test: Refactored transposing of plot data into function bin/tools/RunFunctions::transposeFile()

which simplifies the reactingEulerFoam populationBalance test cases.

Patch contributed by Institute of Fluid Dynamics, Helmholtz-Zentrum
Dresden - Rossendorf (HZDR)
This commit is contained in:
Henry Weller
2018-03-23 14:24:50 +00:00
parent ef885b407c
commit a59351c64f
19 changed files with 149 additions and 190 deletions

View File

@ -168,4 +168,31 @@ cloneCase()
fi
}
transposeFile()
{
awk '
{
for (i = 1; i <= NF; i++)
{
a[NR, i] = $i
}
}
NF > p {p = NF}
END {
for (j = 1; j <= p; j++)
{
str = a[1,j]
for(i = 2; i <= NR; i++)
{
str = str" "a[i,j];
}
print str
}
}' $1
}
#------------------------------------------------------------------------------