Commit 6857ea159a41c1fa1f37c010aa85f69dbadd7b61

Authored by Jürgen Knödlseder
1 parent 80f09635

Fix response cache removal for vector cache (#3499)

ChangeLog
1   -2020-12-02
  1 +2021-01-14
2 2  
3 3 * Version 2.0.0 released
4 4 ========================
5 5  
  6 + Fix response cache removal for vector cache (#3499)
6 7 Add GModelAssociation and GModelAssociations classes (#3469)
7 8 Add GSkyMap::correlate() method (#3461)
8 9 Add GModels::eval() vector evaluation method (#3455)
... ...
1 1 New Features and Important Changes in GammaLib 2.0.0
2 2  
3   -2 December 2020
  3 +14 January 2021
4 4  
5 5  
6 6 1. Introduction
... ... @@ -136,6 +136,9 @@ of functions (#3328).
136 136  
137 137 10. Observation module
138 138 ----------------------
  139 +Add source removal from vector cache to GResponse::remove_response_cache()
  140 +method (#3499).
  141 +
139 142 The GResponseVectorCache class was added to handle caching of the vector response.
140 143 Only non-zero IRF values are stored by the class. The class was integrated in the
141 144 GResponse class (#3403).
... ...
README.md
1 1 GammaLib information
2 2 ====================
3   -* Version: 2.0.0.dev (2 December 2020)
  3 +* Version: 2.0.0.dev (14 January 2021)
4 4  
5 5 [![Build Status](https://cta-jenkins.irap.omp.eu/buildStatus/icon?job=gammalib-integrate-os)](https://cta-jenkins.irap.omp.eu/job/gammalib-integrate-os/)
6 6  
... ...
doc/source/admin/release_history/2.0.rst
1 1 .. _2.0:
2 2  
3   -GammaLib 2.0 release (27 November 2020)
4   -=======================================
  3 +GammaLib 2.0 release (14 January 2021)
  4 +======================================
5 5  
6 6 Overview
7 7 --------
... ... @@ -17,6 +17,8 @@ In particular, this release provides:
17 17 Bug fixes
18 18 ---------
19 19  
  20 +* [`3499 <https://cta-redmine.irap.omp.eu/issues/3499>`_] -
  21 + Fix response cache removal for vector cache
20 22 * Fix ``GSkyMap::stack_maps()`` method for WCS maps
21 23 * [`3417 <https://cta-redmine.irap.omp.eu/issues/3417>`_] -
22 24 Correct application elapsed CPU time for OpenMP
... ...
inst/com/src/GCOMObservation.cpp
1 1 /***************************************************************************
2 2 * GCOMObservation.cpp - COMPTEL Observation class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2012-2020 by Juergen Knoedlseder *
  4 + * copyright (C) 2012-2021 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -734,6 +734,12 @@ void GCOMObservation::remove_response_cache(const std::string&amp; name)
734 734 m_drms.erase(m_drms.begin()+index);
735 735 }
736 736  
  737 + // Build model name
  738 + std::string model_name = id() + ":" + name;
  739 +
  740 + // Remove response cache
  741 + const_cast<GCOMResponse*>(this->response())->remove_response_cache(model_name);
  742 +
737 743 // Return
738 744 return;
739 745 }
... ...
inst/cta/include/GCTAObservation.hpp
1 1 /***************************************************************************
2 2 * GCTAObservation.hpp - CTA Observation class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2010-2019 by Juergen Knoedlseder *
  4 + * copyright (C) 2010-2021 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -97,9 +97,6 @@ public:
97 97 virtual void write(GXmlElement& xml) const;
98 98 virtual std::string print(const GChatter& chatter = NORMAL) const;
99 99  
100   - // Implement virtual methods
101   - virtual void remove_response_cache(const std::string& name);
102   -
103 100 // Other methods
104 101 void instrument(const std::string& instrument);
105 102 bool has_response(void) const;
... ...
inst/cta/pyext/GCTAObservation.i
1 1 /***************************************************************************
2 2 * GCTAObservation.i - CTA Observation class interface *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2010-2019 by Juergen Knoedlseder *
  4 + * copyright (C) 2010-2021 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -64,9 +64,6 @@ public:
64 64 virtual void read(const GXmlElement& xml);
65 65 virtual void write(GXmlElement& xml) const;
66 66  
67   - // Implement virtual methods
68   - virtual void remove_response_cache(const std::string& name);
69   -
70 67 // Other methods
71 68 void instrument(const std::string& instrument);
72 69 bool has_response(void) const;
... ...
inst/cta/src/GCTAObservation.cpp
1 1 /***************************************************************************
2 2 * GCTAObservation.cpp - CTA Observation class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2010-2019 by Juergen Knoedlseder *
  4 + * copyright (C) 2010-2021 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -1419,26 +1419,6 @@ void GCTAObservation::dispose_events(void)
1419 1419  
1420 1420  
1421 1421 /***********************************************************************//**
1422   - * @brief Remove response cache for model
1423   - *
1424   - * @param[in] name Model name.
1425   - *
1426   - * Remove response cache for model @p name from response cache.
1427   - ***************************************************************************/
1428   -void GCTAObservation::remove_response_cache(const std::string& name)
1429   -{
1430   - // Build model name
1431   - std::string model_name = id() + "::" + name;
1432   -
1433   - // Remove response cache
1434   - const_cast<GCTAResponse*>(this->response())->remove_response_cache(model_name);
1435   -
1436   - // Return
1437   - return;
1438   -}
1439   -
1440   -
1441   -/***********************************************************************//**
1442 1422 * @brief Print CTA observation information
1443 1423 *
1444 1424 * @param[in] chatter Chattiness.
... ...
src/obs/GObservation.cpp
1 1 /***************************************************************************
2 2 * GObservation.cpp - Abstract observation base class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2008-2020 by Juergen Knoedlseder *
  4 + * copyright (C) 2008-2021 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -1181,13 +1181,16 @@ double GObservation::npred_grad(const GModel&amp; model, const GModelPar&amp; par) const
1181 1181 *
1182 1182 * @param[in] name Model name.
1183 1183 *
1184   - * This is a response cache removal hook that is called by the
1185   - * GObservations::remove_response_cache() methods and that can be used to
1186   - * remove the model @p name from a response cache, if implemented in the
1187   - * derived class.
  1184 + * Remove response cache for model @p name from response cache.
1188 1185 ***************************************************************************/
1189 1186 void GObservation::remove_response_cache(const std::string& name)
1190 1187 {
  1188 + // Build model name
  1189 + std::string model_name = id() + ":" + name;
  1190 +
  1191 + // Remove response cache
  1192 + const_cast<GResponse*>(this->response())->remove_response_cache(model_name);
  1193 +
1191 1194 // Return
1192 1195 return;
1193 1196 }
... ...
src/obs/GResponse.cpp
1 1 /***************************************************************************
2 2 * GResponse.cpp - Abstract response base class *
3 3 * ----------------------------------------------------------------------- *
4   - * copyright (C) 2008-2020 by Juergen Knoedlseder *
  4 + * copyright (C) 2008-2021 by Juergen Knoedlseder *
5 5 * ----------------------------------------------------------------------- *
6 6 * *
7 7 * This program is free software: you can redistribute it and/or modify *
... ... @@ -736,6 +736,7 @@ void GResponse::remove_response_cache(const std::string&amp; name)
736 736 // Remove model from response caches
737 737 m_irf_cache.remove(name);
738 738 m_nroi_cache.remove(name);
  739 + m_irf_vector_cache.remove(name);
739 740  
740 741 // Return
741 742 return;
... ...