00001 /*Charm++ Network FEM: C interface file 00002 */ 00003 #ifndef __CHARM_NETFEM_H 00004 #define __CHARM_NETFEM_H 00005 00006 #ifdef __cplusplus 00007 extern "C" { 00008 #endif 00009 00010 /*Opaque type to represent one discrete data update*/ 00011 typedef void *NetFEM; 00012 00013 /*We can either point to your arrays (very cheap, but you must leave 00014 data allocated), write out the passed data (expensive, but permanent), 00015 or keep the last K copies of the data in memory (balance). 00016 00017 You can also switch at each step-- one reasonable strategy might be: 00018 POINTAT every timestep, COPY_5 every hundred timesteps, and WRITE 00019 every 500 timesteps. Then the latest responses are always available, 00020 copies of recent data are online, and the complete history is also 00021 available. 00022 */ 00023 #define NetFEM_POINTAT 1 /*Just keep the given pointer in case asked*/ 00024 #define NetFEM_WRITE 2 /*Write out the data to disk.*/ 00025 #define NetFEM_COPY 10 /*Keep the last i versions in memory*/ 00026 #define NetFEM_COPY_1 (NetFEM_COPY+1) /*Keep only the last version*/ 00027 #define NetFEM_COPY_2 (NetFEM_COPY+2) /*Keep the last 2 versions*/ 00028 #define NetFEM_COPY_5 (NetFEM_COPY+5) /*Keep the last 5 versions*/ 00029 #define NetFEM_COPY_10 (NetFEM_COPY+10) /*Keep the last 10 versions*/ 00030 00031 /* Extract an initial offset and distance from this struct/field pair: */ 00032 #define NetFEM_Field(myStruct,myValue) offsetof(myStruct,myValue),sizeof(myStruct) 00033 00034 /*---------------------------------------------- 00035 All NetFEM calls must be between a Begin and End pair:*/ 00036 NetFEM NetFEM_Begin( 00037 int source,/*Integer ID for the source of this data (need not be sequential)*/ 00038 int timestep,/*Integer ID for this instant (need not be sequential)*/ 00039 int dim,/*Number of spatial dimensions (2 or 3)*/ 00040 int flavor /*What to do with data (point at, write, or copy)*/ 00041 ); 00042 void NetFEM_End(NetFEM n); /*Publish these updates*/ 00043 00044 /*---- Register the locations of the nodes. (Exactly once, required) 00045 In 2D, node i has location (loc[2*i+0],loc[2*i+1]) 00046 In 3D, node i has location (loc[3*i+0],loc[3*i+1],loc[3*i+2]) 00047 */ 00048 void NetFEM_Nodes(NetFEM n,int nNodes,const double *loc,const char *name); 00049 void NetFEM_Nodes_field(NetFEM n,int nNodes, 00050 int init_offset,int bytesPerNode,const void *loc,const char *name); 00051 00052 /*----- Register the connectivity of the elements. 00053 Element i is adjacent to nodes conn[nodePerEl*i+{0,1,...,nodePerEl-1}] 00054 */ 00055 void NetFEM_Elements(NetFEM n,int nEl,int nodePerEl,const int *conn,const char *name); 00056 void NetFEM_Elements_field(NetFEM n,int nEl,int nodePerEl, 00057 int init_offset,int bytesPerEl,int indexBase, 00058 const void *conn,const char *name); 00059 00060 /*-------------------------------------------------- 00061 Associate a spatial vector (e.g., displacement, velocity, accelleration) 00062 with each of the previous objects (nodes or elements). 00063 */ 00064 void NetFEM_Vector_field(NetFEM n,const void *start, 00065 int init_offset,int distance, 00066 const char *name); 00067 00068 /*Simpler version of the above if your data is packed as 00069 data[item*3+{0,1,2}]. 00070 */ 00071 void NetFEM_Vector(NetFEM n,const double *data,const char *name); 00072 00073 /*-------------------------------------------------- 00074 Associate a scalar (e.g., stress, temperature, pressure, damage) 00075 with each of the previous objects (nodes or elements). 00076 */ 00077 void NetFEM_Scalar_field(NetFEM n,const void *start, 00078 int vec_len,int init_offset,int distance, 00079 const char *name); 00080 00081 /*Simpler version of above for contiguous double-precision data*/ 00082 void NetFEM_Scalar(NetFEM n,const double *start,int doublePer, 00083 const char *name); 00084 00085 #ifdef __cplusplus 00086 } 00087 #endif 00088 00089 #endif