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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 782 - (hide annotations)
Tue Jul 18 00:47:47 2006 UTC (14 years, 10 months ago) by bcumming
File MIME type: text/plain
File size: 5811 byte(s)
Large number of changes to Finley for meshing in MPI.

- optimisation and neatening up of rectcanglular mesh generation code
- first and second order 1D, 2D and 3D rectangular meshes are now
  available in finley and escript using MPI.
- reduced meshes now generated in MPI, and interpolation to and from 
  reduced data types now supported.  

1 bcumming 731 /* 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 bcumming 782 #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 bcumming 731 /* 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 bcumming 751 index_t *vtxdist; /* process i has nodes with global indices
59 bcumming 731 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     /* there will be further stuff here, as the need for it in domain decomposition arises */
92     /* ... */
93     };
94    
95     typedef struct Finley_ElementDistribution Finley_ElementDistribution;
96    
97     /***************************************
98     Function prototypes
99     ***************************************/
100    
101     /* Finley_NodeDistribution */
102     Finley_NodeDistribution* Finley_NodeDistribution_alloc( Paso_MPIInfo *MPIInfo );
103     void Finley_NodeDistribution_dealloc( Finley_NodeDistribution *in );
104     Finley_NodeDistribution* Finley_NodeDistribution_getReference( Finley_NodeDistribution *in );
105 bcumming 751 void Finley_NodeDistribution_allocTable( Finley_NodeDistribution *in, dim_t numLocal, dim_t numExternal, dim_t numNeighbours );
106 bcumming 731 void Finley_NodeDistribution_deallocTable( Finley_NodeDistribution *in );
107     void Finley_NodeDistribution_addForward( Finley_NodeDistribution *in, index_t domain, dim_t numForward, index_t* indexLocal );
108     void Finley_NodeDistribution_addBackward( Finley_NodeDistribution *in, index_t domain, dim_t numBackward, index_t* indexLocal );
109 bcumming 751 void Finley_NodeDistribution_calculateIndexExternal( Finley_NodeDistribution *Distribution, Paso_CommBuffer *CommBuffer );
110     void Finley_NodeDistribution_formCommBuffer( Finley_NodeDistribution *in, Paso_CommBuffer *CommBuffer );
111     void Finley_NodeDistribution_print( Finley_NodeDistribution *in, FILE *fid );
112 bcumming 731
113     /* Finley_NodeGhostEdge */
114     Finley_NodeGhostEdge* Finley_NodeGhostEdge_alloc( void );
115     void Finley_NodeGhostEdge_dealloc( Finley_NodeGhostEdge *in );
116     Finley_NodeGhostEdge* Finley_NodeGhostEdge_getReference( Finley_NodeGhostEdge *in );
117     void Finley_NodeGhostEdge_allocTable( Finley_NodeGhostEdge *in, dim_t numForward, dim_t numBackward );
118     void Finley_NodeGhostEdge_deallocTable( Finley_NodeGhostEdge *in );
119    
120     /* Finley_ElementDistribution */
121     Finley_ElementDistribution* Finley_ElementDistribution_alloc( Paso_MPIInfo *MPIInfo );
122     void Finley_ElementDistribution_dealloc( Finley_ElementDistribution* in );
123     Finley_ElementDistribution* Finley_ElementDistribution_getReference( Finley_ElementDistribution* in );
124    
125     #endif
126     #endif

  ViewVC Help
Powered by ViewVC 1.1.26