Nektar++
TestReOrientFacePhysMap.cpp
Go to the documentation of this file.
1///////////////////////////////////////////////////////////////////////////////
2//
3// File: TestReOrientFacePhysMap.cpp
4//
5// For more information, please see: http://www.nektar.info
6//
7// The MIT License
8//
9// Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
10// Department of Aeronautics, Imperial College London (UK), and Scientific
11// Computing and Imaging Institute, University of Utah (USA).
12//
13// Permission is hereby granted, free of charge, to any person obtaining a
14// copy of this software and associated documentation files (the "Software"),
15// to deal in the Software without restriction, including without limitation
16// the rights to use, copy, modify, merge, publish, distribute, sublicense,
17// and/or sell copies of the Software, and to permit persons to whom the
18// Software is furnished to do so, subject to the following conditions:
19//
20// The above copyright notice and this permission notice shall be included
21// in all copies or substantial portions of the Software.
22//
23// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29// DEALINGS IN THE SOFTWARE.
30//
31// Description:
32//
33///////////////////////////////////////////////////////////////////////////////
34
36#include <LocalRegions/HexExp.h>
39#include <boost/test/unit_test.hpp>
40
42{
43
45 unsigned int id, SpatialDomains::PointGeomSharedPtr v0,
47{
48 SpatialDomains::PointGeomSharedPtr vertices[] = {v0, v1};
50 new SpatialDomains::SegGeom(id, 3, vertices));
51 return result;
52}
53
63{
76
78 edgesF0[Nektar::SpatialDomains::QuadGeom::kNedges] = {e0, e1, e2, e3};
80 edgesF1[Nektar::SpatialDomains::QuadGeom::kNedges] = {e0, e5, e8, e4};
82 edgesF2[Nektar::SpatialDomains::QuadGeom::kNedges] = {e1, e6, e9, e5};
84 edgesF3[Nektar::SpatialDomains::QuadGeom::kNedges] = {e2, e6, e10, e7};
86 edgesF4[Nektar::SpatialDomains::QuadGeom::kNedges] = {e3, e7, e11, e4};
88 edgesF5[Nektar::SpatialDomains::QuadGeom::kNedges] = {e8, e9, e10, e11};
89
91 new SpatialDomains::QuadGeom(0, edgesF0));
93 new SpatialDomains::QuadGeom(1, edgesF1));
95 new SpatialDomains::QuadGeom(2, edgesF2));
97 new SpatialDomains::QuadGeom(3, edgesF3));
99 new SpatialDomains::QuadGeom(4, edgesF4));
101 new SpatialDomains::QuadGeom(5, edgesF5));
102
103 Nektar::SpatialDomains::QuadGeomSharedPtr qfaces[] = {face0, face1, face2,
104 face3, face4, face5};
106 new SpatialDomains::HexGeom(0, qfaces));
107 return hexGeom;
108}
109
110BOOST_AUTO_TEST_CASE(TestReOrientQuadFacePhysMap)
111{
113 new SpatialDomains::PointGeom(3u, 0u, -1.0, -1.0, -1.0));
115 new SpatialDomains::PointGeom(3u, 1u, 1.0, -1.0, -1.0));
117 new SpatialDomains::PointGeom(3u, 2u, 1.0, 1.0, -1.0));
119 new SpatialDomains::PointGeom(3u, 3u, -1.0, 1.0, -1.0));
121 new SpatialDomains::PointGeom(3u, 4u, -1.0, -1.0, 1.0));
123 new SpatialDomains::PointGeom(3u, 5u, 1.0, -1.0, 1.0));
125 new SpatialDomains::PointGeom(3u, 6u, 1.0, 1.0, 1.0));
127 new SpatialDomains::PointGeom(3u, 7u, -1.0, 1.0, 1.0));
128
130 CreateHex(v0, v1, v2, v3, v4, v5, v6, v7);
131
132 Nektar::LibUtilities::PointsType quadPointsTypeDir1 =
134 Nektar::LibUtilities::BasisType basisTypeDir1 =
136 unsigned int numQuadPoints = 6;
137 const Nektar::LibUtilities::PointsKey quadPointsKeyDir1(numQuadPoints,
138 quadPointsTypeDir1);
139 const Nektar::LibUtilities::BasisKey basisKeyDir1(basisTypeDir1, 4,
140 quadPointsKeyDir1);
141
142 // Dummy 3D expansion
145 basisKeyDir1, basisKeyDir1, basisKeyDir1, hexGeom);
146
147 // Initialiaze 3*3 face id map for quad
148 int nq0 = 3;
149 int nq1 = 3;
150 Array<OneD, int> idmap(nq0 * nq1, -1);
151
152 // Test different orientations
154
156 exp3d->ReOrientTracePhysMap(orient, idmap, nq0, nq1);
157 BOOST_CHECK_EQUAL(idmap[0], 0);
158 BOOST_CHECK_EQUAL(idmap[1], 1);
159 BOOST_CHECK_EQUAL(idmap[2], 2);
160 BOOST_CHECK_EQUAL(idmap[3], 3);
161 BOOST_CHECK_EQUAL(idmap[4], 4);
162 BOOST_CHECK_EQUAL(idmap[5], 5);
163 BOOST_CHECK_EQUAL(idmap[6], 6);
164 BOOST_CHECK_EQUAL(idmap[7], 7);
165 BOOST_CHECK_EQUAL(idmap[8], 8);
166
168 exp3d->ReOrientTracePhysMap(orient, idmap, nq0, nq1);
169 BOOST_CHECK_EQUAL(idmap[0], 6);
170 BOOST_CHECK_EQUAL(idmap[1], 7);
171 BOOST_CHECK_EQUAL(idmap[2], 8);
172 BOOST_CHECK_EQUAL(idmap[3], 3);
173 BOOST_CHECK_EQUAL(idmap[4], 4);
174 BOOST_CHECK_EQUAL(idmap[5], 5);
175 BOOST_CHECK_EQUAL(idmap[6], 0);
176 BOOST_CHECK_EQUAL(idmap[7], 1);
177 BOOST_CHECK_EQUAL(idmap[8], 2);
178
180 exp3d->ReOrientTracePhysMap(orient, idmap, nq0, nq1);
181 BOOST_CHECK_EQUAL(idmap[0], 2);
182 BOOST_CHECK_EQUAL(idmap[1], 1);
183 BOOST_CHECK_EQUAL(idmap[2], 0);
184 BOOST_CHECK_EQUAL(idmap[3], 5);
185 BOOST_CHECK_EQUAL(idmap[4], 4);
186 BOOST_CHECK_EQUAL(idmap[5], 3);
187 BOOST_CHECK_EQUAL(idmap[6], 8);
188 BOOST_CHECK_EQUAL(idmap[7], 7);
189 BOOST_CHECK_EQUAL(idmap[8], 6);
190
192 exp3d->ReOrientTracePhysMap(orient, idmap, nq0, nq1);
193 BOOST_CHECK_EQUAL(idmap[0], 8);
194 BOOST_CHECK_EQUAL(idmap[1], 7);
195 BOOST_CHECK_EQUAL(idmap[2], 6);
196 BOOST_CHECK_EQUAL(idmap[3], 5);
197 BOOST_CHECK_EQUAL(idmap[4], 4);
198 BOOST_CHECK_EQUAL(idmap[5], 3);
199 BOOST_CHECK_EQUAL(idmap[6], 2);
200 BOOST_CHECK_EQUAL(idmap[7], 1);
201 BOOST_CHECK_EQUAL(idmap[8], 0);
202
204 exp3d->ReOrientTracePhysMap(orient, idmap, nq0, nq1);
205 BOOST_CHECK_EQUAL(idmap[0], 0);
206 BOOST_CHECK_EQUAL(idmap[1], 3);
207 BOOST_CHECK_EQUAL(idmap[2], 6);
208 BOOST_CHECK_EQUAL(idmap[3], 1);
209 BOOST_CHECK_EQUAL(idmap[4], 4);
210 BOOST_CHECK_EQUAL(idmap[5], 7);
211 BOOST_CHECK_EQUAL(idmap[6], 2);
212 BOOST_CHECK_EQUAL(idmap[7], 5);
213 BOOST_CHECK_EQUAL(idmap[8], 8);
214
216 exp3d->ReOrientTracePhysMap(orient, idmap, nq0, nq1);
217 BOOST_CHECK_EQUAL(idmap[0], 2);
218 BOOST_CHECK_EQUAL(idmap[1], 5);
219 BOOST_CHECK_EQUAL(idmap[2], 8);
220 BOOST_CHECK_EQUAL(idmap[3], 1);
221 BOOST_CHECK_EQUAL(idmap[4], 4);
222 BOOST_CHECK_EQUAL(idmap[5], 7);
223 BOOST_CHECK_EQUAL(idmap[6], 0);
224 BOOST_CHECK_EQUAL(idmap[7], 3);
225 BOOST_CHECK_EQUAL(idmap[8], 6);
226
228 exp3d->ReOrientTracePhysMap(orient, idmap, nq0, nq1);
229 BOOST_CHECK_EQUAL(idmap[0], 6);
230 BOOST_CHECK_EQUAL(idmap[1], 3);
231 BOOST_CHECK_EQUAL(idmap[2], 0);
232 BOOST_CHECK_EQUAL(idmap[3], 7);
233 BOOST_CHECK_EQUAL(idmap[4], 4);
234 BOOST_CHECK_EQUAL(idmap[5], 1);
235 BOOST_CHECK_EQUAL(idmap[6], 8);
236 BOOST_CHECK_EQUAL(idmap[7], 5);
237 BOOST_CHECK_EQUAL(idmap[8], 2);
238
240 exp3d->ReOrientTracePhysMap(orient, idmap, nq0, nq1);
241 BOOST_CHECK_EQUAL(idmap[0], 8);
242 BOOST_CHECK_EQUAL(idmap[1], 5);
243 BOOST_CHECK_EQUAL(idmap[2], 2);
244 BOOST_CHECK_EQUAL(idmap[3], 7);
245 BOOST_CHECK_EQUAL(idmap[4], 4);
246 BOOST_CHECK_EQUAL(idmap[5], 1);
247 BOOST_CHECK_EQUAL(idmap[6], 6);
248 BOOST_CHECK_EQUAL(idmap[7], 3);
249 BOOST_CHECK_EQUAL(idmap[8], 0);
250}
251
252} // namespace Nektar::Expansion3DTests
Describes the specification for a Basis.
Definition: Basis.h:45
Defines a specification for a set of points.
Definition: Points.h:50
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
static const int kNedges
Definition: QuadGeom.h:74
BOOST_AUTO_TEST_CASE(TestReOrientQuadFacePhysMap)
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)
SpatialDomains::SegGeomSharedPtr CreateSegGeom(unsigned int id, SpatialDomains::PointGeomSharedPtr v0, SpatialDomains::PointGeomSharedPtr v1)
@ 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< QuadGeom > QuadGeomSharedPtr
Definition: HexGeom.h:45
std::shared_ptr< HexGeom > HexGeomSharedPtr
Definition: HexGeom.h:84
std::shared_ptr< SegGeom > SegGeomSharedPtr
Definition: Geometry2D.h:59
std::shared_ptr< PointGeom > PointGeomSharedPtr
Definition: Geometry.h:57