46 const std::weak_ptr<SolverUtils::EquationSystem> &pEquation,
48 :
Filter(pSession, pEquation)
50 if (pParams.find(
"OutputFile") == pParams.end())
56 ASSERTL0(!(pParams.find(
"OutputFile")->second.empty()),
57 "Missing parameter 'OutputFile'.");
60 ASSERTL0(pParams.find(
"OutputFrequency") != pParams.end(),
61 "Missing parameter 'OutputFrequency'.");
63 pParams.find(
"OutputFrequency")->second);
66 if (pParams.find(
"MeanV") != pParams.end())
69 pParams.find(
"MeanV")->second);
86 boost::ignore_unused(time);
91 oldV = pFields[0]->GetPhys();
105 std::stringstream vOutputFilename;
109 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef =
110 pFields[0]->GetFieldDefinitions();
111 std::vector<std::vector<NekDouble>> FieldData(FieldDef.size());
118 for (
int i = 0; i < currentV.size(); ++i)
120 phase[i] = atan2(currentV[i] -
meanV,
125 pFields[0]->FwdTransLocalElmt(phase, phase_coeff);
130 for (
int i = 0; i < FieldDef.size(); ++i)
132 FieldDef[i]->m_fields.push_back(
"phase");
133 pFields[0]->AppendFieldData(FieldDef[i], FieldData[i], phase_coeff);
141 fieldMetaDataMap[
"Time"] = boost::lexical_cast<std::string>(time);
143 m_fld->Write(vOutputFilename.str(), FieldDef, FieldData, fieldMetaDataMap);
151 boost::ignore_unused(pFields, time);
#define ASSERTL0(condition, msg)
static std::string className
Name of the class.
Array< OneD, NekDouble > oldV
static SolverUtils::FilterSharedPtr create(const LibUtilities::SessionReaderSharedPtr &pSession, const std::weak_ptr< SolverUtils::EquationSystem > &pEquation, const ParamMap &pParams)
Creates an instance of this class.
virtual void v_Initialise(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time)
virtual void v_Finalise(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time)
unsigned int m_outputIndex
virtual bool v_IsTimeDependent()
unsigned int m_outputFrequency
FilterOffsetPhase(const LibUtilities::SessionReaderSharedPtr &pSession, const std::weak_ptr< SolverUtils::EquationSystem > &pEquation, const ParamMap &pParams)
virtual void v_Update(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time)
LibUtilities::FieldIOSharedPtr m_fld
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
std::map< std::string, std::string > FieldMetaDataMap
std::shared_ptr< SessionReader > SessionReaderSharedPtr
FilterFactory & GetFilterFactory()
The above copyright notice and this permission notice shall be included.