]> SALOME platform Git repositories - modules/paravis.git/commitdiff
Salome HOME
Ply approved
authorAnthony Geay <anthony.geay@edf.fr>
Tue, 3 Apr 2018 12:46:05 +0000 (14:46 +0200)
committerAnthony Geay <anthony.geay@edf.fr>
Wed, 4 Apr 2018 12:08:48 +0000 (14:08 +0200)
src/Plugins/SimpleMode/IO/vtkSimpleMode.cxx

index 9a351f4b72805b7407cb8fabcfbc665d52666ea3..d6bd567f134ad703eb005892abf141972dc6f81d 100644 (file)
@@ -390,7 +390,7 @@ int vtkSimpleMode::RequestData(vtkInformation *request, vtkInformationVector **i
       arr1->SetNumberOfTuples(nbPts);
       double *ptToFeed1(arr1->Begin());
       const double *srcPt1(arrReal->Begin());
-      double cst1(Factor*sin(AnimationTime*2*M_PI));
+      double cst1(Factor*cos(AnimationTime*2*M_PI));
       std::transform(srcPt1,srcPt1+3*nbPts,ptToFeed1,std::bind2nd(std::multiplies<double>(),cst1));
       int idx1(outSurface->GetPointData()->AddArray(arr1));
       outSurface->GetPointData()->SetActiveAttribute(idx1,vtkDataSetAttributes::VECTORS);
@@ -413,8 +413,22 @@ int vtkSimpleMode::RequestData(vtkInformation *request, vtkInformationVector **i
       vtkInformation *outInfo(outputVector->GetInformationObject(0));
       vtkPolyData *output(vtkPolyData::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT())));
       output->ShallowCopy(ds);
-
-      vtkDataArray* array = ds->GetPointData()->GetArray(idx2);
+      output->GetPointData()->DeepCopy(ds->GetPointData());
+      //
+      for(int i=0;i<output->GetPointData()->GetNumberOfArrays();i++)
+        {
+          vtkDataArray *arr(output->GetPointData()->GetArray(i));
+          vtkDoubleArray *arr2(vtkDoubleArray::SafeDownCast(arr));
+          if(!arr2)
+            continue;
+          int nbCompo(arr2->GetNumberOfComponents()),nbTuples(arr2->GetNumberOfTuples());
+          if(nbCompo!=3 && nbCompo!=2)
+            continue;
+          double *arrPtr(arr2->GetPointer(0));
+          std::transform(arrPtr,arrPtr+nbCompo*nbTuples,arrPtr,std::bind2nd(std::multiplies<double>(),cos(AnimationTime*2*M_PI)));
+        }
+      //
+      vtkDataArray* array = output->GetPointData()->GetArray(idx2);
       vtkSmartPointer<vtkDataArray> result = vtkSmartPointer<vtkDataArray>::Take(vtkDataArray::CreateDataArray(array->GetDataType()));
       result->ShallowCopy(array);
       result->SetName("Result");