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