-// Copyright (C) 2003 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 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
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// Copyright (C) 2007-2010 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
+//
+// 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.
+//
+// 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
+//
+
// File : VISU_FieldTransform.cxx
// Module : VISU
-
+//
#include "VISU_FieldTransform.hxx"
#include "VTKViewer_Transform.h"
#include "VISU_PipeLineUtils.hxx"
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++){
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];
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++){
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)
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;
}
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));
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)
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;
}
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);
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();