/[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

trunk/finley/src/finleyC/Mesh_getPattern.c revision 155 by jgs, Wed Nov 9 02:02:19 2005 UTC trunk/finley/src/Mesh_getPattern.c revision 969 by ksteube, Tue Feb 13 23:02:23 2007 UTC
# Line 1  Line 1 
1  /*  /*
2   ******************************************************************************   ************************************************************
3   *                                                                            *   *          Copyright 2006 by ACcESS MNRF                   *
4   *       COPYRIGHT  ACcESS 2003,2004,2005 -  All Rights Reserved              *   *                                                          *
5   *                                                                            *   *              http://www.access.edu.au                    *
6   * This software is the property of ACcESS. No part of this code              *   *       Primary Business: Queensland, Australia            *
7   * may be copied in any form or by any means without the expressed written    *   *  Licensed under the Open Software License version 3.0    *
8   * consent of ACcESS.  Copying, use or modification of this software          *   *     http://www.opensource.org/licenses/osl-3.0.php       *
9   * by any unauthorised person is illegal unless that person has a software    *   *                                                          *
10   * license agreement with ACcESS.                                             *   ************************************************************
  *                                                                            *  
  ******************************************************************************  
11  */  */
12    
13  /**************************************************************/  /**************************************************************/
# Line 62  Paso_SystemMatrixPattern* Finley_getPatt Line 60  Paso_SystemMatrixPattern* Finley_getPatt
60           }           }
61        }        }
62     }       }  
63       out->MPIInfo = Paso_MPIInfo_getReference( mesh->MPIInfo );
64     return out;     return out;
65  }  }
66  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 70  Paso_SystemMatrixPattern* Finley_makePat Line 69  Paso_SystemMatrixPattern* Finley_makePat
69    index_t s,itmp,*rowLabel=NULL,*colLabel=NULL, *ptr=NULL, *index=NULL;    index_t s,itmp,*rowLabel=NULL,*colLabel=NULL, *ptr=NULL, *index=NULL;
70    Finley_IndexList* index_list=NULL;    Finley_IndexList* index_list=NULL;
71    Finley_resetError();    Finley_resetError();
72        Finley_NodeDistribution *row_degreeOfFreedomDistribution;
73      Finley_NodeDistribution *col_degreeOfFreedomDistribution;
74    
75    time0=Finley_timer();    time0=Finley_timer();
76    
77    #ifdef PASO_MPI
78      if (reduce_col_order) {
79           n=mesh->Nodes->reducedDegreeOfFreedomDistribution->numLocal;
80           colLabel=mesh->Nodes->reducedDegreeOfFreedom;
81      } else {
82           n=mesh->Nodes->degreeOfFreedomDistribution->numLocal;
83           colLabel=mesh->Nodes->degreeOfFreedom;
84      }
85        
86      if (reduce_row_order) {
87          n=mesh->Nodes->reducedDegreeOfFreedomDistribution->numLocal;
88          rowLabel=mesh->Nodes->reducedDegreeOfFreedom;
89      } else {
90          n=mesh->Nodes->degreeOfFreedomDistribution->numLocal;
91          rowLabel=mesh->Nodes->degreeOfFreedom;
92      }
93    #else
94    if (reduce_col_order) {    if (reduce_col_order) {
95         n=mesh->Nodes->reducedNumDegreesOfFreedom;         n=mesh->Nodes->reducedNumDegreesOfFreedom;
96         colLabel=mesh->Nodes->reducedDegreeOfFreedom;         colLabel=mesh->Nodes->reducedDegreeOfFreedom;
# Line 87  Paso_SystemMatrixPattern* Finley_makePat Line 106  Paso_SystemMatrixPattern* Finley_makePat
106        n=mesh->Nodes->numDegreesOfFreedom;        n=mesh->Nodes->numDegreesOfFreedom;
107        rowLabel=mesh->Nodes->degreeOfFreedom;        rowLabel=mesh->Nodes->degreeOfFreedom;
108    }    }
109    #endif
110    
111    index_list=TMPMEMALLOC(n,Finley_IndexList);    index_list=TMPMEMALLOC(n,Finley_IndexList);
112    ptr=MEMALLOC(n+1,index_t);    ptr=MEMALLOC(n+1,index_t);
# Line 99  Paso_SystemMatrixPattern* Finley_makePat Line 119  Paso_SystemMatrixPattern* Finley_makePat
119               index_list[i].n=0;               index_list[i].n=0;
120          }          }
121          /*  insert contributions from element matrices into colums index index_list: */          /*  insert contributions from element matrices into colums index index_list: */
122          Finley_IndexList_insertElements(index_list,mesh->Elements,      printf("ksteube mesh->Elements\n");
123            Finley_IndexList_insertElements(index_list,mesh,mesh->Elements,
124                                          reduce_row_order,rowLabel,reduce_col_order,colLabel);                                          reduce_row_order,rowLabel,reduce_col_order,colLabel);
125          Finley_IndexList_insertElements(index_list,mesh->FaceElements,      printf("ksteube mesh->FaceElements\n");
126            Finley_IndexList_insertElements(index_list,mesh,mesh->FaceElements,
127                                          reduce_row_order,rowLabel,reduce_col_order,colLabel);                                          reduce_row_order,rowLabel,reduce_col_order,colLabel);
128          Finley_IndexList_insertElements(index_list,mesh->ContactElements,      printf("ksteube mesh->ContactElements\n");
129            Finley_IndexList_insertElements(index_list,mesh,mesh->ContactElements,
130                                          reduce_row_order,rowLabel,reduce_col_order,colLabel);                                          reduce_row_order,rowLabel,reduce_col_order,colLabel);
131          Finley_IndexList_insertElements(index_list,mesh->Points,      printf("ksteube mesh->Points\n");
132            Finley_IndexList_insertElements(index_list,mesh,mesh->Points,
133                                          reduce_row_order,rowLabel,reduce_col_order,colLabel);                                          reduce_row_order,rowLabel,reduce_col_order,colLabel);
134        printf("ksteube done with 4 calls to Finley_IndexList_insertElements\n");
135          /* get the number of connections per row */          /* get the number of connections per row */
136          #pragma omp for schedule(static)          #pragma omp for schedule(static)
137          for(i=0;i<n;++i) {          for(i=0;i<n;++i) {
# Line 148  Paso_SystemMatrixPattern* Finley_makePat Line 173  Paso_SystemMatrixPattern* Finley_makePat
173      MEMFREE(index);      MEMFREE(index);
174      return NULL;      return NULL;
175    } else {    } else {
176      return Paso_SystemMatrixPattern_alloc(n,ptr,index);      Paso_SystemMatrixPattern *pattern = Paso_SystemMatrixPattern_alloc(MATRIX_FORMAT_DEFAULT,n,ptr,index,mesh->MPIInfo); /* add distr info */
177        // Use a getReference method to get the DOF distributions to avoid memory leaks
178        if (reduce_col_order) {
179          col_degreeOfFreedomDistribution = mesh->Nodes->reducedDegreeOfFreedomDistribution;
180        }
181        else {
182          col_degreeOfFreedomDistribution = mesh->Nodes->degreeOfFreedomDistribution;
183        }
184        if (reduce_row_order) {
185          row_degreeOfFreedomDistribution = mesh->Nodes->reducedDegreeOfFreedomDistribution;
186        }
187        else {
188          row_degreeOfFreedomDistribution = mesh->Nodes->degreeOfFreedomDistribution;
189        }
190        pattern->row_degreeOfFreedomDistribution = row_degreeOfFreedomDistribution;
191        pattern->col_degreeOfFreedomDistribution = col_degreeOfFreedomDistribution;
192        return pattern;
193    }    }
194  }  }
195  /*  /*

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

  ViewVC Help
Powered by ViewVC 1.1.26