MeshKit  1.0
MsqFBiGeom.cpp
Go to the documentation of this file.
00001 #include "meshkit/MKCore.hpp"
00002 #include "meshkit/MsqFBiGeom.hpp"
00003 
00004 namespace MeshKit
00005 {
00006 
00007 MsqFBiGeom::MsqFBiGeom( FBiGeom * ifbigeom,
00008             iBase_EntityHandle geom_ent_handle )
00009 {
00010   geomEntHandle = geom_ent_handle;
00011   fbigeom = ifbigeom;
00012 }
00013 
00014 MsqFBiGeom::~MsqFBiGeom() {}
00015 
00016 void MsqFBiGeom::snap_to( Mesh::VertexHandle ,
00017     Vector3D& coord ) const
00018 {
00019   double x, y, z;
00020   iBase_ErrorType err = fbigeom->getEntClosestPt(geomEntHandle, coord[0], coord[1], coord[2], x, y, z );
00021   IBERRCHK(err, "Failed to get closest point to surface.");
00022   coord.set( x, y, z );
00023 }
00024 
00025 void MsqFBiGeom::vertex_normal_at( Mesh::VertexHandle /*entity_handle*/,  // the mesh vertex handle is unused
00026                          Vector3D& coord ) const
00027 {
00028   double i, j, k;
00029   iBase_ErrorType err = fbigeom->getEntNrmlXYZ( geomEntHandle, coord[0], coord[1], coord[2], i, j, k);
00030   IBERRCHK(err, "Failed to get normal to surface.");
00031   coord.set( i, j, k );
00032 
00033 }
00034 
00035 void MsqFBiGeom::element_normal_at( Mesh::ElementHandle /*entity_handle*/,  // the mesh element handle is unused
00036                           Vector3D& coord ) const
00037 {
00038   double i, j, k;
00039   iBase_ErrorType err = fbigeom->getEntNrmlXYZ( geomEntHandle, coord[0], coord[1], coord[2], i, j, k);
00040   IBERRCHK(err, "Failed to get normal to surface.");
00041   coord.set( i, j, k );
00042 }
00043 
00044 void MsqFBiGeom::vertex_normal_at( const Mesh::VertexHandle* /*handles*/,
00045                          Vector3D coordinates[],
00046                          unsigned count,
00047                          MsqError& err ) const
00048 {
00049   for (unsigned int i=0; i<count; i++)
00050   {
00051     double x, y, z;
00052     Vector3D coord =coordinates[i];
00053     iBase_ErrorType err = fbigeom->getEntNrmlXYZ( geomEntHandle, coord[0], coord[1], coord[2], x, y, z);
00054     IBERRCHK(err, "Failed to get normal to surface.");
00055     coordinates[i].set( x, y, z );
00056   }
00057 
00058 }
00059 
00060 void MsqFBiGeom::closest_point( Mesh::VertexHandle handle,
00061                       const Vector3D& position,
00062                       Vector3D& closest,
00063                       Vector3D& normal,
00064                       MsqError& err ) const
00065 {
00066   iBase_ErrorType ierr = fbigeom->getEntNrmlPlXYZ( geomEntHandle,
00067                            position[0], position[1], position[2],
00068                            closest[0], closest[1], closest[2],
00069                            normal[0],  normal[1],  normal[2]);
00070   IBERRCHK(ierr, "Failed to get normal and closest point to surface.");
00071 }
00072 
00073 void MsqFBiGeom::domain_DoF( const Mesh::VertexHandle* handle_array,
00074                    unsigned short* dof_array,
00075                    size_t num_vertices,
00076                    MsqError& err ) const
00077 {
00078   // just fill with 2, this is a surface, we know
00079   for (size_t i = 0; i< num_vertices; i++)
00080   {
00081     dof_array[i]=2;
00082   }
00083 }
00084 
00085 }// end namespace
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines