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 
89  bool PointsKey::opLess::operator()(const PointsKey &lhs, const PointsKey &rhs) const
90  {
91  return (lhs.m_pointstype < rhs.m_pointstype);
92  }
93 
94  std::ostream& operator<<(std::ostream& os, const PointsKey& rhs)
95  {
96  os << "NumPoints: " << rhs.GetNumPoints() << " PointsType: " << kPointsTypeStr[rhs.GetPointsType()] << std::endl;
97 
98  return os;
99  }
100 
101 
102  /**
103  * @class Nektar::LibUtilities::Points
104  * This encapsulates a set of points, specified by a PointKey. The
105  * class stores not only the point coordinates, but also the
106  * integration weights and derivative matrix coefficients. Memory is
107  * allocated from the memory pool if in use.
108  */
109 
110  }
111 }
112 
Defines a specification for a set of points.
Definition: Points.h:60
unsigned int m_numpoints
number of the points (as appropriately defined for PointsType)
Definition: Points.h:234
PointsType GetPointsType() const
Definition: Points.h:112
PointsType m_pointstype
Type of Points.
Definition: Points.h:235
NekDouble m_factor
optional factor
Definition: Points.h:236
unsigned int GetNumPoints() const
Definition: Points.h:107
bool operator==(const BasisKey &x, const BasisKey &y)
const std::string kPointsTypeStr[]
Definition: Foundations.hpp:70
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:1
bool operator()(const PointsKey &lhs, const PointsKey &rhs) const