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

Diff of /branches/arrayview_from_1695_trunk/finley/src/Mesh_createNodeFileMappings.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 1  Line 1 
1    
2  /* $Id$ */  /* $Id:$ */
3    
4  /*******************************************************  /*******************************************************
5   *   *
# Line 27  Line 27 
27    
28  void Mesh_createDOFMappingAndCoupling(Finley_Mesh* in, bool_t use_reduced_elements)  void Mesh_createDOFMappingAndCoupling(Finley_Mesh* in, bool_t use_reduced_elements)
29  {  {
30    index_t min_DOF, max_DOF, *shared=NULL, *offsetInShared=NULL, *locDOFMask=NULL, i, k, myFirstDOF, myLastDOF, *nodeMask=NULL, firstDOF, lastDOF, *globalDOFIndex;    index_t min_DOF, max_DOF, *shared=NULL, *offsetInShared=NULL, *locDOFMask=NULL, i, k, myFirstDOF, myLastDOF, *nodeMask=NULL, firstDOF, lastDOF, *globalDOFIndex, *wanted_DOFs=NULL;
31    dim_t mpiSize, len_loc_dof, numNeighbors, n, lastn, numNodes;    dim_t mpiSize, len_loc_dof, numNeighbors, n, lastn, numNodes,*rcv_len=NULL, *snd_len=NULL, count;
32    Paso_MPI_rank myRank,p,p_min,p_max, *neighbor=NULL;    Paso_MPI_rank myRank,p,p_min,p_max, *neighbor=NULL;
33    Paso_SharedComponents *rcv_shcomp=NULL, *snd_shcomp=NULL;    Paso_SharedComponents *rcv_shcomp=NULL, *snd_shcomp=NULL;
34    Finley_NodeMapping *this_mapping=NULL;    Finley_NodeMapping *this_mapping=NULL;
35    Paso_Connector* this_connector=NULL;    Paso_Connector* this_connector=NULL;
36    Paso_Distribution* dof_distribution;    Paso_Distribution* dof_distribution;
37        Paso_MPIInfo *mpi_info = in->MPIInfo;
38      #ifdef PASO_MPI
39          MPI_Request* mpi_requests=NULL;
40          MPI_Status* mpi_stati=NULL;
41      #else
42          int *mpi_requests=NULL, *mpi_stati=NULL;
43      #endif
44    
45    numNodes=in->Nodes->numNodes;    numNodes=in->Nodes->numNodes;
46    if (use_reduced_elements) {    if (use_reduced_elements) {
47      dof_distribution=in->Nodes->reducedDegreesOfFreedomDistribution;      dof_distribution=in->Nodes->reducedDegreesOfFreedomDistribution;
48      globalDOFIndex=in->Nodes->globalReducedDOFIndex;      globalDOFIndex=in->Nodes->globalReducedDOFIndex;
     Finley_NodeFile_setReducedDOFRange(&min_DOF, &max_DOF,in->Nodes);  
49    } else {    } else {
50      dof_distribution=in->Nodes->degreesOfFreedomDistribution;      dof_distribution=in->Nodes->degreesOfFreedomDistribution;
51      globalDOFIndex=in->Nodes->globalDegreesOfFreedom;      globalDOFIndex=in->Nodes->globalDegreesOfFreedom;
     Finley_NodeFile_setDOFRange(&min_DOF, &max_DOF,in->Nodes);  
52    }    }
53      myFirstDOF=Paso_Distribution_getFirstComponent(dof_distribution);
54      myLastDOF=Paso_Distribution_getLastComponent(dof_distribution);
55    
56    mpiSize=dof_distribution->mpi_info->size;  
57    myRank=dof_distribution->mpi_info->rank;    mpiSize=mpi_info->size;
58      myRank=mpi_info->rank;
59    
60    min_DOF=Finley_Util_getFlaggedMinInt(1,numNodes,globalDOFIndex,-1);    min_DOF=Finley_Util_getFlaggedMinInt(1,numNodes,globalDOFIndex,-1);
61    max_DOF=Finley_Util_getFlaggedMaxInt(1,numNodes,globalDOFIndex,-1);    max_DOF=Finley_Util_getFlaggedMaxInt(1,numNodes,globalDOFIndex,-1);
62    
63      if (max_DOF < min_DOF) {
64          min_DOF=myFirstDOF;
65          max_DOF=myLastDOF-1;
66      }
67    
68    p_min=mpiSize;    p_min=mpiSize;
69    p_max=-1;    p_max=-1;
70      if (max_DOF >= min_DOF) {
71    for (p=0; p<mpiSize; ++p) {        for (p=0; p<mpiSize; ++p) {
72        if (dof_distribution->first_component[p]<=min_DOF) p_min=p;           if (dof_distribution->first_component[p]<=min_DOF) p_min=p;
73        if (dof_distribution->first_component[p]<=max_DOF) p_max=p;           if (dof_distribution->first_component[p]<=max_DOF) p_max=p;
74    }       }
75       }
76    
77    len_loc_dof=max_DOF-min_DOF+1;    len_loc_dof=max_DOF-min_DOF+1;
   myFirstDOF=Paso_Distribution_getFirstComponent(dof_distribution);  
   myLastDOF=Paso_Distribution_getLastComponent(dof_distribution);  
78    if (! ((min_DOF<=myFirstDOF) && (myLastDOF-1<=max_DOF)) ) {    if (! ((min_DOF<=myFirstDOF) && (myLastDOF-1<=max_DOF)) ) {
79        Finley_setError(SYSTEM_ERROR,"Local elements do not span local degrees of freedom.");        Finley_setError(SYSTEM_ERROR,"Local elements do not span local degrees of freedom.");
80        return;        return;
81    }    }
82      rcv_len=TMPMEMALLOC(mpiSize,dim_t);
83      snd_len=TMPMEMALLOC(mpiSize,dim_t);
84      #ifdef PASO_MPI
85        mpi_requests=MEMALLOC(mpiSize*2,MPI_Request);
86        mpi_stati=MEMALLOC(mpiSize*2,MPI_Status);
87      #else
88        mpi_requests=MEMALLOC(mpiSize*2,int);
89        mpi_stati=MEMALLOC(mpiSize*2,int);
90      #endif
91      wanted_DOFs=TMPMEMALLOC(numNodes,index_t);
92    nodeMask=TMPMEMALLOC(numNodes,index_t);    nodeMask=TMPMEMALLOC(numNodes,index_t);
93    neighbor=TMPMEMALLOC(mpiSize,Paso_MPI_rank);    neighbor=TMPMEMALLOC(mpiSize,Paso_MPI_rank);
94    shared=TMPMEMALLOC(numNodes*(p_max-p_min+1),index_t);    shared=TMPMEMALLOC(numNodes*(p_max-p_min+1),index_t);
95    offsetInShared=TMPMEMALLOC(mpiSize+1,index_t);    offsetInShared=TMPMEMALLOC(mpiSize+1,index_t);
96    locDOFMask=TMPMEMALLOC(len_loc_dof, index_t);    locDOFMask=TMPMEMALLOC(len_loc_dof, index_t);
97    if (! ( Finley_checkPtr(neighbor) || Finley_checkPtr(shared) || Finley_checkPtr(offsetInShared) || Finley_checkPtr(locDOFMask) || Finley_checkPtr(nodeMask) ))  {    if (! ( Finley_checkPtr(neighbor) || Finley_checkPtr(shared) || Finley_checkPtr(offsetInShared) || Finley_checkPtr(locDOFMask) ||
98         Finley_checkPtr(nodeMask) || Finley_checkPtr(rcv_len) || Finley_checkPtr(snd_len) || Finley_checkPtr(mpi_requests) || Finley_checkPtr(mpi_stati) ||
99         Finley_checkPtr(mpi_stati) )) {
100      #pragma omp parallel for private(i) schedule(static)  
101      for (i=0;i<len_loc_dof;++i) locDOFMask[i]=UNUSED;      memset(rcv_len,0,sizeof(dim_t)*mpiSize);
102      #pragma omp parallel for private(i) schedule(static)      #pragma omp parallel
103      for (i=0;i<numNodes;++i) nodeMask[i]=UNUSED;      {
104            #pragma omp for private(i) schedule(static)
105      for (i=0;i<numNodes;++i) {          for (i=0;i<len_loc_dof;++i) locDOFMask[i]=UNUSED;
106         k=globalDOFIndex[i];          #pragma omp for private(i) schedule(static)
107  #ifdef BOUNDS_CHECK          for (i=0;i<numNodes;++i) nodeMask[i]=UNUSED;
108         if ((k-min_DOF) >= len_loc_dof) { printf("BOUNDS_CHECK %s %d i=%d k=%d min_DOF=%d\n", __FILE__, __LINE__, i, k, min_DOF); exit(1); }          #pragma omp for private(i,k) schedule(static)
109  #endif          for (i=0;i<numNodes;++i) {
110         if (k>-1) locDOFMask[k-min_DOF]=UNUSED-1;             k=globalDOFIndex[i];
111      }             if (k>-1) {
112                  locDOFMask[k-min_DOF]=UNUSED-1;
113                  #ifdef BOUNDS_CHECK
114                  if ((k-min_DOF) >= len_loc_dof) { printf("BOUNDS_CHECK %s %d i=%d k=%d min_DOF=%d\n", __FILE__, __LINE__, i, k, min_DOF); exit(1); }
115                  #endif
116               }
117            }
118    
119      for (i=myFirstDOF-min_DOF;i<myLastDOF-min_DOF;++i) {          #pragma omp for private(i) schedule(static)
120        locDOFMask[i]=i-myFirstDOF+min_DOF;          for (i=myFirstDOF-min_DOF;i<myLastDOF-min_DOF;++i) {
121  #ifdef BOUNDS_CHECK            locDOFMask[i]=i-myFirstDOF+min_DOF;
122        if (i < 0 || i >= len_loc_dof) { printf("BOUNDS_CHECK %s %d i=%d\n", __FILE__, __LINE__, i); exit(1); }            #ifdef BOUNDS_CHECK
123  #endif            if (i < 0 || i >= len_loc_dof) { printf("BOUNDS_CHECK %s %d i=%d\n", __FILE__, __LINE__, i); exit(1); }
124              #endif
125            }
126      }      }
127    
128      numNeighbors=0;      numNeighbors=0;
# Line 104  void Mesh_createDOFMappingAndCoupling(Fi Line 133  void Mesh_createDOFMappingAndCoupling(Fi
133         lastDOF=MIN(max_DOF+1,dof_distribution->first_component[p+1]);         lastDOF=MIN(max_DOF+1,dof_distribution->first_component[p+1]);
134         if (p != myRank) {         if (p != myRank) {
135             for (i=firstDOF-min_DOF;i<lastDOF-min_DOF;++i) {             for (i=firstDOF-min_DOF;i<lastDOF-min_DOF;++i) {
136  #ifdef BOUNDS_CHECK                  #ifdef BOUNDS_CHECK
137                     if (i < 0 || i >= len_loc_dof) { printf("BOUNDS_CHECK %s %d p=%d i=%d\n", __FILE__, __LINE__, p, i); exit(1); }                  if (i < 0 || i >= len_loc_dof) { printf("BOUNDS_CHECK %s %d p=%d i=%d\n", __FILE__, __LINE__, p, i); exit(1); }
138  #endif                  #endif
139                  if (locDOFMask[i] == UNUSED-1) {                  if (locDOFMask[i] == UNUSED-1) {
140                     locDOFMask[i]=myLastDOF-myFirstDOF+n;                     locDOFMask[i]=myLastDOF-myFirstDOF+n;
141                       wanted_DOFs[n]=i+min_DOF;
142                     ++n;                     ++n;
143                  }                  }
144             }             }
145             if (n>lastn) {             if (n>lastn) {
146                  rcv_len[p]=n-lastn;
147                neighbor[numNeighbors]=p;                neighbor[numNeighbors]=p;
148  #ifdef BOUNDS_CHECK                #ifdef BOUNDS_CHECK
149                if (numNeighbors < 0 || numNeighbors >= mpiSize+1) { printf("BOUNDS_CHECK %s %d p=%d numNeighbors=%d n=%d\n", __FILE__, __LINE__, p, numNeighbors, n); exit(1); }                if (numNeighbors < 0 || numNeighbors >= mpiSize+1) { printf("BOUNDS_CHECK %s %d p=%d numNeighbors=%d n=%d\n", __FILE__, __LINE__, p, numNeighbors, n); exit(1); }
150  #endif                #endif
151                offsetInShared[numNeighbors]=lastn;                offsetInShared[numNeighbors]=lastn;
152                numNeighbors++;                numNeighbors++;
153                lastn=n;                lastn=n;
# Line 138  void Mesh_createDOFMappingAndCoupling(Fi Line 169  void Mesh_createDOFMappingAndCoupling(Fi
169      /* now we can set the mapping from nodes to local DOFs */      /* now we can set the mapping from nodes to local DOFs */
170      this_mapping=Finley_NodeMapping_alloc(numNodes,nodeMask,UNUSED);      this_mapping=Finley_NodeMapping_alloc(numNodes,nodeMask,UNUSED);
171      /* define how to get DOF values for controlled bu other processors */      /* define how to get DOF values for controlled bu other processors */
172  #ifdef BOUNDS_CHECK      #ifdef BOUNDS_CHECK
173      for (i=0;i<offsetInShared[numNeighbors];++i) {      for (i=0;i<offsetInShared[numNeighbors];++i) {
174        if (i < 0 || i >= numNodes*(p_max-p_min+1)) { printf("BOUNDS_CHECK %s %d i=%d\n", __FILE__, __LINE__, i); exit(1); }        if (i < 0 || i >= numNodes*(p_max-p_min+1)) { printf("BOUNDS_CHECK %s %d i=%d\n", __FILE__, __LINE__, i); exit(1); }
175      }      }
176  #endif      #endif
177      #pragma omp parallel for private(i) schedule(static)      #pragma omp parallel for private(i) schedule(static)
178      for (i=0;i<offsetInShared[numNeighbors];++i) shared[i]=myLastDOF-myFirstDOF+i;      for (i=0;i<offsetInShared[numNeighbors];++i) shared[i]=myLastDOF-myFirstDOF+i;
179    
180      rcv_shcomp=Paso_SharedComponents_alloc(myLastDOF-myFirstDOF,numNeighbors,neighbor,shared,offsetInShared,1,0,dof_distribution->mpi_info);      rcv_shcomp=Paso_SharedComponents_alloc(myLastDOF-myFirstDOF,numNeighbors,neighbor,shared,offsetInShared,1,0,mpi_info);
181    
182      /* now it is determined which DOFs needs to be send off:*/      /*
183      #pragma omp parallel for private(i) schedule(static)       *    now we build the sender
184      for (i=0;i<len_loc_dof;++i) locDOFMask[i]=UNUSED;       */
185        #ifdef PASO_MPI
186             MPI_Alltoall(rcv_len,1,MPI_INT,snd_len,1,MPI_INT,mpi_info->comm);
187        #else
188            for (p=0;p<mpiSize;++p) snd_len[p]=rcv_len[p];
189        #endif
190        count=0;
191        for (p=0;p<rcv_shcomp->numNeighbors;p++) {
192           #ifdef PASO_MPI
193           MPI_Isend(&(wanted_DOFs[rcv_shcomp->offsetInShared[p]]), rcv_shcomp->offsetInShared[p+1]-rcv_shcomp->offsetInShared[p],
194                      MPI_INT,rcv_shcomp->neighbor[p],mpi_info->msg_tag_counter+myRank,mpi_info->comm,&mpi_requests[count]);
195            #endif
196            count++;
197        }
198      n=0;      n=0;
199      numNeighbors=0;      numNeighbors=0;
200      lastn=n;      for (p=0;p<mpiSize;p++) {
201      for (p=p_min;p<=p_max;++p) {           if (snd_len[p] > 0) {
202         firstDOF=dof_distribution->first_component[p];              #ifdef PASO_MPI
203         lastDOF=dof_distribution->first_component[p+1];              MPI_Irecv(&(shared[n]),snd_len[p],
204         if (p != myRank) {                        MPI_INT, p, mpi_info->msg_tag_counter+p, mpi_info->comm, &mpi_requests[count]);
205             /* mark a DOF by p if it will be requested by processor p */              #endif
206             Finley_Mesh_markDOFsConnectedToRange(locDOFMask,min_DOF,p,firstDOF,lastDOF,in,use_reduced_elements);              count++;
207                neighbor[numNeighbors]=p;
208             for (i=myFirstDOF-min_DOF;i<myLastDOF-min_DOF;++i) {              offsetInShared[numNeighbors]=n;
209                  if (locDOFMask[i] == p) {              numNeighbors++;
210  #ifdef BOUNDS_CHECK              n+=snd_len[p];
211             if (n < 0 || n >= numNodes*(p_max-p_min+1)) { printf("BOUNDS_CHECK %s %d p=%d i=%d n=%d\n", __FILE__, __LINE__, p, i, n); exit(1); }           }
 #endif  
                    shared[n]=i-myFirstDOF+min_DOF;  
                    ++n;  
                 }  
            }  
            if (n>lastn) {  
               neighbor[numNeighbors]=p;  
 #ifdef BOUNDS_CHECK  
               if (numNeighbors < 0 || numNeighbors >= mpiSize+1) { printf("BOUNDS_CHECK %s %d p=%d n=%d numNeighbors=%d\n", __FILE__, __LINE__, p, n, numNeighbors); exit(1); }  
 #endif  
               offsetInShared[numNeighbors]=lastn;  
               numNeighbors++;  
               lastn=n;  
            }  
         }  
212      }      }
213  #ifdef BOUNDS_CHECK      mpi_info->msg_tag_counter+=mpi_info->size;
214      if (numNeighbors < 0 || numNeighbors >= mpiSize+1) { printf("BOUNDS_CHECK %s %d numNeighbors=%d\n", __FILE__, __LINE__, numNeighbors); exit(1); }      offsetInShared[numNeighbors]=n;
215  #endif      #ifdef PASO_MPI
216      offsetInShared[numNeighbors]=lastn;      MPI_Waitall(count,mpi_requests,mpi_stati);
217        #endif
218        /* map global ids to local id's */
219        #pragma omp parallel for private(i) schedule(static)
220        for (i=0;i<offsetInShared[numNeighbors];++i) {
221            shared[i]=locDOFMask[shared[i]-min_DOF];
222        }
223    
224      snd_shcomp=Paso_SharedComponents_alloc(myLastDOF-myFirstDOF,numNeighbors,neighbor,shared,offsetInShared,1,0,dof_distribution->mpi_info);      snd_shcomp=Paso_SharedComponents_alloc(myLastDOF-myFirstDOF,numNeighbors,neighbor,shared,offsetInShared,1,0,dof_distribution->mpi_info);
225    
226      if (Finley_noError()) this_connector=Paso_Connector_alloc(snd_shcomp,rcv_shcomp);      if (Finley_noError()) this_connector=Paso_Connector_alloc(snd_shcomp,rcv_shcomp);
# Line 192  void Mesh_createDOFMappingAndCoupling(Fi Line 228  void Mesh_createDOFMappingAndCoupling(Fi
228      Paso_SharedComponents_free(rcv_shcomp);      Paso_SharedComponents_free(rcv_shcomp);
229      Paso_SharedComponents_free(snd_shcomp);      Paso_SharedComponents_free(snd_shcomp);
230    }    }
231      TMPMEMFREE(rcv_len);
232      TMPMEMFREE(snd_len);
233      TMPMEMFREE(mpi_requests);
234      TMPMEMFREE(mpi_stati);
235      TMPMEMFREE(wanted_DOFs);
236    TMPMEMFREE(nodeMask);    TMPMEMFREE(nodeMask);
237    TMPMEMFREE(neighbor);    TMPMEMFREE(neighbor);
238    TMPMEMFREE(shared);    TMPMEMFREE(shared);
# Line 212  void Mesh_createDOFMappingAndCoupling(Fi Line 253  void Mesh_createDOFMappingAndCoupling(Fi
253    }    }
254  }  }
255    
256  void Finley_Mesh_createMappings(Finley_Mesh* mesh, index_t* distribution) {  void Finley_Mesh_createMappings(Finley_Mesh* mesh, index_t* dof_distribution, index_t* node_distribution) {
257    int i;    int i;
258    index_t *maskReducedNodes=NULL, *indexReducedNodes=NULL;    index_t *maskReducedNodes=NULL, *indexReducedNodes=NULL;
259    dim_t numReducedNodes;    dim_t numReducedNodes;
# Line 225  void Finley_Mesh_createMappings(Finley_M Line 266  void Finley_Mesh_createMappings(Finley_M
266      for (i=0;i<mesh->Nodes->numNodes;++i) maskReducedNodes[i]=-1;      for (i=0;i<mesh->Nodes->numNodes;++i) maskReducedNodes[i]=-1;
267      Finley_Mesh_markNodes(maskReducedNodes,0,mesh,TRUE);      Finley_Mesh_markNodes(maskReducedNodes,0,mesh,TRUE);
268      numReducedNodes=Finley_Util_packMask(mesh->Nodes->numNodes,maskReducedNodes,indexReducedNodes);      numReducedNodes=Finley_Util_packMask(mesh->Nodes->numNodes,maskReducedNodes,indexReducedNodes);
269      if (Finley_noError()) Finley_Mesh_createNodeFileMappings(mesh,numReducedNodes,indexReducedNodes,distribution);      if (Finley_noError()) Finley_Mesh_createNodeFileMappings(mesh,numReducedNodes,indexReducedNodes,dof_distribution, node_distribution);
270    }    }
271    
272    TMPMEMFREE(maskReducedNodes);    TMPMEMFREE(maskReducedNodes);
273    TMPMEMFREE(indexReducedNodes);    TMPMEMFREE(indexReducedNodes);
274  }  }
275    
276  void Finley_Mesh_createNodeFileMappings(Finley_Mesh* in, dim_t numReducedNodes, index_t* indexReducedNodes, index_t* dof_first_component) {  void Finley_Mesh_createNodeFileMappings(Finley_Mesh* in, dim_t numReducedNodes, index_t* indexReducedNodes, index_t* dof_first_component, index_t* nodes_first_component) {
277    
278    
279    index_t myFirstDOF, myLastDOF, myFirstNode, myLastNode, *reduced_dof_first_component=NULL, *nodeMask=NULL,    index_t myFirstDOF, myLastDOF, myFirstNode, myLastNode, *reduced_dof_first_component=NULL, *nodeMask=NULL,
280           *reduced_nodes_first_component=NULL, *nodes_first_component=NULL,k,           *reduced_nodes_first_component=NULL, k,*maskMyReducedDOF=NULL, *indexMyReducedDOF=NULL, *maskMyReducedNodes=NULL, *indexMyReducedNodes=NULL;
281           *maskMyReducedDOF=NULL, *indexMyReducedDOF=NULL, *maskMyReducedNodes=NULL, *indexMyReducedNodes=NULL;    dim_t myNumDOF, myNumNodes, myNumReducedNodes, myNumReducedDOF, globalNumReducedNodes, globalNumReducedDOF,i,mpiSize, minGlobalNodeIndex,maxGlobalNodeIndex;
   dim_t myNumDOF, myNumNodes, myNumReducedNodes, myNumReducedDOF, globalNumReducedNodes, globalNumReducedDOF,i,mpiSize, globalNumNodes;  
282    Paso_MPI_rank myRank;    Paso_MPI_rank myRank;
283    
284    mpiSize=in->Nodes->MPIInfo->size;    mpiSize=in->Nodes->MPIInfo->size;
# Line 247  void Finley_Mesh_createNodeFileMappings( Line 287  void Finley_Mesh_createNodeFileMappings(
287    
288    reduced_dof_first_component=TMPMEMALLOC(mpiSize+1,index_t);    reduced_dof_first_component=TMPMEMALLOC(mpiSize+1,index_t);
289    reduced_nodes_first_component=TMPMEMALLOC(mpiSize+1,index_t);    reduced_nodes_first_component=TMPMEMALLOC(mpiSize+1,index_t);
   nodes_first_component=TMPMEMALLOC(mpiSize+1,index_t);  
290    
291    if (! ( Finley_checkPtr(reduced_dof_first_component) || Finley_checkPtr(reduced_nodes_first_component) || Finley_checkPtr(nodes_first_component)  ) ) {    if (! ( Finley_checkPtr(reduced_dof_first_component) || Finley_checkPtr(reduced_nodes_first_component) ) ) {
   
      globalNumNodes=Finley_NodeFile_maxGlobalNodeIDIndex(in->Nodes)+1;  
      Paso_MPIInfo_setDistribution(in->Nodes->MPIInfo,0,globalNumNodes-1,nodes_first_component);  
292    
293       myFirstDOF=dof_first_component[myRank];       myFirstDOF=dof_first_component[myRank];
294       myLastDOF=dof_first_component[myRank+1];       myLastDOF=dof_first_component[myRank+1];
295       myNumDOF=myLastDOF-myFirstDOF;       myNumDOF=myLastDOF-myFirstDOF;
296    
297       myFirstNode=nodes_first_component[myRank];       myFirstNode=nodes_first_component[myRank];
298       myLastNode=nodes_first_component[myRank+1];       myLastNode=nodes_first_component[myRank+1];
299       myNumNodes=myLastNode-myFirstNode;       myNumNodes=myLastNode-myFirstNode;
# Line 279  void Finley_Mesh_createNodeFileMappings( Line 316  void Finley_Mesh_createNodeFileMappings(
316                 k=in->Nodes->globalNodesIndex[indexReducedNodes[i]];                 k=in->Nodes->globalNodesIndex[indexReducedNodes[i]];
317                 if ( (k>=myFirstNode) && (myLastNode>k) ) maskMyReducedNodes[k-myFirstNode]=i;                 if ( (k>=myFirstNode) && (myLastNode>k) ) maskMyReducedNodes[k-myFirstNode]=i;
318                 k=in->Nodes->globalDegreesOfFreedom[indexReducedNodes[i]];                 k=in->Nodes->globalDegreesOfFreedom[indexReducedNodes[i]];
319                 if ( (k>=myFirstDOF) && (myLastDOF>k) ) maskMyReducedDOF[k-myFirstDOF]=i;                 if ( (k>=myFirstDOF) && (myLastDOF>k) ) {
320                      maskMyReducedDOF[k-myFirstDOF]=i;
321                   }
322              }              }
323          }          }
324          myNumReducedNodes=Finley_Util_packMask(myNumNodes,maskMyReducedNodes,indexMyReducedNodes);          myNumReducedNodes=Finley_Util_packMask(myNumNodes,maskMyReducedNodes,indexMyReducedNodes);
# Line 306  void Finley_Mesh_createNodeFileMappings( Line 345  void Finley_Mesh_createNodeFileMappings(
345          reduced_nodes_first_component[mpiSize]=globalNumReducedNodes;          reduced_nodes_first_component[mpiSize]=globalNumReducedNodes;
346          reduced_dof_first_component[mpiSize]=globalNumReducedDOF;          reduced_dof_first_component[mpiSize]=globalNumReducedDOF;
347          /* ==== distribution of Nodes ===============================*/          /* ==== distribution of Nodes ===============================*/
         Paso_MPIInfo_setDistribution(in->Nodes->MPIInfo,0,globalNumNodes-1,nodes_first_component);  
