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 aCoeffOfIntStep = 1.0E+1;
+static vtkFloatingPointType EPS = 1.0e-7;
+static vtkFloatingPointType aMinNbOfSteps = 1.0E+2;
+//static vtkFloatingPointType aMaxNbOfSteps = 1.0E+3;
+static vtkFloatingPointType aCoeffOfIntStep = 1.0E+1;
vtkStandardNewMacro(VISU_StreamLinesPL);
}
-float VISU_StreamLinesPL::GetNecasseryMemorySize(vtkIdType theNbOfPoints, float theStepLength,
- float thePropogationTime, float thePercents)
+vtkFloatingPointType
+VISU_StreamLinesPL
+::GetNecasseryMemorySize(vtkIdType theNbOfPoints,
+ vtkFloatingPointType theStepLength,
+ vtkFloatingPointType thePropogationTime,
+ vtkFloatingPointType thePercents)
{
- static float aStreamPointSize = sizeof(float)*15 + sizeof(vtkIdType)*2;
- static float aStreamArraySize = aStreamPointSize*1024; // == 69632
+ static vtkFloatingPointType aStreamPointSize = sizeof(vtkFloatingPointType)*15 + sizeof(vtkIdType)*2;
+ static vtkFloatingPointType aStreamArraySize = aStreamPointSize*1024; // == 69632
- float aNbCells = thePercents*theNbOfPoints*2.0;
- float aNbPointsPerCell = thePropogationTime/theStepLength;
- float aCellsSize = aNbCells*(1+aNbPointsPerCell);
- float aPointsSize = aCellsSize*3.0*sizeof(float);
+ vtkFloatingPointType aNbCells = thePercents*theNbOfPoints*2.0;
+ vtkFloatingPointType aNbPointsPerCell = thePropogationTime/theStepLength;
+ vtkFloatingPointType aCellsSize = aNbCells*(1+aNbPointsPerCell);
+ vtkFloatingPointType aPointsSize = aCellsSize*3.0*sizeof(vtkFloatingPointType);
- float aConnectivitySize = aCellsSize*sizeof(vtkIdType);
- float aTypesSize = aNbCells*sizeof(char);
- float aLocationsSize = aNbCells*sizeof(int);
- //float aNbCellsPerPoint = aCellsSize / aNbCells - 1;
- float aMeshSize = aPointsSize + aConnectivitySize + aTypesSize + aLocationsSize;
+ vtkFloatingPointType aConnectivitySize = aCellsSize*sizeof(vtkIdType);
+ vtkFloatingPointType aTypesSize = aNbCells*sizeof(char);
+ vtkFloatingPointType aLocationsSize = aNbCells*sizeof(int);
+ //vtkFloatingPointType aNbCellsPerPoint = aCellsSize / aNbCells - 1;
+ vtkFloatingPointType aMeshSize = aPointsSize + aConnectivitySize + aTypesSize + aLocationsSize;
- float anAssignedDataSize = aCellsSize*4.0*sizeof(float);
- float anOutputDataSetSize = aMeshSize + anAssignedDataSize;
+ vtkFloatingPointType anAssignedDataSize = aCellsSize*4.0*sizeof(vtkFloatingPointType);
+ vtkFloatingPointType anOutputDataSetSize = aMeshSize + anAssignedDataSize;
- float aResult = aStreamArraySize*aNbCells + anOutputDataSetSize;
+ vtkFloatingPointType aResult = aStreamArraySize*aNbCells + anOutputDataSetSize;
return aResult;
}
-int VISU_StreamLinesPL::FindPossibleParams(vtkPointSet* theDataSet, float& theStepLength,
- float& thePropogationTime, float& thePercents)
+int
+VISU_StreamLinesPL
+::FindPossibleParams(vtkPointSet* theDataSet,
+ vtkFloatingPointType& theStepLength,
+ vtkFloatingPointType& thePropogationTime,
+ vtkFloatingPointType& thePercents)
{
- static float aPercentsDecrease = 3.0, aStepLengthIncrease = 9.0;
+ static vtkFloatingPointType aPercentsDecrease = 3.0, aStepLengthIncrease = 9.0;
vtkIdType aNbOfPoints = theDataSet->GetNumberOfPoints();
- float aSize = GetNecasseryMemorySize(aNbOfPoints,theStepLength,thePropogationTime,thePercents);
+ vtkFloatingPointType aSize = GetNecasseryMemorySize(aNbOfPoints,theStepLength,thePropogationTime,thePercents);
int isPoss = CheckAvailableMemory(aSize);
if(!isPoss){
- float aMaxStepLength = max(GetMaxStepLength(theDataSet),thePropogationTime);
- float aMinStepLength = GetMinStepLength(theDataSet);
- float aDeltaStepLength = (aMaxStepLength - aMinStepLength)/aStepLengthIncrease;
+ vtkFloatingPointType aMaxStepLength = max(GetMaxStepLength(theDataSet),thePropogationTime);
+ vtkFloatingPointType aMinStepLength = GetMinStepLength(theDataSet);
+ vtkFloatingPointType aDeltaStepLength = (aMaxStepLength - aMinStepLength)/aStepLengthIncrease;
for(int i = 2, aStepChanged = 1, aPerecentsChanged = 1; aStepChanged || aPerecentsChanged; i++){
- float aStepLength = theStepLength + aDeltaStepLength;
+ vtkFloatingPointType aStepLength = theStepLength + aDeltaStepLength;
if(aStepLength < aMaxStepLength) theStepLength = aStepLength;
else if(aStepChanged){
aStepLength = aMaxStepLength;
aStepChanged = 0;
}
- float aPercents = thePercents /= aPercentsDecrease;
+ vtkFloatingPointType aPercents = thePercents /= aPercentsDecrease;
if(aPercents*aNbOfPoints > 1) thePercents = aPercents;
else if(aPerecentsChanged) {
thePercents = 1.1 / aNbOfPoints;
}
-int VISU_StreamLinesPL::SetParams(float theIntStep,
- float thePropogationTime,
- float theStepLength,
- vtkPointSet* theSource,
- float thePercents,
- int theDirection,
- int isOnlyTry)
+int
+VISU_StreamLinesPL
+::SetParams(vtkFloatingPointType theIntStep,
+ vtkFloatingPointType thePropogationTime,
+ vtkFloatingPointType theStepLength,
+ vtkPointSet* theSource,
+ vtkFloatingPointType thePercents,
+ int theDirection,
+ int isOnlyTry)
{
vtkPointSet* aDataSet = theSource? theSource: myFieldTransform->GetUnstructuredGridOutput();
aDataSet->Update();
}
-vtkPointSet* VISU_StreamLinesPL::GetSource() {
+vtkPointSet*
+VISU_StreamLinesPL
+::GetSource()
+{
return mySource;
}
-float VISU_StreamLinesPL::GetUsedPoints() {
+vtkFloatingPointType
+VISU_StreamLinesPL
+::GetUsedPoints()
+{
return myPercents;
}
-vtkDataSet* VISU_StreamLinesPL::GetStreamerSource(){
+vtkDataSet*
+VISU_StreamLinesPL
+::GetStreamerSource()
+{
return myStream->GetSource();
}
-float VISU_StreamLinesPL::GetVelocityCoeff(){
+vtkFloatingPointType
+VISU_StreamLinesPL
+::GetVelocityCoeff()
+{
return GetVelocityCoeff(myExtractor->GetOutput());
}
-float VISU_StreamLinesPL::GetVelocityCoeff(vtkPointSet* theDataSet){
- float* aScalarRange = theDataSet->GetScalarRange();
+vtkFloatingPointType
+VISU_StreamLinesPL
+::GetVelocityCoeff(vtkPointSet* theDataSet)
+{
+ vtkFloatingPointType* aScalarRange = theDataSet->GetScalarRange();
return (fabs(aScalarRange[1]) + fabs(aScalarRange[0]))/2.0;
}
-int VISU_StreamLinesPL::IsPossible(vtkPointSet* theDataSet, float thePercents){
- float aStepLength = GetBaseStepLength(theDataSet);
- float aBasePropTime = GetBasePropagationTime(theDataSet);
+int
+VISU_StreamLinesPL
+::IsPossible(vtkPointSet* theDataSet,
+ vtkFloatingPointType thePercents)
+{
+ vtkFloatingPointType aStepLength = GetBaseStepLength(theDataSet);
+ vtkFloatingPointType aBasePropTime = GetBasePropagationTime(theDataSet);
VISU_UsedPointsFilter *aPointsFilter = VISU_UsedPointsFilter::New();
aPointsFilter->SetInput(theDataSet);
vtkPointSet* aDataSet = aPointsFilter->GetOutput();
}
-float VISU_StreamLinesPL::GetIntegrationStep(){
+vtkFloatingPointType
+VISU_StreamLinesPL
+::GetIntegrationStep()
+{
return myStream->GetIntegrationStepLength();
}
-float VISU_StreamLinesPL::GetStepLength() {
+
+vtkFloatingPointType
+VISU_StreamLinesPL
+::GetStepLength()
+{
return myStream->GetStepLength();
}
-float VISU_StreamLinesPL::GetPropagationTime() {
+
+vtkFloatingPointType
+VISU_StreamLinesPL
+::GetPropagationTime()
+{
return myStream->GetMaximumPropagationTime();
}
-int VISU_StreamLinesPL::GetDirection(){
+
+int
+VISU_StreamLinesPL
+::GetDirection()
+{
return myStream->GetIntegrationDirection();
}
-float VISU_StreamLinesPL::GetMinIntegrationStep(vtkPointSet* theDataSet, float thePercents) {
+vtkFloatingPointType
+VISU_StreamLinesPL
+::GetMinIntegrationStep(vtkPointSet* theDataSet,
+ vtkFloatingPointType thePercents)
+{
if(!theDataSet) return -1.0;
- float aVolume = 1.0;
+ vtkFloatingPointType aVolume = 1.0;
int degree = 0;
theDataSet->Update();
- float* aBounds = theDataSet->GetBounds();
+ vtkFloatingPointType* aBounds = theDataSet->GetBounds();
for(int i = 0, j = 0; i < 3; ++i, j = 2*i){
- float tmp = aBounds[j+1] - aBounds[j];
+ vtkFloatingPointType tmp = aBounds[j+1] - aBounds[j];
if (tmp > EPS ) {
aVolume *= tmp;
degree += 1;
}
}
if (degree < 1) return 0.0; // absolutely empty object
- float anStepLength = GetMaxIntegrationStep(theDataSet)/aCoeffOfIntStep;
- float aBasePropTime = GetBasePropagationTime(theDataSet)/GetVelocityCoeff(theDataSet);
+ vtkFloatingPointType anStepLength = GetMaxIntegrationStep(theDataSet)/aCoeffOfIntStep;
+ vtkFloatingPointType aBasePropTime = GetBasePropagationTime(theDataSet)/GetVelocityCoeff(theDataSet);
thePercents = 1.0;
vtkIdType aNbOfPoints = theDataSet->GetNumberOfPoints();
- float aSize = GetNecasseryMemorySize(aNbOfPoints,anStepLength,aBasePropTime,thePercents);
- float aRealSize = GetAvailableMemory(aSize);
- float anAverageVolume = aVolume / aRealSize;
- float aStep = pow(double(anAverageVolume), double(1.0/double(degree)));
+ vtkFloatingPointType aSize = GetNecasseryMemorySize(aNbOfPoints,anStepLength,aBasePropTime,thePercents);
+ vtkFloatingPointType aRealSize = GetAvailableMemory(aSize);
+ vtkFloatingPointType anAverageVolume = aVolume / aRealSize;
+ vtkFloatingPointType aStep = pow(double(anAverageVolume), double(1.0/double(degree)));
return aStep;
}
-float VISU_StreamLinesPL::GetMinIntegrationStep(){
+
+vtkFloatingPointType
+VISU_StreamLinesPL
+::GetMinIntegrationStep()
+{
return GetMinIntegrationStep(myExtractor->GetOutput(),GetUsedPoints());
}
-float VISU_StreamLinesPL::GetMaxIntegrationStep(vtkPointSet* theDataSet) {
+vtkFloatingPointType
+VISU_StreamLinesPL
+::GetMaxIntegrationStep(vtkPointSet* theDataSet)
+{
if(!theDataSet) return -1.0;
theDataSet->Update();
- float aLength = theDataSet->GetLength();
- float* aBounds = theDataSet->GetBounds();
- float aMaxSizeY = (aBounds[3]-aBounds[2])/aLength;
- float aMaxSizeZ = (aBounds[5]-aBounds[4])/aLength;
- float aMinMax = (aBounds[1] - aBounds[0])/aLength;
+ vtkFloatingPointType aLength = theDataSet->GetLength();
+ vtkFloatingPointType* aBounds = theDataSet->GetBounds();
+ vtkFloatingPointType aMaxSizeY = (aBounds[3]-aBounds[2])/aLength;
+ vtkFloatingPointType aMaxSizeZ = (aBounds[5]-aBounds[4])/aLength;
+ vtkFloatingPointType aMinMax = (aBounds[1] - aBounds[0])/aLength;
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(){
+
+vtkFloatingPointType
+VISU_StreamLinesPL
+::GetMaxIntegrationStep()
+{
return GetMaxIntegrationStep(myExtractor->GetOutput());
}
-float VISU_StreamLinesPL::GetBaseIntegrationStep(vtkPointSet* theDataSet, float thePercents){
+vtkFloatingPointType
+VISU_StreamLinesPL
+::GetBaseIntegrationStep(vtkPointSet* theDataSet,
+ vtkFloatingPointType thePercents)
+{
theDataSet->Update();
- float aMinIntegrationStep = GetMinIntegrationStep(theDataSet,thePercents);
- float aMaxIntegrationStep = GetMaxIntegrationStep(theDataSet);
- float anIntegrationStep = aMaxIntegrationStep / aCoeffOfIntStep;
- float aMinMax = theDataSet->GetLength()/theDataSet->GetNumberOfPoints();
+ vtkFloatingPointType aMinIntegrationStep = GetMinIntegrationStep(theDataSet,thePercents);
+ vtkFloatingPointType aMaxIntegrationStep = GetMaxIntegrationStep(theDataSet);
+ vtkFloatingPointType anIntegrationStep = aMaxIntegrationStep / aCoeffOfIntStep;
+ vtkFloatingPointType aMinMax = theDataSet->GetLength()/theDataSet->GetNumberOfPoints();
if(aMinMax > anIntegrationStep)
anIntegrationStep = (anIntegrationStep*aCoeffOfIntStep*0.9+aMinMax)/aCoeffOfIntStep;
if(aMinIntegrationStep > anIntegrationStep)
return anIntegrationStep;
}
-float VISU_StreamLinesPL::CorrectIntegrationStep(float theStep, vtkPointSet* theDataSet, float thePercents){
+vtkFloatingPointType
+VISU_StreamLinesPL
+::CorrectIntegrationStep(vtkFloatingPointType theStep,
+ vtkPointSet* theDataSet,
+ vtkFloatingPointType thePercents)
+{
theDataSet->Update();
- float aMinIntegrationStep = GetMinIntegrationStep(theDataSet,thePercents);
- float aMaxIntegrationStep = GetMaxIntegrationStep(theDataSet);
+ vtkFloatingPointType aMinIntegrationStep = GetMinIntegrationStep(theDataSet,thePercents);
+ vtkFloatingPointType aMaxIntegrationStep = GetMaxIntegrationStep(theDataSet);
if(aMinIntegrationStep > theStep)
theStep = aMinIntegrationStep;
if(aMaxIntegrationStep < theStep)
}
-float VISU_StreamLinesPL::GetMinPropagationTime(vtkPointSet* theDataSet){
+vtkFloatingPointType
+VISU_StreamLinesPL
+::GetMinPropagationTime(vtkPointSet* theDataSet)
+{
if(!theDataSet) return -1.0;
return GetMinStepLength(theDataSet);
}
-float VISU_StreamLinesPL::GetMinPropagationTime(){
+
+vtkFloatingPointType
+VISU_StreamLinesPL
+::GetMinPropagationTime()
+{
return GetMinPropagationTime(myExtractor->GetOutput());
}
-float VISU_StreamLinesPL::GetMaxPropagationTime(vtkPointSet* theDataSet){
+vtkFloatingPointType
+VISU_StreamLinesPL
+::GetMaxPropagationTime(vtkPointSet* theDataSet)
+{
if(!theDataSet) return -1.0;
return GetBasePropagationTime(theDataSet)*aMinNbOfSteps;
}
-float VISU_StreamLinesPL::GetMaxPropagationTime(){
+
+vtkFloatingPointType VISU_StreamLinesPL::GetMaxPropagationTime(){
return GetMaxPropagationTime(myExtractor->GetOutput());
}
-float VISU_StreamLinesPL::CorrectPropagationTime(float thePropagationTime, vtkPointSet* theDataSet){
- float aMinPropagationTime = GetMinPropagationTime(theDataSet);
- float aMaxPropagationTime = GetMaxPropagationTime(theDataSet);
+vtkFloatingPointType
+VISU_StreamLinesPL
+::CorrectPropagationTime(vtkFloatingPointType thePropagationTime,
+ vtkPointSet* theDataSet)
+{
+ vtkFloatingPointType aMinPropagationTime = GetMinPropagationTime(theDataSet);
+ vtkFloatingPointType aMaxPropagationTime = GetMaxPropagationTime(theDataSet);
if(aMinPropagationTime > thePropagationTime)
thePropagationTime = aMinPropagationTime;
if(aMaxPropagationTime < thePropagationTime)
thePropagationTime = aMaxPropagationTime;
return thePropagationTime;
}
-float VISU_StreamLinesPL::GetBasePropagationTime(vtkPointSet* theDataSet){
+
+vtkFloatingPointType
+VISU_StreamLinesPL
+::GetBasePropagationTime(vtkPointSet* theDataSet)
+{
if(!theDataSet) return -1.0;
theDataSet->Update();
- float aPropagationTime = theDataSet->GetLength()/GetVelocityCoeff(theDataSet);
+ vtkFloatingPointType aPropagationTime = theDataSet->GetLength()/GetVelocityCoeff(theDataSet);
return aPropagationTime;
}
-float VISU_StreamLinesPL::GetBasePropagationTime(){
+
+vtkFloatingPointType
+VISU_StreamLinesPL
+::GetBasePropagationTime()
+{
return GetBasePropagationTime(myExtractor->GetOutput());
}
-float VISU_StreamLinesPL::GetMinStepLength(vtkPointSet* theDataSet){
- static float aNbOfStepsOfIntStep = 1.0E+1;
- float anIntStep = GetMinIntegrationStep(theDataSet);
- float aStepLength = anIntStep*aNbOfStepsOfIntStep/GetVelocityCoeff(theDataSet);
+vtkFloatingPointType
+VISU_StreamLinesPL
+::GetMinStepLength(vtkPointSet* theDataSet)
+{
+ static vtkFloatingPointType aNbOfStepsOfIntStep = 1.0E+1;
+ vtkFloatingPointType anIntStep = GetMinIntegrationStep(theDataSet);
+ vtkFloatingPointType aStepLength = anIntStep*aNbOfStepsOfIntStep/GetVelocityCoeff(theDataSet);
return aStepLength;
}
-float VISU_StreamLinesPL::GetMinStepLength(){
+
+vtkFloatingPointType
+VISU_StreamLinesPL
+::GetMinStepLength()
+{
return GetMinStepLength(myExtractor->GetOutput());
}
-float VISU_StreamLinesPL::GetMaxStepLength(vtkPointSet* theDataSet){
- float aStepLength = GetBasePropagationTime(theDataSet);
+vtkFloatingPointType
+VISU_StreamLinesPL
+::GetMaxStepLength(vtkPointSet* theDataSet)
+{
+ vtkFloatingPointType aStepLength = GetBasePropagationTime(theDataSet);
return aStepLength;
}
-float VISU_StreamLinesPL::GetMaxStepLength(){
+
+vtkFloatingPointType
+VISU_StreamLinesPL
+::GetMaxStepLength()
+{
return GetMaxStepLength(myExtractor->GetOutput());
}
-float VISU_StreamLinesPL::CorrectStepLength(float theStep, vtkPointSet* theDataSet){
- float aMinStep = GetMinStepLength(theDataSet);
+vtkFloatingPointType
+VISU_StreamLinesPL
+::CorrectStepLength(vtkFloatingPointType theStep,
+ vtkPointSet* theDataSet)
+{
+ vtkFloatingPointType aMinStep = GetMinStepLength(theDataSet);
if(theStep < aMinStep) theStep = aMinStep;
- float aMaxStep = GetMaxStepLength(theDataSet);
+ vtkFloatingPointType aMaxStep = GetMaxStepLength(theDataSet);
if(theStep > aMaxStep) theStep = aMaxStep;
return theStep;
}
-float VISU_StreamLinesPL::GetBaseStepLength(vtkPointSet* theDataSet){
- static float anAvgNbOfSteps = 1.0E+2;
- float aPropagationTime = GetBasePropagationTime(theDataSet);
- float aStepLength = aPropagationTime/anAvgNbOfSteps;
+
+vtkFloatingPointType
+VISU_StreamLinesPL
+::GetBaseStepLength(vtkPointSet* theDataSet)
+{
+ static vtkFloatingPointType anAvgNbOfSteps = 1.0E+2;
+ vtkFloatingPointType aPropagationTime = GetBasePropagationTime(theDataSet);
+ vtkFloatingPointType aStepLength = aPropagationTime/anAvgNbOfSteps;
aStepLength = CorrectStepLength(aStepLength,theDataSet);
return aStepLength;
}
-void VISU_StreamLinesPL::Init(){
+void
+VISU_StreamLinesPL
+::Init()
+{
VISU_ScalarMapPL::Init();
vtkPointSet* aDataSet = myExtractor->GetOutput();
- float anIntStep = GetBaseIntegrationStep(aDataSet);
- float aPropagationTime = GetBasePropagationTime(aDataSet);
- float aStepLength = GetBaseStepLength(aDataSet);
+ vtkFloatingPointType anIntStep = GetBaseIntegrationStep(aDataSet);
+ vtkFloatingPointType aPropagationTime = GetBasePropagationTime(aDataSet);
+ vtkFloatingPointType aStepLength = GetBaseStepLength(aDataSet);
SetParams(anIntStep,aPropagationTime,aStepLength);
}
-VISU_ScalarMapPL::THook* VISU_StreamLinesPL::DoHook(){
+VISU_ScalarMapPL::THook*
+VISU_StreamLinesPL
+::DoHook()
+{
GetInput2()->Update();
VISU::CellDataToPoint(myStream,myCellDataToPointData,GetInput2(),myFieldTransform);
- float *aBounds = GetInput2()->GetBounds();
+ vtkFloatingPointType *aBounds = GetInput2()->GetBounds();
myGeomFilter->SetExtent(aBounds);
myGeomFilter->ExtentClippingOn();
myGeomFilter->SetInput(myStream->GetOutput());
return myGeomFilter->GetOutput();
}
-void VISU_StreamLinesPL::Update(){
+void
+VISU_StreamLinesPL
+::Update()
+{
VISU_ScalarMapPL::Update();
}
-void VISU_StreamLinesPL::SetMapScale(float theMapScale){
+void
+VISU_StreamLinesPL
+::SetMapScale(vtkFloatingPointType theMapScale)
+{
VISU_ScalarMapPL::SetMapScale(theMapScale);
}