/** * In this test we are using connectivity to form edges among vertices. * We will then tag the vertices and edges with some data. Five vertices * are owned by rank 0, and five vertices are owned by rank 1. Then rank 0 * define 5 edges using the vertices on rank 0 and 1. Rank 0 tags five vertices * it owns and five edges, and rank 1 tags five vertices. This test case is * a baby step to build larger meshes e.g. as in GCRM where data resides on * layers, cell centers, edges, corners. * */ #include #include #include #include "damsel.h" #define FILENAME "output/test-edges-parallel.h5" int proc_ranks[5] = {1,1,1,1,1}; int main(int argc, char **argv) { int i, res, myrank, nprocs; printf("%s\n", argv[0]); #ifndef DAMSEL_SINGLETHREAD MPI_Init_thread(&argc, &argv, MPI_THREAD_MULTIPLE, &res); assert(res == MPI_THREAD_MULTIPLE); #else MPI_Init(&argc, &argv); #endif MPI_Comm_size(MPI_COMM_WORLD, &nprocs); MPI_Comm_rank(MPI_COMM_WORLD, &myrank); damsel_library lib; damsel_err_t err = DMSLlib_init(&lib); damsel_model model; err = DMSLmodel_create(DAMSEL_HANDLE_TYPE_HANDLE64, &model); unlink(FILENAME); damsel_trait_bundle tb; err = DMSLtrait_create(&tb); DMSLtrait_put(tb, "mode", "WRITE"); #ifdef DAMSEL_SUBFILE DMSLtrait_put(tb, "dmsl_num_subfiles", "2"); #endif DMSLmodel_attach(model, FILENAME, MPI_COMM_WORLD, tb); DMSLtrait_release(tb); /*Rank 0 and rank 1 will define vertices, and will tag them with some value*/ /*Define damsel handle and Vertices on each rank*/ short int data[5]; int len = 5; damsel_handle vertex_id [len]; damsel_handle remote_vertex_id[len], local_vertex_id[len]; /*generating handles and some data values*/ for(i=0; i