63 const std::map<std::string, std::string> &pParams)
66 ASSERTL0(pParams.find(
"ThresholdValue") != pParams.end(),
67 "Missing parameter 'ThresholdValue'.");
69 ASSERTL0(pParams.find(
"InitialValue") != pParams.end(),
70 "Missing parameter 'InitialValue'.");
71 m_initialValue = atof(pParams.find(
"InitialValue")->second.c_str());
72 ASSERTL0(!(pParams.find(
"OutputFile")->second.empty()),
73 "Missing parameter 'OutputFile'.");
77 if (pParams.find(
"StartTime") != pParams.end())
79 m_startTime = atof(pParams.find(
"StartTime")->second.c_str());
132 for (
int i = 0; i < pFields[0]->GetNpoints(); ++i)
159 pFields[0]->GetSession()->GetComm()->AllReduce(max_idx,
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]->FwdTrans_IterPerExp(
m_threshold[i], vCoeffs);
192 for(
int 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);
virtual void v_Update(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time)
Update recorded times.
#define ASSERTL0(condition, msg)
virtual ~FilterBenchmark()
Destructor for the benchmark filter.
NekDouble m_initialValue
Initial time to use in storage array.
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
virtual bool v_IsTimeDependent()
Identifies that the benchmark filter is time dependent.
std::string m_outputFile
Filename of output files.
T Vmax(int n, const T *x, const int incx)
Return the maximum element in x – called vmax to avoid conflict with max.
static SolverUtils::FilterSharedPtr create(const LibUtilities::SessionReaderSharedPtr &pSession, const std::map< std::string, std::string > &pParams)
Creates an instance of this class.
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
FilterBenchmark(const LibUtilities::SessionReaderSharedPtr &pSession, const std::map< std::string, std::string > &pParams)
Construct the benchmark filter.
NekDouble m_startTime
Time at which to start detecting activations and repolarisations.
virtual void v_Initialise(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time)
Initialises the benchmark filter and allocates storage.
LibUtilities::FieldIOSharedPtr m_fld
FieldIO object used for writing output files.
NekDouble m_thresholdValue
Value at which tissue is considered active.
std::vector< Array< OneD, NekDouble > > m_threshold
Storage for activation and repolarisation times.
Array< OneD, int > m_idx
Number of activations and repolarisations detected for each point.
FilterFactory & GetFilterFactory()
static std::string className
Name of the class.
virtual void v_Finalise(const Array< OneD, const MultiRegions::ExpListSharedPtr > &pFields, const NekDouble &time)
Finalises the benchmark filter and write out recorded data.
Array< OneD, int > m_polarity
Indicates if the previous event was an activation or repolarisation.
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, tDescription pDesc="")
Register a class with the factory.