Nektar++
Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Friends | List of all members
Nektar::FilterCellHistoryPoints Class Reference

#include <FilterCellHistoryPoints.h>

Inheritance diagram for Nektar::FilterCellHistoryPoints:
[legend]

Public Member Functions

 FilterCellHistoryPoints (const LibUtilities::SessionReaderSharedPtr &pSession, const std::weak_ptr< SolverUtils::EquationSystem > &pEquation, const ParamMap &pParams)
 
 ~FilterCellHistoryPoints ()
 
void SetCellModel (CellModelSharedPtr &pCellModel)
 
- Public Member Functions inherited from Nektar::SolverUtils::FilterHistoryPoints
SOLVER_UTILS_EXPORT FilterHistoryPoints (const LibUtilities::SessionReaderSharedPtr &pSession, const std::weak_ptr< EquationSystem > &pEquation, const ParamMap &pParams)
 
SOLVER_UTILS_EXPORT ~FilterHistoryPoints ()
 
- Public Member Functions inherited from Nektar::SolverUtils::Filter
SOLVER_UTILS_EXPORT Filter (const LibUtilities::SessionReaderSharedPtr &pSession, const std::weak_ptr< EquationSystem > &pEquation)
 
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 SolverUtils::FilterSharedPtr create (const LibUtilities::SessionReaderSharedPtr &pSession, const std::weak_ptr< SolverUtils::EquationSystem > &pEquation, const ParamMap &pParams)
 Creates an instance of this class. More...
 
- Static Public Member Functions inherited from Nektar::SolverUtils::FilterHistoryPoints
static FilterSharedPtr create (const LibUtilities::SessionReaderSharedPtr &pSession, const std::weak_ptr< EquationSystem > &pEquation, 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...
 
- Static Public Attributes inherited from Nektar::SolverUtils::FilterHistoryPoints
static std::string className
 Name of the class. More...
 

Protected Member Functions

virtual void v_Update (const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time)
 
- Protected Member Functions inherited from Nektar::SolverUtils::FilterHistoryPoints
virtual SOLVER_UTILS_EXPORT void v_Initialise (const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time)
 
virtual SOLVER_UTILS_EXPORT void v_Finalise (const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time)
 
virtual SOLVER_UTILS_EXPORT bool v_IsTimeDependent ()
 
bool GetPoint (Array< OneD, NekDouble > gloCoord, int I)
 
void WriteData (const int &rank, const Array< OneD, NekDouble > &data, const int &numFields, const NekDouble &time)
 

Protected Attributes

CellModelSharedPtr m_cell
 
- Protected Attributes inherited from Nektar::SolverUtils::FilterHistoryPoints
SpatialDomains::PointGeomVector m_historyPoints
 
unsigned int m_index
 
unsigned int m_outputFrequency
 
unsigned int m_outputPlane
 plane to take history point from if using a homogeneous1D expansion More...
 
Array< OneD, int > m_planeIDs
 
bool m_isHomogeneous1D
 
bool m_waveSpace
 
std::string m_outputFile
 
std::ofstream m_outputStream
 
std::stringstream m_historyPointStream
 
std::list< std::pair< SpatialDomains::PointGeomSharedPtr, Array< OneD, NekDouble > > > m_historyList
 
std::map< int, int > m_historyLocalPointMap
 
std::map< LibUtilities::PtsType, Array< OneD, NekDouble > > m_pointDatMap
 
std::map< LibUtilities::PtsType, Array< OneD, int > > m_pointNumMap
 
unsigned int m_outputIndex
 
bool m_outputOneFile
 
bool m_adaptive
 
- Protected Attributes inherited from Nektar::SolverUtils::Filter
LibUtilities::SessionReaderSharedPtr m_session
 
const std::weak_ptr< EquationSystemm_equ
 

Friends

class MemoryManager< FilterCellHistoryPoints >
 

Additional Inherited Members

- Public Types inherited from Nektar::SolverUtils::Filter
typedef std::map< std::string, std::string > ParamMap
 

Detailed Description

Definition at line 44 of file FilterCellHistoryPoints.h.

Constructor & Destructor Documentation

◆ FilterCellHistoryPoints()

Nektar::FilterCellHistoryPoints::FilterCellHistoryPoints ( const LibUtilities::SessionReaderSharedPtr pSession,
const std::weak_ptr< SolverUtils::EquationSystem > &  pEquation,
const ParamMap pParams 
)

Definition at line 51 of file FilterCellHistoryPoints.cpp.

55  : FilterHistoryPoints(pSession, pEquation, pParams)
56 {
57 }
SOLVER_UTILS_EXPORT FilterHistoryPoints(const LibUtilities::SessionReaderSharedPtr &pSession, const std::weak_ptr< EquationSystem > &pEquation, const ParamMap &pParams)

◆ ~FilterCellHistoryPoints()

Nektar::FilterCellHistoryPoints::~FilterCellHistoryPoints ( )

Definition at line 62 of file FilterCellHistoryPoints.cpp.

63 {
64 }

Member Function Documentation

◆ create()

static SolverUtils::FilterSharedPtr Nektar::FilterCellHistoryPoints::create ( const LibUtilities::SessionReaderSharedPtr pSession,
const std::weak_ptr< SolverUtils::EquationSystem > &  pEquation,
const ParamMap pParams 
)
inlinestatic

Creates an instance of this class.

Definition at line 50 of file FilterCellHistoryPoints.h.

54  {
57  pSession, pEquation, pParams);
58  return p;
59  }
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
std::shared_ptr< Filter > FilterSharedPtr
A shared pointer to a Driver object.
Definition: Filter.h:50

