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/>.
24 \*---------------------------------------------------------------------------*/
26 #include "tetPointFieldDecomposer.H"
27 #include "processorTetPolyPatchFields.H"
28 #include "globalTetPolyPatchFields.H"
30 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
35 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
38 tmp<GeometricField<Type, tetPolyPatchField, tetPointMesh> >
39 tetPointFieldDecomposer::decomposeField
41 const GeometricField<Type, tetPolyPatchField, tetPointMesh>& field
44 // Create and map the internal field values
45 Field<Type> internalField(field.internalField(), directAddressing());
47 // Create and map the patch field values
48 PtrList<tetPolyPatchField<Type> > patchFields
50 boundaryAddressing_.size() + 1
53 forAll (boundaryAddressing_, patchI)
55 if (boundaryAddressing_[patchI] >= 0)
60 tetPolyPatchField<Type>::New
63 [boundaryAddressing_[patchI]],
64 processorMesh_.boundary()[patchI],
65 DimensionedField<Type, tetPointMesh>::null(),
66 *patchFieldDecompPtrs_[patchI]
75 new ProcessorPointPatchField
80 processorTetPolyPatch,
85 processorMesh_.boundary()[patchI],
86 DimensionedField<Type, tetPointMesh>::null()
92 // Add the global patch by hand. This needs to be present on
96 patchFields.size() - 1,
97 new GlobalPointPatchField
107 processorMesh_.boundary().globalPatch(),
108 DimensionedField<Type, tetPointMesh>::null()
112 // Create the field for the processor
113 return tmp<GeometricField<Type, tetPolyPatchField, tetPointMesh> >
115 new GeometricField<Type, tetPolyPatchField, tetPointMesh>
120 processorMesh_().time().timeName(),
135 tmp<GeometricField<Type, elementPatchField, elementMesh> >
136 tetPointFieldDecomposer::decomposeField
138 const GeometricField<Type, elementPatchField, elementMesh>& field
141 // Create and map the internal field values
142 Field<Type> internalField(field.internalField(), cellAddressing_);
144 // Create and map the patch field values
145 PtrList<elementPatchField<Type> > patchFields
147 boundaryAddressing_.size() + 1
150 forAll (boundaryAddressing_, patchI)
152 if (boundaryAddressing_[patchI] >= 0)
157 elementPatchField<Type>::New
159 field.boundaryField()
160 [boundaryAddressing_[patchI]],
161 processorMesh_.boundary()[patchI],
162 DimensionedField<Type, elementMesh>::null(),
163 *patchFieldDecompPtrs_[patchI]
172 new ProcessorPointPatchField
177 processorTetPolyPatch,
182 processorMesh_.boundary()[patchI],
183 DimensionedField<Type, elementMesh>::null()
189 // Add the global patch by hand. This needs to be present on
193 patchFields.size() - 1,
194 new GlobalPointPatchField
204 processorMesh_.boundary().globalPatch(),
205 DimensionedField<Type, elementMesh>::null()
209 // Create the field for the processor
210 return tmp<GeometricField<Type, elementPatchField, elementMesh> >
212 new GeometricField<Type, elementPatchField, elementMesh>
217 processorMesh_().time().timeName(),
231 template<class GeoField>
232 void tetPointFieldDecomposer::decomposeFields
234 const PtrList<GeoField>& fields
237 forAll (fields, fieldI)
239 decomposeField(fields[fieldI])().write();
244 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
246 } // End namespace Foam
248 // ************************************************************************* //