diff --git a/src/amdis/BoundaryManager.hpp b/src/amdis/BoundaryManager.hpp index c1f17acb7b687c37010a08c18df7fdf1f9fbdf6c..9e9191eb25e45f19a42b3c13910e905a68f90598 100644 --- a/src/amdis/BoundaryManager.hpp +++ b/src/amdis/BoundaryManager.hpp @@ -146,7 +146,7 @@ namespace AMDiS if (!segment.boundary()) continue; - Dune::Hybrid::ifElse(Dune::Std::is_detected<HasBoundaryId, Segment>{}, [&](auto id) { + Dune::Hybrid::ifElse(Dune::Std::is_detected<HasBoundaryId, Segment>{}, [&](auto id) -> void { auto index = segment.boundarySegmentIndex(); boundaryIds_[index] = id(segment).boundaryId(); }); diff --git a/src/amdis/ProblemStat.inc.hpp b/src/amdis/ProblemStat.inc.hpp index eab90170bf508b86b4829d8918c6ad9f42db0d0a..48686e05ed75fe8291f667931cfd2a6af2042423 100644 --- a/src/amdis/ProblemStat.inc.hpp +++ b/src/amdis/ProblemStat.inc.hpp @@ -179,7 +179,7 @@ void ProblemStat<Traits>::createMatricesAndVectors() rhs_ = std::make_shared<SystemVector>(globalBasis_, DataTransferOperation::NO_OPERATION); auto localView = globalBasis_->localView(); - for_each_node(localView.tree(), [&,this](auto const& node, auto treePath) + for_each_node(localView.tree(), [&,this](auto const& node, auto treePath) -> void { std::string i = to_string(treePath); estimates_[i].resize(globalBasis_->gridView().indexSet().size(0)); @@ -207,7 +207,7 @@ void ProblemStat<Traits>::createMarker() { marker_.clear(); auto localView = globalBasis_->localView(); - for_each_node(localView.tree(), [&,this](auto const& node, auto treePath) + for_each_node(localView.tree(), [&,this](auto const& node, auto treePath) -> void { std::string componentName = name_ + "->marker[" + to_string(treePath) + "]"; @@ -228,7 +228,7 @@ void ProblemStat<Traits>::createFileWriter() { filewriter_.clear(); auto localView = globalBasis_->localView(); - for_each_node(localView.tree(), [&,this](auto const& node, auto treePath) + for_each_node(localView.tree(), [&,this](auto const& node, auto treePath) -> void { std::string componentName = name_ + "->output[" + to_string(treePath) + "]"; @@ -380,11 +380,11 @@ globalRefine(int refCount) Dune::Timer t; bool adapted = false; Dune::Hybrid::ifElse(Dune::Std::is_detected<HasGlobalRefineADHI, Grid>{}, - /*then*/ [&](auto id) { + /*then*/ [&](auto id) -> void { // TODO(FM): Add a way to pass a GridTransfer as ADH with *globalBasis_ argument id(grid_)->globalRefine(refCount, GridTransferManager::gridTransfer(*grid_)); }, - /*else*/ [&](auto id) { + /*else*/ [&](auto id) -> void { for (int i = 0; i < refCount; ++i) { // mark all entities for grid refinement for (const auto& element : elements(grid_->leafGridView())) @@ -423,9 +423,9 @@ buildAfterAdapt(AdaptInfo& /*adaptInfo*/, Flag /*flag*/, bool asmMatrix, bool as rhs_->init(asmVector); auto localView = globalBasis_->localView(); - for_each_node(localView.tree(), [&,this](auto const& rowNode, auto rowTp) { + for_each_node(localView.tree(), [&,this](auto const& rowNode, auto rowTp) -> void { auto rowBasis = Dune::Functions::subspaceBasis(*globalBasis_, rowTp); - for_each_node(localView.tree(), [&,this](auto const& colNode, auto colTp) { + for_each_node(localView.tree(), [&,this](auto const& colNode, auto colTp) -> void { auto colBasis = Dune::Functions::subspaceBasis(*globalBasis_, colTp); for (auto bc : dirichletBCs_[rowNode][colNode]) bc->init(rowBasis, colBasis); @@ -451,8 +451,8 @@ buildAfterAdapt(AdaptInfo& /*adaptInfo*/, Flag /*flag*/, bool asmMatrix, bool as systemMatrix_->finish(asmMatrix); rhs_->finish(asmVector); - for_each_node(localView.tree(), [&,this](auto const& rowNode, auto row_tp) { - for_each_node(localView.tree(), [&,this](auto const& colNode, auto col_tp) { + for_each_node(localView.tree(), [&,this](auto const& rowNode, auto row_tp) -> void { + for_each_node(localView.tree(), [&,this](auto const& colNode, auto col_tp) -> void { // finish boundary condition for (auto bc : dirichletBCs_[rowNode][colNode]) bc->fillBoundaryCondition(*systemMatrix_, *solution_, *rhs_, rowNode, row_tp, colNode, col_tp); diff --git a/src/amdis/localoperators/ConvectionDiffusionOperator.hpp b/src/amdis/localoperators/ConvectionDiffusionOperator.hpp index a03c70a3857d71c55af65b9f232ebef47d57cb3c..0728f49752e9d2c4af24b6e966ab1f4302e59dae 100644 --- a/src/amdis/localoperators/ConvectionDiffusionOperator.hpp +++ b/src/amdis/localoperators/ConvectionDiffusionOperator.hpp @@ -184,8 +184,8 @@ namespace AMDiS { using Concept = Dune::Std::is_detected<HasLocalFunctionOrder, LocalFct>; return Dune::Hybrid::ifElse(Concept{}, - [&](auto id) { return order(id(localFct)); }, - [] (auto) { return 0; }); + [&](auto id) -> int { return order(id(localFct)); }, + [] (auto) -> int { return 0; }); } template <class T, int N> diff --git a/src/amdis/typetree/Traversal.hpp b/src/amdis/typetree/Traversal.hpp index 8dfd9cdffb669248e2b04d3672f23d623d7fc34c..396822c5340b3c1ec34e1486cef3aef65c0b6261 100644 --- a/src/amdis/typetree/Traversal.hpp +++ b/src/amdis/typetree/Traversal.hpp @@ -96,7 +96,7 @@ namespace AMDiS { if constexpr(visitChild) applyToTree(child, childTP, visitor); #else // AMDIS_HAS_CXX_CONSTEXPR_IF - Dune::Hybrid::ifElse(bool_t<visitChild>{}, [&] (auto /*id*/) { + Dune::Hybrid::ifElse(bool_t<visitChild>{}, [&] (auto /*id*/) -> void { applyToTree(child, childTP, visitor); }); #endif // AMDIS_HAS_CXX_CONSTEXPR_IF diff --git a/src/amdis/typetree/TreeData.hpp b/src/amdis/typetree/TreeData.hpp index d6ecfe62e809838da685f6171072d1ce2c0da8a8..c297dd4f37e7977d999a0a4d7f32d56d1fe8c356 100644 --- a/src/amdis/typetree/TreeData.hpp +++ b/src/amdis/typetree/TreeData.hpp @@ -120,7 +120,9 @@ namespace AMDiS assert(initialized_); assert(data_.size() > node.treeIndex()); using NodePtr = NodeData<Node>*; - return *NodePtr(data_[node.treeIndex()]); + auto* nodePtr = NodePtr(data_[node.treeIndex()]); + assert(nodePtr); + return *nodePtr; } //! Get reference to data associated to given node @@ -130,7 +132,9 @@ namespace AMDiS assert(initialized_); assert(data_.size() > node.treeIndex()); using NodePtr = NodeData<Node>*; - return *NodePtr(data_[node.treeIndex()]); + auto* nodePtr = NodePtr(data_[node.treeIndex()]); + assert(nodePtr); + return *nodePtr; } //! Swap tree and data container with `other` @@ -152,12 +156,12 @@ namespace AMDiS void initData() { std::size_t s = 0; - apply([&s](const auto& node, auto) { + apply([&s](const auto& node, auto) -> void { s = std::max(s, node.treeIndex()+1); }); data_.resize(s, nullptr); - apply([this](const auto& node, auto) { + apply([this](const auto& node, auto) -> void { using Node = std::remove_reference_t<decltype(node)>; data_[node.treeIndex()] = new NodeData<Node>; }); @@ -167,7 +171,7 @@ namespace AMDiS // Deep copy of node data void copyData(const TreeData& other) { - apply([&other,this](const auto& node, auto) { + apply([&other,this](const auto& node, auto) -> void { (*this)[node] = other[node]; }); } @@ -175,7 +179,7 @@ namespace AMDiS // For each node, delete the allocated node data void destroyData() { - apply([this](const auto& node, auto) { + apply([this](const auto& node, auto) -> void { using Node = std::remove_reference_t<decltype(node)>; using NodePtr = NodeData<Node>*; auto* p = NodePtr(data_[node.treeIndex()]); diff --git a/src/amdis/utility/QuadratureFactory.hpp b/src/amdis/utility/QuadratureFactory.hpp index a4a20524c28c88d6aa8025d25c628e81a4907851..865c6cd81223aa245eb7e926243ecd5d268a67bc 100644 --- a/src/amdis/utility/QuadratureFactory.hpp +++ b/src/amdis/utility/QuadratureFactory.hpp @@ -57,8 +57,8 @@ namespace AMDiS void bind(LocalFunction const& localFct) final { order_ = Dune::Hybrid::ifElse(Concept{}, - [&](auto id) { return AMDiS::order(id(localFct)); }, - [] (auto) { return -1; }); + [&](auto id) -> int { return AMDiS::order(id(localFct)); }, + [] (auto) -> int { return -1; }); } int order() const final { return order_; }