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:
47  friend class MemoryManager<FilterElectrogram>;
48 
49  /// Creates an instance of this class
52  const std::weak_ptr<SolverUtils::EquationSystem> &pEquation,
53  const ParamMap &pParams)
54  {
57  pSession, pEquation, pParams);
58  return p;
59  }
60 
61  /// Name of the class
62  static std::string className;
63 
64  /// Electrogram filter constructor
67  const std::weak_ptr<SolverUtils::EquationSystem> &pEquation,
68  const ParamMap &pParams);
69 
70  /// Electrogram filter destructor
71  virtual ~FilterElectrogram();
72 
73 protected:
74  /// Initialises the electrogram filter and open output file.
75  virtual void v_Initialise(
77  const NekDouble &time) override;
78  /// Compute extracellular potential at egm points at current time.
79  virtual void v_Update(
81  const NekDouble &time) override;
82  /// Finalise the electrogram filter and close output file.
83  virtual void v_Finalise(
85  const NekDouble &time) override;
86  /// Filter is time-dependent and should be called at each time-step.
87  virtual bool v_IsTimeDependent() override;
88 
89 private:
90  /// Gradient of the radius from each electrogram point in x-direction
92  /// Gradient of the radius from each electrogram point in y-direction
94  /// Gradient of the radius from each electrogram point in z-direction
96  /// List of electrogram points
98  /// Counts number of calls to update (number of timesteps)
99  unsigned int m_index;
100  /// Number of timesteps between outputs
101  unsigned int m_outputFrequency;
102  /// Filename to output electrogram data to
103  std::string m_outputFile;
104  /// Output file stream for electrogram data
105  std::ofstream m_outputStream;
106  /// Point coordinate input string
107  std::stringstream m_electrogramStream;
108 };
109 } // namespace Nektar
110 
111 #endif
Array< OneD, Array< OneD, NekDouble > > m_grad_R_z
Gradient of the radius from each electrogram point in z-direction.
Array< OneD, Array< OneD, NekDouble > > m_grad_R_x
Gradient of the radius from each electrogram point in x-direction.
std::ofstream m_outputStream
Output file stream for electrogram data.
std::string m_outputFile
Filename to output electrogram data to.
static SolverUtils::FilterSharedPtr create(const LibUtilities::SessionReaderSharedPtr &pSession, const std::weak_ptr< SolverUtils::EquationSystem > &pEquation, const ParamMap &pParams)
Creates an instance of this class.
Array< OneD, Array< OneD, NekDouble > > m_grad_R_y
Gradient of the radius from each electrogram point in y-direction.
unsigned int m_outputFrequency
Number of timesteps between outputs.
virtual bool v_IsTimeDependent() override
Filter is time-dependent and should be called at each time-step.
unsigned int m_index
Counts number of calls to update (number of timesteps)
SpatialDomains::PointGeomVector m_electrogramPoints
List of electrogram points.
virtual void v_Update(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time) override
Compute extracellular potential at egm points at current time.
std::stringstream m_electrogramStream
Point coordinate input string.
static std::string className
Name of the class.
virtual void v_Initialise(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time) override
Initialises the electrogram filter and open output file.
virtual void v_Finalise(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time) override
Finalise the electrogram filter and close output file.
FilterElectrogram(const LibUtilities::SessionReaderSharedPtr &pSession, const std::weak_ptr< SolverUtils::EquationSystem > &pEquation, const ParamMap &pParams)
Electrogram filter constructor.
virtual ~FilterElectrogram()
Electrogram filter destructor.
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
std::map< std::string, std::string > ParamMap
Definition: Filter.h:67
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< Filter > FilterSharedPtr
A shared pointer to a Driver object.
Definition: Filter.h:50
std::vector< PointGeomSharedPtr > PointGeomVector
Definition: Geometry2D.h:64
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:2
double NekDouble