Changeset 16589


Ignore:
Timestamp:
10/30/13 21:15:33 (11 years ago)
Author:
Eric.Larour
Message:

CHG: make external results active, otherwise we have an issue with MPI type in ADOLC related operations.

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

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/classes/Elements/Element.h

    r16494 r16589  
    6060                virtual void   ComputeStrainRate(Vector<IssmDouble>* eps)=0;
    6161                virtual void   ResultInterpolation(int* pinterpolation,int output_enum)=0;
    62                 virtual void   ResultToVector(Vector<IssmPDouble>* vector,int output_enum)=0;
     62                virtual void   ResultToVector(Vector<IssmDouble>* vector,int output_enum)=0;
    6363                virtual void   Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type,int finite_element)=0;
    6464                virtual void   InputDuplicate(int original_enum,int new_enum)=0;
  • issm/trunk-jpl/src/c/classes/Elements/Penta.cpp

    r16545 r16589  
    28642864/*}}}*/
    28652865/*FUNCTION Penta::ResultToVector{{{*/
    2866 void Penta::ResultToVector(Vector<IssmPDouble>* vector,int output_enum){
     2866void Penta::ResultToVector(Vector<IssmDouble>* vector,int output_enum){
    28672867
    28682868        Input* input=this->inputs->GetInput(output_enum);
     
    28752875                case P1Enum:{
    28762876                        IssmDouble  values[NUMVERTICES];
    2877                         IssmPDouble pvalues[NUMVERTICES];
    28782877                        int         connectivity[NUMVERTICES];
    28792878                        int         sidlist[NUMVERTICES];
     
    28822881                        this->GetConnectivityList(&connectivity[0]);
    28832882                        this->GetInputListOnVertices(&values[0],output_enum);
    2884                         for(int i=0;i<NUMVERTICES;i++) pvalues[i] = reCast<IssmPDouble>(values[i])/reCast<IssmPDouble>(connectivity[i]);
    2885 
    2886                         vector->SetValues(NUMVERTICES,&sidlist[0],&pvalues[0],ADD_VAL);
     2883                        for(int i=0;i<NUMVERTICES;i++) values[i] = values[i]/reCast<IssmDouble>(connectivity[i]);
     2884
     2885                        vector->SetValues(NUMVERTICES,&sidlist[0],&values[0],ADD_VAL);
    28872886                        break;
    28882887                                        }
  • issm/trunk-jpl/src/c/classes/Elements/Penta.h

    r16529 r16589  
    9696
    9797                void   ResultInterpolation(int* pinterpolation,int output_enum);
    98                 void   ResultToVector(Vector<IssmPDouble>* vector,int output_enum);
     98                void   ResultToVector(Vector<IssmDouble>* vector,int output_enum);
    9999                void   PositiveDegreeDay(IssmDouble* pdds,IssmDouble* pds,IssmDouble signorm);
    100100                void   ResetCoordinateSystem(void);
  • issm/trunk-jpl/src/c/classes/Elements/Seg.h

    r16529 r16589  
    112112                void        PositiveDegreeDay(IssmDouble* pdds,IssmDouble* pds,IssmDouble signorm){_error_("not implemented yet");};
    113113                void        ResultInterpolation(int* pinterpolation,int output_enum){_error_("not implemented");};
    114                 void        ResultToVector(Vector<IssmPDouble>* vector,int output_enum){_error_("not implemented");};
     114                void        ResultToVector(Vector<IssmDouble>* vector,int output_enum){_error_("not implemented");};
    115115                void        ResetCoordinateSystem(void){_error_("not implemented yet");};
    116116                void          SmbGradients(){_error_("not implemented yet");};
  • issm/trunk-jpl/src/c/classes/Elements/Tria.cpp

    r16573 r16589  
    24642464/*}}}*/
    24652465/*FUNCTION Tria::ResultToVector{{{*/
    2466 void Tria::ResultToVector(Vector<IssmPDouble>* vector,int output_enum){
     2466void Tria::ResultToVector(Vector<IssmDouble>* vector,int output_enum){
    24672467
    24682468        Input* input=this->inputs->GetInput(output_enum);
     
    24752475                case P1Enum:{
    24762476                        IssmDouble  values[NUMVERTICES];
    2477                         IssmPDouble pvalues[NUMVERTICES];
    24782477                        int         connectivity[NUMVERTICES];
    24792478                        int         sidlist[NUMVERTICES];
     
    24822481                        this->GetConnectivityList(&connectivity[0]);
    24832482                        this->GetInputListOnVertices(&values[0],output_enum);
    2484                         for(int i=0;i<NUMVERTICES;i++) pvalues[i] = reCast<IssmPDouble>(values[i])/reCast<IssmPDouble>(connectivity[i]);
    2485 
    2486                         vector->SetValues(NUMVERTICES,&sidlist[0],&pvalues[0],ADD_VAL);
     2483                        for(int i=0;i<NUMVERTICES;i++) values[i] = values[i]/reCast<IssmDouble>(connectivity[i]);
     2484
     2485                        vector->SetValues(NUMVERTICES,&sidlist[0],&values[0],ADD_VAL);
    24872486                        break;
    24882487                                        }
  • issm/trunk-jpl/src/c/classes/Elements/Tria.h

    r16529 r16589  
    103103                void        PositiveDegreeDay(IssmDouble* pdds,IssmDouble* pds,IssmDouble signorm);
    104104                void        ResultInterpolation(int* pinterpolation,int output_enum);
    105                 void        ResultToVector(Vector<IssmPDouble>* vector,int output_enum);
     105                void        ResultToVector(Vector<IssmDouble>* vector,int output_enum);
    106106                void        ResetCoordinateSystem(void);
    107107                void          SmbGradients();
  • issm/trunk-jpl/src/c/classes/ExternalResults/GenericExternalResult.h

    r16504 r16589  
    383383        return new GenericExternalResult<Vector<IssmPDouble>*>(this->id,StringToEnumx(this->result_name),this->value,this->step,this->time);
    384384} /*}}}*/
     385#if defined(_HAVE_ADOLC_) && !defined(_WRAPPERS_)  //We hook off this specific specialization when not running ADOLC, otherwise we get a redeclaration with the next specialization.
    385386template <> inline void GenericExternalResult<Vector<IssmPDouble>*>::WriteData(FILE* fid,bool io_gather){ /*{{{*/
    386387
     
    420421}
    421422/*}}}*/
     423#endif
    422424template <> inline int GenericExternalResult<Vector<IssmPDouble>*>::ObjectEnum(void){ /*{{{*/
    423425        return NoneEnum;
     
    425427} /*}}}*/
    426428
     429/*Specifics instantiations for Vector<IssmDouble>*/
     430template <> inline void GenericExternalResult<Vector<IssmDouble>*>::WriteData(FILE* fid,bool io_gather){ /*{{{*/
     431
     432        int i;
     433        char *name   = NULL;
     434        int   length,rows,cols=1;
     435        IssmDouble*  serialvalues = NULL;
     436        IssmPDouble* pserialvalues = NULL;
     437
     438        if(!io_gather){
     439                _error_("not supported yet");
     440        }
     441
     442        /*Serialize vector*/
     443        serialvalues = this->value->ToMPISerial();
     444        this->value->GetSize(&rows);
     445       
     446        pserialvalues=xNew<IssmPDouble>(rows);
     447        for(i=0;i<rows;i++)pserialvalues[i]=reCast<IssmPDouble>(serialvalues[i]);
     448
     449        if(IssmComm::GetRank()==0){
     450                /*First write name: */
     451                length=(strlen(this->result_name)+1)*sizeof(char);
     452                fwrite(&length,sizeof(int),1,fid);
     453                fwrite(this->result_name,length,1,fid);
     454
     455                /*Now write time and step: */
     456                IssmPDouble passiveDouble=reCast<IssmPDouble>(time);
     457                fwrite(&passiveDouble,sizeof(IssmPDouble),1,fid);
     458                fwrite(&step,sizeof(int),1,fid);
     459
     460                /*writing a IssmDouble array, type is 3:*/
     461                int type=3;
     462                fwrite(&type,sizeof(int),1,fid);
     463                fwrite(&rows,sizeof(int),1,fid);
     464                fwrite(&cols,sizeof(int),1,fid);
     465                fwrite(pserialvalues,cols*rows*sizeof(IssmPDouble),1,fid);
     466        }
     467
     468        /*Clean up*/
     469        xDelete<IssmPDouble>(pserialvalues);
     470        xDelete<IssmDouble>(serialvalues);
     471
     472}
     473/*}}}*/
     474
    427475#endif  /* _EXTERNAL_RESULTOBJECT_H */
  • issm/trunk-jpl/src/c/classes/FemModel.cpp

    r16518 r16589  
    562562
    563563                                        }
    564                                         Vector<IssmPDouble> *vector_result = new Vector<IssmPDouble>(this->vertices->NumberOfVertices());
     564                                        Vector<IssmDouble> *vector_result = new Vector<IssmDouble>(this->vertices->NumberOfVertices());
    565565
    566566                                        /*Fill in vector*/
     
    571571                                        vector_result->Assemble();
    572572
    573                                         results->AddResult(new GenericExternalResult<Vector<IssmPDouble>*>(results->Size()+1,output_enum,vector_result,step,time));
     573                                        results->AddResult(new GenericExternalResult<Vector<IssmDouble>*>(results->Size()+1,output_enum,vector_result,step,time));
    574574                                        isvec = true;
    575575                                        break;
Note: See TracChangeset for help on using the changeset viewer.