本文整理汇总了C++中PetscTryMethod函数的典型用法代码示例。如果您正苦于以下问题:C++ PetscTryMethod函数的具体用法?C++ PetscTryMethod怎么用?C++ PetscTryMethod使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PetscTryMethod函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TSPseudoTimeStepDefault
/*@
TSPseudoSetMaxTimeStep - Sets the maximum time step
when using the TSPseudoTimeStepDefault() routine.
Logically Collective on TS
Input Parameters:
+ ts - the timestep context
- maxdt - the maximum time step, use a non-positive value to deactivate
Options Database Key:
$ -ts_pseudo_max_dt <increment>
Level: advanced
.keywords: timestep, pseudo, set
.seealso: TSPseudoSetTimeStep(), TSPseudoTimeStepDefault()
@*/
PetscErrorCode TSPseudoSetMaxTimeStep(TS ts,PetscReal maxdt)
{
PetscErrorCode ierr;
PetscFunctionBegin;
PetscValidHeaderSpecific(ts,TS_CLASSID,1);
PetscValidLogicalCollectiveReal(ts,maxdt,2);
ierr = PetscTryMethod(ts,"TSPseudoSetMaxTimeStep_C",(TS,PetscReal),(ts,maxdt));CHKERRQ(ierr);
PetscFunctionReturn(0);
}
示例2: EPSJDGetKrylovStart
/*@
EPSJDSetKrylovStart - Activates or deactivates starting the searching
subspace with a Krylov basis.
Logically Collective on EPS
Input Parameters:
+ eps - the eigenproblem solver context
- krylovstart - boolean flag
Options Database Key:
. -eps_jd_krylov_start - Activates starting the searching subspace with a
Krylov basis
Level: advanced
.seealso: EPSJDGetKrylovStart()
@*/
PetscErrorCode EPSJDSetKrylovStart(EPS eps,PetscBool krylovstart)
{
PetscErrorCode ierr;
PetscFunctionBegin;
PetscValidHeaderSpecific(eps,EPS_CLASSID,1);
PetscValidLogicalCollectiveBool(eps,krylovstart,2);
ierr = PetscTryMethod(eps,"EPSJDSetKrylovStart_C",(EPS,PetscBool),(eps,krylovstart));CHKERRQ(ierr);
PetscFunctionReturn(0);
}
示例3: MatPartitioningChacoSetEigenSolver
/*@
MatPartitioningChacoSetEigenTol - Sets the tolerance for the eigensolver.
Collective on MatPartitioning
Input Parameters:
+ part - the partitioning context
- tol - the tolerance
Options Database:
. -mat_partitioning_chaco_eigen_tol <tol>: Tolerance for eigensolver
Note:
Must be positive. The default value is 0.001.
Level: advanced
.seealso: MatPartitioningChacoSetEigenSolver(), MatPartitioningChacoGetEigenTol()
@*/
PetscErrorCode MatPartitioningChacoSetEigenTol(MatPartitioning part,PetscReal tol)
{
PetscErrorCode ierr;
PetscFunctionBegin;
PetscValidHeaderSpecific(part,MAT_PARTITIONING_CLASSID,1);
PetscValidLogicalCollectiveReal(part,tol,2);
ierr = PetscTryMethod(part,"MatPartitioningChacoSetEigenTol_C",(MatPartitioning,PetscReal),(part,tol));CHKERRQ(ierr);
PetscFunctionReturn(0);
}
示例4: PCRedundantSetNumber
/*@
PCRedundantSetNumber - Sets the number of redundant preconditioner contexts.
Logically Collective on PC
Input Parameters:
+ pc - the preconditioner context
- nredundant - number of redundant preconditioner contexts; for example if you are using 64 MPI processes and
use an nredundant of 4 there will be 4 parallel solves each on 16 = 64/4 processes.
Level: advanced
.keywords: PC, redundant solve
@*/
PetscErrorCode PCRedundantSetNumber(PC pc,PetscInt nredundant)
{
PetscErrorCode ierr;
PetscFunctionBegin;
PetscValidHeaderSpecific(pc,PC_CLASSID,1);
if (nredundant <= 0) SETERRQ1(PetscObjectComm((PetscObject)pc),PETSC_ERR_ARG_WRONG, "num of redundant pc %D must be positive",nredundant);
ierr = PetscTryMethod(pc,"PCRedundantSetNumber_C",(PC,PetscInt),(pc,nredundant));CHKERRQ(ierr);
PetscFunctionReturn(0);
}
示例5: PetscViewerFileSetMode
/*@C
PetscViewerFileSetMode - Sets the type of file to be open
Logically Collective on PetscViewer
Input Parameters:
+ viewer - the PetscViewer; must be a binary, Matlab, hdf, or netcdf PetscViewer
- type - type of file
$ FILE_MODE_WRITE - create new file for binary output
$ FILE_MODE_READ - open existing file for binary input
$ FILE_MODE_APPEND - open existing file for binary output
Level: advanced
.seealso: PetscViewerFileSetMode(), PetscViewerCreate(), PetscViewerSetType(), PetscViewerBinaryOpen()
@*/
PetscErrorCode PetscViewerFileSetMode(PetscViewer viewer,PetscFileMode type)
{
PetscErrorCode ierr;
PetscFunctionBegin;
PetscValidHeaderSpecific(viewer,PETSC_VIEWER_CLASSID,1);
PetscValidLogicalCollectiveEnum(viewer,type,2);
ierr = PetscTryMethod(viewer,"PetscViewerFileSetMode_C",(PetscViewer,PetscFileMode),(viewer,type));CHKERRQ(ierr);
PetscFunctionReturn(0);
}
示例6: PEPLinearGetExplicitMatrix
/*@
PEPLinearSetExplicitMatrix - Indicate if the matrices A and B for the
linearization of the problem must be built explicitly.
Logically Collective on PEP
Input Parameters:
+ pep - polynomial eigenvalue solver
- explicit - boolean flag indicating if the matrices are built explicitly
Options Database Key:
. -pep_linear_explicitmatrix <boolean> - Indicates the boolean flag
Level: advanced
.seealso: PEPLinearGetExplicitMatrix()
@*/
PetscErrorCode PEPLinearSetExplicitMatrix(PEP pep,PetscBool explicitmatrix)
{
PetscErrorCode ierr;
PetscFunctionBegin;
PetscValidHeaderSpecific(pep,PEP_CLASSID,1);
PetscValidLogicalCollectiveBool(pep,explicitmatrix,2);
ierr = PetscTryMethod(pep,"PEPLinearSetExplicitMatrix_C",(PEP,PetscBool),(pep,explicitmatrix));CHKERRQ(ierr);
PetscFunctionReturn(0);
}
示例7: SVDLanczosSetOneSide
/*@
SVDTRLanczosSetOneSide - Indicate if the variant of the Lanczos method
to be used is one-sided or two-sided.
Logically Collective on SVD
Input Parameters:
+ svd - singular value solver
- oneside - boolean flag indicating if the method is one-sided or not
Options Database Key:
. -svd_trlanczos_oneside <boolean> - Indicates the boolean flag
Note:
By default, a two-sided variant is selected, which is sometimes slightly
more robust. However, the one-sided variant is faster because it avoids
the orthogonalization associated to left singular vectors.
Level: advanced
.seealso: SVDLanczosSetOneSide()
@*/
PetscErrorCode SVDTRLanczosSetOneSide(SVD svd,PetscBool oneside)
{
PetscErrorCode ierr;
PetscFunctionBegin;
PetscValidHeaderSpecific(svd,SVD_CLASSID,1);
PetscValidLogicalCollectiveBool(svd,oneside,2);
ierr = PetscTryMethod(svd,"SVDTRLanczosSetOneSide_C",(SVD,PetscBool),(svd,oneside));CHKERRQ(ierr);
PetscFunctionReturn(0);
}
示例8: MPI_Allreduce
/*@
KSPCGUseSingleReduction - Merge the two inner products needed in CG into a single MPI_Allreduce() call.
Logically Collective on KSP
Input Parameters:
+ ksp - the iterative context
- flg - turn on or off the single reduction
Options Database:
. -ksp_cg_single_reduction
Level: intermediate
The algorithm used in this case is described as Method 1 in Lapack Working Note 56, "Conjugate Gradient Algorithms with Reduced Synchronization Overhead
Distributed Memory Multiprocessors", by E. F. D'Azevedo, V. L. Eijkhout, and C. H. Romine, December 3, 1999. V. Eijkhout creates the algorithm
initially to Chronopoulos and Gear.
It requires two extra work vectors than the conventional implementation in PETSc.
.keywords: CG, conjugate gradient, Hermitian, symmetric, set, type
@*/
PetscErrorCode KSPCGUseSingleReduction(KSP ksp,PetscBool flg)
{
PetscErrorCode ierr;
PetscFunctionBegin;
PetscValidHeaderSpecific(ksp,KSP_CLASSID,1);
PetscValidLogicalCollectiveBool(ksp,flg,2);
ierr = PetscTryMethod(ksp,"KSPCGUseSingleReduction_C",(KSP,PetscBool),(ksp,flg));CHKERRQ(ierr);
PetscFunctionReturn(0);
}
示例9: SNES_COMPOSITE_ADDITIVE
/*@C
SNESCompositeSetType - Sets the type of composite preconditioner.
Logically Collective on SNES
Input Parameter:
+ snes - the preconditioner context
- type - SNES_COMPOSITE_ADDITIVE (default), SNES_COMPOSITE_MULTIPLICATIVE
Options Database Key:
. -snes_composite_type <type: one of multiplicative, additive, special> - Sets composite preconditioner type
Level: Developer
.keywords: SNES, set, type, composite preconditioner, additive, multiplicative
@*/
PetscErrorCode SNESCompositeSetType(SNES snes,SNESCompositeType type)
{
PetscErrorCode ierr;
PetscFunctionBegin;
PetscValidHeaderSpecific(snes,SNES_CLASSID,1);
PetscValidLogicalCollectiveEnum(snes,type,2);
ierr = PetscTryMethod(snes,"SNESCompositeSetType_C",(SNES,SNESCompositeType),(snes,type));CHKERRQ(ierr);
PetscFunctionReturn(0);
}
示例10: radius
/*@
KSPQCGSetTrustRegionRadius - Sets the radius of the trust region.
Logically Collective on KSP
Input Parameters:
+ ksp - the iterative context
- delta - the trust region radius (Infinity is the default)
Options Database Key:
. -ksp_qcg_trustregionradius <delta>
Level: advanced
.keywords: KSP, QCG, set, trust region radius
@*/
PetscErrorCode KSPQCGSetTrustRegionRadius(KSP ksp,PetscReal delta)
{
PetscErrorCode ierr;
PetscFunctionBegin;
PetscValidHeaderSpecific(ksp,KSP_CLASSID,1);
if (delta < 0.0) SETERRQ(PetscObjectComm((PetscObject)ksp),PETSC_ERR_ARG_OUTOFRANGE,"Tolerance must be non-negative");
ierr = PetscTryMethod(ksp,"KSPQCGSetTrustRegionRadius_C",(KSP,PetscReal),(ksp,delta));CHKERRQ(ierr);
PetscFunctionReturn(0);
}
示例11: KSPChebyshevEstEigSet
/*@
KSPChebyshevEstEigSetRandom - set random context for estimating eigenvalues
Logically Collective
Input Arguments:
+ ksp - linear solver context
- random - random number context or NULL to use default
Level: intermediate
.seealso: KSPChebyshevEstEigSet(), PetscRandomCreate()
@*/
PetscErrorCode KSPChebyshevEstEigSetRandom(KSP ksp,PetscRandom random)
{
PetscErrorCode ierr;
PetscFunctionBegin;
PetscValidHeaderSpecific(ksp,KSP_CLASSID,1);
if (random) PetscValidHeaderSpecific(random,PETSC_RANDOM_CLASSID,2);
ierr = PetscTryMethod(ksp,"KSPChebyshevEstEigSetRandom_C",(KSP,PetscRandom),(ksp,random));CHKERRQ(ierr);
PetscFunctionReturn(0);
}
示例12: SNESMultiblockGetSubSNES
/*@
SNESMultiblockSetBlockSize - Sets the block size for structured mesh block division. If not set the matrix block size is used.
Logically Collective on SNES
Input Parameters:
+ snes - the solver context
- bs - the block size
Level: intermediate
.seealso: SNESMultiblockGetSubSNES(), SNESMULTIBLOCK, SNESMultiblockSetFields()
@*/
PetscErrorCode SNESMultiblockSetBlockSize(SNES snes, PetscInt bs)
{
PetscErrorCode ierr;
PetscFunctionBegin;
PetscValidHeaderSpecific(snes, SNES_CLASSID, 1);
PetscValidLogicalCollectiveInt(snes, bs, 2);
ierr = PetscTryMethod(snes, "SNESMultiblockSetBlockSize_C", (SNES, PetscInt), (snes,bs));CHKERRQ(ierr);
PetscFunctionReturn(0);
}
示例13: PCFactorSetZeroPivot
/*@
PCFactorSetShiftType - adds a particular type of quantity to the diagonal of the matrix during
numerical factorization, thus the matrix has nonzero pivots
Logically Collective on PC
Input Parameters:
+ pc - the preconditioner context
- shifttype - type of shift; one of MAT_SHIFT_NONE, MAT_SHIFT_NONZERO, MAT_SHIFT_POSITIVE_DEFINITE, MAT_SHIFT_INBLOCKS
Options Database Key:
. -pc_factor_shift_type <shifttype> - Sets shift type or PETSC_DECIDE for the default; use '-help' for a list of available types
Level: intermediate
.keywords: PC, set, factorization,
.seealso: PCFactorSetZeroPivot(), PCFactorSetShiftAmount()
@*/
PetscErrorCode PCFactorSetShiftType(PC pc,MatFactorShiftType shifttype)
{
PetscErrorCode ierr;
PetscFunctionBegin;
PetscValidHeaderSpecific(pc,PC_CLASSID,1);
PetscValidLogicalCollectiveEnum(pc,shifttype,2);
ierr = PetscTryMethod(pc,"PCFactorSetShiftType_C",(PC,MatFactorShiftType),(pc,shifttype));CHKERRQ(ierr);
PetscFunctionReturn(0);
}
示例14: MatPartitioningPartySetBipart
/*@
MatPartitioningPartySetBipart - Activate or deactivate recursive bisection.
Collective on MatPartitioning
Input Parameters:
+ part - the partitioning context
- bp - boolean flag
Options Database:
- -mat_partitioning_party_bipart - Bipartitioning option on/off
Level: advanced
@*/
PetscErrorCode MatPartitioningPartySetBipart(MatPartitioning part,PetscBool bp)
{
PetscErrorCode ierr;
PetscFunctionBegin;
PetscValidHeaderSpecific(part,MAT_PARTITIONING_CLASSID,1);
PetscValidLogicalCollectiveBool(part,bp,2);
ierr = PetscTryMethod(part,"MatPartitioningPartySetBipart_C",(MatPartitioning,PetscBool),(part,bp));CHKERRQ(ierr);
PetscFunctionReturn(0);
}
示例15: PCCompositeSpecialSetAlpha
/*@
PCCompositeSpecialSetAlpha - Sets alpha for the special composite preconditioner
for alphaI + R + S
Logically Collective on PC
Input Parameter:
+ pc - the preconditioner context
- alpha - scale on identity
Level: Developer
.keywords: PC, set, type, composite preconditioner, additive, multiplicative
@*/
PetscErrorCode PCCompositeSpecialSetAlpha(PC pc,PetscScalar alpha)
{
PetscErrorCode ierr;
PetscFunctionBegin;
PetscValidHeaderSpecific(pc,PC_CLASSID,1);
PetscValidLogicalCollectiveScalar(pc,alpha,2);
ierr = PetscTryMethod(pc,"PCCompositeSpecialSetAlpha_C",(PC,PetscScalar),(pc,alpha));CHKERRQ(ierr);
PetscFunctionReturn(0);
}