Branch data Line data Source code
1 : : /* *****************************************************************
2 : : MESQUITE -- The Mesh Quality Improvement Toolkit
3 : :
4 : : Copyright 2004 Sandia Corporation and Argonne National
5 : : Laboratory. Under the terms of Contract DE-AC04-94AL85000
6 : : with Sandia Corporation, the U.S. Government retains certain
7 : : rights in this software.
8 : :
9 : : This library is free software; you can redistribute it and/or
10 : : modify it under the terms of the GNU Lesser General Public
11 : : License as published by the Free Software Foundation; either
12 : : version 2.1 of the License, or (at your option) any later version.
13 : :
14 : : This library is distributed in the hope that it will be useful,
15 : : but WITHOUT ANY WARRANTY; without even the implied warranty of
16 : : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 : : Lesser General Public License for more details.
18 : :
19 : : You should have received a copy of the GNU Lesser General Public License
20 : : (lgpl.txt) along with this library; if not, write to the Free Software
21 : : Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 : :
23 : : [email protected], [email protected], [email protected],
24 : : [email protected], [email protected], [email protected]
25 : :
26 : : ***************************************************************** */
27 : : /*!
28 : : \file MeshTransform.hpp
29 : : \brief
30 : :
31 : : Class for performing an affine transformation on the mesh.
32 : :
33 : : \author Michael Brewer
34 : : \date 2004-11-06
35 : : */
36 : :
37 : : #ifndef Mesquite_MeshTransform_hpp
38 : : #define Mesquite_MeshTransform_hpp
39 : :
40 : : #include "Mesquite.hpp"
41 : : #include "Vector3D.hpp"
42 : : #include "Matrix3D.hpp"
43 : : #include "Instruction.hpp"
44 : :
45 : : namespace MBMesquite
46 : : {
47 : :
48 : : /*! \class MeshTransform
49 : : Perform an Affine transformation on Mesh vertex positions.
50 : : Essentially define the new vertex position, v_new, from the original
51 : : vertex position, v_old, s.t.
52 : : v_new = (mMat * v_old) + mVec,
53 : : where mMat is a constant matrix and mVec is a constant vector.
54 : : */
55 : : class MESQUITE_EXPORT MeshTransform : public Instruction
56 : : {
57 : : public:
58 : : MeshTransform( bool skip_fixed = false ) : mMat( 1, 0, 0, 0, 1, 0, 0, 0, 1 ), mVec( 0.0 ), skipFixed( skip_fixed )
59 : : {
60 : : }
61 : 1 : MeshTransform( Matrix3D& in_mat, Vector3D& in_vec, bool skip_fixed = false )
62 [ + - ][ + - ]: 1 : : mMat( in_mat ), mVec( in_vec ), skipFixed( skip_fixed )
63 : : {
64 : 1 : }
65 : :
66 : : // virtual destructor ensures use of polymorphism during destruction
67 : : virtual ~MeshTransform();
68 : :
69 : : // virtual functions from PatchDataUser...
70 : : //! Loop over the mesh and perform the affine transformation
71 : : virtual double loop_over_mesh( MeshDomainAssoc* mesh_and_domain, const Settings* settings, MsqError& err );
72 : : //! Return the name of this PatchDataUser: Mesh Transform
73 : 0 : virtual std::string get_name() const
74 : : {
75 [ # # ]: 0 : return "Mesh Transform";
76 : : }
77 : :
78 : : virtual void initialize_queue( MeshDomainAssoc* mesh_and_domain, const Settings* settings, MsqError& err );
79 : :
80 : : void add_translation( const Vector3D& offset );
81 : : void add_rotation( const Vector3D& axis, double radians );
82 : : void add_scale( double factor );
83 : : void add_scale( const Vector3D& factors );
84 : :
85 : : bool skipping_fixed_vertices() const
86 : : {
87 : : return skipFixed;
88 : : }
89 : : void skip_fixed_vertices( bool yesno )
90 : : {
91 : : skipFixed = yesno;
92 : : }
93 : :
94 : : private:
95 : : Matrix3D mMat; //! Matrix for the affine transformation
96 : : Vector3D mVec; //! Vector for the affine transformation
97 : : bool skipFixed;
98 : : };
99 : :
100 : : } // namespace MBMesquite
101 : : #endif // Mesquite_MeshTransform_hpp
|