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 Coupled patch information with registry support.
32 University of Massachusetts Amherst
39 \*---------------------------------------------------------------------------*/
44 #include "regIOobject.H"
45 #include "labelList.H"
46 #include "pointField.H"
47 #include "fieldTypes.H"
51 #include "labelPair.H"
54 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
59 /*---------------------------------------------------------------------------*\
60 Class coupleMap Declaration
61 \*---------------------------------------------------------------------------*/
72 //- Enumerants for entity-types
102 //- Enumerants for operations
108 COLLAPSE_MIDPOINT = 3,
112 CONVERT_PHYSICAL = 7,
117 typedef FixedList<label, MAX_SIZES> EntitySizeList;
118 typedef FixedList<Map<label>, MAX_ENTITIES> EntityMapList;
119 typedef FixedList<labelList, MAX_BUFFERS> EntityBufferList;
125 mutable bool twoDMesh_;
127 // Flags for coupled entities
128 mutable bool isLocal_;
129 mutable bool isSend_;
131 // Patch index for coupled entities
132 mutable label patchIndex_;
134 // Master / slave indices
135 mutable label masterIndex_;
136 mutable label slaveIndex_;
139 mutable pointField pointBuffer_;
140 mutable pointField oldPointBuffer_;
142 // List of points that are required
143 // during patch sub-mesh creation
144 mutable labelList subMeshPoints_;
145 mutable List<labelPair> globalProcPoints_;
147 // Entity sizes (as specified by the entityType enumerant)
148 mutable EntitySizeList nEntities_;
151 mutable EntityMapList entityMap_;
152 mutable EntityMapList reverseEntityMap_;
154 // Entity Buffers (as specified by the entityType enumerant)
155 mutable EntityBufferList entityBuffer_;
157 // List of entity indices with topological operations
158 mutable labelList entityIndices_;
160 // List of operations performed on entities
161 mutable List<opType> entityOperations_;
163 // Physical patch conversion indices
164 mutable labelList patchIndices_;
166 // List of point-locations to move points to
167 mutable pointField moveNewPoints_;
168 mutable pointField moveOldPoints_;
170 // Addressing for field mapping
171 mutable labelList faceMap_;
172 mutable labelList cellMap_;
173 mutable labelList internalFaceMap_;
175 // Processor point and edge mapping
176 mutable Map<labelList> subMeshPointMap_;
177 mutable Map<labelList> subMeshEdgeMap_;
179 //- Demand-driven connectivity data.
180 mutable edgeList* edgesPtr_;
181 mutable faceList* facesPtr_;
182 mutable labelListList* faceEdgesPtr_;
184 // Private Member Functions
186 void makeEdges() const;
187 void makeFaces() const;
189 void makeFaceMap() const;
190 void makeCellMap() const;
191 void makeInternalFaceMap() const;
193 void clearAddressing() const;
195 //- Disallow default bitwise assignment
196 void operator=(const coupleMap&);
200 // Static data members
202 //- The set of names corresponding to the operationType enumeration
203 // Includes an extra entry for "invalid".
204 static const char* names[INVALID + 1];
206 //- Runtime type information
207 TypeName("coupleMap");
209 // Static Member Functions
211 //- Return a text representation of an opType
212 static const char* asText(const opType);
216 //- Construct from components
223 const label patchIndex,
224 const label masterIndex,
225 const label slaveIndex
228 //- Construct as copy
229 coupleMap(const coupleMap&);
233 virtual ~coupleMap();
235 //- Interpolation functions
237 //- Interpolate point field
239 tmp<Field<Type> > pointInterpolate
241 const Map<label>& mPointMap,
242 const Map<label>& sPointMap,
243 const Field<Type>& pf,
248 tmp<Field<Type> > pointInterpolate
250 const Map<label>& mPointMap,
251 const Map<label>& sPointMap,
252 const tmp<Field<Type> >& tpf,
256 //- Interpolate face field
258 tmp<Field<Type> > faceInterpolate
262 const Field<Type>& pf,
267 tmp<Field<Type> > faceInterpolate
271 const tmp<Field<Type> >& tpf,
277 inline label& patchIndex() const;
279 inline label masterIndex() const;
280 inline label slaveIndex() const;
282 inline bool isTwoDMesh() const;
283 inline bool isLocal() const;
284 inline bool isProcessor() const;
285 inline bool isSend() const;
286 inline bool isRecv() const;
288 pointField& pointBuffer() const;
289 pointField& oldPointBuffer() const;
291 labelList& subMeshPoints() const;
292 List<labelPair>& globalProcPoints() const;
294 void allocateBuffers() const;
334 inline EntitySizeList& nEntities() const;
335 inline label& nEntities(const label eType) const;
337 inline Map<label>& entityMap(const label eType) const;
338 inline Map<label>& reverseEntityMap(const label eType) const;
340 inline EntityBufferList& entityBuffer() const;
341 inline labelList& entityBuffer(const label eType) const;
343 inline labelList& entityIndices() const;
344 inline List<opType>& entityOperations() const;
346 inline labelList& patchIndices() const;
347 inline pointField& moveNewPoints() const;
348 inline pointField& moveOldPoints() const;
350 inline Map<labelList>& subMeshPointMap() const;
351 inline Map<labelList>& subMeshEdgeMap() const;
370 const point& newPoint,
371 const point& oldPoint
374 //- Demand-driven data
375 label nInternalFaces() const;
376 const labelList& owner() const;
377 const labelList& neighbour() const;
378 const edgeList& edges() const;
379 const faceList& faces() const;
380 const labelListList& faceEdges() const;
382 const labelList& faceMap() const;
383 const labelList& cellMap() const;
384 const labelList& internalFaceMap() const;
389 Map<label>& newEntityMap,
390 Map<label>& newReverseEntityMap
393 void clearMaps() const;
395 void clearBuffers() const;
397 bool readData(Istream&);
399 bool writeData(Ostream&) const;
402 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
404 } // End namespace Foam
406 #include "coupleMapI.H"
408 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
412 // ************************************************************************* //