00001
00002
00003
00004 #ifndef _CHARM_FEM_H
00005 #define _CHARM_FEM_H
00006 #include "pup_c.h"
00007 #include "idxlc.h"
00008
00009 #ifdef __cplusplus
00010 extern "C" {
00011 #endif
00012
00013
00014 #define FEM_BYTE IDXL_BYTE
00015 #define FEM_INT IDXL_INT
00016 #define FEM_REAL IDXL_REAL
00017 #define FEM_FLOAT FEM_REAL
00018 #define FEM_DOUBLE IDXL_DOUBLE
00019 #define FEM_INDEX_0 IDXL_INDEX_0
00020 #define FEM_INDEX_1 IDXL_INDEX_1
00021 #define FEM_VAR_INDEX (IDXL_FIRST_DATATYPE+6)
00022
00023
00024 #define FEM_SUM IDXL_SUM
00025 #define FEM_PROD IDXL_PROD
00026 #define FEM_MAX IDXL_MAX
00027 #define FEM_MIN IDXL_MIN
00028
00029
00030 #define FEM_TRIANGULAR 3
00031 #define FEM_TETRAHEDRAL 4
00032 #define FEM_HEXAHEDRAL 8
00033 #define FEM_QUADRILATERAL 4
00034
00035
00036 #define FEM_INIT_READ 2
00037 #define FEM_INIT_WRITE 4
00038
00039 #define FEM_MESH_OUTPUT 0
00040 #define FEM_MESH_UPDATE 1
00041 #define FEM_MESH_FINALIZE 2
00042 typedef void (*FEM_Update_mesh_fn)(int userTag);
00043 typedef void (*FEM_Update_mesh_fortran_fn)(int *userTag);
00044
00045 typedef void (*FEM_PupFn)(pup_er, void*);
00046
00047 typedef void (*FEM_Mesh_alloc_fn)(void *param,int *size,int *maxSize);
00048
00049
00050 typedef int FEM_Comm_t;
00051
00052
00053 void FEM_Init(FEM_Comm_t defaultCommunicator);
00054 void FEM_Done(void);
00055
00056
00057 int FEM_My_partition(void);
00058 int FEM_Num_partitions(void);
00059 double FEM_Timer(void);
00060 void FEM_Print(const char *str);
00061 void FEM_Print_partition(void);
00062
00063
00064 #define FEM_MESH_FIRST 1650000000
00065
00066 int FEM_Mesh_allocate(void);
00067 int FEM_Mesh_copy(int fem_mesh);
00068 void FEM_Mesh_deallocate(int fem_mesh);
00069
00070 int FEM_Mesh_read(const char *prefix,int partNo,int nParts);
00071 void FEM_Mesh_write(int fem_mesh,const char *prefix,int partNo,int nParts);
00072
00073 int FEM_Mesh_assemble(int nParts,const int *srcMeshes);
00074 void FEM_Mesh_partition(int fem_mesh,int nParts,int *destMeshes);
00075
00076 int FEM_Mesh_recv(int fromRank,int tag,FEM_Comm_t comm_context);
00077 void FEM_Mesh_send(int fem_mesh,int toRank,int tag,FEM_Comm_t comm_context);
00078
00079 int FEM_Mesh_reduce(int fem_mesh,int toRank,FEM_Comm_t comm_context);
00080 int FEM_Mesh_broadcast(int fem_mesh,int fromRank,FEM_Comm_t comm_context);
00081
00082 void FEM_Mesh_copy_globalno(int src_mesh,int dest_mesh);
00083 void FEM_Mesh_print(int fem_mesh);
00084
00085
00086 #define FEM_ENTITY_FIRST 1610000000
00087 #define FEM_NODE (FEM_ENTITY_FIRST+0)
00088 #define FEM_ELEM (FEM_ENTITY_FIRST+1000)
00089 #define FEM_ELEMENT FEM_ELEM
00090 #define FEM_SPARSE (FEM_ENTITY_FIRST+2000)
00091 #define FEM_EDGE FEM_SPARSE
00092 #define FEM_FACE FEM_SPARSE
00093 #define FEM_GHOST 10000
00094 #define FEM_ENTITY_LAST (FEM_ENTITY_FIRST+3000+FEM_GHOST)
00095
00096
00097 #define FEM_DATA 0
00098 #define FEM_ATTRIB_TAG_MAX 1000000000
00099 #define FEM_ATTRIB_FIRST 1620000000
00100 #define FEM_CONN (FEM_ATTRIB_FIRST+1)
00101 #define FEM_CONNECTIVITY FEM_CONN
00102
00103
00104 #define FEM_SPARSE_ELEM (FEM_ATTRIB_FIRST+2)
00105 #define FEM_COOR (FEM_ATTRIB_FIRST+3)
00106 #define FEM_COORD FEM_COOR
00107 #define FEM_COORDINATES FEM_COOR
00108 #define FEM_GLOBALNO (FEM_ATTRIB_FIRST+4)
00109 #define FEM_PARTITION (FEM_ATTRIB_FIRST+5)
00110 #define FEM_SYMMETRIES (FEM_ATTRIB_FIRST+6)
00111 #define FEM_NODE_PRIMARY (FEM_ATTRIB_FIRST+7)
00112 #define FEM_CHUNK (FEM_ATTRIB_FIRST+8)
00113
00114 #define FEM_BOUNDARY (FEM_ATTRIB_FIRST+9)
00115 #define FEM_NODE_ELEM_ADJACENCY (FEM_ATTRIB_FIRST+10)
00116 #define FEM_NODE_NODE_ADJACENCY (FEM_ATTRIB_FIRST+11)
00117 #define FEM_ELEM_ELEM_ADJACENCY (FEM_ATTRIB_FIRST+12)
00118 #define FEM_ELEM_ELEM_ADJ_TYPES (FEM_ATTRIB_FIRST+13)
00119
00120
00121 #define FEM_IS_VALID_ATTR (FEM_ATTRIB_FIRST+14)
00122
00123
00124
00125 #define FEM_MESH_SIZING (FEM_ATTRIB_FIRST+15)
00126 #define FEM_ATTRIB_LAST (FEM_ATTRIB_FIRST+16)
00127
00128
00129 void FEM_Mesh_set_conn(int fem_mesh,int entity,
00130 const int *conn, int firstItem, int length, int width);
00131 void FEM_Mesh_get_conn(int fem_mesh,int entity,
00132 int *conn, int firstItem, int length, int width);
00133
00134 void FEM_Mesh_set_data(int fem_mesh,int entity,int attr,
00135 const void *data, int firstItem, int length, int datatype,int width);
00136 void FEM_Mesh_get_data(int fem_mesh,int entity,int attr,
00137 void *data, int firstItem, int length, int datatype,int width);
00138 void FEM_Mesh_conn(int fem_mesh,int entity,
00139 int *conn, int firstItem, int length, int width);
00140
00141 int FEM_Mesh_get_length(int fem_mesh,int entity);
00142
00143
00144 void FEM_Mesh_data(int fem_mesh,int entity,int attr,
00145 void *data, int firstItem, int length, int datatype,int width);
00146 void FEM_Mesh_data_layout(int fem_mesh,int entity,int attr,
00147 void *data, int firstItem, int length, IDXL_Layout_t layout);
00148 void FEM_Mesh_data_offset(int fem_mesh,int entity,int attr,
00149 void *data, int firstItem, int length,
00150 int type,int width, int offsetBytes,int distanceBytes,int skewBytes);
00151
00152 void FEM_Register_array(int fem_mesh,int entity,int attr,
00153 void *data, int datatype,int width);
00154
00155 void FEM_Register_array_layout(int fem_mesh,int entity,int attr,
00156 void *data, IDXL_Layout_t layout);
00157
00158
00159 void FEM_Register_entity(int fem_mesh,int entity,void *data,int len,int max,FEM_Mesh_alloc_fn fn);
00160
00161 void FEM_Mesh_set_length(int fem_mesh,int entity,int newLength);
00162 int FEM_Mesh_get_width(int fem_mesh,int entity,int attr);
00163 void FEM_Mesh_set_width(int fem_mesh,int entity,int attr,int newWidth);
00164 int FEM_Mesh_get_datatype(int fem_mesh,int entity,int attr);
00165 int FEM_Mesh_get_entities(int fem_mesh, int *entities);
00166 int FEM_Mesh_get_attributes(int fem_mesh,int entity,int *attributes);
00167
00168 const char *FEM_Get_entity_name(int entity,char *storage);
00169 const char *FEM_Get_attr_name(int attr,char *storage);
00170 const char *FEM_Get_datatype_name(int datatype,char *storage);
00171
00172 int FEM_Mesh_is_get(int fem_mesh);
00173 int FEM_Mesh_is_set(int fem_mesh);
00174 void FEM_Mesh_become_get(int fem_mesh);
00175 void FEM_Mesh_become_set(int fem_mesh);
00176
00177 typedef void (*FEM_Userdata_fn)(pup_er p,void *data);
00178 void FEM_Mesh_pup(int fem_mesh,int dataTag,FEM_Userdata_fn fn,void *data);
00179
00180
00181 #define FEM_Is_ghost_index(idx) ((idx)<-1)
00182 #define FEM_To_ghost_index(idx) (-(idx)-2)
00183 #define FEM_From_ghost_index(idx) (-(idx)-2)
00184
00185 void FEM_Add_ghost_layer(int nodesPerTuple,int doAddNodes);
00186 void FEM_Add_ghost_elem(int elType,int tuplesPerElem,const int *elem2tuple);
00187
00188 void FEM_Add_ghost_stencil(int nElts,int addNodes,
00189 const int *ends,const int *adj);
00190 void FEM_Add_ghost_stencil_type(int elType,int nElts,int addNodes,
00191 const int *ends,const int *adj2);
00192
00193 void FEM_Add_elem2face_tuples(int fem_mesh, int elem_type, int nodesPerTuple, int tuplesPerElem,const int *elem2tuple);
00194
00195 void FEM_Add_linear_periodicity(int nFaces,int nPer,
00196 const int *facesA,const int *facesB,
00197 int nNodes,const double *nodeLocs);
00198 void FEM_Sym_coordinates(int who,double *d_locs);
00199
00200 void FEM_Set_sym_nodes(const int *canon,const int *sym);
00201 void FEM_Get_sym(int who,int *destSym);
00206 void FEM_Make_node_globalno(int fem_mesh,FEM_Comm_t comm_context);
00207
00208
00209 IDXL_Layout_t FEM_Create_simple_field(int base_type,int vec_len);
00210 IDXL_Layout_t FEM_Create_field(int base_type, int vec_len, int init_offset,
00211 int distance);
00212
00213 IDXL_t FEM_Comm_shared(int fem_mesh,int entity);
00214 IDXL_t FEM_Comm_ghost(int fem_mesh,int entity);
00215
00216 void FEM_Get_roccom_pconn_size(int fem_mesh,int *total_len,int *ghost_len);
00217 void FEM_Get_roccom_pconn(int fem_mesh,const int *paneFmChunk,int *pconn);
00218 void FEM_Set_roccom_pconn(int fem_mesh,const int *paneFmChunk,const int *src,int total_len,int ghost_len);
00219
00220
00221 int FEM_Register(void *userData,FEM_PupFn _pup_ud);
00222 void FEM_Migrate(void);
00223 void *FEM_Get_userdata(int n);
00224
00225 void FEM_Barrier(void);
00226
00227
00228 void init(void);
00229 void driver(void);
00230
00231
00232 void FEM_Mesh_create_node_elem_adjacency(int fem_mesh);
00233 void FEM_Mesh_create_node_node_adjacency(int fem_mesh);
00234 void FEM_Mesh_create_elem_elem_adjacency(int fem_mesh);
00235
00236 void FEM_Print_n2n(int mesh, int nodeid);
00237 void FEM_Print_n2e(int mesh, int nodeid);
00238 void FEM_Print_e2e(int mesh, int eid);
00239 void FEM_Print_e2n(int mesh, int eid);
00240
00241
00242 void FEM_Mesh_allocate_valid_attr(int fem_mesh, int entity_type);
00243 void FEM_set_entity_valid(int mesh, int entityType, int entityIdx);
00244 void FEM_set_entity_invalid(int mesh, int entityType, int entityIdx);
00245 int FEM_is_valid(int mesh, int entityType, int entityIdx);
00246 unsigned int FEM_count_valid(int mesh, int entityType);
00247
00248
00249 void FEM_set_entity_coord2(int mesh, int entityType, int entityIdx, double x, double y);
00250 void FEM_set_entity_coord3(int mesh, int entityType, int entityIdx, double x, double y, double z);
00251
00252
00253
00254 int FEM_Mesh_default_read(void);
00255 int FEM_Mesh_default_write(void);
00256 void FEM_Mesh_set_default_read(int fem_mesh);
00257 void FEM_Mesh_set_default_write(int fem_mesh);
00258
00259 void FEM_Exchange_ghost_lists(int who,int nIdx,const int *localIdx);
00260 int FEM_Get_ghost_list_length(void);
00261 void FEM_Get_ghost_list(int *dest);
00262
00263 void FEM_Update_field(int fid, void *nodes);
00264 void FEM_Update_ghost_field(int fid, int elTypeOrMinusOne, void *nodes);
00265 void FEM_Reduce_field(int fid, const void *nodes, void *outbuf, int op);
00266 void FEM_Reduce(int fid, const void *inbuf, void *outbuf, int op);
00267
00268 void FEM_Read_field(int fid, void *nodes, const char *fname);
00269
00270 void FEM_Set_node(int nNodes,int doublePerNode);
00271 void FEM_Set_node_data(const double *data);
00272 void FEM_Set_elem(int elType,int nElem,int doublePerElem,int nodePerElem);
00273 void FEM_Set_elem_data(int elType,const double *data);
00274 void FEM_Set_elem_conn(int elType,const int *conn);
00275 void FEM_Set_sparse(int uniqueIdentifier,int nRecords,
00276 const int *nodes,int nodesPerRec,
00277 const void *data,int dataPerRec,int dataType);
00278 void FEM_Set_sparse_elem(int uniqueIdentifier,const int *rec2elem);
00279
00280 void FEM_Get_node(int *nNodes,int *doublePerNode);
00281 void FEM_Get_node_data(double *data);
00282 void FEM_Get_elem(int elType,int *nElem,int *doublePerElem,int *nodePerElem);
00283 void FEM_Get_elem_data(int elType,double *data);
00284 void FEM_Get_elem_conn(int elType,int *conn);
00285 int FEM_Get_sparse_length(int uniqueIdentifier);
00286 void FEM_Get_sparse(int uniqueIdentifier,int *nodes,void *data);
00287
00288 void FEM_Set_mesh(int nelem, int nnodes, int nodePerElem, int* conn);
00289
00290 int FEM_Get_node_ghost(void);
00291 int FEM_Get_elem_ghost(int elemType);
00292
00293 void FEM_Update_mesh(FEM_Update_mesh_fn callFn,int userValue,int doWhat);
00294
00295 void FEM_Set_partition(int *elem2chunk);
00296
00297
00298
00299 int FEM_add_node(int mesh, int* adjacent_nodes=0, int num_adjacent_nodes=0, int *chunks=0, int numChunks=0, int forceShared=0, int upcall=0);
00300 int FEM_add_element(int mesh, int* conn, int conn_size, int elem_type=0, int chunkNo=-1);
00301 void FEM_remove_node(int mesh,int node);
00302 int FEM_remove_element(int mesh, int element, int elem_type=0, int permanent=-1);
00303 int FEM_purge_element(int mesh, int element, int elem_type=0);
00304 int FEM_Modify_Lock(int mesh, int* affectedNodes, int numAffectedNodes, int* affectedElts=0, int numAffectedElts=0, int elemtype=0);
00305 int FEM_Modify_Unlock(int mesh);
00306 int FEM_Modify_LockN(int mesh, int nodeId, int readLock);
00307 int FEM_Modify_UnlockN(int mesh, int nodeId, int readLock);
00308 void FEM_REF_INIT(int mesh, int dim);
00309
00310
00311
00312
00313
00314 void FEM_Print_Mesh_Summary(int mesh);
00315
00316
00317 void FEM_Serial_split(int nchunks);
00318 void FEM_Serial_begin(int chunkNo);
00319
00320 void FEM_Serial_read(int chunkNo,int nChunks);
00321 void FEM_Serial_assemble(void);
00322
00323 int FEM_Get_comm_partners(void);
00324 int FEM_Get_comm_partner(int partnerNo);
00325 int FEM_Get_comm_count(int partnerNo);
00326 void FEM_Get_comm_nodes(int partnerNo,int *nodeNos);
00327
00328
00329
00330
00331
00332
00333
00334
00335
00336
00337 #ifdef __cplusplus
00338 }
00339 #endif
00340
00341 #endif
00342