7 #define BOOST_TEST_DYN_LINK
8 #define BOOST_TEST_MODULE "Tests mesh octtree"
10 #include <boost/test/unit_test.hpp>
11 #include <boost/assign/list_of.hpp>
12 #include <boost/assign/std/vector.hpp>
35 using namespace boost;
49 m_argc = boost::unit_test::framework::master_test_suite().argc;
50 m_argv = boost::unit_test::framework::master_test_suite().argv;
77 PE::Comm::instance().init(m_argc,m_argv);
85 boost::shared_ptr< MeshGenerator >
mesh_generator = build_component_abstract_type<MeshGenerator>(
"cf3.mesh.SimpleMeshGenerator",
"mesh_generator");
86 Core::instance().root().add_component(mesh_generator);
87 mesh_generator->options().set(
"mesh",Core::instance().
root().
uri()/
"mesh");
88 mesh_generator->options().set(
"lengths",std::vector<Real>(2,10.));
89 mesh_generator->options().set(
"nb_cells",std::vector<Uint>(2,5));
90 mesh_generator->options().set(
"part",0u);
91 mesh_generator->options().set(
"nb_parts",1u);
93 Mesh&
mesh = mesh_generator->generate();
98 octtree.
options().
set(
"nb_elems_per_cell", 1u );
99 octtree.options().set(
"mesh", mesh.
handle<
Mesh>());
102 std::vector<Uint> nb_cells = boost::assign::list_of(5)(5);
103 octtree.options().set(
"nb_cells", nb_cells );
111 element = octtree.find_element(coord);
112 BOOST_CHECK_EQUAL(element.
idx,0u);
115 element = octtree.find_element(coord);
116 BOOST_CHECK_EQUAL(element.
idx,1u);
119 element = octtree.find_element(coord);
120 BOOST_CHECK_EQUAL(element.
idx,5u);
124 stencil_computer->
options().
set(
"dict", dict );
127 std::vector<SpaceElem> stencil;
128 stencil_computer->
options().
set(
"stencil_size", 1u );
130 BOOST_CHECK_EQUAL(stencil.size(), 1u);
132 stencil_computer->
options().
set(
"stencil_size", 2u );
134 BOOST_CHECK_EQUAL(stencil.size(), 9u);
136 stencil_computer->
options().
set(
"stencil_size", 10u );
138 BOOST_CHECK_EQUAL(stencil.size(), 20u);
140 stencil_computer->
options().
set(
"stencil_size", 21u );
142 BOOST_CHECK_EQUAL(stencil.size(), 25u);
153 mesh_generator->
options().
set(
"mesh",Core::instance().
root().
uri()/
"parallel_mesh");
154 mesh_generator->
options().
set(
"lengths",std::vector<Real>(2,10.));
155 mesh_generator->
options().
set(
"nb_cells",std::vector<Uint>(2,5));
156 mesh_generator->
options().
set(
"part",PE::Comm::instance().rank());
157 mesh_generator->
options().
set(
"nb_parts",PE::Comm::instance().size());
163 octtree.
options().
set(
"nb_elems_per_cell", 1u );
168 std::vector<Uint> nb_cells = boost::assign::list_of(5)(5);
172 coordinates.resize(boost::extents[2][2]);
173 coordinates[0][
XX] = 5.; coordinates[0][
YY] = 2.5;
174 coordinates[1][
XX] = 5.; coordinates[1][
YY] = 7.5;
176 std::vector<Uint>
ranks;
179 BOOST_CHECK_EQUAL(ranks[0] , 0u);
180 BOOST_CHECK_EQUAL(ranks[1] , 1u);
191 PE::Comm::instance().finalize();
196 BOOST_AUTO_TEST_SUITE_END()
#define CFinfo
these are always defined
boost::python::object get_child(ComponentWrapper &self, const std::string &name)
Safe pointer to an object. This is the supported method for referring to components.
const std::vector< Handle< Entities > > & elements() const
external boost library namespace
BOOST_AUTO_TEST_CASE(init)
common::URI uri(ComponentWrapper &self)
~Octtree_Fixture()
common tear-down for each test case
void find_cell_ranks(const boost::multi_array< Real, 2 > &coordinates, std::vector< Uint > &ranks)
int m_argc
possibly common functions used on the tests below
Mesh & generate()
generate, wraps execute() and returns the mesh reference
Basic Classes for Mesh applications used by COOLFluiD.
Top-level namespace for coolfluid.
std::string tree(bool basic_mode=false, Uint depth=0, Uint recursion_level=0) const
boost::proto::terminal< SFOp< CoordinatesOp > >::type const coordinates
Low storage struct to uniquely identify one element.
Octtree_Fixture()
common setup for each test case
Eigen::Matrix< Real, 2, 1 > RealVector2
Fixed size 2x1 column vector.
virtual void compute_stencil(const SpaceElem &element, std::vector< SpaceElem > &stencil)
Compute the stencil around a given element.
Handle< Component > handle()
Get a handle to the component.
Dictionary & geometry_fields() const
void set(const std::string &pname, const boost::any &val)
Handle< Component > create_component(const std::string &name, const std::string &builder)
Build a (sub)component of this component using the extended type_name of the component.
Most basic kernel library.