![]() |
Lethe Open-Source Library version 1.2.0
Developer Guide
|
#include <core/output_struct.h>#include <deal.II/base/conditional_ostream.h>#include <deal.II/base/exceptions.h>#include <deal.II/base/mpi_remote_point_evaluation.h>#include <deal.II/base/parameter_handler.h>#include <deal.II/base/patterns.h>#include <deal.II/base/point.h>#include <deal.II/base/table_handler.h>#include <deal.II/base/tensor.h>#include <deal.II/dofs/dof_handler.h>#include <deal.II/fe/fe_values.h>#include <deal.II/numerics/vector_tools.h>#include <deal.II/particles/particle_iterator.h>#include <boost/archive/text_iarchive.hpp>#include <boost/archive/text_oarchive.hpp>#include <magic_enum.hpp>#include <algorithm>#include <fstream>#include <map>#include <optional>#include <string>#include <string_view>#include <tuple>#include <type_traits>#include <utility>#include <vector>Go to the source code of this file.
Classes | |
| class | statistics |
| struct | cell_comparison< dim > |
| struct | particle_comparison< dim > |
| struct | cut_cell_comparison< dim > |
| struct | cut_cell_hash< dim > |
Typedefs | |
| template<typename EnumType> | |
| using | DeprecatedEnumNames = std::vector<std::pair<std::string, EnumType>> |
Functions | |
| void | add_statistics_to_table_handler (const std::string &variable, const statistics &stats, TableHandler &table) |
| template<typename T> | |
| TableHandler | make_table_scalars_vectors (const std::vector< T > &independent_values, const std::string &independent_column_name, const std::vector< std::vector< double > > &dependent_vector, const std::vector< std::string > &dependent_column_names, const unsigned int display_precision, const bool display_scientific_notation=false) |
| template<int dim, typename T> | |
| TableHandler | make_table_scalars_tensors (const std::vector< T > &independent_values, const std::string &independent_column_name, const std::vector< Tensor< 1, dim > > &dependent_vector, const std::vector< std::string > &dependent_column_names, const unsigned int display_precision, const bool display_scientific_notation=false) |
| template<int dim, typename T> | |
| TableHandler | make_table_scalars_tensors (const std::vector< T > &independent_values, const std::string &independent_column_name, const std::vector< std::vector< Tensor< 1, dim > > > &dependent_vector, const std::vector< std::string > &dependent_column_names, const unsigned int display_precision, const bool display_scientific_notation=false) |
| template<int dim> | |
| TableHandler | make_table_tensors_tensors (const std::vector< Tensor< 1, dim > > &independent_vector, const std::vector< std::string > &independent_column_names, const std::vector< Tensor< 1, dim > > &dependent_vector, const std::vector< std::string > &dependent_column_names, const unsigned int display_precision, const bool display_scientific_notation=false) |
| template<int dim> | |
| TableHandler | make_table_tensors_scalars (const std::vector< Tensor< 1, dim > > &independent_vector, const std::vector< std::string > &independent_column_names, const std::vector< double > &dependent_values, const std::string &dependent_column_name, const unsigned int display_precision, const bool display_scientific_notation=false) |
| double | calculate_point_property (const double phase, const double property0, const double property1) |
| template<typename T> | |
| constexpr int | sgn (const T val) noexcept |
| template<typename T> | |
| T | clip (const T &n, const T &lower, const T &upper) |
| double | calculate_point_property_cahn_hilliard (const double phase_cahn_hilliard, const double property0, const double property1) |
| void | check_file_exists (const std::string &file_name, const std::string &file_description) |
| void | fill_table_from_file (TableHandler &table, const std::string &file_name, const std::string &delimiter=" ") |
| void | fill_vectors_from_file (std::map< std::string, std::vector< double > > &map, const std::string &file_name, const std::string &delimiter=" ") |
| void | fill_string_vectors_from_file (std::map< std::string, std::vector< std::string > > &map, const std::string &file_name, const std::string &delimiter=" ") |
| void | create_output_folder (const std::string &dirname) |
| void | delete_output_folder (const std::string &dirname) |
| void | announce_string (const ConditionalOStream &pcout, const std::string &expression, const char delimiter='-') |
| void | announce_string (const ConditionalOStream &pcout, const std::string &expression, const unsigned int banner_size, const char delimiter='-') |
| void | serialize_table (const TableHandler &table, const std::string &filename, const MPI_Comm &mpi_communicator, const bool serialize_on_rank_zero=true) |
| void | deserialize_table (TableHandler &table, const std::string &filename, const MPI_Comm &mpi_communicator, const bool deserialize_on_rank_zero=true) |
| void | serialize_tables_vector (const std::vector< OutputStructTableHandler > &table_output_structs, const MPI_Comm mpi_communicator) |
| void | deserialize_tables_vector (std::vector< OutputStructTableHandler > &table_output_structs, const MPI_Comm mpi_communicator) |
| std::string | get_last_value_of_parameter (const std::string &file_name, const std::string ¶meter_name) |
| unsigned int | get_dimension (const std::string &file_name) |
| int | get_max_subsection_size (const std::string &file_name, const bool require_subsection_size=true) |
| template<typename EnumType> requires std::is_enum_v<EnumType> | |
| std::string | enum_to_string (const EnumType value) |
| template<typename EnumType> requires std::is_enum_v<EnumType> | |
| EnumType | string_to_enum (const std::string &name) |
| void | warn_deprecated_parameter_value (const std::string ¶meter_name, const std::string &deprecated_value, const std::string &new_value) |
| template<typename EnumType> requires std::is_enum_v<EnumType> | |
| std::string | enum_to_selection (const DeprecatedEnumNames< EnumType > &deprecated_names={}, const std::vector< EnumType > &allowed_values={}) |
| template<typename EnumType> requires std::is_enum_v<EnumType> | |
| std::string | enum_to_choices (const std::vector< EnumType > &allowed_values={}) |
| template<typename EnumType> requires std::is_enum_v<EnumType> | |
| void | declare_enum_entry (ParameterHandler &prm, const std::string &entry_name, const EnumType default_value, const std::string &description, const DeprecatedEnumNames< EnumType > &deprecated_names={}, const std::vector< EnumType > &allowed_values={}) |
| template<typename EnumType> requires std::is_enum_v<EnumType> | |
| EnumType | string_to_enum (const std::string &name, const DeprecatedEnumNames< EnumType > &deprecated_names, const std::string ¶meter_name) |
| template<int spacedim> | |
| Tensor< 1, spacedim > | value_string_to_tensor (const std::string &value_string) |
| template<int dim> | |
| double | compute_cell_diameter (const double cell_measure, const unsigned int fe_degree) |
| double | compute_cell_measure_with_JxW (const std::vector< double > &JxW_values) |
| template<int dim> | |
| double | identify_minimum_cell_size (const Mapping< dim > &mapping, const DoFHandler< dim > &dof_handler, const Quadrature< dim > &cell_quadrature, const MPI_Comm &mpi_communicator) |
| double | get_penalty_factor (const unsigned int fe_degree, const double cell_extent_here, const double cell_extent_there) |
| template<typename key, typename val> | |
| std::vector< key > | extract_keys_from_map (const std::map< key, val > &map) |
| template<typename key, typename val> | |
| std::vector< val > | extract_values_from_map (const std::map< key, val > &map) |
| std::string | concatenate_strings (const int argc, char **argv) |
| void | print_version_info (const ConditionalOStream &pcout) |
| std::tuple< std::map< std::string, bool >, std::vector< std::string > > | parse_args (int argc, char **argv) |
| void | print_parameters_to_output_file (const ConditionalOStream &pcout, const ParameterHandler &prm, const std::string &file_name) |
| void | interpret_escape_sequences (std::string &s) |
| void | print_comment_to_output_file (const ConditionalOStream &pcout, ParameterHandler &prm) |
| void | delete_vtu_and_pvd_files (const std::string &output_path) |
| template<int dim> | |
| double | point_to_angle (const Point< dim > &point, const Point< dim > ¢er_of_rotation=Point< dim >(), const unsigned int rotation_axis_direction=2) |
| template<int dim> | |
| Point< dim > | radius_to_point (const double radius, const double angle_rad, const Point< dim > ¢er_of_rotation=Point< dim >(), const unsigned int rotation_axis_direction=2) |
| void | create_random_number_container (std::vector< double > &random_container, const unsigned int number_of_elements, const double maximum_range, const unsigned int prn_seed) |
| template<typename T> | |
| std::vector< T > | convert_string_to_vector (const ParameterHandler &prm, const std::string &entry_string) |
| template<int dim, typename VectorType> | |
| void | evaluate_values_at_points (const Mapping< dim > &mapping, const DoFHandler< dim > &dof_handler, const VectorType &solution_field, const std::vector< Point< dim > > &evaluation_points, Utilities::MPI::RemotePointEvaluation< dim > &remote_point_evaluator, std::vector< double > &evaluated_scalar_values, const unsigned int first_selected_component=0) |
| template<int n_component, int dim, typename VectorType> | |
| void | evaluate_values_at_points (const Mapping< dim > &mapping, const DoFHandler< dim > &dof_handler, const VectorType &solution_field, const std::vector< Point< dim > > &evaluation_points, Utilities::MPI::RemotePointEvaluation< dim > &remote_point_evaluator, std::vector< Tensor< 1, dim, double > > &evaluated_vector_values, const unsigned int first_selected_component=0) |
| template<int dim> | |
| bool | points_are_in_domain (const std::vector< Point< dim > > &evaluation_points, const Utilities::MPI::RemotePointEvaluation< dim, dim > &remote_point_evaluator) |
| using DeprecatedEnumNames = std::vector<std::pair<std::string, EnumType>> |
Deprecated strings of an enum parameter, each paired with the enumerator it stands for. These are the values that were accepted before the parameter strings were made identical to the enumerator identifiers (e.g. "extra verbose" for Verbosity::extra_verbose). They remain accepted, but using one of them raises a deprecation warning.
| EnumType | Enumeration type. |
Definition at line 765 of file utilities.h.
|
inline |
Add statistical values to a TableHandler.
This function inserts a variable name and its associated statistics (minimum, maximum, total, average) into a given TableHandler.
| [in] | variable | The name of the variable being recorded. |
| [in] | stats | The statistics associated with the variable. |
| [in,out] | table | Reference to the TableHandler where the values will be added. |
Definition at line 97 of file utilities.h.
References statistics::average, statistics::max, statistics::min, and statistics::total.
|
inline |
Prints a string and then adds a line above and below made with dashes containing as many dashes as the string has characters+1.
For example, if the string to be printed is "Tracer" the result will be:
| [in] | pcout | the parallel cout used to print the information |
| [in] | expression | string that will be printed |
| [in] | delimiter | the character used to delimit the printing. Default value is "-" |
Definition at line 500 of file utilities.h.
|
inline |
Prints an expression string surrounded from above and bottom with a lines of a specified delimiter character (by default, '-'). The length of the banner lines is the length of the string + 1 character.
| [in] | pcout | Parallel conditional output stream used to print the information |
| [in] | expression | Expression string that will be printed |
| [in] | banner_size | Length of the decorative banner lines |
| [in] | delimiter | Characters composing the decorative lines of the banner. By default, '-' is used. |
banner_size is used for cases where the expression string is multiple lines long. Definition at line 525 of file utilities.h.
|
inline |
Calculate the equivalent properties for a given phase. Method called in quadrature points loops in CLS simulations.
| phase | Phase value for the given quadrature point |
| property0 | Property value for the fluid with index 0 (fluid for phase = 0) |
| property1 | Property value for the fluid with index 1 (fluid for phase = 1) |
Definition at line 307 of file utilities.h.
References phase.
|
inlinenodiscard |
Calculate the equivalent property for a given phase.
This method is called in quadrature point loops in Cahn-Hilliard simulations. It interpolates between two fluid properties based on the phase value.
| [in] | phase_cahn_hilliard | Phase value for the given quadrature point. |
| [in] | property0 | Property value for the fluid with index 0 (fluid for phase = -1). |
| [in] | property1 | Property value for the fluid with index 1 (fluid for phase = 1). |
Definition at line 380 of file utilities.h.
References phase, phase_cahn_hilliard, and sgn().
| void check_file_exists | ( | const std::string & | file_name, |
| const std::string & | file_description ) |
Verify that a file that Lethe must read exists and can be opened, and raise an error stated in the user's terms otherwise.
This function is meant to be called right before a file whose path comes from the user, either from the command line or from the parameter file, is opened. It distinguishes a file name that was left empty, a file that does not exist and a file that exists but cannot be read, so that the user is told what to correct instead of facing the error that the reader of the file would raise further down.
| [in] | file_name | Path of the file, exactly as it was given by the user. |
| [in] | file_description | Role of the file in the simulation. It is used to build the error message and should read naturally after "The", for example "parameter file given to the application" or "gmsh mesh file given by 'subsection mesh' - 'set file name'". |
Definition at line 225 of file utilities.cc.
| T clip | ( | const T & | n, |
| const T & | lower, | ||
| const T & | upper ) |
Clip a property between a lower and a higher value.
| T | argument's type |
| [in,out] | lower | Lower admissible value |
| [in,out] | upper | Upper admissible value |
| [in,out] | n |
Definition at line 361 of file utilities.h.
|
inline |
Computes equivalent cell diameter by comparing the area to a disk (2D) or the volume to a sphere (3D).
| dim | Number of spatial dimensions (2D or 3D). |
| [in] | cell_measure | Area (2D) or volume (3D) of the cell. |
| [in] | fe_degree | Polynomial degree of the shape function. |
Definition at line 989 of file utilities.h.
|
inline |
Computes the area (2D) or volume (3D) of the cell by integrating 1 over the cell, by summing JxW values (quadrature weights) returned by the FEValues object.
| dim | Number of spatial dimensions (2D or 3D). |
| [in] | JxW_values | Vector of mapped quadrature weights. |
Definition at line 1017 of file utilities.h.
| std::string concatenate_strings | ( | const int | argc, |
| char ** | argv ) |
Concatenate words which are passed from the command line to a main function into a single string in which the words are seperated by space.
| [in] | argc | number of arguments in C style. |
| [in] | argv | arguments themselves in C style. |
Concatenate words which are passed from the command line to a main function into a single string in which the words are seperated by space.
| [in] | argc | number of arguments in C style. |
| [in] | argv | arguments themselves in C style. |
Definition at line 758 of file utilities.cc.
| std::vector< T > convert_string_to_vector | ( | const ParameterHandler & | prm, |
| const std::string & | entry_string ) |
Return the vector of size N of entry @entry_string. If the entry is specified in the .prm file, then the changed value is returned, otherwise the default value is returned. If the entry is not equivalent to a vector, an error will be thrown.
| T | The type of vector (int, unsigned int or double) |
| [in] | prm | A parameter handler which is currently used to parse the simulation information. |
| [in] | entry_string | A declare string in the parameter file. |
Definition at line 1330 of file utilities.h.
| void create_output_folder | ( | const std::string & | dirname | ) |
Creates the simulation output folder.
| [in] | dirname | Output directory name |
Definition at line 401 of file utilities.cc.
|
inline |
Creates a vector of random doubles between 0 and a maximum value using a pseudo random seed.
| [in,out] | random_container | Container in which the doubles are stored. |
| [in] | number_of_elements | Number of random doubles to generate. |
| [in] | maximum_range | Maximum value that the random double can have. |
| [in] | prn_seed | Pseudo random seed used to generate the random doubles. |
Definition at line 1302 of file utilities.h.
|
inline |
Declare a parameter entry whose value is an enumerator. The default value, the accepted values and the choices listed in the description are all derived from the enumeration, so that they cannot differ from one another.
The entry is declared with enum_to_string() of default_value as default value, a Patterns::Selection built with enum_to_selection() as pattern and description followed by enum_to_choices() as documentation.
| EnumType | Enumeration type. |
| [in,out] | prm | Parameter handler in which the entry is declared. |
| [in] | entry_name | Name of the parameter in the parameter file. |
| [in] | default_value | Default enumerator of the parameter. |
| [in] | description | Description of the parameter, without the list of its choices, which is appended to it. It should end with a period. |
| [in] | deprecated_names | Deprecated strings which remain accepted. |
| [in] | allowed_values | Enumerators accepted by the parameter. If empty, all the enumerators of EnumType are accepted (see enum_to_selection()). |
Definition at line 888 of file utilities.h.
| void delete_output_folder | ( | const std::string & | dirname | ) |
Delete the output folder and its content.
| [in] | dirname | Output directory name. |
Definition at line 407 of file utilities.cc.
| void delete_vtu_and_pvd_files | ( | const std::string & | output_path | ) |
Delete vtu and pvd files.
Definition at line 917 of file utilities.cc.
|
inline |
Loads a TableHandler from a file using Boost serialization.
The filename should include the desired extension.
| [in,out] | table | The table to be deserialized (will be overwritten). |
| [in] | filename | Path to the file (including extension) to read the table from. |
| [in] | mpi_communicator | The MPI communicator |
| [in] | deserialize_on_rank_zero | Boolean indicating if the table should only be deserialized on rank 0 only. By default, it is set to true. |
Definition at line 576 of file utilities.h.
|
inline |
Deserializes all the TableHandler objects in table_output_structs.
| [in,out] | table_output_structs | Vector of structures containing references to TableHandler objects that needs to be serialized/deserialized for a given solver, and their corresponding file names. |
| [in] | mpi_communicator | The MPI communicator |
Definition at line 624 of file utilities.h.
References deserialize_table().
|
inline |
Return the sentence listing the choices of an enum parameter (e.g. "Choices are <quiet|verbose|extra_verbose>."), to be used in the description of the parameter entry. The choices are the enumerator identifiers, in the order of the enumeration. The deprecated strings which are still accepted are deliberately not listed.
| EnumType | Enumeration type. |
| [in] | allowed_values | Enumerators accepted by the parameter. If empty, all the enumerators of EnumType are accepted (see enum_to_selection()). |
Definition at line 854 of file utilities.h.
|
inline |
Return the selection string (e.g. "quiet|verbose|extra_verbose") of an enum parameter, to be given to Patterns::Selection. The choices returned in the selection string are the enumerator identifiers (meaning, the names in the enum converted into strings) followed by the deprecated strings which are still accepted.
| EnumType | Enumeration type. |
| [in] | deprecated_names | Deprecated strings which remain accepted. |
| [in] | allowed_values | Enumerators (e.g. the enum values, for example quiet, verbose and extra_verbose) accepted by the parameter. If empty, all the enumerators (meaning all possible values) of EnumType are accepted. This is necessary because some enums contain internal enumerators which are not user choices (for example, the periodic_neighbor value of the boundary condition types, which the parser assigns to the boundary matching a periodic boundary). |
Definition at line 807 of file utilities.h.
|
inline |
Return the name of an enumerator, e.g. to derive the default value string of a parameter entry from the in-class default of its enum member.
This is only valid for parameters whose accepted strings are exactly the enumerator identifiers (e.g. "bdf1" for TimeSteppingMethod::bdf1).
| EnumType | Enumeration type. |
| [in] | value | Enumerator whose name is returned. |
value. Definition at line 705 of file utilities.h.
| void evaluate_values_at_points | ( | const Mapping< dim > & | mapping, |
| const DoFHandler< dim > & | dof_handler, | ||
| const VectorType & | solution_field, | ||
| const std::vector< Point< dim > > & | evaluation_points, | ||
| Utilities::MPI::RemotePointEvaluation< dim > & | remote_point_evaluator, | ||
| std::vector< double > & | evaluated_scalar_values, | ||
| const unsigned int | first_selected_component = 0 ) |
Evaluates the values of a scalar field at remote points of the domain from the mapping, the DoF handler and the solution field.
| dim | Denotes the number of spatial dimensions. |
| VectorType | Vector type of the solution vector. |
| [in] | mapping | Mapping of the domain. |
| [in] | dof_handler | DoF handler associated to the solution field. |
| [in] | solution_field | Vector containing the solution field. For distributed meshes, ghost elements must be updated. |
| [in] | evaluation_points | Vector of points where the values of the solution field are to be evaluated. |
| [in,out] | remote_point_evaluator | Utilities::MPI::RemotePointEvaluation object used to evaluate values of the variable of interest at given points of the domain. |
| [in,out] | evaluated_scalar_values | Vector of evaluated scalar values. |
| [in] | first_selected_component | First component of the solution to select if the solution field is a vector field. This is used to extract the correct field when the solution vector contains multiple fields (e.g., velocity and pressure are stored in a same solution vector). |
Definition at line 930 of file utilities.cc.
References points_are_in_domain().
| void evaluate_values_at_points | ( | const Mapping< dim > & | mapping, |
| const DoFHandler< dim > & | dof_handler, | ||
| const VectorType & | solution_field, | ||
| const std::vector< Point< dim > > & | evaluation_points, | ||
| Utilities::MPI::RemotePointEvaluation< dim > & | remote_point_evaluator, | ||
| std::vector< Tensor< 1, dim, double > > & | evaluated_vector_values, | ||
| const unsigned int | first_selected_component = 0 ) |
Evaluates the values of a vector field at remote points of the domain from the mapping, the DoF handler and the solution field.
| n_component | Number of components of the evaluated vector solution. |
| dim | Denotes the number of spatial dimensions. |
| VectorType | Vector type of the solution vector. |
| [in] | mapping | Mapping of the domain. |
| [in] | dof_handler | DoF handler associated to the solution field. |
| [in] | solution_field | Vector containing the vector solution field. |
| [in] | evaluation_points | Vector of points where the values of the solution field are to be evaluated. |
| [in,out] | remote_point_evaluator | Utilities::MPI::RemotePointEvaluation object used to evaluate values of the variable of interest at given points of the domain. |
| [in,out] | evaluated_vector_values | Vector of evaluated vector values. |
| [in] | first_selected_component | First component of the solution to select. This is used to extract the correct fields when the solution vector contains multiple fields (e.g., velocity and pressure are stored in a same solution vector). |
Definition at line 1027 of file utilities.cc.
References points_are_in_domain().
| std::vector< key > extract_keys_from_map | ( | const std::map< key, val > & | map | ) |
Extract the keys from map object.
| key | Key of the map |
| val | Value of the map. This template parameter is not used. |
| [in] | map | Map object from which the keys are extracted |
Definition at line 1118 of file utilities.h.
| std::vector< val > extract_values_from_map | ( | const std::map< key, val > & | map | ) |
Extract the values from map object.
| key | Key of the map. This template parameter is not used. |
| val | Value of the map. |
| [in] | map | Map object from which the keys are extracted |
Definition at line 1138 of file utilities.h.
| void fill_string_vectors_from_file | ( | std::map< std::string, std::vector< std::string > > & | map, |
| const std::string & | file_name, | ||
| const std::string & | delimiter = " " ) |
Function that read a file that was build from a dealii table and create a map with the key being the column name and the variable the vectors of data.
| [in,out] | map | A map used to store the data based on column names. |
| [in] | file_name | Path to the file to read the table from. |
| [in] | delimiter | Delimiter used in the file to separate values. Default is a space (" "). |
Definition at line 352 of file utilities.cc.
References check_file_exists().
| void fill_table_from_file | ( | TableHandler & | table, |
| const std::string & | file_name, | ||
| const std::string & | delimiter = " " ) |
Reads a file generated by a deal.II TableHandler and fills a TableHandler with its data.
This function reads a table from a file and populates the given TableHandler. Warning: If the table already contains data, it will be erased.
| [in,out] | table | The table to be filled. Existing content will be overwritten. |
| [in] | file_name | Path to the file to read the table from. |
| [in] | delimiter | Delimiter used in the file to separate values. Default is a space (" "). |
Definition at line 253 of file utilities.cc.
References check_file_exists().
| void fill_vectors_from_file | ( | std::map< std::string, std::vector< double > > & | map, |
| const std::string & | file_name, | ||
| const std::string & | delimiter = " " ) |
function that read a file that was build from a dealii table and fill 2 vectors. The first vector contains all the columns names and the second one contained all the column data.
| [in,out] | map | A map used to store the data based on column names. |
| [in] | file_name | Path to the file to read the table from. |
| [in] | delimiter | Delimiter used in the file to separate values. Default is a space (" "). |
Definition at line 299 of file utilities.cc.
References check_file_exists().
| unsigned int get_dimension | ( | const std::string & | file_name | ) |
Extract the dimension in which to run Lethe from the contents of the parameter file. This is something that we need to do before processing the parameter file since we need to know whether to use the dim=2 or dim=3 instantiation of the main classes.
| file_name[in] | The file name from which dimension is read |
Definition at line 670 of file utilities.cc.
References get_last_value_of_parameter().
| std::string get_last_value_of_parameter | ( | const std::string & | file_name, |
| const std::string & | parameter_name ) |
Retrieves the value of a specific parameter from an input file. Returns an empty string if the parameter is not found. This function is adapted from ASPECT and is mainly used to parse the dimension of the problem before creating the full parameter parser.
| [in] | file_name | File from which we retrieve the parameter. |
| [in] | parameter_name | Name of the parameter to retrieve. |
Definition at line 585 of file utilities.cc.
References check_file_exists().
| int get_max_subsection_size | ( | const std::string & | file_name, |
| const bool | require_subsection_size = true ) |
Extract the maximum value between the number of boundary conditions and the number of manifolds from the file. This value is linked to the "number" string defined in the simulation parameter file. It provides an estimate for the amount of parameters or manifolds and is used to determine the size of the vectors that will store boundary conditions and manifold data. This feature will need to be monitored extensively in the future.
| [in] | file_name | The file name from which the number of boundary conditions is read |
| [in] | require_subsection_size | If true, the file must contain at least one "number" entry and an exception is raised otherwise. Solvers for which no variable size subsection is mandatory, such as the DEM solvers whose boundary conditions are declared with a "number of boundary conditions" entry, set this to false. A file without any "number" entry then yields a size of zero. |
Definition at line 736 of file utilities.cc.
References get_max_value_of_parameter().
|
inline |
Calculate the penalty factor for the SIPG method for the case when two cells are of different sizes. A harmonic mean is used to calculate an average cell extent.
| [in] | fe_degree | Finite element degree. |
| [in] | cell_extent_here | Distance of the here cell. The ratio between the volume of the cell and the area of the face is generally used as a metric for this distance. |
| [in] | cell_extent_there | Distance of the there cell. The ratio between the volume of the cell and the area of the face is generally used as a metric for this distance. |
Definition at line 1099 of file utilities.h.
|
inline |
Identify minimum cell size. The cell size corresponds to the diameter of a disk (2D) or sphere (3D) of equivalent area (2D) or volume (3D).
| dim | Number of spatial dimensions (2D or 3D). |
| [in] | mapping | Interface for transformation from the reference (unit) cell to the real cell. |
| [in] | dof_handler | Describes the layout of DoFs and the type of FE. |
| [in] | cell_quadrature | Local cell quadrature information. |
| [in] | mpi_communicator | Allows communication between cores. |
Definition at line 1044 of file utilities.h.
References compute_cell_diameter(), and compute_cell_measure_with_JxW().
| void interpret_escape_sequences | ( | std::string & | s | ) |
Identify escape sequences listed below and apply them to the string.
| [in,out] | s | String to be modified if escape sequences are specified. |
Definition at line 892 of file utilities.cc.
| TableHandler make_table_scalars_tensors | ( | const std::vector< T > & | independent_values, |
| const std::string & | independent_column_name, | ||
| const std::vector< std::vector< Tensor< 1, dim > > > & | dependent_vector, | ||
| const std::vector< std::string > & | dependent_column_names, | ||
| const unsigned int | display_precision, | ||
| const bool | display_scientific_notation = false ) |
Generate a table from a vector of scalar (independent variable) and a vector of vectors of Tensor<1,dim> (dependent variables).
| T | Scalar type of independent variables. |
| dim | Integer that denotes the number of spatial dimensions. |
| [in] | independent_values | Vector of scalar values that serve as the independent variable (e.g., time). |
| [in] | independent_column_name | Label of the independent variable. |
| [in] | dependent_vector | Vector of vectors of Tensor<1,dim> containing dependent variables values (e.g., force). |
| [in] | dependent_column_names | Vector of strings representing the labels of dependent variables. |
| [in] | display_precision | Integer indicating the precision at which the table is written. |
| [in] | display_scientific_notation | Boolean indicating if the values should be displayed in scientific notation (true) or not (false). |
Definition at line 98 of file utilities.cc.
| TableHandler make_table_scalars_tensors | ( | const std::vector< T > & | independent_values, |
| const std::string & | independent_column_name, | ||
| const std::vector< Tensor< 1, dim > > & | dependent_vector, | ||
| const std::vector< std::string > & | dependent_column_names, | ||
| const unsigned int | display_precision, | ||
| const bool | display_scientific_notation = false ) |
Generate a table from a vector of scalars (independent variable) and a vector of Tensor<1,dim> (dependent variables).
| T | Scalar type of independent variables. |
| dim | Integer that denotes the number of spatial dimensions. |
| [in] | independent_values | Vector of scalar values that serve as the independent variable (e.g., time). |
| [in] | independent_column_name | Label of the independent variable. |
| [in] | dependent_vector | Vector of Tensor<1,dim> containing dependent variables values (e.g., force). |
| [in] | dependent_column_names | Vector of strings representing the labels of dependent variables. |
| [in] | display_precision | Integer indicating the precision at which the table is written. |
| [in] | display_scientific_notation | Boolean indicating if the values should be displayed in scientific notation (true) or not (false). |
Definition at line 59 of file utilities.cc.
| TableHandler make_table_scalars_vectors | ( | const std::vector< T > & | independent_values, |
| const std::string & | independent_column_name, | ||
| const std::vector< std::vector< double > > & | dependent_vector, | ||
| const std::vector< std::string > & | dependent_column_names, | ||
| const unsigned int | display_precision, | ||
| const bool | display_scientific_notation = false ) |
Generate a table from a vector of scalars (independent variable) and a vector of vectors of scalars (dependent variables).
| T | Scalar type of independent variables. |
| [in] | independent_values | Vector of scalar values that serve as the independent variable (e.g., time). |
| [in] | independent_column_name | Label of the independent variable. |
| [in] | dependent_vector | Vector of vectors of scalar values containing dependant variables values. |
| [in] | dependent_column_names | Vector of strings representing the labels of dependent variables. |
| [in] | display_precision | Integer indicating the precision at which the table is written. |
| [in] | display_scientific_notation | Boolean indicating if the values should be displayed in scientific notation (true) or not (false). |
Definition at line 24 of file utilities.cc.
| TableHandler make_table_tensors_scalars | ( | const std::vector< Tensor< 1, dim > > & | independent_vector, |
| const std::vector< std::string > & | independent_column_names, | ||
| const std::vector< double > & | dependent_values, | ||
| const std::string & | dependent_column_name, | ||
| const unsigned int | display_precision, | ||
| const bool | display_scientific_notation = false ) |
Generate a table from a vector of Tensor<1,dim> (independent variables) and a vector of scalars (dependent variable).
| dim | Integer that denotes the number of spatial dimensions. |
| [in] | independent_vector | Vector of Tensor<1,dim> that serves as the independent variable (e.g., position). |
| [in] | independent_column_names | Vector of strings representing labels of the independent tensor. |
| [in] | dependent_values | Vector of doubles containing dependent variables values (e.g., force). |
| [in] | dependent_column_name | Label of the dependent variable. |
| [in] | display_precision | Integer indicating the precision at which the table is written. |
| [in] | display_scientific_notation | Boolean indicating if the values should be displayed in scientific notation (true) or not (false). |
Definition at line 189 of file utilities.cc.
| TableHandler make_table_tensors_tensors | ( | const std::vector< Tensor< 1, dim > > & | independent_vector, |
| const std::vector< std::string > & | independent_column_names, | ||
| const std::vector< Tensor< 1, dim > > & | dependent_vector, | ||
| const std::vector< std::string > & | dependent_column_names, | ||
| const unsigned int | display_precision, | ||
| const bool | display_scientific_notation = false ) |
Generate a table from a vector of Tensor<1,dim> (independent variables) and a vector of Tensor<1,dim> (dependent variables).
| dim | Integer that denotes the number of spatial dimensions. |
| [in] | independent_vector | Vector of Tensor<1,dim> that serves as the independent variable (e.g., position). |
| [in] | independent_column_names | Vector of strings representing labels of the independent tensor. |
| [in] | dependent_vector | Vector of vectors of Tensor<1,dim> containing dependent variables values (e.g., force). |
| [in] | dependent_column_names | Vector of strings representing the labels of dependent variables. |
| [in] | display_precision | Integer indicating the precision at which the table is written. |
| [in] | display_scientific_notation | Boolean indicating if the values should be displayed in scientific notation (true) or not (false). |
Definition at line 147 of file utilities.cc.
| std::tuple< std::map< std::string, bool >, std::vector< std::string > > parse_args | ( | int | argc, |
| char ** | argv ) |
Parse the arguments given to the application.
| [in] | argc | Number of arguments |
| [in] | argv | Array of strings representing the arguments |
Definition at line 800 of file utilities.cc.
|
inline |
Converts point to angle (in radians) based on rotation axis.
| [in] | point | Point in cartesian coordinates |
| [in] | center_of_rotation | Center of rotation |
| [in] | rotation_axis_direction | Direction of rotation axis (x=0, y=1, z=2) |
Definition at line 1234 of file utilities.h.
|
inline |
Checks that the evaluation points are within the simulated domain and returns true if all points are within the domain.
| dim | Denotes the number of spatial dimensions. |
| [in] | evaluation_points | Vector of points where the values of the solution field are to be evaluated. |
| [in] | remote_point_evaluator | RemotePointEvaluation object used to evaluate values. |
true if all points are within the simulated domain. Definition at line 1527 of file utilities.h.
| void print_comment_to_output_file | ( | const ConditionalOStream & | pcout, |
| ParameterHandler & | prm ) |
Print a user comment at the beginning of the simulation on the console output.
| [in] | pcout | Parallel console output stream. |
| [in,out] | prm | ParameterHandler. specified. |
Definition at line 902 of file utilities.cc.
References interpret_escape_sequences().
| void print_parameters_to_output_file | ( | const ConditionalOStream & | pcout, |
| const ParameterHandler & | prm, | ||
| const std::string & | file_name ) |
Print the parameters given by the parameter file of the application.
| [in] | pcout | Parallel output stream |
| [in] | prm | Object containing the parameters parsed from the parameter file. |
| [in] | file_name | File name where the parameters will be written. |
| [in] | pcout | Parallel output stream |
| [in] | prm | Object containing the parameters parsed from the parameter file |
Definition at line 865 of file utilities.cc.
References get_last_value_of_parameter().
| void print_version_info | ( | const ConditionalOStream & | pcout | ) |
Print the information of the deal.II and Lethe branches used to run an application in the "git describe" format.
| [in] | pcout | Parallel output stream |
Definition at line 775 of file utilities.cc.
|
inline |
Converts radius to point in cartesian coordinates based on rotation axis.
| [in] | radius | Radial distance |
| [in] | angle_rad | Angle (in radians) |
| [in] | center_of_rotation | Center of rotation |
| [in] | rotation_axis_direction | Direction of rotation axis (x=0, y=1, z=2) |
Definition at line 1266 of file utilities.h.
|
inline |
Serializes a TableHandler to a file using Boost serialization.
The filename should include the desired extension.
| [in] | table | The table to be serialized. |
| [in] | filename | Path to the file (including extension) where the table will be saved. |
| [in] | mpi_communicator | The MPI communicator |
| [in] | serialize_on_rank_zero | Boolean indicating if the table should only be serialized on rank 0 only. By default, it is set to true. |
Definition at line 547 of file utilities.h.
|
inline |
Serializes all the TableHandler objects in table_output_structs.
| [in] | table_output_structs | Vector of structures containing references to TableHandler objects that need to be serialized/deserialized for a given solver, and their corresponding file names. |
| [in] | mpi_communicator | The MPI communicator |
Definition at line 602 of file utilities.h.
References serialize_table().
|
nodiscardconstexprnoexcept |
Retrieve the sign of a value.
Used in calculate_point_property_cahn_hilliard to determine the sign of the phase parameter.
| T | The argument's type (must support comparison with zero). |
| [in] | val | Value of the variable for which the sign is evaluated. |
| -1 | if the value is negative. |
| +1 | if the value is positive. |
| 0 | if the value is zero. |
Definition at line 344 of file utilities.h.
|
inline |
Return the enumerator whose identifier is name, e.g. to parse the value of a parameter entry into its enum member. This is the inverse of enum_to_string().
This is only valid for parameters whose accepted strings are exactly the enumerator identifiers (e.g. "bdf1" for TimeSteppingMethod::bdf1). The comparison is case-sensitive.
| EnumType | Enumeration type. |
| [in] | name | Identifier of the enumerator. |
EnumType named name. An exception is thrown if EnumType has no enumerator named name. Definition at line 734 of file utilities.h.
|
inline |
Return the enumerator designated by name, which is either the identifier of the enumerator or one of the deprecated strings of the parameter. In the latter case, a deprecation warning is printed.
| EnumType | Enumeration type. |
| [in] | parameter_value | Value of the parameter. |
| [in] | deprecated_names | Deprecated strings which remain accepted. |
| [in] | parameter_name | Name of the parameter in the parameter file, used in the deprecation warning. |
EnumType designated by name. An exception is thrown if name is neither an enumerator nor a deprecated string. Definition at line 923 of file utilities.h.
References enum_to_string(), string_to_enum(), and warn_deprecated_parameter_value().
|
inline |
Return the tensor corresponding to the value_string. If the dimension correspondence of the value_string is not equivalent to spacedim (either 2 or 3), an exception will be thrown. The delimiter separating the elements of the value_string is a comma (",").
| spacedim | Number of spatial dimensions (2D or 3D). |
| [in] | value_string | A string in the parameter file corresponding to a given tensor. |
value_string in the parameter file. Definition at line 956 of file utilities.h.
| void warn_deprecated_parameter_value | ( | const std::string & | parameter_name, |
| const std::string & | deprecated_value, | ||
| const std::string & | new_value ) |
Print a warning stating that a deprecated value was given to a parameter, along with the value which replaces it. The warning is only printed by the first MPI process.
| [in] | parameter_name | Name of the parameter in the parameter file. |
| [in] | deprecated_value | Deprecated value which was given. |
| [in] | new_value | Value which replaces deprecated_value. |
Definition at line 839 of file utilities.cc.