[MOAB-dev] commit/MOAB: danwu: Merged master into error_handling_enhancement
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Thu Feb 13 13:53:16 CST 2014
1 new commit in MOAB:
https://bitbucket.org/fathomteam/moab/commits/01f401fcd57c/
Changeset: 01f401fcd57c
Branch: error_handling_enhancement
User: danwu
Date: 2014-02-13 20:53:11
Summary: Merged master into error_handling_enhancement
Affected #: 45 files
diff --git a/.gitignore b/.gitignore
index f909fa9..e60d5d8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -170,6 +170,7 @@ test/lloyd_smoother_test
test/mbcn_test
test/mbfacet_test
test/mbground_test
+test/mergemesh_test
test/mesh_set_test
test/moab_test
test/obb/obb_test
@@ -188,6 +189,7 @@ test/parallel/parallel_unit_tests
test/parallel/parallel_write_test
test/parallel/par_coupler_test
test/parallel/par_intx_sph
+test/parallel/par_spatial_locator_test
test/parallel/parmerge
test/parallel/partcheck
test/parallel/pcomm_serial
@@ -208,6 +210,8 @@ test/perf/seqperf
test/perf/tstt_perf_binding
test/perf/point_location/elem_eval_time
test/perf/point_location/point_location
+test/perf/point_location/sploc_searching_perf
+test/perf/point_location/tree_searching_perf
test/range_test
test/reorder_test
test/scdseq_test
@@ -243,6 +247,11 @@ tools/mbcslam/lagr.h5m
tools/mbcslam/spectral.vtk
tools/mbcslam/spec_visu_test
tools/mbcslam/spherical_area_test
+tools/mbcslam/cslam_par_test
+tools/mbcslam/create_dp
+tools/mbcslam/diffusion
+tools/mbcslam/intx_imesh
+tools/mbcslam/proj1
tools/mbdepth
tools/mbgsets
tools/mbmem
diff --git a/itaps/imesh/MOAB_iMeshP_unit_tests.cpp b/itaps/imesh/MOAB_iMeshP_unit_tests.cpp
index 96d659d..bc3d8e4 100644
--- a/itaps/imesh/MOAB_iMeshP_unit_tests.cpp
+++ b/itaps/imesh/MOAB_iMeshP_unit_tests.cpp
@@ -548,11 +548,11 @@ int create_mesh( const char* filename, int num_parts )
// create vertices
int vl_pos = 0;
for (int i = 0; i <= num_cols; ++i) {
- double coords[15] = { i, 0, 0,
- i, 1, 0,
- i, 2, 0,
- i, 3, 0,
- i, 4, 0 };
+ double coords[15] = { static_cast<double>(i), 0, 0,
+ static_cast<double>(i), 1, 0,
+ static_cast<double>(i), 2, 0,
+ static_cast<double>(i), 3, 0,
+ static_cast<double>(i), 4, 0 };
iBase_EntityHandle* ptr = vertices[i];
const int n = (num_full_cols == num_cols || i <= num_full_cols) ? 5 : 3;
int junk1 = n, junk2 = n;
diff --git a/src/BVHTree.cpp b/src/BVHTree.cpp
index b65eae4..d54e24d 100644
--- a/src/BVHTree.cpp
+++ b/src/BVHTree.cpp
@@ -443,7 +443,7 @@ namespace moab
const TreeNode &node = myTree[index];
treeStats.nodesVisited++;
CartVect params;
- bool is_inside;
+ int is_inside;
ErrorCode rval = MB_SUCCESS;
if(node.dim == 3){
treeStats.leavesVisited++;
diff --git a/src/LocalDiscretization/ElemEvaluator.cpp b/src/LocalDiscretization/ElemEvaluator.cpp
index 4ca3943..209cd11 100644
--- a/src/LocalDiscretization/ElemEvaluator.cpp
+++ b/src/LocalDiscretization/ElemEvaluator.cpp
@@ -18,7 +18,7 @@ namespace moab {
ErrorCode EvalSet::evaluate_reverse(EvalFcn eval, JacobianFcn jacob, InsideFcn inside_f,
const double *posn, const double *verts, const int nverts,
const int ndim, const double iter_tol, const double inside_tol,
- double *work, double *params, bool *inside) {
+ double *work, double *params, int *inside) {
// TODO: should differentiate between epsilons used for
// Newton Raphson iteration, and epsilons used for curved boundary geometry errors
// right now, fix the tolerance used for NR
@@ -39,7 +39,7 @@ namespace moab {
// residual is diff between old and new pos; need to minimize that
CartVect res = new_pos - *cvposn;
Matrix3 J;
- bool dum, *tmp_inside = (inside ? inside : &dum);
+ int dum, *tmp_inside = (inside ? inside : &dum);
int iters=0;
// while |res| larger than tol
@@ -77,7 +77,7 @@ namespace moab {
return MB_SUCCESS;
}// Map::evaluate_reverse()
- bool EvalSet::inside_function(const double *params, const int ndims, const double tol)
+ int EvalSet::inside_function(const double *params, const int ndims, const double tol)
{
if (params[0] >= -1-tol && params[0] <= 1+tol &&
(ndims < 2 || (params[1] >= -1-tol && params[1] <= 1+tol)) &&
@@ -118,7 +118,7 @@ namespace moab {
const double inside_tol, EntityHandle &containing_ent,
double *params, unsigned int *num_evals)
{
- bool is_inside;
+ int is_inside;
ErrorCode rval = MB_SUCCESS;
unsigned int nevals = 0;
Range::iterator i;
diff --git a/src/LocalDiscretization/LinearHex.cpp b/src/LocalDiscretization/LinearHex.cpp
index 5e730af..e9044a8 100644
--- a/src/LocalDiscretization/LinearHex.cpp
+++ b/src/LocalDiscretization/LinearHex.cpp
@@ -97,14 +97,14 @@ namespace moab
ErrorCode LinearHex::reverseEvalFcn(EvalFcn eval, JacobianFcn jacob, InsideFcn ins,
const double *posn, const double *verts, const int nverts, const int ndim,
const double iter_tol, const double inside_tol, double *work,
- double *params, bool *is_inside)
+ double *params, int *is_inside)
{
assert(posn && verts);
return EvalSet::evaluate_reverse(eval, jacob, ins, posn, verts, nverts, ndim, iter_tol, inside_tol, work,
params, is_inside);
}
- bool LinearHex::insideFcn(const double *params, const int ndim, const double tol)
+ int LinearHex::insideFcn(const double *params, const int ndim, const double tol)
{
return EvalSet::inside_function(params, ndim, tol);
}
diff --git a/src/LocalDiscretization/LinearQuad.cpp b/src/LocalDiscretization/LinearQuad.cpp
index 63c9959..667bf0b 100644
--- a/src/LocalDiscretization/LinearQuad.cpp
+++ b/src/LocalDiscretization/LinearQuad.cpp
@@ -76,13 +76,13 @@ namespace moab
ErrorCode LinearQuad::reverseEvalFcn(EvalFcn eval, JacobianFcn jacob, InsideFcn ins,
const double *posn, const double *verts, const int nverts, const int ndim,
const double iter_tol, const double inside_tol, double *work,
- double *params, bool *is_inside)
+ double *params, int *is_inside)
{
return EvalSet::evaluate_reverse(eval, jacob, ins, posn, verts, nverts, ndim, iter_tol, inside_tol, work,
params, is_inside);
}
- bool LinearQuad::insideFcn(const double *params, const int ndim, const double tol)
+ int LinearQuad::insideFcn(const double *params, const int ndim, const double tol)
{
return EvalSet::inside_function(params, ndim, tol);
}
diff --git a/src/LocalDiscretization/LinearTet.cpp b/src/LocalDiscretization/LinearTet.cpp
index 4965cfc..6d590e7 100644
--- a/src/LocalDiscretization/LinearTet.cpp
+++ b/src/LocalDiscretization/LinearTet.cpp
@@ -75,14 +75,14 @@ namespace moab
ErrorCode LinearTet::reverseEvalFcn(EvalFcn eval, JacobianFcn jacob, InsideFcn ins,
const double *posn, const double *verts, const int nverts, const int ndim,
const double iter_tol, const double inside_tol, double *work,
- double *params, bool *is_inside)
+ double *params, int *is_inside)
{
assert(posn && verts);
return evaluate_reverse(eval, jacob, ins, posn, verts, nverts, ndim, iter_tol, inside_tol,
work, params, is_inside);
}
- bool LinearTet::insideFcn(const double *params, const int , const double tol)
+ int LinearTet::insideFcn(const double *params, const int , const double tol)
{
return (params[0] >= -1.0-tol && params[1] >= -1.0-tol && params[2] >= -1.0-tol &&
params[0] + params[1] + params[2] <= 1.0+tol);
@@ -92,7 +92,7 @@ namespace moab
ErrorCode LinearTet::evaluate_reverse(EvalFcn eval, JacobianFcn jacob, InsideFcn inside_f,
const double *posn, const double *verts, const int nverts,
const int ndim, const double iter_tol, const double inside_tol,
- double *work, double *params, bool *inside) {
+ double *work, double *params, int *inside) {
// TODO: should differentiate between epsilons used for
// Newton Raphson iteration, and epsilons used for curved boundary geometry errors
// right now, fix the tolerance used for NR
diff --git a/src/LocalDiscretization/LinearTri.cpp b/src/LocalDiscretization/LinearTri.cpp
index 8fe9d23..e6f7f1c 100644
--- a/src/LocalDiscretization/LinearTri.cpp
+++ b/src/LocalDiscretization/LinearTri.cpp
@@ -72,14 +72,14 @@ namespace moab
ErrorCode LinearTri::reverseEvalFcn(EvalFcn eval, JacobianFcn jacob, InsideFcn ins,
const double *posn, const double *verts, const int nverts, const int ndim,
const double iter_tol, const double inside_tol, double *work,
- double *params, bool *is_inside)
+ double *params, int *is_inside)
{
assert(posn && verts);
return evaluate_reverse(eval, jacob, ins, posn, verts, nverts, ndim, iter_tol, inside_tol, work,
params, is_inside);
}
- bool LinearTri::insideFcn(const double *params, const int , const double tol)
+ int LinearTri::insideFcn(const double *params, const int , const double tol)
{
return (params[0] >= -1.0-tol && params[1] >= -1.0-tol &&
params[0] + params[1] <= 1.0+tol);
@@ -89,7 +89,7 @@ namespace moab
ErrorCode LinearTri::evaluate_reverse(EvalFcn eval, JacobianFcn jacob, InsideFcn inside_f,
const double *posn, const double *verts, const int nverts,
const int ndim, const double iter_tol, const double inside_tol,
- double *work, double *params, bool *inside) {
+ double *work, double *params, int *inside) {
// TODO: should differentiate between epsilons used for
// Newton Raphson iteration, and epsilons used for curved boundary geometry errors
// right now, fix the tolerance used for NR
diff --git a/src/LocalDiscretization/QuadraticHex.cpp b/src/LocalDiscretization/QuadraticHex.cpp
index 5c621f6..e8d2ad2 100644
--- a/src/LocalDiscretization/QuadraticHex.cpp
+++ b/src/LocalDiscretization/QuadraticHex.cpp
@@ -108,14 +108,14 @@ namespace moab
ErrorCode QuadraticHex::reverseEvalFcn(EvalFcn eval, JacobianFcn jacob, InsideFcn ins,
const double *posn, const double *verts, const int nverts, const int ndim,
const double iter_tol, const double inside_tol, double *work,
- double *params, bool *is_inside)
+ double *params, int *is_inside)
{
assert(posn && verts);
return EvalSet::evaluate_reverse(eval, jacob, ins, posn, verts, nverts, ndim, iter_tol, inside_tol,
work, params, is_inside);
}
- bool QuadraticHex::insideFcn(const double *params, const int ndim, const double tol)
+ int QuadraticHex::insideFcn(const double *params, const int ndim, const double tol)
{
return EvalSet::inside_function(params, ndim, tol);
}
diff --git a/src/LocalDiscretization/SpectralHex.cpp b/src/LocalDiscretization/SpectralHex.cpp
index 31f5391..be383fa 100644
--- a/src/LocalDiscretization/SpectralHex.cpp
+++ b/src/LocalDiscretization/SpectralHex.cpp
@@ -180,7 +180,7 @@ void SpectralHex::integrate_vector(const double *field_values, int num_tuples, d
//std::cout << "volume: " << volume << "\n";
}
- bool SpectralHex::insideFcn(const double *params, const int ndim, const double tol)
+ int SpectralHex::insideFcn(const double *params, const int ndim, const double tol)
{
return EvalSet::inside(params, ndim, tol);
}
diff --git a/src/LocalDiscretization/SpectralQuad.cpp b/src/LocalDiscretization/SpectralQuad.cpp
index 5c11d13..d7355e6 100644
--- a/src/LocalDiscretization/SpectralQuad.cpp
+++ b/src/LocalDiscretization/SpectralQuad.cpp
@@ -96,7 +96,7 @@ CartVect SpectralQuad::evalFcn(const double *params, const double *field, const
// replicate the functionality of hex_findpt
bool SpectralQuad::reverseEvalFcn(const double *posn, const double *verts, const int nverts, const int ndim,
const double iter_tol, const double inside_tol, double *work,
- double *params, bool *is_inside)
+ double *params, int *is_inside)
{
params = init;
@@ -147,10 +147,10 @@ void SpectralQuad:: integrate_vector(const double *field, const double *verts, c
// not implemented
}
- bool SpectralQuad::insideFcn(const double *params, const int ndim, const double tol)
- {
- return EvalSet::inside(params, ndim, tol);
- }
+int SpectralQuad::insideFcn(const double *params, const int ndim, const double tol)
+{
+ return EvalSet::inside(params, ndim, tol);
+}
// something we don't do for spectral hex; we do it here because
// we do not store the position of gl points in a tag yet
diff --git a/src/LocalDiscretization/moab/ElemEvaluator.hpp b/src/LocalDiscretization/moab/ElemEvaluator.hpp
index 29d1051..866388c 100644
--- a/src/LocalDiscretization/moab/ElemEvaluator.hpp
+++ b/src/LocalDiscretization/moab/ElemEvaluator.hpp
@@ -21,12 +21,12 @@ namespace moab {
typedef ErrorCode (*InitFcn)(const double *verts, const int nverts, double *&work);
- typedef bool (*InsideFcn)(const double *verts, const int ndims, const double tol);
+ typedef int (*InsideFcn)(const double *verts, const int ndims, const double tol);
typedef ErrorCode (*ReverseEvalFcn)(EvalFcn eval, JacobianFcn jacob, InsideFcn ins,
const double *posn, const double *verts, const int nverts, const int ndim,
const double iter_tol, const double inside_tol,
- double *work, double *params, bool *is_inside);
+ double *work, double *params, int *is_inside);
class EvalSet
{
@@ -78,9 +78,9 @@ namespace moab {
static ErrorCode evaluate_reverse(EvalFcn eval, JacobianFcn jacob, InsideFcn inside_f,
const double *posn, const double *verts, const int nverts,
const int ndim, const double iter_tol, const double inside_tol,
- double *work, double *params, bool *inside);
+ double *work, double *params, int *inside);
/** \brief Common function that returns true if params is in [-1,1]^ndims */
- static bool inside_function(const double *params, const int ndims, const double tol);
+ static int inside_function(const double *params, const int ndims, const double tol);
};
/** \brief Given an entity handle, get an appropriate eval set, based on type & #vertices */
@@ -141,7 +141,7 @@ namespace moab {
* (in most cases, within [-1]*(dim)
*/
ErrorCode reverse_eval(const double *posn, double iter_tol, double inside_tol, double *params,
- bool *is_inside = NULL) const;
+ int *is_inside = NULL) const;
/** \brief Evaluate the jacobian of the cached entity at a given parametric location
* \param params Parameters at which to evaluate jacobian
@@ -158,7 +158,7 @@ namespace moab {
* \param params Parameters at which to query the element
* \param tol Tolerance, usually 10^-6 or so
*/
- bool inside(const double *params, const double tol) const;
+ int inside(const double *params, const double tol) const;
/** \brief Given a list of entities, return the entity the point is in, or none
* This function reverse-evaluates the entities, returning the first entity containing the point.
@@ -451,7 +451,7 @@ namespace moab {
}
inline ErrorCode ElemEvaluator::reverse_eval(const double *posn, const double iter_tol, const double inside_tol,
- double *params, bool *ins) const
+ double *params, int *ins) const
{
assert(entHandle && MBMAXTYPE != entType);
return (*evalSets[entType].reverseEvalFcn)(evalSets[entType].evalFcn, evalSets[entType].jacobianFcn, evalSets[entType].insideFcn,
@@ -493,7 +493,7 @@ namespace moab {
else return find_containing_entity(entities, point, iter_tol, inside_tol, containing_ent, params, num_evals);
}
- inline bool ElemEvaluator::inside(const double *params, const double tol) const
+ inline int ElemEvaluator::inside(const double *params, const double tol) const
{
return (*evalSets[entType].insideFcn)(params, entDim, tol);
}
diff --git a/src/LocalDiscretization/moab/LinearHex.hpp b/src/LocalDiscretization/moab/LinearHex.hpp
index 03ed33f..32d62f8 100644
--- a/src/LocalDiscretization/moab/LinearHex.hpp
+++ b/src/LocalDiscretization/moab/LinearHex.hpp
@@ -18,7 +18,7 @@ public:
static ErrorCode reverseEvalFcn(EvalFcn eval, JacobianFcn jacob, InsideFcn ins,
const double *posn, const double *verts, const int nverts, const int ndim,
const double iter_tol, const double inside_tol, double *work,
- double *params, bool *is_inside);
+ double *params, int *is_inside);
/** \brief Evaluate the jacobian at a specified parametric position */
static ErrorCode jacobianFcn(const double *params, const double *verts, const int nverts, const int ndim,
@@ -29,7 +29,7 @@ public:
double *work, double *result);
/** \brief Function that returns whether or not the parameters are inside the natural space of the element */
- static bool insideFcn(const double *params, const int ndim, const double tol);
+ static int insideFcn(const double *params, const int ndim, const double tol);
static EvalSet eval_set()
{
diff --git a/src/LocalDiscretization/moab/LinearQuad.hpp b/src/LocalDiscretization/moab/LinearQuad.hpp
index 2eb3027..897e3b4 100644
--- a/src/LocalDiscretization/moab/LinearQuad.hpp
+++ b/src/LocalDiscretization/moab/LinearQuad.hpp
@@ -18,7 +18,7 @@ public:
static ErrorCode reverseEvalFcn(EvalFcn eval, JacobianFcn jacob, InsideFcn ins,
const double *posn, const double *verts, const int nverts, const int ndim,
const double iter_tol, const double inside_tol, double *work,
- double *params, bool *is_inside);
+ double *params, int *is_inside);
/** \brief Evaluate the jacobian at a specified parametric position */
static ErrorCode jacobianFcn(const double *params, const double *verts, const int nverts, const int ndim,
@@ -29,7 +29,7 @@ public:
double *work, double *result);
/** \brief Function that returns whether or not the parameters are inside the natural space of the element */
- static bool insideFcn(const double *params, const int ndim, const double tol);
+ static int insideFcn(const double *params, const int ndim, const double tol);
static EvalSet eval_set()
{
diff --git a/src/LocalDiscretization/moab/LinearTet.hpp b/src/LocalDiscretization/moab/LinearTet.hpp
index f621b2f..713192a 100644
--- a/src/LocalDiscretization/moab/LinearTet.hpp
+++ b/src/LocalDiscretization/moab/LinearTet.hpp
@@ -18,7 +18,7 @@ public:
static ErrorCode reverseEvalFcn(EvalFcn eval, JacobianFcn jacob, InsideFcn ins,
const double *posn, const double *verts, const int nverts, const int ndim,
const double iter_tol, const double inside_tol, double *work,
- double *params, bool *is_inside);
+ double *params, int *is_inside);
/** \brief Evaluate the jacobian at a specified parametric position */
static ErrorCode jacobianFcn(const double *params, const double *verts, const int nverts, const int ndim,
@@ -32,12 +32,12 @@ public:
static ErrorCode initFcn(const double *verts, const int nverts, double *&work);
/** \brief Function that returns whether or not the parameters are inside the natural space of the element */
- static bool insideFcn(const double *params, const int ndim, const double tol);
+ static int insideFcn(const double *params, const int ndim, const double tol);
static ErrorCode evaluate_reverse(EvalFcn eval, JacobianFcn jacob, InsideFcn inside_f,
const double *posn, const double *verts, const int nverts,
const int ndim, const double iter_tol, const double inside_tol, double *work,
- double *params, bool *inside);
+ double *params, int *inside);
static EvalSet eval_set()
{
diff --git a/src/LocalDiscretization/moab/LinearTri.hpp b/src/LocalDiscretization/moab/LinearTri.hpp
index 93820a7..3ab4eca 100644
--- a/src/LocalDiscretization/moab/LinearTri.hpp
+++ b/src/LocalDiscretization/moab/LinearTri.hpp
@@ -18,7 +18,7 @@ public:
static ErrorCode reverseEvalFcn(EvalFcn eval, JacobianFcn jacob, InsideFcn ins,
const double *posn, const double *verts, const int nverts, const int ndim,
const double iter_tol, const double inside_tol, double *work,
- double *params, bool *is_inside);
+ double *params, int *is_inside);
/** \brief Evaluate the jacobian at a specified parametric position */
static ErrorCode jacobianFcn(const double *params, const double *verts, const int nverts, const int ndim,
@@ -32,12 +32,12 @@ public:
static ErrorCode initFcn(const double *verts, const int nverts, double *&work);
/** \brief Function that returns whether or not the parameters are inside the natural space of the element */
- static bool insideFcn(const double *params, const int ndim, const double tol);
+ static int insideFcn(const double *params, const int ndim, const double tol);
static ErrorCode evaluate_reverse(EvalFcn eval, JacobianFcn jacob, InsideFcn inside_f,
const double *posn, const double *verts, const int nverts,
const int ndim, const double iter_tol, const double inside_tol, double *work,
- double *params, bool *inside);
+ double *params, int *inside);
static EvalSet eval_set()
{
diff --git a/src/LocalDiscretization/moab/QuadraticHex.hpp b/src/LocalDiscretization/moab/QuadraticHex.hpp
index 0e5cfb8..ee0dcc8 100644
--- a/src/LocalDiscretization/moab/QuadraticHex.hpp
+++ b/src/LocalDiscretization/moab/QuadraticHex.hpp
@@ -18,7 +18,7 @@ public:
static ErrorCode reverseEvalFcn(EvalFcn eval, JacobianFcn jacob, InsideFcn ins,
const double *posn, const double *verts, const int nverts, const int ndim,
const double iter_tol, const double inside_tol, double *work,
- double *params, bool *is_inside);
+ double *params, int *is_inside);
/** \brief Evaluate the jacobian at a specified parametric position */
static ErrorCode jacobianFcn(const double *params, const double *verts, const int nverts, const int ndim,
@@ -29,7 +29,7 @@ public:
double *work, double *result);
/** \brief Function that returns whether or not the parameters are inside the natural space of the element */
- static bool insideFcn(const double *params, const int ndim, const double tol);
+ static int insideFcn(const double *params, const int ndim, const double tol);
static EvalSet eval_set()
{
diff --git a/src/LocalDiscretization/moab/SpectralHex.hpp b/src/LocalDiscretization/moab/SpectralHex.hpp
index 648cc70..9e60c63 100644
--- a/src/LocalDiscretization/moab/SpectralHex.hpp
+++ b/src/LocalDiscretization/moab/SpectralHex.hpp
@@ -20,7 +20,7 @@ public:
static ErrorCode reverseEvalFcn(EvalFcn eval, JacobianFcn jacob, InsideFcn ins,
const double *posn, const double *verts, const int nverts, const int ndim,
const double iter_tol, const double inside_tol, double *work,
- double *params, bool *is_inside);
+ double *params, int *is_inside);
/** \brief Evaluate the jacobian at a specified parametric position */
static ErrorCode jacobianFcn(const double *params, const double *verts, const int nverts, const int ndim,
@@ -34,7 +34,7 @@ public:
static ErrorCode initFcn(const double *verts, const int nverts, double *&work);
/** \brief Function that returns whether or not the parameters are inside the natural space of the element */
- static bool insideFcn(const double *params, const int ndim, const double tol);
+ static int insideFcn(const double *params, const int ndim, const double tol);
static EvalSet eval_set()
{
diff --git a/src/LocalDiscretization/moab/SpectralQuad.hpp b/src/LocalDiscretization/moab/SpectralQuad.hpp
index a72f9b4..4390d23 100644
--- a/src/LocalDiscretization/moab/SpectralQuad.hpp
+++ b/src/LocalDiscretization/moab/SpectralQuad.hpp
@@ -20,7 +20,7 @@ public:
static ErrorCode reverseEvalFcn(EvalFcn eval, JacobianFcn jacob, InsideFcn ins,
const double *posn, const double *verts, const int nverts, const int ndim,
const double iter_tol, const double inside_tol, double *work,
- double *params, bool *is_inside);
+ double *params, int *is_inside);
/** \brief Evaluate the jacobian at a specified parametric position */
static ErrorCode jacobianFcn(const double *params, const double *verts, const int nverts, const int ndim,
@@ -33,7 +33,7 @@ public:
static ErrorCode initFcn(const double *verts, const int nverts, double *&work);
/** \brief Function that returns whether or not the parameters are inside the natural space of the element */
- static bool insideFcn(const double *params, const int ndim, const double tol);
+ static int insideFcn(const double *params, const int ndim, const double tol);
static EvalSet eval_set()
{
diff --git a/src/SpatialLocator.cpp b/src/SpatialLocator.cpp
index 36016c1..694122c 100644
--- a/src/SpatialLocator.cpp
+++ b/src/SpatialLocator.cpp
@@ -3,6 +3,13 @@
#include "moab/ElemEvaluator.hpp"
#include "moab/AdaptiveKDTree.hpp"
+// include ScdInterface for box partitioning
+#include "moab/ScdInterface.hpp"
+
+#ifdef USE_MPI
+#include "moab/ParallelComm.hpp"
+#endif
+
bool debug = true;
namespace moab
@@ -19,6 +26,9 @@ namespace moab
myDim = mbImpl->dimension_from_handle(*elems.rbegin());
ErrorCode rval = myTree->build_tree(myElems);
if (MB_SUCCESS != rval) throw rval;
+
+ rval = myTree->get_bounding_box(localBox);
+ if (MB_SUCCESS != rval) throw rval;
}
}
@@ -34,21 +44,258 @@ namespace moab
}
#ifdef USE_MPI
- ErrorCode SpatialLocator::par_locate_points(Range &/*vertices*/,
- const double /*rel_iter_tol*/, const double /*abs_iter_tol*/,
- const double /*inside_tol*/)
+ ErrorCode SpatialLocator::initialize_intermediate_partition(ParallelComm *pc)
{
- return MB_UNSUPPORTED_OPERATION;
+ if (!pc) return MB_FAILURE;
+
+ BoundBox gbox;
+
+ //step 2
+ // get the global bounding box
+ double sendbuffer[6];
+ double rcvbuffer[6];
+
+ localBox.get(sendbuffer); //fill sendbuffer with local box, max values in [0:2] min values in [3:5]
+ sendbuffer[0] *= -1;
+ sendbuffer[1] *= -1; //negate Xmin,Ymin,Zmin to get their minimum using MPI_MAX
+ sendbuffer[2] *= -1; //to avoid calling MPI_Allreduce again with MPI_MIN
+
+ int mpi_err = MPI_Allreduce(sendbuffer, rcvbuffer, 6, MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD);
+ if (MPI_SUCCESS != mpi_err) return MB_FAILURE;
+
+ rcvbuffer[0] *= -1;
+ rcvbuffer[1] *= -1; //negate Xmin,Ymin,Zmin again to get original values
+ rcvbuffer[2] *= -1;
+
+ globalBox.update_max(&rcvbuffer[3]); //saving values in globalBox
+ globalBox.update_min(&rcvbuffer[0]);
+
+ // compute the alternate decomposition; use ScdInterface::compute_partition_sqijk for this
+ ScdParData spd;
+ spd.partMethod = ScdParData::SQIJK;
+ spd.gPeriodic[0] = spd.gPeriodic[1] = spd.gPeriodic[2] = 0;
+ double lg = log10((localBox.bMax - localBox.bMin).length());
+ double mfactor = pow(10.0, 6 - lg);
+ int ldims[3], lper[3];
+ double dgijk[6];
+ localBox.get(dgijk);
+ for (int i = 0; i < 6; i++) spd.gDims[i] = dgijk[i] * mfactor;
+ ErrorCode rval = ScdInterface::compute_partition(pc->size(), pc->rank(), spd,
+ ldims, lper, regNums);
+ if (MB_SUCCESS != rval) return rval;
+ // all we're really interested in is regNums[i], #procs in each direction
+
+ for (int i = 0; i < 3; i++)
+ regDeltaXYZ[i] = (globalBox.bMax[i] - globalBox.bMin[i])/double(regNums[i]); //size of each region
+
+ return MB_SUCCESS;
+ }
+
+//this function sets up the TupleList TLreg_o containing the registration messages
+// and sends it
+ ErrorCode SpatialLocator::register_src_with_intermediate_procs(ParallelComm *pc, double abs_iter_tol, TupleList &TLreg_o)
+ {
+ int corner_ijk[6];
+
+ // step 3: compute ijks of local box corners in intermediate partition
+ // get corner ijk values for my box
+ ErrorCode rval = get_point_ijk(localBox.bMin-CartVect(abs_iter_tol), abs_iter_tol, corner_ijk);
+ if (MB_SUCCESS != rval) return rval;
+ rval = get_point_ijk(localBox.bMax+CartVect(abs_iter_tol), abs_iter_tol, corner_ijk+3);
+ if (MB_SUCCESS != rval) return rval;
+
+ //step 4
+ //set up TLreg_o
+ TLreg_o.initialize(1,0,0,6,0);
+ // TLreg_o (int destProc, real Xmin, Ymin, Zmin, Xmax, Ymax, Zmax)
+
+ int dest;
+ double boxtosend[6];
+
+ localBox.get(boxtosend);
+
+ //iterate over all regions overlapping with my bounding box using the computerd corner IDs
+ for (int k = corner_ijk[2]; k <= corner_ijk[5]; k++) {
+ for (int j = corner_ijk[1]; j <= corner_ijk[4]; j++) {
+ for (int i = corner_ijk[0]; i <= corner_ijk[3]; i++) {
+ dest = k * regNums[0]*regNums[1] + j * regNums[0] + i;
+ TLreg_o.push_back(&dest, NULL, NULL, boxtosend);
+ }
+ }
+ }
+
+ //step 5
+ //send TLreg_o, receive TLrequests_i
+ if (pc) pc->proc_config().crystal_router()->gs_transfer(1, TLreg_o, 0);
+
+ //step 6
+ //Read registration requests from TLreg_o and add to list of procs to forward to
+ //get number of tuples sent to me
+
+ //read tuples and fill processor list;
+ int NN = TLreg_o.get_n();
+ for (int i=0; i < NN; i++)
+ //TLreg_o is now TLrequests_i
+ srcProcBoxes[TLreg_o.vi_rd[i]] = BoundBox(TLreg_o.vr_rd+6*i);
+
+ return MB_SUCCESS;
}
- ErrorCode SpatialLocator::par_locate_points(const double */*pos*/, int /*num_points*/,
+ ErrorCode SpatialLocator::par_locate_points(ParallelComm */*pc*/,
+ Range &/*vertices*/,
const double /*rel_iter_tol*/, const double /*abs_iter_tol*/,
const double /*inside_tol*/)
{
return MB_UNSUPPORTED_OPERATION;
}
-#endif
+
+ bool is_neg(int i) {return (i == -1);}
+
+ ErrorCode SpatialLocator::par_locate_points(ParallelComm *pc,
+ const double *pos, int num_points,
+ const double rel_iter_tol, const double abs_iter_tol,
+ const double inside_tol)
+ {
+ ErrorCode rval;
+ //TUpleList used for communication
+ TupleList TLreg_o; //TLregister_outbound
+ TupleList TLquery_o; //TLquery_outbound
+ TupleList TLforward_o; //TLforward_outbound
+ TupleList TLsearch_results_o; //TLsearch_results_outbound
+
+
+ // steps 1-2 - initialize the alternative decomposition box from global box
+ rval = initialize_intermediate_partition(pc);
+
+ //steps 3-6 - set up TLreg_o, gs_transfer, gather registrations
+ rval = register_src_with_intermediate_procs(pc, abs_iter_tol, TLreg_o);
+ if (rval != MB_SUCCESS) return rval;
+
+ // actual parallel point location using intermediate partition
+
+ // target_pts: TL(to_proc, tgt_index, x, y, z): tuples sent to source mesh procs representing pts to be located
+ // source_pts: TL(from_proc, tgt_index, src_index): results of source mesh proc point location, ready to send
+ // back to tgt procs; src_index of -1 indicates point not located (arguably not useful...)
+
+ unsigned int my_rank = (pc? pc->proc_config().proc_rank() : 0);
+
+ //TLquery_o: Tuples sent to forwarder proc
+ //TL (toProc, OriginalSourceProc, targetIndex, X,Y,Z)
+
+ //TLforw_req_i: Tuples to forward to corresponding procs (forwarding requests)
+ //TL (sourceProc, OriginalSourceProc, targetIndex, X,Y,Z)
+
+ TLquery_o.initialize(3,0,0,3,0);
+
+ int iargs[3];
+
+ for (int pnt=0; pnt < 3*num_points; pnt+=3)
+ {
+ int forw_id = proc_from_point(pos+pnt, abs_iter_tol); //get ID of proc resonsible of the region the proc is in
+
+ iargs[0] = forw_id; //toProc
+ iargs[1] = my_rank; //originalSourceProc
+ iargs[2] = pnt/3; //targetIndex
+
+ TLquery_o.push_back(iargs, NULL, NULL, const_cast<double*>(pos+pnt));
+ }
+
+ //send point search queries to forwarders
+ if (pc)
+ pc->proc_config().crystal_router()->gs_transfer(1, TLquery_o, 0);
+
+ //now read forwarding requests and forward to corresponding procs
+ //TLquery_o is now TLforw_req_i
+
+ //TLforward_o: query messages forwarded to corresponding procs
+ //TL (toProc, OriginalSourceProc, targetIndex, X,Y,Z)
+
+ TLforward_o.initialize(3,0,0,3,0);
+
+ int NN = TLquery_o.get_n();
+
+ for (int i=0; i < NN; i++) {
+ iargs[1] = TLquery_o.vi_rd[3*i+1]; //get OriginalSourceProc
+ iargs[2] = TLquery_o.vi_rd[3*i+2]; //targetIndex
+ CartVect tmp_pnt(TLquery_o.vr_rd+3*i);
+
+ //compare coordinates to list of bounding boxes
+ for (std::map<int, BoundBox>::iterator mit = srcProcBoxes.begin(); mit != srcProcBoxes.end(); mit++) {
+ if ((*mit).second.contains_point(tmp_pnt.array(), abs_iter_tol)) {
+ iargs[0] = (*mit).first;
+ TLforward_o.push_back(iargs, NULL, NULL, tmp_pnt.array());
+ }
+ }
+
+ }
+
+ if (pc)
+ pc->proc_config().crystal_router()->gs_transfer(1, TLforward_o, 0);
+
+ //step 12
+ //now read Point Search requests
+ //TLforward_o is now TLsearch_req_i
+ //TLsearch_req_i: (sourceProc, OriginalSourceProc, targetIndex, X,Y,Z)
+
+ NN = TLforward_o.get_n();
+
+ //TLsearch_results_o
+ //TL: (OriginalSourceProc, targetIndex, sourceIndex, U,V,W);
+ TLsearch_results_o.initialize(3,0,0,0,0);
+
+ //step 13 is done in test_local_box
+
+ std::vector<double> params(3*NN);
+ std::vector<int> is_inside(NN, 0);
+ std::vector<EntityHandle> ents(NN, 0);
+
+ rval = locate_points(TLforward_o.vr_rd, TLforward_o.get_n(),
+ &ents[0], ¶ms[0], &is_inside[0],
+ rel_iter_tol, abs_iter_tol, inside_tol);
+ if (MB_SUCCESS != rval)
+ return rval;
+
+ locTable.initialize(1, 0, 1, 3, 0);
+ locTable.enableWriteAccess();
+ for (int i = 0; i < NN; i++) {
+ if (is_inside[i]) {
+ iargs[0] = TLforward_o.vi_rd[3*i+1];
+ iargs[1] = TLforward_o.vi_rd[3*i+2];
+ iargs[2] = locTable.get_n();
+ TLsearch_results_o.push_back(iargs, NULL, NULL, NULL);
+ locTable.push_back(const_cast<int*>(&TLforward_o.vi_rd[3*i+1]), NULL, &ents[i], ¶ms[3*i]);
+ }
+ }
+ locTable.disableWriteAccess();
+
+ //step 14: send TLsearch_results_o and receive TLloc_i
+ if (pc)
+ pc->proc_config().crystal_router()->gs_transfer(1, TLsearch_results_o, 0);
+
+
+ // store proc/index tuples in parLocTable
+ parLocTable.initialize(2, 0, 0, 0, num_points);
+ parLocTable.enableWriteAccess();
+ std::fill(parLocTable.vi_wr, parLocTable.vi_wr + 2*num_points, -1);
+
+ for (unsigned int i = 0; i < TLsearch_results_o.get_n(); i++) {
+ int idx = TLsearch_results_o.vi_rd[3*i+1];
+ parLocTable.vi_wr[2*idx] = TLsearch_results_o.vi_rd[3*i];
+ parLocTable.vi_wr[2*idx+1] = TLsearch_results_o.vi_rd[3*i+2];
+ }
+
+ if (debug) {
+ int num_found = num_points - 0.5 *
+ std::count_if(parLocTable.vi_wr, parLocTable.vi_wr + 2*num_points, is_neg);
+ std::cout << "Points found = " << num_found << "/" << num_points
+ << " (" << 100.0*((double)num_found/num_points) << "%)" << std::endl;
+ }
+ return MB_SUCCESS;
+ }
+
+#endif
+
ErrorCode SpatialLocator::locate_points(Range &verts,
const double rel_iter_tol, const double abs_iter_tol,
const double inside_tol)
@@ -82,7 +329,7 @@ namespace moab
}
ErrorCode SpatialLocator::locate_points(Range &verts,
- EntityHandle *ents, double *params, bool *is_inside,
+ EntityHandle *ents, double *params, int *is_inside,
const double rel_iter_tol, const double abs_iter_tol,
const double inside_tol)
{
@@ -94,16 +341,14 @@ namespace moab
}
ErrorCode SpatialLocator::locate_points(const double *pos, int num_points,
- EntityHandle *ents, double *params, bool *is_inside,
+ EntityHandle *ents, double *params, int *is_inside,
const double rel_iter_tol, const double abs_iter_tol,
const double inside_tol)
{
double tmp_abs_iter_tol = abs_iter_tol;
if (rel_iter_tol && !tmp_abs_iter_tol) {
// relative epsilon given, translate to absolute epsilon using box dimensions
- BoundBox box;
- myTree->get_bounding_box(box);
- tmp_abs_iter_tol = rel_iter_tol * box.diagonal_length();
+ tmp_abs_iter_tol = rel_iter_tol * localBox.diagonal_length();
}
EntityHandle closest_leaf;
@@ -154,8 +399,8 @@ namespace moab
if(rval != MB_SUCCESS) return rval;
// loop over the range_leaf
- bool tmp_inside;
- bool *is_ptr = (is_inside ? is_inside+i : &tmp_inside);
+ int tmp_inside;
+ int *is_ptr = (is_inside ? is_inside+i : &tmp_inside);
*is_ptr = false;
EntityHandle ent = 0;
for(Range::iterator rit = range_leaf.begin(); rit != range_leaf.end(); rit++)
diff --git a/src/io/NCHelperMPAS.cpp b/src/io/NCHelperMPAS.cpp
index 684aa4d..9c70b80 100644
--- a/src/io/NCHelperMPAS.cpp
+++ b/src/io/NCHelperMPAS.cpp
@@ -301,7 +301,6 @@ ErrorCode NCHelperMPAS::create_mesh(Range& faces)
int& gatherSetRank = _readNC->gatherSetRank;
bool& noMixedElements = _readNC->noMixedElements;
bool& noEdges = _readNC->noEdges;
- DebugOutput& dbgOut = _readNC->dbgOut;
int rank = 0;
int procs = 1;
@@ -396,8 +395,10 @@ ErrorCode NCHelperMPAS::create_mesh(Range& faces)
MPI_Allreduce(&local_max_edges_per_cell, &global_max_edges_per_cell, 1, MPI_INTEGER, MPI_MAX, myPcomm->proc_config().proc_comm());
assert(local_max_edges_per_cell <= global_max_edges_per_cell);
maxEdgesPerCell = global_max_edges_per_cell;
- if (0 == rank)
+ if (0 == rank) {
+ DebugOutput& dbgOut = _readNC->dbgOut;
dbgOut.tprintf(1, " global_max_edges_per_cell = %d\n", global_max_edges_per_cell);
+ }
}
#endif
@@ -416,7 +417,8 @@ ErrorCode NCHelperMPAS::create_mesh(Range& faces)
EntityHandle starth = pair_iter->first;
EntityHandle endh = pair_iter->second;
NCDF_SIZE read_starts[2] = {static_cast<NCDF_SIZE>(starth - 1), 0};
- NCDF_SIZE read_counts[2] = {static_cast<NCDF_SIZE>(endh - starth + 1), maxEdgesPerCell};
+ NCDF_SIZE read_counts[2] = {static_cast<NCDF_SIZE>(endh - starth + 1),
+ static_cast<NCDF_SIZE>(maxEdgesPerCell)};
// Do a partial read in each subrange
#ifdef PNETCDF_FILE
diff --git a/src/moab/BoundBox.hpp b/src/moab/BoundBox.hpp
index 5c51341..3e525ac 100644
--- a/src/moab/BoundBox.hpp
+++ b/src/moab/BoundBox.hpp
@@ -27,6 +27,7 @@ namespace moab {
void update_min(const double *coords);
void update_max(const BoundBox &other_box);
void update_max(const double *coords);
+ ErrorCode get(double *coords);
/** \brief Return the diagonal length of this box
*/
@@ -123,6 +124,13 @@ namespace moab {
bMax[2] = std::max(bMax[2], coords[2]);
}
+ inline ErrorCode BoundBox::get(double *coords)
+ {
+ bMin.get(coords);
+ bMax.get(coords+3);
+ return MB_SUCCESS;
+ }
+
inline void BoundBox::compute_center(CartVect ¢er){
center = 0.5 * (bMin + bMax);
}
diff --git a/src/moab/SpatialLocator.hpp b/src/moab/SpatialLocator.hpp
index e8ab5cf..f9a1746 100644
--- a/src/moab/SpatialLocator.hpp
+++ b/src/moab/SpatialLocator.hpp
@@ -34,15 +34,18 @@
#include "moab/Tree.hpp"
#include "moab/Range.hpp"
#include "moab/TupleList.hpp"
+#include "moab/BoundBox.hpp"
#include <string>
#include <vector>
+#include <map>
#include <math.h>
namespace moab {
class Interface;
class ElemEvaluator;
+ class ParallelComm;
class SpatialLocator
{
@@ -57,17 +60,20 @@ namespace moab {
ErrorCode add_elems(Range &elems);
/* get bounding box of this locator */
- ErrorCode get_bounding_box(BoundBox &box);
+ BoundBox &local_box() {return localBox;}
+
+ /* get bounding box of this locator */
+ const BoundBox &local_box() const {return localBox;}
/* locate a set of vertices, Range variant */
ErrorCode locate_points(Range &vertices,
- EntityHandle *ents, double *params, bool *is_inside = NULL,
+ EntityHandle *ents, double *params, int *is_inside = NULL,
const double rel_iter_tol = 1.0e-10, const double abs_iter_tol = 1.0e-10,
const double inside_tol = 1.0e-6);
/* locate a set of points */
ErrorCode locate_points(const double *pos, int num_points,
- EntityHandle *ents, double *params, bool *is_inside = NULL,
+ EntityHandle *ents, double *params, int *is_inside = NULL,
const double rel_iter_tol = 1.0e-10, const double abs_iter_tol = 1.0e-10,
const double inside_tol = 1.0e-6);
@@ -107,20 +113,26 @@ namespace moab {
* variables (TupleList) locTable and parLocTable (see comments on locTable and parLocTable for
* structure of those tuples).
*/
- ErrorCode par_locate_points(Range &vertices,
- const double rel_iter_tol = 1.0e-10, const double abs_iter_tol = 1.0e-10,
- const double inside_tol = 1.0e-6);
+ ErrorCode par_locate_points(ParallelComm *pc,
+ Range &vertices,
+ const double rel_iter_tol = 1.0e-10, const double abs_iter_tol = 1.0e-10,
+ const double inside_tol = 1.0e-6);
/* locate a set of points, storing results on TupleList in this class
* Locate a set of points, storing the detailed results in member
* variables (TupleList) locTable and parLocTable (see comments on locTable and parLocTable for
* structure of those tuples).
*/
- ErrorCode par_locate_points(const double *pos, int num_points,
- const double rel_iter_tol = 1.0e-10, const double abs_iter_tol = 1.0e-10,
- const double inside_tol = 1.0e-6);
+ ErrorCode par_locate_points(ParallelComm *pc,
+ const double *pos, int num_points,
+ const double rel_iter_tol = 1.0e-10, const double abs_iter_tol = 1.0e-10,
+ const double inside_tol = 1.0e-6);
#endif
+ /** \brief Return the MOAB interface associated with this locator
+ */
+ Interface* moab() { return mbImpl; }
+
/* locate a point */
ErrorCode locate_point(const double *pos,
EntityHandle &ent, double *params, bool *is_inside = NULL,
@@ -157,6 +169,37 @@ namespace moab {
private:
+ /* locate a point */
+ ErrorCode locate_point(const double *pos,
+ EntityHandle &ent, double *params, int *is_inside = NULL,
+ const double rel_iter_tol = 1.0e-10, const double abs_iter_tol = 1.0e-10,
+ const double inside_tol = 1.0e-6);
+
+#ifdef USE_MPI
+ /* MPI_ReduceAll source mesh bounding boxes to get global source mesh bounding box
+ */
+ ErrorCode initialize_intermediate_partition(ParallelComm *pc);
+
+ /* for a given point in space, compute its ijk location in the intermediate decomposition; tolerance is
+ * used only to test proximity to global box extent, not for local box test
+ */
+ inline ErrorCode get_point_ijk(const CartVect &point, const double abs_iter_tol, int *ijk) const;
+
+ /* given an ijk location in the intermediate partition, return the proc rank for that location
+ */
+ inline int proc_from_ijk(const int *ijk) const;
+
+ /* given a point in space, return the proc responsible for that point from the intermediate decomp; no tolerances
+ * applied here, so first proc in lexicographic ijk ordering is returned
+ */
+ inline int proc_from_point(const double *pos, const double abs_iter_tol) const;
+
+ /* register my source mesh with intermediate decomposition procs
+ */
+ ErrorCode register_src_with_intermediate_procs(ParallelComm *pc, double abs_iter_tol, TupleList &TLreg_o);
+
+#endif
+
/* MOAB instance */
Interface* mbImpl;
@@ -197,6 +240,28 @@ namespace moab {
* The indexing of parLocTable corresponds to that of the points/entities passed in.
*/
TupleList parLocTable;
+
+ /* \brief Local bounding box, duplicated from tree
+ */
+ BoundBox localBox;
+
+ /* \brief Global bounding box, used in parallel spatial location
+ */
+ BoundBox globalBox;
+
+ /* \brief Regional delta xyz, used in parallel spatial location
+ */
+ CartVect regDeltaXYZ;
+
+ /* \brief Number of regions in each of 3 directions
+ */
+ int regNums[3];
+
+ /* \brief Map from source processor to bounding box of that proc's source mesh
+ *
+ */
+ std::map<int, BoundBox> srcProcBoxes;
+
};
inline SpatialLocator::~SpatialLocator()
@@ -205,18 +270,44 @@ namespace moab {
}
inline ErrorCode SpatialLocator::locate_point(const double *pos,
- EntityHandle &ent, double *params, bool *is_inside,
+ EntityHandle &ent, double *params, int *is_inside,
const double rel_iter_tol, const double abs_iter_tol,
const double inside_tol)
{
return locate_points(pos, 1, &ent, params, is_inside, rel_iter_tol, abs_iter_tol, inside_tol);
}
- inline ErrorCode SpatialLocator::get_bounding_box(BoundBox &box)
+#ifdef USE_MPI
+ inline ErrorCode SpatialLocator::get_point_ijk(const CartVect &point, const double abs_iter_tol, int *ijk) const
{
- return myTree->get_bounding_box(box);
+ for (int i = 0; i < 3; i++) {
+ if (point[i] < globalBox.bMin[i]-abs_iter_tol || point[i] > globalBox.bMax[i]+abs_iter_tol)
+ ijk[i] = -1;
+ else {
+ ijk[i] = point[i] - globalBox.bMin[i] / regDeltaXYZ[i];
+ if (ijk[i] >= regNums[i] && point[i] <= globalBox.bMax[i]+abs_iter_tol)
+ ijk[i] = regNums[i]-1;
+ }
+ }
+
+ return (ijk[0] >= 0 && ijk[1] >= 0 && ijk[2] >= 0 ? MB_SUCCESS : MB_FAILURE);;
}
+ inline int SpatialLocator::proc_from_ijk(const int *ijk) const
+ {
+ return ijk[2] * regNums[0]*regNums[1] + ijk[1] * regNums[0] + ijk[0];
+ }
+
+ inline int SpatialLocator::proc_from_point(const double *pos, const double abs_iter_tol) const
+ {
+ int ijk[3];
+ ErrorCode rval = get_point_ijk(CartVect(pos), abs_iter_tol, ijk);
+ if (MB_SUCCESS != rval) return -1;
+
+ return ijk[2] * regNums[0]*regNums[1] + ijk[1] * regNums[0] + ijk[0];
+ }
+#endif
+
} // namespace moab
#endif
diff --git a/test/Test_MBMeshSet.cpp b/test/Test_MBMeshSet.cpp
index c762aa9..b4afc2b 100644
--- a/test/Test_MBMeshSet.cpp
+++ b/test/Test_MBMeshSet.cpp
@@ -185,7 +185,8 @@ void make_mesh( Interface& iface )
for (int z = 0; z <= dim; ++z) {
for (int y = 0; y <= dim; ++y) {
for (int x = 0; x <= dim; ++x) {
- const double coords[] = {x, y, z};
+ const double coords[] = {static_cast<double>(x), static_cast<double>(y),
+ static_cast<double>(z)};
EntityHandle new_handle = 0;
ErrorCode rval = iface.create_vertex( coords, new_handle );
CHECK_ERR(rval);
diff --git a/test/elem_eval_test.cpp b/test/elem_eval_test.cpp
index beb8704..212931f 100644
--- a/test/elem_eval_test.cpp
+++ b/test/elem_eval_test.cpp
@@ -50,7 +50,7 @@ void test_eval(ElemEvaluator &ee, bool test_integrate)
{
CartVect params, posn, params2;
- bool is_inside;
+ int is_inside;
Matrix3 jacob;
ErrorCode rval;
int ent_dim = ee.get_moab()->dimension_from_handle(ee.get_ent_handle());
diff --git a/test/h5file/h5file_test.cpp b/test/h5file/h5file_test.cpp
index 94dc218..ec200e2 100644
--- a/test/h5file/h5file_test.cpp
+++ b/test/h5file/h5file_test.cpp
@@ -352,7 +352,7 @@ void create()
Tag itag;
if (MB_SUCCESS != iface->tag_get_handle( intname, 2, MB_TYPE_INTEGER, itag, MB_TAG_SPARSE|MB_TAG_EXCL ))
moab_error( "tag_get_handle(MB_TYPE_INT)" );
- int idata[] = { 0xDEADBEEF, 0xDEFACED };
+ int idata[] = { static_cast<int>(0xDEADBEEF), static_cast<int>(0xDEFACED) };
if (MB_SUCCESS != iface->tag_set_data( itag, &dodec, 1, idata ))
moab_error( "tag_set_data(itag)" );
diff --git a/test/h5file/h5partial.cpp b/test/h5file/h5partial.cpp
index 17abc06..c87c935 100644
--- a/test/h5file/h5partial.cpp
+++ b/test/h5file/h5partial.cpp
@@ -416,7 +416,7 @@ void create_mesh( bool create_element_sets,
// create elements
EntityHandle verts[MBQUAD_INT+1][MBQUAD_INT+1], quads[MBQUAD_INT][MBQUAD_INT];
for (int i = 0; i <= MBQUAD_INT; ++i) for(int j = 0; j <= MBQUAD_INT; ++j) {
- double coords[3] = { i, j, 0 };
+ double coords[3] = { static_cast<double>(i), static_cast<double>(j), 0 };
rval = mb.create_vertex( coords, verts[j][i] );
CHECK_ERR(rval);
int logical[2] = { i, j };
@@ -1350,7 +1350,7 @@ void test_read_adjacencies()
for (int k = 0; k < 2; ++k) {
for (int j = 0; j < 3; ++j) {
for (int i = 0; i < 3; ++i) {
- double coords[] = { i, j, k };
+ double coords[] = { static_cast<double>(i), static_cast<double>(j), static_cast<double>(k) };
rval = mb.create_vertex( coords, verts[i][j][k] );
CHECK_ERR(rval);
}
@@ -1445,7 +1445,7 @@ void test_read_sides()
EntityHandle verts[INT+1][INT+1];
for (int j = 0; j <= INT; ++j) {
for (int i = 0; i <= INT; ++i) {
- double coords[3] = { i, j, 0 };
+ double coords[3] = { static_cast<double>(i), static_cast<double>(j), 0 };
rval = mb.create_vertex( coords, verts[INT-j][i] );
CHECK_ERR(rval);
}
diff --git a/test/h5file/h5portable.cpp b/test/h5file/h5portable.cpp
index 42dfd05..cbeac98 100644
--- a/test/h5file/h5portable.cpp
+++ b/test/h5file/h5portable.cpp
@@ -107,7 +107,7 @@ void create_mesh( const char* filename )
for (size_t i = 0; i < NUM_VERT; ++i) {
- double coords[] = { i % 9, i / 9, Z };
+ double coords[] = { static_cast<double>(i % 9), static_cast<double>(i / 9), static_cast<double>(Z) };
rval = mb.create_vertex( coords, verts[i] );
CHECK_ERR(rval);
}
diff --git a/test/h5file/h5varlen.cpp b/test/h5file/h5varlen.cpp
index 7b112b5..e525475 100644
--- a/test/h5file/h5varlen.cpp
+++ b/test/h5file/h5varlen.cpp
@@ -566,7 +566,7 @@ void create_structured_quad_mesh( Interface& mb, int x, int y )
std::vector<EntityHandle> verts((x+1)*(y+1));
for (int i = 0; i <= x; ++i) {
for (int j = 0; j<= y; ++j) {
- double coords[3] = { i, j, z };
+ double coords[3] = { static_cast<double>(i), static_cast<double>(j), static_cast<double>(z) };
rval = mb.create_vertex( coords, verts[i + (x+1)*j] );
CHECK_ERR( rval );
}
diff --git a/test/io/stl_test.cc b/test/io/stl_test.cc
index 8956b38..2a4ace0 100644
--- a/test/io/stl_test.cc
+++ b/test/io/stl_test.cc
@@ -229,9 +229,9 @@ void check_mesh_is_tet( Interface& moab )
CHECK_EQUAL( 3, len );
int conn_idx[3] = {
- std::find( vert_handles, vert_handles + 4, conn[0] ) - vert_handles,
- std::find( vert_handles, vert_handles + 4, conn[1] ) - vert_handles,
- std::find( vert_handles, vert_handles + 4, conn[2] ) - vert_handles };
+ static_cast<int>(std::find( vert_handles, vert_handles + 4, conn[0] ) - vert_handles),
+ static_cast<int>(std::find( vert_handles, vert_handles + 4, conn[1] ) - vert_handles),
+ static_cast<int>(std::find( vert_handles, vert_handles + 4, conn[2] ) - vert_handles) };
CHECK( conn_idx[0] != 4 );
CHECK( conn_idx[1] != 4 );
CHECK( conn_idx[2] != 4 );
diff --git a/test/mergemesh_test.cpp b/test/mergemesh_test.cpp
index fca5304..89c4702 100644
--- a/test/mergemesh_test.cpp
+++ b/test/mergemesh_test.cpp
@@ -11,7 +11,7 @@ using namespace moab;
const char* meshfile = STRINGIFY(MESHDIR) "/16_unmerged_hex.h5m";
-int main( int argc, char* argv[] )
+int main( int , char** )
{
Core moab_core;
ErrorCode rval;
diff --git a/test/oldinc/test_oldinc.cpp b/test/oldinc/test_oldinc.cpp
index 59fa57b..fc4b026 100644
--- a/test/oldinc/test_oldinc.cpp
+++ b/test/oldinc/test_oldinc.cpp
@@ -8,12 +8,12 @@ typedef MBProcConfig Foo3;
#include "MBEntityHandle.h"
MBEntityHandle handle = 0;
#include "MBTypes.h"
-MBEntityType type = MBVERTEX;
-MBTag tag = 0;
+MBEntityType tp = MBVERTEX;
+MBTag tg = 0;
MBErrorCode code = MB_SUCCESS;
-int i = MB_VARIABLE_LENGTH;
+int it = MB_VARIABLE_LENGTH;
MBTagType tagtype = MB_TAG_DENSE;
-MBDataType datatype = MB_TYPE_HANDLE;
+MBDataType dttype = MB_TYPE_HANDLE;
MBEntitySetProperty prop = MESHSET_SET;
// test version info
diff --git a/test/parallel/Makefile.am b/test/parallel/Makefile.am
index 739751c..1b9aeef 100644
--- a/test/parallel/Makefile.am
+++ b/test/parallel/Makefile.am
@@ -36,6 +36,7 @@ TESTS = pcomm_unit \
uber_parallel_test \
scdtest \
pcomm_serial \
+ par_spatial_locator_test \
$(NETCDF_TESTS) \
$(HDF5_TESTS) \
$(COUPLER_TESTS) \
@@ -90,6 +91,7 @@ scdpart_SOURCES = scdpart.cpp
read_nc_par_SOURCES = ../io/read_nc.cpp
ucdtrvpart_SOURCES = ucdtrvpart.cpp
mpastrvpart_SOURCES = mpastrvpart.cpp
+par_spatial_locator_test_SOURCES = par_spatial_locator_test.cpp
if ENABLE_mbcoupler
par_coupler_test_SOURCES = par_coupler_test.cpp
@@ -113,5 +115,5 @@ MOSTLYCLEANFILES = mhdf_ll.h5m tmp0.h5m tmp1.h5m tmp2.h5m tmp3.h5m \
test.h5m \
initial1.vtk \
test_mpas.h5m \
- dum.h5m
-
+ dum.h5m \
+ test_mpas_no_mixed_elements.h5m
diff --git a/test/parallel/mhdf_parallel.c b/test/parallel/mhdf_parallel.c
index 178d183..7436022 100644
--- a/test/parallel/mhdf_parallel.c
+++ b/test/parallel/mhdf_parallel.c
@@ -283,7 +283,7 @@ static herr_t handle_hdf5_error( void* data )
return result;
}
-#endif // #ifdef H5_HAVE_PARALLEL
+#endif /* #ifdef H5_HAVE_PARALLEL */
int main( int argc, char* argv[] )
{
diff --git a/test/parallel/par_spatial_locator_test.cpp b/test/parallel/par_spatial_locator_test.cpp
new file mode 100644
index 0000000..334f958
--- /dev/null
+++ b/test/parallel/par_spatial_locator_test.cpp
@@ -0,0 +1,192 @@
+#include "moab/Core.hpp"
+#include "moab/SpatialLocator.hpp"
+#include "moab/Tree.hpp"
+#include "moab/HomXform.hpp"
+#include "moab/ScdInterface.hpp"
+#include "moab/CartVect.hpp"
+#include "moab/BVHTree.hpp"
+#include "moab/ProgOptions.hpp"
+#include "moab/CpuTimer.hpp"
+#include "moab/ParallelComm.hpp"
+#include "moab_mpi.h"
+
+#include "TestUtil.hpp"
+
+#include <cstdlib>
+#include <sstream>
+#include <string>
+
+using namespace moab;
+
+void test_kd_tree();
+void test_bvh_tree();
+void test_locator(SpatialLocator *sl);
+
+ErrorCode create_hex_mesh(Interface &mb, Range &elems, int n, int dim);
+ErrorCode load_file(Interface &mb, std::string &fn, Range &elems);
+
+int max_depth = 30;
+int npoints = 1000;
+int leaf = 6;
+int tree = -1;
+bool print_tree = false;
+int ints = 10;
+std::string fname;
+
+int main(int argc, char **argv)
+{
+ int fail = MPI_Init(&argc, &argv);
+ if (fail) return fail;
+
+ ProgOptions po("spatial_locator_test options" );
+ po.addOpt<std::string>( "file,f", "Input filename", &fname);
+ po.addOpt<int>( "ints,i", "Number of intervals on each side of scd mesh", &ints);
+ po.addOpt<int>( "leaf,l", "Maximum number of elements per leaf", &leaf);
+ po.addOpt<int>( "max_depth,m", "Maximum depth of tree", &max_depth);
+ po.addOpt<int>( "npoints,n", "Number of query points", &npoints);
+ po.addOpt<void>( "print,p", "Print tree details", &print_tree);
+ po.addOpt<int>( "tree,t", "Tree type (-1=all (default), 0=AdaptiveKD, 1=BVH", &tree);
+ po.parseCommandLine(argc, argv);
+
+ if (-1 == tree || 0 == tree)
+ RUN_TEST(test_kd_tree);
+ if (-1 == tree || 1 == tree)
+ RUN_TEST(test_bvh_tree);
+
+ fail = MPI_Finalize();
+ if (fail) return fail;
+
+ return 0;
+}
+
+void test_kd_tree()
+{
+ ErrorCode rval;
+ Core mb;
+
+ // create a simple mesh to test
+ Range elems;
+ if (fname.empty()) {
+ rval = create_hex_mesh(mb, elems, ints, 3); CHECK_ERR(rval);
+ }
+ else {
+ rval = load_file(mb, fname, elems); CHECK_ERR(rval);
+ }
+
+ // initialize spatial locator with the elements and the default tree type
+ SpatialLocator *sl = new SpatialLocator(&mb, elems);
+
+ test_locator(sl);
+
+ // destroy spatial locator, and tree along with it
+ delete sl;
+}
+
+void test_bvh_tree()
+{
+ ErrorCode rval;
+ Core mb;
+
+ // create a simple mesh to test
+ Range elems;
+ if (fname.empty()) {
+ rval = create_hex_mesh(mb, elems, ints, 3); CHECK_ERR(rval);
+ }
+ else {
+ rval = load_file(mb, fname, elems); CHECK_ERR(rval);
+ }
+
+ // initialize spatial locator with the elements and a BVH tree
+ BVHTree bvh(&mb);
+ std::ostringstream opts;
+ opts << "MAX_DEPTH=" << max_depth << ";MAX_PER_LEAF=" << leaf;
+ FileOptions fo(opts.str().c_str());
+ rval = bvh.parse_options(fo);
+ SpatialLocator *sl = new SpatialLocator(&mb, elems, &bvh);
+ test_locator(sl);
+
+ // destroy spatial locator, and tree along with it
+ delete sl;
+}
+
+bool is_neg(int is_neg)
+{
+ return (is_neg < 0);
+}
+
+void test_locator(SpatialLocator *sl)
+{
+ CartVect box_del;
+ BoundBox box = sl->local_box();
+ box_del = box.bMax - box.bMin;
+
+ double denom = 1.0 / (double)RAND_MAX;
+ std::vector<CartVect> test_pts(npoints);
+
+ for (int i = 0; i < npoints; i++) {
+ // generate a small number of random point to test
+ double rx = (double)rand() * denom, ry = (double)rand() * denom, rz = (double)rand() * denom;
+ test_pts[i] = box.bMin + CartVect(rx*box_del[0], ry*box_del[1], rz*box_del[2]);
+ }
+
+ // call spatial locator to locate points
+ ParallelComm *pc = ParallelComm::get_pcomm(sl->moab(), 0);
+ CHECK(pc != NULL);
+
+ ErrorCode rval = sl->par_locate_points(pc, test_pts[0].array(), npoints); CHECK_ERR(rval);
+ if (pc->rank() == 0) {
+ int num_out = std::count_if(sl->par_loc_table().vi_rd, sl->par_loc_table().vi_rd+2*npoints, is_neg);
+ num_out /= 2;
+
+ std::cout << "Number of points inside an element = " << npoints-num_out << "/" << npoints
+ << " (" << 100.0*((double)npoints-num_out)/npoints << "%)" << std::endl;
+ std::cout << "Traversal stats:" << std::endl;
+ sl->get_tree()->tree_stats().output();
+
+ if (print_tree) {
+ std::cout << "Tree information: " << std::endl;
+ rval = sl->get_tree()->print();
+ CHECK_ERR(rval);
+ }
+ }
+}
+
+ErrorCode create_hex_mesh(Interface &mb, Range &elems, int n, int dim)
+{
+ ScdInterface *scdi;
+ ErrorCode rval = mb.query_interface(scdi); CHECK_ERR(rval);
+ ScdParData spd;
+ spd.gDims[0] = spd.gDims[1] = spd.gDims[2] = 0;
+ spd.gDims[3] = n;
+ spd.partMethod = ScdParData::SQIJK;
+ if (dim > 1) spd.gDims[4] = n;
+ if (dim > 2) spd.gDims[5] = n;
+ ScdBox *new_box;
+ rval = scdi->construct_box(HomCoord(0, 0, 0), HomCoord(0, 0, 0),
+ NULL, 0, new_box, NULL, &spd, false, 0); CHECK_ERR(rval);
+
+ rval = mb.get_entities_by_dimension(0, dim, elems); CHECK_ERR(rval);
+
+ return rval;
+}
+
+ErrorCode load_file(Interface &mb, std::string &fn, Range &elems)
+{
+ std::string options;
+ ErrorCode rval;
+
+ options = "PARALLEL=READ_PART;PARTITION=PARALLEL_PARTITION;";
+ rval = mb.load_file(fn.c_str(), NULL, options.c_str());
+ if (MB_SUCCESS != rval) return rval;
+
+ rval = mb.get_entities_by_dimension(0, 3, elems);
+ if (MB_SUCCESS != rval) return rval;
+
+ if (elems.empty()) {
+ rval = mb.get_entities_by_dimension(0, 2, elems);
+ if (MB_SUCCESS != rval) return rval;
+ }
+
+ return MB_SUCCESS;
+}
+
diff --git a/test/parallel/parallel_hdf5_test.cc b/test/parallel/parallel_hdf5_test.cc
index 11224f2..efb9b86 100644
--- a/test/parallel/parallel_hdf5_test.cc
+++ b/test/parallel/parallel_hdf5_test.cc
@@ -790,7 +790,8 @@ void create_input_file( const char* file_name,
for (int j = 0; j < iv; ++j) {
int start = idx;
for (int k = 0; k < iv; ++k) {
- const double coords[3] = {i, j, k};
+ const double coords[3] = {static_cast<double>(i), static_cast<double>(j),
+ static_cast<double>(k)};
rval = mb.create_vertex( coords, verts[idx] );
CHECK_ERR(rval);
if (ijk_vert_tag) {
@@ -1279,7 +1280,7 @@ void test_write_different_element_types()
const int nvert = verts[rank%ntypes];
std::vector<EntityHandle> conn(nvert);
for (int i = 0; i < nvert; ++i) {
- const double coords[] = { rank, i, 0 };
+ const double coords[] = { static_cast<double>(rank), static_cast<double>(i), 0 };
rval = mb.create_vertex( coords, conn[i] );
CHECK_ERR(rval);
}
@@ -1323,8 +1324,10 @@ Tag get_tag( Interface& mb, int rank, bool create )
std::ostringstream name;
name << "TestTag" << rank;
const void* defval = 0;
- const int defint[] = { rank, rank/2, rank+1, rank-1 };
- const double defreal[] = { 0.1*rank, 1.0/rank, -rank, rank };
+ const int defint[] = { static_cast<int>(rank), static_cast<int>(rank/2),
+ static_cast<int>(rank+1), static_cast<int>(rank-1) };
+ const double defreal[] = { 0.1*rank, 1.0/rank,
+ static_cast<double>(-rank), static_cast<double>(rank) };
const int defhandle[] = { 0, 0, 0, 0 };
const unsigned char defbit = 0x1;
const char defopq[] = "Jason";
@@ -1384,14 +1387,14 @@ void test_write_polygons()
// create a polygon on each process
const double r = 0.70710678118654757;
- const double points[8][3] = { { 1, 0, rank },
- { r, r, rank },
- { 0, 1, rank },
- {-r, r, rank },
- {-1, 0, rank },
- {-r,-r, rank },
- { 0,-1, rank },
- { r,-r, rank } };
+ const double points[8][3] = { { 1, 0, static_cast<double>(rank) },
+ { static_cast<double>(r), static_cast<double>(r), static_cast<double>(rank) },
+ { 0, 1, static_cast<double>(rank) },
+ {static_cast<double>(-r), static_cast<double>(r), static_cast<double>(rank) },
+ {-1, 0, static_cast<double>(rank) },
+ {static_cast<double>(-r),static_cast<double>(-r), static_cast<double>(rank) },
+ { 0,-1, static_cast<double>(rank) },
+ { static_cast<double>(r),static_cast<double>(-r), static_cast<double>(rank) } };
const int nvtx = rank % 4 + 5;
std::vector<EntityHandle> conn(nvtx);
for (int i = 0; i < nvtx; ++i) {
@@ -1468,10 +1471,10 @@ void test_write_unbalanced()
// create a quad on every odd processor
if (rank % 2) {
- const double coords[4][3] = { { rank, 0, 0 },
- { rank+2, 0, 0 },
- { rank+2, 2, 0 },
- { rank, 2, 0 } };
+ const double coords[4][3] = { { static_cast<double>(rank), 0, 0 },
+ { static_cast<double>(rank+2), 0, 0 },
+ { static_cast<double>(rank+2), 2, 0 },
+ { static_cast<double>(rank), 2, 0 } };
EntityHandle conn[4], quad;
for (int i = 0; i < 4; ++i)
mb.create_vertex( coords[i], conn[i] );
diff --git a/test/parallel/pcomm_unit.cpp b/test/parallel/pcomm_unit.cpp
index bb6e57c..385784a 100644
--- a/test/parallel/pcomm_unit.cpp
+++ b/test/parallel/pcomm_unit.cpp
@@ -214,7 +214,8 @@ void create_simple_grid( Interface& moab, unsigned x, unsigned y, unsigned z )
for (unsigned k = 0; k < z; ++k)
for (unsigned j = 0; j < y; ++j)
for (unsigned i = 0; i < x; ++i) {
- const double coords[3] = { i, j, k };
+ const double coords[3] = { static_cast<double>(i), static_cast<double>(j),
+ static_cast<double>(k) };
rval = moab.create_vertex( coords, verts[x*y*k + x*j + i] );
CHECK_ERR(rval);
}
diff --git a/test/perf/point_location/elem_eval_time.cpp b/test/perf/point_location/elem_eval_time.cpp
index ef86762..2f573b2 100644
--- a/test/perf/point_location/elem_eval_time.cpp
+++ b/test/perf/point_location/elem_eval_time.cpp
@@ -155,7 +155,7 @@ ErrorCode time_reverse_eval(Interface *mbi, int method, Range &elems,
ElemEvaluator eeval(mbi);
eeval.set_eval_set(*elems.begin());
eeval.set_tag_handle(0, 0); // indicates coordinates as the field to evaluate
- bool ins;
+ int ins;
for (rit = elems.begin(), i = 0; rit != elems.end(); rit++, i++) {
eeval.set_ent_handle(*rit);
rval = eeval.reverse_eval(coords[i].array(), 1.0e-10, 1.0e-6, params[i].array(), &ins);
diff --git a/test/perf/point_location/sploc_searching_perf.cpp b/test/perf/point_location/sploc_searching_perf.cpp
index 158504d..fcda676 100644
--- a/test/perf/point_location/sploc_searching_perf.cpp
+++ b/test/perf/point_location/sploc_searching_perf.cpp
@@ -141,14 +141,12 @@ int main(int argc, char **argv)
ErrorCode test_locator(SpatialLocator &sl, int npoints, double rtol, double &cpu_time, double &percent_outside)
{
- BoundBox box;
- ErrorCode rval = sl.get_bounding_box(box);
- if (MB_SUCCESS != rval) return rval;
+ BoundBox box = sl.local_box();
CartVect box_del = box.bMax - box.bMin;
std::vector<CartVect> test_pts(npoints), test_res(npoints);
std::vector<EntityHandle> ents(npoints);
- bool *is_in = new bool[npoints];
+ int *is_in = new int[npoints];
double denom = 1.0 / (double)RAND_MAX;
for (int i = 0; i < npoints; i++) {
@@ -160,7 +158,7 @@ ErrorCode test_locator(SpatialLocator &sl, int npoints, double rtol, double &cpu
CpuTimer ct;
// call spatial locator to locate points
- rval = sl.locate_points(test_pts[0].array(), npoints, &ents[0], test_res[0].array(), &is_in[0], rtol, 0.0);
+ ErrorCode rval = sl.locate_points(test_pts[0].array(), npoints, &ents[0], test_res[0].array(), &is_in[0], rtol, 0.0);
if (MB_SUCCESS != rval) return rval;
cpu_time = ct.time_elapsed();
diff --git a/test/perf/point_location/tree_searching_perf.cpp b/test/perf/point_location/tree_searching_perf.cpp
index 9e35d9b..241aab8 100644
--- a/test/perf/point_location/tree_searching_perf.cpp
+++ b/test/perf/point_location/tree_searching_perf.cpp
@@ -132,14 +132,12 @@ int main(int argc, char **argv)
ErrorCode test_locator(SpatialLocator &sl, int npoints, double &cpu_time, double &percent_outside)
{
- BoundBox box;
- ErrorCode rval = sl.get_bounding_box(box);
- if (MB_SUCCESS != rval) return rval;
+ BoundBox box = sl.local_box();
CartVect box_del = box.bMax - box.bMin;
std::vector<CartVect> test_pts(npoints), test_res(npoints);
std::vector<EntityHandle> ents(npoints);
- bool *is_in = new bool[npoints];
+ int *is_in = new int[npoints];
double denom = 1.0 / (double)RAND_MAX;
for (int i = 0; i < npoints; i++) {
@@ -151,7 +149,7 @@ ErrorCode test_locator(SpatialLocator &sl, int npoints, double &cpu_time, double
CpuTimer ct;
// call spatial locator to locate points
- rval = sl.locate_points(test_pts[0].array(), npoints, &ents[0], test_res[0].array(), &is_in[0]);
+ ErrorCode rval = sl.locate_points(test_pts[0].array(), npoints, &ents[0], test_res[0].array(), &is_in[0]);
if (MB_SUCCESS != rval) return rval;
cpu_time = ct.time_elapsed();
diff --git a/test/reorder_test.cpp b/test/reorder_test.cpp
index 8201add..daad73e 100644
--- a/test/reorder_test.cpp
+++ b/test/reorder_test.cpp
@@ -185,7 +185,8 @@ void build_mesh( )
rval = mb->tag_set_data( gid, &h, 1, &tagval );
CHECK_ERR(rval);
- int ids[4] = { n0, n1, n2, n3 };
+ int ids[4] = { static_cast<int>(n0), static_cast<int>(n1),
+ static_cast<int>(n2), static_cast<int>(n3) };
rval = mb->tag_set_data( conn_ids, &h, 1, ids );
CHECK_ERR(rval);
diff --git a/test/spatial_locator_test.cpp b/test/spatial_locator_test.cpp
index 6ffa109..0171bf9 100644
--- a/test/spatial_locator_test.cpp
+++ b/test/spatial_locator_test.cpp
@@ -103,13 +103,13 @@ void test_bvh_tree()
void test_locator(SpatialLocator *sl)
{
CartVect box_del, test_pt, test_res;
- BoundBox box;
- ErrorCode rval = sl->get_bounding_box(box); CHECK_ERR(rval);
+ BoundBox box = sl->local_box();
box_del = box.bMax - box.bMin;
double denom = 1.0 / (double)RAND_MAX;
- bool is_in;
+ int is_in;
EntityHandle ent;
+ ErrorCode rval;
for (int i = 0; i < npoints; i++) {
// generate a small number of random point to test
double rx = (double)rand() * denom, ry = (double)rand() * denom, rz = (double)rand() * denom;
diff --git a/tools/mbcoupler/ElemUtilTest.cpp b/tools/mbcoupler/ElemUtilTest.cpp
index eae57c2..082a1eb 100644
--- a/tools/mbcoupler/ElemUtilTest.cpp
+++ b/tools/mbcoupler/ElemUtilTest.cpp
@@ -102,9 +102,6 @@ void test_hex_nat_coords()
result_xi = hex2.ievaluate(pt, EPS1/10);
double dum = EPS1/10;
valid = hex2.inside_nat_space(result_xi, dum);
- if (!valid) {
- double d1 = 0;
- }
CHECK(valid);
CHECK_REAL_EQUAL( xi[0], result_xi[0], EPS1 );
CHECK_REAL_EQUAL( xi[1], result_xi[1], EPS1 );
diff --git a/tools/mbzoltan/MBZoltan.cpp b/tools/mbzoltan/MBZoltan.cpp
index 7590ac9..5427cc8 100644
--- a/tools/mbzoltan/MBZoltan.cpp
+++ b/tools/mbzoltan/MBZoltan.cpp
@@ -362,8 +362,12 @@ ErrorCode MBZoltan::partition_mesh_geom(const double part_geom_mesh_size,
const int part_dim,
const int obj_weight,
const int edge_weight,
+#ifdef CGM
const bool part_surf,
const bool ghost,
+#else
+ const bool, const bool,
+#endif
const bool print_time,
const bool spherical_coords)
{
diff --git a/tools/mcnpmit/mcnpmit.cpp b/tools/mcnpmit/mcnpmit.cpp
index 81b9670..e6e2772 100644
--- a/tools/mcnpmit/mcnpmit.cpp
+++ b/tools/mcnpmit/mcnpmit.cpp
@@ -79,7 +79,6 @@ MCNPError McnpData::read_mcnpfile(bool skip_mesh) {
MCNPError result;
moab::ErrorCode MBresult;
- int nelems;
moab::CartVect tvect;
std::vector<double> xvec[3];
@@ -142,7 +141,6 @@ MCNPError McnpData::read_mcnpfile(bool skip_mesh) {
}
// Make the elements and vertices
- nelems = (nv[0] - 1) * (nv[1] - 1) * (nv[2] - 1);
result = make_elements(xvec, nv);
if (result == MCNP_FAILURE) return MCNP_FAILURE;
break;
@@ -266,8 +264,6 @@ MCNPError McnpData::make_elements(std::vector<double> x[3], int* n) {
// double v[3];
// MBEntityHandle dumhandle;
// MBEntityHandle vstart, vijk;
- moab::ErrorCode MBresult;
-
unsigned int num_verts = n[0]*n[1]*n[2];
double *coords;
coords = new double [ 3 * num_verts ];
@@ -306,7 +302,7 @@ MCNPError McnpData::make_elements(std::vector<double> x[3], int* n) {
}
}
- MBresult = MBI->create_vertices(coords, num_verts, vert_handles);
+ MBI->create_vertices(coords, num_verts, vert_handles);
delete coords;
@@ -315,10 +311,8 @@ MCNPError McnpData::make_elements(std::vector<double> x[3], int* n) {
MCNPError McnpData::initialize_tags() {
- moab::ErrorCode rval;
-
- rval = MBI->tag_get_handle(TALLY_TAG, 1, moab::MB_TYPE_DOUBLE, tally_tag, moab::MB_TAG_DENSE|moab::MB_TAG_CREAT);
- rval = MBI->tag_get_handle(ERROR_TAG, 1, moab::MB_TYPE_DOUBLE, relerr_tag, moab::MB_TAG_DENSE|moab::MB_TAG_CREAT);
+ MBI->tag_get_handle(TALLY_TAG, 1, moab::MB_TYPE_DOUBLE, tally_tag, moab::MB_TAG_DENSE|moab::MB_TAG_CREAT);
+ MBI->tag_get_handle(ERROR_TAG, 1, moab::MB_TYPE_DOUBLE, relerr_tag, moab::MB_TAG_DENSE|moab::MB_TAG_CREAT);
return MCNP_SUCCESS;
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