#include "gmxpre.h"
+#include "gromacs/mdlib/stat.h"
+
#include "compositesimulatorelement.h"
namespace gmx
{
CompositeSimulatorElement::CompositeSimulatorElement(
std::vector<compat::not_null<ISimulatorElement*>> elementCallList,
- std::vector<std::unique_ptr<gmx::ISimulatorElement>> elements) :
- elementCallList_(std::move(elementCallList)), elementOwnershipList_(std::move(elements))
+ std::vector<std::unique_ptr<gmx::ISimulatorElement>> elements,
+ int frequency) :
+ elementCallList_(std::move(elementCallList)),
+ elementOwnershipList_(std::move(elements)),
+ frequency_(frequency)
{
}
void CompositeSimulatorElement::scheduleTask(Step step, Time time, const RegisterRunFunction& registerRunFunction)
{
- for (auto& element : elementCallList_)
+ if (do_per_step(step, frequency_))
{
- element->scheduleTask(step, time, registerRunFunction);
+ for (auto& element : elementCallList_)
+ {
+ element->scheduleTask(step, time, registerRunFunction);
+ }
}
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020,2021, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
public:
//! Constructor
explicit CompositeSimulatorElement(std::vector<compat::not_null<ISimulatorElement*>> elementCallList,
- std::vector<std::unique_ptr<ISimulatorElement>> elements);
+ std::vector<std::unique_ptr<ISimulatorElement>> elements,
+ int frequency);
/*! \brief Register run function for step / time
*
std::vector<compat::not_null<ISimulatorElement*>> elementCallList_;
//! List of elements owned by composite element
std::vector<std::unique_ptr<ISimulatorElement>> elementOwnershipList_;
+ //! The frequency at which the composite element is running
+ const int frequency_;
};
} // namespace gmx