Adding cfMesh-v1.0 into the repository
[foam-extend-3.2.git] / src / meshLibrary / utilities / meshes / polyMeshGen / boundaryPatch / processorBoundaryPatch.C
blob80e53576f8830273b18604215f4a1fbdf9b100bc
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 Description
26 \*---------------------------------------------------------------------------*/
28 #include "processorBoundaryPatch.H"
29 #include "addToRunTimeSelectionTable.H"
30 #include "dictionary.H"
31 #include "Ostream.H"
32 #include "Istream.H"
33 #include "token.H"
35 namespace Foam
38 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
40 defineTypeNameAndDebug(processorBoundaryPatch, 0);
41 addToRunTimeSelectionTable(boundaryPatchBase, processorBoundaryPatch, dictionary);
42     
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 processorBoundaryPatch::processorBoundaryPatch
47     const word& name,
48     const word& type,
49     const label nFaces,
50     const label startFace,
51     const label myProcNo,
52     const label neighbProcNo
55     boundaryPatchBase(name, type, nFaces, startFace),
56     myProcNo_(myProcNo),
57     neighbProcNo_(neighbProcNo)
59     
60 processorBoundaryPatch::processorBoundaryPatch
62     const word& name,
63     const dictionary& dict
66     boundaryPatchBase(name, dict),
67     myProcNo_(readLabel(dict.lookup("myProcNo"))),
68     neighbProcNo_(readLabel(dict.lookup("neighbProcNo")))
70 }   
72 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
73     
74 dictionary processorBoundaryPatch::dict() const
76     dictionary dict;
78     dict.add("type", type_);
80     dict.add("nFaces", nFaces_);
81     dict.add("startFace", startFace_);
82     dict.add("myProcNo", myProcNo_);
83     dict.add("neighbProcNo", neighbProcNo_);
85     return dict;
88 void processorBoundaryPatch::write(Ostream& os) const
90     this->operator<<(os);
93 void processorBoundaryPatch::writeDict(Ostream& os) const
95     
98 Ostream& processorBoundaryPatch::operator<<(Ostream& os) const
100     os  << patchName() << nl << token::BEGIN_BLOCK << nl
101         << "    type         " << patchType() << token::END_STATEMENT << nl
102         << "    nFaces       " << patchSize() << token::END_STATEMENT << nl
103         << "    startFace    " << patchStart() << token::END_STATEMENT << nl
104         << "    myProcNo     " << myProcNo_ << token::END_STATEMENT << nl
105         << "    neighbProcNo " << neighbProcNo_
106         << token::END_STATEMENT << nl
107         << token::END_BLOCK << endl;
109     return os;
112 Istream& processorBoundaryPatch::operator>>(Istream& is)
114     token t;
115     is >> name_ >> t;
116     is >> t >> type_ >> t;
117     is >> t >> nFaces_ >> t;
118     is >> t >> startFace_ >> t;
119     is >> t >> myProcNo_ >> t;
120     is >> t >> neighbProcNo_ >> t;
121     is >> t;
123     return is;
126 void processorBoundaryPatch::operator=(const processorBoundaryPatch& wp)
128     name_ = wp.name_;
129     type_ = wp.type_;
130     nFaces_ = wp.nFaces_;
131     startFace_ = wp.startFace_;
132     myProcNo_ = wp.myProcNo_;
133     neighbProcNo_ = wp.neighbProcNo_;
136 bool processorBoundaryPatch::operator!=(const processorBoundaryPatch& wp) const
138     if( name_ != wp.name_ )
139     {
140         return true;
141     }
142     else if( type_ != wp.name_ )
143     {
144         return true;
145     }
146     else if( (nFaces_ != wp.nFaces_) || (startFace_ != wp.startFace_) )
147     {
148         return true;
149     }
150     else if(
151         (myProcNo_ != wp.myProcNo_) || (neighbProcNo_ != wp.neighbProcNo_)
152     )
153     {
154         return true;
155     }
157     return false;
160 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
162 } // End namespace Foam
164 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //