47 Loki::SingleThreaded> Type;
48 return Type::Instance();
59 const unsigned int& pNumForcingFields,
60 const TiXmlElement* pForce)
77 v_Apply(fields, inarray, outarray, time);
87 const unsigned int& pNumForcingFields)
89 vector<ForcingSharedPtr> vForceList;
91 if (!pSession->DefinesElement(
"Nektar/Forcing"))
96 TiXmlElement* vForcing = pSession->GetElement(
"Nektar/Forcing");
99 unsigned int vNumForcingFields = pNumForcingFields;
100 if (!pNumForcingFields)
102 vNumForcingFields = pFields.num_elements();
105 TiXmlElement* vForce = vForcing->FirstChildElement(
"FORCE");
108 string vType = vForce->Attribute(
"TYPE");
111 vType, pSession, pFields,
112 vNumForcingFields, vForce));
113 vForce = vForce->NextSiblingElement(
"FORCE");
121 std::string pFieldName,
123 const std::string& pFunctionName,
126 ASSERTL0(pSession->DefinesFunction(pFunctionName),
127 "Function '" + pFunctionName +
"' does not exist.");
130 pSession->GetFunction(pFunctionName, pFieldName);
144 pEqn->Evaluate(x0, x0, x0, pTime, pArray);
152 std::string pFieldName,
154 const std::string& pFunctionName,
157 ASSERTL0(pSession->DefinesFunction(pFunctionName),
158 "Function '" + pFunctionName +
"' does not exist.");
160 unsigned int nq = pFields[0]->GetNpoints();
161 if (pArray.num_elements() != nq)
167 vType = pSession->GetFunctionType(pFunctionName, pFieldName);
174 pFields[0]->GetCoords(x0, x1, x2);
176 pSession->GetFunction(pFunctionName, pFieldName);
178 ffunc->Evaluate(x0, x1, x2, pTime, pArray);
182 std::string filename = pSession->GetFunctionFilename(
186 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef;
187 std::vector<std::vector<NekDouble> > FieldData;
193 fld->Import(filename, FieldDef, FieldData);
196 for (
int i = 0; i < FieldDef.size(); ++i)
198 for (
int j = 0; j < FieldDef[i]->m_fields.size(); ++j)
200 if (FieldDef[i]->m_fields[j] == pFieldName)
208 pFields[0]->ExtractDataToCoeffs(
211 FieldDef[i]->m_fields[idx],
216 cout <<
"Field " + pFieldName +
" not found." << endl;
219 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
SOLVER_UTILS_EXPORT Forcing(const LibUtilities::SessionReaderSharedPtr &)
Constructor.
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