lib/src/AMRTools/DerivStencil.cpp
/**
    add another set if the BAI is not in the
    stencil already.  \\
    **Add the weight to the existing weight otherwise**
    */
add another set if the BAI is not in the
stencil already.
Add the weight to the existing weight otherwise
add another set if the BAI is not in the stencil already . Add the weight to the existing weight otherwise
void
DerivStencil::accumulate(
    const IntVect& a_iv,
    Real a_weight
    )
{
    CH_assert(isdefined);
    CH_assert(m_vectIV.size()==m_vectWgt.size());
    bool isalreadythere = false;
    int ithere= -1;
    for (int ivect = 0; ivect < m_vectIV.size(); ivect++)
    {
        if (a_iv == m_vectIV[ivect])
        {
            isalreadythere = true;
            ithere = ivect;
            break;
        }
    }
    if (!isalreadythere)
    {
        m_vectWgt.push_back(a_weight);
        m_vectIV.push_back(a_iv);
    }
    else
    {
        m_vectWgt[ithere] += a_weight;
    }
}
void DerivStencil :: accumulate ( const IntVect & a_iv , Real a_weight ) { CH_assert ( isdefined ) ; CH_assert ( m_vectIV . size ( ) == m_vectWgt . size ( ) ) ; bool isalreadythere = false ; int ithere = -1 ; for ( int ivect = 0 ; ivect < m_vectIV . size ( ) ; ivect ++ ) { if ( a_iv == m_vectIV [ ivect ] ) { isalreadythere = true ; ithere = ivect ; break ; } } if ( ! isalreadythere ) { m_vectWgt . push_back ( a_weight ) ; m_vectIV . push_back ( a_iv ) ; } else { m_vectWgt [ ithere ] += a_weight ; } }
add another set if the BAI is not in the
stencil already.
add another set if the BAI is not in the stencil already .