1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation, either version 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
25 tetPointFieldDecomposer
28 Tetrahedral point field decomposer.
31 tetPointFieldDecomposer.C
32 tetPointFieldDecomposerDecomposeFields.C
34 \*---------------------------------------------------------------------------*/
36 #ifndef tetPointFieldDecomposer_H
37 #define tetPointFieldDecomposer_H
39 #include "tetPolyMesh.H"
40 #include "tetPointMesh.H"
41 #include "elementMesh.H"
42 #include "tetPolyPatch.H"
43 #include "PointPatchFieldMapperPatchRef.H"
44 #include "tetPolyPatchFields.H"
45 #include "elementPatchFields.H"
46 #include "GeometricField.H"
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 /*---------------------------------------------------------------------------*\
54 Class tetPointFieldDecomposer Declaration
55 \*---------------------------------------------------------------------------*/
57 class tetPointFieldDecomposer
61 //- Patch field decomposer class
62 class tetPolyPatchFieldDecomposer
64 public PointPatchFieldMapperPatchRef<tetPolyPatch>
68 //- Size before mapping
69 label sizeBeforeMapping_;
71 //- Reference to direct addressing
72 const labelList& directAddressing_;
78 mutable labelList* directPatchAddressingPtr_;
81 // Private Member Functions
83 //- Disallow default bitwise copy construct
84 tetPolyPatchFieldDecomposer
86 const tetPolyPatchFieldDecomposer&
89 //- Disallow default bitwise assignment
90 void operator=(const tetPolyPatchFieldDecomposer&);
93 // Member functions to calculate demand driven data
95 //- Calculate addressing
96 void calcPatchAddressing() const;
103 //- Construct given addressing
104 tetPolyPatchFieldDecomposer
106 const tetPolyPatch& sourcePatch,
107 const tetPolyPatch& targetPatch,
108 const labelList& directAddr
111 PointPatchFieldMapperPatchRef<tetPolyPatch>
116 sizeBeforeMapping_(sourcePatch.size()),
117 directAddressing_(directAddr),
118 directPatchAddressingPtr_(NULL)
124 virtual ~tetPolyPatchFieldDecomposer()
130 virtual label size() const
132 return directAddressing().size();
135 virtual label sizeBeforeMapping() const
137 return sizeBeforeMapping_;
140 virtual bool direct() const
145 virtual const unallocLabelList& directAddressing() const
147 if (!directPatchAddressingPtr_)
149 calcPatchAddressing();
152 return *directPatchAddressingPtr_;
160 //- Reference to original mesh
161 const tetPolyMesh& originalMesh_;
163 //- Reference to processor mesh
164 const tetPolyMesh& processorMesh_;
166 //- Reference to point addressing
167 const labelList& pointAddressing_;
169 //- Reference to face addressing
170 const labelList& faceAddressing_;
172 //- Reference to cell addressing
173 const labelList& cellAddressing_;
175 //- Reference to boundary addressing
176 const labelList& boundaryAddressing_;
178 //- List of patch field decomposers
179 List<tetPolyPatchFieldDecomposer*> patchFieldDecompPtrs_;
181 // Demand-driven data
184 mutable labelList* directAddressingPtr_;
187 // Private Member Functions
189 //- Disallow default bitwise copy construct
190 tetPointFieldDecomposer
192 const tetPointFieldDecomposer&
195 //- Disallow default bitwise assignment
196 void operator=(const tetPointFieldDecomposer&);
198 // Member functions for demand driven data
200 //- Return addressing
201 const labelList& directAddressing() const;
203 //- Calculate addressing
204 void calcAddressing() const;
211 //- Construct from components
212 tetPointFieldDecomposer
214 const tetPolyMesh& originalMesh,
215 const tetPolyMesh& processorMesh,
216 const labelList& pointAddressing,
217 const labelList& faceAddressing,
218 const labelList& cellAddressing,
219 const labelList& boundaryAddressing
224 ~tetPointFieldDecomposer();
229 //- Decompose point field
231 tmp<GeometricField<Type, tetPolyPatchField, tetPointMesh> >
234 const GeometricField<Type, tetPolyPatchField, tetPointMesh>&
237 //- Decompose element field
239 tmp<GeometricField<Type, elementPatchField, elementMesh> >
242 const GeometricField<Type, elementPatchField, elementMesh>&
245 template<class GeoField>
246 void decomposeFields(const PtrList<GeoField>& fields) const;
250 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
252 } // End namespace Foam
254 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
257 # include "tetPointFieldDecomposerDecomposeFields.C"
260 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
264 // ************************************************************************* //