FEI Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DataReader.cpp
Go to the documentation of this file.
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 <cstring>
10 
11 #include <fei_fstream.hpp>
12 #include <fei_iostream.hpp>
13 #include <fei_defs.h>
14 #include <test_utils/BCNodeSet.hpp>
15 #include <test_utils/CRSet.hpp>
17 #include <test_utils/ElemBlock.hpp>
20 
21 //==============================================================================
23  :
24  solveType_(0),
25  solverLibraryName_(),
26  numFields_(0),
27  fieldIDs_(NULL),
28  fieldSizes_(NULL),
29  numParams_(0),
30  paramStrings_(NULL),
31  numElemBlocks_(0),
32  elemBlocks_(NULL),
33  numCoefAccessPatterns_(0),
34  accessPatterns_(NULL),
35  numCoefAccesses_(0),
36  coefAccesses_(NULL),
37  numCRMultSets_(0),
38  crMultSets_(NULL),
39  numSlaveVars_(0),
40  slaveVars_(NULL),
41  numCRPenSets_(0),
42  crPenSets_(NULL),
43  numBCNodeSets_(0),
44  bcNodeSets_(NULL),
45  numSharedNodeSets_(0),
46  sharedNodeSets_(NULL),
47  numFieldsRead_(false),
48  numElemBlocksRead_(false),
49  currentElemBlockIndex_(0),
50  currentElemIndex_(0),
51  currentShIndex_(0),
52  currentExtIndex_(0),
53  currentBCIndex_(0)
54 {
55 }
56 
57 //==============================================================================
59  deleteMemory();
60 
61  numElemBlocksRead_ = false;
62  numFieldsRead_ = false;
63 }
64 
65 //==============================================================================
67  for(int i=0; i<numParams_; i++) {
68  delete [] paramStrings_[i];
69  }
70  delete [] paramStrings_;
71  numParams_ = 0;
72 
73  delete [] accessPatterns_;
75 
76  delete [] coefAccesses_;
77  numCoefAccesses_ = 0;
78 
79  delete [] elemBlocks_;
80  numElemBlocks_ = 0;
81 
82  delete [] fieldIDs_;
83  delete [] fieldSizes_;
84  numFields_ = 0;
85 
86  delete [] sharedNodeSets_;
88 
89  delete [] crMultSets_;
90  numCRMultSets_ = 0;
91 
92  delete [] slaveVars_;
93  numSlaveVars_ = 0;
94 
95  delete [] crPenSets_;
96  numCRPenSets_ = 0;
97 
98  delete [] bcNodeSets_;
99  numBCNodeSets_ = 0;
100 }
101 
102 //==============================================================================
103 int DataReader::readData(const char* fileName) {
104 
105  FEI_IFSTREAM* instr = new FEI_IFSTREAM(fileName);
106 
107  if (instr->bad()) {
108  fei::console_out() << "DataReader::readData: ERROR opening " << fileName << FEI_ENDL;
109  return(1);
110  }
111 // FEI_COUT << "DataReader reading from " << fileName << FEI_ENDL;
112  char* keyword = NULL;
113 
114  int err = getKeyword(instr, keyword);
115 
116  while (!instr->eof() && !err) {
117  readData(instr, keyword);
118  delete [] keyword;
119  keyword = NULL;
120 
121  err = getKeyword(instr, keyword);
122  }
123 
124  delete instr;
125  delete [] keyword;
126 
127  return(0);
128 }
129 
130 //==============================================================================
131 int DataReader::getKeyword(FEI_ISTREAM* instr, char*& keyword) {
132  int err = skipWhite(instr);
133  if (err) return(err);
134 
135  char *temp = new char[256];
136  for(int i=0; i<256; i++) temp[i] = '\0';
137 
138  do {
139  (*instr) >> temp;
140  } while ((std::strlen(temp) == 0) && (!instr->eof()));
141 
142  keyword = new char[std::strlen(temp)+1];
143  std::strcpy(keyword, temp);
144 
145  delete [] temp;
146 
147  return(0);
148 }
149 
150 //==============================================================================
152  int i = (int)c;
153  if (i<1 || i>126) return(0);
154 
155  return(1);
156 }
157 
158 //==============================================================================
160  char c = '\0';
161  instr->get(c);
162 
163  if (!is_reg_char(c)) {
164  return(1);
165  }
166 
167  while(c == '#' || c == '\n' || c == ' ') {
168  if (c=='#') {
169  char* buf = new char[128];
170  for(int i=0; i<128; i++) buf[i] = '\0';
171  instr->getline(buf, 128);
172  delete [] buf;
173  }
174 
175  instr->get(c);
176 
177  if (instr->eof()) return(1);
178  if ((int)c == EOF) return(1);
179 
180  if (!is_reg_char(c)) {
181  return(1);
182  }
183  }
184 
185  instr->putback(c);
186  return(0);
187 }
188 
189 //==============================================================================
190 void DataReader::readData(FEI_ISTREAM* instr, char* keyword) {
191 
192  if (!std::strcmp("solveType", keyword)) {
193  readData(instr, solveType_);
194  return;
195  }
196 
197  if (!std::strcmp("parameters", keyword)) {
198  int tmp = 0;
199  readData(instr, tmp);
200 
201  char** newParams = new char*[numParams_ + tmp];
202  for(int pp=0; pp<numParams_; pp++) newParams[pp] = paramStrings_[pp];
203 
204  for(int i=numParams_; i<numParams_+tmp; i++) {
205  char* buf = new char[256];
206  for(int j=0; j<256; j++) buf[j] = '\0';
207 
208  skipWhite(instr);
209  instr->getline(buf, 128);
210 
211  newParams[i] = new char[std::strlen(buf)+2];
212  std::strcpy(newParams[i], buf);
213 
214  delete [] buf;
215  }
216 
217  delete [] paramStrings_;
218  paramStrings_ = newParams;
219  numParams_ += tmp;
220 
221  return;
222  }
223 
224  if (!std::strcmp("numFields", keyword)) {
225  readData(instr, numFields_);
226 
227  fieldSizes_ = new int[numFields_];
228  fieldIDs_ = new int[numFields_];
229 
230  numFieldsRead_ = true;
231  return;
232  }
233 
234  if (!std::strcmp("fieldIDs", keyword)) {
235  for(int i=0; i<numFields_; i++) readData(instr, fieldIDs_[i]);
236  return;
237  }
238 
239  if (!std::strcmp("fieldSizes", keyword)) {
240  for(int i=0; i<numFields_; i++) readData(instr, fieldSizes_[i]);
241  return;
242  }
243 
244  if (!std::strcmp("numElemBlocks", keyword)) {
245  if (numElemBlocks_ > 0) {
246  FEI_COUT << "DataReader: Caution, re-setting numElemBlocks." << FEI_ENDL;
247  delete [] elemBlocks_;
248  }
249 
250  readData(instr, numElemBlocks_);
251 
253 
254  numElemBlocksRead_ = true;
256 
257  return;
258  }
259 
260  if (!std::strcmp("blockID", keyword)) {
262  currentElemIndex_ = 0;
263 
264  if (!numElemBlocksRead_) {
265  FEI_COUT << "DataReader: ERROR, numElemBlocks not read before blockID."
266  << FEI_ENDL;
267  return;
268  }
269 
271 
272  int tmp;
273  readData(instr, tmp);
274  eb1.blockID_ = (GlobalID)tmp;
275 
276  return;
277  }
278 
279  if (!std::strcmp("interleaveStrategy", keyword)) {
281  int interleave;
282 
283  readData(instr, interleave);
284 
285  eb2.interleaveStrategy_ = interleave;
286 
287  return;
288  }
289 
290  if (!std::strcmp("numElements", keyword)) {
292  int numElems;
293 
294  readData(instr, numElems);
295 
296  eb3.numElements_ = numElems;
297  eb3.elemIDs_ = new GlobalID[numElems];
298  eb3.elemConn_ = new GlobalID*[numElems];
299  eb3.elemStiff_ = new double**[numElems];
300  eb3.elemLoad_ = new double*[numElems];
301 
302  return;
303  }
304 
305  if (!std::strcmp("numNodesPerElement", keyword)) {
307  int numNodes;
308 
309  readData(instr, numNodes);
310 
311  eb4.numNodesPerElement_ = numNodes;
312  eb4.numFieldsPerNode_ = new int[numNodes];
313  eb4.nodalFieldIDs_ = new int*[numNodes];
314 
315  for(int i=0; i<eb4.numElements_; i++) {
316  eb4.elemConn_[i] = new GlobalID[numNodes];
317  }
318 
319  return;
320  }
321 
322  if (!std::strcmp("numElemDOF", keyword)) {
324  int edof;
325  readData(instr, edof);
326  eb5.numElemDOF_ = edof;
327 
328  if (edof > 0) {
329  eb5.elemDOFFieldIDs_ = new int[edof];
330  }
331 
332  return;
333  }
334 
335  if (!std::strcmp("elemDOFFieldIDs", keyword)) {
337  int edof = eb6.numElemDOF_;
338 
339  for(int i=0; i<edof; i++) {
340  int eDofFieldID;
341  readData(instr, eDofFieldID);
342  eb6.elemDOFFieldIDs_[i] = eDofFieldID;
343  }
344  return;
345  }
346 
347  if (!std::strcmp("elemFormat", keyword)) {
349  int ef;
350  readData(instr, ef);
351 
352  eb7.elemFormat_ = ef;
353  return;
354  }
355 
356  if (!std::strcmp("numFieldsPerNode", keyword)) {
358 
359  int i;
360  for(i=0; i<eb8.numNodesPerElement_; i++) {
361  int nf;
362  readData(instr, nf);
363  eb8.numFieldsPerNode_[i] = nf;
364  eb8.nodalFieldIDs_[i] = new int[nf];
365  }
366 
367  return;
368  }
369 
370  if (!std::strcmp("nodalFieldIDs", keyword)) {
372 
373  int i, numStiffRows = 0;
374  for(i=0; i<eb9.numNodesPerElement_; i++) {
375  for(int j=0; j<eb9.numFieldsPerNode_[i]; j++) {
376  int nfid;
377  readData(instr, nfid);
378  eb9.nodalFieldIDs_[i][j] = nfid;
379 
380  numStiffRows += getFieldSize(nfid);
381  }
382  }
383 
384  numStiffRows += eb9.numElemDOF_;
385 
386  eb9.numStiffRows_ = numStiffRows;
387 
388  for(i=0; i<eb9.numElements_; i++) {
389  eb9.elemStiff_[i] = new double*[numStiffRows];
390  eb9.elemLoad_[i] = new double[numStiffRows];
391  for(int j=0; j<numStiffRows; j++) {
392  eb9.elemStiff_[i][j] = new double[numStiffRows];
393  }
394  }
395 
396  return;
397  }
398 
399  if (!std::strcmp("elemID", keyword)) {
401 
402  int i, tmp;
403  readData(instr, tmp);
404  eb10.elemIDs_[currentElemIndex_] = (GlobalID)tmp;
405 
406  int* conn = eb10.elemConn_[currentElemIndex_];
407 
408  for(i=0; i<eb10.numNodesPerElement_; i++) {
409  readData(instr, conn[i]);
410  }
411 
412  double** stiff = eb10.elemStiff_[currentElemIndex_];
413 
414  for(i=0; i<eb10.numStiffRows_; i++) {
415  for(int j=0; j<eb10.numStiffRows_; j++) {
416  readData(instr, stiff[i][j]);
417  }
418  }
419 
420  double* load = eb10.elemLoad_[currentElemIndex_];
421 
422  for(i=0; i<eb10.numStiffRows_; i++) {
423  readData(instr, load[i]);
424  }
425 
427 
428  return;
429  }
430 
431  if (!std::strcmp("numSharedNodeSets", keyword)) {
433 
434  if (numSharedNodeSets_ == 0) return;
435 
437 
438  currentShIndex_ = 0;
439 
440  for(int i=0; i<numSharedNodeSets_; i++) {
442 
443  int j, nn;
444  readData(instr, nn);
445  shSet.numNodes_ = nn;
446 
447  shSet.nodeIDs_ = new GlobalID[nn];
448 
449  for(j=0; j<nn; j++) {
450  int tmp;
451  readData(instr, tmp);
452  shSet.nodeIDs_[j] = (GlobalID)tmp;
453  }
454 
455  shSet.procsPerNode_ = new int[nn];
456 
457  for(j=0; j<nn; j++) {
458  int tmp;
459  readData(instr, tmp);
460  shSet.procsPerNode_[j] = tmp;
461  }
462 
463  shSet.procs_ = new int*[nn];
464 
465  for(j=0; j<nn; j++) {
466  shSet.procs_[j] = new int[shSet.procsPerNode_[j]];
467  for(int k=0; k<shSet.procsPerNode_[j]; k++) {
468  readData(instr, shSet.procs_[j][k]);
469  }
470  }
471  }
472 
473  return;
474  }
475 
476  if (!std::strcmp("numBCNodeSets", keyword)) {
477  readData(instr, numBCNodeSets_);
478 
479  if (numBCNodeSets_ == 0) return;
480 
482 
483  currentBCIndex_ = 0;
484 
485  for(int i=0; i<numBCNodeSets_; i++) {
487 
488  int j, nn;
489  readData(instr, nn);
490  bcSet.numNodes_ = nn;
491 
492  readData(instr, bcSet.fieldID_);
493 
494  int field_offset;
495  readData(instr, field_offset);
496 
497  bcSet.nodeIDs_ = new GlobalID[nn];
498  bcSet.offsetsIntoField_ = new int[nn];
499  bcSet.prescribed_values_ = new double[nn];
500 
501  for(j=0; j<nn; ++j) bcSet.offsetsIntoField_[j] = field_offset;
502 
503  for(j=0; j<nn; j++) {
504  readData(instr, bcSet.nodeIDs_[j]);
505  readData(instr, bcSet.prescribed_values_[j]);
506  }
507  }
508 
509  return;
510  }
511 
512  if (!std::strcmp("numCRMultSets", keyword)) {
513  readData(instr, numCRMultSets_);
514 
515  if (numCRMultSets_ == 0) return;
516 
518 
519  for(int i=0; i<numCRMultSets_; i++) {
520  CRSet& cr1 = crMultSets_[i];
521 
522  int dummy;
523  readData(instr, dummy);//used to be numCRs_
524  readData(instr, cr1.numNodes_);
525 
526  cr1.nodeIDs_ = new GlobalID*[1];
527  cr1.fieldIDs_ = new int[cr1.numNodes_];
528 
529  int j;
530  for(j=0; j<1; j++) {
531  cr1.nodeIDs_[j] = new GlobalID[cr1.numNodes_];
532 
533  for(int k=0; k<cr1.numNodes_; k++) {
534  readData(instr, cr1.nodeIDs_[j][k]);
535  }
536  }
537 
538  for(j=0; j<cr1.numNodes_; j++) {
539  readData(instr, cr1.fieldIDs_[j]);
540  }
541 
542  int len = 0;
543  for(j=0; j<cr1.numNodes_; j++) {
544  len += getFieldSize(cr1.fieldIDs_[j]);
545  }
546  cr1.weights_ = new double[len];
547 
548  int offset = 0;
549  for(j=0; j<cr1.numNodes_; j++) {
550  int size = getFieldSize(cr1.fieldIDs_[j]);
551 
552  for(int k=0; k<size; k++) {
553  readData(instr, cr1.weights_[offset++]);
554  }
555  }
556 
557  cr1.values_ = new double[1];
558  for(j=0; j<1; j++) {
559  readData(instr, cr1.values_[j]);
560  }
561  }
562 
563  return;
564  }
565 
566  if (!std::strcmp("numCoefAccessPatterns", keyword)) {
568 
569  if (numCoefAccessPatterns_ == 0) return;
570 
572  for(int i=0; i<numCoefAccessPatterns_; i++) {
573  AccessPattern& patt = accessPatterns_[i];
574 
575  readData(instr, patt.ID_);
576  readData(instr, patt.numRowIDs_);
577  if (patt.numRowIDs_ <= 0) {
578  fei::console_out() << "DataReader ERROR, numRowIDs_ <=0"<<FEI_ENDL;
579  return;
580  }
581 
582  patt.numFieldsPerRow_ = new int[patt.numRowIDs_];
583  int j;
584  for(j=0; j<patt.numRowIDs_; j++) {
585  readData(instr, patt.numFieldsPerRow_[j]);
586  }
587 
588  patt.rowFieldIDs_ = new int*[patt.numRowIDs_];
589  for(j=0; j<patt.numRowIDs_; j++) {
590  patt.rowFieldIDs_[j] = new int[patt.numFieldsPerRow_[j]];
591  }
592 
593  for(int r=0; r<patt.numRowIDs_; r++) {
594  for(int c=0; c<patt.numFieldsPerRow_[r]; c++) {
595  readData(instr, patt.rowFieldIDs_[r][c]);
596  }
597  }
598 
599  readData(instr, patt.numColIDsPerRow_);
600  if (patt.numColIDsPerRow_ <= 0) {
601  fei::console_out() << "DataReader ERROR, numColIDsPerRow_ <=0"<<FEI_ENDL;
602  return;
603  }
604 
605  patt.numFieldsPerCol_ = new int[patt.numColIDsPerRow_];
606  for(j=0; j<patt.numColIDsPerRow_; j++) {
607  readData(instr, patt.numFieldsPerCol_[j]);
608  }
609 
610  patt.colFieldIDs_ = new int*[patt.numColIDsPerRow_];
611  for(j=0; j<patt.numColIDsPerRow_; j++) {
612  patt.colFieldIDs_[j] = new int[patt.numFieldsPerCol_[j]];
613  }
614 
615  for(int rr=0; rr<patt.numColIDsPerRow_; rr++) {
616  for(int c=0; c<patt.numFieldsPerCol_[rr]; c++) {
617  readData(instr, patt.colFieldIDs_[rr][c]);
618  }
619  }
620 
621  readData(instr, patt.interleaveStrategy_);
622  }
623 
624  return;
625  }
626 
627  if (!std::strcmp("coefAccess", keyword)) {
628  int i, patternID = -1;
629  readData(instr, patternID);
630 
631  //find the access-pattern corresponding to this coef-access.
632  int index = -1;
633  for(i=0; i<numCoefAccessPatterns_; i++) {
634  if (accessPatterns_[i].ID_ == patternID) index = i;
635  }
636 
637  if (index < 0) {
638  fei::console_out() << "DataReader ERROR, patternID " << patternID << " not found."<<FEI_ENDL;
639  return;
640  }
641 
642  AccessPattern& patt = accessPatterns_[index];
643 
644  //now lengthen the list of coef-accesses.
645  CoefAccess* newAccesses = new CoefAccess[numCoefAccesses_+1];
646  for(i=0; i<numCoefAccesses_; i++) newAccesses[i] = coefAccesses_[i];
647 
648  delete [] coefAccesses_;
649  coefAccesses_ = newAccesses;
650 
652 
653  coefAcc.patternID_ = patternID;
654 
655  coefAcc.numRowIDs_ = patt.numRowIDs_;
656  coefAcc.numColIDsPerRow_ = patt.numColIDsPerRow_;
657 
658  if (coefAcc.numRowIDs_ <= 0 || coefAcc.numColIDsPerRow_ <= 0) {
659  fei::console_out() << "DataReader ERROR, coef-access has 0 rows or cols." << FEI_ENDL;
660  return;
661  }
662 
663  coefAcc.rowIDs_ = new GlobalID[coefAcc.numRowIDs_];
664  for(i=0; i<coefAcc.numRowIDs_; i++) {
665  readData(instr, coefAcc.rowIDs_[i]);
666  }
667 
668  int len = coefAcc.numRowIDs_ * coefAcc.numColIDsPerRow_;
669  coefAcc.colIDs_ = new GlobalID[len];
670  for(i=0; i<len; i++) {
671  readData(instr, coefAcc.colIDs_[i]);
672  }
673 
674  //calculate numRowCoefs.
675  coefAcc.numRowCoefs_ = 0;
676  for(i=0; i<coefAcc.numRowIDs_; i++) {
677  for(int j=0; j<patt.numFieldsPerRow_[i]; j++) {
678  coefAcc.numRowCoefs_ += getFieldSize(patt.rowFieldIDs_[i][j]);
679  }
680  }
681 
682  //calculate numColCoefs.
683  coefAcc.numColCoefs_ = 0;
684  for(i=0; i<coefAcc.numColIDsPerRow_; i++) {
685  for(int j=0; j<patt.numFieldsPerCol_[i]; j++) {
686  coefAcc.numColCoefs_ += getFieldSize(patt.colFieldIDs_[i][j]);
687  }
688  }
689 
690  len = coefAcc.numRowCoefs_*coefAcc.numColCoefs_;
691  coefAcc.coefs_ = new double[len];
692  int offset = 0;
693  //now read the coefficients-table.
694  for(i=0; i<len; i++) {
695  readData(instr, coefAcc.coefs_[offset++]);
696  }
697 
698  numCoefAccesses_++;
699  return;
700  }
701 
702  if (!std::strcmp("numSlaveVariables", keyword)) {
703  readData(instr, numSlaveVars_);
704 
705  if (numSlaveVars_ == 0) return;
706 
708 
709  for(int i=0; i<numSlaveVars_; i++) {
710  CRSet& cr2 = slaveVars_[i];
711 
712  readData(instr, cr2.slaveNodeID_);
713  readData(instr, cr2.slaveFieldID_);
714  readData(instr, cr2.slaveOffset_);
715 
716  readData(instr, cr2.numNodes_);
717  cr2.nodeIDs_ = new GlobalID*[1];
718  cr2.nodeIDs_[0] = new GlobalID[cr2.numNodes_];
719  cr2.fieldIDs_ = new int[cr2.numNodes_];
720 
721  int j;
722  for(int k=0; k<cr2.numNodes_; k++) {
723  readData(instr, cr2.nodeIDs_[0][k]);
724  }
725 
726  for(j=0; j<cr2.numNodes_; j++) {
727  readData(instr, cr2.fieldIDs_[j]);
728  }
729 
730  int len = 0;
731  for(j=0; j<cr2.numNodes_; j++) {
732  len += getFieldSize(cr2.fieldIDs_[j]);
733  }
734  cr2.weights_ = new double[len];
735 
736  int offset = 0;
737  for(j=0; j<cr2.numNodes_; j++) {
738  int size = getFieldSize(cr2.fieldIDs_[j]);
739 
740  for(int k=0; k<size; k++) {
741  readData(instr, cr2.weights_[offset++]);
742  }
743  }
744 
745  cr2.values_ = new double[1];
746  readData(instr, cr2.values_[0]);
747  }
748 
749  return;
750  }
751 
752  if (!std::strcmp("numCRPenSets", keyword)) {
753  readData(instr, numCRPenSets_);
754 
755  if (numCRPenSets_ == 0) return;
756 
758 
759  for(int i=0; i<numCRPenSets_; i++) {
760  CRSet& cr3 = crPenSets_[i];
761 
762  int dummy;
763  readData(instr, dummy);//used to be numCRs_
764  readData(instr, cr3.numNodes_);
765 
766  cr3.nodeIDs_ = new GlobalID*[1];
767  cr3.fieldIDs_ = new int[cr3.numNodes_];
768 
769  int j;
770  for(j=0; j<1; j++) {
771  cr3.nodeIDs_[j] = new GlobalID[cr3.numNodes_];
772 
773  for(int k=0; k<cr3.numNodes_; k++) {
774  readData(instr, cr3.nodeIDs_[j][k]);
775  }
776  }
777 
778  for(j=0; j<cr3.numNodes_; j++) {
779  readData(instr, cr3.fieldIDs_[j]);
780  }
781 
782  int len3 = 0;
783  for(j=0; j<cr3.numNodes_; j++) {
784  len3 += getFieldSize(cr3.fieldIDs_[j]);
785  }
786  cr3.weights_ = new double[len3];
787 
788  int offset3 = 0;
789  for(j=0; j<cr3.numNodes_; j++) {
790  int size3 = getFieldSize(cr3.fieldIDs_[j]);
791 
792  for(int k=0; k<size3; k++) {
793  double dummy3;
794  readData(instr, dummy3);
795  cr3.weights_[offset3++] = dummy3;
796  }
797  }
798 
799  cr3.values_ = new double[1];
800  for(j=0; j<1; j++) {
801  readData(instr, cr3.values_[j]);
802  }
803 
804  cr3.penValues_ = new double[1];
805  for(j=0; j<1; j++) {
806  readData(instr, cr3.penValues_[j]);
807  }
808  }
809 
810  return;
811  }
812 }
813 
814 //==============================================================================
815 int DataReader::getFieldSize(int fieldID) {
816  for(int i=0; i<numFields_; i++) {
817  if (fieldID == fieldIDs_[i]) return(fieldSizes_[i]);
818  }
819 
820  fei::console_out() << "DataReader: ERROR, trying to find size of non-existent field."
821  << FEI_ENDL;
822  return(0);
823 }
824 
825 //==============================================================================
826 void DataReader::readData(FEI_ISTREAM* instr, int& n) {
827  int err = skipWhite(instr);
828  if (err) return;
829  (*instr) >> n;
830 }
831 
832 //==============================================================================
833 void DataReader::readData(FEI_ISTREAM* instr, double& val) {
834  int err = skipWhite(instr);
835  if (err) return;
836  (*instr) >> val;
837 }
838 
int numStiffRows_
Definition: ElemBlock.hpp:24
int * numFieldsPerCol_
Definition: CRSet.hpp:25
double * prescribed_values_
Definition: BCNodeSet.hpp:25
int * fieldIDs_
Definition: DataReader.hpp:35
#define FEI_COUT
GlobalID ** elemConn_
Definition: ElemBlock.hpp:23
CRSet * crPenSets_
Definition: DataReader.hpp:57
int * procsPerNode_
Definition: CommNodeSet.hpp:20
int * fieldSizes_
Definition: DataReader.hpp:36
int elemFormat_
Definition: ElemBlock.hpp:25
int GlobalID
Definition: fei_defs.h:60
CRSet * slaveVars_
Definition: DataReader.hpp:54
int numElements_
Definition: ElemBlock.hpp:18
GlobalID slaveNodeID_
Definition: CRSet.hpp:45
static int is_reg_char(char c)
Definition: DataReader.cpp:151
double * penValues_
Definition: CRSet.hpp:61
int numRowIDs_
Definition: CoefAccess.hpp:62
#define FEI_IFSTREAM
Definition: fei_fstream.hpp:13
int numSlaveVars_
Definition: DataReader.hpp:53
int numFields_
Definition: DataReader.hpp:34
int ** nodalFieldIDs_
Definition: ElemBlock.hpp:21
int * numFieldsPerRow_
bool numElemBlocksRead_
Definition: DataReader.hpp:79
int numCRPenSets_
Definition: DataReader.hpp:56
GlobalID ** nodeIDs_
Definition: CRSet.hpp:55
int slaveOffset_
Definition: CRSet.hpp:53
int numColCoefs_
Definition: CoefAccess.hpp:69
static int getKeyword(FEI_ISTREAM *instr, char *&keyword)
Definition: DataReader.cpp:131
int numNodesPerElement_
Definition: ElemBlock.hpp:19
int numBCNodeSets_
Definition: DataReader.hpp:59
int numElemBlocks_
Definition: DataReader.hpp:41
AccessPattern * accessPatterns_
Definition: DataReader.hpp:45
GlobalID blockID_
Definition: ElemBlock.hpp:17
static int skipWhite(FEI_ISTREAM *instr)
Definition: DataReader.cpp:159
bool numFieldsRead_
Definition: DataReader.hpp:78
double * weights_
Definition: CRSet.hpp:59
int solveType_
Definition: DataReader.hpp:28
int * elemDOFFieldIDs_
Definition: ElemBlock.hpp:29
int numSharedNodeSets_
Definition: DataReader.hpp:62
GlobalID * nodeIDs_
Definition: CommNodeSet.hpp:18
int numNodes_
Definition: BCNodeSet.hpp:21
int patternID_
Definition: CoefAccess.hpp:60
int numRowCoefs_
Definition: CoefAccess.hpp:68
int * offsetsIntoField_
Definition: BCNodeSet.hpp:24
CommNodeSet * sharedNodeSets_
Definition: DataReader.hpp:63
double *** elemStiff_
Definition: ElemBlock.hpp:26
double * coefs_
Definition: CoefAccess.hpp:71
int numNodes_
Definition: CRSet.hpp:40
char ** paramStrings_
Definition: DataReader.hpp:39
void deleteMemory()
Definition: DataReader.cpp:66
int currentElemBlockIndex_
Definition: DataReader.hpp:80
int readData(const char *fileName)
Definition: DataReader.cpp:103
int numElemDOF_
Definition: ElemBlock.hpp:28
#define FEI_ENDL
int getFieldSize(int fieldID)
Definition: DataReader.cpp:815
int ** procs_
Definition: CommNodeSet.hpp:19
CoefAccess * coefAccesses_
Definition: DataReader.hpp:48
std::ostream & console_out()
int fieldID_
Definition: BCNodeSet.hpp:23
GlobalID * nodeIDs_
Definition: BCNodeSet.hpp:22
int * fieldIDs_
Definition: CRSet.hpp:57
double * values_
Definition: CRSet.hpp:60
GlobalID * colIDs_
Definition: CoefAccess.hpp:66
int numColIDsPerRow_
Definition: CoefAccess.hpp:65
int currentBCIndex_
Definition: DataReader.hpp:85
int numCRMultSets_
Definition: DataReader.hpp:50
GlobalID * elemIDs_
Definition: ElemBlock.hpp:22
int * numFieldsPerNode_
Definition: ElemBlock.hpp:20
#define FEI_ISTREAM
int currentElemIndex_
Definition: DataReader.hpp:81
int numCoefAccessPatterns_
Definition: DataReader.hpp:44
int slaveFieldID_
Definition: CRSet.hpp:48
int numParams_
Definition: DataReader.hpp:38
int interleaveStrategy_
Definition: ElemBlock.hpp:30
ElemBlock * elemBlocks_
Definition: DataReader.hpp:42
CRSet * crMultSets_
Definition: DataReader.hpp:51
GlobalID * rowIDs_
Definition: CoefAccess.hpp:63
int currentShIndex_
Definition: DataReader.hpp:83
BCNodeSet * bcNodeSets_
Definition: DataReader.hpp:60
int numCoefAccesses_
Definition: DataReader.hpp:47
double ** elemLoad_
Definition: ElemBlock.hpp:27