//#####################################################################
// Copyright 2005, Eran Guendelman, Geoffrey Irving, Andrew Selle.
// This file is part of PhysBAM whose distribution is governed by the license contained in the accompanying file PHYSBAM_COPYRIGHT.txt.
//#####################################################################
// Class NODE_ITERATOR
//#####################################################################
#ifndef __NODE_ITERATOR__
#define __NODE_ITERATOR__

#include <Core/Grids/GRID.h>
#include <Core/Grids/GRID_ITERATOR_BASE.h>
namespace PhysBAM{

template<class TV>
class NODE_ITERATOR:public RANGE_ITERATOR<TV::m>
{
public:
    typedef GRID_REGION T_REGION;typedef VECTOR<int,TV::m> IV;
    typedef TV VECTOR_T;
    using RANGE_ITERATOR<TV::m>::index;

    GRID<TV> grid;

    NODE_ITERATOR(const GRID<TV>& grid_input,const int number_of_ghost_cells=0,const T_REGION& region_type=WHOLE_REGION,const int side=-1);
    NODE_ITERATOR(const GRID<TV>& grid_input,const RANGE<IV>& region_input);

    const IV& Node_Index() const
    {return index;}

    TV Location() const
    {return grid.Node_X(index);}

    IV Node_Neighbor(const int i) const // i=1 to 6
    {return grid.Node_Neighbor(index,i);}

//#####################################################################
};
}
#endif
