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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
code
pugs
Commits
68214507
Commit
68214507
authored
6 years ago
by
Stéphane Del Pino
Browse files
Options
Downloads
Patches
Plain Diff
Build on demand item local numbering in child items
parent
d8613ba7
No related branches found
No related tags found
1 merge request
!6
Feature/crs
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/mesh/Connectivity.cpp
+0
-6
0 additions, 6 deletions
src/mesh/Connectivity.cpp
src/mesh/Connectivity.hpp
+51
-37
51 additions, 37 deletions
src/mesh/Connectivity.hpp
src/mesh/SubItemValuePerItem.hpp
+24
-0
24 additions, 0 deletions
src/mesh/SubItemValuePerItem.hpp
with
75 additions
and
43 deletions
src/mesh/Connectivity.cpp
+
0
−
6
View file @
68214507
...
@@ -249,12 +249,6 @@ Connectivity(const std::vector<std::vector<unsigned int>>& cell_by_node_vector)
...
@@ -249,12 +249,6 @@ Connectivity(const std::vector<std::vector<unsigned int>>& cell_by_node_vector)
m_connectivity_computer
.
computeInverseConnectivityMatrix
(
cell_to_node_matrix
,
m_connectivity_computer
.
computeInverseConnectivityMatrix
(
cell_to_node_matrix
,
node_to_cell_matrix
);
node_to_cell_matrix
);
m_node_local_numbers_in_their_cells
=
m_connectivity_computer
.
computeLocalItemNumberInChildItem
<
ItemType
::
node
,
ItemType
::
cell
>
(
*
this
);
m_cell_local_numbers_in_their_nodes
=
m_connectivity_computer
.
computeLocalItemNumberInChildItem
<
ItemType
::
cell
,
ItemType
::
node
>
(
*
this
);
if
constexpr
(
Dimension
>
1
)
{
if
constexpr
(
Dimension
>
1
)
{
this
->
_computeFaceCellConnectivities
();
this
->
_computeFaceCellConnectivities
();
}
}
...
...
This diff is collapsed.
Click to expand it.
src/mesh/Connectivity.hpp
+
51
−
37
View file @
68214507
...
@@ -230,6 +230,51 @@ class Connectivity final
...
@@ -230,6 +230,51 @@ class Connectivity final
public:
public:
static
constexpr
size_t
dimension
=
Dimension
;
static
constexpr
size_t
dimension
=
Dimension
;
private:
ConnectivityMatrix
m_item_to_item_matrix
[
Dimension
+
1
][
Dimension
+
1
];
FaceValuePerCell
<
const
bool
>
m_cell_face_is_reversed
;
NodeValuePerCell
<
const
unsigned
short
>
m_cell_local_numbers_in_their_nodes
;
CellValuePerFace
<
const
unsigned
short
>
m_face_local_numbers_in_their_cells
;
CellValuePerNode
<
const
unsigned
short
>
m_node_local_numbers_in_their_cells
;
// not plugged ...
#warning remaining def
NodeValuePerFace
<
unsigned
short
>
m_node_local_numbers_in_their_faces
;
FaceValuePerNode
<
unsigned
short
>
m_face_local_numbers_in_their_nodes
;
// ... not plugged
ConnectivityComputer
m_connectivity_computer
;
std
::
vector
<
RefFaceList
>
m_ref_face_list
;
std
::
vector
<
RefNodeList
>
m_ref_node_list
;
Kokkos
::
View
<
double
*>
m_inv_cell_nb_nodes
;
using
Face
=
ConnectivityFace
<
Dimension
>
;
std
::
unordered_map
<
Face
,
unsigned
int
,
typename
Face
::
Hash
>
m_face_number_map
;
void
_computeFaceCellConnectivities
();
template
<
typename
SubItemValuePerItemType
>
KOKKOS_INLINE_FUNCTION
const
SubItemValuePerItemType
&
_lazzyBuildItemNumberInTheirChild
(
const
SubItemValuePerItemType
&
sub_item_value_per_item
)
const
{
if
(
not
sub_item_value_per_item
.
isBuilt
())
{
const_cast
<
SubItemValuePerItemType
&>
(
sub_item_value_per_item
)
=
m_connectivity_computer
.
computeLocalItemNumberInChildItem
<
SubItemValuePerItemType
::
item_t
,
SubItemValuePerItemType
::
sub_item_t
>
(
*
this
);
}
return
sub_item_value_per_item
;
}
public
:
template
<
ItemType
item_type_0
,
ItemType
item_type_1
>
template
<
ItemType
item_type_0
,
ItemType
item_type_1
>
const
ConnectivityMatrix
&
itemToItemMatrix
()
const
const
ConnectivityMatrix
&
itemToItemMatrix
()
const
{
{
...
@@ -250,60 +295,29 @@ class Connectivity final
...
@@ -250,60 +295,29 @@ class Connectivity final
const
auto
&
cellLocalNumbersInTheirNodes
()
const
const
auto
&
cellLocalNumbersInTheirNodes
()
const
{
{
return
m_cell_local_numbers_in_their_nodes
;
return
_lazzyBuildItemNumberInTheirChild
(
m_cell_local_numbers_in_their_nodes
)
;
}
}
const
auto
&
nodeLocalNumbersInTheirCells
()
const
const
auto
&
nodeLocalNumbersInTheirCells
()
const
{
{
return
m_node_local_numbers_in_their_cells
;
return
_lazzyBuildItemNumberInTheirChild
(
m_node_local_numbers_in_their_cells
)
;
}
}
const
auto
&
faceLocalNumbersInTheirCells
()
const
const
auto
&
faceLocalNumbersInTheirCells
()
const
{
{
if
constexpr
(
dimension
>
1
)
{
if
constexpr
(
dimension
>
1
)
{
return
m_face_local_numbers_in_their_cells
;
return
_lazzyBuildItemNumberInTheirChild
(
m_face_local_numbers_in_their_cells
)
;
}
else
{
}
else
{
return
m_node_local_numbers_in_their_cells
;
return
_lazzyBuildItemNumberInTheirChild
(
m_node_local_numbers_in_their_cells
)
;
}
}
}
}
const
auto
&
node
ToFaceLocalNode
()
const
const
auto
&
node
LocalNumbersInTheirFaces
()
const
{
{
static_assert
(
Dimension
==
1
,
"this function has no meaning in 1d"
);
static_assert
(
Dimension
==
1
,
"this function has no meaning in 1d"
);
return
m_node_local_numbers_in_their_faces
;
return
_lazzyBuildItemNumberInTheirChild
(
m_node_local_numbers_in_their_faces
)
;
}
}
private
:
ConnectivityMatrix
m_item_to_item_matrix
[
Dimension
+
1
][
Dimension
+
1
];
FaceValuePerCell
<
const
bool
>
m_cell_face_is_reversed
;
NodeValuePerCell
<
const
unsigned
short
>
m_cell_local_numbers_in_their_nodes
;
CellValuePerFace
<
const
unsigned
short
>
m_face_local_numbers_in_their_cells
;
CellValuePerNode
<
const
unsigned
short
>
m_node_local_numbers_in_their_cells
;
// not plugged ...
#warning remaining def
NodeValuePerFace
<
unsigned
short
>
m_node_local_numbers_in_their_faces
;
FaceValuePerNode
<
unsigned
short
>
m_face_local_numbers_in_their_nodes
;
// ... not plugged
ConnectivityComputer
m_connectivity_computer
;
std
::
vector
<
RefFaceList
>
m_ref_face_list
;
std
::
vector
<
RefNodeList
>
m_ref_node_list
;
Kokkos
::
View
<
double
*>
m_inv_cell_nb_nodes
;
using
Face
=
ConnectivityFace
<
Dimension
>
;
std
::
unordered_map
<
Face
,
unsigned
int
,
typename
Face
::
Hash
>
m_face_number_map
;
void
_computeFaceCellConnectivities
();
public
:
void
addRefFaceList
(
const
RefFaceList
&
ref_face_list
)
void
addRefFaceList
(
const
RefFaceList
&
ref_face_list
)
{
{
m_ref_face_list
.
push_back
(
ref_face_list
);
m_ref_face_list
.
push_back
(
ref_face_list
);
...
...
This diff is collapsed.
Click to expand it.
src/mesh/SubItemValuePerItem.hpp
+
24
−
0
View file @
68214507
...
@@ -23,7 +23,12 @@ class SubItemValuePerItem<DataType,
...
@@ -23,7 +23,12 @@ class SubItemValuePerItem<DataType,
item_type
,
item_type
,
std
::
enable_if_t
<
sub_item_type
!=
item_type
>>
std
::
enable_if_t
<
sub_item_type
!=
item_type
>>
{
{
public:
static
const
ItemType
item_t
{
item_type
};
static
const
ItemType
sub_item_t
{
sub_item_type
};
private
:
private
:
bool
m_is_built
{
false
};
ConnectivityMatrix
::
HostRowType
m_host_row_map
;
ConnectivityMatrix
::
HostRowType
m_host_row_map
;
Kokkos
::
View
<
DataType
*>
m_values
;
Kokkos
::
View
<
DataType
*>
m_values
;
...
@@ -76,9 +81,16 @@ class SubItemValuePerItem<DataType,
...
@@ -76,9 +81,16 @@ class SubItemValuePerItem<DataType,
}
}
};
};
KOKKOS_FORCEINLINE_FUNCTION
const
bool
&
isBuilt
()
const
{
return
m_is_built
;
}
KOKKOS_FORCEINLINE_FUNCTION
KOKKOS_FORCEINLINE_FUNCTION
DataType
&
operator
()(
const
size_t
&
j
,
const
size_t
&
r
)
DataType
&
operator
()(
const
size_t
&
j
,
const
size_t
&
r
)
{
{
Assert
(
m_is_built
);
return
m_values
[
m_host_row_map
(
j
)
+
r
];
return
m_values
[
m_host_row_map
(
j
)
+
r
];
}
}
...
@@ -87,18 +99,21 @@ class SubItemValuePerItem<DataType,
...
@@ -87,18 +99,21 @@ class SubItemValuePerItem<DataType,
KOKKOS_FORCEINLINE_FUNCTION
KOKKOS_FORCEINLINE_FUNCTION
DataType
&
operator
()(
const
size_t
&
j
,
const
size_t
&
r
)
const
DataType
&
operator
()(
const
size_t
&
j
,
const
size_t
&
r
)
const
{
{
Assert
(
m_is_built
);
return
m_values
[
m_host_row_map
(
j
)
+
r
];
return
m_values
[
m_host_row_map
(
j
)
+
r
];
}
}
KOKKOS_INLINE_FUNCTION
KOKKOS_INLINE_FUNCTION
size_t
numberOfValues
()
const
size_t
numberOfValues
()
const
{
{
Assert
(
m_is_built
);
return
m_values
.
extent
(
0
);
return
m_values
.
extent
(
0
);
}
}
KOKKOS_FORCEINLINE_FUNCTION
KOKKOS_FORCEINLINE_FUNCTION
DataType
&
operator
[](
const
size_t
&
i
)
DataType
&
operator
[](
const
size_t
&
i
)
{
{
Assert
(
m_is_built
);
return
m_values
[
i
];
return
m_values
[
i
];
}
}
...
@@ -107,12 +122,14 @@ class SubItemValuePerItem<DataType,
...
@@ -107,12 +122,14 @@ class SubItemValuePerItem<DataType,
KOKKOS_FORCEINLINE_FUNCTION
KOKKOS_FORCEINLINE_FUNCTION
DataType
&
operator
[](
const
size_t
&
i
)
const
DataType
&
operator
[](
const
size_t
&
i
)
const
{
{
Assert
(
m_is_built
);
return
m_values
[
i
];
return
m_values
[
i
];
}
}
KOKKOS_INLINE_FUNCTION
KOKKOS_INLINE_FUNCTION
size_t
numberOfItems
()
const
size_t
numberOfItems
()
const
{
{
Assert
(
m_is_built
);
Assert
(
m_host_row_map
.
extent
(
0
)
!=
0
);
Assert
(
m_host_row_map
.
extent
(
0
)
!=
0
);
return
m_host_row_map
.
extent
(
0
);
return
m_host_row_map
.
extent
(
0
);
}
}
...
@@ -120,12 +137,14 @@ class SubItemValuePerItem<DataType,
...
@@ -120,12 +137,14 @@ class SubItemValuePerItem<DataType,
KOKKOS_INLINE_FUNCTION
KOKKOS_INLINE_FUNCTION
size_t
numberOfSubValues
(
const
size_t
&
i_cell
)
const
size_t
numberOfSubValues
(
const
size_t
&
i_cell
)
const
{
{
Assert
(
m_is_built
);
return
m_host_row_map
(
i_cell
+
1
)
-
m_host_row_map
(
i_cell
);
return
m_host_row_map
(
i_cell
+
1
)
-
m_host_row_map
(
i_cell
);
}
}
KOKKOS_INLINE_FUNCTION
KOKKOS_INLINE_FUNCTION
SubView
itemValues
(
const
size_t
&
i_cell
)
SubView
itemValues
(
const
size_t
&
i_cell
)
{
{
Assert
(
m_is_built
);
const
auto
&
cell_begin
=
m_host_row_map
(
i_cell
);
const
auto
&
cell_begin
=
m_host_row_map
(
i_cell
);
const
auto
&
cell_end
=
m_host_row_map
(
i_cell
+
1
);
const
auto
&
cell_end
=
m_host_row_map
(
i_cell
+
1
);
return
SubView
(
m_values
,
cell_begin
,
cell_end
);
return
SubView
(
m_values
,
cell_begin
,
cell_end
);
...
@@ -136,6 +155,7 @@ class SubItemValuePerItem<DataType,
...
@@ -136,6 +155,7 @@ class SubItemValuePerItem<DataType,
KOKKOS_INLINE_FUNCTION
KOKKOS_INLINE_FUNCTION
SubView
itemValues
(
const
size_t
&
i_cell
)
const
SubView
itemValues
(
const
size_t
&
i_cell
)
const
{
{
Assert
(
m_is_built
);
const
auto
&
cell_begin
=
m_host_row_map
(
i_cell
);
const
auto
&
cell_begin
=
m_host_row_map
(
i_cell
);
const
auto
&
cell_end
=
m_host_row_map
(
i_cell
+
1
);
const
auto
&
cell_end
=
m_host_row_map
(
i_cell
+
1
);
return
SubView
(
m_values
,
cell_begin
,
cell_end
);
return
SubView
(
m_values
,
cell_begin
,
cell_end
);
...
@@ -155,6 +175,9 @@ class SubItemValuePerItem<DataType,
...
@@ -155,6 +175,9 @@ class SubItemValuePerItem<DataType,
"Cannot assign const SubItemValuePerItem to a non const SubItemValuePerItem"
);
"Cannot assign const SubItemValuePerItem to a non const SubItemValuePerItem"
);
m_host_row_map
=
sub_item_value_per_item
.
m_host_row_map
;
m_host_row_map
=
sub_item_value_per_item
.
m_host_row_map
;
m_values
=
sub_item_value_per_item
.
m_values
;
m_values
=
sub_item_value_per_item
.
m_values
;
m_is_built
=
sub_item_value_per_item
.
m_is_built
;
return
*
this
;
return
*
this
;
}
}
...
@@ -168,6 +191,7 @@ class SubItemValuePerItem<DataType,
...
@@ -168,6 +191,7 @@ class SubItemValuePerItem<DataType,
SubItemValuePerItem
()
=
default
;
SubItemValuePerItem
()
=
default
;
SubItemValuePerItem
(
const
IConnectivity
&
connectivity
)
SubItemValuePerItem
(
const
IConnectivity
&
connectivity
)
:
m_is_built
{
true
}
{
{
ConnectivityMatrix
connectivity_matrix
ConnectivityMatrix
connectivity_matrix
=
connectivity
.
getMatrix
(
item_type
,
sub_item_type
);
=
connectivity
.
getMatrix
(
item_type
,
sub_item_type
);
...
...
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