block.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 | Copyright (C) 2011-2015 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 "error.H"
27 #include "block.H"
28 
29 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
30 
31 Foam::block::block
32 (
33  const pointField& blockPointField,
34  const curvedEdgeList& edges,
35  Istream& is
36 )
37 :
38  blockDescriptor(blockPointField, edges, is),
39  vertices_(0),
40  cells_(0),
41  boundaryPatches_(0)
42 {}
43 
44 
45 Foam::block::block(const blockDescriptor& blockDesc)
46 :
47  blockDescriptor(blockDesc),
48  vertices_(0),
49  cells_(0),
50  boundaryPatches_(0)
51 {}
52 
53 
54 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
55 
57 {}
58 
59 
60 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
61 
63 {
64  if (vertices_.empty())
65  {
66  createPoints();
67  }
68 
69  return vertices_;
70 }
71 
72 
74 {
75  if (cells_.empty())
76  {
77  createCells();
78  }
79 
80  return cells_;
81 }
82 
83 
85 {
86  if (boundaryPatches_.empty())
87  {
88  createBoundary();
89  }
90 
91  return boundaryPatches_;
92 }
93 
94 
95 // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
96 
98 {
99  os << b.points() << nl
100  << b.cells() << nl
101  << b.boundaryPatches() << endl;
102 
103  return os;
104 }
105 
106 
107 // ************************************************************************* //
bool empty() const
Return true if the UList is empty (ie, size() is zero)
Definition: UListI.H:313
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...
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:253
~block()
Destructor.
Definition: block.C:56
const labelListListList & boundaryPatches() const
Return the boundary patch faces for the block.
Definition: block.C:84
const dimensionedScalar b
Wien displacement law constant: default SI units: [m.K].
Definition: createFields.H:27
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:53
static const char nl
Definition: Ostream.H:262
const pointField & points() const
Return the points for filling the block.
Definition: block.C:62
Ostream & operator<<(Ostream &, const ensightPart &)
const labelListList & cells() const
Return the cells for filling the block.
Definition: block.C:73