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 Coupled patch information with registry support.
33 University of Massachusetts Amherst
40 \*---------------------------------------------------------------------------*/
45 #include "regIOobject.H"
46 #include "labelList.H"
47 #include "pointField.H"
48 #include "fieldTypes.H"
52 #include "labelPair.H"
55 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
60 /*---------------------------------------------------------------------------*\
61 Class coupleMap Declaration
62 \*---------------------------------------------------------------------------*/
73 //- Enumerants for entity-types
100 //- Enumerants for operations
106 COLLAPSE_MIDPOINT = 3,
117 mutable bool twoDMesh_;
119 // Flags for coupled entities
120 mutable bool isLocal_;
121 mutable bool isSend_;
123 // Patch index for coupled entities
124 mutable label patchIndex_;
126 // Master / slave indices
127 mutable label masterIndex_;
128 mutable label slaveIndex_;
131 mutable pointField pointBuffer_;
132 mutable pointField oldPointBuffer_;
134 // List of points that are required
135 // during patch sub-mesh creation
136 mutable labelList subMeshPoints_;
137 mutable List<labelPair> globalProcPoints_;
139 // Entity sizes (as specified by the entityType enumerant)
140 mutable FixedList<label,10> nEntities_;
143 mutable FixedList<Map<label>,4> entityMap_;
144 mutable FixedList<Map<label>,4> reverseEntityMap_;
146 // Entity Buffers (as specified by the entityType enumerant)
147 mutable FixedList<labelList,12> entityBuffer_;
149 // List of entity indices with topological operations
150 mutable labelList entityIndices_;
152 // List of operations performed on entities
153 mutable List<opType> entityOperations_;
155 // List of point-locations to move points to
156 mutable pointField moveNewPoints_;
157 mutable pointField moveOldPoints_;
159 // Addressing for field mapping
160 mutable labelList faceMap_;
161 mutable labelList cellMap_;
163 //- Demand-driven connectivity data.
164 mutable edgeList* edgesPtr_;
165 mutable faceList* facesPtr_;
166 mutable labelListList* faceEdgesPtr_;
168 void makeEdges() const;
169 void makeFaces() const;
171 void makeFaceMap() const;
172 void makeCellMap() const;
174 void clearAddressing() const;
176 //- Disallow default bitwise assignment
177 void operator=(const coupleMap&);
181 // Static data members
183 //- The set of names corresponding to the operationType enumeration
184 // Includes an extra entry for "invalid".
185 static const char* names[INVALID + 1];
187 //- Runtime type information
188 TypeName("coupleMap");
190 // Static Member Functions
192 //- Return a text representation of an opType
193 static const char* asText(const opType);
197 //- Construct from components
204 const label patchIndex,
205 const label masterIndex,
206 const label slaveIndex
209 //- Construct as copy
210 coupleMap(const coupleMap&);
214 virtual ~coupleMap();
216 //- Interpolation functions
218 //- Interpolate point field
220 tmp<Field<Type> > pointInterpolate
222 const Map<label>& mPointMap,
223 const Map<label>& sPointMap,
224 const Field<Type>& pf,
229 tmp<Field<Type> > pointInterpolate
231 const Map<label>& mPointMap,
232 const Map<label>& sPointMap,
233 const tmp<Field<Type> >& tpf,
237 //- Interpolate face field
239 tmp<Field<Type> > faceInterpolate
243 const Field<Type>& pf,
248 tmp<Field<Type> > faceInterpolate
252 const tmp<Field<Type> >& tpf,
258 inline label& patchIndex() const;
260 inline label masterIndex() const;
261 inline label slaveIndex() const;
263 inline bool isTwoDMesh() const;
264 inline bool isLocal() const;
265 inline bool isProcessor() const;
266 inline bool isSend() const;
267 inline bool isRecv() const;
269 pointField& pointBuffer() const;
270 pointField& oldPointBuffer() const;
272 labelList& subMeshPoints() const;
273 List<labelPair>& globalProcPoints() const;
275 void allocateBuffers() const;
315 inline FixedList<label,10>& nEntities() const;
316 inline label& nEntities(const label eType) const;
318 inline Map<label>& entityMap(const label eType) const;
319 inline Map<label>& reverseEntityMap(const label eType) const;
321 inline FixedList<labelList,12>& entityBuffer() const;
322 inline labelList& entityBuffer(const label eType) const;
324 inline labelList& entityIndices() const;
325 inline List<opType>& entityOperations() const;
327 inline pointField& moveNewPoints() const;
328 inline pointField& moveOldPoints() const;
334 const point& newPoint = vector::zero,
335 const point& oldPoint = vector::zero
338 //- Demand-driven data
339 label nInternalFaces() const;
340 const labelList& owner() const;
341 const labelList& neighbour() const;
342 const edgeList& edges() const;
343 const faceList& faces() const;
344 const labelListList& faceEdges() const;
346 const labelList& faceMap() const;
347 const labelList& cellMap() const;
352 Map<label>& newEntityMap,
353 Map<label>& newReverseEntityMap
356 void clearMaps() const;
358 void clearBuffers() const;
360 bool readData(Istream&);
362 bool writeData(Ostream&) const;
365 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
367 } // End namespace Foam
369 #include "coupleMapI.H"
371 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
375 // ************************************************************************* //