c # – Multi-threading with TPL – Accessing the properties of the internal class

I am using the TPL library to parallelize a 2D grid operation. I have extracted a simple example from my actual code to illustrate what I am doing. I get the desired results and my computing times are accelerated by the number of processors on my laptop (12).

I would love to have advice or opinions on my code regarding how my properties are declared. Again, it works as expected, but ask yourself if the design could be better. Thanks in advance.

My simplified code:

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace Gridding
{


    public abstract class Base
    {
        /// 
        /// Values representing the mesh values where each node in the gridis assigned som value. 
        /// 
        public float(,) Values { get; set; }
        public abstract void Compute();
    }


    public class Derived : Base
    {

        /// 
        /// Make the mesh readonly.  Is this necessary?
        /// 
        readonly Mesh MyMesh;

        Derived(Mesh mesh)
        {
            MyMesh = mesh;
        }


        public override void Compute()
        {
            Values = new float(MyMesh.NX, MyMesh.NY);

            double() xn = MyMesh.GetXNodes();
            double() yn = MyMesh.GetYNodes();

            /// Paralellize the threads along the columns of the grid using the Task Paralllel Library (TPL).
            Parallel.For(0, MyMesh.NX, i =>
            {
                Run(i, xn, yn);
            });
        }


        private void Run(int i, double() xn, double() yn)
        {
            /// Some long operation that parallelizes along the columns of a mesh/grid
            double x = xn(i);
            for (int j = 0; j < MyMesh.NY; j++)
            {

                /// Again, longer operation here
                double y = yn(j);

                double someValue = Math.Sqrt(x * y); 
                Values(i, j) = (float)someValue;
            }
        }


        static void Main(string() args)
        {
            int nx = 100;
            int ny = 120;
            double x0 = 0.0;
            double y0 = 0.0;
            double width = 100;
            double height = 120;

            Mesh mesh = new Mesh(nx, ny, x0, y0, width, height);

            Base tplTest = new Derived(mesh);
            tplTest.Compute();

            float(,) values = tplTest.Values;

            Console.Read();


        }

        /// 
        /// A simple North-South oriented grid.
        /// 
        class Mesh
        {
            public int NX { get; } = 100;
            public int NY { get; set; } = 150;
            public double XOrigin { get; set; } = 0.0;
            public double YOrigin { get; set; } = 0.0;
            public double Width { get; set; } = 100.0;
            public double Height { get; set; } = 150.0;
            public double DX { get; }
            public double DY { get; }

            public Mesh(int nx, int ny, double xOrigin, double yOrigin, double width, double height)
            {
                NX = nx;
                NY = ny;
                XOrigin = xOrigin;
                YOrigin = yOrigin;
                Width = width;
                Height = height;
                DX = Width / (NX - 1);
                DY = Height / (NY - 1);
            }

            public double() GetYNodes()
            {
                double() yNodeLocs = new double(NY);
                for (int i = 0; i < NY; i++)
                {
                    yNodeLocs(i) = YOrigin + i * DY;
                }
                return yNodeLocs;
            }

            public double() GetXNodes()
            {
                double() xNodeLocs = new double(NX);
                for (int i = 0; i < NX; i++)
                {
                    xNodeLocs(i) = XOrigin + i * DX;
                }
                return xNodeLocs;
            }
        }
    }
}

7 – The tpl / theme file "Views Row Style Output" causes the rupture / disappearance of the navigation on the site.

In a view, the following elements are used to allow me to exchange the order of fields / lines for each line:

content: the output of the field.
* - $ field-> raw: The raw data of the field, if they exist. This is not a secure output.
* - $ field-> class: Secure class identifier to use.
* - $ field-> handler: View field manager object controlling this field. Do not use
* var_export to empty this object because it can not handle recursion.
* - $ field-> inline: Indicates whether the field should be online.
* - $ field-> inline_html: div or span depending on the flag above.
* - $ field-> wrapper_prefix: A complete wrapper containing the inline_html to use.
* - $ field-> wrapper_suffix: The closing tag of the wrapper.
* - $ field-> separator: an optional separator that can appear before a field.
* - $ field-> label: The text of the package to use.
* - $ field-> label_html: The complete HTML code of the label to use, including
* type of configured element.
* - $ row: The raw result object of the query, with all the data that it has extracted.
*
* @ingroup views_templates
* /
?>
row_index% 2 == 0):

//picture
print fields $['field_image']-> wrapper_prefix;
print fields $['field_image']-> content;
print fields $['field_image']-> wrapper_suffix;

//body
print fields $['body']-> wrapper_prefix;
print fields $['body']-> content;
print fields $['body']-> wrapper_suffix;

//mobile
print fields $['nothing']-> wrapper_prefix;
print fields $['nothing']-> content;
print fields $['nothing']-> wrapper_suffix;


other:

//body
print fields $['body']-> wrapper_prefix;
print fields $['body']-> content;
print fields $['body']-> wrapper_suffix;

//picture
print fields $['field_image']-> wrapper_prefix;
print fields $['field_image']-> content;
print fields $['field_image']-> wrapper_suffix;

//mobile
print fields $['nothing']-> wrapper_prefix;
print fields $['nothing']-> content;
print fields $['nothing']-> wrapper_suffix;

end if; ?>

Filename: view-view-fields – founders.tpl.php

But now, every time I click on the button "Rescan template files" in the view, and sometimes just randomly, my main navigation disappears and the "View, Edit" tabs turn into a bulleted list. Is this the right way to achieve this desired end result? Is there a blatant omission in my tpl file code?

enter the description of the image here

Thank you!