fpsmall Namespace Reference

Functions

def pr (*args)
 
def main (argv)
 

Variables

string usage
 

Function Documentation

◆ main()

def fpsmall.main (   argv)
16 def main(argv):
17 
18  if len(argv) < 2 or len(argv) > 3:
19  pr(usage)
20  return 1
21 
22  filename = argv[1]
23 
24  if len(argv) > 2:
25  small = float(argv[2])
26  else:
27  small = 1e-3
28 
29  f = open(filename)
30  lines = f.readlines()
31  f.close()
32 
33  entries = sum([l.strip().split() for l in lines], [])
34  floats = [float(e) for e in entries]
35 
36  exit_code = 0
37  for fl in floats:
38  if fl > small:
39  pr("Value too large: ", str(fl))
40  exit_code = 2
41 
42  return exit_code
43 
44 
str
Definition: compute_granudrum_aor.py:141
def pr(*args)
Definition: fpsmall.py:11
def main(argv)
Definition: fpsmall.py:16
void split(const DoubleVector &in_vector, Vector< DoubleVector * > &out_vector_pt)
Definition: double_vector.cc:1413

References pr(), oomph::DoubleVectorHelpers.split(), and compute_granudrum_aor.str.

◆ pr()

def fpsmall.pr ( args)
Compatible print-like function.
11 def pr(*args):
12  """Compatible print-like function."""
13  sys.stdout.write(" ".join(args))
14  sys.stdout.write("\n")
15 

Referenced by main(), and my_problem.set_ParticleRadius().

Variable Documentation

◆ usage

string fpsmall.usage
Initial value:
1 = """Test whether all floating point values in a file are small.
2 
3 fpsmall [filename] [maximum allowed value]
4 """