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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 793 - (show annotations)
Sat Jul 29 19:40:22 2006 UTC (13 years, 3 months ago) by dhawcroft
File MIME type: text/plain
File size: 6058 byte(s)
Preliminary MPI version of saveVTK. Needs testers. Works for point data and should work for cell centered data.
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
9 #ifdef PASO_MPI
10
11 #include "./paso/CommBuffer.h"
12
13 #define NODE_INTERNAL 1
14 #define NODE_BOUNDARY 2
15 #define NODE_EXTERNAL 3
16
17 #define ELEMENT_INTERNAL 1
18 #define ELEMENT_BOUNDARY 2
19
20 /* DATA TYPES */
21
22 /****************************************************
23 describes the set of nodes shared between two
24 neighbouring domains. Each of the domains has
25 a local copy that show where to map information
26 received from/sent to the other neighbour
27 ****************************************************/
28 struct Finley_NodeGhostEdge
29 {
30 dim_t reference_counter;
31 index_t numForward; /* number of local nodes referenced by neighbour */
32 index_t numBackward; /* number of neighbours nodes referenced by this process */
33 /* local indices of the forward and backward referenced nodes */
34 index_t *indexForward;
35 index_t *indexBackward;
36 };
37
38 typedef struct Finley_NodeGhostEdge Finley_NodeGhostEdge;
39
40 /****************************************************
41 describes the distribution of the nodes/DOF stored
42 on the local process, along with their connections
43 with nodes/DOF in neighbouring domains.
44 ****************************************************/
45 struct Finley_NodeDistribution
46 {
47 dim_t reference_counter;
48 Paso_MPIInfo *MPIInfo;
49 index_t numLocal; /* total number of nodes on local domain
50 numLocal = numBoundary + numInternal */
51 index_t numInternal; /* number of local nodes that are internal,
52 that is, not dependent on nodes in other domains*/
53 index_t numBoundary; /* number of local nodes that are dependant on nodes
54 in other domains */
55 index_t numExternal; /* number of nodes belonging to other subdomains that
56 share elements with local boundary nodes */
57 index_t *indexExternal; /* global indices of the external nodes stored on this Pid */
58 index_t *vtxdist; /* process i has nodes with global indices
59 vtxdist[i] to vtxdist[i]-1. */
60 index_t numGlobal; /* total number of nodes in the global domain */
61 index_t numNeighbours; /* number of neighbour domains */
62 index_t *neighbours; /* list of ranks of neighbours */
63 Finley_NodeGhostEdge **edges; /* ghost edges shared with each neighbour */
64 };
65
66 typedef struct Finley_NodeDistribution Finley_NodeDistribution;
67
68 /* not used at the moment, but could be used in the future for more efficient
69 calculation of integrals etc on boundary elements... */
70 struct Finley_ElementGhostEdge
71 {
72 dim_t reference_counter;
73 index_t numShared; /* number of elements shared with neighbour */
74 index_t *shared; /* local indices of the elements shared with the neighbour */
75 index_t *pointers; /* Yale-style description of dependancies on neighbour elements */
76 index_t *index;
77 };
78
79 typedef struct Finley_ElementGhostEdge Finley_ElementGhostEdge;
80
81 struct Finley_ElementDistribution
82 {
83 dim_t reference_counter;
84 Paso_MPIInfo *MPIInfo;
85 index_t numLocal; /* total number of elements on local domain
86 numLocal = numBoundary + numInternal */
87 index_t numInternal; /* number of local elements that are internal,
88 that is, not dependent on elements in other domains*/
89 index_t numBoundary; /* number of local elements that are dependant on elements
90 in other domains */
91 dim_t *vtxdist; /* process i has elements with Id's between vtxdist[i] up to vtxdist[i+1]-1 inclusive */
92 /* there will be further stuff here, as the need for it in domain decomposition arises */
93 /* ... */
94 };
95
96 typedef struct Finley_ElementDistribution Finley_ElementDistribution;
97
98 /***************************************
99 Function prototypes
100 ***************************************/
101
102 /* Finley_NodeDistribution */
103 Finley_NodeDistribution* Finley_NodeDistribution_alloc( Paso_MPIInfo *MPIInfo );
104 void Finley_NodeDistribution_dealloc( Finley_NodeDistribution *in );
105 Finley_NodeDistribution* Finley_NodeDistribution_getReference( Finley_NodeDistribution *in );
106 void Finley_NodeDistribution_allocTable( Finley_NodeDistribution *in, dim_t numLocal, dim_t numExternal, dim_t numNeighbours );
107 void Finley_NodeDistribution_deallocTable( Finley_NodeDistribution *in );
108 void Finley_NodeDistribution_addForward( Finley_NodeDistribution *in, index_t domain, dim_t numForward, index_t* indexLocal );
109 void Finley_NodeDistribution_addBackward( Finley_NodeDistribution *in, index_t domain, dim_t numBackward, index_t* indexLocal );
110 void Finley_NodeDistribution_calculateIndexExternal( Finley_NodeDistribution *Distribution, Paso_CommBuffer *CommBuffer );
111 void Finley_NodeDistribution_formCommBuffer( Finley_NodeDistribution *in, Paso_CommBuffer *CommBuffer );
112 void Finley_NodeDistribution_print( Finley_NodeDistribution *in, FILE *fid );
113
114 /* Finley_NodeGhostEdge */
115 Finley_NodeGhostEdge* Finley_NodeGhostEdge_alloc( void );
116 void Finley_NodeGhostEdge_dealloc( Finley_NodeGhostEdge *in );
117 Finley_NodeGhostEdge* Finley_NodeGhostEdge_getReference( Finley_NodeGhostEdge *in );
118 void Finley_NodeGhostEdge_allocTable( Finley_NodeGhostEdge *in, dim_t numForward, dim_t numBackward );
119 void Finley_NodeGhostEdge_deallocTable( Finley_NodeGhostEdge *in );
120
121 /* Finley_ElementDistribution */
122 Finley_ElementDistribution* Finley_ElementDistribution_alloc( Paso_MPIInfo *MPIInfo );
123 void Finley_ElementDistribution_dealloc( Finley_ElementDistribution* in );
124 Finley_ElementDistribution* Finley_ElementDistribution_getReference( Finley_ElementDistribution* in );
125 void Finley_ElementDistribution_allocTable( Finley_ElementDistribution *in, dim_t numElements, dim_t numElementsThis );
126
127 #endif
128 #endif

  ViewVC Help
Powered by ViewVC 1.1.26