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
Karsten Rink
ogs
Commits
18e09968
Commit
18e09968
authored
11 years ago
by
Karsten Rink
Browse files
Options
Downloads
Patches
Plain Diff
changed return type for connected active elements of a node to unsigned int
parent
e918f522
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/ElementStatus.cpp
+12
-16
12 additions, 16 deletions
MeshLib/ElementStatus.cpp
MeshLib/ElementStatus.h
+2
-2
2 additions, 2 deletions
MeshLib/ElementStatus.h
with
14 additions
and
18 deletions
MeshLib/ElementStatus.cpp
+
12
−
16
View file @
18e09968
...
...
@@ -51,30 +51,23 @@ std::vector<unsigned> ElementStatus::getActiveNodes() const
return
active_nodes
;
}
std
::
vector
<
MeshLib
::
Element
*
>
ElementStatus
::
getActiveElementsAtNode
(
unsigned
node_id
)
const
std
::
vector
<
unsigned
>
ElementStatus
::
getActiveElementsAtNode
(
unsigned
node_id
)
const
{
const
auto
mesh_elements_start
(
_mesh
->
getElements
().
begin
());
const
auto
mesh_elements_end
(
_mesh
->
getElements
().
end
());
const
unsigned
nElems
(
_mesh
->
getNode
(
node_id
)
->
getNElements
());
const
unsigned
nActiveElements
(
_active_nodes
[
node_id
]);
const
std
::
vector
<
Element
*>
&
elements
(
_mesh
->
getNode
(
node_id
)
->
getElements
());
std
::
vector
<
MeshLib
::
Element
*
>
active_elements
;
const
std
::
vector
<
Element
*>
&
node_
elements
(
_mesh
->
getNode
(
node_id
)
->
getElements
());
std
::
vector
<
unsigned
>
active_elements
;
active_elements
.
reserve
(
nActiveElements
);
for
(
unsigned
i
=
0
;
i
<
nElems
;
++
i
)
{
// if all active elements are found, the test can be cancelled for the rest of the connected elements
if
(
active_elements
.
size
()
==
nActiveElements
)
return
active_elements
;
const
unsigned
nElemNodes
(
elements
[
i
]
->
getNNodes
());
MeshLib
::
Node
const
*
const
*
const
nodes
=
elements
[
i
]
->
getNodes
();
bool
isActive
(
true
);
for
(
unsigned
j
=
0
;
j
<
nElemNodes
;
++
j
)
if
(
_active_nodes
[
nodes
[
j
]
->
getID
()]
==
0
)
{
isActive
=
false
;
break
;
}
if
(
isActive
)
active_elements
.
push_back
(
elements
[
i
]);
auto
it
=
std
::
find
(
mesh_elements_start
,
mesh_elements_end
,
node_elements
[
i
]);
const
unsigned
idx
(
static_cast
<
unsigned
>
(
it
-
mesh_elements_start
));
if
(
_element_status
[
idx
])
active_elements
.
push_back
(
idx
);
}
return
active_elements
;
}
...
...
@@ -98,7 +91,10 @@ void ElementStatus::setElementStatus(unsigned i, bool status)
const
unsigned
nElemNodes
(
_mesh
->
getElement
(
i
)
->
getNNodes
());
MeshLib
::
Node
const
*
const
*
const
nodes
=
_mesh
->
getElement
(
i
)
->
getNodes
();
for
(
unsigned
i
=
0
;
i
<
nElemNodes
;
++
i
)
{
assert
(
_active_nodes
[
i
]
<
255
);
// if one node has >255 connected elements the data type is too small
_active_nodes
[
nodes
[
i
]
->
getID
()]
+=
change
;
}
}
}
...
...
This diff is collapsed.
Click to expand it.
MeshLib/ElementStatus.h
+
2
−
2
View file @
18e09968
...
...
@@ -41,7 +41,7 @@ public:
bool
getElementStatus
(
unsigned
i
)
const
{
return
_element_status
[
i
];
}
/// Returns a vector of active elements connected to a node
std
::
vector
<
MeshLib
::
Element
*
>
getActiveElementsAtNode
(
unsigned
node_id
)
const
;
std
::
vector
<
unsigned
>
getActiveElementsAtNode
(
unsigned
node_id
)
const
;
/// Returns the total number of active nodes
unsigned
getNActiveNodes
()
const
;
...
...
@@ -66,7 +66,7 @@ protected:
/// Element status for each mesh element (active/inactive = true/false)
std
::
vector
<
bool
>
_element_status
;
/// Node status for each mesh node (value = number of active elements connected to node, 0 means inactive)
std
::
vector
<
char
>
_active_nodes
;
std
::
vector
<
unsigned
char
>
_active_nodes
;
};
/* class */
...
...
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