SALSA Analysis Modules
|
Prototypes for general module functions. More...
Go to the source code of this file.
Defines | |
#define | ANAMOD_FORMAT_VERSION "1.0" |
#define | MXC 30 |
#define | INC 7 |
#define | TRUTH(x) ( (x) ? PETSC_TRUE : PETSC_FALSE ) |
#define | HASTOEXIST(h) |
#define | ANAMODCHECKVALID(i, c, s) {if (!(i)) SETERRQ(1,"Null pointer"); if ((i)->cookie!=c) SETERRQ1(1,"Not a valid <%s>",s);} |
Typedefs | |
typedef struct categoryobject_ * | categoryobject |
typedef struct componentobject_ * | componentobject |
typedef struct FeatureSet_ * | FeatureSet |
typedef struct FeatureValues_ * | FeatureValues |
Enumerations | |
enum | CatCmpEnableMode { CATCMP_ENABLE, CATCMP_SKIP_FROM_LOOPS, CATCMP_DISABLE } |
Functions | |
PetscErrorCode | AnaModInitialize () |
PetscErrorCode | AnaModFinalize () |
PetscErrorCode | AnaModGetTypeName (int id, const char **name) |
PetscErrorCode | AnaModGetTypeMySQLName (int id, const char **name) |
PetscErrorCode | AllocCategoryObjects () |
PetscErrorCode | FreeCategoryObjects () |
PetscErrorCode | CreateCategoryObject (const char *, categoryobject *) |
PetscErrorCode | DestroyCategoryObject (categoryobject) |
PetscErrorCode | GetCategory (const char *, categoryobject *, PetscTruth *) |
PetscErrorCode | GetOrCreateCategory (const char *, categoryobject *) |
PetscErrorCode | CategoryGetComponentIndex (categoryobject, const char *, int *, PetscTruth *) |
PetscErrorCode | CategoryComponentSetModule (const char *, const char *, AnalysisDataType, int, PetscErrorCode(*)(AnaModNumericalProblem, AnalysisItem *, int *, PetscTruth *)) |
PetscErrorCode | AnaModRegisterStandardModules () |
PetscErrorCode | RegisterModule (const char *, const char *, AnalysisDataType, PetscErrorCode(*f)(AnaModNumericalProblem, AnalysisItem *, int *, PetscTruth *)) |
PetscErrorCode | DeRegisterCategory (const char *cat) |
PetscErrorCode | DeregisterModules (void) |
PetscErrorCode | GetCategories (int *, const char ***) |
PetscErrorCode | CategoryGetModules (const char *, const char ***, AnalysisDataType **, int **, int *) |
PetscErrorCode | HasComputeCategory (const char *, PetscTruth *) |
PetscErrorCode | HasComputeModule (const char *, const char *, PetscTruth *) |
PetscErrorCode | CategoryEnableByName (const char *, int) |
PetscErrorCode | GetFirstCategory (const char **, PetscTruth *) |
PetscErrorCode | GetNextCategory (const char **, PetscTruth *) |
PetscErrorCode | CreateComponentObject (const char *, componentobject *) |
PetscErrorCode | DestroyComponentObject (componentobject) |
PetscErrorCode | CategoryGetOrCreateComponent (categoryobject, const char *, componentobject *) |
PetscErrorCode | CategoryGetComponent (categoryobject, const char *, componentobject *, PetscTruth *) |
PetscErrorCode | ComponentSetModule (componentobject, AnalysisDataType, int, PetscErrorCode(*)(AnaModNumericalProblem, AnalysisItem *, int *, PetscTruth *)) |
PetscErrorCode | ComponentGetType (componentobject, AnalysisDataType *) |
PetscErrorCode | ComponentCompute (componentobject, AnaModNumericalProblem, AnalysisItem *, int *, PetscTruth *) |
PetscErrorCode | ComponentRetrieve (componentobject, AnaModNumericalProblem, AnalysisItem *, int *, PetscTruth *) |
PetscErrorCode | ComponentGetName (componentobject, const char **) |
PetscErrorCode | ComponentGetId (componentobject, int *) |
PetscErrorCode | GetDataID (const char *, const char *, int *, PetscTruth *) |
PetscErrorCode | GetDataType (const char *, const char *, AnalysisDataType *, PetscTruth *) |
PetscErrorCode | ComputeQuantity (AnaModNumericalProblem, const char *, const char *, AnalysisItem *, int *, PetscTruth *) |
PetscErrorCode | ComputeQuantityByID (AnaModNumericalProblem, int, int, AnalysisItem *, int *, PetscTruth *) |
PetscErrorCode | HasQuantity (AnaModNumericalProblem, const char *, const char *, PetscTruth *) |
PetscErrorCode | HasQuantityByID (AnaModNumericalProblem, int, AnalysisDataType, PetscTruth *) |
PetscErrorCode | RetrieveQuantity (AnaModNumericalProblem, const char *, const char *, AnalysisItem *, int *, PetscTruth *) |
PetscErrorCode | RetrieveQuantityByID (AnaModNumericalProblem, int, AnalysisDataType, AnalysisItem *, PetscTruth *) |
PetscErrorCode | QuantityAsString (AnalysisItem *, AnalysisDataType, const char **) |
PetscErrorCode | AnaModOptionsHandling (void) |
PetscErrorCode | AnaModShowOptions (MPI_Comm) |
PetscErrorCode | DeclareCategoryOptionFunction (const char *cat, PetscErrorCode(*f)(char *)) |
PetscErrorCode | CategoryGetOptionFunction (const char *cat, PetscErrorCode(**f)(char *)) |
PetscErrorCode | AnaModHasForcedSequentialComputation (PetscTruth *) |
PetscErrorCode | AnaModHasForcedExpensiveComputation (PetscTruth *) |
PetscErrorCode | AnaModGetSequentialMatrix (Mat A, Mat *Awork, PetscTruth *mem, PetscTruth *local, PetscTruth *global) |
PetscErrorCode | AnaModDeclareTraceFunction (PetscErrorCode(*)(void *, const char *, va_list)) |
PetscErrorCode | AnaModDeclareTraceContext (void *) |
PetscErrorCode | AnaModTraceMessage (const char *fmt,...) |
PetscErrorCode | AnaModHasTrace (PetscTruth *flg) |
PetscErrorCode | AnaModSetTraceArrays (PetscTruth f) |
PetscErrorCode | AnaModTraceArrays (PetscTruth *f) |
PetscErrorCode | TabReportModules (Mat, char **, char **, int) |
PetscErrorCode | PurgeAttachedArrays (Mat A) |
PetscErrorCode | NewFeatureSet (FeatureSet *) |
PetscErrorCode | DeleteFeatureSet (FeatureSet) |
PetscErrorCode | AddToFeatureSet (FeatureSet, const char *, const char *, int *) |
PetscErrorCode | NewFeatureValues (FeatureValues *) |
PetscErrorCode | DeleteFeatureValues (FeatureValues) |
PetscErrorCode | InstantiateFeatureSet (AnaModNumericalProblem, FeatureSet, FeatureValues) |
PetscErrorCode | GetFeatureValue (FeatureValues, int, AnalysisItem *, PetscTruth *) |
PetscErrorCode | AnaModSetRetrievalFunction (PetscErrorCode(*)(void *, char *, char *, AnalysisItem *, AnalysisDataType *, PetscTruth *)) |
PetscErrorCode | AnaModGetRetrievalFunction (PetscErrorCode(**)(void *, char *, char *, AnalysisItem *, AnalysisDataType *, PetscTruth *), PetscTruth *) |
PetscErrorCode | AnaModCheckValidFeatureSet (void *) |
PetscErrorCode | CreateIntArray (const char *, int, IntArray *) |
PetscErrorCode | DeleteIntArray (IntArray) |
PetscErrorCode | IntArrayAdd (IntArray, int, int *) |
PetscErrorCode | IntArraySetAt (IntArray, int, int) |
PetscErrorCode | IntArrayTryGetAt (IntArray, int, int *, PetscTruth *) |
PetscErrorCode | IntArrayGetAt (IntArray, int, int *) |
PetscErrorCode | IntArrayGetFill (IntArray, int *) |
PetscErrorCode | CreateStringArray (const char *, int, StringArray *) |
PetscErrorCode | DeleteStringArray (StringArray) |
PetscErrorCode | StringArrayAdd (StringArray, const char *, int *) |
PetscErrorCode | StringArraySetAt (StringArray, int, const char *) |
PetscErrorCode | StringArrayTryGetAt (StringArray, int, char **, PetscTruth *) |
PetscErrorCode | StringArrayGetAt (StringArray, int, char **) |
PetscErrorCode | StringArrayGetFill (StringArray, int *) |
PetscErrorCode | CreateAnalysisItemArray (const char *, int, AnalysisItemArray *) |
PetscErrorCode | DeleteAnalysisItemArray (AnalysisItemArray) |
PetscErrorCode | AnalysisItemArrayAdd (AnalysisItemArray, AnalysisItem, int *) |
PetscErrorCode | AnalysisItemArraySetAt (AnalysisItemArray, int, AnalysisItem) |
PetscErrorCode | AnalysisItemArrayTryGetAt (AnalysisItemArray, int, AnalysisItem *, PetscTruth *) |
PetscErrorCode | AnalysisItemArrayGetAt (AnalysisItemArray, int, AnalysisItem *) |
PetscErrorCode | CreateAnalysisDataTypeArray (const char *, int, AnalysisDataTypeArray *) |
PetscErrorCode | DeleteAnalysisDataTypeArray (AnalysisDataTypeArray) |
PetscErrorCode | AnalysisDataTypeArrayAdd (AnalysisDataTypeArray, AnalysisDataType, int *) |
PetscErrorCode | AnalysisDataTypeArraySetAt (AnalysisDataTypeArray, int, AnalysisDataType) |
PetscErrorCode | AnalysisDataTypeArrayTryGetAt (AnalysisDataTypeArray, int, AnalysisDataType *, PetscTruth *) |
PetscErrorCode | AnalysisDataTypeArrayGetAt (AnalysisDataTypeArray, int, AnalysisDataType *) |
PetscErrorCode | CategoryLogEventRegister (char *cat, int icat) |
Prototypes for general module functions.
This file defines the functions for defining and querying analysis modules.
Definition in file anamod.h.
#define ANAMOD_FORMAT_VERSION "1.0" |
#define ANAMODCHECKVALID | ( | i, | |
c, | |||
s | |||
) | {if (!(i)) SETERRQ(1,"Null pointer"); if ((i)->cookie!=c) SETERRQ1(1,"Not a valid <%s>",s);} |
#define HASTOEXIST | ( | h | ) |
if (!h) { \ printf("ERROR asking for unknown module\n"); \ PetscFunctionReturn(1); \ }
Definition at line 18 of file anamod.h.
Referenced by AvgDiagDist(), AvgDistFromDiag(), AvgNnzpRow(), BlockSize(), ColourOffsets(), Colours(), ColourSizes(), ColVariability(), Commutator(), compute_dd(), compute_dummy_rows(), compute_eigenvalues(), compute_ellipse_from_Ritz_values(), compute_icm_splits(), compute_nnz_structure(), compute_posdiag(), compute_singularvalues(), compute_tracea2(), ComputeDiagonal(), computennz(), computetrace(), ComputeVariability(), Departure(), DepartureLee95(), DepartureLee96L(), DepartureLee96U(), DepartureRuhe75(), DiagDefinite(), DiagonalAverage(), DiagonalDominance(), DiagonalSign(), DiagonalVariance(), DiagZeroStart(), DummyRows(), DummyRowsKind(), eigenvaluecomp(), Kappa(), LBandWidth(), Lee95bounds(), Lee96bounds(), LeftSkyline(), LoBand(), MatCommutatorNormF(), MatSymmPartNormInf(), MaxEVbyImIm(), MaxEVbyImRe(), MaxEVbyMagIm(), MaxEVbyMagRe(), MaxEVbyRealIm(), MaxEVbyRealRe(), MaxNNonZerosPerRow(), MinEVbyMagIm(), MinEVbyMagRe(), MinNNonZerosPerRow(), NColours(), NDiags(), NDummyRows(), NNonZeros(), Nnz(), NnzDia(), NnzLow(), NnzUp(), norm1(), normF(), normInf(), NRitzValues(), nRows(), NSplits(), NUnstruct(), PosFraction(), RBandWidth(), regularblocks(), RelSymm(), RightSkyline(), RitzValuesC(), RitzValuesR(), RowVariability(), SigmaDiagDist(), SigmaMax(), SigmaMin(), SpectrumAX(), SpectrumAY(), SpectrumCX(), SpectrumCY(), Splits(), Symmetry(), SymmetryANorm(), SymmetryFANorm(), SymmetryFSNorm(), SymmetrySNorm(), Trace(), TraceA2(), TraceAbs(), UpBand(), and Version().
#define MXC 30 |
Definition at line 11 of file anamod.h.
Referenced by AllocCategoryObjects(), and CreateCategoryObject().
#define TRUTH | ( | x | ) | ( (x) ? PETSC_TRUE : PETSC_FALSE ) |
Definition at line 17 of file anamod.h.
Referenced by GetUpBiDiagSplits().
typedef struct categoryobject_* categoryobject |
typedef struct componentobject_* componentobject |
typedef struct FeatureSet_* FeatureSet |
typedef struct FeatureValues_* FeatureValues |
enum CatCmpEnableMode |
PetscErrorCode AddToFeatureSet | ( | FeatureSet | set, |
const char * | cat, | ||
const char * | cmp, | ||
int * | idx | ||
) |
Add a requested feature to a featureset object. See Feature sets
Arguments:
set
: the featuresetcat
,cmp : the category and component name. It is an error to supply unknown namesidx
: the index under which the feature is known in this featureset. This index can be supplied to GetFeatureValue(). This parameter can be null. Definition at line 115 of file feature.c.
References CHECKVALIDFSET, name, and StringArrayAdd().
{ PetscErrorCode ierr; char *name; int l1,l2; PetscFunctionBegin; CHECKVALIDFSET(set); l1 = strlen(cat); l2 = strlen(cmp); ierr = PetscMalloc((l1+l2+1)*sizeof(char),&name); CHKERRQ(ierr); sprintf(name,"%s/%s",cat,cmp); ierr = StringArrayAdd(set->features,name,idx); CHKERRQ(ierr); ierr = PetscFree(name); CHKERRQ(ierr); PetscFunctionReturn(0); }
PetscErrorCode AllocCategoryObjects | ( | ) |
Definition at line 26 of file category.c.
References categorynames, maxcategories, MXC, and ncategories.
Referenced by AnaModInitialize().
{ PetscErrorCode ierr; PetscFunctionBegin; maxcategories = MXC; ncategories = 0; ierr = PetscMalloc (maxcategories*sizeof(categoryobject),&categoryobjects); CHKERRQ(ierr); ierr = PetscMalloc (maxcategories*sizeof(char*),&categorynames); CHKERRQ(ierr); PetscFunctionReturn(0); }
PetscErrorCode AnalysisDataTypeArrayAdd | ( | AnalysisDataTypeArray | array, |
AnalysisDataType | val, | ||
int * | idx | ||
) |
Add a new value and return the index. Right now we do not yet dynamically reallocate the array if there is no more space.
Definition at line 372 of file anamodutils.c.
References AnalysisDataTypeArray_::alloc, AnalysisDataTypeArray_::data, AnalysisDataTypeArray_::fill, and AnalysisDataTypeArray_::has.
PetscErrorCode AnalysisDataTypeArrayGetAt | ( | AnalysisDataTypeArray | array, |
int | idx, | ||
AnalysisDataType * | val | ||
) |
As AnalysisDataTypeArrayTryGetAt(), except that it is an error to ask for an index where no value has been set.
Definition at line 424 of file anamodutils.c.
References AnalysisDataTypeArray_::alloc, AnalysisDataTypeArray_::data, and AnalysisDataTypeArray_::has.
PetscErrorCode AnalysisDataTypeArraySetAt | ( | AnalysisDataTypeArray | array, |
int | idx, | ||
AnalysisDataType | val | ||
) |
Set a value at a given index. Right now we do not yet dynamically reallocate the array if the index is out of bound.
Definition at line 388 of file anamodutils.c.
References AnalysisDataTypeArray_::alloc, AnalysisDataTypeArray_::data, AnalysisDataTypeArray_::fill, and AnalysisDataTypeArray_::has.
Referenced by InstantiateFeatureSet().
PetscErrorCode AnalysisDataTypeArrayTryGetAt | ( | AnalysisDataTypeArray | array, |
int | idx, | ||
AnalysisDataType * | val, | ||
PetscTruth * | has | ||
) |
Retrieve data from a given index.
Arguments:
array
: the AnalysisDataTypeArray objectidx
: the index; it is an error to ask out of bounds, but not to ask beyond the highest position filled; in that case failure will be reportedval
(output) : the value retrieved. This argument is allowed to be null.has
(output) : true if a value was stored at this index. This argument is allowed to be null. Definition at line 410 of file anamodutils.c.
References AnalysisDataTypeArray_::alloc, AnalysisDataTypeArray_::data, and AnalysisDataTypeArray_::has.
PetscErrorCode AnalysisItemArrayAdd | ( | AnalysisItemArray | array, |
AnalysisItem | val, | ||
int * | idx | ||
) |
Add a new value and return the index. Right now we do not yet dynamically reallocate the array if there is no more space.
Definition at line 267 of file anamodutils.c.
References AnalysisItemArray_::alloc, AnalysisItemArray_::data, AnalysisItemArray_::fill, and AnalysisItemArray_::has.
PetscErrorCode AnalysisItemArrayGetAt | ( | AnalysisItemArray | array, |
int | idx, | ||
AnalysisItem * | val | ||
) |
As AnalysisItemArrayTryGetAt(), except that it is an error to ask for an index where no value has been set.
Definition at line 319 of file anamodutils.c.
References AnalysisItemArray_::alloc, AnalysisItemArray_::data, and AnalysisItemArray_::has.
PetscErrorCode AnalysisItemArraySetAt | ( | AnalysisItemArray | array, |
int | idx, | ||
AnalysisItem | val | ||
) |
Set a value at a given index. Right now we do not yet dynamically reallocate the array if the index is out of bound.
Definition at line 283 of file anamodutils.c.
References AnalysisItemArray_::alloc, AnalysisItemArray_::data, AnalysisItemArray_::fill, and AnalysisItemArray_::has.
Referenced by InstantiateFeatureSet().
PetscErrorCode AnalysisItemArrayTryGetAt | ( | AnalysisItemArray | array, |
int | idx, | ||
AnalysisItem * | val, | ||
PetscTruth * | has | ||
) |
Retrieve data from a given index.
Arguments:
array
: the AnalysisItemArray objectidx
: the index; it is an error to ask out of bounds, but not to ask beyond the highest position filled; in that case failure will be reportedval
(output) : the value retrieved. This argument is allowed to be null.has
(output) : true if a value was stored at this index. This argument is allowed to be null. Definition at line 305 of file anamodutils.c.
References AnalysisItemArray_::alloc, AnalysisItemArray_::data, and AnalysisItemArray_::has.
Referenced by GetFeatureValue().
PetscErrorCode AnaModCheckValidFeatureSet | ( | void * | ) |
Definition at line 242 of file feature.c.
References CHECKVALIDFSET.
{ PetscFunctionBegin; CHECKVALIDFSET((FeatureSet)f); PetscFunctionReturn(0); }
PetscErrorCode AnaModDeclareTraceContext | ( | void * | ) |
Definition at line 69 of file tracing.c.
References anamodtracectx.
{ PetscFunctionBegin; anamodtracectx = (size_t)ctx; PetscFunctionReturn(0); }
PetscErrorCode AnaModDeclareTraceFunction | ( | 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 AnaModDeclareTraceContext().
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.
You can undeclare a trace function by passing NULL.
Definition at line 56 of file tracing.c.
References anamodtrace.
{ PetscFunctionBegin; anamodtrace = fn; PetscFunctionReturn(0); }
PetscErrorCode AnaModFinalize | ( | ) |
Finalization for AnaMod. See also AnaModInitialize()
Definition at line 318 of file module_functions.c.
References FreeCategoryObjects().
Referenced by main().
{ PetscErrorCode ierr; PetscFunctionBegin; ierr = FreeCategoryObjects(); CHKERRQ(ierr); PetscFunctionReturn(0); }
PetscErrorCode AnaModGetRetrievalFunction | ( | PetscErrorCode(**)(void *, char *, char *, AnalysisItem *, AnalysisDataType *, PetscTruth *) | , |
PetscTruth * | |||
) |
PetscErrorCode AnaModGetSequentialMatrix | ( | Mat | A, |
Mat * | Awork, | ||
PetscTruth * | mem, | ||
PetscTruth * | local, | ||
PetscTruth * | global | ||
) |
Collect the matrix on processor zero.
There is an implicit assumption here that processor zero is the one that will do the actual work.
Argument:
A
: input matrixAwork
: pointer to the sequential matrix, this can be a pointer to the original matrix if it was already sequential; it is NULL if no forced sequential computation is asked (see Commandline options)mem
: true if Awork
is newly allocatedlocal
: true if this processor needs to do the workglobal
: true if any processor does work; this condition is false in the case of a distributed matrix and no forced sequential operation Definition at line 192 of file options.c.
References AnaModHasForcedSequentialComputation().
Referenced by compute_tracea2(), MatCommutatorNormF(), and MatSymmPartNormInf().
{ MPI_Comm comm; const MatType type; int mytid; PetscTruth flg; PetscErrorCode ierr; PetscFunctionBegin; ierr = PetscObjectGetComm((PetscObject)A,&comm); CHKERRQ(ierr); MPI_Comm_rank(comm,&mytid); ierr = MatGetType(A,&type); CHKERRQ(ierr); ierr = PetscStrcmp(type,MATSEQAIJ,&flg); CHKERRQ(ierr); if (flg) { *Awork = A; *mem = PETSC_FALSE; *local = PETSC_TRUE; *global = PETSC_TRUE; } else { ierr = AnaModHasForcedSequentialComputation(&flg); CHKERRQ(ierr); if (!flg) { *Awork = NULL; *mem = PETSC_FALSE; *local = PETSC_FALSE; *global = PETSC_FALSE; PetscFunctionReturn(0); } *global = PETSC_TRUE; { Mat *Arow; IS is[1]; int N,M; ierr = MatGetSize(A,&M,&N); CHKERRQ(ierr); if (mytid==0) { ierr = ISCreateStride(MPI_COMM_SELF,M,0,1,is); CHKERRQ(ierr); *local = PETSC_TRUE; } else { ierr = ISCreateStride(MPI_COMM_SELF,0,0,1,is); CHKERRQ(ierr); *local = PETSC_FALSE; } ierr = MatGetSubMatrices (A,1,is,is,MAT_INITIAL_MATRIX,&Arow); CHKERRQ(ierr); ierr = ISDestroy(is[0]); CHKERRQ(ierr); *Awork = Arow[0]; *mem = PETSC_TRUE; } } PetscFunctionReturn(0); }
PetscErrorCode AnaModGetTypeMySQLName | ( | int | id, |
const char ** | name | ||
) |
Definition at line 344 of file module_functions.c.
References AnaModIsInitialized, anamodtypenames, mysqlname, and nAnaModTypeNames.
Referenced by main().
{ int i; PetscFunctionBegin; if (AnaModIsInitialized<1) SETERRQ(1,"AnaMod has not been not formally initialized.\nInsert a call to AnaModInitialize() in your code"); for (i=0; i<nAnaModTypeNames; i++) { if (id==anamodtypenames[i].id) { *name = (char*)anamodtypenames[i].mysqlname; goto exit; } } SETERRQ1(1,"Unknown AnaMod datatype %d",id); exit: PetscFunctionReturn(0); }
PetscErrorCode AnaModGetTypeName | ( | int | id, |
const char ** | name | ||
) |
Definition at line 328 of file module_functions.c.
References anamodtypenames, and nAnaModTypeNames.
{ int i; PetscFunctionBegin; for (i=0; i<nAnaModTypeNames; i++) { if (id==anamodtypenames[i].id) { *name = (char*)anamodtypenames[i].name; goto exit; } } SETERRQ1(1,"Unknown AnaMod datatype %d",id); exit: PetscFunctionReturn(0); }
PetscErrorCode AnaModHasForcedExpensiveComputation | ( | PetscTruth * | flg | ) |
Query whether certain expensive operations should be done regardless the cost.
Definition at line 238 of file options.c.
References expensive.
Referenced by MatCommutatorNormF_seq().
{ PetscFunctionBegin; *flg = expensive; PetscFunctionReturn(0); }
PetscErrorCode AnaModHasForcedSequentialComputation | ( | PetscTruth * | flg | ) |
Query whether parallel modules should be done on processor zero.
Definition at line 165 of file options.c.
References single_proc.
Referenced by AnaModGetSequentialMatrix().
{ PetscFunctionBegin; *flg = single_proc; PetscFunctionReturn(0); }
PetscErrorCode AnaModHasTrace | ( | PetscTruth * | flg | ) |
Test whether a trace function has been declared; see AnaModDeclareTraceFunction(). Normally you would use AnaModTraceMessage() 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 127 of file tracing.c.
References anamodtrace.
Referenced by ComputeOrRetrieveQuantity().
{ PetscFunctionBegin; if (anamodtrace) *flg = PETSC_TRUE; else *flg = PETSC_FALSE; PetscFunctionReturn(0); }
PetscErrorCode AnaModInitialize | ( | ) |
Initializatin for AnaMod. See also AnaModFinalize()
Definition at line 284 of file module_functions.c.
References AllocCategoryObjects(), AnaModIsInitialized, anamodtypenames, and nAnaModTypeNames.
Referenced by main().
{ PetscErrorCode ierr; PetscFunctionBegin; ierr = AllocCategoryObjects(); CHKERRQ(ierr); anamodtypenames[0].id = NMDString; anamodtypenames[0].name="string"; anamodtypenames[0].mysqlname="VARCHAR(256)"; anamodtypenames[1].id = NMDInt; anamodtypenames[1].name="int"; anamodtypenames[1].mysqlname="INTEGER"; anamodtypenames[2].id = NMDReal; anamodtypenames[2].name="real"; anamodtypenames[2].mysqlname="DOUBLE"; anamodtypenames[3].id = NMDIntarray; anamodtypenames[3].name="intarray"; anamodtypenames[3].mysqlname="VARCHAR(1024)"; anamodtypenames[4].id = NMDRealarray; anamodtypenames[4].name="realarray"; anamodtypenames[4].mysqlname="VARCHAR(1024)"; AnaModIsInitialized = 1; nAnaModTypeNames = 5; PetscFunctionReturn(0); }
PetscErrorCode AnaModOptionsHandling | ( | void | ) |
Process any commandline options that were given for AnaMod. These use the regular Petsc commandline options database.
This routine handles general options and module-specific options, so it has to be called after all modules have been declared.
See DeclareCategoryOptionFunction(),CategoryGetOptionFunction(), AnaModOptionsHandling() and section Commandline options.
Definition at line 60 of file options.c.
References CATCMP_SKIP_FROM_LOOPS, CategoryEnableByName(), CategoryGetOptionFunction(), expensive, GetCategories(), single_proc, and VALUELEN.
Referenced by main().
{ PetscTruth flg; PetscErrorCode ierr; char *value; PetscFunctionBegin; #define VALUELEN 150 ierr = PetscMalloc(VALUELEN*sizeof(char),&value); CHKERRQ(ierr); { ierr = PetscOptionsHasName(PETSC_NULL,"-anamod_force",&flg); CHKERRQ(ierr); if (flg) { ierr = PetscOptionsGetString (PETSC_NULL,"-anamod_force",value,VALUELEN,&flg); CHKERRQ(ierr); if (flg) { char *c; c = strtok(value,","); while (c) { ierr = PetscStrcmp(c,"sequential",&flg); CHKERRQ(ierr); if (flg) single_proc = PETSC_TRUE; ierr = PetscStrcmp(c,"expensive",&flg); CHKERRQ(ierr); if (flg) expensive = PETSC_TRUE; c = strtok(NULL,","); } } } } { const char **categories; char *option; int icat,ncats; ierr = PetscMalloc(30*sizeof(char),&option); CHKERRQ(ierr); ierr = GetCategories(&ncats,&categories); CHKERRQ(ierr); for (icat=0; icat<ncats; icat++) { ierr = PetscMemzero(value,VALUELEN*sizeof(char)); CHKERRQ(ierr); ierr = PetscMemzero(option,30*sizeof(char)); CHKERRQ(ierr); sprintf(option,"-anamod_%s",categories[icat]); ierr = PetscOptionsGetString (PETSC_NULL,option,value,VALUELEN,&flg); CHKERRQ(ierr); if (flg) { PetscErrorCode (*f)(char*); ierr = CategoryGetOptionFunction(categories[icat],&f); CHKERRQ(ierr); if (f) { ierr = (*f)(value); CHKERRQ(ierr); } } } ierr = PetscFree(option); CHKERRQ(ierr); } { ierr = PetscOptionsGetString (PETSC_NULL,"-anamod_use_only",value,VALUELEN,&flg); CHKERRQ(ierr); if (flg) { int ncats,icat; const char **cats; ierr = GetCategories(&ncats,&cats); CHKERRQ(ierr); for (icat=0; icat<ncats; icat++) { if (strcmp(value,cats[icat])) { ierr = CategoryEnableByName (cats[icat],CATCMP_SKIP_FROM_LOOPS); CHKERRQ(ierr); } } } } ierr = PetscFree(value); CHKERRQ(ierr); PetscFunctionReturn(0); }
PetscErrorCode AnaModRegisterStandardModules | ( | ) |
Register all standard and nonstandard analysis modules.
Definition at line 47 of file anamodsalsa.c.
References RegisterIprsModules(), RegisterJPLModules(), RegisterLapackModules(), RegisterNormalityModules(), RegisterSimpleModules(), RegisterSpectrumModules(), RegisterStructureModules(), and RegisterVarianceModules().
{ PetscErrorCode ierr; PetscFunctionBegin; /* standard set */ ierr = RegisterSimpleModules(); CHKERRQ(ierr); ierr = RegisterVarianceModules(); CHKERRQ(ierr); ierr = RegisterStructureModules(); CHKERRQ(ierr); ierr = RegisterSpectrumModules(); CHKERRQ(ierr); ierr = RegisterNormalityModules(); CHKERRQ(ierr); CHKMEMQ; /* UKY iprs set */ ierr = RegisterIprsModules(); CHKERRQ(ierr); /* Eijkhout's ICMK */ /*ierr = RegisterICMKModules(); CHKERRQ(ierr);*/ #if defined(HAVE_LAPACK) /* Lapack eigenvalue calculations */ ierr = RegisterLapackModules(); CHKERRQ(ierr); #endif /* Jones/Plassmann multi-colouring */ ierr = RegisterJPLModules(); CHKERRQ(ierr); CHKMEMQ; PetscFunctionReturn(0); }
PetscErrorCode AnaModSetRetrievalFunction | ( | PetscErrorCode(*)(void *, char *, char *, AnalysisItem *, AnalysisDataType *, PetscTruth *) | ) |
PetscErrorCode AnaModSetTraceArrays | ( | PetscTruth | f | ) |
Definition at line 82 of file tracing.c.
References anamodtracearrays.
{ PetscFunctionBegin; anamodtracearrays = f; PetscFunctionReturn(0); }
PetscErrorCode AnaModShowOptions | ( | MPI_Comm | comm | ) |
Display all available options. This depends on the installed modules, so you need to do the various register calls first. See Use of the analysis modules.
For options see Commandline options.
Definition at line 136 of file options.c.
References GetCategories().
{ PetscErrorCode ierr; PetscFunctionBegin; PetscPrintf(comm,"Available AnaMod options\n Global:\n"); PetscPrintf(comm," -anamod_use_only mod : use only the specified module\n"); PetscPrintf(comm," -anamod_force sequential : do sequential computations\n even in parallel runs\n"); PetscPrintf(comm," -anamod_force expensive : do certain calculations no matter how expensive\n"); PetscPrintf(comm,"\n Categories and modules:\n"); { const char **categories; char *option; int icat,ncats; ierr = PetscMalloc(30*sizeof(char),&option); CHKERRQ(ierr); ierr = GetCategories(&ncats,&categories); CHKERRQ(ierr); for (icat=0; icat<ncats; icat++) { ierr = PetscMemzero(option,30*sizeof(char)); CHKERRQ(ierr); PetscPrintf (comm," -anamod_%s : options for category %s\n", categories[icat],categories[icat]); } ierr = PetscFree(option); CHKERRQ(ierr); } PetscFunctionReturn(0); }
PetscErrorCode AnaModTraceArrays | ( | PetscTruth * | f | ) |
Definition at line 95 of file tracing.c.
References anamodtracearrays.
Referenced by ComputeOrRetrieveQuantity(), and ReportAnamodContent().
{ PetscFunctionBegin; *f = anamodtracearrays; PetscFunctionReturn(0); }
PetscErrorCode AnaModTraceMessage | ( | const char * | fmt, |
... | |||
) |
This function prints a trace message if a trace function has been declared; see AnaModDeclareTraceFunction().
Definition at line 107 of file tracing.c.
References anamodtrace, and anamodtracectx.
Referenced by compute_eigenvalues_petsc(), and ComputeOrRetrieveQuantity().
{ va_list argp; PetscErrorCode ierr; PetscFunctionBegin; if (anamodtrace) { va_start(argp, fmt); ierr = (*anamodtrace)((void*)anamodtracectx,(char*)fmt,argp); CHKERRQ(ierr); va_end(argp); } PetscFunctionReturn(0); }
PetscErrorCode CategoryComponentSetModule | ( | const char * | , |
const char * | , | ||
AnalysisDataType | , | ||
int | , | ||
PetscErrorCode(*)(AnaModNumericalProblem, AnalysisItem *, int *, PetscTruth *) | |||
) |
Definition at line 226 of file category.c.
References CategoryGetComponentIndex(), CategoryGetOrCreateComponent(), ComponentSetModule(), GetOrCreateCategory(), and categoryobject_::types.
Referenced by RegisterModule().
{ categoryobject catg; componentobject cmpt; int icmp; PetscErrorCode ierr; PetscFunctionBegin; ierr = GetOrCreateCategory(cat,&catg); CHKERRQ(ierr); ierr = CategoryGetOrCreateComponent(catg,cmp,&cmpt); CHKERRQ(ierr); ierr = ComponentSetModule(cmpt,type,id,f); CHKERRQ(ierr); ierr = CategoryGetComponentIndex(catg,cmp,&icmp,PETSC_NULL); CHKERRQ(ierr); catg->types[icmp] = type; PetscFunctionReturn(0); }
PetscErrorCode CategoryEnableByName | ( | const char * | cat, |
int | mode | ||
) |
Mark a category as enabled/disabled. Values (CatCmpEnableMode):
Definition at line 317 of file category.c.
References categoryobject_::enabled, name, and ncategories.
Referenced by AnaModOptionsHandling().
{ int icat; PetscFunctionBegin; for (icat=0; icat<ncategories; icat++) { if (!strcmp(cat,categoryobjects[icat]->name)) { categoryobjects[icat]->enabled = mode; } } PetscFunctionReturn(0); }
PetscErrorCode CategoryGetComponent | ( | categoryobject | catg, |
const char * | cmp, | ||
componentobject * | cmpt, | ||
PetscTruth * | success | ||
) |
Retrieve a component.
See also CategoryGetOrCreateComponent(), CategoryGetComponentIndex().
Definition at line 209 of file category.c.
References CategoryGetComponentIndex(), CHECKVALIDCATEGORY, and categoryobject_::components.
Referenced by ComputeOrRetrieveQuantity(), GetDataID(), GetDataType(), HasComputeModule(), and HasQuantity().
{ int icmp; PetscTruth flg; PetscErrorCode ierr; PetscFunctionBegin; CHECKVALIDCATEGORY(catg); ierr = CategoryGetComponentIndex(catg,cmp,&icmp,&flg); CHKERRQ(ierr); if (success) *success = flg; if (flg) { if (cmpt) *cmpt = catg->components[icmp]; } else if (!success) SETERRQ(1,"Component not found but no flag given to report this"); PetscFunctionReturn(0); }
PetscErrorCode CategoryGetComponentIndex | ( | categoryobject | catg, |
const char * | cmp, | ||
int * | icmp, | ||
PetscTruth * | flag | ||
) |
Test for presence of a component in a category, and return its index if present. The index parameter can be null.
Definition at line 164 of file category.c.
References CHECKVALIDCATEGORY, categoryobject_::componentnames, and categoryobject_::ncomponents.
Referenced by CategoryComponentSetModule(), CategoryGetComponent(), and CategoryGetOrCreateComponent().
{ int i; PetscTruth flg; PetscErrorCode ierr; PetscFunctionBegin; CHECKVALIDCATEGORY(catg); flg = PETSC_FALSE; for (i=0; i<catg->ncomponents; i++) { ierr = PetscStrcmp(cmp,catg->componentnames[i],&flg); CHKERRQ(ierr); if (flg) {if (icmp) *icmp = i; goto found;} } found: if (flag) *flag = flg; if (!flg && !flag) SETERRQ(1,"Component not found but no flag to return this info"); PetscFunctionReturn(0); }
PetscErrorCode CategoryGetModules | ( | const char * | cat, |
const char *** | ms, | ||
AnalysisDataType ** | t, | ||
int ** | id, | ||
int * | n | ||
) |
Query the modules in a specified category.
The category name has to exist. The routine will call the Petsc error handler if the name is invalid.
Parameters:
cat
: the category that is being queriedms
(optional) : the names of the modules in the categoryt
(optional) : the corresponding list of datatypesid
(optional) : the list of module IDs (see RetrieveQuantityByID())n
(optional) : the number of modules in the categorySee also GetCategories() and HasComputeCategory().
Definition at line 256 of file category.c.
References categoryobject_::componentnames, GetCategory(), categoryobject_::ncomponents, and categoryobject_::types.
Referenced by analyze_matrix(), main(), and ReportAnamodContent().
{ categoryobject catg; PetscTruth flg; PetscErrorCode ierr; PetscFunctionBegin; ierr = GetCategory(cat,&catg,&flg); CHKERRQ(ierr); if (!flg) SETERRQ1(1,"Unknown category <%s>",cat); if (ms) *ms = catg->componentnames; if (t) *t = catg->types; if (n) *n = catg->ncomponents; // if (id) *id = ids[i]; PetscFunctionReturn(0); }
PetscErrorCode CategoryGetOptionFunction | ( | const char * | cat, |
PetscErrorCode(**)(char *) | f | ||
) |
This function is called in AnaModOptionsHandling(). There is probably no reason for the user ever to call it.
See DeclareCategoryOptionFunction(),GetCategoryOptionFunction(), AnaModOptionsHandling() and section optionsfile.
Definition at line 358 of file category.c.
References GetCategory(), and categoryobject_::optionfunction.
Referenced by AnaModOptionsHandling().
{ PetscTruth flg; categoryobject catg; PetscErrorCode ierr; PetscFunctionBegin; ierr = GetCategory(cat,&catg,&flg); CHKERRQ(ierr); if (flg) { *f = catg->optionfunction; } else *f = NULL; PetscFunctionReturn(0); }
PetscErrorCode CategoryGetOrCreateComponent | ( | categoryobject | , |
const char * | , | ||
componentobject * | |||
) |
Definition at line 184 of file category.c.
References CategoryGetComponentIndex(), CHECKVALIDCATEGORY, ComponentGetName(), categoryobject_::componentnames, categoryobject_::components, CreateComponentObject(), categoryobject_::maxcomponents, and categoryobject_::ncomponents.
Referenced by CategoryComponentSetModule().
{ int icmp; PetscTruth flg; PetscErrorCode ierr; PetscFunctionBegin; CHECKVALIDCATEGORY(catg); ierr = CategoryGetComponentIndex(catg,cmp,&icmp,&flg); CHKERRQ(ierr); if (!flg) { icmp = catg->ncomponents++; if (icmp>=catg->maxcomponents) SETERRQ(1,"Component reallocation not implemented"); ierr = CreateComponentObject(cmp,&(catg->components[icmp])); CHKERRQ(ierr); ierr = ComponentGetName (catg->components[icmp],&(catg->componentnames[icmp])); CHKERRQ(ierr); } *cmpt = catg->components[icmp]; PetscFunctionReturn(0); }
PetscErrorCode CategoryLogEventRegister | ( | char * | cat, |
int | icat | ||
) |
Definition at line 20 of file logging.c.
{ PetscLogEvent catevent; PetscCookie cookie; PetscErrorCode ierr; PetscFunctionBegin; ierr = PetscCookieRegister("Anamod events",&cookie); CHKERRQ(ierr); ierr = PetscLogEventRegister(cat,cookie,&catevent); CHKERRQ(ierr); // catevents[icat] = catevent; PetscFunctionReturn(0); }
PetscErrorCode ComponentCompute | ( | componentobject | , |
AnaModNumericalProblem | , | ||
AnalysisItem * | , | ||
int * | , | ||
PetscTruth * | |||
) |
Definition at line 57 of file component.c.
References CHECKVALIDCOMPONENT, componentobject_::hasval, and componentobject_::module.
Referenced by ComputeOrRetrieveQuantity().
{ PetscErrorCode ierr; PetscFunctionBegin; CHECKVALIDCOMPONENT(cmpt); if (!cmpt->module) *success = PETSC_FALSE; else { ierr = (cmpt->module)(prob,res,reslen,success); CHKERRQ(ierr); } cmpt->hasval = *success; PetscFunctionReturn(0); }
PetscErrorCode ComponentGetId | ( | componentobject | , |
int * | |||
) |
Definition at line 139 of file component.c.
References CHECKVALIDCOMPONENT, and componentobject_::dataid.
Referenced by GetDataID(), and HasQuantity().
{ PetscFunctionBegin; CHECKVALIDCOMPONENT(cmpt); *id = cmpt->dataid; PetscFunctionReturn(0); }
PetscErrorCode ComponentGetName | ( | componentobject | , |
const char ** | |||
) |
Definition at line 129 of file component.c.
References CHECKVALIDCOMPONENT, and componentobject_::name.
Referenced by CategoryGetOrCreateComponent().
{ PetscFunctionBegin; CHECKVALIDCOMPONENT(cmpt); *name = cmpt->name; PetscFunctionReturn(0); }
PetscErrorCode ComponentGetType | ( | componentobject | , |
AnalysisDataType * | |||
) |
Definition at line 119 of file component.c.
References CHECKVALIDCOMPONENT, and componentobject_::type.
Referenced by ComputeOrRetrieveQuantity(), GetDataType(), and HasQuantity().
{ PetscFunctionBegin; CHECKVALIDCOMPONENT(cmpt); *t = cmpt->type; PetscFunctionReturn(0); }
PetscErrorCode ComponentRetrieve | ( | componentobject | , |
AnaModNumericalProblem | , | ||
AnalysisItem * | , | ||
int * | , | ||
PetscTruth * | |||
) |
Definition at line 75 of file component.c.
References ANALYSISDBLARRAY, ANALYSISDOUBLE, ANALYSISINTARRAY, ANALYSISINTEGER, CHECKVALIDCOMPONENT, componentobject_::dataid, AnalysisItem::i, AnalysisItem::ii, AnalysisItem::r, AnalysisItem::rr, and componentobject_::type.
Referenced by ComputeOrRetrieveQuantity().
{ PetscTruth flg; PetscErrorCode ierr; PetscFunctionBegin; CHECKVALIDCOMPONENT(cmpt); *success = PETSC_FALSE; switch (cmpt->type) { case ANALYSISINTEGER : { int ir; ierr = PetscObjectComposedDataGetInt ((PetscObject)prob,cmpt->dataid,ir,flg); CHKERRQ(ierr); res->i = ir; *success = flg; break;} case ANALYSISDOUBLE : { PetscReal rr; ierr = PetscObjectComposedDataGetReal ((PetscObject)prob,cmpt->dataid,rr,flg); CHKERRQ(ierr); res->r = rr; *success = flg; break;} case ANALYSISINTARRAY : { int *iir; ierr = PetscObjectComposedDataGetIntstar ((PetscObject)prob,cmpt->dataid,iir,flg); CHKERRQ(ierr); res->ii = iir; *success = flg; ierr = PetscObjectComposedDataGetInt ((PetscObject)prob,cmpt->dataid,*reslen,flg); CHKERRQ(ierr); break;} case ANALYSISDBLARRAY : { PetscReal *rrr; ierr = PetscObjectComposedDataGetRealstar ((PetscObject)prob,cmpt->dataid,rrr,flg); CHKERRQ(ierr); res->rr = rrr; *success = flg; ierr = PetscObjectComposedDataGetInt ((PetscObject)prob,cmpt->dataid,*reslen,flg); CHKERRQ(ierr); break;} default : SETERRQ(1,"Can not retrieve array data yet"); } PetscFunctionReturn(0); }
PetscErrorCode ComponentSetModule | ( | componentobject | , |
AnalysisDataType | , | ||
int | , | ||
PetscErrorCode(*)(AnaModNumericalProblem, AnalysisItem *, int *, PetscTruth *) | |||
) |
Definition at line 43 of file component.c.
References CHECKVALIDCOMPONENT, componentobject_::dataid, id, componentobject_::module, and componentobject_::type.
Referenced by CategoryComponentSetModule().
{ PetscFunctionBegin; CHECKVALIDCOMPONENT(cmpt); cmpt->type = type; cmpt->dataid = id; cmpt->module = f; PetscFunctionReturn(0); }
PetscErrorCode ComputeQuantity | ( | AnaModNumericalProblem | prob, |
const char * | cat, | ||
const char * | cmp, | ||
AnalysisItem * | res, | ||
int * | rreslen, | ||
PetscTruth * | success | ||
) |
Compute a computational module from a certain category.
Argument:
"(AnalysisItem*)&res"
; see types for the definition of the AnalysisItem data typeA call to this routine need not involve actual computation: the requested quantity can already be attached to the matrix object (see attached quantities for details). This mechanism is used in all the standard modules that come with the AnaMod package.
The workings of this function can be traced by specifying a trace function; see Tracing the analysis modules.
Definition at line 558 of file module_functions.c.
References AnaModIsInitialized, ComputeOrRetrieveQuantity(), and MODE_COMPUTE.
Referenced by analyze_matrix(), DepartureRuhe75(), LoBand(), MatrixComputeQuantity(), MaxEVbyImIm(), MaxEVbyImRe(), MaxEVbyMagIm(), MaxEVbyMagRe(), MaxEVbyRealIm(), MaxEVbyRealRe(), MinEVbyMagIm(), MinEVbyMagRe(), RelSymm(), and UpBand().
{ PetscErrorCode ierr; PetscFunctionBegin; if (!AnaModIsInitialized) SETERRQ(1,"AnaMod not initialized: insert call to AnaModInitialize()\n"); ierr = ComputeOrRetrieveQuantity (prob,cat,cmp,res,rreslen,success,MODE_COMPUTE); CHKERRQ(ierr); PetscFunctionReturn(0); }
PetscErrorCode ComputeQuantityByID | ( | AnaModNumericalProblem | , |
int | , | ||
int | , | ||
AnalysisItem * | , | ||
int * | , | ||
PetscTruth * | |||
) |
PetscErrorCode CreateAnalysisDataTypeArray | ( | const char * | , |
int | , | ||
AnalysisDataTypeArray * | |||
) |
Definition at line 338 of file anamodutils.c.
References AnalysisDataTypeArray_::alloc, AnalysisDataTypeArray_::data, AnalysisDataTypeArray_::fill, AnalysisDataTypeArray_::has, NALLOC, and AnalysisDataTypeArray_::name.
Referenced by NewFeatureValues().
{ AnalysisDataTypeArray anew; PetscErrorCode ierr; PetscFunctionBegin; ierr = PetscMalloc(sizeof(struct AnalysisDataTypeArray_),&anew); CHKERRQ(ierr); ierr = PetscMemzero(anew,sizeof(struct AnalysisDataTypeArray_)); CHKERRQ(ierr); if (name) anew->name = strdup(name); anew->fill = 0; anew->alloc = NALLOC; ierr = PetscMalloc(anew->alloc*sizeof(PetscTruth),&(anew->has)); CHKERRQ(ierr); ierr = PetscMemzero(anew->has,anew->alloc*sizeof(PetscTruth)); CHKERRQ(ierr); ierr = PetscMalloc(anew->alloc*sizeof(AnalysisDataType),&(anew->data)); CHKERRQ(ierr); ierr = PetscMemzero(anew->data,anew->alloc*sizeof(AnalysisDataType)); CHKERRQ(ierr); *array = anew; PetscFunctionReturn(0); }
PetscErrorCode CreateAnalysisItemArray | ( | const char * | , |
int | , | ||
AnalysisItemArray * | |||
) |
Definition at line 233 of file anamodutils.c.
References AnalysisItemArray_::alloc, AnalysisItemArray_::data, AnalysisItemArray_::fill, AnalysisItemArray_::has, NALLOC, and AnalysisItemArray_::name.
Referenced by NewFeatureValues().
{ AnalysisItemArray anew; PetscErrorCode ierr; PetscFunctionBegin; ierr = PetscMalloc(sizeof(struct AnalysisItemArray_),&anew); CHKERRQ(ierr); ierr = PetscMemzero(anew,sizeof(struct AnalysisItemArray_)); CHKERRQ(ierr); if (name) anew->name = strdup(name); anew->fill = 0; anew->alloc = NALLOC; ierr = PetscMalloc(anew->alloc*sizeof(PetscTruth),&(anew->has)); CHKERRQ(ierr); ierr = PetscMemzero(anew->has,anew->alloc*sizeof(PetscTruth)); CHKERRQ(ierr); ierr = PetscMalloc(anew->alloc*sizeof(AnalysisItem),&(anew->data)); CHKERRQ(ierr); ierr = PetscMemzero(anew->data,anew->alloc*sizeof(AnalysisItem)); CHKERRQ(ierr); *array = anew; PetscFunctionReturn(0); }
PetscErrorCode CreateCategoryObject | ( | const char * | cat, |
categoryobject * | obj | ||
) |
Create a category object with a given name. See also DestroyCategoryObject().
Definition at line 57 of file category.c.
References CATCMP_ENABLE, CATEGORYCOOKIE, categoryobject_::componentnames, categoryobject_::components, categoryobject_::cookie, categoryobject_::enabled, categoryobject_::maxcomponents, MXC, categoryobject_::name, categoryobject_::ncomponents, and categoryobject_::types.
Referenced by GetOrCreateCategory().
{ categoryobject nnew; PetscErrorCode ierr; PetscFunctionBegin; ierr = PetscMalloc(sizeof(struct categoryobject_),&nnew); CHKERRQ(ierr); ierr = PetscStrallocpy(cat,(char**)&(nnew->name)); CHKERRQ(ierr); nnew->cookie = CATEGORYCOOKIE; nnew->enabled = CATCMP_ENABLE; nnew->maxcomponents = MXC; nnew->ncomponents = 0; ierr = PetscMalloc (nnew->maxcomponents*sizeof(componentobject),&(nnew->components)); CHKERRQ(ierr); ierr = PetscMalloc (nnew->maxcomponents*sizeof(char*),&(nnew->componentnames)); CHKERRQ(ierr); ierr = PetscMalloc (nnew->maxcomponents*sizeof(AnalysisDataType),&(nnew->types)); CHKERRQ(ierr); *obj = nnew; PetscFunctionReturn(0); }
PetscErrorCode CreateComponentObject | ( | const char * | , |
componentobject * | |||
) |
Definition at line 17 of file component.c.
References COMPONENTCOOKIE, componentobject_::cookie, and componentobject_::name.
Referenced by CategoryGetOrCreateComponent().
{ componentobject nnew; PetscErrorCode ierr; PetscFunctionBegin; ierr = PetscMalloc(sizeof(struct componentobject_),&nnew); CHKERRQ(ierr); nnew->cookie = COMPONENTCOOKIE; ierr = PetscStrallocpy(name,(char**)&(nnew->name)); CHKERRQ(ierr); *obj = nnew; PetscFunctionReturn(0); }
PetscErrorCode CreateIntArray | ( | const char * | , |
int | , | ||
IntArray * | |||
) |
Definition at line 13 of file anamodutils.c.
References IntArray_::alloc, IntArray_::data, IntArray_::fill, IntArray_::has, NALLOC, and IntArray_::name.
Referenced by NewFeatureSet().
{ IntArray inew; PetscErrorCode ierr; PetscFunctionBegin; ierr = PetscMalloc(sizeof(struct IntArray_),&inew); CHKERRQ(ierr); ierr = PetscMemzero(inew,sizeof(struct IntArray_)); CHKERRQ(ierr); if (name) inew->name = strdup(name); inew->fill = 0; inew->alloc = NALLOC; ierr = PetscMalloc(inew->alloc*sizeof(PetscTruth),&(inew->has)); CHKERRQ(ierr); ierr = PetscMemzero(inew->has,inew->alloc*sizeof(PetscTruth)); CHKERRQ(ierr); ierr = PetscMalloc(inew->alloc*sizeof(int),&(inew->data)); CHKERRQ(ierr); ierr = PetscMemzero(inew->data,inew->alloc*sizeof(int)); CHKERRQ(ierr); *array = inew; PetscFunctionReturn(0); }
PetscErrorCode CreateStringArray | ( | const char * | , |
int | , | ||
StringArray * | |||
) |
Definition at line 117 of file anamodutils.c.
References StringArray_::alloc, StringArray_::data, StringArray_::fill, StringArray_::has, NALLOC, and StringArray_::name.
Referenced by NewFeatureSet().
{ StringArray snew; PetscErrorCode ierr; PetscFunctionBegin; ierr = PetscMalloc(sizeof(struct StringArray_),&snew); CHKERRQ(ierr); ierr = PetscMemzero(snew,sizeof(struct StringArray_)); CHKERRQ(ierr); if (name) snew->name = strdup(name); snew->fill = 0; snew->alloc = NALLOC; ierr = PetscMalloc(snew->alloc*sizeof(PetscTruth),&(snew->has)); CHKERRQ(ierr); ierr = PetscMemzero(snew->has,snew->alloc*sizeof(PetscTruth)); CHKERRQ(ierr); ierr = PetscMalloc(snew->alloc*sizeof(char*),&(snew->data)); CHKERRQ(ierr); ierr = PetscMemzero(snew->data,snew->alloc*sizeof(char*)); CHKERRQ(ierr); *array = snew; PetscFunctionReturn(0); }
PetscErrorCode DeclareCategoryOptionFunction | ( | const char * | cat, |
PetscErrorCode(*)(char *) | f | ||
) |
This function allows the module developer to give the user commandline options for control of a module.
See DeclareCategoryOptionFunction(),GetCategoryOptionFunction(), AnaModOptionsHandling() and section optionsfile.
Definition at line 338 of file category.c.
References GetCategory(), and categoryobject_::optionfunction.
Referenced by RegisterSpectrumModules().
{ PetscTruth flg; categoryobject catg; PetscErrorCode ierr; PetscFunctionBegin; ierr = GetCategory(cat,&catg,&flg); CHKERRQ(ierr); if (flg) { catg->optionfunction = f; } PetscFunctionReturn(0); }
PetscErrorCode DeleteAnalysisDataTypeArray | ( | AnalysisDataTypeArray | ) |
Definition at line 356 of file anamodutils.c.
References AnalysisDataTypeArray_::data, AnalysisDataTypeArray_::has, and AnalysisDataTypeArray_::name.
Referenced by DeleteFeatureValues().
{
PetscErrorCode ierr;
PetscFunctionBegin;
ierr = PetscFree(array->data); CHKERRQ(ierr);
ierr = PetscFree(array->has); CHKERRQ(ierr);
if (array->name) free(array->name);
ierr = PetscFree(array); CHKERRQ(ierr);
PetscFunctionReturn(0);
}
PetscErrorCode DeleteAnalysisItemArray | ( | AnalysisItemArray | ) |
Definition at line 251 of file anamodutils.c.
References AnalysisItemArray_::data, AnalysisItemArray_::has, and AnalysisItemArray_::name.
Referenced by DeleteFeatureValues().
{
PetscErrorCode ierr;
PetscFunctionBegin;
ierr = PetscFree(array->data); CHKERRQ(ierr);
ierr = PetscFree(array->has); CHKERRQ(ierr);
if (array->name) free(array->name);
ierr = PetscFree(array); CHKERRQ(ierr);
PetscFunctionReturn(0);
}
PetscErrorCode DeleteFeatureSet | ( | FeatureSet | set | ) |
Delete a featureset object. See Feature sets
Definition at line 90 of file feature.c.
References CHECKVALIDFSET, DeleteIntArray(), and DeleteStringArray().
{ PetscErrorCode ierr; PetscFunctionBegin; CHECKVALIDFSET(set); ierr = DeleteIntArray(set->IDs); CHKERRQ(ierr); ierr = DeleteStringArray(set->features); CHKERRQ(ierr); ierr = PetscFree(set); CHKERRQ(ierr); PetscFunctionReturn(0); }
PetscErrorCode DeleteFeatureValues | ( | FeatureValues | values | ) |
Free a featurevalues object. See Feature sets
Definition at line 149 of file feature.c.
References CHECKVALIDFVAL, DeleteAnalysisDataTypeArray(), DeleteAnalysisItemArray(), FeatureValues_::types, and FeatureValues_::values.
{ PetscErrorCode ierr; PetscFunctionBegin; CHECKVALIDFVAL(values); ierr = DeleteAnalysisItemArray(values->values); CHKERRQ(ierr); ierr = DeleteAnalysisDataTypeArray(values->types); CHKERRQ(ierr); ierr = PetscFree(values); CHKERRQ(ierr); PetscFunctionReturn(0); }
PetscErrorCode DeleteIntArray | ( | IntArray | ) |
Definition at line 31 of file anamodutils.c.
References IntArray_::data, IntArray_::has, and IntArray_::name.
Referenced by DeleteFeatureSet().
{
PetscErrorCode ierr;
PetscFunctionBegin;
ierr = PetscFree(array->data); CHKERRQ(ierr);
ierr = PetscFree(array->has); CHKERRQ(ierr);
if (array->name) free(array->name);
ierr = PetscFree(array); CHKERRQ(ierr);
PetscFunctionReturn(0);
}
PetscErrorCode DeleteStringArray | ( | StringArray | ) |
Definition at line 135 of file anamodutils.c.
References StringArray_::data, StringArray_::fill, StringArray_::has, and StringArray_::name.
Referenced by DeleteFeatureSet().
{ int i; PetscErrorCode ierr; PetscFunctionBegin; for (i=0; i<array->fill; i++) if (array->has[i]) free(array->data[i]); ierr = PetscFree(array->data); CHKERRQ(ierr); ierr = PetscFree(array->has); CHKERRQ(ierr); if (array->name) free(array->name); ierr = PetscFree(array); CHKERRQ(ierr); PetscFunctionReturn(0); }
PetscErrorCode DeRegisterCategory | ( | const char * | cat | ) |
Deallocate the storage for a particular category of analysis modules. No longer needed.
Definition at line 409 of file module_functions.c.
{ /* categoryobject catg; */ /* PetscTruth flg; PetscErrorCode ierr; */ PetscFunctionBegin; printf("Please remove use of legacy function DeRegisterCategory\n"); /* ierr = GetCategory(cat,&catg,&flg); CHKERRQ(ierr); */ /* if (!flg) SETERRQ1(1,"Invalid category <%s>",cat); */ /* ierr = DestroyCategoryObject(catg); CHKERRQ(ierr); */ PetscFunctionReturn(0); }
PetscErrorCode DeregisterModules | ( | void | ) |
This function is no longer needed
Definition at line 425 of file module_functions.c.
{ /* int icat,ncat; const char **cat; */ /* PetscErrorCode ierr; */ PetscFunctionBegin; printf("Please remove use of legacy function DeRegisterModules\n"); /* ierr = GetCategories(&ncat,&cat); CHKERRQ(ierr); */ /* for (icat=0; icat<ncat; icat++) { */ /* ierr = DeRegisterCategory(cat[icat]); CHKERRQ(ierr); */ /* } */ PetscFunctionReturn(0); }
PetscErrorCode DestroyCategoryObject | ( | categoryobject | obj | ) |
Deallocate a category object. See also CreateCategoryObject().
Definition at line 79 of file category.c.
References CHECKVALIDCATEGORY, categoryobject_::componentnames, categoryobject_::components, DestroyComponentObject(), categoryobject_::name, categoryobject_::ncomponents, and categoryobject_::types.
Referenced by FreeCategoryObjects().
{ int icmp; PetscErrorCode ierr; PetscFunctionBegin; CHECKVALIDCATEGORY(obj); for (icmp=0; icmp<obj->ncomponents; icmp++) { ierr = DestroyComponentObject(obj->components[icmp]); CHKERRQ(ierr); } ierr = PetscFree(obj->components); CHKERRQ(ierr); ierr = PetscFree(obj->componentnames); CHKERRQ(ierr); ierr = PetscFree(obj->types); CHKERRQ(ierr); ierr = PetscFree(obj->name); CHKERRQ(ierr); ierr = PetscFree(obj); CHKERRQ(ierr); PetscFunctionReturn(0); }
PetscErrorCode DestroyComponentObject | ( | componentobject | ) |
Definition at line 30 of file component.c.
References CHECKVALIDCOMPONENT, and componentobject_::name.
Referenced by DestroyCategoryObject().
{ PetscErrorCode ierr; PetscFunctionBegin; CHECKVALIDCOMPONENT(cmp); ierr = PetscFree(cmp->name); CHKERRQ(ierr); ierr = PetscFree(cmp); CHKERRQ(ierr); PetscFunctionReturn(0); }
PetscErrorCode FreeCategoryObjects | ( | ) |
Definition at line 40 of file category.c.
References categorynames, DestroyCategoryObject(), and ncategories.
Referenced by AnaModFinalize().
{ int icat; PetscErrorCode ierr; PetscFunctionBegin; for (icat=0; icat<ncategories; icat++) { ierr = DestroyCategoryObject(categoryobjects[icat]); CHKERRQ(ierr); } ierr = PetscFree(categoryobjects); CHKERRQ(ierr); ierr = PetscFree(categorynames); CHKERRQ(ierr); PetscFunctionReturn(0); }
PetscErrorCode GetCategories | ( | int * | , |
const char *** | |||
) |
Definition at line 150 of file category.c.
References categorynames, and ncategories.
Referenced by AnaModOptionsHandling(), AnaModShowOptions(), main(), and ReportAnamodContent().
{ PetscFunctionBegin; if (ncat) *ncat = ncategories; if (cats) *cats = categorynames; PetscFunctionReturn(0); }
PetscErrorCode GetCategory | ( | const char * | cat, |
categoryobject * | catg, | ||
PetscTruth * | f | ||
) |
Return a named category
Definition at line 138 of file category.c.
References GetCategoryIndex().
Referenced by CategoryGetModules(), CategoryGetOptionFunction(), ComputeOrRetrieveQuantity(), DeclareCategoryOptionFunction(), GetDataID(), GetDataType(), HasComputeCategory(), HasComputeModule(), and HasQuantity().
{ int icat; PetscTruth flg; PetscErrorCode ierr; PetscFunctionBegin; ierr = GetCategoryIndex(cat,&icat,&flg); CHKERRQ(ierr); if (f) *f = flg; if (flg && catg) *catg = categoryobjects[icat]; PetscFunctionReturn(0); }
PetscErrorCode GetDataID | ( | const char * | , |
const char * | , | ||
int * | , | ||
PetscTruth * | |||
) |
Definition at line 589 of file module_functions.c.
References CategoryGetComponent(), ComponentGetId(), and GetCategory().
Referenced by AvgDiagDist(), AvgDistFromDiag(), AvgNnzpRow(), BlockSize(), ColourOffsets(), Colours(), ColourSizes(), ColVariability(), Commutator(), compute_dd(), compute_dummy_rows(), compute_eigenvalues(), compute_ellipse_from_Ritz_values(), compute_icm_splits(), compute_nnz_structure(), compute_posdiag(), compute_singularvalues(), compute_tracea2(), ComputeDiagonal(), computennz(), computetrace(), ComputeVariability(), Departure(), DepartureLee95(), DepartureLee96L(), DepartureLee96U(), DepartureRuhe75(), DiagDefinite(), DiagonalAverage(), DiagonalDominance(), DiagonalSign(), DiagonalVariance(), DiagZeroStart(), DummyRows(), DummyRowsKind(), eigenvaluecomp(), JonesPlassmannColouring(), Kappa(), LBandWidth(), Lee95bounds(), Lee96bounds(), LeftSkyline(), LoBand(), MatCommutatorNormF(), MatSymmPartNormInf(), MaxEVbyImIm(), MaxEVbyImRe(), MaxEVbyMagIm(), MaxEVbyMagRe(), MaxEVbyRealIm(), MaxEVbyRealRe(), MaxNNonZerosPerRow(), MinEVbyMagIm(), MinEVbyMagRe(), MinNNonZerosPerRow(), NColours(), NDiags(), NDummyRows(), NNonZeros(), Nnz(), NnzDia(), NnzLow(), NnzUp(), norm1(), normF(), normInf(), NRitzValues(), nRows(), NSplits(), NUnstruct(), PosFraction(), RBandWidth(), regularblocks(), RelSymm(), RightSkyline(), RitzValuesC(), RitzValuesR(), RowVariability(), SigmaDiagDist(), SigmaMax(), SigmaMin(), SpectrumAX(), SpectrumAY(), SpectrumCX(), SpectrumCY(), Splits(), Symmetry(), SymmetryANorm(), SymmetryFANorm(), SymmetryFSNorm(), SymmetrySNorm(), Trace(), TraceA2(), TraceAbs(), UpBand(), and Version().
{ categoryobject catg; componentobject cmpt; PetscTruth flg; PetscErrorCode ierr; PetscFunctionBegin; ierr = GetCategory(cat,&catg,&flg); CHKERRQ(ierr); if (!flg) { if (!f) SETERRQ(1,"Could not find cat/cmp, but no flag to report this"); *f = PETSC_FALSE; PetscFunctionReturn(0); } ierr = CategoryGetComponent(catg,cmp,&cmpt,&flg); CHKERRQ(ierr); if (!flg) { if (!f) SETERRQ(1,"Could not find cat/cmp, but no flag to report this"); *f = PETSC_FALSE; PetscFunctionReturn(0); } ierr = ComponentGetId(cmpt,id); CHKERRQ(ierr); if (f) *f = PETSC_TRUE; PetscFunctionReturn(0); }
PetscErrorCode GetDataType | ( | const char * | , |
const char * | , | ||
AnalysisDataType * | , | ||
PetscTruth * | |||
) |
Definition at line 612 of file module_functions.c.
References CategoryGetComponent(), ComponentGetType(), and GetCategory().
Referenced by analyze_matrix().
{ categoryobject catg; componentobject cmpt; PetscTruth flg; PetscErrorCode ierr; PetscFunctionBegin; ierr = GetCategory(cat,&catg,&flg); CHKERRQ(ierr); if (!flg) { if (!f) SETERRQ(1,"Could not find cat/cmp, but no flag to report this"); *f = PETSC_FALSE; PetscFunctionReturn(0); } ierr = CategoryGetComponent(catg,cmp,&cmpt,&flg); CHKERRQ(ierr); if (!flg) { if (!f) SETERRQ(1,"Could not find cat/cmp, but no flag to report this"); *f = PETSC_FALSE; PetscFunctionReturn(0); } ierr = ComponentGetType(cmpt,t); CHKERRQ(ierr); if (f) *f = PETSC_TRUE; PetscFunctionReturn(0); }
PetscErrorCode GetFeatureValue | ( | FeatureValues | values, |
int | index, | ||
AnalysisItem * | val, | ||
PetscTruth * | f | ||
) |
Extract a value from a featurevalues object. See Feature sets.
Arguments:
values
: the FeatureValues object.index
: the index, as returned by AddToFeatureSet().val
(output) : the value; this argument can be null.f
(output) : indicates whether the return value was indeed preset in the featurevalues object; this argument can be null. Definition at line 207 of file feature.c.
References AnalysisItemArrayTryGetAt(), CHECKVALIDFVAL, and FeatureValues_::values.
{ PetscErrorCode ierr; PetscFunctionBegin; CHECKVALIDFVAL(values); ierr = AnalysisItemArrayTryGetAt(values->values,index,val,f); CHKERRQ(ierr); PetscFunctionReturn(0); }
PetscErrorCode GetFirstCategory | ( | const char ** | , |
PetscTruth * | |||
) |
Definition at line 276 of file category.c.
References CATCMP_ENABLE, categoryreadout, categoryobject_::name, and ncategories.
Referenced by analyze_matrix().
{ PetscTruth found = PETSC_FALSE; PetscFunctionBegin; categoryreadout = 0; while (categoryreadout<ncategories && categoryobjects[categoryreadout]->enabled!=CATCMP_ENABLE) categoryreadout++; if (categoryreadout<ncategories) { found = PETSC_TRUE; if (rname) *rname = categoryobjects[categoryreadout]->name; } *rfound = found; PetscFunctionReturn(0); }
PetscErrorCode GetNextCategory | ( | const char ** | , |
PetscTruth * | |||
) |
Definition at line 294 of file category.c.
References CATCMP_ENABLE, categoryreadout, categoryobject_::name, and ncategories.
Referenced by analyze_matrix().
{ PetscTruth found = PETSC_FALSE; PetscFunctionBegin; categoryreadout++; while (categoryreadout<ncategories && categoryobjects[categoryreadout]->enabled!=CATCMP_ENABLE) categoryreadout++; if (categoryreadout<ncategories) { found = PETSC_TRUE; if (rname) *rname = categoryobjects[categoryreadout]->name; } *rfound = found; PetscFunctionReturn(0); }
PetscErrorCode GetOrCreateCategory | ( | const char * | cat, |
categoryobject * | catg | ||
) |
Return a named category, creating it if necessary
Definition at line 119 of file category.c.
References categorynames, CreateCategoryObject(), GetCategoryIndex(), maxcategories, categoryobject_::name, and ncategories.
Referenced by CategoryComponentSetModule().
{ int icat; PetscTruth flg; PetscErrorCode ierr; PetscFunctionBegin; ierr = GetCategoryIndex(cat,&icat,&flg); CHKERRQ(ierr); if (!flg) { icat = ncategories++; if (icat>=maxcategories) SETERRQ(1,"Category reallocation not implemented"); ierr = CreateCategoryObject(cat,&categoryobjects[icat]); CHKERRQ(ierr); categorynames[icat] = categoryobjects[icat]->name; } *catg = categoryobjects[icat]; PetscFunctionReturn(0); }
PetscErrorCode HasComputeCategory | ( | const char * | cat, |
PetscTruth * | f | ||
) |
Query whether a specified category has been declared.
Definition at line 451 of file module_functions.c.
References GetCategory().
{ PetscErrorCode ierr; PetscFunctionBegin; ierr = GetCategory(cat,PETSC_NULL,f); CHKERRQ(ierr); PetscFunctionReturn(0); }
PetscErrorCode HasComputeModule | ( | const char * | cat, |
const char * | cmp, | ||
PetscTruth * | f | ||
) |
Query whether a specified module exists inside a specified category. The category need not itself have been declared.
Definition at line 465 of file module_functions.c.
References CategoryGetComponent(), and GetCategory().
Referenced by LoBand(), and UpBand().
{ categoryobject catg; PetscErrorCode ierr; PetscFunctionBegin; ierr = GetCategory(cat,&catg,f); CHKERRQ(ierr); if (*f) { ierr = CategoryGetComponent(catg,cmp,PETSC_NULL,f); CHKERRQ(ierr); } PetscFunctionReturn(0); }
PetscErrorCode HasQuantity | ( | AnaModNumericalProblem | prob, |
const char * | cat, | ||
const char * | cmp, | ||
PetscTruth * | f | ||
) |
Check if a certain quantity is precomputed, meaning that it can be retrieved (with a call to ComputeQuantity()) at no computational cost.
The category and module names have to exist. Use HasComputeModule() to test whether a category and module is known to the system.
See the page on attached quantities for an explanation of the mechanism behind this routine.
Definition at line 646 of file module_functions.c.
References CategoryGetComponent(), ComponentGetId(), ComponentGetType(), GetCategory(), HasQuantityByID(), and id.
Referenced by computennz().
{ categoryobject catg; componentobject cmpt; AnalysisDataType t; int id; PetscErrorCode ierr; PetscFunctionBegin; ierr = GetCategory(cat,&catg,f); CHKERRQ(ierr); if (!*f) PetscFunctionReturn(0); ierr = CategoryGetComponent(catg,cmp,&cmpt,f); CHKERRQ(ierr); if (!*f) PetscFunctionReturn(0); ierr = ComponentGetId(cmpt,&id); CHKERRQ(ierr); ierr = ComponentGetType(cmpt,&t); CHKERRQ(ierr); ierr = HasQuantityByID(prob,id,t,f); CHKERRQ(ierr); PetscFunctionReturn(0); }
PetscErrorCode HasQuantityByID | ( | AnaModNumericalProblem | prob, |
int | id, | ||
AnalysisDataType | type, | ||
PetscTruth * | f | ||
) |
Auxiliary routine with lookup by ID, which is much faster than by string indexing.
Definition at line 667 of file module_functions.c.
References ANALYSISDBLARRAY, ANALYSISDOUBLE, ANALYSISINTARRAY, and ANALYSISINTEGER.
Referenced by HasQuantity().
{ Mat A = (Mat)prob; PetscReal rv,*rsv; int iv,*isv; PetscErrorCode ierr; PetscFunctionBegin; switch (type) { case ANALYSISINTEGER : ierr = PetscObjectComposedDataGetInt ((PetscObject)A,id,iv,*f); CHKERRQ(ierr); break; case ANALYSISDOUBLE : ierr = PetscObjectComposedDataGetReal ((PetscObject)A,id,rv,*f); CHKERRQ(ierr); break; case ANALYSISINTARRAY : ierr = PetscObjectComposedDataGetIntstar ((PetscObject)A,id,isv,*f); CHKERRQ(ierr); break; case ANALYSISDBLARRAY : ierr = PetscObjectComposedDataGetRealstar ((PetscObject)A,id,rsv,*f); CHKERRQ(ierr); break; default : SETERRQ1(1,"Unknown data type %d",type); } PetscFunctionReturn(0); }
PetscErrorCode InstantiateFeatureSet | ( | AnaModNumericalProblem | prob, |
FeatureSet | set, | ||
FeatureValues | values | ||
) |
Fill in a featurevalues object. See Feature sets
Definition at line 164 of file feature.c.
References AnalysisDataTypeArraySetAt(), AnalysisItemArraySetAt(), AnaModGetRetrievalFunction(), CHECKVALIDFSET, CHECKVALIDFVAL, retriever, StringArrayGetAt(), StringArrayGetFill(), FeatureValues_::types, and FeatureValues_::values.
{ PetscErrorCode (*retriever) (void*,char*,char*,AnalysisItem*,AnalysisDataType*,PetscTruth*); int nval,ival; PetscTruth flg; PetscErrorCode ierr; PetscFunctionBegin; CHECKVALIDFSET(set); CHECKVALIDFVAL(values); ierr = AnaModGetRetrievalFunction(&retriever,&flg); CHKERRQ(ierr); if (!flg) PetscFunctionReturn(0); ierr = StringArrayGetFill(set->features,&nval); CHKERRQ(ierr); for (ival=0; ival<nval; ival++) { char *feature,*cat,*cmp; int l; AnalysisItem res; AnalysisDataType t; ierr = StringArrayGetAt(set->features,ival,&feature); CHKERRQ(ierr); for (l=0; l<strlen(feature); l++) { if (feature[l]=='/') { feature[l] = 0; cat = feature; cmp = feature+l+1; ierr = (*retriever)(prob,cat,cmp,&res,&t,&flg); CHKERRQ(ierr); if (flg) { ierr = AnalysisItemArraySetAt(values->values,ival,res); CHKERRQ(ierr); ierr = AnalysisDataTypeArraySetAt(values->types,ival,t); CHKERRQ(ierr); } feature[l] = '/'; break; } } } PetscFunctionReturn(0); }
PetscErrorCode IntArrayAdd | ( | IntArray | array, |
int | val, | ||
int * | idx | ||
) |
Add a new value and return the index. Right now we do not yet dynamically reallocate the array if there is no more space.
Definition at line 47 of file anamodutils.c.
References IntArray_::alloc, IntArray_::data, IntArray_::fill, and IntArray_::has.
PetscErrorCode IntArrayGetAt | ( | IntArray | array, |
int | idx, | ||
int * | val | ||
) |
As IntArrayTryGetAt(), except that it is an error to ask for an index where no value has been set.
Definition at line 99 of file anamodutils.c.
References IntArray_::alloc, IntArray_::data, and IntArray_::has.
PetscErrorCode IntArrayGetFill | ( | IntArray | , |
int * | |||
) |
PetscErrorCode IntArraySetAt | ( | IntArray | array, |
int | idx, | ||
int | val | ||
) |
Set a value at a given index. Right now we do not yet dynamically reallocate the array if the index is out of bound.
Definition at line 63 of file anamodutils.c.
References IntArray_::alloc, IntArray_::data, IntArray_::fill, and IntArray_::has.
PetscErrorCode IntArrayTryGetAt | ( | IntArray | array, |
int | idx, | ||
int * | val, | ||
PetscTruth * | has | ||
) |
Retrieve data from a given index.
Arguments:
array
: the IntArray objectidx
: the index; it is an error to ask out of bounds, but not to ask beyond the highest position filled; in that case failure will be reportedval
(output) : the value retrieved. This argument is allowed to be null.has
(output) : true if a value was stored at this index. This argument is allowed to be null. Definition at line 85 of file anamodutils.c.
References IntArray_::alloc, IntArray_::data, and IntArray_::has.
PetscErrorCode NewFeatureSet | ( | FeatureSet * | set | ) |
Allocate a featureset object. See Feature sets
Definition at line 74 of file feature.c.
References FeatureSet_::cookie, CreateIntArray(), CreateStringArray(), FeatureSet_::features, FSETCOOKIE, and FeatureSet_::IDs.
{ FeatureSet fnew; PetscErrorCode ierr; PetscFunctionBegin; ierr = PetscMalloc(sizeof(struct FeatureSet_),&fnew); CHKERRQ(ierr); ierr = PetscMemzero(fnew,sizeof(struct FeatureSet_)); CHKERRQ(ierr); fnew->cookie = FSETCOOKIE; ierr = CreateIntArray("IDs",50,&(fnew->IDs)); CHKERRQ(ierr); ierr = CreateStringArray("features",50,&(fnew->features)); CHKERRQ(ierr); *set = fnew; PetscFunctionReturn(0); }
PetscErrorCode NewFeatureValues | ( | FeatureValues * | values | ) |
Allocate a featurevalues object. See Feature sets
Definition at line 133 of file feature.c.
References FeatureValues_::cookie, CreateAnalysisDataTypeArray(), CreateAnalysisItemArray(), FVALCOOKIE, FeatureValues_::types, and FeatureValues_::values.
{ FeatureValues fnew; PetscErrorCode ierr; PetscFunctionBegin; ierr = PetscMalloc(sizeof(struct FeatureValues_),&fnew); CHKERRQ(ierr); ierr = PetscMemzero(fnew,sizeof(struct FeatureValues_)); CHKERRQ(ierr); fnew->cookie = FVALCOOKIE; ierr = CreateAnalysisItemArray("values",50,&fnew->values); CHKERRQ(ierr); ierr = CreateAnalysisDataTypeArray("values",50,&fnew->types); CHKERRQ(ierr); *values = fnew; PetscFunctionReturn(0); }
PetscErrorCode PurgeAttachedArrays | ( | Mat | A | ) |
PetscErrorCode QuantityAsString | ( | AnalysisItem * | q, |
AnalysisDataType | t, | ||
const char ** | s | ||
) |
Generate a character string for a given quantity.
Definition at line 731 of file module_functions.c.
References ANALYSISDBLARRAY, ANALYSISDOUBLE, ANALYSISINTARRAY, ANALYSISINTEGER, ANALYSISSTRING, AnalysisItem::c, AnalysisItem::i, AnalysisItem::ii, AnalysisItem::len, AnalysisItem::r, and AnalysisItem::rr.
Referenced by ComputeOrRetrieveQuantity(), and ReportAnamodContent().
{ PetscErrorCode ierr; size_t l; PetscFunctionBegin; switch (t) { case ANALYSISINTEGER : ierr = PetscMalloc(12*sizeof(char),s); CHKERRQ(ierr); ierr = PetscMemzero((void*)*s,12*sizeof(char)); CHKERRQ(ierr); sprintf((char*)*s,"%d",q->i); break; case ANALYSISDOUBLE : ierr = PetscMalloc(22*sizeof(char),s); CHKERRQ(ierr); ierr = PetscMemzero((void*)*s,22*sizeof(char)); CHKERRQ(ierr); sprintf((char*)*s,"%e",q->r); break; case ANALYSISSTRING : ierr = PetscMalloc((strlen(q->c)+1)*sizeof(char),s); CHKERRQ(ierr); ierr = PetscMemzero((void*)*s,(strlen(q->c)+1)*sizeof(char)); CHKERRQ(ierr); sprintf((char*)*s,"%s",q->c); break; case ANALYSISINTARRAY : { int i,n,*iar; iar = q->ii; n = q->len; ierr = PetscMalloc((10*n+1)*sizeof(char),s); CHKERRQ(ierr); ierr = PetscMemzero((void*)*s,(10*n+1)*sizeof(char)); CHKERRQ(ierr); for (i=0; i<=n; i++) { ierr = PetscStrlen(*s,&l); CHKERRQ(ierr); sprintf((char*)*s+l,"%d,",iar[i]); } } break; case ANALYSISDBLARRAY : { int i,n; PetscReal *rar; rar = q->rr; n = q->len; ierr = PetscMalloc((15*n+1)*sizeof(char),s); CHKERRQ(ierr); ierr = PetscMemzero((void*)*s,(15*n+1)*sizeof(char)); CHKERRQ(ierr); for (i=0; i<=n; i++) { ierr = PetscStrlen(*s,&l); CHKERRQ(ierr); sprintf((char*)*s+l,"%e,",rar[i]); } } break; default : SETERRQ1(1,"Cannot string quantity type %d",t); } PetscFunctionReturn(0); }
PetscErrorCode RegisterModule | ( | const char * | cat, |
const char * | cmp, | ||
AnalysisDataType | type, | ||
PetscErrorCode(*)(AnaModNumericalProblem, AnalysisItem *, int *, PetscTruth *) | f | ||
) |
Register a new computational module
This adds a computational routine (the f
argument) into the modules database under the given category (cat
) and module (cmp
) label. If the category does not exist yet, it is created.
The available types are defined in anamodtypes.h
If the routine is NULL, only the category and component are created.
Routine prototype:
See also HasComputeModule(), ComputeQuantity().
Definition at line 382 of file module_functions.c.
References AnaModIsInitialized, CategoryComponentSetModule(), and id.
Referenced by RegisterICMKModules(), RegisterIprsModules(), RegisterJPLModules(), RegisterLapackModules(), RegisterNormalityModules(), RegisterSimpleModules(), RegisterSpectrumModules(), RegisterStatsModules(), RegisterStructureModules(), and RegisterVarianceModules().
{ int id; PetscErrorCode ierr; PetscFunctionBegin; if (!AnaModIsInitialized) SETERRQ(1,"AnaMod not initialized: insert call to AnaModInitialize()\n"); /* * Check for illegal names */ if (strchr(cat,':')) SETERRQ(1,"Illegal colon in category name"); if (strchr(cmp,':')) SETERRQ(1,"Illegal colon in component name"); #if defined(ANAMODDEBUG) printf("Defining module <%s:%s>\n",cat,cmp); #endif ierr = PetscObjectComposedDataRegister(&id); CHKERRQ(ierr); ierr = CategoryComponentSetModule(cat,cmp,type,id,f); CHKERRQ(ierr); PetscFunctionReturn(0); }
PetscErrorCode RetrieveQuantity | ( | AnaModNumericalProblem | prob, |
const char * | cat, | ||
const char * | cmp, | ||
AnalysisItem * | res, | ||
int * | rreslen, | ||
PetscTruth * | success | ||
) |
Retrieve an attached quantity. Note that this does not report the length of arrays; you have to know under which name this is stored.
Definition at line 577 of file module_functions.c.
References ComputeOrRetrieveQuantity(), and MODE_RETRIEVE.
{ PetscErrorCode ierr; PetscFunctionBegin; ierr = ComputeOrRetrieveQuantity (prob,cat,cmp,res,rreslen,success,MODE_RETRIEVE); CHKERRQ(ierr); PetscFunctionReturn(0); }
PetscErrorCode RetrieveQuantityByID | ( | AnaModNumericalProblem | prob, |
int | id, | ||
AnalysisDataType | type, | ||
AnalysisItem * | result, | ||
PetscTruth * | f | ||
) |
See also HasQuantityByID()
Definition at line 698 of file module_functions.c.
References ANALYSISDBLARRAY, ANALYSISDOUBLE, ANALYSISINTARRAY, ANALYSISINTEGER, AnalysisItem::i, AnalysisItem::ii, AnalysisItem::r, and AnalysisItem::rr.
{ Mat A = (Mat)prob; PetscErrorCode ierr; PetscFunctionBegin; switch (type) { case ANALYSISINTEGER : ierr = PetscObjectComposedDataGetInt ((PetscObject)A,id,result->i,*f); CHKERRQ(ierr); break; case ANALYSISDOUBLE : ierr = PetscObjectComposedDataGetReal ((PetscObject)A,id,result->r,*f); CHKERRQ(ierr); break; case ANALYSISINTARRAY : ierr = PetscObjectComposedDataGetIntstar ((PetscObject)A,id,result->ii,*f); CHKERRQ(ierr); break; case ANALYSISDBLARRAY : ierr = PetscObjectComposedDataGetRealstar ((PetscObject)A,id,result->rr,*f); CHKERRQ(ierr); break; default : SETERRQ1(1,"Unknown data type %d",type); } PetscFunctionReturn(0); }
PetscErrorCode StringArrayAdd | ( | StringArray | array, |
const char * | val, | ||
int * | idx | ||
) |
Add a new value and return the index. Right now we do not yet dynamically reallocate the array if there is no more space.
Definition at line 153 of file anamodutils.c.
References StringArray_::alloc, StringArray_::data, StringArray_::fill, and StringArray_::has.
Referenced by AddToFeatureSet().
PetscErrorCode StringArrayGetAt | ( | StringArray | array, |
int | idx, | ||
char ** | val | ||
) |
As StringArrayTryGetAt(), except that it is an error to ask for an index where no value has been set.
Definition at line 214 of file anamodutils.c.
References StringArray_::alloc, StringArray_::data, and StringArray_::has.
Referenced by InstantiateFeatureSet().
PetscErrorCode StringArrayGetFill | ( | StringArray | , |
int * | |||
) |
Definition at line 166 of file anamodutils.c.
References StringArray_::fill.
Referenced by InstantiateFeatureSet().
{ PetscFunctionBegin; *idx = array->fill; PetscFunctionReturn(0); }
PetscErrorCode StringArraySetAt | ( | StringArray | array, |
int | idx, | ||
const char * | val | ||
) |
Set a value at a given index. Right now we do not yet dynamically reallocate the array if the index is out of bound.
Definition at line 178 of file anamodutils.c.
References StringArray_::alloc, StringArray_::data, StringArray_::fill, and StringArray_::has.
PetscErrorCode StringArrayTryGetAt | ( | StringArray | array, |
int | idx, | ||
char ** | val, | ||
PetscTruth * | has | ||
) |
Retrieve data from a given index.
Arguments:
array
: the StringArray objectidx
: the index; it is an error to ask out of bounds, but not to ask beyond the highest position filled; in that case failure will be reportedval
(output) : the value retrieved. This argument is allowed to be null.has
(output) : true if a value was stored at this index. This argument is allowed to be null. Definition at line 200 of file anamodutils.c.
References StringArray_::alloc, StringArray_::data, and StringArray_::has.
PetscErrorCode TabReportModules | ( | Mat | , |
char ** | , | ||
char ** | , | ||
int | |||
) |