lib/io/writer.cc
/**
 ********************************************************************************************************************************************
 * \brief   Function to interpolate data to a blitz array without pads
 *
 *          The solution files are written after interpolating the data to cell centers.
 *          This function performs this task depending on the mesh configuration of the variable.
 *
 ********************************************************************************************************************************************
 */
\brief   Function to interpolate data to a blitz array without pads
The solution files are written after interpolating the data to cell centers.
This function performs this task depending on the mesh configuration of the variable.
\ brief Function to interpolate data to a blitz array without pads The solution files are written after interpolating the data to cell centers . This function performs this task depending on the mesh configuration of the variable .
void writer::interpolateData(field &outField) {
#ifdef PLANAR
    if (not outField.xStag) {
        for (int i=0; i < fieldData.shape()[0]; i++) {
            for (int k=0; k < fieldData.shape()[2]; k++) {
                fieldData(i, k) = (outField.F(i-1, 0, k) + outField.F(i, 0, k))*0.5;
            }
        }
    } else if (not outField.zStag) {
        for (int i=0; i < fieldData.shape()[0]; i++) {
            for (int k=0; k < fieldData.shape()[2]; k++) {
                fieldData(i, k) = (outField.F(i, 0, k-1) + outField.F(i, 0, k))*0.5;
            }
        }
    } else {
        for (int i=0; i < fieldData.shape()[0]; i++) {
            for (int k=0; k < fieldData.shape()[2]; k++) {
                fieldData(i, k) = outField.F(i, 0, k);
            }
        }
    }
#else
    if (not outField.xStag) {
        for (int i=0; i < fieldData.shape()[0]; i++) {
            for (int j=0; j < fieldData.shape()[1]; j++) {
                for (int k=0; k < fieldData.shape()[2]; k++) {
                    fieldData(i, j, k) = (outField.F(i-1, j, k) + outField.F(i, j, k))*0.5;
                }
            }
        }
    } else if (not outField.yStag) {
        for (int i=0; i < fieldData.shape()[0]; i++) {
            for (int j=0; j < fieldData.shape()[1]; j++) {
                for (int k=0; k < fieldData.shape()[2]; k++) {
                    fieldData(i, j, k) = (outField.F(i, j-1, k) + outField.F(i, j, k))*0.5;
                }
            }
        }
    } else if (not outField.zStag) {
        for (int i=0; i < fieldData.shape()[0]; i++) {
            for (int j=0; j < fieldData.shape()[1]; j++) {
                for (int k=0; k < fieldData.shape()[2]; k++) {
                    fieldData(i, j, k) = (outField.F(i, j, k-1) + outField.F(i, j, k))*0.5;
                }
            }
        }
    } else {
        for (int i=0; i < fieldData.shape()[0]; i++) {
            for (int j=0; j < fieldData.shape()[1]; j++) {
                for (int k=0; k < fieldData.shape()[2]; k++) {
                    fieldData(i, j, k) = outField.F(i, j, k);
                }
            }
        }
    }
#endif
}
void writer :: interpolateData ( field & outField ) { #ifdef PLANAR if ( not outField . xStag ) { for ( int i = 0 ; i < fieldData . shape ( ) [ 0 ] ; i ++ ) { for ( int k = 0 ; k < fieldData . shape ( ) [ 2 ] ; k ++ ) { fieldData ( i , k ) = ( outField . F ( i - 1 , 0 , k ) + outField . F ( i , 0 , k ) ) * 0.5 ; } } } else if ( not outField . zStag ) { for ( int i = 0 ; i < fieldData . shape ( ) [ 0 ] ; i ++ ) { for ( int k = 0 ; k < fieldData . shape ( ) [ 2 ] ; k ++ ) { fieldData ( i , k ) = ( outField . F ( i , 0 , k - 1 ) + outField . F ( i , 0 , k ) ) * 0.5 ; } } } else { for ( int i = 0 ; i < fieldData . shape ( ) [ 0 ] ; i ++ ) { for ( int k = 0 ; k < fieldData . shape ( ) [ 2 ] ; k ++ ) { fieldData ( i , k ) = outField . F ( i , 0 , k ) ; } } } #else if ( not outField . xStag ) { for ( int i = 0 ; i < fieldData . shape ( ) [ 0 ] ; i ++ ) { for ( int j = 0 ; j < fieldData . shape ( ) [ 1 ] ; j ++ ) { for ( int k = 0 ; k < fieldData . shape ( ) [ 2 ] ; k ++ ) { fieldData ( i , j , k ) = ( outField . F ( i - 1 , j , k ) + outField . F ( i , j , k ) ) * 0.5 ; } } } } else if ( not outField . yStag ) { for ( int i = 0 ; i < fieldData . shape ( ) [ 0 ] ; i ++ ) { for ( int j = 0 ; j < fieldData . shape ( ) [ 1 ] ; j ++ ) { for ( int k = 0 ; k < fieldData . shape ( ) [ 2 ] ; k ++ ) { fieldData ( i , j , k ) = ( outField . F ( i , j - 1 , k ) + outField . F ( i , j , k ) ) * 0.5 ; } } } } else if ( not outField . zStag ) { for ( int i = 0 ; i < fieldData . shape ( ) [ 0 ] ; i ++ ) { for ( int j = 0 ; j < fieldData . shape ( ) [ 1 ] ; j ++ ) { for ( int k = 0 ; k < fieldData . shape ( ) [ 2 ] ; k ++ ) { fieldData ( i , j , k ) = ( outField . F ( i , j , k - 1 ) + outField . F ( i , j , k ) ) * 0.5 ; } } } } else { for ( int i = 0 ; i < fieldData . shape ( ) [ 0 ] ; i ++ ) { for ( int j = 0 ; j < fieldData . shape ( ) [ 1 ] ; j ++ ) { for ( int k = 0 ; k < fieldData . shape ( ) [ 2 ] ; k ++ ) { fieldData ( i , j , k ) = outField . F ( i , j , k ) ; } } } } #endif }
\brief   Function to interpolate data to a blitz array without pads
          The solution files are written after interpolating the data to cell centers.
\ brief Function to interpolate data to a blitz array without pads The solution files are written after interpolating the data to cell centers .
// The below method does not recognize arrays with staggering in more than 1 direction // Use with care for exotic arrays