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