Skip to content

Commit

Permalink
Added bart_builder.h SlaybaughLab#10
Browse files Browse the repository at this point in the history
1. Added bart_builder.h and .cc. bart_build contains functions we
can use to project base classes to specific models.
2. Explicitly use PETScWrappers namespace instead of redefining one
as LA
3. Changed main.cc so we can build the whole thing through BartDriver
  • Loading branch information
Weixiong Zheng committed Jul 24, 2017
1 parent 2f2ded6 commit 734385f
Show file tree
Hide file tree
Showing 11 changed files with 2,461 additions and 101 deletions.
37 changes: 37 additions & 0 deletions src/common/bart_builder.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#include "bart_builder.h"
#include "../transport/even_parity.h"
#include "../aqdata/aq_lsgc"


template <int dim>
std_cxx11::shared_ptr<TransportBase<dim> >
build_transport_model (ParameterHandler &prm)
{
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));
return transport_class;
}

template <int dim>
std_cxx11::shared_ptr<AQBase<dim> >
build_aq_model (ParameterHandler &prm)
{
std::string aq_name = prm.get ("angular quadrature name");
AssertThrow (aq_name!="none",
ExcMessage("angular quadrature name incorrect or missing"));
std_cxx11::shared_ptr<AQBase<dim> > aq_class;
if (aq_name=="lsgc")
aq_class = std_cxx11::shared_ptr<AQBase<dim> > (new LSGC<dim>(prm));
return aq_class;
}

template std_cxx11::shared_ptr<TransportBase<2> > build_transport_model;
template std_cxx11::shared_ptr<TransportBase<3> > build_transport_model;
template std_cxx11::shared_ptr<AQBase<2> > build_aq_model;
template std_cxx11::shared_ptr<AQBase<3> > build_aq_model;

21 changes: 21 additions & 0 deletions src/common/bart_builder.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#ifndef __bart_builder_h__
#define __bart_builder_h__

#include <deal.II/base/parameter_handler.h>

#include <string>
#include <map>

#include "../transport/transport_base.h"

using namespace dealii;

template <int dim>
std_cxx11::shared_ptr<TransportBase<dim> >
build_transport_model (ParameterHandler &prm);

template <int dim>
std_cxx11::shared_ptr<AQBase<dim> >
build_aq_model (ParameterHandler &prm);

#endif //__bart_builder_h__
Loading

0 comments on commit 734385f

Please sign in to comment.