Ice Sheet System Model  4.18
Code documentation
VertexCoordinatesx.cpp
Go to the documentation of this file.
1 
6 #include "./VertexCoordinatesx.h"
7 
8 #include "../../shared/shared.h"
9 #include "../../toolkits/toolkits.h"
10 
11 void VertexCoordinatesx( IssmDouble** px, IssmDouble** py, IssmDouble** pz, Vertices* vertices,bool spherical) {
12 
13  /*output: */
14  IssmDouble* x=NULL;
15  IssmDouble* y=NULL;
16  IssmDouble* z=NULL;
17 
18  Vector<IssmDouble>* vx=NULL;
19  Vector<IssmDouble>* vy=NULL;
20  Vector<IssmDouble>* vz=NULL;
21 
22  /*intermediary: */
23  int numberofvertices;
24  int i;
25 
26  /*figure out how many vertices we have: */
27  numberofvertices=vertices->NumberOfVertices();
28 
29  vx=new Vector<IssmDouble>(numberofvertices);
30  vy=new Vector<IssmDouble>(numberofvertices);
31  vz=new Vector<IssmDouble>(numberofvertices);
32 
33  /*march through our vertices: */
34  for(i=0;i<vertices->Size();i++){
35  Vertex* vertex=(Vertex*)vertices->GetObjectByOffset(i);
36  vertex->VertexCoordinates(vx,vy,vz,spherical);
37  }
38 
39  /*Assemble*/
40  vx->Assemble();
41  vy->Assemble();
42  vz->Assemble();
43 
44  /*serialize: */
45  x=vx->ToMPISerial();
46  y=vy->ToMPISerial();
47  z=vz->ToMPISerial();
48 
49  /*Free ressources: */
50  delete vx;
51  delete vy;
52  delete vz;
53 
54  /*output: */
55  if (px)*px=x;
56  else xDelete<IssmDouble>(x);
57  if (py)*py=y;
58  else xDelete<IssmDouble>(y);
59  if (pz)*pz=z;
60  else xDelete<IssmDouble>(z);
61 }
DataSet::Size
int Size()
Definition: DataSet.cpp:399
Vertices
Declaration of Vertices class.
Definition: Vertices.h:15
IssmDouble
double IssmDouble
Definition: types.h:37
Vertices::NumberOfVertices
int NumberOfVertices(void)
Definition: Vertices.cpp:255
Vector::Assemble
void Assemble(void)
Definition: Vector.h:142
DataSet::GetObjectByOffset
Object * GetObjectByOffset(int offset)
Definition: DataSet.cpp:334
Vertex::VertexCoordinates
void VertexCoordinates(Vector< IssmDouble > *vx, Vector< IssmDouble > *vy, Vector< IssmDouble > *vz, bool spherical=false)
Definition: Vertex.cpp:205
VertexCoordinatesx
void VertexCoordinatesx(IssmDouble **px, IssmDouble **py, IssmDouble **pz, Vertices *vertices, bool spherical)
Definition: VertexCoordinatesx.cpp:11
Vertex
Definition: Vertex.h:19
Vector::ToMPISerial
doubletype * ToMPISerial(void)
Definition: Vector.h:277
VertexCoordinatesx.h
Vector< IssmDouble >