1 // Copyright (C) 2010-2011 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 "vtkMedFamilyOnEntity.h"
22 #include "vtkObjectFactory.h"
23 #include "vtkMedUtilities.h"
24 #include "vtkMedFamily.h"
25 #include "vtkMedEntityArray.h"
26 #include "vtkMedMesh.h"
27 #include "vtkMedGrid.h"
28 #include "vtkMedFamilyOnEntityOnProfile.h"
30 vtkCxxSetObjectMacro(vtkMedFamilyOnEntity, Family, vtkMedFamily);
31 vtkCxxSetObjectMacro(vtkMedFamilyOnEntity, EntityArray, vtkMedEntityArray);
33 vtkCxxSetObjectMacro(vtkMedFamilyOnEntity, ParentGrid,vtkMedGrid);
35 // vtkCxxRevisionMacro(vtkMedFamilyOnEntity, "$Revision$");
36 vtkStandardNewMacro(vtkMedFamilyOnEntity)
38 vtkMedFamilyOnEntity::vtkMedFamilyOnEntity()
41 this->EntityArray = NULL;
42 this->ParentGrid = NULL;
45 vtkMedFamilyOnEntity::~vtkMedFamilyOnEntity()
47 this->SetFamily(NULL);
48 this->SetEntityArray(NULL);
49 this->SetParentGrid(NULL);
52 vtkMedEntity vtkMedFamilyOnEntity::GetEntity()
54 if(this->EntityArray != NULL)
56 return this->EntityArray->GetEntity();
59 return vtkMedEntity(MED_NODE, MED_POINT1);
62 int vtkMedFamilyOnEntity::GetPointOrCell()
64 if(this->GetEntity().EntityType == MED_NODE)
65 return vtkMedUtilities::OnPoint;
66 return vtkMedUtilities::OnCell;
69 int vtkMedFamilyOnEntity::GetVertexOnly()
71 if(this->GetPointOrCell() == vtkMedUtilities::OnPoint ||
72 this->EntityArray == NULL)
75 vtkMedEntity entity = this->EntityArray->GetEntity();
76 if(entity.EntityType == MED_POINT1 || entity.GeometryType == MED_NONE)
79 if(entity.GeometryName == MED_BALL_NAME && entity.EntityType == MED_STRUCT_ELEMENT)
82 if(entity.GeometryName == MED_PARTICLE_NAME && entity.EntityType == MED_STRUCT_ELEMENT)
88 void vtkMedFamilyOnEntity::AddFamilyOnEntityOnProfile(
89 vtkMedFamilyOnEntityOnProfile* foep)
91 this->FamilyOnEntityOnProfile[foep->GetProfile()] = foep;
94 int vtkMedFamilyOnEntity::GetNumberOfFamilyOnEntityOnProfile()
96 return this->FamilyOnEntityOnProfile.size();
99 vtkMedFamilyOnEntityOnProfile* vtkMedFamilyOnEntity::
100 GetFamilyOnEntityOnProfile(vtkMedProfile* profile)
102 if(this->FamilyOnEntityOnProfile.find(profile)
103 != this->FamilyOnEntityOnProfile.end())
104 return this->FamilyOnEntityOnProfile[profile];
109 vtkMedFamilyOnEntityOnProfile* vtkMedFamilyOnEntity::
110 GetFamilyOnEntityOnProfile(int index)
112 if(index < 0 || index >= this->FamilyOnEntityOnProfile.size())
115 std::map<vtkMedProfile*,
116 vtkSmartPointer<vtkMedFamilyOnEntityOnProfile> >::iterator it =
117 this->FamilyOnEntityOnProfile.begin();
119 for(int ii=0; ii<index; ii++)
125 void vtkMedFamilyOnEntity::PrintSelf(ostream& os, vtkIndent indent)
127 this->Superclass::PrintSelf(os, indent);
128 PRINT_OBJECT(os, indent, Family);
129 PRINT_OBJECT(os, indent, EntityArray);