#!/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}