54 const std::map<std::string, std::string> &pParams) :
59 if (pParams.find(
"OutputFile") == pParams.end())
65 ASSERTL0(!(pParams.find(
"OutputFile")->second.empty()),
66 "Missing parameter 'OutputFile'.");
67 outName = pParams.find(
"OutputFile")->second;
70 if (pParams.find(
"OutputFrequency") == pParams.end())
77 atoi(pParams.find(
"OutputFrequency")->second.c_str());
82 ASSERTL0(pSession->GetComm()->GetSize() == 1,
83 "The 1D energy filter currently only works in serial.");
85 m_out.open(outName.c_str());
103 ASSERTL0(pFields[0]->GetExp(0)->GetNumBases() == 1,
104 "The Energy 1D filter is only valid in 1D.");
121 int nElmt = pFields[0]->GetExpSize();
124 m_out <<
"##" << endl;
125 m_out <<
"## Time = " << time << endl;
126 m_out <<
"##" << endl;
128 for (
int i = 0; i < nElmt; ++i)
132 int nModes = exp->GetBasis(0)->GetNumModes();
137 btype, nModes, exp->GetBasis(0)->GetPointsKey());
141 exp->GetBasis(0)->GetBasisType(),
142 exp->GetBasis(0)->GetNumModes(),
143 exp->GetBasis(0)->GetPointsKey());
147 pFields[0]->GetCoeffs() + pFields[0]->GetCoeff_Offset(i);
156 m_out <<
"# Element " << i <<
" (ID "
157 << exp->GetGeom()->GetGlobalID() <<
")" << endl;
158 for (
int j = 0; j < nModes; ++j)
160 m_out << coeffsOrth[j] << endl;
virtual void v_Finalise(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pField, const NekDouble &time)
#define ASSERTL0(condition, msg)
void InterpCoeff1D(const BasisKey &fbasis0, const Array< OneD, const NekDouble > &from, const BasisKey &tbasis0, Array< OneD, NekDouble > &to)
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
static std::string className
Name of the class.
virtual void v_Update(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pField, const NekDouble &time)
Update filter output with the current timestep's orthogonal coefficients.
SOLVER_UTILS_EXPORT ~FilterEnergy1D()
Destructor.
unsigned int m_index
Current index counter.
SOLVER_UTILS_EXPORT FilterEnergy1D(const LibUtilities::SessionReaderSharedPtr &pSession, const std::map< std::string, std::string > &pParams)
Set up filter with output file and frequency parameters.
virtual void v_Initialise(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pField, const NekDouble &time)
Initialize filter.
ofstream m_out
Output file.
Principle Orthogonal Functions .
LibUtilities::SessionReaderSharedPtr m_session
static FilterSharedPtr create(const LibUtilities::SessionReaderSharedPtr &pSession, const std::map< std::string, std::string > &pParams)
Creates an instance of this class.
boost::shared_ptr< Expansion > ExpansionSharedPtr
virtual bool v_IsTimeDependent()
FilterFactory & GetFilterFactory()
Describes the specification for a Basis.
unsigned int m_outputFrequency
Output frequency.