COOLFluiD  Release kernel
COOLFluiD is a Collaborative Simulation Environment (CSE) focused on complex MultiPhysics simulations.
utest-mesh-face-cell-connectivity.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 cf3::mesh::FaceCellConnectivity"
9 
10 #include <boost/test/unit_test.hpp>
11 #include <boost/assign/list_of.hpp>
12 
13 #include "common/Log.hpp"
14 #include "common/OptionList.hpp"
15 #include "common/Core.hpp"
17 
19 
20 #include "mesh/Mesh.hpp"
21 #include "mesh/Elements.hpp"
22 #include "mesh/Dictionary.hpp"
23 #include "mesh/Region.hpp"
24 #include "mesh/MeshReader.hpp"
28 
29 using namespace boost;
30 using namespace boost::assign;
31 using namespace cf3;
32 using namespace cf3::mesh;
33 using namespace cf3::common;
34 using namespace cf3::Tools;
35 
37 
38 struct FaceCellConnectivity_Fixture //: public Testing::TimedTestFixture
39 {
42  {
43  // uncomment if you want to use arguments to the test executable
44  //int* argc = &boost::unit_test::framework::master_test_suite().argc;
45  //char*** argv = &boost::unit_test::framework::master_test_suite().argv;
46 
47  }
48 
51  {
52  }
53 
55 
56 
59 };
60 
63 
64 BOOST_FIXTURE_TEST_SUITE( FaceCellConnectivity_TestSuite, FaceCellConnectivity_Fixture )
65 
66 
68 BOOST_AUTO_TEST_CASE( Constructors )
69 {
70  boost::shared_ptr<FaceCellConnectivity> c = allocate_component<FaceCellConnectivity>("faces_to_cells");
71  BOOST_CHECK_EQUAL(c->name(),"faces_to_cells");
72  BOOST_CHECK_EQUAL(FaceCellConnectivity::type_name(), "FaceCellConnectivity");
73 }
74 
76 
78 {
79 
80  // create meshreader
81  // boost::shared_ptr< MeshReader > meshreader = build_component_abstract_type<MeshReader>("cf3.mesh.neu.Reader","meshreader");
82  // boost::filesystem::path fp_source ("quadtriag.neu");
83  // m_mesh = meshreader->create_mesh_from(fp_source);
84 
85  m_mesh = Core::instance().root().create_component<Mesh>("mesh");
86  Uint scale = 2;
87  std::vector<Real> lengths = list_of(4.)(2.);
88  std::vector<Uint> nb_cells = list_of(scale*2u)(scale*2u);
89  SimpleMeshGenerator& mesh_gen = *Core::instance().root().create_component<SimpleMeshGenerator>("mesh_gen");
90  mesh_gen.options().set("mesh",m_mesh->uri());
91  mesh_gen.options().set("lengths",lengths);
92  mesh_gen.options().set("nb_cells",nb_cells);
93  mesh_gen.execute();
94  BOOST_CHECK(true);
95 }
97 
98 BOOST_AUTO_TEST_CASE( face_elem_connectivity )
99 {
100 
101  // create and setup node to elements connectivity
102  Handle<FaceCellConnectivity> c = m_mesh->create_component<FaceCellConnectivity>("face_cell_connectivity");
103  c->setup( find_component<Region>(*m_mesh) );
104 
105  BOOST_CHECK_EQUAL(c->connectivity().size() , 40u);
106 
107  CFinfo << "nodes of face 0 : ";
108  boost_foreach(const Uint node, c->face_nodes(0) )
109  CFinfo << " " << node;
110  CFinfo << CFendl;
111  // Output whole node to elements connectivity
112  //CFinfo << c->connectivity() << CFendl;
113 }
114 
116 
117 BOOST_AUTO_TEST_SUITE_END()
118 
119 
static Handle< Mesh > m_mesh
possibly common functions used on the tests below
#define CFinfo
these are always defined
Definition: Log.hpp:104
FaceCellConnectivity_Fixture()
common setup for each test case
void create_mesh(const ImplicitFunction &function, Mesh &mesh, const MeshParameters parameters)
Using the given implicit function delimiting a domain,.
~FaceCellConnectivity_Fixture()
common tear-down for each test case
external boost library namespace
std::string type_name(const boost::python::api::object &python_object)
Definition: PythonAny.cpp:283
#define boost_foreach
lowercase version of BOOST_FOREACH
Definition: Foreach.hpp:16
Helpful non-essential libraries to use with COOLFluiD.
#define CFendl
Definition: Log.hpp:109
Handle< Component const > root() const
Definition: Component.cpp:266
Uint size() const
Definition: Table.hpp:127
Generate a simple carthesian P1 mesh without grading.
ElementConnectivity & connectivity()
const access to the node to element connectivity table in unified indices
Basic Classes for Mesh applications used by COOLFluiD.
Top-level namespace for coolfluid.
Definition: Action.cpp:18
BOOST_AUTO_TEST_CASE(Constructors)
unsigned int Uint
typedef for unsigned int
Definition: CF.hpp:90
std::vector< Uint > face_nodes(const Uint face) const
OptionList & options()
Definition: Component.cpp:856
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