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
Snippets
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
Dmitri Naumov
ogs
Commits
c34e417e
Commit
c34e417e
authored
10 years ago
by
Norihiro Watanabe
Browse files
Options
Downloads
Patches
Plain Diff
add a function to search connected element ids
parent
bb11199e
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/MeshSearcher.cpp
+34
-0
34 additions, 0 deletions
MeshLib/MeshSearcher.cpp
MeshLib/MeshSearcher.h
+31
-0
31 additions, 0 deletions
MeshLib/MeshSearcher.h
with
65 additions
and
0 deletions
MeshLib/MeshSearcher.cpp
0 → 100644
+
34
−
0
View file @
c34e417e
/**
* \copyright
* Copyright (c) 2013, OpenGeoSys Community (http://www.opengeosys.org)
* Distributed under a Modified BSD License.
* See accompanying file LICENSE.txt or
* http://www.opengeosys.org/project/license
*
*/
#include
"MeshSearcher.h"
#include
"Mesh.h"
#include
"Node.h"
#include
"Elements/Element.h"
namespace
MeshLib
{
std
::
vector
<
std
::
size_t
>
getConnectedElements
(
MeshLib
::
Mesh
const
&
msh
,
const
std
::
vector
<
std
::
size_t
>
&
nodes
)
{
std
::
vector
<
std
::
size_t
>
connected_elements
;
for
(
auto
*
e
:
msh
.
getElements
())
{
for
(
std
::
size_t
j
=
0
;
j
<
e
->
getNNodes
();
j
++
)
{
if
(
std
::
find
(
nodes
.
begin
(),
nodes
.
end
(),
e
->
getNodeIndex
(
j
))
!=
nodes
.
end
())
{
connected_elements
.
push_back
(
e
->
getID
());
break
;
}
}
}
return
connected_elements
;
}
}
// end namespace MeshLib
This diff is collapsed.
Click to expand it.
MeshLib/MeshSearcher.h
0 → 100644
+
31
−
0
View file @
c34e417e
/**
* \copyright
* Copyright (c) 2013, OpenGeoSys Community (http://www.opengeosys.org)
* Distributed under a Modified BSD License.
* See accompanying file LICENSE.txt or
* http://www.opengeosys.org/project/license
*
*/
#ifndef MESHSEARCHER_H_
#define MESHSEARCHER_H_
#include
<vector>
namespace
MeshLib
{
// forward declarations
class
Mesh
;
/**
* get a list of elements connected to given nodes
* @param msh a mesh object
* @param node_ids a vector of mesh node ids
* @return a vector of element ids which connect to the given nodes
*/
std
::
vector
<
std
::
size_t
>
getConnectedElementIDs
(
MeshLib
::
Mesh
const
&
msh
,
const
std
::
vector
<
std
::
size_t
>
&
node_ids
);
}
// end namespace MeshLib
#endif //MESHSEARCHER_H_
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