Back to index

salome-paravis  6.5.0
vtkMedGrid.cxx
Go to the documentation of this file.
00001 // Copyright (C) 2010-2012  CEA/DEN, EDF R&D
00002 //
00003 // This library is free software; you can redistribute it and/or
00004 // modify it under the terms of the GNU Lesser General Public
00005 // License as published by the Free Software Foundation; either
00006 // version 2.1 of the License.
00007 //
00008 // This library is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 // Lesser General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU Lesser General Public
00014 // License along with this library; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00016 //
00017 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00018 //
00019 
00020 #include "vtkMedGrid.h"
00021 
00022 #include "vtkObjectFactory.h"
00023 
00024 #include "vtkMedUtilities.h"
00025 #include "vtkMedMesh.h"
00026 #include "vtkMedIntArray.h"
00027 #include "vtkMedFamilyOnEntity.h"
00028 #include "vtkMedFamily.h"
00029 #include "vtkMedEntityArray.h"
00030 #include "vtkMedFile.h"
00031 #include "vtkMedDriver.h"
00032 
00033 #include <set>
00034 using std::set;
00035 
00036 vtkCxxGetObjectVectorMacro(vtkMedGrid, EntityArray, vtkMedEntityArray);
00037 vtkCxxSetObjectVectorMacro(vtkMedGrid, EntityArray, vtkMedEntityArray);
00038 
00039 vtkCxxSetObjectMacro(vtkMedGrid, PointGlobalIds, vtkMedIntArray);
00040 vtkCxxSetObjectMacro(vtkMedGrid, ParentMesh, vtkMedMesh);
00041 vtkCxxSetObjectMacro(vtkMedGrid, PreviousGrid, vtkMedGrid);
00042 
00043 vtkCxxRevisionMacro(vtkMedGrid, "$Revision: 1.1.4.8.2.1 $")
00044 
00045 vtkMedGrid::vtkMedGrid()
00046 {
00047   this->ParentMesh = NULL;
00048   this->PointGlobalIds = NULL;
00049   this->PreviousGrid = NULL;
00050 
00051   this->CoordinateSystem = MED_CARTESIAN;
00052   this->EntityArray = new vtkObjectVector<vtkMedEntityArray>();
00053   this->UsePreviousCoordinates = false;
00054 }
00055 
00056 vtkMedGrid::~vtkMedGrid()
00057 {
00058   this->SetPointGlobalIds(NULL);
00059   this->SetParentMesh(NULL);
00060   delete this->EntityArray;
00061 }
00062 
00063 int vtkMedGrid::IsPointGlobalIdsLoaded()
00064 {
00065   return this->PointGlobalIds != NULL
00066       && this->PointGlobalIds->GetNumberOfTuples()
00067           == this->GetNumberOfPoints();
00068 }
00069 
00070 void  vtkMedGrid::ClearMedSupports()
00071 {
00072   this->SetPointGlobalIds(NULL);
00073 }
00074 
00075 vtkMedEntityArray* vtkMedGrid::GetEntityArray(const vtkMedEntity& entity)
00076 {
00077   for(int id = 0; id < this->EntityArray->size(); id++)
00078     {
00079     vtkMedEntityArray* array = this->EntityArray->at(id);
00080     if(array->GetEntity() == entity)
00081       return array;
00082     }
00083   return NULL;
00084 }
00085 
00086 void  vtkMedGrid::GatherMedEntities(std::set<vtkMedEntity>& entities)
00087 {
00088   for(int id = 0; id < this->EntityArray->size(); id++)
00089     {
00090     vtkMedEntityArray* array = this->EntityArray->at(id);
00091     entities.insert(array->GetEntity());
00092     }
00093 }
00094 
00095 void vtkMedGrid::PrintSelf(ostream& os, vtkIndent indent)
00096 {
00097   this->Superclass::PrintSelf(os, indent);
00098 }