[Paraview] Providing block names within .vtm files

Adriano Gagliardi agagliardi at ara.co.uk
Fri Mar 25 09:26:54 EDT 2011


Jean,

I had a look at the source too and came to the same conclusion. Admittedly,
I was quite surprised considering it is such a important feature of
multi-block data storage. Thank you for providing code to handle it though.
I'll make changes and test to make sure it works here and update you. 

Thanks,

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 
-----Original Message-----
From: Favre Jean [mailto:jfavre at cscs.ch] 
Sent: 25 March 2011 12:05
To: agagliardi at ara.co.uk; paraview at paraview.org
Subject: RE: [Paraview] Providing block names within .vtm files


I believe the functionality is missing. I have looked for it for many years.

I just put together a quick hack, which seems to work fine for me. No
exhaustive testing was done. It works for my test data, which are
multi-blocks of multi-blocks. It could be generalized to multi-pieces too.
I'll let a Kitware guru do that. :-)

I modified VTK/IO/vtkXMLMultiBlockDataReader.cxx to get the attribute "name"

    // child is a leaf node, read and insert.
    const char* tagName = childXML->GetName();
    if (strcmp(tagName, "DataSet") == 0)
      {
      vtkSmartPointer<vtkDataSet> childDS;
      const char* name;
      if (this->ShouldReadDataSet(dataSetIndex))
        {
        // Read
        childDS.TakeReference(this->ReadDataset(childXML, filePath));
        name = childXML->GetAttribute("name");
        }
      // insert
      if (mblock)
        {
        mblock->SetBlock(index, childDS);
        mblock->GetMetaData(index)->Set(vtkCompositeDataSet::NAME(), name);
        }
      else if (mpiece)
        {
        mpiece->SetPiece(index, childDS);
        }
      dataSetIndex++;
      }
    // Child is a multiblock dataset itself. Create it.
    else if (mblock != 0
             && strcmp(tagName, "Block") == 0)
      {
      vtkMultiBlockDataSet* childDS = vtkMultiBlockDataSet::New();;
      this->ReadComposite(childXML, childDS, filePath, dataSetIndex);
      const char* name = childXML->GetAttribute("name");
      if (mblock)
        {
        mblock->SetBlock(index, childDS);
        mblock->GetMetaData(index)->Set(vtkCompositeDataSet::NAME(), name);
        }
      else if (mpiece)
        {
        vtkErrorMacro("Multipiece data can't have composite children.");
        return;
        }
      childDS->Delete();
      }


-----------------
Jean M. Favre
Swiss National Supercomputing Center

=


**********************************************************************
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 ParaView mailing list