Back to index

salome-paravis  6.5.0
vtkMedFamilyOnEntity.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 "vtkMedFamilyOnEntity.h"
00021 
00022 #include "vtkObjectFactory.h"
00023 #include "vtkMedUtilities.h"
00024 #include "vtkMedFamily.h"
00025 #include "vtkMedEntityArray.h"
00026 #include "vtkMedMesh.h"
00027 #include "vtkMedGrid.h"
00028 #include "vtkMedFamilyOnEntityOnProfile.h"
00029 
00030 vtkCxxSetObjectMacro(vtkMedFamilyOnEntity, Family, vtkMedFamily);
00031 vtkCxxSetObjectMacro(vtkMedFamilyOnEntity, EntityArray, vtkMedEntityArray);
00032 
00033 vtkCxxSetObjectMacro(vtkMedFamilyOnEntity, ParentGrid,vtkMedGrid);
00034 
00035 vtkCxxRevisionMacro(vtkMedFamilyOnEntity, "$Revision: 1.1.4.5.2.1 $");
00036 vtkStandardNewMacro(vtkMedFamilyOnEntity)
00037 
00038 vtkMedFamilyOnEntity::vtkMedFamilyOnEntity()
00039 {
00040   this->Family = NULL;
00041   this->EntityArray = NULL;
00042   this->ParentGrid = NULL;
00043 }
00044 
00045 vtkMedFamilyOnEntity::~vtkMedFamilyOnEntity()
00046 {
00047   this->SetFamily(NULL);
00048   this->SetEntityArray(NULL);
00049   this->SetParentGrid(NULL);
00050 }
00051 
00052 vtkMedEntity vtkMedFamilyOnEntity::GetEntity()
00053 {
00054   if(this->EntityArray != NULL)
00055     {
00056     return this->EntityArray->GetEntity();
00057     }
00058 
00059   return vtkMedEntity(MED_NODE, MED_POINT1);
00060 }
00061 
00062 int vtkMedFamilyOnEntity::GetPointOrCell()
00063 {
00064   if(this->GetEntity().EntityType == MED_NODE)
00065     return vtkMedUtilities::OnPoint;
00066   return vtkMedUtilities::OnCell;
00067 }
00068 
00069 int vtkMedFamilyOnEntity::GetVertexOnly()
00070 {
00071   if(this->GetPointOrCell() == vtkMedUtilities::OnPoint ||
00072      this->EntityArray == NULL)
00073     return true;
00074 
00075   vtkMedEntity entity = this->EntityArray->GetEntity();
00076   if(entity.EntityType == MED_POINT1 || entity.GeometryType == MED_NONE)
00077     return true;
00078 
00079   if(entity.GeometryName == MED_BALL_NAME && entity.EntityType == MED_STRUCT_ELEMENT)
00080     return true;
00081 
00082   if(entity.GeometryName == MED_PARTICLE_NAME && entity.EntityType == MED_STRUCT_ELEMENT)
00083     return true;
00084 
00085   return false;
00086 }
00087 
00088 void  vtkMedFamilyOnEntity::AddFamilyOnEntityOnProfile(
00089     vtkMedFamilyOnEntityOnProfile* foep)
00090 {
00091   this->FamilyOnEntityOnProfile[foep->GetProfile()] = foep;
00092 }
00093 
00094 int vtkMedFamilyOnEntity::GetNumberOfFamilyOnEntityOnProfile()
00095 {
00096   return this->FamilyOnEntityOnProfile.size();
00097 }
00098 
00099 vtkMedFamilyOnEntityOnProfile* vtkMedFamilyOnEntity::
00100     GetFamilyOnEntityOnProfile(vtkMedProfile* profile)
00101 {
00102   if(this->FamilyOnEntityOnProfile.find(profile)
00103     != this->FamilyOnEntityOnProfile.end())
00104     return this->FamilyOnEntityOnProfile[profile];
00105 
00106   return NULL;
00107 }
00108 
00109 vtkMedFamilyOnEntityOnProfile* vtkMedFamilyOnEntity::
00110     GetFamilyOnEntityOnProfile(int index)
00111 {
00112   if(index < 0 || index >= this->FamilyOnEntityOnProfile.size())
00113     return NULL;
00114 
00115   std::map<vtkMedProfile*,
00116   vtkSmartPointer<vtkMedFamilyOnEntityOnProfile> >::iterator it =
00117   this->FamilyOnEntityOnProfile.begin();
00118 
00119   for(int ii=0; ii<index; ii++)
00120     it++;
00121 
00122   return it->second;
00123 }
00124 
00125 void vtkMedFamilyOnEntity::PrintSelf(ostream& os, vtkIndent indent)
00126 {
00127   this->Superclass::PrintSelf(os, indent);
00128   PRINT_OBJECT(os, indent, Family);
00129   PRINT_OBJECT(os, indent, EntityArray);
00130 }