FeResPost Web Site                     FeResPost Online User Manual

IX.1.2 “printStressMax” example

The example is provided in “TESTSAT/NETEX/EX05/printStressMax.cs” source file. This example is worth discussing because it illustrates the difference between the value returned by “Result.getData” method in ruby extension and in C#.

In the example, one extracts the data on a Result which associates only one key-value pair, but the present principles are valid for more general Results. The following ruby lines make use of the ruby extension and 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 .NET assembly by the following C# code:

    ...
    maxScalarData=maxScalar.getData();
    maxStressData=maxStress.getData();

    Console.WriteLine();
    Console.WriteLine("Maximum Von Mises stress in panel +Z skins :");
    Console.WriteLine();
    Console.Write("   {0:F2} Pa ",maxScalarData[0,5]);
    Console.Write("on element {0:D} ",maxScalarData[0,0]);
    Console.WriteLine("(layer=\"{0:S}\")",maxScalarData[0,2]);
    Console.Write("      Sxx = {0:F2}, ",maxStressData[0,5]);
    Console.Write("Syy = {0:F2}, ",maxStressData[0,6]);
    Console.WriteLine("Szz = {0:F2}, ",maxStressData[0,7]);
    Console.Write("      Sxy = {0:F2}, ",maxStressData[0,8]);
    Console.Write("Syz = {0:F2}, ",maxStressData[0,9]);
    Console.WriteLine("Szx = {0:F2} ",maxStressData[0,10]);
    ...

One notices that one no longer accesses element 0 of the array returned by “getData”. Indeed, in .NET assembly, the method returns a 2D Array, and not an Array of Arrays as in ruby extension.