Salome HOME
Update copyright information
[modules/visu.git] / src / PIPELINE / VISU_FieldTransform.cxx
index d448165c70fb12c2767c5b497bccfa44b97953eb..ba2bc909cc5dc633cefac45ba1031d84c519a765 100644 (file)
@@ -1,24 +1,25 @@
-//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
 //
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 //
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
 //
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
 //
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+
 //  File   : VISU_FieldTransform.cxx
 //  Module : VISU
 //
@@ -161,9 +162,9 @@ VISU_FieldTransform
 template<typename TValueType> 
 void
 LinearTransformVectors(TValueType* theInputPtr,
-                      TValueType* theOutputPtr,
-                      vtkIdType theNbOfTuples,
-                      vtkFloatingPointType theScale[3])
+                       TValueType* theOutputPtr,
+                       vtkIdType theNbOfTuples,
+                       vtkFloatingPointType theScale[3])
 {
   for(vtkIdType aTupleId = 0; aTupleId < theNbOfTuples; aTupleId++){
     for(vtkIdType aComponentId = 0; aComponentId < 3; aComponentId++){
@@ -179,14 +180,14 @@ LinearTransformVectors(TValueType* theInputPtr,
 template<typename TValueType> 
 void
 NonLinearTransformVectors(vtkDataArray *theInputVectors,
-                         TValueType* theInputPtr,
-                         TValueType* theOutputPtr,
-                         vtkIdType theNbOfTuples,
-                         vtkFloatingPointType theScale[3],
-                         VISU_FieldTransform::TTransformFun theFunction,
-                         vtkFloatingPointType theModifiedScalarMin,
-                         vtkFloatingPointType theModifiedScalarDelta,
-                         vtkFloatingPointType theSourceScalarMax)
+                          TValueType* theInputPtr,
+                          TValueType* theOutputPtr,
+                          vtkIdType theNbOfTuples,
+                          vtkFloatingPointType theScale[3],
+                          VISU_FieldTransform::TTransformFun theFunction,
+                          vtkFloatingPointType theModifiedScalarMin,
+                          vtkFloatingPointType theModifiedScalarDelta,
+                          vtkFloatingPointType theSourceScalarMax)
 {
   for(vtkIdType aTupleId = 0; aTupleId < theNbOfTuples; aTupleId++){
     vtkFloatingPointType anInputVector[3];
@@ -194,9 +195,9 @@ NonLinearTransformVectors(vtkDataArray *theInputVectors,
     vtkFloatingPointType aMagnification = vtkMath::Norm(anInputVector);
     if(aMagnification > Tolerance)
       aMagnification = 
-       ((*theFunction)(aMagnification) - theModifiedScalarMin) / 
-       theModifiedScalarDelta * theSourceScalarMax / 
-       aMagnification;
+        ((*theFunction)(aMagnification) - theModifiedScalarMin) / 
+        theModifiedScalarDelta * theSourceScalarMax / 
+        aMagnification;
     if(aMagnification < 0.0) 
       aMagnification = 0.0;
     for(vtkIdType aComponentId = 0; aComponentId < 3; aComponentId++){
@@ -212,11 +213,11 @@ NonLinearTransformVectors(vtkDataArray *theInputVectors,
 template<typename TDataSetAttributesType> 
 void
 ExecuteVectors(VISU_FieldTransform::TTransformFun theFunction,
-              VTKViewer_Transform* theTransform,
-              vtkFloatingPointType theScalarRange[2], 
-              vtkIdType theNbOfTuples,
-              TDataSetAttributesType* theInputData, 
-              TDataSetAttributesType* theOutputData)
+               VTKViewer_Transform* theTransform,
+               vtkFloatingPointType theScalarRange[2], 
+               vtkIdType theNbOfTuples,
+               TDataSetAttributesType* theInputData, 
+               TDataSetAttributesType* theOutputData)
 {
   vtkDataArray *anInputVectors = theInputData->GetVectors();
   if(!anInputVectors || theNbOfTuples < 1) 
@@ -246,25 +247,25 @@ ExecuteVectors(VISU_FieldTransform::TTransformFun theFunction,
   if(theFunction == &(VISU_FieldTransform::Ident)){
     switch(anInputDataType){
       vtkTemplateMacro4(LinearTransformVectors,
-                       (VTK_TT *)(anInputPtr), 
-                       (VTK_TT *)(anOutputPtr), 
-                       theNbOfTuples,
-                       aScale);
+                        (VTK_TT *)(anInputPtr), 
+                        (VTK_TT *)(anOutputPtr), 
+                        theNbOfTuples,
+                        aScale);
     default:
       break;
     }  
   }else{
     switch(anInputDataType){
       vtkTemplateMacro9(NonLinearTransformVectors,
-                       anInputVectors,
-                       (VTK_TT *)(anInputPtr), 
-                       (VTK_TT *)(anOutputPtr), 
-                       theNbOfTuples,
-                       aScale,
-                       theFunction,
-                       aScalarRange[0],
-                       aScalarDelta,
-                       theScalarRange[1]);
+                        anInputVectors,
+                        (VTK_TT *)(anInputPtr), 
+                        (VTK_TT *)(anOutputPtr), 
+                        theNbOfTuples,
+                        aScale,
+                        theFunction,
+                        aScalarRange[0],
+                        aScalarDelta,
+                        theScalarRange[1]);
     default:
       break;
     }  
@@ -279,11 +280,11 @@ ExecuteVectors(VISU_FieldTransform::TTransformFun theFunction,
 template<typename TValueType> 
 void
 NonLinearTransformScalars(vtkDataArray *theInputScalars,
-                         TValueType* theInputPtr,
-                         TValueType* theOutputPtr,
-                         vtkIdType theNbOfTuples,
-                         VISU_FieldTransform::TTransformFun theFunction,
-                         vtkFloatingPointType theModifiedScalarMin)
+                          TValueType* theInputPtr,
+                          TValueType* theOutputPtr,
+                          vtkIdType theNbOfTuples,
+                          VISU_FieldTransform::TTransformFun theFunction,
+                          vtkFloatingPointType theModifiedScalarMin)
 {
   for(vtkIdType aTupleId = 0; aTupleId < theNbOfTuples; aTupleId++){
     vtkFloatingPointType aScalar = (*theFunction)(vtkFloatingPointType(*theInputPtr));
@@ -300,10 +301,10 @@ NonLinearTransformScalars(vtkDataArray *theInputScalars,
 template<typename TDataSetAttributesType> 
 void
 ExecuteScalars(VISU_FieldTransform::TTransformFun theFunction, 
-              vtkFloatingPointType theScalarRange[2],
-              vtkIdType theNbOfTuples, 
-              TDataSetAttributesType* theInputData, 
-              TDataSetAttributesType* theOutputData)
+               vtkFloatingPointType theScalarRange[2],
+               vtkIdType theNbOfTuples, 
+               TDataSetAttributesType* theInputData, 
+               TDataSetAttributesType* theOutputData)
 {
   vtkDataArray *anInputScalars = theInputData->GetScalars();
   if(!anInputScalars || theNbOfTuples < 1)
@@ -323,12 +324,12 @@ ExecuteScalars(VISU_FieldTransform::TTransformFun theFunction,
 
   switch(anInputDataType){
     vtkTemplateMacro6(NonLinearTransformScalars,
-                     anInputScalars,
-                     (VTK_TT *)(anInputPtr), 
-                     (VTK_TT *)(anOutputPtr), 
-                     theNbOfTuples,
-                     theFunction,
-                     aScalarRange[0]);
+                      anInputScalars,
+                      (VTK_TT *)(anInputPtr), 
+                      (VTK_TT *)(anOutputPtr), 
+                      theNbOfTuples,
+                      theFunction,
+                      aScalarRange[0]);
   default:
     break;
   }  
@@ -342,8 +343,8 @@ ExecuteScalars(VISU_FieldTransform::TTransformFun theFunction,
 int
 VISU_FieldTransform
 ::RequestData(vtkInformation *vtkNotUsed(request),
-             vtkInformationVector **inputVector,
-             vtkInformationVector *outputVector)
+              vtkInformationVector **inputVector,
+              vtkInformationVector *outputVector)
 {
   // get the info objects
   vtkInformation *inInfo = inputVector[0]->GetInformationObject(0);
@@ -364,30 +365,30 @@ VISU_FieldTransform
     output->GetCellData()->CopyVectorsOff();
 
     ExecuteScalars(myFunction,
-                  myScalarRange,
-                  input->GetNumberOfPoints(),
-                  input->GetPointData(),
-                  output->GetPointData());
+                   myScalarRange,
+                   input->GetNumberOfPoints(),
+                   input->GetPointData(),
+                   output->GetPointData());
 
     ExecuteVectors(myFunction,
-                  myTransform,
-                  myScalarRange,
-                  input->GetNumberOfPoints(),
-                  input->GetPointData(),
-                  output->GetPointData());
+                   myTransform,
+                   myScalarRange,
+                   input->GetNumberOfPoints(),
+                   input->GetPointData(),
+                   output->GetPointData());
 
     ExecuteScalars(myFunction,
-                  myScalarRange,
-                  input->GetNumberOfCells(),
-                  input->GetCellData(),
-                  output->GetCellData());
+                   myScalarRange,
+                   input->GetNumberOfCells(),
+                   input->GetCellData(),
+                   output->GetCellData());
 
     ExecuteVectors(myFunction,
-                  myTransform,
-                  myScalarRange,
-                  input->GetNumberOfCells(),
-                  input->GetCellData(),
-                  output->GetCellData());
+                   myTransform,
+                   myScalarRange,
+                   input->GetNumberOfCells(),
+                   input->GetCellData(),
+                   output->GetCellData());
   }else{
     output->GetPointData()->CopyAllOn();
     output->GetCellData()->CopyAllOn();