MOAB: Mesh Oriented datABase  (version 5.2.1)
ConicDomain.hpp
Go to the documentation of this file.
00001 /* *****************************************************************
00002     MESQUITE -- The Mesh Quality Improvement Toolkit
00003 
00004     Copyright 2007 Sandia National Laboratories.  Developed at the
00005     University of Wisconsin--Madison under SNL contract number
00006     624796.  The U.S. Government and the University of Wisconsin
00007     retain certain rights to 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     (2010) kraftche@cae.wisc.edu
00024 
00025   ***************************************************************** */
00026 
00027 /** \file ConicDomain.hpp
00028  *  \brief
00029  *  \author Jason Kraftcheck
00030  */
00031 
00032 #ifndef MSQ_CONIC_DOMAIN_HPP
00033 #define MSQ_CONIC_DOMAIN_HPP
00034 
00035 #include "Mesquite.hpp"
00036 #include "MeshInterface.hpp"
00037 #include "Vector3D.hpp"
00038 
00039 namespace MBMesquite
00040 {
00041 
00042 /*! \class ConicDomain
00043      Define the geometry of an unbounded cone with circular cross-section.
00044   */
00045 class MESQUITE_EXPORT ConicDomain : public MBMesquite::MeshDomain
00046 {
00047   public:
00048     /**
00049      *\param radius_at_point    The radius of the cone at axis_point
00050      *\param height_to_apex     The distance in the direction of
00051      *                          axis_direction from axis_point to the apex
00052      *\param axis_direction     Vector defining the direction of the axis
00053      *\param axis_point         A point through which the axis passes.
00054      *\NOTE Cone is not bounded at apex.  It extends infinitely in both
00055      *      directions.
00056      */
00057     inline ConicDomain( double radius_at_point, double height_to_apex, Vector3D axis_direction = Vector3D( 0, 0, 1 ),
00058                         Vector3D axis_point = Vector3D( 0, 0, 0 ), bool outward_normal = true )
00059         : mAxis( axis_direction / axis_direction.length() ), mPoint( axis_point ), mRadius( radius_at_point ),
00060           mHeight( height_to_apex ), outwardSign( outward_normal ? 1.0 : -1.0 )
00061     {
00062     }
00063 
00064     inline ConicDomain() {}
00065 
00066     virtual ~ConicDomain();
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 count,
00081                              MsqError& err ) const;
00082 
00083     const Vector3D& axis() const
00084     {
00085         return mAxis;
00086     }
00087     const Vector3D& point() const
00088     {
00089         return mPoint;
00090     }
00091     double point_radius() const
00092     {
00093         return mRadius;
00094     }
00095     double height_from_point() const
00096     {
00097         return mHeight;
00098     }
00099 
00100   protected:
00101     virtual void evaluate( Mesh::VertexHandle handle, const Vector3D& point, Vector3D& closest,
00102                            Vector3D& normal ) const;
00103 
00104   private:
00105     Vector3D mAxis;      //!< Direction of central axis of cone. Unit vector.
00106     Vector3D mPoint;     //!< A point on the axis of the cone.
00107     double mRadius;      //!< Radius at mPoint
00108     double mHeight;      //!< Distance from mPoint to apex, in direction of mAxis
00109     double outwardSign;  //!< 1.0 if normal points away from axis, -1.0 otherwise
00110 };
00111 
00112 }  // namespace MBMesquite
00113 
00114 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines