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 | Protected Attributes | Friends | List of all members
Nektar::FilterCellHistoryPoints Class Reference

#include <FilterCellHistoryPoints.h>

Inheritance diagram for Nektar::FilterCellHistoryPoints:
Inheritance graph
[legend]
Collaboration diagram for Nektar::FilterCellHistoryPoints:
Collaboration graph
[legend]

Public Member Functions

 FilterCellHistoryPoints (const LibUtilities::SessionReaderSharedPtr &pSession, 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 ParamMap &pParams)
 
SOLVER_UTILS_EXPORT ~FilterHistoryPoints ()
 
- 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 SolverUtils::FilterSharedPtr create (const LibUtilities::SessionReaderSharedPtr &pSession, 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::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 = GetFilterFactory().RegisterCreatorFunction("HistoryPoints", FilterHistoryPoints::create)
 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 ()
 

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...
 
bool m_isHomogeneous1D
 
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
 
- Protected Attributes inherited from Nektar::SolverUtils::Filter
LibUtilities::SessionReaderSharedPtr m_session
 

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 45 of file FilterCellHistoryPoints.h.

Constructor & Destructor Documentation

Nektar::FilterCellHistoryPoints::FilterCellHistoryPoints ( const LibUtilities::SessionReaderSharedPtr pSession,
const ParamMap pParams 
)

Definition at line 50 of file FilterCellHistoryPoints.cpp.

52  :
53  FilterHistoryPoints(pSession, pParams)
54 {
55 }
SOLVER_UTILS_EXPORT FilterHistoryPoints(const LibUtilities::SessionReaderSharedPtr &pSession, const ParamMap &pParams)
Nektar::FilterCellHistoryPoints::~FilterCellHistoryPoints ( )

Definition at line 61 of file FilterCellHistoryPoints.cpp.

62 {
63 
64 }

Member Function Documentation

static SolverUtils::FilterSharedPtr Nektar::FilterCellHistoryPoints::create ( const LibUtilities::SessionReaderSharedPtr pSession,
const ParamMap pParams 
)
inlinestatic

Creates an instance of this class.

Definition at line 51 of file FilterCellHistoryPoints.h.

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

53  {
56  ::AllocateSharedPtr(pSession, pParams);
57  return p;
58  }
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::FilterCellHistoryPoints::SetCellModel ( CellModelSharedPtr pCellModel)
inline

Definition at line 68 of file FilterCellHistoryPoints.h.

References m_cell.

Referenced by Nektar::Monodomain::v_InitObject().

69  {
70  m_cell = pCellModel;
71  }
void Nektar::FilterCellHistoryPoints::v_Update ( const Array< OneD, const MultiRegions::ExpListSharedPtr > &  pFields,
const NekDouble time 
)
protectedvirtual

Reimplemented from Nektar::SolverUtils::FilterHistoryPoints.

Definition at line 70 of file FilterCellHistoryPoints.cpp.

References Nektar::iterator, 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.

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

Friends And Related Function Documentation

friend class MemoryManager< FilterCellHistoryPoints >
friend

Definition at line 48 of file FilterCellHistoryPoints.h.

Member Data Documentation

std::string Nektar::FilterCellHistoryPoints::className
static
Initial value:

Name of the class.

Definition at line 61 of file FilterCellHistoryPoints.h.

CellModelSharedPtr Nektar::FilterCellHistoryPoints::m_cell
protected

Definition at line 78 of file FilterCellHistoryPoints.h.

Referenced by SetCellModel(), and v_Update().