How to use logic blocks

Summary:

This article explains how to use nTop's logic blocks and the Await block in your workflow. You can use these blocks to change how your workflow calculates results.

Applies to:

  • Logic blocks
  • Await block

Logic blocks use bools to change the outcome of a result. A bool is a data type that can have one of two possible values, these values are usually represented as true or false. You can use logic blocks to easily change between multiple workflow outcomes.

Using this example, we can highlight the different interactions between logic blocks in nTop. The screenshot below shows our starting geometry and two bool inputs we can use to change the outcome of our workflow.

starting geometry.jpg

If-Else:

The If-Else block returns one of two possible values depending on a bool condition. If the bool is true, the block computes the 'Then' input. If the bool is false, the block computes the 'Else' input.

In the example below, we start with a meshed block. The 'Sharpen' bool from the original mesh is being used to determine which input of the If-Else block should be computed. The 'Sharpen' bool is originally off, therefore the Remesh Surface block is computed. Once the 'Sharpen' bool is toggled on, the Orient Object block is computed.

If Else.gif

Back to top

Not

The Not block returns a true value if the input condition is false. By inserting the Not block into the 'Condition' input, we can reverse the outcome of the first example. The gif starts by showing that the 'Sharpen' input is not enabled, therefore the condition is true and the Orient Object block is calculated. Once the 'Sharpen' input is toggled, the bool becomes false and the Remesh Surface is calculated.

Not block.gif

Back to top

Or

The Or block returns a true value if either of the two input values are true. In the example below, the Or block starts as false because neither of the two conditions are true. When the 'Sharpen' input is toggled on, 'Value A' becomes true and therefore the Or block is true. The block will remain true as long as one or both of the conditions are being met.

Or block.gif

Back to top

And

The And block returns a true value if both of the two input values are true. In the example below, the And block starts as false because neither of the two conditions are true. When the 'Sharpen' input is toggled on, 'Value A' becomes true but the block is still false. The block will remain false until both of the conditions are being met. Once the 'Simplify' input is toggled on, we can see the And block becomes true.

And block.gif

Back to top

Await

The Await block will execute once the 'Wait For' input is built, and will produce the object in the 'Return' input as the output. You can use this to force blocks to compute in serial order instead of in parallel. This is helpful for users running resource intensive workflows.

The gif below shows how nTop normally works by starting to compute the Static Analysis and Topology Optimization blocks at the same time, in parallel.

Without Await.gif

By using the Await block, we can force the blocks to run in series instead of parallel. In the gif below, the Await block is placed in the 'Value' input of the Volume Fraction Constraint. This causes the Topology Optimization to wait until the Static Analysis finishes before it can start computing.

With Await.gif

Back to top

Example File:

More on this topic:

Keywords:

 blocks not document and equal equals or if else if else greater less logic xor great 
Was this article helpful?