Skip to content

Commit

Permalink
removing step-37 coefficient class
Browse files Browse the repository at this point in the history
  • Loading branch information
landinjm committed Jan 14, 2025
1 parent de2e774 commit 54ac82b
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 56 deletions.
53 changes: 0 additions & 53 deletions include/core/matrix_free_operator.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,34 +9,6 @@

using namespace dealii;

template <int dim>
class Coefficient : public Function<dim>
{
public:
virtual double
value(const Point<dim> &p, const unsigned int component = 0) const override;

template <typename number>
number
value(const Point<dim, number> &p, const unsigned int component = 0) const;
};

template <int dim>
template <typename number>
number
Coefficient<dim>::value(const Point<dim, number> &p,
const unsigned int /*component*/) const
{
return 1.0 / (0.05 + 2.0 * p.square());
}

template <int dim>
double
Coefficient<dim>::value(const Point<dim> &p, const unsigned int component) const
{
return value<double>(p, component);
}

/**
* \brief This is the abstract base class for the matrix free implementation of some PDE.
*
Expand Down Expand Up @@ -69,9 +41,6 @@ class matrixFreeOperator
void
clear() override;

void
evaluate_coefficient(const Coefficient<dim> &coefficient_function);

/**
* \brief Compute the diagonal of this operator.
*/
Expand Down Expand Up @@ -111,8 +80,6 @@ class matrixFreeOperator
LinearAlgebra::distributed::Vector<number> &dst,
const unsigned int &dummy,
const std::pair<unsigned int, unsigned int> &cell_range) const;

Table<2, VectorizedArray<number>> coefficient;
};

template <int dim, int degree, typename number>
Expand All @@ -124,29 +91,9 @@ template <int dim, int degree, typename number>
void
matrixFreeOperator<dim, degree, number>::clear()
{
coefficient.reinit(0, 0);
MatrixFreeOperators::Base<dim, LinearAlgebra::distributed::Vector<number>>::clear();
}

template <int dim, int degree, typename number>
void
matrixFreeOperator<dim, degree, number>::evaluate_coefficient(
const Coefficient<dim> &coefficient_function)
{
const unsigned int n_cells = this->data->n_cell_batches();
FEEvaluation<dim, degree, degree + 1, 1, number> phi(*this->data);

coefficient.reinit(n_cells, phi.n_q_points);
for (unsigned int cell = 0; cell < n_cells; ++cell)
{
phi.reinit(cell);
for (const unsigned int q : phi.quadrature_point_indices())
{
coefficient(cell, q) = coefficient_function.value(phi.quadrature_point(q));
}
}
}

template <int dim, int degree, typename number>
void
matrixFreeOperator<dim, degree, number>::local_apply(
Expand Down
3 changes: 0 additions & 3 deletions include/core/temp_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,6 @@ LaplaceProblem<dim>::setup_system()
system_matrix.initialize(system_mf_storage);
}

system_matrix.evaluate_coefficient(Coefficient<dim>());

system_matrix.initialize_dof_vector(solution);
system_matrix.initialize_dof_vector(system_rhs);
}
Expand Down Expand Up @@ -181,7 +179,6 @@ LaplaceProblem<dim>::setup_system()
additional_data);

mg_matrices[level].initialize(mg_mf_storage_level, mg_constrained_dofs, level);
mg_matrices[level].evaluate_coefficient(Coefficient<dim>());
}
}
setup_time += time.wall_time();
Expand Down

0 comments on commit 54ac82b

Please sign in to comment.