deal2lkit: A ToolKit library for Deal.II
parsed_function.cc
Go to the documentation of this file.
1 //-----------------------------------------------------------
2 //
3 // Copyright (C) 2015 by the deal2lkit authors
4 //
5 // This file is part of the deal2lkit library.
6 //
7 // The deal2lkit 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 at
12 // the top level of the deal2lkit distribution.
13 //
14 //-----------------------------------------------------------
15 
17 #include <deal2lkit/utilities.h>
18 
19 
20 D2K_NAMESPACE_OPEN
21 
22 template<int dim>
23 ParsedFunction<dim>::ParsedFunction(const std::string &name,
24  const unsigned int &n_components,
25  const std::string &default_exp,
26  const std::string &default_const) :
27  ParameterAcceptor(name),
28  Functions::ParsedFunction<dim>(n_components),
29  default_exp(default_exp),
30  default_const(default_const),
31  n_components(n_components)
32 {}
33 
34 
35 template<int dim>
37 {
39  if (default_exp != "")
40  prm.set("Function expression", default_exp);
41  if (default_const != "")
42  prm.set("Function constants", default_const);
43 }
44 
45 
46 template<int dim>
48 {
50 }
51 
52 
53 template class ParsedFunction<1>;
54 template class ParsedFunction<2>;
55 template class ParsedFunction<3>;
56 
57 D2K_NAMESPACE_CLOSE
A parameter acceptor base class.
static ParameterHandler prm
Static parameter.
void set(const std::string &entry_name, const std::string &new_value)
static void declare_parameters(ParameterHandler &prm, const unsigned int n_components=1)
const std::string default_exp
Default expression of this function.
void parse_parameters(ParameterHandler &prm)
ParsedFunction(const std::string &name="", const unsigned int &n_components=1, const std::string &default_exp="", const std::string &default_const="")
Constructor: takes an optional name for the section.
const unsigned int n_components
virtual void parse_parameters(ParameterHandler &prm)
Calls the underlying function of ParsedFunction.
A deal2lkit wrapper for dealii::Functions::ParsedFunction.
const std::string default_const
virtual void declare_parameters(ParameterHandler &prm)
Calls the underlying function of ParsedFunction.