40#include <SolverCore/GlobalLinSysOps/LinearSolvers/LinearSolverOp.hpp>
41#include <SolverCore/GlobalLinSysOps/LinearSystems/PoissonSolve/PoissonSolveOp.hpp>
42#include <SolverCore/PreconOps/PreconOp.hpp>
46template <
typename TData>
55 const unsigned int numComp =
57 const size_t nphys = this->
m_expList->GetTotPoints();
66 if (this->
m_session->DefinesFunction(
"Forcing"))
68 for (
unsigned int n = 0; n < numComp; ++n)
71 "Forcing", n % this->
m_session->GetVariables().size());
73 func->Evaluate(x, y, z, fceVar);
77 for (
unsigned int blk = 0; blk < this->
m_in.
GetBlocks().size(); ++blk)
81 block.template GetPtr<NektarSpaces::HostSpace, WriteOnly>();
82 for (
unsigned int n = 0; n < numComp; ++n)
87 auto fceptr = fce.data() + n * nphys;
89 for (
size_t el = 0, cnt = 0;
el < block.GetNumElements(); ++
el)
91 for (
unsigned int phys = 0; phys < block.GetNumData();
94 if (this->
m_session->DefinesFunction(
"Forcing"))
96 inptr[cnt] = *(fceptr++);
100 inptr[cnt] = 1.0 + n;
103 for (
unsigned int p = 1; p < 4; ++p)
106 (n + 1) * p * std::pow(*xptr, p);
112 for (
unsigned int p = 1; p < 4; ++p)
114 inptr[cnt] += (n + 1) * p *
123 for (
unsigned int p = 1; p < 4; ++p)
126 (n + 1) * p * std::pow(*xptr, p) *
127 std::pow(*yptr, p) * std::pow(*zptr, p);
137 inptr += block.CompSize();
141 this->
m_out.template Initialize<NektarSpaces::HostSpace>(0.0);
170 std::string execStr(GlobalConfiguration::ExecStr());
171 std::string implStr(GlobalConfiguration::ImplStr());
174 if (implStr ==
"SumFac" || execStr ==
"AVX")
177 NektarSpaces::GetVectorWidth<TData>(execStr), execStr);
179 NektarSpaces::GetVectorWidth<TData>(execStr));
188 linsolve->SetVerboseOutput(
true);
190 op->SetLinearSolver(linsolve);
191 op->SetPrecon(precon);
199 const unsigned int numComp =
201 const size_t nphys = this->
m_expList->GetTotPoints();
202 const size_t ncoeffs = this->
m_expList->GetNcoeffs();
203 const auto &variables = this->
m_session->GetVariables();
232 for (
unsigned int n = 0; n < numComp; ++n)
239 expListVar->HelmSolve(inphysVar, outcoeffsVar, factors);
243 this->
m_expected.template CopyArray<NektarSpaces::HostSpace>(outcoeffs);
252#if defined(NEKTAR_ENABLE_SINGLE_PRECISION)
253#define TESTFLOAT(type, filename) \
254 class type##float : public TestPoissonSolve<float> \
259 m_meshName = filename; \
263#define TESTFLOAT(type, filename)
265#if defined(NEKTAR_ENABLE_DOUBLE_PRECISION)
266#define TESTDOUBLE(type, filename) \
267 class type : public TestPoissonSolve<double> \
272 m_meshName = filename; \
276#define TESTDOUBLE(type, filename)
278#define TEST(type, filename) \
279 TESTFLOAT(type, filename) \
280 TESTDOUBLE(type, filename)
283TEST(Poisson1D_Seg,
"run/Helmholtz1D_P8.xml")
285TEST(Poisson2D_Tri_Quad, "run/Helmholtz2D_varP.xml")
286TEST(Poisson2D_Tri_Quad_3C, "run/Helmholtz2D_3C.xml")
288TEST(Poisson2D_AllBCs, "run/Helmholtz2D_P7_AllBCs.xml")
290TEST(Poisson3D_Hex, "run/Helmholtz3D_Hex_Heterogeneous.xml")
291TEST(Poisson3D_Hex_3C, "run/Helmholtz3D_Hex_3C.xml")
293TEST(Poisson3D_Prism, "run/Helmholtz3D_Prism_VarP.xml")
295TEST(Poisson3D_Pyr, "run/Helmholtz3D_Pyr_VarP.xml")
297TEST(Poisson3D_Tet, "run/Helmholtz3D_Tet_VarP.xml")
SpatialDomains::MeshGraphSharedPtr graph
#define TEST(type, filename)
SpatialDomains::Geometry * el
void ReshapeStorage(const unsigned int &interleaveWidth, const std::string &execSpace)
std::vector< BlockAccessor< TData, TState > > & GetBlocks()
Get BlockAccessors for the field.
Nektar::Array< Nektar::OneD, TDataOut > ToArray()
Copy the data to a Nektar::Array, component by component and element by element, without padding,...
unsigned int GetNumHomoModes() const
Gets the number of homogeneous modes.
void SetInterleaveWidth(const unsigned int &interleaveWidth)
unsigned int GetNumComponents() const
Gets the number of components for a vector field.
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
static MeshGraphSharedPtr Read(const LibUtilities::SessionReaderSharedPtr pSession, LibUtilities::DomainRangeShPtr rng=LibUtilities::NullDomainRangeShPtr, bool fillGraph=true, SpatialDomains::MeshGraphSharedPtr partitionedGraph=nullptr)
Field< TData, FieldState::Coeff > m_out
Field< TData, FieldState::Phys > m_in
ExpListSharedPtr m_expList
SessionReaderSharedPtr m_session
Field< TData, FieldState::Coeff > m_expected
void RunTestCase(const std::string &method)
std::vector< TData > m_diffCoeff
TestPoissonSolve()=default
std::map< ConstFactorType, NekDouble > ConstFactorMap