System Preprocessors
|
#include "petscksp.h"
#include "petscmat.h"
Go to the source code of this file.
Defines | |
#define | TRANSFORMCOOKIE 2008 |
#define | CHECKVALIDTRANSFORM(x) {if (!(x)) {printf("Null SalsaTransform"); return 1;} else if ((x)->cookie!=TRANSFORMCOOKIE) {printf("Invalid SalsaTransform"); return 1;}; } |
#define | CHECKVALIDTRANSFORM0(x) {if (!(x)) {printf("Null SalsaTransform"); return 1;} else if ((x)->cookie!=TRANSFORMCOOKIE) {printf("Invalid SalsaTransform"); return 1;} } |
#define | TRANSFORMOBJECTCOOKIE 2009 |
#define | CHECKVALIDTRANSFORMOBJECT(x) {if (!(x)) {printf("Null TransformObject"); return 1;} else if ((x)->cookie!=TRANSFORMOBJECTCOOKIE) {printf("Invalid TransformObject"); return 1;} } |
#define | TRUTH(x) ( (x) ? PETSC_TRUE : PETSC_FALSE ) |
Typedefs | |
typedef struct SystemPreprocessor_ * | SystemPreprocessor |
typedef struct NumericalProblem_ * | NumericalProblem |
typedef struct NumericalSolution_ * | NumericalSolution |
typedef PetscReal | SuitabilityValue |
typedef struct SalsaTransform_ * | SalsaTransform |
typedef struct SalsaTransformObject_ * | SalsaTransformObject |
Functions | |
PetscErrorCode | SysProInitialize () |
PetscErrorCode | SysProFinalize () |
PetscErrorCode | DeclarePreprocessor (const char *name, PetscErrorCode(*global_setup)(), PetscErrorCode(*specific_setup)(NumericalProblem, SalsaTransform), PetscErrorCode(*specific_unset)(NumericalProblem), PetscErrorCode(*global_unset)(), PetscErrorCode(*ctxcreate)(NumericalProblem, void **), PetscErrorCode(*ctxdelete)(void *), PetscErrorCode(*start_function)(const char *, int, PetscBool, NumericalProblem, NumericalProblem *, void *, void **, PetscBool *), PetscErrorCode(*end_function)(const char *, PetscBool, void *, void *, NumericalProblem, NumericalProblem, NumericalSolution, NumericalSolution)) |
PetscErrorCode | DeclarePreprocessorIntelligentChoice (const char *name, PetscErrorCode(*picker)(NumericalProblem, const char **, const char **)) |
PetscErrorCode | PreprocessorsOptionsHandling () |
PetscErrorCode | SysProDeclareFunctions (PetscErrorCode(*classstaticsetup)(const char *), PetscErrorCode(*classdynamicsetup)(const char *, NumericalProblem), PetscErrorCode(*classproblemcloner)(const char *, const char *, int, NumericalProblem, NumericalProblem), PetscErrorCode(*solver)(NumericalProblem, void *, NumericalSolution *), PetscErrorCode(*problemdelete)(NumericalProblem), PetscErrorCode(*solutioncreator)(NumericalProblem, NumericalSolution *), PetscErrorCode(*solutioncopy)(NumericalSolution, NumericalSolution), PetscErrorCode(*solutiondelete)(NumericalSolution), PetscErrorCode(*ctxcloner)(const char *, const char *, void *, void **), PetscErrorCode(*ctxfree)(void *), PetscErrorCode(*solutioncontextdelete)(NumericalSolution)) |
PetscErrorCode | ProcessPreprocessorOptions (char *processor, void *ctx) |
PetscErrorCode | PreprocessorGetIndex (const char *, int *) |
PetscErrorCode | SystemPreprocessorGetByName (const char *, SystemPreprocessor *) |
PetscErrorCode | PreprocessorGetSetting (const char *, const char **, int *) |
PetscErrorCode | RetrievePreprocessorChoice (int, const char **, int *) |
PetscErrorCode | GetFirstPreprocessor (const char **preprocess) |
PetscErrorCode | GetNextPreprocessor (const char **next_one) |
PetscErrorCode | SuccessorPreprocessor (const char *, const char **) |
PetscErrorCode | InitRetrievingPreprocessors () |
PetscErrorCode | StartRetrievingCurrentPreprocessors (const char **, const char **, int *, PetscBool *) |
PetscErrorCode | ContinueRetrievingCurrentPreprocessors (const char **, const char **, int *, PetscBool *) |
PetscErrorCode | StartRetrievingAllPreprocessors (const char **, const char ***, int *, PetscBool *) |
PetscErrorCode | ContinueRetrievingAllPreprocessors (const char **, const char ***, int *, PetscBool *) |
PetscErrorCode | RetrieveAllPreprocessorValues (const char *, const char ***, int *) |
PetscErrorCode | SysProShowOptions (MPI_Comm comm) |
PetscErrorCode | RegisterPreprocessorContext (const char *, void *ctx) |
PetscErrorCode | PreprocessorGetContext (const char *, void **ctx) |
PetscErrorCode | PreprocessedSolution (const char *, NumericalProblem, void *, NumericalSolution *) |
PetscErrorCode | PreprocessedProblemSolving (NumericalProblem, NumericalSolution *) |
PetscErrorCode | PreprocessorSetPreservedCategories (const char *, const char *) |
PetscErrorCode | PreprocessorGetPreservedCategories (const char *, const char **) |
PetscErrorCode | SysProComputeQuantity (NumericalProblem, const char *, const char *, void *, int *, PetscBool *) |
PetscErrorCode | SysProRetrieveQuantity (NumericalProblem, const char *, const char *, void *, int *, PetscBool *) |
PetscErrorCode | SysProRemoveQuantity (NumericalProblem, const char *, const char *, PetscBool *) |
PetscErrorCode | SysProFreeQuantities (NumericalProblem) |
PetscErrorCode | SysProDefaultTrace (void *, const char *, va_list) |
PetscErrorCode | SysProDeclareTraceFunction (PetscErrorCode(*fn)(void *, const char *, va_list)) |
PetscErrorCode | SysProDeclareTraceContext (void *ctx) |
PetscErrorCode | SysProTraceMessage (const char *fmt,...) |
PetscErrorCode | SysProHasTrace (PetscBool *flg) |
PetscErrorCode | SysProDeclareProblemMonitor (PetscErrorCode(*)(NumericalProblem)) |
PetscErrorCode | SysProDeclareErrorTracer (PetscErrorCode(*)(NumericalProblem, NumericalSolution, const char *)) |
PetscErrorCode | SysProGetErrorTracer (PetscErrorCode(**)(NumericalProblem, NumericalSolution, const char *)) |
PetscErrorCode | TabReportAllPreprocessors (const char **key, int) |
PetscErrorCode | TabReportActivePreprocessors (const char **key, const char **val, int) |
PetscErrorCode | ReportEnabledPreprocessors (const char *) |
PetscErrorCode | ReportSysProCallStackState (const char *) |
PetscErrorCode | ScreenOutputTab (const char *, const char *) |
PetscErrorCode | ScreenOutputTabLine (const char *, const char *) |
PetscErrorCode | NumericalProblemGetComm (NumericalProblem, MPI_Comm *) |
PetscErrorCode | TestSuitabilityContext (SalsaTransform, void *) |
#define CHECKVALIDTRANSFORM | ( | x | ) | {if (!(x)) {printf("Null SalsaTransform"); return 1;} else if ((x)->cookie!=TRANSFORMCOOKIE) {printf("Invalid SalsaTransform"); return 1;}; } |
Definition at line 8 of file syspro.h.
Referenced by DeregisterTransform(), SetSuitabilityContextTester(), TransformCharAnnotationGetIndex(), TransformGetName(), TransformGetNextUnmarkedItem(), TransformGetNUnmarked(), TransformGetObjects(), TransformGetUserChoices(), TransformIntAnnotationGetIndex(), TransformItemDescribeLong(), TransformItemOptionMark(), TransformObjectsGetNames(), TransformObjectsMarkAll(), TransformObjectsUnmarkAll(), TransformObjectsUseOnly(), and TransformSetUserChoices().
#define CHECKVALIDTRANSFORM0 | ( | x | ) | {if (!(x)) {printf("Null SalsaTransform"); return 1;} else if ((x)->cookie!=TRANSFORMCOOKIE) {printf("Invalid SalsaTransform"); return 1;} } |
Definition at line 10 of file syspro.h.
Referenced by TestSuitabilityContext().
#define CHECKVALIDTRANSFORMOBJECT | ( | x | ) | {if (!(x)) {printf("Null TransformObject"); return 1;} else if ((x)->cookie!=TRANSFORMOBJECTCOOKIE) {printf("Invalid TransformObject"); return 1;} } |
Definition at line 12 of file syspro.h.
Referenced by FreeTransformObject(), PreprocessorSaveAprioriSelection(), TransformGetNextUnmarkedItem(), TransformItemOptionsUseOnly(), TransformObjectAddOption(), TransformObjectAddOptionExplanation(), TransformObjectCharAnnotate(), TransformObjectDefineOption(), TransformObjectGetByName(), TransformObjectGetIntAnnotation(), TransformObjectGetMark(), TransformObjectGetName(), TransformObjectGetSuitabilityFunction(), TransformObjectGetTransformName(), TransformObjectIntAnnotate(), TransformObjectMark(), TransformObjectSetExplanation(), TransformObjectSetSuitabilityFunction(), TransformObjectsMarkAll(), TransformObjectsUnmarkAll(), and TransformObjectUnmark().
#define TRANSFORMCOOKIE 2008 |
Definition at line 7 of file syspro.h.
Referenced by NewTransform().
#define TRANSFORMOBJECTCOOKIE 2009 |
Definition at line 11 of file syspro.h.
Referenced by NewTransformObject().
#define TRUTH | ( | x | ) | ( (x) ? PETSC_TRUE : PETSC_FALSE ) |
Definition at line 13 of file syspro.h.
Referenced by is_gmres_method(), PreprocessedSolution(), PreprocessorsOptionsHandling(), set_intelligent_scaling(), setup_pc(), TransformGetNextUnmarkedItem(), and TransformObjectGetIntAnnotation().
typedef struct NumericalProblem_* NumericalProblem |
typedef struct NumericalSolution_* NumericalSolution |
typedef struct SalsaTransform_* SalsaTransform |
typedef struct SalsaTransformObject_* SalsaTransformObject |
typedef PetscReal SuitabilityValue |
typedef struct SystemPreprocessor_* SystemPreprocessor |
PetscErrorCode ContinueRetrievingAllPreprocessors | ( | const char ** | cclass, |
const char *** | types, | ||
int * | ntypes, | ||
PetscBool * | success | ||
) |
This routine is to be used repeatedly after an initial call to StartRetrievingAllPreprocessors().
The types
argument is allocated internally and should be deallocated by the user.
Definition at line 186 of file reporting.c.
References CHKERRQ(), ierr, SalsaTransform_::n_objects, SystemPreprocessor_::name, npreprocess, preprocessreadout, SystemPreprocessor_::transform, and TransformObjectsGetNames().
Referenced by RetrieveAllPreprocessorValues(), StartRetrievingAllPreprocessors(), SysProShowOptions(), and TabReportPreprocessors().
PetscErrorCode ContinueRetrievingCurrentPreprocessors | ( | const char ** | cclass, |
const char ** | atype, | ||
int * | opt, | ||
PetscBool * | success | ||
) |
This routine is to be used repeatedly after an initial call to StartRetrievingCurrentPreprocessors().
Definition at line 125 of file reporting.c.
References CHKERRQ(), ierr, SystemPreprocessor_::name, preprocesslevel, preprocessreadout, and RetrievePreprocessorChoice().
Referenced by StartRetrievingCurrentPreprocessors(), and TabReportPreprocessors().
PetscErrorCode DeclarePreprocessor | ( | const char * | name, |
PetscErrorCode(*)() | this_preprocessor_setup, | ||
PetscErrorCode(*)(NumericalProblem, SalsaTransform) | specific_setup, | ||
PetscErrorCode(*)(NumericalProblem) | specific_unset, | ||
PetscErrorCode(*)() | global_unset, | ||
PetscErrorCode(*)(NumericalProblem, void **) | ctxcreate, | ||
PetscErrorCode(*)(void *) | ctxdelete, | ||
PetscErrorCode(*)(const char *, int, PetscBool, NumericalProblem, NumericalProblem *, void *, void **, PetscBool *) | start_function, | ||
PetscErrorCode(*)(const char *, PetscBool, void *, void *, NumericalProblem, NumericalProblem, NumericalSolution, NumericalSolution) | end_function | ||
) |
Declare a preprocessor class, by specifing its various members.
The name
argument should not contain the colon character.
Here is an explanation of the various function arguments.
this_preprocessor_setup()
: this routine is called only once, inside this function. This is a good place for defining all the preprocessors in this class
specific_setup(NumericalProblem,SalsaTransform)
: this is called at the start of a preprocessing stage; one could use this for computing matrix metadata.
global_unset(void)
: this is called in SysProFinalize().
ctx_create(NumericalProblem,void**)
: create an object that can be used for the duration of the application of this preprocessor
ctxdelete(void*)
: delete the context again
start_function
: this is the function that performs the forward transform of the problem. Prototype:
PetscErrorCode start_function (char *classmember, int optionvalue, PetscBool overwrite, NumericalProblem problem, NumericalProblem *transformedproblem, void *globalcontext, void **localcontext, PetscBool *success)
end_function
: this is the backtransform. Its main task is copying or backtransforming the preprocessed solution to the original solution.
PetscErrorCode end_function (char *classmember, PetscBool overwrite, void *globalcontext, void *localcontext, NumericalProblem pproblem, NumericalProblem oproblem, NumericalSolution psolution, NumericalSolution osolution)
where pproblem
and psolution
are the preprocessed quantities, the end function has to unprocess them and leave the result in oproblem
, osolution
. Actually, oproblem
is only for reference.
Definition at line 328 of file preprocess.c.
References CHKERRQ(), PreprocessorsGlobalInfo_::classstaticsetup, SystemPreprocessor_::ctxcreate, SystemPreprocessor_::ctxdelete, SystemPreprocessor_::end_function, SystemPreprocessor_::exhaustive, ierr, SystemPreprocessor_::name, NewTransform(), NPREPROCESS, npreprocess, SystemPreprocessor_::setup, SystemPreprocessor_::start_function, SystemPreprocessor_::transform, SystemPreprocessor_::unset, and unsetpreprocessor.
Referenced by DeclareApproximationPreprocessor(), DeclareDistributionPreprocessor(), DeclareFlipsignPreprocessor(), DeclareKSPPreprocessor(), DeclarePCPreprocessor(), DeclareScalingPreprocessor(), DeclareSingletonPreprocessor(), and main().
PetscErrorCode DeclarePreprocessorIntelligentChoice | ( | const char * | name, |
PetscErrorCode(*)(NumericalProblem, const char **, const char **) | picker | ||
) |
Install a function to pick the optimal choice for a preprocessor
Definition at line 412 of file preprocess.c.
References CHKERRQ(), ierr, SystemPreprocessor_::intelligence, and SystemPreprocessorGetByName().
Referenced by DeclareScalingPreprocessor().
PetscErrorCode GetFirstPreprocessor | ( | const char ** | preprocess | ) |
Get the name of the first declared preprocessor (in order of declaration) or null if none have been declared. Subsequent preprocessors can be retrieved with GetNextPreprocessor() or SuccessorPreprocessor().
Definition at line 45 of file reporting.c.
References CHKERRQ(), GetNextPreprocessor(), ierr, and preprocessreadout.
Referenced by PreprocessedProblemSolving(), and PreprocessorsOptionsHandling().
PetscErrorCode GetNextPreprocessor | ( | const char ** | next_one | ) |
Get the next preprocessor according to the variable preprocessreadout.
The result is null if there are no further preprocessors.
Definition at line 61 of file reporting.c.
References SystemPreprocessor_::name, npreprocess, and preprocessreadout.
Referenced by GetFirstPreprocessor(), and PreprocessorsOptionsHandling().
PetscErrorCode InitRetrievingPreprocessors | ( | ) |
Definition at line 169 of file reporting.c.
References preprocessreadout.
Referenced by TabReportPreprocessors().
PetscErrorCode NumericalProblemGetComm | ( | NumericalProblem | , |
MPI_Comm * | |||
) |
Definition at line 424 of file preprocess.c.
References NumericalProblem_::comm.
Referenced by create_solver().
PetscErrorCode PreprocessedProblemSolving | ( | NumericalProblem | problem, |
NumericalSolution * | solution | ||
) |
Invoking this routine starts the preprocessing and ultimate solution of the numerical problem.
Definition at line 1028 of file preprocess.c.
References CHKERRQ(), PreprocessorsGlobalInfo_::errortracer, GetFirstPreprocessor(), ierr, PreprocessedSolution(), preprocesslevel, and PreprocessorsGlobalInfo_::problemsolver.
Referenced by main(), and PreprocessedLinearSystemSolution().
PetscErrorCode PreprocessedSolution | ( | const char * | pclassname, |
NumericalProblem | problem, | ||
void * | prevctx, | ||
NumericalSolution * | rsolution | ||
) |
This routine handles the application of one preprocessor. Depending on the runtime setup (see section Usage modes), one choice is applied, or a sequence of choices is applied consecutively. The forward and backward transformation of the preprocessor are done here, and if necessary, backup copies of the system are kept around.
Definition at line 875 of file preprocess.c.
References CHKERRQ(), ChooseFirstTransform(), PreprocessorsGlobalInfo_::classdynamicsetup, SystemPreprocessor_::ctxcreate, SystemPreprocessor_::ctxdelete, PreprocessorsGlobalInfo_::errortracer, SystemPreprocessor_::exhaustive, ierr, PreprocessedSolution(), preprocesslevel, PreprocessorSpecificSetup(), PreprocessorsGlobalInfo_::problemsolver, RegisterPreprocessorContext(), RegisterPreprocessorSetting(), ReportSysProCallStackState(), PreprocessorsGlobalInfo_::solutioncontextdelete, PreprocessorsGlobalInfo_::solutiondelete, SuccessorPreprocessor(), SysProPreprocessorEndFunction(), SysproPreprocessorStartFunction(), SysProProblemCloneContext(), SysProTraceMessage(), SystemPreprocessorGetByName(), SystemPreprocessor_::transform, TransformGetNextUnmarkedItem(), TransformGetUserChoices(), TransformItemGetFirstOption(), TransformItemGetNextOption(), TransformObjectGetName(), TRUTH, and SystemPreprocessor_::unset.
Referenced by PreprocessedProblemSolving(), and PreprocessedSolution().
PetscErrorCode PreprocessorGetContext | ( | const char * | , |
void ** | ctx | ||
) |
Definition at line 681 of file preprocess.c.
References CHKERRQ(), ierr, preprocessorcontexts, PreprocessorGetIndex(), and solutioncontext.
Referenced by setup_ksp(), and setup_pc().
PetscErrorCode PreprocessorGetIndex | ( | const char * | , |
int * | |||
) |
Definition at line 591 of file preprocess.c.
References CHKERRQ(), ierr, and npreprocess.
Referenced by PreprocessorGetContext(), RegisterPreprocessorContext(), and SystemPreprocessorGetByName().
PetscErrorCode PreprocessorGetPreservedCategories | ( | const char * | , |
const char ** | |||
) |
Definition at line 55 of file compute.c.
References CHKERRQ(), ierr, SystemPreprocessor_::preserved, and SystemPreprocessorGetByName().
PetscErrorCode PreprocessorGetSetting | ( | const char * | , |
const char ** | , | ||
int * | |||
) |
Definition at line 559 of file preprocess.c.
References currentchoices, currentoptions, currentpreprocessors, and preprocesslevel.
Referenced by disable_ksps().
PetscErrorCode PreprocessorSetPreservedCategories | ( | const char * | , |
const char * | |||
) |
Definition at line 33 of file compute.c.
References CHKERRQ(), ierr, SystemPreprocessor_::preserved, and SystemPreprocessorGetByName().
Referenced by DeclareApproximationPreprocessor(), DeclareDistributionPreprocessor(), DeclareFlipsignPreprocessor(), DeclareKSPPreprocessor(), DeclarePCPreprocessor(), DeclareScalingPreprocessor(), and DeclareSingletonPreprocessor().
PetscErrorCode PreprocessorsOptionsHandling | ( | ) |
Process commandline options that control the behaviour of SysPro. For more information see Command line options handling.
Definition at line 72 of file options.c.
References CHKERRQ(), SystemPreprocessor_::exhaustive, GetFirstPreprocessor(), GetNextPreprocessor(), ierr, SystemPreprocessor_::optionshandling, PreprocessorSaveAprioriSelection(), ReportEnabledPreprocessors(), SystemPreprocessorGetByName(), TransformGetByName(), TransformGetNextUnmarkedItem(), TransformGetNUnmarked(), TransformItemOptionsUseOnly(), TransformObjectGetName(), TransformObjectsUseOnly(), TransformSetUserChoices(), TRUTH, and TYPELEN.
Referenced by main().
PetscErrorCode ProcessPreprocessorOptions | ( | char * | processor, |
void * | ctx | ||
) |
PetscErrorCode RegisterPreprocessorContext | ( | const char * | , |
void * | ctx | ||
) |
Definition at line 659 of file preprocess.c.
References CHKERRQ(), ierr, preprocessorcontexts, PreprocessorGetIndex(), and solutioncontext.
Referenced by PreprocessedLinearSystemSolution(), and PreprocessedSolution().
PetscErrorCode ReportEnabledPreprocessors | ( | const char * | name | ) |
Report preprocessor choices that are available after the specific setup has possible disabled some of the registered ones. This function uses the sysprotrace
function, so this has to have been declared.
Definition at line 394 of file reporting.c.
References CHKERRQ(), ierr, SysProHasTrace(), SysProTraceMessage(), TransformGetByName(), and TransformReportEnabled().
Referenced by PreprocessorsOptionsHandling(), and PreprocessorSpecificSetup().
PetscErrorCode ReportSysProCallStackState | ( | const char * | name | ) |
Report preprocessor choices that are available after the specific setup has possible disabled some of the registered ones. This function uses the sysprotrace
function, so this has to have been declared.
Definition at line 418 of file reporting.c.
References CHKERRQ(), ierr, ScreenOutputTabLine(), SysProHasTrace(), SysProTraceMessage(), and TabReportPreprocessors().
Referenced by PreprocessedSolution().
PetscErrorCode RetrieveAllPreprocessorValues | ( | const char * | , |
const char *** | , | ||
int * | |||
) |
Definition at line 210 of file reporting.c.
References CHKERRQ(), ContinueRetrievingAllPreprocessors(), ierr, npreprocess, and preprocessreadout.
Referenced by pcoptionshandling().
PetscErrorCode RetrievePreprocessorChoice | ( | int | , |
const char ** | , | ||
int * | |||
) |
Definition at line 579 of file preprocess.c.
References currentchoices, and currentoptions.
Referenced by ContinueRetrievingCurrentPreprocessors().
PetscErrorCode ScreenOutputTab | ( | const char * | , |
const char * | |||
) |
Definition at line 320 of file reporting.c.
References CHKERRQ(), ierr, SysProHasTrace(), and SysProTraceMessage().
PetscErrorCode ScreenOutputTabLine | ( | const char * | , |
const char * | |||
) |
Definition at line 347 of file reporting.c.
References CHKERRQ(), ierr, MAXLEN, SysProHasTrace(), and SysProTraceMessage().
Referenced by ReportSysProCallStackState().
PetscErrorCode StartRetrievingAllPreprocessors | ( | const char ** | cclass, |
const char *** | types, | ||
int * | ntypes, | ||
PetscBool * | success | ||
) |
This routine gives the class of the first declared preprocessor, and all possible values. To get the next preprocessor, call ContinueRetrievingAllPreprocessors().
The class, types, and ntypes arguments can all be null.
The types
argument is allocated internally and should be deallocated by the user.
Definition at line 157 of file reporting.c.
References CHKERRQ(), ContinueRetrievingAllPreprocessors(), ierr, and preprocessreadout.
Referenced by SysProShowOptions().
PetscErrorCode StartRetrievingCurrentPreprocessors | ( | const char ** | cclass, |
const char ** | type, | ||
int * | opt, | ||
PetscBool * | success | ||
) |
This routine gives the class and current value of the first declared preprocessor. To get the next preprocessor, call ContinueRetrievingAllPreprocessors().
The class, types, and ntypes arguments can all be null.
Definition at line 108 of file reporting.c.
References CHKERRQ(), ContinueRetrievingCurrentPreprocessors(), ierr, and preprocessreadout.
PetscErrorCode SuccessorPreprocessor | ( | const char * | this_one, |
const char ** | next_one | ||
) |
Given a preprocessor, get the name of the next one (in order of declaration) or null if there are no further ones.
The arguments are allowed to be the same.
Definition at line 78 of file reporting.c.
References CHKERRQ(), ierr, SystemPreprocessor_::name, and npreprocess.
Referenced by PreprocessedSolution().
PetscErrorCode SysProComputeQuantity | ( | NumericalProblem | theproblem, |
const char * | cat, | ||
const char * | cmp, | ||
void * | res, | ||
int * | reslen, | ||
PetscBool * | flg | ||
) |
anamod SysPro-AnaMod interface
The SysPro linear package has a few routines to facilitate integration with AnaMod
SysProComputeQuantity()
: to compute a quantity using AnaMod and store it as the metadata of a linear systemSysProRetrieveQuantity()
: to get an already computed quantitySysProFreeQuantities()
: to destroy the metadata objectSysProRemoveQuantity()
: to invalidate/free selected quantitiesThis routine is used in SysPro to compute quantities. See also SysProRetrieveQuantity().
Definition at line 23 of file syspro_anamod.c.
References CHKERRQ(), ierr, LinearSystemGetMetadata(), and LinearSystemGetParts().
Referenced by flipsign(), MatSymmetricPart(), sans_partition(), specific_flipsign_choices(), and specific_singleton_choices().
PetscErrorCode SysProDeclareErrorTracer | ( | PetscErrorCode(*)(NumericalProblem, NumericalSolution, const char *) | ) |
Definition at line 391 of file preprocess.c.
References PreprocessorsGlobalInfo_::errortracer.
PetscErrorCode SysProDeclareFunctions | ( | PetscErrorCode(*)(const char *) | classstaticsetup, |
PetscErrorCode(*)(const char *, NumericalProblem) | classdynamicsetup, | ||
PetscErrorCode(*)(const char *, const char *, int, NumericalProblem, NumericalProblem) | classproblemcloner, | ||
PetscErrorCode(*)(NumericalProblem, void *, NumericalSolution *) | problemsolver, | ||
PetscErrorCode(*)(NumericalProblem) | problemdelete, | ||
PetscErrorCode(*)(NumericalProblem, NumericalSolution *) | solutioncreator, | ||
PetscErrorCode(*)(NumericalSolution, NumericalSolution) | solutioncopy, | ||
PetscErrorCode(*)(NumericalSolution) | solutiondelete, | ||
PetscErrorCode(*)(const char *, const char *, void *, void **) | ctxcloner, | ||
PetscErrorCode(*)(void *) | ctxfree, | ||
PetscErrorCode(*)(NumericalSolution) | solutioncontextdelete | ||
) |
Install various functions
classstaticsetup
: this function is called on each processor as it is being created; see DeclarePreprocessor().classdynamicsetup
: this function is called as any invocation of a preprocessor starts; see PreprocessedSolution();classproblemcloner
: a function to clone the context : optional see Tracing the preprocessors for more details.problemsolver
: the ultimate problem solver : requiredproblemdelete
: delete a problem objectsolutioncreator
: creates a solution object; optional, but required a preprocessor has an endfunction.solutioncopy
: guess what this does; optionalsolutiondelete
: optional, but needed if solutioncopy is usedcontextcloner
: problems can carry a context; this clones the context if a problem is copied; otherwise the pointer is simply duplicatedcontextfree
: used to delete cloned contextssolutioncontextdelete
: hm. Definition at line 453 of file preprocess.c.
References PreprocessorsGlobalInfo_::classdynamicsetup, PreprocessorsGlobalInfo_::classproblemcloner, PreprocessorsGlobalInfo_::classstaticsetup, PreprocessorsGlobalInfo_::clonecontext, PreprocessorsGlobalInfo_::freecontext, PreprocessorsGlobalInfo_::problemdelete, PreprocessorsGlobalInfo_::problemsolver, PreprocessorsGlobalInfo_::solutioncontextdelete, PreprocessorsGlobalInfo_::solutioncopy, PreprocessorsGlobalInfo_::solutioncreator, and PreprocessorsGlobalInfo_::solutiondelete.
Referenced by main().
PetscErrorCode SysProDeclareProblemMonitor | ( | PetscErrorCode(*)(NumericalProblem) | ) |
Definition at line 381 of file preprocess.c.
References PreprocessorsGlobalInfo_::problemmonitor.
PetscErrorCode SysProDeclareTraceContext | ( | void * | ctx | ) |
Definition at line 77 of file tracing.c.
References sysprotracectx.
PetscErrorCode SysProDeclareTraceFunction | ( | PetscErrorCode(*)(void *, const char *, va_list) | fn | ) |
Specify a trace function.
The trace function has a prototype
PetscErrorCode tracefunction(void*,char*,va_list)
which means that it has an arbitrary number of arguments, much like printf
. The first argument is a context, which can be set by SysProDeclareTraceContext().
Here is an example of how you would write a trace function:
#include <stdarg.h> PetscErrorCode tracefunction(void *ctx,char *fmt,va_list argp) { char *prefix = (char*)ctx; PetscFunctionBegin; printf("%s ",prefix); vprintf(fmt, argp); PetscFunctionReturn(0); }
Consult string.h
(probably in /usr/include
) to see which "v" versions of printf
are available.
There is a default trace function SysProDefaultTrace().
You can undeclare a trace function by passing NULL.
See also SysProTraceMessage().
Definition at line 64 of file tracing.c.
References sysprotrace.
Referenced by main().
PetscErrorCode SysProDefaultTrace | ( | void * | , |
const char * | , | ||
va_list | |||
) |
PetscErrorCode SysProFinalize | ( | ) |
Definition at line 245 of file preprocess.c.
References CHKERRQ(), currentchoices, currentoptions, currentpreprocessors, DeregisterTransform(), ierr, SystemPreprocessor_::name, npreprocess, preprocessorcontexts, SystemPreprocessor_::preserved, SystemPreprocessor_::transform, and unsetpreprocessor.
Referenced by main().
PetscErrorCode SysProFreeQuantities | ( | NumericalProblem | ) |
Definition at line 96 of file syspro_anamod.c.
References CHKERRQ(), ierr, and LinearSystemGetMetadata().
PetscErrorCode SysProGetErrorTracer | ( | PetscErrorCode(**)(NumericalProblem, NumericalSolution, const char *) | ) |
Definition at line 401 of file preprocess.c.
References PreprocessorsGlobalInfo_::errortracer.
PetscErrorCode SysProHasTrace | ( | PetscBool * | flg | ) |
Test whether a trace function has been declared; see SysProDeclareTraceFunction(). Normally you would use SysProTraceMessage() which performs this test internally, but this function can be useful if a large amount of processing has to be performed to construct the trace message to begin with.
Definition at line 109 of file tracing.c.
References sysprotrace.
Referenced by ReportEnabledPreprocessors(), ReportSysProCallStackState(), ScreenOutputTab(), and ScreenOutputTabLine().
PetscErrorCode SysProInitialize | ( | ) |
Allocate SysPro globals. See also SysProFinalize().
Definition at line 220 of file preprocess.c.
References CHKERRQ(), CreateGlobalInfo(), currentchoices, currentoptions, currentpreprocessors, ierr, NPREPROCESS, preprocessorcontexts, and unsetpreprocessor.
Referenced by main().
PetscErrorCode SysProRemoveQuantity | ( | NumericalProblem | theproblem, |
const char * | cat, | ||
const char * | cmp, | ||
PetscBool * | flg | ||
) |
This routine is used to invalidate and free computed quantities. See also SysProRetrieveQuantity(), SysProComputeQuantity().
Definition at line 80 of file syspro_anamod.c.
References CHKERRQ(), ierr, and LinearSystemGetMetadata().
Referenced by singleton_specific_unset().
PetscErrorCode SysProRetrieveQuantity | ( | NumericalProblem | theproblem, |
const char * | cat, | ||
const char * | cmp, | ||
void * | res, | ||
int * | reslen, | ||
PetscBool * | flg | ||
) |
This routine is used in SysPro to retrieve already computed quantities. Reports failure if the quantity has not already been computed. See also SysProComputeQuantity().
Definition at line 52 of file syspro_anamod.c.
References CHKERRQ(), ierr, and LinearSystemGetParts().
Referenced by disable_pcs(), eliminate_singletons(), MatSymmetricPart(), set_intelligent_scaling(), specific_approximation_choices(), and specific_scaling_choices().
PetscErrorCode SysProShowOptions | ( | MPI_Comm | comm | ) |
Display all available options.
Definition at line 45 of file options.c.
References CHKERRQ(), ContinueRetrievingAllPreprocessors(), ierr, and StartRetrievingAllPreprocessors().
PetscErrorCode SysProTraceMessage | ( | const char * | fmt, |
... | |||
) |
This function prints a trace message if a trace function has been declared; see SysProDeclareTraceFunction().
Definition at line 89 of file tracing.c.
References CHKERRQ(), ierr, sysprotrace, and sysprotracectx.
Referenced by adder(), ChooseFirstTransform(), PreprocessedSolution(), ReportEnabledPreprocessors(), ReportSysProCallStackState(), ScreenOutputTab(), ScreenOutputTabLine(), and solvebycopy().
PetscErrorCode SystemPreprocessorGetByName | ( | const char * | , |
SystemPreprocessor * | |||
) |
Definition at line 612 of file preprocess.c.
References CHKERRQ(), ierr, and PreprocessorGetIndex().
Referenced by DeclarePCPreprocessor(), DeclarePreprocessorIntelligentChoice(), DeclarePreprocessorRequiredCategories(), PreprocessedSolution(), PreprocessorGetPreservedCategories(), PreprocessorSetPreservedCategories(), PreprocessorsOptionsHandling(), PreprocessorSpecificSetup(), and TransformGetByName().
PetscErrorCode TabReportActivePreprocessors | ( | const char ** | key, |
const char ** | val, | ||
int | |||
) |
Definition at line 309 of file reporting.c.
References CHKERRQ(), ierr, and TabReportPreprocessors().
PetscErrorCode TabReportAllPreprocessors | ( | const char ** | key, |
int | |||
) |
Definition at line 295 of file reporting.c.
References CHKERRQ(), ierr, and TabReportPreprocessors().
PetscErrorCode TestSuitabilityContext | ( | SalsaTransform | , |
void * | |||
) |
Definition at line 894 of file transform.c.
References CHECKVALIDTRANSFORM0, CHKERRQ(), ierr, and SalsaTransform_::suitabilityctxtester.
Referenced by PreprocessorSpecificSetup(), and SalsaTransformIntegrityTest().