References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), and CellMLToNektar.cellml_metadata::p.

◆ SetCellModel()

void Nektar::FilterCellHistoryPoints::SetCellModel ( CellModelSharedPtr pCellModel)
inline

Definition at line 70 of file FilterCellHistoryPoints.h.

71  {
72  m_cell = pCellModel;
73  }

References m_cell.

◆ v_Update()

void Nektar::FilterCellHistoryPoints::v_Update ( const Array< OneD, const MultiRegions::ExpListSharedPtr > &  pFields,
const NekDouble time 
)
protectedvirtual

Reimplemented from Nektar::SolverUtils::FilterHistoryPoints.

Definition at line 69 of file FilterCellHistoryPoints.cpp.

72 {
73  // Only output every m_outputFrequency.
74  if ((m_index++) % m_outputFrequency)
75  {
76  return;
77  }
78 
79  int j = 0;
80  int k = 0;
81  int numPoints = m_historyPoints.size();
82  int numFields = m_cell->GetNumCellVariables();
83  LibUtilities::CommSharedPtr vComm = pFields[0]->GetComm();
84  Array<OneD, NekDouble> data(numPoints * numFields, 0.0);
85  Array<OneD, NekDouble> gloCoord(3, 0.0);
86  Array<OneD, NekDouble> physvals;
87  Array<OneD, NekDouble> locCoord;
88  int expId;
89  int nppp = 0; // Number of points per plane
90 
91  // Pull out data values field by field
92  for (j = 0; j < numFields; ++j)
93  {
94  k = 0;
96  {
97  for (auto &x : m_historyList)
98  {
99  locCoord = x.second;
100  expId = x.first->GetVid();
101  nppp = pFields[0]->GetPlane(0)->GetTotPoints();
102 
103  physvals = m_cell->GetCellSolution(j) + m_outputPlane * nppp +
104  pFields[j]->GetPhys_Offset(expId);
105 
106  // interpolate point can do with zero plane methods
107  data[m_historyLocalPointMap[k++] * numFields + j] =
108  pFields[0]->GetExp(expId)->StdPhysEvaluate(locCoord,
109  physvals);
110  }
111  }
112  else
113  {
114  for (auto &x : m_historyList)
115  {
116  locCoord = x.second;
117  expId = x.first->GetVid();
118 
119  physvals = m_cell->GetCellSolution(j) +
120  pFields[0]->GetPhys_Offset(expId);
121 
122  // interpolate point
123  data[m_historyLocalPointMap[k++] * numFields + j] =
124  pFields[0]->GetExp(expId)->StdPhysEvaluate(locCoord,
125  physvals);
126  }
127  }
128  }
129 
130  // Exchange history data
131  // This could be improved to reduce communication but works for now
132  vComm->AllReduce(data, LibUtilities::ReduceSum);
133 
134  // Only the root process writes out history data
135  if (vComm->GetRank() == 0)
136  {
137 
138  // Write data values point by point
139  for (k = 0; k < m_historyPoints.size(); ++k)
140  {
141  m_outputStream.width(8);
142  m_outputStream << setprecision(6) << time;
143  for (int j = 0; j < numFields; ++j)
144  {
145  m_outputStream.width(25);
146  m_outputStream << setprecision(16) << data[k * numFields + j];
147  }
148  m_outputStream << endl;
149  }
150  }
151 }
SpatialDomains::PointGeomVector m_historyPoints
std::list< std::pair< SpatialDomains::PointGeomSharedPtr, Array< OneD, NekDouble > > > m_historyList
unsigned int m_outputPlane
plane to take history point from if using a homogeneous1D expansion
std::shared_ptr< Comm > CommSharedPtr
Pointer to a Communicator object.
Definition: Comm.h:54

References m_cell, Nektar::SolverUtils::FilterHistoryPoints::m_historyList, Nektar::SolverUtils::FilterHistoryPoints::m_historyLocalPointMap, Nektar::SolverUtils::FilterHistoryPoints::m_historyPoints, Nektar::SolverUtils::FilterHistoryPoints::m_index, Nektar::SolverUtils::FilterHistoryPoints::m_isHomogeneous1D, Nektar::SolverUtils::FilterHistoryPoints::m_outputFrequency, Nektar::SolverUtils::FilterHistoryPoints::m_outputPlane, Nektar::SolverUtils::FilterHistoryPoints::m_outputStream, and Nektar::LibUtilities::ReduceSum.

Friends And Related Function Documentation

◆ MemoryManager< FilterCellHistoryPoints >

friend class MemoryManager< FilterCellHistoryPoints >
friend

Definition at line 1 of file FilterCellHistoryPoints.h.

Member Data Documentation

◆ className

std::string Nektar::FilterCellHistoryPoints::className
static
Initial value:
=
"CellHistoryPoints", FilterCellHistoryPoints::create)
static SolverUtils::FilterSharedPtr create(const LibUtilities::SessionReaderSharedPtr &pSession, const std::weak_ptr< SolverUtils::EquationSystem > &pEquation, const ParamMap &pParams)
Creates an instance of this class.
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
Definition: NekFactory.hpp:198
FilterFactory & GetFilterFactory()
Definition: Filter.cpp:41

Name of the class.

Definition at line 62 of file FilterCellHistoryPoints.h.

◆ m_cell

CellModelSharedPtr Nektar::FilterCellHistoryPoints::m_cell
protected

Definition at line 80 of file FilterCellHistoryPoints.h.

Referenced by SetCellModel(), and v_Update().