diff --git a/.clang-tidy b/.clang-tidy index 4772ac5a6..e9478297e 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -32,5 +32,7 @@ Checks: > performance-*, mpi-*, openmp-*' +WarningsAsErrors: >- + performance-enum-size HeaderFilterRegex: 'palace/drivers|palace/fem|palace/linalg|palace/utils' FormatStyle: 'file' diff --git a/palace/fem/coefficient.hpp b/palace/fem/coefficient.hpp index 357b5c845..47975a32c 100644 --- a/palace/fem/coefficient.hpp +++ b/palace/fem/coefficient.hpp @@ -168,7 +168,7 @@ class BdrSurfaceCurrentVectorCoefficient : public mfem::VectorCoefficient, }; // Helper for BdrSurfaceFluxCoefficient. -enum class SurfaceFluxType +enum class SurfaceFluxType : std::uint8_t { ELECTRIC, MAGNETIC, @@ -292,7 +292,7 @@ inline void BdrSurfaceFluxCoefficient::GetLocalFlux( } // Helper for InterfaceDielectricCoefficient. -enum class InterfaceDielectricType +enum class InterfaceDielectricType : std::uint8_t { DEFAULT, MA, @@ -467,7 +467,7 @@ inline double InterfaceDielectricCoefficient::Eval( } // Helper for EnergyDensityCoefficient. -enum class EnergyDensityType +enum class EnergyDensityType : std::uint8_t { ELECTRIC, MAGNETIC diff --git a/palace/fem/libceed/integrator.hpp b/palace/fem/libceed/integrator.hpp index 022b8b833..6d5a5fe2f 100644 --- a/palace/fem/libceed/integrator.hpp +++ b/palace/fem/libceed/integrator.hpp @@ -12,7 +12,7 @@ namespace palace::ceed { // Evaluation modes for CeedOperator fields for various integrators. -enum EvalMode : unsigned int +enum EvalMode : unsigned int // NOLINT { Weight = 1 << 0, None = 1 << 1, diff --git a/palace/linalg/eps.hpp b/palace/linalg/eps.hpp index 835bac7cb..aa292e2f1 100644 --- a/palace/linalg/eps.hpp +++ b/palace/linalg/eps.hpp @@ -22,13 +22,13 @@ class DivFreeSolver; class EigenvalueSolver { public: - enum class ScaleType + enum class ScaleType : std::uint8_t { NONE, NORM_2 }; - enum class WhichType + enum class WhichType : std::uint8_t { LARGEST_MAGNITUDE, SMALLEST_MAGNITUDE, @@ -41,7 +41,7 @@ class EigenvalueSolver TARGET_IMAGINARY }; - enum class ErrorType + enum class ErrorType : std::uint8_t { ABSOLUTE, RELATIVE, diff --git a/palace/linalg/iterative.hpp b/palace/linalg/iterative.hpp index 84a1bfd4a..91ca0cee8 100644 --- a/palace/linalg/iterative.hpp +++ b/palace/linalg/iterative.hpp @@ -145,14 +145,14 @@ class CgSolver : public IterativeSolver class GmresSolverBase { public: - enum class OrthogType + enum class OrthogType : std::uint8_t { MGS, CGS, CGS2 }; - enum class PrecSide + enum class PrecSide : std::uint8_t { LEFT, RIGHT diff --git a/palace/linalg/slepc.hpp b/palace/linalg/slepc.hpp index bd4fbc201..a63d26afc 100644 --- a/palace/linalg/slepc.hpp +++ b/palace/linalg/slepc.hpp @@ -52,7 +52,7 @@ PetscReal GetMaxSingularValue(MPI_Comm comm, const ComplexOperator &A, bool herm class SlepcEigenvalueSolver : public EigenvalueSolver { public: - enum class ProblemType + enum class ProblemType : std::uint8_t { HERMITIAN, NON_HERMITIAN, @@ -63,7 +63,7 @@ class SlepcEigenvalueSolver : public EigenvalueSolver GYROSCOPIC }; - enum class Type + enum class Type : std::uint8_t { KRYLOVSCHUR, POWER, diff --git a/palace/models/waveportoperator.cpp b/palace/models/waveportoperator.cpp index 250c5dd4d..6e4bed995 100644 --- a/palace/models/waveportoperator.cpp +++ b/palace/models/waveportoperator.cpp @@ -310,7 +310,7 @@ void Normalize(const GridFunction &S0t, GridFunction &E0t, GridFunction &E0n, } // Helper for BdrSubmeshEVectorCoefficient and BdrSubmeshHVectorCoefficient. -enum class ValueType +enum class ValueType : std::uint8_t { REAL, IMAG diff --git a/palace/utils/configfile.hpp b/palace/utils/configfile.hpp index 0014dc8ef..efa4e876b 100644 --- a/palace/utils/configfile.hpp +++ b/palace/utils/configfile.hpp @@ -76,7 +76,7 @@ struct ElementData std::array direction{{0.0, 0.0, 0.0}}; // Coordinate system that the normal vector is expressed in. - enum class CoordinateSystem + enum class CoordinateSystem : std::uint8_t { CARTESIAN, CYLINDRICAL @@ -93,7 +93,7 @@ struct ProblemData { public: // Simulation type. - enum class Type + enum class Type : std::uint8_t { DRIVEN, EIGENMODE, @@ -444,7 +444,7 @@ struct WavePortData double d_offset = 0.0; // Eigenvalue solver type for boundary mode calculation. - enum class EigenSolverType + enum class EigenSolverType : std::uint8_t { DEFAULT, SLEPC, @@ -486,7 +486,7 @@ struct SurfaceFluxData { public: // Surface flux type. - enum class Type + enum class Type : std::uint8_t { ELECTRIC, MAGNETIC, @@ -519,7 +519,7 @@ struct InterfaceDielectricData { public: // Type of interface dielectric for computing electric field energy participation ratios. - enum class Type + enum class Type : std::uint8_t { DEFAULT, MA, @@ -538,7 +538,7 @@ struct InterfaceDielectricData double tandelta = 0.0; // Side of internal boundaries on which to evaluate discontinuous field quantities. - enum class Side + enum class Side : std::uint8_t { SMALLER_REF_INDEX, LARGER_REF_INDEX @@ -688,7 +688,7 @@ struct TransientSolverData { public: // Time integration scheme type. - enum class Type + enum class Type : std::uint8_t { DEFAULT, GEN_ALPHA, @@ -698,7 +698,7 @@ struct TransientSolverData Type type = Type::DEFAULT; // Excitation type for port excitation. - enum class ExcitationType + enum class ExcitationType : std::uint8_t { SINUSOIDAL, GAUSSIAN, @@ -729,7 +729,7 @@ struct LinearSolverData { public: // Solver type. - enum class Type + enum class Type : std::uint8_t { DEFAULT, AMS, @@ -743,7 +743,7 @@ struct LinearSolverData Type type = Type::DEFAULT; // Krylov solver type. - enum class KspType + enum class KspType : std::uint8_t { DEFAULT, CG, @@ -770,7 +770,7 @@ struct LinearSolverData int mg_max_levels = 100; // Type of coarsening for p-multigrid. - enum class MultigridCoarsenType + enum class MultigridCoarsenType : std::uint8_t { LINEAR, LOGARITHMIC @@ -813,7 +813,7 @@ struct LinearSolverData int pc_mat_shifted = -1; // Choose left or right preconditioning. - enum class SideType + enum class SideType : std::uint8_t { DEFAULT, RIGHT, @@ -823,7 +823,7 @@ struct LinearSolverData // Specify details for the column ordering method in the symbolic factorization for sparse // direct solvers. - enum class SymFactType + enum class SymFactType : std::uint8_t { DEFAULT, METIS, @@ -838,7 +838,7 @@ struct LinearSolverData // Low-rank and butterfly compression parameters for sparse direct solvers which support // it (mainly STRUMPACK). - enum class CompressionType + enum class CompressionType : std::uint8_t { NONE, BLR, @@ -885,7 +885,7 @@ struct LinearSolverData // Enable different variants of Gram-Schmidt orthogonalization for GMRES/FGMRES iterative // solvers and SLEPc eigenvalue solver. - enum class OrthogType + enum class OrthogType : std::uint8_t { MGS, CGS, @@ -913,7 +913,7 @@ struct SolverData int q_order_extra = 0; // Device used to configure MFEM. - enum class Device + enum class Device : std::uint8_t { CPU, GPU, diff --git a/palace/utils/iodata.hpp b/palace/utils/iodata.hpp index b57d3082f..bbf7eb87c 100644 --- a/palace/utils/iodata.hpp +++ b/palace/utils/iodata.hpp @@ -51,7 +51,7 @@ class IoData // Redimensionalize values for output. Outputs which depend on the fields assume a // characteristic reference magnetic field strength Hc such that Pc = 1 W, where Pc is the // characteristic reference power. - enum class ValueType + enum class ValueType : std::uint8_t { TIME, // [ns] FREQUENCY, // [GHz] diff --git a/palace/utils/timer.hpp b/palace/utils/timer.hpp index f4cd9fa5f..e674cbf0e 100644 --- a/palace/utils/timer.hpp +++ b/palace/utils/timer.hpp @@ -24,7 +24,7 @@ class Timer using Duration = std::chrono::duration; using TimePoint = typename Clock::time_point; - enum Index + enum Index : std::uint8_t { INIT = 0, CONSTRUCT, // Space and operator construction