[MOAB-dev] r1532 - in MOAB/trunk: . refiner

pebay at mcs.anl.gov pebay at mcs.anl.gov
Wed Jan 16 20:44:27 CST 2008


Author: pebay
Date: 2008-01-16 20:44:27 -0600 (Wed, 16 Jan 2008)
New Revision: 1532

Modified:
   MOAB/trunk/refiner/MBEntityRefiner.cpp
   MOAB/trunk/refiner/MBSimplexTemplateRefiner.cpp
   MOAB/trunk/test_mesh_refiner.cpp
Log:
ENH: checkpoint


Modified: MOAB/trunk/refiner/MBEntityRefiner.cpp
===================================================================
--- MOAB/trunk/refiner/MBEntityRefiner.cpp	2008-01-17 01:43:10 UTC (rev 1531)
+++ MOAB/trunk/refiner/MBEntityRefiner.cpp	2008-01-17 02:44:27 UTC (rev 1532)
@@ -149,7 +149,7 @@
 void MBEntityRefiner::update_heap_size()
 {
   unsigned long n = this->get_heap_size_bound( this->maximum_number_of_subdivisions );
-  this->coord_heap.resize( 6 * n );
+  this->coord_heap.resize( 6 * n + 8 );
   if ( this->edge_size_evaluator )
     {
     unsigned long m = this->edge_size_evaluator->get_vertex_tag_size();

Modified: MOAB/trunk/refiner/MBSimplexTemplateRefiner.cpp
===================================================================
--- MOAB/trunk/refiner/MBSimplexTemplateRefiner.cpp	2008-01-17 01:43:10 UTC (rev 1531)
+++ MOAB/trunk/refiner/MBSimplexTemplateRefiner.cpp	2008-01-17 02:44:27 UTC (rev 1532)
@@ -43,42 +43,49 @@
     return false;
     }
   std::vector<double> entity_coords;
-  std::vector<char> entity_tags;
-  int ts = this->edge_size_evaluator->get_vertex_tag_size();
+  std::vector<void*> entity_tags;
   entity_coords.resize( 6 * num_nodes );
-  if ( ts )
-    {
-    entity_tags.resize( num_nodes * ts );
-    }
+  entity_tags.resize( num_nodes );
+
   MBEntityType etyp = this->mesh->type_from_handle( entity );
   // Have to make num_nodes calls to get_coords() because we need xyz interleaved with rst coords.
+  MBTag tag_handle;
+  int tag_offset;
   for ( int n = 0; n < num_nodes; ++ n )
     {
     if ( this->mesh->get_coords( &conn[n], 1, &entity_coords[6 * n + 3] ) != MB_SUCCESS )
       {
       return false;
       }
-    // Still need to get tags.
+    entity_tags[n] = this->heap_tag_storage();
+    for ( int i = 0; i < this->edge_size_evaluator->get_number_of_vertex_tags(); ++ i )
+      {
+      this->edge_size_evaluator->get_vertex_tag( i, tag_handle, tag_offset );
+      if ( this->mesh->tag_get_data( tag_handle, &conn[n], 1, (char*)( entity_tags[n] ) + tag_offset ) != MB_SUCCESS )
+        {
+        return false;
+        }
+      }
     }
 
   switch ( etyp )
     {
     case MBVERTEX:
       this->assign_parametric_coordinates( 1, MBVertexParametric, &entity_coords[0] );
-      this->refine_0_simplex( &entity_coords[0], &entity_tags[0] );
+      this->refine_0_simplex( &entity_coords[0], entity_tags[0] );
       rval = false;
       break;
     case MBEDGE:
       this->assign_parametric_coordinates( 2, MBEdgeParametric, &entity_coords[0] );
       rval = this->refine_1_simplex( this->maximum_number_of_subdivisions,
-        &entity_coords[0], &entity_tags[0],  &entity_coords[6], &entity_tags[ts] );
+        &entity_coords[0], entity_tags[0],  &entity_coords[6], entity_tags[1] );
       break;
     case MBTRI:
       this->assign_parametric_coordinates( 3, MBTriParametric, &entity_coords[0] );
       rval = this->refine_2_simplex( this->maximum_number_of_subdivisions, 7,
-        &entity_coords[ 0], &entity_tags[     0],
-        &entity_coords[ 6], &entity_tags[    ts],
-        &entity_coords[12], &entity_tags[2 * ts] );
+        &entity_coords[ 0], entity_tags[0],
+        &entity_coords[ 6], entity_tags[1],
+        &entity_coords[12], entity_tags[2] );
       break;
     case MBQUAD:
       std::cerr << "Quadrilaterals not handled yet\n";

Modified: MOAB/trunk/test_mesh_refiner.cpp
===================================================================
--- MOAB/trunk/test_mesh_refiner.cpp	2008-01-17 01:43:10 UTC (rev 1531)
+++ MOAB/trunk/test_mesh_refiner.cpp	2008-01-17 02:44:27 UTC (rev 1532)
@@ -12,7 +12,15 @@
     std::cout << "[ " << vcoords[0];
     for ( int i = 1; i < 6; ++i )
       std::cout << ", " << vcoords[i];
-    std::cout << " ]\n";
+    std::cout << " ] ";
+
+    double* x = (double*)vtags;
+    int* m = (int*)( (char*)vtags + 2 * sizeof( double ) );
+    std::cout << "< " << x[0]
+              << ", " << x[1];
+    for ( int i = 0; i < 4; ++i )
+      std::cout << ", " << m[i];
+    std::cout << " >\n";
     }
 
   virtual void operator () ( MBEntityType etyp )
@@ -31,6 +39,16 @@
   double p2[6] = { 1.0, 0.0, 0.0,  1.0, 0.0, 0.0 };
   double p3[6] = { 0.6, 2.0, 0.0,  0.6, 2.0, 0.0 };
 
+  double default_floatular[] = { 38.7, 104. };
+  double floatular_values[] = { 38.7, 104., 
+                                123.456, 789.012, 
+                                0., 1. };
+
+  int default_intular[] = { 7, 11, 24, 7 };
+  int intular_values[] = {  7, 11, 24, 7, 
+                            1, 2, 3, 4, 
+                            13, 17, 19, 23 };
+
   if ( eval->evaluate_edge( p0, 0, p1, 0, p2, 0 ) )
     {
     return 1;
@@ -45,10 +63,22 @@
   MBEntityHandle node_handles[3];
   MBEntityHandle tri_handle;
 
+  MBTag tag_floatular;
+  iface->tag_create( "floatular", 2 * sizeof( double ), MB_TAG_DENSE, tag_floatular, default_floatular );
+
+  MBTag tag_intular;
+  iface->tag_create( "intular", 4 * sizeof( int ), MB_TAG_DENSE, tag_intular, default_intular );
+
   iface->create_vertex( p0, node_handles[0] );
   iface->create_vertex( p2, node_handles[1] );
   iface->create_vertex( p3, node_handles[2] );
 
+  iface->tag_set_data( tag_floatular, node_handles, 3, (void*)floatular_values );
+  eval->add_vertex_tag( tag_floatular );
+
+  iface->tag_set_data( tag_intular, node_handles, 3, (void*)intular_values );
+  eval->add_vertex_tag( tag_intular );
+
   iface->create_element( MBTRI, node_handles, 3, tri_handle );
 
   MBSimplexTemplateRefiner eref( iface );




More information about the moab-dev mailing list