From ad42a616954ee7d2c3a78e52f21c28995662adbb Mon Sep 17 00:00:00 2001 From: donnaaboise Date: Wed, 18 Dec 2024 23:41:15 +0300 Subject: [PATCH] Remove snippets directory --- snippets/tst_2darray/Makefile | 7 - snippets/tst_2darray/README | 15 - snippets/tst_2darray/array.f | 14 - snippets/tst_2darray/prog.c | 45 --- snippets/tst_array_f90/Makefile | 7 - snippets/tst_array_f90/array.f90 | 47 --- snippets/tst_array_f90/prog.c | 31 -- snippets/tst_array_ptr/Makefile | 7 - snippets/tst_array_ptr/array.f90 | 51 ---- snippets/tst_array_ptr/prog.c | 23 -- snippets/tst_cuda_function_ptrs/tst_fptrs.cu | 35 --- snippets/tst_cuda_function_ptrs/tst_fptrs.h | 22 -- snippets/tst_cuda_function_ptrs/user_f.cu | 49 --- snippets/tst_cuda_function_ptrs/user_f.h | 22 -- snippets/tst_cuda_reduce/reduce_max.cu | 120 -------- snippets/tst_cuda_reduce/reduce_sum.cu | 140 --------- snippets/tst_cyclic_dependency/Makefile | 10 - snippets/tst_cyclic_dependency/global.c | 12 - snippets/tst_cyclic_dependency/global.h | 15 - snippets/tst_cyclic_dependency/pkg.c | 7 - snippets/tst_cyclic_dependency/pkg.h | 14 - snippets/tst_cyclic_dependency/prog.c | 27 -- snippets/tst_f90_alloc/Makefile | 7 - snippets/tst_f90_alloc/array.f90 | 35 --- snippets/tst_f90_alloc/array_handling.f90 | 49 --- snippets/tst_f90_alloc/prog.c | 49 --- snippets/tst_fortran_io/Makefile | 7 - snippets/tst_fortran_io/hello.f90 | 22 -- snippets/tst_fortran_io/hello_1.f90 | 81 ----- snippets/tst_fortran_io/prog.c | 39 --- snippets/tst_funcptr/Makefile | 32 -- snippets/tst_funcptr/Makefile.inc | 4 - snippets/tst_funcptr/cube.cpp | 19 -- snippets/tst_funcptr/math_value.f | 9 - snippets/tst_funcptr/set_value_to_2.f | 7 - snippets/tst_funcptr/set_value_to_5.f | 7 - snippets/tst_funcptr/square.c | 20 -- snippets/tst_funcptr/tst_funcptr.cpp | 37 --- snippets/tst_iso_c_bindings/Makefile | 12 - snippets/tst_iso_c_bindings/assign.f | 18 -- snippets/tst_iso_c_bindings/c_routines.i | 13 - snippets/tst_iso_c_bindings/prog.c | 39 --- snippets/tst_iso_c_bindings/prog.cpp | 37 --- snippets/tst_nans/limiter.f | 19 -- snippets/tst_nans/prog.c | 41 --- snippets/tst_netcdf_fileio/Makefile | 7 - snippets/tst_netcdf_fileio/main.c | 139 --------- snippets/tst_netcdf_fileio/test_ncfile.ipynb | 116 -------- snippets/tst_parser/Makefile | 17 -- snippets/tst_parser/dictionary.h | 192 ------------ snippets/tst_parser/example_parser.cpp | 115 -------- snippets/tst_parser/fclaw.ini | 42 --- snippets/tst_parser/iniparser.h | 295 ------------------- snippets/tst_parser/parser.H | 37 --- snippets/tst_parser/parser.cpp | 113 ------- snippets/tst_static_storage/foo.H | 9 - snippets/tst_static_storage/foo.cpp | 16 - snippets/tst_static_storage/main.cpp | 19 -- snippets/tst_typedefs/f3.c | 14 - 59 files changed, 2454 deletions(-) delete mode 100644 snippets/tst_2darray/Makefile delete mode 100644 snippets/tst_2darray/README delete mode 100644 snippets/tst_2darray/array.f delete mode 100644 snippets/tst_2darray/prog.c delete mode 100644 snippets/tst_array_f90/Makefile delete mode 100644 snippets/tst_array_f90/array.f90 delete mode 100644 snippets/tst_array_f90/prog.c delete mode 100644 snippets/tst_array_ptr/Makefile delete mode 100644 snippets/tst_array_ptr/array.f90 delete mode 100644 snippets/tst_array_ptr/prog.c delete mode 100644 snippets/tst_cuda_function_ptrs/tst_fptrs.cu delete mode 100644 snippets/tst_cuda_function_ptrs/tst_fptrs.h delete mode 100644 snippets/tst_cuda_function_ptrs/user_f.cu delete mode 100644 snippets/tst_cuda_function_ptrs/user_f.h delete mode 100644 snippets/tst_cuda_reduce/reduce_max.cu delete mode 100644 snippets/tst_cuda_reduce/reduce_sum.cu delete mode 100644 snippets/tst_cyclic_dependency/Makefile delete mode 100644 snippets/tst_cyclic_dependency/global.c delete mode 100644 snippets/tst_cyclic_dependency/global.h delete mode 100644 snippets/tst_cyclic_dependency/pkg.c delete mode 100644 snippets/tst_cyclic_dependency/pkg.h delete mode 100644 snippets/tst_cyclic_dependency/prog.c delete mode 100644 snippets/tst_f90_alloc/Makefile delete mode 100644 snippets/tst_f90_alloc/array.f90 delete mode 100644 snippets/tst_f90_alloc/array_handling.f90 delete mode 100644 snippets/tst_f90_alloc/prog.c delete mode 100644 snippets/tst_fortran_io/Makefile delete mode 100644 snippets/tst_fortran_io/hello.f90 delete mode 100644 snippets/tst_fortran_io/hello_1.f90 delete mode 100644 snippets/tst_fortran_io/prog.c delete mode 100644 snippets/tst_funcptr/Makefile delete mode 100644 snippets/tst_funcptr/Makefile.inc delete mode 100644 snippets/tst_funcptr/cube.cpp delete mode 100644 snippets/tst_funcptr/math_value.f delete mode 100644 snippets/tst_funcptr/set_value_to_2.f delete mode 100644 snippets/tst_funcptr/set_value_to_5.f delete mode 100644 snippets/tst_funcptr/square.c delete mode 100644 snippets/tst_funcptr/tst_funcptr.cpp delete mode 100644 snippets/tst_iso_c_bindings/Makefile delete mode 100644 snippets/tst_iso_c_bindings/assign.f delete mode 100644 snippets/tst_iso_c_bindings/c_routines.i delete mode 100644 snippets/tst_iso_c_bindings/prog.c delete mode 100644 snippets/tst_iso_c_bindings/prog.cpp delete mode 100644 snippets/tst_nans/limiter.f delete mode 100644 snippets/tst_nans/prog.c delete mode 100644 snippets/tst_netcdf_fileio/Makefile delete mode 100644 snippets/tst_netcdf_fileio/main.c delete mode 100644 snippets/tst_netcdf_fileio/test_ncfile.ipynb delete mode 100644 snippets/tst_parser/Makefile delete mode 100644 snippets/tst_parser/dictionary.h delete mode 100644 snippets/tst_parser/example_parser.cpp delete mode 100644 snippets/tst_parser/fclaw.ini delete mode 100644 snippets/tst_parser/iniparser.h delete mode 100644 snippets/tst_parser/parser.H delete mode 100644 snippets/tst_parser/parser.cpp delete mode 100644 snippets/tst_static_storage/foo.H delete mode 100644 snippets/tst_static_storage/foo.cpp delete mode 100644 snippets/tst_static_storage/main.cpp delete mode 100644 snippets/tst_typedefs/f3.c diff --git a/snippets/tst_2darray/Makefile b/snippets/tst_2darray/Makefile deleted file mode 100644 index 4241915c6..000000000 --- a/snippets/tst_2darray/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -all: - gfortran -g -c array.f - gcc -g -c prog.c - gcc -o tst_prog prog.o array.o - -clean: - rm -f *.o *~ tst_prog diff --git a/snippets/tst_2darray/README b/snippets/tst_2darray/README deleted file mode 100644 index d21307a97..000000000 --- a/snippets/tst_2darray/README +++ /dev/null @@ -1,15 +0,0 @@ -This example tries to understand why gdb produces the error : - - a=, - val=3.1415899999999999) at array.f:1 - - -Seems that it is related to the double* being in a struct. - - - - - - - - diff --git a/snippets/tst_2darray/array.f b/snippets/tst_2darray/array.f deleted file mode 100644 index e93b2370d..000000000 --- a/snippets/tst_2darray/array.f +++ /dev/null @@ -1,14 +0,0 @@ - subroutine assign_array(m,a,val) - implicit none - - integer m - double precision val - double precision a(m) - - integer i,j - - do i = 1,m - a(i) = val - enddo - - end \ No newline at end of file diff --git a/snippets/tst_2darray/prog.c b/snippets/tst_2darray/prog.c deleted file mode 100644 index 3a5507607..000000000 --- a/snippets/tst_2darray/prog.c +++ /dev/null @@ -1,45 +0,0 @@ -#include - -typedef struct array array_t; - -struct array -{ - double *data[2]; -}; - -void assign_array_(int* m, double* array, double* val); - -int main() -{ - int n, k; - double val; - array_t *a; - double *b; - - n = 8; - val = 3.14159; - - a = (array_t*) malloc(sizeof(array_t)); - for(k = 0; k < 2; k++) - { - a->data[k] = (double*) malloc(sizeof(double)*n); - } - - for(k = 0; k < 2; k++) - { - /* Can produce gdb "a=data[k],&val); - - /* Doesn't seem to produce gdb error */ - b = a->data[k]; - assign_array_(&n,b,&val); - } - - for(k = 0; k < 2; k++) - { - free(a->data[k]); - } - free(a); - - return 0; -} diff --git a/snippets/tst_array_f90/Makefile b/snippets/tst_array_f90/Makefile deleted file mode 100644 index 4d4546396..000000000 --- a/snippets/tst_array_f90/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -all: - gfortran -g -c array.f90 -std=f95 - gcc -g -c prog.c - gcc -o tst_prog prog.o array.o -lgfortran - -clean: - rm -f *.o *~ *.mod tst_prog diff --git a/snippets/tst_array_f90/array.f90 b/snippets/tst_array_f90/array.f90 deleted file mode 100644 index 0aa87772d..000000000 --- a/snippets/tst_array_f90/array.f90 +++ /dev/null @@ -1,47 +0,0 @@ -MODULE test_mod - - DOUBLE PRECISION, ALLOCATABLE, DIMENSION(:) :: array - integer :: nsize - -END MODULE test_mod - -SUBROUTINE assign_array(x,n) - USE test_mod - IMPLICIT NONE - - INTEGER :: n - DOUBLE PRECISION :: x(n) - - CALL test_allocated() - array = x - CALL test_allocated() - - nsize = n - -END SUBROUTINE assign_array - - -SUBROUTINE print_array() - USE test_mod, ONLY: nsize, array - IMPLICIT NONE - - INTEGER :: i - - DO i = 1,nsize - WRITE(6,'(F24.16)') array(i) - END DO - -END SUBROUTINE print_array - -SUBROUTINE test_allocated() - USE test_mod - IMPLICIT NONE - - IF (ALLOCATED(array)) THEN - WRITE(6,*) 'Array is allocated' - WRITE(6,*) 'size is ', SIZE(array) - ELSE - WRITE(6,*) 'Array is NOT allocated' - END IF - -END SUBROUTINE test_allocated diff --git a/snippets/tst_array_f90/prog.c b/snippets/tst_array_f90/prog.c deleted file mode 100644 index 715bdcc42..000000000 --- a/snippets/tst_array_f90/prog.c +++ /dev/null @@ -1,31 +0,0 @@ -#include -#include - -void assign_array_(double x[], int* n); -void print_array_(); - -int main() -{ - int n,i; - double *x; - - n = 5; - x = (double*) malloc(sizeof(double)*n); - if (x == NULL) - { - printf("Malloc did not success\n"); - exit(0); - } - else - { - printf("Malloc succeeded\n"); - } - - for (i = 0; i < n; i++) - x[i] = (double) i; - - assign_array_(x,&n); - print_array_(); - - return 0; -} diff --git a/snippets/tst_array_ptr/Makefile b/snippets/tst_array_ptr/Makefile deleted file mode 100644 index 7d6ba7ef4..000000000 --- a/snippets/tst_array_ptr/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -all: - gfortran -O2 -c array.f90 -std=f2008 - gcc -O2 -c prog.c - gcc -o tst_prog -O2 prog.o array.o -lgfortran - -clean: - rm -f *.o *~ *.mod tst_prog diff --git a/snippets/tst_array_ptr/array.f90 b/snippets/tst_array_ptr/array.f90 deleted file mode 100644 index 38facbdee..000000000 --- a/snippets/tst_array_ptr/array.f90 +++ /dev/null @@ -1,51 +0,0 @@ -MODULE test_mod - implicit none - DOUBLE PRECISION, POINTER :: concen(:,:) - INTEGER :: nsize - -END MODULE test_mod - -SUBROUTINE set_ptr(fc_concen,n) - USE iso_c_binding - USE test_mod - - DOUBLE PRECISION, POINTER :: fc_ptr(:) - INTEGER :: n - TYPE(c_ptr) :: fc_concen - - nsize = n - - CALL c_f_POINTER(fc_concen,fc_ptr,[1]) - concen(0:n-1,0:n-1) => fc_ptr - -END SUBROUTINE - -SUBROUTINE assign_array() - USE test_mod, ONLY: nsize, concen - IMPLICIT NONE - - INTEGER :: i,j - - WRITE(6,*) 'Shape : ', SHAPE(concen) - - DO j = 0,nsize-1 - DO i = 0,nsize-1 - concen(i,j) = nsize*i + j - end do - ENDDO - -END SUBROUTINE - -SUBROUTINE print_array() - USE test_mod, ONLY : nsize, concen - IMPLICIT none - - INTEGER :: i,j - - DO i = 0,nsize-1 - DO j = 0,nsize-1 - WRITE(6,'(2F24.3)') concen(i,j) - END DO - END DO - -END SUBROUTINE print_array diff --git a/snippets/tst_array_ptr/prog.c b/snippets/tst_array_ptr/prog.c deleted file mode 100644 index b13dd5206..000000000 --- a/snippets/tst_array_ptr/prog.c +++ /dev/null @@ -1,23 +0,0 @@ -#include -#include - -void assign_array_(); -void print_array_(); -void set_ptr_(double **x, int* n); - -int main() -{ - int n,i; - double *concen; - - n = 5; - concen = (double*) malloc(sizeof(double)*n*n); - - set_ptr_(&concen,&n); - assign_array_(); - print_array_(); - - free(concen); - - return 0; -} diff --git a/snippets/tst_cuda_function_ptrs/tst_fptrs.cu b/snippets/tst_cuda_function_ptrs/tst_fptrs.cu deleted file mode 100644 index 44db1e060..000000000 --- a/snippets/tst_cuda_function_ptrs/tst_fptrs.cu +++ /dev/null @@ -1,35 +0,0 @@ -#include "tst_fptrs.h" -#include "user_f.h" - -#include - - -__global__ void kernel(fc2d_cuda_t f,float x, float *y) -{ - *y = f(x); - return; -} - -int main() -{ - float x; - float y, *y_dev; - fc2d_cuda_vt_t vt; - - /* User definitions (in swirl_user, for example) */ - x = 5; - assign_cuda_ptr2(&vt.h_f); - - - /* Code */ - cudaMalloc((void**) &y_dev, sizeof(float)); - - kernel<<<1,1>>>(vt.h_f,x,y_dev); - - cudaMemcpy(&y, y_dev, sizeof(float), cudaMemcpyDeviceToHost); - - printf("x = %f; y = %f\n",x,y); - - return 0; -} - diff --git a/snippets/tst_cuda_function_ptrs/tst_fptrs.h b/snippets/tst_cuda_function_ptrs/tst_fptrs.h deleted file mode 100644 index 59b14450a..000000000 --- a/snippets/tst_cuda_function_ptrs/tst_fptrs.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef TST_FPTRS_H -#define TST_FPTRS_H - -#ifdef __cplusplus -extern "C" -{ -#endif - -typedef float (*fc2d_cuda_t)(float x); -typedef void (*fc2d_assign_cuda_ptr_t)(fc2d_cuda_t* h_f); - -typedef struct fc2d_cuda_vt -{ - fc2d_cuda_t h_f; -} fc2d_cuda_vt_t; - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/snippets/tst_cuda_function_ptrs/user_f.cu b/snippets/tst_cuda_function_ptrs/user_f.cu deleted file mode 100644 index 74000c860..000000000 --- a/snippets/tst_cuda_function_ptrs/user_f.cu +++ /dev/null @@ -1,49 +0,0 @@ -#include "user_f.h" -#include - - - -__device__ float f1(float x) -{ - return 2*x; -} - -__device__ fc2d_cuda_t fptr1 = f1; - -void assign_cuda_ptr1(fc2d_cuda_t* h_f) -{ - cudaError_t ce = cudaMemcpyFromSymbol(h_f, fptr1, sizeof(fc2d_cuda_t)); - if(ce != cudaSuccess) - { - printf("ERROR: %s\n",cudaGetErrorString(ce)); - exit(0); - } - else - { - printf("Success!\n"); - } -} - -__device__ float f2(float x) -{ - return -x; -} - -__device__ fc2d_cuda_t fptr2 = f2; - -void assign_cuda_ptr2(fc2d_cuda_t* h_f) -{ - cudaError_t ce = cudaMemcpyFromSymbol(h_f, fptr2, sizeof(fc2d_cuda_t)); - if(ce != cudaSuccess) - { - printf("ERROR: %s\n",cudaGetErrorString(ce)); - exit(0); - } - else - { - printf("Success!\n"); - } - -} - - diff --git a/snippets/tst_cuda_function_ptrs/user_f.h b/snippets/tst_cuda_function_ptrs/user_f.h deleted file mode 100644 index ecbbb687a..000000000 --- a/snippets/tst_cuda_function_ptrs/user_f.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef USER_F_H -#define USER_F_H - -/* User defined functions */ - -#include "tst_fptrs.h" /* Needed for type defs */ - -#ifdef __cplusplus -extern "C" -{ -#endif - -void assign_cuda_ptr1(fc2d_cuda_t* h_f); -void assign_cuda_ptr2(fc2d_cuda_t* h_f); - -#ifdef __cplusplus -} -#endif - -#endif - - diff --git a/snippets/tst_cuda_reduce/reduce_max.cu b/snippets/tst_cuda_reduce/reduce_max.cu deleted file mode 100644 index 56a3a0cf8..000000000 --- a/snippets/tst_cuda_reduce/reduce_max.cu +++ /dev/null @@ -1,120 +0,0 @@ -#include -#include - -const int N_def (1 << 10); -const int threadsPerBlock = 32; -//const int blocksPerGrid = (N_def+threadsPerBlock-1) / threadsPerBlock; -const int blocksPerGrid = 10; - -#define MAX(a,b) (a) > (b) ? (a) : (b) - -__global__ void cuda_max(int N, double *a, double *c) -{ - // __shared__ double localDot[threadsPerBlock]; /* Statically defined */ - extern __shared__ double localReduce[]; - int ix = threadIdx.x + blockIdx.x * blockDim.x; - int localIndex = threadIdx.x; - - double localMax = a[ix]; - while (ix < N) - { - localMax = MAX(localMax,a[ix]); - ix += blockDim.x * gridDim.x; - } - - /* Store local max computed by this thread */ - localReduce[localIndex] = localMax; - - /* Wait for all threads to get to this point */ - __syncthreads(); - - /* Every block should compute max on the block */ - int i = blockDim.x/2; - while (i != 0) - { - if (localIndex < i) - { - localReduce[localIndex] = - MAX(localReduce[localIndex],localReduce[localIndex+i]); - } - __syncthreads(); - i /= 2; - } - - /* Each block stores local max */ - if (localIndex == 0) - c[blockIdx.x] = localReduce[0]; -} - -double max_gpu(int N, double *a, - double *dev_a, - double *dev_partial_c) -{ - double max, *partial_c; - - partial_c = (double*) malloc( blocksPerGrid*sizeof(double) ); - - cudaMemcpy(dev_a, a, N*sizeof(double), - cudaMemcpyHostToDevice ); - - dim3 block(threadsPerBlock); /* Values defined in macros */ - dim3 grid(blocksPerGrid); /* defined in macros, above */ - cuda_max<<>>(N, dev_a, - dev_partial_c ); - cudaDeviceSynchronize(); - cudaPeekAtLastError(); - - - /* copy the array 'c' back from the GPU to the CPU */ - cudaMemcpy( partial_c, dev_partial_c, - blocksPerGrid*sizeof(double), - cudaMemcpyDeviceToHost ); - - /* Sum of block sums */ - max = partial_c[0]; - for (int i = 0; i < blocksPerGrid; i++) - { - max = MAX(max,partial_c[i]); - } - - free(partial_c); - - return max; -} - - -int main( void ) -{ - double *a; - double *dev_a, *dev_partial_c; - double c_gpu; - int N; - double true_max = 3.14159; - - N = N_def; - - a = (double*) malloc( N*sizeof(double) ); - - - /* allocate the memory on the GPU */ - cudaMalloc((void**) &dev_a, N*sizeof(double)); - cudaMalloc((void**) &dev_partial_c, blocksPerGrid*sizeof(double) ); - - - /* Define vector a */ - for (int i = 0; i < N; i++) - { - a[i] = 1.0; - } - a[N/3] = true_max; /* Set the max here */ - - c_gpu = max_gpu(N,a,dev_a,dev_partial_c); - - printf("%20s %10f\n","Maximum (GPU)", c_gpu); - printf("%20s %10f\n","True maximum", true_max); - - cudaFree(dev_a); - cudaFree(dev_partial_c); - - free(a); -} diff --git a/snippets/tst_cuda_reduce/reduce_sum.cu b/snippets/tst_cuda_reduce/reduce_sum.cu deleted file mode 100644 index 3e5477473..000000000 --- a/snippets/tst_cuda_reduce/reduce_sum.cu +++ /dev/null @@ -1,140 +0,0 @@ -#include -#include - -const int N_def (1 << 20); -const int threadsPerBlock = 32; -//const int blocksPerGrid = (N_def+threadsPerBlock-1) / threadsPerBlock; -const int blocksPerGrid = 1; - - -__global__ void cuda_dot(int N, double *a, double *b, double *c) -{ - // __shared__ double localDot[threadsPerBlock]; /* Statically defined */ - extern __shared__ double localDot[]; - int ix = threadIdx.x + blockIdx.x * blockDim.x; - int localIndex = threadIdx.x; - - double localSum = 0; - while (ix < N) - { - localSum += a[ix] * b[ix]; /* Reduction is here */ - ix += blockDim.x * gridDim.x; - } - - /* Store sum computed by this thread */ - localDot[localIndex] = localSum; - - /* Wait for all threads to get to this point */ - __syncthreads(); - - /* Every block should add up sum computed on - threads in the block */ - int i = blockDim.x/2; - while (i != 0) - { - if (localIndex < i) - { - localDot[localIndex] += localDot[localIndex + i]; - } - __syncthreads(); - i /= 2; - } - - /* Each block stores local dot product */ - if (localIndex == 0) - c[blockIdx.x] = localDot[0]; -} - -double dot_gpu(int N, double *a, double *b, - double *dev_a, double *dev_b, - double *dev_partial_c) -{ - double dot, *partial_c; - - partial_c = (double*) malloc( blocksPerGrid*sizeof(double) ); - - /* copy the arrays 'a' and 'b' to the GPU */ - cudaMemcpy(dev_a, a, N*sizeof(double), - cudaMemcpyHostToDevice ); - cudaMemcpy(dev_b, b, N*sizeof(double), - cudaMemcpyHostToDevice ); - - dim3 block(threadsPerBlock); /* Values defined in macros */ - dim3 grid(blocksPerGrid); /* defined in macros, above */ - cuda_dot<<>>(N, dev_a, dev_b, - dev_partial_c ); - cudaDeviceSynchronize(); - cudaPeekAtLastError(); - - - /* copy the array 'c' back from the GPU to the CPU */ - cudaMemcpy( partial_c, dev_partial_c, - blocksPerGrid*sizeof(double), - cudaMemcpyDeviceToHost ); - - /* Sum of block sums */ - dot = 0; - for (int i = 0; i < blocksPerGrid; i++) - { - dot += partial_c[i]; - } - - free(partial_c); - - return dot; -} - -double dot_cpu(int n, double *a, double *b) -{ - double sum = 0; - int i; - - for (i = 0; i < n; i++) - { - sum += a[i]*b[i]; - } - return sum; -} - -/* Compute a dot product */ -int main( void ) -{ - double *a, *b; - double *dev_a, *dev_b, *dev_partial_c; - double c_gpu; - int N; - - N = N_def; - - a = (double*) malloc( N*sizeof(double) ); - b = (double*) malloc( N*sizeof(double) ); - - - /* allocate the memory on the GPU */ - cudaMalloc((void**) &dev_a, N*sizeof(double)); - cudaMalloc((void**) &dev_b, N*sizeof(double)); - cudaMalloc((void**) &dev_partial_c, blocksPerGrid*sizeof(double) ); - - - /* Define vectors a and b */ - for (int i = 0; i < N; i++) - { - a[i] = 1.0; - b[i] = 1.0; - } - - /* GPU */ - c_gpu = dot_gpu(N,a,b,dev_a,dev_b,dev_partial_c); - - double s = N; /* Sum of 1s */ - printf("%20s %10f\n","Dot product (GPU)", c_gpu); - printf("%20s %10f\n","True dot product", s); - - /* free memory on the gpu side */ - cudaFree(dev_a); - cudaFree(dev_b); - cudaFree(dev_partial_c); - - free(a); - free(b); -} diff --git a/snippets/tst_cyclic_dependency/Makefile b/snippets/tst_cyclic_dependency/Makefile deleted file mode 100644 index 2d7048fee..000000000 --- a/snippets/tst_cyclic_dependency/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -target=prog - -objs=prog.o global.o pkg.o - -all: - gcc -g -c prog.c global.c pkg.c -std=c99 -pedantic - gcc -o ${target} ${objs} - -clean: - rm -f *.o *~ ${target} ${objs} diff --git a/snippets/tst_cyclic_dependency/global.c b/snippets/tst_cyclic_dependency/global.c deleted file mode 100644 index 88f00d638..000000000 --- a/snippets/tst_cyclic_dependency/global.c +++ /dev/null @@ -1,12 +0,0 @@ -#include "global.h" -#include "pkg.h" - -void global_add_pkg(global_t* g,pkg_t *p) -{ - g->pkg = p; -} - -int global_get_value(global_t* g) -{ - return g->pkg->value; -} diff --git a/snippets/tst_cyclic_dependency/global.h b/snippets/tst_cyclic_dependency/global.h deleted file mode 100644 index b49ad1977..000000000 --- a/snippets/tst_cyclic_dependency/global.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef GLOBAL_H -#define GLOBAL_H - -typedef struct global global_t; -struct pkg; - -struct global -{ - struct pkg *pkg; -}; - -void global_add_pkg(global_t* g, struct pkg *p); -int global_get_value(global_t* g); - -#endif diff --git a/snippets/tst_cyclic_dependency/pkg.c b/snippets/tst_cyclic_dependency/pkg.c deleted file mode 100644 index 7e9dc0f92..000000000 --- a/snippets/tst_cyclic_dependency/pkg.c +++ /dev/null @@ -1,7 +0,0 @@ -#include "global.h" -#include "pkg.h" - -void pkg_add_value(global_t *g, int v) -{ - g->pkg->value = v; -} diff --git a/snippets/tst_cyclic_dependency/pkg.h b/snippets/tst_cyclic_dependency/pkg.h deleted file mode 100644 index 1a458b3e3..000000000 --- a/snippets/tst_cyclic_dependency/pkg.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef PKG_H -#define PKG_H - -typedef struct pkg pkg_t; -struct global; - -struct pkg -{ - int value; -}; - -void pkg_add_value(struct global *g, int v); - -#endif diff --git a/snippets/tst_cyclic_dependency/prog.c b/snippets/tst_cyclic_dependency/prog.c deleted file mode 100644 index 7f0cfd683..000000000 --- a/snippets/tst_cyclic_dependency/prog.c +++ /dev/null @@ -1,27 +0,0 @@ -#include -#include - -#include "global.h" -#include "pkg.h" - -int main() -{ - - global_t s_g, *g = &s_g; - pkg_t s_pkg, *pkg = &s_pkg; - - pkg->value = 2; - - global_add_pkg(g,pkg); - int v = global_get_value(g); - - printf("value is %d\n",v); - - pkg_add_value(g,47); - v = global_get_value(g); - - printf("value is %d\n",v); - - - return 0; -} diff --git a/snippets/tst_f90_alloc/Makefile b/snippets/tst_f90_alloc/Makefile deleted file mode 100644 index 31f30a442..000000000 --- a/snippets/tst_f90_alloc/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -all: - gfortran -g -O2 -c array.f90 array_handling.f90 - gcc -g -O2 -c prog.c - gcc -g -o tst_prog -O2 prog.o array.o array_handling.o -lgfortran - -clean: - rm -f *.o *~ *.mod tst_prog diff --git a/snippets/tst_f90_alloc/array.f90 b/snippets/tst_f90_alloc/array.f90 deleted file mode 100644 index e615b3016..000000000 --- a/snippets/tst_f90_alloc/array.f90 +++ /dev/null @@ -1,35 +0,0 @@ -MODULE test_mod - IMPLICIT NONE - - DOUBLE PRECISION, POINTER :: x_comp_sp(:) - DOUBLE PRECISION, POINTER :: concen(:,:) - - INTEGER :: nx = 5 - -END MODULE test_mod - - -SUBROUTINE use_array(value1,value2) - USE test_mod - IMPLICIT NONE - - DOUBLE PRECISION value1, value2 - INTEGER i,j - - ALLOCATE(x_comp_sp(nx), concen(nx,nx)) - - do i = 1,nx - x_comp_sp(i) = value1 - do j = 1,nx - concen(i,j) = value2 - end do - end do - - - -end - - - - - diff --git a/snippets/tst_f90_alloc/array_handling.f90 b/snippets/tst_f90_alloc/array_handling.f90 deleted file mode 100644 index 89ccd90b6..000000000 --- a/snippets/tst_f90_alloc/array_handling.f90 +++ /dev/null @@ -1,49 +0,0 @@ -SUBROUTINE store_ptrs(fc_x_comp_sp_ptr,fc_concen_ptr) - use iso_c_binding - use test_mod - IMPLICIT NONE - - TYPE(c_ptr) :: fc_x_comp_sp_ptr, fc_concen_ptr - - fc_x_comp_sp_ptr = c_loc(x_comp_sp) - fc_concen_ptr = c_loc(concen) -end - -SUBROUTINE copy_ptrs2mod(fc_x_comp_sp_ptr,fc_concen_ptr) - use iso_c_binding - use test_mod - IMPLICIT NONE - - TYPE(c_ptr) :: fc_x_comp_sp_ptr, fc_concen_ptr - double precision, pointer :: xp(:) !! Needed only for 2d and higher dim arrays - INTEGER :: i,j - - CALL c_f_pointer(fc_x_comp_sp_ptr,x_comp_sp,[1]) - - CALL c_f_pointer(fc_concen_ptr,xp,[1]) - concen(1:nx,1:nx) => xp - - do i = 1,nx - write(6,'(F12.0)') x_comp_sp(i) - end do - -end - -subroutine deallocate_arrays(fc_x_comp_sp_ptr,fc_concen_ptr) - use iso_c_binding - use test_mod - implicit none - - type(c_ptr) :: fc_x_comp_sp_ptr, fc_concen_ptr - double precision, pointer :: xp(:) - - CALL c_f_pointer(fc_concen_ptr,xp,[1]) - concen(1:nx,1:nx) => xp - DEALLOCATE(concen) !! May also be okay to just de-allocate xp - - CALL c_f_pointer(fc_x_comp_sp_ptr,xp,[1]) - x_comp_sp(1:nx) => xp - DEALLOCATE(x_comp_sp) - -end - diff --git a/snippets/tst_f90_alloc/prog.c b/snippets/tst_f90_alloc/prog.c deleted file mode 100644 index a897a1001..000000000 --- a/snippets/tst_f90_alloc/prog.c +++ /dev/null @@ -1,49 +0,0 @@ -#include -#include - -void use_array_(double *v1, double *v2); -void store_ptrs_(double ** ptr1, double** ptr2); -void copy_ptrs2mod_(double ** ptr1, double **ptr2); -void deallocate_arrays_(double** ptr1, double ** ptr2); - -typedef struct fc_patch -{ - double * x_comp_sp; - double * concen; -} fc_patch_t; - - -int main() -{ - fc_patch_t p1, p2; - double value1, value2; - - value1 = 1.0; - value2 = 5.0; - - use_array_(&value1,&value2); - store_ptrs_(&p1.x_comp_sp, &p1.concen); - - use_array_(&value1, &value2); - store_ptrs_(&p2.x_comp_sp, &p2.concen); - - for(int i = 0; i < 5; i++) - { - printf("%5.0f %5.0f %5.0f %5.0f\n",p1.x_comp_sp[i], p1.concen[i],p2.x_comp_sp[i],p2.concen[i]); - p1.x_comp_sp[i] = 47; - } - - copy_ptrs2mod_(&p1.x_comp_sp, &p1.concen); - copy_ptrs2mod_(&p2.x_comp_sp, &p2.concen); - - deallocate_arrays_(&p1.x_comp_sp, &p1.concen); - deallocate_arrays_(&p2.x_comp_sp, &p2.concen); - - for(int i = 0; i < 5; i++) - { - /* This should seg-fault */ - // fc_x_comp_sp_1[i] = 47; - } - - return 0; -} diff --git a/snippets/tst_fortran_io/Makefile b/snippets/tst_fortran_io/Makefile deleted file mode 100644 index a6b0226e8..000000000 --- a/snippets/tst_fortran_io/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -all: - mpif90 -c hello.f90 hello_1.f90 -g - mpicc -g -c prog.c -lmpi - mpicc -o tst_prog prog.o hello.o hello_1.o - -clean: - rm -f *.o *~ *.mod tst_prog diff --git a/snippets/tst_fortran_io/hello.f90 b/snippets/tst_fortran_io/hello.f90 deleted file mode 100644 index b28068516..000000000 --- a/snippets/tst_fortran_io/hello.f90 +++ /dev/null @@ -1,22 +0,0 @@ -subroutine print_hello(mpirank, verb) -use iso_fortran_env -implicit none - -integer mpirank, i, verb -character(len=*), parameter :: nullfile = '/dev/null' - -if (mpirank > 0) then - open(output_unit,file=nullfile) -endif - -write(*,'(A,I5)') "Hello from rank ", mpirank - -do i = 1,10 - write(*,'(I5)') i -enddo - -if (mpirank > 0) then - close(output_unit) -endif - -end \ No newline at end of file diff --git a/snippets/tst_fortran_io/hello_1.f90 b/snippets/tst_fortran_io/hello_1.f90 deleted file mode 100644 index d916df5d1..000000000 --- a/snippets/tst_fortran_io/hello_1.f90 +++ /dev/null @@ -1,81 +0,0 @@ -subroutine print_hello_1(mpirank,verb) -use iso_fortran_env -!! use, intrinsic :: iso_fortran_env, only : stdin=>input_unit, & -!! stdout=>output_unit, & -!! stderr=>error_unit - -implicit none - -integer mpirank, verb -integer silent, essential, production, info, debug -integer fclaw_global_info, fclaw_global_production -integer fclaw_global_essential, fclaw_global_silent -integer fclaw_debug, nullfile_unit, r - -character(len=*), parameter :: nullfile = '/dev/null' -character(len=*), parameter :: fmt_info = '("[ash3d] ",A)' -character(len=*), parameter :: fmt_production = '("[ash3d] ",A)' -character(len=*), parameter :: fmt_essential = '("[ash3d] ",A)' -character(len=*), parameter :: fmt_debug = '("[",I5,"] ",A)' - -silent = 0 -essential = 1 -production = 2 -info = 3 -debug = 4 - -nullfile_unit = 50 - -!!mpirank = mpirank + 30045 - -!!k = 1 -!!r = mpirank -!!do while (.true.) -!! r = r/10 -!! write(6,*) r -!! k = k + 1 -!! if (r .eq. 0) then -!! exit -!! endif -!!enddo -!!write(6,*) 'Digits = ', k - -if (verb .gt. 0) then - open(nullfile_unit,file=nullfile) -else - open(output_unit,file=nullfile) -endif - -fclaw_global_essential = nullfile_unit -fclaw_global_production = nullfile_unit -fclaw_global_info = nullfile_unit -fclaw_debug = nullfile_unit - -!! Every processor writes something in debug mode -if (verb .eq. debug) then - fclaw_debug = output_unit -endif - -!! Only processor 0 writes in other modes -if (mpirank == 0) then - if (verb .ge. essential) then - fclaw_global_essential = output_unit - if (verb .ge. production) then - fclaw_global_production = output_unit - if (verb .ge. info) then - fclaw_global_info = output_unit - endif - endif - endif -endif - -write(*,'(A,I5)') "(stdout) Hello, World! from rank ", mpirank - - -write(fclaw_global_silent,*) "(silent) Hello World!" -write(fclaw_global_essential,fmt_essential) "(essential) Hello World! " -write(fclaw_global_production,fmt_production) "(production) Hello World! " -write(fclaw_global_info,fmt_info) "(info) Hello World! " -write(fclaw_debug,fmt_debug) mpirank+200, "Hello, World!" - -end \ No newline at end of file diff --git a/snippets/tst_fortran_io/prog.c b/snippets/tst_fortran_io/prog.c deleted file mode 100644 index f00856120..000000000 --- a/snippets/tst_fortran_io/prog.c +++ /dev/null @@ -1,39 +0,0 @@ -#include "mpi.h" -#include -#include - -typedef enum -{ - SILENT=0, - ESSENTIAL, - PRODUCTION, - INFO, - DEBUG, -} output_t; - - -void print_hello_1_(int* mpirank, output_t* verb); -void print_hello_(int* mpirank, output_t* verb); - -int main (int argc, char *argv[]) -{ - int numtasks, mpirank, len; - char hostname[MPI_MAX_PROCESSOR_NAME]; - output_t verb; - - MPI_Init(&argc, &argv); - MPI_Comm_size(MPI_COMM_WORLD, &numtasks); - MPI_Comm_rank(MPI_COMM_WORLD,&mpirank); - MPI_Get_processor_name(hostname, &len); - - verb = DEBUG; - print_hello_1_(&mpirank,&verb); // Doesn't really work - - // printf ("Hello from task %d on %s!\n", mpirank, hostname); - if (mpirank == 0) - { - printf("Number of MPI tasks is: %d\n",numtasks); - } - MPI_Finalize(); -} - diff --git a/snippets/tst_funcptr/Makefile b/snippets/tst_funcptr/Makefile deleted file mode 100644 index 2f0cbc066..000000000 --- a/snippets/tst_funcptr/Makefile +++ /dev/null @@ -1,32 +0,0 @@ -Target := tst_funcptr - -# default: $(TARGETS) - -F77 = gfortran -CXX = g++ -CFLAGS = -Wall -O0 -g - -include Makefile.inc - -OBJS = $(Target).o \ - math_value.o \ - $(set_file) \ - $(not_defined) \ - $(math_file) - -all: $(OBJS) - $(CXX) $(CFLAGS) $(OBJS) -o $(Target) - -.f.o: - $(F77) $(CFLAGS) $^ -c -o $@ - -.cpp.o: - $(CXX) $(CFLAGS) $^ -c -o $@ - -.c.o: - $(CXX) $(CFLAGS) $^ -c -o $@ - -clean: - rm -f *.o $(Target) - -.PHONY: clean default diff --git a/snippets/tst_funcptr/Makefile.inc b/snippets/tst_funcptr/Makefile.inc deleted file mode 100644 index e3370c481..000000000 --- a/snippets/tst_funcptr/Makefile.inc +++ /dev/null @@ -1,4 +0,0 @@ -# -*- Makefile -*- - -set_file := set_value_to_5.o -math_file := square.o diff --git a/snippets/tst_funcptr/cube.cpp b/snippets/tst_funcptr/cube.cpp deleted file mode 100644 index 573651790..000000000 --- a/snippets/tst_funcptr/cube.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#ifdef __cplusplus -extern "C" -{ -#if 0 -} /* need this because indent is dumb */ -#endif -#endif - -void cube(const int& a, int& b) -{ - b = a*a*a; -} - -#ifdef __cplusplus -#if 0 -{ /* need this because indent is dumb */ -#endif -} -#endif diff --git a/snippets/tst_funcptr/math_value.f b/snippets/tst_funcptr/math_value.f deleted file mode 100644 index 3a6792395..000000000 --- a/snippets/tst_funcptr/math_value.f +++ /dev/null @@ -1,9 +0,0 @@ - subroutine math_value(f,a,b) - implicit none - - external f - integer a,b - - call f(a,b) - - end diff --git a/snippets/tst_funcptr/set_value_to_2.f b/snippets/tst_funcptr/set_value_to_2.f deleted file mode 100644 index 8fb578b3c..000000000 --- a/snippets/tst_funcptr/set_value_to_2.f +++ /dev/null @@ -1,7 +0,0 @@ - subroutine set_value_to_2(a) - implicit none - - integer a - - a = 2 - end diff --git a/snippets/tst_funcptr/set_value_to_5.f b/snippets/tst_funcptr/set_value_to_5.f deleted file mode 100644 index 39d8c348f..000000000 --- a/snippets/tst_funcptr/set_value_to_5.f +++ /dev/null @@ -1,7 +0,0 @@ - subroutine set_value_to_5(a) - implicit none - - integer a - - a = 5 - end diff --git a/snippets/tst_funcptr/square.c b/snippets/tst_funcptr/square.c deleted file mode 100644 index 816701532..000000000 --- a/snippets/tst_funcptr/square.c +++ /dev/null @@ -1,20 +0,0 @@ -#ifdef __cplusplus -extern "C" -{ - -#if 0 -} /* need this because indent is dumb */ -#endif -#endif - -void square(const int& a, int& b) -{ - b = a*a; -} - -#ifdef __cplusplus -#if 0 -{ /* need this because indent is dumb */ -#endif -} -#endif diff --git a/snippets/tst_funcptr/tst_funcptr.cpp b/snippets/tst_funcptr/tst_funcptr.cpp deleted file mode 100644 index ef5e4410c..000000000 --- a/snippets/tst_funcptr/tst_funcptr.cpp +++ /dev/null @@ -1,37 +0,0 @@ - -#include -#include - -using namespace std; - -typedef void (*set_value_t)(int& a); -typedef void (*math_t)(const int& a, int& b); - -extern "C" -{ - // We can have the external definitions here, even if the file is not - // compiled in. - void set_value_to_2_(int& a); - void set_value_to_5_(int& a); - void math_value_(math_t f, const int& a, int& b); - void square(const int& a, int& b); - void cube(const int& a, int& b); -} - -int main () -{ - int a; - set_value_t f_set; - math_t f_math; - - // Only these files need to be compiled into executable. See Makefile.inc - f_set = &set_value_to_5_; // Fortran function called directly from C - f_math = □ // C function that is passed to and called from Fortran - - f_set(a); - cout << "a = " << a << endl; - - int b; - math_value_(f_math,a,b); - cout << "f(a) = " << b << endl; -} diff --git a/snippets/tst_iso_c_bindings/Makefile b/snippets/tst_iso_c_bindings/Makefile deleted file mode 100644 index d1144dd2b..000000000 --- a/snippets/tst_iso_c_bindings/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -all: - gcc -g -c prog.c - gfortran -g -c assign.f - gcc -o tst_prog prog.o assign.o - -cpp_tst: - g++ -c -g prog.cpp - gfortran -c -g assign.f - g++ -o tst_prog prog.o assign.o - -clean: - rm -f *.o *~ *.mod tst_prog diff --git a/snippets/tst_iso_c_bindings/assign.f b/snippets/tst_iso_c_bindings/assign.f deleted file mode 100644 index 5ee6a652a..000000000 --- a/snippets/tst_iso_c_bindings/assign.f +++ /dev/null @@ -1,18 +0,0 @@ - subroutine assign(s,n,x) bind(c,name="f_assign") - use iso_c_binding, only : c_ptr - implicit none - -c # Headers for c routine 'mult' - include 'c_routines.i' - - type(c_ptr) s - double precision x(n) - integer n, i - - do i = 1,n - x(i) = i - enddo - - call c_mult(s,n,x) - - end diff --git a/snippets/tst_iso_c_bindings/c_routines.i b/snippets/tst_iso_c_bindings/c_routines.i deleted file mode 100644 index ba4d23d2e..000000000 --- a/snippets/tst_iso_c_bindings/c_routines.i +++ /dev/null @@ -1,13 +0,0 @@ -C -*- FORTRAN -*- - -c # Headers files for C routines - interface - subroutine c_mult(s,n,x) bind(c,name="mult") - use iso_c_binding, only : c_ptr - implicit none - - type(c_ptr) s - integer n - double precision x(n) !! double precision works too - end subroutine - end interface diff --git a/snippets/tst_iso_c_bindings/prog.c b/snippets/tst_iso_c_bindings/prog.c deleted file mode 100644 index 9132e70b0..000000000 --- a/snippets/tst_iso_c_bindings/prog.c +++ /dev/null @@ -1,39 +0,0 @@ -#include -#include - -typedef struct simple -{ - int multiplier; -} simple_t; - -void mult(simple_t **s, const int* n, double x[]); -void f_assign(simple_t **s, const int * n, double x[]); - -int main() -{ - int n,i; - double *x; - simple_t s, *s_ptr = &s; - - n = 3; - s.multiplier = 23; - x = (double*) malloc(sizeof(double)*n); - f_assign(&s_ptr,&n,x); - - for (i = 0; i < n; i++) - { - printf("x(%d) is %4.0f\n",i,x[i]); - } - - return 0; -} - -void mult(simple_t **s, const int* n, double x[]) -{ - int i; - - for (i = 0; i < *n; i++) - { - x[i] = (*s)->multiplier*x[i]; - } -} diff --git a/snippets/tst_iso_c_bindings/prog.cpp b/snippets/tst_iso_c_bindings/prog.cpp deleted file mode 100644 index 5698307fa..000000000 --- a/snippets/tst_iso_c_bindings/prog.cpp +++ /dev/null @@ -1,37 +0,0 @@ -#include -#include - -typedef struct simple -{ - int multiplier; -} simple_t; - -extern "C" -{ - void mult(simple_t *s, const int& n, double x[]); - void f_assign(simple_t *s, const int& n, double x[]); -} - -int main() -{ - int n = 10; - double *x = new double[n]; - simple_t s, *s_ptr = &s; - s.multiplier = 3; - f_assign(s_ptr,n,x); - - for (int i = 0; i < n; i++) - { - std::cout << "x[" << i << "] = " << x[i] << std::endl; - } - - return 0; -} - -void mult(simple_t *s, const int& n, double x[]) -{ - for (int i = 0; i < n; i++) - { - x[i] = s->multiplier*x[i]; - } -} diff --git a/snippets/tst_nans/limiter.f b/snippets/tst_nans/limiter.f deleted file mode 100644 index 43c443324..000000000 --- a/snippets/tst_nans/limiter.f +++ /dev/null @@ -1,19 +0,0 @@ - double precision function compute_slopes(sl,sr) - implicit none - - double precision sl,sr, sc - integer mth - -c # Use AMRClaw slopes (use minimum in absolute value; sign is -c # chosen from centered (sc) slope - sc = (sl + sr)/2.d0 - compute_slopes = min(abs(sl),abs(sr),abs(sc))* - & max(0.d0,sign(1.d0,sl*sr))*sign(1.d0,sc) - -c # Do this to guarantee that ghost cells are used; this is a check -c # on the ghost-fill procedures. Could raise an exception if face -c # a patch communicates with more two or more procs. If this -c # is uncommented, also uncomment warning in fclaw2d_ghost_fill.cpp -c compute_slopes = sc - - end diff --git a/snippets/tst_nans/prog.c b/snippets/tst_nans/prog.c deleted file mode 100644 index de88ce5c2..000000000 --- a/snippets/tst_nans/prog.c +++ /dev/null @@ -1,41 +0,0 @@ -#include -#include -#include - -double compute_slopes_(double *sl, double *sr); - -static -void set_qnan(double* f) -{ - /* - The quiet nan from math.h - */ - *f = NAN; -} - - -static -void set_snan(double* f) -{ - /* From : - "NaNs, Uninitialized Variables, and C++" - http://codingcastles.blogspot.fr/2008/12/nans-in-c.html - */ - *((long long*)f) = 0x7ff0000000000001LL; -} - -int main() -{ - double x,y,z; - - set_snan(&x); - - y = 1.0; - - z = compute_slopes_(&x,&y); - printf("slope is %24.15f\n",z); - - z = compute_slopes_(&y,&x); - printf("slope is %24.15f\n",z); - -} diff --git a/snippets/tst_netcdf_fileio/Makefile b/snippets/tst_netcdf_fileio/Makefile deleted file mode 100644 index b537c8256..000000000 --- a/snippets/tst_netcdf_fileio/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -all: - gcc -c main.c - gcc -o main -O2 main.o -L/opt/local/lib -lnetcdf - -clean: - rm -f *.o - rm main \ No newline at end of file diff --git a/snippets/tst_netcdf_fileio/main.c b/snippets/tst_netcdf_fileio/main.c deleted file mode 100644 index e13cd33de..000000000 --- a/snippets/tst_netcdf_fileio/main.c +++ /dev/null @@ -1,139 +0,0 @@ -// -// This file is modified from netcdf-4.4.1.1/examples/simple_xy_wr.c -// - - -#include -#include -#include -#include - -/* Handle errors by printing an error message and exiting with a - * non-zero status. */ -#define ERRCODE 2 -#define ERR(e) {printf("Error: %s\n", nc_strerror(e)); exit(ERRCODE);} - -#define LEN 40 - -void write_patch(int ncid, int subgroupid, int patchidx, - double time, int ngrids, int numdim, int meqn, int maux, int mx) -{ - const char* dim_name[1] = {"x"}; - // char* temp; - char temp[LEN]; - - /* Patch specific */ - int level = 0; - double q[mx]; - double xlower = 0.0; - double xupper = 1.0; - - int x_dimid, meqn_dimid, qid; - int dimids[numdim+1]; - - int retval; - - /* Create pretend data*/ - for (int i = 0; i < mx; ++i) - { - q[i] = patchidx + i; - } - - /* Define the dimensions. NetCDF will hand back an ID for each. */ - // dim(q) = mx*my*meqn - if ((retval = nc_def_dim(subgroupid, "x", mx, &x_dimid))) - ERR(retval); - if ((retval = nc_def_dim(subgroupid, "meqn", meqn, &meqn_dimid))) - ERR(retval); - - /* Define the attribute */ - // General patch properties - if ((retval = nc_put_att_double(subgroupid, NC_GLOBAL, "t", NC_DOUBLE, 1, &time))) - ERR(retval); - if ((retval = nc_put_att_int(subgroupid, NC_GLOBAL, "num_eqn", NC_INT, 1, &meqn))) - ERR(retval); - if ((retval = nc_put_att_int(subgroupid, NC_GLOBAL, "num_aux", NC_INT, 1, &maux))) - ERR(retval); - if ((retval = nc_put_att_int(subgroupid, NC_GLOBAL, "patch_index", NC_INT, 1, &patchidx))) - ERR(retval); - if ((retval = nc_put_att_int(subgroupid, NC_GLOBAL, "level", NC_INT, 1, &level))) - ERR(retval); - - // Dimension name - if ((retval = nc_put_att_string(subgroupid, NC_GLOBAL, "dim_names", 1, (const char**) dim_name))) - ERR(retval); - - // Dimension attribute - for (int i = 0; i < numdim; ++i) - { - // num_cells - sprintf(temp,"%s.num_cells",dim_name[i]); - if ((retval = nc_put_att_int(subgroupid, NC_GLOBAL, temp, NC_INT, 1, &mx))) - ERR(retval); - - // lower bound of this dimension - sprintf(temp,"%s.lower",dim_name[i]); - if ((retval = nc_put_att_double(subgroupid, NC_GLOBAL, temp, NC_DOUBLE, 1, &xlower))) - ERR(retval); - - // upper bound of this dimension - sprintf(temp,"%s.upper",dim_name[i]); - if ((retval = nc_put_att_double(subgroupid, NC_GLOBAL, temp, NC_DOUBLE, 1, &xupper))) - ERR(retval); - } - - dimids[0] = x_dimid; - dimids[1] = meqn_dimid; - /* Define the variable. */ - if ((retval = nc_def_var(subgroupid, "q", NC_DOUBLE, numdim+1, dimids, &qid))) - ERR(retval); - - /* End define mode. */ - if ((retval = nc_enddef(subgroupid))) - ERR(retval); - - /* Write the pretend data to the file. Although netCDF supports - * reading and writing subsets of data, in this case we write all - * the data in one operation. */ - if ((retval = nc_put_var_double(subgroupid, qid, &q[0]))) - ERR(retval); -} - -int main(int argc, char const *argv[]) -{ - const char filename[] = "claw0001.nc"; - int ncid; - int numpatch = 2; - int subgroupid[numpatch]; - int retval; - char patchname[7]; - - /* Variables that general to all patches */ - double time = 0.0; - int ngrids = 1; - int numdim = 1; - int meqn = 1; - int maux = 0; - int mx = 5; - - /* Create the file. */ - if ((retval = nc_create(filename, NC_NETCDF4, &ncid))) - ERR(retval); - - for (int i = 0; i < numpatch; ++i) - { - sprintf(patchname, "patch%d", i); - /* Create subgroup */ - if ((retval = nc_def_grp(ncid, patchname, &subgroupid[i]))) - ERR(retval); - - write_patch(ncid, subgroupid[i], i, time, ngrids, numdim, meqn, maux, mx); - } - /* Close the file. */ - if ((retval = nc_close(ncid))) - ERR(retval); - - printf("*** SUCCESS writing file %s!\n", filename); - - return 0; -} \ No newline at end of file diff --git a/snippets/tst_netcdf_fileio/test_ncfile.ipynb b/snippets/tst_netcdf_fileio/test_ncfile.ipynb deleted file mode 100644 index 994b6e4be..000000000 --- a/snippets/tst_netcdf_fileio/test_ncfile.ipynb +++ /dev/null @@ -1,116 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Following code can be used to test whether the created netcdf file is valid." - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": { - "collapsed": false - }, - "outputs": [], - "source": [ - "import numpy as np\n", - "from clawpack import pyclaw\n", - "from clawpack.pyclaw.fileio import netcdf\n", - "\n", - "%matplotlib inline\n", - "import matplotlib\n", - "import matplotlib.pyplot as plt" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "metadata": { - "collapsed": false - }, - "outputs": [], - "source": [ - "# Create a solution object\n", - "claw = pyclaw.Controller()\n", - "claw.solution = pyclaw.Solution()" - ] - }, - { - "cell_type": "code", - "execution_count": 3, - "metadata": { - "collapsed": false - }, - "outputs": [], - "source": [ - "# Use pyclaw.fileio.netcdf.read function to read in data from claw0000.nc file\n", - "netcdf.read(claw.solution,1,path='./',file_prefix='claw')" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": { - "collapsed": false - }, - "outputs": [ - { - "data": { - "text/plain": [ - "[]" - ] - }, - "execution_count": 4, - "metadata": {}, - "output_type": "execute_result" - }, - { - "data": { - "image/png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Etz9u0zg6tJcC/B/53Vf3rTa53\nZU23rHPWa5rkkiTfPjz+W8CbgNPrhs18LdvUOeu1BKiq91fVFVX1Kgb70e9V1TvXDdv2ek7tb/tU\nizeLVdV/S/IjSf4M+CrwrmnVt506gZ9I8vPAWeDrwE9Nu84k/xnoAX8nyZ8DR4B9dGgt29RJB9Zy\nWOd1wD8G/njYAy7g/Qx+66sza9qmTma/pn8P+A8Z/En3PcB/Ga5dp/5fb1Mns1/LTe12PX2TlyQt\nIV/wlaQl5OYvSUvIzV+SlpCbvyQtITd/SVpCbv6StITc/CVpCbn5S9IS+v+lLi5XG6h2TAAAAABJ\nRU5ErkJggg==\n", - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "# Plot the solution\n", - "plt.plot(claw.solution.states[0].q)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "collapsed": true - }, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 2", - "language": "python", - "name": "python2" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 2 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython2", - "version": "2.7.12" - } - }, - "nbformat": 4, - "nbformat_minor": 0 -} diff --git a/snippets/tst_parser/Makefile b/snippets/tst_parser/Makefile deleted file mode 100644 index 515533680..000000000 --- a/snippets/tst_parser/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -TARGET = parser_example - -LDFLAGS = -L$(P4EST_DIR)/lib -lsc - -CXXFLAGS = -I. -CXX = c++ - -CFLAGS = $(CXXFLAGS) -CC = gcc - -OBJS = example_parser.o parser.o - -all: $(OBJS) - $(CXX) $(OBJS) $(LDFLAGS) -o $(TARGET) - -clean: - rm -f *.o $(TARGET) diff --git a/snippets/tst_parser/dictionary.h b/snippets/tst_parser/dictionary.h deleted file mode 100644 index 8236aca54..000000000 --- a/snippets/tst_parser/dictionary.h +++ /dev/null @@ -1,192 +0,0 @@ - -/* *INDENT-OFF* */ -/*-------------------------------------------------------------------------*/ -/** - @file dictionary.h - @author N. Devillard - @date Sep 2007 - @version $Revision: 1.12 $ - @brief Implements a dictionary for string variables. - - This module implements a simple dictionary object, i.e. a list - of string/string associations. This object is useful to store e.g. - informations retrieved from a configuration file (ini files). -*/ -/*--------------------------------------------------------------------------*/ - -/* - $Id: dictionary.h,v 1.12 2007-11-23 21:37:00 ndevilla Exp $ - $Author: ndevilla $ - $Date: 2007-11-23 21:37:00 $ - $Revision: 1.12 $ -*/ - -#ifndef _DICTIONARY_H_ -#define _DICTIONARY_H_ - -/*--------------------------------------------------------------------------- - Includes - ---------------------------------------------------------------------------*/ - -#include -#include -#include - -/*--------------------------------------------------------------------------- - Save C++ compilation - ---------------------------------------------------------------------------*/ - -#ifdef __cplusplus -extern "C" { -#if 0 -} -#endif -#endif - -/*--------------------------------------------------------------------------- - New types - ---------------------------------------------------------------------------*/ - - -/*-------------------------------------------------------------------------*/ -/** - @brief Dictionary object - - This object contains a list of string/string associations. Each - association is identified by a unique string key. Looking up values - in the dictionary is speeded up by the use of a (hopefully collision-free) - hash function. - */ -/*-------------------------------------------------------------------------*/ -typedef struct _dictionary_ { - int n ; /** Number of entries in dictionary */ - int size ; /** Storage size */ - char ** val ; /** List of string values */ - char ** key ; /** List of string keys */ - unsigned * hash ; /** List of hash values for keys */ -} dictionary ; - - -/*--------------------------------------------------------------------------- - Function prototypes - ---------------------------------------------------------------------------*/ - -/*-------------------------------------------------------------------------*/ -/** - @brief Compute the hash key for a string. - @param key Character string to use for key. - @return 1 unsigned int on at least 32 bits. - - This hash function has been taken from an Article in Dr Dobbs Journal. - This is normally a collision-free function, distributing keys evenly. - The key is stored anyway in the struct so that collision can be avoided - by comparing the key itself in last resort. - */ -/*--------------------------------------------------------------------------*/ -unsigned dictionary_hash(char * key); - -/*-------------------------------------------------------------------------*/ -/** - @brief Create a new dictionary object. - @param size Optional initial size of the dictionary. - @return 1 newly allocated dictionary objet. - - This function allocates a new dictionary object of given size and returns - it. If you do not know in advance (roughly) the number of entries in the - dictionary, give size=0. - */ -/*--------------------------------------------------------------------------*/ -dictionary * dictionary_new(size_t size); - -/*-------------------------------------------------------------------------*/ -/** - @brief Delete a dictionary object - @param d dictionary object to deallocate. - @return void - - Deallocate a dictionary object and all memory associated to it. - */ -/*--------------------------------------------------------------------------*/ -void dictionary_del(dictionary * vd); - -/*-------------------------------------------------------------------------*/ -/** - @brief Get a value from a dictionary. - @param d dictionary object to search. - @param key Key to look for in the dictionary. - @param def Default value to return if key not found. - @return 1 pointer to internally allocated character string. - - This function locates a key in a dictionary and returns a pointer to its - value, or the passed 'def' pointer if no such key can be found in - dictionary. The returned character pointer points to data internal to the - dictionary object, you should not try to free it or modify it. - */ -/*--------------------------------------------------------------------------*/ -char * dictionary_get(dictionary * d, char * key, char * def); - - -/*-------------------------------------------------------------------------*/ -/** - @brief Set a value in a dictionary. - @param d dictionary object to modify. - @param key Key to modify or add. - @param val Value to add. - @return int 0 if Ok, anything else otherwise - - If the given key is found in the dictionary, the associated value is - replaced by the provided one. If the key cannot be found in the - dictionary, it is added to it. - - It is Ok to provide a NULL value for val, but NULL values for the dictionary - or the key are considered as errors: the function will return immediately - in such a case. - - Notice that if you dictionary_set a variable to NULL, a call to - dictionary_get will return a NULL value: the variable will be found, and - its value (NULL) is returned. In other words, setting the variable - content to NULL is equivalent to deleting the variable from the - dictionary. It is not possible (in this implementation) to have a key in - the dictionary without value. - - This function returns non-zero in case of failure. - */ -/*--------------------------------------------------------------------------*/ -int dictionary_set(dictionary * vd, char * key, char * val); - -/*-------------------------------------------------------------------------*/ -/** - @brief Delete a key in a dictionary - @param d dictionary object to modify. - @param key Key to remove. - @return void - - This function deletes a key in a dictionary. Nothing is done if the - key cannot be found. - */ -/*--------------------------------------------------------------------------*/ -void dictionary_unset(dictionary * d, char * key); - - -/*-------------------------------------------------------------------------*/ -/** - @brief Dump a dictionary to an opened file pointer. - @param d Dictionary to dump - @param f Opened file pointer. - @return void - - Dumps a dictionary onto an opened file pointer. Key pairs are printed out - as @c [Key]=[Value], one per line. It is Ok to provide stdout or stderr as - output file pointers. - */ -/*--------------------------------------------------------------------------*/ -void dictionary_dump(dictionary * d, FILE * out); - -#ifdef __cplusplus -#if 0 -{ -#endif -} -#endif - -#endif diff --git a/snippets/tst_parser/example_parser.cpp b/snippets/tst_parser/example_parser.cpp deleted file mode 100644 index 8feef70de..000000000 --- a/snippets/tst_parser/example_parser.cpp +++ /dev/null @@ -1,115 +0,0 @@ -#include -#include -#include -#include - -#include - -static int parse_ini_file(); - -#include "parser.H" - -int main(int argc, char * argv[]) -{ - int status; - // Set static variables - Parser P; - P.define(argc,argv); - status = parse_ini_file(); - return status; -} - -int parse_ini_file() -{ - // Open parser for section "fclaw" - Parser P("fclaw"); - - P.dump(); - - // Get fclaw values - printf("\n"); - printf("[fclaw]\n"); - - int mx; - mx = P.get_int("mx",0); - printf("%15s [%d]\n", "mx", mx); - - int my; - my = P.get_int("my", 0); - printf("%15s [%d]\n", "my", my); - - double tfinal; - tfinal = P.get_double("tfinal", 0.0); - printf("%15s [%g]\n", "Tfinal", tfinal); - - int sub; - sub = P.get_boolean("subcycling",-1); - printf("%15s [%d]\n","Subcycling", sub); - - int mwaves; - mwaves = P.get_int("mwaves",0); - printf("%15s [%d]\n","mwaves",mwaves); - - printf("\n"); - vector mthlim; - mthlim = P.get_int_array("mthlim"); - if (mthlim.size() != mwaves) - { - printf("Wrong number of limiters read in; mwaves = %d\n",mwaves); - exit(1); - } - for (int j = 0; j < mthlim.size(); j++) - { - printf("mthlim[%d] [%d]\n",j,mthlim[j]); - } - - printf("\n"); - vector mthbc; - mthbc = P.get_int_array("mthbc"); - if (mthbc.size() != 4) - { - printf("Wrong number of boundary conditions\n"); - exit(1); - } - for (int j = 0; j < mthbc.size(); j++) - { - printf("mthbc[%d] [%d]\n",j,mthbc[j]); - } - printf("etc....\n\n"); - - - Parser P_user("User"); - printf("[User]\n"); - vector darray; - darray = P_user.get_double_array("darray"); - for (int j = 0; j < darray.size(); j++) - { - printf("darray[%d] [%g]\n",j,darray[j]); - } - - printf("\n"); - printf("and what happens when items are missing ...\n"); - int N; - int badval = 47; - N = P_user.get_int("N",badval); - if (N == badval) - { - printf("N not found\n"); - } - - vector v; - v = P_user.get_int_array("v"); - if (v.size() == 0) - { - printf("Vector v not found or has length 0.\n"); - } - - vector w; - w = P_user.get_int_array("w"); - if (w.size() == 0) - { - printf("Vector w not found or has length 0.\n"); - } - - return 0; -} diff --git a/snippets/tst_parser/fclaw.ini b/snippets/tst_parser/fclaw.ini deleted file mode 100644 index c3e8981da..000000000 --- a/snippets/tst_parser/fclaw.ini +++ /dev/null @@ -1,42 +0,0 @@ -# The entries under "fclaw" must all be set here. - -[fclaw] - mx = 16 # Grid points in x direction in each grid - my = 16 # Grid points in y direction in each grid - - mbc = 2 # Number of ghost cells - - ax = -1 - bx = 1 - ay = -1 - by = 1 - - order = 2 2; - nout = 16 - tfinal = 4.0 - initial_dt = 0.02 - subcycling = T - - max_cfl = 1.0 - desired_cfl = 0.9 - - meqn = 1 - mwaves = 1 - mthlim = 4 - verbose = T - src = F - mcapa = 0 - - maux = 2 - - mthbc = 1 1 1 1 - - manifold = F - - minlevel = 1 - maxlevel = 4 - -# Let's try a double array -[User] - w = - darray = 1.2 1.3e-10 2e8 -6.7; diff --git a/snippets/tst_parser/iniparser.h b/snippets/tst_parser/iniparser.h deleted file mode 100644 index 10b6d2a59..000000000 --- a/snippets/tst_parser/iniparser.h +++ /dev/null @@ -1,295 +0,0 @@ -/* *INDENT-OFF* */ - -/*-------------------------------------------------------------------------*/ -/** - @file iniparser.h - @author N. Devillard - @date Sep 2007 - @version 3.0 - @brief Parser for ini files. -*/ -/*--------------------------------------------------------------------------*/ - -/* - $Id: iniparser.h,v 1.24 2007-11-23 21:38:19 ndevilla Exp $ - $Revision: 1.24 $ -*/ - -#ifndef _INIPARSER_H_ -#define _INIPARSER_H_ - -/*--------------------------------------------------------------------------- - Includes - ---------------------------------------------------------------------------*/ - -#include -#include -#include - -#include - -/*--------------------------------------------------------------------------- - Macros - ---------------------------------------------------------------------------*/ -/** For backwards compatibility only */ -#define iniparser_getstr(d, k) iniparser_getstring(d, k, NULL) -#define iniparser_setstr iniparser_setstring - -/*--------------------------------------------------------------------------- - Save C++ compilation - ---------------------------------------------------------------------------*/ - -#ifdef __cplusplus -extern "C" { -#if 0 -} -#endif -#endif - -/*-------------------------------------------------------------------------*/ -/** - @brief Get number of sections in a dictionary - @param d Dictionary to examine - @return int Number of sections found in dictionary - - This function returns the number of sections found in a dictionary. - The test to recognize sections is done on the string stored in the - dictionary: a section name is given as "section" whereas a key is - stored as "section:key", thus the test looks for entries that do not - contain a colon. - - This clearly fails in the case a section name contains a colon, but - this should simply be avoided. - - This function returns -1 in case of error. - */ -/*--------------------------------------------------------------------------*/ - -int iniparser_getnsec(dictionary * d); - - -/*-------------------------------------------------------------------------*/ -/** - @brief Get name for section n in a dictionary. - @param d Dictionary to examine - @param n Section number (from 0 to nsec-1). - @return Pointer to char string - - This function locates the n-th section in a dictionary and returns - its name as a pointer to a string statically allocated inside the - dictionary. Do not free or modify the returned string! - - This function returns NULL in case of error. - */ -/*--------------------------------------------------------------------------*/ - -char * iniparser_getsecname(dictionary * d, int n); - - -/*-------------------------------------------------------------------------*/ -/** - @brief Save a dictionary to a loadable ini file - @param d Dictionary to dump - @param f Opened file pointer to dump to - @return void - - This function dumps a given dictionary into a loadable ini file. - It is Ok to specify @c stderr or @c stdout as output files. - */ -/*--------------------------------------------------------------------------*/ - -void iniparser_dump_ini(dictionary * d, FILE * f); - -/*-------------------------------------------------------------------------*/ -/** - @brief Dump a dictionary to an opened file pointer. - @param d Dictionary to dump. - @param f Opened file pointer to dump to. - @return void - - This function prints out the contents of a dictionary, one element by - line, onto the provided file pointer. It is OK to specify @c stderr - or @c stdout as output files. This function is meant for debugging - purposes mostly. - */ -/*--------------------------------------------------------------------------*/ -void iniparser_dump(dictionary * d, FILE * f); - -/*-------------------------------------------------------------------------*/ -/** - @brief Get the string associated to a key - @param d Dictionary to search - @param key Key string to look for - @param def Default value to return if key not found. - @return pointer to statically allocated character string - - This function queries a dictionary for a key. A key as read from an - ini file is given as "section:key". If the key cannot be found, - the pointer passed as 'def' is returned. - The returned char pointer is pointing to a string allocated in - the dictionary, do not free or modify it. - */ -/*--------------------------------------------------------------------------*/ -char * iniparser_getstring(dictionary * d, const char * key, char * def); - -/*-------------------------------------------------------------------------*/ -/** - @brief Get the string associated to a key, convert to an int - @param d Dictionary to search - @param key Key string to look for - @param notfound Value to return in case of error - @return integer - - This function queries a dictionary for a key. A key as read from an - ini file is given as "section:key". If the key cannot be found, - the notfound value is returned. - - Supported values for integers include the usual C notation - so decimal, octal (starting with 0) and hexadecimal (starting with 0x) - are supported. Examples: - - - "42" -> 42 - - "042" -> 34 (octal -> decimal) - - "0x42" -> 66 (hexa -> decimal) - - Warning: the conversion may overflow in various ways. Conversion is - totally outsourced to strtol(), see the associated man page for overflow - handling. - - Credits: Thanks to A. Becker for suggesting strtol() - */ -/*--------------------------------------------------------------------------*/ -int iniparser_getint(dictionary * d, const char * key, int notfound); - -/*-------------------------------------------------------------------------*/ -/** - @brief Get the string associated to a key, convert to a double - @param d Dictionary to search - @param key Key string to look for - @param notfound Value to return in case of error - @return double - - This function queries a dictionary for a key. A key as read from an - ini file is given as "section:key". If the key cannot be found, - the notfound value is returned. - */ -/*--------------------------------------------------------------------------*/ -double iniparser_getdouble(dictionary * d, const char * key, double notfound); - -/*-------------------------------------------------------------------------*/ -/** - @brief Get the string associated to a key, convert to a boolean - @param d Dictionary to search - @param key Key string to look for - @param notfound Value to return in case of error - @return integer - - This function queries a dictionary for a key. A key as read from an - ini file is given as "section:key". If the key cannot be found, - the notfound value is returned. - - A true boolean is found if one of the following is matched: - - - A string starting with 'y' - - A string starting with 'Y' - - A string starting with 't' - - A string starting with 'T' - - A string starting with '1' - - A false boolean is found if one of the following is matched: - - - A string starting with 'n' - - A string starting with 'N' - - A string starting with 'f' - - A string starting with 'F' - - A string starting with '0' - - The notfound value returned if no boolean is identified, does not - necessarily have to be 0 or 1. - */ -/*--------------------------------------------------------------------------*/ -int iniparser_getboolean(dictionary * d, const char * key, int notfound); - - -/*-------------------------------------------------------------------------*/ -/** - @brief Set an entry in a dictionary. - @param ini Dictionary to modify. - @param entry Entry to modify (entry name) - @param val New value to associate to the entry. - @return int 0 if Ok, -1 otherwise. - - If the given entry can be found in the dictionary, it is modified to - contain the provided value. If it cannot be found, -1 is returned. - It is Ok to set val to NULL. - */ -/*--------------------------------------------------------------------------*/ -int iniparser_setstring(dictionary * ini, const char * entry, char * val); - - -/*-------------------------------------------------------------------------*/ -/** - @brief Delete an entry in a dictionary - @param ini Dictionary to modify - @param entry Entry to delete (entry name) - @return void - - If the given entry can be found, it is deleted from the dictionary. - */ -/*--------------------------------------------------------------------------*/ -void iniparser_unset(dictionary * ini, const char * entry); - -/*-------------------------------------------------------------------------*/ -/** - @brief Finds out if a given entry exists in a dictionary - @param ini Dictionary to search - @param entry Name of the entry to look for - @return integer 1 if entry exists, 0 otherwise - - Finds out if a given entry exists in the dictionary. Since sections - are stored as keys with NULL associated values, this is the only way - of querying for the presence of sections in a dictionary. - */ -/*--------------------------------------------------------------------------*/ -int iniparser_find_entry(dictionary * ini, char * entry) ; - -/*-------------------------------------------------------------------------*/ -/** - @brief Parse an ini file and return an allocated dictionary object - @param ininame Name of the ini file to read. - @param f Opened file pointer for error messages. - @return Pointer to newly allocated dictionary - - This is the parser for ini files. This function is called, providing - the name of the file to be read. It returns a dictionary object that - should not be accessed directly, but through accessor functions - instead. - - The returned dictionary must be freed using iniparser_freedict(). - */ -/*--------------------------------------------------------------------------*/ -dictionary * iniparser_load(const char * ininame, FILE * f); - -/*-------------------------------------------------------------------------*/ -/** - @brief Free all memory associated to an ini dictionary - @param d Dictionary to free - @return void - - Free all memory associated to an ini dictionary. - It is mandatory to call this function before the dictionary object - gets out of the current context. - */ -/*--------------------------------------------------------------------------*/ -void iniparser_freedict(dictionary * d); - -#ifdef __cplusplus -#if 0 -{ -#endif -} -#endif - -#endif - -/* *INDENT-ON* */ diff --git a/snippets/tst_parser/parser.H b/snippets/tst_parser/parser.H deleted file mode 100644 index 65cf962c1..000000000 --- a/snippets/tst_parser/parser.H +++ /dev/null @@ -1,37 +0,0 @@ -#include -#include -#include -#include - -#include - -#include -#include -#include - -using namespace std; - -class Parser -{ -public: - Parser(); - Parser(const char *section); - ~Parser(); - void define(int a_argc, char **a_argv); - void dump(); - - int get_int(const char *key, int notfound); - double get_double(const char *key, double notfound); - int get_boolean(const char *key, int notfound); - - vector get_int_array(const char *key); - vector get_double_array(const char *key); - -protected: - dictionary *m_ini; - static int s_argc; - static char** s_argv; - string m_section; -private: - const char* append_key(const char* key); -}; diff --git a/snippets/tst_parser/parser.cpp b/snippets/tst_parser/parser.cpp deleted file mode 100644 index 795d95e1e..000000000 --- a/snippets/tst_parser/parser.cpp +++ /dev/null @@ -1,113 +0,0 @@ -#include -#include -#include - -using namespace std; - -#include "parser.H" - -int Parser::s_argc = NULL; -char** Parser::s_argv = NULL; - -Parser::Parser() -{ - m_ini = NULL; -} - -void Parser::define(int a_argc, char **a_argv) -{ - s_argc = a_argc; - s_argv = a_argv; -} - -Parser::Parser(const char *a_section) -{ - if (s_argv == NULL) - { - printf("parser.cpp : parser is not defined\n"); - exit(1); - } - m_ini = iniparser_load(s_argv[1], stderr); - if (m_ini == NULL) - { - fprintf(stderr, "Cannot parse file: %s\n", s_argv[1]); - exit(1); - } - m_section.assign(a_section); -} - -Parser::~Parser() -{ - iniparser_freedict(m_ini); -} - -void Parser::dump() -{ - iniparser_dump(m_ini, stderr); -} - -const char* Parser::append_key(const char* key) -{ - string section_plus_key; - section_plus_key.assign(m_section); - section_plus_key.append(":"); - section_plus_key.append(key); - return section_plus_key.c_str(); -} - -int Parser::get_int(const char *key, int notfound) -{ - const char* section_plus_key = append_key(key); - return iniparser_getint(m_ini, section_plus_key, notfound); -} - -double Parser::get_double(const char *key, double notfound) -{ - const char* section_plus_key = append_key(key); - return iniparser_getdouble(m_ini, section_plus_key, notfound); -} - -int Parser::get_boolean(const char *key, int notfound) -{ - const char* section_plus_key = append_key(key); - return iniparser_getboolean(m_ini, section_plus_key, notfound); -} - -vector Parser::get_int_array(const char *key) -{ - - const char* section_plus_key = append_key(key); - vector numbers; - char *line; - line = iniparser_getstring(m_ini,section_plus_key, NULL); - if (line == NULL) - { - return numbers; - } - - stringstream lineStream(line); - - int num; - while (lineStream >> num) numbers.push_back(num); - - return numbers; -} - -vector Parser::get_double_array(const char *key) -{ - const char* section_plus_key = append_key(key); - vector numbers; - char *line; - line = iniparser_getstring(m_ini,section_plus_key, NULL); - if (line == NULL) - { - return numbers; - } - - stringstream lineStream(line); - - double num; - while (lineStream >> num) numbers.push_back(num); - - return numbers; -} diff --git a/snippets/tst_static_storage/foo.H b/snippets/tst_static_storage/foo.H deleted file mode 100644 index 9a9abcba6..000000000 --- a/snippets/tst_static_storage/foo.H +++ /dev/null @@ -1,9 +0,0 @@ -class foo -{ -public: - static double x; - - foo(); - - void print(); -}; diff --git a/snippets/tst_static_storage/foo.cpp b/snippets/tst_static_storage/foo.cpp deleted file mode 100644 index f982cec62..000000000 --- a/snippets/tst_static_storage/foo.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include "foo.H" -#include -#include - -// This acts as a default value (??) -double foo::x; - -foo::foo() -{ - foo::x = 1; -} - -void foo::print() -{ - printf("x = %f\n",foo::x); -} diff --git a/snippets/tst_static_storage/main.cpp b/snippets/tst_static_storage/main.cpp deleted file mode 100644 index 97919854f..000000000 --- a/snippets/tst_static_storage/main.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#include -#include - -#include "foo.H" - -int main() -{ - foo f,g; - - f.print(); - g.print(); - - // This call sets foo::x to the desired value. - foo::x = 5; - - f.print(); - g.print(); - -} diff --git a/snippets/tst_typedefs/f3.c b/snippets/tst_typedefs/f3.c deleted file mode 100644 index a3e6632bb..000000000 --- a/snippets/tst_typedefs/f3.c +++ /dev/null @@ -1,14 +0,0 @@ -struct s; - -typedef void (*f_t)(struct s); - -typedef struct s -{ - f_t g; -} s_t; - - -int main() -{ - return 0; -}