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
29 An interface class that provides patch coupling functionality
33 University of Massachusetts Amherst
39 \*---------------------------------------------------------------------------*/
45 #include "coupleMap.H"
46 #include "volFieldsFwd.H"
47 #include "surfaceFieldsFwd.H"
48 #include "fvPatchFieldMapper.H"
53 // Class forward declarations
54 class dynamicTopoFvMesh;
56 /*---------------------------------------------------------------------------*\
57 Class coupledInfo Declaration
58 \*---------------------------------------------------------------------------*/
62 // Reference to the parent mesh
63 const dynamicTopoFvMesh& mesh_;
65 // Auto pointer to a subMesh
66 autoPtr<dynamicTopoFvMesh> subMesh_;
68 // Flag to determine whether maps have been built.
71 // For locally coupled patches,
72 // specify a master / slave index
75 // Zone IDs for patches associated with faceZones
76 label masterFaceZone_;
79 //- Disallow default bitwise assignment
80 inline void operator=(const coupledInfo&);
87 const dynamicTopoFvMesh& mesh,
88 const coupleMap& cMap,
89 const label mfzIndex = -1,
90 const label sfzIndex = -1
95 const dynamicTopoFvMesh& mesh,
96 const bool isTwoDMesh,
99 const label patchIndex,
102 const label mfzIndex = -1,
103 const label sfzIndex = -1
108 // Return a const reference to the parent mesh
109 inline const dynamicTopoFvMesh& baseMesh() const;
112 inline void setMesh(label index, dynamicTopoFvMesh* mesh);
114 // Return a reference to the subMesh
115 inline dynamicTopoFvMesh& subMesh();
117 // Return a const reference to the subMesh
118 inline const dynamicTopoFvMesh& subMesh() const;
120 // Have maps been built?
121 inline bool builtMaps() const;
124 inline void setBuiltMaps();
126 // Return a reference to the coupleMap
127 inline coupleMap& map();
129 // Return a const reference to the coupleMap
130 inline const coupleMap& map() const;
132 // Return the master / slave face zone IDs
133 inline label masterFaceZone() const;
134 inline label slaveFaceZone() const;
138 //- Generic subMesh mapper
141 public fvPatchFieldMapper
143 label sizeBeforeMapping_;
145 labelField directAddressing_;
151 //- Construct from components
158 sizeBeforeMapping_(sbm),
159 directAddressing_(da)
162 //- Construct given addressing
165 const coupledInfo& cInfo,
171 virtual ~subMeshMapper()
178 return directAddressing_.size();
181 label sizeBeforeMapping() const
183 return directAddressing_.size();
191 const unallocLabelList& directAddressing() const
193 return directAddressing_;
197 // Set subMesh centres
198 inline void setCentres(PtrList<volVectorField>& centres) const;
200 // Subset volume field
201 template <class Type>
202 tmp<GeometricField<Type, fvPatchField, volMesh> >
205 const GeometricField<Type, fvPatchField, volMesh>& field
208 // Subset surface field
209 template <class Type>
210 tmp<GeometricField<Type, fvsPatchField, surfaceMesh> >
213 const GeometricField<Type, fvsPatchField, surfaceMesh>& field
216 // Subset the volume fields from registry to output stream
217 template <class Type>
220 const wordList& fieldNames,
221 const word& fieldType,
225 // Subset the surface field from registry to output stream
226 template <class Type>
229 const wordList& fieldNames,
230 const word& fieldType,
234 // Set volume field pointer from input dictionary
235 template <class GeomField>
238 const wordList& fieldNames,
239 const dictionary& fieldDicts,
240 PtrList<GeomField>& fields
243 // Resize map for individual field
244 template <class GeomField>
245 static void resizeMap
247 const label srcIndex,
248 const subMeshMapper& internalMapper,
249 const List<labelList>& internalReverseMaps,
250 const PtrList<subMeshMapper>& boundaryMapper,
251 const List<labelListList>& boundaryReverseMaps,
252 const List<PtrList<GeomField> >& srcFields,
256 // Resize map for all fields in registry
257 template <class GeomField>
258 static void resizeMap
260 const wordList& fieldNames,
261 const objectRegistry& mesh,
262 const subMeshMapper& internalMapper,
263 const List<labelList>& internalReverseMaps,
264 const PtrList<subMeshMapper>& boundaryMapper,
265 const List<labelListList>& boundaryReverseMaps,
266 const List<PtrList<GeomField> >& srcFields
270 } // End namespace Foam
272 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
275 # include "coupledInfo.C"
278 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
282 // ************************************************************************* //