Skip to content

Commit

Permalink
Removing pointer version and test addition
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenzorrilla committed Sep 1, 2023
1 parent bbf0811 commit 8a87677
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 17 deletions.
35 changes: 35 additions & 0 deletions kratos/tests/cpp_tests/utilities/test_entities_utilities.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// | / |
// ' / __| _` | __| _ \ __|
// . \ | ( | | ( |\__ `
// _|\_\_| \__,_|\__|\___/ ____/
// Multi-Physics
//
// License: BSD License
// Kratos default license: kratos/license.txt
//
// Main authors: Ruben Zorrilla
//
//

// Project includes
#include "testing/testing.h"
#include "containers/model.h"
#include "includes/expect.h"
#include "utilities/entities_utilities.h"

namespace Kratos::Testing
{

KRATOS_TEST_CASE_IN_SUITE(EntityIdentifierHasPrototype, KratosCoreFastSuite)
{
Model model;
auto& r_model_part = model.CreateModelPart("MainModelPart");
r_model_part.CreateNewNode(1, 0.0, 0.0, 0.0);
r_model_part.CreateNewNode(2, 1.0, 0.0, 0.0);
r_model_part.CreateNewNode(3, 0.0, 1.0, 0.0);
auto p_tri_geom = r_model_part.CreateNewGeometry("Triangle2D3", 1, {{1, 2, 3}});
auto entity_identifier = EntitiesUtilities::EntitityIdentifier<Element>("Element2D3N");
KRATOS_EXPECT_TRUE(entity_identifier.HasPrototypeEntity(*p_tri_geom));
}

} // namespace Kratos::Testing.
9 changes: 0 additions & 9 deletions kratos/utilities/entities_utilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,6 @@ bool EntitityIdentifier<TEntity>::IsInitialized() const
/***********************************************************************************/
/***********************************************************************************/

template<class TEntity>
bool EntitityIdentifier<TEntity>::HasPrototypeEntity(typename GeometryType::Pointer pGeometry) const
{
return mTypes[static_cast<std::size_t>(pGeometry->GetGeometryType())] != nullptr;
}

/***********************************************************************************/
/***********************************************************************************/

template<class TEntity>
bool EntitityIdentifier<TEntity>::HasPrototypeEntity(const GeometryType& rGeometry) const
{
Expand Down
8 changes: 0 additions & 8 deletions kratos/utilities/entities_utilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,6 @@ namespace EntitiesUtilities
*/
bool IsInitialized() const;

/**
* @brief Get the prototype entity.
* @param pGeometry The pointer to the geometry.
* @return true there is a prototype for the provided entity.
* @return false there is no prototype for the provided entity.
*/
bool HasPrototypeEntity(typename GeometryType::Pointer pGeometry) const;

/**
* @brief Get the prototype entity.
* @param rGeometry The reference to the geometry.
Expand Down

0 comments on commit 8a87677

Please sign in to comment.