STLtriangleI.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | foam-extend: Open Source CFD
4  \\ / O peration | Version: 3.2
5  \\ / A nd | Web: http://www.foam-extend.org
6  \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
8 License
9  This file is part of foam-extend.
10 
11  foam-extend 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.
15 
16  foam-extend is distributed in the hope that it will be useful, but
17  WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  General Public License for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
23 
24 Description
25 
26 \*---------------------------------------------------------------------------*/
27 
28 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
29 
30 namespace Foam
31 {
32 
33 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
34 
35 //- Construct null
37 {}
38 
39 
40 //- Construct from components
42 (
43  const STLpoint& normal,
44  const STLpoint& a,
45  const STLpoint& b,
46  const STLpoint& c,
47  unsigned short region
48 )
49 :
50  normal_(normal),
51  a_(a),
52  b_(b),
53  c_(c),
54  region_(region)
55 {}
56 
57 
58 //- Construct from istream (binary)
59 inline STLtriangle::STLtriangle(istream& is)
60 {
61  read(is);
62 }
63 
64 
65 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
66 
67 inline const STLpoint& STLtriangle::a() const
68 {
69  return a_;
70 }
71 
72 inline const STLpoint& STLtriangle::b() const
73 {
74  return b_;
75 }
76 
77 inline const STLpoint& STLtriangle::c() const
78 {
79  return c_;
80 }
81 
82 inline unsigned short STLtriangle::region() const
83 {
84  return region_;
85 }
86 
87 
88 inline void STLtriangle::read(istream& is)
89 {
90  is.read(reinterpret_cast<char*>(this), 4*sizeof(STLpoint));
91  is.read(reinterpret_cast<char*>(&region_), 2);
92 }
93 
94 
95 inline void STLtriangle::write(ostream& os)
96 {
97  os.write(reinterpret_cast<char*>(this), 4*sizeof(STLpoint));
98  os.write(reinterpret_cast<char*>(&region_), 2);
99 }
100 
101 // * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
102 
103 inline Ostream& operator<<(Ostream& os, const STLtriangle& stlt)
104 {
105  os << stlt.normal_ << token::SPACE
106  << stlt.a_ << token::SPACE
107  << stlt.b_ << token::SPACE
108  << stlt.c_ << token::SPACE
109  << stlt.region_;
110 
111  return os;
112 }
113 
114 
115 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
116 
117 } // End namespace Foam
118 
119 // ************************************************************************* //
Foam::STLtriangle::region
unsigned short region() const
Definition: STLtriangleI.H:82
Foam::STLtriangle::normal_
STLpoint normal_
The face normal, many programs write zore or other junk.
Definition: STLtriangle.H:52
Foam::STLtriangle::b_
STLpoint b_
Definition: STLtriangle.H:52
Foam::constant::physicoChemical::b
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
Definition: createFields.H:28
Foam::operator<<
Ostream & operator<<(Ostream &, const edgeMesh &)
Definition: edgeMeshIO.C:130
Foam::STLtriangle::write
void write(ostream &)
Write to istream (binary)
Definition: STLtriangleI.H:95
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::STLtriangle::b
const STLpoint & b() const
Definition: STLtriangleI.H:72
Foam::STLtriangle::c
const STLpoint & c() const
Definition: STLtriangleI.H:77
Foam::STLtriangle::region_
unsigned short region_
Definition: STLtriangle.H:53
Foam::STLtriangle
A triangle representation for STL files.
Definition: STLtriangle.H:48
Foam::STLpoint
A vertex point representation for STL files.
Definition: STLpoint.H:48
Foam::STLtriangle::read
void read(istream &)
Read from istream (binary)
Definition: STLtriangleI.H:88
Foam::constant::universal::c
const dimensionedScalar c
Speed of light in a vacuum.
Foam::STLtriangle::a_
STLpoint a_
The three points defining the triangle.
Definition: STLtriangle.H:52
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
Foam::STLtriangle::STLtriangle
STLtriangle()
Construct null.
Definition: STLtriangleI.H:36
Foam::STLtriangle::a
const STLpoint & a() const
Definition: STLtriangleI.H:67
normal
A normal distribution model.
Foam::STLtriangle::c_
STLpoint c_
Definition: STLtriangle.H:52
Foam::token::SPACE
@ SPACE
Definition: token.H:95