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

Fixes #2263 #2264

Conversation

msevestre
Copy link
Member

Fixes #2263

Description

@PavelBal @Yuri05 Removing this weird check that does not make much sense to me at this stage. I am ok with replacing a parameter with another parameter if it comes from the spatial structure definition. Resolving of all references is done at a later stage and trying to make it work (or understand why it does not) is a waste of time IMO since this constraint is overkilled in the first place

Type of change

Please mark relevant options with an x in the brackets.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires documentation changes (link at least one user or developer documentation issue):
  • Algorithm update - updates algorithm documentation/questions/answers etc.
  • Other (please describe):

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Integration tests
  • Unit tests
  • Manual tests
  • No tests required

Reviewer checklist

Mark everything that needs to be checked before merging the PR.

  • Check if the code is well documented
  • Check if the behavior is what is expected
  • Check if the code is well tested
  • Check if the code is readable and well formatted
  • Additional checks (document below if any)
  • Check if documentation update issue(s) are created if the option This change requires a documentation update above is selected

Screenshots (if appropriate):

Questions (if appropriate):

}
else if (!formulasAreTheSameForParameter(existingParameter, helpParameter.Formula, molecule.Name))
throw new OSPSuiteException(Error.HelpParameterAlreadyDefinedWithAnotherFormula(calculationMethod.Name, _objectPathFactory.CreateAbsoluteObjectPath(helpParameter).ToString()));
if (existingParameter != null)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Parameter exists in the simulation? Then we remove it and add the one from the CM

Copy link
Member

@PavelBal PavelBal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't review the code.

{
return !_allBlackBoxParameters.Contains(parameter);
}
private bool parameterIsNotBlackBoxParameter(IParameter parameter) => !_allBlackBoxParameters.Contains(parameter);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if just checking for parameter.Formula.IsBlackBox() here is not more performant than caching all black box parameters from the model into _allBlackBoxParameters and checking if a parameter is in that list every time
(Because when caching, parameter.Formula.IsBlackBox() is called for every model parameter anyway; and the function parameterIsNotBlackBoxParameter() is called only once per parameter and only for the calculation methods parameters)

Apart from that looks good for me.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

COuld be. I don't want to change the code that does not need change to fix the issue.

@msevestre msevestre merged commit fc66a8a into develop Jun 18, 2024
1 check passed
@msevestre msevestre deleted the 2263-cannot-create-a-simulation-from-bbs-after-opening-a-v11-project branch June 18, 2024 16:26
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

Successfully merging this pull request may close these issues.

Cannot create a simulation from BBs after opening a V11 project
3 participants