SPModel: libSPModel/src/SurfaceMesh.c File Reference
VPAC - Computational Software Development
Main | SPModel | StGermain FrameWork |
Main Page | Alphabetical List | Class List | Directories | File List | Class Members | File Members

SurfaceMesh.c File Reference

#include <mpi.h>
#include <StGermain/StGermain.h>
#include <Cascade/cascade.h>
#include "types.h"
#include "SurfaceMesh.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <math.h>
#include "SurfaceMeshLoader.h"
#include "Misc.h"
#include "CommHandler.h"

Include dependency graph for SurfaceMesh.c:

Go to the source code of this file.

Functions

SurfaceMeshSurfaceMesh_DefaultNew (Name name)
 Create a new SurfaceMesh and initialise.
SurfaceMeshSurfaceMesh_New (Name name, int numProcs, int rank, void *extension_Register, Dictionary *dictionary)
SurfaceMesh_SurfaceMesh_New (SizeT _sizeOfSelf, Type type, Stg_Class_DeleteFunction *_delete, Stg_Class_PrintFunction *_print, Stg_Class_CopyFunction *_copy, Stg_Component_DefaultConstructorFunction *_defaultConstructor, Stg_Component_ConstructFunction *_construct, Stg_Component_BuildFunction *_build, Stg_Component_InitialiseFunction *_initialise, Stg_Component_ExecuteFunction *_execute, Stg_Component_DestroyFunction *_destroy, Name name, Bool initFlag, int numProcs, int rank, void *extension_Register, Dictionary *dictionary)
 Creation implementation / Virtual constructor.
void _SurfaceMesh_Init (SurfaceMesh *self)
 Initialise implementation.
void _SurfaceMesh_Delete (void *surfaceMesh)
 Stg_Class_Delete a SurfaceMesh construct.
void _SurfaceMesh_Print (void *surfaceMesh, Stream *stream)
 Print the contents of an SurfaceMesh construct.
void _SurfaceMesh_Construct (void *surfaceMesh, Stg_ComponentFactory *cf)
 Build implementation.
int heightCompareFunc (void *data1, void *data2)
int idCompareFunc (const void *data1, const void *data2)
void nodePrintFunction (void *id, Stream *stream)
void _SurfaceMesh_Build (void *surfaceMesh, void *data)
void SurfaceMesh_BuildRiverNetwork (SurfaceMesh *self)
void _SurfaceMesh_Initialise (void *surfaceMesh, void *data)
 Stg_Component_Initialise() implementation.
void _SurfaceMesh_Execute (void *surfaceMesh, void *data)
 Execution implementation.
void _SurfaceMesh_Destroy (void *surfaceMesh, void *data)
void _SurfaceMesh_FindNeighbours (SurfaceMesh *mesh)
void SurfaceMesh_AllocateMemoryForHaloNodes (SurfaceMesh *mesh)
void SurfaceMesh_ReleaseMemory (SurfaceMesh *mesh)
void _SurfaceMesh_DetermineFlows (SurfaceMesh *mesh, float *boundaryConditions)
 Determine the receiver and providers of each node.
void _SurfaceMesh_FindDonors (SurfaceMesh *mesh)
int getSize (SurfaceMesh *mesh, int nodeId)
void _SurfaceMesh_DetermineCatchmentSizes (SurfaceMesh *mesh)
void SurfaceMesh_UpdateFlows (SurfaceMesh *mesh)
void SurfaceMesh_OrderNodes (SurfaceMesh *mesh)
void SurfaceMesh_FindHaloNode (SurfaceMesh *mesh, int nodeId, int *processor, int *index)
void SurfaceMesh_BoundaryConditions (SurfaceMesh *surfaceMesh)

Variables

const Type SurfaceMesh_Type = "SurfaceMesh"
SurfaceMeshglobalMesh = NULL
SurfaceMeshlocalMesh = NULL


Function Documentation

void _SurfaceMesh_Build void *  surfaceMesh,
void *  data
 

