partTriMesh.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | cfMesh: A library for mesh generation
4  \\ / O peration |
5  \\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
6  \\/ M anipulation | Copyright (C) Creative Fields, Ltd.
7 -------------------------------------------------------------------------------
8 License
9  This file is part of cfMesh.
10 
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.
15 
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
19  for more details.
20 
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/>.
23 
24 Class
25  partTriMesh
26 
27 Description
28  Triangulation of mesh surface needed for surface smoothing
29 
30 SourceFiles
31  partTriMesh.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef partTriMesh_H
36 #define partTriMesh_H
37 
38 #include "boolList.H"
39 #include "labelLongList.H"
40 #include "VRWGraph.H"
41 #include "DynList.H"
42 #include "HashSet.H"
43 #include "labelledPoint.H"
44 #include "triSurf.H"
45 #include "Map.H"
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 namespace Foam
50 {
51 
52 // Forward declarations
54 class VRWGraph;
55 
56 /*---------------------------------------------------------------------------*\
57  Class partTriMesh Declaration
58 \*---------------------------------------------------------------------------*/
59 
60 class partTriMesh
61 {
62  // Private data
63  //- const reference to the meshSurfacePartitioner
65 
66  //- surface triangulation created from
67  triSurf surf_;
68 
69  //- label of point in the mesh surface
71 
72  //- label of mesh surface point in the partTriMesh
74 
75  //- shall a node be used for smoothing or not
77 
78  // Private data for parallel runs
79  //- global point label
81 
82  //- processor for containing points
83  mutable VRWGraph* pAtProcsPtr_;
84 
85  //- mapping between global and local point labels
87 
88  //- processors which should communicate with the current one
90 
91  //- labels of points at parallel boundaries
93 
94  //- labels of points serving as buffer layers on other processors
96 
97  // Private member functions
98 
99  //- create surface triangulation
101 
102  //- create parallel addressing
104  (
105  const labelList& nodeLabelForPoint,
106  const labelList& nodeLabelForFace
107  );
108 
109  //- create buffer layers
110  void createBufferLayers();
111 
112  //- update buffer layer points
113  void updateBufferLayers();
114 
115  //- disallow bitwise assignment
116  void operator=(const partTriMesh&);
117 
118  //- disallow bitwise copy construct
119  partTriMesh(const partTriMesh&);
120 
121 public:
122 
123  // Constructors
124  //- construct from meshSurfacePartitioner
125  partTriMesh(const meshSurfacePartitioner& mPart);
126 
127  //- construct from meshSurfacePartitioner, inverted points
128  //- and the number of additional layers
130  (
131  const meshSurfacePartitioner& mPart,
132  const labelHashSet& invertedPoints,
133  const label additionalLayers = 0
134  );
135 
136  // Enumerators
137 
138  enum vertexTypes
139  {
140  NONE = 0,
141  SMOOTH = 1,
144  BOUNDARY = 16,
146  CORNER = 64
147  };
148 
149  // Destructor
150  ~partTriMesh();
151 
152  // Member functions
153  //- access to points, tets and other data
154  inline const pointField& points() const
155  {
156  return surf_.points();
157  }
158 
159  inline const LongList<labelledTri>& triangles() const
160  {
161  return surf_.facets();
162  }
163 
164  inline const VRWGraph& pointTriangles() const
165  {
166  return surf_.pointFacets();
167  }
168 
169  inline const LongList<direction>& pointType() const
170  {
171  return pointType_;
172  }
173 
174  inline const labelLongList& pointLabelInMeshSurface() const
175  {
177  }
178 
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
182  {
184  }
185 
186  // Access to parallel data
187  inline const labelLongList& globalPointLabel() const
188  {
189  if( !Pstream::parRun() )
190  FatalError << "This is a serial run" << abort(FatalError);
191 
192  return *globalPointLabelPtr_;
193  }
194 
195  inline const VRWGraph& pointAtProcs() const
196  {
197  if( !Pstream::parRun() )
198  FatalError << "This is a serial run" << abort(FatalError);
199 
200  return *pAtProcsPtr_;
201  }
202 
203  inline const Map<label>& globalToLocalPointAddressing() const
204  {
205  if( !Pstream::parRun() )
206  FatalError << "This is a serial run" << abort(FatalError);
207 
209  }
210 
211  inline const DynList<label>& neiProcs() const
212  {
213  if( !Pstream::parRun() )
214  FatalError << "This is a serial run" << abort(FatalError);
215 
216  return *neiProcsPtr_;
217  }
218 
219  inline const labelLongList& pointsAtProcessorBoundaries() const
220  {
221  if( !Pstream::parRun() )
222  FatalError << "This is a serial run" << abort(FatalError);
223 
225  }
226 
227  inline const labelLongList& bufferLayerPoints() const
228  {
229  if( !Pstream::parRun() )
230  FatalError << "This is a serial run" << abort(FatalError);
231 
232  return *pAtBufferLayersPtr_;
233  }
234 
235  // Modifiers
236 
237  //- move the vertex to a new position
238  void updateVertex(const label pointI, const point& newP);
239 
240  //- move vertices to their new positions
241  //- intended for SMP parallelisation
243 
244  //- update coordinates of points in partTriMesh to match the coordinates
245  //- in the mesh surface
246  void updateVertices();
247 
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&);
251 
252  //- return triSurf from this partTriMesh
253  const triSurf& getTriSurf() const
254  {
255  return surf_;
256  }
257 };
258 
259 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
260 
261 } // End namespace Foam
262 
263 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
264 
265 #endif
266 
267 // ************************************************************************* //
Foam::partTriMesh::SMOOTH
@ SMOOTH
Definition: partTriMesh.H:140
triSurf.H
boolList.H
Foam::partTriMesh::NONE
@ NONE
Definition: partTriMesh.H:139
Foam::partTriMesh::globalToLocalPointAddressing
const Map< label > & globalToLocalPointAddressing() const
Definition: partTriMesh.H:202
Foam::partTriMesh::surf_
triSurf surf_
surface triangulation created from
Definition: partTriMesh.H:66
Foam::partTriMesh::points
const pointField & points() const
access to points, tets and other data
Definition: partTriMesh.H:153
VRWGraph.H
Foam::partTriMesh::bufferLayerPoints
const labelLongList & bufferLayerPoints() const
Definition: partTriMesh.H:226
Foam::triSurfPoints::points
const pointField & points() const
access to points
Definition: triSurfPointsI.H:44
Foam::partTriMesh::meshSurfacePointLabelInTriMesh
const labelList & meshSurfacePointLabelInTriMesh() const
Definition: partTriMesh.H:180
Foam::UPstream::parRun
static bool & parRun()
Is this a parallel run?
Definition: UPstream.H:377
Foam::partTriMesh::FACECENTRE
@ FACECENTRE
Definition: partTriMesh.H:141
Foam::Map< label >
Foam::HashSet< label, Hash< label > >
Foam::partTriMesh::globalToLocalPointAddressingPtr_
Map< label > * globalToLocalPointAddressingPtr_
mapping between global and local point labels
Definition: partTriMesh.H:85
Foam::partTriMesh::~partTriMesh
~partTriMesh()
Definition: partTriMesh.C:184
Foam::partTriMesh::pAtProcsPtr_
VRWGraph * pAtProcsPtr_
processor for containing points
Definition: partTriMesh.H:82
Foam::partTriMesh::createParallelAddressing
void createParallelAddressing(const labelList &nodeLabelForPoint, const labelList &nodeLabelForFace)
create parallel addressing
Definition: partTriMeshParallelAddressing.C:48
Foam::partTriMesh::operator=
void operator=(const partTriMesh &)
disallow bitwise assignment
Foam::partTriMesh::createBufferLayers
void createBufferLayers()
create buffer layers
Definition: partTriMeshParallelAddressing.C:259
Foam::LongList< label >
Foam::partTriMesh::mPart_
const meshSurfacePartitioner & mPart_
const reference to the meshSurfacePartitioner
Definition: partTriMesh.H:63
Map.H
Foam::partTriMesh::pointsAtProcessorBoundaries
const labelLongList & pointsAtProcessorBoundaries() const
Definition: partTriMesh.H:218
Foam::partTriMesh::pointType_
LongList< direction > pointType_
shall a node be used for smoothing or not
Definition: partTriMesh.H:75
Foam::partTriMesh::pointType
const LongList< direction > & pointType() const
Definition: partTriMesh.H:168
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
Foam::partTriMesh::PARALLELBOUNDARY
@ PARALLELBOUNDARY
Definition: partTriMesh.H:142
Foam::partTriMesh::updateBufferLayers
void updateBufferLayers()
update buffer layer points
Definition: partTriMeshParallelAddressing.C:441
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::partTriMesh::pAtParallelBoundariesPtr_
labelLongList * pAtParallelBoundariesPtr_
labels of points at parallel boundaries
Definition: partTriMesh.H:91
Foam::partTriMesh::updateVertex
void updateVertex(const label pointI, const point &newP)
move the vertex to a new position
Definition: partTriMesh.C:196
Foam::partTriMesh::vertexTypes
vertexTypes
Definition: partTriMesh.H:137
Foam::partTriMesh::updateVertices
void updateVertices()
Definition: partTriMesh.C:370
Foam::partTriMesh::partTriMesh
partTriMesh(const partTriMesh &)
disallow bitwise copy construct
Foam::partTriMesh::neiProcsPtr_
DynList< label > * neiProcsPtr_
processors which should communicate with the current one
Definition: partTriMesh.H:88
Foam::partTriMesh::pointLabelInMeshSurface_
labelLongList pointLabelInMeshSurface_
label of point in the mesh surface
Definition: partTriMesh.H:69
Foam::partTriMesh::pointLabelInMeshSurface
const labelLongList & pointLabelInMeshSurface() const
Definition: partTriMesh.H:173
Foam::triSurfAddressing::pointFacets
const VRWGraph & pointFacets() const
return point-facets addressing
Definition: triSurfAddressingI.H:43
Foam::partTriMesh::updateVerticesSMP
void updateVerticesSMP(const List< LongList< labelledPoint > > &)
Definition: partTriMesh.C:244
meshSurfacePartitioner
Finds corners and edge points at the surface of the volume mesh.
HashSet.H
Foam::partTriMesh::neiProcs
const DynList< label > & neiProcs() const
Definition: partTriMesh.H:210
Foam::FatalError
error FatalError
labelledPoint.H
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::abort
errorManip< error > abort(error &err)
Definition: errorManip.H:131
Foam::partTriMesh::createPointsAndTrias
void createPointsAndTrias(const List< direction > &)
create surface triangulation
Definition: partTriMeshAddressing.C:44
Foam::partTriMesh::globalPointLabelPtr_
labelLongList * globalPointLabelPtr_
global point label
Definition: partTriMesh.H:79
Foam::partTriMesh::BOUNDARY
@ BOUNDARY
Definition: partTriMesh.H:143
Foam::DynList< label >
Foam::meshSurfacePartitioner
Definition: meshSurfacePartitioner.H:52
Foam::partTriMesh
Definition: partTriMesh.H:59
Foam::partTriMesh::globalPointLabel
const labelLongList & globalPointLabel() const
Definition: partTriMesh.H:186
Foam::partTriMesh::pointAtProcs
const VRWGraph & pointAtProcs() const
Definition: partTriMesh.H:194
Foam::partTriMesh::FEATUREEDGE
@ FEATUREEDGE
Definition: partTriMesh.H:144
Foam::Vector< scalar >
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
VRWGraph
This class is an implementation of a graph with variable column width. The imoplementation is memory ...
labelLongList.H
Foam::triSurfFacets::facets
const LongList< labelledTri > & facets() const
access to facets
Definition: triSurfFacetsI.H:44
Foam::partTriMesh::getTriSurf
const triSurf & getTriSurf() const
return triSurf from this partTriMesh
Definition: partTriMesh.H:252
Foam::partTriMesh::CORNER
@ CORNER
Definition: partTriMesh.H:145
Foam::VRWGraph
Definition: VRWGraph.H:101
Foam::triSurf
Definition: triSurf.H:59
Foam::partTriMesh::pAtBufferLayersPtr_
labelLongList * pAtBufferLayersPtr_
labels of points serving as buffer layers on other processors
Definition: partTriMesh.H:94
Foam::partTriMesh::meshSurfacePointLabelInTriMesh_
labelList meshSurfacePointLabelInTriMesh_
label of mesh surface point in the partTriMesh
Definition: partTriMesh.H:72
Foam::partTriMesh::triangles
const LongList< labelledTri > & triangles() const
Definition: partTriMesh.H:158
Foam::partTriMesh::pointTriangles
const VRWGraph & pointTriangles() const
Definition: partTriMesh.H:163
DynList.H