本文整理汇总了C++中Teuchos::setDoubleParameter方法的典型用法代码示例。如果您正苦于以下问题:C++ Teuchos::setDoubleParameter方法的具体用法?C++ Teuchos::setDoubleParameter怎么用?C++ Teuchos::setDoubleParameter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Teuchos
的用法示例。
在下文中一共展示了Teuchos::setDoubleParameter方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetValidAggrParams
void ML_Epetra::SetValidAggrParams(Teuchos::ParameterList *PL)
{
using Teuchos::AnyNumberParameterEntryValidator;
using Teuchos::setIntParameter;
using Teuchos::setDoubleParameter;
using Teuchos::setStringToIntegralParameter;
using Teuchos::tuple;
using std::string;
// prevent Teuchos from converting parameter types
AnyNumberParameterEntryValidator::AcceptedTypes intParam(false),
dblParam(false),
strParam(false);
intParam.allowInt(true);
dblParam.allowDouble(true);
strParam.allowString(true);
/* Aggregation and Prolongator Options (Section 6.4.3) */
setStringToIntegralParameter<int>("aggregation: type", "Uncoupled", "Aggregation algorithm", tuple<string>("Uncoupled","Coupled","MIS","Uncoupled-MIS","METIS","ParMETIS","Zoltan","user"),PL);
setDoubleParameter("aggregation: threshold",0.0,"Dropping for aggregation",PL,dblParam);
setDoubleParameter("aggregation: damping factor",1.3333,"Damping factor for smoothed aggregation",PL,dblParam);
setIntParameter("aggregation: smoothing sweeps",1,"Number of sweeps for prolongator smoother",PL,intParam);
setIntParameter("aggregation: global aggregates",0,"Number of global aggregates (METIS/ParMETIS)",PL,intParam);
setIntParameter("aggregation: local aggregates",0,"Number of local aggregates (METIS/ParMETIS)",PL,intParam);
setIntParameter("aggregation: nodes per aggregate",0,"Number of nodes per aggregate (METIS/ParMETIS)",PL,intParam);
setIntParameter("aggregation: next-level aggregates per process",128,"Number of next-level rows / process (ParMETIS)",PL,intParam);
PL->set("aggregation: use tentative restriction",false);
PL->set("aggregation: symmetrize",false);
/* Highly experimental */
PL->set("aggregation: respect materials",false);
PL->set("aggregation: material type",(int*)0);
}//SetValidAggrParams()
示例2: SetValidSmooParams
void ML_Epetra::SetValidSmooParams(Teuchos::ParameterList *PL, Teuchos::Array<std::string> &smoothers)
{
using Teuchos::AnyNumberParameterEntryValidator;
using Teuchos::ParameterList;
using Teuchos::RCP;
using Teuchos::rcp;
using Teuchos::setIntParameter;
using Teuchos::setDoubleParameter;
using Teuchos::setStringToIntegralParameter;
using Teuchos::tuple; // Different than std::tuple.
using std::string;
using std::vector;
ParameterList dummy;
// prevent Teuchos from converting parameter types
AnyNumberParameterEntryValidator::AcceptedTypes intParam(false),
dblParam(false),
strParam(false);
intParam.allowInt(true);
dblParam.allowDouble(true);
strParam.allowString(true);
/* Smoothing Options (Section 6.4.4) */
setStringToIntegralParameter<int>("smoother: type", string("Chebyshev"),
"Smoothing algorithm",smoothers,PL);
setIntParameter("smoother: sweeps", 2, "Number of smoothing sweeps", PL, intParam);
setDoubleParameter("smoother: damping factor",1.0,"Smoother damping factor",PL,dblParam);
setStringToIntegralParameter<int>("smoother: pre or post","both","Smooth before/after coarse correction, or both",tuple<string>("pre","post","both"),PL);
#ifdef HAVE_ML_AZTECOO
RCP<std::vector<int> > options = rcp(new std::vector<int>(AZ_OPTIONS_SIZE));
RCP<std::vector<double> > params = rcp(new std::vector<double>(AZ_PARAMS_SIZE));
PL->set("smoother: Aztec options",options);
PL->set("smoother: Aztec params",params);
#endif
PL->set("smoother: Aztec as solver",false);
setDoubleParameter("smoother: Chebyshev alpha",20.0,"Damping radius for Chebyshev",PL,dblParam);
setDoubleParameter("smoother: MLS alpha",20.0,"Damping radius for Chebyshev",PL,dblParam);
PL->set("smoother: user-defined function",(int(*)(ML_Smoother*,int,double*,int,double*))0);
PL->set("smoother: user-defined name",string("User-defined"));
PL->set("smoother: Hiptmair efficient symmetric",true);
setStringToIntegralParameter<int>("subsmoother: type","Chebyshev","Subsmoother algorithm (Maxwell)",tuple<string>("Chebyshev","symmetric Gauss-Seidel","MLS"),PL);
setDoubleParameter("subsmoother: Chebyshev alpha",20.0,"Damping radius for Chebshev",PL,dblParam);
setDoubleParameter("subsmoother: MLS alpha",20.0,"Damping radius for Chebshev",PL,dblParam);
setDoubleParameter("subsmoother: damping factor",1.333,"Damping factor for symmetric Gauss-Seidel",PL,dblParam);
setIntParameter("subsmoother: edge sweeps",4,"Number of edge smoothing sweeps",PL,intParam);
setIntParameter("subsmoother: node sweeps",4,"Number of node smoothing sweeps",PL,intParam);
# ifdef HAVE_PETSC
void *petscKSP;
PL->set("smoother: petsc ksp",petscKSP);
# endif
# ifdef HAVE_ML_TekoSmoothers
{
RCP<ParameterList> nullList;
PL->set("smoother: teko filename",std::string("teko_smoother.xml"));
PL->set<RCP<const Teko::InverseLibrary> >("smoother: teko inverse library",Teuchos::null);
PL->set("smoother: teko parameter list",nullList);
PL->set("smoother: teko inverse",std::string("Amesos"));
PL->set("smoother: teko is blocked",0);
}
# endif
/* Unlisted Options */
setIntParameter("smoother: self overlap",0,"experimental option",PL,intParam);
/* Unlisted Options that should probably be listed */
PL->set("smoother: self list",dummy);
PL->sublist("smoother: self list").disableRecursiveValidation();
setDoubleParameter("coarse: add to diag", 0.0,"Unlisted option",PL,dblParam);
// From ml_Multilevel_Smoothers.cpp:
setIntParameter("smoother: ParaSails matrix",0,"Unlisted option",PL,intParam);
setIntParameter("smoother: ParaSails levels",0,"Unlisted option",PL,intParam);
setDoubleParameter("smoother: ParaSails threshold",0.01,"Unlisted option",PL,dblParam);
setDoubleParameter("smoother: ParaSails filter",0.05,"Unlisted option",PL,dblParam);
setDoubleParameter("smoother: ParaSails load balancing",0,"Unlisted option",PL,dblParam);
setIntParameter("smoother: ParaSails factorized",0,"Unlisted option",PL,intParam);
PL->set("smoother: ifpack list",dummy);
PL->sublist("smoother: ifpack list").disableRecursiveValidation();
PL->set("smoother: ifpack type",string(""));
setIntParameter("smoother: ifpack overlap",0,"Unlisted option",PL,intParam);
setDoubleParameter("smoother: ifpack level-of-fill",0.0,"Unlisted option",PL,dblParam);
setDoubleParameter("smoother: ifpack relative threshold",1.0,"Unlisted option",PL,dblParam);
setDoubleParameter("smoother: ifpack absolute threshold",0.0,"Unlisted option",PL,dblParam);
/* Unlisted options that should probably go away */
setIntParameter("smoother: polynomial order",2,"Unlisted option",PL,intParam);
setIntParameter("smoother: MLS polynomial order",2,"Unlisted option",PL,intParam);
setIntParameter("coarse: polynomial order",2,"Unlisted option",PL,intParam);
setIntParameter("coarse: MLS polynomial order",2,"Unlisted option",PL,intParam);
/*
Coarse grid options.
NOTE: "inList" has already been run through ML_CreateSublist(). In
particular, all coarse level options are now in a sublist called "coarse:
list". Furthermore, in the coares list any coarse level option, i.e.,
starts with "coarse:", has been converted to a smoother option of the
same name. So for example, "coarse: type" is now "smoother: type".
Admittedly, this does create some peculiar options, such as
"smoother: max size".
The upshot is that all valid coarse level options from this point in the
code execution start with "smoother:".
*/
//.........这里部分代码省略.........
示例3: intParam
Teuchos::ParameterList * ML_Epetra::GetValidMLPParameters(){
using Teuchos::AnyNumberParameterEntryValidator;
using Teuchos::Array;
using Teuchos::ParameterList;
using Teuchos::setIntParameter;
using Teuchos::setDoubleParameter;
using Teuchos::setStringToIntegralParameter;
using Teuchos::tuple;
using std::string;
ParameterList dummy;
ParameterList * PL = new ParameterList;
// prevent Teuchos from converting parameter types
AnyNumberParameterEntryValidator::AcceptedTypes intParam(false),
dblParam(false),
strParam(false);
intParam.allowInt(true);
dblParam.allowDouble(true);
strParam.allowString(true);
/* Allocate List for Smoothing Options */
# if defined(HAVE_PETSC) && defined(HAVE_ML_SUPERLU4_0)
const int num_smoothers=30;
# elif defined(HAVE_PETSC) || defined(HAVE_ML_SUPERLU4_0)
const int num_smoothers=29;
#elif defined(HAVE_ML_TekoSmoothers)
const int num_smoothers=29; // won't work with SUPERLU or PETSC!
# else
const int num_smoothers=28;
# endif
const char* smoother_strings[num_smoothers]={"Aztec","IFPACK","Jacobi",
"ML symmetric Gauss-Seidel","symmetric Gauss-Seidel","ML Gauss-Seidel",
"Gauss-Seidel","block Gauss-Seidel","symmetric block Gauss-Seidel",
"Chebyshev","MLS","Hiptmair","Amesos-KLU","Amesos-Superlu",
"Amesos-UMFPACK","Amesos-Superludist","Amesos-MUMPS","user-defined",
"SuperLU","IFPACK-Chebyshev","self","do-nothing","IC","ICT","ILU","ILUT",
"Block Chebyshev","IFPACK-Block Chebyshev"
# ifdef HAVE_PETSC
,"petsc"
# endif
# ifdef HAVE_ML_SUPERLU4_0
,"SILU"
//#else
//#error "No SuperLU for you!"
# endif
# ifdef HAVE_ML_TekoSmoothers
,"teko"
# endif
};
Array<string> smoothers(num_smoothers);
for(int i = 0; i<num_smoothers; i++) {
smoothers[i] = smoother_strings[i];
}
/* General Options (Section 6.4.1) */
setIntParameter("ML output",0,"Output Level",PL,intParam);
setIntParameter("print unused",-2,"Print unused parameters",PL,intParam);
setIntParameter("ML print initial list",-2,"Print initial list supplied to constructor",PL,intParam);
setIntParameter("ML print final list",-2,"Print final list used by constructor",PL,intParam);
setIntParameter("PDE equations",1,"# of PDE equations per node",PL,intParam);
setStringToIntegralParameter<int>("eigen-analysis: type","cg","Scheme to compute spectral radius",
tuple<string>("cg","Anorm","power-method"),PL);
setIntParameter("eigen-analysis: iterations",10,"# iterations of eigen-anaysis",PL,intParam);
PL->set("ML label","dummy string");
setIntParameter("print hierarchy",-2,"Print hierarchy. 0 or greater prints individual levels.",PL,intParam);
/* Multigrid Cycle Options (Section 6.4.2) */
setIntParameter("cycle applications",1,"# MG cycles",PL,intParam);
setIntParameter("max levels",10,"Max # of levels",PL,intParam);
setStringToIntegralParameter<int>("increasing or decreasing", "increasing", "Level numbering",tuple<string>("increasing","decreasing"),PL);
setStringToIntegralParameter<int>("prec type", "MGV","Multigrid cycle type",tuple<string>("MGV","MGW","full-MGV","one-level-postsmoothing","two-level-additive","two-level-hybrid","two-level-hybrid2","projected MGV"),PL);
PL->set("projected mode",(double**)0);
setIntParameter("number of projected modes",0,"# of modes to be projected out before and after the V-cycle",PL,intParam);
/* Aggregation and Prolongator Options (Section 6.4.3) */
SetValidAggrParams(PL);
for (int i = 0; i < 10; ++i) {
char param[32];
sprintf(param,"aggregation: list (level %d)",i);
SetValidAggrParams(&(PL->sublist(param)));
}
PL->set("energy minimization: enable",false);
setIntParameter("energy minimization: type",2,"Norm to use for energy minimization",PL,intParam);
setDoubleParameter("energy minimization: droptol",0.0,"Drop tolerance for energy minimization",PL,dblParam);
PL->set("energy minimization: cheap",false);
/* Smoothing Options (Section 6.4.4) */
SetValidSmooParams(PL,smoothers);
for (int i = 0; i < 10; ++i) {
char param[32];
sprintf(param,"smoother: list (level %d)",i);
SetValidSmooParams(&(PL->sublist(param)),smoothers);
}
SetValidSmooParams(&(PL->sublist("coarse: list")),smoothers);
/* Load-balancing Options (Section 6.4.6) */
setIntParameter("repartition: enable",0,"Enable repartitioning",PL,intParam);
setStringToIntegralParameter<int>("repartition: partitioner","Zoltan","Repartitioning method",tuple<string>("Zoltan","ParMETIS"),PL);
//.........这里部分代码省略.........