Back to index

salome-paravis  6.5.0
vtkMedStructElement.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 "vtkMedStructElement.h"
00021 
00022 #include "vtkObjectFactory.h"
00023 #include "vtkMedUtilities.h"
00024 #include "vtkMedVariableAttribute.h"
00025 #include "vtkMedConstantAttribute.h"
00026 #include "vtkMedFile.h"
00027 #include "vtkMedMesh.h"
00028 
00029 #include <map>
00030 #include <string>
00031 #include <vector>
00032 using namespace std;
00033 
00034 vtkCxxGetObjectVectorMacro(vtkMedStructElement, VariableAttribute, vtkMedVariableAttribute);
00035 vtkCxxSetObjectVectorMacro(vtkMedStructElement, VariableAttribute, vtkMedVariableAttribute);
00036 vtkCxxGetObjectVectorMacro(vtkMedStructElement, ConstantAttribute, vtkMedConstantAttribute);
00037 vtkCxxSetObjectVectorMacro(vtkMedStructElement, ConstantAttribute, vtkMedConstantAttribute);
00038 
00039 vtkCxxSetObjectMacro(vtkMedStructElement, ParentFile, vtkMedFile);
00040 vtkCxxSetObjectMacro(vtkMedStructElement, SupportMesh, vtkMedMesh);
00041 
00042 vtkCxxRevisionMacro(vtkMedStructElement, "$Revision: 1.1.2.2.2.1 $")
00043 vtkStandardNewMacro(vtkMedStructElement)
00044 
00045 vtkMedStructElement::vtkMedStructElement()
00046 {
00047   this->MedIterator = -1;
00048   this->Name = NULL;
00049   this->GeometryType = MED_UNDEF_GEOTYPE;
00050   this->ModelDimension = 0;
00051   this->SupportMeshName = NULL;
00052   this->SupportMesh = NULL;
00053   this->SupportEntityType = MED_UNDEF_ENTITY_TYPE;
00054   this->SupportNumberOfNode = 0;
00055   this->SupportNumberOfCell = 0;
00056   this->SupportGeometryType = MED_UNDEF_GEOTYPE;
00057   this->AnyProfile = MED_FALSE;
00058   this->VariableAttribute = new vtkObjectVector<vtkMedVariableAttribute>();
00059   this->ConstantAttribute = new vtkObjectVector<vtkMedConstantAttribute>();
00060   this->ParentFile = NULL;
00061 }
00062 
00063 vtkMedStructElement::~vtkMedStructElement()
00064 {
00065   this->SetName(NULL);
00066   this->SetSupportMeshName(NULL);
00067   this->SetParentFile(NULL);
00068   this->SetSupportMesh(NULL);
00069   delete this->VariableAttribute;
00070   delete this->ConstantAttribute;
00071 }
00072 
00073 void  vtkMedStructElement::LoadVariableAttributes(vtkMedEntityArray* array)
00074 {
00075   for(int varattit = 0; varattit < this->GetNumberOfVariableAttribute(); varattit++)
00076     {
00077     vtkMedVariableAttribute* varatt = this->GetVariableAttribute(varattit);
00078     varatt->Load(array);
00079     }
00080 }
00081 
00082 int vtkMedStructElement::GetConnectivitySize()
00083 {
00084   if(strcmp(this->Name, MED_PARTICLE_NAME) == 0
00085      || this->SupportEntityType != MED_CELL)
00086     return this->SupportNumberOfNode;
00087 
00088   return this->SupportNumberOfCell *
00089       vtkMedUtilities::GetNumberOfPoint(this->SupportGeometryType);
00090 }
00091 
00092 void vtkMedStructElement::PrintSelf(ostream& os, vtkIndent indent)
00093 {
00094   this->Superclass::PrintSelf(os, indent);
00095 }