deal2lkit: A ToolKit library for Deal.II
parsed_grid_refinement.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 
18 
19 
20 D2K_NAMESPACE_OPEN
21 
22 
24  const std::string &strategy,
25  const double &top_parameter,
26  const double &bottom_parameter,
27  const unsigned int &max_cells,
28  const unsigned int &order) :
29  ParameterAcceptor(name),
30  strategy(strategy),
31  top_parameter(top_parameter),
32  bottom_parameter(bottom_parameter),
33  max_cells(max_cells),
34  order(order)
35 {}
36 
38 {
39  add_parameter(prm, &strategy,
40  "Refinement strategy", strategy,
41  Patterns::Selection("fraction|number"),
42  "Refinement strategy to use. fraction|number");
43 
45  "Top fraction", std::to_string(top_parameter),
46  Patterns::Double(0.0),
47  "Refinement fraction.");
48 
50  "Bottom fraction", std::to_string(bottom_parameter),
51  Patterns::Double(0.0),
52  "Coarsening fraction.");
53 
55  "Maximum number of cells (if available)", std::to_string(max_cells),
57  "Maximum number of cells.");
58 
59 
60  add_parameter(prm, &order,
61  "Order (optimize)", std::to_string(order),
63  "Maximum number of cells.");
64 
65 }
66 
67 D2K_NAMESPACE_CLOSE
68 
69 
A parameter acceptor base class.
static ParameterHandler prm
Static parameter.
ParsedGridRefinement(const std::string &name="", const std::string &strategy="fraction", const double &top_parameter=.3, const double &bottom_parameter=.1, const unsigned int &max_cells=0, const unsigned int &order=2)
Constructor.
virtual void declare_parameters(ParameterHandler &prm)
Declare local parameters.
std::string strategy
Default expression of this function.
void add_parameter(ParameterHandler &prm, T *parameter, const std::string &entry, const std::string &default_value, const Patterns::PatternBase &pattern=Patterns::Anything(), const std::string &documentation=std::string())
Add a parameter the given parameter list.