SALSA Analysis Modules
|
Go to the source code of this file.
Data Structures | |
struct | FeatureSet_ |
struct | FeatureValues_ |
Defines | |
#define | NALLOC 25 |
#define | FSETCOOKIE 9876 |
#define | CHECKVALIDFSET(i) {ANAMODCHECKVALID(i,FSETCOOKIE,"feature set");} |
#define | FVALCOOKIE 9877 |
#define | CHECKVALIDFVAL(i) {ANAMODCHECKVALID(i,FVALCOOKIE,"feature values");} |
Functions | |
PetscErrorCode | NewFeatureSet (FeatureSet *set) |
PetscErrorCode | DeleteFeatureSet (FeatureSet set) |
PetscErrorCode | AddToFeatureSet (FeatureSet set, const char *cat, const char *cmp, int *idx) |
PetscErrorCode | NewFeatureValues (FeatureValues *values) |
PetscErrorCode | DeleteFeatureValues (FeatureValues values) |
PetscErrorCode | InstantiateFeatureSet (AnaModNumericalProblem prob, FeatureSet set, FeatureValues values) |
PetscErrorCode | GetFeatureValue (FeatureValues values, int index, AnalysisItem *val, PetscTruth *f) |
PetscErrorCode | AnaModSetRetrievalFunction (PetscErrorCode(*fun)(void *, char *, char *, AnalysisItem *, AnalysisDataType *, PetscTruth *)) |
PetscErrorCode | AnaModGetRetrievalFunction (PetscErrorCode(**fun)(void *, char *, char *, AnalysisItem *, AnalysisDataType *, PetscTruth *), PetscTruth *flg) |
PetscErrorCode | AnaModCheckValidFeatureSet (void *f) |
Variables | |
static PetscErrorCode(* | retriever )(void *, char *, char *, AnalysisItem *, AnalysisDataType *, PetscTruth *) = NULL |
#define CHECKVALIDFSET | ( | i | ) | {ANAMODCHECKVALID(i,FSETCOOKIE,"feature set");} |
Definition at line 59 of file feature.c.
Referenced by AddToFeatureSet(), AnaModCheckValidFeatureSet(), DeleteFeatureSet(), and InstantiateFeatureSet().
#define CHECKVALIDFVAL | ( | i | ) | {ANAMODCHECKVALID(i,FVALCOOKIE,"feature values");} |
Definition at line 65 of file feature.c.
Referenced by DeleteFeatureValues(), GetFeatureValue(), and InstantiateFeatureSet().
#define FSETCOOKIE 9876 |
Definition at line 58 of file feature.c.
Referenced by NewFeatureSet().
#define FVALCOOKIE 9877 |
Definition at line 64 of file feature.c.
Referenced by NewFeatureValues().
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 AnaModCheckValidFeatureSet | ( | void * | f | ) |
Definition at line 242 of file feature.c.
References CHECKVALIDFSET.
{ PetscFunctionBegin; CHECKVALIDFSET((FeatureSet)f); PetscFunctionReturn(0); }
PetscErrorCode AnaModGetRetrievalFunction | ( | PetscErrorCode(**)(void *, char *, char *, AnalysisItem *, AnalysisDataType *, PetscTruth *) | fun, |
PetscTruth * | flg | ||
) |
PetscErrorCode AnaModSetRetrievalFunction | ( | PetscErrorCode(*)(void *, char *, char *, AnalysisItem *, AnalysisDataType *, PetscTruth *) | fun | ) |
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 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 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 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(* retriever)(void *, char *, char *, AnalysisItem *, AnalysisDataType *, PetscTruth *) = NULL [static] |
Definition at line 216 of file feature.c.
Referenced by AnaModGetRetrievalFunction(), AnaModSetRetrievalFunction(), and InstantiateFeatureSet().