SPModel: libSPModel/src/Catchment.h Source File
VPAC - Computational Software Development
Main | SPModel | StGermain FrameWork |
Main Page | Alphabetical List | Class List | Directories | File List | Class Members | File Members

Catchment.h

Go to the documentation of this file.
00001 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00002 **
00003 ** Copyright (C), 2004, Victorian Partnership for Advanced Computing (VPAC) Ltd, 110 Victoria Street, Melbourne, 3053, Australia.
00004 **
00005 ** Authors:
00006 **  Ogar R. Widjaja, Computational Scientist, VPAC.
00007 **  Raquibul Hassan, Software Engineer, VPAC. (raq@vpac.org)
00008 **  Keith Hsuan, Computational Scientist, VPAC (keith@vpac.org)
00009 **  William F. Appelbe, Director, VPAC. (bill@vpac.org)
00010 **  Stevan M. Quenette, Senior Software Engineer, VPAC. (steve@vpac.org)
00011 **  Patrick D. Sunter, Software Engineer, VPAC. (patrick@vpac.org)
00012 **
00013 ** This file may be distributed under the terms of the VPAC Public License
00014 ** as defined by VPAC of Australia and appearing in the file
00015 ** LICENSE.VPL included in the packaging of this file.
00016 **
00017 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00018 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
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     /* --- Constructor / Destructor Interface --- */
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     /* Public  Functions */
00111     void CatchmentList_InsertCatchments( CatchmentList *self );
00112     
00113     /* Private Functions */
00114     
00115     /* Assignes the catchment number to a node */
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 /* __SPModel_Catchment_h__ */