Skip to content

Commit 392cdbe

Browse files
committed
Add scatra function cylinder magnet
1 parent e38501c commit 392cdbe

File tree

13 files changed

+2391
-12
lines changed

13 files changed

+2391
-12
lines changed

src/core/utils/src/functions/4C_utils_function.hpp

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
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

src/global_legacy_module/4C_global_legacy_module.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@
113113
#include "4C_red_airways_elementbase.hpp"
114114
#include "4C_rigidsphere.hpp"
115115
#include "4C_scatra_ele.hpp"
116+
#include "4C_scatra_functions.hpp"
116117
#include "4C_shell7p_ele.hpp"
117118
#include "4C_shell7p_ele_scatra.hpp"
118119
#include "4C_shell_kl_nurbs.hpp"
@@ -289,6 +290,7 @@ namespace
289290
Discret::Utils::add_valid_xfluid_functions(function_manager);
290291
add_valid_library_functions(function_manager);
291292
PoroMultiPhaseScaTra::add_valid_poro_functions(function_manager);
293+
ScaTra::add_valid_scatra_functions(function_manager);
292294
}
293295

294296
Core::IO::InputSpec valid_result_lines()

0 commit comments

Comments
 (0)