20 #include "SheafSystem/assert_contract.h" 23 #include "SheafSystem/equivalence.h" 29 #include "SheafSystem/poset.h" 33 equivalence(
int xremote_index,
int xremote_proc, poset_storage* xremote_storage)
38 require(xremote_index >= 0);
39 require(xremote_proc >= 0);
41 MPI_Comm_size(MPI_COMM_WORLD,&size);
42 require(xremote_proc < size);
43 require(xremote_storage != 0);
47 _remote_index = xremote_index;
48 _remote_proc = xremote_proc;
49 _remote_storage = xremote_storage;
53 ensure(remote_index() == xremote_index);
54 ensure(remote_proc() == xremote_proc);
55 ensure(remote_storage() == xremote_storage);
79 static bool first_call =
true;
80 static hid_t result = -1;
90 result = H5Tcreate(H5T_COMPOUND,
sizeof(hdf_rep));
91 assertion(result >= 0);
92 rtncode = H5Tinsert(result,
94 HOFFSET(hdf_rep, local_index),
96 assertion(rtncode >= 0);
97 rtncode = H5Tinsert(result,
99 HOFFSET(hdf_rep, remote_index),
101 assertion(rtncode >= 0);
102 rtncode = H5Tinsert(result,
104 HOFFSET(hdf_rep, remote_proc),
106 assertion(rtncode >= 0);
126 static bool first_call =
true;
127 static MPI_Datatype result = MPI_DATATYPE_NULL;
128 int rtncode = MPI_SUCCESS;
139 MPI_Datatype types = MPI_INT;
141 rtncode = MPI_Type_struct(1,&cts,&displs,&types,&result);
142 if (rtncode == MPI_SUCCESS)
143 rtncode = MPI_Type_commit(&result);
148 ensure(rtncode == MPI_SUCCESS);
149 ensure(result != MPI_DATATYPE_NULL);
159 make_hdf_rep(hdf_rep* xhdf_rep,
int xlocal_index)
164 require(xhdf_rep != 0);
165 require(xlocal_index >= 0);
169 xhdf_rep->local_index = xlocal_index;
170 xhdf_rep->remote_index = _remote_index;
171 xhdf_rep->remote_proc = _remote_proc;
176 make_mpi_rep(mpi_rep* xmpi_rep)
181 require(xmpi_rep != 0);
185 xmpi_rep->remote_index = _remote_index;
186 xmpi_rep->remote_proc = _remote_proc;
187 assertion(MPI_Address(_remote_storage, &xmpi_rep->remote_storage) == MPI_SUCCESS);
204 return _remote_index;
215 sheaf::poset_storage *
220 return _remote_storage;
225 equivalence(hdf_rep* xrep)
234 _remote_index = xrep->remote_index;
235 _remote_proc = xrep->remote_proc;
244 put_remote_storage(poset_storage* xstorage)
249 require(xstorage != 0);
253 _remote_storage = xstorage;
257 #endif // PARALLEL_MPI