Changeset 3390
- Timestamp:
- 04/05/10 10:32:18 (15 years ago)
- Location:
- issm/trunk/src/c/objects
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/objects/ElementProperties.h
r3383 r3390 11 11 12 12 /*nodal property values: */ 13 int numnodes;13 int numnodes; 14 14 double* h; 15 15 double* s; -
issm/trunk/src/c/objects/Node.cpp
r3378 r3390 64 64 /*}}}*/ 65 65 66 /*Object ma rshall*/66 /*Object management*/ 67 67 /*FUNCTION Node Marshall{{{1*/ 68 68 void Node::Marshall(char** pmarshalled_dataset){ … … 169 169 } 170 170 /*}}}*/ 171 /*FUNCTION Node GetId{{{1*/ 172 int Node::GetId(void){ return id; } 173 /*}}}*/ 174 /*FUNCTION Node GetName{{{1*/ 175 char* Node::GetName(void){ 176 return "node"; 177 } 178 /*}}}*/ 171 179 172 180 /*Object functions*/ … … 677 685 } 678 686 /*}}}*/ 679 /*FUNCTION Node GetId{{{1*/680 int Node::GetId(void){ return id; }681 /*}}}*/682 /*FUNCTION Node GetName{{{1*/683 char* Node::GetName(void){684 return "node";685 }686 /*}}}*/687 687 /*FUNCTION Node GetNumberOfDofs{{{1*/ 688 688 int Node::GetNumberOfDofs(){ -
issm/trunk/src/c/objects/Node.h
r3372 r3390 22 22 double x[3]; /*! coordinates*/ 23 23 double sigma; /*! sigma = (z-bed)/thickness*/ 24 24 25 int onbed; /*! for 3d, on bedrock*/ 25 26 int onsurface; /*! for 3d, on surface*/ -
issm/trunk/src/c/objects/Vertex.cpp
r3388 r3390 9 9 #endif 10 10 11 #include <string.h> 11 12 #include "./Vertex.h" 12 13 #include "../EnumDefinitions/EnumDefinitions.h" 14 #include "../include/macros.h" 15 #include "../shared/shared.h" 16 #include "../include/typedefs.h" 13 17 #include "../include/macros.h" 14 18 … … 48 52 49 53 void Vertex::DeepEcho(void){ 50 51 printf("Vertex:\n"); 52 printf(" id: %i\n",id); 53 hnodes.DeepEcho(); 54 hmatice.DeepEcho(); 55 hmatpar.DeepEcho(); 56 hnumpar.DeepEcho(); 57 properties.DeepEcho(); 58 59 return; 54 this->Echo(); 60 55 } 61 56 /*}}}*/ … … 73 68 74 69 memcpy(&id,marshalled_dataset,sizeof(id));marshalled_dataset+=sizeof(id); 75 76 /*demarshall hooks: */ 77 hnodes.Demarshall(&marshalled_dataset); 78 hmatice.Demarshall(&marshalled_dataset); 79 hmatpar.Demarshall(&marshalled_dataset); 80 hnumpar.Demarshall(&marshalled_dataset); 81 82 /*demarshall properties: */ 83 properties.Demarshall(&marshalled_dataset); 70 memcpy(&x,marshalled_dataset,sizeof(x));marshalled_dataset+=sizeof(x); 71 memcpy(&y,marshalled_dataset,sizeof(y));marshalled_dataset+=sizeof(y); 72 memcpy(&z,marshalled_dataset,sizeof(z));marshalled_dataset+=sizeof(z); 84 73 85 74 /*return: */ … … 94 83 printf("Vertex:\n"); 95 84 printf(" id: %i\n",id); 96 hnodes.Echo(); 97 hmatice.Echo(); 98 hmatpar.Echo(); 99 hnumpar.Echo(); 100 properties.Echo(); 85 printf(" x: %g\n",x); 86 printf(" y: %g\n",y); 87 printf(" z: %g\n",z); 101 88 102 89 return; … … 108 95 return VertexEnum(); 109 96 97 } 98 /*}}}*/ 99 /*FUNCTION GetId{{{1*/ 100 int Vertex::GetId(void){ return id; } 101 /*}}}*/ 102 /*FUNCTION GetName{{{1*/ 103 char* Vertex::GetName(void){ 104 return "node"; 110 105 } 111 106 /*}}}*/ … … 127 122 /*marshall Vertex data: */ 128 123 memcpy(marshalled_dataset,&id,sizeof(id));marshalled_dataset+=sizeof(id); 129 130 /*Marshall hooks: */ 131 hnodes.Marshall(&marshalled_dataset); 132 hmatice.Marshall(&marshalled_dataset); 133 hmatpar.Marshall(&marshalled_dataset); 134 hnumpar.Marshall(&marshalled_dataset); 135 136 /*Marshall properties: */ 137 properties.Marshall(&marshalled_dataset); 124 memcpy(marshalled_dataset,&x,sizeof(x));marshalled_dataset+=sizeof(x); 125 memcpy(marshalled_dataset,&y,sizeof(y));marshalled_dataset+=sizeof(y); 126 memcpy(marshalled_dataset,&z,sizeof(z));marshalled_dataset+=sizeof(z); 138 127 139 128 *pmarshalled_dataset=marshalled_dataset; … … 144 133 int Vertex::MarshallSize(){ 145 134 146 return sizeof(id) 147 +hnodes.MarshallSize() 148 +hmatice.MarshallSize() 149 +hmatpar.MarshallSize() 150 +hnumpar.MarshallSize() 151 +properties.MarshallSize() 135 return sizeof(id)+ 136 sizeof(x)+ 137 sizeof(y)+ 138 sizeof(z)+ 152 139 +sizeof(int); //sizeof(int) for enum type 153 140 } … … 162 149 void Vertex::UpdateFromDakota(void* vinputs){ 163 150 164 int i; 165 int dofs[1]={0}; 166 double temperature_list[3]; 167 double temperature_average; 168 double B_list[3]; 169 double B_average; 170 double new_h[3]; 171 172 /*dynamic objects pointed to by hooks: */ 173 Node** nodes=NULL; 174 Matpar* matpar=NULL; 175 Matice* matice=NULL; 176 Numpar* numpar=NULL; 177 178 ParameterInputs* inputs=NULL; 179 180 /*recover pointers: */ 181 inputs=(ParameterInputs*)vinputs; 182 183 /*recover objects from hooks: */ 184 nodes=(Node**)hnodes.deliverp(); 185 matpar=(Matpar*)hmatpar.delivers(); 186 matice=(Matice*)hmatice.delivers(); 187 numpar=(Numpar*)hnumpar.delivers(); 188 189 /*Update internal data if inputs holds new values: */ 190 inputs->Recover("thickness",&this->properties.h[0],1,dofs,3,(void**)nodes); 191 192 if(inputs->Recover("thickness",&new_h[0],1,dofs,3,(void**)nodes)){ 193 //density, needed later: 194 double di=(this->matpar->GetRhoIce()/this->matpar->GetRhoWater()); 195 //Go through grids: 196 for (i=0;i<3;i++){ 197 if(nodes[i]->IsOnShelf()){ 198 this->b[i]=this->b[i]-di*(new_h[i]-h[i]); //hydrostatic equilibrium; 199 } 200 this->s[i]=this->b[i]+new_h[i]; 201 this->h[i]=new_h[i]; 202 } 203 } 151 ISSMERROR("not supported yet!"); 204 152 205 153 } … … 208 156 void Vertex::UpdateFromInputs(void* vinputs){ 209 157 210 int i; 211 int dofs[1]={0}; 212 double temperature_list[3]; 213 double temperature_average; 214 double B_list[3]; 215 double B_average; 216 double new_h[3]; 217 218 /*dynamic objects pointed to by hooks: */ 219 Node** nodes=NULL; 220 Matpar* matpar=NULL; 221 Matice* matice=NULL; 222 Numpar* numpar=NULL; 223 224 ParameterInputs* inputs=NULL; 225 226 /*recover pointers: */ 227 inputs=(ParameterInputs*)vinputs; 228 229 /*recover objects from hooks: */ 230 nodes=(Node**)hnodes.deliverp(); 231 matpar=(Matpar*)hmatpar.delivers(); 232 matice=(Matice*)hmatice.delivers(); 233 numpar=(Numpar*)hnumpar.delivers(); 234 235 /*Update internal data if inputs holds new values: */ 236 //if (id==1) printf("WARNING if QMU: no hydrostatic equilibrium is applied here (conflict with prognostic, which does not have matpar)\n"); 237 //For now 238 inputs->Recover("thickness",&this->properties.h[0],1,dofs,3,(void**)nodes); 239 //Later 240 /* 241 if(inputs->Recover("thickness",&new_h[0],1,dofs,3,(void**)nodes)){ 242 //density, needed later: 243 double di=(this->matpar->GetRhoIce()/this->matpar->GetRhoWater()); 244 //Go through grids: 245 for (i=0;i<3;i++){ 246 if(nodes[i]->IsOnShelf()){ 247 this->b[i]=this->b[i]-di*(new_h[i]-h[i]); //hydrostatic equilibrium; 248 } 249 this->s[i]=this->b[i]+new_h[i]; 250 this->h[i]=new_h[i]; 251 } 252 } 253 */ 254 inputs->Recover("surface",&this->properties.s[0],1,dofs,3,(void**)nodes); 255 inputs->Recover("bed",&this->properties.b[0],1,dofs,3,(void**)nodes); 256 inputs->Recover("drag",&this->properties.k[0],1,dofs,3,(void**)nodes); 257 inputs->Recover("melting",&this->properties.melting[0],1,dofs,3,(void**)nodes); 258 inputs->Recover("accumulation",&this->properties.accumulation[0],1,dofs,3,(void**)nodes); 259 inputs->Recover("geothermalflux",&this->properties.geothermalflux[0],1,dofs,3,(void**)nodes); 158 ISSMERROR("not supported yet!"); 260 159 261 //Update material if necessary262 if(inputs->Recover("temperature_average",&temperature_list[0],1,dofs,3,(void**)nodes)){263 temperature_average=(temperature_list[0]+temperature_list[1]+temperature_list[2])/3.0;264 B_average=Paterson(temperature_average);265 matice->SetB(B_average);266 }267 268 if(inputs->Recover("B",&B_list[0],1,dofs,3,(void**)nodes)){269 B_average=(B_list[0]+B_list[1]+B_list[2])/3.0;270 matice->SetB(B_average);271 }272 273 160 } 274 161 /*}}}*/ -
issm/trunk/src/c/objects/Vertex.h
r3388 r3390 6 6 #define _VERTEX_H_ 7 7 8 #include "./Object.h" 8 9 9 class Vertex {10 class Vertex: public Object{ 10 11 11 12 private: … … 29 30 void Echo(); 30 31 int Enum(); 31 int Id(); 32 int GetId(void); 33 char* GetName(); 32 34 void Marshall(char** pmarshalled_dataset); 33 35 int MarshallSize();
Note:
See TracChangeset
for help on using the changeset viewer.