boxRefinement.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  boxRefinement
26 
27 Description
28  Checks if a box is contained inside the box object
29 
30 SourceFiles
31  boxRefinement.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef boxRefinement_H
36 #define boxRefinement_H
37 
38 #include "objectRefinement.H"
39 #include "point.H"
40 #include "typeInfo.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 /*---------------------------------------------------------------------------*\
48  Class boxRefinement Declaration
49 \*---------------------------------------------------------------------------*/
50 
51 class boxRefinement
52 :
53  public objectRefinement
54 {
55  // Private data
56  //- centre of the box
57  point centre_;
58 
59  //- length of box sides
60  scalar lengthX_;
61  scalar lengthY_;
62  scalar lengthZ_;
63 
64 public:
65 
66  //- Runtime type information
67  TypeName("box");
68 
69 
70  // Constructors
71 
72  //- Null construct
73  boxRefinement();
74 
75  //- Construct from name, cell size, centre and sizes
77  (
78  const word& name,
79  const scalar cellSize,
80  const direction additionalRefLevels,
81  const point& centre,
82  const scalar lengthX,
83  const scalar lengthY,
84  const scalar lengthZ
85  );
86 
87  //- Construct from dictionary
88  boxRefinement(const word& name, const dictionary& dict);
89 
90  //- Construct and return a clone
92  (
93  const boxRefinement& sr
94  ) const
95  {
97  (
98  new boxRefinement
99  (
100  sr.name(),
101  sr.cellSize(),
103  sr.centre_,
104  sr.lengthX_,
105  sr.lengthY_,
106  sr.lengthZ_
107  )
108  );
109  }
110 
111  // Member Functions
112 
113  //- check if a boundBox intersects or is inside the object
114  bool intersectsObject(const boundBox&) const;
115 
116  //- Return as dictionary of entries
117  dictionary dict(bool ignoreType = false) const;
118 
119  // Write
120 
121  //- Write
122  void write(Ostream&) const;
123 
124  //- Write dictionary
125  void writeDict(Ostream&, bool subDict = true) const;
126 
127  // Member Operators
128 
129  //- assign from dictionary
130  void operator=(const dictionary&);
131 
132  // IOstream Operators
133 
134  Ostream& operator<<(Ostream&) const;
135 };
136 
137 
138 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
139 
140 } // End namespace Foam
141 
142 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
143 
144 #endif
145 
146 // ************************************************************************* //
Foam::boxRefinement::centre_
point centre_
centre of the box
Definition: boxRefinement.H:56
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
typeInfo.H
Foam::boxRefinement::clone
virtual autoPtr< objectRefinement > clone(const boxRefinement &sr) const
Construct and return a clone.
Definition: boxRefinement.H:91
Foam::boxRefinement::lengthY_
scalar lengthY_
Definition: boxRefinement.H:60
Foam::boxRefinement::writeDict
void writeDict(Ostream &, bool subDict=true) const
Write dictionary.
Definition: boxRefinement.C:129
point.H
Foam::boxRefinement::dict
dictionary dict(bool ignoreType=false) const
Return as dictionary of entries.
Definition: boxRefinement.C:97
Foam::boxRefinement::lengthZ_
scalar lengthZ_
Definition: boxRefinement.H:61
Foam::boxRefinement::TypeName
TypeName("box")
Runtime type information.
Foam::boxRefinement::operator=
void operator=(const dictionary &)
assign from dictionary
Definition: boxRefinement.C:164
Foam::boxRefinement::lengthX_
scalar lengthX_
length of box sides
Definition: boxRefinement.H:59
Foam::objectRefinement::cellSize
scalar cellSize() const
return cell size
Definition: objectRefinement.H:80
Foam::boxRefinement
Definition: boxRefinement.H:50
Foam::boxRefinement::operator<<
Ostream & operator<<(Ostream &) const
Definition: boxRefinement.C:233
Foam::objectRefinement
Definition: objectRefinement.H:54
Foam::objectRefinement::additionalRefinementLevels
direction additionalRefinementLevels() const
return the number of additional refinement levels
Definition: objectRefinement.H:157
Foam::boxRefinement::intersectsObject
bool intersectsObject(const boundBox &) const
check if a boundBox intersects or is inside the object
Definition: boxRefinement.C:84
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam::boxRefinement::boxRefinement
boxRefinement()
Null construct.
Definition: boxRefinement.C:40
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
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::Vector< scalar >
Foam::direction
unsigned char direction
Definition: direction.H:43
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::boxRefinement::write
void write(Ostream &) const
Write.
Definition: boxRefinement.C:120
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
objectRefinement.H