Fluid structure interaction suite
symbolic_function.cc
Go to the documentation of this file.
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2022 by Luca Heltai
4 //
5 // This file is part of the FSI-suite platform, based on the deal.II library.
6 //
7 // The FSI-suite platform is free software; you can use it, redistribute it,
8 // and/or modify it under the terms of the GNU Lesser General Public License as
9 // published by the Free Software Foundation; either version 3.0 of the License,
10 // or (at your option) any later version. The full text of the license can be
11 // found in the file LICENSE at the top level of the FSI-suite platform
12 // distribution.
13 //
14 // ---------------------------------------------------------------------
15 
16 
18 
19 #ifdef DEAL_II_WITH_SYMENGINE
20 
21 using namespace dealii;
22 
23 namespace ParsedTools
24 {
25  template <int dim>
27  const std::string &section_name,
28  const std::string &expression,
29  const std::string &function_description)
30  : ParameterAcceptor(section_name)
31  , symbolic_function(
32  std::make_unique<dealii::Functions::SymbolicFunction<dim>>(expression))
33  , n_components(symbolic_function->n_components)
34  {
35  add_parameter(function_description, this->symbolic_function);
37  // Make sure we have the correct number of components when parsing a new
38  // expression
40  function_description, [&](const std::string &) {
42  ExcMessage("Invalid number of components."));
43  });
45  }
46 
47  template class SymbolicFunction<1>;
48  template class SymbolicFunction<2>;
49  template class SymbolicFunction<3>;
50 } // namespace ParsedTools
51 
52 #endif
static ParameterHandler prm
void leave_my_subsection(ParameterHandler &prm)
void enter_my_subsection(ParameterHandler &prm)
void add_parameter(const std::string &entry, ParameterType &parameter, const std::string &documentation="", ParameterHandler &prm_=prm, const Patterns::PatternBase &pattern=*Patterns::Tools::Convert< ParameterType >::to_pattern())
void add_action(const std::string &entry, const std::function< void(const std::string &value)> &action, const bool execute_action=true)
A wrapper for the Functions::SymbolicFunction class.
std::unique_ptr< Functions::SymbolicFunction< dim > > symbolic_function
The actual Functions::SymbolicFunction object.
const unsigned int n_components
The number of components of the function.
static ::ExceptionBase & ExcMessage(std::string arg1)
#define AssertThrow(cond, exc)
unsigned int n_components(const std::string &component_names)
Count the number of components in the given list of comma separated components.
Definition: components.cc:32
We collect in this namespace some wrappers around commonly used deal.II classes, derived from the Par...
STL namespace.