/[escript]/trunk/finley/src/Mesh_getPattern.c
ViewVC logotype

Diff of /trunk/finley/src/Mesh_getPattern.c

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

revision 969 by ksteube, Tue Feb 13 23:02:23 2007 UTC revision 971 by ksteube, Wed Feb 14 04:40:49 2007 UTC
# Line 60  Paso_SystemMatrixPattern* Finley_getPatt Line 60  Paso_SystemMatrixPattern* Finley_getPatt
60           }           }
61        }        }
62     }       }  
    out->MPIInfo = Paso_MPIInfo_getReference( mesh->MPIInfo );  
63     return out;     return out;
64  }  }
65  Paso_SystemMatrixPattern* Finley_makePattern(Finley_Mesh *mesh,bool_t reduce_row_order, bool_t reduce_col_order) {  Paso_SystemMatrixPattern* Finley_makePattern(Finley_Mesh *mesh,bool_t reduce_row_order, bool_t reduce_col_order) {
# Line 69  Paso_SystemMatrixPattern* Finley_makePat Line 68  Paso_SystemMatrixPattern* Finley_makePat
68    index_t s,itmp,*rowLabel=NULL,*colLabel=NULL, *ptr=NULL, *index=NULL;    index_t s,itmp,*rowLabel=NULL,*colLabel=NULL, *ptr=NULL, *index=NULL;
69    Finley_IndexList* index_list=NULL;    Finley_IndexList* index_list=NULL;
70    Finley_resetError();    Finley_resetError();
71    Finley_NodeDistribution *row_degreeOfFreedomDistribution;    
   Finley_NodeDistribution *col_degreeOfFreedomDistribution;  
   
72    time0=Finley_timer();    time0=Finley_timer();
   
 #ifdef PASO_MPI  
   if (reduce_col_order) {  
        n=mesh->Nodes->reducedDegreeOfFreedomDistribution->numLocal;  
        colLabel=mesh->Nodes->reducedDegreeOfFreedom;  
   } else {  
        n=mesh->Nodes->degreeOfFreedomDistribution->numLocal;  
        colLabel=mesh->Nodes->degreeOfFreedom;  
   }  
       
   if (reduce_row_order) {  
       n=mesh->Nodes->reducedDegreeOfFreedomDistribution->numLocal;  
       rowLabel=mesh->Nodes->reducedDegreeOfFreedom;  
   } else {  
       n=mesh->Nodes->degreeOfFreedomDistribution->numLocal;  
       rowLabel=mesh->Nodes->degreeOfFreedom;  
   }  
 #else  
73    if (reduce_col_order) {    if (reduce_col_order) {
74         n=mesh->Nodes->reducedNumDegreesOfFreedom;         n=mesh->Nodes->reducedNumDegreesOfFreedom;
75         colLabel=mesh->Nodes->reducedDegreeOfFreedom;         colLabel=mesh->Nodes->reducedDegreeOfFreedom;
# Line 106  Paso_SystemMatrixPattern* Finley_makePat Line 85  Paso_SystemMatrixPattern* Finley_makePat
85        n=mesh->Nodes->numDegreesOfFreedom;        n=mesh->Nodes->numDegreesOfFreedom;
86        rowLabel=mesh->Nodes->degreeOfFreedom;        rowLabel=mesh->Nodes->degreeOfFreedom;
87    }    }
 #endif  
88    
89    index_list=TMPMEMALLOC(n,Finley_IndexList);    index_list=TMPMEMALLOC(n,Finley_IndexList);
90    ptr=MEMALLOC(n+1,index_t);    ptr=MEMALLOC(n+1,index_t);
# Line 119  Paso_SystemMatrixPattern* Finley_makePat Line 97  Paso_SystemMatrixPattern* Finley_makePat
97               index_list[i].n=0;               index_list[i].n=0;
98          }          }
99          /*  insert contributions from element matrices into colums index index_list: */          /*  insert contributions from element matrices into colums index index_list: */
100      printf("ksteube mesh->Elements\n");          Finley_IndexList_insertElements(index_list,mesh->Elements,
         Finley_IndexList_insertElements(index_list,mesh,mesh->Elements,  
101                                          reduce_row_order,rowLabel,reduce_col_order,colLabel);                                          reduce_row_order,rowLabel,reduce_col_order,colLabel);
102      printf("ksteube mesh->FaceElements\n");          Finley_IndexList_insertElements(index_list,mesh->FaceElements,
         Finley_IndexList_insertElements(index_list,mesh,mesh->FaceElements,  
103                                          reduce_row_order,rowLabel,reduce_col_order,colLabel);                                          reduce_row_order,rowLabel,reduce_col_order,colLabel);
104      printf("ksteube mesh->ContactElements\n");          Finley_IndexList_insertElements(index_list,mesh->ContactElements,
         Finley_IndexList_insertElements(index_list,mesh,mesh->ContactElements,  
105                                          reduce_row_order,rowLabel,reduce_col_order,colLabel);                                          reduce_row_order,rowLabel,reduce_col_order,colLabel);
106      printf("ksteube mesh->Points\n");          Finley_IndexList_insertElements(index_list,mesh->Points,
         Finley_IndexList_insertElements(index_list,mesh,mesh->Points,  
107                                          reduce_row_order,rowLabel,reduce_col_order,colLabel);                                          reduce_row_order,rowLabel,reduce_col_order,colLabel);
     printf("ksteube done with 4 calls to Finley_IndexList_insertElements\n");  
108          /* get the number of connections per row */          /* get the number of connections per row */
109          #pragma omp for schedule(static)          #pragma omp for schedule(static)
110          for(i=0;i<n;++i) {          for(i=0;i<n;++i) {
# Line 173  Paso_SystemMatrixPattern* Finley_makePat Line 146  Paso_SystemMatrixPattern* Finley_makePat
146      MEMFREE(index);      MEMFREE(index);
147      return NULL;      return NULL;
148    } else {    } else {
149      Paso_SystemMatrixPattern *pattern = Paso_SystemMatrixPattern_alloc(MATRIX_FORMAT_DEFAULT,n,ptr,index,mesh->MPIInfo); /* add distr info */      return Paso_SystemMatrixPattern_alloc(MATRIX_FORMAT_DEFAULT,n,ptr,index);
     // Use a getReference method to get the DOF distributions to avoid memory leaks  
     if (reduce_col_order) {  
       col_degreeOfFreedomDistribution = mesh->Nodes->reducedDegreeOfFreedomDistribution;  
     }  
     else {  
       col_degreeOfFreedomDistribution = mesh->Nodes->degreeOfFreedomDistribution;  
     }  
     if (reduce_row_order) {  
       row_degreeOfFreedomDistribution = mesh->Nodes->reducedDegreeOfFreedomDistribution;  
     }  
     else {  
       row_degreeOfFreedomDistribution = mesh->Nodes->degreeOfFreedomDistribution;  
     }  
     pattern->row_degreeOfFreedomDistribution = row_degreeOfFreedomDistribution;  
     pattern->col_degreeOfFreedomDistribution = col_degreeOfFreedomDistribution;  
     return pattern;  
150    }    }
151  }  }
152  /*  /*

Legend:
Removed from v.969  
changed lines
  Added in v.971

  ViewVC Help
Powered by ViewVC 1.1.26