Changeset 25512


Ignore:
Timestamp:
09/01/20 16:43:10 (5 years ago)
Author:
Mathieu Morlighem
Message:

CHG: removed duplicates

Location:
issm/trunk-jpl/src/c
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/cores/transient_core.cpp

    r25511 r25512  
    357357
    358358        for(int i=0;i<Xsize;i++) Xb[i] += X[i].gradient();
    359         InitAdjointFunctor* marshallhandle3 = new InitAdjointFunctor(Yb);
     359        SetAdjointFunctor* marshallhandle3 = new SetAdjointFunctor(Yb);
    360360        femmodel->Marshall(marshallhandle3);
    361361        delete marshallhandle3;
  • issm/trunk-jpl/src/c/shared/io/Marshalling/Marshalling.h

    r25511 r25512  
    2020        AD_REGISTERINPUT,
    2121        AD_REGISTEROUTPUT,
    22         AD_INITADJOINT,
    2322        AD_SETADJOINT,
    2423#endif
     
    212211                }
    213212}; /*}}}*/
    214 class InitAdjointFunctor:     public MarshallHandle{ /*{{{*/
    215 
    216         private:
    217                 int                   double_count;
    218                 IssmDouble::TapeType* tape_codi;
    219                 double*               adjoint;
    220 
    221         public:
    222                 InitAdjointFunctor(double* adjoint_in) : MarshallHandle(AD_INITADJOINT){
    223                         this->double_count = 0;
    224                         this->tape_codi    = &(IssmDouble::getGlobalTape());
    225                         this->adjoint      = adjoint_in;
    226                 }
    227                 void Echo(void){
    228                         printf("InitAdjointFunctor Echo:\n");
    229                         printf("   double_count: %i\n",double_count);
    230                 }
    231                 template<typename T> void call(T & value){
    232                         /*General case: do nothing*/
    233                 }
    234                 template<typename T> void call(T* & value,int size){
    235                         /*General case: do nothing*/
    236                 }
    237                 void call(IssmDouble value){
    238                         value.gradient() = adjoint[this->double_count];
    239                         this->double_count++;
    240                 }
    241                 void call(IssmDouble* value,int size){
    242                         if(value){
    243                                 for(int i=0;i<size;i++){
    244                                         value[i].gradient() = adjoint[this->double_count];
    245                                         this->double_count++;
    246                                 }
    247                         }
    248                 }
    249 }; /*}}}*/
    250213class SetAdjointFunctor:      public MarshallHandle{ /*{{{*/
    251214
     
    295258                case AD_REGISTERINPUT: {RegisterInputFunctor*  temp = xDynamicCast<RegisterInputFunctor*>(this);   temp->call(value); break;}
    296259                case AD_REGISTEROUTPUT:{RegisterOutputFunctor* temp = xDynamicCast<RegisterOutputFunctor*>(this);  temp->call(value); break;}
    297                 case AD_INITADJOINT:   {InitAdjointFunctor*    temp = xDynamicCast<InitAdjointFunctor*>(this);     temp->call(value); break;}
    298260                case AD_SETADJOINT:    {SetAdjointFunctor*     temp = xDynamicCast<SetAdjointFunctor*>(this);      temp->call(value); break;}
    299261#endif
     
    310272                case AD_REGISTERINPUT: {RegisterInputFunctor*  temp = xDynamicCast<RegisterInputFunctor*>(this);   temp->call(value,size); break;}
    311273                case AD_REGISTEROUTPUT:{RegisterOutputFunctor* temp = xDynamicCast<RegisterOutputFunctor*>(this);  temp->call(value,size); break;}
    312                 case AD_INITADJOINT:   {InitAdjointFunctor*    temp = xDynamicCast<InitAdjointFunctor*>(this);     temp->call(value,size); break;}
    313274                case AD_SETADJOINT:    {SetAdjointFunctor*     temp = xDynamicCast<SetAdjointFunctor*>(this);      temp->call(value,size); break;}
    314275#endif
Note: See TracChangeset for help on using the changeset viewer.