[vtkusers] Error using vtkXMLMultiBlockDataWriter

Adriano Gagliardi agagliardi at ara.co.uk
Thu Jun 3 09:32:40 EDT 2010


Unfortunately, it's in serial. I tried it out with a simple piece of code
(mostly taken from the VTK Examples page) and the same thing happened. The
version of VTK was the one supplied in the ParaView-3.8.0-RC2, but I'll try
with the official release to see if there is any difference. If anyone else
has this working, I'd be interested in seeing an example.

=========================================================================
mbwritertest.cxx:
=========================================================================
#include <sstream>

#include <vtkSphereSource.h>
#include <vtkPolyData.h>
#include <vtkMultiBlockDataSet.h>
#include <vtkXMLPolyDataWriter.h>
#include <vtkXMLMultiBlockDataWriter.h>
#include <vtkSmartPointer.h>

int main(int, char *[])
{
  vtkSmartPointer<vtkMultiBlockDataSet> MBPolyData =
    vtkSmartPointer<vtkMultiBlockDataSet>::New();
  MBPolyData->SetNumberOfBlocks(4);

  for ( vtkIdType currBlk = 0; currBlk != MBPolyData->GetNumberOfBlocks();
++currBlk ) {

    //Create a sphere.
    vtkSmartPointer<vtkSphereSource> sphereSource =
      vtkSmartPointer<vtkSphereSource>::New();
    sphereSource->SetCenter(currBlk, 0.0, 0.0);
    sphereSource->SetRadius(5.0);
    sphereSource->Update();

    vtkSmartPointer<vtkPolyData> poly = sphereSource->GetOutput();

    MBPolyData->SetBlock(currBlk, poly);

    //Write the PolyData to file
    std::ostringstream ss;
    ss << "sphere" << currBlk+1 << ".vtp";
    vtkSmartPointer<vtkXMLPolyDataWriter> writer =
      vtkSmartPointer<vtkXMLPolyDataWriter>::New();
    writer->SetInput(poly);
    writer->SetFileName(ss.str().c_str());
    writer->Write();
  }

  //Write the MultiBlockData with PolyData to file
  vtkSmartPointer<vtkXMLMultiBlockDataWriter> writer2 =
    vtkSmartPointer<vtkXMLMultiBlockDataWriter>::New();
  writer2->SetInput(MBPolyData);
  writer2->SetFileName("all-spheres-PD.vtm");
  writer2->Write();

  return EXIT_SUCCESS;
}

=========================================================================
CMakeLists.txt:
=========================================================================
cmake_minimum_required(VERSION 2.6)

PROJECT (MBWriterTest)

INCLUDE (${CMAKE_ROOT}/Modules/FindVTK.cmake)
IF (USE_VTK_FILE)
  INCLUDE(${USE_VTK_FILE})
ENDIF (USE_VTK_FILE)

LINK_LIBRARIES(
  vtkHybrid
)

ADD_EXECUTABLE(mbwritertest mbwritertest.cxx)


===================================

Adriano Gagliardi MEng PhD
Business Sector Leader
Computational Aerodynamics
Aircraft Research Association Ltd.
Manton Lane
Bedford

Tel: 01234 32 4644
E-mail: agagliardi at ara.co.uk
Url: www.ara.co.uk 
-----Original Message-----
From: Berk Geveci [mailto:berk.geveci at kitware.com] 
Sent: 03 June 2010 13:20
To: agagliardi at ara.co.uk
Cc: vtkusers at vtk.org
Subject: Re: [vtkusers] Error using vtkXMLMultiBlockDataWriter

Is this in parallel by any chance?

