Fixed URL for libccmio-2.6.1 (bug report #5 by Thomas Oliveira)
[foam-extend-3.2.git] / src / mesh / cfMesh / utilities / surfaceTools / meshSurfaceMapper / parMapperHelper.H
blobad9af85cb74c9d541de41d0c0973353f85531413
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     parMapperHelper
27 Description
28     A class containing point coordinates, moving distance,
29     global label of the mapped point and projected patch. It is used for
30     exchanging data over processors
32 SourceFiles
34 \*---------------------------------------------------------------------------*/
36 #ifndef parMapperHelper_H
37 #define parMapperHelper_H
39 #include "label.H"
40 #include "point.H"
41 #include "contiguous.H"
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 namespace Foam
48 /*---------------------------------------------------------------------------*\
49                         Class parMapperHelper Declaration
50 \*---------------------------------------------------------------------------*/
52 class parMapperHelper
54     // Private data
55         point p_;
56         scalar movingDist_;
57         label globalLabel_;
58         label patch_;
60     public:
62     // Constructors
63         explicit inline parMapperHelper()
64         :
65             p_(),
66             movingDist_(),
67             globalLabel_(-1),
68             patch_(-1)
69         {};
71         explicit inline parMapperHelper
72         (
73             const point& p,
74             const scalar& movingDst,
75             const label globalLabel,
76             const label patchLabel
77         )
78         :
79             p_(p),
80             movingDist_(movingDst),
81             globalLabel_(globalLabel),
82             patch_(patchLabel)
83         {}
85     // Destructor
86         ~parMapperHelper()
87         {};
89     // Member functions
90         //- return point coordinates
91         inline const point& coordinates() const
92         {
93             return p_;
94         }
96         //- return moving distance
97         inline const scalar& movingDistance() const
98         {
99             return movingDist_;
100         }
102         //- return global label
103         inline label globalLabel() const
104         {
105             return globalLabel_;
106         }
108         //- return patch the point is mapped to
109         inline label pointPatch() const
110         {
111             return patch_;
112         }
114     // Operators
116         inline void operator=(const parMapperHelper& h)
117         {
118             p_ = h.p_;
119             movingDist_ = h.movingDist_;
120             globalLabel_ = h.globalLabel_;
121             patch_ = h.patch_;
122         }
124         inline bool operator!=(const parMapperHelper& h) const
125         {
126             if( globalLabel_ != h.globalLabel_ )
127                 return true;
129             return false;
130         }
132     // Friend operators
133         friend Ostream& operator<<(Ostream& os, const parMapperHelper& h)
134         {
135             os << token::BEGIN_LIST;
136             os << h.p_ << token::SPACE;
137             os << h.movingDist_ << token::SPACE;
138             os << h.globalLabel_ << token::SPACE;
139             os << h.patch_ << token::END_LIST;
141             // Check state of Ostream
142             os.check("operator<<(Ostream&, const parMapperHelper&");
143             return os;
144         }
146         friend Istream& operator>>(Istream& is, parMapperHelper& h)
147         {
148             // Read beginning of parMapperHelper
149             is.readBegin("parMapperHelper");
151             is >> h.p_;
152             is >> h.movingDist_;
153             is >> h.globalLabel_;
154             is >> h.patch_;
156             // Read end of parMapperHelper
157             is.readEnd("parMapperHelper");
159             // Check state of Istream
160             is.check("operator>>(Istream&, parMapperHelper");
162             return is;
163         }
166 //- Specify data associated with parMapperHelper type is contiguous
167 template<>
168 inline bool contiguous<parMapperHelper>() {return true;}
170 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
172 } // End namespace Foam
174 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
176 #endif
178 // ************************************************************************* //