MOAB: Mesh Oriented datABase  (version 5.2.1)
CylinderDomain.hpp
Go to the documentation of this file.
00001 /* *****************************************************************
00002     MESQUITE -- The Mesh Quality Improvement Toolkit
00003 
00004     Copyright 2005 Lawrence Livermore National Laboratory.  Under
00005     the terms of Contract B545069 with the University of Wisconsin --
00006     Madison, Lawrence Livermore National Laboratory 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     kraftche@cae.wisc.edu
00024 
00025   ***************************************************************** */
00026 
00027 #ifndef MSQ_CYLINDER_DOMAIN_HPP
00028 #define MSQ_CYLINDER_DOMAIN_HPP
00029 
00030 #include "Mesquite.hpp"
00031 #include "MeshInterface.hpp"
00032 #include "Vector3D.hpp"
00033 
00034 namespace MBMesquite
00035 {
00036 /*! \class CylinderDomain
00037      Define the geometry of an unbounded cylinder.
00038   */
00039 class MESQUITE_EXPORT CylinderDomain : public MBMesquite::MeshDomain
00040 {
00041   public:
00042     /**
00043      *\param radius         - Radius of the cylinder
00044      *\param axis_direction - Vector defining the direction of the axis
00045      *\param axis_point     - A point through which the axis passes.
00046      */
00047     inline CylinderDomain( double p_radius, Vector3D axis_direction = Vector3D( 0, 0, 1 ),
00048                            Vector3D axis_point = Vector3D( 0, 0, 0 ), bool outward_normal = true )
00049         : mAxis( axis_direction / axis_direction.length() ), mCenter( axis_point ), mRadius( p_radius ),
00050           outwardSign( outward_normal ? 1.0 : -1.0 )
00051     {
00052     }
00053 
00054     virtual ~CylinderDomain();
00055 
00056     virtual void snap_to( Mesh::VertexHandle entity_handle, Vector3D& coordinate ) const;
00057 
00058     virtual void vertex_normal_at( Mesh::VertexHandle entity_handle, Vector3D& coordinate ) const;
00059 
00060     virtual void element_normal_at( Mesh::ElementHandle entity_handle, Vector3D& coordinate ) const;
00061 
00062     virtual void vertex_normal_at( const Mesh::VertexHandle* handle, Vector3D coords[], unsigned count,
00063                                    MsqError& err ) const;
00064 
00065     virtual void closest_point( Mesh::VertexHandle handle, const Vector3D& position, Vector3D& closest,
00066                                 Vector3D& normal, MsqError& err ) const;
00067 
00068     virtual void domain_DoF( const Mesh::VertexHandle* handle_array, unsigned short* dof_array, size_t count,
00069                              MsqError& err ) const;
00070 
00071     const Vector3D& axis() const
00072     {
00073         return mAxis;
00074     }
00075     const Vector3D& center() const
00076     {
00077         return mCenter;
00078     }
00079     double radius() const
00080     {
00081         return mRadius;
00082     }
00083 
00084   protected:
00085     virtual void evaluate( Mesh::VertexHandle handle, const Vector3D& point, Vector3D& closest,
00086                            Vector3D& normal ) const;
00087 
00088   private:
00089     Vector3D mAxis;
00090     Vector3D mCenter;
00091     double mRadius;
00092     double outwardSign;
00093 };
00094 
00095 }  // namespace MBMesquite
00096 
00097 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines