]> SALOME platform Git repositories - modules/visu.git/blob - src/PIPELINE/VISU_PipeLineUtils.hxx
Salome HOME
57e6347bed04467dc1168ed46b3bbee13c00c7ed
[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.salome-platform.org/ or email : webmaster.salome@opencascade.com
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 #ifndef MESSAGE
48 #define MESSAGE(msg) std::cout<<__FILE__<<"["<<__LINE__<<"]::"<<msg<<endl
49
50 #undef EXCEPT
51 #define EXCEPT(msg) QString(QString(__FILE__) + "[" + QString::number(__LINE__) + "]::" + msg)
52
53 #undef EXCEPTION
54 #define EXCEPTION(msg) EXCEPT(msg).latin1()
55
56 #endif
57
58 namespace VISU
59 {
60   void
61   Mul(const vtkFloatingPointType A[3], 
62       vtkFloatingPointType b, 
63       vtkFloatingPointType C[3]); // C = A * b
64   
65   void
66   Sub(const vtkFloatingPointType A[3], 
67       const vtkFloatingPointType B[3], 
68       vtkFloatingPointType C[3]); // C = A - B
69
70   template<class TItem> 
71   void
72   CellDataToPoint(TItem* theTItem, 
73                   vtkCellDataToPointData *theFilter,
74                   vtkDataSet* theDataSet,
75                   VISU_FieldTransform *theFieldTransform)
76   {
77     if(theDataSet->GetCellData()->GetNumberOfArrays()){
78       theFilter->SetInput(theFieldTransform->GetUnstructuredGridOutput());
79       theFilter->PassCellDataOn();
80       theTItem->SetInput(theFilter->GetUnstructuredGridOutput());
81     }else
82       theTItem->SetInput(theFieldTransform->GetUnstructuredGridOutput());
83   }
84
85   template<class TItem> 
86   void
87   ToCellCenters(TItem* theTItem, 
88                 vtkCellCenters *theFilter,
89                 vtkDataSet* theDataSet,
90                 VISU_FieldTransform *theFieldTransform)
91   {
92     if(theDataSet->GetCellData()->GetNumberOfArrays()){
93       theFilter->SetInput(theFieldTransform->GetUnstructuredGridOutput());
94       theFilter->VertexCellsOn();
95       theTItem->SetInput(theFilter->GetOutput());
96     }else
97       theTItem->SetInput(theFieldTransform->GetUnstructuredGridOutput());
98   }
99 }
100
101 #endif
102