Thanks. I am gradually getting in the swing of things.bernd wrote: ↑Wed Oct 10, 2018 9:36 am @HarryvL: this may bei helpful too in the regbard of adding new command to FreeCAD FEM git commit 7d7a02e
OOFem
Moderator: bernd
Forum rules
and Helpful information for the FEM forum
and Helpful information for the FEM forum
Re: OOFem
Re: OOFem
OK this all works now for a dummy file. So far so good. Next the task of writing FC data in OOFEM input formatbernd wrote: ↑Mon Oct 08, 2018 8:19 pm branch assess looks good to me. To get it first started I would go for the following.
- in module src/Mod/Fem/femsolver/oofem/writer.py define a string testinputfile = ''' an simple complete oofem input file '''
- in method def write_OOFEM_input(self): ( https://github.com/HarryvL/FreeCAD/blob ... py#L64-L81 ) you gone write the string testinputfile
- means no matter what FreeCAD analysis for objects has, if it has an oofem solver object in any case your testinputfile will be written.
- With this you can test if the new solver object works at all.
- if it works you can start to step by step implement the writer for oofem which does write the real FreeCAD object data to the oofem input file.
Hope you got my point. It is just an idea, how I did it when I mplemented the Z88.
Re: OOFem
calculix cantilever is a good example and we will need it anyway as a official example for the new solver. see startwb, we have it for all three solvers in new solver frame work example.
Re: OOFem
There is another one you should keep in mind. All FEM python code is pep8 compatible. You can check easily by running the following command in your FreeCAD source tree.
Code: Select all
find src/Mod/Fem/ -name "*\.py" | grep -v convert2TetGen.py | grep -v InitGui.py | grep -v TestFem.py | xargs -I [] flake8 --ignore=E501,E265,E266,E402 []
Re: OOFem
Thanks. Are there any good references about the architecture of FreeCAD? I mean the philosophy and implementation of C++ and Python class structure. It feel it would help speed up understanding of where and how methods and attributes are defined and perhaps more importantly when NOT to worry about this and just apply a method or data structure in a confident and predictable manner.
Re: OOFem
As far as I can tell the best way is to read the source and just do your thing, make a pull request (as small as possible) and the gurus will tell you if that's OK or not. "git grep" + basic understanding how C++ works (headers, definitions, inheritance) is really a powerful tool. I know sometimes it would be better to read a doc i.e. "How to add a new command to a workbench", but instead you can check git log for commit that added a new command and you'll see all required changes in one place.
I also recommend using text editor that can run flake8/pep8 tests on file save - you get immediate feedback if your code formatting is OK.
I also recommend using text editor that can run flake8/pep8 tests on file save - you get immediate feedback if your code formatting is OK.
Re: OOFem
Thanks !PrzemoF wrote: ↑Thu Oct 11, 2018 7:52 am As far as I can tell the best way is to read the source and just do your thing, make a pull request (as small as possible) and the gurus will tell you if that's OK or not. "git grep" + basic understanding how C++ works (headers, definitions, inheritance) is really a powerful tool. I know sometimes it would be better to read a doc i.e. "How to add a new command to a workbench", but instead you can check git log for commit that added a new command and you'll see all required changes in one place.
I also recommend using text editor that can run flake8/pep8 tests on file save - you get immediate feedback if your code formatting is OK.
Re: OOFem
there is no coding standard in FreeCAD. I know just one, which is used in any workbench. Use spaces and no tabs.
As I wrote, in FEM we use pep8 compliant code. Since I have done most Python development in the last two years I check this on any new code. Means if you would like to have your code merged into FreeCAD FEM it is highly possible it has to pass my eyes before it gets merged and I will for sure check if it is pep8 compliant.
Thus runing flake8 from time to time while you are developing makes sence.
BTW: since I'm highly interested in this integrateion I will for sure try your new solver and have a look at the code before you are ready for a PR
bernd
As I wrote, in FEM we use pep8 compliant code. Since I have done most Python development in the last two years I check this on any new code. Means if you would like to have your code merged into FreeCAD FEM it is highly possible it has to pass my eyes before it gets merged and I will for sure check if it is pep8 compliant.
Thus runing flake8 from time to time while you are developing makes sence.
BTW: since I'm highly interested in this integrateion I will for sure try your new solver and have a look at the code before you are ready for a PR
bernd
Re: OOFem
no pressure Harrybernd wrote: ↑Thu Oct 11, 2018 10:33 am there is no coding standard in FreeCAD. I know just one, which is used in any workbench. Use spaces and no tabs.
As I wrote, in FEM we use pep8 compliant code. Since I have done most Python development in the last two years I check this on any new code. Means if you would like to have your code merged into FreeCAD FEM it is highly possible it has to pass my eyes before it gets merged and I will for sure check if it is pep8 compliant.
Thus runing flake8 from time to time while you are developing makes sence.
BTW: since I'm highly interested in this integrateion I will for sure try your new solver and have a look at the code before you are ready for a PR
bernd