structuralcodes 0.3.0__tar.gz → 0.3.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of structuralcodes might be problematic. Click here for more details.

Files changed (61) hide show
  1. {structuralcodes-0.3.0 → structuralcodes-0.3.1}/PKG-INFO +1 -1
  2. {structuralcodes-0.3.0 → structuralcodes-0.3.1}/structuralcodes/__init__.py +1 -1
  3. {structuralcodes-0.3.0 → structuralcodes-0.3.1}/structuralcodes/geometry/_circular.py +25 -5
  4. {structuralcodes-0.3.0 → structuralcodes-0.3.1}/structuralcodes/geometry/_geometry.py +6 -1
  5. {structuralcodes-0.3.0 → structuralcodes-0.3.1}/structuralcodes/geometry/_rectangular.py +23 -5
  6. {structuralcodes-0.3.0 → structuralcodes-0.3.1}/structuralcodes/materials/constitutive_laws/_bilinearcompression.py +10 -9
  7. {structuralcodes-0.3.0 → structuralcodes-0.3.1}/README.md +0 -0
  8. {structuralcodes-0.3.0 → structuralcodes-0.3.1}/pyproject.toml +0 -0
  9. {structuralcodes-0.3.0 → structuralcodes-0.3.1}/structuralcodes/codes/__init__.py +0 -0
  10. {structuralcodes-0.3.0 → structuralcodes-0.3.1}/structuralcodes/codes/ec2_2004/__init__.py +0 -0
  11. {structuralcodes-0.3.0 → structuralcodes-0.3.1}/structuralcodes/codes/ec2_2004/_concrete_creep_and_shrinkage.py +0 -0
  12. {structuralcodes-0.3.0 → structuralcodes-0.3.1}/structuralcodes/codes/ec2_2004/_concrete_material_properties.py +0 -0
  13. {structuralcodes-0.3.0 → structuralcodes-0.3.1}/structuralcodes/codes/ec2_2004/_reinforcement_material_properties.py +0 -0
  14. {structuralcodes-0.3.0 → structuralcodes-0.3.1}/structuralcodes/codes/ec2_2004/_section_7_3_crack_control.py +0 -0
  15. {structuralcodes-0.3.0 → structuralcodes-0.3.1}/structuralcodes/codes/ec2_2004/shear.py +0 -0
  16. {structuralcodes-0.3.0 → structuralcodes-0.3.1}/structuralcodes/codes/ec2_2023/__init__.py +0 -0
  17. {structuralcodes-0.3.0 → structuralcodes-0.3.1}/structuralcodes/codes/ec2_2023/_annexB_time_dependent.py +0 -0
  18. {structuralcodes-0.3.0 → structuralcodes-0.3.1}/structuralcodes/codes/ec2_2023/_section5_materials.py +0 -0
  19. {structuralcodes-0.3.0 → structuralcodes-0.3.1}/structuralcodes/codes/ec2_2023/_section9_sls.py +0 -0
  20. {structuralcodes-0.3.0 → structuralcodes-0.3.1}/structuralcodes/codes/mc2010/__init__.py +0 -0
  21. {structuralcodes-0.3.0 → structuralcodes-0.3.1}/structuralcodes/codes/mc2010/_concrete_creep_and_shrinkage.py +0 -0
  22. {structuralcodes-0.3.0 → structuralcodes-0.3.1}/structuralcodes/codes/mc2010/_concrete_interface_different_casting_times.py +0 -0
  23. {structuralcodes-0.3.0 → structuralcodes-0.3.1}/structuralcodes/codes/mc2010/_concrete_material_properties.py +0 -0
  24. {structuralcodes-0.3.0 → structuralcodes-0.3.1}/structuralcodes/codes/mc2010/_concrete_punching.py +0 -0
  25. {structuralcodes-0.3.0 → structuralcodes-0.3.1}/structuralcodes/codes/mc2010/_concrete_shear.py +0 -0
  26. {structuralcodes-0.3.0 → structuralcodes-0.3.1}/structuralcodes/codes/mc2010/_concrete_torsion.py +0 -0
  27. {structuralcodes-0.3.0 → structuralcodes-0.3.1}/structuralcodes/codes/mc2010/_reinforcement_material_properties.py +0 -0
  28. {structuralcodes-0.3.0 → structuralcodes-0.3.1}/structuralcodes/codes/mc2020/__init__.py +0 -0
  29. {structuralcodes-0.3.0 → structuralcodes-0.3.1}/structuralcodes/core/__init__.py +0 -0
  30. {structuralcodes-0.3.0 → structuralcodes-0.3.1}/structuralcodes/core/_section_results.py +0 -0
  31. {structuralcodes-0.3.0 → structuralcodes-0.3.1}/structuralcodes/core/base.py +0 -0
  32. {structuralcodes-0.3.0 → structuralcodes-0.3.1}/structuralcodes/geometry/__init__.py +0 -0
  33. {structuralcodes-0.3.0 → structuralcodes-0.3.1}/structuralcodes/geometry/_reinforcement.py +0 -0
  34. {structuralcodes-0.3.0 → structuralcodes-0.3.1}/structuralcodes/geometry/_steel_sections.py +0 -0
  35. {structuralcodes-0.3.0 → structuralcodes-0.3.1}/structuralcodes/materials/__init__.py +0 -0
  36. {structuralcodes-0.3.0 → structuralcodes-0.3.1}/structuralcodes/materials/concrete/__init__.py +0 -0
  37. {structuralcodes-0.3.0 → structuralcodes-0.3.1}/structuralcodes/materials/concrete/_concrete.py +0 -0
  38. {structuralcodes-0.3.0 → structuralcodes-0.3.1}/structuralcodes/materials/concrete/_concreteEC2_2004.py +0 -0
  39. {structuralcodes-0.3.0 → structuralcodes-0.3.1}/structuralcodes/materials/concrete/_concreteEC2_2023.py +0 -0
  40. {structuralcodes-0.3.0 → structuralcodes-0.3.1}/structuralcodes/materials/concrete/_concreteMC2010.py +0 -0
  41. {structuralcodes-0.3.0 → structuralcodes-0.3.1}/structuralcodes/materials/constitutive_laws/__init__.py +0 -0
  42. {structuralcodes-0.3.0 → structuralcodes-0.3.1}/structuralcodes/materials/constitutive_laws/_elastic.py +0 -0
  43. {structuralcodes-0.3.0 → structuralcodes-0.3.1}/structuralcodes/materials/constitutive_laws/_elasticplastic.py +0 -0
  44. {structuralcodes-0.3.0 → structuralcodes-0.3.1}/structuralcodes/materials/constitutive_laws/_parabolarectangle.py +0 -0
  45. {structuralcodes-0.3.0 → structuralcodes-0.3.1}/structuralcodes/materials/constitutive_laws/_popovics.py +0 -0
  46. {structuralcodes-0.3.0 → structuralcodes-0.3.1}/structuralcodes/materials/constitutive_laws/_sargin.py +0 -0
  47. {structuralcodes-0.3.0 → structuralcodes-0.3.1}/structuralcodes/materials/constitutive_laws/_userdefined.py +0 -0
  48. {structuralcodes-0.3.0 → structuralcodes-0.3.1}/structuralcodes/materials/reinforcement/__init__.py +0 -0
  49. {structuralcodes-0.3.0 → structuralcodes-0.3.1}/structuralcodes/materials/reinforcement/_reinforcement.py +0 -0
  50. {structuralcodes-0.3.0 → structuralcodes-0.3.1}/structuralcodes/materials/reinforcement/_reinforcementEC2_2004.py +0 -0
  51. {structuralcodes-0.3.0 → structuralcodes-0.3.1}/structuralcodes/materials/reinforcement/_reinforcementEC2_2023.py +0 -0
  52. {structuralcodes-0.3.0 → structuralcodes-0.3.1}/structuralcodes/materials/reinforcement/_reinforcementMC2010.py +0 -0
  53. {structuralcodes-0.3.0 → structuralcodes-0.3.1}/structuralcodes/sections/__init__.py +0 -0
  54. {structuralcodes-0.3.0 → structuralcodes-0.3.1}/structuralcodes/sections/_generic.py +0 -0
  55. {structuralcodes-0.3.0 → structuralcodes-0.3.1}/structuralcodes/sections/_rc_utils.py +0 -0
  56. {structuralcodes-0.3.0 → structuralcodes-0.3.1}/structuralcodes/sections/section_integrators/__init__.py +0 -0
  57. {structuralcodes-0.3.0 → structuralcodes-0.3.1}/structuralcodes/sections/section_integrators/_factory.py +0 -0
  58. {structuralcodes-0.3.0 → structuralcodes-0.3.1}/structuralcodes/sections/section_integrators/_fiber_integrator.py +0 -0
  59. {structuralcodes-0.3.0 → structuralcodes-0.3.1}/structuralcodes/sections/section_integrators/_marin_integration.py +0 -0
  60. {structuralcodes-0.3.0 → structuralcodes-0.3.1}/structuralcodes/sections/section_integrators/_marin_integrator.py +0 -0
  61. {structuralcodes-0.3.0 → structuralcodes-0.3.1}/structuralcodes/sections/section_integrators/_section_integrator.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: structuralcodes
