Skip to content
Snippets Groups Projects
Commit 51fc0f1f authored by Boris Martin's avatar Boris Martin
Browse files

moved type declaration

parent 46e29d11
No related branches found
No related tags found
No related merge requests found
Pipeline #12710 failed
...@@ -413,6 +413,16 @@ namespace gmshfem::field ...@@ -413,6 +413,16 @@ namespace gmshfem::field
unsigned long long global; unsigned long long global;
}; };
MPI_Datatype types[3] = {MPI_UNSIGNED_LONG, MPI_UNSIGNED_LONG, MPI_UNSIGNED_LONG};
MPI_Datatype mpi_struct_type;
MPI_Aint offsets[3];
int blocklengths[3] = {1, 1, 1};
offsets[0] = offsetof(LocalGlobalPair, type);
offsets[1] = offsetof(LocalGlobalPair, entity);
offsets[2] = offsetof(LocalGlobalPair, global);
MPI_Type_create_struct(3, blocklengths, offsets, types, &mpi_struct_type);
MPI_Type_commit(&mpi_struct_type);
std::vector< LocalGlobalPair > myOwnedDofs, allSharedDofsArray; std::vector< LocalGlobalPair > myOwnedDofs, allSharedDofsArray;
for(auto dof : this->_toSend) { for(auto dof : this->_toSend) {
...@@ -431,15 +441,7 @@ namespace gmshfem::field ...@@ -431,15 +441,7 @@ namespace gmshfem::field
} }
MPI_Datatype types[3] = {MPI_UNSIGNED_LONG, MPI_UNSIGNED_LONG, MPI_UNSIGNED_LONG};
MPI_Datatype mpi_struct_type;
MPI_Aint offsets[3];
int blocklengths[3] = {1, 1, 1};
offsets[0] = offsetof(LocalGlobalPair, type);
offsets[1] = offsetof(LocalGlobalPair, entity);
offsets[2] = offsetof(LocalGlobalPair, global);
MPI_Type_create_struct(3, blocklengths, offsets, types, &mpi_struct_type);
MPI_Type_commit(&mpi_struct_type);
// Synchronize the full array // Synchronize the full array
allSharedDofsArray.resize(total_size); allSharedDofsArray.resize(total_size);
...@@ -451,8 +453,7 @@ namespace gmshfem::field ...@@ -451,8 +453,7 @@ namespace gmshfem::field
msg::info << "Gathered allSharedDofsArray. Total size is " << allSharedDofsArray.size() << msg::endl; msg::info << "Gathered allSharedDofsArray. Total size is " << allSharedDofsArray.size() << msg::endl;
} }
MPI_Barrier(MPI_COMM_WORLD); MPI_Barrier(MPI_COMM_WORLD);
// Free the type
MPI_Type_free(&mpi_struct_type);
std::unordered_map< DofIndex, unsigned long long, HashBySecond, std::equal_to<DofIndex> > allSharedDofs; std::unordered_map< DofIndex, unsigned long long, HashBySecond, std::equal_to<DofIndex> > allSharedDofs;
// Put in hashtable // Put in hashtable
...@@ -488,6 +489,8 @@ namespace gmshfem::field ...@@ -488,6 +489,8 @@ namespace gmshfem::field
msg::debug << msg::endl msg::debug << msg::endl
<< "Leaving syncGlobalDofs" << msg::endl; << "Leaving syncGlobalDofs" << msg::endl;
MPI_Barrier(MPI_COMM_WORLD); MPI_Barrier(MPI_COMM_WORLD);
// Free the type
MPI_Type_free(&mpi_struct_type);
#else #else
throw common::Exception("MPI is not available"); throw common::Exception("MPI is not available");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment