Fixed header usage problems and added regression test

- Fixed improper inclusion of _hypre_utilities.h in user header files
- Added a 'check-headers.sh' regression test that compiles the examples with
  options that output header usage, then checks for internal header files
- Moved HYPRE_Init() to 'HYPRE_utilities.h'
This commit is contained in:
Rob Falgout 2020-06-02 10:05:01 -07:00
parent aeb23b4587
commit 4542bf0941
25 changed files with 609 additions and 523 deletions

View File

@ -0,0 +1,6 @@
mpicc
mpif77
include/fortran_matrix.h
include/multivector.h
include/interpreter.h
include/temp_multivector.h

41
AUTOTEST/check-headers.sh Executable file
View File

@ -0,0 +1,41 @@
#!/bin/sh
# Copyright 1998-2019 Lawrence Livermore National Security, LLC and other
# HYPRE Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
testname=`basename $0 .sh`
# Echo usage information
case $1 in
-h|-help)
cat <<EOF
$0 [-h] {src_dir}
where: {src_dir} is the hypre source directory
-h|-help prints this usage information and exits
This script checks hypre header usage.
Example usage: $0 ../src
EOF
exit
;;
esac
# Setup
src_dir=`cd $1; pwd`
shift
# Configure and make library
cd $src_dir
configure --enable-debug
make clean
make -j test
# Make examples and check header usage
cd examples
make clean
make COPTS="-H -g -Wall" |& grep "hypre/include" | grep -v "HYPRE" >&2

View File

@ -27,6 +27,7 @@
*/
#include <stdio.h>
#include <string.h>
/* Struct linear solvers header */
#include "HYPRE_struct_ls.h"

View File

@ -24,6 +24,9 @@
The eigensolver is LOBPCG with AMG preconditioner.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "HYPRE.h"
#include "HYPRE_parcsr_ls.h"

View File

@ -77,6 +77,9 @@
connectivity" point.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "HYPRE_sstruct_mv.h"
#include "HYPRE_sstruct_ls.h"

View File

@ -75,6 +75,9 @@
finite element problem in the SStruct interface.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "HYPRE_sstruct_mv.h"
#include "HYPRE_sstruct_ls.h"

View File

@ -39,6 +39,9 @@
this example.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "HYPRE_sstruct_mv.h"
#include "HYPRE_sstruct_ls.h"

View File

@ -34,6 +34,9 @@
We recommend comparing this example with Example 15.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "HYPRE_sstruct_mv.h"
#include "HYPRE_sstruct_ls.h"

View File

@ -24,6 +24,9 @@
an n x n sub-mesh of data, so the global mesh is nN x nN.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "HYPRE_sstruct_mv.h"
#include "HYPRE_sstruct_ls.h"

View File

@ -26,6 +26,7 @@
*/
#include <stdio.h>
#include <string.h>
/* Struct linear solvers header */
#include "HYPRE_struct_ls.h"

View File

@ -43,6 +43,9 @@
example.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "HYPRE_struct_ls.h"

View File

@ -52,6 +52,9 @@
example.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "HYPRE_krylov.h"
#include "HYPRE_struct_ls.h"

View File

@ -23,6 +23,9 @@
solvers are AMG, PCG, and PCG with AMG or Parasails
preconditioners. */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "HYPRE_krylov.h"
#include "HYPRE.h"

View File

@ -31,6 +31,9 @@
recommend comparing this example with Example 5.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "HYPRE_krylov.h"
#include "HYPRE.h"

View File

@ -27,6 +27,8 @@
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* SStruct linear solvers headers */
#include "HYPRE_sstruct_ls.h"

View File

@ -46,6 +46,9 @@
chapter of the User's Manual.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "HYPRE_krylov.h"
#include "HYPRE_sstruct_ls.h"

View File

@ -26,6 +26,8 @@
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* SStruct linear solvers headers */
#include "HYPRE_sstruct_ls.h"

View File

@ -38,6 +38,9 @@
We recommend viewing Examples 3, 6 and 7 before this example.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "HYPRE_sstruct_ls.h"
#include "HYPRE_krylov.h"

View File

@ -6,6 +6,7 @@
******************************************************************************/
#include "multivector.h"
#include "_hypre_utilities.h"
#ifndef LOCALLY_OPTIMAL_BLOCK_PRECONDITIONED_CONJUGATE_GRADIENTS
#define LOCALLY_OPTIMAL_BLOCK_PRECONDITIONED_CONJUGATE_GRADIENTS

View File

