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

show methods #8

Merged
merged 6 commits into from
Sep 6, 2019
Merged

show methods #8

merged 6 commits into from
Sep 6, 2019

Conversation

TeroFrondelius
Copy link
Member

@TeroFrondelius TeroFrondelius commented Jul 19, 2019

Here is the updated usage example:

julia> b = load("data/libBehaviour.so","Norton", mbv.Tridimensional)
behaviour Norton in shared library data/libBehaviour.so for modelling hypothesis Tridimensional generated from Norton.mfront using TFEL version: 3.3.0-dev.

julia> d = BehaviourData(b)
MFrontInterface.behaviour.BehaviourDataAllocated(Ptr{Nothing} @0x0000000002a50610)

julia> get_internal_state_variables(get_initial_state(d))
7-element RealsVector
 0.0
 0.0
 0.0
 0.0
 0.0
 0.0
 0.0


julia> get_parameters(b)
11-element StringsVector
 epsilon
 YoungModulus
 PoissonRatio
 RelativeValueForTheEquivalentStressLowerBoundDefinition
 K
 E
 A
 minimal_time_step_scaling_factor
 maximal_time_step_scaling_factor
 theta
 numerical_jacobian_epsilon


julia> get_external_state_variables(b)
1-element VariablesVector
 Temperature


julia> 

@thelfer here is an example of overloading Base.show function to get nicer interactive user experience. You know the internals better, is there something we should add or remove? I would like to use get_parameters, but I couldn't figured out how to use it. Can you help me creating another method for another type?

@TeroFrondelius
Copy link
Member Author

@IvanYashchuk let's focus the MFront Julia development in this package. I'm using this package to connect MFront to JuliaFEM. If you already experienced it would be really cool to get you onboard developing this further. Please feel free to open issues/pull request to get the development forward.

@thelfer
Copy link

thelfer commented Aug 26, 2019

@TeroFrondelius Sorry for the delay. Does Base.show provide a short or detailled description of the object ? If it is a short description, then I would somehow invert the first and second line as follows:

julia> b = load("data/libBehaviour.so","ParameterTest", mbv.Tridimensional)
behaviour ParameterTest in shared library Behaviour for modelling hypothesis Tridimensional
generated from ParameterTest.mfront using TFEL version: 3.3.0-dev

If a detailled description is more suitable, one shall discuss this because a detailled description can be quite long..

Thomas

@TeroFrondelius
Copy link
Member Author

Does Base.show provide a short or detailled description of the object ?

I think the possibilities are endless. Here are some examples: https://docs.julialang.org/en/v1/base/io-network/#Base.IOContext. I don't have earlier experience, but my idea is to make user interactive usage as easy and intuitive as possible.

@TeroFrondelius
Copy link
Member Author

@thelfer what method I should use to dick into the BehaviourDataAllocated? I think it would be cool to show something in this first version, we can make it perfect later on.

@thelfer
Copy link

thelfer commented Sep 3, 2019

@TeroFrondelius BehaviourData is nothing really interesting per se.
I would simply write:

data associated with behavior <name of the behaviour> in library <...>

The name of the behaviour can be retrieved for the behaviour object

@TeroFrondelius
Copy link
Member Author

@TeroFrondelius BehaviourData is nothing really interesting per se.
I would simply write:

data associated with behavior <name of the behaviour> in library <...>

The name of the behaviour can be retrieved for the behaviour object

I would eventually like to build a way to dig the data interactively in the REPL session. As an example, instead of writing:

julia> get_internal_state_variables(get_initial_state(d))
7-element RealsVector
 0.0
 0.0
 0.0
 0.0
 0.0
 0.0
 0.0

Maybe we should have something like this:

julia> d.internal_state_variables[0]
7-element RealsVector, time = 0.0
 0.0
 0.0
 0.0
 0.0
 0.0
 0.0
 0.0

Thus in my mind printing the BehaviourData structure would help users/developers to more easily understand the data model and its usage.

@IvanYashchuk
Copy link
Collaborator

Maybe we should have something like this:

julia> d.internal_state_variables[0]
7-element RealsVector, time = 0.0
 0.0
 0.0
 0.0
 0.0
 0.0
 0.0
 0.0

It seems that this kind of functionality is not yet implemented in CxxWrap.jl
JuliaInterop/CxxWrap.jl#90

@TeroFrondelius TeroFrondelius merged commit 622d708 into master Sep 6, 2019
@TeroFrondelius
Copy link
Member Author

I merged these changes. If I will do more show methods I will open a new pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants