/[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 1811 by ksteube, Thu Sep 25 23:11:13 2008 UTC
# Line 1  Line 1 
1    
 /* $Id$ */  
   
2  /*******************************************************  /*******************************************************
3   *  *
4   *           Copyright 2003-2007 by ACceSS MNRF  * Copyright (c) 2003-2008 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 19  Line 18 
18    
19  /**************************************************************/  /**************************************************************/
20    
 /* Copyrights by ACcESS Australia 2003, 2004,2005, 2006, 2007 */  
21  /* Author: gross@access.edu.au */  /* Author: gross@access.edu.au */
22    
23  /**************************************************************/  /**************************************************************/
# Line 35  Paso_SystemMatrixPattern* Paso_SystemMat Line 33  Paso_SystemMatrixPattern* Paso_SystemMat
33                                                           Paso_Distribution *output_distribution,                                                           Paso_Distribution *output_distribution,
34                                                           Paso_Distribution *input_distribution,                                                           Paso_Distribution *input_distribution,
35                                                           Paso_Pattern* mainPattern,                                                           Paso_Pattern* mainPattern,
36                                                           Paso_Pattern* couplePattern,                                                           Paso_Pattern* col_couplePattern,
37                                                           Paso_Coupler* coupler)                                                           Paso_Pattern* row_couplePattern,
38                                                             Paso_Connector* col_connector,
39                                                             Paso_Connector* row_connector)
40  {  {
41    Paso_SystemMatrixPattern*out=NULL;    Paso_SystemMatrixPattern*out=NULL;
42      Paso_resetError();
43    
44      if (output_distribution->mpi_info != input_distribution->mpi_info ) {
45         Paso_setError(SYSTEM_ERROR,"Paso_SystemMatrixPattern_alloc: output_distribution and input_distribution mpi communicator don't match.");
46         return NULL;
47      }
48      if (output_distribution->mpi_info != col_connector->mpi_info ) {
49         Paso_setError(SYSTEM_ERROR,"Paso_SystemMatrixPattern_alloc: output_distribution and col_connector mpi communicator don't match.");
50         return NULL;
51      }
52      if (output_distribution->mpi_info != row_connector->mpi_info ) {
53         Paso_setError(SYSTEM_ERROR,"Paso_SystemMatrixPattern_alloc: output_distribution and row_connector mpi communicator don't match.");
54         return NULL;
55      }
56    
   Paso_resetError();  
57    
58    if (mainPattern->type != type)  {    if (mainPattern->type != type)  {
59        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.");
60    }    }
61    if (couplePattern->type != type)  {    if (col_couplePattern->type != type)  {
62        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.");
63    }    }
64    if ( couplePattern->numOutput != mainPattern->numOutput) {    if (row_couplePattern->type != type)  {
65          Paso_setError(VALUE_ERROR,"Paso_SystemMatrixPattern_alloc: type of row_couplePattern does not match expected type.");
66      }
67      if (col_couplePattern->numOutput != mainPattern->numOutput) {
68              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.");
69    }    }
70    if (mainPattern->numOutput !=  Paso_Distribution_getMyNumComponents(output_distribution)) {    if (mainPattern->numOutput !=  Paso_Distribution_getMyNumComponents(output_distribution)) {
71        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.");
72    }    }
73    if (mainPattern->numInput != Paso_Distribution_getMyNumComponents(input_distribution)) {    if (mainPattern->numInput != Paso_Distribution_getMyNumComponents(input_distribution)) {
74       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.");
75      }
76      if (col_couplePattern->numInput != col_connector->recv->numSharedComponents) {
77         Paso_setError(VALUE_ERROR,"Paso_SystemMatrixPattern_alloc: number of inputs for column couple pattern and number of received components in connector don't match.");
78      }
79      if (row_couplePattern->numOutput != row_connector->recv->numSharedComponents) {
80         Paso_setError(VALUE_ERROR,"Paso_SystemMatrixPattern_alloc: number of inputs for row couple pattern and number of received components in connector don't match.");
81    }    }
82    if (couplePattern->numInput != coupler->recv->numSharedComponents) {    if (mainPattern->output_block_size != col_couplePattern->output_block_size) {
83       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: output block sizes of main and column couple pattern do not match.");
84    }    }
85    if (mainPattern->output_block_size != couplePattern->output_block_size) {    if (mainPattern->input_block_size != col_couplePattern->input_block_size) {
86       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: input block sizes of main and column couple pattern do not match.");
87    }    }
88    if (mainPattern->input_block_size != couplePattern->input_block_size) {    if (mainPattern->output_block_size != row_couplePattern->output_block_size) {
89       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 row couple pattern do not match.");
90      }
91      if (mainPattern->input_block_size != col_couplePattern->input_block_size) {
92         Paso_setError(VALUE_ERROR,"Paso_SystemMatrixPattern_alloc: input block sizes of main and row couple pattern do not match.");
93    }    }
94    
95    out=MEMALLOC(1,Paso_SystemMatrixPattern);    out=MEMALLOC(1,Paso_SystemMatrixPattern);
# Line 73  Paso_SystemMatrixPattern* Paso_SystemMat Line 97  Paso_SystemMatrixPattern* Paso_SystemMat
97    out->type=type;    out->type=type;
98    out->reference_counter=1;    out->reference_counter=1;
99    out->mainPattern=Paso_Pattern_getReference(mainPattern);    out->mainPattern=Paso_Pattern_getReference(mainPattern);
100    out->couplePattern=Paso_Pattern_getReference(couplePattern);    out->row_couplePattern=Paso_Pattern_getReference(row_couplePattern);
101    out->coupler=Paso_Coupler_getReference(coupler);    out->col_couplePattern=Paso_Pattern_getReference(col_couplePattern);
102      out->row_connector=Paso_Connector_getReference(row_connector);
103      out->col_connector=Paso_Connector_getReference(col_connector);
104    out->output_distribution=Paso_Distribution_getReference(output_distribution);    out->output_distribution=Paso_Distribution_getReference(output_distribution);
105    out->input_distribution=Paso_Distribution_getReference(input_distribution);    out->input_distribution=Paso_Distribution_getReference(input_distribution);
106    out->mpi_info= Paso_MPIInfo_getReference(coupler->mpi_info);    out->mpi_info= Paso_MPIInfo_getReference(output_distribution->mpi_info);
107    #ifdef Paso_TRACE    #ifdef Paso_TRACE
108    printf("Paso_SystemMatrixPattern_dealloc: system matrix pattern as been allocated.\n");    printf("Paso_SystemMatrixPattern_dealloc: system matrix pattern as been allocated.\n");
109    #endif    #endif
# Line 100  void Paso_SystemMatrixPattern_free(Paso_ Line 126  void Paso_SystemMatrixPattern_free(Paso_
126       in->reference_counter--;       in->reference_counter--;
127       if (in->reference_counter<=0) {       if (in->reference_counter<=0) {
128          Paso_Pattern_free(in->mainPattern);          Paso_Pattern_free(in->mainPattern);
129          Paso_Pattern_free(in->couplePattern);          Paso_Pattern_free(in->row_couplePattern);
130          Paso_Coupler_free(in->coupler);          Paso_Pattern_free(in->col_couplePattern);
131            Paso_Connector_free(in->row_connector);
132            Paso_Connector_free(in->col_connector);
133          Paso_Distribution_free(in->output_distribution);          Paso_Distribution_free(in->output_distribution);
134          Paso_Distribution_free(in->input_distribution);          Paso_Distribution_free(in->input_distribution);
135          Paso_MPIInfo_free(in->mpi_info);          Paso_MPIInfo_free(in->mpi_info);
# Line 119  dim_t Paso_SystemMatrixPattern_getNumOut Line 147  dim_t Paso_SystemMatrixPattern_getNumOut
147         return in->mainPattern->numOutput;         return in->mainPattern->numOutput;
148      }      }
149  }  }
   

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

  ViewVC Help
Powered by ViewVC 1.1.26