Closed Ithanil closed 5 years ago
Changes Missing Coverage | Covered Lines | Changed/Added Lines | % | ||
---|---|---|---|---|---|
include/mci/DependentObservableInterface.hpp | 0 | 1 | 0.0% | ||
include/mci/Factories.hpp | 3 | 4 | 75.0% | ||
include/mci/ObservableFunctionInterface.hpp | 3 | 4 | 75.0% | ||
src/ObservableContainer.cpp | 26 | 29 | 89.66% | ||
src/SamplingFunctionContainer.cpp | 0 | 3 | 0.0% | ||
include/mci/SamplingFunctionInterface.hpp | 0 | 4 | 0.0% | ||
src/MCIntegrator.cpp | 20 | 28 | 71.43% | ||
<!-- | Total: | 113 | 134 | 84.33% | --> |
Files with Coverage Reduction | New Missed Lines | % | ||
---|---|---|---|---|
src/MCIntegrator.cpp | 2 | 79.66% | ||
<!-- | Total: | 2 | --> |
Totals | |
---|---|
Change from base Build 153: | -0.5% |
Covered Lines: | 1103 |
Relevant Lines: | 1236 |
This PR includes: 1) General
2) Better support for observable-pdf and observable-observable dependencies
When adapting VMC it became apparent that there should be a mechanism to avoid hard-linking dependent objects together, specifically the case of observables depending on the sampling function or other observables.
One way would have been to pass references to the full sampling function/observable containers to all observables on every step (to let them read the required data). However, this would be somewhat inefficient due to: i) The need to check for and potentially throw exceptions on every call, although a check before the first sampling step would be enough. ii) In many cases the need to use dynamic_cast to safely infer a certain base type (beyond the MCI interface classes). The alternative static_cast would let certain errors go unchecked. iii) Generally extra argument overhead and unnecessary indirection to access the required data
Instead, observable classes may now also derive from DependentObservableInterface, which requires them to implement the methods registerDeps() and deregisterDeps(). These should handle the process described above, but are called only once by MCI on pre-integration allocation and post-integration deallocation respectively. During this time, any stored references are guaranteed to be valid. The mechanism is already used successfully in VMC.
3) Callbacks