Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shapely preprocessor #66

Closed
wants to merge 70 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
de3c87f
Updated .gitignore
connorferster Dec 20, 2020
5794e70
Updated .gitignore
connorferster Dec 20, 2020
0a34420
Proof-of-concept for Preprocessing overhaul with Shapely
connorferster Dec 23, 2020
ff2b167
Converted section classes into standalone factory functions for gener…
connorferster Dec 28, 2020
c583584
Update to allow for MultiPolygon shapes
connorferster Dec 28, 2020
0bf7646
cross_section.py: altered init() to create_mesh() for geometry upon i…
connorferster Dec 30, 2020
84128b1
Revised sections.py: added dowel_array(); cross_section.py: made alte…
connorferster Dec 31, 2020
e2c8601
Updated tests to reflect new section functions. Fixed typos in cross_…
connorferster Dec 31, 2020
9d41f99
Added: pre/dxf.py; Changed: name of CrossSection class to Section in …
connorferster Jan 2, 2021
cac8bb3
tests: updated test suite to run with pytest; problem: meshpy seems t…
connorferster Jan 3, 2021
ed036a6
In process: updating NASTRAN section classes to functions
connorferster Jan 5, 2021
156bb8c
Completed updating nastran_sections.py to functions generating Geomet…
connorferster Jan 10, 2021
3f07265
Added Geometry.from_points() for creating new Geometry objects from l…
connorferster Jan 10, 2021
61c5eb3
Completed Geometry.from_points(); updated docstrings
connorferster Jan 12, 2021
1708490
Updated from master
connorferster Jan 12, 2021
b197d87
Updating doc strings in sections.py
connorferster Jan 12, 2021
fcca7f5
Added more docstrings to sections.py
connorferster Jan 19, 2021
31d5c09
Completed updating docstrings on sections.py
connorferster Jan 20, 2021
abf5815
Fix: Update test_rectangle.py to get some working tests (still proble…
connorferster Jan 31, 2021
85df935
Fix: Bug in PlasticSection where a crash would occur because self.ele…
connorferster Feb 5, 2021
a43ffa6
Change: Made fea.Tri6 a dataclass to create an auto __repr__ for debu…
connorferster Feb 7, 2021
9f10ef4
Added instrumentation (logging) to fea.py, sections.py, cross_section…
connorferster Feb 9, 2021
0b0e2b6
Fix: plastic properties calculation now works
connorferster Feb 11, 2021
d894ba0
Tests: Updated testing code and tolerances so that all tests match th…
connorferster Feb 15, 2021
145083c
Update GeometryCleaner to be compatible with point tuples from Geomet…
connorferster Feb 15, 2021
ca78d6e
Converted points from being [x,y] lists to (x,y) tuples to allow set …
connorferster Feb 16, 2021
ac3048c
Breaks with new section tests
connorferster Feb 16, 2021
e627fe5
Added comments from Robbie in cross_section.py, fea.py, and pre.py. B…
connorferster Apr 2, 2021
4f1fc1a
PlasticSection is now calculated on shapely polygons instead of on a …
connorferster Apr 4, 2021
11a5ed1
Fix mistake in plastic calculate in qx, qy calculations (wrong centro…
connorferster Apr 5, 2021
2604a68
Fixed bugs in Geometry tranformations where Geometry was not compilin…
connorferster Apr 6, 2021
1dc1d98
Tests: added test_compound_geometry_from_points() and test_geometry_f…
connorferster Apr 6, 2021
fd42fae
Update sectionproperties.post to accomodate the DEFAULT_MATERIAL inst…
connorferster Apr 10, 2021
77cd4a8
Changed all of the 'align_...' methods to 'align_to'; fixed bugs
connorferster Apr 16, 2021
3150af4
Removed leftover instrumentation, Fix: <Geometry>.mirror_section(), F…
connorferster Apr 18, 2021
3266c21
Removed print() statements
connorferster Apr 18, 2021
37f4842
Fix: Remove logging instrumentation from fea.py
connorferster Apr 20, 2021
468a892
Fix: Update faulty vaulty variable name in post.py; str -> info_str -…
connorferster Apr 20, 2021
9c85285
Fix: Bug in Geometry.mirror_section; Fix: CompoundGeometry.create_mes…
connorferster Apr 20, 2021
a51fb7f
Fix: Updated cross_section.py to change var names from info_str to ms…
connorferster Apr 20, 2021
6c2eed7
Blackify
connorferster Apr 20, 2021
e06edb4
Fix: 'info' var in solver.py got changed to 'exit'; changed back to '…
connorferster Apr 20, 2021
5da7a88
Fix: changed argument in Geometry.create_mesh() from 'mesh_size' back…
connorferster Apr 20, 2021
09ee444
Blackify
connorferster Apr 20, 2021
a377a43
cross_section.py: removed 'time_info' argument from all methods and r…
connorferster Apr 23, 2021
de72c61
Made fixes as suggested by Agent 6-6-6 for pull request
connorferster Apr 27, 2021
a5df59d
Update sectionproperties/analysis/solver.py
connorferster Apr 27, 2021
cb58d3d
Removed print('') lines from cross_section.py
connorferster Apr 27, 2021
f12ba10
Merge branch 'shapely_preprocessor' of https://github.com/connorferst…
connorferster Apr 27, 2021
729a199
Removed a redundant line break in an info message
connorferster Apr 27, 2021
796df9d
Fix: Added .tol attribute to Geometry to round point coordinates to 1…
connorferster Apr 29, 2021
af65862
Fix: As suggested by Agent 6-6-6 in Geometry.align_center(), hard rou…
connorferster May 4, 2021
68bea0f
Docs: Updated analysis.rst, api.rst, examples.rst; Fix: changed nastr…
connorferster May 6, 2021
9ed3a1d
Updated docs to reflect changes to new pre-processor; updated some fu…
connorferster May 10, 2021
d97bc6a
Docs: Update geom_mesh.rst; Project: change build tool from Poetry to…
connorferster May 25, 2021
34ae469
Feature: Added 'size' and 'dpi' args to Geometry.plot_geometry() func…
connorferster May 25, 2021
8a4767e
Feature: Updated Geometry.plot_geometry() to allow for adjustment of …
connorferster May 25, 2021
8d0384d
Fix: Updated Geometry.offset_perimeter() to allow for offset of inter…
connorferster May 26, 2021
f391348
Feat: Added .assigned_control_point functionality to Geometry
connorferster Jun 6, 2021
1725bec
Feature: Added Geometry.assign_control_point() and casually tested co…
connorferster Jun 7, 2021
b18c96f
Fix: doc string for Geometry.plot_geometry(); Fix: pre.dxf removed re…
connorferster Jun 20, 2021
912fe2e
Docs: Geom mesh
connorferster Aug 8, 2021
75ffbaf
Started advanced_geom.rst; fixed empty axis plotting issue in Geometr…
connorferster Aug 28, 2021
7d4c106
docs: wrote advanced_geom.rst and created images
connorferster Aug 28, 2021
0c5c442
docs: revisions and rewrites to advanced_geom.rst
connorferster Aug 29, 2021
bf4fb1b
docs: update installation.rst and structure.rst; feat: implement more…
connorferster Aug 29, 2021
7cf523e
feat: updated all stress plotting functions with new args - size, dpi…
connorferster Aug 30, 2021
c769e63
feat: changed color bar on plots so that it always matches the height…
connorferster Aug 30, 2021
4f20fb8
docs: updated logo and examples in index.rst and doc string examples …
connorferster Aug 30, 2021
0e36822
docs: Updated stress plot images from doc string examples in cross_se…
connorferster Sep 1, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions sectionproperties/pre/pre.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,6 @@ def create_mesh(
:return: Object containing generated mesh data
:rtype: :class:`meshpy.triangle.MeshInfo`
"""
print("Pre.mesh beginning")

# check_geometry(points, facets, holes, control_points, atol=atol)
if not isinstance(mesh_sizes, list):
mesh_sizes = [mesh_sizes]
Expand All @@ -114,7 +112,6 @@ def create_mesh(
mesh.regions[i] = [cp[0], cp[1], region_id, mesh_sizes[i]]
region_id += 1

print("Just before mesh")
mesh = triangle.build(
mesh,
min_angle=30,
Expand Down
23 changes: 13 additions & 10 deletions sectionproperties/pre/sections.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def __init__(
self.holes = []
self.perimeter = []
self._recovery_points = []
self.tol = 12 # Represents num of decimal places of precision
self.tol = 12 # Represents num of decimal places of precision for point locations
self.compile_geometry()

def _repr_svg_(self):
Expand Down Expand Up @@ -205,7 +205,6 @@ def create_mesh(self, mesh_sizes: Union[float, List[float]]):

Mesh generated from the above geometry.
"""
print("Geometry create mesh method begin")
if isinstance(mesh_sizes, (list, tuple)) and len(mesh_sizes) == 1:
mesh_size = mesh_sizes[0]
elif isinstance(mesh_sizes, (float, int)):
Expand Down Expand Up @@ -242,8 +241,9 @@ def align_to(
:return: Geometry object translated to alignment location
:rtype: :class:`sections.pre.sections.Geometry`
"""
# Mappings are indexes in the list of bbox extents of both
# self and 'align_to'
# Mappings are for indexes in the list of bbox extents of both
# 'self' and 'align_to'. i.e. a mapping of which "word" corresponds
# to which bounding box coordinate
align_self_map = {
"left": 0,
"right": 1,
Expand Down Expand Up @@ -305,12 +305,17 @@ def align_center(self, align_to: Optional[Geometry] = None):
:rtype: :class:`sections.pre.sections.Geometry`
"""
cx, cy = list(self.geom.centroid.coords)[0]
# Suggested by Agent 6-6-6: Hard-rounding of cx and cy allows
# for greater precision in placing geometry with its centroid
# near [0, 0]. True [0, 0] placement will not be possible due
# to floating point errors.
if align_to is None:
shift_x, shift_y = -cx, -cy
shift_x, shift_y = round(-cx, self.tol), round(-cy, self.tol)
connorferster marked this conversation as resolved.
Show resolved Hide resolved

else:
align_cx, align_cy = list(align_to.geom.centroid.coords)[0]
shift_x = align_cx - cx
shift_y = align_cy - cy
shift_x = round(align_cx - cx, self.tol)
shift_y = round(align_cy - cy, self.tol)
new_geom = self.shift_section(x_offset=shift_x, y_offset=shift_y)
return new_geom

Expand Down Expand Up @@ -854,7 +859,7 @@ def __init__(self, geoms: Union[MultiPolygon, List[Geometry]]):
self.holes = []
self.perimeter = []
self.compile_geometry()

self.tol = 12
self.mesh = None

def _repr_svg_(self):
Expand Down Expand Up @@ -975,10 +980,8 @@ def create_mesh(self, mesh_sizes: List[float]):

Mesh generated from the above geometry.
"""
print("Begin create mesh method")
if len(mesh_sizes) == 1:
mesh_sizes = mesh_sizes * len(self.control_points)
print("Call pre.create_mesh")
self.mesh = pre.create_mesh(
self.points, self.facets, self.holes, self.control_points, mesh_sizes
)
Expand Down
4 changes: 2 additions & 2 deletions sectionproperties/tests/test_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ def test_angle_all_properties():
check.almost_equal(angle_section.section_props.sf_xx_plus, 1.788366)
check.almost_equal(angle_section.section_props.sf_xx_minus, 9.207672e-1)
check.almost_equal(angle_section.section_props.sf_yy_plus, 1.829943) # Altered from 1.829944
check.almost_equal(angle_section.section_props.sf_yy_minus, 5.646721e-1) # Altered from 5.646723
check.almost_equal(angle_section.section_props.sf_yy_minus, 5.646721e-1) # Altered from 5.646723e-1
check.almost_equal(angle_section.section_props.s11, 1.210275e5)
check.almost_equal(angle_section.section_props.s22, 4.376054e4)
check.almost_equal(angle_section.section_props.sf_11_plus, 1.238049)
check.almost_equal(angle_section.section_props.sf_11_minus, 1.744103)
check.almost_equal(angle_section.section_props.sf_22_plus, 1.564994)
check.almost_equal(angle_section.section_props.sf_22_minus, 2.107303)
check.almost_equal(angle_section.section_props.j, 1.354663e5)
check.almost_equal(angle_section.section_props.j, 1.354663e5) # Altered from 1.354663e5
check.almost_equal(angle_section.section_props.gamma, 162220735.49)
check.almost_equal(angle_section.section_props.A_s11, 8.855951e2)
check.almost_equal(angle_section.section_props.A_s22, 1.460240e3)
Expand Down