ExportCSVField< TYPE > Class Template Reference
Last update: 16.07.2025Exports SoS field data to a CSV text file. More...
Public Member Functions | |
| virtual | check () |
| Checks some settings/preperations. More... | |
| ExportCSVField (Structure database, string output_file, DataObjectContainer filter, string delimiter=",") | |
| Default constructor initializing all member variables to valid defaults. More... | |
| save (Structure database) | |
| Exports all data to the given csv output file. More... | |
Public Attributes | |
| string | delimiter |
| The delimiter string, e.g. ",", which delimits the data entries within one line. | |
| DataObjectContainer | field_data |
| The scalar object data to be exported. | |
| bool | optiSLang_compatibility |
| If this is true, then the idents of scalar-quantities will be modified to match allowed characters in optiSLang (default: false) | |
| string | output_file |
| The name of the output file. Must be non-empty. More... | |
| std::vector< DataObjectKey > | output_order |
| A data object key vector used to define a output order different from the filter ones. More... | |
| bool | replace_files |
| If this is true, an existings output file will be overwritten. Otherwise an exception will arise (default: false) | |
| bool | write_indices |
| Writes the indices before each data set (default: true) | |
Control coordinates | |
If this is true, than the x-coordinate will be written If the members of this group are set to true they will be written after the optional design number. Dependent on the data type, the coordinates written differ, i.e. coordinates for nodes and integration points are obvious but for element data types the element midpoint will be described by the coordinates written. | |
| bool | write_x_coors |
| bool | write_y_coors |
| If this is true, than the y-coordinate will be written. | |
| bool | write_z_coors |
| If this is true, than the z-coordinate will be written. | |
| bool | write_header |
| if this is true (default), then two header lines are written | |
Detailed Description
template<dataobject_types TYPE>
class ExportCSVField< TYPE >
Exports SoS field data to a CSV text file.
When determining the number of designs and quantities to be exported, the method only considers those type objects which are part of
- See also
- ExportCSVField::field_data. Hence one can select the quantities to be exported. Currently, the exported CSV format contains 2 header lines and a Data block (for this example a comma has been chosen as delimiter):
- the quantity name in the first line
[Indices,][Coordinates,]Quanties ...
- the ID's followed by the design idents in the second line
[part-ID,][type-master-ID,][type-ID,]design-IDs ...
The part-ID will be exported only in case of several part definitions whereas a type-master-ID will be written as needed, i.e. for integration point data export 3.-* the data in all subsequent lines till EOF(!)[integers, ... ]number, number, ...
Constructor & Destructor Documentation
◆ ExportCSVField()
| ExportCSVField | ( | Structure | database, |
| string | output_file, | ||
| DataObjectContainer | filter, | ||
| string | delimiter = "," |
||
| ) |
Default constructor initializing all member variables to valid defaults.
- Parameters
-
database The database needed to determine some defaults, i.e. , the mesh type to suggest defaults for needed coordindates - if any output_file The name of the output file. See output_file for detailed information. filter The data type object filter with preselected objects to be written to the output_file given delimiter The delimiter string, e.g. ";", which delimits the data entries within the data sets. See csv::CSVParser::m_delimiter for more details.
- Exceptions
-
std::exception in case of conversion errors std::exception in case of program logical errors. Debug mode only
Member Function Documentation
◆ check()
|
virtualinherited |
Checks some settings/preperations.
- Exceptions
-
std::exception If the settings are not correct
◆ save()
|
virtual |
Exports all data to the given csv output file.
If all member variables are empty all objects in the database will be exported. Otherwise the member variables acts as filter and only listed data will be extracted out of the database given and exported to the CSV file output_file given
- Parameters
-
database The database containing all objects.
- Exceptions
-
std::exception If the output path is not a directory std::exception If no the output_file is not writeable
Implements ExportCSV.
Member Data Documentation
◆ output_file
|
inherited |
The name of the output file. Must be non-empty.
Several modes in several situations are supported:
- The string points to a non-existing FS item:
- The Settings class tries to split up the path given in its components: parent_path, filename (boost::filesystem::stem) and file extension (boost::filesystem::extension) as described in the underlying FS library http://www.boost.org/doc/libs/1_53_0/libs/filesystem/doc/reference.html#Path-decomposition-table
- Non given components will be replaced by default ones and created if neccessary
◆ output_order
| std::vector< DataObjectKey > output_order |
A data object key vector used to define a output order different from the filter ones.
Defines the data output order written after other optional data like indices and coordinates The size of the output_order container may be different from the size of the data type dependent filter given. Even the IDs in the output_order container given may be missing in one or all data type filters. If the size of the output_order container is:
- smaller than the size of all unique ID's of the data type filter given, than the filter ID's matching the ID's in the output_order will be reorderd as defined by the output_order container. ID's that exist in the filter only are silently appended.
- bigger than the size of all unique ID's of the data type filter given, than the filter ID's matching the ID's in the output_order will be reorderd as defined by the output_order container. ID's that exist in the output_order container only are ignored.
- zero, if the output_order container is empty, than the data output order is defined by the return values of the filter iterators If the output_order vector contains number entries than only the first match will be written.