/[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 1551 by trankine, Fri Jan 11 07:45:58 2008 UTC revision 1552 by gross, Thu May 8 08:52:41 2008 UTC
# Line 63  Paso_SystemMatrixPattern* Finley_getPatt Line 63  Paso_SystemMatrixPattern* Finley_getPatt
63  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) {
64    double time0;    double time0;
65    Paso_SystemMatrixPattern* out=NULL;    Paso_SystemMatrixPattern* out=NULL;
66    Paso_Pattern *main_pattern = NULL, *couple_pattern=NULL;    Paso_Pattern *main_pattern = NULL, *col_couple_pattern=NULL, *row_couple_pattern=NULL;
67    Paso_Coupler *coupler;    Paso_Connector *col_connector, *row_connector;
68    Finley_IndexList* index_list=NULL;    Finley_IndexList* index_list=NULL;
69    Finley_NodeMapping *colMap=NULL, *rowMap=NULL;    Finley_NodeMapping *colMap=NULL, *rowMap=NULL;
70    Paso_Distribution *colDistribution=NULL, *rowDistribution=NULL;    Paso_Distribution *colDistribution=NULL, *rowDistribution=NULL;
# Line 76  Paso_SystemMatrixPattern* Finley_makePat Line 76  Paso_SystemMatrixPattern* Finley_makePat
76    if (reduce_col_order) {    if (reduce_col_order) {
77         colMap=mesh->Nodes->reducedDegreesOfFreedomMapping;         colMap=mesh->Nodes->reducedDegreesOfFreedomMapping;
78         colDistribution=mesh->Nodes->reducedDegreesOfFreedomDistribution;         colDistribution=mesh->Nodes->reducedDegreesOfFreedomDistribution;
79         coupler=mesh->Nodes->reducedDegreesOfFreedomCoupler;         col_connector=mesh->Nodes->reducedDegreesOfFreedomConnector;
80    
81    } else {    } else {
82         colMap=mesh->Nodes->degreesOfFreedomMapping;         colMap=mesh->Nodes->degreesOfFreedomMapping;
83         colDistribution=mesh->Nodes->degreesOfFreedomDistribution;         colDistribution=mesh->Nodes->degreesOfFreedomDistribution;
84         coupler=mesh->Nodes->degreesOfFreedomCoupler;         col_connector=mesh->Nodes->degreesOfFreedomConnector;
85    }    }
86            
87    if (reduce_row_order) {    if (reduce_row_order) {
88        rowMap=mesh->Nodes->reducedDegreesOfFreedomMapping;        rowMap=mesh->Nodes->reducedDegreesOfFreedomMapping;
89        rowDistribution=mesh->Nodes->reducedDegreesOfFreedomDistribution;        rowDistribution=mesh->Nodes->reducedDegreesOfFreedomDistribution;
90          row_connector=mesh->Nodes->reducedDegreesOfFreedomConnector;
91    } else {    } else {
92        rowMap=mesh->Nodes->degreesOfFreedomMapping;        rowMap=mesh->Nodes->degreesOfFreedomMapping;
93        rowDistribution=mesh->Nodes->degreesOfFreedomDistribution;        rowDistribution=mesh->Nodes->degreesOfFreedomDistribution;
94          row_connector=mesh->Nodes->degreesOfFreedomConnector;
95    }    }
96    
97    index_list=TMPMEMALLOC(rowMap->numTargets,Finley_IndexList);    index_list=TMPMEMALLOC(rowMap->numTargets,Finley_IndexList);
# Line 115  Paso_SystemMatrixPattern* Finley_makePat Line 117  Paso_SystemMatrixPattern* Finley_makePat
117       }       }
118    
119       /* create pattern */       /* create pattern */
120       main_pattern=Finley_IndexList_createPattern(Paso_Distribution_getMyNumComponents(rowDistribution),index_list,0,Paso_Distribution_getMyNumComponents(colDistribution),0);       main_pattern=Finley_IndexList_createPattern(0,Paso_Distribution_getMyNumComponents(rowDistribution),index_list,
121       couple_pattern=Finley_IndexList_createPattern(Paso_Distribution_getMyNumComponents(rowDistribution),index_list,Paso_Distribution_getMyNumComponents(colDistribution),colMap->numTargets,-Paso_Distribution_getMyNumComponents(colDistribution));                                                   0,Paso_Distribution_getMyNumComponents(colDistribution),
122                                                     0);
123         col_couple_pattern=Finley_IndexList_createPattern(0,Paso_Distribution_getMyNumComponents(rowDistribution),index_list,
124                                                     Paso_Distribution_getMyNumComponents(colDistribution),colMap->numTargets,
125                                                     -Paso_Distribution_getMyNumComponents(colDistribution));
126         row_couple_pattern=Finley_IndexList_createPattern(Paso_Distribution_getMyNumComponents(rowDistribution),rowMap->numTargets,index_list,
127                                                           0,Paso_Distribution_getMyNumComponents(colDistribution),
128                                                           0);
129    
130       /* if everthing is in order we can create the return value */       /* if everthing is in order we can create the return value */
131       if (Finley_noError()) {       if (Finley_noError()) {
132            out=Paso_SystemMatrixPattern_alloc(PATTERN_FORMAT_DEFAULT,            out=Paso_SystemMatrixPattern_alloc(PATTERN_FORMAT_DEFAULT,
133                                               rowDistribution,                                               rowDistribution,
134                                               colDistribution,                                               colDistribution,
135                                               main_pattern,                                               main_pattern,
136                                               couple_pattern,                                               col_couple_pattern,
137                                               coupler);                                               row_couple_pattern,
138                                                 col_connector,
139                                                 row_connector);
140       }       }
141       /* clean up */       /* clean up */
142       if (index_list!=NULL) {       if (index_list!=NULL) {
# Line 133  Paso_SystemMatrixPattern* Finley_makePat Line 145  Paso_SystemMatrixPattern* Finley_makePat
145       }       }
146       TMPMEMFREE(index_list);       TMPMEMFREE(index_list);
147       Paso_Pattern_free(main_pattern);       Paso_Pattern_free(main_pattern);
148       Paso_Pattern_free(couple_pattern);       Paso_Pattern_free(col_couple_pattern);
149         Paso_Pattern_free(row_couple_pattern);
150    }    }
151    #ifdef Finley_TRACE    #ifdef Finley_TRACE
152    printf("timing: mesh to matrix pattern: %.4e sec\n",Finley_timer()-time0);    printf("timing: mesh to matrix pattern: %.4e sec\n",Finley_timer()-time0);

Legend:
Removed from v.1551  
changed lines
  Added in v.1552

  ViewVC Help
Powered by ViewVC 1.1.26