/[escript]/branches/arrayview_from_1695_trunk/finley/src/Mesh_distributeByRankOfDOF.c
ViewVC logotype

Diff of /branches/arrayview_from_1695_trunk/finley/src/Mesh_distributeByRankOfDOF.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1780 by jfenwick, Mon Aug 11 03:33:40 2008 UTC revision 1781 by jfenwick, Thu Sep 11 05:03:14 2008 UTC
# Line 26  Line 26 
26    
27  void Finley_Mesh_distributeByRankOfDOF(Finley_Mesh* self, index_t *dof_distribution) {  void Finley_Mesh_distributeByRankOfDOF(Finley_Mesh* self, index_t *dof_distribution) {
28    
29       index_t min_id, max_id, *tmp_node_localDOF_map=NULL, *tmp_node_localDOF_mask=NULL;       index_t min_dof_id, max_dof_id, *tmp_node_localDOF_map=NULL, *tmp_node_localDOF_mask=NULL;
30       Paso_MPI_rank* mpiRankOfDOF=NULL;       Paso_MPI_rank* mpiRankOfDOF=NULL;
31       register index_t k;       register index_t k;
32       dim_t len,n,numDOFs;       dim_t len,n,numDOFs;
# Line 35  void Finley_Mesh_distributeByRankOfDOF(F Line 35  void Finley_Mesh_distributeByRankOfDOF(F
35       mpiRankOfDOF=TMPMEMALLOC(self->Nodes->numNodes,Paso_MPI_rank);       mpiRankOfDOF=TMPMEMALLOC(self->Nodes->numNodes,Paso_MPI_rank);
36       if (!Finley_checkPtr(mpiRankOfDOF)) {       if (!Finley_checkPtr(mpiRankOfDOF)) {
37    
38    
39          Finley_NodeFile_assignMPIRankToDOFs(self->Nodes,mpiRankOfDOF,dof_distribution);          Finley_NodeFile_assignMPIRankToDOFs(self->Nodes,mpiRankOfDOF,dof_distribution);
40    
41          /* first the elements are redistributed according to mpiRankOfDOF */          /* first the elements are redistributed according to mpiRankOfDOF */
42          /* at the input the Node tables refering to a the local labeling of the nodes */          /* at the input the Node tables refering to a the local labeling of the nodes */
43          /* while at the output they refer to the global labeling which is rectified in the next step */          /* while at the output they refer to the global labeling which is rectified in the next step */
# Line 48  void Finley_Mesh_distributeByRankOfDOF(F Line 50  void Finley_Mesh_distributeByRankOfDOF(F
50          if (Finley_noError()) Finley_Mesh_resolveNodeIds(self);          if (Finley_noError()) Finley_Mesh_resolveNodeIds(self);
51        
52          /* create a local labeling of the DOFs */          /* create a local labeling of the DOFs */
53          Finley_NodeFile_setDOFRange(&min_id,&max_id,self->Nodes);          Finley_NodeFile_setDOFRange(&min_dof_id,&max_dof_id,self->Nodes);
54          len=max_id-min_id+1;          len=max_dof_id-min_dof_id+1;
55          tmp_node_localDOF_mask=TMPMEMALLOC(len,index_t); /* local mask for used nodes */          tmp_node_localDOF_mask=TMPMEMALLOC(len,index_t); /* local mask for used nodes */
56          tmp_node_localDOF_map=TMPMEMALLOC(self->Nodes->numNodes,index_t);          tmp_node_localDOF_map=TMPMEMALLOC(self->Nodes->numNodes,index_t);
57          if (! ( (Finley_checkPtr(tmp_node_localDOF_mask) && Finley_checkPtr(tmp_node_localDOF_map) ) ) ) {          if (! ( (Finley_checkPtr(tmp_node_localDOF_mask) && Finley_checkPtr(tmp_node_localDOF_map) ) ) ) {
58        
59            #pragma omp parallel for private(n) schedule(static)            #pragma omp parallel for private(n) schedule(static)
60            for (n=0;n<len;n++) tmp_node_localDOF_mask[n]=-1;            for (n=0;n<len;n++) tmp_node_localDOF_mask[n]=-1;
61    
62            #pragma omp parallel for private (n) schedule(static)            #pragma omp parallel for private (n) schedule(static)
63            for (n=0;n<self->Nodes->numNodes;n++) tmp_node_localDOF_map[n]=-1;            for (n=0;n<self->Nodes->numNodes;n++) tmp_node_localDOF_map[n]=-1;
64    
65            #pragma omp parallel for private(n) schedule(static)            #pragma omp parallel for private(n) schedule(static)
66            for (n=0;n<self->Nodes->numNodes;n++) {            for (n=0;n<self->Nodes->numNodes;n++) {
67  #ifdef BOUNDS_CHECK           #ifdef BOUNDS_CHECK
68               if ((self->Nodes->globalDegreesOfFreedom[n]-min_id) >= len || (self->Nodes->globalDegreesOfFreedom[n]-min_id) < 0) { printf("BOUNDS_CHECK %s %d\n", __FILE__, __LINE__); exit(1); }               if ((self->Nodes->globalDegreesOfFreedom[n]-min_dof_id) >= len || (self->Nodes->globalDegreesOfFreedom[n]-min_dof_id) < 0) { printf("BOUNDS_CHECK %s %d\n", __FILE__, __LINE__); exit(1); }
69  #endif           #endif
70           tmp_node_localDOF_mask[self->Nodes->globalDegreesOfFreedom[n]-min_id]=n;       tmp_node_localDOF_mask[self->Nodes->globalDegreesOfFreedom[n]-min_dof_id]=n;
71        }        }
72        
73            numDOFs=0;            numDOFs=0;
# Line 76  void Finley_Mesh_distributeByRankOfDOF(F Line 80  void Finley_Mesh_distributeByRankOfDOF(F
80            }            }
81            #pragma omp parallel for private (n,k)            #pragma omp parallel for private (n,k)
82            for  (n=0;n<self->Nodes->numNodes;n++) {            for  (n=0;n<self->Nodes->numNodes;n++) {
83                k=tmp_node_localDOF_mask[self->Nodes->globalDegreesOfFreedom[n]-min_id];                k=tmp_node_localDOF_mask[self->Nodes->globalDegreesOfFreedom[n]-min_dof_id];
84                tmp_node_localDOF_map[n]=k;                tmp_node_localDOF_map[n]=k;
85            }            }
86            /* create element coloring */            /* create element coloring */

Legend:
Removed from v.1780  
changed lines
  Added in v.1781

  ViewVC Help
Powered by ViewVC 1.1.26