diff options
author | Erik Schnetter <schnetter@gmail.com> | 2013-04-02 18:29:33 -0400 |
---|---|---|
committer | Erik Schnetter <schnetter@gmail.com> | 2013-04-02 18:29:33 -0400 |
commit | 671c86c079faa37386f59eb3c814dc837c4df4c5 (patch) | |
tree | 0cf5baa5bb9dc44a05c0b8ea78d867c17d8c1e49 /Carpet/CarpetLib/src/ggf.cc | |
parent | c0c03fece68597fddfef57948334c5c99154f244 (diff) |
Replace abs() by fabs()
Replace calls to abs() with floating arguments by calls to fabs(), to ensure the results are not accidentally truncated to integer.
Diffstat (limited to 'Carpet/CarpetLib/src/ggf.cc')
-rw-r--r-- | Carpet/CarpetLib/src/ggf.cc | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/Carpet/CarpetLib/src/ggf.cc b/Carpet/CarpetLib/src/ggf.cc index 17f9d9406..0f5015897 100644 --- a/Carpet/CarpetLib/src/ggf.cc +++ b/Carpet/CarpetLib/src/ggf.cc @@ -401,9 +401,8 @@ mg_restrict_all (comm_state & state, static Timer timer ("mg_restrict_all"); timer.start (); // Require same times - static_assert (abs(0.1) > 0, "Function CarpetLib::abs has wrong signature"); - assert (abs(t.get_time(ml,rl,0) - t.get_time(ml-1,rl,0)) - <= 1.0e-8 * (1.0 + abs(t.get_time(ml,rl,0)))); + assert (fabs(t.get_time(ml,rl,0) - t.get_time(ml-1,rl,0)) + <= 1.0e-8 * (1.0 + fabs(t.get_time(ml,rl,0)))); vector<int> const tl2s(1,tl); transfer_from_all (state, tl ,rl,ml, @@ -425,9 +424,8 @@ mg_prolongate_all (comm_state & state, static Timer timer ("mg_prolongate_all"); timer.start (); // Require same times - static_assert (abs(0.1) > 0, "Function CarpetLib::abs has wrong signature"); - assert (abs(t.get_time(ml,rl,0) - t.get_time(ml+1,rl,0)) - <= 1.0e-8 * (1.0 + abs(t.get_time(ml,rl,0)))); + assert (fabs(t.get_time(ml,rl,0) - t.get_time(ml+1,rl,0)) + <= 1.0e-8 * (1.0 + fabs(t.get_time(ml,rl,0)))); vector<int> const tl2s(1,tl); transfer_from_all (state, tl ,rl,ml, @@ -449,9 +447,8 @@ ref_restrict_all (comm_state & state, static Timer timer ("ref_restrict_all"); timer.start (); // Require same times - static_assert (abs(0.1) > 0, "Function CarpetLib::abs has wrong signature"); - assert (abs(t.get_time(ml,rl,tl) - t.get_time(ml,rl+1,tl)) <= - 1.0e-8 * (1.0 + abs(t.get_time(ml,rl,tl)))); + assert (fabs(t.get_time(ml,rl,tl) - t.get_time(ml,rl+1,tl)) <= + 1.0e-8 * (1.0 + fabs(t.get_time(ml,rl,tl)))); transfer_from_all (state, tl,rl ,ml, & dh::fast_dboxes::fast_ref_rest_sendrecv, @@ -500,9 +497,8 @@ ref_reflux_all (comm_state & state, static Timer timer ("ref_reflux_all"); timer.start (); // Require same times - static_assert (abs(0.1) > 0, "Function CarpetLib::abs has wrong signature"); - assert (abs(t.get_time(ml,rl,tl) - t.get_time(ml,rl+1,tl)) <= - 1.0e-8 * (1.0 + abs(t.get_time(ml,rl,tl)))); + assert (fabs(t.get_time(ml,rl,tl) - t.get_time(ml,rl+1,tl)) <= + 1.0e-8 * (1.0 + fabs(t.get_time(ml,rl,tl)))); islab slabinfo; slabinfo.is_centered = 1 - ivect::dir(dir); transfer_from_all (state, @@ -526,9 +522,8 @@ ref_reflux_prolongate_all (comm_state & state, static Timer timer ("ref_reflux_prolongate_all"); timer.start (); // Require same times - static_assert (abs(0.1) > 0, "Function CarpetLib::abs has wrong signature"); - assert (abs(t.get_time(ml,rl,tl) - t.get_time(ml,rl-1,tl)) <= - 1.0e-8 * (1.0 + abs(t.get_time(ml,rl,tl)))); + assert (fabs(t.get_time(ml,rl,tl) - t.get_time(ml,rl-1,tl)) <= + 1.0e-8 * (1.0 + fabs(t.get_time(ml,rl,tl)))); islab slabinfo; slabinfo.is_centered = 1 - ivect::dir(dir); transfer_from_all (state, |