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
d9cfcb3d
Commit
d9cfcb3d
authored
8 years ago
by
Dmitri Naumov
Browse files
Options
Downloads
Patches
Plain Diff
[NL] Add multicomponents to LocalToGlobalIndexMap.
parent
ce43de0c
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
+69
-0
69 additions, 0 deletions
NumLib/DOF/LocalToGlobalIndexMap.cpp
NumLib/DOF/LocalToGlobalIndexMap.h
+27
-1
27 additions, 1 deletion
NumLib/DOF/LocalToGlobalIndexMap.h
with
96 additions
and
1 deletion
NumLib/DOF/LocalToGlobalIndexMap.cpp
+
69
−
0
View file @
d9cfcb3d
...
@@ -221,6 +221,41 @@ LocalToGlobalIndexMap::LocalToGlobalIndexMap(
...
@@ -221,6 +221,41 @@ LocalToGlobalIndexMap::LocalToGlobalIndexMap(
}
}
}
}
LocalToGlobalIndexMap
::
LocalToGlobalIndexMap
(
std
::
vector
<
std
::
unique_ptr
<
MeshLib
::
MeshSubsets
>>&&
mesh_subsets
,
std
::
vector
<
std
::
size_t
>
const
&
global_component_ids
,
std
::
vector
<
MeshLib
::
Element
*>
const
&
elements
,
NumLib
::
MeshComponentMap
&&
mesh_component_map
)
:
_mesh_subsets
(
std
::
move
(
mesh_subsets
)),
_mesh_component_map
(
std
::
move
(
mesh_component_map
)),
_variable_component_offsets
(
to_cumulative
(
std
::
vector
<
unsigned
>
(
1
,
1
)))
// Single variable only.
{
// Each subset in the mesh_subsets represents a single component.
if
(
_mesh_subsets
.
size
()
!=
global_component_ids
.
size
())
OGS_FATAL
(
"Number of mesh subsets is not equal to number of components. "
"There are %d mesh subsets and %d components."
,
mesh_subsets
.
size
(),
global_component_ids
.
size
());
for
(
std
::
size_t
i
=
0
;
i
<
global_component_ids
.
size
();
++
i
)
{
auto
const
&
mss
=
*
_mesh_subsets
[
i
];
// For all MeshSubset in mesh_subsets and each element of that
// MeshSubset
// save a line of global indices.
for
(
MeshLib
::
MeshSubset
const
*
const
ms
:
mss
)
{
std
::
size_t
const
mesh_id
=
ms
->
getMeshID
();
findGlobalIndices
(
elements
.
cbegin
(),
elements
.
cend
(),
ms
->
getNodes
(),
mesh_id
,
global_component_ids
[
i
],
i
);
}
}
}
LocalToGlobalIndexMap
*
LocalToGlobalIndexMap
::
deriveBoundaryConstrainedMap
(
LocalToGlobalIndexMap
*
LocalToGlobalIndexMap
::
deriveBoundaryConstrainedMap
(
int
const
variable_id
,
int
const
variable_id
,
int
const
component_id
,
int
const
component_id
,
...
@@ -242,6 +277,40 @@ LocalToGlobalIndexMap* LocalToGlobalIndexMap::deriveBoundaryConstrainedMap(
...
@@ -242,6 +277,40 @@ LocalToGlobalIndexMap* LocalToGlobalIndexMap::deriveBoundaryConstrainedMap(
std
::
move
(
mesh_component_map
));
std
::
move
(
mesh_component_map
));
}
}
LocalToGlobalIndexMap
*
LocalToGlobalIndexMap
::
deriveBoundaryConstrainedMap
(
int
const
variable_id
,
std
::
vector
<
int
>
const
&
component_ids
,
std
::
unique_ptr
<
MeshLib
::
MeshSubsets
>&&
mesh_subsets
,
std
::
vector
<
MeshLib
::
Element
*>
const
&
elements
)
const
{
DBUG
(
"Construct reduced local to global index map."
);
if
(
component_ids
.
empty
())
OGS_FATAL
(
"Expected non-empty vector of component ids."
);
// Create a subset of the current mesh component map.
std
::
vector
<
std
::
size_t
>
global_component_ids
;
for
(
auto
component_id
:
component_ids
)
global_component_ids
.
push_back
(
getGlobalComponent
(
variable_id
,
component_id
));
auto
mesh_component_map
=
_mesh_component_map
.
getSubset
(
global_component_ids
,
*
mesh_subsets
);
// Create copies of the mesh_subsets for each of the global components.
// The last component is moved after the for-loop.
std
::
vector
<
std
::
unique_ptr
<
MeshLib
::
MeshSubsets
>>
all_mesh_subsets
;
for
(
std
::
size_t
i
=
0
;
i
<
global_component_ids
.
size
()
-
1
;
++
i
)
all_mesh_subsets
.
emplace_back
(
new
MeshLib
::
MeshSubsets
{
*
mesh_subsets
});
all_mesh_subsets
.
emplace_back
(
std
::
move
(
mesh_subsets
));
return
new
LocalToGlobalIndexMap
(
std
::
move
(
all_mesh_subsets
),
global_component_ids
,
elements
,
std
::
move
(
mesh_component_map
));
}
std
::
size_t
std
::
size_t
LocalToGlobalIndexMap
::
dofSizeWithGhosts
()
const
LocalToGlobalIndexMap
::
dofSizeWithGhosts
()
const
{
{
...
...
This diff is collapsed.
Click to expand it.
NumLib/DOF/LocalToGlobalIndexMap.h
+
27
−
1
View file @
d9cfcb3d
...
@@ -80,7 +80,9 @@ public:
...
@@ -80,7 +80,9 @@ public:
/// Derive a LocalToGlobalIndexMap constrained to a set of mesh subsets and
/// Derive a LocalToGlobalIndexMap constrained to a set of mesh subsets and
/// elements. A new mesh component map will be constructed using the passed
/// elements. A new mesh component map will be constructed using the passed
/// mesh_subsets for the given variable and component ids.
/// mesh_subsets for the given variable and component id.
///
/// This is single-component version.
///
///
/// \note The elements are not necessarily those used in the mesh_subsets.
/// \note The elements are not necessarily those used in the mesh_subsets.
LocalToGlobalIndexMap
*
deriveBoundaryConstrainedMap
(
LocalToGlobalIndexMap
*
deriveBoundaryConstrainedMap
(
...
@@ -89,6 +91,19 @@ public:
...
@@ -89,6 +91,19 @@ public:
std
::
unique_ptr
<
MeshLib
::
MeshSubsets
>&&
mesh_subsets
,
std
::
unique_ptr
<
MeshLib
::
MeshSubsets
>&&
mesh_subsets
,
std
::
vector
<
MeshLib
::
Element
*>
const
&
elements
)
const
;
std
::
vector
<
MeshLib
::
Element
*>
const
&
elements
)
const
;
/// Derive a LocalToGlobalIndexMap constrained to a set of mesh subsets and
/// elements. A new mesh component map will be constructed using the passed
/// mesh_subsets for the given variable and component ids.
///
/// This is multi-component version.
///
/// \note The elements are not necessarily those used in the mesh_subsets.
LocalToGlobalIndexMap
*
deriveBoundaryConstrainedMap
(
int
const
variable_id
,
std
::
vector
<
int
>
const
&
component_ids
,
std
::
unique_ptr
<
MeshLib
::
MeshSubsets
>&&
mesh_subsets
,
std
::
vector
<
MeshLib
::
Element
*>
const
&
elements
)
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
;
...
@@ -174,6 +189,17 @@ private:
...
@@ -174,6 +189,17 @@ private:
std
::
vector
<
MeshLib
::
Element
*>
const
&
elements
,
std
::
vector
<
MeshLib
::
Element
*>
const
&
elements
,
NumLib
::
MeshComponentMap
&&
mesh_component_map
);
NumLib
::
MeshComponentMap
&&
mesh_component_map
);
/// Private constructor 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
/// this construtor.
explicit
LocalToGlobalIndexMap
(
std
::
vector
<
std
::
unique_ptr
<
MeshLib
::
MeshSubsets
>>&&
mesh_subsets
,
std
::
vector
<
std
::
size_t
>
const
&
global_component_ids
,
std
::
vector
<
MeshLib
::
Element
*>
const
&
elements
,
NumLib
::
MeshComponentMap
&&
mesh_component_map
);
template
<
typename
ElementIterator
>
template
<
typename
ElementIterator
>
void
void
findGlobalIndices
(
ElementIterator
first
,
ElementIterator
last
,
findGlobalIndices
(
ElementIterator
first
,
ElementIterator
last
,
...
...
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