1 // Copyright (C) 2010-2012 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #include "vtkMedGrid.h"
22 #include "vtkObjectFactory.h"
24 #include "vtkMedUtilities.h"
25 #include "vtkMedMesh.h"
26 #include "vtkMedIntArray.h"
27 #include "vtkMedFamilyOnEntity.h"
28 #include "vtkMedFamily.h"
29 #include "vtkMedEntityArray.h"
30 #include "vtkMedFile.h"
31 #include "vtkMedDriver.h"
36 vtkCxxGetObjectVectorMacro(vtkMedGrid, EntityArray, vtkMedEntityArray);
37 vtkCxxSetObjectVectorMacro(vtkMedGrid, EntityArray, vtkMedEntityArray);
39 vtkCxxSetObjectMacro(vtkMedGrid, PointGlobalIds, vtkMedIntArray);
40 vtkCxxSetObjectMacro(vtkMedGrid, ParentMesh, vtkMedMesh);
41 vtkCxxSetObjectMacro(vtkMedGrid, PreviousGrid, vtkMedGrid);
43 vtkCxxRevisionMacro(vtkMedGrid, "$Revision$")
45 vtkMedGrid::vtkMedGrid()
47 this->ParentMesh = NULL;
48 this->PointGlobalIds = NULL;
49 this->PreviousGrid = NULL;
51 this->CoordinateSystem = MED_CARTESIAN;
52 this->EntityArray = new vtkObjectVector<vtkMedEntityArray>();
53 this->UsePreviousCoordinates = false;
56 vtkMedGrid::~vtkMedGrid()
58 this->SetPointGlobalIds(NULL);
59 this->SetParentMesh(NULL);
60 delete this->EntityArray;
63 int vtkMedGrid::IsPointGlobalIdsLoaded()
65 return this->PointGlobalIds != NULL
66 && this->PointGlobalIds->GetNumberOfTuples()
67 == this->GetNumberOfPoints();
70 void vtkMedGrid::ClearMedSupports()
72 this->SetPointGlobalIds(NULL);
75 vtkMedEntityArray* vtkMedGrid::GetEntityArray(const vtkMedEntity& entity)
77 for(int id = 0; id < this->EntityArray->size(); id++)
79 vtkMedEntityArray* array = this->EntityArray->at(id);
80 if(array->GetEntity() == entity)
86 void vtkMedGrid::GatherMedEntities(std::set<vtkMedEntity>& entities)
88 for(int id = 0; id < this->EntityArray->size(); id++)
90 vtkMedEntityArray* array = this->EntityArray->at(id);
91 entities.insert(array->GetEntity());
95 void vtkMedGrid::PrintSelf(ostream& os, vtkIndent indent)
97 this->Superclass::PrintSelf(os, indent);