Filters/Core/Testing/Cxx/TestAppendDataSets.cxx
//////////////////////////////////////////////////////////////////////////////
// Returns 1 on success, 0 otherwise
//////////////////////////////////////////////////////////////////////////////
Returns 1 on success, 0 otherwise
Returns 1 on success 0 otherwise
int AppendDatasetsAndPrint(const std::vector<vtkDataSet*>& inputs, const char* expectedDataSetType)
{
  vtkNew<vtkAppendDataSets> append;
  for (size_t inputIndex = 0; inputIndex < inputs.size(); ++inputIndex)
  {
    append->AddInputData( inputs[inputIndex] );
  }
  append->SetOutputDataSetType(vtkDataObjectTypes::GetTypeIdFromClassName(expectedDataSetType));
  append->Update();
  vtkDataSet* output = append->GetOutput();
  if (!output->IsA(expectedDataSetType))
  {
    std::cerr << "Output dataset type is " << output->GetClassName() << " but is expected to be "
      << expectedDataSetType << std::endl;
    return 0;
  }
  if (!PrintAndCheck(inputs, output, vtkDataObject::POINT))
  {
    return 0;
  }
  if (!PrintAndCheck(inputs, output, vtkDataObject::CELL))
  {
    return 0;
  }
  if (output->GetPointData()->GetGlobalIds() == nullptr)
  {
    std::cerr << "Point global ids should have been preserved!\n";
    return 0;
  }
  if (output->GetCellData()->GetGlobalIds() == nullptr)
  {
    std::cerr << "Cell global ids should have been preserved!\n";
    return 0;
  }
  return AppendDatasetsAndCheckMergedArrayLengths(append);
}
int AppendDatasetsAndPrint ( const std :: vector < vtkDataSet * > & inputs , const char * expectedDataSetType ) { vtkNew < vtkAppendDataSets > append ; for ( size_t inputIndex = 0 ; inputIndex < inputs . size ( ) ; ++ inputIndex ) { append -> AddInputData ( inputs [ inputIndex ] ) ; } append -> SetOutputDataSetType ( vtkDataObjectTypes :: GetTypeIdFromClassName ( expectedDataSetType ) ) ; append -> Update ( ) ; vtkDataSet * output = append -> GetOutput ( ) ; if ( ! output -> IsA ( expectedDataSetType ) ) { std :: cerr << " " << output -> GetClassName ( ) << " " << expectedDataSetType << std :: endl ; return 0 ; } if ( ! PrintAndCheck ( inputs , output , vtkDataObject :: POINT ) ) { return 0 ; } if ( ! PrintAndCheck ( inputs , output , vtkDataObject :: CELL ) ) { return 0 ; } if ( output -> GetPointData ( ) -> GetGlobalIds ( ) == nullptr ) { std :: cerr << " \n " ; return 0 ; } if ( output -> GetCellData ( ) -> GetGlobalIds ( ) == nullptr ) { std :: cerr << " \n " ; return 0 ; } return AppendDatasetsAndCheckMergedArrayLengths ( append ) ; }
Returns 1 on success, 0 otherwise
Returns 1 on success 0 otherwise