Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
ogs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Yuhao Liu
ogs
Commits
4440fee5
Commit
4440fee5
authored
9 years ago
by
Tom Fischer
Browse files
Options
Downloads
Patches
Plain Diff
[MeL/MS] Initial impl. of searchByPropertyValue().
parent
11b22c77
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
MeshLib/MeshSearch/ElementSearch.cpp
+0
-1
0 additions, 1 deletion
MeshLib/MeshSearch/ElementSearch.cpp
MeshLib/MeshSearch/ElementSearch.h
+42
-0
42 additions, 0 deletions
MeshLib/MeshSearch/ElementSearch.h
with
42 additions
and
1 deletion
MeshLib/MeshSearch/ElementSearch.cpp
+
0
−
1
View file @
4440fee5
...
...
@@ -11,7 +11,6 @@
#include
<logog/include/logog.hpp>
#include
"MeshLib/Mesh.h"
#include
"MeshLib/Node.h"
#include
"MeshLib/Elements/Element.h"
...
...
This diff is collapsed.
Click to expand it.
MeshLib/MeshSearch/ElementSearch.h
+
42
−
0
View file @
4440fee5
...
...
@@ -14,6 +14,7 @@
#include
<vector>
#include
"GeoLib/AABB.h"
#include
"MeshLib/Mesh.h"
#include
"MeshLib/MeshEnums.h"
namespace
MeshLib
{
...
...
@@ -31,6 +32,47 @@ public:
/// return marked elements
const
std
::
vector
<
std
::
size_t
>&
getSearchedElementIDs
()
const
{
return
_marked_elements
;
}
/// @tparam PROPERTY_TYPE integral type of the property
/// Different properties can be assigned to the elements of the mesh. These
/// properties can be accessed by the name of the property. The method marks
/// all elements of the mesh for the property \c property_name with the
/// given property value \c property_value.
/// @param property_value the value of the property the elements have to
/// have to be marked
/// @param property_name the name of the property the searching/marking is
/// based on
/// @return The number of marked elements will be returned. The concrete
/// element ids can be requested by getSearchedElementIDs().
template
<
typename
PROPERTY_TYPE
>
std
::
size_t
searchByPropertyValue
(
PROPERTY_TYPE
const
property_value
,
std
::
string
const
&
property_name
=
"MaterialIDs"
)
{
boost
::
optional
<
MeshLib
::
PropertyVector
<
PROPERTY_TYPE
>
const
&>
opt_pv
(
_mesh
.
getProperties
().
getPropertyVector
<
PROPERTY_TYPE
>
(
property_name
));
if
(
!
opt_pv
)
{
WARN
(
"Property
\"
%s
\"
not found in mesh."
,
property_name
.
c_str
());
return
0
;
}
MeshLib
::
PropertyVector
<
PROPERTY_TYPE
>
const
&
pv
(
opt_pv
.
get
());
if
(
pv
.
getMeshItemType
()
!=
MeshLib
::
MeshItemType
::
Cell
)
{
WARN
(
"The property
\"
%s
\"
is not assigned to mesh elements."
,
property_name
.
c_str
());
return
0
;
}
std
::
vector
<
std
::
size_t
>
matchedIDs
;
for
(
std
::
size_t
i
(
0
);
i
<
pv
.
getNumberOfTuples
();
++
i
)
{
if
(
pv
[
i
]
==
property_value
)
matchedIDs
.
push_back
(
i
);
}
updateUnion
(
matchedIDs
);
return
matchedIDs
.
size
();
}
/// Marks all elements with the given Material ID.
std
::
size_t
searchByMaterialID
(
int
const
matID
);
...
...
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