Nektar++
Functions | Variables
Nektar::VarcoeffHashingTest Namespace Reference

Functions

void createSessionFile (boost::filesystem::path &ph)
 
void setupContFieldSolve (boost::filesystem::path &ph, LibUtilities::SessionReaderSharedPtr &Session, MultiRegions::ContFieldSharedPtr &Exp, MultiRegions::ContFieldSharedPtr &Fce)
 
 BOOST_AUTO_TEST_CASE (TestVarcoeffHashing)
 
 BOOST_AUTO_TEST_CASE (TestUnsetGlobalLinSys)
 

Variables

boost::filesystem::path pathGlobal
 
LibUtilities::SessionReaderSharedPtr lsession
 
MultiRegions::ContFieldSharedPtr contfield
 
MultiRegions::ContFieldSharedPtr forcefield
 
StdRegions::ConstFactorMap factors
 
StdRegions::VarCoeffMap varcoeffs1
 
StdRegions::VarCoeffMap varcoeffs2
 
static const std::string sessionfile
 

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/2]

Nektar::VarcoeffHashingTest::BOOST_AUTO_TEST_CASE ( TestUnsetGlobalLinSys  )

Definition at line 297 of file TestVarcoeffHashing.cpp.

298{
299 // Check that the test setup is clear i.e. count == 0
300 BOOST_CHECK_EQUAL(contfield->GetPoolCount("GlobalLinSys"), 0);
301
302 // Create 1st GlobalLinSys
303 auto gkey1 = contfield->LinearAdvectionDiffusionReactionSolve(
304 forcefield->GetPhys(), contfield->UpdateCoeffs(), factors, varcoeffs1);
305
306 // Check count == 1
307 BOOST_CHECK_EQUAL(contfield->GetPoolCount("GlobalLinSys"), 1);
308
309 // Create 2nd GlobalLinSys
310 auto gkey2 = contfield->LinearAdvectionDiffusionReactionSolve(
311 forcefield->GetPhys(), contfield->UpdateCoeffs(), factors, varcoeffs2);
312
313 // Check count == 2
314 BOOST_CHECK_EQUAL(contfield->GetPoolCount("GlobalLinSys"), 2);
315
316 // Unset GlobalLinSys1
317 contfield->UnsetGlobalLinSys(gkey1, true);
318
319 // Check count == 1
320 BOOST_CHECK_EQUAL(contfield->GetPoolCount("GlobalLinSys"), 1);
321
322 // Unset GlobalLinSys2
323 contfield->UnsetGlobalLinSys(gkey2, true);
324
325 // Check count == 0
326 BOOST_CHECK_EQUAL(contfield->GetPoolCount("GlobalLinSys"), 0);
327
328 // Clear for next tests
329 contfield->ClearGlobalLinSysManager();
330}
MultiRegions::ContFieldSharedPtr forcefield
MultiRegions::ContFieldSharedPtr contfield
StdRegions::VarCoeffMap varcoeffs1
StdRegions::VarCoeffMap varcoeffs2
StdRegions::ConstFactorMap factors

References contfield, factors, forcefield, varcoeffs1, and varcoeffs2.

◆ BOOST_AUTO_TEST_CASE() [2/2]

Nektar::VarcoeffHashingTest::BOOST_AUTO_TEST_CASE ( TestVarcoeffHashing  )

Definition at line 256 of file TestVarcoeffHashing.cpp.

