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

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

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

revision 4491 by caltinay, Wed Jun 19 06:44:47 2013 UTC revision 4492 by caltinay, Tue Jul 2 01:44:11 2013 UTC
# Line 25  Line 25 
25    
26    
27  /// returns a reference to the matrix pattern  /// returns a reference to the matrix pattern
28  Paso_SystemMatrixPattern* Finley_getPattern(Finley_Mesh *mesh, bool_t reduce_row_order, bool_t reduce_col_order)  Paso_SystemMatrixPattern* Finley_getPattern(Finley_Mesh *mesh, bool reduce_row_order, bool reduce_col_order)
29  {  {
30      Paso_SystemMatrixPattern *out=NULL;      Paso_SystemMatrixPattern *out=NULL;
31      Finley_resetError();      Finley_resetError();
# Line 65  Paso_SystemMatrixPattern* Finley_getPatt Line 65  Paso_SystemMatrixPattern* Finley_getPatt
65      return out;      return out;
66  }  }
67    
68  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 reduce_row_order, bool reduce_col_order)
69  {  {
70      Paso_SystemMatrixPattern* out=NULL;      Paso_SystemMatrixPattern* out=NULL;
71      Paso_Pattern *main_pattern = NULL, *col_couple_pattern=NULL, *row_couple_pattern=NULL;      Paso_Pattern *main_pattern = NULL, *col_couple_pattern=NULL, *row_couple_pattern=NULL;
72      Paso_Connector *col_connector, *row_connector;      Paso_Connector *col_connector, *row_connector;
     Finley_NodeMapping *colMap=NULL, *rowMap=NULL;  
73      Paso_Distribution *colDistribution=NULL, *rowDistribution=NULL;      Paso_Distribution *colDistribution=NULL, *rowDistribution=NULL;
74        
75      Finley_resetError();      Finley_resetError();
76    
77        int myNumColTargets, myNumRowTargets;
78        int numColTargets, numRowTargets;
79        const int *colTarget, *rowTarget;
80    
81      if (reduce_col_order) {      if (reduce_col_order) {
82          colMap=mesh->Nodes->reducedDegreesOfFreedomMapping;          myNumColTargets=mesh->Nodes->getNumReducedDegreesOfFreedom();
83            numColTargets=mesh->Nodes->reducedDegreesOfFreedomMapping.getNumTargets();
84            colTarget=mesh->Nodes->borrowTargetReducedDegreesOfFreedom();
85          colDistribution=mesh->Nodes->reducedDegreesOfFreedomDistribution;          colDistribution=mesh->Nodes->reducedDegreesOfFreedomDistribution;
86          col_connector=mesh->Nodes->reducedDegreesOfFreedomConnector;          col_connector=mesh->Nodes->reducedDegreesOfFreedomConnector;
87      } else {      } else {
88          colMap=mesh->Nodes->degreesOfFreedomMapping;          myNumColTargets=mesh->Nodes->getNumDegreesOfFreedom();
89            numColTargets=mesh->Nodes->degreesOfFreedomMapping.getNumTargets();
90            colTarget=mesh->Nodes->borrowTargetDegreesOfFreedom();
91          colDistribution=mesh->Nodes->degreesOfFreedomDistribution;          colDistribution=mesh->Nodes->degreesOfFreedomDistribution;
92          col_connector=mesh->Nodes->degreesOfFreedomConnector;          col_connector=mesh->Nodes->degreesOfFreedomConnector;
93      }      }
94        
95      if (reduce_row_order) {      if (reduce_row_order) {
96          rowMap=mesh->Nodes->reducedDegreesOfFreedomMapping;          myNumRowTargets=mesh->Nodes->getNumReducedDegreesOfFreedom();
97            numRowTargets=mesh->Nodes->reducedDegreesOfFreedomMapping.getNumTargets();
98            rowTarget=mesh->Nodes->borrowTargetReducedDegreesOfFreedom();
99          rowDistribution=mesh->Nodes->reducedDegreesOfFreedomDistribution;          rowDistribution=mesh->Nodes->reducedDegreesOfFreedomDistribution;
100          row_connector=mesh->Nodes->reducedDegreesOfFreedomConnector;          row_connector=mesh->Nodes->reducedDegreesOfFreedomConnector;
101      } else {      } else {
102          rowMap=mesh->Nodes->degreesOfFreedomMapping;          myNumRowTargets=mesh->Nodes->getNumDegreesOfFreedom();
103            numRowTargets=mesh->Nodes->degreesOfFreedomMapping.getNumTargets();
104            rowTarget=mesh->Nodes->borrowTargetDegreesOfFreedom();
105          rowDistribution=mesh->Nodes->degreesOfFreedomDistribution;          rowDistribution=mesh->Nodes->degreesOfFreedomDistribution;
106          row_connector=mesh->Nodes->degreesOfFreedomConnector;          row_connector=mesh->Nodes->degreesOfFreedomConnector;
107      }      }
108        IndexList* index_list=new IndexList[numRowTargets];
     IndexList* index_list=new IndexList[rowMap->numTargets];  
109        
110  #pragma omp parallel  #pragma omp parallel
111      {      {
112          // insert contributions from element matrices into columns index index_list:          // insert contributions from element matrices into columns index index_list:
113          IndexList_insertElements(index_list,mesh->Elements,          IndexList_insertElements(index_list, mesh->Elements, reduce_row_order,
114                                          reduce_row_order,rowMap->target,reduce_col_order,colMap->target);                                   rowTarget, reduce_col_order, colTarget);
115          IndexList_insertElements(index_list,mesh->FaceElements,          IndexList_insertElements(index_list, mesh->FaceElements,
116                                          reduce_row_order,rowMap->target,reduce_col_order,colMap->target);                                   reduce_row_order, rowTarget, reduce_col_order,
117          IndexList_insertElements(index_list,mesh->ContactElements,                                   colTarget);
118                                          reduce_row_order,rowMap->target,reduce_col_order,colMap->target);          IndexList_insertElements(index_list, mesh->ContactElements,
119          IndexList_insertElements(index_list,mesh->Points,                                   reduce_row_order, rowTarget, reduce_col_order,
120                                          reduce_row_order,rowMap->target,reduce_col_order,colMap->target);                                   colTarget);
121            IndexList_insertElements(index_list, mesh->Points, reduce_row_order,
122                                     rowTarget, reduce_col_order, colTarget);
123      }      }
124    
125      /* create pattern */      /* create pattern */
126      main_pattern=IndexList_createPattern(0,Paso_Distribution_getMyNumComponents(rowDistribution),index_list,      main_pattern=IndexList_createPattern(0, myNumRowTargets, index_list, 0,
127                                                   0,Paso_Distribution_getMyNumComponents(colDistribution),                                           myNumColTargets, 0);
128                                                   0);      col_couple_pattern=IndexList_createPattern(0, myNumRowTargets, index_list,
129      col_couple_pattern=IndexList_createPattern(0,Paso_Distribution_getMyNumComponents(rowDistribution),index_list,                                                 myNumColTargets, numColTargets,
130                                                   Paso_Distribution_getMyNumComponents(colDistribution),colMap->numTargets,                                                 -myNumColTargets);
131                                                   -Paso_Distribution_getMyNumComponents(colDistribution));      row_couple_pattern=IndexList_createPattern(myNumRowTargets, numRowTargets,
132      row_couple_pattern=IndexList_createPattern(Paso_Distribution_getMyNumComponents(rowDistribution),rowMap->numTargets,index_list,                                              index_list, 0, myNumColTargets, 0);
                                                        0,Paso_Distribution_getMyNumComponents(colDistribution),  
                                                        0);  
133    
134      /* if everything is in order we can create the return value */      /* if everything is in order we can create the return value */
135      if (Finley_noError()) {      if (Finley_noError()) {

Legend:
Removed from v.4491  
changed lines
  Added in v.4492

  ViewVC Help
Powered by ViewVC 1.1.26