----------------------------------------------------------------------------
| 111 | |
| 112 | //---------------------------------------------------------------------------- |
| 113 | int vtkPartitionedDataSetCollectionSource::RequestData( |
| 114 | vtkInformation*, vtkInformationVector**, vtkInformationVector* outputVector) |
| 115 | { |
| 116 | auto outInfo = outputVector->GetInformationObject(0); |
| 117 | auto output = vtkPartitionedDataSetCollection::GetData(outInfo); |
| 118 | const int piece = outInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_PIECE_NUMBER()); |
| 119 | const int numPieces = outInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_NUMBER_OF_PIECES()); |
| 120 | |
| 121 | vtkNew<vtkParametricFunctionSource> source; |
| 122 | source->SetOutputPointsPrecision(vtkAlgorithm::DOUBLE_PRECISION); |
| 123 | |
| 124 | std::vector<vtkSmartPointer<vtkParametricFunction>> functions; |
| 125 | functions.emplace_back(vtkSmartPointer<vtkParametricBoy>::New()); |
| 126 | functions.emplace_back(vtkSmartPointer<vtkParametricCrossCap>::New()); |
| 127 | functions.emplace_back(vtkSmartPointer<vtkParametricFigure8Klein>::New()); |
| 128 | functions.emplace_back(vtkSmartPointer<vtkParametricKlein>::New()); |
| 129 | functions.emplace_back(vtkSmartPointer<vtkParametricMobius>::New()); |
| 130 | functions.emplace_back(vtkSmartPointer<vtkParametricRoman>::New()); |
| 131 | |
| 132 | const auto firstOrientableSurface = static_cast<int>(functions.size()); |
| 133 | |
| 134 | functions.emplace_back(vtkSmartPointer<vtkParametricConicSpiral>::New()); |
| 135 | functions.emplace_back(vtkSmartPointer<vtkParametricDini>::New()); |
| 136 | functions.emplace_back(vtkSmartPointer<vtkParametricEllipsoid>::New()); |
| 137 | functions.emplace_back(vtkSmartPointer<vtkParametricEnneper>::New()); |
| 138 | functions.emplace_back(vtkSmartPointer<vtkParametricSuperToroid>::New()); |
| 139 | functions.emplace_back(vtkSmartPointer<vtkParametricTorus>::New()); |
| 140 | |
| 141 | vtkNew<vtkDataAssembly> assembly; |
| 142 | assembly->SetRootNodeName("Assembly"); |
| 143 | output->SetDataAssembly(assembly); |
| 144 | |
| 145 | auto nonOrientableSurfaces = assembly->AddNode("NonOrientableSurfaces"); |
| 146 | auto orientableSurfaces = assembly->AddNode("OrientableSurfaces"); |
| 147 | |
| 148 | for (int idx = 0; idx < this->NumberOfShapes; ++idx) |
| 149 | { |
| 150 | auto& function = functions.at(idx); |
| 151 | function->JoinVOff(); |
| 152 | function->JoinUOff(); |
| 153 | source->SetParametricFunction(function); |
| 154 | source->SetScalarModeToV(); |
| 155 | |
| 156 | const double maxV = function->GetMaximumV(); |
| 157 | |
| 158 | int totalParts; |
| 159 | std::vector<int> counts = ::GenerateAssignments(numPieces, totalParts); |
| 160 | const double deltaV = maxV / totalParts; |
| 161 | const auto range = ::GetRange(piece, counts); |
| 162 | for (int partition = range.first; partition < range.second; ++partition) |
| 163 | { |
| 164 | function->SetMinimumV(partition * deltaV); |
| 165 | function->SetMaximumV((partition + 1) * deltaV); |
| 166 | vtkLogF(TRACE, "min=%f max=%f", function->GetMinimumV(), function->GetMaximumV()); |
| 167 | source->Update(); |
| 168 | |
| 169 | vtkNew<vtkPolyData> clone; |
| 170 | clone->ShallowCopy(source->GetOutputDataObject(0)); |
nothing calls this directly
no test coverage detected