Skip to content

Commit 3f33296

Browse files
committed
mdpa working with exponential notation
1 parent 28bc742 commit 3f33296

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

pygem/mdpahandler.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ def parse(self, filename):
4444
if line.startswith('End Nodes'):
4545
break
4646
else:
47+
line = line.replace('D', 'E')
4748
li = []
4849
for t in line.split()[1:]:
4950
try:
@@ -79,11 +80,18 @@ def write(self, mesh_points, filename):
7980
if num == index + 1:
8081
if line.startswith('End Nodes'):
8182
index = -9
83+
output_file.write(line)
8284
else:
85+
output_file.write(3 * ' ' + '{:5d}'.format(i+1))
8386
for j in range(0, 3):
84-
line = (line[:5 + 15 * (j)] +
85-
'{:15.10f}'.format(mesh_points[i][j]) +
86-
line[5 + 15 * (j + 1):])
87+
output_file.write(3 * ' ' + '{:.16E}'.format(
88+
mesh_points[i][j]))
89+
output_file.write('\n')
90+
#
91+
# line = (line[:5 + 15 * (j)] +
92+
# '{:15.10f}'.format(mesh_points[i][j]) +
93+
# line[5 + 15 * (j + 1):])
8794
i += 1
8895
index = num
89-
output_file.write(line)
96+
else:
97+
output_file.write(line)

0 commit comments

Comments
 (0)