diff options
author | Erich Eckner <git@eckner.net> | 2015-08-04 10:12:25 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2015-08-04 10:12:25 +0200 |
commit | 16be431a71ff4d05d20bfcdf55627a2562506768 (patch) | |
tree | 659dac1518a9652ba6301e58a94170501d3b8efd /rktopas | |
parent | 0484afec8922e5ac455b98bcd5516d53443a475c (diff) | |
download | Plasmapropagation-16be431a71ff4d05d20bfcdf55627a2562506768.tar.xz |
script zur Koeffizientenkonversion erstellt: rktopas
Diffstat (limited to 'rktopas')
-rwxr-xr-x | rktopas | 33 |
1 files changed, 33 insertions, 0 deletions
@@ -0,0 +1,33 @@ +#!/bin/bash + +for inputFile in $* +do + outputFile="$(echo ${inputFile} | sed "s/\.txt$/.inc/")" + + lines=$(grep --text "^ *[0-9]\+ \+[0-9]\+ \+[-0-9.^*]\+.$" ${inputFile} | sed "s/^ \+//" | sed "s/[^0-9]$//" | grep -v "^[0-9]\+ \+[0-9]\+ \+0\(\.0\+\)\?$" | sed "s/0\+$//" | awk '{print $1+1" "$2+1" "$3}') + + [ -e ${outputFile} ] && rm ${outputFile} + touch ${outputFile} + + for i in $(echo -ne "${lines}" | cut -d " " -f 1 | sort -nu) + do + echo -ne " felders[${i}].liKo(\n felders[aktuelleFelder]" >> ${outputFile} + echo -ne "${lines}" | grep "^${i} \+" | sed "s/^[0-9]\+ \+\([0-9]\+\) \+[-0-9.*^]\+$/,\n felders[\1]/" | tr "\n" ";" | sed "s/;,/,/g" | sed "s/;$//" | tr ";" "\n" | sed "s/felders\[1\]/felders[aktuelleFelder]/g" >> ${outputFile} + echo -ne "${lines}" | grep "^${i} \+" | sed "s/^[0-9]\+ \+[0-9]\+ \+\([-0-9.*^]\+\)$/,\n \1 * dT/" | tr "\n" ";" | sed "s/,;/,\n/g" | sed "s/;,/,/g" | tr ";" " " | sed "s/ $//" | sed "s/\*10^/E/g" >> ${outputFile} + echo -e "\n );" >> ${outputFile} + echo " felders[${i}].berechneAbleitungen(dT/2,dX,iDT,iDX,pDNMax);" >> ${outputFile} + echo >> ${outputFile} + echo " if pruefeMaxDT(${i},mDT,dT) then" >> ${outputFile} + echo " continue;" >> ${outputFile} + echo >> ${outputFile} + done + + rest=$[$(wc -l ${inputFile} | cut -d " " -f 1)-$(grep --text -n "^ *k\s\+c\[k].$" ${inputFile} | cut -d ":" -f 1)] + lines=$(tail -n${rest} ${inputFile} | sed "s/^ \+//" | sed "s/[^0-9]$//" | grep --text "^[0-9]\+ \+[-0-9.^*]\+$" | grep -v "^[0-9]\+ \+0\(\.0\+\)\?$" | sed "s/0\+$//" | awk '{print $1+1" "$2}') + + echo -e " felders[1-aktuelleFelder].liKo(\n felders[aktuelleFelder]," >> ${outputFile} + echo -e "${lines}" | sed "s/^\([0-9]\+\) \+[-0-9.*^]\+$/ felders[\1],/" | sed "s/felders\[1\]/felders[aktuelleFelder]/g" >> ${outputFile} + echo -ne "${lines}" | sed "s/^[0-9]\+ \+\([-0-9.*^]\+\)$/ \1 * dT,/" | tr "\n" "," | sed "s/\([^,]\),$/\1\n );\n/" | sed "s/,,/,\n/g" | sed "s/\*10^/E/g" >> ${outputFile} + +done + |