52 const std::shared_ptr<SolverUtils::EquationSystem> &pEquation,
54 :
Filter(pSession, pEquation)
57 auto it = pParams.find(
"OutputFile");
58 if (it == pParams.end())
64 ASSERTL0(it->second.length() > 0,
"Missing parameter 'OutputFile'.");
74 it = pParams.find(
"OutputFrequency");
75 if (it == pParams.end())
86 it = pParams.find(
"Points");
87 ASSERTL0(it != pParams.end(),
"Missing parameter 'Points'.");
114 const size_t dim = 3;
124 dim, i, gloCoord[0], gloCoord[1], gloCoord[2]);
131 if (vComm->GetRank() == 0)
137 for (
size_t i = 0; i < pFields.size(); ++i)
161 const size_t nq = pFields[0]->GetNpoints();
170 for (
size_t i = 0; i < npts; ++i)
182 pFields[0]->GetCoords(x, y,
z);
187 Vmath::Vvtvvtp(nq, x, 1, x, 1, y, 1, y, 1, oneOverR, 1);
214 const size_t nq = pFields[0]->GetNpoints();
223 pFields[0]->PhysDeriv(pFields[0]->GetPhys(), grad_V_x, grad_V_y, grad_V_z);
225 for (i = 0; i < npoints; ++i)
230 grad_V_y, 1, output, 1);
233 e[i] = pFields[0]->Integral(output);
241 if (vComm->GetRank() == 0)
263 if (pFields[0]->GetComm()->GetRank() == 0)
#define ASSERTL0(condition, msg)
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.
static SolverUtils::FilterSharedPtr create(const LibUtilities::SessionReaderSharedPtr &pSession, const std::shared_ptr< SolverUtils::EquationSystem > &pEquation, const ParamMap &pParams)
Creates an instance of this class.
std::string m_outputFile
Filename to output electrogram data to.
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.
~FilterElectrogram() override
Electrogram filter destructor.
FilterElectrogram(const LibUtilities::SessionReaderSharedPtr &pSession, const std::shared_ptr< SolverUtils::EquationSystem > &pEquation, const ParamMap &pParams)
Electrogram filter constructor.
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.
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.
void v_Initialise(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time) override
Initialises the electrogram filter and open output file.
void v_Finalise(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time) override
Finalise the electrogram filter and close output file.
NekDouble Evaluate() const
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
LibUtilities::SessionReaderSharedPtr m_session
std::map< std::string, std::string > ParamMap
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< Comm > CommSharedPtr
Pointer to a Communicator object.
FilterFactory & GetFilterFactory()
std::shared_ptr< PointGeom > PointGeomSharedPtr
std::vector< double > z(NPUPPER)
void Vsqrt(int n, const T *x, const int incx, T *y, const int incy)
sqrt y = sqrt(x)
void Vvtvp(int n, const T *w, const int incw, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
vvtvp (vector times vector plus vector): z = w*x + y
void Sdiv(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha/x.
void Sadd(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Add vector y = alpha + x.
void Vvtvvtp(int n, const T *v, int incv, const T *w, int incw, const T *x, int incx, const T *y, int incy, T *z, int incz)
vvtvvtp (vector times vector plus vector times vector):