libMesh
Loading...
Searching...
No Matches
point.h
Go to the documentation of this file.
1// The libMesh Finite Element Library.
2// Copyright (C) 2002-2026 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3
4// This library is free software; you can redistribute it and/or
5// modify it under the terms of the GNU Lesser General Public
6// License as published by the Free Software Foundation; either
7// version 2.1 of the License, or (at your option) any later version.
8
9// This library is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12// Lesser General Public License for more details.
13
14// You should have received a copy of the GNU Lesser General Public
15// License along with this library; if not, write to the Free Software
16// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
18
19
20#ifndef LIBMESH_POINT_H
21#define LIBMESH_POINT_H
22
23// Local includes
24#include "libmesh/hashing.h"
25#include "libmesh/type_vector.h"
26
27namespace libMesh
28{
29
39class Point : public TypeVector<Real>
40{
41public:
42
47 Point (const Real x=0.,
48 const Real y=0.,
49 const Real z=0.) :
50 TypeVector<Real> (x,y,z)
51 {}
52
56 Point (const Point & p) = default;
57
61 Point (const TypeVector<Real> & p) :
62 TypeVector<Real> (p)
63 {}
64
68 Point& operator=(const Point & p) = default;
69
73 template <typename T,
74 typename = typename
75 std::enable_if<ScalarTraits<T>::value,void>::type>
76 Point (const T x) :
77 TypeVector<Real> (x,0,0)
78 {}
79
83 ~Point() = default;
84
85protected:
86
90 friend class Node;
91};
92
93} // namespace libMesh
94
95namespace std
96{
97template <>
98struct hash<libMesh::Point>
99{
100 std::size_t operator()(const libMesh::Point & p) const
101 {
102 std::size_t seed = 0;
103 for (int d=0; d != LIBMESH_DIM; ++d)
104 libMesh::boostcopy::hash_combine(seed, std::hash<libMesh::Real>()(p(d)));
105 return seed;
106 }
107};
108
109}
110
111#endif // LIBMESH_POINT_H
A Node is like a Point, but with more information.
Definition node.h:55
A Point defines a location in LIBMESH_DIM dimensional Real space.
Definition point.h:40
Point(const Real x=0., const Real y=0., const Real z=0.)
Constructor.
Definition point.h:47
Point & operator=(const Point &p)=default
Copy-assignment operator.
Point(const T x)
Disambiguate constructing from non-Real scalars.
Definition point.h:76
Point(const TypeVector< Real > &p)
Copy-constructor from non-point Typevector.
Definition point.h:61
Point(const Point &p)=default
Trivial copy-constructor.
~Point()=default
Destructor.
This class defines a vector in LIBMESH_DIM dimensional space of type T.
Definition type_vector.h:63
void hash_combine(std::size_t &seed, const T &value)
Definition hashing.h:34
The libMesh namespace provides an interface to certain functionality in the library.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
std::size_t operator()(const libMesh::Point &p) const
Definition point.h:100