1 #pragma once 2 3 #include <petscconvest.h> 4 #include <petsc/private/petscimpl.h> 5 6 typedef struct _PetscConvEstOps *PetscConvEstOps; 7 struct _PetscConvEstOps { 8 PetscErrorCode (*setfromoptions)(PetscConvEst); 9 PetscErrorCode (*setup)(PetscConvEst); 10 PetscErrorCode (*view)(PetscConvEst, PetscViewer); 11 PetscErrorCode (*destroy)(PetscConvEst); 12 PetscErrorCode (*setsolver)(PetscConvEst, PetscObject); 13 PetscErrorCode (*initguess)(PetscConvEst, PetscInt, DM, Vec); 14 PetscErrorCode (*computeerror)(PetscConvEst, PetscInt, DM, Vec, PetscReal[]); 15 PetscErrorCode (*getconvrate)(PetscConvEst, PetscReal[]); 16 }; 17 18 struct _p_PetscConvEst { 19 PETSCHEADER(struct _PetscConvEstOps); 20 /* Inputs */ 21 DM idm; /* Initial grid */ 22 PetscObject solver; /* Solver */ 23 PetscReal r; /* The refinement factor (spatial check requires r = 2) */ 24 PetscInt Nr; /* The number of refinements */ 25 PetscInt Nf; /* The number of fields in the DM */ 26 PetscBool noRefine; /* Debugging flag to disable refinement */ 27 PetscErrorCode (**initGuess)(PetscInt, PetscReal, const PetscReal[], PetscInt, PetscScalar[], void *); 28 PetscErrorCode (**exactSol)(PetscInt, PetscReal, const PetscReal[], PetscInt, PetscScalar[], void *); 29 void **ctxs; 30 /* Outputs */ 31 PetscLogEvent event; 32 PetscBool monitor; 33 PetscInt *dofs; 34 PetscReal *errors; 35 }; 36