Salome HOME
CMake: replacing CMAKE_* variables by PROJECT_* variabls
[modules/paravis.git] / src / Plugins / MedReader / IO / vtkMedStructElement.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 "vtkMedStructElement.h"
21
22 #include "vtkObjectFactory.h"
23 #include "vtkMedUtilities.h"
24 #include "vtkMedVariableAttribute.h"
25 #include "vtkMedConstantAttribute.h"
26 #include "vtkMedFile.h"
27 #include "vtkMedMesh.h"
28
29 #include <map>
30 #include <string>
31 #include <vector>
32 using namespace std;
33
34 vtkCxxGetObjectVectorMacro(vtkMedStructElement, VariableAttribute, vtkMedVariableAttribute);
35 vtkCxxSetObjectVectorMacro(vtkMedStructElement, VariableAttribute, vtkMedVariableAttribute);
36 vtkCxxGetObjectVectorMacro(vtkMedStructElement, ConstantAttribute, vtkMedConstantAttribute);
37 vtkCxxSetObjectVectorMacro(vtkMedStructElement, ConstantAttribute, vtkMedConstantAttribute);
38
39 vtkCxxSetObjectMacro(vtkMedStructElement, ParentFile, vtkMedFile);
40 vtkCxxSetObjectMacro(vtkMedStructElement, SupportMesh, vtkMedMesh);
41
42 // vtkCxxRevisionMacro(vtkMedStructElement, "$Revision$")
43 vtkStandardNewMacro(vtkMedStructElement)
44
45 vtkMedStructElement::vtkMedStructElement()
46 {
47   this->MedIterator = -1;
48   this->Name = NULL;
49   this->GeometryType = MED_UNDEF_GEOTYPE;
50   this->ModelDimension = 0;
51   this->SupportMeshName = NULL;
52   this->SupportMesh = NULL;
53   this->SupportEntityType = MED_UNDEF_ENTITY_TYPE;
54   this->SupportNumberOfNode = 0;
55   this->SupportNumberOfCell = 0;
56   this->SupportGeometryType = MED_UNDEF_GEOTYPE;
57   this->AnyProfile = MED_FALSE;
58   this->VariableAttribute = new vtkObjectVector<vtkMedVariableAttribute>();
59   this->ConstantAttribute = new vtkObjectVector<vtkMedConstantAttribute>();
60   this->ParentFile = NULL;
61 }
62
63 vtkMedStructElement::~vtkMedStructElement()
64 {
65   this->SetName(NULL);
66   this->SetSupportMeshName(NULL);
67   this->SetParentFile(NULL);
68   this->SetSupportMesh(NULL);
69   delete this->VariableAttribute;
70   delete this->ConstantAttribute;
71 }
72
73 void  vtkMedStructElement::LoadVariableAttributes(vtkMedEntityArray* array)
74 {
75   for(int varattit = 0; varattit < this->GetNumberOfVariableAttribute(); varattit++)
76     {
77     vtkMedVariableAttribute* varatt = this->GetVariableAttribute(varattit);
78     varatt->Load(array);
79     }
80 }
81
82 int vtkMedStructElement::GetConnectivitySize()
83 {
84   if(strcmp(this->Name, MED_PARTICLE_NAME) == 0
85      || this->SupportEntityType != MED_CELL)
86     return this->SupportNumberOfNode;
87
88   return this->SupportNumberOfCell *
89       vtkMedUtilities::GetNumberOfPoint(this->SupportGeometryType);
90 }
91
92 void vtkMedStructElement::PrintSelf(ostream& os, vtkIndent indent)
93 {
94   this->Superclass::PrintSelf(os, indent);
95 }