mapNearestMethod.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::mapNearestMethod
26 
27 Description
28  Map nearest mesh-to-mesh interpolation class
29 
30  Not volume conservative.
31  - cells outside other meshes bounding box do not get mapped
32  (initial filtering)
33  - all remaining cells will be mapped (with weight 1!)
34  - so take care when mapping meshes with different bounding boxes!
35 
36 SourceFiles
37  mapNearestMethod.C
38 
39 \*---------------------------------------------------------------------------*/
40 
41 #ifndef mapNearestMethod_H
42 #define mapNearestMethod_H
43 
44 #include "meshToMeshMethod.H"
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 
51 /*---------------------------------------------------------------------------*\
52  Class mapNearestMethod Declaration
53 \*---------------------------------------------------------------------------*/
54 
55 class mapNearestMethod
56 :
57  public meshToMeshMethod
58 {
59 protected:
60 
61  // Protected Member Functions
62 
63  //- Find indices of overlapping cells in src and tgt meshes - returns
64  // true if found a matching pair
65  virtual bool findInitialSeeds
66  (
67  const labelList& srcCellIDs,
68  const boolList& mapFlag,
69  const label startSeedI,
70  label& srcSeedI,
71  label& tgtSeedI
72  ) const;
73 
74  //- Calculate the mesh-to-mesh addressing and weights
75  virtual void calculateAddressing
76  (
77  labelListList& srcToTgtCellAddr,
78  scalarListList& srcToTgtCellWght,
79  labelListList& tgtToSrcCellAddr,
80  scalarListList& tgtToSrcCellWght,
81  const label srcSeedI,
82  const label tgtSeedI,
83  const labelList& srcCellIDs,
84  boolList& mapFlag,
85  label& startSeedI
86  );
87 
88  //- Find the nearest cell on mesh2 for cell1 on mesh1
89  virtual void findNearestCell
90  (
91  const polyMesh& mesh1,
92  const polyMesh& mesh2,
93  const label cell1,
94  label& cell2
95  ) const;
96 
97  //- Set the next cells for the marching front algorithm
98  virtual void setNextNearestCells
99  (
100  label& startSeedI,
101  label& srcCellI,
102  label& tgtCellI,
103  boolList& mapFlag,
104  const labelList& srcCellIDs
105  ) const;
106 
107  //- Find a source cell mapped to target cell tgtCellI
108  virtual label findMappedSrcCell
109  (
110  const label tgtCellI,
111  const List<DynamicList<label> >& tgtToSrc
112  ) const;
113 
114  //- Disallow default bitwise copy construct
116 
117  //- Disallow default bitwise assignment
118  void operator=(const mapNearestMethod&);
119 
120 
121 public:
122 
123  //- Run-time type information
124  TypeName("mapNearest");
125 
126  //- Construct from source and target meshes
127  mapNearestMethod(const polyMesh& src, const polyMesh& tgt);
128 
129  //- Destructor
130  virtual ~mapNearestMethod();
131 
132 
133  // Member Functions
134 
135  // Evaluate
136 
137  //- Calculate addressing and weights and optionally offset vectors
138  virtual void calculate
139  (
140  labelListList& srcToTgtAddr,
141  scalarListList& srcToTgtWght,
142  pointListList& srcToTgtVec,
143  labelListList& tgtToSrcAddr,
144  scalarListList& tgtToSrcWght,
145  pointListList& tgtToSrcVec
146  );
147 };
148 
149 
150 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
151 
152 } // End namespace Foam
153 
154 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
155 
156 #endif
157 
158 // ************************************************************************* //
Foam::mapNearestMethod::operator=
void operator=(const mapNearestMethod &)
Disallow default bitwise assignment.
Foam::mapNearestMethod::setNextNearestCells
virtual void setNextNearestCells(label &startSeedI, label &srcCellI, label &tgtCellI, boolList &mapFlag, const labelList &srcCellIDs) const
Set the next cells for the marching front algorithm.
Definition: mapNearestMethod.C:242
Foam::mapNearestMethod::calculate
virtual void calculate(labelListList &srcToTgtAddr, scalarListList &srcToTgtWght, pointListList &srcToTgtVec, labelListList &tgtToSrcAddr, scalarListList &tgtToSrcWght, pointListList &tgtToSrcVec)
Calculate addressing and weights and optionally offset vectors.
Definition: mapNearestMethod.C:349
Foam::mapNearestMethod
Map nearest mesh-to-mesh interpolation class.
Definition: mapNearestMethod.H:54
Foam::DynamicList< label >
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
Foam::mapNearestMethod::~mapNearestMethod
virtual ~mapNearestMethod()
Destructor.
Definition: mapNearestMethod.C:342
Foam::meshToMeshMethod
Base class for mesh-to-mesh calculation methods.
Definition: meshToMeshMethod.H:48
Foam::meshToMeshMethod::src
const polyMesh & src() const
Return const access to the source mesh.
Definition: meshToMeshMethodI.H:26
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
Foam::mapNearestMethod::findInitialSeeds
virtual bool findInitialSeeds(const labelList &srcCellIDs, const boolList &mapFlag, const label startSeedI, label &srcSeedI, label &tgtSeedI) const
Find indices of overlapping cells in src and tgt meshes - returns.
Definition: mapNearestMethod.C:43
Foam::mapNearestMethod::findMappedSrcCell
virtual label findMappedSrcCell(const label tgtCellI, const List< DynamicList< label > > &tgtToSrc) const
Find a source cell mapped to target cell tgtCellI.
Definition: mapNearestMethod.C:285
Foam::mapNearestMethod::calculateAddressing
virtual void calculateAddressing(labelListList &srcToTgtCellAddr, scalarListList &srcToTgtCellWght, labelListList &tgtToSrcCellAddr, scalarListList &tgtToSrcCellWght, const label srcSeedI, const label tgtSeedI, const labelList &srcCellIDs, boolList &mapFlag, label &startSeedI)
Calculate the mesh-to-mesh addressing and weights.
Definition: mapNearestMethod.C:93
Foam::meshToMeshMethod::tgt
const polyMesh & tgt() const
Return const access to the target mesh.
Definition: meshToMeshMethodI.H:32
Foam::mapNearestMethod::mapNearestMethod
mapNearestMethod(const mapNearestMethod &)
Disallow default bitwise copy construct.
Foam::mapNearestMethod::findNearestCell
virtual void findNearestCell(const polyMesh &mesh1, const polyMesh &mesh2, const label cell1, label &cell2) const
Find the nearest cell on mesh2 for cell1 on mesh1.
Definition: mapNearestMethod.C:205
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
meshToMeshMethod.H
Foam::mapNearestMethod::TypeName
TypeName("mapNearest")
Run-time type information.
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59