File tree Expand file tree Collapse file tree 3 files changed +23
-7
lines changed
Expand file tree Collapse file tree 3 files changed +23
-7
lines changed Original file line number Diff line number Diff line change @@ -835,3 +835,12 @@ void ArbLattice::debugDumpVTU() const {
835835 vtu_file.writeFooters ();
836836 }
837837}
838+
839+ void ArbLattice::resetAverage (){
840+ data.reset_iter = data.iter ;
841+ for (const Model::Field& f : model->fields ) {
842+ if (f.isAverage ) {
843+ CudaMemset (&getSnapPtr (Snap)[f.id *sizes.snaps_pitch ], 0 , sizes.snaps_pitch *sizeof (real_t ));
844+ }
845+ }
846+ }
Original file line number Diff line number Diff line change @@ -100,6 +100,8 @@ class ArbLattice : public LatticeBase {
100100 const ArbLatticeConnectivity& getConnectivity () const { return connect; }
101101 const std::vector<unsigned >& getLocalPermutation () const { return local_permutation; }
102102
103+ void resetAverage ();
104+
103105 protected:
104106 ArbLatticeLauncher launcher; // / Launcher responsible for running CUDA kernels on the lattice
105107 void SetFirstTabs (int tab0, int tab1);
Original file line number Diff line number Diff line change @@ -3,16 +3,21 @@ std::string cbAveraging::xmlname = "Average";
33#include " ../HandlerFactory.h"
44
55int cbAveraging::Init () {
6- Callback::Init ();
7- solver->getCartLattice ()->resetAverage ();
8- return 0 ;
9- }
6+ return Callback::Init ();
7+ }
108
119
1210int cbAveraging::DoIt () {
13- Callback::DoIt ();
14- solver->getCartLattice ()->resetAverage (); // reseting averages-storing densities and setting reset_iter to iter
15- return 0 ;
11+ Callback::DoIt ();
12+ const auto do_cartesian = [&](const Lattice<CartLattice>* lattice){
13+ solver->getCartLattice ()->resetAverage ();
14+ return EXIT_SUCCESS;
15+ };
16+ const auto do_arbitrary = [&](const Lattice<ArbLattice>* lattice){
17+ solver->getArbLattice ()->resetAverage ();
18+ return EXIT_SUCCESS;
19+ };
20+ return std::visit (OverloadSet{do_cartesian, do_arbitrary}, solver->getLatticeVariant ());
1621 }
1722
1823
You can’t perform that action at this time.
0 commit comments