[prev in list] [next in list] [prev in thread] [next in thread] 

List:       paraview
Subject:    Re: [Paraview] SafeDownCast to vtkDoubleArray fails
From:       Robert Maynard <robertjmaynard () gmail ! com>
Date:       2008-09-23 18:31:44
Message-ID: 48D93610.4070700 () gmail ! com
[Download RAW message or body]

[Attachment #2 (text/html)]

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
If you launch the program for a terminal window on OSX or Linux you
should get all the print statements. On windows I know that pvservers
launched from the command line also properly print out couts,fprints
etc. I have never launced paraview.exe from a windows command line to
see if that works.<br>
Geoff Draper wrote:
<blockquote
 cite="mid:alpine.DEB.0.82.0809231105140.31364@thebes.cs.utah.edu"
 type="cite">I've never succeeded at getting ParaView to output to the
console.&nbsp; I usually just direct my debugging output to a log file.&nbsp; If
anyone has any tips for printing to stdout or stderr from within
ParaView, I'd be interested to learn them.
  <br>
  <br>
On Tue, 23 Sep 2008, Natalie Happenhofer wrote:
  <br>
  <br>
  <blockquote type="cite"><br>
I tried that Print(cerr), but I didn&acute;t see anything printed on my
console.. I hoped that would give me information to which class my
getArr belongs.
    <br>
thats the line where I used it:
    <br>
    <br>
input -&gt; GetPointData() -&gt; GetArray(0) -&gt;Print(cerr);
    <br>
    <br>
I do not know what I should try next..
    <br>
NH
    <br>
    <br>
    <blockquote type="cite">Date: Mon, 22 Sep 2008 09:18:00 -0400
      <br>
From: <a class="moz-txt-link-abbreviated" \
href="mailto:burlen.loring@kitware.com">burlen.loring@kitware.com</a>  <br>
To: <a class="moz-txt-link-abbreviated" \
href="mailto:nataliehapp@hotmail.com">nataliehapp@hotmail.com</a>  <br>
CC: <a class="moz-txt-link-abbreviated" \
href="mailto:paraview@paraview.org">paraview@paraview.org</a>  <br>
Subject: Re: [Paraview] SafeDownCast to vtkDoubleArray fails
      <br>
      <br>
Natalie Happenhofer wrote:
      <br>
      <blockquote type="cite">Hi!
        <br>
Thx a lot, I get now a DataArray using
        <br>
getArr = scaldat -&gt;GetArray(0); //I just have one array in my point
data
        <br>
        <br>
But still the downcast to vtkDoubleArray fails, here is the code I
used:
        <br>
        <br>
scaldat = input -&gt; GetPointData();
        <br>
vtkDataArray *getArr = vtkDataArray::CreateDataArray(VTK_DOUBLE);
        <br>
getArr = scaldat -&gt; GetArray(0);
        <br>
      </blockquote>
This is going to create a leak, because you ask for a New() an array
      <br>
then reassign your pointer to it before you call Delete().
      <br>
      <br>
      <blockquote type="cite"><br>
&nbsp;vtkDoubleArray *scalars = vtkDoubleArray::New();
        <br>
scalars = vtkDoubleArray::SafeDownCast(getArr); //this downcast fails,
        <br>
i.e at runtime I get that warning below
        <br>
      </blockquote>
Again this results in a leak for same reason.
      <br>
      <blockquote type="cite">&nbsp;if(!scalars) vtkErrorMacro("SafeDownCast
to vtkDoubleArray failed");
        <br>
        <br>
        <br>
With the member function "IsTypeOf(char *classname)" I tried to find
        <br>
out if getArr is an array of a subclass of vtkDataArray, but this does
        <br>
not seem to be the case. getArr is just a vtkDataArray. But I need to
        <br>
access the values in it!!!
        <br>
      </blockquote>
There are a few reasons why the cast could fail. Do you know for sure
      <br>
that getArr is not null? Could you check to be sure the array in
      <br>
question is actually a double array? Try getArr-&gt;Print(cerr); That
      <br>
should give more info. If this happened to me I would open the code in
a
      <br>
debugger and single step through this portion of the code examining
      <br>
variables to see they have the expected values.
      <br>
      <br>
      <br>
      <blockquote type="cite"><br>
thx,
        <br>
NH
        <br>
        <br>
        <br>
        <br>
        <blockquote type="cite">Date: Sun, 21 Sep 2008 11:49:00 -0400
          <br>
From: <a class="moz-txt-link-abbreviated" \
href="mailto:burlen.loring@kitware.com">burlen.loring@kitware.com</a>  <br>
To: <a class="moz-txt-link-abbreviated" \
href="mailto:nataliehapp@hotmail.com">nataliehapp@hotmail.com</a>  <br>
CC: <a class="moz-txt-link-abbreviated" \
href="mailto:paraview@paraview.org">paraview@paraview.org</a>  <br>
Subject: Re: [Paraview] SafeDownCast to vtkDoubleArray fails
          <br>
          <blockquote type="cite">
            <blockquote type="cite">
              <blockquote type="cite">Natalie Happenhofer wrote:
                <br>
              </blockquote>
            </blockquote>
Hi!
            <br>
I need to cast my Point Data to a vtkDoubleArray, but it fails:
            <br>
            <br>
vtkPointData *scaldat = input -&gt; GetPointData();
            <br>
vtkDoubleArray *scalars = vtkDoubleArray::New();
            <br>
scalars = vtkDoubleArray::SafeDownCast(scaldat);
            <br>
if(!scalars) vtkErrorMacro("SafeDownCast to vtkDoubleArray failed");
            <br>
          </blockquote>
PointData is not an array, it's a container of arrays. To get one of
          <br>
        </blockquote>
its
        <br>
        <blockquote type="cite">arrays see the GetArray methods.
          <br>
          <br>
        </blockquote>
<a class="moz-txt-link-freetext" \
href="http://www.vtk.org/doc/nightly/html/classvtkFieldData.html#888a6492210426d4ba4d3 \
58b87ab198f">http://www.vtk.org/doc/nightly/html/classvtkFieldData.html#888a6492210426d4ba4d358b87ab198f</a>
  <br>
        <blockquote type="cite"><br>
To find this in the documentation you would have to use the inheritance
          <br>
diagrams. PointData "is a" DataSetAttibutes "is a" FieldData and so on.
          <br>
          <br>
          <blockquote type="cite"><br>
and everytime I run the program I get that vtkErrorMacro.
            <br>
as far as I know from the input files, the PointData should be float,
            <br>
but casting to vtkFloatArray fails as well. Why? and what can I do
            <br>
about it?
            <br>
            <br>
thx a lot,
            <br>
NH
            <br>
            <br>
            <br>
          </blockquote>
        </blockquote>
------------------------------------------------------------------------
        <br>
        <blockquote type="cite">
          <blockquote type="cite">Express yourself instantly with MSN
Messenger! MSN Messenger
            <br>
<a class="moz-txt-link-rfc2396E" \
href="http://clk.atdmt.com/AVE/go/onm00200471ave/direct/01/">&lt;http://clk.atdmt.com/AVE/go/onm00200471ave/direct/01/&gt;</a>
  <br>
            <br>
          </blockquote>
        </blockquote>
------------------------------------------------------------------------
        <br>
        <blockquote type="cite">
          <blockquote type="cite"><br>
_______________________________________________
            <br>
ParaView mailing list
            <br>
<a class="moz-txt-link-abbreviated" \
href="mailto:ParaView@paraview.org">ParaView@paraview.org</a>  <br>
<a class="moz-txt-link-freetext" \
href="http://www.paraview.org/mailman/listinfo/paraview">http://www.paraview.org/mailman/listinfo/paraview</a>
  <br>
            <br>
          </blockquote>
          <br>
          <br>
--
          <br>
Burlen Loring
          <br>
Kitware, Inc.
          <br>
R&amp;D Engineer
          <br>
28 Corporate Drive
          <br>
Clifton Park, NY 12065-8662
          <br>
Phone: 518-371-3971 x137
          <br>
          <br>
        </blockquote>
        <br>
------------------------------------------------------------------------
        <br>
Express yourself instantly with MSN Messenger! MSN Messenger
        <br>
<a class="moz-txt-link-rfc2396E" \
href="http://clk.atdmt.com/AVE/go/onm00200471ave/direct/01/">&lt;http://clk.atdmt.com/AVE/go/onm00200471ave/direct/01/&gt;</a>
  <br>
      </blockquote>
      <br>
      <br>
--
      <br>
Burlen Loring
      <br>
Kitware, Inc.
      <br>
R&amp;D Engineer
      <br>
28 Corporate Drive
      <br>
Clifton Park, NY 12065-8662
      <br>
Phone: 518-371-3971 x137
      <br>
      <br>
    </blockquote>
    <br>
_________________________________________________________________
    <br>
Express yourself instantly with MSN Messenger! Download today it's
FREE!
    <br>
<a class="moz-txt-link-freetext" \
href="http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/">http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/</a><br>
  </blockquote>
  <pre wrap="">
<hr size="4" width="90%">
_______________________________________________
ParaView mailing list
<a class="moz-txt-link-abbreviated" \
href="mailto:ParaView@paraview.org">ParaView@paraview.org</a> <a \
class="moz-txt-link-freetext" \
href="http://www.paraview.org/mailman/listinfo/paraview">http://www.paraview.org/mailman/listinfo/paraview</a>
  </pre>
</blockquote>
<br>
</body>
</html>



_______________________________________________
ParaView mailing list
ParaView@paraview.org
http://www.paraview.org/mailman/listinfo/paraview


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic