Skip to content

Commit

Permalink
Modified builders in bart_tools.cc and .h SlaybaughLab#10
Browse files Browse the repository at this point in the history
  • Loading branch information
Weixiong Zheng committed Jul 27, 2017
1 parent 58b3078 commit 2c24803
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 12 deletions.
7 changes: 3 additions & 4 deletions src/common/bart_driver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,8 @@ pcout(std::cout,
n_total_ho_vars = aqd_ptr->get_n_total_ho_vars ();
n_azi = aqd_ptr->get_sn_order ();
n_dir = aqd_ptr->get_n_dir ();
msh_ptr = std_cxx11::shared_ptr<MeshGenerator<dim> >
(new MeshGenerator<dim>(prm));
this->process_input ();
msh_ptr = build_mesh (prm);
itr_ptr = build_transport_iteration (prm);
}

template <int dim>
Expand Down Expand Up @@ -255,7 +254,7 @@ void BartDriver<dim>::run ()
is_cell_at_ref_bd);
setup_system ();
report_system ();
itr_ptr->do_iterations ();
itr_ptr->do_iterations (msh_ptr, aqd_ptr);
output_results ();
}

Expand Down
34 changes: 32 additions & 2 deletions src/common/bart_tools.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,47 @@
#include "../transport/even_parity.h"
#include "../aqdata/aq_lsgc"

template <int dim>
std_cxx11::shared_ptr<MeshGenerator<dim> > build_mesh (ParameterHandler &prm)
{
std_cxx11::shared_ptr<MeshGenerator<dim> > mesh_class =
std_cxx11::shared_ptr<MeshGenerator<dim> >
(new MeshGenerator<dim>(prm));
return mesh_class;
}

template <int dim>
std_cxx11::shared_ptr<IterationBase<dim> >
build_iterative_solver (ParameterHandler &prm,
const std_cxx11::shared_ptr<MeshGenerator<dim> > msh_ptr,
const std_cxx11::shared_ptr<AQBase<dim> > aqd_ptr)
{
// in future development this builder will be like other two
std_cxx11::shared_ptr<IterationBase<dim> > iteration_class =
std_cxx11::shared_ptr<IterationBase<dim> > (new IterationBase<dim>(prm,
msh_ptr,
aqd_ptr));
return iteration_class;
}

template <int dim>
std_cxx11::shared_ptr<TransportBase<dim> >
build_transport_model (ParameterHandler &prm)
build_transport_model (ParameterHandler &prm,
const std_cxx11::shared_ptr<MeshGenerator<dim> > msh_ptr,
const std_cxx11::shared_ptr<AQBase<dim> > aqd_ptr,
const std_cxx11::shared_ptr<MaterialProperties> mat_ptr)
{
std::string transport_model_name = prm.get ("transport model");
AssertThrow (transport_model_name!="none",
ExcMessage("transport model name incorrect or missing"));
std_cxx11::shared_ptr<TransportBase<dim> > transport_class;
if (transport_model_name=="ep")
transport_class =
std_cxx11::shared_ptr<TransportBase<dim> > (new EvenParity<dim> (prm));
std_cxx11::shared_ptr<TransportBase<dim> >
(new EvenParity<dim> (prm,
msh_ptr,
aqd_ptr,
mat_ptr));
return transport_class;
}

Expand Down
15 changes: 14 additions & 1 deletion src/common/bart_tools.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,22 @@

using namespace dealii;

template <int dim>
std_cxx11::shared_ptr<MeshGenerator<dim> >
build_mesh (ParameterHandler &prm);

template <int dim>
std_cxx11::shared_ptr<IterationBase<dim> >
build_iterative_solver (ParameterHandler &prm,
const std_cxx11::shared_ptr<MeshGenerator<dim> > msh_ptr,
const std_cxx11::shared_ptr<AQBase<dim> > aqd_ptr);

template <int dim>
std_cxx11::shared_ptr<TransportBase<dim> >
build_transport_model (ParameterHandler &prm);
build_transport_model (ParameterHandler &prm,
const std_cxx11::shared_ptr<MeshGenerator<dim> > msh_ptr,
const std_cxx11::shared_ptr<AQBase<dim> > aqd_ptr,
const std_cxx11::shared_ptr<MaterialProperties> mat_ptr);

template <int dim>
std_cxx11::shared_ptr<AQBase<dim> >
Expand Down
7 changes: 5 additions & 2 deletions src/transport/even_parity.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@
#include "even_parity.h"

template <int dim>
EvenParity<dim>::EvenParity (ParameterHandler &prm)
EvenParity<dim>::EvenParity (ParameterHandler &prm,
const std_cxx11::shared_ptr<MeshGenerator<dim> > msh_ptr,
const std_cxx11::shared_ptr<AQBase<dim> > aqd_ptr,
const std_cxx11::shared_ptr<MaterialProperties> mat_ptr)
:
TransportBase<dim>(prm)
TransportBase<dim>(prm, msh_ptr, aqd_ptr, mat_ptr)
{
}

Expand Down
5 changes: 4 additions & 1 deletion src/transport/even_parity.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ template<int dim>
class EvenParity : public TransportBase<dim>
{
public:
EvenParity (ParameterHandler &prm);
EvenParity (ParameterHandler &prm,
const std_cxx11::shared_ptr<MeshGenerator<dim> > msh_ptr,
const std_cxx11::shared_ptr<AQBase<dim> > aqd_ptr,
const std_cxx11::shared_ptr<MaterialProperties> mat_ptr);
~EvenParity ();

void pre_assemble_cell_matrices
Expand Down
5 changes: 4 additions & 1 deletion src/transport/transport_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ TransportBase<dim>::~TransportBase ()
}

template <int dim>
void TransportBase<dim>::process_input (msh_ptr, aqd_ptr, mat_ptr)
void TransportBase<dim>::process_input
(const std_cxx11::shared_ptr<MeshGenerator<dim> > msh_ptr,
const std_cxx11::shared_ptr<AQBase<dim> > aqd_ptr,
const std_cxx11::shared_ptr<MaterialProperties> mat_ptr)
{
// mesh related
{
Expand Down
4 changes: 3 additions & 1 deletion src/transport/transport_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,9 @@ class TransportBase
void assemble_ho_volume_boundary ();
void assemble_ho_interface ();
void assemble_ho_system ();
void process_input ();
void process_input (const std_cxx11::shared_ptr<MeshGenerator<dim> > msh_ptr,
const std_cxx11::shared_ptr<AQBase<dim> > aqd_ptr,
const std_cxx11::shared_ptr<MaterialProperties> mat_ptr);
void initialize_system_matrices_vectors ();
void prepare_correction_aflx ();
void initialize_fiss_process ();
Expand Down

0 comments on commit 2c24803

Please sign in to comment.