Definition at line 294 of file SurfaceMesh.c.

References _SurfaceMesh_FindNeighbours(), MASTER_PROC, SurfaceMesh_BuildRiverNetwork(), and SurfaceMeshLoader_LoadMesh().

Referenced by SurfaceMesh_DefaultNew(), and SurfaceMesh_New().

void _SurfaceMesh_Construct void *  surfaceMesh,
Stg_ComponentFactory *  cf
 

Build implementation.

Definition at line 232 of file SurfaceMesh.c.

Referenced by SurfaceMesh_DefaultNew(), and SurfaceMesh_New().

void _SurfaceMesh_Delete void *  surfaceMesh  ) 
 

Stg_Class_Delete a SurfaceMesh construct.

Definition at line 193 of file SurfaceMesh.c.

References SurfaceMesh_ReleaseMemory().

Referenced by SurfaceMesh_DefaultNew(), and SurfaceMesh_New().

void _SurfaceMesh_Destroy void *  surfaceMesh,
void *  data
 

Definition at line 443 of file SurfaceMesh.c.

Referenced by SurfaceMesh_DefaultNew(), and SurfaceMesh_New().

void _SurfaceMesh_DetermineCatchmentSizes SurfaceMesh mesh  ) 
 

Definition at line 772 of file SurfaceMesh.c.

References getSize(), heightCompareFunc(), SurfaceMesh::id, nodePrintFunction(), SurfaceMesh::rank, and SurfaceMesh::size.

Referenced by SurfaceMesh_BuildRiverNetwork().

void _SurfaceMesh_DetermineFlows SurfaceMesh mesh,
float *  boundaryConditions
 

Determine the receiver and providers of each node.

Definition at line 646 of file SurfaceMesh.c.

References SurfaceMesh::h, heightCompareFunc(), SurfaceMesh::highestNeighbour, SurfaceMesh::id, SurfaceMesh::nodeNeighbours, nodePrintFunction(), SurfaceMesh::nodeProviders, SurfaceMesh::rank, SurfaceMesh::receiver, SurfaceMesh::size, SurfaceMesh::x, and SurfaceMesh::y.

Referenced by SurfaceMesh_BuildRiverNetwork().

void _SurfaceMesh_Execute void *  surfaceMesh,
void *  data
 

Execution implementation.

Definition at line 439 of file SurfaceMesh.c.

Referenced by SurfaceMesh_DefaultNew(), and SurfaceMesh_New().

void _SurfaceMesh_FindDonors SurfaceMesh mesh  ) 
 

Definition at line 715 of file SurfaceMesh.c.

References SurfaceMesh::h, SurfaceMesh::id, SurfaceMesh::length, SurfaceMesh::nLake, SurfaceMesh::rank, SurfaceMesh::receiver, SurfaceMesh::slope, SurfaceMesh::x, and SurfaceMesh::y.

Referenced by SurfaceMesh_BuildRiverNetwork().

void _SurfaceMesh_FindNeighbours SurfaceMesh mesh  ) 
 

Definition at line 449 of file SurfaceMesh.c.

References SurfaceMesh::elementGlobalCount, find_neighbours(), SurfaceMesh::maxNeighboursPerNode, SurfaceMesh::nodeNeighbours, SurfaceMesh::numNeigh, SurfaceMesh::numNodes, SurfaceMesh::sides, SurfaceMesh::surface, SurfaceMesh::surfScale, SurfaceMesh::vertices, SurfaceMesh::x, and SurfaceMesh::y.

Referenced by _SurfaceMesh_Build().

void _SurfaceMesh_Init SurfaceMesh self  ) 
 

Initialise implementation.

Definition at line 139 of file SurfaceMesh.c.

References SurfaceMesh::dictionary, MESH_TYPE_AUTOGENERATED, MESH_TYPE_FROM_ENVI_INPUT, MESH_TYPE_FROM_OUTPUT_FILES, MESH_TYPE_FROM_SPM_INPUT, MESH_TYPE_FROM_TEXT_INPUT, SurfaceMesh::surfaceMeshLoader, SurfaceMeshLoader_New(), and SurfaceMeshLoader_ScanMesh().

