planeScaling.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  planeScaling
26 
27 Description
28  Applies scaling to points on the positive side of the plane within
29  the scaling distance.
30 
31 SourceFiles
32  planeScaling.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef planeScaling_H
37 #define planeScaling_H
38 
39 #include "coordinateModification.H"
40 
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
43 namespace Foam
44 {
45 
46 /*---------------------------------------------------------------------------*\
47  Class planeScaling Declaration
48 \*---------------------------------------------------------------------------*/
49 
50 class planeScaling
51 :
53 {
54  // Private data
55  //- origin of the plane
56  point origin_;
57 
58  //- normal vector
60 
61  //- scaling distance
62  scalar scalingDistance_;
63 
64  //- scaling factor
65  scalar scalingFactor_;
66 
67 public:
68 
69  //- Runtime type information
70  TypeName("plane");
71 
72 
73  // Constructors
74 
75  //- Null construct
76  planeScaling();
77 
78  //- Construct from name, origin, normal, translation distance and scale
80  (
81  const word& name,
82  const point& original,
83  const vector& normal,
84  const scalar scalingDistance,
85  const scalar scalingFactor
86  );
87 
88  //- Construct from dictionary
89  planeScaling(const word& name, const dictionary& dict);
90 
91  //- Construct and return a clone
93  (
94  const planeScaling& pt
95  ) const
96  {
98  (
99  new planeScaling
100  (
101  pt.name(),
102  pt.origin_,
103  pt.normal_,
104  pt.scalingDistance_,
105  pt.scalingFactor_
106  )
107  );
108  }
109 
110  // Member Functions
111 
112  //- return the origin of the plane
113  virtual point origin() const;
114 
115  //- translate the object to the modified coordinates
116  //- this is needed for backward transformation
117  virtual void translateAndModifyObject(const vector&);
118 
119  //- calculate the displacement vector for plane translation
120  virtual vector displacement(const point&) const;
121 
122  //- calculate the displacement vector for plane translation
123  virtual vector backwardDisplacement(const point&) const;
124 
125  //- can this modification object be combined with other ones
126  virtual bool combiningPossible() const;
127 
128  //- return that "bounding planes" of the scaling region for
129  //- the given object
130  virtual void boundingPlanes(PtrList<plane>&) const;
131 
132  //- Return as dictionary of entries
133  dictionary dict(bool ignoreType = false) const;
134 
135  // Write
136 
137  //- Write
138  void write(Ostream&) const;
139 
140  //- Write dictionary
141  void writeDict(Ostream&, bool subDict = true) const;
142 
143  // Member Operators
144 
145  //- assign from dictionary
146  void operator=(const dictionary&);
147 
148  // IOstream Operators
149 
150  Ostream& operator<<(Ostream&) const;
151  friend Ostream& operator<<(Ostream&, const planeScaling&);
152 };
153 
154 
155 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
156 
157 } // End namespace Foam
158 
159 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
160 
161 #endif
162 
163 // ************************************************************************* //
Foam::planeScaling::writeDict
void writeDict(Ostream &, bool subDict=true) const
Write dictionary.
Definition: planeScaling.C:179
Foam::planeScaling::scalingFactor_
scalar scalingFactor_
scaling factor
Definition: planeScaling.H:64
Foam::planeScaling::origin_
point origin_
origin of the plane
Definition: planeScaling.H:55
Foam::planeScaling::backwardDisplacement
virtual vector backwardDisplacement(const point &) const
calculate the displacement vector for plane translation
Definition: planeScaling.C:120
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::planeScaling::boundingPlanes
virtual void boundingPlanes(PtrList< plane > &) const
Definition: planeScaling.C:139
Foam::planeScaling
Definition: planeScaling.H:49
Foam::planeScaling::displacement
virtual vector displacement(const point &) const
calculate the displacement vector for plane translation
Definition: planeScaling.C:106
Foam::planeScaling::write
void write(Ostream &) const
Write.
Definition: planeScaling.C:170
Foam::planeScaling::translateAndModifyObject
virtual void translateAndModifyObject(const vector &)
Definition: planeScaling.C:99
Foam::planeScaling::planeScaling
planeScaling()
Null construct.
Definition: planeScaling.C:46
Foam::planeScaling::dict
dictionary dict(bool ignoreType=false) const
Return as dictionary of entries.
Definition: planeScaling.C:156
Foam::PtrList
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: List.H:61
Foam::planeScaling::combiningPossible
virtual bool combiningPossible() const
can this modification object be combined with other ones
Definition: planeScaling.C:134
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
coordinateModification.H
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::planeScaling::scalingDistance_
scalar scalingDistance_
scaling distance
Definition: planeScaling.H:61
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::planeScaling::origin
virtual point origin() const
return the origin of the plane
Definition: planeScaling.C:94
Foam::planeScaling::normal_
vector normal_
normal vector
Definition: planeScaling.H:58
Foam::Vector< scalar >
Foam::coordinateModification::name
const word & name() const
Return name.
Definition: coordinateModification.H:130
Foam::coordinateModification
Definition: coordinateModification.H:55
Foam::planeScaling::clone
virtual autoPtr< coordinateModification > clone(const planeScaling &pt) const
Construct and return a clone.
Definition: planeScaling.H:92
Foam::planeScaling::operator<<
Ostream & operator<<(Ostream &) const
Definition: planeScaling.C:278
Foam::planeScaling::TypeName
TypeName("plane")
Runtime type information.
Foam::planeScaling::operator=
void operator=(const dictionary &)
assign from dictionary
Definition: planeScaling.C:205
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
normal
A normal distribution model.