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

Error when import plantfem in python #319

Open
HowcanoeWang opened this issue Jan 10, 2022 · 2 comments
Open

Error when import plantfem in python #319

HowcanoeWang opened this issue Jan 10, 2022 · 2 comments

Comments

@HowcanoeWang
Copy link

HowcanoeWang commented Jan 10, 2022

if meshtype.lower()=="Bar1D" :

image

The python grammar doesn't allow if condition without contents, please fix this by adding a pass or mute this if condition:

    # meshtype="None" should be put in the end
    def create(this,x_num,y_num,x_len,y_len,Le,Lh,Dr,thickness, \
        division,smooth,top,margin,inclineRate,shaperatio,master,\
        slave,x,y,z,dx,dy,dz,coordinate,meshtype="None",):   
        if meshtype.lower()=="Bar1D" :
            # initialize
            # this = Mesh()
            pass
@kazulagi
Copy link
Owner

Thank you for your comment, and sorry for my late reply.
I feel your advice is helpful.

Honestly, I don't have any clear plan for our python-API (so the whole structure of it are destructively changed month by month).
I realize the importance of the API for python users. But recently I'm focusing on implementing Fortran parts and it is difficult to use the time for designing the python-API.
I would be grateful if you suggests any designs, test codes, or UIs for python users.

@kazulagi
Copy link
Owner

kazulagi commented Mar 24, 2022

There are some possible methodologies to implement python-API for our library.

  • (1) Directly calling from python
    We can call Fortran from python by F2PY, which hopefully activates all Fortran-subroutines from python.
    However, it is technically difficult to use classes/structs of Fortran library from Python, which prevent us from taking this strategy.

  • (2) Generating Fortran code from python and build & run
    It is the most realistic and straightforward way.
    I experimentally implemented an API at https://github.com/kazulagi/plantFEM/blob/master/plantfem.py
    But, this implementation has following problems.
    (2-a): It crushes when it is called in the interactive mode.
    (2-b): It uses shell, so Windows user cannot use it.
    (2-c); It still lacks a concrete and wholistic design.

  • (3) Creating web-API
    I'm trying to create web-API for this library using FastAPI. It might be an better approach.

Repository owner deleted a comment from gy20121221 Apr 21, 2022
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

No branches or pull requests

2 participants