Subversion Repositories slepc-dev

Compare Revisions

Ignore whitespace Rev 2667 → Rev 2670

/branches/slepc-3_2-branch/src/qep/interface/ftn-custom/zqepf.c
169,8 → 169,9
*ierr = QEPCreate(MPI_Comm_f2c(*(comm)),qep);
}
 
void PETSC_STDCALL qepmonitorset_(QEP *qep,void (PETSC_STDCALL *monitor)(QEP*,PetscInt*,PetscInt*,PetscScalar*,PetscScalar*,PetscReal*,PetscInt*,void*,PetscErrorCode*),void *mctx,void (PETSC_STDCALL *monitordestroy)(void **,PetscErrorCode *),PetscErrorCode *ierr)
void PETSC_STDCALL qepmonitorset_(QEP *qep,void (PETSC_STDCALL *monitor)(QEP*,PetscInt*,PetscInt*,PetscScalar*,PetscScalar*,PetscReal*,PetscInt*,void*,PetscErrorCode*),void *mctx,void (PETSC_STDCALL *monitordestroy)(void *,PetscErrorCode *),PetscErrorCode *ierr)
{
SlepcConvMonitor ctx;
CHKFORTRANNULLFUNCTION(monitordestroy);
PetscObjectAllocateFortranPointers(*qep,3);
if ((PetscVoidFunction)monitor == (PetscVoidFunction)qepmonitorall_) {
180,13 → 181,17
} else if ((PetscVoidFunction)monitor == (PetscVoidFunction)qepmonitorlgall_) {
*ierr = QEPMonitorSet(*qep,QEPMonitorLGAll,0,0);
} else if ((PetscVoidFunction)monitor == (PetscVoidFunction)qepmonitorconverged_) {
*ierr = QEPMonitorSet(*qep,QEPMonitorConverged,0,0);
if (!FORTRANNULLOBJECT(mctx)) { PetscError(((PetscObject)*qep)->comm,__LINE__,"qepmonitorset_",__FILE__,__SDIR__,PETSC_ERR_ARG_WRONG,PETSC_ERROR_INITIAL,"Must provide PETSC_NULL_OBJECT as a context in the Fortran interface to QEPMonitorSet"); *ierr = 1; return; }
*ierr = PetscNew(struct _n_SlepcConvMonitor,&ctx);
if (*ierr) return;
ctx->viewer = PETSC_NULL;
*ierr = QEPMonitorSet(*qep,QEPMonitorConverged,ctx,(PetscErrorCode (*)(void**))SlepcConvMonitorDestroy);
} else if ((PetscVoidFunction)monitor == (PetscVoidFunction)qepmonitorfirst_) {
*ierr = QEPMonitorSet(*qep,QEPMonitorFirst,0,0);
} else {
((PetscObject)*qep)->fortran_func_pointers[0] = (PetscVoidFunction)monitor;
((PetscObject)*qep)->fortran_func_pointers[1] = (PetscVoidFunction)mctx;
if (FORTRANNULLFUNCTION(monitordestroy)) {
if (!monitordestroy) {
*ierr = QEPMonitorSet(*qep,ourmonitor,*qep,0);
} else {
((PetscObject)*qep)->fortran_func_pointers[2] = (PetscVoidFunction)monitordestroy;
/branches/slepc-3_2-branch/src/qep/interface/qepmon.c
180,17 → 180,17
. eigi - imaginary part of the eigenvalues
. errest - error estimates
. nest - number of error estimates to display
- dummy - unused monitor context
- monctx - monitor context (contains viewer, can be PETSC_NULL)
 
Level: intermediate
 
.seealso: QEPMonitorSet(), QEPMonitorFirst(), QEPMonitorConverged()
@*/
PetscErrorCode QEPMonitorAll(QEP qep,PetscInt its,PetscInt nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt nest,void *dummy)
PetscErrorCode QEPMonitorAll(QEP qep,PetscInt its,PetscInt nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt nest,void *monctx)
{
PetscErrorCode ierr;
PetscInt i;
PetscViewer viewer = dummy? (PetscViewer)dummy: PETSC_VIEWER_STDOUT_(((PetscObject)qep)->comm);
PetscViewer viewer = monctx? (PetscViewer)monctx: PETSC_VIEWER_STDOUT_(((PetscObject)qep)->comm);
 
PetscFunctionBegin;
if (its) {
227,16 → 227,16
. eigi - imaginary part of the eigenvalues
. errest - error estimates
. nest - number of error estimates to display
- dummy - unused monitor context
- monctx - monitor context (contains viewer, can be PETSC_NULL)
 
Level: intermediate
 
.seealso: QEPMonitorSet(), QEPMonitorAll(), QEPMonitorConverged()
@*/
PetscErrorCode QEPMonitorFirst(QEP qep,PetscInt its,PetscInt nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt nest,void *dummy)
PetscErrorCode QEPMonitorFirst(QEP qep,PetscInt its,PetscInt nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt nest,void *monctx)
{
PetscErrorCode ierr;
PetscViewer viewer = dummy? (PetscViewer)dummy: PETSC_VIEWER_STDOUT_(((PetscObject)qep)->comm);
PetscViewer viewer = monctx? (PetscViewer)monctx: PETSC_VIEWER_STDOUT_(((PetscObject)qep)->comm);
 
PetscFunctionBegin;
if (its && nconv<nest) {
270,33 → 270,40
. eigi - imaginary part of the eigenvalues
. errest - error estimates
. nest - number of error estimates to display
- dummy - unused monitor context
- monctx - monitor context
 
Level: intermediate
 
Note:
The monitor context must contain a struct with a PetscViewer and a
PetscInt. In Fortran, pass a PETSC_NULL_OBJECT.
 
.seealso: QEPMonitorSet(), QEPMonitorFirst(), QEPMonitorAll()
@*/
PetscErrorCode QEPMonitorConverged(QEP qep,PetscInt its,PetscInt nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt nest,void *dummy)
PetscErrorCode QEPMonitorConverged(QEP qep,PetscInt its,PetscInt nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt nest,void *monctx)
{
PetscErrorCode ierr;
PetscInt i;
SlepcConvMonitor ctx = (SlepcConvMonitor)dummy;
PetscViewer viewer;
SlepcConvMonitor ctx = (SlepcConvMonitor)monctx;
 
PetscFunctionBegin;
if (!monctx) SETERRQ(((PetscObject)qep)->comm,PETSC_ERR_ARG_WRONG,"Must provide a context for QEPMonitorConverged");
if (!its) {
ctx->oldnconv = 0;
} else {
viewer = ctx->viewer? ctx->viewer: PETSC_VIEWER_STDOUT_(((PetscObject)qep)->comm);
for (i=ctx->oldnconv;i<nconv;i++) {
ierr = PetscViewerASCIIAddTab(ctx->viewer,((PetscObject)qep)->tablevel);CHKERRQ(ierr);
ierr = PetscViewerASCIIPrintf(ctx->viewer,"%3D QEP converged value (error) #%D",its,i);CHKERRQ(ierr);
ierr = PetscViewerASCIIAddTab(viewer,((PetscObject)qep)->tablevel);CHKERRQ(ierr);
ierr = PetscViewerASCIIPrintf(viewer,"%3D QEP converged value (error) #%D",its,i);CHKERRQ(ierr);
#if defined(PETSC_USE_COMPLEX)
ierr = PetscViewerASCIIPrintf(ctx->viewer," %G%+Gi",PetscRealPart(eigr[i]),PetscImaginaryPart(eigr[i]));CHKERRQ(ierr);
ierr = PetscViewerASCIIPrintf(viewer," %G%+Gi",PetscRealPart(eigr[i]),PetscImaginaryPart(eigr[i]));CHKERRQ(ierr);
#else
ierr = PetscViewerASCIIPrintf(ctx->viewer," %G",eigr[i]);CHKERRQ(ierr);
if (eigi[i]!=0.0) { ierr = PetscViewerASCIIPrintf(ctx->viewer,"%+Gi",eigi[i]);CHKERRQ(ierr); }
ierr = PetscViewerASCIIPrintf(viewer," %G",eigr[i]);CHKERRQ(ierr);
if (eigi[i]!=0.0) { ierr = PetscViewerASCIIPrintf(viewer,"%+Gi",eigi[i]);CHKERRQ(ierr); }
#endif
ierr = PetscViewerASCIIPrintf(ctx->viewer," (%10.8e)\n",(double)errest[i]);CHKERRQ(ierr);
ierr = PetscViewerASCIISubtractTab(ctx->viewer,((PetscObject)qep)->tablevel);CHKERRQ(ierr);
ierr = PetscViewerASCIIPrintf(viewer," (%10.8e)\n",(double)errest[i]);CHKERRQ(ierr);
ierr = PetscViewerASCIISubtractTab(viewer,((PetscObject)qep)->tablevel);CHKERRQ(ierr);
}
ctx->oldnconv = nconv;
}
/branches/slepc-3_2-branch/src/eps/interface/ftn-custom/zepsf.c
192,6 → 192,7
void PETSC_STDCALL epsmonitorset_(EPS *eps,void (PETSC_STDCALL *monitor)(EPS*,PetscInt*,PetscInt*,PetscScalar*,PetscScalar*,PetscReal*,PetscInt*,void*,PetscErrorCode*),
void *mctx,void (PETSC_STDCALL *monitordestroy)(void *,PetscErrorCode *),PetscErrorCode *ierr)
{
SlepcConvMonitor ctx;
CHKFORTRANNULLFUNCTION(monitordestroy);
PetscObjectAllocateFortranPointers(*eps,3);
if ((PetscVoidFunction)monitor == (PetscVoidFunction)epsmonitorall_) {
201,13 → 202,17
} else if ((PetscVoidFunction)monitor == (PetscVoidFunction)epsmonitorlgall_) {
*ierr = EPSMonitorSet(*eps,EPSMonitorLGAll,0,0);
} else if ((PetscVoidFunction)monitor == (PetscVoidFunction)epsmonitorconverged_) {
*ierr = EPSMonitorSet(*eps,EPSMonitorConverged,0,0);
if (!FORTRANNULLOBJECT(mctx)) { PetscError(((PetscObject)*eps)->comm,__LINE__,"epsmonitorset_",__FILE__,__SDIR__,PETSC_ERR_ARG_WRONG,PETSC_ERROR_INITIAL,"Must provide PETSC_NULL_OBJECT as a context in the Fortran interface to EPSMonitorSet"); *ierr = 1; return; }
*ierr = PetscNew(struct _n_SlepcConvMonitor,&ctx);
if (*ierr) return;
ctx->viewer = PETSC_NULL;
*ierr = EPSMonitorSet(*eps,EPSMonitorConverged,ctx,(PetscErrorCode (*)(void**))SlepcConvMonitorDestroy);
} else if ((PetscVoidFunction)monitor == (PetscVoidFunction)epsmonitorfirst_) {
*ierr = EPSMonitorSet(*eps,EPSMonitorFirst,0,0);
} else {
((PetscObject)*eps)->fortran_func_pointers[0] = (PetscVoidFunction)monitor;
((PetscObject)*eps)->fortran_func_pointers[1] = (PetscVoidFunction)mctx;
if (FORTRANNULLFUNCTION(monitordestroy)) {
if (!monitordestroy) {
*ierr = EPSMonitorSet(*eps,ourmonitor,*eps,0);
} else {
((PetscObject)*eps)->fortran_func_pointers[2] = (PetscVoidFunction)monitordestroy;
/branches/slepc-3_2-branch/src/eps/interface/monitor.c
180,18 → 180,18
. eigi - imaginary part of the eigenvalues
. errest - error estimates
. nest - number of error estimates to display
- dummy - unused monitor context
- monctx - monitor context (contains viewer, can be PETSC_NULL)
 
Level: intermediate
 
.seealso: EPSMonitorSet(), EPSMonitorFirst(), EPSMonitorConverged()
@*/
PetscErrorCode EPSMonitorAll(EPS eps,PetscInt its,PetscInt nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt nest,void *dummy)
PetscErrorCode EPSMonitorAll(EPS eps,PetscInt its,PetscInt nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt nest,void *monctx)
{
PetscErrorCode ierr;
PetscInt i;
PetscScalar er,ei;
PetscViewer viewer = dummy? (PetscViewer)dummy: PETSC_VIEWER_STDOUT_(((PetscObject)eps)->comm);
PetscViewer viewer = monctx? (PetscViewer)monctx: PETSC_VIEWER_STDOUT_(((PetscObject)eps)->comm);
 
PetscFunctionBegin;
if (its) {
230,17 → 230,17
. eigi - imaginary part of the eigenvalues
. errest - error estimates
. nest - number of error estimates to display
- dummy - unused monitor context
- monctx - monitor context (contains viewer, can be PETSC_NULL)
 
Level: intermediate
 
.seealso: EPSMonitorSet(), EPSMonitorAll(), EPSMonitorConverged()
@*/
PetscErrorCode EPSMonitorFirst(EPS eps,PetscInt its,PetscInt nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt nest,void *dummy)
PetscErrorCode EPSMonitorFirst(EPS eps,PetscInt its,PetscInt nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt nest,void *monctx)
{
PetscErrorCode ierr;
PetscScalar er,ei;
PetscViewer viewer = dummy? (PetscViewer)dummy: PETSC_VIEWER_STDOUT_(((PetscObject)eps)->comm);
PetscViewer viewer = monctx? (PetscViewer)monctx: PETSC_VIEWER_STDOUT_(((PetscObject)eps)->comm);
 
PetscFunctionBegin;
if (its && nconv<nest) {
276,36 → 276,43
. eigi - imaginary part of the eigenvalues
. errest - error estimates
. nest - number of error estimates to display
- dummy - unused monitor context
- monctx - monitor context
 
Note:
The monitor context must contain a struct with a PetscViewer and a
PetscInt. In Fortran, pass a PETSC_NULL_OBJECT.
 
Level: intermediate
 
.seealso: EPSMonitorSet(), EPSMonitorFirst(), EPSMonitorAll()
@*/
PetscErrorCode EPSMonitorConverged(EPS eps,PetscInt its,PetscInt nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt nest,void *dummy)
PetscErrorCode EPSMonitorConverged(EPS eps,PetscInt its,PetscInt nconv,PetscScalar *eigr,PetscScalar *eigi,PetscReal *errest,PetscInt nest,void *monctx)
{
PetscErrorCode ierr;
PetscInt i;
PetscScalar er,ei;
SlepcConvMonitor ctx = (SlepcConvMonitor)dummy;
PetscViewer viewer;
SlepcConvMonitor ctx = (SlepcConvMonitor)monctx;
 
PetscFunctionBegin;
if (!monctx) SETERRQ(((PetscObject)eps)->comm,PETSC_ERR_ARG_WRONG,"Must provide a context for EPSMonitorConverged");
if (!its) {
ctx->oldnconv = 0;
} else {
viewer = ctx->viewer? ctx->viewer: PETSC_VIEWER_STDOUT_(((PetscObject)eps)->comm);
for (i=ctx->oldnconv;i<nconv;i++) {
ierr = PetscViewerASCIIAddTab(ctx->viewer,((PetscObject)eps)->tablevel);CHKERRQ(ierr);
ierr = PetscViewerASCIIPrintf(ctx->viewer,"%3D EPS converged value (error) #%D",its,i);CHKERRQ(ierr);
ierr = PetscViewerASCIIAddTab(viewer,((PetscObject)eps)->tablevel);CHKERRQ(ierr);
ierr = PetscViewerASCIIPrintf(viewer,"%3D EPS converged value (error) #%D",its,i);CHKERRQ(ierr);
er = eigr[i]; ei = eigi[i];
ierr = STBackTransform(eps->OP,1,&er,&ei);CHKERRQ(ierr);
#if defined(PETSC_USE_COMPLEX)
ierr = PetscViewerASCIIPrintf(ctx->viewer," %G%+Gi",PetscRealPart(er),PetscImaginaryPart(er));CHKERRQ(ierr);
ierr = PetscViewerASCIIPrintf(viewer," %G%+Gi",PetscRealPart(er),PetscImaginaryPart(er));CHKERRQ(ierr);
#else
ierr = PetscViewerASCIIPrintf(ctx->viewer," %G",er);CHKERRQ(ierr);
if (ei!=0.0) { ierr = PetscViewerASCIIPrintf(ctx->viewer,"%+Gi",ei);CHKERRQ(ierr); }
ierr = PetscViewerASCIIPrintf(viewer," %G",er);CHKERRQ(ierr);
if (ei!=0.0) { ierr = PetscViewerASCIIPrintf(viewer,"%+Gi",ei);CHKERRQ(ierr); }
#endif
ierr = PetscViewerASCIIPrintf(ctx->viewer," (%10.8e)\n",(double)errest[i]);CHKERRQ(ierr);
ierr = PetscViewerASCIISubtractTab(ctx->viewer,((PetscObject)eps)->tablevel);CHKERRQ(ierr);
ierr = PetscViewerASCIIPrintf(viewer," (%10.8e)\n",(double)errest[i]);CHKERRQ(ierr);
ierr = PetscViewerASCIISubtractTab(viewer,((PetscObject)eps)->tablevel);CHKERRQ(ierr);
}
ctx->oldnconv = nconv;
}
/branches/slepc-3_2-branch/src/svd/interface/ftn-custom/zsvdf.c
27,6 → 27,8
#define svdmonitorall_ SVDMONITORALL
#define svdmonitorlg_ SVDMONITORLG
#define svdmonitorlgall_ SVDMONITORLGALL
#define svdmonitorconverged_ SVDMONITORCONVERGED
#define svdmonitorfirst_ SVDMONITORFIRST
#define svdview_ SVDVIEW
#define svdcreate_ SVDCREATE
#define svdsettype_ SVDSETTYPE
43,6 → 45,8
#define svddestroy_ svddestroy
#define svdmonitorall_ svdmonitorall
#define svdmonitorlgall_ svdmonitorlgall
#define svdmonitorconverged_ svdmonitorconverged
#define svdmonitorfirst_ svdmonitorfirst
#define svdview_ svdview
#define svdcreate_ svdcreate
#define svdsettype_ svdsettype
58,8 → 62,6
#endif
 
EXTERN_C_BEGIN
static void (PETSC_STDCALL *f1)(SVD*,PetscInt*,PetscInt*,PetscReal*,PetscReal*,PetscInt*,void*,PetscErrorCode*);
static void (PETSC_STDCALL *f2)(void**,PetscErrorCode*);
 
/*
These are not usually called from Fortran but allow Fortran users
79,20 → 81,35
{
*ierr = SVDMonitorLGAll(*svd,*it,*nconv,sigma,errest,*nest,ctx);
}
 
void svdmonitorconverged_(SVD *svd,PetscInt *it,PetscInt *nconv,PetscReal *sigma,PetscReal *errest,PetscInt *nest,void *ctx,PetscErrorCode *ierr)
{
*ierr = SVDMonitorConverged(*svd,*it,*nconv,sigma,errest,*nest,ctx);
}
 
void svdmonitorfirst_(SVD *svd,PetscInt *it,PetscInt *nconv,PetscReal *sigma,PetscReal *errest,PetscInt *nest,void *ctx,PetscErrorCode *ierr)
{
*ierr = SVDMonitorFirst(*svd,*it,*nconv,sigma,errest,*nest,ctx);
}
 
EXTERN_C_END
 
/* These are not extern C because they are passed into non-extern C user level functions */
static PetscErrorCode ourmonitor(SVD svd,PetscInt i,PetscInt nc,PetscReal *sigma,PetscReal *d,PetscInt l,void* ctx)
{
PetscErrorCode ierr = 0;
(*f1)(&svd,&i,&nc,sigma,d,&l,ctx,&ierr);CHKERRQ(ierr);
void *mctx = (void*) ((PetscObject)svd)->fortran_func_pointers[1];
(*(void (PETSC_STDCALL *)(SVD*,PetscInt*,PetscInt*,PetscReal*,PetscReal*,PetscInt*,void*,PetscErrorCode*))
(((PetscObject)svd)->fortran_func_pointers[0]))(&svd,&i,&nc,sigma,d,&l,mctx,&ierr);CHKERRQ(ierr);
return 0;
}
 
static PetscErrorCode ourdestroy(void** ctx)
{
PetscErrorCode ierr = 0;
(*f2)(ctx,&ierr);CHKERRQ(ierr);
SVD svd = *(SVD*)ctx;
void *mctx = (void*) ((PetscObject)svd)->fortran_func_pointers[1];
(*(void (PETSC_STDCALL *)(void*,PetscErrorCode*))(((PetscObject)svd)->fortran_func_pointers[2]))(mctx,&ierr);CHKERRQ(ierr);
return 0;
}
 
138,21 → 155,33
*ierr = SVDGetIP(*svd,ip);
}
 
void PETSC_STDCALL svdmonitorset_(SVD *svd,void (PETSC_STDCALL *monitor)(SVD*,PetscInt*,PetscInt*,PetscReal*,PetscReal*,PetscInt*,void*,PetscErrorCode*),void *mctx,void (PETSC_STDCALL *monitordestroy)(void **,PetscErrorCode *),PetscErrorCode *ierr)
void PETSC_STDCALL svdmonitorset_(SVD *svd,void (PETSC_STDCALL *monitor)(SVD*,PetscInt*,PetscInt*,PetscReal*,PetscReal*,PetscInt*,void*,PetscErrorCode*),void *mctx,void (PETSC_STDCALL *monitordestroy)(void *,PetscErrorCode *),PetscErrorCode *ierr)
{
if ((void(*)())monitor == (void(*)())svdmonitorall_) {
SlepcConvMonitor ctx;
CHKFORTRANNULLFUNCTION(monitordestroy);
PetscObjectAllocateFortranPointers(*svd,3);
if ((PetscVoidFunction)monitor == (PetscVoidFunction)svdmonitorall_) {
*ierr = SVDMonitorSet(*svd,SVDMonitorAll,0,0);
} else if ((void(*)())monitor == (void(*)())svdmonitorlg_) {
} else if ((PetscVoidFunction)monitor == (PetscVoidFunction)svdmonitorlg_) {
*ierr = SVDMonitorSet(*svd,SVDMonitorLG,0,0);
} else if ((void(*)())monitor == (void(*)())svdmonitorlgall_) {
} else if ((PetscVoidFunction)monitor == (PetscVoidFunction)svdmonitorlgall_) {
*ierr = SVDMonitorSet(*svd,SVDMonitorLGAll,0,0);
} else if ((PetscVoidFunction)monitor == (PetscVoidFunction)svdmonitorconverged_) {
if (!FORTRANNULLOBJECT(mctx)) { PetscError(((PetscObject)*svd)->comm,__LINE__,"svdmonitorset_",__FILE__,__SDIR__,PETSC_ERR_ARG_WRONG,PETSC_ERROR_INITIAL,"Must provide PETSC_NULL_OBJECT as a context in the Fortran interface to SVDMonitorSet"); *ierr = 1; return; }
*ierr = PetscNew(struct _n_SlepcConvMonitor,&ctx);
if (*ierr) return;
ctx->viewer = PETSC_NULL;
*ierr = SVDMonitorSet(*svd,SVDMonitorConverged,ctx,(PetscErrorCode (*)(void**))SlepcConvMonitorDestroy);
} else if ((PetscVoidFunction)monitor == (PetscVoidFunction)svdmonitorfirst_) {
*ierr = SVDMonitorSet(*svd,SVDMonitorFirst,0,0);
} else {
f1 = monitor;
if (FORTRANNULLFUNCTION(monitordestroy)) {
*ierr = SVDMonitorSet(*svd,ourmonitor,mctx,0);
((PetscObject)*svd)->fortran_func_pointers[0] = (PetscVoidFunction)monitor;
((PetscObject)*svd)->fortran_func_pointers[1] = (PetscVoidFunction)mctx;
if (!monitordestroy) {
*ierr = SVDMonitorSet(*svd,ourmonitor,*svd,0);
} else {
f2 = monitordestroy;
*ierr = SVDMonitorSet(*svd,ourmonitor,mctx,ourdestroy);
((PetscObject)*svd)->fortran_func_pointers[2] = (PetscVoidFunction)monitordestroy;
*ierr = SVDMonitorSet(*svd,ourmonitor,*svd,ourdestroy);
}
}
}
/branches/slepc-3_2-branch/src/svd/interface/svdmon.c
176,17 → 176,17
. sigma - singular values
. errest - error estimates
. nest - number of error estimates to display
- dummy - unused monitor context
- monctx - monitor context (contains viewer, can be PETSC_NULL)
 
Level: intermediate
 
.seealso: SVDMonitorSet(), SVDMonitorFirst(), SVDMonitorConverged()
@*/
PetscErrorCode SVDMonitorAll(SVD svd,PetscInt its,PetscInt nconv,PetscReal *sigma,PetscReal *errest,PetscInt nest,void *dummy)
PetscErrorCode SVDMonitorAll(SVD svd,PetscInt its,PetscInt nconv,PetscReal *sigma,PetscReal *errest,PetscInt nest,void *monctx)
{
PetscErrorCode ierr;
PetscInt i;
PetscViewer viewer = dummy? (PetscViewer)dummy: PETSC_VIEWER_STDOUT_(((PetscObject)svd)->comm);
PetscViewer viewer = monctx? (PetscViewer)monctx: PETSC_VIEWER_STDOUT_(((PetscObject)svd)->comm);
 
PetscFunctionBegin;
if (its) {
216,16 → 216,16
. sigma - singular values
. errest - error estimates
. nest - number of error estimates to display
- dummy - unused monitor context
- monctx - monitor context (contains viewer, can be PETSC_NULL)
 
Level: intermediate
 
.seealso: SVDMonitorSet(), SVDMonitorAll(), SVDMonitorConverged()
@*/
PetscErrorCode SVDMonitorFirst(SVD svd,PetscInt its,PetscInt nconv,PetscReal *sigma,PetscReal *errest,PetscInt nest,void *dummy)
PetscErrorCode SVDMonitorFirst(SVD svd,PetscInt its,PetscInt nconv,PetscReal *sigma,PetscReal *errest,PetscInt nest,void *monctx)
{
PetscErrorCode ierr;
PetscViewer viewer = dummy? (PetscViewer)dummy: PETSC_VIEWER_STDOUT_(((PetscObject)svd)->comm);
PetscViewer viewer = monctx? (PetscViewer)monctx: PETSC_VIEWER_STDOUT_(((PetscObject)svd)->comm);
 
PetscFunctionBegin;
if (its && nconv<nest) {
251,27 → 251,34
. sigma - singular values
. errest - error estimates
. nest - number of error estimates to display
- dummy - unused monitor context
- monctx - monitor context
 
Note:
The monitor context must contain a struct with a PetscViewer and a
PetscInt. In Fortran, pass a PETSC_NULL_OBJECT.
 
Level: intermediate
 
.seealso: SVDMonitorSet(), SVDMonitorFirst(), SVDMonitorAll()
@*/
PetscErrorCode SVDMonitorConverged(SVD svd,PetscInt its,PetscInt nconv,PetscReal *sigma,PetscReal *errest,PetscInt nest,void *dummy)
PetscErrorCode SVDMonitorConverged(SVD svd,PetscInt its,PetscInt nconv,PetscReal *sigma,PetscReal *errest,PetscInt nest,void *monctx)
{
PetscErrorCode ierr;
PetscInt i;
SlepcConvMonitor ctx = (SlepcConvMonitor) dummy;
PetscViewer viewer;
SlepcConvMonitor ctx = (SlepcConvMonitor) monctx;
 
PetscFunctionBegin;
if (!monctx) SETERRQ(((PetscObject)svd)->comm,PETSC_ERR_ARG_WRONG,"Must provide a context for SVDMonitorConverged");
if (!its) {
ctx->oldnconv = 0;
} else {
viewer = ctx->viewer? ctx->viewer: PETSC_VIEWER_STDOUT_(((PetscObject)svd)->comm);
for (i=ctx->oldnconv;i<nconv;i++) {
ierr = PetscViewerASCIIAddTab(ctx->viewer,((PetscObject)svd)->tablevel);CHKERRQ(ierr);
ierr = PetscViewerASCIIPrintf(ctx->viewer,"%3D SVD converged value (error) #%D",its,i);CHKERRQ(ierr);
ierr = PetscViewerASCIIPrintf(ctx->viewer," %G (%10.8e)\n",sigma[i],(double)errest[i]);CHKERRQ(ierr);
ierr = PetscViewerASCIISubtractTab(ctx->viewer,((PetscObject)svd)->tablevel);CHKERRQ(ierr);
ierr = PetscViewerASCIIAddTab(viewer,((PetscObject)svd)->tablevel);CHKERRQ(ierr);
ierr = PetscViewerASCIIPrintf(viewer,"%3D SVD converged value (error) #%D",its,i);CHKERRQ(ierr);
ierr = PetscViewerASCIIPrintf(viewer," %G (%10.8e)\n",sigma[i],(double)errest[i]);CHKERRQ(ierr);
ierr = PetscViewerASCIISubtractTab(viewer,((PetscObject)svd)->tablevel);CHKERRQ(ierr);
}
ctx->oldnconv = nconv;
}