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(const tetPolyPatchFieldDecomposer&);
87 //- Disallow default bitwise assignment
88 void operator=(const tetPolyPatchFieldDecomposer&);
91 // Member functions to calculate demand driven data
93 //- Calculate addressing
94 void calcPatchAddressing() const;
101 //- Construct given addressing
102 tetPolyPatchFieldDecomposer
104 const tetPolyPatch& sourcePatch,
105 const tetPolyPatch& targetPatch,
106 const labelList& directAddr
109 PointPatchFieldMapperPatchRef<tetPolyPatch>
114 sizeBeforeMapping_(sourcePatch.size()),
115 directAddressing_(directAddr),
116 directPatchAddressingPtr_(NULL)
122 virtual ~tetPolyPatchFieldDecomposer()
128 virtual label size() const
130 return directAddressing().size();
133 virtual label sizeBeforeMapping() const
135 return sizeBeforeMapping_;
138 virtual bool direct() const
143 virtual const unallocLabelList& directAddressing() const
145 if (!directPatchAddressingPtr_)
147 calcPatchAddressing();
150 return *directPatchAddressingPtr_;
158 //- Reference to original mesh
159 const tetPolyMesh& originalMesh_;
161 //- Reference to processor mesh
162 const tetPolyMesh& processorMesh_;
164 //- Reference to point addressing
165 const labelList& pointAddressing_;
167 //- Reference to face addressing
168 const labelList& faceAddressing_;
170 //- Reference to cell addressing
171 const labelList& cellAddressing_;
173 //- Reference to boundary addressing
174 const labelList& boundaryAddressing_;
176 //- List of patch field decomposers
177 List<tetPolyPatchFieldDecomposer*> patchFieldDecompPtrs_;
179 // Demand-driven data
182 mutable labelList* directAddressingPtr_;
185 // Private Member Functions
187 //- Disallow default bitwise copy construct
188 tetPointFieldDecomposer
190 const tetPointFieldDecomposer&
193 //- Disallow default bitwise assignment
194 void operator=(const tetPointFieldDecomposer&);
196 // Member functions for demand driven data
198 //- Return addressing
199 const labelList& directAddressing() const;
201 //- Calculate addressing
202 void calcAddressing() const;
209 //- Construct from components
210 tetPointFieldDecomposer
212 const tetPolyMesh& originalMesh,
213 const tetPolyMesh& processorMesh,
214 const labelList& pointAddressing,
215 const labelList& faceAddressing,
216 const labelList& cellAddressing,
217 const labelList& boundaryAddressing
222 ~tetPointFieldDecomposer();
227 //- Decompose point field
229 tmp<GeometricField<Type, tetPolyPatchField, tetPointMesh> >
232 const GeometricField<Type, tetPolyPatchField, tetPointMesh>&
235 //- Decompose element field
237 tmp<GeometricField<Type, elementPatchField, elementMesh> >
240 const GeometricField<Type, elementPatchField, elementMesh>&
243 template<class GeoField>
244 void decomposeFields(const PtrList<GeoField>& fields) const;
248 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
250 } // End namespace Foam
252 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
255 # include "tetPointFieldDecomposerDecomposeFields.C"
258 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
262 // ************************************************************************* //