[OptApp / SIApp] Updating the Expressions to TensorAdaptors#14214
[OptApp / SIApp] Updating the Expressions to TensorAdaptors#14214sunethwarna merged 124 commits intomasterfrom
Conversation
| # model part | ||
| return self.model_part.GetRootModelPart() | ||
|
|
||
| def __ExtractTensorData(self, variable, tensor_adaptor: Kratos.TensorAdaptors.DoubleTensorAdaptor, nodes_container: Kratos.NodesArray) -> Kratos.TensorAdaptors.DoubleTensorAdaptor: |
There was a problem hiding this comment.
Why do you need this function ? And what it does? I can't follow. Add please some doc
There was a problem hiding this comment.
Added comments. Could you please check if it is descriptive enough?
There was a problem hiding this comment.
__ExtractShapeUpdateFromDesignSurface() ???
May be we can add the check that it is used only in combination with SHAPE_VAR ? I guess it is not required for other variables ?
There was a problem hiding this comment.
Can we avoid general names in the variables like tensor_adaptor and have more specific ones like, shape_update ?
|
@Igarizza I addressed all of your comments. could you check? |
| # model part | ||
| return self.model_part.GetRootModelPart() | ||
|
|
||
| def __ExtractTensorData(self, variable, tensor_adaptor: Kratos.TensorAdaptors.DoubleTensorAdaptor, nodes_container: Kratos.NodesArray) -> Kratos.TensorAdaptors.DoubleTensorAdaptor: |
There was a problem hiding this comment.
__ExtractShapeUpdateFromDesignSurface() ???
May be we can add the check that it is used only in combination with SHAPE_VAR ? I guess it is not required for other variables ?
| # model part | ||
| return self.model_part.GetRootModelPart() | ||
|
|
||
| def __ExtractTensorData(self, variable, tensor_adaptor: Kratos.TensorAdaptors.DoubleTensorAdaptor, nodes_container: Kratos.NodesArray) -> Kratos.TensorAdaptors.DoubleTensorAdaptor: |
There was a problem hiding this comment.
Can we avoid general names in the variables like tensor_adaptor and have more specific ones like, shape_update ?
| 2, 2.6811e+03, 1.5885e-03 | ||
| 3, 2.6677e+03, 1.5436e-03 | ||
| 4, 2.6191e+03, 1.5046e-03 | ||
| 4, 2.6841e+03, 1.5475e-03 |
There was a problem hiding this comment.
Can we keep the test passing with original settings / values ?
| condition_ta_p = Kratos.TensorAdaptors.VariableTensorAdaptor(self.model_part.Conditions, Kratos.PRESSURE) | ||
| condition_ta_p.CollectData() | ||
|
|
||
| nodal_ta_v = KratosOA.OptimizationUtils.MapContainerDataToNodalData(condition_ta_v, self.model_part.Nodes) |
There was a problem hiding this comment.
So this map is not a copy but rather a linking? So if later we change original var, nodal will change as well? Is map correct name in this case, because you not change map but you also sync. _Map&SyncConditionDatatoNodalData ?? Please comment as I am lost here =()
There was a problem hiding this comment.
Nope, it will not change the model part values, so no automatic synching, but if you call nodal_ta_v.StoreData, then it will write the value to whatever the nodes [ manual synching by the request of the user]. So I would keep the name since there is no automatic synching.
…hape/vertex_morphing_shape_control.py Co-authored-by: IAntonau <igor.antonov92@gmail.com>
|
@Igarizza I addressed your comments and reverted the changes to the |
Igarizza
left a comment
There was a problem hiding this comment.
one more small thing and it is done=)
|
|
||
| def test_CombinedResponseCalculateValue3(self): | ||
| eval_resp = EvaluateResponseExpression("r1 + r2 + 4.0", self.optimization_problem) | ||
| eval_resp = EvaluateResponseExpression("(r1 + r2) * 1e+6 + 4.0", self.optimization_problem) |
There was a problem hiding this comment.
I was checking to fail this test before updating to TensorAdaptors, the problem was, it was not failing because, (r1 + r2) was super low, and the 4.0 was dominating the whole response... Thats why i made it a more sensible test.
Igarizza
left a comment
There was a problem hiding this comment.
I think, it is ready to go !!!
📝 Description
This PR removes all the use cases of
ExpressioninOptimizationApplicationandSystemIdentificationApplication, and replaces them with newTensorAdaptors.This requires following PRs to be merged first.
🆕 Changelog
ExpressionwithTensorAdaptor