1515#include " 4C_utils_functionvariables.hpp"
1616
1717#include < memory>
18+ #include < span>
1819#include < string>
1920#include < vector>
2021
@@ -51,6 +52,23 @@ namespace Core::Utils
5152 */
5253 virtual double evaluate (const double * x, double t, std::size_t component) const = 0;
5354
55+ /* !
56+ * @brief Vector-valued evaluation of time and space dependent function
57+ *
58+ * Evaluate the function at the specified position and point in time and return the vector of
59+ * all components.
60+ *
61+ * @param x the point in 3-dimensional space in which the function will be evaluated
62+ * @param t the point in time in which the function will be evaluated
63+ * @param values function values
64+ */
65+ virtual void evaluate_vector (
66+ const std::span<const double , 3 > x, double t, std::span<double > values) const
67+ {
68+ for (std::size_t i = 0 ; i < number_components (); ++i) values[i] = evaluate (x.data (), t, i);
69+ }
70+
71+
5472 /* !
5573 * \brief Evaluation of first spatial derivative of time and space dependent function
5674 *
@@ -64,8 +82,6 @@ namespace Core::Utils
6482 const double * x, double t, std::size_t component) const
6583 {
6684 FOUR_C_THROW (" The evaluation of the derivative is not implemented for this function" );
67- std::vector<double > emptyvector;
68- return emptyvector;
6985 };
7086
7187 /* !
@@ -85,8 +101,6 @@ namespace Core::Utils
85101 const double * x, double t, unsigned deg, std::size_t component) const
86102 {
87103 FOUR_C_THROW (" The evaluation of the time derivative is not implemented for this function" );
88- std::vector<double > emptyvector;
89- return emptyvector;
90104 };
91105
92106 // / Return number of components of function
0 commit comments