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

A bug related to data type #532

Open
tkrisnguyen opened this issue Dec 7, 2024 · 1 comment
Open

A bug related to data type #532

tkrisnguyen opened this issue Dec 7, 2024 · 1 comment
Labels
elements Elements related issues enhancement New feature or request interfaces

Comments

@tkrisnguyen
Copy link
Contributor

I found a bug below and don't know how to fix in ONSAS code. Please help me. Thank you in advance!

using ONSAS
n1 = Node(1.2, 2.3, 3.4)
n2 = Node(2, 3, 4)    # Although I can fix this line as n2=Node(2.,3.,4.), it does not seems natural to represent an integer by a real value
S = Rectangle(0.6, 0.3)
frame1 = Frame(n1, n2, S) # The error appeared as ERROR: MethodError: no method matching Frame(::Node{3, Int64}, ::Node{3, Float64}, ::Rectangle{Float64})
@mvanzulli mvanzulli added enhancement New feature or request interfaces elements Elements related issues labels Dec 7, 2024
@mvanzulli
Copy link
Member

mvanzulli commented Dec 7, 2024

I see the error seems to be that the constructor of Frame expects a Vector of nodes where all nodes have the same type T:

  function Frame(n₁::N, n₂::N, g::G, mass_matrix::MassMatrix = Consistent,
        label::Label = NO_LABEL) where {N <: AbstractNode, G <: AbstractCrossSection}
    Frame(SVector(n₁, n₂), g, mass_matrix, label)
end

There is always a trade-off of how much we want to support this kind of nice to have things on the ONSAS side or in your script. If u see value, you can fix by defining a different node types in the constructor (which are parametric on the numeric type of each node coordinates:

function Frame(n1::N1, n2::N2, g::G, mass_matrix::MassMatrix = Consistent,
        label::Label = NO_LABEL) where {
        N1 <: AbstractNode, N2 <: AbstractNode, G <: AbstractCrossSection}
    Frame(SVector(n1, n2), g, mass_matrix, label)
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
elements Elements related issues enhancement New feature or request interfaces
Projects
None yet
Development

No branches or pull requests

2 participants