MOAB: Mesh Oriented datABase  (version 5.2.1)
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, const Mesh::VertexHandle* vertex_array, size_t vertex_array_length, MsqError& err,
00079                        double epsilon = 0.0 );
00080 
00081     void set_plane( const Vector3D& normal, const Vector3D& point );
00082 
00083     void flip();
00084 
00085     const Vector3D& get_normal() const
00086     {
00087         return mNormal;
00088     }
00089 
00090     double get_coeff()
00091     {
00092         return mCoeff;
00093     }
00094 
00095     Vector3D get_origin() const
00096     {
00097         return -mCoeff * mNormal;
00098     }
00099 
00100     virtual void snap_to( Mesh::VertexHandle entity_handle, Vector3D& coordinate ) const;
00101 
00102     virtual void vertex_normal_at( Mesh::VertexHandle entity_handle, Vector3D& coordinate ) const;
00103 
00104     virtual void element_normal_at( Mesh::ElementHandle entity_handle, Vector3D& coordinate ) const;
00105 
00106     virtual void vertex_normal_at( const Mesh::VertexHandle* handle, Vector3D coords[], unsigned count,
00107                                    MsqError& err ) const;
00108 
00109     virtual void closest_point( Mesh::VertexHandle handle, const Vector3D& position, Vector3D& closest,
00110                                 Vector3D& normal, MsqError& err ) const;
00111 
00112     virtual void domain_DoF( const Mesh::VertexHandle* handle_array, unsigned short* dof_array, size_t num_vertices,
00113                              MsqError& err ) const;
00114 
00115   private:
00116     Vector3D mNormal;
00117     double mCoeff;
00118 };
00119 }  // namespace MBMesquite
00120 
00121 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines