escript
Revision_
|
00001 00002 /***************************************************************************** 00003 * 00004 * Copyright (c) 2003-2014 by University of Queensland 00005 * http://www.uq.edu.au 00006 * 00007 * Primary Business: Queensland, Australia 00008 * Licensed under the Open Software License version 3.0 00009 * http://www.opensource.org/licenses/osl-3.0.php 00010 * 00011 * Development until 2012 by Earth Systems Science Computational Center (ESSCC) 00012 * Development 2012-2013 by School of Earth Sciences 00013 * Development from 2014 by Centre for Geoscience Computing (GeoComp) 00014 * 00015 *****************************************************************************/ 00016 00017 00018 #ifndef __PASO_TRANSPORT_H__ 00019 #define __PASO_TRANSPORT_H__ 00020 00021 #define DT_FACTOR_MAX 100000. 00022 00023 #include "SystemMatrix.h" 00024 #include "Options.h" 00025 00026 namespace paso { 00027 00028 struct TransportProblem; 00029 typedef boost::shared_ptr<TransportProblem> TransportProblem_ptr; 00030 typedef boost::shared_ptr<const TransportProblem> const_TransportProblem_ptr; 00031 00032 PASO_DLL_API 00033 struct TransportProblem : boost::enable_shared_from_this<TransportProblem> 00034 { 00035 TransportProblem(SystemMatrixPattern_ptr pattern, int block_size); 00036 ~TransportProblem(); 00037 00038 void reset(); 00039 00040 void solve(double* u, double dt, double* u0, double* q, Options* options); 00041 00042 double getSafeTimeStepSize(); 00043 00044 void insertConstraint(const double* r, double* source); 00045 00046 void setUpConstraint(const double* q); 00047 00048 inline dim_t getBlockSize() const 00049 { 00050 return transport_matrix->row_block_size; 00051 } 00052 00053 inline SystemMatrix_ptr borrowTransportMatrix() const 00054 { 00055 return transport_matrix; 00056 } 00057 00058 inline SystemMatrix_ptr borrowMassMatrix() const 00059 { 00060 return mass_matrix; 00061 } 00062 00063 inline double* borrowLumpedMassMatrix() const 00064 { 00065 return lumped_mass_matrix; 00066 } 00067 00068 inline dim_t getTotalNumRows() const 00069 { 00070 return transport_matrix->getTotalNumRows(); 00071 } 00072 00073 inline Connector_ptr borrowConnector() const 00074 { 00075 return transport_matrix->pattern->col_connector; 00076 } 00077 00078 inline index_t* borrowMainDiagonalPointer() const 00079 { 00080 return mass_matrix->mainBlock->borrowMainDiagonalPointer(); 00081 } 00082 00083 inline static index_t getTypeId(index_t solver, index_t preconditioner, 00084 index_t package, bool symmetry, 00085 Esys_MPIInfo* mpi_info) 00086 { 00087 return MATRIX_FORMAT_DEFAULT + MATRIX_FORMAT_BLK1; 00088 } 00089 00090 SystemMatrix_ptr transport_matrix; 00091 SystemMatrix_ptr mass_matrix; 00092 SystemMatrix_ptr iteration_matrix; 00093 00094 bool valid_matrices; 00096 double dt_max_R; 00098 double dt_max_T; 00099 double* constraint_mask; 00100 00101 double* main_diagonal_low_order_transport_matrix; 00105 double* lumped_mass_matrix; 00106 double* reactive_matrix; 00107 double* main_diagonal_mass_matrix; 00108 00109 Esys_MPIInfo* mpi_info; 00110 }; 00111 00112 } // namespace paso 00113 00114 #endif // __PASO_TRANSPORT_H__ 00115