summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: da40c8d4a5caa0938f8b5ccd00b94eca2c9159ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# Maintainer: Maurizio D'Addona <mauritiusdadd@gmail.com>
# Contributor: Sven Niese <Fd3querm@yahoo.de>
# Contributor: Daniel Murphy <mosquitogang201@gmail.com>

# NOTE: If build fails try to add the option "!makeflags" to options array
#       !buildflags is needed in order to compile the code

pkgname=calculix-ccx
pkgver=2.21
pkgrel=2
provides=('calculix')
replaces=('calculix')
conflicts=('calculix')
pkgdesc="CalculiX: 3D Structural Finite Element Program - Solver"
arch=('i686' 'x86_64')
options=(!buildflags)
url="http://www.calculix.de/"
license=('GPL2')
depends=('arpack' 'spooles' 'blas')
optdepends=('calculix-doc: documentation and examples'
            'tetgen: for tet meshing')
makedepends=('gcc-fortran' 'perl')
checkdepends=('perl')

source=(
    "http://www.dhondt.de/ccx_${pkgver}.src.tar.bz2"
    "http://www.dhondt.de/ccx_${pkgver}.test.tar.bz2"
    "http://www.dhondt.de/ccx_${pkgver}.fluidtest.tar.bz2"
    "http://www.dhondt.de/ccx_${pkgver}.structest.tar.bz2"
)

sha256sums=(
    '52a20ef7216c6e2de75eae460539915640e3140ec4a2f631a9301e01eda605ad'
    '094a0a2ec324fc6f937a96e932b488f48f31ad8d5d1186cd14437e6dc3e599ea'
    'b7a5f672918deb4176c9c1c02619a16178e31771b72a58c1188db57e91f28954'
    '264c6f9e9335f9bdcf6a39eafcdc868f47549a64866278d848e41bd9cd1b1a1b'
)
#
# NOTE: remove -Wno-implicit when code is fixed by upstream
#
build()
{
    cd "${srcdir}/CalculiX/ccx_${pkgver}/src"
    make CFLAGS="${CFLAGS} -Wall -Wno-implicit -O2 -fopenmp \
                  -I /usr/include/spooles \
                  -DARCH=\"Linux\" -DSPOOLES -DARPACK -DMATRIXSTORAGE \
                  -DNETWORKOUT -DUSE_MT=1" \
         FFLAGS='-Wall -O2 -fopenmp -fpic -fallow-argument-mismatch' \
         LIBS='-lpthread -lm -lc -lspooles -larpack -lblas -llapack -lgomp'
}

check()
{
  tests=('beamp' 'ball' 'pipe' 'pipe2' 'planestress'
         'gap' 'gap2' 'capacitor' 'carbonseal' 'beamptied1'
         'beamp1rotate' 'beamp2' 'beamp2rotate' 'beamf' 'beamhf'
         'furnace' 'gaspipe1' 'gaspipe1-oil' 'gaspipe2'
         'gaspipe3' 'gaspipe4' 'gaspipe5' 'gaspipe6' 'gaspipe7'
         'gaspipe8' 'gaspipe-cfd-pressure' 'gaspipe8-cfd-pressure'
         'gaspipe8-cfd-massflow' 'gaspipe8-cfd-pressure'
         'gaspipe8-cfd-pressure-split' 'green1' 'green2' 'green3'
         'green4' 'hinge' 'hueeber1' 'hueeber2' 'induction' 'induction2'
         'inistrain' 'largerot1' 'linearnet' 'mass1' 'mass2' 'mass3'
         'massflow_percent_ccx' 'membrane1' 'metalforming' 'modelchel'
         'networkmpc' 'oneel' 'pendel' 'resstress1'
         'restrictor' 'segment' 'sensitivity_I' 'shell1'
         'shellbeam' 'shellf' 'simplebeam' 'spring1' 'spring2'
         'small_pressure_gradient' 'square' 'substructure' 'swing'
         'thermomech' 'transition' 'truss' 'vortex1' 'wire')

  msg "Testing solver..."
  cd ${srcdir}/CalculiX/ccx_${pkgver}/test

  error_status=0
  start_time="$(date -u +%s)"
  for test_name in "${tests[@]}" ; do
    ref_file=${test_name}.dat.ref
    dat_file=${test_name}.dat
    frd_file=${test_name}.frd
    log_file=${test_name}.log

    msg2 "testing ${test_name}"
    rm -f ${dat_file}
    rm -f ${frd_file}

    # Testing on maximum 4 cores
    OMP_NUM_THREADS=4 ../src/ccx_${pkgver} ${test_name} &> ${log_file} ||\
        warning "check $(pwd)/${log_file}"

    if [ ! -f ${dat_file} ]; then
	    warning "${dat_file} does not exist"
       error_status=1
    fi

    sum1="$(wc -l ${dat_file})"
    sum2="$(wc -l ${ref_file})"
    if [ ${sum1%* *} != ${sum2%* *} ]; then
	    warning "The data file generated by ccx is not valid"
      error_status=1
    fi

    if grep "NaN" ${dat_file} ; then
      warning "${dat_file} contains NaNs!"
      error_status=1
    fi

    if ! ./datcheck.pl ${test_name} ; then
      warning "Result is inconsistent with reference data!"
      error_status=1
    fi
  done
  
  cd ${srcdir}/CalculiX/ccx_${pkgver}/fluidtest  
  for test_name in ./*.inp ; do
    msg2 "testing ${test_name}"
    OMP_NUM_THREADS=4 ../src/ccx_${pkgver} ${test_name} &> ${log_file} ||\
        error_status=1 warning "check $(pwd)/${log_file}"
  done
    
  cd ${srcdir}/CalculiX/ccx_${pkgver}/structest  
  for test_name in ./*.inp ; do
    msg2 "testing ${test_name}"
    OMP_NUM_THREADS=4 ../src/ccx_${pkgver} ${test_name} &> ${log_file} ||\
        error_status=1 warning "check $(pwd)/${log_file}"
  done
  end_time="$(date -u +%s)"
  elapsed="$(($end_time-$start_time))"
  
  msg "Total of $elapsed seconds elapsed for tesing"
  
  return $error_status
}

package() 
{
    install -d  ${pkgdir}/usr/bin
    install -Dm755 ${srcdir}/CalculiX/ccx_${pkgver}/src/ccx_${pkgver} ${pkgdir}/usr/bin/ccx
}