VTKFIG  0.20.20181114
Easy VTK based in situ visualization
template<class IV >
void vtkfig::DataSet::SetCellMaskByRegionsOmitted ( const IV &  regions_omitted,
const std::string  name 
)
inline

Mask cells which shall be shown.

Assumes that DataSet::SetCellRegions() was called.

Template Parameters
IVVector class counting from zero with member functions size() and operator[]. std::vector will work.
Parameters
regions_omittedList of regions which shall be omitted
nameName of the mask for later reference

Definition at line 630 of file vtkfigDataSet.h.

631  {
632  auto celllist=vtkSmartPointer<vtkIdList>::New();
633  auto cellregions=vtkDoubleArray::SafeDownCast(this->data->GetCellData()->GetAbstractArray("cellregions"));
634  assert(cellregions);
635  int ncells=this->data->GetNumberOfCells();
636  int icelllist=0;
637  for (int icell=0;icell<ncells;icell++)
638  {
639  int ireg=cellregions->GetComponent(icell,0);
640  bool use_cell=true;
641 
642  for (int io=0;io<regions_omitted.size();io++)
643  if (ireg==regions_omitted[io])
644  {
645  use_cell=false;
646  continue;
647  }
648  if (use_cell)
649  celllist->InsertId(icelllist++,icell);
650  }
651  masks[name]=celllist;
652  }
std::map< std::string, vtkSmartPointer< vtkIdList > > masks
vtkSmartPointer< vtkDataSet > data