MOAB: Mesh Oriented datABase
(version 5.4.1)
|
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 [email protected] 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, 00048 Vector3D axis_direction = Vector3D( 0, 0, 1 ), 00049 Vector3D axis_point = Vector3D( 0, 0, 0 ), 00050 bool outward_normal = true ) 00051 : mAxis( axis_direction / axis_direction.length() ), mCenter( axis_point ), mRadius( p_radius ), 00052 outwardSign( outward_normal ? 1.0 : -1.0 ) 00053 { 00054 } 00055 00056 virtual ~CylinderDomain(); 00057 00058 virtual void snap_to( Mesh::VertexHandle entity_handle, Vector3D& coordinate ) const; 00059 00060 virtual void vertex_normal_at( Mesh::VertexHandle entity_handle, Vector3D& coordinate ) const; 00061 00062 virtual void element_normal_at( Mesh::ElementHandle entity_handle, Vector3D& coordinate ) const; 00063 00064 virtual void vertex_normal_at( const Mesh::VertexHandle* handle, 00065 Vector3D coords[], 00066 unsigned count, 00067 MsqError& err ) const; 00068 00069 virtual void closest_point( Mesh::VertexHandle handle, 00070 const Vector3D& position, 00071 Vector3D& closest, 00072 Vector3D& normal, 00073 MsqError& err ) const; 00074 00075 virtual void domain_DoF( const Mesh::VertexHandle* handle_array, 00076 unsigned short* dof_array, 00077 size_t count, 00078 MsqError& err ) const; 00079 00080 const Vector3D& axis() const 00081 { 00082 return mAxis; 00083 } 00084 const Vector3D& center() const 00085 { 00086 return mCenter; 00087 } 00088 double radius() const 00089 { 00090 return mRadius; 00091 } 00092 00093 protected: 00094 virtual void evaluate( Mesh::VertexHandle handle, 00095 const Vector3D& point, 00096 Vector3D& closest, 00097 Vector3D& normal ) const; 00098 00099 private: 00100 Vector3D mAxis; 00101 Vector3D mCenter; 00102 double mRadius; 00103 double outwardSign; 00104 }; 00105 00106 } // namespace MBMesquite 00107 00108 #endif