block.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) 2011-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 "block.H"
27 
28 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
29 
30 namespace Foam
31 {
32  defineTypeNameAndDebug(block, 0);
33  defineRunTimeSelectionTable(block, Istream);
34 }
35 
36 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
37 
39 (
40  const dictionary& dict,
41  const label index,
42  const pointField& vertices,
43  const blockEdgeList& edges,
44  const blockFaceList& faces,
45  Istream& is
46 )
47 :
48  blockDescriptor(dict, index, vertices, edges, faces, is)
49 {
50  createPoints();
51  createBoundary();
52 }
53 
54 
56 :
57  blockDescriptor(blockDesc)
58 {
59  createPoints();
60  createBoundary();
61 }
62 
63 
65 (
66  const dictionary& dict,
67  const label index,
68  const pointField& points,
69  const blockEdgeList& edges,
70  const blockFaceList& faces,
71  Istream& is
72 )
73 {
74  if (debug)
75  {
76  InfoInFunction << "Constructing block" << endl;
77  }
78 
79  const word blockOrCellShapeType(is);
80 
81  IstreamConstructorTable::iterator cstrIter =
82  IstreamConstructorTablePtr_->find(blockOrCellShapeType);
83 
84  if (cstrIter == IstreamConstructorTablePtr_->end())
85  {
86  is.putBack(blockOrCellShapeType);
87  return autoPtr<block>(new block(dict, index, points, edges, faces, is));
88  }
89  else
90  {
91  return autoPtr<block>
92  (
93  cstrIter()
94  (
95  dict,
96  index,
97  points,
98  edges,
99  faces,
100  is
101  )
102  );
103  }
104 }
105 
106 
107 // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
108 
110 {
111  os << b.points() << nl
112  << b.cells() << nl
113  << b.boundaryPatches() << endl;
114 
115  return os;
116 }
117 
118 
119 // ************************************************************************* //
dictionary dict
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
block(const dictionary &dict, const label index, const pointField &vertices, const blockEdgeList &edges, const blockFaceList &faces, Istream &is)
Construct from components with Istream.
Definition: block.C:39
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
Takes the description of the block and the list of curved edges and creates a list of points on edges...
List< FixedList< label, 8 > > cells() const
Return the cells for filling the block.
Definition: blockCreate.C:349
void putBack(const token &)
Put back token.
Definition: Istream.C:30
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
const dimensionedScalar & b
Wien displacement law constant: default SI units: [m K].
Definition: createFields.H:27
A class for handling words, derived from string.
Definition: word.H:59
Creates a single block of cells from point coordinates, numbers of cells in each direction and an exp...
Definition: block.H:63
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)
static autoPtr< block > New(const dictionary &dict, const label index, const pointField &points, const blockEdgeList &edges, const blockFaceList &faces, Istream &)
New function which constructs and returns pointer to a block.
Definition: block.C:65
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
const FixedList< List< FixedList< label, 4 > >, 6 > & boundaryPatches() const
Return the boundary patch faces for the block.
Definition: blockI.H:35
const pointField & points() const
Return the points for filling the block.
Definition: blockI.H:28
const blockFaceList & faces() const
Return reference to the list of curved faces.
Namespace for OpenFOAM.
#define InfoInFunction
Report an information message using Foam::Info.