8 #define BOOST_TEST_DYN_LINK
9 #define BOOST_TEST_MODULE "Tests mesh reading"
11 #include <boost/test/unit_test.hpp>
12 #include <boost/foreach.hpp>
13 #include <boost/regex.hpp>
39 using namespace boost;
52 m_argc = boost::unit_test::framework::master_test_suite().argc;
53 m_argv = boost::unit_test::framework::master_test_suite().argv;
55 root = allocate_component<Group>(
"Root");
56 reader = build_component_abstract_type<MeshReader>(
"cf3.mesh.neu.Reader",
"MyReader");
59 root->add_component( reader );
61 ExceptionManager::instance().ExceptionOutputs =
false;
62 ExceptionManager::instance().ExceptionDumps =
false;
71 boost::shared_ptr< Component >
root;
72 boost::shared_ptr< MeshReader >
reader;
89 boost::shared_ptr< MeshReader > meshreader = build_component_abstract_type<MeshReader>(
"cf3.mesh.neu.Reader",
"meshreader");
90 BOOST_CHECK_EQUAL(meshreader->name(),
"meshreader");
91 BOOST_CHECK_EQUAL(meshreader->get_format(),
"neu");
93 boost::shared_ptr< MeshWriter > meshwriter = build_component_abstract_type<MeshWriter>(
"cf3.mesh.gmsh.Writer",
"meshwriter");
94 BOOST_CHECK_EQUAL(meshwriter->name(),
"meshwriter");
95 BOOST_CHECK_EQUAL(meshwriter->get_format(),
"Gmsh");
97 boost::shared_ptr< MeshWriter > neu_writer = build_component_abstract_type<MeshWriter>(
"cf3.mesh.neu.Writer",
"meshwriter");
98 BOOST_CHECK_EQUAL(neu_writer->name(),
"meshwriter");
99 BOOST_CHECK_EQUAL(neu_writer->get_format(),
"neu");
107 boost::shared_ptr< MeshReader > meshreader = build_component_abstract_type<MeshReader>(
"cf3.mesh.neu.Reader",
"meshreader");
110 Mesh&
mesh = *Core::instance().root().create_component<
Mesh> (
"quadtriag" );
112 meshreader->read_mesh_into(
"../../resources/quadtriag.neu",mesh);
114 boost::shared_ptr< MeshWriter > gmsh_writer = build_component_abstract_type<MeshWriter>(
"cf3.mesh.gmsh.Writer",
"meshwriter");
115 BOOST_CHECK_NO_THROW(gmsh_writer->write_from_to(mesh,
"quadtriag.msh"));
117 boost::shared_ptr< MeshWriter > neu_writer = build_component_abstract_type<MeshWriter>(
"cf3.mesh.neu.Writer",
"meshwriter");
118 BOOST_CHECK_NO_THROW(neu_writer->write_from_to(mesh,
"quadtriag_write.neu"));
120 BOOST_CHECK_EQUAL(mesh.topology().recursive_nodes_count(), (
Uint) 16);
121 BOOST_CHECK_EQUAL(mesh.topology().recursive_elements_count(
true), (
Uint) 28);
128 boost::shared_ptr< MeshReader > meshreader = build_component_abstract_type<MeshReader>(
"cf3.mesh.neu.Reader",
"meshreader");
129 boost::shared_ptr< MeshWriter > meshwriter = build_component_abstract_type<MeshWriter>(
"cf3.mesh.gmsh.Writer",
"meshwriter");
132 Mesh&
mesh = *Core::instance().root().create_component<
Mesh> (
"quadtriag_write" );
135 BOOST_CHECK_NO_THROW(meshreader->read_mesh_into(
"quadtriag_write.neu",mesh));
138 BOOST_CHECK_NO_THROW(meshwriter->write_from_to(mesh,
"quadtriag_write.msh"));
139 BOOST_CHECK_EQUAL(mesh.topology().recursive_nodes_count(), (
Uint) 16);
140 BOOST_CHECK_EQUAL(mesh.topology().recursive_elements_count(
true), (
Uint) 28);
150 boost::shared_ptr< MeshReader > meshreader = build_component_abstract_type<MeshReader>(
"cf3.mesh.neu.Reader",
"meshreader");
153 Mesh&
mesh = *Core::instance().root().create_component<
Mesh> (
"hextet" );
155 BOOST_CHECK_NO_THROW(meshreader->read_mesh_into(
"../../resources/hextet.neu",mesh));
157 boost::shared_ptr< MeshWriter > gmsh_writer = build_component_abstract_type<MeshWriter>(
"cf3.mesh.gmsh.Writer",
"meshwriter");
158 BOOST_CHECK_NO_THROW(gmsh_writer->write_from_to(mesh,
"hextet.msh"));
159 boost::shared_ptr< MeshWriter > neu_writer = build_component_abstract_type<MeshWriter>(
"cf3.mesh.neu.Writer",
"meshwriter");
160 BOOST_CHECK_NO_THROW(neu_writer->write_from_to(mesh,
"hextet_write.neu"));
161 BOOST_CHECK_EQUAL(mesh.topology().recursive_nodes_count(), (
Uint) 35);
162 BOOST_CHECK_EQUAL(mesh.topology().recursive_elements_count(
true), (
Uint) 44);
169 boost::shared_ptr< MeshReader > meshreader = build_component_abstract_type<MeshReader>(
"cf3.mesh.neu.Reader",
"meshreader");
170 boost::shared_ptr< MeshWriter > meshwriter = build_component_abstract_type<MeshWriter>(
"cf3.mesh.gmsh.Writer",
"meshwriter");
173 Mesh&
mesh = *Core::instance().root().create_component<
Mesh> (
"hextest_write" );
176 meshreader->read_mesh_into(
"hextet_write.neu",mesh);
179 meshwriter->write_from_to(mesh,
"hextet_write.msh");
180 BOOST_CHECK_EQUAL(mesh.topology().recursive_nodes_count(), (
Uint) 35);
181 BOOST_CHECK_EQUAL(mesh.topology().recursive_elements_count(
true), (
Uint) 44);
216 options.
add(
"domain",
domain->handle() );
229 std::vector<URI> files;
230 options.
add(
"domain",
domain->handle() );
231 options.
add(
"files", files);
240 BOOST_CHECK_EQUAL(
domain->count_children(), (
Uint) 0);
245 BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_CASE(Constructors)
#define CFinfo
these are always defined
Abstracts the use of XML when adding options to a signal frame.
void to_string(const XmlNode &node, std::string &str)
XmlNode node
The frame node.
external boost library namespace
boost::shared_ptr< Component > root
possibly common functions used on the tests below
Classes that implement the XML protocol for use in COOLFluiD.
SignalFrame create_frame(const std::string &name=std::string(), const URI &sender=URI(), const URI &receiver=URI()) const
Creates a frame and puts the options in an "options" map.
int m_argc
common values accessed by all tests goes here
Basic Classes for Mesh applications used by COOLFluiD.
~MeshReading_Fixture()
common tear-down for each test case
Top-level namespace for coolfluid.
unsigned int Uint
typedef for unsigned int
boost::shared_ptr< MeshReader > reader
MeshReading_Fixture()
common setup for each test case
SelectOptionType< T >::type & add(const std::string &name, const T &default_value=T())
Most basic kernel library.