COOLFluiD  Release kernel
COOLFluiD is a Collaborative Simulation Environment (CSE) focused on complex MultiPhysics simulations.
utest-mesh-deletion.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 heat-conduction related proto operations"
9 
10 #include <boost/test/unit_test.hpp>
11 
12 #include "common/Core.hpp"
13 #include "common/Environment.hpp"
14 #include "common/EventHandler.hpp"
15 #include "common/Log.hpp"
16 #include "common/OptionList.hpp"
17 
19 
20 #include "mesh/Domain.hpp"
21 #include "mesh/Region.hpp"
22 #include "mesh/Dictionary.hpp"
23 
25 
26 
27 using namespace cf3;
28 using namespace cf3::common;
29 using namespace cf3::mesh;
30 
31 BOOST_AUTO_TEST_SUITE( MeshDeletion )
32 
33 // Solve the Stokes equations with artificial dissipation
34 BOOST_AUTO_TEST_CASE( DeleteMesh )
35 {
36  // debug output
37  Core::instance().environment().options().set("log_level", 4u);
38 
39  const Real length = 5.;
40  const Real height = 2.;
41  const Uint x_segments = 25;
42  const Uint y_segments = 10;
43 
45 
46  // Setup a domain
47  Domain& domain = *root.create_component<Domain>("Domain");
48 
49  Handle<Mesh> mesh = domain.create_component<Mesh>("mesh_empty");
50  BOOST_CHECK(is_null(mesh) == false);
51 
52  domain.remove_component("mesh_empty");
53  BOOST_CHECK(is_null(mesh) == true);
54 
55 
56  mesh = domain.create_component<Mesh>("generated_rectangle");
57  Tools::MeshGeneration::create_rectangle(*mesh, length, height, x_segments, y_segments);
58  BOOST_CHECK(is_null(mesh) == false);
59 
60  domain.remove_component("generated_rectangle");
61  BOOST_CHECK(is_null(mesh) == true);
62 
63  if (is_null(mesh))
64  {
65  // Setup a new mesh
66  Tools::MeshGeneration::create_rectangle(*domain.create_component<Mesh>("Mesh2"), length, height, x_segments, y_segments);
67  domain.remove_component("Mesh2");
68  }
69 
70 
72 
73  XML::SignalFrame frame;
74 
75  // Check if any component pings back. No component should respond
76  Core::instance().event_handler().raise_event("ping", frame);
77 }
78 
79 BOOST_AUTO_TEST_SUITE_END()
bool is_null(T ptr)
predicate for comparison to nullptr
Definition: CF.hpp:151
tuple root
Definition: coolfluid.py:24
void terminate()
Definition: Core.cpp:131
void create_rectangle(Mesh &mesh, const Real x_len, const Real y_len, const Uint x_segments, const Uint y_segments)
Create a rectangular, 2D, quad-only mesh. No buffer for creation.
BOOST_AUTO_TEST_CASE(DeleteMesh)
Manages a set of maps.
Definition: SignalFrame.hpp:31
Basic Classes for Mesh applications used by COOLFluiD.
Top-level namespace for coolfluid.
Definition: Action.cpp:18
common::Component & root() const
Gives the default root component.
Definition: Core.cpp:145
common::EventHandler & event_handler() const
Definition: Core.cpp:153
common::Environment & environment() const
Definition: Core.cpp:168
boost::shared_ptr< Component > remove_component(const std::string &name)
Remove a (sub)component of this component.
Definition: Component.cpp:357
unsigned int Uint
typedef for unsigned int
Definition: CF.hpp:90
static Core & instance()
Definition: Core.cpp:37
OptionList & options()
Definition: Component.cpp:856
void raise_event(const std::string &ename, SignalArgs &args)
raises an event and dispatches immedietly to all listeners
Base class for defining CF components.
Definition: Component.hpp:82
void set(const std::string &pname, const boost::any &val)
Definition: OptionList.cpp:132
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
Send comments to:
COOLFluiD Web Admin