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

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

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

revision 3792 by caltinay, Thu Oct 27 03:41:51 2011 UTC revision 3793 by gross, Wed Feb 1 07:39:43 2012 UTC
# Line 39  void Paso_TransportProblem_free(Paso_Tra Line 39  void Paso_TransportProblem_free(Paso_Tra
39             Paso_SystemMatrix_free(in->mass_matrix);             Paso_SystemMatrix_free(in->mass_matrix);
40             Paso_SystemMatrix_free(in->iteration_matrix);             Paso_SystemMatrix_free(in->iteration_matrix);
41             Esys_MPIInfo_free(in->mpi_info);             Esys_MPIInfo_free(in->mpi_info);
            Paso_Coupler_free(in->u_coupler);  
42             MEMFREE(in->constraint_weights);             MEMFREE(in->constraint_weights);
43             MEMFREE(in->reactive_matrix);             MEMFREE(in->reactive_matrix);
44             MEMFREE(in->main_diagonal_mass_matrix);             MEMFREE(in->main_diagonal_mass_matrix);
# Line 57  Paso_TransportProblem* Paso_TransportPro Line 56  Paso_TransportProblem* Paso_TransportPro
56       return in;       return in;
57  }      }    
58    
59  Paso_SystemMatrix* Paso_TransportProblem_borrowTransportMatrix(Paso_TransportProblem* in) {  Paso_TransportProblem* Paso_TransportProblem_alloc(Paso_SystemMatrixPattern *pattern, const int block_size)
    return in->transport_matrix;  
 }  
 Paso_SystemMatrix* Paso_TransportProblem_borrowMassMatrix(Paso_TransportProblem* in) {  
    return in->mass_matrix;  
 }  
   
 double* Paso_TransportProblem_borrowLumpedMassMatrix(Paso_TransportProblem* in) {  
     return in->lumped_mass_matrix;  
 }  
   
 dim_t Paso_TransportProblem_getTotalNumRows(Paso_TransportProblem* in) {  
     return Paso_SystemMatrix_getTotalNumRows(in->transport_matrix);  
 }  
   
 Paso_TransportProblem* Paso_TransportProblem_alloc(bool_t useBackwardEuler, Paso_SystemMatrixPattern *pattern, int block_size)  
60  {  {
61       Paso_SystemMatrixType matrix_type=MATRIX_FORMAT_DEFAULT+MATRIX_FORMAT_BLK1;  /* at the moment only block size 1 is supported */       Paso_SystemMatrixType matrix_type=MATRIX_FORMAT_DEFAULT+MATRIX_FORMAT_BLK1;  /* at the moment only block size 1 is supported */
62       Paso_TransportProblem* out=NULL;       Paso_TransportProblem* out=NULL;
63       dim_t n,i;       dim_t n,i;
64        
65       out=MEMALLOC(1,Paso_TransportProblem);       out=MEMALLOC(1,Paso_TransportProblem);
66       if (Esys_checkPtr(out)) return NULL;       if (Esys_checkPtr(out)) return NULL;
67       out->reference_counter=0;       out->reference_counter=0;
68       out->useBackwardEuler=useBackwardEuler;       out->dt_max_R=LARGE_POSITIVE_FLOAT;
69       out->dt_max=LARGE_POSITIVE_FLOAT;       out->dt_max_T=LARGE_POSITIVE_FLOAT;
70       out->dt_failed=LARGE_POSITIVE_FLOAT;      
71              
72    
73  /****************** REVISE ****************************/  /****************** REVISE ****************************/
74       out->constraint_factor=sqrt(LARGE_POSITIVE_FLOAT);       out->constraint_factor=sqrt(LARGE_POSITIVE_FLOAT);
75       if (out->useBackwardEuler) {  
76              out->dt_factor=DT_FACTOR_MAX;       out->dt_factor=2.;
      } else {  
             out->dt_factor=2.;  
      }  
77  /*****************************************************/  /*****************************************************/
78       out->valid_matrices=FALSE;       out->valid_matrices=FALSE;
79       out->transport_matrix=Paso_SystemMatrix_alloc(matrix_type,pattern,block_size,block_size,FALSE);       out->transport_matrix=Paso_SystemMatrix_alloc(matrix_type,pattern,block_size,block_size,FALSE);
# Line 106  Paso_TransportProblem* Paso_TransportPro Line 89  Paso_TransportProblem* Paso_TransportPro
89    
90       if (Esys_noError()) {       if (Esys_noError()) {
91           n=Paso_SystemMatrix_getTotalNumRows(out->transport_matrix);           n=Paso_SystemMatrix_getTotalNumRows(out->transport_matrix);
92           out->constraint_weights=MEMALLOC(n,double);           out->constraint_weights=MEMALLOC(n,double); /* ? */
93           out->lumped_mass_matrix=MEMALLOC(n,double);           out->lumped_mass_matrix=MEMALLOC(n,double);  /* ? */
94           out->reactive_matrix=MEMALLOC(n,double);;           out->reactive_matrix=MEMALLOC(n,double); /* ? */
95           out->main_diagonal_mass_matrix=MEMALLOC(n,double);             out->main_diagonal_mass_matrix=MEMALLOC(n,double); /* ? */  
96           out->main_diagonal_low_order_transport_matrix=MEMALLOC(n,double);           out->main_diagonal_low_order_transport_matrix=MEMALLOC(n,double); /* ? */
97           out->u_coupler=Paso_Coupler_alloc(Paso_TransportProblem_borrowConnector(out),block_size);  
98    
99           if ( ! (Esys_checkPtr(out->constraint_weights) ||           if ( ! (Esys_checkPtr(out->constraint_weights) ||
100               Esys_checkPtr(out->reactive_matrix) || Esys_checkPtr(out->main_diagonal_mass_matrix) ||               Esys_checkPtr(out->reactive_matrix) || Esys_checkPtr(out->main_diagonal_mass_matrix) ||
# Line 141  void Paso_TransportProblem_reset(Paso_Tr Line 124  void Paso_TransportProblem_reset(Paso_Tr
124      in->valid_matrices=FALSE;      in->valid_matrices=FALSE;
125  }  }
126    
 dim_t Paso_TransportProblem_getBlockSize(const Paso_TransportProblem* in)  
 {  
    return in->transport_matrix->row_block_size;  
 }  
   
 Paso_Connector* Paso_TransportProblem_borrowConnector(const Paso_TransportProblem* in)  
 {  
    return in->transport_matrix->pattern->col_connector;  
 }  
127    
128  index_t Paso_TransportProblem_getTypeId(const index_t solver,const index_t preconditioner, const index_t package,const  bool_t symmetry, Esys_MPIInfo *mpi_info)  index_t Paso_TransportProblem_getTypeId(const index_t solver,const index_t preconditioner, const index_t package,const  bool_t symmetry, Esys_MPIInfo *mpi_info)
129  {  {

Legend:
Removed from v.3792  
changed lines
  Added in v.3793

  ViewVC Help
Powered by ViewVC 1.1.26