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