56 return exp->GetExp(i);
61 std::ofstream out(filename.c_str());
62 exp->WriteVtkHeader(out);
63 size_t nExp = exp->GetExpSize();
64 for (
size_t i = 0; i < nExp; ++i)
66 exp->WriteVtkPieceHeader(out, i);
67 exp->WriteVtkPieceFooter(out, i);
69 exp->WriteVtkFooter(out);
76 exp->FwdTrans(in, out);
84 exp->BwdTrans(in, out);
92 exp->IProductWRTBase(in, out);
100 exp->MultiplyByInvMassMatrix(in, out);
110 exp->HelmSolve(in, out, constFactorMap, varCoeffMap);
124 return exp->L2(in, err);
130 return exp->Linf(in);
137 return exp->Linf(in, err);
142 size_t nPhys = exp->GetNpoints();
143 size_t coordim = exp->GetCoordim(0);
145 std::vector<Array<OneD, NekDouble>> coords(coordim);
146 for (
size_t i = 0; i < coordim; ++i)
154 exp->GetCoords(coords[0]);
155 return py::make_tuple(coords[0]);
158 exp->GetCoords(coords[0], coords[1]);
159 return py::make_tuple(coords[0], coords[1]);
162 exp->GetCoords(coords[0], coords[1], coords[2]);
163 return py::make_tuple(coords[0], coords[1], coords[2]);
172 exp->SetPhysArray(inarray);
178 exp->SetPhys(inarray);
183 return exp->GetPhys();
189 exp->SetCoeffsArray(inarray);
194 return exp->GetCoeffs();
199 return exp->Integral();
204 std::stringstream ss;
205 ss << static_cast<const void *>(&(exp->GetPhys()[0]));
211 exp->ClearGlobalLinSysManager();
221 size_t nExp = exp->GetExpSize();
225 for (
size_t i = 0; i < nExp; ++i)
227 elementGIDs[i] = exp->GetExp(i)->GetGeom()->GetGlobalID();
230 std::vector<LibUtilities::FieldDefinitionsSharedPtr> def;
231 std::vector<std::vector<NekDouble>> data;
239 Vmath::Zero(exp->GetNcoeffs(), exp->UpdateCoeffs(), 1);
242 for (
size_t i = 0; i < def.size(); ++i)
245 for (
size_t j = 0; j < def[i]->m_fields.size(); ++j)
247 if (def[i]->m_fields[j] == varName)
255 exp->ExtractDataToCoeffs(def[i], data[i], def[i]->m_fields[idx],
256 exp->UpdateCoeffs());
260 std::cout <<
"Field " + varName +
" not found." << std::endl;
264 exp->BwdTrans(exp->GetCoeffs(), exp->UpdatePhys());
271 py::class_<ExpList, std::shared_ptr<ExpList>>(m,
"ExpList")
279 .def(
"GetNcoeffs", GetNcoeffs)
const Array< OneD, const NekDouble > ExpList_GetCoeffs(ExpListSharedPtr exp)
NekDouble ExpList_Linf_Error(ExpListSharedPtr exp, const Array< OneD, const NekDouble > &in, const Array< OneD, const NekDouble > &err)
Array< OneD, NekDouble > ExpList_MultiplyByInvMassMatrix(ExpListSharedPtr exp, const Array< OneD, const NekDouble > &in)
void ExpList_ResetManagers(ExpListSharedPtr exp)
NekDouble ExpList_Linf(ExpListSharedPtr exp, const Array< OneD, const NekDouble > &in)
const Array< OneD, const NekDouble > ExpList_GetPhys(ExpListSharedPtr exp)
NekDouble ExpList_Integral(ExpListSharedPtr exp)
Array< OneD, NekDouble > ExpList_IProductWRTBase(ExpListSharedPtr exp, const Array< OneD, const NekDouble > &in)
ExpansionSharedPtr ExpList_GetExp(ExpListSharedPtr exp, int i)
void ExpList_SetPhysArray(ExpListSharedPtr exp, Array< OneD, NekDouble > inarray)
void export_ExpList(py::module &m)
Array< OneD, NekDouble > ExpList_HelmSolve(ExpListSharedPtr exp, const Array< OneD, const NekDouble > &in, const StdRegions::ConstFactorMap &constFactorMap, const StdRegions::VarCoeffMap &varCoeffMap)
Array< OneD, NekDouble > ExpList_BwdTrans(ExpListSharedPtr exp, const Array< OneD, const NekDouble > &in)
void ExpList_LoadField(ExpListSharedPtr exp, std::string filename, std::string varName)
void ExpList_WriteVTK(ExpListSharedPtr exp, std::string filename)
void ExpList_SetPhys(ExpListSharedPtr exp, const Array< OneD, const NekDouble > &inarray)
py::tuple ExpList_GetCoords(ExpListSharedPtr exp)
void ExpList_SetCoeffsArray(ExpListSharedPtr exp, Array< OneD, NekDouble > inarray)
NekDouble ExpList_L2(ExpListSharedPtr exp, const Array< OneD, const NekDouble > &in)
std::string ExpList_GetPhysAddress(ExpListSharedPtr exp)
Array< OneD, NekDouble > ExpList_FwdTrans(ExpListSharedPtr exp, const Array< OneD, const NekDouble > &in)
NekDouble ExpList_L2_Error(ExpListSharedPtr exp, const Array< OneD, const NekDouble > &in, const Array< OneD, const NekDouble > &err)
PYBIND11_MAKE_OPAQUE(LibUtilities::FieldMetaDataMap)
static std::shared_ptr< FieldIO > CreateForFile(const LibUtilities::SessionReaderSharedPtr session, const std::string &filename)
Construct a FieldIO object for a given input filename.
Base class for all multi-elemental spectral/hp expansions.
int GetNcoeffs(void) const
Returns the total number of local degrees of freedom .
int GetCoeff_Offset(int n) const
Get the start offset position for a local contiguous list of coeffs correspoinding to element n.
int GetExpSize(void)
This function returns the number of elements in the expansion.
int GetNpoints(void) const
Returns the total number of quadrature points m_npoints .
NekDouble PhysEvaluate(const Array< OneD, const NekDouble > &coords, const Array< OneD, const NekDouble > &phys)
bool GetPhysState(void) const
This function indicates whether the array of physical values (implemented as m_phys) is filled or no...
void SetPhysState(const bool physState)
This function manually sets whether the array of physical values (implemented as m_phys) is filled o...
int GetPhys_Offset(int n) const
Get the start offset position for a local contiguous list of quadrature points in a full array corres...
std::shared_ptr< FieldIO > FieldIOSharedPtr
std::shared_ptr< SessionReader > SessionReaderSharedPtr
static FieldMetaDataMap NullFieldMetaDataMap
std::shared_ptr< Expansion > ExpansionSharedPtr
std::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
std::map< ConstFactorType, NekDouble > ConstFactorMap
static ConstFactorMap NullConstFactorMap
static VarCoeffMap NullVarCoeffMap
std::map< StdRegions::VarCoeffType, VarCoeffEntry > VarCoeffMap
NekMatrix< NekMatrix< NekMatrix< NekDouble, StandardMatrixTag >, ScaledMatrixTag >, BlockMatrixTag > DNekScalBlkMat
NekMatrix< NekMatrix< NekDouble, StandardMatrixTag >, ScaledMatrixTag > DNekScalMat
void Zero(int n, T *x, const int incx)
Zero vector.
Used to lookup the create function in NekManager.