X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FPlugins%2FMEDReader%2FIO%2FvtkExtractCellType.cxx;h=d79200a2d68ce97ede5811bcaa7959377198521b;hb=4ab5dda497ba014354de12bc85562e314c73c62c;hp=cb2c713b2cce0f415e45cd6e070861ee656b43dc;hpb=f97aa0a72a48a5411faa8d0defd3cf4b54f4c305;p=modules%2Fparavis.git diff --git a/src/Plugins/MEDReader/IO/vtkExtractCellType.cxx b/src/Plugins/MEDReader/IO/vtkExtractCellType.cxx index cb2c713b..d79200a2 100644 --- a/src/Plugins/MEDReader/IO/vtkExtractCellType.cxx +++ b/src/Plugins/MEDReader/IO/vtkExtractCellType.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2010-2014 CEA/DEN, EDF R&D +// Copyright (C) 2010-2016 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -23,6 +23,7 @@ #include "MEDFileFieldOverView.hxx" #include "vtkAdjacentVertexIterator.h" +#include "vtkDataArrayTemplate.h" #include "vtkIntArray.h" #include "vtkCellData.h" #include "vtkPointData.h" @@ -210,14 +211,29 @@ const ExtractCellTypeStatus& vtkExtractCellType::vtkExtractCellTypeInternal::get bool vtkExtractCellType::vtkExtractCellTypeInternal::getStatusOfEntryStr(const char *entry) const { - const ExtractCellTypeStatus& elt(getEntry(entry)); - return elt.getStatus(); + try + { + const ExtractCellTypeStatus& elt(getEntry(entry)); + return elt.getStatus(); + } + catch (INTERP_KERNEL::Exception e) + { + //std::cerr << vtkDebugMacro"Exception has been thrown in vtkExtractCellType::vtkExtractCellTypeInternal::getStatusOfEntryStr : " << e.what() << std::endl; + return false; + } } void vtkExtractCellType::vtkExtractCellTypeInternal::setStatusOfEntryStr(const char *entry, bool status) const { - const ExtractCellTypeStatus& elt(getEntry(entry)); - elt.setStatus(status); + try + { + const ExtractCellTypeStatus& elt(getEntry(entry)); + elt.setStatus(status); + } + catch (INTERP_KERNEL::Exception e) + { + //std::cerr << "Exception has been thrown in vtkExtractCellType::vtkExtractCellTypeInternal::setStatusOfEntryStr : " << e.what() << std::endl; + } } void vtkExtractCellType::vtkExtractCellTypeInternal::printMySelf(std::ostream& os) const @@ -264,6 +280,8 @@ vtkExtractCellType::vtkExtractCellType():SIL(NULL),Internal(new vtkExtractCellTy vtkExtractCellType::~vtkExtractCellType() { + if(this->SIL) + this->SIL->Delete(); delete this->Internal; } @@ -323,13 +341,13 @@ int vtkExtractCellType::RequestInformation(vtkInformation *request, vtkInformati const std::map::const_iterator it(m.find(vtkCt)); if(it==m.end()) { - const unsigned char *pos(std::find(ParaMEDMEM::MEDMeshMultiLev::PARAMEDMEM_2_VTKTYPE,ParaMEDMEM::MEDMeshMultiLev::PARAMEDMEM_2_VTKTYPE+ParaMEDMEM::MEDMeshMultiLev::PARAMEDMEM_2_VTKTYPE_LGTH,vtkCt)); - if(pos==ParaMEDMEM::MEDMeshMultiLev::PARAMEDMEM_2_VTKTYPE+ParaMEDMEM::MEDMeshMultiLev::PARAMEDMEM_2_VTKTYPE_LGTH) + const unsigned char *pos(std::find(MEDCoupling::MEDMeshMultiLev::PARAMEDMEM_2_VTKTYPE,MEDCoupling::MEDMeshMultiLev::PARAMEDMEM_2_VTKTYPE+MEDCoupling::MEDMeshMultiLev::PARAMEDMEM_2_VTKTYPE_LGTH,vtkCt)); + if(pos==MEDCoupling::MEDMeshMultiLev::PARAMEDMEM_2_VTKTYPE+MEDCoupling::MEDMeshMultiLev::PARAMEDMEM_2_VTKTYPE_LGTH) { vtkDebugMacro("vtkExtractCellType::RequestInformation : cell #" << cellId << " has unrecognized type !"); return 0; } - m[vtkCt]=(INTERP_KERNEL::NormalizedCellType)std::distance(ParaMEDMEM::MEDMeshMultiLev::PARAMEDMEM_2_VTKTYPE,pos); + m[vtkCt]=(INTERP_KERNEL::NormalizedCellType)std::distance(MEDCoupling::MEDMeshMultiLev::PARAMEDMEM_2_VTKTYPE,pos); } } this->Internal->loadFrom(m); @@ -351,8 +369,8 @@ int vtkExtractCellType::RequestInformation(vtkInformation *request, vtkInformati vtkDataSet *FilterFamilies(vtkDataSet *input, const std::vector& idsToKeep, bool insideOut) { - static const int VTK_DATA_ARRAY_DELETE=vtkDataArrayTemplate::VTK_DATA_ARRAY_DELETE; - static const char ZE_SELECTION_ARR_NAME[]="@@ZeSelection@@"; + const int VTK_DATA_ARRAY_DELETE=vtkDataArrayTemplate::VTK_DATA_ARRAY_DELETE; + const char ZE_SELECTION_ARR_NAME[]="@@ZeSelection@@"; vtkDataSet *output(input->NewInstance()); output->ShallowCopy(input); vtkSmartPointer thres(vtkSmartPointer::New()); @@ -454,6 +472,8 @@ int vtkExtractCellType::GetGeoTypesArrayStatus(const char *name) void vtkExtractCellType::SetGeoTypesStatus(const char *name, int status) { //std::cerr << "vtkExtractCellType::SetGeoTypesStatus(" << name << "," << status << ")" << std::endl; + if (GetNumberOfGeoTypesArrays()<1) + return; this->Internal->setStatusOfEntryStr(name,(bool)status); if(std::string(name)==GetGeoTypesArrayName(GetNumberOfGeoTypesArrays()-1)) {