HyPar  1.0
Finite-Difference Hyperbolic-Parabolic PDE Solver on Cartesian Grids
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
SparseGridsMiscFuncs.cpp File Reference

Miscellaneous functions needed for a sparse grids simulation. More...

#include <cfloat>
#include <limits>
#include <math.h>
#include <sparse_grids_simulation.h>
#include <arrayfunctions.h>
#include <mathfunctions.h>
#include <io_cpp.h>
#include <std_vec_ops.h>
#include <Python.h>

Go to the source code of this file.

Functions

void IncrementFilenameIndex (char *, int)
 

Detailed Description

Miscellaneous functions needed for a sparse grids simulation.

Author
Debojyoti Ghosh, John Loffeld, Lee Ricketson

Definition in file SparseGridsMiscFuncs.cpp.

Function Documentation

void IncrementFilenameIndex ( char *  f,
int  len 
)
  Increment the output filename of the form op_nnnnn.dat by 1,

i.e., the number represented by the string nnnnn is incremented by 1.

Increment a character string representing an integer by 1. For example: "00002" -> "00003"; "3421934" -> "3421935"; "999" -> "000". The string can be of arbitrary length.

Parameters
fCharacter string representing the integer
lenLength of the string

Definition at line 46 of file IncrementFilename.c.

50 {
51  int i;
52  for (i=len-1; i>=0; i--) {
53  if (f[i] == '9') {
54  f[i] = '0';
55  if (!i) fprintf(stderr,"Warning: file increment hit max limit. Resetting to zero.\n");
56  } else {
57  f[i]++;
58  break;
59  }
60  }
61 }