<reponame>robotsorcerer/LevelSetPy<filename>BoundaryCondition/add_ghost_all.py
__all__ = ["addGhostAllDims"]


def   addGhostAllDims(grid, dataIn, width):
    """
     addGhostAllDims: Create ghost cells along all grid boundaries.

       dataOut = addGhostAllDims(grid, dataIn, width)

     Creates ghost cells to manage the boundary conditions for the array dataIn.

     This function adds the same number of ghost cells in every dimension
       according to the boundary conditions specified in the grid.

     Notice that the indexing is shifted by the ghost cell width in output array.
       So in 2D, the first data in the original array will be at
              dataOut(width+1,width+1) == dataIn(1,1)

     Parameters:
       grid	Grid structure (see processGrid.m for details).
       dataIn	Inp.t data array.
       width	Number of ghost cells to add on each side (default = 1).

       dataOut	Output data array.


     Copyright 2004 <NAME> (<EMAIL>).
     This software is used, copied and distributed under the licensing
       agreement contained in the file LICENSE in the top directory of
       the distribution.

     <NAME>, 6/3/03

     Lekan Aug 21, 2021
    """
    dataOut = dataIn

    # add ghost cells
    for i in range(grid.dim):
      dataOut = grid.bdry[i](dataOut, i, width, grid.bdryData[i])


    return dataOut

__all__ = ["addGhostAllDims"]


def   addGhostAllDims(grid, dataIn, width):
    """
     addGhostAllDims: Create ghost cells along all grid boundaries.

       dataOut = addGhostAllDims(grid, dataIn, width)

     Creates ghost cells to manage the boundary conditions for the array dataIn.

     This function adds the same number of ghost cells in every dimension
       according to the boundary conditions specified in the grid.

     Notice that the indexing is shifted by the ghost cell width in output array.
       So in 2D, the first data in the original array will be at
              dataOut(width+1,width+1) == dataIn(1,1)

     Parameters:
       grid	Grid structure (see processGrid.m for details).
       dataIn	Inp.t data array.
       width	Number of ghost cells to add on each side (default = 1).

       dataOut	Output data array.


     Copyright 2004 <NAME> (<EMAIL>).
     This software is used, copied and distributed under the licensing
       agreement contained in the file LICENSE in the top directory of
       the distribution.

     <NAME>, 6/3/03

     Lekan Aug 21, 2021
    """
    dataOut = dataIn

    # add ghost cells
    for i in range(grid.dim):
      dataOut = grid.bdry[i](dataOut, i, width, grid.bdryData[i])


    return dataOut
addGhostAllDims: Create ghost cells along all grid boundaries.         dataOut = addGhostAllDims(grid, dataIn, width)       Creates ghost cells to manage the boundary conditions for the array dataIn.       This function adds the same number of ghost cells in every dimension        according to the boundary conditions specified in the grid.       Notice that the indexing is shifted by the ghost cell width in output array.        So in 2D, the first data in the original array will be at               dataOut(width+1,width+1) == dataIn(1,1)       Parameters:        grid	Grid structure (see processGrid.m for details).        dataIn	Inp.t data array.        width	Number of ghost cells to add on each side (default = 1).         dataOut	Output data array.        Copyright 2004 <NAME> (<EMAIL>).      This software is used, copied and distributed under the licensing        agreement contained in the file LICENSE in the top directory of        the distribution.       <NAME>, 6/3/03       Lekan Aug 21, 2021 # add ghost cells