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
c5736dde
There was an error fetching the commit references. Please try again later.
Commit
c5736dde
authored
6 years ago
by
Jakub Klinkovský
Browse files
Options
Downloads
Patches
Plain Diff
VTKWriter: improved implementation to avoid specializations by GridEntity
parent
93fd2bec
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/TNL/Meshes/Writers/VTKWriter_impl.h
+41
-44
41 additions, 44 deletions
src/TNL/Meshes/Writers/VTKWriter_impl.h
with
41 additions
and
44 deletions
src/TNL/Meshes/Writers/VTKWriter_impl.h
+
41
−
44
View file @
c5736dde
...
...
@@ -10,6 +10,8 @@
#pragma once
#include
<type_traits>
#include
<TNL/Meshes/Writers/VTKWriter.h>
#include
<TNL/Meshes/Readers/EntityShape.h>
...
...
@@ -19,68 +21,63 @@ namespace Writers {
namespace
__impl
{
template
<
typename
Entity
>
struct
VerticesPerEntity
template
<
typename
T
,
typename
R
=
void
>
struct
enable_if_type
{
static
constexpr
int
count
=
Entity
::
getVerticesCount
()
;
using
type
=
R
;
};
template
<
typename
MeshConfig
,
typename
Device
>
struct
VerticesPerEntity
<
MeshEntity
<
MeshConfig
,
Device
,
Topologies
::
Vertex
>
>
{
static
constexpr
int
count
=
1
;
};
template
<
typename
T
,
typename
Enable
=
void
>
struct
has_entity_topology
:
std
::
false_type
{};
template
<
typename
Grid
,
typename
Config
>
struct
VerticesPerEntity
<
GridEntity
<
Grid
,
0
,
Config
>
>
{
static
constexpr
int
count
=
1
;
};
template
<
typename
T
>
struct
has_entity_topology
<
T
,
typename
enable_if_type
<
typename
T
::
EntityTopology
>::
type
>
:
std
::
true_type
{};
template
<
typename
Grid
,
typename
Config
>
struct
VerticesPerEntity
<
GridEntity
<
Grid
,
1
,
Config
>
>
{
static
constexpr
int
count
=
2
;
};
template
<
typename
Grid
,
typename
Config
>
struct
VerticesPerEntity
<
GridEntity
<
Grid
,
2
,
Config
>
>
template
<
typename
Entity
,
bool
_is_mesh_entity
=
has_entity_topology
<
Entity
>
::
value
>
struct
VerticesPerEntity
{
static
constexpr
int
count
=
4
;
static
constexpr
int
count
=
Entity
::
getVerticesCount
()
;
};
template
<
typename
Grid
,
typename
Config
>
struct
VerticesPerEntity
<
Grid
Entity
<
Grid
,
3
,
Config
>
>
template
<
typename
MeshConfig
,
typename
Device
>
struct
VerticesPerEntity
<
Mesh
Entity
<
MeshConfig
,
Device
,
Topologies
::
Vertex
>
,
true
>
{
static
constexpr
int
count
=
8
;
static
constexpr
int
count
=
1
;
};
template
<
typename
GridEntity
>
struct
GridEntityShape
{};
template
<
typename
Grid
,
typename
Config
>
struct
GridEntityShape
<
GridEntity
<
Grid
,
0
,
Config
>
>
struct
VerticesPerEntity
<
GridEntity
,
false
>
{
static
constexpr
Readers
::
EntityShape
shape
=
Readers
::
EntityShape
::
Vertex
;
private:
static
constexpr
int
dim
=
GridEntity
::
getEntityDimension
();
static_assert
(
dim
>=
0
&&
dim
<=
3
,
"unexpected dimension of the grid entity"
);
public:
static
constexpr
int
count
=
(
dim
==
0
)
?
1
:
(
dim
==
1
)
?
2
:
(
dim
==
2
)
?
4
:
8
;
};
template
<
typename
Grid
,
typename
Config
>
struct
GridEntityShape
<
GridEntity
<
Grid
,
1
,
Config
>
>
{
static
constexpr
Readers
::
EntityShape
shape
=
Readers
::
EntityShape
::
Line
;
};
template
<
typename
Grid
,
typename
Config
>
struct
GridEntityShape
<
GridEntity
<
Grid
,
2
,
Config
>
>
{
static
constexpr
Readers
::
EntityShape
shape
=
Readers
::
EntityShape
::
Pixel
;
};
template
<
typename
Grid
,
typename
Config
>
struct
GridEntityShape
<
GridEntity
<
Grid
,
3
,
Config
>
>
template
<
typename
Grid
Entity
>
struct
GridEntityShape
{
static
constexpr
Readers
::
EntityShape
shape
=
Readers
::
EntityShape
::
Voxel
;
private:
static
constexpr
int
dim
=
GridEntity
::
getEntityDimension
();
static_assert
(
dim
>=
0
&&
dim
<=
3
,
"unexpected dimension of the grid entity"
);
public:
static
constexpr
Readers
::
EntityShape
shape
=
(
dim
==
0
)
?
Readers
::
EntityShape
::
Vertex
:
(
dim
==
1
)
?
Readers
::
EntityShape
::
Line
:
(
dim
==
2
)
?
Readers
::
EntityShape
::
Pixel
:
Readers
::
EntityShape
::
Voxel
;
};
...
...
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