348          in->Nodes->nodesDistribution=Paso_Distribution_alloc(in->Nodes->MPIInfo,nodes_first_component,1,0);          in->Nodes->nodesDistribution=Paso_Distribution_alloc(in->Nodes->MPIInfo,nodes_first_component,1,0);
349            
350          /* ==== distribution of Nodes ===============================*/          /* ==== distribution of DOFs ===============================*/
351          in->Nodes->degreesOfFreedomDistribution=Paso_Distribution_alloc(in->Nodes->MPIInfo,dof_first_component,1,0);          in->Nodes->degreesOfFreedomDistribution=Paso_Distribution_alloc(in->Nodes->MPIInfo,dof_first_component,1,0);
352            
353          /* ==== distribution of reduced Nodes ===============================*/          /* ==== distribution of reduced Nodes ===============================*/
         reduced_nodes_first_component[mpiSize]=globalNumReducedNodes;  
354          in->Nodes->reducedNodesDistribution=Paso_Distribution_alloc(in->Nodes->MPIInfo,reduced_nodes_first_component,1,0);          in->Nodes->reducedNodesDistribution=Paso_Distribution_alloc(in->Nodes->MPIInfo,reduced_nodes_first_component,1,0);
355            
356          /* ==== distribution of reduced DOF ===============================*/          /* ==== distribution of reduced DOF ===============================*/
# Line 326  void Finley_Mesh_createNodeFileMappings( Line 363  void Finley_Mesh_createNodeFileMappings(
363    }    }
364    TMPMEMFREE(reduced_dof_first_component);    TMPMEMFREE(reduced_dof_first_component);
365    TMPMEMFREE(reduced_nodes_first_component);    TMPMEMFREE(reduced_nodes_first_component);
   TMPMEMFREE(nodes_first_component);  
366    
367    nodeMask=TMPMEMALLOC(in->Nodes->numNodes,index_t);    nodeMask=TMPMEMALLOC(in->Nodes->numNodes,index_t);
368    if (! Finley_checkPtr(nodeMask) && Finley_noError()) {    if (! Finley_checkPtr(nodeMask) && Finley_noError()) {

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

  ViewVC Help
Powered by ViewVC 1.1.26