Nektar++
FilterElectrogram.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File FilterElectrogram.h
4 //
5 // For more information, please see: http://www.nektar.info
6 //
7 // The MIT License
8 //
9 // Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
10 // Department of Aeronautics, Imperial College London (UK), and Scientific
11 // Computing and Imaging Institute, University of Utah (USA).
12 //
13 // Permission is hereby granted, free of charge, to any person obtaining a
14 // copy of this software and associated documentation files (the "Software"),
15 // to deal in the Software without restriction, including without limitation
16 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
17 // and/or sell copies of the Software, and to permit persons to whom the
18 // Software is furnished to do so, subject to the following conditions:
19 //
20 // The above copyright notice and this permission notice shall be included
21 // in all copies or substantial portions of the Software.
22 //
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29 // DEALINGS IN THE SOFTWARE.
30 //
31 // Description: Outputs virtual electrograms at specific locations.
32 //
33 ///////////////////////////////////////////////////////////////////////////////
34 
35 #ifndef NEKTAR_SOLVERUTILS_FILTERS_FILTERELECTROGRAM_H
36 #define NEKTAR_SOLVERUTILS_FILTERS_FILTERELECTROGRAM_H
37 
40 
41 namespace Nektar
42 {
43 
45 {
46 public:
48 
49  /// Creates an instance of this class
52  const std::weak_ptr<SolverUtils::EquationSystem> &pEquation,
53  const ParamMap &pParams)
54  {
56  ::AllocateSharedPtr(pSession, pEquation, pParams);
57  return p;
58  }
59 
60  /// Name of the class
61  static std::string className;
62 
63  /// Electrogram filter constructor
66  const std::weak_ptr<SolverUtils::EquationSystem> &pEquation,
67  const ParamMap &pParams);
68 
69  /// Electrogram filter destructor
70  virtual ~FilterElectrogram();
71 
72 protected:
73  /// Initialises the electrogram filter and open output file.
74  virtual void v_Initialise(
76  const NekDouble &time);
77  /// Compute extracellular potential at egm points at current time.
78  virtual void v_Update(
80  const NekDouble &time);
81  /// Finalise the electrogram filter and close output file.
82  virtual void v_Finalise(
84  const NekDouble &time);
85  /// Filter is time-dependent and should be called at each time-step.
86  virtual bool v_IsTimeDependent();
87 
88 private:
89  /// Gradient of the radius from each electrogram point in x-direction
91  /// Gradient of the radius from each electrogram point in y-direction
93  /// Gradient of the radius from each electrogram point in z-direction
95  /// List of electrogram points
97  /// Counts number of calls to update (number of timesteps)
98  unsigned int m_index;
99  /// Number of timesteps between outputs
100  unsigned int m_outputFrequency;
101  /// Filename to output electrogram data to
102  std::string m_outputFile;
103  /// Output file stream for electrogram data
104  std::ofstream m_outputStream;
105  /// Point coordinate input string
106  std::stringstream m_electrogramStream;
107 };
108 }
109 
110 #endif
std::shared_ptr< Filter > FilterSharedPtr
A shared pointer to a Driver object.
Definition: Filter.h:50
unsigned int m_index
Counts number of calls to update (number of timesteps)
std::string m_outputFile
Filename to output electrogram data to.
std::vector< PointGeomSharedPtr > PointGeomVector
Definition: Geometry2D.h:64
Array< OneD, Array< OneD, NekDouble > > m_grad_R_y
Gradient of the radius from each electrogram point in y-direction.
std::stringstream m_electrogramStream
Point coordinate input string.
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
FilterElectrogram(const LibUtilities::SessionReaderSharedPtr &pSession, const std::weak_ptr< SolverUtils::EquationSystem > &pEquation, const ParamMap &pParams)
Electrogram filter constructor.
virtual void v_Finalise(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time)
Finalise the electrogram filter and close output file.
std::ofstream m_outputStream
Output file stream for electrogram data.
virtual bool v_IsTimeDependent()
Filter is time-dependent and should be called at each time-step.
SpatialDomains::PointGeomVector m_electrogramPoints
List of electrogram points.
virtual void v_Update(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time)
Compute extracellular potential at egm points at current time.
static std::string className
Name of the class.
unsigned int m_outputFrequency
Number of timesteps between outputs.
static SolverUtils::FilterSharedPtr create(const LibUtilities::SessionReaderSharedPtr &pSession, const std::weak_ptr< SolverUtils::EquationSystem > &pEquation, const ParamMap &pParams)
Creates an instance of this class.
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
double NekDouble
std::map< std::string, std::string > ParamMap
Definition: Filter.h:68
Array< OneD, Array< OneD, NekDouble > > m_grad_R_z
Gradient of the radius from each electrogram point in z-direction.
virtual ~FilterElectrogram()
Electrogram filter destructor.
virtual void v_Initialise(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time)
Initialises the electrogram filter and open output file.
std::shared_ptr< SessionReader > SessionReaderSharedPtr
Array< OneD, Array< OneD, NekDouble > > m_grad_R_x
Gradient of the radius from each electrogram point in x-direction.