MFEM v4.7.0
Finite element discretization library
Loading...
Searching...
No Matches
segment.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_SEGMENT
13#define MFEM_SEGMENT
14
15#include "../config/config.hpp"
16#include "element.hpp"
17
18namespace mfem
19{
20
21/// Data type line segment element
22class Segment : public Element
23{
24protected:
25 int indices[2];
26
27public:
29
31
32 /// Constructs triangle by specifying the indices and the attribute.
33 Segment(const int *ind, int attr = 1);
34
35 /// Constructs triangle by specifying the indices and the attribute.
36 Segment(int ind1, int ind2, int attr = 1);
37
38 /// Return element's type.
39 Type GetType() const override { return Element::SEGMENT; }
40
41 /// Get the indices defining the vertices.
42 void GetVertices(Array<int> &v) const override;
43
44 /// Set the indices defining the vertices.
45 void SetVertices(const Array<int> &v) override;
46
47 /// @note The returned array should NOT be deleted by the caller.
48 int * GetVertices () override { return indices; }
49
50 /// Set the indices defining the vertices.
51 void SetVertices(const int *ind) override;
52
53 int GetNVertices() const override { return 2; }
54
55 int GetNEdges() const override { return 0; }
56
57 const int *GetEdgeVertices(int ei) const override { return NULL; }
58
59 /// @deprecated Use GetNFaces(void) and GetNFaceVertices(int) instead.
60 MFEM_DEPRECATED int GetNFaces(int &nFaceVertices) const override
61 { nFaceVertices = 0; return 0; }
62
63 int GetNFaces() const override { return 0; }
64
65 int GetNFaceVertices(int) const override { return 0; }
66
67 const int *GetFaceVertices(int fi) const override { return NULL; }
68
69 Element *Duplicate(Mesh *m) const override
70 { return new Segment(indices, attribute); }
71
72 virtual ~Segment() = default;
73};
74
76extern MFEM_EXPORT Linear1DFiniteElement SegmentFE;
77
78}
79
80#endif
Abstract data type element.
Definition element.hpp:29
int attribute
Element's attribute (specifying material property, etc).
Definition element.hpp:33
Type
Constants for the classes derived from Element.
Definition element.hpp:41
A 1D linear element with nodes on the endpoints.
Mesh data type.
Definition mesh.hpp:56
Data type line segment element.
Definition segment.hpp:23
virtual ~Segment()=default
int GetNVertices() const override
Definition segment.hpp:53
Geometry::Constants< Geometry::SEGMENT > geom_t
Definition segment.hpp:28
Element * Duplicate(Mesh *m) const override
Definition segment.hpp:69
MFEM_DEPRECATED int GetNFaces(int &nFaceVertices) const override
Definition segment.hpp:60
int GetNFaceVertices(int) const override
Definition segment.hpp:65
const int * GetEdgeVertices(int ei) const override
Definition segment.hpp:57
const int * GetFaceVertices(int fi) const override
Definition segment.hpp:67
void SetVertices(const Array< int > &v) override
Set the indices defining the vertices.
Definition segment.cpp:46
int * GetVertices() override
Definition segment.hpp:48
Type GetType() const override
Return element's type.
Definition segment.hpp:39
int indices[2]
Definition segment.hpp:25
int GetNEdges() const override
Definition segment.hpp:55
int GetNFaces() const override
Definition segment.hpp:63
Linear1DFiniteElement SegmentFE
Definition segment.cpp:52