    

 ## On this page

  

 

 # DataExport

 Last update: 16.07.2025 

Examples creating entites and importing or exporting from or to specific formats.

//

// COPYRIGHT ANSYS. ALL RIGHTS RESERVED.

//

\#include "dpf\_api.h"

\#include "helpers/dpf\_result.h"

\#include "helpers/dpf\_model.h"

\#include &lt;limits&gt;

\#ifdef EXAMPLE

\#include "Example.h"

\#else

\#include &lt;gtest/gtest.h&gt;

\#endif

 

// TemporaryDirectory

\#include &lt;boost/filesystem.hpp&gt;

\#include &lt;boost/dll.hpp&gt;

\#include &lt;thread&gt;

\#include &lt;sstream&gt;

 

struct DataExportTempDir

{

private: 

 boost::filesystem::path _result_path;

 

public:

 DataExportTempDir()

 {

 std::ostringstream ss;

 ss &lt;&lt; std::this_thread::get_id();

 boost::filesystem::path program_loc = boost::dll::program_location().parent_path();

 program_loc /= ("DpfData" + ss.str());

 if (!boost::filesystem::exists(program_loc))

 boost::filesystem::create_directories(program_loc);

 _result_path = program_loc;

 }

 ~DataExportTempDir()

 {

 clear();

 }

 

 void clear()

 {

 if (boost::filesystem::exists(_result_path))

 boost::filesystem::remove_all(_result_path);

 }

 

 std::string getTempFile(std::string const&amp; name) const

 {

 return (_result_path / name).string();

 }

};

 

TEST(CreateAndExport, CreateEntitesAndHdf5Export)

