visit-dav / visit

VisIt - Visualization and Data Analysis for Mesh-based Scientific Data
https://visit.llnl.gov
BSD 3-Clause "New" or "Revised" License
434 stars 112 forks source link

Expressions and incorrect var type at the plot level #4442

Open ARSanderson opened 4 years ago

ARSanderson commented 4 years ago

When at the plot level on the engine side when evaluating an expression the variable type is typically based on the expression's input primitives and not the variable the expression is creating. This is problematic. First an expression's input primitives could be from scalars, vectors, and tensors so depending on how the expression is formed the type could be anything.

That issue aside it seems to me that that plot should know the actual variable the expression is creating. So the question is, how does one get to the information indicating the type of the expression’s output?

Why does this information need to be known? As we now have operators that take for instance vector data and create scalar we should be able to check the correctness of operator insertion.

For instance

myVector->Vector Plot - okay myVector->IntegralCurve->Vector Plot - not okay

For the latter, which is legal the error message is not helpful to the user. Also at some point in time operators/plots may need to be able to handle data very differently based on the variable type.

My initial thinking is that an operator/plot should know the variable name and type.

markcmiller86 commented 4 years ago

@ARSanderson thanks for adding. I've unassigned everyone until we review this at next team meeting as per our normal workflow. Ok?

markcmiller86 commented 4 years ago

From @ARSanderson

Below is a discussion between Mark and I on an issue with the var type and expressions. Nut shell if in a avtPlot one checks the variable type for an expression via the data object attributes:

avtVarType varType = input->GetInfo().GetAttributes().GetVariableType();

what is returned for an expression is the variable type of I “believe” is the first variable used in the expression rather than the variable type from the resulting expression. Here is but one case. Two tensors made differently from scalars and vectors.

{ { <tensor_comps/grad_tensor_ij>, <tensor_comps/grad_tensor_jj>, <tensor_comps/grad_tensor_kj> }, { <tensor_comps/grad_tensor_ik>, <tensor_comps/grad_tensor_jk>, <tensor_comps/grad_tensor_kk> }, grad }

{ grad, { <tensor_comps/grad_tensor_ij>, <tensor_comps/grad_tensor_jj>, <tensor_comps/grad_tensor_kj> }, { <tensor_comps/grad_tensor_ik>, <tensor_comps/grad_tensor_jk>, <tensor_comps/grad_tensor_kk> } }

The var type for the first is scalar, the var type for the second is vector. That is problematic - not to mention wrong overall. I tried to trace through when the var type is being set but do not have enough knowledge.

rusu24edward commented 4 years ago

Here is a follow up:

Feb 24, 2020 from Eddie: It looks like src/avt/Expressions/Abstract/avtExpressionFilter.C makes use of the SetVariableType function from avtDataAttributes. This is most likely where the variable type is being set for expressions. Have you looked at this file already?

Feb 24, 2020 from Allen: Thanks for that. It is part of the equation but not all. The expression filter gets called after other plot calls (such as avtPlot::ApplyOperators) so for instance when avtPlot::Execute is called on the ENGINE side the var type is wrong initially but once avtExpressionFilter::SetExpressionAttributes gets called multiple times it is correct but that is not until after avtPlot::ApplyOperators.

That is the ENGINE side for the VIEWR side It does that it appears that on the VIEWER side the type is correct once down in the plot. But I need to tease that out a bit more.