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)
virtual 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_startTime
NekDouble m_thresholdValue
int m_thresholdVar
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, Nektar::StdRegions::find(), m_fld, m_initialValue, m_outputFile, m_startTime, m_thresholdValue, and m_thresholdVar.

:
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());
if (pParams.find("StartTime") != pParams.end())
{
m_startTime = atof(pParams.find("StartTime")->second.c_str());
}
m_outputFile = pSession->GetSessionName() + "_max.fld";
if (pParams.find("OutputFile") != pParams.end())
{
m_outputFile = pParams.find("OutputFile")->second;
}
if (pParams.find("ThresholdVar") != pParams.end())
{
std::string var = pParams.find("ThresholdVar")->second.c_str();
std::vector<string> varlist = pSession->GetVariables();
std::vector<string>::const_iterator x;
ASSERTL0((x=std::find(varlist.begin(), varlist.end(), var)) != varlist.end(),
"Specified variable " + var +
" in ThresholdMax filter is not available.");
m_thresholdVar = x - varlist.begin();
}
}
Nektar::SolverUtils::FilterThresholdMax::~FilterThresholdMax ( )
virtual

Definition at line 83 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 112 of file FilterThresholdMax.cpp.

References m_fld, m_outputFile, m_threshold, and m_thresholdVar.

{
std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef
= pFields[m_thresholdVar]->GetFieldDefinitions();
std::vector<std::vector<NekDouble> > FieldData(FieldDef.size());
Array<OneD, NekDouble> vCoeffs(pFields[0]->GetNcoeffs());
pFields[m_thresholdVar]->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[m_thresholdVar]->AppendFieldData(FieldDef[i], FieldData[i], vCoeffs);
}
m_fld->Write(m_outputFile,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 88 of file FilterThresholdMax.cpp.

References m_initialValue, m_threshold, and m_thresholdVar.

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

Implements Nektar::SolverUtils::Filter.

Definition at line 133 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 93 of file FilterThresholdMax.cpp.

References m_startTime, m_threshold, m_thresholdValue, and m_thresholdVar.

{
if (time < m_startTime)
{
return;
}
int i;
NekDouble timestep = pFields[m_thresholdVar]->GetSession()->GetParameter("TimeStep");
for (i = 0; i < pFields[m_thresholdVar]->GetNpoints(); ++i)
{
if (m_threshold[i] < timestep && pFields[m_thresholdVar]->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 80 of file FilterThresholdMax.h.

Referenced by FilterThresholdMax(), and v_Finalise().

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

Definition at line 78 of file FilterThresholdMax.h.

Referenced by FilterThresholdMax(), and v_Initialise().

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

Definition at line 79 of file FilterThresholdMax.h.

Referenced by FilterThresholdMax(), and v_Finalise().

NekDouble Nektar::SolverUtils::FilterThresholdMax::m_startTime
private

Definition at line 75 of file FilterThresholdMax.h.

Referenced by FilterThresholdMax(), and v_Update().

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 76 of file FilterThresholdMax.h.

Referenced by FilterThresholdMax(), and v_Update().

int Nektar::SolverUtils::FilterThresholdMax::m_thresholdVar
private

Definition at line 77 of file FilterThresholdMax.h.

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