<commit_before>/*=========================================================================

  Program:   Visualization Toolkit
  Module:    vtkImageDataToUniformGrid.cxx

  Copyright (c) <NAME>, <NAME>, <NAME>
  All rights reserved.
  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.

     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notice for more information.

=========================================================================*/

#include "vtkImageDataToUniformGrid.h"

#include <vtkCellData.h>
#include <vtkDataObjectTree.h>
#include <vtkDataObjectTreeIterator.h>
#include <vtkInformation.h>
#include <vtkInformationVector.h>
#include <vtkNew.h>
#include <vtkObjectFactory.h>
#include <vtkPointData.h>
#include <vtkStreamingDemandDrivenPipeline.h>
#include <vtkUniformGrid.h>
#include <vtkUnsignedCharArray.h>

vtkStandardNewMacro(vtkImageDataToUniformGrid);

//----------------------------------------------------------------------------
vtkImageDataToUniformGrid::vtkImageDataToUniformGrid()
{
}

//----------------------------------------------------------------------------
vtkImageDataToUniformGrid::~vtkImageDataToUniformGrid()
{
}

//----------------------------------------------------------------------------
void vtkImageDataToUniformGrid::PrintSelf(ostream &os, vtkIndent indent)
{
  this->Superclass::PrintSelf(os, indent);
}

//----------------------------------------------------------------------------
int vtkImageDataToUniformGrid::RequestDataObject(vtkInformation *,
                                                 vtkInformationVector **inV,
                                                 vtkInformationVector *outV)
{
  vtkInformation* inInfo = inV[0]->GetInformationObject(0);
  if (!inInfo)
    {
    return VTK_ERROR;
    }

  vtkInformation* outInfo = outV->GetInformationObject(0);

  if(vtkDataObjectTree* input =
     vtkDataObjectTree::GetData(inInfo) )
    {
    vtkDataObjectTree* output = vtkDataObjectTree::GetData(outInfo);
    if (!output)
      {
      output = input->NewInstance();
      outInfo->Set(vtkDataObject::DATA_OBJECT(), output);
      this->GetOutputPortInformation(0)->Set(
        vtkDataObject::DATA_EXTENT_TYPE(), output->GetExtentType());
      output->Delete();
      }
    return VTK_OK;
    }
  else
    {
    vtkUniformGrid* output = vtkUniformGrid::GetData(outInfo);
    if (!output)
      {
      output = vtkUniformGrid::New();
      outInfo->Set(vtkDataObject::DATA_OBJECT(), output);
      this->GetOutputPortInformation(0)->Set(
        vtkDataObject::DATA_EXTENT_TYPE(), output->GetExtentType());
      output->Delete();
      }
    return 1;
    }

  return VTK_OK;
}

//----------------------------------------------------------------------------
int vtkImageDataToUniformGrid::RequestData(vtkInformation *,
                                           vtkInformationVector **,
                                           vtkInformationVector *outV)
{
  vtkDataObject* input = this->GetInput();
  vtkInformation *outInfo = outV->GetInformationObject(0);
  vtkDataObject *output = outInfo->Get(vtkDataObject::DATA_OBJECT());

  vtkInformation *inArrayInfo = this->GetInputArrayInformation(0);
  if (!inArrayInfo)
    {
    vtkErrorMacro("Problem getting array to process.");
    return 0;
    }
  int association = -1;
  if (!inArrayInfo->Has(vtkDataObject::FIELD_ASSOCIATION()))
    {<commit_msg>Getting rid of another warning for vtkImageDataToUniformGrid filter.<commit_after>/*=========================================================================

  Program:   Visualization Toolkit
  Module:    vtkImageDataToUniformGrid.cxx

  Copyright (c) <NAME>, <NAME>, <NAME>
  All rights reserved.
  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.

     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notice for more information.

=========================================================================*/

#include "vtkImageDataToUniformGrid.h"

#include <vtkCellData.h>
#include <vtkDataObjectTree.h>
#include <vtkDataObjectTreeIterator.h>
#include <vtkInformation.h>
#include <vtkInformationVector.h>
#include <vtkNew.h>
#include <vtkObjectFactory.h>
#include <vtkPointData.h>
#include <vtkStreamingDemandDrivenPipeline.h>
#include <vtkUniformGrid.h>
#include <vtkUnsignedCharArray.h>

vtkStandardNewMacro(vtkImageDataToUniformGrid);

//----------------------------------------------------------------------------
vtkImageDataToUniformGrid::vtkImageDataToUniformGrid()
{
}

//----------------------------------------------------------------------------
vtkImageDataToUniformGrid::~vtkImageDataToUniformGrid()
{
}

//----------------------------------------------------------------------------
void vtkImageDataToUniformGrid::PrintSelf(ostream &os, vtkIndent indent)
{
  this->Superclass::PrintSelf(os, indent);
}

//----------------------------------------------------------------------------
int vtkImageDataToUniformGrid::RequestDataObject(vtkInformation *,
                                                 vtkInformationVector **inV,
                                                 vtkInformationVector *outV)
{
  vtkInformation* inInfo = inV[0]->GetInformationObject(0);
  if (!inInfo)
    {
    return VTK_ERROR;
    }

  vtkInformation* outInfo = outV->GetInformationObject(0);

  if(vtkDataObjectTree* input = vtkDataObjectTree::GetData(inInfo) )
    { // multiblock data sets
    vtkDataObjectTree* output = vtkDataObjectTree::GetData(outInfo);
    if (!output)
      {
      output = input->NewInstance();
      outInfo->Set(vtkDataObject::DATA_OBJECT(), output);
      this->GetOutputPortInformation(0)->Set(
        vtkDataObject::DATA_EXTENT_TYPE(), output->GetExtentType());
      output->Delete();
      }
    return VTK_OK;
    }
  if(vtkUniformGrid* output = vtkUniformGrid::GetData(outInfo))
    {
    output = vtkUniformGrid::New();
    outInfo->Set(vtkDataObject::DATA_OBJECT(), output);
    this->GetOutputPortInformation(0)->Set(
      vtkDataObject::DATA_EXTENT_TYPE(), output->GetExtentType());
    output->Delete();

    return VTK_OK;
    }

  vtkErrorMacro("Output grid problem.");
  return VTK_ERROR;
}

//----------------------------------------------------------------------------
int vtkImageDataToUniformGrid::RequestData(vtkInformation *,
                                           vtkInformationVector **,
                                           vtkInformationVector *outV)
{
  vtkDataObject* input = this->GetInput();
  vtkInformation *outInfo = outV->GetInformationObject(0);
  vtkDataObject *output = outInfo->Get(vtkDataObject::DATA_OBJECT());

  vtkInformation *inArrayInfo = this->GetInputArrayInformation(0);
  if (!inArrayInfo)
    {
    vtkErrorMacro("Problem getting array to process.");
    return 0;
    }
  int association = -1;
  if (!inArrayInfo->Has(vtkDataObject::FIELD_ASSOCIATION()))
    {
{'fraction_non_alphanumeric': 0.24470621231243864, 'fraction_numerical': 0.0026644229420838593, 'mean_word_length': 2.3641509433962264, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 69, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 16, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4033939', 'n_tokens_mistral': 1907, 'n_tokens_neox': 1877, 'n_words': 340}