1
1
/* !
2
2
* @file ModelMetadata_test.cpp
3
3
*
4
- * @date 17 Jan 2025
4
+ * @date 20 Jan 2025
5
5
* @author Tom Meltzer <tdm39@cam.ac.uk>
6
6
*/
7
7
@@ -102,13 +102,13 @@ void setDGVecValue(
102
102
for (size_t j = 0 ; j < smesh.ny ; ++j) {
103
103
for (size_t i = 0 ; i < smesh.nx ; ++i) {
104
104
size_t pos = indexer (meshDims, std::vector<size_t >({ i, j }));
105
- dgvec (pos, k) = - 1 . ;
105
+ dgvec (pos, k) = value ;
106
106
}
107
107
}
108
108
}
109
109
}
110
110
111
- void updateDGVec (DGVector<DG>& dgvec, std::vector<int >& recv, ParametricMesh& smesh,
111
+ void updateDGVec (DGVector<DG>& dgvec, std::vector<double >& recv, ParametricMesh& smesh,
112
112
std::array<size_t , 4 >& edgeLengths, ModelMetadata::Edge edge)
113
113
{
114
114
SliceIter::MultiDim meshDims = { smesh.nx , smesh.ny };
@@ -225,8 +225,8 @@ MPI_TEST_CASE("test halo exchange on 3 proc grid", 3)
225
225
// create a send buffer the size of the perimeter of the domain
226
226
// each process will populate the send buffer with their perimeter cells
227
227
const size_t perimeterLength = 2 * localNx + 2 * localNy;
228
- std::vector<int > send = std::vector<int >(perimeterLength, 0 );
229
- std::vector<int > recv = std::vector<int >(perimeterLength, 0 );
228
+ std::vector<double > send = std::vector<double >(perimeterLength, 0. 0 );
229
+ std::vector<double > recv = std::vector<double >(perimeterLength, 0. 0 );
230
230
231
231
for (auto edge : edges) {
232
232
size_t offset = std::accumulate (edgeLengths.begin (), edgeLengths.begin () + edge, 0 );
@@ -236,7 +236,7 @@ MPI_TEST_CASE("test halo exchange on 3 proc grid", 3)
236
236
// create a RMA memory window which all process will be able to access
237
237
MPI_Win win;
238
238
MPI_Win_create (
239
- &send[0 ], perimeterLength * sizeof (int ), sizeof (int ), MPI_INFO_NULL, test_comm, &win);
239
+ &send[0 ], perimeterLength * sizeof (double ), sizeof (double ), MPI_INFO_NULL, test_comm, &win);
240
240
241
241
MPI_Win_fence (MPI_MODE_NOPRECEDE, win); // Fence, no preceding RMA calls
242
242
@@ -254,7 +254,8 @@ MPI_TEST_CASE("test halo exchange on 3 proc grid", 3)
254
254
size_t count = metadata.neighbourExtents [edge][i];
255
255
size_t disp = metadata.neighbourHaloSend [edge][i];
256
256
size_t recvOffset = metadata.neighbourHaloRecv [edge][i];
257
- MPI_Get (&recv[recvOffset], count, MPI_INT, fromRank, disp, count, MPI_INT, win);
257
+ MPI_Get (
258
+ &recv[recvOffset], count, MPI_DOUBLE, fromRank, disp, count, MPI_DOUBLE, win);
258
259
}
259
260
}
260
261
}
@@ -355,8 +356,8 @@ MPI_TEST_CASE("test halo exchange on 3 proc grid with periodic boundary conditio
355
356
// create a send buffer the size of the perimeter of the domain
356
357
// each process will populate the send buffer with their perimeter cells
357
358
const size_t perimeterLength = 2 * localNx + 2 * localNy;
358
- std::vector<int > send = std::vector<int >(perimeterLength, 0 );
359
- std::vector<int > recv = std::vector<int >(perimeterLength, 0 );
359
+ std::vector<double > send = std::vector<double >(perimeterLength, 0. 0 );
360
+ std::vector<double > recv = std::vector<double >(perimeterLength, 0. 0 );
360
361
361
362
for (auto edge : edges) {
362
363
size_t offset = std::accumulate (edgeLengths.begin (), edgeLengths.begin () + edge, 0 );
@@ -366,7 +367,7 @@ MPI_TEST_CASE("test halo exchange on 3 proc grid with periodic boundary conditio
366
367
// create a RMA memory window which all process will be able to access
367
368
MPI_Win win;
368
369
MPI_Win_create (
369
- &send[0 ], perimeterLength * sizeof (int ), sizeof (int ), MPI_INFO_NULL, test_comm, &win);
370
+ &send[0 ], perimeterLength * sizeof (double ), sizeof (double ), MPI_INFO_NULL, test_comm, &win);
370
371
371
372
MPI_Win_fence (MPI_MODE_NOPRECEDE, win); // Fence, no preceding RMA calls
372
373
@@ -384,7 +385,8 @@ MPI_TEST_CASE("test halo exchange on 3 proc grid with periodic boundary conditio
384
385
size_t count = metadata.neighbourExtents [edge][i];
385
386
size_t disp = metadata.neighbourHaloSend [edge][i];
386
387
size_t recvOffset = metadata.neighbourHaloRecv [edge][i];
387
- MPI_Get (&recv[recvOffset], count, MPI_INT, fromRank, disp, count, MPI_INT, win);
388
+ MPI_Get (
389
+ &recv[recvOffset], count, MPI_DOUBLE, fromRank, disp, count, MPI_DOUBLE, win);
388
390
}
389
391
}
390
392
}
@@ -399,7 +401,8 @@ MPI_TEST_CASE("test halo exchange on 3 proc grid with periodic boundary conditio
399
401
size_t count = metadata.neighbourExtentsPeriodic [edge][i];
400
402
size_t disp = metadata.neighbourHaloSendPeriodic [edge][i];
401
403
size_t recvOffset = metadata.neighbourHaloRecvPeriodic [edge][i];
402
- MPI_Get (&recv[recvOffset], count, MPI_INT, fromRank, disp, count, MPI_INT, win);
404
+ MPI_Get (
405
+ &recv[recvOffset], count, MPI_DOUBLE, fromRank, disp, count, MPI_DOUBLE, win);
403
406
}
404
407
}
405
408
}
0 commit comments