Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FloGrid Class Reference

#include <FloGrid.H>

Collaboration diagram for FloGrid:

Public Member Functions

 FloGrid ()
 
 FloGrid (const std::string &casename)
 
std::string Casename () const
 
double Time () const
 
std::vector< FloGridBlock > & Blocks ()
 
const std::vector< FloGridBlock > & Blocks () const
 
double UnknownNumber () const
 
int ReadAllBlocks ()
 
int ReadNBlocks (int first, int nblocks)
 
int BlockCount ()
 
void DestroyGrids ()
 
void SetGhostLayers (unsigned int n)
 
void CreateSolutions ()
 
int OpenSolutionFile (const std::string &timestamp, double time, double unknown_number)
 
void CloseSolutionFile ()
 
std::ofstream & SolnFile ()
 
int WriteSolutionFile (const std::string &timestamp, double time, double unknown_number)
 
int WriteBlocks (std::ostream &Ouf)
 
int ReadAllSolutions (const std::string &timestamp)
 

Protected Attributes

std::string _casename
 
std::vector< FloGridBlock_blocks
 
std::ofstream _solnfile
 
double _time
 
double _unknown_number
 

Detailed Description

Definition at line 276 of file FloGrid.H.

Constructor & Destructor Documentation

FloGrid ( )
inline

Definition at line 284 of file FloGrid.H.

References _blocks, and _time.

284  : _casename("")
285  { _blocks.resize(0); _time=0.0;};
double _time
Definition: FloGrid.H:281
std::vector< FloGridBlock > _blocks
Definition: FloGrid.H:279
std::string _casename
Definition: FloGrid.H:278
FloGrid ( const std::string &  casename)
inline

Definition at line 286 of file FloGrid.H.

References _blocks, and _time.

287  : _casename(casename)
288  {_blocks.resize(0); _time=0.0;};
double _time
Definition: FloGrid.H:281
std::vector< FloGridBlock > _blocks
Definition: FloGrid.H:279
std::string _casename
Definition: FloGrid.H:278

Member Function Documentation

int BlockCount ( )
inline

Definition at line 350 of file FloGrid.H.

References _casename, n, and FloGridBlock::ReadBlock().

Referenced by main().

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  };
int ReadBlock(std::istream &BlockIn)
Definition: FloGrid.H:163
Definition: adj.h:203
const NT & n
std::string _casename
Definition: FloGrid.H:278

Here is the call graph for this function:

Here is the caller graph for this function:

std::vector<FloGridBlock>& Blocks ( )
inline

Definition at line 291 of file FloGrid.H.

References _blocks.

Referenced by main().

291 { return (_blocks); };
std::vector< FloGridBlock > _blocks
Definition: FloGrid.H:279

Here is the caller graph for this function:

const std::vector<FloGridBlock>& Blocks ( ) const
inline

Definition at line 292 of file FloGrid.H.

References _blocks.

292 { return (_blocks); };
std::vector< FloGridBlock > _blocks
Definition: FloGrid.H:279
std::string Casename ( ) const
inline

Definition at line 289 of file FloGrid.H.

References _casename.

289 { return (_casename); };
std::string _casename
Definition: FloGrid.H:278
void CloseSolutionFile ( )
inline

Definition at line 407 of file FloGrid.H.

References _solnfile.

Referenced by main(), and WriteSolutionFile().

407 { _solnfile.close(); };
std::ofstream _solnfile
Definition: FloGrid.H:280

Here is the caller graph for this function:

void CreateSolutions ( )
inline

Definition at line 386 of file FloGrid.H.

References _blocks.

Referenced by main().

387  {
388  std::vector<FloGridBlock>::iterator fgbi = _blocks.begin();
389  while(fgbi != _blocks.end())
390  fgbi++->CreateSoln();
391  };
std::vector< FloGridBlock > _blocks
Definition: FloGrid.H:279

Here is the caller graph for this function:

void DestroyGrids ( )
inline

Definition at line 374 of file FloGrid.H.

References _blocks.

375  {
376  std::vector<FloGridBlock>::iterator fgbi = _blocks.begin();
377  while(fgbi != _blocks.end())
378  fgbi++->DestroyGrid();
379  };
std::vector< FloGridBlock > _blocks
Definition: FloGrid.H:279
int OpenSolutionFile ( const std::string &  timestamp,
double  time,
double  unknown_number 
)
inline

Definition at line 392 of file FloGrid.H.

References _casename, and _solnfile.

Referenced by main(), and WriteSolutionFile().

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  };
std::ofstream _solnfile
Definition: FloGrid.H:280
std::string _casename
Definition: FloGrid.H:278
unsigned long time()
Get the value of a system timer with a millisecond precision.
Definition: CImg.h:4605

Here is the caller graph for this function:

int ReadAllBlocks ( )
inline

Definition at line 294 of file FloGrid.H.

References _blocks, _casename, and FloGridBlock::ReadBlock().

Referenced by main().

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  };
int ReadBlock(std::istream &BlockIn)
Definition: FloGrid.H:163
std::vector< FloGridBlock > _blocks
Definition: FloGrid.H:279
Definition: adj.h:203
std::string _casename
Definition: FloGrid.H:278

Here is the call graph for this function:

Here is the caller graph for this function:

int ReadAllSolutions ( const std::string &  timestamp)
inline

Definition at line 444 of file FloGrid.H.

References _blocks, _casename, _time, and _unknown_number.

Referenced by main().

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  };
double _time
Definition: FloGrid.H:281
std::vector< FloGridBlock > _blocks
Definition: FloGrid.H:279
std::string _casename
Definition: FloGrid.H:278
double _unknown_number
Definition: FloGrid.H:282

Here is the caller graph for this function:

int ReadNBlocks ( int  first,
int  nblocks 
)
inline

Definition at line 319 of file FloGrid.H.

References _blocks, _casename, n, and FloGridBlock::ReadBlock().

Referenced by main().

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)){
341  FloGridBlock block;
342  if(block.ReadBlock(Inf) == 0){
343  _blocks.push_back(block);
344  }
345  n++;
346  }
347  Inf.close();
348  return(0);
349  };
int ReadBlock(std::istream &BlockIn)
Definition: FloGrid.H:163
std::vector< FloGridBlock > _blocks
Definition: FloGrid.H:279
Definition: adj.h:203
const NT & n
std::string _casename
Definition: FloGrid.H:278

Here is the call graph for this function:

Here is the caller graph for this function:

void SetGhostLayers ( unsigned int  n)
inline

Definition at line 380 of file FloGrid.H.

References _blocks.

Referenced by main().

381  {
382  std::vector<FloGridBlock>::iterator fgbi = _blocks.begin();
383  while(fgbi != _blocks.end())
384  fgbi++->SetGhostLayers(n);
385  };
std::vector< FloGridBlock > _blocks
Definition: FloGrid.H:279
void SetGhostLayers(unsigned int n)
Definition: FloGrid.H:380
const NT & n

Here is the caller graph for this function:

std::ofstream& SolnFile ( )
inline

Definition at line 408 of file FloGrid.H.

References _solnfile.

Referenced by main().

408 { return (_solnfile); };
std::ofstream _solnfile
Definition: FloGrid.H:280

Here is the caller graph for this function:

double Time ( ) const
inline

Definition at line 290 of file FloGrid.H.

References _time.

Referenced by main().

290 { return (_time); };
double _time
Definition: FloGrid.H:281

Here is the caller graph for this function:

double UnknownNumber ( ) const
inline

Definition at line 293 of file FloGrid.H.

References _unknown_number.

Referenced by main().

293 { return (_unknown_number); };
double _unknown_number
Definition: FloGrid.H:282

Here is the caller graph for this function:

int WriteBlocks ( std::ostream &  Ouf)
inline

Definition at line 424 of file FloGrid.H.

References _blocks.

Referenced by main().

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  };
std::vector< FloGridBlock > _blocks
Definition: FloGrid.H:279

Here is the caller graph for this function:

int WriteSolutionFile ( const std::string &  timestamp,
double  time,
double  unknown_number 
)
inline

Definition at line 409 of file FloGrid.H.

References _blocks, _solnfile, CloseSolutionFile(), and OpenSolutionFile().

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  };
void CloseSolutionFile()
Definition: FloGrid.H:407
std::ofstream _solnfile
Definition: FloGrid.H:280
std::vector< FloGridBlock > _blocks
Definition: FloGrid.H:279
unsigned long time()
Get the value of a system timer with a millisecond precision.
Definition: CImg.h:4605
int OpenSolutionFile(const std::string &timestamp, double time, double unknown_number)
Definition: FloGrid.H:392

Here is the call graph for this function:

Member Data Documentation

std::string _casename
protected
std::ofstream _solnfile
protected

Definition at line 280 of file FloGrid.H.

Referenced by CloseSolutionFile(), OpenSolutionFile(), SolnFile(), and WriteSolutionFile().

double _time
protected

Definition at line 281 of file FloGrid.H.

Referenced by FloGrid(), ReadAllSolutions(), and Time().

double _unknown_number
protected

Definition at line 282 of file FloGrid.H.

Referenced by ReadAllSolutions(), and UnknownNumber().


The documentation for this class was generated from the following file: