예제 #1
0
moab::ErrorCode test_hv_cube_mesh( double A_f, double valence, double &ray_fire_time, double worst_split_ratio )
{

  std::cout << "TESTING MESH - Valence: " << valence << " Area Fraction: " << A_f << std::endl;
	  prep_mesh( A_f, valence);
	  
	  ////////////// START OF MOAB STUFF \\\\\\\\\\\\\\\\\\\\\\\	\

	  moab::OrientedBoxTreeTool::Settings settings; 
	  settings.max_leaf_entities = 8; 
	  settings.max_depth = 0;
	  settings.worst_cost = worst_split_ratio; 
	  settings.best_cost = 0.4;
	  settings.set_options = MESHSET_SET;

	  //now we'll try to load this mesh-file into a dagmc instance
	  moab::DagMC *dag = new moab::DagMC( mbi );
	  
	  moab::ErrorCode result;
	  
	  //load the mesh data from the moab instance into dag
	  result = dag->load_existing_contents(); 
	  if( MB_SUCCESS != result) return MB_FAILURE;

	  result = dag->setup_impl_compl();
	  MB_CHK_SET_ERR(result, "Could not setup implicit compliment.");

	  moab::Range surfs,vols;
	  result = dag->setup_geometry(surfs,vols);
	  MB_CHK_SET_ERR(result,"Failed to setup the geometry.");
	  // build obbs
	  result = build_obbs(dag,surfs,vols,settings);
	  MB_CHK_SET_ERR(result, "Failed to setup the OBBs");
	  
	  // setup indices
	  result = dag->setup_indices();
	  MB_CHK_SET_ERR(result, "Failed to setup problem indices");
	  
	  //analyze mesh here
	  double avg_fire_time;
	  CartVect source;
	  source[0] = 0; source [1] = 0; source [2] = 0;
	  //call into the new functions for firing random rays and get the avg time
	  fire_rand_rays( dag, vols[0], 100000, avg_fire_time, source);
	  //write time to data file

	  mbi->write_mesh("hvcube.h5m");
	  std::cout << "The average fire time for this mesh was: " << avg_fire_time << "s" << std::endl;
	  ray_fire_time = avg_fire_time;
	  
	  mbi->delete_mesh();
	  return MB_SUCCESS;

}
예제 #2
0
int main(int argc, char* argv[])
{
  // create empty meshset                                                                                                                      
  MBErrorCode result, rval;
  MBEntityHandle input_set;
  rval = MBI()->create_meshset( MESHSET_SET | MESHSET_TRACK_OWNER, input_set );

  // load the input file                                                                                                
  std::string input_name = argv[1];
  rval = MBI()->load_file( input_name.c_str(), &input_set );

  // setup the geometry
  MBRange surfs,volumes;
  rval = setup_geometry(surfs,volumes);
  
  std::cout << "Number of surfaces: " << surfs.size() << std::endl;
  std::cout << "Number of volumes: " << volumes.size() << std::endl;

  #pragma omp parallel 
  {
    #pragma omp critical
    {
      std::cout << omp_get_thread_num() << std::endl;
    }

    moab::OrientedBoxTreeTool *obb = new moab::OrientedBoxTreeTool(MBI());  
    rval = build_obbs(obb,surfs,volumes);
    
    #pragma omp taskwait

    #pragma omp critical
    {
      std::cout << omp_get_thread_num() << std::endl;
    }
  }

  return 0;
}