<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  <body bgcolor="#ffffff" text="#000000">
    Hi,<br>
    I have the problem mentioned in the subject:<br>
    My source - is the collection of points (particles) and there are
    several vector fields associated to them. I want to render the
    points (as small spheres- vtkGlyph3d is used here) and the vector
    fields associated to them. Say, that there are 2 vector fields, one
    will be rendered as green arrows, the second - as red arrows. I know
    how to connect the first field. But I don't know how to do the same
    with the second.<br>
    I wrote a the new class for my data source, here is the way I add
    vector fields to them:<br>
    <br>
    int cVtkMoleculeModelSource::RequestData(<br>
      vtkInformation *vtkNotUsed(request),<br>
      vtkInformationVector **vtkNotUsed(inputVector),<br>
      vtkInformationVector *outputVector)<br>
    {<br>
    <br>
        vtkDebugMacro("Molecule Source Executing");<br>
        <br>
         vtkInformation *outInfo =
    outputVector-&gt;GetInformationObject(0);<br>
    <br>
      vtkPolyData *output =
vtkPolyData::SafeDownCast(outInfo-&gt;Get(vtkDataObject::DATA_OBJECT()));<br>
        <br>
        size_t numPts = mMolecularModel-&gt;NumOfMolecules() ;<br>
    <br>
        vtkPoints* newPoints = vtkPoints::New();<br>
      newPoints-&gt;SetDataTypeToDouble(); //used later during
    transformation<br>
      newPoints-&gt;Allocate(numPts);<br>
        <br>
        mForces = vtkDoubleArray::New();<br>
      mForces-&gt;SetNumberOfComponents(3); //used later during
    transformation<br>
        mForces-&gt;SetName("Resultant_F") ;<br>
     <br>
        mLoads= vtkDoubleArray::New();<br>
      mLoads-&gt;SetNumberOfComponents(3); //used later during
    transformation<br>
        mLoads-&gt;SetName("External_F") ;<br>
        <br>
    <br>
         vtkCellArray* newVerts = vtkCellArray::New();<br>
    <br>
        for( size_t i = 0; i &lt; numPts; ++i)<br>
        {<br>
            const  GLW::Molecule &amp; mol =
    mMolecularModel-&gt;getMolecule(i) ;<br>
            const  GLW::Point &amp; x = mol.getCoord() ;<br>
            const  GLW::Point  f =
    mMolecularModel-&gt;getResultantForce(i) ;<br>
            const  GLW::Point  L = mol.getForce();<br>
    <br>
            vtkIdType id = newPoints-&gt;InsertNextPoint(x[0],x[1], x[2]
    ) ;<br>
            newVerts-&gt;InsertNextCell(1,&amp;id ) ;<br>
            //mNodeMap[node.GetNumber()] = id ;<br>
            <br>
            mForces-&gt;InsertNextTuple3(f[0],f[1],f[2]) ;<br>
            mLoads-&gt;InsertNextTuple3(L[0],L[1],L[2]) ;<br>
        }<br>
    <br>
        output-&gt;SetPoints(newPoints);<br>
        // TODO: what are verts? Are they necessary ?<br>
        output-&gt;SetVerts(newVerts) ;<br>
        <br>
        output-&gt;GetPointData()-&gt;SetVectors(mForces) ;<br>
        output-&gt;GetPointData()-&gt;AddArray(mLoads) ; ;<br>
    <br>
            <br>
      newPoints-&gt;Delete();<br>
        newVerts-&gt;Delete() ;<br>
    <br>
        return 1 ;<br>
    <br>
    }<br>
    <br>
    Note the lines:<br>
    output-&gt;GetPointData()-&gt;SetVectors(mForces) ;<br>
    output-&gt;GetPointData()-&gt;AddArray(mLoads) ; <br>
    What I understand from the documentations is, that we have 2 vector
    fields added to the data set, but one of them is treated in a
    special way - mForces. And this is the field, which will be rendered
    by arrows, when this source will be set as input to the vtkGlyph3d
    object, and calling the  vtkGlyph3D::SetVectorModeToUseVector()
    function. But I want to have another vtkGlyph3d object
    (simultaneously), but connected to mLoads field ? How to achieve
    this ?<br>
    One of my first thoughts is to write a filter wich takes the second
    vector field associated whith input and calls
output-&gt;GetPointData()-&gt;SetVectors(input-&gt;GetPointData()-&gt;GetArray(1)<br>
    <br>
    Does it looks reasonable ? Or perhaps there is already a simpler way
    ?<br>
    <br>
    Regards, <br>
    M.H.<br>
    <table class="memname">
      <tbody>
        <tr>
          <td class="memname"><br>
          </td>
          <td><br>
          </td>
          <td class="paramname"><br>
          </td>
          <td><br>
          </td>
        </tr>
      </tbody>
    </table>
  </body>
</html>