MOAB: Mesh Oriented datABase  (version 5.4.0)
MsqIGeom.hpp
Go to the documentation of this file.
00001 /* *****************************************************************
00002     MESQUITE -- The Mesh Quality Improvement Toolkit
00003 
00004     Copyright 2004 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   \file   MsqIGeom.hpp
00028   \brief  MBMesquite::MeshDomain implemented on ITAPS iGeom API
00029   \author Jason Kraftcheck
00030   \date   2007-08-14
00031 */
00032 
00033 #ifndef MSQ_IGEOM_HPP
00034 #define MSQ_IGEOM_HPP
00035 
00036 #include "Mesquite.hpp"
00037 #include "MeshInterface.hpp"
00038 #include "iGeom.h"
00039 #include <vector>
00040 
00041 namespace MBMesquite
00042 {
00043 
00044 /**\brief Common code for specific implementations of MeshDomain on ITAPS interfaces.
00045  *
00046  * This class contains the common functionality used by concrete implementations
00047  * of MeshDomain on the ITAPS geometry interface.
00048  */
00049 class MsqCommonIGeom : public MeshDomain
00050 {
00051   public:
00052     /**\param geom The ITAPS geometry interface implementation to query */
00053     MsqCommonIGeom( iGeom_Instance geom );
00054 
00055     virtual ~MsqCommonIGeom();
00056 
00057     /** Evaluate the closest point to the input position on the specified
00058      *  geometric entity and return the result in the passed position
00059      *  argument (move the passed position onto the geometry.)
00060      */
00061     int move_to( iBase_EntityHandle geom_handle, Vector3D& coord ) const;
00062 
00063     /** Given a geometric entity and a position, evaluate the normal
00064      *  on the geometric entity at the closest point on that entity
00065      *  to the input position, and pass back the result in the input
00066      *  coord vector.
00067      */
00068     int normal( iBase_EntityHandle geom_handle, Vector3D& coord ) const;
00069 
00070     /** Given a geometric entity and a position, evaluate the normal
00071      *  on the geometric entity at the closest point on that entity
00072      *  to the input position, and pass back the result in the input
00073      *  coord vector.
00074      */
00075     int normal( iBase_EntityHandle geom_handle, Vector3D coords[], unsigned count ) const;
00076 
00077     /** Given a geometric entity and a position, evaluate the normal
00078      *  on the geometric entity at the closest point on that entity
00079      *  to the input position, and pass back the result in the input
00080      *  coord vector.
00081      */
00082     int normal( const iBase_EntityHandle geom_handles[], Vector3D coords[], unsigned count ) const;
00083 
00084     /** Given a geometric entity and a position, get point on
00085      *  the geometric entity closest to the input position, and
00086      *  the surface normal at that position.
00087      */
00088     int closest_and_normal( iBase_EntityHandle geom_handle,
00089                             const Vector3D& position,
00090                             Vector3D& closest,
00091                             Vector3D& normal ) const;
00092 
00093     int get_dimension( iBase_EntityHandle const* geom_handle, unsigned short* dof_out, size_t count ) const;
00094 
00095     iGeom_Instance geomIFace;
00096 
00097   private:
00098     mutable std::vector< iBase_EntityHandle > geomHandles;
00099     mutable std::vector< double > coordArray;
00100     mutable std::vector< int > typeArray;
00101 };
00102 
00103 /**\brief A MBMesquite::MeshDomain implemented on top of the ITAPS iGeom API.
00104  *
00105  * Simple MeshDomain class implementatation that queries a single iGeom
00106  * entity for all geometric queries.  Suitable for use when the entire
00107  * mesh to be smoothed lies on a single geometric surface.
00108  */
00109 class MsqIGeom : public MsqCommonIGeom
00110 {
00111   public:
00112     MsqIGeom( iGeom_Instance geom, iBase_EntityHandle geom_ent_handle );
00113 
00114     virtual ~MsqIGeom();
00115 
00116     void snap_to( Mesh::VertexHandle entity_handle, Vector3D& coordinat ) const;
00117 
00118     void vertex_normal_at( Mesh::VertexHandle entity_handle, Vector3D& coordinate ) const;
00119 
00120     void element_normal_at( Mesh::ElementHandle entity_handle, Vector3D& coordinate ) const;
00121 
00122     void vertex_normal_at( const Mesh::VertexHandle* handles,
00123                            Vector3D coordinates[],
00124                            unsigned count,
00125                            MsqError& err ) const;
00126 
00127     void closest_point( Mesh::VertexHandle handle,
00128                         const Vector3D& position,
00129                         Vector3D& closest,
00130                         Vector3D& normal,
00131                         MsqError& err ) const;
00132 
00133     void domain_DoF( const Mesh::VertexHandle* handle_array,
00134                      unsigned short* dof_array,
00135                      size_t num_vertices,
00136                      MsqError& err ) const;
00137 
00138   private:
00139     /** A handle for the geometry entity to evaluate */
00140     iBase_EntityHandle geomEntHandle;
00141 };
00142 
00143 }  // namespace MBMesquite
00144 
00145 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines