Salome HOME
Merge from V6_main 01/04/2013
[modules/paravis.git] / src / Plugins / MedReader / IO / vtkMedFieldStep.cxx
1 // Copyright (C) 2010-2013  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #include "vtkMedFieldStep.h"
21
22 #include "vtkObjectFactory.h"
23 #include "vtkSmartPointer.h"
24 #include "vtkMedUtilities.h"
25 #include "vtkMedFieldOverEntity.h"
26 #include "vtkMedField.h"
27 #include "vtkMedFile.h"
28 #include "vtkMedDriver.h"
29
30 vtkCxxGetObjectVectorMacro(vtkMedFieldStep, FieldOverEntity, vtkMedFieldOverEntity);
31 vtkCxxSetObjectVectorMacro(vtkMedFieldStep, FieldOverEntity, vtkMedFieldOverEntity);
32
33 vtkCxxSetObjectMacro(vtkMedFieldStep, ParentField, vtkMedField);
34 vtkCxxSetObjectMacro(vtkMedFieldStep, PreviousStep, vtkMedFieldStep);
35
36 // vtkCxxRevisionMacro(vtkMedFieldStep, "$Revision$")
37 vtkStandardNewMacro(vtkMedFieldStep)
38
39 vtkMedFieldStep::vtkMedFieldStep()
40 {
41   this->FieldOverEntity = new vtkObjectVector<vtkMedFieldOverEntity>();
42   this->PreviousStep = NULL;
43   this->ParentField = NULL;
44   this->MedIterator = -1;
45   this->EntityInfoLoaded = 0;
46 }
47
48 vtkMedFieldStep::~vtkMedFieldStep()
49 {
50   delete this->FieldOverEntity;
51   this->SetPreviousStep(NULL);
52   this->SetParentField(NULL);
53 }
54
55 vtkMedFieldOverEntity* vtkMedFieldStep::GetFieldOverEntity(
56     const vtkMedEntity& entity)
57 {
58   for(int id=0; id < this->GetNumberOfFieldOverEntity(); id++)
59     {
60     vtkMedFieldOverEntity* fieldOverEntity = this->GetFieldOverEntity(id);
61     if(fieldOverEntity->GetEntity() == entity)
62       return fieldOverEntity;
63     }
64   return NULL;
65 }
66
67 void  vtkMedFieldStep::LoadInformation()
68 {
69   this->GetParentField()->GetParentFile()->GetMedDriver()->
70       ReadFieldStepInformation(this, true);
71 }
72
73 void vtkMedFieldStep::PrintSelf(ostream& os, vtkIndent indent)
74 {
75   this->Superclass::PrintSelf(os, indent);
76   PRINT_OBJECT_VECTOR(os, indent, FieldOverEntity);
77 }