The example is provided in the “TESTSAT/NET/EX05/printStressMax.cs” source file. This example is worth discussing because it illustrates the difference between the value returned by the “Result.getData” method in the Ruby extension and in C#.
In the example, the data for a Result associating only one key-value pair is extracted, but the same principles apply to more general Results. The following Ruby lines make use of the Ruby extension to extract and print the stress components:
...
maxScalarData = maxScalar.getData()[0]
maxStressData = maxStress.getData()[0]
...
printf(" %.2f Pa on element %d (layer=\"%s\").\n",
maxScalarData[5],maxScalarData[0],maxScalarData[2])
printf(" Sxx = %.2f, Syy = %.2f, Szz = %.2f,\n",maxStressData[5],\
maxStressData[6],maxStressData[7])
printf(" Sxy = %.2f, Syz = %.2f, Szx = %.2f\n",maxStressData[8],\
maxStressData[9],maxStressData[10])
...
The same operation is performed with the .NET assembly by the following C# code:
...
object[] maxScalarData = Util.getDataRow(maxScalar.getData(), 0);
object[] maxStressData = Util.getDataRow(maxStress.getData(), 0);
...
Console.Write(" {0:F2} Pa on element {1} (layer=\"{2}\").\n",
maxScalarData[5], maxScalarData[0], maxScalarData[2]);
Console.Write(" Sxx = {0:F2}, Syy = {1:F2}, Szz = {2:F2},\n",
maxStressData[5], maxStressData[6], maxStressData[7]);
Console.Write(" Sxy = {0:F2}, Syz = {1:F2}, Szx = {2:F2}\n",
maxStressData[8], maxStressData[9], maxStressData[10]);
...