Peano
Loading...
Searching...
No Matches
Utils.py
Go to the documentation of this file.
1
# This file is part of the Peano load balancing toolbox. For conditions of
2
# distribution and use, please see the copyright notice at www.peano-framework.org
3
4
5
def
real_mesh_size_and_level(prescribed_h,
6
domain_size,
7
):
8
"""!
9
10
Returns the real mesh size plus the level used
11
12
Peano uses three-partitioning. That is, it will neve be able to match
13
given refinement instructions exactly. All it can do is to approximate
14
them.
15
16
This routine is a copy of exaparty.api.Project.real_mesh_size(), but I didn't
17
want to have dependencies between the two packages, i.e. exaparty and
18
the load balancing. Therefore, copying seems to be appropriate.
19
20
Return a tuple of mesh size and mesh levels
21
22
"""
23
h = domain_size
24
level = 0
25
while
h > prescribed_h:
26
h = h / 3.0
27
level += 1
28
return
(h, level)
29
30
31
def
compute_regular_mesh_construction_grid_construction_sweeps(level):
32
"""!
33
34
Determine after which step to split
35
36
This routine is given the level of a mesh and then determines how many
37
mesh construction sweeps Peano will need to get to this level. Usually,
38
people use this information to determine when to issue split instructions.
39
The routine is typically used with the second argument returned by
40
real_mesh_size_and_level().
41
42
The calculation is close to trivial: As Peano realises a strict
43
flag-then-refine paradigm, it needs two mesh traversals to add a completely
44
new mesh level to a spacetree grid. The first one flags all the fine grid
45
cells, the second one then does the actual refinement.
46
47
When we have just completed the very last refinement, we have to wait for
48
one more step to ensure that all the stats are
49
50
"""
51
return
2*level+0
src
toolbox
loadbalancing
api
Utils.py
Generated on Tue Nov 3 2026 16:05:41 for Peano by
1.9.8