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::FilterThresholdMin Class Reference

#include <FilterThresholdMin.h>

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

Public Member Functions

SOLVER_UTILS_EXPORT FilterThresholdMin (const LibUtilities::SessionReaderSharedPtr &pSession, const std::map< std::string, std::string > &pParams)
virtual SOLVER_UTILS_EXPORT ~FilterThresholdMin ()
- 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
 Name of the class.

Protected Member Functions

virtual SOLVER_UTILS_EXPORT void v_Initialise (const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time)
 Initialises the filter.
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.
virtual SOLVER_UTILS_EXPORT void v_Finalise (const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time)
 Finalise the filter and write out data.
virtual SOLVER_UTILS_EXPORT bool v_IsTimeDependent ()
 Indicate that this filter is time dependent.

Private Attributes

Array< OneD, NekDoublem_threshold
 Storage for recording when each point in domain drops below threshold.
NekDouble m_startTime
 Time at which to start recording.
NekDouble m_thresholdValue
 Value of threshold.
NekDouble m_initialValue
 Initial value of storage.
std::string m_outputFile
 File into which to write output data.
LibUtilities::FieldIOSharedPtr m_fld
 FieldIO object for writing data.

Friends

class MemoryManager< FilterThresholdMin >

Additional Inherited Members

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

Detailed Description

Definition at line 46 of file FilterThresholdMin.h.

Constructor & Destructor Documentation

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

Definition at line 51 of file FilterThresholdMin.cpp.

References ASSERTL0, m_fld, m_initialValue, m_outputFile, m_startTime, 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;
if (pParams.find("StartTime") != pParams.end())
{
m_startTime = atof(pParams.find("StartTime")->second.c_str());
}
pSession->GetComm());
}
Nektar::SolverUtils::FilterThresholdMin::~FilterThresholdMin ( )
virtual

Definition at line 80 of file FilterThresholdMin.cpp.

{
}

Member Function Documentation

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

Creates an instance of this class.

Definition at line 52 of file FilterThresholdMin.h.

void Nektar::SolverUtils::FilterThresholdMin::v_Finalise ( const Array< OneD, const MultiRegions::ExpListSharedPtr > &  pFields,
const NekDouble time 
)
protectedvirtual

Finalise the filter and write out data.

Implements Nektar::SolverUtils::Filter.

Definition at line 127 of file FilterThresholdMin.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::FilterThresholdMin::v_Initialise ( const Array< OneD, const MultiRegions::ExpListSharedPtr > &  pFields,
const NekDouble time 
)
protectedvirtual

Initialises the filter.

Implements Nektar::SolverUtils::Filter.

Definition at line 89 of file FilterThresholdMin.cpp.

References m_initialValue, and m_threshold.

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

Indicate that this filter is time dependent.

Implements Nektar::SolverUtils::Filter.

Definition at line 157 of file FilterThresholdMin.cpp.

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

For each point in domain test if solution is below threshold.

Implements Nektar::SolverUtils::Filter.

Definition at line 101 of file FilterThresholdMin.cpp.

References m_startTime, m_threshold, and m_thresholdValue.

{
if (time < m_startTime)
{
return;
}
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< FilterThresholdMin >
friend

Definition at line 49 of file FilterThresholdMin.h.

Member Data Documentation

std::string Nektar::SolverUtils::FilterThresholdMin::className
static
Initial value:

Name of the class.

Definition at line 63 of file FilterThresholdMin.h.

LibUtilities::FieldIOSharedPtr Nektar::SolverUtils::FilterThresholdMin::m_fld
private

FieldIO object for writing data.

Definition at line 98 of file FilterThresholdMin.h.

Referenced by FilterThresholdMin(), and v_Finalise().

NekDouble Nektar::SolverUtils::FilterThresholdMin::m_initialValue
private

Initial value of storage.

Definition at line 94 of file FilterThresholdMin.h.

Referenced by FilterThresholdMin(), and v_Initialise().

std::string Nektar::SolverUtils::FilterThresholdMin::m_outputFile
private

File into which to write output data.

Definition at line 96 of file FilterThresholdMin.h.

Referenced by FilterThresholdMin(), and v_Finalise().

NekDouble Nektar::SolverUtils::FilterThresholdMin::m_startTime
private

Time at which to start recording.

Definition at line 90 of file FilterThresholdMin.h.

Referenced by FilterThresholdMin(), and v_Update().

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

Storage for recording when each point in domain drops below threshold.

Definition at line 88 of file FilterThresholdMin.h.

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

NekDouble Nektar::SolverUtils::FilterThresholdMin::m_thresholdValue
private

Value of threshold.

Definition at line 92 of file FilterThresholdMin.h.

Referenced by FilterThresholdMin(), and v_Update().