COOLFluiD  Release kernel
COOLFluiD is a Collaborative Simulation Environment (CSE) focused on complex MultiPhysics simulations.
utest-mesh-actions-global-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 mesh::actions::GlobalConnectivity"
9 
10 #include <boost/test/unit_test.hpp>
11 
12 #include "common/Log.hpp"
13 #include "common/OptionList.hpp"
14 #include "common/Core.hpp"
15 #include "common/List.hpp"
16 
17 #include "common/PE/debug.hpp"
18 #include "common/PE/Comm.hpp"
19 
22 #include "mesh/MeshTransformer.hpp"
23 #include "mesh/MeshWriter.hpp"
24 #include "mesh/Mesh.hpp"
25 #include "mesh/Region.hpp"
26 #include "mesh/Dictionary.hpp"
27 #include "mesh/MeshReader.hpp"
28 
29 using namespace cf3;
30 using namespace cf3::common;
31 using namespace cf3::mesh;
32 using namespace cf3::mesh::actions;
33 using namespace cf3::common::PE;
34 
36 
38 {
41  {
42  m_argc = boost::unit_test::framework::master_test_suite().argc;
43  m_argv = boost::unit_test::framework::master_test_suite().argv;
44  }
45 
48  {
49  }
50 
52 
53  int m_argc;
54  char** m_argv;
55 
58 };
59 
61 
63 
64 BOOST_FIXTURE_TEST_SUITE( TestGlobalConnectivity_TestSuite, TestGlobalConnectivity_Fixture )
65 
66 
69 {
70  Core::instance().initiate(m_argc,m_argv);
71  PE::Comm::instance().init(m_argc,m_argv);
72 }
73 
75 
77 {
78  Core::instance().initiate(m_argc,m_argv);
79 
80  boost::shared_ptr< MeshReader > meshreader = build_component_abstract_type<MeshReader>("cf3.mesh.neu.Reader","meshreader");
81  meshreader->options().set("read_boundaries",false);
82  meshreader->read_mesh_into("../../../resources/quadtriag.neu",*mesh);
83 
84 
85  boost::shared_ptr<GlobalNumbering> build_glb_numbering = allocate_component<GlobalNumbering>("build_glb_numbering");
86  build_glb_numbering->set_mesh(mesh);
87  build_glb_numbering->options().set("debug",true);
88  build_glb_numbering->execute();
89 
90  boost::shared_ptr<GlobalConnectivity> build_connectivity = allocate_component<GlobalConnectivity>("build_glb_connectivity");
91  build_connectivity->set_mesh(mesh);
92  build_connectivity->execute();
93 
95  std::cout << "rank = " << Comm::instance().rank() << std::endl;
96  std::cout << "nodes = " << mesh->geometry_fields().glb_idx() << std::endl;
97  std::cout << "ranks = " << mesh->geometry_fields().rank() << std::endl;
98  boost_foreach(const Entities& entities, mesh->topology().elements_range())
99  {
100  std::cout << "elems = " << entities.glb_idx() << std::endl;
101  }
102 
103  )
104 }
105 
107 
109 {
112 }
113 
115 
116 BOOST_AUTO_TEST_SUITE_END()
117 
118 
static Handle< Mesh > mesh
common values accessed by all tests goes here
int m_argc
possibly common functions used on the tests below
#define boost_foreach
lowercase version of BOOST_FOREACH
Definition: Foreach.hpp:16
TestGlobalConnectivity_Fixture()
common setup for each test case
void terminate()
Definition: Core.cpp:131
common::List< Uint > & glb_idx()
Mutable access to the list of nodes.
Definition: Entities.hpp:66
Basic Classes for Mesh applications used by COOLFluiD.
void initiate(int argc, char **argv)
Definition: Core.cpp:98
void init(int argc=0, char **args=0)
Definition: Comm.cpp:80
Top-level namespace for coolfluid.
Definition: Action.cpp:18
common::Component & root() const
Gives the default root component.
Definition: Core.cpp:145
Action derived classes for mesh manipulations.
Classes offering a MPI interface for COOLFluiD.
Definition: all_gather.hpp:39
static Core & instance()
Definition: Core.cpp:37
static Comm & instance()
Return a reference to the current PE.
Definition: Comm.cpp:44
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
~TestGlobalConnectivity_Fixture()
common tear-down for each test case
#define PEProcessSortedExecute(irank, expression)
Definition: debug.hpp:43
Send comments to:
COOLFluiD Web Admin