35#include <boost/core/ignore_unused.hpp>
55 const std::weak_ptr<EquationSystem> &pEquation,
const ParamMap &pParams)
56 :
Filter(pSession, pEquation)
59 auto it = pParams.find(
"ThresholdValue");
60 ASSERTL0(it != pParams.end(),
"Missing parameter 'ThresholdValue'.");
65 it = pParams.find(
"InitialValue");
66 ASSERTL0(it != pParams.end(),
"Missing parameter 'InitialValue'.");
71 it = pParams.find(
"StartTime");
73 if (it != pParams.end())
80 it = pParams.find(
"OutputFile");
82 if (it != pParams.end())
88 it = pParams.find(
"ThresholdVar");
90 if (it != pParams.end())
92 std::string var = it->second.c_str();
93 std::vector<string> varlist = pSession->GetVariables();
94 auto x =
std::find(varlist.begin(), varlist.end(), var);
96 "Specified variable " + var +
97 " in ThresholdMin filter is not available.");
118 boost::ignore_unused(time);
157 boost::ignore_unused(time);
159 std::stringstream vOutputFilename;
162 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef =
163 pFields[0]->GetFieldDefinitions();
164 std::vector<std::vector<NekDouble>> FieldData(FieldDef.size());
167 pFields[0]->FwdTransLocalElmt(
m_threshold, vCoeffs);
170 for (
int i = 0; i < FieldDef.size(); ++i)
173 FieldDef[i]->m_fields.push_back(
"m");
174 pFields[0]->AppendFieldData(FieldDef[i], FieldData[i], vCoeffs);
177 m_fld->Write(vOutputFilename.str(), FieldDef, FieldData);
#define ASSERTL0(condition, msg)
NekDouble Evaluate() const
static std::shared_ptr< FieldIO > CreateDefault(const LibUtilities::SessionReaderSharedPtr session)
Returns an object for the default FieldIO method.
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
LibUtilities::SessionReaderSharedPtr m_session
std::map< std::string, std::string > ParamMap
NekDouble m_thresholdValue
Value of threshold.
static std::string className
Name of the class.
LibUtilities::FieldIOSharedPtr m_fld
FieldIO object for writing data.
virtual SOLVER_UTILS_EXPORT void v_Finalise(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time) override
Finalise the filter and write out data.
NekDouble m_initialValue
Initial value of storage.
virtual SOLVER_UTILS_EXPORT ~FilterThresholdMin()
SOLVER_UTILS_EXPORT FilterThresholdMin(const LibUtilities::SessionReaderSharedPtr &pSession, const std::weak_ptr< EquationSystem > &pEquation, const ParamMap &pParams)
std::string m_outputFile
File into which to write output data.
virtual SOLVER_UTILS_EXPORT void v_Initialise(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time) override
Initialises the filter.
virtual SOLVER_UTILS_EXPORT bool v_IsTimeDependent() override
Indicate that this filter is time dependent.
Array< OneD, NekDouble > m_threshold
Storage for recording when each point in domain drops below threshold.
virtual SOLVER_UTILS_EXPORT void v_Update(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time) override
For each point in domain test if solution is below threshold.
static FilterSharedPtr create(const LibUtilities::SessionReaderSharedPtr &pSession, const std::weak_ptr< EquationSystem > &pEquation, const ParamMap &pParams)
Creates an instance of this class.
int m_thresholdVar
Variable on which to detect threshold.
NekDouble m_startTime
Time at which to start recording.
std::shared_ptr< SessionReader > SessionReaderSharedPtr
FilterFactory & GetFilterFactory()
InputIterator find(InputIterator first, InputIterator last, InputIterator startingpoint, const EqualityComparable &value)
The above copyright notice and this permission notice shall be included.