diff --git a/Applications/DataExplorer/Base/RecentFiles.cpp b/Applications/DataExplorer/Base/RecentFiles.cpp index 892805aa8dd407c7dee0a690200589de3100bcf9..c64b2de8ae754c0379a086facb0da7e145c770d5 100644 --- a/Applications/DataExplorer/Base/RecentFiles.cpp +++ b/Applications/DataExplorer/Base/RecentFiles.cpp @@ -65,7 +65,7 @@ void RecentFiles::updateRecentFileActions() QSettings settings; QStringList files = settings.value(_settingsName).toStringList(); - int numFiles = qMin(files.size(), (int)_maxFiles); + int numFiles = qMin(files.size(), static_cast<int>(_maxFiles)); for (int i = 0; i < numFiles; ++i) { diff --git a/Applications/DataExplorer/DataView/ColorTableView.cpp b/Applications/DataExplorer/DataView/ColorTableView.cpp index 60e7b9827beaaf3ec005eec527e9eed1482dedb4..068465e23bd19c2bda18f5ad1489035a89d54f54 100644 --- a/Applications/DataExplorer/DataView/ColorTableView.cpp +++ b/Applications/DataExplorer/DataView/ColorTableView.cpp @@ -51,7 +51,7 @@ QSize ColorTableViewDelegate::sizeHint( const QStyleOptionViewItem &option, QSize s = QItemDelegate::sizeHint(option, index); if (s.isValid()) { - s.setHeight((int)(0.5 * s.height())); + s.setHeight(static_cast<int>(0.5 * s.height())); } return s; } diff --git a/Applications/DataExplorer/DataView/DiagramView/DiagramList.cpp b/Applications/DataExplorer/DataView/DiagramView/DiagramList.cpp index 14f7088734c8d160691028fc78eb95735332947a..c6a0234000e56e419770a5cee8224dac78863ccc 100644 --- a/Applications/DataExplorer/DataView/DiagramView/DiagramList.cpp +++ b/Applications/DataExplorer/DataView/DiagramView/DiagramList.cpp @@ -185,7 +185,8 @@ int DiagramList::readList(const QString &path, std::vector<DiagramList*> &lists) } bool first_loop(true); - QDateTime startDate, currentDate; + QDateTime startDate; + QDateTime currentDate; unsigned line_count (1); while (!in.atEnd()) diff --git a/Applications/DataExplorer/DataView/DiagramView/DiagramScene.cpp b/Applications/DataExplorer/DataView/DiagramView/DiagramScene.cpp index 9e6ebf6915ff9c0a617a218884e0d133b574d50c..461d22da0930a824512cacd424ff66ae6ddbd636 100644 --- a/Applications/DataExplorer/DataView/DiagramView/DiagramScene.cpp +++ b/Applications/DataExplorer/DataView/DiagramView/DiagramScene.cpp @@ -209,7 +209,8 @@ void DiagramScene::clearGrid() void DiagramScene::constructGrid() { // be very careful with scaling parameters here! - int numXTicks, numYTicks; + int numXTicks; + int numYTicks; qreal xMin = _unscaledBounds.left(); qreal yMin = _unscaledBounds.top(); qreal xMax = _unscaledBounds.right(); @@ -294,16 +295,18 @@ void DiagramScene::drawGraph(DiagramList* list) /// This value is zero if minYValue<0<maxYValue and minYValue otherwise. int DiagramScene::getXAxisOffset() { - return (_bounds.top() <= 0 && _bounds.bottom() > 0) ? (int)(_bounds.bottom() + - _bounds.top()) : (int)_bounds. - bottom(); + return (_bounds.top() <= 0 && _bounds.bottom() > 0) + ? static_cast<int>(_bounds.bottom() + _bounds.top()) + : static_cast<int>(_bounds.bottom()); } /// Returns the x-value at which the y-axis should cross the x-axis. /// This value is zero if minXValue<0<maxXValue and minXValue otherwise. int DiagramScene::getYAxisOffset() { - return (_bounds.left() <= 0 && _bounds.right() > 0) ? 0 : (int)_bounds.left(); + return (_bounds.left() <= 0 && _bounds.right() > 0) + ? 0 + : static_cast<int>(_bounds.left()); } /// Initialises the coordinate axes, adds labels and/or units to the axes, diff --git a/Applications/DataExplorer/DataView/DiagramView/DiagramView.cpp b/Applications/DataExplorer/DataView/DiagramView/DiagramView.cpp index f0ae44effc26f1a860e247a8e57a8fe6d87cc20d..17ebd605ba6ab04b738d3f88788186ae628b2730 100644 --- a/Applications/DataExplorer/DataView/DiagramView/DiagramView.cpp +++ b/Applications/DataExplorer/DataView/DiagramView/DiagramView.cpp @@ -88,12 +88,12 @@ void DiagramView::initialize() QSize DiagramView::minimumSizeHint() const { - return QSize(3 * _scene->MARGIN,2 * _scene->MARGIN); + return QSize(3 * DiagramScene::MARGIN, 2 * DiagramScene::MARGIN); } QSize DiagramView::sizeHint() const { - return QSize(6 * _scene->MARGIN, 4 * _scene->MARGIN); + return QSize(6 * DiagramScene::MARGIN, 4 * DiagramScene::MARGIN); } void DiagramView::resizeEvent(QResizeEvent* event) @@ -114,7 +114,8 @@ void DiagramView::update() //setResizeAnchor(QGraphicsView::AnchorViewCenter); QRectF viewRect = _scene->itemsBoundingRect(); _scene->setSceneRect(viewRect); - QRectF sceneInView(0 /*_scene->MARGIN*/,_scene->MARGIN / 2, - viewRect.width() /*+_scene->MARGIN*/,viewRect.height() + _scene->MARGIN); + QRectF sceneInView(0 /*_scene->MARGIN*/, DiagramScene::MARGIN / 2, + viewRect.width() /*+_scene->MARGIN*/, + viewRect.height() + DiagramScene::MARGIN); fitInView(sceneInView, Qt::IgnoreAspectRatio); } diff --git a/Applications/DataExplorer/DataView/DiagramView/QGraphicsGrid.cpp b/Applications/DataExplorer/DataView/DiagramView/QGraphicsGrid.cpp index 3103e4da7cad619a4b974b39458d219505cab25e..1bed6dc9740eda2dde0a71cf2a96ae8cf24cd43b 100644 --- a/Applications/DataExplorer/DataView/DiagramView/QGraphicsGrid.cpp +++ b/Applications/DataExplorer/DataView/DiagramView/QGraphicsGrid.cpp @@ -175,7 +175,8 @@ void QGraphicsGrid::paint(QPainter* painter, if (i > 0 && i < _numberOfXCells) { painter->setPen(_inside); - painter->drawLine(x, (int)_bounds.top(), x, (int)_bounds.bottom()); + painter->drawLine(x, static_cast<int>(_bounds.top()), x, + static_cast<int>(_bounds.bottom())); } /* draw ticks on x-axis */ @@ -183,7 +184,8 @@ void QGraphicsGrid::paint(QPainter* painter, { //double label = bounds.left() + (i * bounds.width() / numberOfXCells); painter->setPen(_outside); - painter->drawLine(x, (int)_bounds.bottom(), x, (int)_bounds.bottom() + 5); + painter->drawLine(x, static_cast<int>(_bounds.bottom()), x, + static_cast<int>(_bounds.bottom()) + 5); //painter->drawText(x - margin, bounds.bottom() + 5, 2*margin, 20, // Qt::AlignHCenter | Qt::AlignTop, QString::number(label)); } @@ -198,7 +200,8 @@ void QGraphicsGrid::paint(QPainter* painter, if (j > 0 && j < _numberOfYCells) { painter->setPen(_inside); - painter->drawLine((int)_bounds.left(), y, (int)_bounds.right(), y); + painter->drawLine(static_cast<int>(_bounds.left()), y, + static_cast<int>(_bounds.right()), y); } /* draw ticks on y-axis */ @@ -206,7 +209,8 @@ void QGraphicsGrid::paint(QPainter* painter, { //double label = bounds.top() + (j * bounds.height() / numberOfYCells); painter->setPen(_outside); - painter->drawLine((int)_bounds.left() - 5, y, (int)_bounds.left(), y); + painter->drawLine(static_cast<int>(_bounds.left()) - 5, y, + static_cast<int>(_bounds.left()), y); //painter->drawText(bounds.left() - margin, y - 10, margin - 5, 20, // Qt::AlignRight | Qt::AlignVCenter, QString::number(label)); } diff --git a/Applications/DataExplorer/DataView/GMSHPrefsDialog.cpp b/Applications/DataExplorer/DataView/GMSHPrefsDialog.cpp index 304aa482f62c796d79cfa36ed5ff99dd7aecc989..b5c3169ab050348c83fd5199ece6608563acfeb3 100644 --- a/Applications/DataExplorer/DataView/GMSHPrefsDialog.cpp +++ b/Applications/DataExplorer/DataView/GMSHPrefsDialog.cpp @@ -152,8 +152,8 @@ void GMSHPrefsDialog::accept() if (this->radioAdaptive->isChecked()) { double const min_scaling_factor (1e-10); - max_number_of_points_in_quadtree_leaf = BaseLib::str2number<unsigned> ( - param1->text().toStdString().c_str()); + max_number_of_points_in_quadtree_leaf = + BaseLib::str2number<unsigned>(param1->text().toStdString()); if (max_number_of_points_in_quadtree_leaf == 0) { max_number_of_points_in_quadtree_leaf = 10; diff --git a/Applications/DataExplorer/DataView/GeoTreeModel.cpp b/Applications/DataExplorer/DataView/GeoTreeModel.cpp index e0bf87cbc516379d782e2909d410ae070ea69f56..50f2e14cc6744797d9de6893962cdec4b53a6412 100644 --- a/Applications/DataExplorer/DataView/GeoTreeModel.cpp +++ b/Applications/DataExplorer/DataView/GeoTreeModel.cpp @@ -376,7 +376,7 @@ void GeoTreeModel::setNameForItem(const std::string &name, std::size_t id, std::string item_name) { - std::string geo_type_str(""); + std::string geo_type_str; int col_idx(1); switch(type) diff --git a/Applications/DataExplorer/DataView/LineEditDialog.cpp b/Applications/DataExplorer/DataView/LineEditDialog.cpp index a6dfe89bd5ea2c76b18c29dd3983ca257cea29c7..db2ebc523e87a9c875a0a7f49181c87d2b81d57d 100644 --- a/Applications/DataExplorer/DataView/LineEditDialog.cpp +++ b/Applications/DataExplorer/DataView/LineEditDialog.cpp @@ -29,7 +29,7 @@ LineEditDialog::LineEditDialog(const GeoLib::PolylineVec &ply_vec, QDialog* pare QStringList list; for (std::size_t i = 0; i < nPly; i++) { - std::string ply_name(""); + std::string ply_name; ply_vec.getNameOfElementByID(i, ply_name); list.append("Line " + QString::number(i) + " " + QString::fromStdString(ply_name)); } diff --git a/Applications/DataExplorer/DataView/MergeGeometriesDialog.cpp b/Applications/DataExplorer/DataView/MergeGeometriesDialog.cpp index 8b2eab7bd87b20d533860382ce4fdf0242bd0413..bf937b6d376f984ffd3b8c04433a5b126c8d0855 100644 --- a/Applications/DataExplorer/DataView/MergeGeometriesDialog.cpp +++ b/Applications/DataExplorer/DataView/MergeGeometriesDialog.cpp @@ -111,7 +111,7 @@ void MergeGeometriesDialog::reject() this->done(QDialog::Rejected); } -std::vector<std::string> const MergeGeometriesDialog::getSelectedGeometries() const +std::vector<std::string> MergeGeometriesDialog::getSelectedGeometries() const { std::vector<std::string> indexList; QStringList const& list (_selGeo->stringList()); diff --git a/Applications/DataExplorer/DataView/MergeGeometriesDialog.h b/Applications/DataExplorer/DataView/MergeGeometriesDialog.h index af81dd9b3a9e3230fc42af911e36fdfc26f7e4ee..15e2adf049c015e622697d7b918ea6b2ffa27fdd 100644 --- a/Applications/DataExplorer/DataView/MergeGeometriesDialog.h +++ b/Applications/DataExplorer/DataView/MergeGeometriesDialog.h @@ -37,7 +37,7 @@ public: ~MergeGeometriesDialog() override; /// Returns a vector of selected geometries - std::vector<std::string> const getSelectedGeometries() const; + std::vector<std::string> getSelectedGeometries() const; /// Returns the name of the new merged geometry std::string getGeometryName() const; diff --git a/Applications/DataExplorer/DataView/MeshElementRemovalDialog.cpp b/Applications/DataExplorer/DataView/MeshElementRemovalDialog.cpp index cb9291eede6d87d595b21ff271a28d3bc37d5dfa..41fbdd674236b95b4657a4ec4b5797c096721ab6 100644 --- a/Applications/DataExplorer/DataView/MeshElementRemovalDialog.cpp +++ b/Applications/DataExplorer/DataView/MeshElementRemovalDialog.cpp @@ -82,7 +82,8 @@ void MeshElementRemovalDialog::accept() if (this->scalarArrayCheckBox->isChecked()) { std::string const array_name = this->scalarArrayComboBox->currentText().toStdString(); - double min_val, max_val; + double min_val; + double max_val; bool outside = this->outsideButton->isChecked(); if (outside) { diff --git a/Applications/DataExplorer/DataView/MeshLayerEditDialog.cpp b/Applications/DataExplorer/DataView/MeshLayerEditDialog.cpp index 82cccf89c48f4dd37835ec0d70682c649fd088f0..f9aba4d6b1f4c012c83512f28b1dc3792cc08910 100644 --- a/Applications/DataExplorer/DataView/MeshLayerEditDialog.cpp +++ b/Applications/DataExplorer/DataView/MeshLayerEditDialog.cpp @@ -221,7 +221,7 @@ MeshLib::Mesh* MeshLayerEditDialog::createPrismMesh() layer_thickness.push_back(this->_edits[i]->text().toFloat()); } INFO("Mesh construction time: %d ms.", myTimer0.elapsed()); - return mapper.createStaticLayers(*_msh, layer_thickness); + return MeshLib::MeshLayerMapper::createStaticLayers(*_msh, layer_thickness); } MeshLib::Mesh* MeshLayerEditDialog::createTetMesh() diff --git a/Applications/DataExplorer/DataView/SHPImportDialog.cpp b/Applications/DataExplorer/DataView/SHPImportDialog.cpp index 30e2583af903e2d7599b4732f082c01e799932d0..491f729213331279466c026273b6ef40d14af726 100644 --- a/Applications/DataExplorer/DataView/SHPImportDialog.cpp +++ b/Applications/DataExplorer/DataView/SHPImportDialog.cpp @@ -60,7 +60,8 @@ SHPImportDialog::~SHPImportDialog() void SHPImportDialog::setupDialog() { _layout = new QGridLayout(this); - int shpType = 0, numberOfEntities = 0; + int shpType = 0; + int numberOfEntities = 0; QString type = ""; setWindowTitle("Import SHP File"); diff --git a/Applications/DataExplorer/DataView/SaveMeshDialog.cpp b/Applications/DataExplorer/DataView/SaveMeshDialog.cpp index 0fa4356a5b00787617f214abfb061a3ad887fe93..a49a58268e6a46f60f53820b26f8cff5e8d5e984 100644 --- a/Applications/DataExplorer/DataView/SaveMeshDialog.cpp +++ b/Applications/DataExplorer/DataView/SaveMeshDialog.cpp @@ -82,13 +82,13 @@ void SaveMeshDialog::accept() int dataMode = this->dataModeBox->currentIndex(); bool compress (this->compressionCheckBox->isChecked()); MeshLib::IO::VtuInterface vtkIO(&_mesh, dataMode, compress); - vtkIO.writeToFile(file_name.toStdString().c_str()); + vtkIO.writeToFile(file_name.toStdString()); } if (fi.suffix().toLower() == "msh") { MeshLib::IO::Legacy::MeshIO meshIO; meshIO.setMesh(&_mesh); - meshIO.writeToFile(file_name.toStdString().c_str()); + meshIO.writeToFile(file_name.toStdString()); } LastSavedFileDirectory::setDir(file_name); diff --git a/Applications/DataExplorer/DataView/StratView/StratBar.cpp b/Applications/DataExplorer/DataView/StratView/StratBar.cpp index 8a141cfea35c8f2703465cbd8959f0f9705dce88..61425df598ffd456c26cf9b40f9ca4b2f04b4a9d 100644 --- a/Applications/DataExplorer/DataView/StratView/StratBar.cpp +++ b/Applications/DataExplorer/DataView/StratView/StratBar.cpp @@ -36,7 +36,8 @@ void StratBar::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, Q_UNUSED (option) Q_UNUSED (widget) - double top = 0, height = 0; + double top = 0; + double height = 0; QPen pen(Qt::black, 1, Qt::SolidLine, Qt::SquareCap, Qt::RoundJoin); pen.setCosmetic(true); @@ -56,11 +57,18 @@ void StratBar::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, height = logHeight(((*(profile[i - 1]))[2] - (*(profile[i]))[2])); QRectF layer(0, top, BARWIDTH, height); DataHolderLib::Color const& c (DataHolderLib::getColor(soilNames[i], _stratColors)); - QBrush brush(QColor((int)c[0], (int)c[1], (int)c[2], 127), Qt::SolidPattern); + QBrush brush(QColor(static_cast<int>(c[0]), + static_cast<int>(c[1]), + static_cast<int>(c[2]), + 127), + Qt::SolidPattern); painter->setBrush(brush); painter->drawRect(layer); - painter->drawLine(0, (int)layer.bottom(), BARWIDTH + 5, (int)layer.bottom()); + painter->drawLine(0, + static_cast<int>(layer.bottom()), + BARWIDTH + 5, + static_cast<int>(layer.bottom())); //painter->drawText(BARWIDTH+10, layer.bottom(), QString::number((*(profile[i]))[2])); } } diff --git a/Applications/DataExplorer/DataView/StratView/StratScene.cpp b/Applications/DataExplorer/DataView/StratView/StratScene.cpp index 2786a979d08eb2ba2689a2bc2d3060dd25f99bb6..45b8a968a5845a36d76348060f40b392ca65a58f 100644 --- a/Applications/DataExplorer/DataView/StratView/StratScene.cpp +++ b/Applications/DataExplorer/DataView/StratView/StratScene.cpp @@ -98,7 +98,8 @@ void StratScene::addSoilNameLabels(std::vector<std::string> soilNames, double offset) { //QRectF textBounds; - double vertPos = MARGIN, halfHeight = 0; + double vertPos = MARGIN; + double halfHeight = 0; std::vector<QNonScalableGraphicsTextItem*> soilText; soilText.push_back(addNonScalableText(QString::fromStdString(soilNames[0]))); //textBounds = soilText[0]->boundingRect(); diff --git a/Applications/DataExplorer/DataView/StratView/StratView.cpp b/Applications/DataExplorer/DataView/StratView/StratView.cpp index cb93bafc84feec8984dd67a9081ce861537a005e..a29a8a77f7c89c86ef8bc52d803c40d48d0c6351 100644 --- a/Applications/DataExplorer/DataView/StratView/StratView.cpp +++ b/Applications/DataExplorer/DataView/StratView/StratView.cpp @@ -47,9 +47,9 @@ void StratView::update() { QRectF viewRect = _scene->itemsBoundingRect(); _scene->setSceneRect(viewRect); - QRectF sceneInView(_scene->MARGIN,_scene->MARGIN, - viewRect.width() + 2 * _scene->MARGIN, - viewRect.height() + 2 * _scene->MARGIN); + QRectF sceneInView(StratScene::MARGIN, StratScene::MARGIN, + viewRect.width() + 2 * StratScene::MARGIN, + viewRect.height() + 2 * StratScene::MARGIN); fitInView(sceneInView, Qt::IgnoreAspectRatio); } @@ -58,8 +58,8 @@ void StratView::saveAsImage(QString fileName) this->update(); QRectF viewRect = _scene->itemsBoundingRect(); - QImage img( - static_cast<int>(viewRect.width()) + 2 * _scene->MARGIN, 600, QImage::Format_ARGB32); + QImage img(static_cast<int>(viewRect.width()) + 2 * StratScene::MARGIN, 600, + QImage::Format_ARGB32); QPainter painter(&img); this->render(&painter); diff --git a/Applications/DataExplorer/VtkVis/QVtkDataSetMapper.cpp b/Applications/DataExplorer/VtkVis/QVtkDataSetMapper.cpp index 0487e5766bd48bfeeb829a8858965158327cae39..be3c3d322223a71f4c5378ecfabedfef63045c92 100644 --- a/Applications/DataExplorer/VtkVis/QVtkDataSetMapper.cpp +++ b/Applications/DataExplorer/VtkVis/QVtkDataSetMapper.cpp @@ -32,6 +32,6 @@ void QVtkDataSetMapper::PrintSelf(ostream& os, vtkIndent indent) void QVtkDataSetMapper::SetScalarVisibility( bool on ) { - vtkDataSetMapper::SetScalarVisibility((int)on); + vtkDataSetMapper::SetScalarVisibility(static_cast<int>(on)); } diff --git a/Applications/DataExplorer/VtkVis/VisPrefsDialog.cpp b/Applications/DataExplorer/VtkVis/VisPrefsDialog.cpp index f7649a048b7b2a22e12af4a8cb998724aaf2403a..5af0fd284a5b99ef8c42c4b5a9d177d915998ab5 100644 --- a/Applications/DataExplorer/VtkVis/VisPrefsDialog.cpp +++ b/Applications/DataExplorer/VtkVis/VisPrefsDialog.cpp @@ -89,8 +89,8 @@ void VisPrefsDialog::on_superelevationPushButton_pressed() void VisPrefsDialog::on_loadShowAllCheckBox_stateChanged(int state) { - _visWidget.setShowAllOnLoad((bool)state); - _vtkVisPipeline.resetCameraOnAddOrRemove((bool)state); + _visWidget.setShowAllOnLoad(static_cast<bool>(state)); + _vtkVisPipeline.resetCameraOnAddOrRemove(static_cast<bool>(state)); QSettings settings; settings.setValue("resetViewOnLoad", state); @@ -98,7 +98,7 @@ void VisPrefsDialog::on_loadShowAllCheckBox_stateChanged(int state) void VisPrefsDialog::on_cullBackfacesCheckBox_stateChanged(int state) { - _vtkVisPipeline.setGlobalBackfaceCulling((bool)state); + _vtkVisPipeline.setGlobalBackfaceCulling(static_cast<bool>(state)); QSettings settings; settings.setValue("globalCullBackfaces", state); diff --git a/Applications/DataExplorer/VtkVis/VtkAlgorithmPropertyCheckbox.cpp b/Applications/DataExplorer/VtkVis/VtkAlgorithmPropertyCheckbox.cpp index 932ea997c0cd7bad1f72b33b4433b1bb952066f9..e1954f5d9b13493d8cb0f703ed1701514dbb4192 100644 --- a/Applications/DataExplorer/VtkVis/VtkAlgorithmPropertyCheckbox.cpp +++ b/Applications/DataExplorer/VtkVis/VtkAlgorithmPropertyCheckbox.cpp @@ -34,6 +34,6 @@ VtkAlgorithmPropertyCheckbox::~VtkAlgorithmPropertyCheckbox() = default; void VtkAlgorithmPropertyCheckbox::setNewValue( int state ) { - auto boolState = (bool)state; + auto boolState = static_cast<bool>(state); _algProps->SetUserProperty(_name, QVariant(boolState)); } diff --git a/Applications/DataExplorer/VtkVis/VtkCompositeElementSelectionFilter.cpp b/Applications/DataExplorer/VtkVis/VtkCompositeElementSelectionFilter.cpp index 22455ce148de3969a980ff477f8ebb871358fbe0..46a5bee99569428394fc42a995d1027ab0e04e4e 100644 --- a/Applications/DataExplorer/VtkVis/VtkCompositeElementSelectionFilter.cpp +++ b/Applications/DataExplorer/VtkVis/VtkCompositeElementSelectionFilter.cpp @@ -36,7 +36,8 @@ VtkCompositeElementSelectionFilter::VtkCompositeElementSelectionFilter( vtkAlgor void VtkCompositeElementSelectionFilter::init() { - double thresholdLower(_range.first), thresholdUpper(_range.second); + double thresholdLower(_range.first); + double thresholdUpper(_range.second); this->_inputDataObjectType = VTK_UNSTRUCTURED_GRID; this->_outputDataObjectType = VTK_UNSTRUCTURED_GRID; diff --git a/Applications/DataExplorer/VtkVis/VtkCompositeTextureOnSurfaceFilter.cpp b/Applications/DataExplorer/VtkVis/VtkCompositeTextureOnSurfaceFilter.cpp index 07df92c09aec19f48fa9be0c88fe704df77dac78..89aeca6cb02853be18cdfba4ecc4aafc176cf905 100644 --- a/Applications/DataExplorer/VtkVis/VtkCompositeTextureOnSurfaceFilter.cpp +++ b/Applications/DataExplorer/VtkVis/VtkCompositeTextureOnSurfaceFilter.cpp @@ -79,7 +79,9 @@ void VtkCompositeTextureOnSurfaceFilter::init() (fi.suffix().toLower() == "png") || (fi.suffix().toLower() == "grd") || (fi.suffix().toLower() == "jpg") || (fi.suffix().toLower() == "bmp")) { - double x0(0), y0(0), scalingFactor(1); + double x0(0); + double y0(0); + double scalingFactor(1); std::string name = fileName.toStdString(); vtkImageAlgorithm* image = VtkRaster::loadImage(name, x0, y0, scalingFactor); surface->SetRaster(image, x0, y0, scalingFactor); diff --git a/Applications/DataExplorer/VtkVis/VtkFilterFactory.cpp b/Applications/DataExplorer/VtkVis/VtkFilterFactory.cpp index 40ba01614e2566094f23b847a6f2c7914be9c529..c576b5a36f37a34fc8447feadbb706c5cd642f60 100644 --- a/Applications/DataExplorer/VtkVis/VtkFilterFactory.cpp +++ b/Applications/DataExplorer/VtkVis/VtkFilterFactory.cpp @@ -32,7 +32,7 @@ #include <vtkDataSetSurfaceFilter.h> -const QVector<VtkFilterInfo> VtkFilterFactory::GetFilterList() +QVector<VtkFilterInfo> VtkFilterFactory::GetFilterList() { QVector<VtkFilterInfo> filterList; diff --git a/Applications/DataExplorer/VtkVis/VtkFilterFactory.h b/Applications/DataExplorer/VtkVis/VtkFilterFactory.h index 29d3f3f4298e66decc989d48634001657814c29e..193fb20fa905fc4ac46f17629b08c19d6e033c95 100644 --- a/Applications/DataExplorer/VtkVis/VtkFilterFactory.h +++ b/Applications/DataExplorer/VtkVis/VtkFilterFactory.h @@ -32,7 +32,7 @@ public: /// @brief Returns all registered filters. /// New VtkCompositeFilter or filter inherited from VtkAlgorithmProperties /// must be registered here. - static const QVector<VtkFilterInfo> GetFilterList(); + static QVector<VtkFilterInfo> GetFilterList(); /// @brief Creates a composite filter by name. static VtkCompositeFilter* CreateCompositeFilter(QString type, vtkAlgorithm* inputAlgorithm); diff --git a/Applications/DataExplorer/VtkVis/VtkImageDataToLinePolyDataFilter.cpp b/Applications/DataExplorer/VtkVis/VtkImageDataToLinePolyDataFilter.cpp index 29a61851cd37494ac6a50923aa5f761ebe01c4fb..82c8379622214d53e9fe1f699e19789b335acfd2 100644 --- a/Applications/DataExplorer/VtkVis/VtkImageDataToLinePolyDataFilter.cpp +++ b/Applications/DataExplorer/VtkVis/VtkImageDataToLinePolyDataFilter.cpp @@ -102,7 +102,8 @@ int VtkImageDataToLinePolyDataFilter::RequestData( for (vtkIdType ptId = 0; ptId < numPts; ++ptId) { // Skip translucent pixels - float opacity = ((float*)inScalarPtr)[ptId * numScalarComponents + 1]; + float opacity = + (static_cast<float*>(inScalarPtr))[ptId * numScalarComponents + 1]; if (opacity < 0.00000001f) { continue; @@ -110,8 +111,8 @@ int VtkImageDataToLinePolyDataFilter::RequestData( // Compute length of the new line (scalar * LengthScaleFactor) double const length = - ((float*)inScalarPtr)[ptId * numScalarComponents] * scalingFactor * - this->LengthScaleFactor; + (static_cast<float*>(inScalarPtr))[ptId * numScalarComponents] * + scalingFactor * this->LengthScaleFactor; // Skip this line if length is zero if (length < 0.00000001f) diff --git a/Applications/DataExplorer/VtkVis/VtkImageDataToPointCloudFilter.cpp b/Applications/DataExplorer/VtkVis/VtkImageDataToPointCloudFilter.cpp index b067fb2df863a8689f746abd5b7404cbfdb9c84e..491658e31a402e5e8b84940377b81fa56074e6e4 100644 --- a/Applications/DataExplorer/VtkVis/VtkImageDataToPointCloudFilter.cpp +++ b/Applications/DataExplorer/VtkVis/VtkImageDataToPointCloudFilter.cpp @@ -86,13 +86,14 @@ int VtkImageDataToPointCloudFilter::RequestData( // Skip transparent pixels if (n_comp == 2 || n_comp == 4) { - if (((float*)pixvals)[(i + 1) * n_comp - 1] < 0.00000001f) + if ((static_cast<float*>(pixvals))[(i + 1) * n_comp - 1] < + 0.00000001f) { density.push_back(0); continue; } } - float const val(((float*)pixvals)[i * n_comp]); + float const val((static_cast<float*>(pixvals))[i * n_comp]); double const calc_gamma = (IsLinear) ? 1 : Gamma; std::size_t const pnts_per_cell = interpolate(range[0], range[1], val, calc_gamma); density.push_back(static_cast<std::size_t>( @@ -155,7 +156,7 @@ void VtkImageDataToPointCloudFilter::createPoints( double VtkImageDataToPointCloudFilter::getRandomNumber(double const& min, double const& max) const { - return ((double)std::rand() / RAND_MAX) * (max - min) + min; + return (static_cast<double>(std::rand()) / RAND_MAX) * (max - min) + min; } std::size_t VtkImageDataToPointCloudFilter::interpolate(double low, diff --git a/Applications/DataExplorer/VtkVis/VtkImageDataToSurfacePointsFilter.cpp b/Applications/DataExplorer/VtkVis/VtkImageDataToSurfacePointsFilter.cpp index dd05ffd5f3c67abb11395ac31d961f6da550acee..bb18838e0cdd895f33602c7da62e7584fde72464 100644 --- a/Applications/DataExplorer/VtkVis/VtkImageDataToSurfacePointsFilter.cpp +++ b/Applications/DataExplorer/VtkVis/VtkImageDataToSurfacePointsFilter.cpp @@ -87,13 +87,14 @@ int VtkImageDataToSurfacePointsFilter::RequestData( for (std::size_t i = 0; i < n_points; ++i) { if ((n_comp == 2 || n_comp == 4) && - (((float*)pixvals)[(i + 1) * n_comp - 1] < 0.00000001f)) + ((static_cast<float*>(pixvals))[(i + 1) * n_comp - 1] < + 0.00000001f)) { pixels.push_back(-9999); } else { - pixels.push_back(((float*)pixvals)[i * n_comp]); + pixels.push_back((static_cast<float*>(pixvals))[i * n_comp]); } } GeoLib::Raster const* const raster(new GeoLib::Raster( @@ -114,7 +115,8 @@ int VtkImageDataToSurfacePointsFilter::RequestData( // Skip transparent pixels if (n_comp == 2 || n_comp == 4) { - if (((float*)pixvals)[(i + 1) * n_comp - 1] < 0.00000001f) + if ((static_cast<float*>(pixvals))[(i + 1) * n_comp - 1] < + 0.00000001f) { continue; } @@ -163,5 +165,5 @@ void VtkImageDataToSurfacePointsFilter::createPointSurface( double VtkImageDataToSurfacePointsFilter::getRandomNumber(double const& min, double const& max) const { - return ((double)std::rand() / RAND_MAX) * (max - min) + min; + return (static_cast<double>(std::rand()) / RAND_MAX) * (max - min) + min; } diff --git a/Applications/DataExplorer/VtkVis/VtkRaster.cpp b/Applications/DataExplorer/VtkVis/VtkRaster.cpp index 918a0fb7cb5a20067a4e1cfd470fea27f2310a69..8ec9cecb4474d01c8c9152c154a43e126571ee87 100644 --- a/Applications/DataExplorer/VtkVis/VtkRaster.cpp +++ b/Applications/DataExplorer/VtkVis/VtkRaster.cpp @@ -132,7 +132,10 @@ vtkImageAlgorithm* VtkRaster::loadImageFromTIFF(const std::string& fileName, if (geoTiff) { - int imgWidth = 0, imgHeight = 0, nImages = 0, pntCount = 0; + int imgWidth = 0; + int imgHeight = 0; + int nImages = 0; + int pntCount = 0; double* pnts = nullptr; // get actual number of images in the tiff file @@ -163,8 +166,8 @@ vtkImageAlgorithm* VtkRaster::loadImageFromTIFF(const std::string& fileName, } // read pixel values - auto* pixVal = - (uint32*)_TIFFmalloc(imgWidth * imgHeight * sizeof(uint32)); + auto* pixVal = static_cast<uint32*>( + _TIFFmalloc(imgWidth * imgHeight * sizeof(uint32))); if ((imgWidth > 0) && (imgHeight > 0)) { if (!TIFFReadRGBAImage(tiff, imgWidth, imgHeight, pixVal, 0)) @@ -341,7 +344,7 @@ bool VtkRaster::readWorldFile(std::string const& filename, return false; } - std::string line(""); + std::string line; // x-scaling if (!std::getline(in, line)) { diff --git a/Applications/DataExplorer/VtkVis/VtkTextureOnSurfaceFilter.cpp b/Applications/DataExplorer/VtkVis/VtkTextureOnSurfaceFilter.cpp index 4f7b0f91edde3b77d682c39e033e8e66e719cc4e..37717da7bb5ea7a84985c0b0571d0e700de8ef08 100644 --- a/Applications/DataExplorer/VtkVis/VtkTextureOnSurfaceFilter.cpp +++ b/Applications/DataExplorer/VtkVis/VtkTextureOnSurfaceFilter.cpp @@ -63,9 +63,11 @@ int VtkTextureOnSurfaceFilter::RequestData( vtkInformation* request, std::size_t imgWidth = dims[0]; std::size_t imgHeight = dims[1]; - std::pair<int, int> min((int)_origin.first, (int)_origin.second); - std::pair<int, int> max((int)(_origin.first + (imgWidth * _scalingFactor)), - (int)(_origin.second + (imgHeight * _scalingFactor))); + std::pair<int, int> min(static_cast<int>(_origin.first), + static_cast<int>(_origin.second)); + std::pair<int, int> max( + static_cast<int>(_origin.first + (imgWidth * _scalingFactor)), + static_cast<int>(_origin.second + (imgHeight * _scalingFactor))); //calculate texture coordinates vtkPoints* points = input->GetPoints(); diff --git a/Applications/DataExplorer/VtkVis/VtkVisHelper.cpp b/Applications/DataExplorer/VtkVis/VtkVisHelper.cpp index ee247009731c605b51f93a0b2f17b33779c1f0c7..afc518f3b41599847871dc95b5546aa4e4fa234f 100644 --- a/Applications/DataExplorer/VtkVis/VtkVisHelper.cpp +++ b/Applications/DataExplorer/VtkVis/VtkVisHelper.cpp @@ -25,7 +25,8 @@ vtkImageData* VtkVisHelper::QImageToVtkImageData(QImage &img) { - std::size_t imgWidth = img.width(), imgHeight = img.height(); + std::size_t imgWidth = img.width(); + std::size_t imgHeight = img.height(); vtkSmartPointer<vtkUnsignedCharArray> data = vtkSmartPointer<vtkUnsignedCharArray>::New(); data->SetNumberOfComponents(3); data->SetNumberOfTuples( imgWidth * imgHeight ); diff --git a/Applications/DataExplorer/VtkVis/VtkVisPipeline.cpp b/Applications/DataExplorer/VtkVis/VtkVisPipeline.cpp index d9ec04a3885b695065f5c013f5999c855ab0b77c..9234b5f9256543c4d2f02997bdc535213e9c28ec 100644 --- a/Applications/DataExplorer/VtkVis/VtkVisPipeline.cpp +++ b/Applications/DataExplorer/VtkVis/VtkVisPipeline.cpp @@ -138,7 +138,7 @@ void VtkVisPipeline::removeLight(const GeoLib::Point &pos) } } -const QColor VtkVisPipeline::getBGColor() const +QColor VtkVisPipeline::getBGColor() const { double* color = _renderer->GetBackground(); QColor c(static_cast<int>(color[0] * 255), diff --git a/Applications/DataExplorer/VtkVis/VtkVisPipeline.h b/Applications/DataExplorer/VtkVis/VtkVisPipeline.h index 332d7b5818dada6fbbc9722c25d7998cbd007fbb..ccbea1d46a1caa019b856c2e70c36f0c898e18ba 100644 --- a/Applications/DataExplorer/VtkVis/VtkVisPipeline.h +++ b/Applications/DataExplorer/VtkVis/VtkVisPipeline.h @@ -73,7 +73,7 @@ public: void removeLight(const GeoLib::Point &pos); /// \brief Returns the background-colour of the scene. - const QColor getBGColor() const; + QColor getBGColor() const; /// \brief Sets the background-colour of the scene. void setBGColor(const QColor &color); diff --git a/Applications/DataExplorer/VtkVis/VtkVisPipelineItem.cpp b/Applications/DataExplorer/VtkVis/VtkVisPipelineItem.cpp index 7d3b8c8b9805016894df45c7fc9d8e8fe57b28a0..8e7592ec63f1e48148718df0b46bf47d67a8721b 100644 --- a/Applications/DataExplorer/VtkVis/VtkVisPipelineItem.cpp +++ b/Applications/DataExplorer/VtkVis/VtkVisPipelineItem.cpp @@ -113,12 +113,12 @@ bool VtkVisPipelineItem::setData( int column, const QVariant &value ) } bool VtkVisPipelineItem::isVisible() const { - return (bool)_actor->GetVisibility(); + return static_cast<bool>(_actor->GetVisibility()); } void VtkVisPipelineItem::setVisible( bool visible ) { - _actor->SetVisibility((int)visible); + _actor->SetVisibility(static_cast<int>(visible)); _actor->Modified(); _renderer->Render(); } @@ -210,8 +210,8 @@ void VtkVisPipelineItem::setBackfaceCullingOnChildren(bool enable) const for (int i = 0; i < this->childCount(); ++i) { VtkVisPipelineItem* child = this->child(i); - child->setBackfaceCulling((int)enable); - child->setBackfaceCullingOnChildren((int)enable); + child->setBackfaceCulling(static_cast<int>(enable)); + child->setBackfaceCullingOnChildren(static_cast<int>(enable)); } } diff --git a/Applications/DataExplorer/VtkVis/VtkVisPipelineItem.h b/Applications/DataExplorer/VtkVis/VtkVisPipelineItem.h index cf32d916d280a3ed54517c101bb588723b5d400f..5dee06afd9f2f9aa3c8164bcba7a77ab654f0e5f 100644 --- a/Applications/DataExplorer/VtkVis/VtkVisPipelineItem.h +++ b/Applications/DataExplorer/VtkVis/VtkVisPipelineItem.h @@ -74,7 +74,7 @@ public: vtkProp3D* actor() const; // Dummy for implementation in derived classes - virtual const QString GetActiveAttribute() const { return QString(""); } + virtual QString GetActiveAttribute() const { return QString(""); } // Dummy for implementation in derived classes virtual void SetActiveAttribute(const QString& str) { (void)str; } diff --git a/Applications/DataExplorer/VtkVis/VtkVisPointSetItem.cpp b/Applications/DataExplorer/VtkVis/VtkVisPointSetItem.cpp index cf124a12c491ddd58977f0d8e4ade3b273999058..18dd99203792ecdc0e5108d8af5ff515975c79fc 100644 --- a/Applications/DataExplorer/VtkVis/VtkVisPointSetItem.cpp +++ b/Applications/DataExplorer/VtkVis/VtkVisPointSetItem.cpp @@ -96,7 +96,7 @@ VtkVisPointSetItem::~VtkVisPointSetItem() _transformFilter->Delete(); _mapper->Delete(); } -const QString VtkVisPointSetItem::GetActiveAttribute() const +QString VtkVisPointSetItem::GetActiveAttribute() const { return _vtkProps->GetActiveAttribute(); } @@ -410,7 +410,9 @@ vtkAlgorithm* VtkVisPointSetItem::transformFilter() const void VtkVisPointSetItem::setBackfaceCulling(bool enable) const { - static_cast<vtkActor*>(this->_actor)->GetProperty()->SetBackfaceCulling((int)enable); + static_cast<vtkActor*>(this->_actor) + ->GetProperty() + ->SetBackfaceCulling(static_cast<int>(enable)); } void VtkVisPointSetItem::GetRangeForActiveAttribute(double range[2]) const diff --git a/Applications/DataExplorer/VtkVis/VtkVisPointSetItem.h b/Applications/DataExplorer/VtkVis/VtkVisPointSetItem.h index 668b0461c40b8429401c4b1da1122924f897e1e8..ca0463e05216f172244b63935a8f97a420acd892 100644 --- a/Applications/DataExplorer/VtkVis/VtkVisPointSetItem.h +++ b/Applications/DataExplorer/VtkVis/VtkVisPointSetItem.h @@ -52,7 +52,7 @@ public: ~VtkVisPointSetItem() override; /// @brief Gets the last selected attribute. - const QString GetActiveAttribute() const override; + QString GetActiveAttribute() const override; /// @brief Get the scalar range for the active attribute void GetRangeForActiveAttribute(double range[2]) const; diff --git a/Applications/DataExplorer/VtkVis/VtkVisTabWidget.cpp b/Applications/DataExplorer/VtkVis/VtkVisTabWidget.cpp index c2e1b3d505ea1d248363a8d2f6092b4022df1b7e..4dc97ac2b9b7c15db994c7f8753fc69fd41c9064 100644 --- a/Applications/DataExplorer/VtkVis/VtkVisTabWidget.cpp +++ b/Applications/DataExplorer/VtkVis/VtkVisTabWidget.cpp @@ -74,7 +74,8 @@ void VtkVisTabWidget::setActiveItem( VtkVisPipelineItem* item ) diffuseColorPickerButton->setColor(vtkProps->GetDiffuseColor()); visibleEdgesCheckBox->setChecked(vtkProps->GetEdgeVisibility()); edgeColorPickerButton->setColor(vtkProps->GetEdgeColor()); - opacitySlider->setValue((int)(vtkProps->GetOpacity() * 100.0)); + opacitySlider->setValue( + static_cast<int>(vtkProps->GetOpacity() * 100.0)); auto* transform = static_cast<vtkTransform*>(transform_filter->GetTransform()); @@ -218,7 +219,9 @@ void VtkVisTabWidget::on_scaleZ_textChanged(const QString &text) void VtkVisTabWidget::translateItem() { - bool okX(true), okY(true), okZ(true); + bool okX(true); + bool okY(true); + bool okZ(true); double trans[3]; trans[0] = transX->text().toDouble(&okX); diff --git a/Applications/DataExplorer/main.cpp b/Applications/DataExplorer/main.cpp index 006000283bb94b187a51eb34adabf9ba4968fa2b..80f8195fda70b15ab499336c25da0e5319d39f38 100644 --- a/Applications/DataExplorer/main.cpp +++ b/Applications/DataExplorer/main.cpp @@ -50,7 +50,7 @@ int main(int argc, char* argv[]) w->loadFileOnStartUp(QCoreApplication::arguments().at(1)); } w->show(); - int returncode = a.exec(); + int returncode = QApplication::exec(); delete formatter; delete logogCout; LOGOG_SHUTDOWN(); diff --git a/Applications/DataExplorer/mainwindow.cpp b/Applications/DataExplorer/mainwindow.cpp index 313584b0a43edf43f8939bc026dd3aca4603b382..60810f90f78def314e1d2f4506a631533e12f50a 100644 --- a/Applications/DataExplorer/mainwindow.cpp +++ b/Applications/DataExplorer/mainwindow.cpp @@ -184,12 +184,18 @@ MainWindow::MainWindow(QWidget* parent /* = 0*/) : QMainWindow(parent) this->_elementModel.get(), SLOT(setElement(vtkUnstructuredGridAlgorithm const*const, unsigned))); connect(meshTabWidget->treeView, SIGNAL(elementSelected(vtkUnstructuredGridAlgorithm const*const, unsigned, bool)), meshTabWidget->elementView, SLOT(updateView())); - connect(meshTabWidget->treeView, SIGNAL(elementSelected(vtkUnstructuredGridAlgorithm const*const, unsigned, bool)), - (QObject*) (visualizationWidget->interactorStyle()), SLOT(removeHighlightActor())); + connect(meshTabWidget->treeView, + SIGNAL(elementSelected(vtkUnstructuredGridAlgorithm const* const, + unsigned, bool)), + reinterpret_cast<QObject*>(visualizationWidget->interactorStyle()), + SLOT(removeHighlightActor())); connect(meshTabWidget->treeView, SIGNAL(removeSelectedMeshComponent()), _vtkVisPipeline.get(), SLOT(removeHighlightedMeshComponent())); - connect(meshTabWidget->elementView, SIGNAL(nodeSelected(vtkUnstructuredGridAlgorithm const*const, unsigned, bool)), - (QObject*) (visualizationWidget->interactorStyle()), SLOT(removeHighlightActor())); + connect(meshTabWidget->elementView, + SIGNAL(nodeSelected(vtkUnstructuredGridAlgorithm const* const, + unsigned, bool)), + reinterpret_cast<QObject*>(visualizationWidget->interactorStyle()), + SLOT(removeHighlightActor())); connect(meshTabWidget->elementView, SIGNAL(nodeSelected(vtkUnstructuredGridAlgorithm const*const, unsigned, bool)), _vtkVisPipeline.get(), SLOT(highlightMeshComponent(vtkUnstructuredGridAlgorithm const*const, unsigned, bool))); connect(meshTabWidget->elementView, SIGNAL(removeSelectedMeshComponent()), @@ -255,7 +261,7 @@ MainWindow::MainWindow(QWidget* parent /* = 0*/) : QMainWindow(parent) connect(vtkVisTabWidget->vtkVisPipelineView, SIGNAL(actorSelected(vtkProp3D*)), - (QObject*) (visualizationWidget->interactorStyle()), + reinterpret_cast<QObject*>(visualizationWidget->interactorStyle()), SLOT(highlightActor(vtkProp3D*))); connect(_vtkVisPipeline.get(), SIGNAL(vtkVisPipelineChanged()), visualizationWidget, SLOT(updateView())); @@ -263,22 +269,29 @@ MainWindow::MainWindow(QWidget* parent /* = 0*/) : QMainWindow(parent) // Propagates selected vtk object in the pipeline to the pick interactor connect(vtkVisTabWidget->vtkVisPipelineView, SIGNAL(dataObjectSelected(vtkDataObject*)), - (QObject*) (visualizationWidget->interactorStyle()), + reinterpret_cast<QObject*>(visualizationWidget->interactorStyle()), SLOT(pickableDataObject(vtkDataObject*))); - connect((QObject*) (visualizationWidget->vtkPickCallback()), + connect(reinterpret_cast<QObject*>(visualizationWidget->vtkPickCallback()), SIGNAL(actorPicked(vtkProp3D*)), vtkVisTabWidget->vtkVisPipelineView, SLOT(selectItem(vtkProp3D*))); - connect((QObject*) (visualizationWidget->interactorStyle()), - SIGNAL(elementPicked(vtkUnstructuredGridAlgorithm const*const, const unsigned)), - this->_elementModel.get(), SLOT(setElement(vtkUnstructuredGridAlgorithm const*const, const unsigned))); - connect((QObject*) (visualizationWidget->interactorStyle()), - SIGNAL(elementPicked(vtkUnstructuredGridAlgorithm const*const, const unsigned)), + connect(reinterpret_cast<QObject*>(visualizationWidget->interactorStyle()), + SIGNAL(elementPicked(vtkUnstructuredGridAlgorithm const* const, + const unsigned)), + this->_elementModel.get(), + SLOT(setElement(vtkUnstructuredGridAlgorithm const* const, + const unsigned))); + connect(reinterpret_cast<QObject*>(visualizationWidget->interactorStyle()), + SIGNAL(elementPicked(vtkUnstructuredGridAlgorithm const* const, + const unsigned)), meshTabWidget->elementView, SLOT(updateView())); - connect((QObject*) (visualizationWidget->interactorStyle()), SIGNAL(clearElementView()), - this->_elementModel.get(), SLOT(clearView())); - connect((QObject*) (visualizationWidget->interactorStyle()), - SIGNAL(elementPicked(vtkUnstructuredGridAlgorithm const*const, const unsigned)), - this->_vtkVisPipeline.get(), SLOT(removeHighlightedMeshComponent())); + connect(reinterpret_cast<QObject*>(visualizationWidget->interactorStyle()), + SIGNAL(clearElementView()), this->_elementModel.get(), + SLOT(clearView())); + connect(reinterpret_cast<QObject*>(visualizationWidget->interactorStyle()), + SIGNAL(elementPicked(vtkUnstructuredGridAlgorithm const* const, + const unsigned)), + this->_vtkVisPipeline.get(), + SLOT(removeHighlightedMeshComponent())); connect(vtkVisTabWidget->vtkVisPipelineView, SIGNAL(meshAdded(MeshLib::Mesh*)), _meshModel.get(), SLOT(addMesh(MeshLib::Mesh*))); @@ -297,7 +310,8 @@ MainWindow::MainWindow(QWidget* parent /* = 0*/) : QMainWindow(parent) const unsigned int screenCount = desktopWidget->screenCount(); for (std::size_t i = 0; i < screenCount; ++i) { - _screenGeometries.push_back(desktopWidget->availableGeometry((int)i)); + _screenGeometries.push_back( + desktopWidget->availableGeometry(static_cast<int>(i))); } // Setup import files menu @@ -574,7 +588,8 @@ void MainWindow::loadFile(ImportFileType::type t, const QString &fileName) else if (fi.suffix().toLower() == "msh" || fi.suffix().toLower() == "vtu") { #ifndef NDEBUG - QTime myTimer0, myTimer1; + QTime myTimer0; + QTime myTimer1; myTimer0.start(); #endif std::unique_ptr<MeshLib::Mesh> mesh( diff --git a/Applications/DataHolderLib/Color.cpp b/Applications/DataHolderLib/Color.cpp index 463b4a7157f230abc0b910735a4d9e00fa76704c..adaffdf6bdfb85bda4c232822907d0926cece87f 100644 --- a/Applications/DataHolderLib/Color.cpp +++ b/Applications/DataHolderLib/Color.cpp @@ -30,7 +30,7 @@ Color getRandomColor() static_cast<unsigned char>((rand() % 5) * 50)); } -Color const getColor(const std::string &id, std::map<std::string, Color> &colors) +Color getColor(const std::string& id, std::map<std::string, Color>& colors) { auto it = colors.find(id); diff --git a/Applications/DataHolderLib/Color.h b/Applications/DataHolderLib/Color.h index 235cfa86875bc9dacf12c8ac085ed1c21b4f322a..4a24ade5790cdfbaa630eb25d0f9e3f541ae55f5 100644 --- a/Applications/DataHolderLib/Color.h +++ b/Applications/DataHolderLib/Color.h @@ -33,7 +33,7 @@ Color getRandomColor(); /// Uses a color-lookup-table (in form of a map) to return a colour for a specified name. If the name is not /// in the colortable a new entry is created with the new name and a random colour. -Color const getColor(const std::string& id, - std::map<std::string, DataHolderLib::Color>& colors); +Color getColor(const std::string& id, + std::map<std::string, DataHolderLib::Color>& colors); } // namespace DataHolderLib diff --git a/Applications/FileIO/AsciiRasterInterface.cpp b/Applications/FileIO/AsciiRasterInterface.cpp index 8c6a62f28f3c4c536ba93919d044ba83c451bbac..a5ae862a4308c3f6f554aaad01fa22d0e4196372 100644 --- a/Applications/FileIO/AsciiRasterInterface.cpp +++ b/Applications/FileIO/AsciiRasterInterface.cpp @@ -75,7 +75,8 @@ GeoLib::Raster* AsciiRasterInterface::getRasterFromASCFile(std::string const& fn bool AsciiRasterInterface::readASCHeader(std::ifstream &in, GeoLib::RasterHeader &header) { - std::string tag, value; + std::string tag; + std::string value; in >> tag; if (tag == "ncols") @@ -164,7 +165,8 @@ GeoLib::Raster* AsciiRasterInterface::getRasterFromSurferFile(std::string const& // header information GeoLib::RasterHeader header; - double min(0.0), max(0.0); + double min(0.0); + double max(0.0); if (readSurferHeader(in, header, min, max)) { diff --git a/Applications/FileIO/GMSInterface.cpp b/Applications/FileIO/GMSInterface.cpp index 052efcacdeb5043f9983db3582c8a6156dccb60b..46ebedb89c0629a8196b63f9e72054270ec28901 100644 --- a/Applications/FileIO/GMSInterface.cpp +++ b/Applications/FileIO/GMSInterface.cpp @@ -46,7 +46,9 @@ int GMSInterface::readBoreholesFromGMS(std::vector<GeoLib::Point*>* boreholes, } double depth(-9999.0); - std::string line(""), cName(""), sName(""); + std::string line; + std::string cName; + std::string sName; std::list<std::string>::const_iterator it; auto* pnt = new GeoLib::Point(); GeoLib::StationBorehole* newBorehole = nullptr; @@ -158,7 +160,7 @@ void GMSInterface::writeBoreholesToGMS( std::vector<GeoLib::Point*> profile = station->getProfile(); std::vector<std::string> soilNames = station->getSoilNames(); // std::size_t idx = 0; - std::string current_soil_name(""); + std::string current_soil_name; std::size_t nLayers = profile.size(); for (std::size_t i = 1; i < nLayers; i++) @@ -244,7 +246,7 @@ std::vector<std::string> GMSInterface::readSoilIDfromFile( MeshLib::Mesh* GMSInterface::readGMS3DMMesh(const std::string& filename) { - std::string line(""); + std::string line; std::ifstream in(filename.c_str()); if (!in.is_open()) @@ -272,7 +274,8 @@ MeshLib::Mesh* GMSInterface::readGMS3DMMesh(const std::string& filename) // elements are listed before nodes in 3dm-format, therefore // traverse file twice and read first nodes and then elements std::string dummy; - unsigned id(0), count(0); + unsigned id(0); + unsigned count(0); double x[3]; // read nodes while (std::getline(in, line)) diff --git a/Applications/FileIO/Gmsh/GMSHAdaptiveMeshDensity.cpp b/Applications/FileIO/Gmsh/GMSHAdaptiveMeshDensity.cpp index 061ba0ce1c468c21fa43a0ec548bb205d625fa8c..47da3c9957c07aa29ed0fdcd06c1efc0302b0f4c 100644 --- a/Applications/FileIO/Gmsh/GMSHAdaptiveMeshDensity.cpp +++ b/Applications/FileIO/Gmsh/GMSHAdaptiveMeshDensity.cpp @@ -50,7 +50,8 @@ void GMSHAdaptiveMeshDensity::initialize(std::vector<GeoLib::Point const*> const // *** QuadTree - determining bounding box DBUG("GMSHAdaptiveMeshDensity::init(): computing axis aligned bounding box (2D) for quadtree."); - GeoLib::Point min(*pnts[0]), max(*pnts[0]); + GeoLib::Point min(*pnts[0]); + GeoLib::Point max(*pnts[0]); std::size_t n_pnts(pnts.size()); for (std::size_t k(1); k<n_pnts; k++) { for (std::size_t j(0); j < 2; j++) @@ -96,14 +97,16 @@ void GMSHAdaptiveMeshDensity::addPoints(std::vector<GeoLib::Point const*> const& double GMSHAdaptiveMeshDensity::getMeshDensityAtPoint(GeoLib::Point const* const pnt) const { - GeoLib::Point ll, ur; + GeoLib::Point ll; + GeoLib::Point ur; _quad_tree->getLeaf(*pnt, ll, ur); return _pnt_density * (ur[0] - ll[0]); } double GMSHAdaptiveMeshDensity::getMeshDensityAtStation(GeoLib::Point const* const pnt) const { - GeoLib::Point ll, ur; + GeoLib::Point ll; + GeoLib::Point ur; _quad_tree->getLeaf(*pnt, ll, ur); return _station_density * (ur[0] - ll[0]); } @@ -122,7 +125,8 @@ void GMSHAdaptiveMeshDensity::getSteinerPoints (std::vector<GeoLib::Point*> & pn != leaf_list.end(); ++it) { if ((*it)->getPoints().empty()) { // compute point from square - GeoLib::Point ll, ur; + GeoLib::Point ll; + GeoLib::Point ur; (*it)->getSquarePoints(ll, ur); if ((*it)->getDepth() + additional_levels > max_depth) { additional_levels = max_depth - (*it)->getDepth(); @@ -152,7 +156,8 @@ void GMSHAdaptiveMeshDensity::getQuadTreeGeometry(std::vector<GeoLib::Point*> &p for (std::list<GeoLib::QuadTree<GeoLib::Point>*>::const_iterator it(leaf_list.begin()); it != leaf_list.end(); ++it) { // fetch corner points from leaf - GeoLib::Point ll, ur; + GeoLib::Point ll; + GeoLib::Point ur; (*it)->getSquarePoints(ll, ur); std::size_t const pnt_offset (pnts.size()); pnts.push_back(new GeoLib::Point(ll, pnt_offset)); diff --git a/Applications/FileIO/Gmsh/GmshReader.cpp b/Applications/FileIO/Gmsh/GmshReader.cpp index 5cfa730edf8d6f5f32cbc5b1fcbed4520d259464..cfd74fed98115808074285d69c57fe714f59402b 100644 --- a/Applications/FileIO/Gmsh/GmshReader.cpp +++ b/Applications/FileIO/Gmsh/GmshReader.cpp @@ -75,7 +75,10 @@ std::pair<MeshLib::Element*, int> readElement( std::ifstream& in, std::vector<MeshLib::Node*> const& nodes, std::map<unsigned, unsigned> const& id_map) { - unsigned idx, type, n_tags, dummy; + unsigned idx; + unsigned type; + unsigned n_tags; + unsigned dummy; int mat_id; std::vector<unsigned> node_ids; in >> idx >> type >> n_tags >> mat_id >> dummy; @@ -203,7 +206,9 @@ MeshLib::Mesh* readGMSHMesh(std::string const& fname) { std::size_t n_nodes(0); long id; - double x, y, z; + double x; + double y; + double z; in >> n_nodes >> std::ws; nodes.resize(n_nodes); for (std::size_t i = 0; i < n_nodes; i++) { diff --git a/Applications/FileIO/GocadIO/CoordinateSystem.cpp b/Applications/FileIO/GocadIO/CoordinateSystem.cpp index c8fb5ae876e4f8ca7ec3305a123db70a244aece0..cb87bc988489e6e4a4c40d766d5c92a1794ec02f 100644 --- a/Applications/FileIO/GocadIO/CoordinateSystem.cpp +++ b/Applications/FileIO/GocadIO/CoordinateSystem.cpp @@ -24,7 +24,7 @@ std::string parseName(std::string const& str) { std::string name; std::size_t const start = str.find_first_of('\"'); - if (start != str.npos) + if (start != std::string::npos) { std::size_t const end = str.find_last_of('\"'); name = str.substr(start+1, end-start-1); diff --git a/Applications/FileIO/GocadIO/GocadSGridReader.cpp b/Applications/FileIO/GocadIO/GocadSGridReader.cpp index e064baf565d0d91e341e92d564f164794e9c4266..dcdc6876b29c5284c04ba052d8887a7a0531fa5b 100644 --- a/Applications/FileIO/GocadIO/GocadSGridReader.cpp +++ b/Applications/FileIO/GocadIO/GocadSGridReader.cpp @@ -245,7 +245,9 @@ void GocadSGridReader::parseHeader(std::istream& in) void GocadSGridReader::parseDims(std::string const& line) { - std::size_t x_dim(0), y_dim(0), z_dim(0); + std::size_t x_dim(0); + std::size_t y_dim(0); + std::size_t z_dim(0); boost::tokenizer<> tok(line); auto it(tok.begin()); it++; // overread token "AXIS" diff --git a/Applications/FileIO/GocadIO/GocadTSurfaceReader.cpp b/Applications/FileIO/GocadIO/GocadTSurfaceReader.cpp index 4c09e960d25a88a7f4bd9fb2027b4a8fbd37be81..9287c5b15abcd1031df280eb2061a21b88755aca 100644 --- a/Applications/FileIO/GocadIO/GocadTSurfaceReader.cpp +++ b/Applications/FileIO/GocadIO/GocadTSurfaceReader.cpp @@ -69,7 +69,7 @@ MeshLib::Mesh* GocadTSurfaceReader::readMesh(std::ifstream& in, MeshLib::Properties mesh_prop; mesh_prop.createNewPropertyVector<int>(mat_id_name, MeshLib::MeshItemType::Cell, 1); - std::string line(""); + std::string line; while (std::getline(in, line)) { std::vector<std::string> str = BaseLib::splitString(line); @@ -135,7 +135,7 @@ MeshLib::Mesh* GocadTSurfaceReader::readMesh(std::ifstream& in, bool GocadTSurfaceReader::TSurfaceFound(std::ifstream& in) const { - std::string line(""); + std::string line; while (std::getline(in, line)) { if (line.empty() || isCommentLine(line)) @@ -172,7 +172,7 @@ bool GocadTSurfaceReader::isCommentLine(std::string const& str) const bool GocadTSurfaceReader::parseHeader(std::ifstream& in, std::string& mesh_name) { - std::string line(""); + std::string line; while (std::getline(in, line)) { if (line.substr(0, 5) == "name:") @@ -192,7 +192,7 @@ bool GocadTSurfaceReader::parseHeader(std::ifstream& in, std::string& mesh_name) bool GocadTSurfaceReader::parsePropertyClass(std::ifstream& in) const { - std::string line(""); + std::string line; while (std::getline(in, line)) { if (line.substr(0, 1) == "}") @@ -230,7 +230,7 @@ bool GocadTSurfaceReader::parseProperties(std::ifstream& in, // stored, so the stream can be set back if none of the allowed property- // related keywords is found. std::streampos pos = in.tellg(); - std::string line(""); + std::string line; while (getline(in, line)) { std::string const key = propertyCheck(line); @@ -288,7 +288,7 @@ bool GocadTSurfaceReader::parseSurface( return false; } - std::string line(""); + std::string line; while (std::getline(in, line)) { std::vector<std::string> str = BaseLib::splitString(line); @@ -341,7 +341,7 @@ bool GocadTSurfaceReader::parseNodes( std::vector<std::string> const array_names = mesh_prop.getPropertyVectorNames(); std::streampos pos = in.tellg(); - std::string line(""); + std::string line; while (std::getline(in, line)) { std::vector<std::string> str = BaseLib::splitString(line); @@ -384,7 +384,8 @@ bool GocadTSurfaceReader::parseNodes( } else if (line.substr(0, 4) == "ATOM") { - std::size_t new_id, ref_id; + std::size_t new_id; + std::size_t ref_id; std::string keyword; sstr >> keyword >> new_id >> ref_id; nodes.push_back(new MeshLib::Node(nodes[ref_id]->getCoords(), new_id)); @@ -414,7 +415,7 @@ bool GocadTSurfaceReader::parseElements( } std::streampos pos = in.tellg(); std::size_t id(0); - std::string line(""); + std::string line; while (std::getline(in, line)) { if (line.empty() || isCommentLine(line)) @@ -453,7 +454,7 @@ bool GocadTSurfaceReader::parseElements( bool GocadTSurfaceReader::skipModel3d(std::ifstream& in) const { - std::string line(""); + std::string line; while (std::getline(in, line)) { if (line == "END") diff --git a/Applications/FileIO/Legacy/OGSIOVer4.cpp b/Applications/FileIO/Legacy/OGSIOVer4.cpp index e330614a1db7ccf88158b04cf5129324dc37c8fc..8e0f81c1b476e3658000d22945d68261133718e1 100644 --- a/Applications/FileIO/Legacy/OGSIOVer4.cpp +++ b/Applications/FileIO/Legacy/OGSIOVer4.cpp @@ -63,7 +63,9 @@ std::string readPoints(std::istream &in, std::vector<GeoLib::Point*>* pnt_vec, // read id and point coordinates std::stringstream inss(line); std::size_t id; - double x, y, z; + double x; + double y; + double z; inss >> id >> x >> y >> z; if (!inss.fail ()) { @@ -123,7 +125,9 @@ void readPolylinePointVector(const std::string &fname, return; } - double x, y, z; + double x; + double y; + double z; while (in) { in >> x >> y >> z; @@ -154,7 +158,8 @@ std::string readPolyline(std::istream &in, const std::string &path, std::vector<std::string> &errors) { - std::string line, name_of_ply; + std::string line; + std::string name_of_ply; auto* ply(new GeoLib::Polyline(pnt_vec)); std::size_t type = 2; // need an initial value @@ -591,7 +596,7 @@ std::size_t writeTINSurfaces(std::ofstream &os, GeoLib::SurfaceVec const* sfcs_v os << "\t\t" << sfc_name << "\n"; // create tin file sfc_name = path + sfc_name; - GeoLib::IO::TINInterface::writeSurfaceAsTIN(*sfc, sfc_name.c_str()); + GeoLib::IO::TINInterface::writeSurfaceAsTIN(*sfc, sfc_name); sfc_count++; } return sfc_count; diff --git a/Applications/FileIO/PetrelInterface.cpp b/Applications/FileIO/PetrelInterface.cpp index 4eb9c70ac9de6c77d6efe8f5c12789eec819afb8..d28dafd00f1b3d961e19038512cdda7892324ef1 100644 --- a/Applications/FileIO/PetrelInterface.cpp +++ b/Applications/FileIO/PetrelInterface.cpp @@ -223,7 +223,16 @@ void PetrelInterface::readPetrelWellTraceData(std::istream &in) } // read points - double md, x, y, z, tvd, dx, dy, azim, incl, dls; + double md; + double x; + double y; + double z; + double tvd; + double dx; + double dy; + double azim; + double incl; + double dls; in.getline(buffer, MAX_COLS_PER_ROW); line = buffer; while (in) diff --git a/Applications/FileIO/SHPInterface.cpp b/Applications/FileIO/SHPInterface.cpp index 6e17558bccab223a8a76937a58881f9037c0cf4f..13ab0912e854a4935951282fd0567f7ea0f70412 100644 --- a/Applications/FileIO/SHPInterface.cpp +++ b/Applications/FileIO/SHPInterface.cpp @@ -43,7 +43,8 @@ bool SHPInterface::readSHPInfo(const std::string &filename, int &shapeType, int return false; } - double padfMinBound[4], padfMaxBound[4]; + double padfMinBound[4]; + double padfMaxBound[4]; // The SHPGetInfo() function retrieves various information about shapefile as a whole. // The bounds are read from the file header, and may be inaccurate if the file was improperly generated. @@ -57,8 +58,10 @@ void SHPInterface::readSHPFile(const std::string& filename, OGSType choice, const std::string& listName, std::string const& gmsh_path) { - int shapeType, numberOfElements; - double padfMinBound[4], padfMaxBound[4]; + int shapeType; + int numberOfElements; + double padfMinBound[4]; + double padfMaxBound[4]; SHPHandle hSHP = SHPOpen(filename.c_str(), "rb"); SHPGetInfo(hSHP, &numberOfElements, &shapeType, padfMinBound, padfMaxBound); diff --git a/Applications/FileIO/TetGenInterface.cpp b/Applications/FileIO/TetGenInterface.cpp index ca06f246b779aa0e03bc01a77abb73e2c12e6df0..1025ec954f4639f5a72df301c344666d40bf15ba 100644 --- a/Applications/FileIO/TetGenInterface.cpp +++ b/Applications/FileIO/TetGenInterface.cpp @@ -259,7 +259,9 @@ bool TetGenInterface::readNodesFromStream (std::ifstream &ins, { std::string line; getline (ins, line); - std::size_t n_nodes, dim, n_attributes; + std::size_t n_nodes; + std::size_t dim; + std::size_t n_attributes; bool boundary_markers; while (!ins.fail()) @@ -392,7 +394,8 @@ bool TetGenInterface::readElementsFromStream(std::ifstream &ins, { std::string line; getline (ins, line); - std::size_t n_tets, n_nodes_per_tet; + std::size_t n_tets; + std::size_t n_nodes_per_tet; bool region_attributes; while (!ins.fail()) @@ -431,7 +434,8 @@ bool TetGenInterface::parseElementsFileHeader(std::string &line, std::size_t& n_nodes_per_tet, bool& region_attribute) const { - std::size_t pos_beg, pos_end; + std::size_t pos_beg; + std::size_t pos_end; // number of tetrahedras pos_beg = line.find_first_not_of (' '); diff --git a/Applications/FileIO/XmlIO/Qt/XmlNumInterface.cpp b/Applications/FileIO/XmlIO/Qt/XmlNumInterface.cpp index 0ed53536674a47dd34221a794a1bcade9a919246..90eae86f66f3ab71bb9645674be09f2cc4c1e493 100644 --- a/Applications/FileIO/XmlIO/Qt/XmlNumInterface.cpp +++ b/Applications/FileIO/XmlIO/Qt/XmlNumInterface.cpp @@ -75,7 +75,8 @@ int XmlNumInterface::readFile(QString const& fileName) void XmlNumInterface::readLinearSolverConfiguration(QDomElement const& lin_root) { std::string const library = lin_root.attribute("Library").toStdString(); - std::string lin_solver_type, precond_type("no"); + std::string lin_solver_type; + std::string precond_type("no"); QDomElement linear_solver_node = lin_root.firstChildElement(); while (!linear_solver_node.isNull()) @@ -98,7 +99,8 @@ void XmlNumInterface::readLinearSolverConfiguration(QDomElement const& lin_root) void XmlNumInterface::readIterationScheme(QDomElement const& iteration_root) { QDomElement iteration_node = iteration_root.firstChildElement(); - int max_iterations(0), fixed_step_size(0); + int max_iterations(0); + int fixed_step_size(0); while (!iteration_node.isNull()) { @@ -120,7 +122,7 @@ void XmlNumInterface::readConvergenceCriteria(QDomElement const& convergence_roo { QDomElement conv_node = convergence_root.firstChildElement(); double error_threshold(0); - std::string error_method(""); + std::string error_method; while (!conv_node.isNull()) { diff --git a/Applications/FileIO/XmlIO/Qt/XmlPrjInterface.cpp b/Applications/FileIO/XmlIO/Qt/XmlPrjInterface.cpp index f65c3c0b1293354a070405265ceaf127dd4d1d39..008d1d711782cc766c855b173188b34cb5f22a1f 100644 --- a/Applications/FileIO/XmlIO/Qt/XmlPrjInterface.cpp +++ b/Applications/FileIO/XmlIO/Qt/XmlPrjInterface.cpp @@ -271,7 +271,9 @@ T* XmlPrjInterface::parseCondition( DataHolderLib::BaseObjType base_obj_type = DataHolderLib::BaseObjType::GEOMETRY; typename T::ConditionType type = T::ConditionType::NONE; - std::string base_obj_name(""), obj_name(""), param_name(""); + std::string base_obj_name; + std::string obj_name; + std::string param_name; QDomNode param_node = QDomNode(); QDomNodeList nodeList = node.childNodes(); for (int i = 0; i < nodeList.count(); i++) @@ -415,8 +417,8 @@ bool XmlPrjInterface::write() name.c_str()); } - if (_project.getBoundaryConditions().size() > 0 || - _project.getSourceTerms().size() > 0) + if (!_project.getBoundaryConditions().empty() || + !_project.getSourceTerms().empty()) { // parameters writeProcessVariables(doc, root); diff --git a/Applications/Utils/FileConverter/ConvertSHPToGLI.cpp b/Applications/Utils/FileConverter/ConvertSHPToGLI.cpp index a420b17ff51be041e01e076ed847af7154f0a018..5bbe450b464433bfa46dd9ac779f7c5e626d9e3d 100644 --- a/Applications/Utils/FileConverter/ConvertSHPToGLI.cpp +++ b/Applications/Utils/FileConverter/ConvertSHPToGLI.cpp @@ -105,7 +105,8 @@ void convertPoints (DBFHandle dbf_handle, void printFieldInformationTable(DBFHandle const& dbf_handle, std::size_t n_fields) { char* field_name(new char[256]); - int width(0), n_decimals(0); + int width(0); + int n_decimals(0); std::stringstream out; out << std::endl; out << "************************************************" << std::endl; @@ -122,7 +123,7 @@ void printFieldInformationTable(DBFHandle const& dbf_handle, std::size_t n_field out << " " << field_idx << " |"; } std::string field_name_str(field_name); - for (int k(0); k < (14 - (int)field_name_str.size()); k++) + for (int k(0); k < (14 - static_cast<int>(field_name_str.size())); k++) { out << " "; } @@ -173,7 +174,8 @@ int main (int argc, char* argv[]) std::string fname (shapefile_arg.getValue()); - int shape_type, number_of_elements; + int shape_type; + int number_of_elements; SHPHandle hSHP = SHPOpen(fname.c_str(),"rb"); if (hSHP) { @@ -200,7 +202,9 @@ int main (int argc, char* argv[]) std::size_t n_fields(DBFGetFieldCount(dbf_handle)); printFieldInformationTable(dbf_handle, n_fields); - std::size_t x_id, y_id, z_id; + std::size_t x_id; + std::size_t y_id; + std::size_t z_id; INFO("Please give the field idx that should be used for reading the x coordinate: "); std::cin >> x_id; INFO("Please give the field idx that should be used for reading the y coordinate: "); diff --git a/Applications/Utils/FileConverter/GocadTSurfaceReader.cpp b/Applications/Utils/FileConverter/GocadTSurfaceReader.cpp index 3754435f0f22657150747e57a34fd99d085e9726..48625b0dd28f7181908526b94310ab5a06e7e33a 100644 --- a/Applications/Utils/FileConverter/GocadTSurfaceReader.cpp +++ b/Applications/Utils/FileConverter/GocadTSurfaceReader.cpp @@ -18,7 +18,7 @@ std::string getDelim(std::string const& str) { std::size_t const bslash = str.find_first_of('\\'); - char const delim = (bslash == str.npos) ? '/' : '\\'; + char const delim = (bslash == std::string::npos) ? '/' : '\\'; return (str.back() == delim) ? "" : std::string(1, delim); } diff --git a/Applications/Utils/FileConverter/TecPlotTools.cpp b/Applications/Utils/FileConverter/TecPlotTools.cpp index 6c8a31ae22b2e283c2d5d46eb00a32cb4c31ef41..38bcb238f099cd503d3e2f1f3afca760d9715433 100644 --- a/Applications/Utils/FileConverter/TecPlotTools.cpp +++ b/Applications/Utils/FileConverter/TecPlotTools.cpp @@ -243,8 +243,10 @@ void skipGeometrySection(std::ifstream& in, std::string& line) int splitFile(std::ifstream& in, std::string file_name) { std::ofstream out; - std::string line, name; - std::size_t val_count(0), val_total(0); + std::string line; + std::string name; + std::size_t val_count(0); + std::size_t val_total(0); std::size_t write_count(0); while (std::getline(in, line)) { @@ -299,11 +301,13 @@ int splitFile(std::ifstream& in, std::string file_name) /// Converts a TecPlot file into one or more OGS-meshes (one mesh per section/zone) int convertFile(std::ifstream& in, std::string file_name) { - std::string line, name; + std::string line; + std::string name; std::pair<std::size_t, std::size_t> dims(0, 0); std::vector<std::string> var_names; std::vector<std::vector<double>> scalars; - std::size_t val_count(0), val_total(0); + std::size_t val_count(0); + std::size_t val_total(0); std::size_t write_count(0); while (std::getline(in, line)) { diff --git a/Applications/Utils/GeoTools/TriangulatePolyline.cpp b/Applications/Utils/GeoTools/TriangulatePolyline.cpp index 493439e730189cc614c8b3a9dd6fc009bb893880..66ea4231c0a5cc8f349cdb9b82293b6f12bc42f4 100644 --- a/Applications/Utils/GeoTools/TriangulatePolyline.cpp +++ b/Applications/Utils/GeoTools/TriangulatePolyline.cpp @@ -104,7 +104,7 @@ int main(int argc, char *argv[]) if (!line->isClosed()) { - std::string input (""); + std::string input; while (input != "y" && input != "Y" && input != "n" && input != "N") { input = output_question(); diff --git a/Applications/Utils/MeshEdit/NodeReordering.cpp b/Applications/Utils/MeshEdit/NodeReordering.cpp index b983c489245e5a0fe1800b75c532366e5272a60f..db72cda1060b48180d1cc4852b163fcc7a678e37 100644 --- a/Applications/Utils/MeshEdit/NodeReordering.cpp +++ b/Applications/Utils/MeshEdit/NodeReordering.cpp @@ -171,7 +171,8 @@ int main (int argc, char* argv[]) cmd.add(method_arg); cmd.parse(argc, argv); - std::unique_ptr<MeshLib::Mesh> mesh(MeshLib::IO::readMeshFromFile(input_mesh_arg.getValue().c_str())); + std::unique_ptr<MeshLib::Mesh> mesh( + MeshLib::IO::readMeshFromFile(input_mesh_arg.getValue())); if (!mesh) { @@ -197,7 +198,7 @@ int main (int argc, char* argv[]) return EXIT_FAILURE; } - MeshLib::IO::writeMeshToFile(*mesh, output_mesh_arg.getValue().c_str()); + MeshLib::IO::writeMeshToFile(*mesh, output_mesh_arg.getValue()); INFO("VTU file written."); diff --git a/Applications/Utils/MeshGeoTools/computeSurfaceNodeIDsInPolygonalRegion.cpp b/Applications/Utils/MeshGeoTools/computeSurfaceNodeIDsInPolygonalRegion.cpp index 5fcb03266f09ea4d4dc47a20a484e3950c8ff1d1..17c016a7fd2703e93f6f5e54f7977d501262470b 100644 --- a/Applications/Utils/MeshGeoTools/computeSurfaceNodeIDsInPolygonalRegion.cpp +++ b/Applications/Utils/MeshGeoTools/computeSurfaceNodeIDsInPolygonalRegion.cpp @@ -116,7 +116,7 @@ int main (int argc, char* argv[]) std::unique_ptr<MeshLib::Mesh> surface_mesh( MeshLib::MeshSurfaceExtraction::getMeshSurface(mesh, d, angle)); return MeshLib::MeshSurfaceExtraction::getSurfaceAreaForNodes( - *surface_mesh.get()); + *surface_mesh); }; std::vector<double> areas(computeElementTopSurfaceAreas(*mesh, dir, angle)); diff --git a/Applications/Utils/OGSFileConverter/FileListDialog.cpp b/Applications/Utils/OGSFileConverter/FileListDialog.cpp index 136f279e6d42d690d818309e823dd94fa252ca69..9539bae662ac7c5e0bfc61a28757d6d48314b33a 100644 --- a/Applications/Utils/OGSFileConverter/FileListDialog.cpp +++ b/Applications/Utils/OGSFileConverter/FileListDialog.cpp @@ -103,7 +103,7 @@ void FileListDialog::reject() this->done(QDialog::Rejected); } -const QString FileListDialog::getFileTypeString(FileType file_type) const +QString FileListDialog::getFileTypeString(FileType file_type) const { if (file_type == FileType::GML) { diff --git a/Applications/Utils/OGSFileConverter/FileListDialog.h b/Applications/Utils/OGSFileConverter/FileListDialog.h index 6cba6c274e00e66a02c8f7304235ad42540684ef..2e0f31af93c98d19fd5f368a92bc438487d2b593 100644 --- a/Applications/Utils/OGSFileConverter/FileListDialog.h +++ b/Applications/Utils/OGSFileConverter/FileListDialog.h @@ -46,7 +46,7 @@ public: private: /// Returns a string for the given file type enum - const QString getFileTypeString(FileType file_type) const; + QString getFileTypeString(FileType file_type) const; /// Display a warning for vtu- to msh-conversion void displayWarningLabel() const; diff --git a/Applications/Utils/OGSFileConverter/OGSFileConverter.cpp b/Applications/Utils/OGSFileConverter/OGSFileConverter.cpp index b195b57011eb6c18c6925d4b6aadc3cacf05ce87..68b67eb7efdea752ef37a79c86fe3ac64ef84323 100644 --- a/Applications/Utils/OGSFileConverter/OGSFileConverter.cpp +++ b/Applications/Utils/OGSFileConverter/OGSFileConverter.cpp @@ -148,8 +148,8 @@ void OGSFileConverter::convertVTU2MSH(const QStringList &input, const QString &o continue; } - MeshLib::Mesh const* const mesh(MeshLib::IO::VtuInterface::readVTUFile( - input_string.toStdString().c_str())); + MeshLib::Mesh const* const mesh( + MeshLib::IO::VtuInterface::readVTUFile(input_string.toStdString())); if (mesh == nullptr) { OGSError::box("Error reading mesh " + fi.fileName()); @@ -157,7 +157,7 @@ void OGSFileConverter::convertVTU2MSH(const QStringList &input, const QString &o } MeshLib::IO::Legacy::MeshIO meshIO; meshIO.setMesh(mesh); - meshIO.writeToFile(output_str.c_str()); + meshIO.writeToFile(output_str); delete mesh; } OGSError::box("File conversion finished"); diff --git a/Applications/Utils/OGSFileConverter/main.cpp b/Applications/Utils/OGSFileConverter/main.cpp index 4cece56e1f961c0f05aacafa493b330a07ff38c1..796ab01b5397270ecd028330bbc42bcea44e15eb 100644 --- a/Applications/Utils/OGSFileConverter/main.cpp +++ b/Applications/Utils/OGSFileConverter/main.cpp @@ -41,7 +41,7 @@ int main(int argc, char* argv[]) auto* fc = new OGSFileConverter(gmsh_path_arg.getValue()); fc->setWindowTitle( fc->windowTitle() ); fc->show(); - int returncode = app.exec(); + int returncode = QApplication::exec(); delete fc; return returncode; diff --git a/BaseLib/ConfigTree.cpp b/BaseLib/ConfigTree.cpp index ea5f7ee38b0910b6fde1b0c76e1c716f006effde..8a28d3958b65a3d2df5a69c60d66b876c1ac4955 100644 --- a/BaseLib/ConfigTree.cpp +++ b/BaseLib/ConfigTree.cpp @@ -316,8 +316,9 @@ void ConfigTree::checkUnique(const std::string &key) const void ConfigTree::checkUniqueAttr(const std::string &attr) const { // Workaround for handling attributes with xml namespaces and uppercase letters. - if (attr.find(':') != attr.npos) { - auto pos = decltype(attr.npos){0}; + if (attr.find(':') != std::string::npos) + { + auto pos = decltype(std::string::npos){0}; // Replace colon and uppercase letters with an allowed character 'a'. // That means, attributes containing a colon are also allowed to contain @@ -325,14 +326,16 @@ void ConfigTree::checkUniqueAttr(const std::string &attr) const auto attr2 = attr; do { pos = attr2.find_first_of(":ABCDEFGHIJKLMNOPQRSTUVWXYZ", pos); - if (pos != attr.npos) + if (pos != std::string::npos) { attr2[pos] = 'a'; } - } while (pos != attr.npos); + } while (pos != std::string::npos); checkKeyname(attr2); - } else { + } + else + { checkKeyname(attr); } diff --git a/BaseLib/FileTools.cpp b/BaseLib/FileTools.cpp index 0dbf77f2fefe263ce721d85aa6a9c5a787bafa03..34764c8e97f969a936e3721a0886012a308201fc 100644 --- a/BaseLib/FileTools.cpp +++ b/BaseLib/FileTools.cpp @@ -22,10 +22,10 @@ namespace { /// The directory where the prj file resides. -static std::string project_directory = ""; +std::string project_directory; /// Whether the project directory has already been set. -static bool project_directory_is_set = false; +bool project_directory_is_set = false; } // anonymous namespace namespace BaseLib @@ -78,7 +78,7 @@ namespace * position of the last one or std::string::npos if no file path separator was * found. */ -static + std::string::size_type findLastPathSeparator(std::string const& path) { return path.find_last_of("/\\"); @@ -87,7 +87,7 @@ std::string::size_type findLastPathSeparator(std::string const& path) /** Finds the position of last dot. * This could be used to extract file extension. */ -static + std::string::size_type findLastDot(std::string const& path) { return path.find_last_of('.'); diff --git a/ChemistryLib/Output.cpp b/ChemistryLib/Output.cpp index a904efb1bb2981091da66ac5246f6ad72303f4ad..4edac78c9c9a5c3a738aec74f77d714060fb79ec 100644 --- a/ChemistryLib/Output.cpp +++ b/ChemistryLib/Output.cpp @@ -18,17 +18,17 @@ std::ostream& operator<<(std::ostream& os, { os << "-file " << basic_output_setups.output_file << "\n"; os << "-high_precision " << std::boolalpha - << basic_output_setups.use_high_precision << "\n"; + << ChemistryLib::BasicOutputSetups::use_high_precision << "\n"; os << "-simulation " << std::boolalpha - << basic_output_setups.display_simulation_id << "\n"; - os << "-state " << std::boolalpha << basic_output_setups.display_state - << "\n"; - os << "-distance " << std::boolalpha << basic_output_setups.display_distance - << "\n"; - os << "-time " << std::boolalpha << basic_output_setups.display_current_time - << "\n"; - os << "-step " << std::boolalpha << basic_output_setups.display_time_step - << "\n"; + << ChemistryLib::BasicOutputSetups::display_simulation_id << "\n"; + os << "-state " << std::boolalpha + << ChemistryLib::BasicOutputSetups::display_state << "\n"; + os << "-distance " << std::boolalpha + << ChemistryLib::BasicOutputSetups::display_distance << "\n"; + os << "-time " << std::boolalpha + << ChemistryLib::BasicOutputSetups::display_current_time << "\n"; + os << "-step " << std::boolalpha + << ChemistryLib::BasicOutputSetups::display_time_step << "\n"; return os; } diff --git a/GeoLib/GEOObjects.cpp b/GeoLib/GEOObjects.cpp index 88ac92151b684594ed7afe7aa7a90b3ef698a9a7..f63538935e1fa832dead5b3b3262e587321cb8ec 100644 --- a/GeoLib/GEOObjects.cpp +++ b/GeoLib/GEOObjects.cpp @@ -421,9 +421,11 @@ void GEOObjects::getGeometryNames (std::vector<std::string>& names) const } } -const std::string GEOObjects::getElementNameByID(const std::string &geometry_name, GeoLib::GEOTYPE type, std::size_t id) const +std::string GEOObjects::getElementNameByID(const std::string& geometry_name, + GeoLib::GEOTYPE type, + std::size_t id) const { - std::string name(""); + std::string name; switch (type) { case GeoLib::GEOTYPE::POINT: diff --git a/GeoLib/GEOObjects.h b/GeoLib/GEOObjects.h index 0a1ecccbee6fe055c1eaa74f838480a193d85b9b..abf5218d9c737448f53ff217c299b151e9a2a4c2 100644 --- a/GeoLib/GEOObjects.h +++ b/GeoLib/GEOObjects.h @@ -219,7 +219,8 @@ public: /// Returns the names of all geometry vectors. void getGeometryNames (std::vector<std::string>& names) const; - const std::string getElementNameByID(const std::string &geometry_name, GeoLib::GEOTYPE type, std::size_t id) const; + std::string getElementNameByID(const std::string& geometry_name, + GeoLib::GEOTYPE type, std::size_t id) const; /// Returns the names of all station vectors. void getStationVectorNames(std::vector<std::string>& names) const; diff --git a/GeoLib/IO/TINInterface.cpp b/GeoLib/IO/TINInterface.cpp index b92a59f30c64b1d8df30d20ef4efb84ff76b7d38..b77dabf0df64fc5862a518409207efceb946c000 100644 --- a/GeoLib/IO/TINInterface.cpp +++ b/GeoLib/IO/TINInterface.cpp @@ -44,7 +44,9 @@ GeoLib::Surface* TINInterface::readTIN(std::string const& fname, auto* sfc = new GeoLib::Surface(*(pnt_vec.getVector())); std::size_t id; - MathLib::Point3d p0, p1, p2; + MathLib::Point3d p0; + MathLib::Point3d p1; + MathLib::Point3d p2; std::string line; while (std::getline(in, line).good()) { diff --git a/GeoLib/IO/XmlIO/Boost/BoostXmlGmlInterface.cpp b/GeoLib/IO/XmlIO/Boost/BoostXmlGmlInterface.cpp index 5c40bacbf05898dba26566f4642b9bb9dabf1ae9..69156abdc70e348d408766b6de961b713a67d78e 100644 --- a/GeoLib/IO/XmlIO/Boost/BoostXmlGmlInterface.cpp +++ b/GeoLib/IO/XmlIO/Boost/BoostXmlGmlInterface.cpp @@ -338,7 +338,7 @@ void BoostXmlGmlInterface::addSurfacesToPropertyTree( auto& surfaces_tag = geometry_set.add("surfaces", ""); for (std::size_t i=0; i<surfaces->size(); ++i) { GeoLib::Surface const*const surface((*surfaces)[i]); - std::string sfc_name(""); + std::string sfc_name; sfc_vec->getNameOfElement(surface, sfc_name); auto& surface_tag = surfaces_tag.add("surface", ""); surface_tag.put("<xmlattr>.id", i); @@ -380,7 +380,7 @@ void BoostXmlGmlInterface::addPolylinesToPropertyTree( auto& polylines_tag = geometry_set.add("polylines", ""); for (std::size_t i=0; i<polylines->size(); ++i) { GeoLib::Polyline const*const polyline((*polylines)[i]); - std::string ply_name(""); + std::string ply_name; vec->getNameOfElement(polyline, ply_name); auto& polyline_tag = polylines_tag.add("polyline", ""); polyline_tag.put("<xmlattr>.id", i); diff --git a/GeoLib/IO/XmlIO/Qt/XmlGmlInterface.cpp b/GeoLib/IO/XmlIO/Qt/XmlGmlInterface.cpp index 10f3cafb60e1e4f42a20c8d91ed0cca97f399b8f..83116584302a706726fb310cc225e7c5d86dc9e0 100644 --- a/GeoLib/IO/XmlIO/Qt/XmlGmlInterface.cpp +++ b/GeoLib/IO/XmlIO/Qt/XmlGmlInterface.cpp @@ -411,7 +411,7 @@ bool XmlGmlInterface::write() QDomElement polylineTag = doc.createElement("polyline"); polylineTag.setAttribute("id", QString::number(i)); - std::string ply_name(""); + std::string ply_name; if (ply_vec->getNameOfElementByID(i, ply_name)) { polylineTag.setAttribute("name", QString::fromStdString(ply_name)); } else { @@ -457,7 +457,7 @@ bool XmlGmlInterface::write() QDomElement surfaceTag = doc.createElement("surface"); surfaceTag.setAttribute("id", QString::number(i)); - std::string sfc_name(""); + std::string sfc_name; if (sfc_vec->getNameOfElementByID(i, sfc_name)) { surfaceTag.setAttribute( diff --git a/GeoLib/IO/XmlIO/Qt/XmlStnInterface.cpp b/GeoLib/IO/XmlIO/Qt/XmlStnInterface.cpp index 3c073f1cac857cd200d334e2794f45614f3d1fef..8e561121280d745592c6bc398aa650fb2090b188 100644 --- a/GeoLib/IO/XmlIO/Qt/XmlStnInterface.cpp +++ b/GeoLib/IO/XmlIO/Qt/XmlStnInterface.cpp @@ -101,9 +101,10 @@ void XmlStnInterface::readStations( const QDomNode &stationsRoot, station.hasAttribute("y")) { std::string stationName("[NN]"); - std::string sensor_data_file_name(""); + std::string sensor_data_file_name; std::string boreholeDate("0000-00-00"); - double boreholeDepth(0.0), stationValue(0.0); + double boreholeDepth(0.0); + double stationValue(0.0); QDomNodeList stationFeatures = station.childNodes(); for(int i = 0; i < stationFeatures.count(); i++) @@ -437,8 +438,11 @@ void XmlStnInterface::rapidReadStations(const rapidxml::xml_node<>* station_root nullptr); } - std::string station_name(""), sensor_data_file_name(""), bdate_str("0000-00-00"); - double station_value(0.0), borehole_depth(0.0); + std::string station_name; + std::string sensor_data_file_name; + std::string bdate_str("0000-00-00"); + double station_value(0.0); + double borehole_depth(0.0); if (station_node->first_node("name")) { station_name = station_node->first_node("name")->value(); diff --git a/GeoLib/IO/XmlIO/Rapid/RapidStnInterface.cpp b/GeoLib/IO/XmlIO/Rapid/RapidStnInterface.cpp index 5b3e4cce983cb1a361af439f4b6b411522074b6d..e45cdbfb9a001614a70ab6f6c712ed197c0a0e6e 100644 --- a/GeoLib/IO/XmlIO/Rapid/RapidStnInterface.cpp +++ b/GeoLib/IO/XmlIO/Rapid/RapidStnInterface.cpp @@ -153,8 +153,11 @@ void RapidStnInterface::readStations(const rapidxml::xml_node<>* station_root, s nullptr); } - std::string station_name(""), sensor_data_file_name(""), bdate_str("0000-00-00"); - double station_value(0.0), borehole_depth(0.0); + std::string station_name; + std::string sensor_data_file_name; + std::string bdate_str("0000-00-00"); + double station_value(0.0); + double borehole_depth(0.0); if (station_node->first_node("name")) { station_name = station_node->first_node("name")->value(); diff --git a/GeoLib/Polyline.cpp b/GeoLib/Polyline.cpp index 608e3cbc152e113c3d5f9ab55cf36467d4a85029..f10a3fed44c9074e91d1c06ffb4c643ec2acb8ed 100644 --- a/GeoLib/Polyline.cpp +++ b/GeoLib/Polyline.cpp @@ -248,7 +248,7 @@ std::size_t Polyline::getPointID(std::size_t i) const return _ply_pnt_ids[i]; } -LineSegment const Polyline::getSegment(std::size_t i) const +LineSegment Polyline::getSegment(std::size_t i) const { assert(i < getNumberOfSegments()); return LineSegment(_ply_pnts[_ply_pnt_ids[i]], @@ -442,7 +442,8 @@ Location Polyline::getLocationOfPoint (std::size_t k, GeoLib::Point const & pnt) double Polyline::getDistanceAlongPolyline(const MathLib::Point3d& pnt, const double epsilon_radius) const { - double dist(-1.0), lambda; + double dist(-1.0); + double lambda; bool found = false; // loop over all line segments of the polyline for (std::size_t k = 0; k < getNumberOfSegments(); k++) { @@ -508,7 +509,7 @@ Polyline::SegmentIterator& Polyline::SegmentIterator::operator++() return *this; } -LineSegment const Polyline::SegmentIterator::operator*() const +LineSegment Polyline::SegmentIterator::operator*() const { return _polyline->getSegment(_segment_number); } diff --git a/GeoLib/Polyline.h b/GeoLib/Polyline.h index dc421f526f0fea7a112174ad973c812b0a350344..2a0f111df786780b14c8de96cfbef2b08b92d205 100644 --- a/GeoLib/Polyline.h +++ b/GeoLib/Polyline.h @@ -68,7 +68,7 @@ public: SegmentIterator& operator++(); - LineSegment const operator*() const; + LineSegment operator*() const; LineSegment operator*(); @@ -239,7 +239,7 @@ protected: */ std::vector<double> _length; private: - LineSegment const getSegment(std::size_t i) const; + LineSegment getSegment(std::size_t i) const; LineSegment getSegment(std::size_t i); }; diff --git a/GeoLib/SensorData.cpp b/GeoLib/SensorData.cpp index 2283b24074d4af4ba1be813d1238285d4d4b1be5..7de16a8b5cc309ed9d93e0c3eb64bed14e9ebfe9 100644 --- a/GeoLib/SensorData.cpp +++ b/GeoLib/SensorData.cpp @@ -100,7 +100,7 @@ int SensorData::readDataFromFile(const std::string &file_name) return 0; } - std::string line(""); + std::string line; /* first line contains field names */ getline(in, line); diff --git a/MaterialLib/Adsorption/DensityHauer.cpp b/MaterialLib/Adsorption/DensityHauer.cpp index c6f5b17f72034b263d4ad6f383749cd7f17e69c5..102f1061082ebd1600b63f10972811bf78e2ad5b 100644 --- a/MaterialLib/Adsorption/DensityHauer.cpp +++ b/MaterialLib/Adsorption/DensityHauer.cpp @@ -38,7 +38,8 @@ double DensityHauer::getAdsorbateDensity(const double T_Ads) const double DensityHauer::getAlphaT(const double T_Ads) const { // data like in python script - const double T0 = 283.15, alpha0 = 3.781e-4; //K; 1/K + const double T0 = 283.15; + const double alpha0 = 3.781e-4; // K; 1/K return alpha0/(1. - alpha0 * (T_Ads-T0)); //in 1/K } diff --git a/MaterialLib/Adsorption/DensityLegacy.cpp b/MaterialLib/Adsorption/DensityLegacy.cpp index 9eda437d24eadd5d335ba97470bc0eff7a9fe8fa..0847ffdb368912227f08c9dfe3e1bb5b1a630e0a 100644 --- a/MaterialLib/Adsorption/DensityLegacy.cpp +++ b/MaterialLib/Adsorption/DensityLegacy.cpp @@ -30,7 +30,9 @@ namespace Adsorption double DensityLegacy::getAdsorbateDensity(const double T_Ads) const { //set reference state for adsorbate EOS in Hauer - const double T0 = 293.15, rho0 = 998.084, alpha0 = 2.06508e-4; // K; kg/m^3; 1/K + const double T0 = 293.15; + const double rho0 = 998.084; + const double alpha0 = 2.06508e-4; // K; kg/m^3; 1/K return (rho0 * (1. - alpha0 * (T_Ads-T0))); // in kg/m^3 } @@ -39,7 +41,8 @@ double DensityLegacy::getAdsorbateDensity(const double T_Ads) const double DensityLegacy::getAlphaT(const double T_Ads) const { //set reference state for adsorbate EOS in Hauer - const double T0 = 293.15, alpha0 = 2.06508e-4; // K; 1/K + const double T0 = 293.15; + const double alpha0 = 2.06508e-4; // K; 1/K return (alpha0/(1. - alpha0 * (T_Ads-T0))); // in 1/K } diff --git a/MathLib/LinAlg/Eigen/EigenLinearSolver.cpp b/MathLib/LinAlg/Eigen/EigenLinearSolver.cpp index bf204a4aa81fa23bff1df59a83091ab69c2455f9..80cce5b11344bc4756018ee685163e33a1a60de0 100644 --- a/MathLib/LinAlg/Eigen/EigenLinearSolver.cpp +++ b/MathLib/LinAlg/Eigen/EigenLinearSolver.cpp @@ -236,12 +236,12 @@ void EigenLinearSolver::setOption(BaseLib::ConfigTree const& option) if (auto solver_type = //! \ogs_file_param{prj__linear_solvers__linear_solver__eigen__solver_type} ptSolver->getConfigParameterOptional<std::string>("solver_type")) { - _option.solver_type = _option.getSolverType(*solver_type); + _option.solver_type = MathLib::EigenOption::getSolverType(*solver_type); } if (auto precon_type = //! \ogs_file_param{prj__linear_solvers__linear_solver__eigen__precon_type} ptSolver->getConfigParameterOptional<std::string>("precon_type")) { - _option.precon_type = _option.getPreconType(*precon_type); + _option.precon_type = MathLib::EigenOption::getPreconType(*precon_type); } if (auto error_tolerance = //! \ogs_file_param{prj__linear_solvers__linear_solver__eigen__error_tolerance} diff --git a/MeshGeoToolsLib/GeoMapper.cpp b/MeshGeoToolsLib/GeoMapper.cpp index f8bd85cdfefc6ffde6ce95db2faf7b3ab961ffe0..8a0c0bbe8e6f4ea250dea56a1968beff14dedf55 100644 --- a/MeshGeoToolsLib/GeoMapper.cpp +++ b/MeshGeoToolsLib/GeoMapper.cpp @@ -75,10 +75,8 @@ void GeoMapper::mapOnMesh(MeshLib::Mesh const*const mesh) // the variable _surface_mesh is reused below, so first the existing // _surface_mesh has to be cleaned up - if (_surface_mesh) - { + delete _surface_mesh; - } if (mesh->getDimension() < 3) { @@ -125,7 +123,8 @@ void GeoMapper::mapToConstantValue(double value) void GeoMapper::mapStationData(std::vector<GeoLib::Point*> const& points) { - double min_val(0), max_val(0); + double min_val(0); + double max_val(0); if (_surface_mesh) { GeoLib::AABB bounding_box( @@ -460,7 +459,8 @@ static bool snapPointToElementNode(MathLib::Point3d& p, MeshLib::Element const& elem, double rel_eps) { // values will be initialized within computeSqrNodeDistanceRange - double sqr_min, sqr_max; + double sqr_min; + double sqr_max; elem.computeSqrNodeDistanceRange(sqr_min, sqr_max); double const sqr_eps(rel_eps*rel_eps * sqr_min); @@ -575,10 +575,9 @@ static void mapPolylineOnSurfaceMesh( void GeoMapper::advancedMapOnMesh(MeshLib::Mesh const& mesh) { // 1. extract surface - if (_surface_mesh) - { + delete _surface_mesh; - } + if (mesh.getDimension()<3) { _surface_mesh = new MeshLib::Mesh(mesh); } else { diff --git a/MeshGeoToolsLib/HeuristicSearchLength.cpp b/MeshGeoToolsLib/HeuristicSearchLength.cpp index ae9e5a221dfa04f7a60900e91f4265230f9c29ac..d82154815950b2249af6645bbf0b24a8b9724b40 100644 --- a/MeshGeoToolsLib/HeuristicSearchLength.cpp +++ b/MeshGeoToolsLib/HeuristicSearchLength.cpp @@ -42,7 +42,8 @@ HeuristicSearchLength::HeuristicSearchLength(MeshLib::Mesh const& mesh, LengthTy n_sampling += n_edges; } } else { - double min=0, max=0; + double min = 0; + double max = 0; for (const MeshLib::Element* e : elements) { e->computeSqrNodeDistanceRange(min, max, true); sum += std::sqrt(min); diff --git a/MeshLib/IO/Legacy/MeshIO.cpp b/MeshLib/IO/Legacy/MeshIO.cpp index e3c8398c59da82543e8816a0ddf977bab93eae9d..6407bf73d38858c73715d272c132762a1fb97794 100644 --- a/MeshLib/IO/Legacy/MeshIO.cpp +++ b/MeshLib/IO/Legacy/MeshIO.cpp @@ -50,7 +50,7 @@ MeshLib::Mesh* MeshIO::loadMeshFromFile(const std::string& file_name) return nullptr; } - std::string line_string (""); + std::string line_string; getline(in, line_string); std::vector<MeshLib::Node*> nodes; @@ -70,7 +70,10 @@ MeshLib::Mesh* MeshIO::loadMeshFromFile(const std::string& file_name) } if (line_string.find("$NODES") != std::string::npos) { - double x, y, z, double_dummy; + double x; + double y; + double z; + double double_dummy; unsigned idx; getline(in, line_string); BaseLib::trim(line_string); @@ -156,7 +159,8 @@ MeshLib::Mesh* MeshIO::loadMeshFromFile(const std::string& file_name) std::size_t MeshIO::readMaterialID(std::istream & in) const { - unsigned index, material_id; + unsigned index; + unsigned material_id; if (!(in >> index >> material_id)) { return std::numeric_limits<std::size_t>::max(); @@ -167,7 +171,7 @@ std::size_t MeshIO::readMaterialID(std::istream & in) const MeshLib::Element* MeshIO::readElement(std::istream& in, const std::vector<MeshLib::Node*> &nodes) const { - std::string elem_type_str(""); + std::string elem_type_str; MeshLib::MeshElemType elem_type (MeshLib::MeshElemType::INVALID); do { diff --git a/MeshLib/MeshEditing/MeshRevision.cpp b/MeshLib/MeshEditing/MeshRevision.cpp index 6a7fbbe704389ed14ebdb4f986e544a0c288e062..6adaa3e3d743f3f42fdab27dc68014f7ebfbe239 100644 --- a/MeshLib/MeshEditing/MeshRevision.cpp +++ b/MeshLib/MeshEditing/MeshRevision.cpp @@ -677,7 +677,6 @@ void MeshRevision::reducePyramid(MeshLib::Element const*const org_elem, { new_elements.push_back(this->constructLine(org_elem, nodes)); } - return; } unsigned MeshRevision::reducePrism(MeshLib::Element const*const org_elem, @@ -901,8 +900,8 @@ unsigned MeshRevision::lutHexDiametralNode(unsigned id) const return _hex_diametral_nodes[id]; } -const std::array<unsigned,4> MeshRevision::lutHexCuttingQuadNodes( - unsigned id1, unsigned id2) const +std::array<unsigned, 4> MeshRevision::lutHexCuttingQuadNodes(unsigned id1, + unsigned id2) const { std::array<unsigned,4> nodes; if (id1==0 && id2==1) { nodes[0]=3; nodes[1]=2; nodes[2]=5; nodes[3]=4; } @@ -933,8 +932,10 @@ const std::array<unsigned,4> MeshRevision::lutHexCuttingQuadNodes( return nodes; } -const std::pair<unsigned, unsigned> MeshRevision::lutHexBackNodes( - unsigned i, unsigned j, unsigned k, unsigned l) const +std::pair<unsigned, unsigned> MeshRevision::lutHexBackNodes(unsigned i, + unsigned j, + unsigned k, + unsigned l) const { // collapsed edges are *not* connected std::pair<unsigned, unsigned> back(std::numeric_limits<unsigned>::max(), std::numeric_limits<unsigned>::max()); diff --git a/MeshLib/MeshEditing/MeshRevision.h b/MeshLib/MeshEditing/MeshRevision.h index 82095682011c986e65554ffacee3c30668d4a529..95db540e3347d1ce7d5dec72b5fd5ccd9555671b 100644 --- a/MeshLib/MeshEditing/MeshRevision.h +++ b/MeshLib/MeshEditing/MeshRevision.h @@ -175,11 +175,12 @@ private: unsigned lutHexDiametralNode(unsigned id) const; /// Lookup-table for returning four nodes connected to the two nodes (id1, id2) forming an edge in a Hex - const std::array<unsigned,4> lutHexCuttingQuadNodes(unsigned id1, unsigned id2) const; + std::array<unsigned, 4> lutHexCuttingQuadNodes(unsigned id1, + unsigned id2) const; /// When a hex is subdivided into two prisms, this returns the nodes of the hex edge that will serve as the back of one of the prisms. - const std::pair<unsigned, unsigned> lutHexBackNodes( - unsigned i, unsigned j, unsigned k, unsigned l) const; + std::pair<unsigned, unsigned> lutHexBackNodes(unsigned i, unsigned j, + unsigned k, unsigned l) const; /// Lookup-table for returning the third node of bottom or top triangle given the other two unsigned lutPrismThirdNode(unsigned id1, unsigned id2) const; diff --git a/MeshLib/MeshEnums.cpp b/MeshLib/MeshEnums.cpp index 0f7ddefbaa6edb3c95a8de6a28d2e4adea90bb5d..4befd970b056177388bfa421e2dcaa3dcc76a874 100644 --- a/MeshLib/MeshEnums.cpp +++ b/MeshLib/MeshEnums.cpp @@ -15,8 +15,7 @@ #include "MeshEnums.h" namespace MeshLib { - -const std::string MeshElemType2String(const MeshElemType t) +std::string MeshElemType2String(const MeshElemType t) { if (t == MeshElemType::POINT) { @@ -53,7 +52,7 @@ const std::string MeshElemType2String(const MeshElemType t) return "none"; } -const std::string MeshElemType2StringShort(const MeshElemType t) +std::string MeshElemType2StringShort(const MeshElemType t) { if (t == MeshElemType::POINT) { @@ -151,7 +150,7 @@ std::vector<std::string> getMeshElemTypeStringsShort() return vec; } -const std::string CellType2String(const CellType t) +std::string CellType2String(const CellType t) { #define RETURN_CELL_TYPE_STR(t, type)\ if ((t) == CellType::type)\ @@ -180,7 +179,7 @@ const std::string CellType2String(const CellType t) #undef RETURN_CELL_TYPE_STR } -const std::string MeshQualityType2String(const MeshQualityType t) +std::string MeshQualityType2String(const MeshQualityType t) { if (t == MeshQualityType::ELEMENTSIZE) { diff --git a/MeshLib/MeshEnums.h b/MeshLib/MeshEnums.h index 20f48c0cbd229f8059349e5bc6faa1bc8159f037..637edd1b37db8b3b00a8952d9d47802d172dd1aa 100644 --- a/MeshLib/MeshEnums.h +++ b/MeshLib/MeshEnums.h @@ -87,10 +87,10 @@ enum class UseIntensityAs }; /// Given a MeshElemType this returns the appropriate string. -const std::string MeshElemType2String(const MeshElemType t); +std::string MeshElemType2String(const MeshElemType t); /// Given a MeshElemType this returns the appropriate string with a short name. -const std::string MeshElemType2StringShort(const MeshElemType t); +std::string MeshElemType2StringShort(const MeshElemType t); /// Given a string of the shortened name of the element type, this returns the corresponding MeshElemType. MeshElemType String2MeshElemType(const std::string &s); @@ -102,8 +102,8 @@ std::vector<MeshElemType> getMeshElemTypes(); std::vector<std::string> getMeshElemTypeStringsShort(); /// Given a MeshElemType this returns the appropriate string. -const std::string CellType2String(const CellType t); +std::string CellType2String(const CellType t); -const std::string MeshQualityType2String(const MeshQualityType t); +std::string MeshQualityType2String(const MeshQualityType t); } // namespace MeshLib diff --git a/MeshLib/MeshGenerators/LayeredMeshGenerator.cpp b/MeshLib/MeshGenerators/LayeredMeshGenerator.cpp index 91e3fc302f5ede69b8989f24ed6d4015eb3b4fba..dbca74b4f1ba10cae44653b56bd8f9676e45cc8a 100644 --- a/MeshLib/MeshGenerators/LayeredMeshGenerator.cpp +++ b/MeshLib/MeshGenerators/LayeredMeshGenerator.cpp @@ -68,10 +68,10 @@ LayeredMeshGenerator::getMesh(std::string const& mesh_name) const WARN ("Skipping MaterialID information, number of entries does not match element number"); std::unique_ptr<MeshLib::Mesh> result(new MeshLib::Mesh(mesh_name, _nodes, _elements, properties)); - MeshLib::NodeSearch ns(*result.get()); + MeshLib::NodeSearch ns(*result); if (ns.searchUnused() > 0) { - std::unique_ptr<MeshLib::Mesh> new_mesh(MeshLib::removeNodes( - *result.get(), ns.getSearchedNodeIDs(), mesh_name)); + std::unique_ptr<MeshLib::Mesh> new_mesh( + MeshLib::removeNodes(*result, ns.getSearchedNodeIDs(), mesh_name)); return new_mesh; } return result; diff --git a/MeshLib/MeshGenerators/MeshLayerMapper.cpp b/MeshLib/MeshGenerators/MeshLayerMapper.cpp index 84ce5900ad10268106d8b7cf2b98fdb7c051a3df..fa132c35b6e34f05909c622e25d9eba75c42073a 100644 --- a/MeshLib/MeshGenerators/MeshLayerMapper.cpp +++ b/MeshLib/MeshGenerators/MeshLayerMapper.cpp @@ -217,7 +217,8 @@ void MeshLayerMapper::addLayerToMesh(const MeshLib::Mesh &dem_mesh, unsigned lay { continue; } - unsigned node_counter(3), missing_idx(0); + unsigned node_counter(3); + unsigned missing_idx(0); std::array<MeshLib::Node*, 6> new_elem_nodes; for (unsigned j=0; j<3; ++j) { diff --git a/MeshLib/MeshGenerators/VtkMeshConverter.cpp b/MeshLib/MeshGenerators/VtkMeshConverter.cpp index ad773365b1e417956c15a4ff3b0512329f30f344..2d2a167a29632bab3cef6182b0d8ba4f072e7e7b 100644 --- a/MeshLib/MeshGenerators/VtkMeshConverter.cpp +++ b/MeshLib/MeshGenerators/VtkMeshConverter.cpp @@ -346,7 +346,6 @@ void VtkMeshConverter::convertArray(vtkDataArray& array, "Array '%s' in VTU file uses unsupported data type '%s'. The data " "array will not be available.", array.GetName(), array.GetDataTypeAsString()); - return; } } // end namespace MeshLib diff --git a/MeshLib/MeshInformation.cpp b/MeshLib/MeshInformation.cpp index e3b60aa2ba568bd9799a349d5d99e6449eb69333..90ede41009e0807fc4b3e8764cdd0289716078f8 100644 --- a/MeshLib/MeshInformation.cpp +++ b/MeshLib/MeshInformation.cpp @@ -17,13 +17,13 @@ namespace MeshLib { -const GeoLib::AABB MeshInformation::getBoundingBox(const MeshLib::Mesh& mesh) +GeoLib::AABB MeshInformation::getBoundingBox(const MeshLib::Mesh& mesh) { const std::vector<MeshLib::Node*>& nodes(mesh.getNodes()); return GeoLib::AABB(nodes.begin(), nodes.end()); } -const std::array<unsigned, 7> MeshInformation::getNumberOfElementTypes( +std::array<unsigned, 7> MeshInformation::getNumberOfElementTypes( const MeshLib::Mesh& mesh) { std::array<unsigned, 7> n_element_types = {{0, 0, 0, 0, 0, 0, 0}}; diff --git a/MeshLib/MeshInformation.h b/MeshLib/MeshInformation.h index 4a4415fc3d56bdb8a4015df26d8d460a6a958fdf..47a07263ae295072b387d469c2a311eec7a452a7 100644 --- a/MeshLib/MeshInformation.h +++ b/MeshLib/MeshInformation.h @@ -57,7 +57,7 @@ public: } /// Returns the bounding box of the mesh. - static const GeoLib::AABB getBoundingBox(const MeshLib::Mesh& mesh); + static GeoLib::AABB getBoundingBox(const MeshLib::Mesh& mesh); /** * Returns an array with the number of elements of each type in the given @@ -68,7 +68,7 @@ public: * 5: \#pyramids * 6: \#prisms */ - static const std::array<unsigned, 7> getNumberOfElementTypes( + static std::array<unsigned, 7> getNumberOfElementTypes( const MeshLib::Mesh& mesh); }; diff --git a/MeshLib/MeshQuality/AngleSkewMetric.cpp b/MeshLib/MeshQuality/AngleSkewMetric.cpp index 7b2969bdab87aa77d32e8029cc3245a170558b8b..172ece572197722abdb1199ceabc44df9828799c 100644 --- a/MeshLib/MeshQuality/AngleSkewMetric.cpp +++ b/MeshLib/MeshQuality/AngleSkewMetric.cpp @@ -69,7 +69,8 @@ double AngleSkewMetric::checkTriangle (Element const& elem) const double const* const node1 (elem.getNode(1)->getCoords()); double const* const node2 (elem.getNode(2)->getCoords()); - double min_angle (two_pi), max_angle (0.0); + double min_angle(two_pi); + double max_angle(0.0); getMinMaxAngleFromTriangle (node0, node1, node2, min_angle, max_angle); return 1.0 - diff --git a/MeshLib/MeshQuality/MeshValidation.cpp b/MeshLib/MeshQuality/MeshValidation.cpp index b17ba5f48678360b1bf1fbe40ef906cc23763d07..1e8260fd63a718b2ad90a92a3dc501bdcefc9d52 100644 --- a/MeshLib/MeshQuality/MeshValidation.cpp +++ b/MeshLib/MeshQuality/MeshValidation.cpp @@ -41,8 +41,11 @@ MeshValidation::MeshValidation(MeshLib::Mesh &mesh) MeshRevision rev(mesh); INFO ("Found %d potentially collapsable nodes.", rev.getNumberOfCollapsableNodes()); - const std::vector<ElementErrorCode> codes (this->testElementGeometry(mesh)); - std::array<std::string, static_cast<std::size_t>(ElementErrorFlag::MaxValue)> output_str (this->ElementErrorCodeOutput(codes)); + const std::vector<ElementErrorCode> codes( + MeshLib::MeshValidation::testElementGeometry(mesh)); + std::array<std::string, + static_cast<std::size_t>(ElementErrorFlag::MaxValue)> + output_str(MeshLib::MeshValidation::ElementErrorCodeOutput(codes)); for (auto & i : output_str) INFO (i.c_str()); } @@ -124,7 +127,7 @@ MeshValidation::ElementErrorCodeOutput(const std::vector<ElementErrorCode> &erro for (std::size_t i = 0; i < nErrorFlags; ++i) { unsigned count(0); - std::string elementIdStr(""); + std::string elementIdStr; for (std::size_t j = 0; j < nElements; ++j) { diff --git a/MeshLib/MeshQuality/RadiusEdgeRatioMetric.cpp b/MeshLib/MeshQuality/RadiusEdgeRatioMetric.cpp index 20d061d3cd4c721dd8e132d1a2176ccbfbc68673..c6c796ab0d33caf5d479b61d9112ff787c537cc7 100644 --- a/MeshLib/MeshQuality/RadiusEdgeRatioMetric.cpp +++ b/MeshLib/MeshQuality/RadiusEdgeRatioMetric.cpp @@ -35,7 +35,8 @@ void RadiusEdgeRatioMetric::calculateQuality () std::vector<MathLib::Point3d*> pnts(n_nodes); std::copy_n(elem.getNodes(), n_nodes, pnts.begin()); GeoLib::MinimalBoundingSphere const s(pnts); - double min, max; + double min; + double max; elem.computeSqrEdgeLengthRange(min, max); _element_quality_metric[k] = sqrt(min)/(2*s.getRadius()); } diff --git a/MeshLib/MeshSurfaceExtraction.cpp b/MeshLib/MeshSurfaceExtraction.cpp index c5c3fc76df3a49a2c5b2565902336d25d687ccfd..efb18203dc6912aa0a46aecc2bbffe8c4310fc05 100644 --- a/MeshLib/MeshSurfaceExtraction.cpp +++ b/MeshLib/MeshSurfaceExtraction.cpp @@ -402,7 +402,8 @@ bool MeshSurfaceExtraction::createSfcMeshProperties( return false; } - std::size_t vectors_copied(0), vectors_skipped(0); + std::size_t vectors_copied(0); + std::size_t vectors_skipped(0); std::vector<std::string> const& array_names = properties.getPropertyVectorNames(); for (std::string const& name : array_names) diff --git a/ProcessLib/CompareJacobiansJacobianAssembler.cpp b/ProcessLib/CompareJacobiansJacobianAssembler.cpp index f762e486d5826a928efff805e995708ac7103ff5..851ae0237a2f2ae5c366a96d9d83672b3e93f63e 100644 --- a/ProcessLib/CompareJacobiansJacobianAssembler.cpp +++ b/ProcessLib/CompareJacobiansJacobianAssembler.cpp @@ -115,7 +115,7 @@ void dump_py(std::ostream& fh, std::string const& var, } //! Will be printed if some consistency error is detected. -static const std::string msg_fatal = +const std::string msg_fatal = "The local matrices M or K or the local vectors b assembled with the two " "different Jacobian assemblers differ."; @@ -154,8 +154,10 @@ void CompareJacobiansJacobianAssembler::assembleWithJacobian( auto const local_K1 = to_mat(local_K_data); auto const local_b1 = MathLib::toVector(local_b_data); - std::vector<double> local_M_data2, local_K_data2, local_b_data2, - local_Jac_data2; + std::vector<double> local_M_data2; + std::vector<double> local_K_data2; + std::vector<double> local_b_data2; + std::vector<double> local_Jac_data2; // Second assembly -- used for checking only. _asm2->assembleWithJacobian(local_assembler, t, local_x, local_xdot, diff --git a/ProcessLib/ComponentTransport/CreateComponentTransportProcess.cpp b/ProcessLib/ComponentTransport/CreateComponentTransportProcess.cpp index 5cd48c7cc73958ab2b6a14dd01585126554f0aa1..ed8751c9fe10327a78aacd0557236ba4dec8f2aa 100644 --- a/ProcessLib/ComponentTransport/CreateComponentTransportProcess.cpp +++ b/ProcessLib/ComponentTransport/CreateComponentTransportProcess.cpp @@ -139,7 +139,7 @@ std::unique_ptr<Process> createComponentTransportProcess( std::vector<double> const b = //! \ogs_file_param{prj__processes__process__ComponentTransport__specific_body_force} config.getConfigParameter<std::vector<double>>("specific_body_force"); - assert(b.size() > 0 && b.size() < 4); + assert(!b.empty() && b.size() < 4); if (b.size() < mesh.getDimension()) { OGS_FATAL( diff --git a/ProcessLib/HeatTransportBHE/BHE/BHE_1U.cpp b/ProcessLib/HeatTransportBHE/BHE/BHE_1U.cpp index d7ce1ffc0f50397118ef012e880d074010dfcdda..f66583fa68845ae5eb7dd2db505f8e9d2cd829bc 100644 --- a/ProcessLib/HeatTransportBHE/BHE/BHE_1U.cpp +++ b/ProcessLib/HeatTransportBHE/BHE/BHE_1U.cpp @@ -223,7 +223,8 @@ std::array<double, BHE_1U::number_of_unknowns> BHE_1U::calcThermalResistances( d0) / (2.0 * pi * lambda_g); - double R_gg, R_gs; + double R_gg; + double R_gs; std::tie(R_gg, R_gs) = thermalResistancesGroutSoil(chi, R_ar, R_g); return {{R_fig, R_fog, R_gg, R_gs}}; diff --git a/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.cpp b/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.cpp index 7aaf7e23fc5863061c3866a5f65bd6c9c14853f8..4c76df32dd93205d97e34125531aee8defca5182 100644 --- a/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.cpp +++ b/ProcessLib/LIE/HydroMechanics/HydroMechanicsProcess.cpp @@ -536,7 +536,8 @@ void HydroMechanicsProcess<GlobalDim>::computeSecondaryVariableConcrete( return w_n + b0(/*time independent*/ 0, x)[0]; }; - Eigen::VectorXd g(GlobalDim), w(GlobalDim); + Eigen::VectorXd g(GlobalDim); + Eigen::VectorXd w(GlobalDim); for (MeshLib::Node const* node : _vec_fracture_nodes) { auto const node_id = node->getID(); diff --git a/ProcessLib/RichardsComponentTransport/CreateRichardsComponentTransportProcess.cpp b/ProcessLib/RichardsComponentTransport/CreateRichardsComponentTransportProcess.cpp index 102f2a73eb2d01784b25658e3bb3f5df948bfebb..8a7212e781417406a9e7cf40748e6e491730e475 100644 --- a/ProcessLib/RichardsComponentTransport/CreateRichardsComponentTransportProcess.cpp +++ b/ProcessLib/RichardsComponentTransport/CreateRichardsComponentTransportProcess.cpp @@ -136,7 +136,7 @@ std::unique_ptr<Process> createRichardsComponentTransportProcess( std::vector<double> const b = //! \ogs_file_param{prj__processes__process__RichardsComponentTransport__specific_body_force} config.getConfigParameter<std::vector<double>>("specific_body_force"); - assert(b.size() > 0 && b.size() < 4); + assert(!b.empty() && b.size() < 4); if (b.size() < mesh.getDimension()) { OGS_FATAL( diff --git a/ProcessLib/RichardsFlow/CreateRichardsFlowProcess.cpp b/ProcessLib/RichardsFlow/CreateRichardsFlowProcess.cpp index 69ae467085d299ddfe59cf916a245204fb430114..bf594cf99e5d7d55fb57ff8e040612a44a902905 100644 --- a/ProcessLib/RichardsFlow/CreateRichardsFlowProcess.cpp +++ b/ProcessLib/RichardsFlow/CreateRichardsFlowProcess.cpp @@ -64,7 +64,7 @@ std::unique_ptr<Process> createRichardsFlowProcess( std::vector<double> const b = //! \ogs_file_param{prj__processes__process__RICHARDS_FLOW__specific_body_force} config.getConfigParameter<std::vector<double>>("specific_body_force"); - assert(b.size() > 0 && b.size() < 4); + assert(!b.empty() && b.size() < 4); Eigen::VectorXd specific_body_force(b.size()); bool const has_gravity = MathLib::toVector(b).norm() > 0; if (has_gravity) diff --git a/ProcessLib/TES/TESReactionAdaptor.cpp b/ProcessLib/TES/TESReactionAdaptor.cpp index d1fe25da245f0ff8f10ea8b7e6696526c50fabac..32b696f1febd1a309687152f28f7c8887235d362 100644 --- a/ProcessLib/TES/TESReactionAdaptor.cpp +++ b/ProcessLib/TES/TESReactionAdaptor.cpp @@ -361,13 +361,14 @@ ReactionRate TESFEMReactionAdaptorCaOH2::initReaction(const unsigned int int_pt) double rho_react; // cut off when limits are reached - if (y_new[0] < _react.rho_low) + if (y_new[0] < ProcessLib::TES::TESFEMReactionAdaptorCaOH2::React::rho_low) { - rho_react = _react.rho_low; + rho_react = ProcessLib::TES::TESFEMReactionAdaptorCaOH2::React::rho_low; } - else if (y_new[0] > _react.rho_up) + else if (y_new[0] > + ProcessLib::TES::TESFEMReactionAdaptorCaOH2::React::rho_up) { - rho_react = _react.rho_up; + rho_react = ProcessLib::TES::TESFEMReactionAdaptorCaOH2::React::rho_up; } else { diff --git a/ProcessLib/ThermalTwoPhaseFlowWithPP/CreateThermalTwoPhaseFlowWithPPProcess.cpp b/ProcessLib/ThermalTwoPhaseFlowWithPP/CreateThermalTwoPhaseFlowWithPPProcess.cpp index 2ecc9baa56aa7c996f4542e387b0c7dbe3b890a2..0bc966ec4f17b8cc11d17fee8b326c0e6bcd58c7 100644 --- a/ProcessLib/ThermalTwoPhaseFlowWithPP/CreateThermalTwoPhaseFlowWithPPProcess.cpp +++ b/ProcessLib/ThermalTwoPhaseFlowWithPP/CreateThermalTwoPhaseFlowWithPPProcess.cpp @@ -68,7 +68,7 @@ std::unique_ptr<Process> createThermalTwoPhaseFlowWithPPProcess( std::vector<double> const b = //! \ogs_file_param{prj__processes__process__TWOPHASE_FLOW_THERMAL__specific_body_force} config.getConfigParameter<std::vector<double>>("specific_body_force"); - assert(b.size() > 0 && b.size() < 4); + assert(!b.empty() && b.size() < 4); Eigen::VectorXd specific_body_force(b.size()); bool const has_gravity = MathLib::toVector(b).norm() > 0; if (has_gravity) diff --git a/Tests/FileIO_Qt/TestVtkRaster.cpp b/Tests/FileIO_Qt/TestVtkRaster.cpp index 7c8cefce58bddb5c711daea93a342c5951b29544..a5a8a1243b2546ce07759f257b146e3c14e5c0c7 100644 --- a/Tests/FileIO_Qt/TestVtkRaster.cpp +++ b/Tests/FileIO_Qt/TestVtkRaster.cpp @@ -25,7 +25,9 @@ TEST(TestVtkRaster, TestPNGReader) { std::string name = BaseLib::BuildInfo::data_path + "/FileIO/testraster.png"; - double x0, y0, delta; + double x0; + double y0; + double delta; vtkSmartPointer<vtkImageAlgorithm> img = VtkRaster::loadImage(name, x0, y0, delta); img->Update(); @@ -52,7 +54,9 @@ TEST(TestVtkRaster, TestASCReader) { std::string name = BaseLib::BuildInfo::data_path + "/MeshGeoToolsLib/Hamburg/00-raster.asc"; - double x0, y0, delta; + double x0; + double y0; + double delta; vtkSmartPointer<vtkImageAlgorithm> img = VtkRaster::loadImage(name, x0, y0, delta); img->Update(); diff --git a/Tests/GeoLib/TestGrid.cpp b/Tests/GeoLib/TestGrid.cpp index 5bead1d26864640e208287a29cb74f3bfca91515..712ce3b37ffe9c940f99378d5f25ca70328ebe29 100644 --- a/Tests/GeoLib/TestGrid.cpp +++ b/Tests/GeoLib/TestGrid.cpp @@ -46,7 +46,9 @@ TEST(GeoLib, InsertTwoPointsInGrid) TEST(GeoLib, InsertManyPointsInGrid) { - const std::size_t i_max(100), j_max(100), k_max(100); + const std::size_t i_max(100); + const std::size_t j_max(100); + const std::size_t k_max(100); std::vector<GeoLib::Point*> pnts(i_max*j_max*k_max); // fill the vector with points @@ -94,7 +96,9 @@ TEST(GeoLib, SearchNearestPointInGrid) TEST(GeoLib, SearchNearestPointsInDenseGrid) { - const std::size_t i_max(50), j_max(50), k_max(50); + const std::size_t i_max(50); + const std::size_t j_max(50); + const std::size_t k_max(50); std::vector<GeoLib::Point*> pnts(i_max*j_max*k_max); // fill the vector with equi-distant points in the diff --git a/Tests/GeoLib/TestSurfaceIsPointInSurface.cpp b/Tests/GeoLib/TestSurfaceIsPointInSurface.cpp index 85820584715f333f0880349faa7f306942bd6884..876069c7079436d07cb76aea2352c30bbdda72f2 100644 --- a/Tests/GeoLib/TestSurfaceIsPointInSurface.cpp +++ b/Tests/GeoLib/TestSurfaceIsPointInSurface.cpp @@ -156,7 +156,9 @@ TEST(GeoLib, SurfaceIsPointInSurface) } // test edge middle points of the triangles for (std::size_t k(0); k<sfc->getNumberOfTriangles(); ++k) { - MathLib::Point3d p, q, r; + MathLib::Point3d p; + MathLib::Point3d q; + MathLib::Point3d r; std::tie(p,q,r) = getEdgeMiddlePoints(*(*sfc)[k]); EXPECT_TRUE(sfc->isPntInSfc(p, eps)); EXPECT_TRUE(sfc->isPntInSfc(q, eps)); diff --git a/Tests/MathLib/TestEigenCSR.cpp b/Tests/MathLib/TestEigenCSR.cpp index 9fb4a852f2a17c8f6367b2b5fbae1f623d3ba11f..2e49ebd1d52f89cf9fd8edb326bddfd8bcddac2e 100644 --- a/Tests/MathLib/TestEigenCSR.cpp +++ b/Tests/MathLib/TestEigenCSR.cpp @@ -98,7 +98,8 @@ TEST(MathLibEigen, Eigen2CSR) int* col = mat.innerIndexPtr(); double* data = mat.valuePtr(); - for (int r=0; r<(int) nrows; ++r) { + for (int r = 0; r < nrows; ++r) + { EXPECT_EQ(ia[r], ptr[r]); } diff --git a/Tests/MathLib/TestPiecewiseLinearInterpolation.cpp b/Tests/MathLib/TestPiecewiseLinearInterpolation.cpp index b50ecf633d4e39201ff1ff6f35e762ce3939c98a..d667d08cf4d9240e5b6852e4f5e0cb70982236e8 100644 --- a/Tests/MathLib/TestPiecewiseLinearInterpolation.cpp +++ b/Tests/MathLib/TestPiecewiseLinearInterpolation.cpp @@ -22,7 +22,8 @@ TEST(MathLibInterpolationAlgorithms, PiecewiseLinearInterpolation) { const std::size_t size(1000); - std::vector<double> supp_pnts, values; + std::vector<double> supp_pnts; + std::vector<double> values; for (std::size_t k(0); k < size; ++k) { supp_pnts.push_back(static_cast<double>(k)); @@ -75,7 +76,8 @@ TEST(MathLibInterpolationAlgorithms, PiecewiseLinearInterpolationSupportPntsInReverseOrder) { const std::size_t size(1000); - std::vector<double> supp_pnts, values; + std::vector<double> supp_pnts; + std::vector<double> values; for (std::size_t k(0); k < size; ++k) { supp_pnts.push_back(static_cast<double>(size - 1 - k)); @@ -127,7 +129,8 @@ TEST(MathLibInterpolationAlgorithms, TEST(MathLibInterpolationAlgorithms, PiecewiseLinearInterpolationDerivative) { const std::size_t size(1000); - std::vector<double> supp_pnts, values; + std::vector<double> supp_pnts; + std::vector<double> values; for (std::size_t k(0); k < size; ++k) { supp_pnts.push_back(static_cast<double>(k)); diff --git a/Tests/MeshLib/TestMoveMeshNodes.cpp b/Tests/MeshLib/TestMoveMeshNodes.cpp index 0d8d51078961a71441d054d20a67014b9bd16719..46e23e321593935258460212fcdd9498f5843ac6 100644 --- a/Tests/MeshLib/TestMoveMeshNodes.cpp +++ b/Tests/MeshLib/TestMoveMeshNodes.cpp @@ -23,7 +23,8 @@ TEST(MeshLib, moveMeshNodes) std::size_t const size (16384); - std::vector<MeshLib::Node*> nodes, nodes_copy; + std::vector<MeshLib::Node*> nodes; + std::vector<MeshLib::Node*> nodes_copy; nodes.resize(size); nodes_copy.resize(size); diff --git a/Tests/MeshLib/TestQuadraticMesh.cpp b/Tests/MeshLib/TestQuadraticMesh.cpp index e4d2e9545b5e46300bab610fa27b277dbd0cdea4..6b0335ad2ed07134a64f7bb2f5601806e14069cf 100644 --- a/Tests/MeshLib/TestQuadraticMesh.cpp +++ b/Tests/MeshLib/TestQuadraticMesh.cpp @@ -27,7 +27,7 @@ TEST(MeshLib, QuadraticOrderMesh_Line) std::unique_ptr<Mesh> linear_mesh(MeshGenerator::generateLineMesh( 1, std::size_t(2))); - std::unique_ptr<Mesh> mesh(createQuadraticOrderMesh(*linear_mesh.get())); + std::unique_ptr<Mesh> mesh(createQuadraticOrderMesh(*linear_mesh)); ASSERT_EQ(5u, mesh->getNumberOfNodes()); ASSERT_EQ(3u, mesh->getNumberOfBaseNodes()); ASSERT_EQ(2u, mesh->getNumberOfElements()); @@ -70,7 +70,7 @@ TEST(MeshLib, QuadraticOrderMesh_Quad) std::unique_ptr<Mesh> linear_mesh(MeshGenerator::generateRegularQuadMesh( 1, 1, std::size_t(2), std::size_t(2))); - std::unique_ptr<Mesh> mesh(createQuadraticOrderMesh(*linear_mesh.get())); + std::unique_ptr<Mesh> mesh(createQuadraticOrderMesh(*linear_mesh)); ASSERT_EQ(21u, mesh->getNumberOfNodes()); ASSERT_EQ(9u, mesh->getNumberOfBaseNodes()); ASSERT_EQ(4u, mesh->getNumberOfElements()); @@ -138,7 +138,8 @@ TEST(MeshLib, QuadraticOrderMesh_LineQuad) plys->push_back(ply); GeoLib::PolylineVec ply_vec("", std::move(plys)); - linear_mesh = MeshGeoToolsLib::appendLinesAlongPolylines(*linear_quad_mesh.get(), ply_vec); + linear_mesh = MeshGeoToolsLib::appendLinesAlongPolylines( + *linear_quad_mesh, ply_vec); for (auto p : pnts) { @@ -147,7 +148,7 @@ TEST(MeshLib, QuadraticOrderMesh_LineQuad) } ASSERT_EQ(6u, linear_mesh->getNumberOfElements()); - std::unique_ptr<Mesh> mesh(createQuadraticOrderMesh(*linear_mesh.get())); + std::unique_ptr<Mesh> mesh(createQuadraticOrderMesh(*linear_mesh)); ASSERT_EQ(21u, mesh->getNumberOfNodes()); ASSERT_EQ(9u, mesh->getNumberOfBaseNodes()); ASSERT_EQ(6u, mesh->getNumberOfElements()); diff --git a/Tests/MeshLib/TestRasterToMesh.cpp b/Tests/MeshLib/TestRasterToMesh.cpp index 1c812d9c0aa96676fea83f1eac9a5eae8b7ff749..fc633bfb59f559d8514a9c5c01d5bc754c19d471 100644 --- a/Tests/MeshLib/TestRasterToMesh.cpp +++ b/Tests/MeshLib/TestRasterToMesh.cpp @@ -270,7 +270,9 @@ TEST_F(RasterToMeshTest, convertRasterToQuadMeshNone) #ifdef OGS_BUILD_GUI TEST_F(RasterToMeshTest, vtkImage) { - double x0, y0, spacing; + double x0; + double y0; + double spacing; vtkImageAlgorithm* raster = VtkRaster::loadImage(_file_name, x0, y0, spacing); double origin[3]; diff --git a/Tests/NumLib/TestFemIntegration.cpp b/Tests/NumLib/TestFemIntegration.cpp index 6c2bd8a1650b53d364fefb37f50c66bf2aaab231..9cd72ec4a21a75fc1187e1cfe1dfaf9cad5b516f 100644 --- a/Tests/NumLib/TestFemIntegration.cpp +++ b/Tests/NumLib/TestFemIntegration.cpp @@ -30,14 +30,12 @@ TEST(NumLib, FemIntegrationGaussLegendreRegular) std::size_t expected[1] = { 0u }; ASSERT_ARRAY_EQ(expected, IntegrationGaussLegendreRegular<1>::getPositionIndices( - integrationOrder, 0) - .data(), + integrationOrder, 0), 1u); expected[0] = 1u; ASSERT_ARRAY_EQ(expected, IntegrationGaussLegendreRegular<1>::getPositionIndices( - integrationOrder, 1) - .data(), + integrationOrder, 1), 1u); } // dim = 2 @@ -45,28 +43,24 @@ TEST(NumLib, FemIntegrationGaussLegendreRegular) std::size_t expected[2] = { 0u, 0u }; ASSERT_ARRAY_EQ(expected, IntegrationGaussLegendreRegular<2>::getPositionIndices( - integrationOrder, 0) - .data(), + integrationOrder, 0), 2); expected[1] = 1u; ASSERT_ARRAY_EQ(expected, IntegrationGaussLegendreRegular<2>::getPositionIndices( - integrationOrder, 1) - .data(), + integrationOrder, 1), 2); expected[0] = 1u; expected[1] = 0u; ASSERT_ARRAY_EQ(expected, IntegrationGaussLegendreRegular<2>::getPositionIndices( - integrationOrder, 2) - .data(), + integrationOrder, 2), 2); expected[0] = 1u; expected[1] = 1u; ASSERT_ARRAY_EQ(expected, IntegrationGaussLegendreRegular<2>::getPositionIndices( - integrationOrder, 3) - .data(), + integrationOrder, 3), 2); } // dim = 3 @@ -82,8 +76,7 @@ TEST(NumLib, FemIntegrationGaussLegendreRegular) ASSERT_ARRAY_EQ( expected, IntegrationGaussLegendreRegular<3>::getPositionIndices( - integrationOrder, l) - .data(), + integrationOrder, l), 3); } } diff --git a/Tests/NumLib/TestSparsityPattern.cpp b/Tests/NumLib/TestSparsityPattern.cpp index 419c54a4e2c6e9d57375339ad27de3f0f04ad90b..404a7f549be7159618798a803820541a399210af 100644 --- a/Tests/NumLib/TestSparsityPattern.cpp +++ b/Tests/NumLib/TestSparsityPattern.cpp @@ -33,7 +33,7 @@ TEST(NumLib_SparsityPattern, DISABLED_SingleComponentLinearMesh) std::move(components), NumLib::ComponentOrder::BY_COMPONENT); - GlobalSparsityPattern sp = NumLib::computeSparsityPattern(dof_map, *mesh.get()); + GlobalSparsityPattern sp = NumLib::computeSparsityPattern(dof_map, *mesh); ASSERT_EQ(4u, sp.size()); EXPECT_EQ(2u, sp[0]); @@ -60,7 +60,7 @@ TEST(NumLib_SparsityPattern, DISABLED_SingleComponentQuadraticMesh) std::move(components), NumLib::ComponentOrder::BY_COMPONENT); - GlobalSparsityPattern sp = NumLib::computeSparsityPattern(dof_map, *mesh.get()); + GlobalSparsityPattern sp = NumLib::computeSparsityPattern(dof_map, *mesh); ASSERT_EQ(7u, sp.size()); EXPECT_EQ(3u, sp[0]); @@ -88,7 +88,7 @@ TEST(NumLib_SparsityPattern, DISABLED_MultipleComponentsLinearMesh) std::move(components), NumLib::ComponentOrder::BY_COMPONENT); - GlobalSparsityPattern sp = NumLib::computeSparsityPattern(dof_map, *mesh.get()); + GlobalSparsityPattern sp = NumLib::computeSparsityPattern(dof_map, *mesh); ASSERT_EQ(8u, sp.size()); for (int i=0; i<2; i++) @@ -123,7 +123,7 @@ TEST(NumLib_SparsityPattern, DISABLED_MultipleComponentsLinearQuadraticMesh) std::move(components), NumLib::ComponentOrder::BY_COMPONENT); - GlobalSparsityPattern sp = NumLib::computeSparsityPattern(dof_map, *mesh.get()); + GlobalSparsityPattern sp = NumLib::computeSparsityPattern(dof_map, *mesh); ASSERT_EQ(11u, sp.size()); // 1st component diff --git a/Tests/ProcessLib/TestJacobianAssembler.cpp b/Tests/ProcessLib/TestJacobianAssembler.cpp index 9b63e22baedb49a870ee050bb402b7d37ddbce5c..6c33226d7d5b59f234964b7adf129dcbfefe6e49 100644 --- a/Tests/ProcessLib/TestJacobianAssembler.cpp +++ b/Tests/ProcessLib/TestJacobianAssembler.cpp @@ -477,8 +477,10 @@ struct ProcessLibCentralDifferencesJacobianAssembler : public ::testing::Test static void test() { // these four local variables will be filled randomly - std::vector<double> x, xdot; - double dxdot_dx, dx_dx; + std::vector<double> x; + std::vector<double> xdot; + double dxdot_dx; + double dx_dx; std::random_device rd; std::mt19937 random_number_generator(rd()); @@ -513,8 +515,14 @@ private: double const eps = std::numeric_limits<double>::epsilon(); - std::vector<double> M_data_cd, K_data_cd, b_data_cd, Jac_data_cd, - M_data_ana, K_data_ana, b_data_ana, Jac_data_ana; + std::vector<double> M_data_cd; + std::vector<double> K_data_cd; + std::vector<double> b_data_cd; + std::vector<double> Jac_data_cd; + std::vector<double> M_data_ana; + std::vector<double> K_data_ana; + std::vector<double> b_data_ana; + std::vector<double> Jac_data_ana; double const t = 0.0; jac_asm_cd.assembleWithJacobian(loc_asm, t, x, xdot, dxdot_dx, dx_dx, M_data_cd,