structuraid_core 0.1.3 → 0.2.0

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.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +0 -6
  3. data/lib/structuraid_core/design_codes/aci_318_19/rc/footings/bending_reinforcement_ratio.rb +65 -0
  4. data/lib/structuraid_core/design_codes/aci_318_19/rc/footings/one_way_shear_capacity.rb +29 -0
  5. data/lib/structuraid_core/design_codes/aci_318_19/rc/footings/punching_critical_section_perimeter.rb +105 -0
  6. data/lib/structuraid_core/design_codes/aci_318_19/rc/minimum_steel_cover.rb +55 -0
  7. data/lib/structuraid_core/design_codes/aci_318_19/rc/reduction_factor.rb +88 -0
  8. data/lib/structuraid_core/design_codes/nsr_10/rc/footings/bending_reinforcement_ratio.rb +66 -0
  9. data/lib/structuraid_core/design_codes/nsr_10/rc/footings/one_way_shear_capacity.rb +31 -0
  10. data/lib/structuraid_core/design_codes/nsr_10/rc/footings/punching_critical_section_perimeter.rb +103 -0
  11. data/lib/structuraid_core/design_codes/nsr_10/rc/minimum_steel_cover.rb +57 -0
  12. data/lib/structuraid_core/design_codes/nsr_10/rc/reduction_factor.rb +82 -0
  13. data/lib/structuraid_core/design_codes/schemas/rc/footings/bending_reinforcement_ratio_schema.rb +24 -0
  14. data/lib/structuraid_core/design_codes/schemas/rc/footings/one_way_shear_capacity_schema.rb +22 -0
  15. data/lib/structuraid_core/design_codes/schemas/rc/footings/punching_critical_section_perimeter_schema.rb +23 -0
  16. data/lib/structuraid_core/design_codes/schemas/rc/minimum_steel_cover_schema.rb +32 -0
  17. data/lib/structuraid_core/design_codes/schemas/rc/reduction_factor_schema.rb +17 -0
  18. data/lib/structuraid_core/design_codes/utils/schema_definition.rb +38 -9
  19. data/lib/structuraid_core/elements/column/rectangular.rb +5 -4
  20. data/lib/structuraid_core/elements/footing.rb +37 -1
  21. data/lib/structuraid_core/engineering/analysis/footing/base.rb +17 -0
  22. data/lib/structuraid_core/engineering/analysis/footing/centric_combined_two_columns.rb +99 -0
  23. data/lib/structuraid_core/engineering/analysis/footing/centric_isolated.rb +1 -1
  24. data/lib/structuraid_core/engineering/analysis/footing/utils/basic_geometry.rb +36 -0
  25. data/lib/structuraid_core/engineering/analysis/footing/utils/centroid.rb +33 -0
  26. data/lib/structuraid_core/engineering/analysis/footing/utils/one_way_moment.rb +63 -0
  27. data/lib/structuraid_core/engineering/analysis/footing/utils/one_way_shear.rb +46 -0
  28. data/lib/structuraid_core/engineering/base.rb +1 -1
  29. data/lib/structuraid_core/engineering/locations/absolute.rb +4 -0
  30. data/lib/structuraid_core/engineering/locations/base.rb +1 -0
  31. data/lib/structuraid_core/engineering/locations/collection.rb +51 -0
  32. data/lib/structuraid_core/engineering/locations/coordinates_system.rb +19 -4
  33. data/lib/structuraid_core/engineering/locations/relative.rb +17 -4
  34. data/lib/structuraid_core/errors/engineering/locations/duplicate_label_error.rb +13 -0
  35. data/lib/structuraid_core/loads/point_load.rb +3 -2
  36. data/lib/structuraid_core/version.rb +1 -1
  37. metadata +25 -2
@@ -0,0 +1,51 @@
1
+ module StructuraidCore
2
+ module Engineering
3
+ module Locations
4
+ class Collection < Base
5
+ include Enumerable
6
+
7
+ def initialize
8
+ @locations = []
9
+ end
10
+
11
+ def each(&block)
12
+ locations.each(&block)
13
+ end
14
+
15
+ def add(location)
16
+ raise DuplicateLabelError, location.label if find_by_label(location.label)
17
+
18
+ locations.push(location)
19
+ end
20
+
21
+ def inspect
22
+ locations.inspect
23
+ end
24
+
25
+ def find_by_label(label)
26
+ locations.find { |location| location.label == label.to_sym }
27
+ end
28
+
29
+ def last
30
+ locations.last
31
+ end
32
+
33
+ def prepend(location)
34
+ locations.prepend(location)
35
+ end
36
+
37
+ def find_or_add_by_label(location)
38
+ add(location)
39
+ find_by_label(location.label)
40
+ rescue DuplicateLabelError => e
41
+ Warning.warn(e.message)
42
+ find_by_label(location.label)
43
+ end
44
+
45
+ private
46
+
47
+ attr_reader :locations
48
+ end
49
+ end
50
+ end
51
+ end
@@ -4,11 +4,11 @@ module StructuraidCore
4
4
  module Engineering
