lineRefinement.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  lineRefinement
26 
27 Description
28  Refine objects intersected by a line given by two points
29 
30 SourceFiles
31  lineRefinement.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef lineRefinement_H
36 #define lineRefinement_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 lineRefinement Declaration
49 \*---------------------------------------------------------------------------*/
50 
51 class lineRefinement
52 :
53  public objectRefinement
54 {
55  // Private data
56  //- start point of the line
57  point p0_;
58 
59  //- end point of the line
60  point p1_;
61 
62 public:
63 
64  //- Runtime type information
65  TypeName("line");
66 
67 
68  // Constructors
69 
70  //- Null construct
72 
73  //- Construct from name, cell size, start point and end point
75  (
76  const word& name,
77  const scalar cellSize,
78  const direction additionalRefLevels,
79  const point& p0,
80  const point& p1
81  );
82 
83  //- Construct from dictionary
84  lineRefinement(const word& name, const dictionary& dict);
85 
86  //- Construct and return a clone
88  (
89  const lineRefinement& sr
90  ) const
91  {
93  (
94  new lineRefinement
95  (
96  sr.name(),
97  sr.cellSize(),
99  sr.p0_,
100  sr.p1_
101  )
102  );
103  }
104 
105  // Member Functions
106 
107  //- check if the line intersects the box
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::lineRefinement::lineRefinement
lineRefinement()
Null construct.
Definition: lineRefinement.C:40
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::lineRefinement
Definition: lineRefinement.H:50
typeInfo.H
point.H
Foam::lineRefinement::dict
dictionary dict(bool ignoreType=false) const
Return as dictionary of entries.
Definition: lineRefinement.C:209
Foam::lineRefinement::clone
virtual autoPtr< objectRefinement > clone(const lineRefinement &sr) const
Construct and return a clone.
Definition: lineRefinement.H:87
Foam::objectRefinement::cellSize
scalar cellSize() const
return cell size
Definition: objectRefinement.H:80
Foam::lineRefinement::p0_
point p0_
start point of the line
Definition: lineRefinement.H:56
Foam::objectRefinement
Definition: objectRefinement.H:54
Foam::objectRefinement::additionalRefinementLevels
direction additionalRefinementLevels() const
return the number of additional refinement levels
Definition: objectRefinement.H:157
Foam::lineRefinement::operator=
void operator=(const dictionary &)
assign from dictionary
Definition: lineRefinement.C:270
Foam::lineRefinement::p1_
point p1_
end point of the line
Definition: lineRefinement.H:59
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam::lineRefinement::intersectsObject
bool intersectsObject(const boundBox &) const
check if the line intersects the box
Definition: lineRefinement.C:78
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::lineRefinement::TypeName
TypeName("line")
Runtime type information.
Foam::lineRefinement::writeDict
void writeDict(Ostream &, bool subDict=true) const
Write dictionary.
Definition: lineRefinement.C:237
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::lineRefinement::write
void write(Ostream &) const
Write.
Definition: lineRefinement.C:230
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::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
objectRefinement.H
Foam::lineRefinement::operator<<
Ostream & operator<<(Ostream &) const
Definition: lineRefinement.C:311