Nektar++
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. More...
 

Static Public Attributes

static std::string className
 Name of the class. More...
 

Protected Member Functions

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

Private Attributes

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

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 Nektar::MemoryManager< DataType >::AllocateSharedPtr(), ASSERTL0, m_fld, m_initialValue, m_outputFile, m_startTime, and m_thresholdValue.

54  : Filter(pSession)
55 {
56  ASSERTL0(pParams.find("ThresholdValue") != pParams.end(),
57  "Missing parameter 'ThresholdValue'.");
58  m_thresholdValue = atof(pParams.find("ThresholdValue")->second.c_str());
59  ASSERTL0(pParams.find("InitialValue") != pParams.end(),
60  "Missing parameter 'InitialValue'.");
61  m_initialValue = atof(pParams.find("InitialValue")->second.c_str());
62  ASSERTL0(!(pParams.find("OutputFile")->second.empty()),
63  "Missing parameter 'OutputFile'.");
64  m_outputFile = pParams.find("OutputFile")->second;
65 
66  if (pParams.find("StartTime") != pParams.end())
67  {
68  m_startTime = atof(pParams.find("StartTime")->second.c_str());
69  }
70 
72  pSession->GetComm());
73 
74 }
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:135
SOLVER_UTILS_EXPORT Filter(const LibUtilities::SessionReaderSharedPtr &pSession)
Definition: Filter.cpp:52
NekDouble m_startTime
Time at which to start recording.
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
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.
Nektar::SolverUtils::FilterThresholdMin::~FilterThresholdMin ( )
virtual

Definition at line 80 of file FilterThresholdMin.cpp.

81 {
82 
83 }

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.

References Nektar::MemoryManager< DataType >::AllocateSharedPtr().

55  {
56  FilterSharedPtr p =
58  pSession, pParams);
59  return p;
60  }
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
boost::shared_ptr< Filter > FilterSharedPtr
A shared pointer to a Driver object.
Definition: Filter.h:50
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.

130 {
131  std::stringstream vOutputFilename;
132  vOutputFilename << m_outputFile << ".fld";
133 
134  std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef
135  = pFields[0]->GetFieldDefinitions();
136  std::vector<std::vector<NekDouble> > FieldData(FieldDef.size());
137 
138  Array<OneD, NekDouble> vCoeffs(pFields[0]->GetNcoeffs());
139  pFields[0]->FwdTrans_IterPerExp(m_threshold, vCoeffs);
140 
141  // copy Data into FieldData and set variable
142  for(int i = 0; i < FieldDef.size(); ++i)
143  {
144  // Could do a search here to find correct variable
145  FieldDef[i]->m_fields.push_back("m");
146  pFields[0]->AppendFieldData(FieldDef[i], FieldData[i], vCoeffs);
147  }
148 
149  m_fld->Write(vOutputFilename.str(),FieldDef,FieldData);
150 
151 }
std::string m_outputFile
File into which to write output data.
LibUtilities::FieldIOSharedPtr m_fld
FieldIO object for writing data.
Array< OneD, NekDouble > m_threshold
Storage for recording when each point in domain drops below threshold.
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.

92 {
93  m_threshold = Array<OneD, NekDouble> (pFields[0]->GetNpoints(),
95 }
NekDouble m_initialValue
Initial value of storage.
Array< OneD, NekDouble > m_threshold
Storage for recording when each point in domain drops below threshold.
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.

158 {
159  return true;
160 }
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.

104 {
105  if (time < m_startTime)
106  {
107  return;
108  }
109 
110  int i;
111  NekDouble timestep = pFields[0]->GetSession()->GetParameter("TimeStep");
112 
113  for (i = 0; i < pFields[0]->GetNpoints(); ++i)
114  {
115  if (m_threshold[i] < timestep &&
116  pFields[0]->GetPhys()[i] < m_thresholdValue)
117  {
118  m_threshold[i] = time;
119  }
120  }
121 }
NekDouble m_startTime
Time at which to start recording.
NekDouble m_thresholdValue
Value of threshold.
double NekDouble
Array< OneD, NekDouble > m_threshold
Storage for recording when each point in domain drops below threshold.

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().