// VISU OBJECT : interactive object for VISU entities implementation
//
// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
// File: VISU_PipeLine.cxx
#include "VISU_StreamLinesPL.hxx"
#include "VISU_PipeLineUtils.hxx"
#include "VISU_UsedPointsFilter.hxx"
-#include "SALOME_GeometryFilter.h"
+#include "VTKViewer_GeometryFilter.h"
#include <algo.h>
#include <vtkStreamLine.h>
#ifdef _DEBUG_
-static int MYDEBUG = 1;
+static int MYDEBUG = 0;
#else
static int MYDEBUG = 0;
#endif
static float EPS = 1.0e-7;
static float aMinNbOfSteps = 1.0E+2;
-static float aMaxNbOfSteps = 1.0E+3;
+//static float aMaxNbOfSteps = 1.0E+3;
static float aCoeffOfIntStep = 1.0E+1;
VISU_StreamLinesPL::VISU_StreamLinesPL(){
myStream = vtkStreamLine::New();
myCenters = vtkCellCenters::New();
- myGeomFilter = SALOME_GeometryFilter::New();
+ myGeomFilter = VTKViewer_GeometryFilter::New();
myPointsFilter = VISU_UsedPointsFilter::New();
myPercents = 0.3;
mySource = NULL;
}
void VISU_StreamLinesPL::ShallowCopy(VISU_PipeLine *thePipeLine){
- VISU_DeformedShapePL::ShallowCopy(thePipeLine);
- if(VISU_StreamLinesPL *aPipeLine = dynamic_cast<VISU_StreamLinesPL*>(thePipeLine))
+ if(VISU_StreamLinesPL *aPipeLine = dynamic_cast<VISU_StreamLinesPL*>(thePipeLine)){
SetParams(aPipeLine->GetIntegrationStep(),
aPipeLine->GetPropagationTime(),
aPipeLine->GetStepLength(),
aPipeLine->GetSource(),
aPipeLine->GetUsedPoints(),
aPipeLine->GetDirection());
+ }
+ VISU_DeformedShapePL::ShallowCopy(thePipeLine);
}
-float VISU_StreamLinesPL::GetNecasseryMemorySize(vtkIdType theNbOfPoints, float theStepLength,
+float VISU_StreamLinesPL::GetNecasseryMemorySize(vtkIdType theNbOfPoints, float theStepLength,
float thePropogationTime, float thePercents)
{
static float aStreamPointSize = sizeof(float)*15 + sizeof(vtkIdType)*2;
float aConnectivitySize = aCellsSize*sizeof(vtkIdType);
float aTypesSize = aNbCells*sizeof(char);
float aLocationsSize = aNbCells*sizeof(int);
- float aNbCellsPerPoint = aCellsSize / aNbCells - 1;
+ //float aNbCellsPerPoint = aCellsSize / aNbCells - 1;
float aMeshSize = aPointsSize + aConnectivitySize + aTypesSize + aLocationsSize;
float anAssignedDataSize = aCellsSize*4.0*sizeof(float);
return aResult;
}
-int VISU_StreamLinesPL::FindPossibleParams(vtkPointSet* theDataSet, float& theStepLength,
+int VISU_StreamLinesPL::FindPossibleParams(vtkPointSet* theDataSet, float& theStepLength,
float& thePropogationTime, float& thePercents)
{
static float aPercentsDecrease = 3.0, aStepLengthIncrease = 9.0;
}
-int VISU_StreamLinesPL::SetParams(float theIntStep,
+int VISU_StreamLinesPL::SetParams(float theIntStep,
float thePropogationTime,
float theStepLength,
- vtkPointSet* theSource,
- float thePercents,
+ vtkPointSet* theSource,
+ float thePercents,
int theDirection,
int isOnlyTry)
{
if((!isOnlyTry && isAccepted) || (isOnlyTry && isAccepted == 1)){
mySource = theSource;
myPercents = thePercents;
- if(myInput->GetCellData()->GetNumberOfArrays()){
+ if(GetInput2()->GetCellData()->GetNumberOfArrays()){
myCenters->SetInput(aDataSet);
myCenters->VertexCellsOn();
aDataSet = myCenters->GetOutput();
return mySource;
}
-float VISU_StreamLinesPL::GetUsedPoints() {
+float VISU_StreamLinesPL::GetUsedPoints() {
return myPercents;
}
float VISU_StreamLinesPL::GetIntegrationStep(){
return myStream->GetIntegrationStepLength();
}
-float VISU_StreamLinesPL::GetStepLength() {
+float VISU_StreamLinesPL::GetStepLength() {
return myStream->GetStepLength();
}
-float VISU_StreamLinesPL::GetPropagationTime() {
+float VISU_StreamLinesPL::GetPropagationTime() {
return myStream->GetMaximumPropagationTime();
}
int VISU_StreamLinesPL::GetDirection(){
float VISU_StreamLinesPL::GetMinIntegrationStep(vtkPointSet* theDataSet, float thePercents) {
if(!theDataSet) return -1.0;
- float aVolume = 1.0, tmp;
+ float aVolume = 1.0;
int degree = 0;
theDataSet->Update();
float* aBounds = theDataSet->GetBounds();
vtkIdType aNbOfPoints = theDataSet->GetNumberOfPoints();
float aSize = GetNecasseryMemorySize(aNbOfPoints,anStepLength,aBasePropTime,thePercents);
float aRealSize = GetAvailableMemory(aSize);
- float anAverageVolume = aVolume / aRealSize;
+ float anAverageVolume = aVolume / aRealSize;
float aStep = pow(double(anAverageVolume), double(1.0/double(degree)));
return aStep;
}
-float VISU_StreamLinesPL::GetMinIntegrationStep(){
+float VISU_StreamLinesPL::GetMinIntegrationStep(){
return GetMinIntegrationStep(myExtractor->GetOutput(),GetUsedPoints());
}
if (aMinMax < EPS || (aMaxSizeY < aMinMax && aMaxSizeY > EPS)) aMinMax = aMaxSizeY;
if (aMinMax < EPS || (aMaxSizeZ < aMinMax && aMaxSizeZ > EPS)) aMinMax = aMaxSizeZ;
return aMinMax*aLength/2.0;
-}
-float VISU_StreamLinesPL::GetMaxIntegrationStep(){
+}
+float VISU_StreamLinesPL::GetMaxIntegrationStep(){
return GetMaxIntegrationStep(myExtractor->GetOutput());
}
-float VISU_StreamLinesPL::GetBaseIntegrationStep(vtkPointSet* theDataSet, float thePercents){
+float VISU_StreamLinesPL::GetBaseIntegrationStep(vtkPointSet* theDataSet, float thePercents){
theDataSet->Update();
float aMinIntegrationStep = GetMinIntegrationStep(theDataSet,thePercents);
float aMaxIntegrationStep = GetMaxIntegrationStep(theDataSet);
float anIntegrationStep = aMaxIntegrationStep / aCoeffOfIntStep;
float aMinMax = theDataSet->GetLength()/theDataSet->GetNumberOfPoints();
- if(aMinMax > anIntegrationStep)
+ if(aMinMax > anIntegrationStep)
anIntegrationStep = (anIntegrationStep*aCoeffOfIntStep*0.9+aMinMax)/aCoeffOfIntStep;
- if(aMinIntegrationStep > anIntegrationStep)
+ if(aMinIntegrationStep > anIntegrationStep)
anIntegrationStep = aMinIntegrationStep;
return anIntegrationStep;
}
-float VISU_StreamLinesPL::CorrectIntegrationStep(float theStep, vtkPointSet* theDataSet, float thePercents){
+float VISU_StreamLinesPL::CorrectIntegrationStep(float theStep, vtkPointSet* theDataSet, float thePercents){
theDataSet->Update();
float aMinIntegrationStep = GetMinIntegrationStep(theDataSet,thePercents);
float aMaxIntegrationStep = GetMaxIntegrationStep(theDataSet);
float aPropagationTime = theDataSet->GetLength()/GetVelocityCoeff(theDataSet);
return aPropagationTime;
}
-float VISU_StreamLinesPL::GetBasePropagationTime(){
+float VISU_StreamLinesPL::GetBasePropagationTime(){
return GetBasePropagationTime(myExtractor->GetOutput());
}
}
VISU_ScalarMapPL::THook* VISU_StreamLinesPL::DoHook(){
- myInput->Update();
- VISU::CellDataToPoint(myStream,myCellDataToPointData,myInput,myFieldTransform);
- float *aBounds = myInput->GetBounds();
+ GetInput2()->Update();
+ VISU::CellDataToPoint(myStream,myCellDataToPointData,GetInput2(),myFieldTransform);
+ float *aBounds = GetInput2()->GetBounds();
myGeomFilter->SetExtent(aBounds);
myGeomFilter->ExtentClippingOn();
myGeomFilter->SetInput(myStream->GetOutput());