-
Notifications
You must be signed in to change notification settings - Fork 707
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ParameterHandler::add_parameter(): do not call action
- Loading branch information
Showing
5 changed files
with
72 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Fixed: The function ParamerHandler::add_parameter() used to | ||
call the internal action. Within that step, the action | ||
converts the default value to a string and back afterwards. | ||
This can lead to round-off errors so that the default | ||
values might change in the case of floating-point numbers. | ||
The action is not called any more during ParamerHandler::add_parameter(), | ||
fixing the problem. | ||
<br> | ||
(Peter Munch, Magdalena Schreter, 2022/12/11) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// --------------------------------------------------------------------- | ||
// | ||
// Copyright (C) 2022 by the deal.II authors | ||
// | ||
// This file is part of the deal.II library. | ||
// | ||
// The deal.II library is free software; you can use it, redistribute | ||
// it, and/or modify it under the terms of the GNU Lesser General | ||
// Public License as published by the Free Software Foundation; either | ||
// version 2.1 of the License, or (at your option) any later version. | ||
// The full text of the license can be found in the file LICENSE.md at | ||
// the top level directory of deal.II. | ||
// | ||
// --------------------------------------------------------------------- | ||
|
||
|
||
|
||
// check that ParameterHandler::add_parameter() does not modify the | ||
// default value | ||
|
||
#include <deal.II/base/parameter_handler.h> | ||
|
||
#include "../tests.h" | ||
|
||
using namespace dealii; | ||
|
||
int | ||
main() | ||
{ | ||
initlog(); | ||
|
||
double a = std::numeric_limits<double>::lowest(); | ||
|
||
AssertThrow(a == std::numeric_limits<double>::lowest(), ExcInternalError()); | ||
|
||
ParameterHandler prm; | ||
prm.add_parameter("test", a); | ||
|
||
AssertThrow(a == std::numeric_limits<double>::lowest(), ExcInternalError()); | ||
|
||
deallog << "OK!" << std::endl; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
DEAL::OK! |