DelaunayMeshTools.C
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-2015 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
28 #include "DelaunayMeshTools.H"
29 #include "meshTools.H"
30 #include "OFstream.H"
31 #include "pointConversion.H"
32 
33 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
34 
36 (
37  const fileName& fName,
38  const List<Foam::point>& points
39 )
40 {
41  if (points.size())
42  {
43  OFstream str(fName);
44 
45  Pout<< nl
46  << "Writing " << points.size() << " points from pointList to "
47  << str.name() << endl;
48 
49  forAll(points, p)
50  {
52  }
53  }
54 }
55 
56 
58 (
59  const fileName& fName,
60  const List<Vb>& points
61 )
62 {
63  if (points.size())
64  {
65  OFstream str(fName);
66 
67  Pout<< nl
68  << "Writing " << points.size() << " points from pointList to "
69  << str.name() << endl;
70 
71  forAll(points, p)
72  {
74  }
75  }
76 }
77 
78 
80 (
81  const fileName& fName,
82  const pointField& points,
83  const faceList& faces
84 )
85 {
86  OFstream str(fName);
87 
88  Pout<< nl
89  << "Writing points and faces to " << str.name() << endl;
90 
91  forAll(points, p)
92  {
94  }
95 
96  forAll(faces, f)
97  {
98  str<< 'f';
99 
100  const face& fP = faces[f];
101 
102  forAll(fP, p)
103  {
104  str<< ' ' << fP[p] + 1;
105  }
106 
107  str<< nl;
108  }
109 }
110 
111 
112 // ************************************************************************* //
Foam::pointField
vectorField pointField
pointField is a vectorField.
Definition: pointFieldFwd.H:44
meshTools.H
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::DelaunayMeshTools::writeOBJ
void writeOBJ(const fileName &fName, const List< Foam::point > &points)
Write list of points to file.
pointConversion.H
Foam::meshTools::writeOBJ
void writeOBJ(Ostream &os, const point &pt)
Write obj representation of a point.
Definition: meshTools.C:203
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:369
Foam::Pout
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
Foam::topoint
pointFromPoint topoint(const Point &P)
Definition: pointConversion.H:72
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:296
OFstream.H
Foam::DelaunayMeshTools::writeObjMesh
void writeObjMesh(const fileName &fName, const pointField &points, const faceList &faces)
Write an OBJ mesh consisting of points and faces.
DelaunayMeshTools.H
Foam::nl
constexpr char nl
Definition: Ostream.H:404
f
labelList f(nPoints)
Foam::faceList
List< face > faceList
A List of faces.
Definition: faceListFwd.H:47
points
const pointField & points
Definition: gmvOutputHeader.H:1
Foam::point
vector point
Point is a vector.
Definition: point.H:43