Changeset 18886


Ignore:
Timestamp:
11/28/14 09:57:31 (10 years ago)
Author:
Eric.Larour
Message:

CHG: allow chasing through a dataset of external results according now to their enum but to their corresponding
name.

Location:
issm/trunk-jpl/src/c/classes/ExternalResults
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/classes/ExternalResults/ExternalResult.h

    r16504 r18886  
    2828                virtual int    GetStep(void)=0;
    2929                virtual double GetValue(void)=0;
     30                virtual int    GetResultEnum(void)=0;
    3031};
    3132#endif
  • issm/trunk-jpl/src/c/classes/ExternalResults/GenericExternalResult.h

    r17145 r18886  
    160160                return name;
    161161} /*}}}*/
     162int GetResultEnum(void){ /*{{{*/
     163                return StringToEnumx(this->result_name,false);
     164} /*}}}*/
    162165int   GetStep(void){ /*{{{*/
    163166        return this->step;
    164167} /*}}}*/
    165 IssmPDouble GetValue(void){ /*{{{*/
     168double GetValue(void){ /*{{{*/
    166169        /*Only supported by IssmPDouble result, error out by default*/
    167170        _error_("not supported for this type of result");
    168         return 0.;
     171} /*}}}*/
     172double* GetValues(void){ /*{{{*/
     173        /*Only supported by IssmPDouble* result, error out by default*/
     174        _error_("not supported for this type of result");
    169175} /*}}}*/
    170176};
     
    367373        return DoubleMatExternalResultEnum;
    368374} /*}}}*/
     375template <> inline double* GenericExternalResult<IssmPDouble*>::GetValues(void){ /*{{{*/
     376        return value;
     377} /*}}}*/
    369378
    370379/*Specific instantiations for IssmDouble*: */
  • issm/trunk-jpl/src/c/classes/ExternalResults/Results.cpp

    r18521 r18886  
    9494}
    9595/*}}}*/
     96ExternalResult* Results::FindResult(int result_enum){/*{{{*/
     97
     98        for(int i=0;i<this->Size();i++){
     99                ExternalResult* result=xDynamicCast<ExternalResult*>(this->GetObjectByOffset(i));
     100
     101                if(result->GetResultEnum()==result_enum){
     102                        return result;
     103                }
     104        }
     105        return NULL;
     106}
     107/*}}}*/
  • issm/trunk-jpl/src/c/classes/ExternalResults/Results.h

    r16486 r18886  
    2222                /*Mehthos*/
    2323                int AddResult(ExternalResult* result);
     24                ExternalResult* FindResult(int result_enum);
    2425                int DeleteResult(int result_enum,int result_step);
    2526                void Write(Parameters* parameters);
Note: See TracChangeset for help on using the changeset viewer.