Changeset 12473
- Timestamp:
- 06/20/12 09:30:44 (13 years ago)
- Location:
- issm/trunk-jpl/src/c/objects/Options
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/objects/Options/Option.h
r12365 r12473 43 43 virtual int* Size()=0; 44 44 virtual void Get(int* pvalue)=0; 45 virtual void Get( double* pvalue)=0;45 virtual void Get(IssmPDouble* pvalue)=0; 46 46 virtual void Get(bool* pvalue)=0; 47 47 virtual void Get(char** pvalue)=0; 48 48 virtual void Get(char*** ppvalue,int *pnumel)=0; 49 virtual void Get( double** pvalue,int *pnumel)=0;49 virtual void Get(IssmPDouble** pvalue,int *pnumel)=0; 50 50 virtual void Get(Options** pvalue)=0; 51 51 virtual void Get(Options*** ppvalue,int *pnumel)=0; -
issm/trunk-jpl/src/c/objects/Options/OptionCell.cpp
r12454 r12473 78 78 Option::DeepEcho(indent); 79 79 80 memcpy(indent2,indent,(strlen(indent)+1)*sizeof(char));80 xMemCpy<char>(indent2,indent,(strlen(indent)+1)); 81 81 strcat(indent2," "); 82 82 -
issm/trunk-jpl/src/c/objects/Options/OptionCell.h
r12365 r12473 40 40 int* Size(); 41 41 void Get(int* pvalue){_error_("An OptionCell object cannot return a int");}; 42 void Get( double* pvalue){_error_("An OptionCell object cannot return a double");};42 void Get(IssmPDouble* pvalue){_error_("An OptionCell object cannot return a IssmPDouble");}; 43 43 void Get(bool* pvalue){ _error_("An OptionCell object cannot return a bool");}; 44 44 void Get(char** pvalue){ _error_("An OptionCell object cannot return a string");}; 45 45 void Get(char*** ppvalue,int *pnumel){ _error_("An OptionCell object cannot return a string vec");}; 46 void Get( double** pvalue,int *pnumel){ _error_("An OptionCell object cannot return a double vec");};46 void Get(IssmPDouble** pvalue,int *pnumel){ _error_("An OptionCell object cannot return a IssmPDouble vec");}; 47 47 void Get(Options** pvalue); 48 48 void Get(Options*** ppvalue,int *pnumel){ _error_("An OptionCell object cannot return an Options DataSet vec");}; -
issm/trunk-jpl/src/c/objects/Options/OptionChar.cpp
r12454 r12473 82 82 Option::DeepEcho(indent); 83 83 84 memcpy(indent2,indent,(strlen(indent)+1)*sizeof(char));84 xMemCpy<char>(indent2,indent,(strlen(indent)+1)); 85 85 strcat(indent2," "); 86 86 … … 139 139 140 140 outstring=xNew<char>(stringsize); 141 memcpy(outstring,this->values,stringsize*sizeof(char));141 xMemCpy<char>(outstring,this->values,stringsize); 142 142 143 143 *pvalue=outstring; … … 165 165 for (i=0; i<nstr; i++) { 166 166 outstring=xNew<char>(stringsize); 167 memcpy(outstring,&(this->values[ipt]),(stringsize-1)*sizeof(char));167 xMemCpy<char>(outstring,&(this->values[ipt]),(stringsize-1)); 168 168 outstring[stringsize-1]='\0'; 169 169 (*ppvalue)[i]=outstring; -
issm/trunk-jpl/src/c/objects/Options/OptionChar.h
r12365 r12473 40 40 int* Size(); 41 41 void Get(int* pvalue){_error_("An OptionChar object cannot return a int");}; 42 void Get( double* pvalue){_error_("An OptionChar object cannot return a double");};42 void Get(IssmPDouble* pvalue){_error_("An OptionChar object cannot return a IssmPDouble");}; 43 43 void Get(bool* pvalue){ _error_("An OptionChar object cannot return a bool");}; 44 44 void Get(char** pvalue); 45 45 void Get(char*** ppvalue,int *pnumel); 46 void Get( double** pvalue,int *pnumel){ _error_("An OptionChar object cannot return a double vec");};46 void Get(IssmPDouble** pvalue,int *pnumel){ _error_("An OptionChar object cannot return a IssmPDouble vec");}; 47 47 void Get(Options** pvalue){ _error_("An OptionChar object cannot return an Options DataSet");}; 48 48 void Get(Options*** ppvalue,int *pnumel){ _error_("An OptionChar object cannot return an Options DataSet vec");}; -
issm/trunk-jpl/src/c/objects/Options/OptionDouble.cpp
r12454 r12473 1 1 /*!\file OptionDouble.cpp 2 * \brief: implementation of the options double object2 * \brief: implementation of the optionsIssmPDouble object 3 3 */ 4 4 … … 31 31 OptionDouble::~OptionDouble(){ 32 32 33 if (values) xDelete< double>(values);33 if (values) xDelete<IssmPDouble>(values); 34 34 35 35 } … … 50 50 else { 51 51 StringFromSize(cstr,size,ndims); 52 _printf_(flag," values: %s %s\n" ,cstr," double");52 _printf_(flag," values: %s %s\n" ,cstr,"IssmPDouble"); 53 53 } 54 54 } … … 78 78 Option::DeepEcho(indent); 79 79 80 memcpy(indent2,indent,(strlen(indent)+1)*sizeof(char));80 xMemCpy<char>(indent2,indent,(strlen(indent)+1)); 81 81 strcat(indent2," "); 82 82 … … 132 132 } 133 133 /*}}}*/ 134 /*FUNCTION OptionDouble::Get( double* pvalue) {{{*/135 void OptionDouble::Get( double* pvalue){134 /*FUNCTION OptionDouble::Get(IssmPDouble* pvalue) {{{*/ 135 void OptionDouble::Get(IssmPDouble* pvalue){ 136 136 137 137 /*We should first check that the size is one*/ 138 138 if(this->NumEl()!=1){ 139 _error_("option \"%s\" has %i elements and cannot return a single double",this->name,this->NumEl());139 _error_("option \"%s\" has %i elements and cannot return a single IssmPDouble",this->name,this->NumEl()); 140 140 } 141 141 … … 144 144 } 145 145 /*}}}*/ 146 /*FUNCTION OptionDouble::Get( double** pvalue,int* numel) {{{*/147 void OptionDouble::Get( double** pvalue,int* numel){146 /*FUNCTION OptionDouble::Get(IssmPDouble** pvalue,int* numel) {{{*/ 147 void OptionDouble::Get(IssmPDouble** pvalue,int* numel){ 148 148 149 149 /*We should first check that the size is at least one*/ 150 150 if(this->NumEl()<=0){ 151 _error_("option \"%s\" is empty and cannot return a double vector",this->name);151 _error_("option \"%s\" is empty and cannot return a IssmPDouble vector",this->name); 152 152 } 153 153 154 154 /*Copy vector*/ 155 double* outvalue=xNew<double>(this->NumEl());155 IssmPDouble* outvalue=xNew<IssmPDouble>(this->NumEl()); 156 156 for(int i=0;i<this->NumEl();i++) outvalue[i]=this->values[i]; 157 157 -
issm/trunk-jpl/src/c/objects/Options/OptionDouble.h
r12365 r12473 1 1 /*! \file OptionDouble.h 2 * \brief: header file for option double object2 * \brief: header file for optionIssmPDouble object 3 3 */ 4 4 … … 18 18 public: 19 19 20 double* values;20 IssmPDouble* values; 21 21 22 22 /*OptionDouble constructors, destructors {{{*/ … … 40 40 int* Size(); 41 41 void Get(int* pvalue); 42 void Get( double* pvalue);42 void Get(IssmPDouble* pvalue); 43 43 void Get(bool* pvalue){ _error_("An OptionDouble object cannot return a bool");}; 44 44 void Get(char** pvalue){ _error_("An OptionDouble object cannot return a string");}; 45 45 void Get(char*** ppvalue,int *pnumel){ _error_("An OptionDouble object cannot return a string vec");}; 46 void Get( double** pvalue,int* pnumel);46 void Get(IssmPDouble** pvalue,int* pnumel); 47 47 void Get(Options** pvalue){ _error_("An OptionDouble object cannot return an Options DataSet");}; 48 48 void Get(Options*** ppvalue,int *pnumel){ _error_("An OptionDouble object cannot return an Options DataSet vec");}; -
issm/trunk-jpl/src/c/objects/Options/OptionLogical.cpp
r12454 r12473 78 78 Option::DeepEcho(indent); 79 79 80 memcpy(indent2,indent,(strlen(indent)+1)*sizeof(char));80 xMemCpy<char>(indent2,indent,(strlen(indent)+1)); 81 81 strcat(indent2," "); 82 82 -
issm/trunk-jpl/src/c/objects/Options/OptionLogical.h
r12365 r12473 40 40 int* Size(); 41 41 void Get(int* pvalue){_error_("An OptionLogical object cannot return a int");}; 42 void Get( double* pvalue){_error_("An OptionLogical object cannot return a double");};42 void Get(IssmPDouble* pvalue){_error_("An OptionLogical object cannot return a IssmPDouble");}; 43 43 void Get(bool* pvalue); 44 44 void Get(char** pvalue){ _error_("An OptionLogical object cannot return a string");}; 45 45 void Get(char*** ppvalue,int *pnumel){ _error_("An OptionLogical object cannot return a string vec");}; 46 void Get( double** pvalue,int *pnumel){ _error_("An OptionLogical object cannot return a double vec");};46 void Get(IssmPDouble** pvalue,int *pnumel){ _error_("An OptionLogical object cannot return a IssmPDouble vec");}; 47 47 void Get(Options** pvalue){ _error_("An OptionLogical object cannot return an Options DataSet");}; 48 48 void Get(Options*** ppvalue,int *pnumel){ _error_("An OptionLogical object cannot return an Options DataSet vec");}; -
issm/trunk-jpl/src/c/objects/Options/OptionStruct.cpp
r12454 r12473 83 83 Option::DeepEcho(indent); 84 84 85 memcpy(indent2,indent,(strlen(indent)+1)*sizeof(char));85 xMemCpy<char>(indent2,indent,(strlen(indent)+1)); 86 86 strcat(indent2," "); 87 87 -
issm/trunk-jpl/src/c/objects/Options/OptionStruct.h
r12365 r12473 40 40 int* Size(); 41 41 void Get(int* pvalue){_error_("An OptionStruct object cannot return a int");}; 42 void Get( double* pvalue){_error_("An OptionStruct object cannot return a double");};42 void Get(IssmPDouble* pvalue){_error_("An OptionStruct object cannot return a IssmPDouble");}; 43 43 void Get(bool* pvalue){ _error_("An OptionStruct object cannot return a bool");}; 44 44 void Get(char** pvalue){ _error_("An OptionStruct object cannot return a string");}; 45 45 void Get(char*** ppvalue,int *pnumel){ _error_("An OptionStruct object cannot return a string vec");}; 46 void Get( double** pvalue,int *pnumel){ _error_("An OptionStruct object cannot return a double vec");};46 void Get(IssmPDouble** pvalue,int *pnumel){ _error_("An OptionStruct object cannot return a IssmPDouble vec");}; 47 47 void Get(Options** pvalue); 48 48 void Get(Options*** ppvalue,int *pnumel); -
issm/trunk-jpl/src/c/objects/Options/OptionUtilities.cpp
r12365 r12473 31 31 /*calculate the dimensions (being careful of integer division) */ 32 32 for (i=ndims-1; i>=0; i--) { 33 aprod=(int)((( double)aprod+0.5)/(double)size[i]);34 dims[i]=(int)floor((( double)index+0.5)/(double)aprod);33 aprod=(int)(((IssmPDouble)aprod+0.5)/(IssmPDouble)size[i]); 34 dims[i]=(int)floor(((IssmPDouble)index+0.5)/(IssmPDouble)aprod); 35 35 index-=dims[i]*aprod; 36 36 } … … 69 69 /*calculate the dimensions (being careful of integer division) */ 70 70 for (i=0; i<ndims; i++) { 71 aprod=(int)((( double)aprod+0.5)/(double)size[i]);72 dims[i]=(int)floor((( double)index+0.5)/(double)aprod);71 aprod=(int)(((IssmPDouble)aprod+0.5)/(IssmPDouble)size[i]); 72 dims[i]=(int)floor(((IssmPDouble)index+0.5)/(IssmPDouble)aprod); 73 73 index-=dims[i]*aprod; 74 74 }
Note:
See TracChangeset
for help on using the changeset viewer.