Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Private Attributes | Friends | List of all members
Nektar::SolverUtils::FilterThresholdMax Class Reference

#include <FilterThresholdMax.h>

Inheritance diagram for Nektar::SolverUtils::FilterThresholdMax:
Inheritance graph
[legend]
Collaboration diagram for Nektar::SolverUtils::FilterThresholdMax:
Collaboration graph
[legend]

Public Member Functions

SOLVER_UTILS_EXPORT FilterThresholdMax (const LibUtilities::SessionReaderSharedPtr &pSession, const std::map< std::string, std::string > &pParams)
SOLVER_UTILS_EXPORT ~FilterThresholdMax ()
- Public Member Functions inherited from Nektar::SolverUtils::Filter
SOLVER_UTILS_EXPORT Filter (const LibUtilities::SessionReaderSharedPtr &pSession)
virtual SOLVER_UTILS_EXPORT ~Filter ()
SOLVER_UTILS_EXPORT void Initialise (const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time)
SOLVER_UTILS_EXPORT void Update (const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time)
SOLVER_UTILS_EXPORT void Finalise (const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time)
SOLVER_UTILS_EXPORT bool IsTimeDependent ()

Static Public Member Functions

static FilterSharedPtr create (const LibUtilities::SessionReaderSharedPtr &pSession, const std::map< std::string, std::string > &pParams)
 Creates an instance of this class.

Static Public Attributes

static std::string className = GetFilterFactory().RegisterCreatorFunction("ThresholdMax", FilterThresholdMax::create)
 Name of the class.

Protected Member Functions

virtual void v_Initialise (const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time)
virtual void v_Update (const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time)
virtual void v_Finalise (const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time)
virtual bool v_IsTimeDependent ()

Private Attributes

Array< OneD, NekDoublem_threshold
NekDouble m_thresholdValue
NekDouble m_initialValue
std::string m_outputFile
LibUtilities::FieldIOSharedPtr m_fld

Friends

class MemoryManager< FilterThresholdMax >

Additional Inherited Members

- Protected Attributes inherited from Nektar::SolverUtils::Filter
LibUtilities::SessionReaderSharedPtr m_session

Detailed Description

Definition at line 45 of file FilterThresholdMax.h.

Constructor & Destructor Documentation

Nektar::SolverUtils::FilterThresholdMax::FilterThresholdMax ( const LibUtilities::SessionReaderSharedPtr pSession,
const std::map< std::string, std::string > &  pParams 
)

Definition at line 44 of file FilterThresholdMax.cpp.

References ASSERTL0, m_fld, m_initialValue, m_outputFile, and m_thresholdValue.

:
Filter(pSession)
{
ASSERTL0(pParams.find("ThresholdValue") != pParams.end(),
"Missing parameter 'ThresholdValue'.");
m_thresholdValue = atof(pParams.find("ThresholdValue")->second.c_str());
ASSERTL0(pParams.find("InitialValue") != pParams.end(),
"Missing parameter 'InitialValue'.");
m_initialValue = atof(pParams.find("InitialValue")->second.c_str());
ASSERTL0(!(pParams.find("OutputFile")->second.empty()),
"Missing parameter 'OutputFile'.");
m_outputFile = pParams.find("OutputFile")->second;
}
Nektar::SolverUtils::FilterThresholdMax::~FilterThresholdMax ( )

Definition at line 62 of file FilterThresholdMax.cpp.

{
}

Member Function Documentation

static FilterSharedPtr Nektar::SolverUtils::FilterThresholdMax::create ( const LibUtilities::SessionReaderSharedPtr pSession,
const std::map< std::string, std::string > &  pParams 
)
inlinestatic

Creates an instance of this class.

Definition at line 51 of file FilterThresholdMax.h.

{
//p->InitObject();
return p;
}
void Nektar::SolverUtils::FilterThresholdMax::v_Finalise ( const Array< OneD, const MultiRegions::ExpListSharedPtr > &  pFields,
const NekDouble time 
)
protectedvirtual

Implements Nektar::SolverUtils::Filter.

Definition at line 86 of file FilterThresholdMax.cpp.

References m_fld, m_outputFile, and m_threshold.

{
std::stringstream vOutputFilename;
vOutputFilename << m_outputFile << ".fld";
std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef
= pFields[0]->GetFieldDefinitions();
std::vector<std::vector<NekDouble> > FieldData(FieldDef.size());
Array<OneD, NekDouble> vCoeffs(pFields[0]->GetNcoeffs());
pFields[0]->FwdTrans_IterPerExp(m_threshold, vCoeffs);
// copy Data into FieldData and set variable
for(int i = 0; i < FieldDef.size(); ++i)
{
// Could do a search here to find correct variable
FieldDef[i]->m_fields.push_back("m");
pFields[0]->AppendFieldData(FieldDef[i], FieldData[i], vCoeffs);
}
m_fld->Write(vOutputFilename.str(),FieldDef,FieldData);
}
void Nektar::SolverUtils::FilterThresholdMax::v_Initialise ( const Array< OneD, const MultiRegions::ExpListSharedPtr > &  pFields,
const NekDouble time 
)
protectedvirtual

Implements Nektar::SolverUtils::Filter.

Definition at line 67 of file FilterThresholdMax.cpp.

References m_initialValue, and m_threshold.

{
m_threshold = Array<OneD, NekDouble> (pFields[0]->GetNpoints(), m_initialValue);
}
bool Nektar::SolverUtils::FilterThresholdMax::v_IsTimeDependent ( )
protectedvirtual

Implements Nektar::SolverUtils::Filter.

Definition at line 110 of file FilterThresholdMax.cpp.

{
return true;
}
void Nektar::SolverUtils::FilterThresholdMax::v_Update ( const Array< OneD, const MultiRegions::ExpListSharedPtr > &  pFields,
const NekDouble time 
)
protectedvirtual

Implements Nektar::SolverUtils::Filter.

Definition at line 72 of file FilterThresholdMax.cpp.

References m_threshold, and m_thresholdValue.

{
int i;
NekDouble timestep = pFields[0]->GetSession()->GetParameter("TimeStep");
for (i = 0; i < pFields[0]->GetNpoints(); ++i)
{
if (m_threshold[i] < timestep && pFields[0]->GetPhys()[i] > m_thresholdValue)
{
m_threshold[i] = time;
}
}
}

Friends And Related Function Documentation

friend class MemoryManager< FilterThresholdMax >
friend

Definition at line 48 of file FilterThresholdMax.h.

Member Data Documentation

std::string Nektar::SolverUtils::FilterThresholdMax::className = GetFilterFactory().RegisterCreatorFunction("ThresholdMax", FilterThresholdMax::create)
static

Name of the class.

Definition at line 60 of file FilterThresholdMax.h.

LibUtilities::FieldIOSharedPtr Nektar::SolverUtils::FilterThresholdMax::m_fld
private

Definition at line 78 of file FilterThresholdMax.h.

Referenced by FilterThresholdMax(), and v_Finalise().

NekDouble Nektar::SolverUtils::FilterThresholdMax::m_initialValue
private

Definition at line 76 of file FilterThresholdMax.h.

Referenced by FilterThresholdMax(), and v_Initialise().

std::string Nektar::SolverUtils::FilterThresholdMax::m_outputFile
private

Definition at line 77 of file FilterThresholdMax.h.

Referenced by FilterThresholdMax(), and v_Finalise().

Array<OneD, NekDouble> Nektar::SolverUtils::FilterThresholdMax::m_threshold
private

Definition at line 74 of file FilterThresholdMax.h.

Referenced by v_Finalise(), v_Initialise(), and v_Update().

NekDouble Nektar::SolverUtils::FilterThresholdMax::m_thresholdValue
private

Definition at line 75 of file FilterThresholdMax.h.

Referenced by FilterThresholdMax(), and v_Update().