Changeset 2771 for ddriv

Show
Ignore:
Timestamp:
03/27/09 14:13:54 (12 months ago)
Author:
kraftche
Message:

add missing tag_tag_handle function(s) in OptUtils?

Location:
ddriv/trunk
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • ddriv/trunk/DdrivDerivs.hpp

    r2754 r2771  
    8181 
    8282    // mesquite mesh and geometry objects 
    83   Mesquite::MeshTSTT* msqMesh; 
    84   Mesquite::GeomTSTT* msqDomain; 
     83  //Mesquite::MeshTSTT* msqMesh; 
     84  //Mesquite::GeomTSTT* msqDomain; 
    8585   
    8686  unsigned int *adj_cv_s, *infl_scl_p, *infl_cv_p; 
  • ddriv/trunk/OptUtils.cpp

    r2754 r2771  
    324324{ 
    325325  if (0 == origCoordsTag && create_if_missing) { 
    326     origCoordsTag = OptUtils::get_tag_handle(myMesh, ORIG_COORDS_TAG_NAME.c_str(), 
    327                                              3, iBase_DOUBLE); 
     326    origCoordsTag = get_imesh_tag( ORIG_COORDS_TAG_NAME.c_str(), 3, iBase_DOUBLE); 
    328327  } 
    329328   
     
    335334{ 
    336335  if (0 == normalTag && create_if_missing) { 
    337     normalTag = OptUtils::get_tag_handle(myMesh, NORMAL_TAG_NAME.c_str(), 
    338                                          3, iBase_DOUBLE); 
     336    normalTag = get_imesh_tag( NORMAL_TAG_NAME.c_str(), 3, iBase_DOUBLE); 
    339337  } 
    340338   
     
    346344{ 
    347345  if (0 == dndxTag && create_if_missing) { 
    348     dndxTag = OptUtils::get_tag_handle(myMesh, DNDX_TAG_NAME.c_str(), 
    349                                         9, iBase_DOUBLE); 
     346    dndxTag = get_imesh_tag( DNDX_TAG_NAME.c_str(), 9, iBase_DOUBLE); 
    350347  } 
    351348   
     
    741738} 
    742739 
    743  
     740   
     741iBase_TagHandle OptUtils::get_tag_handle( iMesh_Instance myMesh, 
     742                                          const char* tag_name, 
     743                                          int tag_size, 
     744                                          iBase_TagValueType tag_type ) 
     745{ 
     746  int ierr; 
     747  iBase_TagHandle tag; 
     748  iMesh_getTagHandle( myMesh, tag_name, &tag, &ierr, strlen(tag_name) ); 
     749  if (iBase_SUCCESS == ierr) { 
     750    if (tag_size > 0) { 
     751      int size; 
     752      iMesh_getTagSizeValues( myMesh, tag, &size, &ierr ); 
     753      if (ierr) { 
     754        std::cerr << "Error " << ierr << " retreiving size for tag: " << tag_name << std::endl; 
     755        tag = 0; 
     756      } 
     757      else if (size != tag_size) { 
     758        std::cerr << "Unexpectes size (" << size << ") for tag: " << tag_name << std::endl; 
     759        tag = 0; 
     760      } 
     761    } 
     762    if (iBase_BYTES != tag_type) { 
     763      int type; 
     764      iMesh_getTagType( myMesh, tag, &type, &ierr ); 
     765      if (ierr) { 
     766        std::cerr << "Error " << ierr << " retreiving type for tag: " << tag_name << std::endl; 
     767        tag = 0; 
     768      } 
     769      else if (type != tag_type) { 
     770        std::cerr << "Unexpectes type (" << type << ") for tag: " << tag_name << std::endl; 
     771        tag = 0; 
     772      } 
     773    } 
     774  } 
     775  else if (iBase_TAG_NOT_FOUND == ierr && tag_size > 0) { 
     776    iMesh_createTag( myMesh, tag_name, tag_size, tag_type, &tag, &ierr, strlen(tag_name) ); 
     777    if (iBase_SUCCESS != ierr) { 
     778      std::cerr << "Error " << ierr << " creating tag: " << tag_name << std::endl; 
     779      tag = 0; 
     780    } 
     781  } 
     782  else { 
     783    std::cerr << "Error " << ierr << " retreiving handle for tag: " << tag_name << std::endl; 
     784    tag = 0; 
     785  } 
     786   
     787  return tag; 
     788} 
     789 
     790iBase_TagHandle OptUtils::get_tag_handle( iGeom_Instance myGeom, 
     791                                          const char* tag_name, 
     792                                          int tag_size, 
     793                                          iBase_TagValueType tag_type ) 
     794{ 
     795  int ierr; 
     796  iBase_TagHandle tag; 
     797  iGeom_getTagHandle( myGeom, tag_name, &tag, &ierr, strlen(tag_name) ); 
     798  if (iBase_SUCCESS == ierr) { 
     799    if (tag_size > 0) { 
     800      int size; 
     801      iGeom_getTagSizeValues( myGeom, tag, &size, &ierr ); 
     802      if (ierr) { 
     803        std::cerr << "Error " << ierr << " retreiving size for tag: " << tag_name << std::endl; 
     804        tag = 0; 
     805      } 
     806      else if (size != tag_size) { 
     807        std::cerr << "Unexpectes size (" << size << ") for tag: " << tag_name << std::endl; 
     808        tag = 0; 
     809      } 
     810    } 
     811    if (iBase_BYTES != tag_type) { 
     812      int type; 
     813      iGeom_getTagType( myGeom, tag, &type, &ierr ); 
     814      if (ierr) { 
     815        std::cerr << "Error " << ierr << " retreiving type for tag: " << tag_name << std::endl; 
     816        tag = 0; 
     817      } 
     818      else if (type != tag_type) { 
     819        std::cerr << "Unexpectes type (" << type << ") for tag: " << tag_name << std::endl; 
     820        tag = 0; 
     821      } 
     822    } 
     823  } 
     824  else if (iBase_TAG_NOT_FOUND == ierr && tag_size > 0) { 
     825    iGeom_createTag( myGeom, tag_name, tag_size, tag_type, &tag, &ierr, strlen(tag_name) ); 
     826    if (iBase_SUCCESS != ierr) { 
     827      std::cerr << "Error " << ierr << " creating tag: " << tag_name << std::endl; 
     828      tag = 0; 
     829    } 
     830  } 
     831  else { 
     832    std::cerr << "Error " << ierr << " retreiving handle for tag: " << tag_name << std::endl; 
     833    tag = 0; 
     834  } 
     835   
     836  return tag; 
     837} 
     838 
     839 
  • ddriv/trunk/OptUtils.hpp

    r2754 r2771  
    2727#include <string> 
    2828 
    29 namespace Mesquite  
    30 { 
    31   class MeshTSTT; 
    32   class GeomTSTT; 
    33 } 
    34  
    3529class OptUtils  
    3630{ 
     
    4539  bool reset_relation(const bool create_new); 
    4640   
    47   static iBase_TagHandle get_tag_handle(iBase_Instance tag_iface, 
    48                                        const char* tag_name, 
    49                                        int tag_size = -1, 
    50                                        iBase_TagValueType tag_type = iBase_BYTES); 
     41  iBase_TagHandle get_imesh_tag(const char* tag_name, 
     42                                int tag_size = -1, 
     43                                iBase_TagValueType tag_type = iBase_BYTES) 
     44  { return get_tag_handle( myMesh, tag_name, tag_size, tag_type ); } 
     45   
     46  iBase_TagHandle get_igeom_tag(const char* tag_name, 
     47                                int tag_size = -1, 
     48                                iBase_TagValueType tag_type = iBase_BYTES) 
     49  { return get_tag_handle( myGeom, tag_name, tag_size, tag_type ); } 
     50   
     51  static iBase_TagHandle get_tag_handle( iMesh_Instance mesh,  
     52                                         const char* tag_name, 
     53                                         int tag_size = -1, 
     54                                         iBase_TagValueType tag_type = iBase_BYTES); 
     55   
     56  static iBase_TagHandle get_tag_handle( iGeom_Instance geom, 
     57                                         const char* tag_name, 
     58                                         int tag_size = -1, 
     59                                         iBase_TagValueType tag_type = iBase_BYTES); 
    5160   
    5261  iBase_TagHandle get_mesh_tag_handle( iMesh_Instance instance, 
  • ddriv/trunk/SmoothUtils.cpp

    r2770 r2771  
    865865 
    866866    // store these as tags 
    867   iBase_TagHandle vert_targs = myOu.get_tag_handle( myOu.myMesh, "VERTEX_TARGETS", 1, iBase_DOUBLE ); 
     867  iBase_TagHandle vert_targs = myOu.get_imesh_tag( "VERTEX_TARGETS", 1, iBase_DOUBLE ); 
    868868  if (!vert_targs) 
    869869    return false; 
     
    979979  int result; 
    980980   
    981   iBase_TagHandle tag = OptUtils::get_tag_handle( myOu.myMesh, VERTEX_FIXED_TAG_NAME,  
     981  iBase_TagHandle tag = myOu.get_imesh_tag( VERTEX_FIXED_TAG_NAME,  
    982982                                                  1, iBase_INTEGER ); 
    983983  if (!tag)