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
Özgür Ozan Sen
ogs
Commits
d37f686d
Commit
d37f686d
authored
11 years ago
by
Karsten Rink
Browse files
Options
Downloads
Patches
Plain Diff
setting element status and getting total numbers of nodes and elems
parent
276ef1e6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
MeshLib/ElementStatus.cpp
+29
-0
29 additions, 0 deletions
MeshLib/ElementStatus.cpp
MeshLib/ElementStatus.h
+9
-6
9 additions, 6 deletions
MeshLib/ElementStatus.h
with
38 additions
and
6 deletions
MeshLib/ElementStatus.cpp
+
29
−
0
View file @
d37f686d
...
@@ -14,13 +14,42 @@
...
@@ -14,13 +14,42 @@
#include
"ElementStatus.h"
#include
"ElementStatus.h"
#include
"Mesh.h"
#include
"Node.h"
#include
"Elements/Element.h"
namespace
MeshLib
{
namespace
MeshLib
{
ElementStatus
::
ElementStatus
(
Mesh
const
*
const
mesh
)
ElementStatus
::
ElementStatus
(
Mesh
const
*
const
mesh
)
:
_mesh
(
mesh
),
_element_status
(
mesh
->
getNElements
(),
true
)
:
_mesh
(
mesh
),
_element_status
(
mesh
->
getNElements
(),
true
)
{
{
const
std
::
vector
<
MeshLib
::
Node
*>
&
nodes
(
_mesh
->
getNodes
());
for
(
auto
node
=
nodes
.
begin
();
node
!=
nodes
.
end
();
++
node
)
_active_nodes
.
push_back
((
*
node
)
->
getNElements
());
}
}
unsigned
ElementStatus
::
getNActiveNodes
()
const
{
return
_active_nodes
.
size
()
-
std
::
count
(
_active_nodes
.
begin
(),
_active_nodes
.
end
(),
0
);
}
unsigned
ElementStatus
::
getNActiveElements
()
const
{
return
static_cast
<
unsigned
>
(
std
::
count
(
_element_status
.
begin
(),
_element_status
.
end
(),
true
));
}
void
ElementStatus
::
setElementStatus
(
unsigned
i
,
bool
status
)
{
if
(
_element_status
[
i
]
!=
status
)
{
const
int
change
=
(
status
)
?
1
:
-
1
;
_element_status
[
i
]
=
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
)
_active_nodes
[
nodes
[
i
]
->
getID
()]
+=
change
;
}
}
}
}
This diff is collapsed.
Click to expand it.
MeshLib/ElementStatus.h
+
9
−
6
View file @
d37f686d
...
@@ -15,9 +15,11 @@
...
@@ -15,9 +15,11 @@
#ifndef ELEMENTSTATUS_H_
#ifndef ELEMENTSTATUS_H_
#define ELEMENTSTATUS_H_
#define ELEMENTSTATUS_H_
#include
"Mesh.h"
#include
<vector>
namespace
MeshLib
{
namespace
MeshLib
{
class
Mesh
;
class
Element
;
/**
/**
* Manages active/inactive mesh elements and their nodes
* Manages active/inactive mesh elements and their nodes
...
@@ -27,7 +29,7 @@ class ElementStatus
...
@@ -27,7 +29,7 @@ class ElementStatus
public:
public:
/// Constructor
/// Constructor
ElementStatus
(
Mesh
const
*
const
mesh
);
ElementStatus
(
Mesh
Lib
::
Mesh
const
*
const
mesh
);
/// Returns a vector of active element IDs
/// Returns a vector of active element IDs
std
::
vector
<
unsigned
>
getActiveElements
()
const
{};
std
::
vector
<
unsigned
>
getActiveElements
()
const
{};
...
@@ -42,16 +44,16 @@ public:
...
@@ -42,16 +44,16 @@ public:
std
::
vector
<
MeshLib
::
Element
*>
getActiveElements
(
unsigned
node_id
)
const
{};
std
::
vector
<
MeshLib
::
Element
*>
getActiveElements
(
unsigned
node_id
)
const
{};
/// Returns the total number of active nodes
/// Returns the total number of active nodes
unsigned
getNActiveNodes
()
const
{}
;
unsigned
getNActiveNodes
()
const
;
/// Returns the total number of active elements
/// Returns the total number of active elements
unsigned
getNActiveElements
()
const
{}
;
unsigned
getNActiveElements
()
const
;
/// Returns the status of element
/// Returns the status of element
bool
isActive
(
unsigned
i
)
const
{
return
_element_status
[
i
];
}
bool
isActive
(
unsigned
i
)
const
{
return
_element_status
[
i
];
}
/// Sets the status of element i
/// Sets the status of element i
void
setElementStatus
(
unsigned
i
,
bool
status
)
{
_element_status
[
i
]
=
status
;
}
void
setElementStatus
(
unsigned
i
,
bool
status
)
;
/// Sets the status of material group i
/// Sets the status of material group i
void
setMaterialStatus
(
unsigned
i
,
bool
status
)
{};
void
setMaterialStatus
(
unsigned
i
,
bool
status
)
{};
...
@@ -59,8 +61,9 @@ public:
...
@@ -59,8 +61,9 @@ public:
~
ElementStatus
()
{};
~
ElementStatus
()
{};
protected
:
protected
:
Mesh
const
*
const
_mesh
;
MeshLib
::
Mesh
const
*
const
_mesh
;
std
::
vector
<
bool
>
_element_status
;
std
::
vector
<
bool
>
_element_status
;
std
::
vector
<
char
>
_active_nodes
;
};
/* class */
};
/* 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