Skip to content

Commit

Permalink
Make scratch data const in all assemblers
Browse files Browse the repository at this point in the history
  • Loading branch information
blaisb committed Oct 16, 2024
1 parent df3a261 commit 77caca4
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 48 deletions.
56 changes: 28 additions & 28 deletions include/solvers/tracer_assemblers.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ class TracerAssemblerBase
*/

virtual void
assemble_matrix(TracerScratchData<dim> &scratch_data,
StabilizedMethodsCopyData &copy_data) = 0;
assemble_matrix(const TracerScratchData<dim> &scratch_data,
StabilizedMethodsCopyData &copy_data) = 0;


/**
Expand All @@ -46,8 +46,8 @@ class TracerAssemblerBase
*/

virtual void
assemble_rhs(TracerScratchData<dim> &scratch_data,
StabilizedMethodsCopyData &copy_data) = 0;
assemble_rhs(const TracerScratchData<dim> &scratch_data,
StabilizedMethodsCopyData &copy_data) = 0;
};


Expand Down Expand Up @@ -77,8 +77,8 @@ class TracerAssemblerCore : public TracerAssemblerBase<dim>
* @param[in,out] copy_data (see base class)
*/
virtual void
assemble_matrix(TracerScratchData<dim> &scratch_data,
StabilizedMethodsCopyData &copy_data) override;
assemble_matrix(const TracerScratchData<dim> &scratch_data,
StabilizedMethodsCopyData &copy_data) override;


/**
Expand All @@ -87,8 +87,8 @@ class TracerAssemblerCore : public TracerAssemblerBase<dim>
* @param[in,out] copy_data (see base class)
*/
virtual void
assemble_rhs(TracerScratchData<dim> &scratch_data,
StabilizedMethodsCopyData &copy_data) override;
assemble_rhs(const TracerScratchData<dim> &scratch_data,
StabilizedMethodsCopyData &copy_data) override;

std::shared_ptr<SimulationControl> simulation_control;
};
Expand Down Expand Up @@ -119,8 +119,8 @@ class TracerAssemblerDGCore : public TracerAssemblerBase<dim>
* @param[in,out] copy_data (see base class)
*/
virtual void
assemble_matrix(TracerScratchData<dim> &scratch_data,
StabilizedMethodsCopyData &copy_data) override;
assemble_matrix(const TracerScratchData<dim> &scratch_data,
StabilizedMethodsCopyData &copy_data) override;


/**
Expand All @@ -129,8 +129,8 @@ class TracerAssemblerDGCore : public TracerAssemblerBase<dim>
* @param[in,out] copy_data (see base class)
*/
virtual void
assemble_rhs(TracerScratchData<dim> &scratch_data,
StabilizedMethodsCopyData &copy_data) override;
assemble_rhs(const TracerScratchData<dim> &scratch_data,
StabilizedMethodsCopyData &copy_data) override;

// The simulation control must be a part of the core assembler since the
// inverse time-step is used within the stabilization
Expand Down Expand Up @@ -163,17 +163,17 @@ class TracerAssemblerBDF : public TracerAssemblerBase<dim>
*/

virtual void
assemble_matrix(TracerScratchData<dim> &scratch_data,
StabilizedMethodsCopyData &copy_data) override;
assemble_matrix(const TracerScratchData<dim> &scratch_data,
StabilizedMethodsCopyData &copy_data) override;

/**
* @brief Assembles the rhs
* @param[in] scratch_data (see base class)
* @param[in,out] copy_data (see base class)
*/
virtual void
assemble_rhs(TracerScratchData<dim> &scratch_data,
StabilizedMethodsCopyData &copy_data) override;
assemble_rhs(const TracerScratchData<dim> &scratch_data,
StabilizedMethodsCopyData &copy_data) override;

// The simulation control is a necessary part of the transient terms.
std::shared_ptr<SimulationControl> simulation_control;
Expand Down Expand Up @@ -205,8 +205,8 @@ class TracerFaceAssembler
*/

