packages/Utils/utils/test/tstParallel_HDF5_Writer.cc
//---------------------------------------------------------------------------//
/*
 * This test assumes 4 unknowns per mesh cell and 3 groups.  The field is
 * ordered COLUMN-MAJOR, ie.
 *   n = u + Nu * (i + Nx * (j + Ny * (k + Nz * (g))))
 *
 * However, the decomposition is only over space.
 */
This test assumes 4 unknowns per mesh cell and 3 groups.  The field is
ordered COLUMN-MAJOR, ie.

However, the decomposition is only over space.
This test assumes 4 unknowns per mesh cell and 3 groups . The field is ordered COLUMN - MAJOR ie . However the decomposition is only over space .
TEST_F(Parallel_Field_IO, FourUnknowns_4Blocks)
{
    if (nodes != 4)
        return;
    decompose(6, 4, 2, 2, 2, 1);
    IO_t writer;
    writer.open("four_48B.h5");
    writer.begin_group("data");
    Vec_Dbl ref(576, 0.0);
    for (int n = 0; n < 576; ++n)
        ref[n] = n + 1.0;
    Decomp d(5);
    d.local[0]  = 4; 
    d.local[4]  = 3; 
    d.global[0] = 4; 
    d.global[4] = 3; 
    d.offset[0] = 0; 
    d.offset[4] = 0; 
    std::copy(local,  local + 3,  d.local.begin() + 1);
    std::copy(global, global + 3, d.global.begin() + 1);
    std::copy(offset, offset + 3, d.offset.begin() + 1);
    {
        Vec_Dbl data(num_local * 12, 0);
        for (int g = 0; g < 3; ++g)
        {
            for (int k = 0; k < local[2]; ++k)
            {
                for (int j = 0; j < local[1]; ++j)
                {
                    for (int i = 0; i < local[0]; ++i)
                    {
                        for (int n = 0; n < 4; ++n)
                        {
                            int ln = n + 4 * l2l(i, j, k) + 4 * num_local * g;
                            int gn = n + 4 * l2g(i, j, k) + 4 * num_global * g;
                            data[ln] = ref[gn];
                        }
                    }
                }
            }
        }
        writer.write("mesh_data", d, &data[0]);
    }
    writer.end_group();
    writer.close();
    profugus::global_barrier();
    if (node == 0)
    {
        open("four_48B.h5");
        Vec_Dbl d;
        read("/data/mesh_data", d);
        EXPECT_EQ(576, d.size());
        EXPECT_VEC_EQ(ref, d);
        close();
    }
}
TEST_F ( Parallel_Field_IO , FourUnknowns_4Blocks ) { if ( nodes != 4 ) return ; decompose ( 6 , 4 , 2 , 2 , 2 , 1 ) ; IO_t writer ; writer . open ( " " ) ; writer . begin_group ( " " ) ; Vec_Dbl ref ( 576 , 0.0 ) ; for ( int n = 0 ; n < 576 ; ++ n ) ref [ n ] = n + 1.0 ; Decomp d ( 5 ) ; d . local [ 0 ] = 4 ; d . local [ 4 ] = 3 ; d . global [ 0 ] = 4 ; d . global [ 4 ] = 3 ; d . offset [ 0 ] = 0 ; d . offset [ 4 ] = 0 ; std :: copy ( local , local + 3 , d . local . begin ( ) + 1 ) ; std :: copy ( global , global + 3 , d . global . begin ( ) + 1 ) ; std :: copy ( offset , offset + 3 , d . offset . begin ( ) + 1 ) ; { Vec_Dbl data ( num_local * 12 , 0 ) ; for ( int g = 0 ; g < 3 ; ++ g ) { for ( int k = 0 ; k < local [ 2 ] ; ++ k ) { for ( int j = 0 ; j < local [ 1 ] ; ++ j ) { for ( int i = 0 ; i < local [ 0 ] ; ++ i ) { for ( int n = 0 ; n < 4 ; ++ n ) { int ln = n + 4 * l2l ( i , j , k ) + 4 * num_local * g ; int gn = n + 4 * l2g ( i , j , k ) + 4 * num_global * g ; data [ ln ] = ref [ gn ] ; } } } } } writer . write ( " " , d , & data [ 0 ] ) ; } writer . end_group ( ) ; writer . close ( ) ; profugus :: global_barrier ( ) ; if ( node == 0 ) { open ( " " ) ; Vec_Dbl d ; read ( " " , d ) ; EXPECT_EQ ( 576 , d . size ( ) ) ; EXPECT_VEC_EQ ( ref , d ) ; close ( ) ; } }
This test assumes 4 unknowns per mesh cell and 3 groups.
This test assumes 4 unknowns per mesh cell and 3 groups .
// decompose a 6x4x2 mesh into 4 blocks // add a group to the file // make a global reference field // make the decomposition (the decomposition is over (i,j,k)), but the // data is tiled over 5 variables // 4 unknowns per cell // 3 groups // 4 unknowns per cell // 3 groups // unknowns are not decomposed // groups are not decomposed // write using default COLUMN-MAJOR ORDER // write local data // read data