    

 ## On this page

  

 

 # ExportCSVField&lt; TYPE &gt; Class Template Reference

 Last update: 16.07.2025 

Exports SoS field data to a CSV text file. [More...](class_export_c_s_v_field.xhtml#details)

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

virtual [check](class_export_c_s_v.xhtml#a43937566342ee4168150e9fa232ddfc1) () Checks some settings/preperations. [More...](#a43937566342ee4168150e9fa232ddfc1)  
  [ExportCSVField](class_export_c_s_v_field.xhtml#aaab2c56f0af0a15486ca2e077cc61348) ([Structure](class_structure.xhtml) [database](group__data.xhtml#gaebcac3a2836ec9fdf2e47bd812994b6b), string [output\_file](class_export_c_s_v.xhtml#a8643191a264f6d55fead82a6d23a88b6), [DataObjectContainer](class_data_object_container.xhtml) filter, string [delimiter](class_export_c_s_v.xhtml#a0b2e98e6d6483b285675f9e0128ad223)=",") Default constructor initializing all member variables to valid defaults. [More...](#aaab2c56f0af0a15486ca2e077cc61348)  
  [save](class_export_c_s_v_field.xhtml#a6a338dc4344270fcbccadf5667ef12f9) ([Structure](class_structure.xhtml) [database](group__data.xhtml#gaebcac3a2836ec9fdf2e47bd812994b6b)) Exports all data to the given csv output file. [More...](#a6a338dc4344270fcbccadf5667ef12f9)  
 ## <a name="pub-attribs"></a>Public Attributes

<a id="a0b2e98e6d6483b285675f9e0128ad223"></a>string [delimiter](class_export_c_s_v.xhtml#a0b2e98e6d6483b285675f9e0128ad223) The delimiter string, e.g. ",", which delimits the data entries within one line.   
 <a id="af22724fd9c1e0dd42ec296e4784b9df8"></a>[DataObjectContainer](class_data_object_container.xhtml) [field\_data](class_export_c_s_v_field.xhtml#af22724fd9c1e0dd42ec296e4784b9df8) The scalar object data to be exported.   
 <a id="a5681ad659e91643df77ee5bae59979c6"></a>bool [optiSLang\_compatibility](class_export_c_s_v.xhtml#a5681ad659e91643df77ee5bae59979c6) If this is true, then the idents of scalar-quantities will be modified to match allowed characters in optiSLang (default: false)   
 string [output\_file](class_export_c_s_v.xhtml#a8643191a264f6d55fead82a6d23a88b6) The name of the output file. Must be non-empty. [More...](#a8643191a264f6d55fead82a6d23a88b6)  
 std::vector&lt; [DataObjectKey](class_data_object_key.xhtml) &gt; [output\_order](class_export_c_s_v_field.xhtml#a7e4aabf64a404fcb5b6f86f0c44f76fb) A data object key vector used to define a output order different from the filter ones. [More...](#a7e4aabf64a404fcb5b6f86f0c44f76fb)  
 <a id="a2f8b3cba47ad64fb6bda4b6428a032d3"></a>bool [replace\_files](class_export_c_s_v.xhtml#a2f8b3cba47ad64fb6bda4b6428a032d3) If this is true, an existings output file will be overwritten. Otherwise an exception will arise (default: false)   
 <a id="a090c2ac1b8f5be786e0a09268ed48d0a"></a>bool [write\_indices](class_export_c_s_v_field.xhtml#a090c2ac1b8f5be786e0a09268ed48d0a) 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.



<a id="ab0df219856e56f118071aa086eff9893"></a>bool **write\_x\_coors** <a id="abeb22b2536fcd22ce7fd03c3204bb36c"></a>bool [write\_y\_coors](class_export_c_s_v_field.xhtml#abeb22b2536fcd22ce7fd03c3204bb36c) If this is true, than the y-coordinate will be written.   
 <a id="ad5df74233417485277f76e62d5bda57e"></a>bool [write\_z\_coors](class_export_c_s_v_field.xhtml#ad5df74233417485277f76e62d5bda57e) If this is true, than the z-coordinate will be written.   
 <a id="a7669f4acf97a6982ff3134585c6276eb"></a>bool [write\_header](class_export_c_s_v_field.xhtml#a7669f4acf97a6982ff3134585c6276eb) if this is true (default), then two header lines are written   
 <a id="details" name="details"></a>## Detailed Description

### template&lt;dataobject\_types TYPE&gt;  
class ExportCSVField&lt; TYPE &gt;

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](class_export_c_s_v_field.xhtml#af22724fd9c1e0dd42ec296e4784b9df8 "The scalar object data to be exported. "). Hence one can select the quantities to be exported. Currently, the exported CSV format contains 2 header lines and [a](group__tmath.xhtml#ga7e205066f67b9e3fd4c8cbd5859e8da3) [Data](group__data.xhtml "Provides functions and classes to control the central data structure. ") block (for this example [a](group__tmath.xhtml#ga7e205066f67b9e3fd4c8cbd5859e8da3) comma has been chosen as [delimiter](class_export_c_s_v.xhtml#a0b2e98e6d6483b285675f9e0128ad223 "The delimiter string, e.g. ",", which delimits the data entries within one line. ")):1. the quantity name in the first line ```
    [Indices,][Coordinates,]Quanties ...
    ```
2. 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 &amp; Destructor Documentation

<a id="aaab2c56f0af0a15486ca2e077cc61348"></a>## [◆ ](#aaab2c56f0af0a15486ca2e077cc61348)ExportCSVField()

 [ExportCSVField](class_export_c_s_v_field.xhtml)  ( [Structure](class_structure.xhtml)  *database*,    string  *output\_file*,    [DataObjectContainer](class_data_object_container.xhtml)  *filter*,    string  *delimiter* = `","`   ) 

Default constructor initializing all member variables to valid defaults.

Parameters databaseThe database needed to determine some defaults, i.e. , the mesh type to suggest defaults for needed coordindates - if any output\_fileThe name of the output file. See *output\_file* for detailed information. filterThe data type object filter with preselected objects to be written to the output\_file given delimiterThe delimiter string, e.g. ";", which delimits the data entries within the data sets. See csv::CSVParser::m\_delimiter for more details.Exceptions std::exceptionin case of conversion errors std::exception in case of program logical errors. Debug mode only 



## Member Function Documentation

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

 virtual check  ( )   virtualinherited 

Checks some settings/preperations.

Exceptions std::exceptionIf the settings are not correct 



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

 save  ( [Structure](class_structure.xhtml)  *database*)   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](class_export_c_s_v.xhtml#a8643191a264f6d55fead82a6d23a88b6 "The name of the output file. Must be non-empty. ") given

Parameters databaseThe database containing all objects. Exceptions std::exceptionIf the output path is not a directory std::exception If no the output\_file is not writeable Implements [ExportCSV](class_export_c_s_v.xhtml#a61c3eed0322cb79606e39957a8afe9d9).





## Member Data Documentation

<a id="a8643191a264f6d55fead82a6d23a88b6"></a>## [◆ ](#a8643191a264f6d55fead82a6d23a88b6)output\_file

 string 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](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





<a id="a7e4aabf64a404fcb5b6f86f0c44f76fb"></a>## [◆ ](#a7e4aabf64a404fcb5b6f86f0c44f76fb)output\_order

 std::vector&lt; [DataObjectKey](class_data_object_key.xhtml) &gt; 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.