10 #include <fei_macros.hpp>
13 #include <fei_NodeDescriptor.hpp>
16 NodeDescriptor::NodeDescriptor()
17 : nodeID_((GlobalID)-1),
21 fieldEqnNumbers_(NULL),
32 NodeDescriptor::~NodeDescriptor() {
33 delete [] fieldIDList_;
34 delete [] fieldEqnNumbers_;
39 void NodeDescriptor::addField(
int fieldID) {
48 int allocLen = numFields_;
55 if (tmp < numFields_) {
64 allocLen = numFields_ - 1;
70 void NodeDescriptor::setFieldEqnNumber(
int fieldID,
int eqn) {
85 fieldEqnNumbers_[index] = eqn;
99 eqnNumber = fieldEqnNumbers_[index];
106 if (numFields_ < 1) {
107 throw std::runtime_error(
"fei::NodeDescriptor::getFieldID ERROR, no nodal dofs on this node.");
110 int firstNodalEqn = fieldEqnNumbers_[0];
111 if (eqnNumber - firstNodalEqn > numNodalDOF_) {
112 throw std::runtime_error(
"fei::NodeDescriptor::getFieldID ERROR, eqnNumber out of range.");
115 bool found_field =
false;
116 for(
int i=numFields_-1; i>=0; --i) {
117 if (fieldEqnNumbers_[i] <= eqnNumber) {
118 fieldID = fieldIDList_[i];
119 offset_into_field = eqnNumber - fieldEqnNumbers_[i];
126 throw std::runtime_error(
"fei::NodeDescriptor::getFieldID ERROR, fieldID not found for eqnNumber.");
131 bool NodeDescriptor::hasBlockIndex(
unsigned blk_idx)
const
136 if (index >= 0)
return(
true);
int sortedListInsert(const T &item, std::vector< T > &list)
bool getFieldEqnNumber(int fieldID, int &eqnNumber) const
int binarySearch(const T &item, const T *list, int len)
void getFieldID(int eqnNumber, int &fieldID, int &offset_into_field) const
int listInsert(const T &item, int offset, T *&list, int &usedLength, int &allocatedLength, int allocChunkSize=200)