parTriFace.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | cfMesh: A library for mesh generation
4  \\ / O peration |
5  \\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
6  \\/ M anipulation | Copyright (C) Creative Fields, Ltd.
7 -------------------------------------------------------------------------------
8 License
9  This file is part of cfMesh.
10 
11  cfMesh 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  cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  parTriFace
26 
27 Description
28  Hold point labels and their coordinates. It is used for exchanging data
29  over processors
30 
31 SourceFiles
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef parTriFace_H
36 #define parTriFace_H
37 
38 #include "label.H"
39 #include "point.H"
40 #include "triangle.H"
41 #include "contiguous.H"
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 /*---------------------------------------------------------------------------*\
49  Class parTriFace Declaration
50 \*---------------------------------------------------------------------------*/
51 
52 class parTriFace
53 {
54  // Private data
56 
58 
59  public:
60 
61  // Constructors
62 
63  inline parTriFace()
64  :
66  {}
67 
68  explicit inline parTriFace
69  (
70  const label globalLabel0,
71  const label globalLabel1,
72  const label globalLabel2,
73  const triangle<point, point>& pts
74  )
75  :
76  triPoints_(pts)
77  {
78  globalLabels_[0] = globalLabel0;
79  globalLabels_[1] = globalLabel1;
80  globalLabels_[2] = globalLabel2;
81  }
82 
83  // Destructor
84 
85  ~parTriFace()
86  {}
87 
88  // Member functions
89 
90  inline label globalLabelOfPoint(const label i) const
91  {
92  return globalLabels_[i];
93  }
94 
95  inline const triangle<point, point>& trianglePoints() const
96  {
97  return triPoints_;
98  }
99 
100  // Member operators
101 
102  inline bool operator !=(const parTriFace& /*ptf*/) const
103  {
104  Serr << "parTriFace::operator!= Not implemented" << endl;
105  ::exit(1);
106  }
107 
108  // Friend operators
109 
110  inline friend Ostream& operator<<(Ostream& os, const parTriFace& ptf)
111  {
112  os << token::BEGIN_LIST;
113  os << ptf.globalLabels_[0] << token::SPACE;
114  os << ptf.globalLabels_[1] << token::SPACE;
115  os << ptf.globalLabels_[2] << token::SPACE;
116  os << ptf.triPoints_ << token::END_LIST;
117 
118  // Check state of Ostream
119  os.check("operator<<(Ostream&, const parTriFace&");
120  return os;
121  }
122 
123  inline friend Istream& operator>>(Istream& is, parTriFace& ptf)
124  {
125  // Read beginning of parTriFace
126  is.readBegin("parTriFace");
127 
128  is >> ptf.globalLabels_[0];
129  is >> ptf.globalLabels_[1];
130  is >> ptf.globalLabels_[2];
131  is >> ptf.triPoints_;
132 
133  // Read end of parHelper
134  is.readEnd("parTriFace");
135 
136  // Check state of Istream
137  is.check("operator>>(Istream&, parTriFace");
138 
139  return is;
140  }
141 };
142 
143 //- Specify data associated with parTriFace type is contiguous
144 template<>
145 inline bool contiguous<parTriFace>() {return true;}
146 
147 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
148 
149 } // End namespace Foam
150 
151 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
152 
153 #endif
154 
155 // ************************************************************************* //
Foam::parTriFace
Definition: parTriFace.H:51
Foam::parTriFace::operator>>
friend Istream & operator>>(Istream &is, parTriFace &ptf)
Definition: parTriFace.H:122
Foam::Istream::readEnd
Istream & readEnd(const char *funcName)
Definition: Istream.C:105
triangle.H
Foam::parTriFace::globalLabelOfPoint
label globalLabelOfPoint(const label i) const
Definition: parTriFace.H:89
point.H
Foam::parTriFace::trianglePoints
const triangle< point, point > & trianglePoints() const
Definition: parTriFace.H:94
Foam::parTriFace::parTriFace
parTriFace()
Definition: parTriFace.H:62
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
Foam::parTriFace::globalLabels_
label globalLabels_[3]
Definition: parTriFace.H:54
Foam::parTriFace::operator<<
friend Ostream & operator<<(Ostream &os, const parTriFace &ptf)
Definition: parTriFace.H:109
Foam::triangle
A triangle primitive used to calculate face normals and swept volumes.
Definition: triangle.H:59
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:57
Foam::Serr
OSstream Serr(cerr, "Serr")
Definition: IOstreams.H:52
Foam::parTriFace::operator!=
bool operator!=(const parTriFace &) const
Definition: parTriFace.H:101
Foam::IOstream::check
virtual bool check(const char *operation) const
Check IOstream status for given operation.
Definition: IOstream.C:92
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::parTriFace::~parTriFace
~parTriFace()
Definition: parTriFace.H:84
Foam::parTriFace::triPoints_
triangle< point, point > triPoints_
Definition: parTriFace.H:56
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
Foam::token::BEGIN_LIST
@ BEGIN_LIST
Definition: token.H:100
Foam::Vector< scalar >
label.H
contiguous.H
Template function to specify if the data of a type are contiguous.
Foam::contiguous< parTriFace >
bool contiguous< parTriFace >()
Specify data associated with parTriFace type is contiguous.
Definition: parTriFace.H:144
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
Foam::Istream::readBegin
Istream & readBegin(const char *funcName)
Definition: Istream.C:88
Foam::token::END_LIST
@ END_LIST
Definition: token.H:101
Foam::token::SPACE
@ SPACE
Definition: token.H:95
Foam::zero
A class representing the concept of 0 used to avoid unnecessary manipulations for objects that are kn...
Definition: zero.H:47