5
5
  module Locations
6
6
  class CoordinatesSystem < Base
7
- attr_reader :relative_locations, :axis_1
7
+ attr_reader :relative_locations, :axis_1, :anchor_location
8
8
 
9
- def initialize(anchor_location:, relative_locations: [])
9
+ def initialize(anchor_location:)
10
10
  @anchor_location = anchor_location
11
- @relative_locations = relative_locations
11
+ @relative_locations = Collection.new
12
12
  @axis_1 = Vector[1.0, 0.0, 0.0]
13
13
  @axis_3 = Vector[0.0, 0.0, 1.0]
14
14
  end
@@ -19,13 +19,28 @@ module StructuraidCore
19
19
  end
20
20
 
21
21
  def add_location(relative_location)
22
- relative_locations << relative_location
22
+ relative_locations.add(relative_location)
23
+ end
24
+
25
+ def add_location_from_vector(vector, label:)
26
+ relative_location = Relative.from_vector(vector, label:)
27
+ add_location(relative_location)
28
+ end
29
+
30
+ def find_or_add_location_from_vector(vector, label:)
31
+ relative_location = Relative.from_vector(vector, label:)
32
+
33
+ relative_locations.find_or_add_by_label(relative_location)
23
34
  end
24
35
 
25
36
  def axis_2
26
37
  axis_3.cross_product axis_1
27
38
  end
28
39
 
40
+ def find_location(label)
41
+ relative_locations.find_by_label(label)
42
+ end
43
+
29
44
  private
30
45
 
31
46
  attr_reader :axis_3
@@ -4,20 +4,33 @@ module StructuraidCore
4
4
  module Engineering
5
5
  module Locations
6
6
  class Relative < Base
7
- attr_reader :value_1, :value_2, :value_3
7
+ attr_reader :label
8
+ attr_accessor :value_1, :value_2, :value_3
8
9
 
9
- def self.from_matrix(matrix)
10
+ def self.from_vector(vector, label: nil)
11
+ new(
12
+ value_1: vector[0],
13
+ value_2: vector[1],
14
+ value_3: vector[2],
15
+ label:
16
+ )
17
+ end
18
+
19
+ def self.from_matrix(matrix, label: nil)
10
20
  new(
11
21
  value_1: matrix[0, 0],
12
22
  value_2: matrix[1, 0],
13
- value_3: matrix[2, 0]
23
+ value_3: matrix[2, 0],
24
+ label:
14
25
  )
15
26
  end
16
27
 
17
- def initialize(value_1:, value_2:, value_3:)
28
+ def initialize(value_1:, value_2:, value_3:, label: nil)
18
29
  @value_1 = value_1.to_f
19
30
  @value_2 = value_2.to_f
20
31
  @value_3 = value_3.to_f
32
+
33
+ @label = label&.to_sym
21
34
  end
22
35
 
23
36
  def to_matrix
@@ -0,0 +1,13 @@
1
+ module StructuraidCore
2
+ module Engineering
3
+ module Locations
4
+ class DuplicateLabelError < StandardError
5
+ def initialize(label)
6
+ message = "location with label: #{label} already exists"
7
+
8
+ super(message)
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -2,11 +2,12 @@ module StructuraidCore
2
2
  module Loads
3
3
  class PointLoad < Base
4
4
  attr_accessor :value
5
- attr_reader :location
5
+ attr_reader :location, :label
6
6
 
7
- def initialize(value:, location:)
7
+ def initialize(value:, location:, label: nil)
8
8
  @value = value.to_f
9
9
  @location = location
10
+ @label = label&.to_sym
10
11
  end
11
12
  end
12
13
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module StructuraidCore
4
- VERSION = '0.1.3'
4
+ VERSION = '0.2.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: structuraid_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pradaing
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-03-15 00:00:00.000000000 Z
11
+ date: 2023-04-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: byebug
@@ -158,17 +158,32 @@ files:
158
158
  - lib/structuraid_core/db/base.rb
159
159
  - lib/structuraid_core/db/rebars.yml
160
160
  - lib/structuraid_core/design_codes/aci_318_19/rc/elastic_modulus.rb
161
+ - lib/structuraid_core/design_codes/aci_318_19/rc/footings/bending_reinforcement_ratio.rb
161
162
  - lib/structuraid_core/design_codes/aci_318_19/rc/footings/min_height.rb
