Skip to content

Commit

Permalink
Merge branch 'v2.8' into v2.9
Browse files Browse the repository at this point in the history
  • Loading branch information
GiovanniBussi committed Feb 22, 2024
2 parents 9ff970d + 662681e commit 546190f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
17 changes: 17 additions & 0 deletions src/tools/PlumedHandle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,21 @@ void PlumedHandle::cmd(const std::string & key,const TypesafePtr & ptr) {
} else plumed_error() << "should never arrive here (either one or the other should work)";
}

PlumedHandle::PlumedHandle(PlumedHandle && other) noexcept:
local(std::move(other.local)),
loaded(other.loaded)
{
other.loaded=nullptr;
}

PlumedHandle & PlumedHandle::operator=(PlumedHandle && other) noexcept {
if(this!=&other) {
if(loaded) plumed_finalize(plumed_v2c(loaded));
local=std::move(other.local);
loaded=other.loaded;
other.loaded=nullptr;
}
return *this;
}

}
6 changes: 4 additions & 2 deletions src/tools/PlumedHandle.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class PlumedHandle :
/// Used when using the current kernel in order to avoid unneeded indirections.
std::unique_ptr<PlumedMain> local;
/// Pointer to loaded Plumed object;
void* const loaded=nullptr;
void* loaded=nullptr;
/// Constructor using the path to a kernel.
/// I keep it private to avoid confusion wrt the
/// similar constructor of PLMD::Plumed that accepts a string (conversion from FORTRAN).
Expand All @@ -94,7 +94,9 @@ class PlumedHandle :
/// I make it virtual for future extensibility, though this is not necessary now.
virtual ~PlumedHandle();
/// Move constructor.
PlumedHandle(PlumedHandle &&) = default;
PlumedHandle(PlumedHandle && other) noexcept;
/// Move assignment.
PlumedHandle & operator=(PlumedHandle && other) noexcept;
/// Execute cmd.
void cmd(const std::string & key,const TypesafePtr & ptr=nullptr);
/// Bring in the possibility to pass shape/nelem
Expand Down

1 comment on commit 546190f

@PlumedBot
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found broken examples in automatic/a-masterclass-22-09.txt
Found broken examples in automatic/a-masterclass-22-11.txt
Found broken examples in automatic/a-masterclass-22-12.txt
Found broken examples in automatic/performance-optimization.txt
Found broken examples in automatic/a-trieste-6.txt
Found broken examples in automatic/munster.txt
Found broken examples in automatic/ANN.tmp
Found broken examples in automatic/EDS.tmp
Found broken examples in automatic/EMMI.tmp
Found broken examples in automatic/ENVIRONMENTSIMILARITY.tmp
Found broken examples in automatic/FOURIER_TRANSFORM.tmp
Found broken examples in automatic/FUNCPATHGENERAL.tmp
Found broken examples in automatic/FUNCPATHMSD.tmp
Found broken examples in automatic/FUNNEL.tmp
Found broken examples in automatic/FUNNEL_PS.tmp
Found broken examples in automatic/GHBFIX.tmp
Found broken examples in automatic/INCLUDE.tmp
Found broken examples in automatic/MAZE_OPTIMIZER_BIAS.tmp
Found broken examples in automatic/MAZE_RANDOM_ACCELERATION_MD.tmp
Found broken examples in automatic/MAZE_SIMULATED_ANNEALING.tmp
Found broken examples in automatic/MAZE_STEERED_MD.tmp
Found broken examples in automatic/PIV.tmp
Found broken examples in automatic/PLUMED.tmp
Found broken examples in MiscelaneousPP.md

Please sign in to comment.