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
26 globalTetPolyPatchCellDecomp
29 In parallel decompositions of FEM meshes a number of vertices may
30 be shared between more that only two processors. These vertices
31 are typically located on intersections of face processor patches
32 and cause all kinds of trouble, both in terms or organisation and
35 In order to simplify this issue, a processor point communication
36 mechanism caters for all such points for a parallel decomposition.
37 They are colected in a single global list which gets globally
38 communicated (as necessary). A processor point patch knows which
39 local processor points are in the global list and where. In order
40 for this mechanism to work, the multiply-shared points need to be
41 elominated from all other processor patches as well.
43 Note: This patch is created automatically for parallel runs and is
44 not accessible through the run-time selection mechanism as the
45 user may get the construction wrong!
48 globalTetPolyPatchCellDecomp.C
50 \*---------------------------------------------------------------------------*/
52 #ifndef globalTetPolyPatchCellDecomp_H
53 #define globalTetPolyPatchCellDecomp_H
55 #include "tetPolyPatchCellDecomp.H"
56 #include "coupledTetPolyPatchCellDecomp.H"
59 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
64 /*---------------------------------------------------------------------------*\
65 Class globalTetPolyPatchCellDecomp Declaration
66 \*---------------------------------------------------------------------------*/
68 class globalTetPolyPatchCellDecomp
70 public coupledTetPolyPatchCellDecomp
74 //- Global point size - number of all shared points in decomposition
75 label globalPointSize_;
77 //- List of local multiply shared points
78 labelList meshPoints_;
80 //- Addressing into the global point patch
81 labelList sharedPointAddr_;
83 //- Global edge size - number of all shared edges in decomposition
84 label globalEdgeSize_;
86 //- List of local multiply shared edges
89 //- Addressing into the global point patch
90 labelList sharedEdgeAddr_;
92 //- List of local cut edges
93 edgeList meshCutEdges_;
95 //- Local cut edge multiplication mask
96 scalarField meshCutEdgeMask_;
98 //- Index in the boundary mesh
101 // Demand driven private data
103 //- Local edge indices
104 mutable labelList* localEdgeIndicesPtr_;
107 //- Cut edges indices, i.e. the ones originating from the
108 // points on the patch but connected to points which are
109 // internal (not on the patch)
110 mutable labelList* cutEdgeIndicesPtr_;
112 // Edge addressing for cut edges.
113 // Edges are separated into two lists, one where the patch point
114 // is the owner and one for the neighbour. The edges are ordered
115 // such that the first n add a contribution to the vertex zero and
116 // so on; the breaks in the list are stored in the "start"
117 // mechanism, described in lduAddressing. This will be used to
118 // calculate the cross-processor contribution of the vector-matrix
121 //- Cut edges owner list
122 mutable labelList* cutEdgeOwnerIndicesPtr_;
124 //- Cut edge owner starts
125 mutable labelList* cutEdgeOwnerStartPtr_;
127 //- Cut edges neighbour list
128 mutable labelList* cutEdgeNeighbourIndicesPtr_;
130 //- Cut edge neighbour starts
131 mutable labelList* cutEdgeNeighbourStartPtr_;
134 //- Doubly cut edge indices
135 mutable labelList* doubleCutEdgeIndicesPtr_;
137 //- Doubly cut edge owner addressing
138 mutable labelList* doubleCutOwnerPtr_;
140 //- Doubly cut edge neighbour addressing
141 mutable labelList* doubleCutNeighbourPtr_;
143 //- Owner-neighbour-double cut multiplication mask
144 mutable scalarField* ownNeiDoubleMaskPtr_;
147 // Private Member Functions
149 //- Disallow default construct as copy
150 globalTetPolyPatchCellDecomp
152 const globalTetPolyPatchCellDecomp&
155 //- Disallow default assignment
156 void operator=(const globalTetPolyPatchCellDecomp&);
158 // Construction of demand-driven data
160 //- Calculate local points
161 void calcLocalPoints() const;
163 //- Calculate local edge indices
164 void calcLocalEdgesIndices() const;
166 //- Calculate cut edge indices
167 void calcCutEdgeIndices() const;
169 //- Calculate cut edge addressing
170 void calcCutEdgeAddressing() const;
172 //- Clear cut edge addressing
173 void clearCutEdgeAddressing() const;
178 typedef coupledTetPolyPatchCellDecomp CoupledPointPatch;
179 typedef tetPolyBoundaryMeshCellDecomp BoundaryMesh;
182 //- Runtime type information
187 //- Construct from components
188 globalTetPolyPatchCellDecomp
190 const label globalPointSize,
191 const labelList& meshPoints,
192 const labelList& sharedPointAddr,
193 const label globalEdgeSize,
194 const edgeList& meshEdges,
195 const labelList& sharedEdgeAddr,
196 const edgeList& meshCutEdges,
197 const scalarField& meshCutEdgeMask,
198 const tetPolyBoundaryMeshCellDecomp& bm,
205 virtual ~globalTetPolyPatchCellDecomp();
210 virtual const word& name() const
212 // There can only be a single patch of this type - therefore
213 // its name is hard-coded.
218 virtual label size() const
220 return meshPoints().size();
223 //- Return number of faces
224 virtual label nFaces() const
229 //- Return total number of shared points
230 virtual label globalPointSize() const
232 return globalPointSize_;
235 //- Return total number of shared edges
236 virtual label globalEdgeSize() const
238 return globalEdgeSize_;
241 //- Return the index of this patch in the tetPolyBoundaryMeshCellDecomp
242 virtual label index() const
244 return boundaryIndex_;
247 //- Return mesh points
248 virtual const labelList& meshPoints() const
253 //- Return local points. Not implemented
254 virtual const pointField& localPoints() const;
256 //- Return point normals. Not implemented
257 virtual const vectorField& pointNormals() const;
259 //- Face decomposition into triangle. Not implemented
260 virtual triFaceList faceTriangles(const label faceID) const;
262 //- Return complete list of faces. Not implemented
263 virtual faceList triFaces() const;
266 //- Return addressing into the global points list
267 const labelList& sharedPointAddr() const
269 return sharedPointAddr_;
272 //- Return mesh edges
273 virtual const edgeList& meshEdges() const
278 //- Return addressing into the global edge list
279 const labelList& sharedEdgeAddr() const
281 return sharedEdgeAddr_;
284 //- Return cut mesh edges
285 const edgeList& meshCutEdges() const
287 return meshCutEdges_;
290 //- Return cut mesh edges multiplication mask
291 // Warning: this one is in the original cut edge order.
292 // For patch matrix multiplication se the reordered one
293 const scalarField& meshCutEdgeMask() const
295 return meshCutEdgeMask_;
298 // Access functions for demand driven data
300 //- Return list of edge indices for edges local to the patch
301 virtual const labelList& localEdgeIndices() const;
303 //- Return list of edge indices for cut edges
304 // (i.e. connecting points within the patch ot points outside it)
305 virtual const labelList& cutEdgeIndices() const;
307 // Cut edge addressing
309 //- Return cut edge owner edge indices
310 const labelList& cutEdgeOwnerIndices() const;
312 //- Return cut edge owner edge starts
313 const labelList& cutEdgeOwnerStart() const;
315 //- Return cut edge neighbour edge indices
316 const labelList& cutEdgeNeighbourIndices() const;
318 //- Return cut edge neighbour edge starts
319 const labelList& cutEdgeNeighbourStart() const;
321 // Doubly cut edge addressing
323 //- Return doubly cut edge indices
324 const labelList& doubleCutEdgeIndices() const;
326 //- Return doubly cut edge owner addressing
327 // into current patch
328 const labelList& doubleCutOwner() const;
330 //- Return doubly cut edge neighbour addressing
331 // into current patch
332 const labelList& doubleCutNeighbour() const;
334 //- Return cut edge multiplication mask
335 const scalarField& ownNeiDoubleMask() const;
339 virtual void updateMesh();
341 // Dummy functionality for new lduInteface base class
342 // To be removed. HJ, 2/Nov/2007
346 //- Return faceCell addressing
347 virtual const unallocLabelList& faceCells() const
349 return labelList::null();
353 // Interface transfer functions
355 //- Return the values of the given internal data adjacent to
356 // the interface as a field
357 virtual tmp<labelField> interfaceInternalField
359 const unallocLabelList& internalData
362 return tmp<labelField>(NULL);
365 //- Initialise interface data transfer
366 virtual void initTransfer
368 const Pstream::commsTypes commsType,
369 const unallocLabelList& interfaceData
373 //- Transfer and return neighbour field
374 virtual tmp<labelField> transfer
376 const Pstream::commsTypes commsType,
377 const unallocLabelList& interfaceData
380 return tmp<labelField>(NULL);
383 //- Initialise transfer of internal field adjacent to the interface
384 virtual void initInternalFieldTransfer
386 const Pstream::commsTypes commsType,
387 const unallocLabelList& iF
391 //- Transfer and return internal field adjacent to the interface
392 virtual tmp<labelField> internalFieldTransfer
394 const Pstream::commsTypes commsType,
395 const unallocLabelList& iF
398 return tmp<labelField>(NULL);
403 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
405 } // End namespace Foam
407 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
411 // ************************************************************************* //