Salome HOME
untabify
[modules/visu.git] / src / PIPELINE / VISU_StreamLinesPL.cxx
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 //  This library is free software; you can redistribute it and/or
7 //  modify it under the terms of the GNU Lesser General Public
8 //  License as published by the Free Software Foundation; either
9 //  version 2.1 of the License.
10 //
11 //  This library is distributed in the hope that it will be useful,
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 //  Lesser General Public License for more details.
15 //
16 //  You should have received a copy of the GNU Lesser General Public
17 //  License along with this library; if not, write to the Free Software
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 //  VISU OBJECT : interactive object for VISU entities implementation
23 // File:    VISU_StreamLinesPL.cxx
24 // Author:  Alexey PETROV
25 // Module : VISU
26 //
27 #include "VISU_StreamLinesPL.hxx"
28
29 #include "VISU_Extractor.hxx"
30 //#include "VISU_FieldTransform.hxx"
31 //#include "VISU_UsedPointsFilter.hxx"
32 #include "VISU_MaskPointsFilter.hxx"
33 #include "VISU_PipeLineUtils.hxx"
34
35 #include "VTKViewer_GeometryFilter.h"
36
37 #include <algorithm>
38
39 #include <vtkCell.h>
40 #include <vtkDataSet.h>
41 #include <vtkStreamLine.h>
42
43 #ifdef _DEBUG_
44 static int MYDEBUG = 0;
45 #else
46 static int MYDEBUG = 0;
47 #endif
48
49 static vtkFloatingPointType EPS = 1.0e-7;
50 static vtkFloatingPointType aMinNbOfSteps = 1.0E+2;
51 //static vtkFloatingPointType aMaxNbOfSteps = 1.0E+3;
52 static vtkFloatingPointType aCoeffOfIntStep = 1.0E+1;
53
54
55 //----------------------------------------------------------------------------
56 vtkStandardNewMacro(VISU_StreamLinesPL);
57
58
59 //----------------------------------------------------------------------------
60 VISU_StreamLinesPL
61 ::VISU_StreamLinesPL()
62 {
63   SetIsShrinkable(false);
64   SetIsFeatureEdgesAllowed(false);
65
66   myStream = vtkStreamLine::New();
67   myCenters = vtkCellCenters::New();
68   myGeomFilter = VTKViewer_GeometryFilter::New();
69   myPointsFilter = VISU_MaskPointsFilter::New();
70   myPercents = 0.3;
71   mySource = NULL;
72 }
73
74
75 //----------------------------------------------------------------------------
76 VISU_StreamLinesPL
77 ::~VISU_StreamLinesPL()
78 {
79   myPointsFilter->Delete();
80   myPointsFilter = NULL;
81
82   myCenters->Delete();
83   myCenters = NULL;
84
85   myGeomFilter->Delete();
86   myGeomFilter = NULL;
87
88   myStream->Delete();
89   myStream = NULL;
90 }
91
92
93 //----------------------------------------------------------------------------
94 unsigned long int 
95 VISU_StreamLinesPL
96 ::GetMTime()
97 {
98   unsigned long int aTime = Superclass::GetMTime();
99
100   aTime = std::max(aTime, myStream->GetMTime());
101   aTime = std::max(aTime, myCenters->GetMTime());
102   aTime = std::max(aTime, myGeomFilter->GetMTime());
103   aTime = std::max(aTime, myPointsFilter->GetMTime());
104
105   if ( mySource )
106     aTime = std::max(aTime, mySource->GetMTime());
107
108   return aTime;
109 }
110
111
112 //----------------------------------------------------------------------------
113 void
114 VISU_StreamLinesPL
115 ::DoShallowCopy(VISU_PipeLine *thePipeLine,
116                 bool theIsCopyInput)
117 {
118   Superclass::DoShallowCopy(thePipeLine, theIsCopyInput);
119
120   if(VISU_StreamLinesPL *aPipeLine = dynamic_cast<VISU_StreamLinesPL*>(thePipeLine)){
121     SetParams(aPipeLine->GetIntegrationStep(),
122               aPipeLine->GetPropagationTime(),
123               aPipeLine->GetStepLength(),
124               aPipeLine->GetSource(),
125               aPipeLine->GetUsedPoints(),
126               aPipeLine->GetDirection());
127   }
128 }
129
130
131 //----------------------------------------------------------------------------
132 size_t
133 VISU_StreamLinesPL
134 ::GetNecasseryMemorySize(vtkIdType theNbOfPoints, 
135                          vtkFloatingPointType theStepLength,
136                          vtkFloatingPointType thePropogationTime, 
137                          vtkFloatingPointType thePercents)
138 {
139   static vtkFloatingPointType aStreamPointSize = sizeof(vtkFloatingPointType)*15 + sizeof(vtkIdType)*2;
140   static vtkFloatingPointType aStreamArraySize = aStreamPointSize*1024; // == 69632
141
142   vtkFloatingPointType aNbCells = thePercents*theNbOfPoints*2.0;
143   vtkFloatingPointType aNbPointsPerCell = thePropogationTime/theStepLength;
144   vtkFloatingPointType aCellsSize = aNbCells*(1+aNbPointsPerCell);
145   vtkFloatingPointType aPointsSize = aCellsSize*3.0*sizeof(vtkFloatingPointType);
146
147   vtkFloatingPointType aConnectivitySize = aCellsSize*sizeof(vtkIdType);
148   vtkFloatingPointType aTypesSize = aNbCells*sizeof(char);
149   vtkFloatingPointType aLocationsSize = aNbCells*sizeof(int);
150   //vtkFloatingPointType aNbCellsPerPoint = aCellsSize / aNbCells - 1;
151   vtkFloatingPointType aMeshSize = aPointsSize + aConnectivitySize + aTypesSize + aLocationsSize;
152
153   vtkFloatingPointType anAssignedDataSize = aCellsSize*4.0*sizeof(vtkFloatingPointType);
154   vtkFloatingPointType anOutputDataSetSize = aMeshSize + anAssignedDataSize;
155
156   size_t aResult = size_t(aStreamArraySize*aNbCells + anOutputDataSetSize);
157   return aResult;
158 }
159
160
161 //----------------------------------------------------------------------------
162 size_t
163 VISU_StreamLinesPL
164 ::FindPossibleParams(vtkDataSet* theDataSet, 
165                      vtkFloatingPointType& theStepLength,
166                      vtkFloatingPointType& thePropogationTime, 
167                      vtkFloatingPointType& thePercents)
168 {
169   static vtkFloatingPointType aPercentsDecrease = 3.0, aStepLengthIncrease = 9.0;
170   vtkIdType aNbOfPoints = theDataSet->GetNumberOfPoints();
171   size_t aSize = GetNecasseryMemorySize(aNbOfPoints,theStepLength,thePropogationTime,thePercents);
172   size_t anIsPossible = CheckAvailableMemory(aSize);
173   if(!anIsPossible){
174     vtkFloatingPointType aMaxStepLength = std::max(GetMaxStepLength(theDataSet),thePropogationTime);
175     vtkFloatingPointType aMinStepLength = GetMinStepLength(theDataSet);
176     vtkFloatingPointType aDeltaStepLength = (aMaxStepLength - aMinStepLength)/aStepLengthIncrease;
177     for(int i = 2, aStepChanged = 1, aPerecentsChanged = 1; aStepChanged || aPerecentsChanged; i++){
178       vtkFloatingPointType aStepLength = theStepLength + aDeltaStepLength;
179       if(aStepLength < aMaxStepLength) theStepLength = aStepLength;
180       else if(aStepChanged){
181         aStepLength = aMaxStepLength;
182         aStepChanged = 0;
183       }
184       vtkFloatingPointType aPercents = thePercents /= aPercentsDecrease;
185       if(aPercents*aNbOfPoints > 1) thePercents = aPercents;
186       else if(aPerecentsChanged) {
187         thePercents = 1.1 / aNbOfPoints;
188         aPerecentsChanged = 0;
189       }
190       aSize = GetNecasseryMemorySize(aNbOfPoints,theStepLength,thePropogationTime,thePercents);
191       if(CheckAvailableMemory(aSize)){
192         anIsPossible = i;
193         break;
194       }
195     }
196   }
197   if(MYDEBUG) MESSAGE("FindPossibleParams - aSize = "<<aSize<<"; anIsPossible = "<<anIsPossible);
198   return anIsPossible;
199 }
200
201
202 //----------------------------------------------------------------------------
203 size_t
204 VISU_StreamLinesPL
205 ::SetParams(vtkFloatingPointType theIntStep,
206             vtkFloatingPointType thePropogationTime,
207             vtkFloatingPointType theStepLength,
208             vtkPointSet* theSource,
209             vtkFloatingPointType thePercents,
210             int theDirection)
211 {
212   vtkPointSet* aDataSet = theSource? theSource: GetMergedInput();
213   aDataSet->Update();
214
215   vtkIdType aNbOfPoints = aDataSet->GetNumberOfPoints();
216   vtkDataSet* aPointSet = GetExtractorFilter()->GetOutput();
217   if (thePercents * aNbOfPoints < 1)
218     thePercents = 2.0 / aNbOfPoints;
219
220   theIntStep = CorrectIntegrationStep(theIntStep,
221                                       aPointSet,
222                                       thePercents);
223
224   thePropogationTime = CorrectPropagationTime(thePropogationTime,
225                                               aPointSet);
226
227   theStepLength = CorrectStepLength(theStepLength,
228                                     aPointSet);
229
230   size_t anIsAccepted = FindPossibleParams(aPointSet,
231                                            theStepLength,
232                                            thePropogationTime,
233                                            thePercents);
234
235   if (anIsAccepted) {
236     mySource = theSource;
237     myPercents = thePercents;
238     if(VISU::IsDataOnCells(GetMergedInput())){
239       myCenters->SetInput(aDataSet);
240       myCenters->VertexCellsOn();
241       aDataSet = myCenters->GetOutput();
242     }
243     myPointsFilter->SetInput(aDataSet);
244     myPointsFilter->SetPercentsOfUsedPoints(thePercents);
245     aDataSet = myPointsFilter->GetOutput();
246     myStream->SetSource(aDataSet);
247     myStream->SetIntegrationStepLength(theIntStep);
248     myStream->SetMaximumPropagationTime(thePropogationTime);
249     myStream->SetStepLength(theStepLength);
250     myStream->SetSavePointInterval(theIntStep*aMinNbOfSteps);
251     myStream->SetIntegrationDirection(theDirection);
252     myStream->Modified();
253     Modified();
254   }
255   return anIsAccepted;
256 }
257
258
259 //----------------------------------------------------------------------------
260 vtkPointSet* 
261 VISU_StreamLinesPL
262 ::GetSource() 
263 {
264   return mySource;
265 }
266
267
268 //----------------------------------------------------------------------------
269 vtkFloatingPointType
270 VISU_StreamLinesPL
271 ::GetUsedPoints() 
272 {
273   return myPercents;
274 }
275
276
277 //----------------------------------------------------------------------------
278 vtkDataSet* 
279 VISU_StreamLinesPL
280 ::GetStreamerSource()
281 {
282   return myStream->GetSource();
283 }
284
285
286 //----------------------------------------------------------------------------
287 vtkFloatingPointType 
288 VISU_StreamLinesPL
289 ::GetVelocityCoeff()
290 {
291   return GetVelocityCoeff(GetExtractorFilter()->GetOutput());
292 }
293
294
295 //----------------------------------------------------------------------------
296 vtkFloatingPointType 
297 VISU_StreamLinesPL
298 ::GetVelocityCoeff(vtkDataSet* theDataSet)
299 {
300   vtkFloatingPointType* aScalarRange = theDataSet->GetScalarRange();
301   vtkFloatingPointType aVelocity = (fabs(aScalarRange[1]) + fabs(aScalarRange[0]))/2.0;
302   if (aVelocity < EPS)
303     return EPS;
304
305   return aVelocity;
306 }
307
308
309 //----------------------------------------------------------------------------
310 size_t
311 VISU_StreamLinesPL
312 ::IsPossible(vtkPointSet* theDataSet, 
313              vtkFloatingPointType thePercents)
314 {
315   vtkFloatingPointType aStepLength = GetBaseStepLength(theDataSet);
316   vtkFloatingPointType aBasePropTime = GetBasePropagationTime(theDataSet);
317   VISU_MaskPointsFilter *aPointsFilter = VISU_MaskPointsFilter::New();
318   aPointsFilter->SetInput(theDataSet);
319   vtkDataSet* aDataSet = aPointsFilter->GetOutput();
320   aDataSet->Update();
321   size_t aRes = FindPossibleParams(aDataSet,
322                                    aStepLength,
323                                    aBasePropTime,
324                                    thePercents);
325   aPointsFilter->Delete();
326   return aRes;
327 }
328
329
330 //----------------------------------------------------------------------------
331 vtkFloatingPointType
332 VISU_StreamLinesPL
333 ::GetIntegrationStep()
334 {
335   return myStream->GetIntegrationStepLength();
336 }
337
338
339 //----------------------------------------------------------------------------
340 vtkFloatingPointType
341 VISU_StreamLinesPL
342 ::GetStepLength() 
343 {
344   return myStream->GetStepLength();
345 }
346
347
348 //----------------------------------------------------------------------------
349 vtkFloatingPointType
350 VISU_StreamLinesPL
351 ::GetPropagationTime() 
352 {
353   return myStream->GetMaximumPropagationTime();
354 }
355
356
357 //----------------------------------------------------------------------------
358 int
359 VISU_StreamLinesPL
360 ::GetDirection()
361 {
362   return myStream->GetIntegrationDirection();
363 }
364
365
366 //----------------------------------------------------------------------------
367 vtkFloatingPointType
368 VISU_StreamLinesPL
369 ::GetMinIntegrationStep(vtkDataSet* theDataSet, 
370                         vtkFloatingPointType thePercents) 
371 {
372   if(!theDataSet) 
373     return -1.0;
374
375   theDataSet->Update();
376
377   int degree = 0;
378   vtkFloatingPointType aVolume = 1.0;
379   vtkFloatingPointType* aBounds = theDataSet->GetBounds();
380   for(int i = 0, j = 0; i < 3; ++i, j = 2*i){
381     vtkFloatingPointType tmp = aBounds[j+1] - aBounds[j];
382     if (tmp > EPS ) {
383       aVolume *= tmp;
384       degree += 1;
385     }
386   }
387
388   if (degree < 1) 
389     return 0.0; // absolutely empty object
390
391   vtkFloatingPointType anStepLength = GetMaxIntegrationStep(theDataSet)/aCoeffOfIntStep;
392   vtkFloatingPointType aBasePropTime = GetBasePropagationTime(theDataSet)/GetVelocityCoeff(theDataSet);
393   thePercents = 1.0;
394   vtkIdType aNbOfPoints = theDataSet->GetNumberOfPoints();
395   size_t aSize = GetNecasseryMemorySize(aNbOfPoints,anStepLength,aBasePropTime,thePercents);
396   size_t aRealSize = GetAvailableMemory(aSize);
397   vtkFloatingPointType anAverageVolume = aVolume / aRealSize;
398   vtkFloatingPointType aStep = pow(double(anAverageVolume), double(1.0/double(degree)));
399   return aStep;
400 }
401
402
403 //----------------------------------------------------------------------------
404 vtkFloatingPointType
405 VISU_StreamLinesPL
406 ::GetMinIntegrationStep()
407 {
408   return GetMinIntegrationStep(GetExtractorFilter()->GetOutput(), GetUsedPoints());
409 }
410
411
412 //----------------------------------------------------------------------------
413 vtkFloatingPointType
414 VISU_StreamLinesPL
415 ::GetMaxIntegrationStep(vtkDataSet* theDataSet) 
416 {
417   if(!theDataSet) 
418     return -1.0;
419
420   theDataSet->Update();
421
422   vtkFloatingPointType aLength = theDataSet->GetLength();
423   vtkFloatingPointType* aBounds = theDataSet->GetBounds();
424   vtkFloatingPointType aMaxSizeY = (aBounds[3]-aBounds[2])/aLength;
425   vtkFloatingPointType aMaxSizeZ = (aBounds[5]-aBounds[4])/aLength;
426   vtkFloatingPointType aMinMax = (aBounds[1] - aBounds[0])/aLength;
427   if (aMinMax < EPS || (aMaxSizeY < aMinMax && aMaxSizeY > EPS)) 
428     aMinMax = aMaxSizeY;
429   if (aMinMax < EPS || (aMaxSizeZ < aMinMax && aMaxSizeZ > EPS)) 
430     aMinMax = aMaxSizeZ;
431   return aMinMax*aLength/2.0;
432 }
433
434
435 //----------------------------------------------------------------------------
436 vtkFloatingPointType
437 VISU_StreamLinesPL
438 ::GetMaxIntegrationStep()
439 {
440   return GetMaxIntegrationStep(GetExtractorFilter()->GetOutput());
441 }
442
443
444 //----------------------------------------------------------------------------
445 vtkFloatingPointType
446 VISU_StreamLinesPL
447 ::GetBaseIntegrationStep(vtkDataSet* theDataSet, 
448                          vtkFloatingPointType thePercents)
449 {
450   theDataSet->Update();
451
452   vtkFloatingPointType aMaxIntegrationStep = GetMaxIntegrationStep(theDataSet);
453   vtkFloatingPointType anIntegrationStep = aMaxIntegrationStep / aCoeffOfIntStep;
454   vtkFloatingPointType aMinMax = theDataSet->GetLength() / theDataSet->GetNumberOfPoints();
455   if(aMinMax > anIntegrationStep)
456     anIntegrationStep = (anIntegrationStep*aCoeffOfIntStep*0.9+aMinMax)/aCoeffOfIntStep;
457
458   vtkFloatingPointType aMinIntegrationStep = GetMinIntegrationStep(theDataSet, thePercents);
459   if(aMinIntegrationStep > anIntegrationStep)
460     anIntegrationStep = aMinIntegrationStep;
461
462   return anIntegrationStep;
463 }
464
465
466 //----------------------------------------------------------------------------
467 vtkFloatingPointType
468 VISU_StreamLinesPL
469 ::CorrectIntegrationStep(vtkFloatingPointType theStep, 
470                          vtkDataSet* theDataSet, 
471                          vtkFloatingPointType thePercents)
472 {
473   theDataSet->Update();
474
475   vtkFloatingPointType aMinIntegrationStep = GetMinIntegrationStep(theDataSet, thePercents);
476   if(aMinIntegrationStep > theStep)
477     theStep = aMinIntegrationStep;
478
479   vtkFloatingPointType aMaxIntegrationStep = GetMaxIntegrationStep(theDataSet);
480   if(aMaxIntegrationStep < theStep)
481     theStep = aMaxIntegrationStep;
482
483   return theStep;
484 }
485
486
487 //----------------------------------------------------------------------------
488 vtkFloatingPointType
489 VISU_StreamLinesPL
490 ::GetMinPropagationTime(vtkDataSet* theDataSet)
491 {
492   if(!theDataSet) 
493     return -1.0;
494
495   return GetMinStepLength(theDataSet);
496 }
497
498
499 //----------------------------------------------------------------------------
500 vtkFloatingPointType
501 VISU_StreamLinesPL
502 ::GetMinPropagationTime()
503 {
504   return GetMinPropagationTime(GetExtractorFilter()->GetOutput());
505 }
506
507
508 //----------------------------------------------------------------------------
509 vtkFloatingPointType
510 VISU_StreamLinesPL
511 ::GetMaxPropagationTime(vtkDataSet* theDataSet)
512 {
513   if(!theDataSet) 
514     return -1.0;
515
516   return GetBasePropagationTime(theDataSet)*aMinNbOfSteps;
517 }
518
519
520 //----------------------------------------------------------------------------
521 vtkFloatingPointType
522 VISU_StreamLinesPL
523 ::GetMaxPropagationTime()
524 {
525   return GetMaxPropagationTime(GetExtractorFilter()->GetOutput());
526 }
527
528
529 //----------------------------------------------------------------------------
530 vtkFloatingPointType
531 VISU_StreamLinesPL
532 ::CorrectPropagationTime(vtkFloatingPointType thePropagationTime, 
533                          vtkDataSet* theDataSet)
534 {
535   vtkFloatingPointType aMinPropagationTime = GetMinPropagationTime(theDataSet);
536   if(aMinPropagationTime > thePropagationTime)
537     thePropagationTime = aMinPropagationTime;
538
539   vtkFloatingPointType aMaxPropagationTime = GetMaxPropagationTime(theDataSet);
540   if(aMaxPropagationTime < thePropagationTime)
541     thePropagationTime = aMaxPropagationTime;
542
543   return thePropagationTime;
544 }
545
546
547 //----------------------------------------------------------------------------
548 vtkFloatingPointType 
549 VISU_StreamLinesPL
550 ::GetBasePropagationTime(vtkDataSet* theDataSet)
551 {
552   if(!theDataSet) 
553     return -1.0;
554
555   theDataSet->Update();
556   vtkFloatingPointType aPropagationTime = theDataSet->GetLength() / GetVelocityCoeff(theDataSet);
557
558   return aPropagationTime;
559 }
560
561
562 //----------------------------------------------------------------------------
563 vtkFloatingPointType 
564 VISU_StreamLinesPL
565 ::GetBasePropagationTime()
566 {
567   return GetBasePropagationTime(GetExtractorFilter()->GetOutput());
568 }
569
570
571 //----------------------------------------------------------------------------
572 vtkFloatingPointType 
573 VISU_StreamLinesPL
574 ::GetMinStepLength(vtkDataSet* theDataSet)
575 {
576   static vtkFloatingPointType aNbOfStepsOfIntStep = 1.0E+1;
577   vtkFloatingPointType anIntStep = GetMinIntegrationStep(theDataSet);
578   vtkFloatingPointType aStepLength = anIntStep * aNbOfStepsOfIntStep / GetVelocityCoeff(theDataSet);
579   return aStepLength;
580 }
581
582
583 //----------------------------------------------------------------------------
584 vtkFloatingPointType
585 VISU_StreamLinesPL
586 ::GetMinStepLength()
587 {
588   return GetMinStepLength(GetExtractorFilter()->GetOutput());
589 }
590
591
592 //----------------------------------------------------------------------------
593 vtkFloatingPointType
594 VISU_StreamLinesPL
595 ::GetMaxStepLength(vtkDataSet* theDataSet)
596 {
597   vtkFloatingPointType aStepLength = GetBasePropagationTime(theDataSet);
598   return aStepLength;
599 }
600
601
602 //----------------------------------------------------------------------------
603 vtkFloatingPointType
604 VISU_StreamLinesPL
605 ::GetMaxStepLength()
606 {
607   return GetMaxStepLength(GetExtractorFilter()->GetOutput());
608 }
609
610
611 //----------------------------------------------------------------------------
612 vtkFloatingPointType
613 VISU_StreamLinesPL
614 ::CorrectStepLength(vtkFloatingPointType theStep, 
615                     vtkDataSet* theDataSet)
616 {
617   vtkFloatingPointType aMinStep = GetMinStepLength(theDataSet);
618   if(theStep < aMinStep) 
619     theStep = aMinStep;
620
621   vtkFloatingPointType aMaxStep = GetMaxStepLength(theDataSet);
622   if(theStep > aMaxStep) 
623     theStep = aMaxStep;
624
625   return theStep;
626 }
627
628
629 //----------------------------------------------------------------------------
630 vtkFloatingPointType
631 VISU_StreamLinesPL
632 ::GetBaseStepLength(vtkDataSet* theDataSet)
633 {
634   static vtkFloatingPointType anAvgNbOfSteps = 1.0E+2;
635   vtkFloatingPointType aPropagationTime = GetBasePropagationTime(theDataSet);
636   vtkFloatingPointType aStepLength = aPropagationTime/anAvgNbOfSteps;
637   aStepLength = CorrectStepLength(aStepLength,theDataSet);
638
639   return aStepLength;
640 }
641
642
643 //----------------------------------------------------------------------------
644 void
645 VISU_StreamLinesPL
646 ::Init()
647 {
648   Superclass::Init();
649
650   vtkDataSet* aDataSet = GetExtractorFilter()->GetOutput();
651   vtkFloatingPointType anIntStep = GetBaseIntegrationStep(aDataSet);
652   vtkFloatingPointType aPropagationTime = GetBasePropagationTime(aDataSet);
653   vtkFloatingPointType aStepLength = GetBaseStepLength(aDataSet);
654   SetParams(anIntStep,
655             aPropagationTime,
656             aStepLength);
657 }
658
659
660 //----------------------------------------------------------------------------
661 void
662 VISU_StreamLinesPL
663 ::Build()
664 {
665   Superclass::Build();
666
667   VISU::CellDataToPoint(myStream,
668                         myCellDataToPointData,
669                         GetMergedInput());
670
671   myGeomFilter->SetInput(myStream->GetOutput());
672   myGeomFilter->ExtentClippingOn();
673 }
674
675
676 //----------------------------------------------------------------------------
677 vtkDataSet* 
678 VISU_StreamLinesPL
679 ::InsertCustomPL()
680 {
681   return myGeomFilter->GetOutput();
682 }
683
684
685 //----------------------------------------------------------------------------
686 void
687 VISU_StreamLinesPL
688 ::Update()
689 {
690   try{
691     Superclass::Update();
692
693     vtkFloatingPointType aBounds[6];
694     GetMergedInput()->GetBounds(aBounds);
695     myGeomFilter->SetExtent(aBounds);
696     //{
697     //  std::string aFileName = std::string(getenv("HOME"))+"/"+getenv("USER")+"-myStream.vtk";
698     //  VISU::WriteToFile(myStream->GetOutput(), aFileName);
699     //}
700   }catch(std::exception& exc){
701     MSG(true, "Follow exception was occured :\n"<<exc.what());
702   }catch(...){
703     MSG(MYDEBUG,"Unknown exception was occured\n");
704   }
705 }
706
707
708 //----------------------------------------------------------------------------
709 unsigned long int
710 VISU_StreamLinesPL
711 ::GetMemorySize()
712 {
713   unsigned long int aSize = Superclass::GetMemorySize();
714
715   if(vtkDataSet* aDataSet = myStream->GetOutput())
716     aSize += aDataSet->GetActualMemorySize() * 1024;
717   
718   if(vtkDataSet* aDataSet = myGeomFilter->GetOutput())
719     aSize += aDataSet->GetActualMemorySize() * 1024;
720
721   if(myCellDataToPointData->GetInput())
722     if(vtkDataSet* aDataSet = myCellDataToPointData->GetOutput())
723       aSize += aDataSet->GetActualMemorySize() * 1024;
724
725   return aSize;
726 }
727
728
729 //----------------------------------------------------------------------------
730 void
731 VISU_StreamLinesPL
732 ::SetMapScale(vtkFloatingPointType theMapScale)
733 {
734   Superclass::SetMapScale(theMapScale);
735 }
736
737
738 //----------------------------------------------------------------------------