Skip to content
Snippets Groups Projects
Commit e821b456 authored by Dmitri Naumov's avatar Dmitri Naumov
Browse files

Fix constness of arguments and variables.

Use const references where necessary.
parent 5d0b4e84
No related branches found
No related tags found
No related merge requests found
Showing
with 31 additions and 30 deletions
...@@ -293,7 +293,7 @@ bool TetGenInterface::readNodesFromStream (std::ifstream &ins, ...@@ -293,7 +293,7 @@ bool TetGenInterface::readNodesFromStream (std::ifstream &ins,
return false; return false;
} }
bool TetGenInterface::parseNodesFileHeader(std::string& line, bool TetGenInterface::parseNodesFileHeader(std::string const& line,
std::size_t& n_nodes, std::size_t& n_nodes,
std::size_t& dim, std::size_t& dim,
std::size_t& n_attributes, std::size_t& n_attributes,
......
...@@ -122,7 +122,7 @@ private: ...@@ -122,7 +122,7 @@ private:
* @param boundary_markers have the nodes boundary information (output) * @param boundary_markers have the nodes boundary information (output)
* @return true, if the file header is read, false if the method detects an error * @return true, if the file header is read, false if the method detects an error
*/ */
static bool parseNodesFileHeader(std::string& line, static bool parseNodesFileHeader(std::string const& line,
std::size_t& n_nodes, std::size_t& n_nodes,
std::size_t& dim, std::size_t& dim,
std::size_t& n_attributes, std::size_t& n_attributes,
......
...@@ -85,8 +85,8 @@ void writeLiquidFlowPointBC(std::ostream & bc_out, std::string const& pnt_name) ...@@ -85,8 +85,8 @@ void writeLiquidFlowPointBC(std::ostream & bc_out, std::string const& pnt_name)
// set on, geo_name is the name the geometry can be accessed with, out_fname is // set on, geo_name is the name the geometry can be accessed with, out_fname is
// the base file name the gli and bc as well as the gml file will be written to. // the base file name the gli and bc as well as the gml file will be written to.
void writeBCsAndGeometry(GeoLib::GEOObjects& geometry_sets, void writeBCsAndGeometry(GeoLib::GEOObjects& geometry_sets,
std::string& geo_name, std::string const& out_fname, std::string const& geo_name, std::string const& out_fname,
std::string const& bc_type, bool write_gml) std::string const& bc_type, bool const write_gml)
{ {
if (write_gml) { if (write_gml) {
INFO("write points to '{:s}.gml'.", geo_name); INFO("write points to '{:s}.gml'.", geo_name);
......
...@@ -22,7 +22,8 @@ ...@@ -22,7 +22,8 @@
#include "MeshLib/IO/readMeshFromFile.h" #include "MeshLib/IO/readMeshFromFile.h"
#include "MeshLib/IO/writeMeshToFile.h" #include "MeshLib/IO/writeMeshToFile.h"
static void swapNodeCoordinateAxes(MeshLib::Mesh &mesh, std::array<int, 3> const& new_axes_indices) static void swapNodeCoordinateAxes(MeshLib::Mesh const& mesh,
std::array<int, 3> const& new_axes_indices)
{ {
double new_coords[3] = {}; double new_coords[3] = {};
for (MeshLib::Node* node : mesh.getNodes()) for (MeshLib::Node* node : mesh.getNodes())
......
...@@ -381,7 +381,7 @@ bool copyPropertyVector( ...@@ -381,7 +381,7 @@ bool copyPropertyVector(
MeshLib::Properties& partitioned_properties, MeshLib::Properties& partitioned_properties,
std::vector<Partition> const& partitions, std::vector<Partition> const& partitions,
MeshLib::PropertyVector<T> const* const pv, MeshLib::PropertyVector<T> const* const pv,
std::map<MeshLib::MeshItemType, std::size_t> const total_number_of_tuples) std::map<MeshLib::MeshItemType, std::size_t> const& total_number_of_tuples)
{ {
if (pv == nullptr) if (pv == nullptr)
{ {
......
...@@ -128,7 +128,7 @@ static double averageReactantMolality( ...@@ -128,7 +128,7 @@ static double averageReactantMolality(
} }
} // namespace } // namespace
PhreeqcIO::PhreeqcIO(std::string const project_file_name, PhreeqcIO::PhreeqcIO(std::string const& project_file_name,
std::string&& database, std::string&& database,
std::unique_ptr<ChemicalSystem>&& chemical_system, std::unique_ptr<ChemicalSystem>&& chemical_system,
std::vector<ReactionRate>&& reaction_rates, std::vector<ReactionRate>&& reaction_rates,
......
...@@ -34,7 +34,7 @@ struct UserPunch; ...@@ -34,7 +34,7 @@ struct UserPunch;
class PhreeqcIO final : public ChemicalSolverInterface class PhreeqcIO final : public ChemicalSolverInterface
{ {
public: public:
PhreeqcIO(std::string const project_file_name, PhreeqcIO(std::string const& project_file_name,
std::string&& database, std::string&& database,
std::unique_ptr<ChemicalSystem>&& chemical_system, std::unique_ptr<ChemicalSystem>&& chemical_system,
std::vector<ReactionRate>&& reaction_rates, std::vector<ReactionRate>&& reaction_rates,
......
...@@ -28,19 +28,19 @@ std::unique_ptr<FractureModelBase<DisplacementDim>> createCohesiveZoneModeI( ...@@ -28,19 +28,19 @@ std::unique_ptr<FractureModelBase<DisplacementDim>> createCohesiveZoneModeI(
config.checkConfigParameter("type", "CohesiveZoneModeI"); config.checkConfigParameter("type", "CohesiveZoneModeI");
DBUG("Create CohesiveZoneModeI material"); DBUG("Create CohesiveZoneModeI material");
auto& Kn = ParameterLib::findParameter<double>( auto const& Kn = ParameterLib::findParameter<double>(
//! \ogs_file_param_special{material__fracture_model__CohesiveZoneModeI__normal_stiffness} //! \ogs_file_param_special{material__fracture_model__CohesiveZoneModeI__normal_stiffness}
config, "normal_stiffness", parameters, 1); config, "normal_stiffness", parameters, 1);
auto& Ks = ParameterLib::findParameter<double>( auto const& Ks = ParameterLib::findParameter<double>(
//! \ogs_file_param_special{material__fracture_model__CohesiveZoneModeI__shear_stiffness} //! \ogs_file_param_special{material__fracture_model__CohesiveZoneModeI__shear_stiffness}
config, "shear_stiffness", parameters, 1); config, "shear_stiffness", parameters, 1);
auto& Gc = ParameterLib::findParameter<double>( auto const& Gc = ParameterLib::findParameter<double>(
//! \ogs_file_param_special{material__fracture_model__CohesiveZoneModeI__fracture_toughness} //! \ogs_file_param_special{material__fracture_model__CohesiveZoneModeI__fracture_toughness}
config, "fracture_toughness", parameters, 1); config, "fracture_toughness", parameters, 1);
auto& t_np = ParameterLib::findParameter<double>( auto const& t_np = ParameterLib::findParameter<double>(
//! \ogs_file_param_special{material__fracture_model__CohesiveZoneModeI__peak_normal_traction} //! \ogs_file_param_special{material__fracture_model__CohesiveZoneModeI__peak_normal_traction}
config, "peak_normal_traction", parameters, 1); config, "peak_normal_traction", parameters, 1);
......
...@@ -27,11 +27,11 @@ createLinearElasticIsotropic( ...@@ -27,11 +27,11 @@ createLinearElasticIsotropic(
config.checkConfigParameter("type", "LinearElasticIsotropic"); config.checkConfigParameter("type", "LinearElasticIsotropic");
DBUG("Create LinearElasticIsotropic material"); DBUG("Create LinearElasticIsotropic material");
auto& Kn = ParameterLib::findParameter<double>( auto const& Kn = ParameterLib::findParameter<double>(
//! \ogs_file_param_special{material__fracture_model__LinearElasticIsotropic__normal_stiffness} //! \ogs_file_param_special{material__fracture_model__LinearElasticIsotropic__normal_stiffness}
config, "normal_stiffness", parameters, 1); config, "normal_stiffness", parameters, 1);
auto& Ks = ParameterLib::findParameter<double>( auto const& Ks = ParameterLib::findParameter<double>(
//! \ogs_file_param_special{material__fracture_model__LinearElasticIsotropic__shear_stiffness} //! \ogs_file_param_special{material__fracture_model__LinearElasticIsotropic__shear_stiffness}
config, "shear_stiffness", parameters, 1); config, "shear_stiffness", parameters, 1);
......
...@@ -32,7 +32,7 @@ BoundaryElementsAlongPolyline::BoundaryElementsAlongPolyline( ...@@ -32,7 +32,7 @@ BoundaryElementsAlongPolyline::BoundaryElementsAlongPolyline(
auto node_ids_on_poly = mshNodeSearcher.getMeshNodeIDs(ply); auto node_ids_on_poly = mshNodeSearcher.getMeshNodeIDs(ply);
MeshLib::ElementSearch es(_mesh); MeshLib::ElementSearch es(_mesh);
es.searchByNodeIDs(node_ids_on_poly); es.searchByNodeIDs(node_ids_on_poly);
auto& ele_ids_near_ply = es.getSearchedElementIDs(); auto const& ele_ids_near_ply = es.getSearchedElementIDs();
// check all edges of the elements near the polyline // check all edges of the elements near the polyline
for (auto ele_id : ele_ids_near_ply) for (auto ele_id : ele_ids_near_ply)
......
...@@ -28,7 +28,7 @@ MeshNodesAlongSurface::MeshNodesAlongSurface(MeshLib::Mesh const& mesh, ...@@ -28,7 +28,7 @@ MeshNodesAlongSurface::MeshNodesAlongSurface(MeshLib::Mesh const& mesh,
SearchAllNodes search_all_nodes) SearchAllNodes search_all_nodes)
: _mesh(mesh), _sfc(sfc) : _mesh(mesh), _sfc(sfc)
{ {
auto& mesh_nodes = _mesh.getNodes(); auto const& mesh_nodes = _mesh.getNodes();
const std::size_t n_nodes(search_all_nodes == SearchAllNodes::Yes const std::size_t n_nodes(search_all_nodes == SearchAllNodes::Yes
? _mesh.getNumberOfNodes() ? _mesh.getNumberOfNodes()
: _mesh.getNumberOfBaseNodes()); : _mesh.getNumberOfBaseNodes());
......
...@@ -185,7 +185,7 @@ public: ...@@ -185,7 +185,7 @@ public:
bool is_axially_symmetric, bool is_axially_symmetric,
unsigned const integration_order, unsigned const integration_order,
ComponentTransportProcessData const& process_data, ComponentTransportProcessData const& process_data,
std::vector<std::reference_wrapper<ProcessVariable>> std::vector<std::reference_wrapper<ProcessVariable>> const&
transport_process_variables) transport_process_variables)
: _element(element), : _element(element),
_process_data(process_data), _process_data(process_data),
......
...@@ -302,7 +302,7 @@ void Output::doOutputAlways(Process const& process, ...@@ -302,7 +302,7 @@ void Output::doOutputAlways(Process const& process,
return; return;
} }
auto output_bulk_mesh = [&](MeshLib::Mesh& mesh) { auto output_bulk_mesh = [&](MeshLib::Mesh const& mesh) {
MeshLib::IO::PVDFile* pvd_file = nullptr; MeshLib::IO::PVDFile* pvd_file = nullptr;
if (_output_file_type == ProcessLib::OutputType::vtk) if (_output_file_type == ProcessLib::OutputType::vtk)
{ {
......
...@@ -112,42 +112,42 @@ std::unique_ptr<Process> createPhaseFieldProcess( ...@@ -112,42 +112,42 @@ std::unique_ptr<Process> createPhaseFieldProcess(
config.getConfigSubtree("phasefield_parameters"); config.getConfigSubtree("phasefield_parameters");
// Residual stiffness // Residual stiffness
auto& residual_stiffness = ParameterLib::findParameter<double>( auto const& residual_stiffness = ParameterLib::findParameter<double>(
phasefield_parameters_config, phasefield_parameters_config,
//! \ogs_file_param_special{prj__processes__process__PHASE_FIELD__phasefield_parameters__residual_stiffness} //! \ogs_file_param_special{prj__processes__process__PHASE_FIELD__phasefield_parameters__residual_stiffness}
"residual_stiffness", parameters, 1); "residual_stiffness", parameters, 1);
DBUG("Use '{:s}' as residual stiffness.", residual_stiffness.name); DBUG("Use '{:s}' as residual stiffness.", residual_stiffness.name);
// Crack resistance // Crack resistance
auto& crack_resistance = ParameterLib::findParameter<double>( auto const& crack_resistance = ParameterLib::findParameter<double>(
phasefield_parameters_config, phasefield_parameters_config,
//! \ogs_file_param_special{prj__processes__process__PHASE_FIELD__phasefield_parameters__crack_resistance} //! \ogs_file_param_special{prj__processes__process__PHASE_FIELD__phasefield_parameters__crack_resistance}
"crack_resistance", parameters, 1); "crack_resistance", parameters, 1);
DBUG("Use '{:s}' as crack resistance.", crack_resistance.name); DBUG("Use '{:s}' as crack resistance.", crack_resistance.name);
// Crack length scale // Crack length scale
auto& crack_length_scale = ParameterLib::findParameter<double>( auto const& crack_length_scale = ParameterLib::findParameter<double>(
phasefield_parameters_config, phasefield_parameters_config,
//! \ogs_file_param_special{prj__processes__process__PHASE_FIELD__phasefield_parameters__crack_length_scale} //! \ogs_file_param_special{prj__processes__process__PHASE_FIELD__phasefield_parameters__crack_length_scale}
"crack_length_scale", parameters, 1); "crack_length_scale", parameters, 1);
DBUG("Use '{:s}' as crack length scale.", crack_length_scale.name); DBUG("Use '{:s}' as crack length scale.", crack_length_scale.name);
// Kinetic coefficient // Kinetic coefficient
auto& kinetic_coefficient = ParameterLib::findParameter<double>( auto const& kinetic_coefficient = ParameterLib::findParameter<double>(
phasefield_parameters_config, phasefield_parameters_config,
//! \ogs_file_param_special{prj__processes__process__PHASE_FIELD__phasefield_parameters__kinetic_coefficient} //! \ogs_file_param_special{prj__processes__process__PHASE_FIELD__phasefield_parameters__kinetic_coefficient}
"kinetic_coefficient", parameters, 1); "kinetic_coefficient", parameters, 1);
DBUG("Use '{:s}' as kinetic coefficient.", kinetic_coefficient.name); DBUG("Use '{:s}' as kinetic coefficient.", kinetic_coefficient.name);
// Solid density // Solid density
auto& solid_density = ParameterLib::findParameter<double>( auto const& solid_density = ParameterLib::findParameter<double>(
config, config,
//! \ogs_file_param_special{prj__processes__process__PHASE_FIELD__solid_density} //! \ogs_file_param_special{prj__processes__process__PHASE_FIELD__solid_density}
"solid_density", parameters, 1); "solid_density", parameters, 1);
DBUG("Use '{:s}' as solid density parameter.", solid_density.name); DBUG("Use '{:s}' as solid density parameter.", solid_density.name);
// History field // History field
auto& history_field = ParameterLib::findParameter<double>( auto const& history_field = ParameterLib::findParameter<double>(
phasefield_parameters_config, phasefield_parameters_config,
//! \ogs_file_param_special{prj__processes__process__PHASE_FIELD__phasefield_parameters__history_field} //! \ogs_file_param_special{prj__processes__process__PHASE_FIELD__phasefield_parameters__history_field}
"history_field", parameters, 1); "history_field", parameters, 1);
......
...@@ -43,7 +43,7 @@ struct PhaseFieldProcessData ...@@ -43,7 +43,7 @@ struct PhaseFieldProcessData
ParameterLib::Parameter<double> const& crack_length_scale; ParameterLib::Parameter<double> const& crack_length_scale;
ParameterLib::Parameter<double> const& kinetic_coefficient; ParameterLib::Parameter<double> const& kinetic_coefficient;
ParameterLib::Parameter<double> const& solid_density; ParameterLib::Parameter<double> const& solid_density;
ParameterLib::Parameter<double>& history_field; ParameterLib::Parameter<double> const& history_field;
Eigen::Matrix<double, DisplacementDim, 1> const specific_body_force; Eigen::Matrix<double, DisplacementDim, 1> const specific_body_force;
bool propagating_crack = false; bool propagating_crack = false;
bool crack_pressure = false; bool crack_pressure = false;
......
...@@ -110,7 +110,7 @@ void Process::initialize() ...@@ -110,7 +110,7 @@ void Process::initialize()
void Process::setInitialConditions( void Process::setInitialConditions(
std::vector<GlobalVector*>& process_solutions, std::vector<GlobalVector*>& process_solutions,
std::vector<GlobalVector*>& process_solutions_prev, std::vector<GlobalVector*> const& process_solutions_prev,
double const t, double const t,
int const process_id) int const process_id)
{ {
......
...@@ -84,7 +84,7 @@ public: ...@@ -84,7 +84,7 @@ public:
void setInitialConditions( void setInitialConditions(
std::vector<GlobalVector*>& process_solutions, std::vector<GlobalVector*>& process_solutions,
std::vector<GlobalVector*>& process_solutions_prev, std::vector<GlobalVector*> const& process_solutions_prev,
double const t, double const t,
int const process_id); int const process_id);
......
...@@ -331,7 +331,7 @@ std::vector<std::unique_ptr<SourceTerm>> ProcessVariable::createSourceTerms( ...@@ -331,7 +331,7 @@ std::vector<std::unique_ptr<SourceTerm>> ProcessVariable::createSourceTerms(
std::vector<std::unique_ptr<SourceTerm>> source_terms; std::vector<std::unique_ptr<SourceTerm>> source_terms;
transform(cbegin(_source_term_configs), cend(_source_term_configs), transform(cbegin(_source_term_configs), cend(_source_term_configs),
back_inserter(source_terms), [&](auto& config) { back_inserter(source_terms), [&](auto const& config) {
return createSourceTerm(config, dof_table, config.mesh, return createSourceTerm(config, dof_table, config.mesh,
variable_id, integration_order, variable_id, integration_order,
_shapefunction_order, parameters); _shapefunction_order, parameters);
......
...@@ -86,7 +86,7 @@ std::unique_ptr<Process> createRichardsComponentTransportProcess( ...@@ -86,7 +86,7 @@ std::unique_ptr<Process> createRichardsComponentTransportProcess(
MaterialLib::Fluid::createFluidProperties(fluid_config); MaterialLib::Fluid::createFluidProperties(fluid_config);
// Parameter for the density of the fluid. // Parameter for the density of the fluid.
auto& fluid_reference_density = ParameterLib::findParameter<double>( auto const& fluid_reference_density = ParameterLib::findParameter<double>(
config, config,
//! \ogs_file_param_special{prj__processes__process__RichardsComponentTransport__fluid_reference_density} //! \ogs_file_param_special{prj__processes__process__RichardsComponentTransport__fluid_reference_density}
"fluid_reference_density", parameters, 1, &mesh); "fluid_reference_density", parameters, 1, &mesh);
......
...@@ -72,7 +72,7 @@ std::unique_ptr<Process> createSmallDeformationProcess( ...@@ -72,7 +72,7 @@ std::unique_ptr<Process> createSmallDeformationProcess(
parameters, local_coordinate_system, config); parameters, local_coordinate_system, config);
// Solid density // Solid density
auto& solid_density = ParameterLib::findParameter<double>( auto const& solid_density = ParameterLib::findParameter<double>(
config, config,
//! \ogs_file_param_special{prj__processes__process__SMALL_DEFORMATION__solid_density} //! \ogs_file_param_special{prj__processes__process__SMALL_DEFORMATION__solid_density}
"solid_density", parameters, 1, &mesh); "solid_density", parameters, 1, &mesh);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment