/* 
* 
* 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 MESH_H
#define MESH_H

#include "GeoMorph.h"

#ifdef __cplusplus
extern "C" {
#endif
    int SegmentationTopo ( int HandleFlowDir , int HandleRaster , int exu , double cumul , int * CONSTRAIN , int nconstrain, int * _nnodes , int ** _NODES , double ** _WEIGHTS );
#ifdef __cplusplus
}
#endif

#ifdef __cplusplus
extern "C" {
#endif
    int GetCatchmentSum ( int HandleFlowDir , int HandleRaster , int outlet, int nupnodes, int * UPNODES , int ** _BB , float * _Sum , int ** _IXUPNODES , int * _nixupnodes );
#ifdef __cplusplus
}
#endif

#ifdef __cplusplus
extern "C" {
#endif
    int GetCatchmentSum1 ( int HandleFlowDir , int outlet, int nupnodes, int * UPNODES , int ** _BB , float * _Sum , int ** _IXUPNODES , int * _nixupnodes );
#ifdef __cplusplus
}
#endif

#ifdef __cplusplus
extern "C" {
#endif
    int MakeFlowLineThroughPoint ( int HandleFlowDir , int HandleRaster , int exu , int throughpoint , int ** _FlowLine , int * _length );
#ifdef __cplusplus
}
#endif

int MakeFlowLineThroughPoint_ ( FlowDirGrid * F , FloatRaster * R , int * _root , int ** _FlowLine , int * _length );

#ifdef __cplusplus
extern "C" {
#endif
	int MapCatchmentMean ( int HandleFlowDir, int HandleLocalRaster , int exu , int HandleCumulRaster , int ninlets , int * INLETS );
#ifdef __cplusplus
}
#endif

#ifdef __cplusplus
extern "C" {
#endif
	int MapCatchmentSum ( int HandleFlowDir, int HandleLocalRaster , int exu , int HandleCumulRaster , int ninlets , int * INLETS );
#ifdef __cplusplus
}
#endif

#ifdef __cplusplus
extern "C" {
#endif
	int MapCatchmentSum1 ( int HandleFlowDir, int exu , int HandleCumulRaster , int ninlets , int * INLETS );
#ifdef __cplusplus
}
#endif

#ifdef __cplusplus
extern "C" {
#endif
    int GetUpstreamNodes ( int HandleFlowDir , int outlet, int nnodes, int * NODES , int ** _IXUPNODES , int * _nixupnodes );
#ifdef __cplusplus
}
#endif

#ifdef __cplusplus
extern "C" {
#endif
    int OptimMeshVariance ( int HandleFlowDir , int HandleCumulRaster , int HandlePkRaster , int nnodes , int * NODES , int * CNT , double damper , int ** _NEWNODES , double ** _WEIGHTS );
#ifdef __cplusplus
}
#endif


#endif
