MOAB: Mesh Oriented datABase  (version 5.4.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) [email protected]
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,
00058                         double height_to_apex,
00059                         Vector3D axis_direction = Vector3D( 0, 0, 1 ),
00060                         Vector3D axis_point     = Vector3D( 0, 0, 0 ),
00061                         bool outward_normal     = true )
00062         : mAxis( axis_direction / axis_direction.length() ), mPoint( axis_point ), mRadius( radius_at_point ),
00063           mHeight( height_to_apex ), outwardSign( outward_normal ? 1.0 : -1.0 )
00064     {
00065     }
00066 
00067     inline ConicDomain() {}
00068 
00069     virtual ~ConicDomain();
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 count,
00091                              MsqError& err ) const;
00092 
00093     const Vector3D& axis() const
00094     {
00095         return mAxis;
00096     }
00097     const Vector3D& point() const
00098     {
00099         return mPoint;
00100     }
00101     double point_radius() const
00102     {
00103         return mRadius;
00104     }
00105     double height_from_point() const
00106     {
00107         return mHeight;
00108     }
00109 
00110   protected:
00111     virtual void evaluate( Mesh::VertexHandle handle,
00112                            const Vector3D& point,
00113                            Vector3D& closest,
00114                            Vector3D& normal ) const;
00115 
00116   private:
00117     Vector3D mAxis;      //!< Direction of central axis of cone. Unit vector.
00118     Vector3D mPoint;     //!< A point on the axis of the cone.
00119     double mRadius;      //!< Radius at mPoint
00120     double mHeight;      //!< Distance from mPoint to apex, in direction of mAxis
00121     double outwardSign;  //!< 1.0 if normal points away from axis, -1.0 otherwise
00122 };
00123 
00124 }  // namespace MBMesquite
00125 
00126 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines