lib/field/derivative.cc
/**
 ********************************************************************************************************************************************
 * \brief   Constructor of the derivative class
 *
 *          The constructor assigns values to the two const parameters of the derivative class,
 *          namely <B>grid</B> and <B>F</B>.
 *          It resizes tmpArray, the blitz array used to hold temporary data while calculating
 *          derivatives, computes the factors to be used with blitz stencils, and assigns
 *          the appropriate references to grid derivatives for performing finite-difference
 *          operations on non-uniform grids.
 *
 * \param   gridData is a const reference to the global data in the grid class
 * \param   F is a reference to the field on which finite-difference operations will be performed
 ********************************************************************************************************************************************
 */
\brief   Constructor of the derivative class
The constructor assigns values to the two const parameters of the derivative class,
namely grid and F.
It resizes tmpArray, the blitz array used to hold temporary data while calculating
derivatives, computes the factors to be used with blitz stencils, and assigns
the appropriate references to grid derivatives for performing finite-difference
operations on non-uniform grids.

\param   gridData is a const reference to the global data in the grid class
\param   F is a reference to the field on which finite-difference operations will be performed
\ brief Constructor of the derivative class The constructor assigns values to the two const parameters of the derivative class namely grid and F . It resizes tmpArray the blitz array used to hold temporary data while calculating derivatives computes the factors to be used with blitz stencils and assigns the appropriate references to grid derivatives for performing finite - difference operations on non - uniform grids . \ param gridData is a const reference to the global data in the grid class \ param F is a reference to the field on which finite - difference operations will be performed
derivative::derivative(const grid &gridData, const field &F): gridData(gridData), F(F) {
    tmpArray.resize(F.fSize);
    tmpArray.reindexSelf(F.flBound);
    ihx = 1.0/gridData.dXi;         ihx2 = pow(ihx, 2.0);
    ihy = 1.0/gridData.dEt;         ihy2 = pow(ihy, 2.0);
    ihz = 1.0/gridData.dZt;         ihz2 = pow(ihz, 2.0);
    fullRange = blitz::Range::all();
    xRange = blitz::Range(0, F.fCore.ubound(0), 1);
    yRange = blitz::Range(0, F.fCore.ubound(1), 1);
    zRange = blitz::Range(0, F.fCore.ubound(2), 1);
    if (F.xStag) {
        x_Metric.reference(gridData.xi_xStaggr);
        xxMetric.reference(gridData.xixxStaggr);
        x2Metric.reference(gridData.xix2Staggr);
    } else {
        x_Metric.reference(gridData.xi_xColloc);
        xxMetric.reference(gridData.xixxColloc);
        x2Metric.reference(gridData.xix2Colloc);
    }
    if (F.yStag) {
        y_Metric.reference(gridData.et_yStaggr);
        yyMetric.reference(gridData.etyyStaggr);
        y2Metric.reference(gridData.ety2Staggr);
    } else {
        y_Metric.reference(gridData.et_yColloc);
        yyMetric.reference(gridData.etyyColloc);
        y2Metric.reference(gridData.ety2Colloc);
    }
    if (F.zStag) {
        z_Metric.reference(gridData.zt_zStaggr);
        zzMetric.reference(gridData.ztzzStaggr);
        z2Metric.reference(gridData.ztz2Staggr);
    } else {
        z_Metric.reference(gridData.zt_zColloc);
        zzMetric.reference(gridData.ztzzColloc);
        z2Metric.reference(gridData.ztz2Colloc);
    }
    tmpArray = 0.0;
}
derivative :: derivative ( const grid & gridData , const field & F ) : gridData ( gridData ) , F ( F ) { tmpArray . resize ( F . fSize ) ; tmpArray . reindexSelf ( F . flBound ) ; ihx = 1.0 / gridData . dXi ; ihx2 = pow ( ihx , 2.0 ) ; ihy = 1.0 / gridData . dEt ; ihy2 = pow ( ihy , 2.0 ) ; ihz = 1.0 / gridData . dZt ; ihz2 = pow ( ihz , 2.0 ) ; fullRange = blitz :: Range :: all ( ) ; xRange = blitz :: Range ( 0 , F . fCore . ubound ( 0 ) , 1 ) ; yRange = blitz :: Range ( 0 , F . fCore . ubound ( 1 ) , 1 ) ; zRange = blitz :: Range ( 0 , F . fCore . ubound ( 2 ) , 1 ) ; if ( F . xStag ) { x_Metric . reference ( gridData . xi_xStaggr ) ; xxMetric . reference ( gridData . xixxStaggr ) ; x2Metric . reference ( gridData . xix2Staggr ) ; } else { x_Metric . reference ( gridData . xi_xColloc ) ; xxMetric . reference ( gridData . xixxColloc ) ; x2Metric . reference ( gridData . xix2Colloc ) ; } if ( F . yStag ) { y_Metric . reference ( gridData . et_yStaggr ) ; yyMetric . reference ( gridData . etyyStaggr ) ; y2Metric . reference ( gridData . ety2Staggr ) ; } else { y_Metric . reference ( gridData . et_yColloc ) ; yyMetric . reference ( gridData . etyyColloc ) ; y2Metric . reference ( gridData . ety2Colloc ) ; } if ( F . zStag ) { z_Metric . reference ( gridData . zt_zStaggr ) ; zzMetric . reference ( gridData . ztzzStaggr ) ; z2Metric . reference ( gridData . ztz2Staggr ) ; } else { z_Metric . reference ( gridData . zt_zColloc ) ; zzMetric . reference ( gridData . ztzzColloc ) ; z2Metric . reference ( gridData . ztz2Colloc ) ; } tmpArray = 0.0 ; }
\brief   Constructor of the derivative class
          The constructor assigns values to the two const parameters of the derivative class,
          namely <B>grid</B> and <B>F</B>.
\ brief Constructor of the derivative class The constructor assigns values to the two const parameters of the derivative class namely <B > grid< / B > and <B > F< / B > .
// TEMPORARY ARRAY TO STORE DERIVATIVES WHEN CALCULATING 2ND ORDER DERIVATIVES // INVERSES OF hx, hy AND hz, WHICH ARE MULTIPLIED TO FINITE-DIFFERENCE STENCILS // RANGES OF ARRAY INTO WHICH RESULTS FROM BLITZ STENCIL OPERATORS HAVE TO BE WRITTEN