Fluids

Fluids

Topics related to Fluent, CFX, Turbogrid and more.

[Thermal Desktop] [OpenTD] Bulk editing of elements without for or foreach loop

    • mhaas
      Subscriber

      Using OpenTD, is there a way to edit multiple elements without using a for or foreach loop (which essentially edits them one at at time) when these elements are somehow grouped (either in a submodel, layer, domain, etc.)? I know it's possible to do this bulk editing within Thermal Desktop, and I'm looking at how to do this efficiently in C#.

      From the Getting Started manual, I've seen this done with a foreach loop:

      foreach (LinearQuad q in quads)
      {
      q.CondSubmodel = submodel;
      q.TopThickness = 0.01;
      q.Update();
      }

      Additionally, in the code I'm writing, what I'm interested in is similarly implemented.
      myElementList.ForEach(e => 
      {
      e.ThermoMaterial = ThermoMaterialName;
      e.Layer = Layer.Name;
      e.Update();
      }

      However, this method takes too long for my application and I'm hoping there's a way to shorten the element editing time using some type of group editing.

      Thank you!

    • Doug Bell
      Ansys Employee

      Even with the array-based code in Fortran, each element is individually edited. It just does the loop internally: fewer lines of code to compile and the most efficient method of looping (this would be a bigger benefit with multi-dimensional arrays). Unfortunately, there isn't a better option that we know of. Someone in the community might be able to prove us wrong (which would be quite welcome).

Viewing 1 reply thread
  • You must be logged in to reply to this topic.