Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
hyteg
hyteg
Commits
72da656f
Commit
72da656f
authored
Nov 29, 2021
by
Benjamin Mann
Browse files
restrict RG-refinement to rank=0
parent
243b0b08
Pipeline
#36018
failed with stages
in 105 minutes and 55 seconds
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
src/hyteg/mesh/adaptiverefinement/mesh.cpp
View file @
72da656f
...
...
@@ -36,12 +36,14 @@ template < class K_Simplex >
K_Mesh
<
K_Simplex
>::
K_Mesh
(
const
MeshInfo
&
meshInfo
)
:
_setupStorage
(
meshInfo
,
uint_c
(
walberla
::
mpi
::
MPIManager
::
instance
()
->
numProcesses
()
)
)
{
if
(
walberla
::
mpi
::
MPIManager
::
instance
()
->
rank
()
==
0
)
{
// extract vertices
const
uint_t
n_vtx
s
=
meshInfo
.
getVertices
().
size
();
_vertices
.
resize
(
n_v
tx
s
);
_n_vertice
s
=
meshInfo
.
getVertices
().
size
();
_vertices
.
resize
(
_
n_v
ertice
s
);
// [0,1,...,n-1]
std
::
vector
<
uint_t
>
vtxIndices
(
n_v
tx
s
);
std
::
vector
<
uint_t
>
vtxIndices
(
_
n_v
ertice
s
);
// convert MeshInfo::vertexID to Mesh::vertexID
std
::
map
<
MeshInfo
::
IDType
,
uint_t
>
conversion
;
...
...
@@ -84,6 +86,10 @@ K_Mesh< K_Simplex >::K_Mesh( const MeshInfo& meshInfo )
}
init_elements
(
fac
.
faces
(),
cells
);
_n_elements
=
_T
.
size
();
}
// todo communication (_n_vertices, _n_elements)
}
template
<
>
...
...
@@ -116,6 +122,10 @@ void K_Mesh< Simplex3 >::init_elements( const std::map< Idx< 3 >, std::shared_pt
template
<
class
K_Simplex
>
void
K_Mesh
<
K_Simplex
>::
refineRG
(
const
std
::
vector
<
PrimitiveID
>&
elements_to_refine
)
{
auto
meshInfo
=
hyteg
::
MeshInfo
::
emptyMeshInfo
();
if
(
walberla
::
mpi
::
MPIManager
::
instance
()
->
rank
()
==
0
)
{
auto
R
=
init_R
(
elements_to_refine
);
// remove green edges
remove_green_edges
(
R
);
...
...
@@ -139,9 +149,15 @@ void K_Mesh< K_Simplex >::refineRG( const std::vector< PrimitiveID >& elements_t
// update current configuration
_T
=
U
;
_T
.
merge
(
refined
);
_n_vertices
=
_vertices
.
size
();
_n_elements
=
_T
.
size
();
// update setupStorage
auto
meshInfo
=
export_meshInfo
();
meshInfo
=
export_meshInfo
();
}
// todo communication (meshInfo, _n_vertices, _n_elements)
_setupStorage
=
SetupPrimitiveStorage
(
meshInfo
,
uint_c
(
walberla
::
mpi
::
MPIManager
::
instance
()
->
numProcesses
()
)
);
}
...
...
@@ -468,6 +484,8 @@ std::pair< real_t, real_t > K_Mesh< K_Simplex >::min_max_angle() const
{
std
::
pair
<
real_t
,
real_t
>
mm
{
10
,
0
};
if
(
walberla
::
mpi
::
MPIManager
::
instance
()
->
rank
()
==
0
)
{
for
(
auto
&
el
:
_T
)
{
auto
mm_el
=
el
->
min_max_angle
(
_vertices
);
...
...
@@ -475,6 +493,9 @@ std::pair< real_t, real_t > K_Mesh< K_Simplex >::min_max_angle() const
mm
.
first
=
std
::
min
(
mm
.
first
,
mm_el
.
first
);
mm
.
second
=
std
::
max
(
mm
.
second
,
mm_el
.
second
);
}
}
// todo communication (mm)
return
mm
;
}
...
...
@@ -484,10 +505,15 @@ real_t K_Mesh< K_Simplex >::volume() const
{
real_t
v_tot
=
0
;
if
(
walberla
::
mpi
::
MPIManager
::
instance
()
->
rank
()
==
0
)
{
for
(
auto
&
el
:
_T
)
{
v_tot
+=
el
->
volume
(
_vertices
);
}
}
// todo communication (v_tot)
return
v_tot
;
}
...
...
src/hyteg/mesh/adaptiverefinement/mesh.hpp
View file @
72da656f
...
...
@@ -53,10 +53,8 @@ class K_Mesh
// get SetupPrimitiveStorage corresponding to current refinement
inline
SetupPrimitiveStorage
&
setupStorage
()
{
return
_setupStorage
;
};
inline
const
std
::
vector
<
Point3D
>&
vertices
()
const
{
return
_vertices
;
}
inline
const
std
::
set
<
std
::
shared_ptr
<
K_Simplex
>
>&
elements
()
const
{
return
_T
;
}
inline
uint_t
n_elements
()
const
{
return
_T
.
size
();
}
inline
uint_t
n_vtx
()
const
{
return
_vertices
.
size
();
}
inline
uint_t
n_elements
()
const
{
return
_n_elements
;
}
inline
uint_t
n_vtx
()
const
{
return
_n_vertices
;
}
private:
/* remove green edges from _T and replace the corresponding faces in R with their parents
...
...
@@ -111,6 +109,8 @@ class K_Mesh
/* generate MeshInfo corresponding to current refinement */
hyteg
::
MeshInfo
export_meshInfo
()
const
;
uint_t
_n_vertices
;
uint_t
_n_elements
;
std
::
vector
<
Point3D
>
_vertices
;
std
::
set
<
std
::
shared_ptr
<
K_Simplex
>
>
_T
;
// set of elements of current refinement level
SetupPrimitiveStorage
_setupStorage
;
// primitive storage of current refinement level
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment