Reference documentation for deal.II version 9.4.1
\(\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// Copyright (C) 2005 - 2022 by the deal.II authors
4//
5// This file is part of the deal.II library.
6//
7// The deal.II library is free software; you can use it, redistribute
8// it, and/or modify it under the terms of the GNU Lesser General
9// Public License as published by the Free Software Foundation; either
10// version 2.1 of the License, or (at your option) any later version.
11// The full text of the license can be found in the file LICENSE.md at
12// the top level directory of deal.II.
13//
14// ---------------------------------------------------------------------
15
16#ifndef dealii_mu_parser_internal_h
17#define dealii_mu_parser_internal_h
18
19// This file contains functions used internally by the FunctionParser
20// and the TensorFunctionParser class.
21
22#include <deal.II/base/config.h>
23
25#include <deal.II/base/point.h>
27
28#include <memory>
29#include <string>
30#include <vector>
31
33
34namespace internal
35{
37 {
38 int
39 mu_round(double val);
40
41 double
42 mu_if(double condition, double thenvalue, double elsevalue);
43
44 double
45 mu_or(double left, double right);
46
47 double
48 mu_and(double left, double right);
49
50 double
51 mu_int(double value);
52
53 double
54 mu_ceil(double value);
55
56 double
57 mu_floor(double value);
58
59 double
60 mu_cot(double value);
61
62 double
63 mu_csc(double value);
64
65 double
66 mu_sec(double value);
67
68 double
69 mu_log(double value);
70
71 double
72 mu_pow(double a, double b);
73
74 double
75 mu_erf(double value);
76
77 double
78 mu_erfc(double value);
79
80 // returns a random value in the range [0,1] initializing the generator
81 // with the given seed
82 double
83 mu_rand_seed(double seed);
84
85 // returns a random value in the range [0,1]
86 double
87 mu_rand();
88
92 std::vector<std::string>
94
100 int,
101 std::string,
102 << "Parsing Error at Column " << arg1
103 << ". The parser said: " << arg2);
104
106
115 {
116 public:
117 virtual ~muParserBase() = default;
118 };
119
128 {
134 ParserData() = default;
135
143 ParserData(const ParserData &) = delete;
144
149 std::vector<double> vars;
150
154 std::vector<std::unique_ptr<muParserBase>> parsers;
155 };
156
157 template <int dim, typename Number>
159 {
160 public:
162
163 virtual ~ParserImplementation() = default;
164
170 virtual void
171 initialize(const std::string & vars,
172 const std::vector<std::string> & expressions,
173 const std::map<std::string, double> &constants,
174 const bool time_dependent = false);
175
180 void
181 init_muparser() const;
182
186 Number
187 do_value(const Point<dim> &p,
188 const double time,
189 unsigned int component) const;
190
194 void
195 do_all_values(const Point<dim> & p,
196 const double time,
197 ArrayView<Number> &values) const;
198
203 std::vector<std::string> expressions;
204
205 private:
212
217 std::map<std::string, double> constants;
218
223 std::vector<std::string> var_names;
224
230
238 unsigned int n_vars;
239 };
240 } // namespace FunctionParser
241} // namespace internal
242
244
245#endif
Definition: point.h:111
A class that provides a separate storage location on each thread that accesses the object.
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:442
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:443
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
std::vector< std::unique_ptr< muParserBase > > parsers
static ::ExceptionBase & ExcParseError(int arg1, std::string arg2)
#define DeclException2(Exception2, type1, type2, outsequence)
Definition: exceptions.h:532
ParserData(const ParserData &)=delete
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)
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)