163
+ - lib/structuraid_core/design_codes/aci_318_19/rc/footings/one_way_shear_capacity.rb
164
+ - lib/structuraid_core/design_codes/aci_318_19/rc/footings/punching_critical_section_perimeter.rb
162
165
  - lib/structuraid_core/design_codes/aci_318_19/rc/footings/punching_shear_capacity.rb
166
+ - lib/structuraid_core/design_codes/aci_318_19/rc/minimum_steel_cover.rb
167
+ - lib/structuraid_core/design_codes/aci_318_19/rc/reduction_factor.rb
163
168
  - lib/structuraid_core/design_codes/base.rb
164
169
  - lib/structuraid_core/design_codes/nsr_10/rc/elastic_modulus.rb
170
+ - lib/structuraid_core/design_codes/nsr_10/rc/footings/bending_reinforcement_ratio.rb
165
171
  - lib/structuraid_core/design_codes/nsr_10/rc/footings/min_height.rb
172
+ - lib/structuraid_core/design_codes/nsr_10/rc/footings/one_way_shear_capacity.rb
173
+ - lib/structuraid_core/design_codes/nsr_10/rc/footings/punching_critical_section_perimeter.rb
166
174
  - lib/structuraid_core/design_codes/nsr_10/rc/footings/punching_shear_capacity.rb
175
+ - lib/structuraid_core/design_codes/nsr_10/rc/minimum_steel_cover.rb
176
+ - lib/structuraid_core/design_codes/nsr_10/rc/reduction_factor.rb
167
177
  - lib/structuraid_core/design_codes/resolver.rb
168
178
  - lib/structuraid_core/design_codes/schemas/empty_schema.rb
169
179
  - lib/structuraid_core/design_codes/schemas/rc/elastic_modulus_schema.rb
180
+ - lib/structuraid_core/design_codes/schemas/rc/footings/bending_reinforcement_ratio_schema.rb
170
181
  - lib/structuraid_core/design_codes/schemas/rc/footings/min_height_schema.rb
182
+ - lib/structuraid_core/design_codes/schemas/rc/footings/one_way_shear_capacity_schema.rb
183
+ - lib/structuraid_core/design_codes/schemas/rc/footings/punching_critical_section_perimeter_schema.rb
171
184
  - lib/structuraid_core/design_codes/schemas/rc/footings/punching_shear_capacity_schema.rb
185
+ - lib/structuraid_core/design_codes/schemas/rc/minimum_steel_cover_schema.rb
186
+ - lib/structuraid_core/design_codes/schemas/rc/reduction_factor_schema.rb
172
187
  - lib/structuraid_core/design_codes/utils/code_requirement.rb
173
188
  - lib/structuraid_core/design_codes/utils/schema_definition.rb
174
189
  - lib/structuraid_core/elements/base.rb
@@ -181,10 +196,17 @@ files:
181
196
  - lib/structuraid_core/elements/reinforcement/straight_longitudinal.rb
182
197
  - lib/structuraid_core/elements/reinforcement/straight_longitudinal_layer.rb
183
198
  - lib/structuraid_core/elements/reinforcement/utils/rebar_data.rb
199
+ - lib/structuraid_core/engineering/analysis/footing/base.rb
200
+ - lib/structuraid_core/engineering/analysis/footing/centric_combined_two_columns.rb
184
201
  - lib/structuraid_core/engineering/analysis/footing/centric_isolated.rb
202
+ - lib/structuraid_core/engineering/analysis/footing/utils/basic_geometry.rb
203
+ - lib/structuraid_core/engineering/analysis/footing/utils/centroid.rb
204
+ - lib/structuraid_core/engineering/analysis/footing/utils/one_way_moment.rb
205
+ - lib/structuraid_core/engineering/analysis/footing/utils/one_way_shear.rb
185
206
  - lib/structuraid_core/engineering/base.rb
186
207
  - lib/structuraid_core/engineering/locations/absolute.rb
187
208
  - lib/structuraid_core/engineering/locations/base.rb
209
+ - lib/structuraid_core/engineering/locations/collection.rb
188
210
  - lib/structuraid_core/engineering/locations/coordinates_system.rb
189
211
  - lib/structuraid_core/engineering/locations/relative.rb
190
212
  - lib/structuraid_core/errors/base.rb
@@ -193,6 +215,7 @@ files:
193
215
  - lib/structuraid_core/errors/design_codes/unknown_design_code_error.rb
194
216
  - lib/structuraid_core/errors/design_codes/unrecognized_value_error.rb
195
217
  - lib/structuraid_core/errors/engineering/analysis/section_direction_error.rb
218
+ - lib/structuraid_core/errors/engineering/locations/duplicate_label_error.rb
196
219
  - lib/structuraid_core/errors/reinforcement/empty_layers.rb
197
220
  - lib/structuraid_core/errors/reinforcement/invalid_distribution_direction.rb
198
221
  - lib/structuraid_core/loads/base.rb