Referenced by _SurfaceMesh_New().

void _SurfaceMesh_Initialise void *  surfaceMesh,
void *  data
 

Stg_Component_Initialise() implementation.

Definition at line 342 of file SurfaceMesh.c.

References SurfaceMesh::arrayElements, SurfaceMesh::boundaryConditions, SurfaceMesh::foreignHaloNodes, SurfaceMesh::foreignProviderChanges, SurfaceMesh::h, SurfaceMesh::h0, SurfaceMesh::haloNodes, SurfaceMesh::hi, SurfaceMesh::highestNeighbour, SurfaceMesh::id, SurfaceMesh::length, SurfaceMesh::localProviderChanges, SurfaceMesh::mapGlobalToLocal, SurfaceMesh::maxNeighboursPerNode, SurfaceMesh::nCatch, SurfaceMesh::nLake, SurfaceMesh::nodeNeighbours, SurfaceMesh::nodeProviders, SurfaceMesh::nodeType, SurfaceMesh::numNeigh, SurfaceMesh::numNodes, SurfaceMesh::numProcs, SurfaceMesh::processor, providersCompareFunction(), providersDataCopyFunction(), providersDataPrintFunction(), providerSyncCompareFunction(), providerSyncDataCopyFunction(), providerSyncDataPrintFunction(), SurfaceMesh::receiver, SurfaceMesh::requestTable, SurfaceMesh::sides, SurfaceMesh::size, SurfaceMesh::slope, SurfaceMesh::sortedId, SurfaceMesh::statusTable, SurfaceMesh::surface, SurfaceMesh::vertices, SurfaceMesh::x, and SurfaceMesh::y.

Referenced by SurfaceMesh_DefaultNew(), and SurfaceMesh_New().

SurfaceMesh* _SurfaceMesh_New SizeT  _sizeOfSelf,
Type  type,
Stg_Class_DeleteFunction *  _delete,
Stg_Class_PrintFunction *  _print,
Stg_Class_CopyFunction *  _copy,
Stg_Component_DefaultConstructorFunction *  _defaultConstructor,
Stg_Component_ConstructFunction *  _construct,
Stg_Component_BuildFunction *  _build,
Stg_Component_InitialiseFunction *  _initialise,
Stg_Component_ExecuteFunction *  _execute,
Stg_Component_DestroyFunction *  _destroy,
Name  name,
Bool  initFlag,
int  numProcs,
int  rank,
void *  extension_Register,
Dictionary *  dictionary
 

Creation implementation / Virtual constructor.

Definition at line 96 of file SurfaceMesh.c.

References _SurfaceMesh_Init().

Referenced by SurfaceMesh_DefaultNew(), and SurfaceMesh_New().

void _SurfaceMesh_Print void *  surfaceMesh,
Stream *  stream
 

Print the contents of an SurfaceMesh construct.

Definition at line 203 of file SurfaceMesh.c.

Referenced by SurfaceMesh_DefaultNew(), and SurfaceMesh_New().

int getSize SurfaceMesh mesh,
int  nodeId
 

Definition at line 749 of file SurfaceMesh.c.

References getSize(), SurfaceMesh::h, and SurfaceMesh::nodeProviders.

Referenced by _SurfaceMesh_DetermineCatchmentSizes(), and getSize().

int heightCompareFunc void *  data1,
void *  data2
 

Definition at line 237 of file SurfaceMesh.c.

References SurfaceMesh::h.

Referenced by _SurfaceMesh_DetermineCatchmentSizes(), and _SurfaceMesh_DetermineFlows().

int idCompareFunc const void *  data1,
const void *  data2
 

Definition at line 259 of file SurfaceMesh.c.

References SurfaceMesh::h, and SurfaceMesh::mapGlobalToLocal.

Referenced by SurfaceMesh_OrderNodes().

void nodePrintFunction void *  id,
Stream *  stream
 

