Changeset 25827


Ignore:
Timestamp:
12/04/20 13:54:48 (4 years ago)
Author:
Mathieu Morlighem
Message:

CHG: reverting to no rank

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

Legend:

Unmodified
Added
Removed
  • TabularUnified issm/trunk-jpl/src/c/classes/FemModel.cpp

    r25812 r25827  
    38143814
    38153815        /*Get vertices coordinates*/
    3816         VertexCoordinatesx(&x,&y,&z,NULL,femmodel_vertices,false) ;
     3816        VertexCoordinatesx(&x,&y,&z,femmodel_vertices,false) ;
    38173817
    38183818        /*Get element vertices*/
     
    49714971
    49724972        /*recover lat,long and radius vectors from vertices: */
    4973         VertexCoordinatesx(&latitude,&longitude,&radius,NULL,this->vertices,spherical);
     4973        VertexCoordinatesx(&latitude,&longitude,&radius,this->vertices,spherical);
    49744974
    49754975        /* Green's function (1+k_2-h_2/g): checked against Glenn Milne's thesis Chapter 3 (eqs: 3.3-4, 3.10-11)
  • TabularUnified issm/trunk-jpl/src/c/classes/Vertex.cpp

    r25812 r25827  
    205205}
    206206/*}}}*/
    207 void       Vertex::VertexCoordinates(Vector<IssmDouble>* vx,Vector<IssmDouble>* vy,Vector<IssmDouble>* vz,Vector<IssmDouble>* vrank,bool spherical){/*{{{*/
     207void       Vertex::VertexCoordinates(Vector<IssmDouble>* vx,Vector<IssmDouble>* vy,Vector<IssmDouble>* vz,bool spherical){/*{{{*/
    208208
    209209        if(this->clone==true) return;
     
    219219                vz->SetValue(this->sid,this->R,INS_VAL);
    220220        }
    221         if(vrank){
    222                 int rank=IssmComm::GetRank();
    223                 vrank->SetValue(this->sid,rank,INS_VAL);
    224         }
    225 
    226221        return;
    227222}
  • TabularUnified issm/trunk-jpl/src/c/classes/Vertex.h

    r25812 r25827  
    6161                int        Sid(void);
    6262                void       UpdatePosition(Vector<IssmDouble>* vx,Vector<IssmDouble>* vy,Vector<IssmDouble>* vz,Parameters* parameters,IssmDouble* thickness,IssmDouble* bed);
    63                 void       VertexCoordinates(Vector<IssmDouble>* vx,Vector<IssmDouble>* vy,Vector<IssmDouble>* vz,Vector<IssmDouble>* vrank,bool spherical=false);
     63                void       VertexCoordinates(Vector<IssmDouble>* vx,Vector<IssmDouble>* vy,Vector<IssmDouble>* vz,bool spherical=false);
    6464};
    6565
  • TabularUnified issm/trunk-jpl/src/c/cores/esa_core.cpp

    r25812 r25827  
    4444
    4545        /* recover coordinates of vertices: */
    46         VertexCoordinatesx(&latitude,&longitude,&radius,NULL,femmodel->vertices,spherical);
    47         VertexCoordinatesx(&xx,&yy,&zz,NULL,femmodel->vertices);
     46        VertexCoordinatesx(&latitude,&longitude,&radius,femmodel->vertices,spherical);
     47        VertexCoordinatesx(&xx,&yy,&zz,femmodel->vertices);
    4848
    4949        /*Figure out size of g-set deflection vector and allocate solution vector: */
  • TabularUnified issm/trunk-jpl/src/c/cores/gia_core.cpp

    r25812 r25827  
    4545
    4646                /*first, recover x and y vectors from vertices: */
    47                 VertexCoordinatesx(&x,&y,NULL,NULL,femmodel->vertices); //no need for z coordinate
     47                VertexCoordinatesx(&x,&y,NULL,femmodel->vertices); //no need for z coordinate
    4848
    4949                /*call the main module: */
  • TabularUnified issm/trunk-jpl/src/c/cores/sealevelchange_core.cpp

    r25812 r25827  
    392392
    393393        /*first, recover lat,long and radius vectors from vertices: */
    394         VertexCoordinatesx(&latitude,&longitude,&radius,NULL,femmodel->vertices,spherical);
    395         if(horiz) VertexCoordinatesx(&xx,&yy,&zz,NULL,femmodel->vertices);
     394        VertexCoordinatesx(&latitude,&longitude,&radius,femmodel->vertices,spherical);
     395        if(horiz) VertexCoordinatesx(&xx,&yy,&zz,femmodel->vertices);
    396396
    397397
     
    659659
    660660        /*retrieve geometric information: */
    661         VertexCoordinatesx(&latitude,&longitude,&radius,NULL,femmodel->vertices,spherical);
    662         VertexCoordinatesx(&xx,&yy,&zz,NULL,femmodel->vertices);
     661        VertexCoordinatesx(&latitude,&longitude,&radius,femmodel->vertices,spherical);
     662        VertexCoordinatesx(&xx,&yy,&zz,femmodel->vertices);
    663663
    664664        /*call the elastic main modlule:*/
  • TabularUnified issm/trunk-jpl/src/c/main/esmfbinders.cpp

    r25826 r25827  
    66#include <ESMC.h>
    77
    8 /*GCM specific declarations:*/
     8/*GEOS 5 specific declarations:*/
    99const int GCMForcingNumTerms = 1;
    1010const int GCMForcingTerms[GCMForcingNumTerms]= { SMBgcmEnum};
    11 
    1211const int ISSMOutputNumTerms = 1;
    1312const int ISSMOutputTerms[ISSMOutputNumTerms]= { SurfaceEnum };
     
    159158      /*Intermediary*/
    160159                int rc;
     160      int rank = IssmComm::GetRank();
    161161
    162162                /*Initialize femmodel from arguments provided command line: */
     
    165165                /*Initialize ESMC Mesh*/
    166166                int pdim;        /*parametric dimension is the same as the domain dimensions */
    167                 int sdim = 3;    /*coordinates of each vertex is always 3                    */
    168                 ESMC_CoordSys_Flag coordsys = ESMC_COORDSYS_CART; /*Cartesian coordinate system by default                    */
     167                int sdim = 3;    /*coordinates of each vertex is always 2  (just x,y for now) */
     168                ESMC_CoordSys_Flag coordsys = ESMC_COORDSYS_CART; /*Cartesian coordinate system by default */
    169169                femmodel->parameters->FindParam(&pdim,DomainDimensionEnum);
    170170                ESMC_Mesh mesh = ESMC_MeshCreate(pdim,sdim,&coordsys,&rc);
     
    172172
    173173                /*How to install ESMG with lib/libesmf.so
    174                  * what is a PET?
    175                  * should all of these arrays be specific to an MPI? or do all vectors need to be serialized
    176174                 * do indices need to be 1 based?
    177                  * do we need ElementMask, ElementArea or Element Coords?*/
     175                 * ESMF installation, how can we get everything in /lib
     176                 * What do we do with vertices at the boundary, declare twice?
     177                 * Do we need a restart file or save femmodel somewhere?*/
    178178
    179179                /*Add nodes (which are ISSM Vertices)*/
    180                 int numnodes = femmodel->vertices->NumberOfVertices();
    181 
    182                 IssmDouble* x=NULL;
    183                 IssmDouble* y=NULL;
    184                 IssmDouble* z=NULL;
    185                 int* nodeOwner=NULL;
    186                 VertexCoordinatesx(&x,&y,&z,&nodeOwner,femmodel->vertices);
    187 
    188                 int* nodeId = xNew<int>(numnodes);
    189                 IssmDouble* nodeCoord = xNew<IssmDouble>(sdim*numnodes);
    190                 for(int i=0;i<numnodes;i++){
    191                         nodeId[i] = i;
    192                         nodeCoord[sdim*i+0] = x[i];
    193                         nodeCoord[sdim*i+1] = y[i];
    194                         nodeCoord[sdim*i+2] = z[i];
    195                 }
    196                 xDelete<IssmDouble>(x);
    197                 xDelete<IssmDouble>(y);
    198                 xDelete<IssmDouble>(z);
    199 
     180                int numnodes = femmodel->vertices->Size();
     181                int        *nodeId    = xNew<int>(numnodes);
     182                int        *nodeOwner = xNew<int>(numnodes);
     183                IssmDouble *nodeCoord = xNew<IssmDouble>(sdim*numnodes);
     184                for (int i=0;i<femmodel->elements->Size();i++){
     185                        Vertex* vertex = xDynamicCast<Vertex*>(femmodel->vertices->GetObjectByOffset(i));
     186                        nodeId[i]           = vertex->Sid()+1;
     187         nodeOwner[i]        = rank;
     188                        nodeCoord[sdim*i+0] = vertex->x;
     189                        nodeCoord[sdim*i+1] = vertex->y;
     190                }
    200191                rc = ESMC_MeshAddNodes(mesh,numnodes,nodeId,nodeCoord,nodeOwner);
    201192                if(rc!=ESMF_SUCCESS) _error_("could not add nodes to EMSC_Mesh");
    202 
     193                xDelete<int>(nodeId);
    203194                xDelete<int>(nodeOwner);
    204                 xDelete<int>(nodeId);
    205195                xDelete<IssmDouble>(nodeCoord);
    206196
    207197                /*Add Elements (Assume triangles only for now)*/
    208                 int numelements = femmodel->elements->NumberOfElements();
     198                int numelements = femmodel->elements->Size();
    209199                int* elemId   = xNew<int>(numelements);
    210200                int* elemType = xNew<int>(numelements);
    211201                int* elemConn = xNew<int>(numelements*3); /*Assuming triangles*/
    212                 for(int i=0;i<numelements;i++){
    213                         _error_("STOP");
    214                         elemId[i] = i;
     202                for(int i=0;i<femmodel->elements->Size();i++){
     203                        Element* element=xDynamicCast<Element*>(femmodel->elements->GetObjectByOffset(i));
     204                        elemId[i]   = element->Sid()+1;
    215205                        elemType[i] = ESMC_MESHELEMTYPE_TRI; /*Assuming triangles*/
     206         elemConn[i*3+0] = element->vertices[0]->Lid()+1;
     207         elemConn[i*3+1] = element->vertices[1]->Lid()+1;
     208         elemConn[i*3+2] = element->vertices[2]->Lid()+1;
    216209                }
    217210                rc = ESMC_MeshAddElements(mesh,numelements,elemId,elemType,elemConn,NULL,NULL,NULL);
     
    220213                xDelete<int>(elemConn);
    221214
    222                 /*Some specific code here for the binding: */
    223                 _error_("not coded yet, will depend on what FISOC provides");
    224                 //femmodel->parameters->SetParam(SMBgcmEnum,SmbEnum); /*bypass SMB model, will be provided by GCM*/
     215                /*DO we need to create fields here? https://earthsystemmodeling.org/docs/nightly/develop/ESMC_crefdoc/node5.html#SECTION05024400000000000000*/
     216                //ESMC_InterArrayInt *gridToFieldMap,       // in
     217                //ESMC_InterArrayInt *ungriddedLBound,      // in
     218                //ESMC_InterArrayInt *ungriddedUBound,      // in
     219                //ESMC_Field esmf_shelfbase = ESMC_FieldCreateMeshTypeKind(mesh,ESMC_TYPEKIND_R8,???,gridToFieldMap,ungriddedLBound,ungriddedUBound,"ShelfTopography",&rc);
     220                if(rc!=ESMF_SUCCESS) _error_("could not create EMSC_Field");
    225221
    226222                /*Create restart file for later */
  • TabularUnified issm/trunk-jpl/src/c/modules/VertexCoordinatesx/VertexCoordinatesx.cpp

    r25813 r25827  
    99#include "../../toolkits/toolkits.h"
    1010
    11 void VertexCoordinatesx( IssmDouble** px, IssmDouble** py, IssmDouble** pz,int** prank, Vertices* vertices,bool spherical) {
     11void VertexCoordinatesx( IssmDouble** px, IssmDouble** py, IssmDouble** pz,Vertices* vertices,bool spherical) {
    1212
    1313        /*figure out how many vertices we have: */
     
    1717        Vector<IssmDouble>* vy=new Vector<IssmDouble>(numberofvertices);
    1818        Vector<IssmDouble>* vz=new Vector<IssmDouble>(numberofvertices);
    19         Vector<IssmDouble>* vrank=NULL;
    20         if(prank) vrank = new Vector<IssmDouble>(numberofvertices);
    2119
    2220        /*march through our vertices: */
    2321        for(Object* & object : vertices->objects){
    2422                Vertex* vertex=(Vertex*)object;
    25                 vertex->VertexCoordinates(vx,vy,vz,vrank,spherical);
     23                vertex->VertexCoordinates(vx,vy,vz,spherical);
    2624        }
    2725
     
    3028        vy->Assemble();
    3129        vz->Assemble();
    32         if(prank) vrank->Assemble();
    3330
    3431        /*serialize: */
     
    3633        IssmDouble* y=vy->ToMPISerial();
    3734        IssmDouble* z=vz->ToMPISerial();
    38         int* rank = NULL;
    39         if(prank){
    40                 /*Need to convert from IssmDouble to int*/
    41                 IssmDouble* drank = vrank->ToMPISerial();
    42                 rank = xNew<int>(numberofvertices);
    43                 for(int i=0;i<numberofvertices;i++) rank[i] = reCast<int>(drank[i]);
    44                 xDelete<IssmDouble>(drank);
    45                 delete vrank;
    46         }
    4735
    4836        /*Free ressources: */
     
    5846        if(pz) *pz=z;
    5947        else xDelete<IssmDouble>(z);
    60         if(prank) *prank=rank;
    6148}
  • TabularUnified issm/trunk-jpl/src/c/modules/VertexCoordinatesx/VertexCoordinatesx.h

    r25812 r25827  
    88
    99/* local prototypes: */
    10 void VertexCoordinatesx( IssmDouble** px, IssmDouble** py, IssmDouble** pz,int** prank,Vertices* vertices,bool spherical=false);
     10void VertexCoordinatesx( IssmDouble** px, IssmDouble** py, IssmDouble** pz,Vertices* vertices,bool spherical=false);
    1111
    1212#endif  /* _VERTEX_COORDINATESX_H */
Note: See TracChangeset for help on using the changeset viewer.