    

 ## On this page

  

 

 # PrepareRandomFieldSimulation Class Reference

 Last update: 16.07.2025 

A struct collecting export information for random field simulation data. [More...](class_prepare_random_field_simulation.xhtml#details)

## <a name="pub-methods"></a>Public Member Functions

 [check](class_prepare_random_field_simulation.xhtml#a47c34ec1e578c2ce27cf1c5fcd0d1704) ([Structure](class_structure.xhtml) [database](group__data.xhtml#gaebcac3a2836ec9fdf2e47bd812994b6b)) Checks validity of these data. [More...](#a47c34ec1e578c2ce27cf1c5fcd0d1704)  
 bool [outputFilesExisting](class_prepare_random_field_simulation.xhtml#a5000ee7f35b6c3e27e53abb74606bcd9) () const  [PrepareRandomFieldSimulation](class_prepare_random_field_simulation.xhtml#a522849241fbd36947ee40611988666da) ([ExportReferenceDesign](class_export_reference_design.xhtml) [reference\_design](class_prepare_random_field_simulation.xhtml#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 [More...](#a522849241fbd36947ee40611988666da)  
  [save](class_prepare_random_field_simulation.xhtml#a6a338dc4344270fcbccadf5667ef12f9) ([Structure](class_structure.xhtml) [database](group__data.xhtml#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. [More...](#a6a338dc4344270fcbccadf5667ef12f9)  
 ## <a name="pub-attribs"></a>Public Attributes

string [csv\_parameter\_file](class_prepare_random_field_simulation.xhtml#ab9e0aa24db8d743c8610bdcfe612e5b5) the file name of the CSV file containing the amplitudes (relative to [More...](#ab9e0aa24db8d743c8610bdcfe612e5b5)  
 string [database\_file](class_prepare_random_field_simulation.xhtml#a90c11fb8a955197d99f5dfc621bd2856) the file name of the database that stores the simulation data (relative to [More...](#a90c11fb8a955197d99f5dfc621bd2856)  
 string [filelist\_file](class_prepare_random_field_simulation.xhtml#a4222b2d75034eec2b585fafb14bbfb03) the file name of the text file that contains the list of files to be modified (relative to [More...](#a4222b2d75034eec2b585fafb14bbfb03)  
 string [new\_filelist\_file](class_prepare_random_field_simulation.xhtml#a057f3aa803177ac7707da6a4c8a6153c) the file name of the text file that contains the list of files to be created (relative to [More...](#a057f3aa803177ac7707da6a4c8a6153c)  
 <a id="a46c20eb2a26abeb1e934cd66e1dd6484"></a>string [path](class_prepare_random_field_simulation.xhtml#a46c20eb2a26abeb1e934cd66e1dd6484) path (absolute path)   
 <a id="acf3a932aa2f8b555c1a254385c014629"></a>[ExportReferenceDesign](class_export_reference_design.xhtml) [reference\_design](class_prepare_random_field_simulation.xhtml#acf3a932aa2f8b555c1a254385c014629) stores the information on the reference design/design directory template (defines which data to be exported)   
 <a id="a2f8b3cba47ad64fb6bda4b6428a032d3"></a>bool [replace\_files](class_prepare_random_field_simulation.xhtml#a2f8b3cba47ad64fb6bda4b6428a032d3) if true, already existing files are to be replaced   
 string [script\_file](class_prepare_random_field_simulation.xhtml#a586bce376efc55f8678878ee594446f4) the file name of the script to be executed for each design directory (relative to [More...](#a586bce376efc55f8678878ee594446f4)  
 string [test\_run\_path](class_prepare_random_field_simulation.xhtml#af033bf10e916683e009f2cdd9e2c5810) defines the design directory name which is used for test runs (do nothing if empty). Ss relative to [More...](#af033bf10e916683e009f2cdd9e2c5810)  
 <a id="details" name="details"></a>## 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 &amp; Destructor Documentation

<a id="a522849241fbd36947ee40611988666da"></a>## [◆ ](#a522849241fbd36947ee40611988666da)PrepareRandomFieldSimulation()

 [PrepareRandomFieldSimulation](class_prepare_random_field_simulation.xhtml)  ( [ExportReferenceDesign](class_export_reference_design.xhtml)  *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 reference\_designcontains info on the reference export design the\_pathdefines the output path 



## Member Function Documentation

<a id="a47c34ec1e578c2ce27cf1c5fcd0d1704"></a>## [◆ ](#a47c34ec1e578c2ce27cf1c5fcd0d1704)check()

 check  ( [Structure](class_structure.xhtml)  *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 databasethe data base where the data is stored 



<a id="a5000ee7f35b6c3e27e53abb74606bcd9"></a>## [◆ ](#a5000ee7f35b6c3e27e53abb74606bcd9)outputFilesExisting()

 bool outputFilesExisting  ( )  const

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



<a id="a6a338dc4344270fcbccadf5667ef12f9"></a>## [◆ ](#a6a338dc4344270fcbccadf5667ef12f9)save()

 save  ( [Structure](class_structure.xhtml)  *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 databasethe data base where all data is contained. 



## Member Data Documentation

<a id="ab9e0aa24db8d743c8610bdcfe612e5b5"></a>## [◆ ](#ab9e0aa24db8d743c8610bdcfe612e5b5)csv\_parameter\_file

 string csv\_parameter\_file

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

See also[path](class_prepare_random_field_simulation.xhtml#a46c20eb2a26abeb1e934cd66e1dd6484 "path (absolute path) ")) 



<a id="a90c11fb8a955197d99f5dfc621bd2856"></a>## [◆ ](#a90c11fb8a955197d99f5dfc621bd2856)database\_file

 string database\_file

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

See also[path](class_prepare_random_field_simulation.xhtml#a46c20eb2a26abeb1e934cd66e1dd6484 "path (absolute path) ")) 



<a id="a4222b2d75034eec2b585fafb14bbfb03"></a>## [◆ ](#a4222b2d75034eec2b585fafb14bbfb03)filelist\_file

 string filelist\_file

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

See also[path](class_prepare_random_field_simulation.xhtml#a46c20eb2a26abeb1e934cd66e1dd6484 "path (absolute path) ")) 



<a id="a057f3aa803177ac7707da6a4c8a6153c"></a>## [◆ ](#a057f3aa803177ac7707da6a4c8a6153c)new\_filelist\_file

 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](class_prepare_random_field_simulation.xhtml#a46c20eb2a26abeb1e934cd66e1dd6484 "path (absolute path) ")) 



<a id="a586bce376efc55f8678878ee594446f4"></a>## [◆ ](#a586bce376efc55f8678878ee594446f4)script\_file

 string script\_file

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

See also[path](class_prepare_random_field_simulation.xhtml#a46c20eb2a26abeb1e934cd66e1dd6484 "path (absolute path) ")) 



<a id="af033bf10e916683e009f2cdd9e2c5810"></a>## [◆ ](#af033bf10e916683e009f2cdd9e2c5810)test\_run\_path

 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](class_prepare_random_field_simulation.xhtml#a46c20eb2a26abeb1e934cd66e1dd6484 "path (absolute path) "). Default: "Design0001".