Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
mantid
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mantidproject
mantid
Commits
d71eb698
Commit
d71eb698
authored
9 years ago
by
Peterson, Peter
Browse files
Options
Downloads
Patches
Plain Diff
Re #13987. Removing pylint warnings
parent
5920967c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tools/VTKConverter/VTKConvert.py
+14
-14
14 additions, 14 deletions
tools/VTKConverter/VTKConvert.py
with
14 additions
and
14 deletions
tools/VTKConverter/VTKConvert.py
+
14
−
14
View file @
d71eb698
...
@@ -10,19 +10,19 @@ def convertToVTU(infile, outpath):
...
@@ -10,19 +10,19 @@ def convertToVTU(infile, outpath):
planelist
=
[]
planelist
=
[]
npoints
=
0
npoints
=
0
for
line
in
datafile
:
for
line
in
datafile
:
numbers
=
line
.
split
()
;
numbers
=
line
.
split
()
if
(
len
(
numbers
)
!=
4
)
:
if
len
(
numbers
)
!=
4
:
continue
continue
if
(
npoints
==
0
)
:
if
npoints
==
0
:
curz
=
numbers
[
2
]
curz
=
numbers
[
2
]
if
(
numbers
[
2
]
!=
curz
)
:
if
numbers
[
2
]
!=
curz
:
datalist
.
append
(
planelist
)
datalist
.
append
(
planelist
)
curz
=
numbers
[
2
]
curz
=
numbers
[
2
]
planelist
=
[]
planelist
=
[]
planelist
.
append
(
numbers
)
planelist
.
append
(
numbers
)
npoints
+=
1
npoints
+=
1
# Append last set
# Append last set
datalist
.
append
(
planelist
)
datalist
.
append
(
planelist
)
datafile
.
close
()
datafile
.
close
()
...
@@ -43,7 +43,7 @@ def convertToVTU(infile, outpath):
...
@@ -43,7 +43,7 @@ def convertToVTU(infile, outpath):
piece
.
setAttribute
(
"
NumberOfPoints
"
,
str
(
npoints
))
piece
.
setAttribute
(
"
NumberOfPoints
"
,
str
(
npoints
))
piece
.
setAttribute
(
"
NumberOfCells
"
,
str
(
ncells
))
piece
.
setAttribute
(
"
NumberOfCells
"
,
str
(
ncells
))
# First the PointData element
# First the PointData element
point_data
=
doc
.
createElement
(
"
PointData
"
)
point_data
=
doc
.
createElement
(
"
PointData
"
)
piece
.
appendChild
(
point_data
)
piece
.
appendChild
(
point_data
)
point_data
.
setAttribute
(
"
Scalars
"
,
"
Intensity
"
)
point_data
.
setAttribute
(
"
Scalars
"
,
"
Intensity
"
)
...
@@ -59,7 +59,7 @@ def convertToVTU(infile, outpath):
...
@@ -59,7 +59,7 @@ def convertToVTU(infile, outpath):
txt
=
doc
.
createTextNode
(
str
(
point
[
3
]))
txt
=
doc
.
createTextNode
(
str
(
point
[
3
]))
data_array
.
appendChild
(
txt
)
data_array
.
appendChild
(
txt
)
# Now the Points element
# Now the Points element
points
=
doc
.
createElement
(
"
Points
"
)
points
=
doc
.
createElement
(
"
Points
"
)
piece
.
appendChild
(
points
)
piece
.
appendChild
(
points
)
...
@@ -111,12 +111,12 @@ def convertToVTU(infile, outpath):
...
@@ -111,12 +111,12 @@ def convertToVTU(infile, outpath):
txt
=
doc
.
createTextNode
(
"
4
"
)
txt
=
doc
.
createTextNode
(
"
4
"
)
data_array
.
appendChild
(
txt
)
data_array
.
appendChild
(
txt
)
#
#print doc.toprettyxml(newl="\n")
#print doc.toprettyxml(newl="\n")
shortname
=
infile
.
split
(
'
/
'
)
shortname
=
infile
.
split
(
'
/
'
)
name
=
outpath
+
shortname
[
len
(
shortname
)
-
1
]
+
"
.vtu
"
name
=
outpath
+
shortname
[
len
(
shortname
)
-
1
]
+
"
.vtu
"
fi
le
=
open
(
name
,
'
w
'
)
hand
le
=
open
(
name
,
'
w
'
)
doc
.
writexml
(
fi
le
,
newl
=
"
\n
"
)
doc
.
writexml
(
hand
le
,
newl
=
"
\n
"
)
fi
le
.
close
()
hand
le
.
close
()
del
datalist
del
datalist
del
planelist
del
planelist
...
@@ -160,6 +160,6 @@ def writeParallelVTU(files, prefix):
...
@@ -160,6 +160,6 @@ def writeParallelVTU(files, prefix):
# print doc.toprettyxml(newl="\n")
# print doc.toprettyxml(newl="\n")
filename
=
prefix
+
files
[
0
].
split
(
'
.
'
)[
0
]
+
"
.pvtu
"
filename
=
prefix
+
files
[
0
].
split
(
'
.
'
)[
0
]
+
"
.pvtu
"
# print filename
# print filename
fi
le
=
open
(
filename
,
'
w
'
)
hand
le
=
open
(
filename
,
'
w
'
)
doc
.
writexml
(
fi
le
,
newl
=
"
\n
"
)
doc
.
writexml
(
hand
le
,
newl
=
"
\n
"
)
fi
le
.
close
()
hand
le
.
close
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment