1 /*=========================================================================
4 Module: $RCSfile: vtkPVFoamServerSelectTimeSet.cxx,v $
6 Copyright (c) Kitware, Inc.
8 See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
14 =========================================================================*/
15 #include "vtkPVFoamServerSelectTimeSet.h"
17 #include "vtkClientServerInterpreter.h"
18 #include "vtkObjectFactory.h"
19 #include "vtkPVProcessModule.h"
20 #include "vtkFoamReader.h"
21 #include "vtkDataArrayCollection.h"
22 #include "vtkDataArrayCollectionIterator.h"
23 #include "vtkClientServerStream.h"
25 #include <vtkstd/string>
27 //----------------------------------------------------------------------------
28 vtkStandardNewMacro(vtkPVFoamServerSelectTimeSet
);
29 vtkCxxRevisionMacro(vtkPVFoamServerSelectTimeSet
, "$Revision: 1.4 $");
31 //----------------------------------------------------------------------------
32 class vtkPVFoamServerSelectTimeSetInternals
35 vtkClientServerStream Result
;
38 //----------------------------------------------------------------------------
39 vtkPVFoamServerSelectTimeSet::vtkPVFoamServerSelectTimeSet()
41 this->Internal
= new vtkPVFoamServerSelectTimeSetInternals
;
44 //----------------------------------------------------------------------------
45 vtkPVFoamServerSelectTimeSet::~vtkPVFoamServerSelectTimeSet()
47 delete this->Internal
;
50 //----------------------------------------------------------------------------
51 void vtkPVFoamServerSelectTimeSet::PrintSelf(ostream
& os
, vtkIndent indent
)
53 this->Superclass::PrintSelf(os
,indent
);
56 //----------------------------------------------------------------------------
57 const vtkClientServerStream
&
58 vtkPVFoamServerSelectTimeSet::GetTimeSets(vtkFoamReader
* reader
)
60 // Reset the stream for a new list of time sets.
61 this->Internal
->Result
.Reset();
63 // Get the time sets from the reader.
64 vtkDataArrayCollection
* timeSets
= reader
->GetTimeSets();
66 // Iterate through the time sets.
67 vtkDataArrayCollectionIterator
* iter
= vtkDataArrayCollectionIterator::New();
68 iter
->SetCollection(timeSets
);
69 for(iter
->GoToFirstItem(); !iter
->IsDoneWithTraversal();
72 // Each time set is stored in one message.
73 this->Internal
->Result
<< vtkClientServerStream::Reply
;
74 vtkDataArray
* da
= iter
->GetDataArray();
75 for(int i
=0; i
< da
->GetNumberOfTuples(); ++i
)
77 this->Internal
->Result
<< da
->GetTuple1(i
);
79 this->Internal
->Result
<< vtkClientServerStream::End
;
84 return this->Internal
->Result
;