std::tuple<vtkSmartPointer<vtkPolyData>, vtkSmartPointer<vtkCellArray>, vtkSmartPointer<vtkFloatArray>> genvtkPolyData() { auto points = vtkSmartPointer<vtkPoints>::New(); points->InsertNextPoint(0, 0, 0); points->InsertNextPoint(0, 1, 0); points->InsertNextPoint(1, 1, 0); auto poly = vtkSmartPointer<vtkPolyData>::New(); poly->SetPoints(points); auto indices = vtkSmartPointer<vtkCellArray>::New(); indices->InsertNextCell(3); indices->InsertCellPoint(0); indices->InsertCellPoint(1); indices->InsertCellPoint(2); auto vectors = vtkSmartPointer<vtkFloatArray>::New(); vectors->SetName(vectorName()); vectors->SetNumberOfComponents(3); vectors->SetNumberOfTuples(1); vectors->SetTypedComponent(0, 0, 0); vectors->SetTypedComponent(0, 1, 0); vectors->SetTypedComponent(0, 2, 1); return { poly, indices, vectors }; }
vtkSmartPointer<vtkArrayType> FlowAnalysis::vtkMakeArray(const vtkSmartPointer<vtkUniformGrid>& grid, const string& name, size_t numComponents, bool fillZero){ auto arr=vtkSmartPointer<vtkArrayType>::New(); arr->SetNumberOfComponents(numComponents); arr->SetNumberOfTuples(boxCells.prod()); arr->SetName(name.c_str()); if(cellData) grid->GetCellData()->AddArray(arr); else grid->GetPointData()->AddArray(arr); if(fillZero){ for(int _i=0; _i<(int)numComponents; _i++) arr->FillComponent(_i,0.); } return arr; }
void iA3DColoredPolyObjectVis::setupOriginalIds() { auto ids = vtkSmartPointer<vtkIdTypeArray>::New(); ids->SetName("OriginalIds"); vtkIdType numPoints = m_objectTable->GetNumberOfRows() * m_pointsPerObject; ids->SetNumberOfTuples(numPoints); for (vtkIdType id = 0; id < m_objectTable->GetNumberOfRows(); ++id) for (vtkIdType objectPoints = 0; objectPoints < m_pointsPerObject; ++objectPoints) ids->SetTuple1(id*m_pointsPerObject + objectPoints, id); getPolyData()->GetPointData()->AddArray(ids); }
void LogManager::PrepareRecovery() { if (prepared_recovery_) { return; } auto &catalog_manager = catalog::Manager::GetInstance(); // for all database auto db_count = catalog_manager.GetDatabaseCount(); for (oid_t db_idx = 0; db_idx < db_count; db_idx++) { auto database = catalog_manager.GetDatabase(db_idx); // for all tables auto table_count = database->GetTableCount(); for (oid_t table_idx = 0; table_idx < table_count; table_idx++) { auto table = database->GetTable(table_idx); // drop existing tile groups table->DropTileGroups(); table->SetNumberOfTuples(0); } } prepared_recovery_ = true; }