25#include "libmesh/libmesh_common.h"
26#include "libmesh/string_to_enum.h"
27#include "libmesh/enum_to_string.h"
28#include "libmesh/enum_convergence_flags.h"
29#include "libmesh/enum_elem_quality.h"
30#include "libmesh/enum_elem_type.h"
31#include "libmesh/enum_eigen_solver_type.h"
32#include "libmesh/enum_fe_family.h"
33#include "libmesh/enum_inf_map_type.h"
34#include "libmesh/enum_io_package.h"
35#include "libmesh/enum_norm_type.h"
36#include "libmesh/enum_order.h"
37#include "libmesh/enum_parallel_type.h"
38#include "libmesh/enum_partitioner_type.h"
39#include "libmesh/enum_point_locator_type.h"
40#include "libmesh/enum_preconditioner_type.h"
41#include "libmesh/enum_quadrature_type.h"
42#include "libmesh/enum_solver_package.h"
43#include "libmesh/enum_solver_type.h"
44#include "libmesh/enum_subset_solve_mode.h"
45#include "libmesh/enum_xdr_mode.h"
46#include "libmesh/elem.h"
57template <
class MapType>
59std::map<typename MapType::mapped_type, typename MapType::key_type>
60build_reverse_map (
const MapType & forward)
62 std::map<typename MapType::mapped_type, typename MapType::key_type> reverse;
64 for (
auto & [key, val] : forward)
71 if (
auto preimage = reverse.find(val);
72 preimage == reverse.end())
73 reverse.emplace (val, key);
74 else if (preimage->second < key)
75 preimage->second = key;
81std::map<std::string, ElemType> elem_type_to_enum {
151std::map<ElemType, std::string> enum_to_elem_type =
152 build_reverse_map(elem_type_to_enum);
155std::map<std::string, ElemMappingType> elem_mapping_type_to_enum {
161std::map<ElemMappingType, std::string> enum_to_elem_mapping_type =
162 build_reverse_map(elem_mapping_type_to_enum);
165std::map<std::string, Order> order_to_enum {
217std::map<Order, std::string> enum_to_order =
218 build_reverse_map(order_to_enum);
221std::map<std::string, FEFamily> fefamily_to_enum {
252std::map<FEFamily, std::string> enum_to_fefamily =
253 build_reverse_map(fefamily_to_enum);
256std::map<std::string, InfMapType> inf_map_type_to_enum {
262std::map<InfMapType, std::string> enum_to_inf_map_type =
263 build_reverse_map(inf_map_type_to_enum);
266std::map<std::string, QuadratureType> quadrature_type_to_enum {
282std::map<QuadratureType, std::string> enum_to_quadrature_type =
283 build_reverse_map(quadrature_type_to_enum);
286std::map<std::string, PartitionerType> partitioner_type_to_enum {
309std::map<PartitionerType, std::string> enum_to_partitioner_type =
310 build_reverse_map(partitioner_type_to_enum);
313std::map<std::string, PreconditionerType> preconditioner_type_to_enum {
350std::map<PreconditionerType, std::string> enum_to_preconditioner_type =
351 build_reverse_map(preconditioner_type_to_enum);
354#ifdef LIBMESH_ENABLE_AMR
355std::map<std::string, Elem::RefinementState> refinementstate_type_to_enum {
366std::map<Elem::RefinementState, std::string> enum_to_refinementstate_type =
367 build_reverse_map(refinementstate_type_to_enum);
371std::map<std::string, EigenSolverType> eigensolvertype_to_enum {
381std::map<EigenSolverType, std::string> enum_to_eigensolvertype =
382 build_reverse_map(eigensolvertype_to_enum);
385std::map<std::string, SolverType> solvertype_to_enum {
408std::map<SolverType, std::string> enum_to_solvertype =
409 build_reverse_map(solvertype_to_enum);
412std::map<std::string, ElemQuality> elemquality_to_enum {
437std::map<ElemQuality, std::string> enum_to_elemquality =
438 build_reverse_map(elemquality_to_enum);
441std::map<std::string, IOPackage> iopackage_to_enum {
452std::map<IOPackage, std::string> enum_to_iopackage =
453 build_reverse_map(iopackage_to_enum);
456std::map<std::string, FEMNormType> norm_type_to_enum {
485std::map<FEMNormType, std::string> enum_to_norm_type =
486 build_reverse_map(norm_type_to_enum);
489std::map<std::string, ParallelType> parallel_type_to_enum {
497std::map<ParallelType, std::string> enum_to_parallel_type =
498 build_reverse_map(parallel_type_to_enum);
501std::map<std::string, PointLocatorType> point_locator_type_to_enum {
506std::map<PointLocatorType, std::string> enum_to_point_locator_type =
507 build_reverse_map(point_locator_type_to_enum);
510std::map<std::string, SolverPackage> solverpackage_type_to_enum {
520std::map<SolverPackage, std::string> enum_to_solverpackage_type =
521 build_reverse_map(solverpackage_type_to_enum);
524std::map<std::string, SubsetSolveMode> subset_solve_mode_to_enum {
530std::map<SubsetSolveMode, std::string> enum_to_subset_solve_mode =
531 build_reverse_map(subset_solve_mode_to_enum);
534std::map<std::string, XdrMODE> xdr_mode_to_enum {
542std::map<XdrMODE, std::string> enum_to_xdr_mode =
543 build_reverse_map(xdr_mode_to_enum);
546std::map<std::string, LinearConvergenceReason> linear_convergence_reason_to_enum {
570std::map<LinearConvergenceReason, std::string> enum_to_linear_convergence_reason =
571 build_reverse_map(linear_convergence_reason_to_enum);
582#define INSTANTIATE_STRING_TO_ENUM(ENUM_NAME,VAR_NAME) \
584 ENUM_NAME string_to_enum<ENUM_NAME> (std::string_view s) \
586 std::string upper(s); \
587 std::transform(upper.begin(), upper.end(), upper.begin(), ::toupper); \
589 if (!VAR_NAME##_to_enum.count(upper)) \
591 libmesh_error_msg("No " #ENUM_NAME " named " << s << " found."); \
594 return VAR_NAME##_to_enum[upper]; \
598 ENUM_NAME string_to_enum<ENUM_NAME> (const std::string & s) \
600 return string_to_enum<ENUM_NAME>(std::string_view(s)); \
604 ENUM_NAME string_to_enum<ENUM_NAME> (const char * s) \
606 return string_to_enum<ENUM_NAME>(std::string_view(s)); \
610 std::string enum_to_string<ENUM_NAME> (const ENUM_NAME e) \
612 if (!enum_to_##VAR_NAME .count(e)) \
613 libmesh_error_msg("No " #ENUM_NAME " with enumeration " << e << " found."); \
615 return enum_to_##VAR_NAME [e]; \
620INSTANTIATE_STRING_TO_ENUM(
ElemType,elem_type)
622INSTANTIATE_STRING_TO_ENUM(
Order,order)
623INSTANTIATE_STRING_TO_ENUM(
FEFamily,fefamily)
624INSTANTIATE_STRING_TO_ENUM(
InfMapType,inf_map_type)
629#ifdef LIBMESH_ENABLE_AMR
633INSTANTIATE_STRING_TO_ENUM(
SolverType,solvertype)
636INSTANTIATE_STRING_TO_ENUM(
IOPackage,iopackage)
642INSTANTIATE_STRING_TO_ENUM(
XdrMODE,xdr_mode)
645#undef INSTANTIATE_STRING_TO_ENUM
RefinementState
Enumeration of possible element refinement states.
@ INVALID_REFINEMENTSTATE
The libMesh namespace provides an interface to certain functionality in the library.
PartitionerType
Defines an enum for mesh partitioner types.
@ MAPPED_SUBDOMAIN_PARTITIONER
@ HILBERT_SFC_PARTITIONER
ParallelType
Defines an enum for parallel data structure types.
@ INVALID_PARALLELIZATION
IOPackage
libMesh interfaces with several different software packages for the purposes of creating,...
ElemType
Defines an enum for geometric element types.
SubsetSolveMode
defines an enum for the question what happens to the dofs outside the given subset when a system is s...
ElemMappingType
Enumeration of possible element master->physical mapping types.
SolverPackage
Defines an enum for various linear solver packages.
ElemQuality
Defines an enum for element quality metrics.
QuadratureType
Defines an enum for currently available quadrature rules.
PointLocatorType
defines an enum for the types of point locators (given a point with global coordinates,...
PreconditionerType
Defines an enum for preconditioner types.
SolverType
Defines an enum for iterative solver types.
EigenSolverType
Defines an enum for iterative eigenproblem solver types.
XdrMODE
Defines an enum for read/write mode in Xdr format.
LinearConvergenceReason
Linear solver convergence flags (taken from the PETSc flags).
@ CONVERGED_HAPPY_BREAKDOWN
@ CONVERGED_CG_CONSTRAINED
@ DIVERGED_PCSETUP_FAILED
@ DIVERGED_BREAKDOWN_BICG
@ DIVERGED_INDEFINITE_MAT