Giter VIP home page Giter VIP logo

Comments (4)

HugoMVale avatar HugoMVale commented on August 25, 2024 1

Ok, got it.

2nd iteration: we take the logic currently used to deliver the order p, but instead return a derived data type called properties with all we might need:

type :: properties
    integer :: p
    integer :: ncache
    character(:), allocatable ::  name
    ...
end type

We add a get_properties method to rk_class (which will replace the order method for variable step methods)

type,abstract,public :: rk_class
...
procedure(properties_func), deferred :: get_properties
end type

For each method, we define a properties function (replacing what is done today for order):

pure module function rkbs32_properties(me) result(res)
    implicit none
    class(rkbs32_class), intent(in) :: me
    type(properties) :: res
end function rkbs32_properties

and update rklib_variable_orders accordingly:

submodule(rklib_module) rklib_properties
implicit none
contains
    module procedure rkbs32_properties
        !! Returns the properties of the [[rkbs32]] method
        res%p = 3
        res%ncache = 1
       res%name = "rkbs32: Bogacki-Shampine 3(2) method"
    end procedure rkbs32_order
...

I suppose this would work because it is just an extension/generalization of what is done currently.

from rklib.

jacobwilliams avatar jacobwilliams commented on August 25, 2024 1

This is a good idea. I'm going to work on it.

Actually, I'm working on a script to generate all this boilerplate code (interfaces, include files, etc.) automatically. I can add these to that. So we just specify the properties of the methods in a table and the code is autogenerated by a python script.

from rklib.

jacobwilliams avatar jacobwilliams commented on August 25, 2024

There are some problems with that though. For example the value of p is used in the stepping algorithm, so it needs to be able to get the value from all the methods. As a type-bound procedure, it is always available, If it was just a variable in all the extended classes, we would have to add a million select type (me); class is (...) statements to access it, which seems not ideal.

If we put these variable in the abstract class, then we'd need to set their values in some initialization step, which also would probably mean a select type there. So neither way seems great.

from rklib.

HugoMVale avatar HugoMVale commented on August 25, 2024

Addressed in #24.

from rklib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.