Skip to content

Commit c29fc68

Browse files
committed
fix cache update bug
1 parent e233c59 commit c29fc68

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

core/base/discreteGradient/DiscreteGradient_Template.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ int DiscreteGradient::buildGradient(const triangulationType &triangulation,
7474
this->numberOfVertices_ = triangulation.getNumberOfVertices();
7575

7676
this->gradient_ = bypassCache ? &this->localGradient_ : findGradient();
77-
if(this->gradient_ == nullptr || bypassCache) {
77+
bool newParameters = (this->newBackend()) || (this->newSeed());
78+
if(this->gradient_ == nullptr || bypassCache || newParameters) {
7879

7980
if(!bypassCache) {
8081
// add new cache entry
@@ -93,13 +94,13 @@ int DiscreteGradient::buildGradient(const triangulationType &triangulation,
9394
} else if(this->BackEnd == BACKEND::STOCHASTIC_BACKEND) {
9495
this->processLowerStarsStochastic<dataType, triangulationType>(
9596
this->inputOffsets_, triangulation);
96-
this->printMsg("Build stochastic discrete gradient", 1.0,
97+
this->printMsg("Built discrete gradient (Stochastic elgorithm)", 1.0,
9798
tm.getElapsedTime(), this->threadNumber_);
9899

99100
} else if(this->BackEnd == BACKEND::CLASSIC_BACKEND) {
100101
this->processLowerStars(this->inputOffsets_, triangulation);
101-
this->printMsg("Built discrete gradient", 1.0, tm.getElapsedTime(),
102-
this->threadNumber_);
102+
this->printMsg("Built discrete gradient (Homotopic expansion algorithm)",
103+
1.0, tm.getElapsedTime(), this->threadNumber_);
103104
#ifdef TTK_ENABLE_MPI_TIME
104105
double elapsedTime
105106
= ttk::endMPITimer(t_mpi, ttk::MPIrank_, ttk::MPIsize_);

core/base/morseSmaleComplex/MorseSmaleComplex.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -481,11 +481,9 @@ int ttk::MorseSmaleComplex::execute(OutputCriticalPoints &outCP,
481481
== DiscreteGradient::BACKEND::STOCHASTIC_BACKEND) {
482482
this->discreteGradient_.setSeed(seed);
483483
}
484-
bool bypassCache = this->ReturnSaddleConnectors
485-
|| (discreteGradient_.newBackend())
486-
|| (discreteGradient_.newSeed());
484+
487485
this->discreteGradient_.buildGradient<dataType, triangulationType>(
488-
triangulation, bypassCache, nullptr);
486+
triangulation, this->ReturnSaddleConnectors);
489487
if(this->ReturnSaddleConnectors) {
490488
auto persistenceThreshold{this->SaddleConnectorsPersistenceThreshold};
491489
if(!this->ThresholdIsAbsolute) {

0 commit comments

Comments
 (0)