Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
oofem-project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository 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
Ernesto Oquelis
oofem-project
Commits
d7d712ea
Commit
d7d712ea
authored
6 years ago
by
Ernesto Oquelis
Browse files
Options
Downloads
Patches
Plain Diff
update
parent
483d49bc
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
models.py
+12
-8
12 additions, 8 deletions
models.py
tests.py
+21
-4
21 additions, 4 deletions
tests.py
with
33 additions
and
12 deletions
models.py
+
12
−
8
View file @
d7d712ea
...
...
@@ -269,22 +269,26 @@ def load_model(model_name):
"""
This loads models from csv files and returns structure.
"""
import
os
import
pandas
as
pd
import
numpy
as
np
from
fem
import
Constraint
,
Force
,
Structure
constraints_data
=
pd
.
read_csv
(
'
models_data
\\
'
+
model_name
+
'
_constraints_data.csv
'
,
sep
=
'
;
'
,
cwd
=
os
.
getcwd
()
path
=
cwd
+
'
/models_data
'
os
.
chdir
(
path
)
constraints_data
=
pd
.
read_csv
(
model_name
+
'
_constraints_data.csv
'
,
sep
=
'
;
'
,
decimal
=
'
,
'
).
values
elements_data
=
pd
.
read_csv
(
'
models_data
\\
'
+
model_name
+
'
_elements_data.csv
'
,
sep
=
'
;
'
,
elements_data
=
pd
.
read_csv
(
model_name
+
'
_elements_data.csv
'
,
sep
=
'
;
'
,
decimal
=
'
,
'
).
values
forces_data
=
pd
.
read_csv
(
'
models_data
\\
'
+
model_name
+
'
_forces_data.csv
'
,
sep
=
'
;
'
,
forces_data
=
pd
.
read_csv
(
model_name
+
'
_forces_data.csv
'
,
sep
=
'
;
'
,
decimal
=
'
,
'
).
values
nodes_data
=
pd
.
read_csv
(
'
models_data
\\
'
+
model_name
+
'
_nodes_data.csv
'
,
sep
=
'
;
'
,
nodes_data
=
pd
.
read_csv
(
model_name
+
'
_nodes_data.csv
'
,
sep
=
'
;
'
,
decimal
=
'
,
'
).
values
os
.
chdir
(
cwd
)
struct
=
Structure
()
number_nodes
=
nodes_data
.
shape
[
0
]
...
...
This diff is collapsed.
Click to expand it.
tests.py
+
21
−
4
View file @
d7d712ea
...
...
@@ -4,7 +4,7 @@ This is an empty docstring
"""
from
fem
import
Constraint
,
Force
,
Node
,
Element
from
models
import
first_tetraeder
,
small_tetraeder
from
models
import
first_tetraeder
,
small_tetraeder
,
load_model
from
fem
import
Visualizer
from
pview3d.src.pview3d
import
Viewer
...
...
@@ -71,8 +71,9 @@ for element_id in range(STRUCT.get_number_elements()):
print(
'
{:>5}
'
.format(int(dof)), end=
''
)
print(
''
)
'''
# TEST 5 - Full moedl execution with small tetraeder model
# Gets the structure object from the models module.
'''
# TEST 5 - Full model execution with small tetraeder model
# Gets the structure object from the models modcule.
STRUCT = small_tetraeder()
# Solves the system of equations.
...
...
@@ -98,4 +99,20 @@ VIZ.draw_displaced_forces()
VIZ.draw_normal_forces()
# Runs the visualizer.
VIEWER.run()
sh
\ No newline at end of file
'''
# TEST 6 - Importing model from csv files
STRUCT
=
load_model
(
'
small_bridge
'
)
STRUCT
.
print_details
()
# Instantiates a viewer object
VIEWER
=
Viewer
()
# Gives the structure and the viewer instances to the visualizer object.
VIZ
=
Visualizer
(
STRUCT
,
VIEWER
)
# Draws all desired objects to visualize.
VIZ
.
draw_elements
()
VIZ
.
draw_constraints
()
VIZ
.
draw_element_forces
()
# Runs the visualizer.
VIEWER
.
run
()
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