On Wed, Jun 2, 2010 at 10:52 AM, Adriano Gagliardi <agagliardi at ara.co.uk>
wrote:
>
> Just to say that this was using VTK 5.6.0.
>
> ===================================
>
> Adriano Gagliardi MEng PhD
> Business Sector Leader
> Computational Aerodynamics
> Aircraft Research Association Ltd.
> Manton Lane
> Bedford
>
> Tel: 01234 32 4644
> E-mail: agagliardi at ara.co.uk
> Url: www.ara.co.uk
> -----Original Message-----
> From: vtkusers-bounces at vtk.org [mailto:vtkusers-bounces at vtk.org] On 
> Behalf Of Adriano Gagliardi
> Sent: 01 June 2010 17:50
> To: vtkusers at vtk.org
> Subject: [vtkusers] Error using vtkXMLMultiBlockDataWriter
>
>
> Dear Users,
>
> I have been having an issue with the vtkXMLMultiBlockDataWriter class 
> that contain instances of vtkPolyData. The code follows. Note that 
> this same piece of code works fine if the data within the blocks is of 
> type
> vtkUnstructuredGrid:
>
> ####
> //mbdata is a pointer to a vtkMultiBlockDataSet containing either 
> vtkPolyData or vtkUnstructuredGrid data sets
> vtkXMLMultiBlockDataWriter* writer = 
> vtkXMLMultiBlockDataWriter::New();
> std::ostringstream ss;
> ss << "debugFiles/data_out.vtm";
> writer->SetFileName(ss.str().c_str());
> writer->SetInput(mbdata);
> writer->Write();
> writer->Delete();
> ss.str(std::string());
> ####
>
> When using this, I get the following error message:
>
> ####
> ERROR: In
> /usr/people/gagliard/Paraview/FILES/VTK5.6/VTK/IO/vtkXMLWriter.cxx, 
> line 607 vtkXMLPolyDataWriter (0x13473b00): Error opening output file
"debugFiles"
>
> ERROR: In
> /usr/people/gagliard/Paraview/FILES/VTK5.6/VTK/IO/vtkXMLWriter.cxx, 
> line 610 vtkXMLPolyDataWriter (0x13473b00): Error code "Is a directory"
>
> ERROR: In
> /usr/people/gagliard/Paraview/FILES/VTK5.6/VTK/Filtering/vtkExecutive.
> cxx,
> line 757
> vtkStreamingDemandDrivenPipeline (0x134743c0): Algorithm
> vtkXMLPolyDataWriter(0x13473b00) returned failure for request:
> vtkInformation (0x1347ac00)
>  Debug: Off
>  Modified Time: 45234
>  Reference Count: 1
>  Registered Events: (none)
>  Request: REQUEST_DATA
>  ALGORITHM_AFTER_FORWARD: 1
>  FORWARD_DIRECTION: 0
>  FROM_OUTPUT_PORT: -1
> ####
>
> I am, however, able to write out each block separately using
> vtkXMLPolyDataWriter:
>
> ####
> for ( vtkIdType currBlk = 0; currBlk != mbdata->GetNumberOfBlocks();
> ++currBlk ) {
>  vtkXMLPolyDataWriter* writer = vtkXMLPolyDataWriter::New();
>  std::ostringstream ss;
>  ss << "debugFiles/data_out" << currBlk << ".vtp";
>  writer->SetFileName(ss.str().c_str());
>  writer->SetInput(mbdata->GetBlock(currBlk));
>  writer->Write();
>  writer->Delete();
>  ss.str(std::string());
> }
> ####
>
> I am wondering if I'm missing something fundamental that may cause 
> that error. Hopefully someone else can point out the error as I'm not
seeing it.
>
> Cheers,
>
> Adriano
>
> ===================================
>
> Adriano Gagliardi MEng PhD
> Business Sector Leader
> Computational Aerodynamics
> Aircraft Research Association Ltd.
> Manton Lane
> Bedford
>
> Tel: 01234 32 4644
> E-mail: agagliardi at ara.co.uk
> Url: www.ara.co.uk
>
>
> **********************************************************************
> This email contains information that is private and confidential and 
> is intended only for the addressee.
> If you are not the intended recipient please delete it and notify us 
> immediately by e-mailing the sender.
> Note: All email sent to or from this address may be accessed by 
> someone other than the recipient, for system management and security
reasons.
> Aircraft Research Association Ltd.  Registered in England, 
> Registration No
> 503668 Registered Office:
> Manton Lane, Bedford MK41 7PF England VAT No GB 196351245
>
> **********************************************************************
> _______________________________________________
> 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
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
> **********************************************************************
> This email contains information that is private and confidential and is
intended only for the addressee.
> If you are not the intended recipient please delete it and notify us
immediately by e-mailing the sender.
> Note: All email sent to or from this address may be accessed by 
> someone other than the recipient, for system management and security
reasons.
> Aircraft Research Association Ltd.  Registered in England, Registration No
503668 Registered Office:
> Manton Lane, Bedford MK41 7PF England VAT No GB 196351245
>
> **********************************************************************
> _______________________________________________
> 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
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>


**********************************************************************
This email contains information that is private and confidential and is intended only for the addressee.
If you are not the intended recipient please delete it and notify us immediately by e-mailing the sender.
Note: All email sent to or from this address may be accessed by someone other than the recipient, for
system management and security reasons.
Aircraft Research Association Ltd.  Registered in England, Registration No 503668 Registered Office:
Manton Lane, Bedford MK41 7PF England VAT No GB 196351245

**********************************************************************



More information about the vtkusers mailing list