Nektar++
TestLocCollapsedCoords.cpp
Go to the documentation of this file.
1///////////////////////////////////////////////////////////////////////////////
2//
3// File: TestLocCollapsedCoords.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: Test Cartesian <-> collapsed coordinates
32//
33///////////////////////////////////////////////////////////////////////////////
34
38
39#include <boost/test/tools/floating_point_comparison.hpp>
40#include <boost/test/unit_test.hpp>
41
43{
44
45BOOST_AUTO_TEST_CASE(TestLocCollapsedCoordsTet)
46{
47 unsigned int nq = 6;
48 auto pkey0 =
50 auto pkey1 =
51 LibUtilities::PointsKey(nq - 1, LibUtilities::eGaussRadauMAlpha1Beta0);
52 auto pkey2 =
53 LibUtilities::PointsKey(nq - 1, LibUtilities::eGaussRadauMAlpha2Beta0);
54
55 unsigned int nm = 4;
59
60 // Create tet expansion
61 auto stdTet = StdRegions::StdTetExp(bkey0, bkey1, bkey2);
62
63 // Get some evenly distributed points
64 auto pkey =
66 auto evenlySpaced = LibUtilities::PointsManager()[pkey];
67
68 int np = evenlySpaced->GetTotNumPoints();
69 Array<OneD, NekDouble> xc(np), yc(np), zc(np);
70 evenlySpaced->GetPoints(xc, yc, zc);
71
72 double epsilon = 1.0e-8;
73
74 // Loop over points and ensure that the xi -> eta -> xi mapping returns the
75 // original coordinates in the tetrahedron.
76 for (auto i = 0; i < np; ++i)
77 {
78 Array<OneD, NekDouble> xi(3), eta(3), tmp(3);
79 xi[0] = xc[i];
80 xi[1] = yc[i];
81 xi[2] = zc[i];
82
83 stdTet.LocCoordToLocCollapsed(xi, eta);
84 stdTet.LocCollapsedToLocCoord(eta, tmp);
85
86 BOOST_CHECK_CLOSE(tmp[0], xi[0], epsilon);
87 BOOST_CHECK_CLOSE(tmp[1], xi[1], epsilon);
88 BOOST_CHECK_CLOSE(tmp[2], xi[2], epsilon);
89 }
90}
91} // namespace Nektar::StdRegionsTests
Describes the specification for a Basis.
Definition: Basis.h:45
Defines a specification for a set of points.
Definition: Points.h:50
PointsManagerT & PointsManager(void)
@ eGaussLobattoLegendre
1D Gauss-Lobatto-Legendre quadrature points
Definition: PointsType.h:51
@ eNodalTetEvenlySpaced
3D Evenly-spaced points on a Tetrahedron
Definition: PointsType.h:84
@ eModified_B
Principle Modified Functions .
Definition: BasisType.h:49
@ eModified_C
Principle Modified Functions .
Definition: BasisType.h:50
@ eModified_A
Principle Modified Functions .
Definition: BasisType.h:48
BOOST_AUTO_TEST_CASE(TestLocCollapsedCoordsTet)