Changeset 7760
- Timestamp:
- 04/01/11 15:22:11 (14 years ago)
- Location:
- issm/trunk/src/c
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified issm/trunk/src/c/Container/Options.cpp ¶
r7746 r7760 215 215 } 216 216 217 } 218 /*}}}*/ 219 /*FUNCTION Options::Get(double** pvalue,int* numel,const char* name){{{1*/ 220 void Options::Get(double** pvalue,int* numel,const char* name){ 221 222 vector<Object*>::iterator object; 223 Option* option=NULL; 224 225 /*Get option*/ 226 option=GetOption(name); 227 228 /*If the pointer is not NULL, the option has been found*/ 229 if(option){ 230 option->Get(pvalue,numel); 231 } 232 /*Else, the Option does not exist, no default provided*/ 233 else{ 234 _error_("option of name \"%s\" not found, and no default value has been provided",name); 235 } 217 236 } 218 237 /*}}}*/ -
TabularUnified issm/trunk/src/c/Container/Options.h ¶
r7746 r7760 23 23 int AddOption(Option* in_oobject); 24 24 Option* GetOption(const char* name); 25 void Get(double* pvalue,const char* name); 26 void Get(double* pvalue,const char* name,double default_value); 27 void Get(bool* pvalue,const char* name); 28 void Get(bool* pvalue,const char* name,bool default_value); 29 void Get(char** pvalue,const char* name); 30 void Get(char** pvalue,const char* name,const char* default_value); 25 void Get(double* pvalue,const char* name); 26 void Get(double* pvalue,const char* name,double default_value); 27 void Get(bool* pvalue,const char* name); 28 void Get(bool* pvalue,const char* name,bool default_value); 29 void Get(char** pvalue,const char* name); 30 void Get(char** pvalue,const char* name,const char* default_value); 31 void Get(double** pvalue,int* numel,const char* name); 31 32 }; 32 33 -
TabularUnified issm/trunk/src/c/objects/Options/Option.h ¶
r7746 r7760 48 48 virtual void Get(bool* pvalue)=0; 49 49 virtual void Get(char** pvalue)=0; 50 virtual void Get(double** pvalue,int *pnumel)=0; 50 51 51 52 }; -
TabularUnified issm/trunk/src/c/objects/Options/OptionCell.h ¶
r7746 r7760 45 45 void Get(bool* pvalue){ _error_("An OptionCell object cannot return a bool");}; 46 46 void Get(char** pvalue){ _error_("An OptionCell object cannot return a string");}; 47 void Get(double** pvalue,int *pnumel){ _error_("An OptionCell object cannot return a double vec");}; 47 48 48 49 }; -
TabularUnified issm/trunk/src/c/objects/Options/OptionChar.h ¶
r7746 r7760 45 45 void Get(bool* pvalue){ _error_("An OptionChar object cannot return a bool");}; 46 46 void Get(char** pvalue); 47 void Get(double** pvalue,int *pnumel){ _error_("An OptionChar object cannot return a double vec");}; 47 48 48 49 }; -
TabularUnified issm/trunk/src/c/objects/Options/OptionDouble.cpp ¶
r7746 r7760 131 131 } 132 132 /*}}}*/ 133 /*FUNCTION OptionDouble::Get(double** pvalue,int* numel) {{{1*/ 134 void OptionDouble::Get(double** pvalue,int* numel){ 135 136 /*We should first check that the size is one*/ 137 if(this->NumEl()<=0){ 138 _error_("option \"%s\" is empty and cannot return a double vector",this->name); 139 } 140 141 /*Copy vector*/ 142 double* outvalue=(double*)xmalloc(this->NumEl()*sizeof(double)); 143 for(int i=0;i<this->NumEl();i++) outvalue[i]=this->values[i]; 144 145 /*Assign output pointer*/ 146 *pvalue=outvalue; 147 if(numel) *numel=this->NumEl(); 148 } 149 /*}}}*/ -
TabularUnified issm/trunk/src/c/objects/Options/OptionDouble.h ¶
r7746 r7760 45 45 void Get(bool* pvalue){ _error_("An OptionDouble object cannot return a bool");}; 46 46 void Get(char** pvalue){ _error_("An OptionDouble object cannot return a string");}; 47 void Get(double** pvalue,int* pnumel); 47 48 48 49 }; -
TabularUnified issm/trunk/src/c/objects/Options/OptionLogical.h ¶
r7746 r7760 45 45 void Get(bool* pvalue); 46 46 void Get(char** pvalue){ _error_("An OptionLogical object cannot return a string");}; 47 void Get(double** pvalue,int *pnumel){ _error_("An OptionLogical object cannot return a double vec");}; 47 48 48 49 }; -
TabularUnified issm/trunk/src/c/objects/Options/OptionStruct.h ¶
r7746 r7760 42 42 int NDims(); 43 43 int* Size(); 44 void Get(double* pvalue){_error_("An OptionCell object cannot return a double");}; 45 void Get(bool* pvalue){ _error_("An OptionCell object cannot return a bool");}; 46 void Get(char** pvalue){ _error_("An OptionCell object cannot return a string");}; 44 void Get(double* pvalue){_error_("An OptionStruct object cannot return a double");}; 45 void Get(bool* pvalue){ _error_("An OptionStruct object cannot return a bool");}; 46 void Get(char** pvalue){ _error_("An OptionStruct object cannot return a string");}; 47 void Get(double** pvalue,int *pnumel){ _error_("An OptionStruct object cannot return a double vec");}; 47 48 48 49 };
Note:
See TracChangeset
for help on using the changeset viewer.