Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unify assembler structure #1785

Merged
merged 5 commits into from Nov 22, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
39 changes: 12 additions & 27 deletions cookbooks/inner_core_convection/inner_core_assembly.cc
@@ -1,7 +1,7 @@
#include <aspect/simulator_access.h>
#include <aspect/global.h>
#include <aspect/simulator.h>
#include <aspect/assembly.h>
#include <aspect/simulator/assemblers/interface.h>

#include <deal.II/base/quadrature_lib.h>
#include <deal.II/fe/fe_values.h>
Expand Down Expand Up @@ -40,28 +40,29 @@ namespace aspect
*/
template <int dim>
class PhaseBoundaryAssembler :
public aspect::internal::Assembly::Assemblers::AssemblerBase<dim>,
public aspect::Assemblers::Interface<dim>,
public SimulatorAccess<dim>
{

public:

virtual
void
phase_change_boundary_conditions (const typename DoFHandler<dim>::active_cell_iterator &cell,
const unsigned int face_no,
internal::Assembly::Scratch::StokesSystem<dim> &scratch,
internal::Assembly::CopyData::StokesSystem<dim> &data) const
execute (internal::Assembly::Scratch::ScratchBase<dim> &scratch_base,
internal::Assembly::CopyData::CopyDataBase<dim> &data_base) const
{
internal::Assembly::Scratch::StokesSystem<dim> &scratch = dynamic_cast<internal::Assembly::Scratch::StokesSystem<dim>& > (scratch_base);
internal::Assembly::CopyData::StokesSystem<dim> &data = dynamic_cast<internal::Assembly::CopyData::StokesSystem<dim>& > (data_base);

const Introspection<dim> &introspection = this->introspection();
const FiniteElement<dim> &fe = this->get_fe();
const unsigned int stokes_dofs_per_cell = data.local_dof_indices.size();
const unsigned int n_q_points = scratch.face_finite_element_values.n_quadrature_points;

//assemble force terms for the matrix for all boundary faces
if (cell->face(face_no)->at_boundary())
if (scratch.cell->face(scratch.face_number)->at_boundary())
{
scratch.face_finite_element_values.reinit (cell, face_no);
scratch.face_finite_element_values.reinit (scratch.cell, scratch.face_number);

for (unsigned int q=0; q<n_q_points; ++q)
{
Expand Down Expand Up @@ -99,31 +100,15 @@ namespace aspect

template <int dim>
void set_assemblers_phase_boundary(const SimulatorAccess<dim> &simulator_access,
internal::Assembly::AssemblerLists<dim> &assemblers,
std::vector<dealii::std_cxx11::shared_ptr<
internal::Assembly::Assemblers::AssemblerBase<dim> > > &assembler_objects)
Assemblers::Manager<dim> &assemblers)
{
AssertThrow (dynamic_cast<const MaterialModel::InnerCore<dim>*>
(&simulator_access.get_material_model()) != 0,
ExcMessage ("The phase boundary assembler can only be used with the "
"material model 'inner core material'!"));

std_cxx11::shared_ptr<PhaseBoundaryAssembler<dim> > phase_boundary_assembler
(new PhaseBoundaryAssembler<dim>());
assembler_objects.push_back (phase_boundary_assembler);

// add the terms for phase change boundary conditions
assemblers.local_assemble_stokes_system_on_boundary_face
.connect (std_cxx11::bind(&PhaseBoundaryAssembler<dim>::phase_change_boundary_conditions,
std_cxx11::cref (*phase_boundary_assembler),
std_cxx11::_1,
std_cxx11::_2,
// discard pressure_scaling,
// discard rebuild_stokes_matrix,
std_cxx11::_5,
std_cxx11::_6));


PhaseBoundaryAssembler<dim> *phase_boundary_assembler = new PhaseBoundaryAssembler<dim>();
assemblers.stokes_system_on_boundary_face.push_back (std_cxx11::unique_ptr<PhaseBoundaryAssembler<dim> > (phase_boundary_assembler));
}
}

Expand Down
8 changes: 8 additions & 0 deletions doc/update_source_files_to_2.0.0.sed
Expand Up @@ -62,3 +62,11 @@ s/tracer particle/particle/g
s/tracer/particle/g
s/Tracer/Particle/g
s/TRACER/PARTICLE/g

# Rename assembler base class
s/internal::Assembly::AssemblerLists<dim>/Assemblers::AssemblerLists<dim>/g
s/internal::Assembly::Assemblers/Assemblers/g
s/struct AssemblerLists/class Manager/g
s/AssemblerLists/Manager/g
s/AssemblerBase/Interface/g
s:assembly.h:simulator/assemblers/interface.h:g
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we could keep assembly.h (that includes the other files) to avoid this change?!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would vote for removing the file. The interface is broken anyway for anybody who wrote an individual assembler (not many people), and those would be the only ones including assembly.h. interface.h is the new assembly.h.