Nektar++
Functions
Nektar::HexExpTests Namespace Reference

Functions

SpatialDomains::SegGeomSharedPtr CreateSegGeom (unsigned int id, SpatialDomains::PointGeomSharedPtr v0, SpatialDomains::PointGeomSharedPtr v1)
 
SpatialDomains::HexGeomSharedPtr CreateHex (SpatialDomains::PointGeomSharedPtr v0, SpatialDomains::PointGeomSharedPtr v1, SpatialDomains::PointGeomSharedPtr v2, SpatialDomains::PointGeomSharedPtr v3, SpatialDomains::PointGeomSharedPtr v4, SpatialDomains::PointGeomSharedPtr v5, SpatialDomains::PointGeomSharedPtr v6, SpatialDomains::PointGeomSharedPtr v7)
 
 BOOST_AUTO_TEST_CASE (TestHexExpThatIsStdRegion)
 
 BOOST_AUTO_TEST_CASE (TestScaledAndTranslatedHexExp)
 

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/2]

Nektar::HexExpTests::BOOST_AUTO_TEST_CASE ( TestHexExpThatIsStdRegion  )

Definition at line 108 of file TestGetCoords.cpp.

109{
111 new SpatialDomains::PointGeom(3u, 0u, -1.0, -1.0, -1.0));
113 new SpatialDomains::PointGeom(3u, 1u, 1.0, -1.0, -1.0));
115 new SpatialDomains::PointGeom(3u, 2u, 1.0, 1.0, -1.0));
117 new SpatialDomains::PointGeom(3u, 3u, -1.0, 1.0, -1.0));
119 new SpatialDomains::PointGeom(3u, 4u, -1.0, -1.0, 1.0));
121 new SpatialDomains::PointGeom(3u, 5u, 1.0, -1.0, 1.0));
123 new SpatialDomains::PointGeom(3u, 6u, 1.0, 1.0, 1.0));
125 new SpatialDomains::PointGeom(3u, 7u, -1.0, 1.0, 1.0));
126
128 CreateHex(v0, v1, v2, v3, v4, v5, v6, v7);
129
130 Nektar::LibUtilities::PointsType quadPointsTypeDir1 =
132 Nektar::LibUtilities::BasisType basisTypeDir1 =
134 unsigned int numQuadPoints = 6;
135 const Nektar::LibUtilities::PointsKey quadPointsKeyDir1(numQuadPoints,
136 quadPointsTypeDir1);
137 const Nektar::LibUtilities::BasisKey basisKeyDir1(basisTypeDir1, 4,
138 quadPointsKeyDir1);
139
142 basisKeyDir1, basisKeyDir1, basisKeyDir1, hexGeom);
143
144 Array<OneD, NekDouble> c0 = Array<OneD, NekDouble>(hexExp->GetTotPoints());
145 Array<OneD, NekDouble> c1 = Array<OneD, NekDouble>(hexExp->GetTotPoints());
146 Array<OneD, NekDouble> c2 = Array<OneD, NekDouble>(hexExp->GetTotPoints());
147 hexExp->GetCoords(c0, c1, c2);
148 std::shared_ptr<StdRegions::StdHexExp> stdHex =
149 std::dynamic_pointer_cast<StdRegions::StdHexExp>(hexExp);
150 stdHex->GetCoords(c0, c1, c2);
151 double epsilon = 1.0e-8;
152 BOOST_CHECK_CLOSE(c0[0], -1.0, epsilon);
153 BOOST_CHECK_CLOSE(c0[1], -0.76505532392946474, epsilon);
154 BOOST_CHECK_CLOSE(c0[2], -0.28523151648064510, epsilon);
155 BOOST_CHECK_CLOSE(c0[3], 0.28523151648064510, epsilon);
156 BOOST_CHECK_CLOSE(c0[4], 0.76505532392946474, epsilon);
157 BOOST_CHECK_CLOSE(c0[5], 1.0, epsilon);
158}
Describes the specification for a Basis.
Definition: Basis.h:45
Defines a specification for a set of points.
Definition: Points.h:50
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
SpatialDomains::HexGeomSharedPtr CreateHex(SpatialDomains::PointGeomSharedPtr v0, SpatialDomains::PointGeomSharedPtr v1, SpatialDomains::PointGeomSharedPtr v2, SpatialDomains::PointGeomSharedPtr v3, SpatialDomains::PointGeomSharedPtr v4, SpatialDomains::PointGeomSharedPtr v5, SpatialDomains::PointGeomSharedPtr v6, SpatialDomains::PointGeomSharedPtr v7)
@ eGaussLobattoLegendre
1D Gauss-Lobatto-Legendre quadrature points
Definition: PointsType.h:51
@ eModified_A
Principle Modified Functions .
Definition: BasisType.h:48
std::shared_ptr< HexExp > HexExpSharedPtr
Definition: HexExp.h:258
std::shared_ptr< HexGeom > HexGeomSharedPtr
Definition: HexGeom.h:84
std::shared_ptr< PointGeom > PointGeomSharedPtr
Definition: Geometry.h:57

References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), CreateHex(), Nektar::LibUtilities::eGaussLobattoLegendre, and Nektar::LibUtilities::eModified_A.

◆ BOOST_AUTO_TEST_CASE() [2/2]

Nektar::HexExpTests::BOOST_AUTO_TEST_CASE ( TestScaledAndTranslatedHexExp  )

