36 vtkInformationVector **
ttkNotUsed(inputVector),
37 vtkInformationVector *outputVector) {
39 if(FileName ==
nullptr) {
43 FILE *fp = fopen(FileName,
"rb");
55 for(
int i = 0; i < 3; ++i) {
64 vtkInformation *outInfo = outputVector->GetInformationObject(0);
65 outInfo->Set(vtkDataObject::SPACING(), DataSpacing.data(), 3);
66 outInfo->Set(vtkDataObject::ORIGIN(), DataOrigin.data(), 3);
68 vtkStreamingDemandDrivenPipeline::WHOLE_EXTENT(), DataExtent.data(), 6);
70 int numberOfVertices = 1;
71 for(
int i = 0; i < 3; ++i)
72 numberOfVertices *= (1 + DataExtent[2 * i + 1] - DataExtent[2 * i]);
73 outInfo->Set(vtkDataObject::FIELD_NUMBER_OF_TUPLES(), numberOfVertices);
75 vtkDataObject::SetPointDataActiveScalarInfo(outInfo, DataScalarType, 1);
86 vtkInformationVector **
ttkNotUsed(inputVector),
87 vtkInformationVector *outputVector) {
90 if(FileName ==
nullptr) {
93 FILE *fp = fopen(FileName,
"rb");
105 for(
int i = 0; i < 3; ++i) {
111 int const nx = 1 + DataExtent[1] - DataExtent[0];
112 int const ny = 1 + DataExtent[3] - DataExtent[2];
113 int const nz = 1 + DataExtent[5] - DataExtent[4];
114 int const vertexNumber = nx * ny * nz;
117 vtkNew<vtkImageData> mesh{};
125 status = this->ReadFromFile(
126 fp, *
static_cast<TTK_TT *
>(triangulation->getData())));
128 vtkWarningMacro(
"Failure when reading compressed TTK file");
131 mesh->GetPointData()->RemoveArray(0);
132 mesh->GetPointData()->SetNumberOfTuples(vertexNumber);
134 vtkNew<vtkDoubleArray> decompressed{};
135 decompressed->SetNumberOfTuples(vertexNumber);
138 decompressed->SetName(name.data());
140 decompressed->SetName(
"Decompressed");
142 for(
int i = 0; i < vertexNumber; ++i) {
147 mesh->GetPointData()->AddArray(decompressed);
150 vtkNew<vtkIntArray> vertexOffset{};
151 vertexOffset->SetNumberOfTuples(vertexNumber);
154 for(
size_t i = 0; i < voidOffsets.size(); ++i)
155 vertexOffset->SetTuple1(i, voidOffsets[i]);
158 mesh->GetPointData()->AddArray(vertexOffset);
161 this->
printMsg(
"Read " + std::to_string(mesh->GetNumberOfPoints())
162 +
" vertice(s), " + std::to_string(mesh->GetNumberOfCells())
166 vtkInformation *outInfo = outputVector->GetInformationObject(0);
167 outInfo->Set(vtkStreamingDemandDrivenPipeline::UPDATE_NUMBER_OF_PIECES(), 1);
170 auto output = vtkImageData::GetData(outputVector);
171 output->ShallowCopy(mesh);
182 int const nx = 1 + DataExtent[1] - DataExtent[0];
183 int const ny = 1 + DataExtent[3] - DataExtent[2];
184 int const nz = 1 + DataExtent[5] - DataExtent[4];
185 mesh->SetDimensions(nx, ny, nz);
186 mesh->SetSpacing(DataSpacing[0], DataSpacing[1], DataSpacing[2]);
187 mesh->SetOrigin(DataOrigin[0], DataOrigin[1], DataOrigin[2]);
188 mesh->AllocateScalars(DataScalarType, 2);
189 mesh->GetPointData()->SetNumberOfTuples(nx * ny * nz);
printMsg(debug::output::BOLD+" | | | | | . \\ | | (__| | / __/| |_| / __/|__ _|"+debug::output::ENDCOLOR, debug::Priority::PERFORMANCE, debug::LineMode::NEW, stream)