]> SALOME platform Git repositories - modules/visu.git/blob - src/PIPELINE/VISU_PipeLineUtils.hxx
Salome HOME
sources v1.2c
[modules/visu.git] / src / PIPELINE / VISU_PipeLineUtils.hxx
1 //  VISU OBJECT : interactive object for VISU entities implementation
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
5 // 
6 //  This library is free software; you can redistribute it and/or 
7 //  modify it under the terms of the GNU Lesser General Public 
8 //  License as published by the Free Software Foundation; either 
9 //  version 2.1 of the License. 
10 // 
11 //  This library is distributed in the hope that it will be useful, 
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of 
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
14 //  Lesser General Public License for more details. 
15 // 
16 //  You should have received a copy of the GNU Lesser General Public 
17 //  License along with this library; if not, write to the Free Software 
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
19 // 
20 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 // File:    VISU_PipeLine.hxx
24 // Author:  Alexey PETROV
25 // Module : VISU
26
27 #ifndef VISU_PipeLineUtils_HeaderFile
28 #define VISU_PipeLineUtils_HeaderFile
29
30 #include "VISU_FieldTransform.hxx"
31 #include "VISU_LookupTable.hxx"
32 #include "VISU_Extractor.hxx"
33
34 #include <vtkProperty.h>
35 #include <vtkObjectFactory.h>
36 #include <vtkDataSetMapper.h>
37 #include <vtkUnstructuredGrid.h>
38
39 #include <vtkCellDataToPointData.h>
40 #include <vtkCellCenters.h>
41 #include <vtkPointData.h>
42 #include <vtkCellData.h>
43 #include <vtkPolyData.h>
44
45 #include <vtkMath.h>
46
47 namespace VISU{
48   void Mul(const float A[3], float b, float C[3]); // C = A * b
49   void Sub(const float A[3], const float B[3], float C[3]); // C = A - B
50
51   template<class TItem> void CellDataToPoint(TItem* theTItem, vtkDataSet* theDataSet,
52                                              VISU_FieldTransform *theFieldTransform)
53   {
54     if(theDataSet->GetCellData()->GetNumberOfArrays()){
55       vtkCellDataToPointData *aFilter = vtkCellDataToPointData::New();
56       aFilter->SetInput(theFieldTransform->GetUnstructuredGridOutput());
57       aFilter->PassCellDataOn();
58       theTItem->SetInput(aFilter->GetUnstructuredGridOutput());
59       aFilter->Register(theTItem);
60       aFilter->Delete();
61     }else
62       theTItem->SetInput(theFieldTransform->GetUnstructuredGridOutput());
63   }
64
65   template<class TItem> void ToCellCenters(TItem* theTItem, vtkDataSet* theDataSet,
66                                            VISU_FieldTransform *theFieldTransform)
67   {
68     if(theDataSet->GetCellData()->GetNumberOfArrays()){
69       vtkCellCenters *aCenters = vtkCellCenters::New(); // for vectors on cells
70       aCenters->SetInput(theFieldTransform->GetUnstructuredGridOutput());
71       aCenters->VertexCellsOn();
72       theTItem->SetInput(aCenters->GetOutput());
73       aCenters->Register(theTItem);
74       aCenters->Delete();
75     }else
76       theTItem->SetInput(theFieldTransform->GetUnstructuredGridOutput());
77   }
78 }
79
80 #endif
81