roadrunner
2.6.0
Fast simulator for SBML models
|
Hash table designed for storing RoadRunner models. More...
#include <rrRoadRunnerMap.h>
Public Member Functions | |
RoadRunnerMap ()=default | |
Default construct a RoadRunnerMap. More... | |
RoadRunnerMap (const std::vector< std::string > &sbmlStringsOrFiles, unsigned int numThreads) | |
Instantiate a RoadRunnerMap from a. More... | |
std::vector< std::string > | getKeys () const |
Returns the keys of the map in order of insertion. More... | |
std::vector< RoadRunner * > | getValues () const |
return values of the map as a RoadRunnervector. More... | |
std::vector< std::pair< std::string, RoadRunner * > > | getItems () const |
get items of this map as vector of std::pair<std::string, RoadRuner*> types. More... | |
void | insert (std::unique_ptr< RoadRunner > roadRunner) |
Insert a. More... | |
void | insert (const std::string &key, std::unique_ptr< RoadRunner > roadRunner) |
The same as the std::unique_ptr<RoadRunner> overload but with a user provided key. More... | |
void | insert (const std::string &sbmlOrFile) |
insert a roadrunner model into the map using the model name as key. More... | |
void | insert (const std::string &key, const std::string &sbmlOrFile) |
insert a roadrunner model into the map using a user define key. More... | |
void | insert (const std::vector< std::string > &sbmlStringsOrFiles) |
Like the "insert(const std::string &sbmlOrFile);" overload, but pass in a vector of sbml file or sbml strings. More... | |
void | erase (const std::string &key) |
remove an element with More... | |
ThreadSafeUnorderedMap::iterator | begin () |
map iterator More... | |
ThreadSafeUnorderedMap::const_iterator | begin () const |
ThreadSafeUnorderedMap::iterator | end () |
ThreadSafeUnorderedMap::const_iterator | end () const |
ThreadSafeUnorderedMap::iterator | find (const std::string &key) |
find item with key equal to More... | |
ThreadSafeUnorderedMap::const_iterator | find (const std::string &key) const |
find item with key equal to More... | |
bool | empty () const |
return true if the map is empty | |
unsigned int | size () const |
returns the number of elements in the map | |
void | clear () |
empty the map so that there are 0 elements left | |
RoadRunner * | operator[] (const std::string &key) |
Getter operator. More... | |
RoadRunner * | at (const std::string &key) |
get borrowed reference from map for roadrunner model with key equal to More... | |
RoadRunner * | at (const std::string &key) const |
void | wait_for_tasks () |
wait for all tasks to finish before allowing program execution to continue | |
size_t | count (const std::string &key) |
count the number of keys with value More... | |
void | setNumThreads (unsigned int n) |
Reset the number of threads in the pool. More... | |
unsigned int | getNumThreads () const |
get the number of threds in the thread_pool | |
Hash table designed for storing RoadRunner models.
Expensive operations like building models are done in parallel.
Loading RoadRunner models requires expensive builds, which can be prohibitive when loading many models. RoadRunnerMap is a container for RoadRunner objects which abstracts the process of loading or simulating in parallel.
|
default |
Default construct a RoadRunnerMap.
The default number of threads is 1, which can be changed with RoadRunnerMap::setNumThreads.
|
explicit |
Instantiate a RoadRunnerMap from a.
sbmlStringsOrFiles | vector of sbml files, sbml strings or a mix thereof. |
numThreads | How many threads to use, if 1, the overhead of setting up multithreading pool is avoided. |
RoadRunner * rr::RoadRunnerMap::at | ( | const std::string & | key | ) |
get borrowed reference from map for roadrunner model with key equal to
key | . |
returned pointer is owned by the RoadRunnerMap object.
ThreadSafeUnorderedMap::iterator rr::RoadRunnerMap::begin | ( | ) |
map iterator
or
size_t rr::RoadRunnerMap::count | ( | const std::string & | key | ) |
count the number of keys with value
key | . |
Because there can be only 1 element with a particular key in the map, the return value of count is guarenteed to be either 0 for not found, or 1 for found.
ThreadSafeUnorderedMap::iterator rr::RoadRunnerMap::end | ( | ) |
void rr::RoadRunnerMap::erase | ( | const std::string & | key | ) |
remove an element with
key | from the map |
ThreadSafeUnorderedMap::iterator rr::RoadRunnerMap::find | ( | const std::string & | key | ) |
find item with key equal to
key | . |
ThreadSafeUnorderedMap::const_iterator rr::RoadRunnerMap::find | ( | const std::string & | key | ) | const |
find item with key equal to
key | . Const version. |
std::vector< std::pair< std::string, RoadRunner * > > rr::RoadRunnerMap::getItems | ( | ) | const |
get items of this map as vector of std::pair<std::string, RoadRuner*> types.
pointers are owned by the RoadRunnerMap – so do not delete. O(N).
std::vector< std::string > rr::RoadRunnerMap::getKeys | ( | ) | const |
Returns the keys of the map in order of insertion.
Does a linear search over hashmap to build a vector of keys O(N).
std::vector< RoadRunner * > rr::RoadRunnerMap::getValues | ( | ) | const |
return values of the map as a RoadRunnervector.
the RoadRunner* instances are still owned by the RoadRunnerMap Linear complexity in the size of the map.
void rr::RoadRunnerMap::insert | ( | const std::string & | key, |
const std::string & | sbmlOrFile | ||
) |
insert a roadrunner model into the map using a user define key.
key | The string to use for the key to the roadrunner model you are inserting. |
sbmlOrFile | either a sbml string or a valid file path to a sbml file. |
void rr::RoadRunnerMap::insert | ( | const std::string & | key, |
std::unique_ptr< RoadRunner > | roadRunner | ||
) |
The same as the std::unique_ptr<RoadRunner> overload but with a user provided key.
void rr::RoadRunnerMap::insert | ( | const std::string & | sbmlOrFile | ) |
insert a roadrunner model into the map using the model name as key.
sbmlOrFile | either a sbml string or a valid file path to a sbml file. |
void rr::RoadRunnerMap::insert | ( | const std::vector< std::string > & | sbmlStringsOrFiles | ) |
Like the "insert(const std::string &sbmlOrFile);" overload, but pass in a vector of sbml file or sbml strings.
void rr::RoadRunnerMap::insert | ( | std::unique_ptr< RoadRunner > | roadRunner | ) |
Insert a.
roadRunner | roadrunner model into the map. |
The model must already be a unique pointer. The key for accessing the map will be the model name. Loading another model with the same name will overwrite the original.
RoadRunner * rr::RoadRunnerMap::operator[] | ( | const std::string & | key | ) |
Getter operator.
Returns a borrowed reference to a roadruner model that is owned by the RoadRunnerMap.
void rr::RoadRunnerMap::setNumThreads | ( | unsigned int | n | ) |
Reset the number of threads in the pool.