processorBoundaryPatch.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 "processorBoundaryPatch.H"
30 #include "dictionary.H"
31 #include "Ostream.H"
32 #include "Istream.H"
33 #include "token.H"
34 
35 namespace Foam
36 {
37 
38 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
39 
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
46 (
47  const word& name,
48  const word& type,
49  const label nFaces,
50  const label startFace,
51  const label myProcNo,
52  const label neighbProcNo
53 )
54 :
55  boundaryPatchBase(name, type, nFaces, startFace),
56  myProcNo_(myProcNo),
57  neighbProcNo_(neighbProcNo)
58 {}
59 
61 (
62  const word& name,
63  const dictionary& dict
64 )
65 :
67  myProcNo_(readLabel(dict.lookup("myProcNo"))),
68  neighbProcNo_(readLabel(dict.lookup("neighbProcNo")))
69 {
70 }
71 
72 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
73 
75 {
77 
78  dict.add("type", type_);
79 
80  dict.add("nFaces", nFaces_);
81  dict.add("startFace", startFace_);
82  dict.add("myProcNo", myProcNo_);
83  dict.add("neighbProcNo", neighbProcNo_);
84 
85  return dict;
86 }
87 
89 {
90  this->operator<<(os);
91 }
92 
94 {
95 
96 }
97 
99 {
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_
107  << token::END_BLOCK << endl;
108 
109  return os;
110 }
111 
113 {
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;
122 
123  return is;
124 }
125 
127 {
128  name_ = wp.name_;
129  type_ = wp.type_;
130  nFaces_ = wp.nFaces_;
131  startFace_ = wp.startFace_;
132  myProcNo_ = wp.myProcNo_;
134 }
135 
137 {
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(
152  )
153  {
154  return true;
155  }
156 
157  return false;
158 }
159 
160 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
161 
162 } // End namespace Foam
163 
164 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
processorBoundaryPatch
Writes information for a given processor patch.
token.H
boundaryPatchBase
Writes information for a given boundary patch.
Foam::token::END_STATEMENT
@ END_STATEMENT
Definition: token.H:99
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::boundaryPatchBase::patchSize
label patchSize() const
Definition: boundaryPatchBase.H:161
Foam::processorBoundaryPatch::processorBoundaryPatch
processorBoundaryPatch(const word &name, const word &type, const label nFaces, const label startFace, const label myProcNo, const label neighbProcNo)
Definition: processorBoundaryPatch.C:46
Foam::processorBoundaryPatch::myProcNo_
label myProcNo_
Definition: processorBoundaryPatch.H:52
Foam::addToRunTimeSelectionTable
addToRunTimeSelectionTable(ensightPart, ensightPartCells, istream)
Foam::boundaryPatchBase::name_
word name_
Definition: boundaryPatchBase.H:55
Foam::dictionary::lookup
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:449
Foam::boundaryPatchBase::patchName
const word & patchName() const
Definition: boundaryPatchBase.H:131
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::boundaryPatchBase::patchType
const word & patchType() const
Definition: boundaryPatchBase.H:141
Foam::processorBoundaryPatch::dict
dictionary dict() const
Return as dictionary of entries.
Definition: processorBoundaryPatch.C:74
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::boundaryPatchBase::nFaces_
label nFaces_
Definition: boundaryPatchBase.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
Foam::processorBoundaryPatch::operator=
void operator=(const processorBoundaryPatch &)
Definition: processorBoundaryPatch.C:126
Foam::processorBoundaryPatch::write
void write(Ostream &) const
write to Ostream
Definition: processorBoundaryPatch.C:88
Istream.H
Foam::boundaryPatchBase::type_
word type_
Definition: boundaryPatchBase.H:57
Foam::processorBoundaryPatch::operator>>
Istream & operator>>(Istream &)
Definition: processorBoundaryPatch.C:112
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
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::processorBoundaryPatch::neighbProcNo_
label neighbProcNo_
Definition: processorBoundaryPatch.H:54
Foam::processorBoundaryPatch
Definition: processorBoundaryPatch.H:47
Foam::processorBoundaryPatch::operator!=
bool operator!=(const processorBoundaryPatch &) const
Definition: processorBoundaryPatch.C:136
Ostream.H
Foam::boundaryPatchBase
Definition: boundaryPatchBase.H:50
Foam::token::END_BLOCK
@ END_BLOCK
Definition: token.H:105
Foam::boundaryPatchBase::patchStart
label patchStart() const
Definition: boundaryPatchBase.H:151
dictionary.H
Foam::processorBoundaryPatch::writeDict
void writeDict(Ostream &) const
Write dictionary.
Definition: processorBoundaryPatch.C:93
Foam::readLabel
label readLabel(Istream &is)
Definition: label.H:64
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::type
fileName::Type type(const fileName &)
Return the file type: DIRECTORY or FILE.
Definition: POSIX.C:588
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)
processorBoundaryPatch.H
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::processorBoundaryPatch::operator<<
Ostream & operator<<(Ostream &) const
Definition: processorBoundaryPatch.C:98
Foam::boundaryPatchBase::startFace_
label startFace_
Definition: boundaryPatchBase.H:61