{

 /\*

 You can create your field, fields container, or meshed region, to use in DPF operators, with your own data.

 These entities can then be exported into HDF5 format, that can be re-opened in another process.

 \*/

 

 <a id="_a0" name="_a0"></a>[ansys::dpf::LabelSpace](classansys_1_1dpf_1_1LabelSpace.xhtml) label_space_1 = { { <a id="a1" name="a1"></a>[ansys::dpf::labels::time](structansys_1_1dpf_1_1labels.xhtml#a22ee1a5e3be8ad98c20c5ca52e247914), 1 } };

 [ansys::dpf::LabelSpace](classansys_1_1dpf_1_1LabelSpace.xhtml) label_space_2 = { { [ansys::dpf::labels::time](structansys_1_1dpf_1_1labels.xhtml#a22ee1a5e3be8ad98c20c5ca52e247914), 2 } };

 [ansys::dpf::LabelSpace](classansys_1_1dpf_1_1LabelSpace.xhtml) label_space_3 = { { [ansys::dpf::labels::time](structansys_1_1dpf_1_1labels.xhtml#a22ee1a5e3be8ad98c20c5ca52e247914), 3 } };

 int numNodes = 9;

 int numElements = 3;

 <a id="_a2" name="_a2"></a>[ansys::dpf::MeshedRegion](classansys_1_1dpf_1_1MeshedRegion.xhtml) mesh;

 <a id="_a3" name="_a3"></a>[ansys::dpf::TimeFreqSupport](classansys_1_1dpf_1_1TimeFreqSupport.xhtml) time_freq_support;

 <a id="_a4" name="_a4"></a>[ansys::dpf::FieldsContainer](classansys_1_1dpf_1_1FieldsContainer.xhtml) fc_disp;

 [ansys::dpf::FieldsContainer](classansys_1_1dpf_1_1FieldsContainer.xhtml) fc_stress;

 <a id="_a5" name="_a5"></a>[ansys::dpf::MeshesContainer](classansys_1_1dpf_1_1MeshesContainer.xhtml) meshes;

 <a id="_a6" name="_a6"></a>[ansys::dpf::DataSources](classansys_1_1dpf_1_1DataSources.xhtml) hdf5_ds;

 

 // set the result folder path to the right path

 DataExportTempDir temp_dir;

 

 // 1. Create a new mesh with 1 quad, 1 point element and 1 tetra

 // -------------------------------------------------------------

 {

 mesh.<a id="a7" name="a7"></a>[prepareConstruction](classansys_1_1dpf_1_1MeshedRegion.xhtml#aa7b984923ddd90379f08bc5b9831a95e)(numNodes, numElements); //reserve the size of the mesh

 mesh.<a id="a8" name="a8"></a>[setLengthUnit](classansys_1_1dpf_1_1MeshedRegion.xhtml#a638d38d0400a6c64b85082a4c4beb105)(<a id="_a9" name="_a9"></a>[ansys::dpf::Unit](classansys_1_1dpf_1_1Unit.xhtml)("m"));

 

 //quad element with 4 nodes

 mesh.<a id="a10" name="a10"></a>[addNode](classansys_1_1dpf_1_1MeshedRegion.xhtml#a2b4891674d74a792b63318c305963500)(1, { 0.0, 0.0, 0.0 });

 mesh.[addNode](classansys_1_1dpf_1_1MeshedRegion.xhtml#a2b4891674d74a792b63318c305963500)(2, { 1.0, 0.0, 0.0 });

 mesh.[addNode](classansys_1_1dpf_1_1MeshedRegion.xhtml#a2b4891674d74a792b63318c305963500)(3, { 1.0, 1.0, 0.0 });

 mesh.[addNode](classansys_1_1dpf_1_1MeshedRegion.xhtml#a2b4891674d74a792b63318c305963500)(4, { 0.0, 1.0, 0.0 });

 mesh.<a id="a11" name="a11"></a>[addElement](classansys_1_1dpf_1_1MeshedRegion.xhtml#a11b6e06dfea398609fa9fb25ad4333bb)(<a id="a12" name="a12"></a>[ansys::dpf::elements::quadShell4](structansys_1_1dpf_1_1elements.xhtml#ac9194bac632c648b744f96a2306b428b), 1, { 0, 1, 2, 3 }); // connectivity is by node indexes

 

 //point element

 mesh.[addNode](classansys_1_1dpf_1_1MeshedRegion.xhtml#a2b4891674d74a792b63318c305963500)(5, { 0.0, 0.0, 0.0 });

 mesh.[addElement](classansys_1_1dpf_1_1MeshedRegion.xhtml#a11b6e06dfea398609fa9fb25ad4333bb)(<a id="a13" name="a13"></a>[ansys::dpf::elements::point1](structansys_1_1dpf_1_1elements.xhtml#a42c776bd25670e7ca0c2cc9fc91e2829), 2, { 4 });

 

 //tetra element with 4 nodes

 mesh.[addNode](classansys_1_1dpf_1_1MeshedRegion.xhtml#a2b4891674d74a792b63318c305963500)(6, { 0.0, 0.0, 0.0 });

 mesh.[addNode](classansys_1_1dpf_1_1MeshedRegion.xhtml#a2b4891674d74a792b63318c305963500)(7, { 1.0, 0.0, 0.0 });

 mesh.[addNode](classansys_1_1dpf_1_1MeshedRegion.xhtml#a2b4891674d74a792b63318c305963500)(8, { 1.0, 1.0, 0.0 });

 mesh.[addNode](classansys_1_1dpf_1_1MeshedRegion.xhtml#a2b4891674d74a792b63318c305963500)(9, { 0.0, 1.0, 1.0 });

 mesh.[addElement](classansys_1_1dpf_1_1MeshedRegion.xhtml#a11b6e06dfea398609fa9fb25ad4333bb)(<a id="a14" name="a14"></a>[ansys::dpf::elements::tet4](structansys_1_1dpf_1_1elements.xhtml#a05d59369acd4f4ac6819645f2413ee22), 4, { 5, 6, 7, 8 });

 

 // Access the mesh information

 mesh.<a id="a15" name="a15"></a>[nodeScoping](classansys_1_1dpf_1_1MeshedRegion.xhtml#ad5df08993b7c588d9565ef1c1ea4813d)().<a id="a16" name="a16"></a>[size](classansys_1_1dpf_1_1Scoping.xhtml#aeae5e27bd752bdf0da3cc2d64fbe118a)();

 //return:

 //11

 mesh.<a id="a17" name="a17"></a>[elementScoping](classansys_1_1dpf_1_1MeshedRegion.xhtml#a3056a0fc6d69ca8769e33de6be0cecf0)().[size](classansys_1_1dpf_1_1Scoping.xhtml#aeae5e27bd752bdf0da3cc2d64fbe118a)();

 //return:

 //4

 }

 

 // 2. Create time freq support to describe the time frequencies information

 // ------------------------------------------------------------------------

 {

 <a id="_a18" name="_a18"></a>[ansys::dpf::Field](classansys_1_1dpf_1_1Field.xhtml) time_freq(3, { 1 }, <a id="a19" name="a19"></a>[ansys::dpf::locations::time\_set](structansys_1_1dpf_1_1locations.xhtml#a3cf1bbc2ad6d8b8f6173e83b5118031a));

 time_freq.<a id="a20" name="a20"></a>[scoping](classansys_1_1dpf_1_1Field.xhtml#aa16920741c1432c16e46ec6da26b3f04)().<a id="a21" name="a21"></a>[setIds](classansys_1_1dpf_1_1Scoping.xhtml#a021a022f87287b786ff9b3c92deb0e69)({ 1, 2, 3 });

 time_freq.scoping().setLocation(<a id="a22" name="a22"></a>[ansys::dpf::locations::time\_step](structansys_1_1dpf_1_1locations.xhtml#abc48364ef6b184ddf696099c9a2993cd));

 time_freq.setData({ 0.1, 0.21, 0.2 });

 

 // set the time\_freq\_support fields

 time_freq_support.<a id="a23" name="a23"></a>[setTimeFrequencies](classansys_1_1dpf_1_1TimeFreqSupport.xhtml#aa01a23bf27be8e42ce3ec1da5e0ddcbe)(time_freq);

 }

 

 // 3. Create nodal displacement FieldContainer for 3 time steps

 // ------------------------------------------------------------

 /\*

 Create displacement fields over time with three time sets. For the first time set, the displacement 

 on each node is the value of its x, y, and z coordinates. For the second time set, the displacement 

 on each node is two times the value of its x, y, and z coordinates. For the third time set, the 

 displacement on each node is three times the value of its x, y, and z coordinates.

 \*/

 {

 [ansys::dpf::Field](classansys_1_1dpf_1_1Field.xhtml) coordinates_field = mesh.<a id="a24" name="a24"></a>[nodesCoordinates](classansys_1_1dpf_1_1MeshedRegion.xhtml#a482ae171f257bfe86c8e567f0882caa4)();

 <a id="_a25" name="_a25"></a>[ansys::dpf::Operator](classansys_1_1dpf_1_1Operator.xhtml) add("add");

 add.connect(0, coordinates_field);

 add.connect(1, coordinates_field);

 [ansys::dpf::Field](classansys_1_1dpf_1_1Field.xhtml) coordinates_x_2 = add.getOutputField(0);

 add.connect(1, coordinates_x_2);

 [ansys::dpf::Field](classansys_1_1dpf_1_1Field.xhtml) coordinates_x_3 = add.getOutputField(0);

 

 <a id="_a26" name="_a26"></a>[ansys::dpf::FieldDefinition](classansys_1_1dpf_1_1FieldDefinition.xhtml) fieldDef = coordinates_field.<a id="a27" name="a27"></a>[fieldDefinition](classansys_1_1dpf_1_1Field.xhtml#a860e65caa16f612746ad116429282fd3)();

 fieldDef.<a id="a28" name="a28"></a>[setUnit](classansys_1_1dpf_1_1FieldDefinition.xhtml#a8033b1d4486ea3d819ecbb6418bab079)(mesh.<a id="a29" name="a29"></a>[lengthUnit](classansys_1_1dpf_1_1MeshedRegion.xhtml#aed167b03463f42d94d424797529eccad)());

 

 // fill whole data in once

 [ansys::dpf::Field](classansys_1_1dpf_1_1Field.xhtml) time_1_disp_data(numNodes, { 3 }, <a id="a30" name="a30"></a>[ansys::dpf::locations::nodal](structansys_1_1dpf_1_1locations.xhtml#aa4e1967b0838d8597200c606c8564d29));

 double* data_1 = coordinates_field.<a id="a31" name="a31"></a>[data](classansys_1_1dpf_1_1Field.xhtml#a0967a8c6cee105a679dd1151a5d41004)().data();

 time_1_disp_data.setData(data_1, coordinates_field.<a id="a32" name="a32"></a>[dataSize](classansys_1_1dpf_1_1Field.xhtml#a9bb7ac154ee6720cbb98b1c09e056942)());

 [ansys::dpf::Field](classansys_1_1dpf_1_1Field.xhtml) time_2_disp_data(numNodes, { 3 }, [ansys::dpf::locations::nodal](structansys_1_1dpf_1_1locations.xhtml#aa4e1967b0838d8597200c606c8564d29));

 double* data_2 = coordinates_x_2.[data](classansys_1_1dpf_1_1Field.xhtml#a0967a8c6cee105a679dd1151a5d41004)().data();

 time_2_disp_data.setData(data_2, coordinates_x_2.[dataSize](classansys_1_1dpf_1_1Field.xhtml#a9bb7ac154ee6720cbb98b1c09e056942)());

 [ansys::dpf::Field](classansys_1_1dpf_1_1Field.xhtml) time_3_disp_data(numNodes, { 3 }, [ansys::dpf::locations::nodal](structansys_1_1dpf_1_1locations.xhtml#aa4e1967b0838d8597200c606c8564d29));

 double* data_3 = coordinates_x_3.[data](classansys_1_1dpf_1_1Field.xhtml#a0967a8c6cee105a679dd1151a5d41004)().data();

 time_3_disp_data.setData(data_3, coordinates_x_3.[dataSize](classansys_1_1dpf_1_1Field.xhtml#a9bb7ac154ee6720cbb98b1c09e056942)());

 

 [ansys::dpf::FieldDefinition](classansys_1_1dpf_1_1FieldDefinition.xhtml) field_def_1 = time_1_disp_data.fieldDefinition();

 field_def_1.[setUnit](classansys_1_1dpf_1_1FieldDefinition.xhtml#a8033b1d4486ea3d819ecbb6418bab079)(mesh.[lengthUnit](classansys_1_1dpf_1_1MeshedRegion.xhtml#aed167b03463f42d94d424797529eccad)());

 time_1_disp_data.setFieldDefinition(field_def_1);

 [ansys::dpf::FieldDefinition](classansys_1_1dpf_1_1FieldDefinition.xhtml) field_def_2 = time_2_disp_data.fieldDefinition();

 field_def_2.[setUnit](classansys_1_1dpf_1_1FieldDefinition.xhtml#a8033b1d4486ea3d819ecbb6418bab079)(mesh.[lengthUnit](classansys_1_1dpf_1_1MeshedRegion.xhtml#aed167b03463f42d94d424797529eccad)());

 time_2_disp_data.setFieldDefinition(field_def_2);

 [ansys::dpf::FieldDefinition](classansys_1_1dpf_1_1FieldDefinition.xhtml) field_def_3 = time_3_disp_data.fieldDefinition();

 field_def_3.[setUnit](classansys_1_1dpf_1_1FieldDefinition.xhtml#a8033b1d4486ea3d819ecbb6418bab079)(mesh.[lengthUnit](classansys_1_1dpf_1_1MeshedRegion.xhtml#aed167b03463f42d94d424797529eccad)());

 time_3_disp_data.setFieldDefinition(field_def_3);

 

 time_1_disp_data.setScoping(coordinates_field.[scoping](classansys_1_1dpf_1_1Field.xhtml#aa16920741c1432c16e46ec6da26b3f04)());

 time_2_disp_data.setScoping(coordinates_field.[scoping](classansys_1_1dpf_1_1Field.xhtml#aa16920741c1432c16e46ec6da26b3f04)());

 time_3_disp_data.setScoping(coordinates_field.[scoping](classansys_1_1dpf_1_1Field.xhtml#aa16920741c1432c16e46ec6da26b3f04)());

 

 fc_disp.addLabel([ansys::dpf::labels::time](structansys_1_1dpf_1_1labels.xhtml#a22ee1a5e3be8ad98c20c5ca52e247914));

 fc_disp.<a id="a33" name="a33"></a>[add](classansys_1_1dpf_1_1FieldsContainer.xhtml#a0c6bd75cbd78e7a25784ccc4a9f609d5)(label_space_1, time_1_disp_data);

 fc_disp.[add](classansys_1_1dpf_1_1FieldsContainer.xhtml#a0c6bd75cbd78e7a25784ccc4a9f609d5)(label_space_2, time_2_disp_data);

 fc_disp.[add](classansys_1_1dpf_1_1FieldsContainer.xhtml#a0c6bd75cbd78e7a25784ccc4a9f609d5)(label_space_3, time_3_disp_data);

 fc_disp.setSupport(time_freq_support);

 }

 

 // 4. Create elemental stress FieldContainer for 3 time steps

 // ----------------------------------------------------------

 {

 int num_entities = 3;

 [ansys::dpf::Field](classansys_1_1dpf_1_1Field.xhtml) field_stress_1(num_entities, { 3, 3 }, <a id="a34" name="a34"></a>[ansys::dpf::locations::elemental](structansys_1_1dpf_1_1locations.xhtml#a3f66169a86ab935fb398b3fdde98bb04)); //elemental sym matrix

 [ansys::dpf::Field](classansys_1_1dpf_1_1Field.xhtml) field_stress_2(num_entities, { 3, 3 }, [ansys::dpf::locations::elemental](structansys_1_1dpf_1_1locations.xhtml#a3f66169a86ab935fb398b3fdde98bb04)); //elemental sym matrix

 [ansys::dpf::Field](classansys_1_1dpf_1_1Field.xhtml) field_stress_3(num_entities, { 3, 3 }, [ansys::dpf::locations::elemental](structansys_1_1dpf_1_1locations.xhtml#a3f66169a86ab935fb398b3fdde98bb04)); //elemental sym matrix

 

 [ansys::dpf::FieldDefinition](classansys_1_1dpf_1_1FieldDefinition.xhtml) field_def_1 = field_stress_1.fieldDefinition();

 field_def_1.[setUnit](classansys_1_1dpf_1_1FieldDefinition.xhtml#a8033b1d4486ea3d819ecbb6418bab079)([ansys::dpf::Unit](classansys_1_1dpf_1_1Unit.xhtml)("Pa"));

 field_stress_1.setFieldDefinition(field_def_1);

 [ansys::dpf::FieldDefinition](classansys_1_1dpf_1_1FieldDefinition.xhtml) field_def_2 = field_stress_2.fieldDefinition();

 field_def_2.[setUnit](classansys_1_1dpf_1_1FieldDefinition.xhtml#a8033b1d4486ea3d819ecbb6418bab079)([ansys::dpf::Unit](classansys_1_1dpf_1_1Unit.xhtml)("Pa"));

 field_stress_2.setFieldDefinition(field_def_2);

 [ansys::dpf::FieldDefinition](classansys_1_1dpf_1_1FieldDefinition.xhtml) field_def_3 = field_stress_3.fieldDefinition();

 field_def_3.[setUnit](classansys_1_1dpf_1_1FieldDefinition.xhtml#a8033b1d4486ea3d819ecbb6418bab079)([ansys::dpf::Unit](classansys_1_1dpf_1_1Unit.xhtml)("Pa"));

 field_stress_3.setFieldDefinition(field_def_3);

 

 // fill by entity

 std::vector&lt;double&gt; elem_data_1 = { 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, };

 std::vector&lt;double&gt; elem_data_2 = { 4.0, 4.0, 4.0, 0.0, 0.0, 0.0 };

 std::vector&lt;double&gt; elem_data_3 = { 2.3, 1.0, 1.0, 0.0, 0.0, 1.0, 2.3, 1.0, 1.0, 0.0, 0.0, 1.0, 2.3, 1.0, 1.0, 0.0, 0.0, 1.0, 2.3, 1.0, 1.0, 0.0, 0.0, 1.0 };

 field_stress_1.push_back(1, elem_data_1);

 field_stress_1.push_back(2, elem_data_2);

 field_stress_1.push_back(4, elem_data_3);

 field_stress_2.push_back(1, elem_data_1);

 field_stress_2.push_back(2, elem_data_2);

 field_stress_2.push_back(4, elem_data_3);

 field_stress_3.push_back(1, elem_data_1);

 field_stress_3.push_back(2, elem_data_2);

 field_stress_3.push_back(4, elem_data_3);

 

 fc_stress.addLabel([ansys::dpf::labels::time](structansys_1_1dpf_1_1labels.xhtml#a22ee1a5e3be8ad98c20c5ca52e247914));

 fc_stress.[add](classansys_1_1dpf_1_1FieldsContainer.xhtml#a0c6bd75cbd78e7a25784ccc4a9f609d5)(label_space_1, field_stress_1);

 fc_stress.[add](classansys_1_1dpf_1_1FieldsContainer.xhtml#a0c6bd75cbd78e7a25784ccc4a9f609d5)(label_space_2, field_stress_2);

 fc_stress.[add](classansys_1_1dpf_1_1FieldsContainer.xhtml#a0c6bd75cbd78e7a25784ccc4a9f609d5)(label_space_3, field_stress_3);

 fc_stress.setSupport(time_freq_support);

 }

 

 // 5. Get deformed meshed in a MeshesContainer

 // -------------------------------------------

 {

 [ansys::dpf::Field](classansys_1_1dpf_1_1Field.xhtml) node_coords = mesh.[nodesCoordinates](classansys_1_1dpf_1_1MeshedRegion.xhtml#a482ae171f257bfe86c8e567f0882caa4)();

 [ansys::dpf::Operator](classansys_1_1dpf_1_1Operator.xhtml) add_coords("add");

 add_coords.connect(0, node_coords);

 [ansys::dpf::Field](classansys_1_1dpf_1_1Field.xhtml) disp_field_1 = fc_disp.<a id="a35" name="a35"></a>[getField](classansys_1_1dpf_1_1FieldsContainer.xhtml#aeb12b6212b016653f1eb325f19a9d1ce)(label_space_1);

 add_coords.connect(1, disp_field_1);

 [ansys::dpf::Field](classansys_1_1dpf_1_1Field.xhtml) deformed_coords_1 = add_coords.getOutputField(0);

 [ansys::dpf::Field](classansys_1_1dpf_1_1Field.xhtml) disp_field_2 = fc_disp.[getField](classansys_1_1dpf_1_1FieldsContainer.xhtml#aeb12b6212b016653f1eb325f19a9d1ce)(label_space_2);

 add_coords.connect(1, disp_field_2);

 [ansys::dpf::Field](classansys_1_1dpf_1_1Field.xhtml) deformed_coords_2 = add_coords.getOutputField(0);

 [ansys::dpf::Field](classansys_1_1dpf_1_1Field.xhtml) disp_field_3 = fc_disp.[getField](classansys_1_1dpf_1_1FieldsContainer.xhtml#aeb12b6212b016653f1eb325f19a9d1ce)(label_space_3);

 add_coords.connect(1, disp_field_3);

 [ansys::dpf::Field](classansys_1_1dpf_1_1Field.xhtml) deformed_coords_3 = add_coords.getOutputField(0);

 

 [ansys::dpf::MeshedRegion](classansys_1_1dpf_1_1MeshedRegion.xhtml) mesh_1 = mesh.<a id="a36" name="a36"></a>[deep\_copy](classansys_1_1dpf_1_1MeshedRegion.xhtml#acdd5697fc951caef900b5ea145d79cbf)();

 mesh_1.<a id="a37" name="a37"></a>[setNodesCoordinates](classansys_1_1dpf_1_1MeshedRegion.xhtml#ad5fbd4c5a82f47d45eba62536cba68a1)(deformed_coords_1);

 [ansys::dpf::MeshedRegion](classansys_1_1dpf_1_1MeshedRegion.xhtml) mesh_2 = mesh.[deep\_copy](classansys_1_1dpf_1_1MeshedRegion.xhtml#acdd5697fc951caef900b5ea145d79cbf)();

 mesh_2.[setNodesCoordinates](classansys_1_1dpf_1_1MeshedRegion.xhtml#ad5fbd4c5a82f47d45eba62536cba68a1)(deformed_coords_2);

 [ansys::dpf::MeshedRegion](classansys_1_1dpf_1_1MeshedRegion.xhtml) mesh_3 = mesh.[deep\_copy](classansys_1_1dpf_1_1MeshedRegion.xhtml#acdd5697fc951caef900b5ea145d79cbf)();

 mesh_3.[setNodesCoordinates](classansys_1_1dpf_1_1MeshedRegion.xhtml#ad5fbd4c5a82f47d45eba62536cba68a1)(deformed_coords_3);

 

 meshes.addLabel([ansys::dpf::labels::time](structansys_1_1dpf_1_1labels.xhtml#a22ee1a5e3be8ad98c20c5ca52e247914));

 meshes.<a id="a38" name="a38"></a>[add](classansys_1_1dpf_1_1MeshesContainer.xhtml#aff23c8528d5364caf5a959d252576c94)(label_space_1, mesh_1);

 meshes.[add](classansys_1_1dpf_1_1MeshesContainer.xhtml#aff23c8528d5364caf5a959d252576c94)(label_space_2, mesh_2);

 meshes.[add](classansys_1_1dpf_1_1MeshesContainer.xhtml#aff23c8528d5364caf5a959d252576c94)(label_space_3, mesh_3);

 }

 

 // 6. Serialize into hdf5 file

 // ---------------------------

 {

 [ansys::dpf::Operator](classansys_1_1dpf_1_1Operator.xhtml) op_hdf5("hdf5::h5dpf::make\_result\_file");

 op_hdf5.connect(0, temp_dir.getTempFile("export\_hdf5.h5"));

 op_hdf5.connect(1, mesh);

 op_hdf5.connect(4, std::string("stress\_result"));

 op_hdf5.connect(5, fc_stress);

 op_hdf5.connect(6, std::string("disp\_result"));

 op_hdf5.connect(7, fc_disp);

 

 hdf5_ds = op_hdf5.getOutputDataSources(0);

 }

 

 // 7. Deserialize the H5 file and check the result

 // -----------------------------------------------

 [ansys::dpf::MeshedRegion](classansys_1_1dpf_1_1MeshedRegion.xhtml) mesh_deser = ansys::dpf::MeshedRegion::emptyMeshedRegion();

 [ansys::dpf::FieldsContainer](classansys_1_1dpf_1_1FieldsContainer.xhtml) stress_deser = <a id="a39" name="a39"></a>[ansys::dpf::FieldsContainer::emptyFieldsContainer](classansys_1_1dpf_1_1FieldsContainer.xhtml#af4bcbf19662088a80192c4306e76eab9)();

 [ansys::dpf::FieldsContainer](classansys_1_1dpf_1_1FieldsContainer.xhtml) disp_deser = [ansys::dpf::FieldsContainer::emptyFieldsContainer](classansys_1_1dpf_1_1FieldsContainer.xhtml#af4bcbf19662088a80192c4306e76eab9)();

 <a id="_a40" name="_a40"></a>[ansys::dpf::Scoping](classansys_1_1dpf_1_1Scoping.xhtml) time_scoping;

 time_scoping.[setIds](classansys_1_1dpf_1_1Scoping.xhtml#a021a022f87287b786ff9b3c92deb0e69)({ 1, 2, 3 });

 {

 [ansys::dpf::Operator](classansys_1_1dpf_1_1Operator.xhtml) stream("stream\_provider");

 stream.connect(<a id="a41" name="a41"></a>[ansys::dpf::eDataSourcesPin](namespaceansys_1_1dpf.xhtml#aa4a44a04a0aafb8fe0645f019bbd94d1a5b6613f802062fde4faea4b553db7fbc), hdf5_ds);

 

 [ansys::dpf::Operator](classansys_1_1dpf_1_1Operator.xhtml) h5_read_op("hdf5::h5dpf::custom");

 h5_read_op.connect(<a id="a42" name="a42"></a>[ansys::dpf::eStreamPin](namespaceansys_1_1dpf.xhtml#aa4a44a04a0aafb8fe0645f019bbd94d1a0f5631bb51d4a3e4a40e167cb1198799), stream, 0);

 h5_read_op.connect(<a id="a43" name="a43"></a>[ansys::dpf::eTimeScopPin](namespaceansys_1_1dpf.xhtml#aa4a44a04a0aafb8fe0645f019bbd94d1ac390a52dd8c4f1e8ff81a162cdc04d4f), time_scoping);

 h5_read_op.connect(60, std::string("stress\_result"));

 stress_deser = h5_read_op.getOutputFieldsContainer(0);

 h5_read_op.connect(60, std::string("disp\_result"));

 disp_deser = h5_read_op.getOutputFieldsContainer(0);

 

 [ansys::dpf::Operator](classansys_1_1dpf_1_1Operator.xhtml) mesh_prov_op("MeshProvider");

 mesh_prov_op.connect([ansys::dpf::eStreamPin](namespaceansys_1_1dpf.xhtml#aa4a44a04a0aafb8fe0645f019bbd94d1a0f5631bb51d4a3e4a40e167cb1198799), stream, 0);

 mesh_deser = mesh_prov_op.getOutputMeshedRegion(0);

 }

 

 // 8. Ensure serialized and deserialized values are identical

 // ----------------------------------------------------------

 EXPECT_TRUE(mesh_deser.<a id="a44" name="a44"></a>[numberOfElements](classansys_1_1dpf_1_1MeshedRegion.xhtml#ac3a262bc236fda82374a462d7c9e240c)() == mesh.[numberOfElements](classansys_1_1dpf_1_1MeshedRegion.xhtml#ac3a262bc236fda82374a462d7c9e240c)());

 EXPECT_TRUE(mesh_deser.<a id="a45" name="a45"></a>[numberOfNodes](classansys_1_1dpf_1_1MeshedRegion.xhtml#af8ad6b50708b2c201a457c5da8e819da)() == mesh.[numberOfNodes](classansys_1_1dpf_1_1MeshedRegion.xhtml#af8ad6b50708b2c201a457c5da8e819da)());

 EXPECT_TRUE(disp_deser.size() == fc_disp.size());

 EXPECT_TRUE(disp_deser[0].dataSize() == fc_disp[0].dataSize());

 EXPECT_TRUE(stress_deser.size() == fc_stress.size());

 EXPECT_TRUE(stress_deser[1].dataSize() == stress_deser[1].dataSize());

 [ansys::dpf::TimeFreqSupport](classansys_1_1dpf_1_1TimeFreqSupport.xhtml) tfq = stress_deser.support().getAsTimeFreqSupport();

 [ansys::dpf::Field](classansys_1_1dpf_1_1Field.xhtml) f = tfq.<a id="a46" name="a46"></a>[frequencies](classansys_1_1dpf_1_1TimeFreqSupport.xhtml#aa0cf046a80d328f966892abe85308f01)();

 EXPECT_TRUE(tfq.<a id="a47" name="a47"></a>[numberOfSets](classansys_1_1dpf_1_1TimeFreqSupport.xhtml#a87c577de73b5ba2260cf3f940ac43068)() == 3);

 EXPECT_TRUE(f.[dataSize](classansys_1_1dpf_1_1Field.xhtml#a9bb7ac154ee6720cbb98b1c09e056942)() == 3);

}

[ansys::dpf::DataSources](classansys_1_1dpf_1_1DataSources.xhtml)

**Definition:** dpf_api.h:2371



[ansys::dpf::FieldDefinition](classansys_1_1dpf_1_1FieldDefinition.xhtml)

**Definition:** dpf_api.h:633



[ansys::dpf::FieldDefinition::setUnit](classansys_1_1dpf_1_1FieldDefinition.xhtml#a8033b1d4486ea3d819ecbb6418bab079)

void setUnit(ansys::dpf::Unit const &amp;rhs)



[ansys::dpf::Field](classansys_1_1dpf_1_1Field.xhtml)

Data for an entity.

**Definition:** dpf_api.h:991



[ansys::dpf::Field::data](classansys_1_1dpf_1_1Field.xhtml#a0967a8c6cee105a679dd1151a5d41004)

dp_double *const data(int &amp;size) const



[ansys::dpf::Field::fieldDefinition](classansys_1_1dpf_1_1Field.xhtml#a860e65caa16f612746ad116429282fd3)

FieldDefinition fieldDefinition() const



[ansys::dpf::Field::dataSize](classansys_1_1dpf_1_1Field.xhtml#a9bb7ac154ee6720cbb98b1c09e056942)

dp_int dataSize() const



[ansys::dpf::Field::scoping](classansys_1_1dpf_1_1Field.xhtml#aa16920741c1432c16e46ec6da26b3f04)

Scoping scoping() const



[ansys::dpf::FieldsContainer](classansys_1_1dpf_1_1FieldsContainer.xhtml)

Contains a group of fields.

**Definition:** dpf_api.h:1889



[ansys::dpf::FieldsContainer::add](classansys_1_1dpf_1_1FieldsContainer.xhtml#a0c6bd75cbd78e7a25784ccc4a9f609d5)

void add(LabelSpace const &amp;lab_space, Field const &amp;f)



[ansys::dpf::FieldsContainer::getField](classansys_1_1dpf_1_1FieldsContainer.xhtml#aeb12b6212b016653f1eb325f19a9d1ce)

Field getField(LabelSpace const &amp;lab_space) const



[ansys::dpf::FieldsContainer::emptyFieldsContainer](classansys_1_1dpf_1_1FieldsContainer.xhtml#af4bcbf19662088a80192c4306e76eab9)

static FieldsContainer emptyFieldsContainer()



[ansys::dpf::LabelSpace](classansys_1_1dpf_1_1LabelSpace.xhtml)

**Definition:** dpf_api.h:733



[ansys::dpf::MeshedRegion](classansys_1_1dpf_1_1MeshedRegion.xhtml)

Holds the mesh for a given region (body, faces, skin, ...)

**Definition:** dpf_api.h:4231



[ansys::dpf::MeshedRegion::addElement](classansys_1_1dpf_1_1MeshedRegion.xhtml#a11b6e06dfea398609fa9fb25ad4333bb)

void addElement(ElementDescriptor const &amp;descriptor, dp_id elem_id, std::vector&lt; dp_index &gt; const &amp;node_indices)



[ansys::dpf::MeshedRegion::addNode](classansys_1_1dpf_1_1MeshedRegion.xhtml#a2b4891674d74a792b63318c305963500)

void addNode(dp_id node_id, std::array&lt; dp_double, 3 &gt; const &amp;data)



[ansys::dpf::MeshedRegion::elementScoping](classansys_1_1dpf_1_1MeshedRegion.xhtml#a3056a0fc6d69ca8769e33de6be0cecf0)

Scoping elementScoping() const



[ansys::dpf::MeshedRegion::nodesCoordinates](classansys_1_1dpf_1_1MeshedRegion.xhtml#a482ae171f257bfe86c8e567f0882caa4)

Field nodesCoordinates() const



[ansys::dpf::MeshedRegion::setLengthUnit](classansys_1_1dpf_1_1MeshedRegion.xhtml#a638d38d0400a6c64b85082a4c4beb105)

void setLengthUnit(Unit const &amp;unit)



[ansys::dpf::MeshedRegion::prepareConstruction](classansys_1_1dpf_1_1MeshedRegion.xhtml#aa7b984923ddd90379f08bc5b9831a95e)

void prepareConstruction(dp_int n_nodes, dp_int n_elements)



[ansys::dpf::MeshedRegion::numberOfElements](classansys_1_1dpf_1_1MeshedRegion.xhtml#ac3a262bc236fda82374a462d7c9e240c)

dp_int numberOfElements() const



[ansys::dpf::MeshedRegion::deep\_copy](classansys_1_1dpf_1_1MeshedRegion.xhtml#acdd5697fc951caef900b5ea145d79cbf)

MeshedRegion deep_copy(ansys::dpf::Client const *const client) const



[ansys::dpf::MeshedRegion::nodeScoping](classansys_1_1dpf_1_1MeshedRegion.xhtml#ad5df08993b7c588d9565ef1c1ea4813d)

Scoping nodeScoping() const



[ansys::dpf::MeshedRegion::setNodesCoordinates](classansys_1_1dpf_1_1MeshedRegion.xhtml#ad5fbd4c5a82f47d45eba62536cba68a1)

void setNodesCoordinates(Field coordinates)



[ansys::dpf::MeshedRegion::lengthUnit](classansys_1_1dpf_1_1MeshedRegion.xhtml#aed167b03463f42d94d424797529eccad)

Unit lengthUnit() const



[ansys::dpf::MeshedRegion::numberOfNodes](classansys_1_1dpf_1_1MeshedRegion.xhtml#af8ad6b50708b2c201a457c5da8e819da)

dp_int numberOfNodes() const



[ansys::dpf::MeshesContainer](classansys_1_1dpf_1_1MeshesContainer.xhtml)

**Definition:** dpf_api.h:2061



[ansys::dpf::MeshesContainer::add](classansys_1_1dpf_1_1MeshesContainer.xhtml#aff23c8528d5364caf5a959d252576c94)

void add(LabelSpace const &amp;labels, MeshedRegion const &amp;f)



[ansys::dpf::Operator](classansys_1_1dpf_1_1Operator.xhtml)

Wrap an elementary operation.

**Definition:** dpf_api.h:2651



[ansys::dpf::Scoping](classansys_1_1dpf_1_1Scoping.xhtml)

Define a set of entities by ids.

**Definition:** dpf_api.h:838



[ansys::dpf::Scoping::setIds](classansys_1_1dpf_1_1Scoping.xhtml#a021a022f87287b786ff9b3c92deb0e69)

void setIds(std::vector&lt; dp_id &gt; const &amp;ids)



[ansys::dpf::Scoping::size](classansys_1_1dpf_1_1Scoping.xhtml#aeae5e27bd752bdf0da3cc2d64fbe118a)

dp_int size() const



[ansys::dpf::TimeFreqSupport](classansys_1_1dpf_1_1TimeFreqSupport.xhtml)

Define a time/frequency set.

**Definition:** dpf_api.h:4405



[ansys::dpf::TimeFreqSupport::numberOfSets](classansys_1_1dpf_1_1TimeFreqSupport.xhtml#a87c577de73b5ba2260cf3f940ac43068)

dp_int numberOfSets() const



[ansys::dpf::TimeFreqSupport::setTimeFrequencies](classansys_1_1dpf_1_1TimeFreqSupport.xhtml#aa01a23bf27be8e42ce3ec1da5e0ddcbe)

void setTimeFrequencies(Field field)



[ansys::dpf::TimeFreqSupport::frequencies](classansys_1_1dpf_1_1TimeFreqSupport.xhtml#aa0cf046a80d328f966892abe85308f01)

Field frequencies() const



[ansys::dpf::Unit](classansys_1_1dpf_1_1Unit.xhtml)

**Definition:** dpf_api.h:301



[ansys::dpf::eStreamPin](namespaceansys_1_1dpf.xhtml#aa4a44a04a0aafb8fe0645f019bbd94d1a0f5631bb51d4a3e4a40e167cb1198799)

@ eStreamPin

**Definition:** dpf_api.h:2581



[ansys::dpf::eDataSourcesPin](namespaceansys_1_1dpf.xhtml#aa4a44a04a0aafb8fe0645f019bbd94d1a5b6613f802062fde4faea4b553db7fbc)

@ eDataSourcesPin

**Definition:** dpf_api.h:2583



[ansys::dpf::eTimeScopPin](namespaceansys_1_1dpf.xhtml#aa4a44a04a0aafb8fe0645f019bbd94d1ac390a52dd8c4f1e8ff81a162cdc04d4f)

@ eTimeScopPin

**Definition:** dpf_api.h:2575



[ansys::dpf::elements::tet4](structansys_1_1dpf_1_1elements.xhtml#a05d59369acd4f4ac6819645f2413ee22)

static const ElementDescriptor tet4

**Definition:** dpf_api_base.h:675



[ansys::dpf::elements::point1](structansys_1_1dpf_1_1elements.xhtml#a42c776bd25670e7ca0c2cc9fc91e2829)

static const ElementDescriptor point1

**Definition:** dpf_api_base.h:715



[ansys::dpf::elements::quadShell4](structansys_1_1dpf_1_1elements.xhtml#ac9194bac632c648b744f96a2306b428b)

static const ElementDescriptor quadShell4

**Definition:** dpf_api_base.h:689



[ansys::dpf::labels::time](structansys_1_1dpf_1_1labels.xhtml#a22ee1a5e3be8ad98c20c5ca52e247914)

static const Label time

**Definition:** dpf_api_base.h:536



[ansys::dpf::locations::time\_set](structansys_1_1dpf_1_1locations.xhtml#a3cf1bbc2ad6d8b8f6173e83b5118031a)

static const Location time_set

**Definition:** dpf_api_base.h:204



[ansys::dpf::locations::elemental](structansys_1_1dpf_1_1locations.xhtml#a3f66169a86ab935fb398b3fdde98bb04)

static const Location elemental

**Definition:** dpf_api_base.h:178



[ansys::dpf::locations::nodal](structansys_1_1dpf_1_1locations.xhtml#aa4e1967b0838d8597200c606c8564d29)

static const Location nodal

**Definition:** dpf_api_base.h:176



[ansys::dpf::locations::time\_step](structansys_1_1dpf_1_1locations.xhtml#abc48364ef6b184ddf696099c9a2993cd)

static const Location time_step

**Definition:** dpf_api_base.h:202