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"
18 BBTK_ADD_BLACK_BOX_TO_PACKAGE(creaVtk,StreamLineNumeration)
19 BBTK_BLACK_BOX_IMPLEMENTATION(StreamLineNumeration,bbtk::AtomicBlackBox);
21 // 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)
23 void StreamLineNumeration::Process()
26 // THE MAIN PROCESSING METHOD BODY
27 // Here we simply set the input 'In' value to the output 'Out'
28 // And print out the output value
29 // INPUT/OUTPUT ACCESSORS ARE OF THE FORM :
30 // void bbSet{Input|Output}NAME(const TYPE&)
31 // const TYPE& bbGet{Input|Output}NAME() const
33 // * NAME is the name of the input/output
34 // (the one provided in the attribute 'name' of the tag 'input')
35 // * TYPE is the C++ type of the input/output
36 // (the one provided in the attribute 'type' of the tag 'input')
38 // bbSetOutputOut( bbGetInputIn() );
39 // std::cout << "Output value = " <<bbGetOutputOut() << std::endl;
42 std::string namascalararray="creaNumeration";
44 if (bbGetInputStreamLinesIn()!=NULL)
46 vtkIdList *_vtkidlist = vtkIdList::New();
47 vtkCellArray *vtkcellarray = bbGetInputStreamLinesIn()->GetLines();
48 long int nLinesCell = vtkcellarray->GetNumberOfCells();
53 vtkDoubleArray *numeration = vtkDoubleArray::New();
54 numeration->SetName( namascalararray.c_str() );
55 numeration->SetNumberOfComponents(1);
56 numeration->SetNumberOfTuples(nLinesCell);
60 for ( iLine=0 ; iLine<nLinesCell ; iLine++ )
62 vtkcellarray->GetCell(ii, _vtkidlist );
63 numberofids = _vtkidlist->GetNumberOfIds();
64 numeration->SetTuple1(iLine, numberofids);
68 bbGetInputStreamLinesIn()->GetPointData()->AddArray( numeration );
69 } // if bbGetInputStreamLinesIn()
71 bbSetOutputStreamLinesOut( bbGetInputStreamLinesIn() );
72 bbSetOutputNameOfScalarArray( namascalararray );
76 // 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)
78 void StreamLineNumeration::bbUserSetDefaultValues()
80 // SET HERE THE DEFAULT INPUT/OUTPUT VALUES OF YOUR BOX
81 // Here we initialize the input 'In' to 0
82 bbSetInputStreamLinesIn( NULL );
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::bbUserInitializeProcessing()
91 // THE INITIALIZATION METHOD BODY :
93 // but this is where you should allocate the internal/output pointers
99 // 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)
101 void StreamLineNumeration::bbUserFinalizeProcessing()
104 // THE FINALIZATION METHOD BODY :
106 // but this is where you should desallocate the internal/output pointers
111 // EO namespace bbcreaVtk