Ice Sheet System Model  4.18
Code documentation
Tetra.cpp
Go to the documentation of this file.
1 
4 /*Headers:*/
5 /*{{{*/
6 #ifdef HAVE_CONFIG_H
7 #include <config.h>
8 #else
9 #error "Cannot compile with HAVE_CONFIG_H symbol! run configure first!"
10 #endif
11 
12 #include <stdio.h>
13 #include <string.h>
14 #include "../classes.h"
15 #include "../Inputs2/ElementInput2.h"
16 #include "../../shared/shared.h"
17 /*}}}*/
18 
19 /*Element macros*/
20 #define NUMVERTICES 4
21 
22 /*Constructors/destructor/copy*/
23 Tetra::Tetra(int tet_id, int tet_sid,int tet_lid,IoModel* iomodel,int nummodels)/*{{{*/
24  :ElementHook(nummodels,tet_id,NUMVERTICES,iomodel){
25 
26  /*id: */
27  this->id = tet_id;
28  this->sid = tet_sid;
29  this->lid = tet_lid;
30 
31  /*surface and base*/
32  this->isonsurface = false;
33  this->isonbase = false;
34 
35  //this->parameters: we still can't point to it, it may not even exist. Configure will handle this.
36  this->parameters = NULL;
37 
38  /*initialize pointers:*/
39  this->nodes = NULL;
40  this->vertices = NULL;
41  this->material = NULL;
42 
43  /*Only allocate pointer*/
44  this->element_type_list=xNew<int>(nummodels);
45 
46  /*surface and base*/
47  _assert_(iomodel->Data("md.mesh.vertexonsurface"));
48  _assert_(iomodel->Data("md.mesh.vertexonbase"));
49  this->isonsurface = false;
50  this->isonbase = false;
51  IssmDouble sum = 0.;
52  for(int i=0;i<NUMVERTICES;i++) sum += iomodel->Data("md.mesh.vertexonsurface")[reCast<int>(iomodel->elements[(tet_id-1)*NUMVERTICES+i])-1];
53  _assert_(sum>=0 && sum<4);
54  if(sum>2.5) this->isonsurface = true;
55  sum = 0.;
56  for(int i=0;i<NUMVERTICES;i++) sum += iomodel->Data("md.mesh.vertexonbase")[reCast<int>(iomodel->elements[(tet_id-1)*NUMVERTICES+i])-1];
57  _assert_(sum>=0 && sum<4);
58  if(sum>2.5) this->isonbase = true;
59  }
60 /*}}}*/
61 Tetra::~Tetra(){/*{{{*/
62  this->parameters=NULL;
63 }
64 /*}}}*/
65 Object* Tetra::copy() {/*{{{*/
66 
67  int i;
68  Tetra* tetra=NULL;
69 
70  tetra=new Tetra();
71 
72  //deal with TetraRef mother class
73  int nanalyses = this->numanalyses;
74  if(nanalyses > 0){
75  tetra->element_type_list=xNew<int>(nanalyses);
76  for(i=0;i<nanalyses;i++){
77  if (this->element_type_list[i]) tetra->element_type_list[i]=this->element_type_list[i];
78  else tetra->element_type_list[i] = 0;
79  }
80  }
81  else tetra->element_type_list = NULL;
82  tetra->element_type=this->element_type;
83  tetra->numanalyses=nanalyses;
84 
85  //deal with ElementHook mother class
86  if (this->hnodes){
87  tetra->hnodes=xNew<Hook*>(tetra->numanalyses);
88  for(i=0;i<tetra->numanalyses;i++){
89  if (this->hnodes[i]) tetra->hnodes[i] = (Hook*)(this->hnodes[i]->copy());
90  else tetra->hnodes[i] = NULL;
91  }
92  }
93  else tetra->hnodes = NULL;
94 
95  tetra->hvertices = (Hook*)this->hvertices->copy();
96  tetra->hmaterial = (Hook*)this->hmaterial->copy();
97  tetra->hneighbors = NULL;
98 
99  /*deal with Tria fields: */
100  tetra->id = this->id;
101  tetra->sid = this->sid;
102  tetra->lid = this->lid;
103  tetra->isonbase = this->isonbase;
104  tetra->isonsurface = this->isonsurface;
105 
106  /*point parameters: */
107  tetra->parameters=this->parameters;
108 
109  /*recover objects: */
110  unsigned int num_nodes = 4;
111  tetra->nodes = xNew<Node*>(num_nodes); //we cannot rely on an analysis_counter to tell us which analysis_type we are running, so we just copy the nodes.
112  for(i=0;i<num_nodes;i++) if(this->nodes[i]) tetra->nodes[i]=this->nodes[i]; else tetra->nodes[i] = NULL;
113 
114  tetra->vertices = (Vertex**)this->hvertices->deliverp();
115  tetra->material = (Material*)this->hmaterial->delivers();
116 
117  return tetra;
118 }
119 /*}}}*/
120 void Tetra::Marshall(char** pmarshalled_data,int* pmarshalled_data_size, int marshall_direction){ /*{{{*/
121 
123  MARSHALLING(this->isonsurface);
124  MARSHALLING(this->isonbase);
125 
126  /*Call parent classes: */
127  ElementHook::Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
128  Element::MarshallElement(pmarshalled_data,pmarshalled_data_size,marshall_direction,this->numanalyses);
129  TetraRef::Marshall(pmarshalled_data,pmarshalled_data_size,marshall_direction);
130 
131  vertices = (Vertex**)this->hvertices->deliverp();
132  material = (Material*)this->hmaterial->delivers();
133 
134 }
135 /*}}}*/
136 
137 void Tetra::Configure(Elements* elementsin, Loads* loadsin, Nodes* nodesin,Vertices* verticesin, Materials* materialsin, Parameters* parametersin,Inputs2* inputs2in){/*{{{*/
138 
139  int analysis_counter;
140 
141  /*go into parameters and get the analysis_counter: */
142  parametersin->FindParam(&analysis_counter,AnalysisCounterEnum);
143 
144  /*Get Element type*/
145  this->element_type=this->element_type_list[analysis_counter];
146 
147  /*Take care of hooking up all objects for this element, ie links the objects in the hooks to their respective
148  * datasets, using internal ids and offsets hidden in hooks: */
149  if (this->hnodes[analysis_counter]) this->hnodes[analysis_counter]->configure(nodesin);
150  this->hvertices->configure(verticesin);
151  this->hmaterial->configure(materialsin);
152 
153  /*Now, go pick up the objects inside the hooks: */
154  if (this->hnodes[analysis_counter]) this->nodes=(Node**)this->hnodes[analysis_counter]->deliverp();
155  else this->nodes=NULL;
156  this->vertices = (Vertex**)this->hvertices->deliverp();
157  this->material = (Material*)this->hmaterial->delivers();
158 
159  /*point parameters to real dataset: */
160  this->parameters=parametersin;
161  this->inputs2=inputs2in;
162 }
163 /*}}}*/
165 
166  IssmDouble xyz_list[NUMVERTICES][3];
167  IssmDouble xmin,ymin,zmin;
168  IssmDouble xmax,ymax,zmax;
169 
170  /*Get xyz list: */
172  xmin=xyz_list[0][0]; xmax=xyz_list[0][0];
173  ymin=xyz_list[0][1]; ymax=xyz_list[0][1];
174  zmin=xyz_list[0][2]; zmax=xyz_list[0][2];
175 
176  for(int i=1;i<NUMVERTICES;i++){
177  if(xyz_list[i][0]<xmin) xmin=xyz_list[i][0];
178  if(xyz_list[i][0]>xmax) xmax=xyz_list[i][0];
179  if(xyz_list[i][1]<ymin) ymin=xyz_list[i][1];
180  if(xyz_list[i][1]>ymax) ymax=xyz_list[i][1];
181  if(xyz_list[i][2]<zmin) zmin=xyz_list[i][2];
182  if(xyz_list[i][2]>zmax) zmax=xyz_list[i][2];
183  }
184 
185  *hx=xmax-xmin;
186  *hy=ymax-ymin;
187  *hz=zmax-zmin;
188 }
189 /*}}}*/
190 void Tetra::FaceOnBaseIndices(int* pindex1,int* pindex2,int* pindex3){/*{{{*/
191 
192  IssmDouble values[NUMVERTICES];
193  int indices[4][3] = {{0,1,2},{0,3,1},{1,3,2},{0,2,3}};
194 
195  /*Retrieve all inputs and parameters*/
197 
198  for(int i=0;i<4;i++){
199  if(values[indices[i][0]] == 1. && values[indices[i][1]] == 1. && values[indices[i][2]] == 1.){
200  *pindex1 = indices[i][0];
201  *pindex2 = indices[i][1];
202  *pindex3 = indices[i][2];
203  return;
204  }
205  }
206 
207  _error_("Could not find 3 vertices on bed");
208 }
209 /*}}}*/
210 void Tetra::FaceOnFrontIndices(int* pindex1,int* pindex2,int* pindex3){/*{{{*/
211 
212  IssmDouble values[NUMVERTICES];
213  int indices[4][3] = {{0,1,2},{0,3,1},{1,3,2},{0,2,3}};
214 
215  /*Retrieve all inputs and parameters*/
217 
218  for(int i=0;i<4;i++){
219  if(values[indices[i][0]] == 0. && values[indices[i][1]] == 0. && values[indices[i][2]] == 0.){
220  *pindex1 = indices[i][0];
221  *pindex2 = indices[i][1];
222  *pindex3 = indices[i][2];
223  return;
224  }
225  }
226 
227  _error_("Could not find 3 vertices on bed");
228 }
229 /*}}}*/
230 void Tetra::FaceOnSurfaceIndices(int* pindex1,int* pindex2,int* pindex3){/*{{{*/
231 
232  IssmDouble values[NUMVERTICES];
233  int indices[4][3] = {{0,1,2},{0,3,1},{1,3,2},{0,2,3}};
234 
235  /*Retrieve all inputs and parameters*/
237 
238  for(int i=0;i<4;i++){
239  if(values[indices[i][0]] == 1. && values[indices[i][1]] == 1. && values[indices[i][2]] == 1.){
240  *pindex1 = indices[i][0];
241  *pindex2 = indices[i][1];
242  *pindex3 = indices[i][2];
243  return;
244  }
245  }
246 
247  _error_("Could not find 3 vertices on bed");
248 }
249 /*}}}*/
250 int Tetra::FiniteElement(void){/*{{{*/
251  return this->element_type;
252 } /*}}}*/
254 
255  /*return TetraRef field*/
256  return this->element_type;
257 }
258 /*}}}*/
259 Input2* Tetra::GetInput2(int inputenum){/*{{{*/
260  _error_("not implemented yet");
261 }/*}}}*/
262 Input2* Tetra::GetInput2(int inputenum,IssmDouble time){/*{{{*/
263  _error_("not implemented yet");
264 }/*}}}*/
265 void Tetra::GetInputListOnVertices(IssmDouble* pvalue,Input2* input,IssmDouble default_value){/*{{{*/
266 
267  /*Checks in debugging mode*/
268  _assert_(pvalue);
269 
270  /* Start looping on the number of vertices: */
271  if(input){
272  GaussTetra gauss;
273  for(int iv=0;iv<NUMVERTICES;iv++){
274  gauss.GaussVertex(iv);
275  input->GetInputValue(&pvalue[iv],&gauss);
276  }
277  }
278  else{
279  for(int iv=0;iv<NUMVERTICES;iv++) pvalue[iv] = default_value;
280  }
281 }
282 /*}}}*/
283 void Tetra::GetInputListOnNodes(IssmDouble* pvalue,Input2* input,IssmDouble default_value){/*{{{*/
284 
285  /*Checks in debugging mode*/
286  _assert_(pvalue);
287 
288  /*What type of finite element are we dealing with?*/
289  int fe = this->FiniteElement();
290  int numnodes = this->GetNumberOfNodes();
291 
292  /* Start looping on the number of vertices: */
293  if(input){
294  GaussTetra gauss;
295  for(int iv=0;iv<numnodes;iv++){
296  gauss.GaussNode(fe,iv);
297  input->GetInputValue(&pvalue[iv],&gauss);
298  }
299  }
300  else{
301  for(int iv=0;iv<numnodes;iv++) pvalue[iv] = default_value;
302  }
303 }
304 /*}}}*/
305 void Tetra::GetInputValue(IssmDouble* pvalue,Node* node,int enumtype){/*{{{*/
306 
307  Input2* input=this->GetInput2(enumtype);
308  if(!input) _error_("No input of type " << EnumToStringx(enumtype) << " found in tria");
309 
310  GaussTetra* gauss=new GaussTetra();
311  gauss->GaussVertex(this->GetNodeIndex(node));
312 
313  input->GetInputValue(pvalue,gauss);
314  delete gauss;
315 }
316 /*}}}*/
317 int Tetra::GetNumberOfNodes(void){/*{{{*/
318  return this->NumberofNodes(this->element_type);
319 }
320 /*}}}*/
321 int Tetra::GetNumberOfVertices(void){/*{{{*/
322  return NUMVERTICES;
323 }
324 /*}}}*/
326 
327  int indices[3];
328  IssmDouble xyz_list[NUMVERTICES][3];
329 
330  /*Element XYZ list*/
331  ::GetVerticesCoordinates(&xyz_list[0][0],this->vertices,NUMVERTICES);
332 
333  /*Allocate Output*/
334  IssmDouble* xyz_list_edge = xNew<IssmDouble>(3*3);
335  this->FaceOnBaseIndices(&indices[0],&indices[1],&indices[2]);
336  for(int i=0;i<3;i++) for(int j=0;j<3;j++) xyz_list_edge[i*3+j]=xyz_list[indices[i]][j];
337 
338  /*Assign output pointer*/
339  *pxyz_list = xyz_list_edge;
340 
341 }/*}}}*/
343 
344  int indices[3];
345  IssmDouble xyz_list[NUMVERTICES][3];
346 
347  /*Element XYZ list*/
348  ::GetVerticesCoordinates(&xyz_list[0][0],this->vertices,NUMVERTICES);
349 
350  /*Allocate Output*/
351  IssmDouble* xyz_list_edge = xNew<IssmDouble>(3*3);
352  this->FaceOnSurfaceIndices(&indices[0],&indices[1],&indices[2]);
353  for(int i=0;i<3;i++) for(int j=0;j<3;j++) xyz_list_edge[i*3+j]=xyz_list[indices[i]][j];
354 
355  /*Assign output pointer*/
356  *pxyz_list = xyz_list_edge;
357 
358 }/*}}}*/
359 bool Tetra::HasFaceOnBase(){/*{{{*/
360 
361  IssmDouble values[NUMVERTICES];
362  IssmDouble sum;
363 
364  /*Retrieve all inputs and parameters*/
366  sum = values[0]+values[1]+values[2]+values[3];
367 
368  _assert_(sum==0. || sum==1. || sum==2. || sum==3.);
369 
370  if(sum==3){
371  return true;
372  }
373  else{
374  return false;
375  }
376 }
377 /*}}}*/
379 
380  IssmDouble values[NUMVERTICES];
381  IssmDouble sum;
382 
383  /*Retrieve all inputs and parameters*/
385  sum = values[0]+values[1]+values[2]+values[3];
386 
387  _assert_(sum==0. || sum==1. || sum==2. || sum==3.);
388 
389  if(sum==3){
390  return true;
391  }
392  else{
393  return false;
394  }
395 }
396 /*}}}*/
397 void Tetra::InputUpdateFromIoModel(int index,IoModel* iomodel){ /*{{{*/
398 
399  /*Intermediaries*/
400  int i,j;
401  int tetra_vertex_ids[NUMVERTICES];
402  IssmDouble nodeinputs[NUMVERTICES];
403  IssmDouble cmmininputs[NUMVERTICES];
404  IssmDouble cmmaxinputs[NUMVERTICES];
405 
406  IssmDouble yts;
407  bool control_analysis;
408  char** controls = NULL;
409  int num_control_type,num_responses;
410 
411  /*Fetch parameters: */
412  iomodel->FindConstant(&yts,"md.constants.yts");
413  iomodel->FindConstant(&control_analysis,"md.inversion.iscontrol");
414  if(control_analysis) iomodel->FindConstant(&num_control_type,"md.inversion.num_control_parameters");
415  if(control_analysis) iomodel->FindConstant(&num_responses,"md.inversion.num_cost_functions");
416 
417  /*Recover vertices ids needed to initialize inputs*/
418  _assert_(iomodel->elements);
419  for(i=0;i<NUMVERTICES;i++){
420  tetra_vertex_ids[i]=iomodel->elements[NUMVERTICES*index+i]; //ids for vertices are in the elements array from Matlab
421  }
422 }
423 /*}}}*/
424 void Tetra::InputUpdateFromSolutionOneDof(IssmDouble* solution,int enum_type){/*{{{*/
425 
426  /*Intermediary*/
427  int* doflist = NULL;
428 
429  /*Fetch number of nodes for this finite element*/
430  int numnodes = this->NumberofNodes(this->element_type);
431 
432  /*Fetch dof list and allocate solution vector*/
434  IssmDouble* values = xNew<IssmDouble>(numnodes);
435 
436  /*Use the dof list to index into the solution vector: */
437  for(int i=0;i<numnodes;i++){
438  values[i]=solution[doflist[i]];
439  if(xIsNan<IssmDouble>(values[i])) _error_("NaN found in solution vector");
440  if(xIsInf<IssmDouble>(values[i])) _error_("Inf found in solution vector");
441  }
442 
443  /*Add input to the element: */
444  this->AddInput2(enum_type,values,this->element_type);
445 
446  /*Free ressources:*/
447  xDelete<IssmDouble>(values);
448  xDelete<int>(doflist);
449 }
450 /*}}}*/
451 bool Tetra::IsIcefront(void){/*{{{*/
452 
453  /*Retrieve all inputs and parameters*/
456 
457  /* If only one vertex has ice, there is an ice front here */
458  if(IsIceInElement()){
459  int nrice=0;
460  for(int i=0;i<NUMVERTICES;i++) if(ls[i]<0.) nrice++;
461  if(nrice==1) return true;
462  }
463  return false;
464 }/*}}}*/
465 void Tetra::JacobianDeterminant(IssmDouble* pJdet,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
466 
467  _assert_(gauss->Enum()==GaussTetraEnum);
468  this->GetJacobianDeterminant(pJdet,xyz_list,(GaussTetra*)gauss);
469 
470 }
471 /*}}}*/
472 void Tetra::JacobianDeterminantBase(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss){/*{{{*/
473 
474  _assert_(gauss->Enum()==GaussTetraEnum);
475  this->GetJacobianDeterminantFace(pJdet,xyz_list_base,(GaussTetra*)gauss);
476 
477 }
478 /*}}}*/
479 void Tetra::JacobianDeterminantSurface(IssmDouble* pJdet,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
480 
481  _assert_(gauss->Enum()==GaussTetraEnum);
482  this->GetJacobianDeterminantFace(pJdet,xyz_list,(GaussTetra*)gauss);
483 
484 }
485 /*}}}*/
486 void Tetra::JacobianDeterminantTop(IssmDouble* pJdet,IssmDouble* xyz_list_base,Gauss* gauss){/*{{{*/
487 
488  _assert_(gauss->Enum()==GaussTetraEnum);
489  this->GetJacobianDeterminantFace(pJdet,xyz_list_base,(GaussTetra*)gauss);
490 
491 }
492 /*}}}*/
493 Gauss* Tetra::NewGauss(void){/*{{{*/
494  return new GaussTetra();
495 }
496 /*}}}*/
497 Gauss* Tetra::NewGauss(int order){/*{{{*/
498  return new GaussTetra(order);
499 }
500 /*}}}*/
501 Gauss* Tetra::NewGauss(IssmDouble* xyz_list, IssmDouble* xyz_list_front,int order_horiz,int order_vert){/*{{{*/
502  /*FIXME: this is messed up, should provide indices and not xyz_list!*/
503  int indices[3];
504  this->FaceOnFrontIndices(&indices[0],&indices[1],&indices[2]);
505  return new GaussTetra(indices[0],indices[1],indices[2],max(order_horiz,order_vert));
506 }
507 /*}}}*/
508 Gauss* Tetra::NewGaussBase(int order){/*{{{*/
509 
510  int indices[3];
511  this->FaceOnBaseIndices(&indices[0],&indices[1],&indices[2]);
512  return new GaussTetra(indices[0],indices[1],indices[2],order);
513 }
514 /*}}}*/
515 Gauss* Tetra::NewGaussTop(int order){/*{{{*/
516 
517  int indices[3];
518  this->FaceOnSurfaceIndices(&indices[0],&indices[1],&indices[2]);
519  return new GaussTetra(indices[0],indices[1],indices[2],order);
520 }
521 /*}}}*/
522 void Tetra::NodalFunctions(IssmDouble* basis, Gauss* gauss){/*{{{*/
523 
524  _assert_(gauss->Enum()==GaussTetraEnum);
525  this->GetNodalFunctions(basis,(GaussTetra*)gauss,this->element_type);
526 
527 }
528 /*}}}*/
529 void Tetra::NodalFunctionsDerivatives(IssmDouble* dbasis,IssmDouble* xyz_list,Gauss* gauss){/*{{{*/
530 
531  _assert_(gauss->Enum()==GaussTetraEnum);
532  this->GetNodalFunctionsDerivatives(dbasis,xyz_list,(GaussTetra*)gauss,this->element_type);
533 
534 }
535 /*}}}*/
537 
538  _assert_(gauss->Enum()==GaussTetraEnum);
539  this->GetNodalFunctionsDerivatives(dbasis,xyz_list,(GaussTetra*)gauss,this->VelocityInterpolation());
540 
541 }
542 /*}}}*/
543 void Tetra::NodalFunctionsPressure(IssmDouble* basis, Gauss* gauss){/*{{{*/
544 
545  _assert_(gauss->Enum()==GaussTetraEnum);
546  this->GetNodalFunctions(basis,(GaussTetra*)gauss,this->PressureInterpolation());
547 
548 }
549 /*}}}*/
550 void Tetra::NodalFunctionsTensor(IssmDouble* basis, Gauss* gauss){/*{{{*/
551 
552  _assert_(gauss->Enum()==GaussTetraEnum);
553  this->GetNodalFunctions(basis,(GaussTetra*)gauss,this->TensorInterpolation());
554 
555 }
556 /*}}}*/
557 void Tetra::NodalFunctionsVelocity(IssmDouble* basis, Gauss* gauss){/*{{{*/
558 
559  _assert_(gauss->Enum()==GaussTetraEnum);
560  this->GetNodalFunctions(basis,(GaussTetra*)gauss,this->VelocityInterpolation());
561 
562 }
563 /*}}}*/
564 void Tetra::NormalBase(IssmDouble* bed_normal,IssmDouble* xyz_list){/*{{{*/
565 
566  IssmDouble v13[3],v23[3];
567  IssmDouble normal[3];
568  IssmDouble normal_norm;
569 
570  for(int i=0;i<3;i++){
571  v13[i]=xyz_list[0*3+i]-xyz_list[2*3+i];
572  v23[i]=xyz_list[1*3+i]-xyz_list[2*3+i];
573  }
574 
575  normal[0]=v13[1]*v23[2]-v13[2]*v23[1];
576  normal[1]=v13[2]*v23[0]-v13[0]*v23[2];
577  normal[2]=v13[0]*v23[1]-v13[1]*v23[0];
578  normal_norm=sqrt(normal[0]*normal[0]+ normal[1]*normal[1]+ normal[2]*normal[2]);
579 
580  /*Bed normal is opposite to surface normal*/
581  bed_normal[0]=-normal[0]/normal_norm;
582  bed_normal[1]=-normal[1]/normal_norm;
583  bed_normal[2]=-normal[2]/normal_norm;
584 
585  _assert_(bed_normal[2]<0.);
586 }
587 /*}}}*/
588 void Tetra::NormalSection(IssmDouble* normal,IssmDouble* xyz_list){/*{{{*/
589 
590  /*Build unit outward pointing vector*/
591  IssmDouble AB[3];
592  IssmDouble AC[3];
593  IssmDouble norm;
594 
595  AB[0]=xyz_list[1*3+0] - xyz_list[0*3+0];
596  AB[1]=xyz_list[1*3+1] - xyz_list[0*3+1];
597  AB[2]=xyz_list[1*3+2] - xyz_list[0*3+2];
598  AC[0]=xyz_list[2*3+0] - xyz_list[0*3+0];
599  AC[1]=xyz_list[2*3+1] - xyz_list[0*3+1];
600  AC[2]=xyz_list[2*3+2] - xyz_list[0*3+2];
601 
602  cross(normal,AB,AC);
603  norm=sqrt(normal[0]*normal[0]+normal[1]*normal[1]+normal[2]*normal[2]);
604 
605  for(int i=0;i<3;i++) normal[i]=normal[i]/norm;
606 }
607 /*}}}*/
608 void Tetra::NormalTop(IssmDouble* top_normal,IssmDouble* xyz_list){/*{{{*/
609 
610  IssmDouble v13[3],v23[3];
611  IssmDouble normal[3];
612  IssmDouble normal_norm;
613 
614  for(int i=0;i<3;i++){
615  v13[i]=xyz_list[0*3+i]-xyz_list[2*3+i];
616  v23[i]=xyz_list[1*3+i]-xyz_list[2*3+i];
617  }
618 
619  normal[0]=v13[1]*v23[2]-v13[2]*v23[1];
620  normal[1]=v13[2]*v23[0]-v13[0]*v23[2];
621  normal[2]=v13[0]*v23[1]-v13[1]*v23[0];
622  normal_norm=sqrt(normal[0]*normal[0]+ normal[1]*normal[1]+ normal[2]*normal[2]);
623 
624  top_normal[0]=normal[0]/normal_norm;
625  top_normal[1]=normal[1]/normal_norm;
626  top_normal[2]=normal[2]/normal_norm;
627  _assert_(top_normal[2]>0.);
628 }
629 /*}}}*/
632 }
633 /*}}}*/
636 }
637 /*}}}*/
638 int Tetra::ObjectEnum(void){/*{{{*/
639 
640  return TetraEnum;
641 
642 }/*}}}*/
645 }
646 /*}}}*/
648 
649  if(pe){
650  if(this->element_type==MINIcondensedEnum){
651  int indices[3]={12,13,14};
652  pe->StaticCondensation(Ke,3,&indices[0]);
653  }
654  else if(this->element_type==P1bubblecondensedEnum){
656  int offset = 0;
657  for(int i=0;i<4;i++) offset+=nodes[i]->GetNumberOfDofs(NoneApproximationEnum,GsetEnum);
658  int* indices=xNew<int>(size);
659  for(int i=0;i<size;i++) indices[i] = offset+i;
660  pe->StaticCondensation(Ke,size,indices);
661  xDelete<int>(indices);
662  }
663  }
664 
665  if(Ke){
666  if(this->element_type==MINIcondensedEnum){
667  int indices[3]={12,13,14};
668  Ke->StaticCondensation(3,&indices[0]);
669  }
670  else if(this->element_type==P1bubblecondensedEnum){
672  int offset = 0;
673  for(int i=0;i<4;i++) offset+=nodes[i]->GetNumberOfDofs(NoneApproximationEnum,GsetEnum);
674  int* indices=xNew<int>(size);
675  for(int i=0;i<size;i++) indices[i] = offset+i;
676  Ke->StaticCondensation(size,indices);
677  xDelete<int>(indices);
678  }
679  }
680 }
681 /*}}}*/
683 
684  int numnodes = this->GetNumberOfNodes();
685 
686  int approximation;
687  IssmDouble* vertexonbase= NULL;
688  IssmDouble slopex,slopey,groundedice;
689  IssmDouble xz_plane[6];
690 
691  /*For FS only: we want the CS to be tangential to the bedrock*/
692  this->GetInput2Value(&approximation,ApproximationEnum);
693  if(!HasNodeOnBase() || approximation!=FSApproximationEnum) return;
694 
695  //printf("element number %i \n",this->id);
696  /*Get inputs*/
697  Input2* slopex_input=this->GetInput2(BedSlopeXEnum); _assert_(slopex_input);
698  Input2* slopey_input=this->GetInput2(BedSlopeYEnum); _assert_(slopey_input);
699  Input2* groundedicelevelset_input=this->GetInput2(MaskOceanLevelsetEnum); _assert_(groundedicelevelset_input);
700  vertexonbase = xNew<IssmDouble>(numnodes);
701  this->GetInputListOnNodesVelocity(&vertexonbase[0],MeshVertexonbaseEnum);
702 
703  /*Loop over basal nodes and update their CS*/
704  GaussTetra* gauss = new GaussTetra();
705  for(int i=0;i<this->NumberofNodesVelocity();i++){
706 
707  if(vertexonbase[i]==1){
708  gauss->GaussNode(this->VelocityInterpolation(),i);
709 
710  slopex_input->GetInputValue(&slopex,gauss);
711  slopey_input->GetInputValue(&slopey,gauss);
712  groundedicelevelset_input->GetInputValue(&groundedice,gauss);
713 
714  /*New X axis New Z axis*/
715  xz_plane[0]=1.; xz_plane[3]=-slopex;
716  xz_plane[1]=0.; xz_plane[4]=-slopey;
717  xz_plane[2]=slopex; xz_plane[5]=1.;
718 
719  if(groundedice>0){
720  if(this->nodes[i]->GetApproximation()==FSvelocityEnum){
721  this->nodes[i]->DofInSSet(2); //vz
722  }
723  else _error_("Flow equation approximation"<<EnumToStringx(this->nodes[i]->GetApproximation())<<" not supported yet");
724  }
725  else{
726  if(this->nodes[i]->GetApproximation()==FSvelocityEnum){
727  this->nodes[i]->DofInFSet(2); //vz
728  }
729  else _error_("Flow equation approximation"<<EnumToStringx(this->nodes[i]->GetApproximation())<<" not supported yet");
730  }
731 
732  XZvectorsToCoordinateSystem(&this->nodes[i]->coord_system[0][0],&xz_plane[0]);
733  }
734  }
735 
736  /*cleanup*/
737  xDelete<IssmDouble>(vertexonbase);
738  delete gauss;
739 }
740 /*}}}*/
741 void Tetra::ResetHooks(){/*{{{*/
742 
743  if(this->nodes) xDelete<Node*>(this->nodes);
744  this->nodes=NULL;
745  this->vertices=NULL;
746  this->material=NULL;
747  this->parameters=NULL;
748 
749  //deal with ElementHook mother class
750  for(int i=0;i<this->numanalyses;i++) if(this->hnodes[i]) this->hnodes[i]->reset();
751  this->hvertices->reset();
752  this->hmaterial->reset();
753  if(this->hneighbors) this->hneighbors->reset();
754 }
755 /*}}}*/
756 void Tetra::SetCurrentConfiguration(Elements* elementsin, Loads* loadsin, Nodes* nodesin, Materials* materialsin, Parameters* parametersin){/*{{{*/
757 
758  /*go into parameters and get the analysis_counter: */
759  int analysis_counter;
760  parametersin->FindParam(&analysis_counter,AnalysisCounterEnum);
761 
762  /*Get Element type*/
763  this->element_type=this->element_type_list[analysis_counter];
764 
765  /*Pick up nodes*/
766  if(this->hnodes[analysis_counter]) this->nodes=(Node**)this->hnodes[analysis_counter]->deliverp();
767  else this->nodes=NULL;
768 
769 }
770 /*}}}*/
772 
774 
775  int index1,index2,index3;
776  this->FaceOnBaseIndices(&index1,&index2,&index3);
777  return SpawnTria(index1,index2,index3);
778 }/*}}}*/
780 
782 
783  int index1,index2,index3;
784  this->FaceOnSurfaceIndices(&index1,&index2,&index3);
785  return SpawnTria(index1,index2,index3);
786 }/*}}}*/
787 Tria* Tetra::SpawnTria(int index1,int index2,int index3){/*{{{*/
788 
789  int analysis_counter;
790 
791  /*go into parameters and get the analysis_counter: */
792  this->parameters->FindParam(&analysis_counter,AnalysisCounterEnum);
793 
794  /*Create Tria*/
795  Tria* tria=new Tria();
796  tria->id=this->id;
797  tria->parameters=this->parameters;
798  tria->element_type=P1Enum; //Only P1 CG for now (TO BE CHANGED)
799  this->SpawnTriaHook(xDynamicCast<ElementHook*>(tria),index1,index2,index3);
800 
801  /*Spawn material*/
802  tria->material=(Material*)this->material->copy2(tria);
803 
804  /*recover nodes, material*/
805  tria->nodes = (Node**)tria->hnodes[analysis_counter]->deliverp();
806  tria->vertices = (Vertex**)tria->hvertices->deliverp();
807 
808  /*Return new Tria*/
809  return tria;
810 }
811 /*}}}*/
812 int Tetra::TensorInterpolation(void){/*{{{*/
814 }
815 /*}}}*/
816 void Tetra::Update(Inputs2* inputs2,int index,IoModel* iomodel,int analysis_counter,int analysis_type,int finiteelement_type){ /*{{{*/
817 
818  /*Intermediaries*/
819  int i;
820  int tetra_vertex_ids[6];
821  IssmDouble nodeinputs[6];
822  IssmDouble yts;
823  bool dakota_analysis;
824  bool isFS;
825  int numnodes;
826  int* tetra_node_ids = NULL;
827 
828  /*Fetch parameters: */
829  iomodel->FindConstant(&yts,"md.constants.yts");
830  iomodel->FindConstant(&dakota_analysis,"md.qmu.isdakota");
831  iomodel->FindConstant(&isFS,"md.flowequation.isFS");
832 
833  /*Checks if debuging*/
834  _assert_(iomodel->elements);
835  _assert_(index==this->sid);
836 
837  /*Recover element type*/
838  this->element_type_list[analysis_counter]=finiteelement_type;
839 
840  /*Recover vertices ids needed to initialize inputs*/
841  for(i=0;i<4;i++) tetra_vertex_ids[i]=iomodel->elements[4*index+i]; //ids for vertices are in the elements array from Matlab
842 
843  /*Recover nodes ids needed to initialize the node hook.*/
844  switch(finiteelement_type){
845  case P1Enum:
846  numnodes = 4;
847  tetra_node_ids = xNew<int>(numnodes);
848  tetra_node_ids[0]=iomodel->elements[4*index+0];
849  tetra_node_ids[1]=iomodel->elements[4*index+1];
850  tetra_node_ids[2]=iomodel->elements[4*index+2];
851  tetra_node_ids[3]=iomodel->elements[4*index+3];
852  break;
854  numnodes = 5;
855  tetra_node_ids = xNew<int>(numnodes);
856  tetra_node_ids[0]=iomodel->elements[4*index+0];
857  tetra_node_ids[1]=iomodel->elements[4*index+1];
858  tetra_node_ids[2]=iomodel->elements[4*index+2];
859  tetra_node_ids[3]=iomodel->elements[4*index+3];
860  tetra_node_ids[4]=iomodel->numberofvertices+index+1;
861  break;
862  case P2Enum:
863  numnodes = 10;
864  tetra_node_ids = xNew<int>(numnodes);
865  tetra_node_ids[0]=iomodel->elements[4*index+0];
866  tetra_node_ids[1]=iomodel->elements[4*index+1];
867  tetra_node_ids[2]=iomodel->elements[4*index+2];
868  tetra_node_ids[3]=iomodel->elements[4*index+3];
869  tetra_node_ids[4]=iomodel->numberofvertices+iomodel->elementtoedgeconnectivity[6*index+0]+1;
870  tetra_node_ids[5]=iomodel->numberofvertices+iomodel->elementtoedgeconnectivity[6*index+1]+1;
871  tetra_node_ids[6]=iomodel->numberofvertices+iomodel->elementtoedgeconnectivity[6*index+2]+1;
872  tetra_node_ids[7]=iomodel->numberofvertices+iomodel->elementtoedgeconnectivity[6*index+3]+1;
873  tetra_node_ids[8]=iomodel->numberofvertices+iomodel->elementtoedgeconnectivity[6*index+4]+1;
874  tetra_node_ids[9]=iomodel->numberofvertices+iomodel->elementtoedgeconnectivity[6*index+5]+1;
875  break;
876  case MINIEnum: case MINIcondensedEnum:
877  numnodes = 9;
878  tetra_node_ids = xNew<int>(numnodes);
879  tetra_node_ids[0]=iomodel->elements[4*index+0];
880  tetra_node_ids[1]=iomodel->elements[4*index+1];
881  tetra_node_ids[2]=iomodel->elements[4*index+2];
882  tetra_node_ids[3]=iomodel->elements[4*index+3];
883  tetra_node_ids[4]=iomodel->numberofvertices+index+1;
884 
885  tetra_node_ids[5]=iomodel->numberofvertices+iomodel->numberofelements+iomodel->elements[4*index+0];
886  tetra_node_ids[6]=iomodel->numberofvertices+iomodel->numberofelements+iomodel->elements[4*index+1];
887  tetra_node_ids[7]=iomodel->numberofvertices+iomodel->numberofelements+iomodel->elements[4*index+2];
888  tetra_node_ids[8]=iomodel->numberofvertices+iomodel->numberofelements+iomodel->elements[4*index+3];
889  break;
890  case TaylorHoodEnum:
891  case XTaylorHoodEnum:
892  numnodes = 14;
893  tetra_node_ids = xNew<int>(numnodes);
894  tetra_node_ids[0]=iomodel->elements[4*index+0];
895  tetra_node_ids[1]=iomodel->elements[4*index+1];
896  tetra_node_ids[2]=iomodel->elements[4*index+2];
897  tetra_node_ids[3]=iomodel->elements[4*index+3];
898  tetra_node_ids[4]=iomodel->numberofvertices+iomodel->elementtoedgeconnectivity[6*index+0]+1;
899  tetra_node_ids[5]=iomodel->numberofvertices+iomodel->elementtoedgeconnectivity[6*index+1]+1;
900  tetra_node_ids[6]=iomodel->numberofvertices+iomodel->elementtoedgeconnectivity[6*index+2]+1;
901  tetra_node_ids[7]=iomodel->numberofvertices+iomodel->elementtoedgeconnectivity[6*index+3]+1;
902  tetra_node_ids[8]=iomodel->numberofvertices+iomodel->elementtoedgeconnectivity[6*index+4]+1;
903  tetra_node_ids[9]=iomodel->numberofvertices+iomodel->elementtoedgeconnectivity[6*index+5]+1;
904 
905  tetra_node_ids[10]=iomodel->numberofvertices+iomodel->numberofedges+iomodel->elements[4*index+0];
906  tetra_node_ids[11]=iomodel->numberofvertices+iomodel->numberofedges+iomodel->elements[4*index+1];
907  tetra_node_ids[12]=iomodel->numberofvertices+iomodel->numberofedges+iomodel->elements[4*index+2];
908  tetra_node_ids[13]=iomodel->numberofvertices+iomodel->numberofedges+iomodel->elements[4*index+3];
909  break;
910  case LATaylorHoodEnum:
911  numnodes = 10;
912  tetra_node_ids = xNew<int>(numnodes);
913  tetra_node_ids[0]=iomodel->elements[4*index+0];
914  tetra_node_ids[1]=iomodel->elements[4*index+1];
915  tetra_node_ids[2]=iomodel->elements[4*index+2];
916  tetra_node_ids[3]=iomodel->elements[4*index+3];
917  tetra_node_ids[4]=iomodel->numberofvertices+iomodel->elementtoedgeconnectivity[6*index+0]+1;
918  tetra_node_ids[5]=iomodel->numberofvertices+iomodel->elementtoedgeconnectivity[6*index+1]+1;
919  tetra_node_ids[6]=iomodel->numberofvertices+iomodel->elementtoedgeconnectivity[6*index+2]+1;
920  tetra_node_ids[7]=iomodel->numberofvertices+iomodel->elementtoedgeconnectivity[6*index+3]+1;
921  tetra_node_ids[8]=iomodel->numberofvertices+iomodel->elementtoedgeconnectivity[6*index+4]+1;
922  tetra_node_ids[9]=iomodel->numberofvertices+iomodel->elementtoedgeconnectivity[6*index+5]+1;
923  break;
924  default:
925  _error_("Finite element "<<EnumToStringx(finiteelement_type)<<" not supported yet");
926  }
927 
928  /*hooks: */
929  this->SetHookNodes(tetra_node_ids,numnodes,analysis_counter); this->nodes=NULL;
930  xDelete<int>(tetra_node_ids);
931 
932  /*Fill with IoModel*/
933  this->InputUpdateFromIoModel(index,iomodel);
934 }
935 /*}}}*/
936 void Tetra::ValueP1OnGauss(IssmDouble* pvalue,IssmDouble* values,Gauss* gauss){/*{{{*/
937  TetraRef::GetInputValue(pvalue,values,gauss,P1Enum);
938 }
939 /*}}}*/
942 }
943 /*}}}*/
944 void Tetra::ViscousHeating(IssmDouble* pphi,IssmDouble* xyz_list,Gauss* gauss,Input2* vx_input,Input2* vy_input,Input2* vz_input){/*{{{*/
945 
946  /*Intermediaries*/
947  IssmDouble phi;
948  IssmDouble viscosity;
949  IssmDouble epsilon[6];
950 
951  _assert_(gauss->Enum()==GaussTetraEnum);
952  this->StrainRateFS(&epsilon[0],xyz_list,(GaussTetra*)gauss,vx_input,vy_input,vz_input);
953  this->material->ViscosityFS(&viscosity,3,xyz_list,(GaussTetra*)gauss,vx_input,vy_input,vz_input);
954  GetPhi(&phi,&epsilon[0],viscosity);
955 
956  /*Assign output pointer*/
957  *pphi = phi;
958 }
959 /*}}}*/
Tetra::HasFaceOnBase
bool HasFaceOnBase()
Definition: Tetra.cpp:359
Element::lid
int lid
Definition: Element.h:46
Tetra::SpawnTria
Tria * SpawnTria(int index1, int index2, int index3)
Definition: Tetra.cpp:787
Vertices
Declaration of Vertices class.
Definition: Vertices.h:15
ElementVector::StaticCondensation
void StaticCondensation(ElementMatrix *Ke, int numindices, int *indices)
Definition: ElementVector.cpp:266
GaussTetra
Definition: GaussTetra.h:12
Tetra::HasFaceOnSurface
bool HasFaceOnSurface()
Definition: Tetra.cpp:378
_assert_
#define _assert_(ignore)
Definition: exceptions.h:37
IssmDouble
double IssmDouble
Definition: types.h:37
Nodes
Declaration of Nodes class.
Definition: Nodes.h:19
GaussTetra::GaussVertex
void GaussVertex(int iv)
Definition: GaussTetra.cpp:233
TetraEnum
@ TetraEnum
Definition: EnumDefinitions.h:1300
Tetra::PressureInterpolation
int PressureInterpolation(void)
Definition: Tetra.cpp:643
TetraRef::GetInputValue
void GetInputValue(IssmDouble *p, IssmDouble *plist, Gauss *gauss, int finiteelement)
Definition: TetraRef.cpp:71
ElementHook::SetHookNodes
void SetHookNodes(int *node_ids, int numnodes, int analysis_counter)
Definition: ElementHook.cpp:188
Tetra::Tetra
Tetra()
Definition: Tetra.h:32
Tetra::NodalFunctions
void NodalFunctions(IssmDouble *basis, Gauss *gauss)
Definition: Tetra.cpp:522
TetraRef::VelocityInterpolation
int VelocityInterpolation(int fe_stokes)
Definition: TetraRef.cpp:391
MaskOceanLevelsetEnum
@ MaskOceanLevelsetEnum
Definition: EnumDefinitions.h:640
Hook::deliverp
Object ** deliverp(void)
Definition: Hook.cpp:187
Parameters
Declaration of Parameters class.
Definition: Parameters.h:18
TetraRef::GetJacobianDeterminant
void GetJacobianDeterminant(IssmDouble *Jdet, IssmDouble *xyz_list, GaussTetra *gauss)
Definition: TetraRef.cpp:125
MaskIceLevelsetEnum
@ MaskIceLevelsetEnum
Definition: EnumDefinitions.h:641
Tetra::JacobianDeterminantBase
void JacobianDeterminantBase(IssmDouble *pJdet, IssmDouble *xyz_list_base, Gauss *gauss)
Definition: Tetra.cpp:472
MARSHALLING_ENUM
#define MARSHALLING_ENUM(EN)
Definition: Marshalling.h:14
Tetra::ResetFSBasalBoundaryCondition
void ResetFSBasalBoundaryCondition(void)
Definition: Tetra.cpp:682
MINIEnum
@ MINIEnum
Definition: EnumDefinitions.h:1156
TetraRef::TensorInterpolation
int TensorInterpolation(int fe_stokes)
Definition: TetraRef.cpp:382
Element::StrainRateFS
void StrainRateFS(IssmDouble *epsilon, IssmDouble *xyz_list, Gauss *gauss, Input2 *vx_input, Input2 *vy_input, Input2 *vz_input)
Definition: Element.cpp:4055
Tetra::NodalFunctionsDerivatives
void NodalFunctionsDerivatives(IssmDouble *dbasis, IssmDouble *xyz_list, Gauss *gauss)
Definition: Tetra.cpp:529
MeshVertexonbaseEnum
@ MeshVertexonbaseEnum
Definition: EnumDefinitions.h:653
Material::copy2
virtual Material * copy2(Element *element)=0
Elements
Declaration of Elements class.
Definition: Elements.h:17
Element::vertices
Vertex ** vertices
Definition: Element.h:49
Material
Definition: Material.h:21
AnalysisCounterEnum
@ AnalysisCounterEnum
Definition: EnumDefinitions.h:35
TetraRef::GetJacobianDeterminantFace
void GetJacobianDeterminantFace(IssmDouble *Jdet, IssmDouble *xyz_list, GaussTetra *gauss)
Definition: TetraRef.cpp:139
Tetra::InputUpdateFromSolutionOneDof
void InputUpdateFromSolutionOneDof(IssmDouble *solution, int inputenum)
Definition: Tetra.cpp:424
Tetra::NumberofNodesPressure
int NumberofNodesPressure(void)
Definition: Tetra.cpp:630
Tetra::JacobianDeterminant
void JacobianDeterminant(IssmDouble *Jdet, IssmDouble *xyz_list, Gauss *gauss)
Definition: Tetra.cpp:465
BedSlopeXEnum
@ BedSlopeXEnum
Definition: EnumDefinitions.h:500
P1bubblecondensedEnum
@ P1bubblecondensedEnum
Definition: EnumDefinitions.h:1219
Tetra::NodalFunctionsTensor
void NodalFunctionsTensor(IssmDouble *basis, Gauss *gauss)
Definition: Tetra.cpp:550
Tetra::Marshall
void Marshall(char **pmarshalled_data, int *pmarshalled_data_size, int marshall_direction)
Definition: Tetra.cpp:120
Tetra::GetInput2
Input2 * GetInput2(int enumtype)
Definition: Tetra.cpp:259
Element::isonbase
bool isonbase
Definition: Element.h:53
FSApproximationEnum
@ FSApproximationEnum
Definition: EnumDefinitions.h:1060
ElementHook
Definition: ElementHook.h:11
Hook::reset
void reset(void)
Definition: Hook.cpp:211
Tetra::FiniteElement
int FiniteElement(void)
Definition: Tetra.cpp:250
Tetra::GetInputListOnVertices
void GetInputListOnVertices(IssmDouble *pvalue, Input2 *input, IssmDouble default_value)
Definition: Tetra.cpp:265
Tetra::NewGauss
Gauss * NewGauss(void)
Definition: Tetra.cpp:493
ElementHook::hmaterial
Hook * hmaterial
Definition: ElementHook.h:17
Tetra::InputUpdateFromIoModel
void InputUpdateFromIoModel(int index, IoModel *iomodel)
Definition: Tetra.cpp:397
Tetra::GetNumberOfNodes
int GetNumberOfNodes(void)
Definition: Tetra.cpp:317
GaussTetraEnum
@ GaussTetraEnum
Definition: EnumDefinitions.h:1080
TetraRef::NumberofNodes
int NumberofNodes(int finiteelement)
Definition: TetraRef.cpp:345
Element::nodes
Node ** nodes
Definition: Element.h:48
Element
Definition: Element.h:41
Tetra::NormalSection
void NormalSection(IssmDouble *normal, IssmDouble *xyz_list)
Definition: Tetra.cpp:588
IoModel::numberofvertices
int numberofvertices
Definition: IoModel.h:99
P1Enum
@ P1Enum
Definition: EnumDefinitions.h:662
ElementMatrix::StaticCondensation
void StaticCondensation(int numindices, int *indices)
Definition: ElementMatrix.cpp:524
TaylorHoodEnum
@ TaylorHoodEnum
Definition: EnumDefinitions.h:1299
Element::GetPhi
void GetPhi(IssmDouble *phi, IssmDouble *epsilon, IssmDouble viscosity)
Definition: Element.cpp:1244
LATaylorHoodEnum
@ LATaylorHoodEnum
Definition: EnumDefinitions.h:1139
IoModel::numberofelements
int numberofelements
Definition: IoModel.h:96
Object
Definition: Object.h:13
Tetra
Definition: Tetra.h:27
Hook::delivers
Object * delivers(void)
Definition: Hook.cpp:191
Element::inputs2
Inputs2 * inputs2
Definition: Element.h:47
NoneApproximationEnum
@ NoneApproximationEnum
Definition: EnumDefinitions.h:1201
Materials
Declaration of Materials class.
Definition: Materials.h:16
Element::id
int id
Definition: Element.h:44
Element::sid
int sid
Definition: Element.h:45
Element::AddInput2
virtual void AddInput2(int input_enum, IssmDouble *values, int interpolation_enum)
Definition: Element.h:216
ApproximationEnum
@ ApproximationEnum
Definition: EnumDefinitions.h:470
EnumToStringx
const char * EnumToStringx(int enum_in)
Definition: EnumToStringx.cpp:15
Tetra::NewGaussBase
Gauss * NewGaussBase(int order)
Definition: Tetra.cpp:508
Hook
Definition: Hook.h:16
Element::element_type_list
int * element_type_list
Definition: Element.h:55
Hook::configure
void configure(DataSet *dataset)
Definition: Hook.cpp:145
Tetra::IsIcefront
bool IsIcefront(void)
Definition: Tetra.cpp:451
GsetEnum
@ GsetEnum
Definition: EnumDefinitions.h:1093
IoModel::elementtoedgeconnectivity
int * elementtoedgeconnectivity
Definition: IoModel.h:83
Tetra::ReduceMatrices
void ReduceMatrices(ElementMatrix *Ke, ElementVector *pe)
Definition: Tetra.cpp:647
IoModel::FindConstant
void FindConstant(bool *pvalue, const char *constant_name)
Definition: IoModel.cpp:2362
Element::GetInput2Value
void GetInput2Value(bool *pvalue, int enum_type)
Definition: Element.cpp:1185
Material::ViscosityFS
virtual void ViscosityFS(IssmDouble *pviscosity, int dim, IssmDouble *xyz_list, Gauss *gauss, Input2 *vx_input, Input2 *vy_input, Input2 *vz_input)=0
MARSHALLING
#define MARSHALLING(FIELD)
Definition: Marshalling.h:29
Element::GetVerticesCoordinates
void GetVerticesCoordinates(IssmDouble **xyz_list)
Definition: Element.cpp:1446
Tetra::NewGaussTop
Gauss * NewGaussTop(int order)
Definition: Tetra.cpp:515
Tetra::GetInputValue
void GetInputValue(IssmDouble *pvalue, Node *node, int enumtype)
Definition: Tetra.cpp:305
Tetra::NormalBase
void NormalBase(IssmDouble *normal, IssmDouble *xyz_list)
Definition: Tetra.cpp:564
MINIcondensedEnum
@ MINIcondensedEnum
Definition: EnumDefinitions.h:1157
Tetra::GetNumberOfVertices
int GetNumberOfVertices(void)
Definition: Tetra.cpp:321
Tetra::GetVerticesCoordinatesTop
void GetVerticesCoordinatesTop(IssmDouble **pxyz_list)
Definition: Tetra.cpp:342
Gauss::Enum
virtual int Enum(void)=0
Inputs2
Declaration of Inputs class.
Definition: Inputs2.h:23
Tetra::copy
Object * copy()
Definition: Tetra.cpp:65
Tetra::~Tetra
~Tetra()
Definition: Tetra.cpp:61
GaussTetra::GaussNode
void GaussNode(int finitelement, int iv)
Definition: GaussTetra.cpp:186
Hook::copy
Object * copy(void)
Definition: Hook.cpp:61
FSvelocityEnum
@ FSvelocityEnum
Definition: EnumDefinitions.h:1063
P1bubbleEnum
@ P1bubbleEnum
Definition: EnumDefinitions.h:1218
Tetra::ElementSizes
void ElementSizes(IssmDouble *hx, IssmDouble *hy, IssmDouble *hz)
Definition: Tetra.cpp:164
ElementHook::Marshall
void Marshall(char **pmarshalled_data, int *pmarshalled_data_size, int marshall_direction)
Definition: ElementHook.cpp:67
Input2
Definition: Input2.h:18
Element::GetDofListLocal
void GetDofListLocal(int **pdoflist, int approximation_enum, int setenum)
Definition: Element.cpp:984
Tetra::Update
void Update(Inputs2 *inputs2, int index, IoModel *iomodel, int analysis_counter, int analysis_type, int finitelement)
Definition: Tetra.cpp:816
TetraRef::Marshall
void Marshall(char **pmarshalled_data, int *pmarshalled_data_size, int marshall_direction)
Definition: TetraRef.h:27
cross
void cross(IssmDouble *result, IssmDouble *vector1, IssmDouble *vector2)
Definition: cross.cpp:13
Tetra::VelocityInterpolation
int VelocityInterpolation(void)
Definition: Tetra.cpp:940
Tetra::NodalFunctionsDerivativesVelocity
void NodalFunctionsDerivativesVelocity(IssmDouble *dbasis, IssmDouble *xyz_list, Gauss *gauss)
Definition: Tetra.cpp:536
Tetra::SetCurrentConfiguration
void SetCurrentConfiguration(Elements *elements, Loads *loads, Nodes *nodes, Materials *materials, Parameters *parameters)
Definition: Tetra.cpp:756
Element::IsIceInElement
bool IsIceInElement()
Definition: Element.cpp:2021
IoModel::Data
IssmDouble * Data(const char *data_name)
Definition: IoModel.cpp:437
Loads
Declaration of Loads class.
Definition: Loads.h:16
TetraRef::GetNodalFunctionsDerivatives
void GetNodalFunctionsDerivatives(IssmDouble *dbasis, IssmDouble *xyz_list, GaussTetra *gauss, int finiteelement)
Definition: TetraRef.cpp:217
Node
Definition: Node.h:23
Tetra::NodalFunctionsVelocity
void NodalFunctionsVelocity(IssmDouble *basis, Gauss *gauss)
Definition: Tetra.cpp:557
_error_
#define _error_(StreamArgs)
Definition: exceptions.h:49
ElementHook::hvertices
Hook * hvertices
Definition: ElementHook.h:16
Tria
Definition: Tria.h:29
Node::DofInFSet
void DofInFSet(int dof)
Definition: Node.cpp:694
XZvectorsToCoordinateSystem
void XZvectorsToCoordinateSystem(IssmDouble *T, IssmDouble *xzvectors)
Definition: XZvectorsToCoordinateSystem.cpp:8
Element::parameters
Parameters * parameters
Definition: Element.h:51
MeshVertexonsurfaceEnum
@ MeshVertexonsurfaceEnum
Definition: EnumDefinitions.h:655
Node::DofInSSet
void DofInSSet(int dof)
Definition: Node.cpp:709
Tetra::GetVerticesCoordinatesBase
void GetVerticesCoordinatesBase(IssmDouble **pxyz_list)
Definition: Tetra.cpp:325
Tetra::NodalFunctionsPressure
void NodalFunctionsPressure(IssmDouble *basis, Gauss *gauss)
Definition: Tetra.cpp:543
Tetra::GetElementType
int GetElementType(void)
Definition: Tetra.cpp:253
Tetra::ViscousHeating
void ViscousHeating(IssmDouble *pphi, IssmDouble *xyz_list, Gauss *gauss, Input2 *vx_input, Input2 *vy_input, Input2 *vz_input)
Definition: Tetra.cpp:944
Tetra::ObjectEnum
int ObjectEnum()
Definition: Tetra.cpp:638
NUMVERTICES
#define NUMVERTICES
Definition: Tetra.cpp:20
ElementHook::hneighbors
Hook * hneighbors
Definition: ElementHook.h:18
Parameters::FindParam
void FindParam(bool *pinteger, int enum_type)
Definition: Parameters.cpp:262
Tetra::FaceOnBaseIndices
void FaceOnBaseIndices(int *pindex1, int *pindex2, int *pindex3)
Definition: Tetra.cpp:190
TetraRef::PressureInterpolation
int PressureInterpolation(int fe_stokes)
Definition: TetraRef.cpp:367
Element::GetNodeIndex
int GetNodeIndex(Node *node)
Definition: Element.cpp:1212
TetraRef::GetNodalFunctions
void GetNodalFunctions(IssmDouble *basis, Gauss *gauss_in, int finiteelement)
Definition: TetraRef.cpp:170
P2Enum
@ P2Enum
Definition: EnumDefinitions.h:1223
ElementHook::hnodes
Hook ** hnodes
Definition: ElementHook.h:15
ElementVector
Definition: ElementVector.h:20
IoModel::elements
int * elements
Definition: IoModel.h:79
Element::MarshallElement
void MarshallElement(char **pmarshalled_data, int *pmarshalled_data_size, int marshall_direction, int numanalyses)
Definition: Element.cpp:2222
Input2::GetInputValue
virtual void GetInputValue(IssmDouble *pvalue, Gauss *gauss)
Definition: Input2.h:38
Vertex
Definition: Vertex.h:19
Element::HasNodeOnBase
bool HasNodeOnBase()
Definition: Element.cpp:1561
Tetra::ValueP1OnGauss
void ValueP1OnGauss(IssmDouble *pvalue, IssmDouble *values, Gauss *gauss)
Definition: Tetra.cpp:936
IoModel
Definition: IoModel.h:48
ElementHook::SpawnTriaHook
void SpawnTriaHook(ElementHook *triahook, int index1, int index2, int index3)
Definition: ElementHook.cpp:217
Tetra::NormalTop
void NormalTop(IssmDouble *normal, IssmDouble *xyz_list)
Definition: Tetra.cpp:608
Tetra::FaceOnSurfaceIndices
void FaceOnSurfaceIndices(int *pindex1, int *pindex2, int *pindex3)
Definition: Tetra.cpp:230
max
IssmDouble max(IssmDouble a, IssmDouble b)
Definition: extrema.cpp:24
Tetra::Configure
void Configure(Elements *elements, Loads *loads, Nodes *nodesin, Vertices *verticesin, Materials *materials, Parameters *parameters, Inputs2 *inputs2in)
Definition: Tetra.cpp:137
Tetra::FaceOnFrontIndices
void FaceOnFrontIndices(int *pindex1, int *pindex2, int *pindex3)
Definition: Tetra.cpp:210
Element::GetInputListOnVertices
void GetInputListOnVertices(IssmDouble *pvalue, int enumtype)
Definition: Element.cpp:1131
Tetra::TensorInterpolation
int TensorInterpolation(void)
Definition: Tetra.cpp:812
ElementMatrix
Definition: ElementMatrix.h:19
Tetra::SpawnTopElement
Element * SpawnTopElement(void)
Definition: Tetra.cpp:779
Tetra::GetInputListOnNodes
void GetInputListOnNodes(IssmDouble *pvalue, Input2 *input, IssmDouble default_value)
Definition: Tetra.cpp:283
Element::GetInputListOnNodesVelocity
void GetInputListOnNodesVelocity(IssmDouble *pvalue, int enumtype)
Definition: Element.cpp:1114
Element::isonsurface
bool isonsurface
Definition: Element.h:52
Element::element_type
int element_type
Definition: Element.h:56
Node::GetNumberOfDofs
int GetNumberOfDofs(int approximation_enum, int setenum)
Definition: Node.cpp:741
Gauss
Definition: Gauss.h:8
Element::material
Material * material
Definition: Element.h:50
Tetra::JacobianDeterminantSurface
void JacobianDeterminantSurface(IssmDouble *pJdet, IssmDouble *xyz_list, Gauss *gauss)
Definition: Tetra.cpp:479
GetNumberOfDofs
int GetNumberOfDofs(Node **nodes, int numnodes, int setenum, int approximation)
Definition: Node.cpp:1129
Tetra::SpawnBasalElement
Element * SpawnBasalElement(void)
Definition: Tetra.cpp:771
BedSlopeYEnum
@ BedSlopeYEnum
Definition: EnumDefinitions.h:501
XTaylorHoodEnum
@ XTaylorHoodEnum
Definition: EnumDefinitions.h:1329
IoModel::numberofedges
int numberofedges
Definition: IoModel.h:93
Tetra::NumberofNodesVelocity
int NumberofNodesVelocity(void)
Definition: Tetra.cpp:634
Tetra::ResetHooks
void ResetHooks()
Definition: Tetra.cpp:741
Tetra::JacobianDeterminantTop
void JacobianDeterminantTop(IssmDouble *pJdet, IssmDouble *xyz_list_base, Gauss *gauss)
Definition: Tetra.cpp:486
ElementHook::numanalyses
int numanalyses
Definition: ElementHook.h:14