Skip to content
Snippets Groups Projects
Commit 81413bb7 authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

Tests: fixed access to protected member setSubentityIndex

parent ae43f63c
No related branches found
No related tags found
No related merge requests found
...@@ -226,7 +226,7 @@ std::ostream& operator <<( std::ostream& str, const MeshEntity< MeshConfig, Enti ...@@ -226,7 +226,7 @@ std::ostream& operator <<( std::ostream& str, const MeshEntity< MeshConfig, Enti
* This tells the compiler that theMeshEntity is a type with a dynamic memory allocation. * This tells the compiler that theMeshEntity is a type with a dynamic memory allocation.
* It is necessary for the loading and the saving of the mesh entities arrays. * It is necessary for the loading and the saving of the mesh entities arrays.
*/ */
namespace Containers{ namespace Containers {
template< typename MeshConfig, template< typename MeshConfig,
typename EntityTopology > typename EntityTopology >
struct DynamicTypeTag< Meshes::MeshEntity< MeshConfig, EntityTopology > > struct DynamicTypeTag< Meshes::MeshEntity< MeshConfig, EntityTopology > >
......
...@@ -48,6 +48,22 @@ class TestTetrahedronMeshConfig : public MeshConfigBase< MeshTetrahedronTopology ...@@ -48,6 +48,22 @@ class TestTetrahedronMeshConfig : public MeshConfigBase< MeshTetrahedronTopology
return true; return true;
} }
}; };
// stupid wrapper around MeshEntity to expose protected members needed for tests
template< typename MeshConfig, typename EntityTopology >
class TestMeshEntity
: public MeshEntity< MeshConfig, EntityTopology >
{
using BaseType = MeshEntity< MeshConfig, EntityTopology >;
public:
template< int Subdimensions >
void setSubentityIndex( const typename BaseType::LocalIndexType localIndex,
const typename BaseType::GlobalIndexType globalIndex )
{
BaseType::template setSubentityIndex< Subdimensions >( localIndex, globalIndex );
}
};
using RealType = double; using RealType = double;
using Device = Devices::Host; using Device = Devices::Host;
...@@ -56,7 +72,7 @@ using IndexType = int; ...@@ -56,7 +72,7 @@ using IndexType = int;
TEST( MeshEntityTest, VertexMeshEntityTest ) TEST( MeshEntityTest, VertexMeshEntityTest )
{ {
typedef MeshConfigBase< MeshEdgeTopology, 2, RealType, IndexType, IndexType, void > TestEntityTopology; typedef MeshConfigBase< MeshEdgeTopology, 2, RealType, IndexType, IndexType, void > TestEntityTopology;
typedef MeshEntity< TestEntityTopology, MeshVertexTopology > VertexMeshEntityType; typedef TestMeshEntity< TestEntityTopology, MeshVertexTopology > VertexMeshEntityType;
typedef typename VertexMeshEntityType::PointType PointType; typedef typename VertexMeshEntityType::PointType PointType;
ASSERT_TRUE( PointType::getType() == ( Containers::StaticVector< 2, RealType >::getType() ) ); ASSERT_TRUE( PointType::getType() == ( Containers::StaticVector< 2, RealType >::getType() ) );
...@@ -71,8 +87,8 @@ TEST( MeshEntityTest, VertexMeshEntityTest ) ...@@ -71,8 +87,8 @@ TEST( MeshEntityTest, VertexMeshEntityTest )
TEST( MeshEntityTest, EdgeMeshEntityTest ) TEST( MeshEntityTest, EdgeMeshEntityTest )
{ {
typedef MeshEntity< TestEdgeEntityTopology, MeshEdgeTopology > EdgeMeshEntityType; typedef TestMeshEntity< TestEdgeEntityTopology, MeshEdgeTopology > EdgeMeshEntityType;
typedef MeshEntity< TestEdgeEntityTopology, MeshVertexTopology > VertexMeshEntityType; typedef TestMeshEntity< TestEdgeEntityTopology, MeshVertexTopology > VertexMeshEntityType;
typedef typename VertexMeshEntityType::PointType PointType; typedef typename VertexMeshEntityType::PointType PointType;
ASSERT_TRUE( PointType::getType() == ( Containers::StaticVector< 2, RealType >::getType() ) ); ASSERT_TRUE( PointType::getType() == ( Containers::StaticVector< 2, RealType >::getType() ) );
...@@ -134,12 +150,12 @@ TEST( MeshEntityTest, EdgeMeshEntityTest ) ...@@ -134,12 +150,12 @@ TEST( MeshEntityTest, EdgeMeshEntityTest )
TEST( MeshEntityTest, TriangleMeshEntityTest ) TEST( MeshEntityTest, TriangleMeshEntityTest )
{ {
typedef MeshEntity< TestTriangleMeshConfig, MeshTriangleTopology > TriangleMeshEntityType; typedef TestMeshEntity< TestTriangleMeshConfig, MeshTriangleTopology > TriangleMeshEntityType;
static_assert( TriangleMeshEntityType::SubentityTraits< 1 >::storageEnabled, "Testing triangular mesh does not store edges as required." ); static_assert( TriangleMeshEntityType::SubentityTraits< 1 >::storageEnabled, "Testing triangular mesh does not store edges as required." );
static_assert( TriangleMeshEntityType::SubentityTraits< 0 >::storageEnabled, "" ); static_assert( TriangleMeshEntityType::SubentityTraits< 0 >::storageEnabled, "" );
typedef MeshEntity< TestEdgeEntityTopology, MeshEdgeTopology > EdgeMeshEntityType; typedef TestMeshEntity< TestEdgeEntityTopology, MeshEdgeTopology > EdgeMeshEntityType;
typedef MeshEntity< TestVertexEntityTopology, MeshVertexTopology > VertexMeshEntityType; typedef TestMeshEntity< TestVertexEntityTopology, MeshVertexTopology > VertexMeshEntityType;
typedef typename VertexMeshEntityType::PointType PointType; typedef typename VertexMeshEntityType::PointType PointType;
ASSERT_TRUE( PointType::getType() == ( Containers::StaticVector< 2, RealType >::getType() ) ); ASSERT_TRUE( PointType::getType() == ( Containers::StaticVector< 2, RealType >::getType() ) );
...@@ -200,10 +216,10 @@ TEST( MeshEntityTest, TetragedronMeshEntityTest ) ...@@ -200,10 +216,10 @@ TEST( MeshEntityTest, TetragedronMeshEntityTest )
typedef MeshConfigBase< MeshEdgeTopology, 3, RealType, IndexType, IndexType, void > TestEdgeEntityTopology; typedef MeshConfigBase< MeshEdgeTopology, 3, RealType, IndexType, IndexType, void > TestEdgeEntityTopology;
typedef MeshConfigBase< MeshVertexTopology, 3, RealType, IndexType, IndexType, void > TestVertexEntityTopology; typedef MeshConfigBase< MeshVertexTopology, 3, RealType, IndexType, IndexType, void > TestVertexEntityTopology;
typedef MeshEntity< TestTetrahedronMeshConfig, MeshTetrahedronTopology > TetrahedronMeshEntityType; typedef TestMeshEntity< TestTetrahedronMeshConfig, MeshTetrahedronTopology > TetrahedronMeshEntityType;
typedef MeshEntity< TestTriangleMeshConfig, MeshTriangleTopology > TriangleMeshEntityType; typedef TestMeshEntity< TestTriangleMeshConfig, MeshTriangleTopology > TriangleMeshEntityType;
typedef MeshEntity< TestEdgeEntityTopology, MeshEdgeTopology > EdgeMeshEntityType; typedef TestMeshEntity< TestEdgeEntityTopology, MeshEdgeTopology > EdgeMeshEntityType;
typedef MeshEntity< TestVertexEntityTopology, MeshVertexTopology > VertexMeshEntityType; typedef TestMeshEntity< TestVertexEntityTopology, MeshVertexTopology > VertexMeshEntityType;
typedef typename VertexMeshEntityType::PointType PointType; typedef typename VertexMeshEntityType::PointType PointType;
ASSERT_TRUE( PointType::getType() == ( Containers::StaticVector< 3, RealType >::getType() ) ); ASSERT_TRUE( PointType::getType() == ( Containers::StaticVector< 3, RealType >::getType() ) );
...@@ -320,9 +336,9 @@ TEST( MeshEntityTest, TetragedronMeshEntityTest ) ...@@ -320,9 +336,9 @@ TEST( MeshEntityTest, TetragedronMeshEntityTest )
TEST( MeshEntityTest, TwoTrianglesMeshEntityTest ) TEST( MeshEntityTest, TwoTrianglesMeshEntityTest )
{ {
typedef MeshEntity< TestTriangleMeshConfig, MeshTriangleTopology > TriangleMeshEntityType; typedef TestMeshEntity< TestTriangleMeshConfig, MeshTriangleTopology > TriangleMeshEntityType;
typedef MeshEntity< TestTriangleMeshConfig, MeshEdgeTopology > EdgeMeshEntityType; typedef TestMeshEntity< TestTriangleMeshConfig, MeshEdgeTopology > EdgeMeshEntityType;
typedef MeshEntity< TestTriangleMeshConfig, MeshVertexTopology > VertexMeshEntityType; typedef TestMeshEntity< TestTriangleMeshConfig, MeshVertexTopology > VertexMeshEntityType;
typedef typename VertexMeshEntityType::PointType PointType; typedef typename VertexMeshEntityType::PointType PointType;
ASSERT_TRUE( PointType::getType() == ( Containers::StaticVector< 2, RealType >::getType() ) ); ASSERT_TRUE( PointType::getType() == ( Containers::StaticVector< 2, RealType >::getType() ) );
......
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