@@ -328,7 +328,7 @@ void checkTemperatureResults(Inputs &inputs, Grid &grid, Temperature<MemorySpace
328
328
const bool x_coord_mirrored = ((mirror_x) && (coord_y % 2 == 1 ));
329
329
double loc_along_scan;
330
330
if (x_coord_mirrored)
331
- loc_along_scan = static_cast <double >(grid.nx - coord_x);
331
+ loc_along_scan = static_cast <double >(( grid.nx - 1 ) - coord_x);
332
332
else
333
333
loc_along_scan = static_cast <double >(coord_x);
334
334
const double expected_tm = loc_along_scan + static_cast <double >(coord_y) * inputs.temperature .temporal_offset ;
@@ -358,35 +358,27 @@ void checkTemperatureResults(Inputs &inputs, Grid &grid, Temperature<MemorySpace
358
358
}
359
359
}
360
360
361
- // Test storing temperature data from Finch on the correct ExaCA ranks, optionally mirroring and translating the data
362
- void testInitTemperatureFromFinch (const bool mirror_x, const int number_of_copies) {
363
-
364
- using memory_space = TEST_MEMSPACE;
365
- using view_type_coupled = Kokkos::View<double **, Kokkos::LayoutLeft, Kokkos::HostSpace>;
366
-
367
- int id, np;
368
- // Get number of processes
369
- MPI_Comm_size (MPI_COMM_WORLD, &np);
370
- // Get individual process ID
371
- MPI_Comm_rank (MPI_COMM_WORLD, &id);
372
-
373
- // Default inputs struct - manually set temperature values for test
374
- Inputs inputs;
361
+ // Initialize test input values for InitTemperatureFromFinch and InitTemperatureFromFile
362
+ void initTestInputs (const bool mirror_x, const int number_of_copies, Inputs &inputs) {
375
363
inputs.temperature .x_offset = 0.0 ;
376
364
inputs.temperature .y_offset = 1.0 * pow (10 , -6 );
377
365
inputs.temperature .mirror_x = mirror_x;
378
366
inputs.temperature .mirror_y = false ;
379
367
inputs.temperature .temporal_offset = 100.0 ;
380
368
inputs.temperature .number_of_copies = number_of_copies;
369
+ }
381
370
382
- // Default grid struct - manually set up domain for test
383
- Grid grid;
371
+ // Initialize test grid for InitTemperatureFromFinch and InitTemperatureFromFile
372
+ void initTestGrid ( const int id, const int np, Grid & grid) {
384
373
grid.deltax = 1.0 * pow (10 , -6 );
385
374
grid.x_min = -2.0 * pow (10 , -6 );
386
375
grid.nx = 2 ;
376
+ grid.x_max = grid.x_min + grid.deltax * (grid.nx - 1 );
387
377
grid.y_min = 0.0 ;
388
378
grid.ny_local = 3 ;
379
+ grid.ny = grid.ny_local * np;
389
380
grid.y_offset = id * grid.ny_local ;
381
+ grid.y_max = grid.y_min + grid.deltax * (grid.ny - 1 );
390
382
grid.z_min = 0.0 ;
391
383
grid.z_min_layer [0 ] = grid.z_min ;
392
384
grid.nz = np;
@@ -395,6 +387,26 @@ void testInitTemperatureFromFinch(const bool mirror_x, const int number_of_copie
395
387
grid.number_of_layers = 1 ;
396
388
grid.layer_height = 0 ;
397
389
grid.layer_range = std::make_pair (0 , grid.domain_size );
390
+ }
391
+
392
+ // Test storing temperature data from Finch on the correct ExaCA ranks, optionally mirroring and translating the data
393
+ void testInitTemperatureFromFinch (const bool mirror_x, const int number_of_copies) {
394
+
395
+ using memory_space = TEST_MEMSPACE;
396
+ using view_type_coupled = Kokkos::View<double **, Kokkos::LayoutLeft, Kokkos::HostSpace>;
397
+
398
+ int id, np;
399
+ // Get number of processes
400
+ MPI_Comm_size (MPI_COMM_WORLD, &np);
401
+ // Get individual process ID
402
+ MPI_Comm_rank (MPI_COMM_WORLD, &id);
403
+
404
+ // Default inputs struct - manually set temperature values for test
405
+ Inputs inputs;
406
+ // Default grid struct - manually set up domain for test
407
+ Grid grid;
408
+ initTestInputs (mirror_x, number_of_copies, inputs);
409
+ initTestGrid (id, np, grid);
398
410
399
411
// Create dummy Finch temperature data stored on various ranks, to be mapped to ExaCA ranks
400
412
view_type_coupled input_temperature_data (Kokkos::ViewAllocateWithoutInitializing (" FinchData" ), grid.nx * np, 6 );
@@ -435,29 +447,10 @@ void testInitTemperatureFromFile(const bool mirror_x, const int number_of_copies
435
447
436
448
// Default inputs struct - manually set temperature values for test
437
449
Inputs inputs;
438
- inputs.temperature .x_offset = 0.0 ;
439
- inputs.temperature .y_offset = 1.0 * pow (10 , -6 );
440
- inputs.temperature .mirror_x = mirror_x;
441
- inputs.temperature .mirror_y = false ;
442
- inputs.temperature .temporal_offset = 100.0 ;
443
- inputs.temperature .number_of_copies = number_of_copies;
444
-
445
450
// Default grid struct - manually set up domain for test
446
451
Grid grid;
447
- grid.deltax = 1.0 * pow (10 , -6 );
448
- grid.x_min = -2.0 * pow (10 , -6 );
449
- grid.nx = 2 ;
450
- grid.y_min = 0.0 ;
451
- grid.ny_local = 3 ;
452
- grid.y_offset = id * grid.ny_local ;
453
- grid.z_min = 0.0 ;
454
- grid.z_min_layer [0 ] = grid.z_min ;
455
- grid.nz = np;
456
- grid.domain_size = grid.nx * grid.ny_local * grid.nz ;
457
- grid.domain_size_all_layers = grid.domain_size ;
458
- grid.number_of_layers = 1 ;
459
- grid.layer_height = 0 ;
460
- grid.layer_range = std::make_pair (0 , grid.domain_size );
452
+ initTestInputs (mirror_x, number_of_copies, inputs);
453
+ initTestGrid (id, np, grid);
461
454
462
455
// Create dummy file temperature data on rank 0, including data to be mapped to other ExaCA ranks
463
456
if (id == 0 ) {
0 commit comments