1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | cfMesh: A library for mesh generation
5 \\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
6 \\/ M anipulation | Copyright (C) Creative Fields, Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of cfMesh.
11 cfMesh 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 cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
28 Triangulation of mesh surface needed for surface smoothing
33 \*---------------------------------------------------------------------------*/
39 #include "labelLongList.H"
43 #include "labelledPoint.H"
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52 // Forward declarations
53 class meshSurfacePartitioner;
56 /*---------------------------------------------------------------------------*\
57 Class partTriMesh Declaration
58 \*---------------------------------------------------------------------------*/
63 //- const reference to the meshSurfacePartitioner
64 const meshSurfacePartitioner& mPart_;
66 //- surface triangulation created from
69 //- label of point in the mesh surface
70 labelLongList pointLabelInMeshSurface_;
72 //- label of mesh surface point in the partTriMesh
73 labelList meshSurfacePointLabelInTriMesh_;
75 //- shall a node be used for smoothing or not
76 LongList<direction> pointType_;
78 // Private data for parallel runs
79 //- global point label
80 mutable labelLongList* globalPointLabelPtr_;
82 //- processor for containing points
83 mutable VRWGraph* pAtProcsPtr_;
85 //- mapping between global and local point labels
86 mutable Map<label>* globalToLocalPointAddressingPtr_;
88 //- processors which should communicate with the current one
89 mutable DynList<label>* neiProcsPtr_;
91 //- labels of points at parallel boundaries
92 mutable labelLongList* pAtParallelBoundariesPtr_;
94 //- labels of points serving as buffer layers on other processors
95 mutable labelLongList* pAtBufferLayersPtr_;
97 // Private member functions
99 //- create surface triangulation
100 void createPointsAndTrias(const List<direction>&);
102 //- create parallel addressing
103 void createParallelAddressing
105 const labelList& nodeLabelForPoint,
106 const labelList& nodeLabelForFace
109 //- create buffer layers
110 void createBufferLayers();
112 //- update buffer layer points
113 void updateBufferLayers();
115 //- disallow bitwise assignment
116 void operator=(const partTriMesh&);
118 //- disallow bitwise copy construct
119 partTriMesh(const partTriMesh&);
124 //- construct from meshSurfacePartitioner
125 partTriMesh(const meshSurfacePartitioner& mPart);
127 //- construct from meshSurfacePartitioner, inverted points
128 //- and the number of additional layers
131 const meshSurfacePartitioner& mPart,
132 const labelHashSet& invertedPoints,
133 const label additionalLayers = 0
143 PARALLELBOUNDARY = 8,
153 //- access to points, tets and other data
154 inline const pointField& points() const
156 return surf_.points();
159 inline const LongList<labelledTri>& triangles() const
161 return surf_.facets();
164 inline const VRWGraph& pointTriangles() const
166 return surf_.pointFacets();
169 inline const LongList<direction>& pointType() const
174 inline const labelLongList& pointLabelInMeshSurface() const
176 return pointLabelInMeshSurface_;
179 //- return indices of mesh sutrface points in the surface triangulation
180 //- additional points which do not exist in mesh surface are labelled -1
181 inline const labelList& meshSurfacePointLabelInTriMesh() const
183 return meshSurfacePointLabelInTriMesh_;
186 // Access to parallel data
187 inline const labelLongList& globalPointLabel() const
189 if( !Pstream::parRun() )
190 FatalError << "This is a serial run" << abort(FatalError);
192 return *globalPointLabelPtr_;
195 inline const VRWGraph& pointAtProcs() const
197 if( !Pstream::parRun() )
198 FatalError << "This is a serial run" << abort(FatalError);
200 return *pAtProcsPtr_;
203 inline const Map<label>& globalToLocalPointAddressing() const
205 if( !Pstream::parRun() )
206 FatalError << "This is a serial run" << abort(FatalError);
208 return *globalToLocalPointAddressingPtr_;
211 inline const DynList<label>& neiProcs() const
213 if( !Pstream::parRun() )
214 FatalError << "This is a serial run" << abort(FatalError);
216 return *neiProcsPtr_;
219 inline const labelLongList& pointsAtProcessorBoundaries() const
221 if( !Pstream::parRun() )
222 FatalError << "This is a serial run" << abort(FatalError);
224 return *pAtParallelBoundariesPtr_;
227 inline const labelLongList& bufferLayerPoints() const
229 if( !Pstream::parRun() )
230 FatalError << "This is a serial run" << abort(FatalError);
232 return *pAtBufferLayersPtr_;
237 //- move the vertex to a new position
238 void updateVertex(const label pointI, const point& newP);
240 //- move vertices to their new positions
241 //- intended for SMP parallelisation
242 void updateVerticesSMP(const List<LongList<labelledPoint> >&);
244 //- update coordinates of points in partTriMesh to match the coordinates
245 //- in the mesh surface
246 void updateVertices();
248 //- update coordinates of points in partTriMesh to match the coordinates
249 //- of the specified points in the mesh surface
250 void updateVertices(const labelLongList&);
252 //- return triSurf from this partTriMesh
253 const triSurf& getTriSurf() const
259 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
261 } // End namespace Foam
263 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
267 // ************************************************************************* //