private:
#ifdef DEAL_II_WITH_MUPARSER
/**
- * muParser will stores references to these variables.
+ * place for the variables for each thread
*/
-
- // TODO: document variables
mutable Threads::ThreadLocalStorage<std::vector<double> > vars;
+ /**
+ * the muParser objects for each thread (and one for each component)
+ */
mutable Threads::ThreadLocalStorage<std::vector<mu::Parser> > fp;
- mutable Threads::ThreadLocalStorage<unsigned int> init_at_version;
- unsigned int version;
-
+ /**
+ * keep track of all the constants, required to initialize fp in each thread
+ */
std::map< std::string, double > constants;
+ /**
+ * variable names, required to initialize fp in each thread
+ */
std::vector<std::string> var_names;
+ /**
+ * the expressions, required to initialize fp in each thread
+ */
std::vector<std::string> expressions;
+ /**
+ * this function will initialize fp on the current thread
+ */
void init_muparser() const;
#else
/**
:
Function<dim>(n_components, initial_time)
#ifdef DEAL_II_WITH_MUPARSER
- ,version(0)
#else
,fp (0)
#endif
template <int dim>
void FunctionParser<dim>:: init_muparser() const
{
- if (version == init_at_version.get())
+ if (fp.get().size()>0)
return;
fp.get().resize(this->n_components);
{
#ifdef DEAL_II_WITH_MUPARSER
- version++;
-
+ this->fp.clear(); // this will reset all thread-local objects
+
this->constants = constants;
this->var_names = Utilities::split_string_list(variables, ',');
this->expressions = expressions;