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

add generic solver #1

Open
4 tasks
looooo opened this issue Dec 1, 2016 · 58 comments
Open
4 tasks

add generic solver #1

looooo opened this issue Dec 1, 2016 · 58 comments

Comments

@looooo
Copy link
Owner

looooo commented Dec 1, 2016

TODO

  • investigate how other solvers are implemented +++
  • implement a new solver type +
  • add a solver selection to the solver (category ?) ++
  • write interface to existing constraints (constraints to dict) +++

proposal

@joha2
Copy link

joha2 commented Dec 1, 2016

I have no own fork of FreeCAD. I just could fork from your's. But I am rather unexperienced with branching. Could you shortly outline a typical workflow, if I only want to work on your generical solver proposal branch? (My other project is only a python workbench, so there's no interference with the FreeCAD repo necessary.)

Uh, nevermind. Maybe I should have read http://www.freecadweb.org/wiki/index.php?title=Source_code_management :-)

@looooo
Copy link
Owner Author

looooo commented Dec 2, 2016

Good article. How far did you come? I would do like this:

  1. fork with github

  2. clone your fork

  3. add freecad master as upstream

  4. add my branch as sidestream :-)
    5.a.1. checkout the generic solver branch
    5.a.2. checkout a new branch where you want to write code
    alternitive
    5.b.1 checkout a new branch where you want to write code
    5.b.2 reset this branch on the sidestream/genericSolver

  5. make changes to the code

  6. push to github (simple with git push, there will be a message how to upload the branch)

  7. make a pull request with github (you can choose on which branch, directly freecad master or my branch or any other...)

I could also add you as a contributer to this repository, but I think it's not possible to give access only to one branch. So I think it's better to take the pullrequest approach. This is maybe a bit more difficult for you, but it's the way how developers at freecad work, so maybe it's a good idea to learn it anyway. And once you have worked a bit with git, it's not difficult anymore...

@joha2
Copy link

joha2 commented Dec 2, 2016

Thank you for the introduction. I didn't understand the reset branch step at 5.b.2. Could you please explain that part shortly? I have no problem with the pullrequest approach. I think the contributor approach is only useful for a small project. And you're right: I have to learn it anyway sometime. My first pull request will only contribute to your proposal document anyway so I cannot mess up the code ;-)

@looooo
Copy link
Owner Author

looooo commented Dec 2, 2016

Somehow I have messed with the lists...

if you have created a branch you can simple reset the branch by the state of another branch.
git reset upstream/master (or whatever branch) Sometimes this will fail. but if you want to have a local branch that looks exactly the same as any other branch you can pass the --hard option.

"git checkout -b new_branch" creates a new branch which is identical to the previously active branch.

@joha2
Copy link

joha2 commented Dec 2, 2016

OK, I had your branch and created my own with git checkout -b 'genericsolver_joha'. afterwards i renamed the file due to a typo in the filename and did git commit -a -m 'file renamed'. then i did git push and he told me that everything is up to date, although i changed the file. what did I do wrong?

@looooo
Copy link
Owner Author

looooo commented Dec 2, 2016

what was the message at git commit -a -m ? normally you have to add a new (renamed) file with "git add file_name"
Ah I see, you are on a good way :-)

@joha2
Copy link

joha2 commented Dec 2, 2016

git commit -a -m 'msg' adds all changed files to a commit and puts msg on that commit. now with the push i did git push --all -u now there are two branches on my fork: genericsolver_joha and genericSolver. is this correct?

@joha2
Copy link

joha2 commented Dec 2, 2016

now i will delete my branch here at github. if i want to have the newest changes to your branch i have to do: git fetch loooo/genericSolver? then git checkout -b mynewestchanges and git commit -a -m, git push --all -u. then at some point pullrequest, commit commit commit, and after merge delete the branch mynewestchanges again. same game again and again?

@looooo
Copy link
Owner Author

looooo commented Dec 2, 2016

