MOAB: Mesh Oriented datABase  (version 5.4.0)
PlanarDomain.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     diachin2@llnl.gov, djmelan@sandia.gov, mbrewer@sandia.gov,
00024     pknupp@sandia.gov, tleurent@mcs.anl.gov, tmunson@mcs.anl.gov,
00025     kraftche@cae.wisc.edu
00026 
00027   ***************************************************************** */
00028 /*!
00029   \file   PlanarDomain.hpp
00030   \brief
00031 
00032 
00033   \author Thomas Leurent
00034   \date   2002-01-17
00035 */
00036 
00037 #ifndef MSQ_PLANAR_DOMAIN_HPP
00038 #define MSQ_PLANAR_DOMAIN_HPP
00039 
00040 #include "MeshInterface.hpp"
00041 #include "Vector3D.hpp"
00042 
00043 namespace MBMesquite
00044 {
00045 /*! \class PlanarDomain
00046      This is a template for a planar domain.
00047      It will provide the normal information necessary for surface mesh optimization.
00048   */
00049 class MESQUITE_EXPORT PlanarDomain : public MBMesquite::MeshDomain
00050 {
00051   public:
00052     enum Plane
00053     {
00054         XY = 2,
00055         XZ = 1,
00056         YZ = 0
00057     };
00058 
00059     inline PlanarDomain( Plane orient, double offset = 0.0 )
00060     {
00061         Vector3D normal( 0, 0, 0 ), point( 0, 0, 0 );
00062         normal[orient] = 1.0;
00063         point[orient]  = offset;
00064         set_plane( normal, point );
00065     }
00066 
00067     PlanarDomain() {}
00068 
00069     inline PlanarDomain( const Vector3D& normal, const Vector3D& point )
00070     {
00071         set_plane( normal, point );
00072     }
00073 
00074     virtual ~PlanarDomain();
00075 
00076     void fit_vertices( Mesh* mesh, MsqError& err, double epsilon = 0.0 );
00077 
00078     void fit_vertices( Mesh* mesh,
00079                        const Mesh::VertexHandle* vertex_array,
00080                        size_t vertex_array_length,
00081                        MsqError& err,
00082                        double epsilon = 0.0 );
00083 
00084     void set_plane( const Vector3D& normal, const Vector3D& point );
00085 
00086     void flip();
00087 
00088     const Vector3D& get_normal() const
00089     {
00090         return mNormal;
00091     }
00092 
00093     double get_coeff()
00094     {
00095         return mCoeff;
00096     }
00097 
00098     Vector3D get_origin() const
00099     {
00100         return -mCoeff * mNormal;
00101     }
00102 
00103     virtual void snap_to( Mesh::VertexHandle entity_handle, Vector3D& coordinate ) const;
00104 
00105     virtual void vertex_normal_at( Mesh::VertexHandle entity_handle, Vector3D& coordinate ) const;
00106 
00107     virtual void element_normal_at( Mesh::ElementHandle entity_handle, Vector3D& coordinate ) const;
00108 
00109     virtual void vertex_normal_at( const Mesh::VertexHandle* handle,
00110                                    Vector3D coords[],
00111                                    unsigned count,
00112                                    MsqError& err ) const;
00113 
00114     virtual void closest_point( Mesh::VertexHandle handle,
00115                                 const Vector3D& position,
00116                                 Vector3D& closest,
00117                                 Vector3D& normal,
00118                                 MsqError& err ) const;
00119 
00120     virtual void domain_DoF( const Mesh::VertexHandle* handle_array,
00121                              unsigned short* dof_array,
00122                              size_t num_vertices,
00123                              MsqError& err ) const;
00124 
00125   private:
00126     Vector3D mNormal;
00127     double mCoeff;
00128 };
00129 }  // namespace MBMesquite
00130 
00131 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines