COOLFluiD  Release kernel
COOLFluiD is a Collaborative Simulation Environment (CSE) focused on complex MultiPhysics simulations.
utest-mesh-stencilcomputerrings.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 "Tests mesh octtree"
9 
10 #include <boost/test/unit_test.hpp>
11 #include <boost/assign/list_of.hpp>
12 #include <boost/assign/std/vector.hpp>
13 
14 #include "common/Core.hpp"
15 #include "common/Log.hpp"
16 #include "common/OptionList.hpp"
17 #include "common/Table.hpp"
18 
19 #include "mesh/Mesh.hpp"
20 #include "mesh/Elements.hpp"
21 #include "mesh/Space.hpp"
22 #include "mesh/MeshGenerator.hpp"
24 
25 using namespace boost;
26 using namespace boost::assign;
27 using namespace cf3;
28 using namespace cf3::mesh;
29 using namespace cf3::common;
30 
32 
34 {
37  {
38  // uncomment if you want to use arguments to the test executable
39  //int* argc = &boost::unit_test::framework::master_test_suite().argc;
40  //char*** argv = &boost::unit_test::framework::master_test_suite().argv;
41  }
42 
45  {
46  }
47 
49 
50 
52 
53 };
54 
56 
57 BOOST_FIXTURE_TEST_SUITE( StencilComputerRings_TestSuite, StencilComputerRings_Fixture )
58 
59 
61 BOOST_AUTO_TEST_CASE( StencilComputerRings_creation )
62 {
63 
64  // create meshreader
65  boost::shared_ptr< MeshGenerator > mesh_generator = build_component_abstract_type<MeshGenerator>("cf3.mesh.SimpleMeshGenerator","mesh_generator");
66  Core::instance().root().add_component(mesh_generator);
67  mesh_generator->options().set("mesh",Core::instance().root().uri()/"mesh");
68  mesh_generator->options().set("lengths",std::vector<Real>(2,10.));
69  mesh_generator->options().set("nb_cells",std::vector<Uint>(2,5));
70  mesh_generator->options().set("bdry",false);
71  Mesh& mesh = mesh_generator->generate();
73 
74  Handle<StencilComputerRings> stencil_computer = Core::instance().root().create_component<StencilComputerRings>("stencilcomputer");
75  stencil_computer->options().set("dict", dict );
76 
77  SpaceElem space_elem = SpaceElem(mesh.elements()[0]->space(*dict),7);
78  std::vector<SpaceElem> stencil;
79 // stencil_computer->options().set("stencil_size", 10u );
80  stencil_computer->options().set("nb_rings", 1u );
81  stencil_computer->compute_stencil(space_elem, stencil);
82  BOOST_CHECK_EQUAL(stencil.size(), 9u);
83 
84  stencil_computer->options().set("nb_rings", 2u );
85  stencil_computer->compute_stencil(space_elem, stencil);
86  BOOST_CHECK_EQUAL(stencil.size(), 20u);
87 
88  stencil_computer->options().set("nb_rings", 3u );
89  stencil_computer->compute_stencil(space_elem, stencil);
90  BOOST_CHECK_EQUAL(stencil.size(), 25u);
91 
92 }
93 
95 
96 BOOST_AUTO_TEST_SUITE_END()
97 
98 
Safe pointer to an object. This is the supported method for referring to components.
Definition: Handle.hpp:39
const std::vector< Handle< Entities > > & elements() const
Definition: Mesh.hpp:70
external boost library namespace
BOOST_AUTO_TEST_CASE(StencilComputerRings_creation)
common::URI uri(ComponentWrapper &self)
tuple root
Definition: coolfluid.py:24
Basic Classes for Mesh applications used by COOLFluiD.
Compute the stencil around an element, consisting of rings of neighboring cells.
Top-level namespace for coolfluid.
Definition: Action.cpp:18
~StencilComputerRings_Fixture()
common tear-down for each test case
StencilComputerRings_Fixture()
common setup for each test case
Handle< Component > handle()
Get a handle to the component.
Definition: Component.hpp:179
OptionList & options()
Definition: Component.cpp:856
Dictionary & geometry_fields() const
Definition: Mesh.cpp:339
void set(const std::string &pname, const boost::any &val)
Definition: OptionList.cpp:132
Most basic kernel library.
Definition: Action.cpp:19
Send comments to:
COOLFluiD Web Admin