Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
OpenVolumeMesh
OpenVolumeMesh
Commits
ba19b93a
Commit
ba19b93a
authored
May 21, 2019
by
Martin Heistermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implement/improve mesh assignment
parent
29a2730e
Pipeline
#10415
passed with stage
in 4 minutes and 5 seconds
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
51 additions
and
5 deletions
+51
-5
src/OpenVolumeMesh/Core/BaseProperty.hh
src/OpenVolumeMesh/Core/BaseProperty.hh
+5
-0
src/OpenVolumeMesh/Core/GeometryKernel.hh
src/OpenVolumeMesh/Core/GeometryKernel.hh
+5
-0
src/OpenVolumeMesh/Core/PropertyPtr.hh
src/OpenVolumeMesh/Core/PropertyPtr.hh
+2
-0
src/OpenVolumeMesh/Core/PropertyPtrT_impl.hh
src/OpenVolumeMesh/Core/PropertyPtrT_impl.hh
+7
-0
src/OpenVolumeMesh/Core/ResourceManager.cc
src/OpenVolumeMesh/Core/ResourceManager.cc
+29
-5
src/OpenVolumeMesh/Core/TopologyKernel.hh
src/OpenVolumeMesh/Core/TopologyKernel.hh
+3
-0
No files found.
src/OpenVolumeMesh/Core/BaseProperty.hh
View file @
ba19b93a
...
@@ -62,6 +62,7 @@ public:
...
@@ -62,6 +62,7 @@ public:
BaseProperty
&
operator
=
(
const
BaseProperty
&
_cpy
)
=
delete
;
BaseProperty
&
operator
=
(
const
BaseProperty
&
_cpy
)
=
delete
;
virtual
~
BaseProperty
()
{}
virtual
~
BaseProperty
()
{}
virtual
const
std
::
string
&
name
()
const
=
0
;
virtual
const
std
::
string
&
name
()
const
=
0
;
...
@@ -92,6 +93,10 @@ public:
...
@@ -92,6 +93,10 @@ public:
protected:
protected:
/// Copy data from other property. `other` MUST point to an object with the same type as `this`!
/// Currently no type check is performed.
virtual
void
assign_values_from
(
const
BaseProperty
*
other
)
=
0
;
virtual
void
delete_multiple_entries
(
const
std
::
vector
<
bool
>&
_tags
)
=
0
;
virtual
void
delete_multiple_entries
(
const
std
::
vector
<
bool
>&
_tags
)
=
0
;
virtual
void
resize
(
size_t
/*_size*/
)
=
0
;
virtual
void
resize
(
size_t
/*_size*/
)
=
0
;
...
...
src/OpenVolumeMesh/Core/GeometryKernel.hh
View file @
ba19b93a
...
@@ -64,6 +64,11 @@ public:
...
@@ -64,6 +64,11 @@ public:
/// Destructor
/// Destructor
~
GeometryKernel
()
=
default
;
~
GeometryKernel
()
=
default
;
template
<
class
OtherTopoKernel
>
void
assign
(
const
GeometryKernel
<
VecT
,
OtherTopoKernel
>
*
other
)
{
TopologyKernelT
::
assign
(
other
);
other
->
clone_vertices
(
vertices_
);
}
/// Override of empty add_vertex function
/// Override of empty add_vertex function
virtual
VertexHandle
add_vertex
()
{
return
add_vertex
(
VecT
());
}
virtual
VertexHandle
add_vertex
()
{
return
add_vertex
(
VecT
());
}
...
...
src/OpenVolumeMesh/Core/PropertyPtr.hh
View file @
ba19b93a
...
@@ -115,6 +115,8 @@ public:
...
@@ -115,6 +115,8 @@ public:
protected:
protected:
void
assign_values_from
(
const
BaseProperty
*
other
)
override
;
virtual
void
delete_multiple_entries
(
const
std
::
vector
<
bool
>&
_tags
);
virtual
void
delete_multiple_entries
(
const
std
::
vector
<
bool
>&
_tags
);
virtual
void
resize
(
size_t
_size
);
virtual
void
resize
(
size_t
_size
);
...
...
src/OpenVolumeMesh/Core/PropertyPtrT_impl.hh
View file @
ba19b93a
...
@@ -59,6 +59,13 @@ PropertyPtr<PropT,Entity>::~PropertyPtr() {
...
@@ -59,6 +59,13 @@ PropertyPtr<PropT,Entity>::~PropertyPtr() {
}
}
}
}
template
<
class
PropT
,
typename
Entity
>
void
PropertyPtr
<
PropT
,
Entity
>::
assign_values_from
(
const
BaseProperty
*
other
)
{
auto
_other
=
static_cast
<
const
PropertyPtr
<
PropT
,
Entity
>*>
(
other
);
// FIXME: would be nice to perform a type check here
ptr
::
shared_ptr
<
PropT
>::
get
()
->
data_vector
()
=
_other
->
get
()
->
data_vector
();
}
template
<
class
PropT
,
typename
Entity
>
template
<
class
PropT
,
typename
Entity
>
void
PropertyPtr
<
PropT
,
Entity
>::
resize
(
size_t
_size
)
{
void
PropertyPtr
<
PropT
,
Entity
>::
resize
(
size_t
_size
)
{
ptr
::
shared_ptr
<
PropT
>::
get
()
->
resize
(
_size
);
ptr
::
shared_ptr
<
PropT
>::
get
()
->
resize
(
_size
);
...
...
src/OpenVolumeMesh/Core/ResourceManager.cc
View file @
ba19b93a
...
@@ -51,11 +51,34 @@ ResourceManager& ResourceManager::operator=(const ResourceManager &other)
...
@@ -51,11 +51,34 @@ ResourceManager& ResourceManager::operator=(const ResourceManager &other)
if
(
this
==
&
other
)
if
(
this
==
&
other
)
return
*
this
;
return
*
this
;
auto
cloneProps
=
[
this
](
const
Properties
&
src
,
Properties
&
dest
)
{
auto
cloneProps
=
[
this
](
const
Properties
&
src
,
Properties
&
dest
)
dest
.
reserve
(
src
.
size
());
{
for
(
BaseProperty
*
bp
:
src
)
{
// If possible, re-use existing properties instead of copying
dest
.
push_back
(
bp
->
clone
(
*
this
,
bp
->
handle
()));
// everything blindly.
// This way, references to properties of `this` do not expire
// if a corresponding property exists in `other`, e.g. attributes.
Properties
out
;
out
.
reserve
(
src
.
size
());
for
(
BaseProperty
*
srcprop
:
src
)
{
bool
found
=
false
;
for
(
auto
it
=
dest
.
begin
();
it
!=
dest
.
end
();
++
it
)
{
auto
dstprop
=
*
it
;
if
(
dstprop
->
name
()
==
srcprop
->
name
())
{
// TODO: type check
out
.
push_back
(
dstprop
);
dest
.
erase
(
it
);
dstprop
->
assign_values_from
(
srcprop
);
found
=
true
;
break
;
}
}
if
(
!
found
)
{
out
.
push_back
(
srcprop
->
clone
(
*
this
,
OpenVolumeMeshHandle
(
-
1
)));
}
}
}
updatePropHandles
(
out
);
dest
=
std
::
move
(
out
);
};
};
cloneProps
(
other
.
vertex_props_
,
vertex_props_
);
cloneProps
(
other
.
vertex_props_
,
vertex_props_
);
cloneProps
(
other
.
edge_props_
,
edge_props_
);
cloneProps
(
other
.
edge_props_
,
edge_props_
);
...
@@ -72,7 +95,8 @@ ResourceManager& ResourceManager::operator=(ResourceManager &&other)
...
@@ -72,7 +95,8 @@ ResourceManager& ResourceManager::operator=(ResourceManager &&other)
if
(
this
==
&
other
)
if
(
this
==
&
other
)
return
*
this
;
return
*
this
;
auto
moveProps
=
[
this
](
Properties
&&
src
,
Properties
&
dest
)
{
auto
moveProps
=
[
this
](
Properties
&&
src
,
Properties
&
dest
){
// TODO: check for existing properties and move data contents instead of Property classes
dest
=
std
::
move
(
src
);
dest
=
std
::
move
(
src
);
for
(
auto
prop
:
dest
)
{
for
(
auto
prop
:
dest
)
{
prop
->
setResMan
(
this
);
prop
->
setResMan
(
this
);
...
...
src/OpenVolumeMesh/Core/TopologyKernel.hh
View file @
ba19b93a
...
@@ -62,6 +62,9 @@ public:
...
@@ -62,6 +62,9 @@ public:
TopologyKernel
&
operator
=
(
const
TopologyKernel
&
)
=
default
;
TopologyKernel
&
operator
=
(
const
TopologyKernel
&
)
=
default
;
void
assign
(
const
TopologyKernel
*
other
)
{
*
this
=
*
other
;
}
/*
/*
* Defines and constants
* Defines and constants
...
...
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