Salome HOME
Merge from BR_PORTING_VTK6 01/03/2013
[modules/paravis.git] / src / Plugins / MedReader / IO / vtkMedFieldOnProfile.cxx
1 // Copyright (C) 2010-2011  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 "vtkMedFieldOnProfile.h"
21
22 #include "vtkObjectFactory.h"
23 #include "vtkDataArray.h"
24
25 #include "vtkMedFieldOverEntity.h"
26 #include "vtkMedFieldStep.h"
27 #include "vtkMedField.h"
28 #include "vtkMedFile.h"
29 #include "vtkMedDriver.h"
30 #include "vtkMedProfile.h"
31
32 vtkCxxSetObjectMacro(vtkMedFieldOnProfile, Data, vtkDataArray);
33 vtkCxxSetObjectMacro(vtkMedFieldOnProfile, Profile, vtkMedProfile);
34 vtkCxxSetObjectMacro(vtkMedFieldOnProfile, ParentFieldOverEntity, vtkMedFieldOverEntity);
35
36 // vtkCxxRevisionMacro(vtkMedFieldOnProfile, "$Revision$")
37 vtkStandardNewMacro(vtkMedFieldOnProfile)
38
39 vtkMedFieldOnProfile::vtkMedFieldOnProfile()
40 {
41   this->MedIterator = -1;
42   this->ParentFieldOverEntity = NULL;
43   this->ProfileName = NULL;
44   this->ProfileSize = 0;
45   this->LocalizationName = NULL;
46   this->NumberOfIntegrationPoint = 0;
47   this->NumberOfValues = 0;
48   this->Data = NULL;
49   this->Profile = NULL;
50   this->SetProfileName(MED_NO_PROFILE);
51   this->SetLocalizationName(MED_NO_LOCALIZATION);
52 }
53
54 vtkMedFieldOnProfile::~vtkMedFieldOnProfile()
55 {
56   this->SetProfileName(NULL);
57   this->SetLocalizationName(NULL);
58   this->SetParentFieldOverEntity(NULL);
59   this->SetData(NULL);
60 }
61
62 int vtkMedFieldOnProfile::GetHasProfile()
63 {
64   cout << "Profile Name = " << this->ProfileName << endl;
65   return strcmp(this->ProfileName, MED_NO_PROFILE) != 0;
66 }
67
68 int vtkMedFieldOnProfile::IsLoaded()
69 {
70   return this->Data!=NULL
71       && this->Data->GetNumberOfTuples() == this->NumberOfValues;
72 }
73
74 void  vtkMedFieldOnProfile::Load(med_storage_mode mode)
75 {
76   this->ParentFieldOverEntity->GetParentStep()->GetParentField()
77       ->GetParentFile()->GetMedDriver()->LoadField(this, mode);
78 }
79
80 void vtkMedFieldOnProfile::PrintSelf(ostream& os, vtkIndent indent)
81 {
82   this->Superclass::PrintSelf(os, indent);
83
84   PRINT_IVAR(os, indent, MedIterator);
85   PRINT_IVAR(os, indent, ProfileSize);
86   PRINT_IVAR(os, indent, NumberOfIntegrationPoint);
87   PRINT_IVAR(os, indent, NumberOfValues);
88 }