Cantera  3.1.0b1
Loading...
Searching...
No Matches
ValueCache.cpp
Go to the documentation of this file.
1/**
2 * @file ValueCache.cpp
3 */
4
5// This file is part of Cantera. See License.txt in the top-level directory or
6// at https://cantera.org/license.txt for license and copyright information.
7
9#include <mutex>
10
11namespace
12{
13std::mutex id_mutex;
14}
15
16namespace Cantera
17{
18
20
22{
23 std::unique_lock<std::mutex> lock(id_mutex);
24 return ++m_last_id;
25}
26
28{
29 m_scalarCache.clear();
30 m_arrayCache.clear();
31}
32
33}
int getId()
Get a unique id for a cached value.
map< int, CachedValue< double > > m_scalarCache
Cached scalar values.
Definition ValueCache.h:179
void clear()
Clear all cached values.
static int m_last_id
The last assigned id. Automatically incremented by the getId() method.
Definition ValueCache.h:185
map< int, CachedValue< vector< double > > > m_arrayCache
Cached array values.
Definition ValueCache.h:182
Namespace for the Cantera kernel.
Definition AnyMap.cpp:595