block.H
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 Class
25  Foam::block
26 
27 Description
28  Creates a single block of cells from point coordinates, numbers of
29  cells in each direction and an expansion ratio.
30 
31 Note
32  The vertices and cells for filling the block are demand-driven.
33 
34 SourceFiles
35  block.C
36  blockCreate.C
37 
38 \*---------------------------------------------------------------------------*/
39 
40 #ifndef block_H
41 #define block_H
42 
43 #include "pointField.H"
44 #include "labelList.H"
45 
46 #include "blockDescriptor.H"
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 namespace Foam
51 {
52 
53 class Istream;
54 class Ostream;
55 
56 // Forward declaration of friend functions and operators
57 class block;
58 Ostream& operator<<(Ostream&, const block&);
59 
60 /*---------------------------------------------------------------------------*\
61  Class block Declaration
62 \*---------------------------------------------------------------------------*/
63 
64 class block
65 :
66  public blockDescriptor
67 {
68  // Private data
69 
70  //- List of vertices
71  mutable pointField vertices_;
72 
73  //- List of cells
74  mutable labelListList cells_;
75 
76  //- Boundary patches
78 
79 
80  // Private Member Functions
81 
82  //- Creates vertices for cells filling the block
83  void createPoints() const;
84 
85  //- Creates cells for filling the block
86  void createCells() const;
87 
88  //- Creates boundary patch faces for the block
89  void createBoundary() const;
90 
91  //- Disallow default bitwise copy construct
92  block(const block&);
93 
94  //- Disallow default bitwise assignment
95  void operator=(const block&);
96 
97 public:
98 
99  // Constructors
100 
101  //- Construct from components with Istream
102  block
103  (
105  const curvedEdgeList&,
106  Istream&
107  );
108 
109  //- Construct from a block definition
110  block(const blockDescriptor&);
111 
112  //- Clone
113  autoPtr<block> clone() const
114  {
116  return autoPtr<block>(NULL);
117  }
118 
119 
120  //- Destructor
121  ~block();
122 
123 
124  // Member Functions
125 
126  // Access
127 
128  //- Return the block definition
129  inline const blockDescriptor& blockDef() const;
130 
131  //- Vertex label offset for a particular i,j,k position
132  inline label vtxLabel(label i, label j, label k) const;
133 
134  //- Return the points for filling the block
135  const pointField& points() const;
136 
137  //- Return the cells for filling the block
138  const labelListList& cells() const;
139 
140  //- Return the boundary patch faces for the block
141  const labelListListList& boundaryPatches() const;
142 
143 
144  // Edit
145 
146  //- Clear geometry (internal points, cells, boundaryPatches)
147  void clearGeom();
148 
149 
150  // Ostream Operator
151 
152  friend Ostream& operator<<(Ostream&, const block&);
153 };
154 
155 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
156 
157 } // End namespace Foam
158 
159 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
160 
161 #include "blockI.H"
162 
163 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
164 
165 #endif
166 
167 // ************************************************************************* //
Foam::block::boundaryPatches_
labelListListList boundaryPatches_
Boundary patches.
Definition: block.H:76
Foam::block::clone
autoPtr< block > clone() const
Clone.
Definition: block.H:112
Foam::block
Creates a single block of cells from point coordinates, numbers of cells in each direction and an exp...
Definition: block.H:63
Foam::block::createBoundary
void createBoundary() const
Creates boundary patch faces for the block.
Definition: blockCreate.C:277
Foam::block::createPoints
void createPoints() const
Creates vertices for cells filling the block.
Definition: blockCreate.C:31
Foam::block::cells
const labelListList & cells() const
Return the cells for filling the block.
Definition: block.C:73
Foam::block::vertices_
pointField vertices_
List of vertices.
Definition: block.H:70
blockDescriptor.H
blockI.H
Foam::block::blockDef
const blockDescriptor & blockDef() const
Return the block definition.
Definition: blockI.H:41
NotImplemented
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:365
Foam::block::points
const pointField & points() const
Return the points for filling the block.
Definition: block.C:62
Foam::label
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
labelList.H
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::block::createCells
void createCells() const
Creates cells for filling the block.
Definition: blockCreate.C:240
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:57
Foam::PtrList
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: List.H:61
Foam::operator<<
Ostream & operator<<(Ostream &, const edgeMesh &)
Definition: edgeMeshIO.C:130
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::block::~block
~block()
Destructor.
Definition: block.C:56
Foam::blockDescriptor::blockPointField
const pointField & blockPointField() const
Reference to point field defining the block mesh.
Definition: blockDescriptor.C:177
pointField.H
Foam::autoPtr
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:117
Foam::block::operator<<
friend Ostream & operator<<(Ostream &, const block &)
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
k
label k
Boltzmann constant.
Definition: LISASMDCalcMethod2.H:41
Foam::block::operator=
void operator=(const block &)
Disallow default bitwise assignment.
Foam::block::boundaryPatches
const labelListListList & boundaryPatches() const
Return the boundary patch faces for the block.
Definition: block.C:84
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
Foam::block::cells_
labelListList cells_
List of cells.
Definition: block.H:73
Foam::block::clearGeom
void clearGeom()
Clear geometry (internal points, cells, boundaryPatches)
Definition: blockCreate.C:458
Foam::block::vtxLabel
label vtxLabel(label i, label j, label k) const
Vertex label offset for a particular i,j,k position.
Definition: blockI.H:28
Foam::blockDescriptor
Takes the description of the block and the list of curved edges and creates a list of points on edges...
Definition: blockDescriptor.H:61
Foam::block::block
block(const block &)
Disallow default bitwise copy construct.