summaryrefslogtreecommitdiff
path: root/genLikoInc
blob: 2a16dcba6aa95ddc19dd55590c2aa79d65f2ced7 (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
#!/bin/bash

file="$(dirname "$0")/linearkombinationen.inc"
maximum=32

echo > ${file}
echo "// interface *******************************************************************" >> ${file}
echo >> ${file}
echo "{\$IFDEF LiKoInterface}" >> ${file}
echo "// Werte werden auf (in1 + \sum_i faki * ini') gesetzt" >> ${file}

for ((i=2; i<=maximum; i++))
do
  echo -ne "procedure liKo(in1" >> ${file}
  for ((j=2; j<=${i}; j++))
  do
    echo -ne ",in${j}" >> ${file}
  done
  echo -ne ": tFelder; fak2" >> ${file}
  for ((j=3; j<=${i}; j++))
  do
    echo -ne ",fak${j}" >> ${file}
  done
  echo ": double); overload; inline;" >> ${file}
done

echo "{\$ENDIF}" >> ${file}
echo >> ${file}
echo "// implementation **************************************************************" >> ${file}
echo >> ${file}
echo "{\$IFDEF LiKoImplementation}" >> ${file}
echo >> ${file}
echo "{\$INCLUDE linearkombination.inc}" >> ${file}
for ((i=3; i<=maximum; i++))
do
  echo "{\$DEFINE lkA${i}}" >> ${file}
  echo "{\$INCLUDE linearkombination.inc}" >> ${file}
done
for ((i=maximum; i>=3; i--))
do
  echo "{\$UNDEF lkA${i}}" >> ${file}
done
echo "{\$ENDIF}" >> ${file}

# jetzt zur unter-Include ****************************************************************************

file="$(dirname "$0")/linearkombination.inc"

echo > ${file}
echo "// Werte werden auf (in1 + \\sum_i faki * ini') gesetzt" >> ${file}
echo >> ${file}
echo -ne "procedure tFelder.liKo(in1,in2" >> ${file}
for ((i=3; i<=maximum; i++))
do
  echo -ne "\n{\$IFDEF lkA${i}},in${i}{\$ENDIF}" >> ${file}
done
echo ": tFelder;" >> ${file}
echo -ne "fak2" >> ${file}
for ((i=3; i<=maximum; i++))
do
  echo -ne "\n{\$IFDEF lkA${i}},fak${i}{\$ENDIF}" >> ${file}
done
echo ": double);" >> ${file}
echo "var" >> ${file}
echo "  i,j: longint;" >> ${file}
echo "  emF: tEMFeldGroesze;" >> ${file}
echo "begin" >> ${file}
echo "  for emF:=erstesEMFMitAbleitung to letztesEMFMitAbleitung do" >> ${file}
echo "    for i:=0 to aX-1 do" >> ${file}
echo "      (emFelder[emF,false]+i)^:=" >> ${file}
echo -ne "        (in1.emFelder[emF,false]+i)^" >> ${file}
for ((i=2; i<=maximum; i++))
do
  if [ ${i} -gt 2 ]
  then
    echo -ne "\n        {\$IFDEF lkA${i}}" >> ${file}
  fi
  echo -ne "\n        + fak${i}*(in${i}.emFelder[emF,true]+i)^" >> ${file}
  if [ ${i} -gt 2 ]
  then
    echo -ne "\n        {\$ENDIF}" >> ${file}
  fi
done
echo ";" >> ${file}
echo >> ${file}
echo "  for i:=0 to length(impulsraum)-1 do" >> ${file}
echo "    for j:=0 to aX*aP-1 do" >> ${file}
echo "      (impulsraum[i,false]+j)^:=" >> ${file}
echo -ne "        (in1.impulsraum[i,false]+j)^" >> ${file}
for ((i=2; i<=maximum; i++))
do
  if [ ${i} -gt 2 ]
  then
    echo -ne "\n        {\$IFDEF lkA${i}}" >> ${file}
  fi
  echo -ne "\n        + fak${i}*(in${i}.impulsraum[i,true]+j)^" >> ${file}
  if [ ${i} -gt 2 ]
  then
    echo -ne "\n        {\$ENDIF}" >> ${file}
  fi
done
echo ";" >> ${file}
echo >> ${file}
echo "  {\$IFDEF DichteNichtnegativieren}" >> ${file}
echo "  nichtnegativieren;" >> ${file}
echo "  {\$ENDIF}" >> ${file}
echo >> ${file}
echo "end;" >> ${file}