7#include <units/units.hpp>
24 unit_type_ = units::unit_from_string(unit_type);
27 expr.set_unit_type(unit_type);
32 void init(
const Eigen::MatrixXd &
val);
34#ifdef POLYFEM_WITH_PYTHON
35 void init_python(
const std::string &path,
const std::string &function_name);
38 void init(
const std::function<
double(
double x,
double y,
double z)> &func);
39 void init(
const std::function<
double(
double x,
double y,
double z,
double t)> &func);
40 void init(
const std::function<
double(
double x,
double y,
double z,
double t,
int index)> &func);
42 void init(
const std::function<Eigen::MatrixXd(
double x,
double y,
double z)> &func,
const int coo);
43 void init(
const std::function<Eigen::MatrixXd(
double x,
double y,
double z,
double t)> &func,
const int coo);
48 double operator()(
double x,
double y,
double z = 0,
double t = 0,
int index = -1)
const;
56 return expr_.find_first_of(
"xyzt") == std::string::npos &&
mat_.size() == 0 &&
mat_expr_.empty()
67 if (value.is_time_dependent())
92 assert(
mat_.rows() == mat.rows());
93 assert(
mat_.cols() == mat.cols());
103 std::function<double(
double x,
double y,
double z,
double t,
int index)>
sfunc_;
104 std::function<Eigen::MatrixXd(
double x,
double y,
double z,
double t)>
tfunc_;
ElementAssemblyValues vals
Read-only interface to a hierarchical collection of simulation resources.
bool is_constant() const
Independent of coordinates, time and index.
bool is_time_dependent() const
Potentially time-dependent: callbacks/time tables or a formula containing 't' (including conservative...
void set_index(const int index)
void set_t(const json &t)
std::vector< ExpressionValue > mat_expr_
units::precise_unit unit_
std::function< double(double x, double y, double z, double t, int index)> sfunc_
std::function< Eigen::MatrixXd(double x, double y, double z, double t)> tfunc_
std::map< double, int > t_index_
units::precise_unit unit_type_
void set_unit_type(const std::string &unit_type)
double operator()(double x, double y, double z=0, double t=0, int index=-1) const
const Eigen::MatrixXd & get_mat() const
void init(const json &vals, const io::ResourceIO &resources)
void set_mat(const Eigen::MatrixXd &mat)
bool python_gil_held()
Whether the caller holds Python's interpreter lock.