diff --git a/Applications/ApplicationsLib/ProjectData.cpp b/Applications/ApplicationsLib/ProjectData.cpp index 9dd8e4c06ebfb2b728c59bae1ee3542ed22dd81f..30808b73ccfef717bb79c51be7ca1b7891a8e2f6 100644 --- a/Applications/ApplicationsLib/ProjectData.cpp +++ b/Applications/ApplicationsLib/ProjectData.cpp @@ -151,14 +151,14 @@ std::vector<MeshLib::Mesh*>::iterator ProjectData::findMeshByName( const MeshLib::Mesh* ProjectData::getMesh(const std::string& name) const { - std::vector<MeshLib::Mesh*>::const_iterator it = findMeshByName(name); + auto it = findMeshByName(name); return (it == _mesh_vec.end() ? nullptr : *it); } bool ProjectData::removeMesh(const std::string& name) { bool mesh_found = false; - std::vector<MeshLib::Mesh*>::iterator it = findMeshByName(name); + auto it = findMeshByName(name); while (it != _mesh_vec.end()) { delete *it; @@ -195,9 +195,7 @@ bool ProjectData::isMeshNameUniqueAndProvideUniqueName(std::string& name) const if (count > 1) cpName = cpName + "-" + std::to_string(count); - for (std::vector<MeshLib::Mesh*>::const_iterator it = _mesh_vec.begin(); - it != _mesh_vec.end(); - ++it) + for (auto it = _mesh_vec.begin(); it != _mesh_vec.end(); ++it) if (cpName.compare((*it)->getName()) == 0) isUnique = false; } diff --git a/Applications/DataExplorer/Base/CheckboxDelegate.cpp b/Applications/DataExplorer/Base/CheckboxDelegate.cpp index 4c34a87244de0ed022a4cd29eede8d9a60e7a2d7..3da3aa9a9e65e5b91268cbaa9f62bedd7f4c0dcb 100644 --- a/Applications/DataExplorer/Base/CheckboxDelegate.cpp +++ b/Applications/DataExplorer/Base/CheckboxDelegate.cpp @@ -57,7 +57,7 @@ bool CheckboxDelegate::editorEvent(QEvent* event, QAbstractItemModel* model, if ((event->type() == QEvent::MouseButtonRelease) || (event->type() == QEvent::MouseButtonDblClick)) { - QMouseEvent* mouse_event = static_cast<QMouseEvent*>(event); + auto* mouse_event = static_cast<QMouseEvent*>(event); if (mouse_event->button() != Qt::LeftButton || !checkboxRect(option).contains(mouse_event->pos())) return false; diff --git a/Applications/DataExplorer/Base/TreeModel.cpp b/Applications/DataExplorer/Base/TreeModel.cpp index 2791690d995a130ea3fb39c14f35af0e636d1f08..1017e9c21dffdda2b857c521942a43269811c68a 100644 --- a/Applications/DataExplorer/Base/TreeModel.cpp +++ b/Applications/DataExplorer/Base/TreeModel.cpp @@ -75,7 +75,7 @@ QModelIndex TreeModel::parent(const QModelIndex &index) const if (!index.isValid()) return QModelIndex(); - TreeItem* childItem = static_cast<TreeItem*>(index.internalPointer()); + auto* childItem = static_cast<TreeItem*>(index.internalPointer()); TreeItem* parentItem = childItem->parentItem(); if (parentItem == _rootItem) @@ -127,7 +127,7 @@ QVariant TreeModel::data(const QModelIndex &index, int role) const if (role == Qt::EditRole || role == Qt::DisplayRole) { - TreeItem* item = static_cast<TreeItem*>(index.internalPointer()); + auto* item = static_cast<TreeItem*>(index.internalPointer()); return item->data(index.column()); } @@ -142,7 +142,7 @@ bool TreeModel::setData( const QModelIndex &index, const QVariant &value, int ro if (role == Qt::EditRole) { - TreeItem* item = static_cast<TreeItem*>(index.internalPointer()); + auto* item = static_cast<TreeItem*>(index.internalPointer()); item->setData(index.column(), value); return true; } @@ -163,7 +163,7 @@ TreeItem* TreeModel::getItem(const QModelIndex &index) const { if (index.isValid()) { - TreeItem* item = static_cast<TreeItem*>(index.internalPointer()); + auto* item = static_cast<TreeItem*>(index.internalPointer()); if (item) return item; } diff --git a/Applications/DataExplorer/DataView/AddLayerToMeshDialog.cpp b/Applications/DataExplorer/DataView/AddLayerToMeshDialog.cpp index 7b67fcf2e2bd9c960143175a5c2c22a098f10679..16d6ec7af1343cf7ce1ceb3e408d619408bc320f 100644 --- a/Applications/DataExplorer/DataView/AddLayerToMeshDialog.cpp +++ b/Applications/DataExplorer/DataView/AddLayerToMeshDialog.cpp @@ -22,7 +22,7 @@ AddLayerToMeshDialog::AddLayerToMeshDialog(QDialog* parent) { setupUi(this); - StrictDoubleValidator* thickness_validator = new StrictDoubleValidator(0, 1000000, 7, this); + auto* thickness_validator = new StrictDoubleValidator(0, 1000000, 7, this); this->thicknessEdit->setValidator (thickness_validator); } diff --git a/Applications/DataExplorer/DataView/ColorTableModel.cpp b/Applications/DataExplorer/DataView/ColorTableModel.cpp index 80964b2009600c02609a6113d51e0313fb83884a..f7a6d986d3f5a1482b01a53d12e7e266b8585569 100644 --- a/Applications/DataExplorer/DataView/ColorTableModel.cpp +++ b/Applications/DataExplorer/DataView/ColorTableModel.cpp @@ -80,7 +80,7 @@ bool ColorTableModel::buildTable(const std::map<std::string, DataHolderLib::Colo int count = 0; beginInsertRows(QModelIndex(), 0, colorLookupTable.size() - 1); - for (std::map<std::string, DataHolderLib::Color*>::const_iterator it = colorLookupTable.begin(); + for (auto it = colorLookupTable.begin(); it != colorLookupTable.end(); ++it) { QColor color((*(it->second))[0], (*(it->second))[1], (*(it->second))[2]); diff --git a/Applications/DataExplorer/DataView/CondFromRasterDialog.cpp b/Applications/DataExplorer/DataView/CondFromRasterDialog.cpp index fb824f120652825c9186b3a8d39391940291878d..93b0a3f2df535beca66eed7500bed28dd00e3fda 100644 --- a/Applications/DataExplorer/DataView/CondFromRasterDialog.cpp +++ b/Applications/DataExplorer/DataView/CondFromRasterDialog.cpp @@ -32,7 +32,7 @@ CondFromRasterDialog::CondFromRasterDialog(const std::vector<MeshLib::Mesh*> &ms this->scalingEdit->setText("1.0"); this->scalingEdit->setValidator (_scale_validator); - for (std::vector<MeshLib::Mesh*>::const_iterator it = _msh_vec.begin(); it != _msh_vec.end(); ++it) + for (auto it = _msh_vec.begin(); it != _msh_vec.end(); ++it) this->meshBox->addItem(QString::fromStdString((*it)->getName())); this->directButton->setChecked(true); @@ -105,7 +105,7 @@ void CondFromRasterDialog::accept() OGSError::box("No valid scaling factor given."); return; } - MeshLib::Mesh* new_mesh = const_cast<MeshLib::Mesh*>(mesh); + auto* new_mesh = const_cast<MeshLib::Mesh*>(mesh); DirectConditionGenerator dcg; direct_values = dcg.directWithSurfaceIntegration(*new_mesh, raster_name, scaling_factor); diff --git a/Applications/DataExplorer/DataView/CreateStructuredGridDialog.cpp b/Applications/DataExplorer/DataView/CreateStructuredGridDialog.cpp index d47b7cf4cb7e2e647b72c6f053727c2b8f48f142..8315f36de4414163ac955f573efa4f8e3a98e85c 100644 --- a/Applications/DataExplorer/DataView/CreateStructuredGridDialog.cpp +++ b/Applications/DataExplorer/DataView/CreateStructuredGridDialog.cpp @@ -31,25 +31,25 @@ CreateStructuredGridDialog::CreateStructuredGridDialog(QDialog* parent) : QDialo void CreateStructuredGridDialog::setValidators() { - StrictDoubleValidator* origin_x_validator = new StrictDoubleValidator(this); + auto* origin_x_validator = new StrictDoubleValidator(this); this->xOriginEdit->setValidator (origin_x_validator); - StrictDoubleValidator* origin_y_validator = new StrictDoubleValidator(this); + auto* origin_y_validator = new StrictDoubleValidator(this); this->yOriginEdit->setValidator (origin_y_validator); - StrictDoubleValidator* origin_z_validator = new StrictDoubleValidator(this); + auto* origin_z_validator = new StrictDoubleValidator(this); this->zOriginEdit->setValidator (origin_z_validator); - StrictDoubleValidator* x_length_validator = new StrictDoubleValidator(0, 10000000, 10, this); + auto* x_length_validator = new StrictDoubleValidator(0, 10000000, 10, this); this->xLengthEdit->setValidator (x_length_validator); - StrictDoubleValidator* y_length_validator = new StrictDoubleValidator(0, 10000000, 10, this); + auto* y_length_validator = new StrictDoubleValidator(0, 10000000, 10, this); this->yLengthEdit->setValidator (y_length_validator); - StrictDoubleValidator* z_length_validator = new StrictDoubleValidator(0, 10000000, 10, this); + auto* z_length_validator = new StrictDoubleValidator(0, 10000000, 10, this); this->zLengthEdit->setValidator (z_length_validator); - QIntValidator* x_n_elem_validator = new QIntValidator(1, 10000000, this); + auto* x_n_elem_validator = new QIntValidator(1, 10000000, this); this->xElemEdit->setValidator (x_n_elem_validator); - QIntValidator* y_n_elem_validator = new QIntValidator(1, 10000000, this); + auto* y_n_elem_validator = new QIntValidator(1, 10000000, this); this->yElemEdit->setValidator (y_n_elem_validator); - QIntValidator* z_n_elem_validator = new QIntValidator(1, 10000000, this); + auto* z_n_elem_validator = new QIntValidator(1, 10000000, this); this->zElemEdit->setValidator (z_n_elem_validator); } diff --git a/Applications/DataExplorer/DataView/DiagramView/DetailWindow.cpp b/Applications/DataExplorer/DataView/DiagramView/DetailWindow.cpp index d2ae112c9e7bacbb33b2efe9f1b35692eb273745..dfff7acf165fc9868cdfbb5e5a20e66b1f1066cf 100644 --- a/Applications/DataExplorer/DataView/DiagramView/DetailWindow.cpp +++ b/Applications/DataExplorer/DataView/DiagramView/DetailWindow.cpp @@ -97,7 +97,7 @@ DetailWindow::DetailWindow(std::vector<std::size_t> data, QWidget* parent) : QWi for (std::size_t i=0; i<nEntries; i++) list_data.push_back(std::pair<float, float>(static_cast<float>(i), static_cast<float>(data[i]))); - DiagramList* list = new DiagramList(); + auto* list = new DiagramList(); list->setList(list_data); list->setXUnit("Value"); list->setYUnit("Amount"); @@ -145,7 +145,7 @@ void DetailWindow::on_addDataButton_clicked() { QDir dir = QDir(fileName); settings.setValue("lastOpenedFileDirectory", dir.absolutePath()); - DiagramPrefsDialog* prefs = new DiagramPrefsDialog(fileName, this); + auto* prefs = new DiagramPrefsDialog(fileName, this); prefs->setAttribute(Qt::WA_DeleteOnClose); prefs->show(); } diff --git a/Applications/DataExplorer/DataView/DiagramView/DiagramList.cpp b/Applications/DataExplorer/DataView/DiagramView/DiagramList.cpp index 1d0f320c8f13bf6cc1b17c47ad4c1d468de28cec..8cf1e554a9b18eea0c16eb7e488d08849847b3d9 100644 --- a/Applications/DataExplorer/DataView/DiagramView/DiagramList.cpp +++ b/Applications/DataExplorer/DataView/DiagramView/DiagramList.cpp @@ -162,7 +162,7 @@ int DiagramList::readList(const QString &path, std::vector<DiagramList*> &lists) fields.takeFirst(); for (int i = 0; i < nLists; i++) { - DiagramList* l = new DiagramList; + auto* l = new DiagramList; l->setName(fields.takeFirst()); //value = strtod(BaseLib::replaceStringreplaceString(",", ".", fields.takeFirst().toStdString()).c_str(),0); //l->setStartDate(startDate); @@ -256,7 +256,7 @@ int DiagramList::readList(const SensorData* data, std::vector<DiagramList*> &lis for (int i = 0; i < nLists; i++) { - DiagramList* l = new DiagramList; + auto* l = new DiagramList; l->setName(QString::fromStdString(SensorData::convertSensorDataType2String(time_series_names[i]))); l->setXLabel("Time"); lists.push_back(l); diff --git a/Applications/DataExplorer/DataView/DiagramView/DiagramPrefsDialog.cpp b/Applications/DataExplorer/DataView/DiagramView/DiagramPrefsDialog.cpp index 4269f58b5ae13ee13a4d1a51591685705bd24a23..8b2508c24eec976d202e1e3dac69a7a863916fd6 100644 --- a/Applications/DataExplorer/DataView/DiagramView/DiagramPrefsDialog.cpp +++ b/Applications/DataExplorer/DataView/DiagramView/DiagramPrefsDialog.cpp @@ -154,7 +154,7 @@ int DiagramPrefsDialog::loadList(const std::vector< std::pair<QDateTime, float> { if (!coords.empty()) { - DiagramList* l = new DiagramList; + auto* l = new DiagramList; l->setName(stationTypeLabel->text() + ": " + stationNameLabel->text()); l->setXLabel("Time"); //l->setYLabel("Water Level"); diff --git a/Applications/DataExplorer/DataView/DiagramView/DiagramScene.cpp b/Applications/DataExplorer/DataView/DiagramView/DiagramScene.cpp index 44d83a2af422c720d07ede83a41b6c44108a47c8..3a2780daad48c73c3b57c68b2be4fd8fa670290f 100644 --- a/Applications/DataExplorer/DataView/DiagramView/DiagramScene.cpp +++ b/Applications/DataExplorer/DataView/DiagramView/DiagramScene.cpp @@ -70,7 +70,7 @@ DiagramScene::~DiagramScene() /// Adds an arrow object to the diagram which might be used as a coordinate axis, etc. QArrow* DiagramScene::addArrow(float length, float angle, QPen &pen) { - QArrow* arrow = new QArrow(length, angle, 8, 5, pen); + auto* arrow = new QArrow(length, angle, 8, 5, pen); addItem(arrow); return arrow; } @@ -78,7 +78,7 @@ QArrow* DiagramScene::addArrow(float length, float angle, QPen &pen) /// Adds a caption for a graph beneath the actual diagram. void DiagramScene::addCaption(const QString &name, QPen &pen) { - QGraphicsItemGroup* caption = new QGraphicsItemGroup(nullptr); + auto* caption = new QGraphicsItemGroup(nullptr); QGraphicsLineItem* l = addLine(0,0,100,0,pen); QGraphicsTextItem* t = addText(name); l->setPos(0,0); @@ -123,7 +123,7 @@ QGraphicsGrid* DiagramScene::addGrid(const QRectF &rect, int xTicks, int yTicks, QNonScalableGraphicsTextItem* DiagramScene::addNonScalableText(const QString &text, const QFont &font) { - QNonScalableGraphicsTextItem* item = new QNonScalableGraphicsTextItem(text); + auto* item = new QNonScalableGraphicsTextItem(text); item->setFont(font); addItem(item); return item; @@ -206,8 +206,9 @@ void DiagramScene::constructGrid() { for (int i = 0; i <= numXTicks; ++i) { - int x = static_cast<int>(_bounds.left() / _scaleX + - (i * (_bounds.width() / _scaleX) / numXTicks)); + auto x = + static_cast<int>(_bounds.left() / _scaleX + + (i * (_bounds.width() / _scaleX) / numXTicks)); _xTicksText.push_back(addNonScalableText(QString::number(x))); _xTicksText.last()->setPos(x * _scaleX, _bounds.bottom() + 15); } @@ -216,10 +217,12 @@ void DiagramScene::constructGrid() { for (int i = 0; i <= numXTicks; ++i) { - int x = static_cast<int>(_bounds.left() / _scaleX + - (i * (_bounds.width() / _scaleX) / numXTicks)); + auto x = + static_cast<int>(_bounds.left() / _scaleX + + (i * (_bounds.width() / _scaleX) / numXTicks)); QDateTime currentDate = _startDate.addSecs(x); - _xTicksText.push_back(addNonScalableText(currentDate.toString("dd.MM.yyyy"))); + _xTicksText.push_back( + addNonScalableText(currentDate.toString("dd.MM.yyyy"))); _xTicksText.last()->setPos(x * _scaleX, _bounds.bottom() + 15); } } @@ -346,8 +349,8 @@ void DiagramScene::update() for (int i = 0; i < _graphs.size(); i++) { rect = _graphs[i]->boundingRect(); - int offset = static_cast<int>(fabs(rect.bottom() - _bounds.bottom()) - - fabs(rect.top() - _bounds.top())); + auto offset = static_cast<int>(fabs(rect.bottom() - _bounds.bottom()) - + fabs(rect.top() - _bounds.top())); _graphs[i]->setPos(0, offset); rect = itemsBoundingRect(); diff --git a/Applications/DataExplorer/DataView/DiagramView/QArrow.cpp b/Applications/DataExplorer/DataView/DiagramView/QArrow.cpp index f5ade2350d394179eac3ba92daf6495ae30d2594..0d5b46d668f4f299ff5b85f26bd978f75376fcad 100644 --- a/Applications/DataExplorer/DataView/DiagramView/QArrow.cpp +++ b/Applications/DataExplorer/DataView/DiagramView/QArrow.cpp @@ -99,10 +99,10 @@ void QArrow::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QW double theta2 = (ddeltaX < 0.0) ? (theta + PI) : theta; int lengthdeltaX = -static_cast<int>(cos(theta2) * _headLength); int lengthdeltaY = -static_cast<int>(sin(theta2) * _headLength); - int widthdeltaX = static_cast<int>(sin(theta2) * _headWidth); - int widthdeltaY = static_cast<int>(cos(theta2) * _headWidth); - int deltaX = static_cast<int>(ddeltaX); - int deltaY = static_cast<int>(ddeltaY); + auto widthdeltaX = static_cast<int>(sin(theta2) * _headWidth); + auto widthdeltaY = static_cast<int>(cos(theta2) * _headWidth); + auto deltaX = static_cast<int>(ddeltaX); + auto deltaY = static_cast<int>(ddeltaY); painter->setPen(_arrowPen); painter->drawLine(0, 0, deltaX, deltaY); painter->drawLine(deltaX, diff --git a/Applications/DataExplorer/DataView/DiagramView/QGraphicsGrid.cpp b/Applications/DataExplorer/DataView/DiagramView/QGraphicsGrid.cpp index 1b22b24a9d17a5a9dbc3b396f9bcbf401798094b..67678f9563234d12897d896f47bbd0017a4f8eca 100644 --- a/Applications/DataExplorer/DataView/DiagramView/QGraphicsGrid.cpp +++ b/Applications/DataExplorer/DataView/DiagramView/QGraphicsGrid.cpp @@ -167,9 +167,8 @@ void QGraphicsGrid::paint(QPainter* painter, /* draw horizontal lines */ for (int i = 0; i <= _numberOfXCells; ++i) { - int x = - static_cast<int>(_bounds.left() + - (i * (_bounds.width() - 1) / _numberOfXCells)); + auto x = static_cast<int>( + _bounds.left() + (i * (_bounds.width() - 1) / _numberOfXCells)); if (i > 0 && i < _numberOfXCells) { @@ -191,9 +190,8 @@ void QGraphicsGrid::paint(QPainter* painter, /* draw vertical lines */ for (int j = 0; j <= _numberOfYCells; ++j) { - int y = - static_cast<int>(_bounds.bottom() - - (j * (_bounds.height() - 1) / _numberOfYCells)); + auto y = static_cast<int>( + _bounds.bottom() - (j * (_bounds.height() - 1) / _numberOfYCells)); if (j > 0 && j < _numberOfYCells) { diff --git a/Applications/DataExplorer/DataView/DirectConditionGenerator.cpp b/Applications/DataExplorer/DataView/DirectConditionGenerator.cpp index 756a0fbfeb4bef1fe3d37c1a7613b82f892f182e..328d247ba56fb0fca5593d923c319c4cf168875c 100644 --- a/Applications/DataExplorer/DataView/DirectConditionGenerator.cpp +++ b/Applications/DataExplorer/DataView/DirectConditionGenerator.cpp @@ -127,7 +127,7 @@ int DirectConditionGenerator::writeToFile(const std::string &name) const if (out) { - for (std::vector< std::pair<std::size_t,double> >::const_iterator it = _direct_values.begin(); it != _direct_values.end(); ++it) + for (auto it = _direct_values.begin(); it != _direct_values.end(); ++it) out << it->first << "\t" << it->second << "\n"; out.close(); diff --git a/Applications/DataExplorer/DataView/ElementTreeModel.cpp b/Applications/DataExplorer/DataView/ElementTreeModel.cpp index 762edae01804f75b7f436ef52034b8b3f98fab40..fa7ec445fdaf2ac69d7d5211ea73fd0173441554 100644 --- a/Applications/DataExplorer/DataView/ElementTreeModel.cpp +++ b/Applications/DataExplorer/DataView/ElementTreeModel.cpp @@ -46,8 +46,8 @@ void ElementTreeModel::setElement(vtkUnstructuredGridAlgorithm const*const grid, _mesh_source = grid; this->clearView(); - MeshLib::VtkMappedMeshSource const*const source = - dynamic_cast<MeshLib::VtkMappedMeshSource const*const>(grid); + auto const* const source = + dynamic_cast<MeshLib::VtkMappedMeshSource const* const>(grid); if (!source) return; @@ -57,12 +57,12 @@ void ElementTreeModel::setElement(vtkUnstructuredGridAlgorithm const*const grid, QList<QVariant> elemData; elemData << "Element " + QString::number(elem_index) << "" << "" << ""; - TreeItem* elemItem = new TreeItem(elemData, _rootItem); + auto* elemItem = new TreeItem(elemData, _rootItem); _rootItem->appendChild(elemItem); QList<QVariant> typeData; typeData << "Element Type: " << QString::fromStdString(MeshElemType2String(elem->getGeomType())); - TreeItem* typeItem = new TreeItem(typeData, elemItem); + auto* typeItem = new TreeItem(typeData, elemItem); elemItem->appendChild(typeItem); MeshLib::PropertyVector<int> const*const mat_ids = @@ -72,18 +72,18 @@ void ElementTreeModel::setElement(vtkUnstructuredGridAlgorithm const*const grid, QString matIdString = !mat_ids ? QString("not defined") : QString::number((*mat_ids)[elem->getID()]); QList<QVariant> materialData; materialData << "MaterialID: " << matIdString; - TreeItem* matItem = new TreeItem(materialData, elemItem); + auto* matItem = new TreeItem(materialData, elemItem); elemItem->appendChild(matItem); QList<QVariant> volData; volData << "Area/Volume: " << QString::number(mesh->getElement(elem_index)->getContent()); - TreeItem* volItem = new TreeItem(volData, elemItem); + auto* volItem = new TreeItem(volData, elemItem); elemItem->appendChild(volItem); QList<QVariant> nodeListData; nodeListData << "Nodes" << "" << "" << ""; - TreeItem* nodeListItem = new TreeItem(nodeListData, elemItem); + auto* nodeListItem = new TreeItem(nodeListData, elemItem); elemItem->appendChild(nodeListItem); //const std::vector<MeshLib::Node*> nodes_vec = grid->getNodes(); @@ -95,7 +95,7 @@ void ElementTreeModel::setElement(vtkUnstructuredGridAlgorithm const*const grid, nodeData << "Node " + QString::number(node->getID()) << QString::number((*node)[0]) << QString::number((*node)[1]) << QString::number((*node)[2]); - TreeItem* nodeItem = new TreeItem(nodeData, nodeListItem); + auto* nodeItem = new TreeItem(nodeData, nodeListItem); nodeListItem->appendChild(nodeItem); } endResetModel(); @@ -116,17 +116,17 @@ void ElementTreeModel::setMesh(MeshLib::Mesh const& mesh) QList<QVariant> mesh_name; mesh_name << "Name:" << QString::fromStdString(mesh.getName()) << "" << "" << ""; - TreeItem* name_item = new TreeItem(mesh_name, _rootItem); + auto* name_item = new TreeItem(mesh_name, _rootItem); _rootItem->appendChild(name_item); QList<QVariant> nodes_number; nodes_number << "#Nodes: " << QString::number(mesh.getNumberOfNodes()) << "" << ""; - TreeItem* nodes_item = new TreeItem(nodes_number, _rootItem); + auto* nodes_item = new TreeItem(nodes_number, _rootItem); _rootItem->appendChild(nodes_item); QList<QVariant> elements_number; elements_number << "#Elements: " << QString::number(mesh.getNumberOfElements()) << "" << ""; - TreeItem* elements_item = new TreeItem(elements_number, _rootItem); + auto* elements_item = new TreeItem(elements_number, _rootItem); _rootItem->appendChild(elements_item); const std::array<QString, 7> n_element_names = {{ "Lines:", "Triangles:", "Quads:", "Tetrahedra:", "Hexahedra:", "Pyramids:", "Prisms:" }}; @@ -137,14 +137,14 @@ void ElementTreeModel::setMesh(MeshLib::Mesh const& mesh) { QList<QVariant> elements_number; elements_number << n_element_names[i] << QString::number(n_element_types[i]) << "" << ""; - TreeItem* type_item = new TreeItem(elements_number, elements_item); + auto* type_item = new TreeItem(elements_number, elements_item); elements_item->appendChild(type_item); } } QList<QVariant> bounding_box; bounding_box << "Bounding Box" << "" << "" << ""; - TreeItem* aabb_item = new TreeItem(bounding_box, _rootItem); + auto* aabb_item = new TreeItem(bounding_box, _rootItem); _rootItem->appendChild(aabb_item); const GeoLib::AABB aabb (MeshLib::MeshInformation::getBoundingBox(mesh)); @@ -153,17 +153,17 @@ void ElementTreeModel::setMesh(MeshLib::Mesh const& mesh) QList<QVariant> min_aabb; min_aabb << "Min:" << QString::number(min[0], 'f') << QString::number(min[1], 'f') << QString::number(min[2], 'f'); - TreeItem* min_item = new TreeItem(min_aabb, aabb_item); + auto* min_item = new TreeItem(min_aabb, aabb_item); aabb_item->appendChild(min_item); QList<QVariant> max_aabb; max_aabb << "Max:" << QString::number(max[0], 'f') << QString::number(max[1], 'f') << QString::number(max[2], 'f'); - TreeItem* max_item = new TreeItem(max_aabb, aabb_item); + auto* max_item = new TreeItem(max_aabb, aabb_item); aabb_item->appendChild(max_item); QList<QVariant> edges; edges << "Edge Length: " << "[" + QString::number(mesh.getMinEdgeLength(), 'f') + "," << QString::number(mesh.getMaxEdgeLength(), 'f') + "]" << ""; - TreeItem* edge_item = new TreeItem(edges, _rootItem); + auto* edge_item = new TreeItem(edges, _rootItem); _rootItem->appendChild(edge_item); std::vector<std::string> const& vec_names (mesh.getProperties().getPropertyVectorNames()); @@ -182,7 +182,7 @@ void ElementTreeModel::setMesh(MeshLib::Mesh const& mesh) } if (array_info.size() == 1) array_info << "[ ?" << "? ]" << ""; - TreeItem* vec_item = new TreeItem(array_info, _rootItem); + auto* vec_item = new TreeItem(array_info, _rootItem); _rootItem->appendChild(vec_item); } diff --git a/Applications/DataExplorer/DataView/GEOModels.cpp b/Applications/DataExplorer/DataView/GEOModels.cpp index 85918f506afc1f589a2f98315dc2a42b3e67939f..96a5c30d1f7d4e91ae1e5ba5cdefe81fd3d0b30e 100644 --- a/Applications/DataExplorer/DataView/GEOModels.cpp +++ b/Applications/DataExplorer/DataView/GEOModels.cpp @@ -226,29 +226,26 @@ void GEOModels::addNameForObjectPoints(const std::string &geometry_name, GeoLib::PointVec* pnt_vec = _geo_objects.getPointVecObj(geometry_name); if (object_type == GeoLib::GEOTYPE::POLYLINE) { - const GeoLib::Polyline* ply = dynamic_cast<const GeoLib::Polyline*>(obj); + const auto* ply = dynamic_cast<const GeoLib::Polyline*>(obj); std::size_t nPoints = ply->getNumberOfPoints(); for (std::size_t i = 0; i < nPoints; i++) - pnt_vec->setNameForElement(ply->getPointID( - i), new_name + "_Point" + - std::to_string(ply->getPointID(i))); + pnt_vec->setNameForElement( + ply->getPointID(i), + new_name + "_Point" + std::to_string(ply->getPointID(i))); } else if (object_type == GeoLib::GEOTYPE::SURFACE) { - const GeoLib::Surface* sfc = dynamic_cast<const GeoLib::Surface*>(obj); + const auto* sfc = dynamic_cast<const GeoLib::Surface*>(obj); std::size_t nTriangles = sfc->getNumberOfTriangles(); for (std::size_t i = 0; i < nTriangles; i++) { const GeoLib::Triangle* tri = (*sfc)[i]; - pnt_vec->setNameForElement((*tri)[0], - new_name + "_Point" + - std::to_string((*tri)[0])); - pnt_vec->setNameForElement((*tri)[1], - new_name + "_Point" + - std::to_string((*tri)[1])); - pnt_vec->setNameForElement((*tri)[2], - new_name + "_Point" + - std::to_string((*tri)[2])); + pnt_vec->setNameForElement( + (*tri)[0], new_name + "_Point" + std::to_string((*tri)[0])); + pnt_vec->setNameForElement( + (*tri)[1], new_name + "_Point" + std::to_string((*tri)[1])); + pnt_vec->setNameForElement( + (*tri)[2], new_name + "_Point" + std::to_string((*tri)[2])); } } else diff --git a/Applications/DataExplorer/DataView/GMSHPrefsDialog.cpp b/Applications/DataExplorer/DataView/GMSHPrefsDialog.cpp index 125b004040e29a5083d162bc28c1e17cd6806108..9e6141c079eaaab9ebba655173dbdea3b56427ea 100644 --- a/Applications/DataExplorer/DataView/GMSHPrefsDialog.cpp +++ b/Applications/DataExplorer/DataView/GMSHPrefsDialog.cpp @@ -38,25 +38,16 @@ GMSHPrefsDialog::GMSHPrefsDialog(GeoLib::GEOObjects const& geoObjects, QDialog* this->param4->setText("0"); // object will be deleted by Qt - StrictIntValidator* max_number_of_points_in_quadtree_leaf_validator (new StrictIntValidator ( - 1, - 1000, - this->param1)); + auto* max_number_of_points_in_quadtree_leaf_validator( + new StrictIntValidator(1, 1000, this->param1)); param1->setValidator (max_number_of_points_in_quadtree_leaf_validator); // object will be deleted by Qt - StrictDoubleValidator* mesh_density_scaling_pnts_validator(new StrictDoubleValidator ( - 1e-10, - 1.0, - 5, - this - ->param2)); + auto* mesh_density_scaling_pnts_validator( + new StrictDoubleValidator(1e-10, 1.0, 5, this->param2)); param2->setValidator (mesh_density_scaling_pnts_validator); // object will be deleted by Qt# - StrictDoubleValidator* mesh_density_scaling_stations_validator(new StrictDoubleValidator ( - 1e-10, - 1.0, - 5, - this->param3)); + auto* mesh_density_scaling_stations_validator( + new StrictDoubleValidator(1e-10, 1.0, 5, this->param3)); param3->setValidator (mesh_density_scaling_stations_validator); std::vector<std::string> geoNames; diff --git a/Applications/DataExplorer/DataView/GeoTreeModel.cpp b/Applications/DataExplorer/DataView/GeoTreeModel.cpp index b43f5c2ce284924958c287c4c3656bffd19daac9..80fa09536d98e347d3923b45a12b0166a01dcd40 100644 --- a/Applications/DataExplorer/DataView/GeoTreeModel.cpp +++ b/Applications/DataExplorer/DataView/GeoTreeModel.cpp @@ -43,13 +43,14 @@ void GeoTreeModel::addPointList(QString geoName, GeoLib::PointVec const& pointVe QList<QVariant> geoData; geoData << QVariant(geoName) << "" << "" << "" << ""; - GeoTreeItem* geo (new GeoTreeItem(geoData, _rootItem)); + auto* geo(new GeoTreeItem(geoData, _rootItem)); _lists.push_back(geo); _rootItem->appendChild(geo); QList<QVariant> pointData; pointData << "Points" << "" << "" << "" << ""; - GeoObjectListItem* pointList = new GeoObjectListItem(pointData, geo, points, GeoLib::GEOTYPE::POINT); + auto* pointList = + new GeoObjectListItem(pointData, geo, points, GeoLib::GEOTYPE::POINT); geo->appendChild(pointList); std::size_t nPoints = points->size(); @@ -99,7 +100,8 @@ void GeoTreeModel::addPolylineList(QString geoName, GeoLib::PolylineVec const& p QList<QVariant> plyData; plyData << "Polylines" << "" << "" << ""; - GeoObjectListItem* plyList = new GeoObjectListItem(plyData, geo, lines, GeoLib::GEOTYPE::POLYLINE); + auto* plyList = + new GeoObjectListItem(plyData, geo, lines, GeoLib::GEOTYPE::POLYLINE); geo->appendChild(plyList); this->addChildren(plyList, polylineVec, 0, lines->size()); @@ -113,13 +115,12 @@ void GeoTreeModel::appendPolylines(const std::string &name, GeoLib::PolylineVec if ( name.compare( _lists[i]->data(0).toString().toStdString() ) == 0 ) for (int j = 0; j < _lists[i]->childCount(); j++) { - GeoObjectListItem* parent = - static_cast<GeoObjectListItem*>(_lists[i]->child(j)); + auto* parent = + static_cast<GeoObjectListItem*>(_lists[i]->child(j)); if (GeoLib::GEOTYPE::POLYLINE == parent->getType()) { beginResetModel(); - this->addChildren(parent, polylineVec, - parent->childCount(), + this->addChildren(parent, polylineVec, parent->childCount(), polylineVec.getVector()->size()); endResetModel(); parent->vtkSource()->Modified(); @@ -144,10 +145,10 @@ void GeoTreeModel::addChildren(GeoObjectListItem* plyList, line_data << "Line " + QString::number(i) << "" << "" << ""; const GeoLib::Polyline &line(*(lines[i])); - GeoTreeItem* lineItem(new GeoTreeItem(line_data, plyList, &line)); + auto* lineItem(new GeoTreeItem(line_data, plyList, &line)); plyList->appendChild(lineItem); - int nPoints = static_cast<int>(lines[i]->getNumberOfPoints()); + auto nPoints = static_cast<int>(lines[i]->getNumberOfPoints()); for (int j = 0; j < nPoints; j++) { const GeoLib::Point pnt(*(line.getPoint(j))); @@ -190,7 +191,8 @@ void GeoTreeModel::addSurfaceList(QString geoName, GeoLib::SurfaceVec const& sur QList<QVariant> sfcData; sfcData << "Surfaces" << "" << "" << ""; - GeoObjectListItem* sfcList = new GeoObjectListItem(sfcData, geo, surfaces, GeoLib::GEOTYPE::SURFACE); + auto* sfcList = + new GeoObjectListItem(sfcData, geo, surfaces, GeoLib::GEOTYPE::SURFACE); geo->appendChild(sfcList); this->addChildren(sfcList, surfaceVec, 0, surfaces->size()); @@ -206,13 +208,12 @@ void GeoTreeModel::appendSurfaces(const std::string &name, GeoLib::SurfaceVec co int nChildren = _lists[i]->childCount(); for (int j = 0; j < nChildren; j++) { - GeoObjectListItem* parent = - static_cast<GeoObjectListItem*>(_lists[i]->child(j)); + auto* parent = + static_cast<GeoObjectListItem*>(_lists[i]->child(j)); if (GeoLib::GEOTYPE::SURFACE == parent->getType()) { beginResetModel(); - this->addChildren(parent, surfaceVec, - parent->childCount(), + this->addChildren(parent, surfaceVec, parent->childCount(), surfaceVec.getVector()->size()); parent->vtkSource()->Modified(); endResetModel(); @@ -240,10 +241,10 @@ void GeoTreeModel::addChildren(GeoObjectListItem* sfcList, "" << ""; const GeoLib::Surface &sfc(*(*surfaces)[i]); - GeoTreeItem* surfaceItem(new GeoTreeItem(surface, sfcList, &sfc)); + auto* surfaceItem(new GeoTreeItem(surface, sfcList, &sfc)); sfcList->appendChild(surfaceItem); - int nElems = static_cast<int>((*surfaces)[i]->getNumberOfTriangles()); + auto nElems = static_cast<int>((*surfaces)[i]->getNumberOfTriangles()); for (int j = 0; j < nElems; j++) { QList<QVariant> elem; @@ -252,7 +253,7 @@ void GeoTreeModel::addChildren(GeoObjectListItem* sfcList, elem << j << static_cast<int>(triangle[0]) << static_cast<int>(triangle[1]) << static_cast<int>(triangle[2]); - TreeItem* child(new TreeItem(elem, surfaceItem)); + auto* child(new TreeItem(elem, surfaceItem)); surfaceItem->appendChild(child); for (int k = 0; k < 3; k++) @@ -308,8 +309,8 @@ vtkPolyDataAlgorithm* GeoTreeModel::vtkSource(const std::string &name, GeoLib::G if ( name.compare( _lists[i]->data(0).toString().toStdString() ) == 0 ) for (int j = 0; j < _lists[i]->childCount(); j++) { - GeoObjectListItem* item = - dynamic_cast<GeoObjectListItem*>(_lists[i]->child(j)); + auto* item = + dynamic_cast<GeoObjectListItem*>(_lists[i]->child(j)); if (item->getType() == type) return item->vtkSource(); } diff --git a/Applications/DataExplorer/DataView/GeoTreeView.cpp b/Applications/DataExplorer/DataView/GeoTreeView.cpp index 5bd4a4ea7de2b0c832eccf0e93d1ecec349f1711..b228cdc69c6c54fa42eefd0a2788dc6b59a3c0ef 100644 --- a/Applications/DataExplorer/DataView/GeoTreeView.cpp +++ b/Applications/DataExplorer/DataView/GeoTreeView.cpp @@ -70,13 +70,15 @@ void GeoTreeView::selectionChanged( const QItemSelection &selected, else // line points or surface triangles { emit enableSaveButton(false); - const GeoObjectListItem* geo_type = dynamic_cast<const GeoObjectListItem*>(tree_item); + const auto* geo_type = + dynamic_cast<const GeoObjectListItem*>(tree_item); if (geo_type) // geometry list item emit enableRemoveButton(true); else { // highlight a point for an expanded polyline - GeoObjectListItem* list_item = dynamic_cast<GeoObjectListItem*>(tree_item->parentItem()->parentItem()); + auto* list_item = dynamic_cast<GeoObjectListItem*>( + tree_item->parentItem()->parentItem()); if (list_item && list_item->getType() == GeoLib::GEOTYPE::POLYLINE) geoItemSelected( dynamic_cast<GeoObjectListItem*>(tree_item->parentItem()->parentItem()->parentItem()->child(0))->vtkSource(), @@ -115,9 +117,9 @@ void GeoTreeView::selectionChangedFromOutside( const QItemSelection &selected, void GeoTreeView::contextMenuEvent( QContextMenuEvent* event ) { QModelIndex index = this->selectionModel()->currentIndex(); - TreeItem* item = static_cast<TreeItem*>(index.internalPointer()); + auto* item = static_cast<TreeItem*>(index.internalPointer()); - GeoObjectListItem* list = dynamic_cast<GeoObjectListItem*>(item); + auto* list = dynamic_cast<GeoObjectListItem*>(item); QMenu menu; // The current index is a list of points/polylines/surfaces @@ -139,7 +141,7 @@ void GeoTreeView::contextMenuEvent( QContextMenuEvent* event ) if (!item) // Otherwise sometimes it crashes when (unmotivated ;-) ) clicking in a treeview return; - GeoObjectListItem* parent = dynamic_cast<GeoObjectListItem*>(item->parentItem()); + auto* parent = dynamic_cast<GeoObjectListItem*>(item->parentItem()); // The current index refers to a geo-object if (parent != nullptr) @@ -201,7 +203,7 @@ void GeoTreeView::removeGeometry() else { TreeItem* item = static_cast<GeoTreeModel*>(model())->getItem(index); - GeoObjectListItem* list = dynamic_cast<GeoObjectListItem*>(item); + auto* list = dynamic_cast<GeoObjectListItem*>(item); if (list) { emit listRemoved((item->parentItem()->data( 0).toString()).toStdString(), list->getType()); diff --git a/Applications/DataExplorer/DataView/MeshAnalysisDialog.cpp b/Applications/DataExplorer/DataView/MeshAnalysisDialog.cpp index dc3a9db2195c15b63e2a9479552d11a7d5564be5..7aab30599ab9f5ce71dc1cbf8e7f6574510afef8 100644 --- a/Applications/DataExplorer/DataView/MeshAnalysisDialog.cpp +++ b/Applications/DataExplorer/DataView/MeshAnalysisDialog.cpp @@ -35,10 +35,12 @@ MeshAnalysisDialog::MeshAnalysisDialog( for (std::size_t i=0; i<mesh_vec.size(); ++i) this->meshListBox->addItem(QString::fromStdString(mesh_vec[i]->getName())); - StrictDoubleValidator* collapse_threshold_validator = new StrictDoubleValidator(0, 1000000, 7, this); + auto* collapse_threshold_validator = + new StrictDoubleValidator(0, 1000000, 7, this); this->collapsibleNodesThreshold->setValidator (collapse_threshold_validator); - StrictDoubleValidator* volume_threshold_validator = new StrictDoubleValidator(0, 1e10, 10, this); + auto* volume_threshold_validator = + new StrictDoubleValidator(0, 1e10, 10, this); this->zeroVolumeThreshold->setValidator (volume_threshold_validator); } diff --git a/Applications/DataExplorer/DataView/MeshLayerEditDialog.cpp b/Applications/DataExplorer/DataView/MeshLayerEditDialog.cpp index d1b535a5d5adf5975b6a2aa050583e1d8e6c80d3..d89d9ab9d7d4b003dd21529985424f141bbf95f6 100644 --- a/Applications/DataExplorer/DataView/MeshLayerEditDialog.cpp +++ b/Applications/DataExplorer/DataView/MeshLayerEditDialog.cpp @@ -79,7 +79,7 @@ void MeshLayerEditDialog::nextButtonPressed() _layerEdit->setEnabled(false); _nextButton->setEnabled(false); - QVBoxLayout* _radiobuttonLayout (new QVBoxLayout(_radioButtonBox)); + auto* _radiobuttonLayout(new QVBoxLayout(_radioButtonBox)); QRadioButton* selectButton1 (new QRadioButton("Add layers based on raster files", _radioButtonBox)); QRadioButton* selectButton2 (new QRadioButton("Add layers with static thickness", _radioButtonBox)); _radioButtonBox = new QGroupBox(this); @@ -107,7 +107,7 @@ void MeshLayerEditDialog::createWithRasters() if (i==0) text = "Surface"; else if (i == _n_layers) text = "Layer" + QString::number(_n_layers) + "-Bottom"; else text="Layer" + QString::number(i+1) + "-Top"; - QLineEdit* edit (new QLineEdit(this)); + auto* edit(new QLineEdit(this)); QPushButton* button (new QPushButton("...", _layerBox)); this->_edits.push_back(edit); @@ -147,9 +147,9 @@ void MeshLayerEditDialog::createStatic() void MeshLayerEditDialog::createMeshToolSelection() { - QGroupBox* meshToolSelectionBox (new QGroupBox(this)); + auto* meshToolSelectionBox(new QGroupBox(this)); meshToolSelectionBox->setTitle("Output element type"); - QGridLayout* meshToolSelectionLayout (new QGridLayout(meshToolSelectionBox)); + auto* meshToolSelectionLayout(new QGridLayout(meshToolSelectionBox)); _ogsMeshButton = new QRadioButton("Prisms", meshToolSelectionBox); QRadioButton* tetgenMeshButton = new QRadioButton("Tetrahedra", meshToolSelectionBox); tetgenMeshButton->setFixedWidth(150); @@ -157,7 +157,8 @@ void MeshLayerEditDialog::createMeshToolSelection() minThicknessLabel->setText("Minimum thickness of layers:"); _minThicknessEdit = new QLineEdit(meshToolSelectionBox); _minThicknessEdit->setText("1.0"); - QDoubleValidator* min_thickness_validator = new QDoubleValidator(0, 1000000, 15, _minThicknessEdit); + auto* min_thickness_validator = + new QDoubleValidator(0, 1000000, 15, _minThicknessEdit); _minThicknessEdit->setValidator(min_thickness_validator); _minThicknessEdit->setMaximumWidth(100); _minThicknessEdit->setFixedWidth(100); @@ -303,11 +304,12 @@ void MeshLayerEditDialog::reject() void MeshLayerEditDialog::getFileName() { - QPushButton* button = dynamic_cast<QPushButton*>(this->sender()); + auto* button = dynamic_cast<QPushButton*>(this->sender()); QSettings settings; - QString filename = QFileDialog::getOpenFileName(this, "Select raster file to open", - settings.value("lastOpenedRasterFileDirectory").toString(), - "ASCII raster files (*.asc);;All files (* *.*)"); + QString filename = QFileDialog::getOpenFileName( + this, "Select raster file to open", + settings.value("lastOpenedRasterFileDirectory").toString(), + "ASCII raster files (*.asc);;All files (* *.*)"); _fileButtonMap[button]->setText(filename); QFileInfo fi(filename); settings.setValue("lastOpenedRasterFileDirectory", fi.absolutePath()); diff --git a/Applications/DataExplorer/DataView/MeshMapping2DDialog.cpp b/Applications/DataExplorer/DataView/MeshMapping2DDialog.cpp index 728331317955d67918b2c948d3c62d67238212e5..0a1ebd7ff820c606ffa49264deb8c491dd3ebcd7 100644 --- a/Applications/DataExplorer/DataView/MeshMapping2DDialog.cpp +++ b/Applications/DataExplorer/DataView/MeshMapping2DDialog.cpp @@ -19,9 +19,9 @@ MeshMapping2DDialog::MeshMapping2DDialog(QDialog* parent) { setupUi(this); - StrictDoubleValidator* no_data_validator = new StrictDoubleValidator(this); + auto* no_data_validator = new StrictDoubleValidator(this); this->noDataValueEdit->setValidator (no_data_validator); - StrictDoubleValidator* static_value_validator = new StrictDoubleValidator(this); + auto* static_value_validator = new StrictDoubleValidator(this); this->staticValueEdit->setValidator (static_value_validator); } diff --git a/Applications/DataExplorer/DataView/MshModel.cpp b/Applications/DataExplorer/DataView/MshModel.cpp index 5b07f989f9af8167c60747bc9786efe9b4b93ad4..3626e926f243147372025e691a1f82885c89cbc9 100644 --- a/Applications/DataExplorer/DataView/MshModel.cpp +++ b/Applications/DataExplorer/DataView/MshModel.cpp @@ -69,12 +69,12 @@ void MshModel::addMeshObject(const MeshLib::Mesh* mesh) QVariant const display_name (QString::fromStdString(mesh->getName())); QList<QVariant> meshData; meshData << display_name << "" << ""; - MshItem *const newMesh = new MshItem(meshData, _rootItem, mesh); + auto* const newMesh = new MshItem(meshData, _rootItem, mesh); _rootItem->appendChild(newMesh); // display elements std::vector<MeshLib::Element*> const& elems = mesh->getElements(); - int const nElems (static_cast<int>(elems.size())); + auto const nElems(static_cast<int>(elems.size())); for (int i = 0; i < nElems; i++) { @@ -92,7 +92,7 @@ const MeshLib::Mesh* MshModel::getMesh(const QModelIndex &idx) const { if (idx.isValid()) { - MshItem* item = dynamic_cast<MshItem*>(this->getItem(idx)); + auto* item = dynamic_cast<MshItem*>(this->getItem(idx)); if (item) return item->getMesh(); else @@ -106,7 +106,7 @@ const MeshLib::Mesh* MshModel::getMesh(const std::string &name) const { for (int i = 0; i < _rootItem->childCount(); i++) { - MshItem* item = static_cast<MshItem*>(_rootItem->child(i)); + auto* item = static_cast<MshItem*>(_rootItem->child(i)); if (item->data(0).toString().toStdString().compare(name) == 0) return item->getMesh(); } @@ -119,7 +119,7 @@ bool MshModel::removeMesh(const QModelIndex &idx) { if (idx.isValid()) { - MshItem* item = dynamic_cast<MshItem*>(this->getItem(idx)); + auto* item = dynamic_cast<MshItem*>(this->getItem(idx)); if (item) return this->removeMesh(item->getMesh()->getName()); return false; @@ -182,7 +182,7 @@ vtkUnstructuredGridAlgorithm* MshModel::vtkSource(const QModelIndex &idx) const { if (idx.isValid()) { - MshItem* item = static_cast<MshItem*>(this->getItem(idx)); + auto* item = static_cast<MshItem*>(this->getItem(idx)); return item->vtkSource(); } @@ -194,7 +194,7 @@ vtkUnstructuredGridAlgorithm* MshModel::vtkSource(const std::string &name) const { for (int i = 0; i < _rootItem->childCount(); i++) { - MshItem* item = static_cast<MshItem*>(_rootItem->child(i)); + auto* item = static_cast<MshItem*>(_rootItem->child(i)); if (item->data(0).toString().toStdString().compare(name) == 0) return item->vtkSource(); } diff --git a/Applications/DataExplorer/DataView/MshView.cpp b/Applications/DataExplorer/DataView/MshView.cpp index ccec570c5a0509005864869dc799be70b39dc027..4eb6417c486c5f67561ef3771cd1691dc330f358 100644 --- a/Applications/DataExplorer/DataView/MshView.cpp +++ b/Applications/DataExplorer/DataView/MshView.cpp @@ -74,7 +74,7 @@ void MshView::selectionChanged( const QItemSelection &selected, const QItemSelec const QModelIndex idx = *(selected.indexes().begin()); const TreeItem* tree_item = static_cast<TreeModel*>(this->model())->getItem(idx); - const MshItem* list_item = dynamic_cast<const MshItem*>(tree_item); + const auto* list_item = dynamic_cast<const MshItem*>(tree_item); if (list_item) { emit enableSaveButton(true); @@ -201,7 +201,7 @@ void MshView::openValuesEditDialog() { MshModel const*const model = static_cast<MshModel*>(this->model()); QModelIndex const index = this->selectionModel()->currentIndex(); - MeshLib::Mesh* mesh = const_cast<MeshLib::Mesh*>(model->getMesh(index)); + auto* mesh = const_cast<MeshLib::Mesh*>(model->getMesh(index)); MeshValueEditDialog valueEdit(mesh); connect(&valueEdit, SIGNAL(valueEditFinished(MeshLib::Mesh*)), diff --git a/Applications/DataExplorer/DataView/NetCdfConfigureDialog.cpp b/Applications/DataExplorer/DataView/NetCdfConfigureDialog.cpp index a01c02a499b962047b8f4c2d9259867d26b7aefb..50d962384db39d77b4e1fe3546a34a67095ecddf 100644 --- a/Applications/DataExplorer/DataView/NetCdfConfigureDialog.cpp +++ b/Applications/DataExplorer/DataView/NetCdfConfigureDialog.cpp @@ -247,12 +247,12 @@ void NetCdfConfigureDialog::getDimEdges(int dimId, unsigned &size, double &first void NetCdfConfigureDialog::getDaysTime(double minSince, QTime &time, int &days) { - long tmpMin = (long) minSince; + auto tmpMin = (long)minSince; long minuits = tmpMin % 60; long tmpHours = tmpMin / 60; long hours = tmpHours % 24; - days = (int) (tmpHours / 24); - time.setHMS(hours,minuits,0); + days = (int)(tmpHours / 24); + time.setHMS(hours, minuits, 0); } long NetCdfConfigureDialog::convertDateToMinutes(QDateTime initialDateTime, QDate selectedDate, QTime selectedTime) @@ -311,7 +311,7 @@ double NetCdfConfigureDialog::getResolution() void NetCdfConfigureDialog::createDataObject() { - std::size_t* length = new std::size_t[_currentVar->num_dims()]; + auto* length = new std::size_t[_currentVar->num_dims()]; double originLon = 0, originLat = 0; double lastLon = 0, lastLat = 0; unsigned sizeLon = 0, sizeLat = 0; @@ -326,13 +326,13 @@ void NetCdfConfigureDialog::createDataObject() length[comboBoxDim2->currentIndex()]=sizeLon; // set up array - double* data_array = new double[sizeLat*sizeLon]; + auto* data_array = new double[sizeLat * sizeLon]; for(std::size_t i=0; i < (sizeLat*sizeLon); i++) data_array[i]=0; //Time-Dimension: if (_currentVar->num_dims() > 2) { - long* newOrigin = new long[_currentVar->num_dims()]; + auto* newOrigin = new long[_currentVar->num_dims()]; for (int i=0; i < _currentVar->num_dims(); i++) newOrigin[i]=0; newOrigin[comboBoxDim3->currentIndex()] = getTimeStep(); //set origin to selected time _currentVar->set_cur(newOrigin); @@ -407,7 +407,7 @@ std::string NetCdfConfigureDialog::getName() void NetCdfConfigureDialog::reverseNorthSouth(double* data, std::size_t width, std::size_t height) { - double* cp_array = new double[width*height]; + auto* cp_array = new double[width * height]; for (std::size_t i=0; i<height; i++) { diff --git a/Applications/DataExplorer/DataView/SelectMeshDialog.cpp b/Applications/DataExplorer/DataView/SelectMeshDialog.cpp index d63f3934569a44668c2923ffe9ff4049a8ae199c..2e47d615b451feb4e6d15921ed8b042b72f3dca4 100644 --- a/Applications/DataExplorer/DataView/SelectMeshDialog.cpp +++ b/Applications/DataExplorer/DataView/SelectMeshDialog.cpp @@ -44,7 +44,7 @@ void SelectMeshDialog::setupDialog(const std::list<std::string> &msh_names) _msh_names = new QComboBox(); - for (std::list<std::string>::const_iterator it=msh_names.begin(); it != msh_names.end(); ++it) + for (auto it = msh_names.begin(); it != msh_names.end(); ++it) _msh_names->addItem(QString::fromStdString(*it)); setWindowTitle("Select Mesh..."); diff --git a/Applications/DataExplorer/DataView/StationTreeModel.cpp b/Applications/DataExplorer/DataView/StationTreeModel.cpp index 8eb5fae667c868bbc96c41a71ac651cfbe40ce20..5370efd4bfff0c947b379b1e42909e7369c6d14e 100644 --- a/Applications/DataExplorer/DataView/StationTreeModel.cpp +++ b/Applications/DataExplorer/DataView/StationTreeModel.cpp @@ -56,7 +56,7 @@ QModelIndex StationTreeModel::index( int row, int column, else parentItem = static_cast<ModelTreeItem*>(parent.internalPointer()); - ModelTreeItem* childItem = (ModelTreeItem*)(parentItem->child(row)); + auto* childItem = (ModelTreeItem*)(parentItem->child(row)); if (childItem) { QModelIndex newIndex = createIndex(row, column, childItem); @@ -81,7 +81,7 @@ GeoLib::Station* StationTreeModel::stationFromIndex( const QModelIndex& index, { if (index.isValid()) { - ModelTreeItem* treeItem = static_cast<ModelTreeItem*>(index.internalPointer()); + auto* treeItem = static_cast<ModelTreeItem*>(index.internalPointer()); TreeItem* parentItem = treeItem->parentItem(); listName = parentItem->data(0).toString(); return treeItem->getStation(); @@ -130,7 +130,8 @@ void StationTreeModel::addStationList(QString listName, const std::vector<GeoLib listName.append(QString::number(rowCount() + 1)); } grpName << listName << "" << "" << ""; - ModelTreeItem* group = new ModelTreeItem(grpName, _rootItem, new BaseItem(listName, stations)); + auto* group = + new ModelTreeItem(grpName, _rootItem, new BaseItem(listName, stations)); _lists.push_back(group); _rootItem->appendChild(group); int vectorSize = stations->size(); @@ -143,7 +144,7 @@ void StationTreeModel::addStationList(QString listName, const std::vector<GeoLib << QString::number((*(*stations)[i])[1],'f') << QString::number((*(*stations)[i])[2],'f'); - ModelTreeItem* child = new ModelTreeItem(stn, group); + auto* child = new ModelTreeItem(stn, group); child->setStation(static_cast<GeoLib::Station*>((*stations)[i])); group->appendChild(child); } @@ -160,7 +161,7 @@ void StationTreeModel::removeStationList(QModelIndex index) { if (index.isValid()) // { - ModelTreeItem* item = static_cast<ModelTreeItem*>(getItem(index)); + auto* item = static_cast<ModelTreeItem*>(getItem(index)); // also delete the lists entry in the list directory of the model for (std::size_t i = 0; i < _lists.size(); i++) diff --git a/Applications/DataExplorer/DataView/StationTreeView.cpp b/Applications/DataExplorer/DataView/StationTreeView.cpp index 12324f68eda2ddd35c184524145ab23269931cef..e8e00ad498a2567947412733cc9a27e5b1bb0907 100644 --- a/Applications/DataExplorer/DataView/StationTreeView.cpp +++ b/Applications/DataExplorer/DataView/StationTreeView.cpp @@ -50,7 +50,8 @@ void StationTreeView::selectionChanged( const QItemSelection &selected, const QModelIndex idx = *(selected.indexes().begin()); const TreeItem* tree_item = static_cast<TreeModel*>(this->model())->getItem(idx); - const ModelTreeItem* list_item = dynamic_cast<const ModelTreeItem*>(tree_item->parentItem()); + const auto* list_item = + dynamic_cast<const ModelTreeItem*>(tree_item->parentItem()); if (list_item->getItem()) { if (list_item) @@ -85,7 +86,7 @@ void StationTreeView::selectionChangedFromOutside( const QItemSelection &selecte void StationTreeView::contextMenuEvent( QContextMenuEvent* event ) { QModelIndex index = this->selectionModel()->currentIndex(); - ModelTreeItem* item = static_cast<ModelTreeItem*>(index.internalPointer()); + auto* item = static_cast<ModelTreeItem*>(index.internalPointer()); if (!item) // Otherwise sometimes it crashes when (unmotivated ;-) ) clicking in a treeview return; @@ -147,8 +148,11 @@ void StationTreeView::displayStratigraphy() std::map<std::string, DataHolderLib::Color> colorLookupTable = static_cast<VtkStationSource*>(static_cast<StationTreeModel*> (model())->vtkSource(temp_name.toStdString()))->getColorLookupTable(); - StratWindow* stratView = new StratWindow(static_cast<GeoLib::StationBorehole*> - (static_cast<StationTreeModel*>(model())->stationFromIndex(index,temp_name)), &colorLookupTable); + auto* stratView = new StratWindow( + static_cast<GeoLib::StationBorehole*>( + static_cast<StationTreeModel*>(model())->stationFromIndex( + index, temp_name)), + &colorLookupTable); stratView->setAttribute(Qt::WA_DeleteOnClose); // this fixes the memory leak shown by cppcheck stratView->show(); } @@ -252,8 +256,9 @@ void StationTreeView::writeStratigraphiesAsImages(QString listName) for (std::size_t i = 0; i < stations.size(); i++) { - StratWindow* stratView = new StratWindow( - static_cast<GeoLib::StationBorehole*>(stations[i]), &colorLookupTable); + auto* stratView = new StratWindow( + static_cast<GeoLib::StationBorehole*>(stations[i]), + &colorLookupTable); stratView->setAttribute(Qt::WA_DeleteOnClose); stratView->show(); stratView->stationView->saveAsImage(QString::fromStdString( diff --git a/Applications/DataExplorer/DataView/StratView/StratScene.cpp b/Applications/DataExplorer/DataView/StratView/StratScene.cpp index 27c7d86b70f5288edc2944bf79e94a972a75a3e5..ad39310169fcc619e970c65fcabfef8cd21dd92d 100644 --- a/Applications/DataExplorer/DataView/StratView/StratScene.cpp +++ b/Applications/DataExplorer/DataView/StratView/StratScene.cpp @@ -85,7 +85,7 @@ void StratScene::addDepthLabels(std::vector<GeoLib::Point*> profile, double offs QNonScalableGraphicsTextItem* StratScene::addNonScalableText(const QString &text, const QFont &font) { - QNonScalableGraphicsTextItem* item = new QNonScalableGraphicsTextItem(text); + auto* item = new QNonScalableGraphicsTextItem(text); item->setFont(font); addItem(item); return item; @@ -115,7 +115,7 @@ void StratScene::addSoilNameLabels(std::vector<std::string> soilNames, StratBar* StratScene::addStratBar(GeoLib::StationBorehole* station, std::map<std::string, DataHolderLib::Color>* stratColors) { - StratBar* b = new StratBar(station, stratColors); + auto* b = new StratBar(station, stratColors); addItem(b); return b; } diff --git a/Applications/DataExplorer/VtkVis/VtkAddFilterDialog.cpp b/Applications/DataExplorer/VtkVis/VtkAddFilterDialog.cpp index ed7d9165e3ef81bdaa42bd5ac4064572b5bddae9..f5772e222350f98b80bc06808d735153822bc867 100644 --- a/Applications/DataExplorer/VtkVis/VtkAddFilterDialog.cpp +++ b/Applications/DataExplorer/VtkVis/VtkAddFilterDialog.cpp @@ -38,8 +38,8 @@ VtkAddFilterDialog::VtkAddFilterDialog( VtkVisPipeline &pipeline, setupUi(this); filterListWidget->setSelectionMode(QAbstractItemView::SingleSelection); - VtkVisPipelineItem* parentItem = - static_cast<VtkVisPipelineItem*>(_pipeline.getItem(parentIndex)); + auto* parentItem = + static_cast<VtkVisPipelineItem*>(_pipeline.getItem(parentIndex)); vtkDataObject* parentDataObject = parentItem->algorithm()->GetOutputDataObject(0); int parentDataObjectType = parentDataObject->GetDataObjectType(); @@ -74,8 +74,8 @@ void VtkAddFilterDialog::on_buttonBox_accepted() break; } } - VtkVisPipelineItem* parentItem = - static_cast<VtkVisPipelineItem*>(_pipeline.getItem(_parentIndex)); + auto* parentItem = + static_cast<VtkVisPipelineItem*>(_pipeline.getItem(_parentIndex)); QList<QVariant> itemData; itemData << filterListWidget->currentItem()->text() << true; diff --git a/Applications/DataExplorer/VtkVis/VtkAlgorithmProperties.cpp b/Applications/DataExplorer/VtkVis/VtkAlgorithmProperties.cpp index 946c2ba30b58437875e962a6d606814563c537f7..023d00c7401df161946f8974fb28abdb365b07d5 100644 --- a/Applications/DataExplorer/VtkVis/VtkAlgorithmProperties.cpp +++ b/Applications/DataExplorer/VtkVis/VtkAlgorithmProperties.cpp @@ -41,8 +41,7 @@ VtkAlgorithmProperties::~VtkAlgorithmProperties() _property->Delete(); if (_texture != nullptr) _texture->Delete(); - for (std::map<QString, vtkLookupTable*>::iterator it = _lut.begin(); - it != _lut.end(); ++it) + for (auto it = _lut.begin(); it != _lut.end(); ++it) it->second->Delete(); delete _algorithmUserProperties; delete _algorithmUserVectorProperties; @@ -50,7 +49,7 @@ VtkAlgorithmProperties::~VtkAlgorithmProperties() vtkLookupTable* VtkAlgorithmProperties::GetLookupTable(const QString& array_name) { - std::map<QString, vtkLookupTable*>::iterator it = _lut.find(array_name); + auto it = _lut.find(array_name); if (it != _lut.end()) return it->second; else @@ -59,7 +58,7 @@ vtkLookupTable* VtkAlgorithmProperties::GetLookupTable(const QString& array_name void VtkAlgorithmProperties::RemoveLookupTable(const QString& array_name) { - std::map<QString, vtkLookupTable*>::iterator it = _lut.find(array_name); + auto it = _lut.find(array_name); if (it != _lut.end()) { it->second->Delete(); diff --git a/Applications/DataExplorer/VtkVis/VtkAlgorithmPropertyCheckbox.cpp b/Applications/DataExplorer/VtkVis/VtkAlgorithmPropertyCheckbox.cpp index a568e0b2671e60db81736d7fb27da4f83edfb13e..41673728d01ad494c8c218fd143fea9bc4049a3c 100644 --- a/Applications/DataExplorer/VtkVis/VtkAlgorithmPropertyCheckbox.cpp +++ b/Applications/DataExplorer/VtkVis/VtkAlgorithmPropertyCheckbox.cpp @@ -31,6 +31,6 @@ VtkAlgorithmPropertyCheckbox::~VtkAlgorithmPropertyCheckbox() = default; void VtkAlgorithmPropertyCheckbox::setNewValue( int state ) { - bool boolState = (bool)state; + auto boolState = (bool)state; _algProps->SetUserProperty(_name, QVariant(boolState)); } diff --git a/Applications/DataExplorer/VtkVis/VtkAlgorithmPropertyVectorEdit.cpp b/Applications/DataExplorer/VtkVis/VtkAlgorithmPropertyVectorEdit.cpp index a80e4847c88bff8728868532a3083b757b76c72d..b2840e4d70408f914310b168b2eabbc6278230a8 100644 --- a/Applications/DataExplorer/VtkVis/VtkAlgorithmPropertyVectorEdit.cpp +++ b/Applications/DataExplorer/VtkVis/VtkAlgorithmPropertyVectorEdit.cpp @@ -30,13 +30,13 @@ VtkAlgorithmPropertyVectorEdit::VtkAlgorithmPropertyVectorEdit( const QList<QStr QWidget* parent /*= 0*/ ) : QWidget(parent), _name(name), _algProps(algProps), _type(type) { - QHBoxLayout* layout = new QHBoxLayout; + auto* layout = new QHBoxLayout; layout->setSpacing(3); layout->setContentsMargins(0, 0, 0, 0); foreach(QString content, contents) { - QLineEdit* lineEdit = new QLineEdit(content, this); + auto* lineEdit = new QLineEdit(content, this); layout->addWidget(lineEdit); switch(_type) @@ -68,7 +68,7 @@ void VtkAlgorithmPropertyVectorEdit::setNewValue() QList<QVariant> list; for (int i = 0; i < layout->count(); ++i) { - QLineEdit* lineEdit = static_cast<QLineEdit*>(layout->itemAt(i)->widget()); + auto* lineEdit = static_cast<QLineEdit*>(layout->itemAt(i)->widget()); list.push_back(QVariant(lineEdit->text())); } diff --git a/Applications/DataExplorer/VtkVis/VtkColorLookupTable.cpp b/Applications/DataExplorer/VtkVis/VtkColorLookupTable.cpp index 2adcfed1ca70ff5601817c03c784c91c3913983a..f18205aaaeef1f35cc02a0d0fecfdaccb1d944b1 100644 --- a/Applications/DataExplorer/VtkVis/VtkColorLookupTable.cpp +++ b/Applications/DataExplorer/VtkVis/VtkColorLookupTable.cpp @@ -66,26 +66,33 @@ void VtkColorLookupTable::Build() std::pair<std::size_t, unsigned char*> lastValue(0, startcolor); std::size_t nextIndex(0); - for (std::map<double, unsigned char*>::const_iterator it = _dict.begin(); it != _dict.end(); ++it) + for (auto it = _dict.begin(); it != _dict.end(); ++it) { - double val = (it->first < range[0]) ? range[0] : ((it->first > range[1]) ? range[1] : it->first); - nextIndex = static_cast<std::size_t>( std::floor(val-range[0]) ); + double val = (it->first < range[0]) + ? range[0] + : ((it->first > range[1]) ? range[1] : it->first); + nextIndex = static_cast<std::size_t>(std::floor(val - range[0])); this->SetTableValueRGBA(nextIndex, it->second); - if ( nextIndex - lastValue.first > 0 ) + if (nextIndex - lastValue.first > 0) for (std::size_t i = lastValue.first + 1; i < nextIndex; i++) { unsigned char int_rgba[4]; - double pos = (i - lastValue.first) / (static_cast<double>(nextIndex - lastValue.first)); + double pos = + (i - lastValue.first) / + (static_cast<double>(nextIndex - lastValue.first)); if (_type == DataHolderLib::LUTType::LINEAR) for (std::size_t j = 0; j < 4; j++) - int_rgba[j] = linInterpolation( (lastValue.second)[j], (it->second)[j], pos); + int_rgba[j] = linInterpolation( + (lastValue.second)[j], (it->second)[j], pos); else if (_type == DataHolderLib::LUTType::EXPONENTIAL) for (std::size_t j = 0; j < 4; j++) - int_rgba[j] = expInterpolation((lastValue.second)[j], (it->second)[j], 0.2, pos); - else // no interpolation + int_rgba[j] = + expInterpolation((lastValue.second)[j], + (it->second)[j], 0.2, pos); + else // no interpolation for (std::size_t j = 0; j < 4; j++) int_rgba[j] = (lastValue.second)[j]; @@ -150,7 +157,7 @@ void VtkColorLookupTable::GetTableValue(vtkIdType idx, unsigned char rgba[4]) void VtkColorLookupTable::setColor(double pos, DataHolderLib::Color const& color) { - unsigned char* dict_rgba = new unsigned char[4]; + auto* dict_rgba = new unsigned char[4]; for (std::size_t i = 0; i < 4; i++) dict_rgba[i] = color[i]; _dict.insert( std::pair<double, unsigned char*>(pos, dict_rgba) ); diff --git a/Applications/DataExplorer/VtkVis/VtkCompositeColormapToImageFilter.cpp b/Applications/DataExplorer/VtkVis/VtkCompositeColormapToImageFilter.cpp index 84ca60e8e73300abef819944ef01044391608f08..35b75e94f9f7bf0a09b9532a879f300e29a36769 100644 --- a/Applications/DataExplorer/VtkVis/VtkCompositeColormapToImageFilter.cpp +++ b/Applications/DataExplorer/VtkVis/VtkCompositeColormapToImageFilter.cpp @@ -89,7 +89,7 @@ void VtkCompositeColormapToImageFilter::SetUserProperty( QString name, QVariant { VtkAlgorithmProperties::SetUserProperty(name, value); - vtkImageMapToColors* map = static_cast<vtkImageMapToColors*>(_outputAlgorithm); + auto* map = static_cast<vtkImageMapToColors*>(_outputAlgorithm); if (name.compare("PassAlphaToOutput") == 0) map->SetPassAlphaToOutput(value.toBool()); else if (name.compare("NumberOfColors") == 0) @@ -100,7 +100,7 @@ void VtkCompositeColormapToImageFilter::SetUserVectorProperty( QString name, QLi { VtkAlgorithmProperties::SetUserVectorProperty(name, values); - vtkImageMapToColors* map = static_cast<vtkImageMapToColors*>(_outputAlgorithm); + auto* map = static_cast<vtkImageMapToColors*>(_outputAlgorithm); if (name.compare("TableRange") == 0) static_cast<vtkLookupTable*>(map->GetLookupTable())->SetTableRange( values[0].toInt(), values[1].toInt()); diff --git a/Applications/DataExplorer/VtkVis/VtkCompositeNodeSelectionFilter.cpp b/Applications/DataExplorer/VtkVis/VtkCompositeNodeSelectionFilter.cpp index a650cf1d569aadfcbc93212ce3f9ba8fd1996e85..3e73af59b04bc3490038069192da193e68ebcd41 100644 --- a/Applications/DataExplorer/VtkVis/VtkCompositeNodeSelectionFilter.cpp +++ b/Applications/DataExplorer/VtkVis/VtkCompositeNodeSelectionFilter.cpp @@ -65,7 +65,7 @@ void VtkCompositeNodeSelectionFilter::setSelectionArray(const std::vector<unsign for (unsigned i=0; i<point_indeces.size(); ++i) { double * coords = static_cast<vtkDataSetAlgorithm*>(_inputAlgorithm)->GetOutput()->GetPoint(point_indeces[i]); - GeoLib::Point* p (new GeoLib::Point(coords[0], coords[1], coords[2])); + auto* p(new GeoLib::Point(coords[0], coords[1], coords[2])); _selection.push_back(p); } init(); diff --git a/Applications/DataExplorer/VtkVis/VtkCustomInteractorStyle.cpp b/Applications/DataExplorer/VtkVis/VtkCustomInteractorStyle.cpp index 72403ab34ca86a9220606d89f2bbb82ccb30b5a3..d11450ed5c49830bf873fcd5db017c81ae220dee 100644 --- a/Applications/DataExplorer/VtkVis/VtkCustomInteractorStyle.cpp +++ b/Applications/DataExplorer/VtkVis/VtkCustomInteractorStyle.cpp @@ -186,7 +186,8 @@ void VtkCustomInteractorStyle::OnLeftButtonDown() // check if the underlying object is a mesh and if so, send a signal to the element model for display of information about the picked element. vtkAlgorithm* data_set = picker->GetActor()->GetMapper()->GetInputConnection(0, 0)->GetProducer()->GetInputConnection(0,0)->GetProducer(); - vtkUnstructuredGridAlgorithm* source = dynamic_cast<vtkUnstructuredGridAlgorithm*>(data_set); + auto* source = + dynamic_cast<vtkUnstructuredGridAlgorithm*>(data_set); if (source) emit elementPicked(source, static_cast<unsigned>(picker->GetCellId())); else diff --git a/Applications/DataExplorer/VtkVis/VtkPickCallback.cpp b/Applications/DataExplorer/VtkVis/VtkPickCallback.cpp index fd8d8e199fffff7fc668d08bae7a3786dc44d6e2..ba40e2b1b2973c08df61caf5ac984fbf57abd80a 100644 --- a/Applications/DataExplorer/VtkVis/VtkPickCallback.cpp +++ b/Applications/DataExplorer/VtkVis/VtkPickCallback.cpp @@ -28,7 +28,7 @@ VtkPickCallback* VtkPickCallback::New() void VtkPickCallback::Execute( vtkObject* caller, unsigned long vtkNotUsed( eventId), void* vtkNotUsed(callData) ) { - vtkCellPicker* picker = static_cast<vtkCellPicker*>(caller); + auto* picker = static_cast<vtkCellPicker*>(caller); if (picker->GetCellId() < 0) { // Nothing is picked diff --git a/Applications/DataExplorer/VtkVis/VtkPointsSource.cpp b/Applications/DataExplorer/VtkVis/VtkPointsSource.cpp index 1f0778dfeaf91b2d3f59cec47d1d18f127d989fb..8832400f5081153f2316b5897ecee2ba3b01b246 100644 --- a/Applications/DataExplorer/VtkVis/VtkPointsSource.cpp +++ b/Applications/DataExplorer/VtkVis/VtkPointsSource.cpp @@ -51,8 +51,7 @@ void VtkPointsSource::PrintSelf( ostream& os, vtkIndent indent ) os << indent << "== VtkPointsSource ==" << "\n"; int i = 0; - for (std::vector<GeoLib::Point*>::const_iterator it = _points->begin(); - it != _points->end(); ++it) + for (auto it = _points->begin(); it != _points->end(); ++it) { const double* coords = (*it)->getCoords(); os << indent << "Point " << i << " (" << coords[0] << ", " << coords[1] << ", " << @@ -96,8 +95,7 @@ int VtkPointsSource::RequestData( vtkInformation* request, // Generate points and vertices unsigned i = 0; - for (std::vector<GeoLib::Point*>::const_iterator it = _points->begin(); - it != _points->end(); ++it) + for (auto it = _points->begin(); it != _points->end(); ++it) { double coords[3] = {(*(*it))[0], (*(*it))[1], (*(*it))[2]}; newPoints->SetPoint(i, coords); diff --git a/Applications/DataExplorer/VtkVis/VtkPolylinesSource.cpp b/Applications/DataExplorer/VtkVis/VtkPolylinesSource.cpp index 3ba34340ffbcb1e2097195c4412133d55c8b3e67..4f0b79471afb7a1187650a519c3f8a8e5e9e60c5 100644 --- a/Applications/DataExplorer/VtkVis/VtkPolylinesSource.cpp +++ b/Applications/DataExplorer/VtkVis/VtkPolylinesSource.cpp @@ -54,8 +54,7 @@ void VtkPolylinesSource::PrintSelf( ostream& os, vtkIndent indent ) if (_polylines->size() == 0) return; - for (std::vector<GeoLib::Polyline*>::const_iterator it = _polylines->begin(); - it != _polylines->end(); ++it) + for (auto it = _polylines->begin(); it != _polylines->end(); ++it) { os << indent << "== Polyline ==" << "\n"; int numPoints = (*it)->getNumberOfPoints(); diff --git a/Applications/DataExplorer/VtkVis/VtkRaster.cpp b/Applications/DataExplorer/VtkVis/VtkRaster.cpp index 7f289cff5d0c2c72dd4a6b9eec863c742774e562..9ce56065c3de0fbdbc28f90fce24c59ec32a803a 100644 --- a/Applications/DataExplorer/VtkVis/VtkRaster.cpp +++ b/Applications/DataExplorer/VtkVis/VtkRaster.cpp @@ -67,7 +67,7 @@ vtkImageAlgorithm* VtkRaster::loadImage(const std::string &fileName, vtkImageImport* VtkRaster::loadImageFromArray(double const*const data_array, GeoLib::RasterHeader header) { const unsigned length = header.n_rows*header.n_cols; - float* data = new float[length*2]; + auto* data = new float[length * 2]; float max_val = *std::max_element(data_array, data_array+length); for (unsigned j=0; j<length; ++j) { @@ -139,8 +139,8 @@ vtkImageImport* VtkRaster::loadImageFromTIFF(const std::string &fileName, } // read pixel values - uint32* pixVal = - (uint32*) _TIFFmalloc(imgWidth * imgHeight * sizeof (uint32)); + auto* pixVal = + (uint32*)_TIFFmalloc(imgWidth * imgHeight * sizeof(uint32)); if ((imgWidth > 0) && (imgHeight > 0)) if (!TIFFReadRGBAImage(tiff, imgWidth, imgHeight, pixVal, 0)) { @@ -162,8 +162,8 @@ vtkImageImport* VtkRaster::loadImageFromTIFF(const std::string &fileName, &cmap_green, &cmap_blue); - float* data = new float[imgWidth * imgHeight * 4]; - int* pxl (new int[4]); + auto* data = new float[imgWidth * imgHeight * 4]; + auto* pxl(new int[4]); for (int j = 0; j < imgHeight; ++j) { int lineindex = j * imgWidth; diff --git a/Applications/DataExplorer/VtkVis/VtkStationSource.cpp b/Applications/DataExplorer/VtkVis/VtkStationSource.cpp index 0937fea68d64bee96662edc5d630f511ebbb4415..ea9e379cdf184f585d44f6d582d240131c428b16 100644 --- a/Applications/DataExplorer/VtkVis/VtkStationSource.cpp +++ b/Applications/DataExplorer/VtkVis/VtkStationSource.cpp @@ -54,8 +54,7 @@ void VtkStationSource::PrintSelf( ostream& os, vtkIndent indent ) os << indent << "== VtkStationSource ==" << "\n"; int i = 0; - for (std::vector<GeoLib::Point*>::const_iterator it = _stations->begin(); - it != _stations->end(); ++it) + for (auto it = _stations->begin(); it != _stations->end(); ++it) { const double* coords = (*it)->getCoords(); os << indent << "Station " << i << " (" << coords[0] << ", " << coords[1] << @@ -123,8 +122,7 @@ int VtkStationSource::RequestData( vtkInformation* request, std::size_t site_count(0); // Generate graphic objects - for (std::vector<GeoLib::Point*>::const_iterator it = _stations->begin(); - it != _stations->end(); ++it) + for (auto it = _stations->begin(); it != _stations->end(); ++it) { double coords[3] = { (*(*it))[0], (*(*it))[1], (*(*it))[2] }; vtkIdType sid = newStations->InsertNextPoint(coords); @@ -144,13 +142,15 @@ int VtkStationSource::RequestData( vtkInformation* request, for (std::size_t i = 1; i < nLayers; i++) { - double* pCoords = const_cast<double*>(profile[i]->getCoords()); - double loc[3] = { pCoords[0], pCoords[1], pCoords[2] }; + auto* pCoords = const_cast<double*>(profile[i]->getCoords()); + double loc[3] = {pCoords[0], pCoords[1], pCoords[2]}; newStations->InsertNextPoint(loc); station_ids->InsertNextValue(site_count); newLines->InsertNextCell(2); - newLines->InsertCellPoint(lastMaxIndex); // start of borehole-layer - newLines->InsertCellPoint(++lastMaxIndex); //end of boreholelayer + newLines->InsertCellPoint( + lastMaxIndex); // start of borehole-layer + newLines->InsertCellPoint( + ++lastMaxIndex); // end of boreholelayer strat_ids->InsertNextValue(this->GetIndexByName(soilNames[i])); if (useStationValues) station_values->InsertNextValue(static_cast<GeoLib::Station*>(*it)->getStationValue()); @@ -199,8 +199,7 @@ void VtkStationSource::SetUserProperty( QString name, QVariant value ) std::size_t VtkStationSource::GetIndexByName( std::string const& name ) { vtkIdType max_key(0); - for (std::map<std::string, vtkIdType>::const_iterator it = _id_map.begin(); - it != _id_map.end(); ++it) + for (auto it = _id_map.begin(); it != _id_map.end(); ++it) { if (name.compare(it->first) == 0) return it->second; diff --git a/Applications/DataExplorer/VtkVis/VtkSurfacesSource.cpp b/Applications/DataExplorer/VtkVis/VtkSurfacesSource.cpp index 038be7b47e84ef8cc6661caee9d45b2707b5534d..498f2503905e88f635951fe72ca0925fa8c0fbb5 100644 --- a/Applications/DataExplorer/VtkVis/VtkSurfacesSource.cpp +++ b/Applications/DataExplorer/VtkVis/VtkSurfacesSource.cpp @@ -91,8 +91,7 @@ int VtkSurfacesSource::RequestData( vtkInformation* request, } vtkIdType count(0); - for (std::vector<GeoLib::Surface*>::const_iterator it = _surfaces->begin(); - it != _surfaces->end(); ++it) + for (auto it = _surfaces->begin(); it != _surfaces->end(); ++it) { const std::size_t nTriangles = (*it)->getNumberOfTriangles(); diff --git a/Applications/DataExplorer/VtkVis/VtkVisImageItem.cpp b/Applications/DataExplorer/VtkVis/VtkVisImageItem.cpp index 275dcf32489b1ddc500d9e349696faff46eb4f3c..02591fa96aa4581ebdb336155bd9aa6be9f38603 100644 --- a/Applications/DataExplorer/VtkVis/VtkVisImageItem.cpp +++ b/Applications/DataExplorer/VtkVis/VtkVisImageItem.cpp @@ -59,28 +59,28 @@ VtkVisImageItem::~VtkVisImageItem() void VtkVisImageItem::Initialize(vtkRenderer* renderer) { - vtkImageAlgorithm* img = dynamic_cast<vtkImageAlgorithm*>(_algorithm); + auto* img = dynamic_cast<vtkImageAlgorithm*>(_algorithm); img->Update(); - //VtkGeoImageSource* img = dynamic_cast<VtkGeoImageSource*>(_algorithm); + // VtkGeoImageSource* img = dynamic_cast<VtkGeoImageSource*>(_algorithm); double origin[3]; double spacing[3]; double range[2]; img->GetOutput()->GetOrigin(origin); img->GetOutput()->GetSpacing(spacing); - //img->getRange(range); + // img->getRange(range); img->GetOutput()->GetPointData()->GetScalars()->GetRange(range); vtkImageShiftScale* scale = vtkImageShiftScale::New(); scale->SetOutputScalarTypeToUnsignedChar(); scale->SetInputConnection(img->GetOutputPort()); scale->SetShift(-range[0]); - scale->SetScale(255.0/(range[1]-range[0])); + scale->SetScale(255.0 / (range[1] - range[0])); _transformFilter = vtkImageChangeInformation::New(); _transformFilter->SetInputConnection(scale->GetOutputPort()); - //double origin[3]; - //img->getOrigin(origin); - //double spacing = img->getSpacing(); + // double origin[3]; + // img->getOrigin(origin); + // double spacing = img->getSpacing(); //_transformFilter->SetOutputOrigin(origin2); //_transformFilter->SetOutputSpacing(spacing2); _transformFilter->Update(); @@ -94,18 +94,18 @@ void VtkVisImageItem::Initialize(vtkRenderer* renderer) _renderer->AddActor(_actor); // Set pre-set properties - VtkAlgorithmProperties* vtkProps = dynamic_cast<VtkAlgorithmProperties*>(_algorithm); + auto* vtkProps = dynamic_cast<VtkAlgorithmProperties*>(_algorithm); if (vtkProps) setVtkProperties(vtkProps); - VtkVisPipelineItem* parentItem = dynamic_cast<VtkVisPipelineItem*>(this->parentItem()); + auto* parentItem = dynamic_cast<VtkVisPipelineItem*>(this->parentItem()); while (parentItem) { - VtkAlgorithmProperties* parentProps = - dynamic_cast<VtkAlgorithmProperties*>(parentItem->algorithm()); + auto* parentProps = + dynamic_cast<VtkAlgorithmProperties*>(parentItem->algorithm()); if (parentProps) { - VtkAlgorithmProperties* newProps = new VtkAlgorithmProperties(); + auto* newProps = new VtkAlgorithmProperties(); newProps->SetScalarVisibility(parentProps->GetScalarVisibility()); newProps->SetTexture(parentProps->GetTexture()); setVtkProperties(newProps); @@ -113,7 +113,8 @@ void VtkVisImageItem::Initialize(vtkRenderer* renderer) parentItem = nullptr; } else - parentItem = dynamic_cast<VtkVisPipelineItem*>(parentItem->parentItem()); + parentItem = + dynamic_cast<VtkVisPipelineItem*>(parentItem->parentItem()); } // Set active scalar to the desired one from VtkAlgorithmProperties @@ -124,8 +125,8 @@ void VtkVisImageItem::Initialize(vtkRenderer* renderer) this->SetActiveAttribute(vtkProps->GetActiveAttribute()); else { - VtkVisPipelineItem* visParentItem = - dynamic_cast<VtkVisPipelineItem*>(this->parentItem()); + auto* visParentItem = + dynamic_cast<VtkVisPipelineItem*>(this->parentItem()); if (visParentItem) this->SetActiveAttribute(visParentItem->GetActiveAttribute()); if (vtkProps->GetTexture() != nullptr) @@ -143,7 +144,7 @@ void VtkVisImageItem::setVtkProperties(VtkAlgorithmProperties* vtkProps) int VtkVisImageItem::callVTKWriter(vtkAlgorithm* algorithm, const std::string &filename) const { std::string file_name_cpy(filename); - vtkImageAlgorithm* algID = dynamic_cast<vtkImageAlgorithm*>(algorithm); + auto* algID = dynamic_cast<vtkImageAlgorithm*>(algorithm); if (algID) { vtkSmartPointer<vtkXMLImageDataWriter> iWriter = diff --git a/Applications/DataExplorer/VtkVis/VtkVisPipeline.cpp b/Applications/DataExplorer/VtkVis/VtkVisPipeline.cpp index 2ecc975736b8aa339e913b54a1d29d14ba775bc9..de4bf4fc8a295c698f9e4c9e2e20b8d90b2669c7 100644 --- a/Applications/DataExplorer/VtkVis/VtkVisPipeline.cpp +++ b/Applications/DataExplorer/VtkVis/VtkVisPipeline.cpp @@ -91,7 +91,7 @@ bool VtkVisPipeline::setData( const QModelIndex &index, const QVariant &value, void VtkVisPipeline::addLight(const GeoLib::Point &pos) { double lightPos[3]; - for (std::list<vtkLight*>::iterator it = _lights.begin(); it != _lights.end(); ++it) + for (auto it = _lights.begin(); it != _lights.end(); ++it) { (*it)->GetPosition(lightPos); if (pos[0] == lightPos[0] && pos[1] == lightPos[1] && pos[2] == lightPos[2]) @@ -106,7 +106,7 @@ void VtkVisPipeline::addLight(const GeoLib::Point &pos) vtkLight* VtkVisPipeline::getLight(const GeoLib::Point &pos) const { double lightPos[3]; - for (std::list<vtkLight*>::const_iterator it = _lights.begin(); it != _lights.end(); ++it) + for (auto it = _lights.begin(); it != _lights.end(); ++it) { (*it)->GetPosition(lightPos); if (pos[0] == lightPos[0] && pos[1] == lightPos[1] && pos[2] == lightPos[2]) @@ -118,7 +118,7 @@ vtkLight* VtkVisPipeline::getLight(const GeoLib::Point &pos) const void VtkVisPipeline::removeLight(const GeoLib::Point &pos) { double lightPos[3]; - for (std::list<vtkLight*>::iterator it = _lights.begin(); it != _lights.end(); ++it) + for (auto it = _lights.begin(); it != _lights.end(); ++it) { (*it)->GetPosition(lightPos); if (pos[0] == lightPos[0] && pos[1] == lightPos[1] && pos[2] == lightPos[2]) @@ -233,7 +233,7 @@ void VtkVisPipeline::setGlobalSuperelevation(double factor) const // iterate over all source items for (int i = 0; i < _rootItem->childCount(); ++i) { - VtkVisPipelineItem* item = static_cast<VtkVisPipelineItem*>(_rootItem->child(i)); + auto* item = static_cast<VtkVisPipelineItem*>(_rootItem->child(i)); item->setScale(1.0, 1.0, factor); // recursively set on all child items @@ -248,7 +248,7 @@ void VtkVisPipeline::setGlobalBackfaceCulling(bool enable) const // iterate over all source items for (int i = 0; i < _rootItem->childCount(); ++i) { - VtkVisPipelineItem* item = static_cast<VtkVisPipelineItem*>(_rootItem->child(i)); + auto* item = static_cast<VtkVisPipelineItem*>(_rootItem->child(i)); item->setBackfaceCulling(enable); // recursively set on all child items @@ -315,12 +315,11 @@ QModelIndex VtkVisPipeline::addPipelineItem( vtkAlgorithm* source, QModelIndex p if (!parent.isValid()) // if source object { - vtkGenericDataObjectReader* old_reader = dynamic_cast<vtkGenericDataObjectReader*>(source); - vtkXMLReader* new_reader = dynamic_cast<vtkXMLReader*>(source); - vtkImageReader2* image_reader = dynamic_cast<vtkImageReader2*>(source); - VtkAlgorithmProperties* props = dynamic_cast<VtkAlgorithmProperties*>(source); - MeshLib::VtkMappedMeshSource* meshSource = - dynamic_cast<MeshLib::VtkMappedMeshSource*>(source); + auto* old_reader = dynamic_cast<vtkGenericDataObjectReader*>(source); + auto* new_reader = dynamic_cast<vtkXMLReader*>(source); + auto* image_reader = dynamic_cast<vtkImageReader2*>(source); + auto* props = dynamic_cast<VtkAlgorithmProperties*>(source); + auto* meshSource = dynamic_cast<MeshLib::VtkMappedMeshSource*>(source); if (old_reader) itemName = old_reader->GetFileName(); else if (new_reader) @@ -377,11 +376,12 @@ void VtkVisPipeline::removeSourceItem(StationTreeModel* model, const std::string void VtkVisPipeline::removeSourceItem(MshModel* model, const QModelIndex &idx) { - MshItem* sItem = static_cast<MshItem*>(model->getItem(idx)); + auto* sItem = static_cast<MshItem*>(model->getItem(idx)); for (int i = 0; i < _rootItem->childCount(); i++) { - VtkVisPipelineItem* item = static_cast<VtkVisPipelineItem*>(getItem(index(i, 0))); + VtkVisPipelineItem* item = + static_cast<VtkVisPipelineItem*>(getItem(index(i, 0))); if (item->algorithm() == sItem->vtkSource()) { removePipelineItem(index(i, 0)); @@ -443,22 +443,25 @@ void VtkVisPipeline::showMeshElementQuality( int const nSources = this->_rootItem->childCount(); for (int i = 0; i < nSources; i++) { - VtkVisPipelineItem* parentItem = - static_cast<VtkVisPipelineItem*>(_rootItem->child(i)); + auto* parentItem = + static_cast<VtkVisPipelineItem*>(_rootItem->child(i)); if (parentItem->algorithm() != source) continue; QList<QVariant> itemData; - itemData << "MeshQuality: " + QString::fromStdString( - MeshQualityType2String(t)) << true; + itemData << "MeshQuality: " + + QString::fromStdString(MeshQualityType2String(t)) + << true; - VtkCompositeFilter* filter = - VtkFilterFactory::CreateCompositeFilter("VtkCompositeElementSelectionFilter", - parentItem->transformFilter()); + VtkCompositeFilter* filter = VtkFilterFactory::CreateCompositeFilter( + "VtkCompositeElementSelectionFilter", + parentItem->transformFilter()); if (t == MeshLib::MeshQualityType::ELEMENTSIZE) { - auto const range (std::minmax_element(quality.cbegin(), quality.cend())); - static_cast<VtkCompositeElementSelectionFilter*>(filter)->setRange(*range.first, *range.second); + auto const range( + std::minmax_element(quality.cbegin(), quality.cend())); + static_cast<VtkCompositeElementSelectionFilter*>(filter)->setRange( + *range.first, *range.second); } static_cast<VtkCompositeElementSelectionFilter*>(filter)->setSelectionArray("Selection", quality); VtkVisPointSetItem* item = new VtkVisPointSetItem(filter, parentItem, itemData); @@ -473,18 +476,22 @@ void VtkVisPipeline::highlightGeoObject(const vtkPolyDataAlgorithm* source, int int nSources = this->_rootItem->childCount(); for (int i = 0; i < nSources; i++) { - VtkVisPipelineItem* parentItem = static_cast<VtkVisPipelineItem*>(_rootItem->child(i)); + auto* parentItem = + static_cast<VtkVisPipelineItem*>(_rootItem->child(i)); if (parentItem->algorithm() == source) { QList<QVariant> itemData; itemData << "Selected GeoObject" << true; - VtkCompositeFilter* filter = VtkFilterFactory::CreateCompositeFilter( - "VtkCompositeGeoObjectFilter", - parentItem->transformFilter()); + VtkCompositeFilter* filter = + VtkFilterFactory::CreateCompositeFilter( + "VtkCompositeGeoObjectFilter", + parentItem->transformFilter()); static_cast<VtkCompositeGeoObjectFilter*>(filter)->SetIndex(index); - VtkVisPointSetItem* item = new VtkVisPointSetItem(filter, parentItem, itemData); - QModelIndex parent_index = static_cast<TreeModel*>(this)->index(i, 0, QModelIndex()); + VtkVisPointSetItem* item = + new VtkVisPointSetItem(filter, parentItem, itemData); + QModelIndex parent_index = + static_cast<TreeModel*>(this)->index(i, 0, QModelIndex()); _highlighted_geo_index = this->addPipelineItem(item, parent_index); break; } @@ -505,7 +512,8 @@ void VtkVisPipeline::highlightMeshComponent(vtkUnstructuredGridAlgorithm const*c int nSources = this->_rootItem->childCount(); for (int i = 0; i < nSources; i++) { - VtkVisPipelineItem* parentItem = static_cast<VtkVisPipelineItem*>(_rootItem->child(i)); + auto* parentItem = + static_cast<VtkVisPipelineItem*>(_rootItem->child(i)); if (parentItem->algorithm() == source) { QList<QVariant> itemData; @@ -513,25 +521,34 @@ void VtkVisPipeline::highlightMeshComponent(vtkUnstructuredGridAlgorithm const*c QList<QVariant> selected_index; selected_index << index << index; - VtkCompositeFilter* filter (nullptr); + VtkCompositeFilter* filter(nullptr); if (is_element) { - filter = VtkFilterFactory::CreateCompositeFilter("VtkCompositeElementSelectionFilter", - parentItem->transformFilter()); - static_cast<VtkCompositeElementSelectionFilter*>(filter)->setSelectionArray("vtkIdFilter_Ids"); - static_cast<VtkCompositeElementSelectionFilter*>(filter)->SetUserVectorProperty("Threshold Between", selected_index); + filter = VtkFilterFactory::CreateCompositeFilter( + "VtkCompositeElementSelectionFilter", + parentItem->transformFilter()); + static_cast<VtkCompositeElementSelectionFilter*>(filter) + ->setSelectionArray("vtkIdFilter_Ids"); + static_cast<VtkCompositeElementSelectionFilter*>(filter) + ->SetUserVectorProperty("Threshold Between", + selected_index); } else { - filter = VtkFilterFactory::CreateCompositeFilter("VtkCompositeNodeSelectionFilter", - parentItem->transformFilter()); + filter = VtkFilterFactory::CreateCompositeFilter( + "VtkCompositeNodeSelectionFilter", + parentItem->transformFilter()); std::vector<unsigned> indeces(1); indeces[0] = index; - static_cast<VtkCompositeNodeSelectionFilter*>(filter)->setSelectionArray(indeces); + static_cast<VtkCompositeNodeSelectionFilter*>(filter) + ->setSelectionArray(indeces); } - VtkVisPointSetItem* item = new VtkVisPointSetItem(filter, parentItem, itemData); - QModelIndex parent_index = static_cast<TreeModel*>(this)->index(i, 0, QModelIndex()); - _highlighted_mesh_component = this->addPipelineItem(item, parent_index); + VtkVisPointSetItem* item = + new VtkVisPointSetItem(filter, parentItem, itemData); + QModelIndex parent_index = + static_cast<TreeModel*>(this)->index(i, 0, QModelIndex()); + _highlighted_mesh_component = + this->addPipelineItem(item, parent_index); break; } } diff --git a/Applications/DataExplorer/VtkVis/VtkVisPipelineItem.cpp b/Applications/DataExplorer/VtkVis/VtkVisPipelineItem.cpp index 589e768e2a4f439ee65fafc628f377a5e45058e4..787d9eef6b7299eca0b05967ede3589693e4be45 100644 --- a/Applications/DataExplorer/VtkVis/VtkVisPipelineItem.cpp +++ b/Applications/DataExplorer/VtkVis/VtkVisPipelineItem.cpp @@ -54,9 +54,10 @@ VtkVisPipelineItem::VtkVisPipelineItem( _compositeFilter(nullptr), _vtkProps(nullptr) { - VtkVisPipelineItem* visParentItem = dynamic_cast<VtkVisPipelineItem*>(parentItem); + auto* visParentItem = dynamic_cast<VtkVisPipelineItem*>(parentItem); if (parentItem->parentItem()) - _algorithm->SetInputConnection(visParentItem->algorithm()->GetOutputPort()); + _algorithm->SetInputConnection( + visParentItem->algorithm()->GetOutputPort()); } VtkVisPipelineItem::VtkVisPipelineItem( diff --git a/Applications/DataExplorer/VtkVis/VtkVisPipelineView.cpp b/Applications/DataExplorer/VtkVis/VtkVisPipelineView.cpp index b7484c60ca8872b0559e330cb79027df360c177a..44d471ecd2f942ba18ed9b6ed75baed76171af6a 100644 --- a/Applications/DataExplorer/VtkVis/VtkVisPipelineView.cpp +++ b/Applications/DataExplorer/VtkVis/VtkVisPipelineView.cpp @@ -54,7 +54,7 @@ VtkVisPipelineView::VtkVisPipelineView( QWidget* parent /*= 0*/ ) : QTreeView(parent) { this->setItemsExpandable(false); - CheckboxDelegate* checkboxDelegate = new CheckboxDelegate(this); + auto* checkboxDelegate = new CheckboxDelegate(this); this->setItemDelegateForColumn(1, checkboxDelegate); this->header()->setStretchLastSection(false); this->header()->setSectionResizeMode(QHeaderView::ResizeToContents); @@ -242,7 +242,7 @@ void VtkVisPipelineView::selectionChanged( const QItemSelection &selected, QModelIndex index = *selected.indexes().begin(); if (index.isValid()) { - VtkVisPipelineItem* item = static_cast<VtkVisPipelineItem*>(index.internalPointer()); + auto* item = static_cast<VtkVisPipelineItem*>(index.internalPointer()); emit actorSelected(item->actor()); emit itemSelected(item); if (item->transformFilter()) @@ -287,7 +287,7 @@ void VtkVisPipelineView::addColorTable() if (fi.suffix().toLower() == "xml") { - VtkVisPointSetItem* pointSetItem = dynamic_cast<VtkVisPointSetItem*>(item); + auto* pointSetItem = dynamic_cast<VtkVisPointSetItem*>(item); if (pointSetItem) { VtkAlgorithmProperties* props = pointSetItem->getVtkProperties(); diff --git a/Applications/DataExplorer/VtkVis/VtkVisPointSetItem.cpp b/Applications/DataExplorer/VtkVis/VtkVisPointSetItem.cpp index 97b8072c51aa274b1e82729487ba7e567a1f48dd..7235847531202acfcb848d09aa0af5b766893e6e 100644 --- a/Applications/DataExplorer/VtkVis/VtkVisPointSetItem.cpp +++ b/Applications/DataExplorer/VtkVis/VtkVisPointSetItem.cpp @@ -61,19 +61,20 @@ VtkVisPointSetItem::VtkVisPointSetItem( : VtkVisPipelineItem(algorithm, parentItem, data), _mapper(nullptr), _transformFilter(nullptr), _onPointData(true), _activeArrayName("") { - VtkVisPipelineItem* visParentItem = dynamic_cast<VtkVisPipelineItem*>(parentItem); + auto* visParentItem = dynamic_cast<VtkVisPipelineItem*>(parentItem); if (parentItem->parentItem()) { - // special case if parent is image but child is not (e.g. Image2BarChartFilter) + // special case if parent is image but child is not (e.g. + // Image2BarChartFilter) if (dynamic_cast<vtkImageAlgorithm*>(visParentItem->algorithm())) - _algorithm->SetInputConnection(visParentItem->algorithm()->GetOutputPort()); + _algorithm->SetInputConnection( + visParentItem->algorithm()->GetOutputPort()); else { - VtkVisPointSetItem* pointSetItem = - dynamic_cast<VtkVisPointSetItem*>(parentItem); + auto* pointSetItem = dynamic_cast<VtkVisPointSetItem*>(parentItem); if (pointSetItem) _algorithm->SetInputConnection( - pointSetItem->transformFilter()->GetOutputPort()); + pointSetItem->transformFilter()->GetOutputPort()); } } } @@ -120,7 +121,7 @@ void VtkVisPointSetItem::Initialize(vtkRenderer* renderer) // Determine the right pre-set properties // Order is: _algorithm, _compositeFilter, create a new one with props copied from parent - VtkAlgorithmProperties* vtkProps = dynamic_cast<VtkAlgorithmProperties*>(_algorithm); + auto* vtkProps = dynamic_cast<VtkAlgorithmProperties*>(_algorithm); if (!vtkProps) { vtkProps = dynamic_cast<VtkAlgorithmProperties*>(_compositeFilter); @@ -128,22 +129,28 @@ void VtkVisPointSetItem::Initialize(vtkRenderer* renderer) // Copy properties from parent or create a new VtkAlgorithmProperties if (!vtkProps) { - VtkVisPipelineItem* parentItem = dynamic_cast<VtkVisPipelineItem*>(this->parentItem()); + auto* parentItem = + dynamic_cast<VtkVisPipelineItem*>(this->parentItem()); while (parentItem) { VtkAlgorithmProperties* parentProps = nullptr; - if(dynamic_cast<VtkVisPointSetItem*>(parentItem)) - parentProps = dynamic_cast<VtkVisPointSetItem*>(parentItem)->getVtkProperties(); + if (dynamic_cast<VtkVisPointSetItem*>(parentItem)) + parentProps = dynamic_cast<VtkVisPointSetItem*>(parentItem) + ->getVtkProperties(); if (parentProps) { - vtkProps = new VtkAlgorithmProperties(); // TODO memory leak? - vtkProps->SetScalarVisibility(parentProps->GetScalarVisibility()); + vtkProps = + new VtkAlgorithmProperties(); // TODO memory leak? + vtkProps->SetScalarVisibility( + parentProps->GetScalarVisibility()); vtkProps->SetTexture(parentProps->GetTexture()); - vtkProps->SetActiveAttribute(parentProps->GetActiveAttribute()); + vtkProps->SetActiveAttribute( + parentProps->GetActiveAttribute()); parentItem = nullptr; } else - parentItem = dynamic_cast<VtkVisPipelineItem*>(parentItem->parentItem()); + parentItem = dynamic_cast<VtkVisPipelineItem*>( + parentItem->parentItem()); } // Has no parents @@ -198,7 +205,7 @@ void VtkVisPointSetItem::setVtkProperties(VtkAlgorithmProperties* vtkProps) QObject::connect(vtkProps, SIGNAL(ScalarVisibilityChanged(bool)), _mapper, SLOT(SetScalarVisibility(bool))); - vtkActor* actor = dynamic_cast<vtkActor*>(_actor); + auto* actor = dynamic_cast<vtkActor*>(_actor); if (actor) { if (vtkProps->GetTexture() != nullptr) @@ -221,7 +228,7 @@ void VtkVisPointSetItem::setVtkProperties(VtkAlgorithmProperties* vtkProps) int VtkVisPointSetItem::callVTKWriter(vtkAlgorithm* algorithm, const std::string &filename) const { std::string file_name_cpy(filename); - vtkPolyDataAlgorithm* algPD = dynamic_cast<vtkPolyDataAlgorithm*>(algorithm); + auto* algPD = dynamic_cast<vtkPolyDataAlgorithm*>(algorithm); if (algPD) { vtkSmartPointer<vtkXMLPolyDataWriter> pdWriter = @@ -233,7 +240,7 @@ int VtkVisPointSetItem::callVTKWriter(vtkAlgorithm* algorithm, const std::string return pdWriter->Write(); } - vtkUnstructuredGridAlgorithm* algUG = dynamic_cast<vtkUnstructuredGridAlgorithm*>(algorithm); + auto* algUG = dynamic_cast<vtkUnstructuredGridAlgorithm*>(algorithm); if (algUG) { vtkSmartPointer<vtkXMLUnstructuredGridWriter> ugWriter = @@ -300,7 +307,7 @@ void VtkVisPointSetItem::SetActiveAttribute( const QString& name ) _mapper->ScalarVisibilityOn(); _mapper->UseLookupTableScalarRangeOn(); - QVtkDataSetMapper* mapper = dynamic_cast<QVtkDataSetMapper*>(_mapper); + auto* mapper = dynamic_cast<QVtkDataSetMapper*>(_mapper); if (mapper) { // Create a default color table when there is no lookup table for this attribute @@ -340,7 +347,7 @@ void VtkVisPointSetItem::setScale(double x, double y, double z) const { if (this->transformFilter()) { - vtkTransform* transform = + auto* transform = static_cast<vtkTransform*>(this->_transformFilter->GetTransform()); double* trans = transform->GetPosition(); transform->Identity(); @@ -354,7 +361,7 @@ void VtkVisPointSetItem::setTranslation(double x, double y, double z) const { if (this->transformFilter()) { - vtkTransform* transform = + auto* transform = static_cast<vtkTransform*>(this->_transformFilter->GetTransform()); double* scale = transform->GetScale(); transform->Identity(); diff --git a/Applications/DataExplorer/VtkVis/VtkVisTabWidget.cpp b/Applications/DataExplorer/VtkVis/VtkVisTabWidget.cpp index 7d2e816ef9564c45d477b9109bc233ac49a2f6cf..867dec7385d4cef092689cec9daf2a29adb1fcfd 100644 --- a/Applications/DataExplorer/VtkVis/VtkVisTabWidget.cpp +++ b/Applications/DataExplorer/VtkVis/VtkVisTabWidget.cpp @@ -66,7 +66,8 @@ void VtkVisTabWidget::setActiveItem( VtkVisPipelineItem* item ) _item = item; transformTabWidget->setEnabled(true); - vtkTransformFilter* transform_filter = dynamic_cast<vtkTransformFilter*>(_item->transformFilter()); + auto* transform_filter = + dynamic_cast<vtkTransformFilter*>(_item->transformFilter()); if (transform_filter) // if data set { actorPropertiesGroupBox->setEnabled(true); @@ -76,8 +77,8 @@ void VtkVisTabWidget::setActiveItem( VtkVisPipelineItem* item ) edgeColorPickerButton->setColor(vtkProps->GetEdgeColor()); opacitySlider->setValue((int)(vtkProps->GetOpacity() * 100.0)); - vtkTransform* transform = - static_cast<vtkTransform*>(transform_filter->GetTransform()); + auto* transform = + static_cast<vtkTransform*>(transform_filter->GetTransform()); if (transform) { double scale[3]; @@ -119,7 +120,8 @@ void VtkVisTabWidget::setActiveItem( VtkVisPipelineItem* item ) { const VtkVisImageItem* img = static_cast<VtkVisImageItem*>(_item); actorPropertiesGroupBox->setEnabled(false); - vtkImageChangeInformation* transform = static_cast<vtkImageChangeInformation*>(img->transformFilter()); + auto* transform = + static_cast<vtkImageChangeInformation*>(img->transformFilter()); double trans[3]; transform->GetOriginTranslation(trans); this->transX->blockSignals(true); @@ -197,13 +199,13 @@ void VtkVisTabWidget::on_scaleZ_textChanged(const QString &text) VtkVisPipelineItem* childItem = _item->child(i); if (childItem) { - VtkCompositeColorByHeightFilter* colorFilter = - dynamic_cast<VtkCompositeColorByHeightFilter*> - (childItem->compositeFilter()); + auto* colorFilter = + dynamic_cast<VtkCompositeColorByHeightFilter*>( + childItem->compositeFilter()); if (colorFilter) VtkColorByHeightFilter::SafeDownCast( - colorFilter->GetOutputAlgorithm())-> - SetTableRangeScaling(scale); + colorFilter->GetOutputAlgorithm()) + ->SetTableRangeScaling(scale); } } @@ -229,8 +231,9 @@ void VtkVisTabWidget::translateItem() void VtkVisTabWidget::buildProportiesDialog(VtkVisPipelineItem* item) { - QFormLayout* layout = static_cast<QFormLayout*>(this->scrollAreaWidgetContents->layout()); - while(layout->count()) + auto* layout = + static_cast<QFormLayout*>(this->scrollAreaWidgetContents->layout()); + while (layout->count()) delete layout->takeAt(0)->widget(); QMap<QString, QVariant>* propMap = nullptr; @@ -244,7 +247,8 @@ void VtkVisTabWidget::buildProportiesDialog(VtkVisPipelineItem* item) if (item->compositeFilter()) { propMap = item->compositeFilter()->GetAlgorithmUserProperties(); - propVecMap = item->compositeFilter()->GetAlgorithmUserVectorProperties(); + propVecMap = + item->compositeFilter()->GetAlgorithmUserVectorProperties(); } else { diff --git a/Applications/DataExplorer/main.cpp b/Applications/DataExplorer/main.cpp index 256090d31c7ae1910e0860a83869ca13d6bcb769..0e7bc1a981597df5e0b72c8dab83244d4d089cdd 100644 --- a/Applications/DataExplorer/main.cpp +++ b/Applications/DataExplorer/main.cpp @@ -27,8 +27,8 @@ int main(int argc, char* argv[]) vtkOutputWindow::SetInstance(myOutputWindow); LOGOG_INITIALIZE(); - logog::Cout* logogCout = new logog::Cout; - BaseLib::LogogSimpleFormatter* formatter = new BaseLib::LogogSimpleFormatter; + auto* logogCout = new logog::Cout; + auto* formatter = new BaseLib::LogogSimpleFormatter; logogCout->SetFormatter(*formatter); QApplication a(argc, argv); QApplication::setApplicationName("OpenGeoSys - Data Explorer"); diff --git a/Applications/DataExplorer/mainwindow.cpp b/Applications/DataExplorer/mainwindow.cpp index a06e5158edf7dfb9f2c33cd262015bb03983660d..c5a7f8daea5031f3c9493855f8ced561e3f086af 100644 --- a/Applications/DataExplorer/mainwindow.cpp +++ b/Applications/DataExplorer/mainwindow.cpp @@ -321,7 +321,7 @@ MainWindow::MainWindow(QWidget* parent /* = 0*/) menuWindows->addAction(showVisDockAction); // Presentation mode - QMenu* presentationMenu = new QMenu(this); + auto* presentationMenu = new QMenu(this); presentationMenu->setTitle("Presentation on"); connect(presentationMenu, SIGNAL(aboutToShow()), this, SLOT(createPresentationMenu())); @@ -379,7 +379,7 @@ void MainWindow::showVisDockWidget(bool show) void MainWindow::open(int file_type) { QSettings settings; - ImportFileType::type t = static_cast<ImportFileType::type>(file_type); + auto t = static_cast<ImportFileType::type>(file_type); QString type_str = QString::fromStdString((ImportFileType::convertImportFileTypeToString(t))); QString fileName = QFileDialog::getOpenFileName(this, "Select " + type_str + " file to import", settings.value("lastOpenedFileDirectory").toString(), @@ -395,7 +395,7 @@ void MainWindow::open(int file_type) void MainWindow::openRecentFile() { - QAction* action = qobject_cast<QAction*> (sender()); + auto* action = qobject_cast<QAction*>(sender()); if (action) loadFile(ImportFileType::OGS, action->data().toString()); } @@ -699,7 +699,7 @@ void MainWindow::about() QMenu* MainWindow::createImportFilesMenu() { - QSignalMapper* signal_mapper = new QSignalMapper(this); //owned by MainWindow + auto* signal_mapper = new QSignalMapper(this); // owned by MainWindow QMenu* importFiles = new QMenu("&Import Files", this); QAction* feflowFiles = importFiles->addAction("&FEFLOW Files..."); connect(feflowFiles, SIGNAL(triggered()), signal_mapper, SLOT(map())); @@ -967,7 +967,7 @@ void MainWindow::callGMSH(std::vector<std::string> & selectedGeometries, void MainWindow::showFileConverter() { - OGSFileConverter* dlg = new OGSFileConverter(this); + auto* dlg = new OGSFileConverter(this); dlg->setAttribute(Qt::WA_DeleteOnClose); dlg->show(); dlg->raise(); @@ -981,7 +981,7 @@ void MainWindow::showDiagramPrefsDialog(QModelIndex &index) if ((stn->type() == GeoLib::Station::StationType::STATION) && stn->getSensorData()) { - DiagramPrefsDialog* prefs ( new DiagramPrefsDialog(stn) ); + auto* prefs(new DiagramPrefsDialog(stn)); prefs->setAttribute(Qt::WA_DeleteOnClose); prefs->show(); } @@ -999,7 +999,7 @@ void MainWindow::showDiagramPrefsDialog() { QDir dir = QDir(fileName); settings.setValue("lastOpenedFileDirectory", dir.absolutePath()); - DiagramPrefsDialog* prefs = new DiagramPrefsDialog(fileName); + auto* prefs = new DiagramPrefsDialog(fileName); prefs->setAttribute(Qt::WA_DeleteOnClose); prefs->show(); } @@ -1020,7 +1020,7 @@ void MainWindow::showGeoNameDialog(const std::string &geometry_name, const GeoLi void MainWindow::showStationNameDialog(const std::string& stn_vec_name, std::size_t id) { std::vector<GeoLib::Point*> const* stations = _project.getGEOObjects().getStationVec(stn_vec_name); - GeoLib::Station *const stn = static_cast<GeoLib::Station*>((*stations)[id]); + auto* const stn = static_cast<GeoLib::Station*>((*stations)[id]); SetNameDialog dlg("Station", id, stn->getName()); if (dlg.exec() != QDialog::Accepted) return; @@ -1047,7 +1047,7 @@ void MainWindow::showMeshElementRemovalDialog() void MainWindow::showMeshAnalysisDialog() { - MeshAnalysisDialog* dlg = new MeshAnalysisDialog(this->_project.getMeshObjects()); + auto* dlg = new MeshAnalysisDialog(this->_project.getMeshObjects()); dlg->exec(); } @@ -1203,12 +1203,13 @@ void MainWindow::on_actionExportObj_triggered(bool checked /*= false*/) void MainWindow::createPresentationMenu() { - QMenu* menu = static_cast<QMenu*> (QObject::sender()); + auto* menu = static_cast<QMenu*>(QObject::sender()); menu->clear(); if (!_vtkWidget->parent()) { QAction* action = new QAction("Quit presentation mode", menu); - connect(action, SIGNAL(triggered()), this, SLOT(quitPresentationMode())); + connect(action, SIGNAL(triggered()), this, + SLOT(quitPresentationMode())); action->setShortcutContext(Qt::WidgetShortcut); action->setShortcut(QKeySequence(Qt::Key_Escape)); menu->addAction(action); diff --git a/Applications/DataHolderLib/Color.cpp b/Applications/DataHolderLib/Color.cpp index 193c18d208353dc0435e4a163848251e01e88171..e651d72f6020de72e534fff4dc856421e69102fa 100644 --- a/Applications/DataHolderLib/Color.cpp +++ b/Applications/DataHolderLib/Color.cpp @@ -44,7 +44,7 @@ Color getRandomColor() Color const getColor(const std::string &id, std::map<std::string, Color> &colors) { - for (std::map<std::string, Color>::const_iterator it=colors.begin(); it !=colors.end(); ++it) + for (auto it = colors.begin(); it != colors.end(); ++it) { if (id.compare(it->first) == 0) return it->second; diff --git a/Applications/FileIO/AsciiRasterInterface.cpp b/Applications/FileIO/AsciiRasterInterface.cpp index 4f6e3d78b5142a3d768421b5c95ff3c0c8a5cc57..374a43431dcf51c3eaeecca04586332477a06cfa 100644 --- a/Applications/FileIO/AsciiRasterInterface.cpp +++ b/Applications/FileIO/AsciiRasterInterface.cpp @@ -47,7 +47,7 @@ GeoLib::Raster* AsciiRasterInterface::getRasterFromASCFile(std::string const& fn // header information GeoLib::RasterHeader header; if (readASCHeader(in, header)) { - double* values = new double[header.n_cols*header.n_rows]; + auto* values = new double[header.n_cols * header.n_rows]; std::string s; // read the data into the double-array for (std::size_t j(0); j < header.n_rows; ++j) { @@ -132,7 +132,7 @@ GeoLib::Raster* AsciiRasterInterface::getRasterFromSurferFile(std::string const& if (readSurferHeader(in, header, min, max)) { const double no_data_val (min-1); - double* values = new double[header.n_cols*header.n_rows]; + auto* values = new double[header.n_cols * header.n_rows]; std::string s; // read the data into the double-array for (std::size_t j(0); j < header.n_rows; ++j) diff --git a/Applications/FileIO/FEFLOW/FEFLOWGeoInterface.cpp b/Applications/FileIO/FEFLOW/FEFLOWGeoInterface.cpp index d926833ae2c6d5686976b519122b771f10c7ec2a..ed934f0a32f424063ea326229ecd6dc1f75fc554 100644 --- a/Applications/FileIO/FEFLOW/FEFLOWGeoInterface.cpp +++ b/Applications/FileIO/FEFLOW/FEFLOWGeoInterface.cpp @@ -200,7 +200,7 @@ void FEFLOWGeoInterface::readSuperMesh(std::ifstream& in, const std::size_t n_points = str.toLong(); QString str_ptId_list = xmlEle.text().simplified(); { - GeoLib::Polyline* line = new GeoLib::Polyline(*points); + auto* line = new GeoLib::Polyline(*points); lines->push_back(line); std::istringstream ss(str_ptId_list.toStdString()); for (std::size_t i = 0; i < n_points; i++) diff --git a/Applications/FileIO/FEFLOW/FEFLOWMeshInterface.cpp b/Applications/FileIO/FEFLOW/FEFLOWMeshInterface.cpp index 78c1c4d084e31feb38446da656ea6ea74beb25fe..1a85ecedf565248d058b5867542952ca26598fd2 100644 --- a/Applications/FileIO/FEFLOW/FEFLOWMeshInterface.cpp +++ b/Applications/FileIO/FEFLOW/FEFLOWMeshInterface.cpp @@ -351,7 +351,7 @@ std::vector<std::size_t> FEFLOWMeshInterface::getIndexList( else if (is_range) { const std::size_t start = vec_node_IDs.back(); - const std::size_t end = BaseLib::str2number<std::size_t>(str); + const auto end = BaseLib::str2number<std::size_t>(str); for (std::size_t i = start + 1; i < end + 1; i++) vec_node_IDs.push_back(i); is_range = false; @@ -477,7 +477,7 @@ MeshLib::Element* FEFLOWMeshInterface::readElement( unsigned idx[8]; for (std::size_t i = 0; i < n_nodes_of_element; ++i) ss >> idx[i]; - MeshLib::Node** ele_nodes = new MeshLib::Node*[n_nodes_of_element]; + auto** ele_nodes = new MeshLib::Node*[n_nodes_of_element]; switch (elem_type) { @@ -518,7 +518,7 @@ MeshLib::Element* FEFLOWMeshInterface::readElement( unsigned idx[8]; for (std::size_t i = 0; i < fem_dim.n_nodes_of_element; ++i) ss >> idx[i]; - MeshLib::Node** ele_nodes = new MeshLib::Node*[fem_dim.n_nodes_of_element]; + auto** ele_nodes = new MeshLib::Node*[fem_dim.n_nodes_of_element]; switch (elem_type) { diff --git a/Applications/FileIO/GMSInterface.cpp b/Applications/FileIO/GMSInterface.cpp index 0dd1370ff5c0a1e210039cc5143f18907f5322d1..1a2f2fbcf737f4aef32a79cdf3eaa37e05ad92ef 100644 --- a/Applications/FileIO/GMSInterface.cpp +++ b/Applications/FileIO/GMSInterface.cpp @@ -41,7 +41,7 @@ int GMSInterface::readBoreholesFromGMS(std::vector<GeoLib::Point*>* boreholes, double depth(-9999.0); std::string line(""), cName(""), sName(""); std::list<std::string>::const_iterator it; - GeoLib::Point* pnt = new GeoLib::Point(); + auto* pnt = new GeoLib::Point(); GeoLib::StationBorehole* newBorehole = nullptr; std::ifstream in( filename.c_str() ); @@ -142,26 +142,24 @@ void GMSInterface::writeBoreholesToGMS(const std::vector<GeoLib::Point*>* statio for (auto station_as_point : *stations) { - GeoLib::StationBorehole* station = - static_cast<GeoLib::StationBorehole*>(station_as_point); + auto* station = static_cast<GeoLib::StationBorehole*>(station_as_point); std::vector<GeoLib::Point*> profile = station->getProfile(); - std::vector<std::string> soilNames = station->getSoilNames(); - //std::size_t idx = 0; + std::vector<std::string> soilNames = station->getSoilNames(); + // std::size_t idx = 0; std::string current_soil_name(""); std::size_t nLayers = profile.size(); for (std::size_t i = 1; i < nLayers; i++) { - if ( (i > 1) && (soilNames[i].compare(soilNames[i - 1]) == 0) ) + if ((i > 1) && (soilNames[i].compare(soilNames[i - 1]) == 0)) continue; - //idx = getSoilID(soilID, soilNames[i]); + // idx = getSoilID(soilID, soilNames[i]); current_soil_name = soilNames[i]; out << station->getName() << "\t" << std::fixed - << (*(profile[i - 1]))[0] << "\t" - << (*(profile[i - 1]))[1] << "\t" - << (*(profile[i - 1]))[2] << "\t" - << current_soil_name/*idx*/ << "\n"; + << (*(profile[i - 1]))[0] << "\t" << (*(profile[i - 1]))[1] + << "\t" << (*(profile[i - 1]))[2] << "\t" + << current_soil_name /*idx*/ << "\n"; } out << station->getName() << "\t" << std::fixed << (*(profile[nLayers - 1]))[0] << "\t" @@ -255,7 +253,7 @@ MeshLib::Mesh* GMSInterface::readGMS3DMMesh(const std::string &filename) { std::stringstream str(line); str >> dummy >> id >> x[0] >> x[1] >> x[2]; - MeshLib::Node* node = new MeshLib::Node(x, id); + auto* node = new MeshLib::Node(x, id); id_map.insert(std::pair<unsigned, unsigned>(id,count++)); nodes.push_back(node); } @@ -278,7 +276,7 @@ MeshLib::Mesh* GMSInterface::readGMS3DMMesh(const std::string &filename) str >> dummy >> id >> node_idx[0] >> node_idx[1] >> node_idx[2] >> node_idx[3] >> node_idx[4] >> node_idx[5] >> mat_id; - MeshLib::Node** prism_nodes = new MeshLib::Node*[6]; + auto** prism_nodes = new MeshLib::Node*[6]; for (unsigned k(0); k<6; k++) { prism_nodes[k] = nodes[id_map.find(node_idx[k])->second]; } @@ -289,7 +287,7 @@ MeshLib::Mesh* GMSInterface::readGMS3DMMesh(const std::string &filename) { str >> dummy >> id >> node_idx[0] >> node_idx[1] >> node_idx[2] >> node_idx[3] >> mat_id; - MeshLib::Node** tet_nodes = new MeshLib::Node*[4]; + auto** tet_nodes = new MeshLib::Node*[4]; for (unsigned k(0); k<4; k++) { tet_nodes[k] = nodes[id_map.find(node_idx[k])->second]; } @@ -300,7 +298,7 @@ MeshLib::Mesh* GMSInterface::readGMS3DMMesh(const std::string &filename) { str >> dummy >> id >> node_idx[0] >> node_idx[1] >> node_idx[2] >> node_idx[3] >> node_idx[4] >> mat_id; - MeshLib::Node** pyramid_nodes = new MeshLib::Node*[5]; + auto** pyramid_nodes = new MeshLib::Node*[5]; for (unsigned k(0); k<5; k++) { pyramid_nodes[k] = nodes[id_map.find(node_idx[k])->second]; } diff --git a/Applications/FileIO/Gmsh/GMSHInterface.cpp b/Applications/FileIO/Gmsh/GMSHInterface.cpp index ee7bb0e948c2cfb325c25ed3ef37ac4dfb08a2b3..ef4cc3c6e3cd748b90f67b1091743386c83fe3a8 100644 --- a/Applications/FileIO/Gmsh/GMSHInterface.cpp +++ b/Applications/FileIO/Gmsh/GMSHInterface.cpp @@ -93,9 +93,8 @@ int GMSHInterface::writeGMSHInputFile(std::ostream& out) _keep_preprocessed_geometry = true; } - std::vector<GeoLib::Point*>* merged_pnts( - const_cast<std::vector<GeoLib::Point*>*>( - _geo_objs.getPointVec(_gmsh_geo_name))); + auto* merged_pnts(const_cast<std::vector<GeoLib::Point*>*>( + _geo_objs.getPointVec(_gmsh_geo_name))); if (! merged_pnts) { ERR("GMSHInterface::writeGMSHInputFile(): Did not found any points."); return 2; diff --git a/Applications/FileIO/Gmsh/GMSHPolygonTree.cpp b/Applications/FileIO/Gmsh/GMSHPolygonTree.cpp index cfbd9812ae3e6611229af5edab56bcb35bccd426..a7c6df941682645490f41c8a61b2b82ccfabd380 100644 --- a/Applications/FileIO/Gmsh/GMSHPolygonTree.cpp +++ b/Applications/FileIO/Gmsh/GMSHPolygonTree.cpp @@ -280,7 +280,8 @@ void GMSHPolygonTree::createGMSHPoints(std::vector<GMSHPoint*> & gmsh_pnts) cons } // walk through children - for (std::list<SimplePolygonTree*>::const_iterator it (_children.begin()); it != _children.end(); ++it) { + for (auto it(_children.begin()); it != _children.end(); ++it) + { dynamic_cast<GMSHPolygonTree*>((*it))->createGMSHPoints(gmsh_pnts); } } @@ -332,7 +333,8 @@ void GMSHPolygonTree::writeLineConstraints(std::size_t& line_offset, void GMSHPolygonTree::writeSubPolygonsAsLineConstraints(std::size_t &line_offset, std::size_t sfc_number, std::ostream& out) const { - for (std::list<SimplePolygonTree*>::const_iterator it (_children.begin()); it != _children.end(); ++it) { + for (auto it(_children.begin()); it != _children.end(); ++it) + { dynamic_cast<GMSHPolygonTree*>((*it))->writeSubPolygonsAsLineConstraints(line_offset, sfc_number, out); } diff --git a/Applications/FileIO/PetrelInterface.cpp b/Applications/FileIO/PetrelInterface.cpp index adc1f2679de2596ff9a8d9f0ac582fdce5438326..a8b264fc5a6271fee21668e8bf9fbefcd704aa3d 100644 --- a/Applications/FileIO/PetrelInterface.cpp +++ b/Applications/FileIO/PetrelInterface.cpp @@ -210,7 +210,7 @@ void PetrelInterface::readPetrelWellTraceData(std::istream &in) // read column information std::list<std::string> str_list = BaseLib::splitString(line, ' '); - std::list<std::string>::const_iterator it = str_list.begin(); + auto it = str_list.begin(); while (it != str_list.end()) { INFO("PetrelInterface::readPetrelWellTraceData(): column information: %s.", it->c_str()); ++it; diff --git a/Applications/FileIO/SHPInterface.cpp b/Applications/FileIO/SHPInterface.cpp index 86614231434fae1e639dec7a6ea1e271bfe5d4c6..5e3969bd7d790eed88d510ec23fc7c8cbdcec7f1 100644 --- a/Applications/FileIO/SHPInterface.cpp +++ b/Applications/FileIO/SHPInterface.cpp @@ -79,9 +79,9 @@ void SHPInterface::readPoints(const SHPHandle &hSHP, int numberOfElements, std:: for (int i = 0; i < numberOfElements; i++) { hSHPObject = SHPReadObject(hSHP, i); - GeoLib::Point* pnt = - new GeoLib::Point(*(hSHPObject->padfX), *(hSHPObject->padfY), - *(hSHPObject->padfZ)); + auto* pnt = + new GeoLib::Point(*(hSHPObject->padfX), *(hSHPObject->padfY), + *(hSHPObject->padfZ)); points->push_back(pnt); } @@ -158,7 +158,7 @@ void SHPInterface::readPolylines(const SHPHandle &hSHP, int numberOfElements, st int const lastPnt = (p<(noOfParts - 1)) ? *(hSHPObject->panPartStart + p + 1) : noOfPoints; - GeoLib::Polyline* line = new GeoLib::Polyline(*points.getVector()); + auto* line = new GeoLib::Polyline(*points.getVector()); // create polyline for (int j = firstPnt; j < lastPnt; ++j) { diff --git a/Applications/FileIO/TetGenInterface.cpp b/Applications/FileIO/TetGenInterface.cpp index 215a6f91b4853a8c53fe221fba6e2bf08d6c3486..b2735b29b51f5e1e6c7120470f1d268bc583682a 100644 --- a/Applications/FileIO/TetGenInterface.cpp +++ b/Applications/FileIO/TetGenInterface.cpp @@ -106,8 +106,8 @@ std::size_t TetGenInterface::getNFacets(std::ifstream &input) continue; const std::list<std::string> fields = BaseLib::splitString(line, ' '); - std::list<std::string>::const_iterator it = fields.begin(); - const std::size_t nFacets (BaseLib::str2number<std::size_t> (*it)); + auto it = fields.begin(); + const auto nFacets(BaseLib::str2number<std::size_t>(*it)); if (fields.size() > 1) _boundary_markers = (BaseLib::str2number<std::size_t> (*(++it)) == 0) ? false : true; return nFacets; @@ -147,7 +147,7 @@ bool TetGenInterface::parseSmeshFacets(std::ifstream &input, // read facets const std::list<std::string> point_fields = BaseLib::splitString(line, ' '); it = point_fields.begin(); - const std::size_t nPoints = BaseLib::str2number<std::size_t>(*it); + const auto nPoints = BaseLib::str2number<std::size_t>(*it); if (nPoints != 3) { ERR ("Smesh-files are currently only supported for triangle meshes."); @@ -306,7 +306,7 @@ bool TetGenInterface::parseNodes(std::ifstream &ins, std::size_t dim) { std::string line; - double* coordinates (new double[dim]); + auto* coordinates(new double[dim]); nodes.reserve(n_nodes); std::size_t k(0); @@ -435,7 +435,8 @@ bool TetGenInterface::parseElements(std::ifstream& ins, bool region_attribute) const { std::string line; - std::size_t* ids (static_cast<std::size_t*>(alloca (sizeof (std::size_t) * n_nodes_per_tet))); + auto* ids(static_cast<std::size_t*>( + alloca(sizeof(std::size_t) * n_nodes_per_tet))); elements.reserve(n_tets); materials.reserve(n_tets); @@ -495,7 +496,7 @@ bool TetGenInterface::parseElements(std::ifstream& ins, } } // insert new element into vector - MeshLib::Node** tet_nodes = new MeshLib::Node*[4]; + auto** tet_nodes = new MeshLib::Node*[4]; for (unsigned k(0); k<4; k++) { tet_nodes[k] = nodes[ids[k]]; } diff --git a/Applications/Utils/OGSFileConverter/main.cpp b/Applications/Utils/OGSFileConverter/main.cpp index 17625cfbc294c3594e0814772851429d755c5573..a8cd544602f740ef7fdb40e678a96e7ee947f5aa 100644 --- a/Applications/Utils/OGSFileConverter/main.cpp +++ b/Applications/Utils/OGSFileConverter/main.cpp @@ -22,7 +22,7 @@ int main(int argc, char* argv[]) QApplication app(argc, argv); setlocale(LC_NUMERIC,"C"); - OGSFileConverter* fc = new OGSFileConverter(); + auto* fc = new OGSFileConverter(); fc->setWindowTitle( fc->windowTitle() ); fc->show(); int returncode = app.exec(); diff --git a/BaseLib/DateTools.cpp b/BaseLib/DateTools.cpp index d330b3d82106245b787ede4ddeaee6c2400548aa..6e0f6cec8095d79116ca9742c4f1a76ce28d3839 100644 --- a/BaseLib/DateTools.cpp +++ b/BaseLib/DateTools.cpp @@ -43,8 +43,8 @@ std::string int2date(int date) { if (date > 10000000 && date < 22000000) { - int y = static_cast<int>(std::floor(date / 10000.0)); - int m = static_cast<int>(std::floor((date - (y * 10000)) / 100.0)); + auto y = static_cast<int>(std::floor(date / 10000.0)); + auto m = static_cast<int>(std::floor((date - (y * 10000)) / 100.0)); int d = date - (y * 10000) - (m * 100); std::stringstream ss; if (d < 10) @@ -66,10 +66,10 @@ std::string date2string(double ddate) return "0.0.0000"; } - int rest (static_cast<int>(ddate)); - int y = static_cast<int>(std::floor(rest / 10000.0)); + auto rest(static_cast<int>(ddate)); + auto y = static_cast<int>(std::floor(rest / 10000.0)); rest = rest % (y * 10000); - int m = static_cast<int>(std::floor(rest / 100.0)); + auto m = static_cast<int>(std::floor(rest / 100.0)); if (m < 1 || m > 12) WARN("date2String(): month not in [1:12]."); rest = rest % (m * 100); diff --git a/BaseLib/Histogram.h b/BaseLib/Histogram.h index 5c7155a896feb10ab68156f33d54c93bbb7d333a..3b7780bff41b31537d59afbfc091b87c9481f23f 100644 --- a/BaseLib/Histogram.h +++ b/BaseLib/Histogram.h @@ -83,13 +83,11 @@ public: _bin_width = (_max - _min) / _nr_bins; - typedef typename Data::const_iterator DataCI; - DataCI it = _data.begin(); - DataCI itEnd; + auto it = _data.begin(); for (unsigned int bin = 0; bin < _nr_bins; bin++) { - itEnd = std::upper_bound(it, (DataCI)_data.end(), - _min + (bin + 1) * _bin_width); + auto itEnd = std::upper_bound(it, _data.end(), + _min + (bin + 1) * _bin_width); _histogram[bin] = std::distance(it, itEnd); it = itEnd; } diff --git a/GeoLib/AnalyticalGeometry.cpp b/GeoLib/AnalyticalGeometry.cpp index e308faa69e1dad246ee5c3dcff42e55c88912aff..d78b3d6ad371a4e8b61e9fbc5274f2561bc98da4 100644 --- a/GeoLib/AnalyticalGeometry.cpp +++ b/GeoLib/AnalyticalGeometry.cpp @@ -351,7 +351,7 @@ GeoLib::Polygon rotatePolygonToXY(GeoLib::Polygon const& polygon_in, MathLib::Vector3 & plane_normal) { // 1 copy all points - std::vector<GeoLib::Point*> *polygon_pnts(new std::vector<GeoLib::Point*>); + auto* polygon_pnts(new std::vector<GeoLib::Point*>); for (std::size_t k(0); k < polygon_in.getNumberOfPoints(); k++) polygon_pnts->push_back (new GeoLib::Point (*(polygon_in.getPoint(k)))); diff --git a/GeoLib/EarClippingTriangulation.cpp b/GeoLib/EarClippingTriangulation.cpp index d52964bc07a17c41f3475e29680bd8518c8a6d0b..eb1bb2b5dfad23bb395c4e6b0c929ae0e89e91d1 100644 --- a/GeoLib/EarClippingTriangulation.cpp +++ b/GeoLib/EarClippingTriangulation.cpp @@ -114,8 +114,8 @@ void EarClippingTriangulation::ensureCWOrientation () bool EarClippingTriangulation::isEar(std::size_t v0, std::size_t v1, std::size_t v2) const { - for (std::list<std::size_t>::const_iterator it (_vertex_list.begin ()); - it != _vertex_list.end(); ++it) { + for (auto it(_vertex_list.begin()); it != _vertex_list.end(); ++it) + { if (*it != v0 && *it != v1 && *it != v2) { if (MathLib::isPointInTriangle (*_pnts[*it], *_pnts[v0], *_pnts[v1], *_pnts[v2])) { return false; diff --git a/GeoLib/GEOObjects.cpp b/GeoLib/GEOObjects.cpp index 87e3bf59c7246d09ee3049b9ade159cb9ce9985a..83651e188838ade67c3f052bddfabef7303fba4f 100644 --- a/GeoLib/GEOObjects.cpp +++ b/GeoLib/GEOObjects.cpp @@ -82,8 +82,7 @@ bool GEOObjects::removePointVec(std::string const& name) return false; } - for (std::vector<PointVec*>::iterator it(_pnt_vecs.begin()); - it != _pnt_vecs.end(); ++it) + for (auto it(_pnt_vecs.begin()); it != _pnt_vecs.end(); ++it) if ((*it)->getName().compare(name) == 0) { _callbacks->removePointVec(name); @@ -106,8 +105,8 @@ void GEOObjects::addStationVec(std::unique_ptr<std::vector<Point*>> stations, const std::vector<GeoLib::Point*>* GEOObjects::getStationVec( const std::string& name) const { - for (std::vector<PointVec*>::const_iterator it(_pnt_vecs.begin()); - it != _pnt_vecs.end(); ++it) { + for (auto it(_pnt_vecs.begin()); it != _pnt_vecs.end(); ++it) + { if ((*it)->getName().compare(name) == 0 && (*it)->getType() == PointVec::PointType::STATION) { return (*it)->getVector(); } @@ -121,12 +120,11 @@ void GEOObjects::addPolylineVec(std::unique_ptr<std::vector<Polyline*>> lines, std::map<std::string, std::size_t>* ply_names) { assert(lines); - for (std::vector<Polyline*>::iterator it (lines->begin()); - it != lines->end(); ) + for (auto it(lines->begin()); it != lines->end();) { if ((*it)->getNumberOfPoints() < 2) { - std::vector<Polyline*>::iterator it_erase (it); + auto it_erase(it); it = lines->erase (it_erase); } else @@ -189,8 +187,7 @@ const PolylineVec* GEOObjects::getPolylineVecObj(const std::string &name) const bool GEOObjects::removePolylineVec(std::string const& name) { _callbacks->removePolylineVec(name); - for (std::vector<PolylineVec*>::iterator it = _ply_vecs.begin(); - it != _ply_vecs.end(); ++it) + for (auto it = _ply_vecs.begin(); it != _ply_vecs.end(); ++it) if ((*it)->getName().compare(name) == 0) { delete *it; @@ -256,8 +253,7 @@ const std::vector<Surface*>* GEOObjects::getSurfaceVec(const std::string &name) bool GEOObjects::removeSurfaceVec(const std::string &name) { _callbacks->removeSurfaceVec(name); - for (std::vector<SurfaceVec*>::iterator it (_sfc_vecs.begin()); - it != _sfc_vecs.end(); ++it) + for (auto it(_sfc_vecs.begin()); it != _sfc_vecs.end(); ++it) if ((*it)->getName().compare (name) == 0) { delete *it; @@ -315,14 +311,12 @@ bool GEOObjects::isUniquePointVecName(std::string &name) bool GEOObjects::isPntVecUsed (const std::string &name) const { // search dependent data structures (Polyline) - for (std::vector<PolylineVec*>::const_iterator it ( _ply_vecs.begin()); it != _ply_vecs.end(); - ++it) + for (auto it(_ply_vecs.begin()); it != _ply_vecs.end(); ++it) { if (((*it)->getName()).compare(name) == 0) return true; } - for (std::vector<SurfaceVec*>::const_iterator it ( _sfc_vecs.begin()); it != _sfc_vecs.end(); - ++it) + for (auto it(_sfc_vecs.begin()); it != _sfc_vecs.end(); ++it) { if (((*it)->getName()).compare(name) == 0) return true; @@ -333,8 +327,7 @@ bool GEOObjects::isPntVecUsed (const std::string &name) const void GEOObjects::getStationVectorNames(std::vector<std::string>& names) const { - for (std::vector<PointVec*>::const_iterator it(_pnt_vecs.begin()); it != _pnt_vecs.end(); - ++it) + for (auto it(_pnt_vecs.begin()); it != _pnt_vecs.end(); ++it) if ((*it)->getType() == PointVec::PointType::STATION) names.push_back((*it)->getName()); } @@ -342,8 +335,7 @@ void GEOObjects::getStationVectorNames(std::vector<std::string>& names) const void GEOObjects::getGeometryNames (std::vector<std::string>& names) const { names.clear (); - for (std::vector<PointVec*>::const_iterator it(_pnt_vecs.begin()); it != _pnt_vecs.end(); - ++it) + for (auto it(_pnt_vecs.begin()); it != _pnt_vecs.end(); ++it) if ((*it)->getType() == PointVec::PointType::POINT) names.push_back((*it)->getName()); } @@ -392,7 +384,7 @@ bool GEOObjects::mergePoints(std::vector<std::string> const & geo_names, auto merged_points = std::unique_ptr<std::vector<GeoLib::Point*>>( new std::vector<GeoLib::Point*>); - std::map<std::string, std::size_t>* merged_pnt_names(new std::map<std::string, std::size_t>); + auto* merged_pnt_names(new std::map<std::string, std::size_t>); for (std::size_t j(0); j < n_geo_names; ++j) { GeoLib::PointVec const*const pnt_vec(this->getPointVecObj(geo_names[j])); @@ -435,7 +427,7 @@ void GEOObjects::mergePolylines(std::vector<std::string> const & geo_names, auto merged_polylines = std::unique_ptr<std::vector<GeoLib::Polyline*>>( new std::vector<GeoLib::Polyline*>); - std::map<std::string, std::size_t>* merged_ply_names(new std::map<std::string, std::size_t>); + auto* merged_ply_names(new std::map<std::string, std::size_t>); std::vector<GeoLib::Point*> const* merged_points(this->getPointVecObj(merged_geo_name)->getVector()); std::vector<std::size_t> const& id_map (this->getPointVecObj(merged_geo_name)->getIDMap ()); @@ -445,7 +437,7 @@ void GEOObjects::mergePolylines(std::vector<std::string> const & geo_names, if (plys) { std::string tmp_name; for (std::size_t k(0); k < plys->size(); k++) { - GeoLib::Polyline* kth_ply_new(new GeoLib::Polyline (*merged_points)); + auto* kth_ply_new(new GeoLib::Polyline(*merged_points)); GeoLib::Polyline const* const kth_ply_old ((*plys)[k]); const std::size_t size_of_kth_ply (kth_ply_old->getNumberOfPoints()); // copy point ids from old ply to new ply (considering the offset) @@ -481,13 +473,13 @@ void GEOObjects::mergeSurfaces(std::vector<std::string> const & geo_names, std::vector<std::size_t> sfc_offsets(n_geo_names, 0); auto merged_sfcs = std::unique_ptr<std::vector<GeoLib::Surface*>>( new std::vector<GeoLib::Surface*>); - std::map<std::string, std::size_t>* merged_sfc_names(new std::map<std::string, std::size_t>); + auto* merged_sfc_names(new std::map<std::string, std::size_t>); for (std::size_t j(0); j < n_geo_names; j++) { const std::vector<GeoLib::Surface*>* sfcs (this->getSurfaceVec(geo_names[j])); if (sfcs) { std::string tmp_name; for (std::size_t k(0); k < sfcs->size(); k++) { - GeoLib::Surface* kth_sfc_new(new GeoLib::Surface (*merged_points)); + auto* kth_sfc_new(new GeoLib::Surface(*merged_points)); GeoLib::Surface const* const kth_sfc_old ((*sfcs)[k]); const std::size_t size_of_kth_sfc (kth_sfc_old->getNumberOfTriangles()); // clone surface elements using new ids diff --git a/GeoLib/Grid.h b/GeoLib/Grid.h index fba64e6089b9bb4039f8b6aecc5ab6f155e00501..050f489a5c7597c5ad11b74cdd07d09426609ab2 100644 --- a/GeoLib/Grid.h +++ b/GeoLib/Grid.h @@ -329,35 +329,35 @@ void Grid<POINT>::createGridGeometry(GeoLib::GEOObjects* geo_obj) const auto plys = std::unique_ptr<std::vector<GeoLib::Polyline*>>( new std::vector<GeoLib::Polyline*>); auto const& points = *geo_obj->getPointVec(grid_names.back()); - GeoLib::Polyline* ply0 (new GeoLib::Polyline(points)); + auto* ply0(new GeoLib::Polyline(points)); for (std::size_t l(0); l < 4; l++) ply0->addPoint(l); ply0->addPoint(0); plys->push_back(ply0); - GeoLib::Polyline* ply1 (new GeoLib::Polyline(points)); + auto* ply1(new GeoLib::Polyline(points)); for (std::size_t l(4); l < 8; l++) ply1->addPoint(l); ply1->addPoint(4); plys->push_back(ply1); - GeoLib::Polyline* ply2 (new GeoLib::Polyline(points)); + auto* ply2(new GeoLib::Polyline(points)); ply2->addPoint(0); ply2->addPoint(4); plys->push_back(ply2); - GeoLib::Polyline* ply3 (new GeoLib::Polyline(points)); + auto* ply3(new GeoLib::Polyline(points)); ply3->addPoint(1); ply3->addPoint(5); plys->push_back(ply3); - GeoLib::Polyline* ply4 (new GeoLib::Polyline(points)); + auto* ply4(new GeoLib::Polyline(points)); ply4->addPoint(2); ply4->addPoint(6); plys->push_back(ply4); - GeoLib::Polyline* ply5 (new GeoLib::Polyline(points)); + auto* ply5(new GeoLib::Polyline(points)); ply5->addPoint(3); ply5->addPoint(7); plys->push_back(ply5); diff --git a/GeoLib/IO/Legacy/OGSIOVer4.cpp b/GeoLib/IO/Legacy/OGSIOVer4.cpp index dc63160f44631bb345ef90d02ce96b65ff349162..1b3e67dcf20c152c4610836058a3ca7d97a4c4f7 100644 --- a/GeoLib/IO/Legacy/OGSIOVer4.cpp +++ b/GeoLib/IO/Legacy/OGSIOVer4.cpp @@ -155,7 +155,7 @@ std::string readPolyline(std::istream &in, std::vector<std::string> &errors) { std::string line, name_of_ply; - GeoLib::Polyline* ply(new GeoLib::Polyline(pnt_vec)); + auto* ply(new GeoLib::Polyline(pnt_vec)); std::size_t type = 2; // need an initial value // Schleife ueber alle Phasen bzw. Komponenten @@ -191,13 +191,13 @@ std::string readPolyline(std::istream &in, && (line.find('#') == std::string::npos) && (line.find('$') == std::string::npos)) { - std::size_t pnt_id(BaseLib::str2number<std::size_t> (line)); + auto pnt_id(BaseLib::str2number<std::size_t>(line)); if (!zero_based_indexing) pnt_id--; // one based indexing - std::size_t ply_size (ply->getNumberOfPoints()); + std::size_t ply_size(ply->getNumberOfPoints()); if (ply_size > 0) { - if (ply->getPointID (ply_size - 1) != pnt_id_map[pnt_id]) + if (ply->getPointID(ply_size - 1) != pnt_id_map[pnt_id]) ply->addPoint(pnt_id_map[pnt_id]); } else @@ -325,7 +325,7 @@ std::string readSurface(std::istream &in, && (line.find('$') == std::string::npos)) { // we did read the name of a polyline -> search the id for polyline - std::map<std::string,std::size_t>::const_iterator it (ply_vec_names.find (line)); + auto it(ply_vec_names.find(line)); if (it != ply_vec_names.end()) ply_id = it->second; else @@ -449,7 +449,7 @@ bool readGLIFileV4(const std::string& fname, getline (in, tag); // read names of points into vector of strings - std::map<std::string,std::size_t>* pnt_id_names_map (new std::map<std::string,std::size_t>); + auto* pnt_id_names_map(new std::map<std::string, std::size_t>); bool zero_based_idx(true); auto pnt_vec = std::unique_ptr<std::vector<GeoLib::Point*>>( new std::vector<GeoLib::Point*>); @@ -465,13 +465,13 @@ bool readGLIFileV4(const std::string& fname, const std::string path = BaseLib::extractPath(fname); // read names of plys into temporary string-vec - std::map<std::string,std::size_t>* ply_names (new std::map<std::string,std::size_t>); + auto* ply_names(new std::map<std::string, std::size_t>); auto ply_vec = std::unique_ptr<std::vector<GeoLib::Polyline*>>( new std::vector<GeoLib::Polyline*>); GeoLib::PointVec & point_vec( *const_cast<GeoLib::PointVec*>(geo.getPointVecObj(unique_name))); - std::vector<GeoLib::Point*>* geo_pnt_vec(const_cast<std::vector<GeoLib::Point*>*>( - point_vec.getVector())); + auto* geo_pnt_vec( + const_cast<std::vector<GeoLib::Point*>*>(point_vec.getVector())); if (tag.find("#POLYLINE") != std::string::npos && in) { INFO("GeoLib::readGLIFile(): read polylines from stream."); @@ -485,7 +485,7 @@ bool readGLIFileV4(const std::string& fname, auto sfc_vec = std::unique_ptr<std::vector<GeoLib::Surface*>>( new std::vector<GeoLib::Surface*>); - std::map<std::string,std::size_t>* sfc_names (new std::map<std::string,std::size_t>); + auto* sfc_names(new std::map<std::string, std::size_t>); if (tag.find("#SURFACE") != std::string::npos && in) { INFO("GeoLib::readGLIFile(): read surfaces from stream."); diff --git a/GeoLib/IO/TINInterface.cpp b/GeoLib/IO/TINInterface.cpp index 7f98521c7b2e72d2569d5bcf9ed92f7e4e7ba902..551dcb14b5dadc2f06f5f8b173bcf5e4845944ee 100644 --- a/GeoLib/IO/TINInterface.cpp +++ b/GeoLib/IO/TINInterface.cpp @@ -40,7 +40,7 @@ GeoLib::Surface* TINInterface::readTIN(std::string const& fname, return nullptr; } - GeoLib::Surface* sfc = new GeoLib::Surface(*(pnt_vec.getVector())); + auto* sfc = new GeoLib::Surface(*(pnt_vec.getVector())); std::size_t id; MathLib::Point3d p0, p1, p2; std::string line; diff --git a/GeoLib/IO/XmlIO/Qt/XmlGmlInterface.cpp b/GeoLib/IO/XmlIO/Qt/XmlGmlInterface.cpp index e0f7d7fd1edcb23cc2bb25ce06e2ee6402728311..16ec0472d81b8c3d936e6817e24d0be472974e5c 100644 --- a/GeoLib/IO/XmlIO/Qt/XmlGmlInterface.cpp +++ b/GeoLib/IO/XmlIO/Qt/XmlGmlInterface.cpp @@ -56,9 +56,9 @@ int XmlGmlInterface::readFile(const QString &fileName) auto surfaces = std::unique_ptr<std::vector<GeoLib::Surface*>>( new std::vector<GeoLib::Surface*>); - std::map<std::string, std::size_t>* pnt_names = new std::map<std::string, std::size_t>; - std::map<std::string, std::size_t>* ply_names = new std::map<std::string, std::size_t>; - std::map<std::string, std::size_t>* sfc_names = new std::map<std::string, std::size_t>; + auto* pnt_names = new std::map<std::string, std::size_t>; + auto* ply_names = new std::map<std::string, std::size_t>; + auto* sfc_names = new std::map<std::string, std::size_t>; QDomNodeList geoTypes = docElement.childNodes(); for (int i = 0; i < geoTypes.count(); i++) diff --git a/GeoLib/IO/XmlIO/Qt/XmlStnInterface.cpp b/GeoLib/IO/XmlIO/Qt/XmlStnInterface.cpp index bd401e9da983907778c91480796bd3496e7892ea..3e645faffa36e02450fe48ceb5d8c3a50f725260 100644 --- a/GeoLib/IO/XmlIO/Qt/XmlStnInterface.cpp +++ b/GeoLib/IO/XmlIO/Qt/XmlStnInterface.cpp @@ -331,7 +331,7 @@ int XmlStnInterface::rapidReadFile(const std::string &fileName) in.seekg(0, std::ios::end); std::size_t length = in.tellg(); in.seekg(0, std::ios::beg); - char* buffer = new char[length + 1]; + auto* buffer = new char[length + 1]; in.read(buffer, length); buffer[in.gcount()] = '\0'; in.close(); @@ -405,7 +405,7 @@ void XmlStnInterface::rapidReadStations(const rapidxml::xml_node<>* station_root if (std::string(station_node->name()).compare("station") == 0) { - GeoLib::Station* s = new GeoLib::Station( + auto* s = new GeoLib::Station( strtod(station_node->first_attribute("x")->value(), nullptr), strtod(station_node->first_attribute("y")->value(), diff --git a/GeoLib/IO/XmlIO/Rapid/RapidStnInterface.cpp b/GeoLib/IO/XmlIO/Rapid/RapidStnInterface.cpp index 9f5f55a630a9f018da1f72537634ef56f11fa842..ee2d47560fb39b95fce743199807af727b488458 100644 --- a/GeoLib/IO/XmlIO/Rapid/RapidStnInterface.cpp +++ b/GeoLib/IO/XmlIO/Rapid/RapidStnInterface.cpp @@ -29,7 +29,7 @@ namespace IO std::vector<GeoLib::Point*> *RapidStnInterface::readStationFile(const std::string &fileName) { - std::vector<GeoLib::Point*> *stations = new std::vector<GeoLib::Point*>; + auto* stations = new std::vector<GeoLib::Point*>; std::ifstream in(fileName.c_str()); if (in.fail()) { @@ -41,7 +41,7 @@ std::vector<GeoLib::Point*> *RapidStnInterface::readStationFile(const std::strin in.seekg(0, std::ios::end); std::size_t length = in.tellg(); in.seekg(0, std::ios::beg); - char* buffer = new char[length+1]; + auto* buffer = new char[length + 1]; in.read(buffer, length); buffer[in.gcount()] = '\0'; in.close(); @@ -162,7 +162,7 @@ void RapidStnInterface::readStations(const rapidxml::xml_node<>* station_root, s if (std::string(station_node->name()).compare("station") == 0) { - GeoLib::Station* s = new GeoLib::Station( + auto* s = new GeoLib::Station( strtod(station_node->first_attribute("x")->value(), nullptr), strtod(station_node->first_attribute("y")->value(), diff --git a/GeoLib/MinimalBoundingSphere.cpp b/GeoLib/MinimalBoundingSphere.cpp index f16603efb9b942009cf13d4b34ae75ac15a29a78..c016239eb5718d1268554d1842e4b42d00a4fdbd 100644 --- a/GeoLib/MinimalBoundingSphere.cpp +++ b/GeoLib/MinimalBoundingSphere.cpp @@ -187,7 +187,7 @@ double MinimalBoundingSphere::pointDistanceSquared(MathLib::Point3d const& pnt) std::vector<MathLib::Point3d*>* MinimalBoundingSphere::getRandomSpherePoints(std::size_t n_points) const { - std::vector<MathLib::Point3d*> *pnts = new std::vector<MathLib::Point3d*>; + auto* pnts = new std::vector<MathLib::Point3d*>; pnts->reserve(n_points); srand ( static_cast<unsigned>(time(nullptr)) ); diff --git a/GeoLib/Polygon.cpp b/GeoLib/Polygon.cpp index 70f95c854c92d5671ecb4a222776026c34b25af6..935f6a7aabfdcfda56e2b9d754b2d73ffb65a935 100644 --- a/GeoLib/Polygon.cpp +++ b/GeoLib/Polygon.cpp @@ -48,8 +48,9 @@ Polygon::Polygon(Polygon const& other) Polygon::~Polygon() { // remove polygons from list - for (std::list<Polygon*>::iterator it (_simple_polygon_list.begin()); - it != _simple_polygon_list.end(); ++it) + for (auto it(_simple_polygon_list.begin()); + it != _simple_polygon_list.end(); + ++it) // the first entry of the list can be a pointer the object itself if (*it != this) delete *it; @@ -101,8 +102,7 @@ bool Polygon::isPntInPolygon (GeoLib::Point const & pnt) const if (n_intersections % 2 == 1) return true; } else { - for (std::list<Polygon*>::const_iterator it( - _simple_polygon_list.begin()++); + for (auto it(_simple_polygon_list.begin()++); it != _simple_polygon_list.end(); ++it) { @@ -262,8 +262,9 @@ void Polygon::computeListOfSimplePolygons () splitPolygonAtPoint (_simple_polygon_list.begin()); splitPolygonAtIntersection (_simple_polygon_list.begin()); - for (std::list<Polygon*>::iterator it (_simple_polygon_list.begin()); - it != _simple_polygon_list.end(); ++it) + for (auto it(_simple_polygon_list.begin()); + it != _simple_polygon_list.end(); + ++it) (*it)->initialise (); } @@ -467,7 +468,7 @@ GeoLib::Polygon* createPolygonFromCircle (GeoLib::Point const& middle_pnt, doubl double angle (boost::math::double_constants::two_pi / resolution); for (std::size_t k(0); k < resolution; k++) { - GeoLib::Point* pnt(new GeoLib::Point(middle_pnt)); + auto* pnt(new GeoLib::Point(middle_pnt)); (*pnt)[0] += radius * cos (k * angle); (*pnt)[1] += radius * sin (k * angle); pnts.push_back (pnt); diff --git a/GeoLib/Polyline.cpp b/GeoLib/Polyline.cpp index abcfe70494e0b731375435b77be8ad4164ea4403..90a863039a4c6d3deb24e00fbc8e9724ab6ac812 100644 --- a/GeoLib/Polyline.cpp +++ b/GeoLib/Polyline.cpp @@ -90,9 +90,9 @@ bool Polyline::insertPoint(std::size_t pos, std::size_t pnt_id) } } - std::vector<std::size_t>::difference_type const pos_dt( + auto const pos_dt( static_cast<std::vector<std::size_t>::difference_type>(pos)); - std::vector<std::size_t>::iterator it(_ply_pnt_ids.begin() + pos_dt); + auto it(_ply_pnt_ids.begin() + pos_dt); _ply_pnt_ids.insert(it, pnt_id); if (_ply_pnt_ids.size() > 1) { @@ -131,7 +131,7 @@ bool Polyline::insertPoint(std::size_t pos, std::size_t pnt_id) double update_dist( len_seg0 + len_seg1 - (_length[pos] - dist_until_now)); _length[pos] = dist_until_now + len_seg0; - std::vector<double>::iterator it1(_length.begin() + pos_dt + 1); + auto it1(_length.begin() + pos_dt + 1); _length.insert(it1, _length[pos] + len_seg1); for (it1 = _length.begin() + pos_dt + 2; it1 != _length.end(); ++it1) @@ -147,7 +147,7 @@ void Polyline::removePoint(std::size_t pos) if (pos >= _ply_pnt_ids.size()) return; - std::vector<std::size_t>::difference_type const pos_dt( + auto const pos_dt( static_cast<std::vector<std::size_t>::difference_type>(pos)); _ply_pnt_ids.erase(_ply_pnt_ids.begin() + pos_dt); @@ -270,7 +270,7 @@ Polyline* Polyline::constructPolylineFromSegments(const std::vector<Polyline*> & { std::size_t nLines = ply_vec.size(); - Polyline* new_ply = new Polyline(*ply_vec[0]); + auto* new_ply = new Polyline(*ply_vec[0]); std::vector<GeoLib::Point*> pnt_vec(new_ply->getPointsVec()); std::vector<Polyline*> local_ply_vec; @@ -281,8 +281,7 @@ Polyline* Polyline::constructPolylineFromSegments(const std::vector<Polyline*> & { bool ply_found(false); prox *= prox; // square distance once to save time later - for (std::vector<Polyline*>::iterator it = local_ply_vec.begin(); - it != local_ply_vec.end(); ++it) + for (auto it = local_ply_vec.begin(); it != local_ply_vec.end(); ++it) { if (pnt_vec == (*it)->getPointsVec()) { @@ -292,7 +291,7 @@ Polyline* Polyline::constructPolylineFromSegments(const std::vector<Polyline*> & if (pointsAreIdentical(pnt_vec, new_ply->getPointID(0), (*it)->getPointID(0), prox)) { - Polyline* tmp = new Polyline((*it)->getPointsVec()); + auto* tmp = new Polyline((*it)->getPointsVec()); for (std::size_t k = 0; k < nPoints; k++) tmp->addPoint((*it)->getPointID(nPoints - k - 1)); @@ -307,7 +306,7 @@ Polyline* Polyline::constructPolylineFromSegments(const std::vector<Polyline*> & else if (pointsAreIdentical(pnt_vec, new_ply->getPointID(0), (*it)->getPointID(nPoints - 1), prox)) { - Polyline* tmp = new Polyline(**it); + auto* tmp = new Polyline(**it); std::size_t new_ply_size(new_ply->getNumberOfPoints()); for (std::size_t k = 1; k < new_ply_size; k++) tmp->addPoint(new_ply->getPointID(k)); diff --git a/GeoLib/Raster.cpp b/GeoLib/Raster.cpp index aa23861a09732c50f8b5dfbb71c718ff33aafa22..8c2b5e8624608b4d13b9e83019422b8967be10ed 100644 --- a/GeoLib/Raster.cpp +++ b/GeoLib/Raster.cpp @@ -27,7 +27,8 @@ namespace GeoLib { void Raster::refineRaster(std::size_t scaling) { - double *new_raster_data(new double[_header.n_rows*_header.n_cols*scaling*scaling]); + auto* new_raster_data( + new double[_header.n_rows * _header.n_cols * scaling * scaling]); for (std::size_t row(0); row<_header.n_rows; row++) { for (std::size_t col(0); col<_header.n_cols; col++) { @@ -62,7 +63,7 @@ Raster* Raster::getRasterFromSurface(Surface const& sfc, double cell_size, doubl const std::size_t n_cols = static_cast<std::size_t>(std::abs(ur[0]-ll[0]) / cell_size)+1; const std::size_t n_rows = static_cast<std::size_t>(std::abs(ur[1]-ll[1]) / cell_size)+1; const std::size_t n_triangles(sfc.getNumberOfTriangles()); - double *z_vals (new double[n_cols*n_rows]); + auto* z_vals(new double[n_cols * n_rows]); std::size_t k(0); for (std::size_t r(0); r < n_cols; r++) { @@ -93,16 +94,21 @@ double Raster::getValueAtPoint(const MathLib::Point3d &pnt) const if (pnt[0]>=_header.origin[0] && pnt[0]<(_header.origin[0]+(_header.cell_size*_header.n_cols)) && pnt[1]>=_header.origin[1] && pnt[1]<(_header.origin[1]+(_header.cell_size*_header.n_rows))) { - int cell_x = static_cast<int>(std::floor((pnt[0] - _header.origin[0])/_header.cell_size)); - int cell_y = static_cast<int>(std::floor((pnt[1] - _header.origin[1])/_header.cell_size)); - - // use raster boundary values if node is outside raster due to rounding errors or floating point arithmetic - cell_x = (cell_x < 0) ? 0 : ((cell_x > static_cast<int>(_header.n_cols)) ? - static_cast<int>(_header.n_cols-1) : cell_x); - cell_y = (cell_y < 0) ? 0 : ((cell_y > static_cast<int>(_header.n_rows)) ? - static_cast<int>(_header.n_rows-1) : cell_y); - - const std::size_t index = cell_y*_header.n_cols+cell_x; + auto cell_x = static_cast<int>( + std::floor((pnt[0] - _header.origin[0]) / _header.cell_size)); + auto cell_y = static_cast<int>( + std::floor((pnt[1] - _header.origin[1]) / _header.cell_size)); + + // use raster boundary values if node is outside raster due to rounding + // errors or floating point arithmetic + cell_x = (cell_x < 0) ? 0 : ((cell_x > static_cast<int>(_header.n_cols)) + ? static_cast<int>(_header.n_cols - 1) + : cell_x); + cell_y = (cell_y < 0) ? 0 : ((cell_y > static_cast<int>(_header.n_rows)) + ? static_cast<int>(_header.n_rows - 1) + : cell_y); + + const std::size_t index = cell_y * _header.n_cols + cell_x; return _raster_data[index]; } return _header.no_data; diff --git a/GeoLib/SensorData.cpp b/GeoLib/SensorData.cpp index 32c035b723f26c657c24d7d0822e9597970444aa..75f383a8e23e819dafde5ef0bcab7468636f3ec1 100644 --- a/GeoLib/SensorData.cpp +++ b/GeoLib/SensorData.cpp @@ -124,7 +124,7 @@ int SensorData::readDataFromFile(const std::string &file_name) { this->_vec_names.push_back(SensorData::convertString2SensorDataType(*++it)); this->_data_unit_string.push_back(""); - std::vector<float> *data = new std::vector<float>; + auto* data = new std::vector<float>; this->_data_vecs.push_back(data); } diff --git a/GeoLib/SimplePolygonTree.h b/GeoLib/SimplePolygonTree.h index eb53dd8a786565f83a246a2042ec055aac906845..e76232be6ea3659e31d8234f78ce7a57e4aeb2f4 100644 --- a/GeoLib/SimplePolygonTree.h +++ b/GeoLib/SimplePolygonTree.h @@ -85,11 +85,11 @@ private: template <typename POLYGONTREETYPE> void createPolygonTrees (std::list<POLYGONTREETYPE*>& list_of_simple_polygon_hierarchies) { - typedef typename std::list<POLYGONTREETYPE*>::const_iterator CIT; - typedef typename std::list<POLYGONTREETYPE*>::iterator IT; - for (CIT it0(list_of_simple_polygon_hierarchies.begin()); - it0 != list_of_simple_polygon_hierarchies.end(); ++it0) { - IT it1 = list_of_simple_polygon_hierarchies.begin(); + for (auto it0 = list_of_simple_polygon_hierarchies.begin(); + it0 != list_of_simple_polygon_hierarchies.end(); + ++it0) + { + auto it1 = list_of_simple_polygon_hierarchies.begin(); while (it1 != list_of_simple_polygon_hierarchies.end()) { if (it0 == it1) { // don't check same polygons ++it1; diff --git a/GeoLib/Station.cpp b/GeoLib/Station.cpp index 2f786943505cdb42b547dcd527c1fd5a3aaced11..acfee0f1ece279d94e5b31b1af131e1dcf2ac371 100644 --- a/GeoLib/Station.cpp +++ b/GeoLib/Station.cpp @@ -78,7 +78,7 @@ Station* Station::createStation(const std::string &name, double x, double y, dou bool isStation(GeoLib::Point const* pnt) { - GeoLib::Station const* bh(dynamic_cast<GeoLib::Station const*>(pnt)); + auto const* bh(dynamic_cast<GeoLib::Station const*>(pnt)); return bh != nullptr; } diff --git a/GeoLib/StationBorehole.cpp b/GeoLib/StationBorehole.cpp index fd11a39a4a5bcfc05abb09377069099a0f81280d..2152b41167971c0afbb0e8fe8b28a2966d9a4eae 100644 --- a/GeoLib/StationBorehole.cpp +++ b/GeoLib/StationBorehole.cpp @@ -258,7 +258,7 @@ void StationBorehole::createSurrogateStratigraphies(std::vector<Point*>* borehol std::size_t nBoreholes = boreholes->size(); for (std::size_t i = 0; i < nBoreholes; i++) { - StationBorehole* bore = static_cast<StationBorehole*>((*boreholes)[i]); + auto* bore = static_cast<StationBorehole*>((*boreholes)[i]); bore->addSoilLayer(bore->getDepth(), "depth"); } } @@ -298,8 +298,7 @@ void StationBorehole::addSoilLayer ( double x, double y, double z, const std::st bool isBorehole(GeoLib::Point const* pnt) { - GeoLib::StationBorehole const* bh( - dynamic_cast<GeoLib::StationBorehole const*>(pnt)); + auto const* bh(dynamic_cast<GeoLib::StationBorehole const*>(pnt)); return bh != nullptr; } diff --git a/GeoLib/Surface.cpp b/GeoLib/Surface.cpp index 536962fe03c37cde3b18fe8063b3aabef6b511a0..3a541fdef33dae3d589e0e1818e718f9046bb277 100644 --- a/GeoLib/Surface.cpp +++ b/GeoLib/Surface.cpp @@ -101,16 +101,15 @@ Surface* Surface::createSurface(const Polyline& ply) } // create empty surface - Surface* sfc(new Surface(ply.getPointsVec())); + auto* sfc(new Surface(ply.getPointsVec())); - Polygon* polygon(new Polygon(ply)); + auto* polygon(new Polygon(ply)); polygon->computeListOfSimplePolygons(); // create surfaces from simple polygons const std::list<GeoLib::Polygon*>& list_of_simple_polygons( polygon->getListOfSimplePolygons()); - for (std::list<GeoLib::Polygon*>::const_iterator simple_polygon_it( - list_of_simple_polygons.begin()); + for (auto simple_polygon_it(list_of_simple_polygons.begin()); simple_polygon_it != list_of_simple_polygons.end(); ++simple_polygon_it) { diff --git a/MaterialLib/Fluid/Density/CreateFluidDensityModel.cpp b/MaterialLib/Fluid/Density/CreateFluidDensityModel.cpp index 34f87172b33f812de08aaa3c6b93175d86209902..629444347b749be44b194e9d089e8dbfa88d310c 100644 --- a/MaterialLib/Fluid/Density/CreateFluidDensityModel.cpp +++ b/MaterialLib/Fluid/Density/CreateFluidDensityModel.cpp @@ -39,15 +39,15 @@ static std::unique_ptr<FluidProperty> createLiquidDensity( config.checkConfigParameter("type", "LiquidDensity"); //! \ogs_file_param{material__fluid__density__LiquidDensity__beta} - const double beta = config.getConfigParameter<double>("beta"); + const auto beta = config.getConfigParameter<double>("beta"); //! \ogs_file_param{material__fluid__density__LiquidDensity__rho0} - const double rho0 = config.getConfigParameter<double>("rho0"); + const auto rho0 = config.getConfigParameter<double>("rho0"); //! \ogs_file_param{material__fluid__density__LiquidDensity__temperature0} - const double T0 = config.getConfigParameter<double>("temperature0"); + const auto T0 = config.getConfigParameter<double>("temperature0"); //! \ogs_file_param{material__fluid__density__LiquidDensity__p0} - const double p0 = config.getConfigParameter<double>("p0"); + const auto p0 = config.getConfigParameter<double>("p0"); //! \ogs_file_param{material__fluid__density__LiquidDensity__bulk_modulus} - const double E = config.getConfigParameter<double>("bulk_modulus"); + const auto E = config.getConfigParameter<double>("bulk_modulus"); return std::unique_ptr<FluidProperty>( new LiquidDensity(beta, rho0, T0, p0, E)); } @@ -64,11 +64,11 @@ static std::unique_ptr<FluidProperty> createLinearTemperatureDependentDensity( config.checkConfigParameter("type", "TemperatureDependent"); //! \ogs_file_param{material__fluid__density__TemperatureDependent__rho0} - const double rho0 = config.getConfigParameter<double>("rho0"); + const auto rho0 = config.getConfigParameter<double>("rho0"); //! \ogs_file_param{material__fluid__density__TemperatureDependent__temperature0} - const double T0 = config.getConfigParameter<double>("temperature0"); + const auto T0 = config.getConfigParameter<double>("temperature0"); //! \ogs_file_param{material__fluid__density__TemperatureDependent__beta} - const double beta = config.getConfigParameter<double>("beta"); + const auto beta = config.getConfigParameter<double>("beta"); return std::unique_ptr<FluidProperty>( new LinearTemperatureDependentDensity(rho0, T0, beta)); } diff --git a/MaterialLib/Fluid/Viscosity/CreateViscosityModel.cpp b/MaterialLib/Fluid/Viscosity/CreateViscosityModel.cpp index 23c44a98bcfd0012244ca4e57f3b86e0b0b52193..e532295acb99ae2d397892f5080ede2e319e3540 100644 --- a/MaterialLib/Fluid/Viscosity/CreateViscosityModel.cpp +++ b/MaterialLib/Fluid/Viscosity/CreateViscosityModel.cpp @@ -37,13 +37,13 @@ static std::unique_ptr<FluidProperty> createLinearPressureDependentViscosity( config.checkConfigParameter("type", "LinearPressure"); //! \ogs_file_param{material__fluid__viscosity__LinearPressure__mu0} - const double mu0 = config.getConfigParameter<double>("mu0"); + const auto mu0 = config.getConfigParameter<double>("mu0"); //! \ogs_file_param{material__fluid__viscosity__LinearPressure__p0} - const double p0 = config.getConfigParameter<double>("p0"); + const auto p0 = config.getConfigParameter<double>("p0"); //! \ogs_file_param{material__fluid__viscosity__LinearPressure__gamma} - const double gamma = config.getConfigParameter<double>("gamma"); + const auto gamma = config.getConfigParameter<double>("gamma"); return std::unique_ptr<FluidProperty>( new LinearPressureDependentViscosity(mu0, p0, gamma)); @@ -61,13 +61,13 @@ static std::unique_ptr<FluidProperty> createTemperatureDependentViscosity( config.checkConfigParameter("type", "TemperatureDependent"); //! \ogs_file_param{material__fluid__viscosity__TemperatureDependent__mu0} - const double mu0 = config.getConfigParameter<double>("mu0"); + const auto mu0 = config.getConfigParameter<double>("mu0"); //! \ogs_file_param{material__fluid__viscosity__TemperatureDependent__tc} - const double Tc = config.getConfigParameter<double>("tc"); + const auto Tc = config.getConfigParameter<double>("tc"); //! \ogs_file_param{material__fluid__viscosity__TemperatureDependent__tv} - const double Tv = config.getConfigParameter<double>("tv"); + const auto Tv = config.getConfigParameter<double>("tv"); return std::unique_ptr<FluidProperty>( new TemperatureDependentViscosity(mu0, Tc, Tv)); diff --git a/MaterialLib/PorousMedium/UnsaturatedProperty/CapillaryPressure/CreateCapillaryPressureModel.cpp b/MaterialLib/PorousMedium/UnsaturatedProperty/CapillaryPressure/CreateCapillaryPressureModel.cpp index 1c2193b523f9101921ca83add6403d551b5f770e..0e4c98d1962f60f41a2863d787185cc2ac37b0a8 100644 --- a/MaterialLib/PorousMedium/UnsaturatedProperty/CapillaryPressure/CreateCapillaryPressureModel.cpp +++ b/MaterialLib/PorousMedium/UnsaturatedProperty/CapillaryPressure/CreateCapillaryPressureModel.cpp @@ -39,10 +39,10 @@ static std::unique_ptr<CapillaryPressureSaturation> createBrooksCorey( config.checkConfigParameter("type", "BrooksCorey"); //! \ogs_file_param{material__porous_medium__capillary_pressure__BrooksCorey__pd} - const double pd = config.getConfigParameter<double>("pd"); + const auto pd = config.getConfigParameter<double>("pd"); //! \ogs_file_param{material__porous_medium__capillary_pressure__BrooksCorey__sr} - const double Sr = config.getConfigParameter<double>("sr"); + const auto Sr = config.getConfigParameter<double>("sr"); double Sg_r = 0.0; //! \ogs_file_param{material__porous_medium__capillary_pressure__BrooksCorey__sg_r} @@ -55,10 +55,10 @@ static std::unique_ptr<CapillaryPressureSaturation> createBrooksCorey( Sg_r = *Sg_r_ptr; } //! \ogs_file_param{material__porous_medium__capillary_pressure__BrooksCorey__smax} - const double Smax = config.getConfigParameter<double>("smax"); + const auto Smax = config.getConfigParameter<double>("smax"); //! \ogs_file_param{material__porous_medium__capillary_pressure__BrooksCorey__m} - const double m = config.getConfigParameter<double>("m"); + const auto m = config.getConfigParameter<double>("m"); if (m < 1.0) // m >= 1 { OGS_FATAL( @@ -66,7 +66,7 @@ static std::unique_ptr<CapillaryPressureSaturation> createBrooksCorey( "saturation model, m, must not be smaller than 1"); } //! \ogs_file_param{material__porous_medium__capillary_pressure__BrooksCorey__pc_max} - const double Pc_max = config.getConfigParameter<double>("pc_max"); + const auto Pc_max = config.getConfigParameter<double>("pc_max"); return std::unique_ptr<CapillaryPressureSaturation>( new BrooksCoreyCapillaryPressureSaturation( @@ -85,10 +85,10 @@ static std::unique_ptr<CapillaryPressureSaturation> createVanGenuchten( config.checkConfigParameter("type", "vanGenuchten"); //! \ogs_file_param{material__porous_medium__capillary_pressure__vanGenuchten__pd} - const double pd = config.getConfigParameter<double>("pd"); + const auto pd = config.getConfigParameter<double>("pd"); //! \ogs_file_param{material__porous_medium__capillary_pressure__vanGenuchten__sr} - const double Sr = config.getConfigParameter<double>("sr"); + const auto Sr = config.getConfigParameter<double>("sr"); double Sg_r = 0.0; //! \ogs_file_param{material__porous_medium__capillary_pressure__vanGenuchten__sg_r} @@ -102,10 +102,10 @@ static std::unique_ptr<CapillaryPressureSaturation> createVanGenuchten( } //! \ogs_file_param{material__porous_medium__capillary_pressure__vanGenuchten__smax} - const double Smax = config.getConfigParameter<double>("smax"); + const auto Smax = config.getConfigParameter<double>("smax"); //! \ogs_file_param{material__porous_medium__capillary_pressure__vanGenuchten__m} - const double m = config.getConfigParameter<double>("m"); + const auto m = config.getConfigParameter<double>("m"); if (m < 0. || m > 1.0) { OGS_FATAL( @@ -113,7 +113,7 @@ static std::unique_ptr<CapillaryPressureSaturation> createVanGenuchten( "saturation model, m, must be in an interval of [0, 1]"); } //! \ogs_file_param{material__porous_medium__capillary_pressure__vanGenuchten__pc_max} - const double Pc_max = config.getConfigParameter<double>("pc_max"); + const auto Pc_max = config.getConfigParameter<double>("pc_max"); bool has_regularized = false; if (auto const has_regularized_conf = diff --git a/MaterialLib/PorousMedium/UnsaturatedProperty/RelativePermeability/CreateRelativePermeabilityModel.cpp b/MaterialLib/PorousMedium/UnsaturatedProperty/RelativePermeability/CreateRelativePermeabilityModel.cpp index e4f43e1b3eaccf2324ca44540e1182c9928fda86..ffe7b4ed66623e85161a5e4065d15ac192a71e8f 100644 --- a/MaterialLib/PorousMedium/UnsaturatedProperty/RelativePermeability/CreateRelativePermeabilityModel.cpp +++ b/MaterialLib/PorousMedium/UnsaturatedProperty/RelativePermeability/CreateRelativePermeabilityModel.cpp @@ -46,13 +46,13 @@ std::unique_ptr<RelativePermeability> createWettingPhaseVanGenuchten( config.checkConfigParameter("type", "WettingPhaseVanGenuchten"); //! \ogs_file_param{material__porous_medium__relative_permeability__WettingPhaseVanGenuchten__sr} - const double Sr = config.getConfigParameter<double>("sr"); + const auto Sr = config.getConfigParameter<double>("sr"); //! \ogs_file_param{material__porous_medium__relative_permeability__WettingPhaseVanGenuchten__smax} - const double Smax = config.getConfigParameter<double>("smax"); + const auto Smax = config.getConfigParameter<double>("smax"); //! \ogs_file_param{material__porous_medium__relative_permeability__WettingPhaseVanGenuchten__m} - const double m = config.getConfigParameter<double>("m"); + const auto m = config.getConfigParameter<double>("m"); if (m < 0. || m > 1.0) { OGS_FATAL( @@ -60,7 +60,7 @@ std::unique_ptr<RelativePermeability> createWettingPhaseVanGenuchten( " permeability model, m, must be in an interval of [0, 1]"); } //! \ogs_file_param{material__porous_medium__relative_permeability__WettingPhaseVanGenuchten__krel_min} - const double krel_min = config.getConfigParameter<double>("krel_min"); + const auto krel_min = config.getConfigParameter<double>("krel_min"); return std::unique_ptr<RelativePermeability>( new WettingPhaseVanGenuchten(Sr, Smax, m, krel_min)); @@ -78,13 +78,13 @@ std::unique_ptr<RelativePermeability> createNonWettingPhaseVanGenuchten( config.checkConfigParameter("type", "NonWettingPhaseVanGenuchten"); //! \ogs_file_param{material__porous_medium__relative_permeability__NonWettingPhaseVanGenuchten__sr} - const double Sr = config.getConfigParameter<double>("sr"); + const auto Sr = config.getConfigParameter<double>("sr"); //! \ogs_file_param{material__porous_medium__relative_permeability__NonWettingPhaseVanGenuchten__smax} - const double Smax = config.getConfigParameter<double>("smax"); + const auto Smax = config.getConfigParameter<double>("smax"); //! \ogs_file_param{material__porous_medium__relative_permeability__NonWettingPhaseVanGenuchten__m} - const double m = config.getConfigParameter<double>("m"); + const auto m = config.getConfigParameter<double>("m"); if (m < 0. || m > 1.0) { OGS_FATAL( @@ -93,7 +93,7 @@ std::unique_ptr<RelativePermeability> createNonWettingPhaseVanGenuchten( } //! \ogs_file_param{material__porous_medium__relative_permeability__NonWettingPhaseVanGenuchten__krel_min} - const double krel_min = config.getConfigParameter<double>("krel_min"); + const auto krel_min = config.getConfigParameter<double>("krel_min"); return std::unique_ptr<RelativePermeability>( new NonWettingPhaseVanGenuchten(Sr, Smax, m, krel_min)); @@ -111,13 +111,13 @@ std::unique_ptr<RelativePermeability> createWettingPhaseBrooksCoreyOilGas( config.checkConfigParameter("type", "WettingPhaseBrooksCoreyOilGas"); //! \ogs_file_param{material__porous_medium__relative_permeability__WettingPhaseBrooksCoreyOilGas__sr} - const double Sr = config.getConfigParameter<double>("sr"); + const auto Sr = config.getConfigParameter<double>("sr"); //! \ogs_file_param{material__porous_medium__relative_permeability__WettingPhaseBrooksCoreyOilGas__smax} - const double Smax = config.getConfigParameter<double>("smax"); + const auto Smax = config.getConfigParameter<double>("smax"); //! \ogs_file_param{material__porous_medium__relative_permeability__WettingPhaseBrooksCoreyOilGas__m} - const double m = config.getConfigParameter<double>("m"); + const auto m = config.getConfigParameter<double>("m"); if (m < 1.0) // m >= 1 { OGS_FATAL( @@ -126,7 +126,7 @@ std::unique_ptr<RelativePermeability> createWettingPhaseBrooksCoreyOilGas( } //! \ogs_file_param{material__porous_medium__relative_permeability__WettingPhaseBrooksCoreyOilGas__krel_min} - const double krel_min = config.getConfigParameter<double>("krel_min"); + const auto krel_min = config.getConfigParameter<double>("krel_min"); return std::unique_ptr<RelativePermeability>( new WettingPhaseBrooksCoreyOilGas(Sr, Smax, m, krel_min)); @@ -144,13 +144,13 @@ std::unique_ptr<RelativePermeability> createNonWettingPhaseBrooksCoreyOilGas( config.checkConfigParameter("type", "NonWettingPhaseBrooksCoreyOilGas"); //! \ogs_file_param{material__porous_medium__relative_permeability__NonWettingPhaseBrooksCoreyOilGas__sr} - const double Sr = config.getConfigParameter<double>("sr"); + const auto Sr = config.getConfigParameter<double>("sr"); //! \ogs_file_param{material__porous_medium__relative_permeability__NonWettingPhaseBrooksCoreyOilGas__smax} - const double Smax = config.getConfigParameter<double>("smax"); + const auto Smax = config.getConfigParameter<double>("smax"); //! \ogs_file_param{material__porous_medium__relative_permeability__NonWettingPhaseBrooksCoreyOilGas__m} - const double m = config.getConfigParameter<double>("m"); + const auto m = config.getConfigParameter<double>("m"); if (m < 1.0) // m >= 1 { OGS_FATAL( @@ -159,7 +159,7 @@ std::unique_ptr<RelativePermeability> createNonWettingPhaseBrooksCoreyOilGas( } //! \ogs_file_param{material__porous_medium__relative_permeability__NonWettingPhaseBrooksCoreyOilGas__krel_min} - const double krel_min = config.getConfigParameter<double>("krel_min"); + const auto krel_min = config.getConfigParameter<double>("krel_min"); return std::unique_ptr<RelativePermeability>( new NonWettingPhaseBrooksCoreyOilGas(Sr, Smax, m, krel_min)); diff --git a/MaterialLib/SolidModels/CreateEhlers.h b/MaterialLib/SolidModels/CreateEhlers.h index 67709980a353a8d7405520d89a64b04406d84e22..bba68d8c13c81678275583d89f9a8703c525e1ed 100644 --- a/MaterialLib/SolidModels/CreateEhlers.h +++ b/MaterialLib/SolidModels/CreateEhlers.h @@ -26,13 +26,13 @@ inline NumLib::NewtonRaphsonSolverParameters createNewtonRaphsonSolverParameters(BaseLib::ConfigTree const& config) { DBUG("Create local nonlinear solver parameters."); - int const maximum_iterations = + auto const maximum_iterations = //! \ogs_file_param{material__solid__constitutive_relation__Ehlers__nonlinear_solver__maximum_iterations} config.getConfigParameter<int>("maximum_iterations"); DBUG("\tmaximum_iterations: %d.", maximum_iterations); - double const error_tolerance = + auto const error_tolerance = //! \ogs_file_param{material__solid__constitutive_relation__Ehlers__nonlinear_solver__error_tolerance} config.getConfigParameter<double>("error_tolerance"); diff --git a/MaterialLib/SolidModels/CreateLubby2.h b/MaterialLib/SolidModels/CreateLubby2.h index 49b0395d321d526d5a47274b63bfcabec98d3148..a9bc8d685af67b983c5e54b26d0b8d40620d4517 100644 --- a/MaterialLib/SolidModels/CreateLubby2.h +++ b/MaterialLib/SolidModels/CreateLubby2.h @@ -26,13 +26,13 @@ inline NumLib::NewtonRaphsonSolverParameters createNewtonRaphsonSolverParameters(BaseLib::ConfigTree const& config) { DBUG("Create local nonlinear solver parameters."); - int const maximum_iterations = + auto const maximum_iterations = //! \ogs_file_param{material__solid__constitutive_relation__Lubby2__nonlinear_solver__maximum_iterations} config.getConfigParameter<int>("maximum_iterations"); DBUG("\tmaximum_iterations: %d.", maximum_iterations); - double const error_tolerance = + auto const error_tolerance = //! \ogs_file_param{material__solid__constitutive_relation__Lubby2__nonlinear_solver__error_tolerance} config.getConfigParameter<double>("error_tolerance"); diff --git a/MaterialLib/SolidModels/Ehlers-impl.h b/MaterialLib/SolidModels/Ehlers-impl.h index a28ed14037f5e509da20d92d1be8729aa82be578..421f4154534039c76af00f41f98be0cc8122d966 100644 --- a/MaterialLib/SolidModels/Ehlers-impl.h +++ b/MaterialLib/SolidModels/Ehlers-impl.h @@ -441,7 +441,7 @@ void SolidEhlers<DisplacementDim>::updateDamage( { assert(dynamic_cast<MaterialStateVariables*>(&material_state_variables) != nullptr); - MaterialStateVariables& state = + auto& state = static_cast<MaterialStateVariables&>(material_state_variables); // Default case of the rate problem. Updated below if volumetric plastic @@ -546,7 +546,7 @@ bool SolidEhlers<DisplacementDim>::computeConstitutiveRelation( { assert(dynamic_cast<MaterialStateVariables*>(&material_state_variables) != nullptr); - MaterialStateVariables& _state = + auto& _state = static_cast<MaterialStateVariables&>(material_state_variables); _state.setInitialConditions(); diff --git a/MaterialLib/SolidModels/Lubby2-impl.h b/MaterialLib/SolidModels/Lubby2-impl.h index bd060a56d42a469f69fc1562fe2f3486699dde33..01106fdd31e42586734cecf68880745ab42e8a47 100644 --- a/MaterialLib/SolidModels/Lubby2-impl.h +++ b/MaterialLib/SolidModels/Lubby2-impl.h @@ -32,7 +32,7 @@ bool Lubby2<DisplacementDim>::computeConstitutiveRelation( assert(dynamic_cast<MaterialStateVariables*>(&material_state_variables) != nullptr); - MaterialStateVariables& state = + auto& state = static_cast<MaterialStateVariables&>(material_state_variables); state.setInitialConditions(); diff --git a/MathLib/LinAlg/Dense/DenseMatrix-impl.h b/MathLib/LinAlg/Dense/DenseMatrix-impl.h index e143d78ecc2cf38d76ad8909b2d3f87dcae48e36..71696faae260b88d7a8228eb01b1edf850137774 100644 --- a/MathLib/LinAlg/Dense/DenseMatrix-impl.h +++ b/MathLib/LinAlg/Dense/DenseMatrix-impl.h @@ -120,7 +120,7 @@ FP_TYPE* DenseMatrix<FP_TYPE, IDX_TYPE>::operator* (FP_TYPE* const& x) const template<typename FP_TYPE, typename IDX_TYPE> FP_TYPE* DenseMatrix<FP_TYPE, IDX_TYPE>::operator* (FP_TYPE const* const& x) const { - FP_TYPE *y(new FP_TYPE[_n_rows]); + auto* y(new FP_TYPE[_n_rows]); for (IDX_TYPE i(0); i < _n_rows; i++) { y[i] = 0.0; for (IDX_TYPE j(0); j < _n_cols; j++) { diff --git a/MeshGeoToolsLib/HeuristicSearchLength.cpp b/MeshGeoToolsLib/HeuristicSearchLength.cpp index 1cd0320c2939815bb44e76245f4068a9acf1bb5f..fedfdd6b99bce90149bf690c081f63b247a8027c 100644 --- a/MeshGeoToolsLib/HeuristicSearchLength.cpp +++ b/MeshGeoToolsLib/HeuristicSearchLength.cpp @@ -28,7 +28,7 @@ HeuristicSearchLength::HeuristicSearchLength(MeshLib::Mesh const& mesh, LengthTy std::vector<MeshLib::Element*> const& elements(_mesh.getElements()); if (length_type==LengthType::Edge) { - for (std::vector<MeshLib::Element*>::const_iterator it(elements.cbegin()); + for (auto it(elements.cbegin()); it != elements.cend(); ++it) { std::size_t const n_edges((*it)->getNumberOfEdges()); for (std::size_t k(0); k<n_edges; k++) { diff --git a/MeshLib/Elements/EdgeReturn.cpp b/MeshLib/Elements/EdgeReturn.cpp index 3066ce056ef23177316b30fc22dcb6b66bda4b94..1e740b17a230e79dbc1780eba73d7008d91d74c0 100644 --- a/MeshLib/Elements/EdgeReturn.cpp +++ b/MeshLib/Elements/EdgeReturn.cpp @@ -22,7 +22,7 @@ const Element* LinearEdgeReturn::getEdge(const Element* e, unsigned i) { if (i < e->getNumberOfEdges()) { - Node** nodes = new Node*[2]; + auto** nodes = new Node*[2]; nodes[0] = const_cast<Node*>(e->getEdgeNode(i,0)); nodes[1] = const_cast<Node*>(e->getEdgeNode(i,1)); return new Line(nodes); @@ -35,7 +35,7 @@ const Element* QuadraticEdgeReturn::getEdge(const Element* e, unsigned i) { if (i < e->getNumberOfEdges()) { - Node** nodes = new Node*[3]; + auto** nodes = new Node*[3]; nodes[0] = const_cast<Node*>(e->getEdgeNode(i,0)); nodes[1] = const_cast<Node*>(e->getEdgeNode(i,1)); nodes[2] = const_cast<Node*>(e->getEdgeNode(i,2)); diff --git a/MeshLib/Elements/PrismRule15.cpp b/MeshLib/Elements/PrismRule15.cpp index 7b0ba0e472a4c428eea7db750908099b67fa84c7..edc1ac1eb18e9a0c0b09a47569f5cce58b2c5626 100644 --- a/MeshLib/Elements/PrismRule15.cpp +++ b/MeshLib/Elements/PrismRule15.cpp @@ -46,7 +46,7 @@ const Element* PrismRule15::getFace(const Element* e, unsigned i) if (i < n_faces) { unsigned nFaceNodes(PrismRule15::n_face_nodes[i]); - Node** nodes = new Node*[nFaceNodes]; + auto** nodes = new Node*[nFaceNodes]; for (unsigned j=0; j<nFaceNodes; j++) nodes[j] = const_cast<Node*>(e->getNode(face_nodes[i][j])); diff --git a/MeshLib/Elements/PrismRule6.cpp b/MeshLib/Elements/PrismRule6.cpp index 844b651754e70ae9cfb58c6dd8f396520ac11477..3c4327add346a6c546459a1da35ddbbbb45c785d 100644 --- a/MeshLib/Elements/PrismRule6.cpp +++ b/MeshLib/Elements/PrismRule6.cpp @@ -48,7 +48,7 @@ const Element* PrismRule6::getFace(const Element* e, unsigned i) if (i < n_faces) { unsigned nFaceNodes(PrismRule6::n_face_nodes[i]); - Node** nodes = new Node*[nFaceNodes]; + auto** nodes = new Node*[nFaceNodes]; for (unsigned j=0; j<nFaceNodes; j++) nodes[j] = const_cast<Node*>(e->getNode(face_nodes[i][j])); @@ -102,7 +102,7 @@ ElementErrorCode PrismRule6::validate(const Element* e) for (unsigned i=1; i<4; ++i) { - const MeshLib::Quad* quad (dynamic_cast<const MeshLib::Quad*>(e->getFace(i))); + const auto* quad(dynamic_cast<const MeshLib::Quad*>(e->getFace(i))); if (quad) error_code |= quad->validate(); else diff --git a/MeshLib/Elements/PyramidRule13.cpp b/MeshLib/Elements/PyramidRule13.cpp index ddd172792dd4a9f3397d0a2883679bf9915147b0..1960f12ad756dc119bad0fdecc866af14a06d4f8 100644 --- a/MeshLib/Elements/PyramidRule13.cpp +++ b/MeshLib/Elements/PyramidRule13.cpp @@ -45,7 +45,7 @@ const Element* PyramidRule13::getFace(const Element* e, unsigned i) if (i<e->getNumberOfFaces()) { unsigned nFaceNodes(PyramidRule13::n_face_nodes[i]); - Node** nodes = new Node*[nFaceNodes]; + auto** nodes = new Node*[nFaceNodes]; for (unsigned j=0; j<nFaceNodes; j++) nodes[j] = const_cast<Node*>(e->getNode(face_nodes[i][j])); diff --git a/MeshLib/Elements/PyramidRule5.cpp b/MeshLib/Elements/PyramidRule5.cpp index 28e35a349ff4665d88e39441648d78a7470c1319..cb2616461bc264fe2a4d18ee9a6024b248b2b966 100644 --- a/MeshLib/Elements/PyramidRule5.cpp +++ b/MeshLib/Elements/PyramidRule5.cpp @@ -47,7 +47,7 @@ const Element* PyramidRule5::getFace(const Element* e, unsigned i) if (i<e->getNumberOfFaces()) { unsigned nFaceNodes(PyramidRule5::n_face_nodes[i]); - Node** nodes = new Node*[nFaceNodes]; + auto** nodes = new Node*[nFaceNodes]; for (unsigned j=0; j<nFaceNodes; j++) nodes[j] = const_cast<Node*>(e->getNode(face_nodes[i][j])); @@ -96,7 +96,7 @@ ElementErrorCode PyramidRule5::validate(const Element* e) ElementErrorCode error_code; error_code[ElementErrorFlag::ZeroVolume] = e->hasZeroVolume(); - const MeshLib::Quad* base (dynamic_cast<const MeshLib::Quad*>(e->getFace(4))); + const auto* base(dynamic_cast<const MeshLib::Quad*>(e->getFace(4))); if (base) { error_code |= base->validate(); diff --git a/MeshLib/IO/Legacy/MeshIO.cpp b/MeshLib/IO/Legacy/MeshIO.cpp index da3d5465407117730175fd4f332a1fa22ad6e7d8..dc2d15dfffeb7cd6d146dc3fa4638b5bcfda3967 100644 --- a/MeshLib/IO/Legacy/MeshIO.cpp +++ b/MeshLib/IO/Legacy/MeshIO.cpp @@ -83,7 +83,7 @@ MeshLib::Mesh* MeshIO::loadMeshFromFile(const std::string& file_name) getline(in, line_string); std::stringstream iss(line_string); iss >> idx >> x >> y >> z; - MeshLib::Node* node(new MeshLib::Node(x, y, z, idx)); + auto* node(new MeshLib::Node(x, y, z, idx)); nodes.push_back(node); iss >> s; if (s.find("$AREA") != std::string::npos) @@ -174,7 +174,7 @@ MeshLib::Element* MeshIO::readElement(std::istream& in, elem_type = MeshLib::String2MeshElemType(elem_type_str); } while (elem_type == MeshLib::MeshElemType::INVALID); - unsigned* idx = new unsigned[8]; + auto* idx = new unsigned[8]; MeshLib::Element* elem; switch(elem_type) @@ -184,7 +184,7 @@ MeshLib::Element* MeshIO::readElement(std::istream& in, if (!(in >> idx[i])) return nullptr; // edge_nodes array will be deleted from Line object - MeshLib::Node** edge_nodes = new MeshLib::Node*[2]; + auto** edge_nodes = new MeshLib::Node*[2]; for (unsigned k(0); k < 2; ++k) edge_nodes[k] = nodes[idx[k]]; elem = new MeshLib::Line(edge_nodes); @@ -194,7 +194,7 @@ MeshLib::Element* MeshIO::readElement(std::istream& in, for (int i = 0; i < 3; ++i) if (!(in >> idx[i])) return nullptr; - MeshLib::Node** tri_nodes = new MeshLib::Node*[3]; + auto** tri_nodes = new MeshLib::Node*[3]; for (unsigned k(0); k < 3; ++k) tri_nodes[k] = nodes[idx[k]]; elem = new MeshLib::Tri(tri_nodes); @@ -204,7 +204,7 @@ MeshLib::Element* MeshIO::readElement(std::istream& in, for (int i = 0; i < 4; ++i) if (!(in >> idx[i])) return nullptr; - MeshLib::Node** quad_nodes = new MeshLib::Node*[4]; + auto** quad_nodes = new MeshLib::Node*[4]; for (unsigned k(0); k < 4; ++k) quad_nodes[k] = nodes[idx[k]]; elem = new MeshLib::Quad(quad_nodes); @@ -214,7 +214,7 @@ MeshLib::Element* MeshIO::readElement(std::istream& in, for (int i = 0; i < 4; ++i) if (!(in >> idx[i])) return nullptr; - MeshLib::Node** tet_nodes = new MeshLib::Node*[4]; + auto** tet_nodes = new MeshLib::Node*[4]; for (unsigned k(0); k < 4; ++k) tet_nodes[k] = nodes[idx[k]]; elem = new MeshLib::Tet(tet_nodes); @@ -224,7 +224,7 @@ MeshLib::Element* MeshIO::readElement(std::istream& in, for (int i = 0; i < 8; ++i) if (!(in >> idx[i])) return nullptr; - MeshLib::Node** hex_nodes = new MeshLib::Node*[8]; + auto** hex_nodes = new MeshLib::Node*[8]; for (unsigned k(0); k < 8; ++k) hex_nodes[k] = nodes[idx[k]]; elem = new MeshLib::Hex(hex_nodes); @@ -234,7 +234,7 @@ MeshLib::Element* MeshIO::readElement(std::istream& in, for (int i = 0; i < 5; ++i) if (!(in >> idx[i])) return nullptr; - MeshLib::Node** pyramid_nodes = new MeshLib::Node*[5]; + auto** pyramid_nodes = new MeshLib::Node*[5]; for (unsigned k(0); k < 5; ++k) pyramid_nodes[k] = nodes[idx[k]]; elem = new MeshLib::Pyramid(pyramid_nodes); @@ -244,7 +244,7 @@ MeshLib::Element* MeshIO::readElement(std::istream& in, for (int i = 0; i < 6; ++i) if (!(in >> idx[i])) return nullptr; - MeshLib::Node** prism_nodes = new MeshLib::Node*[6]; + auto** prism_nodes = new MeshLib::Node*[6]; for (unsigned k(0); k < 6; ++k) prism_nodes[k] = nodes[idx[k]]; elem = new MeshLib::Prism(prism_nodes); diff --git a/MeshLib/MeshEditing/AddLayerToMesh.cpp b/MeshLib/MeshEditing/AddLayerToMesh.cpp index 594c0e81d2147be8aa19c9cbfd66e5dbfaf8db16..13e7454f3d7088a4d23fd9f8c9246e26cb98b8ef 100644 --- a/MeshLib/MeshEditing/AddLayerToMesh.cpp +++ b/MeshLib/MeshEditing/AddLayerToMesh.cpp @@ -53,7 +53,7 @@ MeshLib::Element* extrudeElement(std::vector<MeshLib::Node*> const& subsfc_nodes return nullptr; const unsigned nElemNodes(sfc_elem.getNumberOfBaseNodes()); - MeshLib::Node** new_nodes = new MeshLib::Node*[2*nElemNodes]; + auto** new_nodes = new MeshLib::Node*[2 * nElemNodes]; for (unsigned j=0; j<nElemNodes; ++j) { diff --git a/MeshLib/MeshEditing/ConvertToLinearMesh.cpp b/MeshLib/MeshEditing/ConvertToLinearMesh.cpp index 9d0e558be83a0f206db1849c47886f73744a5839..9b6cf62fe74234f8b018e5b157528f5533f4282b 100644 --- a/MeshLib/MeshEditing/ConvertToLinearMesh.cpp +++ b/MeshLib/MeshEditing/ConvertToLinearMesh.cpp @@ -32,7 +32,7 @@ T_ELEMENT* createLinearElement(MeshLib::Element const* e, std::vector<MeshLib::Node*> const& vec_new_nodes) { auto const n_base_nodes = T_ELEMENT::n_base_nodes; - MeshLib::Node** nodes = new MeshLib::Node*[n_base_nodes]; + auto** nodes = new MeshLib::Node*[n_base_nodes]; for (unsigned i=0; i<e->getNumberOfBaseNodes(); i++) nodes[i] = const_cast<MeshLib::Node*>(vec_new_nodes[e->getNode(i)->getID()]); return new T_ELEMENT(nodes); diff --git a/MeshLib/MeshEditing/DuplicateMeshComponents.cpp b/MeshLib/MeshEditing/DuplicateMeshComponents.cpp index 91ab90155d0fc72d5c04dbb1d5a92fafd9013668..ade3934074bba7b4228026ea02c7bee96a668e0b 100644 --- a/MeshLib/MeshEditing/DuplicateMeshComponents.cpp +++ b/MeshLib/MeshEditing/DuplicateMeshComponents.cpp @@ -64,7 +64,7 @@ MeshLib::Element* copyElement(MeshLib::Element const*const element, const std::v template <typename E> MeshLib::Element* copyElement(MeshLib::Element const*const element, const std::vector<MeshLib::Node*> &nodes) { - MeshLib::Node** new_nodes = new MeshLib::Node*[element->getNumberOfNodes()]; + auto** new_nodes = new MeshLib::Node*[element->getNumberOfNodes()]; for (unsigned i=0; i<element->getNumberOfNodes(); ++i) new_nodes[i] = nodes[element->getNode(i)->getID()]; return new E(new_nodes); diff --git a/MeshLib/MeshEditing/FlipElements.cpp b/MeshLib/MeshEditing/FlipElements.cpp index aab4f09539dcb3b62e4e9e7799ec6d9ea97fad8d..4cac837513f3fc554e3b1e7fead251258cd00c51 100644 --- a/MeshLib/MeshEditing/FlipElements.cpp +++ b/MeshLib/MeshEditing/FlipElements.cpp @@ -25,7 +25,7 @@ std::unique_ptr<MeshLib::Element> createFlippedElement(MeshLib::Element const& e return nullptr; unsigned const n_nodes (elem.getNumberOfNodes()); - MeshLib::Node** elem_nodes = new MeshLib::Node*[n_nodes]; + auto** elem_nodes = new MeshLib::Node*[n_nodes]; for (unsigned i=0; i<n_nodes; ++i) elem_nodes[i] = nodes[elem.getNode(i)->getID()]; std::swap(elem_nodes[0], elem_nodes[1]); diff --git a/MeshLib/MeshEditing/MeshRevision.cpp b/MeshLib/MeshEditing/MeshRevision.cpp index 3d53c0df14483eae63db34c4af25a7da6d4bf798..44a3edd9050b5bce7b90cdae9d78d7d54c6c22a4 100644 --- a/MeshLib/MeshEditing/MeshRevision.cpp +++ b/MeshLib/MeshEditing/MeshRevision.cpp @@ -328,13 +328,13 @@ unsigned MeshRevision::subdivideQuad(MeshLib::Element const*const quad, std::vector<MeshLib::Node*> const& nodes, std::vector<MeshLib::Element*> &new_elements) const { - MeshLib::Node** tri1_nodes = new MeshLib::Node*[3]; + auto** tri1_nodes = new MeshLib::Node*[3]; tri1_nodes[0] = nodes[quad->getNode(0)->getID()]; tri1_nodes[1] = nodes[quad->getNode(1)->getID()]; tri1_nodes[2] = nodes[quad->getNode(2)->getID()]; new_elements.push_back(new MeshLib::Tri(tri1_nodes)); - MeshLib::Node** tri2_nodes = new MeshLib::Node*[3]; + auto** tri2_nodes = new MeshLib::Node*[3]; tri2_nodes[0] = nodes[quad->getNode(0)->getID()]; tri2_nodes[1] = nodes[quad->getNode(2)->getID()]; tri2_nodes[2] = nodes[quad->getNode(3)->getID()]; @@ -347,25 +347,25 @@ unsigned MeshRevision::subdivideHex(MeshLib::Element const*const hex, std::vector<MeshLib::Node*> const& nodes, std::vector<MeshLib::Element*> &new_elements) const { - MeshLib::Node** prism1_nodes = new MeshLib::Node*[6]; + auto** prism1_nodes = new MeshLib::Node*[6]; prism1_nodes[0] = nodes[hex->getNode(0)->getID()]; prism1_nodes[1] = nodes[hex->getNode(2)->getID()]; prism1_nodes[2] = nodes[hex->getNode(1)->getID()]; prism1_nodes[3] = nodes[hex->getNode(4)->getID()]; prism1_nodes[4] = nodes[hex->getNode(6)->getID()]; prism1_nodes[5] = nodes[hex->getNode(5)->getID()]; - MeshLib::Prism* prism1 (new MeshLib::Prism(prism1_nodes)); + auto* prism1(new MeshLib::Prism(prism1_nodes)); this->subdividePrism(prism1, nodes, new_elements); delete prism1; - MeshLib::Node** prism2_nodes = new MeshLib::Node*[6]; + auto** prism2_nodes = new MeshLib::Node*[6]; prism2_nodes[0] = nodes[hex->getNode(4)->getID()]; prism2_nodes[1] = nodes[hex->getNode(6)->getID()]; prism2_nodes[2] = nodes[hex->getNode(7)->getID()]; prism2_nodes[3] = nodes[hex->getNode(0)->getID()]; prism2_nodes[4] = nodes[hex->getNode(2)->getID()]; prism2_nodes[5] = nodes[hex->getNode(3)->getID()]; - MeshLib::Prism* prism2 (new MeshLib::Prism(prism2_nodes)); + auto* prism2(new MeshLib::Prism(prism2_nodes)); this->subdividePrism(prism2, nodes, new_elements); delete prism2; @@ -377,9 +377,8 @@ unsigned MeshRevision::subdividePyramid(MeshLib::Element const*const pyramid, std::vector<MeshLib::Element*> &new_elements) const { auto addTetrahedron = [&pyramid, &nodes, &new_elements]( - std::size_t id0, std::size_t id1, std::size_t id2, std::size_t id3) - { - MeshLib::Node** tet_nodes = new MeshLib::Node*[4]; + std::size_t id0, std::size_t id1, std::size_t id2, std::size_t id3) { + auto** tet_nodes = new MeshLib::Node*[4]; tet_nodes[0] = nodes[pyramid->getNode(id0)->getID()]; tet_nodes[1] = nodes[pyramid->getNode(id1)->getID()]; tet_nodes[2] = nodes[pyramid->getNode(id2)->getID()]; @@ -399,9 +398,8 @@ unsigned MeshRevision::subdividePrism(MeshLib::Element const*const prism, std::vector<MeshLib::Element*> &new_elements) const { auto addTetrahedron = [&prism, &nodes, &new_elements]( - std::size_t id0, std::size_t id1, std::size_t id2, std::size_t id3) - { - MeshLib::Node** tet_nodes = new MeshLib::Node*[4]; + std::size_t id0, std::size_t id1, std::size_t id2, std::size_t id3) { + auto** tet_nodes = new MeshLib::Node*[4]; tet_nodes[0] = nodes[prism->getNode(id0)->getID()]; tet_nodes[1] = nodes[prism->getNode(id1)->getID()]; tet_nodes[2] = nodes[prism->getNode(id2)->getID()]; @@ -436,7 +434,7 @@ unsigned MeshRevision::reduceHex(MeshLib::Element const*const org_elem, if (org_elem->getNode(i)->getID() == org_elem->getNode(j)->getID()) { const std::array<unsigned,4> base_nodes (this->lutHexCuttingQuadNodes(i,j)); - MeshLib::Node** pyr_nodes = new MeshLib::Node*[5]; + auto** pyr_nodes = new MeshLib::Node*[5]; pyr_nodes[0] = nodes[org_elem->getNode(base_nodes[0])->getID()]; pyr_nodes[1] = nodes[org_elem->getNode(base_nodes[1])->getID()]; pyr_nodes[2] = nodes[org_elem->getNode(base_nodes[2])->getID()]; @@ -445,7 +443,7 @@ unsigned MeshRevision::reduceHex(MeshLib::Element const*const org_elem, new_elements.push_back (new MeshLib::Pyramid(pyr_nodes)); if (i<4 && j>=4) std::swap(i,j); - MeshLib::Node** prism_nodes = new MeshLib::Node*[6]; + auto** prism_nodes = new MeshLib::Node*[6]; prism_nodes[0] = nodes[org_elem->getNode(base_nodes[0])->getID()]; prism_nodes[1] = nodes[org_elem->getNode(base_nodes[3])->getID()]; prism_nodes[2] = nodes[org_elem->getNode(this->lutHexDiametralNode(j))->getID()]; @@ -464,7 +462,7 @@ unsigned MeshRevision::reduceHex(MeshLib::Element const*const org_elem, const MeshLib::Element* face (org_elem->getFace(i)); if (face->getNode(0)->getID() == face->getNode(1)->getID() && face->getNode(2)->getID() == face->getNode(3)->getID()) { - MeshLib::Node** prism_nodes = new MeshLib::Node*[6]; + auto** prism_nodes = new MeshLib::Node*[6]; prism_nodes[0] = nodes[org_elem->getNode(this->lutHexDiametralNode(org_elem->getNodeIDinElement(face->getNode(0))))->getID()]; prism_nodes[1] = nodes[org_elem->getNode(this->lutHexDiametralNode(org_elem->getNodeIDinElement(face->getNode(1))))->getID()]; prism_nodes[2] = nodes[org_elem->getNode(org_elem->getNodeIDinElement(face->getNode(2)))->getID()]; @@ -477,7 +475,7 @@ unsigned MeshRevision::reduceHex(MeshLib::Element const*const org_elem, } if (face->getNode(0)->getID() == face->getNode(3)->getID() && face->getNode(1)->getID() == face->getNode(2)->getID()) { - MeshLib::Node** prism_nodes = new MeshLib::Node*[6]; + auto** prism_nodes = new MeshLib::Node*[6]; prism_nodes[0] = nodes[org_elem->getNode(this->lutHexDiametralNode(org_elem->getNodeIDinElement(face->getNode(0))))->getID()]; prism_nodes[1] = nodes[org_elem->getNode(this->lutHexDiametralNode(org_elem->getNodeIDinElement(face->getNode(3))))->getID()]; prism_nodes[2] = nodes[org_elem->getNode(org_elem->getNodeIDinElement(face->getNode(2)))->getID()]; @@ -507,25 +505,25 @@ unsigned MeshRevision::reduceHex(MeshLib::Element const*const org_elem, } std::array<unsigned, 4> cutting_plane (this->lutHexCuttingQuadNodes(back.first, back.second)); - MeshLib::Node** pris1_nodes = new MeshLib::Node*[6]; + auto** pris1_nodes = new MeshLib::Node*[6]; pris1_nodes[0] = const_cast<MeshLib::Node*>(org_elem->getNode(back.first)); pris1_nodes[1] = const_cast<MeshLib::Node*>(org_elem->getNode(cutting_plane[0])); pris1_nodes[2] = const_cast<MeshLib::Node*>(org_elem->getNode(cutting_plane[3])); pris1_nodes[3] = const_cast<MeshLib::Node*>(org_elem->getNode(back.second)); pris1_nodes[4] = const_cast<MeshLib::Node*>(org_elem->getNode(cutting_plane[1])); pris1_nodes[5] = const_cast<MeshLib::Node*>(org_elem->getNode(cutting_plane[2])); - MeshLib::Prism* prism1 (new MeshLib::Prism(pris1_nodes)); + auto* prism1(new MeshLib::Prism(pris1_nodes)); unsigned nNewElements = this->reducePrism(prism1, 5, nodes, new_elements, min_elem_dim); delete prism1; - MeshLib::Node** pris2_nodes = new MeshLib::Node*[6]; + auto** pris2_nodes = new MeshLib::Node*[6]; pris2_nodes[0] = const_cast<MeshLib::Node*>(org_elem->getNode(this->lutHexDiametralNode(back.first))); pris2_nodes[1] = const_cast<MeshLib::Node*>(org_elem->getNode(cutting_plane[0])); pris2_nodes[2] = const_cast<MeshLib::Node*>(org_elem->getNode(cutting_plane[3])); pris2_nodes[3] = const_cast<MeshLib::Node*>(org_elem->getNode(this->lutHexDiametralNode(back.second))); pris2_nodes[4] = const_cast<MeshLib::Node*>(org_elem->getNode(cutting_plane[1])); pris2_nodes[5] = const_cast<MeshLib::Node*>(org_elem->getNode(cutting_plane[2])); - MeshLib::Prism* prism2 (new MeshLib::Prism(pris2_nodes)); + auto* prism2(new MeshLib::Prism(pris2_nodes)); nNewElements += this->reducePrism(prism2, 5, nodes, new_elements, min_elem_dim); delete prism2; return nNewElements; @@ -543,7 +541,7 @@ unsigned MeshRevision::reduceHex(MeshLib::Element const*const org_elem, { delete tet1; tet_changed =true; - MeshLib::Node** tet1_nodes = new MeshLib::Node*[4]; + auto** tet1_nodes = new MeshLib::Node*[4]; tet1_nodes[0] = nodes[first_four_nodes[0]]; tet1_nodes[1] = nodes[first_four_nodes[1]]; tet1_nodes[2] = nodes[first_four_nodes[2]]; @@ -553,7 +551,7 @@ unsigned MeshRevision::reduceHex(MeshLib::Element const*const org_elem, else new_elements.push_back(tet1); - MeshLib::Node** tet2_nodes = new MeshLib::Node*[4]; + auto** tet2_nodes = new MeshLib::Node*[4]; tet2_nodes[0] = (tet_changed) ? nodes[first_four_nodes[0]] : nodes[first_four_nodes[1]]; tet2_nodes[1] = nodes[first_four_nodes[2]]; tet2_nodes[2] = nodes[first_four_nodes[3]]; @@ -609,9 +607,8 @@ unsigned MeshRevision::reducePrism(MeshLib::Element const*const org_elem, unsigned min_elem_dim) const { auto addTetrahedron = [&org_elem, &nodes, &new_elements]( - std::size_t id0, std::size_t id1, std::size_t id2, std::size_t id3) - { - MeshLib::Node** tet_nodes = new MeshLib::Node*[4]; + std::size_t id0, std::size_t id1, std::size_t id2, std::size_t id3) { + auto** tet_nodes = new MeshLib::Node*[4]; tet_nodes[0] = nodes[org_elem->getNode(id0)->getID()]; tet_nodes[1] = nodes[org_elem->getNode(id1)->getID()]; tet_nodes[2] = nodes[org_elem->getNode(id2)->getID()]; @@ -683,7 +680,7 @@ unsigned MeshRevision::reducePrism(MeshLib::Element const*const org_elem, MeshLib::Element* MeshRevision::constructLine(MeshLib::Element const*const element, const std::vector<MeshLib::Node*> &nodes) const { - MeshLib::Node** line_nodes = new MeshLib::Node*[2]; + auto** line_nodes = new MeshLib::Node*[2]; line_nodes[0] = nodes[element->getNode(0)->getID()]; line_nodes[1] = nullptr; for (unsigned i=1; i<element->getNumberOfBaseNodes(); ++i) @@ -704,7 +701,7 @@ MeshLib::Element* MeshRevision::constructTri(MeshLib::Element const*const elemen // TODO? // In theory three unique nodes could also be reduced to two lines e.g. with // a quad where two diametral nodes collapse. This case is currently not implemented! - MeshLib::Node** tri_nodes = new MeshLib::Node*[3]; + auto** tri_nodes = new MeshLib::Node*[3]; tri_nodes[0] = nodes[element->getNode(0)->getID()]; tri_nodes[2] = nullptr; for (unsigned i = 1; i < element->getNumberOfBaseNodes(); ++i) @@ -732,7 +729,7 @@ MeshLib::Element* MeshRevision::constructFourNodeElement( std::vector<MeshLib::Node*> const& nodes, unsigned min_elem_dim) const { - MeshLib::Node** new_nodes = new MeshLib::Node*[4]; + auto** new_nodes = new MeshLib::Node*[4]; unsigned count(0); new_nodes[count++] = nodes[element->getNode(0)->getID()]; for (unsigned i=1; i<element->getNumberOfBaseNodes(); ++i) diff --git a/MeshLib/MeshGenerators/MeshLayerMapper.cpp b/MeshLib/MeshGenerators/MeshLayerMapper.cpp index 754dcfc2c91ff8e58b6248d193ca43eb8dfed4de..b702b7a1bc88e7f3760ed38fc7663dea660d9d68 100644 --- a/MeshLib/MeshGenerators/MeshLayerMapper.cpp +++ b/MeshLib/MeshGenerators/MeshLayerMapper.cpp @@ -94,7 +94,7 @@ MeshLib::Mesh* MeshLayerMapper::createStaticLayers(MeshLib::Mesh const& mesh, st continue; const unsigned nElemNodes(sfc_elem->getNumberOfBaseNodes()); - MeshLib::Node** e_nodes = new MeshLib::Node*[2*nElemNodes]; + auto** e_nodes = new MeshLib::Node*[2 * nElemNodes]; for (unsigned j=0; j<nElemNodes; ++j) { @@ -127,11 +127,11 @@ bool MeshLayerMapper::createRasterLayers( return false; } - MeshLib::Mesh* top (new MeshLib::Mesh(mesh)); + auto* top(new MeshLib::Mesh(mesh)); if (!layerMapping(*top, *rasters.back(), noDataReplacementValue)) return false; - MeshLib::Mesh* bottom (new MeshLib::Mesh(mesh)); + auto* bottom(new MeshLib::Mesh(mesh)); if (!layerMapping(*bottom, *rasters[0], 0)) { delete top; diff --git a/MeshLib/MeshGenerators/QuadraticMeshGenerator.cpp b/MeshLib/MeshGenerators/QuadraticMeshGenerator.cpp index f4d321714b55927d1caafedb785cd03baa261fc3..5d6b68ccbe68d7fd59997eac57bba4439d519c74 100644 --- a/MeshLib/MeshGenerators/QuadraticMeshGenerator.cpp +++ b/MeshLib/MeshGenerators/QuadraticMeshGenerator.cpp @@ -56,7 +56,7 @@ T_ELEMENT* createQuadraticElement( { auto const n_all_nodes = T_ELEMENT::n_all_nodes; auto const n_base_nodes = T_ELEMENT::n_base_nodes; - MeshLib::Node** nodes = new MeshLib::Node*[n_all_nodes]; + auto** nodes = new MeshLib::Node*[n_all_nodes]; for (unsigned i = 0; i < e->getNumberOfBaseNodes(); i++) nodes[i] = const_cast<MeshLib::Node*>(vec_new_nodes[e->getNode(i)->getID()]); diff --git a/MeshLib/MeshGenerators/RasterToMesh.cpp b/MeshLib/MeshGenerators/RasterToMesh.cpp index 7d80280d7ce20d87e3636a0c8ac493fd9dde61dd..dba1407c6c2dad86bc6b7c9cf5074129cf6cde57 100644 --- a/MeshLib/MeshGenerators/RasterToMesh.cpp +++ b/MeshLib/MeshGenerators/RasterToMesh.cpp @@ -179,7 +179,9 @@ std::vector<MeshLib::Node*> RasterToMesh::createNodeVector( continue; double const zValue = (use_elevation) ? elevation[index] : 0; - MeshLib::Node* node (new MeshLib::Node(x_offset + (header.cell_size * j), y_offset + (header.cell_size * i), zValue)); + auto* node(new MeshLib::Node(x_offset + (header.cell_size * j), + y_offset + (header.cell_size * i), + zValue)); nodes.push_back(node); node_idx_map[index] = node_idx_count; node_idx_count++; @@ -206,12 +208,12 @@ std::vector<MeshLib::Element*> RasterToMesh::createElementVector( int const idx = i * incWidth + j; if (elem_type == MeshElemType::TRIANGLE) { - MeshLib::Node** tri1_nodes = new MeshLib::Node*[3]; + auto** tri1_nodes = new MeshLib::Node*[3]; tri1_nodes[0] = nodes[node_idx_map[idx]]; tri1_nodes[1] = nodes[node_idx_map[idx+1]]; tri1_nodes[2] = nodes[node_idx_map[idx+incWidth]]; - MeshLib::Node** tri2_nodes = new MeshLib::Node*[3]; + auto** tri2_nodes = new MeshLib::Node*[3]; tri2_nodes[0] = nodes[node_idx_map[idx+1]]; tri2_nodes[1] = nodes[node_idx_map[idx+incWidth+1]]; tri2_nodes[2] = nodes[node_idx_map[idx+incWidth]]; @@ -221,7 +223,7 @@ std::vector<MeshLib::Element*> RasterToMesh::createElementVector( } else if (elem_type == MeshElemType::QUAD) { - MeshLib::Node** quad_nodes = new MeshLib::Node*[4]; + auto** quad_nodes = new MeshLib::Node*[4]; quad_nodes[0] = nodes[node_idx_map[idx]]; quad_nodes[1] = nodes[node_idx_map[idx + 1]]; quad_nodes[2] = nodes[node_idx_map[idx + incWidth + 1]]; diff --git a/MeshLib/MeshGenerators/RasterToMesh.h b/MeshLib/MeshGenerators/RasterToMesh.h index e386f9694169c777a0f2857edb30d290c8254fec..8ea537a749349eb4b79173c07e35faf2e8c19f84 100644 --- a/MeshLib/MeshGenerators/RasterToMesh.h +++ b/MeshLib/MeshGenerators/RasterToMesh.h @@ -118,7 +118,7 @@ private: { if (!pix_vis[i*imgWidth+j]) continue; - T val (static_cast<T>(pix_val[i*(imgWidth+1)+j])); + auto val(static_cast<T>(pix_val[i * (imgWidth + 1) + j])); if (elem_type == MeshElemType::TRIANGLE) { prop_vec.push_back(val); diff --git a/MeshLib/MeshGenerators/VtkMeshConverter.cpp b/MeshLib/MeshGenerators/VtkMeshConverter.cpp index 1d71cac97527dabebba047056ce38b3752b17ac6..2486a7f656ec16098993a559c9ca6443e67ca1ba 100644 --- a/MeshLib/MeshGenerators/VtkMeshConverter.cpp +++ b/MeshLib/MeshGenerators/VtkMeshConverter.cpp @@ -45,7 +45,7 @@ template <class T_ELEMENT> MeshLib::Element* createElementWithSameNodeOrder(const std::vector<MeshLib::Node*> &nodes, vtkIdList* const node_ids) { - MeshLib::Node** ele_nodes = new MeshLib::Node*[T_ELEMENT::n_all_nodes]; + auto** ele_nodes = new MeshLib::Node*[T_ELEMENT::n_all_nodes]; for (unsigned k(0); k<T_ELEMENT::n_all_nodes; k++) ele_nodes[k] = nodes[node_ids->GetId(k)]; return new T_ELEMENT(ele_nodes); @@ -92,7 +92,7 @@ MeshLib::Mesh* VtkMeshConverter::convertUnstructuredGrid(vtkUnstructuredGrid* gr break; } case VTK_PIXEL: { - MeshLib::Node** quad_nodes = new MeshLib::Node*[4]; + auto** quad_nodes = new MeshLib::Node*[4]; quad_nodes[0] = nodes[node_ids->GetId(0)]; quad_nodes[1] = nodes[node_ids->GetId(1)]; quad_nodes[2] = nodes[node_ids->GetId(3)]; @@ -109,7 +109,7 @@ MeshLib::Mesh* VtkMeshConverter::convertUnstructuredGrid(vtkUnstructuredGrid* gr break; } case VTK_VOXEL: { - MeshLib::Node** voxel_nodes = new MeshLib::Node*[8]; + auto** voxel_nodes = new MeshLib::Node*[8]; voxel_nodes[0] = nodes[node_ids->GetId(0)]; voxel_nodes[1] = nodes[node_ids->GetId(1)]; voxel_nodes[2] = nodes[node_ids->GetId(3)]; @@ -126,7 +126,7 @@ MeshLib::Mesh* VtkMeshConverter::convertUnstructuredGrid(vtkUnstructuredGrid* gr break; } case VTK_WEDGE: { - MeshLib::Node** prism_nodes = new MeshLib::Node*[6]; + auto** prism_nodes = new MeshLib::Node*[6]; for (unsigned i=0; i<3; ++i) { prism_nodes[i] = nodes[node_ids->GetId(i+3)]; @@ -164,7 +164,7 @@ MeshLib::Mesh* VtkMeshConverter::convertUnstructuredGrid(vtkUnstructuredGrid* gr break; } case VTK_QUADRATIC_WEDGE: { - MeshLib::Node** prism_nodes = new MeshLib::Node*[15]; + auto** prism_nodes = new MeshLib::Node*[15]; for (unsigned i=0; i<3; ++i) { prism_nodes[i] = nodes[node_ids->GetId(i+3)]; @@ -197,17 +197,19 @@ MeshLib::Mesh* VtkMeshConverter::convertUnstructuredGrid(vtkUnstructuredGrid* gr void VtkMeshConverter::convertScalarArrays(vtkUnstructuredGrid &grid, MeshLib::Mesh &mesh) { vtkPointData* point_data = grid.GetPointData(); - unsigned const n_point_arrays = static_cast<unsigned>(point_data->GetNumberOfArrays()); + auto const n_point_arrays = + static_cast<unsigned>(point_data->GetNumberOfArrays()); for (unsigned i=0; i<n_point_arrays; ++i) convertArray(*point_data->GetArray(i), mesh.getProperties(), MeshLib::MeshItemType::Node); vtkCellData* cell_data = grid.GetCellData(); - unsigned const n_cell_arrays = static_cast<unsigned>(cell_data->GetNumberOfArrays()); + auto const n_cell_arrays = + static_cast<unsigned>(cell_data->GetNumberOfArrays()); for (unsigned i=0; i<n_cell_arrays; ++i) convertArray(*cell_data->GetArray(i), mesh.getProperties(), MeshLib::MeshItemType::Cell); vtkFieldData* field_data = grid.GetFieldData(); - unsigned const n_field_arrays = + auto const n_field_arrays = static_cast<unsigned>(field_data->GetNumberOfArrays()); for (unsigned i = 0; i < n_field_arrays; ++i) convertArray( diff --git a/MeshLib/MeshGenerators/VtkMeshConverter.h b/MeshLib/MeshGenerators/VtkMeshConverter.h index 704c28cb131a9be12be1c14a7a7756b8276d686d..591c0a1b0226756413ea4bba205744467d1041e2 100644 --- a/MeshLib/MeshGenerators/VtkMeshConverter.h +++ b/MeshLib/MeshGenerators/VtkMeshConverter.h @@ -111,7 +111,7 @@ private: return; } vec->reserve(nTuples*nComponents); - T* data_array = static_cast<T*>(array.GetVoidPointer(0)); + auto* data_array = static_cast<T*>(array.GetVoidPointer(0)); std::copy(&data_array[0], &data_array[nTuples*nComponents], std::back_inserter(*vec)); return; } diff --git a/MeshLib/MeshQuality/MeshValidation.cpp b/MeshLib/MeshQuality/MeshValidation.cpp index 5e26d233205ec4e172ef065b2a19ab4b8b0505a8..af673d8a3d1525e2bc98ff550f6cccb3619fcb26 100644 --- a/MeshLib/MeshQuality/MeshValidation.cpp +++ b/MeshLib/MeshQuality/MeshValidation.cpp @@ -50,7 +50,8 @@ MeshValidation::MeshValidation(MeshLib::Mesh &mesh) std::vector<ElementErrorCode> MeshValidation::testElementGeometry(const MeshLib::Mesh &mesh, double min_volume) { INFO ("Testing mesh element geometry:"); - const std::size_t nErrorCodes (static_cast<std::size_t>(ElementErrorFlag::MaxValue)); + const auto nErrorCodes( + static_cast<std::size_t>(ElementErrorFlag::MaxValue)); unsigned error_count[nErrorCodes]; std::fill_n(error_count, 4, 0); const std::size_t nElements (mesh.getNumberOfElements()); @@ -78,7 +79,8 @@ std::vector<ElementErrorCode> MeshValidation::testElementGeometry(const MeshLib: error_code_vector[i].set(ElementErrorFlag::ZeroVolume); // output - const unsigned error_sum (static_cast<unsigned>(std::accumulate(error_count, error_count+nErrorCodes, 0.0))); + const auto error_sum(static_cast<unsigned>( + std::accumulate(error_count, error_count + nErrorCodes, 0.0))); if (error_sum != 0) { ElementErrorFlag flags[nErrorCodes] = { ElementErrorFlag::ZeroVolume, ElementErrorFlag::NonCoplanar, @@ -95,28 +97,32 @@ std::vector<ElementErrorCode> MeshValidation::testElementGeometry(const MeshLib: std::array<std::string, static_cast<std::size_t>(ElementErrorFlag::MaxValue)> MeshValidation::ElementErrorCodeOutput(const std::vector<ElementErrorCode> &error_codes) { - const std::size_t nErrorFlags (static_cast<std::size_t>(ElementErrorFlag::MaxValue)); - ElementErrorFlag flags[nErrorFlags] = { ElementErrorFlag::ZeroVolume, ElementErrorFlag::NonCoplanar, - ElementErrorFlag::NonConvex, ElementErrorFlag::NodeOrder }; - const std::size_t nElements (error_codes.size()); - std::array<std::string, static_cast<std::size_t>(ElementErrorFlag::MaxValue)> output; - - for (std::size_t i=0; i<nErrorFlags; ++i) + const auto nErrorFlags( + static_cast<std::size_t>(ElementErrorFlag::MaxValue)); + ElementErrorFlag flags[nErrorFlags] = { + ElementErrorFlag::ZeroVolume, ElementErrorFlag::NonCoplanar, + ElementErrorFlag::NonConvex, ElementErrorFlag::NodeOrder}; + const std::size_t nElements(error_codes.size()); + std::array<std::string, + static_cast<std::size_t>(ElementErrorFlag::MaxValue)> + output; + + for (std::size_t i = 0; i < nErrorFlags; ++i) { unsigned count(0); std::string elementIdStr(""); - for (std::size_t j=0; j<nElements; ++j) + for (std::size_t j = 0; j < nElements; ++j) { if (error_codes[j][flags[i]]) { elementIdStr += (std::to_string(j) + ", "); count++; } - } const std::string nErrorsStr = (count) ? std::to_string(count) : "No"; - output[i] = (nErrorsStr + " elements found with " + ElementErrorCode::toString(flags[i]) + ".\n"); + output[i] = (nErrorsStr + " elements found with " + + ElementErrorCode::toString(flags[i]) + ".\n"); if (count) output[i] += ("ElementIDs: " + elementIdStr + "\n"); @@ -134,7 +140,7 @@ unsigned MeshValidation::detectHoles(MeshLib::Mesh const& mesh) std::vector<unsigned> sfc_idx (elements.size(), std::numeric_limits<unsigned>::max()); unsigned current_surface_id (0); - std::vector<unsigned>::const_iterator it = sfc_idx.cbegin(); + auto it = sfc_idx.cbegin(); while (it != sfc_idx.cend()) { diff --git a/MeshLib/MeshSearch/MeshElementGrid.cpp b/MeshLib/MeshSearch/MeshElementGrid.cpp index cf37745b088c45f07f0705b5b91f02deb110b86b..f7e6c1f4304ee25e96aa805d4b3a4a06b4263b03 100644 --- a/MeshLib/MeshSearch/MeshElementGrid.cpp +++ b/MeshLib/MeshSearch/MeshElementGrid.cpp @@ -233,34 +233,34 @@ void getGridGeometry(MeshElementGrid const& grid, new std::vector<GeoLib::Polyline*>); auto & points = *geometries.getPointVec(cell_names.back()); - GeoLib::Polyline* ply_bottom(new GeoLib::Polyline(points)); + auto* ply_bottom(new GeoLib::Polyline(points)); for (std::size_t l(0); l < 4; ++l) ply_bottom->addPoint(l); ply_bottom->addPoint(0); // close to bottom surface plys->push_back(ply_bottom); - GeoLib::Polyline* ply_top(new GeoLib::Polyline(points)); + auto* ply_top(new GeoLib::Polyline(points)); for (std::size_t l(4); l<8; ++l) ply_top->addPoint(l); ply_top->addPoint(4); // close to top surface plys->push_back(ply_top); - GeoLib::Polyline* ply_04(new GeoLib::Polyline(points)); + auto* ply_04(new GeoLib::Polyline(points)); ply_04->addPoint(0); ply_04->addPoint(4); plys->push_back(ply_04); - GeoLib::Polyline* ply_15(new GeoLib::Polyline(points)); + auto* ply_15(new GeoLib::Polyline(points)); ply_15->addPoint(1); ply_15->addPoint(5); plys->push_back(ply_15); - GeoLib::Polyline* ply_26(new GeoLib::Polyline(points)); + auto* ply_26(new GeoLib::Polyline(points)); ply_26->addPoint(2); ply_26->addPoint(6); plys->push_back(ply_26); - GeoLib::Polyline* ply_37(new GeoLib::Polyline(points)); + auto* ply_37(new GeoLib::Polyline(points)); ply_37->addPoint(3); ply_37->addPoint(7); plys->push_back(ply_37); diff --git a/MeshLib/MeshSubset.h b/MeshLib/MeshSubset.h index b10bae59627cf7dae4649391c4f7e19115b4c600..5dc343f08bc052eaa781f48c5ee98c1ea952957b 100644 --- a/MeshLib/MeshSubset.h +++ b/MeshLib/MeshSubset.h @@ -137,7 +137,7 @@ public: MeshSubset* getIntersectionByNodes(std::vector<Node*> const& nodes) const { - std::vector<Node*>* active_nodes = new std::vector<Node*>; + auto* active_nodes = new std::vector<Node*>; if (_nodes == nullptr || _nodes->empty()) return new MeshSubset(_msh, active_nodes); // Empty mesh subset diff --git a/MeshLib/MeshSurfaceExtraction.cpp b/MeshLib/MeshSurfaceExtraction.cpp index 8843b41ffca103cd309e4277617895befe7d2555..ba14e2fd1d696767a5ce4327170142d6bb673478 100644 --- a/MeshLib/MeshSurfaceExtraction.cpp +++ b/MeshLib/MeshSurfaceExtraction.cpp @@ -103,7 +103,7 @@ MeshLib::Mesh* MeshSurfaceExtraction::getMeshSurface( for (auto elem = sfc_elements.cbegin(); elem != sfc_elements.cend(); ++elem) { unsigned const n_elem_nodes ((*elem)->getNumberOfBaseNodes()); - MeshLib::Node** new_nodes = new MeshLib::Node*[n_elem_nodes]; + auto** new_nodes = new MeshLib::Node*[n_elem_nodes]; for (unsigned k(0); k<n_elem_nodes; k++) new_nodes[k] = sfc_nodes[node_id_map[(*elem)->getNode(k)->getID()]]; if ((*elem)->getGeomType() == MeshElemType::TRIANGLE) diff --git a/MeshLib/Properties-impl.h b/MeshLib/Properties-impl.h index e42ba563c06f53306c577286105564f8f99dda89..5e61698e1099c62a5291a5280f88e8229bddca4e 100644 --- a/MeshLib/Properties-impl.h +++ b/MeshLib/Properties-impl.h @@ -77,8 +77,7 @@ PropertyVector<T>* Properties::createNewPropertyVector( template <typename T> bool Properties::existsPropertyVector(std::string const& name) const { - std::map<std::string, PropertyVectorBase*>::const_iterator it( - _properties.find(name)); + auto it(_properties.find(name)); // Check that a PropertyVector with the approriate name exists. if (it == _properties.end()) { @@ -92,8 +91,7 @@ template <typename T> PropertyVector<T> const* Properties::getPropertyVector( std::string const& name) const { - std::map<std::string, PropertyVectorBase*>::const_iterator it( - _properties.find(name)); + auto it(_properties.find(name)); if (it == _properties.end()) { OGS_FATAL( @@ -113,8 +111,7 @@ PropertyVector<T> const* Properties::getPropertyVector( template <typename T> PropertyVector<T>* Properties::getPropertyVector(std::string const& name) { - std::map<std::string, PropertyVectorBase*>::iterator it( - _properties.find(name)); + auto it(_properties.find(name)); if (it == _properties.end()) { OGS_FATAL( diff --git a/MeshLib/Properties.cpp b/MeshLib/Properties.cpp index ced0d5659dd4db0c6859266d2a4eb22eee631015..1a50474fdc252a60f63bb7875590cf637bf70606 100644 --- a/MeshLib/Properties.cpp +++ b/MeshLib/Properties.cpp @@ -32,9 +32,7 @@ void Properties::removePropertyVector(std::string const& name) bool Properties::hasPropertyVector(std::string const& name) const { - std::map<std::string, PropertyVectorBase*>::const_iterator it( - _properties.find(name) - ); + auto it(_properties.find(name)); if (it == _properties.end()) { return false; } diff --git a/MeshLib/PropertyVector.h b/MeshLib/PropertyVector.h index 37b285ccf9d180a1648feb82fdbb59c03594b284..fc3de6dddfbc3f039d38c32ea4403673774dd373 100644 --- a/MeshLib/PropertyVector.h +++ b/MeshLib/PropertyVector.h @@ -86,7 +86,7 @@ public: PropertyVectorBase* clone( std::vector<std::size_t> const& exclude_positions) const { - PropertyVector<PROP_VAL_TYPE>* t(new PropertyVector<PROP_VAL_TYPE>( + auto* t(new PropertyVector<PROP_VAL_TYPE>( _property_name, _mesh_item_type, _n_components)); BaseLib::excludeObjectCopy(*this, exclude_positions, *t); return t; @@ -166,7 +166,7 @@ public: if (_n_components != 1) OGS_FATAL("Single-component version of initPropertyValue() is called " "for a multi-components PropertyVector<T*>"); - T* p = new T[1]; + auto* p = new T[1]; p[0] = value; _values[group_id] = p; } @@ -177,7 +177,7 @@ public: OGS_FATAL("The size of provided values in initPropertyValue() is " "not same as the number of components in PropertyVector<T*>"); - T* p = new T[values.size()]; + auto* p = new T[values.size()]; for (unsigned i=0; i<values.size(); i++) p[i] = values[i]; _values[group_id] = p; diff --git a/MeshLib/Vtk/VtkMappedMeshSource.cpp b/MeshLib/Vtk/VtkMappedMeshSource.cpp index dcb2bb5ddd5feca92881201504b1535ba152596f..1c7a7a07227f90c888ae83793159b85c7fba89bb 100644 --- a/MeshLib/Vtk/VtkMappedMeshSource.cpp +++ b/MeshLib/Vtk/VtkMappedMeshSource.cpp @@ -31,7 +31,7 @@ namespace MeshLib { vtkStandardNewMacro(VtkMappedMeshSource) -void VtkMappedMeshSource::PrintSelf(std::ostream& os, vtkIndent indent) + void VtkMappedMeshSource::PrintSelf(std::ostream& os, vtkIndent indent) { this->Superclass::PrintSelf(os, indent); os << indent << "Mesh: " << (_mesh ? _mesh->getName() : "(none)") << endl; @@ -130,8 +130,7 @@ int VtkMappedMeshSource::RequestData(vtkInformation*, std::vector<std::string> const& propertyNames = properties.getPropertyVectorNames(); - for (std::vector<std::string>::const_iterator name = propertyNames.cbegin(); - name != propertyNames.cend(); + for (auto name = propertyNames.cbegin(); name != propertyNames.cend(); ++name) { if (addProperty<double>(properties, *name)) diff --git a/MeshLib/convertMeshToGeo.cpp b/MeshLib/convertMeshToGeo.cpp index 7b1f2b2562b1376173f66d7bedbf61fc9299d0bd..23d880bae577f9160426760ae2b3c206de0c1518 100644 --- a/MeshLib/convertMeshToGeo.cpp +++ b/MeshLib/convertMeshToGeo.cpp @@ -99,7 +99,7 @@ MeshLib::Mesh* convertSurfaceToMesh(const GeoLib::Surface &sfc, const std::strin for (std::size_t i=0; i<sfc.getNumberOfTriangles(); i++) { auto* tri = sfc[i]; - MeshLib::Node** tri_nodes = new MeshLib::Node*[3]; + auto** tri_nodes = new MeshLib::Node*[3]; for (unsigned j=0; j<3; j++) tri_nodes[j] = new MeshLib::Node(tri->getPoint(j)->getCoords(), nodeId++); elements.push_back(new MeshLib::Tri(tri_nodes, i)); diff --git a/NumLib/Extrapolation/LocalLinearLeastSquaresExtrapolator.cpp b/NumLib/Extrapolation/LocalLinearLeastSquaresExtrapolator.cpp index 26d97f7b7e85a378194f1914abd3c55c473924b9..5a53d633d54312048fa5afe8fad952f234ac5f77 100644 --- a/NumLib/Extrapolation/LocalLinearLeastSquaresExtrapolator.cpp +++ b/NumLib/Extrapolation/LocalLinearLeastSquaresExtrapolator.cpp @@ -88,7 +88,7 @@ void LocalLinearLeastSquaresExtrapolator::extrapolateElement( element_index, _integration_point_values_cache); auto const& N_0 = extrapolatables.getShapeMatrix(element_index, 0); - const unsigned num_nodes = static_cast<unsigned>(N_0.cols()); + const auto num_nodes = static_cast<unsigned>(N_0.cols()); const unsigned num_int_pts = integration_point_values.size(); assert(num_int_pts >= num_nodes && diff --git a/NumLib/Fem/Integration/IntegrationGaussPrism.h b/NumLib/Fem/Integration/IntegrationGaussPrism.h index f2fdb573b6f18edb261b0b88f60816525a9f54c8..087a53d652c68a2ec65f1f6d0e38756447d80147 100644 --- a/NumLib/Fem/Integration/IntegrationGaussPrism.h +++ b/NumLib/Fem/Integration/IntegrationGaussPrism.h @@ -59,7 +59,7 @@ public: { (void)order; const unsigned gp_r = igp % 3; - const unsigned gp_t = (unsigned)(igp/3); + const auto gp_t = (unsigned)(igp / 3); std::array<double, 3> rst; rst[0] = MathLib::GaussLegendreTri<2>::X[gp_r][0]; rst[1] = MathLib::GaussLegendreTri<2>::X[gp_r][1]; diff --git a/ProcessLib/HeatConduction/HeatConductionFEM-impl.h b/ProcessLib/HeatConduction/HeatConductionFEM-impl.h index 2110040f4a262e826a5365f4b4ff10c480b283da..f3bafbc7c1ccb7ad84e7747635e55f01fe733515 100644 --- a/ProcessLib/HeatConduction/HeatConductionFEM-impl.h +++ b/ProcessLib/HeatConduction/HeatConductionFEM-impl.h @@ -121,7 +121,7 @@ void LocalAssemblerData<ShapeFunction, IntegrationMethod, GlobalDim>:: dynamic_cast<const ProcessLib::LiquidFlow::LiquidFlowProcess*>( &(coupled_process_pair.second)) != nullptr); - ProcessLib::LiquidFlow::LiquidFlowProcess const& pcs = + auto const& pcs = static_cast<ProcessLib::LiquidFlow::LiquidFlowProcess const&>( coupled_process_pair.second); const auto liquid_flow_prop = pcs.getLiquidFlowMaterialProperties(); diff --git a/ProcessLib/LiquidFlow/CreateLiquidFlowProcess.cpp b/ProcessLib/LiquidFlow/CreateLiquidFlowProcess.cpp index 1259fd9758491df54a628b9a015e07e361661176..577261fc04c6ffb5ca3e00cb6431ad989d41b257 100644 --- a/ProcessLib/LiquidFlow/CreateLiquidFlowProcess.cpp +++ b/ProcessLib/LiquidFlow/CreateLiquidFlowProcess.cpp @@ -58,11 +58,11 @@ std::unique_ptr<Process> createLiquidFlowProcess( // Get the gravity vector for the Darcy velocity //! \ogs_file_param{prj__processes__process__LIQUID_FLOW__darcy_gravity} auto const& darcy_g_config = config.getConfigSubtree("darcy_gravity"); - const int gravity_axis_id_input = + const auto gravity_axis_id_input = //! \ogs_file_param{prj__processes__process__LIQUID_FLOW__darcy_gravity__axis_id} darcy_g_config.getConfigParameter<int>("axis_id"); assert(gravity_axis_id_input < static_cast<int>(mesh.getDimension())); - const double g = + const auto g = //! \ogs_file_param{prj__processes__process__LIQUID_FLOW__darcy_gravity__g} darcy_g_config.getConfigParameter<double>("g"); assert(g >= 0.); diff --git a/SimpleTests/MatrixTests/DenseGaussEliminationChecker.cpp b/SimpleTests/MatrixTests/DenseGaussEliminationChecker.cpp index 6903878f3801e8a5e901994c91ee1d6dad2e4a16..6586c0affc0d4cfcee90395f43eb5879a78e39ae 100644 --- a/SimpleTests/MatrixTests/DenseGaussEliminationChecker.cpp +++ b/SimpleTests/MatrixTests/DenseGaussEliminationChecker.cpp @@ -24,8 +24,8 @@ int main(int argc, char *argv[]) { LOGOG_INITIALIZE(); - BaseLib::LogogSimpleFormatter *custom_format (new BaseLib::LogogSimpleFormatter); - logog::Cout *logogCout(new logog::Cout); + auto* custom_format(new BaseLib::LogogSimpleFormatter); + auto* logogCout(new logog::Cout); logogCout->SetFormatter(*custom_format); TCLAP::CmdLine cmd("Simple direct matrix solver test.\n\ diff --git a/SimpleTests/MeshTests/MeshRead.cpp b/SimpleTests/MeshTests/MeshRead.cpp index 886c0e1fbda015b3e3d497120d4f018726575f37..74e3770031cff679102ba8d7d832305c2216a143 100644 --- a/SimpleTests/MeshTests/MeshRead.cpp +++ b/SimpleTests/MeshTests/MeshRead.cpp @@ -31,8 +31,8 @@ int main(int argc, char *argv[]) { LOGOG_INITIALIZE(); - BaseLib::LogogSimpleFormatter *custom_format (new BaseLib::LogogSimpleFormatter); - logog::Cout *logogCout(new logog::Cout); + auto* custom_format(new BaseLib::LogogSimpleFormatter); + auto* logogCout(new logog::Cout); logogCout->SetFormatter(*custom_format); TCLAP::CmdLine cmd("Simple mesh loading test", ' ', "0.1"); diff --git a/SimpleTests/MeshTests/MeshSearchTest.cpp b/SimpleTests/MeshTests/MeshSearchTest.cpp index f38981a1c77e7648241332c89003a5c0cc5c14ae..7480de710c3e85b4dbe726c8d4e5b4218bc24ce7 100644 --- a/SimpleTests/MeshTests/MeshSearchTest.cpp +++ b/SimpleTests/MeshTests/MeshSearchTest.cpp @@ -91,8 +91,8 @@ void testMeshGridAlgorithm(MeshLib::Mesh const*const mesh, int main(int argc, char *argv[]) { LOGOG_INITIALIZE(); - logog::Cout* logog_cout (new logog::Cout); - BaseLib::LogogSimpleFormatter *custom_format (new BaseLib::LogogSimpleFormatter); + auto* logog_cout(new logog::Cout); + auto* custom_format(new BaseLib::LogogSimpleFormatter); logog_cout->SetFormatter(*custom_format); TCLAP::CmdLine cmd("Simple mesh search test", ' ', "0.1"); diff --git a/Tests/FileIO/TestGmlInterface.h b/Tests/FileIO/TestGmlInterface.h index 9c367ac2e7ba31970bde93a38460548004e4b85c..47de4c320ab451f1aa3f0f81a2e698c1d2912fd5 100644 --- a/Tests/FileIO/TestGmlInterface.h +++ b/Tests/FileIO/TestGmlInterface.h @@ -111,8 +111,7 @@ public: auto lines = std::unique_ptr<std::vector<GeoLib::Polyline*>>( new std::vector<GeoLib::Polyline*>(5)); - std::map<std::string, std::size_t>* name_map = - new std::map<std::string, std::size_t>; + auto* name_map = new std::map<std::string, std::size_t>; createPolyline(pnt_vec, *(lines.get()), 0, {0, 1, 2}, *name_map, "left"); createPolyline(pnt_vec, *(lines.get()), 1, {3, 4, 5}, *name_map, "center"); @@ -157,8 +156,7 @@ public: auto sfcs = std::unique_ptr<std::vector<GeoLib::Surface*>>( new std::vector<GeoLib::Surface*>(2)); - std::map<std::string, std::size_t>* sfc_names = - new std::map<std::string, std::size_t>; + auto* sfc_names = new std::map<std::string, std::size_t>; (*sfcs)[0] = new GeoLib::Surface(*points); (*sfcs)[0]->addTriangle(pnt_id_map[0], pnt_id_map[3], pnt_id_map[1]); (*sfcs)[0]->addTriangle(pnt_id_map[1], pnt_id_map[3], pnt_id_map[4]); diff --git a/Tests/GeoLib/TestAABB.cpp b/Tests/GeoLib/TestAABB.cpp index 09f233a1c76195f5c9c2d98f93c7af4749d8d644..68b83ed20877bd4b645159f64bfedfbd41e23454 100644 --- a/Tests/GeoLib/TestAABB.cpp +++ b/Tests/GeoLib/TestAABB.cpp @@ -54,7 +54,8 @@ TEST(GeoLibAABB, RandomNumberOfPointersToRandomPoints) ASSERT_GE(half_box_size, max_pnt[1]) << "coordinate 1 of max_pnt is greater than " << half_box_size; ASSERT_GE(half_box_size, max_pnt[2]) << "coordinate 2 of max_pnt is greater than " << half_box_size; - for (std::list<GeoLib::Point*>::iterator it(pnts_list.begin()); it != pnts_list.end(); it++) { + for (auto it(pnts_list.begin()); it != pnts_list.end(); it++) + { delete *it; } } @@ -122,7 +123,8 @@ TEST(GeoLibAABB, RandomNumberOfPointersToRandomPointsInAVector) ASSERT_GE(half_box_size, max_pnt[1]) << "coordinate 1 of max_pnt is greater than " << half_box_size; ASSERT_GE(half_box_size, max_pnt[2]) << "coordinate 2 of max_pnt is greater than " << half_box_size; - for (std::vector<GeoLib::Point*>::iterator it(pnts.begin()); it != pnts.end(); it++) { + for (auto it(pnts.begin()); it != pnts.end(); it++) + { delete *it; } } @@ -170,9 +172,9 @@ TEST(GeoLibAABB, RandomNumberOfPointsRandomBox) double half_box_size_x(box_size_x/2); double half_box_size_y(box_size_y/2); double half_box_size_z(box_size_z/2); - int minus_half_box_size_x(static_cast<int>(-half_box_size_x)); - int minus_half_box_size_y(static_cast<int>(-half_box_size_y)); - int minus_half_box_size_z(static_cast<int>(-half_box_size_z)); + auto minus_half_box_size_x(static_cast<int>(-half_box_size_x)); + auto minus_half_box_size_y(static_cast<int>(-half_box_size_y)); + auto minus_half_box_size_z(static_cast<int>(-half_box_size_z)); // fill list with points std::list<GeoLib::Point> pnts; diff --git a/Tests/GeoLib/TestComputeAndInsertAllIntersectionPoints.cpp b/Tests/GeoLib/TestComputeAndInsertAllIntersectionPoints.cpp index 78bc6274fe099a2a83daece259b85632cd85cb5d..a2790dc9269c88518f958cf919095f0f10aafe29 100644 --- a/Tests/GeoLib/TestComputeAndInsertAllIntersectionPoints.cpp +++ b/Tests/GeoLib/TestComputeAndInsertAllIntersectionPoints.cpp @@ -49,13 +49,13 @@ TEST(GeoLib, TestComputeAndInsertAllIntersectionPoints) // *** create polylines auto& pnts = *geo_objs.getPointVec(geo_name); - GeoLib::Polyline* ply0(new GeoLib::Polyline(pnts)); + auto* ply0(new GeoLib::Polyline(pnts)); ply0->addPoint(0); ply0->addPoint(1); - GeoLib::Polyline* ply1(new GeoLib::Polyline(pnts)); + auto* ply1(new GeoLib::Polyline(pnts)); for (std::size_t k(2); k<pnts.size(); ++k) ply1->addPoint(k); - std::vector<GeoLib::Polyline*>* plys(new std::vector<GeoLib::Polyline*>); + auto* plys(new std::vector<GeoLib::Polyline*>); plys->push_back(ply0); plys->push_back(ply1); diff --git a/Tests/GeoLib/TestDuplicateGeometry.cpp b/Tests/GeoLib/TestDuplicateGeometry.cpp index 49e7f2d1eb019fc40ac4683fee7fb3d02ce11614..752e598870ac8b084115417275e4d00c8f6f73a3 100644 --- a/Tests/GeoLib/TestDuplicateGeometry.cpp +++ b/Tests/GeoLib/TestDuplicateGeometry.cpp @@ -72,7 +72,7 @@ TEST(GeoLib, DuplicateGeometry) for (std::size_t i=0; i<n_plys; ++i) { int n_ply_pnts (rand() % 100 + 2); - GeoLib::Polyline* line = new GeoLib::Polyline(*geo.getPointVec(input_name)); + auto* line = new GeoLib::Polyline(*geo.getPointVec(input_name)); for (std::size_t j=0; j<static_cast<std::size_t>(n_ply_pnts); ++j) line->addPoint(rand() % n_pnts); plys->push_back(line); @@ -110,7 +110,7 @@ TEST(GeoLib, DuplicateGeometry) for (std::size_t i=0; i<n_sfcs; ++i) { int n_tris (rand() % 10); - GeoLib::Surface* sfc = new GeoLib::Surface(*geo.getPointVec(input_name)); + auto* sfc = new GeoLib::Surface(*geo.getPointVec(input_name)); for (std::size_t j=0; j<static_cast<std::size_t>(n_tris); ++j) sfc->addTriangle(rand() % n_pnts, rand() % n_pnts, rand() % n_pnts); if (sfc->getNumberOfTriangles() > 0) @@ -146,7 +146,7 @@ TEST(GeoLib, DuplicateGeometry) mod_pnts.push_back(new GeoLib::Point(1,0,0,n_pnts)); mod_pnts.push_back(new GeoLib::Point(0,1,0,n_pnts+1)); mod_pnts.push_back(new GeoLib::Point(0,0,1,n_pnts+2)); - GeoLib::Surface* sfc = new GeoLib::Surface(mod_pnts); + auto* sfc = new GeoLib::Surface(mod_pnts); sfc->addTriangle(n_pnts, n_pnts+1, n_pnts+2); mod_sfcs.push_back(sfc); ASSERT_EQ(mod_sfcs.size(), sfcs->size() + 1); diff --git a/Tests/GeoLib/TestGEOObjectsMerge.cpp b/Tests/GeoLib/TestGEOObjectsMerge.cpp index 0d79affa1d36010dd1984e2b4264b3828cc4b6af..4b427c3b4cf5ee421098a222d2072138d1e2b782 100644 --- a/Tests/GeoLib/TestGEOObjectsMerge.cpp +++ b/Tests/GeoLib/TestGEOObjectsMerge.cpp @@ -23,7 +23,7 @@ void createSetOfTestPointsAndAssociatedNames(GeoLib::GEOObjects & geo_objs, std: { auto pnts = std::unique_ptr<std::vector<GeoLib::Point*>>( new std::vector<GeoLib::Point*>); - std::map<std::string, std::size_t>* pnt_name_map(new std::map< std::string, std::size_t>); + auto* pnt_name_map(new std::map<std::string, std::size_t>); const std::size_t pnts_per_edge(8); for (std::size_t k(0); k < pnts_per_edge; k++) { @@ -120,7 +120,7 @@ TEST(GeoLib, GEOObjectsMergePointsAndPolylines) geo_objs.addPointVec(std::move(pnts), geometry_0, nullptr, std::numeric_limits<double>::epsilon()); // *** insert polyline - GeoLib::Polyline* ply(new GeoLib::Polyline(*geo_objs.getPointVec(geometry_0))); + auto* ply(new GeoLib::Polyline(*geo_objs.getPointVec(geometry_0))); ply->addPoint(0); ply->addPoint(1); ply->addPoint(2); @@ -169,7 +169,7 @@ TEST(GeoLib, GEOObjectsMergePolylinesWithNames) std::numeric_limits<double>::epsilon()); // *** insert a named polyline into geometry - GeoLib::Polyline* ply_00(new GeoLib::Polyline(*geo_objs.getPointVec(geometry_0))); + auto* ply_00(new GeoLib::Polyline(*geo_objs.getPointVec(geometry_0))); ply_00->addPoint(0); ply_00->addPoint(1); ply_00->addPoint(2); @@ -178,7 +178,7 @@ TEST(GeoLib, GEOObjectsMergePolylinesWithNames) auto plys_0 = std::unique_ptr<std::vector<GeoLib::Polyline*>>( new std::vector<GeoLib::Polyline*>); plys_0->push_back(ply_00); - std::map<std::string, std::size_t> *names_map_0(new std::map<std::string, std::size_t>); + auto* names_map_0(new std::map<std::string, std::size_t>); names_map_0->insert(std::pair<std::string, std::size_t>("Polyline0FromGeometry0", 0)); geo_objs.addPolylineVec(std::move(plys_0), geometry_0, names_map_0); names.push_back(geometry_0); @@ -198,17 +198,17 @@ TEST(GeoLib, GEOObjectsMergePolylinesWithNames) std::numeric_limits<double>::epsilon()); // *** insert a named polyline into geometry - GeoLib::Polyline* ply_10(new GeoLib::Polyline(*geo_objs.getPointVec(geometry_1))); + auto* ply_10(new GeoLib::Polyline(*geo_objs.getPointVec(geometry_1))); ply_10->addPoint(0); ply_10->addPoint(1); - GeoLib::Polyline* ply_11(new GeoLib::Polyline(*geo_objs.getPointVec(geometry_1))); + auto* ply_11(new GeoLib::Polyline(*geo_objs.getPointVec(geometry_1))); ply_11->addPoint(2); ply_11->addPoint(3); auto plys_1 = std::unique_ptr<std::vector<GeoLib::Polyline*>>( new std::vector<GeoLib::Polyline*>); plys_1->push_back(ply_10); plys_1->push_back(ply_11); - std::map<std::string, std::size_t> *names_map_1(new std::map<std::string, std::size_t>); + auto* names_map_1(new std::map<std::string, std::size_t>); names_map_1->insert(std::pair<std::string, std::size_t>("Polyline0FromGeometry1", 0)); names_map_1->insert(std::pair<std::string, std::size_t>("Polyline1FromGeometry1", 1)); geo_objs.addPolylineVec(std::move(plys_1), geometry_1, names_map_1); diff --git a/Tests/GeoLib/TestSimplePolygonTree.cpp b/Tests/GeoLib/TestSimplePolygonTree.cpp index 59194f629f41563e23f24d6481248227b9fa1338..cbef784f4da7c38813df189fd5df3270e279e8db 100644 --- a/Tests/GeoLib/TestSimplePolygonTree.cpp +++ b/Tests/GeoLib/TestSimplePolygonTree.cpp @@ -106,8 +106,8 @@ protected: TEST_F(CreatePolygonTreesTest, P0AndP1) { - GeoLib::SimplePolygonTree *pt0(new GeoLib::SimplePolygonTree(_p0, nullptr)); - GeoLib::SimplePolygonTree *pt1(new GeoLib::SimplePolygonTree(_p1, nullptr)); + auto* pt0(new GeoLib::SimplePolygonTree(_p0, nullptr)); + auto* pt1(new GeoLib::SimplePolygonTree(_p1, nullptr)); std::list<GeoLib::SimplePolygonTree*> pt_list; pt_list.push_back(pt0); @@ -121,9 +121,9 @@ TEST_F(CreatePolygonTreesTest, P0AndP1) TEST_F(CreatePolygonTreesTest, P0AndP1AndP2) { - GeoLib::SimplePolygonTree *pt0(new GeoLib::SimplePolygonTree(_p0, nullptr)); - GeoLib::SimplePolygonTree *pt1(new GeoLib::SimplePolygonTree(_p1, nullptr)); - GeoLib::SimplePolygonTree *pt2(new GeoLib::SimplePolygonTree(_p2, nullptr)); + auto* pt0(new GeoLib::SimplePolygonTree(_p0, nullptr)); + auto* pt1(new GeoLib::SimplePolygonTree(_p1, nullptr)); + auto* pt2(new GeoLib::SimplePolygonTree(_p2, nullptr)); std::list<GeoLib::SimplePolygonTree*> pt_list; pt_list.push_back(pt0); @@ -146,10 +146,10 @@ TEST_F(CreatePolygonTreesTest, P0AndP1AndP2) TEST_F(CreatePolygonTreesTest, P0AndP1AndP2AndP3) { - GeoLib::SimplePolygonTree *pt0(new GeoLib::SimplePolygonTree(_p0, nullptr)); - GeoLib::SimplePolygonTree *pt1(new GeoLib::SimplePolygonTree(_p1, nullptr)); - GeoLib::SimplePolygonTree *pt2(new GeoLib::SimplePolygonTree(_p2, nullptr)); - GeoLib::SimplePolygonTree *pt3(new GeoLib::SimplePolygonTree(_p3, nullptr)); + auto* pt0(new GeoLib::SimplePolygonTree(_p0, nullptr)); + auto* pt1(new GeoLib::SimplePolygonTree(_p1, nullptr)); + auto* pt2(new GeoLib::SimplePolygonTree(_p2, nullptr)); + auto* pt3(new GeoLib::SimplePolygonTree(_p3, nullptr)); std::list<GeoLib::SimplePolygonTree*> pt_list; pt_list.push_back(pt0); diff --git a/Tests/GeoLib/TestSortSegments.cpp b/Tests/GeoLib/TestSortSegments.cpp index c6ca27d8d78cc3d345214f3e3fe5f080cbc00bda..9411d23c9d665c6c63d6c3ebc4c7b44e79e60a93 100644 --- a/Tests/GeoLib/TestSortSegments.cpp +++ b/Tests/GeoLib/TestSortSegments.cpp @@ -50,12 +50,12 @@ TEST_F(GeoLibSortLineSegments, SortSubSegments) for (auto sub_seg_id : sub_seg_ids) { double t(dt * sub_seg_id); - GeoLib::Point* sub_seg_begin_pnt(new GeoLib::Point{ + auto* sub_seg_begin_pnt(new GeoLib::Point{ (1 - t) * s0.getBeginPoint()[0] + t * s0.getEndPoint()[0], (1 - t) * s0.getBeginPoint()[1] + t * s0.getEndPoint()[1], (1 - t) * s0.getBeginPoint()[2] + t * s0.getEndPoint()[2]}); t += dt; - GeoLib::Point* sub_seg_end_pnt(new GeoLib::Point{ + auto* sub_seg_end_pnt(new GeoLib::Point{ (1 - t) * s0.getBeginPoint()[0] + t * s0.getEndPoint()[0], (1 - t) * s0.getBeginPoint()[1] + t * s0.getEndPoint()[1], (1 - t) * s0.getBeginPoint()[2] + t * s0.getEndPoint()[2]}); diff --git a/Tests/MathLib/TestDenseGaussAlgorithm.cpp b/Tests/MathLib/TestDenseGaussAlgorithm.cpp index 42ad9e4c2e747222565f59d9e1891f95af2f56ee..f7a9703501ae4b6526639d66f3218124fe0d32f8 100644 --- a/Tests/MathLib/TestDenseGaussAlgorithm.cpp +++ b/Tests/MathLib/TestDenseGaussAlgorithm.cpp @@ -38,7 +38,7 @@ TEST(MathLib, DenseGaussAlgorithm) } // *** create solution vector, set all entries to 0.0 - double *x(new double[n_cols]); + auto* x(new double[n_cols]); std::fill(x,x+n_cols, 0.0); double *b0(mat * x); @@ -53,7 +53,7 @@ TEST(MathLib, DenseGaussAlgorithm) // right hand side and solution vector with random entries double *b3(mat * x); double *b3_copy(mat * x); - double *x3 (new double[n_cols]); + auto* x3(new double[n_cols]); std::generate(x3,x3+n_cols, std::rand); MathLib::GaussAlgorithm<MathLib::DenseMatrix<double, std::size_t>, double*> gauss; diff --git a/Tests/MeshLib/MeshProperties.cpp b/Tests/MeshLib/MeshProperties.cpp index db3a116880e77d69b8ef488ec879f82d9c76d849..9122dac48c0d0acba96f9fee2dac685fd13c7a00 100644 --- a/Tests/MeshLib/MeshProperties.cpp +++ b/Tests/MeshLib/MeshProperties.cpp @@ -145,17 +145,12 @@ TEST_F(MeshLibProperties, AddDoublePointerProperties) std::vector<std::size_t> prop_item2group_mapping(n_items); // create simple mat_group to index mapping for (std::size_t j(0); j<n_prop_val_groups; j++) { - std::size_t const lower( - static_cast<std::size_t>( - (static_cast<double>(j)/n_prop_val_groups)*n_items - ) - ); - std::size_t const upper( - static_cast<std::size_t>( - (static_cast<double>(j+1)/n_prop_val_groups)*n_items - ) - ); - for (std::size_t k(lower); k<upper; k++) { + auto const lower(static_cast<std::size_t>( + (static_cast<double>(j) / n_prop_val_groups) * n_items)); + auto const upper(static_cast<std::size_t>( + (static_cast<double>(j + 1) / n_prop_val_groups) * n_items)); + for (std::size_t k(lower); k < upper; k++) + { prop_item2group_mapping[k] = j; } } @@ -172,19 +167,14 @@ TEST_F(MeshLibProperties, AddDoublePointerProperties) } // check mapping to values for (std::size_t i(0); i<n_prop_val_groups; i++) { - std::size_t const lower( - static_cast<std::size_t>( - (static_cast<double>(i)/n_prop_val_groups)*n_items - ) - ); - std::size_t const upper( - static_cast<std::size_t>( - (static_cast<double>(i+1)/n_prop_val_groups)*n_items - ) - ); - for (std::size_t k(lower); k<upper; k++) { - ASSERT_NEAR(static_cast<double>(i+1), *(*group_properties)[k], - std::numeric_limits<double>::epsilon()); + auto const lower(static_cast<std::size_t>( + (static_cast<double>(i) / n_prop_val_groups) * n_items)); + auto const upper(static_cast<std::size_t>( + (static_cast<double>(i + 1) / n_prop_val_groups) * n_items)); + for (std::size_t k(lower); k < upper; k++) + { + ASSERT_NEAR(static_cast<double>(i + 1), *(*group_properties)[k], + std::numeric_limits<double>::epsilon()); } } @@ -213,17 +203,12 @@ TEST_F(MeshLibProperties, AddArrayPointerProperties) std::vector<std::size_t> prop_item2group_mapping(n_items); // create simple mat_group to index mapping for (std::size_t j(0); j<n_prop_val_groups; j++) { - std::size_t const lower( - static_cast<std::size_t>( - (static_cast<double>(j)/n_prop_val_groups)*n_items - ) - ); - std::size_t const upper( - static_cast<std::size_t>( - (static_cast<double>(j+1)/n_prop_val_groups)*n_items - ) - ); - for (std::size_t k(lower); k<upper; k++) { + auto const lower(static_cast<std::size_t>( + (static_cast<double>(j) / n_prop_val_groups) * n_items)); + auto const upper(static_cast<std::size_t>( + (static_cast<double>(j + 1) / n_prop_val_groups) * n_items)); + for (std::size_t k(lower); k < upper; k++) + { prop_item2group_mapping[k] = j; } } @@ -244,23 +229,18 @@ TEST_F(MeshLibProperties, AddArrayPointerProperties) } // check the mapping to values for (std::size_t i(0); i<n_prop_val_groups; i++) { - std::size_t const lower( - static_cast<std::size_t>( - (static_cast<double>(i)/n_prop_val_groups)*n_items - ) - ); - std::size_t const upper( - static_cast<std::size_t>( - (static_cast<double>(i+1)/n_prop_val_groups)*n_items - ) - ); - for (std::size_t k(lower); k<upper; k++) { + auto const lower(static_cast<std::size_t>( + (static_cast<double>(i) / n_prop_val_groups) * n_items)); + auto const upper(static_cast<std::size_t>( + (static_cast<double>(i + 1) / n_prop_val_groups) * n_items)); + for (std::size_t k(lower); k < upper; k++) + { ASSERT_NEAR(static_cast<double>(i), (*(*group_prop_vec)[k])[0], - std::numeric_limits<double>::epsilon()); - ASSERT_NEAR(static_cast<double>(i+1), (*(*group_prop_vec)[k])[1], - std::numeric_limits<double>::epsilon()); - ASSERT_NEAR(static_cast<double>(i+2), (*(*group_prop_vec)[k])[2], - std::numeric_limits<double>::epsilon()); + std::numeric_limits<double>::epsilon()); + ASSERT_NEAR(static_cast<double>(i + 1), (*(*group_prop_vec)[k])[1], + std::numeric_limits<double>::epsilon()); + ASSERT_NEAR(static_cast<double>(i + 2), (*(*group_prop_vec)[k])[2], + std::numeric_limits<double>::epsilon()); } } @@ -297,17 +277,12 @@ TEST_F(MeshLibProperties, AddVariousDifferentProperties) std::vector<std::size_t> prop_item2group_mapping(n_items); // create simple mat_group to index mapping for (std::size_t j(0); j<n_prop_val_groups; j++) { - std::size_t const lower( - static_cast<std::size_t>( - (static_cast<double>(j)/n_prop_val_groups)*n_items - ) - ); - std::size_t const upper( - static_cast<std::size_t>( - (static_cast<double>(j+1)/n_prop_val_groups)*n_items - ) - ); - for (std::size_t k(lower); k<upper; k++) { + auto const lower(static_cast<std::size_t>( + (static_cast<double>(j) / n_prop_val_groups) * n_items)); + auto const upper(static_cast<std::size_t>( + (static_cast<double>(j + 1) / n_prop_val_groups) * n_items)); + for (std::size_t k(lower); k < upper; k++) + { prop_item2group_mapping[k] = j; } } @@ -436,17 +411,12 @@ TEST_F(MeshLibProperties, CopyConstructor) std::vector<std::size_t> prop_item2group_mapping(n_items); // create simple mat_group to index mapping for (std::size_t j(0); j<n_prop_val_groups; j++) { - std::size_t const lower( - static_cast<std::size_t>( - (static_cast<double>(j)/n_prop_val_groups)*n_items - ) - ); - std::size_t const upper( - static_cast<std::size_t>( - (static_cast<double>(j+1)/n_prop_val_groups)*n_items - ) - ); - for (std::size_t k(lower); k<upper; k++) { + auto const lower(static_cast<std::size_t>( + (static_cast<double>(j) / n_prop_val_groups) * n_items)); + auto const upper(static_cast<std::size_t>( + (static_cast<double>(j + 1) / n_prop_val_groups) * n_items)); + for (std::size_t k(lower); k < upper; k++) + { prop_item2group_mapping[k] = j; } } diff --git a/Tests/MeshLib/TestAddLayerToMesh.cpp b/Tests/MeshLib/TestAddLayerToMesh.cpp index b27105f52326922182e911bdab46aa8a5965a8d6..47a74767081947b7940115bf238fb2869d862797 100644 --- a/Tests/MeshLib/TestAddLayerToMesh.cpp +++ b/Tests/MeshLib/TestAddLayerToMesh.cpp @@ -27,7 +27,8 @@ namespace AddLayerValidation { int const reduce_tests = (testNodeOrder) ? 0 : 1; - std::size_t const nErrorFlags (static_cast<std::size_t>(ElementErrorFlag::MaxValue)); + auto const nErrorFlags( + static_cast<std::size_t>(ElementErrorFlag::MaxValue)); ElementErrorFlag const flags[nErrorFlags] = {ElementErrorFlag::ZeroVolume, ElementErrorFlag::NonCoplanar, ElementErrorFlag::NonConvex, ElementErrorFlag::NodeOrder}; std::vector<ElementErrorCode> const codes (MeshLib::MeshValidation::testElementGeometry(mesh)); diff --git a/Tests/MeshLib/TestCoordinatesMappingLocal.cpp b/Tests/MeshLib/TestCoordinatesMappingLocal.cpp index 8bcb82a9b2b279a47b99c2030cc3b869c167cac0..5e85d62174ebf5e38a2d32071f9d602915fc341f 100644 --- a/Tests/MeshLib/TestCoordinatesMappingLocal.cpp +++ b/Tests/MeshLib/TestCoordinatesMappingLocal.cpp @@ -40,7 +40,7 @@ namespace TestLine2 std::unique_ptr<MeshLib::Line> createLine( std::array<double, 3> const& a, std::array<double, 3> const& b) { - MeshLib::Node** nodes = new MeshLib::Node*[e_nnodes]; + auto** nodes = new MeshLib::Node*[e_nnodes]; nodes[0] = new MeshLib::Node(a); nodes[1] = new MeshLib::Node(b); return std::unique_ptr<MeshLib::Line>{new MeshLib::Line(nodes)}; @@ -79,7 +79,7 @@ namespace TestQuad4 std::array<double, 3> const& a, std::array<double, 3> const& b, std::array<double, 3> const& c, std::array<double, 3> const& d) { - MeshLib::Node** nodes = new MeshLib::Node*[e_nnodes]; + auto** nodes = new MeshLib::Node*[e_nnodes]; nodes[0] = new MeshLib::Node(a); nodes[1] = new MeshLib::Node(b); nodes[2] = new MeshLib::Node(c); diff --git a/Tests/MeshLib/TestQuadraticMesh.cpp b/Tests/MeshLib/TestQuadraticMesh.cpp index 5553a5727afd3638262c8999525deec93f17e3b3..2beafb3c85d88a77003a465cf3551574f2af74cd 100644 --- a/Tests/MeshLib/TestQuadraticMesh.cpp +++ b/Tests/MeshLib/TestQuadraticMesh.cpp @@ -119,7 +119,7 @@ TEST(MeshLib, QuadraticOrderMesh_LineQuad) std::vector<GeoLib::Point*> pnts; pnts.push_back(new GeoLib::Point(0,0.5,0,0)); pnts.push_back(new GeoLib::Point(1,0.5,0,1)); - GeoLib::Polyline* ply = new GeoLib::Polyline(pnts); + auto* ply = new GeoLib::Polyline(pnts); ply->addPoint(0); ply->addPoint(1); std::unique_ptr<std::vector<GeoLib::Polyline*>> plys(new std::vector<GeoLib::Polyline*>()); diff --git a/Tests/NumLib/CoordinatesMappingTestData/TestHex8.h b/Tests/NumLib/CoordinatesMappingTestData/TestHex8.h index 5072b65d4fb701d3587509fd22803910e2d79b61..b1a5f8ec7cd13f7894011a78decad22c7425b100 100644 --- a/Tests/NumLib/CoordinatesMappingTestData/TestHex8.h +++ b/Tests/NumLib/CoordinatesMappingTestData/TestHex8.h @@ -42,7 +42,7 @@ class TestHex8 // element shape identical to that in natural coordinates (see ShapeHex8.h) MeshLib::Hex* createNaturalShape() { - MeshLib::Node** nodes = new MeshLib::Node*[e_nnodes]; + auto** nodes = new MeshLib::Node*[e_nnodes]; nodes[0] = new MeshLib::Node(-1.0, -1.0, -1.0); nodes[1] = new MeshLib::Node( 1.0, -1.0, -1.0); nodes[2] = new MeshLib::Node( 1.0, 1.0, -1.0); @@ -58,7 +58,7 @@ class TestHex8 MeshLib::Hex* createIrregularShape() { // two times longer in z direction than the natural - MeshLib::Node** nodes = new MeshLib::Node*[e_nnodes]; + auto** nodes = new MeshLib::Node*[e_nnodes]; nodes[0] = new MeshLib::Node(-1.0, -1.0, -1.0); nodes[1] = new MeshLib::Node( 1.0, -1.0, -1.0); nodes[2] = new MeshLib::Node( 1.0, 1.0, -1.0); @@ -73,7 +73,7 @@ class TestHex8 // invalid case: clock wise node ordering MeshLib::Hex* createClockWise() { - MeshLib::Node** nodes = new MeshLib::Node*[e_nnodes]; + auto** nodes = new MeshLib::Node*[e_nnodes]; nodes[0] = new MeshLib::Node(-1.0, -1.0, -1.0); nodes[3] = new MeshLib::Node( 1.0, -1.0, -1.0); nodes[2] = new MeshLib::Node( 1.0, 1.0, -1.0); @@ -88,7 +88,7 @@ class TestHex8 // invalid case: zero volume MeshLib::Hex* createZeroVolume() { - MeshLib::Node** nodes = new MeshLib::Node*[e_nnodes]; + auto** nodes = new MeshLib::Node*[e_nnodes]; nodes[0] = new MeshLib::Node(-1.0, -1.0, 1.0); nodes[1] = new MeshLib::Node( 1.0, -1.0, 1.0); nodes[2] = new MeshLib::Node( 1.0, 1.0, 1.0); diff --git a/Tests/NumLib/CoordinatesMappingTestData/TestLine2.h b/Tests/NumLib/CoordinatesMappingTestData/TestLine2.h index a9ec867d8eb455cac4fd6be3ed394d82be9ee7f8..3d9ad76710cf511d12c375bdfebfa61505d24a63 100644 --- a/Tests/NumLib/CoordinatesMappingTestData/TestLine2.h +++ b/Tests/NumLib/CoordinatesMappingTestData/TestLine2.h @@ -42,7 +42,7 @@ public: // element shape identical to that in natural coordinates (see ShapeLine2.h) static MeshLib::Line* createNaturalShape() { - MeshLib::Node** nodes = new MeshLib::Node*[e_nnodes]; + auto** nodes = new MeshLib::Node*[e_nnodes]; nodes[0] = new MeshLib::Node(-1.0, 0.0, 0.0); nodes[1] = new MeshLib::Node( 1.0, 0.0, 0.0); return new MeshLib::Line(nodes); @@ -52,7 +52,7 @@ public: MeshLib::Line* createIrregularShape() { // two times longer than the natural - MeshLib::Node** nodes = new MeshLib::Node*[e_nnodes]; + auto** nodes = new MeshLib::Node*[e_nnodes]; nodes[0] = new MeshLib::Node(-2.0, 0.0, 0.0); nodes[1] = new MeshLib::Node( 2.0, 0.0, 0.0); return new MeshLib::Line(nodes); @@ -61,7 +61,7 @@ public: // invalid case: clock wise node ordering MeshLib::Line* createClockWise() { - MeshLib::Node** nodes = new MeshLib::Node*[e_nnodes]; + auto** nodes = new MeshLib::Node*[e_nnodes]; nodes[1] = new MeshLib::Node(-1.0, 0.0, 0.0); nodes[0] = new MeshLib::Node( 1.0, 0.0, 0.0); return new MeshLib::Line(nodes); @@ -70,7 +70,7 @@ public: // invalid case: zero volume MeshLib::Line* createZeroVolume() { - MeshLib::Node** nodes = new MeshLib::Node*[e_nnodes]; + auto** nodes = new MeshLib::Node*[e_nnodes]; nodes[0] = new MeshLib::Node(0.0, 0.0, 0.0); nodes[1] = new MeshLib::Node(0.0, 0.0, 0.0); return new MeshLib::Line(nodes); @@ -79,7 +79,7 @@ public: // 1.5d line static MeshLib::Line* createY() { - MeshLib::Node** nodes = new MeshLib::Node*[e_nnodes]; + auto** nodes = new MeshLib::Node*[e_nnodes]; nodes[0] = new MeshLib::Node(0.0, -1.0, 0.0); nodes[1] = new MeshLib::Node(0.0, 1.0, 0.0); return new MeshLib::Line(nodes); diff --git a/Tests/NumLib/CoordinatesMappingTestData/TestLine3.h b/Tests/NumLib/CoordinatesMappingTestData/TestLine3.h index f15a1c8ce48d1604b86b4062e7492691c269823a..a94106e543803d82d2a42bc00fe257e06af8bd6c 100644 --- a/Tests/NumLib/CoordinatesMappingTestData/TestLine3.h +++ b/Tests/NumLib/CoordinatesMappingTestData/TestLine3.h @@ -41,7 +41,7 @@ public: // element shape identical to that in natural coordinates (see ShapeLine3.h) static MeshLib::Line3* createNaturalShape() { - MeshLib::Node** nodes = new MeshLib::Node*[e_nnodes]; + auto** nodes = new MeshLib::Node*[e_nnodes]; nodes[0] = new MeshLib::Node(-1.0, 0.0, 0.0); nodes[1] = new MeshLib::Node(1.0, 0.0, 0.0); nodes[2] = new MeshLib::Node(0.0, 0.0, 0.0); @@ -52,7 +52,7 @@ public: MeshLib::Line3* createIrregularShape() { // two times longer than the natural - MeshLib::Node** nodes = new MeshLib::Node*[e_nnodes]; + auto** nodes = new MeshLib::Node*[e_nnodes]; nodes[0] = new MeshLib::Node(-2.0, 0.0, 0.0); nodes[1] = new MeshLib::Node(2.0, 0.0, 0.0); nodes[2] = new MeshLib::Node(0.0, 0.0, 0.0); @@ -62,7 +62,7 @@ public: // invalid case: clock wise node ordering MeshLib::Line3* createClockWise() { - MeshLib::Node** nodes = new MeshLib::Node*[e_nnodes]; + auto** nodes = new MeshLib::Node*[e_nnodes]; nodes[0] = new MeshLib::Node(1.0, 0.0, 0.0); nodes[1] = new MeshLib::Node(-1.0, 0.0, 0.0); nodes[2] = new MeshLib::Node(0.0, 0.0, 0.0); @@ -72,7 +72,7 @@ public: // invalid case: zero volume MeshLib::Line3* createZeroVolume() { - MeshLib::Node** nodes = new MeshLib::Node*[e_nnodes]; + auto** nodes = new MeshLib::Node*[e_nnodes]; nodes[0] = new MeshLib::Node(0.0, 0.0, 0.0); nodes[1] = new MeshLib::Node(0.0, 0.0, 0.0); nodes[2] = new MeshLib::Node(0.0, 0.0, 0.0); @@ -82,7 +82,7 @@ public: // 1.5d line static MeshLib::Line3* createY() { - MeshLib::Node** nodes = new MeshLib::Node*[e_nnodes]; + auto** nodes = new MeshLib::Node*[e_nnodes]; nodes[0] = new MeshLib::Node(0.0, -1.0, 0.0); nodes[1] = new MeshLib::Node(0.0, 1.0, 0.0); nodes[2] = new MeshLib::Node(0.0, 0.0, 0.0); diff --git a/Tests/NumLib/CoordinatesMappingTestData/TestQuad4.h b/Tests/NumLib/CoordinatesMappingTestData/TestQuad4.h index 2e66f0f8d7b0e03fb34c39abe8f7e90e04075e4f..7b6a989688aa1cb8d672fc121123080448b69093 100644 --- a/Tests/NumLib/CoordinatesMappingTestData/TestQuad4.h +++ b/Tests/NumLib/CoordinatesMappingTestData/TestQuad4.h @@ -42,7 +42,7 @@ class TestQuad4 // element shape identical to that in natural coordinates MeshLib::Quad* createNaturalShape() { - MeshLib::Node** nodes = new MeshLib::Node*[e_nnodes]; + auto** nodes = new MeshLib::Node*[e_nnodes]; nodes[0] = new MeshLib::Node( 1.0, 1.0, 0.0); nodes[1] = new MeshLib::Node(-1.0, 1.0, 0.0); nodes[2] = new MeshLib::Node(-1.0, -1.0, 0.0); @@ -53,7 +53,7 @@ class TestQuad4 // element having irregular or skew shape MeshLib::Quad* createIrregularShape() { - MeshLib::Node** nodes = new MeshLib::Node*[e_nnodes]; + auto** nodes = new MeshLib::Node*[e_nnodes]; nodes[0] = new MeshLib::Node(-0.5, -0.5, 0.0); nodes[1] = new MeshLib::Node( 0.6, -0.6, 0.0); nodes[2] = new MeshLib::Node( 0.5, 0.4, 0.0); @@ -64,7 +64,7 @@ class TestQuad4 // invalid case: clock wise node ordering MeshLib::Quad* createClockWise() { - MeshLib::Node** nodes = new MeshLib::Node*[e_nnodes]; + auto** nodes = new MeshLib::Node*[e_nnodes]; nodes[0] = new MeshLib::Node( 1.0, 1.0, 0.0); nodes[3] = new MeshLib::Node(-1.0, 1.0, 0.0); nodes[2] = new MeshLib::Node(-1.0, -1.0, 0.0); @@ -75,7 +75,7 @@ class TestQuad4 // invalid case: zero area MeshLib::Quad* createZeroVolume() { - MeshLib::Node** nodes = new MeshLib::Node*[e_nnodes]; + auto** nodes = new MeshLib::Node*[e_nnodes]; nodes[0] = new MeshLib::Node( 1.0, 1.0, 0.0); nodes[1] = new MeshLib::Node(-1.0, 1.0, 0.0); nodes[2] = new MeshLib::Node(-1.0, 1.0, 0.0); diff --git a/Tests/NumLib/CoordinatesMappingTestData/TestTri3.h b/Tests/NumLib/CoordinatesMappingTestData/TestTri3.h index 84269f1a474d11a301ed1b1aeea2c7aa77dd9817..2bf74cef8e54dcbd5a9d824e3b62c76ae9e7d9c8 100644 --- a/Tests/NumLib/CoordinatesMappingTestData/TestTri3.h +++ b/Tests/NumLib/CoordinatesMappingTestData/TestTri3.h @@ -42,7 +42,7 @@ class TestTri3 // element having shape identical to that in natural coordinates MeshLib::Tri* createNaturalShape() { - MeshLib::Node** nodes = new MeshLib::Node*[e_nnodes]; + auto** nodes = new MeshLib::Node*[e_nnodes]; nodes[0] = new MeshLib::Node( 0.0, 0.0, 0.0); nodes[1] = new MeshLib::Node( 1.0, 0.0, 0.0); nodes[2] = new MeshLib::Node( 0.0, 1.0, 0.0); @@ -52,7 +52,7 @@ class TestTri3 // element having irregular or skew shape MeshLib::Tri* createIrregularShape() { - MeshLib::Node** nodes = new MeshLib::Node*[e_nnodes]; + auto** nodes = new MeshLib::Node*[e_nnodes]; nodes[0] = new MeshLib::Node( 0.1, 0.1, 0.0); nodes[1] = new MeshLib::Node( 2.0, -0.6, 0.0); nodes[2] = new MeshLib::Node( 1.5, 0.4, 0.0); @@ -62,7 +62,7 @@ class TestTri3 // invalid case: clock wise node ordering MeshLib::Tri* createClockWise() { - MeshLib::Node** nodes = new MeshLib::Node*[e_nnodes]; + auto** nodes = new MeshLib::Node*[e_nnodes]; nodes[0] = new MeshLib::Node( 0.0, 0.0, 0.0); nodes[2] = new MeshLib::Node( 1.0, 0.0, 0.0); nodes[1] = new MeshLib::Node( 0.0, 1.0, 0.0); @@ -72,7 +72,7 @@ class TestTri3 // invalid case: zero area MeshLib::Tri* createZeroVolume() { - MeshLib::Node** nodes = new MeshLib::Node*[e_nnodes]; + auto** nodes = new MeshLib::Node*[e_nnodes]; nodes[0] = new MeshLib::Node( 0.0, 0.0, 0.0); nodes[1] = new MeshLib::Node( 1.0, 0.0, 0.0); nodes[2] = new MeshLib::Node( 1.0, 0.0, 0.0); diff --git a/Tests/NumLib/FeTestData/TestFeHEX8.h b/Tests/NumLib/FeTestData/TestFeHEX8.h index 1792de0bd46aa711e19bbbcf0bdb8f7b6b72df2b..6a854418ad3322c989cd085bcc5731ebc436a844 100644 --- a/Tests/NumLib/FeTestData/TestFeHEX8.h +++ b/Tests/NumLib/FeTestData/TestFeHEX8.h @@ -38,7 +38,7 @@ public: MeshLib::Hex* createMeshElement() { // cubic - MeshLib::Node** nodes = new MeshLib::Node*[e_nnodes]; + auto** nodes = new MeshLib::Node*[e_nnodes]; nodes[0] = new MeshLib::Node(0.0, 0.0, 0.0); nodes[1] = new MeshLib::Node(1.0, 0.0, 0.0); nodes[2] = new MeshLib::Node(1.0, 1.0, 0.0); diff --git a/Tests/NumLib/FeTestData/TestFeLINE2.h b/Tests/NumLib/FeTestData/TestFeLINE2.h index b921646dcfaecb6a77777927a36ba78da178ae9b..43303648ad790f5f55e37c25707679520924ce33 100644 --- a/Tests/NumLib/FeTestData/TestFeLINE2.h +++ b/Tests/NumLib/FeTestData/TestFeLINE2.h @@ -37,7 +37,7 @@ public: /// create a mesh element MeshLib::Line* createMeshElement() { - MeshLib::Node** nodes = new MeshLib::Node*[e_nnodes]; + auto** nodes = new MeshLib::Node*[e_nnodes]; nodes[0] = new MeshLib::Node(0.0, 0.0, 0.0); nodes[1] = new MeshLib::Node(1.0, 0.0, 0.0); return new MeshLib::Line(nodes); diff --git a/Tests/NumLib/FeTestData/TestFeLINE2Y.h b/Tests/NumLib/FeTestData/TestFeLINE2Y.h index 31e7c8a2dcc8e9fec1a0d2bc8a60dc5ee3ade70c..a82edca2e70fb523d94080feafc800436f982696 100644 --- a/Tests/NumLib/FeTestData/TestFeLINE2Y.h +++ b/Tests/NumLib/FeTestData/TestFeLINE2Y.h @@ -36,7 +36,7 @@ public: /// create a mesh element MeshLib::Line* createMeshElement() { - MeshLib::Node** nodes = new MeshLib::Node*[e_nnodes]; + auto** nodes = new MeshLib::Node*[e_nnodes]; nodes[0] = new MeshLib::Node(0.0, 0.0, 0.0); nodes[1] = new MeshLib::Node(0.0, 1.0, 0.0); return new MeshLib::Line(nodes); diff --git a/Tests/NumLib/FeTestData/TestFeLINE3.h b/Tests/NumLib/FeTestData/TestFeLINE3.h index 7c396003c112f79aed09405932becf71428fa477..68ebe39e125b0ebb1a6b6fb8486210a79c048d29 100644 --- a/Tests/NumLib/FeTestData/TestFeLINE3.h +++ b/Tests/NumLib/FeTestData/TestFeLINE3.h @@ -36,7 +36,7 @@ public: /// create a mesh element MeshElementType* createMeshElement() { - MeshLib::Node** nodes = new MeshLib::Node*[e_nnodes]; + auto** nodes = new MeshLib::Node*[e_nnodes]; nodes[0] = new MeshLib::Node(0.0, 0.0, 0.0); nodes[1] = new MeshLib::Node(1.0, 0.0, 0.0); nodes[2] = new MeshLib::Node(0.5, 0.0, 0.0); diff --git a/Tests/NumLib/FeTestData/TestFePRISM6.h b/Tests/NumLib/FeTestData/TestFePRISM6.h index 114ff74de3dd1e95ce1e94fac41be496b25f261d..838d5b6fd5d88fe1d036b23d45915039f6a29b9d 100644 --- a/Tests/NumLib/FeTestData/TestFePRISM6.h +++ b/Tests/NumLib/FeTestData/TestFePRISM6.h @@ -37,7 +37,7 @@ public: MeshElementType* createMeshElement() { // cubic - MeshLib::Node** nodes = new MeshLib::Node*[e_nnodes]; + auto** nodes = new MeshLib::Node*[e_nnodes]; nodes[0] = new MeshLib::Node(0.0, 0.0, 0.0); nodes[1] = new MeshLib::Node(0.5, 0.0, 0.0); nodes[2] = new MeshLib::Node(0.5, 0.5, 0.0); diff --git a/Tests/NumLib/FeTestData/TestFePYRA5.h b/Tests/NumLib/FeTestData/TestFePYRA5.h index 05c6b34b944684d99ece2e74adc35be3d7b23368..92851ec0b55fad2357d39969f47889aa17feaf22 100644 --- a/Tests/NumLib/FeTestData/TestFePYRA5.h +++ b/Tests/NumLib/FeTestData/TestFePYRA5.h @@ -37,7 +37,7 @@ public: MeshElementType* createMeshElement() { // cubic - MeshLib::Node** nodes = new MeshLib::Node*[e_nnodes]; + auto** nodes = new MeshLib::Node*[e_nnodes]; nodes[0] = new MeshLib::Node(0.0, 0.0, 0.5); nodes[1] = new MeshLib::Node(0.0, 0.0, 0.0); nodes[2] = new MeshLib::Node(0.0, 0.5, 0.0); diff --git a/Tests/NumLib/FeTestData/TestFeQUAD4.h b/Tests/NumLib/FeTestData/TestFeQUAD4.h index f67805edfe6536bb8f75afd214100bd916d59623..40ce1863e520703485c6c3fb143389c57a64bc04 100644 --- a/Tests/NumLib/FeTestData/TestFeQUAD4.h +++ b/Tests/NumLib/FeTestData/TestFeQUAD4.h @@ -38,7 +38,7 @@ public: MeshLib::Quad* createMeshElement() { // square - MeshLib::Node** nodes = new MeshLib::Node*[e_nnodes]; + auto** nodes = new MeshLib::Node*[e_nnodes]; nodes[0] = new MeshLib::Node(0.0, 0.0, 0.0); nodes[1] = new MeshLib::Node(1.0, 0.0, 0.0); nodes[2] = new MeshLib::Node(1.0, 1.0, 0.0); diff --git a/Tests/NumLib/FeTestData/TestFeTET4.h b/Tests/NumLib/FeTestData/TestFeTET4.h index 36a58ab0d6b383239e594f63a5ceae0a8641aa09..79d0b397c1c45488d662773d7718a5d305abecce 100644 --- a/Tests/NumLib/FeTestData/TestFeTET4.h +++ b/Tests/NumLib/FeTestData/TestFeTET4.h @@ -36,7 +36,7 @@ public: /// create a mesh element MeshElementType* createMeshElement() { - MeshLib::Node** nodes = new MeshLib::Node*[e_nnodes]; + auto** nodes = new MeshLib::Node*[e_nnodes]; nodes[0] = new MeshLib::Node(0.0, 0.0, 0.0); nodes[1] = new MeshLib::Node(0.5, 0.5, 0.5); nodes[2] = new MeshLib::Node(0.5, 0.0, 0.5); diff --git a/Tests/NumLib/FeTestData/TestFeTRI3.h b/Tests/NumLib/FeTestData/TestFeTRI3.h index c118ba23ea517fea838c5fcf5b479af4c3670477..1e39f9a30e0702b75681f7ecbb56a1a4c9e9b174 100644 --- a/Tests/NumLib/FeTestData/TestFeTRI3.h +++ b/Tests/NumLib/FeTestData/TestFeTRI3.h @@ -37,10 +37,10 @@ public: /// create a mesh element MeshElementType* createMeshElement() { - MeshLib::Node** nodes = new MeshLib::Node*[e_nnodes]; - nodes[0] = new MeshLib::Node( 0.0, 0.0, 0.0); - nodes[1] = new MeshLib::Node( 1.0, 0.0, 0.0); - nodes[2] = new MeshLib::Node( 0.0, 1.0, 0.0); + auto** nodes = new MeshLib::Node*[e_nnodes]; + nodes[0] = new MeshLib::Node(0.0, 0.0, 0.0); + nodes[1] = new MeshLib::Node(1.0, 0.0, 0.0); + nodes[2] = new MeshLib::Node(0.0, 1.0, 0.0); return new MeshLib::Tri(nodes); } diff --git a/Tests/NumLib/TestDistribution.cpp b/Tests/NumLib/TestDistribution.cpp index 347bfd46cd0269d345202b39e46667631a19898e..0af55d1d0351b14477e789751b120af1d8a8b24b 100644 --- a/Tests/NumLib/TestDistribution.cpp +++ b/Tests/NumLib/TestDistribution.cpp @@ -51,7 +51,7 @@ public: _ply0->addPoint(1); plys->push_back(_ply0); - GeoLib::Polyline* ply1 = new GeoLib::Polyline(*pnts); + auto* ply1 = new GeoLib::Polyline(*pnts); ply1->addPoint(0); ply1->addPoint(1); ply1->addPoint(2); @@ -108,7 +108,7 @@ public: _ply0->addPoint(0); _ply0->addPoint(4); plys->push_back(_ply0); - GeoLib::Polyline* ply1 = new GeoLib::Polyline(*pnts); // polygon for left surface + auto* ply1 = new GeoLib::Polyline(*pnts); // polygon for left surface ply1->addPoint(0); ply1->addPoint(3); ply1->addPoint(7); diff --git a/Tests/ProcessLib/TestLIE.cpp b/Tests/ProcessLib/TestLIE.cpp index 20c00c4243544d8bfb5c1a781920af9dfb5c007b..d9fb7f36dcc9197b8b1504efc658cb08deea7157 100644 --- a/Tests/ProcessLib/TestLIE.cpp +++ b/Tests/ProcessLib/TestLIE.cpp @@ -26,28 +26,26 @@ namespace std::unique_ptr<MeshLib::Mesh> createTriangle( std::array<std::array<double, 3>, 3> const& points) { - MeshLib::Node** nodes = new MeshLib::Node*[3]; + auto** nodes = new MeshLib::Node*[3]; for (int i = 0; i < points.size(); ++i) nodes[i] = new MeshLib::Node(points[i]); MeshLib::Element* e = new MeshLib::Tri(nodes); return std::unique_ptr<MeshLib::Mesh>(new MeshLib::Mesh( - "", - std::vector<MeshLib::Node*>{nodes[0], nodes[1], nodes[2]}, + "", std::vector<MeshLib::Node*>{nodes[0], nodes[1], nodes[2]}, std::vector<MeshLib::Element*>{e})); } std::unique_ptr<MeshLib::Mesh> createLine( std::array<std::array<double, 3>, 2> const& points) { - MeshLib::Node** nodes = new MeshLib::Node*[2]; + auto** nodes = new MeshLib::Node*[2]; for (int i = 0; i < points.size(); ++i) nodes[i] = new MeshLib::Node(points[i]); MeshLib::Element* e = new MeshLib::Line(nodes); return std::unique_ptr<MeshLib::Mesh>( - new MeshLib::Mesh("", - std::vector<MeshLib::Node*>{nodes[0], nodes[1]}, + new MeshLib::Mesh("", std::vector<MeshLib::Node*>{nodes[0], nodes[1]}, std::vector<MeshLib::Element*>{e})); }