Toast++  1.0.2 (r.539)
Forward and inverse modelling in optical tomography
ndlist.h
1 // -*-C++-*-
2 // ==========================================================================
3 // Module libfe
4 // File ndlist.h
5 // Declaration of class NodeList
6 // ==========================================================================
7 
8 #ifndef __NDLIST_H
9 #define __NDLIST_H
10 
11 // ==========================================================================
12 // class NodeList
13 
14 class FELIB NodeList {
15 public:
16  // constructors, destructor
17  NodeList ();
18  NodeList (int length);
19  NodeList (const NodeList &nl);
20  ~NodeList ();
21 
22  void New (int length);
23  // create new (empty) list of with 'length' entries
24 
25  void Append (int number);
26  // append 'number' empty entries to the list
27 
28  void Clear ();
29  // clear node list
30 
31  void SetList (int no, Node *nds);
32  // replaces the node list with array nds of size no, discarding prev list
33  // nds should not be deallocated by the caller
34 
35  void Remove (int nd);
36  // removes node 'nd' from the list. All node numbers higher than 'nd' will
37  // be decremented by 1.
38  // WARNING: the element list will be invalid after the node is removed!
39  // remove all references to the deleted node from the element list and run
40  // ElementList::RemoveNode (nd) to update the element list.
41 
42  int Len (void) const { return size; };
43  // returns number of nodes in the list
44 
45  int Exists (const Node &node, double rad = 1e-8) const;
46  // returns the number of the node in the list that coincides with 'node'
47  // within radius 'rad', or -1 if no node is found
48  // If more than one node lies within 'rad' of 'node' then the first in
49  // the list is returned
50 
51  int TotBnd (void) const;
52  // returns the number of boundary nodes in the list OLD!
53 
54  int NumberOf (BYTE bndtype) const;
55  // returns the number of nodes of type bndtype in the list, where bndtype is
56  // any of the following: BND_NONE, BND_DIRICHLET, BND_NEUMANN, BND_CAUCHY,
57  // BND_ANY
58 
59 #ifdef FEM_DEBUG
60  Node& operator[] (int rec) const;
61 #else
62  Node& operator[] (int rec) const { return list[rec]; }
63 #endif
64  // returns reference to a node in the list
65 
66  void Swap (int nd1, int nd2);
67  // exchange elements el1 and el2 in the list
68 
69  // friends
70  friend std::istream& operator>> (std::istream& is, NodeList& nlist);
71  friend std::ostream& operator<< (std::ostream& os, NodeList& nlist);
72 
73 private:
74  int size; // list length
75  Node *list; // array of nodes
76  int dofnod; // degrees of freedom per node; always 1 so far
77 
78 };
79 
80 // ==========================================================================
81 // friend prototypes
82 
83 std::istream& operator>> (std::istream& is, NodeList& nlist);
84 std::ostream& operator<< (std::ostream& os, NodeList& nlist);
85 
86 #endif // !__NDLIST_H
Definition: ndlist.h:14
Definition: node.h:39