<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    Hi everybody <br>
    <br>
    I think I found a bug in the function <i class="moz-txt-slash"><span
        class="moz-txt-tag">/</span>IO/XML/vtkXMLWriterC.cxx<span
        class="moz-txt-tag">/</span></i>
    vtkXMLWriterC_SetCellsWithTypes/ vtkXMLWriterC_NewCellArray <br>
    <br>
    <br>
    //----------------------------------------------------------------------------

    <br>
    static <br>
    vtkSmartPointer&lt;vtkCellArray&gt; <br>
    vtkXMLWriterC_NewCellArray(const char* method, vtkIdType ncells, <br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; vtkIdType* cells, vtkIdType cellsSize) <br>
    { <br>
    &nbsp; // Create a vtkIdTypeArray to reference the cells. <br>
    &nbsp; vtkSmartPointer&lt;vtkIdTypeArray&gt; array = <br>
    &nbsp;&nbsp;&nbsp; vtkSmartPointer&lt;vtkIdTypeArray&gt;::New(); <br>
    &nbsp; if(!array) <br>
    &nbsp;&nbsp;&nbsp; { <br>
    &nbsp;&nbsp;&nbsp; vtkGenericWarningMacro( <br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "vtkXMLWriterC_" &lt;&lt; method &lt;&lt; " failed to allocate
    a vtkIdTypeArray." <br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ); <br>
    &nbsp;&nbsp;&nbsp; return 0; <br>
    &nbsp;&nbsp;&nbsp; } <br>
    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! <br>
    the error is here <br>
    &nbsp; //array-&gt;SetArray(cells, ncells*cellsSize, 1); <br>
    my correction is <br>
    &nbsp; array-&gt;SetArray(cells, cellsSize, 1); <br>
    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! <br>
    &nbsp; // Create the cell array. <br>
    &nbsp; vtkSmartPointer&lt;vtkCellArray&gt; cellArray = <br>
    &nbsp;&nbsp;&nbsp; vtkSmartPointer&lt;vtkCellArray&gt;::New(); <br>
    &nbsp; if(!cellArray) <br>
    &nbsp;&nbsp;&nbsp; { <br>
    &nbsp;&nbsp;&nbsp; vtkGenericWarningMacro( <br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "vtkXMLWriterC_" &lt;&lt; method &lt;&lt; " failed to allocate
    a vtkCellArray." <br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ); <br>
    &nbsp;&nbsp;&nbsp; return 0; <br>
    &nbsp;&nbsp;&nbsp; } <br>
    &nbsp; cellArray-&gt;SetCells(ncells, array); <br>
    &nbsp; return cellArray; <br>
    } <br>
    <br>
    //----------------------------------------------------------------------------

    <br>
    <br>
    I just want that someone less newbie than me confirm my correction.
    <br>
    I modified the hello program to test it. <br>
    It is Fortran, but finally it is the same call <br>
    thank you <br>
    <br>
    <br>
    <br>
    PROGRAM Hello <br>
    &nbsp; INTEGER writer <br>
    &nbsp; INTEGER success <br>
    &nbsp; INTEGER*8 numpoints/10/ <br>
    &nbsp; INTEGER*8 numcells/2/ <br>
    &nbsp; INTEGER*8 cellsSize/16/ <br>
    &nbsp; REAL*4 pdata(10)/0,0,0,0,1,1,1,1,0,0/ <br>
    &nbsp; REAL*4 points(30)/0,0,0, 1,0,0, 1,1,0, 0,1,0, 0,0,1, 1,0,1, 1,1,1,
    0,1,1, 0,0,2, 0,1,2/ <br>
    &nbsp; INTEGER*8 cells(16)/8,0,1,2,3,4,5,6,7,6,4,5,8,7,6,9/ <br>
    &nbsp; INTEGER*4 cellTypes(2)/12,13/ <br>
    <br>
    &nbsp; call vtkXMLWriterF_New(writer) <br>
    &nbsp; call vtkXMLWriterF_SetDataObjectType(writer, 4) <br>
    &nbsp; call vtkXMLWriterF_SetDataModeType(writer, 0) <br>
    &nbsp; call vtkXMLWriterF_SetFileName(writer, 'test1.vtu') <br>
    &nbsp; call vtkXMLWriterF_SetPoints(writer, 10, points, numpoints) <br>
    &nbsp; call vtkXMLWriterF_SetCellsWithTypes(writer, cellTypes ,numcells,
    cells, cellsSize) <br>
    &nbsp; call vtkXMLWriterF_SetPointData(writer, 'example data', 10, pdata,
    numpoints, 1, 'SCALARS') <br>
    &nbsp; call vtkXMLWriterF_Write(writer, success) <br>
    &nbsp; call vtkXMLWriterF_Delete(writer) <br>
    &nbsp; PRINT *, 'success =', success <br>
    END PROGRAM Hello
    <pre class="moz-signature" cols="72">-- 
Hadrien Calmet
Dpt. Computer Applications in Science and Engineering
Barcelona Supercomputing Center (BSC-CNS)
Edificio NEXUS I, Office 204
c) Gran Capitan 2-4
08034 Barcelona, Spain
Tel: +34 93 405 4289
Fax: +34 93 413 7721
Www: <a class="moz-txt-link-abbreviated" href="http://www.bsc.es">www.bsc.es</a>

</pre>
  
<br>
<br>
WARNING / LEGAL TEXT: This message is intended only for the use of the
individual or entity to which it is addressed and may contain
information which is privileged, confidential, proprietary, or exempt
from disclosure under applicable law. If you are not the intended
recipient or the person responsible for delivering the message to the
intended recipient, you are strictly prohibited from disclosing,
distributing, copying, or in any way using this message. If you have
received this communication in error, please notify the sender and
destroy and delete any copies you may have received.
<br><br>
<a href="http://www.bsc.es/disclaimer.htm">http://www.bsc.es/disclaimer</a>
<br>
</body>
</html>