also test with -fcoarray=single
[AGH_fortran_course_solution3.git] / run.sh
blobca72d9c52fffd6a13d90560d44d55c9e9e9eb2f0
1 #!/bin/bash
3 # Copyright 2019 Wojciech Kosior
5 # This is free and unencumbered software released into the public domain.
7 # Anyone is free to copy, modify, publish, use, compile, sell, or
8 # distribute this software, either in source code form or as a compiled
9 # binary, for any purpose, commercial or non-commercial, and by any
10 # means.
12 # In jurisdictions that recognize copyright laws, the author or authors
13 # of this software dedicate any and all copyright interest in the
14 # software to the public domain. We make this dedication for the benefit
15 # of the public at large and to the detriment of our heirs and
16 # successors. We intend this dedication to be an overt act of
17 # relinquishment in perpetuity of all present and future rights to this
18 # software under copyright law.
20 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23 # IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
24 # OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
25 # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
26 # OTHER DEALINGS IN THE SOFTWARE.
28 # For more information, please refer to <http://unlicense.org/>
30 if [ -z "$1" ]; then echo "please pass number of images"; exit; fi
32 COMMAND="cafrun -np $1 ./integrator"
34 QUADRATURE_TYPES="newton-cotes gauss"
36 FUNCTIONS="exp sin poly"
38 # for simplicity always use the same
39 IBEG="-0.5"
40 IEND="1"
42 SUBINTERVALS="1 4 16 64 128"
44 valid_poly_orders() {
45 if [ "$1" = newton-cotes ]; then seq 0 2; fi
46 if [ "$1" = gauss ]; then seq 1 3; fi
49 echo "\
50 # results of numerical integration of three different functions
51 # (exp, sin and some 10 degree polynomial) on [$IBEG; $IEND] interval
53 #FUNC ___QUAD_TYPE POLY_ORDER SUBINTERVALS _______COMPUTED_VALUE __________VALUE_ERROR"
56 for FUNC in $FUNCTIONS; do
57 echo -n "# function $FUNC; exact integral:"
58 $COMMAND analytical $FUNC $IBEG $IEND
60 for TYPE in $QUADRATURE_TYPES; do
61 for N in $SUBINTERVALS; do
62 for P in `valid_poly_orders $TYPE`; do
63 printf "%5s %12s %10s %12s " $FUNC $TYPE $P $N
64 $COMMAND $TYPE $FUNC $IBEG $IEND $P $N
65 done
66 done
67 done
68 done