1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | cfMesh: A library for mesh generation
5 \\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
6 \\/ M anipulation | Copyright (C) Creative Fields, Ltd.
7 -------------------------------------------------------------------------------
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
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/>.
28 Provides topology addressing of the triangulated surface
33 \*---------------------------------------------------------------------------*/
35 #ifndef triSurfAddressing_H
36 #define triSurfAddressing_H
38 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 #include "edgeLongList.H"
42 #include "triSurfFacets.H"
43 #include "labelledTri.H"
51 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 class triSurfAddressing
56 //- const reference to the points
57 const pointField& points_;
59 // Topology addressing
60 //- const reference to the facets
61 const LongList<labelledTri>& facets_;
63 //- facets connected to a point
64 mutable VRWGraph* pointFacetsPtr_;
66 //- edges in the triangulation
67 mutable edgeLongList* edgesPtr_;
69 //- labels of edges in the triangles
70 mutable VRWGraph* facetEdgesPtr_;
72 //- labels of triangles connected to an edge
73 mutable VRWGraph* edgeFacetsPtr_;
75 //- labels of edges connected to a point
76 mutable VRWGraph* pointEdgesPtr_;
78 //- facets connected tp a facet via edges
79 mutable VRWGraph* facetFacetsEdgesPtr_;
83 mutable vectorField* pointNormalsPtr_;
86 mutable vectorField* facetNormalsPtr_;
89 mutable vectorField* facetCentresPtr_;
91 // Private member functions
92 //- calculate point-facets addressing
93 void calculatePointFacets() const;
95 //- calculate edges, facet-edges and edge-facets addressing
96 void calculateEdges() const;
98 //- calculate facet-edges addresing
99 void calculateFacetEdges() const;
101 //- calculate edge-facets addressing
102 void calculateEdgeFacets() const;
104 //- calculate point-edges addressing
105 void calculatePointEdges() const;
107 //- calculate facet-faceys addressing
108 void calculateFacetFacetsEdges() const;
110 //- calculate point normals
111 void calculatePointNormals() const;
113 //- calculate normals of facets
114 void calculateFacetNormals() const;
116 //- calculate centres of facets
117 void calculateFacetCentres() const;
119 // Disallow bitwise assignment
120 void operator=(const triSurfAddressing&);
122 triSurfAddressing(const triSurfAddressing&);
127 //- Construct from surface triangles
130 const pointField& points,
131 const LongList<labelledTri>& triangles
135 ~triSurfAddressing();
138 //- return point-facets addressing
139 inline const VRWGraph& pointFacets() const;
142 inline const LongList<edge>& edges() const;
144 //- return facet-edges addressing
145 inline const VRWGraph& facetEdges() const;
147 //- return edge-facets addressing
148 inline const VRWGraph& edgeFacets() const;
150 //- return point-edges addressing
151 inline const VRWGraph& pointEdges() const;
153 //- return facet-facets addressing
154 inline const VRWGraph& facetFacets() const;
156 //- return point normals
157 inline const pointField& pointNormals() const;
159 //- return normals of facets
160 inline const vectorField& facetNormals() const;
162 //- return centres of facets
163 inline const vectorField& facetCentres() const;
166 void clearAddressing();
168 //- delete geometry data
169 void clearGeometry();
172 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
174 } // End namespace Foam
176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
178 #include "triSurfAddressingI.H"
180 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
184 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //