*
* @code
* class UserFunction: public AutoDerivativeFunction
- * { // access to one component at one point
- * double value (const Point<dim> &p, const
- * unsigned int component = 0) const
- * { // Implementation .... };
- * } user_function;
+ * {
+ * // access to one component at one point
+ * double value (const Point<dim> &p,
+ * const unsigned int component = 0) const override
+ * {
+ * // Implementation ....
+ * };
+ * };
*
- * // gradient by employing difference quotients.
+ * UserFunction user_function;
+ *
+ * // gradient by employing difference quotients.
* Tensor<1,dim> grad=user_function.gradient(some_point);
* @endcode
*
* @code
* ConditionalOStream pout(std::cout, this_mpi_process==0);
*
- * // all processes print following
- * // information to standard output
+ * // all processes print the following information to standard output
* std::cout << "Reading parameter file on process "
* << this_mpi_process << std::endl;
*
- * // following is printed by
- * // process 0 only
+ * // following is printed by process 0 only
* pout << "Solving ..." << std::endl;
* solve();
* pout << "done" << std::endl;
*
* @code
* // This is your own class, derived from ParameterAcceptor
- * class MyClass : public ParameterAcceptor {
- *
- * // The constructor of ParameterAcceptor requires a std::string,
- * // which defines the section name where the parameters of MyClass
- * // will be stored.
- *
- * MyClass() :
- * ParameterAcceptor("Some class name")
+ * class MyClass : public ParameterAcceptor
* {
- * add_parameter("A param", member_var);
- * }
+ * // The constructor of ParameterAcceptor requires a std::string,
+ * // which defines the section name where the parameters of MyClass
+ * // will be stored.
+ * MyClass()
+ * : ParameterAcceptor("Some class name")
+ * {
+ * add_parameter("A param", member_var);
+ * }
*
* private:
* std::vector<unsigned int> member_var;
- * ...
+ * ...
* };
*
- * int main() {
- * // Make sure you create your object BEFORE calling
- * // ParameterAcceptor::initialize()
- * MyClass class;
+ * int main()
+ * {
+ * // Make sure you create your object BEFORE calling
+ * // ParameterAcceptor::initialize()
+ * MyClass class;
*
- * // With this call, all derived classes will have their
- * // parameters initialized
- * ParameterAcceptor::initialize("file.prm");
+ * // With this call, all derived classes will have their
+ * // parameters initialized
+ * ParameterAcceptor::initialize("file.prm");
* }
* @endcode
*
* // If you don't pass anything to the constructor of
* // ParameterAcceptor, then the class name is used, "MyClass"
* // in this case
- * class MyClass : public ParameterAcceptor {
- *
- * virtual void declare_parameters(ParameterHandler &prm) {
- * ...
+ * class MyClass : public ParameterAcceptor
+ * {
+ * virtual void declare_parameters(ParameterHandler &prm)
+ * {
+ * ...
* }
*
- * virtual void parse_parameters(ParameterHandler &prm) {
+ * virtual void parse_parameters(ParameterHandler &prm)
+ * {
* ...
* }
* };
*
- * int main() {
- * // Make sure you create your object BEFORE calling
- * // ParameterAcceptor::initialize()
- * MyClass class;
- * ParameterAcceptor::initialize("file.prm");
- * class.run();
+ * int main()
+ * {
+ * // Make sure you create your object BEFORE calling
+ * // ParameterAcceptor::initialize()
+ * MyClass class;
+ * ParameterAcceptor::initialize("file.prm");
+ * class.run();
* }
* @endcode
*
* @code
* class MyClass : public ParameterAcceptor
* {
- * MyClass (std::string name);
- * virtual void declare_parameters(ParameterHandler &prm);
- * private:
- * SomeParsedClass<dim> my_subclass;
- * ...
+ * MyClass (std::string name);
+ * virtual void declare_parameters(ParameterHandler &prm);
+ * private:
+ * SomeParsedClass<dim> my_subclass;
+ * ...
* };
*
* MyClass::MyClass(std::string name)
- * :
- * ParameterAcceptor(name),
- * my_subclass("Forcing term")
+ * : ParameterAcceptor(name)
+ * , my_subclass("Forcing term")
* {}
*
* void MyClass::declare_parmeters(ParameterHandler &prm)
*
* int main()
* {
- * MyClass mc("My Class");
- * ParameterAcceptor::initialize("file.prm");
+ * MyClass mc("My Class");
+ * ParameterAcceptor::initialize("file.prm");
* }
* @endcode
*
* the constructor of MyClass:
* @code
* MyClass::MyClass(std::string name)
- * :
- * ParameterAcceptor(name),
- * my_subclass(name+" --- forcing term")
+ * : ParameterAcceptor(name)
+ * , my_subclass(name+" --- forcing term")
* {}
* @endcode
*
* ...
* ParameterHandler prm;
* prm.declare_entry ("Time step size",
- * "0.2",
- * Patterns::Double(),
- * "Some documentation");
+ * "0.2",
+ * Patterns::Double(),
+ * "Some documentation");
* prm.declare_entry ("Geometry",
- * "[0,1]x[0,1]",
- * Patterns::Anything());
+ * "[0,1]x[0,1]",
+ * Patterns::Anything());
* ...
* @endcode
* Each entry is declared using the function declare_entry(). The first
* example input parameters for linear solver routines should be classified in
* a subsection named <tt>Linear solver</tt> or any other suitable name. This
* is accomplished in the following way:
- * @code
- * ...
- * LinEq eq;
- * eq.declare_parameters (prm);
+ * @code
+ * ...
+ * LinEq eq;
+ * eq.declare_parameters (prm);
+ * ...
+ *
+ * void LinEq::declare_parameters (ParameterHandler &prm)
+ * {
+ * prm.enter_subsection("Linear solver");
+ * {
+ * prm.declare_entry ("Solver",
+ * "CG",
+ * Patterns::Selection("CG|GMRES|GaussElim"),
+ * "Name of a linear solver for the inner iteration");
+ * prm.declare_entry ("Maximum number of iterations", "20",
+ * ParameterHandler::RegularExpressions::Integer());
* ...
- *
- * void LinEq::declare_parameters (ParameterHandler &prm) {
- * prm.enter_subsection("Linear solver");
- * {
- * prm.declare_entry ("Solver",
- * "CG",
- * Patterns::Selection("CG|GMRES|GaussElim"),
- * "Name of a linear solver for the inner
- * iteration"); prm.declare_entry ("Maximum number of iterations", "20",
- * ParameterHandler::RegularExpressions::Integer());
- * ...
- * }
- * prm.leave_subsection ();
- * }
- * @endcode
+ * }
+ * prm.leave_subsection ();
+ * }
+ * @endcode
*
* Subsections may be nested. For example a nonlinear solver may have a linear
* solver as member object. Then the function call tree would be something
* like (if the class <tt>NonLinEq</tt> has a member variables <tt>eq</tt> of
* type <tt>LinEq</tt>):
- * @code
- * void NonLinEq::declare_parameters (ParameterHandler &prm) {
- * prm.enter_subsection ("Nonlinear solver");
- * {
- * prm.declare_entry ("Nonlinear method",
- * "Newton-Raphson",
- * ParameterHandler::RegularExpressions::Anything());
- * eq.declare_parameters (prm);
- * }
- * prm.leave_subsection ();
- * }
- * @endcode
+ * @code
+ * void NonLinEq::declare_parameters (ParameterHandler &prm)
+ * {
+ * prm.enter_subsection ("Nonlinear solver");
+ * {
+ * prm.declare_entry ("Nonlinear method",
+ * "Newton-Raphson",
+ * ParameterHandler::RegularExpressions::Anything());
+ * eq.declare_parameters (prm);
+ * }
+ * prm.leave_subsection ();
+ * }
+ * @endcode
*
* For class member functions which declare the different entries we propose
* to use the common name <tt>declare_parameters</tt>. In normal cases this
* has two or more member variables of the same type both of which should have
* their own parameters, this parent class' method <tt>declare_parameters</tt>
* is responsible to group them into different subsections:
- * @code
- * void NonLinEq::declare_parameters (ParameterHandler &prm) {
- * prm.enter_subsection ("Nonlinear solver");
- * {
- * prm.enter_subsection ("Linear solver 1");
- * {
- * eq1.declare_parameters (prm);
- * }
- * prm.leave_subsection ();
- *
- * prm.enter_subsection ("Linear solver 2");
- * {
- * eq2.declare_parameters (prm);
- * }
- * prm.leave_subsection ();
- * }
- * prm.leave_subsection ();
+ * @code
+ * void NonLinEq::declare_parameters (ParameterHandler &prm)
+ * {
+ * prm.enter_subsection ("Nonlinear solver");
+ * {
+ * prm.enter_subsection ("Linear solver 1");
+ * {
+ * eq1.declare_parameters (prm);
* }
- * @endcode
+ * prm.leave_subsection ();
+ *
+ * prm.enter_subsection ("Linear solver 2");
+ * {
+ * eq2.declare_parameters (prm);
+ * }
+ * prm.leave_subsection ();
+ * }
+ * prm.leave_subsection ();
+ * }
+ * @endcode
*
*
* <h3>Input files and special characters</h3>
* Each class gets its data out of a ParameterHandler object by calling the
* get() member functions like this:
* @code
- * void NonLinEq::get_parameters (ParameterHandler &prm) {
+ * void NonLinEq::get_parameters (ParameterHandler &prm)
+ * {
* prm.enter_subsection ("Nonlinear solver");
* std::string method = prm.get ("Nonlinear method");
* eq.get_parameters (prm);
* prm.declare_entry ("Number of iterations", // name of parameter
* "10", // default value
* Patterns::Integer(1,100),// allowed values: 1...100
- * "The number of ..."); // some documentation, to be
- * completed
+ * "The number of ..."); // some documentation
*
* // next read the parameter from an input file...
* prm.parse_input ("my_algorithm.prm");
* prm.declare_entry ("Number of iterations", // name of parameter
* "10", // default value
* Patterns::Integer(1,100),// allowed values: 1...100
- * "The number of ..."); // some documentation, to be
- * completed prm.add_action ("Number of iterations",
- * [&](const std::string &value) {
+ * "The number of ..."); // some documentation
+ * prm.add_action ("Number of iterations",
+ * [&](const std::string &value)
+ * {
* this->n_iterations = Utilities::string_to_int(value);
* });
*
* void Problem::declare_parameters (ParameterHandler &prm)
* {
* // first some global parameter entries
- * prm.declare_entry ("Output file",
- * "out",
- * Patterns::Anything(),
- * "Name of the output file, either relative to the
- * present " "path or absolute"); prm.declare_entry ("Equation 1", "Laplace",
+ * prm.declare_entry (
+ * "Output file",
+ * "out",
+ * Patterns::Anything(),
+ * "Name of the output file, either relative or absolute");
+ * prm.declare_entry ("Equation 1", "Laplace",
* Patterns::Anything(),
* "String identifying the equation we want to solve");
* prm.declare_entry ("Equation 2",
* eq2.get_parameters (prm); // for eq2
* }
* prm.leave_subsection ();
- * std::cout << " Problem: outfile=" << outfile << '\n'
- * << " eq1=" << equation1 << ", eq2=" << equation2
- * << '\n'
- * << " matrix1=" << matrix1 << ", matrix2=" << matrix2
- * << std::endl;
+ * std::cout
+ * << " Problem: outfile=" << outfile << '\n'
+ * << " eq1=" << equation1 << ", eq2=" << equation2 << '\n'
+ * << " matrix1=" << matrix1 << ", matrix2=" << matrix2
+ * << std::endl;
* }
*
*
* "up on a matrix.");
* prm.enter_subsection ("Preconditioner");
* {
- * prm.declare_entry ("Kind",
- * "SSOR",
- * Patterns::Selection ("SSOR|Jacobi"),
- * "A string that describes the kind of preconditioner
- * " "to use."); prm.declare_entry ("Relaxation factor", "1.0", Patterns::Double
- * (0, 1), "The numerical value (between zero and one) for the " "relaxation
- * factor to use in the preconditioner.");
+ * prm.declare_entry(
+ * "Kind",
+ * "SSOR",
+ * Patterns::Selection ("SSOR|Jacobi"),
+ * "A string that describes the kind of preconditioner to use.");
+ * prm.declare_entry(
+ * "Relaxation factor",
+ * "1.0",
+ * Patterns::Double (0, 1),
+ * "The numerical value (between zero and one) for the "
+ * "relaxation factor to use in the preconditioner.");
* }
* prm.leave_subsection ();
* @endcode
* <Maximal_20number_20of_20iterations>
* <value>10</value>
* <default_value>10</default_value>
- * <documentation>A parameter that describes the maximal number of
- * iterations the CG method is to take before giving up on a
- * matrix.</documentation> <pattern>0</pattern> <pattern_description>[Integer
- * range 1...1000 (inclusive)]</pattern_description>
+ * <documentation>
+ * A parameter that describes the maximal number of iterations the CG
+ * method is to take before giving up on a matrix.
+ * </documentation>
+ * <pattern>0</pattern>
+ * <pattern_description>
+ * [Integer range 1...1000 (inclusive)]
+ * </pattern_description>
* </Maximal_20number_20of_20iterations>
* <Preconditioner>
* <Kind><value>SSOR</value>
* <default_value>SSOR</default_value>
- * <documentation>A string that describes the kind of preconditioner to
- * use.</documentation> <pattern>1</pattern>
+ * <documentation>
+ * A string that describes the kind of preconditioner to use.
+ * </documentation>
+ * <pattern>1</pattern>
* <pattern_description>SSOR|Jacobi</pattern_description>
* </Kind>
* <Relaxation_20factor>
* <value>1.0</value>
* <default_value>1.0</default_value>
- * <documentation>The numerical value (between zero and one) for the
- * relaxation factor to use in the preconditioner.</documentation>
+ * <documentation>
+ * The numerical value (between zero and one) for the relaxation
+ * factor to use in the preconditioner.
+ * </documentation>
* <pattern>2</pattern>
- * <pattern_description>[Floating point range 0...1
- * (inclusive)]</pattern_description>
+ * <pattern_description>
+ * [Floating point range 0...1 (inclusive)]
+ * </pattern_description>
* </Relaxation_20factor>
* </Preconditioner>
* <ParameterHandler>
* << "> with default values for you."
* << std::endl;
* std::ofstream output (filename);
- * parameter_handler.print_parameters (output,
- * ParameterHandler::OutputStyle::Text);
+ * parameter_handler.print_parameters(
+ * output, ParameterHandler::OutputStyle::Text);
* }
* }
* @endcode
* @code
* \usepackage{imakeidx}
* \makeindex[name=prmindex, title=Index of run-time parameter entries]
- * \makeindex[name=prmindexfull, title=Index of run-time parameters with
- * section names]
+ * \makeindex[name=prmindexfull,
+ * title=Index of run-time parameters with section names]
* @endcode
* and at the end of the file this:
* @code
* ... // Build compare class
* std::map<std::vector<unsigned int>, std::vector<double>, compare> map;
*
- * map = convert<decltype(map)>::to_value("1,2,3 : 5.0,6.0,7.0 ; 8,9,10 :
- * 11.0,12.0,13.0");
+ * map = convert<decltype(map)>::to_value(
+ * "1,2,3 : 5.0,6.0,7.0 ; 8,9,10 : 11.0,12.0,13.0");
*
* @endcode
*
* This class can then be use with CellDataStorage in the following way:
* @code
* CellDataStorage<typename Triangulation<dim,dim>::cell_iterator,MyQData>
- * data_storage;
+ * data_storage;
* parallel::distributed::ContinuousQuadratureDataTransfer<dim,MyQData>
* data_transfer(FE_Q<dim>(2),QGauss<dim>(3),QGauss<dim>(4));
* //...populate data for all active cells in data_storage
* data_transfer.prepare_for_coarsening_and_refinement(triangulation,data_storage);
* triangulation.execute_coarsening_and_refinement();
* //...initialize quadrature point data on new cells by calling
- * CellDataStorage::reinit() data_transfer.interpolate();
+ * // CellDataStorage::initialize()
+ * data_transfer.interpolate();
* @endcode
* This approach can be extended to quadrature point data with Tensors of
* arbitrary order, although with a little bit more work in packing and
* particular call. Example:
* @code
* template <typename T>
- * typename T::type foo(T) {...};
+ * typename T::type foo(T)
+ * {
+ * ...
+ * };
* ...
* foo(1);
* @endcode
* The idea is then to make the return type un-instantiatable if certain
* constraints on the template types are not satisfied:
* @code
- * template <bool, typename> struct constraint_and_return_value;
- * template <typename T> struct constraint_and_return_value<true,T> {
+ * template <bool, typename>
+ * struct constraint_and_return_value;
+ *
+ * template <typename T>
+ * struct constraint_and_return_value<true,T>
+ * {
* using type = T;
* };
* @endcode
* constraint_and_return_value<false,T> is not defined. Given something like
* @code
* template <typename>
- * struct int_or_double { static const bool value = false;};
+ * struct int_or_double
+ * {
+ * static const bool value = false;
+ * };
+ *
* template <>
- * struct int_or_double<int> { static const bool value = true; };
+ * struct int_or_double<int>
+ * {
+ * static const bool value = true;
+ * };
+ *
* template <>
- * struct int_or_double<double> { static const bool value = true; };
+ * struct int_or_double<double>
+ * {
+ * static const bool value = true;
+ * };
* @endcode
* we can write a template
* @code
* template <typename T>
* typename constraint_and_return_value<int_or_double<T>::value,void>::type
- * f (T);
+ * f (T);
* @endcode
* which can only be instantiated if T=int or T=double. A call to f('c') will
* just fail with a compiler error: "no instance of f(char) found". On the
* alias. This class, while at first appearing useless, makes sense in the
* following context: if you have a function template as follows:
* @code
- * template <typename T> void f(T, T);
+ * template <typename T>
+ * void f(T, T);
* @endcode
* then it can't be called in an expression like <code>f(1, 3.141)</code>
* because the type <code>T</code> of the template can not be deduced in a
* unique way from the types of the arguments. However, if the template is
* written as
* @code
- * template <typename T> void f(T, typename identity<T>::type);
+ * template <typename T>
+ * void f(T, typename identity<T>::type);
* @endcode
* then the call becomes valid: the type <code>T</code> is not deducible from
* the second argument to the function, so only the first argument
* The context for this feature is as follows: consider
* @code
* template <typename RT, typename A>
- * void forward_call(RT (*p) (A), A a) { p(a); }
+ * void forward_call(RT (*p) (A), A a)
+ * {
+ * p(a);
+ * }
*
* void h (double);
*
* this by writing the code as follows:
* @code
* template <typename RT, typename A>
- * void forward_call(RT (*p) (A), typename identity<A>::type a) { p(a); }
+ * void forward_call(RT (*p) (A), typename identity<A>::type a)
+ * {
+ * p(a);
+ * }
*
* void h (double);
*
*
* @code
* template <int dim>
- * class X {
+ * class X
+ * {
* // do something on subdim-dimensional sub-objects of the big
* // dim-dimensional thing (for example on vertices/lines/quads of
* // cells):
*
* template <int dim>
* template <>
- * void X<dim>::f<0> () { ...operate on the vertices of a cell... }
+ * void X<dim>::f<0> ()
+ * {
+ * ...operate on the vertices of a cell...
+ * }
*
- * template <int dim, int subdim> void g(X<dim> &x) {
+ * template <int dim, int subdim> void g(X<dim> &x)
+ * {
* x.f<subdim> ();
* }
* @endcode
* the common tricks is therefore to use something like this:
*
* @code
- * template <int N> struct int2type {};
+ * template <int N>
+ * struct int2type
+ * {};
*
* template <int dim>
- * class X {
+ * class X
+ * {
* // do something on subdim-dimensional sub-objects of the big
* // dim-dimensional thing (for example on vertices/lines/quads of
* // cells):
* };
*
* template <int dim>
- * void X<dim>::f (int2type<0>) { ...operate on the vertices of a cell... }
+ * void X<dim>::f (int2type<0>)
+ * {
+ * ...operate on the vertices of a cell...
+ * }
*
* template <int dim>
- * void X<dim>::f (int2type<1>) { ...operate on the lines of a cell... }
+ * void X<dim>::f (int2type<1>)
+ * {
+ * ...operate on the lines of a cell...
+ * }
*
- * template <int dim, int subdim> void g(X<dim> &x) {
+ * template <int dim, int subdim>
+ * void g(X<dim> &x)
+ * {
* x.f (int2type<subdim>());
* }
* @endcode
* to write code like
* @code
* template <typename T>
- * void Vector<T>::some_operation () {
+ * void Vector<T>::some_operation ()
+ * {
* if (std::is_same<T,double>::value == true)
* call_some_blas_function_for_doubles;
* else
* consider the following function:
* @code
* template <typename T>
- * T multiply (const T t1, const T t2) { return t1*t2; }
+ * T multiply (const T t1, const T t2)
+ * {
+ * return t1*t2;
+ * }
* @endcode
* This function can be called with any two arguments of the same type @p T.
* This includes arguments for which this clearly makes no sense.
* @code
* template <typename T>
* typename EnableIfScalar<T>::type
- * multiply (const T t1, const T t2) { return t1*t2; }
+ * multiply (const T t1, const T t2)
+ * {
+ * return t1*t2;
+ * }
* @endcode
* At a place where you call the function, the compiler will deduce the type
* @p T from the arguments. For example, in
/**
* Return a reference (const or non-const) to a subobject of a tensorial
* object @p t of type @p T, as described by an array type @p ArrayType
- * object @p indices. For example: @code
+ * object @p indices. For example:
+ * @code
* Tensor<5, dim> tensor;
* TableIndices<5> indices (0, 1, 2, 3, 4);
* TensorAccessors::extract(tensor, indices) = 42;
* ...
* for(unsigned int k_ = 0; k_ < dim; ++k_)
* result[i_0]..[i_][j_0]..[j_] +=
- * left[i_0]..[i_][k_0]..[k_] * right[j_0]..[j_][k_0]..[k_];
+ * left[i_0]..[i_][k_0]..[k_]
+ * * right[j_0]..[j_][k_0]..[k_];
* }
* @endcode
* with r = rank_1 + rank_2 - 2 * no_contr, l = rank_1 - no_contr, l1 =
* for(unsigned int j_0 = 0; j_0 < dim; ++j_0)
* ...
* for(unsigned int j_ = 0; j_ < dim; ++j_)
- * result += left[i_0]..[i_] * middle[i_0]..[i_][j_0]..[j_] *
- * right[j_0]..[j_];
+ * result += left[i_0]..[i_]
+ * * middle[i_0]..[i_][j_0]..[j_]
+ * * right[j_0]..[j_];
* @endcode
*
* @note The Types @p T2, @p T3, and @p T4 must have rank rank_1, rank_1 +
* the returned object, instead of the returned object. This
* allows writing code such as
* @code
- * Threads::Thread<int> t = Threads::new_thread (...function returning an
- * int...); t.return_value() = 42; // overwrite returned value int i =
- * t.return_value(); // i is now 42
+ * Threads::Thread<int> t = Threads::new_thread (
+ * ...function returning an int...);
+ * t.return_value() = 42; // overwrite returned value
+ * int i = t.return_value(); // i is now 42
* @endcode
* You will rarely have a need to write such code. On the other hand,
* the function needs to return a writable (non-@p const) reference to
* support code such as this:
* @code
- * std::unique_ptr<int> create_int (const std::string &s) { ... }
+ * std::unique_ptr<int> create_int (const std::string &s)
+ * {
+ * ...
+ * }
*
* void f()
* {
*
* An example of how this function works is as follows:
* @code
- * class B { ... }; // A base class. Assume that it has virtual
- * // functions so that dynamic_cast can work.
- * class D : public B { ... }; // A derived class
+ * // A base class. Assume that it has virtual
+ * // functions so that dynamic_cast can work.
+ * class B
+ * {
+ * ...
+ * };
*
+ * // A derived class
+ * class D : public B
+ * {
+ * ...
+ * };
*
- * std::unique_ptr<B> create_object (...) {...} // A factory function
+ * // A factory function
+ * std::unique_ptr<B> create_object (...)
+ * {
+ * ...
+ * }
*
* void foo (...)
* {