cee::ug::ResultsQueryItem Class Reference

Used to identify an element or a node within a DataGeometry in order to query result values for it using a ResultsQuery. More...

Public Member Functions

 ResultsQueryItem ()
 Constructs a query item object. This is used to instantiate an item for the first time. More...
 
 ResultsQueryItem (size_t partIndex, size_t index)
 Constructs a query item object and assigns the index of the DataPart which it belongs to as well as its own index within this part. More...
 
bool operator== (const ResultsQueryItem &other) const
 Returns true if this item is equal to the passed item. More...
 
size_t partIndex () const
 Returns the part index of this item. More...
 
size_t index () const
 Returns the item index (node or element) More...
 

Detailed Description

Used to identify an element or a node within a DataGeometry in order to query result values for it using a ResultsQuery.

The item type needs to be consistent with the mapping of the queried result: nodes for node-mapped results, and elements for element, element-node- and element-surface- mapped results.

Items can be instantiated with the default constructor and then reused thanks to the second constructor to perform different queries.

Example:

ResultsQuery query(dataSource.get()); // the ResultsQuery object that will fetch the result values
ResultQueryItem item1; // first instantiation, no part index or index specified
ResultQueryItem item2;
std::vector<ResultsQueryItem> items; // The vector of items that will be queried
std::vector<ResultsQueryResult> results; // The vector containing the results of the query
// First query
item1 = ResultsQueryItem(1, 5); // Looking for values at part 1, node 5 (the result is a node-mapped one)
item2 = ResultsQueryItem(2, 36); // Looking for values at part 2, node 36
items.push_back(item1);
items.push_back(item2);
query.scalars(scalarId, stateId, 0, &items, &results); // fills "results" with the scalar values
// of the items. The geometry index is 0.
// Second query
items.clear(); // Clear the query item vector
item1 = ResultsQueryItem(0, 523); // Looking for values at part 0, element 523 (the result is an element-mapped one)
item2 = ResultsQueryItem(1, 136); // Looking for values at part 1, node 136
items.push_back(item1);
items.push_back(item2);
query.vectors(vectorId, stateId, 0, &items, &results); // fills "results" with the vector values
// of the items. The geometry index is 0.

Constructor & Destructor Documentation

cee::ug::ResultsQueryItem::ResultsQueryItem ( )

Constructs a query item object. This is used to instantiate an item for the first time.

cee::ug::ResultsQueryItem::ResultsQueryItem ( size_t  partIndex,
size_t  index 
)

Constructs a query item object and assigns the index of the DataPart which it belongs to as well as its own index within this part.

Member Function Documentation

size_t cee::ug::ResultsQueryItem::index ( ) const

Returns the item index (node or element)

bool cee::ug::ResultsQueryItem::operator== ( const ResultsQueryItem other) const

Returns true if this item is equal to the passed item.

size_t cee::ug::ResultsQueryItem::partIndex ( ) const

Returns the part index of this item.