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" 58 :direct_linear_solver_type_(
59 #ifdef SPARSE_SOLVER_PACK_USE_MA48
62 # ifdef HAVE_MOOCHO_MA28
86 BasisSystemFactoryStd::obj_ptr_t
95 Teuchos::RCP<DirectSparseSolver> direct_sparse_solver;
96 switch(direct_linear_solver_type_) {
98 Teuchos::RCP<DirectSparseSolverDense>
100 direct_sparse_solver = dss_dense;
104 #ifdef HAVE_MOOCHO_MA28 105 Teuchos::RCP<DirectSparseSolverMA28>
109 opt_setter(dss_ma28.get());
112 direct_sparse_solver = dss_ma28;
114 TEUCHOS_TEST_FOR_EXCEPTION(
115 true, std::logic_error
116 ,
"Error, HAVE_MOOCHO_MA28 is not defined and therefore MA28 is not supported!" );
121 TEUCHOS_TEST_FOR_EXCEPTION(
122 true, std::logic_error
123 ,
"Error, MA48 is not supported yet!" );
127 #ifdef SPARSE_SOLVER_PACK_USE_SUPERLU 128 Teuchos::RCP<DirectSparseSolverSuperLU>
129 dss_slu = Teuchos::rcp(
new DirectSparseSolverSuperLU());
131 direct_sparse_solver = dss_slu;
133 TEUCHOS_TEST_FOR_EXCEPTION(
134 true, std::logic_error
135 ,
"Error, SPARSE_SOLVER_PACK_USE_SUPERLU is not defined and therefore SuperLU is not supported!" );
140 TEUCHOS_TEST_FOR_EXCEPT(
true);
150 void BasisSystemFactoryStd::read_options()
const 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;
186 TEUCHOS_TEST_FOR_EXCEPTION(
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;
195 TEUCHOS_TEST_FOR_EXCEPTION(
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;
204 TEUCHOS_TEST_FOR_EXCEPTION(
205 true, std::logic_error
206 ,
"BasisSystemFactoryStd::read_options(...) : SUPERLU is not supported," 207 " must define SPARSE_SOLVER_PACK_USE_SUPERLU!" );
210 TEUCHOS_TEST_FOR_EXCEPTION(
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." );
219 TEUCHOS_TEST_FOR_EXCEPT(
true);
Concreate sparse solver subclass that uses MA28.
void set_options(const OptionsFromStream &options)
void set_options(const options_ptr_t &options)
Concreate sparse solver subclass that uses the dense LAPACK routines.
const options_ptr_t & get_options() const
Teuchos::RCP< const OptionsFromStreamPack::OptionsFromStream > options_ptr_t
Permutatble basis system subclass that uses a direct sparse solver.
Set options for DirectSparseSolverMA28 from OptionsFromStream object.