polyMeshGenAddressingPointFaces.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | cfMesh: A library for mesh generation
4  \\ / O peration |
5  \\ / A nd | Copyright held by the original author
6  \\/ M anipulation |
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 \*---------------------------------------------------------------------------*/
25 
26 #include "polyMeshGenAddressing.H"
27 #include "VRWGraphSMPModifier.H"
28 
29 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
30 
31 namespace Foam
32 {
33 
34 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
35 
37 {
38  if( pfPtr_)
39  {
40  FatalErrorIn("polyMeshGenAddressing::calcPointFaces()")
41  << "pointFaces already calculated"
42  << abort(FatalError);
43  }
44  else
45  {
46  const faceListPMG& faces = mesh_.faces();
47  const label nPoints = mesh_.points().size();
48 
49  //- create the addressing
50  pfPtr_ = new VRWGraph();
51  VRWGraph& pointFaceAddr = *pfPtr_;
52 
53  VRWGraphSMPModifier(pointFaceAddr).reverseAddressing(faces);
54  pointFaceAddr.setSize(nPoints);
55  }
56 }
57 
58 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
59 
61 {
62  if( !pfPtr_ )
63  {
64  # ifdef USE_OMP
65  if( omp_in_parallel() )
67  (
68  "const VRWGraph& polyMeshGenAddressing::pointFaces() const"
69  ) << "Calculating addressing inside a parallel region."
70  << " This is not thread safe" << exit(FatalError);
71  # endif
72 
74  }
75 
76  return *pfPtr_;
77 }
78 
79 
80 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
81 
82 } // End namespace Foam
83 
84 // ************************************************************************* //
Foam::polyMeshGenAddressing::mesh_
const polyMeshGenCells & mesh_
reference to the mesh
Definition: polyMeshGenAddressing.H:74
Foam::polyMeshGenPoints::points
const pointFieldPMG & points() const
access to points
Definition: polyMeshGenPointsI.H:44
Foam::polyMeshGenFaces::faces
const faceListPMG & faces() const
access to faces
Definition: polyMeshGenFacesI.H:43
nPoints
label nPoints
Definition: gmvOutputHeader.H:2
Foam::polyMeshGenAddressing::pfPtr_
VRWGraph * pfPtr_
Point-faces.
Definition: polyMeshGenAddressing.H:97
Foam::polyMeshGenAddressing::pointFaces
const VRWGraph & pointFaces() const
Definition: polyMeshGenAddressingPointFaces.C:60
VRWGraphSMPModifier.H
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::polyMeshGenAddressing::calcPointFaces
void calcPointFaces() const
Calculate point-face addressing.
Definition: polyMeshGenAddressingPointFaces.C:36
Foam::VRWGraph::setSize
void setSize(const label)
Reset the number of rows.
Definition: VRWGraphI.H:132
Foam::pointFieldPMG::size
label size() const
return the number of used elements
Definition: pointFieldPMGI.H:71
Foam::FatalError
error FatalError
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::abort
errorManip< error > abort(error &err)
Definition: errorManip.H:131
Foam::VRWGraphSMPModifier::reverseAddressing
void reverseAddressing(const GraphType &origGraph)
Definition: VRWGraphSMPModifierTemplates.C:111
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
FatalErrorIn
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
Definition: error.H:313
Foam::VRWGraphSMPModifier
Definition: VRWGraphSMPModifier.H:50
Foam::faceListPMG
Definition: faceListPMG.H:50
Foam::VRWGraph
Definition: VRWGraph.H:101
polyMeshGenAddressing.H