8 #define BOOST_TEST_DYN_LINK
9 #define BOOST_TEST_MODULE "Test module for cf3::math::LSS where testing indivdual operations."
15 #include <boost/test/unit_test.hpp>
16 #include <boost/assign/std/vector.hpp>
17 #include <boost/lexical_cast.hpp>
41 solvertype(
"Trilinos"),
52 if (common::PE::Comm::instance().is_initialized())
54 nproc=common::PE::Comm::instance().size();
55 irank=common::PE::Comm::instance().rank();
56 BOOST_CHECK_EQUAL(nproc,2);
58 m_argc = boost::unit_test::framework::master_test_suite().argc;
59 m_argv = boost::unit_test::framework::master_test_suite().argv;
77 rank_updatable += 0,0,1;
80 rank_updatable += 0,1,1;
82 cp.
insert(
"gid",gid,1,
false);
91 node_connectivity += 0,1,0,1,2,1,2;
92 starting_indices += 0,2,5,7;
96 node_connectivity += 0,1,0,1,2,1,2;
97 starting_indices += 0,2,5,7;
101 sys.
create(cp,neq,node_connectivity,starting_indices);
135 common::PE::Comm::instance().init(m_argc,m_argv);
136 BOOST_CHECK_EQUAL(common::PE::Comm::instance().is_active(),
true);
137 CFinfo.setFilterRankZero(
false);
138 common::Core::instance().environment().options().set(
"log_level", 4u);
139 common::Core::instance().environment().options().set(
"exception_backtrace",
false);
140 common::Core::instance().environment().options().set(
"exception_outputs",
false);
149 boost::shared_ptr<common::PE::CommPattern> cp_ptr = common::allocate_component<common::PE::CommPattern>(
"commpattern");
151 build_commpattern(cp);
152 boost::shared_ptr<LSS::System> sys(common::allocate_component<LSS::System>(
"sys"));
153 sys->options().option(
"matrix_builder").change_value(
matrix_builder);
154 build_system(*sys,cp);
155 BOOST_CHECK_EQUAL(sys->is_created(),
true);
156 BOOST_CHECK_EQUAL(sys->solvertype(),solvertype);
158 sys->matrix()->set_row(0, 0, 2, 1);
159 sys->matrix()->set_row(1, 0, 2, 1);
160 sys->matrix()->set_row(2, 0, 2, 1);
163 sys->matrix()->symmetric_dirichlet(1, 0, 10., *sys->rhs());
165 sys->matrix()->symmetric_dirichlet(0, 0, 10., *sys->rhs());
167 sys->rhs()->print_native(std::cout);
172 sys->matrix()->get_value(0, 0, val);
173 BOOST_CHECK_EQUAL(val, 2.);
174 sys->matrix()->get_value(1, 0, val);
175 BOOST_CHECK_EQUAL(val, 0.);
176 sys->matrix()->get_value(0, 1, val);
177 BOOST_CHECK_EQUAL(val, 0.);
178 sys->matrix()->get_value(1, 1, val);
179 BOOST_CHECK_EQUAL(val, 1.);
180 sys->matrix()->get_value(2, 1, val);
181 BOOST_CHECK_EQUAL(val, 0.);
183 sys->rhs()->get_value(0, val);
184 BOOST_CHECK_EQUAL(val, -10.);
185 sys->rhs()->get_value(1, val);
186 BOOST_CHECK_EQUAL(val, 10.);
190 sys->matrix()->get_value(0, 1, val);
191 BOOST_CHECK_EQUAL(val, 0.);
192 sys->matrix()->get_value(1, 1, val);
193 BOOST_CHECK_EQUAL(val, 2.);
194 sys->matrix()->get_value(2, 1, val);
195 BOOST_CHECK_EQUAL(val, 1.);
196 sys->matrix()->get_value(1, 2, val);
197 BOOST_CHECK_EQUAL(val, 1.);
198 sys->matrix()->get_value(2, 2, val);
199 BOOST_CHECK_EQUAL(val, 2.);
201 sys->rhs()->get_value(0, val);
202 BOOST_CHECK_EQUAL(val, 10.);
203 sys->rhs()->get_value(1, val);
204 BOOST_CHECK_EQUAL(val, -10.);
205 sys->rhs()->get_value(2, val);
206 BOOST_CHECK_EQUAL(val, 0.);
214 CFinfo.setFilterRankZero(
true);
215 common::PE::Comm::instance().finalize();
216 BOOST_CHECK_EQUAL(common::PE::Comm::instance().is_active(),
false);
221 BOOST_AUTO_TEST_SUITE_END()
#define CFinfo
these are always defined
void create(cf3::common::PE::CommPattern &cp, Uint neq, std::vector< Uint > &node_connectivity, std::vector< Uint > &starting_indices, const std::vector< Uint > &periodic_links_nodes=std::vector< Uint >(), const std::vector< bool > &periodic_links_active=std::vector< bool >())
Safe pointer to an object. This is the supported method for referring to components.
~LSSSymmetricDirichletFixture()
common tear-down for each test case
This header collects all the headers needed for the linear system solver, also including configure-ti...
Basic Classes for Mathematical applications used by COOLFluiD.
void setup(const Handle< CommWrapper > &gid, std::vector< Uint > &rank)
void build_system(LSS::System &sys, common::PE::CommPattern &cp)
build a test system
std::vector< Uint > node_connectivity
system builds
std::string matrix_builder
void insert(const std::string &name, T *&data, const int size, const unsigned int stride=1, const bool needs_update=true)
std::vector< Uint > starting_indices
void build_commpattern(common::PE::CommPattern &cp)
create a test commpattern
LSSSymmetricDirichletFixture()
common setup for each test case
Handle< Component > get_child(const std::string &name)
Top-level namespace for coolfluid.
std::vector< Uint > rank_updatable
std::vector< Uint > gid
commpattern builds
BOOST_AUTO_TEST_CASE(init_mpi)
std::string solvertype
main solver selector
int irank
constructor builds