Changeset 11317 for issm/trunk-jpl/src/c/objects/Elements/Penta.cpp
- Timestamp:
- 02/03/12 13:50:06 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/objects/Elements/Penta.cpp
r11314 r11317 1607 1607 this->results->AddObject((Object*)input->SpawnResult(step,time)); 1608 1608 #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 } 1610 1612 #endif 1611 1613 … … 5129 5131 } 5130 5132 /*}}}*/ 5133 /*FUNCTION Penta::GetVectorFromControlInputs{{{1*/ 5134 void 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*/ 5153 void 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 /*}}}*/ 5131 5187 #endif 5132 5188
Note:
See TracChangeset
for help on using the changeset viewer.