Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pugs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
code
pugs
Merge requests
!7
Feature/itemvalue
Code
Review changes
Check out branch
Download
Patches
Plain diff
Expand sidebar
Merged
Feature/itemvalue
feature/itemvalue
into
develop
Overview
0
Commits
29
Pipelines
0
Changes
1
Merged
Feature/itemvalue
Stéphane Del Pino
requested to merge
feature/itemvalue
into
develop
Sep 12, 2018
Overview
0
Commits
29
Pipelines
0
Changes
1
0
0
Merge request reports
Viewing commit
a16b179c
Prev
Next
Show latest version
1 file
+
19
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
a16b179c
Add set of inline directives
· a16b179c
Stéphane Del Pino
authored
Sep 11, 2018
src/mesh/ItemToItemMatrix.hpp
0 → 100644
+
105
−
0
View file @ 9b34e9db
Edit in single-file editor
Open in Web IDE
#ifndef ITEM_TO_ITEM_MATRIX_HPP
#define ITEM_TO_ITEM_MATRIX_HPP
#include
<ItemType.hpp>
#include
<ItemId.hpp>
#include
<Kokkos_Core.hpp>
#include
<ConnectivityMatrix.hpp>
template
<
ItemType
SourceItemType
,
ItemType
TargetItemType
>
class
ItemToItemMatrix
{
public:
using
SourceItemId
=
ItemIdT
<
SourceItemType
>
;
using
TargetItemId
=
ItemIdT
<
TargetItemType
>
;
template
<
typename
RowType
>
class
SubItemList
{
private:
const
RowType
m_row
;
public:
KOKKOS_INLINE_FUNCTION
size_t
size
()
const
{
return
m_row
.
length
;
}
KOKKOS_INLINE_FUNCTION
TargetItemId
operator
[](
const
size_t
&
j
)
const
{
return
m_row
(
j
);
}
KOKKOS_INLINE_FUNCTION
SubItemList
(
const
RowType
&
row
)
:
m_row
{
row
}
{
;
}
KOKKOS_INLINE_FUNCTION
SubItemList
&
operator
=
(
const
SubItemList
&
)
=
default
;
KOKKOS_INLINE_FUNCTION
SubItemList
&
operator
=
(
SubItemList
&&
)
=
default
;
KOKKOS_INLINE_FUNCTION
SubItemList
(
const
SubItemList
&
)
=
default
;
KOKKOS_INLINE_FUNCTION
SubItemList
(
SubItemList
&&
)
=
default
;
KOKKOS_INLINE_FUNCTION
~
SubItemList
()
=
default
;
};
private
:
const
ConnectivityMatrix
&
m_connectivity_matrix
;
public
:
KOKKOS_INLINE_FUNCTION
const
auto
operator
[](
const
SourceItemId
&
source_id
)
const
{
using
RowType
=
decltype
(
m_connectivity_matrix
.
rowConst
(
source_id
));
return
SubItemList
<
RowType
>
(
m_connectivity_matrix
.
rowConst
(
source_id
));
}
template
<
typename
IndexType
>
KOKKOS_INLINE_FUNCTION
const
auto
operator
[](
const
IndexType
&
source_id
)
const
{
static_assert
(
std
::
is_same
<
IndexType
,
SourceItemId
>
(),
"ItemToItemMatrix must be indexed using correct ItemId"
);
using
RowType
=
decltype
(
m_connectivity_matrix
.
rowConst
(
source_id
));
return
SubItemList
<
RowType
>
(
m_connectivity_matrix
.
rowConst
(
source_id
));
}
KOKKOS_INLINE_FUNCTION
ItemToItemMatrix
(
const
ConnectivityMatrix
&
connectivity_matrix
)
:
m_connectivity_matrix
{
connectivity_matrix
}
{
;
}
KOKKOS_INLINE_FUNCTION
ItemToItemMatrix
&
operator
=
(
const
ItemToItemMatrix
&
)
=
default
;
KOKKOS_INLINE_FUNCTION
ItemToItemMatrix
&
operator
=
(
ItemToItemMatrix
&&
)
=
default
;
KOKKOS_INLINE_FUNCTION
ItemToItemMatrix
(
ItemToItemMatrix
&&
)
=
default
;
KOKKOS_INLINE_FUNCTION
ItemToItemMatrix
(
const
ItemToItemMatrix
&
)
=
default
;
KOKKOS_INLINE_FUNCTION
~
ItemToItemMatrix
()
=
default
;
};
#endif // ITEM_TO_ITEM_MATRIX_HPP
Loading