本文整理汇总了C++中CommandLineProcessor::throwExceptions方法的典型用法代码示例。如果您正苦于以下问题:C++ CommandLineProcessor::throwExceptions方法的具体用法?C++ CommandLineProcessor::throwExceptions怎么用?C++ CommandLineProcessor::throwExceptions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CommandLineProcessor
的用法示例。
在下文中一共展示了CommandLineProcessor::throwExceptions方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main( int argc, char* argv[] ) {
using Teuchos::CommandLineProcessor;
bool success = true;
bool verbose = true;
Teuchos::GlobalMPISession mpiSession(&argc,&argv);
Teuchos::RCP<Teuchos::FancyOStream>
out = Teuchos::VerboseObjectBase::getDefaultOStream();
try {
const Teuchos::RCP<const Teuchos::Comm<Thyra::Ordinal> >
comm = Teuchos::DefaultComm<Thyra::Ordinal>::getComm();
//
// Read options from command-line
//
int n = 4;
bool useSpmd = true;
bool dumpAll = false;
CommandLineProcessor clp;
clp.throwExceptions(false);
clp.addOutputSetupOptions(true);
clp.setOption( "verbose", "quiet", &verbose, "Set if output is printed or not." );
clp.setOption( "local-dim", &n, "Local number of elements in each constituent vector." );
clp.setOption( "use-spmd", "use-serial", &useSpmd, "Determines if MPI or serial vector space is used." );
clp.setOption( "dump-all", "no-dump-all", &dumpAll, "Determines if vectors are printed or not." );
CommandLineProcessor::EParseCommandLineReturn parse_return = clp.parse(argc,argv);
if( parse_return != CommandLineProcessor::PARSE_SUCCESSFUL ) return parse_return;
//
// Run the tests
//
#ifdef HAVE_THYRA_TEUCHOS_BLASFLOAT
if( !run_composite_linear_ops_tests<float>(comm,n,useSpmd,float(1e-4),dumpAll,verbose?&*out:NULL) ) success = false;
#endif // HAVE_THYRA_TEUCHOS_BLASFLOAT
if( !run_composite_linear_ops_tests<double>(comm,n,useSpmd,double(1e-12),dumpAll,verbose?&*out:NULL) ) success = false;
#if defined(HAVE_THYRA_COMPLEX)
#ifdef HAVE_THYRA_TEUCHOS_BLASFLOAT
if( !run_composite_linear_ops_tests<std::complex<float> >(comm,n,useSpmd,float(1e-4),dumpAll,verbose?&*out:NULL) ) success = false;
#endif // HAVE_THYRA_TEUCHOS_BLASFLOAT
if( !run_composite_linear_ops_tests<std::complex<double> >(comm,n,useSpmd,double(1e-12),dumpAll,verbose?&*out:NULL) ) success = false;
#endif
#if defined(HAVE_TEUCHOS_GNU_MP) && !defined(USE_MPI) // mpf_class can not be used with MPI yet!
if( !run_composite_linear_ops_tests<mpf_class>(comm,n,useSpmd,mpf_class(1e-12),dumpAll,verbose?&*out:NULL) ) success = false;
#endif
if( verbose ) {
if(success) *out << "\nAll of the tests seem to have run successfully!\n";
else *out << "\nOh no! at least one of the tests failed!\n";
}
} // end try
TEUCHOS_STANDARD_CATCH_STATEMENTS(true,*out,success)
return success ? EXIT_SUCCESS : EXIT_FAILURE;
} // end main() [Doxygen looks for this!]
示例2: main
int main(int argc, char *argv[])
{
using std::endl;
typedef double Scalar;
// typedef double ScalarMag; // unused
typedef Teuchos::ScalarTraits<Scalar> ST;
using Teuchos::describe;
using Teuchos::Array;
using Teuchos::RCP;
using Teuchos::rcp;
using Teuchos::outArg;
using Teuchos::rcp_implicit_cast;
using Teuchos::rcp_dynamic_cast;
using Teuchos::as;
using Teuchos::ParameterList;
using Teuchos::CommandLineProcessor;
typedef Teuchos::ParameterList::PrintOptions PLPrintOptions;
typedef Thyra::ModelEvaluatorBase MEB;
bool result, success = true;
Teuchos::GlobalMPISession mpiSession(&argc,&argv);
RCP<Epetra_Comm> epetra_comm;
#ifdef HAVE_MPI
epetra_comm = rcp( new Epetra_MpiComm(MPI_COMM_WORLD) );
#else
epetra_comm = rcp( new Epetra_SerialComm );
#endif // HAVE_MPI
RCP<Teuchos::FancyOStream>
out = Teuchos::VerboseObjectBase::getDefaultOStream();
try {
//
// Read commandline options
//
CommandLineProcessor clp;
clp.throwExceptions(false);
clp.addOutputSetupOptions(true);
std::string paramsFileName = "";
clp.setOption( "params-file", ¶msFileName,
"File name for XML parameters" );
double t_final = 1e-3;
clp.setOption( "final-time", &t_final,
"Final integration time (initial time is 0.0)" );
int numTimeSteps = 10;
clp.setOption( "num-time-steps", &numTimeSteps,
"Number of (fixed) time steps. If <= 0.0, then variable time steps are taken" );
double maxStateError = 1e-14;
clp.setOption( "max-state-error", &maxStateError,
"Maximum relative error in the integrated state allowed" );
Teuchos::EVerbosityLevel verbLevel = Teuchos::VERB_DEFAULT;
setVerbosityLevelOption( "verb-level", &verbLevel,
"Top-level verbosity level. By default, this gets deincremented as you go deeper into numerical objects.",
&clp );
Teuchos::EVerbosityLevel solnVerbLevel = Teuchos::VERB_DEFAULT;
setVerbosityLevelOption( "soln-verb-level", &solnVerbLevel,
"Solution verbosity level",
&clp );
CommandLineProcessor::EParseCommandLineReturn parse_return = clp.parse(argc,argv);
if( parse_return != CommandLineProcessor::PARSE_SUCCESSFUL ) return parse_return;
//
*out << "\nA) Get the base parameter list ...\n";
//
RCP<ParameterList>
paramList = Teuchos::parameterList();
if (paramsFileName.length())
updateParametersFromXmlFile( paramsFileName, paramList.ptr() );
paramList->validateParameters(*getValidParameters());
const Scalar t_init = 0.0;
const Rythmos::TimeRange<Scalar> fwdTimeRange(t_init, t_final);
const Scalar delta_t = t_final / numTimeSteps;
*out << "\ndelta_t = " << delta_t;
//
*out << "\nB) Create the Stratimikos linear solver factory ...\n";
//
// This is the linear solve strategy that will be used to solve for the
// linear system with the W.
//
Stratimikos::DefaultLinearSolverBuilder linearSolverBuilder;
linearSolverBuilder.setParameterList(sublist(paramList,Stratimikos_name));
RCP<Thyra::LinearOpWithSolveFactoryBase<Scalar> >
//.........这里部分代码省略.........
示例3: main
int main(int argc, char *argv[])
{
#ifdef HAVE_MPI
MPI_Init(&argc,&argv);
Epetra_MpiComm Comm(MPI_COMM_WORLD);
#else
Epetra_SerialComm Comm;
#endif
CommandLineProcessor CLP;
int n = 10;
int m = (int)pow((double)Comm.NumProc(), 0.3334);
double DampingFactor = 1.333;
std::string AggregationScheme = "Uncoupled";
int NPA = 16;
int MaxLevels = 5;
CLP.setOption("l", &MaxLevels, "number of levels");
CLP.setOption("n", &n, "number of nodes along each axis");
CLP.setOption("damp", &DampingFactor, "prolongator damping factor");
CLP.setOption("aggr", &AggregationScheme, "aggregation scheme");
CLP.setOption("npa", &NPA, "nodes per aggregate (if supported by the aggregation scheme)");
CLP.throwExceptions(false);
CLP.parse(argc,argv);
if (m * m * m != Comm.NumProc()) {
if (Comm.MyPID() == 0)
{
std::cout << "Number of processes must be a perfect cube." << std::endl;
std::cout << "Please re-run with --help option for details." << std::endl;
}
#ifdef HAVE_MPI
MPI_Finalize();
#endif
exit(EXIT_SUCCESS);
}
n *= m;
Laplace3D A(Comm, n, n, n, m, m, m, true);
Epetra_Vector LHS(A.OperatorDomainMap());
Epetra_Vector RHS(A.OperatorDomainMap());
LHS.Random();
RHS.PutScalar(0.0);
Epetra_LinearProblem Problem(&A, &LHS, &RHS);
// Construct a solver object for this problem
AztecOO solver(Problem);
// create a parameter list for ML options
ParameterList MLList;
// set defaults for classic smoothed aggregation
ML_Epetra::SetDefaults("SA",MLList);
// overwrite some parameters. Please refer to the user's guide
// for more information
MLList.set("max levels",MaxLevels);
MLList.set("increasing or decreasing","increasing");
MLList.set("aggregation: type", AggregationScheme);
MLList.set("aggregation: damping factor", DampingFactor);
MLList.set("aggregation: nodes per aggregate", NPA);
MLList.set("smoother: type","symmetric Gauss-Seidel");
MLList.set("smoother: pre or post", "both");
MLList.set("coarse: max size", 512);
MLList.set("coarse: type","Amesos-KLU");
MLList.set("analyze memory", true);
MLList.set("repartition: enable", true);
MLList.set("repartition: max min ratio", 1.1);
MLList.set("repartition: min per proc", 512);
MLList.set("low memory usage", true);
MLList.set("x-coordinates", (double*) A.XCoord());
MLList.set("y-coordinates", (double*) A.YCoord());
MLList.set("z-coordinates", (double*) A.ZCoord());
// create the preconditioner object and compute hierarchy
MultiLevelPreconditioner* MLPrec = new MultiLevelPreconditioner(A, MLList);
// tell AztecOO to use this preconditioner, then solve
solver.SetPrecOperator(MLPrec);
solver.SetAztecOption(AZ_solver, AZ_cg_condnum);
solver.SetAztecOption(AZ_output, 1);
solver.Iterate(500, 1e-10);
delete MLPrec;
double norm;
LHS.Norm2(&norm);
if (Comm.MyPID() == 0)
std::cout << "Norm of the error = " << norm << std::endl;
#ifdef HAVE_MPI
MPI_Finalize() ;
#endif
//.........这里部分代码省略.........
示例4: 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);
Teuchos::Time timer("");
bool dummySuccess = true;
Teuchos::RCP<Teuchos::FancyOStream>
out = Teuchos::VerboseObjectBase::getDefaultOStream();
try {
//
// A) Create the solver objects that will insert their command-line
// options
//
MoochoThyraSolver solver;
//
// B) Get options from the command line
//
int localDim = 4;
double pt = 0.0;
double p0 = 0.1;
double scale = 0.1;
CommandLineProcessor clp;
clp.throwExceptions(false);
clp.addOutputSetupOptions(true);
clp.setOption("local-dim", &localDim);
clp.setOption("pt", &pt);
clp.setOption("p0", &p0);
clp.setOption("scale", &scale);
solver.setupCLP(&clp);
CommandLineProcessor::EParseCommandLineReturn
parse_return = clp.parse(argc,argv,&std::cerr);
if( parse_return != CommandLineProcessor::PARSE_SUCCESSFUL )
return parse_return;
solver.readParameters( out.get() );
Teuchos::RCP<Epetra_Comm> comm = Teuchos::null;
#ifdef HAVE_MPI
MPI_Comm mpiComm = MPI_COMM_WORLD;
comm = Teuchos::rcp(new Epetra_MpiComm(mpiComm));
#else
comm = Teuchos::rcp(new Epetra_SerialComm());
#endif
//
// C) Create the Thyra::ModelEvaluator object
//
*out << "\nCreate EpetraExt::DiagonalQuadraticResponseOnlyModelEvaluator object ...\n";
Teuchos::RCP<EpetraExt::DiagonalQuadraticResponseOnlyModelEvaluator>
epetraModel = EpetraExt::diagonalQuadraticResponseOnlyModelEvaluator(
comm, localDim, pt, p0, scale);
*out << "\nCreate the Thyra::EpetraModelEvaluator wrapper object ...\n";
Teuchos::RCP<Thyra::EpetraModelEvaluator>
epetraThyraModel(new Thyra::EpetraModelEvaluator()); // Sets default options!
epetraThyraModel->initialize(epetraModel, Teuchos::null);
//
// D) Solve the NLP
//
// Set the model
solver.setModel(epetraThyraModel);
// Read the initial guess if one exists
solver.readInitialGuess(out.get());
// Solve the NLP
const MoochoSolver::ESolutionStatus solution_status = solver.solve();
// Write the solution to file
solver.writeFinalSolution(out.get());
// Write the final parameters to file
solver.writeParamsFile();
//
//.........这里部分代码省略.........
示例5: main
int main( int argc, char* argv[] ) {
using Teuchos::CommandLineProcessor;
using Teuchos::RCP;
bool success = true;
bool verbose = true;
Teuchos::GlobalMPISession mpiSession(&argc,&argv);
RCP<Teuchos::FancyOStream>
out = Teuchos::VerboseObjectBase::getDefaultOStream();
try {
//
// Read options from command-line
//
int n = 4;
int numBlocks = 4;
bool showAllTests = true;
bool dumpAll = false;
CommandLineProcessor clp;
clp.throwExceptions(false);
clp.addOutputSetupOptions(true);
clp.setOption( "verbose", "quiet", &verbose, "Set if output is printed or not." );
clp.setOption( "n", &n, "Number of elements in each constituent vector." );
clp.setOption( "num-blocks", &numBlocks, "blocks to create." );
clp.setOption( "dump-all", "no-dump-all", &dumpAll, "Determines if vectors are printed or not." );
clp.setOption( "show-all-tests", "no-show-all-tests", &showAllTests, "Determines if all tests are printed or not." );
CommandLineProcessor::EParseCommandLineReturn parse_return = clp.parse(argc,argv);
if( parse_return != CommandLineProcessor::PARSE_SUCCESSFUL ) return parse_return;
//
// Run the tests
//
#ifdef HAVE_THYRA_TEUCHOS_BLASFLOAT
if( !run_product_space_tests<float>(n,numBlocks,float(1e-5),showAllTests,dumpAll,verbose?&*out:NULL) ) success = false;
#endif // HAVE_THYRA_TEUCHOS_BLASFLOAT
if( !run_product_space_tests<double>(n,numBlocks,double(1e-13),showAllTests,dumpAll,verbose?&*out:NULL) ) success = false;
#if defined(HAVE_THYRA_COMPLEX)
#ifdef THYRA_TEUCHOS_BLASFLOAT
if( !run_product_space_tests<std::complex<float> >(n,numBlocks,float(1e-5),showAllTests,dumpAll,verbose?&*out:NULL) ) success = false;
#endif // HAVE_THYRA_TEUCHOS_BLASFLOAT
if( !run_product_space_tests<std::complex<double> >(n,numBlocks,double(1e-12),showAllTests,dumpAll,verbose?&*out:NULL) ) success = false;
#endif // defined(HAVE_THYRA_COMPLEX)
#ifdef HAVE_TEUCHOS_GNU_MP
//if( !run_product_space_tests<mpf_class>(n,numBlocks,mpf_class(1e-13),showAllTests,dumpAll,verbose?&*out:NULL) ) success = false;
// Above commented out code will not compile because its ScalarTraits specialization does not support eps()
#endif // HAVE_TEUCHOS_GNU_MP
} // end try
TEUCHOS_STANDARD_CATCH_STATEMENTS(true,*out,success)
if(verbose) {
if(success)
*out << "\nAll of the tests seem to have run successfully!\n";
else
*out << "\nOh no! at least one of the test failed!\n";
}
return success ? 0 : 1;
} // end main() [Doxygen looks for this!]
示例6: main
int main(int argc, char *argv[])
{
using std::endl;
using Teuchos::RCP;
using Teuchos::rcp;
using Teuchos::ParameterList;
using Teuchos::CommandLineProcessor;
bool result, success = true;
Teuchos::GlobalMPISession mpiSession(&argc,&argv);
RCP<Epetra_Comm> epetra_comm;
#ifdef HAVE_MPI
epetra_comm = rcp( new Epetra_MpiComm(MPI_COMM_WORLD) );
#else
epetra_comm = rcp( new Epetra_SerialComm );
#endif // HAVE_MPI
RCP<Teuchos::FancyOStream>
out = Teuchos::VerboseObjectBase::getDefaultOStream();
try {
//
// Read commandline options
//
CommandLineProcessor clp;
clp.throwExceptions(false);
clp.addOutputSetupOptions(true);
Teuchos::EVerbosityLevel verbLevel = Teuchos::VERB_DEFAULT;
setVerbosityLevelOption( "verb-level", &verbLevel,
"Top-level verbosity level. By default, this gets deincremented as you go deeper into numerical objects.",
&clp );
bool dumpFinalSolutions = false;
clp.setOption(
"dump-final-solutions", "no-dump-final-solutions", &dumpFinalSolutions,
"Determine if the final solutions are dumpped or not." );
CommandLineProcessor::EParseCommandLineReturn parse_return = clp.parse(argc,argv);
if( parse_return != CommandLineProcessor::PARSE_SUCCESSFUL ) return parse_return;
if ( Teuchos::VERB_DEFAULT == verbLevel )
verbLevel = Teuchos::VERB_LOW;
const Teuchos::EVerbosityLevel
solnVerbLevel = ( dumpFinalSolutions ? Teuchos::VERB_EXTREME : verbLevel );
//
// Get the base parameter list that all other parameter lists will be read
// from.
//
RCP<ParameterList>
paramList = Teuchos::parameterList();
//
// Create the underlying EpetraExt::ModelEvaluator
//
RCP<LorenzModel>
lorenzModel = rcp(new LorenzModel( epetra_comm, *paramList ));
//
// Create the Thyra-wrapped ModelEvaluator
//
RCP<Thyra::ModelEvaluator<double> >
thyraLorenzModel = Thyra::epetraModelEvaluator(lorenzModel,Teuchos::null);
//
// Create the Rythmos GAASP ErrorEstimator
//
RCP<Rythmos::GAASPErrorEstimator> gaaspEE = rcp(new Rythmos::GAASPErrorEstimator);
gaaspEE->setModel(thyraLorenzModel);
//gaaspEE->setQuantityOfInterest( AVERAGE_ERROR_QTY ); // Not passed through yet.
Teuchos::RCP<Teuchos::ParameterList> pl = Teuchos::parameterList();
pl->sublist("GAASP Interface Parameters").set<double>("eTime",1.0);
pl->sublist("GAASP Interface Parameters").set<double>("timeStep",0.1);
//pl->sublist("GAASP Interface Parameters").set<double>("timeStep",0.5);
gaaspEE->setParameterList(pl);
//RCP<const Rythmos::ErrorEstimateBase<double> > error = gaaspEE->getErrorEstimate();
//double uTOL = 1.0e-8;
double uTOL = 1.0e-2;
RCP<const Rythmos::ErrorEstimateBase<double> > error = gaaspEE->controlGlobalError(uTOL);
double err = error->getTotalError();
out->precision(15);
*out << "err = " << err << std::endl;
}
TEUCHOS_STANDARD_CATCH_STATEMENTS(true,*out,success);
//.........这里部分代码省略.........
示例7: main
//
// Main driver program
//
int main( int argc, char *argv[] )
{
using Teuchos::CommandLineProcessor;
bool success = true;
bool result;
Teuchos::GlobalMPISession mpiSession(&argc,&argv);
// Above is needed to run in an MPI build with some MPI implementations
Teuchos::RCP<Teuchos::FancyOStream>
out = Teuchos::VerboseObjectBase::getDefaultOStream();
try {
//
// Read in command-line options
//
CommandLineProcessor clp;
clp.throwExceptions(false);
clp.addOutputSetupOptions(true);
int n0 = 2;
clp.setOption( "n0", &n0 );
int n1 = 3;
clp.setOption( "n1", &n1 );
int n2 = 4;
clp.setOption( "n2", &n2 );
Teuchos::EVerbosityLevel verbLevel = Teuchos::VERB_MEDIUM;
setVerbosityLevelOption( "verb-level", &verbLevel,
"Top-level verbosity level. By default, this gets deincremented as you go deeper into numerical objects.",
&clp );
CommandLineProcessor::EParseCommandLineReturn parse_return = clp.parse(argc,argv);
if( parse_return != CommandLineProcessor::PARSE_SUCCESSFUL ) return parse_return;
#if defined(HAVE_THYRA_FLOAT)
// Run using float
result = exampleImplicitlyComposedLinearOperators<float>(
n0, n1, n2, *out, verbLevel, 1e-5, true );
if (!result) success = false;
#endif
// Run using double
result = exampleImplicitlyComposedLinearOperators<double>(
n0, n1, n2, *out, verbLevel, 1e-12, true );
if (!result) success = false;
#ifdef HAVE_THYRA_COMPLEX
#if defined(HAVE_THYRA_FLOAT)
// Run using std::complex<float>
result = exampleImplicitlyComposedLinearOperators<std::complex<float> >(
n0, n1, n2, *out, verbLevel, 1e-5, false );
if (!result) success = false;
// 2007/11/02: rabartl: Above, I skip the test of the adjoint since it
// fails but a lot. On my machine, the relative error is:
// rel_err((-3.00939,-0.836347),(-0.275689,1.45244)) = 1.14148.
// Since this works just fine for the next complex<double> case, I am
// going to just skip this test.
#endif // defined(HAVE_THYRA_FLOAT)
// Run using std::complex<double>
result = exampleImplicitlyComposedLinearOperators<std::complex<double> >(
n0, n1, n2, *out, verbLevel, 1e-12, true );
if (!result) success = false;
#endif // HAVE_THYRA_COMPLEX
#ifdef HAVE_TEUCHOS_GNU_MP
// Run using mpf_class
result = exampleImplicitlyComposedLinearOperators<mpf_class>(
n0, n1, n2, *out, verbLevel, 1e-20, true );
if (!result) success = false;
#endif // HAVE_TEUCHOS_GNU_MP
}
TEUCHOS_STANDARD_CATCH_STATEMENTS(true,*out,success)
if(success)
*out << "\nCongratulations! All of the tests checked out!\n";
else
*out << "\nOh no! At least one of the tests failed!\n";
return success ? 0 : 1;
} // end main()
示例8: main
int main(int argc, char* argv[])
{
using Teuchos::CommandLineProcessor;
bool success = true;
bool verbose = true;
Teuchos::RCP<Teuchos::FancyOStream>
out = Teuchos::VerboseObjectBase::getDefaultOStream();
try {
//
// Read options from command-line
//
std::string matrixFile = "";
Thyra::Amesos::ESolverType solverType
#ifdef HAVE_AMESOS_KLU
= Thyra::Amesos::KLU;
#else
= Thyra::Amesos::LAPACK;
#endif
Thyra::Amesos::ERefactorizationPolicy refactorizationPolicy = Thyra::Amesos::REPIVOT_ON_REFACTORIZATION;
bool testTranspose = true;
int numRandomVectors = 1;
double maxFwdError = 1e-14;
double maxError = 1e-10;
double maxResid = 1e-10;
bool showAllTests = false;
bool dumpAll = false;
CommandLineProcessor clp;
clp.throwExceptions(false);
clp.addOutputSetupOptions(true);
clp.setOption( "matrix-file", &matrixFile, "Matrix iput file [Required]." );
clp.setOption(
"solver-type", &solverType
,Thyra::Amesos::numSolverTypes, Thyra::Amesos::solverTypeValues, Thyra::Amesos::solverTypeNames
,"Type of direct solver."
);
clp.setOption(
"refactorization-policy", &refactorizationPolicy
,Thyra::Amesos::numRefactorizationPolices, Thyra::Amesos::refactorizationPolicyValues, Thyra::Amesos::refactorizationPolicyNames
,"Pivoting policy used on refactorizations."
);
clp.setOption( "test-transpose", "no-test-transpose", &testTranspose, "Test the transpose solve or not." );
clp.setOption( "num-random-vectors", &numRandomVectors, "Number of times a test is performed with different random vectors." );
clp.setOption( "max-fwd-error", &maxFwdError, "The maximum relative error in the forward operator." );
clp.setOption( "max-error", &maxError, "The maximum relative error in the solution." );
clp.setOption( "max-resid", &maxResid, "The maximum relative error in the residual." );
clp.setOption( "verbose", "quiet", &verbose, "Set if output is printed or not." );
clp.setOption( "show-all-tests", "no-show-all-tests", &showAllTests, "Set if all the tests are shown or not." );
clp.setOption( "dump-all", "no-dump-all", &dumpAll, "Determines if vectors are printed or not." );
CommandLineProcessor::EParseCommandLineReturn parse_return = clp.parse(argc,argv);
if( parse_return != CommandLineProcessor::PARSE_SUCCESSFUL ) return parse_return;
TEST_FOR_EXCEPT( matrixFile == "" );
Teuchos::ParameterList amesosLOWSFPL;
amesosLOWSFPL.set("Solver Type",toString(solverType));
amesosLOWSFPL.set("Refactorization Policy",toString(refactorizationPolicy));
success
= Thyra::test_single_amesos_thyra_solver(
matrixFile,&amesosLOWSFPL,testTranspose,numRandomVectors
,maxFwdError,maxError,maxResid,showAllTests,dumpAll,verbose?&*out:0
);
}
示例9: main
int main( int argc, char* argv[] ) {
using Teuchos::CommandLineProcessor;
bool success = true;
bool verbose = true;
bool dumpAll = false;
Teuchos::GlobalMPISession mpiSession(&argc,&argv);
// KL 27 Jul 2006 -- Commenting out unused variables
// const int procRank = Teuchos::GlobalMPISession::getRank();
// const int numProc = Teuchos::GlobalMPISession::getNProc();
Teuchos::RCP<Teuchos::FancyOStream>
out = Teuchos::VerboseObjectBase::getDefaultOStream();
try {
//
// Read options from the command-line
//
CommandLineProcessor clp;
clp.throwExceptions(false);
clp.addOutputSetupOptions(true);
int local_dim = 4;
clp.setOption( "local-dim", &local_dim, "Number of vector elements per process." );
double eps_scale = 200.0;
clp.setOption( "eps-scale", &eps_scale, "Constant (greater than 1) to scale eps by in error tests." );
clp.setOption( "verbose", "quiet", &verbose,
"Determines if any output is printed or not." );
clp.setOption( "dump-all", "no-dump", &dumpAll, "Determines if quantities are dumped or not." );
CommandLineProcessor::EParseCommandLineReturn parse_return = clp.parse(argc,argv);
if( parse_return != CommandLineProcessor::PARSE_SUCCESSFUL ) return parse_return;
//
// Run the tests
//
#if defined(HAVE_THYRA_FLOAT)
if( !Thyra::run_std_ops_tests<float>(local_dim,float(eps_scale*Teuchos::ScalarTraits<float>::eps()),dumpAll,verbose?&*out:NULL) ) success = false;
#endif
if( !Thyra::run_std_ops_tests<double>(local_dim,double(eps_scale*Teuchos::ScalarTraits<double>::eps()),dumpAll,verbose?&*out:NULL) ) success = false;
#if defined(HAVE_THYRA_COMPLEX) && defined(HAVE_THYRA_FLOAT)
if( !Thyra::run_std_ops_tests<std::complex<float> >(local_dim,float(eps_scale*Teuchos::ScalarTraits<float>::eps()),dumpAll,verbose?&*out:NULL) ) success = false;
#endif
#if defined(HAVE_THYRA_COMPLEX)
if( !Thyra::run_std_ops_tests<std::complex<double> >(local_dim,double(eps_scale*Teuchos::ScalarTraits<double>::eps()),dumpAll,verbose?&*out:NULL) ) success = false;
#endif
#ifdef HAVE_TEUCHOS_GNU_MP
//if( !Thyra::run_std_ops_tests<mpf_class>(local_dim,mpf_class(max_rel_err),dumpAll,verbose?&*out:NULL) ) success = false;
// RAB: 4/16/2005: We can not instantiate the above since rmax() is not supported by this types ScalarTraits class
// and it is needed by the class RTOpPack::ROpMaxIndexLessThanBound. This can be fixed using a template
// conditional but I have not done this yet.
#endif
} // end try
catch( const std::exception &excpt ) {
if(verbose)
std::cerr << "*** Caught a standard exception : " << excpt.what() << std::endl;
success = false;
}
catch( ... ) {
if(verbose)
std::cerr << "*** Caught an unknown exception!\n";
success = false;
}
if(verbose) {
if(success)
*out << "\nAll of the tests seem to have run successfully!\n";
else
*out << "\nOh no! at least one of the test failed!\n";
}
return success ? 0 : 1;
}
示例10: main
int main(int argc, char *argv[])
{
using std::endl;
typedef double Scalar;
typedef double ScalarMag;
using Teuchos::describe;
using Teuchos::RCP;
using Teuchos::rcp;
using Teuchos::rcp_implicit_cast;
using Teuchos::rcp_dynamic_cast;
using Teuchos::as;
using Teuchos::ParameterList;
using Teuchos::CommandLineProcessor;
typedef Teuchos::ParameterList::PrintOptions PLPrintOptions;
typedef Thyra::ModelEvaluatorBase MEB;
using Thyra::createMember;
using Thyra::createMembers;
bool success = true;
Teuchos::GlobalMPISession mpiSession(&argc,&argv);
RCP<Epetra_Comm> epetra_comm;
#ifdef HAVE_MPI
epetra_comm = rcp( new Epetra_MpiComm(MPI_COMM_WORLD) );
#else
epetra_comm = rcp( new Epetra_SerialComm );
#endif // HAVE_MPI
RCP<Teuchos::FancyOStream>
out = Teuchos::VerboseObjectBase::getDefaultOStream();
try {
//
// A) Read commandline options
//
CommandLineProcessor clp;
clp.throwExceptions(false);
clp.addOutputSetupOptions(true);
std::string paramsFileName = "";
clp.setOption( "params-file", ¶msFileName,
"File name for XML parameters" );
std::string extraParamsString = "";
clp.setOption( "extra-params", &extraParamsString,
"Extra XML parameter string" );
Teuchos::EVerbosityLevel verbLevel = Teuchos::VERB_DEFAULT;
setVerbosityLevelOption( "verb-level", &verbLevel,
"Top-level verbosity level. By default, this gets deincremented as you go deeper into numerical objects.",
&clp );
double finalTime = 1.0;
clp.setOption( "final-time", &finalTime, "Final time (the inital time)" );
int numTimeSteps = 2;
clp.setOption( "num-time-steps", &numTimeSteps, "Number of time steps" );
bool dumpFinalSolutions = false;
clp.setOption(
"dump-final-solutions", "no-dump-final-solutions", &dumpFinalSolutions,
"Determine if the final solutions are dumpped or not." );
double maxStateError = 1e-6;
clp.setOption( "max-state-error", &maxStateError,
"The maximum allowed error in the integrated state in relation to the exact state solution" );
// ToDo: Read in more parameters
CommandLineProcessor::EParseCommandLineReturn parse_return = clp.parse(argc,argv);
if( parse_return != CommandLineProcessor::PARSE_SUCCESSFUL ) return parse_return;
if ( Teuchos::VERB_DEFAULT == verbLevel )
verbLevel = Teuchos::VERB_LOW;
const Teuchos::EVerbosityLevel
solnVerbLevel = ( dumpFinalSolutions ? Teuchos::VERB_EXTREME : verbLevel );
//
// B) Get the base parameter list that all other parameter lists will be
// read from.
//
RCP<ParameterList> paramList = Teuchos::parameterList();
if (paramsFileName.length())
updateParametersFromXmlFile( paramsFileName, &*paramList );
if (extraParamsString.length())
updateParametersFromXmlString( extraParamsString, &*paramList );
paramList->validateParameters(*getValidParameters());
//
// C) Create the Stratimikos linear solver factories.
//
// Get the linear solve strategy that will be used to solve for the linear
//.........这里部分代码省略.........
示例11: 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);
//.........这里部分代码省略.........
示例12: main
//
// Main driver program for epetra implementation of the power method.
//
int main(int argc, char *argv[])
{
using Teuchos::outArg;
using Teuchos::CommandLineProcessor;
using Teuchos::RCP;
bool success = true;
bool result;
//
// (A) Setup and get basic MPI info
//
Teuchos::GlobalMPISession mpiSession(&argc,&argv);
#ifdef HAVE_MPI
MPI_Comm mpiComm = MPI_COMM_WORLD;
#endif
//
// (B) Setup the output stream (do output only on root process!)
//
Teuchos::RCP<Teuchos::FancyOStream>
out = Teuchos::VerboseObjectBase::getDefaultOStream();
try {
//
// (C) Read in commandline options
//
CommandLineProcessor clp;
clp.throwExceptions(false);
clp.addOutputSetupOptions(true);
int globalDim = 500;
clp.setOption( "global-dim", &globalDim, "Global dimension of the linear system." );
bool dumpAll = false;
clp.setOption( "dump-all", "no-dump", &dumpAll, "Determines if quantities are dumped or not." );
CommandLineProcessor::EParseCommandLineReturn
parse_return = clp.parse(argc,argv);
if (parse_return != CommandLineProcessor::PARSE_SUCCESSFUL)
return parse_return;
TEST_FOR_EXCEPTION( globalDim < 2, std::logic_error, "Error, globalDim=" << globalDim << " < 2 is not allowed!" );
*out << "\n***\n*** Running power method example using Epetra implementation\n***\n" << std::scientific;
//
// (D) Setup the operator and run the power method!
//
//
// (1) Setup the initial tridiagonal operator
//
// [ 2 -1 ]
// [ -1 2 -1 ]
// A = [ . . . ]
// [ -1 2 -1 ]
// [ -1 2 ]
//
*out << "\n(1) Constructing tridagonal Epetra matrix A of global dimension = " << globalDim << " ...\n";
RCP<Epetra_Operator>
A_epetra = createTridiagEpetraLinearOp(
globalDim,
#ifdef HAVE_MPI
mpiComm,
#endif
1.0, true, *out
);
// Wrap in an Thyra::EpetraLinearOp object
RCP<Thyra::LinearOpBase<double> >
A = Thyra::nonconstEpetraLinearOp(A_epetra);
//
if (dumpAll) *out << "\nA =\n" << *A; // This works even in parallel!
//
// (2) Run the power method ANA
//
*out << "\n(2) Running the power method on matrix A ...\n";
double lambda = 0.0;
double tolerance = 1e-3;
int maxNumIters = 10*globalDim;
result = sillyPowerMethod<double>(*A, maxNumIters, tolerance, outArg(lambda), *out);
if(!result) success = false;
*out << "\n Estimate of dominate eigenvalue lambda = " << lambda << std::endl;
//
// (3) Increase dominance of first eigenvalue
//
*out << "\n(3) Scale the diagonal of A by a factor of 10 ...\n";
scaleFirstDiagElement( 10.0, &*A );
//.........这里部分代码省略.........
示例13: main
int main(int argc, char *argv[])
{
Teuchos::GlobalMPISession mpiSession(&argc, &argv);
// Create a communicator for Epetra objects
#ifdef HAVE_MPI
Epetra_MpiComm Comm( MPI_COMM_WORLD );
#else
Epetra_SerialComm Comm;
#endif
bool success = false;
bool verbose = false;
try {
// Parse the command line
using Teuchos::CommandLineProcessor;
CommandLineProcessor clp;
clp.throwExceptions(false);
clp.addOutputSetupOptions(true);
clp.setOption( "v", "disable-verbosity", &verbose, "Enable verbosity" );
CommandLineProcessor::EParseCommandLineReturn
parse_return = clp.parse(argc,argv,&std::cerr);
if( parse_return != CommandLineProcessor::PARSE_SUCCESSFUL )
return parse_return;
if (verbose)
std::cout << "Verbosity Activated" << std::endl;
else
std::cout << "Verbosity Disabled" << std::endl;
int status = 0;
const int num_elements = 400;
// Check we have only one processor since this problem doesn't work
// for more than one proc
if (Comm.NumProc() > num_elements)
throw "Error! Number of elements must be greate than number of processors!";
// Create the model evaluator object
double paramC = 0.99;
Teuchos::RCP<ModelEvaluatorHeq<double> > model =
modelEvaluatorHeq<double>(Teuchos::rcp(&Comm,false),num_elements,paramC);
::Stratimikos::DefaultLinearSolverBuilder builder;
Teuchos::RCP<Teuchos::ParameterList> p =
Teuchos::rcp(new Teuchos::ParameterList);
p->set("Linear Solver Type", "AztecOO");
p->sublist("Linear Solver Types").sublist("AztecOO").sublist("Forward Solve").sublist("AztecOO Settings").set("Output Frequency",20);
p->set("Preconditioner Type", "Ifpack");
builder.setParameterList(p);
Teuchos::RCP< ::Thyra::LinearOpWithSolveFactoryBase<double> >
lowsFactory = builder.createLinearSolveStrategy("");
model->set_W_factory(lowsFactory);
// Create the initial guess
Teuchos::RCP< ::Thyra::VectorBase<double> >
initial_guess = model->getNominalValues().get_x()->clone_v();
Thyra::V_S(initial_guess.ptr(),Teuchos::ScalarTraits<double>::one());
Teuchos::RCP<NOX::Thyra::Group> nox_group =
Teuchos::rcp(new NOX::Thyra::Group(*initial_guess, model));
//Teuchos::rcp(new NOX::Thyra::Group(*initial_guess, model, model->create_W_op(), lowsFactory, Teuchos::null, Teuchos::null));
nox_group->computeF();
// Create the NOX status tests and the solver
// Create the convergence tests
Teuchos::RCP<NOX::StatusTest::NormF> absresid =
Teuchos::rcp(new NOX::StatusTest::NormF(1.0e-8));
Teuchos::RCP<NOX::StatusTest::NormWRMS> wrms =
Teuchos::rcp(new NOX::StatusTest::NormWRMS(1.0e-2, 1.0e-8));
Teuchos::RCP<NOX::StatusTest::Combo> converged =
Teuchos::rcp(new NOX::StatusTest::Combo(NOX::StatusTest::Combo::AND));
converged->addStatusTest(absresid);
converged->addStatusTest(wrms);
Teuchos::RCP<NOX::StatusTest::MaxIters> maxiters =
Teuchos::rcp(new NOX::StatusTest::MaxIters(20));
Teuchos::RCP<NOX::StatusTest::FiniteValue> fv =
Teuchos::rcp(new NOX::StatusTest::FiniteValue);
Teuchos::RCP<NOX::StatusTest::Combo> combo =
Teuchos::rcp(new NOX::StatusTest::Combo(NOX::StatusTest::Combo::OR));
combo->addStatusTest(fv);
combo->addStatusTest(converged);
combo->addStatusTest(maxiters);
// Create nox parameter list
Teuchos::RCP<Teuchos::ParameterList> nl_params =
Teuchos::rcp(new Teuchos::ParameterList);
nl_params->set("Nonlinear Solver", "Anderson Accelerated Fixed-Point");
nl_params->sublist("Anderson Parameters").set("Storage Depth", 5);
nl_params->sublist("Anderson Parameters").set("Mixing Parameter", 1.0);
nl_params->sublist("Anderson Parameters").set("Acceleration Start Iteration", 1);
nl_params->sublist("Anderson Parameters").sublist("Preconditioning").set("Precondition", false);
//.........这里部分代码省略.........
示例14: main
int main(int argc, char *argv[])
{
using std::endl;
typedef double Scalar;
typedef double ScalarMag;
using Teuchos::describe;
using Teuchos::RCP;
using Teuchos::rcp;
using Teuchos::rcp_implicit_cast;
using Teuchos::rcp_dynamic_cast;
using Teuchos::as;
using Teuchos::ParameterList;
using Teuchos::CommandLineProcessor;
typedef Teuchos::ParameterList::PrintOptions PLPrintOptions;
typedef Thyra::ModelEvaluatorBase MEB;
typedef Thyra::DefaultMultiVectorProductVectorSpace<Scalar> DMVPVS;
using Thyra::productVectorBase;
bool result, success = true;
Teuchos::GlobalMPISession mpiSession(&argc,&argv);
RCP<Epetra_Comm> epetra_comm;
#ifdef HAVE_MPI
epetra_comm = rcp( new Epetra_MpiComm(MPI_COMM_WORLD) );
#else
epetra_comm = rcp( new Epetra_SerialComm );
#endif // HAVE_MPI
RCP<Teuchos::FancyOStream>
out = Teuchos::VerboseObjectBase::getDefaultOStream();
try {
//
// Read commandline options
//
CommandLineProcessor clp;
clp.throwExceptions(false);
clp.addOutputSetupOptions(true);
std::string paramsFileName = "";
clp.setOption( "params-file", ¶msFileName,
"File name for XML parameters" );
std::string extraParamsString = "";
clp.setOption( "extra-params", &extraParamsString,
"Extra XML parameters" );
std::string extraParamsFile = "";
clp.setOption( "extra-params-file", &extraParamsFile, "File containing extra parameters in XML format.");
double maxStateError = 1e-6;
clp.setOption( "max-state-error", &maxStateError,
"The maximum allowed error in the integrated state in relation to the exact state solution" );
double finalTime = 1e-3;
clp.setOption( "final-time", &finalTime,
"Final integration time (initial time is 0.0)" );
int numTimeSteps = 10;
clp.setOption( "num-time-steps", &numTimeSteps,
"Number of (fixed) time steps. If <= 0.0, then variable time steps are taken" );
bool useBDF = false;
clp.setOption( "use-BDF", "use-BE", &useBDF,
"Use BDF or Backward Euler (BE)" );
bool useIRK = false;
clp.setOption( "use-IRK", "use-other", &useIRK,
"Use IRK or something" );
bool doFwdSensSolve = false;
clp.setOption( "fwd-sens-solve", "state-solve", &doFwdSensSolve,
"Do the forward sensitivity solve or just the state solve" );
bool doFwdSensErrorControl = false;
clp.setOption( "fwd-sens-err-cntrl", "no-fwd-sens-err-cntrl", &doFwdSensErrorControl,
"Do error control on the forward sensitivity solve or not" );
double maxRestateError = 0.0;
clp.setOption( "max-restate-error", &maxRestateError,
"The maximum allowed error between the state integrated by itself verses integrated along with DxDp" );
double maxSensError = 1e-4;
clp.setOption( "max-sens-error", &maxSensError,
"The maximum allowed error in the integrated sensitivity in relation to"
" the finite-difference sensitivity" );
Teuchos::EVerbosityLevel verbLevel = Teuchos::VERB_DEFAULT;
setVerbosityLevelOption( "verb-level", &verbLevel,
"Top-level verbosity level. By default, this gets deincremented as you go deeper into numerical objects.",
&clp );
bool testExactSensitivity = false;
clp.setOption( "test-exact-sens", "no-test-exact-sens", &testExactSensitivity,
"Test the exact sensitivity with finite differences or not." );
//.........这里部分代码省略.........
示例15: main
int main(int argc, char *argv[])
{
Teuchos::GlobalMPISession mpiSession(&argc, &argv);
int status = 0;
// Parse the command line
using Teuchos::CommandLineProcessor;
CommandLineProcessor clp;
clp.throwExceptions(false);
clp.addOutputSetupOptions(true);
bool verbose = false;
clp.setOption( "v", "disable-verbosity", &verbose, "Enable verbosity" );
CommandLineProcessor::EParseCommandLineReturn
parse_return = clp.parse(argc,argv,&std::cerr);
if( parse_return != CommandLineProcessor::PARSE_SUCCESSFUL )
return parse_return;
if (verbose)
std::cout << "Verbosity Activated" << std::endl;
else
std::cout << "Verbosity Disabled" << std::endl;
// Create a communicator for Epetra objects
#ifdef HAVE_MPI
Epetra_MpiComm Comm( MPI_COMM_WORLD );
#else
Epetra_SerialComm Comm;
#endif
// Check we have only one processor since this problem doesn't work
// for more than one proc
if (Comm.NumProc() > 1) {
std::cerr << "Error! Problem can only be run with at most 1 processor!"
<< std::endl;
return -1;
}
// Create the model evaluator object
double d = 10.0;
double p0 = 2.0;
double p1 = 0.0;
double x00 = 0.0;
double x01 = 1.0;
Teuchos::RCP<ModelEvaluator2DSim<double> > thyraModel =
Teuchos::rcp(new ModelEvaluator2DSim<double>(Teuchos::rcp(&Comm,false),
d,p0,p1,x00,x01));
::Stratimikos::DefaultLinearSolverBuilder builder;
Teuchos::RCP<Teuchos::ParameterList> p =
Teuchos::rcp(new Teuchos::ParameterList);
p->set("Linear Solver Type", "AztecOO");
p->set("Preconditioner Type", "Ifpack");
builder.setParameterList(p);
Teuchos::RCP< ::Thyra::LinearOpWithSolveFactoryBase<double> >
lowsFactory = builder.createLinearSolveStrategy("");
thyraModel->set_W_factory(lowsFactory);
// Create nox parameter list
Teuchos::RCP<Teuchos::ParameterList> nl_params =
Teuchos::rcp(new Teuchos::ParameterList);
nl_params->set("Nonlinear Solver", "Line Search Based");
// Create a Thyra nonlinear solver
Teuchos::RCP< ::Thyra::NonlinearSolverBase<double> > solver =
Teuchos::rcp(new ::Thyra::NOXNonlinearSolver);
solver->setParameterList(nl_params);
solver->setModel(thyraModel);
Teuchos::RCP< ::Thyra::VectorBase<double> >
initial_guess = thyraModel->getNominalValues().get_x()->clone_v();
::Thyra::SolveCriteria<double> solve_criteria;
::Thyra::SolveStatus<double> solve_status;
solve_status = solver->solve(initial_guess.get(), &solve_criteria);
TEUCHOS_ASSERT(solve_status.extraParameters->isType<int>("Number of Iterations"));
TEUCHOS_ASSERT(solve_status.extraParameters->get<int>("Number of Iterations") == 7);
if (solve_status.solveStatus == ::Thyra::SOLVE_STATUS_CONVERGED)
std::cout << "Test passed!" << std::endl;
Teuchos::TimeMonitor::summarize();
// Final return value (0 = successfull, non-zero = failure)
return status;
}