hpcflow.sdk.core.task.RepeatsDescriptor#

class hpcflow.sdk.core.task.RepeatsDescriptor(number, name='', nesting_order=0.0, generate_seed_sequence=True, master_seed=None)#

Bases: JSONLike

Specification for defining element repeats.

Parameters:
  • name (str) – Name to reference this repeats descriptor. An empty string by default.

  • number (int) – Number of times to repeat the elements of the element set.

  • nesting_order (int | float) – The nesting order. Normally an integer; non-integer values have special meanings.

  • generate_seed_sequence (bool) – Whether to generate a ValueSequence of random seeds corresponding to the repeats.

  • master_seed (int | None) – The master seed to use if generating a corresponding ValueSequence of random seeds.

Methods

from_json_like

Make an instance of this class from JSON (or YAML) data.

normalise

Generate from repeats descriptors specified in potentially several ways.

to_dict

Serialize this object as a dictionary.

to_json_like

Serialize this object as an object structure that can be trivially converted to JSON.

Attributes

generate_seed_sequence

Whether to generate a ValueSequence of random seeds corresponding to the repeats

master_seed

The master seed to use if generating a corresponding ValueSequence of random seeds.

name

Name to reference this repeats descriptor.

nesting_order

The nesting order.

number

Number of times to repeat the elements of the element set.

classmethod from_json_like(json_like, shared_data=None)#

Make an instance of this class from JSON (or YAML) data.

Parameters:
  • json_like (str | Mapping[str, JSONed] | Sequence[Mapping[str, JSONed]] | None) – The data to deserialise.

  • shared_data (Mapping[str, ObjectList[JSONable]] | None) – Shared context data.

Return type:

The deserialised object.

generate_seed_sequence: bool = True#

Whether to generate a ValueSequence of random seeds corresponding to the repeats

master_seed: int | None = None#

The master seed to use if generating a corresponding ValueSequence of random seeds.

name: str = ''#

Name to reference this repeats descriptor. An empty string by default.

nesting_order: int | float = 0.0#

The nesting order. Normally an integer; non-integer values have special meanings.

classmethod normalise(repeats)#

Generate from repeats descriptors specified in potentially several ways.

Parameters:

repeats (RepeatsDescriptorType)

Return type:

list[Self]

number: int#

Number of times to repeat the elements of the element set.

to_dict()#

Serialize this object as a dictionary.

Return type:

dict[str, Any]

to_json_like(dct=None, shared_data=None, exclude=(), path=None)#

Serialize this object as an object structure that can be trivially converted to JSON. Note that YAML can also be produced from the result of this method; it just requires a different final serialization step.

Parameters:
  • dct (dict[str, JSONable] | None)

  • shared_data (_JSONDeserState)

  • exclude (Container[str | None])

  • path (list | None)

Return type:

tuple[JSONDocument, _JSONDeserState]