Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenVolumeMesh
OpenVolumeMesh
Commits
fd68dccf
Commit
fd68dccf
authored
Feb 26, 2019
by
Martin Heistermann
Browse files
Refactor: Entity tag structs for generic handles and property handles
parent
172ca930
Pipeline
#8862
passed with stage
in 5 minutes and 27 seconds
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/OpenVolumeMesh/Attribs/StatusAttrib.hh
View file @
fd68dccf
...
...
@@ -108,12 +108,12 @@ public:
}
const
OpenVolumeMeshStatus
&
mesh_status
()
const
{
OpenVolume
MeshHandle
h
(
0
);
MeshHandle
h
(
0
);
return
m_status_
[
h
];
}
OpenVolumeMeshStatus
&
mesh_status
()
{
OpenVolume
MeshHandle
h
(
0
);
MeshHandle
h
(
0
);
return
m_status_
[
h
];
}
...
...
src/OpenVolumeMesh/Core/Entities.hh
0 → 100644
View file @
fd68dccf
#pragma once
#include
<type_traits>
namespace
OpenVolumeMesh
{
namespace
Entity
{
struct
Vertex
{};
struct
Edge
{};
struct
HalfEdge
{};
struct
Face
{};
struct
HalfFace
{};
struct
Cell
{};
struct
Mesh
{};
}
template
<
typename
T
>
struct
is_entity
:
std
::
false_type
{};
template
<
>
struct
is_entity
<
Entity
::
Vertex
>
:
std
::
true_type
{};
template
<
>
struct
is_entity
<
Entity
::
Edge
>
:
std
::
true_type
{};
template
<
>
struct
is_entity
<
Entity
::
HalfEdge
>
:
std
::
true_type
{};
template
<
>
struct
is_entity
<
Entity
::
Face
>
:
std
::
true_type
{};
template
<
>
struct
is_entity
<
Entity
::
HalfFace
>
:
std
::
true_type
{};
template
<
>
struct
is_entity
<
Entity
::
Cell
>
:
std
::
true_type
{};
template
<
>
struct
is_entity
<
Entity
::
Mesh
>
:
std
::
true_type
{};
}
// namespace OpenVolumeMesh
src/OpenVolumeMesh/Core/OpenVolumeMeshHandle.cc
View file @
fd68dccf
...
...
@@ -32,14 +32,6 @@
* *
\*===========================================================================*/
/*===========================================================================*\
* *
* $Revision: 36 $ *
* $Date: 2012-01-10 18:00:06 +0100 (Di, 10 Jan 2012) $ *
* $LastChangedBy: kremer $ *
* *
\*===========================================================================*/
#include
<istream>
#include
"OpenVolumeMeshHandle.hh"
...
...
src/OpenVolumeMesh/Core/OpenVolumeMeshHandle.hh
View file @
fd68dccf
...
...
@@ -38,6 +38,7 @@
#include
<iosfwd>
#include
<vector>
#include
"Entities.hh"
#include
"../System/FunctionalInclude.hh"
#include
"../System/Deprecation.hh"
...
...
@@ -86,14 +87,25 @@ private:
int
idx_
;
};
template
<
typename
EntityTag
,
typename
=
typename
std
::
enable_if
<
is_entity
<
EntityTag
>
::
value
>::
type
>
class
HandleT
:
public
OpenVolumeMeshHandle
{
public:
using
Entity
=
EntityTag
;
explicit
HandleT
(
int
_idx
=
-
1
)
:
OpenVolumeMeshHandle
(
_idx
)
{}
};
// Default entity handles
class
VertexHandle
:
public
OpenVolumeMeshHandle
{
public
:
explicit
VertexHandle
(
int
_idx
=
-
1
)
:
OpenVolumeMeshHandle
(
_idx
)
{}
};
class
EdgeHandle
:
public
OpenVolumeMeshHandle
{
public
:
explicit
EdgeHandle
(
int
_idx
=
-
1
)
:
OpenVolumeMeshHandle
(
_idx
)
{}
};
class
FaceHandle
:
public
OpenVolumeMeshHandle
{
public
:
explicit
FaceHandle
(
int
_idx
=
-
1
)
:
OpenVolumeMeshHandle
(
_idx
)
{}
};
class
CellHandle
:
public
OpenVolumeMeshHandle
{
public
:
explicit
CellHandle
(
int
_idx
=
-
1
)
:
OpenVolumeMeshHandle
(
_idx
)
{}
};
class
HalfEdgeHandle
:
public
OpenVolumeMeshHandle
{
public
:
explicit
HalfEdgeHandle
(
int
_idx
=
-
1
)
:
OpenVolumeMeshHandle
(
_idx
)
{}
};
class
HalfFaceHandle
:
public
OpenVolumeMeshHandle
{
public
:
explicit
HalfFaceHandle
(
int
_idx
=
-
1
)
:
OpenVolumeMeshHandle
(
_idx
)
{}
};
using
VertexHandle
=
HandleT
<
Entity
::
Vertex
>
;
using
HalfEdgeHandle
=
HandleT
<
Entity
::
HalfEdge
>
;
using
EdgeHandle
=
HandleT
<
Entity
::
Edge
>
;
using
HalfFaceHandle
=
HandleT
<
Entity
::
HalfFace
>
;
using
FaceHandle
=
HandleT
<
Entity
::
Face
>
;
using
CellHandle
=
HandleT
<
Entity
::
Cell
>
;
using
MeshHandle
=
HandleT
<
Entity
::
Mesh
>
;
// Helper class that is used to decrease all handles
// exceeding a certain threshold
...
...
src/OpenVolumeMesh/Core/PropertyHandles.hh
View file @
fd68dccf
...
...
@@ -36,46 +36,26 @@
#pragma once
#include
"OpenVolumeMeshHandle.hh"
#include
"Entities.hh"
namespace
OpenVolumeMesh
{
// Defines for property handles
class
VertexPropHandle
:
public
OpenVolumeMeshHandle
{
public:
using
OpenVolumeMeshHandle
::
OpenVolumeMeshHandle
;
using
EntityHandleT
=
VertexHandle
;
};
class
EdgePropHandle
:
public
OpenVolumeMeshHandle
{
public:
using
OpenVolumeMeshHandle
::
OpenVolumeMeshHandle
;
using
EntityHandleT
=
EdgeHandle
;
};
class
HalfEdgePropHandle
:
public
OpenVolumeMeshHandle
{
public:
using
OpenVolumeMeshHandle
::
OpenVolumeMeshHandle
;
using
EntityHandleT
=
HalfEdgeHandle
;
};
class
FacePropHandle
:
public
OpenVolumeMeshHandle
{
public:
using
OpenVolumeMeshHandle
::
OpenVolumeMeshHandle
;
using
EntityHandleT
=
FaceHandle
;
};
class
HalfFacePropHandle
:
public
OpenVolumeMeshHandle
{
public:
using
OpenVolumeMeshHandle
::
OpenVolumeMeshHandle
;
using
EntityHandleT
=
HalfFaceHandle
;
};
class
CellPropHandle
:
public
OpenVolumeMeshHandle
{
public:
using
OpenVolumeMeshHandle
::
OpenVolumeMeshHandle
;
using
EntityHandleT
=
CellHandle
;
};
class
MeshPropHandle
:
public
OpenVolumeMeshHandle
template
<
typename
EntityTag
,
typename
=
typename
std
::
enable_if
<
is_entity
<
EntityTag
>
::
value
>::
type
>
class
PropHandleT
:
public
OpenVolumeMeshHandle
{
public:
using
Entity
=
EntityTag
;
using
OpenVolumeMeshHandle
::
OpenVolumeMeshHandle
;
using
EntityHandleT
=
OpenVolumeMeshHandle
;
};
using
VertexPropHandle
=
PropHandleT
<
Entity
::
Vertex
>
;
using
EdgePropHandle
=
PropHandleT
<
Entity
::
Edge
>
;
using
HalfEdgePropHandle
=
PropHandleT
<
Entity
::
HalfEdge
>
;
using
FacePropHandle
=
PropHandleT
<
Entity
::
Face
>
;
using
HalfFacePropHandle
=
PropHandleT
<
Entity
::
HalfFace
>
;
using
CellPropHandle
=
PropHandleT
<
Entity
::
Cell
>
;
using
MeshPropHandle
=
PropHandleT
<
Entity
::
Mesh
>
;
}
// Namespace OpenVolumeMesh
src/OpenVolumeMesh/Core/PropertyPtr.hh
View file @
fd68dccf
...
...
@@ -74,7 +74,7 @@ public:
typedef
typename
PropT
::
reference
reference
;
typedef
typename
PropT
::
const_reference
const_reference
;
typedef
typename
HandleT
::
Entity
HandleT
EntityHandleT
;
typedef
OpenVolumeMesh
::
HandleT
<
typename
HandleT
::
Entity
>
EntityHandleT
;
/// Constructor
PropertyPtr
(
PropT
*
_ptr
,
ResourceManager
&
_resMan
,
HandleT
_handle
);
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment