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
wenqing
ogs
Commits
a3f02051
Commit
a3f02051
authored
6 years ago
by
Christoph Lehmann
Browse files
Options
Downloads
Patches
Plain Diff
[NL] added convenience methods.
Get constrained DOF table for all vars/components.
parent
b11da2c0
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
NumLib/DOF/LocalToGlobalIndexMap.cpp
+38
-2
38 additions, 2 deletions
NumLib/DOF/LocalToGlobalIndexMap.cpp
NumLib/DOF/LocalToGlobalIndexMap.h
+25
-10
25 additions, 10 deletions
NumLib/DOF/LocalToGlobalIndexMap.h
with
63 additions
and
12 deletions
NumLib/DOF/LocalToGlobalIndexMap.cpp
+
38
−
2
View file @
a3f02051
...
@@ -191,7 +191,8 @@ LocalToGlobalIndexMap::LocalToGlobalIndexMap(
...
@@ -191,7 +191,8 @@ LocalToGlobalIndexMap::LocalToGlobalIndexMap(
std
::
vector
<
int
>
const
&
global_component_ids
,
std
::
vector
<
int
>
const
&
global_component_ids
,
std
::
vector
<
int
>
const
&
variable_component_offsets
,
std
::
vector
<
int
>
const
&
variable_component_offsets
,
std
::
vector
<
MeshLib
::
Element
*>
const
&
elements
,
std
::
vector
<
MeshLib
::
Element
*>
const
&
elements
,
NumLib
::
MeshComponentMap
&&
mesh_component_map
)
NumLib
::
MeshComponentMap
&&
mesh_component_map
,
LocalToGlobalIndexMap
::
ConstructorTag
)
:
_mesh_subsets
(
std
::
move
(
mesh_subsets
)),
:
_mesh_subsets
(
std
::
move
(
mesh_subsets
)),
_mesh_component_map
(
std
::
move
(
mesh_component_map
)),
_mesh_component_map
(
std
::
move
(
mesh_component_map
)),
_variable_component_offsets
(
variable_component_offsets
)
_variable_component_offsets
(
variable_component_offsets
)
...
@@ -249,7 +250,42 @@ LocalToGlobalIndexMap* LocalToGlobalIndexMap::deriveBoundaryConstrainedMap(
...
@@ -249,7 +250,42 @@ LocalToGlobalIndexMap* LocalToGlobalIndexMap::deriveBoundaryConstrainedMap(
return
new
LocalToGlobalIndexMap
(
return
new
LocalToGlobalIndexMap
(
std
::
move
(
all_mesh_subsets
),
global_component_ids
,
std
::
move
(
all_mesh_subsets
),
global_component_ids
,
_variable_component_offsets
,
elements
,
std
::
move
(
mesh_component_map
));
_variable_component_offsets
,
elements
,
std
::
move
(
mesh_component_map
),
ConstructorTag
{});
}
std
::
unique_ptr
<
LocalToGlobalIndexMap
>
LocalToGlobalIndexMap
::
deriveBoundaryConstrainedMap
(
MeshLib
::
MeshSubset
&&
new_mesh_subset
)
const
{
DBUG
(
"Construct reduced local to global index map."
);
// Create a subset of the current mesh component map.
std
::
vector
<
int
>
global_component_ids
;
for
(
int
i
=
0
;
i
<
getNumberOfComponents
();
++
i
)
{
global_component_ids
.
push_back
(
i
);
}
// Elements of the new_mesh_subset's mesh.
std
::
vector
<
MeshLib
::
Element
*>
const
&
elements
=
new_mesh_subset
.
getMesh
().
getElements
();
auto
mesh_component_map
=
_mesh_component_map
.
getSubset
(
_mesh_subsets
,
new_mesh_subset
,
global_component_ids
);
// Create copies of the new_mesh_subset for each of the global components.
// The last component is moved after the for-loop.
std
::
vector
<
MeshLib
::
MeshSubset
>
all_mesh_subsets
;
for
(
int
i
=
0
;
i
<
static_cast
<
int
>
(
global_component_ids
.
size
())
-
1
;
++
i
)
all_mesh_subsets
.
emplace_back
(
new_mesh_subset
);
all_mesh_subsets
.
emplace_back
(
std
::
move
(
new_mesh_subset
));
return
std
::
make_unique
<
LocalToGlobalIndexMap
>
(
std
::
move
(
all_mesh_subsets
),
global_component_ids
,
_variable_component_offsets
,
elements
,
std
::
move
(
mesh_component_map
),
ConstructorTag
{});
}
}
std
::
size_t
LocalToGlobalIndexMap
::
dofSizeWithGhosts
()
const
std
::
size_t
LocalToGlobalIndexMap
::
dofSizeWithGhosts
()
const
...
...
This diff is collapsed.
Click to expand it.
NumLib/DOF/LocalToGlobalIndexMap.h
+
25
−
10
View file @
a3f02051
...
@@ -41,6 +41,14 @@ namespace NumLib
...
@@ -41,6 +41,14 @@ namespace NumLib
/// mesh item.
/// mesh item.
class
LocalToGlobalIndexMap
final
class
LocalToGlobalIndexMap
final
{
{
// Enables using std::make_unique with private constructors from within
// member functions of LocalToGlobalIndexMap. Cf.
// http://seanmiddleditch.com/enabling-make_unique-with-private-constructors/
struct
ConstructorTag
{
explicit
ConstructorTag
()
=
default
;
};
public
:
public
:
using
RowColumnIndices
=
MathLib
::
RowColumnIndices
<
GlobalIndexType
>
;
using
RowColumnIndices
=
MathLib
::
RowColumnIndices
<
GlobalIndexType
>
;
using
LineIndex
=
RowColumnIndices
::
LineIndex
;
using
LineIndex
=
RowColumnIndices
::
LineIndex
;
...
@@ -90,6 +98,13 @@ public:
...
@@ -90,6 +98,13 @@ public:
std
::
vector
<
int
>
const
&
component_ids
,
std
::
vector
<
int
>
const
&
component_ids
,
MeshLib
::
MeshSubset
&&
mesh_subset
)
const
;
MeshLib
::
MeshSubset
&&
mesh_subset
)
const
;
/// Derive a LocalToGlobalIndexMap constrained to the mesh subset and mesh
/// subset's elements. A new mesh component map will be constructed using
/// the passed mesh_subset for all variables and components of the current
/// LocalToGlobalIndexMap.
std
::
unique_ptr
<
LocalToGlobalIndexMap
>
deriveBoundaryConstrainedMap
(
MeshLib
::
MeshSubset
&&
new_mesh_subset
)
const
;
/// Returns total number of degrees of freedom including those located in
/// Returns total number of degrees of freedom including those located in
/// the ghost nodes.
/// the ghost nodes.
std
::
size_t
dofSizeWithGhosts
()
const
;
std
::
size_t
dofSizeWithGhosts
()
const
;
...
@@ -144,10 +159,14 @@ public:
...
@@ -144,10 +159,14 @@ public:
MeshLib
::
MeshSubset
const
&
getMeshSubset
(
MeshLib
::
MeshSubset
const
&
getMeshSubset
(
int
const
global_component_id
)
const
;
int
const
global_component_id
)
const
;
private:
/// The global component id for the specific variable (like velocity) and a
/// Private constructor used by internally created local-to-global index
/// component (like x, or y, or z).
/// maps. The mesh_component_map is passed as argument instead of being
int
getGlobalComponent
(
int
const
variable_id
,
int
const
component_id
)
const
;
/// created by the constructor.
/// Private constructor (ensured by ConstructorTag) used by internally
/// created local-to-global index maps. The mesh_component_map is passed as
/// argument instead of being created by the constructor.
///
/// \attention The passed mesh_component_map is in undefined state after
/// \attention The passed mesh_component_map is in undefined state after
/// this construtor.
/// this construtor.
explicit
LocalToGlobalIndexMap
(
explicit
LocalToGlobalIndexMap
(
...
@@ -155,8 +174,9 @@ private:
...
@@ -155,8 +174,9 @@ private:
std
::
vector
<
int
>
const
&
global_component_ids
,
std
::
vector
<
int
>
const
&
global_component_ids
,
std
::
vector
<
int
>
const
&
variable_component_offsets
,
std
::
vector
<
int
>
const
&
variable_component_offsets
,
std
::
vector
<
MeshLib
::
Element
*>
const
&
elements
,
std
::
vector
<
MeshLib
::
Element
*>
const
&
elements
,
NumLib
::
MeshComponentMap
&&
mesh_component_map
);
NumLib
::
MeshComponentMap
&&
mesh_component_map
,
ConstructorTag
);
private
:
template
<
typename
ElementIterator
>
template
<
typename
ElementIterator
>
void
findGlobalIndices
(
ElementIterator
first
,
ElementIterator
last
,
void
findGlobalIndices
(
ElementIterator
first
,
ElementIterator
last
,
std
::
vector
<
MeshLib
::
Node
*>
const
&
nodes
,
std
::
vector
<
MeshLib
::
Node
*>
const
&
nodes
,
...
@@ -169,11 +189,6 @@ private:
...
@@ -169,11 +189,6 @@ private:
std
::
vector
<
MeshLib
::
Node
*>
const
&
nodes
,
std
::
size_t
const
mesh_id
,
std
::
vector
<
MeshLib
::
Node
*>
const
&
nodes
,
std
::
size_t
const
mesh_id
,
const
int
component_id
,
const
int
comp_id_write
);
const
int
component_id
,
const
int
comp_id_write
);
/// The global component id for the specific variable (like velocity) and a
/// component (like x, or y, or z).
int
getGlobalComponent
(
int
const
variable_id
,
int
const
component_id
)
const
;
private:
/// A vector of mesh subsets for each process variables' components.
/// A vector of mesh subsets for each process variables' components.
std
::
vector
<
MeshLib
::
MeshSubset
>
_mesh_subsets
;
std
::
vector
<
MeshLib
::
MeshSubset
>
_mesh_subsets
;
NumLib
::
MeshComponentMap
_mesh_component_map
;
NumLib
::
MeshComponentMap
_mesh_component_map
;
...
...
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