7 #define BOOST_TEST_DYN_LINK
8 #define BOOST_TEST_MODULE "Test module for the LagrangeP1 Line3D Element types"
10 #include <boost/assign/list_of.hpp>
11 #include <boost/test/unit_test.hpp>
45 10., 3., 3.).finished())
59 const Real start_angle = 0.;
64 coord_array.
resize(boost::extents[segments + 1][dim]);
68 conn_array.
resize(boost::extents[segments][nb_nodes]);
69 const Real height_step = height /
segments;
72 const Real
theta = start_angle + (end_angle - start_angle) * (static_cast<Real>(u) /
static_cast<Real
>(
segments));
75 coord_row[
XX] = radius * cos(theta);
76 coord_row[
YY] = radius * sin(theta);
77 coord_row[
ZZ] = u*height_step;
84 coord_row[
XX] = radius * cos(end_angle);
85 coord_row[
YY] = radius * sin(end_angle);
86 coord_row[
ZZ] = segments * height_step;
110 template<
typename NodesT>
118 result += jac(0, i) * jac(0, i);
131 template<
typename ResultT,
typename FunctorT>
134 const Uint nb_elems = connectivity.
array().size();
135 for(
Uint elem_idx = 0; elem_idx != nb_elems; ++ elem_idx)
138 fill(nodes, coordinates, connectivity.
array()[elem_idx]);
144 template<
typename ResultT,
typename FunctorT,
typename NodesT>
147 static const double mu = 0.;
148 static const double w = 2.;
150 result += w * functor(mapped_coords, nodes);
162 nodes_line3D << 2., 2., 2.,
164 BOOST_CHECK_EQUAL(
ETYPE::length(nodes_line3D),std::sqrt(3.));
169 ETYPE::SF::ValueT reference_result;
170 reference_result << 0.4, 0.6;
171 ETYPE::SF::ValueT result;
172 ETYPE::SF::compute_value(mapped_coords, result);
174 vector_test(result, reference_result, accumulator);
180 ETYPE::SF::GradientT result;
181 ETYPE::SF::GradientT expected(-0.5, 0.5);
182 ETYPE::SF::compute_gradient(mapped_coords, result);
200 ConstFunctor ftor(
nodes);
210 gauss_integrate<1, GeoShape::LINE>(ftor, ftor.mapped_coords,
result1);
211 gauss_integrate<2, GeoShape::LINE>(ftor, ftor.mapped_coords,
result2);
212 gauss_integrate<4, GeoShape::LINE>(ftor, ftor.mapped_coords, result4);
213 gauss_integrate<8, GeoShape::LINE>(ftor, ftor.mapped_coords, result8);
214 gauss_integrate<16, GeoShape::LINE>(ftor, ftor.mapped_coords, result16);
215 gauss_integrate<32, GeoShape::LINE>(ftor, ftor.mapped_coords, result32);
217 BOOST_CHECK_CLOSE(result1, len, 0.00001);
218 BOOST_CHECK_CLOSE(result2, len, 0.00001);
219 BOOST_CHECK_CLOSE(result4, len, 0.00001);
220 BOOST_CHECK_CLOSE(result8, len, 0.00001);
221 BOOST_CHECK_CLOSE(result16, len, 0.00001);
222 BOOST_CHECK_CLOSE(result32, len, 0.00001);
228 const Real radius = 1.;
229 const Real height = 5.;
230 const Real tours = 3.;
236 create_helix(*coordinates, *connectivity, radius, height, tours, segments);
246 BOOST_AUTO_TEST_SUITE_END()
LagrangeP1Line3DFixture()
common setup for each test case
void create_helix(Table< Real > &coordinates, Table< Uint > &connectivity, const Real radius, const Real height, const Real tours, const Uint segments)
Fills the given coordinate and connectivity data to create a helix along the Z-axis, consisting of ETYPE elements.
Returns the norm of the tangen vector to the curve.
void integrate_element(ResultT &result, FunctorT functor, const NodesT &nodes)
Integral over an element.
Basic Classes for Mathematical applications used by COOLFluiD.
static void compute_jacobian(const MappedCoordsT &mapped_coord, const NodesT &nodes, MatrixType &jacobian)
~LagrangeP1Line3DFixture()
common tear-down for each test case
Real max(const Real a, const Real b)
Maximum between two scalars.
boost::proto::terminal< SFOp< NodesOp > >::type const nodes
void integrate_region(ResultT &result, FunctorT functor, const Table< Real > &coordinates, const Table< Uint > &connectivity)
Integral over a region.
Eigen::Matrix< Real, nb_nodes, Hexa3D_traits::dimension > NodesT
BOOST_AUTO_TEST_CASE(Length)
Lagrange P1 Triangular Element type This class provides the lagrangian shape function describing the ...
Real pi()
Definition of the Pi constant.
static const Uint dimension
Basic Classes for Mesh applications used by COOLFluiD.
namespace holding LagrangeP1 shape functions and elements
ConstFunctor(const NodesT &node_list)
Top-level namespace for coolfluid.
void fill(NodeValuesT &to_fill, const common::Table< Real > &data_array, const RowT &element_row, const Uint start=0)
Fill STL-vector like per-node data storage.
ETYPE::MappedCoordsT mapped_coords
Functions to provide integration over elements.
Real square(const Real a)
Real operator()(const ETYPE::MappedCoordsT &mapped_coords, const NodesT &nodes)
boost::proto::terminal< SFOp< CoordinatesOp > >::type const coordinates
Hexa3D_traits::SF::MappedCoordsT MappedCoordsT
void set_row_size(const Uint nb_cols)
unsigned int Uint
typedef for unsigned int
Eigen::Matrix< Real, Hexa3D_traits::SF::dimensionality, Hexa3D_traits::dimension > JacobianT
static const Uint nb_nodes
Most basic kernel library.
boost::shared_ptr< T > allocate_component(const std::string &name)
Stand-alone function to allocate components of a given type.
2D Lagrange P1 Triangular Element type This class provides the lagrangian shape function describing t...
Real square(const Real x)
virtual void resize(const Uint nb_rows)
const ETYPE::MappedCoordsT mapped_coords