Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CardMech
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
KIT
Mpp
CardMech
Commits
6963f6e8
Commit
6963f6e8
authored
3 years ago
by
jonathan.froehlich
Browse files
Options
Downloads
Patches
Plain Diff
simplified progress output
parent
b8e13c84
No related branches found
Branches containing commit
No related tags found
Tags containing commit
3 merge requests
!153
Local add output info
,
!144
Debug cardmech
,
!122
Resolve "Electrocute geometries"
Pipeline
#123711
passed
3 years ago
Stage: build
Stage: test
Stage: debug
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tools/geometries/utility/progress.py
+1
-1
1 addition, 1 deletion
tools/geometries/utility/progress.py
tools/geometries/vtu_to_mesh.py
+11
-11
11 additions, 11 deletions
tools/geometries/vtu_to_mesh.py
with
12 additions
and
12 deletions
tools/geometries/utility/progress.py
+
1
−
1
View file @
6963f6e8
# Print iterations progress
def
print
P
rogress
Bar
(
iteration
,
total
,
prefix
=
''
,
suffix
=
''
,
decimals
=
1
,
length
=
50
,
fill
=
'
█
'
,
printEnd
=
"
\r
"
):
def
print
_p
rogress
(
iteration
,
total
,
prefix
=
''
,
suffix
=
''
,
decimals
=
1
,
length
=
50
,
fill
=
'
█
'
,
printEnd
=
"
\r
"
):
"""
Call in a loop to create terminal progress bar
@params:
...
...
This diff is collapsed.
Click to expand it.
tools/geometries/vtu_to_mesh.py
+
11
−
11
View file @
6963f6e8
...
...
@@ -2,7 +2,7 @@ from vtkmodules.util.numpy_support import vtk_to_numpy
from
vtkmodules.vtkIOXML
import
vtkXMLUnstructuredGridReader
from
utility.mesh
import
Mesh
from
utility.progress
import
print
P
rogress
Bar
from
utility.progress
import
print
_p
rogress
class
VtuMesh
:
...
...
@@ -28,14 +28,14 @@ class VtuMesh:
def
add_points
(
self
,
nodes
):
l
=
len
(
nodes
)
print
P
rogress
Bar
(
0
,
l
,
prefix
=
'
Reading Nodes:
'
,
suffix
=
'
Complete
'
)
print
_p
rogress
(
0
,
l
,
prefix
=
'
Reading Nodes:
\t\t
'
,
suffix
=
''
)
for
i
,
node
in
enumerate
(
nodes
):
self
.
geo
.
add_point
([
p
*
self
.
scale
for
p
in
node
])
print
P
rogress
Bar
(
i
+
1
,
l
,
prefix
=
'
Reading Nodes:
'
,
suffix
=
'
Complete
'
)
print
_p
rogress
(
i
+
1
,
l
,
prefix
=
'
Reading Nodes:
\t\t
'
,
suffix
=
''
)
def
add_cells
(
self
,
cells
):
t
=
cells
.
size
print
P
rogress
Bar
(
0
,
t
,
prefix
=
'
Reading Cells:
'
,
suffix
=
'
Complete
'
)
print
_p
rogress
(
0
,
t
,
prefix
=
'
Reading Cells:
\t\t
'
,
suffix
=
''
)
j
,
k
=
0
,
0
while
j
<
t
:
i
=
cells
[
j
]
...
...
@@ -44,22 +44,22 @@ class VtuMesh:
elif
i
==
3
:
self
.
bnd_data
.
append
([
p
for
p
in
cells
[
j
+
1
:
j
+
i
+
1
]])
j
+=
i
+
1
print
P
rogress
Bar
(
j
,
t
,
prefix
=
'
Reading Cells:
'
,
suffix
=
'
Complete
'
)
print
_p
rogress
(
j
,
t
,
prefix
=
'
Reading Cells:
\t\t
'
,
suffix
=
''
)
def
set_boundary_data
(
self
,
bnd_function
):
l
=
len
(
self
.
geo
.
bnd_faces
())
print
P
rogress
Bar
(
0
,
l
,
prefix
=
'
Setting Boundary:
'
,
suffix
=
'
Complete
'
)
print
_p
rogress
(
0
,
l
,
prefix
=
'
Setting Boundary:
\t
'
,
suffix
=
''
)
for
i
,
bnd_face
in
enumerate
(
self
.
geo
.
bnd_faces
()):
indices
=
bnd_face
.
corners
()
points
=
self
.
geo
.
corners
(
bnd_face
)
bnd_face
.
bnd
=
bnd_function
({
indices
[
i
]:
points
[
i
]
for
i
in
range
(
len
(
indices
))})
print
P
rogress
Bar
(
i
+
1
,
l
,
prefix
=
'
Setting Boundary:
'
,
suffix
=
'
Complete
'
)
print
_p
rogress
(
i
+
1
,
l
,
prefix
=
'
Setting Boundary:
\t
'
,
suffix
=
''
)
def
electrocute
(
self
,
elphy_function
,
elphy_data
=
None
):
if
elphy_data
is
None
:
elphy_data
=
[
0.0
,
0.003
,
30.0
]
l
=
len
(
self
.
geo
.
bnd_faces
())
print
P
rogress
Bar
(
0
,
l
,
prefix
=
'
Setting Activation:
'
,
suffix
=
'
Complete
'
)
print
_p
rogress
(
0
,
l
,
prefix
=
'
Setting Activation:
\t
'
,
suffix
=
''
)
for
i
,
bnd_face
in
enumerate
(
self
.
geo
.
bnd_faces
()):
if
bnd_face
.
bnd
!=
230
:
continue
...
...
@@ -69,7 +69,7 @@ class VtuMesh:
for
j
in
range
(
len
(
points
)):
if
elphy_function
(
points
[
j
]):
self
.
geo
.
set_vdata
(
indices
[
j
],
elphy_data
)
print
P
rogress
Bar
(
i
+
1
,
l
,
prefix
=
'
Setting Activation:
'
,
suffix
=
'
Complete
'
)
print
_p
rogress
(
i
+
1
,
l
,
prefix
=
'
Setting Activation:
\t
'
,
suffix
=
''
)
def
read_celldata
(
self
,
cell_indices
):
for
ci
in
cell_indices
:
...
...
@@ -102,11 +102,11 @@ class VtuMesh:
def
overwrite_subdomains
(
self
,
othergeo
):
cell_size
=
len
(
self
.
geo
.
cells
)
print
P
rogress
Bar
(
0
,
cell_size
,
prefix
=
'
Overwriting subdomains:
'
,
suffix
=
'
Complete
'
)
print
_p
rogress
(
0
,
cell_size
,
prefix
=
'
Overwriting subdomains:
'
,
suffix
=
''
)
for
i
,
c
in
self
.
geo
.
cells
.
items
():
nearest_c
=
othergeo
.
nearest_cell
(
self
.
geo
.
center
(
c
))
c
.
subdomain
=
nearest_c
.
subdomain
print
P
rogress
Bar
(
i
+
1
,
cell_size
,
prefix
=
'
Overwriting subdomains:
'
,
suffix
=
'
Complete
'
)
print
_p
rogress
(
i
+
1
,
cell_size
,
prefix
=
'
Overwriting subdomains:
'
,
suffix
=
''
)
quarter_ellipsoid_endocard
=
(
...
...
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