MFEM  v3.1
Finite element discretization library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
triangle.hpp
Go to the documentation of this file.
1 // Copyright (c) 2010, Lawrence Livermore National Security, LLC. Produced at
2 // the Lawrence Livermore National Laboratory. LLNL-CODE-443211. All Rights
3 // reserved. See file COPYRIGHT for details.
4 //
5 // This file is part of the MFEM library. For more information and source code
6 // availability see http://mfem.org.
7 //
8 // MFEM is free software; you can redistribute it and/or modify it under the
9 // terms of the GNU Lesser General Public License (as published by the Free
10 // Software Foundation) version 2.1 dated February 1999.
11 
12 #ifndef MFEM_TRIANGLE
13 #define MFEM_TRIANGLE
14 
15 #include "../config/config.hpp"
16 #include "../fem/fe.hpp"
17 #include "element.hpp"
18 
19 namespace mfem
20 {
21 
23 class Triangle : public Element
24 {
25 protected:
26  int indices[3];
27  static const int edges[3][2];
28 
29 public:
30 
32 
34  Triangle(const int *ind, int attr = 1);
35 
37  Triangle(int ind1, int ind2, int ind3, int attr = 1);
38 
40  int NeedRefinement(DSTable &v_to_v, int *middle) const;
41 
43  virtual void SetVertices(const int *ind);
44 
48  virtual void MarkEdge(DenseMatrix & pmat);
49 
51  virtual void MarkEdge(const DSTable &v_to_v, const int *length);
52 
54  virtual int GetType() const { return Element::TRIANGLE; }
55 
57  virtual void GetVertices(Array<int> &v) const;
58 
59  virtual int *GetVertices() { return indices; }
60 
61  virtual int GetNVertices() const { return 3; }
62 
63  virtual int GetNEdges() const { return (3); }
64 
65  virtual const int *GetEdgeVertices(int ei) const { return (edges[ei]); }
66 
67  virtual int GetNFaces(int &nFaceVertices) const
68  { nFaceVertices = 0; return 0; }
69 
70  virtual const int *GetFaceVertices(int fi) const
71  { MFEM_ABORT("not implemented"); return NULL; }
72 
73  virtual Element *Duplicate(Mesh *m) const
74  { return new Triangle(indices, attribute); }
75 
76  virtual ~Triangle() { }
77 };
78 
79 extern Linear2DFiniteElement TriangleFE;
80 
81 }
82 
83 #endif
virtual int * GetVertices()
Definition: triangle.hpp:59
int NeedRefinement(DSTable &v_to_v, int *middle) const
Return 1 if the element needs refinement in order to get conforming mesh.
Definition: triangle.cpp:38
virtual int GetNFaces(int &nFaceVertices) const
Definition: triangle.hpp:67
virtual int GetNVertices() const
Definition: triangle.hpp:61
Data type dense matrix using column-major storage.
Definition: densemat.hpp:22
virtual const int * GetEdgeVertices(int ei) const
Definition: triangle.hpp:65
static const int edges[3][2]
Definition: triangle.hpp:27
virtual void MarkEdge(DenseMatrix &pmat)
Definition: triangle.cpp:56
Data type triangle element.
Definition: triangle.hpp:23
virtual void SetVertices(const int *ind)
Set the vertices according to the given input.
Definition: triangle.cpp:48
virtual const int * GetFaceVertices(int fi) const
Definition: triangle.hpp:70
virtual Element * Duplicate(Mesh *m) const
Definition: triangle.hpp:73
int attribute
Element&#39;s attribute (specifying material property, etc).
Definition: element.hpp:32
Linear2DFiniteElement TriangleFE
Definition: triangle.cpp:134
virtual int GetNEdges() const
Definition: triangle.hpp:63
virtual int GetType() const
Return element&#39;s type.
Definition: triangle.hpp:54
Abstract data type element.
Definition: element.hpp:27
virtual ~Triangle()
Definition: triangle.hpp:76
int indices[3]
Definition: triangle.hpp:26