51 return exp->GetExp(i);
56 std::ofstream out(filename.c_str());
57 exp->WriteVtkHeader(out);
58 size_t nExp = exp->GetExpSize();
59 for (
size_t i = 0; i < nExp; ++i)
61 exp->WriteVtkPieceHeader(out, i);
62 exp->WriteVtkPieceFooter(out, i);
64 exp->WriteVtkFooter(out);
71 exp->FwdTrans(in, out);
79 exp->BwdTrans(in, out);
87 exp->IProductWRTBase(in, out);
95 exp->MultiplyByInvMassMatrix(in, out);
101 const py::object constFactorMap,
102 const py::object varCoeffMap)
109 if (!constFactorMap.is_none())
111 facMap = py::extract<StdRegions::ConstFactorMap>(constFactorMap);
113 if (!varCoeffMap.is_none())
115 coeffMap = py::extract<StdRegions::VarCoeffMap>(varCoeffMap);
118 exp->HelmSolve(in, out, facMap, coeffMap);
132 return exp->L2(in, err);
138 return exp->Linf(in);
145 return exp->Linf(in, err);
150 size_t nPhys = exp->GetNpoints();
151 size_t coordim = exp->GetCoordim(0);
153 std::vector<Array<OneD, NekDouble>> coords(coordim);
154 for (
size_t i = 0; i < coordim; ++i)
162 exp->GetCoords(coords[0]);
163 return py::make_tuple(coords[0]);
166 exp->GetCoords(coords[0], coords[1]);
167 return py::make_tuple(coords[0], coords[1]);
170 exp->GetCoords(coords[0], coords[1], coords[2]);
171 return py::make_tuple(coords[0], coords[1], coords[2]);
180 exp->SetPhysArray(inarray);
186 exp->SetPhys(inarray);
191 return exp->GetPhys();
196 return exp->Integral();
201 std::stringstream ss;
202 ss << static_cast<const void *>(&(exp->GetPhys()[0]));
208 exp->ClearGlobalLinSysManager();
218 size_t nExp = exp->GetExpSize();
222 for (
size_t i = 0; i < nExp; ++i)
224 elementGIDs[i] = exp->GetExp(i)->GetGeom()->GetGlobalID();
227 std::vector<LibUtilities::FieldDefinitionsSharedPtr> def;
228 std::vector<std::vector<NekDouble>> data;
236 Vmath::Zero(exp->GetNcoeffs(), exp->UpdateCoeffs(), 1);
239 for (
size_t i = 0; i < def.size(); ++i)
242 for (
size_t j = 0; j < def[i]->m_fields.size(); ++j)
244 if (def[i]->m_fields[j] == varName)
252 exp->ExtractDataToCoeffs(def[i], data[i], def[i]->m_fields[idx],
253 exp->UpdateCoeffs());
257 std::cout <<
"Field " + varName +
" not found." << std::endl;
261 exp->BwdTrans(exp->GetCoeffs(), exp->UpdatePhys());
268 py::class_<ExpList, std::shared_ptr<ExpList>, boost::noncopyable>(
276 .def(
"GetNcoeffs", GetNcoeffs)
291 (py::arg(
"in"), py::arg(
"constFactorMap") = py::object(),
292 py::arg(
"varCoeffMap") = py::object()))
NekDouble ExpList_Linf_Error(ExpListSharedPtr exp, const Array< OneD, const NekDouble > &in, const Array< OneD, const NekDouble > &err)
void ExpList_ResetManagers(ExpListSharedPtr exp)
NekDouble ExpList_Linf(ExpListSharedPtr exp, const Array< OneD, const NekDouble > &in)
Array< OneD, NekDouble > ExpList_IProductWRTBase(ExpListSharedPtr exp, const Array< OneD, const NekDouble > &in)
NekDouble ExpList_Integral(ExpListSharedPtr exp)
ExpansionSharedPtr ExpList_GetExp(ExpListSharedPtr exp, int i)
void ExpList_SetPhysArray(ExpListSharedPtr exp, Array< OneD, NekDouble > inarray)
const Array< OneD, const NekDouble > ExpList_GetPhys(ExpListSharedPtr exp)
void ExpList_LoadField(ExpListSharedPtr exp, std::string filename, std::string varName)
Array< OneD, NekDouble > ExpList_MultiplyByInvMassMatrix(ExpListSharedPtr exp, const Array< OneD, const NekDouble > &in)
void ExpList_WriteVTK(ExpListSharedPtr exp, std::string filename)
Array< OneD, NekDouble > ExpList_FwdTrans(ExpListSharedPtr exp, const Array< OneD, const NekDouble > &in)
void ExpList_SetPhys(ExpListSharedPtr exp, const Array< OneD, const NekDouble > &inarray)
py::tuple ExpList_GetCoords(ExpListSharedPtr exp)
NekDouble ExpList_L2(ExpListSharedPtr exp, const Array< OneD, const NekDouble > &in)
Array< OneD, NekDouble > ExpList_HelmSolve(ExpListSharedPtr exp, const Array< OneD, const NekDouble > &in, const py::object constFactorMap, const py::object varCoeffMap)
Array< OneD, NekDouble > ExpList_BwdTrans(ExpListSharedPtr exp, const Array< OneD, const NekDouble > &in)
std::string ExpList_GetPhysAddress(ExpListSharedPtr exp)
NekDouble ExpList_L2_Error(ExpListSharedPtr exp, const Array< OneD, const NekDouble > &in, const Array< OneD, const NekDouble > &err)
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
The namespace associated with the the StdRegions library (StdRegions introduction)
std::map< ConstFactorType, NekDouble > ConstFactorMap
static ConstFactorMap NullConstFactorMap
static VarCoeffMap NullVarCoeffMap
std::map< StdRegions::VarCoeffType, VarCoeffEntry > VarCoeffMap
The above copyright notice and this permission notice shall be included.
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.