[visit-developers] ln syntax

Hank Childs childs3 at llnl.gov
Mon May 11 11:31:15 EDT 2009


On May 11, 2009, at 8:21 AM, Sean Ahern wrote:

> Paul A. Navratil wrote:
>> ln(if(gt(u,0), u, <some ln-able val>))
>> This happens b/c both sides of the conditional are evaluated  
>> before the test is evaluated.  This seems counter-intuitive to me,  
>> since I expect the conditional to prevent execution of the non- 
>> selected branch.  Not sure how painful this would be to change in  
>> the code guts.
>
> Unfortunately, I think it would be rather difficult to change in  
> the expression engine.  To make the engine as efficient as  
> possible, we work on problem-sized arrays.  Thus, we compute the  
> results of all sub-expressions first, then filter that through the  
> if() function.  This makes for rapid execution, but no intuitive  
> side effects.  Sorry.

Hi Sean,

I agree that it would be very hard to change the order of execution  
of expressions and that makes this change non-trivial.  But I was  
brainstorming about this over the weekend and came up with another  
possibility:

To be explicit, let's focus on: if(ne(p,0), (q/p), 1) ... where p is  
0 sometimes, of course.  (The only reason I'm choosing "divide" is to  
pick something besides log)

avtDivideExpression encounters divide by 0.
-> Current result: exception
-> New proposed result:
   The avtDivideExpression:
       (i) puts in some sort of sentinel value to express an error (- 
FLT_MAX)?
       (ii) sets a boolean in the data attributes saying an error was  
encountered
   The if-then-else filter:
       goes about its normal business.  It will throw away all of the  
-FLT_MAX's
   The avtExpressionEvaluatorFilter
      (i) notes that the boolean in the data attributes was set
      (ii) so it decides to walk through the data and see if any of  
the -FLT_MAX's were encountered
         -- if so -- correctly throws an exception
         -- if not -- correctly does not throw an exception

one of the nice things about this is we have a chance to fix a  
parallel error handling case that we have done a poor job on  
throughout the years.  (The case is where proc 0 does not get an  
exception, but another processor does.)

So:
      (ii) decides then to walk through the data and see if any of  
the -FLT_MAX's were encountered
        -new- communicate with other processors (if not streaming)  
and see if any had a problem
         -- if so -- correctly throws an exception
         -- if not -- correctly does not throw an exception

-FLT_MAX may not be the right value to choose.  But it would make  
things easier if we can choose some sentinel value.

-Hank


More information about the visit-developers mailing list