boundaryPatchBase.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 "boundaryPatchBase.H"
29 #include "Ostream.H"
30 #include "Istream.H"
31 #include "token.H"
32 #include "IOPtrList.H"
33 #include "dictionary.H"
34 
35 namespace Foam
36 {
37 
38 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
39 
41 (
42  IOPtrList<boundaryPatchBase>,
43  "polyBoundaryMesh",
44  0
45 );
46 
49 
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 
52 autoPtr<boundaryPatchBase> boundaryPatchBase::New
53 (
54  const word& name,
55  const dictionary& dict
56 )
57 {
58  word type(dict.lookup("type"));
59  //- check the type of processor. Allowed types are processor and patch
60  //- Other patch types are treated as ordinary patches
61  if( type != "processor" )
62  type = "patch";
63 
64  dictionaryConstructorTable::iterator cstrIter =
65  dictionaryConstructorTablePtr_->find(type);
66 
67  if( cstrIter == dictionaryConstructorTablePtr_->end() )
68  {
70  (
71  "boundaryPatchBase::New(const word&, const dictionary&)",
72  dict
73  ) << "Unknown boundaryPatchBase type " << type << nl << nl
74  << "Valid boundaryPatchBase types are :" << nl
75  << "[default: " << typeName_() << "]"
76  << dictionaryConstructorTablePtr_->toc()
77  << exit(FatalIOError);
78  }
79 
80  return autoPtr<boundaryPatchBase>(cstrIter()(name, dict));
81 }
82 
84 (
85  Istream& is
86 )
87 {
88  word name(is);
89  dictionary dict(is);
90 
92 }
93 
94 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
95 
97 (
98  const word& n,
99  const word& t,
100  const label nF,
101  const label sF
102 )
103 :
104  name_(n),
105  type_(t),
106  nFaces_(nF),
107  startFace_(sF)
108 {}
109 
111 :
112  name_(name),
113  type_(),
114  nFaces_(),
115  startFace_()
116 {
117  word type(dict.lookup("type"));
118  type_ = type;
119  nFaces_ = readLabel(dict.lookup("nFaces"));
120  startFace_ = readLabel(dict.lookup("startFace"));
121 }
122 
123 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
124 
126 {
127  wpb.write(os);
128  os.check("Ostream& operator<<(Ostream& f, const boundaryPatchBase& wpb");
129  return os;
130 }
131 
132 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
133 
134 } // End namespace Foam
135 
136 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
token.H
boundaryPatchBase
Writes information for a given boundary patch.
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
boundaryPatchBase.H
Foam::defineRunTimeSelectionTable
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
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::dict
virtual dictionary dict() const =0
Return as dictionary of entries.
Foam::FatalIOError
IOerror FatalIOError
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::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
IOPtrList.H
Foam::boundaryPatchBase::boundaryPatchBase
boundaryPatchBase(const word &, const word &, const label, const label)
Definition: boundaryPatchBase.C:97
Foam::nl
static const char nl
Definition: Ostream.H:260
FatalIOErrorIn
#define FatalIOErrorIn(functionName, ios)
Report an error message using Foam::FatalIOError.
Definition: error.H:324
Istream.H
Foam::operator<<
Ostream & operator<<(Ostream &, const edgeMesh &)
Definition: edgeMeshIO.C:130
Foam::boundaryPatchBase::type_
word type_
Definition: boundaryPatchBase.H:57
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::boundaryPatchBase::New
static autoPtr< boundaryPatchBase > New(const word &name, const dictionary &dict)
Definition: boundaryPatchBase.C:53
Foam::IOstream::check
virtual bool check(const char *operation) const
Check IOstream status for given operation.
Definition: IOstream.C:92
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam::defineTemplateTypeNameAndDebugWithName
defineTemplateTypeNameAndDebugWithName(scalarAverageIOField, "scalarAverageField", 0)
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
Ostream.H
Foam::autoPtr
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:117
Foam::boundaryPatchBase
Definition: boundaryPatchBase.H:50
dictionary.H
Foam::readLabel
label readLabel(Istream &is)
Definition: label.H:64
Foam::boundaryPatchBase::write
virtual void write(Ostream &) const =0
Write.
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)
Foam::name
word name(const complex &)
Return a string representation of a complex.
Definition: complex.C:47
Foam::boundaryPatchBase::startFace_
label startFace_
Definition: boundaryPatchBase.H:61