# ERROR: Glyph filter input array index not specified

**URL:** https://discourse.paraview.org/t/error-glyph-filter-input-array-index-not-specified/12018
**Category:** Development
**Created:** [May 4, 2023, 2:06am UTC](https://discourse.paraview.org/t/error-glyph-filter-input-array-index-not-specified/12018 "2023-05-04T02:06:54Z")
**Posts on this page:** 15
**Page:** 2

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [May 12, 2023, 10:07am UTC](https://discourse.paraview.org/t/error-glyph-filter-input-array-index-not-specified/12018/23 "2023-05-12T10:07:43Z")

</div>

I still dont follow, please include screenshot to explain what is missing

---

<div class="post-metadata">

### Author: ![Muhammad\_Saad\_Atique](https://discourse.paraview.org/user_avatar/discourse.paraview.org/muhammad_saad_atique/32/11159_2.png) [@Muhammad\_Saad\_Atique](https://discourse.paraview.org/u/Muhammad_Saad_Atique)
#### Post date: [May 12, 2023, 10:52am UTC](https://discourse.paraview.org/t/error-glyph-filter-input-array-index-not-specified/12018/25 "2023-05-12T10:52:03Z")

</div>

> [@mwestphal](#):
>
> I still dont follow, please include screenshot to explain what is missing

Sorry for the continued confusion

This is when I apply my new combined filter. You see in the Orientation Array dropdown below, it does not show the “Result” array from the Calculator part.

 ![image](https://discourse.paraview.org/uploads/default/original/2X/1/18af74c3284424462912a2f2b416552ec858e104.png)

Whereas, if I don’t use my combined filter but instead use Calculator filter first and then glyph filter. I can see the “Result” array in the Orientation and Scale dropdowns:

 ![image](https://discourse.paraview.org/uploads/default/original/2X/6/6cd5859ba1b38584b1aba280782bec5d57ecc460.png)

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [May 12, 2023, 11:11am UTC](https://discourse.paraview.org/t/error-glyph-filter-input-array-index-not-specified/12018/26 "2023-05-12T11:11:08Z")

</div>

This is expected, the domains are extracted from the input of the filter.

---

<div class="post-metadata">

### Author: ![Muhammad\_Saad\_Atique](https://discourse.paraview.org/user_avatar/discourse.paraview.org/muhammad_saad_atique/32/11159_2.png) [@Muhammad\_Saad\_Atique](https://discourse.paraview.org/u/Muhammad_Saad_Atique)
#### Post date: [May 12, 2023, 11:16am UTC](https://discourse.paraview.org/t/error-glyph-filter-input-array-index-not-specified/12018/27 "2023-05-12T11:16:57Z")

</div>

But you see that in both cases the pipeline is the same — (Import Cylinder, extract same surface, apply calculator and glyph filters)

So according to my understanding the input should be same, no?

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [May 12, 2023, 11:18am UTC](https://discourse.paraview.org/t/error-glyph-filter-input-array-index-not-specified/12018/29 "2023-05-12T11:18:30Z")

</div>

GlyphFilter input is calculator output.  
ForceFilter input is ExtractSelection output.

Not the same.

---

<div class="post-metadata">

### Author: ![Muhammad\_Saad\_Atique](https://discourse.paraview.org/user_avatar/discourse.paraview.org/muhammad_saad_atique/32/11159_2.png) [@Muhammad\_Saad\_Atique](https://discourse.paraview.org/u/Muhammad_Saad_Atique)
#### Post date: [May 12, 2023, 11:24am UTC](https://discourse.paraview.org/t/error-glyph-filter-input-array-index-not-specified/12018/31 "2023-05-12T11:24:22Z")

</div>

> [@mwestphal](#):
>
> Not the same

I see. I thought when I am passing calculators output i forceFilter to the glyph part I will be able to achieve the desired functionality.

this-\>GlyphFilter-\>SetInputData(dataset);

this-\>GlyphFilter-\>SetInputConnection(this-\>ArrayCalculator-\>GetOutputPort());

If not is there a way to somehow do that?

And thanks a lot for your help and patience!

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [May 12, 2023, 11:35am UTC](https://discourse.paraview.org/t/error-glyph-filter-input-array-index-not-specified/12018/32 "2023-05-12T11:35:13Z")

</div>

VTK input and ParaView input is not the same.

> If not is there a way to somehow do that?

You should not expose this setting and set it manually in your C++ code.

---

<div class="post-metadata">

### Author: ![Muhammad\_Saad\_Atique](https://discourse.paraview.org/user_avatar/discourse.paraview.org/muhammad_saad_atique/32/11159_2.png) [@Muhammad\_Saad\_Atique](https://discourse.paraview.org/u/Muhammad_Saad_Atique)
#### Post date: [May 12, 2023, 11:36am UTC](https://discourse.paraview.org/t/error-glyph-filter-input-array-index-not-specified/12018/33 "2023-05-12T11:36:56Z")

</div>

> [@mwestphal](#):
>
> You should not expose this setting and set it manually in your C++ code.

I will do that.

Thank you so much!

---

<div class="post-metadata">

### Author: ![Muhammad\_Saad\_Atique](https://discourse.paraview.org/user_avatar/discourse.paraview.org/muhammad_saad_atique/32/11159_2.png) [@Muhammad\_Saad\_Atique](https://discourse.paraview.org/u/Muhammad_Saad_Atique)
#### Post date: [May 23, 2023, 9:07pm UTC](https://discourse.paraview.org/t/error-glyph-filter-input-array-index-not-specified/12018/35 "2023-05-23T21:07:40Z")

</div>

> [@mwestphal](#):
>
> This is expected, the domains are extracted from the input of the filter.

If I try to apply my ForceFilter (calculator + glyph) twice on two different surface it does not let me do that and the filter menu is greyed out (see the first figure).

 ![Screenshot (1)](https://discourse.paraview.org/uploads/default/original/2X/7/7afd1b0c450fef1d1aa0eee556048a1f20c5066b.png)

I can achieve the same functionality if I apply calculator + glyph filter separately (see the second figure)

 ![image](https://discourse.paraview.org/uploads/default/original/2X/c/c1f0df32814fbe48192fbb56a14e79880b63e4e9.png)

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [May 24, 2023, 6:47am UTC](https://discourse.paraview.org/t/error-glyph-filter-input-array-index-not-specified/12018/36 "2023-05-24T06:47:20Z")

</div>

> [@Muhammad\_Saad\_Atique](#):
>
> the filter menu is greyed out (see the first figure).

Press apply

---

<div class="post-metadata">

### Author: ![Muhammad\_Saad\_Atique](https://discourse.paraview.org/user_avatar/discourse.paraview.org/muhammad_saad_atique/32/11159_2.png) [@Muhammad\_Saad\_Atique](https://discourse.paraview.org/u/Muhammad_Saad_Atique)
#### Post date: [May 24, 2023, 3:40pm UTC](https://discourse.paraview.org/t/error-glyph-filter-input-array-index-not-specified/12018/37 "2023-05-24T15:40:18Z")

</div>

How did I even miss that 🤦‍♂️

---

<div class="post-metadata">

### Author: ![Muhammad\_Saad\_Atique](https://discourse.paraview.org/user_avatar/discourse.paraview.org/muhammad_saad_atique/32/11159_2.png) [@Muhammad\_Saad\_Atique](https://discourse.paraview.org/u/Muhammad_Saad_Atique)
#### Post date: [May 31, 2023, 1:52am UTC](https://discourse.paraview.org/t/error-glyph-filter-input-array-index-not-specified/12018/38 "2023-05-31T01:52:37Z")

</div>

> [@mwestphal](#):
>
> This is expected, the domains are extracted from the input of the filter.

I am applying multiple Force filter, then I group them using `Group Datasets` filter. After that I am applying Resample with dataset to convert into my original mesh form.  
But if I use my apply force filter (instead of calculator + glyph) filter I don’t see the force vector (actually the function in calculator) in Resample with dataset in some cases.

By force vector I mean:  
`0*iHat + 0*jHat + 4*kHat`

This is the pipeline with my `ApplyForce` filter. Here you can see that I cannot see any Force value. Btw this only happens if I have 0 in two directions and only one non zero value.

And if you see in ResampleWithDataset vtkValidPointMask are all 0 (not sure why)

 ![image](https://discourse.paraview.org/uploads/default/original/2X/8/8027a2523339efd17020a42c6757a24e59b66f50.jpeg)

But if I use Calculator + Glyph instead of ApplyForce then it works fine with any sort of vector, which is how it should be.

 ![image](https://discourse.paraview.org/uploads/default/original/2X/b/b4e1f83c9129626cdd8b773689508ba456a8dfa3.jpeg)

Here you can see that Force equation is present in the Group Dataset also:

 ![image](https://discourse.paraview.org/uploads/default/original/2X/9/9a768b3ddc379dcbaefe82a958940f2a5b18cc50.png)

Can you please help me with it.  
My assumptions are that maybe in one case I am applying GroupDataset directly on calculator but in the other case I am applying GroupDataset to the ApplyForce filter so maybe something is wrong there. But then in both cases I have the same output of GroupDataset.

And in some cases I don’t have this issue if I change the Force vector equation to maybe have non zero in jHat and other 0s.

Thanks in advance for your help and patience.

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [May 31, 2023, 8:24am UTC](https://discourse.paraview.org/t/error-glyph-filter-input-array-index-not-specified/12018/39 "2023-05-31T08:24:28Z")

</div>

> if I use my apply force filter (instead of calculator + glyph) filter I don’t see the force vector

What is apply force filter ? Maybe the data is not computed. Check your filter.

---

<div class="post-metadata">

### Author: ![Muhammad\_Saad\_Atique](https://discourse.paraview.org/user_avatar/discourse.paraview.org/muhammad_saad_atique/32/11159_2.png) [@Muhammad\_Saad\_Atique](https://discourse.paraview.org/u/Muhammad_Saad_Atique)
#### Post date: [May 31, 2023, 9:22am UTC](https://discourse.paraview.org/t/error-glyph-filter-input-array-index-not-specified/12018/40 "2023-05-31T09:22:50Z")

</div>

> [@mwestphal](#):
>
> What is apply force filter

Force filter is the combination of `Calculator` filter and `Glyph` Filter:

```auto

vtkStandardNewMacro(vtkMyForceFilter);

vtkMyForceFilter::vtkMyForceFilter()

{
  
  this->ArrayCalculator = vtkSmartPointer<vtkPVArrayCalculator>::New();

  this->GlyphFilter = vtkSmartPointer<vtkPVGlyphFilter>::New();
  this->SetNumberOfInputPorts(2);

}

vtkMyForceFilter::~vtkMyForceFilter()
{

}

void vtkMyForceFilter::SetAttributeType(int value)
{
  this->ArrayCalculator->SetAttributeType(value);
  this->Modified();
}

void vtkMyForceFilter::SetCoordinateResults(int value)
{
  this->ArrayCalculator->SetCoordinateResults(value);
  this->Modified();
}
void vtkMyForceFilter::SetResultNormals(int value)
{
  this->ArrayCalculator->SetResultNormals(value);
  this->Modified();
}

void vtkMyForceFilter::SetResultTCoords(int value)
{
  this->ArrayCalculator->SetResultTCoords(value);
  this->Modified();
}
void vtkMyForceFilter::SetResultArrayName(std::string value)
{
  this->ArrayCalculator->SetResultArrayName(value.c_str());
  this->Modified();
}

void vtkMyForceFilter::SetFunction(std::string value)
{
  
  this->ArrayCalculator->SetFunction(value.c_str());
  this->Modified();
}

void vtkMyForceFilter::SetReplaceInvalidValues(int value)
{
  this->ArrayCalculator->SetReplaceInvalidValues(value);
  this->Modified();
}

void vtkMyForceFilter::SetReplacementValue(double value)
{
  this->ArrayCalculator->SetReplacementValue(value);
  this->Modified();
}

void vtkMyForceFilter::SetResultArrayType(int value)
{
  this->ArrayCalculator->SetResultArrayType(value);
  this->Modified();
}

void vtkMyForceFilter::SetFunctionParserTypeFromInt(int value)
{
  this->ArrayCalculator->SetFunctionParserTypeFromInt(value);
  this->Modified();
}

// Glyph Methods for XML

void vtkMyForceFilter::SetVectorScaleMode(int value)
{
  this->GlyphFilter->SetVectorScaleMode(value);
  this->Modified();
}

void vtkMyForceFilter::SetScaleFactor(double value)
{
  this->GlyphFilter->SetScaleFactor(value);
  this->Modified();
}
void vtkMyForceFilter::SetGlyphMode(int value)
{
  this->GlyphFilter->SetGlyphMode(value);
  this->Modified();
}
void vtkMyForceFilter::SetMaximumNumberOfSamplePoints(int value)
{
  this->GlyphFilter->SetMaximumNumberOfSamplePoints(value);
  this->Modified();
}
void vtkMyForceFilter::SetSeed(int value)
{
  this->GlyphFilter->SetSeed(value);
  this->Modified();
}
void vtkMyForceFilter::SetStride(int value)
{
  this->GlyphFilter->SetStride(value);
  this->Modified();
}

void vtkMyForceFilter::SetSourceTransform(vtkTransform* transform)
{
    this->GlyphFilter->SetSourceTransform(transform);
    this->Modified();
}

// Specify a source object at a specified table location.
void vtkMyForceFilter::SetSourceConnection(int id, vtkAlgorithmOutput* algOutput)
{
  if (id < 0)
  {
    vtkErrorMacro("Bad index " << id << " for source.");
    return;
  }

  int numConnections = this->GetNumberOfInputConnections(1);
  if (id < numConnections)
  {
    this->SetNthInputConnection(1, id, algOutput);
  }
  else if (id == numConnections && algOutput)
  {
    this->AddInputConnection(1, algOutput);
  }
  else if (algOutput)
  {
    vtkWarningMacro("The source id provided is larger than the maximum "
                    "source id, using "
      << numConnections << " instead.");
    this->AddInputConnection(1, algOutput);
  }
}

int vtkMyForceFilter::FillInputPortInformation(int port, vtkInformation* info)
{
  if (port == 0)
  {
    info->Set(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(), "vtkDataSet");
    // we can handle composite datasets.
    info->Append(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(), "vtkCompositeDataSet");
    return 1;
  }
  else if (port == 1)
  {
    info->Set(vtkAlgorithm::INPUT_IS_REPEATABLE(), 1);
    info->Set(vtkAlgorithm::INPUT_IS_OPTIONAL(), 1);
    info->Set(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(), "vtkPolyData");
    return 1;
  }

  return 0;
}

void vtkMyForceFilter::SetInputArrayToProcess(int idx, int port, int connection, int fieldAssociation, const char *name)
{
    this->GlyphFilter->SetInputArrayToProcess(idx, port, connection, fieldAssociation, name);
    this->Modified();
}

int vtkMyForceFilter::RequestData(
    vtkInformation *request,
    vtkInformationVector **inputVector,
    vtkInformationVector *outputVector)
{

  auto* arrayCalcInput = vtkDataObject::GetData(inputVector[0], 0);
  vtkDataSet* output = vtkDataSet::GetData(outputVector);
  this->ArrayCalculator->SetInputData(arrayCalcInput);
  this->ArrayCalculator->Update();
  vtkDataObject* arrayCalcOutput = this->ArrayCalculator->GetOutputDataObject(0);
  vtkDataSet* dataset = vtkDataSet::SafeDownCast(arrayCalcOutput);

// Glyph Parts
  vtkNew<vtkArrowSource> arrowSource;

  this->GlyphFilter->SetSourceConnection(arrowSource->GetOutputPort());
  this->GlyphFilter->SetInputData(dataset);

  this->GlyphFilter->SetInputConnection(this->ArrayCalculator->GetOutputPort());

  // // Set the vector array 
  this->GlyphFilter->SetInputArrayToProcess(1, 0, 0, vtkDataObject::FIELD_ASSOCIATION_POINTS, "Force");

  this->GlyphFilter->Update();
  // Get the output data object of the GlyphFilter
  // vtkDataObject* glyphOutput = this->GlyphFilter->GetOutputDataObject(0);
  vtkDataObject* glyphOutput = this->GlyphFilter->GetOutput();

  // Shallow copy the output of GlyphFilter to the output of vtkMyForceFilter
 
  if (glyphOutput)
  {
    output->ShallowCopy(glyphOutput);
  }

  return 1;
}

```

---

<div class="post-metadata">

### Author: ![Muhammad\_Saad\_Atique](https://discourse.paraview.org/user_avatar/discourse.paraview.org/muhammad_saad_atique/32/11159_2.png) [@Muhammad\_Saad\_Atique](https://discourse.paraview.org/u/Muhammad_Saad_Atique)
#### Post date: [May 31, 2023, 1:31pm UTC](https://discourse.paraview.org/t/error-glyph-filter-input-array-index-not-specified/12018/41 "2023-05-31T13:31:05Z")

</div>

And the issue is with certain vectors.  
E.g. if I write 0_iHat + 0_jHat + 5\*kHat then when i apply resample with data it can’t this equation. It actually mask those points to 0  
So essentially if two dimensions are 0 then I have the issue and that’s when masking in resample with dataset happens, which is strange

[Previous page](https://discourse.paraview.org/t/error-glyph-filter-input-array-index-not-specified/12018.md?page=1)
