00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00056 #ifndef __SPModel_SurfaceMesh_h__
00057 #define __SPModel_SurfaceMesh_h__
00058
00059
00060 extern const Type SurfaceMesh_Type;
00061
00062
00063 extern const char* MESH_TYPE_AUTOGENERATED;
00064 extern const char* MESH_TYPE_FROM_TEXT_INPUT;
00065 extern const char* MESH_TYPE_FROM_ENVI_INPUT;
00066
00068 #define __SurfaceMeshHaloNodes \
00069 int numHaloNodes; \
00070 int *haloId; \
00071 float *x; \
00072 float *y; \
00073 float *h; \
00074 int *receiver; \
00075 float *surface;
00076 struct SurfaceMeshHaloNodes { __SurfaceMeshHaloNodes };
00077
00078 #define __SurfaceMeshForeignHaloNodes \
00079 int numForeignHaloNodes; \
00080 int *foreignHaloId;
00081 struct SurfaceMeshForeignHaloNodes { __SurfaceMeshForeignHaloNodes };
00082
00083
00085 #define __SurfaceMesh \
00086 struct { __Stg_Component }; \
00087 \
00088 Dictionary *dictionary; \
00089 Stream *debug; \
00090 SurfaceMeshLoader *surfaceMeshLoader; \
00091 \
00092 float *boundaryConditions; \
00093 \
00094 int elementGlobalCount; \
00095 int arrayElements; \
00096 \
00097 float delta; \
00098 float surfScale; \
00099 int iAdapt; \
00100 float sideX, sideY; \
00101 int *numNeigh; \
00102 int **nodeNeighbours; \
00103 int numNodes; \
00104 int maxNeighboursPerNode; \
00105 \
00106 int *id; \
00107 int *sortedId; \
00108 int numProcs; \
00109 int rank; \
00110 MPI_Request *requestTable; \
00111 MPI_Status *statusTable; \
00112 \
00113 int myLoad; \
00114 int *processor; \
00115 LinkedList **nodeProviders; \
00116 int *numProviders; \
00117 int *mapGlobalToLocal; \
00118 \
00119 float **sides; \
00120 int **vertices; \
00121 float *surface; \
00122 float *x; \
00123 float *y; \
00124 float *h; \
00125 int *receiver; \
00126 int *highestNeighbour; \
00127 int *size; \
00128 int *nCatch; \
00129 int *nLake; \
00130 int *nodeType; \
00131 float *slope; \
00132 float *length; \
00133 float *hi; \
00134 float *h0; \
00135 SurfaceMeshHaloNodes *haloNodes; \
00136 SurfaceMeshForeignHaloNodes *foreignHaloNodes; \
00137 LinkedList **foreignProviderChanges; \
00138 LinkedList **localProviderChanges;
00139
00141 struct SurfaceMesh { __SurfaceMesh };
00142
00143 typedef struct providerSyncStruct_t{
00144 int nodeId;
00145 int provider;
00146 }providerSyncStruct;
00147
00148
00149
00151 SurfaceMesh* SurfaceMesh_DefaultNew( Name name );
00152
00153 SurfaceMesh* SurfaceMesh_New(
00154 Name name,
00155 int numProcs,
00156 int rank,
00157 void* extension_Register,
00158 Dictionary* dictionary );
00159
00161 SurfaceMesh* _SurfaceMesh_New(
00162 SizeT _sizeOfSelf,
00163 Type type,
00164 Stg_Class_DeleteFunction* _delete,
00165 Stg_Class_PrintFunction* _print,
00166 Stg_Class_CopyFunction* _copy,
00167 Stg_Component_DefaultConstructorFunction* _defaultConstructor,
00168 Stg_Component_ConstructFunction* _construct,
00169 Stg_Component_BuildFunction* _build,
00170 Stg_Component_InitialiseFunction* _initialise,
00171 Stg_Component_ExecuteFunction* _execute,
00172 Stg_Component_DestroyFunction* _destroy,
00173 Name name,
00174 Bool initFlag,
00175 int numProcs,
00176 int rank,
00177 void* extension_Register,
00178 Dictionary* dictionary );
00179
00181
00182 void _SurfaceMesh_Init( SurfaceMesh* self );
00183
00185 void _SurfaceMesh_Delete( void* surfaceMesh );
00186
00187
00188
00190 void _SurfaceMesh_Print( void* surfaceMesh, Stream* stream );
00191
00193 void _SurfaceMesh_Construct( void* surfaceMesh, Stg_ComponentFactory* cf );
00194
00195 void _SurfaceMesh_Build( void* surfaceMesh, void* data );
00196
00198 void _SurfaceMesh_Initialise( void* surfaceMesh, void* data );
00199
00201 void _SurfaceMesh_Execute( void* surfaceMesh, void* data );
00202
00203 void _SurfaceMesh_Destroy( void* surfaceMesh, void* data );
00204
00205
00206 void SurfaceMesh_FindHaloNode( SurfaceMesh *mesh, int nodeId, int *processor, int *index );
00207
00208
00209
00210 void _SurfaceMesh_FindNeighbours( SurfaceMesh* mesh );
00211
00212 void SurfaceMesh_AllocateMemoryForHaloNodes( SurfaceMesh *mesh );
00213
00214
00215 void SurfaceMesh_ReleaseMemory( SurfaceMesh* mesh );
00216
00218 void _SurfaceMesh_DetermineFlows( SurfaceMesh* mesh, float* boundaryConditions );
00219
00220 void _SurfaceMesh_FindDonors( SurfaceMesh* mesh );
00221
00222
00223 int getSize( SurfaceMesh *mesh, int nodeId );
00224
00225 void _SurfaceMesh_DetermineCatchmentSizes( SurfaceMesh* mesh );
00226
00227 void SurfaceMesh_BuildRiverNetwork( SurfaceMesh *self );
00228
00229 void SurfaceMesh_UpdateFlows( SurfaceMesh *mesh );
00230
00231 void SurfaceMesh_OrderNodes( SurfaceMesh *mesh );
00232
00233 void SurfaceMesh_BoundaryConditions( SurfaceMesh *surfaceMesh );
00234
00235 #endif