generate_points#

TwinModel.generate_points(rom_name, on_disk=True, named_selection=None)#

Generate a points file either in memory or on disk, for the full domain or a specific part. It returns the points data as an array if in memory, or the path of the points file written on disk.

Parameters:
rom_name: str

Name of the TBROM considered to generate the point file.

on_disk: bool

Whether the point file is saved on disk (True) or returned in memory (False).

named_selection: str (optional)

Named selection on which the point file has to be generated.

Returns:
str | np.ndarray

Path to points file written to disk if on_disk == True, else array of points data

Raises:
TwinModelError:

If TwinModel object has not been initialized. If rom_name is not included in the Twin’s list of TBROM If the TBROM does not have any point file available If name_selection is not included in the TBROM’s list of Named Selections

Examples

>>> from pytwin import TwinModel
>>> # Instantiate a twin model, initialize it, and evaluate it step by step until you want to save its state
>>> model1 = TwinModel('model.twin')
>>> model1.initialize_evaluation()
>>> romname = model1.tbrom_names[0]
>>> nslist = model1.get_named_selections(romname)
>>> points = model1.generate_points(romname, False, nslist[0])