virtual void
assemble_matrix(TracerScratchData<dim> &scratch_data,
StabilizedDGMethodsCopyData &copy_data) = 0;
assemble_matrix(const TracerScratchData<dim> &scratch_data,
StabilizedDGMethodsCopyData &copy_data) = 0;


/**
Expand All @@ -219,8 +219,8 @@ class TracerFaceAssembler
*/

virtual void
assemble_rhs(TracerScratchData<dim> &scratch_data,
StabilizedDGMethodsCopyData &copy_data) = 0;
assemble_rhs(const TracerScratchData<dim> &scratch_data,
StabilizedDGMethodsCopyData &copy_data) = 0;
};


Expand Down Expand Up @@ -251,8 +251,8 @@ class TracerAssemblerSIPG : public TracerFaceAssembler<dim>
* should be copied
*/
virtual void
assemble_matrix(TracerScratchData<dim> &scratch_data,
StabilizedDGMethodsCopyData &copy_data) override;
assemble_matrix(const TracerScratchData<dim> &scratch_data,
StabilizedDGMethodsCopyData &copy_data) override;


/**
Expand All @@ -264,8 +264,8 @@ class TracerAssemblerSIPG : public TracerFaceAssembler<dim>
* should be copied
*/
virtual void
assemble_rhs(TracerScratchData<dim> &scratch_data,
StabilizedDGMethodsCopyData &copy_data) override;
assemble_rhs(const TracerScratchData<dim> &scratch_data,
StabilizedDGMethodsCopyData &copy_data) override;

std::shared_ptr<SimulationControl> simulation_control;
};
Expand Down Expand Up @@ -301,8 +301,8 @@ class TracerAssemblerBoundaryNitsche : public TracerFaceAssembler<dim>
* should be copied
*/
virtual void
assemble_matrix(TracerScratchData<dim> &scratch_data,
StabilizedDGMethodsCopyData &copy_data) override;
assemble_matrix(const TracerScratchData<dim> &scratch_data,
StabilizedDGMethodsCopyData &copy_data) override;


/**
Expand All @@ -314,8 +314,8 @@ class TracerAssemblerBoundaryNitsche : public TracerFaceAssembler<dim>
* should be copied
*/
virtual void
assemble_rhs(TracerScratchData<dim> &scratch_data,
StabilizedDGMethodsCopyData &copy_data) override;
assemble_rhs(const TracerScratchData<dim> &scratch_data,
StabilizedDGMethodsCopyData &copy_data) override;

std::shared_ptr<SimulationControl> simulation_control;
BoundaryConditions::TracerBoundaryConditions<dim> boundary_conditions_tracer;
Expand Down
46 changes: 26 additions & 20 deletions source/solvers/tracer_assemblers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@

