Changeset 3612
- Timestamp:
- 04/23/10 11:09:28 (15 years ago)
- Location:
- issm/trunk/src
- Files:
-
- 43 added
- 9 deleted
- 67 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/ComputeBasalStressx/ComputeBasalStressx.h
r3529 r3612 11 11 /* local prototypes: */ 12 12 void ComputeBasalStressx( Vec* pp_g,DataSet* elements,DataSet* nodes, DataSet* vertices,DataSet* loads, DataSet* materials, DataSet* parameters, 13 ParameterInputs* inputs,int analysis_type,int sub_analysis_type);13 int analysis_type,int sub_analysis_type); 14 14 15 15 #endif /* _COMPUTEBASALSTRESSX_H */ -
issm/trunk/src/c/ComputePressurex/ComputePressurex.h
r3529 r3612 11 11 /* local prototypes: */ 12 12 void ComputePressurex( Vec* pp_g,DataSet* elements,DataSet* nodes, DataSet* vertices,DataSet* loads, DataSet* materials, DataSet* parameters, 13 ParameterInputs* inputs,int analysis_type,int sub_analysis_type);13 int analysis_type,int sub_analysis_type); 14 14 15 15 #endif /* _COMPUTEPRESSUREX_H */ -
issm/trunk/src/c/ComputeStrainRatex/ComputeStrainRatex.h
r3529 r3612 11 11 /* local prototypes: */ 12 12 void ComputeStrainRatex(Vec* eps_g,DataSet* elements,DataSet* nodes, DataSet* vertices,DataSet* loads, DataSet* materials, DataSet* parameters, 13 ParameterInputs* inputs,int analysis_type,int sub_analysis_type);13 int analysis_type,int sub_analysis_type); 14 14 15 15 #endif /* _COMPUTESTRAINRATEX_H */ -
issm/trunk/src/c/CostFunctionx/CostFunctionx.h
r3446 r3612 11 11 /* local prototypes: */ 12 12 void CostFunctionx( double* pJ, DataSet* elements,DataSet* nodes, DataSet* vertices, DataSet* loads, DataSet* materials, DataSet* parameters, 13 ParameterInputs* inputs,int analysis_type,int sub_analysis_type);13 int analysis_type,int sub_analysis_type); 14 14 15 15 #endif /* _MISFITX_H */ -
issm/trunk/src/c/DataSet/DataSet.cpp
r3599 r3612 225 225 dataset->AddObject(tria); 226 226 } 227 else if(enum_type==TriaVertexInputEnum){ 228 TriaVertexInput* triavertexinput=NULL; 229 triavertexinput=new TriaVertexInput(); 230 triavertexinput->Demarshall(&marshalled_dataset); 231 dataset->AddObject(triavertexinput); 232 } 227 233 else if(enum_type==SingEnum){ 228 234 Sing* sing=NULL; … … 316 322 317 323 /*Specific methods*/ 318 /*FUNCTION DataSet::AddEinput{{{1*/319 int DataSet::AddEinput(Einput* in_einput){320 321 /*First, go through dataset of inputs and check whether any input322 * with the same name is already in. If so, erase the corresponding323 * object before adding this new one: */324 vector<Object*>::iterator object;325 Einput* einput=NULL;326 327 for ( object=objects.begin() ; object < objects.end(); object++ ){328 329 einput=(Einput*)(*object); //assume this is an inputs dataset330 331 if (einput->EnumType()==in_einput->EnumType()){332 this->DeleteObject(einput);333 break;334 }335 }336 this->AddObject(in_einput);337 }338 /*}}}*/339 324 /*FUNCTION DataSet::AddObject{{{1*/ 340 325 int DataSet::AddObject(Object* object){ -
issm/trunk/src/c/DataSet/DataSet.h
r3599 r3612 12 12 #include <vector> 13 13 #include "../toolkits/toolkits.h" 14 #include "../objects/Einput.h"15 14 #include "../objects/Object.h" 16 15 … … 47 46 int MarshallSize(); 48 47 int AddObject(Object* object); 49 int AddEinput(Einput* in_einput);50 48 int DeleteObject(int id); 51 49 int Size(); -
issm/trunk/src/c/Dux/Dux.h
r3446 r3612 11 11 /* local prototypes: */ 12 12 void Dux( Vec* pdu_g, DataSet* elements,DataSet* nodes, DataSet* vertices, DataSet* loads, DataSet* materials, DataSet* parameters, 13 ParameterInputs* inputs,int analysis_type,int sub_analysis_type);13 int analysis_type,int sub_analysis_type); 14 14 15 15 #endif /* _DUX_H */ -
issm/trunk/src/c/EnumDefinitions/EnumDefinitions.h
r3599 r3612 99 99 InputEnum, 100 100 TriaVertexInputEnum, 101 BoolInputEnum, 102 IntInputEnum, 103 DoubleInputEnum, 101 104 /*Params: */ 102 105 ParamEnum, … … 124 127 VxEnum, 125 128 VyEnum, 129 VzEnum, 130 VxAverageEnum, 131 VyAverageEnum, 132 VzAverageEnum, 133 VxObsEnum, 134 VyObsEnum, 135 VzObsEnum, 136 VxOldEnum, 137 VyOldEnum, 138 VzOldEnum, 139 DhDtEnum, 140 ThicknessEnum, 141 SurfaceEnum, 142 BedEnum, 143 DragCoefficientEnum, 144 DragPEnum, 145 DragQEnum, 146 DragTypeEnum, 147 RheologyBEnum, 148 RheologyNEnum, 149 MeltingRateEnum, 150 AccumulationRateEnum, 151 GeothermalFluxEnum, 152 ElementOnIceShelfEnum, 153 ElementOnBedEnum, 154 ElementOnWaterEnum, 155 ElementOnSurfaceEnum, 156 SurfaceAreaEnum, 157 WeightsEnum, 158 FitEnum, 159 AdjointxEnum, 160 AdjointyEnum, 161 PressureEnum 126 162 /*}}}*/ 127 163 -
issm/trunk/src/c/Gradjx/Gradjx.h
r3446 r3612 11 11 /* local prototypes: */ 12 12 void Gradjx( Vec* pgrad_g, int numberofnodes, DataSet* elements,DataSet* nodes, DataSet* vertices, DataSet* loads, DataSet* materials, DataSet* parameters, 13 ParameterInputs* inputs,int analysis_type,int sub_analysis_type,char* control_type);13 int analysis_type,int sub_analysis_type,char* control_type); 14 14 15 15 #endif /* _GRADJX_H */ -
issm/trunk/src/c/Makefile.am
r3599 r3612 30 30 ./objects/BamgOpts.cpp\ 31 31 ./objects/Element.h\ 32 ./objects/ElementProperties.h\33 ./objects/ElementProperties.cpp\34 32 ./objects/Model.h\ 35 33 ./objects/Model.cpp\ … … 67 65 ./objects/TriaVertexInput.h\ 68 66 ./objects/TriaVertexInput.cpp\ 67 ./objects/BoolInput.h\ 68 ./objects/BoolInput.cpp\ 69 ./objects/IntInput.h\ 70 ./objects/IntInput.cpp\ 71 ./objects/DoubleInput.h\ 72 ./objects/DoubleInput.cpp\ 69 73 ./objects/Sing.h\ 70 74 ./objects/Sing.cpp\ … … 82 86 ./objects/Input.cpp\ 83 87 ./objects/Einput.h\ 84 ./objects/ParameterInputs.h\85 ./objects/ParameterInputs.cpp\86 88 ./objects/Spc.cpp\ 87 89 ./objects/Spc.h\ … … 104 106 ./DataSet/DataSet.cpp\ 105 107 ./DataSet/DataSet.h\ 108 ./DataSet/Inputs.cpp\ 109 ./DataSet/Inputs.h\ 106 110 ./shared/shared.h\ 107 111 ./shared/Alloc/alloc.h\ … … 200 204 ./io/FetchParams.cpp\ 201 205 ./io/FetchNodeSets.cpp\ 202 ./io/ParameterInputsInit.cpp\203 206 ./io/pfopen.cpp\ 204 207 ./io/pfclose.cpp\ … … 272 275 ./Gradjx/Gradjx.h\ 273 276 ./Gradjx/Gradjx.cpp\ 274 ./UpdateFromInputsx/UpdateFromInputsx.h\275 ./UpdateFromInputsx/UpdateFromInputsx.cpp\276 277 ./UpdateInputsx/UpdateInputsx.h\ 277 278 ./UpdateInputsx/UpdateInputsx.cpp\ … … 441 442 ./objects/BamgOpts.cpp\ 442 443 ./objects/Element.h\ 443 ./objects/ElementProperties.h\444 ./objects/ElementProperties.cpp\445 444 ./objects/Model.h\ 446 445 ./objects/Model.cpp\ … … 478 477 ./objects/TriaVertexInput.h\ 479 478 ./objects/TriaVertexInput.cpp\ 479 ./objects/BoolInput.h\ 480 ./objects/BoolInput.cpp\ 481 ./objects/IntInput.h\ 482 ./objects/IntInput.cpp\ 483 ./objects/DoubleInput.h\ 484 ./objects/DoubleInput.cpp\ 480 485 ./objects/Sing.h\ 481 486 ./objects/Sing.cpp\ … … 490 495 ./objects/Numpar.h\ 491 496 ./objects/Numpar.cpp\ 492 ./objects/Input.h\493 ./objects/Input.cpp\494 497 ./objects/Einput.h\ 495 ./objects/ParameterInputs.h\496 ./objects/ParameterInputs.cpp\497 498 ./objects/Spc.cpp\ 498 499 ./objects/Spc.h\ … … 515 516 ./DataSet/DataSet.cpp\ 516 517 ./DataSet/DataSet.h\ 518 ./DataSet/Inputs.cpp\ 519 ./DataSet/Inputs.h\ 517 520 ./shared/shared.h\ 518 521 ./shared/Threads/issm_threads.h\ … … 608 611 ./io/WriteParams.cpp\ 609 612 ./io/FetchNodeSets.cpp\ 610 ./io/ParameterInputsInit.cpp\611 613 ./io/pfopen.cpp\ 612 614 ./io/pfclose.cpp\ … … 680 682 ./Gradjx/Gradjx.h\ 681 683 ./Gradjx/Gradjx.cpp\ 682 ./UpdateFromInputsx/UpdateFromInputsx.h\683 ./UpdateFromInputsx/UpdateFromInputsx.cpp\684 684 ./UpdateInputsx/UpdateInputsx.h\ 685 685 ./UpdateInputsx/UpdateInputsx.cpp\ -
issm/trunk/src/c/Misfitx/Misfitx.h
r3446 r3612 11 11 /* local prototypes: */ 12 12 void Misfitx( double* pJ, DataSet* elements,DataSet* nodes, DataSet* vertices, DataSet* loads, DataSet* materials, DataSet* parameters, 13 ParameterInputs* inputs,int analysis_type,int sub_analysis_type);13 int analysis_type,int sub_analysis_type); 14 14 15 15 #endif /* _MISFITX_H */ -
issm/trunk/src/c/ModelProcessorx/DiagnosticHoriz/CreateElementsNodesAndMaterialsDiagnosticHoriz.cpp
r3568 r3612 43 43 IoModelFetchData(&iomodel->surface,NULL,NULL,iomodel_handle,"surface"); 44 44 IoModelFetchData(&iomodel->bed,NULL,NULL,iomodel_handle,"bed"); 45 IoModelFetchData(&iomodel->drag ,NULL,NULL,iomodel_handle,"drag");46 IoModelFetchData(&iomodel-> p,NULL,NULL,iomodel_handle,"p");47 IoModelFetchData(&iomodel-> q,NULL,NULL,iomodel_handle,"q");45 IoModelFetchData(&iomodel->drag_coefficient,NULL,NULL,iomodel_handle,"drag_coefficient"); 46 IoModelFetchData(&iomodel->drag_p,NULL,NULL,iomodel_handle,"drag_p"); 47 IoModelFetchData(&iomodel->drag_q,NULL,NULL,iomodel_handle,"drag_q"); 48 48 IoModelFetchData(&iomodel->elementoniceshelf,NULL,NULL,iomodel_handle,"elementoniceshelf"); 49 49 IoModelFetchData(&iomodel->elementonwater,NULL,NULL,iomodel_handle,"elementonwater"); 50 50 IoModelFetchData(&iomodel->elements_type,NULL,NULL,iomodel_handle,"elements_type"); 51 IoModelFetchData(&iomodel->B,NULL,NULL,iomodel_handle,"B"); 52 IoModelFetchData(&iomodel->n,NULL,NULL,iomodel_handle,"n"); 53 IoModelFetchData(&iomodel->accumulation,NULL,NULL,iomodel_handle,"accumulation"); 54 IoModelFetchData(&iomodel->melting,NULL,NULL,iomodel_handle,"melting"); 51 IoModelFetchData(&iomodel->rheology_B,NULL,NULL,iomodel_handle,"rheology_B"); 52 IoModelFetchData(&iomodel->rheology_n,NULL,NULL,iomodel_handle,"rheology_n"); 55 53 56 54 for (i=0;i<iomodel->numberofelements;i++){ … … 71 69 /*Free data : */ 72 70 xfree((void**)&iomodel->elements); 71 xfree((void**)&iomodel->elements_type); 73 72 xfree((void**)&iomodel->thickness); 74 73 xfree((void**)&iomodel->surface); 75 74 xfree((void**)&iomodel->bed); 76 xfree((void**)&iomodel->drag); 77 xfree((void**)&iomodel->p); 78 xfree((void**)&iomodel->q); 75 xfree((void**)&iomodel->drag_coefficient); 76 xfree((void**)&iomodel->drag_p); 77 xfree((void**)&iomodel->drag_q); 78 xfree((void**)&iomodel->rheology_B); 79 xfree((void**)&iomodel->rheology_n); 79 80 xfree((void**)&iomodel->elementoniceshelf); 80 81 xfree((void**)&iomodel->elementonwater); 81 xfree((void**)&iomodel->B); 82 xfree((void**)&iomodel->n); 83 xfree((void**)&iomodel->elements_type); 84 82 85 83 } 86 84 else{ // if (strcmp(meshtype,"2d")==0) … … 88 86 /*Fetch data needed: */ 89 87 IoModelFetchData(&iomodel->elements,NULL,NULL,iomodel_handle,"elements"); 88 IoModelFetchData(&iomodel->elements_type,NULL,NULL,iomodel_handle,"elements_type"); 90 89 IoModelFetchData(&iomodel->thickness,NULL,NULL,iomodel_handle,"thickness"); 91 90 IoModelFetchData(&iomodel->surface,NULL,NULL,iomodel_handle,"surface"); 92 91 IoModelFetchData(&iomodel->bed,NULL,NULL,iomodel_handle,"bed"); 93 IoModelFetchData(&iomodel->drag,NULL,NULL,iomodel_handle,"drag"); 94 IoModelFetchData(&iomodel->p,NULL,NULL,iomodel_handle,"p"); 95 IoModelFetchData(&iomodel->q,NULL,NULL,iomodel_handle,"q"); 92 IoModelFetchData(&iomodel->drag_coefficient,NULL,NULL,iomodel_handle,"drag_coefficient"); 93 IoModelFetchData(&iomodel->drag_p,NULL,NULL,iomodel_handle,"drag_p"); 94 IoModelFetchData(&iomodel->drag_q,NULL,NULL,iomodel_handle,"drag_q"); 95 IoModelFetchData(&iomodel->rheology_B,NULL,NULL,iomodel_handle,"rheology_B"); 96 IoModelFetchData(&iomodel->rheology_n,NULL,NULL,iomodel_handle,"rheology_n"); 97 IoModelFetchData(&iomodel->elementonwater,NULL,NULL,iomodel_handle,"elementonwater"); 96 98 IoModelFetchData(&iomodel->elementoniceshelf,NULL,NULL,iomodel_handle,"elementoniceshelf"); 97 99 IoModelFetchData(&iomodel->elementonbed,NULL,NULL,iomodel_handle,"elementonbed"); 98 100 IoModelFetchData(&iomodel->elementonsurface,NULL,NULL,iomodel_handle,"elementonsurface"); 99 IoModelFetchData(&iomodel->elements_type,NULL,NULL,iomodel_handle,"elements_type"); 100 IoModelFetchData(&iomodel->B,NULL,NULL,iomodel_handle,"B"); 101 IoModelFetchData(&iomodel->n,NULL,NULL,iomodel_handle,"n"); 102 IoModelFetchData(&iomodel->accumulation,NULL,NULL,iomodel_handle,"accumulation"); 103 IoModelFetchData(&iomodel->melting,NULL,NULL,iomodel_handle,"melting"); 104 IoModelFetchData(&iomodel->elementonwater,NULL,NULL,iomodel_handle,"elementonwater"); 105 101 106 102 for (i=0;i<iomodel->numberofelements;i++){ 107 103 if(iomodel->my_elements[i]){ … … 120 116 /*Free data: */ 121 117 xfree((void**)&iomodel->elements); 118 xfree((void**)&iomodel->elements_type); 122 119 xfree((void**)&iomodel->thickness); 123 120 xfree((void**)&iomodel->surface); 124 121 xfree((void**)&iomodel->bed); 125 xfree((void**)&iomodel->drag); 126 xfree((void**)&iomodel->p); 127 xfree((void**)&iomodel->q); 122 xfree((void**)&iomodel->drag_coefficient); 123 xfree((void**)&iomodel->drag_p); 124 xfree((void**)&iomodel->drag_q); 125 xfree((void**)&iomodel->rheology_n); 126 xfree((void**)&iomodel->rheology_B); 128 127 xfree((void**)&iomodel->elementoniceshelf); 129 128 xfree((void**)&iomodel->elementonbed); 130 129 xfree((void**)&iomodel->elementonsurface); 131 xfree((void**)&iomodel->elements_type);132 xfree((void**)&iomodel->n);133 xfree((void**)&iomodel->B);134 xfree((void**)&iomodel->accumulation);135 xfree((void**)&iomodel->melting);136 130 xfree((void**)&iomodel->elementonwater); 131 137 132 138 133 } //if (strcmp(meshtype,"2d")==0) -
issm/trunk/src/c/ModelProcessorx/IoModel.cpp
r3582 r3612 85 85 86 86 iomodel->drag_type=0; 87 iomodel->drag =NULL;88 iomodel-> p=NULL;89 iomodel-> q=NULL;87 iomodel->drag_cofficient=NULL; 88 iomodel->drag_p=NULL; 89 iomodel->drag_q=NULL; 90 90 91 91 … … 102 102 iomodel->rho_ice=0; 103 103 iomodel->g=0; 104 iomodel-> n=NULL;105 iomodel-> B=NULL;104 iomodel->rheology_n=NULL; 105 iomodel->rheology_B=NULL; 106 106 107 107 /*!control methods: */ … … 170 170 171 171 /*!basal: */ 172 iomodel->accumulation =NULL;172 iomodel->accumulation_rate=NULL; 173 173 iomodel->dhdt=NULL; 174 174 … … 240 240 xfree((void**)&iomodel->pressure); 241 241 xfree((void**)&iomodel->temperature); 242 xfree((void**)&iomodel->drag );243 xfree((void**)&iomodel-> p);244 xfree((void**)&iomodel-> q);242 xfree((void**)&iomodel->drag_coefficient); 243 xfree((void**)&iomodel->drag_p); 244 xfree((void**)&iomodel->drag_q); 245 245 xfree((void**)&iomodel->elementoniceshelf); 246 246 xfree((void**)&iomodel->elementonwater); … … 253 253 xfree((void**)&iomodel->edges); 254 254 xfree((void**)&iomodel->geothermalflux); 255 xfree((void**)&iomodel->melting );256 xfree((void**)&iomodel->accumulation );255 xfree((void**)&iomodel->melting_rate); 256 xfree((void**)&iomodel->accumulation_rate); 257 257 xfree((void**)&iomodel->dhdt); 258 xfree((void**)&iomodel-> B);259 xfree((void**)&iomodel-> n);258 xfree((void**)&iomodel->rheology_B); 259 xfree((void**)&iomodel->rheology_n); 260 260 xfree((void**)&iomodel->fit); 261 261 xfree((void**)&iomodel->weights); -
issm/trunk/src/c/ModelProcessorx/IoModel.h
r3588 r3612 84 84 /*friction: */ 85 85 int drag_type; 86 double* drag ;87 double* p;88 double* q;86 double* drag_coefficient; 87 double* drag_p; 88 double* drag_q; 89 89 90 90 /*boundary conditions: */ … … 101 101 double rho_water,rho_ice; 102 102 double g; 103 double* B;104 double* n;103 double* rheology_B; 104 double* rheology_n; 105 105 106 106 /*numerical parameters: */ … … 170 170 171 171 /*basal: */ 172 double* melting ;173 double* accumulation ;172 double* melting_rate; 173 double* accumulation_rate; 174 174 double* dhdt; 175 175 -
issm/trunk/src/c/PenaltyConstraintsx/PenaltyConstraintsx.h
r3446 r3612 11 11 /* local prototypes: */ 12 12 void PenaltyConstraintsx(int* pconverged, int* pnum_unstable_constraints, DataSet* elements,DataSet* nodes, DataSet* vertices, 13 DataSet* loads,DataSet* materials, DataSet* parameters, ParameterInputs* inputs,int analysis_type,int sub_analysis_type);13 DataSet* loads,DataSet* materials, DataSet* parameters,int analysis_type,int sub_analysis_type); 14 14 15 15 #endif /* _PENALTYCONSTRAINTSX_H */ -
issm/trunk/src/c/PenaltySystemMatricesx/PenaltySystemMatricesx.cpp
r3595 r3612 11 11 12 12 void PenaltySystemMatricesx(Mat Kgg, Vec pg,double* pkmax,DataSet* elements,DataSet* nodes, DataSet* vertices,DataSet* loads,DataSet* materials, DataSet* parameters, 13 int kflag,int pflag, ParameterInputs* inputs,int analysis_type,int sub_analysis_type){13 int kflag,int pflag,int analysis_type,int sub_analysis_type){ 14 14 15 15 int i; -
issm/trunk/src/c/PenaltySystemMatricesx/PenaltySystemMatricesx.h
r3446 r3612 11 11 /* local prototypes: */ 12 12 void PenaltySystemMatricesx(Mat Kgg, Vec pg,double* pkmax, DataSet* elements,DataSet* nodes, DataSet* vertices,DataSet* loads,DataSet* materials, DataSet* parameters, 13 int kflag,int pflag, ParameterInputs* inputs,int analysis_type,int sub_analysis_type);13 int kflag,int pflag,int analysis_type,int sub_analysis_type); 14 14 15 15 #endif /* _PENALTYSYSTEMMATRICESX_H */ -
issm/trunk/src/c/Qmux/Qmux.h
r3446 r3612 15 15 void SpawnCoreSerial(double* responses, int numresponses, double* variables, char** variables_descriptors,int numvariables, mxArray* model,mxArray* inputs,int analysis_type,int sub_analysis_type,int counter); 16 16 #else 17 void Qmux(Model* model, ParameterInputs* inputs,int analysis_type,int sub_analysis_type);18 void SpawnCoreParallel(double* responses, int numresponses, double* variables, char** variables_descriptors,int numvariables, Model* model, ParameterInputs* inputs,int analysis_type,int sub_analysis_type,int counter);19 void DakotaResponses(double* responses,char** responses_descriptors,int numresponses,Model* model, DataSet* results,DataSet* processed_results, ParameterInputs* inputs,int analysis_type,int sub_analysis_type);17 void Qmux(Model* model,int analysis_type,int sub_analysis_type); 18 void SpawnCoreParallel(double* responses, int numresponses, double* variables, char** variables_descriptors,int numvariables, Model* model,int analysis_type,int sub_analysis_type,int counter); 19 void DakotaResponses(double* responses,char** responses_descriptors,int numresponses,Model* model, DataSet* results,DataSet* processed_results,int analysis_type,int sub_analysis_type); 20 20 #endif 21 21 -
issm/trunk/src/c/SurfaceAreax/SurfaceAreax.h
r3446 r3612 11 11 /* local prototypes: */ 12 12 void SurfaceAreax( double* pS, DataSet* elements,DataSet* nodes, DataSet* vertices, DataSet* loads, DataSet* materials, DataSet* parameters, 13 ParameterInputs* inputs,int analysis_type,int sub_analysis_type);13 int analysis_type,int sub_analysis_type); 14 14 15 15 #endif /* _SURFACEAREAX_H */ -
issm/trunk/src/c/SystemMatricesx/SystemMatricesx.cpp
r3483 r3612 11 11 12 12 void SystemMatricesx(Mat* pKgg, Vec* ppg,DataSet* elements,DataSet* nodes, DataSet* vertices,DataSet* loads,DataSet* materials, DataSet* parameters, 13 int kflag,int pflag,int connectivity,int numberofdofspernode, ParameterInputs* inputs,int analysis_type,int sub_analysis_type){13 int kflag,int pflag,int connectivity,int numberofdofspernode,int analysis_type,int sub_analysis_type){ 14 14 15 15 int i; … … 30 30 loads->Configure(elements, loads, nodes,vertices, materials,parameters); 31 31 parameters->Configure(elements,loads, nodes,vertices, materials,parameters); 32 32 33 33 34 /*Get size of matrix: */ -
issm/trunk/src/c/SystemMatricesx/SystemMatricesx.h
r3446 r3612 11 11 /* local prototypes: */ 12 12 void SystemMatricesx(Mat* pKgg, Vec* ppg,DataSet* elements,DataSet* nodes, DataSet* vertices,DataSet* loads,DataSet* materials, DataSet* parameters, 13 int kflag,int pflag,int connectivity,int numberofdofspernode, ParameterInputs* inputs,int analysis_type,int sub_analysis_type);13 int kflag,int pflag,int connectivity,int numberofdofspernode,int analysis_type,int sub_analysis_type); 14 14 15 15 #endif /* _SYSTEMMATRICESX_H */ -
issm/trunk/src/c/UpdateInputsx/UpdateInputsx.cpp
r3599 r3612 31 31 elements->UpdateInputs(serial_solution,analysis_type,sub_analysis_type); 32 32 33 elements->Echo();34 35 33 /*Free ressources:*/ 36 34 xfree((void**)&serial_solution); -
issm/trunk/src/c/UpdateVertexPositionsx/UpdateVertexPositionsx.h
r3446 r3612 7 7 8 8 #include "../DataSet/DataSet.h" 9 #include "../objects/ParameterInputs.h"10 9 11 10 /* local prototypes: */ -
issm/trunk/src/c/issm.h
r3599 r3612 39 39 #include "./ConfigureObjectsx/ConfigureObjectsx.h" 40 40 #include "./SystemMatricesx/SystemMatricesx.h" 41 #include "./UpdateFromInputsx/UpdateFromInputsx.h"42 41 #include "./UpdateInputsx/UpdateInputsx.h" 43 42 #include "./UpdateGeometryx/UpdateGeometryx.h" -
issm/trunk/src/c/objects/Beam.cpp
r3599 r3612 243 243 } 244 244 /*}}}*/ 245 /*FUNCTION Beam::UpdateFromInputs{{{1*/246 void Beam::UpdateFromInputs(void* vinputs){247 248 int dofs[1]={0};249 double temperature_list[2];250 double temperature_average;251 double B_list[2];252 double B_average;253 254 /*dynamic objects pointed to by hooks: */255 Node** nodes=NULL;256 Matpar* matpar=NULL;257 Matice* matice=NULL;258 Numpar* numpar=NULL;259 260 ParameterInputs* inputs=NULL;261 262 /*recover pointers: */263 inputs=(ParameterInputs*)vinputs;264 265 /*recover objects from hooks: */266 nodes=(Node**)hnodes.deliverp();267 matpar=(Matpar*)hmatpar.delivers();268 matice=(Matice*)hmatice.delivers();269 numpar=(Numpar*)hnumpar.delivers();270 271 /*Update internal data if inputs holds new values: */272 //if (id==1) printf("WARNING if QMU: no hydrostatic equilibrium is applied here (conflict with prognostic, which does not have matpar)\n");273 //For now274 if(this->properties.h) inputs->Recover("thickness",&this->properties.h[0],1,dofs,2,(void**)nodes);275 //Later276 /*277 if(inputs->Recover("thickness",&new_h[0],1,dofs,2,(void**)nodes)){278 //density, needed later:279 double di=(this->matpar->GetRhoIce()/this->matpar->GetRhoWater());280 //Go through grids:281 for (i=0;i<2;i++){282 if(nodes[i]->IsOnShelf()){283 this->b[i]=this->b[i]-di*(new_h[i]-h[i]); //hydrostatic equilibrium;284 }285 this->s[i]=this->b[i]+new_h[i];286 this->h[i]=new_h[i];287 }288 }289 */290 if (this->properties.s) inputs->Recover("surface",&this->properties.s[0],1,dofs,2,(void**)nodes);291 if (this->properties.b) inputs->Recover("bed",&this->properties.b[0],1,dofs,2,(void**)nodes);292 if (this->properties.k) inputs->Recover("drag",&this->properties.k[0],1,dofs,2,(void**)nodes);293 if (this->properties.melting) inputs->Recover("melting",&this->properties.melting[0],1,dofs,2,(void**)nodes);294 if (this->properties.accumulation) inputs->Recover("accumulation",&this->properties.accumulation[0],1,dofs,2,(void**)nodes);295 if (this->properties.geothermalflux) inputs->Recover("geothermalflux",&this->properties.geothermalflux[0],1,dofs,2,(void**)nodes);296 297 //Update material if necessary298 if(inputs->Recover("temperature_average",&temperature_list[0],1,dofs,2,(void**)nodes)){299 temperature_average=(temperature_list[0]+temperature_list[1])/2.0;300 B_average=Paterson(temperature_average);301 matice->SetB(B_average);302 }303 if(inputs->Recover("temperature",&temperature_list[0],1,dofs,2,(void**)nodes)){304 temperature_average=(temperature_list[0]+temperature_list[1])/2.0;305 B_average=Paterson(temperature_average);306 matice->SetB(B_average);307 }308 if(inputs->Recover("B",&B_list[0],1,dofs,2,(void**)nodes)){309 B_average=(B_list[0]+B_list[1])/2.0;310 matice->SetB(B_average);311 }312 313 }314 /*}}}*/315 245 316 246 /*Object functions*/ 317 247 /*FUNCTION Beam::ComputeBasalStress{{{1*/ 318 void Beam::ComputeBasalStress(Vec eps, void* inputs,int analysis_type,int sub_analysis_type){248 void Beam::ComputeBasalStress(Vec eps,int analysis_type,int sub_analysis_type){ 319 249 320 250 ISSMERROR("Not implemented yet"); … … 323 253 /*}}}*/ 324 254 /*FUNCTION Beam::ComputePressure{{{1*/ 325 void Beam::ComputePressure(Vec p_g, void* inputs,int analysis_type,int sub_analysis_type){255 void Beam::ComputePressure(Vec p_g,int analysis_type,int sub_analysis_type){ 326 256 327 257 int i; … … 366 296 /*}}}*/ 367 297 /*FUNCTION Beam::ComputeStrainRate{{{1*/ 368 void Beam::ComputeStrainRate(Vec eps, void* inputs,int analysis_type,int sub_analysis_type){298 void Beam::ComputeStrainRate(Vec eps,int analysis_type,int sub_analysis_type){ 369 299 370 300 ISSMERROR("Not implemented yet"); … … 379 309 /*FUNCTION Beam::CreateKMatrix{{{1*/ 380 310 381 void Beam::CreateKMatrix(Mat Kgg, void* inputs,int analysis_type,int sub_analysis_type){311 void Beam::CreateKMatrix(Mat Kgg,int analysis_type,int sub_analysis_type){ 382 312 383 313 /*Just branch to the correct element stiffness matrix generator, according to the type of analysis we are carrying out: */ … … 399 329 /*FUNCTION Beam::CreateKMatrixDiagnosticHutter{{{1*/ 400 330 401 void Beam::CreateKMatrixDiagnosticHutter(Mat Kgg, void* vinputs,int analysis_type,int sub_analysis_type){331 void Beam::CreateKMatrixDiagnosticHutter(Mat Kgg,int analysis_type,int sub_analysis_type){ 402 332 403 333 … … 432 362 /*}}}*/ 433 363 /*FUNCTION Beam::CreatePVector{{{1*/ 434 void Beam::CreatePVector(Vec pg, void* inputs,int analysis_type,int sub_analysis_type){364 void Beam::CreatePVector(Vec pg,int analysis_type,int sub_analysis_type){ 435 365 436 366 /*Just branch to the correct load generator, according to the type of analysis we are carrying out: */ … … 450 380 /*FUNCTION Beam::CreatePVectorDiagnosticHutter{{{1*/ 451 381 452 void Beam::CreatePVectorDiagnosticHutter( Vec pg, void* vinputs,int analysis_type,int sub_analysis_type){382 void Beam::CreatePVectorDiagnosticHutter( Vec pg, int analysis_type,int sub_analysis_type){ 453 383 454 384 int i,j,k; … … 699 629 /*}}}*/ 700 630 /*FUNCTION Beam::GetOnBed{{{1*/ 701 intBeam::GetOnBed(){631 bool Beam::GetOnBed(){ 702 632 ISSMERROR(" not supported yet!"); 703 633 } … … 714 644 /*}}}*/ 715 645 /*FUNCTION Beam::GetShelf{{{1*/ 716 intBeam::GetShelf(){646 bool Beam::GetShelf(){ 717 647 ISSMERROR(" not supported yet!"); 718 648 } -
issm/trunk/src/c/objects/Beam.h
r3599 r3612 11 11 #include "./Matice.h" 12 12 #include "./Matpar.h" 13 #include "./ParameterInputs.h"14 #include "./ElementProperties.h"15 13 #include "../ModelProcessorx/IoModel.h" 16 14 #include "./Hook.h" … … 20 18 class Element; 21 19 class Hook; 22 class ElementProperties;23 20 24 21 class Beam: public Element{ … … 34 31 Hook hnumpar; //hook to 1 numpar 35 32 36 ElementProperties properties;33 Inputs* inputs; 37 34 38 35 public: … … 40 37 /*constructors, destructors: {{{1*/ 41 38 Beam(); 42 Beam(int beam_id,int* beam_node_ids, int beam_matice_id, int beam_matpar_id, int beam_numpar_id , ElementProperties* beam_properties);43 Beam(int beam_id,Hook* beam_hnodes, Hook* beam_hmatice, Hook* beam_hmatpar, Hook* beam_hnumpar, ElementProperties* beam_properties);39 Beam(int beam_id,int* beam_node_ids, int beam_matice_id, int beam_matpar_id, int beam_numpar_id); 40 Beam(int beam_id,Hook* beam_hnodes, Hook* beam_hmatice, Hook* beam_hmatpar, Hook* beam_hnumpar, Inputs* beam_inputs); 44 41 Beam(int i, IoModel* iomodel); 45 42 ~Beam(); … … 61 58 /*}}}*/ 62 59 /*numerics: {{{1*/ 63 void CreateKMatrix(Mat Kgg,void* inputs,int analysis_type,int sub_analysis_type); 64 void CreatePVector(Vec pg, void* inputs, int analysis_type,int sub_analysis_type); 65 void UpdateFromInputs(void* inputs); 60 void CreateKMatrix(Mat Kgg,int analysis_type,int sub_analysis_type); 61 void CreatePVector(Vec pg, int analysis_type,int sub_analysis_type); 66 62 void UpdateInputs(double* solution, int analysis_type, int sub_analysis_type); 67 63 void GetDofList(int* doflist,int* pnumberofdofs); 68 64 void GetDofList1(int* doflist); 69 void CreateKMatrixDiagnosticHutter(Mat Kgg, void* inputs,int analysis_type,int sub_analysis_type);65 void CreateKMatrixDiagnosticHutter(Mat Kgg,int analysis_type,int sub_analysis_type); 70 66 void GetParameterValue(double* pp, double* plist, double* gauss_l1l2l3); 71 void CreatePVectorDiagnosticHutter(Vec pg, void* inputs,int analysis_type,int sub_analysis_type);67 void CreatePVectorDiagnosticHutter(Vec pg,int analysis_type,int sub_analysis_type); 72 68 void* GetMatPar(); 73 69 74 void ComputeBasalStress(Vec sigma_b, void* inputs,int analysis_type,int sub_analysis_type);75 void ComputePressure(Vec p_g, void* inputs,int analysis_type,int sub_analysis_type);76 void ComputeStrainRate(Vec eps, void* inputs,int analysis_type,int sub_analysis_type);70 void ComputeBasalStress(Vec sigma_b,int analysis_type,int sub_analysis_type); 71 void ComputePressure(Vec p_g,int analysis_type,int sub_analysis_type); 72 void ComputeStrainRate(Vec eps,int analysis_type,int sub_analysis_type); 77 73 void GetNodes(void** vpnodes); 78 74 /*}}}*/ 79 75 /*not implemented: {{{1*/ 80 intGetShelf();81 intGetOnBed();76 bool GetShelf(); 77 bool GetOnBed(); 82 78 void GetBedList(double*); 83 79 void GetThicknessList(double* thickness_list); -
issm/trunk/src/c/objects/Element.h
r3599 r3612 17 17 18 18 virtual ~Element(){}; 19 virtual int Enum()=0; 19 20 virtual void Configure(void* loads,void* nodes,void* materials,void* parameters)=0; 20 virtual void CreateKMatrix(Mat Kgg,void* inputs,int analysis_type,int sub_analysis_type)=0; 21 virtual void CreatePVector(Vec pg, void* inputs, int analysis_type,int sub_analysis_type)=0; 22 virtual int Enum()=0; 23 virtual void UpdateFromInputs(void* inputs)=0; 21 22 virtual void CreateKMatrix(Mat Kgg,int analysis_type,int sub_analysis_type)=0; 23 virtual void CreatePVector(Vec pg, int analysis_type,int sub_analysis_type)=0; 24 24 virtual void UpdateInputs(double* solution, int analysis_type, int sub_analysis_type)=0; 25 25 virtual void GetNodes(void** nodes)=0; 26 26 virtual void* GetMatPar()=0; 27 virtual intGetShelf()=0;28 virtual intGetOnBed()=0;27 virtual bool GetShelf()=0; 28 virtual bool GetOnBed()=0; 29 29 virtual void GetThicknessList(double* thickness_list)=0; 30 30 virtual void GetBedList(double* bed_list)=0; 31 virtual void Du(Vec du_g, void* inputs,int analysis_type,int sub_analysis_type)=0;32 virtual void Gradj(Vec grad_g, void* inputs,int analysis_type,int sub_analysis_type,char* control_type)=0;33 virtual void GradjDrag(Vec grad_g, void* inputs,int analysis_type,int sub_analysis_type)=0;34 virtual void GradjB(Vec grad_g, void* inputs,int analysis_type,int sub_analysis_type)=0;35 virtual double Misfit( void* inputs,int analysis_type,int sub_analysis_type)=0;36 virtual double CostFunction( void* inputs,int analysis_type,int sub_analysis_type)=0;37 virtual double SurfaceArea( void* inputs,int analysis_type,int sub_analysis_type)=0;38 virtual void ComputeBasalStress(Vec sigma_b, void* inputs,int analysis_type,int sub_analysis_type)=0;39 virtual void ComputePressure(Vec p_g, void* inputs,int analysis_type,int sub_analysis_type)=0;40 virtual void ComputeStrainRate(Vec eps, void* inputs,int analysis_type,int sub_analysis_type)=0;31 virtual void Du(Vec du_g,int analysis_type,int sub_analysis_type)=0; 32 virtual void Gradj(Vec grad_g,int analysis_type,int sub_analysis_type,char* control_type)=0; 33 virtual void GradjDrag(Vec grad_g,int analysis_type,int sub_analysis_type)=0; 34 virtual void GradjB(Vec grad_g,int analysis_type,int sub_analysis_type)=0; 35 virtual double Misfit(int analysis_type,int sub_analysis_type)=0; 36 virtual double CostFunction(int analysis_type,int sub_analysis_type)=0; 37 virtual double SurfaceArea(int analysis_type,int sub_analysis_type)=0; 38 virtual void ComputeBasalStress(Vec sigma_b,int analysis_type,int sub_analysis_type)=0; 39 virtual void ComputePressure(Vec p_g, int analysis_type,int sub_analysis_type)=0; 40 virtual void ComputeStrainRate(Vec eps, int analysis_type,int sub_analysis_type)=0; 41 41 virtual double MassFlux(double* segment,double* ug)=0; 42 42 -
issm/trunk/src/c/objects/Friction.cpp
r2907 r3612 45 45 printf("\n"); 46 46 47 printf("v elocities: ");48 for(i=0;i<3;i++)printf("%g ",friction->v elocities[i*2+0]);47 printf("vx: "); 48 for(i=0;i<3;i++)printf("%g ",friction->vx[i]); 49 49 printf("\n "); 50 for(i=0;i<3;i++)printf("%g ",friction->velocities[i*2+1]); 50 printf("vy: "); 51 for(i=0;i<3;i++)printf("%g ",friction->vy[i]); 51 52 printf("\n"); 53 if(friction->vz){ 54 printf("vz: "); 55 for(i=0;i<3;i++)printf("%g ",friction->vz[i]); 56 printf("\n"); 57 } 58 52 59 } 53 60 /*}}}*/ … … 66 73 friction->bed=NULL; 67 74 friction->thickness=NULL; 68 friction->velocities=NULL; 75 friction->vx=NULL; 76 friction->vy=NULL; 77 friction->vz=NULL; 69 78 friction->p=UNDEF; 70 79 friction->q=UNDEF; … … 127 136 //We need the velocity magnitude to evaluate the basal stress: 128 137 if(strcmp(friction->element_type,"2d")){ 129 velocity_x[i]= *(friction->velocities+2*i+0);//velocities of size numgridsx2130 velocity_y[i]= *(friction->velocities+2*i+1);138 velocity_x[i]=friction->vx[i];//velocities of size numgridsx2 139 velocity_y[i]=friction->vy[i]; 131 140 velocity_mag[i]=sqrt(pow(velocity_x[i],2)+pow(velocity_y[i],2)); 132 141 } 133 142 else{ 134 velocity_x[i]= *(friction->velocities+3*i+0); //velocities of size numgridsx3135 velocity_y[i]= *(friction->velocities+3*i+1);136 velocity_z[i]= *(friction->velocities+3*i+2);143 velocity_x[i]=friction->vx[i]; //velocities of size numgridsx3 144 velocity_y[i]=friction->vy[i]; 145 velocity_z[i]=friction->vz[i]; 137 146 velocity_mag[i]=sqrt(pow(velocity_x[i],2)+pow(velocity_y[i],2)+pow(velocity_z[i],2)); 138 147 } … … 177 186 178 187 //We need the velocity magnitude to evaluate the basal stress: 179 velocity_x[i]= *(friction->velocities+2*i+0); //velocities of size numgridsx2180 velocity_y[i]= *(friction->velocities+2*i+1);188 velocity_x[i]=friction->vx[i]; //velocities of size numgridsx2 189 velocity_y[i]=friction->vy[i]; 181 190 velocity_mag[i]=sqrt(pow(velocity_x[i],2)+pow(velocity_y[i],2)); 182 191 -
issm/trunk/src/c/objects/Friction.h
r2359 r3612 16 16 double* bed; 17 17 double* thickness; 18 double* velocities; 18 double* vx; 19 double* vy; 20 double* vz; 19 21 double p; 20 22 double q; -
issm/trunk/src/c/objects/Hook.cpp
r3570 r3612 16 16 #include "./Hook.h" 17 17 #include "../EnumDefinitions/EnumDefinitions.h" 18 #include "./ParameterInputs.h"19 18 #include "../shared/shared.h" 20 19 #include "../include/typedefs.h" -
issm/trunk/src/c/objects/Input.h
r3463 r3612 1 /*!\file Input.h2 * \brief : header file for input object3 */ 1 /*!\file: Input.h 2 * \brief abstract class for Input object 3 */ 4 4 5 #ifndef _INPUT_H_6 #define _INPUT_H_7 5 8 #i nclude "./Param.h" //for enums STRING,INTEGER,DOUBLE AND DOUBLEVEC9 # include "./Node.h"6 #ifndef _EINPUT_H_ 7 #define _EINPUT_H_ 10 8 11 # define INPUTSTRING 200 //max string length9 #include "./Object.h" 12 10 13 class Input: public Object 11 class Input: public Object{ 14 12 15 private: 16 char name[INPUTSTRING]; //"analysis_type","velocity", etc ... 17 int type; //STRING, INTEGER, DOUBLE OR DOUBLEVEC 18 19 /*placeholders: */ 20 char string[INPUTSTRING]; 21 int integer; 22 double scalar; 23 double* vector; 13 public: 24 14 25 int ndof; //number of dofs for input array 26 int numberofnodes; //size of input array for each dof 27 28 public: 29 30 /*constructors and destructors: */ 31 Input(); 32 ~Input(); 33 Input(char* name,char* string); 34 Input(char* name,int integer); 35 Input(char* name,double scalar); 36 Input(char* name,double* vector,int ndof,int numberofnodes); 37 Input(char* name,Vec petscvector,int ndof, int numberofnodes); 38 39 40 Object* copy(); 41 42 /*fill virtual routines: */ 43 void Echo(); 44 void DeepEcho(void); 45 void Marshall(char** pmarshalled_dataset); 46 int MarshallSize(); 47 char* GetName(); 48 void Demarshall(char** pmarshalled_dataset); 49 int Enum(); 50 int GetId(); 51 int MyRank(); 52 53 /*Input specific routines: */ 54 int IsSameName(char* input_name); 55 int IsPresent(char* input_name); 56 void Recover(double* values, int ndof, int* dofs,int numnodes,void** nodes); 57 void Recover(int* pinteger); 58 void Recover(char** pstring); 59 void Recover(double* pdouble); 60 61 /*get into workspace: */ 62 Vec Get(int* dofs, int numdofs); 15 virtual ~Input(){}; 16 virtual int Enum()=0; //object Enum 17 virtual int EnumType()=0; //type of input (vx,vy?) 63 18 64 19 }; 65 66 #endif /* _INPUT_H_ */ 20 #endif -
issm/trunk/src/c/objects/Matice.cpp
r3595 r3612 53 53 /*Compute B on the element if provided*/ 54 54 if (num_vertices==3 || num_vertices==6){ 55 if (iomodel-> B){55 if (iomodel->rheology_B){ 56 56 B_avg=0; 57 57 for(j=0;j<num_vertices;j++){ 58 B_avg+=*(iomodel-> B+((int)*(iomodel->elements+num_vertices*i+j)-1));58 B_avg+=*(iomodel->rheology_B+((int)*(iomodel->elements+num_vertices*i+j)-1)); 59 59 } 60 60 B_avg=B_avg/num_vertices; … … 62 62 } 63 63 else if (num_vertices==1 || num_vertices==2){ 64 if (iomodel-> B){65 B_avg=*(iomodel-> B+i);64 if (iomodel->rheology_B){ 65 B_avg=*(iomodel->rheology_B+i); 66 66 } 67 67 } 68 68 else ISSMERROR("num_vertices = %i not supported yet",num_vertices); 69 69 70 if (iomodel-> B) matice_B=B_avg;70 if (iomodel->rheology_B) matice_B=B_avg; 71 71 else matice_B=UNDEF; 72 if (iomodel-> n){72 if (iomodel->rheology_n){ 73 73 if (num_vertices==3 || num_vertices==6){ 74 matice_n=(double)*(iomodel-> n+i);74 matice_n=(double)*(iomodel->rheology_n+i); 75 75 } 76 76 else if (num_vertices==1 || num_vertices==2){ 77 77 /*n is on the elements for now, so just take the first one*/ 78 matice_n=(double)*(iomodel-> n);78 matice_n=(double)*(iomodel->rheology_n); 79 79 } 80 80 else ISSMERROR("num_vertices = %i not supported yet",num_vertices); -
issm/trunk/src/c/objects/Node.cpp
r3570 r3612 17 17 #include <string.h> 18 18 #include "../EnumDefinitions/EnumDefinitions.h" 19 #include "./ParameterInputs.h"20 19 #include "../shared/shared.h" 21 20 #include "../include/typedefs.h" -
issm/trunk/src/c/objects/Numpar.cpp
r3607 r3612 39 39 cm_maxdmp_value=UNDEF; 40 40 cm_maxdmp_slope=UNDEF; 41 dt=UNDEF; 41 42 42 43 return; … … 82 83 memcpy(marshalled_dataset,&cm_maxdmp_value,sizeof(cm_maxdmp_value));marshalled_dataset+=sizeof(cm_maxdmp_value); 83 84 memcpy(marshalled_dataset,&cm_maxdmp_slope,sizeof(cm_maxdmp_slope));marshalled_dataset+=sizeof(cm_maxdmp_slope); 85 memcpy(marshalled_dataset,&dt,sizeof(dt));marshalled_dataset+=sizeof(dt); 84 86 85 87 *pmarshalled_dataset=marshalled_dataset; … … 101 103 +sizeof(cm_maxdmp_value) 102 104 +sizeof(cm_maxdmp_slope) 105 +sizeof(dt) 103 106 +sizeof(int); //sizeof(int) for enum type 104 107 } … … 128 131 memcpy(&cm_maxdmp_value,marshalled_dataset,sizeof(cm_maxdmp_value));marshalled_dataset+=sizeof(cm_maxdmp_value); 129 132 memcpy(&cm_maxdmp_slope,marshalled_dataset,sizeof(cm_maxdmp_slope));marshalled_dataset+=sizeof(cm_maxdmp_slope); 133 memcpy(&dt,marshalled_dataset,sizeof(dt));marshalled_dataset+=sizeof(dt); 130 134 131 135 /*return: */ … … 158 162 parameters->FindParam(&cm_maxdmp_value,"cm_maxdmp_value"); 159 163 parameters->FindParam(&cm_maxdmp_slope,"cm_maxdmp_slope"); 164 parameters->FindParam(&dt,"dt"); 160 165 161 166 return; … … 185 190 printf(" cm_maxdmp_value: %g\n",cm_maxdmp_value); 186 191 printf(" cm_maxdmp_slope: %g\n",cm_maxdmp_slope); 192 printf(" dt: %g\n",dt); 187 193 } 188 194 /*}}}*/ … … 203 209 printf(" cm_maxdmp_value: %g\n",cm_maxdmp_value); 204 210 printf(" cm_maxdmp_slope: %g\n",cm_maxdmp_slope); 211 printf(" dt: %g\n",dt); 205 212 } 206 213 /*}}}*/ … … 246 253 inputs->Recover("cm_maxdmp_value",&cm_maxdmp_value); 247 254 inputs->Recover("cm_maxdmp_slope",&cm_maxdmp_slope); 248 249 } 250 /*}}}*/ 255 inputs->Recover("dt",&dt); 256 257 } 258 /*}}}*/ -
issm/trunk/src/c/objects/Numpar.h
r3463 r3612 27 27 double cm_maxdmp_value; 28 28 double cm_maxdmp_slope; 29 double dt; 29 30 30 31 Numpar(); -
issm/trunk/src/c/objects/OptArgs.h
r1881 r3612 24 24 #else 25 25 26 #include "./ParameterInputs.h"27 class ParameterInputs;28 29 26 struct OptArgs{ 30 27 Model* model; 31 28 double* param_g; 32 29 double* grad_g; 33 ParameterInputs* inputs;34 30 int n; 35 31 }; -
issm/trunk/src/c/objects/Penta.cpp
r3599 r3612 266 266 } 267 267 /*}}}*/ 268 /*FUNCTION UpdateFromInputs {{{1*/269 void Penta::UpdateFromInputs(void* vinputs){270 271 int dofs[1]={0};272 double temperature_list[6];273 double temperature_average;274 double B_list[6];275 double B_average;276 277 /*dynamic objects pointed to by hooks: */278 Node** nodes=NULL;279 Matice* matice=NULL;280 281 ParameterInputs* inputs=NULL;282 283 /*If on water, skip: */284 if(this->properties.onwater)return;285 286 /*recover objects from hooks: */287 nodes=(Node**)hnodes.deliverp();288 matice=(Matice*)hmatice.delivers();289 290 /*recover pointers: */291 inputs=(ParameterInputs*)vinputs;292 293 /*Update internal data if inputs holds new values: */294 if (this->properties.h) inputs->Recover("thickness",&this->properties.h[0],1,dofs,6,(void**)nodes);295 if (this->properties.s) inputs->Recover("surface",&this->properties.s[0],1,dofs,6,(void**)nodes);296 if (this->properties.b) inputs->Recover("bed",&this->properties.b[0],1,dofs,6,(void**)nodes);297 if (this->properties.k) inputs->Recover("drag",&this->properties.k[0],1,dofs,6,(void**)nodes);298 if (this->properties.melting) inputs->Recover("melting",&this->properties.melting[0],1,dofs,6,(void**)nodes);299 if (this->properties.accumulation) inputs->Recover("accumulation",&this->properties.accumulation[0],1,dofs,6,(void**)nodes);300 if (this->properties.geothermalflux) inputs->Recover("geothermalflux",&this->properties.geothermalflux[0],1,dofs,6,(void**)nodes);301 302 //Update material if necessary303 if(inputs->Recover("temperature",&temperature_list[0],1,dofs,6,(void**)nodes)){304 if(matice && !this->properties.collapse){305 //B_average=(Paterson(temperature_list[0])+Paterson(temperature_list[1])+Paterson(temperature_list[2])306 // +Paterson(temperature_list[3])+Paterson(temperature_list[4])+Paterson(temperature_list[5]))/6.0;307 temperature_average=(temperature_list[0]+temperature_list[1]+temperature_list[2]+temperature_list[3]+temperature_list[4]+temperature_list[5])/6.0;308 B_average=Paterson(temperature_average);309 matice->SetB(B_average);310 }311 }312 313 if(inputs->Recover("temperature_average",&temperature_list[0],1,dofs,6,(void**)nodes)){314 if(matice && this->properties.collapse){315 temperature_average=(temperature_list[0]+temperature_list[1]+temperature_list[2]+temperature_list[3]+temperature_list[4]+temperature_list[5])/6.0;316 B_average=Paterson(temperature_average);317 //B_average=(Paterson(temperature_list[0])+Paterson(temperature_list[1])+Paterson(temperature_list[2])318 // +Paterson(temperature_list[3])+Paterson(temperature_list[4])+Paterson(temperature_list[5]))/6.0;319 matice->SetB(B_average);320 }321 }322 323 if(inputs->Recover("B",&B_list[0],1,dofs,6,(void**)nodes)){324 if(matice){325 B_average=(B_list[0]+B_list[1]+B_list[2]+B_list[3]+B_list[4]+B_list[5])/6.0;326 matice->SetB(B_average);327 }328 }329 330 }331 /*}}}*/332 268 /*FUNCTION UpdateFromDakota {{{1*/ 333 269 void Penta::UpdateFromDakota(void* vinputs){ … … 345 281 /*Object functions*/ 346 282 /*FUNCTION ComputeBasalStress {{{1*/ 347 void Penta::ComputeBasalStress(Vec sigma_b, void* vinputs,int analysis_type,int sub_analysis_type){283 void Penta::ComputeBasalStress(Vec sigma_b,int analysis_type,int sub_analysis_type){ 348 284 349 285 int i,j; … … 477 413 /*}}}*/ 478 414 /*FUNCTION ComputePressure {{{1*/ 479 void Penta::ComputePressure(Vec pg, void* vinputs,int analysis_type,int sub_analysis_type){415 void Penta::ComputePressure(Vec pg,int analysis_type,int sub_analysis_type){ 480 416 481 417 int i; … … 519 455 /*}}}*/ 520 456 /*FUNCTION ComputeStrainRate {{{1*/ 521 void Penta::ComputeStrainRate(Vec eps, void* vinputs,int analysis_type,int sub_analysis_type){457 void Penta::ComputeStrainRate(Vec eps,int analysis_type,int sub_analysis_type){ 522 458 523 459 ISSMERROR("Not implemented yet"); … … 526 462 /*}}}*/ 527 463 /*FUNCTION CostFunction {{{1*/ 528 double Penta::CostFunction( void* inputs,int analysis_type,int sub_analysis_type){464 double Penta::CostFunction(int analysis_type,int sub_analysis_type){ 529 465 530 466 double J; … … 560 496 /*FUNCTION CreateKMatrix {{{1*/ 561 497 562 void Penta::CreateKMatrix(Mat Kgg, void* inputs,int analysis_type,int sub_analysis_type){498 void Penta::CreateKMatrix(Mat Kgg,int analysis_type,int sub_analysis_type){ 563 499 564 500 /*Just branch to the correct element stiffness matrix generator, according to the type of analysis we are carrying out: */ … … 608 544 /*}}}*/ 609 545 /*FUNCTION CreateKMatrixDiagnosticHoriz {{{1*/ 610 void Penta::CreateKMatrixDiagnosticHoriz( Mat Kgg, void* vinputs,int analysis_type,int sub_analysis_type){546 void Penta::CreateKMatrixDiagnosticHoriz( Mat Kgg, int analysis_type,int sub_analysis_type){ 611 547 612 548 … … 844 780 /*}}}*/ 845 781 /*FUNCTION CreateKMatrixDiagnosticStokes {{{1*/ 846 void Penta::CreateKMatrixDiagnosticStokes( Mat Kgg, void* vinputs,int analysis_type,int sub_analysis_type){782 void Penta::CreateKMatrixDiagnosticStokes( Mat Kgg, int analysis_type,int sub_analysis_type){ 847 783 848 784 int i,j; … … 1139 1075 /*}}}*/ 1140 1076 /*FUNCTION CreateKMatrixDiagnosticVert {{{1*/ 1141 void Penta::CreateKMatrixDiagnosticVert( Mat Kgg, void* vinputs,int analysis_type,int sub_analysis_type){1077 void Penta::CreateKMatrixDiagnosticVert( Mat Kgg, int analysis_type,int sub_analysis_type){ 1142 1078 1143 1079 /* local declarations */ … … 1275 1211 /*}}}*/ 1276 1212 /*FUNCTION CreateKMatrixMelting {{{1*/ 1277 void Penta::CreateKMatrixMelting(Mat Kgg, void* inputs,int analysis_type,int sub_analysis_type){1213 void Penta::CreateKMatrixMelting(Mat Kgg,int analysis_type,int sub_analysis_type){ 1278 1214 1279 1215 Tria* tria=NULL; … … 1296 1232 /*FUNCTION CreateKMatrixPrognostic {{{1*/ 1297 1233 1298 void Penta::CreateKMatrixPrognostic(Mat Kgg, void* inputs,int analysis_type,int sub_analysis_type){1234 void Penta::CreateKMatrixPrognostic(Mat Kgg,int analysis_type,int sub_analysis_type){ 1299 1235 1300 1236 /*Collapsed formulation: */ … … 1317 1253 /*FUNCTION CreateKMatrixSlopeCompute {{{1*/ 1318 1254 1319 void Penta::CreateKMatrixSlopeCompute(Mat Kgg, void* inputs,int analysis_type,int sub_analysis_type){1255 void Penta::CreateKMatrixSlopeCompute(Mat Kgg,int analysis_type,int sub_analysis_type){ 1320 1256 1321 1257 /*Collapsed formulation: */ … … 1337 1273 /*}}}*/ 1338 1274 /*FUNCTION CreateKMatrixThermal {{{1*/ 1339 void Penta::CreateKMatrixThermal(Mat Kgg, void* vinputs,int analysis_type,int sub_analysis_type){1275 void Penta::CreateKMatrixThermal(Mat Kgg,int analysis_type,int sub_analysis_type){ 1340 1276 1341 1277 /* local declarations */ … … 1600 1536 /*}}}*/ 1601 1537 /*FUNCTION CreatePVector {{{1*/ 1602 void Penta::CreatePVector(Vec pg, void* inputs,int analysis_type,int sub_analysis_type){1538 void Penta::CreatePVector(Vec pg, int analysis_type,int sub_analysis_type){ 1603 1539 1604 1540 /*Just branch to the correct element stiffness matrix generator, according to the type of analysis we are carrying out: */ … … 1646 1582 /*}}}*/ 1647 1583 /*FUNCTION CreatePVectorDiagnosticHoriz {{{1*/ 1648 void Penta::CreatePVectorDiagnosticHoriz( Vec pg, void* vinputs,int analysis_type,int sub_analysis_type){1584 void Penta::CreatePVectorDiagnosticHoriz( Vec pg, int analysis_type,int sub_analysis_type){ 1649 1585 1650 1586 int i,j; … … 1801 1737 /*}}}*/ 1802 1738 /*FUNCTION CreatePVectorDiagnosticStokes {{{1*/ 1803 void Penta::CreatePVectorDiagnosticStokes( Vec pg, void* vinputs,int analysis_type,int sub_analysis_type){1739 void Penta::CreatePVectorDiagnosticStokes( Vec pg, int analysis_type,int sub_analysis_type){ 1804 1740 1805 1741 /*indexing: */ … … 2051 1987 /*}}}*/ 2052 1988 /*FUNCTION CreatePVectorDiagnosticVert {{{1*/ 2053 void Penta::CreatePVectorDiagnosticVert( Vec pg, void* vinputs,int analysis_type,int sub_analysis_type){1989 void Penta::CreatePVectorDiagnosticVert( Vec pg, int analysis_type,int sub_analysis_type){ 2054 1990 2055 1991 int i; … … 2190 2126 /*}}}*/ 2191 2127 /*FUNCTION CreatePVectorMelting {{{1*/ 2192 void Penta::CreatePVectorMelting( Vec pg, void* vinputs,int analysis_type,int sub_analysis_type){2128 void Penta::CreatePVectorMelting( Vec pg, int analysis_type,int sub_analysis_type){ 2193 2129 return; 2194 2130 } … … 2196 2132 /*FUNCTION CreatePVectorPrognostic {{{1*/ 2197 2133 2198 void Penta::CreatePVectorPrognostic( Vec pg, void* inputs,int analysis_type,int sub_analysis_type){2134 void Penta::CreatePVectorPrognostic( Vec pg, int analysis_type,int sub_analysis_type){ 2199 2135 2200 2136 /*Collapsed formulation: */ … … 2216 2152 /*FUNCTION CreatePVectorSlopeCompute {{{1*/ 2217 2153 2218 void Penta::CreatePVectorSlopeCompute( Vec pg, void* inputs,int analysis_type,int sub_analysis_type){2154 void Penta::CreatePVectorSlopeCompute( Vec pg, int analysis_type,int sub_analysis_type){ 2219 2155 2220 2156 /*Collapsed formulation: */ … … 2235 2171 /*}}}*/ 2236 2172 /*FUNCTION CreatePVectorThermal {{{1*/ 2237 void Penta::CreatePVectorThermal( Vec pg, void* vinputs,int analysis_type,int sub_analysis_type){2173 void Penta::CreatePVectorThermal( Vec pg, int analysis_type,int sub_analysis_type){ 2238 2174 2239 2175 … … 2438 2374 /*}}}*/ 2439 2375 /*FUNCTION Du {{{1*/ 2440 void Penta::Du(Vec du_g, void* inputs,int analysis_type,int sub_analysis_type){2376 void Penta::Du(Vec du_g,int analysis_type,int sub_analysis_type){ 2441 2377 2442 2378 int i; … … 3647 3583 /*}}}*/ 3648 3584 /*FUNCTION GetOnBed {{{1*/ 3649 intPenta::GetOnBed(){3585 bool Penta::GetOnBed(){ 3650 3586 return this->properties.onbed; 3651 3587 } … … 3792 3728 /*}}}*/ 3793 3729 /*FUNCTION Gradj {{{1*/ 3794 void Penta::Gradj(Vec grad_g, void* inputs,int analysis_type,int sub_analysis_type,char* control_type){3730 void Penta::Gradj(Vec grad_g,int analysis_type,int sub_analysis_type,char* control_type){ 3795 3731 3796 3732 /*If on water, skip grad (=0): */ … … 3807 3743 /*}}}*/ 3808 3744 /*FUNCTION GradjDrag {{{1*/ 3809 void Penta::GradjDrag(Vec grad_g, void* inputs,int analysis_type,int sub_analysis_type){3745 void Penta::GradjDrag(Vec grad_g,int analysis_type,int sub_analysis_type){ 3810 3746 3811 3747 Tria* tria=NULL; … … 3840 3776 /*}}}*/ 3841 3777 /*FUNCTION GradjB {{{1*/ 3842 void Penta::GradjB(Vec grad_g, void* inputs,int analysis_type,int sub_analysis_type){3778 void Penta::GradjB(Vec grad_g,int analysis_type,int sub_analysis_type){ 3843 3779 3844 3780 Tria* tria=NULL; … … 3873 3809 /*}}}*/ 3874 3810 /*FUNCTION Misfit {{{1*/ 3875 double Penta::Misfit( void* inputs,int analysis_type,int sub_analysis_type){3811 double Penta::Misfit(int analysis_type,int sub_analysis_type){ 3876 3812 3877 3813 double J; … … 4006 3942 /*}}}1*/ 4007 3943 /*FUNCTION SurfaceArea {{{1*/ 4008 double Penta::SurfaceArea( void* inputs,int analysis_type,int sub_analysis_type){3944 double Penta::SurfaceArea(int analysis_type,int sub_analysis_type){ 4009 3945 4010 3946 double S; -
issm/trunk/src/c/objects/Penta.h
r3599 r3612 9 9 class Node; 10 10 class Hook; 11 class ElementProperties;12 11 class DataSet; 13 12 struct IoModel; … … 21 20 #include "./Tria.h" 22 21 #include "./Hook.h" 23 #include "./ElementProperties.h"24 22 #include "../ModelProcessorx/IoModel.h" 25 #include "./ParameterInputs.h"26 23 #include "./Node.h" 27 24 … … 36 33 Hook hnumpar; //hook to 1 numpar 37 34 38 ElementProperties properties; 39 DataSet* inputs; 35 Inputs* inputs; 40 36 41 37 public: … … 43 39 /*FUNCTION constructors, destructors {{{1*/ 44 40 Penta(); 45 Penta(int penta_id,int* penta_node_ids, int penta_matice_id, int penta_matpar_id, int penta_numpar_id , ElementProperties* properties);46 Penta(int penta_id,Hook* penta_hnodes, Hook* penta_hmatice, Hook* penta_hmatpar, Hook* penta_hnumpar, ElementProperties* penta_properties);41 Penta(int penta_id,int* penta_node_ids, int penta_matice_id, int penta_matpar_id, int penta_numpar_id); 42 Penta(int penta_id,Hook* penta_hnodes, Hook* penta_hmatice, Hook* penta_hmatpar, Hook* penta_hnumpar, Inputs* inputs); 47 43 Penta(int i, IoModel* iomodel); 48 44 ~Penta(); … … 62 58 void* SpawnTria(int g0, int g1, int g2); 63 59 void UpdateFromDakota(void* inputs); 64 void UpdateFromInputs(void* inputs);65 60 void UpdateInputs(double* solution, int analysis_type, int sub_analysis_type); 66 61 void SetClone(int* minranks); … … 68 63 /*}}}*/ 69 64 /*FUNCTION element numerical routines {{{1*/ 70 void CreateKMatrix(Mat Kgg, void* inputs,int analysis_type,int sub_analysis_type);71 void CreateKMatrixDiagnosticHoriz( Mat Kgg, void* inputs,int analysis_type,int sub_analysis_type);72 void CreateKMatrixDiagnosticVert( Mat Kgg, void* inputs,int analysis_type,int sub_analysis_type);73 void CreatePVector(Vec pg, void* inputs,int analysis_type,int sub_analysis_type);65 void CreateKMatrix(Mat Kgg,int analysis_type,int sub_analysis_type); 66 void CreateKMatrixDiagnosticHoriz( Mat Kgg, int analysis_type,int sub_analysis_type); 67 void CreateKMatrixDiagnosticVert( Mat Kgg, int analysis_type,int sub_analysis_type); 68 void CreatePVector(Vec pg, int analysis_type,int sub_analysis_type); 74 69 void GetDofList(int* doflist,int* pnumberofdofs); 75 70 void GetDofList1(int* doflist); 76 71 void* GetMatPar(); 77 intGetShelf();72 bool GetShelf(); 78 73 void GetNodes(void** nodes); 79 intGetOnBed();80 void Du(Vec du_g, void* inputs,int analysis_type,int sub_analysis_type);81 void Gradj(Vec grad_g, void* inputs,int analysis_type,int sub_analysis_type,char* control_type);82 void GradjDrag(Vec grad_g, void* inputs,int analysis_type,int sub_analysis_type);83 void GradjB(Vec grad_g, void* inputs,int analysis_type,int sub_analysis_type);84 double Misfit( void* inputs,int analysis_type,int sub_analysis_type);85 double SurfaceArea( void* inputs,int analysis_type,int sub_analysis_type);86 double CostFunction( void* inputs,int analysis_type,int sub_analysis_type);74 bool GetOnBed(); 75 void Du(Vec du_g,int analysis_type,int sub_analysis_type); 76 void Gradj(Vec grad_g,int analysis_type,int sub_analysis_type,char* control_type); 77 void GradjDrag(Vec grad_g,int analysis_type,int sub_analysis_type); 78 void GradjB(Vec grad_g,int analysis_type,int sub_analysis_type); 79 double Misfit(int analysis_type,int sub_analysis_type); 80 double SurfaceArea(int analysis_type,int sub_analysis_type); 81 double CostFunction(int analysis_type,int sub_analysis_type); 87 82 88 83 void GetThicknessList(double* thickness_list); … … 99 94 void GetNodalFunctionsDerivativesReference(double* dl1dl6,double* gauss_coord); 100 95 void GetJacobianInvert(double* Jinv, double* xyz_list,double* gauss_coord); 101 void CreatePVectorDiagnosticHoriz( Vec pg, void* inputs,int analysis_type,int sub_analysis_type);102 void CreatePVectorDiagnosticVert( Vec pg, void* inputs,int analysis_type,int sub_analysis_type);96 void CreatePVectorDiagnosticHoriz( Vec pg, int analysis_type,int sub_analysis_type); 97 void CreatePVectorDiagnosticVert( Vec pg, int analysis_type,int sub_analysis_type); 103 98 void GetParameterValue(double* pvalue, double* v_list,double* gauss_coord); 104 99 void GetParameterDerivativeValue(double* p, double* p_list,double* xyz_list, double* gauss_coord); 105 100 void GetNodalFunctions(double* l1l6, double* gauss_coord); 106 101 void FieldExtrude(Vec field,double* field_serial,char* field_name, int iscollapsed); 107 void ComputeBasalStress(Vec sigma_b, void* inputs,int analysis_type,int sub_analysis_type);108 void ComputePressure(Vec p_g, void* inputs,int analysis_type,int sub_analysis_type);109 void ComputeStrainRate(Vec eps, void* inputs,int analysis_type,int sub_analysis_type);110 void CreateKMatrixSlopeCompute(Mat Kgg, void* vinputs,int analysis_type,int sub_analysis_type);111 void CreatePVectorSlopeCompute( Vec pg, void* vinputs,int analysis_type,int sub_analysis_type);112 void CreateKMatrixPrognostic(Mat Kgg, void* vinputs,int analysis_type,int sub_analysis_type);113 void CreatePVectorPrognostic( Vec pg, void* vinputs,int analysis_type,int sub_analysis_type);102 void ComputeBasalStress(Vec sigma_b,int analysis_type,int sub_analysis_type); 103 void ComputePressure(Vec p_g,int analysis_type,int sub_analysis_type); 104 void ComputeStrainRate(Vec eps,int analysis_type,int sub_analysis_type); 105 void CreateKMatrixSlopeCompute(Mat Kgg,int analysis_type,int sub_analysis_type); 106 void CreatePVectorSlopeCompute( Vec pg, int analysis_type,int sub_analysis_type); 107 void CreateKMatrixPrognostic(Mat Kgg,int analysis_type,int sub_analysis_type); 108 void CreatePVectorPrognostic( Vec pg, int analysis_type,int sub_analysis_type); 114 109 115 void CreateKMatrixDiagnosticStokes( Mat Kgg, void* vinputs,int analysis_type,int sub_analysis_type);116 void CreatePVectorDiagnosticStokes( Vec pg, void* vinputs,int analysis_type,int sub_analysis_type);110 void CreateKMatrixDiagnosticStokes( Mat Kgg, int analysis_type,int sub_analysis_type); 111 void CreatePVectorDiagnosticStokes( Vec pg, int analysis_type,int sub_analysis_type); 117 112 void ReduceMatrixStokes(double* Ke_reduced, double* Ke_temp); 118 113 void GetMatrixInvert(double* Ke_invert, double* Ke); … … 127 122 void ReduceVectorStokes(double* Pe_reduced, double* Ke_temp, double* Pe_temp); 128 123 void GetNodalFunctionsStokes(double* l1l7, double* gauss_coord); 129 void CreateKMatrixThermal(Mat Kgg, void* inputs,int analysis_type,int sub_analysis_type);124 void CreateKMatrixThermal(Mat Kgg,int analysis_type,int sub_analysis_type); 130 125 void GetB_conduct(double* B_conduct, double* xyz_list, double* gauss_coord); 131 126 void GetB_advec(double* B_advec, double* xyz_list, double* gauss_coord); 132 127 void GetBprime_advec(double* Bprime_advec, double* xyz_list, double* gauss_coord); 133 128 void GetB_artdiff(double* B_artdiff, double* xyz_list, double* gauss_coord); 134 void CreateKMatrixMelting(Mat Kgg, void* inputs,int analysis_type,int sub_analysis_type);135 void CreatePVectorThermal( Vec pg, void* vinputs,int analysis_type,int sub_analysis_type);136 void CreatePVectorMelting( Vec pg, void* vinputs,int analysis_type,int sub_analysis_type);129 void CreateKMatrixMelting(Mat Kgg,int analysis_type,int sub_analysis_type); 130 void CreatePVectorThermal( Vec pg, int analysis_type,int sub_analysis_type); 131 void CreatePVectorMelting( Vec pg, int analysis_type,int sub_analysis_type); 137 132 void GetPhi(double* phi, double* epsilon, double viscosity); 138 133 double MassFlux(double* segment,double* ug); -
issm/trunk/src/c/objects/Result.cpp
r3567 r3612 15 15 #include "../EnumDefinitions/EnumDefinitions.h" 16 16 #include "../include/macros.h" 17 #include "./ParameterInputs.h"18 17 #include "../shared/shared.h" 19 18 #include "../include/typedefs.h" -
issm/trunk/src/c/objects/Riftfront.h
r3463 r3612 10 10 #include "./Element.h" 11 11 #include "./Node.h" 12 #include "./ParameterInputs.h"13 12 14 13 #define MAX_RIFTFRONT_GRIDS 2 //max number of grids on a rift flank, only 2 because 2d for now. -
issm/trunk/src/c/objects/Sing.cpp
r3599 r3612 226 226 } 227 227 /*}}}*/ 228 /*FUNCTION Sing::UpdateFromInputs {{{1*/ 229 void Sing::UpdateFromInputs(void* vinputs){ 230 231 int dofs[1]={0}; 232 double temperature; 233 double B; 234 double B_average; 228 /*FUNCTION Sing::UpdateInputs {{{1*/ 229 void Sing::UpdateInputs(double* solution, int analysis_type, int sub_analysis_type){ 230 ISSMERROR(" not supported yet!"); 231 } 232 /*}}}*/ 233 234 /*Object functions*/ 235 /*FUNCTION Sing::ComputeBasalStress {{{1*/ 236 void Sing::ComputeBasalStress(Vec p_g,int analysis_type,int sub_analysis_type){ 237 238 ISSMERROR("Not implemented yet"); 239 240 } 241 /*}}}*/ 242 /*FUNCTION Sing::ComputePressure {{{1*/ 243 void Sing::ComputePressure(Vec p_g,int analysis_type,int sub_analysis_type){ 244 245 int i; 246 const int numgrids=1; 247 int doflist[numgrids]; 248 double pressure[numgrids]; 249 double rho_ice,g; 235 250 236 251 /*dynamic objects pointed to by hooks: */ … … 240 255 Numpar* numpar=NULL; 241 256 242 ParameterInputs* inputs=NULL; 243 244 /*recover pointers: */ 245 inputs=(ParameterInputs*)vinputs; 257 /*Get dof list on which we will plug the pressure values: */ 258 GetDofList1(&doflist[0]); 246 259 247 260 /*recover objects from hooks: */ … … 251 264 numpar=(Numpar*)hnumpar.delivers(); 252 265 253 /*Update internal data if inputs holds new values: */254 //if (id==1) printf("WARNING if QMU: no hydrostatic equilibrium is applied here (conflict with prognostic, which does not have matpar)\n");255 //For now256 if(this->properties.h) inputs->Recover("thickness",&this->properties.h[0],1,dofs,1,(void**)nodes);257 //Later258 /*259 if(inputs->Recover("thickness",&new_h[0],1,dofs,1,(void**)nodes)){260 //density, needed later:261 double di=(this->matpar->GetRhoIce()/this->matpar->GetRhoWater());262 //Go through grids:263 for (i=0;i<1;i++){264 if(nodes[i]->IsOnShelf()){265 this->b[i]=this->b[i]-di*(new_h[i]-h[i]); //hydrostatic equilibrium;266 }267 this->s[i]=this->b[i]+new_h[i];268 this->h[i]=new_h[i];269 }270 }271 */272 if (this->properties.k) inputs->Recover("drag",&this->properties.k[0],1,dofs,1,(void**)nodes);273 274 //Update material if necessary275 if(inputs->Recover("temperature_average",&temperature,1,dofs,1,(void**)nodes)){276 B_average=Paterson(temperature);277 matice->SetB(B_average);278 }279 else if(inputs->Recover("temperature",&temperature,1,dofs,1,(void**)nodes)){280 B=Paterson(temperature);281 matice->SetB(B);282 }283 284 if(inputs->Recover("B",&B,1,dofs,1,(void**)nodes)){285 matice->SetB(B);286 }287 288 }289 /*}}}*/290 /*FUNCTION Sing::UpdateInputs {{{1*/291 void Sing::UpdateInputs(double* solution, int analysis_type, int sub_analysis_type){292 ISSMERROR(" not supported yet!");293 }294 /*}}}*/295 296 /*Object functions*/297 /*FUNCTION Sing::ComputeBasalStress {{{1*/298 void Sing::ComputeBasalStress(Vec p_g,void* inputs,int analysis_type,int sub_analysis_type){299 300 ISSMERROR("Not implemented yet");301 302 }303 /*}}}*/304 /*FUNCTION Sing::ComputePressure {{{1*/305 void Sing::ComputePressure(Vec p_g,void* inputs,int analysis_type,int sub_analysis_type){306 307 int i;308 const int numgrids=1;309 int doflist[numgrids];310 double pressure[numgrids];311 double rho_ice,g;312 313 /*dynamic objects pointed to by hooks: */314 Node** nodes=NULL;315 Matpar* matpar=NULL;316 Matice* matice=NULL;317 Numpar* numpar=NULL;318 319 /*Get dof list on which we will plug the pressure values: */320 GetDofList1(&doflist[0]);321 322 /*recover objects from hooks: */323 nodes=(Node**)hnodes.deliverp();324 matpar=(Matpar*)hmatpar.delivers();325 matice=(Matice*)hmatice.delivers();326 numpar=(Numpar*)hnumpar.delivers();327 328 266 /*pressure is lithostatic: */ 329 267 rho_ice=matpar->GetRhoIce(); … … 337 275 /*}}}*/ 338 276 /*FUNCTION Sing::ComputeStrainRate {{{1*/ 339 void Sing::ComputeStrainRate(Vec p_g, void* inputs,int analysis_type,int sub_analysis_type){277 void Sing::ComputeStrainRate(Vec p_g,int analysis_type,int sub_analysis_type){ 340 278 341 279 ISSMERROR("Not implemented yet"); … … 350 288 /*FUNCTION Sing::CreateKMatrix {{{1*/ 351 289 352 void Sing::CreateKMatrix(Mat Kgg, void* inputs,int analysis_type,int sub_analysis_type){290 void Sing::CreateKMatrix(Mat Kgg,int analysis_type,int sub_analysis_type){ 353 291 354 292 /*Just branch to the correct element stiffness matrix generator, according to the type of analysis we are carrying out: */ … … 366 304 /*FUNCTION Sing::CreateKMatrixDiagnosticHutter {{{1*/ 367 305 368 void Sing::CreateKMatrixDiagnosticHutter(Mat Kgg, void* vinputs,int analysis_type,int sub_analysis_type){306 void Sing::CreateKMatrixDiagnosticHutter(Mat Kgg,int analysis_type,int sub_analysis_type){ 369 307 370 308 const int numgrids=1; … … 387 325 /*}}}*/ 388 326 /*FUNCTION Sing::CreatePVector {{{1*/ 389 void Sing::CreatePVector(Vec pg, void* inputs,int analysis_type,int sub_analysis_type){327 void Sing::CreatePVector(Vec pg,int analysis_type,int sub_analysis_type){ 390 328 391 329 /*Just branch to the correct load generator, according to the type of analysis we are carrying out: */ … … 403 341 /*FUNCTION Sing::CreatePVectorDiagnosticHutter {{{1*/ 404 342 405 void Sing::CreatePVectorDiagnosticHutter( Vec pg, void* vinputs,int analysis_type,int sub_analysis_type){343 void Sing::CreatePVectorDiagnosticHutter( Vec pg, int analysis_type,int sub_analysis_type){ 406 344 407 345 … … 561 499 /*}}}*/ 562 500 /*FUNCTION Sing::GetOnBed {{{1*/ 563 intSing::GetOnBed(){501 bool Sing::GetOnBed(){ 564 502 ISSMERROR(" not supported yet!"); 565 503 } -
issm/trunk/src/c/objects/Sing.h
r3599 r3612 10 10 #include "./Matice.h" 11 11 #include "./Matpar.h" 12 #include "./ParameterInputs.h"13 #include "./ElementProperties.h"14 12 #include "../ModelProcessorx/IoModel.h" 15 13 #include "./Hook.h" 16 14 17 15 class Hook; 18 class ElementProperties;19 16 20 17 class Sing: public Element{ … … 30 27 Hook hnumpar; //hook to 1 numpar 31 28 32 ElementProperties properties;29 Inputs* inputs; 33 30 34 31 public: … … 36 33 /*constructors, destructors: {{{1*/ 37 34 Sing(); 38 Sing(int sing_id,int* sing_node_ids, int sing_matice_id, int sing_matpar_id, int sing_numpar_id , ElementProperties* sing_properties);39 Sing(int sing_id,Hook* sing_hnodes, Hook* sing_hmatice, Hook* sing_hmatpar, Hook* sing_hnumpar, ElementProperties* sing_properties);35 Sing(int sing_id,int* sing_node_ids, int sing_matice_id, int sing_matpar_id, int sing_numpar_id); 36 Sing(int sing_id,Hook* sing_hnodes, Hook* sing_hmatice, Hook* sing_hmatpar, Hook* sing_hnumpar, Inputs* sing_inputs); 40 37 Sing(int i, IoModel* iomodel); 41 38 ~Sing(); … … 56 53 /*}}}*/ 57 54 /*numerics: {{{1*/ 58 void CreateKMatrix(Mat Kgg,void* inputs,int analysis_type,int sub_analysis_type); 59 void CreatePVector(Vec pg, void* inputs, int analysis_type,int sub_analysis_type); 60 void UpdateFromInputs(void* inputs); 55 void CreateKMatrix(Mat Kgg,int analysis_type,int sub_analysis_type); 56 void CreatePVector(Vec pg, int analysis_type,int sub_analysis_type); 61 57 void UpdateInputs(double* solution, int analysis_type, int sub_analysis_type); 62 58 void GetDofList(int* doflist,int* pnumberofdofs); 63 59 void GetDofList1(int* doflist); 64 void CreateKMatrixDiagnosticHutter(Mat Kgg, void* inputs,int analysis_type,int sub_analysis_type);60 void CreateKMatrixDiagnosticHutter(Mat Kgg,int analysis_type,int sub_analysis_type); 65 61 void GetParameterValue(double* pp, double* plist, double* gauss_l1l2l3); 66 void CreatePVectorDiagnosticHutter(Vec pg, void* inputs,int analysis_type,int sub_analysis_type);62 void CreatePVectorDiagnosticHutter(Vec pg,int analysis_type,int sub_analysis_type); 67 63 void* GetMatPar(); 68 void ComputeBasalStress(Vec sigma_b, void* inputs,int analysis_type,int sub_analysis_type);69 void ComputePressure(Vec p_g, void* inputs,int analysis_type,int sub_analysis_type);70 void ComputeStrainRate(Vec eps, void* inputs,int analysis_type,int sub_analysis_type);64 void ComputeBasalStress(Vec sigma_b,int analysis_type,int sub_analysis_type); 65 void ComputePressure(Vec p_g,int analysis_type,int sub_analysis_type); 66 void ComputeStrainRate(Vec eps,int analysis_type,int sub_analysis_type); 71 67 void GetNodes(void** vpnodes); 72 68 /*}}}*/ 73 69 /*not implemented: {{{1*/ 74 intGetShelf();75 intGetOnBed();70 bool GetShelf(); 71 bool GetOnBed(); 76 72 void GetBedList(double*); 77 73 void GetThicknessList(double* thickness_list); -
issm/trunk/src/c/objects/Tria.cpp
r3599 r3612 19 19 #include "../shared/shared.h" 20 20 #include "../DataSet/DataSet.h" 21 #include "../DataSet/Inputs.h" 21 22 #include "../include/typedefs.h" 22 23 #include "../include/macros.h" … … 29 30 } 30 31 /*}}}*/ 31 /*FUNCTION Tria::Tria(int id, int* node_ids, int matice_id, int matpar_id, int numpar_id , ElementProperties* properties){{{1*/32 Tria::Tria(int tria_id,int* tria_node_ids, int tria_matice_id, int tria_matpar_id, int tria_numpar_id , ElementProperties* triaproperties):32 /*FUNCTION Tria::Tria(int id, int* node_ids, int matice_id, int matpar_id, int numpar_id){{{1*/ 33 Tria::Tria(int tria_id,int* tria_node_ids, int tria_matice_id, int tria_matpar_id, int tria_numpar_id): 33 34 hnodes(tria_node_ids,3), 34 35 hmatice(&tria_matice_id,1), 35 36 hmatpar(&tria_matpar_id,1), 36 hnumpar(&tria_numpar_id,1), 37 properties(triaproperties) 37 hnumpar(&tria_numpar_id,1) 38 38 { 39 39 40 40 /*all the initialization has been done by the initializer, just fill in the id: */ 41 41 this->id=tria_id; 42 this->inputs=new DataSet();42 this->inputs=new Inputs(); 43 43 44 44 return; 45 45 } 46 46 /*}}}*/ 47 /*FUNCTION Tria::Tria(int id, Hook* hnodes, Hook* hmatice, Hook* hmatpar, Hook* hnumpar, ElementProperties* properties,DataSet* tria_inputs) {{{1*/48 Tria::Tria(int tria_id,Hook* tria_hnodes, Hook* tria_hmatice, Hook* tria_hmatpar, Hook* tria_hnumpar, ElementProperties* tria_properties,DataSet* tria_inputs):47 /*FUNCTION Tria::Tria(int id, Hook* hnodes, Hook* hmatice, Hook* hmatpar, Hook* hnumpar, Inputs* tria_inputs) {{{1*/ 48 Tria::Tria(int tria_id,Hook* tria_hnodes, Hook* tria_hmatice, Hook* tria_hmatpar, Hook* tria_hnumpar, Inputs* tria_inputs): 49 49 hnodes(tria_hnodes), 50 50 hmatice(tria_hmatice), 51 51 hmatpar(tria_hmatpar), 52 hnumpar(tria_hnumpar), 53 properties(tria_properties) 52 hnumpar(tria_hnumpar) 54 53 { 55 54 … … 57 56 this->id=tria_id; 58 57 if(tria_inputs){ 59 this->inputs= tria_inputs->Copy();58 this->inputs=(Inputs*)tria_inputs->Copy(); 60 59 } 61 60 else{ 62 this->inputs=new DataSet();61 this->inputs=new Inputs(); 63 62 } 64 63 … … 67 66 /*}}}*/ 68 67 /*FUNCTION Tria::Tria(int i, IoModel* iomodel){{{1*/ 69 Tria::Tria(int i , IoModel* iomodel){ //i is the element index70 71 int j;68 Tria::Tria(int index, IoModel* iomodel){ //i is the element index 69 70 int i,j; 72 71 int tria_node_ids[3]; 73 72 int tria_matice_id; 74 73 int tria_matpar_id; 75 74 int tria_numpar_id; 75 double nodeinputs[3]; 76 76 77 77 /*id: */ 78 this->id=i+1; 79 this->inputs=new DataSet(); 78 this->id=index+1; 80 79 81 80 /*hooks: */ … … 83 82 if (iomodel->analysis_type==Prognostic2AnalysisEnum || iomodel->analysis_type==Balancedthickness2AnalysisEnum){ 84 83 /*Discontinuous Galerkin*/ 85 tria_node_ids[0]=3*i +1;86 tria_node_ids[1]=3*i +2;87 tria_node_ids[2]=3*i +3;84 tria_node_ids[0]=3*index+1; 85 tria_node_ids[1]=3*index+2; 86 tria_node_ids[2]=3*index+3; 88 87 } 89 88 else{ 90 89 /*Continuous Galerkin*/ 91 for( j=0;j<3;j++){92 tria_node_ids[ j]=(int)*(iomodel->elements+3*i+j); //ids for vertices are in the elements array from Matlab90 for(i=0;i<3;i++){ 91 tria_node_ids[i]=(int)*(iomodel->elements+3*index+i); //ids for vertices are in the elements array from Matlab 93 92 } 94 93 } 95 tria_matice_id=i +1; //refers to the corresponding ice material object94 tria_matice_id=index+1; //refers to the corresponding ice material object 96 95 tria_matpar_id=iomodel->numberofelements+1; //refers to the constant material parameters object 97 96 tria_numpar_id=1; //refers to numerical parameters object … … 101 100 this->hmatpar.Init(&tria_matpar_id,1); 102 101 this->hnumpar.Init(&tria_numpar_id,1); 103 this->properties.Init(3,tria_node_ids,this->id,iomodel); 102 103 //intialize inputs, and add as many inputs per element as requested: 104 this->inputs=new Inputs(); 105 106 if (iomodel->thickness) { 107 for(i=0;i<3;i++)nodeinputs[i]=iomodel->thickness[tria_node_ids[i]-1]; 108 this->inputs->AddInput(new TriaVertexInput(ThicknessEnum,nodeinputs)); 109 } 110 if (iomodel->surface) { 111 for(i=0;i<3;i++)nodeinputs[i]=iomodel->surface[tria_node_ids[i]-1]; 112 this->inputs->AddInput(new TriaVertexInput(SurfaceEnum,nodeinputs)); 113 } 114 if (iomodel->bed) { 115 for(i=0;i<3;i++)nodeinputs[i]=iomodel->bed[tria_node_ids[i]-1]; 116 this->inputs->AddInput(new TriaVertexInput(BedEnum,nodeinputs)); 117 } 118 if (iomodel->drag_coefficient) { 119 for(i=0;i<3;i++)nodeinputs[i]=iomodel->drag_coefficient[tria_node_ids[i]-1]; 120 this->inputs->AddInput(new TriaVertexInput(DragCoefficientEnum,nodeinputs)); 121 122 if (iomodel->drag_p) this->inputs->AddInput(new DoubleInput(DragPEnum,iomodel->drag_p[index])); 123 if (iomodel->drag_q) this->inputs->AddInput(new DoubleInput(DragQEnum,iomodel->drag_q[index])); 124 this->inputs->AddInput(new IntInput(DragTypeEnum,iomodel->drag_type)); 125 126 } 127 if (iomodel->melting_rate) { 128 for(i=0;i<3;i++)nodeinputs[i]=iomodel->melting_rate[tria_node_ids[i]-1]; 129 this->inputs->AddInput(new TriaVertexInput(MeltingRateEnum,nodeinputs)); 130 } 131 if (iomodel->accumulation_rate) { 132 for(i=0;i<3;i++)nodeinputs[i]=iomodel->accumulation_rate[tria_node_ids[i]-1]; 133 this->inputs->AddInput(new TriaVertexInput(AccumulationRateEnum,nodeinputs)); 134 } 135 if (iomodel->geothermalflux) { 136 for(i=0;i<3;i++)nodeinputs[i]=iomodel->geothermalflux[tria_node_ids[i]-1]; 137 this->inputs->AddInput(new TriaVertexInput(GeothermalFluxEnum,nodeinputs)); 138 } 139 140 if (iomodel->elementoniceshelf) this->inputs->AddInput(new BoolInput(ElementOnIceShelfEnum,(IssmBool)iomodel->elementoniceshelf[index])); 141 if (iomodel->elementonbed) this->inputs->AddInput(new BoolInput(ElementOnBedEnum,(IssmBool)iomodel->elementonbed[index])); 142 if (iomodel->elementonwater) this->inputs->AddInput(new BoolInput(ElementOnWaterEnum,(IssmBool)iomodel->elementonwater[index])); 143 if (iomodel->elementonsurface) this->inputs->AddInput(new BoolInput(ElementOnSurfaceEnum,(IssmBool)iomodel->elementonsurface[index])); 144 104 145 105 146 } … … 141 182 Object* Tria::copy() { 142 183 143 return new Tria(this->id,&this->hnodes,&this->hmatice,&this->hmatpar,&this->hnumpar, &this->properties,this->inputs);184 return new Tria(this->id,&this->hnodes,&this->hmatice,&this->hmatpar,&this->hnumpar,this->inputs); 144 185 145 186 } … … 166 207 hnumpar.Demarshall(&marshalled_dataset); 167 208 168 /*demarshall properties: */ 169 properties.Demarshall(&marshalled_dataset); 170 171 inputs=DataSetDemarshallRaw(&marshalled_dataset); 209 /*demarshall inputs: */ 210 inputs=(Inputs*)DataSetDemarshallRaw(&marshalled_dataset); 172 211 173 212 /*return: */ … … 186 225 hmatpar.DeepEcho(); 187 226 hnumpar.DeepEcho(); 188 properties.DeepEcho(); 189 printf("Element inputs\n"); 227 printf(" inputs\n"); 190 228 inputs->DeepEcho(); 191 229 … … 203 241 hmatpar.Echo(); 204 242 hnumpar.Echo(); 205 properties.Echo(); 206 printf("Element inputs\n"); 243 printf(" inputs\n"); 207 244 inputs->Echo(); 208 245 … … 236 273 hnumpar.Marshall(&marshalled_dataset); 237 274 238 /*Marshall properties: */239 properties.Marshall(&marshalled_dataset);240 241 275 /*Marshall inputs: */ 242 276 marshalled_inputs_size=inputs->MarshallSize(); … … 257 291 +hmatpar.MarshallSize() 258 292 +hnumpar.MarshallSize() 259 +properties.MarshallSize()260 293 +inputs->MarshallSize() 261 294 +sizeof(int); //sizeof(int) for enum type … … 264 297 265 298 /*Updates: */ 266 /*FUNCTION Tria::UpdateFrom Inputs{{{1*/267 void Tria::UpdateFrom Inputs(void* vinputs){299 /*FUNCTION Tria::UpdateFromDakota {{{1*/ 300 void Tria::UpdateFromDakota(void* vinputs){ 268 301 269 302 int i; … … 280 313 Matice* matice=NULL; 281 314 Numpar* numpar=NULL; 282 283 ParameterInputs* inputs=NULL;284 285 /*recover pointers: */286 inputs=(ParameterInputs*)vinputs;287 288 /*recover objects from hooks: */289 nodes=(Node**)hnodes.deliverp();290 matpar=(Matpar*)hmatpar.delivers();291 matice=(Matice*)hmatice.delivers();292 numpar=(Numpar*)hnumpar.delivers();293 294 /*Update internal data if inputs holds new values: */295 //if (id==1) printf("WARNING if QMU: no hydrostatic equilibrium is applied here (conflict with prognostic, which does not have matpar)\n");296 //For now297 if(this->properties.h) inputs->Recover("thickness",&this->properties.h[0],1,dofs,3,(void**)nodes);298 //Later299 /*300 if(inputs->Recover("thickness",&new_h[0],1,dofs,3,(void**)nodes)){301 //density, needed later:302 double di=(this->matpar->GetRhoIce()/this->matpar->GetRhoWater());303 //Go through grids:304 for (i=0;i<3;i++){305 if(nodes[i]->IsOnShelf()){306 this->b[i]=this->b[i]-di*(new_h[i]-h[i]); //hydrostatic equilibrium;307 }308 this->s[i]=this->b[i]+new_h[i];309 this->h[i]=new_h[i];310 }311 }312 */313 if (this->properties.s) inputs->Recover("surface",&this->properties.s[0],1,dofs,3,(void**)nodes);314 if (this->properties.b) inputs->Recover("bed",&this->properties.b[0],1,dofs,3,(void**)nodes);315 if (this->properties.k) inputs->Recover("drag",&this->properties.k[0],1,dofs,3,(void**)nodes);316 if (this->properties.melting) inputs->Recover("melting",&this->properties.melting[0],1,dofs,3,(void**)nodes);317 if (this->properties.accumulation) inputs->Recover("accumulation",&this->properties.accumulation[0],1,dofs,3,(void**)nodes);318 if (this->properties.geothermalflux) inputs->Recover("geothermalflux",&this->properties.geothermalflux[0],1,dofs,3,(void**)nodes);319 320 //Update material if necessary321 if(inputs->Recover("temperature_average",&temperature_list[0],1,dofs,3,(void**)nodes)){322 temperature_average=(temperature_list[0]+temperature_list[1]+temperature_list[2])/3.0;323 B_average=Paterson(temperature_average);324 matice->SetB(B_average);325 }326 327 if(inputs->Recover("B",&B_list[0],1,dofs,3,(void**)nodes)){328 B_average=(B_list[0]+B_list[1]+B_list[2])/3.0;329 matice->SetB(B_average);330 }331 332 }333 /*}}}*/334 /*FUNCTION Tria::UpdateFromDakota {{{1*/335 void Tria::UpdateFromDakota(void* vinputs){336 337 int i;338 int dofs[1]={0};339 double temperature_list[3];340 double temperature_average;341 double B_list[3];342 double B_average;343 double new_h[3];344 345 /*dynamic objects pointed to by hooks: */346 Node** nodes=NULL;347 Matpar* matpar=NULL;348 Matice* matice=NULL;349 Numpar* numpar=NULL;350 351 ParameterInputs* inputs=NULL;352 353 /*recover pointers: */354 inputs=(ParameterInputs*)vinputs;355 315 356 316 /*recover objects from hooks: */ … … 458 418 459 419 /*Add vx and vy as inputs to the tria element: */ 460 this->inputs->Add Einput(new TriaVertexInput(VxEnum,vx));461 this->inputs->Add Einput(new TriaVertexInput(VyEnum,vy));420 this->inputs->AddInput(new TriaVertexInput(VxEnum,vx)); 421 this->inputs->AddInput(new TriaVertexInput(VyEnum,vy)); 462 422 } 463 423 … … 497 457 /*Object functions*/ 498 458 /*FUNCTION Tria::ComputeBasalStress {{{1*/ 499 void Tria::ComputeBasalStress(Vec eps, void* vinputs,int analysis_type,int sub_analysis_type){459 void Tria::ComputeBasalStress(Vec eps,int analysis_type,int sub_analysis_type){ 500 460 501 461 int i; … … 523 483 /*}}}*/ 524 484 /*FUNCTION Tria::ComputePressure {{{1*/ 525 void Tria::ComputePressure(Vec pg, void* vinputs,int analysis_type,int sub_analysis_type){485 void Tria::ComputePressure(Vec pg,int analysis_type,int sub_analysis_type){ 526 486 527 487 int i; 528 const int numgrids=3; 529 int doflist[numgrids]; 530 double pressure[numgrids]; 488 const int numvertices=3; 489 int doflist[numvertices]; 490 double pressure[numvertices]; 491 double thickness[numvertices]; 531 492 double rho_ice,g; 493 double gauss[numvertices][numvertices]={{1,0,0},{0,1,0},{0,0,1}}; 532 494 533 495 /*dynamic objects pointed to by hooks: */ … … 537 499 Numpar* numpar=NULL; 538 500 539 540 /*Get dof list on which we will plug the pressure values: */541 GetDofList1(&doflist[0]);542 543 501 /*recover objects from hooks: */ 544 502 nodes=(Node**)hnodes.deliverp(); … … 547 505 numpar=(Numpar*)hnumpar.delivers(); 548 506 507 /*Get dof list on which we will plug the pressure values: */ 508 GetDofList1(&doflist[0]); 509 549 510 /*pressure is lithostatic: */ 550 511 rho_ice=matpar->GetRhoIce(); 551 512 g=matpar->GetG(); 552 for(i=0;i<numgrids;i++){ 553 pressure[i]=rho_ice*g*this->properties.h[i]; 513 514 /*recover value of thickness at gauss points (0,0,1), (0,1,0),(1,0,0): */ 515 inputs->GetParameterValues(&thickness[0],&gauss[0][0],3,ThicknessEnum); 516 517 for(i=0;i<numvertices;i++){ 518 pressure[i]=rho_ice*g*thickness[i]; 554 519 } 555 520 556 521 /*plug local pressure values into global pressure vector: */ 557 VecSetValues(pg,num grids,doflist,(const double*)pressure,INSERT_VALUES);522 VecSetValues(pg,numvertices,doflist,(const double*)pressure,INSERT_VALUES); 558 523 559 524 } 560 525 /*}}}*/ 561 526 /*FUNCTION Tria::ComputeStrainRate {{{1*/ 562 void Tria::ComputeStrainRate(Vec eps, void* vinputs,int analysis_type,int sub_analysis_type){527 void Tria::ComputeStrainRate(Vec eps,int analysis_type,int sub_analysis_type){ 563 528 564 529 int i; … … 586 551 /*}}}*/ 587 552 /*FUNCTION Tria::CostFunction {{{1*/ 588 double Tria::CostFunction( void* vinputs,int analysis_type,int sub_analysis_type){553 double Tria::CostFunction(int analysis_type,int sub_analysis_type){ 589 554 590 555 int i; … … 628 593 Numpar* numpar=NULL; 629 594 630 ParameterInputs* inputs=NULL; 595 /*inputs: */ 596 bool onwater; 597 bool shelf; 598 599 /*retrieve inputs :*/ 600 inputs->GetParameterValue(&onwater,ElementOnWaterEnum); 601 inputs->GetParameterValue(&shelf,ElementOnIceShelfEnum); 631 602 632 603 /*If on water, return 0: */ 633 if(this->properties.onwater)return 0; 634 635 /*recover pointers: */ 636 inputs=(ParameterInputs*)vinputs; 604 if(onwater)return 0; 637 605 638 606 /*recover objects from hooks: */ … … 646 614 647 615 /*First, get Misfit*/ 648 Jelem=Misfit( inputs,analysis_type,sub_analysis_type);616 Jelem=Misfit(analysis_type,sub_analysis_type); 649 617 650 618 /* Get gaussian points and weights (make this a statically initialized list of points? fstd): */ … … 664 632 /*Add Tikhonov regularization term to misfit*/ 665 633 if (strcmp(numpar->control_type,"drag")==0){ 666 if (!this->properties.shelf){ 667 668 GetParameterDerivativeValue(&dk[0], &this->properties.k[0],&xyz_list[0][0], gauss_l1l2l3); 634 if (shelf){ 635 inputs->GetParameterDerivativeValue(&dk[0],&xyz_list[0][0],&gauss_l1l2l3[0],DragCoefficientEnum); 669 636 Jelem+=numpar->cm_noisedmp*1/2*(pow(dk[0],2)+pow(dk[1],2))*Jdet*gauss_weight; 670 637 … … 672 639 } 673 640 else if (strcmp(numpar->control_type,"B")==0){ 674 675 if(!inputs->Recover("B",&B[0],1,dofs1,numgrids,(void**)nodes)){ 676 ISSMERROR("parameter B not found in input"); 677 } 678 GetParameterDerivativeValue(&dB[0], &B[0],&xyz_list[0][0], gauss_l1l2l3); 641 inputs->GetParameterDerivativeValue(&dB[0], &xyz_list[0][0], &gauss_l1l2l3[0],RheologyBEnum); 679 642 Jelem+=numpar->cm_noisedmp*1/2*(pow(dB[0],2)+pow(dB[1],2))*Jdet*gauss_weight; 680 681 643 } 682 644 else{ … … 697 659 /*FUNCTION Tria::CreateKMatrix {{{1*/ 698 660 699 void Tria::CreateKMatrix(Mat Kgg, void* inputs,int analysis_type,int sub_analysis_type){661 void Tria::CreateKMatrix(Mat Kgg,int analysis_type,int sub_analysis_type){ 700 662 701 663 /*Just branch to the correct element stiffness matrix generator, according to the type of analysis we are carrying out: */ 702 664 if (analysis_type==ControlAnalysisEnum){ 703 665 704 CreateKMatrixDiagnosticHoriz( Kgg, inputs,analysis_type,sub_analysis_type);666 CreateKMatrixDiagnosticHoriz( Kgg,analysis_type,sub_analysis_type); 705 667 } 706 668 else if (analysis_type==DiagnosticAnalysisEnum){ … … 708 670 if (sub_analysis_type==HorizAnalysisEnum){ 709 671 710 CreateKMatrixDiagnosticHoriz( Kgg, inputs,analysis_type,sub_analysis_type);672 CreateKMatrixDiagnosticHoriz( Kgg,analysis_type,sub_analysis_type); 711 673 } 712 674 else ISSMERROR("%s%i%s\n","sub_analysis: ",sub_analysis_type," not supported yet"); … … 715 677 else if (analysis_type==SlopecomputeAnalysisEnum){ 716 678 717 CreateKMatrixSlopeCompute( Kgg, inputs,analysis_type,sub_analysis_type);679 CreateKMatrixSlopeCompute( Kgg,analysis_type,sub_analysis_type); 718 680 } 719 681 else if (analysis_type==PrognosticAnalysisEnum){ 720 682 721 CreateKMatrixPrognostic( Kgg, inputs,analysis_type,sub_analysis_type);683 CreateKMatrixPrognostic( Kgg,analysis_type,sub_analysis_type); 722 684 } 723 685 else if (analysis_type==Prognostic2AnalysisEnum){ 724 686 725 CreateKMatrixPrognostic2(Kgg, inputs,analysis_type,sub_analysis_type);687 CreateKMatrixPrognostic2(Kgg,analysis_type,sub_analysis_type); 726 688 } 727 689 else if (analysis_type==BalancedthicknessAnalysisEnum){ 728 690 729 CreateKMatrixBalancedthickness( Kgg, inputs,analysis_type,sub_analysis_type);691 CreateKMatrixBalancedthickness( Kgg,analysis_type,sub_analysis_type); 730 692 } 731 693 else if (analysis_type==Balancedthickness2AnalysisEnum){ 732 694 733 CreateKMatrixBalancedthickness2( Kgg, inputs,analysis_type,sub_analysis_type);695 CreateKMatrixBalancedthickness2( Kgg,analysis_type,sub_analysis_type); 734 696 } 735 697 else if (analysis_type==BalancedvelocitiesAnalysisEnum){ 736 698 737 CreateKMatrixBalancedvelocities( Kgg, inputs,analysis_type,sub_analysis_type);699 CreateKMatrixBalancedvelocities( Kgg,analysis_type,sub_analysis_type); 738 700 } 739 701 else{ … … 745 707 /*}}}*/ 746 708 /*FUNCTION Tria::CreateKMatrixBalancedthickness {{{1*/ 747 void Tria::CreateKMatrixBalancedthickness(Mat Kgg, void* vinputs,int analysis_type,int sub_analysis_type){709 void Tria::CreateKMatrixBalancedthickness(Mat Kgg,int analysis_type,int sub_analysis_type){ 748 710 749 711 /* local declarations */ … … 766 728 double gauss_weight; 767 729 double gauss_l1l2l3[3]; 730 double gaussgrids[numgrids][numgrids]={{1,0,0},{0,1,0},{0,0,1}}; 768 731 769 732 /* matrices: */ … … 782 745 783 746 /*input parameters for structural analysis (diagnostic): */ 784 double vxvy_list[numgrids][2]={0.0}; 785 double vx_list[numgrids]={0.0}; 786 double vy_list[numgrids]={0.0}; 747 double vx_list[numgrids]; 748 double vy_list[numgrids]; 787 749 double dvx[2]; 788 750 double dvy[2]; … … 790 752 double dvxdx,dvydy; 791 753 double v_gauss[2]={0.0}; 754 755 792 756 double K[2][2]={0.0}; 793 757 double KDL[2][2]={0.0}; … … 801 765 Numpar* numpar=NULL; 802 766 803 ParameterInputs* inputs=NULL;804 805 /*recover pointers: */806 inputs=(ParameterInputs*)vinputs;807 767 808 768 /*recover objects from hooks: */ … … 812 772 numpar=(Numpar*)hnumpar.delivers(); 813 773 814 /*recover extra inputs from users, at current convergence iteration: */815 found=inputs->Recover("velocity_average",&vxvy_list[0][0],2,dofs,numgrids,(void**)nodes);816 if(!found)ISSMERROR(" could not find velocity_average in inputs!");817 818 for(i=0;i<numgrids;i++){819 vx_list[i]=vxvy_list[i][0];820 vy_list[i]=vxvy_list[i][1];821 }822 823 774 /* Get node coordinates and dof list: */ 824 775 GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids); 825 776 GetDofList(&doflist[0],&numberofdofspernode); 777 778 /*Recover velocity: */ 779 inputs->GetParameterValues(&vx_list[0],&gaussgrids[0][0],3,VxAverageEnum); 780 inputs->GetParameterValues(&vy_list[0],&gaussgrids[0][0],3,VyAverageEnum); 826 781 827 782 //Create Artificial diffusivity once for all if requested … … 832 787 833 788 //Build K matrix (artificial diffusivity matrix) 834 v_gauss[0]=ONETHIRD*(vx vy_list[0][0]+vxvy_list[1][0]+vxvy_list[2][0]);835 v_gauss[1]=ONETHIRD*(v xvy_list[0][1]+vxvy_list[1][1]+vxvy_list[2][1]);789 v_gauss[0]=ONETHIRD*(vx_list[0]+vx_list[1]+vx_list[2]); 790 v_gauss[1]=ONETHIRD*(vy_list[0]+vy_list[1]+vy_list[2]); 836 791 837 792 K[0][0]=pow(Jdettria,(double).5)/2.0*fabs(v_gauss[0]); … … 858 813 859 814 //Get vx, vy and their derivatives at gauss point 860 GetParameterValue(&vx, &vx_list[0],gauss_l1l2l3);861 GetParameterValue(&vy, &vy_list[0],gauss_l1l2l3);862 863 GetParameterDerivativeValue(&dvx[0], &vx_list[0],&xyz_list[0][0], gauss_l1l2l3);864 GetParameterDerivativeValue(&dvy[0], &vy_list[0],&xyz_list[0][0], gauss_l1l2l3);815 this->GetParameterValue(&vx, &vx_list[0],gauss_l1l2l3); 816 this->GetParameterValue(&vy, &vy_list[0],gauss_l1l2l3); 817 818 this->GetParameterDerivativeValue(&dvx[0], &vx_list[0],&xyz_list[0][0], gauss_l1l2l3); 819 this->GetParameterDerivativeValue(&dvy[0], &vy_list[0],&xyz_list[0][0], gauss_l1l2l3); 865 820 866 821 dvxdx=dvx[0]; … … 922 877 /*}}}*/ 923 878 /*FUNCTION Tria::CreateKMatrixBalancedthickness2 {{{1*/ 924 void Tria::CreateKMatrixBalancedthickness2(Mat Kgg, void* vinputs,int analysis_type,int sub_analysis_type){879 void Tria::CreateKMatrixBalancedthickness2(Mat Kgg,int analysis_type,int sub_analysis_type){ 925 880 926 881 /* local declarations */ … … 955 910 956 911 /*input parameters for structural analysis (diagnostic): */ 957 double vx_list[numgrids]={0.0};958 double vy_list[numgrids]={0.0};959 912 double vx,vy; 960 913 int dofs[1]={0}; … … 967 920 Numpar* numpar=NULL; 968 921 969 ParameterInputs* inputs=NULL;970 971 /*recover pointers: */972 inputs=(ParameterInputs*)vinputs;973 922 974 923 /*recover objects from hooks: */ … … 977 926 matice=(Matice*)hmatice.delivers(); 978 927 numpar=(Numpar*)hnumpar.delivers(); 979 980 /*recover extra inputs from users, at current convergence iteration: */981 found=inputs->Recover("vx_average",&vx_list[0],1,dofs,numgrids,(void**)nodes);982 if(!found)ISSMERROR(" could not find vx_average in inputs!");983 found=inputs->Recover("vy_average",&vy_list[0],1,dofs,numgrids,(void**)nodes);984 if(!found)ISSMERROR(" could not find vy_average in inputs!");985 928 986 929 /* Get node coordinates and dof list: */ … … 1008 951 1009 952 //Get vx, vy and their derivatives at gauss point 1010 GetParameterValue(&vx, &vx_list[0],gauss_l1l2l3);1011 GetParameterValue(&vy, &vy_list[0],gauss_l1l2l3);953 inputs->GetParameterValue(&vx, &gauss_l1l2l3[0],VxEnum); 954 inputs->GetParameterValue(&vy, &gauss_l1l2l3[0],VyEnum); 1012 955 1013 956 DL_scalar=-gauss_weight*Jdettria; … … 1039 982 /*}}}*/ 1040 983 /*FUNCTION Tria::CreateKMatrixBalancedvelocities {{{1*/ 1041 void Tria::CreateKMatrixBalancedvelocities(Mat Kgg, void* vinputs,int analysis_type,int sub_analysis_type){984 void Tria::CreateKMatrixBalancedvelocities(Mat Kgg,int analysis_type,int sub_analysis_type){ 1042 985 1043 986 /* local declarations */ … … 1060 1003 double gauss_weight; 1061 1004 double gauss_l1l2l3[3]; 1005 double gaussgrids[numgrids][numgrids]={{1,0,0},{0,1,0},{0,0,1}}; 1062 1006 1063 1007 /* matrices: */ … … 1076 1020 /*input parameters for structural analysis (diagnostic): */ 1077 1021 double surface_normal[3]; 1022 double surface_list[3]; 1078 1023 double nx,ny,norm; 1079 double vxvy_list[numgrids][2]={0.0};1080 1024 double vx_list[numgrids]={0.0}; 1081 1025 double vy_list[numgrids]={0.0}; … … 1096 1040 Numpar* numpar=NULL; 1097 1041 1098 ParameterInputs* inputs=NULL;1099 1100 /*recover pointers: */1101 inputs=(ParameterInputs*)vinputs;1102 1103 1042 /*recover objects from hooks: */ 1104 1043 nodes=(Node**)hnodes.deliverp(); … … 1107 1046 numpar=(Numpar*)hnumpar.delivers(); 1108 1047 1109 /*recover extra inputs from users, at current convergence iteration: */ 1110 found=inputs->Recover("velocity_average",&vxvy_list[0][0],2,dofs,numgrids,(void**)nodes); 1111 if(!found)ISSMERROR(" could not find velocity_average in inputs!"); 1112 1113 for(i=0;i<numgrids;i++){ 1114 vx_list[i]=vxvy_list[i][0]; 1115 vy_list[i]=vxvy_list[i][1]; 1116 } 1048 /*Recover velocity: */ 1049 inputs->GetParameterValues(&vx_list[0],&gaussgrids[0][0],3,VxAverageEnum); 1050 inputs->GetParameterValues(&vy_list[0],&gaussgrids[0][0],3,VyAverageEnum); 1117 1051 1118 1052 /* Get node coordinates and dof list: */ … … 1121 1055 1122 1056 /*Modify z so that it reflects the surface*/ 1123 for(i=0;i<numgrids;i++) xyz_list[i][2]=this->properties.s[i]; 1057 inputs->GetParameterValues(&surface_list[0],&gaussgrids[0][0],3,SurfaceEnum); 1058 for(i=0;i<numgrids;i++) xyz_list[i][2]=surface_list[i]; 1124 1059 1125 1060 /*Get normal vector to the surface*/ … … 1146 1081 1147 1082 //Build K matrix (artificial diffusivity matrix) 1148 v_gauss[0]=ONETHIRD*(vx vy_list[0][0]+vxvy_list[1][0]+vxvy_list[2][0]);1149 v_gauss[1]=ONETHIRD*(v xvy_list[0][1]+vxvy_list[1][1]+vxvy_list[2][1]);1083 v_gauss[0]=ONETHIRD*(vx_list[0]+vx_list[1]+vx_list[2]); 1084 v_gauss[1]=ONETHIRD*(vy_list[0]+vy_list[1]+vy_list[2]); 1150 1085 1151 1086 K[0][0]=pow(10,2)*pow(Jdettria,(double).5)/2.0*fabs(v_gauss[0]); //pow should be zero!! … … 1227 1162 /*}}}*/ 1228 1163 /*FUNCTION Tria::CreateKMatrixDiagnosticHoriz {{{1*/ 1229 void Tria::CreateKMatrixDiagnosticHoriz(Mat Kgg, void* vinputs,int analysis_type,int sub_analysis_type){1164 void Tria::CreateKMatrixDiagnosticHoriz(Mat Kgg,int analysis_type,int sub_analysis_type){ 1230 1165 1231 1166 /* local declarations */ … … 1270 1205 1271 1206 /*input parameters for structural analysis (diagnostic): */ 1272 double vxvy_list[numgrids][2]={{0,0},{0,0},{0,0}};1273 double oldvxvy_list[numgrids][2]={{0,0},{0,0},{0,0}};1274 1207 double thickness; 1275 1208 int dofs[2]={0,1}; … … 1281 1214 Numpar* numpar=NULL; 1282 1215 1283 ParameterInputs* inputs=NULL; 1216 /*inputs: */ 1217 bool onwater,shelf; 1218 1219 /*retrieve inputs :*/ 1220 inputs->GetParameterValue(&onwater,ElementOnWaterEnum); 1221 inputs->GetParameterValue(&shelf,ElementOnIceShelfEnum); 1284 1222 1285 1223 /*First, if we are on water, return empty matrix: */ 1286 if(this->properties.onwater) return; 1287 1288 /*recover pointers: */ 1289 inputs=(ParameterInputs*)vinputs; 1224 if(onwater) return; 1290 1225 1291 1226 /*recover objects from hooks: */ … … 1294 1229 matice=(Matice*)hmatice.delivers(); 1295 1230 numpar=(Numpar*)hnumpar.delivers(); 1296 1297 /*recover extra inputs from users, at current convergence iteration: */1298 inputs->Recover("velocity",&vxvy_list[0][0],2,dofs,numgrids,(void**)nodes);1299 inputs->Recover("old_velocity",&oldvxvy_list[0][0],2,dofs,numgrids,(void**)nodes);1300 1231 1301 1232 /* Get node coordinates and dof list: */ … … 1319 1250 1320 1251 /*Compute thickness at gaussian point: */ 1321 GetParameterValue(&thickness, &this->properties.h[0],gauss_l1l2l3);1252 inputs->GetParameterValue(&thickness, gauss_l1l2l3,ThicknessEnum); 1322 1253 1323 1254 /*Get strain rate from velocity: */ 1324 GetStrainRate(&epsilon[0],&vxvy_list[0][0],&xyz_list[0][0],gauss_l1l2l3);1325 GetStrainRate(&oldepsilon[0],&oldvxvy_list[0][0],&xyz_list[0][0],gauss_l1l2l3);1255 inputs->GetStrainRate(&epsilon[0],&xyz_list[0][0],gauss_l1l2l3,VxEnum,VyEnum); 1256 inputs->GetStrainRate(&oldepsilon[0],&xyz_list[0][0],gauss_l1l2l3,VxOldEnum,VyOldEnum); 1326 1257 1327 1258 /*Get viscosity: */ … … 1360 1291 1361 1292 /*Do not forget to include friction: */ 1362 if(! this->properties.shelf){1363 CreateKMatrixDiagnosticHorizFriction(Kgg, inputs,analysis_type,sub_analysis_type);1293 if(!shelf){ 1294 CreateKMatrixDiagnosticHorizFriction(Kgg,analysis_type,sub_analysis_type); 1364 1295 } 1365 1296 … … 1373 1304 /*}}}*/ 1374 1305 /*FUNCTION Tria::CreateKMatrixDiagnosticHorizFriction {{{1*/ 1375 void Tria::CreateKMatrixDiagnosticHorizFriction(Mat Kgg, void* vinputs,int analysis_type,int sub_analysis_type){1306 void Tria::CreateKMatrixDiagnosticHorizFriction(Mat Kgg,int analysis_type,int sub_analysis_type){ 1376 1307 1377 1308 … … 1394 1325 double gauss_weight; 1395 1326 double gauss_l1l2l3[3]; 1327 double gaussgrids[numgrids][numgrids]={{1,0,0},{0,1,0},{0,0,1}}; 1396 1328 1397 1329 /* matrices: */ … … 1411 1343 1412 1344 /*input parameters for structural analysis (diagnostic): */ 1413 double vxvy_list[numgrids][2]={{0,0},{0,0},{0,0}}; 1414 int dofs[2]={0,1}; 1345 double vx_list[numgrids]; 1346 double vy_list[numgrids]; 1347 double thickness_list[numgrids]; 1348 double bed_list[numgrids]; 1349 double dragcoefficient_list[numgrids]; 1350 double drag_p,drag_q; 1415 1351 1416 1352 /*friction: */ … … 1420 1356 double MAXSLOPE=.06; // 6 % 1421 1357 double MOUNTAINKEXPONENT=10; 1358 1359 /*inputs: */ 1360 bool shelf; 1361 int drag_type; 1422 1362 1423 1363 /*dynamic objects pointed to by hooks: */ … … 1427 1367 Numpar* numpar=NULL; 1428 1368 1429 ParameterInputs* inputs=NULL;1430 1431 /*recover pointers: */1432 inputs=(ParameterInputs*)vinputs;1433 1369 1434 1370 /*recover objects from hooks: */ … … 1437 1373 matice=(Matice*)hmatice.delivers(); 1438 1374 numpar=(Numpar*)hnumpar.delivers(); 1375 1376 /*retrieve inputs :*/ 1377 inputs->GetParameterValue(&shelf,ElementOnIceShelfEnum); 1378 inputs->GetParameterValue(&drag_type,DragTypeEnum); 1439 1379 1440 1380 /* Get node coordinates and dof list: */ … … 1445 1385 for(i=0;i<numdof;i++) for(j=0;j<numdof;j++) Ke_gg[i][j]=0.0; 1446 1386 1447 if ( this->properties.shelf){1387 if (shelf){ 1448 1388 /*no friction, do nothing*/ 1449 1389 return; 1450 1390 } 1451 1391 1452 if (this->properties.friction_type!=2)ISSMERROR(" non-viscous friction not supported yet!"); 1453 1454 /*recover extra inputs from users, at current convergence iteration: */ 1455 inputs->Recover("velocity",&vxvy_list[0][0],2,dofs,numgrids,(void**)nodes); 1392 if (drag_type!=2)ISSMERROR(" non-viscous friction not supported yet!"); 1393 1394 /*Recover inputs: */ 1395 inputs->GetParameterValues(&vx_list[0],&gaussgrids[0][0],3,VxAverageEnum); 1396 inputs->GetParameterValues(&vy_list[0],&gaussgrids[0][0],3,VyAverageEnum); 1397 inputs->GetParameterValues(&dragcoefficient_list[0],&gaussgrids[0][0],3,DragCoefficientEnum); 1398 inputs->GetParameterValues(&bed_list[0],&gaussgrids[0][0],3,BedEnum); 1399 inputs->GetParameterValues(&thickness_list[0],&gaussgrids[0][0],3,ThicknessEnum); 1400 inputs->GetParameterValue(&drag_p,DragPEnum); 1401 inputs->GetParameterValue(&drag_q,DragQEnum); 1456 1402 1457 1403 /*Build alpha2_list used by drag stiffness matrix*/ … … 1465 1411 friction->rho_ice=matpar->GetRhoIce(); 1466 1412 friction->rho_water=matpar->GetRhoWater(); 1467 friction->K=&this->properties.k[0]; 1468 friction->bed=&this->properties.b[0]; 1469 friction->thickness=&this->properties.h[0]; 1470 friction->velocities=&vxvy_list[0][0]; 1471 friction->p=this->properties.p; 1472 friction->q=this->properties.q; 1413 friction->K=&dragcoefficient_list[0]; 1414 friction->bed=&bed_list[0]; 1415 friction->thickness=&thickness_list[0]; 1416 friction->vx=&vx_list[0]; 1417 friction->vy=&vy_list[0]; 1418 friction->p=drag_p; 1419 friction->q=drag_q; 1473 1420 1474 1421 /*Compute alpha2_list: */ … … 1492 1439 // If we have a slope > 6% for this element, it means we are on a mountain. In this particular case, 1493 1440 //velocity should be = 0. To achieve this result, we set alpha2_list to a very high value: */ 1494 GetParameterDerivativeValue(&slope[0], &this->properties.s[0],&xyz_list[0][0], gauss_l1l2l3);1441 inputs->GetParameterDerivativeValue(&slope[0],&xyz_list[0][0],&gauss_l1l2l3[0],SurfaceEnum); 1495 1442 slope_magnitude=sqrt(pow(slope[0],2)+pow(slope[1],2)); 1496 1443 … … 1537 1484 /*}}}*/ 1538 1485 /*FUNCTION Tria::CreateKMatrixDiagnosticSurfaceVert {{{1*/ 1539 void Tria::CreateKMatrixDiagnosticSurfaceVert(Mat Kgg, void* vinputs,int analysis_type,int sub_analysis_type){1486 void Tria::CreateKMatrixDiagnosticSurfaceVert(Mat Kgg,int analysis_type,int sub_analysis_type){ 1540 1487 1541 1488 int i,j; … … 1584 1531 Numpar* numpar=NULL; 1585 1532 1586 ParameterInputs* inputs=NULL;1587 1588 /*recover pointers: */1589 inputs=(ParameterInputs*)vinputs;1590 1591 1533 /*recover objects from hooks: */ 1592 1534 nodes=(Node**)hnodes.deliverp(); … … 1675 1617 /*}}}*/ 1676 1618 /*FUNCTION Tria::CreateKMatrixMelting {{{1*/ 1677 void Tria::CreateKMatrixMelting(Mat Kgg, void* vinputs,int analysis_type,int sub_analysis_type){1619 void Tria::CreateKMatrixMelting(Mat Kgg,int analysis_type,int sub_analysis_type){ 1678 1620 1679 1621 /*indexing: */ … … 1771 1713 /*}}}*/ 1772 1714 /*FUNCTION Tria::CreateKMatrixPrognostic {{{1*/ 1773 void Tria::CreateKMatrixPrognostic(Mat Kgg, void* vinputs,int analysis_type,int sub_analysis_type){1715 void Tria::CreateKMatrixPrognostic(Mat Kgg,int analysis_type,int sub_analysis_type){ 1774 1716 1775 1717 /* local declarations */ … … 1792 1734 double gauss_weight; 1793 1735 double gauss_l1l2l3[3]; 1736 double gaussgrids[numgrids][numgrids]={{1,0,0},{0,1,0},{0,0,1}}; 1794 1737 1795 1738 /* matrices: */ … … 1807 1750 1808 1751 /*input parameters for structural analysis (diagnostic): */ 1809 double vxvy_list[numgrids][2]={0.0};1810 1752 double vx_list[numgrids]={0.0}; 1811 1753 double vy_list[numgrids]={0.0}; … … 1827 1769 Numpar* numpar=NULL; 1828 1770 1829 ParameterInputs* inputs=NULL;1830 1831 /*recover pointers: */1832 inputs=(ParameterInputs*)vinputs;1833 1834 1771 /*recover objects from hooks: */ 1835 1772 nodes=(Node**)hnodes.deliverp(); … … 1838 1775 numpar=(Numpar*)hnumpar.delivers(); 1839 1776 1840 /*recover extra inputs from users, at current convergence iteration: */ 1841 found=inputs->Recover("velocity_average",&vxvy_list[0][0],2,dofs,numgrids,(void**)nodes); 1842 if(!found)ISSMERROR(" could not find velocity_average in inputs!"); 1843 1844 for(i=0;i<numgrids;i++){ 1845 vx_list[i]=vxvy_list[i][0]; 1846 vy_list[i]=vxvy_list[i][1]; 1847 } 1848 1849 found=inputs->Recover("dt",&dt); 1850 if(!found)ISSMERROR(" could not find dt in inputs!"); 1777 /*recover dt: */ 1778 dt=numpar->dt; 1851 1779 1852 1780 /* Get node coordinates and dof list: */ 1853 1781 GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids); 1854 1782 GetDofList(&doflist[0],&numberofdofspernode); 1783 1784 /*Recover velocity: */ 1785 inputs->GetParameterValues(&vx_list[0],&gaussgrids[0][0],3,VxAverageEnum); 1786 inputs->GetParameterValues(&vy_list[0],&gaussgrids[0][0],3,VyAverageEnum); 1855 1787 1856 1788 //Create Artificial diffusivity once for all if requested … … 1861 1793 1862 1794 //Build K matrix (artificial diffusivity matrix) 1863 v_gauss[0]=ONETHIRD*(vx vy_list[0][0]+vxvy_list[1][0]+vxvy_list[2][0]);1864 v_gauss[1]=ONETHIRD*(v xvy_list[0][1]+vxvy_list[1][1]+vxvy_list[2][1]);1795 v_gauss[0]=ONETHIRD*(vx_list[0]+vx_list[1]+vx_list[2]); 1796 v_gauss[1]=ONETHIRD*(vy_list[0]+vy_list[1]+vy_list[2]); 1865 1797 1866 1798 K[0][0]=pow(Jdettria,(double).5)/2.0*fabs(v_gauss[0]); … … 1966 1898 /*}}}*/ 1967 1899 /*FUNCTION Tria::CreateKMatrixPrognostic2 {{{1*/ 1968 void Tria::CreateKMatrixPrognostic2(Mat Kgg, void* vinputs,int analysis_type,int sub_analysis_type){1900 void Tria::CreateKMatrixPrognostic2(Mat Kgg,int analysis_type,int sub_analysis_type){ 1969 1901 1970 1902 /* local declarations */ … … 2001 1933 2002 1934 /*input parameters for structural analysis (diagnostic): */ 2003 double vx_list[numgrids]={0.0};2004 double vy_list[numgrids]={0.0};2005 1935 double vx,vy; 2006 1936 double dt; … … 2014 1944 Numpar* numpar=NULL; 2015 1945 2016 ParameterInputs* inputs=NULL;2017 2018 /*recover pointers: */2019 inputs=(ParameterInputs*)vinputs;2020 2021 1946 /*recover objects from hooks: */ 2022 1947 nodes=(Node**) hnodes.deliverp(); … … 2025 1950 numpar=(Numpar*)hnumpar.delivers(); 2026 1951 2027 /*recover extra inputs from users, at current convergence iteration: */ 2028 found=inputs->Recover("vx_average",&vx_list[0],1,dofs,numgrids,(void**)nodes); 2029 if(!found)ISSMERROR(" could not find vx_average in inputs!"); 2030 found=inputs->Recover("vy_average",&vy_list[0],1,dofs,numgrids,(void**)nodes); 2031 if(!found)ISSMERROR(" could not find vy_average in inputs!"); 2032 found=inputs->Recover("dt",&dt); 2033 if(!found)ISSMERROR(" could not find dt in inputs!"); 1952 /*recover dt: */ 1953 dt=numpar->dt; 2034 1954 2035 1955 /* Get node coordinates and dof list: */ … … 2069 1989 2070 1990 //Get vx, vy and their derivatives at gauss point 2071 GetParameterValue(&vx, &vx_list[0],gauss_l1l2l3);2072 GetParameterValue(&vy, &vy_list[0],gauss_l1l2l3);1991 inputs->GetParameterValue(&vx,&gauss_l1l2l3[0],VxAverageEnum); 1992 inputs->GetParameterValue(&vy,&gauss_l1l2l3[0],VyAverageEnum); 2073 1993 2074 1994 DL_scalar=-dt*gauss_weight*Jdettria; … … 2103 2023 /*FUNCTION Tria::CreateKMatrixSlopeCompute {{{1*/ 2104 2024 2105 void Tria::CreateKMatrixSlopeCompute(Mat Kgg, void* vinputs,int analysis_type,int sub_analysis_type){2025 void Tria::CreateKMatrixSlopeCompute(Mat Kgg,int analysis_type,int sub_analysis_type){ 2106 2026 2107 2027 /* local declarations */ … … 2195 2115 /*}}}*/ 2196 2116 /*FUNCTION Tria::CreateKMatrixThermal {{{1*/ 2197 void Tria::CreateKMatrixThermal(Mat Kgg, void* vinputs,int analysis_type,int sub_analysis_type){2117 void Tria::CreateKMatrixThermal(Mat Kgg,int analysis_type,int sub_analysis_type){ 2198 2118 2199 2119 int i,j; … … 2230 2150 double tl1l2l3D[3]; 2231 2151 double D_scalar; 2232 ParameterInputs* inputs=NULL;2233 2152 2234 2153 /*dynamic objects pointed to by hooks: */ … … 2238 2157 Numpar* numpar=NULL; 2239 2158 2240 /*recover pointers: */2241 inputs=(ParameterInputs*)vinputs;2242 2243 2159 /*recover objects from hooks: */ 2244 2160 nodes=(Node**)hnodes.deliverp(); … … 2248 2164 2249 2165 /*recover extra inputs from users, dt: */ 2250 found=inputs->Recover("dt",&dt); 2251 if(!found)ISSMERROR(" could not find dt in inputs!"); 2166 dt=numpar->dt; 2252 2167 2253 2168 /* Get node coordinates and dof list: */ … … 2307 2222 /*}}}*/ 2308 2223 /*FUNCTION Tria::CreatePVector {{{1*/ 2309 void Tria::CreatePVector(Vec pg, void* inputs,int analysis_type,int sub_analysis_type){2224 void Tria::CreatePVector(Vec pg,int analysis_type,int sub_analysis_type){ 2310 2225 2311 2226 /*Just branch to the correct load generator, according to the type of analysis we are carrying out: */ 2312 2227 if (analysis_type==ControlAnalysisEnum){ 2313 2228 2314 CreatePVectorDiagnosticHoriz( pg, inputs,analysis_type,sub_analysis_type);2229 CreatePVectorDiagnosticHoriz( pg,analysis_type,sub_analysis_type); 2315 2230 2316 2231 } … … 2318 2233 if (sub_analysis_type==HorizAnalysisEnum){ 2319 2234 2320 CreatePVectorDiagnosticHoriz( pg, inputs,analysis_type,sub_analysis_type);2235 CreatePVectorDiagnosticHoriz( pg,analysis_type,sub_analysis_type); 2321 2236 } 2322 2237 else ISSMERROR("%s%i%s\n","sub_analysis: ",sub_analysis_type," not supported yet"); … … 2324 2239 else if (analysis_type==SlopecomputeAnalysisEnum){ 2325 2240 2326 CreatePVectorSlopeCompute( pg, inputs,analysis_type,sub_analysis_type);2241 CreatePVectorSlopeCompute( pg,analysis_type,sub_analysis_type); 2327 2242 } 2328 2243 else if (analysis_type==PrognosticAnalysisEnum){ 2329 2244 2330 CreatePVectorPrognostic( pg, inputs,analysis_type,sub_analysis_type);2245 CreatePVectorPrognostic( pg,analysis_type,sub_analysis_type); 2331 2246 } 2332 2247 else if (analysis_type==Prognostic2AnalysisEnum){ 2333 2248 2334 CreatePVectorPrognostic2( pg, inputs,analysis_type,sub_analysis_type);2249 CreatePVectorPrognostic2( pg,analysis_type,sub_analysis_type); 2335 2250 } 2336 2251 else if (analysis_type==BalancedthicknessAnalysisEnum){ 2337 2252 2338 CreatePVectorBalancedthickness( pg, inputs,analysis_type,sub_analysis_type);2253 CreatePVectorBalancedthickness( pg,analysis_type,sub_analysis_type); 2339 2254 } 2340 2255 else if (analysis_type==Balancedthickness2AnalysisEnum){ 2341 2256 2342 CreatePVectorBalancedthickness2( pg, inputs,analysis_type,sub_analysis_type);2257 CreatePVectorBalancedthickness2( pg,analysis_type,sub_analysis_type); 2343 2258 } 2344 2259 else if (analysis_type==BalancedvelocitiesAnalysisEnum){ 2345 2260 2346 CreatePVectorBalancedvelocities( pg, inputs,analysis_type,sub_analysis_type);2261 CreatePVectorBalancedvelocities( pg,analysis_type,sub_analysis_type); 2347 2262 } 2348 2263 else{ … … 2353 2268 /*}}}*/ 2354 2269 /*FUNCTION Tria::CreatePVectorBalancedthickness {{{1*/ 2355 void Tria::CreatePVectorBalancedthickness(Vec pg , void* vinputs,int analysis_type,int sub_analysis_type){2270 void Tria::CreatePVectorBalancedthickness(Vec pg ,int analysis_type,int sub_analysis_type){ 2356 2271 2357 2272 … … 2382 2297 2383 2298 /*input parameters for structural analysis (diagnostic): */ 2384 double accumulation_list[numgrids]={0.0};2385 2299 double accumulation_g; 2386 double melting_list[numgrids]={0.0};2387 2300 double melting_g; 2388 double thickness_list[numgrids]={0.0};2389 double thickness_g;2390 int dofs[1]={0};2391 int found=0;2392 2301 2393 2302 /*dynamic objects pointed to by hooks: */ … … 2397 2306 Numpar* numpar=NULL; 2398 2307 2399 ParameterInputs* inputs=NULL;2400 2401 /*recover pointers: */2402 inputs=(ParameterInputs*)vinputs;2403 2404 2308 /*recover objects from hooks: */ 2405 2309 nodes=(Node**)hnodes.deliverp(); … … 2407 2311 matice=(Matice*)hmatice.delivers(); 2408 2312 numpar=(Numpar*)hnumpar.delivers(); 2409 2410 /*recover extra inputs from users, at current convergence iteration: */2411 found=inputs->Recover("accumulation",&accumulation_list[0],1,dofs,numgrids,(void**)nodes);2412 if(!found)ISSMERROR(" could not find accumulation in inputs!");2413 found=inputs->Recover("melting",&melting_list[0],1,dofs,numgrids,(void**)nodes);2414 if(!found)ISSMERROR(" could not find melting in inputs!");2415 2313 2416 2314 /* Get node coordinates and dof list: */ … … 2435 2333 GetL(&L[0], &xyz_list[0][0], gauss_l1l2l3,numberofdofspernode); 2436 2334 2437 /* Get accumulation, melting a nd thickness at gauss point */2438 GetParameterValue(&accumulation_g, &accumulation_list[0],gauss_l1l2l3);2439 GetParameterValue(&melting_g, &melting_list[0],gauss_l1l2l3);2335 /* Get accumulation, melting at gauss point */ 2336 inputs->GetParameterValue(&accumulation_g, &gauss_l1l2l3[0],AccumulationRateEnum); 2337 inputs->GetParameterValue(&melting_g, &gauss_l1l2l3[0],MeltingRateEnum); 2440 2338 2441 2339 /* Add value into pe_g: */ … … 2456 2354 /*}}}*/ 2457 2355 /*FUNCTION Tria::CreatePVectorBalancedthickness2 {{{1*/ 2458 void Tria::CreatePVectorBalancedthickness2(Vec pg , void* vinputs,int analysis_type,int sub_analysis_type){2356 void Tria::CreatePVectorBalancedthickness2(Vec pg ,int analysis_type,int sub_analysis_type){ 2459 2357 2460 2358 … … 2485 2383 2486 2384 /*input parameters for structural analysis (diagnostic): */ 2487 double accumulation_list[numgrids]={0.0};2488 2385 double accumulation_g; 2489 double melting_list[numgrids]={0.0};2490 2386 double melting_g; 2491 double dhdt_list[numgrids]={0.0};2492 2387 double dhdt_g; 2493 int dofs[1]={0};2494 int found=0;2495 2388 2496 2389 /*dynamic objects pointed to by hooks: */ … … 2500 2393 Numpar* numpar=NULL; 2501 2394 2502 ParameterInputs* inputs=NULL;2503 2504 /*recover pointers: */2505 inputs=(ParameterInputs*)vinputs;2506 2507 2395 /*recover objects from hooks: */ 2508 2396 nodes=(Node**) hnodes.deliverp(); … … 2510 2398 matice=(Matice*)hmatice.delivers(); 2511 2399 numpar=(Numpar*)hnumpar.delivers(); 2512 2513 /*recover extra inputs from users, at current convergence iteration: */2514 found=inputs->Recover("accumulation",&accumulation_list[0],1,dofs,numgrids,(void**)nodes);2515 if(!found)ISSMERROR(" could not find accumulation in inputs!");2516 found=inputs->Recover("melting",&melting_list[0],1,dofs,numgrids,(void**)nodes);2517 if(!found)ISSMERROR(" could not find melting in inputs!");2518 found=inputs->Recover("dhdt",&dhdt_list[0],1,dofs,numgrids,(void**)nodes);2519 if(!found)ISSMERROR(" could not find dhdt in inputs!");2520 2400 2521 2401 /* Get node coordinates and dof list: */ … … 2541 2421 2542 2422 /* Get accumulation, melting and thickness at gauss point */ 2543 GetParameterValue(&accumulation_g, &accumulation_list[0],gauss_l1l2l3);2544 GetParameterValue(&melting_g, &melting_list[0],gauss_l1l2l3);2545 GetParameterValue(&dhdt_g, &dhdt_list[0],gauss_l1l2l3);2423 inputs->GetParameterValue(&accumulation_g, &gauss_l1l2l3[0],AccumulationRateEnum); 2424 inputs->GetParameterValue(&melting_g, &gauss_l1l2l3[0],MeltingRateEnum); 2425 inputs->GetParameterValue(&dhdt_g, &gauss_l1l2l3[0],DhDtEnum); 2546 2426 2547 2427 /* Add value into pe_g: */ … … 2562 2442 /*}}}*/ 2563 2443 /*FUNCTION Tria::CreatePVectorBalancedvelocities {{{1*/ 2564 void Tria::CreatePVectorBalancedvelocities(Vec pg , void* vinputs,int analysis_type,int sub_analysis_type){2444 void Tria::CreatePVectorBalancedvelocities(Vec pg ,int analysis_type,int sub_analysis_type){ 2565 2445 2566 2446 … … 2591 2471 2592 2472 /*input parameters for structural analysis (diagnostic): */ 2593 double accumulation_list[numgrids]={0.0};2594 2473 double accumulation_g; 2595 double melting_list[numgrids]={0.0};2596 2474 double melting_g; 2597 int dofs[1]={0};2598 int found=0;2599 2475 2600 2476 /*dynamic objects pointed to by hooks: */ … … 2604 2480 Numpar* numpar=NULL; 2605 2481 2606 ParameterInputs* inputs=NULL;2607 2608 /*recover pointers: */2609 inputs=(ParameterInputs*)vinputs;2610 2611 2482 /*recover objects from hooks: */ 2612 2483 nodes=(Node**)hnodes.deliverp(); … … 2620 2491 matice=(Matice*)hmatice.delivers(); 2621 2492 numpar=(Numpar*)hnumpar.delivers(); 2622 2623 /*recover extra inputs from users, at current convergence iteration: */2624 found=inputs->Recover("accumulation",&accumulation_list[0],1,dofs,numgrids,(void**)nodes);2625 if(!found)ISSMERROR(" could not find accumulation in inputs!");2626 found=inputs->Recover("melting",&melting_list[0],1,dofs,numgrids,(void**)nodes);2627 if(!found)ISSMERROR(" could not find melting in inputs!");2628 2493 2629 2494 /* Get node coordinates and dof list: */ … … 2649 2514 2650 2515 /* Get accumulation, melting at gauss point */ 2651 GetParameterValue(&accumulation_g, &accumulation_list[0],gauss_l1l2l3);2652 GetParameterValue(&melting_g, &melting_list[0],gauss_l1l2l3);2516 inputs->GetParameterValue(&accumulation_g, &gauss_l1l2l3[0],AccumulationRateEnum); 2517 inputs->GetParameterValue(&melting_g, &gauss_l1l2l3[0],MeltingRateEnum); 2653 2518 2654 2519 /* Add value into pe_g: */ … … 2669 2534 /*}}}*/ 2670 2535 /*FUNCTION Tria::CreatePVectorDiagnosticBaseVert {{{1*/ 2671 void Tria::CreatePVectorDiagnosticBaseVert(Vec pg, void* vinputs,int analysis_type,int sub_analysis_type){2536 void Tria::CreatePVectorDiagnosticBaseVert(Vec pg,int analysis_type,int sub_analysis_type){ 2672 2537 2673 2538 int i,j; … … 2704 2569 2705 2570 /*input parameters for structural analysis (diagnostic): */ 2706 double* velocity_param=NULL;2707 double vx_list[numgrids]={0,0,0};2708 double vy_list[numgrids]={0,0,0};2709 2571 double vx,vy; 2710 2572 double meltingvalue; 2711 2573 double slope[2]; 2712 2574 double dbdx,dbdy; 2713 int dofs1[1]={0};2714 int dofs2[1]={1};2715 2575 2716 2576 /*dynamic objects pointed to by hooks: */ … … 2720 2580 Numpar* numpar=NULL; 2721 2581 2722 ParameterInputs* inputs=NULL;2723 2724 /*recover pointers: */2725 inputs=(ParameterInputs*)vinputs;2726 2727 2582 /*recover objects from hooks: */ 2728 2583 nodes=(Node**)hnodes.deliverp(); … … 2731 2586 numpar=(Numpar*)hnumpar.delivers(); 2732 2587 2733 /* recover input parameters: */2734 if(!inputs->Recover("velocity",&vx_list[0],1,dofs1,numgrids,(void**)nodes))ISSMERROR(" cannot compute vertical velocity without horizontal velocity");2735 inputs->Recover("velocity",&vy_list[0],1,dofs2,numgrids,(void**)nodes);2736 2737 2588 /* Get node coordinates and dof list: */ 2738 2589 GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids); … … 2756 2607 2757 2608 /*Get melting at gaussian point: */ 2758 GetParameterValue(&meltingvalue, &this->properties.melting[0],gauss_l1l2l3);2609 inputs->GetParameterValue(&meltingvalue, &gauss_l1l2l3[0],MeltingRateEnum); 2759 2610 2760 2611 /*Get velocity at gaussian point: */ 2761 GetParameterValue(&vx, &vx_list[0],gauss_l1l2l3);2762 GetParameterValue(&vy, &vy_list[0],gauss_l1l2l3);2612 inputs->GetParameterValue(&vx, &gauss_l1l2l3[0],VxEnum); 2613 inputs->GetParameterValue(&vy, &gauss_l1l2l3[0],VyEnum); 2763 2614 2764 2615 /*Get bed slope: */ 2765 GetParameterDerivativeValue(&slope[0], &this->properties.b[0],&xyz_list[0][0], gauss_l1l2l3);2616 inputs->GetParameterDerivativeValue(&slope[0],&xyz_list[0][0],&gauss_l1l2l3[0],BedEnum); 2766 2617 dbdx=slope[0]; 2767 2618 dbdy=slope[1]; … … 2796 2647 /*}}}*/ 2797 2648 /*FUNCTION Tria::CreatePVectorDiagnosticHoriz {{{1*/ 2798 void Tria::CreatePVectorDiagnosticHoriz( Vec pg, void* vinputs,int analysis_type,int sub_analysis_type){2649 void Tria::CreatePVectorDiagnosticHoriz( Vec pg, int analysis_type,int sub_analysis_type){ 2799 2650 2800 2651 int i,j; … … 2841 2692 Numpar* numpar=NULL; 2842 2693 2843 ParameterInputs* inputs=NULL; 2694 /*inputs: */ 2695 bool onwater; 2696 int drag_type; 2697 2698 /*retrieve inputs :*/ 2699 inputs->GetParameterValue(&onwater,ElementOnWaterEnum); 2700 inputs->GetParameterValue(&drag_type,DragTypeEnum); 2844 2701 2845 2702 /*First, if we are on water, return empty vector: */ 2846 if(this->properties.onwater)return; 2847 2848 /*recover pointers: */ 2849 inputs=(ParameterInputs*)vinputs; 2703 if(onwater)return; 2850 2704 2851 2705 /*recover objects from hooks: */ … … 2875 2729 2876 2730 /*Compute thickness at gaussian point: */ 2877 GetParameterValue(&thickness, &this->properties.h[0],gauss_l1l2l3); 2878 2879 GetParameterDerivativeValue(&slope[0], &this->properties.s[0],&xyz_list[0][0], gauss_l1l2l3); 2731 inputs->GetParameterValue(&thickness, &gauss_l1l2l3[0],ThicknessEnum); 2732 inputs->GetParameterDerivativeValue(&slope[0],&xyz_list[0][0],&gauss_l1l2l3[0],SurfaceEnum); 2880 2733 2881 2734 /*In case we have plastic basal drag, compute plastic stress at gaussian point from k1, k2 and k3 fields in the 2882 2735 * element itself: */ 2883 if( this->properties.friction_type==1){2884 GetParameterValue(&plastic_stress, &this->properties.k[0],gauss_l1l2l3);2736 if(drag_type==1){ 2737 inputs->GetParameterValue(&plastic_stress, &gauss_l1l2l3[0],DragCoefficientEnum); 2885 2738 } 2886 2739 … … 2895 2748 2896 2749 /*Build pe_g_gaussian vector: */ 2897 if( this->properties.friction_type==1){2750 if(drag_type==1){ 2898 2751 for (i=0;i<numgrids;i++){ 2899 2752 for (j=0;j<NDOF2;j++){ … … 2927 2780 /*}}}*/ 2928 2781 /*FUNCTION Tria::CreatePVectorPrognostic {{{1*/ 2929 void Tria::CreatePVectorPrognostic(Vec pg , void* vinputs,int analysis_type,int sub_analysis_type){2782 void Tria::CreatePVectorPrognostic(Vec pg ,int analysis_type,int sub_analysis_type){ 2930 2783 2931 2784 … … 2956 2809 2957 2810 /*input parameters for structural analysis (diagnostic): */ 2958 double accumulation_list[numgrids]={0.0};2959 2811 double accumulation_g; 2960 double melting_list[numgrids]={0.0};2961 2812 double melting_g; 2962 double thickness_list[numgrids]={0.0};2963 2813 double thickness_g; 2964 2814 double dt; 2965 int dofs[1]={0};2966 int found=0;2967 2815 2968 2816 /*dynamic objects pointed to by hooks: */ … … 2972 2820 Numpar* numpar=NULL; 2973 2821 2974 ParameterInputs* inputs=NULL;2975 2976 /*recover pointers: */2977 inputs=(ParameterInputs*)vinputs;2978 2979 2822 /*recover objects from hooks: */ 2980 2823 nodes=(Node**)hnodes.deliverp(); … … 2983 2826 numpar=(Numpar*)hnumpar.delivers(); 2984 2827 2985 /*recover extra inputs from users, at current convergence iteration: */ 2986 found=inputs->Recover("accumulation",&accumulation_list[0],1,dofs,numgrids,(void**)nodes); 2987 if(!found)ISSMERROR(" could not find accumulation in inputs!"); 2988 found=inputs->Recover("melting",&melting_list[0],1,dofs,numgrids,(void**)nodes); 2989 if(!found)ISSMERROR(" could not find melting in inputs!"); 2990 found=inputs->Recover("thickness",&thickness_list[0],1,dofs,numgrids,(void**)nodes); 2991 if(!found)ISSMERROR(" could not find thickness in inputs!"); 2992 found=inputs->Recover("dt",&dt); 2993 if(!found)ISSMERROR(" could not find dt in inputs!"); 2828 /*recover dt: */ 2829 dt=numpar->dt; 2994 2830 2995 2831 /* Get node coordinates and dof list: */ … … 3015 2851 3016 2852 /* Get accumulation, melting and thickness at gauss point */ 3017 GetParameterValue(&accumulation_g, &accumulation_list[0],gauss_l1l2l3);3018 GetParameterValue(&melting_g, &melting_list[0],gauss_l1l2l3);3019 GetParameterValue(&thickness_g, &thickness_list[0],gauss_l1l2l3);2853 inputs->GetParameterValue(&accumulation_g, &gauss_l1l2l3[0],AccumulationRateEnum); 2854 inputs->GetParameterValue(&melting_g, &gauss_l1l2l3[0],MeltingRateEnum); 2855 inputs->GetParameterValue(&thickness_g, &gauss_l1l2l3[0],ThicknessEnum); 3020 2856 3021 2857 /* Add value into pe_g: */ … … 3036 2872 /*}}}*/ 3037 2873 /*FUNCTION Tria::CreatePVectorPrognostic2 {{{1*/ 3038 void Tria::CreatePVectorPrognostic2(Vec pg , void* vinputs,int analysis_type,int sub_analysis_type){2874 void Tria::CreatePVectorPrognostic2(Vec pg ,int analysis_type,int sub_analysis_type){ 3039 2875 3040 2876 /* local declarations */ … … 3064 2900 3065 2901 /*input parameters for structural analysis (diagnostic): */ 3066 double accumulation_list[numgrids]={0.0};3067 2902 double accumulation_g; 3068 double melting_list[numgrids]={0.0};3069 2903 double melting_g; 3070 double thickness_list[numgrids]={0.0};3071 2904 double thickness_g; 3072 2905 double dt; 3073 int dofs[1]={0};3074 int found=0;3075 2906 3076 2907 /*dynamic objects pointed to by hooks: */ … … 3080 2911 Numpar* numpar=NULL; 3081 2912 3082 ParameterInputs* inputs=NULL;3083 3084 /*recover pointers: */3085 inputs=(ParameterInputs*)vinputs;3086 3087 2913 /*recover objects from hooks: */ 3088 2914 nodes=(Node**)hnodes.deliverp(); … … 3091 2917 numpar=(Numpar*)hnumpar.delivers(); 3092 2918 3093 /*recover extra inputs from users, at current convergence iteration: */ 3094 found=inputs->Recover("accumulation",&accumulation_list[0],1,dofs,numgrids,(void**)nodes); 3095 if(!found)ISSMERROR(" could not find accumulation in inputs!"); 3096 found=inputs->Recover("melting",&melting_list[0],1,dofs,numgrids,(void**)nodes); 3097 if(!found)ISSMERROR(" could not find melting in inputs!"); 3098 found=inputs->Recover("thickness",&thickness_list[0],1,dofs,numgrids,(void**)nodes); 3099 if(!found)ISSMERROR(" could not find thickness in inputs!"); 3100 found=inputs->Recover("dt",&dt); 3101 if(!found)ISSMERROR(" could not find dt in inputs!"); 2919 /*recover dt: */ 2920 dt=numpar->dt; 2921 3102 2922 3103 2923 /* Get node coordinates and dof list: */ … … 3123 2943 3124 2944 /* Get accumulation, melting and thickness at gauss point */ 3125 GetParameterValue(&accumulation_g, &accumulation_list[0],gauss_l1l2l3);3126 GetParameterValue(&melting_g, &melting_list[0],gauss_l1l2l3);3127 GetParameterValue(&thickness_g, &thickness_list[0],gauss_l1l2l3);2945 inputs->GetParameterValue(&accumulation_g, &gauss_l1l2l3[0],AccumulationRateEnum); 2946 inputs->GetParameterValue(&melting_g, &gauss_l1l2l3[0],MeltingRateEnum); 2947 inputs->GetParameterValue(&thickness_g, &gauss_l1l2l3[0],ThicknessEnum); 3128 2948 3129 2949 /* Add value into pe_g: */ … … 3145 2965 /*FUNCTION Tria::CreatePVectorSlopeCompute {{{1*/ 3146 2966 3147 void Tria::CreatePVectorSlopeCompute( Vec pg, void* vinputs,int analysis_type,int sub_analysis_type){2967 void Tria::CreatePVectorSlopeCompute( Vec pg, int analysis_type,int sub_analysis_type){ 3148 2968 3149 2969 int i,j; … … 3175 2995 double pe_g[numdof]; 3176 2996 double pe_g_gaussian[numdof]; 3177 double param[3];3178 2997 double slope[2]; 3179 2998 … … 3197 3016 for(i=0;i<numdof;i++) pe_g[i]=0.0; 3198 3017 3199 if ( (sub_analysis_type==SurfaceXAnalysisEnum) || (sub_analysis_type==SurfaceYAnalysisEnum)){3200 for(i=0;i<numdof;i++) param[i]=this->properties.s[i];3201 }3202 if ( (sub_analysis_type==BedXAnalysisEnum) || (sub_analysis_type==BedYAnalysisEnum)){3203 for(i=0;i<numdof;i++) param[i]=this->properties.b[i];3204 }3205 3018 3206 3019 /* Get gaussian points and weights: */ … … 3216 3029 gauss_l1l2l3[2]=*(third_gauss_area_coord+ig); 3217 3030 3218 GetParameterDerivativeValue(&slope[0], ¶m[0],&xyz_list[0][0], gauss_l1l2l3); 3219 3031 if ( (sub_analysis_type==SurfaceXAnalysisEnum) || (sub_analysis_type==SurfaceYAnalysisEnum)){ 3032 inputs->GetParameterDerivativeValue(&slope[0],&xyz_list[0][0],&gauss_l1l2l3[0],SurfaceEnum); 3033 } 3034 if ( (sub_analysis_type==BedXAnalysisEnum) || (sub_analysis_type==BedYAnalysisEnum)){ 3035 inputs->GetParameterDerivativeValue(&slope[0],&xyz_list[0][0],&gauss_l1l2l3[0],BedEnum); 3036 } 3037 3220 3038 /* Get Jacobian determinant: */ 3221 3039 GetJacobianDeterminant2d(&Jdet, &xyz_list[0][0],gauss_l1l2l3); … … 3249 3067 /*}}}*/ 3250 3068 /*FUNCTION Tria::CreatePVectorThermalShelf {{{1*/ 3251 void Tria::CreatePVectorThermalShelf( Vec pg, void* vinputs,int analysis_type,int sub_analysis_type){3069 void Tria::CreatePVectorThermalShelf( Vec pg, int analysis_type,int sub_analysis_type){ 3252 3070 3253 3071 int i,found; … … 3270 3088 /*inputs: */ 3271 3089 double dt; 3272 double pressure_list[3];3273 3090 double pressure; 3274 3091 … … 3297 3114 Numpar* numpar=NULL; 3298 3115 3299 ParameterInputs* inputs=NULL;3300 3301 /*recover pointers: */3302 inputs=(ParameterInputs*)vinputs;3303 3304 3116 /*recover objects from hooks: */ 3305 3117 nodes=(Node**)hnodes.deliverp(); … … 3320 3132 beta=matpar->GetBeta(); 3321 3133 meltingpoint=matpar->GetMeltingPoint(); 3322 3323 3324 /*recover extra inputs from users, dt and velocity: */ 3325 found=inputs->Recover("dt",&dt); 3326 if(!found)ISSMERROR(" could not find dt in inputs!"); 3327 found=inputs->Recover("pressure",&pressure_list[0],1,dofs1,numgrids,(void**)nodes); 3328 if(!found)ISSMERROR(" could not find pressure in inputs!"); 3134 dt=numpar->dt; 3135 3329 3136 3330 3137 /* Ice/ocean heat exchange flux on ice shelf base */ … … 3346 3153 3347 3154 /*Get geothermal flux and basal friction */ 3348 GetParameterValue(&pressure,&pressure_list[0],gauss_coord);3155 inputs->GetParameterValue(&pressure, &gauss_coord[0],PressureEnum); 3349 3156 t_pmp=meltingpoint-beta*pressure; 3350 3157 … … 3372 3179 /*}}}*/ 3373 3180 /*FUNCTION Tria::CreatePVectorThermalSheet {{{1*/ 3374 void Tria::CreatePVectorThermalSheet( Vec pg, void* vinputs,int analysis_type,int sub_analysis_type){3181 void Tria::CreatePVectorThermalSheet( Vec pg, int analysis_type,int sub_analysis_type){ 3375 3182 3376 3183 int i,found; … … 3382 3189 int numberofdofspernode; 3383 3190 double xyz_list[numgrids][3]; 3384 double vxvyvz_list[numgrids][3];3385 double vx_list[numgrids];3386 double vy_list[numgrids];3387 3191 3388 3192 double rho_ice; … … 3398 3202 double geothermalflux_value; 3399 3203 3204 double vx_list[numgrids]; 3205 double vy_list[numgrids]; 3206 double thickness_list[numgrids]; 3207 double bed_list[numgrids]; 3208 double dragcoefficient_list[numgrids]; 3209 double drag_p,drag_q; 3210 int drag_type; 3211 3400 3212 /* gaussian points: */ 3401 3213 int num_area_gauss,ig; … … 3406 3218 double gauss_weight; 3407 3219 double gauss_coord[3]; 3408 int dofs1[1]={0};3220 double gaussgrids[numgrids][numgrids]={{1,0,0},{0,1,0},{0,0,1}}; 3409 3221 3410 3222 /*matrices: */ … … 3414 3226 double scalar; 3415 3227 3416 int dofs[3]={0,1,2};3417 3418 ParameterInputs* inputs=NULL;3419 3228 3420 3229 /*dynamic objects pointed to by hooks: */ … … 3424 3233 Numpar* numpar=NULL; 3425 3234 3426 /*recover pointers: */3427 inputs=(ParameterInputs*)vinputs;3428 3429 3235 /*recover objects from hooks: */ 3430 3236 nodes=(Node**)hnodes.deliverp(); … … 3432 3238 matice=(Matice*)hmatice.delivers(); 3433 3239 numpar=(Numpar*)hnumpar.delivers(); 3240 3241 /*retrieve inputs :*/ 3242 inputs->GetParameterValue(&drag_type,DragTypeEnum); 3434 3243 3435 3244 /* Get node coordinates and dof list: */ … … 3440 3249 rho_ice=matpar->GetRhoIce(); 3441 3250 heatcapacity=matpar->GetHeatCapacity(); 3442 3443 3444 /*recover extra inputs from users, dt and velocity: */ 3445 found=inputs->Recover("dt",&dt); 3446 if(!found)ISSMERROR(" could not find dt in inputs!"); 3447 3448 found=inputs->Recover("velocity",&vxvyvz_list[0][0],3,dofs,numgrids,(void**)nodes); 3449 if(!found)ISSMERROR(" could not find velocity in inputs!"); 3450 3451 for(i=0;i<numgrids;i++){ 3452 vx_list[i]=vxvyvz_list[i][0]; 3453 vy_list[i]=vxvyvz_list[i][1]; 3454 } 3251 dt=numpar->dt; 3252 3253 3254 /*Recover inputs: */ 3255 inputs->GetParameterValues(&vx_list[0],&gaussgrids[0][0],3,VxAverageEnum); 3256 inputs->GetParameterValues(&vy_list[0],&gaussgrids[0][0],3,VyAverageEnum); 3257 inputs->GetParameterValues(&dragcoefficient_list[0],&gaussgrids[0][0],3,DragCoefficientEnum); 3258 inputs->GetParameterValues(&bed_list[0],&gaussgrids[0][0],3,BedEnum); 3259 inputs->GetParameterValues(&thickness_list[0],&gaussgrids[0][0],3,ThicknessEnum); 3260 inputs->GetParameterValue(&drag_p,DragPEnum); 3261 inputs->GetParameterValue(&drag_q,DragQEnum); 3455 3262 3456 3263 /*Build alpha2_list used by drag stiffness matrix*/ … … 3458 3265 3459 3266 /*Initialize all fields: */ 3460 if ( this->properties.friction_type!=2)ISSMERROR(" non-viscous friction not supported yet!");3267 if (drag_type!=2)ISSMERROR(" non-viscous friction not supported yet!"); 3461 3268 3462 3269 friction->element_type=(char*)xmalloc((strlen("3d")+1)*sizeof(char)); 3463 3270 strcpy(friction->element_type,"3d"); 3464 3271 3465 3272 friction->gravity=matpar->GetG(); 3466 3273 friction->rho_ice=matpar->GetRhoIce(); 3467 3274 friction->rho_water=matpar->GetRhoWater(); 3468 friction->K=&this->properties.k[0]; 3469 friction->bed=&this->properties.b[0]; 3470 friction->thickness=&this->properties.h[0]; 3471 friction->velocities=&vxvyvz_list[0][0]; 3472 friction->p=this->properties.p; 3473 friction->q=this->properties.q; 3275 friction->K=&dragcoefficient_list[0]; 3276 friction->bed=&bed_list[0]; 3277 friction->thickness=&thickness_list[0]; 3278 friction->vx=&vx_list[0]; 3279 friction->vy=&vy_list[0]; 3280 friction->p=drag_p; 3281 friction->q=drag_q; 3474 3282 3475 3283 /*Compute alpha2_list: */ … … 3501 3309 3502 3310 /*Get geothermal flux and basal friction */ 3503 GetParameterValue(&geothermalflux_value,&this->properties.geothermalflux[0],gauss_coord);3311 inputs->GetParameterValue(&geothermalflux_value, &gauss_coord[0],GeothermalFluxEnum); 3504 3312 GetParameterValue(&basalfriction,&basalfriction_list[0],gauss_coord); 3505 3313 … … 3527 3335 /*}}}*/ 3528 3336 /*FUNCTION Tria::Du {{{1*/ 3529 void Tria::Du(Vec du_g, void* vinputs,int analysis_type,int sub_analysis_type){3337 void Tria::Du(Vec du_g,int analysis_type,int sub_analysis_type){ 3530 3338 3531 3339 int i; … … 3538 3346 int doflist[numdof]; 3539 3347 int numberofdofspernode; 3540 int dofs2[2]={0,1}; 3541 int dofs1[1]={0}; 3348 double gaussgrids[numgrids][numgrids]={{1,0,0},{0,1,0},{0,0,1}}; 3542 3349 3543 3350 /* grid data: */ 3544 double vxvy_list[numgrids][2];3545 3351 double vx_list[numgrids]; 3546 3352 double vy_list[numgrids]; 3547 double obs_vxvy_list[numgrids][2];3548 3353 double obs_vx_list[numgrids]; 3549 3354 double obs_vy_list[numgrids]; … … 3566 3371 3567 3372 /*element vector : */ 3568 double due_g[numdof] ;3373 double due_g[numdof]={0,0,0,0,0,0}; 3569 3374 double due_g_gaussian[numdof]; 3570 3375 … … 3588 3393 Numpar* numpar=NULL; 3589 3394 3590 ParameterInputs* inputs=NULL;3591 3592 /*recover pointers: */3593 inputs=(ParameterInputs*)vinputs;3594 3595 3395 /*recover objects from hooks: */ 3596 3396 nodes=(Node**)hnodes.deliverp(); … … 3603 3403 GetDofList(&doflist[0],&numberofdofspernode); 3604 3404 3605 /* Set due_g to 0: */3606 for(i=0;i<numdof;i++) due_g[i]=0.0;3607 3608 3405 /* Recover input data: */ 3609 if(!inputs->Recover("fit",&fit)) ISSMERROR(" missing fit input parameter"); 3610 if(!inputs->Recover("velocity_obs",&obs_vxvy_list[0][0],2,dofs2,numgrids,(void**)nodes)){ 3611 ISSMERROR("missing velocity_obs input parameter"); 3612 } 3613 if(fit==3 && !inputs->Recover("surfacearea",&S)){ 3614 ISSMERROR("missing surface area input parameter"); 3615 } 3616 if(!inputs->Recover("velocity",&vxvy_list[0][0],2,dofs2,numgrids,(void**)nodes)){ 3617 ISSMERROR("missing velocity input parameter"); 3618 } 3619 if(!inputs->Recover("weights",&weights_list[0],1,dofs1,numgrids,(void**)nodes)){ 3620 ISSMERROR("missing weights input parameter"); 3621 } 3622 3623 for(i=0;i<numgrids;i++){ 3624 obs_vx_list[i]=obs_vxvy_list[i][0]; 3625 obs_vy_list[i]=obs_vxvy_list[i][1]; 3626 vx_list[i]=vxvy_list[i][0]; 3627 vy_list[i]=vxvy_list[i][1]; 3406 inputs->GetParameterValues(&obs_vx_list[0],&gaussgrids[0][0],3,VxObsEnum); 3407 inputs->GetParameterValues(&obs_vy_list[0],&gaussgrids[0][0],3,VyObsEnum); 3408 3409 inputs->GetParameterValues(&vx_list[0],&gaussgrids[0][0],3,VxEnum); 3410 inputs->GetParameterValues(&vy_list[0],&gaussgrids[0][0],3,VyEnum); 3411 3412 inputs->GetParameterValues(&weights_list[0],&gaussgrids[0][0],3,WeightsEnum); 3413 3414 inputs->GetParameterValue(&fit,FitEnum); 3415 if(fit==3){ 3416 inputs->GetParameterValue(&S,SurfaceAreaEnum); 3628 3417 } 3629 3418 … … 3927 3716 /*}}}*/ 3928 3717 /*FUNCTION Tria::GetBedList {{{1*/ 3929 void Tria::GetBedList(double* bed_list){ 3930 3931 int i; 3932 for(i=0;i<3;i++)bed_list[i]=this->properties.b[i]; 3718 void Tria::GetBedList(double* bedlist){ 3719 3720 const int numgrids=3; 3721 double gaussgrids[numgrids][numgrids]={{1,0,0},{0,1,0},{0,0,1}}; 3722 3723 inputs->GetParameterValues(bedlist,&gaussgrids[0][0],3,BedEnum); 3933 3724 3934 3725 } … … 4296 4087 /*}}}*/ 4297 4088 /*FUNCTION Tria::GetOnBed {{{1*/ 4298 int Tria::GetOnBed(){ 4299 return this->properties.onbed; 4089 bool Tria::GetOnBed(){ 4090 4091 bool onbed; 4092 inputs->GetParameterValue(&onbed,ElementOnBedEnum); 4093 4094 return onbed; 4300 4095 } 4301 4096 /*}}}*/ … … 4344 4139 /*}}}*/ 4345 4140 /*FUNCTION Tria::GetShelf {{{1*/ 4346 int Tria::GetShelf(){ 4347 return this->properties.shelf; 4141 bool Tria::GetShelf(){ 4142 /*inputs: */ 4143 bool shelf; 4144 4145 /*retrieve inputs :*/ 4146 inputs->GetParameterValue(&shelf,ElementOnIceShelfEnum); 4147 4148 return shelf; 4348 4149 } 4349 4150 /*}}}*/ … … 4370 4171 void Tria::GetThicknessList(double* thickness_list){ 4371 4172 4372 int i; 4373 for(i=0;i<3;i++)thickness_list[i]=this->properties.h[i]; 4173 const int numgrids=3; 4174 double gaussgrids[numgrids][numgrids]={{1,0,0},{0,1,0},{0,0,1}}; 4175 inputs->GetParameterValues(thickness_list,&gaussgrids[0][0],3,ThicknessEnum); 4176 4374 4177 } 4375 4178 /*}}}*/ 4376 4179 /*FUNCTION Tria::Gradj {{{1*/ 4377 void Tria::Gradj(Vec grad_g,void* inputs,int analysis_type,int sub_analysis_type,char* control_type){ 4180 void Tria::Gradj(Vec grad_g,int analysis_type,int sub_analysis_type,char* control_type){ 4181 4182 /*inputs: */ 4183 bool onwater; 4184 4185 /*retrieve inputs :*/ 4186 inputs->GetParameterValue(&onwater,ElementOnWaterEnum); 4378 4187 4379 4188 /*If on water, grad = 0: */ 4380 if( this->properties.onwater)return;4189 if(onwater)return; 4381 4190 4382 4191 if (strcmp(control_type,"drag")==0){ 4383 GradjDrag( grad_g, inputs,analysis_type,sub_analysis_type);4192 GradjDrag( grad_g,analysis_type,sub_analysis_type); 4384 4193 } 4385 4194 else if (strcmp(control_type,"B")==0){ 4386 GradjB( grad_g, inputs,analysis_type,sub_analysis_type);4195 GradjB( grad_g,analysis_type,sub_analysis_type); 4387 4196 } 4388 4197 else ISSMERROR("%s%s","control type not supported yet: ",control_type); … … 4390 4199 /*}}}*/ 4391 4200 /*FUNCTION Tria::GradjB{{{1*/ 4392 void Tria::GradjB(Vec grad_g, void* vinputs,int analysis_type,int sub_analysis_type){4201 void Tria::GradjB(Vec grad_g,int analysis_type,int sub_analysis_type){ 4393 4202 4394 4203 int i; … … 4404 4213 4405 4214 /* grid data: */ 4406 double vx_list[numgrids];4407 double vy_list[numgrids];4408 double vxvy_list[numgrids][2];4409 double adjx_list[numgrids];4410 double adjy_list[numgrids];4411 double adjxadjy_list[numgrids][2];4412 4215 double B[numgrids]; 4413 4216 … … 4456 4259 Numpar* numpar=NULL; 4457 4260 4458 ParameterInputs* inputs=NULL;4459 4460 /*recover pointers: */4461 inputs=(ParameterInputs*)vinputs;4462 4463 4261 /*recover objects from hooks: */ 4464 4262 nodes=(Node**)hnodes.deliverp(); … … 4473 4271 /* Set grade_g to 0: */ 4474 4272 for(i=0;i<numgrids;i++) grade_g[i]=0.0; 4475 4476 /* recover input parameters: */4477 inputs->Recover("thickness",&this->properties.h[0],1,dofs,numgrids,(void**)nodes);4478 if(!inputs->Recover("velocity",&vxvy_list[0][0],2,dofs2,numgrids,(void**)nodes)){4479 ISSMERROR("missing velocity input parameter");4480 }4481 if(!inputs->Recover("adjoint",&adjxadjy_list[0][0],2,dofs2,numgrids,(void**)nodes)){4482 ISSMERROR("missing adjoint input parameter");4483 }4484 if(!inputs->Recover("B",&B[0],1,dofs1,numgrids,(void**)nodes)){4485 ISSMERROR("parameter B not found in input");4486 }4487 4488 /*Initialize parameter lists: */4489 for(i=0;i<numgrids;i++){4490 vx_list[i]=vxvy_list[i][0];4491 vy_list[i]=vxvy_list[i][1];4492 adjx_list[i]=adjxadjy_list[i][0];4493 adjy_list[i]=adjxadjy_list[i][1];4494 }4495 4273 4496 4274 /* Get gaussian points and weights (make this a statically initialized list of points? fstd): */ … … 4506 4284 4507 4285 /*Get thickness: */ 4508 GetParameterValue(&thickness, &this->properties.h[0],gauss_l1l2l3);4286 inputs->GetParameterValue(&thickness, gauss_l1l2l3,ThicknessEnum); 4509 4287 4510 4288 /*Get strain rate, if velocity has been supplied: */ 4511 GetStrainRate(&epsilon[0],&vxvy_list[0][0],&xyz_list[0][0],gauss_l1l2l3);4289 inputs->GetStrainRate(&epsilon[0],&xyz_list[0][0],gauss_l1l2l3,VxEnum,VyEnum); 4512 4290 4513 4291 /*Get viscosity complement: */ … … 4515 4293 4516 4294 /*Get dvx, dvy, dadjx and dadjx: */ 4517 GetParameterDerivativeValue(&dvx[0], &vx_list[0],&xyz_list[0][0], gauss_l1l2l3);4518 GetParameterDerivativeValue(&dvy[0], &vy_list[0],&xyz_list[0][0], gauss_l1l2l3);4519 GetParameterDerivativeValue(&dadjx[0], &adjx_list[0],&xyz_list[0][0], gauss_l1l2l3);4520 GetParameterDerivativeValue(&dadjy[0], &adjy_list[0],&xyz_list[0][0], gauss_l1l2l3);4295 inputs->GetParameterDerivativeValue(&dvx[0],&xyz_list[0][0],&gauss_l1l2l3[0],VxEnum); 4296 inputs->GetParameterDerivativeValue(&dvy[0],&xyz_list[0][0],&gauss_l1l2l3[0],VyEnum); 4297 inputs->GetParameterDerivativeValue(&dadjx[0],&xyz_list[0][0],&gauss_l1l2l3[0],AdjointxEnum); 4298 inputs->GetParameterDerivativeValue(&dadjy[0],&xyz_list[0][0],&gauss_l1l2l3[0],AdjointyEnum); 4521 4299 4522 4300 /* Get Jacobian determinant: */ … … 4530 4308 4531 4309 /*Get B derivative: dB/dx */ 4532 GetParameterDerivativeValue(&dB[0], &B[0],&xyz_list[0][0], gauss_l1l2l3);4533 GetParameterValue(&B_gauss, &B[0],gauss_l1l2l3);4310 inputs->GetParameterDerivativeValue(&dB[0],&xyz_list[0][0],&gauss_l1l2l3[0],RheologyBEnum); 4311 inputs->GetParameterValue(&B_gauss, gauss_l1l2l3,RheologyBEnum); 4534 4312 4535 4313 /*Build gradje_g_gaussian vector (actually -dJ/dB): */ … … 4568 4346 /*}}}*/ 4569 4347 /*FUNCTION Tria::GradjDrag {{{1*/ 4570 void Tria::GradjDrag(Vec grad_g, void* vinputs,int analysis_type,int sub_analysis_type){4348 void Tria::GradjDrag(Vec grad_g,int analysis_type,int sub_analysis_type){ 4571 4349 4572 4350 … … 4584 4362 double vx_list[numgrids]; 4585 4363 double vy_list[numgrids]; 4586 double vxvy_list[numgrids][2];4587 4364 double adjx_list[numgrids]; 4588 4365 double adjy_list[numgrids]; 4589 double adjxadjy_list[numgrids][2]; 4366 double thickness_list[numgrids]; 4367 double bed_list[numgrids]; 4368 double dragcoefficient_list[numgrids]; 4369 double drag_p; 4370 double drag_q; 4371 int drag_type; 4590 4372 4591 4373 double drag; 4592 int dofs1[1]={0};4593 int dofs2[2]={0,1};4594 4374 4595 4375 /* gaussian points: */ … … 4601 4381 double gauss_weight; 4602 4382 double gauss_l1l2l3[3]; 4383 double gaussgrids[numgrids][numgrids]={{1,0,0},{0,1,0},{0,0,1}}; 4603 4384 4604 4385 /* parameters: */ … … 4609 4390 4610 4391 /*drag: */ 4611 double pcoeff,qcoeff;4612 4392 double alpha_complement_list[numgrids]; 4613 4393 double alpha_complement; 4614 4394 4615 4395 /*element vector at the gaussian points: */ 4616 double grade_g[numgrids] ;4396 double grade_g[numgrids]={0,0,0}; 4617 4397 double grade_g_gaussian[numgrids]; 4618 4398 … … 4625 4405 /* strain rate: */ 4626 4406 double epsilon[3]; /* epsilon=[exx,eyy,exy];*/ 4407 4408 /*inputs: */ 4409 bool shelf; 4627 4410 4628 4411 /*dynamic objects pointed to by hooks: */ … … 4632 4415 Numpar* numpar=NULL; 4633 4416 4634 ParameterInputs* inputs=NULL;4635 4636 /*recover pointers: */4637 inputs=(ParameterInputs*)vinputs;4638 4639 4417 /*recover objects from hooks: */ 4640 4418 nodes=(Node**)hnodes.deliverp(); … … 4643 4421 numpar=(Numpar*)hnumpar.delivers(); 4644 4422 4423 /*retrieve inputs :*/ 4424 inputs->GetParameterValue(&shelf,ElementOnIceShelfEnum); 4425 4645 4426 /*Get out if shelf*/ 4646 if( this->properties.shelf)return;4427 if(shelf)return; 4647 4428 4648 4429 /* Get node coordinates and dof list: */ … … 4650 4431 GetDofList1(&doflist1[0]); 4651 4432 4652 /* Set grade_g to 0: */ 4653 for(i=0;i<numgrids;i++) grade_g[i]=0.0; 4654 4655 /* recover input parameters: */ 4656 inputs->Recover("drag",&this->properties.k[0],1,dofs1,numgrids,(void**)nodes); 4657 inputs->Recover("bed",&this->properties.b[0],1,dofs1,numgrids,(void**)nodes); 4658 inputs->Recover("thickness",&this->properties.h[0],1,dofs1,numgrids,(void**)nodes); 4659 if(!inputs->Recover("velocity",&vxvy_list[0][0],2,dofs2,numgrids,(void**)nodes)){ 4660 ISSMERROR("missing velocity input parameter"); 4661 } 4662 if(!inputs->Recover("adjoint",&adjxadjy_list[0][0],2,dofs2,numgrids,(void**)nodes)){ 4663 ISSMERROR("missing adjoint input parameter"); 4664 } 4665 4666 /*Initialize parameter lists: */ 4667 for(i=0;i<numgrids;i++){ 4668 vx_list[i]=vxvy_list[i][0]; 4669 vy_list[i]=vxvy_list[i][1]; 4670 adjx_list[i]=adjxadjy_list[i][0]; 4671 adjy_list[i]=adjxadjy_list[i][1]; 4672 } 4433 /*Recover inputs: */ 4434 inputs->GetParameterValues(&vx_list[0],&gaussgrids[0][0],3,VxAverageEnum); 4435 inputs->GetParameterValues(&vy_list[0],&gaussgrids[0][0],3,VyAverageEnum); 4436 inputs->GetParameterValues(&thickness_list[0],&gaussgrids[0][0],3,ThicknessEnum); 4437 inputs->GetParameterValues(&bed_list[0],&gaussgrids[0][0],3,BedEnum); 4438 inputs->GetParameterValues(&dragcoefficient_list[0],&gaussgrids[0][0],3,DragCoefficientEnum); 4439 inputs->GetParameterValue(&drag_p,DragPEnum); 4440 inputs->GetParameterValue(&drag_q,DragQEnum); 4441 inputs->GetParameterValue(&drag_type,DragTypeEnum); 4673 4442 4674 4443 /* Get gaussian points and weights (make this a statically initialized list of points? fstd): */ … … 4684 4453 4685 4454 /*Build alpha_complement_list: */ 4686 if ( !this->properties.shelf && (this->properties.friction_type==2)){4455 if (drag_type==2){ 4687 4456 4688 4457 /*Allocate friction object: */ … … 4693 4462 strcpy(friction->element_type,"2d"); 4694 4463 4464 4695 4465 friction->gravity=matpar->GetG(); 4696 4466 friction->rho_ice=matpar->GetRhoIce(); 4697 4467 friction->rho_water=matpar->GetRhoWater(); 4698 friction->K=&this->properties.k[0]; 4699 friction->bed=&this->properties.b[0]; 4700 friction->thickness=&this->properties.h[0]; 4701 friction->velocities=&vxvy_list[0][0]; 4702 friction->p=this->properties.p; 4703 friction->q=this->properties.q; 4704 4468 friction->K=&dragcoefficient_list[0]; 4469 friction->bed=&bed_list[0]; 4470 friction->thickness=&thickness_list[0]; 4471 friction->vx=&vx_list[0]; 4472 friction->vy=&vy_list[0]; 4473 friction->p=drag_p; 4474 friction->q=drag_q; 4475 4476 4705 4477 if(friction->p!=1) ISSMERROR("non-linear friction not supported yet in control methods!"); 4706 4478 … … 4719 4491 /*Recover alpha_complement and k: */ 4720 4492 GetParameterValue(&alpha_complement, &alpha_complement_list[0],gauss_l1l2l3); 4721 GetParameterValue(&drag, &this->properties.k[0],gauss_l1l2l3);4493 inputs->GetParameterValue(&drag, gauss_l1l2l3,DragCoefficientEnum); 4722 4494 4723 4495 /*recover lambda and mu: */ 4724 GetParameterValue(&lambda, &adjx_list[0],gauss_l1l2l3);4725 GetParameterValue(&mu, &adjy_list[0],gauss_l1l2l3);4496 inputs->GetParameterValue(&lambda, gauss_l1l2l3,AdjointxEnum); 4497 inputs->GetParameterValue(&mu, gauss_l1l2l3,AdjointyEnum); 4726 4498 4727 4499 /*recover vx and vy: */ 4728 GetParameterValue(&vx, &vx_list[0],gauss_l1l2l3);4729 GetParameterValue(&vy, &vy_list[0],gauss_l1l2l3);4500 inputs->GetParameterValue(&vx, gauss_l1l2l3,VxEnum); 4501 inputs->GetParameterValue(&vy, gauss_l1l2l3,VyEnum); 4730 4502 4731 4503 /* Get Jacobian determinant: */ … … 4739 4511 4740 4512 /*Get k derivative: dk/dx */ 4741 GetParameterDerivativeValue(&dk[0], &this->properties.k[0],&xyz_list[0][0], gauss_l1l2l3);4513 inputs->GetParameterDerivativeValue(&dk[0],&xyz_list[0][0],&gauss_l1l2l3[0],DragCoefficientEnum); 4742 4514 4743 4515 /*Build gradje_g_gaussian vector (actually -dJ/ddrag): */ … … 4777 4549 /*}}}*/ 4778 4550 /*FUNCTION Tria::GradjDragStokes {{{1*/ 4779 void Tria::GradjDragStokes(Vec grad_g, void* vinputs,int analysis_type,int sub_analysis_type){4551 void Tria::GradjDragStokes(Vec grad_g,int analysis_type,int sub_analysis_type){ 4780 4552 4781 4553 int i; … … 4837 4609 double epsilon[3]; /* epsilon=[exx,eyy,exy];*/ 4838 4610 4839 ParameterInputs* inputs=NULL; 4611 /*inputs: */ 4612 bool shelf; 4613 int drag_type; 4840 4614 4841 4615 /*dynamic objects pointed to by hooks: */ … … 4845 4619 Numpar* numpar=NULL; 4846 4620 4621 /*retrieve inputs :*/ 4622 inputs->GetParameterValue(&shelf,ElementOnIceShelfEnum); 4623 inputs->GetParameterValue(&drag_type,DragTypeEnum); 4624 4847 4625 /*Get out if shelf*/ 4848 if(this->properties.shelf) return; 4849 4850 /*recover pointers: */ 4851 inputs=(ParameterInputs*)vinputs; 4626 if(shelf)return; 4852 4627 4853 4628 /*recover objects from hooks: */ … … 4897 4672 4898 4673 /*Build alpha_complement_list: */ 4899 if ( !this->properties.shelf && (this->properties.friction_type==2)){4674 if (drag_type==2){ 4900 4675 4901 4676 /*Allocate friction object: */ … … 5080 4855 /*}}}*/ 5081 4856 /*FUNCTION Tria::Misfit {{{1*/ 5082 double Tria::Misfit( void* vinputs,int analysis_type,int sub_analysis_type){4857 double Tria::Misfit(int analysis_type,int sub_analysis_type){ 5083 4858 5084 4859 int i; … … 5127 4902 double fit=-1; 5128 4903 5129 ParameterInputs* inputs=NULL;5130 5131 4904 /*dynamic objects pointed to by hooks: */ 5132 4905 Node** nodes=NULL; … … 5135 4908 Numpar* numpar=NULL; 5136 4909 4910 /*inputs: */ 4911 bool onwater; 4912 4913 /*retrieve inputs :*/ 4914 inputs->GetParameterValue(&onwater,ElementOnWaterEnum); 4915 5137 4916 /*If on water, return 0: */ 5138 if(this->properties.onwater)return 0; 5139 5140 /*recover pointers: */ 5141 inputs=(ParameterInputs*)vinputs; 4917 if(onwater)return 0; 5142 4918 5143 4919 /*recover objects from hooks: */ … … 5329 5105 /*}}}*/ 5330 5106 /*FUNCTION Tria::SurfaceArea {{{1*/ 5331 double Tria::SurfaceArea( void* vinputs,int analysis_type,int sub_analysis_type){5107 double Tria::SurfaceArea(int analysis_type,int sub_analysis_type){ 5332 5108 5333 5109 int i; … … 5346 5122 Node** nodes=NULL; 5347 5123 5124 /*inputs: */ 5125 bool onwater; 5126 5127 /*retrieve inputs :*/ 5128 inputs->GetParameterValue(&onwater,ElementOnWaterEnum); 5129 5348 5130 /*recover objects from hooks: */ 5349 5131 nodes=(Node**)hnodes.deliverp(); 5350 5132 5351 5133 /*If on water, return 0: */ 5352 if( this->properties.onwater)return 0;5134 if(onwater)return 0; 5353 5135 5354 5136 /* Get node coordinates and dof list: */ -
issm/trunk/src/c/objects/Tria.h
r3599 r3612 9 9 class Element; 10 10 class Hook; 11 class ElementProperties;12 11 class DataSet; 12 class Inputs; 13 13 class Node; 14 14 struct IoModel; … … 18 18 #include "./Hook.h" 19 19 #include "./Node.h" 20 #include "./ElementProperties.h"21 20 #include "../ModelProcessorx/IoModel.h" 22 21 #include "../DataSet/DataSet.h" 22 #include "../DataSet/Inputs.h" 23 23 24 24 class Tria: public Element{ … … 33 33 Hook hnumpar; //hook to 1 numpar 34 34 35 ElementProperties properties; 36 DataSet* inputs; 35 Inputs* inputs; 37 36 38 37 public: … … 40 39 /*FUNCTION constructors, destructors {{{1*/ 41 40 Tria(); 42 Tria(int tria_id,int* tria_node_ids, int tria_matice_id, int tria_matpar_id, int tria_numpar_id , ElementProperties* tria_properties);43 Tria(int tria_id,Hook* tria_hnodes, Hook* tria_hmatice, Hook* tria_hmatpar, Hook* tria_hnumpar, ElementProperties* tria_properties,DataSet* tria_inputs);41 Tria(int tria_id,int* tria_node_ids, int tria_matice_id, int tria_matpar_id, int tria_numpar_id); 42 Tria(int tria_id,Hook* tria_hnodes, Hook* tria_hmatice, Hook* tria_hmatpar, Hook* tria_hnumpar, Inputs* tria_inputs); 44 43 Tria(int i, IoModel* iomodel); 45 44 ~Tria(); … … 60 59 /*}}}*/ 61 60 /*FUNCTION element numerical routines {{{1*/ 62 void CreateKMatrix(Mat Kgg, void* inputs,int analysis_type,int sub_analysis_type);63 void CreatePVector(Vec pg, void* inputs,int analysis_type,int sub_analysis_type);61 void CreateKMatrix(Mat Kgg,int analysis_type,int sub_analysis_type); 62 void CreatePVector(Vec pg, int analysis_type,int sub_analysis_type); 64 63 void GetDofList(int* doflist,int* pnumberofdofs); 65 64 void GetDofList1(int* doflist); 66 void CreateKMatrixDiagnosticHoriz(Mat Kgg, void* inputs,int analysis_type,int sub_analysis_type);67 void CreateKMatrixDiagnosticHorizFriction(Mat Kgg, void* inputs,int analysis_type,int sub_analysis_type);68 void CreateKMatrixDiagnosticSurfaceVert(Mat Kgg, void* inputs,int analysis_type,int sub_analysis_type);69 void CreateKMatrixSlopeCompute(Mat Kgg, void* vinputs,int analysis_type,int sub_analysis_type);65 void CreateKMatrixDiagnosticHoriz(Mat Kgg,int analysis_type,int sub_analysis_type); 66 void CreateKMatrixDiagnosticHorizFriction(Mat Kgg,int analysis_type,int sub_analysis_type); 67 void CreateKMatrixDiagnosticSurfaceVert(Mat Kgg,int analysis_type,int sub_analysis_type); 68 void CreateKMatrixSlopeCompute(Mat Kgg,int analysis_type,int sub_analysis_type); 70 69 void GetParameterValue(double* pp, double* plist, double* gauss_l1l2l3); 71 70 void GetParameterDerivativeValue(double* p, double* plist,double* xyz_list, double* gauss_l1l2l3); … … 83 82 void GetJacobianInvert(double* Jinv, double* xyz_list,double* gauss_l1l2l3); 84 83 void GetJacobian(double* J, double* xyz_list,double* gauss_l1l2l3); 85 void Du(Vec du_g, void* inputs,int analysis_type,int sub_analysis_type);86 void Gradj(Vec grad_g, void* inputs,int analysis_type,int sub_analysis_type,char* control_type);87 void GradjDrag(Vec grad_g, void* inputs,int analysis_type,int sub_analysis_type);88 void GradjDragStokes(Vec grad_g, void* inputs,int analysis_type,int sub_analysis_type);84 void Du(Vec du_g,int analysis_type,int sub_analysis_type); 85 void Gradj(Vec grad_g,int analysis_type,int sub_analysis_type,char* control_type); 86 void GradjDrag(Vec grad_g,int analysis_type,int sub_analysis_type); 87 void GradjDragStokes(Vec grad_g,int analysis_type,int sub_analysis_type); 89 88 void SurfaceNormal(double* surface_normal, double xyz_list[3][3]); 90 void GradjB(Vec grad_g, void* inputs,int analysis_type,int sub_analysis_type);91 double Misfit( void* inputs,int analysis_type,int sub_analysis_type);92 double SurfaceArea( void* inputs,int analysis_type,int sub_analysis_type);93 double CostFunction( void* inputs,int analysis_type,int sub_analysis_type);89 void GradjB(Vec grad_g,int analysis_type,int sub_analysis_type); 90 double Misfit(int analysis_type,int sub_analysis_type); 91 double SurfaceArea(int analysis_type,int sub_analysis_type); 92 double CostFunction(int analysis_type,int sub_analysis_type); 94 93 95 void CreatePVectorDiagnosticHoriz(Vec pg, void* inputs,int analysis_type,int sub_analysis_type);96 void CreatePVectorDiagnosticBaseVert(Vec pg, void* inputs,int analysis_type,int sub_analysis_type);97 void CreatePVectorSlopeCompute( Vec pg, void* vinputs,int analysis_type,int sub_analysis_type);94 void CreatePVectorDiagnosticHoriz(Vec pg,int analysis_type,int sub_analysis_type); 95 void CreatePVectorDiagnosticBaseVert(Vec pg,int analysis_type,int sub_analysis_type); 96 void CreatePVectorSlopeCompute( Vec pg, int analysis_type,int sub_analysis_type); 98 97 void* GetMatPar(); 99 intGetShelf();98 bool GetShelf(); 100 99 void GetNodes(void** nodes); 101 int GetOnBed(); 102 100 bool GetOnBed(); 103 101 void GetThicknessList(double* thickness_list); 104 102 void GetBedList(double* bed_list); 105 void ComputeBasalStress(Vec sigma_b, void* inputs,int analysis_type,int sub_analysis_type);106 void ComputePressure(Vec p_g, void* inputs,int analysis_type,int sub_analysis_type);107 void ComputeStrainRate(Vec eps, void* inputs,int analysis_type,int sub_analysis_type);108 void CreateKMatrixThermal(Mat Kgg, void* inputs,int analysis_type,int sub_analysis_type);109 void CreateKMatrixMelting(Mat Kgg, void* inputs,int analysis_type,int sub_analysis_type);110 void CreatePVectorThermalShelf( Vec pg, void* vinputs,int analysis_type,int sub_analysis_type);111 void CreatePVectorThermalSheet( Vec pg, void* vinputs,int analysis_type,int sub_analysis_type);112 void CreateKMatrixPrognostic(Mat Kgg, void* vinputs,int analysis_type,int sub_analysis_type);113 void CreatePVectorPrognostic(Vec pg, void* vinputs,int analysis_type,int sub_analysis_type);114 void CreateKMatrixPrognostic2(Mat Kgg, void* vinputs,int analysis_type,int sub_analysis_type);115 void CreatePVectorPrognostic2(Vec pg, void* vinputs,int analysis_type,int sub_analysis_type);116 void CreateKMatrixBalancedthickness(Mat Kgg, void* vinputs,int analysis_type,int sub_analysis_type);117 void CreatePVectorBalancedthickness(Vec pg, void* vinputs,int analysis_type,int sub_analysis_type);118 void CreateKMatrixBalancedthickness2(Mat Kgg, void* vinputs,int analysis_type,int sub_analysis_type);119 void CreatePVectorBalancedthickness2(Vec pg, void* vinputs,int analysis_type,int sub_analysis_type);120 void CreateKMatrixBalancedvelocities(Mat Kgg, void* vinputs,int analysis_type,int sub_analysis_type);121 void CreatePVectorBalancedvelocities(Vec pg, void* vinputs,int analysis_type,int sub_analysis_type);103 void ComputeBasalStress(Vec sigma_b,int analysis_type,int sub_analysis_type); 104 void ComputePressure(Vec p_g,int analysis_type,int sub_analysis_type); 105 void ComputeStrainRate(Vec eps,int analysis_type,int sub_analysis_type); 106 void CreateKMatrixThermal(Mat Kgg,int analysis_type,int sub_analysis_type); 107 void CreateKMatrixMelting(Mat Kgg,int analysis_type,int sub_analysis_type); 108 void CreatePVectorThermalShelf( Vec pg, int analysis_type,int sub_analysis_type); 109 void CreatePVectorThermalSheet( Vec pg, int analysis_type,int sub_analysis_type); 110 void CreateKMatrixPrognostic(Mat Kgg,int analysis_type,int sub_analysis_type); 111 void CreatePVectorPrognostic(Vec pg,int analysis_type,int sub_analysis_type); 112 void CreateKMatrixPrognostic2(Mat Kgg,int analysis_type,int sub_analysis_type); 113 void CreatePVectorPrognostic2(Vec pg,int analysis_type,int sub_analysis_type); 114 void CreateKMatrixBalancedthickness(Mat Kgg,int analysis_type,int sub_analysis_type); 115 void CreatePVectorBalancedthickness(Vec pg,int analysis_type,int sub_analysis_type); 116 void CreateKMatrixBalancedthickness2(Mat Kgg,int analysis_type,int sub_analysis_type); 117 void CreatePVectorBalancedthickness2(Vec pg,int analysis_type,int sub_analysis_type); 118 void CreateKMatrixBalancedvelocities(Mat Kgg,int analysis_type,int sub_analysis_type); 119 void CreatePVectorBalancedvelocities(Vec pg,int analysis_type,int sub_analysis_type); 122 120 double MassFlux(double* segment,double* ug); 123 121 double GetArea(void); … … 126 124 /*updates:*/ 127 125 void UpdateFromDakota(void* inputs); 128 void UpdateFromInputs(void* inputs);129 126 void UpdateInputs(double* solution, int analysis_type, int sub_analysis_type); 130 127 void UpdateInputsDiagnosticHoriz( double* solution,int analysis_type,int sub_analysis_type); -
issm/trunk/src/c/objects/TriaVertexInput.h
r3599 r3612 3 3 */ 4 4 5 #include "./ Einput.h"5 #include "./Input.h" 6 6 7 7 #ifndef _TRIAVERTEXINPUT_H_ 8 8 #define _TRIAVERTEXINPUT_H_ 9 9 10 class TriaVertexInput: public Einput{10 class TriaVertexInput: public Input{ 11 11 12 12 private: -
issm/trunk/src/c/objects/Vertex.cpp
r3567 r3612 182 182 } 183 183 /*}}}*/ 184 /*FUNCTION UpdateFromInputs {{{2*/185 void Vertex::UpdateFromInputs(void* vinputs){186 187 ParameterInputs* inputs=NULL;188 Vertex* vertex=NULL;189 int dof[1]={0};190 191 vertex=this;192 193 /*Recover parameter inputs: */194 inputs=(ParameterInputs*)vinputs;195 196 /*Update internal data if inputs holds new values: */197 inputs->Recover("x",&x,1,dof,1,(void**)&vertex);198 inputs->Recover("y",&y,1,dof,1,(void**)&vertex);199 inputs->Recover("z",&z,1,dof,1,(void**)&vertex);200 201 }202 /*}}}*/203 184 /*FUNCTION UpdateVertexPosition {{{2*/ 204 185 void Vertex::UpdatePosition(double* thickness,double* bed){ -
issm/trunk/src/c/objects/Vertex.h
r3464 r3612 46 46 int MyRank(); 47 47 void UpdateFromDakota(void* vinputs); 48 void UpdateFromInputs(void* vinputs);49 48 void UpdatePosition(double* thickness,double* bed); 50 49 -
issm/trunk/src/c/objects/objects.h
r3420 r3612 25 25 class NodeSets; 26 26 class Model; 27 class TriaVertexInput; 28 class DoubleInput; 29 class IntInput; 30 class BoolInput; 31 class Input; 27 32 28 33 /*Abstract class: */ … … 50 55 #include "./NodeSets.h" 51 56 #include "./Model.h" 57 #include "./Input.h" 58 #include "./TriaVertexInput.h" 59 #include "./BoolInput.h" 60 #include "./IntInput.h" 61 #include "./DoubleInput.h" 52 62 53 63 /*C objects: */ 54 64 #include "./Contour.h" 55 #include "./ParameterInputs.h"56 #include "./Input.h"57 65 #include "./Friction.h" 58 66 #include "./SolverEnum.h" -
issm/trunk/src/c/parallel/parallel.h
r3588 r3612 10 10 11 11 struct OptArgs; 12 class ParameterInputs;13 12 class FemModel; 14 13 15 void gradjcompute_core(DataSet* results,Model* model , ParameterInputs* inputs);14 void gradjcompute_core(DataSet* results,Model* model); 16 15 17 void diagnostic_core(DataSet* results,Model* model , ParameterInputs* inputs);18 void prognostic_core(DataSet* results,Model* model , ParameterInputs* inputs);19 void prognostic2_core(DataSet* results,Model* model , ParameterInputs* inputs);20 void balancedthickness_core(DataSet* results,Model* model , ParameterInputs* inputs);21 void balancedthickness2_core(DataSet* results,Model* model , ParameterInputs* inputs);22 void balancedvelocities_core(DataSet* results,Model* model , ParameterInputs* inputs);23 void slopecompute_core(DataSet* results,Model* model , ParameterInputs* inputs);24 void control_core(DataSet* results,Model* model , ParameterInputs* inputs);16 void diagnostic_core(DataSet* results,Model* model); 17 void prognostic_core(DataSet* results,Model* model); 18 void prognostic2_core(DataSet* results,Model* model); 19 void balancedthickness_core(DataSet* results,Model* model); 20 void balancedthickness2_core(DataSet* results,Model* model); 21 void balancedvelocities_core(DataSet* results,Model* model); 22 void slopecompute_core(DataSet* results,Model* model); 23 void control_core(DataSet* results,Model* model); 25 24 26 void thermal_core(DataSet* results,Model* model , ParameterInputs* inputs);27 void thermal_core_nonlinear(Vec* ptg,double* pmelting_offset,FemModel* fem, ParameterInputs* inputs,int analysis_type,int sub_analysis_type);25 void thermal_core(DataSet* results,Model* model); 26 void thermal_core_nonlinear(Vec* ptg,double* pmelting_offset,FemModel* fem,int analysis_type,int sub_analysis_type); 28 27 29 void steadystate_core(DataSet* results,Model* model , ParameterInputs* inputs);28 void steadystate_core(DataSet* results,Model* model); 30 29 31 void diagnostic_core_nonlinear(Vec* pug,Mat* pK_ff0,Mat* pK_fs0, DataSet* loads, FemModel* fem, ParameterInputs* inputs,int analysis_type,int sub_analysis_type);32 void diagnostic_core_linear(Vec* ppg,FemModel* fem, ParameterInputs* inputs,int analysis_type,int sub_analysis_type);30 void diagnostic_core_nonlinear(Vec* pug,Mat* pK_ff0,Mat* pK_fs0, DataSet* loads, FemModel* fem,int analysis_type,int sub_analysis_type); 31 void diagnostic_core_linear(Vec* ppg,FemModel* fem,int analysis_type,int sub_analysis_type); 33 32 void convergence(int* pconverged, Mat K_ff,Vec p_f,Vec u_f,Vec u_f_old,DataSet* parameters); 34 33 35 void transient_core(DataSet* results,Model* model , ParameterInputs* inputs);36 void transient_core_2d(DataSet* results,Model* model , ParameterInputs* inputs);37 void transient_core_3d(DataSet* results,Model* model , ParameterInputs* inputs);34 void transient_core(DataSet* results,Model* model); 35 void transient_core_2d(DataSet* results,Model* model); 36 void transient_core_3d(DataSet* results,Model* model); 38 37 39 38 //int GradJOrth(WorkspaceParams* workspaceparams); 40 39 41 int GoldenSearch(double* psearch_scalar,double* pJ,double xa, double xb, double tolerance, int maxiter, double fit,double optscal,double (*f)(double*,double,double,FemModel* ,ParameterInputs*),FemModel* femmodel);40 int GoldenSearch(double* psearch_scalar,double* pJ,double xa, double xb, double tolerance, int maxiter, double fit,double optscal,double (*f)(double*,double,double,FemModel*),FemModel* femmodel); 42 41 43 int BrentSearch(double* psearch_scalar,double* pJ,double xa, double xb, double tolerance, int maxiter, double fit,double optscal,double (*f)(double*,double,double,FemModel* ,ParameterInputs*),FemModel* femmodel);42 int BrentSearch(double* psearch_scalar,double* pJ,double xa, double xb, double tolerance, int maxiter, double fit,double optscal,double (*f)(double*,double,double,FemModel*),FemModel* femmodel); 44 43 45 44 double objectivefunctionC(double search_scalar,OptArgs* optargs); … … 52 51 void WriteLockFile(char* filename); 53 52 54 void ControlInitialization(Model* model , ParameterInputs* inputs);53 void ControlInitialization(Model* model); 55 54 void ControlRestart(Model* model,double* param_g); 56 55 -
issm/trunk/src/m/classes/@model/model.m
r3582 r3612 124 124 md.g=0; 125 125 md.yts=0; 126 md.drag=NaN;127 126 md.drag_type=0; 128 md.p=NaN; 129 md.q=NaN; 130 md.B=NaN; 131 md.n=NaN; 127 md.drag_coefficient=NaN; 128 md.drag_p=NaN; 129 md.drag_q=NaN; 130 md.rheology_B=NaN; 131 md.rheology_n=NaN; 132 132 133 133 %Geometrical parameters … … 160 160 md.vel_bal=NaN; 161 161 md.vel_obs_raw=NaN; 162 md.accumulation =NaN;162 md.accumulation_rate=NaN; 163 163 md.dhdt=NaN; 164 164 md.geothermalflux=NaN; … … 237 237 md.vel=NaN; 238 238 md.temperature=NaN; %temperature solution vector 239 md.melting =NaN;239 md.melting_rate=NaN; 240 240 md.pressure=NaN; 241 241 -
issm/trunk/src/m/classes/public/marshall.m
r3582 r3612 64 64 WriteData(fid,md.pressure,'Mat','pressure'); 65 65 WriteData(fid,md.temperature,'Mat','temperature'); 66 WriteData(fid,md.melting ,'Mat','melting');66 WriteData(fid,md.melting_rate,'Mat','melting_rate'); 67 67 68 68 69 69 WriteData(fid,md.drag_type,'Integer','drag_type'); 70 WriteData(fid,md.drag ,'Mat','drag');71 WriteData(fid,md. p,'Mat','p');72 WriteData(fid,md. q,'Mat','q');70 WriteData(fid,md.drag_coefficient,'Mat','drag_coefficient'); 71 WriteData(fid,md.drag_p,'Mat','drag_p'); 72 WriteData(fid,md.drag_q,'Mat','drag_q'); 73 73 74 74 WriteData(fid,md.elementoniceshelf,'Mat','elementoniceshelf'); … … 86 86 WriteData(fid,md.geothermalflux,'Mat','geothermalflux'); 87 87 WriteData(fid,md.melting,'Mat','melting'); 88 WriteData(fid,md.accumulation ,'Mat','accumulation');88 WriteData(fid,md.accumulation_rate,'Mat','accumulation_rate'); 89 89 WriteData(fid,md.dhdt,'Mat','dhdt'); 90 90 … … 93 93 WriteData(fid,md.rho_ice,'Scalar','rho_ice'); 94 94 WriteData(fid,md.g,'Scalar','g'); 95 WriteData(fid,md. B,'Mat','B');96 WriteData(fid,md. n,'Mat','n');95 WriteData(fid,md.rheology_B,'Mat','rheology_B'); 96 WriteData(fid,md.rheology_n,'Mat','rheology_n'); 97 97 98 98 %Control methods -
issm/trunk/src/m/enum/AirEnum.m
r3599 r3612 7 7 % macro=AirEnum() 8 8 9 macro= 77;9 macro=80; -
issm/trunk/src/m/enum/DofVecEnum.m
r3599 r3612 7 7 % macro=DofVecEnum() 8 8 9 macro=7 1;9 macro=74; -
issm/trunk/src/m/enum/GeographyEnum.m
r3599 r3612 7 7 % macro=GeographyEnum() 8 8 9 macro=7 2;9 macro=75; -
issm/trunk/src/m/enum/IceEnum.m
r3599 r3612 7 7 % macro=IceEnum() 8 8 9 macro=7 6;9 macro=79; -
issm/trunk/src/m/enum/IceSheetEnum.m
r3599 r3612 7 7 % macro=IceSheetEnum() 8 8 9 macro=7 3;9 macro=76; -
issm/trunk/src/m/enum/IceShelfEnum.m
r3599 r3612 7 7 % macro=IceShelfEnum() 8 8 9 macro=7 4;9 macro=77; -
issm/trunk/src/m/enum/MelangeEnum.m
r3599 r3612 7 7 % macro=MelangeEnum() 8 8 9 macro= 78;9 macro=81; -
issm/trunk/src/m/enum/ParamEnum.m
r3599 r3612 7 7 % macro=ParamEnum() 8 8 9 macro= 67;9 macro=70; -
issm/trunk/src/m/enum/ResultEnum.m
r3599 r3612 7 7 % macro=ResultEnum() 8 8 9 macro= 68;9 macro=71; -
issm/trunk/src/m/enum/RgbEnum.m
r3599 r3612 7 7 % macro=RgbEnum() 8 8 9 macro= 69;9 macro=72; -
issm/trunk/src/m/enum/SpcEnum.m
r3599 r3612 7 7 % macro=SpcEnum() 8 8 9 macro=7 0;9 macro=73; -
issm/trunk/src/m/enum/VxEnum.m
r3599 r3612 7 7 % macro=VxEnum() 8 8 9 macro= 79;9 macro=82; -
issm/trunk/src/m/enum/VyEnum.m
r3599 r3612 7 7 % macro=VyEnum() 8 8 9 macro=8 0;9 macro=83; -
issm/trunk/src/m/enum/WaterEnum.m
r3599 r3612 7 7 % macro=WaterEnum() 8 8 9 macro=7 5;9 macro=78; -
issm/trunk/src/m/solutions/jpl/diagnostic_core_nonlinear.m
r3599 r3612 14 14 converged=0; count=1; 15 15 soln(count).u_g=get(inputs,'velocity',[1 1 (m.parameters.numberofdofspernode>=3) (m.parameters.numberofdofspernode>=3)]); %only keep vz if running with more than 3 dofs per node 16 16 17 soln(count).u_f= Reducevectorgtof(soln(count).u_g,m.nodesets); 17 18 … … 56 57 %Update elements with new solution 57 58 [m.elements]=UpdateInputs(m.elements,m.nodes,m.vertices,loads,m.materials,m.parameters,soln(count).u_g,analysis_type,sub_analysis_type); 58 error;59 59 60 60 %Deal with penalty loads … … 63 63 %penalty constraints 64 64 [loads,constraints_converged,num_unstable_constraints] =PenaltyConstraints( m.elements,m.nodes,m.vertices,loads, m.materials,m.parameters,inputs,analysis_type,sub_analysis_type); 65 error; 65 66 66 67 displaystring(m.parameters.verbose,'%s%i',' number of unstable constraints: ',num_unstable_constraints); -
issm/trunk/src/mex/PenaltyConstraints/PenaltyConstraints.cpp
r3484 r3612 50 50 PenaltyConstraintsx(&converged, &num_unstable_constraints, elements,nodes,vertices, loads,materials,parameters,inputs,analysis_type,sub_analysis_type); 51 51 52 elements->Echo(); 53 mexErrMsgTxt(" "); 54 52 55 /*write output datasets: */ 53 56 WriteData(LOADS,loads);
Note:
See TracChangeset
for help on using the changeset viewer.