/[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 3258 by gross, Mon May 10 06:23:49 2010 UTC revision 3259 by jfenwick, Mon Oct 11 01:48:14 2010 UTC
# Line 38  void Paso_TransportProblem_free(Paso_Tra Line 38  void Paso_TransportProblem_free(Paso_Tra
38             Paso_SystemMatrix_free(in->transport_matrix);             Paso_SystemMatrix_free(in->transport_matrix);
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             Paso_MPIInfo_free(in->mpi_info);             Esys_MPIInfo_free(in->mpi_info);
42             Paso_Coupler_free(in->u_coupler);             Paso_Coupler_free(in->u_coupler);
43             MEMFREE(in->constraint_weights);             MEMFREE(in->constraint_weights);
44             MEMFREE(in->reactive_matrix);             MEMFREE(in->reactive_matrix);
# Line 80  Paso_TransportProblem* Paso_TransportPro Line 80  Paso_TransportProblem* Paso_TransportPro
80       dim_t n,i;       dim_t n,i;
81    
82       out=MEMALLOC(1,Paso_TransportProblem);       out=MEMALLOC(1,Paso_TransportProblem);
83       if (Paso_checkPtr(out)) return NULL;       if (Esys_checkPtr(out)) return NULL;
84       out->reference_counter=0;       out->reference_counter=0;
85       out->useBackwardEuler=useBackwardEuler;       out->useBackwardEuler=useBackwardEuler;
86       out->dt_max=LARGE_POSITIVE_FLOAT;       out->dt_max=LARGE_POSITIVE_FLOAT;
# Line 98  Paso_TransportProblem* Paso_TransportPro Line 98  Paso_TransportProblem* Paso_TransportPro
98       out->mass_matrix=Paso_SystemMatrix_alloc(matrix_type,pattern,block_size,block_size,FALSE);       out->mass_matrix=Paso_SystemMatrix_alloc(matrix_type,pattern,block_size,block_size,FALSE);
99       out->iteration_matrix=NULL;       out->iteration_matrix=NULL;
100       out->constraint_weights=NULL;       out->constraint_weights=NULL;
101       out->mpi_info=Paso_MPIInfo_getReference(pattern->mpi_info);       out->mpi_info=Esys_MPIInfo_getReference(pattern->mpi_info);
102    
103       out->lumped_mass_matrix=NULL;       out->lumped_mass_matrix=NULL;
104       out->main_diagonal_low_order_transport_matrix=NULL;       out->main_diagonal_low_order_transport_matrix=NULL;
105       out->reactive_matrix=NULL;       out->reactive_matrix=NULL;
106       out->main_diagonal_mass_matrix=NULL;       out->main_diagonal_mass_matrix=NULL;
107    
108       if (Paso_noError()) {       if (Esys_noError()) {
109           n=Paso_SystemMatrix_getTotalNumRows(out->transport_matrix);           n=Paso_SystemMatrix_getTotalNumRows(out->transport_matrix);
110           transport_pattern=out->transport_matrix->pattern;           transport_pattern=out->transport_matrix->pattern;
111           out->constraint_weights=MEMALLOC(n,double);           out->constraint_weights=MEMALLOC(n,double);
# Line 115  Paso_TransportProblem* Paso_TransportPro Line 115  Paso_TransportProblem* Paso_TransportPro
115           out->main_diagonal_low_order_transport_matrix=MEMALLOC(n,double);           out->main_diagonal_low_order_transport_matrix=MEMALLOC(n,double);
116           out->u_coupler=Paso_Coupler_alloc(Paso_TransportProblem_borrowConnector(out),block_size);           out->u_coupler=Paso_Coupler_alloc(Paso_TransportProblem_borrowConnector(out),block_size);
117    
118           if ( ! (Paso_checkPtr(out->constraint_weights) ||           if ( ! (Esys_checkPtr(out->constraint_weights) ||
119               Paso_checkPtr(out->reactive_matrix) || Paso_checkPtr(out->main_diagonal_mass_matrix) ||               Esys_checkPtr(out->reactive_matrix) || Esys_checkPtr(out->main_diagonal_mass_matrix) ||
120                   Paso_checkPtr(out->lumped_mass_matrix) || Paso_checkPtr(out->main_diagonal_low_order_transport_matrix)) && Paso_noError()  )                   Esys_checkPtr(out->lumped_mass_matrix) || Esys_checkPtr(out->main_diagonal_low_order_transport_matrix)) && Esys_noError()  )
121       {       {
122                   #pragma omp parallel for schedule(static) private(i)                   #pragma omp parallel for schedule(static) private(i)
123                   for (i = 0; i < n; ++i) {                   for (i = 0; i < n; ++i) {
# Line 126  Paso_TransportProblem* Paso_TransportPro Line 126  Paso_TransportProblem* Paso_TransportPro
126                   }                   }
127       }       }
128    }    }
129    if (Paso_noError()) {    if (Esys_noError()) {
130       out->reference_counter=1;       out->reference_counter=1;
131       return out;       return out;
132    } else {    } else {
# Line 153  Paso_Connector* Paso_TransportProblem_bo Line 153  Paso_Connector* Paso_TransportProblem_bo
153     return in->transport_matrix->pattern->col_connector;     return in->transport_matrix->pattern->col_connector;
154  }  }
155    
156  index_t Paso_TransportProblem_getTypeId(const index_t solver,const index_t preconditioner, const index_t package,const  bool_t symmetry, Paso_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)
157  {  {
158     return MATRIX_FORMAT_DEFAULT + MATRIX_FORMAT_BLK1;     return MATRIX_FORMAT_DEFAULT + MATRIX_FORMAT_BLK1;
159  }  }
# Line 168  void Paso_TransportProblem_setUpConstrai Line 168  void Paso_TransportProblem_setUpConstrai
168     const index_t* main_iptr=Paso_SparseMatrix_borrowMainDiagonalPointer(fctp->mass_matrix->mainBlock);     const index_t* main_iptr=Paso_SparseMatrix_borrowMainDiagonalPointer(fctp->mass_matrix->mainBlock);
169        
170     if ( fctp->valid_matrices ) {     if ( fctp->valid_matrices ) {
171        Paso_setError(VALUE_ERROR, "Paso_TransportProblem_insertConstraint: you must not insert a constraint is a valid system.");        Esys_setError(VALUE_ERROR, "Paso_TransportProblem_insertConstraint: you must not insert a constraint is a valid system.");
172        return;        return;
173     }     }
174     if (factor<=0) {     if (factor<=0) {
175        Paso_setError(VALUE_ERROR, "Paso_TransportProblem_insertConstraint: constraint_factor needs to be positive.");        Esys_setError(VALUE_ERROR, "Paso_TransportProblem_insertConstraint: constraint_factor needs to be positive.");
176        return;        return;
177     }     }
178    

Legend:
Removed from v.3258  
changed lines
  Added in v.3259

  ViewVC Help
Powered by ViewVC 1.1.26