FEI  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
fei_NodeDescriptor.hpp
1 #ifndef _NodeDescriptor_hpp_
2 #define _NodeDescriptor_hpp_
3 
4 /*--------------------------------------------------------------------*/
5 /* Copyright 2005 Sandia Corporation. */
6 /* Under the terms of Contract DE-AC04-94AL85000, there is a */
7 /* non-exclusive license for use of this work by or on behalf */
8 /* of the U.S. Government. Export of this program may require */
9 /* a license from the United States Government. */
10 /*--------------------------------------------------------------------*/
11 
12 #include <fei_macros.hpp>
13 
14 #include <fei_ArrayUtils.hpp>
15 #include <iostream>
36 class NodeDescriptor {
37  public:
39 
40  NodeDescriptor(const NodeDescriptor& src)
41  : nodeID_(src.nodeID_), nodeNumber_(src.nodeNumber_),
42  numNodalDOF_(0), fieldIDList_(NULL),
43  fieldEqnNumbers_(NULL), numFields_(0), blkEqnNumber_(0),
44  ownerProc_(src.ownerProc_), blockList_()
45  {}
46 
47  virtual ~NodeDescriptor();
48 
49  GlobalID getGlobalNodeID() const {return(nodeID_);}
50  void setGlobalNodeID(GlobalID node) {nodeID_ = node;}
51 
52  int getNodeNumber() const {return(nodeNumber_);}
53  void setNodeNumber(int nn) {nodeNumber_ = nn;};
54 
55  int getBlkEqnNumber() const {return(blkEqnNumber_);}
56  void setBlkEqnNumber(int blkEqn) {blkEqnNumber_ = blkEqn;}
57 
58  int getNumNodalDOF() const {return(numNodalDOF_);}
59  void setNumNodalDOF(int dof) {numNodalDOF_ = dof;}
60 
61  void addField(int fieldID);
62  void setFieldEqnNumber(int fieldID, int eqn);
63 
64  int getNumFields() const {return(numFields_);}
65  const int* getFieldIDList() const {return(fieldIDList_);}
66  const int* getFieldEqnNumbers() const {return(fieldEqnNumbers_);}
67 
74  bool getFieldEqnNumber(int fieldID, int& eqnNumber) const;
75 
79  void getFieldID(int eqnNumber, int& fieldID, int& offset_into_field) const;
80 
81  bool operator==(const NodeDescriptor& nd) const
82  { return( nodeID_ == nd.nodeID_ ); }
83 
84  bool operator!=(const NodeDescriptor& nd) const
85  { return( nodeID_ != nd.nodeID_ ); }
86 
87  bool operator<(const NodeDescriptor& nd) const
88  { return( nodeID_ < nd.nodeID_ ); }
89 
90  bool operator>(const NodeDescriptor& nd) const
91  { return( nodeID_ > nd.nodeID_ ); }
92 
93  int getOwnerProc() const {return(ownerProc_);}
94  void setOwnerProc(int proc) {ownerProc_ = proc;}
95 
96  void addBlockIndex(unsigned blk_idx)
97  { fei::sortedListInsert(blk_idx, blockList_); }
98 
99  size_t getNumBlocks() const {return blockList_.size();}
100  const std::vector<unsigned>& getBlockIndexList() const {return(blockList_);}
101  bool hasBlockIndex(unsigned blk_idx) const;
102 
103  private:
104  NodeDescriptor& operator=(const NodeDescriptor& src);
105 
106  void allocFieldLists();
107  void allocBlockList();
108 
109  GlobalID nodeID_;
110 
111  int nodeNumber_;
112 
113  int numNodalDOF_; //total number of nodal degrees-of-freedom
114 
115  int* fieldIDList_; //list of field identifiers
116  int* fieldEqnNumbers_; //list of starting (global) equation numbers.
117  //fields can consist of more than one scalar (and
118  //have more than one associated equation), this
119  //is the first equation number
120  int numFields_;
121 
122  int blkEqnNumber_;
123 
124  int ownerProc_; //processor that owns the equations for this node
125 
126  std::vector<unsigned> blockList_; //indexes of blocks that contain this node
127 };
128 
129 #endif
130 
int sortedListInsert(const T &item, std::vector< T > &list)
bool getFieldEqnNumber(int fieldID, int &eqnNumber) const
void getFieldID(int eqnNumber, int &fieldID, int &offset_into_field) const