polyMeshGenAddressingEdgeCells.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( ecPtr_ )
39  {
40  FatalErrorIn("polyMeshGenAddressing::calcEdgeCells() const")
41  << "edgeCells already calculated"
42  << abort(FatalError);
43  }
44  else
45  {
46  const VRWGraph& ce = cellEdges();
47 
48  ecPtr_ = new VRWGraph();
49  VRWGraph& edgeCellAddr = *ecPtr_;
50 
51  VRWGraphSMPModifier(edgeCellAddr).reverseAddressing(ce);
52  edgeCellAddr.setSize(edges().size());
53  }
54 }
55 
56 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
57 
59 {
60  if( !ecPtr_ )
61  {
62  # ifdef USE_OMP
63  if( omp_in_parallel() )
65  (
66  "const VRWGraph& polyMeshGenAddressing::edgeCells() const"
67  ) << "Calculating addressing inside a parallel region."
68  << " This is not thread safe" << exit(FatalError);
69  # endif
70 
71  calcEdgeCells();
72  }
73 
74  return *ecPtr_;
75 }
76 
77 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
78 
79 } // End namespace Foam
80 
81 // ************************************************************************* //
Foam::polyMeshGenAddressing::cellEdges
const VRWGraph & cellEdges() const
Definition: polyMeshGenAddressingCellEdges.C:127
VRWGraphSMPModifier.H
Foam::VRWGraph::setSize
void setSize(const label)
Reset the number of rows.
Definition: VRWGraphI.H:132
Foam::FatalError
error FatalError
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::abort
errorManip< error > abort(error &err)
Definition: errorManip.H:131
Foam::polyMeshGenAddressing::edges
const edgeList & edges() const
Return mesh edges.
Definition: polyMeshGenAddressingEdges.C:157
Foam::polyMeshGenAddressing::edgeCells
const VRWGraph & edgeCells() const
Definition: polyMeshGenAddressingEdgeCells.C:58
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::calcEdgeCells
void calcEdgeCells() const
Calculate cell-edge addressing.
Definition: polyMeshGenAddressingEdgeCells.C:36
Foam::polyMeshGenAddressing::ecPtr_
VRWGraph * ecPtr_
Edge-cells.
Definition: polyMeshGenAddressing.H:88
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