[MOAB-dev] commit/MOAB: 18 new changesets

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Fri Jun 27 16:56:44 CDT 2014


18 new commits in MOAB:

https://bitbucket.org/fathomteam/moab/commits/3b4e0576ea77/
Changeset:   3b4e0576ea77
Branch:      None
User:        pshriwise
Date:        2014-06-27 23:30:33
Summary:     Implemented a new function add_vertices in ReadCGM.

Affected #:  2 files

diff --git a/src/io/ReadCGM.cpp b/src/io/ReadCGM.cpp
index d563293..dd309da 100644
--- a/src/io/ReadCGM.cpp
+++ b/src/io/ReadCGM.cpp
@@ -484,6 +484,7 @@ ErrorCode ReadCGM::store_group_content( Interface* /* moab */, std::map<RefEntit
   return MB_SUCCESS;
 }
 
+
 void ReadCGM::set_cgm_attributes(bool const act_attributes, bool const verbose)
 {
 
@@ -500,6 +501,31 @@ void ReadCGM::set_cgm_attributes(bool const act_attributes, bool const verbose)
 
 }
 
+
+  ErrorCode ReadCGM::add_vertices( Interface* moab, std::map<RefEntity*,EntityHandle> entitymap[5] )
+{
+
+ ErrorCode rval;
+ std::map<RefEntity*,EntityHandle>::iterator ci;
+ for (ci = entitymap[0].begin(); ci != entitymap[0].end(); ++ci) {
+    CubitVector pos = dynamic_cast<RefVertex*>(ci->first)->coordinates();
+    double coords[3] = {pos.x(), pos.y(), pos.z()};
+    EntityHandle vh;
+    rval = moab->create_vertex( coords, vh );
+    if (MB_SUCCESS != rval)
+      return MB_FAILURE;
+    
+    rval = moab->add_entities( ci->second, &vh, 1 );
+    if (MB_SUCCESS != rval)
+      return MB_FAILURE;
+    
+    ci->second = vh;
+  }
+  return MB_SUCCESS;
+}
+
+
+
 // copy geometry into mesh database
 ErrorCode ReadCGM::load_file(const char *cgm_file_name,
                       const EntityHandle* file_set,
@@ -587,23 +613,12 @@ ErrorCode ReadCGM::load_file(const char *cgm_file_name,
   entmap[3].clear();
   entmap[4].clear();
   
+
   // create geometry for all vertices and replace 
   // vertex set handles with vertex handles in map
-  for (ci = entmap[0].begin(); ci != entmap[0].end(); ++ci) {
-    CubitVector pos = dynamic_cast<RefVertex*>(ci->first)->coordinates();
-    double coords[3] = {pos.x(), pos.y(), pos.z()};
-    EntityHandle vh;
-    rval = mdbImpl->create_vertex( coords, vh );
-    if (MB_SUCCESS != rval)
-      return MB_FAILURE;
-    
-    rval = mdbImpl->add_entities( ci->second, &vh, 1 );
-    if (MB_SUCCESS != rval)
-      return MB_FAILURE;
-    
-    ci->second = vh;
-  }
-
+  rval = add_vertices( mdbImpl, entmap );
+  if(rval!=MB_SUCCESS) return rval; 
+ 
   // maximum allowable curve-endpoint proximity warnings
   // if this integer becomes negative, then abs(curve_warnings) is the 
   // number of warnings that were suppressed.

diff --git a/src/io/ReadCGM.hpp b/src/io/ReadCGM.hpp
index 2e38bbd..8150db4 100644
--- a/src/io/ReadCGM.hpp
+++ b/src/io/ReadCGM.hpp
@@ -95,8 +95,12 @@ public:
 
   ErrorCode store_group_content( Interface* moab, std::map<RefEntity*,EntityHandle>* entitymap );
 
+
   void set_cgm_attributes(bool const act_attributes, bool const verbost);
 
+  ErrorCode add_vertices( Interface* moab, std::map<RefEntity*,EntityHandle> entmap[5] );
+
+
    //! Constructor
    ReadCGM(Interface* impl = NULL);
 


https://bitbucket.org/fathomteam/moab/commits/6623f1b6612e/
Changeset:   6623f1b6612e
Branch:      None
User:        pshriwise
Date:        2014-06-27 23:30:34
Summary:     Created a new function for faceting curves.

Affected #:  2 files

diff --git a/src/io/ReadCGM.cpp b/src/io/ReadCGM.cpp
index dd309da..066c535 100644
--- a/src/io/ReadCGM.cpp
+++ b/src/io/ReadCGM.cpp
@@ -476,7 +476,7 @@ ErrorCode ReadCGM::store_group_content( Interface* /* moab */, std::map<RefEntit
     }
     
     if (!entities.empty()) {
-      rval = mdbImpl->add_entities( ci->second, entities );
+      rval = moab->add_entities( ci->second, entities );
       if (MB_SUCCESS != rval)
         return MB_FAILURE;
     }
@@ -524,6 +524,128 @@ void ReadCGM::set_cgm_attributes(bool const act_attributes, bool const verbose)
   return MB_SUCCESS;
 }
 
+ErrorCode ReadCGM::create_curve_facets( Interface* moab, 
+                                        std::map<RefEntity*,EntityHandle> entitymap[5], 
+                                        int norm_tol, 
+                                        double faceting_tol, 
+                                        bool verbose_warn )
+{
+ 
+  ErrorCode rval;
+  CubitStatus s;
+  // maximum allowable curve-endpoint proximity warnings
+  // if this integer becomes negative, then abs(curve_warnings) is the 
+  // number of warnings that were suppressed.
+  int curve_warnings = 10;
+ 
+  //map iterator
+  std::map<RefEntity*,EntityHandle>::iterator ci; 
+  
+  // create geometry for all curves
+  GMem data;
+  for (ci = entitymap[1].begin(); ci != entitymap[1].end(); ++ci) {
+    RefEdge* edge = dynamic_cast<RefEdge*>(ci->first);
+    Curve* curve = edge->get_curve_ptr();
+    data.clean_out();
+#if  CGM_MAJOR_VERSION>12
+    s = edge->get_graphics( data, norm_tol, faceting_tol);
+#else
+    s = edge->get_graphics( data, faceting_tol);
+#endif
+     if (CUBIT_SUCCESS != s)
+        return MB_FAILURE;
+      
+    std::vector<CubitVector> points;
+    for (int i = 0; i < data.pointListCount; ++i)
+      points.push_back( CubitVector( data.point_list()[i].x,
+                                     data.point_list()[i].y,
+                                     data.point_list()[i].z ) );
+
+      // need to reverse data?
+    if (curve->bridge_sense() == CUBIT_REVERSED) 
+      std::reverse( points.begin(), points.end() );
+    
+       // check for closed curve
+    RefVertex *start_vtx, *end_vtx;
+    start_vtx = edge->start_vertex();
+    end_vtx = edge->end_vertex();
+    
+      // Special case for point curve
+    if (points.size() < 2) {
+      if (start_vtx != end_vtx || curve->measure() > GEOMETRY_RESABS ) {
+        std::cerr << "Warning: No facetting for curve " << edge->id() << std::endl;
+        continue;
+      }
+      EntityHandle h = entitymap[0][start_vtx];
+      rval = moab->add_entities( ci->second, &h, 1 );
+      if (MB_SUCCESS != rval)
+        return MB_FAILURE;
+      continue;
+    }
+    
+    const bool closed = (points.front() - points.back()).length() < GEOMETRY_RESABS;
+    if (closed != (start_vtx == end_vtx)) {
+      std::cerr << "Warning: topology and geometry inconsistant for possibly closed curve "
+                << edge->id() << std::endl;
+    }
+    
+      // check proximity of vertices to end coordinates
+    if ((start_vtx->coordinates() - points.front()).length() > GEOMETRY_RESABS
+     || (  end_vtx->coordinates() - points.back() ).length() > GEOMETRY_RESABS ) {
+
+      curve_warnings--;
+      if( curve_warnings >= 0 || verbose_warn){ 
+	std::cerr << "Warning: vertices not at ends of curve " << edge->id() << std::endl;
+	if( curve_warnings == 0 && !verbose_warn){
+	  std::cerr << "         further instances of this warning will be suppressed..." << std::endl;
+	}
+      }
+
+    }    
+      // create interior points
+    std::vector<EntityHandle> verts, edges;
+    verts.push_back( entitymap[0][start_vtx] );
+    for (size_t i = 1; i < points.size() - 1; ++i) {
+      double coords[] = { points[i].x(), points[i].y(), points[i].z() };
+      EntityHandle h;
+      rval = moab->create_vertex( coords, h );
+      if (MB_SUCCESS != rval)
+        return MB_FAILURE;
+      verts.push_back( h );
+    }
+    verts.push_back( entitymap[0][end_vtx] );
+    
+      // create edges
+    for (size_t i = 0; i < verts.size()-1; ++i) {
+      EntityHandle h;
+      rval = moab->create_element( MBEDGE, &verts[i], 2, h );
+      if (MB_SUCCESS != rval)
+        return MB_FAILURE;
+      edges.push_back( h );
+    }
+    
+      // if closed, remove duplicate
+    if (verts.front() == verts.back())
+      verts.pop_back();
+    
+    rval = moab->add_entities( ci->second, &verts[0], verts.size() );
+    if (MB_SUCCESS != rval)
+      return MB_FAILURE;
+    rval = moab->add_entities( ci->second, &edges[0], edges.size() );
+    if (MB_SUCCESS != rval)
+      return MB_FAILURE;
+  }
+
+  if( !verbose_warn && curve_warnings < 0 ){
+    std::cerr << "Suppressed " << -curve_warnings 
+	      << " 'vertices not at ends of curve' warnings." << std::endl;
+    std::cerr << "To see all warnings, use reader param VERBOSE_CGM_WARNINGS." << std::endl;
+  }
+
+  return MB_SUCCESS;
+}
+
+
 
 
 // copy geometry into mesh database
@@ -618,8 +740,8 @@ ErrorCode ReadCGM::load_file(const char *cgm_file_name,
   // vertex set handles with vertex handles in map
   rval = add_vertices( mdbImpl, entmap );
   if(rval!=MB_SUCCESS) return rval; 
- 
-  // maximum allowable curve-endpoint proximity warnings
+
+  // maximum allowable curve-endpoint proximity warningsg
   // if this integer becomes negative, then abs(curve_warnings) is the 
   // number of warnings that were suppressed.
   int curve_warnings = 10;
@@ -725,7 +847,7 @@ ErrorCode ReadCGM::load_file(const char *cgm_file_name,
 	      << " 'vertices not at ends of curve' warnings." << std::endl;
     std::cerr << "To see all warnings, use reader param VERBOSE_CGM_WARNINGS." << std::endl;
   }
-  
+
     // create geometry for all surfaces
   for (ci = entmap[2].begin(); ci != entmap[2].end(); ++ci) {
     RefFace* face = dynamic_cast<RefFace*>(ci->first);

diff --git a/src/io/ReadCGM.hpp b/src/io/ReadCGM.hpp
index 8150db4..8304e0c 100644
--- a/src/io/ReadCGM.hpp
+++ b/src/io/ReadCGM.hpp
@@ -100,6 +100,11 @@ public:
 
   ErrorCode add_vertices( Interface* moab, std::map<RefEntity*,EntityHandle> entmap[5] );
 
+  ErrorCode create_curve_facets( Interface* moab, 
+                                 std::map<RefEntity*,EntityHandle> entitymap[5],
+                                 int norm_tol,
+                                 double faceting_tol,
+                                 bool verbose_warn = false );
 
    //! Constructor
    ReadCGM(Interface* impl = NULL);


https://bitbucket.org/fathomteam/moab/commits/58dd901c1377/
Changeset:   58dd901c1377
Branch:      None
User:        pshriwise
Date:        2014-06-27 23:30:34
Summary:     Implemented function for faceting curves in ReadCGM.

Affected #:  1 file

diff --git a/src/io/ReadCGM.cpp b/src/io/ReadCGM.cpp
index 066c535..e06f20e 100644
--- a/src/io/ReadCGM.cpp
+++ b/src/io/ReadCGM.cpp
@@ -741,113 +741,12 @@ ErrorCode ReadCGM::load_file(const char *cgm_file_name,
   rval = add_vertices( mdbImpl, entmap );
   if(rval!=MB_SUCCESS) return rval; 
 
-  // maximum allowable curve-endpoint proximity warningsg
-  // if this integer becomes negative, then abs(curve_warnings) is the 
-  // number of warnings that were suppressed.
-  int curve_warnings = 10;
+  // create facets for all curves
+  rval = create_curve_facets( mdbImpl, entmap, norm_tol, faceting_tol, verbose_warnings );
+  if(rval!=MB_SUCCESS) return rval;
+
   
-    // create geometry for all curves
   GMem data;
-  for (ci = entmap[1].begin(); ci != entmap[1].end(); ++ci) {
-    RefEdge* edge = dynamic_cast<RefEdge*>(ci->first);
-    Curve* curve = edge->get_curve_ptr();
-    data.clean_out();
-#if  CGM_MAJOR_VERSION>12
-    edge->get_graphics( data, norm_tol, faceting_tol);
-#else
-    edge->get_graphics( data, faceting_tol);
-#endif
-    if (CUBIT_SUCCESS != s)
-      return MB_FAILURE;
-      
-    std::vector<CubitVector> points;
-    for (int i = 0; i < data.pointListCount; ++i)
-      points.push_back( CubitVector( data.point_list()[i].x,
-                                     data.point_list()[i].y,
-                                     data.point_list()[i].z ) );
-
-      // need to reverse data?
-    if (curve->bridge_sense() == CUBIT_REVERSED) 
-      std::reverse( points.begin(), points.end() );
-    
-       // check for closed curve
-    RefVertex *start_vtx, *end_vtx;
-    start_vtx = edge->start_vertex();
-    end_vtx = edge->end_vertex();
-    
-      // Special case for point curve
-    if (points.size() < 2) {
-      if (start_vtx != end_vtx || curve->measure() > GEOMETRY_RESABS ) {
-        std::cerr << "Warning: No facetting for curve " << edge->id() << std::endl;
-        continue;
-      }
-      EntityHandle h = entmap[0][start_vtx];
-      rval = mdbImpl->add_entities( ci->second, &h, 1 );
-      if (MB_SUCCESS != rval)
-        return MB_FAILURE;
-      continue;
-    }
-    
-    const bool closed = (points.front() - points.back()).length() < GEOMETRY_RESABS;
-    if (closed != (start_vtx == end_vtx)) {
-      std::cerr << "Warning: topology and geometry inconsistant for possibly closed curve "
-                << edge->id() << std::endl;
-    }
-    
-      // check proximity of vertices to end coordinates
-    if ((start_vtx->coordinates() - points.front()).length() > GEOMETRY_RESABS
-     || (  end_vtx->coordinates() - points.back() ).length() > GEOMETRY_RESABS ) {
-
-      curve_warnings--;
-      if( curve_warnings >= 0 || verbose_warnings ){ 
-	std::cerr << "Warning: vertices not at ends of curve " << edge->id() << std::endl;
-	if( curve_warnings == 0 && !verbose_warnings ){
-	  std::cerr << "         further instances of this warning will be suppressed..." << std::endl;
-	}
-      }
-
-    }
-    
-      // create interior points
-    std::vector<EntityHandle> verts, edges;
-    verts.push_back( entmap[0][start_vtx] );
-    for (size_t i = 1; i < points.size() - 1; ++i) {
-      double coords[] = { points[i].x(), points[i].y(), points[i].z() };
-      EntityHandle h;
-      rval = mdbImpl->create_vertex( coords, h );
-      if (MB_SUCCESS != rval)
-        return MB_FAILURE;
-      verts.push_back( h );
-    }
-    verts.push_back( entmap[0][end_vtx] );
-    
-      // create edges
-    for (size_t i = 0; i < verts.size()-1; ++i) {
-      EntityHandle h;
-      rval = mdbImpl->create_element( MBEDGE, &verts[i], 2, h );
-      if (MB_SUCCESS != rval)
-        return MB_FAILURE;
-      edges.push_back( h );
-    }
-    
-      // if closed, remove duplicate
-    if (verts.front() == verts.back())
-      verts.pop_back();
-    
-    rval = mdbImpl->add_entities( ci->second, &verts[0], verts.size() );
-    if (MB_SUCCESS != rval)
-      return MB_FAILURE;
-    rval = mdbImpl->add_entities( ci->second, &edges[0], edges.size() );
-    if (MB_SUCCESS != rval)
-      return MB_FAILURE;
-  }
-
-  if( !verbose_warnings && curve_warnings < 0 ){
-    std::cerr << "Suppressed " << -curve_warnings 
-	      << " 'vertices not at ends of curve' warnings." << std::endl;
-    std::cerr << "To see all warnings, use reader param VERBOSE_CGM_WARNINGS." << std::endl;
-  }
-
     // create geometry for all surfaces
   for (ci = entmap[2].begin(); ci != entmap[2].end(); ++ci) {
     RefFace* face = dynamic_cast<RefFace*>(ci->first);


https://bitbucket.org/fathomteam/moab/commits/274009e66f75/
Changeset:   274009e66f75
Branch:      None
User:        pshriwise
Date:        2014-06-27 23:30:34
Summary:     Added comments to the create_curve_facets function in ReadCGM.

Affected #:  1 file

diff --git a/src/io/ReadCGM.cpp b/src/io/ReadCGM.cpp
index e06f20e..34c74bb 100644
--- a/src/io/ReadCGM.cpp
+++ b/src/io/ReadCGM.cpp
@@ -544,9 +544,13 @@ ErrorCode ReadCGM::create_curve_facets( Interface* moab,
   // create geometry for all curves
   GMem data;
   for (ci = entitymap[1].begin(); ci != entitymap[1].end(); ++ci) {
+    //get the start and end points of the curve in the form of a refernce edge
     RefEdge* edge = dynamic_cast<RefEdge*>(ci->first);
+    //get the edge's curve information
     Curve* curve = edge->get_curve_ptr();
+    //clean out previous curve information
     data.clean_out();
+    //facet curve accoring to parameters and CGM version
 #if  CGM_MAJOR_VERSION>12
     s = edge->get_graphics( data, norm_tol, faceting_tol);
 #else
@@ -557,6 +561,7 @@ ErrorCode ReadCGM::create_curve_facets( Interface* moab,
       
     std::vector<CubitVector> points;
     for (int i = 0; i < data.pointListCount; ++i)
+      //add Cubit vertext points to a list
       points.push_back( CubitVector( data.point_list()[i].x,
                                      data.point_list()[i].y,
                                      data.point_list()[i].z ) );
@@ -582,7 +587,8 @@ ErrorCode ReadCGM::create_curve_facets( Interface* moab,
         return MB_FAILURE;
       continue;
     }
-    
+    // check to see if the first and last interior vertices are considered to be 
+    // coincident by CUBIT
     const bool closed = (points.front() - points.back()).length() < GEOMETRY_RESABS;
     if (closed != (start_vtx == end_vtx)) {
       std::cerr << "Warning: topology and geometry inconsistant for possibly closed curve "
@@ -608,6 +614,7 @@ ErrorCode ReadCGM::create_curve_facets( Interface* moab,
     for (size_t i = 1; i < points.size() - 1; ++i) {
       double coords[] = { points[i].x(), points[i].y(), points[i].z() };
       EntityHandle h;
+      //create vertex entity
       rval = moab->create_vertex( coords, h );
       if (MB_SUCCESS != rval)
         return MB_FAILURE;
@@ -627,7 +634,7 @@ ErrorCode ReadCGM::create_curve_facets( Interface* moab,
       // if closed, remove duplicate
     if (verts.front() == verts.back())
       verts.pop_back();
-    
+    //Add entities to the curve meshset from entitymap
     rval = moab->add_entities( ci->second, &verts[0], verts.size() );
     if (MB_SUCCESS != rval)
       return MB_FAILURE;
@@ -744,7 +751,6 @@ ErrorCode ReadCGM::load_file(const char *cgm_file_name,
   // create facets for all curves
   rval = create_curve_facets( mdbImpl, entmap, norm_tol, faceting_tol, verbose_warnings );
   if(rval!=MB_SUCCESS) return rval;
-
   
   GMem data;
     // create geometry for all surfaces


https://bitbucket.org/fathomteam/moab/commits/f64435ea8c6c/
Changeset:   f64435ea8c6c
Branch:      None
User:        pshriwise
Date:        2014-06-27 23:30:34
Summary:     Added comments to ReadCGM. Moved a variable initialization closer to its use point.

Affected #:  1 file

diff --git a/src/io/ReadCGM.cpp b/src/io/ReadCGM.cpp
index 34c74bb..26d4eb2 100644
--- a/src/io/ReadCGM.cpp
+++ b/src/io/ReadCGM.cpp
@@ -653,8 +653,6 @@ ErrorCode ReadCGM::create_curve_facets( Interface* moab,
 }
 
 
-
-
 // copy geometry into mesh database
 ErrorCode ReadCGM::load_file(const char *cgm_file_name,
                       const EntityHandle* file_set,
@@ -693,7 +691,7 @@ ErrorCode ReadCGM::load_file(const char *cgm_file_name,
   //const char geom_categories[][CATEGORY_TAG_SIZE] =
       //{"Vertex\0", "Curve\0", "Surface\0", "Volume\0", "Group\0"};
  
-  DLIList<ModelEntity*> me_list;
+
 
   // Initialize CGM
   InitCGMA::initialize_cgma();
@@ -752,6 +750,7 @@ ErrorCode ReadCGM::load_file(const char *cgm_file_name,
   rval = create_curve_facets( mdbImpl, entmap, norm_tol, faceting_tol, verbose_warnings );
   if(rval!=MB_SUCCESS) return rval;
   
+  DLIList<ModelEntity*> me_list;
   GMem data;
     // create geometry for all surfaces
   for (ci = entmap[2].begin(); ci != entmap[2].end(); ++ci) {
@@ -766,22 +765,28 @@ ErrorCode ReadCGM::load_file(const char *cgm_file_name,
       // declare array of all vertex handles
     std::vector<EntityHandle> verts( data.pointListCount, 0 );
     
-      // get list of vertices in surface
+      // get list of geometric vertices in surface
     me_list.clean_out();
     ModelQueryEngine::instance()->query_model( *face, DagType::ref_vertex_type(), me_list );
 
-      // for each vertex, find coincident point in facets
+      // for each geometric vertex, find a single coincident point in facets
+      // otherwise, print a warning
     for (int i = me_list.size(); i--; ) {
+      //assign geometric vertex
       RefVertex* vtx = dynamic_cast<RefVertex*>(me_list.get_and_step());
       CubitVector pos = vtx->coordinates();
 
       for (int j = 0; j < data.pointListCount; ++j) {
+        //assign facet vertex
         CubitVector vpos( data.point_list()[j].x,
                           data.point_list()[j].y,
                           data.point_list()[j].z );
+        //check to see if they are considered coincident
         if ((pos - vpos).length_squared() < GEOMETRY_RESABS*GEOMETRY_RESABS ) {
+          // if this facet vertex has already been found coincident, print warning
           if (verts[j])
             std::cerr << "Warning: Coincident vertices in surface " << face->id() << std::endl;
+          //if a coincidence is found, keep track of it in the verts vector
           verts[j] = entmap[0][vtx];
           break;
         }
@@ -795,6 +800,8 @@ ErrorCode ReadCGM::load_file(const char *cgm_file_name,
       double coords[] = { data.point_list()[i].x,
                           data.point_list()[i].y,
                           data.point_list()[i].z };
+      // return vertex handle to verts to fill in all remaining facet
+      // vertices
       rval = mdbImpl->create_vertex( coords, verts[i] );
       if (MB_SUCCESS != rval)
         return rval;
@@ -804,6 +811,7 @@ ErrorCode ReadCGM::load_file(const char *cgm_file_name,
     Range facets;
     std::vector<EntityHandle> corners;
     for (int i = 0; i < data.fListCount; i += data.facet_list()[i]+1) {
+      // get number of facet verts
       int* facet = data.facet_list() + i;
       corners.resize( *facet );
       for (int j = 1; j <= *facet; ++j) {


https://bitbucket.org/fathomteam/moab/commits/170a7387f5d8/
Changeset:   170a7387f5d8
Branch:      None
User:        pshriwise
Date:        2014-06-27 23:30:34
Summary:     Added a new function for creating surface facets in ReadCGM.

Affected #:  2 files

diff --git a/src/io/ReadCGM.cpp b/src/io/ReadCGM.cpp
index 26d4eb2..571a00d 100644
--- a/src/io/ReadCGM.cpp
+++ b/src/io/ReadCGM.cpp
@@ -652,6 +652,122 @@ ErrorCode ReadCGM::create_curve_facets( Interface* moab,
   return MB_SUCCESS;
 }
 
+ErrorCode ReadCGM::create_surface_facets( Interface* moab, 
+                                          std::map<RefEntity*,EntityHandle> entitymap[5],
+                                          int norm_tol, 
+                                          double facet_tol, 
+                                          double length_tol )
+{
+
+  ErrorCode rval;
+  std::map<RefEntity*,EntityHandle>::iterator ci;
+  CubitStatus s;
+  DLIList<ModelEntity*> me_list;
+  GMem data;
+    // create geometry for all surfaces
+  for (ci = entitymap[2].begin(); ci != entitymap[2].end(); ++ci) {
+    RefFace* face = dynamic_cast<RefFace*>(ci->first);
+
+    data.clean_out();
+    s = face->get_graphics( data, norm_tol, facet_tol, length_tol );
+
+    if (CUBIT_SUCCESS != s)
+      return MB_FAILURE;
+
+      // declare array of all vertex handles
+    std::vector<EntityHandle> verts( data.pointListCount, 0 );
+    
+      // get list of geometric vertices in surface
+    me_list.clean_out();
+    ModelQueryEngine::instance()->query_model( *face, DagType::ref_vertex_type(), me_list );
+
+      // for each geometric vertex, find a single coincident point in facets
+      // otherwise, print a warning
+    for (int i = me_list.size(); i--; ) {
+      //assign geometric vertex
+      RefVertex* vtx = dynamic_cast<RefVertex*>(me_list.get_and_step());
+      CubitVector pos = vtx->coordinates();
+
+      for (int j = 0; j < data.pointListCount; ++j) {
+        //assign facet vertex
+        CubitVector vpos( data.point_list()[j].x,
+                          data.point_list()[j].y,
+                          data.point_list()[j].z );
+        //check to see if they are considered coincident
+        if ((pos - vpos).length_squared() < GEOMETRY_RESABS*GEOMETRY_RESABS ) {
+          // if this facet vertex has already been found coincident, print warning
+          if (verts[j])
+            std::cerr << "Warning: Coincident vertices in surface " << face->id() << std::endl;
+          //if a coincidence is found, keep track of it in the verts vector
+          verts[j] = entitymap[0][vtx];
+          break;
+        }
+      }
+    }
+    
+      // now create vertices for the remaining points in the facetting
+    for (int i = 0; i < data.pointListCount; ++i) {
+      if (verts[i]) // if a geometric vertex
+        continue;
+      double coords[] = { data.point_list()[i].x,
+                          data.point_list()[i].y,
+                          data.point_list()[i].z };
+      // return vertex handle to verts to fill in all remaining facet
+      // vertices
+      rval = mdbImpl->create_vertex( coords, verts[i] );
+      if (MB_SUCCESS != rval)
+        return rval;
+    }
+    
+      // now create facets
+    Range facets;
+    std::vector<EntityHandle> corners;
+    for (int i = 0; i < data.fListCount; i += data.facet_list()[i]+1) {
+      // get number of facet verts
+      int* facet = data.facet_list() + i;
+      corners.resize( *facet );
+      for (int j = 1; j <= *facet; ++j) {
+        if (facet[j] >= (int)verts.size()) {
+          std::cerr << "ERROR: Invalid facet data for surface " << face->id() << std::endl;
+          return MB_FAILURE;
+        }
+        corners[j-1] = verts[facet[j]];
+      }
+      EntityType type;
+      if (*facet == 3)
+        type = MBTRI;
+      else {
+        std::cerr << "Warning: non-triangle facet in surface " << face->id() << std::endl;
+	std::cerr << "  entity has " << *facet << " edges" << std::endl;
+        if (*facet == 4)
+          type = MBQUAD;
+        else
+          type = MBPOLYGON;
+      }
+      
+      // if (surf->bridge_sense() == CUBIT_REVERSED)
+      //   std::reverse( corners.begin(), corners.end() );
+      
+      EntityHandle h;
+      rval = mdbImpl->create_element( type, &corners[0], corners.size(), h );
+      if (MB_SUCCESS != rval)
+        return MB_FAILURE;
+        
+      facets.insert( h );
+    }
+    
+      // add vertices and facets to surface set
+    rval = mdbImpl->add_entities( ci->second, &verts[0], verts.size() );
+    if (MB_SUCCESS != rval)
+      return MB_FAILURE;
+    rval = mdbImpl->add_entities( ci->second, facets );
+    if (MB_SUCCESS != rval)
+      return MB_FAILURE;
+  }
+
+  return MB_SUCCESS;
+}
+
 
 // copy geometry into mesh database
 ErrorCode ReadCGM::load_file(const char *cgm_file_name,
@@ -750,6 +866,7 @@ ErrorCode ReadCGM::load_file(const char *cgm_file_name,
   rval = create_curve_facets( mdbImpl, entmap, norm_tol, faceting_tol, verbose_warnings );
   if(rval!=MB_SUCCESS) return rval;
   
+
   DLIList<ModelEntity*> me_list;
   GMem data;
     // create geometry for all surfaces

diff --git a/src/io/ReadCGM.hpp b/src/io/ReadCGM.hpp
index 8304e0c..395614a 100644
--- a/src/io/ReadCGM.hpp
+++ b/src/io/ReadCGM.hpp
@@ -106,6 +106,12 @@ public:
                                  double faceting_tol,
                                  bool verbose_warn = false );
 
+  ErrorCode create_surface_facets( Interface* moab, 
+                                   std::map<RefEntity*,EntityHandle> entitymap[5],
+                                   int norm_tol, 
+                                   double facet_tol, 
+                                   double length_tol );
+
    //! Constructor
    ReadCGM(Interface* impl = NULL);
 


https://bitbucket.org/fathomteam/moab/commits/2de7ccb920a1/
Changeset:   2de7ccb920a1
Branch:      None
User:        pshriwise
Date:        2014-06-27 23:30:34
Summary:     Implemented the function create_surface_facets in ReadCGM.

Affected #:  1 file

diff --git a/src/io/ReadCGM.cpp b/src/io/ReadCGM.cpp
index 571a00d..ea27ff1 100644
--- a/src/io/ReadCGM.cpp
+++ b/src/io/ReadCGM.cpp
@@ -855,120 +855,18 @@ ErrorCode ReadCGM::load_file(const char *cgm_file_name,
   // done with volumes and groups
   entmap[3].clear();
   entmap[4].clear();
-  
 
   // create geometry for all vertices and replace 
-  // vertex set handles with vertex handles in map
   rval = add_vertices( mdbImpl, entmap );
   if(rval!=MB_SUCCESS) return rval; 
 
   // create facets for all curves
   rval = create_curve_facets( mdbImpl, entmap, norm_tol, faceting_tol, verbose_warnings );
   if(rval!=MB_SUCCESS) return rval;
-  
-
-  DLIList<ModelEntity*> me_list;
-  GMem data;
-    // create geometry for all surfaces
-  for (ci = entmap[2].begin(); ci != entmap[2].end(); ++ci) {
-    RefFace* face = dynamic_cast<RefFace*>(ci->first);
-
-    data.clean_out();
-    s = face->get_graphics( data, norm_tol, faceting_tol, len_tol );
-
-    if (CUBIT_SUCCESS != s)
-      return MB_FAILURE;
-
-      // declare array of all vertex handles
-    std::vector<EntityHandle> verts( data.pointListCount, 0 );
-    
-      // get list of geometric vertices in surface
-    me_list.clean_out();
-    ModelQueryEngine::instance()->query_model( *face, DagType::ref_vertex_type(), me_list );
-
-      // for each geometric vertex, find a single coincident point in facets
-      // otherwise, print a warning
-    for (int i = me_list.size(); i--; ) {
-      //assign geometric vertex
-      RefVertex* vtx = dynamic_cast<RefVertex*>(me_list.get_and_step());
-      CubitVector pos = vtx->coordinates();
 
-      for (int j = 0; j < data.pointListCount; ++j) {
-        //assign facet vertex
-        CubitVector vpos( data.point_list()[j].x,
-                          data.point_list()[j].y,
-                          data.point_list()[j].z );
-        //check to see if they are considered coincident
-        if ((pos - vpos).length_squared() < GEOMETRY_RESABS*GEOMETRY_RESABS ) {
-          // if this facet vertex has already been found coincident, print warning
-          if (verts[j])
-            std::cerr << "Warning: Coincident vertices in surface " << face->id() << std::endl;
-          //if a coincidence is found, keep track of it in the verts vector
-          verts[j] = entmap[0][vtx];
-          break;
-        }
-      }
-    }
-    
-      // now create vertices for the remaining points in the facetting
-    for (int i = 0; i < data.pointListCount; ++i) {
-      if (verts[i]) // if a geometric vertex
-        continue;
-      double coords[] = { data.point_list()[i].x,
-                          data.point_list()[i].y,
-                          data.point_list()[i].z };
-      // return vertex handle to verts to fill in all remaining facet
-      // vertices
-      rval = mdbImpl->create_vertex( coords, verts[i] );
-      if (MB_SUCCESS != rval)
-        return rval;
-    }
-    
-      // now create facets
-    Range facets;
-    std::vector<EntityHandle> corners;
-    for (int i = 0; i < data.fListCount; i += data.facet_list()[i]+1) {
-      // get number of facet verts
-      int* facet = data.facet_list() + i;
-      corners.resize( *facet );
-      for (int j = 1; j <= *facet; ++j) {
-        if (facet[j] >= (int)verts.size()) {
-          std::cerr << "ERROR: Invalid facet data for surface " << face->id() << std::endl;
-          return MB_FAILURE;
-        }
-        corners[j-1] = verts[facet[j]];
-      }
-      EntityType type;
-      if (*facet == 3)
-        type = MBTRI;
-      else {
-        std::cerr << "Warning: non-triangle facet in surface " << face->id() << std::endl;
-	std::cerr << "  entity has " << *facet << " edges" << std::endl;
-        if (*facet == 4)
-          type = MBQUAD;
-        else
-          type = MBPOLYGON;
-      }
-      
-      // if (surf->bridge_sense() == CUBIT_REVERSED)
-      //   std::reverse( corners.begin(), corners.end() );
-      
-      EntityHandle h;
-      rval = mdbImpl->create_element( type, &corners[0], corners.size(), h );
-      if (MB_SUCCESS != rval)
-        return MB_FAILURE;
-        
-      facets.insert( h );
-    }
-    
-      // add vertices and facets to surface set
-    rval = mdbImpl->add_entities( ci->second, &verts[0], verts.size() );
-    if (MB_SUCCESS != rval)
-      return MB_FAILURE;
-    rval = mdbImpl->add_entities( ci->second, facets );
-    if (MB_SUCCESS != rval)
-      return MB_FAILURE;
-  }
+  // create facets for surfaces
+  rval = create_surface_facets( mdbImpl, entmap, norm_tol, faceting_tol, len_tol);
+  if(rval!=MB_SUCCESS) return rval;
 
   return MB_SUCCESS;
 }


https://bitbucket.org/fathomteam/moab/commits/331a8569fd53/
Changeset:   331a8569fd53
Branch:      None
User:        pshriwise
Date:        2014-06-27 23:30:34
Summary:     Renamed add_vertices in ReadCGM to create_vertices.

Affected #:  2 files

diff --git a/src/io/ReadCGM.cpp b/src/io/ReadCGM.cpp
index ea27ff1..310eec4 100644
--- a/src/io/ReadCGM.cpp
+++ b/src/io/ReadCGM.cpp
@@ -502,7 +502,7 @@ void ReadCGM::set_cgm_attributes(bool const act_attributes, bool const verbose)
 }
 
 
-  ErrorCode ReadCGM::add_vertices( Interface* moab, std::map<RefEntity*,EntityHandle> entitymap[5] )
+  ErrorCode ReadCGM::create_vertices( Interface* moab, std::map<RefEntity*,EntityHandle> entitymap[5] )
 {
 
  ErrorCode rval;
@@ -857,7 +857,7 @@ ErrorCode ReadCGM::load_file(const char *cgm_file_name,
   entmap[4].clear();
 
   // create geometry for all vertices and replace 
-  rval = add_vertices( mdbImpl, entmap );
+  rval = create_vertices( mdbImpl, entmap );
   if(rval!=MB_SUCCESS) return rval; 
 
   // create facets for all curves

diff --git a/src/io/ReadCGM.hpp b/src/io/ReadCGM.hpp
index 395614a..9eeadf6 100644
--- a/src/io/ReadCGM.hpp
+++ b/src/io/ReadCGM.hpp
@@ -98,7 +98,9 @@ public:
 
   void set_cgm_attributes(bool const act_attributes, bool const verbost);
 
-  ErrorCode add_vertices( Interface* moab, std::map<RefEntity*,EntityHandle> entmap[5] );
+
+  ErrorCode create_vertices( Interface* moab, std::map<RefEntity*,EntityHandle> entmap[5] );
+
 
   ErrorCode create_curve_facets( Interface* moab, 
                                  std::map<RefEntity*,EntityHandle> entitymap[5],


https://bitbucket.org/fathomteam/moab/commits/ef4e355aea3f/
Changeset:   ef4e355aea3f
Branch:      None
User:        pshriwise
Date:        2014-06-27 23:30:34
Summary:     Removed the moab interface parameter from the store_group_content function in ReadCGM.

Affected #:  2 files

diff --git a/src/io/ReadCGM.cpp b/src/io/ReadCGM.cpp
index 310eec4..66ddb10 100644
--- a/src/io/ReadCGM.cpp
+++ b/src/io/ReadCGM.cpp
@@ -321,7 +321,7 @@ ErrorCode ReadCGM::store_curve_senses( std::map<RefEntity*,EntityHandle> entitym
   if(rval!=MB_SUCCESS) return rval;
   
   // store group names and entities in the mesh
-  rval = store_group_content( moab, entitymap );
+  rval = store_group_content(entitymap );
   if(rval!=MB_SUCCESS) return rval;
  
 
@@ -424,7 +424,7 @@ ErrorCode ReadCGM::create_group_entsets( Interface* moab, std::map<RefEntity*,En
   return MB_SUCCESS;
 }
 
-ErrorCode ReadCGM::store_group_content( Interface* /* moab */, std::map<RefEntity*,EntityHandle>* entitymap )
+ErrorCode ReadCGM::store_group_content(std::map<RefEntity*,EntityHandle>* entitymap )
 {
 
   ErrorCode rval;
@@ -476,7 +476,7 @@ ErrorCode ReadCGM::store_group_content( Interface* /* moab */, std::map<RefEntit
     }
     
     if (!entities.empty()) {
-      rval = moab->add_entities( ci->second, entities );
+      rval = mdbImpl->add_entities( ci->second, entities );
       if (MB_SUCCESS != rval)
         return MB_FAILURE;
     }

diff --git a/src/io/ReadCGM.hpp b/src/io/ReadCGM.hpp
index 9eeadf6..4a5a0b6 100644
--- a/src/io/ReadCGM.hpp
+++ b/src/io/ReadCGM.hpp
@@ -93,7 +93,7 @@ public:
   ErrorCode create_group_entsets( Interface* moab, 
                                    std::map<RefEntity*,EntityHandle>& entitymap );
 
-  ErrorCode store_group_content( Interface* moab, std::map<RefEntity*,EntityHandle>* entitymap );
+  ErrorCode store_group_content( std::map<RefEntity*,EntityHandle>* entitymap );
 
 
   void set_cgm_attributes(bool const act_attributes, bool const verbost);


https://bitbucket.org/fathomteam/moab/commits/2bdc9bd83dc8/
Changeset:   2bdc9bd83dc8
Branch:      None
User:        pshriwise
Date:        2014-06-27 23:30:34
Summary:     Removed un-needed moab interface passes to multiple functions.

Affected #:  2 files

diff --git a/src/io/ReadCGM.cpp b/src/io/ReadCGM.cpp
index 66ddb10..87ce275 100644
--- a/src/io/ReadCGM.cpp
+++ b/src/io/ReadCGM.cpp
@@ -159,7 +159,7 @@ ErrorCode ReadCGM::set_options( const FileOptions& opts,
   return MB_SUCCESS;
 }
 
-  ErrorCode ReadCGM::create_entity_sets( Interface* moab, std::map<RefEntity*, EntityHandle> (&entmap)[5] )
+  ErrorCode ReadCGM::create_entity_sets( std::map<RefEntity*, EntityHandle> (&entmap)[5] )
 {
   ErrorCode rval; 
   const char geom_categories[][CATEGORY_TAG_SIZE] = 
@@ -178,21 +178,21 @@ ErrorCode ReadCGM::set_options( const FileOptions& opts,
          RefEntity* ent = entlist.get_and_step(); 
          EntityHandle handle;  
          // create the new meshset
-         rval = moab->create_meshset( dim == 1 ? MESHSET_ORDERED : MESHSET_SET, handle);
+         rval = mdbImpl->create_meshset( dim == 1 ? MESHSET_ORDERED : MESHSET_SET, handle);
          if (MB_SUCCESS != rval) return rval; 
 
          // map the geom reference entity to the corresponding moab meshset
          entmap[dim][ent] = handle; 
 
          // create tags for the new meshset
-         rval = moab->tag_set_data( geom_tag, &handle, 1, &dim ); 
+         rval = mdbImpl->tag_set_data( geom_tag, &handle, 1, &dim ); 
          if (MB_SUCCESS != rval) return rval; 
 
          int id = ent->id();
-         rval = moab->tag_set_data( id_tag, &handle, 1, &id );
+         rval = mdbImpl->tag_set_data( id_tag, &handle, 1, &id );
          if (MB_SUCCESS != rval) return rval;
 
-         rval = moab->tag_set_data( category_tag, &handle, 1, &geom_categories[dim] );
+         rval = mdbImpl->tag_set_data( category_tag, &handle, 1, &geom_categories[dim] );
          if (MB_SUCCESS != rval) return rval;
  
        }
@@ -203,7 +203,7 @@ ErrorCode ReadCGM::set_options( const FileOptions& opts,
 
 
 
-ErrorCode ReadCGM::create_topology( Interface* moab, std::map<RefEntity*,EntityHandle> entitymap[5] )
+ErrorCode ReadCGM::create_topology( std::map<RefEntity*,EntityHandle> entitymap[5] )
 {
   ErrorCode rval;
   DLIList<RefEntity*> entitylist;
@@ -218,7 +218,7 @@ ErrorCode ReadCGM::create_topology( Interface* moab, std::map<RefEntity*,EntityH
       for (int i = entitylist.size(); i--; ) {
         RefEntity* ent = entitylist.get_and_step();
         EntityHandle h = entitymap[dim-1][ent];
-        rval = moab->add_parent_child( ci->second, h );
+        rval = mdbImpl->add_parent_child( ci->second, h );
         if (MB_SUCCESS != rval)
           return rval;
       }
@@ -312,12 +312,12 @@ ErrorCode ReadCGM::store_curve_senses( std::map<RefEntity*,EntityHandle> entitym
   return MB_SUCCESS;
 }
 
-  ErrorCode ReadCGM::store_groups( Interface* moab, std::map<RefEntity*,EntityHandle>* entitymap )
+  ErrorCode ReadCGM::store_groups( std::map<RefEntity*,EntityHandle>* entitymap )
 {
   ErrorCode rval;
 
   // create eneity sets for all ref groups
-  rval = create_group_entsets( moab, entitymap[4] );
+  rval = create_group_entsets( entitymap[4] );
   if(rval!=MB_SUCCESS) return rval;
   
   // store group names and entities in the mesh
@@ -328,7 +328,7 @@ ErrorCode ReadCGM::store_curve_senses( std::map<RefEntity*,EntityHandle> entitym
   return MB_SUCCESS;
 }
 
-ErrorCode ReadCGM::create_group_entsets( Interface* moab, std::map<RefEntity*,EntityHandle>& entitymap )
+ErrorCode ReadCGM::create_group_entsets( std::map<RefEntity*,EntityHandle>& entitymap )
 {
 
   ErrorCode rval;
@@ -370,7 +370,7 @@ ErrorCode ReadCGM::create_group_entsets( Interface* moab, std::map<RefEntity*,En
 #endif
     // create entity handle for the group
     EntityHandle h;
-    rval = moab->create_meshset( MESHSET_SET, h );
+    rval = mdbImpl->create_meshset( MESHSET_SET, h );
     if (MB_SUCCESS != rval)
       return rval;
     //set tag data for the group
@@ -380,16 +380,16 @@ ErrorCode ReadCGM::create_group_entsets( Interface* moab, std::map<RefEntity*,En
     if (name1.length() >= (unsigned)NAME_TAG_SIZE)
       std::cout << "WARNING: group name '" << name1.c_str()
                 << "' truncated to '" << namebuf << "'" << std::endl;
-    rval = moab->tag_set_data( name_tag, &h, 1, namebuf );
+    rval = mdbImpl->tag_set_data( name_tag, &h, 1, namebuf );
     if (MB_SUCCESS != rval)
       return MB_FAILURE;
       
     int id = grp->id();
-    rval = moab->tag_set_data( id_tag, &h, 1, &id );
+    rval = mdbImpl->tag_set_data( id_tag, &h, 1, &id );
     if (MB_SUCCESS != rval)
       return MB_FAILURE;
       
-    rval = moab->tag_set_data( category_tag, &h, 1, &geom_categories[4] );
+    rval = mdbImpl->tag_set_data( category_tag, &h, 1, &geom_categories[4] );
     if (MB_SUCCESS != rval)
       return MB_FAILURE;
     //check for extra group names  
@@ -397,7 +397,7 @@ ErrorCode ReadCGM::create_group_entsets( Interface* moab, std::map<RefEntity*,En
       for (int j = extra_name_tags.size(); j < name_list.size(); ++j) {
         sprintf( namebuf, "EXTRA_%s%d", NAME_TAG_NAME, j );
         Tag t;
-        rval = moab->tag_get_handle( namebuf, NAME_TAG_SIZE, MB_TYPE_OPAQUE, t, MB_TAG_SPARSE|MB_TAG_CREAT );
+        rval = mdbImpl->tag_get_handle( namebuf, NAME_TAG_SIZE, MB_TYPE_OPAQUE, t, MB_TAG_SPARSE|MB_TAG_CREAT );
         assert(!rval);
         extra_name_tags.push_back(t);
       }
@@ -413,7 +413,7 @@ ErrorCode ReadCGM::create_group_entsets( Interface* moab, std::map<RefEntity*,En
         if (name1.length() >= (unsigned)NAME_TAG_SIZE)
           std::cout << "WARNING: group name '" << name1.c_str()
                     << "' truncated to '" << namebuf << "'" << std::endl;
-        rval = moab->tag_set_data( extra_name_tags[j], &h, 1, namebuf );
+        rval = mdbImpl->tag_set_data( extra_name_tags[j], &h, 1, namebuf );
         if (MB_SUCCESS != rval)
           return MB_FAILURE;
       }
@@ -502,7 +502,7 @@ void ReadCGM::set_cgm_attributes(bool const act_attributes, bool const verbose)
 }
 
 
-  ErrorCode ReadCGM::create_vertices( Interface* moab, std::map<RefEntity*,EntityHandle> entitymap[5] )
+  ErrorCode ReadCGM::create_vertices( std::map<RefEntity*,EntityHandle> entitymap[5] )
 {
 
  ErrorCode rval;
@@ -511,11 +511,11 @@ void ReadCGM::set_cgm_attributes(bool const act_attributes, bool const verbose)
     CubitVector pos = dynamic_cast<RefVertex*>(ci->first)->coordinates();
     double coords[3] = {pos.x(), pos.y(), pos.z()};
     EntityHandle vh;
-    rval = moab->create_vertex( coords, vh );
+    rval = mdbImpl->create_vertex( coords, vh );
     if (MB_SUCCESS != rval)
       return MB_FAILURE;
     
-    rval = moab->add_entities( ci->second, &vh, 1 );
+    rval = mdbImpl->add_entities( ci->second, &vh, 1 );
     if (MB_SUCCESS != rval)
       return MB_FAILURE;
     
@@ -524,8 +524,7 @@ void ReadCGM::set_cgm_attributes(bool const act_attributes, bool const verbose)
   return MB_SUCCESS;
 }
 
-ErrorCode ReadCGM::create_curve_facets( Interface* moab, 
-                                        std::map<RefEntity*,EntityHandle> entitymap[5], 
+ErrorCode ReadCGM::create_curve_facets( std::map<RefEntity*,EntityHandle> entitymap[5], 
                                         int norm_tol, 
                                         double faceting_tol, 
                                         bool verbose_warn )
@@ -582,7 +581,7 @@ ErrorCode ReadCGM::create_curve_facets( Interface* moab,
         continue;
       }
       EntityHandle h = entitymap[0][start_vtx];
-      rval = moab->add_entities( ci->second, &h, 1 );
+      rval = mdbImpl->add_entities( ci->second, &h, 1 );
       if (MB_SUCCESS != rval)
         return MB_FAILURE;
       continue;
@@ -615,7 +614,7 @@ ErrorCode ReadCGM::create_curve_facets( Interface* moab,
       double coords[] = { points[i].x(), points[i].y(), points[i].z() };
       EntityHandle h;
       //create vertex entity
-      rval = moab->create_vertex( coords, h );
+      rval = mdbImpl->create_vertex( coords, h );
       if (MB_SUCCESS != rval)
         return MB_FAILURE;
       verts.push_back( h );
@@ -625,7 +624,7 @@ ErrorCode ReadCGM::create_curve_facets( Interface* moab,
       // create edges
     for (size_t i = 0; i < verts.size()-1; ++i) {
       EntityHandle h;
-      rval = moab->create_element( MBEDGE, &verts[i], 2, h );
+      rval = mdbImpl->create_element( MBEDGE, &verts[i], 2, h );
       if (MB_SUCCESS != rval)
         return MB_FAILURE;
       edges.push_back( h );
@@ -635,10 +634,10 @@ ErrorCode ReadCGM::create_curve_facets( Interface* moab,
     if (verts.front() == verts.back())
       verts.pop_back();
     //Add entities to the curve meshset from entitymap
-    rval = moab->add_entities( ci->second, &verts[0], verts.size() );
+    rval = mdbImpl->add_entities( ci->second, &verts[0], verts.size() );
     if (MB_SUCCESS != rval)
       return MB_FAILURE;
-    rval = moab->add_entities( ci->second, &edges[0], edges.size() );
+    rval = mdbImpl->add_entities( ci->second, &edges[0], edges.size() );
     if (MB_SUCCESS != rval)
       return MB_FAILURE;
   }
@@ -652,8 +651,7 @@ ErrorCode ReadCGM::create_curve_facets( Interface* moab,
   return MB_SUCCESS;
 }
 
-ErrorCode ReadCGM::create_surface_facets( Interface* moab, 
-                                          std::map<RefEntity*,EntityHandle> entitymap[5],
+ErrorCode ReadCGM::create_surface_facets( std::map<RefEntity*,EntityHandle> entitymap[5],
                                           int norm_tol, 
                                           double facet_tol, 
                                           double length_tol )
@@ -833,11 +831,11 @@ ErrorCode ReadCGM::load_file(const char *cgm_file_name,
   DLIList<RefEntity*> entlist;
   std::map<RefEntity*,EntityHandle> entmap[5]; // one for each dim, and one for groups
   //std::map<RefEntity*,EntityHandle>* entmap_ptr = entmap;
-  rval = create_entity_sets( mdbImpl, entmap );
+  rval = create_entity_sets( entmap );
   if (rval!=MB_SUCCESS) return rval;
 
   // create topology for all geometric entities
-  rval = create_topology( mdbImpl, entmap );
+  rval = create_topology( entmap );
   if(rval!=MB_SUCCESS) return rval;
 
   // store CoFace senses
@@ -849,7 +847,7 @@ ErrorCode ReadCGM::load_file(const char *cgm_file_name,
   if (rval!=MB_SUCCESS) return rval;
 
   // get group information and store it in the mesh 
-  rval = store_groups( mdbImpl, entmap );
+  rval = store_groups( entmap );
   if(rval!=MB_SUCCESS) return rval;
  
   // done with volumes and groups
@@ -857,15 +855,15 @@ ErrorCode ReadCGM::load_file(const char *cgm_file_name,
   entmap[4].clear();
 
   // create geometry for all vertices and replace 
-  rval = create_vertices( mdbImpl, entmap );
+  rval = create_vertices( entmap );
   if(rval!=MB_SUCCESS) return rval; 
 
   // create facets for all curves
-  rval = create_curve_facets( mdbImpl, entmap, norm_tol, faceting_tol, verbose_warnings );
+  rval = create_curve_facets( entmap, norm_tol, faceting_tol, verbose_warnings );
   if(rval!=MB_SUCCESS) return rval;
 
   // create facets for surfaces
-  rval = create_surface_facets( mdbImpl, entmap, norm_tol, faceting_tol, len_tol);
+  rval = create_surface_facets( entmap, norm_tol, faceting_tol, len_tol);
   if(rval!=MB_SUCCESS) return rval;
 
   return MB_SUCCESS;

diff --git a/src/io/ReadCGM.hpp b/src/io/ReadCGM.hpp
index 4a5a0b6..35e8dc0 100644
--- a/src/io/ReadCGM.hpp
+++ b/src/io/ReadCGM.hpp
@@ -78,20 +78,17 @@ public:
 			        bool& act_att,
                                 bool& verbose_warnings);
 
-  ErrorCode create_entity_sets( Interface* moab,
-                                std::map<RefEntity*,EntityHandle> (&entmap)[5] );
+  ErrorCode create_entity_sets( std::map<RefEntity*,EntityHandle> (&entmap)[5] );
 
-  ErrorCode create_topology( Interface* moab, 
-                             std::map<RefEntity*,EntityHandle> entitymap[5] );
+  ErrorCode create_topology( std::map<RefEntity*,EntityHandle> entitymap[5] );
 
   ErrorCode store_surface_senses( std::map<RefEntity*,EntityHandle> entitymap[5] );
 
   ErrorCode store_curve_senses( std::map<RefEntity*,EntityHandle> entitymap[5] );
 
-  ErrorCode store_groups( Interface* moab, std::map<RefEntity*,EntityHandle>* entitymap );
+  ErrorCode store_groups( std::map<RefEntity*,EntityHandle>* entitymap );
 
-  ErrorCode create_group_entsets( Interface* moab, 
-                                   std::map<RefEntity*,EntityHandle>& entitymap );
+  ErrorCode create_group_entsets( std::map<RefEntity*,EntityHandle>& entitymap );
 
   ErrorCode store_group_content( std::map<RefEntity*,EntityHandle>* entitymap );
 
@@ -99,17 +96,15 @@ public:
   void set_cgm_attributes(bool const act_attributes, bool const verbost);
 
 
-  ErrorCode create_vertices( Interface* moab, std::map<RefEntity*,EntityHandle> entmap[5] );
+  ErrorCode create_vertices( std::map<RefEntity*,EntityHandle> entmap[5] );
 
 
-  ErrorCode create_curve_facets( Interface* moab, 
-                                 std::map<RefEntity*,EntityHandle> entitymap[5],
+  ErrorCode create_curve_facets( std::map<RefEntity*,EntityHandle> entitymap[5],
                                  int norm_tol,
                                  double faceting_tol,
                                  bool verbose_warn = false );
 
-  ErrorCode create_surface_facets( Interface* moab, 
-                                   std::map<RefEntity*,EntityHandle> entitymap[5],
+  ErrorCode create_surface_facets( std::map<RefEntity*,EntityHandle> entitymap[5],
                                    int norm_tol, 
                                    double facet_tol, 
                                    double length_tol );


https://bitbucket.org/fathomteam/moab/commits/27cc103347d8/
Changeset:   27cc103347d8
Branch:      None
User:        pshriwise
Date:        2014-06-27 23:30:34
Summary:     Removed unused variables/structures in ReadCGM.

Affected #:  1 file

diff --git a/src/io/ReadCGM.cpp b/src/io/ReadCGM.cpp
index 87ce275..6b4d9b5 100644
--- a/src/io/ReadCGM.cpp
+++ b/src/io/ReadCGM.cpp
@@ -515,10 +515,7 @@ void ReadCGM::set_cgm_attributes(bool const act_attributes, bool const verbose)
     if (MB_SUCCESS != rval)
       return MB_FAILURE;
     
-    rval = mdbImpl->add_entities( ci->second, &vh, 1 );
-    if (MB_SUCCESS != rval)
-      return MB_FAILURE;
-    
+    //replace meshset with the vertex handle
     ci->second = vh;
   }
   return MB_SUCCESS;
@@ -800,13 +797,6 @@ ErrorCode ReadCGM::load_file(const char *cgm_file_name,
   rval = mdbImpl->tag_set_data( geometry_resabs_tag, &set, 1, &GEOMETRY_RESABS );
   if(MB_SUCCESS != rval) return rval;
 
-  // CGM data
-  std::map<RefEntity*,EntityHandle>::iterator ci;
-  //const char geom_categories[][CATEGORY_TAG_SIZE] =
-      //{"Vertex\0", "Curve\0", "Surface\0", "Volume\0", "Group\0"};
- 
-
-
   // Initialize CGM
   InitCGMA::initialize_cgma();
 
@@ -828,9 +818,8 @@ ErrorCode ReadCGM::load_file(const char *cgm_file_name,
   }
 
   // create entity sets for all geometric entities
-  DLIList<RefEntity*> entlist;
   std::map<RefEntity*,EntityHandle> entmap[5]; // one for each dim, and one for groups
-  //std::map<RefEntity*,EntityHandle>* entmap_ptr = entmap;
+
   rval = create_entity_sets( entmap );
   if (rval!=MB_SUCCESS) return rval;
 
@@ -854,7 +843,7 @@ ErrorCode ReadCGM::load_file(const char *cgm_file_name,
   entmap[3].clear();
   entmap[4].clear();
 
-  // create geometry for all vertices and replace 
+  // create geometry for all vertices
   rval = create_vertices( entmap );
   if(rval!=MB_SUCCESS) return rval; 
 


https://bitbucket.org/fathomteam/moab/commits/da20591ba6e4/
Changeset:   da20591ba6e4
Branch:      None
User:        pshriwise
Date:        2014-06-27 23:30:34
Summary:     Revert "Removed unused variables/structures in ReadCGM."

This reverts commit a5d3b32b123c88dd96286c01ae64d36c1f9773be.

Affected #:  1 file

diff --git a/src/io/ReadCGM.cpp b/src/io/ReadCGM.cpp
index 6b4d9b5..87ce275 100644
--- a/src/io/ReadCGM.cpp
+++ b/src/io/ReadCGM.cpp
@@ -515,7 +515,10 @@ void ReadCGM::set_cgm_attributes(bool const act_attributes, bool const verbose)
     if (MB_SUCCESS != rval)
       return MB_FAILURE;
     
-    //replace meshset with the vertex handle
+    rval = mdbImpl->add_entities( ci->second, &vh, 1 );
+    if (MB_SUCCESS != rval)
+      return MB_FAILURE;
+    
     ci->second = vh;
   }
   return MB_SUCCESS;
@@ -797,6 +800,13 @@ ErrorCode ReadCGM::load_file(const char *cgm_file_name,
   rval = mdbImpl->tag_set_data( geometry_resabs_tag, &set, 1, &GEOMETRY_RESABS );
   if(MB_SUCCESS != rval) return rval;
 
+  // CGM data
+  std::map<RefEntity*,EntityHandle>::iterator ci;
+  //const char geom_categories[][CATEGORY_TAG_SIZE] =
+      //{"Vertex\0", "Curve\0", "Surface\0", "Volume\0", "Group\0"};
+ 
+
+
   // Initialize CGM
   InitCGMA::initialize_cgma();
 
@@ -818,8 +828,9 @@ ErrorCode ReadCGM::load_file(const char *cgm_file_name,
   }
 
   // create entity sets for all geometric entities
+  DLIList<RefEntity*> entlist;
   std::map<RefEntity*,EntityHandle> entmap[5]; // one for each dim, and one for groups
-
+  //std::map<RefEntity*,EntityHandle>* entmap_ptr = entmap;
   rval = create_entity_sets( entmap );
   if (rval!=MB_SUCCESS) return rval;
 
@@ -843,7 +854,7 @@ ErrorCode ReadCGM::load_file(const char *cgm_file_name,
   entmap[3].clear();
   entmap[4].clear();
 
-  // create geometry for all vertices
+  // create geometry for all vertices and replace 
   rval = create_vertices( entmap );
   if(rval!=MB_SUCCESS) return rval; 
 


https://bitbucket.org/fathomteam/moab/commits/6609b229e651/
Changeset:   6609b229e651
Branch:      None
User:        pshriwise
Date:        2014-06-27 23:30:34
Summary:     Removed unused variables/structures. Added comments to create_vertices function.

Affected #:  1 file

diff --git a/src/io/ReadCGM.cpp b/src/io/ReadCGM.cpp
index 87ce275..52673a4 100644
--- a/src/io/ReadCGM.cpp
+++ b/src/io/ReadCGM.cpp
@@ -515,11 +515,15 @@ void ReadCGM::set_cgm_attributes(bool const act_attributes, bool const verbose)
     if (MB_SUCCESS != rval)
       return MB_FAILURE;
     
+    //add the vertex to its tagged meshset
     rval = mdbImpl->add_entities( ci->second, &vh, 1 );
     if (MB_SUCCESS != rval)
       return MB_FAILURE;
     
+    // replace the meshset handle with the vertex handle
+    // this makes adding the vertex to higher dim sets easier
     ci->second = vh;
+
   }
   return MB_SUCCESS;
 }
@@ -800,13 +804,6 @@ ErrorCode ReadCGM::load_file(const char *cgm_file_name,
   rval = mdbImpl->tag_set_data( geometry_resabs_tag, &set, 1, &GEOMETRY_RESABS );
   if(MB_SUCCESS != rval) return rval;
 
-  // CGM data
-  std::map<RefEntity*,EntityHandle>::iterator ci;
-  //const char geom_categories[][CATEGORY_TAG_SIZE] =
-      //{"Vertex\0", "Curve\0", "Surface\0", "Volume\0", "Group\0"};
- 
-
-
   // Initialize CGM
   InitCGMA::initialize_cgma();
 
@@ -828,9 +825,8 @@ ErrorCode ReadCGM::load_file(const char *cgm_file_name,
   }
 
   // create entity sets for all geometric entities
-  DLIList<RefEntity*> entlist;
   std::map<RefEntity*,EntityHandle> entmap[5]; // one for each dim, and one for groups
-  //std::map<RefEntity*,EntityHandle>* entmap_ptr = entmap;
+
   rval = create_entity_sets( entmap );
   if (rval!=MB_SUCCESS) return rval;
 


https://bitbucket.org/fathomteam/moab/commits/5464ead0e8d4/
Changeset:   5464ead0e8d4
Branch:      None
User:        pshriwise
Date:        2014-06-27 23:30:34
Summary:     Spelling correction to set_cgm_attributes variable

Affected #:  1 file

diff --git a/src/io/ReadCGM.hpp b/src/io/ReadCGM.hpp
index 35e8dc0..511e140 100644
--- a/src/io/ReadCGM.hpp
+++ b/src/io/ReadCGM.hpp
@@ -93,7 +93,7 @@ public:
   ErrorCode store_group_content( std::map<RefEntity*,EntityHandle>* entitymap );
 
 
-  void set_cgm_attributes(bool const act_attributes, bool const verbost);
+  void set_cgm_attributes(bool const act_attributes, bool const verbose);
 
 
   ErrorCode create_vertices( std::map<RefEntity*,EntityHandle> entmap[5] );


https://bitbucket.org/fathomteam/moab/commits/7ad94bbdd580/
Changeset:   7ad94bbdd580
Branch:      None
User:        pshriwise
Date:        2014-06-27 23:30:34
Summary:     Altered ReadCGM methods to pass maps by reference.

Affected #:  2 files

diff --git a/src/io/ReadCGM.cpp b/src/io/ReadCGM.cpp
index 52673a4..e7682af 100644
--- a/src/io/ReadCGM.cpp
+++ b/src/io/ReadCGM.cpp
@@ -203,7 +203,7 @@ ErrorCode ReadCGM::set_options( const FileOptions& opts,
 
 
 
-ErrorCode ReadCGM::create_topology( std::map<RefEntity*,EntityHandle> entitymap[5] )
+  ErrorCode ReadCGM::create_topology( std::map<RefEntity*,EntityHandle> (&entitymap)[5] )
 {
   ErrorCode rval;
   DLIList<RefEntity*> entitylist;
@@ -227,7 +227,7 @@ ErrorCode ReadCGM::create_topology( std::map<RefEntity*,EntityHandle> entitymap[
   return MB_SUCCESS;
 }
 
-ErrorCode ReadCGM::store_surface_senses( std::map<RefEntity*,EntityHandle> entitymap[5] )
+  ErrorCode ReadCGM::store_surface_senses( std::map<RefEntity*,EntityHandle> (&entitymap)[5] )
 {
   ErrorCode rval;
   std::map<RefEntity*,EntityHandle>::iterator ci;
@@ -278,7 +278,7 @@ ErrorCode ReadCGM::store_surface_senses( std::map<RefEntity*,EntityHandle> entit
   return MB_SUCCESS;
 }
 
-ErrorCode ReadCGM::store_curve_senses( std::map<RefEntity*,EntityHandle> entitymap[5] )
+  ErrorCode ReadCGM::store_curve_senses( std::map<RefEntity*,EntityHandle> (&entitymap)[5] )
 {
 
   ErrorCode rval;
@@ -312,7 +312,7 @@ ErrorCode ReadCGM::store_curve_senses( std::map<RefEntity*,EntityHandle> entitym
   return MB_SUCCESS;
 }
 
-  ErrorCode ReadCGM::store_groups( std::map<RefEntity*,EntityHandle>* entitymap )
+  ErrorCode ReadCGM::store_groups( std::map<RefEntity*,EntityHandle> (&entitymap)[5] )
 {
   ErrorCode rval;
 
@@ -424,7 +424,7 @@ ErrorCode ReadCGM::create_group_entsets( std::map<RefEntity*,EntityHandle>& enti
   return MB_SUCCESS;
 }
 
-ErrorCode ReadCGM::store_group_content(std::map<RefEntity*,EntityHandle>* entitymap )
+  ErrorCode ReadCGM::store_group_content(std::map<RefEntity*,EntityHandle> (&entitymap)[5] )
 {
 
   ErrorCode rval;
@@ -502,12 +502,12 @@ void ReadCGM::set_cgm_attributes(bool const act_attributes, bool const verbose)
 }
 
 
-  ErrorCode ReadCGM::create_vertices( std::map<RefEntity*,EntityHandle> entitymap[5] )
+  ErrorCode ReadCGM::create_vertices( std::map<RefEntity*,EntityHandle> &entitymap )
 {
 
  ErrorCode rval;
  std::map<RefEntity*,EntityHandle>::iterator ci;
- for (ci = entitymap[0].begin(); ci != entitymap[0].end(); ++ci) {
+ for (ci = entitymap.begin(); ci != entitymap.end(); ++ci) {
     CubitVector pos = dynamic_cast<RefVertex*>(ci->first)->coordinates();
     double coords[3] = {pos.x(), pos.y(), pos.z()};
     EntityHandle vh;
@@ -528,7 +528,7 @@ void ReadCGM::set_cgm_attributes(bool const act_attributes, bool const verbose)
   return MB_SUCCESS;
 }
 
-ErrorCode ReadCGM::create_curve_facets( std::map<RefEntity*,EntityHandle> entitymap[5], 
+  ErrorCode ReadCGM::create_curve_facets( std::map<RefEntity*,EntityHandle> (&entitymap)[5], 
                                         int norm_tol, 
                                         double faceting_tol, 
                                         bool verbose_warn )
@@ -655,7 +655,7 @@ ErrorCode ReadCGM::create_curve_facets( std::map<RefEntity*,EntityHandle> entity
   return MB_SUCCESS;
 }
 
-ErrorCode ReadCGM::create_surface_facets( std::map<RefEntity*,EntityHandle> entitymap[5],
+  ErrorCode ReadCGM::create_surface_facets( std::map<RefEntity*,EntityHandle> (&entitymap)[5],
                                           int norm_tol, 
                                           double facet_tol, 
                                           double length_tol )
@@ -851,7 +851,7 @@ ErrorCode ReadCGM::load_file(const char *cgm_file_name,
   entmap[4].clear();
 
   // create geometry for all vertices and replace 
-  rval = create_vertices( entmap );
+  rval = create_vertices( entmap[0] );
   if(rval!=MB_SUCCESS) return rval; 
 
   // create facets for all curves

diff --git a/src/io/ReadCGM.hpp b/src/io/ReadCGM.hpp
index 511e140..640ae4a 100644
--- a/src/io/ReadCGM.hpp
+++ b/src/io/ReadCGM.hpp
@@ -80,31 +80,31 @@ public:
 
   ErrorCode create_entity_sets( std::map<RefEntity*,EntityHandle> (&entmap)[5] );
 
-  ErrorCode create_topology( std::map<RefEntity*,EntityHandle> entitymap[5] );
+  ErrorCode create_topology( std::map<RefEntity*,EntityHandle> (&entitymap)[5] );
 
-  ErrorCode store_surface_senses( std::map<RefEntity*,EntityHandle> entitymap[5] );
+  ErrorCode store_surface_senses( std::map<RefEntity*,EntityHandle> (&entitymap)[5] );
 
-  ErrorCode store_curve_senses( std::map<RefEntity*,EntityHandle> entitymap[5] );
+  ErrorCode store_curve_senses( std::map<RefEntity*,EntityHandle> (&entitymap)[5] );
 
-  ErrorCode store_groups( std::map<RefEntity*,EntityHandle>* entitymap );
+  ErrorCode store_groups( std::map<RefEntity*,EntityHandle> (&entitymap)[5] );
 
   ErrorCode create_group_entsets( std::map<RefEntity*,EntityHandle>& entitymap );
 
-  ErrorCode store_group_content( std::map<RefEntity*,EntityHandle>* entitymap );
+  ErrorCode store_group_content( std::map<RefEntity*,EntityHandle> (&entitymap)[5] );
 
 
   void set_cgm_attributes(bool const act_attributes, bool const verbose);
 
 
-  ErrorCode create_vertices( std::map<RefEntity*,EntityHandle> entmap[5] );
+  ErrorCode create_vertices( std::map<RefEntity*,EntityHandle> &entitymap );
 
 
-  ErrorCode create_curve_facets( std::map<RefEntity*,EntityHandle> entitymap[5],
+  ErrorCode create_curve_facets( std::map<RefEntity*,EntityHandle> (&entitymap)[5],
                                  int norm_tol,
                                  double faceting_tol,
                                  bool verbose_warn = false );
 
-  ErrorCode create_surface_facets( std::map<RefEntity*,EntityHandle> entitymap[5],
+  ErrorCode create_surface_facets( std::map<RefEntity*,EntityHandle> (&entitymap)[5],
                                    int norm_tol, 
                                    double facet_tol, 
                                    double length_tol );


https://bitbucket.org/fathomteam/moab/commits/52baa949e61d/
Changeset:   52baa949e61d
Branch:      None
User:        pshriwise
Date:        2014-06-27 23:30:34
Summary:     Moved newly created re-factor functions from public to private.

Affected #:  1 file

diff --git a/src/io/ReadCGM.hpp b/src/io/ReadCGM.hpp
index 640ae4a..83fc8b5 100644
--- a/src/io/ReadCGM.hpp
+++ b/src/io/ReadCGM.hpp
@@ -71,6 +71,15 @@ public:
                              std::vector<int>& tag_values_out,
                              const SubsetList* subset_list = 0 );
 
+
+   //! Constructor
+   ReadCGM(Interface* impl = NULL);
+
+   //! Destructor
+  virtual ~ReadCGM();
+
+private:
+
   ErrorCode set_options( const FileOptions& opts,
                                 int& norm_tol,
                                 double& faceting_tol,
@@ -109,13 +118,6 @@ public:
                                    double facet_tol, 
                                    double length_tol );
 
-   //! Constructor
-   ReadCGM(Interface* impl = NULL);
-
-   //! Destructor
-  virtual ~ReadCGM();
-
-private:
 
   ReadUtilIface* readUtilIface;
 


https://bitbucket.org/fathomteam/moab/commits/c334cb120fdd/
Changeset:   c334cb120fdd
Branch:      None
User:        pshriwise
Date:        2014-06-27 23:30:34
Summary:     Updated arguments to store_*_sense functions to make them more readable.

Affected #:  2 files

diff --git a/src/io/ReadCGM.cpp b/src/io/ReadCGM.cpp
index e7682af..c1b3f2a 100644
--- a/src/io/ReadCGM.cpp
+++ b/src/io/ReadCGM.cpp
@@ -227,12 +227,13 @@ ErrorCode ReadCGM::set_options( const FileOptions& opts,
   return MB_SUCCESS;
 }
 
-  ErrorCode ReadCGM::store_surface_senses( std::map<RefEntity*,EntityHandle> (&entitymap)[5] )
+  ErrorCode ReadCGM::store_surface_senses( std::map<RefEntity*,EntityHandle>& surface_map,
+					   std::map<RefEntity*,EntityHandle>& volume_map )
 {
   ErrorCode rval;
   std::map<RefEntity*,EntityHandle>::iterator ci;
 
-  for (ci = entitymap[2].begin(); ci != entitymap[2].end(); ++ci) {
+  for (ci = surface_map.begin(); ci != surface_map.end(); ++ci) {
     RefFace* face = (RefFace*)(ci->first);
     BasicTopologyEntity *forward = 0, *reverse = 0;
     for (SenseEntity* cf = face->get_first_sense_entity_ptr();
@@ -264,12 +265,12 @@ ErrorCode ReadCGM::set_options( const FileOptions& opts,
     }
     
     if (forward) {
-      rval = myGeomTool->set_sense( ci->second, entitymap[3][forward], SENSE_FORWARD );
+      rval = myGeomTool->set_sense( ci->second, volume_map[forward], SENSE_FORWARD );
       if (MB_SUCCESS != rval)
         return rval;
     }
     if (reverse) {
-      rval = myGeomTool->set_sense( ci->second, entitymap[3][reverse], SENSE_REVERSE );
+      rval = myGeomTool->set_sense( ci->second, volume_map[reverse], SENSE_REVERSE );
       if (MB_SUCCESS != rval)
         return rval;
     }
@@ -278,21 +279,22 @@ ErrorCode ReadCGM::set_options( const FileOptions& opts,
   return MB_SUCCESS;
 }
 
-  ErrorCode ReadCGM::store_curve_senses( std::map<RefEntity*,EntityHandle> (&entitymap)[5] )
+  ErrorCode ReadCGM::store_curve_senses( std::map<RefEntity*,EntityHandle>& curve_map,
+					 std::map<RefEntity*,EntityHandle>& surface_map )
 {
 
   ErrorCode rval;
   std::vector<EntityHandle> ents;
   std::vector<int> senses;
   std::map<RefEntity*,EntityHandle>::iterator ci;
-  for (ci = entitymap[1].begin(); ci != entitymap[1].end(); ++ci) {
+  for (ci = curve_map.begin(); ci != curve_map.end(); ++ci) {
     RefEdge* edge = (RefEdge*)(ci->first);
     ents.clear();
     senses.clear();
     for (SenseEntity* ce = edge->get_first_sense_entity_ptr();
          ce; ce = ce->next_on_bte()) {
       BasicTopologyEntity* fac = ce->get_parent_basic_topology_entity_ptr();
-      EntityHandle face = entitymap[2][fac];
+      EntityHandle face = surface_map[fac];
       if (ce->get_sense() == CUBIT_UNKNOWN || 
           ce->get_sense() != edge->get_curve_ptr()->bridge_sense()) {
         ents.push_back(face);
@@ -835,11 +837,11 @@ ErrorCode ReadCGM::load_file(const char *cgm_file_name,
   if(rval!=MB_SUCCESS) return rval;
 
   // store CoFace senses
-  rval = store_surface_senses( entmap );
+  rval = store_surface_senses( entmap[2], entmap[3] );
   if (rval!=MB_SUCCESS) return rval;
 
   // store CoEdge senses
-  rval = store_curve_senses( entmap );
+  rval = store_curve_senses( entmap[1], entmap[2] );
   if (rval!=MB_SUCCESS) return rval;
 
   // get group information and store it in the mesh 

diff --git a/src/io/ReadCGM.hpp b/src/io/ReadCGM.hpp
index 83fc8b5..21dc386 100644
--- a/src/io/ReadCGM.hpp
+++ b/src/io/ReadCGM.hpp
@@ -91,9 +91,11 @@ private:
 
   ErrorCode create_topology( std::map<RefEntity*,EntityHandle> (&entitymap)[5] );
 
-  ErrorCode store_surface_senses( std::map<RefEntity*,EntityHandle> (&entitymap)[5] );
+  ErrorCode store_surface_senses( std::map<RefEntity*,EntityHandle>& surface_map,
+				  std::map<RefEntity*,EntityHandle>& volume_map );
 
-  ErrorCode store_curve_senses( std::map<RefEntity*,EntityHandle> (&entitymap)[5] );
+  ErrorCode store_curve_senses( std::map<RefEntity*,EntityHandle>& curve_map,
+				std::map<RefEntity*,EntityHandle>& surface_map );
 
   ErrorCode store_groups( std::map<RefEntity*,EntityHandle> (&entitymap)[5] );
 


https://bitbucket.org/fathomteam/moab/commits/afabd70a8c36/
Changeset:   afabd70a8c36
Branch:      master
User:        pshriwise
Date:        2014-06-27 23:30:35
Summary:     Updated faceting functions to use two distinct entitymaps for readability.

Affected #:  2 files

diff --git a/src/io/ReadCGM.cpp b/src/io/ReadCGM.cpp
index c1b3f2a..28c4986 100644
--- a/src/io/ReadCGM.cpp
+++ b/src/io/ReadCGM.cpp
@@ -330,7 +330,7 @@ ErrorCode ReadCGM::set_options( const FileOptions& opts,
   return MB_SUCCESS;
 }
 
-ErrorCode ReadCGM::create_group_entsets( std::map<RefEntity*,EntityHandle>& entitymap )
+ErrorCode ReadCGM::create_group_entsets( std::map<RefEntity*,EntityHandle>& group_map )
 {
 
   ErrorCode rval;
@@ -421,7 +421,7 @@ ErrorCode ReadCGM::create_group_entsets( std::map<RefEntity*,EntityHandle>& enti
       }
     }
     //add the group handle   
-    entitymap[grp] = h;
+    group_map[grp] = h;
   }
   return MB_SUCCESS;
 }
@@ -504,12 +504,12 @@ void ReadCGM::set_cgm_attributes(bool const act_attributes, bool const verbose)
 }
 
 
-  ErrorCode ReadCGM::create_vertices( std::map<RefEntity*,EntityHandle> &entitymap )
+  ErrorCode ReadCGM::create_vertices( std::map<RefEntity*,EntityHandle> &vertex_map )
 {
 
  ErrorCode rval;
  std::map<RefEntity*,EntityHandle>::iterator ci;
- for (ci = entitymap.begin(); ci != entitymap.end(); ++ci) {
+ for (ci = vertex_map.begin(); ci != vertex_map.end(); ++ci) {
     CubitVector pos = dynamic_cast<RefVertex*>(ci->first)->coordinates();
     double coords[3] = {pos.x(), pos.y(), pos.z()};
     EntityHandle vh;
@@ -530,7 +530,8 @@ void ReadCGM::set_cgm_attributes(bool const act_attributes, bool const verbose)
   return MB_SUCCESS;
 }
 
-  ErrorCode ReadCGM::create_curve_facets( std::map<RefEntity*,EntityHandle> (&entitymap)[5], 
+  ErrorCode ReadCGM::create_curve_facets( std::map<RefEntity*,EntityHandle>& curve_map,
+					  std::map<RefEntity*,EntityHandle>& vertex_map,
                                         int norm_tol, 
                                         double faceting_tol, 
                                         bool verbose_warn )
@@ -548,7 +549,7 @@ void ReadCGM::set_cgm_attributes(bool const act_attributes, bool const verbose)
   
   // create geometry for all curves
   GMem data;
-  for (ci = entitymap[1].begin(); ci != entitymap[1].end(); ++ci) {
+  for (ci = curve_map.begin(); ci != curve_map.end(); ++ci) {
     //get the start and end points of the curve in the form of a refernce edge
     RefEdge* edge = dynamic_cast<RefEdge*>(ci->first);
     //get the edge's curve information
@@ -586,7 +587,7 @@ void ReadCGM::set_cgm_attributes(bool const act_attributes, bool const verbose)
         std::cerr << "Warning: No facetting for curve " << edge->id() << std::endl;
         continue;
       }
-      EntityHandle h = entitymap[0][start_vtx];
+      EntityHandle h = vertex_map[start_vtx];
       rval = mdbImpl->add_entities( ci->second, &h, 1 );
       if (MB_SUCCESS != rval)
         return MB_FAILURE;
@@ -615,7 +616,7 @@ void ReadCGM::set_cgm_attributes(bool const act_attributes, bool const verbose)
     }    
       // create interior points
     std::vector<EntityHandle> verts, edges;
-    verts.push_back( entitymap[0][start_vtx] );
+    verts.push_back( vertex_map[start_vtx] );
     for (size_t i = 1; i < points.size() - 1; ++i) {
       double coords[] = { points[i].x(), points[i].y(), points[i].z() };
       EntityHandle h;
@@ -625,7 +626,7 @@ void ReadCGM::set_cgm_attributes(bool const act_attributes, bool const verbose)
         return MB_FAILURE;
       verts.push_back( h );
     }
-    verts.push_back( entitymap[0][end_vtx] );
+    verts.push_back( vertex_map[end_vtx] );
     
       // create edges
     for (size_t i = 0; i < verts.size()-1; ++i) {
@@ -657,7 +658,8 @@ void ReadCGM::set_cgm_attributes(bool const act_attributes, bool const verbose)
   return MB_SUCCESS;
 }
 
-  ErrorCode ReadCGM::create_surface_facets( std::map<RefEntity*,EntityHandle> (&entitymap)[5],
+  ErrorCode ReadCGM::create_surface_facets( std::map<RefEntity*,EntityHandle>& surface_map,
+					    std::map<RefEntity*,EntityHandle>& vertex_map,
                                           int norm_tol, 
                                           double facet_tol, 
                                           double length_tol )
@@ -669,7 +671,7 @@ void ReadCGM::set_cgm_attributes(bool const act_attributes, bool const verbose)
   DLIList<ModelEntity*> me_list;
   GMem data;
     // create geometry for all surfaces
-  for (ci = entitymap[2].begin(); ci != entitymap[2].end(); ++ci) {
+  for (ci = surface_map.begin(); ci != surface_map.end(); ++ci) {
     RefFace* face = dynamic_cast<RefFace*>(ci->first);
 
     data.clean_out();
@@ -703,7 +705,7 @@ void ReadCGM::set_cgm_attributes(bool const act_attributes, bool const verbose)
           if (verts[j])
             std::cerr << "Warning: Coincident vertices in surface " << face->id() << std::endl;
           //if a coincidence is found, keep track of it in the verts vector
-          verts[j] = entitymap[0][vtx];
+          verts[j] = vertex_map[vtx];
           break;
         }
       }
@@ -857,11 +859,11 @@ ErrorCode ReadCGM::load_file(const char *cgm_file_name,
   if(rval!=MB_SUCCESS) return rval; 
 
   // create facets for all curves
-  rval = create_curve_facets( entmap, norm_tol, faceting_tol, verbose_warnings );
+  rval = create_curve_facets( entmap[1], entmap[0], norm_tol, faceting_tol, verbose_warnings );
   if(rval!=MB_SUCCESS) return rval;
 
   // create facets for surfaces
-  rval = create_surface_facets( entmap, norm_tol, faceting_tol, len_tol);
+  rval = create_surface_facets( entmap[2], entmap[0], norm_tol, faceting_tol, len_tol);
   if(rval!=MB_SUCCESS) return rval;
 
   return MB_SUCCESS;

diff --git a/src/io/ReadCGM.hpp b/src/io/ReadCGM.hpp
index 21dc386..ce119af 100644
--- a/src/io/ReadCGM.hpp
+++ b/src/io/ReadCGM.hpp
@@ -99,7 +99,7 @@ private:
 
   ErrorCode store_groups( std::map<RefEntity*,EntityHandle> (&entitymap)[5] );
 
-  ErrorCode create_group_entsets( std::map<RefEntity*,EntityHandle>& entitymap );
+  ErrorCode create_group_entsets( std::map<RefEntity*,EntityHandle>& group_map );
 
   ErrorCode store_group_content( std::map<RefEntity*,EntityHandle> (&entitymap)[5] );
 
@@ -107,15 +107,17 @@ private:
   void set_cgm_attributes(bool const act_attributes, bool const verbose);
 
 
-  ErrorCode create_vertices( std::map<RefEntity*,EntityHandle> &entitymap );
+  ErrorCode create_vertices( std::map<RefEntity*,EntityHandle> &vertex_map );
 
 
-  ErrorCode create_curve_facets( std::map<RefEntity*,EntityHandle> (&entitymap)[5],
+  ErrorCode create_curve_facets( std::map<RefEntity*,EntityHandle>& curve_map,
+				 std::map<RefEntity*,EntityHandle>& vertex_map,
                                  int norm_tol,
                                  double faceting_tol,
                                  bool verbose_warn = false );
 
-  ErrorCode create_surface_facets( std::map<RefEntity*,EntityHandle> (&entitymap)[5],
+  ErrorCode create_surface_facets( std::map<RefEntity*,EntityHandle>& surface_map,
+				   std::map<RefEntity*,EntityHandle>& vertex_map,
                                    int norm_tol, 
                                    double facet_tol, 
                                    double length_tol );

Repository URL: https://bitbucket.org/fathomteam/moab/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.


More information about the moab-dev mailing list