Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tnl-dev
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
TNL
tnl-dev
Commits
81413bb7
There was an error fetching the commit references. Please try again later.
Commit
81413bb7
authored
8 years ago
by
Jakub Klinkovský
Browse files
Options
Downloads
Patches
Plain Diff
Tests: fixed access to protected member setSubentityIndex
parent
ae43f63c
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/TNL/Meshes/MeshEntity.h
+1
-1
1 addition, 1 deletion
src/TNL/Meshes/MeshEntity.h
src/UnitTests/Meshes/MeshEntityTest.h
+29
-13
29 additions, 13 deletions
src/UnitTests/Meshes/MeshEntityTest.h
with
30 additions
and
14 deletions
src/TNL/Meshes/MeshEntity.h
+
1
−
1
View file @
81413bb7
...
@@ -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
>
>
...
...
This diff is collapsed.
Click to expand it.
src/UnitTests/Meshes/MeshEntityTest.h
+
29
−
13
View file @
81413bb7
...
@@ -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
Test
MeshEntity
<
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
Test
MeshEntity
<
TestEdgeEntityTopology
,
MeshEdgeTopology
>
EdgeMeshEntityType
;
typedef
MeshEntity
<
TestEdgeEntityTopology
,
MeshVertexTopology
>
VertexMeshEntityType
;
typedef
Test
MeshEntity
<
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
Test
MeshEntity
<
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
Test
MeshEntity
<
TestEdgeEntityTopology
,
MeshEdgeTopology
>
EdgeMeshEntityType
;
typedef
MeshEntity
<
TestVertexEntityTopology
,
MeshVertexTopology
>
VertexMeshEntityType
;
typedef
Test
MeshEntity
<
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
Test
MeshEntity
<
TestTetrahedronMeshConfig
,
MeshTetrahedronTopology
>
TetrahedronMeshEntityType
;
typedef
MeshEntity
<
TestTriangleMeshConfig
,
MeshTriangleTopology
>
TriangleMeshEntityType
;
typedef
Test
MeshEntity
<
TestTriangleMeshConfig
,
MeshTriangleTopology
>
TriangleMeshEntityType
;
typedef
MeshEntity
<
TestEdgeEntityTopology
,
MeshEdgeTopology
>
EdgeMeshEntityType
;
typedef
Test
MeshEntity
<
TestEdgeEntityTopology
,
MeshEdgeTopology
>
EdgeMeshEntityType
;
typedef
MeshEntity
<
TestVertexEntityTopology
,
MeshVertexTopology
>
VertexMeshEntityType
;
typedef
Test
MeshEntity
<
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
Test
MeshEntity
<
TestTriangleMeshConfig
,
MeshTriangleTopology
>
TriangleMeshEntityType
;
typedef
MeshEntity
<
TestTriangleMeshConfig
,
MeshEdgeTopology
>
EdgeMeshEntityType
;
typedef
Test
MeshEntity
<
TestTriangleMeshConfig
,
MeshEdgeTopology
>
EdgeMeshEntityType
;
typedef
MeshEntity
<
TestTriangleMeshConfig
,
MeshVertexTopology
>
VertexMeshEntityType
;
typedef
Test
MeshEntity
<
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
()
)
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment