Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FloGrid.H
Go to the documentation of this file.
1 /* *******************************************************************
2  * Rocstar Simulation Suite *
3  * Copyright@2015, Illinois Rocstar LLC. All rights reserved. *
4  * *
5  * Illinois Rocstar LLC *
6  * Champaign, IL *
7  * www.illinoisrocstar.com *
8  * sales@illinoisrocstar.com *
9  * *
10  * License: See LICENSE file in top level of distribution package or *
11  * http://opensource.org/licenses/NCSA *
12  *********************************************************************/
13 /* *******************************************************************
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, *
15  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES *
16  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND *
17  * NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR *
18  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
20  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE *
21  * USE OR OTHER DEALINGS WITH THE SOFTWARE. *
22  *********************************************************************/
23 #ifndef _FLOGRID_H_
24 #define _FLOGRID_H_
25 
26 
27 class FloGridBlock {
28 protected:
29  unsigned int _ncells[3];
30  std::vector<double> _incoords;
31  unsigned int _ng;
32  std::vector<double> _soln;
33  unsigned int _grid_no;
34 private:
35  bool flolayout;
36 public:
38  {
39  _ncells[0] = _ncells[1] = _ncells[2] = _ng = 0;
40  _incoords.resize(0);
41  _soln.resize(0);
42  _grid_no = 0;
43  flolayout = false;
44  };
45  FloGridBlock(unsigned int i,unsigned int j,unsigned int k)
46  {
47  _ncells[0] = i;
48  _ncells[1] = j;
49  _ncells[2] = k;
50  _ng = 0;
51  _grid_no = 0;
52  _incoords.resize(3*(i+1)*(j+1)*(k+1));
53  flolayout = false;
54  };
55  FloGridBlock(const FloGridBlock &inblock)
56  {
57  _ncells[0] = inblock._ncells[0];
58  _ncells[1] = inblock._ncells[1];
59  _ncells[2] = inblock._ncells[2];
60  _grid_no = inblock._grid_no;
61  _incoords.resize(3*(inblock._ncells[0]+1)*(inblock._ncells[1]+1)*
62  (inblock._ncells[2]+1));
63  std::vector<double>::const_iterator ii = inblock._incoords.begin();
64  std::vector<double>::iterator ni = _incoords.begin();
65  while(ni != _incoords.end())
66  *ni++ = *ii++;
67  flolayout = inblock.flolayout;
68  _soln = inblock._soln;
69  _ng = inblock._ng;
70  };
71  void DestroyGrid()
72  {
73  _incoords.resize(0);
74  // release the memory for real...
75  std::vector<double>(_incoords).swap(_incoords);
76  };
77  void SetGhostLayers(unsigned int n)
78  {
79  _ng = n;
80  };
81  unsigned int NGhostLayers() const {return (_ng); };
82  int CreateSoln()
83  {
84  _soln.resize(5*NTotalCells());
85  };
86  unsigned int NNodes() const { return ((_ncells[0]+1)*(_ncells[1]+1)*(_ncells[2]+1)); };
87  unsigned int NumCells() const { return (_ncells[0]*_ncells[1]*_ncells[2]); };
88  unsigned int NTotalCells() const { return ((_ncells[0]+(2*_ng))*(_ncells[1]+(2*_ng))*(_ncells[2]+(2*_ng))); };
89  std::vector<double> &Solution() { return (_soln); };
90  const std::vector<double> &Solution() const { return (_soln); };
91  void FloLayout()
92  {
93  if(!flolayout){
94  flolayout = true;
95  unsigned int nnodes = NNodes();
96  std::vector<double> coordcopy(3*nnodes);
97  std::vector<double>::iterator ci = _incoords.begin();
98  std::vector<double>::iterator cci = coordcopy.begin();
99  while(ci != _incoords.end())
100  *cci++ = *ci++;
101  for(int i = 0;i < nnodes;i++){
102  _incoords[i] = coordcopy[3*i];
103  _incoords[nnodes+i] = coordcopy[(3*i) + 1];
104  _incoords[2*nnodes+i] = coordcopy[(3*i) + 2];
105  }
106 
107  }
108  };
109  void MeshLayout()
110  {
111  if(flolayout){
112  flolayout = false;
113  unsigned int nnodes = NNodes();
114  std::vector<double> coordcopy(3*nnodes);
115  std::vector<double>::iterator ci = _incoords.begin();
116  std::vector<double>::iterator cci = coordcopy.begin();
117  while(ci != _incoords.end())
118  *cci++ = *ci++;
119  for(int i = 0;i < nnodes;i++){
120  _incoords[3*i] = coordcopy[i];
121  _incoords[3*i+1] = coordcopy[nnodes + i];
122  _incoords[3*i+2] = coordcopy[(2*nnodes) + i];
123  }
124 
125  }
126  };
127 
129  {
130  _ncells[0] = inblock._ncells[0];
131  _ncells[1] = inblock._ncells[1];
132  _ncells[2] = inblock._ncells[2];
133 
134  _incoords.resize(3*(inblock._ncells[0]+1)*(inblock._ncells[1]+1)*
135  (inblock._ncells[2]+1));
136  std::vector<double>::const_iterator ii = inblock._incoords.begin();
137  std::vector<double>::iterator ni = _incoords.begin();
138  while(ni != _incoords.end())
139  *ni++ = *ii++;
140  flolayout = inblock.flolayout;
141 
142  };
143  unsigned int isize() const { return _ncells[0]; };
144  unsigned int jsize() const { return _ncells[1]; };
145  unsigned int ksize() const { return _ncells[2]; };
146  unsigned int *NCells() { return (_ncells); };
147  const unsigned int *NCells() const { return(_ncells); };
148  void Resize(unsigned int i,unsigned int j,unsigned int k)
149  {
150  _ncells[0] = i; _ncells[1] = j; _ncells[2] = k;
151  _incoords.resize(3*(i+1)*(j+1)*(k+1));
152  flolayout = false;
153  };
154  void ResizeSoln(unsigned int i,unsigned int j,unsigned int k,unsigned int ng)
155  {
156  _ncells[0] = i; _ncells[1] = j; _ncells[2] = k;
157  _ng = ng;
158  _soln.resize(5*((i+(2*ng))*(j+(2*ng))*(k+(2*ng))));
159  // flolayout = false;
160  };
161  std::vector<double> &Coords() { return _incoords; };
162  const std::vector<double> &Coords() const { return _incoords; };
163  int ReadBlock(std::istream &BlockIn)
164  {
165  std::string line;
166  std::getline(BlockIn,line);
167  if(line.empty())
168  return(1);
169  std::istringstream Istr(line);
170  unsigned int ni = 0;
171  unsigned int nj = 0;
172  unsigned int nk = 0;
173  Istr >> _grid_no >> ni >> nj >> nk;
174  if((_grid_no <= 0) || (ni <= 0) || (nj <= 0) || (nk <= 0)){
175  std::cout << "FloGridBlock::ReadBlock: Error reading block" << std::endl
176  << "FloGridBlock::ReadBlock: line:" << line << std::endl
177  << "FloGridBlock::ReadBlock: grid no: " << _grid_no << "ni = " << ni
178  << " nj = " << nj << " nk = " << nk << std::endl;
179  return(1);
180  }
181  unsigned int number_of_nodes = (ni+1)*(nj+1)*(nk+1);
182  // std::cout << "Partition " << grid_no << ": (" << ni
183  // << "," << nj << "," << nk << ")" << std::endl
184  // << "npts = " << number_of_nodes << std::endl;
185  this->Resize(ni,nj,nk);
186  double VERYSMALL = std::numeric_limits<double>::min();
187  double VERYLARGE = std::numeric_limits<double>::max();
188  std::vector<double>::iterator ici = _incoords.begin();
189  while(ici != _incoords.end())
190  BlockIn >> *ici++;
191  std::getline(BlockIn,line);
192  GeoPrim::CPoint minp(VERYLARGE,VERYLARGE,VERYLARGE);
193  GeoPrim::CPoint maxp(-1.0*VERYLARGE,-1.0*VERYLARGE,-1.0*VERYLARGE);
194  ici = _incoords.begin();
195  unsigned int ncount = 0;
196  while(ici != _incoords.end()){
197  double *minval = NULL;
198  double *maxval = NULL;
199  double value = *ici++;
200  if(ncount < number_of_nodes){
201  minval = &minp.x();
202  maxval = &maxp.x();
203  }
204  else if(ncount < 2*number_of_nodes){
205  minval = &minp.y();
206  maxval = &maxp.y();
207  }
208  else {
209  minval = &minp.z();
210  maxval = &maxp.z();
211  }
212  ncount++;
213  if (value < *minval)
214  *minval = value;
215  if (value > *maxval)
216  *maxval = value;
217  }
218  // std::cout << "Mesh limits: " << std::endl
219  // << "Minimum point: " << minp << std::endl
220  // << "Maximum point: " << maxp << std::endl;
221  flolayout = true;
222  return(0);
223  };
224  int ReadBlockSoln(std::istream &BlockSolnIn)
225  {
226  std::string line;
227  std::getline(BlockSolnIn,line);
228  if(line.empty())
229  return(1);
230  std::istringstream Istr(line);
231  unsigned int grid_no = 0;
232  unsigned int ni = 0;
233  unsigned int nj = 0;
234  unsigned int nk = 0;
235  unsigned int ng = 0;
236  Istr >> grid_no >> ni >> nj >> nk >> ng;
237  if(_grid_no != grid_no) std::cout << "grid " << _grid_no << " tried to read soln for block " << grid_no << std::endl;
238  assert(_grid_no == grid_no);
239  if((grid_no <= 0) || (ni <= 0) || (nj <= 0) || (nk <= 0)){
240  std::cout << "FloGridBlock::ReadBlockSoln: Error reading block" << std::endl
241  << "FloGridBlock::ReadBlockSoln: line:" << line << std::endl
242  << "FloGridBlock::ReadBlockSoln: grid no: " << grid_no << "ni = " << ni
243  << " nj = " << nj << " nk = " << nk << std::endl;
244  return(1);
245  }
246  unsigned int number_of_total_cells = (ni+(2*ng))*(nj+(2*ng))*(nk+(2*ng));
247  unsigned int number_of_real_cells = (ni*nj*nk);
248  assert(number_of_real_cells == NumCells());
249  // std::cout << "Partition " << grid_no << ": (" << ni
250  // << "," << nj << "," << nk << ")" << std::endl
251  // << "npts = " << number_of_nodes << std::endl;
252  this->ResizeSoln(ni,nj,nk,ng);
253  std::vector<double>::iterator ici = _soln.begin();
254  while(ici != _soln.end())
255  BlockSolnIn >> *ici++;
256  std::getline(BlockSolnIn,line);
257  return(0);
258  };
259  int WriteBlockSoln(std::ostream &Ouf)
260  {
261  std::ostringstream Ostr;
262  Ostr << _grid_no << " " << _ncells[0] << " " << _ncells[1]
263  << " " << _ncells[2] << " " << _ng << std::endl;
264  std::vector<double>::iterator si = _soln.begin();
265  while(si != _soln.end()){
266  Ostr << std::scientific << std::setprecision(16) << *si++ << " ";
267  }
268  Ostr << std::endl;
269  Ouf << Ostr.str();
270  return(Ostr.str().size());
271  };
272 
273 };
274 
275 
276 class FloGrid {
277 protected:
278  std::string _casename;
279  std::vector<FloGridBlock> _blocks;
280  std::ofstream _solnfile;
281  double _time;
283 public:
285  { _blocks.resize(0); _time=0.0;};
286  FloGrid(const std::string &casename)
287  : _casename(casename)
288  {_blocks.resize(0); _time=0.0;};
289  std::string Casename() const { return (_casename); };
290  double Time() const { return (_time); };
291  std::vector<FloGridBlock> &Blocks() { return (_blocks); };
292  const std::vector<FloGridBlock> &Blocks() const { return (_blocks); };
293  double UnknownNumber() const { return (_unknown_number); };
295  {
296  std::string sourcegridfile(_casename+".grda_0.00000E-00");
297  // std::cout << "Reading grid file: " << sourcegridfile << std::endl;
298 
299  std::ifstream Inf;
300  Inf.open(sourcegridfile.c_str());
301  if(!Inf){
302  std::cout << "FloGrid::ReadAllBlocks: Could not open source grid file, "
303  << sourcegridfile << std::endl;
304  return(1);
305  }
306 
307  std::string ftimestamp;
308  std::getline(Inf,ftimestamp);
309  while(Inf){
311  if(block.ReadBlock(Inf) == 0){
312  _blocks.push_back(block);
313  }
314 
315  }
316  Inf.close();
317  return(0);
318  };
319  int ReadNBlocks(int first,int nblocks)
320  {
321  std::string sourcegridfile(_casename+".grda_0.00000E-00");
322  // std::cout << "Reading grid file: " << sourcegridfile << std::endl;
323 
324  std::ifstream Inf;
325  Inf.open(sourcegridfile.c_str());
326  if(!Inf){
327  std::cout << "FloGrid::ReadAllBlocks: Could not open source grid file, "
328  << sourcegridfile << std::endl;
329  return(1);
330  }
331 
332  std::string ftimestamp;
333  std::getline(Inf,ftimestamp);
334  int n = 1;
335  while(n < first){
337  block.ReadBlock(Inf);
338  n++;
339  }
340  while(n < (first + nblocks)){
342  if(block.ReadBlock(Inf) == 0){
343  _blocks.push_back(block);
344  }
345  n++;
346  }
347  Inf.close();
348  return(0);
349  };
351  {
352  std::string sourcegridfile(_casename+".grda_0.00000E-00");
353  std::cout << "Reading grid file: " << sourcegridfile << std::endl;
354 
355  std::ifstream Inf;
356  Inf.open(sourcegridfile.c_str());
357  if(!Inf){
358  std::cout << "FloGrid::ReadAllBlocks: Could not open source grid file, "
359  << sourcegridfile << std::endl;
360  return(1);
361  }
362 
363  std::string ftimestamp;
364  std::getline(Inf,ftimestamp);
365  int n = 0;
366  while(Inf){
368  block.ReadBlock(Inf);
369  n++;
370  }
371  Inf.close();
372  return(n-1);
373  };
375  {
376  std::vector<FloGridBlock>::iterator fgbi = _blocks.begin();
377  while(fgbi != _blocks.end())
378  fgbi++->DestroyGrid();
379  };
380  void SetGhostLayers(unsigned int n)
381  {
382  std::vector<FloGridBlock>::iterator fgbi = _blocks.begin();
383  while(fgbi != _blocks.end())
384  fgbi++->SetGhostLayers(n);
385  };
387  {
388  std::vector<FloGridBlock>::iterator fgbi = _blocks.begin();
389  while(fgbi != _blocks.end())
390  fgbi++->CreateSoln();
391  };
392  int OpenSolutionFile(const std::string &timestamp,double time,double unknown_number)
393  {
394  std::string solnfile(_casename+".sola_"+timestamp);
395 
396  // std::ofstream Ouf;
397  _solnfile.open(solnfile.c_str());
398  if(!_solnfile){
399  std::cout << "FloGrid::OpenSolutionFile Could not open source soln file, "
400  << solnfile << std::endl;
401  return(1);
402  }
403  _solnfile << std::scientific << std::setprecision(16);
404  _solnfile << time << "\t" << unknown_number << std::endl;
405  return(0);
406  };
407  void CloseSolutionFile() { _solnfile.close(); };
408  std::ofstream &SolnFile() { return (_solnfile); };
409  int WriteSolutionFile(const std::string &timestamp,double time,double unknown_number)
410  {
411  if(OpenSolutionFile(timestamp,time,unknown_number))
412  return(1);
413  std::vector<FloGridBlock>::iterator fgbi = _blocks.begin();
414  while(fgbi != _blocks.end()){
415  fgbi++->WriteBlockSoln(_solnfile);
416  if(!_solnfile && (fgbi != _blocks.end()))
417  return(1);
418 
419  }
421  return(0);
422 
423  };
424  int WriteBlocks(std::ostream &Ouf)
425  {
426  // std::string sourcesolnfile(_casename+".sola_"+timestamp);
427  // std::cout << "Writing soln file: " << sourcesolnfile << std::endl;
428 
429  // std::ofstream Ouf;
430  // Ouf.open(sourcesolnfile.c_str());
431  // if(!Ouf){
432  // std::cout << "FloGrid::WriteSolutionFile Could not open source soln file, "
433  // << sourcesolnfile << std::endl;
434  // return(1);
435  // }
436  // Ouf << std::scientific << std::setprecision(16);
437  // Ouf << time << "\t" << unknown_number << std::endl;
438  int datasize = 0;
439  std::vector<FloGridBlock>::iterator fgbi = _blocks.begin();
440  while(fgbi != _blocks.end())
441  datasize += (fgbi++->WriteBlockSoln(Ouf));
442  return(datasize);
443  };
444  int ReadAllSolutions(const std::string &timestamp)
445  {
446  std::string sourcesolnfile(_casename+".sola_"+timestamp);
447  // std::cout << "Reading soln file: " << sourcesolnfile << std::endl;
448 
449  std::ifstream Inf;
450  Inf.open(sourcesolnfile.c_str());
451  if(!Inf){
452  std::cout << "FloGrid::ReadAllSoln: Could not open source soln file, "
453  << sourcesolnfile << std::endl;
454  return(1);
455  }
456 
457  std::string ftimestamp;
458  std::getline(Inf,ftimestamp);
459  std::istringstream Istr(ftimestamp);
460  Istr >> _time >> _unknown_number;
461  std::vector<FloGridBlock>::iterator fgbi = _blocks.begin();
462  while(fgbi != _blocks.end()){
463  fgbi++->ReadBlockSoln(Inf);
464  if(!Inf && (fgbi != _blocks.end()))
465  return(1);
466 
467  }
468  Inf.close();
469  return(0);
470  };
471 };
472 
474 public:
476  double _resid;
477  bool _unsteady;
478  std::vector<double> _rhof; // Density
479  std::vector<double> _rhouf;
480  std::vector<double> _rhovf; // Momentum density
481  std::vector<double> _rhowf;
482  std::vector<double> _rhoEf; // Energy density
483  std::vector<double> _pf; // Pressure
484  std::vector<double> _Tf; // Temperature
485  std::vector<double> _af; // Speed of sound
486  std::vector<double> _disp; // nodal displacements
487  // std::vector<double> _gsp; // Speed of each face
488  FloVolumeSoln(unsigned int ncell_i=0, unsigned int ncell_j=0, unsigned int ncell_k=0)
489 
490  {
491  Resize(ncell_i,ncell_j,ncell_k);
492  };
493  void
494  Resize(unsigned int ncell_i,unsigned int ncell_j,unsigned int ncell_k)
495  {
496  unsigned int ncells = ncell_i * ncell_j * ncell_k;
497  unsigned int number_of_nodes = (ncell_i+1)*(ncell_j+1)*(ncell_k+1);
498  _rhof.resize(ncells,0.0);
499  _rhouf.resize(ncells,0.0);
500  _rhovf.resize(ncells,0.0);
501  _rhowf.resize(ncells,0.0);
502  _rhoEf.resize(ncells,0.0);
503  _pf.resize(ncells,0.0);
504  _Tf.resize(ncells,0.0);
505  _af.resize(ncells,0.0);
506  _disp.resize(number_of_nodes*3,0.0);
507  // _gsp.resize(nfaces,0.0);
508  _unsteady = false;
509  _resid = 0.0;
510  _current_time = 0.0;
511  };
512 };
513 
514 //class FloBorder : public GEM_PartitionBoundary
515 //{
516 //public:
517 // unsigned int _rbid;
518 //};
519 
520 
521 // class FloRegion : public GEM_Partition {
522 // public:
523 // string _casename;
524 // string _casepath;
525 // unsigned int _nnodes;
526 // unsigned int _ncells;
527 // unsigned int _ni;
528 // unsigned int _nj;
529 // unsigned int _nk;
530 // // unsigned int _npatches_total;
531 // // std::vector<FluPatch> _patches;
532 // std::vector<FloBorder> _borders;
533 // FloVolumeSoln _soln;
534 // // std::vector<pair<unsigned int,unsigned int> > _cellmap;
535 // // void report();
536 // // unsigned int nelem();
537 // // bool BuildCellMapping();
538 // // bool Cell2Elem(unsigned int, unsigned
539 // // int&, unsigned int&);
540 // // bool BuildPatchMapping(map<unsigned int,unsigned int> &,const string &p="");
541 // // bool WriteFluNative(const string &p="");
542 // // bool WriteFluCMP(const string &p="");
543 // // bool ReadFluCOM(const string &p="");
544 // // bool WriteFluCOM(const string &p="");
545 // // bool ReadFluDIM(const string &p="",double=0.0,bool=true);
546 // // bool WriteFluDIM(const string &p="",double=0.0,bool=true);
547 // // bool ReadFluGridASCII(const std::string&p="", double=0.0,bool=true);
548 // // bool WriteFluGridASCII(const string &pre="", double=0.0,bool=true);
549 // // bool ReadFluSolnASCII(const std::string&p="",unsigned int=0,
550 // // double=0.0,bool=true);
551 // // bool WriteFluSolnASCII(const std::string&p="",unsigned int=0,
552 // // double=0.0,bool=true);
553 // // bool WriteGSPASCII(const std::string&p="",unsigned int=0,
554 // // double=0.0,bool=true);
555 // // bool ReadGSPASCII(const std::string&p="",unsigned int=0,
556 // // double=0.0,bool=true);
557 // // bool ReadRegionASCII(const string &p="",unsigned int=0,unsigned int=0,
558 // // double=0.0,bool=true);
559 // // bool InitSurfaceSoln(const string &p="");
560 // // bool InitVolumeSoln(const string &p="");
561 // // bool CreateRegionMapFile(const string &p="",unsigned int=0,unsigned int=0);
562 // // void PopRemBordIndMPI();
563 // // bool PopRemBordIndFILE(const string &p="",double=0.0,bool=true);
564 // // bool ComRemeshInitData(const string &wname,double *cell_data,int nval_cells,
565 // // double *node_data,int nval_nodes);
566 // // bool ReadControlFile();
567 // // bool validate_comm_list(int ncsend,int ncrecv,int *csend,int *crecv);
568 // // bool PopulateFluVolumeSoln(double *data);
569 // FloRegion(): GEM_Partition()
570 // {
571 // _casename = "";
572 // _nnodes = 0;
573 // _ni = 0;
574 // _nj = 0;
575 // _nk = 0;
576 // _ncells = 0;
577 // _borders.resize(0);
578 // };
579 
580 // FloRegion(const GEM_Partition &gp) : GEM_Partition(gp)
581 // {
582 // _casename = "";
583 // _nnodes = gp._nc.size()/3;
584 // _ncells = gp._hexconn.size()/8;
585 // };
586 
587 
588 
589 // template<typename PB>
590 // bool PopulateFloBorders(std::vector<PB> &pb)
591 // {
592 // unsigned int nborders = pb.size();
593 // _borders.resize(nborders);
594 // unsigned int border = 0;
595 // while(border < nborders){
596 // _borders[border]._rpart = pb[border]._rpart;
597 // _borders[border]._sendcells = pb[border]._sendcells;
598 // _borders[border]._recvcells = pb[border]._recvcells;
599 // _borders[border]._sharenodes = pb[border]._sharenodes;
600 // _borders[border]._sendnodes = pb[border]._sendnodes;
601 // _borders[border]._recvnodes = pb[border]._recvnodes;
602 // _borders[border]._rbid = pb[border]._rbid;
603 // _borders[border]._out = pb[border]._out;
604 // border++;
605 // }
606 // return(true);
607 // };
608 
609 // // bool
610 // // validate_comm_list(int ncsend,int ncrecv,int *csend,int *crecv)
611 // // {
612 // // int index = 0;
613 // // int nreal_cell = _tetconn.size()/4 + _prisconn.size()/6 +
614 // // _pyrconn.size()/5 + _hexconn.size()/8 - (_ngtet + _ngpris +
615 // // _ngpyr + _nghex);
616 // // bool rval = true;
617 // // while(index < ncsend){
618 // // int ind = index++;
619 // // if(!(csend[ind] <= nreal_cell)){
620 // // if(_out)
621 // // *_out << "SEND CELL " << index << " is a ghost cell!!" << endl;
622 // // rval = false;
623 // // }
624 // // if(!(csend[ind] > 0)){
625 // // if(_out)
626 // // *_out << "SEND CELL " << index << " is zero or negative!" << endl;
627 // // rval = false;
628 // // }
629 // // }
630 // // index = 0;
631 // // list<int> recvcell_list;
632 // // while(index < ncrecv) {
633 // // int ind = index++;
634 // // if(!(crecv[ind] > nreal_cell)){
635 // // if(_out)
636 // // *_out << "RECV CELL " << index << " is a real cell!!" << endl;
637 // // rval = false;
638 // // }
639 // // if(!(crecv[ind] > 0)){
640 // // if(_out)
641 // // *_out << "RECV CELL " << index << " is zero or negative!" << endl;
642 // // rval = false;
643 // // }
644 // // bool duped = false;
645 // // list<int>::iterator rci = recvcell_list.begin();
646 // // while(rci != recvcell_list.end() && !duped){
647 // // if(crecv[ind] == *rci++){
648 // // if(_out)
649 // // *_out << "RECV CELL " << index
650 // // << " is duplicated in the receive list!"
651 // // << endl;
652 // // duped = true;
653 // // }
654 // // }
655 // // if(!duped)
656 // // recvcell_list.push_back(crecv[ind]);
657 // // }
658 // // return(rval);
659 // // };
660 // void AddFluBorder(int rpid,int rpin,int nnshare, int nnsend,
661 // // int nnrecv,int ncsend,int ncrecv,
662 // // int *nshared,int *nsend,int *nrecv,
663 // // int *csend,int *crecv){
664 // // assert(rpid > 0 && rpin >= 0);
665 // // if(_debug && _out)
666 // // *_out << "FluRegion(" << _id << ")::AddFluBorder: Adding Border with"
667 // // << " region " << rpid << "." << endl;
668 // // FluBorder new_border;
669 // // new_border._rbid = rpin;
670 // // new_border._out = _out;
671 // // if(!validate_comm_list(ncsend,ncrecv,csend,crecv)){
672 // // if(_out)
673 // // *_out << "FluRegion(" << _id << ")::AddFluBorder: Validation of "
674 // // << "communication arrays failed, aborting." << endl;
675 // // exit(-1);
676 // // }
677 // // new_border.populate(rpid,nnshare,nnsend,nnrecv,ncsend,ncrecv,
678 // // nshared,nsend,nrecv,csend,crecv);
679 // // _borders.push_back(new_border);
680 // // };
681 // // void AddFluPatch(int patch_id,int ntri, int ngtri, int *tris,
682 // // int nquad,int ngquad, int *quads)
683 // // {
684 // // assert(ntri >= ngtri && nquad >= ngquad);
685 // // if(_debug && _out)
686 // // *_out << "FluRegion(" << _id << ")::AddFluPatch: Adding Patch with"
687 // // << " id " << patch_id << "." << endl;
688 // // FluPatch new_patch;
689 // // new_patch._ntri = ntri;
690 // // new_patch._nquad = nquad;
691 // // new_patch._id = patch_id;
692 // // new_patch._ngtri = ngtri;
693 // // new_patch._ngquad = ngquad;
694 // // int indy = 0;
695 // // new_patch._triconn.resize(3*ntri);
696 // // new_patch._quadconn.resize(4*nquad);
697 // // new_patch._out = _out;
698 // // while(indy < 3*ntri){
699 // // assert(tris[indy] != 0);
700 // // new_patch._triconn[indy] = tris[indy];
701 // // assert(new_patch._triconn[indy] != 0);
702 // // indy++;
703 // // }
704 // // indy = 0;
705 // // while(indy < 4*nquad){
706 // // assert(quads[indy] != 0);
707 // // new_patch._quadconn[indy] = quads[indy];
708 // // indy++;
709 // // }
710 // // _patches.push_back(new_patch);
711 // // };
712 // // #ifdef _ROCSTAR_X_
713 // // bool RegisterFluSurfaceMesh();
714 // // bool RegisterSurfaceSoln(bool);
715 // // bool RegisterVolumeSoln(bool);
716 // //#endif
717 // };
718 
719 //istream &SkipLines(istream &,unsigned int = 1);
720 #endif
721 
722 
723 
724 
725 
726 
unsigned int _grid_no
Definition: FloGrid.H:33
std::vector< double > _incoords
Definition: FloGrid.H:30
void swap(int &a, int &b)
Definition: buildface.cpp:88
FloGridBlock()
Definition: FloGrid.H:37
unsigned int jsize() const
Definition: FloGrid.H:144
FloGridBlock(const FloGridBlock &inblock)
Definition: FloGrid.H:55
int ReadNBlocks(int first, int nblocks)
Definition: FloGrid.H:319
std::vector< double > & Solution()
Definition: FloGrid.H:89
std::vector< double > _Tf
Definition: FloGrid.H:484
int ReadBlockSoln(std::istream &BlockSolnIn)
Definition: FloGrid.H:224
unsigned int _ng
Definition: FloGrid.H:31
const std::vector< double > & Solution() const
Definition: FloGrid.H:90
unsigned int NNodes() const
Definition: FloGrid.H:86
void CloseSolutionFile()
Definition: FloGrid.H:407
j indices k indices k
Definition: Indexing.h:6
std::ofstream & SolnFile()
Definition: FloGrid.H:408
Vector_n max(const Array_n_const &v1, const Array_n_const &v2)
Definition: Vector_n.h:354
double _time
Definition: FloGrid.H:281
void DestroyGrid()
Definition: FloGrid.H:71
std::vector< double > _pf
Definition: FloGrid.H:483
int ReadAllBlocks()
Definition: FloGrid.H:294
int ReadBlock(std::istream &BlockIn)
Definition: FloGrid.H:163
int WriteBlocks(std::ostream &Ouf)
Definition: FloGrid.H:424
unsigned int NTotalCells() const
Definition: FloGrid.H:88
double _resid
Definition: FloGrid.H:476
unsigned int * NCells()
Definition: FloGrid.H:146
int CreateSoln()
Definition: FloGrid.H:82
unsigned int NumCells() const
Definition: FloGrid.H:87
unsigned int ksize() const
Definition: FloGrid.H:145
const unsigned int * NCells() const
Definition: FloGrid.H:147
void SetGhostLayers(unsigned int n)
Definition: FloGrid.H:77
std::ofstream _solnfile
Definition: FloGrid.H:280
std::vector< FloGridBlock > _blocks
Definition: FloGrid.H:279
Definition: adj.h:203
unsigned int NGhostLayers() const
Definition: FloGrid.H:81
int WriteBlockSoln(std::ostream &Ouf)
Definition: FloGrid.H:259
unsigned int _ncells[3]
Definition: FloGrid.H:29
void MeshLayout()
Definition: FloGrid.H:109
std::vector< double > _disp
Definition: FloGrid.H:486
double UnknownNumber() const
Definition: FloGrid.H:293
void ResizeSoln(unsigned int i, unsigned int j, unsigned int k, unsigned int ng)
Definition: FloGrid.H:154
void SetGhostLayers(unsigned int n)
Definition: FloGrid.H:380
FloGridBlock & operator=(const FloGridBlock &inblock)
Definition: FloGrid.H:128
bool _unsteady
Definition: FloGrid.H:477
blockLoc i
Definition: read.cpp:79
void Resize(unsigned int ncell_i, unsigned int ncell_j, unsigned int ncell_k)
Definition: FloGrid.H:494
const std::vector< double > & Coords() const
Definition: FloGrid.H:162
std::vector< double > _af
Definition: FloGrid.H:485
const std::vector< FloGridBlock > & Blocks() const
Definition: FloGrid.H:292
const NT & n
void DestroyGrids()
Definition: FloGrid.H:374
std::string _casename
Definition: FloGrid.H:278
FloGrid()
Definition: FloGrid.H:284
std::vector< double > _rhouf
Definition: FloGrid.H:479
double _unknown_number
Definition: FloGrid.H:282
std::vector< double > _rhoEf
Definition: FloGrid.H:482
void FloLayout()
Definition: FloGrid.H:91
std::string Casename() const
Definition: FloGrid.H:289
Vector_n min(const Array_n_const &v1, const Array_n_const &v2)
Definition: Vector_n.h:346
void int int * nk
Definition: read.cpp:74
int WriteSolutionFile(const std::string &timestamp, double time, double unknown_number)
Definition: FloGrid.H:409
j indices j
Definition: Indexing.h:6
FloGridBlock(unsigned int i, unsigned int j, unsigned int k)
Definition: FloGrid.H:45
unsigned long time()
Get the value of a system timer with a millisecond precision.
Definition: CImg.h:4605
void CreateSolutions()
Definition: FloGrid.H:386
std::vector< double > _rhowf
Definition: FloGrid.H:481
unsigned int isize() const
Definition: FloGrid.H:143
FloVolumeSoln(unsigned int ncell_i=0, unsigned int ncell_j=0, unsigned int ncell_k=0)
Definition: FloGrid.H:488
int OpenSolutionFile(const std::string &timestamp, double time, double unknown_number)
Definition: FloGrid.H:392
double Time() const
Definition: FloGrid.H:290
double _current_time
Definition: FloGrid.H:475
void int int REAL REAL REAL *z blockDim dim * ni
Definition: read.cpp:77
void int * nj
Definition: read.cpp:74
void Resize(unsigned int i, unsigned int j, unsigned int k)
Definition: FloGrid.H:148
int BlockCount()
Definition: FloGrid.H:350
int ReadAllSolutions(const std::string &timestamp)
Definition: FloGrid.H:444
std::vector< double > & Coords()
Definition: FloGrid.H:161
bool flolayout
Definition: FloGrid.H:35
FloGrid(const std::string &casename)
Definition: FloGrid.H:286
std::vector< double > _rhovf
Definition: FloGrid.H:480
std::vector< double > _soln
Definition: FloGrid.H:32
std::vector< double > _rhof
Definition: FloGrid.H:478
std::vector< FloGridBlock > & Blocks()
Definition: FloGrid.H:291