FEM mesh: Create mesh groups in Python (exposing C++ functions to Python)

About the development of the FEM module/workbench.

Moderator: bernd

User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: FEM mesh: Create mesh groups in Python (exposing C++ functions to Python)

Post by bernd »

exactly ... Try a million cells, it still works fine, but post processing and input file writing (especially for multiple materials) could take very long. All FEM in FreeCAD is not optimized on this.
joha2
Posts: 303
Joined: Tue Oct 11, 2016 9:48 pm

Re: FEM mesh: Create mesh groups in Python (exposing C++ functions to Python)

Post by joha2 »

bernd wrote: Fri Feb 07, 2020 7:39 am bump
:D any news here? :D
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: FEM mesh: Create mesh groups in Python (exposing C++ functions to Python)

Post by bernd »

ohh my godness ...

rebased you work on master. hopefully I did not delete anything. This is what we have so far ... https://github.com/berndhahnebach/FreeC ... aa1fdd452c on branch https://github.com/berndhahnebach/FreeC ... /femgroups

Would you just check?

cheers bernd
joha2
Posts: 303
Joined: Tue Oct 11, 2016 9:48 pm

Re: FEM mesh: Create mesh groups in Python (exposing C++ functions to Python)

Post by joha2 »

bernd wrote: Fri May 22, 2020 9:37 am ohh my godness ...
:mrgreen: :D :D
bernd wrote: Fri May 22, 2020 9:37 am Would you just check?
Hey bernd,

hope you're doing well in these times!
I've checked the comparisons quickly and it seems that all is there. One small thing I saw in the tests:
https://github.com/berndhahnebach/FreeC ... sh.py#L562
Shouldn't that be something like TestMeshGroups in that string?

Best wishes
Johannes
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: FEM mesh: Create mesh groups in Python (exposing C++ functions to Python)

Post by bernd »

quite buisy at the moment, but without family on the weekend thus time for sitting all the time in front of the computer making sports having beer :D

git commit f90a88ce3c

good things want to have a while :D

How about some unit tests for the reading group methods? :oops:
joha2
Posts: 303
Joined: Tue Oct 11, 2016 9:48 pm

Re: FEM mesh: Create mesh groups in Python (exposing C++ functions to Python)

Post by joha2 »

bernd wrote: Sat May 23, 2020 1:03 pm quite buisy at the moment, but without family on the weekend thus time for sitting all the time in front of the computer making sports having beer :D
Hehe nice one! How come that you are alone this weekend only with beer and sports and computer? :mrgreen:
bernd wrote: Sat May 23, 2020 1:03 pm git commit f90a88ce3c
good things want to have a while :D
:mrgreen: Yeah! But thanks for fast merging! :D :D
bernd wrote: Sat May 23, 2020 1:03 pm How about some unit tests for the reading group methods? :oops:
Sorry, I don't understand: What do you mean by reading group methods? But yes, once I figured out what you mean, it's definitely on my TODO list to write more tests. I would put them into the class TestMeshGroups. Is this OK for you?

I really have to catch up again in FreeCAD development. I didn't update my fork for months :oops:

Best wishes and stay safe
Johannes
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: FEM mesh: Create mesh groups in Python (exposing C++ functions to Python)

Post by bernd »

joha2 wrote: Sat May 23, 2020 1:57 pm
bernd wrote: Sat May 23, 2020 1:03 pm quite buisy at the moment, but without family on the weekend thus time for sitting all the time in front of the computer making sports having beer :D
Hehe nice one! How come that you are alone this weekend only with beer and sports and computer? :mrgreen:
the grandparents are happy to see their grand child and child for the first time since corona started. They are a few hundred km away.

joha2 wrote: Sat May 23, 2020 1:57 pm
bernd wrote: Sat May 23, 2020 1:03 pm How about some unit tests for the reading group methods? :oops:
Sorry, I don't understand: What do you mean by reading group methods? But yes, once I figured out what you mean, it's definitely on my TODO list to write more tests. I would put them into the class TestMeshGroups. Is this OK for you?
the methods for reading group mesh data out of the mesh do not have unit tests. They could just be made similar to the once you made for editing group mesh data in the same module.
joha2
Posts: 303
Joined: Tue Oct 11, 2016 9:48 pm

Re: FEM mesh: Create mesh groups in Python (exposing C++ functions to Python)

Post by joha2 »

bernd wrote: Sat May 23, 2020 5:04 pm the grandparents are happy to see their grand child and child for the first time since corona started. They are a few hundred km away.
Ah nice! When do they come back? Right after the weekend or are they there for a whole week? I haven't seen my parents for months, too. This whole corona thing sucks! :evil:
bernd wrote: Sat May 23, 2020 5:04 pm the methods for reading group mesh data out of the mesh do not have unit tests. They could just be made similar to the once you made for editing group mesh data in the same module.
OK, I found them: `getGroupElementType` and `getGroupElements' as well as `addGroupElements` do not have tests. What about a `removeGroupElements`? Yeah I think, that was on my agenda, but I forgot :mrgreen:

Best wishes
Johannes
joha2
Posts: 303
Joined: Tue Oct 11, 2016 9:48 pm

Re: FEM mesh: Create mesh groups in Python (exposing C++ functions to Python)

Post by joha2 »

bernd wrote: Sat May 23, 2020 5:04 pm the methods for reading group mesh data out of the mesh do not have unit tests. They could just be made similar to the once you made for editing group mesh data in the same module.
After solving the compiling issue, I checked the mesh groups unit tests and found out that:
  • test_add_groups checks 'addGroup', 'getGroupName', 'getGroupElementType'
  • test_delete_groups checks checks 'GroupCount', 'removeGroup"
  • test_add_group_elements check 'addGroupElements' and 'getGroupElements'
But these are basically more functions than I implemented (addGroup, removeGroup, addGroupElements). So I'm afraid that I don't know which unit tests are missing :oops:

Best wishes
Johannes
Post Reply