00001 #ifndef PREPROCESS_H
00002 #define PREPROCESS_H
00003
00004 #include "petscmat.h"
00005
00006 #define TRUTH(x) ( (x) ? PETSC_TRUE : PETSC_FALSE )
00007
00008
00009
00010
00011
00012 typedef struct SystemPreprocessor_* SystemPreprocessor;
00013 typedef struct NumericalProblem_* NumericalProblem;
00014 typedef struct NumericalSolution_* NumericalSolution;
00015 typedef PetscReal SuitabilityValue;
00016
00017 typedef struct SalsaTransform_* SalsaTransform;
00018 typedef struct SalsaTransformObject_* SalsaTransformObject;
00019
00020 extern PetscErrorCode SysProInitialize();
00021 extern PetscErrorCode SysProFinalize();
00022 extern PetscErrorCode DeclarePreprocessor
00023 (char *name,
00024 PetscErrorCode(*global_setup)(),
00025 PetscErrorCode(*specific_setup)(NumericalProblem,SalsaTransform),
00026 PetscErrorCode(*specific_unset)(NumericalProblem),
00027 PetscErrorCode(*global_unset)(),
00028 PetscErrorCode(*ctxcreate)(NumericalProblem,void**),
00029 PetscErrorCode(*ctxdelete)(void*),
00030 PetscErrorCode(*start_function)(char*,int,PetscTruth,NumericalProblem,NumericalProblem*,void*,void**,PetscTruth*),
00031 PetscErrorCode(*end_function)
00032 (char*,PetscTruth,void*,void*,NumericalProblem,NumericalProblem,NumericalSolution,NumericalSolution)
00033 );
00034 extern PetscErrorCode DeclarePreprocessorIntelligentChoice
00035 (char *name,PetscErrorCode(*picker)(NumericalProblem,char**,char**));
00036 extern PetscErrorCode PreprocessorsOptionsHandling();
00037
00038 extern PetscErrorCode SysProDeclareFunctions
00039 (PetscErrorCode(*classstaticsetup)(char*),
00040 PetscErrorCode(*classdynamicsetup)(char*,NumericalProblem),
00041 PetscErrorCode(*classproblemcloner)(char*,char*,int,NumericalProblem,NumericalProblem),
00042 PetscErrorCode(*solver)(NumericalProblem,void*,NumericalSolution*),
00043 PetscErrorCode(*problemdelete)(NumericalProblem),
00044 PetscErrorCode(*solutioncreator)(NumericalProblem,NumericalSolution*),
00045 PetscErrorCode(*solutioncopy)(NumericalSolution,NumericalSolution),
00046 PetscErrorCode(*solutiondelete)(NumericalSolution),
00047 PetscErrorCode(*ctxcloner)(char*,char*,void*,void**),
00048 PetscErrorCode(*ctxfree)(void*),
00049 PetscErrorCode(*solutioncontextdelete)(NumericalSolution)
00050 );
00051
00052 extern PetscErrorCode ProcessPreprocessorOptions(char *processor,void *ctx);
00053
00054 extern PetscErrorCode PreprocessorGetIndex(char*,int*);
00055 extern PetscErrorCode SystemPreprocessorGetByName(char*,SystemPreprocessor*);
00056 extern PetscErrorCode PreprocessorGetSetting(char*,char**,int*);
00057
00058 extern PetscErrorCode RetrievePreprocessorChoice(int,char**,int*);
00059 extern PetscErrorCode GetFirstPreprocessor(char **preprocess);
00060 extern PetscErrorCode GetNextPreprocessor(char **next_one);
00061
00062 extern PetscErrorCode SuccessorPreprocessor(char *,char**);
00063 extern PetscErrorCode InitRetrievingPreprocessors();
00064 extern PetscErrorCode StartRetrievingCurrentPreprocessors(char**,char**,int*,PetscTruth*);
00065 extern PetscErrorCode ContinueRetrievingCurrentPreprocessors(char**,char**,int*,PetscTruth*);
00066 extern PetscErrorCode StartRetrievingAllPreprocessors(char**,char***,int*,PetscTruth*);
00067 extern PetscErrorCode ContinueRetrievingAllPreprocessors(char**,char***,int*,PetscTruth*);
00068 extern PetscErrorCode RetrieveAllPreprocessorValues(char*,char***,int*);
00069
00070 extern PetscErrorCode RegisterPreprocessorContext(char *pre,void *ctx);
00071 extern PetscErrorCode PreprocessorGetContext(char *pre,void **ctx);
00072
00073 extern PetscErrorCode PreprocessedSolution
00074 (char*,NumericalProblem,void*,NumericalSolution*);
00075 extern PetscErrorCode PreprocessedProblemSolving
00076 (NumericalProblem,NumericalSolution*);
00077
00078
00079
00080
00081 extern PetscErrorCode PreprocessorSetPreservedCategories(char*,char*);
00082 extern PetscErrorCode PreprocessorGetPreservedCategories(char*,char**);
00083 extern PetscErrorCode SysProComputeQuantity
00084 (NumericalProblem,char*,char*,void*,int*,PetscTruth*);
00085 extern PetscErrorCode SysProRetrieveQuantity
00086 (NumericalProblem,char*,char*,void*,int*,PetscTruth*);
00087 extern PetscErrorCode SysProRemoveQuantity
00088 (NumericalProblem,char*,char*,PetscTruth*);
00089 extern PetscErrorCode SysProFreeQuantities(NumericalProblem);
00090
00091
00092
00093
00094 extern PetscErrorCode SysProDefaultTrace(void *ctx,char *fmt,va_list argp);
00095 extern PetscErrorCode SysProDeclareTraceFunction
00096 (PetscErrorCode(*fn)(void*,char*,va_list));
00097 extern PetscErrorCode SysProDeclareTraceContext(void *ctx);
00098 extern PetscErrorCode SysProTraceMessage(char *fmt,...);
00099 extern PetscErrorCode SysProHasTrace(PetscTruth *flg);
00100 extern PetscErrorCode SysProDeclareProblemMonitor
00101 (PetscErrorCode(*)(NumericalProblem));
00102 extern PetscErrorCode SysProDeclareErrorTracer
00103 (PetscErrorCode(*)(NumericalProblem,NumericalSolution,char*));
00104 extern PetscErrorCode SysProGetErrorTracer
00105 (PetscErrorCode(**)(NumericalProblem,NumericalSolution,char*));
00106
00107
00108
00109
00110 extern PetscErrorCode TabReportAllPreprocessors(char **key,int);
00111 extern PetscErrorCode TabReportActivePreprocessors(char **key,char **val,int);
00112 extern PetscErrorCode ReportEnabledPreprocessors(char *name);
00113 extern PetscErrorCode ReportSysProCallStackState(char *name);
00114 extern PetscErrorCode ScreenOutputTab(char *key,char *val);
00115 extern PetscErrorCode ScreenOutputTabLine(char *key,char *val);
00116
00117
00118 extern PetscErrorCode NumericalProblemGetComm(NumericalProblem,MPI_Comm*);
00119
00120 #endif