[MOAB-dev] commit/MOAB: danwu: Merged master into ncwriter

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Mon Apr 28 12:45:52 CDT 2014


1 new commit in MOAB:

https://bitbucket.org/fathomteam/moab/commits/5ffa5b78d70f/
Changeset:   5ffa5b78d70f
Branch:      ncwriter
User:        danwu
Date:        2014-04-28 19:45:45
Summary:     Merged master into ncwriter
Affected #:  10 files

diff --git a/src/LocalDiscretization/SpectralQuad.cpp b/src/LocalDiscretization/SpectralQuad.cpp
index d7355e6..7b581cb 100644
--- a/src/LocalDiscretization/SpectralQuad.cpp
+++ b/src/LocalDiscretization/SpectralQuad.cpp
@@ -109,7 +109,10 @@ bool SpectralQuad::reverseEvalFcn(const double *posn, const double *verts, const
   double dist = opt_findpt_2(&_data, (const double **)_xyz, x_star, r, &c);
     // if it did not converge, get out with throw...
   if (dist > 0.9e+30)
-    throw Map::EvaluationError();
+  {
+    std::vector<CartVect> dummy;
+    throw Map::EvaluationError(CartVect(x_star), dummy);
+  }
     //c tells us if we landed inside the element or exactly on a face, edge, or node
     // also, dist shows the distance to the computed point.
     //copy parametric coords back

diff --git a/src/io/mhdf/include/mhdf.h b/src/io/mhdf/include/mhdf.h
index db36d63..b602bdf 100644
--- a/src/io/mhdf/include/mhdf.h
+++ b/src/io/mhdf/include/mhdf.h
@@ -67,7 +67,7 @@ extern "C" {
  * named \c max_id .  This attribute, if present, should contain the
  * value of the largest entity ID used internally to the file.  It can
  * be used to verify that the code reading the file is using an integer
- * type of sufficient size to accomodate the entity IDs.  
+ * type of sufficient size to accommodate the entity IDs.
  *
  * The \c tstt group contains four sub-groups, a datatype object, and a 
  * dataset object.  The four sub-groups are: \c nodes, \c elements,
@@ -101,12 +101,12 @@ extern "C" {
  *
  * The \c coordinates
  * DataSet contains the coordinates of all vertices in the mesh.
- * The DataSet should contain floating point values and have a dimenions 
+ * The DataSet should contain floating point values and have a dimensions
  * \f$ n \times d \f$, where \c n is the number of vertices and \c d
  * is the number of coordinate values for each vertex.
  *
- * The \c coodinates DataSet must have an integer attribute named \c start_id .
- * The vertices are then defined to have IDs begining with this value
+ * The \c coordinates DataSet must have an integer attribute named \c start_id .
+ * The vertices are then defined to have IDs beginning with this value
  * and increasing sequentially in the order that they are defined in the
  * \c coordinates table.
  *
@@ -128,7 +128,7 @@ extern "C" {
  * optional subgroup named \c tags.  The \c tags subgroup is described in the 
  * \ref Dense "section on dense tag storage". 
  *
- * The \c connectivty DataSet is an \f$ n \times m \f$ array of integer
+ * The \c connectivity DataSet is an \f$ n \times m \f$ array of integer
  * values.  The DataSet contains one row for each of the \c n contained
  * elements, where the connectivity of each element contains \c m IDs.  For
  * all element types supported by MOAB, with the exception of polyhedra,
@@ -146,14 +146,14 @@ extern "C" {
  * The \c sets group contains the definitions of any entity sets stored
  * in the file.  It contains 1 to 4 DataSets and the optional \c tags 
  * subgroup.  The \c contents, \c parents, and \c children data sets
- * are one dimensional arrays containing the concatenation of of the
+ * are one dimensional arrays containing the concatenation of the
  * corresponding lists for all of the sets represented in the file.
  *
  * The \c lists DataSet is a \f$ n \times 4 \f$ table, having one
  * row of four integer values for each set.  The first three values
  * for each set are the indices into the \c contents, \c children, 
  * and \c parents DataSets, respectively, at which the \em last value
- * for the set is stored.  The contents, child, and parent lists for
+ * for set is stored.  The contents, child, and parent lists for
  * sets are stored in the corresponding datasets in the same order as
  * the sets are listed in the \c lists DataSet, such that the index of
  * the first value in one of those tables is one greater than the 
@@ -168,7 +168,7 @@ extern "C" {
  * stored at position 0 of the \c parents DataSet and the second at position
  * 1.
  *
- * The fourth colum of the \c lists DataSet is a series of bit flags
+ * The fourth column of the \c lists DataSet is a series of bit flags
  * defining some properties of the sets.  The four bit values currently
  * defined are:
  *  - 0x1 owner
@@ -180,7 +180,7 @@ extern "C" {
  * data set, that the contents list for the corresponding set is stored
  * using a single range compression.  Rather than storing the IDs of the
  * contained entities individually, each ID \c i is followed by a count 
- * \c n indicating that the set contains the cotiguous range of IDs
+ * \c n indicating that the set contains the contiguous range of IDs
  * \f$ [i, i+n-1] \f$.
  *
  * The three least significant bits specify intended properties of the
@@ -208,16 +208,16 @@ extern "C" {
  * may also be stored in the "dense" format as described in the 
  * \ref Dense "section on dense tag storage".
  *
- * Each sub-group of the \c tags group contains the defintion for
+ * Each sub-group of the \c tags group contains the definition for
  * a single tag.  The name of each sub-group is the name of the 
  * corresponding tag.  Non-printable characters, characters
  * prohibited in group names in the HDF5 file format, and the
  * backslash ('\') character are encoded
  * in the name string by a backslash ('\') character followed by
- * the ASCII value of the character expressed as a pair of hexidecimal
+ * the ASCII value of the character expressed as a pair of hexadecimal
  * digits.  Thus the backslash character would be represented as \c \5C .
  * Each tag group should also contain a comment which contains the
- * unenconded tag name.
+ * unencoded tag name.
  *
  * The tag sub-group may have any or all of the following four attributes:
  * \c default, \c global, \c is_handle, and \c variable_length.  

diff --git a/src/moab/BoundBox.hpp b/src/moab/BoundBox.hpp
index c74707a..3f1f07f 100644
--- a/src/moab/BoundBox.hpp
+++ b/src/moab/BoundBox.hpp
@@ -14,6 +14,15 @@ namespace moab {
       BoundBox(const CartVect &min, const CartVect &max) : 
               bMin(min), bMax(max) {}
       BoundBox(const double *corners);
+      // constructor used in element maps
+      BoundBox(std::vector<CartVect> points): bMin(DBL_MAX), bMax(-DBL_MAX)
+      {
+        for (size_t i=0; i<points.size(); i++)
+        {
+          update_min( points[i].array() );
+          update_max( points[i].array() );
+        }
+      }
       ~BoundBox() {}
 
       bool contains_point(const double *point, const double tol = 0.0) const;

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;
 }

diff --git a/tools/mbcoupler/Coupler.cpp b/tools/mbcoupler/Coupler.cpp
index afee8af..fbfd8fb 100644
--- a/tools/mbcoupler/Coupler.cpp
+++ b/tools/mbcoupler/Coupler.cpp
@@ -446,7 +446,12 @@ ErrorCode Coupler::locate_points(double *xyz, int num_points,
   for (int i = 0; i < num_points; i++) 
   {
     if (tl_tmp->vi_rd[3*i+1] == -1)
+    {
       missing_pts++;
+#ifndef NDEBUG
+      printf(" %f %f %f\n", xyz[3*i], xyz[3*i+1], xyz[3*i+2] );
+#endif
+    }
     else
       if (tl_tmp->vi_rd[3*i]==(int)my_rank)
         local_pts++;
@@ -668,7 +673,11 @@ ErrorCode Coupler::nat_param(double xyz[3],
   if (epsilon) {
     std::vector<double> dists;
     std::vector<EntityHandle> leaves;
-    result = myTree->distance_search(xyz, epsilon, leaves, 1.0e-10, 1.0e-6, &dists, NULL, &localRoot);
+    // two tolerances
+    result = myTree->distance_search(xyz, epsilon, leaves,
+        /*iter_tol*/  epsilon,
+        /*inside_tol*/ 10*epsilon,
+        &dists, NULL, &localRoot);
     if (leaves.empty()) 
       // not found returns success here, with empty list, just like case with no epsilon
       return MB_SUCCESS;
@@ -758,38 +767,53 @@ ErrorCode Coupler::nat_param(double xyz[3],
         std::cout << "Problems getting coordinates of vertices\n";
         return result;
       }
-
+      CartVect  pos(xyz);
       if (etype == MBHEX) {
         if (8==num_connect)
         {
           Element::LinearHex hexmap(coords_vert);
-          tmp_nat_coords = hexmap.ievaluate(CartVect(xyz), epsilon);
-          bool inside = hexmap.inside_nat_space(tmp_nat_coords, epsilon);
-          if (!inside)
+          if (!hexmap.inside_box( pos, epsilon))
+            continue;
+          try {
+            tmp_nat_coords = hexmap.ievaluate(pos, epsilon);
+            bool inside = hexmap.inside_nat_space(tmp_nat_coords, epsilon);
+            if (!inside) continue;
+          }
+          catch (Element::Map::EvaluationError) {
             continue;
+          }
         }
         else if (27==num_connect)
         {
           Element::QuadraticHex hexmap(coords_vert);
-          tmp_nat_coords = hexmap.ievaluate(CartVect(xyz), epsilon);
-          bool inside = hexmap.inside_nat_space(tmp_nat_coords, epsilon);
-          if (!inside)
-            continue;
+         if (!hexmap.inside_box( pos, epsilon))
+           continue;
+         try {
+           tmp_nat_coords = hexmap.ievaluate(pos, epsilon);
+           bool inside = hexmap.inside_nat_space(tmp_nat_coords, epsilon);
+           if (!inside) continue;
+         }
+         catch (Element::Map::EvaluationError) {
+           continue;
+         }
         }
         else // TODO this case not treated yet, no interpolation
           continue;
       }
       else if (etype == MBTET){
         Element::LinearTet tetmap(coords_vert);
-        tmp_nat_coords = tetmap.ievaluate(CartVect(xyz));
+        // this is just a linear solve; unless degenerate, will not except
+        tmp_nat_coords = tetmap.ievaluate(pos);
         bool inside = tetmap.inside_nat_space(tmp_nat_coords, epsilon);
         if (!inside)
           continue;
       }
       else if (etype == MBQUAD){
         Element::LinearQuad quadmap(coords_vert);
+        if (!quadmap.inside_box( pos, epsilon))
+          continue;
         try {
-          tmp_nat_coords = quadmap.ievaluate(CartVect(xyz), epsilon);
+          tmp_nat_coords = quadmap.ievaluate(pos, epsilon);
           bool inside = quadmap.inside_nat_space(tmp_nat_coords, epsilon);
           if (!inside) continue;
         }

diff --git a/tools/mbcoupler/ElemUtil.cpp b/tools/mbcoupler/ElemUtil.cpp
index cfc36e0..ee338c0 100644
--- a/tools/mbcoupler/ElemUtil.cpp
+++ b/tools/mbcoupler/ElemUtil.cpp
@@ -3,6 +3,7 @@
 #include <assert.h>
 
 #include "ElemUtil.hpp"
+#include "moab/BoundBox.hpp"
 
 namespace moab {
 namespace ElemUtil {
@@ -433,6 +434,15 @@ namespace Element {
         this->vertex = v;
       }
 
+  bool Map::inside_box(const CartVect & xi, double & tol) const
+  {
+    // bail out early, before doing an expensive NR iteration
+    // compute box
+    BoundBox box(this->vertex);
+    return box.contains_point(xi.array(), tol);
+
+  }
+
   //
   CartVect Map::ievaluate(const CartVect& x, double tol, const CartVect& x0) const {
     // TODO: should differentiate between epsilons used for
@@ -448,12 +458,12 @@ namespace Element {
     int iters=0;
     while (delta % delta > error_tol_sqr) {
       if(++iters>10)
-        throw Map::EvaluationError();
+        throw Map::EvaluationError(x, vertex);
 
       J = jacobian(xi);
       det = J.determinant();
       if (det < std::numeric_limits<double>::epsilon())
-        throw Map::EvaluationError();
+        throw Map::EvaluationError(x, vertex);
       xi -= J.inverse(1.0/det) * delta;
       delta = evaluate( xi ) - x;
     }
@@ -896,7 +906,10 @@ namespace Element {
     real dist = opt_findpt_3(&_data, (const real **)_xyz, x_star, r, &c);
     // if it did not converge, get out with throw...
     if (dist > 0.9e+30)
-      throw Map::EvaluationError();
+    {
+      std::vector<CartVect> dummy;
+      throw Map::EvaluationError(xyz, dummy);
+    }
     //c tells us if we landed inside the element or exactly on a face, edge, or node
     // also, dist shows the distance to the computed point.
     //copy parametric coords back
@@ -1184,7 +1197,11 @@ namespace Element {
     real dist = opt_findpt_2(&_data, (const real **)_xyz, x_star, r, &c);
     // if it did not converge, get out with throw...
     if (dist > 0.9e+30)
-      throw Map::EvaluationError();
+    {
+      std::vector<CartVect> dummy;
+      throw Map::EvaluationError(xyz, dummy);
+    }
+
     //c tells us if we landed inside the element or exactly on a face, edge, or node
     // also, dist shows the distance to the computed point.
     //copy parametric coords back

diff --git a/tools/mbcoupler/ElemUtil.hpp b/tools/mbcoupler/ElemUtil.hpp
index 219323b..b2a743a 100644
--- a/tools/mbcoupler/ElemUtil.hpp
+++ b/tools/mbcoupler/ElemUtil.hpp
@@ -103,10 +103,22 @@ namespace ElemUtil {
       /**\brief Set vertices.      */
       virtual void set_vertices(const std::vector<CartVect>& v);
 
+      // will look at the box formed by vertex coordinates, and before doing any NR, bail out if necessary
+      virtual bool inside_box(const CartVect & xi, double & tol) const;
+
       /* Exception thrown when an evaluation fails (e.g., ievaluate fails to converge). */
       class EvaluationError {
       public:
-        EvaluationError(){};
+        EvaluationError(const CartVect & x, const std::vector<CartVect> & verts): p(x), vertices(verts){
+#ifndef NDEBUG
+          std::cout << "p:" << p << "\n vertices.size() " <<vertices.size() << "\n";
+          for (size_t i=0; i<vertices.size(); i++)
+            std::cout << vertices[i] << "\n";
+#endif
+        };
+      private:
+        CartVect p;
+        std::vector<CartVect> vertices;
       };// class EvaluationError
 
       /* Exception thrown when a bad argument is encountered. */

diff --git a/tools/mbcoupler/ElementTest.cpp b/tools/mbcoupler/ElementTest.cpp
index 4f37602..ca6e9e2 100644
--- a/tools/mbcoupler/ElementTest.cpp
+++ b/tools/mbcoupler/ElementTest.cpp
@@ -24,7 +24,58 @@ void test_tet() {
 }// test_tet()
 
 void test_hex() {
-  moab::Element::LinearHex hex;
+  double positions[] =
+  {
+      236.80706050970281, -139.55422526228017, 193.27999999999997,
+      236.47511729348639, -141.33020962638582, 193.27999999999997,
+      237.8457938295229, -142.57076074835663, 193.27999999999997,
+      239.12702305519684, -139.96608933577852, 193.27999999999997,
+      236.80841321361444, -139.55341321335499, 202.654,
+      236.47655014713746, -141.32980272396816, 202.654,
+      237.8477913707564, -142.57047282187165, 202.654,
+      239.12865103844533, -139.96531051891105, 202.654
+  };
+  CartVect x(235.96518686964933, -142.43503000077749, 188.19999999999987);
+  std::vector<CartVect> vertices;
+  for (int i=0; i<8; i++)
+    vertices.push_back(CartVect(positions+3*i));
+
+  moab::Element::LinearHex hex(vertices);
+  double tol(0.0001);
+  if (hex.inside_box(x, tol))
+  {
+   CartVect nat_par = hex.ievaluate(x, 0.0001);
+   std::cout <<nat_par <<"\n";
+  }
+
+  double positions2[] =
+    {   49.890500000000024, -20.376134375374882, 312.72000000000003,
+        52.015875000000044, -19.149048546996006, 312.72000000000003,
+        48.430375821458099, -18.548796774572125, 312.72000000000003,
+        47.717616239031223, -21.191360829777231, 312.72000000000003,
+        49.890500000000024, -20.376134375374882, 322.88,
+        52.015875000000044, -19.149048546996006, 322.88,
+        48.429930354643275, -18.52828610485021, 322.88,
+        47.720552036968819, -21.167591146685712, 322.88};
+
+  CartVect x2(51.469000000000015, -20.145482942833631, 317.80000000000001);
+
+  vertices.clear();
+  for (int i=0; i<8; i++)
+    vertices.push_back(CartVect(positions2+3*i));
+  moab::Element::LinearHex hex2(vertices);
+  if (hex2.inside_box(x2, tol))
+  {
+    try {
+      CartVect nat_par = hex.ievaluate(x, 0.0001);
+      std::cout <<nat_par <<"\n";
+  }
+  catch (Element::Map::EvaluationError) {
+    // nothing
+  }
+}
+
+
 }// test_hex()
 #include "moab/Core.hpp"
 #include "moab/Range.hpp"

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