48template <
typename TData>
56 const auto &components = this->
session->GetVariables();
57 auto inblockAttr = GetBoundaryBlockAttributes<FieldState::Phys>();
58 auto outblockAttr = GetBoundaryBlockAttributes<FieldState::Coeff>();
65 "f_expected", outblockAttr, components, nhomo);
74 this->
fixt_in->template CopyVector<NektarSpaces::HostSpace>(
77 this->
fixt_out->template Initialize<NektarSpaces::HostSpace>(0.0);
85 const auto &components = this->
session->GetVariables();
86 const auto nComp = components.size();
90 auto inPhys = this->
fixt_in->template ToArray<TData>();
91 std::vector<TData> result(totalCoeffs * nComp, 0.0);
92 size_t physOffset = 0;
93 size_t coeffOffset = 0;
95 for (
const auto &expList : boundaryExp)
97 expList->SetDataWarehouse();
99 auto physBlocks = GetBlockAttributes<TData, FieldState::Phys>(
100 expList, MultiRegions::UnitInterleaveWidths(expList));
101 auto coeffBlocks = GetBlockAttributes<TData, FieldState::Coeff>(
102 expList, MultiRegions::UnitInterleaveWidths(expList));
108 const auto nphys = expList->GetTotPoints();
109 const auto ncoeffs = expList->GetNcoeffs();
112 for (
unsigned int i = 0; i < nComp; ++i)
114 std::copy(inPhys.data() + i * totalPhys + physOffset,
115 inPhys.data() + i * totalPhys + physOffset + nphys,
116 localIn.data() + i * nphys);
119 in.template CopyArray<NektarSpaces::HostSpace>(localIn);
120 out.template Initialize<NektarSpaces::HostSpace>(0.0);
125 const auto outVec = out.template ToVector<TData>();
126 for (
unsigned int i = 0; i < nComp; ++i)
128 std::copy(outVec.begin() + i * ncoeffs,
129 outVec.begin() + (i + 1) * ncoeffs,
130 result.begin() + i * totalCoeffs + coeffOffset);
134 coeffOffset += ncoeffs;
137 this->
fixt_out->template CopyVector<NektarSpaces::HostSpace>(result);
142 const auto &components = this->
session->GetVariables();
143 const auto nComp = components.size();
147 auto inPhys = this->
fixt_in->template ToArray<double>();
149 size_t physOffset = 0;
150 size_t coeffOffset = 0;
152 for (
const auto &expList : boundaryExp)
154 const auto nphys = expList->GetTotPoints();
155 const auto ncoeffs = expList->GetNcoeffs();
158 for (
unsigned int i = 0; i < nComp; ++i)
162 std::copy(inPhys.data() + i * totalPhys + physOffset,
163 inPhys.data() + i * totalPhys + physOffset +
165 result.data() + i * totalCoeffs + coeffOffset);
169 expList->FwdTransBndConstrained(
170 inPhys + i * totalPhys + physOffset,
171 tmp = result + i * totalCoeffs + coeffOffset);
176 coeffOffset += ncoeffs;
179 this->
fixt_expected->template CopyArray<NektarSpaces::HostSpace>(
185 const std::string &variable)
const
192 bcfield->EvaluateBoundaryConditions(0.0);
201 const auto &bndExp = bcfield->GetBndCondExpansions();
203 std::vector<MultiRegions::ExpListSharedPtr> result;
204 result.reserve(bndExp.size());
205 for (
size_t i = 0; i < bndExp.size(); ++i)
207 result.push_back(bndExp[i]);
215 const auto &components = this->
session->GetVariables();
216 const auto nComp = components.size();
220 std::vector<TData> result(totalPhys * nComp, 0.0);
222 for (
unsigned int i = 0; i < nComp; ++i)
225 const auto &bndExp = bcfield->GetBndCondExpansions();
226 size_t physOffset = 0;
228 for (
size_t j = 0; j < bndExp.size(); ++j)
230 const auto &expList = bndExp[j];
231 const auto nphys = expList->GetTotPoints();
235 const auto &coeffs = expList->GetCoeffs();
236 std::copy(coeffs.begin(), coeffs.begin() + nphys,
237 result.begin() + i * totalPhys + physOffset);
241 const auto &phys = expList->GetPhys();
242 std::copy(phys.begin(), phys.begin() + nphys,
243 result.begin() + i * totalPhys + physOffset);
254 const std::vector<MultiRegions::ExpListSharedPtr> &boundaryExp)
const
256 size_t totalPhys = 0;
257 for (
const auto &expList : boundaryExp)
259 totalPhys += expList->GetTotPoints();
266 const std::vector<MultiRegions::ExpListSharedPtr> &boundaryExp)
const
268 size_t totalCoeffs = 0;
269 for (
const auto &expList : boundaryExp)
271 totalCoeffs += expList->GetNcoeffs();
277 template <FieldState TState>
281 std::vector<BlockAttributes<TState>> blockAttr;
283 for (
const auto &expList : boundaryExp)
285 nBlocks += GetBlockAttributes<TData, TState>(
286 expList, MultiRegions::UnitInterleaveWidths(expList))
290 blockAttr.reserve(nBlocks);
291 for (
const auto &expList : boundaryExp)
293 auto bcBlockAttr = GetBlockAttributes<TData, TState>(
294 expList, MultiRegions::UnitInterleaveWidths(expList));
295 for (
const auto &attr : bcBlockAttr)
297 blockAttr.emplace_back(attr);
306#if defined(NEKTAR_ENABLE_SINGLE_PRECISION)
307#define TESTFLOAT(type, filename) \
308 class type##float : public TestFwdTransBC<float> \
313 meshName = filename; \
317#define TESTFLOAT(type, filename)
319#if defined(NEKTAR_ENABLE_DOUBLE_PRECISION)
320#define TESTDOUBLE(type, filename) \
321 class type : public TestFwdTransBC<double> \
326 meshName = filename; \
330#define TESTDOUBLE(type, filename)
332#define TEST(type, filename) \
333 TESTFLOAT(type, filename) \
334 TESTDOUBLE(type, filename)
337TEST(Helmholtz1D_Seg,
"run/Helmholtz1D_P8.xml")
338TEST(Helmholtz1D_Seg_3C, "run/Helmholtz1D_3C_mixedBC.xml")
339TEST(Helmholtz2D_Tri, "run/Helmholtz2D_Tri.xml")
340TEST(Helmholtz2D_Quad, "run/Helmholtz2D_Quad.xml")
341TEST(Helmholtz2D_Tri_Quad, "run/Helmholtz2D_varP.xml")
342TEST(Helmholtz2D_Tri_Quad_3C, "run/Helmholtz2D_3C.xml")
343TEST(Helmholtz2D_AllBCs, "run/Helmholtz2D_P7_AllBCs.xml")
344TEST(Helmholtz3D_Hex, "run/Helmholtz3D_Hex_Heterogeneous.xml")
345TEST(Helmholtz3D_Hex_3C, "run/Helmholtz3D_Hex_3C.xml")
346TEST(Helmholtz3D_Prism, "run/Helmholtz3D_Prism_VarP.xml")
347TEST(Helmholtz3D_Pyr, "run/Helmholtz3D_Pyr_VarP.xml")
348TEST(Helmholtz3D_Tet, "run/Helmholtz3D_Tet_VarP.xml")
SpatialDomains::MeshGraphSharedPtr graph
#define TEST(type, filename)
A Field represents expansion data to be operated on.
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
static std::shared_ptr< FwdTransBCOp< TData > > Create(const MultiRegions::ExpListSharedPtr &expansionList, const std::vector< std::string > &components, const std::string &execStr="")
static MeshGraphSharedPtr Read(const LibUtilities::SessionReaderSharedPtr pSession, LibUtilities::DomainRangeShPtr rng=LibUtilities::NullDomainRangeShPtr, bool fillGraph=true, SpatialDomains::MeshGraphSharedPtr partitionedGraph=nullptr)
void SetFixture(const unsigned int nhomo) override
size_t GetTotalBoundaryCoeffs(const std::vector< MultiRegions::ExpListSharedPtr > &boundaryExp) const
std::vector< MultiRegions::ExpListSharedPtr > GetBoundaryConditionExpansions() const
size_t GetTotalBoundaryPoints(const std::vector< MultiRegions::ExpListSharedPtr > &boundaryExp) const
std::shared_ptr< MultiRegions::ContField > CreateBoundaryField(const std::string &variable) const
std::vector< TData > GetBoundaryPhysValues() const
std::vector< BlockAttributes< TState > > GetBoundaryBlockAttributes() const
std::shared_ptr< MultiRegions::ExpList > fixt_explist
Field< TData, stateOut > * fixt_out
Field< TData, stateIn > * fixt_in
Field< TData, stateOut > * fixt_expected
LibUtilities::SessionReaderSharedPtr session