hmm, never used that command. "git push --all -u" most likely will add all your local branches to github. I don't think this is what you wanted. But it's no problem to delete a branch on github... "git branch -D branch_name"
"git push -u" would have been enough.

I have merged your commit. There were actually 2 commits. The one you have made and one merge-commit. Next time I will try to avoid this. I think there is also an option to use re-basing as merge-strategy..., which will lead to a cleaner history

@looooo
Copy link
Owner Author

looooo commented Dec 2, 2016

you do not have to delete your branch.

after fetching you can do this:
git rebase looooo/genericSolver

this will add all my commits to your current branch. (but at the moment the branches are the same. so nothin will happen)

@joha2
Copy link

joha2 commented Dec 2, 2016

hm I still don't understood it. too much new things to learn :D could you please show me an appropriate workflow loop (from update from your branch to pull request and to be ready for the next workflow loop)? my git behaves also strange or somehow different than yours :-( sorry that i ask these dumb questions, but i only contributed to a small project where pull requests only without branching are sufficient :-(

@looooo
Copy link
Owner Author

looooo commented Dec 2, 2016

ok I have now rebased on freecad/master. So you can try to update your branch:

git checkout your_branch
git rebase looooo/genericSolver
git push origin +genericsolver_joha  #(the + is necessary, I don't know why, but it's always necessary for rebasing, maybe because rebasing can be dangerous :-)

now you add things, change stuff ...

git add .
git commit -a -m "message"
git push

and then do a pull-request... thats all.

@joha2
Copy link

joha2 commented Dec 2, 2016

oh oh, somehow the last file rename has been vanished. ok, i'll try your loop and see if it works. thanks btw. for writing all this stuff down :D

@joha2
Copy link

joha2 commented Dec 2, 2016

ok now you can see my second pull request: but there are conflicts. i don't understand why.
:-(

@looooo
Copy link
Owner Author

looooo commented Dec 2, 2016

Somehow your first commit is not there anymore. Maybe you rebase your local branch on my branch again.

@joha2
Copy link

joha2 commented Dec 2, 2016

just the rebase command or do i also have to perform the command with push origin +genericsolver_joha?

@looooo
Copy link
Owner Author

looooo commented Dec 3, 2016

I have merged your pull request manually. What I have done is the following:

git remote add joha "your_branch"
git fetch joha
git checkout joha/genericSolver_joha
git checkout -b temp_branch
git rebase origing/genericSolver
# checked the log 
git log
# git very nice :-)
git checkout genericSolver
git reset temp_branch
git push origin +genericSolver

That would be the way how you could have done it.
Now you should look to sync with my branch. Maybe it's best to delete your branch and create a new to not mess up somethings again :-) Or simple "git reset looooo/genericSolver" should also work.
Updating your github branch with "git push origin +genericSolver_joha".

Yesterday I wanted to compile freecad, but I have big troubles with that at the moment. Especially as we need the netgen/occt7 package for fem... And there are so many other new things... I will try to get anaconda builds updated first and then go on with this branch.

@looooo
Copy link
Owner Author

looooo commented Dec 3, 2016

I am also messing around a bit :-) I have renamed your commit, because there was the "rename file" twice. Hopefully this is ok. You can edit commits with "git rebase -i HEAD~2" where 2 is the number of commits you want to go back to make changes. With this you can edit commit messages and join commits. But this all is a bit dangerous when there is some bigger work involved. So trying it out first on a temp_branch makes always sense.

@joha2
Copy link

joha2 commented Dec 3, 2016

Thanks for repairing my mess :-). My main problem is, that i don't understand most of the commands really. And reading in the git help doesn't help because there are too much information and no simple examples (it's getting to difficult for an unexperienced user). Anyway i also set up a new freecad clone within my docker image with fenics and have to finish compiling, therefore there is no hurry necessary :-) but i certainly will ask a few questions about the workflow: e.g. is our workflow to only have two (genericSolver and genericsolver_joha) branches and do pull-requests from one to another or do i have to create a new branch for every changeset i'll intend to do?

@joha2
Copy link

joha2 commented Dec 3, 2016

Now on my docker I merged my local genericsolver_joha branch from your looooo/genericSolver branch and got 38 commits from files which are in other parts of FreeCAD. is that correct? did you a merge from the FreeCAD master?
I am sceptics with the rebase command. Why not that way:

  1. git checkout genericsolver_joha (switch to my local genericsolver_joha branch)
  2. git fetch looooo (fetch your changes)
  3. git merge looooo/genericSolver (merge your genericSolver branch with my genericsolver_joha branch)
  4. git push (now my online repo origin/genericsolver_joha and my local branch genericsolver_joha are equal to your genericSolver branch)
  5. do work: vim proposal.md, add files git commit -a -m 'my work'
  6. git push (now my online repo and my local branch deviate from your's)
  7. pullrequest joha2/genericsolver_joha -> loooo/genericSolver
  8. you accept the pullrequest and all is good

i think this works because we are only two developers. as far as i understood performing rebase in my branch from your branch is ok, but the other way around is not ok. is this correct?

@joha2
Copy link

joha2 commented Dec 3, 2016

Ah now I see: Your branch is 41 commits behind FreeCAD/master and i forked from FreeCAD/master. Therefore the large difference.

@looooo
Copy link
Owner Author

looooo commented Dec 3, 2016

hmm i have rebased on freecad/master yesterday. So there shouldn't be that much commits between these branches.

regarding merge vs rebase: Doesn't git merge add a merge commit message?

I have rebased again.
git diff FreeCAD/master shows only proposal stuff. So this branch should be up to date right now.

i think this works because we are only two developers. as far as i understood performing rebase in my branch from your branch is ok, but the other way around is not ok. is this correct?

The pull-request on github has the option to merge with a rebase. That is was I wanted for your first pull request. But I have choosen merge, and then there was this merge commit, which is not really necessary. So I think rebasing my branch on yours if you are some commit in front of my branch isn't a problem.

@joha2
Copy link

joha2 commented Dec 3, 2016

yes, but i didn't push yet. i wanted to know your opinion for that first.
As you can see, i made a pull request: But it is still strange. Now there 5 files changed, which is just not correct. It's very complicated to find an appropriate workflow :-(

@joha2
Copy link

joha2 commented Dec 3, 2016

Ah ok, now we are equal. The pull request clearly shows. And this is how it should be.
So i also could substitute the merge by a rebase? Is this correct?

@looooo
Copy link
Owner Author

looooo commented Dec 3, 2016

I am wondering what your last pull-request was all about. All commits are already in the commit history of my branch.

rebase is better, beause there is no merge commit.

@joha2
Copy link

joha2 commented Dec 4, 2016

The last pullrequest was only a test. I wanted to make sure that we are at the same starting point. Sorry for that i am learning the git basics in our forks :-( :-)

@looooo
Copy link
Owner Author

looooo commented Dec 4, 2016

No problem. But there is something wrong with your branch. Maybe you simply reset it with my branch: 'git reset looooo/genericSolver' then these two branches are definetly equal without additional merge commits. It could be my fault that the branches diverged that much.... But if you have a clean commit history (no unnecessary merge commits) I could simply accept the pullrequest via github, and we wouldn't have any problems. Maybe this was the problem.

@joha2
Copy link

joha2 commented Dec 4, 2016

ok. i performed the the git reset status, but my git informed me that my branch is 17 commits behind origin/genericsolver_joha. it asked me to perform a git pull to be up-to-date. is this correct?

@joha2
Copy link

joha2 commented Dec 12, 2016

I had not that much luck. My graphics driver seems to segfault when I start FreeCAD within the docker image. I have to further investigate this issue. Meanwhile I will have a look at your code ;-).

@joha2
Copy link

joha2 commented Dec 12, 2016

OK now it works also for me. Time to go to bed ;-).

Would it make sense to open a Wiki here at your fork again (at least for persistent information)? I would like to share my information about setting up a docker image. Maybe it would also be useful for others if you would share your setup information for the anaconda repo.

@looooo
Copy link
Owner Author

looooo commented Dec 13, 2016

nice to hear you have figured out the problem.

Would it make sense to open a Wiki
yes that is a good idea. writing the proposal as a wiki article would have been the better solution.

@looooo
Copy link
Owner Author

looooo commented Dec 13, 2016

another issue with isatty:
importing fenics from the freecad console works, but importing fenics inside of a file in fem workbench shows a window with a text "isatty".
After importing fenics manually from console, switching to fem workbench works.

@joha2
Copy link

joha2 commented Dec 13, 2016

Perhaps FreeCAD and fenics expect different boolean values from isatty. Could you show me a picture of this issue?

@looooo
Copy link
Owner Author

looooo commented Dec 13, 2016

isatty

As a workaround we could do something like FreeCADGui.doCommand("import fenics").

@joha2
Copy link

joha2 commented Dec 13, 2016

Strange! Where does the change of the workbench "Wechsel von Arbeitsbereich" take place in the source? I grepped through the source and found some VC9 comments about isatty. But nothing which fits into our problem.

@looooo
Copy link
Owner Author

looooo commented Dec 13, 2016

I think the traceback is partially reported to this window. Tested the workaround, and it also isn't working. Placing this in the file gives the same error:

import sys
sys.stdout.isatty()

In the freecad-console sys.stdout has no autocompletion for isatty. So there is maybe something wrong with the implementation I have made.

@joha2
Copy link

joha2 commented Dec 13, 2016

Can you please give me a link to your correction?

@looooo
Copy link
Owner Author

looooo commented Dec 13, 2016

6d726c9

@joha2
Copy link

joha2 commented Dec 13, 2016

Looks correct. Maybe there is some other registering instance? Maybe wernerh could help us in the forum?

@looooo
Copy link
Owner Author

looooo commented Dec 13, 2016

ahh, the console report errors in the console. So this works. But the file in the fem-wb is sending the messages to the reportview.

Docs of OutputStdout

* Python class for redirection of stdout to FreeCAD's output
 * console window. This allows to report all Python output to
 * the output window which simplifies debugging scripts.

so the isatty function must implemented for these classes too.

@joha2
Copy link

joha2 commented Dec 13, 2016

Sorry, I don't get it. For which classes you also have to implement the isatty() method?

@looooo
Copy link
Owner Author

looooo commented Dec 13, 2016

sorry for my unclear message.
here: src/Gui/PythonConsolePy L94 and L116

@joha2
Copy link

joha2 commented Dec 13, 2016

Did it work? :-)

@looooo
Copy link
Owner Author

looooo commented Dec 13, 2016

My workflow with conda is a bit time intensive. At the moment there is no way for me to build only changed files for freecad. So I have to compile the full source all the time something changed in c++. As I forgot some things (like adding files to CMakeList.txt) I had to build several times. This is a bit frustrating. So I had no chance to try the fix yet, but I am pretty sure the additional isatty function will solve the issue.
If I have time I will try to understand your docker workflow. Maybe this is the better approach to develop stuff for FreeCAD.

@joha2
Copy link

joha2 commented Dec 13, 2016

Yeah sounds frustrating! The docker workflow is also rather complicated I think. This is because you only have this sandbox and you have to mess around with access permission a lot. At the moment the description is more or less "hingerotzt", so maybe it is not that useful. But If you have problems from this description, we could still improve it. Now I have the git problem again: So maybe I will as a first step just clone your source and try to compile it. :-)

@looooo
Copy link
Owner Author

looooo commented Dec 13, 2016

instead of cloning:

git fetch looooo
git checkout looooo/genericSolver
git checkout -b cloneOfGenericSolver

Btw. There is another error with the added files.
https://github.com/looooo/FreeCAD/blob/genericSolver/src/Mod/Fem/CMakeLists.txt#L106#L109
these lines should be removed.

looooo pushed a commit that referenced this issue Oct 17, 2018
pull bot pushed a commit that referenced this issue Mar 19, 2020
4th-axis fixes and improvements
pull bot pushed a commit that referenced this issue Apr 25, 2020
Path: Fix `ZigZag` pattern; Remove some comments
pull bot pushed a commit that referenced this issue May 18, 2020
Path: Extend fix to `updateVisibility()`
pull bot pushed a commit that referenced this issue Oct 5, 2020
pull bot pushed a commit that referenced this issue Feb 11, 2021
Fixes Coverity issue:
CID 316539 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR)
uninit_member: Non-static class member lastHasPartialRedundancies is not initialized in this constructor nor in any functions that it calls.
pull bot pushed a commit that referenced this issue Feb 21, 2021
Coverity warnings fixed:

CID 316517 (#1 of 1): Uninitialized scalar variable (UNINIT)
13. uninit_use_in_call: Using uninitialized value t. Field t.err is uninitialized when calling push_back

CID 316519 (#1 of 1): Uninitialized scalar variable (UNINIT)
3. uninit_use_in_call: Using uninitialized value v. Field v.tstart is uninitialized when calling push_back

CID 316547 (#1 of 1): Uninitialized scalar variable (UNINIT)
13. uninit_use_in_call: Using uninitialized value t. Field t.err is uninitialized when calling push_back

CID 316556 (#1 of 1): Uninitialized scalar variable (UNINIT)
3. uninit_use_in_call: Using uninitialized value v. Field v.tstart is uninitialized when calling push_back
pull bot pushed a commit that referenced this issue Feb 21, 2021
Coverity warnings fixed:

CID 316550 (#1 of 1): Uninitialized scalar variable (UNINIT)
13. uninit_use_in_call: Using uninitialized value sel. Field sel.pResolvedObject is uninitialized when calling push_back
pull bot pushed a commit that referenced this issue Feb 21, 2021
Coverity warnings fixed:

CID 316559 (#1 of 1): Uninitialized scalar variable (UNINIT)
3. uninit_use_in_call: Using uninitialized value we. Field we.idx is uninitialized when calling push_back

CID 316549 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR)
4. uninit_member: Non-static class member pageheight is not initialized in this constructor nor in any functions that it calls.

CID 186161 (#1 of 1): Uninitialized pointer field (UNINIT_CTOR)
2. uninit_member: Non-static class member parent is not initialized in this constructor nor in any functions that it calls.

CID 305170 (#1 of 1): Dereference before null check (REVERSE_INULL)
check_after_deref: Null-checking this->m_baseFeat suggests that it may be null, but it has already been dereferenced on all paths leading to the check.

CID 186152 (#2 of 2): Uninitialized pointer field (UNINIT_CTOR)
3. uninit_member: Non-static class member m_mdi is not initialized in this constructor nor in any functions that it calls.

CID 192588 (#1 of 1): Same on both sides (CONSTANT_EXPRESSION_RESULT)
pointless_expression
pull bot pushed a commit that referenced this issue Feb 21, 2021
Coverity warnings fixed:

CID 305123 (#1 of 1): Logically dead code (DEADCODE)
dead_error_line: Execution cannot reach the expression this->linked inside this statement: if (role == Qt::TextColorRole && linked)
pull bot pushed a commit that referenced this issue Feb 21, 2021
Coverity warnings fixed:

CID 129530 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR)
2. uninit_member: Non-static class member pixelScalingFactor is not initialized in this constructor nor in any functions that it calls.
pull bot pushed a commit that referenced this issue Aug 23, 2021
Prevent matplotlib selecting the PyQt API instead of PySide2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants