System Preprocessors
syspro.h
Go to the documentation of this file.
00001 #ifndef PREPROCESS_H
00002 #define PREPROCESS_H
00003 
00004 #include "petscksp.h"
00005 #include "petscmat.h"
00006 
00007 #define TRANSFORMCOOKIE 2008
00008 #define CHECKVALIDTRANSFORM(x) {if (!(x)) {printf("Null SalsaTransform"); return 1;} else if ((x)->cookie!=TRANSFORMCOOKIE) {printf("Invalid SalsaTransform"); return 1;}; }
00009 /* ierr = SalsaTransformIntegrityTest(x); CHKERRQ(ierr); */
00010 #define CHECKVALIDTRANSFORM0(x) {if (!(x)) {printf("Null SalsaTransform"); return 1;} else if ((x)->cookie!=TRANSFORMCOOKIE) {printf("Invalid SalsaTransform"); return 1;} }
00011 #define TRANSFORMOBJECTCOOKIE 2009
00012 #define CHECKVALIDTRANSFORMOBJECT(x) {if (!(x)) {printf("Null TransformObject"); return 1;} else if ((x)->cookie!=TRANSFORMOBJECTCOOKIE) {printf("Invalid TransformObject"); return 1;} }
00013 #define TRUTH(x) ( (x) ? PETSC_TRUE : PETSC_FALSE )
00014 
00015 //struct NumericalSolution {
00016 //  void* dummy;
00017 //} ;
00018 
00019 typedef struct SystemPreprocessor_* SystemPreprocessor;
00020 typedef struct NumericalProblem_* NumericalProblem;
00021 typedef struct NumericalSolution_* NumericalSolution;
00022 typedef PetscReal SuitabilityValue;
00023 
00024 typedef struct SalsaTransform_* SalsaTransform;
00025 typedef struct SalsaTransformObject_* SalsaTransformObject;
00026 
00027 extern PetscErrorCode SysProInitialize();
00028 extern PetscErrorCode SysProFinalize();
00029 extern PetscErrorCode DeclarePreprocessor
00030 (const char *name,
00031  PetscErrorCode(*global_setup)(),
00032  PetscErrorCode(*specific_setup)(NumericalProblem,SalsaTransform),
00033  PetscErrorCode(*specific_unset)(NumericalProblem),
00034  PetscErrorCode(*global_unset)(),
00035  PetscErrorCode(*ctxcreate)(NumericalProblem,void**),
00036  PetscErrorCode(*ctxdelete)(void*),
00037  PetscErrorCode(*start_function)(const char*,int,PetscBool,NumericalProblem,NumericalProblem*,void*,void**,PetscBool*),
00038  PetscErrorCode(*end_function) (const char*,PetscBool,void*,void*,NumericalProblem,NumericalProblem,NumericalSolution,NumericalSolution)
00039  );
00040 extern PetscErrorCode DeclarePreprocessorIntelligentChoice
00041 (const char *name,PetscErrorCode(*picker)(NumericalProblem,const char**,const char**));
00042 extern PetscErrorCode PreprocessorsOptionsHandling();
00043 
00044 extern PetscErrorCode SysProDeclareFunctions
00045 (PetscErrorCode(*classstaticsetup)(const char*),
00046  PetscErrorCode(*classdynamicsetup)(const char*,NumericalProblem),
00047  PetscErrorCode(*classproblemcloner)(const char*,const char*,int,NumericalProblem,NumericalProblem),
00048  PetscErrorCode(*solver)(NumericalProblem,void*,NumericalSolution*),
00049  PetscErrorCode(*problemdelete)(NumericalProblem),
00050  PetscErrorCode(*solutioncreator)(NumericalProblem,NumericalSolution*),
00051  PetscErrorCode(*solutioncopy)(NumericalSolution,NumericalSolution),
00052  PetscErrorCode(*solutiondelete)(NumericalSolution),
00053  PetscErrorCode(*ctxcloner)(const char*,const char*,void*,void**),
00054  PetscErrorCode(*ctxfree)(void*),
00055  PetscErrorCode(*solutioncontextdelete)(NumericalSolution)
00056  );
00057 
00058 extern PetscErrorCode ProcessPreprocessorOptions(char *processor,void *ctx);
00059 
00060 extern PetscErrorCode PreprocessorGetIndex(const char*,int*);
00061 extern PetscErrorCode SystemPreprocessorGetByName(const char*,SystemPreprocessor*);
00062 extern PetscErrorCode PreprocessorGetSetting(const char*,const char**,int*);
00063 
00064 extern PetscErrorCode RetrievePreprocessorChoice(int,const char**,int*);
00065 extern PetscErrorCode GetFirstPreprocessor(const char **preprocess);
00066 extern PetscErrorCode GetNextPreprocessor(const char **next_one);
00067 
00068 extern PetscErrorCode SuccessorPreprocessor(const char *,const char**);
00069 extern PetscErrorCode InitRetrievingPreprocessors();
00070 extern PetscErrorCode StartRetrievingCurrentPreprocessors(const char**,const char**,int*,PetscBool*);
00071 extern PetscErrorCode ContinueRetrievingCurrentPreprocessors(const char**,const char**,int*,PetscBool*);
00072 extern PetscErrorCode StartRetrievingAllPreprocessors(const char**,const char***,int*,PetscBool*);
00073 extern PetscErrorCode ContinueRetrievingAllPreprocessors(const char**,const char***,int*,PetscBool*);
00074 extern PetscErrorCode RetrieveAllPreprocessorValues(const char*,const char***,int*);
00075 extern PetscErrorCode SysProShowOptions(MPI_Comm comm);
00076 
00077 extern PetscErrorCode RegisterPreprocessorContext(const char*,void *ctx);
00078 extern PetscErrorCode PreprocessorGetContext(const char*,void **ctx);
00079 
00080 extern PetscErrorCode PreprocessedSolution
00081 (const char*,NumericalProblem,void*,NumericalSolution*);
00082 extern PetscErrorCode PreprocessedProblemSolving
00083 (NumericalProblem,NumericalSolution*);
00084 
00085 /*
00086  * Anamod interface
00087  */
00088 extern PetscErrorCode PreprocessorSetPreservedCategories(const char*,const char*);
00089 extern PetscErrorCode PreprocessorGetPreservedCategories(const char*,const char**);
00090 extern PetscErrorCode SysProComputeQuantity
00091 (NumericalProblem,const char*,const char*,void*,int*,PetscBool*);
00092 extern PetscErrorCode SysProRetrieveQuantity
00093 (NumericalProblem,const char*,const char*,void*,int*,PetscBool*);
00094 extern PetscErrorCode SysProRemoveQuantity
00095 (NumericalProblem,const char*,const char*,PetscBool*);
00096 extern PetscErrorCode SysProFreeQuantities(NumericalProblem);
00097 
00098 /*
00099  * Tracing
00100  */
00101 extern PetscErrorCode SysProDefaultTrace(void*,const char*,va_list);
00102 extern PetscErrorCode SysProDeclareTraceFunction
00103 (PetscErrorCode(*fn)(void*,const char*,va_list));
00104 extern PetscErrorCode SysProDeclareTraceContext(void *ctx);
00105 extern PetscErrorCode SysProTraceMessage(const char *fmt,...);
00106 extern PetscErrorCode SysProHasTrace(PetscBool *flg);
00107 extern PetscErrorCode SysProDeclareProblemMonitor
00108 (PetscErrorCode(*)(NumericalProblem));
00109 extern PetscErrorCode SysProDeclareErrorTracer
00110 (PetscErrorCode(*)(NumericalProblem,NumericalSolution,const char*));
00111 extern PetscErrorCode SysProGetErrorTracer
00112 (PetscErrorCode(**)(NumericalProblem,NumericalSolution,const char*));
00113 
00114 /*
00115  * Output
00116  */
00117 extern PetscErrorCode TabReportAllPreprocessors(const char **key,int);
00118 extern PetscErrorCode TabReportActivePreprocessors(const char **key,const char **val,int);
00119 extern PetscErrorCode ReportEnabledPreprocessors(const char*);
00120 extern PetscErrorCode ReportSysProCallStackState(const char*);
00121 extern PetscErrorCode ScreenOutputTab(const char*,const char*);
00122 extern PetscErrorCode ScreenOutputTabLine(const char*,const char*);
00123 
00124 /* Utility stuff */
00125 extern PetscErrorCode NumericalProblemGetComm(NumericalProblem,MPI_Comm*);
00126 extern PetscErrorCode TestSuitabilityContext(SalsaTransform,void*);
00127 
00128 #endif