diff --git a/ikarus/CMakeLists.txt b/ikarus/CMakeLists.txt index 7aba01630..7cfdce156 100644 --- a/ikarus/CMakeLists.txt +++ b/ikarus/CMakeLists.txt @@ -9,7 +9,6 @@ file( CONFIGURE_DEPENDS *.cpp ) - dune_enable_all_packages() dune_add_library( ${PROJECT_NAME} diff --git a/ikarus/io/resultevaluators.hh b/ikarus/io/resultevaluators.hh index f47824285..5e2951b63 100644 --- a/ikarus/io/resultevaluators.hh +++ b/ikarus/io/resultevaluators.hh @@ -112,7 +112,7 @@ struct PrincipalStress const int comp) const { auto mat = fromVoigt(resultArray, false); Eigen::SelfAdjointEigenSolver eigensolver(mat, Eigen::EigenvaluesOnly); - return eigensolver.eigenvalues()[dim - 1 - comp]; + return eigensolver.eigenvalues().reverse()[comp]; } /** @@ -164,9 +164,9 @@ struct Triaxiality }; /** - * \brief Struct for calculating the 2d polar stress. The center of the coordinate system is chosen to be the center of - * the corresponding reference geometry. - \ingroup resultevaluators + * \brief Struct for calculating the 2d polar stress. The center of the coordinate system is to be passed to the + * evaluator. + * \ingroup resultevaluators */ struct PolarStress { @@ -200,8 +200,10 @@ struct PolarStress return polarStress(0, 0); case 1: return polarStress(1, 1); - default: // 2 + case 2: return polarStress(1, 0); + default: + __builtin_unreachable(); } } diff --git a/ikarus/io/resultfunction.hh b/ikarus/io/resultfunction.hh index b918928e6..af60889ea 100644 --- a/ikarus/io/resultfunction.hh +++ b/ikarus/io/resultfunction.hh @@ -29,8 +29,11 @@ namespace Impl { * \tparam R Type of the matrix * \return the result */ - template - double operator()(const R& resultArray, const auto& pos, const auto& fe, const int comp) const {}; + template + double operator()(const R& resultArray, const Dune::FieldVector& pos, const FiniteElement& fe, + const int comp) const { + return resultArray[comp]; + }; }; } // namespace Impl @@ -101,7 +104,7 @@ public: } /** - * \brief Get the name of the result type.P + * \brief Get the name of the result type. * \details * This function is required by the Dune::VTKFunction interface. * @@ -127,14 +130,14 @@ public: /** * \brief Construct a new Result Function object * - * \tparam Args Type of additional arguments passed to the user function + * \tparam UF Type of the user function * \param assembler shared pointer to the underlying assembler (provides the finite elements and the requested * results) * \param prec (optional) specify the used precision (only has an effect when using resultfunciton with * Dune::VTK::VTKWriter) * \param userFunction the user function (default is DefaultUserFunction) */ - template + template ResultFunction(std::shared_ptr assembler, Dune::VTK::Precision prec = Dune::VTK::Precision::float64, UF&& userFunction = {}) : assembler_(assembler), @@ -146,10 +149,7 @@ private: const auto& fe = finiteElements().at(eleID); auto result = fe.template calculateAt(requirement(), local).asVec(); - if constexpr (!std::is_same_v) { - return userFunction_(result, local, fe, comp); - } else - return result(comp); + return userFunction_(result, local, fe, comp); } const FEContainer& finiteElements() const { return assembler_->finiteElements(); } @@ -166,15 +166,17 @@ private: * \brief Function to create a ResultFunction as a shared_ptr * \details * Constructs a ResultFunction object with given assembler as shared_ptr to be used with the native Dune VTKWriter - * * \param assembler shared pointer to the underlying assembler (provides the finite elements and the requested - * results) \tparam AS type of the assembler \tparam RT requested result type \tparam UserFunction Type of the - * user-defined function for custom result evaluation (default is DefaultUserFunction) \param assembler shared pointer - * to the underlying assembler (provides the finite elements and the requested results) \param prec (optional) specify - * the used precision \param userFunction (optional) the user function (default is DefaultUserFunction) + * results) + * \tparam AS type of the assembler + * \tparam RT requested result type + * \tparam UserFunction Type of the user-defined function for custom result evaluation (default is DefaultUserFunction) + * \param assembler shared pointer to the underlying assembler (provides the finite elements and the requested results) + * \param prec (optional) specify the used precision + * \param userFunction (optional) the user function (default is DefaultUserFunction) */ template