ComputeWallTorque Namespace Reference

Functions

def main ()
 

Function Documentation

◆ main()

def ComputeWallTorque.main ( )
23 def main():
24 
25  # the user gives the base of the restart-file name
26  if (len(sys.argv)<3):
27  raise(Exception("This code needs at least two arguments, e.g. \n\t./ConvertRestartToData.py name.restart wall_id [wall_id_end]"))
28 
29  wall_id_begin = int(sys.argv[2])
30  if (len(sys.argv)>3):
31  wall_id_end = int(sys.argv[3])
32  else:
33  wall_id_end = wall_id_begin
34 
35  # name data and fstat
36  restart_file_name = sys.argv[1]
37  data_file_name = restart_file_name.replace(".restart",".data")
38  fstat_file_name = restart_file_name.replace(".restart",".fstat")
39 
40  # open the in- and output files
41  data_file = open(data_file_name, 'w')
42  fstat_file = open(fstat_file_name, 'w')
43  restart_file = open(restart_file_name)
44  print("Reading %s" % restart_file_name)
45  restart_file = restart_file.readlines()
46 
47  #look for number of particles and interactions, get line with first interaction
48  i = 0
49  while not restart_file[i].startswith('Walls '): i += 1
50  num_walls = int(restart_file[i].split()[1])
51  index_walls = i + 1
52  index_walls_end = index_walls + num_walls
53 
54  wall0 = restart_file[index_walls].split()
55  torque_index = wall0.index('torque')
56  torque_x = 0;
57  torque_y = 0;
58  torque_z = 0;
59  # Read all walls
60  for i in range(index_walls, index_walls_end):
61  wall = restart_file[i].split()
62  wall_id = int(wall[2])
63  if wall_id<=wall_id_end and wall_id>=wall_id_begin:
64  torque_x += float(wall[torque_index+1])
65  torque_y += float(wall[torque_index+2])
66  torque_z += float(wall[torque_index+3])
67  print("Torque %r %r %r" % (torque_x,torque_y,torque_z))
68 
return int(ret)+1
def main()
Definition: ComputeWallTorque.py:23
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet print(const Packet &a)
Definition: GenericPacketMath.h:1166
void split(const DoubleVector &in_vector, Vector< DoubleVector * > &out_vector_pt)
Definition: double_vector.cc:1413

References int(), Eigen::internal.print(), and oomph::DoubleVectorHelpers.split().