MFEM v4.7.0
Finite element discretization library
Loading...
Searching...
No Matches
vertex.hpp
Go to the documentation of this file.
1// Copyright (c) 2010-2024, Lawrence Livermore National Security, LLC. Produced
2// at the Lawrence Livermore National Laboratory. All Rights reserved. See files
3// LICENSE and NOTICE for details. LLNL-CODE-806117.
4//
5// This file is part of the MFEM library. For more information and source code
6// availability visit https://mfem.org.
7//
8// MFEM is free software; you can redistribute it and/or modify it under the
9// terms of the BSD-3 license. We welcome feedback and contributions, see file
10// CONTRIBUTING.md for details.
11
12#ifndef MFEM_VERTEX
13#define MFEM_VERTEX
14
15#include "../config/config.hpp"
17
18namespace mfem
19{
20
21/// Data type for vertex
22class Vertex
23{
24protected:
26
27public:
28 Vertex() = default;
29
30 // Trivial copy constructor and trivial copy assignment operator
31
32 Vertex(real_t *xx, int dim);
33 Vertex(real_t x, real_t y) { coord[0] = x; coord[1] = y; coord[2] = 0.; }
35 { coord[0] = x; coord[1] = y; coord[2] = z; }
36
37 /// Returns pointer to the coordinates of the vertex.
38 inline real_t * operator() () const { return (real_t*)coord; }
39
40 /// Returns the i'th coordinate of the vertex.
41 inline real_t & operator() (int i) { return coord[i]; }
42
43 /// Returns the i'th coordinate of the vertex.
44 inline const real_t & operator() (int i) const { return coord[i]; }
45
46 /// (DEPRECATED) Set the coordinates of the Vertex.
47 /** @deprecated This old version of SetCoords is not always memory safe. */
48 MFEM_DEPRECATED void SetCoords(const real_t *p)
49 { coord[0] = p[0]; coord[1] = p[1]; coord[2] = p[2]; }
50
51 /// Sets vertex location based on given point p
52 void SetCoords(int dim, const real_t *p)
53 { for (int i = 0; i < dim; i++) { coord[i] = p[i]; } }
54
55 // Trivial destructor
56};
57
58}
59
60#endif
Data type for vertex.
Definition vertex.hpp:23
MFEM_DEPRECATED void SetCoords(const real_t *p)
(DEPRECATED) Set the coordinates of the Vertex.
Definition vertex.hpp:48
Vertex(real_t x, real_t y, real_t z)
Definition vertex.hpp:34
real_t coord[3]
Definition vertex.hpp:25
real_t * operator()() const
Returns pointer to the coordinates of the vertex.
Definition vertex.hpp:38
void SetCoords(int dim, const real_t *p)
Sets vertex location based on given point p.
Definition vertex.hpp:52
Vertex(real_t x, real_t y)
Definition vertex.hpp:33
Vertex()=default
int dim
Definition ex24.cpp:53
float real_t
Definition config.hpp:43
real_t p(const Vector &x, real_t t)