[vtkusers] vtkMergeDataObjectFilter

dsjen at cs.unc.edu dsjen at cs.unc.edu
Tue Jul 15 09:46:36 EDT 2003


I'm not all that familiar with vtk, so others feel free to offer 
suggestions as well.

It looks as though you need to set the name of your 
vtkDataObjectReader, which I guess is named doReader in your case.  
Something like:

     doReader->SetScalarsName("time9");

might do the trick.

Alternatively, like you said, you could create a vtkDoubleArray and 
fill it with the scalar values and set the name of that array 
to "scalar0," although that doesn't seems like the optimal way...

Good Luck,
Dennis

- Dennis

----- Original Message -----
From: "mccoy" <j.mccoy at gmx.de>
Date: Tuesday, July 15, 2003 9:18 am
Subject: Re: [vtkusers] vtkMergeDataObjectFilter

> thank you  for answering so fast :-)
> nope, in fact, i didn't. i just 'retyped' the tcl- example in cpp. 
> meanwhilei've discovered that the same code in tcl works... but 
> still i need it in
> vcpp.
> can you tell me, where i have to assign the array-name? in the
> DataObjectReader? or must i first create an array and read the 
> scalar file
> into it? till now, the name "scalar0" appears only in the vtk 
> scalar-file
> header.
> 
> 
> 
> 
> ----- Original Message -----
> From: <dsjen at cs.unc.edu>
> To: "mccoy" <j.mccoy at gmx.de>
> Cc: <vtkusers at vtk.org>
> Sent: Tuesday, July 15, 2003 3:05 PM
> Subject: Re: [vtkusers] vtkMergeDataObjectFilter
> 
> 
> > It might be that you're not setting the name properly.  Did you use
> > something like:
> >
> > array->SetName("scalar0");
> >
> > by using some sort of vtkArray?
> >
> > - Dennis
> >
> > ----- Original Message -----
> > From: "mccoy" <j.mccoy at gmx.de>
> > Date: Tuesday, July 15, 2003 7:49 am
> > Subject: [vtkusers] vtkMergeDataObjectFilter
> >
> > > hi there,
> > >
> > > i have  problem that has allready been dealt with some time 
before
> > > in this archive, but nevertheless my code won't work. maybe
> > > someone can tell me what i'm doing wrong.
> > > all right, here is my problem: i have a geometry (unstructured
> > > grid) and a lot of time steps of scalar data. now i want to read
> > > the geometry once and then merge it with some attribute-data 
> of a
> > > special timestep.
> > >
> > > following the answers in the archives i created one unstructured
> > > grid *.vtk file and a lot of fielddata- files containing the
> > > scalar- values of each timestep. now i wanted to mergethe 
geometry
> > > and a scalarfile with 'vtkMergeDataObjectFilter'. i did so using:
> > >
> > > // m_reader: DataSetReader
> > > // doReader: DataObjectReader
> > >
> > >      vtkMergeDataObjectFilter *mdof;
> > >      vtkFieldDataToAttributeDataFilter *fd2ad;
> > >      vtkDataSetMapper *dMapper;
> > >                    ...
> > >      mdof = vtkMergeDataObjectFilter::New();
> > >      mdof->SetInput(m_reader->GetOutput() );
> > >      mdof->SetDataObject(doReader->GetOutput() );
> > >
> > >      fd2ad = vtkFieldDataToAttributeDataFilter::New();
> > >      fd2ad->SetInput(mdof->GetOutput() );
> > >      fd2ad->SetOutputAttributeDataToPointData();
> > >      fd2ad->SetScalarComponent(0, "scalar0", 0);
> > >
> > >     dMapper = vtkDataSetMapper::New();
> > >     dMapper->SetInput(fd2ad->GetOutput() );
> > >
> > > the scalar- files are formated like:
> > >
> > >      # vtk DataFile Version 2.0
> > >      Scalardata
> > >      ASCII
> > >      FIELD time0 1
> > >      scalar0 1 3470 float
> > >      6.300000E+02
> > >      6.300000E+02
> > >      6.300000E+02
> > >      ...
> > >
> > > now there is no compiler error (vcpp6.0), and the program runs.
> > > but it only shows the geometry, no scalar information. and i get
> > > the error:
> > >    error: vtkFieldDataToAttributeDataFilter (0x09D1B940): Can't
> > > find array/component requested
> > >
> > > does anybody now where i'm wrong? How else should i run
> > > SetScalarComponent, or is there something complete different 
> to use?
> > >
> > > thank u all.
> > >
> > >
> > >
> >
> 
> 
> 




More information about the vtkusers mailing list