QueryCache is a convenient way to construct and pass around (possible partially constructed) warehouse queries. More...
#include <TheWarehouse.h>
Public Types | |
typedef std::tuple< KeyType< Attribs >... > | KeyTuple |
typedef std::tuple< AttribType< Attribs >... > | AttribTuple |
Public Member Functions | |
QueryCache () | |
QueryCache (TheWarehouse &w) | |
Creates a new query operating on the given warehouse w. More... | |
template<typename T > | |
QueryCache (const T &q) | |
QueryCache & | operator= (const QueryCache &other) |
template<typename T > | |
QueryCache & | operator= (const T &q) |
Copy constructor from another Query. More... | |
QueryCache (const QueryCache &other) | |
template<typename T , typename... Args> | |
QueryCache & | condition (Args &&... args) |
Adds a new condition to the query. More... | |
QueryCache | clone () const |
clone creates and returns an independent copy of the query in its current state. More... | |
std::size_t | count () |
count returns the number of results that match the query (this requires actually running the query). More... | |
TheWarehouse & | warehouse () const |
std::vector< std::unique_ptr< Attribute > > | attributes () const |
attribs returns a copy of the constructed Attribute list for the query in its current state. More... | |
template<typename T , typename... Args> | |
std::vector< T * > & | queryInto (std::vector< T *> &results, Args &&... args) |
queryInto executes the query and stores the results in the given vector. More... | |
template<typename T , typename... Args> | |
std::vector< T * > & | queryIntoUnsorted (std::vector< T *> &results, Args &&... args) |
queryInto executes the query and stores the results in the given vector. More... | |
std::size_t | numAttribs () const |
Gets the number of attributes associated with the cached query. More... | |
Private Member Functions | |
template<typename T , typename... Args> | |
std::vector< T * > & | queryIntoHelper (std::vector< T *> &results, const bool sort, Args &&... args) |
queryInto executes the query and stores the results in the given vector. More... | |
template<int Index, typename A , typename... As> | |
void | addAttribs () |
template<int Index> | |
void | addAttribs () |
template<int Index, typename K , typename... Args> | |
void | setKeysInner (K &k, Args &... args) |
template<int Index> | |
void | setKeysInner () |
template<int Index, typename K , typename... Args> | |
void | setAttribsInner (K k, Args &... args) |
template<int Index> | |
void | setAttribsInner () |
Private Attributes | |
TheWarehouse * | _w = nullptr |
std::vector< std::unique_ptr< Attribute > > | _attribs |
KeyTuple | _key_tup |
AttribTuple | _attrib_tup |
std::map< std::pair< bool, KeyTuple >, std::size_t > | _cache |
std::mutex | _cache_mutex |
QueryCache is a convenient way to construct and pass around (possible partially constructed) warehouse queries.
The warehouse's "query()" or "queryCache(...)" functions should generally be used to create new Query objects rather than constructing them directly. A Query object holds a list of persistent conditions used to filter/select objects from the warehouse. When the query is executed/run, results are filtered by "and"ing each condition together - i.e. only objects that match all conditions are returned.
Template arguments (i.e. Attribs) are used to specify parametrized query conditions. The passed template parameters should be the Attribute classes you want to use for parameterization (i.e. the values that will change from query to query).
Definition at line 208 of file TheWarehouse.h.
typedef std::tuple<AttribType<Attribs>...> TheWarehouse::QueryCache< Attribs >::AttribTuple |
Definition at line 212 of file TheWarehouse.h.
typedef std::tuple<KeyType<Attribs>...> TheWarehouse::QueryCache< Attribs >::KeyTuple |
Definition at line 211 of file TheWarehouse.h.
|
inline |
Definition at line 214 of file TheWarehouse.h.
|
inline |
Creates a new query operating on the given warehouse w.
You should generally use TheWarehouse::query() instead.
Definition at line 218 of file TheWarehouse.h.
|
inline |
Definition at line 225 of file TheWarehouse.h.
|
inline |
Definition at line 269 of file TheWarehouse.h.
|
inlineprivate |
Definition at line 367 of file TheWarehouse.h.
Referenced by TheWarehouse::QueryCache< AttribThread, AttribBoundaries, AttribInterfaces >::addAttribs(), TheWarehouse::QueryCache< AttribThread, AttribBoundaries, AttribInterfaces >::operator=(), and TheWarehouse::QueryCache< AttribThread, AttribBoundaries, AttribInterfaces >::QueryCache().
|
inlineprivate |
Definition at line 374 of file TheWarehouse.h.
|
inline |
attribs returns a copy of the constructed Attribute list for the query in its current state.
Definition at line 300 of file TheWarehouse.h.
|
inline |
clone creates and returns an independent copy of the query in its current state.
Definition at line 292 of file TheWarehouse.h.
Referenced by TheWarehouse::QueryCache< AttribThread, AttribBoundaries, AttribInterfaces >::attributes(), FEProblemBase::computeUserObjectsInternal(), ComputeNodalUserObjectsThread::onNode(), BoundaryNodeIntegrityCheckThread::onNode(), BoundaryElemIntegrityCheckThread::operator()(), ComputeNodalUserObjectsThread::printGeneralExecutionInformation(), ComputeNodalUserObjectsThread::subdomainChanged(), and ComputeUserObjectsThread::subdomainChanged().
|
inline |
Adds a new condition to the query.
The template parameter T is the Attribute class of interest and args are forwarded to T's constructor to build+add the attribute in-situ. Conditions represent persistent query conditions that do not change from query to query for a particular QueryCache instance.
Definition at line 284 of file TheWarehouse.h.
Referenced by FEProblemBase::checkUserObjectJacobianRequirement(), FEProblemBase::checkUserObjects(), NonlinearSystemBase::computeJacobianInternal(), NonlinearSystemBase::computeResidualAndJacobianInternal(), NonlinearSystemBase::computeResidualInternal(), FEProblemBase::computeUserObjectByName(), FEProblemBase::computeUserObjects(), FEProblemBase::computeUserObjectsInternal(), FEProblemBase::customSetup(), FEProblemBase::executeSamplers(), FEProblemBase::getDistribution(), FEProblemBase::getMortarUserObjects(), FEProblemBase::getPositionsObject(), FEProblemBase::getSampler(), CompositionDT::getTimeSteppers(), FEProblemBase::getUserObject(), FEProblemBase::getUserObjectBase(), FEProblemBase::hasUserObject(), SideFVFluxBCIntegral::initialSetup(), FEProblemBase::initialSetup(), AdvancedOutput::initPostprocessorOrVectorPostprocessorLists(), FEProblemBase::needBoundaryMaterialOnSide(), FEProblemBase::needInterfaceMaterialOnSide(), FEProblemBase::needSubdomainMaterialOnSide(), ComputeNodalUserObjectsThread::onNode(), BoundaryNodeIntegrityCheckThread::onNode(), BoundaryElemIntegrityCheckThread::operator()(), JSONOutput::outputReporters(), BlockRestrictionDebugOutput::printBlockRestrictionMap(), ComputeNodalUserObjectsThread::printGeneralExecutionInformation(), ComputeNodalUserObjectsThread::subdomainChanged(), ComputeUserObjectsThread::subdomainChanged(), and FEProblemBase::timestepSetup().
|
inline |
count returns the number of results that match the query (this requires actually running the query).
Definition at line 295 of file TheWarehouse.h.
|
inline |
Gets the number of attributes associated with the cached query.
Definition at line 330 of file TheWarehouse.h.
|
inline |
Definition at line 234 of file TheWarehouse.h.
|
inline |
Copy constructor from another Query.
Definition at line 255 of file TheWarehouse.h.
|
inline |
queryInto executes the query and stores the results in the given vector.
For parametrized queries (i.e. QueryCaches created with more than zero template arguments) args must contain one value for each parametrized query attribute - the types of args should be equal to the ::Key typedef specified for each corresponding parametrized attribute. All results must be castable to the templated type T. If the objects we are querying into inherit from the dependency resolver interface, then they will be sorted
Definition at line 311 of file TheWarehouse.h.
Referenced by LinearSystem::containsTimeKernel(), NonlinearSystemBase::customSetup(), ComputeResidualAndJacobianThread::determineObjectWarehouses(), NonlinearSystemBase::initialSetup(), FEProblemBase::initialSetup(), ComputeUserObjectsThread::queryBoundary(), ComputeUserObjectsThread::querySubdomain(), NonlinearThread::subdomainChanged(), and NonlinearSystemBase::timestepSetup().
|
inlineprivate |
queryInto executes the query and stores the results in the given vector.
For parametrized queries (i.e. QueryCaches created with more than zero template arguments) args must contain one value for each parametrized query attribute - the types of args should be equal to the ::Key typedef specified for each corresponding parametrized attribute. All results must be castable to the templated type T. If the objects we are querying into inherit from the dependency resolver interface, then they will be sorted if sort
is true
Definition at line 342 of file TheWarehouse.h.
Referenced by TheWarehouse::QueryCache< AttribThread, AttribBoundaries, AttribInterfaces >::queryInto(), and TheWarehouse::QueryCache< AttribThread, AttribBoundaries, AttribInterfaces >::queryIntoUnsorted().
|
inline |
queryInto executes the query and stores the results in the given vector.
For parametrized queries (i.e. QueryCaches created with more than zero template arguments) args must contain one value for each parametrized query attribute - the types of args should be equal to the ::Key typedef specified for each corresponding parametrized attribute. All results must be castable to the templated type T. These objects will not be sorted
Definition at line 324 of file TheWarehouse.h.
Referenced by FEProblemBase::computeUserObjectsInternal().
|
inlineprivate |
Definition at line 390 of file TheWarehouse.h.
|
inlineprivate |
Definition at line 396 of file TheWarehouse.h.
Referenced by TheWarehouse::QueryCache< AttribThread, AttribBoundaries, AttribInterfaces >::setAttribsInner().
|
inlineprivate |
Definition at line 379 of file TheWarehouse.h.
|
inlineprivate |
Definition at line 385 of file TheWarehouse.h.
Referenced by TheWarehouse::QueryCache< AttribThread, AttribBoundaries, AttribInterfaces >::setKeysInner().
|
inline |
Definition at line 297 of file TheWarehouse.h.
|
private |
Definition at line 404 of file TheWarehouse.h.
Referenced by TheWarehouse::QueryCache< AttribThread, AttribBoundaries, AttribInterfaces >::addAttribs(), and TheWarehouse::QueryCache< AttribThread, AttribBoundaries, AttribInterfaces >::setAttribsInner().
|
private |
Definition at line 401 of file TheWarehouse.h.
Referenced by TheWarehouse::QueryCache< AttribThread, AttribBoundaries, AttribInterfaces >::addAttribs(), TheWarehouse::QueryCache< AttribThread, AttribBoundaries, AttribInterfaces >::attributes(), TheWarehouse::QueryCache< AttribThread, AttribBoundaries, AttribInterfaces >::condition(), TheWarehouse::QueryCache< AttribThread, AttribBoundaries, AttribInterfaces >::count(), TheWarehouse::QueryCache< AttribThread, AttribBoundaries, AttribInterfaces >::numAttribs(), TheWarehouse::QueryCache< AttribThread, AttribBoundaries, AttribInterfaces >::operator=(), TheWarehouse::QueryCache< AttribThread, AttribBoundaries, AttribInterfaces >::QueryCache(), and TheWarehouse::QueryCache< AttribThread, AttribBoundaries, AttribInterfaces >::queryIntoHelper().
|
private |
Definition at line 405 of file TheWarehouse.h.
Referenced by TheWarehouse::QueryCache< AttribThread, AttribBoundaries, AttribInterfaces >::condition(), and TheWarehouse::QueryCache< AttribThread, AttribBoundaries, AttribInterfaces >::queryIntoHelper().
|
private |
Definition at line 406 of file TheWarehouse.h.
Referenced by TheWarehouse::QueryCache< AttribThread, AttribBoundaries, AttribInterfaces >::queryIntoHelper().
|
private |
Definition at line 403 of file TheWarehouse.h.
Referenced by TheWarehouse::QueryCache< AttribThread, AttribBoundaries, AttribInterfaces >::operator=(), TheWarehouse::QueryCache< AttribThread, AttribBoundaries, AttribInterfaces >::queryIntoHelper(), and TheWarehouse::QueryCache< AttribThread, AttribBoundaries, AttribInterfaces >::setKeysInner().
|
private |
Definition at line 400 of file TheWarehouse.h.
Referenced by TheWarehouse::QueryCache< AttribThread, AttribBoundaries, AttribInterfaces >::addAttribs(), TheWarehouse::QueryCache< AttribThread, AttribBoundaries, AttribInterfaces >::condition(), TheWarehouse::QueryCache< AttribThread, AttribBoundaries, AttribInterfaces >::count(), TheWarehouse::QueryCache< AttribThread, AttribBoundaries, AttribInterfaces >::operator=(), TheWarehouse::QueryCache< AttribThread, AttribBoundaries, AttribInterfaces >::queryIntoHelper(), and TheWarehouse::QueryCache< AttribThread, AttribBoundaries, AttribInterfaces >::warehouse().