Let me please clarify my last concerns in this regard:

The operations
GridTools::find_active_cell_around_point and
feValues.reinit
are executed at quadrature point level and performance
is really important in our application.

The reason why I wanted to use an
try/catch block is to surrogate the use of an if-statement.
Consider these two variants:

Variant 1:

disable_abort_on_exception();
try
{
   feValues.reinit(cell,...);
}
catch(dealii::Exception Base exception & )
{
   Assert(checkSecondRunTimeCondition, ...)
   // do something
}

Variant 2:

if(cell->state()==-1)
{
    Assert(checkSecondRunTimeCondition, ...)
   // do something
}
else
{
     feValues.reinit(cell,...);
}

As you can see, there are two conditions I have to check at every
quadrature point.
Clearly, Variant 2 implements an if-requests and is probably not the way to
go.


1. So with regard to performance, would you prefer Variant 1
(as the try/catch introduces less overhead compared to the if-statement)?
2. If so, is the call of "disable_abort_on_exception()" good
coding practice or would you refrain from doing so?
In the main function of our program, we have a try/catch with
catch(dealii::ExceptionBase exception &).
Given that, in my opinion  "disable_abort_on_exception()"
should cause any undue behavior.

Best,
Simon


Am Do., 3. Aug. 2023 um 14:21 Uhr schrieb Wolfgang Bangerth <
[email protected]>:

> On 8/2/23 15:58, Simon Wiesheier wrote:
> >
> > Does that make sense?
> > Or do you see a better solution, like checking
> > cell->status() right after GridTools::find_active_cell_around_point?
>
> This. If the function you call returns an error code in the form of an end
> iterator, just test for that rather than doing something with this
> iterator
> and wait to see what happens. It is always worth checking errors as early
> as
> possible.
>
> Best
>   W.
>
> --
> ------------------------------------------------------------------------
> Wolfgang Bangerth          email:                 [email protected]
>                             www: http://www.math.colostate.edu/~bangerth/
>
>
> --
> The deal.II project is located at http://www.dealii.org/
> For mailing list/forum options, see
> https://groups.google.com/d/forum/dealii?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "deal.II User Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/dealii/53307567-6cd6-3f21-2c63-a5eedf5367f5%40colostate.edu
> .
>

-- 
The deal.II project is located at http://www.dealii.org/
For mailing list/forum options, see 
https://groups.google.com/d/forum/dealii?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"deal.II User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/CAM50jEsCfErRV8-Su0gw4MyJS13W%3DwfbY5mCZY2_LXYMcm8efw%40mail.gmail.com.

Reply via email to