Skip to content
This repository has been archived by the owner on Oct 30, 2023. It is now read-only.

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiasleibner committed Sep 27, 2019
1 parent d5a1979 commit c462db2
Show file tree
Hide file tree
Showing 22 changed files with 326 additions and 379 deletions.
1 change: 1 addition & 0 deletions dune/gdt/local/integrands/elliptic.hh
Expand Up @@ -30,6 +30,7 @@ namespace GDT {


/**
* This class is deprecated, use LocalLaplaceIntegrand instead (10.08.2019)!
* Given an inducing scalar function lambda and an inducing matrix-valued function kappa, computes
* `lambda(x) * {[kappa(x) \nabla phi(x)] * \nabla psi(x)}` for all combinations of phi in the ansatz basis and psi in
* the test basis.
Expand Down
Expand Up @@ -7,13 +7,12 @@
// Authors:
// Tobias Leibner (2019)

#ifndef DUNE_GDT_LOCAL_INTEGRANDS_QUADRATIC_HH
#define DUNE_GDT_LOCAL_INTEGRANDS_QUADRATIC_HH
#ifndef DUNE_GDT_LOCAL_INTEGRANDS_GRADIENT_VALUE_HH
#define DUNE_GDT_LOCAL_INTEGRANDS_GRADIENT_VALUE_HH

#include <dune/xt/common/memory.hh>
#include <dune/xt/functions/constant.hh>
#include <dune/xt/functions/base/function-as-grid-function.hh>
#include <dune/xt/functions/interfaces/grid-function.hh>
#include <dune/xt/functions/grid-function.hh>

#include "interfaces.hh"

Expand Down Expand Up @@ -53,25 +52,19 @@ public:
typename std::conditional_t<use_test_gradient, LocalTestBasisType, LocalAnsatzBasisType>::DerivativeRangeType>;
static const size_t vector_size = d;

using VectorGridFunctionType = XT::Functions::GridFunctionInterface<E, vector_size, 1, F>;
using VectorGridFunctionType = XT::Functions::GridFunction<E, vector_size, 1, F>;
using VectorValues = typename VectorGridFunctionType::LocalFunctionType::RangeReturnType;

LocalElementGradientValueIntegrand(const XT::Functions::FunctionInterface<d, vector_size, 1, F>& vector_in)
LocalElementGradientValueIntegrand(const VectorGridFunctionType vector_in)
: BaseType()
, vector_(new XT::Functions::FunctionAsGridFunctionWrapper<E, vector_size, 1, F>(vector_in))
, local_function_(vector_.access().local_function())
{}

LocalElementGradientValueIntegrand(const VectorGridFunctionType& vector_in)
: BaseType(vector_in.parameter_type())
, vector_(vector_in)
, local_function_(vector_.access().local_function())
, local_function_(vector_.local_function())
{}

LocalElementGradientValueIntegrand(const ThisType& other)
: BaseType(other.parameter_type())
, vector_(other.vector_)
, local_function_(vector_.access().local_function())
, local_function_(vector_.local_function())
{}

LocalElementGradientValueIntegrand(ThisType&& source) = default;
Expand Down Expand Up @@ -162,7 +155,7 @@ private:
}
};

const XT::Common::ConstStorageProvider<VectorGridFunctionType> vector_;
const VectorGridFunctionType vector_;
std::unique_ptr<typename VectorGridFunctionType::LocalFunctionType> local_function_;
mutable VectorValues vector_values_;
mutable BasisValues values_;
Expand All @@ -173,4 +166,4 @@ private:
} // namespace GDT
} // namespace Dune

#endif // DUNE_GDT_LOCAL_INTEGRANDS_QUADRATIC_HH
#endif // DUNE_GDT_LOCAL_INTEGRANDS_GRADIENT_VALUE_HH
4 changes: 4 additions & 0 deletions dune/gdt/local/integrands/laplace.hh
Expand Up @@ -60,6 +60,10 @@ public:
protected:
void post_bind(const ElementType& ele) override
{
#ifndef NDEBUG
if (!ele.geometry().affine())
std::cerr << "Warning: integration order has to be increased for non-affine geometries!" << std::endl;
#endif
local_weight_->bind(ele);
}

Expand Down
Expand Up @@ -5,14 +5,10 @@
// or GPL-2.0+ (http://opensource.org/licenses/gpl-license)
// with "runtime exception" (http://www.dune-project.org/license.html)
// Authors:
// Felix Schindler (2013 - 2018)
// Kirsten Weber (2013)
// René Fritze (2014, 2016, 2018)
// René Milk (2017)
// Tobias Leibner (2014, 2016 - 2018)

#ifndef DUNE_GDT_LOCAL_INTEGRANDS_SYMMETRIC_ELLIPTIC_HH
#define DUNE_GDT_LOCAL_INTEGRANDS_SYMMETRIC_ELLIPTIC_HH
#ifndef DUNE_GDT_LOCAL_INTEGRANDS_SYMMETRIZED_LAPLACE_HH
#define DUNE_GDT_LOCAL_INTEGRANDS_SYMMETRIZED_LAPLACE_HH

#include <dune/xt/common/memory.hh>
#include <dune/xt/la/container/eye-matrix.hh>
Expand All @@ -32,12 +28,12 @@ namespace GDT {
* psi in the test basis. Here, ':' denotes the (matrix) scalar product.
*/
template <class E, class F = double>
class LocalSymmetricEllipticIntegrand
class LocalSymmetrizedLaplaceIntegrand
: public LocalBinaryElementIntegrandInterface<E, E::dimension, 1, F, F, E::dimension, 1, F>
{

using BaseType = LocalBinaryElementIntegrandInterface<E, E::dimension, 1, F, F, E::dimension, 1, F>;
using ThisType = LocalSymmetricEllipticIntegrand;
using ThisType = LocalSymmetrizedLaplaceIntegrand;

public:
using BaseType::d;
Expand All @@ -49,32 +45,32 @@ public:

using DiffusionFactorType = XT::Functions::GridFunctionInterface<E, 1, 1, F>;

LocalSymmetricEllipticIntegrand(const F& diffusion_factor = F(1))
LocalSymmetrizedLaplaceIntegrand(const F& diffusion_factor = F(1))
: BaseType()
, diffusion_factor_(new XT::Functions::FunctionAsGridFunctionWrapper<E, 1, 1, F>(
new XT::Functions::ConstantFunction<d, 1, 1, F>(diffusion_factor)))
, local_diffusion_factor_(diffusion_factor_.access().local_function())
{}

LocalSymmetricEllipticIntegrand(const XT::Functions::FunctionInterface<d, 1, 1, F>& diffusion_factor)
LocalSymmetrizedLaplaceIntegrand(const XT::Functions::FunctionInterface<d, 1, 1, F>& diffusion_factor)
: BaseType(diffusion_factor.parameter_type())
, diffusion_factor_(new XT::Functions::FunctionAsGridFunctionWrapper<E, 1, 1, F>(diffusion_factor))
, local_diffusion_factor_(diffusion_factor_.access().local_function())
{}

LocalSymmetricEllipticIntegrand(const DiffusionFactorType& diffusion_factor)
LocalSymmetrizedLaplaceIntegrand(const DiffusionFactorType& diffusion_factor)
: BaseType(diffusion_factor.parameter_type())
, diffusion_factor_(diffusion_factor)
, local_diffusion_factor_(diffusion_factor_.access().local_function())
{}

LocalSymmetricEllipticIntegrand(const ThisType& other)
LocalSymmetrizedLaplaceIntegrand(const ThisType& other)
: BaseType(other.parameter_type())
, diffusion_factor_(other.diffusion_factor_)
, local_diffusion_factor_(diffusion_factor_.access().local_function())
{}

LocalSymmetricEllipticIntegrand(ThisType&& source) = default;
LocalSymmetrizedLaplaceIntegrand(ThisType&& source) = default;

std::unique_ptr<BaseType> copy() const override final
{
Expand Down Expand Up @@ -131,10 +127,10 @@ private:
mutable std::vector<typename LocalTestBasisType::DerivativeRangeType> test_basis_grads_;
mutable std::vector<typename LocalAnsatzBasisType::DerivativeRangeType> ansatz_basis_grads_;
mutable std::vector<typename LocalAnsatzBasisType::DerivativeRangeType> symmetric_ansatz_basis_grads_;
}; // class LocalSymmetricEllipticIntegrand
}; // class LocalSymmetrizedLaplaceIntegrand


} // namespace GDT
} // namespace Dune

#endif // DUNE_GDT_LOCAL_INTEGRANDS_SYMMETRIC_ELLIPTIC_HH
#endif // DUNE_GDT_LOCAL_INTEGRANDS_SYMMETRIZED_LAPLACE_HH
7 changes: 1 addition & 6 deletions dune/gdt/local/numerical-fluxes/kinetic.hh
Expand Up @@ -92,13 +92,8 @@ public:
n,
direction);
for (auto&& entry : ret)
if (std::isnan(entry) || std::isinf(entry)) {
// std::cout << XT::Common::to_string(ret) << std::endl;
// std::cout << XT::Common::to_string(u) << std::endl;
// std::cout << XT::Common::to_string(v) << std::endl;
// std::cout << this->intersection().geometry().center() << std::endl;
if (std::isnan(entry) || std::isinf(entry))
DUNE_THROW(Dune::MathError, "NaN or inf in kinetic flux");
}
return ret;
} else {
static const auto flux_matrices = initialize_flux_matrices(basis_);
Expand Down

0 comments on commit c462db2

Please sign in to comment.