コード例 #1
0
// ****************************************************************************
//  Function:  CalculateIndex
//
//  Purpose:
//    Calculate a linear index using an i,j,k index in global indexing space
//
//  Arguments:
//    e          the extents of the current domain
//    d          the dimensions of the current domain
//
//  Programmer:  Jeremy Meredith
//  Creation:    November 21, 2001
//
// ****************************************************************************
inline static int
CalculateIndex(int *e, int *d, int i, int j, int k)
{
    i = BNDMIN(BNDMAX(i, e[0]), e[1]);
    j = BNDMIN(BNDMAX(j, e[2]), e[3]);
    k = BNDMIN(BNDMAX(k, e[4]), e[5]);
    if (d[2] == 1)
        return                  (j-e[2]) *d[0] + (i-e[0]);
    else
        return ((k-e[4])*d[1] + (j-e[2]))*d[0] + (i-e[0]);
}
コード例 #2
0
// ****************************************************************************
//  Method:  Boundary::SetExtents
//
//  Purpose:
//    Set the old extents information.
//
//  Arguments:
//    e          the extents
//
//  Programmer:  Jeremy Meredith
//  Creation:    November 21, 2001
//
// ****************************************************************************
void
Boundary::SetExtents(int e[6])
{
    oldndims[0]    = e[1] - e[0] + 1;
    oldndims[1]    = e[3] - e[2] + 1;
    oldndims[2]    = e[5] - e[4] + 1;
    oldzdims[0]    = BNDMAX(e[1] - e[0], 1);
    oldzdims[1]    = BNDMAX(e[3] - e[2], 1);
    oldzdims[2]    = BNDMAX(e[5] - e[4], 1);

    oldnpts        = oldndims[0] * oldndims[1] * oldndims[2];
    oldncells      = oldzdims[0] * oldzdims[1] * oldzdims[2];

    oldnextents[0] = e[0];
    oldnextents[1] = e[1];
    oldnextents[2] = e[2];
    oldnextents[3] = e[3];
    oldnextents[4] = e[4];
    oldnextents[5] = e[5];

    oldzextents[0] = e[0];
    oldzextents[1] = BNDMAX(e[1]-1, e[0]);
    oldzextents[2] = e[2];
    oldzextents[3] = BNDMAX(e[3]-1, e[2]);
    oldzextents[4] = e[4];
    oldzextents[5] = BNDMAX(e[5]-1, e[4]);

    expand[0]      = 0;
    expand[1]      = 0;
    expand[2]      = 0;
    expand[3]      = 0;
    expand[4]      = 0;
    expand[5]      = 0;
}
コード例 #3
0
// ****************************************************************************
//  Method:  Boundary::AddNeighbor
//
//  Purpose:
//    Add a neighbor to our list, keeping track of how we must expand.
//
//  Arguments:
//    d          the matching domain number
//    mi         the index of the matching neighbor information in d's list
//    o          the "orientation" i,j,k values
//    e          the extents of the neighbor in global indexing
//
//  Programmer:  Jeremy Meredith
//  Creation:    November 21, 2001
//
// ****************************************************************************
void
Boundary::AddNeighbor(int d, int mi, int o[3], int e[6])
{
    Neighbor n;

    n.domain        = d;
    n.match         = mi;

    n.orient[0]  = o[0];
    n.orient[1]  = o[1];
    n.orient[2]  = o[2];

    n.ndims[0]   = e[1] - e[0] + 1;
    n.ndims[1]   = e[3] - e[2] + 1;
    n.ndims[2]   = e[5] - e[4] + 1;
    n.zdims[0]   = BNDMAX(e[1] - e[0], 1);
    n.zdims[1]   = BNDMAX(e[3] - e[2], 1);
    n.zdims[2]   = BNDMAX(e[5] - e[4], 1);
    n.npts       = n.ndims[0] * n.ndims[1] * n.ndims[2];
    n.ncells     = n.zdims[0] * n.zdims[1] * n.zdims[2];

    n.nextents[0] = e[0];
    n.nextents[1] = e[1];
    n.nextents[2] = e[2];
    n.nextents[3] = e[3];
    n.nextents[4] = e[4];
    n.nextents[5] = e[5];

    n.zextents[0] = e[0];
    n.zextents[1] = BNDMAX(e[1]-1, e[0]);
    n.zextents[2] = e[2];
    n.zextents[3] = BNDMAX(e[3]-1, e[2]);
    n.zextents[4] = e[4];
    n.zextents[5] = BNDMAX(e[5]-1, e[4]);

    n.type = NONE;
    // ---- I ----
    if (e[0] == e[1]  &&  oldnextents[0] != oldnextents[1])
    {
        int ei = e[0];
        if (ei == oldnextents[0])
        {
            n.type |= IMIN;
            expand[0] = 1;
        }
        if (ei == oldnextents[1])
        {
            n.type |= IMAX;
            expand[1] = 1;
            n.zextents[0]--;
            n.zextents[1]--;
        }
    }
    // ---- J ----
    if (e[2] == e[3]  &&  oldnextents[2] != oldnextents[3])
    {
        int ej = e[2];
        if (ej == oldnextents[2])
        {
            n.type |= JMIN;
            expand[2] = 1;
        }
        if (ej == oldnextents[3])
        {
            n.type |= JMAX;
            expand[3] = 1;
            n.zextents[2]--;
            n.zextents[3]--;
        }
    }
    // ---- K ----
    if (e[4] == e[5]  &&  oldnextents[4] != oldnextents[5])
    {
        int ek = e[4];
        if (ek == oldnextents[4])
        {
            n.type |= KMIN;
            expand[4] = 1;
        }
        if (ek == oldnextents[5])
        {
            n.type |= KMAX;
            expand[5] = 1;
            n.zextents[4]--;
            n.zextents[5]--;
        }
    }

    // Add the neighbor to the list
    neighbors.push_back(n);
}
コード例 #4
0
// ****************************************************************************
//  Method:  Boundary::AddNeighbor
//
//  Purpose:
//    Add a neighbor to our list, keeping track of how we must expand.
//
//  Arguments:
//    d          the matching domain number
//    mi         the index of the matching neighbor information in d's list
//    o          the "orientation" i,j,k values
//    e          the extents of the neighbor in global indexing
//
//  Programmer:  Jeremy Meredith
//  Creation:    November 21, 2001
//
//  Modifications:
//
//    Hank Childs, Tue Jan  4 12:33:17 PST 2011
//    Add arguments for creating ghost data across refinement levels.
//
//    Gunther H. Weber, Wed Jul 18 15:38:36 PDT 2012
//    Support anisotropic refinement.
//
//    Gunther H. Weber, Mon Jul 28 18:19:19 PDT 2014
//    Do not expand boundary when adding recipient neighbors (fixes
//    regression test failure when selecting new ghost zone generation
//    method for crack-free isosurface extraction from AMR data).
//
// ****************************************************************************
void
Boundary::AddNeighbor(int d, int mi, int o[3], int e[6],
                      RefinementRelationship rr, const std::vector<int>& ref_ratio,
                      NeighborRelationship nr)
{
    Neighbor n;

    n.refinement_rel   = rr;
    n.refinement_ratio = ref_ratio;
    n.neighbor_rel     = nr;
    n.domain        = d;
    n.match         = mi;

    n.orient[0]  = o[0];
    n.orient[1]  = o[1];
    n.orient[2]  = o[2];

    n.ndims[0]   = e[1] - e[0] + 1;
    n.ndims[1]   = e[3] - e[2] + 1;
    n.ndims[2]   = e[5] - e[4] + 1;
    n.zdims[0]   = BNDMAX(e[1] - e[0], 1);
    n.zdims[1]   = BNDMAX(e[3] - e[2], 1);
    n.zdims[2]   = BNDMAX(e[5] - e[4], 1);
    n.npts       = n.ndims[0] * n.ndims[1] * n.ndims[2];
    n.ncells     = n.zdims[0] * n.zdims[1] * n.zdims[2];

    n.nextents[0] = e[0];
    n.nextents[1] = e[1];
    n.nextents[2] = e[2];
    n.nextents[3] = e[3];
    n.nextents[4] = e[4];
    n.nextents[5] = e[5];

    n.zextents[0] = e[0];
    n.zextents[1] = BNDMAX(e[1]-1, e[0]);
    n.zextents[2] = e[2];
    n.zextents[3] = BNDMAX(e[3]-1, e[2]);
    n.zextents[4] = e[4];
    n.zextents[5] = BNDMAX(e[5]-1, e[4]);

    n.type = NONE;
    // ---- I ----
    if (e[0] == e[1]  &&  oldnextents[0] != oldnextents[1])
    {
        int ei = e[0];
        if (ei == oldnextents[0])
        {
            n.type |= IMIN;
            if (nr != RECIPIENT_NEIGHBOR) expand[0] = 1;
        }
        if (ei == oldnextents[1])
        {
            n.type |= IMAX;
            if (nr != RECIPIENT_NEIGHBOR) expand[1] = 1;
            n.zextents[0]--;
            n.zextents[1]--;
        }
    }
    // ---- J ----
    if (e[2] == e[3]  &&  oldnextents[2] != oldnextents[3])
    {
        int ej = e[2];
        if (ej == oldnextents[2])
        {
            n.type |= JMIN;
            if (nr != RECIPIENT_NEIGHBOR) expand[2] = 1;
        }
        if (ej == oldnextents[3])
        {
            n.type |= JMAX;
            if (nr != RECIPIENT_NEIGHBOR) expand[3] = 1;
            n.zextents[2]--;
            n.zextents[3]--;
        }
    }
    // ---- K ----
    if (e[4] == e[5]  &&  oldnextents[4] != oldnextents[5])
    {
        int ek = e[4];
        if (ek == oldnextents[4])
        {
            n.type |= KMIN;
            if (nr != RECIPIENT_NEIGHBOR) expand[4] = 1;
        }
        if (ek == oldnextents[5])
        {
            n.type |= KMAX;
            if (nr != RECIPIENT_NEIGHBOR) expand[5] = 1;
            n.zextents[4]--;
            n.zextents[5]--;
        }
    }

    // Add the neighbor to the list
    neighbors.push_back(n);
}