Definition at line 160 of file TestGetCoords.cpp.

161{
163 new SpatialDomains::PointGeom(3u, 0u, 0.0, 0.0, 0.0));
165 new SpatialDomains::PointGeom(3u, 1u, 0.5, 0.0, 0.0));
167 new SpatialDomains::PointGeom(3u, 2u, 0.5, 0.5, 0.0));
169 new SpatialDomains::PointGeom(3u, 3u, 0.0, 0.5, 0.0));
171 new SpatialDomains::PointGeom(3u, 4u, 0.0, 0.0, 0.5));
173 new SpatialDomains::PointGeom(3u, 5u, 0.5, 0.0, 0.5));
175 new SpatialDomains::PointGeom(3u, 6u, 0.5, 0.5, 0.5));
177 new SpatialDomains::PointGeom(3u, 7u, 0.0, 0.5, 0.5));
178
180 CreateHex(v0, v1, v2, v3, v4, v5, v6, v7);
181
182 Nektar::LibUtilities::PointsType quadPointsTypeDir1 =
184 Nektar::LibUtilities::BasisType basisTypeDir1 =
186 unsigned int numQuadPoints = 6;
187 const Nektar::LibUtilities::PointsKey quadPointsKeyDir1(numQuadPoints,
188 quadPointsTypeDir1);
189 const Nektar::LibUtilities::BasisKey basisKeyDir1(basisTypeDir1, 4,
190 quadPointsKeyDir1);
191
194 basisKeyDir1, basisKeyDir1, basisKeyDir1, hexGeom);
195
196 Array<OneD, NekDouble> c0 = Array<OneD, NekDouble>(hexExp->GetTotPoints());
197 Array<OneD, NekDouble> c1 = Array<OneD, NekDouble>(hexExp->GetTotPoints());
198 Array<OneD, NekDouble> c2 = Array<OneD, NekDouble>(hexExp->GetTotPoints());
199 hexExp->GetCoords(c0, c1, c2);
200
201 double epsilon = 1.0e-8;
202 BOOST_CHECK_EQUAL(c0[0], 0.0);
203 BOOST_CHECK_CLOSE(c0[1], .05873616902, epsilon);
204 BOOST_CHECK_CLOSE(c0[2], .17869212088, epsilon);
205 BOOST_CHECK_CLOSE(c0[3], .32130787912, epsilon);
206 BOOST_CHECK_CLOSE(c0[4], .44126383098, epsilon);
207 BOOST_CHECK_CLOSE(c0[5], .5, epsilon);
208}

References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), CreateHex(), Nektar::LibUtilities::eGaussLobattoLegendre, and Nektar::LibUtilities::eModified_A.

◆ CreateHex()

Definition at line 52 of file TestGetCoords.cpp.

61{
74
76 edgesF0[Nektar::SpatialDomains::QuadGeom::kNedges] = {e0, e1, e2, e3};
78 edgesF1[Nektar::SpatialDomains::QuadGeom::kNedges] = {e0, e5, e8, e4};
80 edgesF2[Nektar::SpatialDomains::QuadGeom::kNedges] = {e1, e6, e9, e5};
82 edgesF3[Nektar::SpatialDomains::QuadGeom::kNedges] = {e2, e6, e10, e7};
84 edgesF4[Nektar::SpatialDomains::QuadGeom::kNedges] = {e3, e7, e11, e4};
86 edgesF5[Nektar::SpatialDomains::QuadGeom::kNedges] = {e8, e9, e10, e11};
87
89 new SpatialDomains::QuadGeom(0, edgesF0));
91 new SpatialDomains::QuadGeom(1, edgesF1));
93 new SpatialDomains::QuadGeom(2, edgesF2));
95 new SpatialDomains::QuadGeom(3, edgesF3));
97 new SpatialDomains::QuadGeom(4, edgesF4));
99 new SpatialDomains::QuadGeom(5, edgesF5));
100
101 Nektar::SpatialDomains::QuadGeomSharedPtr qfaces[] = {face0, face1, face2,
102 face3, face4, face5};
104 new SpatialDomains::HexGeom(0, qfaces));
105 return hexGeom;
106}
static const int kNedges
Definition: QuadGeom.h:74
SpatialDomains::SegGeomSharedPtr CreateSegGeom(unsigned int id, SpatialDomains::PointGeomSharedPtr v0, SpatialDomains::PointGeomSharedPtr v1)
std::shared_ptr< QuadGeom > QuadGeomSharedPtr
Definition: HexGeom.h:45
std::shared_ptr< SegGeom > SegGeomSharedPtr
Definition: Geometry2D.h:59

References CreateSegGeom(), and Nektar::SpatialDomains::QuadGeom::kNedges.

Referenced by BOOST_AUTO_TEST_CASE().

◆ CreateSegGeom()

SpatialDomains::SegGeomSharedPtr Nektar::HexExpTests::CreateSegGeom ( unsigned int  id,
SpatialDomains::PointGeomSharedPtr  v0,
SpatialDomains::PointGeomSharedPtr  v1 
)

Definition at line 42 of file TestGetCoords.cpp.

45{
46 SpatialDomains::PointGeomSharedPtr vertices[] = {v0, v1};
48 new SpatialDomains::SegGeom(id, 3, vertices));
49 return result;
50}

Referenced by CreateHex().