Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
writeflo.cpp File Reference
#include <stdio.h>
#include "face.h"
Include dependency graph for writeflo.cpp:

Go to the source code of this file.

Classes

class  bcRec
 
class  bcList
 

Functions

void writeHeader (FILE *out, int nBlocks, int nPEs)
 
string getSpan (const blockSpan &s)
 
void writeBlock (FILE *out, const bcList &bc, const block *b)
 
const char * writeFlo (vector< block * > &blocks, int nPEs, const char *inBcs, const char *outFlo)
 

Function Documentation

string getSpan ( const blockSpan s)

Definition at line 159 of file writeflo.cpp.

References blockSpan::end, and blockSpan::start.

Referenced by externalBCpatch::writeFlo(), and internalBCpatch::writeFlo().

160 {
161  char buf[200];
162  sprintf(buf," %d %d %d %d %d %d",
163  1+s.start[0],s.end[0],
164  1+s.start[1],s.end[1],
165  1+s.start[2],s.end[2]);
166  return buf;
167 }
blockLoc start
Definition: gridutil.h:155
blockLoc end
Definition: gridutil.h:156

Here is the caller graph for this function:

void writeBlock ( FILE *  out,
const bcList bc,
const block b 
)

Definition at line 198 of file writeflo.cpp.

References d, block::face2name, block::getBlockNumber(), block::getDim(), block::getFace(), block::getOriginalNumber(), face::getPatches(), bcList::lookup(), and block::nFaces.

Referenced by writeFlo(), and writeTop().

198  {
199  int blockNo=b->getBlockNumber()+1;
200  fprintf(out,
201  "%d %d 1 ! BLOCK %d (Split from source block %d) ======================\n"
202  "\n",
203  blockNo,blockNo,blockNo,b->getOriginalNumber()+1);
204  blockDim d=b->getDim();
205  fprintf(out,
206  "%d %d %d ! Block size (ni, nj, nk)\n",
207  d[0],d[1],d[2]);
208  //Get the fluid initial conditions
209  fprintf(out,"%s\n",bc.lookup(-1,"").c_str());
210 
211  //Loop over the faces
212  for (int f=0;f<block::nFaces;f++) {
213  const vector<patch *> &patches=b->getFace(f).getPatches();
214  int nPatches=patches.size();
215 
216  fprintf(out,
217  "%d ! Block %d, Face (%s) has %d patch\n",
218  nPatches,blockNo,block::face2name[f],nPatches);
219  //Loop over the patches
220  for (int p=0;p<nPatches;p++) {
221  patches[p]->writeFlo(out,bc);
222  }
223  fprintf(out,"\n");
224  }
225  fprintf(out,
226  "ENDBBC\n"
227  "\n");
228 }
int getOriginalNumber(void) const
Definition: adj.h:220
const vector< patch * > & getPatches(void) const
Definition: face.h:145
const NT & d
string lookup(int bcNo, string insert) const
Definition: writeflo.cpp:133
static const char * face2name[nFaces]
Definition: adj.h:236
const blockDim & getDim(void) const
Definition: adj.h:222
int getBlockNumber(void) const
Definition: adj.h:219
face & getFace(int faceNo)
Definition: adj.h:248

Here is the call graph for this function:

Here is the caller graph for this function:

const char* writeFlo ( vector< block * > &  blocks,
int  nPEs,
const char *  inBcs,
const char *  outFlo 
)

Definition at line 230 of file writeflo.cpp.

References cimg_library::cimg::fclose(), cimg_library::cimg::fopen(), writeBlock(), and writeHeader().

Referenced by main().

234 {
235  FILE *bcs=fopen(inBcs,"r");
236  if (bcs==NULL) {
237  char *ret=(char *)malloc(sizeof(char)*1000);
238  sprintf(ret,"Couldn't open input .bc file '%s'!\n",inBcs);
239  return ret;
240  }
241  bcList bc(bcs);
242  fclose(bcs);
243 
244  FILE *flo=fopen(outFlo,"w");
245  if (flo==NULL) return "Couldn't open output .flo file!\n";
246 
247  //Print the .flo file header
248  int nBlocks=blocks.size();
249  writeHeader(flo,nBlocks,nPEs);
250 
251  //Print out each block
252  for (int bn=0;bn<nBlocks;bn++)
253  writeBlock(flo,bc,blocks[bn]);
254  fclose(flo);
255  return NULL; //Everything worked!
256 }
void writeBlock(FILE *out, const bcList &bc, const block *b)
Definition: writeflo.cpp:198
int fclose(std::FILE *file)
Close a file, and check for possible errors.
Definition: CImg.h:5507
void writeHeader(FILE *out, int nBlocks, int nPEs)
Definition: writeflo.cpp:148
std::FILE * fopen(const char *const path, const char *const mode)
Open a file, and check for possible errors.
Definition: CImg.h:5494

Here is the call graph for this function:

Here is the caller graph for this function:

void writeHeader ( FILE *  out,
int  nBlocks,
int  nPEs 
)

Definition at line 148 of file writeflo.cpp.

Referenced by writeFlo().

148  {
149  fprintf(out,
150  "%d %d ! ndom, nproc\n"
151  "\n"
152  "PROC_MAP_AUTO\n"
153  "\n",
154  nBlocks,nPEs);
155 }

Here is the caller graph for this function: