pygeo icon indicating copy to clipboard operation
pygeo copied to clipboard

DVConstraints evalFunctions inconsistent passing of references + values

Open bbrelje opened this issue 5 years ago • 1 comments

Description

When evalFunctions and evalFunctionsSens is called for each type of constraint, one of two things happens. Either a fresh set of values is returned back to the dict() with all the constraints in it, or a reference to an existing array (which may have been present at previous iterations).

For example, the ThicknessConstraint always passes a reference to a FRESH array of values, whereas the CircularityConstraint passes a reference to the same array each time. If the dict() is manipulated outside, it can affect the internal values. Alternatively, a user may inadvertently save a result from a previous iteration without realizing it's a live reference which can be changed later on. I discovered this will writing reg tests for the circularity constraint.

Should probably be made consistent but this may produce breaking behavior in very few edge cases where people are relying on the current reference behavior.

Code versions

List versions only if relevant

  • Python

bbrelje avatar Oct 25 '20 00:10 bbrelje

I think this is probably worthwhile bringing up for discussion, and if everyone is on board we should absolutely make this consistent and documented.

ewu63 avatar Oct 26 '20 14:10 ewu63