[MOAB-dev] commit/MOAB: danwu: Removed some unwanted warnings for unit tests in directory test/dagmc.
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Mon Apr 28 12:41:12 CDT 2014
1 new commit in MOAB:
https://bitbucket.org/fathomteam/moab/commits/0c3c2a8253a1/
Changeset: 0c3c2a8253a1
Branch: master
User: danwu
Date: 2014-04-28 19:40:42
Summary: Removed some unwanted warnings for unit tests in directory test/dagmc.
Affected #: 3 files
diff --git a/test/dagmc/dagmc_pointinvol_test.cpp b/test/dagmc/dagmc_pointinvol_test.cpp
index 47ee7c1..a859b65 100644
--- a/test/dagmc/dagmc_pointinvol_test.cpp
+++ b/test/dagmc/dagmc_pointinvol_test.cpp
@@ -26,7 +26,6 @@ static const char input_file[] = STRINGIFY(MESHDIR) "/dagmc/test_geom.h5m";
static const char input_file[] = STRINGIFY(MESHDIR) "/dagmc/test_geom.h5m";
#endif
-
void dagmc_setup_test()
{
ErrorCode rval = DAG->load_file(input_file); // open the Dag file
@@ -34,250 +33,247 @@ void dagmc_setup_test()
rval = DAG->init_OBBTree();
CHECK_ERR(rval);
+ /*
int num_vols = DAG->num_entities(3);
EntityHandle vol;
- for ( int i = 0 ; i < num_vols ; i++ )
- {
- vol = DAG->entity_by_index(3,i);
- }
+ for (int i = 0; i < num_vols; i++)
+ vol = DAG->entity_by_index(3, i);
+ */
//EntityHandle volume = 12682136550675316765;
- //CHECK_EQUAL(volume,vol);
+ //CHECK_EQUAL(volume, vol);
}
void dagmc_point_in()
{
int result = 0;
- int expected_result=1;
- double xyz[3]={0.0,0.0,0.0};
- int vol_idx=1;
- EntityHandle vol_h = DAG->entity_by_index(3,vol_idx);
- ErrorCode rval = DAG->point_in_volume(vol_h,xyz,result);
+ int expected_result = 1;
+ double xyz[3] = {0.0, 0.0, 0.0};
+ int vol_idx = 1;
+ EntityHandle vol_h = DAG->entity_by_index(3, vol_idx);
+ ErrorCode rval = DAG->point_in_volume(vol_h, xyz, result);
CHECK_ERR(rval);
- CHECK_EQUAL(expected_result,result);
+ CHECK_EQUAL(expected_result, result);
}
-int dagmc_point_in_vol_dir(double origin[3],double dir[3],int vol_idx)
+int dagmc_point_in_vol_dir(double origin[3], double dir[3], int vol_idx)
{
int result = 0;
- EntityHandle vol_h = DAG->entity_by_index(3,vol_idx);
+ EntityHandle vol_h = DAG->entity_by_index(3, vol_idx);
double xyz[3];
double next_surf_dist;
EntityHandle next_surf;
// normalise the vector
- double dir_norm = (dir[0]*dir[0])+(dir[1]*dir[1])+(dir[2]*dir[2]);
+ double dir_norm = (dir[0]*dir[0]) + (dir[1]*dir[1]) + (dir[2]*dir[2]);
- dir[0]=dir[0]/sqrt(dir_norm);
- dir[1]=dir[1]/sqrt(dir_norm);
- dir[2]=dir[2]/sqrt(dir_norm);
+ dir[0] = dir[0] / sqrt(dir_norm);
+ dir[1] = dir[1] / sqrt(dir_norm);
+ dir[2] = dir[2] / sqrt(dir_norm);
- ErrorCode rval = DAG->ray_fire(vol_h,origin,dir,next_surf,next_surf_dist);
-
- xyz[0]=origin[0]+(next_surf_dist*dir[0]);
- xyz[1]=origin[1]+(next_surf_dist*dir[1]);
- xyz[2]=origin[2]+(next_surf_dist*dir[2]);
+ ErrorCode rval = DAG->ray_fire(vol_h, origin, dir, next_surf, next_surf_dist);
+
+ xyz[0] = origin[0] + (next_surf_dist*dir[0]);
+ xyz[1] = origin[1] + (next_surf_dist*dir[1]);
+ xyz[2] = origin[2] + (next_surf_dist*dir[2]);
std::cout << xyz[0] << " " << xyz[1] << " " << xyz[2] << std::endl;
- rval = DAG->point_in_volume(vol_h,xyz,result,dir);
+ rval = DAG->point_in_volume(vol_h, xyz, result, dir);
CHECK_ERR(rval);
return result;
}
void dagmc_point_in_vol_1()
{
- double dir[3]={ -1.0,0.0,0.0};
- double origin[3]={0.0,0.0,0.0};
- int vol_idx=1;
- int expected_result=1;
-
- int result = dagmc_point_in_vol_dir(origin,dir,vol_idx);
- CHECK_EQUAL(expected_result,result);
+ double dir[3] = {-1.0, 0.0, 0.0};
+ double origin[3] = {0.0, 0.0, 0.0};
+ int vol_idx = 1;
+ int expected_result = 1;
+ int result = dagmc_point_in_vol_dir(origin, dir, vol_idx);
+ CHECK_EQUAL(expected_result, result);
}
void dagmc_point_in_vol_2()
{
- int expected_result=1;
- int vol_idx=1;
- double dir[3]={ 1.0,0.0,0.0};
- double origin[3]={0.0,0.0,0.0};
+ int expected_result = 1;
+ int vol_idx = 1;
+ double dir[3] = {1.0, 0.0, 0.0};
+ double origin[3] = {0.0, 0.0, 0.0};
- int result = dagmc_point_in_vol_dir(origin,dir,vol_idx);
+ int result = dagmc_point_in_vol_dir(origin, dir, vol_idx);
- CHECK_EQUAL(expected_result,result);
+ CHECK_EQUAL(expected_result, result);
}
void dagmc_point_in_vol_3()
{
- int expected_result=1;
- int vol_idx=1;
- double dir[3]={ 0.0,-1.0,0.0};
- double origin[3]={0.0,0.0,0.0};
+ int expected_result = 1;
+ int vol_idx = 1;
+ double dir[3] = {0.0, -1.0, 0.0};
+ double origin[3] = {0.0, 0.0, 0.0};
- int result = dagmc_point_in_vol_dir(origin,dir,vol_idx);
+ int result = dagmc_point_in_vol_dir(origin, dir, vol_idx);
- CHECK_EQUAL(expected_result,result);
+ CHECK_EQUAL(expected_result, result);
}
void dagmc_point_in_vol_4()
{
- int expected_result=1;
- int vol_idx=1;
- double dir[3]={ 0.0,1.0,0.0};
- double origin[3]={0.0,0.0,0.0};
-
- int result = dagmc_point_in_vol_dir(origin,dir,vol_idx);
+ int expected_result = 1;
+ int vol_idx = 1;
+ double dir[3] = {0.0, 1.0, 0.0};
+ double origin[3] = {0.0, 0.0, 0.0};
- CHECK_EQUAL(expected_result,result);
+ int result = dagmc_point_in_vol_dir(origin, dir, vol_idx);
+ CHECK_EQUAL(expected_result, result);
}
void dagmc_point_in_vol_5()
{
- int expected_result=1;
- int vol_idx=1;
- double dir[3]={ 0.0,0.0,-1.0};
- double origin[3]={0.0,0.0,0.0};
+ int expected_result = 1;
+ int vol_idx = 1;
+ double dir[3] = {0.0, 0.0, -1.0};
+ double origin[3] = {0.0, 0.0, 0.0};
- int result = dagmc_point_in_vol_dir(origin,dir,vol_idx);
+ int result = dagmc_point_in_vol_dir(origin, dir, vol_idx);
- CHECK_EQUAL(expected_result,result);
+ CHECK_EQUAL(expected_result, result);
}
void dagmc_point_in_vol_6()
{
- int expected_result=1;
- int vol_idx=1;
- double dir[3]={ 0.0,0.0,1.0};
- double origin[3]={0.0,0.0,0.0};
-
- int result = dagmc_point_in_vol_dir(origin,dir,vol_idx);
+ int expected_result = 1;
+ int vol_idx = 1;
+ double dir[3] = {0.0, 0.0, 1.0};
+ double origin[3] = {0.0, 0.0, 0.0};
- CHECK_EQUAL(expected_result,result);
+ int result = dagmc_point_in_vol_dir(origin, dir, vol_idx);
+ CHECK_EQUAL(expected_result, result);
}
void dagmc_point_on_corner_1()
{
- int expected_result=1;
- int vol_idx=1;
- double dir[3]={ 1.0,1.0,1.0};
- double origin[3]={0.0,0.0,0.0};
+ int expected_result = 1;
+ int vol_idx = 1;
+ double dir[3] = {1.0, 1.0, 1.0};
+ double origin[3] = {0.0, 0.0, 0.0};
- int result = dagmc_point_in_vol_dir(origin,dir,vol_idx);
+ int result = dagmc_point_in_vol_dir(origin, dir, vol_idx);
- CHECK_EQUAL(expected_result,result);
+ CHECK_EQUAL(expected_result, result);
}
void dagmc_point_on_corner_2()
{
- int expected_result=1;
- int vol_idx=1;
- double dir[3]={ -1.0,1.0,1.0};
- double origin[3]={0.0,0.0,0.0};
+ int expected_result = 1;
+ int vol_idx = 1;
+ double dir[3] = {-1.0, 1.0, 1.0};
+ double origin[3] = {0.0, 0.0, 0.0};
- int result = dagmc_point_in_vol_dir(origin,dir,vol_idx);
+ int result = dagmc_point_in_vol_dir(origin, dir, vol_idx);
- CHECK_EQUAL(expected_result,result);
+ CHECK_EQUAL(expected_result, result);
}
void dagmc_point_on_corner_3()
{
int expected_result = 1;
- int vol_idx=1;
- double dir[3]={ 1.0,1.0,-1.0};
- double origin[3]={0.0,0.0,0.0};
+ int vol_idx = 1;
+ double dir[3] = {1.0, 1.0, -1.0};
+ double origin[3] = {0.0, 0.0, 0.0};
- int result = dagmc_point_in_vol_dir(origin,dir,vol_idx);
+ int result = dagmc_point_in_vol_dir(origin, dir, vol_idx);
- CHECK_EQUAL(expected_result,result);
+ CHECK_EQUAL(expected_result, result);
}
void dagmc_point_on_corner_4()
{
int expected_result = 1;
- int vol_idx=1;
- double dir[3]={ -1.0,1.0,-1.0};
- double origin[3]={0.0,0.0,0.0};
+ int vol_idx = 1;
+ double dir[3] = {-1.0, 1.0, -1.0};
+ double origin[3] = {0.0, 0.0, 0.0};
- int result = dagmc_point_in_vol_dir(origin,dir,vol_idx);
+ int result = dagmc_point_in_vol_dir(origin, dir, vol_idx);
- CHECK_EQUAL(expected_result,result);
+ CHECK_EQUAL(expected_result, result);
}
void dagmc_point_on_corner_5()
{
int expected_result = 1;
- int vol_idx=1;
- double dir[3]={ 1.0,-1.0,1.0};
- double origin[3]={0.0,0.0,0.0};
+ int vol_idx = 1;
+ double dir[3] = {1.0, -1.0, 1.0};
+ double origin[3] = {0.0, 0.0, 0.0};
- int result = dagmc_point_in_vol_dir(origin,dir,vol_idx);
+ int result = dagmc_point_in_vol_dir(origin, dir, vol_idx);
- CHECK_EQUAL(expected_result,result);
+ CHECK_EQUAL(expected_result, result);
}
void dagmc_point_on_corner_6()
{
int expected_result = 1;
- int vol_idx=1;
- double dir[3]={ -1.0,-1.0,1.0};
- double origin[3]={0.0,0.0,0.0};
+ int vol_idx = 1;
+ double dir[3] = {-1.0, -1.0, 1.0};
+ double origin[3] = {0.0, 0.0, 0.0};
- int result = dagmc_point_in_vol_dir(origin,dir,vol_idx);
+ int result = dagmc_point_in_vol_dir(origin, dir, vol_idx);
- CHECK_EQUAL(expected_result,result);
+ CHECK_EQUAL(expected_result, result);
}
void dagmc_point_on_corner_7()
{
int expected_result = 1;
- int vol_idx=1;
- double dir[3]={ 1.0,-1.0,-1.0};
- double origin[3]={0.0,0.0,0.0};
+ int vol_idx = 1;
+ double dir[3] = {1.0, -1.0, -1.0};
+ double origin[3] = {0.0, 0.0, 0.0};
- int result = dagmc_point_in_vol_dir(origin,dir,vol_idx);
+ int result = dagmc_point_in_vol_dir(origin, dir, vol_idx);
- CHECK_EQUAL(expected_result,result);
+ CHECK_EQUAL(expected_result, result);
}
void dagmc_point_on_corner_8()
{
int expected_result = 1;
- int vol_idx=1;
- double dir[3]={ -1.0,-1.0,-1.0};
- double origin[3]={0.0,0.0,0.0};
+ int vol_idx = 1;
+ double dir[3] = {-1.0, -1.0, -1.0};
+ double origin[3] = {0.0, 0.0, 0.0};
- int result = dagmc_point_in_vol_dir(origin,dir,vol_idx);
+ int result = dagmc_point_in_vol_dir(origin, dir, vol_idx);
- CHECK_EQUAL(expected_result,result);
+ CHECK_EQUAL(expected_result, result);
}
int main(int /* argc */, char** /* argv */)
{
int result = 0;
- result += RUN_TEST( dagmc_setup_test ); // setup problem
- result += RUN_TEST( dagmc_point_in ); // point in centre
+ result += RUN_TEST(dagmc_setup_test); // setup problem
+ result += RUN_TEST(dagmc_point_in); // point in centre
// rays fired along cardinal directions
- result += RUN_TEST( dagmc_point_in_vol_1); // point in centre
- result += RUN_TEST( dagmc_point_in_vol_2); // point in centre
- result += RUN_TEST( dagmc_point_in_vol_3); // point in centre
- result += RUN_TEST( dagmc_point_in_vol_4); // point in centre
- result += RUN_TEST( dagmc_point_in_vol_5); // point in centre
- result += RUN_TEST( dagmc_point_in_vol_6); // point in centre
+ result += RUN_TEST(dagmc_point_in_vol_1); // point in centre
+ result += RUN_TEST(dagmc_point_in_vol_2); // point in centre
+ result += RUN_TEST(dagmc_point_in_vol_3); // point in centre
+ result += RUN_TEST(dagmc_point_in_vol_4); // point in centre
+ result += RUN_TEST(dagmc_point_in_vol_5); // point in centre
+ result += RUN_TEST(dagmc_point_in_vol_6); // point in centre
// rays fired at nodes
- result += RUN_TEST( dagmc_point_on_corner_1);
- result += RUN_TEST( dagmc_point_on_corner_2);
- result += RUN_TEST( dagmc_point_on_corner_3);
- result += RUN_TEST( dagmc_point_on_corner_4);
-
- // result += RUN_TEST( dagmc_point_in({0.0,0.0,5.0}); // point in centre
- // result += RUN_TEST( dagmc_point_in({0.0,0.0,-5.0}); // point in centre
- // result += RUN_TEST( dagmc_point_in({0.0,5.0,0.0}); // point in centre
- // result += RUN_TEST( dagmc_point_in({0.0,-5.0,0.0}); // point in centre
- // result += RUN_TEST( dagmc_point_in({5.0,0.0,0.0}); // point in centre
- // result += RUN_TEST( dagmc_point_in({-5.0,0.0,0.0}); // point in centre
+ result += RUN_TEST(dagmc_point_on_corner_1);
+ result += RUN_TEST(dagmc_point_on_corner_2);
+ result += RUN_TEST(dagmc_point_on_corner_3);
+ result += RUN_TEST(dagmc_point_on_corner_4);
+
+ //result += RUN_TEST(dagmc_point_in({0.0, 0.0, 5.0}); // point in centre
+ //result += RUN_TEST(dagmc_point_in({0.0, 0.0, -5.0}); // point in centre
+ //result += RUN_TEST(dagmc_point_in({0.0, 5.0, 0.0}); // point in centre
+ //result += RUN_TEST(dagmc_point_in({0.0, -5.0, 0.0}); // point in centre
+ //result += RUN_TEST(dagmc_point_in({5.0, 0.0, 0.0}); // point in centre
+ //result += RUN_TEST(dagmc_point_in({-5.0, 0.0, 0.0}); // point in centre
return result;
}
diff --git a/test/dagmc/dagmc_rayfire_test.cpp b/test/dagmc/dagmc_rayfire_test.cpp
index 57aa625..ba5f309 100644
--- a/test/dagmc/dagmc_rayfire_test.cpp
+++ b/test/dagmc/dagmc_rayfire_test.cpp
@@ -35,80 +35,80 @@ void dagmc_setup_test()
rval = DAG->init_OBBTree();
CHECK_ERR(rval);
+ /*
int num_vols = DAG->num_entities(3);
EntityHandle vol_h;
- for ( int i = 0 ; i < num_vols ; i++ )
- {
- vol_h = DAG->entity_by_index(3,i);
- }
+ for (int i = 0; i < num_vols; i++)
+ vol_h = DAG->entity_by_index(3, i);
+ */
// EntityHandle volume = 12682136550675316765;
- // CHECK_EQUAL(volume,vol);
+ // CHECK_EQUAL(volume, vol);
}
void dagmc_origin_face_rayfire()
{
int vol_idx = 1;
- EntityHandle vol_h = DAG->entity_by_index(3,vol_idx);
- double dir[3]={-1.0,0.0,0.0};
- double origin[3]={0.0,0.0,0.0};
+ EntityHandle vol_h = DAG->entity_by_index(3, vol_idx);
+ double dir[3] = {-1.0, 0.0, 0.0};
+ double origin[3] = {0.0, 0.0, 0.0};
double next_surf_dist;
EntityHandle next_surf;
- DAG->ray_fire(vol_h,origin,dir,next_surf,next_surf_dist);
- double expected_next_surf_dist=5.0;
- CHECK_REAL_EQUAL(expected_next_surf_dist,next_surf_dist,eps);
+ DAG->ray_fire(vol_h, origin, dir, next_surf, next_surf_dist);
+ double expected_next_surf_dist = 5.0;
+ CHECK_REAL_EQUAL(expected_next_surf_dist, next_surf_dist, eps);
}
void dagmc_outside_face_rayfire()
{
int vol_idx = 1;
- EntityHandle vol_h = DAG->entity_by_index(3,vol_idx);
- double dir[3]={1.0,0.0,0.0}; // ray along x direction
- double origin[3]={-10.0,0.0,0.0}; // origin at -10 0 0
+ EntityHandle vol_h = DAG->entity_by_index(3, vol_idx);
+ double dir[3] = {1.0, 0.0, 0.0}; // ray along x direction
+ double origin[3] = {-10.0, 0.0, 0.0}; // origin at -10 0 0
double next_surf_dist;
EntityHandle next_surf;
- DAG->ray_fire(vol_h,origin,dir,next_surf,next_surf_dist);
+ DAG->ray_fire(vol_h, origin, dir, next_surf, next_surf_dist);
std::cout << next_surf_dist << std::endl;
- double expected_next_surf_dist=15.0;
- CHECK_REAL_EQUAL(expected_next_surf_dist,next_surf_dist,eps);
+ double expected_next_surf_dist = 15.0;
+ CHECK_REAL_EQUAL(expected_next_surf_dist, next_surf_dist, eps);
}
void dagmc_outside_face_rayfire_orient_exit()
{
DagMC::RayHistory history;
int vol_idx = 1;
- EntityHandle vol_h = DAG->entity_by_index(3,vol_idx);
- double dir[3]={1.0,0.0,0.0}; // ray along x direction
- double origin[3]={-10.0,0.0,0.0}; // origin at -10 0 0
+ EntityHandle vol_h = DAG->entity_by_index(3, vol_idx);
+ double dir[3] = {1.0, 0.0, 0.0}; // ray along x direction
+ double origin[3] = {-10.0, 0.0, 0.0}; // origin at -10 0 0
double next_surf_dist;
EntityHandle next_surf;
- DAG->ray_fire(vol_h,origin,dir,next_surf,next_surf_dist,&history,0,1);
+ DAG->ray_fire(vol_h, origin, dir, next_surf, next_surf_dist, &history, 0, 1);
std::cout << next_surf_dist << std::endl;
- double expected_next_surf_dist=15.0;
- CHECK_REAL_EQUAL(expected_next_surf_dist,next_surf_dist,eps);
+ double expected_next_surf_dist = 15.0;
+ CHECK_REAL_EQUAL(expected_next_surf_dist, next_surf_dist, eps);
}
void dagmc_outside_face_rayfire_orient_entrance()
{
DagMC::RayHistory history;
int vol_idx = 1;
- EntityHandle vol_h = DAG->entity_by_index(3,vol_idx);
- double dir[3]={1.0,0.0,0.0}; // ray along x direction
- double origin[3]={-10.0,0.0,0.0}; // origin at -10 0 0
+ EntityHandle vol_h = DAG->entity_by_index(3, vol_idx);
+ double dir[3] = {1.0, 0.0, 0.0}; // ray along x direction
+ double origin[3] = {-10.0, 0.0, 0.0}; // origin at -10 0 0
double next_surf_dist;
EntityHandle next_surf;
- DAG->ray_fire(vol_h,origin,dir,next_surf,next_surf_dist,&history,0.0,-1);
+ DAG->ray_fire(vol_h, origin, dir, next_surf, next_surf_dist, &history, 0.0, -1);
std::cout << next_surf_dist << std::endl;
- double expected_next_surf_dist=5.0;
- CHECK_REAL_EQUAL(expected_next_surf_dist,next_surf_dist,eps);
+ double expected_next_surf_dist = 5.0;
+ CHECK_REAL_EQUAL(expected_next_surf_dist, next_surf_dist, eps);
}
void dagmc_outside_face_rayfire_history_fail()
{
DagMC::RayHistory history;
int vol_idx = 1;
- EntityHandle vol_h = DAG->entity_by_index(3,vol_idx);
- double dir[3]={1.0,0.0,0.0}; // ray along x direction
- double origin[3]={-10.0,0.0,0.0}; // origin at -10 0 0
+ EntityHandle vol_h = DAG->entity_by_index(3, vol_idx);
+ double dir[3] = {1.0, 0.0, 0.0}; // ray along x direction
+ double origin[3] = {-10.0, 0.0, 0.0}; // origin at -10 0 0
double xyz[3];
double next_surf_dist;
EntityHandle next_surf;
@@ -119,62 +119,60 @@ void dagmc_outside_face_rayfire_history_fail()
// needs two ray_fires to cross, this is expected and ok
// first ray fire with history
- DAG->ray_fire(vol_h,origin,dir,next_surf,next_surf_dist,&history,0,1);
+ DAG->ray_fire(vol_h, origin, dir, next_surf, next_surf_dist, &history, 0, 1);
// second ray fire with history
- DAG->ray_fire(vol_h,xyz,dir,next_surf,next_surf_dist,&history,0,1);
+ DAG->ray_fire(vol_h, xyz, dir, next_surf, next_surf_dist, &history, 0, 1);
// this fire should hit graveyard, i.e. next_surf = 0
- DAG->ray_fire(vol_h,xyz,dir,next_surf,next_surf_dist,&history,0,1);
+ DAG->ray_fire(vol_h, xyz, dir, next_surf, next_surf_dist, &history, 0, 1);
// using history with this geom, there should be no next surface, i.e. 0
EntityHandle ZERO = 0;
- CHECK_EQUAL(ZERO ,next_surf);
+ CHECK_EQUAL(ZERO, next_surf);
}
void dagmc_outside_face_rayfire_history()
{
DagMC::RayHistory history;
int vol_idx = 1;
- EntityHandle vol_h = DAG->entity_by_index(3,vol_idx);
- double dir[3]={1.0,0.0,0.0}; // ray along x direction
- double origin[3]={-10.0,0.0,0.0}; // origin at -10 0 0
+ EntityHandle vol_h = DAG->entity_by_index(3, vol_idx);
+ double dir[3] = {1.0, 0.0, 0.0}; // ray along x direction
+ double origin[3] = {-10.0, 0.0, 0.0}; // origin at -10 0 0
double xyz[3];
double next_surf_dist;
EntityHandle next_surf;
history.reset();
// first ray fire with history
- DAG->ray_fire(vol_h,origin,dir,next_surf,next_surf_dist,&history,0,1);
+ DAG->ray_fire(vol_h, origin, dir, next_surf, next_surf_dist, &history, 0, 1);
std::cout << next_surf << " " << history.size() << std::endl;
// second ray fire with history
- xyz[0]=origin[0]+(next_surf_dist*dir[0]);
- xyz[1]=origin[1]+(next_surf_dist*dir[1]);
- xyz[2]=origin[2]+(next_surf_dist*dir[2]);
+ xyz[0] = origin[0] + (next_surf_dist*dir[0]);
+ xyz[1] = origin[1] + (next_surf_dist*dir[1]);
+ xyz[2] = origin[2] + (next_surf_dist*dir[2]);
// ray fired execacyl
- DAG->ray_fire(vol_h,xyz,dir,next_surf,next_surf_dist,&history,0,1);
-
- DAG->ray_fire(vol_h,xyz,dir,next_surf,next_surf_dist,&history,0,1);
+ DAG->ray_fire(vol_h, xyz, dir, next_surf, next_surf_dist, &history, 0, 1);
+ DAG->ray_fire(vol_h, xyz, dir, next_surf, next_surf_dist, &history, 0, 1);
// using history with this geom, there should be no next surface, i.e. 0
EntityHandle ZERO = 0;
- CHECK_EQUAL(ZERO ,next_surf);
+ CHECK_EQUAL(ZERO, next_surf);
}
-
int main(int /* argc */, char** /* argv */)
{
int result = 0;
- result += RUN_TEST( dagmc_setup_test ); // setup problem
+ result += RUN_TEST(dagmc_setup_test); // setup problem
// rays fired along cardinal directions
- result += RUN_TEST( dagmc_origin_face_rayfire ); // point in centre
- result += RUN_TEST( dagmc_outside_face_rayfire );
- result += RUN_TEST( dagmc_outside_face_rayfire_orient_exit ); // fire ray from point outside volume looking for exit intersections
- result += RUN_TEST( dagmc_outside_face_rayfire_orient_entrance ); // fire ray from point outside volume looking for entrance intersection
- result += RUN_TEST( dagmc_outside_face_rayfire_history_fail ); // fire ray from point outside geometry using ray history
- result += RUN_TEST( dagmc_outside_face_rayfire_history ); // fire ray from point outside geometry using ray history
+ result += RUN_TEST(dagmc_origin_face_rayfire); // point in centre
+ result += RUN_TEST(dagmc_outside_face_rayfire);
+ result += RUN_TEST(dagmc_outside_face_rayfire_orient_exit); // fire ray from point outside volume looking for exit intersections
+ result += RUN_TEST(dagmc_outside_face_rayfire_orient_entrance); // fire ray from point outside volume looking for entrance intersection
+ result += RUN_TEST(dagmc_outside_face_rayfire_history_fail); // fire ray from point outside geometry using ray history
+ result += RUN_TEST(dagmc_outside_face_rayfire_history); // fire ray from point outside geometry using ray history
return result;
}
diff --git a/test/dagmc/dagmc_simple_test.cpp b/test/dagmc/dagmc_simple_test.cpp
index bf253f6..b2a44eb 100644
--- a/test/dagmc/dagmc_simple_test.cpp
+++ b/test/dagmc/dagmc_simple_test.cpp
@@ -26,7 +26,6 @@ static const char input_file[] = STRINGIFY(MESHDIR) "/dagmc/test_geom.h5m";
static const char input_file[] = STRINGIFY(MESHDIR) "/dagmc/test_geom.h5m";
#endif
-
void dagmc_load_file()
{
ErrorCode rval = DAG->load_file(input_file); // open the Dag file
@@ -41,97 +40,101 @@ void dagmc_build_obb()
void dagmc_num_vols()
{
- int expect_num_vols=2;
+ int expect_num_vols = 2;
int num_vols = DAG->num_entities(3);
- CHECK_EQUAL(expect_num_vols,num_vols);
+ CHECK_EQUAL(expect_num_vols, num_vols);
}
void dagmc_entity_handle()
{
- int num_vols = DAG->num_entities(3);
+ /*
+ int num_vols = DAG->num_entities(3);
EntityHandle vol_h;
- for ( int i = 0 ; i < num_vols ; i++ )
- {
- vol_h = DAG->entity_by_index(3,i);
- }
+ for (int i = 0; i < num_vols; i++)
+ vol_h = DAG->entity_by_index(3, i);
+ */
//EntityHandle expect_vol_h = 12682136550675316765;
- //CHECK_EQUAL(expect_vol_h,vol_h);
+ //CHECK_EQUAL(expect_vol_h, vol_h);
}
void dagmc_point_in()
{
int result = 0;
- int expect_result=1;
- int vol_idx=1;
- double xyz[3]={0.0,0.0,0.0};
- EntityHandle vol_h = DAG->entity_by_index(3,vol_idx);
- ErrorCode rval = DAG->point_in_volume(vol_h,xyz,result);
- CHECK_EQUAL(expect_result,result);
+ int expect_result = 1;
+ int vol_idx = 1;
+ double xyz[3] = {0.0, 0.0, 0.0};
+ EntityHandle vol_h = DAG->entity_by_index(3, vol_idx);
+ ErrorCode rval = DAG->point_in_volume(vol_h, xyz, result);
+ CHECK_ERR(rval);
+ CHECK_EQUAL(expect_result, result);
}
void dagmc_rayfire()
{
const double eps = 1e-6; // epsilon for test, faceting tol?
- int vol_idx=1;
+ int vol_idx = 1;
// note model is cube of side 10, centred at 0,0,0, so ray fire along
// any unit direction should be exactly 5.0
- double xyz[3]={0.0,0.0,0.0};
- double dir[3]={0.0,0.0,1.0};
+ double xyz[3] = {0.0, 0.0, 0.0};
+ double dir[3] = {0.0, 0.0, 1.0};
EntityHandle next_surf;
double next_surf_dist;
- double expect_next_surf_dist=5.0;
- EntityHandle vol_h = DAG->entity_by_index(3,vol_idx);
+ double expect_next_surf_dist = 5.0;
+ EntityHandle vol_h = DAG->entity_by_index(3, vol_idx);
- ErrorCode rval = DAG->ray_fire(vol_h,xyz,dir,next_surf,next_surf_dist);
- CHECK_REAL_EQUAL(expect_next_surf_dist,next_surf_dist,eps);
+ ErrorCode rval = DAG->ray_fire(vol_h, xyz, dir, next_surf, next_surf_dist);
+ CHECK_ERR(rval);
+ CHECK_REAL_EQUAL(expect_next_surf_dist, next_surf_dist, eps);
}
void dagmc_closest_to()
{
const double eps = 1e-6; // epsilon for test, faceting tol?
- int vol_idx=1;
+ int vol_idx = 1;
// note model is cube of side 10, centred at 0,0,0, so ray fire along
// any unit direction should be exactly 5.0
- double xyz[3]={-6.0,0.0,0.0};
+ double xyz[3] = {-6.0, 0.0, 0.0};
double distance; // distance from point to nearest surface
- double expect_distance=1.0;
- EntityHandle vol_h = DAG->entity_by_index(3,vol_idx);
+ double expect_distance = 1.0;
+ EntityHandle vol_h = DAG->entity_by_index(3, vol_idx);
- ErrorCode rval = DAG->closest_to_location(vol_h,xyz,distance);
+ ErrorCode rval = DAG->closest_to_location(vol_h, xyz, distance);
+ CHECK_ERR(rval);
// distance should be 1.0 cm
- CHECK_REAL_EQUAL(expect_distance,distance,eps);
+ CHECK_REAL_EQUAL(expect_distance, distance, eps);
}
void dagmc_test_boundary()
{
- int vol_idx=1;
- EntityHandle vol_h = DAG->entity_by_index(3,vol_idx);
- int surf_idx=1;
- EntityHandle surf_h = DAG->entity_by_index(2,surf_idx);
+ int vol_idx = 1;
+ EntityHandle vol_h = DAG->entity_by_index(3, vol_idx);
+ int surf_idx = 1;
+ EntityHandle surf_h = DAG->entity_by_index(2, surf_idx);
- double xyz[3]={0.0,0.0,5.0};
- double dir[3]={0.0,0.0,1.0};
+ double xyz[3] = {0.0, 0.0, 5.0};
+ double dir[3] = {0.0, 0.0, 1.0};
int result;
- int expect_result=0;
+ int expect_result = 0;
- ErrorCode rval = DAG->test_volume_boundary(vol_h,surf_h,xyz,dir,result);
+ ErrorCode rval = DAG->test_volume_boundary(vol_h, surf_h, xyz, dir, result);
+ CHECK_ERR(rval);
// check ray leaving volume
- CHECK_EQUAL(expect_result,result);
+ CHECK_EQUAL(expect_result, result);
}
int main(int /* argc */, char** /* argv */)
{
int result = 0;
- result += RUN_TEST( dagmc_load_file ); // test ray fire
- result += RUN_TEST( dagmc_build_obb ); // build the obb
- result += RUN_TEST( dagmc_num_vols ); // make sure the num of vols correct
- // result += RUN_TEST( dagmc_entity_handle); // check the entity handle correct
- result += RUN_TEST( dagmc_point_in); // check entity by point
- result += RUN_TEST( dagmc_rayfire ) ; // ensure ray fire distance is correct
- result += RUN_TEST( dagmc_closest_to ); // check the distance to surface nearest point
- result += RUN_TEST( dagmc_test_boundary ); // check particle entering leaving
+ result += RUN_TEST(dagmc_load_file); // test ray fire
+ result += RUN_TEST(dagmc_build_obb); // build the obb
+ result += RUN_TEST(dagmc_num_vols); // make sure the num of vols correct
+ // result += RUN_TEST(dagmc_entity_handle); // check the entity handle correct
+ result += RUN_TEST(dagmc_point_in); // check entity by point
+ result += RUN_TEST(dagmc_rayfire); // ensure ray fire distance is correct
+ result += RUN_TEST(dagmc_closest_to); // check the distance to surface nearest point
+ result += RUN_TEST(dagmc_test_boundary); // check particle entering leaving
return result;
}
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