49 Loki::SingleThreaded> Type;
50 return Type::Instance();
61 const unsigned int& pNumForcingFields,
62 const TiXmlElement* pForce)
79 v_Apply(fields, inarray, outarray, time);
89 const unsigned int& pNumForcingFields)
91 vector<ForcingSharedPtr> vForceList;
93 if (!pSession->DefinesElement(
"Nektar/Forcing"))
98 TiXmlElement* vForcing = pSession->GetElement(
"Nektar/Forcing");
101 unsigned int vNumForcingFields = pNumForcingFields;
102 if (!pNumForcingFields)
104 vNumForcingFields = pFields.num_elements();
107 TiXmlElement* vForce = vForcing->FirstChildElement(
"FORCE");
110 string vType = vForce->Attribute(
"TYPE");
113 vType, pSession, pFields,
114 vNumForcingFields, vForce));
115 vForce = vForce->NextSiblingElement(
"FORCE");
123 std::string pFieldName,
125 const std::string& pFunctionName,
128 ASSERTL0(pSession->DefinesFunction(pFunctionName),
129 "Function '" + pFunctionName +
"' does not exist.");
132 pSession->GetFunction(pFunctionName, pFieldName);
146 pEqn->Evaluate(x0, x0, x0, pTime, pArray);
154 std::string pFieldName,
156 const std::string& pFunctionName,
159 ASSERTL0(pSession->DefinesFunction(pFunctionName),
160 "Function '" + pFunctionName +
"' does not exist.");
162 unsigned int nq = pFields[0]->GetNpoints();
163 if (pArray.num_elements() != nq)
169 vType = pSession->GetFunctionType(pFunctionName, pFieldName);
176 pFields[0]->GetCoords(x0, x1, x2);
178 pSession->GetFunction(pFunctionName, pFieldName);
180 ffunc->Evaluate(x0, x1, x2, pTime, pArray);
184 std::string filename = pSession->GetFunctionFilename(
188 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef;
189 std::vector<std::vector<NekDouble> > FieldData;
195 fld->Import(filename, FieldDef, FieldData);
198 for (
int i = 0; i < FieldDef.size(); ++i)
200 for (
int j = 0; j < FieldDef[i]->m_fields.size(); ++j)
202 if (FieldDef[i]->m_fields[j] == pFieldName)
210 pFields[0]->ExtractDataToCoeffs(
213 FieldDef[i]->m_fields[idx],
218 cout <<
"Field " + pFieldName +
" not found." << endl;
221 pFields[0]->BwdTrans_IterPerExp(vCoeffs, pArray);
SOLVER_UTILS_EXPORT void EvaluateTimeFunction(LibUtilities::SessionReaderSharedPtr pSession, std::string pFieldName, Array< OneD, NekDouble > &pArray, const std::string &pFunctionName, NekDouble pTime=NekDouble(0))
#define ASSERTL0(condition, msg)
SOLVER_UTILS_EXPORT void InitObject(const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, const unsigned int &pNumForcingFields, const TiXmlElement *pForce)
Initialise the forcing object.
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
SOLVER_UTILS_EXPORT void Apply(const Array< OneD, MultiRegions::ExpListSharedPtr > &fields, const Array< OneD, Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble &time)
Apply the forcing.
ForcingFactory & GetForcingFactory()
Declaration of the forcing factory singleton.
SOLVER_UTILS_EXPORT void EvaluateFunction(Array< OneD, MultiRegions::ExpListSharedPtr > pFields, LibUtilities::SessionReaderSharedPtr pSession, std::string pFieldName, Array< OneD, NekDouble > &pArray, const std::string &pFunctionName, NekDouble pTime=NekDouble(0))
static SOLVER_UTILS_EXPORT std::vector< ForcingSharedPtr > Load(const LibUtilities::SessionReaderSharedPtr &pSession, const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, const unsigned int &pNumForcingFields=0)
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
LibUtilities::NekFactory< std::string, Forcing, const LibUtilities::SessionReaderSharedPtr &, const Array< OneD, MultiRegions::ExpListSharedPtr > &, const unsigned int &, const TiXmlElement * > ForcingFactory
Declaration of the forcing factory.
boost::shared_ptr< FieldIO > FieldIOSharedPtr
LibUtilities::SessionReaderSharedPtr m_session
Session reader.
boost::shared_ptr< Equation > EquationSharedPtr
virtual SOLVER_UTILS_EXPORT void v_InitObject(const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, const unsigned int &pNumForcingFields, const TiXmlElement *pForce)=0
void Zero(int n, T *x, const int incx)
Zero vector.
Provides a generic Factory class.
virtual SOLVER_UTILS_EXPORT void v_Apply(const Array< OneD, MultiRegions::ExpListSharedPtr > &fields, const Array< OneD, Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble &time)=0