Skip to content

Commit

Permalink
IterationBase changed to Iterations SlaybaughLab#10
Browse files Browse the repository at this point in the history
This class does not serve as base class for transport iterations,
so it is renamed to Iterations which is used to perform different
iterations defined by upcoming classes.
  • Loading branch information
Weixiong Zheng committed Aug 10, 2017
1 parent 8e02160 commit fd778c9
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 52 deletions.
44 changes: 22 additions & 22 deletions src/iteration/iteration_base.cc → src/iteration/iterations.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@

#include <algorithm>

#include "equation_base.h"
#include "iterations.h"
#include "../aqdata/aq_base.h"
#include "../aqdata/aq_lsgc.h"

using namespace dealii;

template <int dim>
IterationBase<dim>::IterationBase
Iterations<dim>::Iterations
(ParameterHandler &prm,
const std_cxx11::shared_ptr<MeshGenerator<dim> > msh_ptr,
const std_cxx11::shared_ptr<AQBase<dim> > aqd_ptr,
Expand Down Expand Up @@ -43,22 +43,22 @@ n_group(prm.get_integer("number of groups"))
}

template <int dim>
IterationBase<dim>::~IterationBase ()
Iterations<dim>::~Iterations ()
{
}

template <int dim>
void IterationBase<dim>::NDA_PI ()
void Iterations<dim>::NDA_PI ()
{
}

template <int dim>
void IterationBase<dim>::NDA_SI ()
void Iterations<dim>::NDA_SI ()
{
}

template <int dim>
void IterationBase<dim>::initialize_system_matrices_vectors
void Iterations<dim>::initialize_system_matrices_vectors
(SparsityPatternType &dsp)
{
for (unsigned int g=0; g<n_group; ++g)
Expand Down Expand Up @@ -116,7 +116,7 @@ void IterationBase<dim>::initialize_system_matrices_vectors
}

template <int dim>
void IterationBase<dim>::scale_fiss_transfer_matrices ()
void Iterations<dim>::scale_fiss_transfer_matrices ()
{
AssertThrow (do_nda==false,
ExcMessage("we don't scale fission transfer without NDA"));
Expand All @@ -136,10 +136,10 @@ void IterationBase<dim>::scale_fiss_transfer_matrices ()
}

template <int dim>
void IterationBase<dim>::
void Iterations<dim>::

template <int dim>
void IterationBase<dim>::initialize_fiss_process
void Iterations<dim>::initialize_fiss_process
(std::vector<PETScWrappers::MPI::Vector*> &vec_ho_sflx)
{
for (unsigned int g=0; g<n_group; ++g)
Expand All @@ -152,7 +152,7 @@ void IterationBase<dim>::initialize_fiss_process
}

template <int dim>
void IterationBase<dim>::update_ho_moments_in_fiss
void Iterations<dim>::update_ho_moments_in_fiss
(std::vector<PETScWrappers::MPI::Vector*> &vec_ho_sflx,
std::vector<PETScWrappers::MPI::Vector*> &vec_ho_sflx_prev_gen)
{
Expand All @@ -164,7 +164,7 @@ void IterationBase<dim>::update_ho_moments_in_fiss
}

template <int dim>
void IterationBase<dim>::update_fiss_source_keff ()
void Iterations<dim>::update_fiss_source_keff ()
{
keff_prev_gen = keff;
fission_source_prev_gen = fission_source;
Expand All @@ -173,7 +173,7 @@ void IterationBase<dim>::update_fiss_source_keff ()
}

template <int dim>
void IterationBase<dim>::power_iteration
void Iterations<dim>::power_iteration
(std::vector<PETScWrappers::MPI::Vector*> &vec_ho_sflx)
{
double err_k = 1.0;
Expand All @@ -199,7 +199,7 @@ void IterationBase<dim>::power_iteration
}

template <int dim>
void IterationBase<dim>::source_iteration
void Iterations<dim>::source_iteration
(std::vector<PETScWrappers::MPI::SparseMatrix*> &vec_ho_sys,
std::vector<PETScWrappers::MPI::Vector*> &vec_aflx,
std::vector<PETScWrappers::MPI::Vector*> &vec_ho_rhs,
Expand Down Expand Up @@ -228,20 +228,20 @@ void IterationBase<dim>::source_iteration
}

template <int dim>
void IterationBase<dim>::postprocess ()
void Iterations<dim>::postprocess ()
{// do nothing in the base class
}

