本文整理汇总了C++中PetscViewerASCIIPushTab函数的典型用法代码示例。如果您正苦于以下问题:C++ PetscViewerASCIIPushTab函数的具体用法?C++ PetscViewerASCIIPushTab怎么用?C++ PetscViewerASCIIPushTab使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PetscViewerASCIIPushTab函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: VecView_Nest
static PetscErrorCode VecView_Nest(Vec x,PetscViewer viewer)
{
Vec_Nest *bx = (Vec_Nest*)x->data;
PetscBool isascii;
PetscInt i;
PetscErrorCode ierr;
PetscFunctionBegin;
ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII,&isascii);CHKERRQ(ierr);
if (isascii) {
ierr = PetscViewerASCIIPushTab(viewer);CHKERRQ(ierr);
ierr = PetscViewerASCIIPrintf(viewer,"VecNest, rows=%D, structure: \n",bx->nb);CHKERRQ(ierr);
for (i=0; i<bx->nb; i++) {
VecType type;
char name[256] = "",prefix[256] = "";
PetscInt NR;
ierr = VecGetSize(bx->v[i],&NR);CHKERRQ(ierr);
ierr = VecGetType(bx->v[i],&type);CHKERRQ(ierr);
if (((PetscObject)bx->v[i])->name) {ierr = PetscSNPrintf(name,sizeof(name),"name=\"%s\", ",((PetscObject)bx->v[i])->name);CHKERRQ(ierr);}
if (((PetscObject)bx->v[i])->prefix) {ierr = PetscSNPrintf(prefix,sizeof(prefix),"prefix=\"%s\", ",((PetscObject)bx->v[i])->prefix);CHKERRQ(ierr);}
ierr = PetscViewerASCIIPrintf(viewer,"(%D) : %s%stype=%s, rows=%D \n",i,name,prefix,type,NR);CHKERRQ(ierr);
ierr = PetscViewerASCIIPushTab(viewer);CHKERRQ(ierr); /* push1 */
ierr = VecView(bx->v[i],viewer);CHKERRQ(ierr);
ierr = PetscViewerASCIIPopTab(viewer);CHKERRQ(ierr); /* pop1 */
}
ierr = PetscViewerASCIIPopTab(viewer);CHKERRQ(ierr); /* pop0 */
}
PetscFunctionReturn(0);
}
示例2: DMView_Composite
PetscErrorCode DMView_Composite(DM dm,PetscViewer v)
{
PetscErrorCode ierr;
PetscBool iascii;
DM_Composite *com = (DM_Composite *)dm->data;
PetscFunctionBegin;
ierr = PetscObjectTypeCompare((PetscObject)v,PETSCVIEWERASCII,&iascii);CHKERRQ(ierr);
if (iascii) {
struct DMCompositeLink *lnk = com->next;
PetscInt i;
ierr = PetscViewerASCIIPrintf(v,"DM (%s)\n",((PetscObject)dm)->prefix?((PetscObject)dm)->prefix:"no prefix");CHKERRQ(ierr);
ierr = PetscViewerASCIIPrintf(v," contains %D DMs\n",com->nDM);CHKERRQ(ierr);
ierr = PetscViewerASCIIPushTab(v);CHKERRQ(ierr);
for (i=0; lnk; lnk=lnk->next,i++) {
ierr = PetscViewerASCIIPrintf(v,"Link %D: DM of type %s\n",i,((PetscObject)lnk->dm)->type_name);CHKERRQ(ierr);
ierr = PetscViewerASCIIPushTab(v);CHKERRQ(ierr);
ierr = DMView(lnk->dm,v);CHKERRQ(ierr);
ierr = PetscViewerASCIIPopTab(v);CHKERRQ(ierr);
}
ierr = PetscViewerASCIIPopTab(v);CHKERRQ(ierr);
}
PetscFunctionReturn(0);
}
示例3: SNESView_NASM
PetscErrorCode SNESView_NASM(SNES snes, PetscViewer viewer)
{
SNES_NASM *nasm = (SNES_NASM*)snes->data;
PetscErrorCode ierr;
PetscMPIInt rank,size;
PetscInt i,N,bsz;
PetscBool iascii,isstring;
PetscViewer sviewer;
MPI_Comm comm;
PetscFunctionBegin;
ierr = PetscObjectGetComm((PetscObject)snes,&comm);CHKERRQ(ierr);
ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII,&iascii);CHKERRQ(ierr);
ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERSTRING,&isstring);CHKERRQ(ierr);
ierr = MPI_Comm_rank(comm,&rank);CHKERRQ(ierr);
ierr = MPI_Comm_size(comm,&size);CHKERRQ(ierr);
ierr = MPI_Allreduce(&nasm->n,&N,1,MPIU_INT,MPI_SUM,comm);CHKERRQ(ierr);
if (iascii) {
ierr = PetscViewerASCIIPrintf(viewer, " Nonlinear Additive Schwarz: total subdomain blocks = %D\n",N);CHKERRQ(ierr);
if (nasm->same_local_solves) {
if (nasm->subsnes) {
ierr = PetscViewerASCIIPrintf(viewer," Local solve is the same for all blocks:\n");CHKERRQ(ierr);
ierr = PetscViewerASCIIPushTab(viewer);CHKERRQ(ierr);
ierr = PetscViewerGetSingleton(viewer,&sviewer);CHKERRQ(ierr);
if (!rank) {
ierr = PetscViewerASCIIPushTab(viewer);CHKERRQ(ierr);
ierr = SNESView(nasm->subsnes[0],sviewer);CHKERRQ(ierr);
ierr = PetscViewerASCIIPopTab(viewer);CHKERRQ(ierr);
}
ierr = PetscViewerRestoreSingleton(viewer,&sviewer);CHKERRQ(ierr);
ierr = PetscViewerASCIIPopTab(viewer);CHKERRQ(ierr);
}
} else {
/* print the solver on each block */
ierr = PetscViewerASCIISynchronizedAllow(viewer,PETSC_TRUE);CHKERRQ(ierr);
ierr = PetscViewerASCIISynchronizedPrintf(viewer," [%d] number of local blocks = %D\n",(int)rank,nasm->n);CHKERRQ(ierr);
ierr = PetscViewerFlush(viewer);CHKERRQ(ierr);
ierr = PetscViewerASCIISynchronizedAllow(viewer,PETSC_FALSE);CHKERRQ(ierr);
ierr = PetscViewerASCIIPrintf(viewer," Local solve info for each block is in the following SNES objects:\n");CHKERRQ(ierr);
ierr = PetscViewerASCIIPushTab(viewer);CHKERRQ(ierr);
ierr = PetscViewerASCIIPrintf(viewer,"- - - - - - - - - - - - - - - - - -\n");CHKERRQ(ierr);
ierr = PetscViewerGetSingleton(viewer,&sviewer);CHKERRQ(ierr);
for (i=0; i<nasm->n; i++) {
ierr = VecGetLocalSize(nasm->x[i],&bsz);CHKERRQ(ierr);
ierr = PetscViewerASCIIPrintf(sviewer,"[%d] local block number %D, size = %D\n",(int)rank,i,bsz);CHKERRQ(ierr);
ierr = SNESView(nasm->subsnes[i],sviewer);CHKERRQ(ierr);
ierr = PetscViewerASCIIPrintf(sviewer,"- - - - - - - - - - - - - - - - - -\n");CHKERRQ(ierr);
}
ierr = PetscViewerRestoreSingleton(viewer,&sviewer);CHKERRQ(ierr);
ierr = PetscViewerFlush(viewer);CHKERRQ(ierr);
ierr = PetscViewerASCIIPopTab(viewer);CHKERRQ(ierr);
}
} else if (isstring) {
ierr = PetscViewerStringSPrintf(viewer," blocks=%D,type=%s",N,SNESNASMTypes[nasm->type]);CHKERRQ(ierr);
ierr = PetscViewerGetSingleton(viewer,&sviewer);CHKERRQ(ierr);
if (nasm->subsnes && !rank) {ierr = SNESView(nasm->subsnes[0],sviewer);CHKERRQ(ierr);}
ierr = PetscViewerRestoreSingleton(viewer,&sviewer);CHKERRQ(ierr);
}
PetscFunctionReturn(0);
}
示例4: PCView_Factor
PetscErrorCode PCView_Factor(PC pc,PetscViewer viewer)
{
PC_Factor *factor = (PC_Factor*)pc->data;
PetscErrorCode ierr;
PetscBool isstring,iascii;
PetscFunctionBegin;
ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERSTRING,&isstring);CHKERRQ(ierr);
ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII,&iascii);CHKERRQ(ierr);
if (iascii) {
if (factor->factortype == MAT_FACTOR_ILU || factor->factortype == MAT_FACTOR_ICC) {
if (factor->info.dt > 0) {
ierr = PetscViewerASCIIPrintf(viewer," drop tolerance %G\n",factor->info.dt);CHKERRQ(ierr);
ierr = PetscViewerASCIIPrintf(viewer," max nonzeros per row %D\n",factor->info.dtcount);CHKERRQ(ierr);
ierr = PetscViewerASCIIPrintf(viewer," column permutation tolerance %G\n",(PetscInt)factor->info.dtcol);CHKERRQ(ierr);
} else if (factor->info.levels == 1) {
ierr = PetscViewerASCIIPrintf(viewer," %D level of fill\n",(PetscInt)factor->info.levels);CHKERRQ(ierr);
} else {
ierr = PetscViewerASCIIPrintf(viewer," %D levels of fill\n",(PetscInt)factor->info.levels);CHKERRQ(ierr);
}
}
ierr = PetscViewerASCIIPrintf(viewer," tolerance for zero pivot %G\n",factor->info.zeropivot);CHKERRQ(ierr);
if (factor->info.shifttype==(PetscReal)MAT_SHIFT_POSITIVE_DEFINITE) {
ierr = PetscViewerASCIIPrintf(viewer," using Manteuffel shift\n");CHKERRQ(ierr);
}
if (factor->info.shifttype==(PetscReal)MAT_SHIFT_NONZERO) {
ierr = PetscViewerASCIIPrintf(viewer," using diagonal shift to prevent zero pivot\n");CHKERRQ(ierr);
}
if (factor->info.shifttype==(PetscReal)MAT_SHIFT_INBLOCKS) {
ierr = PetscViewerASCIIPrintf(viewer," using diagonal shift on blocks to prevent zero pivot\n");CHKERRQ(ierr);
}
ierr = PetscViewerASCIIPrintf(viewer," matrix ordering: %s\n",factor->ordering);CHKERRQ(ierr);
if (factor->fact) {
MatInfo info;
ierr = MatGetInfo(factor->fact,MAT_LOCAL,&info);CHKERRQ(ierr);
ierr = PetscViewerASCIIPrintf(viewer," factor fill ratio given %G, needed %G\n",info.fill_ratio_given,info.fill_ratio_needed);CHKERRQ(ierr);
ierr = PetscViewerASCIIPrintf(viewer," Factored matrix follows:\n");CHKERRQ(ierr);
ierr = PetscViewerASCIIPushTab(viewer);CHKERRQ(ierr);
ierr = PetscViewerASCIIPushTab(viewer);CHKERRQ(ierr);
ierr = PetscViewerASCIIPushTab(viewer);CHKERRQ(ierr);
ierr = PetscViewerPushFormat(viewer,PETSC_VIEWER_ASCII_INFO);CHKERRQ(ierr);
ierr = MatView(factor->fact,viewer);CHKERRQ(ierr);
ierr = PetscViewerPopFormat(viewer);CHKERRQ(ierr);
ierr = PetscViewerASCIIPopTab(viewer);CHKERRQ(ierr);
ierr = PetscViewerASCIIPopTab(viewer);CHKERRQ(ierr);
ierr = PetscViewerASCIIPopTab(viewer);CHKERRQ(ierr);
}
} else if (isstring) {
MatFactorType t;
ierr = MatGetFactorType(factor->fact,&t);CHKERRQ(ierr);
if (t == MAT_FACTOR_ILU || t == MAT_FACTOR_ICC) {
ierr = PetscViewerStringSPrintf(viewer," lvls=%D,order=%s",(PetscInt)factor->info.levels,factor->ordering);CHKERRQ(ierr);CHKERRQ(ierr);
}
}
PetscFunctionReturn(0);
}
示例5: KSPView_Chebyshev
PetscErrorCode KSPView_Chebyshev(KSP ksp,PetscViewer viewer)
{
KSP_Chebyshev *cheb = (KSP_Chebyshev*)ksp->data;
PetscErrorCode ierr;
PetscBool iascii;
PetscFunctionBegin;
ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII,&iascii);CHKERRQ(ierr);
if (iascii) {
ierr = PetscViewerASCIIPrintf(viewer," Chebyshev: eigenvalue estimates: min = %g, max = %g\n",(double)cheb->emin,(double)cheb->emax);CHKERRQ(ierr);
if (cheb->kspest) {
ierr = PetscViewerASCIIPrintf(viewer," Chebyshev: estimated using: [%g %g; %g %g]\n",(double)cheb->tform[0],(double)cheb->tform[1],(double)cheb->tform[2],(double)cheb->tform[3]);CHKERRQ(ierr);
if (cheb->random) {
ierr = PetscViewerASCIIPrintf(viewer," Chebyshev: estimating eigenvalues using random right hand side\n");CHKERRQ(ierr);
ierr = PetscViewerASCIIPushTab(viewer);CHKERRQ(ierr);
ierr = PetscRandomView(cheb->random,viewer);CHKERRQ(ierr);
ierr = PetscViewerASCIIPopTab(viewer);CHKERRQ(ierr);
}
ierr = PetscViewerASCIIPushTab(viewer);CHKERRQ(ierr);
ierr = KSPView(cheb->kspest,viewer);CHKERRQ(ierr);
ierr = PetscViewerASCIIPopTab(viewer);CHKERRQ(ierr);
}
}
PetscFunctionReturn(0);
}
示例6: MatView_SchurComplement
PetscErrorCode MatView_SchurComplement(Mat N,PetscViewer viewer)
{
Mat_SchurComplement *Na = (Mat_SchurComplement*)N->data;
PetscErrorCode ierr;
PetscFunctionBegin;
ierr = PetscViewerASCIIPrintf(viewer,"Schur complement A11 - A10 inv(A00) A01\n");CHKERRQ(ierr);
if (Na->D) {
ierr = PetscViewerASCIIPrintf(viewer,"A11\n");CHKERRQ(ierr);
ierr = PetscViewerASCIIPushTab(viewer);CHKERRQ(ierr);
ierr = MatView(Na->D,viewer);CHKERRQ(ierr);
ierr = PetscViewerASCIIPopTab(viewer);CHKERRQ(ierr);
} else {
ierr = PetscViewerASCIIPrintf(viewer,"A11 = 0\n");CHKERRQ(ierr);
}
ierr = PetscViewerASCIIPrintf(viewer,"A10\n");CHKERRQ(ierr);
ierr = PetscViewerASCIIPushTab(viewer);CHKERRQ(ierr);
ierr = MatView(Na->C,viewer);CHKERRQ(ierr);
ierr = PetscViewerASCIIPopTab(viewer);CHKERRQ(ierr);
ierr = PetscViewerASCIIPrintf(viewer,"KSP of A00\n");CHKERRQ(ierr);
ierr = PetscViewerASCIIPushTab(viewer);CHKERRQ(ierr);
ierr = KSPView(Na->ksp,viewer);CHKERRQ(ierr);
ierr = PetscViewerASCIIPopTab(viewer);CHKERRQ(ierr);
ierr = PetscViewerASCIIPrintf(viewer,"A01\n");CHKERRQ(ierr);
ierr = PetscViewerASCIIPushTab(viewer);CHKERRQ(ierr);
ierr = MatView(Na->B,viewer);CHKERRQ(ierr);
ierr = PetscViewerASCIIPopTab(viewer);CHKERRQ(ierr);
PetscFunctionReturn(0);
}
示例7: TaoLineSearchView
PetscErrorCode TaoLineSearchView(TaoLineSearch ls, PetscViewer viewer)
{
PetscErrorCode ierr;
PetscBool isascii, isstring;
const TaoLineSearchType type;
PetscBool destroyviewer = PETSC_FALSE;
PetscFunctionBegin;
PetscValidHeaderSpecific(ls,TAOLINESEARCH_CLASSID,1);
if (!viewer) {
destroyviewer = PETSC_TRUE;
ierr = PetscViewerASCIIGetStdout(((PetscObject)ls)->comm, &viewer);CHKERRQ(ierr);
}
PetscValidHeaderSpecific(viewer,PETSC_VIEWER_CLASSID,2);
PetscCheckSameComm(ls,1,viewer,2);
ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII,&isascii);CHKERRQ(ierr);
ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERSTRING,&isstring);CHKERRQ(ierr);
if (isascii) {
if (((PetscObject)ls)->prefix) {
ierr = PetscViewerASCIIPrintf(viewer,"TaoLineSearch Object:(%s)\n",((PetscObject)ls)->prefix);CHKERRQ(ierr);
} else {
ierr = PetscViewerASCIIPrintf(viewer,"TaoLineSearch Object:\n");CHKERRQ(ierr);
}
ierr = PetscViewerASCIIPushTab(viewer);CHKERRQ(ierr);
ierr = TaoLineSearchGetType(ls,&type);CHKERRQ(ierr);
if (type) {
ierr = PetscViewerASCIIPrintf(viewer,"type: %s\n",type);CHKERRQ(ierr);
} else {
ierr = PetscViewerASCIIPrintf(viewer,"type: not set yet\n");CHKERRQ(ierr);
}
if (ls->ops->view) {
ierr = PetscViewerASCIIPushTab(viewer);CHKERRQ(ierr);
ierr = (*ls->ops->view)(ls,viewer);CHKERRQ(ierr);
ierr = PetscViewerASCIIPopTab(viewer);CHKERRQ(ierr);
}
ierr = PetscViewerASCIIPrintf(viewer,"maximum function evaluations=%D\n",ls->max_funcs);CHKERRQ(ierr);
ierr = PetscViewerASCIIPrintf(viewer,"tolerances: ftol=%g, rtol=%g, gtol=%g\n",(double)ls->ftol,(double)ls->rtol,(double)ls->gtol);CHKERRQ(ierr);
ierr = PetscViewerASCIIPrintf(viewer,"total number of function evaluations=%D\n",ls->nfeval);CHKERRQ(ierr);
ierr = PetscViewerASCIIPrintf(viewer,"total number of gradient evaluations=%D\n",ls->ngeval);CHKERRQ(ierr);
ierr = PetscViewerASCIIPrintf(viewer,"total number of function/gradient evaluations=%D\n",ls->nfgeval);CHKERRQ(ierr);
if (ls->bounded) {
ierr = PetscViewerASCIIPrintf(viewer,"using variable bounds\n");CHKERRQ(ierr);
}
ierr = PetscViewerASCIIPrintf(viewer,"Termination reason: %D\n",(int)ls->reason);CHKERRQ(ierr);
ierr = PetscViewerASCIIPopTab(viewer);CHKERRQ(ierr);
} else if (isstring) {
ierr = TaoLineSearchGetType(ls,&type);CHKERRQ(ierr);
ierr = PetscViewerStringSPrintf(viewer," %-3.3s",type);CHKERRQ(ierr);
}
if (destroyviewer) {
ierr = PetscViewerDestroy(&viewer);CHKERRQ(ierr);
}
PetscFunctionReturn(0);
}
示例8: PCView_Factor
PetscErrorCode PCView_Factor(PC pc,PetscViewer viewer)
{
PC_Factor *factor = (PC_Factor*)pc->data;
PetscErrorCode ierr;
PetscBool isstring,iascii;
PetscFunctionBegin;
ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERSTRING,&isstring);CHKERRQ(ierr);
ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII,&iascii);CHKERRQ(ierr);
if (iascii) {
if (factor->factortype == MAT_FACTOR_ILU || factor->factortype == MAT_FACTOR_ICC) {
if (factor->info.dt > 0) {
ierr = PetscViewerASCIIPrintf(viewer," drop tolerance %G\n",factor->info.dt);CHKERRQ(ierr);
ierr = PetscViewerASCIIPrintf(viewer," max nonzeros per row %D\n",factor->info.dtcount);CHKERRQ(ierr);
ierr = PetscViewerASCIIPrintf(viewer," column permutation tolerance %G\n",(PetscInt)factor->info.dtcol);CHKERRQ(ierr);
} else if (factor->info.levels == 1) {
ierr = PetscViewerASCIIPrintf(viewer," %D level of fill\n",(PetscInt)factor->info.levels);CHKERRQ(ierr);
} else {
ierr = PetscViewerASCIIPrintf(viewer," %D levels of fill\n",(PetscInt)factor->info.levels);CHKERRQ(ierr);
}
}
ierr = PetscViewerASCIIPrintf(viewer," tolerance for zero pivot %G\n",factor->info.zeropivot);CHKERRQ(ierr);
if (MatFactorShiftTypesDetail[(int)factor->info.shifttype]) { /* Only print when using a nontrivial shift */
ierr = PetscViewerASCIIPrintf(viewer," using %s [%s]\n",MatFactorShiftTypesDetail[(int)factor->info.shifttype],MatFactorShiftTypes[(int)factor->info.shifttype]);CHKERRQ(ierr);
}
ierr = PetscViewerASCIIPrintf(viewer," matrix ordering: %s\n",factor->ordering);CHKERRQ(ierr);
if (factor->fact) {
MatInfo info;
ierr = MatGetInfo(factor->fact,MAT_LOCAL,&info);CHKERRQ(ierr);
ierr = PetscViewerASCIIPrintf(viewer," factor fill ratio given %G, needed %G\n",info.fill_ratio_given,info.fill_ratio_needed);CHKERRQ(ierr);
ierr = PetscViewerASCIIPrintf(viewer," Factored matrix follows:\n");CHKERRQ(ierr);
ierr = PetscViewerASCIIPushTab(viewer);CHKERRQ(ierr);
ierr = PetscViewerASCIIPushTab(viewer);CHKERRQ(ierr);
ierr = PetscViewerASCIIPushTab(viewer);CHKERRQ(ierr);
ierr = PetscViewerPushFormat(viewer,PETSC_VIEWER_ASCII_INFO);CHKERRQ(ierr);
ierr = MatView(factor->fact,viewer);CHKERRQ(ierr);
ierr = PetscViewerPopFormat(viewer);CHKERRQ(ierr);
ierr = PetscViewerASCIIPopTab(viewer);CHKERRQ(ierr);
ierr = PetscViewerASCIIPopTab(viewer);CHKERRQ(ierr);
ierr = PetscViewerASCIIPopTab(viewer);CHKERRQ(ierr);
}
} else if (isstring) {
MatFactorType t;
ierr = MatGetFactorType(factor->fact,&t);CHKERRQ(ierr);
if (t == MAT_FACTOR_ILU || t == MAT_FACTOR_ICC) {
ierr = PetscViewerStringSPrintf(viewer," lvls=%D,order=%s",(PetscInt)factor->info.levels,factor->ordering);CHKERRQ(ierr);CHKERRQ(ierr);
}
}
PetscFunctionReturn(0);
}
示例9: TSAdaptView
PetscErrorCode TSAdaptView(TSAdapt adapt,PetscViewer viewer)
{
PetscErrorCode ierr;
PetscBool iascii,isbinary;
PetscFunctionBegin;
PetscValidHeaderSpecific(adapt,TSADAPT_CLASSID,1);
if (!viewer) {ierr = PetscViewerASCIIGetStdout(PetscObjectComm((PetscObject)adapt),&viewer);CHKERRQ(ierr);}
PetscValidHeaderSpecific(viewer,PETSC_VIEWER_CLASSID,2);
PetscCheckSameComm(adapt,1,viewer,2);
ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII,&iascii);CHKERRQ(ierr);
ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERBINARY,&isbinary);CHKERRQ(ierr);
if (iascii) {
ierr = PetscObjectPrintClassNamePrefixType((PetscObject)adapt,viewer);CHKERRQ(ierr);
ierr = PetscViewerASCIIPrintf(viewer," number of candidates %D\n",adapt->candidates.n);CHKERRQ(ierr);
if (adapt->ops->view) {
ierr = PetscViewerASCIIPushTab(viewer);CHKERRQ(ierr);
ierr = (*adapt->ops->view)(adapt,viewer);CHKERRQ(ierr);
ierr = PetscViewerASCIIPopTab(viewer);CHKERRQ(ierr);
}
} else if (isbinary) {
char type[256];
/* need to save FILE_CLASS_ID for adapt class */
ierr = PetscStrncpy(type,((PetscObject)adapt)->type_name,256);CHKERRQ(ierr);
ierr = PetscViewerBinaryWrite(viewer,type,256,PETSC_CHAR,PETSC_FALSE);CHKERRQ(ierr);
} else if (adapt->ops->view) {
ierr = (*adapt->ops->view)(adapt,viewer);CHKERRQ(ierr);
}
PetscFunctionReturn(0);
}
示例10: PCView_Composite
static PetscErrorCode PCView_Composite(PC pc,PetscViewer viewer)
{
PC_Composite *jac = (PC_Composite*)pc->data;
PetscErrorCode ierr;
PC_CompositeLink next = jac->head;
PetscBool iascii;
PetscFunctionBegin;
ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII,&iascii);CHKERRQ(ierr);
if (iascii) {
ierr = PetscViewerASCIIPrintf(viewer,"Composite PC type - %s\n",PCCompositeTypes[jac->type]);CHKERRQ(ierr);
ierr = PetscViewerASCIIPrintf(viewer,"PCs on composite preconditioner follow\n");CHKERRQ(ierr);
ierr = PetscViewerASCIIPrintf(viewer,"---------------------------------\n");CHKERRQ(ierr);
}
if (iascii) {
ierr = PetscViewerASCIIPushTab(viewer);CHKERRQ(ierr);
}
while (next) {
ierr = PCView(next->pc,viewer);CHKERRQ(ierr);
next = next->next;
}
if (iascii) {
ierr = PetscViewerASCIIPopTab(viewer);CHKERRQ(ierr);
ierr = PetscViewerASCIIPrintf(viewer,"---------------------------------\n");CHKERRQ(ierr);
}
PetscFunctionReturn(0);
}
示例11: output
/*@C
MatPartitioningView - Prints the partitioning data structure.
Collective on MatPartitioning
Input Parameters:
. part - the partitioning context
. viewer - optional visualization context
Level: intermediate
Note:
The available visualization contexts include
+ PETSC_VIEWER_STDOUT_SELF - standard output (default)
- PETSC_VIEWER_STDOUT_WORLD - synchronized standard
output where only the first processor opens
the file. All other processors send their
data to the first processor to print.
The user can open alternative visualization contexts with
. PetscViewerASCIIOpen() - output to a specified file
.keywords: Partitioning, view
.seealso: PetscViewerASCIIOpen()
@*/
PetscErrorCode MatPartitioningView(MatPartitioning part,PetscViewer viewer)
{
PetscErrorCode ierr;
PetscBool iascii;
PetscFunctionBegin;
PetscValidHeaderSpecific(part,MAT_PARTITIONING_CLASSID,1);
if (!viewer) {
ierr = PetscViewerASCIIGetStdout(PetscObjectComm((PetscObject)part),&viewer);CHKERRQ(ierr);
}
PetscValidHeaderSpecific(viewer,PETSC_VIEWER_CLASSID,2);
PetscCheckSameComm(part,1,viewer,2);
ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII,&iascii);CHKERRQ(ierr);
if (iascii) {
ierr = PetscObjectPrintClassNamePrefixType((PetscObject)part,viewer);CHKERRQ(ierr);
if (part->vertex_weights) {
ierr = PetscViewerASCIIPrintf(viewer," Using vertex weights\n");CHKERRQ(ierr);
}
}
if (part->ops->view) {
ierr = PetscViewerASCIIPushTab(viewer);CHKERRQ(ierr);
ierr = (*part->ops->view)(part,viewer);CHKERRQ(ierr);
ierr = PetscViewerASCIIPopTab(viewer);CHKERRQ(ierr);
}
PetscFunctionReturn(0);
}
示例12: output
/*@C
MatPartitioningView - Prints the partitioning data structure.
Collective on MatPartitioning
Input Parameters:
. part - the partitioning context
. viewer - optional visualization context
Level: intermediate
Note:
The available visualization contexts include
+ PETSC_VIEWER_STDOUT_SELF - standard output (default)
- PETSC_VIEWER_STDOUT_WORLD - synchronized standard
output where only the first processor opens
the file. All other processors send their
data to the first processor to print.
The user can open alternative visualization contexts with
. PetscViewerASCIIOpen() - output to a specified file
.keywords: Partitioning, view
.seealso: PetscViewerASCIIOpen()
@*/
PetscErrorCode MatPartitioningView(MatPartitioning part,PetscViewer viewer)
{
PetscErrorCode ierr;
PetscBool iascii;
PetscFunctionBegin;
PetscValidHeaderSpecific(part,MAT_PARTITIONING_CLASSID,1);
if (!viewer) {
ierr = PetscViewerASCIIGetStdout(((PetscObject)part)->comm,&viewer);CHKERRQ(ierr);
}
PetscValidHeaderSpecific(viewer,PETSC_VIEWER_CLASSID,2);
PetscCheckSameComm(part,1,viewer,2);
ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII,&iascii);CHKERRQ(ierr);
if (iascii) {
ierr = PetscObjectPrintClassNamePrefixType((PetscObject)part,viewer,"MatPartitioning Object");CHKERRQ(ierr);
if (part->vertex_weights) {
ierr = PetscViewerASCIIPrintf(viewer," Using vertex weights\n");CHKERRQ(ierr);
}
} else {
SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_SUP,"Viewer type %s not supported for this MatParitioning",((PetscObject)viewer)->type_name);
}
if (part->ops->view) {
ierr = PetscViewerASCIIPushTab(viewer);CHKERRQ(ierr);
ierr = (*part->ops->view)(part,viewer);CHKERRQ(ierr);
ierr = PetscViewerASCIIPopTab(viewer);CHKERRQ(ierr);
}
PetscFunctionReturn(0);
}
示例13: BSSCR_VecInfoLog
/*
name[] is operator name
*/
PetscErrorCode BSSCR_VecInfoLog(PetscViewer v,Vec x,const char name[])
{
PetscReal nrm_1,nrm_f,nrm_inf;
VecType vectype;
PetscInt M;
PetscViewerType vtype;
PetscTruth isascii;
PetscViewerGetType( v, &vtype );
Stg_PetscObjectTypeCompare( (PetscObject)v,PETSC_VIEWER_ASCII,&isascii );
if (!isascii) { PetscFunctionReturn(0); }
VecGetSize( x, &M);
VecGetType( x, &vectype );
VecNorm( x, NORM_1, &nrm_1 );
VecNorm( x, NORM_2, &nrm_f );
VecNorm( x, NORM_INFINITY, &nrm_inf );
PetscViewerASCIIPrintf( v, "VecInfo: %s \n", name );
PetscViewerASCIIPushTab(v);
PetscViewerASCIIPrintf( v, "type=%s \n", vectype );
PetscViewerASCIIPrintf( v, "dimension=%Dx1 \n", M);
PetscViewerASCIIPrintf( v, "|x|_1 = %1.12e\n", nrm_1 );
PetscViewerASCIIPrintf( v, "|x|_2 = %1.12e\n", nrm_f );
PetscViewerASCIIPrintf( v, "|x|_inf = %1.12e\n", nrm_inf );
PetscViewerASCIIPopTab(v);
PetscFunctionReturn(0);
}
示例14: output
/*@
PFView - Prints information about a mathematical function
Collective on PF unless PetscViewer is PETSC_VIEWER_STDOUT_SELF
Input Parameters:
+ PF - the PF context
- viewer - optional visualization context
Note:
The available visualization contexts include
+ PETSC_VIEWER_STDOUT_SELF - standard output (default)
- PETSC_VIEWER_STDOUT_WORLD - synchronized standard
output where only the first processor opens
the file. All other processors send their
data to the first processor to print.
The user can open an alternative visualization contexts with
PetscViewerASCIIOpen() (output to a specified file).
Level: developer
.keywords: PF, view
.seealso: PetscViewerCreate(), PetscViewerASCIIOpen()
@*/
PetscErrorCode PFView(PF pf,PetscViewer viewer)
{
PetscErrorCode ierr;
PetscBool iascii;
PetscViewerFormat format;
PetscFunctionBegin;
PetscValidHeaderSpecific(pf,PF_CLASSID,1);
if (!viewer) {
ierr = PetscViewerASCIIGetStdout(PetscObjectComm((PetscObject)pf),&viewer);CHKERRQ(ierr);
}
PetscValidHeaderSpecific(viewer,PETSC_VIEWER_CLASSID,2);
PetscCheckSameComm(pf,1,viewer,2);
ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII,&iascii);CHKERRQ(ierr);
if (iascii) {
ierr = PetscViewerGetFormat(viewer,&format);CHKERRQ(ierr);
ierr = PetscObjectPrintClassNamePrefixType((PetscObject)pf,viewer);CHKERRQ(ierr);
if (pf->ops->view) {
ierr = PetscViewerASCIIPushTab(viewer);CHKERRQ(ierr);
ierr = (*pf->ops->view)(pf->data,viewer);CHKERRQ(ierr);
ierr = PetscViewerASCIIPopTab(viewer);CHKERRQ(ierr);
}
}
PetscFunctionReturn(0);
}
示例15: SNESView_Composite
static PetscErrorCode SNESView_Composite(SNES snes,PetscViewer viewer)
{
SNES_Composite *jac = (SNES_Composite*)snes->data;
PetscErrorCode ierr;
SNES_CompositeLink next = jac->head;
PetscBool iascii;
PetscFunctionBegin;
ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII,&iascii);CHKERRQ(ierr);
if (iascii) {
ierr = PetscViewerASCIIPrintf(viewer,"Composite SNES type - %s\n",SNESCompositeTypes[jac->type]);CHKERRQ(ierr);
ierr = PetscViewerASCIIPrintf(viewer,"SNESes on composite preconditioner follow\n");CHKERRQ(ierr);
ierr = PetscViewerASCIIPrintf(viewer,"---------------------------------\n");CHKERRQ(ierr);
}
if (iascii) {
ierr = PetscViewerASCIIPushTab(viewer);CHKERRQ(ierr);
}
while (next) {
ierr = SNESView(next->snes,viewer);CHKERRQ(ierr);
next = next->next;
}
if (iascii) {
ierr = PetscViewerASCIIPopTab(viewer);CHKERRQ(ierr);
ierr = PetscViewerASCIIPrintf(viewer,"---------------------------------\n");CHKERRQ(ierr);
}
PetscFunctionReturn(0);
}