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-2016 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
138  virtual void calculate
139  (
140  labelListList& srcToTgtAddr,
141  scalarListList& srcToTgtWght,
142  labelListList& tgtToTgtAddr,
143  scalarListList& tgtToTgtWght
144  );
145 };
146 
147 
148 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
149 
150 } // End namespace Foam
151 
152 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
153 
154 #endif
155 
156 // ************************************************************************* //
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.
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
void operator=(const mapNearestMethod &)
Disallow default bitwise assignment.
virtual void setNextNearestCells(label &startSeedI, label &srcCelli, label &tgtCelli, boolList &mapFlag, const labelList &srcCellIDs) const
Set the next cells for the marching front algorithm.
virtual void calculate(labelListList &srcToTgtAddr, scalarListList &srcToTgtWght, labelListList &tgtToTgtAddr, scalarListList &tgtToTgtWght)
Calculate addressing and weights.
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.
const polyMesh & src() const
Return const access to the source mesh.
mapNearestMethod(const mapNearestMethod &)
Disallow default bitwise copy construct.
const polyMesh & tgt() const
Return const access to the target mesh.
Base class for mesh-to-mesh calculation methods.
virtual ~mapNearestMethod()
Destructor.
TypeName("mapNearest")
Run-time type information.
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.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
virtual label findMappedSrcCell(const label tgtCelli, const List< DynamicList< label >> &tgtToSrc) const
Find a source cell mapped to target cell tgtCelli.
Map nearest mesh-to-mesh interpolation class.
Namespace for OpenFOAM.