Skip to content

Conversation

@mortenengen
Copy link
Member

@mortenengen mortenengen commented Dec 13, 2022

Continuation from #5.

First attempt to refactor concrete:

  • one abstract class and then subclasses for each design code
  • new implementation on how attributes are used: by default they assume a None value. If overwritten by user, will use the new values
  • added optional description/name for materials and concrete. Default behaviors for names are defined
  • created a factory function that creates the proper type of concrete based on the code wanted (the active global one or another specified by user)

Example usage:

import structuralcodes
from structuralcodes.material.concrete import create_concrete

# We can also create a specific class of material if needed
from structuralcodes.material.concrete import ConcreteMC2010

structuralcodes.set_design_code('mc2010')

# Create a concrete material with the active design code
c25 = create_concrete(25)

print('fcm = ', c25.fcm)
print('fctm = ', c25.fctm)
print('fctkmin = ', c25.fctkmin)

# We can override a quantity (useful for existing materials probably)
c25.fctm = 2.0
print('updated material\n', 'fctm = ', c25.fctm)

# If we want we can reset it to default values computed by MC2010
c25.fck = 25
print('restored material\n', 'fctm = ', c25.fctm)

# We can also create a material with a given code (not the used active one)
c25 = create_concrete(25, design_code='mc2010')
print('fcm = ', c25.fcm)

# We can also create a specific object of the specific concrete class
c30mc = ConcreteMC2010(30)
print('fcm of the new specific instance: ', c30mc.fcm)

# A new existing concrete object
c30ex = ConcreteMC2010(30, existing=True)
# For now this commands raises a not implemented exception

TO BE DONE STILL:

  • split the class in more files (for now it is all in a single concrete.py file): one file for abstract class and factory function + one file for each concrete implementation for the different codes
  • add tests
  • some more value checking in the setters of properties in concrete
  • improve docstrings (sphinx format is ok?)

mortenengen and others added 2 commits December 13, 2022 21:01
Co-authored-by: talledodiego <38036285+talledodiego@users.noreply.github.com>
@mortenengen mortenengen added the enhancement New feature or request label Dec 13, 2022
mortenengen and others added 5 commits January 17, 2023 13:42
- included tests for Concrete MC2010 class (and its base classes)
- small bugfix on concrete creation facotry
Co-authored-by: talledodiego <38036285+talledodiego@users.noreply.github.com>
Co-authored-by: talledodiego <38036285+talledodiego@users.noreply.github.com>
@talledodiego talledodiego marked this pull request as ready for review January 31, 2023 16:04
@mortenengen mortenengen merged commit a578f04 into dev Jan 31, 2023
@mortenengen mortenengen deleted the concrete-class branch January 31, 2023 19:37
@mortenengen mortenengen restored the concrete-class branch January 31, 2023 19:45
@mortenengen mortenengen added this to the Framework milestone Jun 13, 2023
@mortenengen mortenengen removed this from the Framework milestone Sep 27, 2023
@mortenengen mortenengen deleted the concrete-class branch June 6, 2024 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: Done 🚀

Development

Successfully merging this pull request may close these issues.

Add material classes for concrete and reinforcement for MC2020 Add material classes for concrete and reinforcement for EC2

3 participants