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
77  mutable labelListListList boundaryPatches_;
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  {
115  notImplemented("block::clone()");
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 // ************************************************************************* //
friend Ostream & operator<<(Ostream &, const block &)
const blockDescriptor & blockDef() const
Return the block definition.
Definition: blockI.H:41
Creates a single block of cells from point coordinates, numbers of cells in each direction and an exp...
Definition: block.H:63
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
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 & operator<<(Ostream &, const edgeMesh &)
Definition: edgeMeshIO.C:133
Namespace for OpenFOAM.
autoPtr< block > clone() const
Clone.
Definition: block.H:112
const pointField & blockPointField() const
Reference to point field defining the block mesh.
label k
Boltzmann constant.
~block()
Destructor.
Definition: block.C:56
const labelListList & cells() const
Return the cells for filling the block.
Definition: block.C:73
label vtxLabel(label i, label j, label k) const
Vertex label offset for a particular i,j,k position.
Definition: blockI.H:28
Takes the description of the block and the list of curved edges and creates a list of points on edges...
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
const pointField & points() const
Return the points for filling the block.
Definition: block.C:62
void clearGeom()
Clear geometry (internal points, cells, boundaryPatches)
Definition: blockCreate.C:458
#define notImplemented(functionName)
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:356
const labelListListList & boundaryPatches() const
Return the boundary patch faces for the block.
Definition: block.C:84
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:117