00001 #include <stdlib.h>
00002 #include "anamod.h"
00003 #include "syspro.h"
00004 #include "sysprolinear.h"
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #undef __FUNCT__
00018 #define __FUNCT__ "SysProComputeQuantity"
00019
00020
00021
00022 PetscErrorCode SysProComputeQuantity
00023 (NumericalProblem theproblem,char *cat,char *cmp,
00024 void *res,int *reslen,PetscTruth *flg)
00025 {
00026 LinearSystem problem = (LinearSystem)theproblem;
00027 Mat A;
00028 NMD_metadata nmd;
00029 PetscErrorCode ierr;
00030 PetscFunctionBegin;
00031
00032 ierr = LinearSystemGetParts
00033 (problem,&A,PETSC_NULL,PETSC_NULL,PETSC_NULL,PETSC_NULL); CHKERRQ(ierr);
00034 ierr = ComputeQuantity((void*)A,cat,cmp,(AnalysisItem*)res,reslen,flg); CHKERRQ(ierr);
00035 if (*flg) {
00036 AnalysisDataType type;
00037 ierr = LinearSystemGetMetadata(problem,&nmd); CHKERRQ(ierr);
00038 ierr = GetDataType(cat,cmp,&type); CHKERRQ(ierr);
00039 ierr = NMDSetValue(nmd,cat,cmp,type,res); CHKERRQ(ierr);
00040 }
00041 CHKMEMQ;
00042 PetscFunctionReturn(0);
00043 }
00044
00045 #undef __FUNCT__
00046 #define __FUNCT__ "SysProRetrieveQuantity"
00047
00048
00049
00050
00051 PetscErrorCode SysProRetrieveQuantity
00052 (NumericalProblem theproblem,char *cat,char *cmp,
00053 void *res,int *reslen,PetscTruth *flg)
00054 {
00055 LinearSystem problem = (LinearSystem)theproblem;
00056 PetscErrorCode ierr;
00057 PetscFunctionBegin;
00058
00059 ierr = HasComputeModule(cat,cmp,flg); CHKERRQ(ierr);
00060 if (*flg) {
00061 Mat A;
00062 ierr = LinearSystemGetParts
00063 (problem,&A,PETSC_NULL,PETSC_NULL,PETSC_NULL,PETSC_NULL); CHKERRQ(ierr);
00064 ierr = HasQuantity((void*)A,cat,cmp,flg); CHKERRQ(ierr);
00065 if (*flg) {
00066 ierr = ComputeQuantity((void*)A,cat,cmp,(AnalysisItem*)res,reslen,flg); CHKERRQ(ierr);
00067 }
00068 }
00069 CHKMEMQ;
00070
00071 PetscFunctionReturn(0);
00072 }
00073
00074 #undef __FUNCT__
00075 #define __FUNCT__ "SysProRemoveQuantity"
00076
00077
00078
00079 PetscErrorCode SysProRemoveQuantity
00080 (NumericalProblem theproblem,char *cat,char *cmp,PetscTruth *flg)
00081 {
00082 LinearSystem problem = (LinearSystem)theproblem;
00083 NMD_metadata nmd;
00084 PetscErrorCode ierr;
00085 PetscFunctionBegin;
00086
00087 ierr = LinearSystemGetMetadata(problem,&nmd); CHKERRQ(ierr);
00088 ierr = NMDUnsetValue(nmd,cat,cmp); CHKERRQ(ierr);
00089
00090 CHKMEMQ;
00091 PetscFunctionReturn(0);
00092 }
00093
00094 #undef __FUNCT__
00095 #define __FUNCT__ "SysProFreeQuantities"
00096 PetscErrorCode SysProFreeQuantities(NumericalProblem theproblem)
00097 {
00098 LinearSystem problem = (LinearSystem)theproblem;
00099 NMD_metadata nmd;
00100 PetscErrorCode ierr;
00101 PetscFunctionBegin;
00102 ierr = LinearSystemGetMetadata(problem,&nmd); CHKERRQ(ierr);
00103 ierr = NMDDestroyObject(nmd); CHKERRQ(ierr);
00104 PetscFunctionReturn(0);
00105 }