本文整理汇总了C++中PetscOptionsHead函数的典型用法代码示例。如果您正苦于以下问题:C++ PetscOptionsHead函数的具体用法?C++ PetscOptionsHead怎么用?C++ PetscOptionsHead使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PetscOptionsHead函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: VecSetFromOptions_MPI
static PetscErrorCode VecSetFromOptions_MPI(PetscOptionItems *PetscOptionsObject,Vec X)
{
PetscErrorCode ierr;
PetscBool flg = PETSC_FALSE,set;
PetscFunctionBegin;
ierr = PetscOptionsHead(PetscOptionsObject,"VecMPI Options");CHKERRQ(ierr);
ierr = PetscOptionsBool("-vec_assembly_bts","Use BuildTwoSided version of assembly","",flg,&flg,&set);CHKERRQ(ierr);
if (set) {
X->ops->assemblybegin = flg ? VecAssemblyBegin_MPI_BTS : VecAssemblyBegin_MPI;
X->ops->assemblyend = flg ? VecAssemblyEnd_MPI_BTS : VecAssemblyEnd_MPI;
}
ierr = PetscOptionsTail();CHKERRQ(ierr);
PetscFunctionReturn(0);
}
示例2: SNESSetFromOptions_LS
static PetscErrorCode SNESSetFromOptions_LS(SNES snes)
{
PetscErrorCode ierr;
SNESLineSearch linesearch;
PetscFunctionBegin;
ierr = PetscOptionsHead("SNESLS options");CHKERRQ(ierr);
ierr = PetscOptionsTail();CHKERRQ(ierr);
/* set the default line search type */
if (!snes->linesearch) {
ierr = SNESGetSNESLineSearch(snes, &linesearch);CHKERRQ(ierr);
ierr = SNESLineSearchSetType(linesearch, SNESLINESEARCHBT);CHKERRQ(ierr);
}
PetscFunctionReturn(0);
}
示例3: KSPSetFromOptions_CG
PetscErrorCode KSPSetFromOptions_CG(PetscOptions *PetscOptionsObject,KSP ksp)
{
PetscErrorCode ierr;
KSP_CG *cg = (KSP_CG*)ksp->data;
PetscFunctionBegin;
ierr = PetscOptionsHead(PetscOptionsObject,"KSP CG and CGNE options");CHKERRQ(ierr);
#if defined(PETSC_USE_COMPLEX)
ierr = PetscOptionsEnum("-ksp_cg_type","Matrix is Hermitian or complex symmetric","KSPCGSetType",KSPCGTypes,(PetscEnum)cg->type,
(PetscEnum*)&cg->type,NULL);CHKERRQ(ierr);
#endif
ierr = PetscOptionsBool("-ksp_cg_single_reduction","Merge inner products into single MPI_Allreduce()","KSPCGUseSingleReduction",cg->singlereduction,&cg->singlereduction,NULL);CHKERRQ(ierr);
ierr = PetscOptionsTail();CHKERRQ(ierr);
PetscFunctionReturn(0);
}
示例4: SNESLineSearchSetFromOptions_BT
static PetscErrorCode SNESLineSearchSetFromOptions_BT(SNESLineSearch linesearch)
{
PetscErrorCode ierr;
SNESLineSearch_BT *bt;
PetscFunctionBegin;
bt = (SNESLineSearch_BT*)linesearch->data;
ierr = PetscOptionsHead("SNESLineSearch BT options");CHKERRQ(ierr);
ierr = PetscOptionsReal("-snes_linesearch_alpha", "Descent tolerance", "SNESLineSearchBT", bt->alpha, &bt->alpha, NULL);CHKERRQ(ierr);
ierr = PetscOptionsTail();CHKERRQ(ierr);
PetscFunctionReturn(0);
}
示例5: SVDSetFromOptions_TRLanczos
PetscErrorCode SVDSetFromOptions_TRLanczos(SVD svd)
{
PetscErrorCode ierr;
PetscBool set,val;
SVD_TRLANCZOS *lanczos = (SVD_TRLANCZOS*)svd->data;
PetscFunctionBegin;
ierr = PetscOptionsHead("SVD TRLanczos Options");CHKERRQ(ierr);
ierr = PetscOptionsBool("-svd_trlanczos_oneside","Lanczos one-side reorthogonalization","SVDTRLanczosSetOneSide",lanczos->oneside,&val,&set);CHKERRQ(ierr);
if (set) {
ierr = SVDTRLanczosSetOneSide(svd,val);CHKERRQ(ierr);
}
ierr = PetscOptionsTail();CHKERRQ(ierr);
PetscFunctionReturn(0);
}
示例6: DMSetFromOptions_Complex
PetscErrorCode DMSetFromOptions_Complex(DM dm)
{
DM_Complex *mesh = (DM_Complex *) dm->data;
PetscErrorCode ierr;
PetscFunctionBegin;
PetscValidHeaderSpecific(dm, DM_CLASSID, 1);
ierr = PetscOptionsHead("DMComplex Options");CHKERRQ(ierr);
/* Handle DMComplex refinement */
/* Handle associated vectors */
/* Handle viewing */
ierr = PetscOptionsBool("-dm_complex_print_set_values", "Output all set values info", "DMView", PETSC_FALSE, &mesh->printSetValues, PETSC_NULL);CHKERRQ(ierr);
ierr = PetscOptionsTail();CHKERRQ(ierr);
PetscFunctionReturn(0);
}
示例7: KSPCGSetFromOptions_NASH
static PetscErrorCode KSPCGSetFromOptions_NASH(PetscOptionItems *PetscOptionsObject,KSP ksp)
{
PetscErrorCode ierr;
KSPCG_NASH *cg = (KSPCG_NASH*)ksp->data;
PetscFunctionBegin;
ierr = PetscOptionsHead(PetscOptionsObject,"KSPCG NASH options");CHKERRQ(ierr);
ierr = PetscOptionsReal("-ksp_cg_radius", "Trust Region Radius", "KSPCGSetRadius", cg->radius, &cg->radius, NULL);CHKERRQ(ierr);
ierr = PetscOptionsEList("-ksp_cg_dtype", "Norm used for direction", "", DType_Table, NASH_DIRECTION_TYPES, DType_Table[cg->dtype], &cg->dtype, NULL);CHKERRQ(ierr);
ierr = PetscOptionsTail();CHKERRQ(ierr);
PetscFunctionReturn(0);
}
示例8: KSPSetFromOptions_FGMRES
PetscErrorCode KSPSetFromOptions_FGMRES(KSP ksp)
{
PetscErrorCode ierr;
PetscBool flg;
PetscFunctionBegin;
ierr = KSPSetFromOptions_GMRES(ksp);CHKERRQ(ierr);
ierr = PetscOptionsHead("KSP flexible GMRES Options");CHKERRQ(ierr);
ierr = PetscOptionsBoolGroupBegin("-ksp_fgmres_modifypcnochange","do not vary the preconditioner","KSPFGMRESSetModifyPC",&flg);CHKERRQ(ierr);
if (flg) {ierr = KSPFGMRESSetModifyPC(ksp,KSPFGMRESModifyPCNoChange,0,0);CHKERRQ(ierr);}
ierr = PetscOptionsBoolGroupEnd("-ksp_fgmres_modifypcksp","vary the KSP based preconditioner","KSPFGMRESSetModifyPC",&flg);CHKERRQ(ierr);
if (flg) {ierr = KSPFGMRESSetModifyPC(ksp,KSPFGMRESModifyPCKSP,0,0);CHKERRQ(ierr);}
ierr = PetscOptionsTail();CHKERRQ(ierr);
PetscFunctionReturn(0);
}
示例9: TaoSetFromOptions_NM
PetscErrorCode TaoSetFromOptions_NM(Tao tao)
{
TAO_NelderMead *nm = (TAO_NelderMead*)tao->data;
PetscBool flg;
PetscErrorCode ierr;
PetscFunctionBegin;
ierr = PetscOptionsHead("Nelder-Mead options");CHKERRQ(ierr);
ierr = PetscOptionsReal("-tao_nm_lamda","initial step length","",nm->lamda,&nm->lamda,&flg); CHKERRQ(ierr);
ierr = PetscOptionsReal("-tao_nm_mu","mu","",nm->mu_oc,&nm->mu_oc,&flg);CHKERRQ(ierr);
nm->mu_ic = -nm->mu_oc;
nm->mu_r = nm->mu_oc*2.0;
nm->mu_e = nm->mu_oc*4.0;
ierr = PetscOptionsTail();CHKERRQ(ierr);
PetscFunctionReturn(0);
}
示例10: PCSetFromOptions_Eisenstat
static PetscErrorCode PCSetFromOptions_Eisenstat(PC pc)
{
PC_Eisenstat *eis = (PC_Eisenstat*)pc->data;
PetscErrorCode ierr;
PetscBool flg = PETSC_FALSE;
PetscFunctionBegin;
ierr = PetscOptionsHead("Eisenstat SSOR options");CHKERRQ(ierr);
ierr = PetscOptionsReal("-pc_eisenstat_omega","Relaxation factor 0 < omega < 2","PCEisenstatSetOmega",eis->omega,&eis->omega,PETSC_NULL);CHKERRQ(ierr);
ierr = PetscOptionsBool("-pc_eisenstat_no_diagonal_scaling","Do not use standard diagonal scaling","PCEisenstatNoDiagonalScaling",flg,&flg,PETSC_NULL);CHKERRQ(ierr);
if (flg) {
ierr = PCEisenstatNoDiagonalScaling(pc);CHKERRQ(ierr);
}
ierr = PetscOptionsTail();CHKERRQ(ierr);
PetscFunctionReturn(0);
}
示例11: TSSetFromOptions_Theta
static PetscErrorCode TSSetFromOptions_Theta(TS ts)
{
TS_Theta *th = (TS_Theta*)ts->data;
PetscErrorCode ierr;
PetscFunctionBegin;
ierr = PetscOptionsHead("Theta ODE solver options");CHKERRQ(ierr);
{
ierr = PetscOptionsReal("-ts_theta_theta","Location of stage (0<Theta<=1)","TSThetaSetTheta",th->Theta,&th->Theta,PETSC_NULL);CHKERRQ(ierr);
ierr = PetscOptionsBool("-ts_theta_extrapolate","Extrapolate stage solution from previous solution (sometimes unstable)","TSThetaSetExtrapolate",th->extrapolate,&th->extrapolate,PETSC_NULL);CHKERRQ(ierr);
ierr = PetscOptionsBool("-ts_theta_endpoint","Use the endpoint instead of midpoint form of the Theta method","TSThetaSetEndpoint",th->endpoint,&th->endpoint,PETSC_NULL);CHKERRQ(ierr);
ierr = SNESSetFromOptions(ts->snes);CHKERRQ(ierr);
}
ierr = PetscOptionsTail();CHKERRQ(ierr);
PetscFunctionReturn(0);
}
示例12: KSPSetFromOptions_LGMRES
PetscErrorCode KSPSetFromOptions_LGMRES(PetscOptions *PetscOptionsObject,KSP ksp)
{
PetscErrorCode ierr;
PetscInt aug;
KSP_LGMRES *lgmres = (KSP_LGMRES*) ksp->data;
PetscBool flg = PETSC_FALSE;
PetscFunctionBegin;
ierr = KSPSetFromOptions_GMRES(PetscOptionsObject,ksp);CHKERRQ(ierr);
ierr = PetscOptionsHead(PetscOptionsObject,"KSP LGMRES Options");CHKERRQ(ierr);
ierr = PetscOptionsBool("-ksp_lgmres_constant","Use constant approx. space size","KSPGMRESSetConstant",lgmres->approx_constant,&lgmres->approx_constant,NULL);CHKERRQ(ierr);
ierr = PetscOptionsInt("-ksp_lgmres_augment","Number of error approximations to augment the Krylov space with","KSPLGMRESSetAugDim",lgmres->aug_dim,&aug,&flg);CHKERRQ(ierr);
if (flg) { ierr = KSPLGMRESSetAugDim(ksp,aug);CHKERRQ(ierr); }
ierr = PetscOptionsTail();CHKERRQ(ierr);
PetscFunctionReturn(0);
}
示例13: KSPSetFromOptions_STCG
EXTERN_C_END
#undef __FUNCT__
#define __FUNCT__ "KSPSetFromOptions_STCG"
PetscErrorCode KSPSetFromOptions_STCG(KSP ksp)
{
PetscErrorCode ierr;
KSP_STCG *cg = (KSP_STCG *)ksp->data;
PetscFunctionBegin;
ierr = PetscOptionsHead("KSP STCG options");CHKERRQ(ierr);
ierr = PetscOptionsReal("-ksp_stcg_radius", "Trust Region Radius", "KSPSTCGSetRadius", cg->radius, &cg->radius, PETSC_NULL);CHKERRQ(ierr);
ierr = PetscOptionsEList("-ksp_stcg_dtype", "Norm used for direction", "", DType_Table, STCG_DIRECTION_TYPES, DType_Table[cg->dtype], &cg->dtype, PETSC_NULL);CHKERRQ(ierr);
ierr = PetscOptionsTail();CHKERRQ(ierr);
PetscFunctionReturn(0);
}
示例14: KSPSetFromOptions_Richardson
PetscErrorCode KSPSetFromOptions_Richardson(KSP ksp)
{
KSP_Richardson *rich = (KSP_Richardson*)ksp->data;
PetscErrorCode ierr;
PetscReal tmp;
PetscBool flg,flg2;
PetscFunctionBegin;
ierr = PetscOptionsHead("KSP Richardson Options");CHKERRQ(ierr);
ierr = PetscOptionsReal("-ksp_richardson_scale","damping factor","KSPRichardsonSetScale",rich->scale,&tmp,&flg);CHKERRQ(ierr);
if (flg) { ierr = KSPRichardsonSetScale(ksp,tmp);CHKERRQ(ierr); }
ierr = PetscOptionsBool("-ksp_richardson_self_scale","dynamically determine optimal damping factor","KSPRichardsonSetSelfScale",rich->selfscale,&flg2,&flg);CHKERRQ(ierr);
if (flg) { ierr = KSPRichardsonSetSelfScale(ksp,flg2);CHKERRQ(ierr); }
ierr = PetscOptionsTail();CHKERRQ(ierr);
PetscFunctionReturn(0);
}
示例15: TaoSetFromOptions_Test
static PetscErrorCode TaoSetFromOptions_Test(PetscOptions *PetscOptionsObject,Tao tao)
{
Tao_Test *fd = (Tao_Test *)tao->data;
PetscErrorCode ierr;
PetscFunctionBegin;
ierr = PetscOptionsHead(PetscOptionsObject,"Hand-coded Hessian tester options");CHKERRQ(ierr);
ierr = PetscOptionsBool("-tao_test_display","Display difference between hand-coded and finite difference Hessians","None",fd->complete_print,&fd->complete_print,NULL);CHKERRQ(ierr);
ierr = PetscOptionsBool("-tao_test_gradient","Test Hand-coded gradient against finite-difference gradient","None",fd->check_gradient,&fd->check_gradient,NULL);CHKERRQ(ierr);
ierr = PetscOptionsBool("-tao_test_hessian","Test Hand-coded hessian against finite-difference hessian","None",fd->check_hessian,&fd->check_hessian,NULL);CHKERRQ(ierr);
if (fd->check_gradient == PETSC_FALSE && fd->check_hessian == PETSC_FALSE) {
fd->check_gradient = PETSC_TRUE;
}
ierr = PetscOptionsTail();CHKERRQ(ierr);
PetscFunctionReturn(0);
}