FEI  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
driverData.hpp
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 #ifndef _driverData_h_
10 #define _driverData_h_
11 
12 #include <fei_macros.hpp>
13 #include <fei_defs.h>
14 
15 class initElem {
16  public:
17  initElem(){}
18  ~initElem()
19  {
20  delete [] nodeIDs;
21  }
22  GlobalID elemBlockID;
23  GlobalID elemID;
24  int numNodes;
25  GlobalID* nodeIDs;
26 };
27 
28 class sumInElem {
29  public:
30  sumInElem() : stiff1D(NULL), stiffness(NULL), load(NULL) {}
31  ~sumInElem()
32  {
33  delete [] nodeIDs;
34  delete [] stiff1D;
35  delete [] stiffness;
36  delete [] load;
37  }
38  GlobalID elemBlockID;
39  GlobalID elemID;
40  int numNodes;
41  GlobalID* nodeIDs;
42  int numRows;
43  double* stiff1D;
44  double** stiffness;
45  double* load;
46  int elemFormat;
47 };
48 
49 class nodeBC {
50  public:
51  nodeBC():nodeIDs(NULL), alpha(NULL), beta(NULL), gamma(NULL) {}
52  ~nodeBC()
53  {
54  for(int i=0; i<numNodes; ++i) {
55  delete [] alpha[i];
56  delete [] beta[i];
57  delete [] gamma[i];
58  }
59  delete [] alpha;
60  delete [] beta;
61  delete [] gamma;
62  delete [] nodeIDs;
63  }
64  int numNodes;
65  GlobalID* nodeIDs;
66  int fieldID;
67  int fieldSize;
68  double** alpha;
69  double** beta;
70  double** gamma;
71 };
72 
73 class initCR {
74  public:
75  initCR(){}
76  ~initCR()
77  {
78  delete [] nodeIDs;
79  delete [] fieldIDs;
80  }
81 
82  int numNodes;
83  GlobalID* nodeIDs;
84  int* fieldIDs;
85  int CRID;
86 };
87 
88 class loadCR {
89  public:
90  loadCR() {}
91  ~loadCR()
92  {
93  delete [] fieldIDs;
94  delete [] fieldSizes;
95  delete [] weights;
96  delete [] nodeIDs;
97  }
98 
99  int numNodes;
100  GlobalID* nodeIDs;
101  int* fieldIDs;
102  int* fieldSizes;
103  double* weights;
104  double CRValue;
105  double penValue;
106  int CRID;
107 };
108 
109 class sharedNodes {
110  public:
111  sharedNodes() : nodeIDs(NULL), numProcsPerNode(NULL), sharedProcIDs(NULL){}
112  ~sharedNodes()
113  {
114  for(int i=0; i<numNodes; ++i) delete [] sharedProcIDs[i];
115  delete [] sharedProcIDs;
116  delete [] numProcsPerNode;
117  delete [] nodeIDs;
118  }
119 
120  int numNodes;
121  GlobalID* nodeIDs;
122  int* numProcsPerNode;
123  int** sharedProcIDs;
124 };
125 
126 class parameters {
127  public:
128  parameters() : paramList() {}
129  ~parameters()
130  {
131  for(size_t i=0; i<paramList.size(); ++i) delete [] paramList[i];
132  }
133 
134  std::vector<char*> paramList;
135 };
136 
137 class setIDLists {
138  public:
139  setIDLists() : matrixIDs(NULL), rhsIDs(NULL) {}
140  ~setIDLists(){delete [] matrixIDs; delete [] rhsIDs;}
141 
142  int* matrixIDs;
143  int numMatrices;
144  int* rhsIDs;
145  int numRHSs;
146 };
147 
148 class putBlockFieldNodeSolution {
149  public:
150  putBlockFieldNodeSolution() : nodeIDs(NULL), estimates(NULL) {}
151  ~putBlockFieldNodeSolution(){delete [] nodeIDs; delete [] estimates;}
152 
153  int elemBlockID;
154  int fieldID;
155  int fieldSize;
156  int numNodes;
157  GlobalID* nodeIDs;
158  double* estimates;
159 };
160 
161 class driverData {
162  public:
163  driverData();
164  ~driverData();
165 
166  int readData(const char* fileName);
167 
172  int call_fei_method(const char* method, FEI* fei);
173 
174  std::vector<const char*>& get_methodNames() { return( methodNames ); }
175 
176  private:
177  int readData(FEI_ISTREAM* instr, char* keyword);
178  int getKeyword(FEI_ISTREAM* instr, char*& keyword);
179 
180  int is_reg_char(char c);
181  int skipWhite(FEI_ISTREAM* instr);
182  int readData(FEI_ISTREAM* instr, int& n);
183  int readData(FEI_ISTREAM* instr, double& val);
184  int appendName(const char* name);
185 
186  std::vector<const char*> methodNames;
187  char* temp_;
188  int tempLen_;
189 
190  int solveType_;
191 
192  int initFields_numFields_;
193  int* initFields_fieldSizes_;
194  int* initFields_fieldIDs_;
195 
196  int initElemBlock_numInts_;
197  int* initElemBlock_ints_;
198  int* initElemBlock_fieldsPerNode_;
199  int** initElemBlock_fieldIDs_;
200  int* initElemBlock_elemDofFieldIDs_;
201 
202  std::vector<initElem*> initElems_;
203  int initElemCounter_;
204 
205  std::vector<sumInElem*> sumInElems_;
206  int sumInElemCounter_;
207 
208  std::vector<sumInElem*> sumInElemMatrix_;
209  int sumInElemMatrixCounter_;
210 
211  std::vector<sumInElem*> sumInElemRHS_;
212  int sumInElemRHSCounter_;
213 
214  double resetSystem_;
215  double resetMatrix_;
216  double resetRHSVector_;
217  double resetInitialGuess_;
218 
219  std::vector<nodeBC*> loadNodeBCs_;
220  int loadNodeBCsCounter_;
221 
222  std::vector<initCR*> initCRMult_;
223  int initCRMultCounter_;
224 
225  std::vector<loadCR*> loadCRMult_;
226  int loadCRMultCounter_;
227 
228  std::vector<sharedNodes*> initSharedNodes_;
229  int initSharedNodesCounter_;
230 
231  std::vector<parameters*> parameters_;
232  int parametersCounter_;
233 
234  std::vector<setIDLists*> setIDLists_;
235  int setIDListsCounter_;
236 
237  std::vector<int> setCurrentMatrix_;
238  int setCurrentMatrixCounter_;
239 
240  std::vector<int> setCurrentRHS_;
241  int setCurrentRHSCounter_;
242 
243  std::vector<putBlockFieldNodeSolution*> putBlockFieldNodeSolution_;
244  int putBlockFieldNodeSolutionCounter_;
245 };
246 
247 #endif // _driverData_h_
Definition: FEI.hpp:144