Changeset 14090
- Timestamp:
- 12/02/12 23:09:31 (12 years ago)
- Location:
- issm/trunk-jpl/src/c
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/Container/Vertices.cpp
r13797 r14090 199 199 } 200 200 /*}}}*/ 201 /*FUNCTION Vertices::ToXYZ{{{*/ 202 double* Vertices::ToXYZ(void){ 203 204 /*intermediary: */ 205 int i; 206 int my_rank; 207 int num_vertices; 208 209 /*output: */ 210 Matrix<IssmDouble>* xyz = NULL; 211 double* xyz_serial=NULL; 212 213 /*recover my_rank:*/ 214 my_rank=IssmComm::GetRank(); 215 216 /*First, figure out number of vertices: */ 217 num_vertices=this->NumberOfVertices(); 218 219 /*Now, allocate matrix to hold all the vertices x,y and z values: */ 220 xyz= new Matrix<IssmDouble>(num_vertices,3); 221 222 /*Go through vertices, and for each vertex, object, report it cpu: */ 223 for(i=0;i<this->Size();i++){ 224 225 /*let vertex fill matrix: */ 226 Vertex* vertex=dynamic_cast<Vertex*>(this->GetObjectByOffset(i)); 227 vertex->ToXYZ(xyz); 228 } 229 230 /*Assemble:*/ 231 xyz->Assemble(); 232 233 /*gather on cpu 0: */ 234 xyz_serial=xyz->ToSerial(); 235 236 /*free ressources: */ 237 delete xyz; 238 if(my_rank!=0)delete xyz_serial; 239 240 /*return matrix: */ 241 return xyz_serial; 242 } 243 /*}}}*/ -
issm/trunk-jpl/src/c/Container/Vertices.h
r13410 r14090 28 28 int NumberOfVertices(void); 29 29 void Ranks(int* ranks); 30 double* ToXYZ(void); 30 31 }; 31 32 -
issm/trunk-jpl/src/c/classes/objects/Vertex.cpp
r13622 r14090 194 194 } 195 195 /*}}}*/ 196 /*FUNCTION Vertex::ToXYZ {{{*/ 197 void Vertex::ToXYZ(Matrix<IssmDouble>* matrix){ 198 199 int i; 200 double xyz[3]; 201 int indices[3]; 202 203 if (this->clone==true)return; 204 else{ 205 206 xyz[0]=x; xyz[1]=y; xyz[2]=z; 207 indices[0]=0;indices[1]=1; indices[2]=2; 208 209 matrix->SetValues(1,&sid,3,&indices[0],&xyz[0],INS_VAL); 210 } 211 } 212 /*}}}*/ -
issm/trunk-jpl/src/c/classes/objects/Vertex.h
r13634 r14090 13 13 #include "../../include/include.h" 14 14 template <class doubletype> class Vector; 15 template <class doubletype> class Matrix; 15 16 class Parameters; 16 17 class IoModel; … … 53 54 void UpdateClonePids(int* allborderpids); 54 55 void SetClone(int* minranks); 56 void ToXYZ(Matrix<IssmDouble>* matrix); 55 57 }; 56 58 #endif /* _VERTEX_H */
Note:
See TracChangeset
for help on using the changeset viewer.