Changeset 25814


Ignore:
Timestamp:
12/02/20 21:14:05 (4 years ago)
Author:
Mathieu Morlighem
Message:

CHG: more FISOC stuff

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/main/esmfbinders.cpp

    r25813 r25814  
    171171                if(rc!=ESMF_SUCCESS) _error_("could not create EMSC_Mesh");
    172172
     173                /*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
     176                 * do indices need to be 1 based?
     177                 * do we need ElementMask, ElementArea or Element Coords?*/
     178
    173179                /*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
     200                rc = ESMC_MeshAddNodes(mesh,numnodes,nodeId,nodeCoord,nodeOwner);
     201                if(rc!=ESMF_SUCCESS) _error_("could not add nodes to EMSC_Mesh");
     202
     203                xDelete<int>(nodeOwner);
     204                xDelete<int>(nodeId);
     205                xDelete<IssmDouble>(nodeCoord);
     206
     207                /*Add Elements (Assume triangles only for now)*/
     208                int numelements = femmodel->elements->NumberOfElements();
     209                int* elemId   = xNew<int>(numelements);
     210                int* elemType = xNew<int>(numelements);
     211                int* elemConn = xNew<int>(numelements*3); /*Assuming triangles*/
     212                for(int i=0;i<numelements;i++){
     213                        _error_("STOP");
     214                        elemId[i] = i;
     215                        elemType[i] = ESMC_MESHELEMTYPE_TRI; /*Assuming triangles*/
     216                }
     217                rc = ESMC_MeshAddElements(mesh,numelements,elemId,elemType,elemConn,NULL,NULL,NULL);
     218                xDelete<int>(elemId);
     219                xDelete<int>(elemType);
     220                xDelete<int>(elemConn);
    174221
    175222                /*Some specific code here for the binding: */
Note: See TracChangeset for help on using the changeset viewer.