void GuiTableComposition::UpdateCellBounds() { rowOffsets.Resize(rows); rowSizes.Resize(rows); columnOffsets.Resize(columns); columnSizes.Resize(columns); vint rowTotal = (rows - 1) * cellPadding; vint columnTotal = (columns - 1) * cellPadding; vint rowTotalWithPercentage = rowTotal; vint columnTotalWithPercentage = columnTotal; UpdateCellBoundsInternal( rowSizes, rowTotal, rowTotalWithPercentage, rowOptions, &GuiTableComposition::rows, &GuiTableComposition::columns, &Y, &RL, &RS, &First, &Second, 1 ); UpdateCellBoundsInternal( columnSizes, columnTotal, columnTotalWithPercentage, columnOptions, &GuiTableComposition::columns, &GuiTableComposition::rows, &X, &CL, &CS, &Second, &First, 1 ); Rect area = GetCellArea(); UpdateCellBoundsPercentages(rowSizes, rowTotal, area.Height(), rowOptions); UpdateCellBoundsPercentages(columnSizes, columnTotal, area.Width(), columnOptions); rowExtending = UpdateCellBoundsOffsets(rowOffsets, rowSizes, area.Height()); columnExtending = UpdateCellBoundsOffsets(columnOffsets, columnSizes, area.Width()); for (vint i = 0; i < rows; i++) { for (vint j = 0; j < columns; j++) { vint index = GetSiteIndex(rows, columns, i, j); cellBounds[index] = Rect(Point(columnOffsets[j], rowOffsets[i]), Size(columnSizes[j], rowSizes[i])); } } tableContentMinSize = Size(columnTotalWithPercentage, rowTotalWithPercentage); InvokeOnCompositionStateChanged(); }
vtkDataArray * avtRevolvedSurfaceArea::DeriveVariable(vtkDataSet *in_ds, int currentDomainsIndex) { // // Create a copy of the input with each zone's id number. This will be // used to match up the line segments with the zones they came from later. // vtkDataSet *tmp_ds = in_ds->NewInstance(); tmp_ds->ShallowCopy(in_ds); vtkIdType n_orig_cells = tmp_ds->GetNumberOfCells(); vtkIntArray *iarray = vtkIntArray::New(); iarray->SetName("_rsa_ncells"); iarray->SetNumberOfTuples(n_orig_cells); for (vtkIdType i = 0 ; i < n_orig_cells ; i++) iarray->SetValue(i, i); tmp_ds->GetCellData()->AddArray(iarray); iarray->Delete(); // // Create the boundary edges. // vtkGeometryFilter *geomFilter = vtkGeometryFilter::New(); vtkVisItFeatureEdges *boundaryFilter = vtkVisItFeatureEdges::New(); vtkPolyData *allLines = NULL; avtDataAttributes &atts = GetInput()->GetInfo().GetAttributes(); if (atts.GetTopologicalDimension() == 2) { geomFilter->SetInputData(tmp_ds); boundaryFilter->BoundaryEdgesOn(); boundaryFilter->FeatureEdgesOff(); boundaryFilter->NonManifoldEdgesOff(); boundaryFilter->ManifoldEdgesOff(); boundaryFilter->ColoringOff(); boundaryFilter->SetInputConnection(geomFilter->GetOutputPort()); vtkStreamingDemandDrivenPipeline::SetUpdateGhostLevel(boundaryFilter->GetInformation(), 2); boundaryFilter->Update(); allLines = boundaryFilter->GetOutput(); } else if (tmp_ds->GetDataObjectType() == VTK_POLY_DATA) { allLines = (vtkPolyData *) tmp_ds; } else { geomFilter->SetInputData(tmp_ds); allLines = geomFilter->GetOutput(); } // // Remove ghost zones. // vtkDataSetRemoveGhostCells *gzFilter = vtkDataSetRemoveGhostCells::New(); gzFilter->SetInputData(allLines); gzFilter->Update(); vtkDataSet *ds_1d_nogz = gzFilter->GetOutput(); // We need line segment polydata, and should have it by now. if (ds_1d_nogz->GetDataObjectType() != VTK_POLY_DATA) { tmp_ds->Delete(); geomFilter->Delete(); gzFilter->Delete(); boundaryFilter->Delete(); debug1 << "ERROR:Did not get polydata from ghost zone filter output\n"; return NULL; } vtkPolyData *pd_1d_nogz = (vtkPolyData*)ds_1d_nogz; // // Only some of the zones are actually external to the domain and // contribute to the resolved surface area. These zones are exactly // the zones in pd_1d_nogz. But we need to create an output that is // sized for the input mesh. So construct an array with all 0's (the // zones that aren't on the exterior contribute 0 surface area) and then // add in the contributions from the zones on the exterior. // vtkDataArray *arr = CreateArrayFromMesh(in_ds); arr->SetNumberOfTuples(n_orig_cells); for (vtkIdType i = 0 ; i < n_orig_cells ; i++) arr->SetTuple1(i, 0.); vtkIdType ncells = pd_1d_nogz->GetNumberOfCells(); vtkIntArray *orig_cells = (vtkIntArray *) pd_1d_nogz->GetCellData()->GetArray("_rsa_ncells"); for (vtkIdType i = 0 ; i < ncells ; i++) { vtkCell *cell = pd_1d_nogz->GetCell(i); double area = GetCellArea(cell); int orig_cell = orig_cells->GetValue(i); double orig_area = arr->GetTuple1(orig_cell); double new_area = area + orig_area; arr->SetTuple1(orig_cell, new_area); } // // Clean up. // tmp_ds->Delete(); geomFilter->Delete(); gzFilter->Delete(); boundaryFilter->Delete(); return arr; }