本文整理汇总了C++中stratimikos::DefaultLinearSolverBuilder::setupCLP方法的典型用法代码示例。如果您正苦于以下问题:C++ DefaultLinearSolverBuilder::setupCLP方法的具体用法?C++ DefaultLinearSolverBuilder::setupCLP怎么用?C++ DefaultLinearSolverBuilder::setupCLP使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类stratimikos::DefaultLinearSolverBuilder
的用法示例。
在下文中一共展示了DefaultLinearSolverBuilder::setupCLP方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main( int argc, char* argv[] )
{
using Teuchos::CommandLineProcessor;
typedef AbstractLinAlgPack::value_type Scalar;
using MoochoPack::MoochoSolver;
using MoochoPack::MoochoThyraSolver;
bool dummySuccess = true;
Teuchos::GlobalMPISession mpiSession(&argc,&argv);
Teuchos::RCP<Teuchos::FancyOStream>
out = Teuchos::VerboseObjectBase::getDefaultOStream();
try {
Stratimikos::DefaultLinearSolverBuilder lowsfCreator;
MoochoThyraSolver solver;
//
// Get options from the command line
//
Scalar xt0 = 1.0;
Scalar xt1 = 1.0;
Scalar pt0 = 2.0;
Scalar pt1 = 0.0;
Scalar d = 10.0;
Scalar x00 = 1.0;
Scalar x01 = 1.0;
Scalar p00 = 2.0;
Scalar p01 = 0.0;
Scalar pL0 = -1e+50;
Scalar pL1 = -1e+50;
Scalar pU0 = +1e+50;
Scalar pU1 = +1e+50;
Scalar xL0 = -1e+50;
Scalar xL1 = -1e+50;
Scalar xU0 = +1e+50;
Scalar xU1 = +1e+50;
bool supportDerivs = true;
std::string extraXmlFile = "";
CommandLineProcessor clp(false); // Don't throw exceptions
lowsfCreator.setupCLP(&clp);
solver.setupCLP(&clp);
clp.setOption( "xt0", &xt0 );
clp.setOption( "xt1", &xt1 );
clp.setOption( "pt0", &pt0 );
clp.setOption( "pt1", &pt1 );
clp.setOption( "d", &d );
clp.setOption( "x00", &x00 );
clp.setOption( "x01", &x01 );
clp.setOption( "p00", &p00 );
clp.setOption( "p01", &p01 );
clp.setOption( "pL0", &pL0 );
clp.setOption( "pL1", &pL1 );
clp.setOption( "pU0", &pU0 );
clp.setOption( "pU1", &pU1 );
clp.setOption( "xL0", &xL0 );
clp.setOption( "xL1", &xL1 );
clp.setOption( "xU0", &xU0 );
clp.setOption( "xU1", &xU1 );
clp.setOption( "support-derivs", "no-support-derivs", &supportDerivs );
clp.setOption("extra-xml-file",&extraXmlFile,"File with extra XML text that will modify the initial XML read in");
std::string line("");
if(extraXmlFile.length()) {
std::ifstream myfile(extraXmlFile.c_str());
if (myfile.is_open())
{
getline (myfile,line);
solver.extraParamsXmlStringOption(line);
std::cout << line << "\n";
myfile.close();
}
}
CommandLineProcessor::EParseCommandLineReturn
parse_return = clp.parse(argc,argv,&std::cerr);
if( parse_return != CommandLineProcessor::PARSE_SUCCESSFUL )
return parse_return;
lowsfCreator.readParameters(out.get());
solver.readParameters(out.get());
//
// Create the NLP
//
// Create the EpetraExt::ModelEvaluator object
Teuchos::RCP<EpetraModelEval4DOpt>
epetraModel = Teuchos::rcp(new EpetraModelEval4DOpt(xt0,xt1,pt0,pt1,d,x00,x01,p00,p01));
//.........这里部分代码省略.........
示例2: main
int main( int argc, char* argv[] )
{
using Teuchos::rcp;
using Teuchos::RCP;
using Teuchos::OSTab;
using MoochoPack::MoochoSolver;
using MoochoPack::MoochoThyraSolver;
using Teuchos::CommandLineProcessor;
Teuchos::GlobalMPISession mpiSession(&argc,&argv);
const int numProcs = mpiSession.getNProc();
Teuchos::Time timer("");
bool dummySuccess = true;
Teuchos::RCP<Teuchos::FancyOStream>
out = Teuchos::VerboseObjectBase::getDefaultOStream();
try {
// Create the solver object
GLpApp::AdvDiffReactOptModelCreator advDiffReacModelCreator;
Stratimikos::DefaultLinearSolverBuilder lowsfCreator;
MoochoThyraSolver solver;
//
// Get options from the command line
//
std::string matchingVecFile = "";
bool showMoochoThyraParams = false;
bool showMoochoThyraParamsWithDoc = true;
bool showMoochoThyraParamsXML = false;
CommandLineProcessor clp;
clp.throwExceptions(false);
clp.addOutputSetupOptions(true);
advDiffReacModelCreator.setupCLP(&clp);
lowsfCreator.setupCLP(&clp);
solver.setupCLP(&clp);
clp.setOption(
"q-vec-file", &matchingVecFile
,"Base file name to read the objective state matching "
"vector q (i.e. ||x-q||_M in the objective)."
);
clp.setOption(
"only-print-moocho-thyra-solver-params", "no-print-moocho-thyra-solver-params"
,&showMoochoThyraParams
,"Only print the parameters accepted by MoochoPack::MoochoThyraSolver and stop."
);
clp.setOption(
"show-doc", "hide-doc", &showMoochoThyraParamsWithDoc
,"Show MoochoPack::MocohoThyraSolver parameters with documentation or not."
);
clp.setOption(
"xml-format", "readable-format", &showMoochoThyraParamsXML
,"Show MoochoPack::MoochoThyraSolver parameters in XML or human-readable format."
);
CommandLineProcessor::EParseCommandLineReturn
parse_return = clp.parse(argc,argv,&std::cerr);
if( parse_return != CommandLineProcessor::PARSE_SUCCESSFUL )
return parse_return;
lowsfCreator.readParameters( !showMoochoThyraParams ? out.get() : NULL );
solver.readParameters( !showMoochoThyraParams ? out.get() : NULL );
if(showMoochoThyraParams) {
typedef Teuchos::ParameterList::PrintOptions PLPrintOptions;
if(showMoochoThyraParamsXML)
Teuchos::writeParameterListToXmlOStream(
*solver.getValidParameters()
,*out
);
else
solver.getValidParameters()->print(
*out,PLPrintOptions().indent(2).showTypes(true).showDoc(showMoochoThyraParamsWithDoc)
);
return 0;
}
//
// Setup the output streams
//
Teuchos::RCP<Teuchos::FancyOStream>
journalOut = Teuchos::rcp(
new Teuchos::FancyOStream(
solver.getSolver().generate_output_file("MoochoJournal")
," "
)
);
journalOut->copyAllOutputOptions(*out);
//.........这里部分代码省略.........