/[escript]/trunk/paso/src/SystemMatrixPattern_unrollBlocks.c
ViewVC logotype

Diff of /trunk/paso/src/SystemMatrixPattern_unrollBlocks.c

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

revision 2550 by jfenwick, Mon Jul 20 06:20:06 2009 UTC revision 2551 by gross, Thu Jul 23 09:19:15 2009 UTC
# Line 28  Line 28 
28    
29  /* creates SystemMatrixPattern  */  /* creates SystemMatrixPattern  */
30    
31    
32  Paso_SystemMatrixPattern* Paso_SystemMatrixPattern_unrollBlocks(Paso_SystemMatrixPattern* pattern,  Paso_SystemMatrixPattern* Paso_SystemMatrixPattern_unrollBlocks(Paso_SystemMatrixPattern* pattern,
33                                             int type, dim_t output_block_size,dim_t input_block_size) {                                             int type, dim_t output_block_size,dim_t input_block_size) {
34    Paso_SystemMatrixPattern*out=NULL;    Paso_SystemMatrixPattern*out=NULL;
# Line 35  Paso_SystemMatrixPattern* Paso_SystemMat Line 36  Paso_SystemMatrixPattern* Paso_SystemMat
36    Paso_Distribution* new_output_distribution=NULL, *new_input_distribution=NULL;    Paso_Distribution* new_output_distribution=NULL, *new_input_distribution=NULL;
37    Paso_Connector *new_col_connector=NULL, *new_row_connector=NULL;    Paso_Connector *new_col_connector=NULL, *new_row_connector=NULL;
38    
39    new_mainPattern=Paso_Pattern_unrollBlocks(pattern->mainPattern,type,output_block_size,input_block_size);    if ( ( output_block_size == 1 ) && (input_block_size == 1) && ((pattern->type & PATTERN_FORMAT_OFFSET1) == (type & PATTERN_FORMAT_OFFSET1) ) ) {
40    new_col_couplePattern=Paso_Pattern_unrollBlocks(pattern->col_couplePattern,type,output_block_size,input_block_size);       out = Paso_SystemMatrixPattern_getReference(pattern);
41    new_row_couplePattern=Paso_Pattern_unrollBlocks(pattern->row_couplePattern,type,output_block_size,input_block_size);    } else {
42    new_output_distribution=Paso_Distribution_alloc(pattern->output_distribution->mpi_info,       new_mainPattern=Paso_Pattern_unrollBlocks(pattern->mainPattern,type,output_block_size,input_block_size);
43                                                    pattern->output_distribution->first_component,       new_col_couplePattern=Paso_Pattern_unrollBlocks(pattern->col_couplePattern,type,output_block_size,input_block_size);
44                                                    output_block_size,0);       new_row_couplePattern=Paso_Pattern_unrollBlocks(pattern->row_couplePattern,type,output_block_size,input_block_size);
45    new_input_distribution=Paso_Distribution_alloc(pattern->input_distribution->mpi_info,       if (output_block_size>1) {
46                                                    pattern->input_distribution->first_component,            new_output_distribution=Paso_Distribution_alloc(pattern->output_distribution->mpi_info,
47                                                    input_block_size,0);                                                            pattern->output_distribution->first_component,
48    new_col_connector=Paso_Connector_unroll(pattern->col_connector,input_block_size);                                                            output_block_size,0);
49    new_row_connector=Paso_Connector_unroll(pattern->row_connector,output_block_size);            new_row_connector=Paso_Connector_unroll(pattern->row_connector,output_block_size);
50    if (Paso_noError()) {       } else {
51       out=Paso_SystemMatrixPattern_alloc(type,            new_output_distribution=Paso_Distribution_getReference(pattern->output_distribution);
52                                          new_output_distribution,            new_row_connector= Paso_Connector_getReference(pattern->row_connector);
53                                          new_input_distribution,       }
54                                          new_mainPattern,       if (input_block_size>1) {
55                                          new_col_couplePattern,            new_input_distribution=Paso_Distribution_alloc(pattern->input_distribution->mpi_info,
56                                          new_row_couplePattern,                                                            pattern->input_distribution->first_component,
57                                          new_col_connector,                                                            input_block_size,0);
58                                          new_row_connector);            new_col_connector=Paso_Connector_unroll(pattern->col_connector,input_block_size);
59         } else {
60              new_input_distribution=Paso_Distribution_getReference(pattern->input_distribution);
61              new_col_connector=Paso_Connector_getReference(pattern->col_connector);
62         }
63         if (Paso_noError()) {
64            out=Paso_SystemMatrixPattern_alloc(type,
65                                               new_output_distribution,
66                                               new_input_distribution,
67                                               new_mainPattern,
68                                               new_col_couplePattern,
69                                               new_row_couplePattern,
70                                               new_col_connector,
71                                               new_row_connector);
72         }
73         Paso_Pattern_free(new_mainPattern);
74         Paso_Pattern_free(new_col_couplePattern);
75         Paso_Pattern_free(new_row_couplePattern);
76         Paso_Distribution_free(new_output_distribution);
77         Paso_Distribution_free(new_input_distribution);
78         Paso_Connector_free(new_row_connector);
79         Paso_Connector_free(new_col_connector);
80    }    }
   Paso_Pattern_free(new_mainPattern);  
   Paso_Pattern_free(new_col_couplePattern);  
   Paso_Pattern_free(new_row_couplePattern);  
   Paso_Distribution_free(new_output_distribution);  
   Paso_Distribution_free(new_input_distribution);  
   Paso_Connector_free(new_row_connector);  
   Paso_Connector_free(new_col_connector);  
   
81    if (Paso_noError()) {    if (Paso_noError()) {
82       return out;        return out;
83    } else {    } else {
84       Paso_SystemMatrixPattern_free(out);       Paso_SystemMatrixPattern_free(out);
85       return NULL;       return NULL;

Legend:
Removed from v.2550  
changed lines
  Added in v.2551

  ViewVC Help
Powered by ViewVC 1.1.26