00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00033 #ifndef __SPModel_Catchment_h__
00034 #define __SPModel_Catchment_h__
00035
00036 typedef struct vector_t{
00037 double x, y, h;
00038 }vector;
00039
00040 #define __Catchment \
00041 int localMinimum; \
00042 int netSize; \
00043 vector catchmentCentre; \
00044 struct Catchment *subCatchments; \
00045 struct Catchment *nextCatchment;
00046 struct Catchment{ __Catchment };
00047
00048 #define __CatchmentList \
00049 struct { __Stg_Component }; \
00050 \
00051 Dictionary *dictionary; \
00052 SurfaceMesh *mesh; \
00053 int numProcs; \
00054 BTree *catchments;
00055 struct CatchmentList { __CatchmentList };
00056
00057
00058
00060 CatchmentList *CatchmentList_DefaultNew( Name name );
00061
00062 CatchmentList *CatchmentList_New( Name name, SurfaceMesh *mesh, int numProcs, Dictionary *dictionary );
00063
00065 CatchmentList *_CatchmentList_New( SizeT _sizeOfSelf,
00066 Type type,
00067 Stg_Class_DeleteFunction* _delete,
00068 Stg_Class_PrintFunction* _print,
00069 Stg_Class_CopyFunction* _copy,
00070 Stg_Component_DefaultConstructorFunction* _defaultConstructor,
00071 Stg_Component_ConstructFunction* _construct,
00072 Stg_Component_BuildFunction* _build,
00073 Stg_Component_InitialiseFunction* _initialise,
00074 Stg_Component_ExecuteFunction* _execute,
00075 Stg_Component_DestroyFunction* _destroy,
00076 Name name,
00077 Bool initFlag,
00078 SurfaceMesh* mesh,
00079 int numProcs,
00080 Dictionary* dictionary );
00081
00083 void CatchmentList_Init( CatchmentList *self,
00084 Name name,
00085 SurfaceMesh *mesh,
00086 int numProcs,
00087 Dictionary *dictionary );
00088
00089 void _CatchmentList_Init( CatchmentList *self );
00090
00092 void _CatchmentList_Delete( void *cList );
00093
00095 void _CatchmentList_Print( void *cList, Stream *stream );
00096
00097 void _CatchmentList_Construct( void *cList, Stg_ComponentFactory *cf );
00098
00100 void _CatchmentList_Build( void *cList, void *data );
00101
00103 void _CatchmentList_Initialise( void *cList, void *data );
00104
00106 void _CatchmentList_Execute( void *cList, void *data );
00107
00108 void _CatchmentList_Destroy( void *cList, void *data );
00109
00110
00111 void CatchmentList_InsertCatchments( CatchmentList *self );
00112
00113
00114
00115
00116 void AssignCatchmentNumber( CatchmentList *self, int nodeId, int locMin );
00117
00118 void CalculateCatchmentCentres( CatchmentList *self );
00119
00120 void CalculateCatchmentCentreHelper( CatchmentList *self, int nodeId, vector *sum );
00121
00122 #endif