Lethe Open-Source Library version 1.2.0
Developer Guide
Loading...
Searching...
No Matches
shape_parsing.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) 2023-2026 The Lethe Authors
2// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception OR LGPL-2.1-or-later
3
4#ifndef lethe_shape_parsing_h
5#define lethe_shape_parsing_h
6
7#include <core/shape.h>
8#include <core/utilities.h>
9
10using namespace dealii;
11
13{
14 /**
15 * @brief Return the deprecated strings of the shape types, which remain
16 * accepted in parameter files, composite shape files and particle files.
17 *
18 * @tparam dim Number of spatial dimensions.
19 *
20 * @return The deprecated strings, each paired with its shape type.
21 */
22 template <int dim>
25
26 /**
27 * @brief Return the shape type designated by a string, which is either the
28 * name of a Shape<dim>::ShapeType enumerator or one of the deprecated strings
29 * given by deprecated_shape_type_names(). No deprecation warning is printed,
30 * since the string may come from a composite shape file or a particle file
31 * rather than from a parameter.
32 *
33 * @tparam dim Number of spatial dimensions.
34 *
35 * @param[in] type String designating the type of shape.
36 *
37 * @return The corresponding shape type. An exception is thrown if @p type
38 * designates no shape type.
39 */
40 template <int dim>
42 string_to_shape_type(const std::string &type);
43
44 /**
45 * Initializes the shape from its type and arguments
46 * @param type the type of shape
47 * @param shape_arguments_str the raw arguments
48 * @param position the position of the shape
49 * @param orientation the orientation of the shape
50 */
51 template <int dim>
52 std::shared_ptr<Shape<dim>>
53 initialize_shape(const std::string &type,
54 const std::string &shape_arguments_str,
55 const Point<dim> &position,
56 const Tensor<1, 3> &orientation);
57
58 /**
59 * Initializes the shape from its type and numerical arguments
60 * @param type the type of shape
61 * @param shape_arguments the numerical arguments
62 * @param position the position of the shape
63 * @param orientation the orientation of the shape
64 */
65 template <int dim>
66 std::shared_ptr<Shape<dim>>
67 initialize_shape_from_vector(const std::string &type,
68 const std::vector<double> &shape_arguments,
69 const Point<dim> &position,
70 const Tensor<1, 3> &orientation);
71
72 /**
73 * Initializes the shape from its type and a text file that contains the real
74 * initialization data
75 * @param type the type of shape
76 * @param file_name the name of the file that contains the initialization data
77 * @param position the position of the shape
78 * @param orientation the orientation of the shape
79 */
80 template <int dim>
81 std::shared_ptr<Shape<dim>>
82 initialize_shape_from_file(const std::string &type,
83 const std::string &file_name,
84 const Point<dim> &position,
85 const Tensor<1, 3> &orientation);
86} // namespace ShapeGenerator
87
88#endif // lethe_shape_parsing_h
ShapeType
enum class that associate an integer index tp each type of shape. The enumerator names are the values...
Definition shape.h:61
std::vector< std::pair< std::string, EnumType > > DeprecatedEnumNames
Deprecated strings of an enum parameter, each paired with the enumerator it stands for....
Definition utilities.h:765
Shape< dim >::ShapeType string_to_shape_type(const std::string &type)
Return the shape type designated by a string, which is either the name of a Shape<dim>::ShapeType enu...
std::shared_ptr< Shape< dim > > initialize_shape_from_vector(const std::string &type, const std::vector< double > &shape_arguments, const Point< dim > &position, const Tensor< 1, 3 > &orientation)
const DeprecatedEnumNames< typename Shape< dim >::ShapeType > & deprecated_shape_type_names()
Return the deprecated strings of the shape types, which remain accepted in parameter files,...
std::shared_ptr< Shape< dim > > initialize_shape(const std::string &type, const std::string &shape_arguments_str, const Point< dim > &position, const Tensor< 1, 3 > &orientation)
std::shared_ptr< Shape< dim > > initialize_shape_from_file(const std::string &type, const std::string &file_name, const Point< dim > &position, const Tensor< 1, 3 > &orientation)