68 vtkInformationVector **inputVector,
69 vtkInformationVector *outputVector) {
73 vtkDataSet *input = vtkDataSet::GetData(inputVector[0]);
74 vtkDataSet *output = vtkDataSet::GetData(outputVector);
77 masterAppender_->Delete();
78 masterAppender_ =
nullptr;
82 appenderList_[i]->Delete();
85 masterAppender_ = vtkAppendPolyData::New();
88 appenderList_[i] = vtkAppendPolyData::New();
91 if((
SimplexId)sphereList_.size() > input->GetNumberOfPoints()) {
92 for(
SimplexId i = input->GetNumberOfPoints();
94 sphereList_[i]->Delete();
97 sphereList_.resize(input->GetNumberOfPoints());
98 }
else if((
SimplexId)sphereList_.size() < input->GetNumberOfPoints()) {
99 SimplexId const oldSize = sphereList_.size();
101 sphereList_.resize(input->GetNumberOfPoints());
104 sphereList_[i] = vtkSphereSource::New();
108 if(dataArrayList_.size()) {
111 dataArrayList_[i][j]->Delete();
113 dataArrayList_[i].clear();
124 if(!input->GetNumberOfPoints())
127 input->GetPoint(0, p[0].data());
129#ifdef TTK_ENABLE_OPENMP
130#pragma omp parallel for num_threads(threadNumber_)
132 for(
SimplexId i = 0; i < input->GetNumberOfPoints(); i++) {
136#ifdef TTK_ENABLE_OPENMP
137 threadId = omp_get_thread_num();
140 input->GetPoint(i, p[threadId].data());
142 sphereList_[i]->SetCenter(p[threadId][0], p[threadId][1], p[threadId][2]);
144 sphereList_[i]->SetRadius(Radius);
146 sphereList_[i]->SetThetaResolution(ThetaResolution);
147 sphereList_[i]->SetStartTheta(StartTheta);
148 sphereList_[i]->SetEndTheta(EndTheta);
150 sphereList_[i]->SetPhiResolution(PhiResolution);
151 sphereList_[i]->SetStartPhi(StartPhi);
152 sphereList_[i]->SetEndPhi(EndPhi);
154 sphereList_[i]->Update();
156 vtkPolyData *sphereSurface = sphereList_[i]->GetOutput();
159 for(
SimplexId j = 0; j < input->GetPointData()->GetNumberOfArrays(); j++) {
161 vtkDataArray *array = input->GetPointData()->GetArray(j);
163 if(array !=
nullptr && array->GetNumberOfComponents() == 1) {
166 array->GetTuple(i, &value);
168 vtkDataArray *dataArray = array->NewInstance();
169 if(dataArray !=
nullptr) {
170 dataArray->SetName(array->GetName());
171 dataArray->SetNumberOfTuples(sphereSurface->GetNumberOfPoints());
172 for(
SimplexId k = 0; k < sphereSurface->GetNumberOfPoints(); k++) {
173 dataArray->SetTuple(k, &value);
176 sphereSurface->GetPointData()->AddArray(dataArray);
177 dataArrayList_[threadId].emplace_back(dataArray);
180 "Unsupported number of components :(", debug::Priority::DETAIL);
184 appenderList_[threadId]->AddInputConnection(
185 sphereList_[i]->GetOutputPort());
189 if(appenderList_[i]->GetInput())
190 masterAppender_->AddInputConnection(appenderList_[i]->GetOutputPort());
192 masterAppender_->Update();
194 output->ShallowCopy(masterAppender_->GetOutput());
196 printMsg(std::to_string(input->GetNumberOfPoints()) +
" spheres generated", 1,