63 std::vector<double>::const_iterator ii = inblock.
_incoords.begin();
64 std::vector<double>::iterator
ni =
_incoords.begin();
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();
101 for(
int i = 0;
i < nnodes;
i++){
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();
119 for(
int i = 0;
i < nnodes;
i++){
136 std::vector<double>::const_iterator ii = inblock.
_incoords.begin();
137 std::vector<double>::iterator
ni =
_incoords.begin();
148 void Resize(
unsigned int i,
unsigned int j,
unsigned int k)
154 void ResizeSoln(
unsigned int i,
unsigned int j,
unsigned int k,
unsigned int ng)
158 _soln.resize(5*((i+(2*ng))*(j+(2*ng))*(k+(2*ng))));
166 std::getline(BlockIn,line);
169 std::istringstream Istr(line);
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;
181 unsigned int number_of_nodes = (ni+1)*(nj+1)*(nk+1);
188 std::vector<double>::iterator ici =
_incoords.begin();
191 std::getline(BlockIn,line);
195 unsigned int ncount = 0;
197 double *minval = NULL;
198 double *maxval = NULL;
199 double value = *ici++;
200 if(ncount < number_of_nodes){
204 else if(ncount < 2*number_of_nodes){
227 std::getline(BlockSolnIn,line);
230 std::istringstream Istr(line);
231 unsigned int grid_no = 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;
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;
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());
253 std::vector<double>::iterator ici =
_soln.begin();
254 while(ici !=
_soln.end())
255 BlockSolnIn >> *ici++;
256 std::getline(BlockSolnIn,line);
261 std::ostringstream Ostr;
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++ <<
" ";
270 return(Ostr.str().size());
296 std::string sourcegridfile(
_casename+
".grda_0.00000E-00");
300 Inf.open(sourcegridfile.c_str());
302 std::cout <<
"FloGrid::ReadAllBlocks: Could not open source grid file, "
303 << sourcegridfile << std::endl;
307 std::string ftimestamp;
308 std::getline(Inf,ftimestamp);
321 std::string sourcegridfile(
_casename+
".grda_0.00000E-00");
325 Inf.open(sourcegridfile.c_str());
327 std::cout <<
"FloGrid::ReadAllBlocks: Could not open source grid file, "
328 << sourcegridfile << std::endl;
332 std::string ftimestamp;
333 std::getline(Inf,ftimestamp);
340 while(n < (first + nblocks)){
352 std::string sourcegridfile(
_casename+
".grda_0.00000E-00");
353 std::cout <<
"Reading grid file: " << sourcegridfile << std::endl;
356 Inf.open(sourcegridfile.c_str());
358 std::cout <<
"FloGrid::ReadAllBlocks: Could not open source grid file, "
359 << sourcegridfile << std::endl;
363 std::string ftimestamp;
364 std::getline(Inf,ftimestamp);
376 std::vector<FloGridBlock>::iterator fgbi =
_blocks.begin();
378 fgbi++->DestroyGrid();
382 std::vector<FloGridBlock>::iterator fgbi =
_blocks.begin();
388 std::vector<FloGridBlock>::iterator fgbi =
_blocks.begin();
390 fgbi++->CreateSoln();
394 std::string solnfile(
_casename+
".sola_"+timestamp);
399 std::cout <<
"FloGrid::OpenSolutionFile Could not open source soln file, "
400 << solnfile << std::endl;
403 _solnfile << std::scientific << std::setprecision(16);
404 _solnfile << time <<
"\t" << unknown_number << std::endl;
413 std::vector<FloGridBlock>::iterator fgbi =
_blocks.begin();
439 std::vector<FloGridBlock>::iterator fgbi =
_blocks.begin();
441 datasize += (fgbi++->WriteBlockSoln(Ouf));
446 std::string sourcesolnfile(
_casename+
".sola_"+timestamp);
450 Inf.open(sourcesolnfile.c_str());
452 std::cout <<
"FloGrid::ReadAllSoln: Could not open source soln file, "
453 << sourcesolnfile << std::endl;
457 std::string ftimestamp;
458 std::getline(Inf,ftimestamp);
459 std::istringstream Istr(ftimestamp);
461 std::vector<FloGridBlock>::iterator fgbi =
_blocks.begin();
463 fgbi++->ReadBlockSoln(Inf);
464 if(!Inf && (fgbi !=
_blocks.end()))
488 FloVolumeSoln(
unsigned int ncell_i=0,
unsigned int ncell_j=0,
unsigned int ncell_k=0)
491 Resize(ncell_i,ncell_j,ncell_k);
494 Resize(
unsigned int ncell_i,
unsigned int ncell_j,
unsigned int ncell_k)
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);
std::vector< double > _incoords
void swap(int &a, int &b)
unsigned int jsize() const
FloGridBlock(const FloGridBlock &inblock)
int ReadNBlocks(int first, int nblocks)
std::vector< double > & Solution()
std::vector< double > _Tf
int ReadBlockSoln(std::istream &BlockSolnIn)
const std::vector< double > & Solution() const
unsigned int NNodes() const
std::ofstream & SolnFile()
Vector_n max(const Array_n_const &v1, const Array_n_const &v2)
std::vector< double > _pf
int ReadBlock(std::istream &BlockIn)
int WriteBlocks(std::ostream &Ouf)
unsigned int NTotalCells() const
unsigned int NumCells() const
unsigned int ksize() const
const unsigned int * NCells() const
void SetGhostLayers(unsigned int n)
std::vector< FloGridBlock > _blocks
unsigned int NGhostLayers() const
int WriteBlockSoln(std::ostream &Ouf)
std::vector< double > _disp
double UnknownNumber() const
void ResizeSoln(unsigned int i, unsigned int j, unsigned int k, unsigned int ng)
void SetGhostLayers(unsigned int n)
FloGridBlock & operator=(const FloGridBlock &inblock)
void Resize(unsigned int ncell_i, unsigned int ncell_j, unsigned int ncell_k)
const std::vector< double > & Coords() const
std::vector< double > _af
const std::vector< FloGridBlock > & Blocks() const
std::vector< double > _rhouf
std::vector< double > _rhoEf
std::string Casename() const
Vector_n min(const Array_n_const &v1, const Array_n_const &v2)
int WriteSolutionFile(const std::string ×tamp, double time, double unknown_number)
FloGridBlock(unsigned int i, unsigned int j, unsigned int k)
unsigned long time()
Get the value of a system timer with a millisecond precision.
std::vector< double > _rhowf
unsigned int isize() const
FloVolumeSoln(unsigned int ncell_i=0, unsigned int ncell_j=0, unsigned int ncell_k=0)
int OpenSolutionFile(const std::string ×tamp, double time, double unknown_number)
void int int REAL REAL REAL *z blockDim dim * ni
void Resize(unsigned int i, unsigned int j, unsigned int k)
int ReadAllSolutions(const std::string ×tamp)
std::vector< double > & Coords()
FloGrid(const std::string &casename)
std::vector< double > _rhovf
std::vector< double > _soln
std::vector< double > _rhof
std::vector< FloGridBlock > & Blocks()