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

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

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

temp/paso/src/SystemMatrixPattern.c revision 1387 by trankine, Fri Jan 11 07:45:26 2008 UTC trunk/paso/src/SystemMatrixPattern.c revision 1552 by gross, Thu May 8 08:52:41 2008 UTC
# Line 35  Paso_SystemMatrixPattern* Paso_SystemMat Line 35  Paso_SystemMatrixPattern* Paso_SystemMat
35                                                           Paso_Distribution *output_distribution,                                                           Paso_Distribution *output_distribution,
36                                                           Paso_Distribution *input_distribution,                                                           Paso_Distribution *input_distribution,
37                                                           Paso_Pattern* mainPattern,                                                           Paso_Pattern* mainPattern,
38                                                           Paso_Pattern* couplePattern,                                                           Paso_Pattern* col_couplePattern,
39                                                           Paso_Coupler* coupler)                                                           Paso_Pattern* row_couplePattern,
40                                                             Paso_Connector* col_connector,
41                                                             Paso_Connector* row_connector)
42  {  {
43    Paso_SystemMatrixPattern*out=NULL;    Paso_SystemMatrixPattern*out=NULL;
44      Paso_resetError();
45    
46      if (output_distribution->mpi_info != input_distribution->mpi_info ) {
47         Paso_setError(SYSTEM_ERROR,"Paso_SystemMatrixPattern_alloc: output_distribution and input_distribution mpi communicator don't match.");
48         return NULL;
49      }
50      if (output_distribution->mpi_info != col_connector->mpi_info ) {
51         Paso_setError(SYSTEM_ERROR,"Paso_SystemMatrixPattern_alloc: output_distribution and col_connector mpi communicator don't match.");
52         return NULL;
53      }
54      if (output_distribution->mpi_info != row_connector->mpi_info ) {
55         Paso_setError(SYSTEM_ERROR,"Paso_SystemMatrixPattern_alloc: output_distribution and row_connector mpi communicator don't match.");
56         return NULL;
57      }
58    
   Paso_resetError();  
59    
60    if (mainPattern->type != type)  {    if (mainPattern->type != type)  {
61        Paso_setError(VALUE_ERROR,"Paso_SystemMatrixPattern_alloc: type of mainPattern does not match expected type.");        Paso_setError(VALUE_ERROR,"Paso_SystemMatrixPattern_alloc: type of mainPattern does not match expected type.");
62    }    }
63    if (couplePattern->type != type)  {    if (col_couplePattern->type != type)  {
64        Paso_setError(VALUE_ERROR,"Paso_SystemMatrixPattern_alloc: type of couplePattern does not match expected type.");        Paso_setError(VALUE_ERROR,"Paso_SystemMatrixPattern_alloc: type of col_couplePattern does not match expected type.");
65      }
66      if (row_couplePattern->type != type)  {
67          Paso_setError(VALUE_ERROR,"Paso_SystemMatrixPattern_alloc: type of row_couplePattern does not match expected type.");
68    }    }
69    if ( couplePattern->numOutput != mainPattern->numOutput) {    if (col_couplePattern->numOutput != mainPattern->numOutput) {
70              Paso_setError(VALUE_ERROR,"Paso_SystemMatrixPattern_alloc: number of output for couple and main pattern don't match.");              Paso_setError(VALUE_ERROR,"Paso_SystemMatrixPattern_alloc: number of output for couple and main pattern don't match.");
71    }    }
72    if (mainPattern->numOutput !=  Paso_Distribution_getMyNumComponents(output_distribution)) {    if (mainPattern->numOutput !=  Paso_Distribution_getMyNumComponents(output_distribution)) {
73        Paso_setError(VALUE_ERROR,"Paso_SystemMatrixPattern_alloc: number of output and given distribution don't match.");        Paso_setError(VALUE_ERROR,"Paso_SystemMatrixPattern_alloc: number of output and given distribution don't match.");
74    }    }
75    if (mainPattern->numInput != Paso_Distribution_getMyNumComponents(input_distribution)) {    if (mainPattern->numInput != Paso_Distribution_getMyNumComponents(input_distribution)) {
76       Paso_setError(VALUE_ERROR,"Paso_SystemMatrixPattern_alloc: number of input for main pattern and number of send components in coupler don't match.");       Paso_setError(VALUE_ERROR,"Paso_SystemMatrixPattern_alloc: number of input for main pattern and number of send components in connector don't match.");
77    }    }
78    if (couplePattern->numInput != coupler->recv->numSharedComponents) {    if (col_couplePattern->numInput != col_connector->recv->numSharedComponents) {
79       Paso_setError(VALUE_ERROR,"Paso_SystemMatrixPattern_alloc: number of inputs for couple pattern and number of received components in coupler don't match.");       Paso_setError(VALUE_ERROR,"Paso_SystemMatrixPattern_alloc: number of inputs for column couple pattern and number of received components in connector don't match.");
80    }    }
81    if (mainPattern->output_block_size != couplePattern->output_block_size) {    if (row_couplePattern->numOutput != row_connector->recv->numSharedComponents) {
82       Paso_setError(VALUE_ERROR,"Paso_SystemMatrixPattern_alloc: output block sizes of main and couple pattern do not match.");       Paso_setError(VALUE_ERROR,"Paso_SystemMatrixPattern_alloc: number of inputs for row couple pattern and number of received components in connector don't match.");
83    }    }
84    if (mainPattern->input_block_size != couplePattern->input_block_size) {    if (mainPattern->output_block_size != col_couplePattern->output_block_size) {
85       Paso_setError(VALUE_ERROR,"Paso_SystemMatrixPattern_alloc: input block sizes of main and couple pattern do not match.");       Paso_setError(VALUE_ERROR,"Paso_SystemMatrixPattern_alloc: output block sizes of main and column couple pattern do not match.");
86      }
87      if (mainPattern->input_block_size != col_couplePattern->input_block_size) {
88         Paso_setError(VALUE_ERROR,"Paso_SystemMatrixPattern_alloc: input block sizes of main and column couple pattern do not match.");
89      }
90      if (mainPattern->output_block_size != row_couplePattern->output_block_size) {
91         Paso_setError(VALUE_ERROR,"Paso_SystemMatrixPattern_alloc: output block sizes of main and row couple pattern do not match.");
92      }
93      if (mainPattern->input_block_size != col_couplePattern->input_block_size) {
94         Paso_setError(VALUE_ERROR,"Paso_SystemMatrixPattern_alloc: input block sizes of main and row couple pattern do not match.");
95    }    }
96    
97    out=MEMALLOC(1,Paso_SystemMatrixPattern);    out=MEMALLOC(1,Paso_SystemMatrixPattern);
# Line 73  Paso_SystemMatrixPattern* Paso_SystemMat Line 99  Paso_SystemMatrixPattern* Paso_SystemMat
99    out->type=type;    out->type=type;
100    out->reference_counter=1;    out->reference_counter=1;
101    out->mainPattern=Paso_Pattern_getReference(mainPattern);    out->mainPattern=Paso_Pattern_getReference(mainPattern);
102    out->couplePattern=Paso_Pattern_getReference(couplePattern);    out->row_couplePattern=Paso_Pattern_getReference(row_couplePattern);
103    out->coupler=Paso_Coupler_getReference(coupler);    out->col_couplePattern=Paso_Pattern_getReference(col_couplePattern);
104      out->row_connector=Paso_Connector_getReference(row_connector);
105      out->col_connector=Paso_Connector_getReference(col_connector);
106    out->output_distribution=Paso_Distribution_getReference(output_distribution);    out->output_distribution=Paso_Distribution_getReference(output_distribution);
107    out->input_distribution=Paso_Distribution_getReference(input_distribution);    out->input_distribution=Paso_Distribution_getReference(input_distribution);
108    out->mpi_info= Paso_MPIInfo_getReference(coupler->mpi_info);    out->mpi_info= Paso_MPIInfo_getReference(output_distribution->mpi_info);
109    #ifdef Paso_TRACE    #ifdef Paso_TRACE
110    printf("Paso_SystemMatrixPattern_dealloc: system matrix pattern as been allocated.\n");    printf("Paso_SystemMatrixPattern_dealloc: system matrix pattern as been allocated.\n");
111    #endif    #endif
# Line 100  void Paso_SystemMatrixPattern_free(Paso_ Line 128  void Paso_SystemMatrixPattern_free(Paso_
128       in->reference_counter--;       in->reference_counter--;
129       if (in->reference_counter<=0) {       if (in->reference_counter<=0) {
130          Paso_Pattern_free(in->mainPattern);          Paso_Pattern_free(in->mainPattern);
131          Paso_Pattern_free(in->couplePattern);          Paso_Pattern_free(in->row_couplePattern);
132          Paso_Coupler_free(in->coupler);          Paso_Pattern_free(in->col_couplePattern);
133            Paso_Connector_free(in->row_connector);
134            Paso_Connector_free(in->col_connector);
135          Paso_Distribution_free(in->output_distribution);          Paso_Distribution_free(in->output_distribution);
136          Paso_Distribution_free(in->input_distribution);          Paso_Distribution_free(in->input_distribution);
137          Paso_MPIInfo_free(in->mpi_info);          Paso_MPIInfo_free(in->mpi_info);
# Line 119  dim_t Paso_SystemMatrixPattern_getNumOut Line 149  dim_t Paso_SystemMatrixPattern_getNumOut
149         return in->mainPattern->numOutput;         return in->mainPattern->numOutput;
150      }      }
151  }  }
   

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

  ViewVC Help
Powered by ViewVC 1.1.26