257{
258 // Create session file and setup Contfield
261
262 // Check no initial GlobalLinSys i.e. count == 0
263 BOOST_CHECK_EQUAL(contfield->GetPoolCount("GlobalLinSys"), 0);
264
265 // Create GlobalLinSys(varcoeff1)
266 contfield->HelmSolve(forcefield->GetPhys(), contfield->UpdateCoeffs(),
268
269 // Check count == 1
270 BOOST_CHECK_EQUAL(contfield->GetPoolCount("GlobalLinSys"), 1);
271
272 // Create new GlobalLinSys(varcoeff2)
273 contfield->HelmSolve(forcefield->GetPhys(), contfield->UpdateCoeffs(),
275
276 // Check count == 2
277 BOOST_CHECK_EQUAL(contfield->GetPoolCount("GlobalLinSys"), 2);
278
279 // Again use 2nd GlobalLinSys(varcoeff2)
280 contfield->HelmSolve(forcefield->GetPhys(), contfield->UpdateCoeffs(),
282
283 // Check count still == 2
284 BOOST_CHECK_EQUAL(contfield->GetPoolCount("GlobalLinSys"), 2);
285
286 // Again use 1st GlobalLinSys(varcoeff1)
287 contfield->HelmSolve(forcefield->GetPhys(), contfield->UpdateCoeffs(),
289
290 // Check count still == 2
291 BOOST_CHECK_EQUAL(contfield->GetPoolCount("GlobalLinSys"), 2);
292
293 // Clear for next tests
294 contfield->ClearGlobalLinSysManager();
295}
void setupContFieldSolve(boost::filesystem::path &ph, LibUtilities::SessionReaderSharedPtr &Session, MultiRegions::ContFieldSharedPtr &Exp, MultiRegions::ContFieldSharedPtr &Fce)
boost::filesystem::path pathGlobal
LibUtilities::SessionReaderSharedPtr lsession
void createSessionFile(boost::filesystem::path &ph)

References contfield, createSessionFile(), factors, forcefield, lsession, pathGlobal, setupContFieldSolve(), varcoeffs1, and varcoeffs2.

◆ createSessionFile()

void Nektar::VarcoeffHashingTest::createSessionFile ( boost::filesystem::path &  ph)

Definition at line 168 of file TestVarcoeffHashing.cpp.

169{
170 // Create temporary directory
171 using namespace boost::filesystem;
172 ph = temp_directory_path() / unique_path();
173 create_directories(ph);
174
175 // Create file in working directory
176 ph /= "TestVarcoeffHashing.xml"; // append filename
177 boost::filesystem::ofstream sfile(ph);
178 sfile << sessionfile;
179 sfile.close();
180}
static const std::string sessionfile

References sessionfile.

Referenced by BOOST_AUTO_TEST_CASE().

◆ setupContFieldSolve()

void Nektar::VarcoeffHashingTest::setupContFieldSolve ( boost::filesystem::path &  ph,
LibUtilities::SessionReaderSharedPtr Session,
MultiRegions::ContFieldSharedPtr Exp,
MultiRegions::ContFieldSharedPtr Fce 
)

Definition at line 187 of file TestVarcoeffHashing.cpp.

191{
192#ifdef _WIN32
193 // Prepare input file name - convert wstring to string to support Windows
194 const std::wstring input_file_wstr(ph.c_str());
195 const std::string input_file_str(input_file_wstr.begin(),
196 input_file_wstr.end());
197 char *input_file = (char *)input_file_str.c_str();
198#else
199 char *input_file = (char *)ph.c_str();
200#endif
201
202 // Setup parameters for call to IncNavierStokesSolver
203 int argc = 2;
204 char *argv[] = {(char *)("IncNavierStokesSolver"), input_file, nullptr};
205
206 // Read Session, MeshGraph and create ContField
207 Session = LibUtilities::SessionReader::CreateInstance(argc, argv);
209 SpatialDomains::MeshGraph::Read(Session);
211 Session, Graph, Session->GetVariable(0));
213
214 // Read functons for varcoeffs and Forcing
215 LibUtilities::EquationSharedPtr d00func = Session->GetFunction("d00", 0);
216 LibUtilities::EquationSharedPtr d00Bfunc = Session->GetFunction("d00B", 0);
217 LibUtilities::EquationSharedPtr ffunc = Session->GetFunction("Forcing", 0);
218
219 // Get coordinates to evaluate functions
220 unsigned int npoints = Exp->GetNpoints();
221 unsigned int coordim = Exp->GetCoordim(0);
222 Array<OneD, NekDouble> x0(npoints), x1(npoints), x2(npoints);
223 Array<OneD, NekDouble> d00(npoints, 0.0), d00B(npoints, 0.0),
224 fcePhys(npoints);
225
226 // Define lambda
227 factors[StdRegions::eFactorLambda] = Session->GetParameter("lambda");
228 Exp->GetCoords(x0, x1, x2);
229
230 // Define 1st varcoeff
231 d00func->Evaluate(x0, x1, x2, d00);
233
234 // Define 2nd varcoeff
235 d00Bfunc->Evaluate(x0, x1, x2, d00B);
237
238 // Define Forcing
239 ffunc->Evaluate(x0, x1, x2, fcePhys);
240 Fce->SetPhys(fcePhys);
241
242 // Define Advection velocities and add to varcoeff1 or 2
246 for (int i = 0; i < coordim; i++)
247 {
248 varcoeffs1[varcoefftypes[i]] = Array<OneD, NekDouble>(npoints, 0.1);
249 varcoeffs2[varcoefftypes[i]] = Array<OneD, NekDouble>(npoints, 0.2);
250 }
251
252 // Clear solution
253 Vmath::Zero(Exp->GetNcoeffs(), Exp->UpdateCoeffs(), 1);
254}
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
std::shared_ptr< Equation > EquationSharedPtr
Definition: Equation.h:129
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
Definition: MeshGraph.h:176
void Zero(int n, T *x, const int incx)
Zero vector.
Definition: Vmath.cpp:487

References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), Nektar::LibUtilities::SessionReader::CreateInstance(), Nektar::StdRegions::eFactorLambda, Nektar::StdRegions::eVarCoeffD00, Nektar::StdRegions::eVarCoeffVelX, Nektar::StdRegions::eVarCoeffVelY, Nektar::StdRegions::eVarCoeffVelZ, factors, Nektar::SpatialDomains::MeshGraph::Read(), varcoeffs1, varcoeffs2, and Vmath::Zero().

Referenced by BOOST_AUTO_TEST_CASE().

Variable Documentation

◆ contfield

MultiRegions::ContFieldSharedPtr Nektar::VarcoeffHashingTest::contfield

Definition at line 50 of file TestVarcoeffHashing.cpp.

Referenced by BOOST_AUTO_TEST_CASE().

◆ factors

StdRegions::ConstFactorMap Nektar::VarcoeffHashingTest::factors

Definition at line 52 of file TestVarcoeffHashing.cpp.

Referenced by Nektar::VelocityCorrectionScheme::AppendSVVFactors(), Nektar::HexCollectionTests::BOOST_AUTO_TEST_CASE(), Nektar::PrismCollectionTests::BOOST_AUTO_TEST_CASE(), Nektar::PyrCollectionTests::BOOST_AUTO_TEST_CASE(), Nektar::QuadCollectionTests::BOOST_AUTO_TEST_CASE(), Nektar::TetCollectionTests::BOOST_AUTO_TEST_CASE(), Nektar::TriCollectionTests::BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), Nektar::LinearElasticSystem::BuildMatrixSystem(), Nektar::Collections::Collection::CheckFactors(), Nektar::Collections::BwdTrans_StdMat::CheckFactors(), Nektar::Collections::BwdTrans_MatrixFree::CheckFactors(), Nektar::Collections::BwdTrans_IterPerExp::CheckFactors(), Nektar::Collections::BwdTrans_NoCollection::CheckFactors(), Nektar::Collections::BwdTrans_SumFac_Seg::CheckFactors(), Nektar::Collections::BwdTrans_SumFac_Quad::CheckFactors(), Nektar::Collections::BwdTrans_SumFac_Tri::CheckFactors(), Nektar::Collections::BwdTrans_SumFac_Hex::CheckFactors(), Nektar::Collections::BwdTrans_SumFac_Tet::CheckFactors(), Nektar::Collections::BwdTrans_SumFac_Prism::CheckFactors(), Nektar::Collections::BwdTrans_SumFac_Pyr::CheckFactors(), Nektar::Collections::Helmholtz_NoCollection::CheckFactors(), Nektar::Collections::Helmholtz_IterPerExp::CheckFactors(), Nektar::Collections::Helmholtz_MatrixFree::CheckFactors(), Nektar::Collections::IProductWRTBase_StdMat::CheckFactors(), Nektar::Collections::IProductWRTBase_MatrixFree::CheckFactors(), Nektar::Collections::IProductWRTBase_IterPerExp::CheckFactors(), Nektar::Collections::IProductWRTBase_NoCollection::CheckFactors(), Nektar::Collections::IProductWRTBase_SumFac_Seg::CheckFactors(), Nektar::Collections::IProductWRTBase_SumFac_Quad::CheckFactors(), Nektar::Collections::IProductWRTBase_SumFac_Tri::CheckFactors(), Nektar::Collections::IProductWRTBase_SumFac_Hex::CheckFactors(), Nektar::Collections::IProductWRTBase_SumFac_Tet::CheckFactors(), Nektar::Collections::IProductWRTBase_SumFac_Prism::CheckFactors(), Nektar::Collections::IProductWRTBase_SumFac_Pyr::CheckFactors(), Nektar::Collections::IProductWRTDerivBase_StdMat::CheckFactors(), Nektar::Collections::IProductWRTDerivBase_MatrixFree::CheckFactors(), Nektar::Collections::IProductWRTDerivBase_IterPerExp::CheckFactors(), Nektar::Collections::IProductWRTDerivBase_NoCollection::CheckFactors(), Nektar::Collections::IProductWRTDerivBase_SumFac_Seg::CheckFactors(), Nektar::Collections::IProductWRTDerivBase_SumFac_Quad::CheckFactors(), Nektar::Collections::IProductWRTDerivBase_SumFac_Tri::CheckFactors(), Nektar::Collections::IProductWRTDerivBase_SumFac_Hex::CheckFactors(), Nektar::Collections::IProductWRTDerivBase_SumFac_Tet::CheckFactors(), Nektar::Collections::IProductWRTDerivBase_SumFac_Prism::CheckFactors(), Nektar::Collections::IProductWRTDerivBase_SumFac_Pyr::CheckFactors(), Nektar::Collections::PhysDeriv_StdMat::CheckFactors(), Nektar::Collections::PhysDeriv_MatrixFree::CheckFactors(), Nektar::Collections::PhysDeriv_IterPerExp::CheckFactors(), Nektar::Collections::PhysDeriv_NoCollection::CheckFactors(), Nektar::Collections::PhysDeriv_SumFac_Seg::CheckFactors(), Nektar::Collections::PhysDeriv_SumFac_Quad::CheckFactors(), Nektar::Collections::PhysDeriv_SumFac_Tri::CheckFactors(), Nektar::Collections::PhysDeriv_SumFac_Hex::CheckFactors(), Nektar::Collections::PhysDeriv_SumFac_Tet::CheckFactors(), Nektar::Collections::PhysDeriv_SumFac_Prism::CheckFactors(), Nektar::Collections::PhysDeriv_SumFac_Pyr::CheckFactors(), Nektar::SpatialDomains::GeomFactors::ComputeDerivFactors(), Nektar::SpatialDomains::GeomFactors::ComputeMovingFrames(), Nektar::SpatialDomains::GeomFactors::ComputePrincipleDirection(), Nektar::LocalRegions::Expansion2D::CreateMatrix(), Nektar::LocalRegions::SegExp::CreateMatrix(), Diffusion::DoImplicitSolve(), Nektar::UnsteadyAdvectionDiffusion::DoImplicitSolve(), Nektar::UnsteadyDiffusion::DoImplicitSolve(), Nektar::UnsteadyReactionDiffusion::DoImplicitSolve(), Nektar::UnsteadyViscousBurgers::DoImplicitSolve(), Nektar::Bidomain::DoImplicitSolve(), Nektar::Monodomain::DoImplicitSolve(), Nektar::MMFDiffusion::DoImplicitSolve(), Nektar::UnsteadyAdvection::DoOdeProjection(), Nektar::ImageWarpingSystem::DoOdeRhs(), Nektar::LocalRegions::QuadExp::GetEdgeInterpVals(), Nektar::LocalRegions::Expansion::GetLocMatrix(), Nektar::Collections::Helmholtz_NoCollection::Helmholtz_NoCollection(), Nektar::MultiRegions::ExpList::HelmSolve(), Nektar::Collections::Collection::Initialise(), Nektar::MultiRegions::ContField::LaplaceSolve(), Nektar::MultiRegions::ExpList::LinearAdvectionDiffusionReactionSolve(), Nektar::MultiRegions::ContField::LinearAdvectionEigs(), main(), Nektar::LocalRegions::Expansion::NormalTraceDerivFactors(), Nektar::Collections::Operator::Operator(), Nektar::SolverUtils::CouplingCwipi::ReceiveCwipi(), setupContFieldSolve(), Nektar::CoupledLinearNS::SetUpCoupledMatrix(), Nektar::Collections::CollectionOptimisation::SetWithTimings(), Nektar::SmoothedProfileMethod::SolveCorrectionPressure(), Nektar::LocalRegions::Expansion2D::v_AddEdgeNormBoundaryInt(), Nektar::SteadyAdvectionDiffusion::v_DoSolve(), Nektar::StdRegions::StdQuadExp::v_GenMatrix(), Nektar::LocalRegions::Expansion1D::v_GenMatrix(), Nektar::LocalRegions::SegExp::v_GetVertexPhysVals(), Nektar::MultiRegions::ExpList::v_HelmSolve(), Nektar::MultiRegions::ContField::v_HelmSolve(), Nektar::MultiRegions::ContField3DHomogeneous1D::v_HelmSolve(), Nektar::MultiRegions::ContField3DHomogeneous2D::v_HelmSolve(), Nektar::MultiRegions::DisContField::v_HelmSolve(), Nektar::MultiRegions::DisContField3DHomogeneous1D::v_HelmSolve(), Nektar::MultiRegions::DisContField3DHomogeneous2D::v_HelmSolve(), Nektar::MultiRegions::ExpList::v_LinearAdvectionDiffusionReactionSolve(), Nektar::MultiRegions::ContField::v_LinearAdvectionDiffusionReactionSolve(), Nektar::MultiRegions::ContField::v_LinearAdvectionReactionSolve(), Nektar::LocalRegions::Expansion::v_NormalTraceDerivFactors(), Nektar::LocalRegions::Expansion1D::v_NormalTraceDerivFactors(), Nektar::FieldUtils::ProcessC0Projection::v_Process(), Nektar::VelocityCorrectionScheme::v_SolvePressure(), Nektar::VCSMapping::v_SolvePressure(), Nektar::VCSImplicit::v_SolvePressure(), Nektar::VCSWeakPressure::v_SolvePressure(), Nektar::VelocityCorrectionScheme::v_SolveViscous(), Nektar::VCSMapping::v_SolveViscous(), and Nektar::VCSImplicit::v_SolveViscous().

◆ forcefield

MultiRegions::ContFieldSharedPtr Nektar::VarcoeffHashingTest::forcefield

Definition at line 50 of file TestVarcoeffHashing.cpp.

Referenced by BOOST_AUTO_TEST_CASE().

◆ lsession

LibUtilities::SessionReaderSharedPtr Nektar::VarcoeffHashingTest::lsession

Definition at line 49 of file TestVarcoeffHashing.cpp.

Referenced by BOOST_AUTO_TEST_CASE().

◆ pathGlobal

boost::filesystem::path Nektar::VarcoeffHashingTest::pathGlobal

Definition at line 48 of file TestVarcoeffHashing.cpp.

Referenced by BOOST_AUTO_TEST_CASE().

◆ sessionfile

const std::string Nektar::VarcoeffHashingTest::sessionfile
static

Definition at line 57 of file TestVarcoeffHashing.cpp.

Referenced by createSessionFile().

◆ varcoeffs1

StdRegions::VarCoeffMap Nektar::VarcoeffHashingTest::varcoeffs1

Definition at line 53 of file TestVarcoeffHashing.cpp.

Referenced by BOOST_AUTO_TEST_CASE(), and setupContFieldSolve().

◆ varcoeffs2

StdRegions::VarCoeffMap Nektar::VarcoeffHashingTest::varcoeffs2

Definition at line 53 of file TestVarcoeffHashing.cpp.

Referenced by BOOST_AUTO_TEST_CASE(), and setupContFieldSolve().