Commit c145364a authored by incardon's avatar incardon

Added an operator to Box + fix in configure

parent dc9ff87b
......@@ -198,6 +198,11 @@ fi
#
if test x$gpu_support = x"no"; then
CUDA_LIBS=""
CUDA_CFLAGS=""
fi
AM_CONDITIONAL(BUILDCUDA, test x$gpu_support = x"yes")
##### CHECK FOR BOOST ###
......
......@@ -376,6 +376,24 @@ public:
return *this;
}
/*! \brief Multiply component wise each box points with a point
*
* \param p point
*
* \return the result box
*
*/
inline Box<dim,T> operator*(const Point<dim,T> & p)
{
Box<dim,T> ret;
for (size_t i = 0 ; i < dim ; i++)
{
ret.setLow(i, getLow(i)*p.get(i));
ret.setHigh(i, getHigh(i)*p.get(i));
}
return ret;
}
/*! \brief Constructor from initializer list
*
......
......@@ -166,6 +166,24 @@ BOOST_AUTO_TEST_CASE( box_use)
}
{
//! [Box operators]
Box<2,float> box({0.5,0.6},{1.4,1.3});
Point<2,float> p({3.0,4.0});
Box<2,float> result;
result = box * p;
BOOST_REQUIRE_CLOSE(result.getHigh(0),4.2,0.0001);
BOOST_REQUIRE_CLOSE(result.getHigh(1),5.2,0.0001);
BOOST_REQUIRE_CLOSE(result.getLow(0),1.5,0.0001);
BOOST_REQUIRE_CLOSE(result.getLow(1),2.4,0.0001);
//! [Box operators]
}
std::cout << "Box unit test stop" << "\n";
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment