Skip to content

Commit f9884dd

Browse files
authored
Remove all clang tidy warnings from the core library of Lethe (chaos-polymtl#1243)
Description Since I have deployed the new CI action, we are able to identify many more alerts using clang sanitizer. This PR aims at removing the alerts from the core library of Lethe. We still have warnings when we compile with clang, but this will need an additional CI instance check. Testing All units tests and application tests should pass before this is merged. Former-commit-id: afe7dbb
1 parent f280cd9 commit f9884dd

32 files changed

+242
-238
lines changed

include/core/bdf.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ using namespace dealii;
5050
Vector<double>
5151
calculate_bdf_coefficients(
5252
const Parameters::SimulationControl::TimeSteppingMethod method,
53-
const std::vector<double> time_steps);
53+
const std::vector<double> &time_steps);
5454

5555

5656
/**
@@ -78,10 +78,10 @@ calculate_bdf_coefficients(
7878
* calculation of BDF coefficients.
7979
*/
8080
Vector<double>
81-
delta(const unsigned int order,
82-
const unsigned int n,
83-
const unsigned int j,
84-
const Vector<double> times);
81+
delta(const unsigned int order,
82+
const unsigned int n,
83+
const unsigned int j,
84+
const Vector<double> &times);
8585

8686

8787

include/core/manifolds.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -186,19 +186,19 @@ attach_manifolds_to_triangulation(
186186
*/
187187
void
188188
attach_cad_to_manifold(parallel::DistributedTriangulationBase<2> &triangulation,
189-
std::string cad_name,
190-
unsigned int manifold_id);
189+
const std::string &cad_name,
190+
const unsigned int manifold_id);
191191

192192
void
193193
attach_cad_to_manifold(
194194
parallel::DistributedTriangulationBase<2, 3> &triangulation,
195-
std::string cad_name,
196-
unsigned int manifold_id);
195+
const std::string &cad_name,
196+
const unsigned int manifold_id);
197197

198198
void
199199
attach_cad_to_manifold(parallel::DistributedTriangulationBase<3> &triangulation,
200-
std::string cad_name,
201-
unsigned int manifold_id);
200+
const std::string &cad_name,
201+
const unsigned int manifold_id);
202202

203203

204204

include/core/parameters.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -384,12 +384,12 @@ namespace Parameters
384384
{}
385385

386386
void
387-
declare_parameters(ParameterHandler &prm,
388-
std::string material_prefix,
389-
unsigned int id);
387+
declare_parameters(ParameterHandler &prm,
388+
const std::string &material_prefix,
389+
unsigned int id);
390390
void
391391
parse_parameters(ParameterHandler &prm,
392-
std::string material_prefix,
392+
const std::string &material_prefix,
393393
const unsigned int id,
394394
const Dimensionality dimensions);
395395

@@ -815,8 +815,8 @@ namespace Parameters
815815
// z =2) value of the beam_orientation parameter
816816
unsigned int beam_orientation_coordinate;
817817

818-
// beam_direction shows the direction of laser beam (either in positive (1)
819-
// or negative (0) direction
818+
// beam_direction shows the direction of laser beam (either in positive
819+
// (true) or negative (false) direction
820820
bool beam_direction;
821821

822822
// Based on the laser beam orientation, the integer values of a

include/core/parsed_function_custom.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ class ParsedFunctionCustom
8181
* @param[in] constants_list Constants used by the expressions
8282
*/
8383
void
84-
initialize(const std::string vnames,
85-
const std::string expression,
86-
const std::string constants_list);
84+
initialize(const std::string &vnames,
85+
const std::string &expression,
86+
const std::string &constants_list);
8787

8888
/**
8989
* @brief Evaluate all components at the evaluation point

include/core/pvd_handler.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,18 @@ class PVDHandler
3535
* @param filename Name of the file to which the PVDHandler content is save
3636
*/
3737
void
38-
save(std::string filename);
38+
save(const std::string &filename);
3939

4040
/**
4141
* @brief read Reads the content of a pvd times_and_names checpoint
4242
*
4343
* @param filename Name of the file frin which the PVDHandler content is read
4444
*/
4545
void
46-
read(std::string filename);
46+
read(const std::string &filename);
4747

4848
void
49-
append(double time, std::string pvtu_filename)
49+
append(double time, const std::string &pvtu_filename)
5050
{
5151
times_and_names.push_back(
5252
std::pair<double, std::string>(time, pvtu_filename));

include/core/serial_solid.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,8 @@ class SerialSolid
201201
* @param simulation_control The simulation control object
202202
*/
203203
void
204-
write_output_results(std::shared_ptr<SimulationControl> simulation_control);
204+
write_output_results(
205+
const std::shared_ptr<SimulationControl> &simulation_control);
205206

206207
/**
207208
* @brief read solid base triangulation checkpoint and replaces the
@@ -211,15 +212,15 @@ class SerialSolid
211212
*
212213
*/
213214
void
214-
read_checkpoint(std::string prefix_name);
215+
read_checkpoint(const std::string &prefix_name);
215216

216217
/**
217218
* @brief write solid base triangulation checkpoint
218219
*
219220
* @param prefix_name The prefix of the checkpoint of the simulation
220221
*/
221222
void
222-
write_checkpoint(std::string prefix_name);
223+
write_checkpoint(const std::string &prefix_name);
223224

224225

225226
private:

include/core/shape.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2680,7 +2680,7 @@ class RBFShape : public Shape<dim>
26802680
* @param orientation the orientation of the shape with respect to each main
26812681
* axis
26822682
*/
2683-
RBFShape(const std::string shape_arguments_str,
2683+
RBFShape(const std::string &shape_arguments_str,
26842684
const Point<dim> &position,
26852685
const Tensor<1, 3> &orientation);
26862686

include/core/shape_parsing.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ namespace ShapeGenerator
3333
*/
3434
template <int dim>
3535
std::shared_ptr<Shape<dim>>
36-
initialize_shape(const std::string type,
37-
const std::string shape_arguments_str,
36+
initialize_shape(const std::string &type,
37+
const std::string &shape_arguments_str,
3838
const Point<dim> &position,
3939
const Tensor<1, 3> &orientation);
4040

@@ -47,10 +47,10 @@ namespace ShapeGenerator
4747
*/
4848
template <int dim>
4949
std::shared_ptr<Shape<dim>>
50-
initialize_shape_from_vector(const std::string type,
51-
const std::vector<double> shape_arguments,
52-
const Point<dim> &position,
53-
const Tensor<1, 3> &orientation);
50+
initialize_shape_from_vector(const std::string &type,
51+
const std::vector<double> &shape_arguments,
52+
const Point<dim> &position,
53+
const Tensor<1, 3> &orientation);
5454

5555
/**
5656
* Initializes the shape from its type and a text file that contains the real
@@ -62,8 +62,8 @@ namespace ShapeGenerator
6262
*/
6363
template <int dim>
6464
std::shared_ptr<Shape<dim>>
65-
initialize_shape_from_file(const std::string type,
66-
const std::string file_name,
65+
initialize_shape_from_file(const std::string &type,
66+
const std::string &file_name,
6767
const Point<dim> &position,
6868
const Tensor<1, 3> &orientation);
6969
} // namespace ShapeGenerator

include/core/simulation_control.h

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ class SimulationControl
165165
*
166166
**/
167167

168-
SimulationControl(const Parameters::SimulationControl param);
168+
SimulationControl(const Parameters::SimulationControl &param);
169169

170170
/**
171171
* @brief Pure virtual function to control the progression of the simulation.
@@ -472,23 +472,31 @@ class SimulationControl
472472
return bdf_coefs;
473473
}
474474

475-
475+
/**
476+
* @brief Save the simulation control information from the checkpoint file and updates the time step vector, the CFL value, the time and the iteration number.
477+
*
478+
* @param prefix The prefix of the checkpoint of the simulation
479+
*/
476480
void
477-
save(std::string filename);
481+
save(const std::string &prefix);
478482

479483
/**
480484
* @brief Reads the simulation control information from the checkpoint file and updates the time step vector, the CFL value, the time and the iteration number.
485+
*
486+
* @param prefix The prefix of the checkpoint of the simulation
481487
*/
482488
void
483-
read(std::string filename);
489+
read(const std::string &prefix);
484490

485491
/**
486492
* @brief Reads and returns the simulation control information from the checkpoint file filename without updating the simulation control information.
487493
*
494+
* @param prefix The prefix of the checkpoint of the simulation
495+
*
488496
* @return A vector containing the last checkpointed file and time step.
489497
*/
490498
std::vector<double>
491-
get_checkpointed_simulation_control_info(std::string filename);
499+
get_checkpointed_simulation_control_info(const std::string &prefix);
492500
};
493501

494502

@@ -518,7 +526,7 @@ class SimulationControlTransient : public SimulationControl
518526

519527

520528
public:
521-
SimulationControlTransient(Parameters::SimulationControl param);
529+
SimulationControlTransient(const Parameters::SimulationControl &param);
522530

523531
virtual void
524532
print_progression(const ConditionalOStream &pcout) override;
@@ -543,7 +551,7 @@ class SimulationControlTransient : public SimulationControl
543551
class SimulationControlTransientDEM : public SimulationControlTransient
544552
{
545553
public:
546-
SimulationControlTransientDEM(Parameters::SimulationControl param);
554+
SimulationControlTransientDEM(const Parameters::SimulationControl &param);
547555

548556
virtual void
549557
print_progression(const ConditionalOStream &pcout) override;
@@ -571,7 +579,8 @@ class SimulationControlTransientDynamicOutput
571579
calculate_time_step() override;
572580

573581
public:
574-
SimulationControlTransientDynamicOutput(Parameters::SimulationControl param);
582+
SimulationControlTransientDynamicOutput(
583+
const Parameters::SimulationControl &param);
575584

576585

577586
/**
@@ -585,7 +594,7 @@ class SimulationControlTransientDynamicOutput
585594
class SimulationControlSteady : public SimulationControl
586595
{
587596
public:
588-
SimulationControlSteady(Parameters::SimulationControl param);
597+
SimulationControlSteady(const Parameters::SimulationControl &param);
589598

590599
virtual void
591600
print_progression(const ConditionalOStream &pcout) override;
@@ -606,7 +615,7 @@ class SimulationControlSteady : public SimulationControl
606615
class SimulationControlAdjointSteady : public SimulationControlTransient
607616
{
608617
public:
609-
SimulationControlAdjointSteady(Parameters::SimulationControl param);
618+
SimulationControlAdjointSteady(const Parameters::SimulationControl &param);
610619

611620
virtual void
612621
print_progression(const ConditionalOStream &pcout) override;

include/core/solid_base.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,14 @@ class SolidBase
101101
* @brief Loads a solid triangulation from a restart file
102102
*/
103103
void
104-
load_triangulation(const std::string filename_tria);
104+
load_triangulation(const std::string &filename_tria);
105105

106106
/**
107107
* @brief Loads a particle handler in the fluid triangulation domain that holds the particles of the solid
108108
* according to a specific quadrature, and sets up dofs
109109
*/
110110
void
111-
load_particles(const std::string filename_part);
111+
load_particles(const std::string &filename_part);
112112

113113
/**
114114
* @return the reference to the std::shared_ptr of a Particles::ParticleHandler<spacedim> that contains the solid particle handler
@@ -220,13 +220,13 @@ class SolidBase
220220
* @brief read solid base triangulation checkpoint
221221
*/
222222
void
223-
read_checkpoint(std::string prefix_name);
223+
read_checkpoint(const std::string &prefix_name);
224224

225225
/**
226226
* @brief write solid base triangulation checkpoint
227227
*/
228228
void
229-
write_checkpoint(std::string prefix_name);
229+
write_checkpoint(const std::string &prefix_name);
230230

231231

232232
private:

0 commit comments

Comments
 (0)