本文整理汇总了C++中PetscViewerASCIIPushTab函数的典型用法代码示例。如果您正苦于以下问题:C++ PetscViewerASCIIPushTab函数的具体用法?C++ PetscViewerASCIIPushTab怎么用?C++ PetscViewerASCIIPushTab使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PetscViewerASCIIPushTab函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:plguhur,项目名称:petsc,代码行数:32,代码来源:vecnest.c
示例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);
}
开发者ID:erdc-cm,项目名称:petsc-dev,代码行数:25,代码来源:pack.c
示例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);
}
开发者ID:ZJLi2013,项目名称:petsc,代码行数:60,代码来源:nasm.c
示例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);
}
开发者ID:feelpp,项目名称:debian-petsc,代码行数:60,代码来源:factimpl.c
示例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);
}
开发者ID:OpenCMISS-Dependencies,项目名称:petsc,代码行数:26,代码来源:cheby.c
示例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);
}
开发者ID:erdc-cm,项目名称:petsc-dev,代码行数:29,代码来源:schurm.c
示例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);
}
开发者ID:00liujj,项目名称:petsc,代码行数:57,代码来源:taolinesearch.c
示例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);
}
开发者ID:hsahasra,项目名称:petsc-magma-dense-mat,代码行数:54,代码来源:factimpl.c
示例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);
}
开发者ID:ziolai,项目名称:petsc,代码行数:31,代码来源:tsadapt.c
示例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);
}
开发者ID:00liujj,项目名称:petsc,代码行数:27,代码来源:composite.c
示例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);
}
开发者ID:prbrune,项目名称:petsc,代码行数:53,代码来源:partition.c
示例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);
}
开发者ID:erdc-cm,项目名称:petsc-dev,代码行数:57,代码来源:partition.c
示例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);
}
开发者ID:AngelValverdePerez,项目名称:underworld2,代码行数:35,代码来源:operator_summary.c
示例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);
}
开发者ID:plguhur,项目名称:petsc,代码行数:52,代码来源:pf.c
示例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);
}
开发者ID:masa-ito,项目名称:PETScToPoisson,代码行数:27,代码来源:snescomposite.c
示例16: dUnitsView
dErr dUnitsView(dUnits un,dViewer viewer)
{
dBool iascii;
dErr err;
dFunctionBegin;
dValidHeader(un,dUNITS_CLASSID,1);
if (!viewer) {err = PetscViewerASCIIGetStdout(((dObject)un)->comm,&viewer);dCHK(err);}
dValidHeader(viewer,PETSC_VIEWER_CLASSID,2);
PetscCheckSameComm(un,1,viewer,2);
err = PetscTypeCompare((PetscObject)viewer,PETSCVIEWERASCII,&iascii);dCHK(err);
if (iascii) {
err = PetscObjectPrintClassNamePrefixType((PetscObject)un,viewer,"Units Manager");dCHK(err);
err = PetscViewerASCIIPushTab(viewer);dCHK(err);
for (dInt i=0; i<un->nalloc && un->list[i]; i++) {
dUnit u = un->list[i];
err = PetscViewerASCIIPrintf(viewer,"%-12s: 1 internal unit = %10.4e %s (%s) = %10.4e %s\n",
dUnitQuantityName(u),dUnitDimensionalize(u,1.0),dUnitName(u),dUnitShortName(u),dUnitDimensionalizeSI(u,1.0),dUnitSIName(u));dCHK(err);
err = PetscViewerASCIIPrintf(viewer,"%-12s 1 %s = %10.4e %s\n","",dUnitShortName(u),dUnitDimensionalizeSI(u,dUnitNonDimensionalize(u,1.0)),dUnitSIName(u));dCHK(err);
}
err = PetscViewerASCIIPopTab(viewer);dCHK(err);
} else dERROR(((dObject)un)->comm,PETSC_ERR_SUP,"Viewer type %s not supported",((PetscObject)viewer)->type_name);
dFunctionReturn(0);
}
开发者ID:xyuan,项目名称:dohp,代码行数:25,代码来源:dunits.c
示例17: private_PetscViewerCreate_XDMF
PetscErrorCode private_PetscViewerCreate_XDMF(MPI_Comm comm,const char filename[],PetscViewer *v)
{
long int *bytes;
PetscContainer container;
PetscViewer viewer;
PetscErrorCode ierr;
PetscFunctionBegin;
ierr = PetscViewerCreate(comm,&viewer);CHKERRQ(ierr);
ierr = PetscViewerSetType(viewer,PETSCVIEWERASCII);CHKERRQ(ierr);
ierr = PetscViewerFileSetMode(viewer,FILE_MODE_WRITE);CHKERRQ(ierr);
ierr = PetscViewerFileSetName(viewer,filename);CHKERRQ(ierr);
ierr = PetscMalloc1(1,&bytes);CHKERRQ(ierr);
bytes[0] = 0;
ierr = PetscContainerCreate(comm,&container);CHKERRQ(ierr);
ierr = PetscContainerSetPointer(container,(void*)bytes);CHKERRQ(ierr);
ierr = PetscObjectCompose((PetscObject)viewer,"XDMFViewerContext",(PetscObject)container);CHKERRQ(ierr);
/* write xdmf header */
ierr = PetscViewerASCIIPrintf(viewer,"<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");CHKERRQ(ierr);
ierr = PetscViewerASCIIPrintf(viewer,"<Xdmf xmlns:xi=\"http://www.w3.org/2001/XInclude\" Version=\"2.99\">\n");CHKERRQ(ierr);
/* write xdmf domain */
ierr = PetscViewerASCIIPushTab(viewer);CHKERRQ(ierr);
ierr = PetscViewerASCIIPrintf(viewer,"<Domain>\n");CHKERRQ(ierr);
*v = viewer;
PetscFunctionReturn(0);
}
开发者ID:firedrakeproject,项目名称:petsc,代码行数:28,代码来源:swarmpic_view.c
示例18: MatNullSpaceCreate
/*@C
MatNullSpaceView - Visualizes a null space object.
Collective on MatNullSpace
Input Parameters:
+ matnull - the null space
- viewer - visualization context
Level: advanced
Fortran Note:
This routine is not supported in Fortran.
.seealso: MatNullSpaceCreate(), PetscViewerASCIIOpen()
@*/
PetscErrorCode MatNullSpaceView(MatNullSpace sp,PetscViewer viewer)
{
PetscErrorCode ierr;
PetscBool iascii;
PetscFunctionBegin;
PetscValidHeaderSpecific(sp,MAT_NULLSPACE_CLASSID,1);
if (!viewer) {
ierr = PetscViewerASCIIGetStdout(PetscObjectComm((PetscObject)sp),&viewer);CHKERRQ(ierr);
}
PetscValidHeaderSpecific(viewer,PETSC_VIEWER_CLASSID,2);
PetscCheckSameComm(sp,1,viewer,2);
ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII,&iascii);CHKERRQ(ierr);
if (iascii) {
PetscViewerFormat format;
PetscInt i;
ierr = PetscViewerGetFormat(viewer,&format);CHKERRQ(ierr);
ierr = PetscObjectPrintClassNamePrefixType((PetscObject)sp,viewer);CHKERRQ(ierr);
ierr = PetscViewerASCIIPushTab(viewer);CHKERRQ(ierr);
ierr = PetscViewerASCIIPrintf(viewer,"Contains %D vector%s%s\n",sp->n,sp->n==1 ? "" : "s",sp->has_cnst ? " and the constant" : "");CHKERRQ(ierr);
if (sp->remove) {ierr = PetscViewerASCIIPrintf(viewer,"Has user-provided removal function\n");CHKERRQ(ierr);}
if (!(format == PETSC_VIEWER_ASCII_INFO || format == PETSC_VIEWER_ASCII_INFO_DETAIL)) {
for (i=0; i<sp->n; i++) {
ierr = VecView(sp->vecs[i],viewer);CHKERRQ(ierr);
}
}
ierr = PetscViewerASCIIPopTab(viewer);CHKERRQ(ierr);
}
PetscFunctionReturn(0);
}
开发者ID:firedrakeproject,项目名称:petsc,代码行数:47,代码来源:matnull.c
示例19: PCView_Redundant
static PetscErrorCode PCView_Redundant(PC pc,PetscViewer viewer)
{
PC_Redundant *red = (PC_Redundant*)pc->data;
PetscErrorCode ierr;
PetscBool iascii,isstring;
PetscViewer subviewer;
PetscFunctionBegin;
ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERASCII,&iascii);CHKERRQ(ierr);
ierr = PetscObjectTypeCompare((PetscObject)viewer,PETSCVIEWERSTRING,&isstring);CHKERRQ(ierr);
if (iascii) {
if (!red->psubcomm) {
ierr = PetscViewerASCIIPrintf(viewer," Redundant preconditioner: Not yet setup\n");CHKERRQ(ierr);
} else {
ierr = PetscViewerASCIIPrintf(viewer," Redundant preconditioner: First (color=0) of %D PCs follows\n",red->nsubcomm);CHKERRQ(ierr);
ierr = PetscViewerGetSubViewer(viewer,((PetscObject)red->pc)->comm,&subviewer);CHKERRQ(ierr);
if (!red->psubcomm->color) { /* only view first redundant pc */
ierr = PetscViewerASCIIPushTab(subviewer);CHKERRQ(ierr);
ierr = KSPView(red->ksp,subviewer);CHKERRQ(ierr);
ierr = PetscViewerASCIIPopTab(subviewer);CHKERRQ(ierr);
}
ierr = PetscViewerRestoreSubViewer(viewer,((PetscObject)red->pc)->comm,&subviewer);CHKERRQ(ierr);
}
} else if (isstring) {
ierr = PetscViewerStringSPrintf(viewer," Redundant solver preconditioner");CHKERRQ(ierr);
}
PetscFunctionReturn(0);
}
开发者ID:plguhur,项目名称:petsc,代码行数:28,代码来源:redundant.c
示例20: 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(((PetscObject)pf)->comm,&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,"PF Object");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);
}
} else {
SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_SUP,"Viewer type %s not supported by PF",((PetscObject)viewer)->type_name);
}
PetscFunctionReturn(0);
}
开发者ID:Kun-Qu,项目名称:petsc,代码行数:54,代码来源:pf.c
注:本文中的PetscViewerASCIIPushTab函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论