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

  Program:   Visualization Toolkit
  Module:    vtkPReflectionFilter.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 "vtkPReflectionFilter.h"

#include "vtkObjectFactory.h"
#include "vtkBoundingBox.h"
#include "vtkMultiProcessController.h"

vtkStandardNewMacro(vtkPReflectionFilter);
vtkCxxRevisionMacro(vtkPReflectionFilter, "1.1");
vtkCxxSetObjectMacro(vtkPReflectionFilter, Controller, vtkMultiProcessController);
//----------------------------------------------------------------------------
vtkPReflectionFilter::vtkPReflectionFilter()
{
  this->Controller = 0;
  this->SetController(vtkMultiProcessController::GetGlobalController());
}

//----------------------------------------------------------------------------
vtkPReflectionFilter::~vtkPReflectionFilter()
{
  this->SetController(0);
}

//----------------------------------------------------------------------------
int vtkPReflectionFilter::ComputeBounds(vtkDataObject* input, double bounds[6])
{
  vtkBoundingBox bbox;

  if (this->Superclass::ComputeBounds(input, bounds))
    {
    bbox.SetBounds(bounds);
    }

  this->Controller->GetCommunicator()->ComputeGlobalBounds(
    this->Controller->GetLocalProcessId(),
    this->Controller->GetNumberOfProcesses(),
    &bbox);
  bbox.GetBounds(bounds);
  return 1;
}<commit_msg>BUG: Fixed segfaul when controller is not set.<commit_after>/*=========================================================================

  Program:   Visualization Toolkit
  Module:    vtkPReflectionFilter.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 "vtkPReflectionFilter.h"

#include "vtkObjectFactory.h"
#include "vtkBoundingBox.h"
#include "vtkMultiProcessController.h"

vtkStandardNewMacro(vtkPReflectionFilter);
vtkCxxRevisionMacro(vtkPReflectionFilter, "1.2");
vtkCxxSetObjectMacro(vtkPReflectionFilter, Controller, vtkMultiProcessController);
//----------------------------------------------------------------------------
vtkPReflectionFilter::vtkPReflectionFilter()
{
  this->Controller = 0;
  this->SetController(vtkMultiProcessController::GetGlobalController());
}

//----------------------------------------------------------------------------
vtkPReflectionFilter::~vtkPReflectionFilter()
{
  this->SetController(0);
}

//----------------------------------------------------------------------------
int vtkPReflectionFilter::ComputeBounds(vtkDataObject* input, double bounds[6])
{
  vtkBoundingBox bbox;

  if (this->Superclass::ComputeBounds(input, bounds))
    {
    bbox.SetBounds(bounds);
    }

  if (this->Controller)
    {
    this->Controller->GetCommunicator()->ComputeGlobalBounds(
      this->Controller->GetLocalProcessId(),
      this->Controller->GetNumberOfProcesses(),
      &bbox);
    bbox.GetBounds(bounds);
    }

  return 1;
}
{'fraction_non_alphanumeric': 0.2958057395143488, 'fraction_numerical': 0.0033112582781456954, 'mean_word_length': 2.918918918918919, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 32, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4717901', 'n_tokens_mistral': 925, 'n_tokens_neox': 919, 'n_words': 181}