Home
Downloads
Documentation
Installation
User Guide
man-pages
API Documentation
README
Release Notes
Changes
License
Support
SourceForge Project
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
src
triSurface
tools
labelledTri
labelledTriI.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) 1991-2010 OpenCFD Ltd.
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
Description
25
26
\*---------------------------------------------------------------------------*/
27
28
#include <
OpenFOAM/IOstreams.H
>
29
30
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
31
32
namespace
Foam
33
{
34
35
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
36
37
//- Construct null
38
inline
labelledTri::labelledTri
()
39
:
40
region_(-1)
41
{}
42
43
44
//- Construct from components
45
inline
labelledTri::labelledTri
46
(
47
const
label
A
,
48
const
label B,
49
const
label
C
,
50
const
label region
51
)
52
:
53
triFace
(A, B, C),
54
region_(region)
55
{}
56
57
58
inline
labelledTri::labelledTri
(
Istream
& is)
59
{
60
operator>>
(is, *
this
);
61
}
62
63
64
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
65
66
inline
label
labelledTri::region
()
const
67
{
68
return
region_;
69
}
70
71
inline
label&
labelledTri::region
()
72
{
73
return
region_;
74
}
75
76
77
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
78
79
inline
Istream
&
operator>>
(
Istream
& is,
labelledTri
& t)
80
{
81
if
(is.
format
() ==
IOstream::ASCII
)
82
{
83
// Read beginning of labelledTri point pair
84
is.
readBegin
(
"labelledTri"
);
85
86
is >>
static_cast<
triFace
&
>
(t) >> t.region_;
87
88
// Read end of labelledTri point pair
89
is.
readEnd
(
"labelledTri"
);
90
}
91
else
92
{
93
is.
read
(reinterpret_cast<char*>(&t),
sizeof
(
labelledTri
));
94
}
95
96
// Check state of Ostream
97
is.
check
(
"Istream& operator>>(Istream&, labelledTri&)"
);
98
99
return
is;
100
}
101
102
103
inline
Ostream
&
operator<<
(
Ostream
& os,
const
labelledTri
& t)
104
{
105
if
(os.
format
() ==
IOstream::ASCII
)
106
{
107
os <<
token::BEGIN_LIST
108
<<
static_cast<
const
triFace
&
>
(t) <<
token::SPACE
<< t.region_
109
<<
token::END_LIST
;
110
}
111
else
112
{
113
os.
write
114
(
115
reinterpret_cast<const char*>(&t),
116
sizeof
(
labelledTri
)
117
);
118
}
119
120
// Check state of Ostream
121
os.
check
(
"Ostream& operator<<(Ostream&, const labelledTri&)"
);
122
123
124
return
os;
125
}
126
127
128
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
129
130
}
// End namespace Foam
131
132
// ************************ vim: set sw=4 sts=4 et: ************************ //