Toast++  1.0.2 (r.539)
Forward and inverse modelling in optical tomography
ellist.h
1 // -*-C++-*-
2 // ==========================================================================
3 // Module libfe
4 // File ellist.h
5 // Declaration of class ElementList
6 // ==========================================================================
7 
8 #ifndef __ELLIST_H
9 #define __ELLIST_H
10 
11 #define BW_TOTAL 0 // bandwidth type ids
12 #define BW_INTERNAL 1
13 #define BW_AUTO 2
14 
15 // ==========================================================================
16 // class ElementList
17 
18 class FELIB ElementList {
19 public:
20  ElementList () { Length=0; /*Segmented = false;*/ isKappa = false; };
21  ~ElementList ();
22  // constructor, destructor
23 
24  PElement& operator[] (int rec) const;
25  // returns reference to an element in the list
26 
27  void New (int length);
28  // create new (empty) list of with 'length' entries
29 
30  void Clear() { New(0); }
31  // empty list
32 
33  int Len (void) const { return Length; };
34  // Length of the list
35 
36  void Insert (PElement pel, int pos);
37  // inserts the element pointed to by pel into the element list at position
38  // pos (0 <= pos <= Len).
39  // typical usage: elist.Insert (new Triangle3, 5);
40 
41  void Append (PElement pel);
42  // appends the element pointer pel to the end of the current element list
43  // typical usage: elist.Append (new Triangle3);
44 
45  void AppendList (int no, PElement *ppel);
46  // Appends an array of element pointers to the end of the current element
47  // list. The pointers in the array are expected to point to initialised
48  // elements. The array itself (but not the elements) can be deleted after
49  // the call
50 
51  void SetList (int no, PElement *ppel);
52  // Replaces the current list with ppel, length no
53  // The array must not be deleted by the calling function
54 
55  void Delete (int rec);
56  // removes record 'rec' from the list. 0 <= rec < Len
57 
58  void RemoveNodeRef (int nd);
59  // Updates the node references in all elements under the assuption that
60  // node nd has been removed from the node list. If there are still
61  // references to nd when RemoveNodeRef is called, these will afterwards be
62  // references to the following node (which is then assigned the identifier
63  // nd)
64 
65  Element *SideNeighbour (int el, int side);
66  // Return neighbour element of 'el' at 'side', or NULL if side has
67  // no neighbour, i.e. if the side is part of the mesh surface
68  // Note: This function requires a preceeding call to
69  // Mesh::PopulateNeighbourLists
70  // Note: This replaces 'EdgeAdjacentElement'
71 
72  int EdgeAdjacentElement (int el, int side) const;
73  // returns the number of the element adjacent to 'el' at side 'side'
74  // returns -1 if no element is found, i.e. if 'side' is a boundary
75 
76  int VertexAdjacentElement (int el, int nd, int min_el=0);
77  // Returns the number of an element sharing the node 'nd' with 'el'.
78  // nd is the local node number: 0 <= nd < nNode
79  // Searching starts from element number 'min_el' upwards
80  // Returns -1 if no matching element >= min_el is found
81 
82  friend std::istream& operator>> (std::istream& i, ElementList& nlist);
83  friend std::ostream& operator<< (std::ostream& o, ElementList& elist);
84  // read/write element list from/to streams
85 
86  //bool Segmented;
87  // TRUE if elements contain region information
88 
89  bool isKappa;
90  // TRUE if Coeff[MUS] contains c*kappa for each element in the list
91 
92 protected:
93 
94  PElement *List;
95  // array of pointers to elements
96 
97  int Length;
98  // length of list
99 
100 };
101 
102 // ==========================================================================
103 // inline functions
104 
105 #ifndef FEM_DEBUG
106 inline PElement& ElementList::operator[] (int rec) const
107 {
108  return List[rec];
109 }
110 #endif // !FEM_DEBUG
111 
112 #endif // !__ELLIST_H
Definition: ellist.h:18
Base class for finite element types.
Definition: element.h:84