Skip to content

Commit

Permalink
[clang-tidy] fix performance-enum-size check
Browse files Browse the repository at this point in the history
  • Loading branch information
Yaraslaut committed Jul 19, 2024
1 parent 684aaf2 commit d26293f
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 30 deletions.
2 changes: 2 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,7 @@ Checks: >
performance-*,
mpi-*,
openmp-*'
WarningsAsErrors: >-
performance-enum-size
HeaderFilterRegex: 'palace/drivers|palace/fem|palace/linalg|palace/utils'
FormatStyle: 'file'
6 changes: 3 additions & 3 deletions palace/fem/coefficient.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ class BdrSurfaceCurrentVectorCoefficient : public mfem::VectorCoefficient,
};

// Helper for BdrSurfaceFluxCoefficient.
enum class SurfaceFluxType
enum class SurfaceFluxType : std::uint8_t
{
ELECTRIC,
MAGNETIC,
Expand Down Expand Up @@ -292,7 +292,7 @@ inline void BdrSurfaceFluxCoefficient<SurfaceFluxType::POWER>::GetLocalFlux(
}

// Helper for InterfaceDielectricCoefficient.
enum class InterfaceDielectricType
enum class InterfaceDielectricType : std::uint8_t
{
DEFAULT,
MA,
Expand Down Expand Up @@ -467,7 +467,7 @@ inline double InterfaceDielectricCoefficient<InterfaceDielectricType::SA>::Eval(
}

// Helper for EnergyDensityCoefficient.
enum class EnergyDensityType
enum class EnergyDensityType : std::uint8_t
{
ELECTRIC,
MAGNETIC
Expand Down
2 changes: 1 addition & 1 deletion palace/fem/libceed/integrator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions palace/linalg/eps.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -41,7 +41,7 @@ class EigenvalueSolver
TARGET_IMAGINARY
};

enum class ErrorType
enum class ErrorType : std::uint8_t
{
ABSOLUTE,
RELATIVE,
Expand Down
4 changes: 2 additions & 2 deletions palace/linalg/iterative.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,14 @@ class CgSolver : public IterativeSolver<OperType>
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
Expand Down
4 changes: 2 additions & 2 deletions palace/linalg/slepc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -63,7 +63,7 @@ class SlepcEigenvalueSolver : public EigenvalueSolver
GYROSCOPIC
};

enum class Type
enum class Type : std::uint8_t
{
KRYLOVSCHUR,
POWER,
Expand Down
2 changes: 1 addition & 1 deletion palace/models/waveportoperator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
32 changes: 16 additions & 16 deletions palace/utils/configfile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ struct ElementData
std::array<double, 3> 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
Expand All @@ -93,7 +93,7 @@ struct ProblemData
{
public:
// Simulation type.
enum class Type
enum class Type : std::uint8_t
{
DRIVEN,
EIGENMODE,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -486,7 +486,7 @@ struct SurfaceFluxData
{
public:
// Surface flux type.
enum class Type
enum class Type : std::uint8_t
{
ELECTRIC,
MAGNETIC,
Expand Down Expand Up @@ -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,
Expand All @@ -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
Expand Down Expand Up @@ -688,7 +688,7 @@ struct TransientSolverData
{
public:
// Time integration scheme type.
enum class Type
enum class Type : std::uint8_t
{
DEFAULT,
GEN_ALPHA,
Expand All @@ -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,
Expand Down Expand Up @@ -729,7 +729,7 @@ struct LinearSolverData
{
public:
// Solver type.
enum class Type
enum class Type : std::uint8_t
{
DEFAULT,
AMS,
Expand All @@ -743,7 +743,7 @@ struct LinearSolverData
Type type = Type::DEFAULT;

// Krylov solver type.
enum class KspType
enum class KspType : std::uint8_t
{
DEFAULT,
CG,
Expand All @@ -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
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion palace/utils/iodata.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion palace/utils/timer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Timer
using Duration = std::chrono::duration<double>;
using TimePoint = typename Clock::time_point;

enum Index
enum Index : std::uint8_t
{
INIT = 0,
CONSTRUCT, // Space and operator construction
Expand Down

0 comments on commit d26293f

Please sign in to comment.