template <int dim>
double IterationBase<dim>::estimate_k (double &fiss_source,
double &fiss_source_prev_gen,
double &k_prev_gen)
double Iterations<dim>::estimate_k (double &fiss_source,
double &fiss_source_prev_gen,
double &k_prev_gen)
{
return k_prev_gen * fiss_source / fiss_source_prev_gen;
}

template <int dim>
double IterationBase<dim>::estimate_phi_diff
double Iterations<dim>::estimate_phi_diff
(std::vector<PETScWrappers::MPI::Vector*> &phis_newer,
std::vector<PETScWrappers::MPI::Vector*> &phis_older)
{
Expand All @@ -258,7 +258,7 @@ double IterationBase<dim>::estimate_phi_diff
}

template <int dim>
void IterationBase<dim>::do_iterations ()
void Iterations<dim>::do_iterations ()
{
sol_ptr->initialize_ho_preconditioners (vec_ho_sys, vec_ho_rhs);
if (is_eigen_problem)
Expand Down Expand Up @@ -286,12 +286,12 @@ void IterationBase<dim>::do_iterations ()
}

template <int dim>
void IterationBase<dim>::get_flux_this_proc
void Iterations<dim>::get_flux_this_proc
(std::vector<Vector<double> > &sflxes_proc)
{
sflxes_proc = this->sflx_proc;
}

// explicit instantiation to avoid linking error
template class IterationBase<2>;
template class IterationBase<3>;
template class Iterations<2>;
template class Iterations<3>;
36 changes: 6 additions & 30 deletions src/iteration/iteration_base.h → src/iteration/iterations.h
Original file line number Diff line number Diff line change
@@ -1,18 +1,6 @@
#ifndef __transport_base_h__
#define __transport_base_h__
#ifndef __iterations_h__
#define __iterations_h__
#include <deal.II/lac/generic_linear_algebra.h>
namespace LA
{
#if defined(DEAL_II_WITH_PETSC) && !(defined(DEAL_II_WITH_TRILINOS) && defined(FORCE_USE_OF_TRILINOS))
using namespace dealii::LinearAlgebraPETSc;
# define USE_PETSC_LA
#elif defined(DEAL_II_WITH_TRILINOS)
using namespace dealii::LinearAlgebraTrilinos;
#else
# error DEAL_II_WITH_PETSC or DEAL_II_WITH_TRILINOS required
#endif
}

#include <deal.II/lac/petsc_parallel_sparse_matrix.h>
#include <deal.II/lac/petsc_parallel_vector.h>
#include <deal.II/lac/petsc_precondition.h>
Expand Down Expand Up @@ -54,11 +42,11 @@ namespace LA
using namespace dealii;

template <int dim>
class TransportBase
class Iterations
{
public:
IterationBase (ParameterHandler &prm);// : ProblemDefinition<dim> (prm){}
virtual ~IterationBase ();
Iterations (ParameterHandler &prm);// : ProblemDefinition<dim> (prm){}
virtual ~Iterations ();

void do_iterations ();

Expand All @@ -79,7 +67,6 @@ class TransportBase
double estimate_k (double &fiss_source,
double &fiss_source_prev_gen,
double &k_prev_gen);
double estimate_fiss_source (std::vector<Vector<double> > &phis_this_process);
double estimate_phi_diff (std::vector<LA::MPI::Vector*> &phis_newer,
std::vector<LA::MPI::Vector*> &phis_older);

Expand All @@ -90,14 +77,6 @@ class TransportBase
std::string aq_name;

protected:
unsigned int get_component_index
(unsigned int incident_angle_index, unsigned int g);
unsigned int get_component_direction (unsigned int comp_ind);
unsigned int get_component_group (unsigned int comp_ind);

unsigned int get_reflective_direction_index
(unsigned int boundary_id, unsigned int incident_angle_index);

std::vector<typename DoFHandler<dim>::active_cell_iterator> local_cells;
std::vector<typename DoFHandler<dim>::active_cell_iterator> ref_bd_cells;
std::vector<bool> is_cell_at_bd;
Expand All @@ -109,8 +88,6 @@ class TransportBase

double keff;
double keff_prev_gen;
double total_angle;
double c_penalty;
double fission_source;
double fission_source_prev_gen;

Expand All @@ -123,7 +100,6 @@ class TransportBase
unsigned int n_group;
unsigned int n_material;
unsigned int p_order;
unsigned int global_refinements;

std::vector<unsigned int> linear_iters;

Expand All @@ -146,4 +122,4 @@ class TransportBase
std::vector<Vector<double> > lo_sflx_proc;
};

#endif // define __transport_base_h__
#endif // define __iterations_h__

0 comments on commit fd778c9

Please sign in to comment.