MOAB: Mesh Oriented datABase  (version 5.4.1)
MeshTransform.hpp
Go to the documentation of this file.
00001 /* *****************************************************************
00002     MESQUITE -- The Mesh Quality Improvement Toolkit
00003 
00004     Copyright 2004 Sandia Corporation and Argonne National
00005     Laboratory.  Under the terms of Contract DE-AC04-94AL85000
00006     with Sandia Corporation, the U.S. Government retains certain
00007     rights in this software.
00008 
00009     This library is free software; you can redistribute it and/or
00010     modify it under the terms of the GNU Lesser General Public
00011     License as published by the Free Software Foundation; either
00012     version 2.1 of the License, or (at your option) any later version.
00013 
00014     This library is distributed in the hope that it will be useful,
00015     but WITHOUT ANY WARRANTY; without even the implied warranty of
00016     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017     Lesser General Public License for more details.
00018 
00019     You should have received a copy of the GNU Lesser General Public License
00020     (lgpl.txt) along with this library; if not, write to the Free Software
00021     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00022 
00023     [email protected], [email protected], [email protected],
00024     [email protected], [email protected], [email protected]
00025 
00026   ***************************************************************** */
00027 /*!
00028   \file   MeshTransform.hpp
00029   \brief
00030 
00031   Class for performing an affine transformation on the mesh.
00032 
00033   \author Michael Brewer
00034   \date   2004-11-06
00035 */
00036 
00037 #ifndef Mesquite_MeshTransform_hpp
00038 #define Mesquite_MeshTransform_hpp
00039 
00040 #include "Mesquite.hpp"
00041 #include "Vector3D.hpp"
00042 #include "Matrix3D.hpp"
00043 #include "Instruction.hpp"
00044 
00045 namespace MBMesquite
00046 {
00047 
00048 /*! \class MeshTransform
00049   Perform an Affine transformation on Mesh vertex positions.
00050   Essentially define the new vertex position, v_new, from the original
00051   vertex position, v_old, s.t.
00052   v_new = (mMat * v_old) + mVec,
00053   where mMat is a constant matrix and mVec is a constant vector.
00054  */
00055 class MESQUITE_EXPORT MeshTransform : public Instruction
00056 {
00057   public:
00058     MeshTransform( bool skip_fixed = false ) : mMat( 1, 0, 0, 0, 1, 0, 0, 0, 1 ), mVec( 0.0 ), skipFixed( skip_fixed )
00059     {
00060     }
00061     MeshTransform( Matrix3D& in_mat, Vector3D& in_vec, bool skip_fixed = false )
00062         : mMat( in_mat ), mVec( in_vec ), skipFixed( skip_fixed )
00063     {
00064     }
00065 
00066     // virtual destructor ensures use of polymorphism during destruction
00067     virtual ~MeshTransform();
00068 
00069     // virtual functions from PatchDataUser...
00070     //! Loop over the mesh and perform the affine transformation
00071     virtual double loop_over_mesh( MeshDomainAssoc* mesh_and_domain, const Settings* settings, MsqError& err );
00072     //! Return the name of this PatchDataUser:  Mesh Transform
00073     virtual std::string get_name() const
00074     {
00075         return "Mesh Transform";
00076     }
00077 
00078     virtual void initialize_queue( MeshDomainAssoc* mesh_and_domain, const Settings* settings, MsqError& err );
00079 
00080     void add_translation( const Vector3D& offset );
00081     void add_rotation( const Vector3D& axis, double radians );
00082     void add_scale( double factor );
00083     void add_scale( const Vector3D& factors );
00084 
00085     bool skipping_fixed_vertices() const
00086     {
00087         return skipFixed;
00088     }
00089     void skip_fixed_vertices( bool yesno )
00090     {
00091         skipFixed = yesno;
00092     }
00093 
00094   private:
00095     Matrix3D mMat;  //! Matrix for the affine transformation
00096     Vector3D mVec;  //! Vector for the affine transformation
00097     bool skipFixed;
00098 };
00099 
00100 }  // namespace MBMesquite
00101 #endif  // Mesquite_MeshTransform_hpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines