structuraid_core 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +3 -0
  3. data/.rubocop.yml +38 -0
  4. data/CHANGELOG.md +5 -0
  5. data/CODE_OF_CONDUCT.md +84 -0
  6. data/Gemfile +2 -0
  7. data/Guardfile +5 -0
  8. data/LICENSE +21 -0
  9. data/LICENSE.txt +21 -0
  10. data/README.md +37 -0
  11. data/Rakefile +12 -0
  12. data/lib/structuraid_core/db/base.rb +13 -0
  13. data/lib/structuraid_core/db/rebars.yml +36 -0
  14. data/lib/structuraid_core/design_codes/aci_318_19/rc/elastic_modulus.rb +17 -0
  15. data/lib/structuraid_core/design_codes/base.rb +15 -0
  16. data/lib/structuraid_core/design_codes/nsr_10/rc/elastic_modulus.rb +17 -0
  17. data/lib/structuraid_core/design_codes/resolver.rb +21 -0
  18. data/lib/structuraid_core/design_codes/schemas/empty_schema.rb +12 -0
  19. data/lib/structuraid_core/design_codes/schemas/rc/elastic_modulus_schema.rb +14 -0
  20. data/lib/structuraid_core/design_codes/utils/code_requirement.rb +39 -0
  21. data/lib/structuraid_core/design_codes/utils/schema_definition.rb +56 -0
  22. data/lib/structuraid_core/elements/base.rb +10 -0
  23. data/lib/structuraid_core/elements/column/base.rb +10 -0
  24. data/lib/structuraid_core/elements/column/rectangular.rb +16 -0
  25. data/lib/structuraid_core/elements/footing.rb +83 -0
  26. data/lib/structuraid_core/elements/reinforcement/base.rb +14 -0
  27. data/lib/structuraid_core/elements/reinforcement/rebar.rb +45 -0
  28. data/lib/structuraid_core/elements/reinforcement/rebar_hook.rb +18 -0
  29. data/lib/structuraid_core/elements/reinforcement/straight_longitudinal.rb +44 -0
  30. data/lib/structuraid_core/elements/reinforcement/straight_longitudinal_layer.rb +89 -0
  31. data/lib/structuraid_core/elements/reinforcement/utils/rebar_data.rb +14 -0
  32. data/lib/structuraid_core/engineering/analysis/footing/centric_isolated.rb +60 -0
  33. data/lib/structuraid_core/engineering/base.rb +10 -0
  34. data/lib/structuraid_core/engineering/locations/absolute.rb +19 -0
  35. data/lib/structuraid_core/engineering/locations/base.rb +11 -0
  36. data/lib/structuraid_core/engineering/locations/relative.rb +15 -0
  37. data/lib/structuraid_core/engineering/vector.rb +35 -0
  38. data/lib/structuraid_core/errors/base.rb +12 -0
  39. data/lib/structuraid_core/errors/design_codes/missing_param_error.rb +9 -0
  40. data/lib/structuraid_core/errors/design_codes/unknown_design_code_error.rb +11 -0
  41. data/lib/structuraid_core/errors/engineering/analysis/section_direction_error.rb +13 -0
  42. data/lib/structuraid_core/errors/reinforcement/empty_layers.rb +13 -0
  43. data/lib/structuraid_core/errors/reinforcement/invalid_distribution_direction.rb +13 -0
  44. data/lib/structuraid_core/loads/base.rb +9 -0
  45. data/lib/structuraid_core/loads/point_load.rb +13 -0
  46. data/lib/structuraid_core/loads/uniform_load.rb +15 -0
  47. data/lib/structuraid_core/materials/base.rb +10 -0
  48. data/lib/structuraid_core/materials/concrete.rb +13 -0
  49. data/lib/structuraid_core/materials/soil.rb +11 -0
  50. data/lib/structuraid_core/materials/steel.rb +14 -0
  51. data/lib/structuraid_core/version.rb +5 -0
  52. data/lib/structuraid_core.rb +14 -0
  53. data/sig/structuraid_core.rbs +4 -0
  54. data/structuraid_core.gemspec +50 -0
  55. metadata +212 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 3be903647819b8980e89e0f8e1e984c3696735a254d10cc8de3a8928d56dac88
4
+ data.tar.gz: d8c3b1c9b7aa1a8adf9d0edf4c82210c49ee2813bd9c309de0ec296018438231
5
+ SHA512:
6
+ metadata.gz: 4ea5df93f54fb0c95583a88c8b1006f89ca5cdd69b50f952d00361980b2fe350be17883b762ce67151a111ad0a0d7b714e3562e6a2d45bede013308f780bad86
7
+ data.tar.gz: 8403c78e6ea124d31d38e87a6fbe2731f957acc8974337586c8c340ab847360f8426ce05b770740c3bd7ab858cb8c6d99213b59bb82bdd00e7cf2824987428c9
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,38 @@
1
+ require:
2
+ - rubocop-rspec
3
+
4
+ AllCops:
5
+ TargetRubyVersion: 3.1.2
6
+
7
+ Style/FrozenStringLiteralComment:
8
+ Enabled: false
9
+
10
+ convention:Style/Documentation:
11
+ Enabled: false
12
+
13
+ Style/OptionalBooleanParameter:
14
+ Enabled: false
15
+
16
+ Metrics/MethodLength:
17
+ Max: 15
18
+
19
+ RSpec/BlockLength:
20
+ Enabled: false
21
+
22
+ RSpec/MultipleMemoizedHelpers:
23
+ Enabled: false
24
+
25
+ RSpec/NestedGroups:
26
+ Enabled: false
27
+
28
+ Lint/MissingSuper:
29
+ Enabled: false
30
+
31
+ Naming/VariableNumber:
32
+ Enabled: false
33
+
34
+ Metrics/ParameterLists:
35
+ Enabled: false
36
+
37
+ Style/IfUnlessModifier:
38
+ Enabled: false
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2023-03-12
4
+
5
+ - Initial release
@@ -0,0 +1,84 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or
22
+ advances of any kind
23
+ * Trolling, insulting or derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information, such as a physical or email
26
+ address, without their explicit permission
27
+ * Other conduct which could reasonably be considered inappropriate in a
28
+ professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
+
34
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
+
36
+ ## Scope
37
+
38
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
+
40
+ ## Enforcement
41
+
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at mapra99@gmail.com. All complaints will be reviewed and investigated promptly and fairly.
43
+
44
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
+
46
+ ## Enforcement Guidelines
47
+
48
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
+
50
+ ### 1. Correction
51
+
52
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
+
54
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
+
56
+ ### 2. Warning
57
+
58
+ **Community Impact**: A violation through a single incident or series of actions.
59
+
60
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
+
62
+ ### 3. Temporary Ban
63
+
64
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
+
66
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
+
68
+ ### 4. Permanent Ban
69
+
70
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
+
72
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
73
+
74
+ ## Attribution
75
+
76
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
+ available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
+
79
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
+
81
+ [homepage]: https://www.contributor-covenant.org
82
+
83
+ For answers to common questions about this code of conduct, see the FAQ at
84
+ https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
data/Guardfile ADDED
@@ -0,0 +1,5 @@
1
+ guard :rspec, cmd: 'rspec' do
2
+ watch(%r{^spec/.+_spec\.rb$})
3
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
4
+ watch('spec/spec_helper.rb') { 'spec' }
5
+ end
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 PradaIng
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2023 Miguel Prada
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,37 @@
1
+ # Core
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/core`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Install the gem and add to the application's Gemfile by executing:
10
+
11
+ $ bundle add core
12
+
13
+ If bundler is not being used to manage dependencies, install the gem by executing:
14
+
15
+ $ gem install core
16
+
17
+ ## Usage
18
+
19
+ TODO: Write usage instructions here
20
+
21
+ ## Development
22
+
23
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
24
+
25
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
26
+
27
+ ## Contributing
28
+
29
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/core. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/core/blob/main/CODE_OF_CONDUCT.md).
30
+
31
+ ## License
32
+
33
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
34
+
35
+ ## Code of Conduct
36
+
37
+ Everyone interacting in the Core project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/core/blob/main/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require 'rubocop/rake_task'
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ task default: %i[spec rubocop]
@@ -0,0 +1,13 @@
1
+ require 'yaml'
2
+
3
+ module StructuraidCore
4
+ module DB
5
+ module Base
6
+ STANDARD_REBAR = YAML.load_file('lib/structuraid_core/db/rebars.yml')
7
+
8
+ def self.find_standard_rebar(number:)
9
+ STANDARD_REBAR.find { |rebar_data| rebar_data['number'] == number }
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,36 @@
1
+ - number: 18
2
+ diameter: 57.3
3
+ linear_mass: 20.137
4
+ - number: 14
5
+ diameter: 43.0
6
+ linear_mass: 20.137
7
+ - number: 11
8
+ diameter: 35.8
9
+ linear_mass: 20.137
10
+ - number: 10
11
+ diameter: 32.2
12
+ linear_mass: 20.137
13
+ - number: 9
14
+ diameter: 28.7
15
+ linear_mass: 20.137
16
+ - number: 8
17
+ diameter: 25.4
18
+ linear_mass: 20.137
19
+ - number: 7
20
+ diameter: 22.2
21
+ linear_mass: 20.137
22
+ - number: 6
23
+ diameter: 19.1
24
+ linear_mass: 20.137
25
+ - number: 5
26
+ diameter: 15.9
27
+ linear_mass: 20.137
28
+ - number: 4
29
+ diameter: 12.7
30
+ linear_mass: 20.137
31
+ - number: 3
32
+ diameter: 9.5
33
+ linear_mass: 20.137
34
+ - number: 2
35
+ diameter: 6.4
36
+ linear_mass: 20.137
@@ -0,0 +1,17 @@
1
+ module StructuraidCore
2
+ module DesignCodes
3
+ module ACI31819
4
+ module RC
5
+ class ElasticModulus
6
+ include DesignCodes::Utils::CodeRequirement
7
+ use_schema DesignCodes::Schemas::RC::ElasticModulusSchema
8
+
9
+ # ACI 318-19 19.2.2.1
10
+ def call
11
+ 4700 * Math.sqrt(params.design_compression_strength)
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,15 @@
1
+ module StructuraidCore
2
+ module DesignCodes
3
+ class Base
4
+ end
5
+ end
6
+ end
7
+
8
+ require 'require_all'
9
+ require_relative 'utils/code_requirement'
10
+ require_relative 'utils/schema_definition'
11
+ require_all 'lib/structuraid_core/design_codes/schemas'
12
+ require_all 'lib/structuraid_core/design_codes/nsr_10'
13
+ require_all 'lib/structuraid_core/design_codes/aci_318_19'
14
+ require_all 'lib/structuraid_core/errors/design_codes'
15
+ require_relative 'resolver'
@@ -0,0 +1,17 @@
1
+ module StructuraidCore
2
+ module DesignCodes
3
+ module NSR10
4
+ module RC
5
+ class ElasticModulus
6
+ include DesignCodes::Utils::CodeRequirement
7
+ use_schema DesignCodes::Schemas::RC::ElasticModulusSchema
8
+
9
+ # NSR-10 C.8.5.1
10
+ def call
11
+ 4700 * Math.sqrt(params.design_compression_strength)
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,21 @@
1
+ # See https://pradaing.notion.site/Design-Codes-System-238dd1a6357a4b958f82e2cd7a51dd47 for usage
2
+
3
+ module StructuraidCore
4
+ module DesignCodes
5
+ class Resolver < Base
6
+ CODES_NAMESPACES = {
7
+ 'nsr_10' => DesignCodes::NSR10,
8
+ 'aci_318_19' => DesignCodes::ACI31819
9
+ }.freeze
10
+
11
+ class << self
12
+ def use(code_name)
13
+ code_abstraction = CODES_NAMESPACES[code_name]
14
+ raise DesignCodes::UnknownDesignCodeError, code_name if code_abstraction.nil?
15
+
16
+ code_abstraction
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,12 @@
1
+ module StructuraidCore
2
+ module DesignCodes
3
+ module Schemas
4
+ class EmptySchema
5
+ include DesignCodes::Utils::SchemaDefinition
6
+
7
+ required_params []
8
+ optional_params []
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,14 @@
1
+ module StructuraidCore
2
+ module DesignCodes
3
+ module Schemas
4
+ module RC
5
+ class ElasticModulusSchema
6
+ include DesignCodes::Utils::SchemaDefinition
7
+
8
+ required_params %i[design_compression_strength]
9
+ optional_params []
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,39 @@
1
+ module StructuraidCore
2
+ module DesignCodes
3
+ module Utils
4
+ module CodeRequirement
5
+ def self.included(base)
6
+ base.class_eval do
7
+ extend ClassMethods
8
+
9
+ attr_reader :params
10
+ end
11
+ end
12
+
13
+ def initialize(params)
14
+ @params = params
15
+ end
16
+
17
+ module ClassMethods
18
+ def call(params = {})
19
+ schema_klass.validate!(params)
20
+ sanitized_params = schema_klass.structurize(params)
21
+
22
+ obj = new(sanitized_params)
23
+ obj.call
24
+ end
25
+
26
+ def schema_klass
27
+ @schema_klass
28
+ end
29
+
30
+ private
31
+
32
+ def use_schema(schema_klass)
33
+ @schema_klass = schema_klass
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,56 @@
1
+ module StructuraidCore
2
+ module DesignCodes
3
+ module Utils
4
+ module SchemaDefinition
5
+ def self.included(base)
6
+ base.class_eval do
7
+ extend ClassMethods
8
+ end
9
+ end
10
+
11
+ module ClassMethods
12
+ def validate!(params)
13
+ required.each do |required_param|
14
+ raise DesignCodes::MissingParamError, required_param if params[required_param].nil?
15
+ end
16
+
17
+ optional.each do |optional_param|
18
+ raise DesignCodes::MissingParamError, optional_param if params[optional_param].nil?
19
+ rescue DesignCodes::MissingParamError => e
20
+ Warning.warn(e.message)
21
+ end
22
+
23
+ true
24
+ end
25
+
26
+ def structurize(params)
27
+ structured_args_names = [*required, *optional]
28
+ structured_klass = Struct.new(*structured_args_names, :schema, keyword_init: true)
29
+ sliced_params = params.slice(*structured_args_names)
30
+ sliced_params.merge!(schema: name)
31
+
32
+ structured_klass.new(sliced_params)
33
+ end
34
+
35
+ def required
36
+ @required
37
+ end
38
+
39
+ def optional
40
+ @optional
41
+ end
42
+
43
+ private
44
+
45
+ def required_params(params)
46
+ @required = params
47
+ end
48
+
49
+ def optional_params(params)
50
+ @optional = params
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,10 @@
1
+ module StructuraidCore
2
+ module Elements
3
+ class Base
4
+ end
5
+ end
6
+ end
7
+
8
+ require_relative 'column/base'
9
+ require_relative 'reinforcement/base'
10
+ require_relative 'footing'
@@ -0,0 +1,10 @@
1
+ module StructuraidCore
2
+ module Elements
3
+ module Column
4
+ class Base
5
+ end
6
+ end
7
+ end
8
+ end
9
+
10
+ require_relative 'rectangular'
@@ -0,0 +1,16 @@
1
+ module StructuraidCore
2
+ module Elements
3
+ module Column
4
+ class Rectangular < Base
5
+ attr_reader :length_x, :length_y, :height, :material
6
+
7
+ def initialize(length_x:, length_y:, height:, material:)
8
+ @length_x = length_x.to_f
9
+ @length_y = length_y.to_f
10
+ @height = height.to_f
11
+ @material = material
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,83 @@
1
+ module StructuraidCore
2
+ module Elements
3
+ class Footing < Base
4
+ attr_accessor :length_1, :length_2, :height, :material, :cover_lateral, :cover_top, :cover_bottom
5
+ attr_reader :longitudinal_top_reinforcement_length_1,
6
+ :longitudinal_bottom_reinforcement_length_1,
7
+ :longitudinal_top_reinforcement_length_2,
8
+ :longitudinal_bottom_reinforcement_length_2
9
+
10
+ VALID_SECTIONS = %i[length_1 length_2].freeze
11
+
12
+ def initialize(
13
+ length_1:,
14
+ length_2:,
15
+ height:,
16
+ material:,
17
+ cover_lateral:,
18
+ cover_top:,
19
+ cover_bottom:,
20
+ longitudinal_top_reinforcement_length_1: nil,
21
+ longitudinal_bottom_reinforcement_length_1: nil,
22
+ longitudinal_top_reinforcement_length_2: nil,
23
+ longitudinal_bottom_reinforcement_length_2: nil
24
+ )
25
+ @length_1 = length_1.to_f
26
+ @length_2 = length_2.to_f
27
+ @height = height.to_f
28
+ @material = material
29
+ @cover_lateral = cover_lateral.to_f
30
+ @cover_top = cover_top.to_f
31
+ @cover_bottom = cover_bottom.to_f
32
+ @longitudinal_top_reinforcement_length_1 = longitudinal_top_reinforcement_length_1
33
+ @longitudinal_bottom_reinforcement_length_1 = longitudinal_bottom_reinforcement_length_1
34
+ @longitudinal_top_reinforcement_length_2 = longitudinal_top_reinforcement_length_2
35
+ @longitudinal_bottom_reinforcement_length_2 = longitudinal_bottom_reinforcement_length_2
36
+ @main_section = :length_1
37
+ end
38
+
39
+ def horizontal_area
40
+ @length_1 * @length_2
41
+ end
42
+
43
+ def effective_height(section_direction:, above_middle:)
44
+ case section_direction
45
+ when :length_1
46
+ length_1_section_effective_area(above_middle:)
47
+ when :length_2
48
+ length_2_section_effective_area(above_middle:)
49
+ end
50
+ end
51
+
52
+ private
53
+
54
+ def aspect_ratio
55
+ @length_1 / @length_2
56
+ end
57
+
58
+ def length_1_section_effective_area(above_middle:)
59
+ if above_middle
60
+ return nil unless @longitudinal_top_reinforcement_length_1
61
+
62
+ @longitudinal_top_reinforcement_length_1.centroid_height
63
+ else
64
+ return nil unless @longitudinal_bottom_reinforcement_length_1
65
+
66
+ @height - @longitudinal_bottom_reinforcement_length_1.centroid_height
67
+ end
68
+ end
69
+
70
+ def length_2_section_effective_area(above_middle:)
71
+ if above_middle
72
+ return nil unless @longitudinal_top_reinforcement_length_2
73
+
74
+ @longitudinal_top_reinforcement_length_2.centroid_height
75
+ else
76
+ return nil unless @longitudinal_bottom_reinforcement_length_2
77
+
78
+ @height - @longitudinal_bottom_reinforcement_length_2.centroid_height
79
+ end
80
+ end
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,14 @@
1
+ module StructuraidCore
2
+ module Elements
3
+ module Reinforcement
4
+ class Base
5
+ end
6
+ end
7
+ end
8
+ end
9
+
10
+ require_relative 'utils/rebar_data'
11
+ require_relative 'rebar_hook'
12
+ require_relative 'rebar'
13
+ require_relative 'straight_longitudinal'
14
+ require_relative 'straight_longitudinal_layer'