Changeset 25510
- Timestamp:
- 09/01/20 16:03:14 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/shared/io/Marshalling/Marshalling.h
r25509 r25510 19 19 AD_COUNTDOUBLES, 20 20 AD_REGISTERINPUT, 21 AD_REGISTEROUTPUT, 21 22 AD_SETADJOINT, 22 23 #endif … … 143 144 int double_count; 144 145 int* identifiers; 145 auto* tape_codi; 146 147 public: 148 RegisterInputFunctor(auto* tape_in,int* identifiers_in) : MarshallHandle(AD_REGISTERINPUT),double_count(0),identifiers(identifiers_in),tape_codi(tape_in)){} 146 IssmDouble::TapeType* tape_codi; 147 148 public: 149 RegisterInputFunctor(int* identifiers_in) : MarshallHandle(AD_REGISTERINPUT){ 150 this->double_count = 0; 151 this->identifiers = identifiers_in; 152 this->tape_codi = &(IssmDouble::getGlobalTape()); 153 } 149 154 int DoubleCount(void){return this->double_count;}; 150 155 void Echo(void){ … … 173 178 } 174 179 }; /*}}}*/ 180 class RegisterOutputFunctor: public MarshallHandle{ /*{{{*/ 181 182 private: 183 int double_count; 184 IssmDouble::TapeType* tape_codi; 185 186 public: 187 RegisterOutputFunctor(void) : MarshallHandle(AD_REGISTERINPUT){ 188 this->double_count = 0; 189 this->tape_codi = &(IssmDouble::getGlobalTape()); 190 } 191 int DoubleCount(void){return this->double_count;}; 192 void Echo(void){ 193 printf("RegisterOutputFunctor Echo:\n"); 194 printf(" double_count: %i\n",double_count); 195 } 196 template<typename T> void call(T & value){ 197 /*General case: do nothing*/ 198 } 199 template<typename T> void call(T* & value,int size){ 200 /*General case: do nothing*/ 201 } 202 void call(IssmDouble value){ 203 this->tape_codi->registerOutput(value); 204 this->double_count++; 205 } 206 void call(IssmDouble* value,int size){ 207 if(value){ 208 for(int i=0;i<size;i++){ 209 this->tape_codi->registerOutput(value[i]); 210 this->double_count++; 211 } 212 } 213 } 214 }; /*}}}*/ 175 215 #endif 176 216 … … 183 223 case AD_COUNTDOUBLES: {CountDoublesFunctor* temp = xDynamicCast<CountDoublesFunctor*>(this); temp->call(value); break;} 184 224 case AD_REGISTERINPUT: {RegisterInputFunctor* temp = xDynamicCast<RegisterInputFunctor*>(this); temp->call(value); break;} 225 case AD_REGISTEROUTPUT:{RegisterOutputFunctor* temp = xDynamicCast<RegisterOutputFunctor*>(this); temp->call(value); break;} 185 226 //case AD_SETADJOINT: {SetAdjointFunction* temp = xDynamicCast<SetAdjointFunction*>(this); temp->call(value); break;} 186 227 #endif … … 196 237 case AD_COUNTDOUBLES: {CountDoublesFunctor* temp = xDynamicCast<CountDoublesFunctor*>(this); temp->call(value,size); break;} 197 238 case AD_REGISTERINPUT: {RegisterInputFunctor* temp = xDynamicCast<RegisterInputFunctor*>(this); temp->call(value,size); break;} 239 case AD_REGISTEROUTPUT:{RegisterOutputFunctor* temp = xDynamicCast<RegisterOutputFunctor*>(this); temp->call(value,size); break;} 198 240 //case AD_SETADJOINT: {SetAdjointFunction* temp = xDynamicCast<SetAdjointFunction*>(this); temp->call(value,size); break;} 199 241 #endif
Note:
See TracChangeset
for help on using the changeset viewer.