Small VTFx file showing the use of results, multiple states and properties.
This example contains of two simple parts. The first part consists of a single hexahedron element and the second part of a single pyramid element. It is also set up with three states and one scalar result. The scalar result is defined for both parts and for all three states.
const cee::Str fileName =
"ExampleSimple.vtfx";
if (!file->
create(fileName, fileSettings))
{
return EXIT_FAILURE;
}
{
{
const float NODES_PART_1[] =
{
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_1, NODES_PART_1 + sizeof(NODES_PART_1) / sizeof(NODES_PART_1[0]));
{
return EXIT_FAILURE;
}
{
return EXIT_FAILURE;
}
}
{
const int CONNECTS_PART_1[] = { 0, 1, 2, 3, 4, 5, 6, 7 };
std::vector<int> elementNodes(CONNECTS_PART_1, CONNECTS_PART_1 + sizeof(CONNECTS_PART_1) / sizeof(CONNECTS_PART_1[0]));
{
return EXIT_FAILURE;
}
{
return EXIT_FAILURE;
}
}
}
{
{
const float NODES_PART_2[] =
{
3.0f, 0.0f, 0.0f,
4.0f, 0.0f, 0.0f,
4.0f, 1.0f, 0.0f,
3.0f, 1.0f, 0.0f,
3.5f, 0.5f, 1.0f
};
std::vector<float> nodesPart(NODES_PART_2, NODES_PART_2 + sizeof(NODES_PART_2) / sizeof(NODES_PART_2[0]));
{
return EXIT_FAILURE;
}
{
return EXIT_FAILURE;
}
}
{
const int CONNECTS_PART_2[] = { 0, 1, 2, 3, 4 };
std::vector<int> elementNodes(CONNECTS_PART_2, CONNECTS_PART_2 + sizeof(CONNECTS_PART_2) / sizeof(CONNECTS_PART_2[0]));
{
return EXIT_FAILURE;
}
{
return EXIT_FAILURE;
}
}
}
{
size_t geoIndex = 0;
int partIdCube = 1;
int partIdPyramid = 2;
{
return EXIT_FAILURE;
}
{
return EXIT_FAILURE;
}
{
return EXIT_FAILURE;
}
}
{
{
return EXIT_FAILURE;
}
{
return EXIT_FAILURE;
}
}
{
{
{
{
return EXIT_FAILURE;
}
const float RESULT_VALUES[] = { 0.0f, 0.5f, 1.0f, 1.0f, 2.0f, 2.0f, 2.0f, 3.0f };
std::vector<float> resultValues(RESULT_VALUES, RESULT_VALUES + sizeof(RESULT_VALUES) / sizeof(RESULT_VALUES[0]));
{
return EXIT_FAILURE;
}
{
return EXIT_FAILURE;
}
}
{
{
return EXIT_FAILURE;
}
const float RESULT_VALUES[] = { 0.0f, 0.5f, 2.5f, 2.5f, 3.0f, 3.0f, 3.0f, 4.0f };
std::vector<float> resultValues(RESULT_VALUES, RESULT_VALUES + sizeof(RESULT_VALUES) / sizeof(RESULT_VALUES[0]));
{
return EXIT_FAILURE;
}
{
return EXIT_FAILURE;
}
}
{
{
return EXIT_FAILURE;
}
const float RESULT_VALUES[] = { 0.0f, 0.5f, 2.5f, 2.5f, 3.0f, 3.0f, 4.0f, 6.0f };
std::vector<float> resultValues(RESULT_VALUES, RESULT_VALUES + sizeof(RESULT_VALUES) / sizeof(RESULT_VALUES[0]));
{
return EXIT_FAILURE;
}
{
return EXIT_FAILURE;
}
}
}
{
{
{
return EXIT_FAILURE;
}
const float RESULT_VALUES[] = { 0.0f, 0.5f, 1.0f, 1.0f, 1.5f };
std::vector<float> resultValues(RESULT_VALUES, RESULT_VALUES + sizeof(RESULT_VALUES) / sizeof(RESULT_VALUES[0]));
{
return EXIT_FAILURE;
}
{
return EXIT_FAILURE;
}
}
{
{
return EXIT_FAILURE;
}
const float RESULT_VALUES[] = { 0.0f, 0.5f, 1.0f, 1.0f, 3.5f };
std::vector<float> resultValues(RESULT_VALUES, RESULT_VALUES + sizeof(RESULT_VALUES) / sizeof(RESULT_VALUES[0]));
{
return EXIT_FAILURE;
}
{
return EXIT_FAILURE;
}
}
{
{
return EXIT_FAILURE;
}
const float RESULT_VALUES[] = { 0.0f, 0.5f, 1.0f, 1.0f, 6.0f };
std::vector<float> resultValues(RESULT_VALUES, RESULT_VALUES + sizeof(RESULT_VALUES) / sizeof(RESULT_VALUES[0]));
{
return EXIT_FAILURE;
}
{
return EXIT_FAILURE;
}
}
}
{
return EXIT_FAILURE;
}
scalarResult->
setName(
"My scalar result");
{
return EXIT_FAILURE;
}
}
{
scalarSelection->
setValue(
"fringes_result_id", 1);
std::vector<cee::Variant> stateIds(STATE_IDS, STATE_IDS + sizeof(STATE_IDS) / sizeof(STATE_IDS[0]));
stateSelection->
setValue(
"state_ids", stateIds);
viewer->
setValue(
"start_animation",
true);
if (!singleCase->setProperties(vtfxProps.
get()))
{
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;