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/libmesh_device.h"
26#include "libmesh/type_vector.h"
27
28namespace libMesh
29{
30
40class Point : public TypeVector<Real>
41{
42public:
43
48 LIBMESH_DEVICE_INLINE
49 Point (const Real x=0.,
50 const Real y=0.,
51 const Real z=0.) :
52 TypeVector<Real> (x,y,z)
53 {}
54
58 LIBMESH_DEVICE_INLINE
59 Point (const Point & p) = default;
60
64 LIBMESH_DEVICE_INLINE
65 Point (const TypeVector<Real> & p) :
66 TypeVector<Real> (p)
67 {}
68
72 LIBMESH_DEVICE_INLINE
73 Point& operator=(const Point & p) = default;
74
78 template <typename T,
79 typename = typename
80 std::enable_if<ScalarTraits<T>::value,void>::type>
81 LIBMESH_DEVICE_INLINE
82 Point (const T x) :
83 TypeVector<Real> (x,0,0)
84 {}
85
89 ~Point() = default;
90
91protected:
92
96 friend class Node;
97};
98
99} // namespace libMesh
100
101namespace std
102{
103template <>
104struct hash<libMesh::Point>
105{
106 std::size_t operator()(const libMesh::Point & p) const
107 {
108 std::size_t seed = 0;
109 for (int d=0; d != LIBMESH_DIM; ++d)
110 libMesh::boostcopy::hash_combine(seed, std::hash<libMesh::Real>()(p(d)));
111 return seed;
112 }
113};
114
115}
116
117#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:41
LIBMESH_DEVICE_INLINE Point(const Point &p)=default
Trivial copy-constructor.
LIBMESH_DEVICE_INLINE Point(const TypeVector< Real > &p)
Copy-constructor from non-point Typevector.
Definition point.h:65
LIBMESH_DEVICE_INLINE Point(const T x)
Disambiguate constructing from non-Real scalars.
Definition point.h:82
~Point()=default
Destructor.
LIBMESH_DEVICE_INLINE Point(const Real x=0., const Real y=0., const Real z=0.)
Constructor.
Definition point.h:49
LIBMESH_DEVICE_INLINE Point & operator=(const Point &p)=default
Copy-assignment operator.
This class defines a vector in LIBMESH_DIM dimensional space of type T.
Definition type_vector.h:64
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:106