deal.II version GIT relicensing-6834-g5b78e6bcdf 2026-10-01 11:20:01+00:00
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
Loading...
Searching...
No Matches
mu_parser_internal.h
Go to the documentation of this file.
1// -----------------------------------------------------------------------------
2//
3// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception OR LGPL-2.1-or-later
4// Copyright (C) 2019 - 2026 by the deal.II authors
5//
6// This file is part of the deal.II library.
7//
8// Detailed license information governing the source code and contributions
9// can be found in LICENSE.md and CONTRIBUTING.md at the top level directory.
10//
11// -----------------------------------------------------------------------------
12
13#ifndef dealii_mu_parser_internal_h
14#define dealii_mu_parser_internal_h
15
16// This file contains functions used internally by the FunctionParser
17// and the TensorFunctionParser class.
18
19#include <deal.II/base/config.h>
20
22#include <deal.II/base/point.h>
24
25#include <memory>
26#include <string>
27#include <vector>
28
30
31namespace internal
32{
34 {
35 int
36 mu_round(double val);
37
38 double
39 mu_if(double condition, double thenvalue, double elsevalue);
40
41 double
42 mu_or(double left, double right);
43
44 double
45 mu_and(double left, double right);
46
47 double
48 mu_int(double value);
49
50 double
51 mu_ceil(double value);
52
53 double
54 mu_floor(double value);
55
56 double
57 mu_cot(double value);
58
59 double
60 mu_csc(double value);
61
62 double
63 mu_sec(double value);
64
65 double
66 mu_log(double value);
67
68 double
69 mu_pow(double a, double b);
70
71 double
72 mu_erf(double value);
73
74 double
75 mu_erfc(double value);
76
77 // returns a random value in the range [0,1] initializing the generator
78 // with the given seed
79 double
80 mu_rand_seed(double seed);
81
82 // returns a random value in the range [0,1]
83 double
84 mu_rand();
85
89 std::vector<std::string>
91
97 int,
98 std::string,
99 << "Parsing Error at Column " << arg1
100 << ". The parser said: " << arg2);
101
112 {
113 public:
114 virtual ~muParserBase() = default;
115 };
116
125 {
131 ParserData() = default;
132
140 ParserData(const ParserData &) = delete;
141
146 std::vector<double> vars;
147
151 std::vector<std::unique_ptr<muParserBase>> parsers;
152 };
153
154 template <int dim, typename Number>
156 {
157 public:
159
160 virtual ~ParserImplementation() = default;
161
167 virtual void
168 initialize(const std::string &vars,
169 const std::vector<std::string> &expressions,
170 const std::map<std::string, double> &constants,
171 const bool time_dependent = false);
172
177 void
178 init_muparser() const;
179
183 Number
184 do_value(const Point<dim> &p,
185 const double time,
186 unsigned int component) const;
187
191 void
192 do_all_values(const Point<dim> &p,
193 const double time,
194 ArrayView<Number> &values) const;
195
200 std::vector<std::string> expressions;
201
202 private:
209
214 std::map<std::string, double> constants;
215
220 std::vector<std::string> var_names;
221
227
235 unsigned int n_vars;
236 };
237 } // namespace FunctionParser
238} // namespace internal
239
241
242#endif
Definition point.h:111
A class that provides a separate storage location on each thread that accesses the object.
Number do_value(const Point< dim > &p, const double time, unsigned int component) const
Threads::ThreadLocalStorage< internal::FunctionParser::ParserData > parser_data
void do_all_values(const Point< dim > &p, const double time, ArrayView< Number > &values) const
virtual void initialize(const std::string &vars, const std::vector< std::string > &expressions, const std::map< std::string, double > &constants, const bool time_dependent=false)
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:38
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:39
static ::ExceptionBase & ExcParseError(int arg1, std::string arg2)
#define DeclException2(Exception2, type1, type2, outsequence)
double mu_if(double condition, double thenvalue, double elsevalue)
double mu_erf(double value)
double mu_sec(double value)
double mu_floor(double value)
double mu_csc(double value)
double mu_pow(double a, double b)
double mu_log(double value)
double mu_rand_seed(double seed)
double mu_ceil(double value)
std::vector< std::string > get_function_names()
double mu_cot(double value)
double mu_int(double value)
double mu_or(double left, double right)
double mu_and(double left, double right)
double mu_erfc(double value)
std::vector< std::unique_ptr< muParserBase > > parsers
ParserData(const ParserData &)=delete