7 #define BOOST_TEST_DYN_LINK
8 #define BOOST_TEST_MODULE "Tests mesh interpolation"
10 #include <boost/test/unit_test.hpp>
11 #include <boost/assign/list_of.hpp>
12 #include <boost/assign/std/vector.hpp>
25 using namespace boost;
38 int* argc = &boost::unit_test::framework::master_test_suite().argc;
39 char*** argv = &boost::unit_test::framework::master_test_suite().argv;
51 double c1 = (b -
a) / 2, c2 = (b + a) / 2, sum = 0;
52 for (
int i = 0; i <
P; i++)
65 BOOST_FIXTURE_TEST_SUITE( TestSuite,
Fixture )
92 CFinfo << integrate<1 >(std::exp, 0.,1.) <<
CFendl;
93 CFinfo << integrate<2 >(std::exp, 0.,1.) <<
CFendl;
94 CFinfo << integrate<3 >(std::exp, 0.,1.) <<
CFendl;
95 CFinfo << integrate<4 >(std::exp, 0.,1.) <<
CFendl;
96 CFinfo << integrate<5 >(std::exp, 0.,1.) <<
CFendl;
97 CFinfo << integrate<8 >(std::exp, 0.,1.) <<
CFendl;
98 CFinfo << integrate<10>(std::exp, 0.,1.) <<
CFendl;
133 Eigen::Matrix<Real, ETYPE::nb_nodes, 1> func;
138 Real
x = elem_coords[
n];
143 for(
Uint n=0;
n<QDR::nb_nodes; ++
n)
145 ETYPE::SF::ValueT interpolate = ETYPE::SF::value( QDR::local_coordinates().row(
n) );
147 integral += Jdet * QDR::weights()[
n] * interpolate * func;
149 BOOST_CHECK_CLOSE(integral,
std::pow(b,3.)/3.,1
e-10);
160 Real ax=a*std::sqrt(2.)/2., ay=a*std::sqrt(2.)/2.;
161 Real bx=
b*std::sqrt(2.)/2., by=
b*std::sqrt(2.)/2.;
168 0.5*(ax+bx), 0.5*(ay+by) ;
173 Real
x = elem_coords(
n,
XX);
174 Real
y = elem_coords(
n,
YY);
175 Real r = std::sqrt(x*x+y*y);
180 for(
Uint n=0;
n<qdr->nb_nodes(); ++
n)
184 integral += Jdet * qdr->weights()[
n] * interpolate * func;
186 BOOST_CHECK_CLOSE(integral,
std::pow(
b,3.)/3.,1
e-10);
191 BOOST_AUTO_TEST_SUITE_END()
#define CFinfo
these are always defined
Safe pointer to an object. This is the supported method for referring to components.
external boost library namespace
const RealRowVector & weights() const
virtual Real jacobian_determinant(const RealVector &mapped_coord, const RealMatrix &nodes) const =0
static Real jacobian_determinant(const MappedCoordsT &mapped_coord, const NodesT &nodes)
~Fixture()
common tear-down for each test case
Real e()
Definition of the Unit charge [C].
Lagrange P2 line (1D) Element type This class provides the lagrangian shape function describing the r...
Eigen::Matrix< Real, Eigen::Dynamic, Eigen::Dynamic > RealMatrix
Dynamic sized matrix of Real scalars.
Eigen::Matrix< Real, nb_nodes, Hexa3D_traits::dimension > NodesT
Eigen::Matrix< Real, 1, Eigen::Dynamic > RealRowVector
Dynamic sized row vector.
Basic Classes for Mesh applications used by COOLFluiD.
Eigen::Matrix< Real, Eigen::Dynamic, 1 > RealVector
Dynamic sized column vector.
BOOST_AUTO_TEST_CASE(Line_static)
Top-level namespace for coolfluid.
int m_argc
common values accessed by all tests goes here
unsigned int Uint
typedef for unsigned int
double integrate(double(*f)(double), double a, double b)
possibly common functions used on the tests below
virtual RealRowVector value(const RealVector &local_coordinate) const =0
Compute the shape function values in the given local coordinate.
#define P(a, b, c, d, k, s, t)
Fixture()
common setup for each test case
const RealMatrix & local_coordinates() const
static const Uint nb_nodes
Most basic kernel library.
boost::proto::result_of::make_expr< boost::proto::tag::function, pow_fun< Exp >, Arg const & >::type const pow(Arg const &arg)
boost::proto::result_of::make_expr< boost::proto::tag::function, IntegralTag< boost::mpl::int_< Order > >, ExprT const & >::type const integral(ExprT const &expr)
virtual const ShapeFunction & shape_function() const =0