/[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 1388 by trankine, Fri Jan 11 07:45:58 2008 UTC revision 2551 by gross, Thu Jul 23 09:19:15 2009 UTC
# Line 1  Line 1 
1    
 /* $Id$ */  
   
2  /*******************************************************  /*******************************************************
3   *  *
4   *           Copyright 2003-2007 by ACceSS MNRF  * Copyright (c) 2003-2009 by University of Queensland
5   *       Copyright 2007 by University of Queensland  * Earth Systems Science Computational Center (ESSCC)
6   *  * http://www.uq.edu.au/esscc
7   *                http://esscc.uq.edu.au  *
8   *        Primary Business: Queensland, Australia  * Primary Business: Queensland, Australia
9   *  Licensed under the Open Software License version 3.0  * Licensed under the Open Software License version 3.0
10   *     http://www.opensource.org/licenses/osl-3.0.php  * http://www.opensource.org/licenses/osl-3.0.php
11   *  *
12   *******************************************************/  *******************************************************/
13    
14    
15  /**************************************************************/  /**************************************************************/
16    
# Line 46  Paso_SystemMatrixPattern* Finley_getPatt Line 45  Paso_SystemMatrixPattern* Finley_getPatt
45     if (Finley_noError()) {     if (Finley_noError()) {
46        if (reduce_row_order) {        if (reduce_row_order) {
47           if (reduce_col_order) {           if (reduce_col_order) {
48              out=Paso_SystemMatrixPattern_reference(mesh->ReducedReducedPattern);              out=Paso_SystemMatrixPattern_getReference(mesh->ReducedReducedPattern);
49           } else {           } else {
50              out=Paso_SystemMatrixPattern_reference(mesh->ReducedFullPattern);              out=Paso_SystemMatrixPattern_getReference(mesh->ReducedFullPattern);
51           }           }
52        } else {        } else {
53           if (reduce_col_order) {           if (reduce_col_order) {
54              out=Paso_SystemMatrixPattern_reference(mesh->FullReducedPattern);              out=Paso_SystemMatrixPattern_getReference(mesh->FullReducedPattern);
55           } else {           } else {
56              out=Paso_SystemMatrixPattern_reference(mesh->FullFullPattern);              out=Paso_SystemMatrixPattern_getReference(mesh->FullFullPattern);
57           }           }
58        }        }
59     }       }  
# Line 63  Paso_SystemMatrixPattern* Finley_getPatt Line 62  Paso_SystemMatrixPattern* Finley_getPatt
62  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) {
63    double time0;    double time0;
64    Paso_SystemMatrixPattern* out=NULL;    Paso_SystemMatrixPattern* out=NULL;
65    Paso_Pattern *main_pattern = NULL, *couple_pattern=NULL;    Paso_Pattern *main_pattern = NULL, *col_couple_pattern=NULL, *row_couple_pattern=NULL;
66    Paso_Coupler *coupler;    Paso_Connector *col_connector, *row_connector;
67    Finley_IndexList* index_list=NULL;    Finley_IndexList* index_list=NULL;
68    Finley_NodeMapping *colMap=NULL, *rowMap=NULL;    Finley_NodeMapping *colMap=NULL, *rowMap=NULL;
69    Paso_Distribution *colDistribution=NULL, *rowDistribution=NULL;    Paso_Distribution *colDistribution=NULL, *rowDistribution=NULL;
70        
71    index_t i,j;    index_t i;
72    Finley_resetError();    Finley_resetError();
73    time0=Finley_timer();    time0=Finley_timer();
74    
75    if (reduce_col_order) {    if (reduce_col_order) {
76         colMap=mesh->Nodes->reducedDegreesOfFreedomMapping;         colMap=mesh->Nodes->reducedDegreesOfFreedomMapping;
77         colDistribution=mesh->Nodes->reducedDegreesOfFreedomDistribution;         colDistribution=mesh->Nodes->reducedDegreesOfFreedomDistribution;
78         coupler=mesh->Nodes->reducedDegreesOfFreedomCoupler;         col_connector=mesh->Nodes->reducedDegreesOfFreedomConnector;
79    
80    } else {    } else {
81         colMap=mesh->Nodes->degreesOfFreedomMapping;         colMap=mesh->Nodes->degreesOfFreedomMapping;
82         colDistribution=mesh->Nodes->degreesOfFreedomDistribution;         colDistribution=mesh->Nodes->degreesOfFreedomDistribution;
83         coupler=mesh->Nodes->degreesOfFreedomCoupler;         col_connector=mesh->Nodes->degreesOfFreedomConnector;
84    }    }
85            
86    if (reduce_row_order) {    if (reduce_row_order) {
87        rowMap=mesh->Nodes->reducedDegreesOfFreedomMapping;        rowMap=mesh->Nodes->reducedDegreesOfFreedomMapping;
88        rowDistribution=mesh->Nodes->reducedDegreesOfFreedomDistribution;        rowDistribution=mesh->Nodes->reducedDegreesOfFreedomDistribution;
89          row_connector=mesh->Nodes->reducedDegreesOfFreedomConnector;
90    } else {    } else {
91        rowMap=mesh->Nodes->degreesOfFreedomMapping;        rowMap=mesh->Nodes->degreesOfFreedomMapping;
92        rowDistribution=mesh->Nodes->degreesOfFreedomDistribution;        rowDistribution=mesh->Nodes->degreesOfFreedomDistribution;
93          row_connector=mesh->Nodes->degreesOfFreedomConnector;
94    }    }
95    
96    index_list=TMPMEMALLOC(rowMap->numTargets,Finley_IndexList);    index_list=TMPMEMALLOC(rowMap->numTargets,Finley_IndexList);
# Line 115  Paso_SystemMatrixPattern* Finley_makePat Line 116  Paso_SystemMatrixPattern* Finley_makePat
116       }       }
117    
118       /* create pattern */       /* create pattern */
119       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,
120       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),
121                                                     0);
122         col_couple_pattern=Finley_IndexList_createPattern(0,Paso_Distribution_getMyNumComponents(rowDistribution),index_list,
123                                                     Paso_Distribution_getMyNumComponents(colDistribution),colMap->numTargets,
124                                                     -Paso_Distribution_getMyNumComponents(colDistribution));
125         row_couple_pattern=Finley_IndexList_createPattern(Paso_Distribution_getMyNumComponents(rowDistribution),rowMap->numTargets,index_list,
126                                                           0,Paso_Distribution_getMyNumComponents(colDistribution),
127                                                           0);
128    
129       /* if everthing is in order we can create the return value */       /* if everthing is in order we can create the return value */
130       if (Finley_noError()) {       if (Finley_noError()) {
131            out=Paso_SystemMatrixPattern_alloc(PATTERN_FORMAT_DEFAULT,            out=Paso_SystemMatrixPattern_alloc(PATTERN_FORMAT_DEFAULT,
132                                               rowDistribution,                                               rowDistribution,
133                                               colDistribution,                                               colDistribution,
134                                               main_pattern,                                               main_pattern,
135                                               couple_pattern,                                               col_couple_pattern,
136                                               coupler);                                               row_couple_pattern,
137                                                 col_connector,
138                                                 row_connector);
139       }       }
140       /* clean up */       /* clean up */
141       if (index_list!=NULL) {       if (index_list!=NULL) {
# Line 133  Paso_SystemMatrixPattern* Finley_makePat Line 144  Paso_SystemMatrixPattern* Finley_makePat
144       }       }
145       TMPMEMFREE(index_list);       TMPMEMFREE(index_list);
146       Paso_Pattern_free(main_pattern);       Paso_Pattern_free(main_pattern);
147       Paso_Pattern_free(couple_pattern);       Paso_Pattern_free(col_couple_pattern);
148         Paso_Pattern_free(row_couple_pattern);
149    }    }
150    #ifdef Finley_TRACE    #ifdef Finley_TRACE
151    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.1388  
changed lines
  Added in v.2551

  ViewVC Help
Powered by ViewVC 1.1.26