PolyhedronReader.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) 2015 OpenFOAM Foundation
9 Copyright (C) 2020 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
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\*---------------------------------------------------------------------------*/
28
29#include "PolyhedronReader.H"
30
31// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * //
32
33template<class HDS>
35{
36 // Postcondition: hds is a valid polyhedral surface.
37 CGAL::Polyhedron_incremental_builder_3<HDS> B(hds, true);
38
39 B.begin_surface(s_.nPoints(), s_.size());
40
41 typedef typename HDS::Vertex Vertex;
42 typedef typename Vertex::Point Point;
43
44 for (const auto& pt : s_.points())
45 {
46 B.add_vertex(Point(pt.x(), pt.y(), pt.z()));
47 }
48
49 for (const auto& f : s_)
50 {
51 B.begin_facet();
52
53 for (const label verti : f)
54 {
55 B.add_vertex_to_facet(verti);
56 }
57
58 B.end_facet();
59 }
60
61 B.end_surface();
62}
63
64
65// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
66
68{
69 Build_triangle<HalfedgeDS> triangle(s);
70 p.delegate(triangle);
71
72 // Populate index and region
73 Foam::label nTris = 0;
74
75 for
76 (
77 Facet_iterator fi = p.facets_begin();
78 fi != p.facets_end();
79 ++fi
80 )
81 {
82 fi->index = nTris;
83 fi->region = s[nTris].region();
84
85 ++nTris;
86 }
87}
88
89
90// ************************************************************************* //
static const Foam::dimensionedScalar B("", Foam::dimless, 18.678)
Polyhedron::Facet_iterator Facet_iterator
CGAL::Polyhedron_3< K, My_items > Polyhedron
CGAL::Point_3< K > Point
graph_traits< Graph >::vertex_descriptor Vertex
Definition: SloanRenumber.C:74
Ostream & operator()() const
Output stream (master only).
Definition: ensightCaseI.H:74
volScalarField & p
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
labelList f(nPoints)