thelfer / tfel

Main repository of TFEL/MFront project
https://thelfer.github.io/tfel/web/index.html
Other
88 stars 40 forks source link

[Miscellaneous] Is a library a MFront library? #641

Open OlivierFandeur opened 2 weeks ago

OlivierFandeur commented 2 weeks ago

Find out if a library has been built by MFront. If so, then give the list of laws/behaviours that can be used in this library,

Idea: MFront puts in the library a function, which, if it exists, gives the list of laws/behaviours? Available for different OS (Linux, Windows, MacOS ...) and can be called in C or Fortran inside a code (e.g. castem).

thelfer commented 2 weeks ago

Hi @OlivierFandeur, This feature is already provided by the tfel::system::ExternalLibraryManager:

    /*!
     * \return the list of all mfront generated entry points
     * in a library.
     * \param[in] l: library name
     */
    std::vector<std::string> getEntryPoints(const std::string&);
    /*!
     * \return the material knowledge type of an entry point in a
     * library. The returned value has the following meaning:
     * - 0: material property
     * - 1: behaviour
     * - 2: model
     * \param[in] l: library name
     */
    unsigned short getMaterialKnowledgeType(const std::string&,
                                            const std::string&);

There is currently no bindings for C or fortran. Those features are known to work on Mac Os and Linux. I never tested it on windows.

thelfer commented 2 weeks ago

The question is: would you want to link against TFEL/System ? I don't have any example of solver directly using TFEL/System which is currently used only internally.

Anyway, you may want to have a look at the mfm utility: https://thelfer.github.io/tfel/web/mfm.html which leverages TFEL/System to do something very similar to your needs

thelfer commented 1 week ago

@OlivierFandeur It works with tfel compiler with Visual Studio

> mfm .\src\Release\Behaviour.dll
- Plasticity

However, it does not work with icx and mingw:

c>mfm Behaviour.dll