VTKFIG  0.20.20181114
Easy VTK based in situ visualization
template<class DATA , class FILTER >
void vtkfig::ScalarView::RTBuildVTKPipeline3D ( )
private

3D Filter

Definition at line 187 of file vtkfigScalarView-2018-01-21-2258.cxx.

188  {
189  RTCalcTransform();
190 
191 
192 
193  vtkSmartPointer<vtkExtractCells> subgrid;
194  if (celllist)
195  {
196  subgrid=vtkSmartPointer<vtkExtractCells>::New();
197  subgrid->SetInputConnection(data_producer->GetOutputPort());
198  subgrid->SetCellList(celllist);
199  }
200 
201 
202 
203  auto scalar = vtkSmartPointer<vtkAssignAttribute>::New();
204  scalar->Assign(dataname.c_str(),vtkDataSetAttributes::SCALARS,vtkAssignAttribute::POINT_DATA);
205  if (celllist)
206  scalar->SetInputConnection(subgrid->GetOutputPort());
207  else
208  scalar->SetInputConnection(data_producer->GetOutputPort());
209 
210 
211 
212 
213  auto transgeometry=vtkSmartPointer<vtkTransformFilter>::New();
214  transgeometry->SetInputConnection(scalar->GetOutputPort());
215  transgeometry->SetTransform(transform);
216 
217  vtkSmartPointer<vtkTransformFilter> transallgeometry;
218  if (celllist)
219  {
220  auto allgeometry=vtkSmartPointer<FILTER>::New();
221  allgeometry->SetInputConnection(data_producer->GetOutputPort());
222 
223  transallgeometry=vtkSmartPointer<vtkTransformFilter>::New();
224  transallgeometry->SetTransform(transform);
225  transallgeometry->SetInputConnection(allgeometry->GetOutputPort());
226  }
227  else
228  transallgeometry=transgeometry;
229 
230 
231 
232 
233  planeX->SetOrigin(trans_center);
234  planeY->SetOrigin(trans_center);
235  planeZ->SetOrigin(trans_center);
236 
237  planecutX->SetInputConnection(transgeometry->GetOutputPort());
238  planecutX->SetCutFunction(planeX);
239  planecutX->SetNumberOfContours(0);
240 
241 
242  planecutY->SetInputConnection(transgeometry->GetOutputPort());
243  planecutY->SetCutFunction(planeY);
244  planecutY->SetNumberOfContours(0);
245 
246  planecutZ->SetInputConnection(transgeometry->GetOutputPort());
247  planecutZ->SetCutFunction(planeZ);
248  planecutZ->SetNumberOfContours(1);
249  planecutZ->SetValue(0,0.0);
250 
251 
252  vtkSmartPointer<vtkClipPolyData> clipgeometry=0;
253  if (false) // plot complete outline surface
254  {
255 
256  clipgeometry=vtkSmartPointer<vtkClipPolyData>::New();
257  auto sfilter=vtkSmartPointer<FILTER>::New();
258  sfilter->SetInputConnection(transgeometry->GetOutputPort());
259  clipgeometry->SetInputConnection(sfilter->GetOutputPort());
260  clipgeometry->SetClipFunction(planeZ);
261  clipgeometry->SetInsideOut(1);
262 
263  vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
264 
265 
266  mapper->SetInputConnection(clipgeometry->GetOutputPort());
267  mapper->UseLookupTableScalarRangeOn();
268  mapper->SetLookupTable(surface_lut);
269  auto splot=vtkSmartPointer<vtkActor>::New();
270  splot->GetProperty()->SetOpacity(1.0);
271  splot->SetMapper(mapper);
273 
274  }
275 
276 
277 
278  auto xyz = vtkSmartPointer<vtkAppendPolyData>::New();
279  xyz->SetUserManagedInputs(1);
280  if (clipgeometry)
281  xyz->SetNumberOfInputs(4);
282  else
283  xyz->SetNumberOfInputs(3);
284 
285  xyz->SetInputConnectionByNumber(0,planecutX->GetOutputPort());
286  xyz->SetInputConnectionByNumber(1,planecutY->GetOutputPort());
287  xyz->SetInputConnectionByNumber(2,planecutZ->GetOutputPort());
288  if (clipgeometry)
289  xyz->SetInputConnectionByNumber(3,clipgeometry->GetOutputPort());
290 
291 
292  vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
293  mapper->SetInputConnection(xyz->GetOutputPort());
294  mapper->UseLookupTableScalarRangeOn();
295  mapper->SetLookupTable(surface_lut);
296 
297  vtkSmartPointer<vtkActor> plot = vtkSmartPointer<vtkActor>::New();
298  plot->GetProperty()->SetOpacity(1);
299  plot->SetMapper(mapper);
300  Figure::RTAddActor(plot);
301 
303 
304 
305 
306  if (true)
307  {
308 
309  isoline_filter->SetInputConnection(xyz->GetOutputPort());
310 
311  vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
312  mapper->SetInputConnection(isoline_filter->GetOutputPort());
313  // mapper->UseLookupTableScalarRangeOn();
314  // mapper->SetLookupTable(contour_lut);
315  mapper->ScalarVisibilityOff();
316 
317  isoline_plot->GetProperty()->SetOpacity(1.0);
318  isoline_plot->GetProperty()->SetColor(0,0,0);
319  isoline_plot->GetProperty()->SetLineWidth(state.isoline_width);
320  isoline_plot->SetMapper(mapper);
321  isoline_plot->SetVisibility(state.show_isolines);
323  }
324 
325 
326  if (true)
327  {
328 
329  isosurface_filter->SetInputConnection(transgeometry->GetOutputPort());
330 
331  vtkSmartPointer<vtkPolyDataMapper> mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
332  mapper->SetInputConnection(isosurface_filter->GetOutputPort());
333  mapper->UseLookupTableScalarRangeOn();
334  mapper->SetLookupTable(surface_lut);
335 
336  isosurface_plot->GetProperty()->SetOpacity(0.3);
337 
338  isosurface_plot->SetMapper(mapper);
339  isosurface_plot->SetVisibility(state.show_isosurfaces);
341 
342  }
343 
344 
345  }
std::string dataname
Name of data item in data set.
Definition: vtkfigFigure.h:256
vtkSmartPointer< vtkCutter > planecutY
Definition: vtkfigFigure.h:204
void RTAddActor2D(vtkSmartPointer< vtkActor2D > prop)
Add vtk Actor to renderer showing figure.
vtkSmartPointer< vtkIdList > celllist
Cell mask.
Definition: vtkfigFigure.h:259
vtkSmartPointer< vtkCutter > planecutX
Cutters for plane sections.
Definition: vtkfigFigure.h:203
vtkSmartPointer< vtkActor > splot
Definition: vtkfigFigure.h:238
vtkSmartPointer< vtkContourFilter > isoline_filter
Definition: vtkfigFigure.h:224
vtkSmartPointer< vtkTrivialProducer > data_producer
Data producer for grid dataset.
Definition: vtkfigFigure.h:247
vtkSmartPointer< vtkTransform > transform
Definition: vtkfigFigure.h:200
void RTCalcTransform()
Calculate transformation to unit cube This shall be applied to all data.
vtkSmartPointer< vtkActor > isoline_plot
Items for isoline plot.
Definition: vtkfigFigure.h:223
vtkSmartPointer< vtkLookupTable > surface_lut
Color lookup table for surface plots.
Definition: vtkfigFigure.h:265
struct vtkfig::Figure::@0 state
figure state
vtkSmartPointer< vtkActor > isosurface_plot
Items for isosurface plot.
Definition: vtkfigFigure.h:219
vtkSmartPointer< vtkPlane > planeY
Definition: vtkfigFigure.h:209
void RTAddActor(vtkSmartPointer< vtkActor > prop)
Add vtk Actor to renderer showing figure.
vtkSmartPointer< vtkPlane > planeX
Plane equations for plane sections.
Definition: vtkfigFigure.h:208
vtkSmartPointer< vtkCutter > planecutZ
Definition: vtkfigFigure.h:205
vtkSmartPointer< vtkScalarBarActor > BuildColorBar(vtkSmartPointer< vtkPolyDataMapper > mapper, int irank=0)
Definition: vtkfigTools.cxx:88
vtkSmartPointer< vtkPlane > planeZ
Definition: vtkfigFigure.h:210
double trans_center[3]
Definition: vtkfigFigure.h:533
vtkSmartPointer< vtkContourFilter > isosurface_filter
Definition: vtkfigFigure.h:220

+ Here is the call graph for this function: