本文整理汇总了C++中Teuchos::sublist方法的典型用法代码示例。如果您正苦于以下问题:C++ Teuchos::sublist方法的具体用法?C++ Teuchos::sublist怎么用?C++ Teuchos::sublist使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Teuchos
的用法示例。
在下文中一共展示了Teuchos::sublist方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setMyParamList
void BrentsLineSearch<Scalar>::setParameterList(
RCP<ParameterList> const& paramList
)
{
typedef ScalarTraits<Scalar> ST;
namespace BLSU = BrentsLineSearchUtils;
using Teuchos::sublist;
paramList->validateParametersAndSetDefaults(*this->getValidParameters());
bracket_.setParameterList(sublist(paramList, BLSU::bracket_name, true));
brentsMin_.setParameterList(sublist(paramList, BLSU::minimize_name, true));
setMyParamList(paramList);
}
示例2: setParameterList
void
setParameterList (const Teuchos::RCP<Teuchos::ParameterList>& plist)
{
using Teuchos::ParameterList;
using Teuchos::parameterList;
using Teuchos::RCP;
using Teuchos::sublist;
RCP<ParameterList> params = plist.is_null() ?
parameterList (*getValidParameters ()) : plist;
nodeTsqr_->setParameterList (sublist (params, "NodeTsqr"));
distTsqr_->setParameterList (sublist (params, "DistTsqr"));
this->setMyParamList (params);
}
示例3: setParameters
//.........这里部分代码省略.........
}
if (ortho_.is_null() || tempOrthoType != orthoType_) {
mustMakeOrtho = true;
// Ensure that the specified orthogonalization type is valid.
if (! factory.isValidName (tempOrthoType)) {
std::ostringstream os;
os << "Belos::LSQRSolMgr: Invalid orthogonalization name \""
<< tempOrthoType << "\". The following are valid options "
<< "for the \"Orthogonalization\" name parameter: ";
factory.printValidNames (os);
TEUCHOS_TEST_FOR_EXCEPTION(true, std::invalid_argument, os.str());
}
orthoType_ = tempOrthoType; // The name is valid, so accept it.
params_->set ("Orthogonalization", orthoType_);
}
}
// Get any parameters for the orthogonalization ("Orthogonalization
// Parameters"). If not supplied, the orthogonalization manager
// factory will supply default values.
//
// NOTE (mfh 21 Oct 2011) For the sake of backwards compatibility,
// if params has an "Orthogonalization Constant" parameter and the
// DGKS orthogonalization manager is to be used, the value of this
// parameter will override DGKS's "depTol" parameter.
//
// Users must supply the orthogonalization manager parameters as a
// sublist (supplying it as an RCP<ParameterList> would make the
// resulting parameter list not serializable).
RCP<ParameterList> orthoParams;
{ // The nonmember function returns an RCP<ParameterList>,
// which is what we want here.
using Teuchos::sublist;
// Abbreviation to avoid typos.
const std::string paramName ("Orthogonalization Parameters");
try {
orthoParams = sublist (params_, paramName, true);
} catch (InvalidParameter&) {
// We didn't get the parameter list from params, so get a
// default parameter list from the OrthoManagerFactory.
// Modify params_ so that it has the default parameter list,
// and set orthoParams to ensure it's a sublist of params_
// (and not just a copy of one).
params_->set (paramName, factory.getDefaultParameters (orthoType_));
orthoParams = sublist (params_, paramName, true);
}
}
TEUCHOS_TEST_FOR_EXCEPTION(orthoParams.is_null(), std::logic_error,
"Failed to get orthogonalization parameters. "
"Please report this bug to the Belos developers.");
// If we need to, instantiate a new MatOrthoManager subclass
// instance corresponding to the desired orthogonalization method.
// We've already fetched the orthogonalization method name
// (orthoType_) and its parameters (orthoParams) above.
//
// NOTE (mfh 21 Oct 2011) We only instantiate a new MatOrthoManager
// subclass if the orthogonalization method name is different than
// before. Thus, for some orthogonalization managers, changes to
// their parameters may not get propagated, if the manager type
// itself didn't change. The one exception is the "depTol"
// (a.k.a. orthoKappa or "Orthogonalization Constant") parameter of
// DGKS; changes to that _do_ get propagated down to the DGKS
// instance.
示例4: main
int main(int argc, char* argv[])
{
using Teuchos::describe;
using Teuchos::rcp;
using Teuchos::rcp_dynamic_cast;
using Teuchos::rcp_const_cast;
using Teuchos::RCP;
using Teuchos::CommandLineProcessor;
using Teuchos::ParameterList;
using Teuchos::sublist;
using Teuchos::getParametersFromXmlFile;
typedef ParameterList::PrintOptions PLPrintOptions;
using Thyra::inverse;
using Thyra::initializePreconditionedOp;
using Thyra::initializeOp;
using Thyra::unspecifiedPrec;
using Thyra::solve;
typedef RCP<const Thyra::LinearOpBase<double> > LinearOpPtr;
typedef RCP<Thyra::VectorBase<double> > VectorPtr;
bool success = true;
bool verbose = true;
Teuchos::GlobalMPISession mpiSession(&argc,&argv);
Teuchos::RCP<Teuchos::FancyOStream>
out = Teuchos::VerboseObjectBase::getDefaultOStream();
try {
//
// Read in options from the command line
//
CommandLineProcessor clp(false); // Don't throw exceptions
const int numVerbLevels = 6;
Teuchos::EVerbosityLevel
verbLevelValues[] =
{
Teuchos::VERB_DEFAULT, Teuchos::VERB_NONE,
Teuchos::VERB_LOW, Teuchos::VERB_MEDIUM,
Teuchos::VERB_HIGH, Teuchos::VERB_EXTREME
};
const char*
verbLevelNames[] =
{ "default", "none", "low", "medium", "high", "extreme" };
Teuchos::EVerbosityLevel verbLevel = Teuchos::VERB_MEDIUM;
clp.setOption( "verb-level", &verbLevel,
numVerbLevels, verbLevelValues, verbLevelNames,
"Verbosity level used for all objects."
);
std::string matrixFile = ".";
clp.setOption( "matrix-file", &matrixFile,
"Matrix file."
);
std::string paramListFile = "";
clp.setOption( "param-list-file", ¶mListFile,
"Parameter list for preconditioner and solver blocks."
);
bool showParams = false;
clp.setOption( "show-params", "no-show-params", &showParams,
"Show the parameter list or not."
);
bool testPrecIsLinearOp = true;
clp.setOption( "test-prec-is-linear-op", "test-prec-is-linear-op", &testPrecIsLinearOp,
"Test if the preconditioner is a linear operator or not."
);
double solveTol = 1e-8;
clp.setOption( "solve-tol", &solveTol,
"Tolerance for the solution to determine success or failure!"
);
clp.setDocString(
"This example program shows how to use one linear solver (e.g. AztecOO)\n"
"as a preconditioner for another iterative solver (e.g. Belos).\n"
);
// Note: Use --help on the command line to see the above documentation
CommandLineProcessor::EParseCommandLineReturn parse_return = clp.parse(argc,argv);
if( parse_return != CommandLineProcessor::PARSE_SUCCESSFUL ) return parse_return;
//
*out << "\nA) Reading in the matrix ...\n";
//
#ifdef HAVE_MPI
Epetra_MpiComm comm(MPI_COMM_WORLD);
#else
Epetra_SerialComm comm;
#endif
//.........这里部分代码省略.........