Changeset 3805
- Timestamp:
- 05/18/10 11:25:43 (15 years ago)
- Location:
- issm/trunk/src/c/objects/Elements
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/objects/Elements/Penta.cpp
r3791 r3805 3 3 */ 4 4 5 /*Headers:*/ 6 /*{{{1*/ 5 7 #ifdef HAVE_CONFIG_H 6 8 #include "config.h" … … 16 18 #include "../../include/include.h" 17 19 #include "../../DataSet/DataSet.h" 20 /*}}}*/ 18 21 19 22 /*Object constructors and destructor*/ 20 23 /*FUNCTION Penta::Penta(){{{1*/ 21 24 Penta::Penta(){ 25 this->nodes=NULL; 26 this->matice=NULL; 27 this->matpar=NULL; 28 22 29 this->inputs=NULL; 23 30 this->parameters=NULL; 24 31 } 25 32 /*}}}*/ 26 /*FUNCTION Penta::Penta(int id, Hook* hnodes, Hook* hmatice, Hook* hmatpar, Parameters* parameters, Inputs* penta_inputs) {{{1*/ 27 Penta::Penta(int penta_id,Hook* penta_hnodes, Hook* penta_hmatice, Hook* penta_hmatpar, Parameters* penta_parameters, Inputs* penta_inputs): 28 hnodes(penta_hnodes), 29 hmatice(penta_hmatice), 30 hmatpar(penta_hmatpar) 31 { 32 33 /*all the initialization has been done by the initializer, just fill in the id: */ 34 this->id=penta_id; 35 if(penta_inputs){ 36 this->inputs=(Inputs*)penta_inputs->Copy(); 37 } 38 else{ 39 this->inputs=new Inputs(); 40 } 41 /*point parameters: */ 42 this->parameters=penta_parameters; 33 /*FUNCTION Penta::~Penta(){{{1*/ 34 Penta::~Penta(){ 35 delete inputs; 36 this->parameters=NULL; 43 37 } 44 38 /*}}}*/ … … 63 57 penta_matpar_id=iomodel->numberofelements+1; //refers to the constant material parameters object 64 58 65 this-> hnodes.Init(&penta_node_ids[0],6);66 this-> hmatice.Init(&penta_matice_id,1);67 this-> hmatpar.Init(&penta_matpar_id,1);59 this->InitHookNodes(penta_node_ids); this->nodes=NULL; 60 this->InitHookMatice(penta_matice_id);this->matice=NULL; 61 this->InitHookMatpar(penta_matpar_id);this->matpar=NULL; 68 62 69 63 //intialize inputs, and add as many inputs per element as requested: … … 181 175 } 182 176 /*}}}*/ 183 /*FUNCTION Penta::~Penta(){{{1*/ 184 Penta::~Penta(){ 185 delete inputs; 186 this->parameters=NULL; 177 /*FUNCTION Penta::copy {{{1*/ 178 Object* Penta::copy() { 179 180 Penta* penta=NULL; 181 182 penta=new Penta(); 183 184 /*copy fields: */ 185 penta->id=this->id; 186 if(this->inputs){ 187 penta->inputs=(Inputs*)this->inputs->Copy(); 188 } 189 else{ 190 penta->inputs=new Inputs(); 191 } 192 /*point parameters: */ 193 penta->parameters=this->parameters; 194 195 /*now deal with hooks and objects: */ 196 penta->hnodes.copy(&this->hnodes); 197 penta->hmatice.copy(&this->hmatice); 198 penta->hmatpar.copy(&this->hmatpar); 199 200 /*recover objects: */ 201 penta->nodes=(Node**)penta->hnodes.deliverp(); 202 penta->matice=(Matice*)penta->hmatice.delivers(); 203 penta->matpar=(Matpar*)penta->hmatpar.delivers(); 204 205 return penta; 187 206 } 188 207 /*}}}*/ … … 192 211 void Penta::Configure(DataSet* loadsin, DataSet* nodesin, DataSet* materialsin, Parameters* parametersin){ 193 212 194 int i;195 196 213 /*Take care of hooking up all objects for this element, ie links the objects in the hooks to their respective 197 214 * datasets, using internal ids and offsets hidden in hooks: */ 198 hnodes.configure(nodesin); 199 hmatice.configure(materialsin); 200 hmatpar.configure(materialsin); 215 this->hnodes.configure(nodesin); 216 this->hmatice.configure(materialsin); 217 this->hmatpar.configure(materialsin); 218 219 /*Now, go pick up the objects inside the hooks: */ 220 this->nodes=(Node**)this->hnodes.deliverp(); 221 this->matice=(Matice*)this->hmatice.delivers(); 222 this->matpar=(Matpar*)this->hmatpar.delivers(); 201 223 202 224 /*point parameters to real dataset: */ … … 205 227 } 206 228 /*}}}*/ 207 /*FUNCTION copy {{{1*/ 208 Object* Penta::copy() { 209 return new Penta(this->id,&this->hnodes,&this->hmatice,&this->hmatpar,this->parameters,this->inputs); 210 } 211 /*}}}*/ 212 /*FUNCTION Demarshall {{{1*/ 229 /*FUNCTION Penta::Demarshall {{{1*/ 213 230 void Penta::Demarshall(char** pmarshalled_dataset){ 214 231 … … 229 246 hmatpar.Demarshall(&marshalled_dataset); 230 247 248 /*pointers are garbabe, until configuration is carried out: */ 249 nodes=NULL; 250 matice=NULL; 251 matpar=NULL; 252 231 253 /*demarshall inputs: */ 232 254 inputs=(Inputs*)DataSetDemarshallRaw(&marshalled_dataset); … … 240 262 } 241 263 /*}}}*/ 242 /*FUNCTION DeepEcho{{{1*/ 243 264 /*FUNCTION Penta::DeepEcho{{{1*/ 244 265 void Penta::DeepEcho(void){ 245 266 246 267 printf("Penta:\n"); 247 268 printf(" id: %i\n",id); 248 hnodes.DeepEcho(); 249 hmatice.DeepEcho(); 250 hmatpar.DeepEcho(); 269 nodes[0]->DeepEcho(); 270 nodes[1]->DeepEcho(); 271 nodes[2]->DeepEcho(); 272 nodes[3]->DeepEcho(); 273 nodes[4]->DeepEcho(); 274 nodes[5]->DeepEcho(); 275 matice->DeepEcho(); 276 matpar->DeepEcho(); 251 277 printf(" parameters\n"); 252 278 parameters->DeepEcho(); 253 279 printf(" inputs\n"); 254 280 inputs->DeepEcho(); 255 281 256 282 return; 257 283 } 258 284 /*}}}*/ 259 /*FUNCTION Echo{{{1*/285 /*FUNCTION Penta::Echo{{{1*/ 260 286 261 287 void Penta::Echo(void){ 262 263 printf("Penta:\n"); 264 printf(" id: %i\n",id); 265 hnodes.Echo(); 266 hmatice.Echo(); 267 hmatpar.Echo(); 268 printf(" parameters\n"); 269 parameters->Echo(); 270 printf(" inputs\n"); 271 inputs->Echo(); 272 288 this->DeepEcho(); 273 289 } 274 290 /*}}}*/ … … 553 569 double stokesreconditioning; 554 570 555 /*dynamic objects pointed to by hooks: */556 Node** nodes=NULL;557 Matpar* matpar=NULL;558 Matice* matice=NULL;559 560 571 /*Check analysis_types*/ 561 572 if (analysis_type!=DiagnosticAnalysisEnum || sub_analysis_type!=StokesAnalysisEnum) ISSMERROR("Not supported yet!"); 562 563 /*recover objects from hooks: */564 nodes=(Node**)hnodes.deliverp();565 matpar=(Matpar*)hmatpar.delivers();566 matice=(Matice*)hmatice.delivers();567 573 568 574 /*recover some inputs: */ … … 652 658 /*inputs: */ 653 659 bool onwater; 654 655 /*dynamic objects pointed to by hooks: */656 Node** nodes=NULL;657 Matpar* matpar=NULL;658 659 /*recover objects from hooks: */660 nodes=(Node**)hnodes.deliverp();661 matpar=(Matpar*)hmatpar.delivers();662 660 663 661 /*retrieve inputs :*/ … … 938 936 /*Collapsed formulation: */ 939 937 Tria* tria=NULL; 940 941 /*dynamic objects pointed to by hooks: */942 Node** nodes=NULL;943 Matice* matice=NULL;944 945 /*recover objects from hooks: */946 nodes=(Node**)hnodes.deliverp();947 matice=(Matice*)hmatice.delivers();948 938 949 939 /*inputs: */ … … 1174 1164 double stokesreconditioning; 1175 1165 1176 /*dynamic objects pointed to by hooks: */1177 Node** nodes=NULL;1178 Matpar* matpar=NULL;1179 Matice* matice=NULL;1180 1181 1166 /*inputs: */ 1182 1167 bool onwater; … … 1191 1176 /*If on water, skip stiffness: */ 1192 1177 if(onwater)return; 1193 1194 /*recover objects from hooks: */1195 nodes=(Node**)hnodes.deliverp();1196 matpar=(Matpar*)hmatpar.delivers();1197 matice=(Matice*)hmatice.delivers();1198 1199 1178 1200 1179 /*recovre material parameters: */ … … 1438 1417 double Bprime[NDOF1][numgrids]; 1439 1418 double DL_scalar; 1440 1441 /*dynamic objects pointed to by hooks: */1442 Node** nodes=NULL;1443 1444 /*recover objects from hooks: */1445 nodes=(Node**)hnodes.deliverp();1446 1419 1447 1420 /*Collapsed formulation: */ … … 1688 1661 double dt,artdiff,epsvel; 1689 1662 1690 /*dynamic objects pointed to by hooks: */1691 Node** nodes=NULL;1692 Matpar* matpar=NULL;1693 1694 1663 /*Collapsed formulation: */ 1695 1664 Tria* tria=NULL; … … 1708 1677 /*If on water, skip: */ 1709 1678 if(onwater)return; 1710 1711 /*recover objects from hooks: */1712 nodes=(Node**)hnodes.deliverp();1713 matpar=(Matpar*)hmatpar.delivers();1714 1679 1715 1680 /* Get node coordinates and dof list: */ … … 2025 1990 double pe_g_gaussian[numdof]; 2026 1991 2027 /*dynamic objects pointed to by hooks: */2028 Node** nodes=NULL;2029 Matpar* matpar=NULL;2030 2031 1992 /*Spawning: */ 2032 1993 Tria* tria=NULL; … … 2044 2005 /*If on water, skip load: */ 2045 2006 if(onwater)return; 2046 2047 /*recover objects from hooks: */2048 nodes=(Node**)hnodes.deliverp();2049 matpar=(Matpar*)hmatpar.delivers();2050 2051 2007 2052 2008 /*Figure out if this pentaelem is collapsed. If so, then bailout, except if it is at the … … 2205 2161 Tria* tria=NULL; 2206 2162 2207 /*dynamic objects pointed to by hooks: */2208 Node** nodes=NULL;2209 Matpar* matpar=NULL;2210 Matice* matice=NULL;2211 2212 2163 /*parameters: */ 2213 2164 double stokesreconditioning; … … 2228 2179 /*If on water, skip load: */ 2229 2180 if(onwater)return; 2230 2231 /*recover objects from hooks: */2232 nodes=(Node**)hnodes.deliverp();2233 matpar=(Matpar*)hmatpar.delivers();2234 matice=(Matice*)hmatice.delivers();2235 2236 2181 2237 2182 /*recovre material parameters: */ … … 2438 2383 int dofs2[1]={1}; 2439 2384 2440 /*dynamic objects pointed to by hooks: */2441 Node** nodes=NULL;2442 2443 2385 /*inputs: */ 2444 2386 bool onwater; 2445 2387 bool onbed; 2446 2447 /*recover objects from hooks: */2448 nodes=(Node**)hnodes.deliverp();2449 2388 2450 2389 /*retrieve inputs :*/ … … 2657 2596 double dt; 2658 2597 2659 /*dynamic objects pointed to by hooks: */2660 Node** nodes=NULL;2661 Matpar* matpar=NULL;2662 Matice* matice=NULL;2663 2664 2598 /*inputs: */ 2665 2599 bool onwater; … … 2677 2611 /*If on water, skip: */ 2678 2612 if(onwater)return; 2679 2680 /*recover objects from hooks: */2681 nodes=(Node**)hnodes.deliverp();2682 matpar=(Matpar*)hmatpar.delivers();2683 matice=(Matice*)hmatice.delivers();2684 2613 2685 2614 /* Get node coordinates and dof list: */ … … 2833 2762 int i; 2834 2763 int extrude=0; 2835 2836 /*dynamic objects pointed to by hooks: */2837 Node** nodes=NULL;2838 2839 /*recover objects from hooks: */2840 nodes=(Node**)hnodes.deliverp();2841 2764 2842 2765 /*inputs: */ … … 3394 3317 int numberofdofspernode; 3395 3318 3396 /*dynamic objects pointed to by hooks: */3397 Node** nodes=NULL;3398 3399 /*recover objects from hooks: */3400 nodes=(Node**)hnodes.deliverp();3401 3402 3319 for(i=0;i<6;i++){ 3403 3320 nodes[i]->GetDofList(&doflist_per_node[0],&numberofdofspernode); … … 3416 3333 3417 3334 int i; 3418 /*dynamic objects pointed to by hooks: */3419 Node** nodes=NULL;3420 3421 /*recover objects from hooks: */3422 nodes=(Node**)hnodes.deliverp();3423 3335 3424 3336 for(i=0;i<6;i++){ … … 3727 3639 void* Penta::GetMatPar(){ 3728 3640 3729 /*dynamic objects pointed to by hooks: */3730 Matpar* matpar=NULL;3731 3732 /*recover objects from hooks: */3733 matpar=(Matpar*)hmatpar.delivers();3734 3735 3641 return matpar; 3736 3642 } … … 3984 3890 int i; 3985 3891 Node** pnodes=NULL; 3986 /*dynamic objects pointed to by hooks: */3987 Node** nodes=NULL;3988 3989 /*recover objects from hooks: */3990 nodes=(Node**)hnodes.deliverp();3991 3892 3992 3893 /*virtual object: */ -
issm/trunk/src/c/objects/Elements/Penta.h
r3783 r3805 8 8 /*Headers:*/ 9 9 /*{{{1*/ 10 11 #include ". ./Elements/Element.h"10 #include "./Element.h" 11 #include "./PentaHook.h" 12 12 class Object; 13 class Hook; 14 class Parameters; 15 class Inputs; 16 13 class Parameters; 14 class Inputs; 17 15 class IoModel; 16 class Node; 17 class Matice; 18 class Matpar; 18 19 19 20 #include "../../shared/Exceptions/exceptions.h" … … 22 23 /*}}}*/ 23 24 24 class Penta: public Element {25 class Penta: public Element,public PentaHook{ 25 26 26 27 public: 27 28 28 29 int id; 29 Hook hnodes; //hook to 6 nodes 30 Hook hmatice; //hook to 1 matice 31 Hook hmatpar; //hook to 1 matpar 30 31 Node** nodes; // 6 nodes 32 Matice* matice; // 1 material ice 33 Matpar* matpar; // 1 material parameter 32 34 33 35 Parameters* parameters; //pointer to solution parameters … … 36 38 /*FUNCTION constructors, destructors {{{1*/ 37 39 Penta(); 38 Penta(int penta_id,Hook* penta_hnodes, Hook* penta_hmatice, Hook* penta_hmatpar, Parameters* penta_parameters, Inputs* inputs);39 40 Penta(int penta_id,int i, IoModel* iomodel); 40 41 ~Penta(); -
issm/trunk/src/c/objects/Elements/Tria.cpp
r3803 r3805 66 66 tria_matpar_id=iomodel->numberofelements+1; //refers to the constant material parameters object 67 67 68 this->InitHookNodes(tria_node_ids); 69 this->InitHookMatice(tria_matice_id); 70 this->InitHookMatpar(tria_matpar_id); 68 this->InitHookNodes(tria_node_ids); this->nodes=NULL; 69 this->InitHookMatice(tria_matice_id);this->matice=NULL; 70 this->InitHookMatpar(tria_matpar_id);this->matpar=NULL; 71 71 72 72 //intialize inputs, and add as many inputs per element as requested: -
issm/trunk/src/c/objects/Elements/Tria.h
r3791 r3805 27 27 int id; 28 28 29 Node** nodes; 30 Matice* matice; 31 Matpar* matpar; 32 29 Node** nodes; // 3 nodes 30 Matice* matice; // 1 material ice 31 Matpar* matpar; // 1 material parameter 32 33 33 Parameters* parameters; //pointer to solution parameters 34 34 Inputs* inputs; … … 36 36 /*FUNCTION constructors, destructors {{{1*/ 37 37 Tria(); 38 Tria(int tria_id,Node* tria_nodes, Matice* tria_matice, Matpar* tria_matpar, Parameters* parameters, Inputs* tria_inputs);39 38 Tria(int tria_id,int i, IoModel* iomodel); 40 39 ~Tria(); -
issm/trunk/src/c/objects/Elements/TriaHook.h
r3791 r3805 11 11 12 12 public: 13 Hook hnodes; 14 Hook hmatice; 15 Hook hmatpar; 13 Hook hnodes; // 3 nodes 14 Hook hmatice; // 1 ice material 15 Hook hmatpar; // 1 material parameter 16 16 17 17
Note:
See TracChangeset
for help on using the changeset viewer.