35 #include <boost/core/ignore_unused.hpp>
46 std::string FilterThresholdMax::className =
48 FilterThresholdMax::create);
50 FilterThresholdMax::FilterThresholdMax(
52 const std::weak_ptr<EquationSystem> &pEquation,
const ParamMap &pParams)
53 :
Filter(pSession, pEquation)
56 auto it = pParams.find(
"ThresholdValue");
57 ASSERTL0(it != pParams.end(),
"Missing parameter 'ThresholdValue'.");
62 it = pParams.find(
"InitialValue");
63 ASSERTL0(it != pParams.end(),
"Missing parameter 'InitialValue'.");
68 it = pParams.find(
"StartTime");
70 if (it != pParams.end())
77 it = pParams.find(
"OutputFile");
79 if (it != pParams.end())
85 it = pParams.find(
"ThresholdVar");
87 if (it != pParams.end())
89 std::string var = it->second.c_str();
90 std::vector<string> varlist = pSession->GetVariables();
91 auto x =
std::find(varlist.begin(), varlist.end(), var);
93 "Specified variable " + var +
94 " in ThresholdMax filter is not available.");
109 boost::ignore_unused(time);
142 boost::ignore_unused(time);
144 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef =
146 std::vector<std::vector<NekDouble>> FieldData(FieldDef.size());
152 for (
int i = 0; i < FieldDef.size(); ++i)
155 FieldDef[i]->m_fields.push_back(
"m");
156 pFields[
m_thresholdVar]->AppendFieldData(FieldDef[i], FieldData[i],
#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
LibUtilities::FieldIOSharedPtr m_fld
FieldIO object for writing data.
virtual void v_Initialise(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time) override
Initialises the filter.
virtual void v_Update(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time) override
For each point in domain test if solution is above threshold.
virtual void v_Finalise(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time) override
Finalise the filter and write out data.
NekDouble m_startTime
Time at which to start recording.
std::string m_outputFile
File into which to write output data.
NekDouble m_initialValue
Initial value of storage.
Array< OneD, NekDouble > m_threshold
Storage for recording when each point in domain rises above threshold.
virtual bool v_IsTimeDependent() override
Indicate that this filter is time dependent.
int m_thresholdVar
Variable on which to detect threshold.
virtual SOLVER_UTILS_EXPORT ~FilterThresholdMax()
NekDouble m_thresholdValue
Value of threshold.
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.