Quantcast

Best way to add a print in a distribution file ?

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Best way to add a print in a distribution file ?

foufara
This post was updated on .
Hi here is a quick question most of you can answer to.

I want to add some prints in the distribution files to check some variables. I know I should use a debugger but I can't spend time learning how to use it right now…
 
I tried adding prints like

  std::cout << "A print" << std::end;

in files and then calling make (my distribution is already built) to build the files I modified.

But then when I run an example calling the modified functions (which I also rebuilt of course), the prints do not appear on my console (linux).

What is wrong ?Do I have to compile the whole distribution each time (way too long)

What is the right way to add these prints ?

Thank you !
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Best way to add a print in a distribution file ?

kenichiro yoshimi
Hi,

I have a concern about your building work completed because of the
wrong description std::end (std::endl is correct). Or there is a
possibility that std::cout doesn't work due to buffering. You may
manually flush it yourself.

 std::cout << "A print" << std::endl << std::flush;
or
 std::cout << "A print" << std::endl;
 std::cout.flush();

Regards,

2017-05-08 17:15 GMT+09:00 foufara via vtkusers <[hidden email]>:

> Hi here is a quick question most of you can answer to.
>
> I want to add some prints in the distribution files to check some variables.
> I know I should use a debugger but I can't spend time learning how to use it
> right now…
>
> I tried adding prints like
>
>   std::cout << "A print" << std::end;
>
> in files and then calling make (my distribution is already built) to build
> the files I modified.
>
> But then when I run an example calling the modified functions, the print do
> not appear on my console (linux).
>
> What is wrong ?Do I have to compile the whole distribution each time (way
> too long)
>
> What is the right way to add these prints ?
>
> Thank you !
>
>
>
>
> --
> View this message in context: http://vtk.1045678.n5.nabble.com/Best-way-to-add-a-print-in-a-distribution-file-tp5743112.html
> Sent from the VTK - Users mailing list archive at Nabble.com.
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Best way to add a print in a distribution file ?

foufara
Hi,

thank you for this answer.

Actually I was writing it correctly  std::endl.
I tried flushing but it didn’t change anything.
The print I had added was in

void vtkLineSource::SetPoint1(float point1f[3])

I then added another print in

int vtkLineSource::RequestData(
  vtkInformation *vtkNotUsed(request),
  vtkInformationVector **vtkNotUsed(inputVector),
  vtkInformationVector *outputVector)

And this one works.
So I guess the code does not call

void vtkLineSource::SetPoint1(float point1f[3])

at all.

But then what does it call when I write :

  // Create a line
  vtkSmartPointer<vtkLineSource> lineSource =
    vtkSmartPointer<vtkLineSource>::New();
  lineSource->SetPoint1(1.0, 0.0, 0.0);
  lineSource->SetPoint2(0.0, 1.0, 0.0);

in my code ? Is it because of the smart pointer ?

Cheers,
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Best way to add a print in a distribution file ?

VTK - Users mailing list
In reply to this post by kenichiro yoshimi
Hi,

thank you for this answer.

Actually I was writing it correctly  std::endl.
I tried flushing but it didn’t change anything.
The print I had added was in

void vtkLineSource::SetPoint1(float point1f[3])

I then added another print in

int vtkLineSource::RequestData(
 vtkInformation *vtkNotUsed(request),
 vtkInformationVector **vtkNotUsed(inputVector),
 vtkInformationVector *outputVector)

And this one works.
So I guess the code does not call

void vtkLineSource::SetPoint1(float point1f[3])

at all.

But then what does it call when I write :

 // Create a line
 vtkSmartPointer<vtkLineSource> lineSource =
   vtkSmartPointer<vtkLineSource>::New();
 lineSource->SetPoint1(1.0, 0.0, 0.0);
 lineSource->SetPoint2(0.0, 1.0, 0.0);

in my code ? Is it because of the smart pointer ?

Cheers,



--
View this message in context: http://vtk.1045678.n5.nabble.com/Best-way-to-add-a-print-in-a-distribution-file-tp5743112p5743145.html
Sent from the VTK - Users mailing list archive at Nabble.com.
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Best way to add a print in a distribution file ?

kenichiro yoshimi
Hi,

Probably, you are calling a function defined by
  vtkGetVectorMacro(Point1,double,3);
and hence a function to which you have added print
 void vtkLineSource::SetPoint1(float point1f[3])
