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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2013-2016 OpenFOAM Foundation
9  Copyright (C) 2019 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Namespace
28  Foam::DelaunayMeshTools
29 
30 Description
31  Collection of functions for operating on a Delaunay mesh.
32 
33  Includes:
34  - Functions for writing to an OBJ file
35  - Functions for extracting fields from the Delaunay triangulation
36 
37 SourceFiles
38  DelaunayMeshToolsI.H
39  DelaunayMeshTools.C
40 
41 \*---------------------------------------------------------------------------*/
42 
43 #ifndef DelaunayMeshTools_H
44 #define DelaunayMeshTools_H
45 
46 #include "fileName.H"
47 #include "List.H"
48 #include "point.H"
50 #include "indexedVertexEnum.H"
51 
52 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 
54 namespace Foam
55 {
56 
57 /*---------------------------------------------------------------------------*\
58  Namespace DelaunayMeshTools Declaration
59 \*---------------------------------------------------------------------------*/
60 
61 namespace DelaunayMeshTools
62 {
63 
64 // OBJ writing
65 
66  //- Write list of points to file
67  void writeOBJ(const fileName& fName, const List<Foam::point>& points);
68 
69  //- Write list of points to file
70  void writeOBJ(const fileName& fName, const List<Vb>& points);
71 
72  //- Write an OBJ mesh consisting of points and faces
73  void writeObjMesh
74  (
75  const fileName& fName,
76  const pointField& points,
77  const faceList& faces
78  );
79 
80  //- Write Delaunay points in the range between (and including)
81  // type startPointType and endPointType to an OBJ file
82  template<class Triangulation>
83  void writeOBJ
84  (
85  const fileName& fName,
86  const Triangulation& t,
87  const indexedVertexEnum::vertexType startPointType,
88  const indexedVertexEnum::vertexType endPointType
89  );
90 
91  //- Write Delaunay points of type pointType to .obj file
92  template<class Triangulation>
93  void writeOBJ
94  (
95  const fileName& fName,
96  const Triangulation& t,
97  const indexedVertexEnum::vertexType pointType
98  );
99 
100  //- Write the fixed Delaunay points to an OBJ file
101  template<class Triangulation>
102  void writeFixedPoints(const fileName& fName, const Triangulation& t);
103 
104  //- Write the boundary Delaunay points to an OBJ file
105  template<class Triangulation>
106  void writeBoundaryPoints(const fileName& fName, const Triangulation& t);
107 
108  //- Write the processor interface to an OBJ file
109  template<class Triangulation>
111  (
112  const fileName& fName,
113  const Triangulation& t,
114  const faceList& faces
115  );
116 
117  //- Write the internal Delaunay vertices of the tessellation as a
118  // pointField that may be used to restart the meshing process
119  template<class Triangulation>
121  (
122  const fileName& instance,
123  const Triangulation& t
124  );
125 
126  //- Draws a tet cell to an output stream. The offset is supplied as the tet
127  // number to be drawn.
128  template<class CellHandle>
129  void drawDelaunayCell(Ostream& os, const CellHandle& c, label offset = 0);
130 
131 
132 // Field extraction
133 
134  //- Extract all points in vertex-index order
135  template<class Triangulation>
136  tmp<pointField> allPoints(const Triangulation& t);
137 
138 
139 } // End namespace DelaunayMeshTools
140 
141 
142 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
143 
144 } // End namespace Foam
145 
146 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
147 
148 #ifdef NoRepository
150 #endif
151 
152 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
153 
154 #endif
155 
156 // ************************************************************************* //
Foam::pointField
vectorField pointField
pointField is a vectorField.
Definition: pointFieldFwd.H:44
Foam::DelaunayMeshTools::writeOBJ
void writeOBJ(const fileName &fName, const List< Foam::point > &points)
Write list of points to file.
List.H
point.H
Foam::DelaunayMeshTools::drawDelaunayCell
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.
Foam::indexedVertexEnum::vertexType
vertexType
Definition: indexedVertexEnum.H:52
indexedVertexEnum.H
Foam::DelaunayMeshTools::writeObjMesh
void writeObjMesh(const fileName &fName, const pointField &points, const faceList &faces)
Write an OBJ mesh consisting of points and faces.
fileName.H
os
OBJstream os(runTime.globalPath()/outputName)
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::DelaunayMeshTools::writeProcessorInterface
void writeProcessorInterface(const fileName &fName, const Triangulation &t, const faceList &faces)
Write the processor interface to an OBJ file.
Foam::DelaunayMeshTools::writeBoundaryPoints
void writeBoundaryPoints(const fileName &fName, const Triangulation &t)
Write the boundary Delaunay points to an OBJ file.
Foam::DelaunayMeshTools::writeFixedPoints
void writeFixedPoints(const fileName &fName, const Triangulation &t)
Write the fixed Delaunay points to an OBJ file.
Foam::faceList
List< face > faceList
A List of faces.
Definition: faceListFwd.H:47
points
const pointField & points
Definition: gmvOutputHeader.H:1
Foam::constant::universal::c
const dimensionedScalar c
Speed of light in a vacuum.
DelaunayMeshToolsTemplates.C
Foam::DelaunayMeshTools::allPoints
tmp< pointField > allPoints(const Triangulation &t)
Extract all points in vertex-index order.
Foam::DelaunayMeshTools::writeInternalDelaunayVertices
void writeInternalDelaunayVertices(const fileName &instance, const Triangulation &t)
Write the internal Delaunay vertices of the tessellation as a.
CGALTriangulation3Ddefs.H
CGAL data structures used for 3D Delaunay meshing.