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 {
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 // ************************************************************************* //
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:60
void putBack(const token &)
Put back token.
Definition: Istream.C:30
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
Takes the description of the block and the list of curved edges and creates a list of points on edges...
Creates a single block of cells from point coordinates, numbers of cells in each direction and an exp...
Definition: block.H:66
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
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
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
A class for handling words, derived from string.
Definition: word.H:62
const pointField & points
volScalarField & b
Definition: createFields.H:25
#define InfoInFunction
Report an information message using Foam::Info.
Namespace for OpenFOAM.
pointField vertices(const blockVertexList &bvl)
defineRunTimeSelectionTable(reactionRateFlameArea, dictionary)
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
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:257
defineTypeNameAndDebug(combustionModel, 0)
Ostream & operator<<(Ostream &os, const fvConstraints &constraints)
static const char nl
Definition: Ostream.H:266
dictionary dict