MFEM  v3.0
 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.googlecode.com.
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 "element.hpp"
17 
18 namespace mfem
19 {
20 
22 class Triangle : public Element
23 {
24 protected:
25  int indices[3];
26  static const int edges[3][2];
27 
28 public:
29 
31 
33  Triangle(const int *ind, int attr = 1);
34 
36  Triangle(int ind1, int ind2, int ind3, int attr = 1);
37 
39  int NeedRefinement(DSTable &v_to_v, int *middle) const;
40 
42  virtual void SetVertices(const int *ind);
43 
47  virtual void MarkEdge(DenseMatrix & pmat);
48 
50  virtual void MarkEdge(const DSTable &v_to_v, const int *length);
51 
53  virtual int GetType() const { return Element::TRIANGLE; }
54 
56  virtual void GetVertices(Array<int> &v) const;
57 
58  virtual int *GetVertices() { return indices; }
59 
60  virtual int GetNVertices() const { return 3; }
61 
62  virtual int GetNEdges() const { return(3); }
63 
64  virtual const int *GetEdgeVertices(int ei) const { return(edges[ei]); }
65 
66  virtual int GetNFaces(int &nFaceVertices) const
67  { nFaceVertices = 0; return 0; }
68 
69  virtual const int *GetFaceVertices(int fi) const
70  { MFEM_ABORT("not implemented"); return NULL; }
71 
72  virtual Element *Duplicate(Mesh *m) const
73  { return new Triangle(indices, attribute); }
74 
75  virtual ~Triangle() { }
76 };
77 
78 extern Linear2DFiniteElement TriangleFE;
79 
80 }
81 
82 #endif
virtual int * GetVertices()
Definition: triangle.hpp:58
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:36
virtual int GetNFaces(int &nFaceVertices) const
Definition: triangle.hpp:66
virtual int GetNVertices() const
Definition: triangle.hpp:60
Data type dense matrix.
Definition: densemat.hpp:22
virtual const int * GetEdgeVertices(int ei) const
Definition: triangle.hpp:64
static const int edges[3][2]
Definition: triangle.hpp:26
virtual void MarkEdge(DenseMatrix &pmat)
Definition: triangle.cpp:52
Data type triangle element.
Definition: triangle.hpp:22
virtual void SetVertices(const int *ind)
Set the vertices according to the given input.
Definition: triangle.cpp:46
virtual const int * GetFaceVertices(int fi) const
Definition: triangle.hpp:69
virtual Element * Duplicate(Mesh *m) const
Definition: triangle.hpp:72
int attribute
Element&#39;s attribute (specifying material property, etc).
Definition: element.hpp:32
Linear2DFiniteElement TriangleFE
Definition: triangle.cpp:127
virtual int GetNEdges() const
Definition: triangle.hpp:62
virtual int GetType() const
Return element&#39;s type.
Definition: triangle.hpp:53
Abstract data type element.
Definition: element.hpp:27
virtual ~Triangle()
Definition: triangle.hpp:75
int indices[3]
Definition: triangle.hpp:25