Definition at line 283 of file SurfaceMesh.c.

References SurfaceMesh::h.

Referenced by _SurfaceMesh_DetermineCatchmentSizes(), and _SurfaceMesh_DetermineFlows().

void SurfaceMesh_AllocateMemoryForHaloNodes SurfaceMesh mesh  ) 
 

Definition at line 520 of file SurfaceMesh.c.

References SurfaceMeshForeignHaloNodes::foreignHaloId, SurfaceMesh::foreignHaloNodes, SurfaceMeshHaloNodes::h, SurfaceMeshHaloNodes::haloId, SurfaceMesh::haloNodes, SurfaceMeshForeignHaloNodes::numForeignHaloNodes, SurfaceMeshHaloNodes::numHaloNodes, SurfaceMesh::numProcs, SurfaceMeshHaloNodes::receiver, SurfaceMeshHaloNodes::surface, SurfaceMeshHaloNodes::x, and SurfaceMeshHaloNodes::y.

Referenced by _SurfaceMeshDecomp_Execute().

void SurfaceMesh_BoundaryConditions SurfaceMesh surfaceMesh  ) 
 

Definition at line 1032 of file SurfaceMesh.c.

Referenced by _SPModel_Context_BoundaryConditions().

void SurfaceMesh_BuildRiverNetwork SurfaceMesh self  ) 
 

Definition at line 320 of file SurfaceMesh.c.

References _SurfaceMesh_DetermineCatchmentSizes(), _SurfaceMesh_DetermineFlows(), _SurfaceMesh_FindDonors(), SurfaceMesh::boundaryConditions, and SurfaceMesh::nodeProviders.

Referenced by _SPModel_Context_RedistributeNodes(), and _SurfaceMesh_Build().

SurfaceMesh* SurfaceMesh_DefaultNew Name  name  ) 
 

Create a new SurfaceMesh and initialise.

Definition at line 47 of file SurfaceMesh.c.

References _SurfaceMesh_Build(), _SurfaceMesh_Construct(), _SurfaceMesh_Delete(), _SurfaceMesh_Destroy(), _SurfaceMesh_Execute(), _SurfaceMesh_Initialise(), _SurfaceMesh_New(), _SurfaceMesh_Print(), SurfaceMesh_DefaultNew(), and SurfaceMesh_Type.

Referenced by SurfaceMesh_DefaultNew(), and SurfaceMesh_New().

void SurfaceMesh_FindHaloNode SurfaceMesh mesh,
int  nodeId,
int *  processor,
int *  index
 

Definition at line 1012 of file SurfaceMesh.c.

References SurfaceMeshHaloNodes::haloId, SurfaceMesh::haloNodes, SurfaceMeshHaloNodes::numHaloNodes, and SurfaceMesh::numProcs.

Referenced by fluvial(), and SurfaceMesh_UpdateFlows().

SurfaceMesh* SurfaceMesh_New Name  name,
int  numProcs,
int  rank,
void *  extension_Register,
Dictionary *  dictionary
 

Definition at line 69 of file SurfaceMesh.c.

References _SurfaceMesh_Build(), _SurfaceMesh_Construct(), _SurfaceMesh_Delete(), _SurfaceMesh_Destroy(), _SurfaceMesh_Execute(), _SurfaceMesh_Initialise(), _SurfaceMesh_New(), _SurfaceMesh_Print(), SurfaceMesh_DefaultNew(), and SurfaceMesh_Type.

Referenced by _SPModel_Context_Init().

void SurfaceMesh_OrderNodes SurfaceMesh mesh  ) 
 

Definition at line 1004 of file SurfaceMesh.c.

References idCompareFunc(), SurfaceMesh::myLoad, and SurfaceMesh::sortedId.

Referenced by _SPModel_Context_Solve(), and SurfaceMesh_UpdateFlows().

void SurfaceMesh_ReleaseMemory SurfaceMesh mesh  ) 
 

Definition at line 555 of file SurfaceMesh.c.

