This is the most basic example of a VTFx.
The minimum requirements for a VTFx file are:
- one database with
- one node block
- one element block, referencing the node block
- one geometry block, referencing the element block
- one state info block
- one case with a reference to the database
This example shows how to create such a minimal VTFx file with a simple part consisting of just one hexahedron element. The VTFx file has only one state, no results of any kind nor any properties.
const cee::Str fileName =
"ExampleMinimal.vtfx";
if (!file->
create(fileName, fileSettings))
{
return EXIT_FAILURE;
}
const float NODES_PART[] =
{
0.0f, 0.0f, 0.0f,
1.0f, 0.0f, 0.0f,
1.0f, 1.0f, 0.0f,
0.0f, 1.0f, 0.0f,
0.0f, 0.0f, 1.0f,
1.0f, 0.0f, 1.0f,
1.0f, 1.0f, 1.0f,
0.0f, 1.0f, 1.0f
};
std::vector<float> nodesPart(NODES_PART, NODES_PART + sizeof(NODES_PART) / sizeof(NODES_PART[0]));
if (!nodeBlock->setNodes(nodesPart))
{
return EXIT_FAILURE;
}
{
return EXIT_FAILURE;
}
const int CONNECTS_PART[] =
{
0, 1, 2, 3, 4, 5, 6, 7
};
std::vector<int> elementNodes(CONNECTS_PART, CONNECTS_PART + sizeof(CONNECTS_PART) / sizeof(CONNECTS_PART[0]));
{
return EXIT_FAILURE;
}
{
return EXIT_FAILURE;
}
size_t geoIndex = 0;
int partId = 1;
{
return EXIT_FAILURE;
}
{
return EXIT_FAILURE;
}
{
return EXIT_FAILURE;
}
{
return EXIT_FAILURE;
}
{
return EXIT_FAILURE;
}
{
return EXIT_FAILURE;
}
std::cout <<
"Exported successfully to file: " << fileName.
toStdString() << std::endl;
std::cout << std::endl << "Press enter to exit..." << std::endl;
std::cin.ignore();
return EXIT_SUCCESS;