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/>.
28 An interface class that provides patch coupling functionality
32 University of Massachusetts Amherst
38 \*---------------------------------------------------------------------------*/
44 #include "coupleMap.H"
45 #include "volFieldsFwd.H"
46 #include "fvPatchFieldMapper.H"
51 // Class forward declarations
54 /*---------------------------------------------------------------------------*\
55 Class coupledInfo Declaration
56 \*---------------------------------------------------------------------------*/
58 template <class MeshType>
64 // Reference to the parent mesh
65 const MeshType& mesh_;
67 // Auto pointer to a subMesh
68 autoPtr<MeshType> subMesh_;
70 // Flag to determine whether maps have been built.
73 // For locally coupled patches,
74 // specify a master / slave index
77 // Zone IDs for patches associated with faceZones
78 label masterFaceZone_;
81 // Private member functions
83 // Disallow default bitwise assignment
84 inline void operator=(const coupledInfo&);
90 // Construct given mesh, coupleMap and master / slave indices
94 const coupleMap& cMap,
95 const label mfzIndex = -1,
96 const label sfzIndex = -1
99 // Construct from components
102 const MeshType& mesh,
103 const bool isTwoDMesh,
106 const label patchIndex,
109 const label mfzIndex = -1,
110 const label sfzIndex = -1
115 // Return a const reference to the parent mesh
116 inline const MeshType& baseMesh() const;
119 inline void setMesh(label index, MeshType* mesh);
121 // Return a reference to the subMesh
122 inline MeshType& subMesh();
124 // Return a const reference to the subMesh
125 inline const MeshType& subMesh() const;
127 // Return if maps have been built
128 inline bool builtMaps() const;
130 // Set internal state of maps as built
131 inline void setBuiltMaps();
133 // Return a reference to the coupleMap
134 inline coupleMap& map();
136 // Return a const reference to the coupleMap
137 inline const coupleMap& map() const;
139 // Return the master face zone ID
140 inline label masterFaceZone() const;
142 // Return the slave face zone ID
143 inline label slaveFaceZone() const;
147 //- Generic subMesh mapper
150 public fvPatchFieldMapper
152 label sizeBeforeMapping_;
154 labelField directAddressing_;
160 //- Construct from components
167 sizeBeforeMapping_(sbm),
168 directAddressing_(da)
171 //- Construct given addressing
174 const coupledInfo& cInfo,
180 virtual ~subMeshMapper()
187 return directAddressing_.size();
190 label sizeBeforeMapping() const
192 return sizeBeforeMapping_;
200 const unallocLabelList& directAddressing() const
202 return directAddressing_;
206 // Subset geometric field
207 template <class GeomField, class ZeroType>
212 const ZeroType& zeroValue,
213 const labelList& internalMapper
216 // Subset geometric fields from registry to output stream
217 template <class GeomField, class ZeroType>
220 const wordList& fieldNames,
221 const word& fieldType,
222 const ZeroType& zeroValue,
223 const labelList& internalMapper,
227 // Set geometric field pointers from input dictionary
228 template <class GeomField>
231 const wordList& fieldNames,
232 const dictionary& fieldDicts,
233 const label internalSize,
234 PtrList<GeomField>& fields
237 // Resize map for individual field
238 template <class GeomField>
239 static void resizeMap
241 const label srcIndex,
242 const subMeshMapper& internalMapper,
243 const List<labelList>& internalReverseMaps,
244 const PtrList<subMeshMapper>& boundaryMapper,
245 const List<labelListList>& boundaryReverseMaps,
246 const List<PtrList<GeomField> >& srcFields,
250 // Resize map for all fields in registry
251 template <class GeomField>
252 static void resizeMap
254 const wordList& fieldNames,
255 const objectRegistry& mesh,
256 const subMeshMapper& internalMapper,
257 const List<labelList>& internalReverseMaps,
258 const PtrList<subMeshMapper>& boundaryMapper,
259 const List<labelListList>& boundaryReverseMaps,
260 const List<PtrList<GeomField> >& srcFields
263 // Resize boundaryFields for all fields in the registry
264 template <class GeomField>
265 static void resizeBoundaries
267 const objectRegistry& mesh,
268 const fvBoundaryMesh& boundary
272 } // End namespace Foam
274 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
277 # include "coupledInfo.C"
280 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
284 // ************************************************************************* //