Skip to content

Commit

Permalink
fix 2
Browse files Browse the repository at this point in the history
  • Loading branch information
henrij22 committed Jan 16, 2025
1 parent 4f64d15 commit 4780e87
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 26 deletions.
50 changes: 25 additions & 25 deletions ikarus/io/resultfunction.hh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@ namespace Ikarus {
namespace Impl {
struct DefaultUserFunction
{
/**
* \brief Calculate the result quantity
* \param resultArray EigenVector containing the stress state in Voigt notation
* \param comp component of result
* \tparam R Type of the matrix
* \return the result
*/
template <typename R>
double operator()(const R& resultArray, const auto& pos, const auto& fe, const int comp) const {};
};
} // namespace Impl

Expand Down Expand Up @@ -158,13 +167,11 @@ private:
* \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)
* \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)
*/
template <template <typename, int, int> class RT, typename UserFunction = Impl::DefaultUserFunction,
Concepts::FlatAssembler AS, typename... Args>
Expand All @@ -179,35 +186,28 @@ auto makeResultFunction(std::shared_ptr<AS> assembler, Dune::VTK::Precision prec
* \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 userFunction (optional) the user function (default is DefaultUserFunction)
* \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 \param assembler shared pointer to the underlying assembler
* (provides the finite elements and the requested results) \param userFunction the user function
*/
template <template <typename, int, int> class RT, typename UserFunction = Impl::DefaultUserFunction,
Concepts::FlatAssembler AS, typename... Args>
auto makeResultFunction(std::shared_ptr<AS> assembler, UserFunction&& userFunction = {}) {
return std::make_shared<ResultFunction<AS, RT, UserFunction>>(assembler, Dune::VTK::Precision::float64,
std::forward<UserFunction>(userFunction));
auto makeResultFunction(std::shared_ptr<AS> assembler, UserFunction&& userFunction) {
return makeResultFunction<RT>(assembler, Dune::VTK::Precision::float64, std::forward<UserFunction>(userFunction));
}

/**
* \brief Function to create a ResultFunction as a gridfunction that can be used with dune-vtk
* \details
* Constructs a ResultFunction object with given assembler as a VTK::Function to be used withdune-vtk It is possible to
* construct a localFunction from this as follows
* \code
* auto localResultFunction = localFunction(vtkResultFunction);
* localResultFunction.bind(element);
* \endcode
* \tparam AS type of the assembler
* Constructs a ResultFunction object with given assembler as a VTK::Function to be used withdune-vtk It is possible
* to construct a localFunction from this as follows \code auto localResultFunction =
* localFunction(vtkResultFunction); localResultFunction.bind(element); \endcode \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 userFunction the user function (default is DefaultUserFunction)
* \param assembler shared pointer to the underlying assembler (provides the finite elements and the requested
* results) \param userFunction the user function (default is DefaultUserFunction)
*/
template <template <typename, int, int> class RT, typename UserFunction = Impl::DefaultUserFunction,
Concepts::FlatAssembler AS, typename... Args>
Expand Down
5 changes: 4 additions & 1 deletion tests/src/testnonlinearelasticity.hh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ using Dune::TestSuite;

struct OwnResultFunction
{
double operator()(const auto& resultArray, [[maybe_unused]] int /* comp */) const { return 7; }
double operator()(const auto& resultArray, [[maybe_unused]] const auto& pos, [[maybe_unused]] const auto& fe,
[[maybe_unused]] const int comp) const {
return 7;
}
static std::string name() { return "Seven"; }
static int ncomps() { return 1; }
};
Expand Down

0 comments on commit 4780e87

Please sign in to comment.