7 #define BOOST_TEST_DYN_LINK
8 #define BOOST_TEST_MODULE "Common tests for shape functions that can be used to model the volume of a mesh"
10 #include <boost/mpl/vector.hpp>
11 #include <boost/mpl/for_each.hpp>
12 #include <boost/mpl/transform_view.hpp>
13 #include <boost/assign/list_of.hpp>
14 #include <boost/test/unit_test.hpp>
16 #include <boost/fusion/adapted/mpl.hpp>
17 #include <boost/fusion/support/pair.hpp>
18 #include <boost/fusion/container/map.hpp>
19 #include <boost/fusion/container/map/convert.hpp>
20 #include <boost/fusion/sequence/intrinsic/at_key.hpp>
39 typedef boost::mpl::vector<
64 template<
typename ETYPE,
typename NodesT,
typename FunctorT>
72 mapped_coord << mapped_coord_min + i *
step;
73 functor(sf, nodes, mapped_coord);
81 template<
typename ETYPE,
typename NodesT,
typename FunctorT>
91 mapped_coord << mapped_coord_min + i *
step, mapped_coord_min + j *
step;
92 functor(sf, nodes, mapped_coord);
101 template<
typename ETYPE,
typename NodesT,
typename FunctorT>
113 mapped_coord << mapped_coord_min + i *
step, mapped_coord_min + j *
step, mapped_coord_min +
k *
step;
114 functor(sf, nodes, mapped_coord);
124 template<
typename SF>
127 typedef boost::fusion::pair<SF, typename SF::NodesT>
type;
131 typedef boost::fusion::result_of::as_map
133 boost::mpl::transform_view
171 0.830434, 0.885201, 0.188108,
172 0.89653, 0.899961, 0.297475,
173 0.888273, 0.821744, 0.211428,
174 0.950439, 0.904872, 0.20736
176 boost::fusion::make_pair< LagrangeP2::Quad2D>( ( LagrangeP2::Quad2D::NodesT() <<
187 boost::fusion::make_pair< LagrangeP2::Triag2D>( ( LagrangeP2::Triag2D::NodesT() <<
195 boost::fusion::make_pair< LagrangeP3::Quad2D>( ( LagrangeP3::Quad2D::NodesT() <<
213 boost::fusion::make_pair< LagrangeP3::Triag2D>( ( LagrangeP3::Triag2D::NodesT() <<
233 template<
typename FunctorT>
242 CFinfo <<
"---------------------- Start " << allocate_component< ElementTypeT<ETYPE> >(
"lala")->
derived_type_name() <<
" test ----------------------" <<
CFendl;
263 template<
typename ETYPE,
typename NodesT,
typename MappedCoordsT>
267 typename ETYPE::SF::GradientT mapped_grad;
268 ETYPE::SF::compute_gradient(mapped_coordinates,mapped_grad);
280 template<
typename ETYPE,
typename NodesT,
typename CoordsT>
292 template<
typename ETYPE,
typename NodesT,
typename CoordsT>
309 BOOST_CHECK_CLOSE(identity(i, j), 1., 1
e-6);
311 BOOST_CHECK_SMALL(identity(i, j), 1
e-14);
320 template<
typename ETYPE,
typename NodesT,
typename CoordsT>
332 BOOST_CHECK_CLOSE(grad[0], 1, 1
e-6);
333 for(
Uint i = 1; i != grad.size(); ++i)
334 BOOST_CHECK_SMALL(grad[i], 1
e-14);
348 VolumeMPLFunctor<CheckJacobianDeterminant> functor(
nodes);
349 boost::mpl::for_each<TestCellTypes>(functor);
356 VolumeMPLFunctor<CheckJacobianInverse> functor(
nodes);
357 boost::mpl::for_each<TestCellTypes>(functor);
364 VolumeMPLFunctor<CheckGradientX> functor(
nodes);
365 boost::mpl::for_each<TestCellTypes>(functor);
370 BOOST_AUTO_TEST_SUITE_END()
Functor to create a fusion pair between a shape function and its node matrix.
void operator()(const ETYPE &T, const NodesT &nodes, const CoordsT &mapped_coord)
boost::proto::terminal< SFOp< JacobianOp > >::type const jacobian
boost::mpl::filter_view< TestTypes, IsCellType > TestCellTypes
#define CFinfo
these are always defined
boost::fusion::result_of::as_map< boost::mpl::transform_view< TestTypes, MakeSFNodesPair< boost::mpl::_1 > > >::type NodesMapT
Map between a shape function and its node matrix. Used to store nodes for each possible test...
static void compute_jacobian_adjoint(const MappedCoordsT &mapped_coord, const NodesT &nodes, JacobianT &result)
VolumeSFFixture()
common setup for each test case
void operator()(const Uint segments, const ETYPE &sf, const NodesT &nodes, FunctorT &functor)
Checks if the jacobian_determinant function result is the same as det(jacobian)
void operator()(const Uint segments, const ETYPE &sf, const NodesT &nodes, FunctorT &functor)
2D Lagrange P1 Triangular Element type This class provides the lagrangian shape function describing t...
external boost library namespace
static void compute_jacobian(const MappedCoordsT &mapped_coord, const NodesT &nodes, MatrixType &jacobian)
static Real jacobian_determinant(const MappedCoordsT &mapped_coord, const NodesT &nodes)
void operator()(const ETYPE &T, const NodesT &nodes, const CoordsT &mapped_coord)
static const GeoShape::Type shape
2D Lagrange P1 Triangular Element type This class provides the lagrangian shape function describing t...
Applies a functor if the element is a volume element.
void operator()(const ETYPE &T)
2D Lagrange P3 Triangular Element type This class provides the lagrangian shape function describing t...
Real e()
Definition of the Unit charge [C].
boost::proto::terminal< SFOp< NodesOp > >::type const nodes
2D Lagrange P3 Quadrilateral Element type This class provides the lagrangian shape function describin...
const NodesMapT & m_nodes
boost::mpl::filter_view< TestTypes, IsEdgeType > TestEdgeTypes
boost::mpl::filter_view< TestTypes, IsFaceType > TestFaceTypes
void operator()(const ETYPE &T, const NodesT &nodes, const CoordsT &mapped_coord)
Lagrange P1 Triangular Element type This class provides the lagrangian shape function describing the ...
static const Uint dimension
Basic Classes for Mesh applications used by COOLFluiD.
Eigen::Matrix< Real, Eigen::Dynamic, 1 > RealVector
Dynamic sized column vector.
boost::mpl::vector1< mesh::LagrangeP1::Triag2D > LagrangeP1
2D Lagrange P2 Quadrilateral Element type This class provides the lagrangian shape function describin...
Top-level namespace for coolfluid.
static std::string type_name()
VolumeMPLFunctor(const NodesMapT &nodes)
ETYPE::CoordsT gradient(const NodesT &nodes, const MappedCoordsT &mapped_coordinates, const RealVector &function_values)
Eigen::Matrix< Real, Hexa3D_traits::dimension, 1 > CoordsT
std::string derived_type_name(ComponentWrapper &self)
BOOST_AUTO_TEST_CASE(TestJacobianDeterminant)
Hexa3D_traits::SF::MappedCoordsT MappedCoordsT
void operator()(const Uint segments, const ETYPE &sf, const NodesT &nodes, FunctorT &functor)
common::Environment & environment() const
unsigned int Uint
typedef for unsigned int
boost::mpl::vector< LagrangeP1::Line1D, LagrangeP1::Quad2D, LagrangeP1::Triag2D, LagrangeP1::Hexa3D, LagrangeP1::Tetra3D, LagrangeP2::Quad2D, LagrangeP2::Triag2D, LagrangeP3::Quad2D, LagrangeP3::Triag2D > TestTypes
Check if the gradient of X is one in the X direction and zero in the other directions.
boost::fusion::pair< SF, typename SF::NodesT > type
Checks if the inverse of the jacobian matrix equals jacobian_adjoint / jacobian_determinant.
2D Lagrange P2 Triangular Element type This class provides the lagrangian shape function describing t...
Eigen::Matrix< Real, Hexa3D_traits::SF::dimensionality, Hexa3D_traits::dimension > JacobianT
static const Uint dimensionality
static const Uint nb_nodes
void set(const std::string &pname, const boost::any &val)
Most basic kernel library.
2D Lagrange P1 Quadrilateral Element type This class provides the lagrangian shape function describin...
2D Lagrange P1 Triangular Element type This class provides the lagrangian shape function describing t...