1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
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
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26 tetPointFieldDecomposer
29 Tetrahedral point field decomposer.
32 tetPointFieldDecomposer.C
33 tetPointFieldDecomposerDecomposeFields.C
35 \*---------------------------------------------------------------------------*/
37 #ifndef tetPointFieldDecomposer_H
38 #define tetPointFieldDecomposer_H
40 #include "tetPolyMesh.H"
41 #include "tetPointMesh.H"
42 #include "elementMesh.H"
43 #include "tetPolyPatch.H"
44 #include "PointPatchFieldMapperPatchRef.H"
45 #include "tetPolyPatchFields.H"
46 #include "elementPatchFields.H"
47 #include "GeometricField.H"
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
54 /*---------------------------------------------------------------------------*\
55 Class tetPointFieldDecomposer Declaration
56 \*---------------------------------------------------------------------------*/
58 class tetPointFieldDecomposer
62 //- Patch field decomposer class
63 class tetPolyPatchFieldDecomposer
65 public PointPatchFieldMapperPatchRef<tetPolyPatch>
69 //- Size before mapping
70 label sizeBeforeMapping_;
72 //- Reference to direct addressing
73 const labelList& directAddressing_;
79 mutable labelList* directPatchAddressingPtr_;
82 // Private Member Functions
84 //- Disallow default bitwise copy construct
85 tetPolyPatchFieldDecomposer
87 const tetPolyPatchFieldDecomposer&
90 //- Disallow default bitwise assignment
91 void operator=(const tetPolyPatchFieldDecomposer&);
94 // Member functions to calculate demand driven data
96 //- Calculate addressing
97 void calcPatchAddressing() const;
104 //- Construct given addressing
105 tetPolyPatchFieldDecomposer
107 const tetPolyPatch& sourcePatch,
108 const tetPolyPatch& targetPatch,
109 const labelList& directAddr
112 PointPatchFieldMapperPatchRef<tetPolyPatch>
117 sizeBeforeMapping_(sourcePatch.size()),
118 directAddressing_(directAddr),
119 directPatchAddressingPtr_(NULL)
125 virtual ~tetPolyPatchFieldDecomposer()
131 virtual label size() const
133 return directAddressing().size();
136 virtual label sizeBeforeMapping() const
138 return sizeBeforeMapping_;
141 virtual bool direct() const
146 virtual const unallocLabelList& directAddressing() const
148 if (!directPatchAddressingPtr_)
150 calcPatchAddressing();
153 return *directPatchAddressingPtr_;
161 //- Reference to original mesh
162 const tetPolyMesh& originalMesh_;
164 //- Reference to processor mesh
165 const tetPolyMesh& processorMesh_;
167 //- Reference to point addressing
168 const labelList& pointAddressing_;
170 //- Reference to face addressing
171 const labelList& faceAddressing_;
173 //- Reference to cell addressing
174 const labelList& cellAddressing_;
176 //- Reference to boundary addressing
177 const labelList& boundaryAddressing_;
179 //- List of patch field decomposers
180 List<tetPolyPatchFieldDecomposer*> patchFieldDecompPtrs_;
182 // Demand-driven data
185 mutable labelList* directAddressingPtr_;
188 // Private Member Functions
190 //- Disallow default bitwise copy construct
191 tetPointFieldDecomposer
193 const tetPointFieldDecomposer&
196 //- Disallow default bitwise assignment
197 void operator=(const tetPointFieldDecomposer&);
199 // Member functions for demand driven data
201 //- Return addressing
202 const labelList& directAddressing() const;
204 //- Calculate addressing
205 void calcAddressing() const;
212 //- Construct from components
213 tetPointFieldDecomposer
215 const tetPolyMesh& originalMesh,
216 const tetPolyMesh& processorMesh,
217 const labelList& pointAddressing,
218 const labelList& faceAddressing,
219 const labelList& cellAddressing,
220 const labelList& boundaryAddressing
225 ~tetPointFieldDecomposer();
230 //- Decompose point field
232 tmp<GeometricField<Type, tetPolyPatchField, tetPointMesh> >
235 const GeometricField<Type, tetPolyPatchField, tetPointMesh>&
238 //- Decompose element field
240 tmp<GeometricField<Type, elementPatchField, elementMesh> >
243 const GeometricField<Type, elementPatchField, elementMesh>&
246 template<class GeoField>
247 void decomposeFields(const PtrList<GeoField>& fields) const;
251 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
253 } // End namespace Foam
255 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
258 # include "tetPointFieldDecomposerDecomposeFields.C"
261 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
265 // ************************************************************************* //