sphereRefinement.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  sphereRefinement
26 
27 Description
28  Mark objects contained in a sphere
29 
30 SourceFiles
31  sphereRefinement.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef sphereRefinement_H
36 #define sphereRefinement_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 sphereRefinement Declaration
49 \*---------------------------------------------------------------------------*/
50 
51 class sphereRefinement
52 :
53  public objectRefinement
54 {
55  // Private data
56  //- centre of the sphere
57  point centre_;
58 
59  //- radius of the sphere
60  scalar radius_;
61 
62 public:
63 
64  //- Runtime type information
65  TypeName("sphere");
66 
67 
68  // Constructors
69 
70  //- Null construct
72 
73  //- Construct from name, cell size, centre and radius
75  (
76  const word& name,
77  const scalar cellSize,
78  const direction additionalRefLevels,
79  const point& centre,
80  const scalar radius
81  );
82 
83  //- Construct from dictionary
84  sphereRefinement(const word& name, const dictionary& dict);
85 
86  //- Construct and return a clone
88  (
89  const sphereRefinement& sr
90  ) const
91  {
93  (
95  (
96  sr.name(),
97  sr.cellSize(),
99  sr.centre_,
100  sr.radius_
101  )
102  );
103  }
104 
105  // Member Functions
106 
107  //- check if a boundBox intersects or is inside the object
108  bool intersectsObject(const boundBox&) const;
109 
110  //- Return as dictionary of entries
111  dictionary dict(bool ignoreType = false) const;
112 
113  // Write
114 
115  //- Write
116  void write(Ostream&) const;
117 
118  //- Write dictionary
119  void writeDict(Ostream&, bool subDict = true) const;
120 
121  // Member Operators
122 
123  //- assign from dictionary
124  void operator=(const dictionary&);
125 
126  // IOstream Operators
127 
128  Ostream& operator<<(Ostream&) const;
129 };
130 
131 
132 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
133 
134 } // End namespace Foam
135 
136 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
137 
138 #endif
139 
140 // ************************************************************************* //
Foam::sphereRefinement::writeDict
void writeDict(Ostream &, bool subDict=true) const
Write dictionary.
Definition: sphereRefinement.C:118
Foam::sphereRefinement::TypeName
TypeName("sphere")
Runtime type information.
Foam::sphereRefinement::clone
virtual autoPtr< objectRefinement > clone(const sphereRefinement &sr) const
Construct and return a clone.
Definition: sphereRefinement.H:87
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
typeInfo.H
point.H
Foam::sphereRefinement::write
void write(Ostream &) const
Write.
Definition: sphereRefinement.C:111
Foam::sphereRefinement
Definition: sphereRefinement.H:50
Foam::objectRefinement::cellSize
scalar cellSize() const
return cell size
Definition: objectRefinement.H:80
Foam::sphereRefinement::intersectsObject
bool intersectsObject(const boundBox &) const
check if a boundBox intersects or is inside the object
Definition: sphereRefinement.C:78
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::sphereRefinement::radius_
scalar radius_
radius of the sphere
Definition: sphereRefinement.H:59
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::sphereRefinement::operator=
void operator=(const dictionary &)
assign from dictionary
Definition: sphereRefinement.C:151
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::sphereRefinement::operator<<
Ostream & operator<<(Ostream &) const
Definition: sphereRefinement.C:192
Foam::sphereRefinement::sphereRefinement
sphereRefinement()
Null construct.
Definition: sphereRefinement.C:40
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::sphereRefinement::centre_
point centre_
centre of the sphere
Definition: sphereRefinement.H:56
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
objectRefinement.H
Foam::sphereRefinement::dict
dictionary dict(bool ignoreType=false) const
Return as dictionary of entries.
Definition: sphereRefinement.C:90