//#####################################################################
// Copyright 2002-2007, Ronald Fedkiw, Geoffrey Irving, Nipun Kwatra.
// This file is part of PhysBAM whose distribution is governed by the license contained in the accompanying file PHYSBAM_COPYRIGHT.txt.
//#####################################################################
// Class BOUNDARY_EXTRAPOLATE_CELL
//#####################################################################
#include <Core/Boundaries/BOUNDARY_EXTRAPOLATE_CELL.h>
#include <Core/Extrapolation/EXTRAPOLATION_HIGHER_ORDER_POLY.h>
#include <Core/Grids/CELL_ITERATOR.h>
#include <Core/Grids/GRID.h>
using namespace PhysBAM;
//#####################################################################
// Function Fill_Ghost_Cells
//#####################################################################
template<class TV,class T2> void BOUNDARY_EXTRAPOLATE_CELL<TV,T2>::
Fill_Ghost_Cells(const GRID<TV>& grid,const ARRAYS_ND_BASE<T2,IV>& u,ARRAYS_ND_BASE<T2,IV>& u_ghost,const int number_of_ghost_cells) const
{
    ARRAYS_ND_BASE<T2,IV>::Put(u,u_ghost); // interior
    RANGE<IV> domain=grid.Cell_Indices(number_of_ghost_cells);
    EXTRAPOLATION_HIGHER_ORDER_POLY<TV,T>::Extrapolate_Cell(grid,
        [&](const IV& index){return domain.Lazy_Inside_Half_Open(index);},
        number_of_ghost_cells,u_ghost,3,number_of_ghost_cells);
}
//#####################################################################
// Function Apply_Boundary_Condition
//#####################################################################
template<class TV,class T2> void BOUNDARY_EXTRAPOLATE_CELL<TV,T2>::
Apply_Boundary_Condition_Cell(const GRID<TV>& grid,ARRAYS_ND_BASE<T2,IV>& u) const
{
}
namespace PhysBAM{
template class BOUNDARY_EXTRAPOLATE_CELL<VECTOR<float,1>,float>;
template class BOUNDARY_EXTRAPOLATE_CELL<VECTOR<float,2>,float>;
template class BOUNDARY_EXTRAPOLATE_CELL<VECTOR<float,3>,float>;
template class BOUNDARY_EXTRAPOLATE_CELL<VECTOR<double,1>,double>;
template class BOUNDARY_EXTRAPOLATE_CELL<VECTOR<double,2>,double>;
template class BOUNDARY_EXTRAPOLATE_CELL<VECTOR<double,3>,double>;
}
