MOAB: Mesh Oriented datABase  (version 5.4.1)
SphericalDomain.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     [email protected]
00026 
00027   ***************************************************************** */
00028 /*!
00029   \file   SphericalDomain.hpp
00030   \brief
00031 
00032 
00033   \author Thomas Leurent
00034   \date   2002-01-17
00035 */
00036 #ifndef MSQ_SPHERICAL_DOMAIN_HPP
00037 #define MSQ_SPHERICAL_DOMAIN_HPP
00038 
00039 #include "MeshInterface.hpp"
00040 #include "Vector3D.hpp"
00041 
00042 namespace MBMesquite
00043 {
00044 /*! \class SphericalDomain
00045      This is a template for a spherical domain.
00046      It will provide the normal information necessary for surface mesh optimization.
00047   */
00048 class MESQUITE_EXPORT SphericalDomain : public MBMesquite::MeshDomain
00049 {
00050   public:
00051     SphericalDomain( const Vector3D& p_center, double p_radius ) : mCenter( p_center ), mRadius( p_radius ) {}
00052 
00053     SphericalDomain() {}
00054 
00055     virtual ~SphericalDomain();
00056 
00057     void set_sphere( const Vector3D& p_center, double p_radius )
00058     {
00059         mCenter = p_center;
00060         mRadius = p_radius;
00061     }
00062 
00063     void fit_vertices( Mesh* mesh, MsqError& err, double epsilon = 0.0 );
00064 
00065     void fit_vertices( Mesh* mesh,
00066                        const Mesh::VertexHandle* vertex_array,
00067                        size_t vertex_array_length,
00068                        MsqError& err,
00069                        double epsilon = 0.0 );
00070 
00071     virtual void snap_to( Mesh::VertexHandle entity_handle, Vector3D& coordinate ) const;
00072 
00073     virtual void vertex_normal_at( Mesh::VertexHandle entity_handle, Vector3D& coordinate ) const;
00074 
00075     virtual void element_normal_at( Mesh::ElementHandle entity_handle, Vector3D& coordinate ) const;
00076 
00077     virtual void vertex_normal_at( const Mesh::VertexHandle* handle,
00078                                    Vector3D coords[],
00079                                    unsigned count,
00080                                    MsqError& err ) const;
00081 
00082     virtual void closest_point( Mesh::VertexHandle handle,
00083                                 const Vector3D& position,
00084                                 Vector3D& closest,
00085                                 Vector3D& normal,
00086                                 MsqError& err ) const;
00087 
00088     virtual void domain_DoF( const Mesh::VertexHandle* handle_array,
00089                              unsigned short* dof_array,
00090                              size_t num_vertices,
00091                              MsqError& err ) const;
00092 
00093     Vector3D center() const
00094     {
00095         return mCenter;
00096     }
00097     double radius() const
00098     {
00099         return mRadius;
00100     }
00101 
00102   private:
00103     Vector3D mCenter;
00104     double mRadius;
00105 };
00106 }  // namespace MBMesquite
00107 
00108 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines