/[escript]/branches/pasoc/paso/src/FluxLimiter.cpp
ViewVC logotype

Diff of /branches/pasoc/paso/src/FluxLimiter.cpp

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

revision 6561 by jfenwick, Fri May 12 05:51:39 2017 UTC revision 6562 by jfenwick, Fri May 12 08:15:37 2017 UTC
# Line 29  Line 29 
29    
30  namespace paso {  namespace paso {
31    
32  FCT_FluxLimiter::FCT_FluxLimiter(const_TransportProblem_ptr tp)  template <class T>
33    FCT_FluxLimiter<T>::FCT_FluxLimiter(const_TransportProblem_ptr<T> tp)
34  {  {
35      const dim_t n = tp->transport_matrix->getTotalNumRows();      const dim_t n = tp->transport_matrix->getTotalNumRows();
36      const dim_t blockSize = tp->getBlockSize();      const dim_t blockSize = tp->getBlockSize();
# Line 39  FCT_FluxLimiter::FCT_FluxLimiter(const_T Line 40  FCT_FluxLimiter::FCT_FluxLimiter(const_T
40      MQ = new double[2*n];      MQ = new double[2*n];
41      R = new double[2*n];      R = new double[2*n];
42    
43      R_coupler.reset(new Coupler(tp->borrowConnector(), 2*blockSize, mpi_info));      R_coupler.reset(new Coupler<T>(tp->borrowConnector(), 2*blockSize, mpi_info));
44      u_tilde_coupler.reset(new Coupler(tp->borrowConnector(), blockSize, mpi_info));      u_tilde_coupler.reset(new Coupler<T>(tp->borrowConnector(), blockSize, mpi_info));
45      antidiffusive_fluxes.reset(new SystemMatrix(      antidiffusive_fluxes.reset(new SystemMatrix<T>(
46                  tp->transport_matrix->type, tp->transport_matrix->pattern,                  tp->transport_matrix->type, tp->transport_matrix->pattern,
47                  tp->transport_matrix->row_block_size,                  tp->transport_matrix->row_block_size,
48                  tp->transport_matrix->col_block_size, true,                  tp->transport_matrix->col_block_size, true,
# Line 50  FCT_FluxLimiter::FCT_FluxLimiter(const_T Line 51  FCT_FluxLimiter::FCT_FluxLimiter(const_T
51      borrowed_lumped_mass_matrix = tp->lumped_mass_matrix;      borrowed_lumped_mass_matrix = tp->lumped_mass_matrix;
52  }  }
53    
54  FCT_FluxLimiter::~FCT_FluxLimiter()  template <class T>
55    FCT_FluxLimiter<T>::~FCT_FluxLimiter()
56  {  {
57      delete[] u_tilde;      delete[] u_tilde;
58      delete[] MQ;      delete[] MQ;
# Line 59  FCT_FluxLimiter::~FCT_FluxLimiter() Line 61  FCT_FluxLimiter::~FCT_FluxLimiter()
61    
62  // sets the predictor u_tilde from Mu_tilde by solving M_C * u_tilde = Mu_tilde  // sets the predictor u_tilde from Mu_tilde by solving M_C * u_tilde = Mu_tilde
63  // and calculates the limiters QP and QN  // and calculates the limiters QP and QN
64  void FCT_FluxLimiter::setU_tilde(const double* Mu_tilde)  template <class T>
65    void FCT_FluxLimiter<T>::setU_tilde(const double* Mu_tilde)
66  {  {
67      const real_t LARGE_POSITIVE_FLOAT = escript::DataTypes::real_t_max();      const real_t LARGE_POSITIVE_FLOAT = escript::DataTypes::real_t_max();
68      const dim_t n = getTotalNumRows();      const dim_t n = getTotalNumRows();
# Line 134  void FCT_FluxLimiter::setU_tilde(const d Line 137  void FCT_FluxLimiter::setU_tilde(const d
137    
138  // starts to update a vector (not given yet) from the antidiffusion fluxes  // starts to update a vector (not given yet) from the antidiffusion fluxes
139  // in flux_limiter->antidiffusive_fluxes (needs u_tilde and Q)  // in flux_limiter->antidiffusive_fluxes (needs u_tilde and Q)
140  void FCT_FluxLimiter::addLimitedFluxes_Start()  template <class T>
141    void FCT_FluxLimiter<T>::addLimitedFluxes_Start()
142  {  {
143      const dim_t n = getTotalNumRows();      const dim_t n = getTotalNumRows();
144      const_SystemMatrixPattern_ptr pattern(getFluxPattern());      const_SystemMatrixPattern_ptr pattern(getFluxPattern());
145      const double* remote_u_tilde = u_tilde_coupler->borrowRemoteData();      const double* remote_u_tilde = u_tilde_coupler->borrowRemoteData();
146      SystemMatrix_ptr adf(antidiffusive_fluxes);      SystemMatrix_ptr<T> adf(antidiffusive_fluxes);
147    
148  #pragma omp parallel for  #pragma omp parallel for
149      for (dim_t i = 0; i < n; ++i) {      for (dim_t i = 0; i < n; ++i) {
# Line 204  void FCT_FluxLimiter::addLimitedFluxes_S Line 208  void FCT_FluxLimiter::addLimitedFluxes_S
208    
209  // completes the exchange of the R factors and adds the weighted  // completes the exchange of the R factors and adds the weighted
210  // antidiffusion fluxes to the residual b  // antidiffusion fluxes to the residual b
211    template <class T>
212  void FCT_FluxLimiter::addLimitedFluxes_Complete(double* b)  void FCT_FluxLimiter::addLimitedFluxes_Complete(double* b)
213  {  {
214      const dim_t n = getTotalNumRows();      const dim_t n = getTotalNumRows();
215      const_SystemMatrixPattern_ptr pattern(getFluxPattern());      const_SystemMatrixPattern_ptr pattern(getFluxPattern());
216      const_SystemMatrix_ptr adf(antidiffusive_fluxes);      const_SystemMatrix_ptr<T> adf(antidiffusive_fluxes);
217      const double* remote_R = R_coupler->finishCollect();      const double* remote_R = R_coupler->finishCollect();
218    
219  #pragma omp parallel for  #pragma omp parallel for

Legend:
Removed from v.6561  
changed lines
  Added in v.6562

  ViewVC Help
Powered by ViewVC 1.1.26