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 52 of file FilterCellHistoryPoints.cpp.

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

Definition at line 63 of file FilterCellHistoryPoints.cpp.

64 {
65 
66 }

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 72 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.

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