parPartTet.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  parPartTet
26 
27 Description
28  Holds labels and coordinates of points making a tet.
29  It is used for exchanging data over processors
30 
31 SourceFiles
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef parPartTet_H
36 #define parPartTet_H
37 
38 #include "labelledPoint.H"
39 #include "contiguous.H"
40 
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
43 namespace Foam
44 {
45 
46 /*---------------------------------------------------------------------------*\
47  Class parPartTet Declaration
48 \*---------------------------------------------------------------------------*/
49 
50 class parPartTet
51 {
52  // Private data
54 
55 public:
56 
57  // Constructors
58 
59  inline parPartTet()
60  {}
61 
62  explicit inline parPartTet
63  (
64  const labelledPoint& p0,
65  const labelledPoint& p1,
66  const labelledPoint& p2,
67  const labelledPoint& p3
68  )
69  {
70  pts_[0] = p0;
71  pts_[1] = p1;
72  pts_[2] = p2;
73  pts_[3] = p3;
74  }
75 
76  // Destructor
77 
78  ~parPartTet()
79  {}
80 
81  // Member functions
82 
83  // Member operators
84 
85  inline const labelledPoint& operator[](const label i) const
86  {
87  return pts_[i];
88  }
89 
90  inline bool operator !=(const parPartTet& /*ptf*/) const
91  {
92  Serr << "Not implemented" << endl;
93  ::exit(1);
94 
95  return true;
96  }
97 
98  // Friend operators
99 
100  inline friend Ostream& operator<<(Ostream& os, const parPartTet& ppt)
101  {
102  os << token::BEGIN_LIST;
103  os << ppt.pts_[0] << token::SPACE;
104  os << ppt.pts_[1] << token::SPACE;
105  os << ppt.pts_[2] << token::SPACE;
106  os << ppt.pts_[3];
107  os << token::END_LIST;
108 
109  // Check state of Ostream
110  os.check("operator<<(Ostream&, const parPartTet&");
111  return os;
112  }
113 
114  inline friend Istream& operator>>(Istream& is, parPartTet& ppt)
115  {
116  // Read beginning of parPartTet
117  is.readBegin("parPartTet");
118 
119  for(label i=0;i<4;++i)
120  is >> ppt.pts_[i];
121 
122  // Read end of parHelper
123  is.readEnd("parPartTet");
124 
125  // Check state of Istream
126  is.check("operator>>(Istream&, parPartTet");
127 
128  return is;
129  }
130 };
131 
132 //- Specify data associated with parPartTet type is contiguous
133 template<>
134 inline bool contiguous<parPartTet>() {return true;}
135 
136 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
137 
138 } // End namespace Foam
139 
140 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
141 
142 #endif
143 
144 // ************************************************************************* //
Foam::Istream::readEnd
Istream & readEnd(const char *funcName)
Definition: Istream.C:105
Foam::contiguous< parPartTet >
bool contiguous< parPartTet >()
Specify data associated with parPartTet type is contiguous.
Definition: parPartTet.H:133
Foam::parPartTet
Definition: parPartTet.H:49
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
Foam::parPartTet::operator>>
friend Istream & operator>>(Istream &is, parPartTet &ppt)
Definition: parPartTet.H:113
Foam::parPartTet::parPartTet
parPartTet()
Definition: parPartTet.H:58
Foam::parPartTet::~parPartTet
~parPartTet()
Definition: parPartTet.H:77
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::parPartTet::operator<<
friend Ostream & operator<<(Ostream &os, const parPartTet &ppt)
Definition: parPartTet.H:99
Foam::parPartTet::operator[]
const labelledPoint & operator[](const label i) const
Definition: parPartTet.H:84
Foam::Serr
OSstream Serr(cerr, "Serr")
Definition: IOstreams.H:52
Foam::IOstream::check
virtual bool check(const char *operation) const
Check IOstream status for given operation.
Definition: IOstream.C:92
labelledPoint.H
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
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::labelledPoint
Definition: labelledPoint.H:50
contiguous.H
Template function to specify if the data of a type are contiguous.
Foam::parPartTet::pts_
labelledPoint pts_[4]
Definition: parPartTet.H:52
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::parPartTet::operator!=
bool operator!=(const parPartTet &) const
Definition: parPartTet.H:89
Foam::token::END_LIST
@ END_LIST
Definition: token.H:101
Foam::token::SPACE
@ SPACE
Definition: token.H:95