Changeset 3294

Show
Ignore:
Timestamp:
11/06/09 12:12:14 (2 weeks ago)
Author:
kraftche
Message:

fix bug in previous checkin, and add tests for timing skinning

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • MOAB/trunk/tools/mbperf/mbperf.cpp

    r3293 r3294  
    4646#include "SequenceManager.hpp" 
    4747#include "HomXform.hpp" 
     48#include "MBSkinner.hpp" 
    4849 
    4950double LENGTH = 1.0; 
     
    5455void testB(const int nelem); 
    5556void testC(const int nelem); 
     57void skin_time(const int intervals); 
     58void skin_adj(const int intervals); 
     59void skin_vert(const int intervals); 
    5660void print_time(const bool print_em, double &tot_time, double &utime, double &stime, 
    5761                double &mem); 
     
    6165void get_time_mem(double &tot_time, double &user_time, 
    6266                  double &sys_time, double &tot_mem); 
     67void bulk_construct_mesh( MBInterface* gMB, const int nelem ); 
    6368 
    6469void compute_edge(double *start, const int nelem,  const double xint, 
     
    279284const struct { 
    280285  std::string testName; 
     286  test_func_t testFunc; 
    281287  std::string testDesc; 
    282   test_func_t testFunc; 
    283288} TestList[] = { 
    284  { "struct", "Conn. and adj. query time for structured mesh", &testA }, 
    285  { "bulk",   "Conn. and adj. query time for bulk-created mesh", &testB }, 
    286  { "indiv",  "Conn. and adj. query time for per-entity created mesh", &testC }, 
    287 // { "skin",       "Test skin time", &skin_time }, 
    288 // { "skin_adj",   "Test skin time using vertex-to-element adjacencies", &skin_adj }, 
    289  }; 
    290  
     289 { "struct",    &testA,     "Conn. and adj. query time for structured mesh" }, 
     290 { "bulk",      &testB,     "Conn. and adj. query time for bulk-created mesh" }, 
     291 { "indiv",     &testC,     "Conn. and adj. query time for per-entity created mesh" }, 
     292 { "skin",      &skin_time, "Test time to get skin quads" }, 
     293 { "skin_adj",  &skin_adj,  "Test skin quads using vert-to-elem adjacencies" }, 
     294 { "skin_vert", &skin_vert, "Test time to get skin verts" }, 
     295}; 
    291296const int TestListSize = sizeof(TestList)/sizeof(TestList[0]);  
    292297 
     
    361366          return 1; 
    362367        } 
    363       } while (TestList[j].testName == argv[i]); 
     368      } while (TestList[j].testName != argv[i]); 
    364369      test_list.push_back( TestList[j].testFunc ); 
    365370    } 
     
    580585} 
    581586 
    582 void testB(const int nelem)  
    583 { 
    584   MBCore moab; 
    585   MBInterface* gMB = &moab; 
    586   double ttime0, ttime1, ttime2, ttime3, utime, stime, mem; 
    587    
    588   print_time(false, ttime0, utime, stime, mem); 
    589   std::cout << "Ready to read model into MOAB; memory = " << mem/1.0e6 << " MB." << std::endl; 
    590  
     587void bulk_construct_mesh( MBInterface* gMB, const int nelem ) 
     588{ 
    591589  int num_verts = (nelem + 1)*(nelem + 1)*(nelem + 1); 
    592590  int num_elems = nelem*nelem*nelem; 
     
    617615  result = readMeshIface->update_adjacencies(estart, num_elems, 8, conn); 
    618616  assert(MB_SUCCESS == result); 
     617} 
     618 
     619void testB(const int nelem)  
     620{ 
     621  MBCore moab; 
     622  MBInterface* gMB = &moab; 
     623  double ttime0, ttime1, ttime2, ttime3, utime, stime, mem; 
     624   
     625  print_time(false, ttime0, utime, stime, mem); 
     626  std::cout << "Ready to read model into MOAB; memory = " << mem/1.0e6 << " MB." << std::endl; 
     627 
     628  bulk_construct_mesh( gMB, nelem ); 
    619629 
    620630  print_time(false, ttime1, utime, stime, mem); 
     
    712722            << std::endl; 
    713723} 
     724 
     725void skin_time( const int nelem )  
     726{ 
     727  MBCore moab; 
     728  MBInterface* gMB = &moab; 
     729  MBErrorCode rval; 
     730 
     731  bulk_construct_mesh( gMB, nelem ); 
     732 
     733  MBRange skin, hexes; 
     734  rval = gMB->get_entities_by_dimension( 0, 3, hexes ); 
     735  assert(MB_SUCCESS == rval); assert(!hexes.empty()); 
     736 
     737  MBSkinner tool(gMB); 
     738  clock_t t = clock(); 
     739  rval = tool.find_skin( hexes, 2, skin, false ); 
     740  double d = ((double)(clock() - t))/CLOCKS_PER_SEC; 
     741  assert(MB_SUCCESS == rval); 
     742   
     743  std::cout << "Got 2D skin in " << d << " seconds w/out vertex-to-element adjacencies" << std::endl; 
     744} 
     745 
     746void skin_adj( const int nelem )  
     747{ 
     748  MBCore moab; 
     749  MBInterface* gMB = &moab; 
     750  MBErrorCode rval; 
     751 
     752  bulk_construct_mesh( gMB, nelem ); 
     753 
     754  MBRange skin, verts, hexes; 
     755    // force creation of adjacencies 
     756  rval = gMB->get_entities_by_dimension( 0, 0, verts ); 
     757  assert(MB_SUCCESS == rval); assert(!verts.empty()); 
     758  rval = gMB->get_adjacencies( verts, 3, false, hexes ); 
     759  assert(MB_SUCCESS == rval); assert(!hexes.empty()); 
     760 
     761  MBSkinner tool(gMB); 
     762  clock_t t = clock(); 
     763  rval = tool.find_skin( hexes, 2, skin, true ); 
     764  double d = ((double)(clock() - t))/CLOCKS_PER_SEC; 
     765  assert(MB_SUCCESS == rval); 
     766 
     767  std::cout << "Got 2D skin in " << d << " seconds with vertex-to-element adjacencies" << std::endl; 
     768} 
     769 
     770void skin_vert( const int nelem )  
     771{ 
     772  MBCore moab; 
     773  MBInterface* gMB = &moab; 
     774  MBErrorCode rval; 
     775 
     776  bulk_construct_mesh( gMB, nelem ); 
     777 
     778  MBRange skin, hexes; 
     779  rval = gMB->get_entities_by_dimension( 0, 3, hexes ); 
     780  assert(MB_SUCCESS == rval); assert(!hexes.empty()); 
     781 
     782  MBSkinner tool(gMB); 
     783  clock_t t = clock(); 
     784  rval = tool.find_skin( hexes, 0, skin, false ); 
     785  double d = ((double)(clock() - t))/CLOCKS_PER_SEC; 
     786  assert(MB_SUCCESS == rval); 
     787   
     788  std::cout << "Got 0D skin in " << d << " seconds w/out vertex-to-element adjacencies" << std::endl; 
     789}