may not be called.

Regards,

2017-05-09 15:44 GMT+09:00 foufara via vtkusers <[hidden email]>:

> Hi,
>
> thank you for this answer.
>
> Actually I was writing it correctly  std::endl.
> I tried flushing but it didn’t change anything.
> The print I had added was in
>
> void vtkLineSource::SetPoint1(float point1f[3])
>
> I then added another print in
>
> int vtkLineSource::RequestData(
>  vtkInformation *vtkNotUsed(request),
>  vtkInformationVector **vtkNotUsed(inputVector),
>  vtkInformationVector *outputVector)
>
> And this one works.
> So I guess the code does not call
>
> void vtkLineSource::SetPoint1(float point1f[3])
>
> at all.
>
> But then what does it call when I write :
>
>  // Create a line
>  vtkSmartPointer<vtkLineSource> lineSource =
>    vtkSmartPointer<vtkLineSource>::New();
>  lineSource->SetPoint1(1.0, 0.0, 0.0);
>  lineSource->SetPoint2(0.0, 1.0, 0.0);
>
> in my code ? Is it because of the smart pointer ?
>
> Cheers,
>
>
>
> --
> View this message in context: http://vtk.1045678.n5.nabble.com/Best-way-to-add-a-print-in-a-distribution-file-tp5743112p5743145.html
> Sent from the VTK - Users mailing list archive at Nabble.com.
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Best way to add a print in a distribution file ?

foufara
Yes you are right, if I look at vtkLineSource.h I see that vtkGetVectorMacro is called just before SetPoint1 is declared.
I don’t understand the meaning of that, but that should be the reason.

Thank you



Le 9 mai 2017 à 09:24, kenichiro yoshimi [via VTK] <[hidden email]> a écrit :

Hi, 

Probably, you are calling a function defined by 
  vtkGetVectorMacro(Point1,double,3); 
and hence a function to which you have added print 
 void vtkLineSource::SetPoint1(float point1f[3]) 
may not be called. 

Regards, 

2017-05-09 15:44 GMT+09:00 foufara via vtkusers <<a href="x-msg://10/user/SendEmail.jtp?type=node&amp;node=5743148&amp;i=0" target="_top" rel="nofollow" link="external" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">[hidden email]>:

> Hi, 
> 
> thank you for this answer. 
> 
> Actually I was writing it correctly  std::endl. 
> I tried flushing but it didn’t change anything. 
> The print I had added was in 
> 
> void vtkLineSource::SetPoint1(float point1f[3]) 
> 
> I then added another print in 
> 
> int vtkLineSource::RequestData( 
>  vtkInformation *vtkNotUsed(request), 
>  vtkInformationVector **vtkNotUsed(inputVector), 
>  vtkInformationVector *outputVector) 
> 
> And this one works. 
> So I guess the code does not call 
> 
> void vtkLineSource::SetPoint1(float point1f[3]) 
> 
> at all. 
> 
> But then what does it call when I write : 
> 
>  // Create a line 
>  vtkSmartPointer<vtkLineSource> lineSource = 
>    vtkSmartPointer<vtkLineSource>::New(); 
>  lineSource->SetPoint1(1.0, 0.0, 0.0); 
>  lineSource->SetPoint2(0.0, 1.0, 0.0); 
> 
> in my code ? Is it because of the smart pointer ? 
> 
> Cheers, 
> 
> 
> 
> -- 
> View this message in context: http://vtk.1045678.n5.nabble.com/Best-way-to-add-a-print-in-a-distribution-file-tp5743112p5743145.html
> Sent from the VTK - Users mailing list archive at Nabble.com. 
> _______________________________________________ 
> Powered by www.kitware.com 
> 
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
> 
> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> 
> Search the list archives at: http://markmail.org/search/?q=vtkusers
> 
> Follow this link to subscribe/unsubscribe: 
> http://public.kitware.com/mailman/listinfo/vtkusers
_______________________________________________ 
Powered by www.kitware.com 

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe: 
http://public.kitware.com/mailman/listinfo/vtkusers



If you reply to this email, your message will be added to the discussion below:
http://vtk.1045678.n5.nabble.com/Best-way-to-add-a-print-in-a-distribution-file-tp5743112p5743148.html
To unsubscribe from Best way to add a print in a distribution file ?, click here.
NAML

Loading...