> ## Documentation Index
> Fetch the complete documentation index at: https://developer.synopsys.com/llms.txt
> Use this file to discover all available pages before exploring further.

# PrepareRandomFieldSimulation Class Reference

Part of [Import](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/group__import)

A struct collecting export information for random field simulation data.

## Public Member Functions

| Type | Name |
| - | - |
| | [check](#a47c34ec1e578c2ce27cf1c5fcd0d1704) ([Structure](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_structure) [database](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/group__data#gaebcac3a2836ec9fdf2e47bd812994b6b)) Checks validity of these data. |
| bool | [outputFilesExisting](#a5000ee7f35b6c3e27e53abb74606bcd9) () const |
| | [PrepareRandomFieldSimulation](#a522849241fbd36947ee40611988666da) ([ExportReferenceDesign](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_export_reference_design.md) [reference\_design](#acf3a932aa2f8b555c1a254385c014629), string the\_path) constructor. It assumes that the base path is one directory level below the base path of the reference design. It further assumes a default for the design directory names and copies the information on the reference design |
| | [save](#a6a338dc4344270fcbccadf5667ef12f9) ([Structure](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_structure) [database](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/group__data#gaebcac3a2836ec9fdf2e47bd812994b6b)) exports multiple designs to disk This method tries to export as much data as possible and does even proceed in case of errors. Important: the design directories to be exported to must already exist. |

## Public Attributes

| Type | Name |
| - | - |
| string | [csv\_parameter\_file](#ab9e0aa24db8d743c8610bdcfe612e5b5) the file name of the CSV file containing the amplitudes (relative to |
| string | [database\_file](#a90c11fb8a955197d99f5dfc621bd2856) the file name of the database that stores the simulation data (relative to |
| string | [filelist\_file](#a4222b2d75034eec2b585fafb14bbfb03) the file name of the text file that contains the list of files to be modified (relative to |
| string | [new\_filelist\_file](#a057f3aa803177ac7707da6a4c8a6153c) the file name of the text file that contains the list of files to be created (relative to |
|  string | [path](#a46c20eb2a26abeb1e934cd66e1dd6484) path (absolute path) |
| [ExportReferenceDesign](https://developer.synopsys.com/docs/optislang/optislang-3d-postprocessing-script-api/class_export_reference_design.md) | [reference\_design](#acf3a932aa2f8b555c1a254385c014629) stores the information on the reference design/design directory template (defines which data to be exported) |
|  bool | [replace\_files](#a2f8b3cba47ad64fb6bda4b6428a032d3) if true, already existing files are to be replaced |
| string | [script\_file](#a586bce376efc55f8678878ee594446f4) the file name of the script to be executed for each design directory (relative to |
| string | [test\_run\_path](#af033bf10e916683e009f2cdd9e2c5810) defines the design directory name which is used for test runs (do nothing if empty). Ss relative to |

## Detailed Description

A struct collecting export information for random field simulation data.

The idea is the following:

* The user generates all data required for simulating a random field in SoS. Example:

  * Import simulation responses from a robustness sampling
  * Perform Karhunen-Loeve expansion: Create amplitudes, create scatter shapes, create shape\_mean and local error vectors
* SoS selects those amplitudes the user wants to use for random field generation
* SoS exports data to optiSLang:

  * a CSV file containing the amplitudes (needed by optiSLang to estimate the statistical properties of the amplitudes)
  * a SDB file that contains the reference mesh and a few data objects (the minimum set of required objects to generate field objects from given amplitudes). These are essentially scatter shapes and mean value vectors
  * a script file that is called by optiSLang for each design.
  * a text file that lists the files required for export: The first row denotes the base\_path of the reference design. All other rows denote a filename (relative to the design path) which is required by the field data exporter. These file names are relative to the reference path.
* optiSLang then calls for each design:

  * For each design given: the design number, the design path, path to SDB database, path to a csv file that contains the values of the amplitudes of this design (the CSV file only contains 2 rows. first row: amplitude idents; second row: the amplitude values, separated by a comma (",") ).
  * the script then generates the field quantities and exports them using previously defined export definition data...

    * It expects that the design path contains all field data files to be modified. Further it still assumes that the original reference path (for export definition) still exists.

To read a more detailed workflow with examples and so on refer to SectionAutomatedSimulationOfRandomFields .

## Constructor & Destructor Documentation

### PrepareRandomFieldSimulation()

```cpp theme={null}
PrepareRandomFieldSimulation(
    ExportReferenceDesign reference_design,
    string the_path
)
```

constructor. It assumes that the base path is one directory level below the base path of the reference design. It further assumes a default for the design directory names and copies the information on the reference design

**Parameters**

| Name | Description |
| - | - |
| reference\_design | contains info on the reference export design |
| the\_path | defines the output path |

## Member Function Documentation

### check()

```cpp theme={null}
check(Structure database)
```

Checks validity of these data.

If any of the specified directories or files does not exist, an exception is thrown It also checks the validity of the reference design It further checks if any of the objects to be exported does not exist. And if the scalar data contain valid amplitudes

**Parameters**

| Name | Description |
| - | - |
| database | the data base where the data is stored |

### outputFilesExisting()

```cpp theme={null}
bool outputFilesExisting() const
```

**Returns**

true if at least one of the output files are existing.

### save()

```cpp theme={null}
save(Structure database)
```

exports multiple designs to disk This method tries to export as much data as possible and does even proceed in case of errors. Important: the design directories to be exported to must already exist.

**Parameters**

| Name | Description |
| - | - |
| database | the data base where all data is contained. |

## Member Data Documentation

### csv\_parameter\_file

```cpp theme={null}
string csv_parameter_file
```

the file name of the CSV file containing the amplitudes (relative to

**See also**

[path](#a46c20eb2a26abeb1e934cd66e1dd6484))

### database\_file

```cpp theme={null}
string database_file
```

the file name of the database that stores the simulation data (relative to

**See also**

[path](#a46c20eb2a26abeb1e934cd66e1dd6484))

### filelist\_file

```cpp theme={null}
string filelist_file
```

the file name of the text file that contains the list of files to be modified (relative to

**See also**

[path](#a46c20eb2a26abeb1e934cd66e1dd6484))

### new\_filelist\_file

```cpp theme={null}
string new_filelist_file
```

the file name of the text file that contains the list of files to be created (relative to

**See also**

[path](#a46c20eb2a26abeb1e934cd66e1dd6484))

### script\_file

```cpp theme={null}
string script_file
```

the file name of the script to be executed for each design directory (relative to

**See also**

[path](#a46c20eb2a26abeb1e934cd66e1dd6484))

### test\_run\_path

```cpp theme={null}
string test_run_path
```

defines the design directory name which is used for test runs (do nothing if empty). Ss relative to

**See also**

[path](#a46c20eb2a26abeb1e934cd66e1dd6484). Default: "Design0001".
