[MOAB-dev] r5123 - MOAB/trunk/src/io

kraftche at cae.wisc.edu kraftche at cae.wisc.edu
Fri Aug 26 11:48:15 CDT 2011


Author: kraftche
Date: 2011-08-26 11:48:15 -0500 (Fri, 26 Aug 2011)
New Revision: 5123

Modified:
   MOAB/trunk/src/io/WriteNCDF.cpp
Log:
simplify a little bit of code in WriteNCDF using newer moab::Range features

Modified: MOAB/trunk/src/io/WriteNCDF.cpp
===================================================================
--- MOAB/trunk/src/io/WriteNCDF.cpp	2011-08-26 16:46:04 UTC (rev 5122)
+++ MOAB/trunk/src/io/WriteNCDF.cpp	2011-08-26 16:48:15 UTC (rev 5123)
@@ -384,27 +384,6 @@
     if (dummy_range.empty())
       continue;
 
-    // wait a minute, we are doing some filtering here that doesn't make sense at this level  CJS
-
-      // find the dimension of the last entity in this range
-    Range::iterator entity_iter = dummy_range.end();
-    entity_iter = dummy_range.end();
-    entity_iter--;
-    int this_dim = CN::Dimension(TYPE_FROM_HANDLE(*entity_iter));
-    entity_iter = dummy_range.begin();
-    while (entity_iter != dummy_range.end() &&
-           CN::Dimension(TYPE_FROM_HANDLE(*entity_iter)) != this_dim)
-      entity_iter++;
-    
-    if (entity_iter != dummy_range.end())
-      std::copy(entity_iter, dummy_range.end(), range_inserter(block_data.elements));
-
-    assert(block_data.elements.begin() == block_data.elements.end() ||
-           CN::Dimension(TYPE_FROM_HANDLE(*(block_data.elements.begin()))) == this_dim);
-    
-    // end of -- wait a minute, we are doing some filtering here that doesn't make sense at this level CJS
-   
-
     // get the block's id
     if(mdbImpl->tag_get_data(mMaterialSetTag, &(*vector_iter), 1, &id) != MB_SUCCESS ) {
       mWriteIface->report_error("Couldn't get block id from a tag for an element block.");
@@ -413,17 +392,23 @@
     
     block_data.id = id; 
     block_data.number_attributes = 0;
- 
-     // iterate through all the elements in the meshset
-    Range::iterator elem_range_iter, end_elem_range_iter;
-    elem_range_iter = block_data.elements.begin();
-    end_elem_range_iter = block_data.elements.end();
 
+    // wait a minute, we are doing some filtering here that doesn't make sense at this level  CJS
+
+      // find the dimension of the last entity in this range
+    int this_dim = CN::Dimension(TYPE_FROM_HANDLE(dummy_range.back()));
+    if (this_dim > 3) {
+      mWriteIface->report_error("Block %d contains entity sets.", id);
+      return MB_TYPE_OUT_OF_RANGE;
+    }
+    block_data.elements = dummy_range.subset_by_dimension( this_dim );


More information about the moab-dev mailing list