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
663e7c62
Commit
663e7c62
authored
6 years ago
by
Stéphane Del Pino
Browse files
Options
Downloads
Patches
Plain Diff
Remove m_cell_to_node_matrix member
Now use m_item_to_item_matrix[cell_id][node_id] instead
parent
5b7dfe1b
No related branches found
No related tags found
1 merge request
!6
Feature/crs
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/mesh/Connectivity.cpp
+9
-2
9 additions, 2 deletions
src/mesh/Connectivity.cpp
src/mesh/Connectivity.hpp
+23
-12
23 additions, 12 deletions
src/mesh/Connectivity.hpp
with
32 additions
and
14 deletions
src/mesh/Connectivity.cpp
+
9
−
2
View file @
663e7c62
...
@@ -7,9 +7,13 @@ void Connectivity<3>::_computeFaceCellConnectivities()
...
@@ -7,9 +7,13 @@ void Connectivity<3>::_computeFaceCellConnectivities()
Kokkos
::
View
<
unsigned
short
*>
cell_nb_faces
(
"cell_nb_faces"
,
this
->
numberOfCells
());
Kokkos
::
View
<
unsigned
short
*>
cell_nb_faces
(
"cell_nb_faces"
,
this
->
numberOfCells
());
typedef
std
::
tuple
<
unsigned
int
,
unsigned
short
,
bool
>
CellFaceInfo
;
typedef
std
::
tuple
<
unsigned
int
,
unsigned
short
,
bool
>
CellFaceInfo
;
const
auto
&
cell_to_node_matrix
=
m_item_to_item_matrix
[
itemId
(
TypeOfItem
::
cell
)][
itemId
(
TypeOfItem
::
node
)];
std
::
map
<
Face
,
std
::
vector
<
CellFaceInfo
>>
face_cells_map
;
std
::
map
<
Face
,
std
::
vector
<
CellFaceInfo
>>
face_cells_map
;
for
(
unsigned
int
j
=
0
;
j
<
this
->
numberOfCells
();
++
j
)
{
for
(
unsigned
int
j
=
0
;
j
<
this
->
numberOfCells
();
++
j
)
{
const
auto
&
cell_nodes
=
m_
cell_to_node_matrix
.
rowConst
(
j
);
const
auto
&
cell_nodes
=
cell_to_node_matrix
.
rowConst
(
j
);
switch
(
cell_nodes
.
length
)
{
switch
(
cell_nodes
.
length
)
{
case
4
:
{
// tetrahedron
case
4
:
{
// tetrahedron
...
@@ -182,11 +186,14 @@ void Connectivity<3>::_computeFaceCellConnectivities()
...
@@ -182,11 +186,14 @@ void Connectivity<3>::_computeFaceCellConnectivities()
template
<
>
template
<
>
void
Connectivity
<
2
>::
_computeFaceCellConnectivities
()
void
Connectivity
<
2
>::
_computeFaceCellConnectivities
()
{
{
const
auto
&
cell_to_node_matrix
=
m_item_to_item_matrix
[
itemId
(
TypeOfItem
::
cell
)][
itemId
(
TypeOfItem
::
node
)];
// In 2D faces are simply define
// In 2D faces are simply define
typedef
std
::
pair
<
unsigned
int
,
unsigned
short
>
CellFaceId
;
typedef
std
::
pair
<
unsigned
int
,
unsigned
short
>
CellFaceId
;
std
::
map
<
Face
,
std
::
vector
<
CellFaceId
>>
face_cells_map
;
std
::
map
<
Face
,
std
::
vector
<
CellFaceId
>>
face_cells_map
;
for
(
unsigned
int
j
=
0
;
j
<
this
->
numberOfCells
();
++
j
)
{
for
(
unsigned
int
j
=
0
;
j
<
this
->
numberOfCells
();
++
j
)
{
const
auto
&
cell_nodes
=
m_
cell_to_node_matrix
.
rowConst
(
j
);
const
auto
&
cell_nodes
=
cell_to_node_matrix
.
rowConst
(
j
);
for
(
unsigned
short
r
=
0
;
r
<
cell_nodes
.
length
;
++
r
)
{
for
(
unsigned
short
r
=
0
;
r
<
cell_nodes
.
length
;
++
r
)
{
unsigned
int
node0_id
=
cell_nodes
(
r
);
unsigned
int
node0_id
=
cell_nodes
(
r
);
unsigned
int
node1_id
=
cell_nodes
((
r
+
1
)
%
cell_nodes
.
length
);
unsigned
int
node1_id
=
cell_nodes
((
r
+
1
)
%
cell_nodes
.
length
);
...
...
This diff is collapsed.
Click to expand it.
src/mesh/Connectivity.hpp
+
23
−
12
View file @
663e7c62
...
@@ -230,12 +230,10 @@ class Connectivity final
...
@@ -230,12 +230,10 @@ class Connectivity final
public:
public:
static
constexpr
size_t
dimension
=
Dimension
;
static
constexpr
size_t
dimension
=
Dimension
;
private:
ConnectivityMatrix
m_cell_to_node_matrix
;
public:
public:
ConnectivityMatrix
cellToNodeMatrix
()
const
ConnectivityMatrix
cellToNodeMatrix
()
const
{
{
return
m_
cell_to_node_matrix
;
return
m_
item_to_item_matrix
[
itemId
(
TypeOfItem
::
cell
)][
itemId
(
TypeOfItem
::
node
)]
;
}
}
NodeValuePerCell
<
unsigned
short
>
m_cell_to_node_local_cell
;
NodeValuePerCell
<
unsigned
short
>
m_cell_to_node_local_cell
;
...
@@ -323,7 +321,9 @@ private:
...
@@ -323,7 +321,9 @@ private:
KOKKOS_INLINE_FUNCTION
KOKKOS_INLINE_FUNCTION
size_t
numberOfCells
()
const
size_t
numberOfCells
()
const
{
{
return
m_cell_to_node_matrix
.
numRows
();
const
auto
&
cell_to_node_matrix
=
m_item_to_item_matrix
[
itemId
(
TypeOfItem
::
cell
)][
itemId
(
TypeOfItem
::
node
)];
return
cell_to_node_matrix
.
numRows
();
}
}
const
Kokkos
::
View
<
const
double
*>
invCellNbNodes
()
const
const
Kokkos
::
View
<
const
double
*>
invCellNbNodes
()
const
...
@@ -347,32 +347,34 @@ private:
...
@@ -347,32 +347,34 @@ private:
Connectivity
(
const
std
::
vector
<
std
::
vector
<
unsigned
int
>>&
cell_by_node_vector
)
Connectivity
(
const
std
::
vector
<
std
::
vector
<
unsigned
int
>>&
cell_by_node_vector
)
{
{
m_cell_to_node_matrix
=
cell_by_node_vector
;
auto
&
cell_to_node_matrix
=
m_item_to_item_matrix
[
itemId
(
TypeOfItem
::
cell
)][
itemId
(
TypeOfItem
::
node
)];
cell_to_node_matrix
=
cell_by_node_vector
;
Assert
(
this
->
numberOfCells
()
>
0
);
Assert
(
this
->
numberOfCells
()
>
0
);
{
{
Kokkos
::
View
<
double
*>
inv_cell_nb_nodes
(
"inv_cell_nb_nodes"
,
this
->
numberOfCells
());
Kokkos
::
View
<
double
*>
inv_cell_nb_nodes
(
"inv_cell_nb_nodes"
,
this
->
numberOfCells
());
Kokkos
::
parallel_for
(
this
->
numberOfCells
(),
KOKKOS_LAMBDA
(
const
int
&
j
){
Kokkos
::
parallel_for
(
this
->
numberOfCells
(),
KOKKOS_LAMBDA
(
const
int
&
j
){
const
auto
&
cell_nodes
=
m_
cell_to_node_matrix
.
rowConst
(
j
);
const
auto
&
cell_nodes
=
cell_to_node_matrix
.
rowConst
(
j
);
inv_cell_nb_nodes
[
j
]
=
1.
/
cell_nodes
.
length
;
inv_cell_nb_nodes
[
j
]
=
1.
/
cell_nodes
.
length
;
});
});
m_inv_cell_nb_nodes
=
inv_cell_nb_nodes
;
m_inv_cell_nb_nodes
=
inv_cell_nb_nodes
;
}
}
m_connectivity_computer
.
computeInverseConnectivityMatrix
(
m_
cell_to_node_matrix
,
m_connectivity_computer
.
computeInverseConnectivityMatrix
(
cell_to_node_matrix
,
m_node_to_cell_matrix
);
m_node_to_cell_matrix
);
m_node_to_cell_local_node
=
CellValuePerNode
<
unsigned
short
>
(
*
this
);
m_node_to_cell_local_node
=
CellValuePerNode
<
unsigned
short
>
(
*
this
);
m_connectivity_computer
.
computeLocalChildItemNumberInItem
(
m_
cell_to_node_matrix
,
m_connectivity_computer
.
computeLocalChildItemNumberInItem
(
cell_to_node_matrix
,
m_node_to_cell_matrix
,
m_node_to_cell_matrix
,
m_node_to_cell_local_node
);
m_node_to_cell_local_node
);
m_cell_to_node_local_cell
=
NodeValuePerCell
<
unsigned
short
>
(
*
this
);
m_cell_to_node_local_cell
=
NodeValuePerCell
<
unsigned
short
>
(
*
this
);
m_connectivity_computer
.
computeLocalChildItemNumberInItem
(
m_node_to_cell_matrix
,
m_connectivity_computer
.
computeLocalChildItemNumberInItem
(
m_node_to_cell_matrix
,
m_
cell_to_node_matrix
,
cell_to_node_matrix
,
m_cell_to_node_local_cell
);
m_cell_to_node_local_cell
);
if
constexpr
(
Dimension
>
1
)
{
if
constexpr
(
Dimension
>
1
)
{
this
->
_computeFaceCellConnectivities
();
this
->
_computeFaceCellConnectivities
();
...
@@ -403,7 +405,10 @@ inline const ConnectivityMatrix&
...
@@ -403,7 +405,10 @@ inline const ConnectivityMatrix&
Connectivity
<
3
>::
itemToItemMatrix
<
TypeOfItem
::
cell
,
Connectivity
<
3
>::
itemToItemMatrix
<
TypeOfItem
::
cell
,
TypeOfItem
::
node
>
()
const
TypeOfItem
::
node
>
()
const
{
{
return
m_cell_to_node_matrix
;
const
auto
&
cell_to_node_matrix
=
m_item_to_item_matrix
[
itemId
(
TypeOfItem
::
cell
)][
itemId
(
TypeOfItem
::
node
)];
return
cell_to_node_matrix
;
}
}
template
<
>
template
<
>
...
@@ -450,7 +455,10 @@ inline const ConnectivityMatrix&
...
@@ -450,7 +455,10 @@ inline const ConnectivityMatrix&
Connectivity
<
2
>::
itemToItemMatrix
<
TypeOfItem
::
cell
,
Connectivity
<
2
>::
itemToItemMatrix
<
TypeOfItem
::
cell
,
TypeOfItem
::
node
>
()
const
TypeOfItem
::
node
>
()
const
{
{
return
m_cell_to_node_matrix
;
const
auto
&
cell_to_node_matrix
=
m_item_to_item_matrix
[
itemId
(
TypeOfItem
::
cell
)][
itemId
(
TypeOfItem
::
node
)];
return
cell_to_node_matrix
;
}
}
template
<
>
template
<
>
...
@@ -488,7 +496,10 @@ inline const ConnectivityMatrix&
...
@@ -488,7 +496,10 @@ inline const ConnectivityMatrix&
Connectivity
<
1
>::
itemToItemMatrix
<
TypeOfItem
::
cell
,
Connectivity
<
1
>::
itemToItemMatrix
<
TypeOfItem
::
cell
,
TypeOfItem
::
node
>
()
const
TypeOfItem
::
node
>
()
const
{
{
return
m_cell_to_node_matrix
;
const
auto
&
cell_to_node_matrix
=
m_item_to_item_matrix
[
itemId
(
TypeOfItem
::
cell
)][
itemId
(
TypeOfItem
::
node
)];
return
cell_to_node_matrix
;
}
}
template
<
>
template
<
>
...
...
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