Changeset 24344
- Timestamp:
- 11/17/19 07:34:15 (5 years ago)
- Location:
- issm/trunk-jpl/src/c
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/analyses/HydrologyDCEfficientAnalysis.cpp
r24335 r24344 689 689 } 690 690 } 691 basalelement->AddInput2(HydrologydcEplThicknessSubstepEnum,epl_thickness,basalelement->GetElementType());691 element->AddBasalInput2(HydrologydcEplThicknessSubstepEnum,epl_thickness,basalelement->GetElementType()); 692 692 693 693 if(domaintype!=Domain2DhorizontalEnum){ -
issm/trunk-jpl/src/c/classes/Elements/Element.cpp
r24340 r24344 3282 3282 3283 3283 /*If this input is not already in Inputs, maybe it needs to be computed?*/ 3284 Input2* input2 = this->GetInput2(output_enum); 3285 if(!input2) _error_("input "<<EnumToStringx(output_enum)<<" not found in element"); 3284 switch(this->inputs2->GetInputObjectEnum(output_enum)){ 3285 case TriaInput2Enum: 3286 case PentaInput2Enum:{ 3287 Input2* input2 = this->GetInput2(output_enum); 3288 if(!input2) _error_("input "<<EnumToStringx(output_enum)<<" not found in element"); 3289 *pinterpolation = input2->GetResultInterpolation(); 3290 *pnodesperelement = input2->GetResultNumberOfNodes(); 3291 *parray_size = input2->GetResultArraySize(); 3292 } 3293 break; 3294 case BoolInput2Enum: 3295 *pinterpolation = P0Enum; 3296 *pnodesperelement = 1; 3297 *parray_size = 1; 3298 break; 3299 default: 3300 _error_("Input type \""<<EnumToStringx(this->inputs2->GetInputObjectEnum(output_enum))<<"\" not supported yet"); 3301 } 3302 3286 3303 3287 3304 /*Assign output pointer*/ 3288 *pinterpolation = input2->GetResultInterpolation(); 3289 *pnodesperelement = input2->GetResultNumberOfNodes(); 3290 *parray_size = input2->GetResultArraySize(); 3305 3291 3306 return; 3292 3307 }/*}}}*/ … … 3311 3326 void Element::ResultToVector(Vector<IssmDouble>* vector,int output_enum){/*{{{*/ 3312 3327 3313 3314 Input2* input2=this->GetInput2(output_enum); 3315 if(!input2) _error_("input "<<EnumToStringx(output_enum)<<" not found in element"); 3316 3317 switch(input2->GetResultInterpolation()){ 3318 case P0Enum:{ 3319 IssmDouble value; 3320 bool bvalue; 3321 switch(input2->ObjectEnum()){ 3322 case BoolInputEnum: 3323 (xDynamicCast<BoolInput2*>(input2))->GetInput(&bvalue,this->lid); 3324 value=reCast<IssmDouble>(bvalue); 3325 break; 3326 default: 3327 Gauss* gauss = this->NewGauss(); 3328 input2->GetInputValue(&value,gauss); 3329 delete gauss; 3330 } 3331 vector->SetValue(this->Sid(),value,INS_VAL); 3332 break; 3333 } 3334 case P1Enum:{ 3335 const int NUM_VERTICES = this->GetNumberOfVertices(); 3336 3337 IssmDouble *values = xNew<IssmDouble>(NUM_VERTICES); 3338 int *connectivity= xNew<int>(NUM_VERTICES); 3339 int *sidlist = xNew<int>(NUM_VERTICES); 3340 3341 this->GetVerticesSidList(sidlist); 3342 this->GetVerticesConnectivityList(connectivity); 3343 this->GetInputListOnVertices(values,output_enum); 3344 for(int i=0;i<NUM_VERTICES;i++) values[i] = values[i]/reCast<IssmDouble>(connectivity[i]); 3345 3346 vector->SetValues(NUM_VERTICES,sidlist,values,ADD_VAL); 3347 3348 xDelete<IssmDouble>(values); 3349 xDelete<int>(connectivity); 3350 xDelete<int>(sidlist); 3351 break; 3352 } 3353 default: 3354 _error_("interpolation "<<EnumToStringx(input2->GetResultInterpolation())<<" not supported yet"); 3355 } 3328 switch(this->inputs2->GetInputObjectEnum(output_enum)){ 3329 case TriaInput2Enum: 3330 case PentaInput2Enum:{ 3331 3332 Input2* input2 = this->GetInput2(output_enum); 3333 if(!input2) _error_("input "<<EnumToStringx(output_enum)<<" not found in element"); 3334 3335 switch(input2->GetResultInterpolation()){ 3336 case P0Enum:{ 3337 IssmDouble value; 3338 bool bvalue; 3339 Gauss* gauss = this->NewGauss(); 3340 input2->GetInputValue(&value,gauss); 3341 delete gauss; 3342 vector->SetValue(this->Sid(),value,INS_VAL); 3343 break; 3344 } 3345 case P1Enum:{ 3346 const int NUM_VERTICES = this->GetNumberOfVertices(); 3347 3348 IssmDouble *values = xNew<IssmDouble>(NUM_VERTICES); 3349 int *connectivity= xNew<int>(NUM_VERTICES); 3350 int *sidlist = xNew<int>(NUM_VERTICES); 3351 3352 this->GetVerticesSidList(sidlist); 3353 this->GetVerticesConnectivityList(connectivity); 3354 this->GetInputListOnVertices(values,output_enum); 3355 for(int i=0;i<NUM_VERTICES;i++) values[i] = values[i]/reCast<IssmDouble>(connectivity[i]); 3356 3357 vector->SetValues(NUM_VERTICES,sidlist,values,ADD_VAL); 3358 3359 xDelete<IssmDouble>(values); 3360 xDelete<int>(connectivity); 3361 xDelete<int>(sidlist); 3362 break; 3363 } 3364 default: 3365 _error_("interpolation "<<EnumToStringx(input2->GetResultInterpolation())<<" not supported yet"); 3366 } 3367 } 3368 break; 3369 case BoolInput2Enum: 3370 bool bvalue; 3371 this->GetInput2Value(&bvalue,output_enum); 3372 vector->SetValue(this->Sid(),reCast<IssmDouble>(bvalue),INS_VAL); 3373 break; 3374 default: 3375 _error_("Input type \""<<EnumToStringx(this->inputs2->GetInputObjectEnum(output_enum))<<"\" not supported yet"); 3376 } 3377 3356 3378 } /*}}}*/ 3357 3379 void Element::SetBoolInput(Inputs2* inputs2,int enum_in,bool value){/*{{{*/ -
issm/trunk-jpl/src/c/classes/Elements/Tria.cpp
r24342 r24344 194 194 if(!this->inputs2){ 195 195 int* temp = xNew<int>(3); 196 _error_("inputs2 not set"); 196 197 } 197 198 _assert_(this->inputs2); -
issm/trunk-jpl/src/c/classes/Inputs2/BoolInput2.cpp
r24335 r24344 44 44 void BoolInput2::DeepEcho(void){/*{{{*/ 45 45 46 //_printf_(setw(15)<<" BoolInput2 "<<setw(25)<<left<<EnumToStringx(this->enum_type)<<" "<<(value?"true":"false") << "\n"); 47 _error_("Not implemented"); 46 _printf_("BoolInput2 Echo:\n"); 47 _printf_(" Size: "<<size<<"\n"); 48 printarray(this->values,this->size); 48 49 } 49 50 /*}}}*/ -
issm/trunk-jpl/src/c/classes/Inputs2/Inputs2.cpp
r24340 r24344 246 246 } 247 247 /*}}}*/ 248 int Inputs2::GetInputObjectEnum(int enum_in){/*{{{*/ 249 250 _assert_(this); 251 252 int index = EnumToIndex(enum_in); 253 if(!this->inputs[index]) _error_("Input "<<EnumToStringx(enum_in)<<" not found"); 254 return this->inputs[index]->ObjectEnum(); 255 } 256 /*}}}*/ 248 257 void Inputs2::GetInputsInterpolations(int* pnuminputs,int** pinterpolations,int** pinputenums){/*{{{*/ 249 258 -
issm/trunk-jpl/src/c/classes/Inputs2/Inputs2.h
r24340 r24344 60 60 ControlInput2* GetControlInput2(int enum_type); 61 61 void Marshall(char** pmarshalled_data, int* pmarshalled_data_size, int marshall_direction); 62 int GetInputObjectEnum(int enum_type); 62 63 void GetInputValue(bool* pvalue,int enum_in,int index); 63 64 void GetInputValue(int* pvalue,int enum_in,int index);
Note:
See TracChangeset
for help on using the changeset viewer.