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 / Register
Toggle navigation
Open sidebar
CMB
SMTK
Commits
b56cde38
Commit
b56cde38
authored
Oct 31, 2018
by
T.J. Corona
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
smtk::mesh::Collection: visit()
parent
3a3aa930
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
2 deletions
+37
-2
smtk/mesh/core/Collection.cxx
smtk/mesh/core/Collection.cxx
+21
-2
smtk/mesh/testing/cxx/UnitTestMeshSet.cxx
smtk/mesh/testing/cxx/UnitTestMeshSet.cxx
+16
-0
No files found.
smtk/mesh/core/Collection.cxx
View file @
b56cde38
...
...
@@ -120,8 +120,27 @@ std::function<bool(const resource::ComponentPtr&)> Collection::queryOperation(
// visit all components in the resource.
void
Collection
::
visit
(
smtk
::
resource
::
Component
::
Visitor
&
visitor
)
const
{
// TODO
(
void
)
visitor
;
class
Visit
:
public
smtk
::
mesh
::
MeshForEach
{
public:
Visit
(
smtk
::
resource
::
Component
::
Visitor
&
visitor
)
:
smtk
::
mesh
::
MeshForEach
()
,
m_visitor
(
visitor
)
{
}
void
forMesh
(
smtk
::
mesh
::
MeshSet
&
mesh
)
override
{
m_visitor
(
smtk
::
mesh
::
Component
::
create
(
mesh
));
}
private:
smtk
::
resource
::
Component
::
Visitor
&
m_visitor
;
};
Visit
visit_
(
visitor
);
smtk
::
mesh
::
for_each
(
this
->
meshes
(),
visit_
);
}
const
smtk
::
mesh
::
InterfacePtr
&
Collection
::
interface
()
const
...
...
smtk/mesh/testing/cxx/UnitTestMeshSet.cxx
View file @
b56cde38
...
...
@@ -10,6 +10,7 @@
#include "smtk/io/ImportMesh.h"
#include "smtk/mesh/core/Collection.h"
#include "smtk/mesh/core/Component.h"
#include "smtk/mesh/testing/cxx/helpers.h"
...
...
@@ -399,6 +400,20 @@ void verify_meshset_for_each(const smtk::mesh::CollectionPtr& c)
test
(
static_cast
<
std
::
size_t
>
(
functor
.
numberOfMeshesVisited
())
==
volMeshes
.
size
());
test
(
functor
.
cells
()
==
volMeshes
.
cells
());
}
void
verify_meshset_visit
(
const
smtk
::
mesh
::
CollectionPtr
&
c
)
{
std
::
size_t
numMeshesIteratedOver
=
0
;
smtk
::
resource
::
Component
::
Visitor
countMeshesAndCells
=
[
&
](
const
smtk
::
resource
::
ComponentPtr
&
component
)
{
auto
meshComponent
=
std
::
dynamic_pointer_cast
<
smtk
::
mesh
::
Component
>
(
component
);
numMeshesIteratedOver
++
;
};
c
->
visit
(
countMeshesAndCells
);
test
(
numMeshesIteratedOver
==
c
->
meshes
().
size
());
}
}
int
UnitTestMeshSet
(
int
,
char
**
const
)
...
...
@@ -420,6 +435,7 @@ int UnitTestMeshSet(int, char** const)
verify_meshset_subtract
(
c
);
verify_meshset_for_each
(
c
);
verify_meshset_visit
(
c
);
return
0
;
}
David Thompson
@dcthomp
mentioned in commit
8c6c6073
·
Oct 31, 2018
mentioned in commit
8c6c6073
mentioned in commit 8c6c6073856fb0e38b1921067a6d4896ec08b0d2
Toggle commit list
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