Loading...
Searching...
No Matches
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-------------------------------------------------------------------------------
11License
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"
31#include "blockVertex.H"
32
33// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
34
35namespace Foam
36{
41
42// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
45:
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 }
100 return autoPtr<blockFace>(ctorPtr(dict, index, geometry, is));
101}
102
103
104// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
105
106void 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
120}
121
122
123// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
124
125Foam::Ostream& Foam::operator<<(Ostream& os, const blockFace& p)
126{
127 os << p.vertices_ << endl;
128
129 return os;
130}
131
132
133// ************************************************************************* //
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition Istream.H:60
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
Define a curved face.
Definition blockFace.H:54
const face & vertices() const
Return block face vertices.
Definition blockFaceI.H:23
blockFace(const face &vertices)
Construct from face vertices.
Definition blockFace.C:37
const face vertices_
Block face vertices.
Definition blockFace.H:62
void write(Ostream &, const dictionary &) const
Write face with variable backsubstitution.
Definition blockFace.C:99
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
virtual autoPtr< blockFace > clone() const
Clone function.
Definition blockFace.C:61
static void write(Ostream &, const label, const dictionary &)
Write vertex index with optional name backsubstitution.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
A face is a list of labels corresponding to mesh vertices.
Definition face.H:71
Container for searchableSurfaces. The collection is specified as a dictionary. For example,...
@ BEGIN_LIST
Begin list [isseparator].
Definition token.H:174
@ END_LIST
End list [isseparator].
Definition token.H:175
@ SPACE
Space [isspace].
Definition token.H:144
A class for handling words, derived from Foam::string.
Definition word.H:66
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
Definition className.H:142
volScalarField & p
#define FatalIOErrorInLookup(ios, lookupTag, lookupName, lookupTable)
Report an error message using Foam::FatalIOError.
Definition error.H:637
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition error.H:688
OBJstream os(runTime.globalPath()/outputName)
#define DebugInFunction
Report an information message using Foam::Info.
Tools for parsing label(List) with dictionary lookup.
Namespace for OpenFOAM.
bool read(const char *buf, int32_t &val)
Same as readInt32.
Definition int32.H:127
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces).
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition Ostream.H:519
errorManip< error > abort(error &err)
Definition errorManip.H:139
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...
#define defineRunTimeSelectionTable(baseType, argNames)
Define run-time selection table.
dictionary dict
#define forAll(list, i)
Loop across all elements in list.
Definition stdFoam.H:299