Nektar++
Foundations/Points.cpp
Go to the documentation of this file.
1///////////////////////////////////////////////////////////////////////////////
2//
3// File: Points.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: 1D Points definitions
32//
33///////////////////////////////////////////////////////////////////////////////
34
36
38{
39/**
40 * @class PointsKey
41 * Specification for a set of points. This includes the total number of
42 * points, as well as their distribution.
43 */
44
45bool operator==(const PointsKey &lhs, const PointsKey &rhs)
46{
47 return (lhs.m_numpoints == rhs.m_numpoints &&
48 lhs.m_pointstype == rhs.m_pointstype);
49}
50
51bool operator<(const PointsKey &lhs, const PointsKey &rhs)
52{
53 if (lhs.m_pointstype < rhs.m_pointstype)
54 {
55 return true;
56 }
57
58 if (lhs.m_pointstype > rhs.m_pointstype)
59 {
60 return false;
61 }
62
63 if (lhs.m_numpoints < rhs.m_numpoints)
64 {
65 return true;
66 }
67
68 if (lhs.m_numpoints > rhs.m_numpoints)
69 {
70 return false;
71 }
72
73 if (lhs.m_factor < rhs.m_factor)
74 {
75 return true;
76 }
77
78 if (lhs.m_factor > rhs.m_factor)
79 {
80 return false;
81 }
82
83 return false;
84}
85
87 const PointsKey &rhs) const
88{
89 return (lhs.m_pointstype < rhs.m_pointstype);
90}
91
92std::ostream &operator<<(std::ostream &os, const PointsKey &rhs)
93{
94 os << "NumPoints: " << rhs.GetNumPoints()
95 << " PointsType: " << kPointsTypeStr[rhs.GetPointsType()] << std::endl;
96
97 return os;
98}
99
100/**
101 * @class Nektar::LibUtilities::Points
102 * This encapsulates a set of points, specified by a PointKey. The
103 * class stores not only the point coordinates, but also the
104 * integration weights and derivative matrix coefficients. Memory is
105 * allocated from the memory pool if in use.
106 */
107
108} // namespace Nektar::LibUtilities
Defines a specification for a set of points.
Definition: Points.h:50
size_t m_numpoints
number of the points (as appropriately defined for PointsType)
Definition: Points.h:216
PointsType GetPointsType() const
Definition: Points.h:90
PointsType m_pointstype
Type of Points.
Definition: Points.h:218
size_t GetNumPoints() const
Definition: Points.h:85
NekDouble m_factor
optional factor
Definition: Points.h:219
bool operator==(const BasisKey &x, const BasisKey &y)
const std::string kPointsTypeStr[]
Definition: Foundations.hpp:52
bool operator<(const BasisKey &lhs, const BasisKey &rhs)
std::ostream & operator<<(std::ostream &os, const BasisKey &rhs)
bool operator()(const PointsKey &lhs, const PointsKey &rhs) const