Skip to content

Commit

Permalink
Resolved unused-variable 'errors'
Browse files Browse the repository at this point in the history
  • Loading branch information
drreynolds committed Sep 6, 2024
1 parent 7a38980 commit 816a24f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -809,8 +809,6 @@ int main(int argc, char* argv[])
static int ff(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data)
{
Options* opts = (Options*)user_data;
const sunrealtype u = NV_Ith_S(y, 0);
const sunrealtype v = NV_Ith_S(y, 1);
const sunrealtype w = NV_Ith_S(y, 2);

// fill in the RHS function:
Expand Down Expand Up @@ -845,7 +843,6 @@ static int fse(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data)
Options* opts = (Options*)user_data;
const sunrealtype u = NV_Ith_S(y, 0);
const sunrealtype v = NV_Ith_S(y, 1);
const sunrealtype w = NV_Ith_S(y, 2);

// fill in the RHS function:
NV_Ith_S(ydot, 0) = opts->a + v * u * u;
Expand All @@ -859,9 +856,7 @@ static int fse(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data)
// fsi routine to compute the slow portion of the ODE RHS.(currently same as fse)
static int fsi(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data)
{
Options* opts = (Options*)user_data;
const sunrealtype u = NV_Ith_S(y, 0);
const sunrealtype v = NV_Ith_S(y, 1);
const sunrealtype w = NV_Ith_S(y, 2);

// fill in the RHS function:
Expand Down Expand Up @@ -898,7 +893,6 @@ static int f0(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data)
static int Js(sunrealtype t, N_Vector y, N_Vector fy, SUNMatrix J,
void* user_data, N_Vector tmp1, N_Vector tmp2, N_Vector tmp3)
{
Options* opts = (Options*)user_data;
const sunrealtype u = NV_Ith_S(y, 0);
const sunrealtype v = NV_Ith_S(y, 1);
const sunrealtype w = NV_Ith_S(y, 2);
Expand All @@ -923,9 +917,7 @@ static int Js(sunrealtype t, N_Vector y, N_Vector fy, SUNMatrix J,
static int Jsi(sunrealtype t, N_Vector y, N_Vector fy, SUNMatrix J,
void* user_data, N_Vector tmp1, N_Vector tmp2, N_Vector tmp3)
{
Options* opts = (Options*)user_data;
const sunrealtype u = NV_Ith_S(y, 0);
const sunrealtype v = NV_Ith_S(y, 1);
const sunrealtype w = NV_Ith_S(y, 2);

// fill in the Jacobian:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ int main(int argc, char* argv[])
sunindextype NEQ = 3; // number of dependent vars.
string method; // MRI method name
int test = 2; // test problem to run
sunrealtype a, b, u0, v0, w0; // parameters
sunrealtype u0, v0, w0; // parameters
sunrealtype reltol = SUN_RCONST(1.e-10); // fast solver tolerances
sunrealtype abstol = SUN_RCONST(1.e-12);

Expand Down Expand Up @@ -233,7 +233,7 @@ int main(int argc, char* argv[])
cout << " partition size = " << udata.Npart << endl;
cout << " initial conditions: u0 = " << u0 << ", v0 = " << v0
<< ", w0 = " << w0 << endl;
cout << " problem parameters: a = " << a << ", b = " << b
cout << " problem parameters: a = " << udata.a << ", b = " << udata.b
<< ", ep = " << udata.ep << endl;
cout << " MRI method: " << method;
if (imex) { cout << " (ImEx)" << endl; }
Expand Down Expand Up @@ -392,7 +392,6 @@ static int fi(sunrealtype t, N_Vector y, N_Vector ydot, void* user_data)
{
UserData* udata = (UserData*)user_data;
sunrealtype u = NV_Ith_S(y, 0); // access solution values
sunrealtype v = NV_Ith_S(y, 1);
sunrealtype w = NV_Ith_S(y, 2);

// fill in the RHS function
Expand Down Expand Up @@ -450,7 +449,6 @@ static int Ji(sunrealtype t, N_Vector y, N_Vector fy, SUNMatrix J,
{
UserData* udata = (UserData*)user_data;
sunrealtype u = NV_Ith_S(y, 0); // access solution values
sunrealtype v = NV_Ith_S(y, 1);
sunrealtype w = NV_Ith_S(y, 2);

// fill in the Jacobian
Expand Down
7 changes: 4 additions & 3 deletions test/unit_tests/utilities/test_utilities.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* -----------------------------------------------------------------------------
* Programmer(s): David J. Gardner @ LLNL
* Daniel R. Reynolds @ SMU
* -----------------------------------------------------------------------------
* SUNDIALS Copyright Start
* Copyright (c) 2002-2023, Lawrence Livermore National Security
Expand All @@ -11,7 +12,7 @@
* SPDX-License-Identifier: BSD-3-Clause
* SUNDIALS Copyright End
* -----------------------------------------------------------------------------
* Utility functions for C++ examples
* Utility functions for C++ unit tests.
* ---------------------------------------------------------------------------*/

#include <algorithm>
Expand All @@ -20,7 +21,7 @@
#include <vector>

// Check function return flag
int check_flag(const int flag, const std::string funcname)
static int check_flag(const int flag, const std::string funcname)
{
if (!flag) return 0;
if (flag < 0) std::cerr << "ERROR: ";
Expand All @@ -29,7 +30,7 @@ int check_flag(const int flag, const std::string funcname)
}

// Check if a function returned a NULL pointer
int check_ptr(const void* ptr, const std::string funcname)
static int check_ptr(const void* ptr, const std::string funcname)
{
if (ptr) return 0;
std::cerr << "ERROR: " << funcname << " returned NULL" << std::endl;
Expand Down

0 comments on commit 816a24f

Please sign in to comment.