/[escript]/trunk/finley/src/Distribution.h
ViewVC logotype

Contents of /trunk/finley/src/Distribution.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 751 - (show annotations)
Mon Jun 26 01:46:34 2006 UTC (12 years, 10 months ago) by bcumming
File MIME type: text/plain
File size: 5682 byte(s)
Changes relating to the MPI version of escript
The standard OpenMP version of escript is unchanged

- updated data types (Finley_Mesh, Finley_NodeFile, etc) to store meshes
  over multiple MPI processes.
- added CommBuffer code in Paso for communication of Data associated
  with distributed meshes
- updates in Finley and Escript to support distributed data and operations
  on distributed data (such as interpolation).
- construction of RHS in MPI, so that simple explicit schemes (such as
  /docs/examples/wave.py without IO and the Locator) can run in MPI.
- updated mesh generation for first order line, rectangle and brick
  meshes and second order line meshes in MPI.        
- small changes to trunk/SConstruct and trunk/scons/ess_options.py to
  build the MPI version, these changes are turned off by default.

1 /* created by Ben Cumming on 26/04/2006 */
2
3 #ifndef INC_DISTRIBUTION
4 #define INC_DISTRIBUTION
5
6
7 #include "Finley.h"
8 #include "./paso/CommBuffer.h"
9
10 #ifdef PASO_MPI
11
12 /* DATA TYPES */
13
14 /****************************************************
15 describes the set of nodes shared between two
16 neighbouring domains. Each of the domains has
17 a local copy that show where to map information
18 received from/sent to the other neighbour
19 ****************************************************/
20 struct Finley_NodeGhostEdge
21 {
22 dim_t reference_counter;
23 index_t numForward; /* number of local nodes referenced by neighbour */
24 index_t numBackward; /* number of neighbours nodes referenced by this process */
25 /* local indices of the forward and backward referenced nodes */
26 index_t *indexForward;
27 index_t *indexBackward;
28 };
29
30 typedef struct Finley_NodeGhostEdge Finley_NodeGhostEdge;
31
32 /****************************************************
33 describes the distribution of the nodes/DOF stored
34 on the local process, along with their connections
35 with nodes/DOF in neighbouring domains.
36 ****************************************************/
37 struct Finley_NodeDistribution
38 {
39 dim_t reference_counter;
40 Paso_MPIInfo *MPIInfo;
41 index_t numLocal; /* total number of nodes on local domain
42 numLocal = numBoundary + numInternal */
43 index_t numInternal; /* number of local nodes that are internal,
44 that is, not dependent on nodes in other domains*/
45 index_t numBoundary; /* number of local nodes that are dependant on nodes
46 in other domains */
47 index_t numExternal; /* number of nodes belonging to other subdomains that
48 share elements with local boundary nodes */
49 index_t *indexExternal; /* global indices of the external nodes stored on this Pid */
50 index_t *vtxdist; /* process i has nodes with global indices
51 vtxdist[i] to vtxdist[i]-1. */
52 index_t numGlobal; /* total number of nodes in the global domain */
53 index_t numNeighbours; /* number of neighbour domains */
54 index_t *neighbours; /* list of ranks of neighbours */
55 Finley_NodeGhostEdge **edges; /* ghost edges shared with each neighbour */
56 };
57
58 typedef struct Finley_NodeDistribution Finley_NodeDistribution;
59
60 /* not used at the moment, but could be used in the future for more efficient
61 calculation of integrals etc on boundary elements... */
62 struct Finley_ElementGhostEdge
63 {
64 dim_t reference_counter;
65 index_t numShared; /* number of elements shared with neighbour */
66 index_t *shared; /* local indices of the elements shared with the neighbour */
67 index_t *pointers; /* Yale-style description of dependancies on neighbour elements */
68 index_t *index;
69 };
70
71 typedef struct Finley_ElementGhostEdge Finley_ElementGhostEdge;
72
73 struct Finley_ElementDistribution
74 {
75 dim_t reference_counter;
76 Paso_MPIInfo *MPIInfo;
77 index_t numLocal; /* total number of elements on local domain
78 numLocal = numBoundary + numInternal */
79 index_t numInternal; /* number of local elements that are internal,
80 that is, not dependent on elements in other domains*/
81 index_t numBoundary; /* number of local elements that are dependant on elements
82 in other domains */
83 /* there will be further stuff here, as the need for it in domain decomposition arises */
84 /* ... */
85 };
86
87 typedef struct Finley_ElementDistribution Finley_ElementDistribution;
88
89 /***************************************
90 Function prototypes
91 ***************************************/
92
93 /* Finley_NodeDistribution */
94 Finley_NodeDistribution* Finley_NodeDistribution_alloc( Paso_MPIInfo *MPIInfo );
95 void Finley_NodeDistribution_dealloc( Finley_NodeDistribution *in );
96 Finley_NodeDistribution* Finley_NodeDistribution_getReference( Finley_NodeDistribution *in );
97 void Finley_NodeDistribution_allocTable( Finley_NodeDistribution *in, dim_t numLocal, dim_t numExternal, dim_t numNeighbours );
98 void Finley_NodeDistribution_deallocTable( Finley_NodeDistribution *in );
99 void Finley_NodeDistribution_addForward( Finley_NodeDistribution *in, index_t domain, dim_t numForward, index_t* indexLocal );
100 void Finley_NodeDistribution_addBackward( Finley_NodeDistribution *in, index_t domain, dim_t numBackward, index_t* indexLocal );
101 void Finley_NodeDistribution_calculateIndexExternal( Finley_NodeDistribution *Distribution, Paso_CommBuffer *CommBuffer );
102 void Finley_NodeDistribution_formCommBuffer( Finley_NodeDistribution *in, Paso_CommBuffer *CommBuffer );
103 void Finley_NodeDistribution_print( Finley_NodeDistribution *in, FILE *fid );
104
105 /* Finley_NodeGhostEdge */
106 Finley_NodeGhostEdge* Finley_NodeGhostEdge_alloc( void );
107 void Finley_NodeGhostEdge_dealloc( Finley_NodeGhostEdge *in );
108 Finley_NodeGhostEdge* Finley_NodeGhostEdge_getReference( Finley_NodeGhostEdge *in );
109 void Finley_NodeGhostEdge_allocTable( Finley_NodeGhostEdge *in, dim_t numForward, dim_t numBackward );
110 void Finley_NodeGhostEdge_deallocTable( Finley_NodeGhostEdge *in );
111
112 /* Finley_ElementDistribution */
113 Finley_ElementDistribution* Finley_ElementDistribution_alloc( Paso_MPIInfo *MPIInfo );
114 void Finley_ElementDistribution_dealloc( Finley_ElementDistribution* in );
115 Finley_ElementDistribution* Finley_ElementDistribution_getReference( Finley_ElementDistribution* in );
116
117 #endif
118 #endif

  ViewVC Help
Powered by ViewVC 1.1.26