On Tue, Jun 03, 2014 at 02:43:12PM +0200, Jan Blechta wrote:
> On Tue, 3 Jun 2014 14:25:02 +0200
> Jan Blechta <[email protected]> wrote:
>
> > On Tue, 3 Jun 2014 13:50:04 +0300
> > Päivo Simson <[email protected]> wrote:
> >
> > > Hi!
> > >
> > > Is there a way to disable console output for
> > > interpolate_nonmatching_mesh? This happens when the point is outside
> > > the original mesh. The output looks like this:
> > > ...
> > > <Point x = -7 y = 17.5 z = 0>
> > > <Point x = -7 y = 10.5 z = 0>
> > > <Point x = 7 y = 17.5 z = 0>
> > > <Point x = -7 y = 3.5 z = 0>
> > > <Point x = 21 y = 17.5 z = 0>
> > > ...
> > > I could not find anywhere in the source code where these messages
> > > could be disabled. Im using fenicstools-1.3.0
> >
> > This is probably because of
> >
> >    384       id =
> > mesh.bounding_box_tree()->compute_closest_entity(point).first;
> > 385       cout << "Extrapolating function value at x = " << point
> > 386            << " (not inside domain)." << endl;
> >
> > in dolfin/function/Function.cpp which happens when extrapolating. This
> > is really annoying and flooding stdout and should be fixed. AFAIK this
> > can only be muted using
> >
> >   set_log_active(false);
> >
> > before executing some extrapolating code and afterwards reverted by
> >
> >   set_log_active(true);
> >
> > Jan
>
> It is little more complicated. There was one more cout in dolfin-1.3.0
>
> 379   // If not found, use the closest cell
> 380   if (id == std::numeric_limits<unsigned int>::max())
> 381   {
> 382     if (allow_extrapolation)
> 383     {
> 384       id = mesh.bounding_box_tree()->compute_closest_entity(point).first;
> 385       cout << "Extrapolating function value at x = " << point
> 386            << " (not inside domain)." << endl;
> 387     }
> 388     else
> 389     {
> 390       cout << point << endl;
> 391       dolfin_error("Function.cpp",
> 392                    "evaluate function at point",
> 393                    "The point is not inside the domain. Consider setting 
> \"allow_extrapolation\" to allow extrapolation");
>
> fenicstools intentionally triggers dolfin_error on line 391 and catches it.
> So you can
>
>  - install new DOLFIN 1.4 where interpolate_non_matching is included as
>    LagrangeInterpolator or
>  - tweak the source of your DOLFIN 1.3 or
>  - use set_log_active(false) trick
>
> Still, cout in current DOLFIN should be eliminated. What about making
> it a warning?

Since we already have a test (checking "allow_extrapolation") then
that cout should simply be removed. It can be commented out and left
there for debugging.

--
Anders
_______________________________________________
fenics-support mailing list
[email protected]
http://fenicsproject.org/mailman/listinfo/fenics-support

Reply via email to