3
- Version: 0.3.0
3
+ Version: 0.3.1
4
4
  Summary: A Python package that contains models from structural design codes.
5
5
  Author-email: fib - International Federation for Structural Concrete <info@fib-international.org>
6
6
  Requires-Python: >=3.8
@@ -3,7 +3,7 @@
3
3
  from . import codes, core, geometry, materials, sections
4
4
  from .codes import get_design_codes, set_design_code, set_national_annex
5
5
 
6
- __version__ = '0.3.0'
6
+ __version__ = '0.3.1'
7
7
 
8
8
  __all__ = [
9
9
  'set_design_code',
@@ -9,6 +9,7 @@ input by the user.
9
9
  import typing as t
10
10
 
11
11
  import numpy as np
12
+ from numpy.typing import ArrayLike
12
13
  from shapely import Polygon
13
14
 
14
15
  from structuralcodes.core.base import ConstitutiveLaw, Material
@@ -16,11 +17,12 @@ from structuralcodes.core.base import ConstitutiveLaw, Material
16
17
  from ._geometry import SurfaceGeometry
17
18
 
18
19
 
19
- def _create_circle(radius, npoints=20):
20
+ def _create_circle(radius, npoints=20, origin: t.Optional[ArrayLike] = None):
20
21
  """Create a circle with a given radius."""
22
+ origin = origin if origin is not None else (0.0, 0.0)
21
23
  phi = np.linspace(0, 2 * np.pi, npoints + 1)
22
- x = radius * np.cos(phi)
23
- y = radius * np.sin(phi)
24
+ x = radius * np.cos(phi) + origin[0]
25
+ y = radius * np.sin(phi) + origin[1]
24
26
  points = np.transpose(np.array([x, y]))
25
27
  return Polygon(points)
26
28
 
@@ -39,6 +41,9 @@ class CircularGeometry(SurfaceGeometry):
39
41
  n_points: int = 20,
40
42
  density: t.Optional[float] = None,
41
43
  concrete: bool = False,
44
+ origin: t.Optional[ArrayLike] = None,
45
+ name: t.Optional[str] = None,
46
+ group_label: t.Optional[str] = None,
42
47
  ) -> None:
43
48
  """Initialize a CircularGeometry.
44
49
 
@@ -53,6 +58,10 @@ class CircularGeometry(SurfaceGeometry):
53
58
  material is a Material object the density is taken from the
54
59
  material.
55
60
  concrete (bool): Flag to indicate if the geometry is concrete.
61
+ origin (Optional(ArrayLike)): The center point of the circle.
62
+ (0.0, 0.0) is used as default.
63
+ name (Optional(str)): The name to be given to the object.
64
+ group_label (Optional(str)): A label for grouping several objects.
56
65
 
57
66
  Note:
58
67
  The CircularGeometry is simply a wrapper for a SurfaceGeometry
@@ -63,11 +72,22 @@ class CircularGeometry(SurfaceGeometry):
63
72
  raise ValueError('Diameter must be a positive number.')
64
73
  # Manage size as radius or diameter (default)
65
74
  self._radius = diameter / 2.0
75
+ # Parse origin
76
+ if origin is not None and len(origin) != 2:
77
+ raise ValueError('origin must be an ArrayLike with len == 2')
78
+ origin = origin if origin is not None else (0.0, 0.0)
66
79
  # Create the shapely polygon
67
- polygon = _create_circle(radius=self._radius, npoints=n_points)
80
+ polygon = _create_circle(
81
+ radius=self._radius, npoints=n_points, origin=origin
82
+ )
68
83
  # Pass everything to the base class
69
84
  super().__init__(
70
- poly=polygon, material=material, density=density, concrete=concrete
85
+ poly=polygon,
86
+ material=material,
87
+ density=density,
88
+ concrete=concrete,
89
+ name=name,
90
+ group_label=group_label,
71
91
  )
72
92
 
73
93
  @property
@@ -323,7 +323,7 @@ def create_line_point_angle(
323
323
  return LineString([(x1, y1), (x2, y2)])
324
324
 
325
325
 
326
- class SurfaceGeometry:
326
+ class SurfaceGeometry(Geometry):
327
327
  """Class for a surface geometry with material.
328
328
 
329
329
  Basically it is a wrapper for shapely polygon including the material (and
@@ -339,6 +339,8 @@ class SurfaceGeometry:
339
339
  material: t.Union[Material, ConstitutiveLaw],
340
340
  density: t.Optional[float] = None,
341
341
  concrete: bool = False,
342
+ name: t.Optional[str] = None,
343
+ group_label: t.Optional[str] = None,
342
344
  ) -> None:
343
345
  """Initializes a SurfaceGeometry object.
344
346
 
@@ -350,7 +352,10 @@ class SurfaceGeometry:
350
352
  the density can be provided by this argument. When mat is a
351
353
  Material object the density is taken from the material.
352
354
  concrete (bool): Flag to indicate if the geometry is concrete.
355
+ name (Optional(str)): The name to be given to the object.
356
+ group_label (Optional(str)): A label for grouping several objects.
353
357
  """
358
+ super().__init__(name=name, group_label=group_label)
354
359
  # Check if inputs are of the correct type, otherwise return error
355
360
  if not isinstance(poly, Polygon):
356
361
  raise TypeError(
@@ -8,6 +8,7 @@ input by the user.
8
8
 
9
9
  import typing as t
10
10
 
11
+ from numpy.typing import ArrayLike
11
12
  from shapely import Polygon
12
13
 
13
14
  from structuralcodes.core.base import ConstitutiveLaw, Material
@@ -30,6 +31,9 @@ class RectangularGeometry(SurfaceGeometry):
30
31
  material: t.Union[Material, ConstitutiveLaw],
31
32
  density: t.Optional[float] = None,
32
33
  concrete: bool = False,
34
+ origin: t.Optional[ArrayLike] = None,
35
+ name: t.Optional[str] = None,
36
+ group_label: t.Optional[str] = None,
33
37
  ) -> None:
34
38
  """Initialize a RectangularGeometry.
35
39
 
@@ -44,6 +48,10 @@ class RectangularGeometry(SurfaceGeometry):
44
48
  material.
45
49
  concrete (bool): Flag to indicate if the geometry is concrete. When
46
50
  passing a Material as material, this is automatically inferred.
51
+ origin (Optional(ArrayLike)): The center point of the rectangle.
52
+ (0.0, 0.0) is used as default.
53
+ name (Optional(str)): The name to be given to the object.
54
+ group_label (Optional(str)): A label for grouping several objects.
47
55
 
48
56
  Note:
49
57
  The RectangularGeometry is simply a wrapper for a SurfaceGeometry
@@ -58,18 +66,28 @@ class RectangularGeometry(SurfaceGeometry):
58
66
  self._width = width
59
67
  self._height = height
60
68
 
69
+ # Parse origin
70
+ if origin is not None and len(origin) != 2:
71
+ raise ValueError('origin must be an ArrayLike with len == 2')
72
+ origin = origin if origin is not None else (0.0, 0.0)
73
+
61
74
  # Create the shapely polygon
62
75
  polygon = Polygon(
63
76
  (
64
- (-width / 2, -height / 2),
65
- (width / 2, -height / 2),
66
- (width / 2, height / 2),
67
- (-width / 2, height / 2),
77
+ (-width / 2 + origin[0], -height / 2 + origin[1]),
78
+ (width / 2 + origin[0], -height / 2 + origin[1]),
79
+ (width / 2 + origin[0], height / 2 + origin[1]),
80
+ (-width / 2 + origin[0], height / 2 + origin[1]),
68
81
  )
69
82
  )
70
83
  # Pass everything to the base class
71
84
  super().__init__(
72
- poly=polygon, material=material, density=density, concrete=concrete
85
+ poly=polygon,
86
+ material=material,
87
+ density=density,
88
+ concrete=concrete,
89
+ name=name,
90
+ group_label=group_label,
73
91
  )
74
92
 
75
93
  @property
@@ -51,10 +51,10 @@ class BilinearCompression(ConstitutiveLaw):
51
51
  # Compute stress
52
52
  # If it is a scalar
53
53
  if np.isscalar(eps):
54
- sig = 0
55
- if self._fc / self._E <= eps <= 0:
56
- sig = self._E * eps
57
- return sig
54
+ if eps > 0 or eps < self._eps_cu:
55
+ return 0
56
+ return max(self._E * eps, self._fc)
57
+
58
58
  # If it is an array
59
59
  sig = self._E * eps
60
60
  sig[sig < self._fc] = self._fc
@@ -69,13 +69,14 @@ class BilinearCompression(ConstitutiveLaw):
69
69
  eps = eps if np.isscalar(eps) else np.atleast_1d(eps)
70
70
  # If it is a scalar
71
71
  if np.isscalar(eps):
72
- tangent = 0
73
- if self._fc / self._E <= eps <= 0:
74
- tangent = self._E
75
- return tangent
72
+ if self._eps_c < eps <= 0:
73
+ return self._E
74
+ return 0
75
+
76
76
  # If it is an array
77
77
  tangent = np.ones_like(eps) * self._E
78
- tangent[eps < self._eps_c] = 0.0
78
+ tangent[eps >= 0] = 0
79
+ tangent[eps < self._eps_c] = 0
79
80
 
80
81
  return tangent
81
82