COOLFluiD  Release kernel
COOLFluiD is a Collaborative Simulation Environment (CSE) focused on complex MultiPhysics simulations.
utest-mesh-loadmesh.cpp
Go to the documentation of this file.
1 // Copyright (C) 2010-2013 von Karman Institute for Fluid Dynamics, Belgium
2 //
3 // This software is distributed under the terms of the
4 // GNU Lesser General Public License version 3 (LGPLv3).
5 // See doc/lgpl.txt and doc/gpl.txt for the license text.
6 
7 #define BOOST_TEST_DYN_LINK
8 #define BOOST_TEST_MODULE "Test module for cf3::mesh::LoadMesh"
9 
10 #include <boost/test/unit_test.hpp>
11 
12 
14 #include "common/Log.hpp"
15 #include "common/OptionList.hpp"
16 #include "common/Link.hpp"
17 #include "common/List.hpp"
18 #include "common/Foreach.hpp"
19 #include "common/Core.hpp"
20 #include "common/OptionArray.hpp"
21 #include "common/OptionT.hpp"
22 #include "common/OptionURI.hpp"
23 
26 
27 #include "mesh/Domain.hpp"
28 #include "mesh/MeshWriter.hpp"
29 
30 #include "mesh/LoadMesh.hpp"
31 
32 using namespace cf3;
33 using namespace cf3::common;
34 using namespace cf3::common::XML;
35 using namespace cf3::mesh;
36 
38 
39 BOOST_AUTO_TEST_SUITE( LoadMesh_Suite )
40 
41 
43 BOOST_AUTO_TEST_CASE( constructor )
44 {
45  BOOST_CHECK(true);
46 
48 
49  BOOST_CHECK(true);
50 
51  Handle<LoadMesh> load_mesh = Core::instance().root().create_component<LoadMesh>("load_mesh");
52 
53  BOOST_CHECK(true);
54 
55  SignalFrame frame;
56  SignalOptions options;
57 
58  // everything is OK
59  std::vector<URI> files;
60  files.push_back( "file:../../resources/rotation-tg-p1.neu" );
61  options.add("mesh", domain->uri()/URI("Mesh") );
62  options.add("files", files);
63 
64  frame = options.create_frame("Target", "/", "/");
65 
66  load_mesh->signal_load_mesh(frame);
67 }
68 
70 
72 {
73  Domain& domain = find_component_recursively<Domain>(Core::instance().root());
74  Handle< Mesh > mesh(domain.get_child_checked("Mesh"));
75  boost::shared_ptr< MeshWriter > mesh_writer = build_component_abstract_type<MeshWriter> ( "cf3.mesh.gmsh.Writer", "GmshWriter" );
76  mesh_writer->write_from_to(*mesh,"utest-loadmesh-result.msh");
77 }
78 
80 
81 BOOST_AUTO_TEST_SUITE_END()
82 
83 
Abstracts the use of XML when adding options to a signal frame.
Classes that implement the XML protocol for use in COOLFluiD.
Definition: Component.hpp:43
URI uri() const
Construct the full path.
Definition: Component.cpp:248
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.
Handle< Component > get_child_checked(const std::string &name)
Definition: Component.cpp:458
Manages a set of maps.
Definition: SignalFrame.hpp:31
Basic Classes for Mesh applications used by COOLFluiD.
void signal_load_mesh(common::SignalArgs &node)
signal to load the mesh
Definition: LoadMesh.cpp:175
Top-level namespace for coolfluid.
Definition: Action.cpp:18
common::Component & root() const
Gives the default root component.
Definition: Core.cpp:145
static Core & instance()
Definition: Core.cpp:37
SelectOptionType< T >::type & add(const std::string &name, const T &default_value=T())
Definition: OptionList.hpp:45
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.
Definition: Component.cpp:568
Most basic kernel library.
Definition: Action.cpp:19
BOOST_AUTO_TEST_CASE(constructor)
Send comments to:
COOLFluiD Web Admin