References SurfaceMesh::arrayElements, SurfaceMesh::boundaryConditions, SurfaceMeshForeignHaloNodes::foreignHaloId, SurfaceMesh::foreignHaloNodes, SurfaceMesh::foreignProviderChanges, SurfaceMesh::h, SurfaceMeshHaloNodes::h, SurfaceMesh::h0, SurfaceMeshHaloNodes::haloId, SurfaceMesh::haloNodes, SurfaceMesh::hi, SurfaceMesh::highestNeighbour, SurfaceMesh::id, SurfaceMesh::length, SurfaceMesh::localProviderChanges, SurfaceMesh::mapGlobalToLocal, SurfaceMesh::nCatch, SurfaceMesh::nLake, SurfaceMesh::nodeNeighbours, SurfaceMesh::nodeProviders, SurfaceMesh::nodeType, SurfaceMesh::numNeigh, SurfaceMesh::numProcs, SurfaceMesh::processor, SurfaceMesh::receiver, SurfaceMeshHaloNodes::receiver, SurfaceMesh::requestTable, SurfaceMesh::sides, SurfaceMesh::size, SurfaceMesh::slope, SurfaceMesh::sortedId, SurfaceMesh::statusTable, SurfaceMesh::surface, SurfaceMeshHaloNodes::surface, SurfaceMesh::vertices, SurfaceMesh::x, SurfaceMeshHaloNodes::x, SurfaceMesh::y, and SurfaceMeshHaloNodes::y.

Referenced by _SPModel_Context_RedistributeNodes(), and _SurfaceMesh_Delete().

void SurfaceMesh_UpdateFlows SurfaceMesh mesh  ) 
 

Definition at line 806 of file SurfaceMesh.c.

References SurfaceMesh::boundaryConditions, SurfaceMesh::foreignProviderChanges, SurfaceMeshHaloNodes::h, SurfaceMesh::h, SurfaceMesh::haloNodes, SurfaceMesh::highestNeighbour, SurfaceMesh::id, SurfaceMesh::length, SurfaceMesh::localProviderChanges, SurfaceMesh::mapGlobalToLocal, SurfaceMesh::myLoad, providerSyncStruct_t::nodeId, SurfaceMesh::nodeNeighbours, SurfaceMesh::nodeProviders, NonBlockingReceive_LinkedList(), NonBlockingSend_LinkedList(), SurfaceMesh::numNeigh, SurfaceMesh::numProcs, providerSyncStruct_t::provider, PROVIDERS_SYNC_TAG, SurfaceMesh::rank, SurfaceMesh::receiver, SurfaceMesh::requestTable, SurfaceMesh::slope, SurfaceMesh::statusTable, SurfaceMesh_FindHaloNode(), SurfaceMesh_OrderNodes(), SurfaceMeshHaloNodes::x, SurfaceMesh::x, SurfaceMeshHaloNodes::y, and SurfaceMesh::y.

Referenced by _SPModel_Context_Sync().


Variable Documentation

SurfaceMesh* globalMesh = NULL
 

Definition at line 44 of file SurfaceMesh.c.

Referenced by _Interpolator_Build(), _LinearInterpolator_Build(), _SPModel_Context_Gather(), _SurfaceMeshDecomp_Execute(), SPModelIsostaticFlexure_Solve(), SPModelSimulationContextExtension_Gather(), SPModelSimulationContextExtension_Scatter(), and windowEvents().

SurfaceMesh* localMesh = NULL
 

Definition at line 45 of file SurfaceMesh.c.

Referenced by _SPModel_Context_Gather(), _SurfaceMeshDecomp_Execute(), dumpNodes(), SPModelIsostaticFlexure_Solve(), SPModelSimulationContextExtension_Gather(), and SPModelSimulationContextExtension_Scatter().

const Type SurfaceMesh_Type = "SurfaceMesh"
 

Definition at line 43 of file SurfaceMesh.c.

Referenced by SurfaceMesh_DefaultNew(), and SurfaceMesh_New().