Skip to content
Snippets Groups Projects
Commit 6afa1923 authored by Norihiro Watanabe's avatar Norihiro Watanabe
Browse files

include comments from DN

parent 7500ab12
No related branches found
No related tags found
No related merge requests found
...@@ -22,10 +22,6 @@ ElementSearch::ElementSearch(const MeshLib::Mesh &mesh) ...@@ -22,10 +22,6 @@ ElementSearch::ElementSearch(const MeshLib::Mesh &mesh)
{ {
} }
ElementSearch::~ElementSearch()
{
}
std::size_t ElementSearch::searchByMaterialID(int const matID) std::size_t ElementSearch::searchByMaterialID(int const matID)
{ {
boost::optional<MeshLib::PropertyVector<int> const&> opt_pv( boost::optional<MeshLib::PropertyVector<int> const&> opt_pv(
......
...@@ -23,13 +23,11 @@ class Mesh; ...@@ -23,13 +23,11 @@ class Mesh;
class Element; class Element;
/// Element search class /// Element search class
class ElementSearch class ElementSearch final
{ {
public: public:
explicit ElementSearch(const MeshLib::Mesh &mesh); explicit ElementSearch(const MeshLib::Mesh &mesh);
~ElementSearch();
/// return marked elements /// return marked elements
const std::vector<std::size_t>& getSearchedElementIDs() const { return _marked_elements; } const std::vector<std::size_t>& getSearchedElementIDs() const { return _marked_elements; }
......
...@@ -24,10 +24,6 @@ NodeSearch::NodeSearch(const MeshLib::Mesh &mesh) ...@@ -24,10 +24,6 @@ NodeSearch::NodeSearch(const MeshLib::Mesh &mesh)
{ {
} }
NodeSearch::~NodeSearch()
{
}
std::size_t NodeSearch::searchByElementIDs(const std::vector<std::size_t> &elements, bool only_match_all_connected_elements) std::size_t NodeSearch::searchByElementIDs(const std::vector<std::size_t> &elements, bool only_match_all_connected_elements)
{ {
std::vector<std::size_t> connected_nodes; std::vector<std::size_t> connected_nodes;
...@@ -86,7 +82,7 @@ void NodeSearch::updateUnion(const std::vector<std::size_t> &vec) ...@@ -86,7 +82,7 @@ void NodeSearch::updateUnion(const std::vector<std::size_t> &vec)
_marked_nodes.assign(vec_temp.begin(), vec_temp.end()); _marked_nodes.assign(vec_temp.begin(), vec_temp.end());
} }
std::vector<Node*> getNodes(std::vector<Element*> const& elements) std::vector<Node*> getUniqueNodes(std::vector<Element*> const& elements)
{ {
std::set<Node*> nodes_set; std::set<Node*> nodes_set;
for (auto e : elements) for (auto e : elements)
......
...@@ -21,13 +21,11 @@ class Element; ...@@ -21,13 +21,11 @@ class Element;
class Node; class Node;
/// Node search class /// Node search class
class NodeSearch class NodeSearch final
{ {
public: public:
explicit NodeSearch(const MeshLib::Mesh &mesh); explicit NodeSearch(const MeshLib::Mesh &mesh);
~NodeSearch();
/// return marked node IDs /// return marked node IDs
const std::vector<std::size_t>& getSearchedNodeIDs() const {return _marked_nodes; } const std::vector<std::size_t>& getSearchedNodeIDs() const {return _marked_nodes; }
...@@ -48,7 +46,7 @@ private: ...@@ -48,7 +46,7 @@ private:
}; };
/// Create a vector of unique nodes used by given elements. /// Create a vector of unique nodes used by given elements.
std::vector<Node*> getNodes(std::vector<Element*> const& elements); std::vector<Node*> getUniqueNodes(std::vector<Element*> const& elements);
} // end namespace MeshLib } // end namespace MeshLib
......
...@@ -64,7 +64,7 @@ public: ...@@ -64,7 +64,7 @@ public:
std::back_inserter(_elements), std::back_inserter(_elements),
std::mem_fn(&MeshLib::Element::clone)); std::mem_fn(&MeshLib::Element::clone));
std::vector<MeshLib::Node*> nodes = MeshLib::getNodes(_elements); std::vector<MeshLib::Node*> nodes = MeshLib::getUniqueNodes(_elements);
_mesh_subset_all_nodes = _mesh_subset_all_nodes =
mesh_subset_all_nodes.getIntersectionByNodes(nodes); mesh_subset_all_nodes.getIntersectionByNodes(nodes);
......
...@@ -88,7 +88,7 @@ TEST_F(AssemblerLibLocalToGlobalIndexMapTest, SubsetByComponent) ...@@ -88,7 +88,7 @@ TEST_F(AssemblerLibLocalToGlobalIndexMapTest, SubsetByComponent)
some_elements.push_back(const_cast<MeshLib::Element*>(mesh->getElement(id))); some_elements.push_back(const_cast<MeshLib::Element*>(mesh->getElement(id)));
// Find unique node ids of the selected elements for testing. // Find unique node ids of the selected elements for testing.
std::vector<MeshLib::Node*> selected_nodes = MeshLib::getNodes(some_elements); std::vector<MeshLib::Node*> selected_nodes = MeshLib::getUniqueNodes(some_elements);
MeshLib::MeshSubset const* const selected_subset = MeshLib::MeshSubset const* const selected_subset =
nodesSubset->getIntersectionByNodes(selected_nodes); nodesSubset->getIntersectionByNodes(selected_nodes);
......
...@@ -151,7 +151,7 @@ TEST_F(MeshLibBoundaryElementSearchInSimpleHexMesh, SurfaceSearch) ...@@ -151,7 +151,7 @@ TEST_F(MeshLibBoundaryElementSearchInSimpleHexMesh, SurfaceSearch)
double sum_area_b = std::accumulate(found_faces_sfc_b.begin(), found_faces_sfc_b.end(), 0.0, double sum_area_b = std::accumulate(found_faces_sfc_b.begin(), found_faces_sfc_b.end(), 0.0,
[](double v, MeshLib::Element*e){return v+e->getContent();}); [](double v, MeshLib::Element*e){return v+e->getContent();});
ASSERT_EQ(_geometric_size*_geometric_size, sum_area_b); ASSERT_EQ(_geometric_size*_geometric_size, sum_area_b);
auto connected_nodes_b = MeshLib::getNodes(found_faces_sfc_b); auto connected_nodes_b = MeshLib::getUniqueNodes(found_faces_sfc_b);
ASSERT_EQ(n_nodes_2d, connected_nodes_b.size()); ASSERT_EQ(n_nodes_2d, connected_nodes_b.size());
for (auto node : connected_nodes_b) for (auto node : connected_nodes_b)
ASSERT_EQ(0.0, (*node)[2]); // check z coordinates ASSERT_EQ(0.0, (*node)[2]); // check z coordinates
...@@ -162,7 +162,7 @@ TEST_F(MeshLibBoundaryElementSearchInSimpleHexMesh, SurfaceSearch) ...@@ -162,7 +162,7 @@ TEST_F(MeshLibBoundaryElementSearchInSimpleHexMesh, SurfaceSearch)
double sum_area_f = std::accumulate(found_faces_sfc_f.begin(), found_faces_sfc_f.end(), 0.0, double sum_area_f = std::accumulate(found_faces_sfc_f.begin(), found_faces_sfc_f.end(), 0.0,
[](double v, MeshLib::Element*e){return v+e->getContent();}); [](double v, MeshLib::Element*e){return v+e->getContent();});
ASSERT_EQ(_geometric_size*_geometric_size, sum_area_f); ASSERT_EQ(_geometric_size*_geometric_size, sum_area_f);
auto connected_nodes_f = MeshLib::getNodes(found_faces_sfc_f); auto connected_nodes_f = MeshLib::getUniqueNodes(found_faces_sfc_f);
ASSERT_EQ(n_nodes_2d, connected_nodes_f.size()); ASSERT_EQ(n_nodes_2d, connected_nodes_f.size());
for (auto node : connected_nodes_f) for (auto node : connected_nodes_f)
ASSERT_EQ(0.0, (*node)[1]); // check y coordinates ASSERT_EQ(0.0, (*node)[1]); // check y coordinates
......
...@@ -15,13 +15,14 @@ ...@@ -15,13 +15,14 @@
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "Mesh.h" #include "MathLib/MathTools.h"
#include "MeshLib/Mesh.h"
#include "MeshLib/Node.h" #include "MeshLib/Node.h"
#include "Elements/Element.h" #include "MeshLib/Elements/Element.h"
#include "MeshEditing/RemoveMeshComponents.h" #include "MeshLib/MeshEditing/RemoveMeshComponents.h"
#include "MeshGenerators/MeshGenerator.h" #include "MeshLib/MeshGenerators/MeshGenerator.h"
#include "MeshQuality/MeshValidation.h" #include "MeshLib/MeshQuality/MeshValidation.h"
#include "MathTools.h"
TEST(MeshLib, RemoveNodes) TEST(MeshLib, RemoveNodes)
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment