51 const std::shared_ptr<EquationSystem> &pEquation,
const ParamMap &pParams)
52 :
Filter(pSession, pEquation)
55 auto it = pParams.find(
"ThresholdValue");
56 ASSERTL0(it != pParams.end(),
"Missing parameter 'ThresholdValue'.");
61 it = pParams.find(
"InitialValue");
62 ASSERTL0(it != pParams.end(),
"Missing parameter 'InitialValue'.");
67 it = pParams.find(
"StartTime");
69 if (it != pParams.end())
76 it = pParams.find(
"OutputFile");
78 if (it != pParams.end())
84 it = pParams.find(
"ThresholdVar");
86 if (it != pParams.end())
88 std::string var = it->second.c_str();
89 std::vector<string> varlist = pSession->GetVariables();
90 auto x =
std::find(varlist.begin(), varlist.end(), var);
92 "Specified variable " + var +
93 " in ThresholdMin filter is not available.");
151 std::stringstream vOutputFilename;
154 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef =
155 pFields[0]->GetFieldDefinitions();
156 std::vector<std::vector<NekDouble>> FieldData(FieldDef.size());
159 pFields[0]->FwdTransLocalElmt(
m_threshold, vCoeffs);
162 for (
int i = 0; i < FieldDef.size(); ++i)
165 FieldDef[i]->m_fields.push_back(
"m");
166 pFields[0]->AppendFieldData(FieldDef[i], FieldData[i], vCoeffs);
169 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.
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.
SOLVER_UTILS_EXPORT FilterThresholdMin(const LibUtilities::SessionReaderSharedPtr &pSession, const std::shared_ptr< EquationSystem > &pEquation, const ParamMap &pParams)
std::string m_outputFile
File into which to write output data.
SOLVER_UTILS_EXPORT void v_Initialise(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time) override
Initialises the filter.
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.
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.
SOLVER_UTILS_EXPORT ~FilterThresholdMin() override
static FilterSharedPtr create(const LibUtilities::SessionReaderSharedPtr &pSession, const std::shared_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)