Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

AbstractState struct #23

Open
longemen3000 opened this issue Sep 23, 2022 · 0 comments
Open

AbstractState struct #23

longemen3000 opened this issue Sep 23, 2022 · 0 comments

Comments

@longemen3000
Copy link
Contributor

when using PropsSI, a new abstract state is created with each call. one option would be to do something like:

mutable struct AbstractState #mutable, to register finalizers
  handle::Clong
  function AbstractState(x::Integer)
    res = new(Clong(x))
    finalizer(AbstractState_free,res) #register finalizer, to free up memory when `AbstractState` goes out of scope
    return res
  end
end

function AbstractState_free(x::AbstractState)
  return AbstractState_free(x.handle)
end

function PropsSI(val1,prop1,val2,prop2,fluid::AbstractState)
  # do low level call, fluid is mutated
end
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant