ImportDesigns Class Reference
Last update: 16.07.2025A class collecting import information for various design directories. More...
Public Member Functions | |
| check (Structure database) | |
| Checks validity of these data. More... | |
| filterDesignsByOptiSLang (string filename) | |
| reads the given optiSLang binary file and removes all design numbers which are marked as 'failed' More... | |
| TUIntVector | getDesignNumbers () |
| Generates a list of all design sample numbers. More... | |
| string | getDesignNumbersString () |
| generates the defined design range intervals as a string More... | |
| DataObjectContainer::string_vector_type | getDesignPathNames () |
| generates a list of all design directory path names More... | |
| import (Structure database) | |
| imports multiple designs from disk This method tries to import as much data as possible and does even proceed in case of errors. More... | |
| ImportDesigns (ReferenceDesign reference_design) | |
| Initializes defaults and starts a first filesystem scan. More... | |
| scanDesignRanges () | |
| Scans the base path for design directories. More... | |
| setDesignNumbers (string design_ranges) | |
| Sets the design number intervals given as string The method calls unifyDesignNumbers(); to ensure uniqueness of the defined design numbers. More... | |
| unifyDesignNumbers () | |
| Unifies the design numbers This method ensures that each design number appears at most once in the design interval definition. | |
Public Attributes | |
| string | base_path |
| Base path (absolute path) | |
| string | design_name_format |
| Format string for identifying design directories. More... | |
| int | max_num_threads |
| If set to 0 (default=4), then multiple designs may be imported in parallel using the default OpenMP settings. Else each design is imported using the defined number of threads. | |
| TUIntVector | ranges_from |
| Defines ranges of the design directories, specifically the left interval boundaries. | |
| TUIntVector | ranges_to |
| Defines ranges of the design directories, specifically the right interval boundaries. More... | |
| ReferenceDesign | reference_design |
| Stores the information on the reference design/design template (defines which data to be imported) | |
| number | start_design_number |
| Associates the start design number to the specified design ranges. More... | |
Detailed Description
A class collecting import information for various design directories.
In a typical SoS workflow the user imports varying outcomes of a repeated experiment. These outcome needs to be saved somewhere, and as SoS orgins the Post-optiSLang area, the program expects this data stored in several directories. Each directory contains at least one file which contains one or several outcome(s) of one of specific experiment. While its expected that the directory name varies for each experiment, the filenames must be constant. At best, the design directory name contains a number which might be directly used by SoS on import to insert the outcomes into its database with a unique design number ident.
Constructor & Destructor Documentation
◆ ImportDesigns()
| ImportDesigns | ( | ReferenceDesign | reference_design | ) |
Initializes defaults and starts a first filesystem scan.
At first, the constructor tries to generate a suiteable base path and design template string:
- Usually, the ReferenceDesign object will contain at least one file to be imported. If this is the case, its completed file path will be analyzed using the #DesignPath object. At best, this analysis will return a reliable base_path as well as design_name_format.
- Otherwise the ReferenceDesign::base_path of reference_design given will be separated. Its parent path will be re-used as base_path and the other part as design_name_format Afterwards, ImportDesigns::scanDesignRanges() will be called automatically and the first design range number re-used as start design ident. Otherise, the design ranges remain empty and the ImportDesigns::start_design_number will be initialized to one.
- Parameters
-
reference_design The reference design object
Member Function Documentation
◆ check()
| check | ( | Structure | database | ) |
Checks validity of these data.
- If any of the specified directories, design IDs or files does not exist, an exception is thrown
- It also checks the validity of the reference design
- Parameters
-
database the data base where the data is going to be imported to
◆ filterDesignsByOptiSLang()
| filterDesignsByOptiSLang | ( | string | filename | ) |
reads the given optiSLang binary file and removes all design numbers which are marked as 'failed'
- Parameters
-
filename the optiSLang file name, either absolute path or relative to the reference design
◆ getDesignNumbers()
| TUIntVector getDesignNumbers | ( | ) |
Generates a list of all design sample numbers.
- Returns
- A vector of integer numbers where each number represents the design identifier used in the SoS database. The vector indices correspond to the vector of ImportDesigns::getDesignPathNames
◆ getDesignNumbersString()
| string getDesignNumbersString | ( | ) |
generates the defined design range intervals as a string
- Returns
- the design range string, eg. "1-4;6-10;12;15-20"
◆ getDesignPathNames()
| DataObjectContainer::string_vector_type getDesignPathNames | ( | ) |
generates a list of all design directory path names
- Returns
- A vector of strings where each string represents the design path name. Each path name is a valid directory name (already includes the base_path).
◆ import()
| import | ( | Structure | database | ) |
imports multiple designs from disk This method tries to import as much data as possible and does even proceed in case of errors.
- Parameters
-
database the data base where all data is to be added
◆ scanDesignRanges()
| scanDesignRanges | ( | ) |
Scans the base path for design directories.
Depending on the currently storred information (base path, design name properties, defined files in the reference design) the design directories are determined and the ranges of the indicies are stored in ranges_from and ranges_to. Only design directories are accepted which contain ALL of the files being contained in the reference path!
◆ setDesignNumbers()
| setDesignNumbers | ( | string | design_ranges | ) |
Sets the design number intervals given as string The method calls unifyDesignNumbers(); to ensure uniqueness of the defined design numbers.
- Parameters
-
design_ranges The string to be interpreted, must be of format "1-4;12;15-20;" or "1-4" or "1" or "".
- Exceptions
-
an exception If the string can not be interpreted. In this case, the definition is not changed.
Member Data Documentation
◆ design_name_format
| string design_name_format |
Format string for identifying design directories.
Format strings shall be defined as Perl Regular Expressions including one sub-expression which defines the design ID, eg.
which matches the string Design, followed by one or no underscore and a sub-expression of one or more digits until the end of the string. The digit group will be used as unique design number within the database. Other examples might be
which expects exactly 2 digits, or
which matches the directory 'first' relative to base_path, any of its subdirectories, a Design directory consisting of one or 5 digits (zero should be avoided as internal design numbers must be generated in that case), an ANSYS dp subdirectory composed of the dp string followed by exactly 2 digits and as last acceptable subdirectory the string mech. For further common pittfalls - like the maximum sub directory level - refer to DesignScanner::filter ( string )
◆ ranges_to
| TUIntVector ranges_to |
Defines ranges of the design directories, specifically the right interval boundaries.
Must have the same dimensions as #ImportDesings::ranges_from
◆ start_design_number
| number start_design_number |
Associates the start design number to the specified design ranges.
This member offers the possibility to control the design number range associated to the imported designs. For example, for some reason it might be necessary to import the same design range twice into SoS. So the first time the user simply accepts the design directory deduced design number suggestion, but on the second run the user decides to import the same design with an arbitrary chosen start design number. The design number range used on import preserves any range definition on the the design directory range side. In other words, holes within the design directory ranges will be reprocuded. For example, the design directory range '1;5-10;12;14-100' with a start_design_number set to 200 leads to the following used design number range on import '200;204-209;211;213-299'