Forward compatibility: flex
[foam-extend-3.2.git] / src / mesh / cfMesh / utilities / anisotropicMeshing / coordinateModification / boxScaling.H
blob765ecdd08e55a821f002b4d820d20985460f28a1
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.
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.
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.
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/>.
24 Class
25     boxScaling
27 Description
28     Checks if a box is contained inside the box object
30 SourceFiles
31     boxScaling.C
33 \*---------------------------------------------------------------------------*/
35 #ifndef boxScaling_H
36 #define boxScaling_H
38 #include "coordinateModification.H"
39 #include "point.H"
40 #include "typeInfo.H"
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 namespace Foam
47 /*---------------------------------------------------------------------------*\
48                            Class boxScaling Declaration
49 \*---------------------------------------------------------------------------*/
51 class boxScaling
53     public coordinateModification
55     // Private data
56         //- centre of the box
57         point centre_;
59         //- length of box sides
60         vector lengthVec_;
62         //- scaling factors in all directions
63         vector scaleVec_;
65         //- min point
66         point pMin_;
68         //- max point
69         point pMax_;
71     // Private member functions
72         //- calculate bounding box points
73         void calculateBndBox();
75 public:
77     //- Runtime type information
78     TypeName("box");
81     // Constructors
83         //- Null construct
84         boxScaling();
86         //- Construct from name, cell size, centre and sizes and scaling factors
87         boxScaling
88         (
89             const word& name,
90             const point& centre,
91             const scalar lengthX,
92             const scalar lengthY,
93             const scalar lengthZ,
94             const scalar scaleX = 1.0,
95             const scalar scaleY = 1.0,
96             const scalar scaleZ = 1.0
97         );
99         //- Construct from dictionary
100         boxScaling(const word& name, const dictionary& dict);
102         //- Construct and return a clone
103         virtual autoPtr<coordinateModification> clone
104         (
105             const boxScaling& bs
106         ) const
107         {
108             return autoPtr<coordinateModification>
109             (
110                 new boxScaling
111                 (
112                     bs.name(),
113                     bs.centre_,
114                     bs.lengthVec_.x(),
115                     bs.lengthVec_.y(),
116                     bs.lengthVec_.z(),
117                     bs.scaleVec_.x(),
118                     bs.scaleVec_.y(),
119                     bs.scaleVec_.z()
120                 )
121             );
122         }
124     // Member Functions
126         //- return the centre of the box
127         virtual point origin() const;
129         //- translate the object to the modified coordinates
130         //- this is needed for backward transformation
131         virtual void translateAndModifyObject(const vector&);
133         //- calculate the displacement vector for box scaling
134         virtual vector displacement(const point&) const;
136         //- calculate the displacement vector for box scaling
137         virtual vector backwardDisplacement(const point&) const;
139         //- can this modification object be combined with other ones
140         virtual bool combiningPossible() const;
142         //- return that "bounding planes" of the scaling region for
143         //- the given object
144         virtual void boundingPlanes(PtrList<plane>&) const;
146     //- Return as dictionary of entries
147         dictionary dict(bool ignoreType = false) const;
149       // Write
151         //- Write
152         void write(Ostream&) const;
154         //- Write dictionary
155         void writeDict(Ostream&, bool subDict = true) const;
157     // Member Operators
159         //- assign from dictionary
160         void operator=(const dictionary&);
162     // IOstream Operators
164         Ostream& operator<<(Ostream&) const;
165         friend Ostream& operator<<(Ostream&, const boxScaling&);
169 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
171 } // End namespace Foam
173 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
175 #endif
177 // ************************************************************************* //