Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
dorie
dorie
Commits
a97c2b28
Commit
a97c2b28
authored
Feb 06, 2019
by
Lukas Riedel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Disable get_water_flux_reconstructed at compile-time
Use enable_if instead of throwing at run-time
parent
3d209140
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
48 deletions
+47
-48
dune/dorie/model/richards/richards.hh
dune/dorie/model/richards/richards.hh
+47
-48
No files found.
dune/dorie/model/richards/richards.hh
View file @
a97c2b28
...
...
@@ -542,60 +542,57 @@ public:
*
* @return Pointer to a (reconstructed) water flux grid function
*/
std
::
shared_ptr
<
const
GFFluxReconstruction
>
get_water_flux_reconstructed
(
ConstState
state
)
const
template
<
bool
enabled
=
enable_rt_engine
>
std
::
enable_if_t
<
enabled
,
std
::
shared_ptr
<
const
GFFluxReconstruction
>>
get_water_flux_reconstructed
(
ConstState
state
)
const
{
std
::
shared_ptr
<
GFFluxReconstruction
>
gf_ptr
;
auto
&
cache
=
cache_water_flux_gf_rt
;
if
constexpr
(
enable_rt_engine
)
if
(
state
.
grid_function_space
!=
gfs
or
state
.
coefficients
!=
u
or
state
.
time
!=
current_time
())
{
// if state is different to current state, create flux from zero
if
(
state
.
grid_function_space
!=
gfs
or
state
.
coefficients
!=
u
or
state
.
time
!=
current_time
())
{
// if state is different to current state, create flux from zero
gf_ptr
=
std
::
make_unique
<
GFFluxReconstruction
>
(
this
->
_log
,
gv
,
inifile
.
sub
(
"fluxReconstruction"
));
assert
(
fboundary
);
assert
(
fparam
);
assert
(
slop
);
slop
->
setTime
(
state
.
time
);
// update it with the state
gf_ptr
->
update
(
*
(
state
.
coefficients
),
*
(
state
.
grid_function_space
),
*
slop
);
slop
->
setTime
(
current_time
());
}
else
if
(
not
cache
)
{
// if state is equal to current state, use cache.
cache
=
std
::
make_unique
<
GFFluxReconstruction
>
(
this
->
_log
,
gv
,
inifile
.
sub
(
"fluxReconstruction"
));
assert
(
fboundary
);
assert
(
fparam
);
assert
(
slop
);
// update it with current state
cache
->
update
(
*
u
,
*
gfs
,
*
slop
);
gf_ptr
=
cache
;
}
else
{
gf_ptr
=
cache
;
}
}
else
{
DUNE_THROW
(
NotImplemented
,
"Flux reconstruction is not implemented for the selected "
<<
"configuration"
);
gf_ptr
=
std
::
make_unique
<
GFFluxReconstruction
>
(
this
->
_log
,
gv
,
inifile
.
sub
(
"fluxReconstruction"
));
assert
(
fboundary
);
assert
(
fparam
);
assert
(
slop
);
slop
->
setTime
(
state
.
time
);
// update it with the state
gf_ptr
->
update
(
*
(
state
.
coefficients
),
*
(
state
.
grid_function_space
),
*
slop
);
slop
->
setTime
(
current_time
());
}
// if state is equal to current state, use cache.
else
if
(
not
cache
)
{
cache
=
std
::
make_unique
<
GFFluxReconstruction
>
(
this
->
_log
,
gv
,
inifile
.
sub
(
"fluxReconstruction"
));
assert
(
fboundary
);
assert
(
fparam
);
assert
(
slop
);
// update it with current state
cache
->
update
(
*
u
,
*
gfs
,
*
slop
);
gf_ptr
=
cache
;
}
else
{
gf_ptr
=
cache
;
}
return
gf_ptr
;
}
...
...
@@ -604,10 +601,12 @@ public:
*
* @return Pointer to a (reconstructed) water flux grid function
*/
std
::
shared_ptr
<
const
GFFluxReconstruction
>
get_water_flux_reconstructed
()
const
template
<
bool
enabled
=
enable_rt_engine
>
std
::
enable_if_t
<
enabled
,
std
::
shared_ptr
<
const
GFFluxReconstruction
>>
get_water_flux_reconstructed
()
const
{
return
get_water_flux_reconstructed
(
current_state
());
}
}
protected:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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