Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
OpenVolumeMesh
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
7
Issues
7
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenVolumeMesh
OpenVolumeMesh
Commits
f69d1edd
Commit
f69d1edd
authored
Mar 13, 2019
by
Martin Heistermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handles: some support for construction from / conversion to size_t
parent
8ec177ed
Pipeline
#9179
passed with stage
in 3 minutes and 33 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
12 deletions
+26
-12
src/OpenVolumeMesh/Core/OpenVolumeMeshHandle.hh
src/OpenVolumeMesh/Core/OpenVolumeMeshHandle.hh
+19
-5
src/OpenVolumeMesh/Core/PropertyPtr.hh
src/OpenVolumeMesh/Core/PropertyPtr.hh
+1
-1
src/OpenVolumeMesh/Core/ResourceManager.cc
src/OpenVolumeMesh/Core/ResourceManager.cc
+6
-6
No files found.
src/OpenVolumeMesh/Core/OpenVolumeMeshHandle.hh
View file @
f69d1edd
...
@@ -37,6 +37,8 @@
...
@@ -37,6 +37,8 @@
#include <algorithm>
#include <algorithm>
#include <iosfwd>
#include <iosfwd>
#include <vector>
#include <vector>
#include <cassert>
#include <limits>
#include "Entities.hh"
#include "Entities.hh"
#include "../System/FunctionalInclude.hh"
#include "../System/FunctionalInclude.hh"
...
@@ -48,17 +50,15 @@ namespace OpenVolumeMesh {
...
@@ -48,17 +50,15 @@ namespace OpenVolumeMesh {
class
OpenVolumeMeshHandle
{
class
OpenVolumeMeshHandle
{
public:
public:
// Default constructor
// Default constructor
explicit
OpenVolumeMeshHandle
(
int
_idx
)
:
idx_
(
_idx
)
{};
explicit
OpenVolumeMeshHandle
(
int
_idx
)
:
idx_
(
_idx
)
{}
OpenVolumeMeshHandle
&
operator
=
(
int
_idx
)
{
OpenVolumeMeshHandle
&
operator
=
(
int
_idx
)
{
idx_
=
_idx
;
idx_
=
_idx
;
return
*
this
;
return
*
this
;
}
}
OpenVolumeMeshHandle
&
operator
=
(
const
OpenVolumeMeshHandle
&
_idx
)
{
OpenVolumeMeshHandle
(
const
OpenVolumeMeshHandle
&
_idx
)
=
default
;
idx_
=
_idx
.
idx_
;
OpenVolumeMeshHandle
&
operator
=
(
const
OpenVolumeMeshHandle
&
_idx
)
=
default
;
return
*
this
;
}
inline
bool
is_valid
()
const
{
return
idx_
!=
-
1
;
}
inline
bool
is_valid
()
const
{
return
idx_
!=
-
1
;
}
...
@@ -76,6 +76,9 @@ public:
...
@@ -76,6 +76,9 @@ public:
inline
const
int
&
idx
()
const
{
return
idx_
;
}
inline
const
int
&
idx
()
const
{
return
idx_
;
}
/// return unsigned idx - handle must be valid
inline
size_t
uidx
()
const
{
assert
(
is_valid
());
return
static_cast
<
size_t
>
(
idx_
);
}
void
idx
(
const
int
&
_idx
)
{
idx_
=
_idx
;
}
void
idx
(
const
int
&
_idx
)
{
idx_
=
_idx
;
}
OVM_DEPRECATED
(
"use explicit .idx() instead"
)
OVM_DEPRECATED
(
"use explicit .idx() instead"
)
...
@@ -95,6 +98,17 @@ class HandleT : public OpenVolumeMeshHandle
...
@@ -95,6 +98,17 @@ class HandleT : public OpenVolumeMeshHandle
public:
public:
using
Entity
=
EntityTag
;
using
Entity
=
EntityTag
;
explicit
HandleT
(
int
_idx
=
-
1
)
:
OpenVolumeMeshHandle
(
_idx
)
{}
explicit
HandleT
(
int
_idx
=
-
1
)
:
OpenVolumeMeshHandle
(
_idx
)
{}
static
HandleT
<
EntityTag
>
from_unsigned
(
size_t
_idx
)
{
if
(
_idx
<=
std
::
numeric_limits
<
int
>::
max
())
{
return
HandleT
<
EntityTag
>
(
static_cast
<
int
>
(
_idx
));
}
else
{
assert
(
false
);
return
HandleT
<
EntityTag
>
(
-
1
);
}
}
};
};
// Default entity handles
// Default entity handles
...
...
src/OpenVolumeMesh/Core/PropertyPtr.hh
View file @
f69d1edd
...
@@ -99,7 +99,7 @@ public:
...
@@ -99,7 +99,7 @@ public:
const_reference
operator
[](
size_t
_idx
)
const
{
return
(
*
ptr
::
shared_ptr
<
PropT
>::
get
())[
_idx
];
}
const_reference
operator
[](
size_t
_idx
)
const
{
return
(
*
ptr
::
shared_ptr
<
PropT
>::
get
())[
_idx
];
}
reference
operator
[](
const
EntityHandleT
&
_h
)
{
return
(
*
ptr
::
shared_ptr
<
PropT
>::
get
())[
_h
.
idx
()];
}
reference
operator
[](
const
EntityHandleT
&
_h
)
{
return
(
*
ptr
::
shared_ptr
<
PropT
>::
get
())[
_h
.
idx
()];
}
const_reference
operator
[](
const
EntityHandleT
&
_h
)
const
{
return
(
*
ptr
::
shared_ptr
<
PropT
>::
get
())[
_h
.
idx
()];
}
const_reference
operator
[](
const
EntityHandleT
&
_h
)
const
{
return
(
*
ptr
::
shared_ptr
<
PropT
>::
get
())[
_h
.
u
idx
()];
}
virtual
void
serialize
(
std
::
ostream
&
_ostr
)
const
{
ptr
::
shared_ptr
<
PropT
>::
get
()
->
serialize
(
_ostr
);
}
virtual
void
serialize
(
std
::
ostream
&
_ostr
)
const
{
ptr
::
shared_ptr
<
PropT
>::
get
()
->
serialize
(
_ostr
);
}
virtual
void
deserialize
(
std
::
istream
&
_istr
)
{
ptr
::
shared_ptr
<
PropT
>::
get
()
->
deserialize
(
_istr
);
}
virtual
void
deserialize
(
std
::
istream
&
_istr
)
{
ptr
::
shared_ptr
<
PropT
>::
get
()
->
deserialize
(
_istr
);
}
...
...
src/OpenVolumeMesh/Core/ResourceManager.cc
View file @
f69d1edd
...
@@ -178,32 +178,32 @@ void ResourceManager::swap_vertex_properties(VertexHandle _h1, VertexHandle _h2)
...
@@ -178,32 +178,32 @@ void ResourceManager::swap_vertex_properties(VertexHandle _h1, VertexHandle _h2)
void
ResourceManager
::
release_property
(
VertexPropHandle
_handle
)
{
void
ResourceManager
::
release_property
(
VertexPropHandle
_handle
)
{
remove_property
(
vertex_props_
,
_handle
.
idx
());
remove_property
(
vertex_props_
,
_handle
.
u
idx
());
}
}
void
ResourceManager
::
release_property
(
EdgePropHandle
_handle
)
{
void
ResourceManager
::
release_property
(
EdgePropHandle
_handle
)
{
remove_property
(
edge_props_
,
_handle
.
idx
());
remove_property
(
edge_props_
,
_handle
.
u
idx
());
}
}
void
ResourceManager
::
release_property
(
HalfEdgePropHandle
_handle
)
{
void
ResourceManager
::
release_property
(
HalfEdgePropHandle
_handle
)
{
remove_property
(
halfedge_props_
,
_handle
.
idx
());
remove_property
(
halfedge_props_
,
_handle
.
u
idx
());
}
}
void
ResourceManager
::
release_property
(
FacePropHandle
_handle
)
{
void
ResourceManager
::
release_property
(
FacePropHandle
_handle
)
{
remove_property
(
face_props_
,
_handle
.
idx
());
remove_property
(
face_props_
,
_handle
.
u
idx
());
}
}
void
ResourceManager
::
release_property
(
HalfFacePropHandle
_handle
)
{
void
ResourceManager
::
release_property
(
HalfFacePropHandle
_handle
)
{
remove_property
(
halfface_props_
,
_handle
.
idx
());
remove_property
(
halfface_props_
,
_handle
.
u
idx
());
}
}
void
ResourceManager
::
release_property
(
CellPropHandle
_handle
)
{
void
ResourceManager
::
release_property
(
CellPropHandle
_handle
)
{
remove_property
(
cell_props_
,
_handle
.
idx
());
remove_property
(
cell_props_
,
_handle
.
u
idx
());
}
}
void
ResourceManager
::
release_property
(
MeshPropHandle
_handle
)
{
void
ResourceManager
::
release_property
(
MeshPropHandle
_handle
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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