void load_parameters(const char *);
private:
- void build_fe();
void setup_system ();
void initialize_system ();
void assemble_system (double &res_norm);
const MappingQ1<dim> mapping;
- FESystem<dim> *fe_ptr;
+ FESystem<dim> fe;
DoFHandler<dim> dof_handler;
public:
- void assemble_cell_term(const FEValues<dim>& fe_v,
- std::vector<unsigned int> &dofs,
- unsigned int cell_no
- );
+ void assemble_cell_term (const FEValues<dim> &fe_v,
+ const std::vector<unsigned int> &dofs);
void assemble_face_term(
int face_no,
// to the right hand side, and adding in the Jacobian
// contributions.
template <int dim>
-void ConsLaw<dim>::assemble_cell_term(
- const FEValues<dim> &fe_v,
- std::vector<unsigned int> &dofs,
- unsigned int /*cell_no*/
-)
+void ConsLaw<dim>::assemble_cell_term (const FEValues<dim> &fe_v,
+ const std::vector<unsigned int> &dofs)
{
unsigned int dofs_per_cell = fe_v.dofs_per_cell;
unsigned int n_q_points = fe_v.n_quadrature_points;
Matrix->SumIntoGlobalValues(dofs[i],
dofs_per_cell,
values,
- reinterpret_cast<int*>(&dofs[0]));
+ reinterpret_cast<int*>(const_cast<unsigned int*>(&dofs[0])));
// Add minus the residual to the right hand side.
right_hand_side(dofs[i]) -= F_i.val();
template <int dim>
void ConsLaw<dim>::assemble_system (double &res_norm)
{
- FESystem<dim> &fe = *fe_ptr;
const unsigned int dofs_per_cell = dof_handler.get_fe().dofs_per_cell;
// We track the dofs on this cell and (if necessary)
cell_diameter = cell->diameter();
assemble_cell_term(fe_v,
- dofs,
- cell_no);
+ dofs);
// We use the DG style loop through faces
// to determine if we need to apply a
ConsLaw<dim>::ConsLaw ()
:
mapping (),
- fe_ptr(NULL),
+ fe (FE_Q<dim>(1), EulerEquations<dim>::n_components),
dof_handler (triangulation),
quadrature (2),
face_quadrature (2),
theta(0.5)
{}
- // At one time this example could work for both DG and
- // continuous finite elements. The choice was made here.
-template <int dim>
-void ConsLaw<dim>::build_fe() {
- fe_ptr = new FESystem<dim>(FE_Q<dim>(1), EulerEquations<dim>::n_components);
-}
// Bye bye Conservation law.
template <int dim>
ConsLaw<dim>::~ConsLaw ()
{
dof_handler.clear ();
- delete fe_ptr;
}
// @sect3{Initialize System}
// First we need to distribute the
// DoFs.
dof_handler.clear();
- dof_handler.distribute_dofs (*fe_ptr);
+ dof_handler.distribute_dofs (fe);
// Size all of the fields.
solution.reinit (dof_handler.n_dofs());
sparsity_pattern.reinit (dof_handler.n_dofs(),
dof_handler.n_dofs(),
(GeometryInfo<dim>::faces_per_cell
- *GeometryInfo<dim>::subfaces_per_face+1)*fe_ptr->dofs_per_cell);
+ *GeometryInfo<dim>::subfaces_per_face+1)*fe.dofs_per_cell);
// Since the continuous sparsity pattern is
// a subset of the DG one, and since we need
QGauss<dim> quadrature_formula(4);
- const std::vector<Point<dim> > &us = fe_ptr->base_element(0).get_unit_support_points();
+ const std::vector<Point<dim> > &us = fe.base_element(0).get_unit_support_points();
Quadrature<dim> unit_support(us);
int n_uq_points = unit_support.n_quadrature_points;
FEValues<dim> fe_v (
- mapping, *fe_ptr, quadrature_formula, update_flags);
+ mapping, fe, quadrature_formula, update_flags);
FEValues<dim> fe_v_unit (
- mapping, *fe_ptr, unit_support, update_flags1);
+ mapping, fe, unit_support, update_flags1);
std::vector<Vector<double> > U(n_uq_points,
Vector<double>(EulerEquations<dim>::n_components));
FEValues<dim> fe_v (
- mapping, *fe_ptr, quadrature_formula, update_flags);
+ mapping, fe, quadrature_formula, update_flags);
std::vector<Vector<double> > U(n_q_points,
Vector<double>(EulerEquations<dim>::n_components));
triangulation.execute_coarsening_and_refinement ();
dof_handler.clear();
- dof_handler.distribute_dofs (*fe_ptr);
+ dof_handler.distribute_dofs (fe);
{
Vector<double> new_solution(1);
grid_in.read_ucd(input_file);
input_file.close();
- build_fe();
-
unsigned int nstep = 0;
// Initialize fields and matrices.