template <int dim>
void
TracerAssemblerCore<dim>::assemble_matrix(TracerScratchData<dim> &scratch_data,
StabilizedMethodsCopyData &copy_data)
TracerAssemblerCore<dim>::assemble_matrix(
const TracerScratchData<dim> &scratch_data,
StabilizedMethodsCopyData &copy_data)
{
// Scheme and physical properties
const std::vector<double> &diffusivity_vector =
Expand Down Expand Up @@ -137,8 +138,9 @@ TracerAssemblerCore<dim>::assemble_matrix(TracerScratchData<dim> &scratch_data,

template <int dim>
void
TracerAssemblerCore<dim>::assemble_rhs(TracerScratchData<dim> &scratch_data,
StabilizedMethodsCopyData &copy_data)
TracerAssemblerCore<dim>::assemble_rhs(
const TracerScratchData<dim> &scratch_data,
StabilizedMethodsCopyData &copy_data)
{
// Scheme and physical properties
const std::vector<double> &diffusivity_vector =
Expand Down Expand Up @@ -244,8 +246,8 @@ template class TracerAssemblerCore<3>;
template <int dim>
void
TracerAssemblerDGCore<dim>::assemble_matrix(
TracerScratchData<dim> &scratch_data,
StabilizedMethodsCopyData &copy_data)
const TracerScratchData<dim> &scratch_data,
StabilizedMethodsCopyData &copy_data)
{
// Scheme and physical properties
const std::vector<double> &diffusivity_vector =
Expand Down Expand Up @@ -292,8 +294,9 @@ TracerAssemblerDGCore<dim>::assemble_matrix(

template <int dim>
void
TracerAssemblerDGCore<dim>::assemble_rhs(TracerScratchData<dim> &scratch_data,
StabilizedMethodsCopyData &copy_data)
TracerAssemblerDGCore<dim>::assemble_rhs(
const TracerScratchData<dim> &scratch_data,
StabilizedMethodsCopyData &copy_data)
{
// Scheme and physical properties
const std::vector<double> &diffusivity_vector =
Expand Down Expand Up @@ -339,8 +342,9 @@ template class TracerAssemblerDGCore<3>;

template <int dim>
void
TracerAssemblerBDF<dim>::assemble_matrix(TracerScratchData<dim> &scratch_data,
StabilizedMethodsCopyData &copy_data)
TracerAssemblerBDF<dim>::assemble_matrix(
const TracerScratchData<dim> &scratch_data,
StabilizedMethodsCopyData &copy_data)
{
// Loop and quadrature informations
const auto &JxW = scratch_data.JxW;
Expand Down Expand Up @@ -393,8 +397,9 @@ TracerAssemblerBDF<dim>::assemble_matrix(TracerScratchData<dim> &scratch_data,

template <int dim>
void
TracerAssemblerBDF<dim>::assemble_rhs(TracerScratchData<dim> &scratch_data,
StabilizedMethodsCopyData &copy_data)
TracerAssemblerBDF<dim>::assemble_rhs(
const TracerScratchData<dim> &scratch_data,
StabilizedMethodsCopyData &copy_data)
{
// Loop and quadrature informations
const auto &JxW = scratch_data.JxW;
Expand Down Expand Up @@ -447,8 +452,8 @@ template class TracerAssemblerBDF<3>;
template <int dim>
void
TracerAssemblerSIPG<dim>::assemble_matrix(
TracerScratchData<dim> &scratch_data,
StabilizedDGMethodsCopyData &copy_data)
const TracerScratchData<dim> &scratch_data,
StabilizedDGMethodsCopyData &copy_data)
{
const double penalty_factor = scratch_data.penalty_factor;
const FEInterfaceValues<dim> &fe_iv = scratch_data.fe_interface_values_tracer;
Expand Down Expand Up @@ -493,8 +498,9 @@ TracerAssemblerSIPG<dim>::assemble_matrix(

template <int dim>
void
TracerAssemblerSIPG<dim>::assemble_rhs(TracerScratchData<dim> &scratch_data,
StabilizedDGMethodsCopyData &copy_data)
TracerAssemblerSIPG<dim>::assemble_rhs(
const TracerScratchData<dim> &scratch_data,
StabilizedDGMethodsCopyData &copy_data)
{
const double penalty_factor = scratch_data.penalty_factor;
const FEInterfaceValues<dim> &fe_iv = scratch_data.fe_interface_values_tracer;
Expand Down Expand Up @@ -553,8 +559,8 @@ template class TracerAssemblerSIPG<3>;
template <int dim>
void
TracerAssemblerBoundaryNitsche<dim>::assemble_matrix(
TracerScratchData<dim> &scratch_data,
StabilizedDGMethodsCopyData &copy_data)
const TracerScratchData<dim> &scratch_data,
StabilizedDGMethodsCopyData &copy_data)
{
const unsigned int boundary_index = scratch_data.boundary_index;
const FEFaceValuesBase<dim> &fe_face =
Expand Down Expand Up @@ -611,8 +617,8 @@ TracerAssemblerBoundaryNitsche<dim>::assemble_matrix(
template <int dim>
void
TracerAssemblerBoundaryNitsche<dim>::assemble_rhs(
TracerScratchData<dim> &scratch_data,
StabilizedDGMethodsCopyData &copy_data)
const TracerScratchData<dim> &scratch_data,
StabilizedDGMethodsCopyData &copy_data)
{
const unsigned int boundary_index = scratch_data.boundary_index;
const FEFaceValuesBase<dim> &fe_face =
Expand Down

0 comments on commit 77caca4

Please sign in to comment.