@ -37,11 +37,7 @@
#include <time.h>
#include "fortran_matrix.h"
#include "HYPRE_lobpcg.h"
#include "interpreter.h"
#include "multivector.h"
#include "HYPRE_MatvecFunctions.h"
/* end lobpcg */

View File

@ -36,13 +36,8 @@
#include <assert.h>
#include <time.h>
#include "fortran_matrix.h"
#include "HYPRE_lobpcg.h"
#include "interpreter.h"
#include "multivector.h"
#include "HYPRE_MatvecFunctions.h"
/* max dt */
#define DT_INF 1.0e30
HYPRE_Int

View File

@ -109,6 +109,13 @@ typedef HYPRE_Int MPI_Comm;
/* bits 4-8 are reserved for the index of the argument error */
#define HYPRE_ERROR_CONV 256 /* method did not converge as expected */
/*--------------------------------------------------------------------------
* HYPRE init/finalize
*--------------------------------------------------------------------------*/
HYPRE_Int HYPRE_Init();
HYPRE_Int HYPRE_Finalize();
/*--------------------------------------------------------------------------
* HYPRE error user functions
*--------------------------------------------------------------------------*/

View File

@ -2919,8 +2919,6 @@ HYPRE_Real hypre_cimag( HYPRE_Complex value );
hypre_Handle* hypre_handle();
hypre_Handle* hypre_HandleCreate();
HYPRE_Int hypre_HandleDestroy(hypre_Handle *hypre_handle_);
HYPRE_Int HYPRE_Init();
HYPRE_Int HYPRE_Finalize();
HYPRE_Int hypre_SetDevice(HYPRE_Int use_device, hypre_Handle *hypre_handle_);
/* hypre_qsort.c */

File diff suppressed because it is too large Load Diff

View File

@ -8,13 +8,13 @@
#ifndef FORTRAN_STYLE_MATRIX
#define FORTRAN_STYLE_MATRIX
#include "_hypre_utilities.h"
#include "HYPRE_utilities.h"
typedef struct
{
hypre_longint globalHeight;
hypre_longint height;
hypre_longint width;
HYPRE_BigInt globalHeight;
HYPRE_BigInt height;
HYPRE_BigInt width;
HYPRE_Real* value;
HYPRE_Int ownsValues;
} utilities_FortranMatrix;
@ -26,19 +26,19 @@ extern "C" {
utilities_FortranMatrix*
utilities_FortranMatrixCreate(void);
void
utilities_FortranMatrixAllocateData( hypre_longint h, hypre_longint w,
utilities_FortranMatrixAllocateData( HYPRE_BigInt h, HYPRE_BigInt w,
utilities_FortranMatrix* mtx );
void
utilities_FortranMatrixWrap( HYPRE_Real*, hypre_longint gh, hypre_longint h, hypre_longint w,
utilities_FortranMatrixWrap( HYPRE_Real*, HYPRE_BigInt gh, HYPRE_BigInt h, HYPRE_BigInt w,
utilities_FortranMatrix* mtx );
void
utilities_FortranMatrixDestroy( utilities_FortranMatrix* mtx );
hypre_longint
HYPRE_BigInt
utilities_FortranMatrixGlobalHeight( utilities_FortranMatrix* mtx );
hypre_longint
HYPRE_BigInt
utilities_FortranMatrixHeight( utilities_FortranMatrix* mtx );
hypre_longint
HYPRE_BigInt
utilities_FortranMatrixWidth( utilities_FortranMatrix* mtx );
HYPRE_Real*
utilities_FortranMatrixValues( utilities_FortranMatrix* mtx );
@ -89,17 +89,17 @@ utilities_FortranMatrixFNorm( utilities_FortranMatrix* mtx );
HYPRE_Real
utilities_FortranMatrixValue( utilities_FortranMatrix* mtx,
hypre_longint i, hypre_longint j );
HYPRE_BigInt i, HYPRE_BigInt j );
HYPRE_Real*
utilities_FortranMatrixValuePtr( utilities_FortranMatrix* mtx,
hypre_longint i, hypre_longint j );
HYPRE_BigInt i, HYPRE_BigInt j );
HYPRE_Real
utilities_FortranMatrixMaxValue( utilities_FortranMatrix* mtx );
void
utilities_FortranMatrixSelectBlock( utilities_FortranMatrix* mtx,
hypre_longint iFrom, hypre_longint iTo,
hypre_longint jFrom, hypre_longint jTo,
HYPRE_BigInt iFrom, HYPRE_BigInt iTo,
HYPRE_BigInt jFrom, HYPRE_BigInt jTo,
utilities_FortranMatrix* block );
void
utilities_FortranMatrixUpperInv( utilities_FortranMatrix* u );