2 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
4 #include "bbcreaVtkStreamLineNumeration.h"
5 #include "bbcreaVtkPackage.h"
7 #include <vtkCellArray.h>
8 #include <vtkPointData.h>
9 #include <vtkDoubleArray.h>
10 #include <vtkPolyData.h>
11 #include "vtkIdList.h"
16 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,StreamLineNumeration)
17 BBTK_BLACK_BOX_IMPLEMENTATION(StreamLineNumeration,bbtk::AtomicBlackBox);
19 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
21 void StreamLineNumeration::Process()
24 // THE MAIN PROCESSING METHOD BODY
25 // Here we simply set the input 'In' value to the output 'Out'
26 // And print out the output value
27 // INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
28 // void bbSet{Input|Output}NAME(const TYPE&)
29 // const TYPE& bbGet{Input|Output}NAME() const
31 // * NAME is the name of the input/output
32 // (the one provided in the attribute 'name' of the tag 'input')
33 // * TYPE is the C++ type of the input/output
34 // (the one provided in the attribute 'type' of the tag 'input')
36 std::string namascalararray="creaNumeration";
38 if (bbGetInputStreamLinesIn()!=NULL)
40 vtkIdList *_vtkidlist = vtkIdList::New();
41 vtkCellArray *vtkcellarray = bbGetInputStreamLinesIn()->GetLines();
42 long int nLinesCell = vtkcellarray->GetNumberOfCells();
47 vtkDoubleArray *numeration = vtkDoubleArray::New();
48 numeration->SetName( namascalararray.c_str() );
49 numeration->SetNumberOfComponents(1);
50 numeration->SetNumberOfTuples(nLinesCell);
54 for ( iLine=0 ; iLine<nLinesCell ; iLine++ )
56 vtkcellarray->GetCell(ii, _vtkidlist );
57 numberofids = _vtkidlist->GetNumberOfIds();
58 numeration->SetTuple1(iLine, numberofids);
62 bbGetInputStreamLinesIn()->GetPointData()->AddArray( numeration );
63 } // if bbGetInputStreamLinesIn()
65 bbSetOutputStreamLinesOut( bbGetInputStreamLinesIn() );
66 bbSetOutputNameOfScalarArray( namascalararray );
71 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
73 void StreamLineNumeration::bbUserSetDefaultValues()
75 // SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
76 // Here we initialize the input 'In' to 0
77 bbSetInputStreamLinesIn( NULL );
81 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
83 void StreamLineNumeration::bbUserInitializeProcessing()
86 // THE INITIALIZATION METHOD BODY :
88 // but this is where you should allocate the internal/output pointers
94 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
96 void StreamLineNumeration::bbUserFinalizeProcessing()
99 // THE FINALIZATION METHOD BODY :
101 // but this is where you should desallocate the internal/output pointers
106 // EO namespace bbcreaVtk