Skip to main content

toSurface parameter behavior in batch ray trace

  • October 14, 2021
  • 1 reply
  • 67 views

Adub
Ansys Staff

Hi, 

I tried to trace some ray in C++ through a simple test lens file with two surfaces after the lens and the IMAGE surface (see file).

I create a batch with CreateDirectunpol() function but I noticed two behaviors that seemed strange to me : 

  • when I set  toSurface  parameter to a negative number (CreateDirectUnpol(1000, RaysType_Paraxial, 0, -1)  for example), no error are thrown, and the function does not return nullptr. Even more strange, I could add rays, trace them and read output result. Obviously, rays were unchanged.
  • when I set toSurface parameter to TheSystem->LDE->NumberOfSurfaces, I have the exact same output as TheSystem->LDE->NumberOfSurfaces - 1.

Do you have any explanation for these behaviors ?

Thanks

 

Did this topic help you find an answer to your question?

1 reply

David.Nguyen
Luminary
Forum|alt.badge.img+2
  • Luminary
  • 1089 replies
  • October 15, 2021

Hi Adub,

 

From what I know there isn’t systematic error handling in the ZOS-API, and developers have been focused on incorporating all the analysis features as opposed to fixing and polishing a subset of those. I’m not particularly surprised by your discovery. If you search for those behaviours, you’ll find plenty of them, I guess the important bit is whether it stops you from doing your work.

As for your second issue, I think the surfaces start at zero, so if you have five surfaces, their indices will be 0, 1, 2, 3, and 4. However, the NumberOfSurfaces will be 5, and 5 is not a valid index, therefore its showing you the same behaviour as -1 which isn’t a valid index either.

Let me know if this makes sense.

Take care,

 

David


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings