From: Anthony Geay Date: Wed, 15 Mar 2017 08:15:37 +0000 (+0100) Subject: Propagate GAUSS_DATA information key accros the pipeline. X-Git-Tag: SHAPER_2.7.0~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=2e172a452a438dd4498e024188036e6e2c6fc0b1;p=modules%2Fparavis.git Propagate GAUSS_DATA information key accros the pipeline. --- diff --git a/src/Plugins/MEDReader/IO/CMakeLists.txt b/src/Plugins/MEDReader/IO/CMakeLists.txt index e1e5fdae..ba92fa88 100644 --- a/src/Plugins/MEDReader/IO/CMakeLists.txt +++ b/src/Plugins/MEDReader/IO/CMakeLists.txt @@ -39,7 +39,7 @@ FOREACH(class ${MEDReader_CLASSES}) SET(MEDReader_HDRS ${MEDReader_HDRS} ${class}.h) ENDFOREACH(class) -SET(MEDReader_HDRS ${MEDReader_HDRS} MEDFileFieldRepresentationTree.hxx MEDTimeReq.hxx MEDUtilities.hxx MEDLoaderForPV.h) +SET(MEDReader_HDRS ${MEDReader_HDRS} MEDFileFieldRepresentationTree.hxx MEDTimeReq.hxx MEDUtilities.hxx MEDLoaderForPV.h vtkInformationGaussDoubleVectorKey.h) ADD_LIBRARY(MEDLoaderForPV SHARED MEDFileFieldRepresentationTree.cxx MEDTimeReq.cxx MEDUtilities.cxx vtkGenerateVectors.cxx) diff --git a/src/Plugins/MEDReader/IO/vtkInformationGaussDoubleVectorKey.h b/src/Plugins/MEDReader/IO/vtkInformationGaussDoubleVectorKey.h new file mode 100644 index 00000000..9a40f794 --- /dev/null +++ b/src/Plugins/MEDReader/IO/vtkInformationGaussDoubleVectorKey.h @@ -0,0 +1,61 @@ +// 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 +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#ifndef __vtkInformationGaussDoubleVectorKey_h_ +#define __vtkInformationGaussDoubleVectorKey_h_ + +#include "vtkInformationDoubleVectorKey.h" + +class VTK_EXPORT vtkInformationGaussDoubleVectorKey : public vtkInformationDoubleVectorKey +{ +public: + vtkTypeMacro(vtkInformationGaussDoubleVectorKey, vtkInformationDoubleVectorKey); + void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE{} + + vtkInformationGaussDoubleVectorKey(const char* name, const char* location, + int length = -1) : vtkInformationDoubleVectorKey(name, location, length) { } + + /** + * This method simply returns a new vtkInformationDoubleVectorKey, given a + * name, a location and a required length. This method is provided for + * wrappers. Use the constructor directly from C++ instead. + */ + static vtkInformationGaussDoubleVectorKey* MakeKey(const char* name, const char* location, + int length = -1) + { + return new vtkInformationGaussDoubleVectorKey(name, location, length); + } + + /** + * Simply shallow copies the key from fromInfo to toInfo. + * This is used by the pipeline to propagate this key downstream. + */ + void CopyDefaultInformation(vtkInformation* request, + vtkInformation* fromInfo, + vtkInformation* toInfo) VTK_OVERRIDE + { + this->ShallowCopy(fromInfo, toInfo); + } + +private: + vtkInformationGaussDoubleVectorKey(const vtkInformationGaussDoubleVectorKey&) VTK_DELETE_FUNCTION; + void operator=(const vtkInformationGaussDoubleVectorKey&) VTK_DELETE_FUNCTION; +}; + +#endif diff --git a/src/Plugins/MEDReader/IO/vtkMEDReader.cxx b/src/Plugins/MEDReader/IO/vtkMEDReader.cxx index 65de650b..0ff70c1c 100755 --- a/src/Plugins/MEDReader/IO/vtkMEDReader.cxx +++ b/src/Plugins/MEDReader/IO/vtkMEDReader.cxx @@ -234,16 +234,17 @@ vtkInformationDataObjectMetaDataKey *vtkMEDReader::META_DATA() return ret; } -static vtkInformationDoubleVectorKey *vtkMEDReader_GAUSS_DATA=new vtkInformationDoubleVectorKey("GAUSS_DATA","vtkMEDReader"); +static vtkInformationGaussDoubleVectorKey *vtkMEDReader_GAUSS_DATA=new vtkInformationGaussDoubleVectorKey("GAUSS_DATA","vtkMEDReader"); -vtkInformationDoubleVectorKey *vtkMEDReader::GAUSS_DATA() +vtkInformationGaussDoubleVectorKey *vtkMEDReader::GAUSS_DATA() { static const char ZE_KEY[]="vtkMEDReader::GAUSS_DATA"; - vtkInformationDoubleVectorKey *ret(vtkMEDReader_GAUSS_DATA); + vtkInformationGaussDoubleVectorKey *ret(vtkMEDReader_GAUSS_DATA); MEDCoupling::GlobalDict *gd(MEDCoupling::GlobalDict::GetInstance()); if(!gd->hasKey(ZE_KEY)) {// here META_DATA is put on global var to be exchanged with other filters without dependancy of MEDReader. Please do not change ZE_KEY ! - std::ostringstream oss; oss << ret; + vtkInformationDoubleVectorKey *ret2(ret); + std::ostringstream oss; oss << ret2; gd->setKeyValue(ZE_KEY,oss.str()); } return ret; diff --git a/src/Plugins/MEDReader/IO/vtkMEDReader.h b/src/Plugins/MEDReader/IO/vtkMEDReader.h index 9193e147..0fe34add 100644 --- a/src/Plugins/MEDReader/IO/vtkMEDReader.h +++ b/src/Plugins/MEDReader/IO/vtkMEDReader.h @@ -24,6 +24,7 @@ #include #include "vtkMultiBlockDataSetAlgorithm.h" +#include "vtkInformationGaussDoubleVectorKey.h" class vtkDataSet; class vtkMutableDirectedGraph; @@ -71,7 +72,7 @@ class VTK_EXPORT vtkMEDReader : public vtkMultiBlockDataSetAlgorithm // Description // Static information key used to transfer the meta data graph along the pipeline static vtkInformationDataObjectMetaDataKey* META_DATA(); - static vtkInformationDoubleVectorKey* GAUSS_DATA(); + static vtkInformationGaussDoubleVectorKey* GAUSS_DATA(); protected: vtkMEDReader();