Nektar++
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
TestOptimization Class Reference

#include <TestOptimization.hpp>

Public Member Functions

 TestOptimization ()
 
 ~TestOptimization ()
 
void Configure (const std::string &execSpace)
 
void Configure (const std::string &execSpace, const std::string &impl)
 
MultiRegions::ExpListSharedPtr ExpansionList (const int nmodes)
 The mesh with every element at nmodes orthogonal modes, so that a test sets the expansion order the default implementation follows. The orthogonal basis is the one that admits a single mode (order 0).
 
MultiRegions::ExpListSharedPtr ExpansionList (const int nmodesFirst, const int nmodesSecond)
 The mesh with its first half of elements (composite C[0]) at nmodesFirst orthogonal modes and its second half at nmodesSecond, so that a test can give the two blocks different orders.
 

Protected Attributes

std::string meshName = ""
 
LibUtilities::SessionReaderSharedPtr session
 

Detailed Description

Definition at line 43 of file TestOptimization.hpp.

Constructor & Destructor Documentation

◆ TestOptimization()

TestOptimization::TestOptimization ( )
inline

Definition at line 46 of file TestOptimization.hpp.

47 {
48 meshName = "run/optimization.xml";
49 }

References meshName.

◆ ~TestOptimization()

TestOptimization::~TestOptimization ( )
inline

Definition at line 51 of file TestOptimization.hpp.

52 {
53 BOOST_TEST_MESSAGE("teardown fixture");
54 }

Member Function Documentation

◆ Configure() [1/2]

void TestOptimization::Configure ( const std::string &  execSpace)
inline

Definition at line 56 of file TestOptimization.hpp.

57 {
58 BOOST_TEST_MESSAGE("Creating input and output fields");
59
60 // Construct a fake command-line argument array to be fed to
61 // Session::Reader::CreateInstance. The first element stands for
62 // the name of the executable which, in our case, doesn't matter.
63 int argc = 3;
64 char **argv = new char *[argc];
65 argv[0] = strdup("exe_name");
66 argv[1] = strdup(meshName.data());
67 argv[2] = strdup(("--opExecSpace=" + execSpace).c_str());
68
70 session->InitSession();
71
72 for (int i = 0; i < argc; ++i)
73 {
74 free(argv[i]);
75 }
76 delete[] argv;
77 }
static SessionReaderSharedPtr CreateInstance(int argc, char *argv[])
Creates an instance of the SessionReader class.
LibUtilities::SessionReaderSharedPtr session

References Nektar::LibUtilities::SessionReader::CreateInstance(), meshName, and session.

◆ Configure() [2/2]

void TestOptimization::Configure ( const std::string &  execSpace,
const std::string &  impl 
)
inline

Definition at line 79 of file TestOptimization.hpp.

80 {
81 BOOST_TEST_MESSAGE("Creating input and output fields");
82
83 // Construct a fake command-line argument array to be fed to
84 // Session::Reader::CreateInstance. The first element stands for
85 // the name of the executable which, in our case, doesn't matter.
86 int argc = 4;
87 char **argv = new char *[argc];
88 argv[0] = strdup("exe_name");
89 argv[1] = meshName.data();
90 argv[2] = strdup(("--opExecSpace=" + execSpace).c_str());
91 argv[3] = strdup(("--opImpl=" + impl).c_str());
92
94 session->InitSession();
95
96 delete[] argv;
97 }

References Nektar::LibUtilities::SessionReader::CreateInstance(), meshName, and session.

◆ ExpansionList() [1/2]

MultiRegions::ExpListSharedPtr TestOptimization::ExpansionList ( const int  nmodes)
inline

The mesh with every element at nmodes orthogonal modes, so that a test sets the expansion order the default implementation follows. The orthogonal basis is the one that admits a single mode (order 0).

Definition at line 102 of file TestOptimization.hpp.

103 {
104 return ExpansionList(nmodes, nmodes);
105 }
MultiRegions::ExpListSharedPtr ExpansionList(const int nmodes)
The mesh with every element at nmodes orthogonal modes, so that a test sets the expansion order the d...

References ExpansionList().

Referenced by ExpansionList().

◆ ExpansionList() [2/2]

MultiRegions::ExpListSharedPtr TestOptimization::ExpansionList ( const int  nmodesFirst,
const int  nmodesSecond 
)
inline

The mesh with its first half of elements (composite C[0]) at nmodesFirst orthogonal modes and its second half at nmodesSecond, so that a test can give the two blocks different orders.

Definition at line 111 of file TestOptimization.hpp.

113 {
116 for (const auto &expInfo : graph->GetExpansionInfo("u"))
117 {
118 expInfo.second->m_basisKeyVector =
120 expInfo.second->m_geomPtr, SpatialDomains::eOrthogonal,
121 expInfo.first < 5 ? nmodesFirst : nmodesSecond);
122 }
124 session, graph, true, "u");
125 }
SpatialDomains::MeshGraphSharedPtr graph
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
static LibUtilities::BasisKeyVector DefineBasisKeyFromExpansionType(Geometry *in, ExpansionType type, const int order, const int numpoints=-1)
The basis keys of expansion type type at order on in, with numpoints quadrature points in every direc...
static MeshGraphSharedPtr Read(const LibUtilities::SessionReaderSharedPtr pSession, LibUtilities::DomainRangeShPtr rng=LibUtilities::NullDomainRangeShPtr, bool fillGraph=true, SpatialDomains::MeshGraphSharedPtr partitionedGraph=nullptr)
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
Definition MeshGraph.h:287

References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), Nektar::SpatialDomains::MeshGraph::DefineBasisKeyFromExpansionType(), Nektar::SpatialDomains::eOrthogonal, graph, Nektar::SpatialDomains::MeshGraphIO::Read(), and session.

Member Data Documentation

◆ meshName

std::string TestOptimization::meshName = ""
protected

Definition at line 128 of file TestOptimization.hpp.

Referenced by Configure(), Configure(), and TestOptimization().

◆ session

LibUtilities::SessionReaderSharedPtr TestOptimization::session
protected

Definition at line 129 of file TestOptimization.hpp.

Referenced by Configure(), Configure(), and ExpansionList().