9 #include <fei_iostream.hpp>
12 #include <fei_BlockDescriptor.hpp>
15 BlockDescriptor::BlockDescriptor()
17 numNodesPerElement_(0),
18 numFieldsPerNode_(NULL),
20 fieldIDsAllocated_(false),
21 numDistinctFields_(0),
23 interleaveStrategy_(0),
26 numElemDOFPerElement_(0),
28 numEqnsPerElement_(0),
29 numBlkEqnsPerElement_(0),
37 BlockDescriptor::~BlockDescriptor() {
41 numElemDOFPerElement_ = 0;
45 void BlockDescriptor::destroyFieldArrays() {
46 if (numNodesPerElement_ == 0)
return;
48 for(
int i=0; i<numNodesPerElement_; i++) {
49 delete [] nodalFieldIDs_[i];
52 delete [] nodalFieldIDs_;
53 nodalFieldIDs_ = NULL;
54 delete [] numFieldsPerNode_;
55 numFieldsPerNode_ = NULL;
56 numNodesPerElement_ = 0;
68 numNodesPerElement_ = numNodes;
70 numFieldsPerNode_ =
new int[numNodesPerElement_];
72 for(
int i=0; i<numNodesPerElement_; i++) {
73 numFieldsPerNode_[i] = 0;
79 int* BlockDescriptor::fieldsPerNodePtr() {
81 return(numFieldsPerNode_);
85 int BlockDescriptor::allocateFieldIDsTable()
87 nodalFieldIDs_ =
new int*[numNodesPerElement_];
88 bool rowsAllZeroLength =
true;
90 for(
int i=0; i<numNodesPerElement_; i++) {
91 if (numFieldsPerNode_[i] > 0) {
92 nodalFieldIDs_[i] =
new int[numFieldsPerNode_[i]];
93 rowsAllZeroLength =
false;
95 else nodalFieldIDs_[i] = NULL;
98 if (rowsAllZeroLength || numNodesPerElement_ == 0) {
99 fei::console_out() <<
"BlockDescriptor::allocateFieldIDsTable: ERROR, all rows of"
100 <<
" fieldIDs table have zero length. Set fieldsPerNode entries"
101 <<
" first." << FEI_ENDL;
105 fieldIDsAllocated_ =
true;
110 bool BlockDescriptor::containsField(
int fieldID) {
130 for(
int i=0; i<numNodesPerElement_; i++) {
131 for(
int j=0; j<numFieldsPerNode_[i]; j++) {
132 if (nodalFieldIDs_[i][j] == fieldID)
return(
true);
140 int BlockDescriptor::setElemDofFieldIDs(
int numFields,
const int* fieldIDs)
142 if (numFields <= 0) {
143 elemDOFEqnNumbers_.resize(0);
147 for(
int i=0; i<numFields; i++) elemDofFieldIDs_.push_back(fieldIDs[i]);
149 elemDOFEqnNumbers_.resize(numElements_);
151 for(
int j=0; j<numElements_; j++) {
152 elemDOFEqnNumbers_[j] = -1;
std::ostream & console_out()
int setNumNodesPerElement(int numNodes)