35 #include <boost/core/ignore_unused.hpp>
46 std::string FilterThresholdMin::className =
48 "ThresholdMin", FilterThresholdMin::create);
54 FilterThresholdMin::FilterThresholdMin(
56 const std::weak_ptr<EquationSystem> &pEquation,
58 :
Filter(pSession, pEquation)
61 auto it = pParams.find(
"ThresholdValue");
62 ASSERTL0(it != pParams.end(),
"Missing parameter 'ThresholdValue'.");
68 it = pParams.find(
"InitialValue");
69 ASSERTL0(it != pParams.end(),
"Missing parameter 'InitialValue'.");
75 it = pParams.find(
"StartTime");
77 if (it != pParams.end())
85 it = pParams.find(
"OutputFile");
87 if (it != pParams.end())
93 it = pParams.find(
"ThresholdVar");
95 if (it != pParams.end())
97 std::string var = it->second.c_str();
98 std::vector<string> varlist = pSession->GetVariables();
99 auto x =
std::find(varlist.begin(), varlist.end(), var);
101 "Specified variable " + var +
102 " in ThresholdMin filter is not available.");
126 boost::ignore_unused(time);
166 boost::ignore_unused(time);
168 std::stringstream vOutputFilename;
171 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef
172 = pFields[0]->GetFieldDefinitions();
173 std::vector<std::vector<NekDouble> > FieldData(FieldDef.size());
176 pFields[0]->FwdTrans_IterPerExp(
m_threshold, vCoeffs);
179 for(
int i = 0; i < FieldDef.size(); ++i)
182 FieldDef[i]->m_fields.push_back(
"m");
183 pFields[0]->AppendFieldData(FieldDef[i], FieldData[i], vCoeffs);
186 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.
LibUtilities::FieldIOSharedPtr m_fld
FieldIO object for writing data.
virtual SOLVER_UTILS_EXPORT void v_Initialise(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time)
Initialises the filter.
NekDouble m_initialValue
Initial value of storage.
virtual SOLVER_UTILS_EXPORT ~FilterThresholdMin()
virtual SOLVER_UTILS_EXPORT bool v_IsTimeDependent()
Indicate that this filter is time dependent.
std::string m_outputFile
File into which to write output data.
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)
For each point in domain test if solution is below threshold.
virtual SOLVER_UTILS_EXPORT void v_Finalise(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time)
Finalise the filter and write out data.
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.