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

#include <FilterCheckpointCellModel.h>

Collaboration diagram for Nektar::FilterCheckpointCellModel:
Collaboration graph
[legend]

Public Member Functions

 FilterCheckpointCellModel (const LibUtilities::SessionReaderSharedPtr &pSession, const std::map< std::string, std::string > &pParams)
 ~FilterCheckpointCellModel ()
void SetCellModel (CellModelSharedPtr &pCellModel)

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("CheckpointCellModel", FilterCheckpointCellModel::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

unsigned int m_index
unsigned int m_outputIndex
unsigned int m_outputFrequency
std::string m_outputFile
CellModelSharedPtr m_cell
LibUtilities::FieldIOSharedPtr m_fld

Friends

class MemoryManager< FilterCheckpointCellModel >

Detailed Description

Definition at line 47 of file FilterCheckpointCellModel.h.

Constructor & Destructor Documentation

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

Definition at line 42 of file FilterCheckpointCellModel.cpp.

References ASSERTL0, m_fld, m_index, m_outputFile, m_outputFrequency, and m_outputIndex.

:
Filter(pSession)
{
if (pParams.find("OutputFile") == pParams.end())
{
m_outputFile = m_session->GetSessionName();
}
else
{
ASSERTL0(!(pParams.find("OutputFile")->second.empty()),
"Missing parameter 'OutputFile'.");
m_outputFile = pParams.find("OutputFile")->second;
}
ASSERTL0(pParams.find("OutputFrequency") != pParams.end(),
"Missing parameter 'OutputFrequency'.");
m_outputFrequency = atoi(pParams.find("OutputFrequency")->second.c_str());
m_index = 0;
}
Nektar::FilterCheckpointCellModel::~FilterCheckpointCellModel ( )

Definition at line 66 of file FilterCheckpointCellModel.cpp.

{
}

Member Function Documentation

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

Creates an instance of this class.

Definition at line 53 of file FilterCheckpointCellModel.h.

{
//p->InitObject();
return p;
}
void Nektar::FilterCheckpointCellModel::SetCellModel ( CellModelSharedPtr pCellModel)
inline

Definition at line 69 of file FilterCheckpointCellModel.h.

Referenced by Nektar::Bidomain::v_InitObject(), and Nektar::Monodomain::v_InitObject().

{
m_cell = pCellModel;
}
void Nektar::FilterCheckpointCellModel::v_Finalise ( const Array< OneD, const MultiRegions::ExpListSharedPtr > &  pFields,
const NekDouble time 
)
protectedvirtual

Definition at line 123 of file FilterCheckpointCellModel.cpp.

{
}
void Nektar::FilterCheckpointCellModel::v_Initialise ( const Array< OneD, const MultiRegions::ExpListSharedPtr > &  pFields,
const NekDouble time 
)
protectedvirtual

Definition at line 71 of file FilterCheckpointCellModel.cpp.

References ASSERTL0, m_cell, m_index, m_outputIndex, and v_Update().

{
ASSERTL0(m_cell.get(), "Cell model has not been set by EquationSystem "
"class. Use SetCellModel on this filter to achieve this.");
m_index = 0;
v_Update(pFields, 0.0);
}
bool Nektar::FilterCheckpointCellModel::v_IsTimeDependent ( )
protectedvirtual

Definition at line 128 of file FilterCheckpointCellModel.cpp.

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

Definition at line 82 of file FilterCheckpointCellModel.cpp.

References m_cell, m_fld, m_index, m_outputFile, m_outputFrequency, and m_outputIndex.

Referenced by v_Initialise().

{
{
return;
}
std::stringstream vOutputFilename;
vOutputFilename << m_outputFile << "_" << m_outputIndex << ".chk";
SpatialDomains::MeshGraphSharedPtr vGraph = pFields[0]->GetGraph();
std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef
= pFields[0]->GetFieldDefinitions();
std::vector<std::vector<NekDouble> > FieldData(FieldDef.size());
// copy Data into FieldData and set variable
std::string varName;
for(int j = 1; j < m_cell->GetNumCellVariables(); ++j)
{
varName = m_cell->GetCellVarName(j);
for(int i = 0; i < FieldDef.size(); ++i)
{
// Retrieve data from cell model
Array<OneD, NekDouble> data = m_cell->GetCellSolutionCoeffs(j);
// Could do a search here to find correct variable
FieldDef[i]->m_fields.push_back(varName);
pFields[0]->AppendFieldData(FieldDef[i], FieldData[i], data);
}
}
// Update time in field info if required
fieldMetaDataMap["Time"] = boost::lexical_cast<std::string>(time);
m_fld->Write(vOutputFilename.str(),FieldDef,FieldData,fieldMetaDataMap);
m_outputIndex++;
}

Friends And Related Function Documentation

friend class MemoryManager< FilterCheckpointCellModel >
friend

Definition at line 50 of file FilterCheckpointCellModel.h.

Member Data Documentation

std::string Nektar::FilterCheckpointCellModel::className = GetFilterFactory().RegisterCreatorFunction("CheckpointCellModel", FilterCheckpointCellModel::create)
static

Name of the class.

Definition at line 62 of file FilterCheckpointCellModel.h.

CellModelSharedPtr Nektar::FilterCheckpointCellModel::m_cell
private

Definition at line 85 of file FilterCheckpointCellModel.h.

Referenced by v_Initialise(), and v_Update().

LibUtilities::FieldIOSharedPtr Nektar::FilterCheckpointCellModel::m_fld
private

Definition at line 86 of file FilterCheckpointCellModel.h.

Referenced by FilterCheckpointCellModel(), and v_Update().

unsigned int Nektar::FilterCheckpointCellModel::m_index
private

Definition at line 81 of file FilterCheckpointCellModel.h.

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

std::string Nektar::FilterCheckpointCellModel::m_outputFile
private

Definition at line 84 of file FilterCheckpointCellModel.h.

Referenced by FilterCheckpointCellModel(), and v_Update().

unsigned int Nektar::FilterCheckpointCellModel::m_outputFrequency
private

Definition at line 83 of file FilterCheckpointCellModel.h.

Referenced by FilterCheckpointCellModel(), and v_Update().

unsigned int Nektar::FilterCheckpointCellModel::m_outputIndex
private

Definition at line 82 of file FilterCheckpointCellModel.h.

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