]> SALOME platform Git repositories - modules/paravis.git/blob - src/Plugins/MedReader/IO/vtkMedStructElement.cxx
Salome HOME
Merge from BR_PORTING_VTK6 01/03/2013
[modules/paravis.git] / src / Plugins / MedReader / IO / vtkMedStructElement.cxx
1 #include "vtkMedStructElement.h"
2
3 #include "vtkObjectFactory.h"
4 #include "vtkMedUtilities.h"
5 #include "vtkMedVariableAttribute.h"
6 #include "vtkMedConstantAttribute.h"
7 #include "vtkMedFile.h"
8 #include "vtkMedMesh.h"
9
10 #include <map>
11 #include <string>
12 #include <vector>
13 using namespace std;
14
15 vtkCxxGetObjectVectorMacro(vtkMedStructElement, VariableAttribute, vtkMedVariableAttribute);
16 vtkCxxSetObjectVectorMacro(vtkMedStructElement, VariableAttribute, vtkMedVariableAttribute);
17 vtkCxxGetObjectVectorMacro(vtkMedStructElement, ConstantAttribute, vtkMedConstantAttribute);
18 vtkCxxSetObjectVectorMacro(vtkMedStructElement, ConstantAttribute, vtkMedConstantAttribute);
19
20 vtkCxxSetObjectMacro(vtkMedStructElement, ParentFile, vtkMedFile);
21 vtkCxxSetObjectMacro(vtkMedStructElement, SupportMesh, vtkMedMesh);
22
23 // vtkCxxRevisionMacro(vtkMedStructElement, "$Revision$")
24 vtkStandardNewMacro(vtkMedStructElement)
25
26 vtkMedStructElement::vtkMedStructElement()
27 {
28   this->MedIterator = -1;
29   this->Name = NULL;
30   this->GeometryType = MED_UNDEF_GEOTYPE;
31   this->ModelDimension = 0;
32   this->SupportMeshName = NULL;
33   this->SupportMesh = NULL;
34   this->SupportEntityType = MED_UNDEF_ENTITY_TYPE;
35   this->SupportNumberOfNode = 0;
36   this->SupportNumberOfCell = 0;
37   this->SupportGeometryType = MED_UNDEF_GEOTYPE;
38   this->AnyProfile = MED_FALSE;
39   this->VariableAttribute = new vtkObjectVector<vtkMedVariableAttribute>();
40   this->ConstantAttribute = new vtkObjectVector<vtkMedConstantAttribute>();
41   this->ParentFile = NULL;
42 }
43
44 vtkMedStructElement::~vtkMedStructElement()
45 {
46   this->SetName(NULL);
47   this->SetSupportMeshName(NULL);
48   this->SetParentFile(NULL);
49   this->SetSupportMesh(NULL);
50   delete this->VariableAttribute;
51   delete this->ConstantAttribute;
52 }
53
54 void  vtkMedStructElement::LoadVariableAttributes(vtkMedEntityArray* array)
55 {
56   for(int varattit = 0; varattit < this->GetNumberOfVariableAttribute(); varattit++)
57     {
58     vtkMedVariableAttribute* varatt = this->GetVariableAttribute(varattit);
59     varatt->Load(array);
60     }
61 }
62
63 int vtkMedStructElement::GetConnectivitySize()
64 {
65   if(strcmp(this->Name, MED_PARTICLE_NAME) == 0
66      || this->SupportEntityType != MED_CELL)
67     return this->SupportNumberOfNode;
68
69   return this->SupportNumberOfCell *
70       vtkMedUtilities::GetNumberOfPoint(this->SupportGeometryType);
71 }
72
73 void vtkMedStructElement::PrintSelf(ostream& os, vtkIndent indent)
74 {
75   this->Superclass::PrintSelf(os, indent);
76 }