MFEM  v3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
segment.cpp
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 
13 #include "mesh_headers.hpp"
14 
15 namespace mfem
16 {
17 
18 Segment::Segment( const int *ind, int attr ) : Element(Geometry::SEGMENT) {
19  attribute = attr;
20  for (int i=0; i<2; i++)
21  indices[i] = ind[i];
22 }
23 
24 Segment::Segment( int ind1, int ind2, int attr ) : Element(Geometry::SEGMENT) {
25  attribute = attr;
26  indices[0] = ind1;
27  indices[1] = ind2;
28 }
29 
30 void Segment::SetVertices(const int *ind){
31  indices[0] = ind[0];
32  indices[1] = ind[1];
33 }
34 
35 void Segment::GetVertices( Array<int> &v ) const {
36  v.SetSize( 2 );
37  for (int i=0; i<2; i++)
38  v[i] = indices[i];
39 }
40 
42 
43 }
int indices[2]
Definition: segment.hpp:25
Class for linear FE on interval.
Definition: fe.hpp:342
int attribute
Element&#39;s attribute (specifying material property, etc).
Definition: element.hpp:32
void SetSize(int nsize)
Change logical size of the array, keep existing entries.
Definition: array.hpp:293
virtual int * GetVertices()
Definition: segment.hpp:46
virtual void SetVertices(const int *ind)
Set the indices the element according to the input.
Definition: segment.cpp:30
Abstract data type element.
Definition: element.hpp:27
Linear1DFiniteElement SegmentFE
Definition: segment.cpp:41