polyMeshGenAddressingPointCells.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( pcPtr_ )
39  {
40  FatalErrorIn("polyMeshGenAddressing::calcPointCells() const")
41  << "pointCells already calculated"
42  << abort(FatalError);
43  }
44  else
45  {
46  const VRWGraph& cellPoints = this->cellPoints();
47 
48  //- create the storage
49  pcPtr_ = new VRWGraph();
50  VRWGraph& pointCellAddr = *pcPtr_;
51 
53  pointCellAddr.setSize(mesh_.points().size());
54  }
55 }
56 
57 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
58 
60 {
61  if( !pcPtr_ )
62  {
63  # ifdef USE_OMP
64  if( omp_in_parallel() )
66  (
67  "const VRWGraph& polyMeshGenAddressing::pointCells() const"
68  ) << "Calculating addressing inside a parallel region."
69  << " This is not thread safe" << exit(FatalError);
70  # endif
71 
73  }
74 
75  return *pcPtr_;
76 }
77 
78 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
79 
80 } // End namespace Foam
81 
82 // ************************************************************************* //
Foam::polyMeshGenAddressing::mesh_
const polyMeshGenCells & mesh_
reference to the mesh
Definition: polyMeshGenAddressing.H:74
Foam::polyMeshGenAddressing::cellPoints
const VRWGraph & cellPoints() const
Definition: polyMeshGenAddressingCellPoints.C:122
Foam::polyMeshGenPoints::points
const pointFieldPMG & points() const
access to points
Definition: polyMeshGenPointsI.H:44
Foam::polyMeshGenAddressing::pointCells
const VRWGraph & pointCells() const
Definition: polyMeshGenAddressingPointCells.C:59
VRWGraphSMPModifier.H
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
Foam::polyMeshGenAddressing::pcPtr_
VRWGraph * pcPtr_
Point-cells.
Definition: polyMeshGenAddressing.H:91
FatalErrorIn
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
Definition: error.H:313
Foam::VRWGraphSMPModifier
Definition: VRWGraphSMPModifier.H:50
Foam::VRWGraph
Definition: VRWGraph.H:101
polyMeshGenAddressing.H
Foam::polyMeshGenAddressing::calcPointCells
void calcPointCells() const
Calculate point-cell addressing.
Definition: polyMeshGenAddressingPointCells.C:36