Changeset 4396
- Timestamp:
- 07/04/10 12:39:52 (15 years ago)
- Location:
- issm/trunk/src/c/objects
- Files:
-
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/objects/Elements/Penta.cpp
r4395 r4396 41 41 /*}}}*/ 42 42 /*FUNCTION Penta::Penta(int id, int index, IoModel* iomodel,int nummodels) {{{1*/ 43 Penta::Penta(int penta_id, int index, IoModel* iomodel,int nummodels){ //i is the element index 44 45 IssmInt i; 46 int penta_matice_id; 47 int penta_matpar_id; 43 Penta::Penta(int penta_id, int index, IoModel* iomodel,int nummodels): 44 45 PentaHook(nummodels,index+1,iomodel->numberofelements+1) //index+1: matice id, iomodel->numberofelements+1: matpar id 46 { //i is the element index 47 48 int i; 48 49 int penta_elements_ids[2]; 49 50 … … 51 52 this->id=penta_id; 52 53 53 /*hooks: */ 54 penta_matice_id=index+1; //refers to the corresponding ice material object 55 penta_matpar_id=iomodel->numberofelements+1; //refers to the constant material parameters object 56 54 /*penta_elements_ids: */ 57 55 if isnan(iomodel->upperelements[index]){ 58 56 penta_elements_ids[1]=this->id; //upper penta is the same penta … … 68 66 penta_elements_ids[0]=(int)(iomodel->lowerelements[index]); 69 67 } 70 this->InitHookNodes(nummodels);this->nodes=NULL; 71 this->InitHookMatice(penta_matice_id);this->matice=NULL; 72 this->InitHookMatpar(penta_matpar_id);this->matpar=NULL; 73 this->InitHookNeighbors(penta_elements_ids);this->neighbors=NULL; 68 this->InitHookNeighbors(penta_elements_ids); 74 69 75 70 //this->parameters: we still can't point to it, it may not even exist. Configure will handle this. … … 79 74 this->inputs=new Inputs(); 80 75 this->results=new Results(); 76 77 /*initialize pointers:*/ 78 this->nodes=NULL; 79 this->matice=NULL; 80 this->matpar=NULL; 81 this->neighbors=NULL; 81 82 } 82 83 /*}}}*/ … … 92 93 penta=new Penta(); 93 94 94 /*copy fields: */ 95 //deal with PentaHook mother class 96 penta->numanalyses=this->numanalyses; 97 penta->hnodes=new Hook*[penta->numanalyses]; 98 for(i=0;i<penta->numanalyses;i++)penta->hnodes[i]=(Hook*)this->hnodes[i]->copy(); 99 penta->hmatice=(Hook*)this->hmatice->copy(); 100 penta->hmatpar=(Hook*)this->hmatpar->copy(); 101 penta->hneighbors=(Hook*)this->hneighbors->copy(); 102 103 /*deal with Penta copy fields: */ 95 104 penta->id=this->id; 96 105 if(this->inputs){ … … 109 118 penta->parameters=this->parameters; 110 119 111 /*now deal with hooks and objects: */112 penta->InitHookNodes(this->numanalyses);113 for(i=0;i<this->numanalyses;i++)penta->hnodes[i].copy(&this->hnodes[i]);114 penta->hmatice.copy(&this->hmatice);115 penta->hmatpar.copy(&this->hmatpar);116 penta->hneighbors.copy(&this->hneighbors);117 118 120 /*recover objects: */ 119 121 penta->nodes=(Node**)xmalloc(6*sizeof(Node*)); //we cannot rely on an analysis_counter to tell us which analysis_type we are running, so we just copy the nodes. 120 122 for(i=0;i<6;i++)penta->nodes[i]=this->nodes[i]; 121 penta->matice=(Matice*)penta->hmatice .delivers();122 penta->matpar=(Matpar*)penta->hmatpar .delivers();123 penta->neighbors=(Penta**)penta->hneighbors .deliverp();123 penta->matice=(Matice*)penta->hmatice->delivers(); 124 penta->matpar=(Matpar*)penta->hmatpar->delivers(); 125 penta->neighbors=(Penta**)penta->hneighbors->deliverp(); 124 126 125 127 return penta; … … 167 169 168 170 /*allocate dynamic memory: */ 169 InitHookNodes(numanalyses); 170 171 this->hnodes=new Hook*[this->numanalyses]; 171 172 /*demarshall hooks: */ 172 for(i=0;i<numanalyses;i++)hnodes[i].Demarshall(&marshalled_dataset); 173 hmatice.Demarshall(&marshalled_dataset); 174 hmatpar.Demarshall(&marshalled_dataset); 175 hneighbors.Demarshall(&marshalled_dataset); 173 for(i=0;i<numanalyses;i++){ 174 hnodes[i]=new Hook(); 175 hnodes[i]->Demarshall(&marshalled_dataset); 176 } 177 hmatice=new Hook(); hmatice->Demarshall(&marshalled_dataset); 178 hmatpar=new Hook(); hmatpar->Demarshall(&marshalled_dataset); 179 hneighbors=new Hook(); hneighbors->Demarshall(&marshalled_dataset); 176 180 177 181 /*pointers are garbage, until configuration is carried out: */ … … 236 240 237 241 /*Marshall hooks: */ 238 for(i=0;i<numanalyses;i++)hnodes[i] .Marshall(&marshalled_dataset);239 hmatice .Marshall(&marshalled_dataset);240 hmatpar .Marshall(&marshalled_dataset);241 hneighbors .Marshall(&marshalled_dataset);242 for(i=0;i<numanalyses;i++)hnodes[i]->Marshall(&marshalled_dataset); 243 hmatice->Marshall(&marshalled_dataset); 244 hmatpar->Marshall(&marshalled_dataset); 245 hneighbors->Marshall(&marshalled_dataset); 242 246 243 247 /*Marshall inputs and results: */ … … 267 271 int hnodes_size=0;; 268 272 269 for(i=0;i<numanalyses;i++)hnodes_size+=hnodes[i] .MarshallSize();273 for(i=0;i<numanalyses;i++)hnodes_size+=hnodes[i]->MarshallSize(); 270 274 271 275 return sizeof(id) 272 276 +hnodes_size 273 277 +sizeof(numanalyses) 274 +hmatice .MarshallSize()275 +hmatpar .MarshallSize()276 +hneighbors .MarshallSize()278 +hmatice->MarshallSize() 279 +hmatpar->MarshallSize() 280 +hneighbors->MarshallSize() 277 281 +inputs->MarshallSize() 278 282 +results->MarshallSize() … … 599 603 /*Take care of hooking up all objects for this element, ie links the objects in the hooks to their respective 600 604 * datasets, using internal ids and offsets hidden in hooks: */ 601 this->hnodes[analysis_counter] .configure(nodesin);602 this->hmatice .configure(materialsin);603 this->hmatpar .configure(materialsin);604 this->hneighbors .configure(elementsin);605 this->hnodes[analysis_counter]->configure(nodesin); 606 this->hmatice->configure(materialsin); 607 this->hmatpar->configure(materialsin); 608 this->hneighbors->configure(elementsin); 605 609 606 610 /*Now, go pick up the objects inside the hooks: */ 607 this->nodes=(Node**)this->hnodes[analysis_counter] .deliverp();608 this->matice=(Matice*)this->hmatice .delivers();609 this->matpar=(Matpar*)this->hmatpar .delivers();610 this->neighbors=(Penta**)this->hneighbors .deliverp();611 this->nodes=(Node**)this->hnodes[analysis_counter]->deliverp(); 612 this->matice=(Matice*)this->hmatice->delivers(); 613 this->matpar=(Matpar*)this->hmatpar->delivers(); 614 this->neighbors=(Penta**)this->hneighbors->deliverp(); 611 615 612 616 /*point parameters to real dataset: */ … … 1779 1783 /*Penta specific routines: */ 1780 1784 /*FUNCTION Penta::SpawnTria {{{1*/ 1781 void* Penta::SpawnTria(int g0, int g1, int g2){1785 Tria* Penta::SpawnTria(int g0, int g1, int g2){ 1782 1786 1783 1787 int i; … … 1811 1815 1812 1816 /*recover nodes, matice and matpar: */ 1813 tria->nodes=(Node**)tria->hnodes[analysis_counter] .deliverp();1814 tria->matice=(Matice*)tria->hmatice .delivers();1815 tria->matpar=(Matpar*)tria->hmatpar .delivers();1817 tria->nodes=(Node**)tria->hnodes[analysis_counter]->deliverp(); 1818 tria->matice=(Matice*)tria->hmatice->delivers(); 1819 tria->matpar=(Matpar*)tria->hmatpar->delivers(); 1816 1820 1817 1821 return tria; -
issm/trunk/src/c/objects/Elements/Penta.h
r4395 r4396 17 17 class Matice; 18 18 class Matpar; 19 class Tria; 19 20 20 21 #include "../../shared/Exceptions/exceptions.h" … … 185 186 void* SpawnBeam(int g0, int g1); 186 187 void* SpawnSing(int g0); 187 void* SpawnTria(int g0, int g1, int g2);188 Tria* SpawnTria(int g0, int g1, int g2); 188 189 void SurfaceNormal(double* surface_normal, double xyz_list[3][3]); 189 190 void UpdateFromDakota(void* inputs); -
issm/trunk/src/c/objects/Elements/PentaHook.cpp
r4378 r4396 25 25 numanalyses=UNDEF; 26 26 this->hnodes=NULL; 27 this->hmatice=NULL; 28 this->hmatpar=NULL; 29 this->hneighbors=NULL; 27 30 } 28 31 /*}}}*/ 29 32 /*FUNCTION PentaHook::~PentaHook(){{{1*/ 30 33 PentaHook::~PentaHook(){ 34 35 int i; 36 37 for(i=0;i<this->numanalyses;i++){ 38 delete this->hnodes[i]; 39 } 31 40 delete [] this->hnodes; 41 delete hmatice; 42 delete hmatpar; 43 delete hneighbors; 32 44 } 33 45 /*}}}*/ 34 /*FUNCTION PentaHook:: InitHookNodes(int numanalyses){{{1*/35 void PentaHook::InitHookNodes(int in_numanalyses){36 46 /*FUNCTION PentaHook::PentaHook(int in_numanalyses,int matice_id, int matpar_id){{{1*/ 47 PentaHook::PentaHook(int in_numanalyses,int matice_id, int matpar_id){ 48 37 49 this->numanalyses=in_numanalyses; 38 this->hnodes=new Hook[in_numanalyses]; 50 this->hnodes=new Hook*[in_numanalyses]; 51 this->hmatice=new Hook(&matice_id,1); 52 this->hmatpar=new Hook(&matpar_id,1); 53 this->hneighbors=NULL; 39 54 40 55 } … … 42 57 /*FUNCTION PentaHook::SetHookNodes(int* node_ids,int analysis_counter){{{1*/ 43 58 void PentaHook::SetHookNodes(int* node_ids,int analysis_counter){ 44 this->hnodes[analysis_counter] .Init(node_ids,6);59 this->hnodes[analysis_counter]= new Hook(node_ids,6); 45 60 46 61 } 47 62 /*}}}*/ 48 /*FUNCTION PentaHook::InitHookMatice(int matice_id){{{1*/49 void PentaHook::InitHookMatice(int matice_id){50 this->hmatice.Init(&matice_id,1);51 }52 53 /*FUNCTION PentaHook::InitHookMatpar(int matpar_id){{{1*/54 void PentaHook::InitHookMatpar(int matpar_id){55 this->hmatpar.Init(&matpar_id,1);56 }57 58 63 /*FUNCTION PentaHook::InitHookNeighbors(int* element_ids){{{1*/ 59 64 void PentaHook::InitHookNeighbors(int* element_ids){ 60 this->hneighbors .Init(element_ids,2);65 this->hneighbors=new Hook(element_ids,2); 61 66 62 67 } … … 69 74 70 75 triahook->numanalyses=this->numanalyses; 71 triahook->hnodes=new Hook [this->numanalyses];76 triahook->hnodes=new Hook*[this->numanalyses]; 72 77 73 78 for(i=0;i<this->numanalyses;i++){ 74 79 /*Do not do anything if Hook is empty*/ 75 if (this->hnodes[i] .GetNum()==0) continue;80 if (this->hnodes[i]->GetNum()==0) continue; 76 81 /*Else, spawn Hook*/ 77 t his->hnodes[i].Spawn(&triahook->hnodes[i],indices,3);82 triahook->hnodes[i]=this->hnodes[i]->Spawn(indices,3); 78 83 } 79 triahook->hmatice .copy(&this->hmatice);80 triahook->hmatpar .copy(&this->hmatpar);84 triahook->hmatice=(Hook*)this->hmatice->copy(); 85 triahook->hmatpar=(Hook*)this->hmatpar->copy(); 81 86 } 82 87 /*}}}*/ -
issm/trunk/src/c/objects/Elements/PentaHook.h
r4369 r4396 13 13 public: 14 14 int numanalyses; //number of analysis types 15 Hook* hnodes; // 6 nodes for each analysis type16 Hook hmatice; // 1 ice material17 Hook hmatpar; // 1 material parameter18 Hook hneighbors; // 2 elements, first down, second up15 Hook** hnodes; // 6 nodes for each analysis type 16 Hook* hmatice; // 1 ice material 17 Hook* hmatpar; // 1 material parameter 18 Hook* hneighbors; // 2 elements, first down, second up 19 19 20 20 /*FUNCTION constructors, destructors {{{1*/ 21 21 PentaHook(); 22 PentaHook(int in_numanalyses,int matice_id, int matpar_id); 22 23 ~PentaHook(); 23 void InitHookNodes(int numanalyses);24 24 void SetHookNodes(int* node_ids,int analysis_counter); 25 void InitHookMatice(int matice_id); 26 void InitHookMatpar(int matpar_id); 25 void SpawnTriaHook(TriaHook* triahook,int* indices); 27 26 void InitHookNeighbors(int* element_ids); 28 void SpawnTriaHook(TriaHook* triahook,int* indices);29 27 /*}}}*/ 30 28 }; -
issm/trunk/src/c/objects/Elements/Tria.cpp
r4394 r4396 23 23 /*FUNCTION Tria::Tria(){{{1*/ 24 24 Tria::Tria(){ 25 25 26 this->nodes=NULL; 26 27 this->matice=NULL; … … 39 40 /*}}}*/ 40 41 /*FUNCTION Tria::Tria(int id, int index, IoModel* iomodel,int nummodels){{{1*/ 41 Tria::Tria(int tria_id, int index, IoModel* iomodel,int nummodels){ //i is the element index 42 43 int i; 44 int tria_matice_id; 45 int tria_matpar_id; 46 42 Tria::Tria(int tria_id, int index, IoModel* iomodel,int nummodels) 43 44 :TriaRef(P1Enum) //P1Enum: interpolation type 45 ,TriaHook(nummodels,index+1,iomodel->numberofelements+1) //index+1: matice id, iomodel->numberofelements+1: matpar id 46 { //i is the element index 47 47 /*id: */ 48 48 this->id=tria_id; 49 50 /*interpolation type: */51 this->InitInterpolationType(P1Enum);52 53 /*hooks: */54 tria_matice_id=index+1; //refers to the corresponding ice material object55 tria_matpar_id=iomodel->numberofelements+1; //refers to the constant material parameters object56 57 this->InitHookNodes(nummodels); this->nodes=NULL;58 this->InitHookMatice(tria_matice_id);this->matice=NULL;59 this->InitHookMatpar(tria_matpar_id);this->matpar=NULL;60 49 61 50 //this->parameters: we still can't point to it, it may not even exist. Configure will handle this. … … 66 55 this->results=new Results(); 67 56 57 /*initialize pointers:*/ 58 this->nodes=NULL; 59 this->matice=NULL; 60 this->matpar=NULL; 61 68 62 } 69 63 /*}}}*/ … … 78 72 tria=new Tria(); 79 73 80 /*copy fields: */ 74 //deal with TriaRef mother class 75 tria->interpolation_type=this->interpolation_type; 76 77 //deal with TriaHook mother class 78 tria->numanalyses=this->numanalyses; 79 tria->hnodes=new Hook*[tria->numanalyses]; 80 for(i=0;i<tria->numanalyses;i++)tria->hnodes[i]=(Hook*)this->hnodes[i]->copy(); 81 tria->hmatice=(Hook*)this->hmatice->copy(); 82 tria->hmatpar=(Hook*)this->hmatpar->copy(); 83 84 /*deal with Tria fields: */ 81 85 tria->id=this->id; 82 tria->interpolation_type=this->interpolation_type;83 86 if(this->inputs){ 84 87 tria->inputs=(Inputs*)this->inputs->Copy(); … … 95 98 /*point parameters: */ 96 99 tria->parameters=this->parameters; 97 98 /*now deal with hooks and objects: */ 99 tria->InitHookNodes(this->numanalyses); 100 for(i=0;i<this->numanalyses;i++)tria->hnodes[i].copy(&this->hnodes[i]); 101 tria->hmatice.copy(&this->hmatice); 102 tria->hmatpar.copy(&this->hmatpar); 103 100 104 101 /*recover objects: */ 105 102 tria->nodes=(Node**)xmalloc(3*sizeof(Node*)); //we cannot rely on an analysis_counter to tell us which analysis_type we are running, so we just copy the nodes. 106 103 for(i=0;i<3;i++)tria->nodes[i]=this->nodes[i]; 107 tria->matice=(Matice*)tria->hmatice .delivers();108 tria->matpar=(Matpar*)tria->hmatpar .delivers();104 tria->matice=(Matice*)tria->hmatice->delivers(); 105 tria->matpar=(Matpar*)tria->hmatpar->delivers(); 109 106 110 107 return tria; … … 159 156 160 157 /*allocate dynamic memory: */ 161 InitHookNodes(numanalyses); 162 158 this->hnodes=new Hook*[this->numanalyses]; 163 159 /*demarshall hooks: */ 164 for(i=0;i<numanalyses;i++)hnodes[i].Demarshall(&marshalled_dataset); 165 hmatice.Demarshall(&marshalled_dataset); 166 hmatpar.Demarshall(&marshalled_dataset); 160 for(i=0;i<numanalyses;i++){ 161 hnodes[i]=new Hook(); 162 hnodes[i]->Demarshall(&marshalled_dataset); 163 } 164 hmatice=new Hook(); hmatice->Demarshall(&marshalled_dataset); 165 hmatpar=new Hook(); hmatpar->Demarshall(&marshalled_dataset); 167 166 168 167 /*pointers are garbabe, until configuration is carried out: */ … … 248 247 249 248 /*Marshall hooks: */ 250 for(i=0;i<numanalyses;i++)hnodes[i] .Marshall(&marshalled_dataset);251 hmatice .Marshall(&marshalled_dataset);252 hmatpar .Marshall(&marshalled_dataset);249 for(i=0;i<numanalyses;i++)hnodes[i]->Marshall(&marshalled_dataset); 250 hmatice->Marshall(&marshalled_dataset); 251 hmatpar->Marshall(&marshalled_dataset); 253 252 254 253 /*Marshall inputs: */ … … 279 278 int hnodes_size=0;; 280 279 281 for(i=0;i<numanalyses;i++)hnodes_size+=hnodes[i] .MarshallSize();280 for(i=0;i<numanalyses;i++)hnodes_size+=hnodes[i]->MarshallSize(); 282 281 283 282 return sizeof(id) … … 285 284 +sizeof(interpolation_type) 286 285 +sizeof(numanalyses) 287 +hmatice .MarshallSize()288 +hmatpar .MarshallSize()286 +hmatice->MarshallSize() 287 +hmatpar->MarshallSize() 289 288 +inputs->MarshallSize() 290 289 +results->MarshallSize() … … 488 487 /*Take care of hooking up all objects for this element, ie links the objects in the hooks to their respective 489 488 * datasets, using internal ids and offsets hidden in hooks: */ 490 this->hnodes[analysis_counter] .configure(nodesin);491 this->hmatice .configure(materialsin);492 this->hmatpar .configure(materialsin);489 this->hnodes[analysis_counter]->configure(nodesin); 490 this->hmatice->configure(materialsin); 491 this->hmatpar->configure(materialsin); 493 492 494 493 /*Now, go pick up the objects inside the hooks: */ 495 this->nodes=(Node**)this->hnodes[analysis_counter] .deliverp();496 this->matice=(Matice*)this->hmatice .delivers();497 this->matpar=(Matpar*)this->hmatpar .delivers();494 this->nodes=(Node**)this->hnodes[analysis_counter]->deliverp(); 495 this->matice=(Matice*)this->hmatice->delivers(); 496 this->matpar=(Matpar*)this->hmatpar->delivers(); 498 497 499 498 /*point parameters to real dataset: */ -
issm/trunk/src/c/objects/Elements/TriaHook.cpp
r4236 r4396 25 25 numanalyses=UNDEF; 26 26 this->hnodes=NULL; 27 this->hmatice=NULL; 28 this->hmatpar=NULL; 27 29 } 28 30 /*}}}*/ 29 31 /*FUNCTION TriaHook::~TriaHook(){{{1*/ 30 32 TriaHook::~TriaHook(){ 33 int i; 34 35 for(i=0;i<this->numanalyses;i++){ 36 delete this->hnodes[i]; 37 } 31 38 delete [] this->hnodes; 39 delete hmatice; 40 delete hmatpar; 41 32 42 } 33 43 /*}}}*/ 34 /*FUNCTION TriaHook:: InitHookNodes(int numanalyses){{{1*/35 void TriaHook::InitHookNodes(int in_numanalyses){36 44 /*FUNCTION TriaHook::TriaHook(int in_numanalyses,int matice_id, int matpar_id){{{1*/ 45 TriaHook::TriaHook(int in_numanalyses,int matice_id, int matpar_id){ 46 37 47 this->numanalyses=in_numanalyses; 38 this->hnodes=new Hook[in_numanalyses]; 48 this->hnodes=new Hook*[in_numanalyses]; 49 this->hmatice=new Hook(&matice_id,1); 50 this->hmatpar=new Hook(&matpar_id,1); 39 51 40 52 } … … 42 54 /*FUNCTION TriaHook::SetHookNodes(int* node_ids,int analysis_counter){{{1*/ 43 55 void TriaHook::SetHookNodes(int* node_ids,int analysis_counter){ 44 this->hnodes[analysis_counter].Init(node_ids,3); 45 56 this->hnodes[analysis_counter]=new Hook(node_ids,3); 46 57 } 47 58 /*}}}*/ 48 /*FUNCTION TriaHook::InitHookMatice(int matice_id){{{1*/49 void TriaHook::InitHookMatice(int matice_id){50 this->hmatice.Init(&matice_id,1);51 }52 53 /*FUNCTION TriaHook::InitHookMatpar(int matpar_id){{{1*/54 void TriaHook::InitHookMatpar(int matpar_id){55 this->hmatpar.Init(&matpar_id,1);56 }57 -
issm/trunk/src/c/objects/Elements/TriaHook.h
r3984 r4396 11 11 12 12 public: 13 int numanalyses; //number of analysis types14 Hook* hnodes; // 3 nodes for each analysis type15 Hook hmatice; // 1 ice material16 Hook hmatpar; // 1 material parameter13 int numanalyses; //number of analysis types 14 Hook** hnodes; // 3 nodes for each analysis type 15 Hook* hmatice; // 1 ice material 16 Hook* hmatpar; // 1 material parameter 17 17 18 18 19 19 /*FUNCTION constructors, destructors {{{1*/ 20 20 TriaHook(); 21 TriaHook(int in_numanalyses,int matice_id, int matpar_id); 21 22 ~TriaHook(); 22 void InitHookNodes(int numanalyses);23 23 void SetHookNodes(int* node_ids,int analysis_counter); 24 void InitHookMatice(int matice_id);25 void InitHookMatpar(int matpar_id);26 void InitHookNeighbors(int* element_ids);27 28 24 /*}}}*/ 29 25 -
issm/trunk/src/c/objects/Elements/TriaRef.cpp
r4236 r4396 25 25 } 26 26 /*}}}*/ 27 /*FUNCTION TriaRef::TriaRef(int type){{{1*/ 28 TriaRef::TriaRef(int type){ 29 this->interpolation_type=type; 30 } 31 /*}}}*/ 27 32 /*FUNCTION TriaRef::~TriaRef(){{{1*/ 28 33 TriaRef::~TriaRef(){ 29 34 } 30 35 /*}}}*/ 31 /*FUNCTION TriaRef::InitInterpolationType(int type){{{1*/32 void TriaRef::InitInterpolationType(int type){33 this->interpolation_type=type;34 }35 /*}}}*/ -
issm/trunk/src/c/objects/Elements/TriaRef.h
r3828 r4396 16 16 /*FUNCTION constructors, destructors {{{1*/ 17 17 TriaRef(); 18 TriaRef(int type); 18 19 ~TriaRef(); 19 void InitInterpolationType(int type);20 20 /*}}}*/ 21 21 /*FUNCTION numerics {{{1*/ -
issm/trunk/src/c/objects/Hook.cpp
r4378 r4396 31 31 /*FUNCTION Hook::Hook(int* ids, int num){{{1*/ 32 32 Hook::Hook(int* in_ids, int in_num){ 33 this->Init(in_ids,in_num);34 }35 /*}}}*/36 /*FUNCTION Hook::Init(int* ids, int num){{{1*/37 void Hook::Init(int* in_ids, int in_num){38 33 39 34 /*Intermediaries*/ … … 62 57 this->offsets[i]=0; 63 58 } 64 }65 }66 /*}}}*/67 /*FUNCTION Hook::Hook(Object** hook_objects, int* hook_ids, int* hook_offsets,int hook_num){{{1*/68 Hook::Hook(Object** hook_objects, int* hook_ids, int* hook_offsets,int hook_num){69 70 /*just plug in: */71 this->num=hook_num;72 this->objects=hook_objects;73 this->offsets=hook_offsets;74 this->ids=hook_ids;75 76 }77 /*}}}*/78 /*FUNCTION Hook::Hook(Hook* input) {{{1*/79 Hook::Hook(Hook* input){80 81 int i;82 Object** input_objects=NULL;83 int* input_ids=NULL;84 int* input_offsets=NULL;85 86 /*get internals of input: */87 this->num=input->GetNum();88 input_objects=input->GetObjects();89 input_ids=input->Ids();90 input_offsets=input->GetOffsets();91 92 if(this->num){93 this->objects=(Object**)xmalloc(this->num*sizeof(Object*));94 this->ids=(int*)xmalloc(this->num*sizeof(int));95 this->offsets=(int*)xmalloc(this->num*sizeof(int));96 }97 98 99 for(i=0;i<this->num;i++){100 this->objects[i]=input_objects[i];101 this->offsets[i]=input_offsets[i];102 this->ids[i]=input_ids[i];103 59 } 104 60 } … … 252 208 } 253 209 /*}}}*/ 254 /*FUNCTION Hook::copy(Hook* input) {{{1*/ 255 void Hook::copy(Hook* input){ 256 257 int i; 258 Object** input_objects=NULL; 259 int* input_ids=NULL; 260 int* input_offsets=NULL; 261 262 /*get internals of input: */ 263 this->num=input->GetNum(); 264 input_objects=input->GetObjects(); 265 input_ids=input->Ids(); 266 input_offsets=input->GetOffsets(); 267 268 if(this->num){ 269 this->objects=(Object**)xmalloc(this->num*sizeof(Object*)); 270 this->ids=(int*)xmalloc(this->num*sizeof(int)); 271 this->offsets=(int*)xmalloc(this->num*sizeof(int)); 272 } 273 274 275 for(i=0;i<this->num;i++){ 276 this->objects[i]=input_objects[i]; 277 this->offsets[i]=input_offsets[i]; 278 this->ids[i]=input_ids[i]; 210 /*FUNCTION Hook::copy(void) {{{1*/ 211 Object* Hook::copy(void){ 212 213 int i; 214 215 /*output: */ 216 Hook* output=NULL; 217 218 /*initalize output: */ 219 output=new Hook(); 220 221 /*copy in the fields: */ 222 output->num=this->num; 223 if(output->num){ 224 output->objects=(Object**)xmalloc(output->num*sizeof(Object*)); 225 output->ids=(int*)xmalloc(output->num*sizeof(int)); 226 output->offsets=(int*)xmalloc(output->num*sizeof(int)); 227 } 228 229 for(i=0;i<output->num;i++){ 230 output->objects[i]=this->objects[i]; 231 output->offsets[i]=this->offsets[i]; 232 output->ids[i]=this->ids[i]; 279 233 } 280 234 } … … 363 317 /*}}}*/ 364 318 /*FUNCTION Hook::Spawn{{{1*/ 365 void Hook::Spawn(Hook* spawnedhook, int* indices, int numindices){ 366 367 int i; 319 Hook* Hook::Spawn(int* indices, int numindices){ 320 321 int i; 322 323 /*output: */ 324 Hook* output=NULL; 325 326 /*allocate: */ 327 output=new Hook(); 368 328 369 329 /*If this Hook is empty, simply return*/ 370 330 if(this->num==0){ 371 spawnedhook->num=0;372 return ;331 output->num=0; 332 return output; 373 333 } 374 334 … … 377 337 378 338 /*go pickup the correct objects, ids and offsets :*/ 379 spawnedhook->num=numindices; 380 if(spawnedhook->num<1) ISSMERROR("Trying to spawn an empty ElementProperties!"); 381 382 spawnedhook->objects=(Object**)xmalloc(spawnedhook->num*sizeof(Object*)); 383 spawnedhook->ids=(int*)xmalloc(spawnedhook->num*sizeof(int)); 384 spawnedhook->offsets=(int*)xmalloc(spawnedhook->num*sizeof(int)); 385 386 for(i=0;i<spawnedhook->num;i++){ 387 spawnedhook->objects[i]=this->objects[indices[i]]; 388 spawnedhook->ids[i]=this->ids[indices[i]]; 389 spawnedhook->offsets[i]=this->offsets[indices[i]]; 390 } 391 } 392 /*}}}*/ 339 output->num=numindices; 340 if(output->num<1) ISSMERROR("Trying to spawn an empty ElementProperties!"); 341 342 output->objects=(Object**)xmalloc(output->num*sizeof(Object*)); 343 output->ids=(int*)xmalloc(output->num*sizeof(int)); 344 output->offsets=(int*)xmalloc(output->num*sizeof(int)); 345 346 for(i=0;i<output->num;i++){ 347 output->objects[i]=this->objects[indices[i]]; 348 output->ids[i]=this->ids[indices[i]]; 349 output->offsets[i]=this->offsets[indices[i]]; 350 } 351 352 return output; 353 } 354 /*}}}*/ -
issm/trunk/src/c/objects/Hook.h
r4369 r4396 29 29 Hook(); 30 30 Hook(int* ids, int num); 31 void Init(int* ids, int num);32 Hook(Object** objects, int* ids, int* offsets,int num);33 Hook(Hook* hook);34 31 ~Hook(); 35 32 /*}}}*/ … … 40 37 int MarshallSize(); 41 38 void Demarshall(char** pmarshalled_dataset); 42 void copy(Hook* hook);39 Object* copy(void); 43 40 /*}}}*/ 44 41 /*Hook management: {{{1*/ … … 46 43 Object** deliverp(void); //deliver all objects 47 44 void configure(DataSet* dataset); 48 void Spawn(Hook* spawnedhook,int* indices, int numindices);45 Hook* Spawn(int* indices, int numindices); 49 46 Object** GetObjects(void); 50 47 int* Ids(void); -
issm/trunk/src/c/objects/Loads/Icefront.cpp
r4248 r4396 24 24 this->inputs=NULL; 25 25 this->parameters=NULL; 26 this->hnodes=NULL; 27 this->helement=NULL; 28 this->hmatpar=NULL; 26 29 } 27 30 /*}}}*/ … … 84 87 85 88 /*Hooks: */ 86 this->hnodes .Init(icefront_node_ids,num_nodes);87 this->helement .Init(&icefront_eid,1);88 this->hmatpar .Init(&icefront_mparid,1);89 this->hnodes=new Hook(icefront_node_ids,num_nodes); 90 this->helement=new Hook(&icefront_eid,1); 91 this->hmatpar=new Hook(&icefront_mparid,1); 89 92 90 93 //intialize and add as many inputs per element as requested: … … 103 106 delete inputs; 104 107 this->parameters=NULL; 108 delete hnodes; 109 delete helement; 110 delete hmatpar; 105 111 } 106 112 /*}}}*/ … … 112 118 printf(" id: %i\n",id); 113 119 printf(" analysis_type: %s\n",EnumAsString(analysis_type)); 114 hnodes .Echo();115 helement .Echo();116 hmatpar .Echo();120 hnodes->Echo(); 121 helement->Echo(); 122 hmatpar->Echo(); 117 123 printf(" parameters\n"); 118 124 parameters->Echo(); … … 127 133 printf(" id: %i\n",id); 128 134 printf(" analysis_type: %s\n",EnumAsString(analysis_type)); 129 hnodes .DeepEcho();130 helement .DeepEcho();131 hmatpar .DeepEcho();135 hnodes->DeepEcho(); 136 helement->DeepEcho(); 137 hmatpar->DeepEcho(); 132 138 printf(" parameters\n"); 133 139 parameters->DeepEcho(); … … 167 173 168 174 /*Marshall hooks: */ 169 hnodes .Marshall(&marshalled_dataset);170 helement .Marshall(&marshalled_dataset);171 hmatpar .Marshall(&marshalled_dataset);175 hnodes->Marshall(&marshalled_dataset); 176 helement->Marshall(&marshalled_dataset); 177 hmatpar->Marshall(&marshalled_dataset); 172 178 173 179 /*Marshall inputs: */ … … 189 195 return sizeof(id) 190 196 +sizeof(analysis_type) 191 +hnodes .MarshallSize()192 +helement .MarshallSize()193 +hmatpar .MarshallSize()197 +hnodes->MarshallSize() 198 +helement->MarshallSize() 199 +hmatpar->MarshallSize() 194 200 +inputs->MarshallSize() 195 201 +sizeof(int); //sizeof(int) for enum type … … 211 217 212 218 /*demarshall hooks: */ 213 hnodes .Demarshall(&marshalled_dataset);214 helement .Demarshall(&marshalled_dataset);215 hmatpar .Demarshall(&marshalled_dataset);219 hnodes=new Hook(); hnodes->Demarshall(&marshalled_dataset); 220 helement=new Hook(); helement->Demarshall(&marshalled_dataset); 221 hmatpar=new Hook(); hmatpar->Demarshall(&marshalled_dataset); 216 222 217 223 /*demarshall inputs: */ … … 253 259 254 260 /*now deal with hooks and objects: */ 255 icefront->hnodes .copy(&this->hnodes);256 icefront->helement .copy(&this->helement);257 icefront->hmatpar .copy(&this->hmatpar);261 icefront->hnodes=(Hook*)this->hnodes->copy(); 262 icefront->helement=(Hook*)this->helement->copy(); 263 icefront->hmatpar=(Hook*)this->hmatpar->copy(); 258 264 259 265 return icefront; … … 268 274 /*Take care of hooking up all objects for this element, ie links the objects in the hooks to their respective 269 275 * datasets, using internal ids and offsets hidden in hooks: */ 270 hnodes .configure(nodesin);271 helement .configure(elementsin);272 hmatpar .configure(materialsin);276 hnodes->configure(nodesin); 277 helement->configure(elementsin); 278 hmatpar->configure(materialsin); 273 279 274 280 /*point parameters to real dataset: */ … … 411 417 412 418 /*Recover hook objects: */ 413 matpar=(Matpar*)hmatpar .delivers();414 element=(Element*)helement .delivers();415 nodes=(Node**)hnodes .deliverp();419 matpar=(Matpar*)hmatpar->delivers(); 420 element=(Element*)helement->delivers(); 421 nodes=(Node**)hnodes->deliverp(); 416 422 417 423 element_type=element->Enum(); … … 514 520 515 521 /*Recover hook objects: */ 516 matpar=(Matpar*)hmatpar .delivers();517 element=(Element*)helement .delivers();518 nodes=(Node**)hnodes .deliverp();522 matpar=(Matpar*)hmatpar->delivers(); 523 element=(Element*)helement->delivers(); 524 nodes=(Node**)hnodes->deliverp(); 519 525 520 526 element_type=element->Enum(); … … 653 659 654 660 /*Recover hook objects: */ 655 matpar=(Matpar*)hmatpar .delivers();656 element=(Element*)helement .delivers();657 nodes=(Node**)hnodes .deliverp();661 matpar=(Matpar*)hmatpar->delivers(); 662 element=(Element*)helement->delivers(); 663 nodes=(Node**)hnodes->deliverp(); 658 664 659 665 /*check icefront is associated to a pentaelem: */ … … 756 762 757 763 Node** nodes=NULL; 758 nodes=(Node**)hnodes .deliverp();764 nodes=(Node**)hnodes->deliverp(); 759 765 inputs->GetParameterValue(&type,TypeEnum); 760 766 -
issm/trunk/src/c/objects/Loads/Icefront.h
r4248 r4396 25 25 26 26 /*hooks: */ 27 Hook hnodes;28 Hook helement;29 Hook hmatpar;27 Hook* hnodes; 28 Hook* helement; 29 Hook* hmatpar; 30 30 31 31 /*inputs and parameters: */ -
issm/trunk/src/c/objects/Loads/Numericalflux.cpp
r4248 r4396 23 23 this->inputs=NULL; 24 24 this->parameters=NULL; 25 this->helements=NULL; 26 this->hnodes=NULL; 25 27 } 26 28 /*}}}*/ … … 109 111 110 112 /*Hooks: */ 111 this->hnodes .Init(numericalflux_node_ids,num_nodes);112 this->helements .Init(numericalflux_elem_ids,num_elems);113 this->hnodes=new Hook(numericalflux_node_ids,num_nodes); 114 this->helements=new Hook(numericalflux_elem_ids,num_elems); 113 115 114 116 //intialize and add as many inputs per element as requested: … … 124 126 delete inputs; 125 127 this->parameters=NULL; 128 delete helements; 129 delete hnodes; 126 130 } 127 131 /*}}}*/ … … 139 143 printf(" id: %i\n",id); 140 144 printf(" analysis_type: %s\n",EnumAsString(analysis_type)); 141 hnodes .DeepEcho();142 helements .DeepEcho();145 hnodes->DeepEcho(); 146 helements->DeepEcho(); 143 147 printf(" parameters\n"); 144 148 parameters->DeepEcho(); … … 181 185 182 186 /*Marshall hooks: */ 183 hnodes .Marshall(&marshalled_dataset);184 helements .Marshall(&marshalled_dataset);187 hnodes->Marshall(&marshalled_dataset); 188 helements->Marshall(&marshalled_dataset); 185 189 186 190 /*Marshall inputs: */ … … 203 207 return sizeof(id) 204 208 +sizeof(analysis_type) 205 +hnodes .MarshallSize()206 +helements .MarshallSize()209 +hnodes->MarshallSize() 210 +helements->MarshallSize() 207 211 +inputs->MarshallSize() 208 212 +sizeof(int); //sizeof(int) for enum type … … 224 228 225 229 /*demarshall hooks: */ 226 hnodes .Demarshall(&marshalled_dataset);227 helements .Demarshall(&marshalled_dataset);230 hnodes=new Hook(); hnodes->Demarshall(&marshalled_dataset); 231 helements=new Hook(); helements->Demarshall(&marshalled_dataset); 228 232 229 233 /*demarshall inputs: */ … … 265 269 266 270 /*now deal with hooks and objects: */ 267 numericalflux->hnodes .copy(&this->hnodes);268 numericalflux->helements .copy(&this->helements);271 numericalflux->hnodes=(Hook*)this->hnodes->copy(); 272 numericalflux->helements=(Hook*)this->helements->copy(); 269 273 270 274 return numericalflux; … … 279 283 /*Take care of hooking up all objects for this element, ie links the objects in the hooks to their respective 280 284 * datasets, using internal ids and offsets hidden in hooks: */ 281 hnodes .configure(nodesin);282 helements .configure(elementsin);285 hnodes->configure(nodesin); 286 helements->configure(elementsin); 283 287 284 288 /*point parameters to real dataset: */ … … 394 398 395 399 /*recover objects from hooks: */ 396 nodes=(Node**)hnodes .deliverp();397 trias=(Tria**)helements .deliverp();400 nodes=(Node**)hnodes->deliverp(); 401 trias=(Tria**)helements->deliverp(); 398 402 399 403 /*recover parameters: */ … … 514 518 515 519 /*recover objects from hooks: */ 516 nodes=(Node**)hnodes .deliverp();517 trias=(Tria**)helements .deliverp();520 nodes=(Node**)hnodes->deliverp(); 521 trias=(Tria**)helements->deliverp(); 518 522 519 523 /*recover parameters: */ … … 640 644 641 645 /*recover objects from hooks: */ 642 nodes=(Node**)hnodes .deliverp();643 trias=(Tria**)helements .deliverp();646 nodes=(Node**)hnodes->deliverp(); 647 trias=(Tria**)helements->deliverp(); 644 648 645 649 /*Retrieve parameters: */ … … 742 746 743 747 /*recover objects from hooks: */ 744 nodes=(Node**)hnodes .deliverp();748 nodes=(Node**)hnodes->deliverp(); 745 749 746 750 /*recover type: */ -
issm/trunk/src/c/objects/Loads/Numericalflux.h
r4248 r4396 22 22 int analysis_type; 23 23 24 Hook 25 Hook 24 Hook* helements; 25 Hook* hnodes; 26 26 Parameters *parameters; 27 27 Inputs *inputs; -
issm/trunk/src/c/objects/Loads/Pengrid.cpp
r4248 r4396 23 23 this->inputs=NULL; 24 24 this->parameters=NULL; 25 this->hnode=NULL; 26 this->helement=NULL; 27 this->hmatpar=NULL; 25 28 26 29 /*not active, not zigzagging: */ … … 51 54 pengrid_matpar_id=iomodel->numberofelements+1; //refers to the constant material parameters object 52 55 53 this->hnode .Init(&pengrid_node_id,1);54 this->helement .Init(&pengrid_element_id,1);55 this->hmatpar .Init(&pengrid_matpar_id,1);56 this->hnode=new Hook(&pengrid_node_id,1); 57 this->helement=new Hook(&pengrid_element_id,1); 58 this->hmatpar=new Hook(&pengrid_matpar_id,1); 56 59 57 60 //initialize inputs: none needed … … 69 72 /*FUNCTION Pengrid::destructor {{{1*/ 70 73 Pengrid::~Pengrid(){ 74 delete hnode; 75 delete helement; 76 delete hmatpar; 71 77 return; 72 78 } … … 85 91 printf(" id: %i\n",id); 86 92 printf(" analysis_type: %s\n",EnumAsString(analysis_type)); 87 hnode .DeepEcho();88 helement .DeepEcho();89 hmatpar .DeepEcho();93 hnode->DeepEcho(); 94 helement->DeepEcho(); 95 hmatpar->DeepEcho(); 90 96 printf(" active %i\n",this->active); 91 97 printf(" zigzag_counter %i\n",this->zigzag_counter); … … 129 135 130 136 /*Marshall hooks: */ 131 hnode .Marshall(&marshalled_dataset);132 helement .Marshall(&marshalled_dataset);133 hmatpar .Marshall(&marshalled_dataset);137 hnode->Marshall(&marshalled_dataset); 138 helement->Marshall(&marshalled_dataset); 139 hmatpar->Marshall(&marshalled_dataset); 134 140 135 141 /*Marshall inputs: */ … … 154 160 +sizeof(active) 155 161 +sizeof(zigzag_counter) 156 +hnode .MarshallSize()157 +helement .MarshallSize()158 +hmatpar .MarshallSize()162 +hnode->MarshallSize() 163 +helement->MarshallSize() 164 +hmatpar->MarshallSize() 159 165 +inputs->MarshallSize() 160 166 +sizeof(int); //sizeof(int) for enum type … … 179 185 180 186 /*demarshall hooks: */ 181 hnode .Demarshall(&marshalled_dataset);182 helement .Demarshall(&marshalled_dataset);183 hmatpar .Demarshall(&marshalled_dataset);187 hnode=new Hook(); hnode->Demarshall(&marshalled_dataset); 188 helement=new Hook(); helement->Demarshall(&marshalled_dataset); 189 hmatpar=new Hook(); hmatpar->Demarshall(&marshalled_dataset); 184 190 185 191 /*demarshall inputs: */ … … 220 226 221 227 /*now deal with hooks and objects: */ 222 pengrid->hnode .copy(&this->hnode);223 pengrid->h element.copy(&this->helement);224 pengrid->h matpar.copy(&this->hmatpar);228 pengrid->hnode=(Hook*)this->hnode->copy(); 229 pengrid->hmatpar=(Hook*)this->hmatpar->copy(); 230 pengrid->helement=(Hook*)this->helement->copy(); 225 231 226 232 //let's not forget internals … … 239 245 /*Take care of hooking up all objects for this load, ie links the objects in the hooks to their respective 240 246 * datasets, using internal ids and offsets hidden in hooks: */ 241 hnode .configure(nodesin);242 helement .configure(elementsin);243 hmatpar .configure(materialsin);247 hnode->configure(nodesin); 248 helement->configure(elementsin); 249 hmatpar->configure(materialsin); 244 250 245 251 /*point parameters to real dataset: */ … … 381 387 382 388 /*recover objects from hooks: */ 383 node=(Node*)hnode .delivers();389 node=(Node*)hnode->delivers(); 384 390 385 391 node->GetDofList(&doflist_per_node[0],&numberofdofspernode); … … 448 454 449 455 /*recover pointers: */ 450 node=(Node*)hnode .delivers();451 penta=(Penta*)helement .delivers();452 matpar=(Matpar*)hmatpar .delivers();456 node=(Node*)hnode->delivers(); 457 penta=(Penta*)helement->delivers(); 458 matpar=(Matpar*)hmatpar->delivers(); 453 459 454 460 /*check that pengrid is not a clone (penalty to be added only once)*/ … … 533 539 534 540 /*recover pointers: */ 535 node=(Node*)hnode .delivers();536 penta=(Penta*)helement .delivers();541 node=(Node*)hnode->delivers(); 542 penta=(Penta*)helement->delivers(); 537 543 538 544 //recover slope: */ … … 577 583 578 584 /*recover pointers: */ 579 node=(Node*)hnode .delivers();580 penta=(Penta*)helement .delivers();581 matpar=(Matpar*)hmatpar .delivers();585 node=(Node*)hnode->delivers(); 586 penta=(Penta*)helement->delivers(); 587 matpar=(Matpar*)hmatpar->delivers(); 582 588 583 589 /*check that pengrid is not a clone (penalty to be added only once)*/ … … 665 671 666 672 /*recover pointers: */ 667 node=(Node*)hnode .delivers();668 penta=(Penta*)helement .delivers();669 matpar=(Matpar*)hmatpar .delivers();673 node=(Node*)hnode->delivers(); 674 penta=(Penta*)helement->delivers(); 675 matpar=(Matpar*)hmatpar->delivers(); 670 676 671 677 /*check that pengrid is not a clone (penalty to be added only once)*/ … … 738 744 739 745 /*recover pointers: */ 740 node=(Node*)hnode .delivers();741 penta=(Penta*)helement .delivers();742 matpar=(Matpar*)hmatpar .delivers();746 node=(Node*)hnode->delivers(); 747 penta=(Penta*)helement->delivers(); 748 matpar=(Matpar*)hmatpar->delivers(); 743 749 744 750 if(!this->active)return; -
issm/trunk/src/c/objects/Loads/Pengrid.h
r4248 r4396 21 21 int analysis_type; 22 22 23 Hook hnode; //hook to 1 node24 Hook helement; //hook to 1 element25 Hook hmatpar; //hook to 1 matpar23 Hook* hnode; //hook to 1 node 24 Hook* helement; //hook to 1 element 25 Hook* hmatpar; //hook to 1 matpar 26 26 27 27 Parameters* parameters; //pointer to solution parameters -
issm/trunk/src/c/objects/Loads/Penpair.cpp
r4248 r4396 20 20 /*FUNCTION Penpair::constructor {{{1*/ 21 21 Penpair::Penpair(){ 22 23 this->hnodes=NULL; 22 24 return; 23 25 } 24 26 /*}}}1*/ 25 27 /*FUNCTION Penpair::creation {{{1*/ 26 Penpair::Penpair(int penpair_id, int* penpair_node_ids,int in_analysis_type): 27 hnodes(penpair_node_ids,2) 28 { 28 Penpair::Penpair(int penpair_id, int* penpair_node_ids,int in_analysis_type){ 29 30 31 this->id=penpair_id; 32 this->analysis_type=in_analysis_type; 33 this->hnodes=new Hook(penpair_node_ids,2); 34 35 return; 36 } 37 /*}}}1*/ 38 /*FUNCTION Penpair::creation {{{1*/ 39 Penpair::Penpair(int penpair_id, Hook* penpair_hnodes,int in_analysis_type){ 29 40 30 41 /*all the initialization has been done by the initializer, just fill in the id: */ 31 42 this->id=penpair_id; 32 43 this->analysis_type=in_analysis_type; 33 34 return; 35 } 36 /*}}}1*/ 37 /*FUNCTION Penpair::creation {{{1*/ 38 Penpair::Penpair(int penpair_id, Hook* penpair_hnodes,int in_analysis_type): 39 hnodes(penpair_hnodes) 40 { 41 42 /*all the initialization has been done by the initializer, just fill in the id: */ 43 this->id=penpair_id; 44 this->analysis_type=in_analysis_type; 44 this->hnodes=penpair_hnodes; 45 45 46 46 return; … … 49 49 /*FUNCTION Penpair::destructor {{{1*/ 50 50 Penpair::~Penpair(){ 51 delete hnodes; 51 52 return; 52 53 } … … 62 63 printf(" id: %i\n",id); 63 64 printf(" analysis_type: %s\n",EnumAsString(analysis_type)); 64 hnodes .Echo();65 hnodes->Echo(); 65 66 66 67 return; … … 73 74 printf(" id: %i\n",id); 74 75 printf(" analysis_type: %s\n",EnumAsString(analysis_type)); 75 hnodes .DeepEcho();76 hnodes->DeepEcho(); 76 77 77 78 return; … … 107 108 108 109 /*Marshall hooks*/ 109 hnodes .Marshall(&marshalled_dataset);110 hnodes->Marshall(&marshalled_dataset); 110 111 111 112 *pmarshalled_dataset=marshalled_dataset; … … 118 119 return sizeof(id)+ 119 120 +sizeof(analysis_type) 120 +hnodes .MarshallSize()121 +hnodes->MarshallSize() 121 122 +sizeof(int); //sizeof(int) for enum type 122 123 } … … 137 138 138 139 /*demarshall hooks: */ 139 hnodes .Demarshall(&marshalled_dataset);140 hnodes=new Hook(); hnodes->Demarshall(&marshalled_dataset); 140 141 141 142 /*return: */ … … 162 163 163 164 /*now deal with hooks and objects: */ 164 penpair->hnodes .copy(&this->hnodes);165 penpair->hnodes=(Hook*)this->hnodes->copy(); 165 166 166 167 return penpair; … … 175 176 /*Take care of hooking up all objects for this element, ie links the objects in the hooks to their respective 176 177 * datasets, using internal ids and offsets hidden in hooks: */ 177 hnodes .configure(nodesin);178 hnodes->configure(nodesin); 178 179 179 180 } -
issm/trunk/src/c/objects/Loads/Penpair.h
r4248 r4396 20 20 int analysis_type; 21 21 22 Hook hnodes; //hook to 2 nodes22 Hook* hnodes; //hook to 2 nodes 23 23 24 24 public: -
issm/trunk/src/c/objects/Loads/Riftfront.cpp
r4248 r4396 25 25 this->inputs=NULL; 26 26 this->parameters=NULL; 27 this->hnodes=NULL; 28 this->helements=NULL; 29 this->hmatpar=NULL; 27 30 } 28 31 /*}}}*/ … … 59 62 riftfront_matpar_id=iomodel->numberofelements+1; //matlab indexing 60 63 61 this->hnodes .Init(riftfront_node_ids,2);62 this->hmatpar .Init(&riftfront_matpar_id,1);64 this->hnodes=new Hook(riftfront_node_ids,2); 65 this->hmatpar=new Hook(&riftfront_matpar_id,1); 63 66 64 67 /*computational parameters: */ … … 98 101 delete inputs; 99 102 this->parameters=NULL; 103 delete hnodes; 104 delete hmatpar; 105 delete helements; 100 106 } 101 107 /*}}}*/ … … 113 119 printf(" id: %i\n",id); 114 120 printf(" analysis_type: %s\n",EnumAsString(analysis_type)); 115 hnodes .DeepEcho();116 hmatpar .DeepEcho();121 hnodes->DeepEcho(); 122 hmatpar->DeepEcho(); 117 123 printf(" parameters\n"); 118 124 parameters->DeepEcho(); … … 161 167 162 168 /*Marshall hooks: */ 163 hnodes .Marshall(&marshalled_dataset);164 hmatpar .Marshall(&marshalled_dataset);169 hnodes->Marshall(&marshalled_dataset); 170 hmatpar->Marshall(&marshalled_dataset); 165 171 166 172 /*Marshall inputs: */ … … 192 198 +sizeof(prestable) 193 199 +sizeof(penalty_lock) 194 +hnodes .MarshallSize()195 +hmatpar .MarshallSize()200 +hnodes->MarshallSize() 201 +hmatpar->MarshallSize() 196 202 +inputs->MarshallSize() 197 203 +sizeof(int); //sizeof(int) for enum type … … 224 230 225 231 /*demarshall hooks: */ 226 hnodes .Demarshall(&marshalled_dataset);227 hmatpar .Demarshall(&marshalled_dataset);232 hnodes=new Hook(); hnodes->Demarshall(&marshalled_dataset); 233 hmatpar=new Hook(); hmatpar->Demarshall(&marshalled_dataset); 228 234 229 235 /*demarshall inputs: */ … … 264 270 265 271 /*now deal with hooks and objects: */ 266 riftfront->hnodes.copy(&this->hnodes); 267 riftfront->helements.copy(&this->helements); 268 riftfront->hmatpar.copy(&this->hmatpar); 272 riftfront->hnodes=(Hook*)this->hnodes->copy(); 273 riftfront->hmatpar=(Hook*)this->hmatpar->copy(); 269 274 270 275 return riftfront; … … 279 284 /*Take care of hooking up all objects for this element, ie links the objects in the hooks to their respective 280 285 * datasets, using internal ids and offsets hidden in hooks: */ 281 hnodes .configure(nodesin);282 hmatpar .configure(materialsin);286 hnodes->configure(nodesin); 287 hmatpar->configure(materialsin); 283 288 284 289 /*point parameters to real dataset: */ … … 320 325 321 326 /*Recover hook objects: */ 322 elements=(Element**)helements .deliverp();323 nodes=(Node**)hnodes .deliverp();327 elements=(Element**)helements->deliverp(); 328 nodes=(Node**)hnodes->deliverp(); 324 329 325 330 /*enum of element? */ … … 444 449 445 450 /*Recover hook objects: */ 446 elements=(Element**)helements .deliverp();447 nodes=(Node**)hnodes .deliverp();448 matpar=(Matpar*)hmatpar .delivers();451 elements=(Element**)helements->deliverp(); 452 nodes=(Node**)hnodes->deliverp(); 453 matpar=(Matpar*)hmatpar->delivers(); 449 454 450 455 /*enum of element? */ … … 569 574 570 575 /*Recover hook objects: */ 571 elements=(Element**)helements .deliverp();572 nodes=(Node**)hnodes .deliverp();576 elements=(Element**)helements->deliverp(); 577 nodes=(Node**)hnodes->deliverp(); 573 578 574 579 /*enum of element? */ … … 647 652 Node **nodes = NULL; 648 653 649 nodes=(Node**)hnodes .deliverp();654 nodes=(Node**)hnodes->deliverp(); 650 655 651 656 for(i=0;i<MAX_RIFTFRONT_GRIDS;i++){ … … 705 710 706 711 /*Recover hook objects: */ 707 elements=(Element**)helements .deliverp();708 nodes=(Node**)hnodes .deliverp();712 elements=(Element**)helements->deliverp(); 713 nodes=(Node**)hnodes->deliverp(); 709 714 710 715 /*enum of element? */ … … 770 775 771 776 /*Recover hook objects: */ 772 elements=(Element**)helements .deliverp();773 nodes=(Node**)hnodes .deliverp();777 elements=(Element**)helements->deliverp(); 778 nodes=(Node**)hnodes->deliverp(); 774 779 775 780 /*enum of element? */ … … 820 825 821 826 /*Recover hook objects: */ 822 elements=(Element**)helements .deliverp();823 nodes=(Node**)hnodes .deliverp();827 elements=(Element**)helements->deliverp(); 828 nodes=(Node**)hnodes->deliverp(); 824 829 825 830 /*enum of element? */ … … 876 881 877 882 /*Recover hook objects: */ 878 elements=(Element**)helements .deliverp();879 nodes=(Node**)hnodes .deliverp();883 elements=(Element**)helements->deliverp(); 884 nodes=(Node**)hnodes->deliverp(); 880 885 881 886 /*enum of element? */ -
issm/trunk/src/c/objects/Loads/Riftfront.h
r4248 r4396 24 24 int analysis_type; 25 25 26 Hook hnodes; //2 nodes27 Hook helements; //2 elements28 Hook hmatpar;26 Hook* hnodes; //2 nodes 27 Hook* helements; //2 elements 28 Hook* hmatpar; 29 29 30 30 /*computational: */ -
issm/trunk/src/c/objects/Node.cpp
r4390 r4396 22 22 Node::Node(){ 23 23 this->inputs=NULL; 24 this->hvertex=NULL; 25 this->hupper_node=NULL; 24 26 return; 25 27 } … … 27 29 /*FUNCTION Node::Node(int id, int vertex_id, int uppernode_id, int numdofs, NodeProperties*) {{{2*/ 28 30 Node::Node(int node_id,int node_sid, int node_vertex_id, int node_upper_node_id, int node_numdofs): 29 indexing(node_numdofs), 30 hvertex(&node_vertex_id,1), 31 hupper_node(&node_upper_node_id,1){ 31 indexing(node_numdofs){ 32 32 33 33 this->id=node_id; 34 34 this->sid=node_sid; 35 35 this->inputs=new Inputs(); 36 37 this->hvertex=new Hook(&node_vertex_id,1); 38 this->hupper_node=new Hook(&node_upper_node_id,1); 39 36 40 } 37 41 /*}}}*/ … … 86 90 } 87 91 88 this->hvertex .Init(&vertex_id,1); //node id is the same as the vertex id, continuous galerkin!89 this->hupper_node .Init(&upper_node_id,1);92 this->hvertex=new Hook(&vertex_id,1); //node id is the same as the vertex id, continuous galerkin! 93 this->hupper_node=new Hook(&upper_node_id,1); 90 94 91 95 //intialize inputs, and add as many inputs per element as requested: … … 201 205 indexing.DeepEcho(); 202 206 printf("Vertex:\n"); 203 hvertex .DeepEcho();207 hvertex->DeepEcho(); 204 208 printf("Upper node:\n"); 205 209 //Do not Deepecho the upper_node otherwise DeepEcho will go crazy! 206 hupper_node .Echo();210 hupper_node->Echo(); 207 211 printf(" inputs\n"); 208 212 inputs->DeepEcho(); … … 244 248 /*marshall objects: */ 245 249 indexing.Marshall(&marshalled_dataset); 246 hvertex .Marshall(&marshalled_dataset);247 hupper_node .Marshall(&marshalled_dataset);250 hvertex->Marshall(&marshalled_dataset); 251 hupper_node->Marshall(&marshalled_dataset); 248 252 249 253 /*Marshall inputs: */ … … 266 270 sizeof(sid)+ 267 271 indexing.MarshallSize()+ 268 hvertex .MarshallSize()+269 hupper_node .MarshallSize()+272 hvertex->MarshallSize()+ 273 hupper_node->MarshallSize()+ 270 274 inputs->MarshallSize()+ 271 275 sizeof(analysis_type)+ … … 290 294 /*demarshall objects: */ 291 295 indexing.Demarshall(&marshalled_dataset); 292 hvertex .Demarshall(&marshalled_dataset);293 hupper_node .Demarshall(&marshalled_dataset);296 hvertex=new Hook(); hvertex->Demarshall(&marshalled_dataset); 297 hupper_node=new Hook(); hupper_node->Demarshall(&marshalled_dataset); 294 298 295 299 /*demarshall inputs: */ … … 311 315 Object* Node::copy() { 312 316 313 return new Node(this->id,this->sid,&this->indexing, &this->hvertex,&this->hupper_node,this->inputs,this->analysis_type);317 return new Node(this->id,this->sid,&this->indexing, this->hvertex,this->hupper_node,this->inputs,this->analysis_type); 314 318 315 319 } … … 325 329 /*Take care of hooking up all objects for this element, ie links the objects in the hooks to their respective 326 330 * datasets, using internal ids and offsets hidden in hooks: */ 327 hvertex .configure(verticesin);328 hupper_node .configure(nodesin);331 hvertex->configure(verticesin); 332 hupper_node->configure(nodesin); 329 333 330 334 } … … 341 345 Vertex* vertex=NULL; 342 346 343 vertex=(Vertex*)this->hvertex .delivers();347 vertex=(Vertex*)this->hvertex->delivers(); 344 348 345 349 return vertex->dof; … … 365 369 Vertex* vertex=NULL; 366 370 367 vertex=(Vertex*)hvertex .delivers();371 vertex=(Vertex*)hvertex->delivers(); 368 372 return vertex->id; 369 373 } … … 374 378 Vertex* vertex=NULL; 375 379 376 vertex=(Vertex*)hvertex .delivers();380 vertex=(Vertex*)hvertex->delivers(); 377 381 return vertex->dof; 378 382 } … … 383 387 Vertex* vertex=NULL; 384 388 385 vertex=(Vertex*)hvertex .delivers();389 vertex=(Vertex*)hvertex->delivers(); 386 390 vertex->dof=in_dof; 387 391 … … 706 710 Vertex* vertex=NULL; 707 711 708 vertex=(Vertex*)hvertex .delivers();712 vertex=(Vertex*)hvertex->delivers(); 709 713 return vertex->sigma; 710 714 } … … 713 717 Node* Node::GetUpperNode(){ 714 718 Node* upper_node=NULL; 715 upper_node=(Node*)hupper_node .delivers();719 upper_node=(Node*)hupper_node->delivers(); 716 720 return upper_node; 717 721 } … … 721 725 Vertex* vertex=NULL; 722 726 723 vertex=(Vertex*)hvertex .delivers();727 vertex=(Vertex*)hvertex->delivers(); 724 728 return vertex->x; 725 729 } … … 729 733 Vertex* vertex=NULL; 730 734 731 vertex=(Vertex*)hvertex .delivers();735 vertex=(Vertex*)hvertex->delivers(); 732 736 return vertex->y; 733 737 } … … 737 741 Vertex* vertex=NULL; 738 742 739 vertex=(Vertex*)hvertex .delivers();743 vertex=(Vertex*)hvertex->delivers(); 740 744 return vertex->z; 741 745 } -
issm/trunk/src/c/objects/Node.h
r4248 r4396 27 27 28 28 DofIndexing indexing; 29 Hook 30 Hook 29 Hook* hvertex; 30 Hook* hupper_node; 31 31 Inputs* inputs; //properties of this node 32 32 int analysis_type;
Note:
See TracChangeset
for help on using the changeset viewer.