Changeset 8386


Ignore:
Timestamp:
05/21/11 12:13:08 (14 years ago)
Author:
Mathieu Morlighem
Message:

trunk: more flexible GetVectorFromInput (input could be in material)

Location:
issm/trunk/src/c/objects
Files:
9 edited

Legend:

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

    r8376 r8386  
    36173617/*}}}*/
    36183618/*FUNCTION Penta::GetVectorFromInputs{{{1*/
    3619 void  Penta::GetVectorFromInputs(Vec vector,int NameEnum){
    3620 
    3621         int i;
     3619void  Penta::GetVectorFromInputs(Vec vector,int input_enum){
     3620
    36223621        int doflist1[NUMVERTICES];
    36233622
    3624         /*Find NameEnum input in the inputs dataset, and get it to fill in the vector: */
    3625         for(i=0;i<this->inputs->Size();i++){
    3626                 Input* input=(Input*)this->inputs->GetObjectByOffset(i);
    3627                 if(input->EnumType()==NameEnum){
    3628                         /*We found the enum.  Use its values to fill into the vector, using the vertices ids: */
    3629                         this->GetDofList1(&doflist1[0]);
    3630                         input->GetVectorFromInputs(vector,&doflist1[0]);
    3631                         break;
    3632                 }
    3633         }
     3623        /*Get out if this is not an element input*/
     3624        if (!IsInput(input_enum)) return;
     3625
     3626        /*Prepare index list*/
     3627        this->GetDofList1(&doflist1[0]);
     3628
     3629        /*Get input (either in element or material)*/
     3630        Input* input=inputs->GetInput(input_enum);
     3631        if(!input) _error_("Input %s not found in element",EnumToStringx(input_enum));
     3632
     3633        /*We found the enum.  Use its values to fill into the vector, using the vertices ids: */
     3634        input->GetVectorFromInputs(vector,&doflist1[0]);
    36343635}
    36353636/*}}}*/
  • issm/trunk/src/c/objects/Elements/Tria.cpp

    r8376 r8386  
    31763176/*}}}*/
    31773177/*FUNCTION Tria::GetVectorFromInputs{{{1*/
    3178 void  Tria::GetVectorFromInputs(Vec vector,int NameEnum){
     3178void  Tria::GetVectorFromInputs(Vec vector,int input_enum){
    31793179
    31803180        int doflist1[NUMVERTICES];
    31813181
    3182         /*Find NameEnum input in the inputs dataset, and get it to fill in the vector: */
    3183         for(int i=0;i<this->inputs->Size();i++){
    3184                 Input* input=(Input*)this->inputs->GetObjectByOffset(i);
    3185                 if(input->EnumType()==NameEnum){
    3186                         /*We found the enum.  Use its values to fill into the vector, using the vertices ids: */
    3187                         this->GetDofList1(&doflist1[0]);
    3188                         input->GetVectorFromInputs(vector,&doflist1[0]);
    3189                         break;
    3190                 }
    3191         }
     3182        /*Get out if this is not an element input*/
     3183        if (!IsInput(input_enum)) return;
     3184
     3185        /*Prepare index list*/
     3186        this->GetDofList1(&doflist1[0]);
     3187
     3188        /*Get input (either in element or material)*/
     3189        Input* input=inputs->GetInput(input_enum);
     3190        if(!input) _error_("Input %s not found in element",EnumToStringx(input_enum));
     3191
     3192        /*We found the enum.  Use its values to fill into the vector, using the vertices ids: */
     3193        input->GetVectorFromInputs(vector,&doflist1[0]);
    31923194}
    31933195/*}}}*/
  • issm/trunk/src/c/objects/FemModel.cpp

    r8263 r8386  
    131131        printf("     %i: %s\n",analysis_counter,EnumToStringx(analysis_type_list[analysis_counter]));
    132132
    133 
    134133}
    135134/*}}}*/
  • issm/trunk/src/c/objects/Inputs/ControlInput.cpp

    r8363 r8386  
    396396        return gradient->SpawnResult(step,time);
    397397}/*}}}*/
     398/*FUNCTION ControlInput::GetParameterValue(bool* pvalue){{{1*/
     399void ControlInput::GetVectorFromInputs(Vec vector,int* doflist){
     400        values->GetVectorFromInputs(vector,doflist);
     401}/*}}}*/
    398402/*FUNCTION ControlInput::GetParameterAverage(double* pvalue){{{1*/
    399403void ControlInput::GetParameterAverage(double* pvalue){
  • issm/trunk/src/c/objects/Inputs/ControlInput.h

    r8363 r8386  
    8282                void Extrude(void);
    8383                void VerticallyIntegrate(Input* thickness_input);
    84                 void GetVectorFromInputs(Vec vector,int* doflist){_error_("not implemented yet");};
     84                void GetVectorFromInputs(Vec vector,int* doflist);
    8585                void GetValuesPtr(double** pvalues,int* pnum_values){_error_("not implemented yet");};
    8686                ElementResult* SpawnGradient(int step, double time);
  • issm/trunk/src/c/objects/Materials/Material.h

    r6216 r8386  
    2222                virtual void   InputDuplicate(int original_enum,int new_enum)=0;
    2323                virtual void   Configure(Elements* elements)=0;
     24                virtual void   GetVectorFromInputs(Vec vector,int input_enum)=0;
    2425
    2526};
  • issm/trunk/src/c/objects/Materials/Matice.cpp

    r8224 r8386  
    224224        inputs->GetParameterAverage(&n,RheologyNEnum);
    225225        return n;
     226}
     227/*}}}*/
     228/*FUNCTION Matice::GetVectorFromInputs{{{1*/
     229void  Matice::GetVectorFromInputs(Vec vector,int input_enum){
     230
     231        /*Intermediaries*/
     232        Element *element= NULL;
     233
     234        /*Recover element*/
     235        element=(Element*)helement->delivers();
     236
     237        /*Check that input_enum is a material input*/
     238        if (!IsInput(input_enum)) return;
     239
     240        switch(element->Enum()){
     241
     242                case TriaEnum:
     243
     244                        /*Prepare index list*/
     245                        int doflist1[3];
     246                        for(int i=0;i<3;i++) doflist1[i]=((Tria*)element)->nodes[i]->GetVertexDof();
     247
     248                        /*Get input (either in element or material)*/
     249                        Input* input=inputs->GetInput(input_enum);
     250                        if(!input) _error_("Input %s not found in material",EnumToStringx(input_enum));
     251
     252                        /*We found the enum.  Use its values to fill into the vector, using the vertices ids: */
     253                        input->GetVectorFromInputs(vector,&doflist1[0]);
     254                        break;
     255
     256                default: _error_("element %s not implemented yet",EnumToStringx(element->Enum()));
     257        }
    226258}
    227259/*}}}*/
  • issm/trunk/src/c/objects/Materials/Matice.h

    r6216 r8386  
    5757                void   InputDuplicate(int original_enum,int new_enum);
    5858                void   Configure(Elements* elements);
     59                void   GetVectorFromInputs(Vec vector,int input_enum);
    5960                /*}}}*/
    6061                /*Matice Numerics: {{{1*/
  • issm/trunk/src/c/objects/Materials/Matpar.h

    r7640 r8386  
    6464                void   InputDuplicate(int original_enum,int new_enum){_error_("not implemented yet");};
    6565                void   Configure(Elements* elements);
     66                void   GetVectorFromInputs(Vec vector,int input_enum){return;}
    6667                /*}}}*/
    6768                /*Numerics: {{{1*/
Note: See TracChangeset for help on using the changeset viewer.