boundaryPatch.C
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 Description
25 
26 \*---------------------------------------------------------------------------*/
27 
28 #include "boundaryPatch.H"
29 #include "Ostream.H"
30 #include "Istream.H"
31 #include "token.H"
32 #include "dictionary.H"
34 
35 namespace Foam
36 {
37 
38 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
39 
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
46 (
47  const word& n,
48  const word& t,
49  const label nF,
50  const label sF
51 )
52 :
53  boundaryPatchBase(n, t, nF, sF)
54 {}
55 
57 :
59 {}
60 
61 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
62 
64 {
66 
67  dict.add("type", type_);
68 
69  dict.add("nFaces", nFaces_);
70  dict.add("startFace", startFace_);
71 
72  return dict;
73 }
74 
75 void boundaryPatch::write(Ostream& os) const
76 {
77  this->operator<<(os);
78 }
79 
81 {
82  this->operator<<(os);
83 }
84 
86 {
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;
92 
93  return os;
94 }
95 
97 {
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;
104 
105  return is;
106 }
107 
109 {
110  name_ = wp.name_;
111  type_ = wp.type_;
112  nFaces_ = wp.nFaces_;
113  startFace_ = wp.startFace_;
114 }
115 
117 {
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  }
130 
131  return false;
132 }
133 
134 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
135 
136 } // End namespace Foam
137 
138 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
token.H
boundaryPatchBase
Writes information for a given boundary patch.
Foam::token::END_STATEMENT
@ END_STATEMENT
Definition: token.H:99
Foam::boundaryPatch::operator=
void operator=(const boundaryPatch &)
Definition: boundaryPatch.C:108
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::boundaryPatch::operator<<
friend Ostream & operator<<(Ostream &, const boundaryPatch &)
Foam::addToRunTimeSelectionTable
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
Foam::boundaryPatch::writeDict
void writeDict(Ostream &) const
Write dictionary.
Definition: boundaryPatch.C:80
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
Foam::token
A token holds items read from Istream.
Definition: token.H:67
Foam::boundaryPatch::dict
dictionary dict() const
Return as dictionary of entries.
Definition: boundaryPatch.C:63
Foam::boundaryPatch
Like polyPatch but without reference to mesh. patchIdentifier::index is not used. Used in boundaryMes...
Definition: boundaryPatch.H:50
n
label n
Definition: TABSMDCalcMethod2.H:31
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::nl
static const char nl
Definition: Ostream.H:260
Istream.H
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
addToRunTimeSelectionTable.H
Macros for easy insertion into run-time selection tables.
Foam::boundaryPatch::boundaryPatch
boundaryPatch(const word &name, const label index, const label size, const label start, const word &physicalType=word::null)
Construct from components.
Definition: boundaryPatch.C:33
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Ostream.H
Foam::boundaryPatch::operator>>
Istream & operator>>(Istream &)
Definition: boundaryPatch.C:96
Foam::boundaryPatchBase
Definition: boundaryPatchBase.H:50
Foam::token::END_BLOCK
@ END_BLOCK
Definition: token.H:105
Foam::boundaryPatch::write
virtual void write(Ostream &) const
Write dictionary.
Definition: boundaryPatch.C:90
dictionary.H
boundaryPatch.H
Foam::token::BEGIN_BLOCK
@ BEGIN_BLOCK
Definition: token.H:104
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)
boundaryPatch
Writes information for a given boundary patch.
Foam::patchIdentifier::name_
word name_
Name of patch.
Definition: patchIdentifier.H:62
Foam::name
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
Foam::dictionary::add
bool add(entry *, bool mergeEntry=false)
Add a new entry.
Definition: dictionary.C:729
Foam::boundaryPatch::operator!=
bool operator!=(const boundaryPatch &) const
Definition: boundaryPatch.C:116