Changeset 17275
- Timestamp:
- 02/13/14 14:46:49 (11 years ago)
- Location:
- issm/trunk-jpl/src/c
- Files:
-
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/analyses/DamageEvolutionAnalysis.cpp
r17212 r17275 270 270 element->FindParam(&dt,TimesteppingTimeStepEnum); 271 271 this->CreateDamageFInput(element); 272 Input* damaged_input = element->Get MaterialInput(DamageDbarEnum); _assert_(damaged_input);273 Input* damagef_input = element->Get MaterialInput(DamageFEnum); _assert_(damagef_input);272 Input* damaged_input = element->GetInput(DamageDbarEnum); _assert_(damaged_input); 273 Input* damagef_input = element->GetInput(DamageFEnum); _assert_(damagef_input); 274 274 275 275 /* Start looping on the number of gaussian points: */ … … 378 378 379 379 /*Get all inputs and parameters*/ 380 element->Add MaterialInput(DamageDbarEnum,values,P1Enum);380 element->AddInput(DamageDbarEnum,values,P1Enum); 381 381 382 382 /*Free ressources:*/ … … 416 416 Input* sigma_xy_input = element->GetInput(StressTensorxyEnum); _assert_(sigma_xy_input); 417 417 Input* sigma_yy_input = element->GetInput(StressTensoryyEnum); _assert_(sigma_yy_input); 418 Input* damage_input = element->Get MaterialInput(DamageDbarEnum); _assert_(damage_input);418 Input* damage_input = element->GetInput(DamageDbarEnum); _assert_(damage_input); 419 419 420 420 /*Damage evolution z mapping: */ … … 442 442 443 443 /*Add input*/ 444 element->Add MaterialInput(DamageFEnum,f,P1Enum);444 element->AddInput(DamageFEnum,f,P1Enum); 445 445 446 446 /*Clean up and return*/ -
issm/trunk-jpl/src/c/analyses/EnthalpyAnalysis.cpp
r17212 r17275 790 790 case PatersonEnum: 791 791 for(i=0;i<numnodes;i++) B[i]=Paterson(temperature[i]); 792 element->Add MaterialInput(MaterialsRheologyBEnum,&B[0],P1Enum);792 element->AddInput(MaterialsRheologyBEnum,&B[0],P1Enum); 793 793 break; 794 794 case ArrheniusEnum: 795 795 element->GetVerticesCoordinates(&xyz_list); 796 796 for(i=0;i<numnodes;i++) B[i]=Arrhenius(temperature[i],surface[i]-xyz_list[i*3+2],element->GetMaterialParameter(MaterialsRheologyNEnum)); 797 element->Add MaterialInput(MaterialsRheologyBEnum,&B[0],P1Enum);797 element->AddInput(MaterialsRheologyBEnum,&B[0],P1Enum); 798 798 break; 799 799 case LliboutryDuvalEnum: 800 800 for(i=0;i<numnodes;i++) B[i]=LliboutryDuval(values[i],pressure[i],element->GetMaterialParameter(MaterialsRheologyNEnum),element->GetMaterialParameter(MaterialsBetaEnum),element->GetMaterialParameter(ConstantsReferencetemperatureEnum),element->GetMaterialParameter(MaterialsHeatcapacityEnum),element->GetMaterialParameter(MaterialsLatentheatEnum)); 801 element->Add MaterialInput(MaterialsRheologyBEnum,&B[0],P1Enum);801 element->AddInput(MaterialsRheologyBEnum,&B[0],P1Enum); 802 802 break; 803 803 default: _error_("Rheology law " << EnumToStringx(rheology_law) << " not supported yet"); -
issm/trunk-jpl/src/c/analyses/StressbalanceAnalysis.cpp
r17261 r17275 1044 1044 void StressbalanceAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/ 1045 1045 /*Default, do nothing*/ 1046 _printf0_(" Updating active and non-active nodes for StressbalanceAnalysis \n");1046 //_printf0_(" Updating active and non-active nodes for StressbalanceAnalysis \n"); 1047 1047 // SetActiveNodesLSMx(femmodel->elements); 1048 1048 return; -
issm/trunk-jpl/src/c/analyses/ThermalAnalysis.cpp
r17212 r17275 659 659 case PatersonEnum: 660 660 for(i=0;i<numnodes;i++) B[i]=Paterson(values[i]); 661 element->Add MaterialInput(MaterialsRheologyBEnum,&B[0],P1Enum);661 element->AddInput(MaterialsRheologyBEnum,&B[0],P1Enum); 662 662 break; 663 663 case ArrheniusEnum:{ 664 664 element->GetVerticesCoordinates(&xyz_list); 665 665 for(i=0;i<numnodes;i++) B[i]=Arrhenius(values[i],surface[i]-xyz_list[i*3+2],element->GetMaterialParameter(MaterialsRheologyNEnum)); 666 element->Add MaterialInput(MaterialsRheologyBEnum,&B[0],P1Enum);666 element->AddInput(MaterialsRheologyBEnum,&B[0],P1Enum); 667 667 break; 668 668 } -
issm/trunk-jpl/src/c/classes/Elements/Element.cpp
r17258 r17275 155 155 return this->matpar->GetMaterialParameter(enum_in); 156 156 } 157 } 158 /*}}}*/ 157 }/*}}}*/ 159 158 void Element::GetPhi(IssmDouble* phi, IssmDouble* epsilon, IssmDouble viscosity){/*{{{*/ 160 159 /*Compute deformational heating from epsilon and viscosity */ … … 227 226 return shelf; 228 227 }/*}}}*/ 228 bool Element::IsInput(int name){/*{{{*/ 229 if ( 230 name==ThicknessEnum || 231 name==SurfaceEnum || 232 name==BedEnum || 233 name==BathymetryEnum || 234 name==SurfaceSlopeXEnum || 235 name==SurfaceSlopeYEnum || 236 name==SurfaceforcingsMassBalanceEnum || 237 name==BasalforcingsMeltingRateEnum || 238 name==BasalforcingsGeothermalfluxEnum || 239 name==SurfaceAreaEnum|| 240 name==DamageDEnum || 241 name==DamageDbarEnum || 242 name==PressureEnum || 243 name==VxEnum || 244 name==VyEnum || 245 name==VzEnum || 246 name==VxMeshEnum || 247 name==VyMeshEnum || 248 name==VzMeshEnum || 249 name==InversionVxObsEnum || 250 name==InversionVyObsEnum || 251 name==InversionVzObsEnum || 252 name==TemperatureEnum || 253 name==EnthalpyEnum || 254 name==EnthalpyPicardEnum || 255 name==WaterfractionEnum|| 256 name==WatercolumnEnum || 257 name==FrictionCoefficientEnum || 258 name==MaskGroundediceLevelsetEnum || 259 name==MaskIceLevelsetEnum || 260 name==IceMaskNodeActivationEnum || 261 name==LevelsetfunctionSlopeXEnum || 262 name==LevelsetfunctionSlopeYEnum || 263 name==GradientEnum || 264 name==OldGradientEnum || 265 name==ConvergedEnum || 266 name==QmuVxEnum || 267 name==QmuVyEnum || 268 name==QmuVzEnum || 269 name==QmuVxMeshEnum || 270 name==QmuVyMeshEnum || 271 name==QmuVzMeshEnum || 272 name==QmuPressureEnum || 273 name==QmuBedEnum || 274 name==QmuThicknessEnum || 275 name==QmuSurfaceEnum || 276 name==QmuTemperatureEnum || 277 name==QmuMeltingEnum || 278 name==QmuMaskGroundediceLevelsetEnum || 279 name==QmuMaskIceLevelsetEnum || 280 name==QmuMaterialsRheologyBEnum || 281 name==MaterialsRheologyBEnum || 282 name==MaterialsRheologyBbarEnum || 283 name==MaterialsRheologyNEnum || 284 name==GiaWEnum || 285 name==GiadWdtEnum || 286 name==SedimentHeadEnum || 287 name==EplHeadEnum || 288 name==SedimentHeadOldEnum || 289 name==EplHeadOldEnum || 290 name==HydrologydcEplThicknessOldEnum || 291 name==HydrologydcEplInitialThicknessEnum || 292 name==HydrologydcEplThicknessEnum || 293 name==HydrologydcMaskEplactiveNodeEnum || 294 name==MeshVertexonbedEnum || 295 name==WaterTransferEnum 296 297 ) { 298 return true; 299 } 300 else return false; 301 } 302 /*}}}*/ 229 303 void Element::ResultInterpolation(int* pinterpolation,int* pnodesperelement,int output_enum){/*{{{*/ 230 304 -
issm/trunk-jpl/src/c/classes/Elements/Element.h
r17257 r17275 65 65 void GetVerticesSidList(int* sidlist); 66 66 void GetVerticesConnectivityList(int* connectivitylist); 67 bool IsInput(int name); 67 68 bool IsFloating(); 68 69 void ResultInterpolation(int* pinterpolation,int*nodesperelement,int output_enum); … … 106 107 virtual void AddBasalInput(int input_enum, IssmDouble* values, int interpolation_enum)=0; 107 108 virtual void AddInput(int input_enum, IssmDouble* values, int interpolation_enum)=0; 108 virtual void AddMaterialInput(int input_enum, IssmDouble* values, int interpolation_enum)=0;109 109 virtual IssmDouble CharacteristicLength(void)=0; 110 110 virtual void Configure(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters)=0; … … 164 164 virtual void GetInputListOnVertices(IssmDouble* pvalue,int enumtype)=0; 165 165 virtual void GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue)=0; 166 virtual Input* GetMaterialInput(int inputenum)=0;167 166 virtual void GetInputValue(IssmDouble* pvalue,Node* node,int enumtype)=0; 168 167 virtual void GetInputValue(bool* pvalue,int enum_type)=0; … … 177 176 virtual IssmDouble GetYcoord(Gauss* gauss)=0; 178 177 virtual IssmDouble GetZcoord(Gauss* gauss)=0; 179 virtual void GetMaterialInputValue(IssmDouble* pvalue,Node* node,int enumtype)=0;180 178 virtual int GetElementType(void)=0; 181 179 182 180 virtual IssmDouble SurfaceArea(void)=0; 183 virtual void InputDepthAverageAtBase(int enum_type,int average_enum_type ,int object_enum)=0;181 virtual void InputDepthAverageAtBase(int enum_type,int average_enum_type)=0; 184 182 virtual void InputChangeName(int enum_type,int enum_type_old)=0; 185 183 virtual void ComputeBasalStress(Vector<IssmDouble>* sigma_b)=0; -
issm/trunk-jpl/src/c/classes/Elements/Penta.cpp
r17274 r17275 139 139 else _error_("not implemented yet"); 140 140 } 141 }142 /*}}}*/143 /*FUNCTION Penta::AddMaterialInput{{{*/144 void Penta::AddMaterialInput(int input_enum,IssmDouble* values, int interpolation_enum){145 146 _assert_(this->material);147 this->material->inputs->AddInput(new PentaInput(input_enum,values,interpolation_enum));148 141 } 149 142 /*}}}*/ … … 465 458 this->inputs->AddInput(NewPrecipitationInput); 466 459 467 this->InputExtrude(SurfaceforcingsMonthlytemperaturesEnum ,ElementEnum);468 this->InputExtrude(SurfaceforcingsPrecipitationEnum ,ElementEnum);460 this->InputExtrude(SurfaceforcingsMonthlytemperaturesEnum); 461 this->InputExtrude(SurfaceforcingsPrecipitationEnum); 469 462 470 463 /*clean-up*/ … … 974 967 } 975 968 /*}}}*/ 976 /*FUNCTION Penta::GetMaterialInput(int inputenum) {{{*/977 Input* Penta::GetMaterialInput(int inputenum){978 return this->material->inputs->GetInput(inputenum);979 }980 /*}}}*/981 969 /*FUNCTION Penta::GetInputListOnVertices(IssmDouble* pvalue,int enumtype) {{{*/ 982 970 void Penta::GetInputListOnVertices(IssmDouble* pvalue,int enumtype){ … … 1138 1126 1139 1127 }/*}}}*/ 1140 /*FUNCTION Penta::GetMaterialInputValue(IssmDouble* pvalue,Node* node,int enumtype) {{{*/1141 void Penta::GetMaterialInputValue(IssmDouble* pvalue,Node* node,int enumtype){1142 1143 Input* input=this->material->inputs->GetInput(enumtype);1144 if(!input) _error_("No input of type " << EnumToStringx(enumtype) << " found in tria");1145 1146 GaussPenta* gauss=new GaussPenta();1147 gauss->GaussVertex(this->GetNodeIndex(node));1148 1149 input->GetInputValue(pvalue,gauss);1150 delete gauss;1151 }1152 /*}}}*/1153 1128 /*FUNCTION Penta::NormalSection{{{*/ 1154 1129 void Penta::NormalSection(IssmDouble* normal,IssmDouble* xyz_list){ … … 1500 1475 /*}}}*/ 1501 1476 /*FUNCTION Penta::InputDepthAverageAtBase{{{*/ 1502 void Penta::InputDepthAverageAtBase(int enum_type,int average_enum_type ,int object_enum){1477 void Penta::InputDepthAverageAtBase(int enum_type,int average_enum_type){ 1503 1478 1504 1479 int step,i; … … 1528 1503 1529 1504 /*Step1: Get original input (to be depth avegaged): */ 1530 if (object_enum==MeshElementsEnum) 1531 original_input=(Input*)penta->inputs->GetInput(enum_type); 1532 else if (object_enum==MaterialsEnum) 1533 original_input=(Input*)penta->material->inputs->GetInput(enum_type); 1534 else 1535 _error_("object " << EnumToStringx(object_enum) << " not supported yet"); 1505 original_input=(Input*)penta->inputs->GetInput(enum_type); 1536 1506 if(!original_input) _error_("could not find input with enum " << EnumToStringx(enum_type)); 1537 1507 … … 1589 1559 1590 1560 /*Finally, add to inputs*/ 1591 if (object_enum==MeshElementsEnum) 1592 this->inputs->AddInput((Input*)depth_averaged_input); 1593 else if (object_enum==MaterialsEnum) 1594 this->material->inputs->AddInput((Input*)depth_averaged_input); 1595 else 1596 _error_("object " << EnumToStringx(object_enum) << " not supported yet"); 1561 this->inputs->AddInput((Input*)depth_averaged_input); 1597 1562 } 1598 1563 /*}}}*/ … … 1606 1571 /*}}}*/ 1607 1572 /*FUNCTION Penta::InputExtrude {{{*/ 1608 void Penta::InputExtrude(int enum_type ,int object_type){1573 void Penta::InputExtrude(int enum_type){ 1609 1574 1610 1575 int i,num_inputs; … … 1617 1582 1618 1583 /*Step1: Get and Extrude original input: */ 1619 if(object_type==ElementEnum){ 1620 num_inputs=1; 1621 base_inputs=xNew<Input*>(num_inputs); 1622 base_inputs[0]=(Input*)this->inputs->GetInput(enum_type); 1623 } 1624 else if(object_type==MaterialsEnum){ 1625 num_inputs=1; 1626 base_inputs=xNew<Input*>(num_inputs); 1627 base_inputs[0]=(Input*)material->inputs->GetInput(enum_type); 1628 } 1629 else{ 1630 _error_("object of type " << EnumToStringx(object_type) << " not supported yet"); 1631 } 1584 num_inputs=1; 1585 base_inputs=xNew<Input*>(num_inputs); 1586 base_inputs[0]=(Input*)this->inputs->GetInput(enum_type); 1632 1587 for(i=0;i<num_inputs;i++){ 1633 if(!base_inputs[i]) _error_("could not find input with enum " << EnumToStringx(enum_type) << " in object " << EnumToStringx(object_type));1588 if(!base_inputs[i]) _error_("could not find input with enum " << EnumToStringx(enum_type)); 1634 1589 base_inputs[i]->Extrude(); 1635 1590 } … … 1648 1603 for(i=0;i<num_inputs;i++){ 1649 1604 copy=(Input*)base_inputs[i]->copy(); 1650 if (object_type==ElementEnum){ 1651 penta->inputs->AddInput((Input*)copy); 1652 } 1653 else if(object_type==MaterialsEnum){ 1654 penta->material->inputs->AddInput((Input*)copy); 1655 } 1656 else{ 1657 _error_("object of type " << EnumToStringx(object_type) << " not supported yet"); 1658 } 1605 penta->inputs->AddInput((Input*)copy); 1659 1606 } 1660 1607 … … 1774 1721 } 1775 1722 break; 1776 /*Material will take care of it*/ 1777 case MaterialsRheologyBbarEnum: break; 1778 case DamageDbarEnum:break; 1723 case MaterialsRheologyBbarEnum: 1724 if(iomodel->Data(MaterialsRheologyBEnum)){ 1725 for(j=0;j<6;j++) nodeinputs[j]=iomodel->Data(MaterialsRheologyBEnum)[penta_vertex_ids[j]-1]; 1726 for(j=0;j<6;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i]; 1727 for(j=0;j<6;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i]; 1728 this->inputs->AddInput(new ControlInput(MaterialsRheologyBEnum,PentaInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1)); 1729 } 1730 break; 1731 case DamageDbarEnum: 1732 if(iomodel->Data(DamageDEnum)){ 1733 for(j=0;j<6;j++) nodeinputs[j]=iomodel->Data(DamageDEnum)[penta_vertex_ids[j]-1]; 1734 for(j=0;j<6;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i]; 1735 for(j=0;j<6;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(penta_vertex_ids[j]-1)*num_control_type+i]; 1736 this->inputs->AddInput(new ControlInput(DamageDEnum,PentaInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1)); 1737 } 1738 break; 1779 1739 default: 1780 1740 _error_("Control " << EnumToStringx(reCast<int,IssmDouble>(iomodel->Data(InversionControlParametersEnum)[i])) << " not implemented yet"); … … 1944 1904 inputs->GetInputValue(&onsurface,MeshElementonsurfaceEnum); 1945 1905 return onsurface; 1946 }1947 /*}}}*/1948 /*FUNCTION Penta::IsInput{{{*/1949 bool Penta::IsInput(int name){1950 if (1951 name==ThicknessEnum ||1952 name==SurfaceEnum ||1953 name==BedEnum ||1954 name==BathymetryEnum ||1955 name==SurfaceSlopeXEnum ||1956 name==SurfaceSlopeYEnum ||1957 name==SurfaceforcingsMassBalanceEnum ||1958 name==BasalforcingsMeltingRateEnum ||1959 name==BasalforcingsGeothermalfluxEnum ||1960 name==SurfaceAreaEnum||1961 name==PressureEnum ||1962 name==VxEnum ||1963 name==VyEnum ||1964 name==VzEnum ||1965 name==VxMeshEnum ||1966 name==VyMeshEnum ||1967 name==VzMeshEnum ||1968 name==InversionVxObsEnum ||1969 name==InversionVyObsEnum ||1970 name==InversionVzObsEnum ||1971 name==TemperatureEnum ||1972 name==EnthalpyEnum ||1973 name==EnthalpyPicardEnum ||1974 name==WaterfractionEnum||1975 name==FrictionCoefficientEnum ||1976 name==MaskGroundediceLevelsetEnum ||1977 name==MaskIceLevelsetEnum ||1978 name==IceMaskNodeActivationEnum ||1979 name==LevelsetfunctionSlopeXEnum ||1980 name==LevelsetfunctionSlopeYEnum ||1981 name==GradientEnum ||1982 name==OldGradientEnum ||1983 name==ConvergedEnum ||1984 name==QmuVxEnum ||1985 name==QmuVyEnum ||1986 name==QmuVzEnum ||1987 name==QmuVxMeshEnum ||1988 name==QmuVyMeshEnum ||1989 name==QmuVzMeshEnum ||1990 name==QmuPressureEnum ||1991 name==QmuBedEnum ||1992 name==QmuThicknessEnum ||1993 name==QmuSurfaceEnum ||1994 name==QmuTemperatureEnum ||1995 name==QmuMeltingEnum ||1996 name==QmuMaskGroundediceLevelsetEnum ||1997 name==QmuMaskIceLevelsetEnum ||1998 name==GiaWEnum ||1999 name==GiadWdtEnum ||2000 name==SedimentHeadEnum ||2001 name==EplHeadEnum ||2002 name==SedimentHeadOldEnum ||2003 name==EplHeadOldEnum ||2004 name==HydrologydcEplThicknessOldEnum ||2005 name==HydrologydcEplInitialThicknessEnum ||2006 name==HydrologydcEplThicknessEnum ||2007 name==HydrologydcMaskEplactiveNodeEnum ||2008 name==WaterTransferEnum2009 2010 ) {2011 return true;2012 }2013 else return false;2014 1906 } 2015 1907 /*}}}*/ … … 2354 2246 this->inputs->AddInput(new PentaInput(SurfaceforcingsMassBalanceEnum,&agd[0],P1Enum)); 2355 2247 //this->inputs->AddInput(new PentaVertexInput(ThermalSpcTemperatureEnum,&Tsurf[0])); 2356 this->InputExtrude(SurfaceforcingsMassBalanceEnum ,ElementEnum);2248 this->InputExtrude(SurfaceforcingsMassBalanceEnum); 2357 2249 2358 2250 /*clean-up*/ … … 2579 2471 2580 2472 /*Spawn material*/ 2581 tria->material=(Material*)this->material->copy(); 2582 delete tria->material->inputs; 2583 tria->material->inputs=(Inputs*)this->material->inputs->SpawnTriaInputs(location); 2473 tria->material=(Material*)this->material->copy(tria); 2584 2474 2585 2475 /*recover nodes, material and matpar: */ … … 2597 2487 _assert_(this->IsOnBed()); 2598 2488 2599 this->InputDepthAverageAtBase(MaterialsRheologyBEnum,MaterialsRheologyBbarEnum ,MaterialsEnum);2600 this->InputDepthAverageAtBase(DamageDEnum,DamageDbarEnum ,MaterialsEnum);2489 this->InputDepthAverageAtBase(MaterialsRheologyBEnum,MaterialsRheologyBbarEnum); 2490 this->InputDepthAverageAtBase(DamageDEnum,DamageDbarEnum); 2601 2491 if(this->inputs->GetInput(VxEnum)) this->InputDepthAverageAtBase(VxEnum,VxAverageEnum); 2602 2492 if(this->inputs->GetInput(VyEnum)) this->InputDepthAverageAtBase(VyEnum,VyAverageEnum); 2603 2493 Tria* tria=(Tria*)SpawnTria(0); //lower face is 0, upper face is 1. 2604 this-> material->inputs->DeleteInput(MaterialsRheologyBbarEnum);2605 this-> material->inputs->DeleteInput(DamageDbarEnum);2494 this->inputs->DeleteInput(MaterialsRheologyBbarEnum); 2495 this->inputs->DeleteInput(DamageDbarEnum); 2606 2496 this->inputs->DeleteInput(VxAverageEnum); 2607 2497 this->inputs->DeleteInput(VyAverageEnum); … … 3491 3381 if(enum_type==MaterialsRheologyBbarEnum){ 3492 3382 if(!IsOnBed()) return; 3493 input=(Input*) material->inputs->GetInput(MaterialsRheologyBEnum);3383 input=(Input*)inputs->GetInput(MaterialsRheologyBEnum); 3494 3384 } 3495 3385 else if(enum_type==DamageDbarEnum){ 3496 3386 if(!IsOnBed()) return; 3497 input=(Input*) material->inputs->GetInput(DamageDEnum);3387 input=(Input*)inputs->GetInput(DamageDEnum); 3498 3388 } 3499 3389 else{ … … 3513 3403 3514 3404 if(enum_type==MaterialsRheologyBbarEnum){ 3515 input=(Input*) material->inputs->GetInput(MaterialsRheologyBEnum);3405 input=(Input*)inputs->GetInput(MaterialsRheologyBEnum); 3516 3406 } 3517 3407 else if(enum_type==DamageDbarEnum){ 3518 input=(Input*) material->inputs->GetInput(DamageDEnum);3408 input=(Input*)inputs->GetInput(DamageDEnum); 3519 3409 } 3520 3410 else{ … … 3535 3425 3536 3426 if(enum_type==MaterialsRheologyBbarEnum){ 3537 input=(Input*) material->inputs->GetInput(MaterialsRheologyBEnum);3427 input=(Input*)inputs->GetInput(MaterialsRheologyBEnum); 3538 3428 } 3539 3429 else if(enum_type==DamageDbarEnum){ 3540 input=(Input*) material->inputs->GetInput(DamageDEnum);3430 input=(Input*)inputs->GetInput(DamageDEnum); 3541 3431 } 3542 3432 else{ … … 3558 3448 3559 3449 if(control_enum==MaterialsRheologyBbarEnum){ 3560 input=(Input*) material->inputs->GetInput(MaterialsRheologyBEnum);3450 input=(Input*)inputs->GetInput(MaterialsRheologyBEnum); 3561 3451 } 3562 3452 else if(control_enum==DamageDbarEnum){ 3563 input=(Input*) material->inputs->GetInput(DamageDEnum);3453 input=(Input*)inputs->GetInput(DamageDEnum); 3564 3454 } 3565 3455 else{ … … 3883 3773 3884 3774 /*Depth Average B*/ 3885 this->InputDepthAverageAtBase(MaterialsRheologyBEnum,MaterialsRheologyBbarEnum ,MaterialsEnum);3886 this->InputDepthAverageAtBase(DamageDEnum,DamageDbarEnum ,MaterialsEnum);3775 this->InputDepthAverageAtBase(MaterialsRheologyBEnum,MaterialsRheologyBbarEnum); 3776 this->InputDepthAverageAtBase(DamageDEnum,DamageDbarEnum); 3887 3777 3888 3778 /*Collapse element to the base*/ … … 3892 3782 3893 3783 /*delete Average B*/ 3894 this-> material->inputs->DeleteInput(MaterialsRheologyBbarEnum);3895 this-> material->inputs->DeleteInput(DamageDbarEnum);3784 this->inputs->DeleteInput(MaterialsRheologyBbarEnum); 3785 this->inputs->DeleteInput(DamageDbarEnum); 3896 3786 3897 3787 } /*}}}*/ … … 3903 3793 3904 3794 /*Depth Average B and D*/ 3905 this->InputDepthAverageAtBase(MaterialsRheologyBEnum,MaterialsRheologyBbarEnum ,MaterialsEnum);3906 this->InputDepthAverageAtBase(DamageDEnum,DamageDbarEnum ,MaterialsEnum);3795 this->InputDepthAverageAtBase(MaterialsRheologyBEnum,MaterialsRheologyBbarEnum); 3796 this->InputDepthAverageAtBase(DamageDEnum,DamageDbarEnum); 3907 3797 3908 3798 /*Collapse element to the base*/ … … 3912 3802 3913 3803 /*delete Average B*/ 3914 this-> material->inputs->DeleteInput(MaterialsRheologyBbarEnum);3915 this-> material->inputs->DeleteInput(DamageDbarEnum);3804 this->inputs->DeleteInput(MaterialsRheologyBbarEnum); 3805 this->inputs->DeleteInput(DamageDbarEnum); 3916 3806 } /*}}}*/ 3917 3807 /*FUNCTION Penta::GradjBbarFS {{{*/ … … 3922 3812 3923 3813 /*Depth Average B and D*/ 3924 this->InputDepthAverageAtBase(MaterialsRheologyBEnum,MaterialsRheologyBbarEnum ,MaterialsEnum);3925 this->InputDepthAverageAtBase(DamageDEnum,DamageDbarEnum ,MaterialsEnum);3814 this->InputDepthAverageAtBase(MaterialsRheologyBEnum,MaterialsRheologyBbarEnum); 3815 this->InputDepthAverageAtBase(DamageDEnum,DamageDbarEnum); 3926 3816 3927 3817 /*Collapse element to the base*/ … … 3931 3821 3932 3822 /*delete Average B*/ 3933 this-> material->inputs->DeleteInput(MaterialsRheologyBbarEnum);3934 this-> material->inputs->DeleteInput(DamageDbarEnum);3823 this->inputs->DeleteInput(MaterialsRheologyBbarEnum); 3824 this->inputs->DeleteInput(DamageDbarEnum); 3935 3825 } /*}}}*/ 3936 3826 /*FUNCTION Penta::InputControlUpdate{{{*/ … … 3950 3840 if(control_type[i]==MaterialsRheologyBbarEnum){ 3951 3841 if (!IsOnBed()) goto cleanup_and_return; 3952 input=(Input*) material->inputs->GetInput(MaterialsRheologyBEnum); _assert_(input);3842 input=(Input*)this->inputs->GetInput(MaterialsRheologyBEnum); _assert_(input); 3953 3843 } 3954 3844 else if(control_type[i]==DamageDbarEnum){ 3955 3845 if (!IsOnBed()) goto cleanup_and_return; 3956 input=(Input*) material->inputs->GetInput(DamageDEnum); _assert_(input);3846 input=(Input*)this->inputs->GetInput(DamageDEnum); _assert_(input); 3957 3847 } 3958 3848 else{ 3959 3849 input=(Input*)this->inputs->GetInput(control_type[i]); _assert_(input); 3960 3850 } 3961 3962 if (input->ObjectEnum()!=ControlInputEnum) _error_("input " << EnumToStringx(control_type[i]) << " is not a ControlInput"); 3851 if(input->ObjectEnum()!=ControlInputEnum) _error_("input " << EnumToStringx(control_type[i]) << " is not a ControlInput"); 3963 3852 3964 3853 ((ControlInput*)input)->UpdateValue(scalar); … … 3967 3856 3968 3857 if(control_type[i]==MaterialsRheologyBbarEnum){ 3969 this->InputExtrude(MaterialsRheologyBEnum ,MaterialsEnum);3858 this->InputExtrude(MaterialsRheologyBEnum); 3970 3859 } 3971 3860 else if(control_type[i]==DamageDbarEnum){ 3972 this->InputExtrude(DamageDEnum ,MaterialsEnum);3861 this->InputExtrude(DamageDEnum); 3973 3862 } 3974 3863 } … … 4264 4153 } 4265 4154 new_input = new PentaInput(control_enum,values,P1Enum); 4266 4267 if(control_enum==MaterialsRheologyBbarEnum){ 4268 input=(Input*)material->inputs->GetInput(control_enum); _assert_(input); 4269 } 4270 else{ 4271 input=(Input*)this->inputs->GetInput(control_enum); _assert_(input); 4272 } 4155 input=(Input*)this->inputs->GetInput(control_enum); _assert_(input); 4273 4156 4274 4157 if (input->ObjectEnum()!=ControlInputEnum){ … … 4369 4252 this->inputs->AddInput(new PentaInput(BedEnum,bed,P1Enum)); 4370 4253 this->inputs->AddInput(new PentaInput(SurfaceEnum,surface,P1Enum)); 4371 4372 4254 break; 4255 4373 4256 default: 4374 4257 this->inputs->AddInput(new PentaInput(name,values,P1Enum)); … … 4656 4539 } 4657 4540 this->inputs->AddInput(new PentaInput(MaskGroundediceLevelsetEnum,&phi[0],P1Enum)); 4658 this->InputExtrude(MaskGroundediceLevelsetEnum ,ElementEnum);4541 this->InputExtrude(MaskGroundediceLevelsetEnum); 4659 4542 4660 4543 /*SubelementMigrationEnum: if one grounded, all grounded*/ … … 4688 4571 4689 4572 /*Extrude inputs*/ 4690 this->InputExtrude(SurfaceEnum ,ElementEnum);4691 this->InputExtrude(BedEnum ,ElementEnum);4573 this->InputExtrude(SurfaceEnum); 4574 this->InputExtrude(BedEnum); 4692 4575 } 4693 4576 /*}}}*/ -
issm/trunk-jpl/src/c/classes/Elements/Penta.h
r17267 r17275 105 105 int Sid(); 106 106 void InputCreate(IssmDouble* vector,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code); 107 void InputDepthAverageAtBase(int enum_type,int average_enum_type ,int object_enum=MeshElementsEnum);107 void InputDepthAverageAtBase(int enum_type,int average_enum_type); 108 108 void InputDuplicate(int original_enum,int new_enum); 109 109 void InputScale(int enum_type,IssmDouble scale_factor); … … 195 195 void AddBasalInput(int input_enum, IssmDouble* values, int interpolation_enum); 196 196 void AddInput(int input_enum, IssmDouble* values, int interpolation_enum); 197 void AddMaterialInput(int input_enum, IssmDouble* values, int interpolation_enum);198 197 void NormalBase(IssmDouble* bed_normal, IssmDouble* xyz_list); 199 198 void NormalSection(IssmDouble* normal,IssmDouble* xyz_list); … … 206 205 void GetVertexPidList(int* doflist); 207 206 int GetElementType(void); 208 Input* GetMaterialInput(int inputenum);209 207 void GetInputListOnVertices(IssmDouble* pvalue,int enumtype); 210 208 void GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue); … … 216 214 void GetInputValue(IssmDouble* pvalue,int enum_type); 217 215 void GetInputValue(IssmDouble* pvalue,Gauss* gauss,int enum_type); 218 void GetMaterialInputValue(IssmDouble* pvalue,Node* node,int enumtype);219 216 Node* GetNode(int node_number); 220 217 void InputChangeName(int input_enum, int enum_type_old); 221 void InputExtrude(int enum_type ,int object_type);218 void InputExtrude(int enum_type); 222 219 void InputUpdateFromSolutionOneDof(IssmDouble* solutiong,int enum_type); 223 220 void InputUpdateFromSolutionOneDofCollapsed(IssmDouble* solutiong,int enum_type); 224 bool IsInput(int name);225 221 bool IsOnSurface(void); 226 222 bool IsOnBed(void); -
issm/trunk-jpl/src/c/classes/Elements/Seg.h
r17257 r17275 61 61 void AddBasalInput(int input_enum, IssmDouble* values, int interpolation_enum){_error_("not implemented yet");}; 62 62 void AddInput(int input_enum, IssmDouble* values, int interpolation_enum){_error_("not implemented yet");}; 63 void AddMaterialInput(int input_enum, IssmDouble* values, int interpolation_enum){_error_("not implemented yet");};64 63 IssmDouble CharacteristicLength(void); 65 64 void ComputeBasalStress(Vector<IssmDouble>* sigma_b){_error_("not implemented yet");}; … … 130 129 void GetGroundedPart(int* point1,IssmDouble* fraction1, IssmDouble* fraction2,bool* mainlyfloating){_error_("not implemented yet");}; 131 130 IssmDouble GetGroundedPortion(IssmDouble* xyz_list){_error_("not implemented yet");}; 132 Input* GetMaterialInput(int inputenum){_error_("not implemented yet");};133 131 void GetInputListOnVertices(IssmDouble* pvalue,int enumtype){_error_("not implemented yet");}; 134 132 void GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue){_error_("not implemented yet");}; … … 138 136 void GetInputValue(IssmDouble* pvalue,int enum_type){_error_("not implemented yet");}; 139 137 void GetInputValue(IssmDouble* pvalue,Gauss* gauss,int enum_type){_error_("not implemented yet");}; 140 void GetMaterialInputValue(IssmDouble* pvalue,Node* node,int enumtype){_error_("not implemented yet");};141 138 Node* GetNode(int node_number){_error_("Not implemented");}; 142 139 IssmDouble GetXcoord(Gauss* gauss){_error_("Not implemented");}; … … 173 170 void GetVectorFromInputs(Vector<IssmDouble>* vector, int name_enum){_error_("not implemented yet");}; 174 171 void InputCreate(IssmDouble* vector,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code){_error_("not implemented yet");}; 175 void InputDepthAverageAtBase(int enum_type,int average_enum_type ,int object_enum=MeshElementsEnum){_error_("not implemented yet");};172 void InputDepthAverageAtBase(int enum_type,int average_enum_type){_error_("not implemented yet");}; 176 173 void InputDuplicate(int original_enum,int new_enum){_error_("not implemented yet");}; 177 174 void InputScale(int enum_type,IssmDouble scale_factor){_error_("not implemented yet");}; -
issm/trunk-jpl/src/c/classes/Elements/Tria.cpp
r17274 r17275 178 178 } 179 179 /*}}}*/ 180 /*FUNCTION Tria::AddMaterialInput{{{*/181 void Tria::AddMaterialInput(int input_enum,IssmDouble* values, int interpolation_enum){182 183 _assert_(this->material);184 this->material->inputs->AddInput(new TriaInput(input_enum,values,interpolation_enum));185 }186 /*}}}*/187 180 /*FUNCTION Tria::CharacteristicLength{{{*/ 188 181 IssmDouble Tria::CharacteristicLength(void){ … … 1018 1011 } 1019 1012 /*}}}*/ 1020 /*FUNCTION Tria::GetMaterialInput(int inputenum) {{{*/1021 Input* Tria::GetMaterialInput(int inputenum){1022 return this->material->inputs->GetInput(inputenum);1023 }1024 /*}}}*/1025 1013 /*FUNCTION Tria::GetInputListOnVertices(IssmDouble* pvalue,int enumtype) {{{*/ 1026 1014 void Tria::GetInputListOnVertices(IssmDouble* pvalue,int enumtype){ … … 1173 1161 1174 1162 }/*}}}*/ 1175 /*FUNCTION Tria::GetMaterialInputValue(IssmDouble* pvalue,Node* node,int enumtype) {{{*/1176 void Tria::GetMaterialInputValue(IssmDouble* pvalue,Node* node,int enumtype){1177 1178 Input* input=this->material->inputs->GetInput(enumtype);1179 if(!input) _error_("No input of type " << EnumToStringx(enumtype) << " found in tria");1180 1181 GaussTria* gauss=new GaussTria();1182 gauss->GaussVertex(this->GetNodeIndex(node));1183 1184 input->GetInputValue(pvalue,gauss);1185 delete gauss;1186 }1187 /*}}}*/1188 1163 Node* Tria::GetNode(int node_number){/*{{{*/ 1189 1164 _assert_(node_number>=0); … … 1247 1222 /*}}}*/ 1248 1223 /*FUNCTION Tria::InputDepthAverageAtBase {{{*/ 1249 void Tria::InputDepthAverageAtBase(int enum_type,int average_enum_type ,int object_enum){1224 void Tria::InputDepthAverageAtBase(int enum_type,int average_enum_type){ 1250 1225 1251 1226 /*New input*/ … … 1254 1229 1255 1230 /*copy input of enum_type*/ 1256 if (object_enum==MeshElementsEnum) 1257 oldinput=(Input*)this->inputs->GetInput(enum_type); 1258 else if (object_enum==MaterialsEnum) 1259 oldinput=(Input*)this->material->inputs->GetInput(enum_type); 1260 else 1261 _error_("object " << EnumToStringx(object_enum) << " not supported yet"); 1231 oldinput=(Input*)this->inputs->GetInput(enum_type); 1262 1232 if(!oldinput)_error_("could not find old input with enum: " << EnumToStringx(enum_type)); 1263 1233 newinput=(Input*)oldinput->copy(); … … 1267 1237 1268 1238 /*Add new input to current element*/ 1269 if (object_enum==MeshElementsEnum) 1270 this->inputs->AddInput((Input*)newinput); 1271 else if (object_enum==MaterialsEnum) 1272 this->material->inputs->AddInput((Input*)newinput); 1273 else 1274 _error_("object " << EnumToStringx(object_enum) << " not supported yet"); 1239 this->inputs->AddInput((Input*)newinput); 1275 1240 } 1276 1241 /*}}}*/ … … 1408 1373 } 1409 1374 break; 1410 /*Material will take care of it*/ 1411 case MaterialsRheologyBbarEnum:break; 1412 case DamageDbarEnum: break; 1375 case MaterialsRheologyBbarEnum: 1376 if(iomodel->Data(MaterialsRheologyBEnum)){ 1377 for(j=0;j<3;j++) nodeinputs[j]=iomodel->Data(MaterialsRheologyBEnum)[tria_vertex_ids[j]-1]; 1378 for(j=0;j<3;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(tria_vertex_ids[j]-1)*num_control_type+i]; 1379 for(j=0;j<3;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(tria_vertex_ids[j]-1)*num_control_type+i]; 1380 this->inputs->AddInput(new ControlInput(MaterialsRheologyBbarEnum,TriaInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1)); 1381 } 1382 break; 1383 case DamageDbarEnum: 1384 if(iomodel->Data(DamageDEnum)){ 1385 for(j=0;j<3;j++) nodeinputs[j]=iomodel->Data(DamageDEnum)[tria_vertex_ids[j]-1]; 1386 for(j=0;j<3;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(tria_vertex_ids[j]-1)*num_control_type+i]; 1387 for(j=0;j<3;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(tria_vertex_ids[j]-1)*num_control_type+i]; 1388 this->inputs->AddInput(new ControlInput(DamageDbarEnum,TriaInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1)); 1389 } 1390 break; 1413 1391 default: 1414 1392 _error_("Control " << EnumToStringx(reCast<int,IssmDouble>(iomodel->Data(InversionControlParametersEnum)[i])) << " not implemented yet"); … … 1476 1454 } 1477 1455 /*update input*/ 1478 if (name==MaterialsRheologyBbarEnum || name==MaterialsRheologyBEnum || name==DamageDEnum || name==DamageDbarEnum){ 1479 material->inputs->AddInput(new TriaInput(name,values,P1Enum)); 1480 } 1481 else{ 1482 this->inputs->AddInput(new TriaInput(name,values,P1Enum)); 1483 } 1456 this->inputs->AddInput(new TriaInput(name,values,P1Enum)); 1484 1457 break; 1485 1458 … … 1490 1463 } 1491 1464 /*update input*/ 1492 if(name==MaterialsRheologyBbarEnum || name==MaterialsRheologyBEnum || name==DamageDEnum || name==DamageDbarEnum){ 1493 material->inputs->AddInput(new TriaInput(name,values,P1Enum)); 1494 } 1495 else{ 1496 this->inputs->AddInput(new TriaInput(name,values,P1Enum)); 1497 } 1465 this->inputs->AddInput(new TriaInput(name,values,P1Enum)); 1498 1466 break; 1499 1467 … … 1603 1571 } 1604 1572 1605 }1606 /*}}}*/1607 /*FUNCTION Tria::IsInput{{{*/1608 bool Tria::IsInput(int name){1609 if (1610 name==ThicknessEnum ||1611 name==SurfaceEnum ||1612 name==BathymetryEnum ||1613 name==BedEnum ||1614 name==MaskGroundediceLevelsetEnum ||1615 name==MaskIceLevelsetEnum ||1616 name==IceMaskNodeActivationEnum ||1617 name==LevelsetfunctionSlopeXEnum ||1618 name==LevelsetfunctionSlopeYEnum ||1619 name==SurfaceSlopeXEnum ||1620 name==SurfaceSlopeYEnum ||1621 name==BasalforcingsMeltingRateEnum ||1622 name==WatercolumnEnum ||1623 name==SurfaceforcingsMassBalanceEnum ||1624 name==SurfaceAreaEnum||1625 name==VxEnum ||1626 name==VyEnum ||1627 name==PressureEnum ||1628 name==InversionVxObsEnum ||1629 name==InversionVyObsEnum ||1630 name==FrictionCoefficientEnum ||1631 name==MaterialsRheologyBbarEnum ||1632 name==DamageDbarEnum ||1633 name==GradientEnum ||1634 name==OldGradientEnum ||1635 name==ConvergedEnum ||1636 name==SedimentHeadOldEnum ||1637 name==SedimentHeadEnum ||1638 name==EplHeadEnum ||1639 name==EplHeadOldEnum ||1640 name==HydrologydcEplThicknessOldEnum ||1641 name==HydrologydcEplInitialThicknessEnum ||1642 name==HydrologydcEplThicknessEnum ||1643 name==HydrologydcMaskEplactiveNodeEnum ||1644 name==MeshVertexonbedEnum ||1645 name==WaterTransferEnum ||1646 name==QmuVxEnum ||1647 name==QmuVyEnum ||1648 name==QmuPressureEnum ||1649 name==QmuBedEnum ||1650 name==QmuThicknessEnum ||1651 name==QmuSurfaceEnum ||1652 name==QmuTemperatureEnum ||1653 name==QmuMeltingEnum ||1654 name==QmuMaskGroundediceLevelsetEnum ||1655 name==QmuMaskIceLevelsetEnum ||1656 name==GiaWEnum ||1657 name==GiadWdtEnum1658 ){1659 return true;1660 }1661 else return false;1662 1573 } 1663 1574 /*}}}*/ … … 2299 2210 2300 2211 /*Spawn material*/ 2301 seg->material=(Material*)this->material->copy(); 2302 delete seg->material->inputs; 2303 seg->material->inputs=(Inputs*)this->material->inputs->SpawnSegInputs(index1,index2); 2212 seg->material=(Material*)this->material->copy(seg); 2304 2213 2305 2214 /*recover nodes, material and matpar: */ … … 3297 3206 3298 3207 for(int i=0;i<num_controls;i++){ 3299 3300 if(control_type[i]==MaterialsRheologyBbarEnum || control_type[i]==DamageDbarEnum){ 3301 input=(Input*)material->inputs->GetInput(control_type[i]); _assert_(input); 3302 } 3303 else{ 3304 input=(Input*)this->inputs->GetInput(control_type[i]); _assert_(input); 3305 } 3306 3208 input=(Input*)this->inputs->GetInput(control_type[i]); _assert_(input); 3307 3209 if (input->ObjectEnum()!=ControlInputEnum){ 3308 3210 _error_("input " << EnumToStringx(control_type[i]) << " is not a ControlInput"); … … 3323 3225 3324 3226 int vertexpidlist[NUMVERTICES]; 3325 Input* input=NULL; 3326 3327 if(enum_type==MaterialsRheologyBbarEnum || enum_type==DamageDbarEnum){ 3328 input=(Input*)material->inputs->GetInput(enum_type); 3329 } 3330 else{ 3331 input=inputs->GetInput(enum_type); 3332 } 3227 3228 Input* input=inputs->GetInput(enum_type); 3333 3229 if (!input) _error_("Input " << EnumToStringx(enum_type) << " not found"); 3334 3230 if (input->ObjectEnum()!=ControlInputEnum) _error_("Input " << EnumToStringx(enum_type) << " is not a ControlInput"); … … 3341 3237 void Tria::ControlInputScaleGradient(int enum_type,IssmDouble scale){ 3342 3238 3343 Input* input=NULL; 3344 3345 if(enum_type==MaterialsRheologyBbarEnum || enum_type==DamageDbarEnum){ 3346 input=(Input*)material->inputs->GetInput(enum_type); 3347 } 3348 else{ 3349 input=inputs->GetInput(enum_type); 3350 } 3239 Input* input=inputs->GetInput(enum_type); 3351 3240 if (!input) _error_("Input " << EnumToStringx(enum_type) << " not found"); 3352 3241 if (input->ObjectEnum()!=ControlInputEnum) _error_("Input " << EnumToStringx(enum_type) << " is not a ControlInput"); … … 3360 3249 IssmDouble grad_list[NUMVERTICES]; 3361 3250 Input* grad_input=NULL; 3362 Input* input=NULL; 3363 3364 if(enum_type==MaterialsRheologyBbarEnum || enum_type==DamageDbarEnum){ 3365 input=(Input*)material->inputs->GetInput(enum_type); 3366 } 3367 else{ 3368 input=inputs->GetInput(enum_type); 3369 } 3251 3252 Input* input=inputs->GetInput(enum_type); 3370 3253 if (!input) _error_("Input " << EnumToStringx(enum_type) << " not found"); 3371 3254 if (input->ObjectEnum()!=ControlInputEnum) _error_("Input " << EnumToStringx(enum_type) << " is not a ControlInput"); … … 3381 3264 void Tria::ControlToVectors(Vector<IssmPDouble>* vector_control, Vector<IssmPDouble>* vector_gradient,int control_enum){ 3382 3265 3383 Input* input=NULL; 3384 if(control_enum==MaterialsRheologyBbarEnum || control_enum==DamageDbarEnum){ 3385 input=(Input*)material->inputs->GetInput(control_enum); 3386 } 3387 else{ 3388 input=inputs->GetInput(control_enum); 3389 } 3266 Input* input=inputs->GetInput(control_enum); 3390 3267 if (!input) _error_("Input " << EnumToStringx(control_enum) << " not found"); 3391 3268 if (input->ObjectEnum()!=ControlInputEnum) _error_("Input " << EnumToStringx(control_enum) << " is not a ControlInput"); … … 3499 3376 ::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES); 3500 3377 GradientIndexing(&vertexpidlist[0],control_index); 3501 Input* rheologyb_input= material->inputs->GetInput(MaterialsRheologyBbarEnum); _assert_(rheologyb_input);3378 Input* rheologyb_input=inputs->GetInput(MaterialsRheologyBbarEnum); _assert_(rheologyb_input); 3502 3379 Input* weights_input=inputs->GetInput(InversionCostFunctionsCoefficientsEnum); _assert_(weights_input); 3503 3380 … … 3548 3425 Input* adjointx_input=inputs->GetInput(AdjointxEnum); _assert_(adjointx_input); 3549 3426 Input* adjointy_input=inputs->GetInput(AdjointyEnum); _assert_(adjointy_input); 3550 Input* rheologyb_input= material->inputs->GetInput(MaterialsRheologyBbarEnum); _assert_(rheologyb_input);3427 Input* rheologyb_input=inputs->GetInput(MaterialsRheologyBbarEnum); _assert_(rheologyb_input); 3551 3428 3552 3429 /* Start looping on the number of gaussian points: */ … … 3605 3482 Input* adjointx_input=inputs->GetInput(AdjointxEnum); _assert_(adjointx_input); 3606 3483 Input* adjointy_input=inputs->GetInput(AdjointyEnum); _assert_(adjointy_input); 3607 Input* rheologyd_input= material->inputs->GetInput(DamageDbarEnum); _assert_(rheologyd_input);3484 Input* rheologyd_input=inputs->GetInput(DamageDbarEnum); _assert_(rheologyd_input); 3608 3485 3609 3486 /* Start looping on the number of gaussian points: */ … … 4011 3888 ::GetVerticesCoordinates(&xyz_list[0][0],vertices,NUMVERTICES); 4012 3889 Input* weights_input =inputs->GetInput(InversionCostFunctionsCoefficientsEnum); _assert_(weights_input); 4013 Input* rheologyb_input= material->inputs->GetInput(MaterialsRheologyBbarEnum); _assert_(rheologyb_input);3890 Input* rheologyb_input=inputs->GetInput(MaterialsRheologyBbarEnum); _assert_(rheologyb_input); 4014 3891 4015 3892 /* Start looping on the number of gaussian points: */ … … 4573 4450 4574 4451 /*Get input (either in element or material)*/ 4575 if(control_enum==MaterialsRheologyBbarEnum || control_enum==DamageDbarEnum){ 4576 input=(Input*)this->material->inputs->GetInput(control_enum); _assert_(input); 4577 } 4578 else{ 4579 input=(Input*)this->inputs->GetInput(control_enum); _assert_(input); 4580 } 4452 input=(Input*)this->inputs->GetInput(control_enum); _assert_(input); 4581 4453 4582 4454 /*Check that it is a ControlInput*/ … … 4608 4480 new_input = new TriaInput(control_enum,values,P1Enum); 4609 4481 4610 if(control_enum==MaterialsRheologyBbarEnum || control_enum==DamageDbarEnum){ 4611 input=(Input*)material->inputs->GetInput(control_enum); _assert_(input); 4612 } 4613 else{ 4614 input=(Input*)this->inputs->GetInput(control_enum); _assert_(input); 4615 } 4616 4482 input=(Input*)this->inputs->GetInput(control_enum); _assert_(input); 4617 4483 if (input->ObjectEnum()!=ControlInputEnum){ 4618 4484 _error_("input " << EnumToStringx(control_enum) << " is not a ControlInput"); … … 5150 5016 5151 5017 break; 5018 case MaterialsRheologyBEnum: 5019 this->inputs->AddInput(new TriaInput(MaterialsRheologyBbarEnum,values,P1Enum)); 5020 break; 5152 5021 default: 5153 5022 this->inputs->AddInput(new TriaInput(name,values,P1Enum)); -
issm/trunk-jpl/src/c/classes/Elements/Tria.h
r17257 r17275 109 109 void GetVerticesCoordinatesTop(IssmDouble** pxyz_list); 110 110 void InputCreate(IssmDouble* vector,IoModel* iomodel,int M,int N,int vector_type,int vector_enum,int code); 111 void InputDepthAverageAtBase(int enum_type,int average_enum_type ,int object_enum=MeshElementsEnum);111 void InputDepthAverageAtBase(int enum_type,int average_enum_type); 112 112 void InputDuplicate(int original_enum,int new_enum); 113 113 void InputScale(int enum_type,IssmDouble scale_factor); … … 202 202 void AddBasalInput(int input_enum, IssmDouble* values, int interpolation_enum); 203 203 void AddInput(int input_enum, IssmDouble* values, int interpolation_enum); 204 void AddMaterialInput(int input_enum, IssmDouble* values, int interpolation_enum);205 204 IssmDouble EnthalpyDiffusionParameter(IssmDouble enthalpy,IssmDouble pressure){_error_("not implemented");}; 206 205 IssmDouble EnthalpyDiffusionParameterVolume(int numvertices,IssmDouble* enthalpy,IssmDouble* pressure){_error_("not implemented");}; … … 216 215 void NormalTop(IssmDouble* normal,IssmDouble* xyz_list); 217 216 void NormalBase(IssmDouble* normal,IssmDouble* xyz_list); 218 Input* GetMaterialInput(int inputenum);219 217 void GetInputListOnVertices(IssmDouble* pvalue,int enumtype); 220 218 void GetInputListOnVertices(IssmDouble* pvalue,int enumtype,IssmDouble defaultvalue); … … 232 230 void InputUpdateFromSolutionOneDof(IssmDouble* solution,int enum_type); 233 231 void InputUpdateFromSolutionOneDofCollapsed(IssmDouble* solution,int enum_type){_error_("not implemented yet");}; 234 bool IsInput(int name);235 232 void JacobianDeterminant(IssmDouble* pJdet, IssmDouble* xyz_list,Gauss* gauss); 236 233 void JacobianDeterminantLine(IssmDouble* Jdet, IssmDouble* xyz_list,Gauss* gauss){_error_("not implemented yet");}; -
issm/trunk-jpl/src/c/classes/Loads/Pengrid.cpp
r17268 r17275 706 706 707 707 //First recover damage using the element: */ 708 element->Get MaterialInputValue(&damage,node,DamageDbarEnum);708 element->GetInputValue(&damage,node,DamageDbarEnum); 709 709 710 710 //Recover our data: -
issm/trunk-jpl/src/c/classes/Materials/Material.h
r17266 r17275 12 12 #include "../../datastructures/datastructures.h" 13 13 #include "../Update.h" 14 class Element; 14 15 class Elements; 15 16 /*}}}*/ … … 18 19 19 20 public: 20 Inputs* inputs;21 21 virtual ~Material(){}; 22 22 /*WARNING: input should not be public but it is an easy way to update B from T (using UpdateFromSolution) from Pentas*/ 23 23 24 24 /*Numerics*/ 25 virtual void InputDuplicate(int original_enum,int new_enum)=0;25 virtual Material* copy(Element* element)=0; 26 26 virtual void Configure(Elements* elements)=0; 27 virtual void GetVectorFromInputs(Vector<IssmDouble>* vector,int input_enum)=0;28 27 virtual void GetViscosity(IssmDouble* pviscosity,IssmDouble epseff)=0; 29 28 virtual void GetViscosityBar(IssmDouble* pviscosity,IssmDouble epseff)=0; -
issm/trunk-jpl/src/c/classes/Materials/Materials.cpp
r15375 r17275 47 47 } 48 48 /*}}}*/ 49 /*FUNCTION Materials::InputDuplicate{{{*/50 void Materials::InputDuplicate(int input_enum,int output_enum){51 52 for(int i=0;i<this->Size();i++){53 Material* material=(Material*)this->GetObjectByOffset(i);54 material->InputDuplicate(input_enum,output_enum);55 }56 } -
issm/trunk-jpl/src/c/classes/Materials/Materials.h
r15375 r17275 24 24 /*numerics*/ 25 25 void Configure(Elements* elements,Loads* loads, Nodes* nodes, Vertices* vertices, Materials* materials,Parameters* parameters); 26 void InputDuplicate(int input_enum,int output_enum);27 26 28 27 }; -
issm/trunk-jpl/src/c/classes/Materials/Matice.cpp
r17248 r17275 29 29 /*FUNCTION Matice::Matice(){{{*/ 30 30 Matice::Matice(){ 31 this->inputs=NULL;32 31 this->helement=NULL; 32 this->element=NULL; 33 33 return; 34 34 } … … 42 42 /*Initialize id*/ 43 43 this->mid=matice_mid; 44 45 /*Initialize inputs*/46 this->inputs=new Inputs();47 48 /*Initialize inputs from IoModel*/49 this->InputUpdateFromIoModel(index,iomodel);50 44 51 45 /*Hooks: */ 52 46 matice_eid=index+1; 53 47 this->helement=new Hook(&matice_eid,1); 48 this->element=NULL; 54 49 55 50 return; … … 60 55 Matice::~Matice(){ 61 56 delete helement; 62 delete inputs;63 57 return; 64 58 } … … 71 65 _printf_("Matice:\n"); 72 66 _printf_(" mid: " << mid << "\n"); 73 _printf_(" inputs:\n");74 inputs->Echo();75 67 _printf_(" element:\n"); 76 68 helement->Echo(); … … 82 74 _printf_("Matice:\n"); 83 75 _printf_(" mid: " << mid << "\n"); 84 _printf_(" inputs:\n");85 inputs->DeepEcho();86 76 _printf_(" element:\n"); 87 77 helement->Echo(); … … 98 88 } 99 89 /*}}}*/ 100 /*FUNCTION Matice::copy {{{*/90 /*FUNCTION Matice::copy() {{{*/ 101 91 Object* Matice::copy() { 102 92 … … 110 100 matice->mid=this->mid; 111 101 matice->helement=(Hook*)this->helement->copy(); 112 if(this->inputs) matice->inputs=(Inputs*)this->inputs->Copy(); 113 else matice->inputs=new Inputs(); 102 matice->element =(Element*)this->helement->delivers(); 103 104 return matice; 105 } 106 /*}}}*/ 107 /*FUNCTION Matice::copy(Element* element) {{{*/ 108 Material* Matice::copy(Element* element_in) { 109 110 /*Output*/ 111 Matice* matice=NULL; 112 113 /*Initialize output*/ 114 matice=new Matice(); 115 116 /*copy fields: */ 117 matice->mid=this->mid; 118 matice->helement=(Hook*)this->helement->copy(); 119 matice->element =element_in; 114 120 115 121 return matice; … … 124 130 * datasets, using internal ids and offsets hidden in hooks: */ 125 131 helement->configure((DataSet*)elementsin); 132 this->element = (Element*)helement->delivers(); 126 133 } 127 134 /*}}}*/ … … 139 146 IssmDouble B,n; 140 147 141 inputs->GetInputAverage(&B,MaterialsRheologyBEnum);148 element->inputs->GetInputAverage(&B,MaterialsRheologyBEnum); 142 149 n=this->GetN(); 143 150 … … 153 160 IssmDouble B,n; 154 161 155 inputs->GetInputAverage(&B,MaterialsRheologyBbarEnum);162 element->inputs->GetInputAverage(&B,MaterialsRheologyBbarEnum); 156 163 n=this->GetN(); 157 164 … … 165 172 IssmDouble B; 166 173 167 inputs->GetInputAverage(&B,MaterialsRheologyBEnum);174 element->inputs->GetInputAverage(&B,MaterialsRheologyBEnum); 168 175 return B; 169 176 } … … 175 182 IssmDouble Bbar; 176 183 177 inputs->GetInputAverage(&Bbar,MaterialsRheologyBbarEnum);184 element->inputs->GetInputAverage(&Bbar,MaterialsRheologyBbarEnum); 178 185 return Bbar; 179 186 } … … 185 192 IssmDouble n; 186 193 187 inputs->GetInputAverage(&n,MaterialsRheologyNEnum);194 element->inputs->GetInputAverage(&n,MaterialsRheologyNEnum); 188 195 return n; 189 196 } … … 195 202 IssmDouble D; 196 203 197 inputs->GetInputAverage(&D,DamageDEnum);204 element->inputs->GetInputAverage(&D,DamageDEnum); 198 205 return D; 199 206 } … … 204 211 /*Output*/ 205 212 IssmDouble Dbar; 206 inputs->GetInputAverage(&Dbar,DamageDbarEnum);213 element->inputs->GetInputAverage(&Dbar,DamageDbarEnum); 207 214 return Dbar; 208 }209 /*}}}*/210 /*FUNCTION Matice::GetVectorFromInputs{{{*/211 void Matice::GetVectorFromInputs(Vector<IssmDouble>* vector,int input_enum){212 213 /*Intermediaries*/214 Element *element= NULL;215 216 /*Recover element*/217 element=(Element*)helement->delivers();218 219 /*Check that input_enum is a material input*/220 if (!IsInput(input_enum)) return;221 222 switch(element->ObjectEnum()){223 224 case TriaEnum:{225 226 /*Prepare index list*/227 int vertexpidlist[3];228 ((Tria*)element)->GetVertexPidList(&vertexpidlist[0]);229 230 /*Get input (either in element or material)*/231 Input* input=inputs->GetInput(input_enum);232 if(!input) _error_("Input " << EnumToStringx(input_enum) << " not found in material");233 234 /*We found the enum. Use its values to fill into the vector, using the vertices ids: */235 input->GetVectorFromInputs(vector,&vertexpidlist[0]);}236 break;237 238 default: _error_("element " << EnumToStringx(element->ObjectEnum()) << " not implemented yet");239 }240 215 } 241 216 /*}}}*/ … … 546 521 } 547 522 /*}}}*/ 548 /*FUNCTION Matice::InputDuplicate{{{*/549 void Matice::InputDuplicate(int original_enum,int new_enum){550 551 /*Call inputs method*/552 if (IsInput(original_enum)) inputs->DuplicateInput(original_enum,new_enum);553 554 }555 /*}}}*/556 523 /*FUNCTION Matice::InputUpdateFromVector(IssmDouble* vector, int name, int type) {{{*/ 557 524 void Matice::InputUpdateFromVector(IssmDouble* vector, int name, int type){ 558 525 559 /*Intermediaries*/560 Element *element = NULL;561 562 /*Recover element*/563 element=(Element*)helement->delivers();564 565 /*Check that name is an element input*/566 if (!IsInput(name)) return;567 568 switch(type){569 570 case VertexEnum:571 572 switch(element->ObjectEnum()){573 574 case TriaEnum: {575 IssmDouble values[3];576 for (int i=0;i<3;i++) values[i]=vector[((Tria*)element)->vertices[i]->Pid()];577 this->inputs->AddInput(new TriaInput(name,values,P1Enum));578 return;579 }580 case PentaEnum: {581 IssmDouble valuesp[6];582 for (int i=0;i<6;i++) valuesp[i]=vector[((Penta*)element)->vertices[i]->Sid()]; //use sid list, to index into serial oriented vector583 this->inputs->AddInput(new PentaInput(name,valuesp,P1Enum));584 return;585 }586 default: _error_("element " << EnumToStringx(element->ObjectEnum()) << " not implemented yet");587 }588 default: _error_("type " << type << " (" << EnumToStringx(type) << ") not implemented yet");589 }590 526 } 591 527 /*}}}*/ 592 528 /*FUNCTION Matice::InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type) {{{*/ 593 529 void Matice::InputUpdateFromVectorDakota(IssmDouble* vector, int name, int type){ 594 595 /*Intermediaries*/596 Element *element = NULL;597 Parameters *parameters = NULL;598 int meshtype;599 600 /*Recover element*/601 element=(Element*)helement->delivers();602 603 /*Check that name is an element input*/604 if (!IsInput(name)) return;605 606 switch(type){607 608 case VertexEnum:609 610 switch(element->ObjectEnum()){611 612 case TriaEnum: {613 IssmDouble values[3];614 for (int i=0;i<3;i++) values[i]=vector[((Tria*)element)->vertices[i]->Sid()]; //index into serial oriented vector615 this->inputs->AddInput(new TriaInput(name,values,P1Enum));616 /*Special case for rheology B in 2D: Pourave land for this solution{{{*/617 if(name==MaterialsRheologyBEnum){618 /*Are we in 2D?:*/619 if(element->ObjectEnum()==TriaEnum){620 parameters=((Tria*)(element))->parameters;621 }622 else{623 parameters=((Penta*)(element))->parameters;624 }625 parameters->FindParam(&meshtype,MeshTypeEnum);626 if(meshtype==Mesh2DhorizontalEnum){627 /*Duplicate rheology input: */628 this->inputs->AddInput(new TriaInput(MaterialsRheologyBbarEnum,values,P1Enum));629 }630 }631 /*}}}*/632 return;633 }634 case PentaEnum:{635 IssmDouble valuesp[6];636 for (int i=0;i<6;i++) valuesp[i]=vector[((Penta*)element)->vertices[i]->Sid()]; //use sid list, to index into serial oriented vector637 this->inputs->AddInput(new PentaInput(name,valuesp,P1Enum));638 return;639 }640 default: _error_("element " << EnumToStringx(element->ObjectEnum()) << " not implemented yet");641 }642 default: _error_("type " << type << " (" << EnumToStringx(type) << ") not implemented yet");643 }644 530 645 531 } … … 665 551 } 666 552 /*}}}*/ 667 /*FUNCTION Matice::InputUpdateFromIoModel{{{*/668 void Matice::InputUpdateFromIoModel(int index, IoModel* iomodel){669 670 int i,j;671 bool control_analysis;672 int num_control_type;673 674 /*Fetch parameters: */675 iomodel->Constant(&control_analysis,InversionIscontrolEnum);676 if(control_analysis) iomodel->Constant(&num_control_type,InversionNumControlParametersEnum);677 678 if(iomodel->meshtype==Mesh2DhorizontalEnum){679 680 /*Intermediaries*/681 const int num_vertices = 3; //Tria has 3 vertices682 IssmDouble nodeinputs[num_vertices];683 IssmDouble cmmininputs[num_vertices];684 IssmDouble cmmaxinputs[num_vertices];685 686 /*Get B*/687 if (iomodel->Data(MaterialsRheologyBEnum)) {688 for(i=0;i<num_vertices;i++) nodeinputs[i]=iomodel->Data(MaterialsRheologyBEnum)[iomodel->elements[num_vertices*index+i]-1];689 this->inputs->AddInput(new TriaInput(MaterialsRheologyBbarEnum,nodeinputs,P1Enum));690 }691 692 /*Get n*/693 if (iomodel->Data(MaterialsRheologyNEnum)) {694 for(i=0;i<num_vertices;i++) nodeinputs[i]=iomodel->Data(MaterialsRheologyNEnum)[index];695 this->inputs->AddInput(new TriaInput(MaterialsRheologyNEnum,nodeinputs,P1Enum));696 }697 698 /*Get D:*/699 if (iomodel->Data(DamageDEnum)) {700 for(i=0;i<num_vertices;i++) nodeinputs[i]=iomodel->Data(DamageDEnum)[iomodel->elements[num_vertices*index+i]-1];701 this->inputs->AddInput(new TriaInput(DamageDbarEnum,nodeinputs,P1Enum));702 }703 704 /*Control Inputs*/705 if (control_analysis && iomodel->Data(InversionControlParametersEnum)){706 for(i=0;i<num_control_type;i++){707 switch(reCast<int>(iomodel->Data(InversionControlParametersEnum)[i])){708 case MaterialsRheologyBbarEnum:709 if (iomodel->Data(MaterialsRheologyBEnum)){710 _assert_(iomodel->Data(MaterialsRheologyBEnum));_assert_(iomodel->Data(InversionMinParametersEnum)); _assert_(iomodel->Data(InversionMaxParametersEnum));711 for(j=0;j<num_vertices;j++)nodeinputs[j]=iomodel->Data(MaterialsRheologyBEnum)[iomodel->elements[num_vertices*index+j]-1];712 for(j=0;j<num_vertices;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(iomodel->elements[num_vertices*index+j]-1)*num_control_type+i];713 for(j=0;j<num_vertices;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(iomodel->elements[num_vertices*index+j]-1)*num_control_type+i];714 this->inputs->AddInput(new ControlInput(MaterialsRheologyBbarEnum,TriaInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));715 }716 break;717 case DamageDbarEnum:718 if (iomodel->Data(DamageDEnum)){719 _assert_(iomodel->Data(DamageDEnum));_assert_(iomodel->Data(InversionMinParametersEnum)); _assert_(iomodel->Data(InversionMaxParametersEnum));720 for(j=0;j<num_vertices;j++)nodeinputs[j]=iomodel->Data(DamageDEnum)[iomodel->elements[num_vertices*index+j]-1];721 for(j=0;j<num_vertices;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(iomodel->elements[num_vertices*index+j]-1)*num_control_type+i];722 for(j=0;j<num_vertices;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(iomodel->elements[num_vertices*index+j]-1)*num_control_type+i];723 this->inputs->AddInput(new ControlInput(DamageDbarEnum,TriaInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));724 }725 break;726 }727 }728 }729 }730 else if(iomodel->meshtype==Mesh2DverticalEnum){731 732 /*Intermediaries*/733 const int num_vertices = 3; //Tria has 3 vertices734 IssmDouble nodeinputs[num_vertices];735 IssmDouble cmmininputs[num_vertices];736 IssmDouble cmmaxinputs[num_vertices];737 738 /*Get B*/739 if (iomodel->Data(MaterialsRheologyBEnum)) {740 for(i=0;i<num_vertices;i++) nodeinputs[i]=iomodel->Data(MaterialsRheologyBEnum)[iomodel->elements[num_vertices*index+i]-1];741 this->inputs->AddInput(new TriaInput(MaterialsRheologyBEnum,nodeinputs,P1Enum));742 }743 744 /*Get n*/745 if (iomodel->Data(MaterialsRheologyNEnum)) {746 for(i=0;i<num_vertices;i++) nodeinputs[i]=iomodel->Data(MaterialsRheologyNEnum)[index];747 this->inputs->AddInput(new TriaInput(MaterialsRheologyNEnum,nodeinputs,P1Enum));748 }749 750 /*Get D:*/751 if (iomodel->Data(DamageDEnum)) {752 for(i=0;i<num_vertices;i++) nodeinputs[i]=iomodel->Data(DamageDEnum)[iomodel->elements[num_vertices*index+i]-1];753 this->inputs->AddInput(new TriaInput(DamageDEnum,nodeinputs,P1Enum));754 }755 }756 else if(iomodel->meshtype==Mesh3DEnum){757 758 /*Intermediaries*/759 const int num_vertices = 6; //Penta has 6 vertices760 IssmDouble nodeinputs[num_vertices];761 IssmDouble cmmininputs[num_vertices];762 IssmDouble cmmaxinputs[num_vertices];763 764 /*Get B*/765 if (iomodel->Data(MaterialsRheologyBEnum)) {766 for(i=0;i<num_vertices;i++) nodeinputs[i]=iomodel->Data(MaterialsRheologyBEnum)[iomodel->elements[num_vertices*index+i]-1];767 this->inputs->AddInput(new PentaInput(MaterialsRheologyBEnum,nodeinputs,P1Enum));768 }769 770 /*Get n*/771 if (iomodel->Data(MaterialsRheologyNEnum)) {772 for(i=0;i<num_vertices;i++) nodeinputs[i]=iomodel->Data(MaterialsRheologyNEnum)[index];773 this->inputs->AddInput(new PentaInput(MaterialsRheologyNEnum,nodeinputs,P1Enum));774 }775 776 /*Get D*/777 if (iomodel->Data(DamageDEnum)) {778 for(i=0;i<num_vertices;i++) nodeinputs[i]=iomodel->Data(DamageDEnum)[iomodel->elements[num_vertices*index+i]-1];779 this->inputs->AddInput(new PentaInput(DamageDEnum,nodeinputs,P1Enum));780 }781 782 /*Control Inputs*/783 if (control_analysis && iomodel->Data(InversionControlParametersEnum)){784 for(i=0;i<num_control_type;i++){785 switch(reCast<int>(iomodel->Data(InversionControlParametersEnum)[i])){786 case MaterialsRheologyBbarEnum:787 if (iomodel->Data(MaterialsRheologyBEnum)){788 _assert_(iomodel->Data(MaterialsRheologyBEnum));_assert_(iomodel->Data(InversionMinParametersEnum)); _assert_(iomodel->Data(InversionMaxParametersEnum));789 for(j=0;j<num_vertices;j++)nodeinputs[j]=iomodel->Data(MaterialsRheologyBEnum)[iomodel->elements[num_vertices*index+j]-1];790 for(j=0;j<num_vertices;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(iomodel->elements[num_vertices*index+j]-1)*num_control_type+i];791 for(j=0;j<num_vertices;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(iomodel->elements[num_vertices*index+j]-1)*num_control_type+i];792 this->inputs->AddInput(new ControlInput(MaterialsRheologyBEnum,PentaInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));793 }794 break;795 case DamageDbarEnum:796 if (iomodel->Data(DamageDEnum)){797 _assert_(iomodel->Data(DamageDEnum));_assert_(iomodel->Data(InversionMinParametersEnum)); _assert_(iomodel->Data(InversionMaxParametersEnum));798 for(j=0;j<num_vertices;j++)nodeinputs[j]=iomodel->Data(DamageDEnum)[iomodel->elements[num_vertices*index+j]-1];799 for(j=0;j<num_vertices;j++)cmmininputs[j]=iomodel->Data(InversionMinParametersEnum)[(iomodel->elements[num_vertices*index+j]-1)*num_control_type+i];800 for(j=0;j<num_vertices;j++)cmmaxinputs[j]=iomodel->Data(InversionMaxParametersEnum)[(iomodel->elements[num_vertices*index+j]-1)*num_control_type+i];801 this->inputs->AddInput(new ControlInput(DamageDEnum,PentaInputEnum,nodeinputs,cmmininputs,cmmaxinputs,i+1));802 }803 break;804 805 }806 }807 }808 }809 else{810 _error_("Mesh type not supported yet!");811 }812 813 return;814 }815 /*}}}*/816 /*FUNCTION Matice::IsInput{{{*/817 bool Matice::IsInput(int name){818 if (819 name==MaterialsRheologyBEnum ||820 name==MaterialsRheologyBbarEnum ||821 name==MaterialsRheologyNEnum ||822 name==QmuMaterialsRheologyBEnum ||823 name==DamageDEnum ||824 name==DamageDbarEnum825 826 ){827 return true;828 }829 else return false;830 }831 /*}}}*/ -
issm/trunk-jpl/src/c/classes/Materials/Matice.h
r17248 r17275 12 12 class IoModel; 13 13 class Elements; 14 class Element; 14 15 class Loads; 15 16 class Nodes; … … 22 23 23 24 private: 24 int mid; 25 Hook *helement; 25 int mid; 26 Hook *helement; 27 Element *element; 26 28 27 29 public: … … 45 47 void InputUpdateFromConstant(int constant, int name); 46 48 void InputUpdateFromConstant(bool constant, int name); 47 void InputUpdateFromIoModel(int index, IoModel* iomodel) ;49 void InputUpdateFromIoModel(int index, IoModel* iomodel){_error_("not implemented");}; 48 50 /*}}}*/ 49 51 /*Material virtual functions resolution: {{{*/ 50 void InputDuplicate(int original_enum,int new_enum);51 52 void Configure(Elements* elements); 52 void GetVectorFromInputs(Vector<IssmDouble>* vector,int input_enum);53 Material* copy(Element* element); 53 54 void SetCurrentConfiguration(Elements* elements,Loads* loads,Nodes* nodes,Vertices* vertices,Materials* materials,Parameters* parameters); 54 55 void GetViscosity(IssmDouble* pviscosity, IssmDouble eps_eff); … … 66 67 IssmDouble GetDbar(); 67 68 IssmDouble GetN(); 68 bool IsInput(int name);69 69 /*}}}*/ 70 70 }; -
issm/trunk-jpl/src/c/classes/Materials/Matpar.cpp
r17266 r17275 91 91 iomodel->Constant(&this->mantle_shear_modulus,MaterialsMantleShearModulusEnum); 92 92 iomodel->Constant(&this->mantle_density,MaterialsMantleDensityEnum); 93 94 this->inputs=NULL; /*not used here*/95 93 } 96 94 /*}}}*/ … … 234 232 235 233 /*Matpar management: */ 236 /*FUNCTION Matpar::InputDuplicate{{{*/237 void Matpar::InputDuplicate(int original_enum,int new_enum){238 239 /*Call inputs method*/240 if (IsInput(original_enum)) inputs->DuplicateInput(original_enum,new_enum);241 242 }243 /*}}}*/244 234 /*FUNCTION Matpar::Configure {{{*/ 245 235 void Matpar::Configure(Elements* elementsin){ … … 520 510 } 521 511 /*}}}*/ 522 523 512 /*FUNCTION Matpar::GetLithosphereShearModulus {{{*/ 524 513 IssmDouble Matpar::GetLithosphereShearModulus(){ … … 541 530 } 542 531 /*}}}*/ 543 /*FUNCTION Matpar::IsInput{{{*/544 bool Matpar::IsInput(int name){545 return false;546 }547 /*}}}*/ -
issm/trunk-jpl/src/c/classes/Materials/Matpar.h
r17248 r17275 76 76 void InputUpdateFromConstant(int constant, int name); 77 77 void InputUpdateFromConstant(bool constant, int name); 78 void InputUpdateFromIoModel(int index, IoModel* iomodel){_error_("not implemented yet");};78 void InputUpdateFromIoModel(int index, IoModel* iomodel){_error_("not implemented");}; 79 79 /*}}}*/ 80 80 /*Material virtual functions resolution: {{{*/ 81 void InputDuplicate(int original_enum,int new_enum);81 Material* copy(Element* element){_error_("not implemented");}; 82 82 void Configure(Elements* elements); 83 void GetVectorFromInputs(Vector<IssmDouble>* vector,int input_enum){return;}84 83 void GetViscosity(IssmDouble* pviscosity,IssmDouble eps_eff){_error_("not supported");}; 85 84 void GetViscosityBar(IssmDouble* pviscosity,IssmDouble eps_eff){_error_("not supported");}; … … 135 134 IssmDouble GetS0p(); 136 135 IssmDouble GetMaterialParameter(int in_enum); 137 bool IsInput(int name);138 136 /*}}}*/ 139 137 -
issm/trunk-jpl/src/c/modules/GetVectorFromInputsx/GetVectorFromInputsx.cpp
r15849 r17275 21 21 Element* element=dynamic_cast<Element*>(femmodel->elements->GetObjectByOffset(i)); 22 22 element->GetVectorFromInputs(vector,name); 23 }24 25 /*Look up in materials*/26 for(i=0;i<femmodel->materials->Size();i++){27 Material* material=(Material*)femmodel->materials->GetObjectByOffset(i);28 material->GetVectorFromInputs(vector,name);29 23 } 30 24 } -
issm/trunk-jpl/src/c/modules/InputDuplicatex/InputDuplicatex.cpp
r16638 r17275 14 14 element->InputDuplicate(original_enum,new_enum); 15 15 } 16 for(int i=0;i<femmodel->materials->Size();i++){17 Material* material=(Material*)femmodel->materials->GetObjectByOffset(i);18 material->InputDuplicate(original_enum,new_enum);19 }20 21 16 } -
issm/trunk-jpl/src/c/modules/ModelProcessorx/Control/UpdateElementsAndMaterialsControl.cpp
r16313 r17275 45 45 } 46 46 47 /*Update elements and materials: */47 /*Update elements: */ 48 48 counter=0; 49 49 for (i=0;i<iomodel->numberofelements;i++){ … … 51 51 element=(Element*)elements->GetObjectByOffset(counter); 52 52 element->InputUpdateFromIoModel(i,iomodel); //we need i to index into elements. 53 54 material=(Material*)materials->GetObjectByOffset(counter);55 material->InputUpdateFromIoModel(i,iomodel); //we need i to index into elements.56 53 counter++; 57 54 } -
issm/trunk-jpl/src/c/modules/ModelProcessorx/CreateElementsVerticesAndMaterials.cpp
r17236 r17275 28 28 switch(iomodel->meshtype){ 29 29 case Mesh2DhorizontalEnum: 30 materials->InputDuplicate(MaterialsRheologyBbarEnum,QmuMaterialsRheologyBEnum);31 30 for(i=0;i<iomodel->numberofelements;i++){ 32 31 if(iomodel->my_elements[i]) elements->AddObject(new Tria(i+1,i,i,iomodel,nummodels)); … … 51 50 switch(materials_type){ 52 51 case MaticeEnum: 53 iomodel->FetchData(3,MaterialsRheologyBEnum,MaterialsRheologyNEnum,DamageDEnum); 52 iomodel->FetchDataToInput(elements,MaterialsRheologyBEnum); 53 iomodel->FetchDataToInput(elements,MaterialsRheologyNEnum); 54 iomodel->FetchDataToInput(elements,DamageDEnum); 54 55 for (i=0;i<iomodel->numberofelements;i++) if(iomodel->my_elements[i]) materials->AddObject(new Matice(i+1,i,iomodel)); 55 if(dakota_analysis){56 switch(iomodel->meshtype){57 case Mesh2DhorizontalEnum:58 materials->InputDuplicate(MaterialsRheologyBbarEnum,QmuMaterialsRheologyBEnum);59 break;60 case Mesh3DEnum:61 materials->InputDuplicate(MaterialsRheologyBEnum,QmuMaterialsRheologyBEnum);62 break;63 default:64 _error_("Mesh not supported yet");65 }56 switch(iomodel->meshtype){ 57 case Mesh2DhorizontalEnum: 58 elements->InputDuplicate(MaterialsRheologyBEnum,MaterialsRheologyBbarEnum); 59 elements->InputDuplicate(DamageDEnum,DamageDbarEnum); 60 if(dakota_analysis) elements->InputDuplicate(MaterialsRheologyBbarEnum,QmuMaterialsRheologyBEnum); 61 break; 62 case Mesh3DEnum: 63 if(dakota_analysis) elements->InputDuplicate(MaterialsRheologyBEnum,QmuMaterialsRheologyBEnum); 64 break; 65 default: 66 _error_("Mesh not supported yet"); 66 67 } 67 68 break;
Note:
See TracChangeset
for help on using the changeset viewer.