MOAB: Mesh Oriented datABase  (version 5.2.1)
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, const Vector3D& position, Vector3D& closest,
00089                             Vector3D& normal ) const;
00090 
00091     int get_dimension( iBase_EntityHandle const* geom_handle, unsigned short* dof_out, size_t count ) const;
00092 
00093     iGeom_Instance geomIFace;
00094 
00095   private:
00096     mutable std::vector< iBase_EntityHandle > geomHandles;
00097     mutable std::vector< double > coordArray;
00098     mutable std::vector< int > typeArray;
00099 };
00100 
00101 /**\brief A MBMesquite::MeshDomain implemented on top of the ITAPS iGeom API.
00102  *
00103  * Simple MeshDomain class implementatation that queries a single iGeom
00104  * entity for all geometric queries.  Suitable for use when the entire
00105  * mesh to be smoothed lies on a single geometric surface.
00106  */
00107 class MsqIGeom : public MsqCommonIGeom
00108 {
00109   public:
00110     MsqIGeom( iGeom_Instance geom, iBase_EntityHandle geom_ent_handle );
00111 
00112     virtual ~MsqIGeom();
00113 
00114     void snap_to( Mesh::VertexHandle entity_handle, Vector3D& coordinat ) const;
00115 
00116     void vertex_normal_at( Mesh::VertexHandle entity_handle, Vector3D& coordinate ) const;
00117 
00118     void element_normal_at( Mesh::ElementHandle entity_handle, Vector3D& coordinate ) const;
00119 
00120     void vertex_normal_at( const Mesh::VertexHandle* handles, Vector3D coordinates[], unsigned count,
00121                            MsqError& err ) const;
00122 
00123     void closest_point( Mesh::VertexHandle handle, const Vector3D& position, Vector3D& closest, Vector3D& normal,
00124                         MsqError& err ) const;
00125 
00126     void domain_DoF( const Mesh::VertexHandle* handle_array, unsigned short* dof_array, size_t num_vertices,
00127                      MsqError& err ) const;
00128 
00129   private:
00130     /** A handle for the geometry entity to evaluate */
00131     iBase_EntityHandle geomEntHandle;
00132 };
00133 
00134 }  // namespace MBMesquite
00135 
00136 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines