DelaunayMeshTools.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::DelaunayMeshTools
26 
27 Description
28  Collection of functions for operating on a Delaunay mesh. Includes:
29 
30  - Functions for writing to an OBJ file
31  - Functions for extracting fields from the Delaunay triangulation
32 
33 SourceFiles
34  DelaunayMeshToolsI.H
35  DelaunayMeshTools.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef DelaunayMeshTools_H
40 #define DelaunayMeshTools_H
41 
42 #include "fileName.H"
43 #include "List.H"
44 #include "point.H"
46 #include "indexedVertexEnum.H"
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 namespace Foam
51 {
52 
53 /*---------------------------------------------------------------------------*\
54  Namespace DelaunayMeshTools Declaration
55 \*---------------------------------------------------------------------------*/
56 
57 namespace DelaunayMeshTools
58 {
59 
60 // OBJ writing
61 
62  //- Write list of points to file
63  void writeOBJ(const fileName& fName, const List<Foam::point>& points);
64 
65  //- Write list of points to file
66  void writeOBJ(const fileName& fName, const List<Vb>& points);
67 
68  //- Write an OBJ mesh consisting of points and faces
69  void writeObjMesh
70  (
71  const fileName& fName,
72  const pointField& points,
73  const faceList& faces
74  );
75 
76  //- Write Delaunay points in the range between (and including)
77  // type startPointType and endPointType to an OBJ file
78  template<class Triangulation>
79  void writeOBJ
80  (
81  const fileName& fName,
82  const Triangulation& t,
83  const indexedVertexEnum::vertexType startPointType,
84  const indexedVertexEnum::vertexType endPointType
85  );
86 
87  //- Write Delaunay points of type pointType to .obj file
88  template<class Triangulation>
89  void writeOBJ
90  (
91  const fileName& fName,
92  const Triangulation& t,
93  const indexedVertexEnum::vertexType pointType
94  );
95 
96  //- Write the fixed Delaunay points to an OBJ file
97  template<class Triangulation>
98  void writeFixedPoints(const fileName& fName, const Triangulation& t);
99 
100  //- Write the boundary Delaunay points to an OBJ file
101  template<class Triangulation>
102  void writeBoundaryPoints(const fileName& fName, const Triangulation& t);
103 
104  //- Write the processor interface to an OBJ file
105  template<class Triangulation>
107  (
108  const fileName& fName,
109  const Triangulation& t,
110  const faceList& faces
111  );
112 
113  //- Write the internal Delaunay vertices of the tessellation as a
114  // pointField that may be used to restart the meshing process
115  template<class Triangulation>
117  (
118  const fileName& instance,
119  const Triangulation& t
120  );
121 
122  //- Draws a tet cell to an output stream. The offset is supplied as the tet
123  // number to be drawn.
124  template<class CellHandle>
125  void drawDelaunayCell(Ostream& os, const CellHandle& c, label offset = 0);
126 
127 
128 // Field extraction
129 
130  //- Extract all points in vertex-index order
131  template<class Triangulation>
132  tmp<pointField> allPoints(const Triangulation& t);
133 
134 
135 } // End namespace DelaunayMeshTools
136 
137 
138 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
139 
140 } // End namespace Foam
141 
142 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
143 
144 #ifdef NoRepository
146 #endif
147 
148 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
149 
150 #endif
151 
152 // ************************************************************************* //
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
A class for handling file names.
Definition: fileName.H:69
void writeOBJ(const fileName &fName, const List< Foam::point > &points)
Write list of points to file.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
void drawDelaunayCell(Ostream &os, const CellHandle &c, label offset=0)
Draws a tet cell to an output stream. The offset is supplied as the tet.
void writeObjMesh(const fileName &fName, const pointField &points, const faceList &faces)
Write an OBJ mesh consisting of points and faces.
const pointField & points
Collection of functions for operating on a Delaunay mesh. Includes:
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
void writeProcessorInterface(const fileName &fName, const Triangulation &t, const faceList &faces)
Write the processor interface to an OBJ file.
void writeFixedPoints(const fileName &fName, const Triangulation &t)
Write the fixed Delaunay points to an OBJ file.
void writeBoundaryPoints(const fileName &fName, const Triangulation &t)
Write the boundary Delaunay points to an OBJ file.
const dimensionedScalar c
Speed of light in a vacuum.
tmp< pointField > allPoints(const Triangulation &t)
Extract all points in vertex-index order.
CGAL data structures used for 3D Delaunay meshing.
A class for managing temporary objects.
Definition: PtrList.H:54
void writeInternalDelaunayVertices(const fileName &instance, const Triangulation &t)
Write the internal Delaunay vertices of the tessellation as a.
Namespace for OpenFOAM.