
#ifndef GROUNDWATER_H
#define GROUNDWATER_H

typedef struct {
  
  float Dem;
  float depth;
  float FlowGrad;
  float cumDeepLoss;  /* Cumulative deep loss */
  float deepLoss;     /* deep loss in the timestep */
  unsigned char toChannel;
  unsigned char Dir[NDIRS];
  unsigned int TotalDir;
} GWPIX;


void RouteGroundwater(int Dt, MAPSIZE *Map, TOPOPIX **TopoMap, SOILTABLE *SType, 
                 SOILPIX **SoilMap, CHANNEL *ChannelData, GWPIX **Groundwater, 
                 float *GwToChannel);

void InitGroundwater(LISTPTR Input, OPTIONSTRUCT *Options, MAPSIZE *Map, 
		 TOPOPIX **RealTopoMap, GWPIX ***Groundwater);

void StoreGroundwaterState(char *Path, DATE *Now, MAPSIZE *Map,  SOILPIX **SoilMap, 
                           TOPOPIX **TopoMap, GWPIX **Groundwater);

void ReadGroundwaterState(char *Path, DATE *Now, MAPSIZE *Map,  SOILPIX **SoilMap, 
                          TOPOPIX **TopoMap, GWPIX **Groundwater);

#endif
