Ignore:
Timestamp:
02/03/12 13:50:06 (13 years ago)
Author:
Mathieu Morlighem
Message:

Added 2 modules to make TAO work

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/objects/Elements/Penta.cpp

    r11314 r11317  
    16071607        this->results->AddObject((Object*)input->SpawnResult(step,time));
    16081608        #ifdef _HAVE_CONTROL_
    1609         if(input->ObjectEnum()==ControlInputEnum) this->results->AddObject((Object*)((ControlInput*)input)->SpawnGradient(step,time));
     1609        if(input->ObjectEnum()==ControlInputEnum){
     1610                if(((ControlInput*)input)->gradient!=NULL) this->results->AddObject((Object*)((ControlInput*)input)->SpawnGradient(step,time));
     1611        }
    16101612        #endif
    16111613
     
    51295131}
    51305132/*}}}*/
     5133/*FUNCTION Penta::GetVectorFromControlInputs{{{1*/
     5134void  Penta::GetVectorFromControlInputs(Vec vector,int control_enum,int control_index){
     5135
     5136        int doflist1[NUMVERTICES];
     5137
     5138        /*Get out if this is not an element input*/
     5139        if(!IsInput(control_enum)) return;
     5140
     5141        /*Prepare index list*/
     5142        GradientIndexing(&doflist1[0],control_index);
     5143
     5144        /*Get input (either in element or material)*/
     5145        Input* input=inputs->GetInput(control_enum);
     5146        if(!input) _error_("Input %s not found in element",EnumToStringx(control_enum));
     5147
     5148        /*We found the enum.  Use its values to fill into the vector, using the vertices ids: */
     5149        input->GetVectorFromInputs(vector,&doflist1[0]);
     5150}
     5151/*}}}*/
     5152/*FUNCTION Penta::SetControlInputsFromVector{{{1*/
     5153void  Penta::SetControlInputsFromVector(double* vector,int control_enum,int control_index){
     5154
     5155        double  values[NUMVERTICES];
     5156        int     doflist1[NUMVERTICES];
     5157        Input  *input     = NULL;
     5158        Input  *new_input = NULL;
     5159
     5160        /*Get out if this is not an element input*/
     5161        if(!IsInput(control_enum)) return;
     5162
     5163        /*Prepare index list*/
     5164        GradientIndexing(&doflist1[0],control_index);
     5165
     5166        /*Get values on vertices*/
     5167        for (int i=0;i<NUMVERTICES;i++){
     5168                values[i]=vector[doflist1[i]];
     5169        }
     5170        new_input = new PentaP1Input(control_enum,values);
     5171
     5172
     5173        if(control_enum==MaterialsRheologyBbarEnum){
     5174                input=(Input*)matice->inputs->GetInput(control_enum); _assert_(input);
     5175        }
     5176        else{
     5177                input=(Input*)this->inputs->GetInput(control_enum);   _assert_(input);
     5178        }
     5179
     5180        if (input->ObjectEnum()!=ControlInputEnum){
     5181                _error_("input %s is not a ControlInput",EnumToStringx(control_enum));
     5182        }
     5183
     5184        ((ControlInput*)input)->SetInput(new_input);
     5185}
     5186/*}}}*/
    51315187#endif
    51325188
Note: See TracChangeset for help on using the changeset viewer.