/* 
* 
* Copyright (C) 2013 UMPC
* 
* This file is part of CLaRiNet.
*  
* CLaRiNet is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* 
* CLaRiNet is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
* 
* You should have received a copy of the GNU General Public License
* along with CLaRiNet.  If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TOPOLOGY_H
#define TOPOLOGY_H

#include "GeoMorph.h"

#ifdef __cplusplus
extern "C" {
#endif
    int verifyUpstreamDownstream ( FlowDirGrid * F , int * _src , int * _dst );
#ifdef __cplusplus
}
#endif

int GetDownstream ( FlowDirGrid * F , int * _cell );

int GetUpstream ( FlowDirGrid * F , int * _cell , int * _nup , int ** _UPSTREAM );

#ifdef __cplusplus
extern "C" {
#endif
	int GetCatchmentCells ( int HandleFlowDir , int outlet, int * INLETS , int ninlets , int * _nup , int ** _CATCHMENT , int ** _bb , int ** _SELINLETS , int * _nselinlets );
#ifdef __cplusplus
}
#endif

#ifdef __cplusplus
extern "C" {
#endif
    int GetCatchmentSize ( const int HandleFlowDir , int outlet, int nupnodes, int * UPNODES , int ** _BB , int * _nup , int ** _IXUPNODES , int * _nixupnodes );
#ifdef __cplusplus
}
#endif

#ifdef __cplusplus
extern "C" {
#endif
    int GetDownstreamSet ( const int HandleFlowDir , int ncells , int * CELLS , int ** _DOWNSTREAM );
#ifdef __cplusplus
}
#endif

#ifdef __cplusplus
extern "C" {
#endif
    int MakeFlowLine ( int HandleFlowDir , const int A , const int B , int ** _FlowLine , int * _length );
#ifdef __cplusplus
}
#endif

#ifdef __cplusplus
extern "C" {
#endif
    int MakeArcs ( int HandleFlowDir , int * NODES , int nnodes , int ** _UP , int ** _DOWN , int * _narcs ) ;
#ifdef __cplusplus
}
#endif

int MakeFlowLineBetweenPoints ( FlowDirGrid * F , int A , int B , int ** _FlowLine , int * _length );

#ifdef __cplusplus
extern "C" {
#endif
	int GetDownstreamPath ( int HandleFlowDir , int start , int ** _FlowLine , int * _length  );
#ifdef __cplusplus
}
#endif

	
#endif

