Palabos source parsing (c) geometry3D.h file

geometry3D.h file

Box3D

struct Box3D {
    Box3D() : x0(), x1(), y0(), y1(), z0(), z1() { }
    Box3D(plint x0_, plint x1_, plint y0_, plint y1_, plint z0_, plint z1_)
        : x0(x0_), x1(x1_), y0(y0_), y1(y1_), z0(z0_), z1(z1_)
    { }
    /// Add a border of nCells cells to the box
    Box3D enlarge(plint nCells) const {
        return Box3D(x0-nCells, x1+nCells,
                     y0-nCells, y1+nCells,
                     z0-nCells, z1+nCells);
    }

    /// Add a border of nCells cells to the box in one direction (x=0, y=1, z=2)
    Box3D enlarge(plint nCells, plint dir) const {
        switch ( dir ) {
            case 0:
              return Box3D(x0-nCells, x1+nCells, y0, y1, z0, z1);
            case 1:
              return Box3D(x0, x1, y0-nCells, y1+nCells, z0, z1);
            case 2:
              return Box3D(x0, x1, y0, y1, z0-nCells, z1+nCells);
            default:
              PLB_ASSERT(false && "The direction must be 0, 1, or 2");
              break;
        }
        return Box3D(-1,-1,-1,-1,-1,-1);
    }
    /// Number of cells in x-direction
    plint getNx()  const { return (x1-x0+1); }
    /// Number of cells in y-direction
    plint getNy()  const { return (y1-y0+1); }
    /// Number of cells in z-direction
    plint getNz()  const { return (z1-z0+1); }
    /// Total number of cells in the box
    plint nCells() const { return getNx()*getNy()*getNz(); }
    /// Return the maximum of getNx(), getNy(), and getNz()
    plint getMaxWidth() const { return std::max(std::max(getNx(), getNy()), getNz()); }

    bool operator==(Box3D const& rhs) const {
        return x0 == rhs.x0 && y0 == rhs.y0 && z0 == rhs.z0 &&
               x1 == rhs.x1 && y1 == rhs.y1 && z1 == rhs.z1;
    }

    plint x0, x1, y0, y1, z0, z1;
};

Box3D data for a predetermined operating range, often used as a parameter, to expand and to reduce the series Enlarge Box range for obtaining a corresponding series of GET parameter.

Dot3D

struct Dot3D {
    Dot3D() : x(), y(), z() { }
    Dot3D(plint x_, plint y_, plint z_) : x(x_), y(y_), z(z_) { }
    plint x, y, z;
};

Dot3D data composed of three members, respectively x, y, z. Point class can be seen as general use.

DotList3D

struct DotList3D {
    DotList3D() { }
    DotList3D(std::vector<Dot3D> const& dots_) : dots(dots_) { }
    /// Add one more point to the list
    void addDot(Dot3D dot) {
        dots.push_back(dot);
    }
    /// Add more points to the list
    void addDots(std::vector<Dot3D> const& dots_) {
        dots.insert(dots.end(), dots_.begin(), dots_.end());
    }
    /// Get const reference to one of the dots
    Dot3D const& getDot(plint whichDot) const {
        PLB_PRECONDITION( whichDot<getN() );
        return dots[whichDot];
    }
    /// Get non-const reference to one of the dots
    Dot3D& getDot(plint whichDot) {
        PLB_PRECONDITION( whichDot<getN() );
        return dots[whichDot];
    }
    /// Get total number of points
    plint getN() const {
        return dots.size();
    }

    std::vector<Dot3D> dots;
};

DotList3D vector with a container for storing Dot3D point data, the data used to do a predetermined operation range, often used as a parameter. addDot function for adding points, getDot function for obtaining point.

Bowen synchronization update address .

Published 15 original articles · won praise 5 · Views 3680

Guess you like

Origin blog.csdn.net/qq_28632981/article/details/103742209