From 88426db960647ea4fc24c2efde6981bb9121a09f Mon Sep 17 00:00:00 2001 From: Dmitri Naumov <github@naumov.de> Date: Sat, 15 Apr 2017 19:15:16 +0200 Subject: [PATCH] Pass-by-value for arguments which are copied. This potentially saves a second copy compared to using const reference. See Effective Modern C++, Item 41. --- .../DataExplorer/Base/RecentFiles.cpp | 6 ++-- Applications/DataExplorer/Base/TreeItem.cpp | 6 ++-- Applications/DataExplorer/Base/TreeItem.h | 2 +- .../DataView/CondFromRasterDialog.cpp | 6 ++-- .../DataView/CondFromRasterDialog.h | 2 +- .../VtkVis/VtkAlgorithmPropertyCheckbox.cpp | 13 +++++---- .../VtkVis/VtkAlgorithmPropertyCheckbox.h | 2 +- .../VtkVis/VtkAlgorithmPropertyLineEdit.cpp | 19 +++++++----- .../VtkVis/VtkAlgorithmPropertyLineEdit.h | 2 +- .../VtkVis/VtkAlgorithmPropertyVectorEdit.cpp | 14 +++++---- .../VtkVis/VtkAlgorithmPropertyVectorEdit.h | 2 +- BaseLib/ConfigTree-impl.h | 3 +- BaseLib/ConfigTree.cpp | 15 ++++++---- BaseLib/ConfigTree.h | 15 +++++----- BaseLib/Histogram.h | 9 +++--- BaseLib/IO/XmlIO/Qt/XMLQtInterface.cpp | 6 ++-- BaseLib/IO/XmlIO/Qt/XMLQtInterface.h | 2 +- GeoLib/DuplicateGeometry.cpp | 10 +++---- GeoLib/DuplicateGeometry.h | 6 ++-- GeoLib/QuadTree.h | 29 ++++++++++++------- GeoLib/Raster.h | 9 ++++-- GeoLib/Station.cpp | 18 ++++++++---- GeoLib/Station.h | 4 +-- GeoLib/TemplateVec.h | 9 ++++-- .../Viscosity/VogelsLiquidDynamicViscosity.h | 9 +++--- .../FractureModels/LinearElasticIsotropic.h | 6 ++-- MaterialLib/FractureModels/MohrCoulomb.h | 7 ++--- MaterialLib/SolidModels/Ehlers.h | 10 +++---- .../SolidModels/LinearElasticIsotropic.h | 7 +++-- MaterialLib/SolidModels/Lubby2.h | 9 +++--- .../TwoPhaseFlowWithPPMaterialProperties.cpp | 3 +- MathLib/LinearFunction.h | 5 ++-- MathLib/TemplatePoint.h | 12 ++++---- MeshLib/IO/VtkIO/PVDFile.h | 6 +++- MeshLib/Mesh.cpp | 21 +++++++++----- MeshLib/Mesh.h | 8 +++-- MeshLib/PropertyVector.h | 10 ++++--- NumLib/DOF/ComponentGlobalIndexDict.h | 20 +++++++------ NumLib/Function/TemplateSpatialFunction.h | 6 ++-- NumLib/NamedFunction.h | 7 +++-- ...erationNumberBasedAdaptiveTimeStepping.cpp | 28 ++++++++++++------ ...IterationNumberBasedAdaptiveTimeStepping.h | 16 +++++----- ProcessLib/CachedSecondaryVariable.h | 14 +++++---- ProcessLib/HT/HTFEM.h | 8 +++-- ProcessLib/HT/HTProcessData.h | 5 ++-- .../HydroMechanicsProcessData.h | 6 ++-- .../HydroMechanicsProcessData.h | 14 +++++---- .../HydroMechanicsLocalAssemblerInterface.h | 12 ++++---- .../SmallDeformationLocalAssemblerInterface.h | 7 ++--- ProcessLib/Output.h | 6 ++-- ProcessLib/Parameter/ConstantParameter.h | 9 +++--- ProcessLib/Parameter/CurveScaledParameter.h | 5 ++-- ProcessLib/Parameter/GroupBasedParameter.h | 7 +++-- ProcessLib/Parameter/Parameter.h | 4 +-- .../TwoPhaseFlowWithPPLocalAssembler.h | 6 ++-- .../TwoPhaseFlowWithPPMaterialProperties.cpp | 3 +- ...TwoPhaseFlowWithPrhoMaterialProperties.cpp | 3 +- Tests/GeoLib/AutoCheckGenerators.h | 8 ++--- .../TestTimeSteppingIterationNumber.cpp | 8 +++-- 59 files changed, 311 insertions(+), 213 deletions(-) diff --git a/Applications/DataExplorer/Base/RecentFiles.cpp b/Applications/DataExplorer/Base/RecentFiles.cpp index feafc8a55ba..4865272e7a9 100644 --- a/Applications/DataExplorer/Base/RecentFiles.cpp +++ b/Applications/DataExplorer/Base/RecentFiles.cpp @@ -17,9 +17,11 @@ #include <QFileInfo> #include <QSettings> +#include <utility> -RecentFiles::RecentFiles( QObject* parent, const char* slot, QString settingsName) - : QObject(parent), _settingsName(settingsName) +RecentFiles::RecentFiles(QObject* parent, const char* slot, + QString settingsName) + : QObject(parent), _settingsName(std::move(settingsName)) { _filesMenu = new QMenu(tr("Recent files")); for (auto& _fileAction : _fileActions) diff --git a/Applications/DataExplorer/Base/TreeItem.cpp b/Applications/DataExplorer/Base/TreeItem.cpp index bbb88c8ba2a..67960c2f927 100644 --- a/Applications/DataExplorer/Base/TreeItem.cpp +++ b/Applications/DataExplorer/Base/TreeItem.cpp @@ -12,14 +12,16 @@ * */ +#include <utility> + #include "TreeItem.h" /** * The constructor is only used to record the item's parent * and the data associated with each column. */ -TreeItem::TreeItem(const QList<QVariant> &data, TreeItem* parent) -: _itemData(data), _parentItem(parent) +TreeItem::TreeItem(QList<QVariant> data, TreeItem* parent) + : _itemData(std::move(data)), _parentItem(parent) { } diff --git a/Applications/DataExplorer/Base/TreeItem.h b/Applications/DataExplorer/Base/TreeItem.h index 362c1789e19..6741e97bc1c 100644 --- a/Applications/DataExplorer/Base/TreeItem.h +++ b/Applications/DataExplorer/Base/TreeItem.h @@ -27,7 +27,7 @@ class TreeItem { public: - TreeItem(const QList<QVariant> &data, TreeItem* parent); + TreeItem(QList<QVariant> data, TreeItem* parent); virtual ~TreeItem(); void appendChild(TreeItem* child); diff --git a/Applications/DataExplorer/DataView/CondFromRasterDialog.cpp b/Applications/DataExplorer/DataView/CondFromRasterDialog.cpp index bc74da0480a..294dd5ded1b 100644 --- a/Applications/DataExplorer/DataView/CondFromRasterDialog.cpp +++ b/Applications/DataExplorer/DataView/CondFromRasterDialog.cpp @@ -17,13 +17,15 @@ #include <QFileDialog> #include <QSettings> +#include <utility> #include "DirectConditionGenerator.h" #include "OGSError.h" #include "StrictDoubleValidator.h" -CondFromRasterDialog::CondFromRasterDialog(const std::vector<MeshLib::Mesh*> &msh_vec, QDialog* parent) - : QDialog(parent), _msh_vec(msh_vec) +CondFromRasterDialog::CondFromRasterDialog(std::vector<MeshLib::Mesh*> msh_vec, + QDialog* parent) + : QDialog(parent), _msh_vec(std::move(msh_vec)) { setupUi(this); diff --git a/Applications/DataExplorer/DataView/CondFromRasterDialog.h b/Applications/DataExplorer/DataView/CondFromRasterDialog.h index ecf00fef0f5..9de5003574a 100644 --- a/Applications/DataExplorer/DataView/CondFromRasterDialog.h +++ b/Applications/DataExplorer/DataView/CondFromRasterDialog.h @@ -31,7 +31,7 @@ class CondFromRasterDialog : public QDialog, private Ui_CondFromRaster Q_OBJECT public: - CondFromRasterDialog(const std::vector<MeshLib::Mesh*>& msh_vec, + CondFromRasterDialog(std::vector<MeshLib::Mesh*> msh_vec, QDialog* parent = nullptr); ~CondFromRasterDialog(void); diff --git a/Applications/DataExplorer/VtkVis/VtkAlgorithmPropertyCheckbox.cpp b/Applications/DataExplorer/VtkVis/VtkAlgorithmPropertyCheckbox.cpp index 41673728d01..490728c3ecb 100644 --- a/Applications/DataExplorer/VtkVis/VtkAlgorithmPropertyCheckbox.cpp +++ b/Applications/DataExplorer/VtkVis/VtkAlgorithmPropertyCheckbox.cpp @@ -13,15 +13,18 @@ */ // ** INCLUDES ** +#include <utility> + #include "VtkAlgorithmPropertyCheckbox.h" #include "VtkAlgorithmProperties.h" -VtkAlgorithmPropertyCheckbox::VtkAlgorithmPropertyCheckbox(const bool value, - const QString& name, - VtkAlgorithmProperties* algProps, - QWidget* parent /*= 0*/ ) - : QCheckBox(parent), _name(name), _algProps(algProps) +VtkAlgorithmPropertyCheckbox::VtkAlgorithmPropertyCheckbox( + const bool value, + QString name, + VtkAlgorithmProperties* algProps, + QWidget* parent /*= 0*/) + : QCheckBox(parent), _name(std::move(name)), _algProps(algProps) { this->setChecked(value); connect(this, SIGNAL(stateChanged(int)), this, SLOT(setNewValue(int))); diff --git a/Applications/DataExplorer/VtkVis/VtkAlgorithmPropertyCheckbox.h b/Applications/DataExplorer/VtkVis/VtkAlgorithmPropertyCheckbox.h index 4272845776a..5d4026ca40a 100644 --- a/Applications/DataExplorer/VtkVis/VtkAlgorithmPropertyCheckbox.h +++ b/Applications/DataExplorer/VtkVis/VtkAlgorithmPropertyCheckbox.h @@ -30,7 +30,7 @@ public: /// @param name The name of the user property to set. /// @param algProps The VtkAlgorithmProperties object. /// @param parent The parent widget. - VtkAlgorithmPropertyCheckbox(const bool value, const QString& name, + VtkAlgorithmPropertyCheckbox(const bool value, QString name, VtkAlgorithmProperties* algProps, QWidget* parent = nullptr); diff --git a/Applications/DataExplorer/VtkVis/VtkAlgorithmPropertyLineEdit.cpp b/Applications/DataExplorer/VtkVis/VtkAlgorithmPropertyLineEdit.cpp index 28e5be08ac9..3877f75d24e 100644 --- a/Applications/DataExplorer/VtkVis/VtkAlgorithmPropertyLineEdit.cpp +++ b/Applications/DataExplorer/VtkVis/VtkAlgorithmPropertyLineEdit.cpp @@ -19,13 +19,18 @@ #include <QDoubleValidator> #include <QIntValidator> - -VtkAlgorithmPropertyLineEdit::VtkAlgorithmPropertyLineEdit(const QString& contents, - const QString& name, - QVariant::Type type, - VtkAlgorithmProperties* algProps, - QWidget* parent /*= 0*/) - : QLineEdit(contents, parent), _name(name), _algProps(algProps), _type(type) +#include <utility> + +VtkAlgorithmPropertyLineEdit::VtkAlgorithmPropertyLineEdit( + const QString& contents, + QString name, + QVariant::Type type, + VtkAlgorithmProperties* algProps, + QWidget* parent /*= 0*/) + : QLineEdit(contents, parent), + _name(std::move(name)), + _algProps(algProps), + _type(type) { switch(_type) { diff --git a/Applications/DataExplorer/VtkVis/VtkAlgorithmPropertyLineEdit.h b/Applications/DataExplorer/VtkVis/VtkAlgorithmPropertyLineEdit.h index 9a7da243688..b628d77f3c1 100644 --- a/Applications/DataExplorer/VtkVis/VtkAlgorithmPropertyLineEdit.h +++ b/Applications/DataExplorer/VtkVis/VtkAlgorithmPropertyLineEdit.h @@ -34,7 +34,7 @@ public: /// @param algProps The VtkAlgorithmProperties object. /// @param parent The parent widget. VtkAlgorithmPropertyLineEdit(const QString& contents, - const QString& name, + QString name, QVariant::Type type, VtkAlgorithmProperties* algProps, QWidget* parent = nullptr); diff --git a/Applications/DataExplorer/VtkVis/VtkAlgorithmPropertyVectorEdit.cpp b/Applications/DataExplorer/VtkVis/VtkAlgorithmPropertyVectorEdit.cpp index b2840e4d704..b278a4b4ca5 100644 --- a/Applications/DataExplorer/VtkVis/VtkAlgorithmPropertyVectorEdit.cpp +++ b/Applications/DataExplorer/VtkVis/VtkAlgorithmPropertyVectorEdit.cpp @@ -22,13 +22,15 @@ #include <QIntValidator> #include <QLineEdit> #include <QSize> +#include <utility> -VtkAlgorithmPropertyVectorEdit::VtkAlgorithmPropertyVectorEdit( const QList<QString> contents, - const QString& name, - QVariant::Type type, - VtkAlgorithmProperties* algProps, - QWidget* parent /*= 0*/ ) - : QWidget(parent), _name(name), _algProps(algProps), _type(type) +VtkAlgorithmPropertyVectorEdit::VtkAlgorithmPropertyVectorEdit( + const QList<QString> contents, + QString name, + QVariant::Type type, + VtkAlgorithmProperties* algProps, + QWidget* parent /*= 0*/) + : QWidget(parent), _name(std::move(name)), _algProps(algProps), _type(type) { auto* layout = new QHBoxLayout; layout->setSpacing(3); diff --git a/Applications/DataExplorer/VtkVis/VtkAlgorithmPropertyVectorEdit.h b/Applications/DataExplorer/VtkVis/VtkAlgorithmPropertyVectorEdit.h index 209f02242c5..9242c3ebfd6 100644 --- a/Applications/DataExplorer/VtkVis/VtkAlgorithmPropertyVectorEdit.h +++ b/Applications/DataExplorer/VtkVis/VtkAlgorithmPropertyVectorEdit.h @@ -34,7 +34,7 @@ public: /// @param algProps The VtkAlgorithmProperties object. /// @param parent The parent widget. VtkAlgorithmPropertyVectorEdit(const QList<QString> contents, - const QString& name, + QString name, QVariant::Type type, VtkAlgorithmProperties* algProps, QWidget* parent = nullptr); diff --git a/BaseLib/ConfigTree-impl.h b/BaseLib/ConfigTree-impl.h index 4a51a7cda12..79cdcf73e7e 100644 --- a/BaseLib/ConfigTree-impl.h +++ b/BaseLib/ConfigTree-impl.h @@ -10,6 +10,7 @@ #include "ConfigTree.h" #include <sstream> +#include <utility> namespace BaseLib { @@ -20,7 +21,7 @@ class Range { public: explicit Range(Iterator begin, Iterator end) - : _begin(begin), _end(end) + : _begin(std::move(begin)), _end(std::move(end)) {} Iterator begin() const { return _begin; } diff --git a/BaseLib/ConfigTree.cpp b/BaseLib/ConfigTree.cpp index db7c849e4d2..e287b015142 100644 --- a/BaseLib/ConfigTree.cpp +++ b/BaseLib/ConfigTree.cpp @@ -11,6 +11,7 @@ #include <forward_list> #include <logog/include/logog.hpp> +#include <utility> #include "Error.h" @@ -30,12 +31,14 @@ const char ConfigTree::pathseparator = '/'; const std::string ConfigTree::key_chars_start = "abcdefghijklmnopqrstuvwxyz"; const std::string ConfigTree::key_chars = key_chars_start + "_0123456789"; -ConfigTree:: -ConfigTree(PTree const& tree, - std::string const& filename, - Callback const& error_cb, - Callback const& warning_cb) - : _tree(&tree), _filename(filename), _onerror(error_cb), _onwarning(warning_cb) +ConfigTree::ConfigTree(PTree const& tree, + std::string filename, + Callback error_cb, + Callback warning_cb) + : _tree(&tree), + _filename(std::move(filename)), + _onerror(std::move(error_cb)), + _onwarning(std::move(warning_cb)) { if (!_onerror) { OGS_FATAL("ConfigTree: No valid error handler provided."); diff --git a/BaseLib/ConfigTree.h b/BaseLib/ConfigTree.h index 8f8bcc20fb0..90d40954287 100644 --- a/BaseLib/ConfigTree.h +++ b/BaseLib/ConfigTree.h @@ -14,6 +14,7 @@ #include <functional> #include <memory> +#include <utility> #include <vector> #include <boost/property_tree/ptree.hpp> @@ -105,9 +106,9 @@ public: public: using Iterator = boost::property_tree::ptree::const_assoc_iterator; - explicit SubtreeIterator(Iterator it, std::string const& root, + explicit SubtreeIterator(Iterator it, std::string root, ConfigTree const& parent) - : _it(it), _tagname(root), _parent(parent) + : _it(it), _tagname(std::move(root)), _parent(parent) {} SubtreeIterator& operator++() { @@ -189,9 +190,9 @@ public: public: using Iterator = boost::property_tree::ptree::const_assoc_iterator; - explicit ValueIterator(Iterator it, std::string const& root, + explicit ValueIterator(Iterator it, std::string root, ConfigTree const& parent) - : _it(it), _tagname(root), _parent(parent) + : _it(it), _tagname(std::move(root)), _parent(parent) {} ValueIterator<ValueType>& operator++() { @@ -255,9 +256,9 @@ public: * i.e., warnings will also result in program abortion! */ explicit ConfigTree(PTree const& tree, - std::string const& filename, - Callback const& error_cb, - Callback const& warning_cb); + std::string filename, + Callback error_cb, + Callback warning_cb); /*! This constructor is deleted in order to prevent the user from passing * temporary instances of \c PTree. diff --git a/BaseLib/Histogram.h b/BaseLib/Histogram.h index 3b7780bff41..6d4aa8783c8 100644 --- a/BaseLib/Histogram.h +++ b/BaseLib/Histogram.h @@ -14,9 +14,10 @@ #include <algorithm> #include <cmath> -#include <iterator> -#include <iosfwd> #include <fstream> +#include <iosfwd> +#include <iterator> +#include <utility> #include <vector> #include <logog/include/logog.hpp> @@ -59,9 +60,9 @@ public: * \param computeHistogram Compute histogram if set. If not set user must call * \c update() before accessing data. */ - Histogram(std::vector<T> const& data, const unsigned int nr_bins = 16, + Histogram(std::vector<T> data, const unsigned int nr_bins = 16, const bool computeHistogram = true) - : _data(data), _nr_bins(nr_bins) + : _data(std::move(data)), _nr_bins(nr_bins) { init(computeHistogram); } diff --git a/BaseLib/IO/XmlIO/Qt/XMLQtInterface.cpp b/BaseLib/IO/XmlIO/Qt/XMLQtInterface.cpp index 7661895544a..4fa8ed79033 100644 --- a/BaseLib/IO/XmlIO/Qt/XMLQtInterface.cpp +++ b/BaseLib/IO/XmlIO/Qt/XMLQtInterface.cpp @@ -23,14 +23,14 @@ #include <QCryptographicHash> #include <logog/include/logog.hpp> +#include <utility> namespace BaseLib { namespace IO { - -XMLQtInterface::XMLQtInterface(const std::string &schemaFile) : - _schemaName(schemaFile) +XMLQtInterface::XMLQtInterface(std::string schemaFile) + : _schemaName(std::move(schemaFile)) {} int XMLQtInterface::readFile(const QString &fileName) diff --git a/BaseLib/IO/XmlIO/Qt/XMLQtInterface.h b/BaseLib/IO/XmlIO/Qt/XMLQtInterface.h index d941114cf0e..7c21fcf9ac0 100644 --- a/BaseLib/IO/XmlIO/Qt/XMLQtInterface.h +++ b/BaseLib/IO/XmlIO/Qt/XMLQtInterface.h @@ -30,7 +30,7 @@ namespace IO class XMLQtInterface { public: - XMLQtInterface(const std::string &schemaFile = ""); + XMLQtInterface(std::string schemaFile = ""); virtual ~XMLQtInterface() = default; /// As QXMLStreamWriter seems currently unable to include style-file links into xml-files, this method will workaround this issue and include the stylefile link. diff --git a/GeoLib/DuplicateGeometry.cpp b/GeoLib/DuplicateGeometry.cpp index 1240c8b23b9..8ea38744140 100644 --- a/GeoLib/DuplicateGeometry.cpp +++ b/GeoLib/DuplicateGeometry.cpp @@ -10,6 +10,7 @@ #include "DuplicateGeometry.h" #include <logog/include/logog.hpp> +#include <utility> #include "GeoLib/GEOObjects.h" #include "GeoLib/Point.h" @@ -20,11 +21,10 @@ namespace GeoLib { - -DuplicateGeometry::DuplicateGeometry(GeoLib::GEOObjects &geo_objects, - std::string const& input_name, - std::string const& output_name) -: _output_name(output_name), _geo_objects(geo_objects) +DuplicateGeometry::DuplicateGeometry(GeoLib::GEOObjects& geo_objects, + std::string const& input_name, + std::string output_name) + : _output_name(std::move(output_name)), _geo_objects(geo_objects) { duplicate(input_name); } diff --git a/GeoLib/DuplicateGeometry.h b/GeoLib/DuplicateGeometry.h index 820f09a3df5..7550f033764 100644 --- a/GeoLib/DuplicateGeometry.h +++ b/GeoLib/DuplicateGeometry.h @@ -33,9 +33,9 @@ public: * \param input_name The geometry to be copied * \param output_name The name of the copy (note: this might be modified by GEOObjects) */ - DuplicateGeometry(GeoLib::GEOObjects &geo_objects, - std::string const& input_name, - std::string const& output_name); + DuplicateGeometry(GeoLib::GEOObjects& geo_objects, + std::string const& input_name, + std::string output_name); // Returns the (possibly modified) output name of the new geometry. std::string const& getFinalizedOutputName() const { return _output_name; } diff --git a/GeoLib/QuadTree.h b/GeoLib/QuadTree.h index 7b9878635d7..d5132cbb9f5 100644 --- a/GeoLib/QuadTree.h +++ b/GeoLib/QuadTree.h @@ -17,6 +17,7 @@ #include <limits> #include <logog/include/logog.hpp> +#include <utility> namespace GeoLib { @@ -47,9 +48,13 @@ public: * @param ur upper right point of the square * @param max_points_per_leaf maximum number of points per leaf */ - QuadTree(POINT const& ll, POINT const& ur, std::size_t max_points_per_leaf) : - _father (nullptr), _ll (ll), _ur (ur), _depth (0), _is_leaf (true), - _max_points_per_leaf (max_points_per_leaf) + QuadTree(POINT ll, POINT ur, std::size_t max_points_per_leaf) + : _father(nullptr), + _ll(std::move(ll)), + _ur(std::move(ur)), + _depth(0), + _is_leaf(true), + _max_points_per_leaf(max_points_per_leaf) { assert (_max_points_per_leaf > 0); @@ -368,13 +373,17 @@ private: * @param max_points_per_leaf maximum number of points per leaf * @return */ - QuadTree (POINT const& ll, - POINT const& ur, - QuadTree* father, - std::size_t depth, - std::size_t max_points_per_leaf) : - _father (father), _ll (ll), _ur (ur), _depth (depth), _is_leaf (true), - _max_points_per_leaf (max_points_per_leaf) + QuadTree(POINT ll, + POINT ur, + QuadTree* father, + std::size_t depth, + std::size_t max_points_per_leaf) + : _father(father), + _ll(std::move(ll)), + _ur(std::move(ur)), + _depth(depth), + _is_leaf(true), + _max_points_per_leaf(max_points_per_leaf) { // init children for (auto& k : _children) diff --git a/GeoLib/Raster.h b/GeoLib/Raster.h index 386ab2ecb59..beb70ec56c3 100644 --- a/GeoLib/Raster.h +++ b/GeoLib/Raster.h @@ -13,6 +13,8 @@ #pragma once +#include <utility> + #include "Surface.h" namespace GeoLib { @@ -49,9 +51,10 @@ public: * @param begin input iterator pointing to the first element of the data * @param end input iterator pointing to the last element of the data, end have to be reachable from begin */ - template<typename InputIterator> - Raster(RasterHeader header, InputIterator begin, InputIterator end) : - _header(header), _raster_data(new double[_header.n_cols*_header.n_rows]) + template <typename InputIterator> + Raster(RasterHeader header, InputIterator begin, InputIterator end) + : _header(std::move(header)), + _raster_data(new double[_header.n_cols * _header.n_rows]) { iterator raster_it(_raster_data); for (InputIterator it(begin); it != end; ++it) { diff --git a/GeoLib/Station.cpp b/GeoLib/Station.cpp index acfee0f1ece..27332304b9d 100644 --- a/GeoLib/Station.cpp +++ b/GeoLib/Station.cpp @@ -23,14 +23,20 @@ namespace GeoLib { -Station::Station(double x, double y, double z, std::string const& name) : - Point (x,y,z), _name(name), _type(Station::StationType::STATION), - _station_value(0.0), _sensor_data(nullptr) +Station::Station(double x, double y, double z, std::string name) + : Point(x, y, z), + _name(std::move(name)), + _type(Station::StationType::STATION), + _station_value(0.0), + _sensor_data(nullptr) {} -Station::Station(Point* coords, std::string const& name) : - Point (*coords), _name(name), _type(Station::StationType::STATION), - _station_value(0.0), _sensor_data(nullptr) +Station::Station(Point* coords, std::string name) + : Point(*coords), + _name(std::move(name)), + _type(Station::StationType::STATION), + _station_value(0.0), + _sensor_data(nullptr) {} Station::Station(Station const& src) : diff --git a/GeoLib/Station.h b/GeoLib/Station.h index adca976c61b..aa131162090 100644 --- a/GeoLib/Station.h +++ b/GeoLib/Station.h @@ -55,9 +55,9 @@ public: Station(double x = 0.0, double y = 0.0, double z = 0.0, - std::string const& name = ""); + std::string name = ""); - Station(Point* coords, std::string const& name = ""); + Station(Point* coords, std::string name = ""); /** * Constructor copies the source object diff --git a/GeoLib/TemplateVec.h b/GeoLib/TemplateVec.h index 36a0ba2ab4c..81cd5ea02d2 100644 --- a/GeoLib/TemplateVec.h +++ b/GeoLib/TemplateVec.h @@ -20,6 +20,7 @@ #include <map> #include <memory> #include <string> +#include <utility> #include <vector> #include <logog/include/logog.hpp> @@ -55,9 +56,11 @@ public: * of the element and the value for std::size_t stands for an index in * the data_vec. */ - TemplateVec (const std::string &name, std::unique_ptr<std::vector<T*>> data_vec, - NameIdMap* elem_name_map = nullptr) : - _name(name), _data_vec(std::move(data_vec)), _name_id_map (elem_name_map) + TemplateVec(std::string name, std::unique_ptr<std::vector<T*>> data_vec, + NameIdMap* elem_name_map = nullptr) + : _name(std::move(name)), + _data_vec(std::move(data_vec)), + _name_id_map(elem_name_map) { if (_data_vec == nullptr) { diff --git a/MaterialLib/Fluid/Viscosity/VogelsLiquidDynamicViscosity.h b/MaterialLib/Fluid/Viscosity/VogelsLiquidDynamicViscosity.h index ed94b0fb825..14865299bf6 100644 --- a/MaterialLib/Fluid/Viscosity/VogelsLiquidDynamicViscosity.h +++ b/MaterialLib/Fluid/Viscosity/VogelsLiquidDynamicViscosity.h @@ -13,10 +13,11 @@ #pragma once -#include <string> -#include <vector> #include <array> #include <cmath> +#include <string> +#include <utility> +#include <vector> #include "MaterialLib/Fluid/FluidProperty.h" @@ -37,8 +38,8 @@ public: * \param constants Constants of the fluid. * */ - explicit VogelsLiquidDynamicViscosity(const VogelsConstants& constants) - : _constants(constants) + explicit VogelsLiquidDynamicViscosity(VogelsConstants constants) + : _constants(std::move(constants)) { } diff --git a/MaterialLib/FractureModels/LinearElasticIsotropic.h b/MaterialLib/FractureModels/LinearElasticIsotropic.h index 7c44ede3f58..2bc3037dac0 100644 --- a/MaterialLib/FractureModels/LinearElasticIsotropic.h +++ b/MaterialLib/FractureModels/LinearElasticIsotropic.h @@ -10,6 +10,7 @@ #pragma once #include <Eigen/Eigen> +#include <utility> #include "ProcessLib/Parameter/Parameter.h" @@ -55,9 +56,8 @@ public: } public: - explicit LinearElasticIsotropic( - MaterialProperties const& material_properties) - : _mp(material_properties) + explicit LinearElasticIsotropic(MaterialProperties material_properties) + : _mp(std::move(material_properties)) { } diff --git a/MaterialLib/FractureModels/MohrCoulomb.h b/MaterialLib/FractureModels/MohrCoulomb.h index a16744bd5ac..e2a8c1b2308 100644 --- a/MaterialLib/FractureModels/MohrCoulomb.h +++ b/MaterialLib/FractureModels/MohrCoulomb.h @@ -10,6 +10,7 @@ #pragma once #include <Eigen/Eigen> +#include <utility> #include "ProcessLib/Parameter/Parameter.h" @@ -64,10 +65,8 @@ public: } public: - - explicit MohrCoulomb( - MaterialProperties const& material_properties) - : _mp(material_properties) + explicit MohrCoulomb(MaterialProperties material_properties) + : _mp(std::move(material_properties)) { } diff --git a/MaterialLib/SolidModels/Ehlers.h b/MaterialLib/SolidModels/Ehlers.h index 3cac0f7dc67..9b5d9145312 100644 --- a/MaterialLib/SolidModels/Ehlers.h +++ b/MaterialLib/SolidModels/Ehlers.h @@ -27,6 +27,7 @@ #include <Eigen/Dense> #include <logog/include/logog.hpp> +#include <utility> #include "BaseLib/Error.h" #include "NumLib/NewtonRaphson.h" @@ -210,12 +211,11 @@ public: public: explicit SolidEhlers( - NumLib::NewtonRaphsonSolverParameters const& - nonlinear_solver_parameters, - MaterialProperties const& material_properties, + NumLib::NewtonRaphsonSolverParameters nonlinear_solver_parameters, + MaterialProperties material_properties, std::unique_ptr<EhlersDamageProperties>&& damage_properties) - : _nonlinear_solver_parameters(nonlinear_solver_parameters), - _mp(material_properties), + : _nonlinear_solver_parameters(std::move(nonlinear_solver_parameters)), + _mp(std::move(material_properties)), _damage_properties(std::move(damage_properties)) { } diff --git a/MaterialLib/SolidModels/LinearElasticIsotropic.h b/MaterialLib/SolidModels/LinearElasticIsotropic.h index 3342eb0b438..9e6357f40f7 100644 --- a/MaterialLib/SolidModels/LinearElasticIsotropic.h +++ b/MaterialLib/SolidModels/LinearElasticIsotropic.h @@ -9,6 +9,8 @@ #pragma once +#include <utility> + #include "MechanicsBase.h" namespace MaterialLib @@ -72,9 +74,8 @@ public: using KelvinVector = ProcessLib::KelvinVectorType<DisplacementDim>; using KelvinMatrix = ProcessLib::KelvinMatrixType<DisplacementDim>; - explicit LinearElasticIsotropic( - MaterialProperties const& material_properties) - : _mp(material_properties) + explicit LinearElasticIsotropic(MaterialProperties material_properties) + : _mp(std::move(material_properties)) { } diff --git a/MaterialLib/SolidModels/Lubby2.h b/MaterialLib/SolidModels/Lubby2.h index a53392f25fb..6ec6d0cdb91 100644 --- a/MaterialLib/SolidModels/Lubby2.h +++ b/MaterialLib/SolidModels/Lubby2.h @@ -10,6 +10,7 @@ #pragma once #include <logog/include/logog.hpp> +#include <utility> #include "BaseLib/Error.h" #include "NumLib/NewtonRaphson.h" @@ -166,10 +167,10 @@ public: Eigen::RowMajor>; public: - explicit Lubby2(NumLib::NewtonRaphsonSolverParameters const& - nonlinear_solver_parameters, - Lubby2MaterialProperties& material_properties) - : _nonlinear_solver_parameters(nonlinear_solver_parameters), + explicit Lubby2( + NumLib::NewtonRaphsonSolverParameters nonlinear_solver_parameters, + Lubby2MaterialProperties& material_properties) + : _nonlinear_solver_parameters(std::move(nonlinear_solver_parameters)), _mp(material_properties) { } diff --git a/MaterialLib/TwoPhaseModels/TwoPhaseFlowWithPPMaterialProperties.cpp b/MaterialLib/TwoPhaseModels/TwoPhaseFlowWithPPMaterialProperties.cpp index 15bc7631967..0b4c981f926 100644 --- a/MaterialLib/TwoPhaseModels/TwoPhaseFlowWithPPMaterialProperties.cpp +++ b/MaterialLib/TwoPhaseModels/TwoPhaseFlowWithPPMaterialProperties.cpp @@ -9,6 +9,7 @@ #include "TwoPhaseFlowWithPPMaterialProperties.h" #include <logog/include/logog.hpp> +#include <utility> #include "BaseLib/reorderVector.h" #include "MaterialLib/Fluid/FluidProperty.h" #include "MaterialLib/PorousMedium/Porosity/Porosity.h" @@ -46,7 +47,7 @@ TwoPhaseFlowWithPPMaterialProperties::TwoPhaseFlowWithPPMaterialProperties( _gas_density(std::move(gas_density)), _gas_viscosity(std::move(gas_viscosity)), _material_ids(material_ids), - _intrinsic_permeability_models(intrinsic_permeability_models), + _intrinsic_permeability_models(std::move(intrinsic_permeability_models)), _porosity_models(std::move(porosity_models)), _storage_models(std::move(storage_models)) { diff --git a/MathLib/LinearFunction.h b/MathLib/LinearFunction.h index 1d5b593fc20..be6a25d58bc 100644 --- a/MathLib/LinearFunction.h +++ b/MathLib/LinearFunction.h @@ -14,6 +14,7 @@ #include <array> #include <numeric> +#include <utility> namespace MathLib { @@ -36,8 +37,8 @@ public: * \param coefficients an array of coefficients of a linear function. * The size of the coefficient array should equal to the number of variables + 1 */ - explicit LinearFunction(const std::array<T_TYPE, N_VARS+1> &coefficients) - : _coefficients(coefficients) + explicit LinearFunction(std::array<T_TYPE, N_VARS + 1> coefficients) + : _coefficients(std::move(coefficients)) {} /** diff --git a/MathLib/TemplatePoint.h b/MathLib/TemplatePoint.h index 92bc97d107f..9b3656164cb 100644 --- a/MathLib/TemplatePoint.h +++ b/MathLib/TemplatePoint.h @@ -15,12 +15,13 @@ #pragma once // STL -#include <array> #include <algorithm> +#include <array> +#include <cassert> #include <cmath> -#include <iterator> #include <istream> -#include <cassert> +#include <iterator> +#include <utility> namespace MathLib { @@ -42,7 +43,7 @@ public: * * @param x std::array containing the coordinates of the point */ - explicit TemplatePoint(std::array<T,DIM> const& x); + explicit TemplatePoint(std::array<T, DIM> x); /** virtual destructor */ virtual ~TemplatePoint() = default; @@ -100,8 +101,7 @@ TemplatePoint<T,DIM>::TemplatePoint() : {} template <typename T, std::size_t DIM> -TemplatePoint<T,DIM>::TemplatePoint(std::array<T,DIM> const& x) : - _x(x) +TemplatePoint<T, DIM>::TemplatePoint(std::array<T, DIM> x) : _x(std::move(x)) {} /** Equality of TemplatePoint's up to an epsilon. diff --git a/MeshLib/IO/VtkIO/PVDFile.h b/MeshLib/IO/VtkIO/PVDFile.h index 1e7e30ea278..e0a7b8bdea8 100644 --- a/MeshLib/IO/VtkIO/PVDFile.h +++ b/MeshLib/IO/VtkIO/PVDFile.h @@ -10,6 +10,7 @@ #pragma once #include <string> +#include <utility> #include <vector> namespace MeshLib @@ -24,7 +25,10 @@ class PVDFile { public: //! Set a PVD file path - explicit PVDFile(std::string const& pvd_fname) : _pvd_filename(pvd_fname) {} + explicit PVDFile(std::string pvd_fname) + : _pvd_filename(std::move(pvd_fname)) + { + } //! Add a VTU file to this PVD file. void addVTUFile(std::string const& vtu_fname, double timestep); diff --git a/MeshLib/Mesh.cpp b/MeshLib/Mesh.cpp index 542d01a96fb..30747ef6139 100644 --- a/MeshLib/Mesh.cpp +++ b/MeshLib/Mesh.cpp @@ -15,6 +15,7 @@ #include "Mesh.h" #include <memory> +#include <utility> #include "BaseLib/RunTime.h" @@ -28,23 +29,27 @@ namespace MeshLib { - -Mesh::Mesh(const std::string &name, - const std::vector<Node*> &nodes, - const std::vector<Element*> &elements, +Mesh::Mesh(std::string name, + std::vector<Node*> + nodes, + std::vector<Element*> + elements, Properties const& properties, const std::size_t n_base_nodes) - : _id(_counter_value-1), _mesh_dimension(0), + : _id(_counter_value - 1), + _mesh_dimension(0), _edge_length(std::numeric_limits<double>::max(), 0), _node_distance(std::numeric_limits<double>::max(), 0), - _name(name), _nodes(nodes), _elements(elements), + _name(std::move(name)), + _nodes(std::move(nodes)), + _elements(std::move(elements)), _n_base_nodes(n_base_nodes), _properties(properties) { - assert(n_base_nodes <= nodes.size()); + assert(_n_base_nodes <= _nodes.size()); this->resetNodeIDs(); this->resetElementIDs(); - if ((n_base_nodes==0 && hasNonlinearElement()) || isNonlinear()) + if ((_n_base_nodes == 0 && hasNonlinearElement()) || isNonlinear()) this->checkNonlinearNodeIDs(); this->setDimension(); this->setElementsConnectedToNodes(); diff --git a/MeshLib/Mesh.h b/MeshLib/Mesh.h index 2d7f63ca0db..6f26b61c0de 100644 --- a/MeshLib/Mesh.h +++ b/MeshLib/Mesh.h @@ -56,9 +56,11 @@ public: /// parameter for nonlinear case. If the parameter is /// set to zero, we consider there are no nonlinear /// nodes. - Mesh(const std::string &name, - const std::vector<Node*> &nodes, - const std::vector<Element*> &elements, + Mesh(std::string name, + std::vector<Node*> + nodes, + std::vector<Element*> + elements, Properties const& properties = Properties(), const std::size_t n_base_nodes = 0); diff --git a/MeshLib/PropertyVector.h b/MeshLib/PropertyVector.h index fc3de6dddfb..3b33ab3e68f 100644 --- a/MeshLib/PropertyVector.h +++ b/MeshLib/PropertyVector.h @@ -14,6 +14,7 @@ #include <iterator> #include <ostream> #include <string> +#include <utility> #include <vector> #include "BaseLib/Error.h" @@ -35,12 +36,12 @@ public: std::size_t getNumberOfComponents() const { return _n_components; } protected: - PropertyVectorBase(std::string const& property_name, + PropertyVectorBase(std::string property_name, MeshItemType mesh_item_type, std::size_t n_components) : _n_components(n_components), _mesh_item_type(mesh_item_type), - _property_name(property_name) + _property_name(std::move(property_name)) {} std::size_t const _n_components; @@ -254,11 +255,12 @@ protected: /// nodes or cells (see enumeration MeshItemType) /// @param n_components the number of elements of a tuple PropertyVector(std::size_t n_prop_groups, - std::vector<std::size_t> const& item2group_mapping, + std::vector<std::size_t> + item2group_mapping, std::string const& property_name, MeshItemType mesh_item_type, std::size_t n_components) - : std::vector<std::size_t>(item2group_mapping), + : std::vector<std::size_t>(std::move(item2group_mapping)), PropertyVectorBase(property_name, mesh_item_type, n_components), _values(n_prop_groups * n_components) {} diff --git a/NumLib/DOF/ComponentGlobalIndexDict.h b/NumLib/DOF/ComponentGlobalIndexDict.h index e844601c7e2..ba7644b7adc 100644 --- a/NumLib/DOF/ComponentGlobalIndexDict.h +++ b/NumLib/DOF/ComponentGlobalIndexDict.h @@ -18,6 +18,7 @@ #include <boost/multi_index/member.hpp> #include <boost/multi_index/ordered_index.hpp> #include <boost/multi_index_container.hpp> +#include <utility> #include "MeshLib/Location.h" #include "NumLib/NumericsConfig.h" @@ -39,19 +40,20 @@ struct Line // Position in global matrix or vector GlobalIndexType global_index; - Line(MeshLib::Location const& l, std::size_t c, GlobalIndexType i) - : location(l), comp_id(c), global_index(i) + Line(MeshLib::Location l, std::size_t c, GlobalIndexType i) + : location(std::move(l)), comp_id(c), global_index(i) {} - Line(MeshLib::Location const& l, std::size_t c) - : location(l), comp_id(c), - global_index(std::numeric_limits<GlobalIndexType>::max()) + Line(MeshLib::Location l, std::size_t c) + : location(std::move(l)), + comp_id(c), + global_index(std::numeric_limits<GlobalIndexType>::max()) {} - explicit Line(MeshLib::Location const& l) - : location(l), - comp_id(std::numeric_limits<std::size_t>::max()), - global_index(std::numeric_limits<GlobalIndexType>::max()) + explicit Line(MeshLib::Location l) + : location(std::move(l)), + comp_id(std::numeric_limits<std::size_t>::max()), + global_index(std::numeric_limits<GlobalIndexType>::max()) {} friend std::ostream& operator<<(std::ostream& os, Line const& l) diff --git a/NumLib/Function/TemplateSpatialFunction.h b/NumLib/Function/TemplateSpatialFunction.h index 8b372e1d643..4f640cb5cc4 100644 --- a/NumLib/Function/TemplateSpatialFunction.h +++ b/NumLib/Function/TemplateSpatialFunction.h @@ -12,6 +12,8 @@ #pragma once +#include <utility> + #include "ISpatialFunction.h" namespace NumLib @@ -30,9 +32,7 @@ public: * Constructor * @param f a function object */ - TemplateSpatialFunction(const T_FUNCTION &f) - : _f(f) {} - + TemplateSpatialFunction(T_FUNCTION f) : _f(std::move(f)) {} /** * evaluate a function * @param pnt a point object diff --git a/NumLib/NamedFunction.h b/NumLib/NamedFunction.h index bea46bac736..a8771d1e53f 100644 --- a/NumLib/NamedFunction.h +++ b/NumLib/NamedFunction.h @@ -14,6 +14,7 @@ #include <memory> #include <string> #include <type_traits> +#include <utility> #include <vector> namespace detail @@ -57,7 +58,7 @@ public: * \param function the actual function object */ template <typename ReturnType, typename... Arguments> - NamedFunction(std::string const& name, + NamedFunction(std::string name, std::vector<std::string>&& argument_names, std::function<ReturnType(Arguments...)>&& function); @@ -92,10 +93,10 @@ private: }; template <typename ReturnType, typename... Arguments> -NamedFunction::NamedFunction(std::string const& name, +NamedFunction::NamedFunction(std::string name, std::vector<std::string>&& argument_names, std::function<ReturnType(Arguments...)>&& function) - : _name(name), + : _name(std::move(name)), _argument_names(std::move(argument_names)), _function( new std::function<ReturnType(Arguments...)>(std::move(function))) diff --git a/NumLib/TimeStepping/Algorithms/IterationNumberBasedAdaptiveTimeStepping.cpp b/NumLib/TimeStepping/Algorithms/IterationNumberBasedAdaptiveTimeStepping.cpp index e41318cf79a..d6e27d960e3 100644 --- a/NumLib/TimeStepping/Algorithms/IterationNumberBasedAdaptiveTimeStepping.cpp +++ b/NumLib/TimeStepping/Algorithms/IterationNumberBasedAdaptiveTimeStepping.cpp @@ -11,21 +11,31 @@ #include "IterationNumberBasedAdaptiveTimeStepping.h" -#include <limits> #include <algorithm> #include <cassert> #include <cmath> +#include <limits> +#include <utility> namespace NumLib { - -IterationNumberBasedAdaptiveTimeStepping::IterationNumberBasedAdaptiveTimeStepping(double t0, double tn, - double min_ts, double max_ts, double initial_ts, - const std::vector<std::size_t> &iter_times_vector, - const std::vector<double> &multiplier_vector) -: _t_initial(t0), _t_end(tn), _iter_times_vector(iter_times_vector), _multiplier_vector(multiplier_vector), - _min_ts(min_ts), _max_ts(max_ts), _initial_ts(initial_ts), _max_iter(_iter_times_vector.empty() ? 0 : _iter_times_vector.back()), - _iter_times(0), _ts_pre(t0), _ts_current(t0), _n_rejected_steps(0) +IterationNumberBasedAdaptiveTimeStepping:: + IterationNumberBasedAdaptiveTimeStepping( + double t0, double tn, double min_ts, double max_ts, double initial_ts, + std::vector<std::size_t> iter_times_vector, + std::vector<double> multiplier_vector) + : _t_initial(t0), + _t_end(tn), + _iter_times_vector(std::move(iter_times_vector)), + _multiplier_vector(std::move(multiplier_vector)), + _min_ts(min_ts), + _max_ts(max_ts), + _initial_ts(initial_ts), + _max_iter(_iter_times_vector.empty() ? 0 : _iter_times_vector.back()), + _iter_times(0), + _ts_pre(t0), + _ts_current(t0), + _n_rejected_steps(0) { assert(iter_times_vector.size() == multiplier_vector.size()); } diff --git a/NumLib/TimeStepping/Algorithms/IterationNumberBasedAdaptiveTimeStepping.h b/NumLib/TimeStepping/Algorithms/IterationNumberBasedAdaptiveTimeStepping.h index 4ff96ac9a98..b0c20f7e380 100644 --- a/NumLib/TimeStepping/Algorithms/IterationNumberBasedAdaptiveTimeStepping.h +++ b/NumLib/TimeStepping/Algorithms/IterationNumberBasedAdaptiveTimeStepping.h @@ -74,13 +74,15 @@ public: * (\f$a_1\f$, \f$a_2\f$, ..., \f$a_n\f$) corresponding to the intervals given by iter_times_vector. * A time step size is calculated by \f$\Delta t_{n+1} = a * \Delta t_{n}\f$ */ - IterationNumberBasedAdaptiveTimeStepping( double t_initial, - double t_end, - double min_ts, - double max_ts, - double initial_ts, - const std::vector<std::size_t> &iter_times_vector, - const std::vector<double> &multiplier_vector); + IterationNumberBasedAdaptiveTimeStepping(double t_initial, + double t_end, + double min_ts, + double max_ts, + double initial_ts, + std::vector<std::size_t> + iter_times_vector, + std::vector<double> + multiplier_vector); virtual ~IterationNumberBasedAdaptiveTimeStepping() = default; diff --git a/ProcessLib/CachedSecondaryVariable.h b/ProcessLib/CachedSecondaryVariable.h index 3a8d3e790ce..0c6b5335f6e 100644 --- a/ProcessLib/CachedSecondaryVariable.h +++ b/ProcessLib/CachedSecondaryVariable.h @@ -9,6 +9,8 @@ #pragma once +#include <utility> + #include "NumLib/Extrapolation/ExtrapolatableElementCollection.h" #include "NumLib/NamedFunctionProvider.h" #include "NumLib/NumericsConfig.h" @@ -36,17 +38,17 @@ public: template <typename LocalAssemblerCollection, typename IntegrationPointValuesMethod> CachedSecondaryVariable( - std::string const& internal_variable_name, + std::string internal_variable_name, NumLib::Extrapolator& extrapolator, LocalAssemblerCollection const& local_assemblers, IntegrationPointValuesMethod integration_point_values_method, SecondaryVariableContext const& context) - : _extrapolator(extrapolator) - , _extrapolatables(new NumLib::ExtrapolatableLocalAssemblerCollection< + : _extrapolator(extrapolator), + _extrapolatables(new NumLib::ExtrapolatableLocalAssemblerCollection< LocalAssemblerCollection>{ - local_assemblers, integration_point_values_method}) - , _context(context) - , _internal_variable_name(internal_variable_name) + local_assemblers, integration_point_values_method}), + _context(context), + _internal_variable_name(std::move(internal_variable_name)) { } diff --git a/ProcessLib/HT/HTFEM.h b/ProcessLib/HT/HTFEM.h index 938ba3b1b06..f2cbd909e58 100644 --- a/ProcessLib/HT/HTFEM.h +++ b/ProcessLib/HT/HTFEM.h @@ -30,10 +30,12 @@ namespace HT template < typename NodalRowVectorType, typename GlobalDimNodalMatrixType> struct IntegrationPointData final { - IntegrationPointData(NodalRowVectorType const& N_, - GlobalDimNodalMatrixType const& dNdx_, + IntegrationPointData(NodalRowVectorType N_, + GlobalDimNodalMatrixType dNdx_, double const& integration_weight_) - : N(N_), dNdx(dNdx_), integration_weight(integration_weight_) + : N(std::move(N_)), + dNdx(std::move(dNdx_)), + integration_weight(integration_weight_) {} NodalRowVectorType const N; diff --git a/ProcessLib/HT/HTProcessData.h b/ProcessLib/HT/HTProcessData.h index ea071ca707c..f84c7e3ebdd 100644 --- a/ProcessLib/HT/HTProcessData.h +++ b/ProcessLib/HT/HTProcessData.h @@ -10,6 +10,7 @@ #pragma once #include <memory> +#include <utility> #include "MaterialLib/Fluid/FluidProperty.h" #include "MaterialLib/PorousMedium/Porosity/Porosity.h" @@ -43,7 +44,7 @@ struct HTProcessData ProcessLib::Parameter<double> const& specific_heat_capacity_fluid_, ProcessLib::Parameter<double> const& thermal_conductivity_solid_, ProcessLib::Parameter<double> const& thermal_conductivity_fluid_, - Eigen::Vector3d const& specific_body_force_, + Eigen::Vector3d specific_body_force_, bool const has_gravity_) : porous_media_properties(std::move(porous_media_properties_)), viscosity_model(std::move(viscosity_model_)), @@ -56,7 +57,7 @@ struct HTProcessData thermal_dispersivity_transversal(thermal_dispersivity_transversal_), thermal_conductivity_solid(thermal_conductivity_solid_), thermal_conductivity_fluid(thermal_conductivity_fluid_), - specific_body_force(specific_body_force_), + specific_body_force(std::move(specific_body_force_)), has_gravity(has_gravity_) { } diff --git a/ProcessLib/HydroMechanics/HydroMechanicsProcessData.h b/ProcessLib/HydroMechanics/HydroMechanicsProcessData.h index 1172958b3af..2f7c1baebf3 100644 --- a/ProcessLib/HydroMechanics/HydroMechanicsProcessData.h +++ b/ProcessLib/HydroMechanics/HydroMechanicsProcessData.h @@ -10,6 +10,7 @@ #pragma once #include <Eigen/Dense> +#include <utility> namespace MeshLib { @@ -33,7 +34,8 @@ struct HydroMechanicsProcessData Parameter<double> const& biot_coefficient_, Parameter<double> const& porosity_, Parameter<double> const& solid_density_, - Eigen::Matrix<double, DisplacementDim, 1> const& specific_body_force_) + Eigen::Matrix<double, DisplacementDim, 1> + specific_body_force_) : material{std::move(material_)}, intrinsic_permeability(intrinsic_permeability_), specific_storage(specific_storage_), @@ -42,7 +44,7 @@ struct HydroMechanicsProcessData biot_coefficient(biot_coefficient_), porosity(porosity_), solid_density(solid_density_), - specific_body_force(specific_body_force_) + specific_body_force(std::move(specific_body_force_)) { } diff --git a/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcessData.h b/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcessData.h index 920a9780727..f86382fe908 100644 --- a/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcessData.h +++ b/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcessData.h @@ -9,8 +9,9 @@ #pragma once -#include <memory> #include <Eigen/Dense> +#include <memory> +#include <utility> #include "MeshLib/ElementStatus.h" #include "MeshLib/PropertyVector.h" @@ -44,13 +45,14 @@ struct HydroMechanicsProcessData Parameter<double> const& biot_coefficient_, Parameter<double> const& porosity_, Parameter<double> const& solid_density_, - Eigen::Matrix<double, GlobalDim, 1> const& specific_body_force_, - std::unique_ptr<MaterialLib::Fracture::FractureModelBase<GlobalDim>>&& fracture_model, + Eigen::Matrix<double, GlobalDim, 1> + specific_body_force_, + std::unique_ptr<MaterialLib::Fracture::FractureModelBase<GlobalDim>>&& + fracture_model, std::unique_ptr<FractureProperty>&& fracture_prop, Parameter<double> const& initial_effective_stress_, Parameter<double> const& initial_fracture_effective_stress_, - bool const deactivate_matrix_in_flow_ - ) + bool const deactivate_matrix_in_flow_) : material{std::move(material_)}, intrinsic_permeability(intrinsic_permeability_), specific_storage(specific_storage_), @@ -59,7 +61,7 @@ struct HydroMechanicsProcessData biot_coefficient(biot_coefficient_), porosity(porosity_), solid_density(solid_density_), - specific_body_force(specific_body_force_), + specific_body_force(std::move(specific_body_force_)), fracture_model{std::move(fracture_model)}, fracture_property{std::move(fracture_prop)}, initial_effective_stress(initial_effective_stress_), diff --git a/ProcessLib/LIE/HydroMechanics/LocalAssembler/HydroMechanicsLocalAssemblerInterface.h b/ProcessLib/LIE/HydroMechanics/LocalAssembler/HydroMechanicsLocalAssemblerInterface.h index f30d8385a44..98dfcd584c3 100644 --- a/ProcessLib/LIE/HydroMechanics/LocalAssembler/HydroMechanicsLocalAssemblerInterface.h +++ b/ProcessLib/LIE/HydroMechanics/LocalAssembler/HydroMechanicsLocalAssemblerInterface.h @@ -9,6 +9,7 @@ #pragma once +#include <utility> #include <vector> #include "BaseLib/Error.h" @@ -31,11 +32,12 @@ class HydroMechanicsLocalAssemblerInterface public NumLib::ExtrapolatableElement { public: - HydroMechanicsLocalAssemblerInterface( - MeshLib::Element const& element, - std::size_t n_local_size, - std::vector<unsigned> const& dofIndex_to_localIndex) - : _element(element), _dofIndex_to_localIndex(dofIndex_to_localIndex) + HydroMechanicsLocalAssemblerInterface(MeshLib::Element const& element, + std::size_t n_local_size, + std::vector<unsigned> + dofIndex_to_localIndex) + : _element(element), + _dofIndex_to_localIndex(std::move(dofIndex_to_localIndex)) { _local_u.resize(n_local_size); _local_udot.resize(n_local_size); diff --git a/ProcessLib/LIE/SmallDeformation/LocalAssembler/SmallDeformationLocalAssemblerInterface.h b/ProcessLib/LIE/SmallDeformation/LocalAssembler/SmallDeformationLocalAssemblerInterface.h index b082fa43bde..c7f6dfd91aa 100644 --- a/ProcessLib/LIE/SmallDeformation/LocalAssembler/SmallDeformationLocalAssemblerInterface.h +++ b/ProcessLib/LIE/SmallDeformation/LocalAssembler/SmallDeformationLocalAssemblerInterface.h @@ -9,6 +9,7 @@ #pragma once +#include <utility> #include <vector> #include "BaseLib/Error.h" @@ -30,11 +31,9 @@ class SmallDeformationLocalAssemblerInterface { public: SmallDeformationLocalAssemblerInterface() : _dofIndex_to_localIndex{} {} - SmallDeformationLocalAssemblerInterface( - std::size_t n_local_size, - std::vector<unsigned> const& dofIndex_to_localIndex) - : _dofIndex_to_localIndex(dofIndex_to_localIndex) + std::size_t n_local_size, std::vector<unsigned> dofIndex_to_localIndex) + : _dofIndex_to_localIndex(std::move(dofIndex_to_localIndex)) { _local_u.resize(n_local_size); _local_b.resize(_local_u.size()); diff --git a/ProcessLib/Output.h b/ProcessLib/Output.h index 8b655ecdd20..2d7e099e461 100644 --- a/ProcessLib/Output.h +++ b/ProcessLib/Output.h @@ -9,6 +9,8 @@ #pragma once +#include <utility> + #include "BaseLib/ConfigTree.h" #include "MeshLib/IO/VtkIO/PVDFile.h" #include "Process.h" @@ -82,9 +84,9 @@ private: MeshLib::IO::PVDFile pvd_file; }; - Output(std::string const& prefix, bool const compress_output, + Output(std::string prefix, bool const compress_output, bool const output_nonlinear_iteration_results) - : _output_file_prefix(prefix), + : _output_file_prefix(std::move(prefix)), _output_file_compression(compress_output), _output_nonlinear_iteration_results( output_nonlinear_iteration_results) diff --git a/ProcessLib/Parameter/ConstantParameter.h b/ProcessLib/Parameter/ConstantParameter.h index d754e75727d..cfc08b74205 100644 --- a/ProcessLib/Parameter/ConstantParameter.h +++ b/ProcessLib/Parameter/ConstantParameter.h @@ -9,6 +9,8 @@ #pragma once +#include <utility> + #include "Parameter.h" namespace ProcessLib @@ -25,11 +27,10 @@ struct ConstantParameter final : public Parameter<T> /// Construction with a tuple. /// The given tuple must be non-empty. - explicit ConstantParameter(std::string const& name_, - std::vector<T> const& values) - : Parameter<T>(name_), _values(values) + explicit ConstantParameter(std::string const& name_, std::vector<T> values) + : Parameter<T>(name_), _values(std::move(values)) { - assert(!values.empty()); + assert(!_values.empty()); } bool isTimeDependent() const override { return false; } diff --git a/ProcessLib/Parameter/CurveScaledParameter.h b/ProcessLib/Parameter/CurveScaledParameter.h index 57d39ced101..0891d69b16a 100644 --- a/ProcessLib/Parameter/CurveScaledParameter.h +++ b/ProcessLib/Parameter/CurveScaledParameter.h @@ -10,6 +10,7 @@ #pragma once #include <map> +#include <utility> #include "MathLib/InterpolationAlgorithms/PiecewiseLinearInterpolation.h" #include "Parameter.h" #include "ProcessLib/Utils/ProcessUtils.h" @@ -20,10 +21,10 @@ template <typename T> struct CurveScaledParameter final : public Parameter<T> { CurveScaledParameter(std::string const& name_, MathLib::PiecewiseLinearInterpolation const& curve, - std::string const& referenced_parameter_name) + std::string referenced_parameter_name) : Parameter<T>(name_), _curve(curve), - _referenced_parameter_name(referenced_parameter_name) + _referenced_parameter_name(std::move(referenced_parameter_name)) { } diff --git a/ProcessLib/Parameter/GroupBasedParameter.h b/ProcessLib/Parameter/GroupBasedParameter.h index aa336588c2d..e31c28ceb18 100644 --- a/ProcessLib/Parameter/GroupBasedParameter.h +++ b/ProcessLib/Parameter/GroupBasedParameter.h @@ -9,6 +9,8 @@ #pragma once +#include <utility> + #include "BaseLib/Error.h" #include "MeshLib/PropertyVector.h" @@ -39,10 +41,11 @@ struct GroupBasedParameter final */ GroupBasedParameter(std::string const& name_, MeshLib::PropertyVector<int> const& property, - std::vector<std::vector<double>> const& vec_values) + std::vector<std::vector<double>> + vec_values) : Parameter<T>(name_), _property_index(property), - _vec_values(vec_values) + _vec_values(std::move(vec_values)) { } diff --git a/ProcessLib/Parameter/Parameter.h b/ProcessLib/Parameter/Parameter.h index b9a81894414..da183f3e7cd 100644 --- a/ProcessLib/Parameter/Parameter.h +++ b/ProcessLib/Parameter/Parameter.h @@ -11,6 +11,7 @@ #include <map> #include <memory> +#include <utility> #include <vector> #include "SpatialPosition.h" @@ -36,8 +37,7 @@ namespace ProcessLib /// Its property name helps addressing the right parameter. struct ParameterBase { - ParameterBase(std::string const& name_) : name(name_) {} - + ParameterBase(std::string name_) : name(std::move(name_)) {} virtual ~ParameterBase() = default; virtual bool isTimeDependent() const = 0; diff --git a/ProcessLib/TwoPhaseFlowWithPP/TwoPhaseFlowWithPPLocalAssembler.h b/ProcessLib/TwoPhaseFlowWithPP/TwoPhaseFlowWithPPLocalAssembler.h index 19104355f44..8915b94b9d2 100644 --- a/ProcessLib/TwoPhaseFlowWithPP/TwoPhaseFlowWithPPLocalAssembler.h +++ b/ProcessLib/TwoPhaseFlowWithPP/TwoPhaseFlowWithPPLocalAssembler.h @@ -32,11 +32,11 @@ template <typename NodalRowVectorType, typename GlobalDimNodalMatrixType, struct IntegrationPointData final { explicit IntegrationPointData( - NodalRowVectorType const& N_, GlobalDimNodalMatrixType const& dNdx_, + NodalRowVectorType N_, GlobalDimNodalMatrixType dNdx_, TwoPhaseFlowWithPPMaterialProperties& material_property_, double const& integration_weight_, NodalMatrixType const massOperator_) - : N(N_), - dNdx(dNdx_), + : N(std::move(N_)), + dNdx(std::move(dNdx_)), mat_property(material_property_), integration_weight(integration_weight_), massOperator(massOperator_) diff --git a/ProcessLib/TwoPhaseFlowWithPP/TwoPhaseFlowWithPPMaterialProperties.cpp b/ProcessLib/TwoPhaseFlowWithPP/TwoPhaseFlowWithPPMaterialProperties.cpp index c2ed90e5a79..369eec2abc5 100644 --- a/ProcessLib/TwoPhaseFlowWithPP/TwoPhaseFlowWithPPMaterialProperties.cpp +++ b/ProcessLib/TwoPhaseFlowWithPP/TwoPhaseFlowWithPPMaterialProperties.cpp @@ -9,6 +9,7 @@ #include "TwoPhaseFlowWithPPMaterialProperties.h" #include <logog/include/logog.hpp> +#include <utility> #include "BaseLib/reorderVector.h" #include "MaterialLib/Fluid/FluidProperty.h" #include "MaterialLib/PorousMedium/Porosity/Porosity.h" @@ -53,7 +54,7 @@ TwoPhaseFlowWithPPMaterialProperties::TwoPhaseFlowWithPPMaterialProperties( _gas_density(std::move(gas_density)), _gas_viscosity(std::move(gas_viscosity)), _material_ids(material_ids), - _intrinsic_permeability_models(intrinsic_permeability_models), + _intrinsic_permeability_models(std::move(intrinsic_permeability_models)), _porosity_models(std::move(porosity_models)), _storage_models(std::move(storage_models)), _capillary_pressure_models(std::move(capillary_pressure_models)), diff --git a/ProcessLib/TwoPhaseFlowWithPrho/TwoPhaseFlowWithPrhoMaterialProperties.cpp b/ProcessLib/TwoPhaseFlowWithPrho/TwoPhaseFlowWithPrhoMaterialProperties.cpp index 242a565dd7c..687acf6062d 100644 --- a/ProcessLib/TwoPhaseFlowWithPrho/TwoPhaseFlowWithPrhoMaterialProperties.cpp +++ b/ProcessLib/TwoPhaseFlowWithPrho/TwoPhaseFlowWithPrhoMaterialProperties.cpp @@ -9,6 +9,7 @@ #include "TwoPhaseFlowWithPrhoMaterialProperties.h" #include <logog/include/logog.hpp> +#include <utility> #include "BaseLib/reorderVector.h" #include "MaterialLib/Fluid/FluidProperty.h" #include "MaterialLib/PorousMedium/Porosity/Porosity.h" @@ -58,7 +59,7 @@ TwoPhaseFlowWithPrhoMaterialProperties::TwoPhaseFlowWithPrhoMaterialProperties( _gas_density(std::move(gas_density)), _gas_viscosity(std::move(gas_viscosity)), _material_ids(material_ids), - _intrinsic_permeability_models(intrinsic_permeability_models), + _intrinsic_permeability_models(std::move(intrinsic_permeability_models)), _porosity_models(std::move(porosity_models)), _storage_models(std::move(storage_models)), _capillary_pressure_models(std::move(capillary_pressure_models)), diff --git a/Tests/GeoLib/AutoCheckGenerators.h b/Tests/GeoLib/AutoCheckGenerators.h index 28c799d0939..99abfb6572e 100644 --- a/Tests/GeoLib/AutoCheckGenerators.h +++ b/Tests/GeoLib/AutoCheckGenerators.h @@ -11,6 +11,7 @@ #include <cmath> #include <memory> #include <random> +#include <utility> #include "autocheck/autocheck.hpp" #include "MathLib/Point3d.h" @@ -55,9 +56,8 @@ template <typename Gen = RandomCirclePointGeneratorXY<generator<double>>> struct SymmSegmentGeneratorXY { SymmSegmentGeneratorXY( - Gen s, - std::function<MathLib::Point3d(MathLib::Point3d const&)> f) - : source(s), function(f) + Gen s, std::function<MathLib::Point3d(MathLib::Point3d const&)> f) + : source(std::move(s)), function(std::move(f)) {} using result_type = GeoLib::LineSegment; @@ -82,7 +82,7 @@ struct PairSegmentGeneratorXY { PairSegmentGeneratorXY( Gen s, std::function<GeoLib::LineSegment(GeoLib::LineSegment const&)> f) - : segment_generator(s), function(f) + : segment_generator(std::move(s)), function(std::move(f)) { } diff --git a/Tests/NumLib/TestTimeSteppingIterationNumber.cpp b/Tests/NumLib/TestTimeSteppingIterationNumber.cpp index 08e7a054ede..baf12ca9232 100644 --- a/Tests/NumLib/TestTimeSteppingIterationNumber.cpp +++ b/Tests/NumLib/TestTimeSteppingIterationNumber.cpp @@ -11,6 +11,7 @@ #include <gtest/gtest.h> +#include <utility> #include <vector> #include <logog/include/logog.hpp> @@ -100,8 +101,11 @@ TEST(NumLib, TimeSteppingIterationNumberBased2) struct IterationNumberUpdate { - IterationNumberUpdate(const std::vector<std::size_t> &vec, std::size_t& counter) - : _nr_iterations(vec), i(counter) {} + IterationNumberUpdate(std::vector<std::size_t> vec, + std::size_t& counter) + : _nr_iterations(std::move(vec)), i(counter) + { + } std::vector<std::size_t> _nr_iterations; std::size_t& i; -- GitLab