1 /* 2 * ----------------------------------------------------------------- 3 * Programmer(s): Daniel R. Reynolds @ SMU 4 * ----------------------------------------------------------------- 5 * SUNDIALS Copyright Start 6 * Copyright (c) 2002-2021, Lawrence Livermore National Security 7 * and Southern Methodist University. 8 * All rights reserved. 9 * 10 * See the top-level LICENSE and NOTICE files for details. 11 * 12 * SPDX-License-Identifier: BSD-3-Clause 13 * SUNDIALS Copyright End 14 * ----------------------------------------------------------------- 15 * This is the header file contains the prototypes for functions to 16 * test SUNLinearSolver module implementations. 17 * ----------------------------------------------------------------- 18 */ 19 20 #include <math.h> 21 22 /* define constatnts */ 23 #define ZERO RCONST(0.0) 24 #define ONE RCONST(1.0) 25 26 /* NAN and floating point "equality" check, failure update macro */ 27 #if __STDC_VERSION__ >= 199901L 28 #define FNEQ(a,b,tol) (isnan(a) ? 1 : ( SUNRabs((a)-(b)) > tol )) 29 #else 30 #define FNEQ(a,b,tol) (( SUNRabs((a)-(b)) > tol )) 31 #endif 32 33 #ifdef __cplusplus /* wrapper to enable C++ usage */ 34 extern "C" { 35 #endif 36 /* Forward declarations for implementation specific utility functions */ 37 int check_vector(N_Vector X, N_Vector Y, realtype tol); 38 void sync_device(); 39 40 /* Test function declarations */ 41 int Test_SUNLinSolGetType(SUNLinearSolver S, SUNLinearSolver_Type suntype, int myid); 42 int Test_SUNLinSolGetID(SUNLinearSolver S, SUNLinearSolver_ID sunid, int myid); 43 int Test_SUNLinSolLastFlag(SUNLinearSolver S, int myid); 44 int Test_SUNLinSolSpace(SUNLinearSolver S, int myid); 45 int Test_SUNLinSolNumIters(SUNLinearSolver S, int myid); 46 int Test_SUNLinSolResNorm(SUNLinearSolver S, int myid); 47 int Test_SUNLinSolResid(SUNLinearSolver S, int myid); 48 int Test_SUNLinSolSetATimes(SUNLinearSolver S, void *ATdata, 49 ATimesFn ATimes, int myid); 50 int Test_SUNLinSolSetPreconditioner(SUNLinearSolver S, void *Pdata, 51 PSetupFn PSetup, PSolveFn PSolve, int myid); 52 int Test_SUNLinSolSetScalingVectors(SUNLinearSolver S, N_Vector s1, 53 N_Vector s2, int myid); 54 int Test_SUNLinSolInitialize(SUNLinearSolver S, int myid); 55 int Test_SUNLinSolSetup(SUNLinearSolver S, SUNMatrix A, int myid); 56 int Test_SUNLinSolSolve(SUNLinearSolver S, SUNMatrix A, N_Vector x, 57 N_Vector b, realtype tol, int myid); 58 59 /* Timing function */ 60 void SetTiming(int onoff); 61 62 #ifdef __cplusplus 63 } 64 #endif 65