blockFace.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2016 OpenFOAM Foundation
9  Copyright (C) 2019-2021 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
29 #include "blockFace.H"
30 #include "blockMeshTools.H"
31 #include "blockVertex.H"
32 
33 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
34 
35 namespace Foam
36 {
39 }
40 
41 
42 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
43 
45 :
46  vertices_(vertices)
47 {}
48 
49 
51 (
52  const dictionary& dict,
53  const label index,
54  Istream& is
55 )
56 :
57  vertices_
58  (
59  blockMeshTools::read<label>
60  (
61  is,
62  dict.subOrEmptyDict("namedVertices")
63  )
64  )
65 {}
66 
67 
69 {
71  return nullptr;
72 }
73 
74 
76 (
77  const dictionary& dict,
78  const label index,
79  const searchableSurfaces& geometry,
80  Istream& is
81 )
82 {
83  DebugInFunction << "Constructing blockFace" << endl;
84 
85  const word faceType(is);
86 
87  auto* ctorPtr = IstreamConstructorTable(faceType);
88 
89  if (!ctorPtr)
90  {
92  (
93  dict,
94  "blockFace",
95  faceType,
96  *IstreamConstructorTablePtr_
97  ) << abort(FatalIOError);
98  }
99 
100  return autoPtr<blockFace>(ctorPtr(dict, index, geometry, is));
101 }
102 
103 
104 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
105 
106 void Foam::blockFace::write(Ostream& os, const dictionary& d) const
107 {
108  // Write size and start delimiter
109  os << vertices_.size() << token::BEGIN_LIST;
110 
111  // Write contents
112  forAll(vertices_, i)
113  {
114  if (i) os << token::SPACE;
115  blockVertex::write(os, vertices_[i], d);
116  }
117 
118  // Write end delimiter
119  os << token::END_LIST;
120 }
121 
122 
123 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
124 
125 Foam::Ostream& Foam::operator<<(Ostream& os, const blockFace& p)
126 {
127  os << p.vertices_ << endl;
128 
129  return os;
130 }
131 
132 
133 // ************************************************************************* //
dictionary dict
A face is a list of labels corresponding to mesh vertices.
Definition: face.H:68
blockFace(const face &vertices)
Construct from face vertices.
Definition: blockFace.C:37
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:531
static autoPtr< blockFace > New(const dictionary &dict, const label index, const searchableSurfaces &geometry, Istream &)
New function which constructs and returns pointer to a blockFace.
Definition: blockFace.C:69
Begin list [isseparator].
Definition: token.H:161
bool read(const char *buf, int32_t &val)
Same as readInt32.
Definition: int32.H:127
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:421
pointField vertices(const blockVertexList &bvl)
A class for handling words, derived from Foam::string.
Definition: word.H:63
#define DebugInFunction
Report an information message using Foam::Info.
Space [isspace].
Definition: token.H:131
virtual autoPtr< blockFace > clone() const
Clone function.
Definition: blockFace.C:61
Container for searchableSurfaces. The collection is specified as a dictionary. For example...
End list [isseparator].
Definition: token.H:162
errorManip< error > abort(error &err)
Definition: errorManip.H:139
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
OBJstream os(runTime.globalPath()/outputName)
defineTypeNameAndDebug(combustionModel, 0)
void write(Ostream &, const dictionary &) const
Write face with variable backsubstitution.
Definition: blockFace.C:99
Define a curved face.
Definition: blockFace.H:53
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:77
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
volScalarField & p
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:686
#define FatalIOErrorInLookup(ios, lookupTag, lookupName, lookupTable)
Report an error message using Foam::FatalIOError.
Definition: error.H:635
static void write(Ostream &, const label, const dictionary &)
Write vertex index with optional name backsubstitution.
Definition: blockVertex.C:111
Namespace for OpenFOAM.
IOerror FatalIOError
Error stream (stdout output on all processes), with additional &#39;FOAM FATAL IO ERROR&#39; header text and ...