Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
dune-fem-dg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
dune-fem
dune-fem-dg
Commits
4864409a
Commit
4864409a
authored
1 year ago
by
Robert K
Browse files
Options
Downloads
Patches
Plain Diff
[bugfix][CoarsestVolume] catch exception in case `father` is not
implemented.
parent
bb4336f1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#66195
passed
1 year ago
Stage: test
Changes
1
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dune/fem-dg/operator/adaptation/utility.hh
+16
-4
16 additions, 4 deletions
dune/fem-dg/operator/adaptation/utility.hh
with
16 additions
and
4 deletions
dune/fem-dg/operator/adaptation/utility.hh
+
16
−
4
View file @
4864409a
...
...
@@ -161,13 +161,24 @@ namespace Fem
typedef
std
::
pair
<
double
,
double
>
VolumePairType
;
template
<
class
Entity
>
double
findCoarsestVolume
(
const
Entity
&
entity
,
const
bool
hasGridHierarchy
)
const
double
findCoarsestVolume
(
const
Entity
&
entity
,
const
bool
hasGridHierarchy
,
bool
&
hasFather
)
const
{
// go to father, if possible
// otherwise write min and max volume on backup/restore
if
(
hasGridHierarchy
&&
entity
.
level
()
>
0
)
if
(
hasGridHierarchy
&&
(
entity
.
level
()
>
0
)
&&
hasFather
)
{
return
findCoarsestVolume
(
entity
.
father
(),
hasGridHierarchy
);
double
vol
=
0.0
;
// grids without hierarchy do not implement father method,
// but throw and exception instead
try
{
vol
=
findCoarsestVolume
(
entity
.
father
(),
hasGridHierarchy
,
hasFather
);
}
catch
(
const
Dune
::
NotImplemented
&
e
)
{
hasFather
=
false
;
vol
=
entity
.
geometry
().
volume
();
}
return
vol
;
}
else
// return entity's volume
return
entity
.
geometry
().
volume
();
...
...
@@ -181,6 +192,7 @@ namespace Fem
typedef
typename
GridPart
::
GridType
GridType
;
const
bool
hasGridHierarchy
=
Fem
::
GridPartCapabilities
::
hasGrid
<
GridPart
>
::
v
;
bool
hasFather
=
true
;
// will be set to false if father () fails
double
weight
=
Dune
::
DGFGridInfo
<
GridType
>::
refineWeight
();
// if weight is not set, use 1/(2^d)
...
...
@@ -194,7 +206,7 @@ namespace Fem
for
(
const
auto
&
en
:
elements
(
gridPart
)
)
{
const
double
volume
=
findCoarsestVolume
(
en
,
hasGridHierarchy
);
const
double
volume
=
findCoarsestVolume
(
en
,
hasGridHierarchy
,
hasFather
);
minVolume
[
0
]
=
std
::
min
(
minVolume
[
0
],
volume
);
maxVolume
[
0
]
=
std
::
max
(
maxVolume
[
0
],
volume
);
}
...
...
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