From 9bb17731e74f2e9cddc314be4f0cefd45fe905b7 Mon Sep 17 00:00:00 2001 From: Thomas Fischer <thomas.fischer@ufz.de> Date: Wed, 10 Oct 2012 11:52:21 +0200 Subject: [PATCH] refactored MeshLib::Element::getType() to MeshLib::Element::getGeoType() --- FileIO/Legacy/MeshIO.cpp | 4 ++-- FileIO/XmlIO/VTKInterface.cpp | 2 +- Gui/DataView/ElementTreeModel.cpp | 2 +- Gui/DataView/MshLayerMapper.cpp | 6 +++--- Gui/DataView/MshModel.cpp | 2 +- Gui/VtkVis/VtkMeshSource.cpp | 4 ++-- MeshLib/Elements/Element.cpp | 2 +- MeshLib/Elements/Element.h | 2 +- MeshLib/Elements/TemplateEdge.h | 2 +- MeshLib/Elements/TemplateHex.h | 2 +- MeshLib/Elements/TemplatePrism.h | 2 +- MeshLib/Elements/TemplatePyramid.h | 2 +- MeshLib/Elements/TemplateQuad.h | 2 +- MeshLib/Elements/TemplateTet.h | 2 +- MeshLib/Elements/TemplateTri.h | 2 +- MeshLib/Mesh.cpp | 4 ++-- MeshLib/MeshQuality/MeshQualityChecker.cpp | 2 +- MeshLib/MeshQuality/MeshQualityEquiAngleSkew.cpp | 2 +- MeshLib/MeshQuality/MeshQualityShortestLongestRatio.cpp | 4 ++-- MeshLib/MeshQuality/MeshQualityVolume.cpp | 2 +- MeshLib/MshEditor.cpp | 6 +++--- 21 files changed, 29 insertions(+), 29 deletions(-) diff --git a/FileIO/Legacy/MeshIO.cpp b/FileIO/Legacy/MeshIO.cpp index 8ef075314bc..164a01515a2 100644 --- a/FileIO/Legacy/MeshIO.cpp +++ b/FileIO/Legacy/MeshIO.cpp @@ -251,7 +251,7 @@ void MeshIO::writeElementsExceptLines(std::vector<MeshLib::Element*> const& ele_ size_t n_elements(0); for (size_t i(0); i < ele_vector_size; i++) { - if ((ele_vec[i])->getType() == MshElemType::EDGE) { + if ((ele_vec[i])->getGeoType() == MshElemType::EDGE) { non_line_element[i] = false; non_null_element[i] = false; } else { @@ -265,7 +265,7 @@ void MeshIO::writeElementsExceptLines(std::vector<MeshLib::Element*> const& ele_ out << n_elements << std::endl; for (size_t i(0), k(0); i < ele_vector_size; i++) { if (non_line_element[i] && non_null_element[i]) { - out << k << " " << ele_vec[i]->getValue() << " " << MshElemType2String(ele_vec[i]->getType()) << " "; + out << k << " " << ele_vec[i]->getValue() << " " << MshElemType2String(ele_vec[i]->getGeoType()) << " "; for(size_t j = 0; j < ele_vec[i]->getNNodes()-1; j++) out << ele_vec[i]->getNode(j)->getID() << " "; out << ele_vec[i]->getNode(ele_vec[i]->getNNodes()-1)->getID() << std::endl; diff --git a/FileIO/XmlIO/VTKInterface.cpp b/FileIO/XmlIO/VTKInterface.cpp index b483a1e71be..649343648c0 100644 --- a/FileIO/XmlIO/VTKInterface.cpp +++ b/FileIO/XmlIO/VTKInterface.cpp @@ -408,7 +408,7 @@ int VTKInterface::write(std::ostream& stream) oss << std::endl; offset_count += nElemNodes; offstream << offset_count << " "; - typestream << this->getVTKElementID(element->getType()) << " "; + typestream << this->getVTKElementID(element->getGeoType()) << " "; } oss << data_array_close; offstream << std::endl << data_array_close; diff --git a/Gui/DataView/ElementTreeModel.cpp b/Gui/DataView/ElementTreeModel.cpp index 34ea1e568a1..974f0a4aa8f 100644 --- a/Gui/DataView/ElementTreeModel.cpp +++ b/Gui/DataView/ElementTreeModel.cpp @@ -43,7 +43,7 @@ void ElementTreeModel::setElement(const MeshLib::Mesh* grid, const size_t elem_i _rootItem->appendChild(elemItem); QList<QVariant> typeData; - typeData << "Element Type: " << QString::fromStdString(MshElemType2String(elem->getType())); + typeData << "Element Type: " << QString::fromStdString(MshElemType2String(elem->getGeoType())); TreeItem* typeItem = new TreeItem(typeData, elemItem); elemItem->appendChild(typeItem); diff --git a/Gui/DataView/MshLayerMapper.cpp b/Gui/DataView/MshLayerMapper.cpp index 612429a6a63..ceb29d87606 100644 --- a/Gui/DataView/MshLayerMapper.cpp +++ b/Gui/DataView/MshLayerMapper.cpp @@ -74,15 +74,15 @@ MeshLib::Mesh* MshLayerMapper::CreateLayers(const MeshLib::Mesh* mesh, unsigned e_nodes[j] = new_nodes[node_id+nNodes]; e_nodes[j+nElemNodes] = new_nodes[node_id]; } - if (sfc_elem->getType() == MshElemType::TRIANGLE) // extrude triangles to prism + if (sfc_elem->getGeoType() == MshElemType::TRIANGLE) // extrude triangles to prism new_elems[elem_offset+i] = new MeshLib::Prism(e_nodes, mat_id); - else if (sfc_elem->getType() == MshElemType::QUAD) // extrude quads to hexes + else if (sfc_elem->getGeoType() == MshElemType::QUAD) // extrude quads to hexes new_elems[elem_offset+i] = new MeshLib::Hex(e_nodes, mat_id); } else { std::cout << "Warning in MshLayerMapper::CreateLayers() - Method can only handle 2D mesh elements ..." << std::endl; - std::cout << "Skipping Element " << i << " of type \"" << MshElemType2String(sfc_elem->getType()) << "\"." << std::endl; + std::cout << "Skipping Element " << i << " of type \"" << MshElemType2String(sfc_elem->getGeoType()) << "\"." << std::endl; } } } diff --git a/Gui/DataView/MshModel.cpp b/Gui/DataView/MshModel.cpp index 34495e5a6ad..d215e1350a7 100644 --- a/Gui/DataView/MshModel.cpp +++ b/Gui/DataView/MshModel.cpp @@ -68,7 +68,7 @@ void MshModel::addMeshObject(const MeshLib::Mesh* mesh) for (size_t i = 0; i < nElems; i++) { const MeshLib::Element* current_element (elems[i]); - MshElemType::type t (current_element->getType()); + MshElemType::type t (current_element->getGeoType()); QList<QVariant> elemData; if (t != elem_type) { diff --git a/Gui/VtkVis/VtkMeshSource.cpp b/Gui/VtkVis/VtkMeshSource.cpp index ea0a73a5fce..8114b6496a2 100644 --- a/Gui/VtkVis/VtkMeshSource.cpp +++ b/Gui/VtkVis/VtkMeshSource.cpp @@ -129,7 +129,7 @@ int VtkMeshSource::RequestData( vtkInformation* request, int type(0); const MeshLib::Element* elem (elems[i]); - switch (elem->getType()) + switch (elem->getGeoType()) { case MshElemType::EDGE: type = 3; @@ -153,7 +153,7 @@ int VtkMeshSource::RequestData( vtkInformation* request, type = 14; break; default: // if none of the above can be applied - std::cout << "Error in VtkMeshSource::RequestData() - Unknown element type " << MshElemType2String(elem->getType()) << "." << std::endl; + std::cout << "Error in VtkMeshSource::RequestData() - Unknown element type " << MshElemType2String(elem->getGeoType()) << "." << std::endl; return 0; } diff --git a/MeshLib/Elements/Element.cpp b/MeshLib/Elements/Element.cpp index ca7bc18a3c2..e19affcec61 100644 --- a/MeshLib/Elements/Element.cpp +++ b/MeshLib/Elements/Element.cpp @@ -117,7 +117,7 @@ const Node* Element::getNode(unsigned i) const { if (i < getNNodes()) return _nodes[i]; - std::cerr << "Error in MeshLib::Element::getNode() - Index " << i << " in " << MshElemType2String(getType()) << " does not exist." << std::endl; + std::cerr << "Error in MeshLib::Element::getNode() - Index " << i << " in " << MshElemType2String(getGeoType()) << " does not exist." << std::endl; return NULL; } diff --git a/MeshLib/Elements/Element.h b/MeshLib/Elements/Element.h index 2d691317198..6fef4bf7fe4 100644 --- a/MeshLib/Elements/Element.h +++ b/MeshLib/Elements/Element.h @@ -114,7 +114,7 @@ public: unsigned getNodeIndex(unsigned i) const; /// Get the type of the mesh element (as a MshElemType-enum). - virtual MshElemType::type getType() const = 0; + virtual MshElemType::type getGeoType() const = 0; /// Get the value for this element. unsigned getValue() const { return _value; }; diff --git a/MeshLib/Elements/TemplateEdge.h b/MeshLib/Elements/TemplateEdge.h index 234173c5272..47386c34916 100644 --- a/MeshLib/Elements/TemplateEdge.h +++ b/MeshLib/Elements/TemplateEdge.h @@ -82,7 +82,7 @@ public: * Method returns the type of the element. In this case EDGE will be returned. * @return MshElemType::EDGE */ - virtual MshElemType::type getType() const { return MshElemType::EDGE; } + virtual MshElemType::type getGeoType() const { return MshElemType::EDGE; } /// Returns true if these two indices form an edge and false otherwise bool isEdge(unsigned idx1, unsigned idx2) const diff --git a/MeshLib/Elements/TemplateHex.h b/MeshLib/Elements/TemplateHex.h index a42b9f7400e..0a67ccf4262 100644 --- a/MeshLib/Elements/TemplateHex.h +++ b/MeshLib/Elements/TemplateHex.h @@ -80,7 +80,7 @@ public: * Method returns the type of the element. In this case HEXAHEDRON will be returned. * @return MshElemType::HEXAHEDRON */ - virtual MshElemType::type getType() const { return MshElemType::HEXAHEDRON; } + virtual MshElemType::type getGeoType() const { return MshElemType::HEXAHEDRON; } /// Returns true if these two indices form an edge and false otherwise bool isEdge(unsigned i, unsigned j) const; diff --git a/MeshLib/Elements/TemplatePrism.h b/MeshLib/Elements/TemplatePrism.h index 2a93ae4db41..f9522d505e8 100644 --- a/MeshLib/Elements/TemplatePrism.h +++ b/MeshLib/Elements/TemplatePrism.h @@ -78,7 +78,7 @@ public: * Method returns the type of the element. In this case PRISM will be returned. * @return MshElemType::PRISM */ - virtual MshElemType::type getType() const { return MshElemType::PRISM; } + virtual MshElemType::type getGeoType() const { return MshElemType::PRISM; } /// Returns true if these two indeces form an edge and false otherwise bool isEdge(unsigned i, unsigned j) const; diff --git a/MeshLib/Elements/TemplatePyramid.h b/MeshLib/Elements/TemplatePyramid.h index 225ec57004d..58503f9d64b 100644 --- a/MeshLib/Elements/TemplatePyramid.h +++ b/MeshLib/Elements/TemplatePyramid.h @@ -76,7 +76,7 @@ public: * Method returns the type of the element. In this case PYRAMID will be returned. * @return MshElemType::PYRAMID */ - virtual MshElemType::type getType() const { return MshElemType::PYRAMID; } + virtual MshElemType::type getGeoType() const { return MshElemType::PYRAMID; } /// Returns true if these two indeces form an edge and false otherwise bool isEdge(unsigned i, unsigned j) const; diff --git a/MeshLib/Elements/TemplateQuad.h b/MeshLib/Elements/TemplateQuad.h index d05ac9239ca..f438c86ebb6 100644 --- a/MeshLib/Elements/TemplateQuad.h +++ b/MeshLib/Elements/TemplateQuad.h @@ -61,7 +61,7 @@ public: * Method returns the type of the element. In this case QUAD will be returned. * @return MshElemType::QUAD */ - virtual MshElemType::type getType() const { return MshElemType::QUAD; } + virtual MshElemType::type getGeoType() const { return MshElemType::QUAD; } /// Returns true if these two indeces form an edge and false otherwise bool isEdge(unsigned i, unsigned j) const; diff --git a/MeshLib/Elements/TemplateTet.h b/MeshLib/Elements/TemplateTet.h index 39c1da63ca1..802568e56ef 100644 --- a/MeshLib/Elements/TemplateTet.h +++ b/MeshLib/Elements/TemplateTet.h @@ -75,7 +75,7 @@ public: * Method returns the type of the element. In this case TETRAHEDRON will be returned. * @return MshElemType::TETRAHEDRON */ - virtual MshElemType::type getType() const { return MshElemType::TETRAHEDRON; } + virtual MshElemType::type getGeoType() const { return MshElemType::TETRAHEDRON; } /// Returns true if these two indeces form an edge and false otherwise bool isEdge(unsigned i, unsigned j) const; diff --git a/MeshLib/Elements/TemplateTri.h b/MeshLib/Elements/TemplateTri.h index 1bbdc31672d..50ba490d0fe 100644 --- a/MeshLib/Elements/TemplateTri.h +++ b/MeshLib/Elements/TemplateTri.h @@ -68,7 +68,7 @@ public: * Method returns the type of the element. In this case TRIANGLE will be returned. * @return MshElemType::TRIANGLE */ - virtual MshElemType::type getType() const { return MshElemType::TRIANGLE; } + virtual MshElemType::type getGeoType() const { return MshElemType::TRIANGLE; } /// Returns true if these two indices form an edge and false otherwise bool isEdge(unsigned idx1, unsigned idx2) const; diff --git a/MeshLib/Mesh.cpp b/MeshLib/Mesh.cpp index 2db846e4994..8e168fac8fc 100644 --- a/MeshLib/Mesh.cpp +++ b/MeshLib/Mesh.cpp @@ -170,7 +170,7 @@ void Mesh::setElementsConnectedToElements() // create vector with all elements connected to current element (includes lots of doubles!) std::vector<Element*> neighbors; Element *const element (_elements[m]); - if (element->getType() != MshElemType::EDGE) + if (element->getGeoType() != MshElemType::EDGE) { const size_t nNodes (element->getNNodes()); for (unsigned n(0); n<nNodes; ++n) @@ -183,7 +183,7 @@ void Mesh::setElementsConnectedToElements() for (unsigned i(0); i<nNeighbors; ++i) { - if (element->addNeighbor(neighbors[i]) && neighbors[i]->getType() != MshElemType::EDGE) + if (element->addNeighbor(neighbors[i]) && neighbors[i]->getGeoType() != MshElemType::EDGE) { neighbors[i]->addNeighbor(element); } diff --git a/MeshLib/MeshQuality/MeshQualityChecker.cpp b/MeshLib/MeshQuality/MeshQualityChecker.cpp index 47fb72aade6..72a51a92658 100644 --- a/MeshLib/MeshQuality/MeshQualityChecker.cpp +++ b/MeshLib/MeshQuality/MeshQualityChecker.cpp @@ -37,7 +37,7 @@ BASELIB::Histogram<double> MeshQualityChecker::getHistogram (size_t nclasses) co void MeshQualityChecker::errorMsg (const Element* elem, size_t idx) const { ERR ("Error in MeshQualityChecker::check() - Calculated value of element is below double precision minimum."); - ERR ("Points of %s-Element %d: ", MshElemType2String(elem->getType()).c_str(), idx); + ERR ("Points of %s-Element %d: ", MshElemType2String(elem->getGeoType()).c_str(), idx); for (size_t i(0); i < elem->getNNodes(); i++) { const double* coords = elem->getNode(i)->getCoords(); diff --git a/MeshLib/MeshQuality/MeshQualityEquiAngleSkew.cpp b/MeshLib/MeshQuality/MeshQualityEquiAngleSkew.cpp index 041a1550c94..e8507a16b9a 100644 --- a/MeshLib/MeshQuality/MeshQualityEquiAngleSkew.cpp +++ b/MeshLib/MeshQuality/MeshQualityEquiAngleSkew.cpp @@ -42,7 +42,7 @@ void MeshQualityEquiAngleSkew::check () for (size_t k(0); k < nElements; k++) { const Element* elem (elements[k]); - switch (elem->getType()) + switch (elem->getGeoType()) { case MshElemType::EDGE: _mesh_quality_measure[k] = -1.0; diff --git a/MeshLib/MeshQuality/MeshQualityShortestLongestRatio.cpp b/MeshLib/MeshQuality/MeshQualityShortestLongestRatio.cpp index 3bd5560d931..17cf68347b5 100644 --- a/MeshLib/MeshQuality/MeshQualityShortestLongestRatio.cpp +++ b/MeshLib/MeshQuality/MeshQualityShortestLongestRatio.cpp @@ -29,7 +29,7 @@ void MeshQualityShortestLongestRatio::check() for (size_t k(0); k < nElements; k++) { const Element* elem (elements[k]); - switch (elem->getType()) + switch (elem->getGeoType()) { case MshElemType::EDGE: _mesh_quality_measure[k] = 1.0; @@ -62,7 +62,7 @@ void MeshQualityShortestLongestRatio::check() } default: ERR ("MeshQualityShortestLongestRatio::check () check for element type %s not implemented.", - MshElemType2String(elem->getType()).c_str()); + MshElemType2String(elem->getGeoType()).c_str()); } } } diff --git a/MeshLib/MeshQuality/MeshQualityVolume.cpp b/MeshLib/MeshQuality/MeshQualityVolume.cpp index 114a3c1e0b4..961c1c9660e 100644 --- a/MeshLib/MeshQuality/MeshQualityVolume.cpp +++ b/MeshLib/MeshQuality/MeshQualityVolume.cpp @@ -32,7 +32,7 @@ void MeshQualityVolume::check() for (size_t k(0); k < nElements; k++) { const Element* elem (elements[k]); - MshElemType::type elem_type (elem->getType()); + MshElemType::type elem_type (elem->getGeoType()); if (elem_type == MshElemType::EDGE || elem_type == MshElemType::TRIANGLE || elem_type == MshElemType::QUAD) diff --git a/MeshLib/MshEditor.cpp b/MeshLib/MshEditor.cpp index 0c61b7044c0..0759971cd25 100644 --- a/MeshLib/MshEditor.cpp +++ b/MeshLib/MshEditor.cpp @@ -44,7 +44,7 @@ void MshEditor::getSurfaceAreaForNodes(const MeshLib::Mesh* mesh, std::vector<do for (size_t i=0; i<nConnElems; ++i) { const MeshLib::Element* elem (conn_elems[i]); - const unsigned nElemParts = (elem->getType() == MshElemType::TRIANGLE) ? 3 : 4; + const unsigned nElemParts = (elem->getGeoType() == MshElemType::TRIANGLE) ? 3 : 4; const double area = conn_elems[i]->getContent() / nElemParts; node_area += area; total_area += area; @@ -134,7 +134,7 @@ MeshLib::Mesh* MshEditor::getMeshSurface(const MeshLib::Mesh &mesh, const double for (unsigned i=0; i<nNewElements; ++i) { MeshLib::Element* elem (sfc_elements[i]); - if (elem->getType() == MshElemType::TRIANGLE) { + if (elem->getGeoType() == MshElemType::TRIANGLE) { MeshLib::Node** tri_nodes = new MeshLib::Node*[3]; for (unsigned k(0); k<3; k++) tri_nodes[k] = sfc_nodes[node_id_map[elem->getNode(k)->getID()]]; @@ -198,7 +198,7 @@ void MshEditor::get2DSurfaceElements(const std::vector<MeshLib::Element*> &all_e continue; } - if (face->getType() == MshElemType::TRIANGLE) + if (face->getGeoType() == MshElemType::TRIANGLE) sfc_elements.push_back(new MeshLib::Tri(*static_cast<const MeshLib::Tri*>(face))); else sfc_elements.push_back(new MeshLib::Quad(*static_cast<const MeshLib::Quad*>(face))); -- GitLab