/[escript]/trunk-mpi-branch/finley/src/NodeFile_createMappings.c
ViewVC logotype

Diff of /trunk-mpi-branch/finley/src/NodeFile_createMappings.c

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

revision 1250 by gross, Mon Aug 13 02:24:56 2007 UTC revision 1251 by gross, Thu Aug 16 06:39:17 2007 UTC
# Line 138  void Finley_NodeFile_createMappings(Finl Line 138  void Finley_NodeFile_createMappings(Finl
138      #pragma omp parallel for private(i) schedule(static)      #pragma omp parallel for private(i) schedule(static)
139      for (i=0;i<numReducedNodes;++i) nodeMask[indexReducedNodes[i]]=i;      for (i=0;i<numReducedNodes;++i) nodeMask[indexReducedNodes[i]]=i;
140      in->reducedNodesMapping=Finley_NodeMapping_alloc(in->numNodes,nodeMask,UNUSED);      in->reducedNodesMapping=Finley_NodeMapping_alloc(in->numNodes,nodeMask,UNUSED);
 printf("CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC^^^ crash!\n");  
 return;  
141    
142      /* ==== mapping between nodes and DOFs ========== */      /* ==== mapping between nodes and DOFs ========== */
143      /* the trick is to count the local DOFs first and then the romote DOFs grouped by processor */      /* the trick is to count the local DOFs first and then the romote DOFs grouped by processor */
     dof_first_component=in->degreesOfFreedomDistribution->first_component;  
144      p_min=mpiSize;      p_min=mpiSize;
145      p_max=-1;      p_max=-1;
146      Finley_NodeFile_setDOFRange(&min_DOF,&max_DOF,in);      Finley_NodeFile_setDOFRange(&min_DOF,&max_DOF,in);
147    
148      for (p=0; p<in->MPIInfo->size; ++p) {      for (p=0; p<in->MPIInfo->size; ++p) {
149           if (dof_first_component[p]<=min_DOF) p_min=p;           if (in->degreesOfFreedomDistribution->first_component[p]<=min_DOF) p_min=p;
150           if (dof_first_component[p]<=max_DOF) p_max=p;           if (in->degreesOfFreedomDistribution->first_component[p]<=max_DOF) p_max=p;
151      }      }
152      n=0;      n=0;
153      for (i=0;i<in->numNodes;++i) {      for (i=0;i<in->numNodes;++i) {
# Line 161  return; Line 158  return;
158         }         }
159      }      }
160      for (p=p_min;p<=p_max;++p) {      for (p=p_min;p<=p_max;++p) {
161         firstDOF=dof_first_component[p];         firstDOF=in->degreesOfFreedomDistribution->first_component[p];
162         lastDOF=dof_first_component[p+1];         lastDOF=in->degreesOfFreedomDistribution->first_component[p+1];
163         for (i=0;i<in->numNodes;++i) {         if (p != myRank) {
164             k=in->globalDegreesOfFreedom[i];             for (i=0;i<in->numNodes;++i) {
165             if ( (k>=firstDOF) && (lastDOF>k) ) {                 k=in->globalDegreesOfFreedom[i];
166               nodeMask[i]=n;                 if ( (k>=firstDOF) && (lastDOF>k) ) {
167               n++;                   nodeMask[i]=n;
168               break;                   n++;
169                   }
170             }             }
171         }         }
172      }      }
# Line 176  return; Line 174  return;
174    
175      /* ==== mapping between nodes and DOFs ========== */      /* ==== mapping between nodes and DOFs ========== */
176      /* the trick is to count the local DOFs first and then the romote DOFs grouped by processor */      /* the trick is to count the local DOFs first and then the romote DOFs grouped by processor */
     reduced_dof_first_component=in->reducedDegreesOfFreedomDistribution->first_component;  
177      p_min=mpiSize;      p_min=mpiSize;
178      p_max=-1;      p_max=-1;
179      Finley_NodeFile_setReducedDOFRange(&min_DOF,&max_DOF,in);      Finley_NodeFile_setReducedDOFRange(&min_DOF,&max_DOF,in);
180    
181    
182      for (p=0; p<in->MPIInfo->size; ++p) {      for (p=0; p<in->MPIInfo->size; ++p) {
183           if (reduced_dof_first_component[p]<=min_DOF) p_min=p;           if (in->reducedDegreesOfFreedomDistribution->first_component[p]<=min_DOF) p_min=p;
184           if (reduced_dof_first_component[p]<=max_DOF) p_max=p;           if (in->reducedDegreesOfFreedomDistribution->first_component[p]<=max_DOF) p_max=p;
185      }      }
186      myFirstReducedDOF=reduced_dof_first_component[myRank];      myFirstReducedDOF=in->reducedDegreesOfFreedomDistribution->first_component[myRank];
187      myLastReducedDOF=reduced_dof_first_component[myRank+1];      myLastReducedDOF=in->reducedDegreesOfFreedomDistribution->first_component[myRank+1];
188      #pragma omp parallel for private(i) schedule(static)      #pragma omp parallel for private(i) schedule(static)
189      for (i=0;i<in->numNodes;++i) nodeMask[i]=UNUSED;      for (i=0;i<in->numNodes;++i) nodeMask[i]=UNUSED;
190    
191      n=0;      n=0;
192      for (i=0;i<numReducedNodes;++i) {      for (i=0;i<in->numNodes;++i) {
193         k=in->globalReducedDOFIndex[i];         k=in->globalReducedDOFIndex[i];
194         if ( (k>=myFirstReducedDOF) && (myLastReducedDOF>k) ) {         if ( (k>=myFirstReducedDOF) && (myLastReducedDOF>k) ) {
195            nodeMask[i]=n;            nodeMask[i]=n;
# Line 199  return; Line 197  return;
197         }         }
198      }      }
199      for (p=p_min;p<=p_max;++p) {      for (p=p_min;p<=p_max;++p) {
200         firstDOF=reduced_dof_first_component[p];         firstDOF=in->reducedDegreesOfFreedomDistribution->first_component[p];
201         lastDOF=reduced_dof_first_component[p+1];         lastDOF=in->reducedDegreesOfFreedomDistribution->first_component[p+1];
202         for (i=0;i<in->numNodes;++i) {         if (p != myRank) {
203             k=in->globalReducedDOFIndex[i];             for (i=0;i<in->numNodes;++i) {
204             if ( (k>=firstDOF) && (lastDOF>k) ) {                 k=in->globalReducedDOFIndex[i];
205               nodeMask[i]=n;                 if ( (k>=firstDOF) && (lastDOF>k) ) {
206               n++;                   nodeMask[i]=n;
207               break;                   n++;
208                   }
209             }             }
210         }         }
211      }      }
212      in->reducedDegreesOfFreedomMapping=Finley_NodeMapping_alloc(in->numNodes,nodeMask,UNUSED);      in->reducedDegreesOfFreedomMapping=Finley_NodeMapping_alloc(in->numNodes,nodeMask,UNUSED);
       
   
213    }    }
214    TMPMEMFREE(nodeMask);    TMPMEMFREE(nodeMask);
215        

Legend:
Removed from v.1250  
changed lines
  Added in v.1251

  ViewVC Help
Powered by ViewVC 1.1.26