Merge branch 'master' of ssh://git.code.sf.net/p/foam-extend/foam-extend-3.2
[foam-extend-3.2.git] / src / mesh / cfMesh / utilities / meshes / polyMeshGen / boundaryPatch / boundaryPatch.C
blob9e3153c4dc4ba5256608281bec271c6c98a790a7
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 "boundaryPatch.H"
29 #include "Ostream.H"
30 #include "Istream.H"
31 #include "token.H"
32 #include "dictionary.H"
33 #include "addToRunTimeSelectionTable.H"
35 namespace Foam
38 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
40 defineTypeNameAndDebug(boundaryPatch, 0);
41 addToRunTimeSelectionTable(boundaryPatchBase, boundaryPatch, dictionary);
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 boundaryPatch::boundaryPatch
47     const word& n,
48     const word& t,
49     const label nF,
50     const label sF
53     boundaryPatchBase(n, t, nF, sF)
56 boundaryPatch::boundaryPatch(const word& name, const dictionary& dict)
58     boundaryPatchBase(name, dict)
61 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
63 dictionary boundaryPatch::dict() const
65     dictionary dict;
67     dict.add("type", type_);
69     dict.add("nFaces", nFaces_);
70     dict.add("startFace", startFace_);
72     return dict;
75 void boundaryPatch::write(Ostream& os) const
77     this->operator<<(os);
80 void boundaryPatch::writeDict(Ostream& os) const
82     this->operator<<(os);
85 Ostream& boundaryPatch::operator<<(Ostream& os) const
87     os  << name_ << nl << token::BEGIN_BLOCK << nl
88         << "    type " << type_ << token::END_STATEMENT << nl
89         << "    nFaces " << nFaces_ << token::END_STATEMENT << nl
90         << "    startFace " << startFace_ << token::END_STATEMENT << nl
91         << token::END_BLOCK << endl;
93     return os;
96 Istream& boundaryPatch::operator>>(Istream& is)
98     token t;
99     is >> name_ >> t;
100     is >> t >> type_ >> t;
101     is >> t >> nFaces_ >> t;
102     is >> t >> startFace_ >> t;
103     is >> t;
105     return is;
108 void boundaryPatch::operator=(const boundaryPatch& wp)
110     name_ = wp.name_;
111     type_ = wp.type_;
112     nFaces_ = wp.nFaces_;
113     startFace_ = wp.startFace_;
116 bool boundaryPatch::operator!=(const boundaryPatch& wp) const
118     if( name_ != wp.name_ )
119     {
120         return true;
121     }
122     else if( type_ != wp.name_ )
123     {
124         return true;
125     }
126     else if( (nFaces_ != wp.nFaces_) || (startFace_ != wp.startFace_) )
127     {
128         return true;
129     }
131     return false;
134 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
136 } // End namespace Foam
138 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //