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
Commits
25cf16b9
Commit
25cf16b9
authored
Apr 25, 2018
by
Stéphane Del Pino
Browse files
Options
Downloads
Patches
Plain Diff
begining of 2d connectivity
parent
681984aa
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/mesh/Connectivity2D.hpp
+128
-0
128 additions, 0 deletions
src/mesh/Connectivity2D.hpp
src/mesh/GmshReader.cpp
+30
-1
30 additions, 1 deletion
src/mesh/GmshReader.cpp
src/mesh/Mesh.hpp
+12
-0
12 additions, 0 deletions
src/mesh/Mesh.hpp
with
170 additions
and
1 deletion
src/mesh/Connectivity2D.hpp
0 → 100644
+
128
−
0
View file @
25cf16b9
#ifndef CONNECTIVITY_2D_HPP
#define CONNECTIVITY_2D_HPP
#include
<Kokkos_Core.hpp>
#include
<TinyVector.hpp>
class
Connectivity2D
{
public:
static
constexpr
size_t
dimension
=
2
;
private:
const
size_t
m_number_of_cells
;
size_t
m_number_of_faces
;
size_t
m_number_of_nodes
;
const
Kokkos
::
View
<
const
unsigned
int
**>
m_cell_nodes
;
Kokkos
::
View
<
unsigned
int
**>
m_cell_faces
;
Kokkos
::
View
<
unsigned
short
*>
m_cell_nb_nodes
;
Kokkos
::
View
<
double
*>
m_inv_cell_nb_nodes
;
Kokkos
::
View
<
unsigned
short
*>
m_cell_nb_faces
;
Kokkos
::
View
<
unsigned
short
*>
m_node_nb_cells
;
Kokkos
::
View
<
unsigned
short
*>
m_face_nb_cells
;
Kokkos
::
View
<
unsigned
int
**>
m_node_cells
;
Kokkos
::
View
<
unsigned
int
**>
m_face_cells
;
Kokkos
::
View
<
unsigned
short
**>
m_node_cell_local_node
;
Kokkos
::
View
<
unsigned
short
**>
m_face_cell_local_face
;
size_t
m_max_nb_node_per_cell
;
public:
const
size_t
&
numberOfNodes
()
const
{
return
m_number_of_nodes
;
}
const
size_t
&
numberOfFaces
()
const
{
return
m_number_of_faces
;
}
const
size_t
&
numberOfCells
()
const
{
return
m_number_of_cells
;
}
const
size_t
&
maxNbNodePerCell
()
const
{
return
m_max_nb_node_per_cell
;
}
const
Kokkos
::
View
<
const
unsigned
int
**>
cellNodes
()
const
{
return
m_cell_nodes
;
}
const
Kokkos
::
View
<
const
unsigned
int
**>
cellFaces
()
const
{
return
m_cell_faces
;
}
const
Kokkos
::
View
<
const
unsigned
short
*>
nodeNbCells
()
const
{
return
m_node_nb_cells
;
}
const
Kokkos
::
View
<
const
unsigned
short
*>
cellNbNodes
()
const
{
return
m_cell_nb_nodes
;
}
const
Kokkos
::
View
<
const
double
*>
invCellNbNodes
()
const
{
return
m_inv_cell_nb_nodes
;
}
const
Kokkos
::
View
<
const
unsigned
short
*>
cellNbFaces
()
const
{
return
m_cell_nb_faces
;
}
const
Kokkos
::
View
<
const
unsigned
short
*>
faceNbCells
()
const
{
return
m_face_nb_cells
;
}
const
Kokkos
::
View
<
const
unsigned
int
**>
nodeCells
()
const
{
return
m_node_cells
;
}
const
Kokkos
::
View
<
const
unsigned
int
**>
faceCells
()
const
{
return
m_face_cells
;
}
const
Kokkos
::
View
<
const
unsigned
short
**>
nodeCellLocalNode
()
const
{
return
m_node_cell_local_node
;
}
const
Kokkos
::
View
<
const
unsigned
short
**>
faceCellLocalFace
()
const
{
return
m_face_cell_local_face
;
}
Connectivity2D
(
const
Connectivity2D
&
)
=
delete
;
Connectivity2D
(
const
Kokkos
::
View
<
const
unsigned
int
**>
cell_nodes
)
:
m_number_of_cells
(
cell_nodes
.
dimension_0
()),
m_cell_nodes
(
cell_nodes
)
{
assert
(
m_number_of_cells
>
0
);
std
::
cout
<<
__PRETTY_FUNCTION__
<<
": Number of cells = "
<<
m_number_of_cells
<<
'\n'
;
}
~
Connectivity2D
()
{
;
}
};
#endif // CONNECTIVITY_2D_HPP
This diff is collapsed.
Click to expand it.
src/mesh/GmshReader.cpp
+
30
−
1
View file @
25cf16b9
...
...
@@ -5,6 +5,9 @@
#include
<set>
#include
<rang.hpp>
#include
<Connectivity2D.hpp>
#include
<Mesh.hpp>
template
<
typename
T
>
inline
std
::
string
stringify
(
const
T
&
t
)
{
...
...
@@ -728,7 +731,33 @@ GmshReader::__proceedData()
std
::
cerr
<<
"*** using a 3d mesh (NIY)
\n
"
;
std
::
exit
(
0
);
}
else
if
((
dimension2_mask
,
elementNumber
)
>
0
)
{
std
::
cerr
<<
"*** using a 2d mesh (NIY)
\n
"
;
if
(
__quadrangles
.
dimension_0
()
>
0
)
{
std
::
cerr
<<
"quadrangles NYI
\n
"
;
std
::
exit
(
0
);
}
Kokkos
::
View
<
unsigned
int
**>
cell_nodes
(
"cell_nodes"
,
__triangles
.
dimension_0
(),
3
);
Connectivity2D
connectivity
(
cell_nodes
);
typedef
Mesh
<
Connectivity2D
>
MeshType
;
typedef
TinyVector
<
2
,
double
>
Rd
;
Kokkos
::
View
<
Rd
*>
xr
(
"xr"
,
__vertices
.
dimension_0
());
for
(
size_t
i
=
0
;
i
<
__vertices
.
dimension_0
();
++
i
)
{
xr
[
i
][
0
]
=
__vertices
[
i
][
0
];
xr
[
i
][
1
]
=
__vertices
[
i
][
1
];
}
MeshType
mesh
(
connectivity
,
xr
);
std
::
ofstream
gnuplot
(
"mesh.gnu"
);
for
(
int
j
=
0
;
j
<
mesh
.
numberOfCells
();
++
j
)
{
for
(
int
r
=
0
;
r
<
3
;
++
r
)
{
const
Rd
&
x
=
mesh
.
xr
()[
mesh
.
connectivity
().
cellNodes
()(
j
,
r
)];
gnuplot
<<
x
[
0
]
<<
' '
<<
x
[
1
]
<<
'\n'
;
}
const
Rd
&
x
=
mesh
.
xr
()[
mesh
.
connectivity
().
cellNodes
()(
j
,
0
)];
gnuplot
<<
x
[
0
]
<<
' '
<<
x
[
1
]
<<
"
\n\n
"
;
}
std
::
exit
(
0
);
}
else
if
((
dimension1_mask
,
elementNumber
)
>
0
)
{
std
::
cerr
<<
"*** using a 1d mesh (NIY)
\n
"
;
...
...
This diff is collapsed.
Click to expand it.
src/mesh/Mesh.hpp
+
12
−
0
View file @
25cf16b9
...
...
@@ -48,12 +48,24 @@ public:
:
m_connectivity
(
connectivity
),
m_xr
(
"xr"
,
connectivity
.
numberOfNodes
())
{
static_assert
(
Connectivity
::
dimension
==
1
,
"no automatic calculation of vertices in dim>1"
);
const
double
delta_x
=
1.
/
connectivity
.
numberOfCells
();
Kokkos
::
parallel_for
(
connectivity
.
numberOfNodes
(),
KOKKOS_LAMBDA
(
const
int
&
r
){
m_xr
[
r
][
0
]
=
r
*
delta_x
;
});
}
KOKKOS_INLINE_FUNCTION
Mesh
(
const
Connectivity
&
connectivity
,
Kokkos
::
View
<
Rd
*>&
xr
)
:
m_connectivity
(
connectivity
),
m_xr
(
xr
)
{
;
}
Mesh
()
=
delete
;
~
Mesh
()
{
;
...
...
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