110 if (
this != &cache) {
173 #if defined(G_DEBUG_VECTOR_CACHE)
174 std::cout <<
"GResponseVectorCache::set(";
175 std::cout << cache_id <<
"," << vector.
size() <<
"):";
179 double* values = NULL;
189 #if defined(G_DEBUG_VECTOR_CACHE)
191 std::cout <<
" entry found at index " << index;
193 std::cout <<
" Require " << entries <<
" elements.";
194 std::cout << std::endl;
197 std::cout <<
" no entry found.";
198 std::cout <<
" Require " << entries <<
" elements.";
199 std::cout << std::endl;
207 values =
new double[entries];
208 indices =
new int[entries];
222 values =
new double[entries];
223 indices =
new int[entries];
238 for (
int i = 0; i < vector.
size(); ++i) {
239 if (vector[i] != 0.0) {
240 *values++ = vector[i];
299 #if defined(G_DEBUG_VECTOR_CACHE)
300 std::cout <<
"GResponseVectorCache::contains(" << cache_id;
301 if (vector == NULL) {
302 std::cout <<
", NULL):";
305 std::cout <<
"," << vector->
size() <<
"):";
316 #if defined(G_DEBUG_VECTOR_CACHE)
318 std::cout <<
" entry found at index " << index;
320 std::cout << std::endl;
323 std::cout <<
" no entry found." << std::endl;
329 if (contains && vector != NULL) {
336 for (
int i = 0; i <
m_cache_entries[index]; ++i, ++values, ++indices) {
337 (*vector)[*indices] = *values;
362 result.append(
"=== GResponseVectorCache ===");
369 for (
int i = 0; i <
size(); ++i) {
416 for (
int i = 0; i <
size(); ++i) {
417 double* values = NULL;
421 indices =
new int[m_cache_entries[i]];
422 for (
int k = 0; k < m_cache_entries[i]; ++k) {
442 for (
int i = 0; i <
size(); ++i) {
GResponseVectorCache(void)
Void constructor.
Response vector cache class.
std::vector< int > m_cache_entries
std::string print(const GChatter &chatter=NORMAL) const
Print response cache.
void set(const std::string &cache_id, const GVector &vector)
Set cache value.
virtual ~GResponseVectorCache(void)
Destructor.
void init_members(void)
Initialise class members.
std::vector< double * > m_cache_values
int size(void) const
Returns size of vector chache.
int find_cache(const std::string &cache_id) const
Find cache.
void free_members(void)
Delete class members.
GResponseVectorCache * clone(void) const
Clone response cache.
int non_zeros(void) const
Returns number of non-zero elements in vector.
GResponseVectorCache & operator=(const GResponseVectorCache &cache)
Assignment operator.
Response vector cache class definition.
void remove(const std::string &cache_id)
Remove cache.
Vector class interface definition.
void copy_members(const GResponseVectorCache &cache)
Copy class members.
void clear(void)
Clear response vector cache.
bool contains(const std::string &cache_id, GVector *irfs=NULL) const
Check if cache contains a value for specific parameters.
std::vector< int * > m_cache_indices
const int & size(void) const
Return size of vector.
std::string parformat(const std::string &s, const int &indent=0)
Convert string in parameter format.
std::vector< std::string > m_cache_ids
std::string str(const unsigned short int &value)
Convert unsigned short integer value into string.