Merge topic 'shallow'

e60203e7ea Adding a .md file
c08e9325ff Update vtkCompositeDataSet::ShallowCopy usage
4a1994d926 Rework vtkCompositeDataSet::ShallowCopy

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Acked-by: Spiros Tsalikis <spiros.tsalikis@kitware.com>
Acked-by: Timothee Chabat <timothee.chabat@kitware.com>
Merge-request: !9618
dev
Mathieu Westphal 2 months ago committed by Kitware Robot
commit 82626a33c5

@ -109,7 +109,7 @@ void vtkAMRDataInternals::GenerateIndex(bool force)
}
}
void vtkAMRDataInternals::ShallowCopy(vtkObject* src)
void vtkAMRDataInternals::CompositeShallowCopy(vtkObject* src)
{
if (src == this)
{
@ -124,7 +124,7 @@ void vtkAMRDataInternals::ShallowCopy(vtkObject* src)
this->Modified();
}
void vtkAMRDataInternals::RecursiveShallowCopy(vtkObject* src)
void vtkAMRDataInternals::ShallowCopy(vtkObject* src)
{
if (src == this)
{

@ -53,8 +53,8 @@ public:
void Insert(unsigned int index, vtkUniformGrid* grid);
vtkUniformGrid* GetDataSet(unsigned int compositeIndex);
virtual void ShallowCopy(vtkObject* src);
void RecursiveShallowCopy(vtkObject* src);
void CompositeShallowCopy(vtkObject* src);
void ShallowCopy(vtkObject* src);
bool Empty() const { return this->GetNumberOfBlocks() == 0; }

@ -281,7 +281,7 @@ void vtkAMRUtilities::StripGhostLayers(
if (!vtkAMRUtilities::HasPartiallyOverlappingGhostCells(ghostedAMRData))
{
strippedAMRData->ShallowCopy(ghostedAMRData);
strippedAMRData->CompositeShallowCopy(ghostedAMRData);
return;
}

@ -22,6 +22,7 @@
#include "vtkInformationIntegerKey.h"
#include "vtkInformationStringKey.h"
#include "vtkInformationVector.h"
#include "vtkLegacy.h"
#include "vtkObjectFactory.h"
#include "vtkSmartPointer.h"
@ -50,36 +51,22 @@ vtkCompositeDataSet* vtkCompositeDataSet::GetData(vtkInformationVector* v, int i
//------------------------------------------------------------------------------
void vtkCompositeDataSet::CopyStructure(vtkCompositeDataSet* input)
{
if (input != this)
{
// copy data-information and other common stuff by calling
// superclass' ShallowCopy.
this->Superclass::ShallowCopy(input);
}
// copy data-information and other common stuff by calling
// superclass' ShallowCopy.
this->Superclass::ShallowCopy(input);
}
//------------------------------------------------------------------------------
void vtkCompositeDataSet::ShallowCopy(vtkDataObject* src)
void vtkCompositeDataSet::CompositeShallowCopy(vtkCompositeDataSet* src)
{
if (src == this)
{
return;
}
this->Superclass::ShallowCopy(src);
this->Modified();
}
//------------------------------------------------------------------------------
void vtkCompositeDataSet::DeepCopy(vtkDataObject* src)
void vtkCompositeDataSet::RecursiveShallowCopy(vtkDataObject* src)
{
if (src == this)
{
return;
}
this->Superclass::DeepCopy(src);
this->Modified();
VTK_LEGACY_REPLACED_BODY(RecursiveShallowCopy, "VTK 9.3", ShallowCopy);
this->ShallowCopy(src);
}
//------------------------------------------------------------------------------

@ -35,6 +35,7 @@
#include "vtkCommonDataModelModule.h" // For export macro
#include "vtkDataObject.h"
#include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_3_0
#include <vector> // For GetDataSets
@ -115,21 +116,20 @@ public:
*/
void Initialize() override;
///@{
/**
* Shallow and Deep copy.
* The goal of the method is to copy the data up to the dataset pointers only.
* The implementation is delegated to the differenent subclasses.
* If you want to copy up to array pointers, @see vtkDataObject::ShallowCopy.
*
* This method just calls vtkDataObject::ShallowCopy.
*/
void ShallowCopy(vtkDataObject* src) override;
void DeepCopy(vtkDataObject* src) override;
///@}
virtual void CompositeShallowCopy(vtkCompositeDataSet* src);
/**
* For historical reasons, `vtkCompositeDataSet::ShallowCopy` simply pass
* pointers to the leaf non-composite datasets. In some cases, we truly want
* to shallow copy those leaf non-composite datasets as well. For those cases,
* use this method.
* @deprecated RecursiveShallowCopy method, @see ShallowCopy
*/
virtual void RecursiveShallowCopy(vtkDataObject* src) = 0;
VTK_DEPRECATED_IN_9_3_0("Use ShallowCopy instead.")
virtual void RecursiveShallowCopy(vtkDataObject* src);
/**
* Returns the total number of points of all blocks. This will

@ -225,7 +225,7 @@ bool vtkDataAssemblyUtilities::GenerateHierarchyInternal(
}
if (auto pdc = vtkPartitionedDataSetCollection::SafeDownCast(dobj))
{
output->GetPartitionedDataSet(oid)->ShallowCopy(pdc);
output->GetPartitionedDataSet(oid)->CompositeShallowCopy(pdc);
}
else if (auto mp = vtkMultiPieceDataSet::SafeDownCast(dobj))
{
@ -319,7 +319,7 @@ bool vtkDataAssemblyUtilities::GenerateHierarchyInternal(vtkPartitionedDataSetCo
assert(input != nullptr && hierarchy != nullptr);
if (output)
{
output->ShallowCopy(input);
output->CompositeShallowCopy(input);
}
std::map<int, unsigned int> output_node2dataset_map;

@ -501,6 +501,12 @@ void vtkDataObject::ShallowCopy(vtkDataObject* src)
return;
}
if (src == this)
{
vtkWarningMacro("Attempted to ShallowCopy the data object into itself.");
return;
}
this->InternalDataObjectCopy(src);
if (!src->FieldData)
@ -526,6 +532,18 @@ void vtkDataObject::ShallowCopy(vtkDataObject* src)
//------------------------------------------------------------------------------
void vtkDataObject::DeepCopy(vtkDataObject* src)
{
if (!src)
{
vtkWarningMacro("Attempted to DeepCopy from null.");
return;
}
if (src == this)
{
vtkWarningMacro("Attempted to DeepCopy the data object into itself.");
return;
}
vtkFieldData* srcFieldData = src->GetFieldData();
this->InternalDataObjectCopy(src);
@ -581,6 +599,8 @@ void vtkDataObject::InternalDataObjectCopy(vtkDataObject* src)
// this->PipelineMTime = src->PipelineMTime;
// this->UpdateTime = src->UpdateTime;
// this->Locality = src->Locality;
this->Modified();
}
//------------------------------------------------------------------------------

@ -217,14 +217,23 @@ public:
*/
virtual void PrepareForNewData() { this->Initialize(); }
///@{
/**
* Shallow and Deep copy. These copy the data, but not any of the
* pipeline connections.
* The goal of the method is to copy the data up to the array pointers only.
* The implementation is delegated to the differenent subclasses.
* If you want to copy the actual data, @see DeepCopy.
*
* This method shallow copy the field data and copy the internal structure.
*/
virtual void ShallowCopy(vtkDataObject* src);
/**
* The goal of the method is to copy the complete data from src into this object.
* The implementation is delegated to the differenent subclasses.
* If you want to copy the data up to the array pointers only, @see ShallowCopy.
*
* This method deep copy the field data and copy the internal structure.
*/
virtual void DeepCopy(vtkDataObject* src);
///@}
/**
* The ExtentType will be left as VTK_PIECES_EXTENT for data objects

@ -21,6 +21,7 @@
#include "vtkInformationIntegerKey.h"
#include "vtkInformationStringKey.h"
#include "vtkInformationVector.h"
#include "vtkLegacy.h"
#include "vtkMultiPieceDataSet.h"
#include "vtkObjectFactory.h"
@ -470,7 +471,7 @@ int vtkDataObjectTree::HasMetaData(vtkCompositeDataIterator* compositeIter)
}
//------------------------------------------------------------------------------
void vtkDataObjectTree::ShallowCopy(vtkDataObject* src)
void vtkDataObjectTree::CompositeShallowCopy(vtkCompositeDataSet* src)
{
if (src == this)
{
@ -478,7 +479,7 @@ void vtkDataObjectTree::ShallowCopy(vtkDataObject* src)
}
this->Internals->Children.clear();
this->Superclass::ShallowCopy(src);
this->Superclass::CompositeShallowCopy(src);
vtkDataObjectTree* from = vtkDataObjectTree::SafeDownCast(src);
if (from)
@ -490,10 +491,11 @@ void vtkDataObjectTree::ShallowCopy(vtkDataObject* src)
vtkDataObject* child = from->GetChild(cc);
if (child)
{
if (child->IsA("vtkDataObjectTree"))
vtkDataObjectTree* childTree = vtkDataObjectTree::SafeDownCast(child);
if (childTree)
{
vtkDataObject* clone = child->NewInstance();
clone->ShallowCopy(child);
vtkDataObjectTree* clone = childTree->NewInstance();
clone->CompositeShallowCopy(childTree);
this->SetChild(cc, clone);
clone->FastDelete();
}
@ -505,7 +507,7 @@ void vtkDataObjectTree::ShallowCopy(vtkDataObject* src)
if (from->HasChildMetaData(cc))
{
vtkInformation* toInfo = this->GetChildMetaData(cc);
toInfo->Copy(from->GetChildMetaData(cc), /*deep=*/0);
toInfo->Copy(from->GetChildMetaData(cc), 0);
}
}
}
@ -549,7 +551,7 @@ void vtkDataObjectTree::DeepCopy(vtkDataObject* src)
}
//------------------------------------------------------------------------------
void vtkDataObjectTree::RecursiveShallowCopy(vtkDataObject* src)
void vtkDataObjectTree::ShallowCopy(vtkDataObject* src)
{
if (src == this)
{
@ -584,6 +586,13 @@ void vtkDataObjectTree::RecursiveShallowCopy(vtkDataObject* src)
this->Modified();
}
//------------------------------------------------------------------------------
void vtkDataObjectTree::RecursiveShallowCopy(vtkDataObject* src)
{
VTK_LEGACY_REPLACED_BODY(RecursiveShallowCopy, "VTK 9.3", ShallowCopy);
this->ShallowCopy(src);
}
//------------------------------------------------------------------------------
void vtkDataObjectTree::Initialize()
{

@ -35,6 +35,7 @@
#include "vtkCommonDataModelModule.h" // For export macro
#include "vtkCompositeDataSet.h"
#include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_3_0
VTK_ABI_NAMESPACE_BEGIN
class vtkCompositeDataIterator;
@ -125,13 +126,19 @@ public:
///@{
/**
* Shallow and Deep copy.
* CompositeShallow, Shallow and Deep copy.
*/
void CompositeShallowCopy(vtkCompositeDataSet* src) override;
void ShallowCopy(vtkDataObject* src) override;
void DeepCopy(vtkDataObject* src) override;
void RecursiveShallowCopy(vtkDataObject* src) override;
///@}
/**
* @deprecated RecursiveShallowCopy method, @see ShallowCopy
*/
VTK_DEPRECATED_IN_9_3_0("Please use ShallowCopy instead.")
void RecursiveShallowCopy(vtkDataObject* src) override;
/**
* Returns the total number of points of all blocks. This will
* iterate over all blocks and call GetNumberOfPoints() so it

@ -174,6 +174,16 @@ void vtkPartitionedDataSetCollection::CopyStructure(vtkCompositeDataSet* input)
}
}
//------------------------------------------------------------------------------
void vtkPartitionedDataSetCollection::CompositeShallowCopy(vtkCompositeDataSet* src)
{
this->Superclass::CompositeShallowCopy(src);
if (auto pdc = vtkPartitionedDataSetCollection::SafeDownCast(src))
{
this->SetDataAssembly(pdc->GetDataAssembly());
}
}
//------------------------------------------------------------------------------
void vtkPartitionedDataSetCollection::ShallowCopy(vtkDataObject* src)
{

@ -164,6 +164,7 @@ public:
/**
* Overridden to handle vtkDataAssembly.
*/
void CompositeShallowCopy(vtkCompositeDataSet* src) override;
void ShallowCopy(vtkDataObject* src) override;
void DeepCopy(vtkDataObject* src) override;
void CopyStructure(vtkCompositeDataSet* input) override;

@ -18,6 +18,7 @@
#include "vtkInformation.h"
#include "vtkInformationKey.h"
#include "vtkInformationVector.h"
#include "vtkLegacy.h"
#include "vtkMath.h"
#include "vtkObjectFactory.h"
#include "vtkType.h"
@ -257,19 +258,19 @@ vtkUniformGridAMR* vtkUniformGridAMR::GetData(vtkInformationVector* v, int i)
}
//------------------------------------------------------------------------------
void vtkUniformGridAMR::ShallowCopy(vtkDataObject* src)
void vtkUniformGridAMR::CompositeShallowCopy(vtkCompositeDataSet* src)
{
if (src == this)
{
return;
}
this->Superclass::ShallowCopy(src);
this->Superclass::CompositeShallowCopy(src);
if (vtkUniformGridAMR* hbds = vtkUniformGridAMR::SafeDownCast(src))
{
this->SetAMRInfo(hbds->GetAMRInfo());
this->AMRData->ShallowCopy(hbds->GetAMRData());
this->AMRData->CompositeShallowCopy(hbds->GetAMRData());
memcpy(this->Bounds, hbds->Bounds, sizeof(double) * 6);
}
@ -316,7 +317,7 @@ void vtkUniformGridAMR::CopyStructure(vtkCompositeDataSet* src)
}
//------------------------------------------------------------------------------
void vtkUniformGridAMR::RecursiveShallowCopy(vtkDataObject* src)
void vtkUniformGridAMR::ShallowCopy(vtkDataObject* src)
{
if (src == this)
{
@ -328,13 +329,20 @@ void vtkUniformGridAMR::RecursiveShallowCopy(vtkDataObject* src)
if (vtkUniformGridAMR* hbds = vtkUniformGridAMR::SafeDownCast(src))
{
this->SetAMRInfo(hbds->GetAMRInfo());
this->AMRData->RecursiveShallowCopy(hbds->GetAMRData());
this->AMRData->ShallowCopy(hbds->GetAMRData());
memcpy(this->Bounds, hbds->Bounds, sizeof(double) * 6);
}
this->Modified();
}
//------------------------------------------------------------------------------
void vtkUniformGridAMR::RecursiveShallowCopy(vtkDataObject* src)
{
VTK_LEGACY_REPLACED_BODY(RecursiveShallowCopy, "VTK 9.3", ShallowCopy);
this->ShallowCopy(src);
}
//------------------------------------------------------------------------------
const double* vtkUniformGridAMR::GetBounds()
{

@ -27,6 +27,7 @@
#include "vtkCommonDataModelModule.h" // For export macro
#include "vtkCompositeDataSet.h"
#include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_3_0
VTK_ABI_NAMESPACE_BEGIN
class vtkCompositeDataIterator;
@ -133,10 +134,16 @@ public:
/**
* ShallowCopy.
*/
void CompositeShallowCopy(vtkCompositeDataSet* src) override;
void ShallowCopy(vtkDataObject* src) override;
void RecursiveShallowCopy(vtkDataObject* src) override;
///@}
/**
* Depreacted RecursiveShallowCopy method, uses ShallowCopy
*/
VTK_DEPRECATED_IN_9_3_0("Please use ShallowCopy instead.")
void RecursiveShallowCopy(vtkDataObject* src) override;
/**
* DeepCopy.
*/

@ -0,0 +1,5 @@
## Rework vtkCompositeDataSet::ShallowCopy
- vtkCompositeDataSet::ShallowCopy now do an actual shallow copy up to array pointers
- Introduce a vtkCompositeDataSet::CompositeShallowCopy that shallow copy up to dataset pointers only
- Deprecate vtkCompositeDataSet::RecursiveShallowCopy

@ -287,7 +287,7 @@ vtkOverlappingAMR* GetAMRDataSet(const int dimension, const int refinementRatio)
amrGPSource->SetRefinementRatio(refinementRatio);
amrGPSource->Update();
vtkOverlappingAMR* myAMR = vtkOverlappingAMR::New();
myAMR->ShallowCopy(amrGPSource->GetOutput());
myAMR->CompositeShallowCopy(amrGPSource->GetOutput());
amrGPSource->Delete();
return (myAMR);
}

@ -618,7 +618,7 @@ int vtkAMRSliceFilter::RequestData(vtkInformation* vtkNotUsed(request),
if (this->IsAMRData2D(inputAMR))
{
outputAMR->ShallowCopy(inputAMR);
outputAMR->CompositeShallowCopy(inputAMR);
return 1;
}

@ -100,7 +100,7 @@ int vtkAppendCompositeDataLeaves::RequestData(vtkInformation* vtkNotUsed(request
if (numInputs == 1)
{
// trivial case.
output->ShallowCopy(input0);
output->CompositeShallowCopy(input0);
return 1;
}

@ -57,7 +57,7 @@ int vtkConvertToPartitionedDataSetCollection::RequestData(
if (auto pdc = vtkPartitionedDataSetCollection::SafeDownCast(inputDO))
{
// nothing to do, input is already a vtkPartitionedDataSetCollection.
output->ShallowCopy(pdc);
output->CompositeShallowCopy(pdc);
this->CheckAbort();
return 1;
}

@ -115,7 +115,7 @@ int vtkExtractBlock::RequestData(vtkInformation* vtkNotUsed(request),
if (this->Indices->find(0) != this->Indices->end())
{
// trivial case.
output->ShallowCopy(input);
output->CompositeShallowCopy(input);
return 1;
}
@ -236,7 +236,7 @@ bool vtkExtractBlock::Prune(vtkMultiBlockDataSet* mblock)
vtkMultiBlockDataSet::SafeDownCast(mblock->GetBlock(0));
if (block0)
{
mblock->ShallowCopy(block0);
mblock->CompositeShallowCopy(block0);
}
}
return (oindex == 0);

@ -336,7 +336,7 @@ int vtkExtractBlockUsingDataAssembly::RequestData(
if (auto result = vtkDataAssemblyUtilities::GenerateCompositeDataSetFromHierarchy(
xformedOutput, xformedOutput->GetDataAssembly()))
{
outputCD->ShallowCopy(result);
outputCD->CompositeShallowCopy(result);
return 1;
}

@ -98,7 +98,7 @@ void vtkCopySubTree(std::unordered_set<unsigned int>& ids, vtkCompositeDataItera
assert(coutput != nullptr);
// shallow copy..this pass the non-leaf nodes over.
coutput->ShallowCopy(cinput);
coutput->CompositeShallowCopy(cinput);
// now, we need to remove all composite ids for the subtree from the set to
// extract to avoid attempting to copy them multiple times (although it
@ -191,7 +191,7 @@ int vtkExtractSelectedBlock::RequestData(vtkInformation* vtkNotUsed(request),
if (has_root && !inverse)
{
// pass everything.
output->ShallowCopy(cd);
output->CompositeShallowCopy(cd);
return 1;
}

@ -195,7 +195,7 @@ int vtkAnimateModes::RequestData(
auto outputDT = vtkDataObjectTree::SafeDownCast(outputDO);
assert(outputDT);
outputDT->RecursiveShallowCopy(inputDT);
outputDT->ShallowCopy(inputDT);
for (auto block : vtkCompositeDataSet::GetDataSets<vtkPointSet>(outputDT))
{
executeBlock(block);

@ -249,7 +249,7 @@ int vtkMergeTimeFilter::RequestData(vtkInformation* vtkNotUsed(request),
}
groupInputs->SetContainerAlgorithm(this);
groupInputs->Update();
output->ShallowCopy(groupInputs->GetOutput());
output->CompositeShallowCopy(groupInputs->GetOutput());
output->GetInformation()->Set(vtkDataObject::DATA_TIME_STEP(), this->RequestedTimeValue);

@ -114,7 +114,7 @@ int vtkMultiBlockDataGroupFilter::RequestData(vtkInformation* vtkNotUsed(request
{
vtkMultiBlockDataSet* block = vtkMultiBlockDataSet::SafeDownCast(output->GetBlock(0));
block->Register(this);
output->ShallowCopy(block);
output->CompositeShallowCopy(block);
block->UnRegister(this);
}

@ -69,7 +69,7 @@ int vtkMultiBlockMergeFilter::RequestData(vtkInformation* vtkNotUsed(request),
{
// shallow copy first input to output to start off with
// cerr << "Copy first input" << endl;
output->ShallowCopy(vtkMultiBlockDataSet::SafeDownCast(input));
output->CompositeShallowCopy(vtkMultiBlockDataSet::SafeDownCast(input));
first = 0;
}
else

@ -223,7 +223,7 @@ vtkDataObject* vtkTemporalArrayOperatorFilter::Process(
vtkCompositeDataSet* compositeDataSet1 = vtkCompositeDataSet::SafeDownCast(inputData1);
vtkCompositeDataSet* outputCompositeDataSet = compositeDataSet0->NewInstance();
outputCompositeDataSet->ShallowCopy(inputData0);
outputCompositeDataSet->CompositeShallowCopy(compositeDataSet0);
vtkSmartPointer<vtkCompositeDataIterator> iter;
iter.TakeReference(compositeDataSet0->NewIterator());

@ -128,7 +128,7 @@ int vtkAlignImageDataSetFilter::RequestData(
vtkInformation*, vtkInformationVector** inputVector, vtkInformationVector* outputVector)
{
auto outputCD = vtkCompositeDataSet::GetData(outputVector, 0);
outputCD->RecursiveShallowCopy(vtkDataObject::GetData(inputVector[0], 0));
outputCD->ShallowCopy(vtkDataObject::GetData(inputVector[0], 0));
auto images = vtkCompositeDataSet::GetDataSets<vtkImageData>(outputCD);
auto controller = this->GetController()

@ -275,7 +275,7 @@ int vtkDistributedDataFilter::RequestData(vtkInformation* vtkNotUsed(request),
if (outputCD)
{
outputCD->ShallowCopy(input);
outputCD->CompositeShallowCopy(vtkCompositeDataSet::SafeDownCast(input));
}
else
{

@ -65,7 +65,7 @@ int vtkPConvertToMultiBlockDataSet::RequestData(
// ensure that we have exactly the same number of partitions on all ranks.
vtkNew<vtkPartitionedDataSetCollection> clone;
clone->ShallowCopy(input);
clone->CompositeShallowCopy(input);
const auto count = input->GetNumberOfPartitionedDataSets();
std::vector<unsigned int> piece_counts(count);

@ -212,7 +212,7 @@ void vtkPExtractDataArraysOverTime::ReorganizeData(vtkMultiBlockDataSet* dataset
}
this->Controller->Broadcast(stream, 0);
dataset->ShallowCopy(mb);
dataset->CompositeShallowCopy(mb);
} // end rank 0
}
VTK_ABI_NAMESPACE_END

@ -37,7 +37,7 @@ vtkCxxSetObjectMacro(vtkPartitionBalancer, Controller, vtkMultiProcessController
namespace
{
//------------------------------------------------------------------------------
void ShallowCopy(vtkPartitionedDataSet* inputPDS, vtkPartitionedDataSet* outputPDS,
void CompositeShallowCopy(vtkPartitionedDataSet* inputPDS, vtkPartitionedDataSet* outputPDS,
int numberOfNonNullPartitionsInInput, int offset = 0)
{
for (int outPartitionId = 0, inPartitionId = 0; outPartitionId < numberOfNonNullPartitionsInInput;
@ -87,7 +87,7 @@ int vtkPartitionBalancer::RequestData(
if (!this->Controller)
{
outputPDS->ShallowCopy(inputPDS);
outputPDS->CompositeShallowCopy(inputPDS);
outputPDS->RemoveNullPartitions();
return 1;
}
@ -103,14 +103,14 @@ int vtkPartitionBalancer::RequestData(
const int offset = std::accumulate(recvBuf.begin(), recvBuf.begin() + localProcessId, 0);
outputPDS->SetNumberOfPartitions(numberOfPartitions);
ShallowCopy(inputPDS, outputPDS, numberOfNonNullPartitionsInInput, offset);
::CompositeShallowCopy(inputPDS, outputPDS, numberOfNonNullPartitionsInInput, offset);
}
else if (this->Mode == vtkPartitionBalancer::Squash)
{
const int numberOfPartitions = *std::max_element(recvBuf.begin(), recvBuf.end());
outputPDS->SetNumberOfPartitions(numberOfPartitions);
ShallowCopy(inputPDS, outputPDS, numberOfNonNullPartitionsInInput);
::CompositeShallowCopy(inputPDS, outputPDS, numberOfNonNullPartitionsInInput);
}
else
{

@ -101,7 +101,7 @@ int vtkPeriodicFilter::RequestData(vtkInformation* vtkNotUsed(request),
else if (this->Indices.empty())
{
// Trivial case
output->ShallowCopy(input);
output->CompositeShallowCopy(input);
return 1;
}

@ -710,7 +710,7 @@ int vtkExtractSubsetWithSeed::RequestData(
// now, put the pieces in output_blocks in the output MB.
// we use a trick, copy into to output and then replace
outputMB->ShallowCopy(inputMB);
outputMB->CompositeShallowCopy(inputMB);
std::function<vtkDataObject*(vtkDataObject*)> replaceLeaves;
replaceLeaves = [&replaceLeaves, &input_dataset_map, &output_blocks](

@ -499,25 +499,30 @@ int vtkRedistributeDataSetFilter::RequestData(
// ******************************************************
// Now, package the result into the output.
// ******************************************************
if (vtkPartitionedDataSetCollection::SafeDownCast(outputDO))
vtkPartitionedDataSetCollection* outputPDSC =
vtkPartitionedDataSetCollection::SafeDownCast(outputDO);
vtkPartitionedDataSet* outputPDS = vtkPartitionedDataSet::SafeDownCast(outputDO);
vtkMultiBlockDataSet* outputMB = vtkMultiBlockDataSet::SafeDownCast(outputDO);
if (outputPDSC)
{
outputDO->ShallowCopy(result);
outputPDSC->CompositeShallowCopy(result);
}
else if (vtkPartitionedDataSet::SafeDownCast(outputDO))
else if (outputPDS)
{
assert(result->GetNumberOfPartitionedDataSets() <= 1);
if (result->GetNumberOfPartitionedDataSets() == 1)
{
outputDO->ShallowCopy(result->GetPartitionedDataSet(0));
outputPDS->CompositeShallowCopy(result->GetPartitionedDataSet(0));
}
}
else if (vtkMultiBlockDataSet::SafeDownCast(outputDO))
else if (outputMB)
{
// convert result (vtkPartitionedDataSetCollection) to vtkMultiBlockDataSet.
if (auto mbresult = vtkDataAssemblyUtilities::GenerateCompositeDataSetFromHierarchy(
result, result->GetDataAssembly()))
{
outputDO->ShallowCopy(mbresult);
outputMB->CompositeShallowCopy(mbresult);
}
else
{
@ -734,7 +739,7 @@ bool vtkRedistributeDataSetFilter::Redistribute(vtkPartitionedDataSet* inputPDS,
if (this->GenerateGlobalCellIds)
{
auto result = this->AssignGlobalCellIds(outputPDS, mb_offset);
outputPDS->ShallowCopy(result);
outputPDS->CompositeShallowCopy(result);
}
break;
@ -784,7 +789,7 @@ bool vtkRedistributeDataSetFilter::RedistributeDataSet(
auto pieces = vtkDIYKdTreeUtilities::Exchange(parts, this->GetController(), this->Assigner);
assert(pieces->GetNumberOfPartitions() == parts->GetNumberOfPartitions());
outputPDS->ShallowCopy(pieces);
outputPDS->CompositeShallowCopy(pieces);
return true;
}

@ -106,13 +106,13 @@ protected:
return 0;
}
output->ShallowCopy(input);
output->DeepCopy(input);
for (unsigned int level = 0; level < input->GetNumberOfLevels(); ++level)
for (unsigned int level = 0; level < output->GetNumberOfLevels(); ++level)
{
for (unsigned int idx = 0; idx < input->GetNumberOfDataSets(level); ++idx)
for (unsigned int idx = 0; idx < output->GetNumberOfDataSets(level); ++idx)
{
vtkUniformGrid* grid = input->GetDataSet(level, idx);
vtkUniformGrid* grid = output->GetDataSet(level, idx);
if (!grid)
{
continue;

@ -1111,7 +1111,7 @@ bool vtkPLagrangianParticleTracker::UpdateSurfaceCacheIfNeeded(vtkDataObject*& s
{
// Rank 0 reconstruct Composite tree
vtkCompositeDataSet* mb = vtkCompositeDataSet::SafeDownCast(surfaces);
this->TmpSurfaceInputMB->ShallowCopy(mb);
this->TmpSurfaceInputMB->CompositeShallowCopy(mb);
vtkCompositeDataIterator* iter = mb->NewIterator();
iter->SkipEmptyNodesOff();
for (iter->InitTraversal(); !iter->IsDoneWithTraversal(); iter->GoToNextItem())

@ -148,7 +148,8 @@ int vtkStreamingStatistics::RequestData(
// Shallow copy the internal output to external output
outData->ShallowCopy(this->StatisticsAlgorithm->GetOutput(OUTPUT_DATA));
outModel->ShallowCopy(this->StatisticsAlgorithm->GetOutputDataObject(OUTPUT_MODEL));
outModel->CompositeShallowCopy(vtkCompositeDataSet::SafeDownCast(
this->StatisticsAlgorithm->GetOutputDataObject(OUTPUT_MODEL)));
outTest->ShallowCopy(this->StatisticsAlgorithm->GetOutput(OUTPUT_TEST));
return 1;

@ -500,7 +500,7 @@ int vtkCGNSFileSeriesReader::RequestData(
vtkMultiBlockDataSet* output = vtkMultiBlockDataSet::GetData(outputVector, 0);
output->Initialize();
output->ShallowCopy(hierarchy.Get());
output->CompositeShallowCopy(vtkMultiBlockDataSet::SafeDownCast(hierarchy.Get()));
return 1;
}
VTK_ABI_NAMESPACE_END

@ -288,7 +288,8 @@ int vtkGenericEnSightReader::RequestData(vtkInformation* vtkNotUsed(request),
vtkNew<vtkDataSetTriangleFilter> tetrahedralizeFilter;
tetrahedralizeFilter->SetInputData(output);
tetrahedralizeFilter->Update();
output->ShallowCopy(tetrahedralizeFilter->GetOutputDataObject(0));
output->CompositeShallowCopy(
vtkMultiBlockDataSet::SafeDownCast(tetrahedralizeFilter->GetOutputDataObject(0)));
}
return 1;

@ -882,7 +882,7 @@ int vtkGLTFReader::RequestData(
// Save current animations
this->PreviousAnimationSelection->CopySelections(this->AnimationSelection);
output->ShallowCopy(this->OutputDataSet);
output->CompositeShallowCopy(this->OutputDataSet);
return 1;
}

@ -946,7 +946,7 @@ int vtkSLACReader::RequestData(vtkInformation* request,
}
}
this->Internal->MeshCache->ShallowCopy(compositeOutput);
this->Internal->MeshCache->CompositeShallowCopy(compositeOutput);
this->Internal->PointCache = points;
this->MeshReadTime.Modified();
}
@ -1760,8 +1760,10 @@ int vtkSLACReader::MeshUpToDate()
int vtkSLACReader::RestoreMeshCache(vtkMultiBlockDataSet* surfaceOutput,
vtkMultiBlockDataSet* volumeOutput, vtkMultiBlockDataSet* compositeOutput)
{
surfaceOutput->ShallowCopy(this->Internal->MeshCache->GetBlock(SURFACE_OUTPUT));
volumeOutput->ShallowCopy(this->Internal->MeshCache->GetBlock(VOLUME_OUTPUT));
surfaceOutput->CompositeShallowCopy(
vtkCompositeDataSet::SafeDownCast(this->Internal->MeshCache->GetBlock(SURFACE_OUTPUT)));
volumeOutput->CompositeShallowCopy(
vtkCompositeDataSet::SafeDownCast(this->Internal->MeshCache->GetBlock(VOLUME_OUTPUT)));
// Shove two outputs in composite output.
compositeOutput->SetNumberOfBlocks(2);

@ -675,7 +675,7 @@ int vtkPOpenFOAMReader::RequestData(
// reader->RequestInformation() and RequestData() are called
// for all reader instances without setting UPDATE_TIME_STEPS
append->Update();
output->ShallowCopy(append->GetOutput());
output->CompositeShallowCopy(append->GetOutput());
}
append->Delete();

@ -467,8 +467,8 @@ int vtkPlot3DMetaReader::RequestData(
this->Reader->UpdatePiece(outInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_PIECE_NUMBER()),
outInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_NUMBER_OF_PIECES()),
outInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_NUMBER_OF_GHOST_LEVELS()));
vtkDataObject* ioutput = this->Reader->GetOutput();
output->ShallowCopy(ioutput);
vtkMultiBlockDataSet* ioutput = this->Reader->GetOutput();
output->CompositeShallowCopy(ioutput);
output->GetInformation()->Set(vtkDataObject::DATA_NUMBER_OF_GHOST_LEVELS(),
ioutput->GetInformation()->Get(vtkDataObject::DATA_NUMBER_OF_GHOST_LEVELS()));
}

@ -662,7 +662,7 @@ int vtkPExodusIIReader::RequestData(vtkInformation* vtkNotUsed(request),
if (append->GetNumberOfInputConnections(0) != 0)
{
append->Update();
output->ShallowCopy(append->GetOutput());
output->CompositeShallowCopy(append->GetOutput());
}
// I've copied append's output to the 'output' so delete append

@ -46,7 +46,7 @@ vtkSmartPointer<vtkCompositeDataSet> EnsureComposite(vtkDataObject* dobj)
toComposite->Update();
auto outCds = vtkCompositeDataSet::SafeDownCast(toComposite->GetOutputDataObject(0));
auto cds = vtkSmartPointer<vtkCompositeDataSet>::Take(outCds->NewInstance());
cds->ShallowCopy(outCds);
cds->CompositeShallowCopy(outCds);
return cds;
}

@ -118,7 +118,7 @@ protected:
group->AddInputData(pd2);
group->Update();
output->ShallowCopy(group->GetOutput());
output->CompositeShallowCopy(group->GetOutput());
return 1;
}

Loading…
Cancel
Save