cee::ug::DataElementSetBuilder

class DataElementSetBuilder

Helper class for building element sets in an efficient matter.

If you need to call DataElementSet::addItem()/addItems() many times for each data element set, you can use this helper class to increase performance.

Use the add* functions to add items to be included in the element set. After all items are added, get the complete element set using createSet(). Always use addUnique* when possible to increase performance further.

DataElementSetBuilder builder(1);
 std::vector<size_t> eltementIndices1 = { 7, 5, 16, 8 };
 std::vector<size_t> eltementIndices2 = { 17, 24, 3, 9 };
 builder.addUniqueItems(1, 1, eltementIndices1);
 builder.addUniqueItems(1, 1, eltementIndices2);
 cee::PtrRef<DataElementSet> set = builder.createSet();

Public Functions

DataElementSetBuilder(int setId)

Creates the element set builder.

setId need to be unique when the element set is added to the model

void addItem(const DataElementSetItem &item)

Adds the item to the element set builder.

void addItems(int geometryId, int partId, const std::vector<size_t> &elementIndices)

Adds the items to the element set builder.

void addUniqueItem(const DataElementSetItem &item)

Adds the item to the element set builder.

Requires unique items. Only use this if you are sure the item does not already exist in the element set.

void addUniqueItems(int geometryId, int partId, const std::vector<size_t> &elementIndices)

Adds the items to the element set builder.

Requires unique items. Only use this if you are sure the item does not already exist in the element set.

PtrRef<DataElementSet> createSet()

Returns the complete data element set.

Call this once after all items are added.