61 const std::shared_ptr<SolverUtils::EquationSystem> &pEquation,
63 :
Filter(pSession, pEquation)
66 auto it = pParams.find(
"ThresholdValue");
67 ASSERTL0(it != pParams.end(),
"Missing parameter 'ThresholdValue'.");
72 it = pParams.find(
"InitialValue");
73 ASSERTL0(it != pParams.end(),
"Missing parameter 'InitialValue'.");
78 it = pParams.find(
"OutputFile");
79 ASSERTL0(it->second.length() > 0,
"Missing parameter 'OutputFile'.");
84 it = pParams.find(
"StartTime");
85 if (it != pParams.end())
135 size_t nPts = pFields[0]->GetNpoints();
136 for (
size_t i = 0; i < nPts; ++i)
161 pFields[0]->GetSession()->GetComm()->AllReduce(max_idx,
179 for (
size_t j = 0; j <
m_threshold.size() - 1; ++j)
181 std::stringstream vOutputFilename;
184 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef =
185 pFields[0]->GetFieldDefinitions();
186 std::vector<std::vector<NekDouble>> FieldData(FieldDef.size());
189 pFields[0]->FwdTransLocalElmt(
m_threshold[j], vCoeffs);
192 for (
size_t i = 0; i < FieldDef.size(); ++i)
195 FieldDef[i]->m_fields.push_back(
"m");
196 pFields[0]->AppendFieldData(FieldDef[i], FieldData[i], vCoeffs);
199 m_fld->Write(vOutputFilename.str(), FieldDef, FieldData);
#define ASSERTL0(condition, msg)
std::vector< Array< OneD, NekDouble > > m_threshold
Storage for activation and repolarisation times.
LibUtilities::FieldIOSharedPtr m_fld
FieldIO object used for writing output files.
void v_Finalise(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time) override
Finalises the benchmark filter and write out recorded data.
~FilterBenchmark() override
Destructor for the benchmark filter.
void v_Initialise(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time) override
Initialises the benchmark filter and allocates storage.
NekDouble m_thresholdValue
Value at which tissue is considered active.
FilterBenchmark(const LibUtilities::SessionReaderSharedPtr &pSession, const std::shared_ptr< SolverUtils::EquationSystem > &pEquation, const ParamMap &pParams)
Construct the benchmark filter.
std::string m_outputFile
Filename of output files.
static SolverUtils::FilterSharedPtr create(const LibUtilities::SessionReaderSharedPtr &pSession, const std::shared_ptr< SolverUtils::EquationSystem > &pEquation, const ParamMap &pParams)
Creates an instance of this class.
void v_Update(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time) override
Update recorded times.
bool v_IsTimeDependent() override
Identifies that the benchmark filter is time dependent.
NekDouble m_initialValue
Initial time to use in storage array.
NekDouble m_startTime
Time at which to start detecting activations and repolarisations.
static std::string className
Name of the class.
Array< OneD, int > m_polarity
Indicates if the previous event was an activation or repolarisation.
Array< OneD, int > m_idx
Number of activations and repolarisations detected for each point.
NekDouble Evaluate() const
static std::shared_ptr< FieldIO > CreateDefault(const LibUtilities::SessionReaderSharedPtr session)
Returns an object for the default FieldIO method.
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
LibUtilities::SessionReaderSharedPtr m_session
std::map< std::string, std::string > ParamMap
std::shared_ptr< SessionReader > SessionReaderSharedPtr
FilterFactory & GetFilterFactory()
T Vmax(int n, const T *x, const int incx)
Return the maximum element in x – called vmax to avoid conflict with max.