Changeset 3383
- Timestamp:
- 04/04/10 23:08:44 (15 years ago)
- Location:
- issm/trunk
- Files:
-
- 6 added
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/etc/environment.sh
r3366 r3383 126 126 #AUTOMAKE 127 127 export AUTOMAKE_DIR 128 PATH="$ PATH:$AUTOMAKE_DIR/bin"128 PATH="$AUTOMAKE_DIR/bin:$PATH" 129 129 130 130 #BORLAND -
issm/trunk/src/c/EnumDefinitions/EnumDefinitions.cpp
r3362 r3383 68 68 int ObjectEnum(void){ return 400; } 69 69 /*Elements: */ 70 int HookEnum(void){ return 409; } 70 71 int ElementEnum(void){ return 410; } 71 72 int TriaEnum(void){ return 411; } 72 int PentaEnum(void){ return 412; } 73 int ElementPropertiesEnum(void){ return 412; } 74 int PentaEnum(void){ return 413; } 73 75 int SingEnum(void){ return 414; } 74 76 int BeamEnum(void){ return 415; } -
issm/trunk/src/c/EnumDefinitions/EnumDefinitions.h
r3362 r3383 69 69 int ObjectEnum(void); 70 70 /*Elements: */ 71 int HookEnum(void); 71 72 int ElementEnum(void); 72 73 int TriaEnum(void); 74 int ElementPropertiesEnum(void); 73 75 int PentaEnum(void); 74 76 int SingEnum(void); -
issm/trunk/src/c/Makefile.am
r3373 r3383 31 31 ./objects/Element.h\ 32 32 ./objects/Element.cpp\ 33 ./objects/ElementProperties.h\ 34 ./objects/ElementProperties.cpp\ 33 35 ./objects/Model.h\ 34 36 ./objects/Model.cpp\ … … 52 54 ./objects/Node.h\ 53 55 ./objects/Node.cpp\ 56 ./objects/Hook.h\ 57 ./objects/Hook.cpp\ 54 58 ./objects/Result.h\ 55 59 ./objects/Result.cpp\ … … 419 423 ./objects/Element.h\ 420 424 ./objects/Element.cpp\ 425 ./objects/ElementProperties.h\ 426 ./objects/ElementProperties.cpp\ 421 427 ./objects/Model.h\ 422 428 ./objects/Model.cpp\ … … 440 446 ./objects/Node.h\ 441 447 ./objects/Node.cpp\ 448 ./objects/Hook.h\ 449 ./objects/Hook.cpp\ 442 450 ./objects/Result.h\ 443 451 ./objects/Result.cpp\ -
issm/trunk/src/c/ModelProcessorx/Balancedthickness/CreateElementsNodesAndMaterialsBalancedthickness.cpp
r3332 r3383 8 8 #include "../../objects/objects.h" 9 9 #include "../../shared/shared.h" 10 #include "../../include/typedefs.h" 10 11 #include "../../MeshPartitionx/MeshPartitionx.h" 11 12 #include "../IoModel.h" … … 33 34 Matice* matice = NULL; 34 35 Matpar* matpar = NULL; 36 ElementProperties* tria_properties=NULL; 37 ElementProperties* penta_properties=NULL; 35 38 36 39 /*output: */ … … 47 50 /*tria constructor input: */ 48 51 int tria_id; 49 int tria_m id;50 int tria_m parid;51 int tria_numpar id;52 int tria_ g[3];52 int tria_matice_id; 53 int tria_matpar_id; 54 int tria_numpar_id; 55 int tria_node_ids[3]; 53 56 double tria_h[3]; 54 57 double tria_s[3]; 55 58 double tria_b[3]; 56 double tria_k[3];57 double tria_melting[3];58 double tria_accumulation[3];59 double tria_geothermalflux[3];60 int tria_friction_type;61 double tria_p;62 double tria_q;63 59 int tria_shelf; 64 60 bool tria_onwater; … … 72 68 73 69 int penta_id; 74 int penta_m id;75 int penta_m parid;76 int penta_numpar id;77 int penta_ g[6];70 int penta_matice_id; 71 int penta_matpar_id; 72 int penta_numpar_id; 73 int penta_node_ids[6]; 78 74 double penta_h[6]; 79 75 double penta_s[6]; 80 76 double penta_b[6]; 81 double penta_k[6];82 int penta_friction_type;83 double penta_p;84 double penta_q;85 77 int penta_shelf; 86 78 int penta_onbed; 87 79 int penta_onsurface; 88 80 int penta_collapse; 89 double penta_melting[6];90 double penta_accumulation[6];91 double penta_geothermalflux[6];92 int penta_thermal_steadystate;93 81 bool penta_onwater; 94 82 … … 190 178 /*ids: */ 191 179 tria_id=i+1; //matlab indexing. 192 tria_m id=-1; //no need for materials193 tria_m parid=-1; //no need for materials194 tria_numpar id=1;180 tria_matice_id=-1; //no need for materials 181 tria_matpar_id=-1; //no need for materials 182 tria_numpar_id=1; 195 183 196 184 /*vertices offsets: */ 197 tria_ g[0]=(int)*(iomodel->elements+elements_width*i+0);198 tria_ g[1]=(int)*(iomodel->elements+elements_width*i+1);199 tria_ g[2]=(int)*(iomodel->elements+elements_width*i+2);185 tria_node_ids[0]=(int)*(iomodel->elements+elements_width*i+0); 186 tria_node_ids[1]=(int)*(iomodel->elements+elements_width*i+1); 187 tria_node_ids[2]=(int)*(iomodel->elements+elements_width*i+2); 200 188 201 189 /*thickness,surface and bed:*/ … … 216 204 tria_onwater=(bool)*(iomodel->elementonwater+i); 217 205 206 /*Create properties: */ 207 tria_properties=new ElementProperties(3,tria_h, tria_s, tria_b, NULL, NULL, NULL, NULL, UNDEF, UNDEF, UNDEF, tria_shelf, UNDEF, tria_onwater, UNDEF, UNDEF, UNDEF); 208 218 209 /*Create tria element using its constructor:*/ 219 tria=new Tria(tria_id, tria_mid, tria_mparid, tria_numparid,tria_g, tria_h, tria_s, tria_b, tria_k, tria_melting,tria_accumulation,tria_geothermalflux,tria_friction_type, tria_p, tria_q, tria_shelf, tria_onwater); 210 tria=new Tria(tria_id, tria_node_ids, tria_matice_id, tria_matpar_id, tria_numpar_id, tria_properties); 211 212 /*Delete properties: */ 213 delete tria_properties; 220 214 221 215 /*Add tria element to elements dataset: */ … … 269 263 /*name and id: */ 270 264 penta_id=i+1; //matlab indexing. 271 penta_m id=-1;272 penta_m parid=-1; //no need for materials273 penta_numpar id=1;265 penta_matice_id=-1; 266 penta_matpar_id=-1; //no need for materials 267 penta_numpar_id=1; 274 268 275 269 /*vertices,thickness,surface,bed and drag: */ 276 270 for(j=0;j<6;j++){ 277 penta_ g[j]=(int)*(iomodel->elements+elements_width*i+j);271 penta_node_ids[j]=(int)*(iomodel->elements+elements_width*i+j); 278 272 penta_h[j]=*(iomodel->thickness+ ((int)*(iomodel->elements+elements_width*i+j)-1)); 279 273 penta_s[j]=*(iomodel->surface+ ((int)*(iomodel->elements+elements_width*i+j)-1)); … … 289 283 290 284 285 /*Create properties: */ 286 penta_properties=new ElementProperties(6,penta_h, penta_s, penta_b, NULL, NULL, NULL, NULL, UNDEF, UNDEF, UNDEF, penta_shelf, penta_onbed, penta_onwater, penta_onsurface, penta_collapse, UNDEF); 287 291 288 /*Create Penta using its constructor:*/ 292 penta= new Penta( penta_id,penta_mid,penta_mparid,penta_numparid,penta_g,penta_h,penta_s,penta_b,penta_k,penta_friction_type,293 penta_p,penta_q,penta_shelf,penta_onbed,penta_onsurface, 294 penta_collapse,penta_melting,penta_accumulation,penta_geothermalflux,295 penta_thermal_steadystate,penta_onwater);289 penta=new Penta(penta_id, penta_node_ids, penta_matice_id, penta_matpar_id, penta_numpar_id, penta_properties); 290 291 /*Delete properties: */ 292 delete penta_properties; 296 293 297 294 /*Add penta element to elements dataset: */ -
issm/trunk/src/c/ModelProcessorx/Balancedvelocities/CreateElementsNodesAndMaterialsBalancedvelocities.cpp
r3332 r3383 9 9 #include "../../shared/shared.h" 10 10 #include "../../MeshPartitionx/MeshPartitionx.h" 11 #include "../../include/typedefs.h" 11 12 #include "../IoModel.h" 12 13 … … 26 27 DataSet* nodes = NULL; 27 28 DataSet* materials = NULL; 29 ElementProperties* tria_properties=NULL; 30 ElementProperties* penta_properties=NULL; 28 31 29 32 /*Objects: */ … … 47 50 /*tria constructor input: */ 48 51 int tria_id; 49 int tria_m id;50 int tria_m parid;51 int tria_numpar id;52 int tria_ g[3];52 int tria_matice_id; 53 int tria_matpar_id; 54 int tria_numpar_id; 55 int tria_node_ids[3]; 53 56 double tria_h[3]; 54 57 double tria_s[3]; 55 58 double tria_b[3]; 56 double tria_k[3];57 double tria_melting[3];58 double tria_accumulation[3];59 double tria_geothermalflux[3];60 int tria_friction_type;61 double tria_p;62 double tria_q;63 59 int tria_shelf; 64 60 bool tria_onwater; … … 72 68 73 69 int penta_id; 74 int penta_m id;75 int penta_m parid;76 int penta_numpar id;77 int penta_ g[6];70 int penta_matice_id; 71 int penta_matpar_id; 72 int penta_numpar_id; 73 int penta_node_ids[6]; 78 74 double penta_h[6]; 79 75 double penta_s[6]; 80 76 double penta_b[6]; 81 double penta_k[6];82 int penta_friction_type;83 double penta_p;84 double penta_q;85 77 int penta_shelf; 86 78 int penta_onbed; 87 79 int penta_onsurface; 88 80 int penta_collapse; 89 double penta_melting[6];90 double penta_accumulation[6];91 double penta_geothermalflux[6];92 int penta_thermal_steadystate;93 81 bool penta_onwater; 94 82 … … 190 178 /*ids: */ 191 179 tria_id=i+1; //matlab indexing. 192 tria_m id=-1; //no need for materials193 tria_m parid=-1; //no need for materials194 tria_numpar id=1;180 tria_matice_id=-1; //no need for materials 181 tria_matpar_id=-1; //no need for materials 182 tria_numpar_id=1; 195 183 196 184 /*vertices offsets: */ 197 tria_ g[0]=(int)*(iomodel->elements+elements_width*i+0);198 tria_ g[1]=(int)*(iomodel->elements+elements_width*i+1);199 tria_ g[2]=(int)*(iomodel->elements+elements_width*i+2);185 tria_node_ids[0]=(int)*(iomodel->elements+elements_width*i+0); 186 tria_node_ids[1]=(int)*(iomodel->elements+elements_width*i+1); 187 tria_node_ids[2]=(int)*(iomodel->elements+elements_width*i+2); 200 188 201 189 /*thickness,surface and bed:*/ … … 216 204 tria_onwater=(bool)*(iomodel->elementonwater+i); 217 205 206 /*Create properties: */ 207 tria_properties=new ElementProperties(3,tria_h, tria_s, tria_b, NULL, NULL, NULL, NULL, UNDEF, UNDEF, UNDEF, tria_shelf, UNDEF, tria_onwater, UNDEF, UNDEF, UNDEF); 208 218 209 /*Create tria element using its constructor:*/ 219 tria=new Tria(tria_id, tria_mid, tria_mparid, tria_numparid,tria_g, tria_h, tria_s, tria_b, tria_k, tria_melting,tria_accumulation,tria_geothermalflux,tria_friction_type, tria_p, tria_q, tria_shelf, tria_onwater); 210 tria=new Tria(tria_id, tria_node_ids, tria_matice_id, tria_matpar_id, tria_numpar_id, tria_properties); 211 212 /*Delete properties: */ 213 delete tria_properties; 220 214 221 215 /*Add tria element to elements dataset: */ … … 269 263 /*name and id: */ 270 264 penta_id=i+1; //matlab indexing. 271 penta_m id=-1;272 penta_m parid=-1; //no need for materials273 penta_numpar id=1;265 penta_matice_id=-1; 266 penta_matpar_id=-1; //no need for materials 267 penta_numpar_id=1; 274 268 275 269 /*vertices,thickness,surface,bed and drag: */ 276 270 for(j=0;j<6;j++){ 277 penta_ g[j]=(int)*(iomodel->elements+elements_width*i+j);271 penta_node_ids[j]=(int)*(iomodel->elements+elements_width*i+j); 278 272 penta_h[j]=*(iomodel->thickness+ ((int)*(iomodel->elements+elements_width*i+j)-1)); 279 273 penta_s[j]=*(iomodel->surface+ ((int)*(iomodel->elements+elements_width*i+j)-1)); … … 288 282 penta_onwater=(bool)*(iomodel->elementonwater+i); 289 283 284 /*Create properties: */ 285 penta_properties=new ElementProperties(6,penta_h, penta_s, penta_b, NULL, NULL, NULL, NULL, UNDEF, UNDEF, UNDEF, penta_shelf, penta_onbed, penta_onwater, penta_onsurface, penta_collapse, UNDEF); 290 286 291 287 /*Create Penta using its constructor:*/ 292 penta= new Penta( penta_id,penta_mid,penta_mparid,penta_numparid,penta_g,penta_h,penta_s,penta_b,penta_k,penta_friction_type,293 penta_p,penta_q,penta_shelf,penta_onbed,penta_onsurface, 294 penta_collapse,penta_melting,penta_accumulation,penta_geothermalflux,295 penta_thermal_steadystate,penta_onwater);288 penta=new Penta(penta_id, penta_node_ids, penta_matice_id, penta_matpar_id, penta_numpar_id, penta_properties); 289 290 /*Delete properties: */ 291 delete penta_properties; 296 292 297 293 /*Add penta element to elements dataset: */ -
issm/trunk/src/c/ModelProcessorx/DiagnosticHoriz/CreateElementsNodesAndMaterialsDiagnosticHoriz.cpp
r3332 r3383 9 9 #include "../../shared/shared.h" 10 10 #include "../../MeshPartitionx/MeshPartitionx.h" 11 #include "../../include/typedefs.h" 11 12 #include "../IoModel.h" 12 13 … … 33 34 Matice* matice = NULL; 34 35 Matpar* matpar = NULL; 36 ElementProperties* tria_properties=NULL; 37 ElementProperties* penta_properties=NULL; 35 38 36 39 /*output: */ … … 47 50 /*tria constructor input: */ 48 51 int tria_id; 49 int tria_m id;50 int tria_m parid;51 int tria_numpar id;52 int tria_ g[3];52 int tria_matice_id; 53 int tria_matpar_id; 54 int tria_numpar_id; 55 int tria_node_ids[3]; 53 56 double tria_h[3]; 54 57 double tria_s[3]; … … 57 60 double tria_melting[3]; 58 61 double tria_accumulation[3]; 59 double tria_geothermalflux[3];60 62 int tria_friction_type; 61 63 double tria_p; … … 71 73 /*penta constructor input: */ 72 74 int penta_id; 73 int penta_m id;74 int penta_m parid;75 int penta_numpar id;76 int penta_ g[6];75 int penta_matice_id; 76 int penta_matpar_id; 77 int penta_numpar_id; 78 int penta_node_ids[6]; 77 79 double penta_h[6]; 78 80 double penta_s[6]; … … 88 90 double penta_melting[6]; 89 91 double penta_accumulation[6]; 90 double penta_geothermalflux[6];91 int penta_thermal_steadystate;92 92 bool penta_onwater; 93 93 … … 218 218 /*ids: */ 219 219 tria_id=i+1; //matlab indexing. 220 tria_m id=i+1; //refers to the corresponding material property card221 tria_m parid=iomodel->numberofelements+1;//refers to the corresponding parmat property card222 tria_numpar id=1;223 224 /*vertices offsets: */225 tria_ g[0]=(int)*(iomodel->elements+elements_width*i+0);226 tria_ g[1]=(int)*(iomodel->elements+elements_width*i+1);227 tria_ g[2]=(int)*(iomodel->elements+elements_width*i+2);220 tria_matice_id=i+1; //refers to the corresponding material property card 221 tria_matpar_id=iomodel->numberofelements+1;//refers to the corresponding parmat property card 222 tria_numpar_id=1; 223 224 /*vertices ids: */ 225 tria_node_ids[0]=(int)*(iomodel->elements+elements_width*i+0); 226 tria_node_ids[1]=(int)*(iomodel->elements+elements_width*i+1); 227 tria_node_ids[2]=(int)*(iomodel->elements+elements_width*i+2); 228 228 229 229 /*thickness,surface and bed:*/ … … 263 263 tria_onwater=(bool)*(iomodel->elementonwater+i); 264 264 265 /*Create properties: */ 266 tria_properties=new ElementProperties(3,tria_h, tria_s, tria_b, tria_k, tria_melting, tria_accumulation, NULL, 267 tria_friction_type, tria_p, tria_q, tria_shelf, UNDEF,tria_onwater, UNDEF,UNDEF,UNDEF); 268 265 269 /*Create tria element using its constructor:*/ 266 tria=new Tria(tria_id, tria_mid, tria_mparid, tria_numparid,tria_g, tria_h, tria_s, tria_b, tria_k, tria_melting,tria_accumulation,tria_geothermalflux,tria_friction_type, tria_p, tria_q, tria_shelf, tria_onwater); 270 tria=new Tria(tria_id, tria_node_ids, tria_matice_id, tria_matpar_id, tria_numpar_id, tria_properties); 271 272 /*delete properties: */ 273 delete tria_properties; 267 274 268 275 /*Add tria element to elements dataset: */ … … 351 358 /*name and id: */ 352 359 penta_id=i+1; //matlab indexing. 353 penta_m id=i+1; //refers to the corresponding material property card354 penta_m parid=iomodel->numberofelements+1;//refers to the corresponding parmat property card355 penta_numpar id=1;360 penta_matice_id=i+1; //refers to the corresponding material property card 361 penta_matpar_id=iomodel->numberofelements+1;//refers to the corresponding parmat property card 362 penta_numpar_id=1; 356 363 357 364 /*vertices,thickness,surface,bed and drag: */ 358 365 for(j=0;j<6;j++){ 359 penta_ g[j]=(int)*(iomodel->elements+elements_width*i+j);366 penta_node_ids[j]=(int)*(iomodel->elements+elements_width*i+j); 360 367 penta_h[j]=*(iomodel->thickness+ ((int)*(iomodel->elements+elements_width*i+j)-1)); 361 368 penta_s[j]=*(iomodel->surface+ ((int)*(iomodel->elements+elements_width*i+j)-1)); … … 385 392 } 386 393 394 /*Create element properties: */ 395 penta_properties=new ElementProperties(6,penta_h, penta_s, penta_b, penta_k, penta_melting, penta_accumulation, NULL, penta_friction_type, penta_p, penta_q, penta_shelf, penta_onbed, penta_onwater, penta_onsurface, penta_collapse, UNDEF); 387 396 388 397 /*Create Penta using its constructor:*/ 389 penta= new Penta( penta_id,penta_mid,penta_mparid,penta_numparid,penta_g,penta_h,penta_s,penta_b,penta_k,penta_friction_type,390 penta_p,penta_q,penta_shelf,penta_onbed,penta_onsurface, 391 penta_collapse,penta_melting,penta_accumulation,penta_geothermalflux,392 penta_thermal_steadystate,penta_onwater);398 penta= new Penta(penta_id,penta_node_ids, penta_matice_id, penta_matpar_id, penta_numpar_id, penta_properties); 399 400 /*delete properties: */ 401 delete penta_properties; 393 402 394 403 /*Add penta element to elements dataset: */ -
issm/trunk/src/c/ModelProcessorx/DiagnosticStokes/CreateElementsNodesAndMaterialsDiagnosticStokes.cpp
r3332 r3383 9 9 #include "../../shared/shared.h" 10 10 #include "../../include/macros.h" 11 #include "../../include/typedefs.h" 11 12 #include "../../MeshPartitionx/MeshPartitionx.h" 12 13 #include "../IoModel.h" … … 32 33 Matice* matice = NULL; 33 34 Matpar* matpar = NULL; 35 ElementProperties* penta_properties=NULL; 34 36 35 37 /*output: */ … … 52 54 53 55 int penta_id; 54 int penta_m id;55 int penta_m parid;56 int penta_numpar id;57 int penta_ g[6];56 int penta_matice_id; 57 int penta_matpar_id; 58 int penta_numpar_id; 59 int penta_node_ids[6]; 58 60 double penta_h[6]; 59 61 double penta_s[6]; … … 69 71 double penta_melting[6]; 70 72 double penta_accumulation[6]; 71 double penta_geothermalflux[6];72 int penta_thermal_steadystate;73 73 bool penta_onwater; 74 74 … … 185 185 /*name and id: */ 186 186 penta_id=i+1; //matlab indexing. 187 penta_m id=i+1; //refers to the corresponding material property card188 penta_m parid=iomodel->numberofelements+1;//refers to the corresponding parmat property card189 penta_numpar id=1;187 penta_matice_id=i+1; //refers to the corresponding material property card 188 penta_matpar_id=iomodel->numberofelements+1;//refers to the corresponding parmat property card 189 penta_numpar_id=1; 190 190 191 191 /*vertices,thickness,surface,bed and drag: */ 192 192 for(j=0;j<6;j++){ 193 penta_ g[j]=(int)*(iomodel->elements+elements_width*i+j);193 penta_node_ids[j]=(int)*(iomodel->elements+elements_width*i+j); 194 194 penta_h[j]=*(iomodel->thickness+ ((int)*(iomodel->elements+elements_width*i+j)-1)); 195 195 penta_s[j]=*(iomodel->surface+ ((int)*(iomodel->elements+elements_width*i+j)-1)); … … 211 211 penta_onsurface=(int)*(iomodel->elementonsurface+i); 212 212 penta_onwater=(bool)*(iomodel->elementonwater+i); 213 penta_collapse=0; 213 214 214 215 if (*(iomodel->elements_type+2*i+1)==StokesFormulationEnum()){ 215 216 217 /*Create properties: */ 218 penta_properties=new ElementProperties(6,penta_h, penta_s, penta_b, penta_k, penta_melting, penta_accumulation, NULL, penta_friction_type, penta_p, penta_q, penta_shelf, penta_onbed, penta_onwater, penta_onsurface, penta_collapse, UNDEF); 219 216 220 /*Create Penta using its constructor:*/ 217 penta= new Penta( penta_id,penta_mid,penta_mparid,penta_numparid,penta_g,penta_h,penta_s,penta_b,penta_k,penta_friction_type,218 penta_p,penta_q,penta_shelf,penta_onbed,penta_onsurface, 219 penta_collapse,penta_melting,penta_accumulation,penta_geothermalflux,220 penta_thermal_steadystate,penta_onwater);221 penta=new Penta(penta_id,penta_node_ids, penta_matice_id, penta_matpar_id, penta_numpar_id, penta_properties); 222 223 /*Delete properties: */ 224 delete penta_properties; 221 225 222 226 /*Add penta element to elements dataset: */ -
issm/trunk/src/c/ModelProcessorx/DiagnosticVert/CreateElementsNodesAndMaterialsDiagnosticVert.cpp
r3332 r3383 10 10 #include "../../shared/shared.h" 11 11 #include "../../MeshPartitionx/MeshPartitionx.h" 12 #include "../../include/typedefs.h" 12 13 #include "../IoModel.h" 13 14 … … 33 34 Matice* matice = NULL; 34 35 Matpar* matpar = NULL; 36 ElementProperties* penta_properties=NULL; 35 37 36 38 /*output: */ … … 53 55 54 56 int penta_id; 55 int penta_m id;56 int penta_m parid;57 int penta_numpar id;58 int penta_ g[6];57 int penta_matice_id; 58 int penta_matpar_id; 59 int penta_numpar_id; 60 int penta_node_ids[6]; 59 61 double penta_h[6]; 60 62 double penta_s[6]; 61 63 double penta_b[6]; 62 double penta_k[6];63 int penta_friction_type;64 double penta_p;65 double penta_q;66 64 int penta_shelf; 67 65 int penta_onbed; … … 70 68 double penta_melting[6]; 71 69 double penta_accumulation[6]; 72 double penta_geothermalflux[6];73 70 int penta_artdiff; 74 int penta_thermal_steadystate;75 71 double penta_viscosity_overshoot; 76 72 double penta_stokesreconditioning; … … 177 173 /*name and id: */ 178 174 penta_id=i+1; //matlab indexing. 179 penta_m id=i+1; //refers to the corresponding material property card180 penta_m parid=iomodel->numberofelements+1;//refers to the corresponding parmat property card181 penta_numpar id=1;175 penta_matice_id=i+1; //refers to the corresponding material property card 176 penta_matpar_id=iomodel->numberofelements+1;//refers to the corresponding parmat property card 177 penta_numpar_id=1; 182 178 183 179 /*vertices,thickness,surface,bed and drag: */ 184 180 for(j=0;j<6;j++){ 185 penta_ g[j]=(int)*(iomodel->elements+elements_width*i+j);181 penta_node_ids[j]=(int)*(iomodel->elements+elements_width*i+j); 186 182 penta_h[j]=*(iomodel->thickness+ ((int)*(iomodel->elements+elements_width*i+j)-1)); 187 183 penta_s[j]=*(iomodel->surface+ ((int)*(iomodel->elements+elements_width*i+j)-1)); … … 198 194 penta_onwater=(bool)*(iomodel->elementonwater+i); 199 195 196 /*Create properties: */ 197 penta_properties=new ElementProperties(6,penta_h, penta_s, penta_b, NULL, penta_melting, penta_accumulation, NULL, UNDEF,UNDEF,UNDEF, penta_shelf, penta_onbed, penta_onwater, penta_onsurface, penta_collapse, UNDEF); 198 200 199 /*Create Penta using its constructor:*/ 201 penta= new Penta( penta_id,penta_mid,penta_mparid,penta_numparid,penta_g,penta_h,penta_s,penta_b,penta_k,penta_friction_type,202 penta_p,penta_q,penta_shelf,penta_onbed,penta_onsurface, 203 penta_collapse,penta_melting,penta_accumulation,penta_geothermalflux,204 penta_thermal_steadystate,penta_onwater);200 penta=new Penta(penta_id,penta_node_ids, penta_matice_id, penta_matpar_id, penta_numpar_id, penta_properties); 201 202 /*delete properties: */ 203 delete penta_properties; 205 204 206 205 /*Add penta element to elements dataset: */ -
issm/trunk/src/c/ModelProcessorx/Melting/CreateElementsNodesAndMaterialsMelting.cpp
r3332 r3383 6 6 #include "../../toolkits/toolkits.h" 7 7 #include "../../EnumDefinitions/EnumDefinitions.h" 8 #include "../../include/typedefs.h" 8 9 #include "../../objects/objects.h" 9 10 #include "../../shared/shared.h" … … 32 33 Matice* matice = NULL; 33 34 Matpar* matpar = NULL; 35 ElementProperties* penta_properties=NULL; 34 36 35 37 /*output: */ … … 52 54 53 55 int penta_id; 54 int penta_m id;55 int penta_m parid;56 int penta_numpar id;57 int penta_ g[6];56 int penta_matice_id; 57 int penta_matpar_id; 58 int penta_numpar_id; 59 int penta_node_ids[6]; 58 60 double penta_h[6]; 59 61 double penta_s[6]; … … 69 71 double penta_melting[6]; 70 72 double penta_accumulation[6]; 71 double penta_geothermalflux[6];72 int penta_thermal_steadystate;73 73 bool penta_onwater; 74 74 … … 165 165 /*name and id: */ 166 166 penta_id=i+1; //matlab indexing. 167 penta_m id=i+1; //refers to the corresponding material property card168 penta_m parid=iomodel->numberofelements+1;//refers to the corresponding parmat property card169 penta_numpar id=1;167 penta_matice_id=i+1; //refers to the corresponding material property card 168 penta_matpar_id=iomodel->numberofelements+1;//refers to the corresponding parmat property card 169 penta_numpar_id=1; 170 170 171 171 /*vertices,thickness,surface,bed and drag: */ 172 172 for(j=0;j<6;j++){ 173 penta_ g[j]=(int)*(iomodel->elements+elements_width*i+j);173 penta_node_ids[j]=(int)*(iomodel->elements+elements_width*i+j); 174 174 penta_h[j]=*(iomodel->thickness+ ((int)*(iomodel->elements+elements_width*i+j)-1)); 175 175 penta_s[j]=*(iomodel->surface+ ((int)*(iomodel->elements+elements_width*i+j)-1)); … … 193 193 penta_collapse=1; 194 194 195 /*Create properties: */ 196 penta_properties=new ElementProperties(6,penta_h, penta_s, penta_b, penta_k, penta_melting, penta_accumulation, NULL, penta_friction_type, penta_p, penta_q, penta_shelf, penta_onbed, penta_onwater, penta_onsurface, penta_collapse, UNDEF); 197 195 198 /*Create Penta using its constructor:*/ 196 penta= new Penta( penta_id,penta_mid,penta_mparid,penta_numparid,penta_g,penta_h,penta_s,penta_b,penta_k,penta_friction_type,197 penta_p,penta_q,penta_shelf,penta_onbed,penta_onsurface, 198 penta_collapse,penta_melting,penta_accumulation,penta_geothermalflux,199 penta_thermal_steadystate,penta_onwater);199 penta=new Penta(penta_id, penta_node_ids, penta_matice_id, penta_matpar_id, penta_numpar_id, penta_properties); 200 201 /*Delete properties: */ 202 delete penta_properties; 200 203 201 204 /*Add penta element to elements dataset: */ -
issm/trunk/src/c/ModelProcessorx/Prognostic/CreateElementsNodesAndMaterialsPrognostic.cpp
r3332 r3383 10 10 #include "../../shared/shared.h" 11 11 #include "../../MeshPartitionx/MeshPartitionx.h" 12 #include "../../include/typedefs.h" 12 13 #include "../IoModel.h" 13 14 … … 34 35 Matice* matice = NULL; 35 36 Matpar* matpar = NULL; 37 ElementProperties* tria_properties=NULL; 38 ElementProperties* penta_properties=NULL; 36 39 37 40 /*output: */ … … 48 51 /*tria constructor input: */ 49 52 int tria_id; 50 int tria_m id;51 int tria_m parid;52 int tria_numpar id;53 int tria_ g[3];53 int tria_matice_id; 54 int tria_matpar_id; 55 int tria_numpar_id; 56 int tria_node_ids[3]; 54 57 double tria_h[3]; 55 58 double tria_s[3]; 56 59 double tria_b[3]; 57 double tria_k[3];58 double tria_melting[3];59 double tria_accumulation[3];60 double tria_geothermalflux[3];61 int tria_friction_type;62 double tria_p;63 double tria_q;64 60 int tria_shelf; 65 61 bool tria_onwater; … … 73 69 74 70 int penta_id; 75 int penta_m id;76 int penta_m parid;77 int penta_numpar id;78 int penta_ g[6];71 int penta_matice_id; 72 int penta_matpar_id; 73 int penta_numpar_id; 74 int penta_node_ids[6]; 79 75 double penta_h[6]; 80 76 double penta_s[6]; 81 77 double penta_b[6]; 82 double penta_k[6];83 int penta_friction_type;84 double penta_p;85 double penta_q;86 78 int penta_shelf; 87 79 int penta_onbed; 88 80 int penta_onsurface; 89 81 int penta_collapse; 90 double penta_melting[6];91 double penta_accumulation[6];92 double penta_geothermalflux[6];93 int penta_thermal_steadystate;94 82 bool penta_onwater; 95 83 … … 191 179 /*ids: */ 192 180 tria_id=i+1; //matlab indexing. 193 tria_m id=-1; //no need for materials194 tria_m parid=-1; //no need for materials195 tria_numpar id=1;181 tria_matice_id=-1; //no need for materials 182 tria_matpar_id=-1; //no need for materials 183 tria_numpar_id=1; 196 184 197 185 /*vertices offsets: */ 198 tria_ g[0]=(int)*(iomodel->elements+elements_width*i+0);199 tria_ g[1]=(int)*(iomodel->elements+elements_width*i+1);200 tria_ g[2]=(int)*(iomodel->elements+elements_width*i+2);186 tria_node_ids[0]=(int)*(iomodel->elements+elements_width*i+0); 187 tria_node_ids[1]=(int)*(iomodel->elements+elements_width*i+1); 188 tria_node_ids[2]=(int)*(iomodel->elements+elements_width*i+2); 201 189 202 190 /*thickness,surface and bed:*/ … … 217 205 tria_onwater=(bool)*(iomodel->elementonwater+i); 218 206 207 /*Create properties: */ 208 tria_properties=new ElementProperties(3,tria_h, tria_s, tria_b, NULL, NULL, NULL, NULL, UNDEF, UNDEF, UNDEF, tria_shelf, UNDEF, tria_onwater, UNDEF, UNDEF, UNDEF); 209 219 210 /*Create tria element using its constructor:*/ 220 tria=new Tria(tria_id, tria_mid, tria_mparid, tria_numparid,tria_g, tria_h, tria_s, tria_b, tria_k, tria_melting,tria_accumulation,tria_geothermalflux,tria_friction_type, tria_p, tria_q, tria_shelf, tria_onwater); 211 tria=new Tria(tria_id, tria_node_ids, tria_matice_id, tria_matpar_id, tria_numpar_id, tria_properties); 212 213 /*Delete properties: */ 214 delete tria_properties; 221 215 222 216 /*Add tria element to elements dataset: */ … … 270 264 /*name and id: */ 271 265 penta_id=i+1; //matlab indexing. 272 penta_m id=-1;273 penta_m parid=-1; //no need for materials274 penta_numpar id=1;266 penta_matice_id=-1; 267 penta_matpar_id=-1; //no need for materials 268 penta_numpar_id=1; 275 269 276 270 /*vertices,thickness,surface,bed and drag: */ 277 271 for(j=0;j<6;j++){ 278 penta_ g[j]=(int)*(iomodel->elements+elements_width*i+j);272 penta_node_ids[j]=(int)*(iomodel->elements+elements_width*i+j); 279 273 penta_h[j]=*(iomodel->thickness+ ((int)*(iomodel->elements+elements_width*i+j)-1)); 280 274 penta_s[j]=*(iomodel->surface+ ((int)*(iomodel->elements+elements_width*i+j)-1)); … … 289 283 penta_onwater=(bool)*(iomodel->elementonwater+i); 290 284 285 /*Create properties: */ 286 penta_properties=new ElementProperties(6,penta_h, penta_s, penta_b, NULL, NULL, NULL, NULL, UNDEF, UNDEF, UNDEF, penta_shelf, penta_onbed, penta_onwater, penta_onsurface, penta_collapse, UNDEF); 291 287 292 288 /*Create Penta using its constructor:*/ 293 penta= new Penta( penta_id,penta_mid,penta_mparid,penta_numparid,penta_g,penta_h,penta_s,penta_b,penta_k,penta_friction_type,294 penta_p,penta_q,penta_shelf,penta_onbed,penta_onsurface, 295 penta_collapse,penta_melting,penta_accumulation,penta_geothermalflux,296 penta_thermal_steadystate,penta_onwater);289 penta=new Penta(penta_id, penta_node_ids, penta_matice_id, penta_matpar_id, penta_numpar_id, penta_properties); 290 291 /*Delete properties: */ 292 delete penta_properties; 297 293 298 294 /*Add penta element to elements dataset: */ -
issm/trunk/src/c/ModelProcessorx/Prognostic2/CreateElementsNodesAndMaterialsPrognostic2.cpp
r3378 r3383 30 30 Matice* matice = NULL; 31 31 Matpar* matpar = NULL; 32 ElementProperties* tria_properties=NULL; 32 33 33 34 /*output: */ … … 43 44 /*tria constructor input: */ 44 45 int tria_id; 45 int tria_m id;46 int tria_m parid;47 int tria_numpar id;48 int tria_ g[3];46 int tria_matice_id; 47 int tria_matpar_id; 48 int tria_numpar_id; 49 int tria_node_ids[3]; 49 50 double tria_h[3]; 50 51 double tria_s[3]; 51 52 double tria_b[3]; 52 double tria_k[3];53 double tria_melting[3];54 double tria_accumulation[3];55 double tria_geothermalflux[3];56 int tria_friction_type;57 double tria_p;58 double tria_q;59 53 int tria_shelf; 60 54 bool tria_onwater; … … 76 70 double penta_b[6]; 77 71 double penta_k[6]; 78 int penta_friction_type;79 72 double penta_p; 80 73 double penta_q; … … 85 78 double penta_melting[6]; 86 79 double penta_accumulation[6]; 87 double penta_geothermalflux[6];88 80 int penta_thermal_steadystate; 89 81 bool penta_onwater; … … 188 180 /*ids: */ 189 181 tria_id=i+1; //matlab indexing. 190 tria_m id=-1; //no need for materials191 tria_m parid=-1; //no need for materials192 tria_numpar id=1;182 tria_matice_id=-1; //no need for materials 183 tria_matpar_id=-1; //no need for materials 184 tria_numpar_id=1; 193 185 194 186 /*vertices offsets: */ 195 tria_ g[0]=3*i+1;196 tria_ g[1]=3*i+2;197 tria_ g[2]=3*i+3;187 tria_node_ids[0]=3*i+1; 188 tria_node_ids[1]=3*i+2; 189 tria_node_ids[2]=3*i+3; 198 190 199 191 /*thickness,surface and bed:*/ … … 214 206 tria_onwater=(bool)*(iomodel->elementonwater+i); 215 207 208 /*Create properties: */ 209 tria_properties=new ElementProperties(3,tria_h, tria_s, tria_b, NULL, NULL, NULL, NULL, UNDEF, UNDEF, UNDEF, tria_shelf, UNDEF, tria_onwater, UNDEF, UNDEF, UNDEF); 210 216 211 /*Create tria element using its constructor:*/ 217 tria=new Tria(tria_id, tria_mid, tria_mparid, tria_numparid,tria_g, tria_h, tria_s, tria_b, tria_k, tria_melting,tria_accumulation,tria_geothermalflux,tria_friction_type, tria_p, tria_q, tria_shelf, tria_onwater); 212 tria=new Tria(tria_id, tria_node_ids, tria_matice_id, tria_matpar_id, tria_numpar_id, tria_properties); 213 214 /*Delete properties: */ 215 delete tria_properties; 218 216 219 217 /*Add tria element to elements dataset: */ -
issm/trunk/src/c/ModelProcessorx/SlopeCompute/CreateElementsNodesAndMaterialsSlopeCompute.cpp
r3332 r3383 9 9 #include "../../objects/objects.h" 10 10 #include "../../shared/shared.h" 11 #include "../../include/typedefs.h" 11 12 #include "../../MeshPartitionx/MeshPartitionx.h" 12 13 #include "../IoModel.h" 13 14 14 15 15 void CreateElementsNodesAndMaterialsSlopeCompute(DataSet** pelements,DataSet** pnodes, DataSet** pmaterials, IoModel* iomodel,ConstDataHandle iomodel_handle){ … … 32 32 Tria* tria = NULL; 33 33 Penta* penta = NULL; 34 ElementProperties* tria_properties=NULL; 35 ElementProperties* penta_properties=NULL; 34 36 35 37 /*output: */ … … 44 46 /*tria constructor input: */ 45 47 int tria_id; 46 int tria_mid; 47 int tria_mparid; 48 int tria_numparid; 49 int tria_g[3]; 50 double tria_h[3]; 48 int tria_matice_id; 49 int tria_matpar_id; 50 int tria_numpar_id; 51 int tria_node_ids[3]; 51 52 double tria_s[3]; 52 53 double tria_b[3]; 53 double tria_k[3];54 double tria_melting[3];55 double tria_accumulation[3];56 double tria_geothermalflux[3];57 int tria_friction_type;58 double tria_p;59 double tria_q;60 int tria_shelf;61 54 bool tria_onwater; 62 55 … … 64 57 65 58 int penta_id; 66 int penta_mid; 67 int penta_mparid; 68 int penta_numparid; 69 int penta_g[6]; 70 double penta_h[6]; 59 int penta_matice_id; 60 int penta_matpar_id; 61 int penta_numpar_id; 62 int penta_node_ids[6]; 71 63 double penta_s[6]; 72 64 double penta_b[6]; 73 double penta_k[6];74 int penta_friction_type;75 double penta_p;76 double penta_q;77 int penta_shelf;78 65 int penta_onbed; 79 int penta_onsurface;80 int penta_collapse;81 double penta_melting[6];82 double penta_accumulation[6];83 double penta_geothermalflux[6];84 int penta_thermal_steadystate;85 66 bool penta_onwater; 86 67 … … 171 152 /*ids: */ 172 153 tria_id=i+1; //matlab indexing. 173 tria_m id=-1; //no materials174 tria_m parid=-1; //no materials175 tria_numpar id=1; //no materials154 tria_matice_id=-1; //no materials 155 tria_matpar_id=-1; //no materials 156 tria_numpar_id=1; //no materials 176 157 177 158 /*vertices offsets: */ 178 tria_ g[0]=(int)*(iomodel->elements+elements_width*i+0);179 tria_ g[1]=(int)*(iomodel->elements+elements_width*i+1);180 tria_ g[2]=(int)*(iomodel->elements+elements_width*i+2);159 tria_node_ids[0]=(int)*(iomodel->elements+elements_width*i+0); 160 tria_node_ids[1]=(int)*(iomodel->elements+elements_width*i+1); 161 tria_node_ids[2]=(int)*(iomodel->elements+elements_width*i+2); 181 162 182 163 /*surface and bed:*/ … … 192 173 tria_onwater=(bool)*(iomodel->elementonwater+i); 193 174 175 /*Create properties: */ 176 tria_properties=new ElementProperties(3,NULL, tria_s, tria_b, NULL, NULL, NULL, NULL, UNDEF, UNDEF, UNDEF, UNDEF, UNDEF, tria_onwater, UNDEF, UNDEF, UNDEF); 177 194 178 /*Create tria element using its constructor:*/ 195 tria=new Tria(tria_id, tria_mid, tria_mparid, tria_numparid,tria_g, tria_h, tria_s, tria_b, tria_k, tria_melting,tria_accumulation,tria_geothermalflux,tria_friction_type, tria_p, tria_q, tria_shelf, tria_onwater); 179 tria=new Tria(tria_id, tria_node_ids, tria_matice_id, tria_matpar_id, tria_numpar_id, tria_properties); 180 181 /*Delete properties: */ 182 delete tria_properties; 196 183 197 184 /*Add tria element to elements dataset: */ … … 240 227 /*name and id: */ 241 228 penta_id=i+1; //matlab indexing. 242 penta_m id=-1; //no materials243 penta_m parid=-1; //no materials244 penta_numpar id=1; //no materials229 penta_matice_id=-1; //no materials 230 penta_matpar_id=-1; //no materials 231 penta_numpar_id=1; //no materials 245 232 246 233 247 234 /*vertices,thickness,surface,bed and drag: */ 248 235 for(j=0;j<6;j++){ 249 penta_ g[j]=(int)*(iomodel->elements+elements_width*i+j);236 penta_node_ids[j]=(int)*(iomodel->elements+elements_width*i+j); 250 237 penta_s[j]=*(iomodel->surface+ ((int)*(iomodel->elements+elements_width*i+j)-1)); 251 238 penta_b[j]=*(iomodel->bed+ ((int)*(iomodel->elements+elements_width*i+j)-1)); … … 256 243 penta_onwater=(bool)*(iomodel->elementonwater+i); 257 244 245 /*Create properties: */ 246 penta_properties=new ElementProperties(6,NULL, penta_s, penta_b, NULL, NULL, NULL, NULL, UNDEF, UNDEF, UNDEF,UNDEF,penta_onbed, penta_onwater, UNDEF, UNDEF, UNDEF); 247 258 248 /*Create Penta using its constructor:*/ 259 penta= new Penta( penta_id,penta_mid,penta_mparid,penta_numparid,penta_g,penta_h,penta_s,penta_b,penta_k,penta_friction_type,260 penta_p,penta_q,penta_shelf,penta_onbed,penta_onsurface, 261 penta_collapse,penta_melting,penta_accumulation,penta_geothermalflux,262 penta_thermal_steadystate,penta_onwater);249 penta=new Penta(penta_id, penta_node_ids, penta_matice_id, penta_matpar_id, penta_numpar_id, penta_properties); 250 251 /*Delete properties: */ 252 delete penta_properties; 263 253 264 254 /*Add penta element to elements dataset: */ 265 255 elements->AddObject(penta); 266 256 267 268 257 #ifdef _PARALLEL_ 269 258 /*Now that we are here, we can also start building the list of grids belonging to this node partition: we use -
issm/trunk/src/c/ModelProcessorx/Thermal/CreateElementsNodesAndMaterialsThermal.cpp
r3332 r3383 7 7 #include "../../EnumDefinitions/EnumDefinitions.h" 8 8 #include "../../objects/objects.h" 9 #include "../../include/typedefs.h" 9 10 #include "../../shared/shared.h" 10 11 #include "../../MeshPartitionx/MeshPartitionx.h" … … 31 32 Matice* matice = NULL; 32 33 Matpar* matpar = NULL; 34 ElementProperties* penta_properties=NULL; 33 35 34 36 /*output: */ … … 51 53 52 54 int penta_id; 53 int penta_m id;54 int penta_m parid;55 int penta_numpar id;56 int penta_ g[6];55 int penta_matice_id; 56 int penta_matpar_id; 57 int penta_numpar_id; 58 int penta_node_ids[6]; 57 59 double penta_h[6]; 58 60 double penta_s[6]; … … 66 68 int penta_onsurface; 67 69 int penta_collapse; 68 double penta_melting[6];69 double penta_accumulation[6];70 70 double penta_geothermalflux[6]; 71 int penta_thermal_steadystate;72 71 bool penta_onwater; 73 72 … … 162 161 /*name and id: */ 163 162 penta_id=i+1; //matlab indexing. 164 penta_m id=i+1; //refers to the corresponding material property card165 penta_m parid=iomodel->numberofelements+1;//refers to the corresponding parmat property card166 penta_numpar id=1;163 penta_matice_id=i+1; //refers to the corresponding material property card 164 penta_matpar_id=iomodel->numberofelements+1;//refers to the corresponding parmat property card 165 penta_numpar_id=1; 167 166 168 167 /*vertices,thickness,surface,bed and drag: */ 169 168 for(j=0;j<6;j++){ 170 penta_ g[j]=(int)*(iomodel->elements+elements_width*i+j);169 penta_node_ids[j]=(int)*(iomodel->elements+elements_width*i+j); 171 170 penta_h[j]=*(iomodel->thickness+ ((int)*(iomodel->elements+elements_width*i+j)-1)); 172 171 penta_s[j]=*(iomodel->surface+ ((int)*(iomodel->elements+elements_width*i+j)-1)); … … 196 195 } 197 196 197 /*Create properties: */ 198 penta_properties=new ElementProperties(6,penta_h, penta_s, penta_b, penta_k, NULL, NULL, penta_geothermalflux, penta_friction_type, penta_p, penta_q, penta_shelf, penta_onbed, penta_onwater, penta_onsurface, penta_collapse, UNDEF); 198 199 199 200 /*Create Penta using its constructor:*/ 200 penta= new Penta( penta_id,penta_mid,penta_mparid,penta_numparid,penta_g,penta_h,penta_s,penta_b,penta_k,penta_friction_type,201 penta_p,penta_q,penta_shelf,penta_onbed,penta_onsurface, 202 penta_collapse,penta_melting,penta_accumulation,penta_geothermalflux,203 penta_thermal_steadystate,penta_onwater);201 penta=new Penta(penta_id, penta_node_ids, penta_matice_id, penta_matpar_id, penta_numpar_id, penta_properties); 202 203 /*Delete properties: */ 204 delete penta_properties; 204 205 205 206 /*Add penta element to elements dataset: */ 206 207 elements->AddObject(penta); 207 208 208 209 209 /*Deal with material:*/ -
issm/trunk/src/c/objects/Penta.cpp
r3332 r3383 18 18 19 19 /*Object constructors and destructor*/ 20 /*FUNCTION Penta constructor {{{1*/20 /*FUNCTION Penta default constructor {{{1*/ 21 21 Penta::Penta(){ 22 22 return; 23 23 } 24 24 /*}}}*/ 25 /*FUNCTION Penta creation {{{1*/ 26 Penta::Penta( int penta_id, int penta_mid, int penta_mparid, int penta_numparid, int penta_node_ids[6], double penta_h[6], double penta_s[6], double penta_b[6], double penta_k[6], int penta_friction_type, 27 double penta_p, double penta_q, int penta_shelf, int penta_onbed, int penta_onsurface, int penta_collapse, double penta_melting[6], double penta_accumulation[6], double penta_geothermalflux[6], 28 int penta_thermal_steadystate,bool penta_onwater){ 29 30 int i; 31 32 id = penta_id; 33 mid = penta_mid; 34 mparid = penta_mparid; 35 numparid=penta_numparid; 36 37 for(i =0;i<6;i++){ 38 node_ids[i] = penta_node_ids[i]; 39 node_offsets[i]=UNDEF; 40 nodes[i]=NULL; 41 h[i] = penta_h[i]; 42 s[i] = penta_s[i]; 43 b[i] = penta_b[i]; 44 k[i] = penta_k[i]; 45 melting[i] = penta_melting[i]; 46 accumulation[i] = penta_accumulation[i] ; 47 geothermalflux[i] = penta_geothermalflux[i]; 48 } 49 matice=NULL; 50 matice_offset=UNDEF; 51 matpar=NULL; 52 matpar_offset=UNDEF; 53 numpar=NULL; 54 numpar_offset=UNDEF; 55 56 friction_type = penta_friction_type; 57 p = penta_p; 58 q = penta_q; 59 shelf = penta_shelf; 60 onbed = penta_onbed; 61 onwater = penta_onwater; 62 onsurface = penta_onsurface; 63 collapse = penta_collapse; 64 thermal_steadystate = penta_thermal_steadystate; 25 /*FUNCTION Penta constructor {{{1*/ 26 Penta::Penta(int penta_id,int* penta_node_ids, int penta_matice_id, int penta_matpar_id, int penta_numpar_id, ElementProperties* pentaproperties): 27 hnodes(penta_node_ids,3), 28 hmatice(&penta_matice_id,1), 29 hmatpar(&penta_matpar_id,1), 30 hnumpar(&penta_numpar_id,1), 31 properties(pentaproperties) 32 { 33 34 /*all the initialization has been done by the initializer, just fill in the id: */ 35 this->id=penta_id; 65 36 66 37 return; … … 91 62 /*marshall Penta data: */ 92 63 memcpy(marshalled_dataset,&id,sizeof(id));marshalled_dataset+=sizeof(id); 93 memcpy(marshalled_dataset,&mid,sizeof(mid));marshalled_dataset+=sizeof(mid); 94 memcpy(marshalled_dataset,&mparid,sizeof(mparid));marshalled_dataset+=sizeof(mparid); 95 memcpy(marshalled_dataset,&node_ids,sizeof(node_ids));marshalled_dataset+=sizeof(node_ids); 96 memcpy(marshalled_dataset,&nodes,sizeof(nodes));marshalled_dataset+=sizeof(nodes); 97 memcpy(marshalled_dataset,&node_offsets,sizeof(node_offsets));marshalled_dataset+=sizeof(node_offsets); 98 memcpy(marshalled_dataset,&matice,sizeof(matice));marshalled_dataset+=sizeof(matice); 99 memcpy(marshalled_dataset,&matice_offset,sizeof(matice_offset));marshalled_dataset+=sizeof(matice_offset); 100 memcpy(marshalled_dataset,&matpar,sizeof(matpar));marshalled_dataset+=sizeof(matpar); 101 memcpy(marshalled_dataset,&matpar_offset,sizeof(matpar_offset));marshalled_dataset+=sizeof(matpar_offset); 102 memcpy(marshalled_dataset,&numparid,sizeof(numparid));marshalled_dataset+=sizeof(numparid); 103 memcpy(marshalled_dataset,&numpar,sizeof(numpar));marshalled_dataset+=sizeof(numpar); 104 memcpy(marshalled_dataset,&numpar_offset,sizeof(numpar_offset));marshalled_dataset+=sizeof(numpar_offset); 105 memcpy(marshalled_dataset,&h,sizeof(h));marshalled_dataset+=sizeof(h); 106 memcpy(marshalled_dataset,&s,sizeof(s));marshalled_dataset+=sizeof(s); 107 memcpy(marshalled_dataset,&b,sizeof(b));marshalled_dataset+=sizeof(b); 108 memcpy(marshalled_dataset,&k,sizeof(k));marshalled_dataset+=sizeof(k); 109 memcpy(marshalled_dataset,&friction_type,sizeof(friction_type));marshalled_dataset+=sizeof(friction_type); 110 memcpy(marshalled_dataset,&p,sizeof(p));marshalled_dataset+=sizeof(p); 111 memcpy(marshalled_dataset,&q,sizeof(q));marshalled_dataset+=sizeof(q); 112 memcpy(marshalled_dataset,&shelf,sizeof(shelf));marshalled_dataset+=sizeof(shelf); 113 memcpy(marshalled_dataset,&onbed,sizeof(onbed));marshalled_dataset+=sizeof(onbed); 114 memcpy(marshalled_dataset,&onwater,sizeof(onwater));marshalled_dataset+=sizeof(onwater); 115 memcpy(marshalled_dataset,&onsurface,sizeof(onsurface));marshalled_dataset+=sizeof(onsurface); 116 memcpy(marshalled_dataset,&collapse,sizeof(collapse));marshalled_dataset+=sizeof(collapse); 117 memcpy(marshalled_dataset,&melting,sizeof(melting));marshalled_dataset+=sizeof(melting); 118 memcpy(marshalled_dataset,&accumulation,sizeof(accumulation));marshalled_dataset+=sizeof(accumulation); 119 memcpy(marshalled_dataset,&geothermalflux,sizeof(geothermalflux));marshalled_dataset+=sizeof(geothermalflux); 120 memcpy(marshalled_dataset,&thermal_steadystate,sizeof(thermal_steadystate));marshalled_dataset+=sizeof(thermal_steadystate); 64 65 /*Marshall hooks: */ 66 hnodes.Marshall(&marshalled_dataset); 67 hmatice.Marshall(&marshalled_dataset); 68 hmatpar.Marshall(&marshalled_dataset); 69 hnumpar.Marshall(&marshalled_dataset); 70 71 /*Marshall properties: */ 72 properties.Marshall(&marshalled_dataset); 121 73 122 74 *pmarshalled_dataset=marshalled_dataset; … … 126 78 /*FUNCTION MarshallSize {{{1*/ 127 79 int Penta::MarshallSize(){ 128 129 return sizeof(id)+ 130 sizeof(mid)+ 131 sizeof(mparid)+ 132 sizeof(node_ids)+ 133 sizeof(nodes)+ 134 sizeof(node_offsets)+ 135 sizeof(matice)+ 136 sizeof(matice_offset)+ 137 sizeof(matpar)+ 138 sizeof(matpar_offset)+ 139 +sizeof(numparid)+ 140 +sizeof(numpar)+ 141 +sizeof(numpar_offset)+ 142 sizeof(h)+ 143 sizeof(s)+ 144 sizeof(b)+ 145 sizeof(k)+ 146 sizeof(friction_type)+ 147 sizeof(p)+ 148 sizeof(q)+ 149 sizeof(shelf)+ 150 sizeof(onbed)+ 151 sizeof(onwater)+ 152 sizeof(onsurface)+ 153 sizeof(collapse)+ 154 sizeof(melting)+ 155 sizeof(accumulation)+ 156 sizeof(geothermalflux)+ 157 sizeof(thermal_steadystate) + 158 sizeof(int); //sizeof(int) for enum type 80 81 return sizeof(id) 82 +hnodes.MarshallSize() 83 +hmatice.MarshallSize() 84 +hmatpar.MarshallSize() 85 +hnumpar.MarshallSize() 86 +properties.MarshallSize() 87 +sizeof(int); //sizeof(int) for enum type 159 88 } 160 89 /*}}}*/ … … 162 91 void Penta::Demarshall(char** pmarshalled_dataset){ 163 92 164 int i;165 93 char* marshalled_dataset=NULL; 94 int i; 166 95 167 96 /*recover marshalled_dataset: */ … … 172 101 173 102 memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id); 174 memcpy(&mid,marshalled_dataset,sizeof(mid));marshalled_dataset+=sizeof(mid); 175 memcpy(&mparid,marshalled_dataset,sizeof(mparid));marshalled_dataset+=sizeof(mparid); 176 memcpy(&node_ids,marshalled_dataset,sizeof(node_ids));marshalled_dataset+=sizeof(node_ids); 177 memcpy(&nodes,marshalled_dataset,sizeof(nodes));marshalled_dataset+=sizeof(nodes); 178 memcpy(&node_offsets,marshalled_dataset,sizeof(node_offsets));marshalled_dataset+=sizeof(node_offsets); 179 memcpy(&matice,marshalled_dataset,sizeof(matice));marshalled_dataset+=sizeof(matice); 180 memcpy(&matice_offset,marshalled_dataset,sizeof(matice_offset));marshalled_dataset+=sizeof(matice_offset); 181 memcpy(&matpar,marshalled_dataset,sizeof(matpar));marshalled_dataset+=sizeof(matpar); 182 memcpy(&matpar_offset,marshalled_dataset,sizeof(matpar_offset));marshalled_dataset+=sizeof(matpar_offset); 183 memcpy(&numparid,marshalled_dataset,sizeof(numparid));marshalled_dataset+=sizeof(numparid); 184 memcpy(&numpar,marshalled_dataset,sizeof(numpar));marshalled_dataset+=sizeof(numpar); 185 memcpy(&numpar_offset,marshalled_dataset,sizeof(numpar_offset));marshalled_dataset+=sizeof(numpar_offset); 186 memcpy(&h,marshalled_dataset,sizeof(h));marshalled_dataset+=sizeof(h); 187 memcpy(&s,marshalled_dataset,sizeof(s));marshalled_dataset+=sizeof(s); 188 memcpy(&b,marshalled_dataset,sizeof(b));marshalled_dataset+=sizeof(b); 189 memcpy(&k,marshalled_dataset,sizeof(k));marshalled_dataset+=sizeof(k); 190 memcpy(&friction_type,marshalled_dataset,sizeof(friction_type));marshalled_dataset+=sizeof(friction_type); 191 memcpy(&p,marshalled_dataset,sizeof(p));marshalled_dataset+=sizeof(p); 192 memcpy(&q,marshalled_dataset,sizeof(q));marshalled_dataset+=sizeof(q); 193 memcpy(&shelf,marshalled_dataset,sizeof(shelf));marshalled_dataset+=sizeof(shelf); 194 memcpy(&onbed,marshalled_dataset,sizeof(onbed));marshalled_dataset+=sizeof(onbed); 195 memcpy(&onwater,marshalled_dataset,sizeof(onwater));marshalled_dataset+=sizeof(onwater); 196 memcpy(&onsurface,marshalled_dataset,sizeof(onsurface));marshalled_dataset+=sizeof(onsurface); 197 memcpy(&collapse,marshalled_dataset,sizeof(collapse));marshalled_dataset+=sizeof(collapse); 198 memcpy(&melting,marshalled_dataset,sizeof(melting));marshalled_dataset+=sizeof(melting); 199 memcpy(&accumulation,marshalled_dataset,sizeof(accumulation));marshalled_dataset+=sizeof(accumulation); 200 memcpy(&geothermalflux,marshalled_dataset,sizeof(geothermalflux));marshalled_dataset+=sizeof(geothermalflux); 201 memcpy(&thermal_steadystate,marshalled_dataset,sizeof(thermal_steadystate));marshalled_dataset+=sizeof(thermal_steadystate); 202 203 /*nodes and materials are not pointing to correct objects anymore:*/ 204 for(i=0;i<6;i++)nodes[i]=NULL; 205 matice=NULL; 206 matpar=NULL; 207 numpar=NULL; 103 104 /*demarshall hooks: */ 105 hnodes.Demarshall(&marshalled_dataset); 106 hmatice.Demarshall(&marshalled_dataset); 107 hmatpar.Demarshall(&marshalled_dataset); 108 hnumpar.Demarshall(&marshalled_dataset); 109 110 /*demarshall properties: */ 111 properties.Demarshall(&marshalled_dataset); 208 112 209 113 /*return: */ 210 114 *pmarshalled_dataset=marshalled_dataset; 211 115 return; 116 } 117 /*}}}*/ 118 119 /*Object processing: */ 120 /*FUNCTION Echo{{{1*/ 121 122 void Penta::Echo(void){ 123 124 printf("Penta:\n"); 125 printf(" id: %i\n",id); 126 hnodes.Echo(); 127 hmatice.Echo(); 128 hmatpar.Echo(); 129 hnumpar.Echo(); 130 properties.Echo(); 131 132 return; 133 } 134 /*}}}*/ 135 /*FUNCTION DeepEcho{{{1*/ 136 137 void Penta::DeepEcho(void){ 138 139 printf("Penta:\n"); 140 printf(" id: %i\n",id); 141 hnodes.DeepEcho(); 142 hmatice.DeepEcho(); 143 hmatpar.DeepEcho(); 144 hnumpar.DeepEcho(); 145 properties.DeepEcho(); 146 147 return; 148 } 149 /*}}}*/ 150 /*FUNCTION Configure {{{1*/ 151 void Penta::Configure(void* ploadsin,void* pnodesin,void* pmaterialsin,void* pparametersin){ 152 153 int i; 154 155 DataSet* loadsin=NULL; 156 DataSet* nodesin=NULL; 157 DataSet* materialsin=NULL; 158 DataSet* parametersin=NULL; 159 160 /*Recover pointers :*/ 161 loadsin=(DataSet*)ploadsin; 162 nodesin=(DataSet*)pnodesin; 163 materialsin=(DataSet*)pmaterialsin; 164 parametersin=(DataSet*)pparametersin; 165 166 /*Take care of hooking up all objects for this element, ie links the objects in the hooks to their respective 167 * datasets, using internal ids and offsets hidden in hooks: */ 168 hnodes.configure(nodesin); 169 hmatice.configure(materialsin); 170 hmatpar.configure(materialsin); 171 hnumpar.configure(parametersin); 172 173 } 174 /*}}}*/ 175 /*FUNCTION SpawnTria {{{1*/ 176 void* Penta::SpawnTria(int g0, int g1, int g2){ 177 178 /*out of grids g0,g1 and g2 from Penta, build a tria element: */ 179 Tria* tria=NULL; 180 int indices[3]; 181 Hook* tria_hnodes=NULL; 182 Hook* tria_hmatice=NULL; 183 Hook* tria_hmatpar=NULL; 184 Hook* tria_hnumpar=NULL; 185 ElementProperties* tria_properties=NULL; 186 187 indices[0]=g0; 188 indices[1]=g1; 189 indices[2]=g2; 190 191 tria_hnodes=this->hnodes.Spawn(indices,3); 192 tria_hmatice=this->hmatice.Spawn(indices,3); 193 tria_hmatpar=this->hmatpar.Spawn(indices,3); 194 tria_hnumpar=this->hnumpar.Spawn(indices,3); 195 tria_properties=(ElementProperties*)this->properties.Spawn(indices,3); 196 197 tria=new Tria(this->id,tria_hnodes,tria_hmatice,tria_hmatpar,tria_hnumpar,tria_properties); 198 199 delete tria_hnodes; 200 delete tria_hmatice; 201 delete tria_hmatpar; 202 delete tria_hnumpar; 203 delete tria_properties; 204 205 return tria; 212 206 } 213 207 /*}}}*/ … … 224 218 double xyz_list[numgrids][3]; 225 219 220 /*dynamic objects pointed to by hooks: */ 221 Node** nodes=NULL; 222 Matpar* matpar=NULL; 223 224 /*recover objects from hooks: */ 225 nodes=(Node**)hnodes.deliverp(); 226 matpar=(Matpar*)hmatpar.delivers(); 227 226 228 /*If on water, skip: */ 227 if( onwater)return;229 if(this->properties.onwater)return; 228 230 229 231 /*Get node data: */ … … 240 242 g=matpar->GetG(); 241 243 for(i=0;i<numgrids;i++){ 242 pressure[i]=rho_ice*g*( s[i]-xyz_list[i][2]);244 pressure[i]=rho_ice*g*(this->properties.s[i]-xyz_list[i][2]); 243 245 } 244 246 245 247 /*plug local pressure values into global pressure vector: */ 246 248 VecSetValues(pg,numgrids,doflist,(const double*)pressure,INSERT_VALUES); 247 248 }249 /*}}}*/250 /*FUNCTION Configure {{{1*/251 void Penta::Configure(void* ploadsin,void* pnodesin,void* pmaterialsin,void* pparametersin){252 253 int i;254 255 DataSet* loadsin=NULL;256 DataSet* nodesin=NULL;257 DataSet* materialsin=NULL;258 DataSet* parametersin=NULL;259 260 /*Recover pointers :*/261 loadsin=(DataSet*)ploadsin;262 nodesin=(DataSet*)pnodesin;263 materialsin=(DataSet*)pmaterialsin;264 parametersin=(DataSet*)pparametersin;265 266 /*Link this element with its nodes, ie find pointers to the nodes in the nodes dataset.: */267 ResolvePointers((Object**)nodes,node_ids,node_offsets,6,nodesin);268 269 /*Same for materials: */270 ResolvePointers((Object**)&matice,&mid,&matice_offset,1,materialsin);271 ResolvePointers((Object**)&matpar,&mparid,&matpar_offset,1,materialsin);272 273 /*Same for numpar: */274 ResolvePointers((Object**)&numpar,&numparid,&numpar_offset,1,parametersin);275 249 276 250 } … … 288 262 289 263 /*If on water, return 0: */ 290 if( onwater)return 0;264 if(this->properties.onwater)return 0; 291 265 292 266 /*Bail out if this element if: 293 267 * -> Non collapsed and not on the surface 294 268 * -> collapsed (2d model) and not on bed) */ 295 if ((! collapse && !onsurface) || (collapse && !onbed)){269 if ((!this->properties.collapse && !this->properties.onsurface) || (this->properties.collapse && !this->properties.onbed)){ 296 270 return 0; 297 271 } 298 else if ( collapse){272 else if (this->properties.collapse){ 299 273 300 274 /*This element should be collapsed into a tria element at its base. Create this tria element, … … 379 353 380 354 /*If on water, skip: */ 381 if( onwater)return;355 if(this->properties.onwater)return; 382 356 383 357 /*Is this element on the bed? :*/ 384 if(! onbed)return;358 if(!this->properties.onbed)return; 385 359 386 360 /*Spawn Tria element from the base of the Penta: */ … … 400 374 401 375 /*If on water, skip: */ 402 if( onwater)return;376 if(this->properties.onwater)return; 403 377 404 378 /*Is this element on the bed? :*/ 405 if(! onbed)return;379 if(!this->properties.onbed)return; 406 380 407 381 /*Spawn Tria element from the base of the Penta: */ … … 498 472 Tria* tria=NULL; 499 473 474 /*dynamic objects pointed to by hooks: */ 475 Node** nodes=NULL; 476 Matice* matice=NULL; 477 Numpar* numpar=NULL; 478 479 /*recover objects from hooks: */ 480 nodes=(Node**)hnodes.deliverp(); 481 matice=(Matice*)hmatice.delivers(); 482 numpar=(Numpar*)hnumpar.delivers(); 483 500 484 /*If on water, skip stiffness: */ 501 if( onwater)return;485 if(this->properties.onwater)return; 502 486 503 487 /*recover pointers: */ … … 509 493 510 494 511 if (( collapse==1) && (onbed==0)){495 if ((this->properties.collapse==1) && (this->properties.onbed==0)){ 512 496 /*This element should be collapsed, but this element is not on the bedrock, therefore all its 513 497 * dofs have already been frozen! Do nothing: */ 514 498 return; 515 499 } 516 else if (( collapse==1) && (onbed==1)){500 else if ((this->properties.collapse==1) && (this->properties.onbed==1)){ 517 501 518 502 /*This element should be collapsed into a tria element at its base. Create this tria element, … … 643 627 644 628 //Deal with 2d friction at the bedrock interface 645 if(( onbed && !shelf)){629 if((this->properties.onbed && !this->properties.shelf)){ 646 630 647 631 /*Build a tria element using the 3 grids of the base of the penta. Then use … … 744 728 ParameterInputs* inputs=NULL; 745 729 730 /*dynamic objects pointed to by hooks: */ 731 Node** nodes=NULL; 732 Matpar* matpar=NULL; 733 Matice* matice=NULL; 734 Numpar* numpar=NULL; 735 746 736 /*If on water, skip stiffness: */ 747 if(onwater)return; 737 if(this->properties.onwater)return; 738 739 /*recover objects from hooks: */ 740 nodes=(Node**)hnodes.deliverp(); 741 matpar=(Matpar*)hmatpar.delivers(); 742 matice=(Matice*)hmatice.delivers(); 743 numpar=(Numpar*)hnumpar.delivers(); 748 744 749 745 /*recover pointers: */ … … 831 827 } 832 828 833 if(( onbed==1) && (shelf==0)){829 if((this->properties.onbed==1) && (this->properties.shelf==0)){ 834 830 835 831 /*Build alpha2_list used by drag stiffness matrix*/ … … 843 839 friction->rho_ice=matpar->GetRhoIce(); 844 840 friction->rho_water=matpar->GetRhoWater(); 845 friction->K=& k[0];846 friction->bed=& b[0];847 friction->thickness=& h[0];841 friction->K=&this->properties.k[0]; 842 friction->bed=&this->properties.b[0]; 843 friction->thickness=&this->properties.h[0]; 848 844 friction->velocities=&vxvyvz_list[0][0]; 849 friction->p= p;850 friction->q= q;845 friction->p=this->properties.p; 846 friction->q=this->properties.q; 851 847 friction->analysis_type=analysis_type; 852 848 … … 926 922 } 927 923 } 928 } //if ( ( onbed==1) && (shelf==0))924 } //if ( (this->properties.onbed==1) && (shelf==0)) 929 925 930 926 /*Reduce the matrix */ … … 990 986 double DL_scalar; 991 987 988 /*dynamic objects pointed to by hooks: */ 989 Node** nodes=NULL; 990 991 /*recover objects from hooks: */ 992 nodes=(Node**)hnodes.deliverp(); 993 992 994 ParameterInputs* inputs=NULL; 993 995 … … 996 998 997 999 /*If on water, skip stiffness: */ 998 if( onwater)return;1000 if(this->properties.onwater)return; 999 1001 1000 1002 /*recover pointers: */ … … 1004 1006 /*If this element is on the surface, we have a dynamic boundary condition that applies, as a stiffness 1005 1007 * matrix: */ 1006 if( onsurface){1008 if(this->properties.onsurface){ 1007 1009 tria=(Tria*)SpawnTria(3,4,5); //nodes 3,4 and 5 are on the surface 1008 1010 tria->CreateKMatrixDiagnosticSurfaceVert(Kgg,inputs, analysis_type,sub_analysis_type); … … 1096 1098 1097 1099 /*If on water, skip: */ 1098 if( onwater)return;1099 1100 if (! onbed){1100 if(this->properties.onwater)return; 1101 1102 if (!this->properties.onbed){ 1101 1103 return; 1102 1104 } … … 1118 1120 1119 1121 /*If on water, skip: */ 1120 if( onwater)return;1122 if(this->properties.onwater)return; 1121 1123 1122 1124 /*Is this element on the bed? :*/ 1123 if(! onbed)return;1125 if(!this->properties.onbed)return; 1124 1126 1125 1127 /*Spawn Tria element from the base of the Penta: */ … … 1139 1141 1140 1142 /*If on water, skip: */ 1141 if( onwater)return;1143 if(this->properties.onwater)return; 1142 1144 1143 1145 /*Is this element on the bed? :*/ 1144 if(! onbed)return;1146 if(!this->properties.onbed)return; 1145 1147 1146 1148 /*Spawn Tria element from the base of the Penta: */ … … 1227 1229 double mixed_layer_capacity,thermal_exchange_velocity; 1228 1230 1231 /*dynamic objects pointed to by hooks: */ 1232 Node** nodes=NULL; 1233 Matpar* matpar=NULL; 1234 Numpar* numpar=NULL; 1235 1229 1236 /*Collapsed formulation: */ 1230 1237 Tria* tria=NULL; … … 1232 1239 1233 1240 /*If on water, skip: */ 1234 if(onwater)return; 1241 if(this->properties.onwater)return; 1242 1243 /*recover objects from hooks: */ 1244 nodes=(Node**)hnodes.deliverp(); 1245 matpar=(Matpar*)hmatpar.delivers(); 1246 numpar=(Numpar*)hnumpar.delivers(); 1235 1247 1236 1248 /*recover pointers: */ … … 1397 1409 1398 1410 //Ice/ocean heat exchange flux on ice shelf base 1399 if( onbed &&shelf){1411 if(this->properties.onbed && this->properties.shelf){ 1400 1412 1401 1413 tria=(Tria*)SpawnTria(0,1,2); //grids 0, 1 and 2 make the new tria. … … 1467 1479 1468 1480 /*If on water, skip: */ 1469 if( onwater)return;1481 if(this->properties.onwater)return; 1470 1482 1471 1483 /*Is this element on the bed? :*/ 1472 if(! onbed)return;1484 if(!this->properties.onbed)return; 1473 1485 1474 1486 /*Spawn Tria element from the base of the Penta: */ … … 1487 1499 1488 1500 /*If on water, skip: */ 1489 if( onwater)return;1501 if(this->properties.onwater)return; 1490 1502 1491 1503 /*Is this element on the bed? :*/ 1492 if(! onbed)return;1504 if(!this->properties.onbed)return; 1493 1505 1494 1506 /*Spawn Tria element from the base of the Penta: */ … … 1545 1557 ParameterInputs* inputs=NULL; 1546 1558 1559 /*dynamic objects pointed to by hooks: */ 1560 Node** nodes=NULL; 1561 Matpar* matpar=NULL; 1562 1547 1563 /*Spawning: */ 1548 1564 Tria* tria=NULL; 1549 1565 1550 1566 /*If on water, skip load: */ 1551 if( onwater)return;1567 if(this->properties.onwater)return; 1552 1568 1553 1569 /*recover pointers: */ 1554 1570 inputs=(ParameterInputs*)vinputs; 1571 1572 /*recover objects from hooks: */ 1573 nodes=(Node**)hnodes.deliverp(); 1574 matpar=(Matpar*)hmatpar.delivers(); 1555 1575 1556 1576 … … 1559 1579 the load vector. */ 1560 1580 1561 if (( collapse==1) && (onbed==0)){1581 if ((this->properties.collapse==1) && (this->properties.onbed==0)){ 1562 1582 /*This element should be collapsed, but this element is not on the bedrock, therefore all its 1563 1583 * dofs have already been frozen! Do nothing: */ 1564 1584 return; 1565 1585 } 1566 else if (( collapse==1) && (onbed==1)){1586 else if ((this->properties.collapse==1) && (this->properties.onbed==1)){ 1567 1587 1568 1588 /*This element should be collapsed into a tria element at its base. Create this tria element, … … 1613 1633 1614 1634 /*Compute thickness at gaussian point: */ 1615 GetParameterValue(&thickness, & h[0],gauss_coord);1635 GetParameterValue(&thickness, &this->properties.h[0],gauss_coord); 1616 1636 1617 1637 /*Compute slope at gaussian point: */ 1618 GetParameterDerivativeValue(&slope[0], & s[0],&xyz_list[0][0], gauss_coord);1638 GetParameterDerivativeValue(&slope[0], &this->properties.s[0],&xyz_list[0][0], gauss_coord); 1619 1639 1620 1640 /* Get Jacobian determinant: */ … … 1640 1660 } //for (ig1=0; ig1<num_area_gauss; ig1++) 1641 1661 1642 } //else if ((collapse==1) && ( onbed==1))1662 } //else if ((collapse==1) && (this->properties.onbed==1)) 1643 1663 1644 1664 /*Add pe_g to global vector pg: */ … … 1723 1743 Tria* tria=NULL; 1724 1744 1745 /*dynamic objects pointed to by hooks: */ 1746 Node** nodes=NULL; 1747 Matpar* matpar=NULL; 1748 Matice* matice=NULL; 1749 Numpar* numpar=NULL; 1750 1725 1751 /*If on water, skip load: */ 1726 if( onwater)return;1752 if(this->properties.onwater)return; 1727 1753 1728 1754 /*recover pointers: */ 1729 1755 inputs=(ParameterInputs*)vinputs; 1756 1757 /*recover objects from hooks: */ 1758 nodes=(Node**)hnodes.deliverp(); 1759 matpar=(Matpar*)hmatpar.delivers(); 1760 matice=(Matice*)hmatice.delivers(); 1761 numpar=(Numpar*)hnumpar.delivers(); 1730 1762 1731 1763 /* Set P_terms to 0: */ … … 1822 1854 1823 1855 /*Deal with 2d friction at the bedrock interface: */ 1824 if ( ( onbed==1) && (shelf==1)){1856 if ( (this->properties.onbed==1) && (this->properties.shelf==1)){ 1825 1857 1826 1858 for(i=0;i<numgrids2d;i++){ … … 1849 1881 1850 1882 /* Get bed at gaussian point */ 1851 GetParameterValue(&bed,& b[0],gauss_coord);1883 GetParameterValue(&bed,&this->properties.b[0],gauss_coord); 1852 1884 1853 1885 /*Get L matrix : */ … … 1870 1902 } 1871 1903 } 1872 } //if ( ( onbed==1) && (shelf==1))1904 } //if ( (this->properties.onbed==1) && (this->properties.shelf==1)) 1873 1905 1874 1906 /*Reduce the matrix */ … … 1942 1974 int dofs2[1]={1}; 1943 1975 1976 /*dynamic objects pointed to by hooks: */ 1977 Node** nodes=NULL; 1978 1944 1979 ParameterInputs* inputs=NULL; 1980 1981 /*recover objects from hooks: */ 1982 nodes=(Node**)hnodes.deliverp(); 1945 1983 1946 1984 /*recover pointers: */ … … 1948 1986 1949 1987 /*If on water, skip: */ 1950 if( onwater)return;1988 if(this->properties.onwater)return; 1951 1989 1952 1990 /*If we are on the bedrock, spawn a tria on the bedrock, and use it to build the 1953 1991 *diagnostic base vertical stifness: */ 1954 if( onbed){1992 if(this->properties.onbed){ 1955 1993 tria=(Tria*)SpawnTria(0,1,2); //nodes 0, 1 and 2 are on the bedrock 1956 1994 tria->CreatePVectorDiagnosticBaseVert(pg,inputs, analysis_type,sub_analysis_type); … … 2049 2087 2050 2088 /*If on water, skip: */ 2051 if( onwater)return;2089 if(this->properties.onwater)return; 2052 2090 2053 2091 /*Is this element on the bed? :*/ 2054 if(! onbed)return;2092 if(!this->properties.onbed)return; 2055 2093 2056 2094 /*Spawn Tria element from the base of the Penta: */ … … 2069 2107 2070 2108 /*If on water, skip: */ 2071 if( onwater)return;2109 if(this->properties.onwater)return; 2072 2110 2073 2111 /*Is this element on the bed? :*/ 2074 if(! onbed)return;2112 if(!this->properties.onbed)return; 2075 2113 2076 2114 /*Spawn Tria element from the base of the Penta: */ … … 2155 2193 ParameterInputs* inputs=NULL; 2156 2194 2195 /*dynamic objects pointed to by hooks: */ 2196 Node** nodes=NULL; 2197 Matpar* matpar=NULL; 2198 Matice* matice=NULL; 2199 2157 2200 /*If on water, skip: */ 2158 if( onwater)return;2201 if(this->properties.onwater)return; 2159 2202 2160 2203 /*recover pointers: */ 2161 2204 inputs=(ParameterInputs*)vinputs; 2205 2206 /*recover objects from hooks: */ 2207 nodes=(Node**)hnodes.deliverp(); 2208 matpar=(Matpar*)hmatpar.delivers(); 2209 matice=(Matice*)hmatice.delivers(); 2162 2210 2163 2211 /* Get node coordinates and dof list: */ … … 2249 2297 2250 2298 /* Ice/ocean heat exchange flux on ice shelf base */ 2251 if( onbed &&shelf){2299 if(this->properties.onbed && this->properties.shelf){ 2252 2300 2253 2301 tria=(Tria*)SpawnTria(0,1,2); //grids 0, 1 and 2 make the new tria. … … 2257 2305 2258 2306 /* Geothermal flux on ice sheet base and basal friction */ 2259 if( onbed && !shelf){2307 if(this->properties.onbed && !this->properties.shelf){ 2260 2308 2261 2309 tria=(Tria*)SpawnTria(0,1,2); //grids 0, 1 and 2 make the new tria. … … 2274 2322 } 2275 2323 /*}}}*/ 2276 /*FUNCTION DeepEcho {{{1*/2277 void Penta::DeepEcho(void){2278 2279 printf("Penta:\n");2280 printf(" id: %i\n",id);2281 printf(" mid: %i\n",mid);2282 printf(" mparid: %i\n",mparid);2283 printf(" numparid: %i\n",numparid);2284 2285 printf(" node_ids=[%i,%i,%i,%i,%i,%i]\n",node_ids[0],node_ids[1],node_ids[2],node_ids[3],node_ids[4],node_ids[5]);2286 printf(" node_offsets=[%i,%i,%i,%i,%i,%i]\n",node_offsets[0],node_offsets[1],node_offsets[2],node_offsets[3],node_offsets[4],node_offsets[5]);2287 printf(" matice_offset=%i\n",matice_offset);2288 printf(" matpar_offset=%i\n",matpar_offset);2289 2290 printf(" h=[%i,%i,%i,%i,%i,%i]\n",h[0],h[1],h[2],h[3],h[4],h[5]);2291 printf(" s=[%i,%i,%i,%i,%i,%i]\n",s[0],s[1],s[2],s[3],s[4],s[5]);2292 printf(" b=[%i,%i,%i,%i,%i,%i]\n",b[0],b[1],b[2],b[3],b[4],b[5]);2293 printf(" k=[%i,%i,%i,%i,%i,%i]\n",k[0],k[1],k[2],k[3],k[4],k[5]);2294 2295 printf(" friction_type: %i\n",friction_type);2296 printf(" p: %g\n",p);2297 printf(" q: %g\n",q);2298 printf(" shelf: %i\n",shelf);2299 printf(" onbed: %i\n",onbed);2300 printf(" onwater: %i\n",onwater);2301 printf(" onsurface: %i\n",onsurface);2302 printf(" collapse: %i\n",collapse);2303 2304 printf(" melting=[%i,%i,%i,%i,%i,%i]\n",melting[0],melting[1],melting[2],melting[3],melting[4],melting[5]);2305 printf(" accumulation=[%i,%i,%i,%i,%i,%i]\n",accumulation[0],accumulation[1],accumulation[2],accumulation[3],accumulation[4],accumulation[5]);2306 printf(" geothermalflux=[%i,%i,%i,%i,%i,%i]\n",geothermalflux[0],geothermalflux[1],geothermalflux[2],geothermalflux[3],geothermalflux[4],geothermalflux[5]);2307 printf(" thermal_steadystate: %i\n",thermal_steadystate);2308 return;2309 }2310 /*}}}*/2311 2324 /*FUNCTION Du {{{1*/ 2312 2325 void Penta::Du(Vec du_g,void* inputs,int analysis_type,int sub_analysis_type){ … … 2316 2329 2317 2330 /*If on water, skip: */ 2318 if( onwater)return;2331 if(this->properties.onwater)return; 2319 2332 2320 2333 /*Bail out if this element if: 2321 2334 * -> Non collapsed and not on the surface 2322 2335 * -> collapsed (2d model) and not on bed) */ 2323 if ((! collapse && !onsurface) || (collapse && !onbed)){2336 if ((!this->properties.collapse && !this->properties.onsurface) || (this->properties.collapse && !this->properties.onbed)){ 2324 2337 return; 2325 2338 } 2326 else if ( collapse){2339 else if (this->properties.collapse){ 2327 2340 2328 2341 /*This element should be collapsed into a tria element at its base. Create this tria element, … … 2342 2355 } 2343 2356 /*}}}*/ 2344 /*FUNCTION Echo {{{1*/2345 void Penta::Echo(void){2346 2347 printf("Penta:\n");2348 printf(" id: %i\n",id);2349 printf(" mid: %i\n",mid);2350 printf(" mparid: %i\n",mparid);2351 printf(" numparid: %i\n",numparid);2352 2353 printf(" node_ids=[%i,%i,%i,%i,%i,%i]\n",node_ids[0],node_ids[1],node_ids[2],node_ids[3],node_ids[4],node_ids[5]);2354 printf(" node_offsets=[%i,%i,%i,%i,%i,%i]\n",node_offsets[0],node_offsets[1],node_offsets[2],node_offsets[3],node_offsets[4],node_offsets[5]);2355 printf(" matice_offset=%i\n",matice_offset);2356 printf(" matpar_offset=%i\n",matpar_offset);2357 2358 printf(" h=[%g,%g,%g,%g,%g,%g]\n",h[0],h[1],h[2],h[3],h[4],h[5]);2359 printf(" s=[%g,%g,%g,%g,%g,%g]\n",s[0],s[1],s[2],s[3],s[4],s[5]);2360 printf(" b=[%g,%g,%g,%g,%g,%g]\n",b[0],b[1],b[2],b[3],b[4],b[5]);2361 printf(" k=[%g,%g,%g,%g,%g,%g]\n",k[0],k[1],k[2],k[3],k[4],k[5]);2362 2363 printf(" friction_type: %i\n",friction_type);2364 printf(" p: %g\n",p);2365 printf(" q: %g\n",q);2366 printf(" shelf: %i\n",shelf);2367 printf(" onbed: %i\n",onbed);2368 printf(" onwater: %i\n",onwater);2369 printf(" onsurface: %i\n",onsurface);2370 printf(" collapse: %i\n",collapse);2371 2372 printf(" melting=[%g,%g,%g,%g,%g,%g]\n",melting[0],melting[1],melting[2],melting[3],melting[4],melting[5]);2373 printf(" accumulation=[%g,%g,%g,%g,%g,%g]\n",accumulation[0],accumulation[1],accumulation[2],accumulation[3],accumulation[4],accumulation[5]);2374 printf(" geothermalflux=[%g,%g,%g,%g,%g,%g]\n",geothermalflux[0],geothermalflux[1],geothermalflux[2],geothermalflux[3],geothermalflux[4],geothermalflux[5]);2375 printf(" thermal_steadystate: %i\n",thermal_steadystate);2376 return;2377 }2378 /*}}}*/2379 2357 /*FUNCTION Enum {{{1*/ 2380 2358 int Penta::Enum(void){ … … 2394 2372 int extrude=0; 2395 2373 2374 /*dynamic objects pointed to by hooks: */ 2375 Node** nodes=NULL; 2376 2377 /*recover objects from hooks: */ 2378 nodes=(Node**)hnodes.deliverp(); 2379 2396 2380 /*Figure out if we should extrude for this element: */ 2397 2381 if (iscollapsed){ 2398 2382 /*From higher level, we are told to extrude only elements that have the collapse flag on: */ 2399 if ( collapse)extrude=1;2383 if (this->properties.collapse)extrude=1; 2400 2384 else extrude=0; 2401 2385 } … … 2407 2391 /*Now, extrusion starts from the bed on, so double check this element is on 2408 2392 * the bedrock: */ 2409 if( onbed==0)extrude=0;2393 if(this->properties.onbed==0)extrude=0; 2410 2394 2411 2395 /*Go on and extrude field: */ … … 2704 2688 2705 2689 int i; 2706 for(i=0;i<6;i++)bed_list[i]= b[i];2690 for(i=0;i<6;i++)bed_list[i]=this->properties.b[i]; 2707 2691 2708 2692 } … … 2970 2954 int numberofdofspernode; 2971 2955 2956 /*dynamic objects pointed to by hooks: */ 2957 Node** nodes=NULL; 2958 2959 /*recover objects from hooks: */ 2960 nodes=(Node**)hnodes.deliverp(); 2961 2972 2962 for(i=0;i<6;i++){ 2973 2963 nodes[i]->GetDofList(&doflist_per_node[0],&numberofdofspernode); … … 2984 2974 /*FUNCTION GetDofList1 {{{1*/ 2985 2975 void Penta::GetDofList1(int* doflist){ 2986 2976 2987 2977 int i; 2978 /*dynamic objects pointed to by hooks: */ 2979 Node** nodes=NULL; 2980 2981 /*recover objects from hooks: */ 2982 nodes=(Node**)hnodes.deliverp(); 2983 2988 2984 for(i=0;i<6;i++){ 2989 2985 doflist[i]=nodes[i]->GetDofList1(); … … 3311 3307 /*FUNCTION GetMatPar {{{1*/ 3312 3308 void* Penta::GetMatPar(){ 3309 3310 /*dynamic objects pointed to by hooks: */ 3311 Matpar* matpar=NULL; 3312 3313 /*recover objects from hooks: */ 3314 matpar=(Matpar*)hmatpar.delivers(); 3315 3313 3316 return matpar; 3314 3317 } … … 3564 3567 /*FUNCTION GetNodes {{{1*/ 3565 3568 void Penta::GetNodes(void** vpnodes){ 3569 3566 3570 int i; 3567 Node** pnodes=(Node**)vpnodes; 3571 Node** pnodes=NULL; 3572 /*dynamic objects pointed to by hooks: */ 3573 Node** nodes=NULL; 3574 3575 /*recover objects from hooks: */ 3576 nodes=(Node**)hnodes.deliverp(); 3577 3578 /*virtual object: */ 3579 pnodes=(Node**)vpnodes; 3568 3580 3569 3581 for(i=0;i<6;i++){ … … 3574 3586 /*FUNCTION GetOnBed {{{1*/ 3575 3587 int Penta::GetOnBed(){ 3576 return onbed;3588 return this->properties.onbed; 3577 3589 } 3578 3590 /*}}}*/ … … 3650 3662 /*FUNCTION GetShelf {{{1*/ 3651 3663 int Penta::GetShelf(){ 3652 return shelf;3664 return this->properties.shelf; 3653 3665 } 3654 3666 /*}}}*/ … … 3753 3765 3754 3766 int i; 3755 for(i=0;i<6;i++)thickness_list[i]= h[i];3767 for(i=0;i<6;i++)thickness_list[i]=this->properties.h[i]; 3756 3768 } 3757 3769 /*}}}*/ … … 3760 3772 3761 3773 /*If on water, skip grad (=0): */ 3762 if( onwater)return;3774 if(this->properties.onwater)return; 3763 3775 3764 3776 if (strcmp(control_type,"drag")==0){ … … 3777 3789 3778 3790 /*If on water, skip: */ 3779 if( onwater)return;3791 if(this->properties.onwater)return; 3780 3792 3781 3793 /*If on shelf, skip: */ 3782 if( shelf)return;3794 if(this->properties.shelf)return; 3783 3795 3784 3796 /*Bail out if this element does not touch the bedrock: */ 3785 if (! onbed) return;3797 if (!this->properties.onbed) return; 3786 3798 3787 3799 if (sub_analysis_type==HorizAnalysisEnum()){ … … 3810 3822 3811 3823 /*If on water, skip: */ 3812 if( onwater)return;3813 3814 if ( collapse){3824 if(this->properties.onwater)return; 3825 3826 if (this->properties.collapse){ 3815 3827 /*Bail out element if collapsed (2d) and not on bed*/ 3816 if (! onbed) return;3828 if (!this->properties.onbed) return; 3817 3829 3818 3830 /*This element should be collapsed into a tria element at its base. Create this tria element, … … 3844 3856 3845 3857 /*If on water, return 0: */ 3846 if( onwater)return 0;3858 if(this->properties.onwater)return 0; 3847 3859 3848 3860 /*Bail out if this element if: 3849 3861 * -> Non collapsed and not on the surface 3850 3862 * -> collapsed (2d model) and not on bed) */ 3851 if ((! collapse && !onsurface) || (collapse && !onbed)){3863 if ((!this->properties.collapse && !this->properties.onsurface) || (this->properties.collapse && !this->properties.onbed)){ 3852 3864 return 0; 3853 3865 } 3854 else if ( collapse){3866 else if (this->properties.collapse){ 3855 3867 3856 3868 /*This element should be collapsed into a tria element at its base. Create this tria element, … … 3964 3976 } 3965 3977 /*}}}*/ 3966 /*FUNCTION SpawnTria {{{1*/3967 void* Penta::SpawnTria(int g0, int g1, int g2){3968 3969 /*out of grids g0,g1 and g2 from Penta, build a tria element: */3970 Tria* tria=NULL;3971 double tria_h[3];3972 double tria_s[3];3973 double tria_b[3];3974 double tria_c[3];3975 double tria_k[3];3976 double tria_melting[3];3977 double tria_accumulation[3];3978 double tria_geothermalflux[3];3979 3980 /*configuration: */3981 int tria_node_ids[3];3982 Node* tria_nodes[3];3983 int tria_node_offsets[3];3984 3985 tria_h[0]=h[g0];3986 tria_h[1]=h[g1];3987 tria_h[2]=h[g2];3988 3989 tria_s[0]=s[g0];3990 tria_s[1]=s[g1];3991 tria_s[2]=s[g2];3992 3993 tria_b[0]=b[g0];3994 tria_b[1]=b[g1];3995 tria_b[2]=b[g2];3996 3997 tria_k[0]=k[g0];3998 tria_k[1]=k[g1];3999 tria_k[2]=k[g2];4000 4001 tria_melting[0]=melting[g0];4002 tria_melting[1]=melting[g1];4003 tria_melting[2]=melting[g2];4004 4005 tria_accumulation[0]=accumulation[g0];4006 tria_accumulation[1]=accumulation[g1];4007 tria_accumulation[2]=accumulation[g2];4008 4009 tria_geothermalflux[0]=geothermalflux[g0];4010 tria_geothermalflux[1]=geothermalflux[g1];4011 tria_geothermalflux[2]=geothermalflux[g2];4012 4013 tria_node_ids[0]=node_ids[g0];4014 tria_node_ids[1]=node_ids[g1];4015 tria_node_ids[2]=node_ids[g2];4016 4017 tria_nodes[0]=nodes[g0];4018 tria_nodes[1]=nodes[g1];4019 tria_nodes[2]=nodes[g2];4020 4021 tria_node_offsets[0]=node_offsets[g0];4022 tria_node_offsets[1]=node_offsets[g1];4023 tria_node_offsets[2]=node_offsets[g2];4024 4025 tria= new Tria(id,mid,mparid,numparid,tria_node_ids,tria_h,tria_s,tria_b,tria_k, tria_melting, tria_accumulation, tria_geothermalflux,friction_type,p,q,shelf,onwater);4026 4027 tria->NodeConfiguration(tria_node_ids,tria_nodes,tria_node_offsets);4028 tria->MaticeConfiguration(matice,matice_offset);4029 tria->MatparConfiguration(matpar,matpar_offset);4030 tria->NumparConfiguration(numpar,numpar_offset);4031 4032 return tria;4033 4034 }4035 /*}}}*/4036 3978 /*FUNCTION UpdateFromInputs {{{1*/ 4037 3979 void Penta::UpdateFromInputs(void* vinputs){ … … 4043 3985 double B_average; 4044 3986 3987 /*dynamic objects pointed to by hooks: */ 3988 Node** nodes=NULL; 3989 Matice* matice=NULL; 3990 4045 3991 ParameterInputs* inputs=NULL; 4046 3992 4047 3993 /*If on water, skip: */ 4048 if(onwater)return; 3994 if(this->properties.onwater)return; 3995 3996 /*recover objects from hooks: */ 3997 nodes=(Node**)hnodes.deliverp(); 3998 matice=(Matice*)hmatice.delivers(); 4049 3999 4050 4000 /*recover pointers: */ … … 4052 4002 4053 4003 /*Update internal data if inputs holds new values: */ 4054 inputs->Recover("thickness",& h[0],1,dofs,6,(void**)nodes);4055 inputs->Recover("surface",& s[0],1,dofs,6,(void**)nodes);4056 inputs->Recover("bed",& b[0],1,dofs,6,(void**)nodes);4057 inputs->Recover("drag",& k[0],1,dofs,6,(void**)nodes);4058 inputs->Recover("melting",& melting[0],1,dofs,6,(void**)nodes);4059 inputs->Recover("accumulation_param",& accumulation[0],1,dofs,6,(void**)nodes);4004 inputs->Recover("thickness",&this->properties.h[0],1,dofs,6,(void**)nodes); 4005 inputs->Recover("surface",&this->properties.s[0],1,dofs,6,(void**)nodes); 4006 inputs->Recover("bed",&this->properties.b[0],1,dofs,6,(void**)nodes); 4007 inputs->Recover("drag",&this->properties.k[0],1,dofs,6,(void**)nodes); 4008 inputs->Recover("melting",&this->properties.melting[0],1,dofs,6,(void**)nodes); 4009 inputs->Recover("accumulation_param",&this->properties.accumulation[0],1,dofs,6,(void**)nodes); 4060 4010 4061 4011 //Update material if necessary 4062 4012 if(inputs->Recover("temperature",&temperature_list[0],1,dofs,6,(void**)nodes)){ 4063 if(matice && ! collapse){4013 if(matice && !this->properties.collapse){ 4064 4014 //B_average=(Paterson(temperature_list[0])+Paterson(temperature_list[1])+Paterson(temperature_list[2]) 4065 4015 // +Paterson(temperature_list[3])+Paterson(temperature_list[4])+Paterson(temperature_list[5]))/6.0; … … 4071 4021 4072 4022 if(inputs->Recover("temperature_average",&temperature_list[0],1,dofs,6,(void**)nodes)){ 4073 if(matice && collapse){4023 if(matice && this->properties.collapse){ 4074 4024 temperature_average=(temperature_list[0]+temperature_list[1]+temperature_list[2]+temperature_list[3]+temperature_list[4]+temperature_list[5])/6.0; 4075 4025 B_average=Paterson(temperature_average); … … 4096 4046 4097 4047 /*If on water, return 0: */ 4098 if( onwater)return 0;4048 if(this->properties.onwater)return 0; 4099 4049 4100 4050 /*Bail out if this element if: 4101 4051 * -> Non collapsed and not on the surface 4102 4052 * -> collapsed (2d model) and not on bed) */ 4103 if ((! collapse && !onsurface) || (collapse && !onbed)){4053 if ((!this->properties.collapse && !this->properties.onsurface) || (this->properties.collapse && !this->properties.onbed)){ 4104 4054 return 0; 4105 4055 } 4106 else if ( collapse){4056 else if (this->properties.collapse){ 4107 4057 4108 4058 /*This element should be collapsed into a tria element at its base. Create this tria element, -
issm/trunk/src/c/objects/Penta.h
r3180 r3383 9 9 #include "./Element.h" 10 10 #include "./Matpar.h" 11 #include "./Numpar.h" 11 12 #include "./Matice.h" 12 13 #include "./Node.h" 13 14 #include "./Tria.h" 15 #include "./Hook.h" 16 #include "./ElementProperties.h" 14 17 #include "./ParameterInputs.h" 18 19 class Numpar; 20 class Node; 21 class Matice; 22 class Matpar; 23 class ElementProperties; 15 24 16 25 class Penta: public Element{ 17 26 18 27 private: 28 19 29 int id; 20 21 /*nodes: */ 22 int node_ids[6]; //node ids 23 Node* nodes[6]; //node pointers 24 int node_offsets[6]; //node offsets in nodes dataset 30 Hook hnodes; //hook to 6 nodes 31 Hook hmatice; //hook to 1 matice 32 Hook hmatpar; //hook to 1 matpar 33 Hook hnumpar; //hook to 1 numpar 25 34 26 /*materials: */ 27 int mid; 28 Matice* matice; 29 int matice_offset; 30 31 int mparid; 32 Matpar* matpar; 33 int matpar_offset; 35 ElementProperties properties; 34 36 35 int numparid;36 Numpar* numpar;37 int numpar_offset;38 39 40 double h[6];41 double s[6];42 double b[6];43 double k[6];44 double melting[6];45 double accumulation[6];46 int friction_type;47 double p;48 double q;49 int shelf;50 int onbed;51 int onsurface;52 bool onwater;53 int collapse;54 double geothermalflux[6];55 int thermal_steadystate;56 57 37 public: 58 38 39 /*FUNCTION constructors, destructors {{{1*/ 59 40 Penta(); 60 Penta( int id, int mid, int mparid, int numparid, int node_ids[6], double h[6], double s[6], double b[6], double k[6], int friction_type, 61 double p, double q, int shelf, int onbed, int onsurface, int collapse, double melting[6], double accumulation[6], double geothermalflux[6], 62 int thermal_steadystate,bool onwater); 41 Penta(int penta_id,int* penta_node_ids, int penta_matice_id, int penta_matpar_id, int penta_numpar_id, ElementProperties* properties); 63 42 ~Penta(); 64 43 /*}}}*/ 44 /*FUNCTION object management {{{1*/ 65 45 void Echo(); 66 46 void DeepEcho(); … … 73 53 int MyRank(); 74 54 void Configure(void* loads,void* nodes,void* materials,void* parameters); 55 /*}}}*/ 56 /*FUNCTION element numerical routines {{{1*/ 75 57 void CreateKMatrix(Mat Kgg,void* inputs,int analysis_type,int sub_analysis_type); 76 58 void CreateKMatrixDiagnosticHoriz( Mat Kgg, void* inputs, int analysis_type,int sub_analysis_type); … … 147 129 void GetPhi(double* phi, double* epsilon, double viscosity); 148 130 double MassFlux(double* segment,double* ug); 131 /*}}}*/ 149 132 150 133 -
issm/trunk/src/c/objects/Tria.cpp
r3359 r3383 11 11 #include "stdio.h" 12 12 #include "./Tria.h" 13 #include "./Hook.h" 13 14 #include <string.h> 14 15 #include "../EnumDefinitions/EnumDefinitions.h" … … 25 26 26 27 /*Object constructors and destructor*/ 28 /*FUNCTION Tria default constructor {{{1*/ 29 Tria::Tria(){ 30 return; 31 } 32 /*}}}*/ 27 33 /*FUNCTION Tria constructor {{{1*/ 28 Tria::Tria(){ 34 Tria::Tria(int tria_id,int* tria_node_ids, int tria_matice_id, int tria_matpar_id, int tria_numpar_id, ElementProperties* triaproperties): 35 hnodes(tria_node_ids,3), 36 hmatice(&tria_matice_id,1), 37 hmatpar(&tria_matpar_id,1), 38 hnumpar(&tria_numpar_id,1), 39 properties(triaproperties) 40 { 41 42 /*all the initialization has been done by the initializer, just fill in the id: */ 43 this->id=tria_id; 44 45 return; 46 } 47 /*}}}*/ 48 /*FUNCTION Tria other constructor {{{1*/ 49 Tria::Tria(int tria_id,Hook* tria_hnodes, Hook* tria_hmatice, Hook* tria_hmatpar, Hook* tria_hnumpar, ElementProperties* tria_properties): 50 hnodes(tria_hnodes), 51 hmatice(tria_hmatice), 52 hmatpar(tria_hmatpar), 53 hnumpar(tria_hnumpar), 54 properties(tria_properties) 55 { 56 57 /*all the initialization has been done by the initializer, just fill in the id: */ 58 this->id=tria_id; 59 29 60 return; 30 61 } … … 35 66 } 36 67 /*}}}*/ 37 /*FUNCTION Tria creation {{{1*/ 38 Tria::Tria(int tria_id,int tria_mid,int tria_mparid,int tria_numparid,int tria_node_ids[3],double tria_h[3],double tria_s[3],double tria_b[3],double tria_k[3],double tria_melting[3], 39 double tria_accumulation[3],double tria_geothermalflux[3],int tria_friction_type,double tria_p,double tria_q,int tria_shelf, bool tria_onwater){ 40 41 int i; 42 43 id=tria_id; 44 mid=tria_mid; 45 mparid=tria_mparid; 46 numparid=tria_numparid; 47 for(i=0;i<3;i++){ 48 node_ids[i]=tria_node_ids[i]; 49 node_offsets[i]=UNDEF; 50 nodes[i]=NULL; 51 h[i]=tria_h[i]; 52 s[i]=tria_s[i]; 53 b[i]=tria_b[i]; 54 k[i]=tria_k[i]; 55 melting[i]=tria_melting[i]; 56 accumulation[i]=tria_accumulation[i]; 57 geothermalflux[i]=tria_geothermalflux[i]; 58 } 59 matice=NULL; 60 matice_offset=UNDEF; 61 matpar=NULL; 62 matpar_offset=UNDEF; 63 numpar=NULL; 64 numpar_offset=UNDEF; 65 friction_type=tria_friction_type; 66 p=tria_p; 67 q=tria_q; 68 shelf=tria_shelf; 69 onbed=1; 70 onwater=tria_onwater; 71 72 return; 73 } 74 /*}}}*/ 75 76 /*Object marshall*/ 68 69 /*Object marshalling*/ 77 70 /*FUNCTION Marshall {{{1*/ 78 71 void Tria::Marshall(char** pmarshalled_dataset){ … … 92 85 /*marshall Tria data: */ 93 86 memcpy(marshalled_dataset,&id,sizeof(id));marshalled_dataset+=sizeof(id); 94 memcpy(marshalled_dataset,&mid,sizeof(mid));marshalled_dataset+=sizeof(mid); 95 memcpy(marshalled_dataset,&mparid,sizeof(mparid));marshalled_dataset+=sizeof(mparid); 96 memcpy(marshalled_dataset,&node_ids,sizeof(node_ids));marshalled_dataset+=sizeof(node_ids); 97 memcpy(marshalled_dataset,&nodes,sizeof(nodes));marshalled_dataset+=sizeof(nodes); 98 memcpy(marshalled_dataset,&node_offsets,sizeof(node_offsets));marshalled_dataset+=sizeof(node_offsets); 99 memcpy(marshalled_dataset,&matice,sizeof(matice));marshalled_dataset+=sizeof(matice); 100 memcpy(marshalled_dataset,&matice_offset,sizeof(matice_offset));marshalled_dataset+=sizeof(matice_offset); 101 memcpy(marshalled_dataset,&matpar,sizeof(matpar));marshalled_dataset+=sizeof(matpar); 102 memcpy(marshalled_dataset,&matpar_offset,sizeof(matpar_offset));marshalled_dataset+=sizeof(matpar_offset); 103 memcpy(marshalled_dataset,&numparid,sizeof(numparid));marshalled_dataset+=sizeof(numparid); 104 memcpy(marshalled_dataset,&numpar,sizeof(numpar));marshalled_dataset+=sizeof(numpar); 105 memcpy(marshalled_dataset,&numpar_offset,sizeof(numpar_offset));marshalled_dataset+=sizeof(numpar_offset); 106 memcpy(marshalled_dataset,&h,sizeof(h));marshalled_dataset+=sizeof(h); 107 memcpy(marshalled_dataset,&s,sizeof(s));marshalled_dataset+=sizeof(s); 108 memcpy(marshalled_dataset,&b,sizeof(b));marshalled_dataset+=sizeof(b); 109 memcpy(marshalled_dataset,&k,sizeof(k));marshalled_dataset+=sizeof(k); 110 memcpy(marshalled_dataset,&melting,sizeof(melting));marshalled_dataset+=sizeof(melting); 111 memcpy(marshalled_dataset,&accumulation,sizeof(accumulation));marshalled_dataset+=sizeof(accumulation); 112 memcpy(marshalled_dataset,&geothermalflux,sizeof(geothermalflux));marshalled_dataset+=sizeof(geothermalflux); 113 memcpy(marshalled_dataset,&friction_type,sizeof(friction_type));marshalled_dataset+=sizeof(friction_type); 114 memcpy(marshalled_dataset,&onbed,sizeof(onbed));marshalled_dataset+=sizeof(onbed); 115 memcpy(marshalled_dataset,&onwater,sizeof(onwater));marshalled_dataset+=sizeof(onwater); 116 memcpy(marshalled_dataset,&p,sizeof(p));marshalled_dataset+=sizeof(p); 117 memcpy(marshalled_dataset,&q,sizeof(q));marshalled_dataset+=sizeof(q); 118 memcpy(marshalled_dataset,&shelf,sizeof(shelf));marshalled_dataset+=sizeof(shelf); 87 88 /*Marshall hooks: */ 89 hnodes.Marshall(&marshalled_dataset); 90 hmatice.Marshall(&marshalled_dataset); 91 hmatpar.Marshall(&marshalled_dataset); 92 hnumpar.Marshall(&marshalled_dataset); 93 94 /*Marshall properties: */ 95 properties.Marshall(&marshalled_dataset); 119 96 120 97 *pmarshalled_dataset=marshalled_dataset; … … 124 101 /*FUNCTION MarshallSize {{{1*/ 125 102 int Tria::MarshallSize(){ 103 126 104 return sizeof(id) 127 +sizeof(mid) 128 +sizeof(mparid) 129 +sizeof(node_ids) 130 +sizeof(nodes) 131 +sizeof(node_offsets) 132 +sizeof(matice) 133 +sizeof(matice_offset) 134 +sizeof(matpar) 135 +sizeof(matpar_offset) 136 +sizeof(numparid) 137 +sizeof(numpar) 138 +sizeof(numpar_offset) 139 +sizeof(h) 140 +sizeof(s) 141 +sizeof(b) 142 +sizeof(k) 143 +sizeof(melting) 144 +sizeof(accumulation) 145 +sizeof(geothermalflux) 146 +sizeof(friction_type) 147 +sizeof(onbed) 148 +sizeof(onwater) 149 +sizeof(p) 150 +sizeof(q) 151 +sizeof(shelf) 152 +sizeof(int); //sizeof(int) for enum type 105 +hnodes.MarshallSize() 106 +hmatice.MarshallSize() 107 +hmatpar.MarshallSize() 108 +hnumpar.MarshallSize() 109 +properties.MarshallSize() 110 +sizeof(int); //sizeof(int) for enum type 153 111 } 154 112 /*}}}*/ … … 166 124 167 125 memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id); 168 memcpy(&mid,marshalled_dataset,sizeof(mid));marshalled_dataset+=sizeof(mid); 169 memcpy(&mparid,marshalled_dataset,sizeof(mparid));marshalled_dataset+=sizeof(mparid); 170 memcpy(&node_ids,marshalled_dataset,sizeof(node_ids));marshalled_dataset+=sizeof(node_ids); 171 memcpy(&nodes,marshalled_dataset,sizeof(nodes));marshalled_dataset+=sizeof(nodes); 172 memcpy(&node_offsets,marshalled_dataset,sizeof(node_offsets));marshalled_dataset+=sizeof(node_offsets); 173 memcpy(&matice,marshalled_dataset,sizeof(matice));marshalled_dataset+=sizeof(matice); 174 memcpy(&matice_offset,marshalled_dataset,sizeof(matice_offset));marshalled_dataset+=sizeof(matice_offset); 175 memcpy(&matpar,marshalled_dataset,sizeof(matpar));marshalled_dataset+=sizeof(matpar); 176 memcpy(&matpar_offset,marshalled_dataset,sizeof(matpar_offset));marshalled_dataset+=sizeof(matpar_offset); 177 memcpy(&numparid,marshalled_dataset,sizeof(numparid));marshalled_dataset+=sizeof(numparid); 178 memcpy(&numpar,marshalled_dataset,sizeof(numpar));marshalled_dataset+=sizeof(numpar); 179 memcpy(&numpar_offset,marshalled_dataset,sizeof(numpar_offset));marshalled_dataset+=sizeof(numpar_offset); 180 memcpy(&h,marshalled_dataset,sizeof(h));marshalled_dataset+=sizeof(h); 181 memcpy(&s,marshalled_dataset,sizeof(s));marshalled_dataset+=sizeof(s); 182 memcpy(&b,marshalled_dataset,sizeof(b));marshalled_dataset+=sizeof(b); 183 memcpy(&k,marshalled_dataset,sizeof(k));marshalled_dataset+=sizeof(k); 184 memcpy(&melting,marshalled_dataset,sizeof(melting));marshalled_dataset+=sizeof(melting); 185 memcpy(&accumulation,marshalled_dataset,sizeof(accumulation));marshalled_dataset+=sizeof(accumulation); 186 memcpy(&geothermalflux,marshalled_dataset,sizeof(geothermalflux));marshalled_dataset+=sizeof(geothermalflux); 187 memcpy(&friction_type,marshalled_dataset,sizeof(friction_type));marshalled_dataset+=sizeof(friction_type); 188 memcpy(&onbed,marshalled_dataset,sizeof(onbed));marshalled_dataset+=sizeof(onbed); 189 memcpy(&onwater,marshalled_dataset,sizeof(onwater));marshalled_dataset+=sizeof(onwater); 190 memcpy(&p,marshalled_dataset,sizeof(p));marshalled_dataset+=sizeof(p); 191 memcpy(&q,marshalled_dataset,sizeof(q));marshalled_dataset+=sizeof(q); 192 memcpy(&shelf,marshalled_dataset,sizeof(shelf));marshalled_dataset+=sizeof(shelf); 193 194 /*nodes and materials are not pointing to correct objects anymore:*/ 195 for(i=0;i<3;i++)nodes[i]=NULL; 196 matice=NULL; 197 matpar=NULL; 198 numpar=NULL; 126 127 /*demarshall hooks: */ 128 hnodes.Demarshall(&marshalled_dataset); 129 hmatice.Demarshall(&marshalled_dataset); 130 hmatpar.Demarshall(&marshalled_dataset); 131 hnumpar.Demarshall(&marshalled_dataset); 132 133 /*demarshall properties: */ 134 properties.Demarshall(&marshalled_dataset); 199 135 200 136 /*return: */ 201 137 *pmarshalled_dataset=marshalled_dataset; 202 138 return; 139 } 140 /*}}}*/ 141 142 /*Object processing: */ 143 /*FUNCTION Echo{{{1*/ 144 145 void Tria::Echo(void){ 146 147 printf("Tria:\n"); 148 printf(" id: %i\n",id); 149 hnodes.Echo(); 150 hmatice.Echo(); 151 hmatpar.Echo(); 152 hnumpar.Echo(); 153 properties.Echo(); 154 155 return; 156 } 157 /*}}}*/ 158 /*FUNCTION DeepEcho{{{1*/ 159 160 void Tria::DeepEcho(void){ 161 162 printf("Tria:\n"); 163 printf(" id: %i\n",id); 164 hnodes.DeepEcho(); 165 hmatice.DeepEcho(); 166 hmatpar.DeepEcho(); 167 hnumpar.DeepEcho(); 168 properties.DeepEcho(); 169 170 return; 171 } 172 /*}}}*/ 173 /*FUNCTION Configure {{{1*/ 174 void Tria::Configure(void* ploadsin,void* pnodesin,void* pmaterialsin,void* pparametersin){ 175 176 int i; 177 178 DataSet* loadsin=NULL; 179 DataSet* nodesin=NULL; 180 DataSet* materialsin=NULL; 181 DataSet* parametersin=NULL; 182 183 /*Recover pointers :*/ 184 loadsin=(DataSet*)ploadsin; 185 nodesin=(DataSet*)pnodesin; 186 materialsin=(DataSet*)pmaterialsin; 187 parametersin=(DataSet*)pparametersin; 188 189 /*Take care of hooking up all objects for this element, ie links the objects in the hooks to their respective 190 * datasets, using internal ids and offsets hidden in hooks: */ 191 hnodes.configure(nodesin); 192 hmatice.configure(materialsin); 193 hmatpar.configure(materialsin); 194 hnumpar.configure(parametersin); 195 203 196 } 204 197 /*}}}*/ … … 213 206 double pressure[numgrids]; 214 207 double rho_ice,g; 215 208 209 /*dynamic objects pointed to by hooks: */ 210 Node** nodes=NULL; 211 Matpar* matpar=NULL; 212 Matice* matice=NULL; 213 Numpar* numpar=NULL; 214 215 216 216 /*Get dof list on which we will plug the pressure values: */ 217 217 GetDofList1(&doflist[0]); 218 219 /*recover objects from hooks: */ 220 nodes=(Node**)hnodes.deliverp(); 221 matpar=(Matpar*)hmatpar.delivers(); 222 matice=(Matice*)hmatice.delivers(); 223 numpar=(Numpar*)hnumpar.delivers(); 218 224 219 225 /*pressure is lithostatic: */ … … 221 227 g=matpar->GetG(); 222 228 for(i=0;i<numgrids;i++){ 223 pressure[i]=rho_ice*g* h[i];229 pressure[i]=rho_ice*g*this->properties.h[i]; 224 230 } 225 231 226 232 /*plug local pressure values into global pressure vector: */ 227 233 VecSetValues(pg,numgrids,doflist,(const double*)pressure,INSERT_VALUES); 228 229 }230 /*}}}*/231 /*FUNCTION Configure {{{1*/232 void Tria::Configure(void* ploadsin,void* pnodesin,void* pmaterialsin,void* pparametersin){233 234 int i;235 236 DataSet* loadsin=NULL;237 DataSet* nodesin=NULL;238 DataSet* materialsin=NULL;239 DataSet* parametersin=NULL;240 241 /*Recover pointers :*/242 loadsin=(DataSet*)ploadsin;243 nodesin=(DataSet*)pnodesin;244 materialsin=(DataSet*)pmaterialsin;245 parametersin=(DataSet*)pparametersin;246 247 /*Link this element with its nodes, ie find pointers to the nodes in the nodes dataset.: */248 ResolvePointers((Object**)nodes,node_ids,node_offsets,3,nodesin);249 250 /*Same for materials: */251 ResolvePointers((Object**)&matice,&mid,&matice_offset,1,materialsin);252 ResolvePointers((Object**)&matpar,&mparid,&matpar_offset,1,materialsin);253 254 /*Same for numpar: */255 ResolvePointers((Object**)&numpar,&numparid,&numpar_offset,1,parametersin);256 234 257 235 } … … 301 279 double Jdet; 302 280 281 /*dynamic objects pointed to by hooks: */ 282 Node** nodes=NULL; 283 Matpar* matpar=NULL; 284 Matice* matice=NULL; 285 Numpar* numpar=NULL; 286 303 287 ParameterInputs* inputs=NULL; 304 288 305 289 /*If on water, return 0: */ 306 if( onwater)return 0;290 if(this->properties.onwater)return 0; 307 291 308 292 /*recover pointers: */ 309 293 inputs=(ParameterInputs*)vinputs; 294 295 /*recover objects from hooks: */ 296 nodes=(Node**)hnodes.deliverp(); 297 matpar=(Matpar*)hmatpar.delivers(); 298 matice=(Matice*)hmatice.delivers(); 299 numpar=(Numpar*)hnumpar.delivers(); 310 300 311 301 /* Get node coordinates and dof list: */ … … 337 327 /*Add Tikhonov regularization term to misfit*/ 338 328 if (strcmp(numpar->control_type,"drag")==0){ 339 if (! shelf){340 341 GetParameterDerivativeValue(&dk[0], & k[0],&xyz_list[0][0], gauss_l1l2l3);329 if (!this->properties.shelf){ 330 331 GetParameterDerivativeValue(&dk[0], &this->properties.k[0],&xyz_list[0][0], gauss_l1l2l3); 342 332 Jelem+=numpar->cm_noisedmp*1/2*(pow(dk[0],2)+pow(dk[1],2))*Jdet*gauss_weight; 343 333 … … 464 454 int found=0; 465 455 456 /*dynamic objects pointed to by hooks: */ 457 Node** nodes=NULL; 458 Matpar* matpar=NULL; 459 Matice* matice=NULL; 460 Numpar* numpar=NULL; 461 466 462 ParameterInputs* inputs=NULL; 467 463 468 464 /*recover pointers: */ 469 465 inputs=(ParameterInputs*)vinputs; 466 467 /*recover objects from hooks: */ 468 nodes=(Node**)hnodes.deliverp(); 469 matpar=(Matpar*)hmatpar.delivers(); 470 matice=(Matice*)hmatice.delivers(); 471 numpar=(Numpar*)hnumpar.delivers(); 470 472 471 473 /*recover extra inputs from users, at current convergence iteration: */ … … 666 668 int found=0; 667 669 670 /*dynamic objects pointed to by hooks: */ 671 Node** nodes=NULL; 672 Matpar* matpar=NULL; 673 Matice* matice=NULL; 674 Numpar* numpar=NULL; 675 668 676 ParameterInputs* inputs=NULL; 669 677 670 678 /*recover pointers: */ 671 679 inputs=(ParameterInputs*)vinputs; 680 681 /*recover objects from hooks: */ 682 nodes=(Node**)hnodes.deliverp(); 683 matpar=(Matpar*)hmatpar.delivers(); 684 matice=(Matice*)hmatice.delivers(); 685 numpar=(Numpar*)hnumpar.delivers(); 672 686 673 687 /*recover extra inputs from users, at current convergence iteration: */ … … 685 699 686 700 /*Modify z so that it reflects the surface*/ 687 for(i=0;i<numgrids;i++) xyz_list[i][2]= s[i];701 for(i=0;i<numgrids;i++) xyz_list[i][2]=this->properties.s[i]; 688 702 689 703 /*Get normal vector to the surface*/ … … 875 889 int dofs[2]={0,1}; 876 890 891 /*dynamic objects pointed to by hooks: */ 892 Node** nodes=NULL; 893 Matpar* matpar=NULL; 894 Matice* matice=NULL; 895 Numpar* numpar=NULL; 896 877 897 ParameterInputs* inputs=NULL; 878 898 879 899 /*First, if we are on water, return empty matrix: */ 880 if( onwater)return;900 if(this->properties.onwater)return; 881 901 882 902 /*recover pointers: */ 883 903 inputs=(ParameterInputs*)vinputs; 904 905 /*recover objects from hooks: */ 906 nodes=(Node**)hnodes.deliverp(); 907 matpar=(Matpar*)hmatpar.delivers(); 908 matice=(Matice*)hmatice.delivers(); 909 numpar=(Numpar*)hnumpar.delivers(); 884 910 885 911 /*recover extra inputs from users, at current convergence iteration: */ … … 935 961 936 962 /*Compute thickness at gaussian point: */ 937 GetParameterValue(&thickness, & h[0],gauss_l1l2l3);963 GetParameterValue(&thickness, &this->properties.h[0],gauss_l1l2l3); 938 964 939 965 /*Get strain rate from velocity: */ … … 1012 1038 1013 1039 /*Do not forget to include friction: */ 1014 if(! shelf){1040 if(!this->properties.shelf){ 1015 1041 CreateKMatrixDiagnosticHorizFriction(Kgg,inputs,analysis_type,sub_analysis_type); 1016 1042 } … … 1090 1116 double MOUNTAINKEXPONENT=10; 1091 1117 1118 /*dynamic objects pointed to by hooks: */ 1119 Node** nodes=NULL; 1120 Matpar* matpar=NULL; 1121 Matice* matice=NULL; 1122 Numpar* numpar=NULL; 1123 1092 1124 ParameterInputs* inputs=NULL; 1093 1125 1094 1126 /*recover pointers: */ 1095 1127 inputs=(ParameterInputs*)vinputs; 1128 1129 /*recover objects from hooks: */ 1130 nodes=(Node**)hnodes.deliverp(); 1131 matpar=(Matpar*)hmatpar.delivers(); 1132 matice=(Matice*)hmatice.delivers(); 1133 numpar=(Numpar*)hnumpar.delivers(); 1096 1134 1097 1135 /* Get node coordinates and dof list: */ … … 1102 1140 for(i=0;i<numdof;i++) for(j=0;j<numdof;j++) Ke_gg[i][j]=0.0; 1103 1141 1104 if ( shelf){1142 if (this->properties.shelf){ 1105 1143 /*no friction, do nothing*/ 1106 1144 return; 1107 1145 } 1108 1146 1109 if ( friction_type!=2)ISSMERROR(" non-viscous friction not supported yet!");1147 if (this->properties.friction_type!=2)ISSMERROR(" non-viscous friction not supported yet!"); 1110 1148 1111 1149 /*recover extra inputs from users, at current convergence iteration: */ … … 1122 1160 friction->rho_ice=matpar->GetRhoIce(); 1123 1161 friction->rho_water=matpar->GetRhoWater(); 1124 friction->K=& k[0];1125 friction->bed=& b[0];1126 friction->thickness=& h[0];1162 friction->K=&this->properties.k[0]; 1163 friction->bed=&this->properties.b[0]; 1164 friction->thickness=&this->properties.h[0]; 1127 1165 friction->velocities=&vxvy_list[0][0]; 1128 friction->p= p;1129 friction->q= q;1166 friction->p=this->properties.p; 1167 friction->q=this->properties.q; 1130 1168 1131 1169 /*Compute alpha2_list: */ … … 1164 1202 // If we have a slope > 6% for this element, it means we are on a mountain. In this particular case, 1165 1203 //velocity should be = 0. To achieve this result, we set alpha2_list to a very high value: */ 1166 GetParameterDerivativeValue(&slope[0], & s[0],&xyz_list[0][0], gauss_l1l2l3);1204 GetParameterDerivativeValue(&slope[0], &this->properties.s[0],&xyz_list[0][0], gauss_l1l2l3); 1167 1205 slope_magnitude=sqrt(pow(slope[0],2)+pow(slope[1],2)); 1168 1206 … … 1250 1288 double Ke_gg_gaussian[numdof][numdof]; //stiffness matrix evaluated at the gaussian point. 1251 1289 1290 /*dynamic objects pointed to by hooks: */ 1291 Node** nodes=NULL; 1292 Matpar* matpar=NULL; 1293 Matice* matice=NULL; 1294 Numpar* numpar=NULL; 1295 1252 1296 ParameterInputs* inputs=NULL; 1253 1297 1254 1298 /*recover pointers: */ 1255 1299 inputs=(ParameterInputs*)vinputs; 1300 1301 /*recover objects from hooks: */ 1302 nodes=(Node**)hnodes.deliverp(); 1303 matpar=(Matpar*)hmatpar.delivers(); 1304 matice=(Matice*)hmatice.delivers(); 1305 numpar=(Numpar*)hnumpar.delivers(); 1256 1306 1257 1307 /* Get node coordinates and dof list: */ … … 1368 1418 double tLD[3]; 1369 1419 double Ke_gaussian[numdof][numdof]={0.0}; 1420 1421 /*dynamic objects pointed to by hooks: */ 1422 Node** nodes=NULL; 1423 Matpar* matpar=NULL; 1424 Matice* matice=NULL; 1425 Numpar* numpar=NULL; 1426 1427 /*recover objects from hooks: */ 1428 nodes=(Node**)hnodes.deliverp(); 1429 matpar=(Matpar*)hmatpar.delivers(); 1430 matice=(Matice*)hmatice.delivers(); 1431 numpar=(Numpar*)hnumpar.delivers(); 1370 1432 1371 1433 /*Recover constants of ice */ … … 1469 1531 int found; 1470 1532 1533 /*dynamic objects pointed to by hooks: */ 1534 Node** nodes=NULL; 1535 Matpar* matpar=NULL; 1536 Matice* matice=NULL; 1537 Numpar* numpar=NULL; 1538 1471 1539 ParameterInputs* inputs=NULL; 1472 1540 1473 1541 /*recover pointers: */ 1474 1542 inputs=(ParameterInputs*)vinputs; 1543 1544 /*recover objects from hooks: */ 1545 nodes=(Node**)hnodes.deliverp(); 1546 matpar=(Matpar*)hmatpar.delivers(); 1547 matice=(Matice*)hmatice.delivers(); 1548 numpar=(Numpar*)hnumpar.delivers(); 1475 1549 1476 1550 /*recover extra inputs from users, at current convergence iteration: */ … … 1678 1752 int found; 1679 1753 1754 /*dynamic objects pointed to by hooks: */ 1755 Node** nodes=NULL; 1756 Matpar* matpar=NULL; 1757 Matice* matice=NULL; 1758 Numpar* numpar=NULL; 1759 1680 1760 ParameterInputs* inputs=NULL; 1681 1761 1682 1762 /*recover pointers: */ 1683 1763 inputs=(ParameterInputs*)vinputs; 1764 1765 /*recover objects from hooks: */ 1766 nodes=(Node**)hnodes.deliverp(); 1767 matpar=(Matpar*)hmatpar.delivers(); 1768 matice=(Matice*)hmatice.delivers(); 1769 numpar=(Numpar*)hnumpar.delivers(); 1684 1770 1685 1771 /*recover extra inputs from users, at current convergence iteration: */ … … 1808 1894 1809 1895 double Jdet; 1810 1896 1897 /*dynamic objects pointed to by hooks: */ 1898 Node** nodes=NULL; 1899 Matpar* matpar=NULL; 1900 Matice* matice=NULL; 1901 Numpar* numpar=NULL; 1902 1903 /*recover objects from hooks: */ 1904 nodes=(Node**)hnodes.deliverp(); 1905 matpar=(Matpar*)hmatpar.delivers(); 1906 matice=(Matice*)hmatice.delivers(); 1907 numpar=(Numpar*)hnumpar.delivers(); 1908 1811 1909 /* Get node coordinates and dof list: */ 1812 1910 GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids); … … 1894 1992 ParameterInputs* inputs=NULL; 1895 1993 1994 /*dynamic objects pointed to by hooks: */ 1995 Node** nodes=NULL; 1996 Matpar* matpar=NULL; 1997 Matice* matice=NULL; 1998 Numpar* numpar=NULL; 1999 1896 2000 /*recover pointers: */ 1897 2001 inputs=(ParameterInputs*)vinputs; 2002 2003 /*recover objects from hooks: */ 2004 nodes=(Node**)hnodes.deliverp(); 2005 matpar=(Matpar*)hmatpar.delivers(); 2006 matice=(Matice*)hmatice.delivers(); 2007 numpar=(Numpar*)hnumpar.delivers(); 1898 2008 1899 2009 /*recover extra inputs from users, dt: */ … … 2037 2147 int found=0; 2038 2148 2149 /*dynamic objects pointed to by hooks: */ 2150 Node** nodes=NULL; 2151 Matpar* matpar=NULL; 2152 Matice* matice=NULL; 2153 Numpar* numpar=NULL; 2154 2039 2155 ParameterInputs* inputs=NULL; 2040 2156 2041 2157 /*recover pointers: */ 2042 2158 inputs=(ParameterInputs*)vinputs; 2159 2160 /*recover objects from hooks: */ 2161 nodes=(Node**)hnodes.deliverp(); 2162 matpar=(Matpar*)hmatpar.delivers(); 2163 matice=(Matice*)hmatice.delivers(); 2164 numpar=(Numpar*)hnumpar.delivers(); 2043 2165 2044 2166 /*recover extra inputs from users, at current convergence iteration: */ … … 2126 2248 int found=0; 2127 2249 2250 /*dynamic objects pointed to by hooks: */ 2251 Node** nodes=NULL; 2252 Matpar* matpar=NULL; 2253 Matice* matice=NULL; 2254 Numpar* numpar=NULL; 2255 2128 2256 ParameterInputs* inputs=NULL; 2129 2257 2130 2258 /*recover pointers: */ 2131 2259 inputs=(ParameterInputs*)vinputs; 2260 2261 /*recover objects from hooks: */ 2262 nodes=(Node**)hnodes.deliverp(); 2263 matpar=(Matpar*)hmatpar.delivers(); 2264 matice=(Matice*)hmatice.delivers(); 2265 numpar=(Numpar*)hnumpar.delivers(); 2266 2267 /*recover objects from hooks: */ 2268 nodes=(Node**)hnodes.deliverp(); 2269 matpar=(Matpar*)hmatpar.delivers(); 2270 matice=(Matice*)hmatice.delivers(); 2271 numpar=(Numpar*)hnumpar.delivers(); 2132 2272 2133 2273 /*recover extra inputs from users, at current convergence iteration: */ … … 2224 2364 int dofs2[1]={1}; 2225 2365 2366 /*dynamic objects pointed to by hooks: */ 2367 Node** nodes=NULL; 2368 Matpar* matpar=NULL; 2369 Matice* matice=NULL; 2370 Numpar* numpar=NULL; 2371 2226 2372 ParameterInputs* inputs=NULL; 2227 2373 2228 2374 /*recover pointers: */ 2229 2375 inputs=(ParameterInputs*)vinputs; 2376 2377 /*recover objects from hooks: */ 2378 nodes=(Node**)hnodes.deliverp(); 2379 matpar=(Matpar*)hmatpar.delivers(); 2380 matice=(Matice*)hmatice.delivers(); 2381 numpar=(Numpar*)hnumpar.delivers(); 2230 2382 2231 2383 /* recover input parameters: */ … … 2254 2406 2255 2407 /*Get melting at gaussian point: */ 2256 GetParameterValue(&meltingvalue, & melting[0],gauss_l1l2l3);2408 GetParameterValue(&meltingvalue, &this->properties.melting[0],gauss_l1l2l3); 2257 2409 2258 2410 /*Get velocity at gaussian point: */ … … 2261 2413 2262 2414 /*Get bed slope: */ 2263 GetParameterDerivativeValue(&slope[0], & b[0],&xyz_list[0][0], gauss_l1l2l3);2415 GetParameterDerivativeValue(&slope[0], &this->properties.b[0],&xyz_list[0][0], gauss_l1l2l3); 2264 2416 dbdx=slope[0]; 2265 2417 dbdy=slope[1]; … … 2333 2485 double thickness; 2334 2486 2487 /*dynamic objects pointed to by hooks: */ 2488 Node** nodes=NULL; 2489 Matpar* matpar=NULL; 2490 Matice* matice=NULL; 2491 Numpar* numpar=NULL; 2492 2335 2493 ParameterInputs* inputs=NULL; 2336 2494 2337 2495 /*First, if we are on water, return empty vector: */ 2338 if( onwater)return;2496 if(this->properties.onwater)return; 2339 2497 2340 2498 /*recover pointers: */ 2341 2499 inputs=(ParameterInputs*)vinputs; 2500 2501 /*recover objects from hooks: */ 2502 nodes=(Node**)hnodes.deliverp(); 2503 matpar=(Matpar*)hmatpar.delivers(); 2504 matice=(Matice*)hmatice.delivers(); 2505 numpar=(Numpar*)hnumpar.delivers(); 2342 2506 2343 2507 /* Get node coordinates and dof list: */ … … 2384 2548 2385 2549 /*Compute thickness at gaussian point: */ 2386 GetParameterValue(&thickness, & h[0],gauss_l1l2l3);2550 GetParameterValue(&thickness, &this->properties.h[0],gauss_l1l2l3); 2387 2551 2388 GetParameterDerivativeValue(&slope[0], & s[0],&xyz_list[0][0], gauss_l1l2l3);2552 GetParameterDerivativeValue(&slope[0], &this->properties.s[0],&xyz_list[0][0], gauss_l1l2l3); 2389 2553 2390 2554 /*In case we have plastic basal drag, compute plastic stress at gaussian point from k1, k2 and k3 fields in the 2391 2555 * element itself: */ 2392 if( friction_type==1){2393 GetParameterValue(&plastic_stress, & k[0],gauss_l1l2l3);2556 if(this->properties.friction_type==1){ 2557 GetParameterValue(&plastic_stress, &this->properties.k[0],gauss_l1l2l3); 2394 2558 } 2395 2559 … … 2417 2581 2418 2582 /*Build pe_g_gaussian vector: */ 2419 if( friction_type==1){2583 if(this->properties.friction_type==1){ 2420 2584 for (i=0;i<numgrids;i++){ 2421 2585 for (j=0;j<NDOF2;j++){ … … 2502 2666 int found=0; 2503 2667 2668 /*dynamic objects pointed to by hooks: */ 2669 Node** nodes=NULL; 2670 Matpar* matpar=NULL; 2671 Matice* matice=NULL; 2672 Numpar* numpar=NULL; 2673 2504 2674 ParameterInputs* inputs=NULL; 2505 2675 2506 2676 /*recover pointers: */ 2507 2677 inputs=(ParameterInputs*)vinputs; 2678 2679 /*recover objects from hooks: */ 2680 nodes=(Node**)hnodes.deliverp(); 2681 matpar=(Matpar*)hmatpar.delivers(); 2682 matice=(Matice*)hmatice.delivers(); 2683 numpar=(Numpar*)hnumpar.delivers(); 2508 2684 2509 2685 /*recover extra inputs from users, at current convergence iteration: */ … … 2598 2774 int found=0; 2599 2775 2776 /*dynamic objects pointed to by hooks: */ 2777 Node** nodes=NULL; 2778 Matpar* matpar=NULL; 2779 Matice* matice=NULL; 2780 Numpar* numpar=NULL; 2781 2600 2782 ParameterInputs* inputs=NULL; 2601 2783 2602 2784 /*recover pointers: */ 2603 2785 inputs=(ParameterInputs*)vinputs; 2786 2787 /*recover objects from hooks: */ 2788 nodes=(Node**)hnodes.deliverp(); 2789 matpar=(Matpar*)hmatpar.delivers(); 2790 matice=(Matice*)hmatice.delivers(); 2791 numpar=(Numpar*)hnumpar.delivers(); 2604 2792 2605 2793 /*recover extra inputs from users, at current convergence iteration: */ … … 2690 2878 double slope[2]; 2691 2879 2880 /*dynamic objects pointed to by hooks: */ 2881 Node** nodes=NULL; 2882 Matpar* matpar=NULL; 2883 Matice* matice=NULL; 2884 Numpar* numpar=NULL; 2885 2886 /*recover objects from hooks: */ 2887 nodes=(Node**)hnodes.deliverp(); 2888 matpar=(Matpar*)hmatpar.delivers(); 2889 matice=(Matice*)hmatice.delivers(); 2890 numpar=(Numpar*)hnumpar.delivers(); 2891 2692 2892 /* Get node coordinates and dof list: */ 2693 2893 GetVerticesCoordinates(&xyz_list[0][0], nodes, numgrids); … … 2698 2898 2699 2899 if ( (sub_analysis_type==SurfaceXAnalysisEnum()) || (sub_analysis_type==SurfaceYAnalysisEnum())){ 2700 for(i=0;i<numdof;i++) param[i]= s[i];2900 for(i=0;i<numdof;i++) param[i]=this->properties.s[i]; 2701 2901 } 2702 2902 if ( (sub_analysis_type==BedXAnalysisEnum()) || (sub_analysis_type==BedYAnalysisEnum())){ 2703 for(i=0;i<numdof;i++) param[i]= b[i];2903 for(i=0;i<numdof;i++) param[i]=this->properties.b[i]; 2704 2904 } 2705 2905 … … 2791 2991 double scalar_ocean; 2792 2992 2993 /*dynamic objects pointed to by hooks: */ 2994 Node** nodes=NULL; 2995 Matpar* matpar=NULL; 2996 Matice* matice=NULL; 2997 Numpar* numpar=NULL; 2998 2793 2999 ParameterInputs* inputs=NULL; 2794 3000 2795 3001 /*recover pointers: */ 2796 3002 inputs=(ParameterInputs*)vinputs; 3003 3004 /*recover objects from hooks: */ 3005 nodes=(Node**)hnodes.deliverp(); 3006 matpar=(Matpar*)hmatpar.delivers(); 3007 matice=(Matice*)hmatice.delivers(); 3008 numpar=(Numpar*)hnumpar.delivers(); 2797 3009 2798 3010 /* Get node coordinates and dof list: */ … … 2906 3118 ParameterInputs* inputs=NULL; 2907 3119 3120 /*dynamic objects pointed to by hooks: */ 3121 Node** nodes=NULL; 3122 Matpar* matpar=NULL; 3123 Matice* matice=NULL; 3124 Numpar* numpar=NULL; 3125 2908 3126 /*recover pointers: */ 2909 3127 inputs=(ParameterInputs*)vinputs; 3128 3129 /*recover objects from hooks: */ 3130 nodes=(Node**)hnodes.deliverp(); 3131 matpar=(Matpar*)hmatpar.delivers(); 3132 matice=(Matice*)hmatice.delivers(); 3133 numpar=(Numpar*)hnumpar.delivers(); 2910 3134 2911 3135 /* Get node coordinates and dof list: */ … … 2934 3158 2935 3159 /*Initialize all fields: */ 2936 if ( friction_type!=2)ISSMERROR(" non-viscous friction not supported yet!");3160 if (this->properties.friction_type!=2)ISSMERROR(" non-viscous friction not supported yet!"); 2937 3161 2938 3162 friction->element_type=(char*)xmalloc((strlen("3d")+1)*sizeof(char)); … … 2942 3166 friction->rho_ice=matpar->GetRhoIce(); 2943 3167 friction->rho_water=matpar->GetRhoWater(); 2944 friction->K=& k[0];2945 friction->bed=& b[0];2946 friction->thickness=& h[0];3168 friction->K=&this->properties.k[0]; 3169 friction->bed=&this->properties.b[0]; 3170 friction->thickness=&this->properties.h[0]; 2947 3171 friction->velocities=&vxvyvz_list[0][0]; 2948 friction->p= p;2949 friction->q= q;3172 friction->p=this->properties.p; 3173 friction->q=this->properties.q; 2950 3174 2951 3175 /*Compute alpha2_list: */ … … 2977 3201 2978 3202 /*Get geothermal flux and basal friction */ 2979 GetParameterValue(&geothermalflux_value,& geothermalflux[0],gauss_coord);3203 GetParameterValue(&geothermalflux_value,&this->properties.geothermalflux[0],gauss_coord); 2980 3204 GetParameterValue(&basalfriction,&basalfriction_list[0],gauss_coord); 2981 3205 … … 3000 3224 xfree((void**)&gauss_weights); 3001 3225 3002 }3003 /*}}}*/3004 /*FUNCTION DeepEcho{{{1*/3005 3006 void Tria::DeepEcho(void){3007 3008 printf("Tria:\n");3009 printf(" id: %i\n",id);3010 printf(" mid: %i\n",mid);3011 printf(" mparid: %i\n",mparid);3012 printf(" node_ids=[%i,%i,%i]\n",node_ids[0],node_ids[1],node_ids[2]);3013 printf(" node_offsets=[%i,%i,%i]\n",node_offsets[0],node_offsets[1],node_offsets[2]);3014 printf(" matice_offset=%i\n",matice_offset);3015 printf(" matpar_offset=%i\n",matpar_offset);3016 printf(" h=[%g,%g,%g]\n",h[0],h[1],h[2]);3017 printf(" s=[%g,%g,%g]\n",s[0],s[1],s[2]);3018 printf(" b=[%g,%g,%g]\n",b[0],b[1],b[2]);3019 printf(" k=[%g,%g,%g]\n",k[0],k[1],k[2]);3020 printf(" melting=[%g,%g,%g]\n",melting[0],melting[1],melting[2]);3021 printf(" accumulation=[%g,%g,%g]\n",accumulation[0],accumulation[1],accumulation[2]);3022 printf(" geothermalflux=[%g,%g,%g]\n",geothermalflux[0],geothermalflux[1],geothermalflux[2]);3023 printf(" friction_type: %i\n",friction_type);3024 printf(" p: %g\n",p);3025 printf(" q: %g\n",q);3026 printf(" shelf: %i\n",shelf);3027 printf(" onbed: %i\n",onbed);3028 printf(" onwater: %i\n",onwater);3029 printf(" nodes: \n");3030 if(nodes[0])nodes[0]->Echo();3031 if(nodes[1])nodes[1]->Echo();3032 if(nodes[2])nodes[2]->Echo();3033 if(matice)matice->Echo();3034 if(matpar)matpar->Echo();3035 3036 return;3037 3226 } 3038 3227 /*}}}*/ … … 3093 3282 double fit=-1; 3094 3283 3284 /*dynamic objects pointed to by hooks: */ 3285 Node** nodes=NULL; 3286 Matpar* matpar=NULL; 3287 Matice* matice=NULL; 3288 Numpar* numpar=NULL; 3289 3095 3290 ParameterInputs* inputs=NULL; 3096 3291 3097 3292 /*recover pointers: */ 3098 3293 inputs=(ParameterInputs*)vinputs; 3294 3295 /*recover objects from hooks: */ 3296 nodes=(Node**)hnodes.deliverp(); 3297 matpar=(Matpar*)hmatpar.delivers(); 3298 matice=(Matice*)hmatice.delivers(); 3299 numpar=(Numpar*)hnumpar.delivers(); 3099 3300 3100 3301 /* Get node coordinates and dof list: */ … … 3302 3503 } 3303 3504 /*}}}*/ 3304 /*FUNCTION Echo {{{1*/3305 3306 void Tria::Echo(void){3307 3308 printf("Tria:\n");3309 printf(" id: %i\n",id);3310 printf(" mid: %i\n",mid);3311 printf(" mparid: %i\n",mparid);3312 printf(" node_ids=[%i,%i,%i]\n",node_ids[0],node_ids[1],node_ids[2]);3313 printf(" node_offsets=[%i,%i,%i]\n",node_offsets[0],node_offsets[1],node_offsets[2]);3314 printf(" matice_offset=%i\n",matice_offset);3315 printf(" matpar_offset=%i\n",matpar_offset);3316 printf(" h=[%g,%g,%g]\n",h[0],h[1],h[2]);3317 printf(" s=[%g,%g,%g]\n",s[0],s[1],s[2]);3318 printf(" b=[%g,%g,%g]\n",b[0],b[1],b[2]);3319 printf(" k=[%g,%g,%g]\n",k[0],k[1],k[2]);3320 printf(" melting=[%g,%g,%g]\n",melting[0],melting[1],melting[2]);3321 printf(" accumulation=[%g,%g,%g]\n",accumulation[0],accumulation[1],accumulation[2]);3322 printf(" geothermalflux=[%g,%g,%g]\n",geothermalflux[0],geothermalflux[1],geothermalflux[2]);3323 printf(" friction_type: %i\n",friction_type);3324 printf(" p: %g\n",p);3325 printf(" q: %g\n",q);3326 printf(" shelf: %i\n",shelf);3327 printf(" onbed: %i\n",onbed);3328 printf(" onwater: %i\n",onwater);3329 printf(" nodes: \n");3330 if(nodes[0])nodes[0]->Echo();3331 if(nodes[1])nodes[1]->Echo();3332 if(nodes[2])nodes[2]->Echo();3333 if(matice)matice->Echo();3334 if(matpar)matpar->Echo();3335 3336 return;3337 }3338 /*}}}*/3339 3505 /*FUNCTION Enum {{{1*/ 3340 3506 int Tria::Enum(void){ … … 3351 3517 double xyz_list[numgrids][3]; 3352 3518 double x1,y1,x2,y2,x3,y3; 3519 3520 /*dynamic objects pointed to by hooks: */ 3521 Node** nodes=NULL; 3522 3523 /*recover objects from hooks: */ 3524 nodes=(Node**)hnodes.deliverp(); 3353 3525 3354 3526 /*Get xyz list: */ … … 3368 3540 double xyz_list[numgrids][3]; 3369 3541 double x1,y1,x2,y2,x3,y3; 3542 3543 /*dynamic objects pointed to by hooks: */ 3544 Node** nodes=NULL; 3545 3546 /*recover objects from hooks: */ 3547 nodes=(Node**)hnodes.deliverp(); 3370 3548 3371 3549 /*Get area: */ … … 3476 3654 3477 3655 int i; 3478 for(i=0;i<3;i++)bed_list[i]= b[i];3656 for(i=0;i<3;i++)bed_list[i]=this->properties.b[i]; 3479 3657 3480 3658 } … … 3555 3733 int doflist_per_node[MAXDOFSPERNODE]; 3556 3734 int numberofdofspernode; 3735 3736 /*dynamic objects pointed to by hooks: */ 3737 Node** nodes=NULL; 3738 3739 /*recover objects from hooks: */ 3740 nodes=(Node**)hnodes.deliverp(); 3557 3741 3558 3742 for(i=0;i<3;i++){ … … 3571 3755 void Tria::GetDofList1(int* doflist){ 3572 3756 3757 /*dynamic objects pointed to by hooks: */ 3758 Node** nodes=NULL; 3759 3760 /*recover objects from hooks: */ 3761 nodes=(Node**)hnodes.deliverp(); 3762 3573 3763 int i; 3574 3764 for(i=0;i<3;i++){ … … 3723 3913 /*FUNCTION GetMatPar {{{1*/ 3724 3914 void* Tria::GetMatPar(){ 3915 3916 /*dynamic objects pointed to by hooks: */ 3917 Matpar* matpar=NULL; 3918 3919 /*recover objects from hooks: */ 3920 matpar=(Matpar*)hmatpar.delivers(); 3921 3725 3922 return matpar; 3726 3923 } … … 3806 4003 void Tria::GetNodes(void** vpnodes){ 3807 4004 int i; 3808 Node** pnodes=(Node**)vpnodes; 3809 4005 Node** pnodes=NULL; 4006 4007 /*dynamic objects pointed to by hooks: */ 4008 Node** nodes=NULL; 4009 4010 /*recover nodes: */ 4011 pnodes=(Node**)vpnodes; 4012 4013 /*recover objects from hooks: */ 4014 nodes=(Node**)hnodes.deliverp(); 4015 3810 4016 for(i=0;i<3;i++){ 3811 4017 pnodes[i]=nodes[i]; … … 3815 4021 /*FUNCTION GetOnBed {{{1*/ 3816 4022 int Tria::GetOnBed(){ 3817 return onbed;4023 return this->properties.onbed; 3818 4024 } 3819 4025 /*}}}*/ … … 3863 4069 /*FUNCTION GetShelf {{{1*/ 3864 4070 int Tria::GetShelf(){ 3865 return shelf;4071 return this->properties.shelf; 3866 4072 } 3867 4073 /*}}}*/ … … 3889 4095 3890 4096 int i; 3891 for(i=0;i<3;i++)thickness_list[i]= h[i];4097 for(i=0;i<3;i++)thickness_list[i]=this->properties.h[i]; 3892 4098 } 3893 4099 /*}}}*/ … … 3896 4102 3897 4103 /*If on water, grad = 0: */ 3898 if( onwater)return;4104 if(this->properties.onwater)return; 3899 4105 3900 4106 if (strcmp(control_type,"drag")==0){ … … 3968 4174 double B_gauss; 3969 4175 4176 /*dynamic objects pointed to by hooks: */ 4177 Node** nodes=NULL; 4178 Matpar* matpar=NULL; 4179 Matice* matice=NULL; 4180 Numpar* numpar=NULL; 4181 3970 4182 ParameterInputs* inputs=NULL; 3971 4183 3972 4184 /*recover pointers: */ 3973 4185 inputs=(ParameterInputs*)vinputs; 4186 4187 /*recover objects from hooks: */ 4188 nodes=(Node**)hnodes.deliverp(); 4189 matpar=(Matpar*)hmatpar.delivers(); 4190 matice=(Matice*)hmatice.delivers(); 4191 numpar=(Numpar*)hnumpar.delivers(); 3974 4192 3975 4193 /* Get node coordinates and dof list: */ … … 3981 4199 3982 4200 /* recover input parameters: */ 3983 inputs->Recover("thickness",& h[0],1,dofs,numgrids,(void**)nodes);4201 inputs->Recover("thickness",&this->properties.h[0],1,dofs,numgrids,(void**)nodes); 3984 4202 if(!inputs->Recover("velocity",&vxvy_list[0][0],2,dofs2,numgrids,(void**)nodes)){ 3985 4203 ISSMERROR("missing velocity input parameter"); … … 4017 4235 4018 4236 /*Get thickness: */ 4019 GetParameterValue(&thickness, & h[0],gauss_l1l2l3);4237 GetParameterValue(&thickness, &this->properties.h[0],gauss_l1l2l3); 4020 4238 4021 4239 /*Get strain rate, if velocity has been supplied: */ … … 4140 4358 double epsilon[3]; /* epsilon=[exx,eyy,exy];*/ 4141 4359 4360 /*dynamic objects pointed to by hooks: */ 4361 Node** nodes=NULL; 4362 Matpar* matpar=NULL; 4363 Matice* matice=NULL; 4364 Numpar* numpar=NULL; 4365 4142 4366 ParameterInputs* inputs=NULL; 4143 4367 … … 4145 4369 inputs=(ParameterInputs*)vinputs; 4146 4370 4371 /*recover objects from hooks: */ 4372 nodes=(Node**)hnodes.deliverp(); 4373 matpar=(Matpar*)hmatpar.delivers(); 4374 matice=(Matice*)hmatice.delivers(); 4375 numpar=(Numpar*)hnumpar.delivers(); 4376 4147 4377 /*Get out if shelf*/ 4148 if( shelf) return;4378 if(this->properties.shelf) return; 4149 4379 4150 4380 /* Get node coordinates and dof list: */ … … 4156 4386 4157 4387 /* recover input parameters: */ 4158 inputs->Recover("drag",& k[0],1,dofs1,numgrids,(void**)nodes);4159 inputs->Recover("bed",& b[0],1,dofs1,numgrids,(void**)nodes);4160 inputs->Recover("thickness",& h[0],1,dofs1,numgrids,(void**)nodes);4388 inputs->Recover("drag",&this->properties.k[0],1,dofs1,numgrids,(void**)nodes); 4389 inputs->Recover("bed",&this->properties.b[0],1,dofs1,numgrids,(void**)nodes); 4390 inputs->Recover("thickness",&this->properties.h[0],1,dofs1,numgrids,(void**)nodes); 4161 4391 if(!inputs->Recover("velocity",&vxvy_list[0][0],2,dofs2,numgrids,(void**)nodes)){ 4162 4392 ISSMERROR("missing velocity input parameter"); … … 4195 4425 4196 4426 /*Build alpha_complement_list: */ 4197 if (! shelf && (friction_type==2)){4427 if (!this->properties.shelf && (this->properties.friction_type==2)){ 4198 4428 4199 4429 /*Allocate friction object: */ … … 4207 4437 friction->rho_ice=matpar->GetRhoIce(); 4208 4438 friction->rho_water=matpar->GetRhoWater(); 4209 friction->K=& k[0];4210 friction->bed=& b[0];4211 friction->thickness=& h[0];4439 friction->K=&this->properties.k[0]; 4440 friction->bed=&this->properties.b[0]; 4441 friction->thickness=&this->properties.h[0]; 4212 4442 friction->velocities=&vxvy_list[0][0]; 4213 friction->p= p;4214 friction->q= q;4443 friction->p=this->properties.p; 4444 friction->q=this->properties.q; 4215 4445 4216 4446 if(friction->p!=1) ISSMERROR("non-linear friction not supported yet in control methods!"); … … 4230 4460 /*Recover alpha_complement and k: */ 4231 4461 GetParameterValue(&alpha_complement, &alpha_complement_list[0],gauss_l1l2l3); 4232 GetParameterValue(&drag, & k[0],gauss_l1l2l3);4462 GetParameterValue(&drag, &this->properties.k[0],gauss_l1l2l3); 4233 4463 #ifdef _ISSM_DEBUG_ 4234 4464 printf("Drag complement: %20.20lf Drag: %20.20lf\n",alpha_complement,drag); … … 4262 4492 4263 4493 /*Get k derivative: dk/dx */ 4264 GetParameterDerivativeValue(&dk[0], & k[0],&xyz_list[0][0], gauss_l1l2l3);4494 GetParameterDerivativeValue(&dk[0], &this->properties.k[0],&xyz_list[0][0], gauss_l1l2l3); 4265 4495 4266 4496 /*Build gradje_g_gaussian vector (actually -dJ/ddrag): */ … … 4362 4592 ParameterInputs* inputs=NULL; 4363 4593 4594 /*dynamic objects pointed to by hooks: */ 4595 Node** nodes=NULL; 4596 Matpar* matpar=NULL; 4597 Matice* matice=NULL; 4598 Numpar* numpar=NULL; 4599 4364 4600 /*Get out if shelf*/ 4365 if( shelf) return;4601 if(this->properties.shelf) return; 4366 4602 4367 4603 /*recover pointers: */ 4368 4604 inputs=(ParameterInputs*)vinputs; 4605 4606 /*recover objects from hooks: */ 4607 nodes=(Node**)hnodes.deliverp(); 4608 matpar=(Matpar*)hmatpar.delivers(); 4609 matice=(Matice*)hmatice.delivers(); 4610 numpar=(Numpar*)hnumpar.delivers(); 4369 4611 4370 4612 /* Get node coordinates and dof list: */ … … 4376 4618 4377 4619 /* recover input parameters: */ 4378 inputs->Recover("drag",& k[0],1,dofs1,numgrids,(void**)nodes);4379 inputs->Recover("bed",& b[0],1,dofs1,numgrids,(void**)nodes);4380 inputs->Recover("thickness",& h[0],1,dofs1,numgrids,(void**)nodes);4620 inputs->Recover("drag",&this->properties.k[0],1,dofs1,numgrids,(void**)nodes); 4621 inputs->Recover("bed",&this->properties.b[0],1,dofs1,numgrids,(void**)nodes); 4622 inputs->Recover("thickness",&this->properties.h[0],1,dofs1,numgrids,(void**)nodes); 4381 4623 if(!inputs->Recover("velocity",&vxvyvz_list[0][0],3,dofs3,numgrids,(void**)nodes)){ 4382 4624 ISSMERROR("missing velocity input parameter"); … … 4417 4659 4418 4660 /*Build alpha_complement_list: */ 4419 if (! shelf && (friction_type==2)){4661 if (!this->properties.shelf && (this->properties.friction_type==2)){ 4420 4662 4421 4663 /*Allocate friction object: */ … … 4429 4671 friction->rho_ice=matpar->GetRhoIce(); 4430 4672 friction->rho_water=matpar->GetRhoWater(); 4431 friction->K=& k[0];4432 friction->bed=& b[0];4433 friction->thickness=& h[0];4673 friction->K=&this->properties.k[0]; 4674 friction->bed=&this->properties.b[0]; 4675 friction->thickness=&this->properties.h[0]; 4434 4676 friction->velocities=&vxvyvz_list[0][0]; 4435 friction->p= p;4436 friction->q= q;4677 friction->p=this->properties.p; 4678 friction->q=this->properties.q; 4437 4679 4438 4680 if(friction->p!=1) ISSMERROR("non-linear friction not supported yet in control methods!"); … … 4452 4694 /*Recover alpha_complement and k: */ 4453 4695 GetParameterValue(&alpha_complement, &alpha_complement_list[0],gauss_l1l2l3); 4454 GetParameterValue(&drag, & k[0],gauss_l1l2l3);4696 GetParameterValue(&drag, &this->properties.k[0],gauss_l1l2l3); 4455 4697 #ifdef _ISSM_DEBUG_ 4456 4698 printf("Drag complement: %20.20lf Drag: %20.20lf\n",alpha_complement,drag); … … 4493 4735 4494 4736 /*Get k derivative: dk/dx */ 4495 GetParameterDerivativeValue(&dk[0], & k[0],&xyz_list[0][0], gauss_l1l2l3);4737 GetParameterDerivativeValue(&dk[0], &this->properties.k[0],&xyz_list[0][0], gauss_l1l2l3); 4496 4738 4497 4739 /*Build gradje_g_gaussian vector (actually -dJ/ddrag): */ … … 4555 4797 double rho_ice; 4556 4798 4799 /*dynamic objects pointed to by hooks: */ 4800 Node** nodes=NULL; 4801 Matpar* matpar=NULL; 4802 4803 /*recover objects from hooks: */ 4804 nodes=(Node**)hnodes.deliverp(); 4805 matpar=(Matpar*)hmatpar.delivers(); 4806 4557 4807 /*Get material parameters :*/ 4558 rho_ice= this->matpar->GetRhoIce();4808 rho_ice=matpar->GetRhoIce(); 4559 4809 4560 4810 /*First off, check that this segment belongs to this element: */ … … 4588 4838 4589 4839 /*get thickness and velocity at two segment extremities: */ 4590 GetParameterValue(&h1, & h[0],gauss_1);4591 GetParameterValue(&h2, & h[0],gauss_2);4840 GetParameterValue(&h1, &this->properties.h[0],gauss_1); 4841 GetParameterValue(&h2, &this->properties.h[0],gauss_2); 4592 4842 GetParameterValue(&vx1, &vx_list[0],gauss_1); 4593 4843 GetParameterValue(&vy1, &vy_list[0],gauss_1); … … 4605 4855 /*FUNCTION MaticeConfiguration {{{1*/ 4606 4856 void Tria::MaticeConfiguration(Matice* tria_matice,int tria_matice_offset){ 4607 matice=tria_matice; 4608 matice_offset=tria_matice_offset; 4857 4858 /*dynamic objects pointed to by hooks: */ 4859 Matice* matice=NULL; 4860 4861 /*recover objects from hooks: */ 4862 matice=(Matice*)hmatice.delivers(); 4863 4864 ISSMERROR("not supported yet!"); 4865 4866 /*matice=tria_matice; 4867 matice_offset=tria_matice_offset;*/ 4868 4609 4869 } 4610 4870 /*}}}*/ … … 4612 4872 void Tria::MatparConfiguration(Matpar* tria_matpar,int tria_matpar_offset){ 4613 4873 4614 matpar=tria_matpar; 4615 matpar_offset=tria_matpar_offset; 4874 /*dynamic objects pointed to by hooks: */ 4875 Matpar* matpar=NULL; 4876 4877 /*recover objects from hooks: */ 4878 matpar=(Matpar*)hmatpar.delivers(); 4879 4880 ISSMERROR("not supported yet!"); 4881 4882 /*matpar=tria_matpar; 4883 matpar_offset=tria_matpar_offset;*/ 4616 4884 4617 4885 } … … 4667 4935 ParameterInputs* inputs=NULL; 4668 4936 4937 /*dynamic objects pointed to by hooks: */ 4938 Node** nodes=NULL; 4939 Matpar* matpar=NULL; 4940 Matice* matice=NULL; 4941 Numpar* numpar=NULL; 4942 4669 4943 /*If on water, return 0: */ 4670 if( onwater)return 0;4944 if(this->properties.onwater)return 0; 4671 4945 4672 4946 /*recover pointers: */ 4673 4947 inputs=(ParameterInputs*)vinputs; 4948 4949 /*recover objects from hooks: */ 4950 nodes=(Node**)hnodes.deliverp(); 4951 matpar=(Matpar*)hmatpar.delivers(); 4952 matice=(Matice*)hmatice.delivers(); 4953 numpar=(Numpar*)hnumpar.delivers(); 4674 4954 4675 4955 /* Get node coordinates and dof list: */ … … 4824 5104 void Tria::NodeConfiguration(int* tria_node_ids,Node* tria_nodes[3],int* tria_node_offsets){ 4825 5105 4826 int i; 5106 /*dynamic objects pointed to by hooks: */ 5107 Node** nodes=NULL; 5108 5109 /*recover objects from hooks: */ 5110 nodes=(Node**)hnodes.deliverp(); 5111 5112 ISSMERROR("not supported yet!"); 5113 5114 /*int i; 4827 5115 for(i=0;i<3;i++){ 4828 5116 node_ids[i]=tria_node_ids[i]; 4829 5117 nodes[i]=tria_nodes[i]; 4830 5118 node_offsets[i]=tria_node_offsets[i]; 4831 } 5119 }*/ 4832 5120 4833 5121 } … … 4836 5124 void Tria::NumparConfiguration(Numpar* tria_numpar,int tria_numpar_offset){ 4837 5125 4838 numpar=tria_numpar; 4839 numpar_offset=tria_numpar_offset; 5126 /*dynamic objects pointed to by hooks: */ 5127 Numpar* numpar=NULL; 5128 5129 /*recover objects from hooks: */ 5130 numpar=(Numpar*)hnumpar.delivers(); 5131 5132 ISSMERROR("not supported yet!"); 5133 5134 /*numpar=tria_numpar; 5135 numpar_offset=tria_numpar_offset;*/ 4840 5136 4841 5137 } … … 4883 5179 double normal[3]; 4884 5180 5181 /*dynamic objects pointed to by hooks: */ 5182 Node** nodes=NULL; 5183 5184 /*recover objects from hooks: */ 5185 nodes=(Node**)hnodes.deliverp(); 5186 4885 5187 /*If on water, return 0: */ 4886 if( onwater)return 0;5188 if(this->properties.onwater)return 0; 4887 5189 4888 5190 /* Get node coordinates and dof list: */ … … 4915 5217 double new_h[3]; 4916 5218 5219 /*dynamic objects pointed to by hooks: */ 5220 Node** nodes=NULL; 5221 Matpar* matpar=NULL; 5222 Matice* matice=NULL; 5223 Numpar* numpar=NULL; 5224 4917 5225 ParameterInputs* inputs=NULL; 4918 5226 4919 5227 /*recover pointers: */ 4920 5228 inputs=(ParameterInputs*)vinputs; 5229 5230 /*recover objects from hooks: */ 5231 nodes=(Node**)hnodes.deliverp(); 5232 matpar=(Matpar*)hmatpar.delivers(); 5233 matice=(Matice*)hmatice.delivers(); 5234 numpar=(Numpar*)hnumpar.delivers(); 4921 5235 4922 5236 /*Update internal data if inputs holds new values: */ 4923 5237 //if (id==1) printf("WARNING if QMU: no hydrostatic equilibrium is applied here (conflict with prognostic, which does not have matpar)\n"); 4924 5238 //For now 4925 inputs->Recover("thickness",& h[0],1,dofs,3,(void**)nodes);5239 inputs->Recover("thickness",&this->properties.h[0],1,dofs,3,(void**)nodes); 4926 5240 //Later 4927 5241 /* … … 4931 5245 //Go through grids: 4932 5246 for (i=0;i<3;i++){ 4933 if( this->nodes[i]->IsOnShelf()){5247 if(nodes[i]->IsOnShelf()){ 4934 5248 this->b[i]=this->b[i]-di*(new_h[i]-h[i]); //hydrostatic equilibrium; 4935 5249 } … … 4939 5253 } 4940 5254 */ 4941 inputs->Recover("surface",& s[0],1,dofs,3,(void**)nodes);4942 inputs->Recover("bed",& b[0],1,dofs,3,(void**)nodes);4943 inputs->Recover("drag",& k[0],1,dofs,3,(void**)nodes);4944 inputs->Recover("melting",& melting[0],1,dofs,3,(void**)nodes);4945 inputs->Recover("accumulation",& accumulation[0],1,dofs,3,(void**)nodes);4946 inputs->Recover("geothermalflux",& geothermalflux[0],1,dofs,3,(void**)nodes);5255 inputs->Recover("surface",&this->properties.s[0],1,dofs,3,(void**)nodes); 5256 inputs->Recover("bed",&this->properties.b[0],1,dofs,3,(void**)nodes); 5257 inputs->Recover("drag",&this->properties.k[0],1,dofs,3,(void**)nodes); 5258 inputs->Recover("melting",&this->properties.melting[0],1,dofs,3,(void**)nodes); 5259 inputs->Recover("accumulation",&this->properties.accumulation[0],1,dofs,3,(void**)nodes); 5260 inputs->Recover("geothermalflux",&this->properties.geothermalflux[0],1,dofs,3,(void**)nodes); 4947 5261 4948 5262 //Update material if necessary -
issm/trunk/src/c/objects/Tria.h
r3359 r3383 8 8 9 9 #include "./Element.h" 10 #include "../DataSet/DataSet.h" 11 #include "./Object.h" 10 12 #include "./Node.h" 11 13 #include "./Matice.h" … … 13 15 #include "./Numpar.h" 14 16 #include "./ParameterInputs.h" 17 #include "./ElementProperties.h" 18 #include "./Hook.h" 19 20 class Object; 21 class Hook; 22 class ElementProperties; 23 class DataSet; 15 24 16 25 class Tria: public Element{ … … 18 27 private: 19 28 20 /*ids:*/ 21 int id; 29 int id; 22 30 23 /*nodes: */24 int node_ids[3]; //node ids25 Node* nodes[3]; //node pointers26 int node_offsets[3]; //node offsets in nodes dataset31 Hook hnodes; //hook to 3 nodes 32 Hook hmatice; //hook to 1 matice 33 Hook hmatpar; //hook to 1 matpar 34 Hook hnumpar; //hook to 1 numpar 27 35 28 /*materials: */ 29 int mid; 30 Matice* matice; 31 int matice_offset; 32 33 int mparid; 34 Matpar* matpar; 35 int matpar_offset; 36 37 int numparid; 38 Numpar* numpar; 39 int numpar_offset; 36 ElementProperties properties; 40 37 41 double h[3];42 double s[3];43 double b[3];44 double k[3];45 double melting[3];46 double accumulation[3];47 double geothermalflux[3];48 int friction_type;49 double p;50 double q;51 int shelf;52 int onbed;53 bool onwater;54 55 38 public: 56 39 40 /*FUNCTION constructors, destructors {{{1*/ 57 41 Tria(); 58 Tria(int id,int mid,int mparid,int numparid,int node_ids[3],double h[3],double s[3],double b[3],double k[3],double melting[3],double accumulation[3],double geothermalflux[3],int friction_type,double p,double q,int shelf,bool onwater); 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); 59 44 ~Tria(); 60 45 /*}}}*/ 46 /*FUNCTION object management {{{1*/ 61 47 void Echo(); 62 48 void DeepEcho(); … … 68 54 int GetId(); 69 55 int MyRank(); 56 /*}}}*/ 57 /*FUNCTION element numerical routines {{{1*/ 70 58 void Configure(void* loads,void* nodes,void* materials,void* parameters); 71 59 void CreateKMatrix(Mat Kgg,void* inputs,int analysis_type,int sub_analysis_type); … … 134 122 double GetArea(void); 135 123 double GetAreaCoordinate(double x, double y, int which_one); 124 /*}}}*/ 136 125 137 126 }; -
issm/trunk/src/m/classes/public/plot/applyoptions.m
r3200 r3383 90 90 %Caxis 91 91 if exist(options,'caxis'), 92 if exist(options,'log'), 93 logvalue=getfieldvalue(options,'log'); 94 if any(getfieldvalue(options,'caxis')<=0), 95 error('applyoptions error message: negative log values when trying to apply caxis option'); 96 end 97 caxis(log(getfieldvalue(options,'caxis'))/log(logvalue)); 98 else 99 caxis(getfieldvalue(options,'caxis')); 100 end 92 caxis(getfieldvalue(options,'caxis')); 101 93 end 102 94 -
issm/trunk/src/m/enum/PentaEnum.m
r1714 r3383 7 7 % macro=PentaEnum() 8 8 9 macro=41 2;9 macro=413; -
issm/trunk/todo
r3178 r3383 82 82 83 83 Get Matlab 7.8: version 4.2.3 84 Use gprof to figure out where we are losing out time. 84 Use gprof to figure out where we are losing out time. 85 86 Get rid of ResolvePointers
Note:
See TracChangeset
for help on using the changeset viewer.