Changeset 14090


Ignore:
Timestamp:
12/02/12 23:09:31 (12 years ago)
Author:
Eric.Larour
Message:

CHG: new xyz routine to create matrix of information about the vertices.

Location:
issm/trunk-jpl/src/c
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/Container/Vertices.cpp

    r13797 r14090  
    199199}
    200200/*}}}*/
     201/*FUNCTION Vertices::ToXYZ{{{*/
     202double* 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  
    2828                int   NumberOfVertices(void);
    2929                void  Ranks(int* ranks);
     30                double* ToXYZ(void);
    3031};
    3132
  • issm/trunk-jpl/src/c/classes/objects/Vertex.cpp

    r13622 r14090  
    194194}
    195195/*}}}*/
     196/*FUNCTION Vertex::ToXYZ {{{*/
     197void  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  
    1313#include "../../include/include.h"
    1414template <class doubletype> class Vector;
     15template <class doubletype> class Matrix;
    1516class Parameters;
    1617class IoModel;
     
    5354                void  UpdateClonePids(int* allborderpids);
    5455                void  SetClone(int* minranks);
     56                void  ToXYZ(Matrix<IssmDouble>* matrix);
    5557};
    5658#endif  /* _VERTEX_H */
Note: See TracChangeset for help on using the changeset viewer.