45 std::string FilterThresholdMin::className =
47 "ThresholdMin", FilterThresholdMin::create);
53 FilterThresholdMin::FilterThresholdMin(
58 ParamMap::const_iterator it;
61 it = pParams.find(
"ThresholdValue");
62 ASSERTL0(it != pParams.end(),
"Missing parameter 'ThresholdValue'.");
67 it = pParams.find(
"InitialValue");
68 ASSERTL0(it != pParams.end(),
"Missing parameter 'InitialValue'.");
73 it = pParams.find(
"StartTime");
75 if (it != pParams.end())
82 it = pParams.find(
"OutputFile");
84 if (it != pParams.end())
90 it = pParams.find(
"ThresholdVar");
92 if (it != pParams.end())
94 std::string var = it->second.c_str();
95 std::vector<string> varlist = pSession->GetVariables();
96 std::vector<string>::const_iterator x;
99 "Specified variable " + var +
100 " in ThresholdMin filter is not available.");
162 std::stringstream vOutputFilename;
165 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef
166 = pFields[0]->GetFieldDefinitions();
167 std::vector<std::vector<NekDouble> > FieldData(FieldDef.size());
170 pFields[0]->FwdTrans_IterPerExp(
m_threshold, vCoeffs);
173 for(
int i = 0; i < FieldDef.size(); ++i)
176 FieldDef[i]->m_fields.push_back(
"m");
177 pFields[0]->AppendFieldData(FieldDef[i], FieldData[i], vCoeffs);
180 m_fld->Write(vOutputFilename.str(),FieldDef,FieldData);
#define ASSERTL0(condition, msg)
NekDouble m_startTime
Time at which to start recording.
virtual SOLVER_UTILS_EXPORT void v_Initialise(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time)
Initialises the filter.
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
virtual SOLVER_UTILS_EXPORT bool v_IsTimeDependent()
Indicate that this filter is time dependent.
NekDouble m_thresholdValue
Value of threshold.
NekDouble Evaluate() const
int m_thresholdVar
Variable on which to detect threshold.
NekDouble m_initialValue
Initial value of storage.
std::map< std::string, std::string > ParamMap
LibUtilities::SessionReaderSharedPtr m_session
std::string m_outputFile
File into which to write output data.
virtual SOLVER_UTILS_EXPORT ~FilterThresholdMin()
static boost::shared_ptr< FieldIO > CreateDefault(const LibUtilities::SessionReaderSharedPtr session)
Returns an object for the default FieldIO method.
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.
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)
Finalise the filter and write out data.
InputIterator find(InputIterator first, InputIterator last, InputIterator startingpoint, const EqualityComparable &value)
FilterFactory & GetFilterFactory()
Array< OneD, NekDouble > m_threshold
Storage for recording when each point in domain drops below threshold.
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, tDescription pDesc="")
Register a class with the factory.