42 #include "AbstractLinAlgPack_BasisSystemFactoryStd.hpp"
43 #include "AbstractLinAlgPack_BasisSystemPermDirectSparse.hpp"
44 #include "AbstractLinAlgPack_DirectSparseSolverDense.hpp"
45 #include "Teuchos_Assert.hpp"
46 #include "OptionsFromStreamPack_OptionsFromStream.hpp"
47 #include "OptionsFromStreamPack_StringToIntMap.hpp"
48 #include "OptionsFromStreamPack_StringToBool.hpp"
50 #ifdef HAVE_MOOCHO_MA28
51 #include "AbstractLinAlgPack_DirectSparseSolverMA28.hpp"
52 #include "AbstractLinAlgPack_DirectSparseSolverMA28SetOptions.hpp"
55 namespace AbstractLinAlgPack {
58 :direct_linear_solver_type_(
59 #ifdef SPARSE_SOLVER_PACK_USE_MA48
62 # ifdef HAVE_MOOCHO_MA28
86 BasisSystemFactoryStd::obj_ptr_t
89 namespace mmp = MemMngPack;;
96 switch(direct_linear_solver_type_) {
100 direct_sparse_solver = dss_dense;
104 #ifdef HAVE_MOOCHO_MA28
109 opt_setter(dss_ma28.
get());
112 direct_sparse_solver = dss_ma28;
115 true, std::logic_error
116 ,
"Error, HAVE_MOOCHO_MA28 is not defined and therefore MA28 is not supported!" );
122 true, std::logic_error
123 ,
"Error, MA48 is not supported yet!" );
127 #ifdef SPARSE_SOLVER_PACK_USE_SUPERLU
129 dss_slu =
Teuchos::rcp(
new DirectSparseSolverSuperLU());
131 direct_sparse_solver = dss_slu;
134 true, std::logic_error
135 ,
"Error, SPARSE_SOLVER_PACK_USE_SUPERLU is not defined and therefore SuperLU is not supported!" );
150 void BasisSystemFactoryStd::read_options()
const
152 namespace ofsp = OptionsFromStreamPack;
153 using ofsp::OptionsFromStream;
154 typedef OptionsFromStream::options_group_t options_group_t;
155 using ofsp::StringToIntMap;
156 using ofsp::StringToBool;
161 const std::string opt_grp_name =
"BasisSystemFactoryStd";
162 const OptionsFromStream::options_group_t optgrp = options_->options_group( opt_grp_name );
163 if( OptionsFromStream::options_group_exists( optgrp ) ) {
165 const int num_opts = 1;
166 enum EBasisSystemFactorStd {
169 const char* SBasisSystemFactorStd[num_opts] = {
170 "direct_linear_solver"
172 StringToIntMap map( opt_grp_name, num_opts, SBasisSystemFactorStd );
174 options_group_t::const_iterator itr = optgrp.begin();
175 for( ; itr != optgrp.end(); ++itr ) {
176 switch( (EBasisSystemFactorStd)map( ofsp::option_name(itr) ) ) {
177 case DIRECT_LINEAR_SOLVER:
179 const std::string &linear_solver = ofsp::option_value(itr);
180 if( linear_solver ==
"DENSE" ) {
181 direct_linear_solver_type_ = LA_DENSE;
182 }
else if( linear_solver ==
"MA28" ) {
183 #ifdef HAVE_MOOCHO_MA28
184 direct_linear_solver_type_ = LA_MA28;
187 true, std::logic_error
188 ,
"BasisSystemFactoryStd::read_options(...) : MA28 is not supported,"
189 " you must configure with --enable-moocho-ma28!" );
191 }
else if( linear_solver ==
"MA48" ) {
192 #ifdef SPARSE_SOLVER_PACK_USE_MA48
193 direct_linear_solver_type_ = LA_MA48;
196 true, std::logic_error
197 ,
"BasisSystemFactoryStd::read_options(...) : MA48 is not supported,"
198 " must define SPARSE_SOLVER_PACK_USE_MA48!" );
200 }
else if( linear_solver ==
"SUPERLU" ) {
201 #ifdef SPARSE_SOLVER_PACK_USE_SUPERLU
202 direct_linear_solver_type_ = LA_SUPERLU;
205 true, std::logic_error
206 ,
"BasisSystemFactoryStd::read_options(...) : SUPERLU is not supported,"
207 " must define SPARSE_SOLVER_PACK_USE_SUPERLU!" );
211 true, std::invalid_argument
212 ,
"BasisSystemFactoryStd::read_options(...) : "
213 "Error, incorrect value for \"direct_linear_solver\" "
214 "Only the options \'DENSE\', \'MA28\' and \'SUPERLU\' are avalible." );
Concreate sparse solver subclass that uses MA28.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
void set_options(const OptionsFromStream &options)
void set_options(const options_ptr_t &options)
Concreate sparse solver subclass that uses the dense LAPACK routines.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
const options_ptr_t & get_options() const
Permutatble basis system subclass that uses a direct sparse solver.
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)
Set options for DirectSparseSolverMA28 from OptionsFromStream object.