MOAB: Mesh Oriented datABase  (version 5.3.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     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   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, const Mesh::VertexHandle* vertex_array, size_t vertex_array_length, MsqError& err,
00066                        double epsilon = 0.0 );
00067 
00068     virtual void snap_to( Mesh::VertexHandle entity_handle, Vector3D& coordinate ) const;
00069 
00070     virtual void vertex_normal_at( Mesh::VertexHandle entity_handle, Vector3D& coordinate ) const;
00071 
00072     virtual void element_normal_at( Mesh::ElementHandle entity_handle, Vector3D& coordinate ) const;
00073 
00074     virtual void vertex_normal_at( const Mesh::VertexHandle* handle, Vector3D coords[], unsigned count,
00075                                    MsqError& err ) const;
00076 
00077     virtual void closest_point( Mesh::VertexHandle handle, const Vector3D& position, Vector3D& closest,
00078                                 Vector3D& normal, MsqError& err ) const;
00079 
00080     virtual void domain_DoF( const Mesh::VertexHandle* handle_array, unsigned short* dof_array, size_t num_vertices,
00081                              MsqError& err ) const;
00082 
00083     Vector3D center() const
00084     {
00085         return mCenter;
00086     }
00087     double radius() const
00088     {
00089         return mRadius;
00090     }
00091 
00092   private:
00093     Vector3D mCenter;
00094     double mRadius;
00095 };
00096 }  // namespace MBMesquite
00097 
00098 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines