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

Go to the source code of this file.

Functions

void checkError (const char *errCode)
 
void printUsage (const char *why)
 
int main (int argc, char *argv[])
 

Variables

makefloParam parameters
 

Function Documentation

void checkError ( const char *  errCode)

Definition at line 62 of file makemblock.cpp.

62  {
63  if (errCode==NULL) return; //No problem
64  fprintf(stderr,"FATAL ERROR! %s\n",errCode);
65  exit(1);
66 }
int main ( int  argc,
char *  argv[] 
)

Definition at line 93 of file makemblock.cpp.

References blocks, buildFaces(), checkError(), printUsage(), blockConsumer::read(), readBoundaries(), replaceExtention(), makefloParam::skipAxis, splitBlocks(), makefloParam::topologyOnly, and writeMblock().

94 {
95 //Parse the command line arguments
96  if (argc<4) printUsage("Not enough command-line arguments");
97  int curArg=1;
98 
99  while (argv[curArg][0]=='-') {
100  if (0==strcmp(argv[curArg],"-2D")) {
101  parameters.skipAxis=2; //Don't bother about the z axis.
102  curArg++;
103  }
104  else if (0==strcmp(argv[curArg],"-top")) {
105  parameters.topologyOnly=1; //Only write .bblk
106  curArg++;
107  }
108  else
109  printUsage("Unrecongized parameter");
110  }
111 
112  if (curArg+3!=argc) printUsage("Too many arguments");
113  const char *inMesh=argv[curArg+0];
114  string inpFile=replaceExtention(argv[curArg+0],".inp");
115  int nPieces=atoi(argv[curArg+1]);
116  const char *outMesh=argv[curArg+2];
117 
118  vector<block *> blocks;
119 
120 //Read the blocks of the mesh
121  { //<- scoping block so r's destructor gets called
122  blockReader r(blocks);
123  checkError(r.read(inMesh));
124  printf("Mesh file read successfully.\n");
125  }
126 
127 //Read the boundary conditions
128  checkError(readBoundaries(blocks,inpFile.c_str()));
129  printf("Boundary conditions read successfully.\n");
130 
131 //Split the blocks (for greater parallelism)
132  checkError(splitBlocks(blocks,nPieces));
133  printf("Split blocks for %d PEs (%d blocks generated).\n",nPieces,blocks.size());
134 
135 //Build the block faces & associate all shared nodes
136  buildFaces(blocks,false);
137  printf("Nodes matched successfully.\n");
138 
139 //Write out the blocks
140  checkError(writeMblock(blocks,outMesh));
141  printf("Block files written successfully\n");
142  return 0;
143 }
int skipAxis
Definition: makeflo.h:92
const char * writeMblock(vector< block * > &blocks, const char *outMblock)
int topologyOnly
Definition: makeflo.h:93
void printUsage(const char *why)
Definition: makeflo.cpp:68
string replaceExtention(const string &a, const string &newSuffix)
void checkError(const char *errCode)
Definition: makeflo.cpp:62
const char * splitBlocks(vector< block * > &blocks, int nPieces)
Definition: split.cpp:205
bool blocks
Input data is block-structured grid.
Definition: hdf2pltV2.C:51
makefloParam parameters
Definition: makeflo.cpp:101
const char * readBoundaries(vector< block * > &blocks, const char *inMesh)
Definition: readinp.cpp:135
void buildFaces(vector< block * > &blocks, bool buildTypeTwo)
Definition: buildface.cpp:123

Here is the call graph for this function:

void printUsage ( const char *  why)

Definition at line 68 of file makemblock.cpp.

References MAKEFLO_VERSION.

69 {
70  printf("Usage: makemblock \n"
71  " <.grd, or .msh mesh; and .inp and .bc file> \n"
72  " <# output chunks> <output file prefix>\n"
73  " Makemblock reads a mesh (first parameter) and boundary condition\n"
74  "(.inp) list, partitions the mesh into the requested number of\n"
75  "chunks, and writes out mblock input files.\n"
76  " The mesh formats supported are:\n"
77  "<*.grd> A Gridgen ASCII double-precision mesh description\n"
78  "<*.msh> A double-precision binary Rocflo mesh file\n"
79  "<*.hdf> A double-precision 3D HDF mesh file\n"
80  "<*.mblk> A double-precision 3D Mblock mesh file\n"
81  " When the mesh consists of multiple files, give only the name of\n"
82  "the first file (e.g., 'tstflo_001.hdf'). The number of blocks and\n"
83  "numeric format will be automatically determined.\n"
84  "Part of the Charm++ Tools. Version " MAKEFLO_VERSION "\n"
85  );
86  if (why!=NULL)
87  printf("Exiting> %s\n",why);
88  exit(1);
89 }
#define MAKEFLO_VERSION
Definition: makeflo.h:65

Variable Documentation

makefloParam parameters

Definition at line 91 of file makemblock.cpp.