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()
23 // THE MAIN PROCESSING METHOD BODY
24 // Here we simply set the input 'In' value to the output 'Out'
25 // And print out the output value
26 // INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
27 // void bbSet{Input|Output}NAME(const TYPE&)
28 // const TYPE& bbGet{Input|Output}NAME() const
30 // * NAME is the name of the input/output
31 // (the one provided in the attribute 'name' of the tag 'input')
32 // * TYPE is the C++ type of the input/output
33 // (the one provided in the attribute 'type' of the tag 'input')
34 std::string namascalararray="creaNumeration";
35 if (bbGetInputStreamLinesIn()!=NULL)
37 vtkIdList *_vtkidlist = vtkIdList::New();
38 vtkCellArray *vtkcellarray = bbGetInputStreamLinesIn()->GetLines();
39 long int nLinesCell = vtkcellarray->GetNumberOfCells();
42 vtkDoubleArray *numeration = vtkDoubleArray::New();
43 numeration->SetName( namascalararray.c_str() );
44 numeration->SetNumberOfComponents(1);
45 numeration->SetNumberOfTuples(nLinesCell);
48 for ( iLine=0 ; iLine<nLinesCell ; iLine++ )
50 vtkcellarray->GetCell(ii, _vtkidlist );
51 numberofids = _vtkidlist->GetNumberOfIds();
52 numeration->SetTuple1(iLine, numberofids);
56 bbGetInputStreamLinesIn()->GetPointData()->AddArray( numeration );
57 bbGetInputStreamLinesIn()->GetPointData()->Modified( );
58 bbGetInputStreamLinesIn()->GetPointData()->Update( );
59 } // if bbGetInputStreamLinesIn()
60 bbSetOutputStreamLinesOut( bbGetInputStreamLinesIn() );
61 bbSetOutputNameOfScalarArray( namascalararray );
65 // 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)
67 void StreamLineNumeration::bbUserSetDefaultValues()
69 // SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
70 // Here we initialize the input 'In' to 0
71 bbSetInputStreamLinesIn( NULL );
75 // 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)
77 void StreamLineNumeration::bbUserInitializeProcessing()
79 // THE INITIALIZATION METHOD BODY :
81 // but this is where you should allocate the internal/output pointers
86 // 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)
88 void StreamLineNumeration::bbUserFinalizeProcessing()
90 // THE FINALIZATION METHOD BODY :
92 // but this is where you should desallocate the internal/output pointers
96 } // EO namespace bbcreaVtk