MFEM  v4.4.0
Finite element discretization library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
segment.hpp
Go to the documentation of this file.
1 // Copyright (c) 2010-2022, 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 
18 namespace mfem
19 {
20 
21 /// Data type line segment element
22 class Segment : public Element
23 {
24 protected:
25  int indices[2];
26 
27 public:
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  /// Set the indices the element according to the input.
39  virtual void SetVertices(const int *ind);
40 
41  /// Return element's type.
42  virtual Type GetType() const { return Element::SEGMENT; }
43 
44  /// Returns the indices of the element's vertices.
45  virtual void GetVertices(Array<int> &v) const;
46 
47  virtual int *GetVertices() { return indices; }
48 
49  virtual int GetNVertices() const { return 2; }
50 
51  virtual int GetNEdges() const { return (0); }
52 
53  virtual const int *GetEdgeVertices(int ei) const { return NULL; }
54 
55  /// @deprecated Use GetNFaces(void) and GetNFaceVertices(int) instead.
56  MFEM_DEPRECATED virtual int GetNFaces(int &nFaceVertices) const
57  { nFaceVertices = 0; return 0; }
58 
59  virtual int GetNFaces() const { return 0; }
60 
61  virtual int GetNFaceVertices(int) const { return 0; }
62 
63  virtual const int *GetFaceVertices(int fi) const { return NULL; }
64 
65  virtual Element *Duplicate(Mesh *m) const
66  { return new Segment(indices, attribute); }
67 
68  virtual ~Segment() { }
69 };
70 
71 class Linear1DFiniteElement;
72 extern Linear1DFiniteElement SegmentFE;
73 
74 }
75 
76 #endif
virtual int GetNEdges() const
Definition: segment.hpp:51
int indices[2]
Definition: segment.hpp:25
virtual int GetNFaceVertices(int) const
Definition: segment.hpp:61
virtual ~Segment()
Definition: segment.hpp:68
Type
Constants for the classes derived from Element.
Definition: element.hpp:41
virtual MFEM_DEPRECATED int GetNFaces(int &nFaceVertices) const
Definition: segment.hpp:56
virtual Type GetType() const
Return element&#39;s type.
Definition: segment.hpp:42
int attribute
Element&#39;s attribute (specifying material property, etc).
Definition: element.hpp:33
Geometry::Constants< Geometry::SEGMENT > geom_t
Definition: segment.hpp:28
virtual int GetNVertices() const
Definition: segment.hpp:49
virtual int GetNFaces() const
Definition: segment.hpp:59
virtual const int * GetFaceVertices(int fi) const
Definition: segment.hpp:63
virtual int * GetVertices()
Definition: segment.hpp:47
virtual Element * Duplicate(Mesh *m) const
Definition: segment.hpp:65
virtual void SetVertices(const int *ind)
Set the indices the element according to the input.
Definition: segment.cpp:34
Abstract data type element.
Definition: element.hpp:28
Data type line segment element.
Definition: segment.hpp:22
Linear1DFiniteElement SegmentFE
Definition: segment.cpp:49
virtual const int * GetEdgeVertices(int ei) const
Definition: segment.hpp:53