Moving cfMesh into place. Updated contibutors list
[foam-extend-3.2.git] / src / mesh / cfMesh / meshLibrary / utilities / meshes / polyMeshGenAddressing / polyMeshGenAddressingPointEdges.C
blob1aa2eac7058cfcd7b6de0fd15487ea2cc094a122
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.
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
19     for more details.
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/>.
24 \*---------------------------------------------------------------------------*/
26 #include "polyMeshGenAddressing.H"
27 #include "VRWGraphSMPModifier.H"
29 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
31 namespace Foam
34 // * * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * //
36 void polyMeshGenAddressing::calcPointEdges() const
38     if( pePtr_)
39     {
40         FatalErrorIn("polyMeshGenAddressing::calcPointEdges() const")
41             << "pointEdges already calculated"
42             << abort(FatalError);
43     }
44     else
45     {
46         const edgeList& e = edges();
48         //- create the addressing
49         pePtr_ = new VRWGraph();
50         VRWGraph& pointEdgeAddr = *pePtr_;
52         VRWGraphSMPModifier(pointEdgeAddr).reverseAddressing(e);
53         pointEdgeAddr.setSize(mesh_.points().size());
54     }
57 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
59 const VRWGraph& polyMeshGenAddressing::pointEdges() const
61     if( !pePtr_ )
62     {
63         # ifdef USE_OMP
64         if( omp_in_parallel() )
65             FatalErrorIn
66             (
67                 "const VRWGraph& polyMeshGenAddressing::pointEdges() const"
68             ) << "Calculating addressing inside a parallel region."
69                 << " This is not thread safe" << exit(FatalError);
70         # endif
72         calcPointEdges();
73     }
75     return *pePtr_;
79 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
81 } // End namespace Foam
83 // ************************************************************************* //