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

Context.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 */
00090 #ifndef __SPModel_Context_h__
00091 #define __SPModel_Context_h__
00092 
00093     typedef enum MemoryFlag_t{
00094         GLOBAL_EXTENSION,
00095         LOCAL_EXTENSION 
00096     }MemoryFlag;
00097 
00098     typedef enum FileFormat_t{
00099         TEXT,
00100         BINARY
00101     }FileFormat;
00102 
00103     /* Textual name of this class */
00104     extern const Type SPModel_Context_Type;
00105 
00106     /* SPModel_Context entry point names */
00107     extern const Name SPModel_EP_LoopNodesEnergy;
00108 
00109     /* SPModel_Context info */
00110     #define __SPModel_Context \
00111         /* General info */ \
00112         struct              { __AbstractContext }; \
00113         \
00114         /* Virtual info */ \
00115         \
00116         /* SPModel_Context info */ \
00117         SurfaceMesh             *globalMesh; \
00118         SurfaceMesh             *localMesh; \
00119         SurfaceRegularMesh      *regularMesh; \
00120         CatchmentList           *catchmentList; \
00121         _SurfaceMeshDecomp      *meshDecomp; \
00122         _Interpolator           *interpolator; \
00123         SurfaceMeshSmoother     *meshSmoother; \
00124         /* physical properties */ \
00125         double              gravity; \
00126         ParameterTimeSeries *seaLevel; \
00127         _SurfaceMeshCyclicBC    *cyclicBC; \
00128         float               upliftRate;  \
00129         float               oroLength;   \
00130         float               oroRate; \
00131         float               fluvialConstant; \
00132         float               bedRockDiffusivity; \
00133         float               sedimentDiffusivity; \
00134         float               submarineBedRockDiffusivity; \
00135         float               submarineSedimentDiffusivity; \
00136         float               bedRockErosionLengthScale; \
00137         float               sedimentErosionLengthScale; \
00138         float               bedRockDensity; \
00139         float               sedimentDensity; \
00140         float               asthenosphereDensity; \
00141         float               flexuralRigidity; \
00142         float               elasticPlateLength; \
00143         \
00144         /* File output options */ \
00145         FileFormat      outputFormat; \
00146         int             itopography; \
00147         int             iwater; \
00148         int             ierosion; \
00149         int             iuplift; \
00150         int             isedimentation; \
00151         int             iisostacy; \
00152         int             idaughterNodes; \
00153         /* Sync Info */ \
00154         int             itemsSent; \
00155         int             itemsReceived; \
00156         \
00157         double              dt; \
00158         double              staticDt; \
00159         int                 flexureInterval; \
00160         int                 redistributeNodesFlag;
00161     struct SPModel_Context { __SPModel_Context };
00162 
00163     typedef struct SPModelSimulationContextExtension_t{
00164         float *water;
00165         float *erosion;
00166         float *sediment;
00167         float *sedimentHistory;
00168         float *uplift;
00169         float *hiso;
00170         float *hisoPrev;
00171         float *hisotot;
00172 
00173         float *globalWater;
00174         float *globalErosion;
00175         float *globalSedimentHistory;
00176         float *globalUplift;
00177     }SPModelSimulationContextExtension;
00178 
00179     /* Create a new SPModel_Context and initialise */
00180     SPModel_Context* SPModel_Context_DefaultNew( Name name );
00181     
00182     SPModel_Context* SPModel_Context_New(
00183         Name                    name,
00184         double                  start,
00185         double                  stop,
00186         MPI_Comm                communicator,
00187         Dictionary*             dictionary );
00188 
00189     /* Creation implementation / Virtual constructor */
00190     SPModel_Context* _SPModel_Context_New(
00191         SizeT                   _sizeOfSelf,
00192         Type                    type,
00193         Stg_Class_DeleteFunction*               _delete,
00194         Stg_Class_PrintFunction*                _print,
00195         Stg_Class_CopyFunction*             _copy, 
00196         Stg_Component_DefaultConstructorFunction*   _defaultConstructor,
00197         Stg_Component_ConstructFunction*            _construct,
00198         Stg_Component_BuildFunction*        _build,
00199         Stg_Component_InitialiseFunction*       _initialise,
00200         Stg_Component_ExecuteFunction*      _execute,
00201         Stg_Component_DestroyFunction*      _destroy,
00202         Name                            name,
00203         Bool                            initFlag,
00204         AbstractContext_SetDt*          _setDt,
00205         double                  start,
00206         double                  stop,
00207         MPI_Comm                communicator,
00208         Dictionary*             dictionary );
00209 
00210     /* Initialisation implementation */
00211     void _SPModel_Context_Init( SPModel_Context* self );
00212 
00213     /* Stg_Class_Delete implementation */
00214     void _SPModel_Context_Delete( void* context );
00215 
00216     /* Print implementation */
00217     void _SPModel_Context_Print( void* context, Stream* stream );
00218 
00219     void _SPModel_Context_Build( void* context );
00220     
00221     /* Build the SPModel implementation */
00222     void _SPModel_Context_Build( void* context );
00223 
00224     /* Initialise the SPModel implementation */
00225     void _SPModel_Context_InitialConditions( void* context );
00226 
00227     /* Obtain the Dt for the SPModel implementation */
00228     double _SPModel_Context_Dt( void* context );
00229 
00230     /* Set the Dt */
00231     void _SPModel_Context_SetDt( void* context, double dt );
00232 
00233     /* Set the boundary conditions of the SPModel implementation */
00234     void _SPModel_Context_BoundaryConditions( void* context );
00235 
00236     /* Do the zeroth time step */
00237     void SPModel_Context_TimeStepZero( void* context );
00238 
00239     /* Solve for the SPModel implementation */
00240     void _SPModel_Context_Solve( void* context );
00241 
00242     /* Sync for the SPModel implementation */
00243     void _SPModel_Context_Sync( void* context );
00244 
00245     /* Some output dumping helpers */
00246     void DumpLoopInfo( void* context );
00247     void DumpCoord( SPModel_Context* self, Node_LocalIndex node_lI );
00248 
00249     void _SPModel_Context_InitDump( SPModel_Context* self );
00250     void _SPModel_Context_Dump( SPModel_Context* self );
00251 
00252 
00253     void _SPModel_Context_ComponentConstruct( void* context, Stg_ComponentFactory* cf );
00254     void _SPModel_Context_ComponentBuild( void* context, void* data );
00255     void _SPModel_Context_ComponentInitialise( void* context, void* data );
00256     void _SPModel_Context_ComponentExecute( void* context, void* data );
00257     void _SPModel_Context_ComponentDestroy( void* context, void* data );
00258 
00259     void _SPModel_SimulationContextExtension_AllocateMemory( void *context, MemoryFlag mf );
00260     void _SPModel_SimulationContextExtension_ReleaseMemory( void *context, MemoryFlag mf );
00261 
00262     void _SPModel_Context_Gather( SPModel_Context* self );
00263     void _SPModel_Context_RedistributeNodes( SPModel_Context *context );
00264 
00265 #endif /* __SPModel_Context_h__ */