FEI  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ElemBlock.cpp
1 /*--------------------------------------------------------------------*/
2 /* Copyright 2005 Sandia Corporation. */
3 /* Under the terms of Contract DE-AC04-94AL85000, there is a */
4 /* non-exclusive license for use of this work by or on behalf */
5 /* of the U.S. Government. Export of this program may require */
6 /* a license from the United States Government. */
7 /*--------------------------------------------------------------------*/
8 
9 #include <fei_macros.hpp>
10 #include <fei_defs.h>
11 #include <test_utils/ElemBlock.hpp>
12 #include <cstdlib>
13 
14 //==============================================================================
15 ElemBlock::ElemBlock()
16  : blockID_(0),
17  numElements_(0),
18  numNodesPerElement_(0),
19  numFieldsPerNode_(NULL),
20  nodalFieldIDs_(NULL),
21  elemIDs_(NULL),
22  elemConn_(NULL),
23  numStiffRows_(0),
24  elemFormat_(0),
25  elemStiff_(NULL),
26  elemLoad_(NULL),
27  numElemDOF_(0),
28  elemDOFFieldIDs_(NULL),
29  interleaveStrategy_(0),
30  lumpingStrategy_(0)
31 {
32 }
33 
34 //==============================================================================
35 ElemBlock::~ElemBlock() {
36  deleteMemory();
37 }
38 
39 //==============================================================================
40 void ElemBlock::deleteMemory() {
41  for(int i=0; i<numElements_; i++) {
42  for(int j=0; j<numStiffRows_; j++) {
43  delete [] elemStiff_[i][j];
44  }
45  delete [] elemStiff_[i];
46  delete [] elemLoad_[i];
47  delete [] elemConn_[i];
48  }
49 
50  for(int j=0; j<numNodesPerElement_; j++) {
51  delete [] nodalFieldIDs_[j];
52  }
53  delete [] nodalFieldIDs_;
54  delete [] numFieldsPerNode_;
55 
56  delete [] elemStiff_;
57  delete [] elemLoad_;
58  delete [] elemConn_;
59  delete [] elemIDs_;
60 
61  if (numElemDOF_ > 0) {
62  delete [] elemDOFFieldIDs_;
63  numElemDOF_ = 0;
64  }
65 
66  numElements_ = 0;
67  numNodesPerElement_ = 0;
68 }
69