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 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 {
37  defineTypeNameAndDebug(blockFace, 0);
38  defineRunTimeSelectionTable(blockFace, Istream);
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 cstrIter = IstreamConstructorTablePtr_->cfind(faceType);
88 
89  if (!cstrIter.found())
90  {
92  (
93  dict,
94  "blockFace",
95  faceType,
96  *IstreamConstructorTablePtr_
97  ) << abort(FatalIOError);
98  }
99 
100  return autoPtr<blockFace>(cstrIter()(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 
126 {
127  os << p.vertices_ << endl;
128 
129  return os;
130 }
131 
132 
133 // ************************************************************************* //
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::defineRunTimeSelectionTable
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
blockFace.H
Foam::blockFace
Define a curved face.
Definition: blockFace.H:57
Foam::FatalIOError
IOerror FatalIOError
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:350
forAll
#define forAll(list, i)
Loop across all elements in list.
Definition: stdFoam.H:296
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
NotImplemented
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:445
FatalIOErrorInLookup
#define FatalIOErrorInLookup(ios, lookupTag, lookupName, lookupTable)
Report an error message using Foam::FatalIOError.
Definition: error.H:406
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
DebugInFunction
#define DebugInFunction
Report an information message using Foam::Info.
Definition: messageStream.H:365
Foam::blockFace::New
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:76
dict
dictionary dict
Definition: searchingEngine.H:14
blockVertex.H
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
Foam::vertices
pointField vertices(const blockVertexList &bvl)
Definition: blockVertexList.H:49
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::abort
errorManip< error > abort(error &err)
Definition: errorManip.H:144
Foam::dictionary::subOrEmptyDict
dictionary subOrEmptyDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX, const bool mandatory=false) const
Definition: dictionary.C:608
Foam::blockFace::clone
virtual autoPtr< blockFace > clone() const
Clone function.
Definition: blockFace.C:68
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
blockMeshTools.H
Foam::searchableSurfaces
Container for searchableSurfaces. The collection is specified as a dictionary. For example,...
Definition: searchableSurfaces.H:92
Foam::token::SPACE
Space [isspace].
Definition: token.H:117
Foam::token::END_LIST
End list [isseparator].
Definition: token.H:123
Foam::face
A face is a list of labels corresponding to mesh vertices.
Definition: face.H:72
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::blockVertex::write
static void write(Ostream &, const label, const dictionary &)
Write vertex index with optional name backsubstitution.
Definition: blockVertex.C:118
Foam::blockFace::write
void write(Ostream &, const dictionary &) const
Write face with variable backsubstitution.
Definition: blockFace.C:106
Foam::token::BEGIN_LIST
Begin list [isseparator].
Definition: token.H:122
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)
Foam::blockFace::blockFace
blockFace(const face &vertices)
Construct from face vertices.
Definition: blockFace.C:44