Skip to content
Snippets Groups Projects
Commit 38376623 authored by Tobias Leibner's avatar Tobias Leibner
Browse files

Merge branch 'werror_in_ci' into 'master'

Werror in ci

See merge request !7
parents abe829d3 4b614624
No related branches found
No related tags found
1 merge request!7Werror in ci
Pipeline #108569 passed
......@@ -15,7 +15,11 @@
# set up project
project("dune-gdt" CXX)
cmake_minimum_required(VERSION 3.1)
cmake_minimum_required(VERSION 3.13)
if("${TRAVIS}" EQUAL "1")
add_compile_options(-Werror)
endif()
if(NOT
(dune-common_DIR
......
This diff is collapsed.
// This file is part of the dune-gdt project:
// https://github.com/dune-community/dune-gdt
// Copyright 2010-2018 dune-gdt developers and contributors. All rights reserved.
// License: Dual licensed as BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
// 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)
#warning This header is deprecated, use and include <dune/gdt/local/integrands/laplace.hh> instead!
#ifndef DUNE_GDT_LOCAL_INTEGRANDS_ELLIPTIC_HH
# define DUNE_GDT_LOCAL_INTEGRANDS_ELLIPTIC_HH
# include <dune/xt/common/memory.hh>
# include <dune/xt/la/container/eye-matrix.hh>
# include <dune/xt/functions/base/function-as-grid-function.hh>
# include <dune/xt/functions/constant.hh>
# include <dune/xt/functions/interfaces/grid-function.hh>
# include "interfaces.hh"
namespace Dune {
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.
* If phi and psi are vector-valued, \nabla phi is the jacobian matrix and we are actually computing
* `lambda(x) * {[kappa(x) (\nabla phi(x))^T] : (\nabla psi(x))^T}`, where ':' denotes the matrix scalar product.
*/
template <class E, size_t r = 1, class F = double>
class [[deprecated("Use LocalLaplaceIntegrand instead (10.08.2019)!")]] LocalEllipticIntegrand
: public LocalBinaryElementIntegrandInterface<E, r, 1, F, F, r, 1, F>
{
using BaseType = LocalBinaryElementIntegrandInterface<E, r, 1, F, F, r, 1, F>;
using ThisType = LocalEllipticIntegrand;
public:
using BaseType::d;
using typename BaseType::DomainType;
using typename BaseType::ElementType;
using typename BaseType::LocalAnsatzBasisType;
using typename BaseType::LocalTestBasisType;
using DiffusionFactorType = XT::Functions::GridFunctionInterface<E, 1, 1, F>;
using DiffusionTensorType = XT::Functions::GridFunctionInterface<E, d, d, F>;
LocalEllipticIntegrand(const F& diffusion_factor = F(1),
const XT::Common::FieldMatrix<F, d, d>& diffusion_tensor =
XT::LA::eye_matrix<FieldMatrix<F, d, d>>(d, d))
: BaseType()
, diffusion_factor_(new XT::Functions::FunctionAsGridFunctionWrapper<E, 1, 1, F>(
new XT::Functions::ConstantFunction<d, 1, 1, F>(diffusion_factor)))
, diffusion_tensor_(new XT::Functions::FunctionAsGridFunctionWrapper<E, d, d, F>(
new XT::Functions::ConstantFunction<d, d, d, F>(diffusion_tensor)))
, local_diffusion_factor_(diffusion_factor_.access().local_function())
, local_diffusion_tensor_(diffusion_tensor_.access().local_function())
{}
LocalEllipticIntegrand(const XT::Functions::FunctionInterface<d, 1, 1, F>& diffusion_factor,
const XT::Functions::FunctionInterface<d, d, d, F>& diffusion_tensor)
: BaseType(diffusion_factor.parameter_type() + diffusion_tensor.parameter_type())
, diffusion_factor_(new XT::Functions::FunctionAsGridFunctionWrapper<E, 1, 1, F>(diffusion_factor))
, diffusion_tensor_(new XT::Functions::FunctionAsGridFunctionWrapper<E, d, d, F>(diffusion_tensor))
, local_diffusion_factor_(diffusion_factor_.access().local_function())
, local_diffusion_tensor_(diffusion_tensor_.access().local_function())
{}
LocalEllipticIntegrand(const DiffusionFactorType& diffusion_factor, const DiffusionTensorType& diffusion_tensor)
: BaseType(diffusion_factor.parameter_type() + diffusion_tensor.parameter_type())
, diffusion_factor_(diffusion_factor)
, diffusion_tensor_(diffusion_tensor)
, local_diffusion_factor_(diffusion_factor_.access().local_function())
, local_diffusion_tensor_(diffusion_tensor_.access().local_function())
{}
LocalEllipticIntegrand(const ThisType& other)
: BaseType(other)
, diffusion_factor_(other.diffusion_factor_)
, diffusion_tensor_(other.diffusion_tensor_)
, local_diffusion_factor_(diffusion_factor_.access().local_function())
, local_diffusion_tensor_(diffusion_tensor_.access().local_function())
{}
LocalEllipticIntegrand(ThisType && source) = default;
std::unique_ptr<BaseType> copy_as_binary_element_integrand() const override final
{
return std::make_unique<ThisType>(*this);
}
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_diffusion_factor_->bind(ele);
local_diffusion_tensor_->bind(ele);
}
public:
int order(const LocalTestBasisType& test_basis,
const LocalAnsatzBasisType& ansatz_basis,
const XT::Common::Parameter& param = {}) const override final
{
return local_diffusion_factor_->order(param) + local_diffusion_tensor_->order(param) + test_basis.order(param)
+ ansatz_basis.order(param);
}
void evaluate(const LocalTestBasisType& test_basis,
const LocalAnsatzBasisType& ansatz_basis,
const DomainType& point_in_reference_element,
DynamicMatrix<F>& result,
const XT::Common::Parameter& param = {}) const override final
{
// prepare storage
const size_t rows = test_basis.size(param);
const size_t cols = ansatz_basis.size(param);
if (result.rows() < rows || result.cols() < cols)
result.resize(rows, cols);
result *= 0;
// evaluate
test_basis.jacobians(point_in_reference_element, test_basis_grads_, param);
ansatz_basis.jacobians(point_in_reference_element, ansatz_basis_grads_, param);
const auto diffusion = local_diffusion_tensor_->evaluate(point_in_reference_element, param)
* local_diffusion_factor_->evaluate(point_in_reference_element, param)[0];
// compute elliptic evaluation
for (size_t ii = 0; ii < rows; ++ii)
for (size_t jj = 0; jj < cols; ++jj)
for (size_t rr = 0; rr < r; ++rr)
result[ii][jj] += (diffusion * ansatz_basis_grads_[jj][rr]) * test_basis_grads_[ii][rr];
} // ... evaluate(...)
private:
const XT::Common::ConstStorageProvider<DiffusionFactorType> diffusion_factor_;
const XT::Common::ConstStorageProvider<DiffusionTensorType> diffusion_tensor_;
std::unique_ptr<typename DiffusionFactorType::LocalFunctionType> local_diffusion_factor_;
std::unique_ptr<typename DiffusionTensorType::LocalFunctionType> local_diffusion_tensor_;
mutable std::vector<typename LocalTestBasisType::DerivativeRangeType> test_basis_grads_;
mutable std::vector<typename LocalAnsatzBasisType::DerivativeRangeType> ansatz_basis_grads_;
}; // class LocalEllipticIntegrand
} // namespace GDT
} // namespace Dune
#endif // DUNE_GDT_LOCAL_INTEGRANDS_ELLIPTIC_HH
// This file is part of the dune-gdt project:
// https://github.com/dune-community/dune-gdt
// Copyright 2010-2018 dune-gdt developers and contributors. All rights reserved.
// License: Dual licensed as BSD 2-Clause License (http://opensource.org/licenses/BSD-2-Clause)
// or GPL-2.0+ (http://opensource.org/licenses/gpl-license)
// with "runtime exception" (http://www.dune-project.org/license.html)
// Authors:
// Felix Schindler (2018)
#ifndef DUNE_GDT_OPERATORS_LOCALIZABLE_BILINEAR_FORM_HH
#define DUNE_GDT_OPERATORS_LOCALIZABLE_BILINEAR_FORM_HH
#warning "This header is deprecated, include <dune/gdt/bilinear-form.hh> instead (03.08.2020)!"
#include <dune/xt/la/type_traits.hh>
#include <dune/xt/grid/type_traits.hh>
#include <dune/xt/grid/walker.hh>
#include <dune/xt/functions/interfaces/grid-function.hh>
#include <dune/gdt/local/assembler/bilinear-form-accumulators.hh>
#include <dune/gdt/local/bilinear-forms/interfaces.hh>
namespace Dune {
namespace GDT {
template <class GridView,
size_t source_range_dim = 1,
size_t source_range_dim_cols = 1,
class SourceRangeField = double,
class Result = double,
size_t range_range_dim = source_range_dim,
size_t range_range_dim_cols = source_range_dim_cols,
class RangeRangeField = SourceRangeField>
class [[deprecated("Use BilinearForm instead (03.08.2020)!")]] LocalizableBilinearFormBase
: public XT::Grid::Walker<GridView>
{
static_assert(XT::Grid::is_view<GridView>::value, "");
using ThisType = LocalizableBilinearFormBase<GridView,
source_range_dim,
source_range_dim_cols,
SourceRangeField,
Result,
range_range_dim,
range_range_dim_cols,
RangeRangeField>;
using BaseType = XT::Grid::Walker<GridView>;
public:
using GV = GridView;
using GridViewType = GridView;
using E = XT::Grid::extract_entity_t<GV>;
using ResultType = Result;
static constexpr size_t s_r = source_range_dim;
static constexpr size_t s_rC = source_range_dim_cols;
using SR = SourceRangeField;
using SourceType = XT::Functions::GridFunctionInterface<E, s_r, s_rC, SR>;
static constexpr size_t r_r = range_range_dim;
static constexpr size_t r_rC = range_range_dim_cols;
using RR = RangeRangeField;
using RangeType = XT::Functions::GridFunctionInterface<E, r_r, r_rC, RR>;
using typename BaseType::I;
using ElementFilterType = XT::Grid::ElementFilter<GridViewType>;
using IntersectionFilterType = XT::Grid::IntersectionFilter<GridViewType>;
using ApplyOnAllElements = XT::Grid::ApplyOn::AllElements<GridViewType>;
using ApplyOnAllIntersection = XT::Grid::ApplyOn::AllIntersections<GridViewType>;
LocalizableBilinearFormBase(GridViewType grid_view, const SourceType& src, const RangeType& rng)
: BaseType(grid_view)
, source_(src)
, range_(rng)
, assembled_(false)
{
// to detect assembly
this->append(
[](/*prepare nothing*/) {}, [](const auto&) { /*apply nothing*/ }, [&](/*finalize*/) { assembled_ = true; });
}
const SourceType& source() const
{
return source_;
}
const RangeType& range() const
{
return range_;
}
using BaseType::append;
ThisType& append(
const LocalElementBilinearFormInterface<E, s_r, s_rC, SR, Result, r_r, r_rC, RR>& local_bilinear_form,
const XT::Common::Parameter& param = {},
const ElementFilterType& filter = ApplyOnAllElements())
{
local_accumulators_.emplace_back(
make_local_element_bilinear_form_accumulator<GV>(local_bilinear_form, source_, range_, param));
this->append(*local_accumulators_.back(), filter);
return *this;
}
ThisType& append(
std::unique_ptr<
LocalElementBilinearFormInterface<E, s_r, s_rC, SR, Result, r_r, r_rC, RR>> && local_bilinear_form,
const XT::Common::Parameter& param = {},
const ElementFilterType& filter = ApplyOnAllElements())
{
local_forms_.emplace_back(std::move(local_bilinear_form));
local_accumulators_.emplace_back(
make_local_element_bilinear_form_accumulator<GV>(*local_forms_.back(), source_, range_, param));
this->append(*local_accumulators_.back(), filter);
return *this;
}
void assemble(const bool use_tbb = false)
{
if (assembled_)
return;
// This clears all appended bilinear forms, which is ok, since we are done after assembling once!
this->walk(use_tbb);
assembled_ = true;
}
ResultType result() const
{
ResultType ret = 0;
for (const auto& local_accumulators : local_accumulators_)
ret += local_accumulators->result();
return ret;
}
protected:
const SourceType& source_;
const RangeType& range_;
bool assembled_;
std::list<std::unique_ptr<LocalElementBilinearFormInterface<E, s_r, s_rC, SR, Result, r_r, r_rC, RR>>> local_forms_;
std::list<std::unique_ptr<LocalElementBilinearFormAccumulator<GridView, s_r, s_rC, SR, ResultType, r_r, r_rC, RR>>>
local_accumulators_;
}; // class LocalizableBilinearFormBase
template <class GV, size_t s_r, size_t s_rC, class SR, size_t r_r, size_t r_rC, class RR>
[[deprecated("Use make_bilinear_form instead (03.08.2020)!")]] std::
enable_if_t<XT::Grid::is_view<GV>::value, LocalizableBilinearFormBase<GV, s_r, s_rC, SR, double, r_r, r_rC, RR>>
make_localizable_bilinear_form(
GV grid_view,
const XT::Functions::GridFunctionInterface<XT::Grid::extract_entity_t<GV>, s_r, s_rC, SR>& source,
const XT::Functions::GridFunctionInterface<XT::Grid::extract_entity_t<GV>, r_r, r_rC, RR>& range)
{
return LocalizableBilinearFormBase<GV, s_r, s_rC, SR, double, r_r, r_rC, RR>(grid_view, source, range);
}
} // namespace GDT
} // namespace Dune
#endif // DUNE_GDT_OPERATORS_LOCALIZABLE_BILINEAR_FORM_HH
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment