objectRefinement.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | cfMesh: A library for mesh generation
4  \\ / O peration |
5  \\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
6  \\/ M anipulation | Copyright (C) Creative Fields, Ltd.
7 -------------------------------------------------------------------------------
8 License
9  This file is part of cfMesh.
10 
11  cfMesh is free software; you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by the
13  Free Software Foundation; either version 3 of the License, or (at your
14  option) any later version.
15 
16  cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  objectRefinement
26 
27 Description
28  Base class for coordinate systems.
29  All systems are defined by an origin and a coordinate rotation.
30 
31 SourceFiles
32  objectRefinement.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef objectRefinement_H
37 #define objectRefinement_H
38 
39 #include "word.H"
40 #include "scalar.H"
41 #include "dictionary.H"
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 // Forward declarations
49 class boundBox;
50 
51 /*---------------------------------------------------------------------------*\
52  Class objectRefinement Declaration
53 \*---------------------------------------------------------------------------*/
54 
55 class objectRefinement
56 {
57 protected:
58 
59  // Protected data
60 
61  //- Name of object refinement type
62  word name_;
63 
64  //- cell size for this object
65  scalar cellSize_;
66 
67  //- refinement level applicable to this object
69 
70  //- refinement thickness fro this object
71  scalar refThickness_;
72 
73  // Protected member functions
74  //- set cell size
75  void setCellSize(const scalar cellSize)
76  {
78  }
79 
80  //- return cell size
81  scalar cellSize() const
82  {
83  return cellSize_;
84  }
85 
86 public:
87 
88  // Runtime type information
89  TypeName("objectRefinement");
90 
91 
92  // Constructors
93 
94  //- Null construct
96 
97  //- Construct from dictionary
98  objectRefinement(const word& name, const dictionary&);
99 
100  // Declare run-time constructor selection table
101 
103  (
104  autoPtr,
106  dictionary,
107  (
108  const word& name,
109  const dictionary& dict
110  ),
111  (name, dict)
112  );
113 
114 
115  // Selectors
116 
117  //- Select constructed from dictionary
119  (
120  const word& name,
121  const dictionary& dict
122  );
123 
124  // Destructor
125 
126  virtual ~objectRefinement();
127 
128 
129  // Member Functions
130 
131  //- check if a boundBox intersects or is inside the object
132  virtual bool intersectsObject(const boundBox&) const = 0;
133 
134  // Access
135 
136  //- Return name
137  const word& name() const
138  {
139  return name_;
140  }
141 
142  //- set the name
143  void setName(const word& name)
144  {
145  name_ = name;
146  }
147 
148  //- calculate additional refinement levels from cell size
149  void calculateAdditionalRefLevels(const scalar globalCellSize);
150 
151  //- set the number of additional refinement level
152  void setAdditionalRefinementLevels(const direction addRefLevels)
153  {
154  additionalRefLevel_ = label(addRefLevels);
155  }
156 
157  //- return the number of additional refinement levels
159  {
161  }
162 
163  //- set refinement thickness
164  void setRefinementThickness(const scalar refThickness)
165  {
166  refThickness_ = refThickness;
167  }
168 
169  //- return refinement thickness for this object
170  scalar refinementThickness() const
171  {
172  return refThickness_;
173  }
174 
175  //- Return as dictionary of entries
176  virtual dictionary dict(bool ignoreType = false) const = 0;
177 
178  // Write
179 
180  //- Write
181  virtual void write(Ostream&) const = 0;
182 
183  //- Write dictionary
184  virtual void writeDict(Ostream&, bool subDict = true) const = 0;
185 
186  // Member Operators
187 
188  //- assign from dictionary
189  virtual void operator=(const dictionary&) = 0;
190 
191  // IOstream Operators
192 
193  friend Ostream& operator<<(Ostream&, const objectRefinement&);
194 };
195 
196 
197 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
198 
199 } // End namespace Foam
200 
201 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
202 
203 #endif
204 
205 // ************************************************************************* //
Foam::objectRefinement::cellSize_
scalar cellSize_
cell size for this object
Definition: objectRefinement.H:64
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::objectRefinement::calculateAdditionalRefLevels
void calculateAdditionalRefLevels(const scalar globalCellSize)
calculate additional refinement levels from cell size
Definition: objectRefinement.C:108
Foam::objectRefinement::dict
virtual dictionary dict(bool ignoreType=false) const =0
Return as dictionary of entries.
Foam::objectRefinement::operator<<
friend Ostream & operator<<(Ostream &, const objectRefinement &)
Definition: objectRefinement.C:101
Foam::objectRefinement::additionalRefLevel_
label additionalRefLevel_
refinement level applicable to this object
Definition: objectRefinement.H:67
Foam::objectRefinement::intersectsObject
virtual bool intersectsObject(const boundBox &) const =0
check if a boundBox intersects or is inside the object
Foam::objectRefinement::setRefinementThickness
void setRefinementThickness(const scalar refThickness)
set refinement thickness
Definition: objectRefinement.H:163
Foam::objectRefinement::setAdditionalRefinementLevels
void setAdditionalRefinementLevels(const direction addRefLevels)
set the number of additional refinement level
Definition: objectRefinement.H:151
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
Foam::objectRefinement::cellSize
scalar cellSize() const
return cell size
Definition: objectRefinement.H:80
Foam::objectRefinement::setName
void setName(const word &name)
set the name
Definition: objectRefinement.H:142
Foam::objectRefinement::setCellSize
void setCellSize(const scalar cellSize)
set cell size
Definition: objectRefinement.H:74
Foam::objectRefinement
Definition: objectRefinement.H:54
Foam::objectRefinement::additionalRefinementLevels
direction additionalRefinementLevels() const
return the number of additional refinement levels
Definition: objectRefinement.H:157
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam::objectRefinement::writeDict
virtual void writeDict(Ostream &, bool subDict=true) const =0
Write dictionary.
scalar.H
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::objectRefinement::objectRefinement
objectRefinement()
Null construct.
Definition: objectRefinement.C:40
Foam::objectRefinement::write
virtual void write(Ostream &) const =0
Write.
Foam::objectRefinement::~objectRefinement
virtual ~objectRefinement()
Definition: objectRefinement.C:95
Foam::objectRefinement::refinementThickness
scalar refinementThickness() const
return refinement thickness for this object
Definition: objectRefinement.H:169
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::objectRefinement::refThickness_
scalar refThickness_
refinement thickness fro this object
Definition: objectRefinement.H:70
Foam::objectRefinement::New
static autoPtr< objectRefinement > New(const word &name, const dictionary &dict)
Select constructed from dictionary.
Definition: newObjectRefinement.C:38
dictionary.H
Foam::direction
unsigned char direction
Definition: direction.H:43
Foam::objectRefinement::name_
word name_
Name of object refinement type.
Definition: objectRefinement.H:61
Foam::boundBox
A bounding box defined in terms of the points at its extremities.
Definition: boundBox.H:55
Foam::objectRefinement::name
const word & name() const
Return name.
Definition: objectRefinement.H:136
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
word.H
Foam::objectRefinement::operator=
virtual void operator=(const dictionary &)=0
assign from dictionary
Foam::objectRefinement::TypeName
TypeName("objectRefinement")
Foam::objectRefinement::declareRunTimeSelectionTable
declareRunTimeSelectionTable(autoPtr, objectRefinement, dictionary,(const word &name, const dictionary &dict),(name, dict))