Skip to content

Commit

Permalink
[clang-tidy] fix cppcoreguidelines-use-default-member-init check
Browse files Browse the repository at this point in the history
  • Loading branch information
Yaraslaut committed Jul 19, 2024
1 parent d26293f commit b96cd00
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 24 deletions.
4 changes: 2 additions & 2 deletions palace/fem/fespace.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class FiniteElementSpace
mutable ComplexVector tx, lx, ly;

// Members for discrete interpolators from an auxiliary space to a primal space.
mutable const FiniteElementSpace *aux_fespace;
mutable const FiniteElementSpace *aux_fespace{nullptr};
mutable std::unique_ptr<Operator> G;

bool HasUniqueInterpRestriction(const mfem::FiniteElement &fe) const
Expand Down Expand Up @@ -66,7 +66,7 @@ class FiniteElementSpace
public:
template <typename... T>
FiniteElementSpace(Mesh &mesh, T &&...args)
: fespace(&mesh.Get(), std::forward<T>(args)...), mesh(mesh), aux_fespace(nullptr)
: fespace(&mesh.Get(), std::forward<T>(args)...), mesh(mesh)
{
ResetCeedObjects();
tx.UseDevice(true);
Expand Down
11 changes: 3 additions & 8 deletions palace/fem/libceed/integrator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,18 @@ enum EvalMode : unsigned int // NOLINT
struct CeedQFunctionInfo
{
// QFunctions for operator construction and application.
CeedQFunctionUser apply_qf;
CeedQFunctionUser apply_qf{nullptr};

// Path and name of the QFunctions for operator construction and application.
std::string apply_qf_path;

// Evaluation modes for the test and trial basis.
unsigned int trial_ops, test_ops;
unsigned int trial_ops{0}, test_ops{0};

// Control whether or not to pre-assemble the quadrature data or compute it during
// operator application in true matrix-free fashion.
bool assemble_q_data;
bool assemble_q_data{false};

CeedQFunctionInfo()
: apply_qf(nullptr), apply_qf_path(""), trial_ops(0), test_ops(0),
assemble_q_data(false)
{
}
};

// Helper function to get the geometry space dimension.
Expand Down
4 changes: 2 additions & 2 deletions palace/linalg/chebyshev.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class ChebyshevSmoother : public Solver<OperType>
VecType dinv;

// Maximum operator eigenvalue for Chebyshev polynomial smoothing.
double lambda_max, sf_max;
double lambda_max, sf_max; // NOLINT

// Temporary vector for smoother application.
mutable VecType d, r;
Expand Down Expand Up @@ -102,7 +102,7 @@ class ChebyshevSmoother1stKind : public Solver<OperType>

// Parameters depending on maximum and minimum operator eigenvalue estimates for Chebyshev
// polynomial smoothing.
double theta, delta, sf_max, sf_min;
double theta, delta, sf_max, sf_min; // NOLINT

// Temporary vector for smoother application.
mutable VecType d, r;
Expand Down
3 changes: 1 addition & 2 deletions palace/linalg/distrelaxation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ template <typename OperType>
DistRelaxationSmoother<OperType>::DistRelaxationSmoother(
MPI_Comm comm, const Operator &G, int smooth_it, int cheby_smooth_it, int cheby_order,
double cheby_sf_max, double cheby_sf_min, bool cheby_4th_kind)
: Solver<OperType>(), pc_it(smooth_it), G(&G), A(nullptr), A_G(nullptr),
dbc_tdof_list_G(nullptr)
: Solver<OperType>(), pc_it(smooth_it), G(&G), A(nullptr), A_G(nullptr)
{
// Initialize smoothers.
if (cheby_4th_kind)
Expand Down
2 changes: 1 addition & 1 deletion palace/linalg/distrelaxation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class DistRelaxationSmoother : public Solver<OperType>

// System matrix and its projection GᵀAG (not owned).
const OperType *A, *A_G;
const mfem::Array<int> *dbc_tdof_list_G;
const mfem::Array<int> *dbc_tdof_list_G{nullptr};

// Point smoother objects for each matrix.
mutable std::unique_ptr<Solver<OperType>> B;
Expand Down
9 changes: 4 additions & 5 deletions palace/linalg/iterative.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,14 +187,14 @@ class GmresSolver : public IterativeSolver<OperType>, GmresSolverBase
using IterativeSolver<OperType>::final_it;

// Maximum subspace dimension for restarted GMRES.
mutable int max_dim;
mutable int max_dim{-1};

// Orthogonalization method for orthonormalizing a newly computed vector against a basis
// at each iteration.
OrthogType orthog_type;
OrthogType orthog_type{OrthogType::MGS};

// Use left or right preconditioning.
PrecSide pc_side;
PrecSide pc_side{PrecSide::LEFT};

// Temporary workspace for solve.
mutable std::vector<VecType> V;
Expand All @@ -209,8 +209,7 @@ class GmresSolver : public IterativeSolver<OperType>, GmresSolverBase

public:
GmresSolver(MPI_Comm comm, int print)
: IterativeSolver<OperType>(comm, print), max_dim(-1), orthog_type(OrthogType::MGS),
pc_side(PrecSide::LEFT)
: IterativeSolver<OperType>(comm, print)
{
}

Expand Down
2 changes: 1 addition & 1 deletion palace/utils/iodata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ std::stringstream PreprocessFile(const char *filename)

using json = nlohmann::json;

IoData::IoData(const char *filename, bool print) : Lc(1.0), tc(1.0), init(false)
IoData::IoData(const char *filename, bool print)
{
// Open configuration file and preprocess: strip whitespace, comments, and expand integer
// ranges.
Expand Down
6 changes: 3 additions & 3 deletions palace/utils/iodata.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ class IoData

private:
// Characteristic reference length [m] and time [ns] for nondimensionalization.
double Lc, tc;
bool init;
double Lc{1.0}, tc{1.0};
bool init{false};

// Check configuration file options and compatibility with requested problem type.
void CheckConfiguration();
Expand All @@ -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 : std::uint8_t
enum class ValueType : std::uint8_t
{
TIME, // [ns]
FREQUENCY, // [GHz]
Expand Down

0 comments on commit b96cd00

Please sign in to comment.