Forward compatibility: flex
[foam-extend-3.2.git] / src / mesh / cfMesh / utilities / helperClasses / parallelHelpers / parTriFace / parTriFace.H
blob1b0741f9dffcab64b0a83e3f26623a895fe3bb39
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.
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.
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.
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/>.
24 Class
25     parTriFace
27 Description
28     Hold point labels and their coordinates. It is used for exchanging data
29     over processors
31 SourceFiles
33 \*---------------------------------------------------------------------------*/
35 #ifndef parTriFace_H
36 #define parTriFace_H
38 #include "label.H"
39 #include "point.H"
40 #include "triangle.H"
41 #include "contiguous.H"
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 namespace Foam
48 /*---------------------------------------------------------------------------*\
49                            Class parTriFace Declaration
50 \*---------------------------------------------------------------------------*/
52 class parTriFace
54     // Private data
55         label globalLabels_[3];
57         triangle<point, point> triPoints_;
59     public:
61     // Constructors
63         inline parTriFace()
64         :
65             triPoints_(vector::zero, vector::zero, vector::zero)
66         {}
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         }
83     // Destructor
85         ~parTriFace()
86         {}
88     // Member functions
90         inline label globalLabelOfPoint(const label i) const
91         {
92             return globalLabels_[i];
93         }
95         inline const triangle<point, point>& trianglePoints() const
96         {
97             return triPoints_;
98         }
100     // Member operators
102         inline bool operator !=(const parTriFace& ptf) const
103         {
104             Serr << "parTriFace::operator!= Not implemented" << endl;
105             ::exit(1);
107             return true;
108         }
110     // Friend operators
112         inline friend Ostream& operator<<(Ostream& os, const parTriFace& ptf)
113         {
114             os << token::BEGIN_LIST;
115             os << ptf.globalLabels_[0] << token::SPACE;
116             os << ptf.globalLabels_[1] << token::SPACE;
117             os << ptf.globalLabels_[2] << token::SPACE;
118             os << ptf.triPoints_ << token::END_LIST;
120             // Check state of Ostream
121             os.check("operator<<(Ostream&, const parTriFace&");
122             return os;
123         }
125         inline friend Istream& operator>>(Istream& is, parTriFace& ptf)
126         {
127             // Read beginning of parTriFace
128             is.readBegin("parTriFace");
130             is >> ptf.globalLabels_[0];
131             is >> ptf.globalLabels_[1];
132             is >> ptf.globalLabels_[2];
133             is >> ptf.triPoints_;
135             // Read end of parHelper
136             is.readEnd("parTriFace");
138             // Check state of Istream
139             is.check("operator>>(Istream&, parTriFace");
141             return is;
142         }
145 //- Specify data associated with parTriFace type is contiguous
146 template<>
147 inline bool contiguous<parTriFace>() {return true;}
149 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
151 } // End namespace Foam
153 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
155 #endif
157 // ************************************************************************* //