blockFace.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2016-2018 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM 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 OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "blockFace.H"
27 #include "blockMeshTools.H"
28 #include "blockVertex.H"
29 
30 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 
32 namespace Foam
33 {
34  defineTypeNameAndDebug(blockFace, 0);
35  defineRunTimeSelectionTable(blockFace, Istream);
36 }
37 
38 
39 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
40 
42 :
43  vertices_(vertices)
44 {}
45 
46 
48 (
49  const dictionary& dict,
50  const label index,
51  Istream& is
52 )
53 :
54  vertices_
55  (
56  blockMeshTools::read<label>
57  (
58  is,
59  dict.subOrEmptyDict("namedVertices")
60  )
61  )
62 {}
63 
64 
66 {
68  return autoPtr<blockFace>(nullptr);
69 }
70 
71 
73 (
74  const dictionary& dict,
75  const label index,
76  const searchableSurfaces& geometry,
77  Istream& is
78 )
79 {
80  if (debug)
81  {
82  InfoInFunction << "Constructing blockFace" << endl;
83  }
84 
85  const word faceType(is);
86 
87  IstreamConstructorTable::iterator cstrIter =
88  IstreamConstructorTablePtr_->find(faceType);
89 
90  if (cstrIter == IstreamConstructorTablePtr_->end())
91  {
93  << "Unknown blockFace type "
94  << faceType << nl << nl
95  << "Valid blockFace types are" << endl
96  << IstreamConstructorTablePtr_->sortedToc()
97  << abort(FatalError);
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 > 0) 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 // ************************************************************************* //
dictionary dict
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:434
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
A face is a list of labels corresponding to mesh vertices.
Definition: face.H:75
blockFace(const face &vertices)
Construct from face vertices.
Definition: blockFace.C:41
error FatalError
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:323
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
void size(const label)
Override size to be inconsistent with allocated storage.
Definition: ListI.H:164
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
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:73
pointField vertices(const blockVertexList &bvl)
A class for handling words, derived from string.
Definition: word.H:59
virtual autoPtr< blockFace > clone() const
Clone function.
Definition: blockFace.C:65
Container for searchableSurfaces.
errorManip< error > abort(error &err)
Definition: errorManip.H:131
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
static const char nl
Definition: Ostream.H:260
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
defineTypeNameAndDebug(combustionModel, 0)
void write(Ostream &, const dictionary &) const
Write face with variable backsubstitution.
Definition: blockFace.C:106
Define a curved face.
Definition: blockFace.H:55
const face vertices_
Block face vertices.
Definition: blockFace.H:62
Ostream & operator<<(Ostream &, const ensightPart &)
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
volScalarField & p
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:370
static void write(Ostream &, const label, const dictionary &)
Write vertex index with optional name backsubstitution.
Definition: blockVertex.C:120
dictionary subOrEmptyDict(const word &, const bool mustRead=false) const
Find and return a sub-dictionary as a copy, or.
Definition: dictionary.C:1013
Namespace for OpenFOAM.
#define InfoInFunction
Report an information message using Foam::Info.