Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Sebastian Steinlechner
pykat
Commits
46218f5a
Commit
46218f5a
authored
Feb 20, 2014
by
Andreas Freise
Browse files
make block writing a bit more readable.
parent
5a013138
Changes
1
Hide whitespace changes
Inline
Side-by-side
pykat/finesse.py
View file @
46218f5a
...
@@ -393,14 +393,14 @@ class kat(object):
...
@@ -393,14 +393,14 @@ class kat(object):
if
values
[
1
]
==
"FTblock"
:
if
values
[
1
]
==
"FTblock"
:
newTag
=
values
[
2
]
newTag
=
values
[
2
]
if
self
.
__currentTag
!=
None
and
newTag
!=
self
.
__currentTag
:
if
self
.
__currentTag
!=
None
and
self
.
__currentTag
!=
NO_BLOCK
:
warnings
.
warn
(
"found block {0} before block {1} ended"
.
format
(
newTag
,
self
.
__currentTag
))
warnings
.
warn
(
"found block {0} before block {1} ended"
.
format
(
newTag
,
self
.
__currentTag
))
if
newTag
in
self
.
__blocks
:
if
newTag
in
self
.
__blocks
:
raise
pkex
.
BasePyKatException
(
"Block `{0}` has already been read"
.
format
(
newTag
))
raise
pkex
.
BasePyKatException
(
"Block `{0}` has already been read"
.
format
(
newTag
))
self
.
__blocks
[
newTag
]
=
Block
(
newTag
)
# create new list to store all references to components in block
self
.
__blocks
[
newTag
]
=
Block
(
newTag
)
# create new list to store all references to components in block
self
.
__currentTag
=
newTag
self
.
__currentTag
=
newTag
if
values
[
1
]
==
"FTend"
:
if
values
[
1
]
==
"FTend"
:
self
.
__currentTag
=
NO_BLOCK
self
.
__currentTag
=
NO_BLOCK
...
@@ -524,7 +524,7 @@ class kat(object):
...
@@ -524,7 +524,7 @@ class kat(object):
raise
pkex
.
BasePyKatException
(
"pdtype command `{0}` is incorrect."
.
format
(
line
))
raise
pkex
.
BasePyKatException
(
"pdtype command `{0}` is incorrect."
.
format
(
line
))
self
.
__currentTag
=
NO_BLOCK
self
.
__currentTag
=
NO_BLOCK
def
saveScript
(
self
,
filename
=
None
):
def
saveScript
(
self
,
filename
=
None
):
"""
"""
Saves the current kat object to a Finesse input file
Saves the current kat object to a Finesse input file
...
@@ -812,11 +812,12 @@ class kat(object):
...
@@ -812,11 +812,12 @@ class kat(object):
import
datetime
import
datetime
strtoday
=
datetime
.
datetime
.
now
()
strtoday
=
datetime
.
datetime
.
now
()
out
.
append
(
strtoday
.
strftime
(
"%% Generated by PyKat %d.%m.%Y %H:%M:%S
\n
"
)
)
out
.
append
(
strtoday
.
strftime
(
"%% Generated by PyKat %d.%m.%Y %H:%M:%S
\n
"
)
)
for
key
in
self
.
__blocks
:
for
key
in
self
.
__blocks
:
objs
=
self
.
__blocks
[
key
].
contents
objs
=
self
.
__blocks
[
key
].
contents
if
key
!=
NO_BLOCK
:
out
.
append
(
"
\n
"
)
if
key
!=
NO_BLOCK
and
np
.
size
(
objs
)
>
0
:
out
.
append
(
"%%% FTblock "
+
key
+
"
\n
"
)
out
.
append
(
"%%% FTblock "
+
key
+
"
\n
"
)
for
obj
in
objs
:
for
obj
in
objs
:
...
@@ -833,7 +834,7 @@ class kat(object):
...
@@ -833,7 +834,7 @@ class kat(object):
else
:
else
:
out
.
append
(
txt
+
"
\n
"
)
out
.
append
(
txt
+
"
\n
"
)
if
key
!=
NO_BLOCK
:
if
key
!=
NO_BLOCK
and
np
.
size
(
objs
)
>
0
:
out
.
append
(
"%%% FTend "
+
key
+
"
\n
"
)
out
.
append
(
"%%% FTend "
+
key
+
"
\n
"
)
# now loop through all the nodes and get any gauss commands
# now loop through all the nodes and get any gauss commands
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment