Salome HOME
Copyright update 2022
[modules/paravis.git] / src / Plugins / MEDReader / plugin / MEDLoaderForPV / MEDFileFieldRepresentationTree.cxx
index 61edea6cb5270e07fafb308034a2e2a8e995ce07..cea876abb748a10779dd98d4aadf48c0c722b2a8 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2010-2020  CEA/DEN, EDF R&D
+// Copyright (C) 2010-2022  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
@@ -26,7 +26,6 @@
 #include "MEDCouplingFieldDouble.hxx"
 #include "InterpKernelGaussCoords.hxx"
 #include "MEDFileData.hxx"
-#include "SauvReader.hxx"
 #include "MEDCouplingMemArray.txx"
 
 #ifdef MEDREADER_USE_MPI
@@ -43,7 +42,7 @@
 #include "vtkInformationQuadratureSchemeDefinitionVectorKey.h"
 #include "vtkInformationIntegerKey.h"
 #include "vtkInformation.h"
-#include "vtkDataArrayTemplate.h"
+#include "vtkAOSDataArrayTemplate.h"
 #include "vtkIdTypeArray.h"
 #include "vtkDoubleArray.h"
 #include "vtkIntArray.h"
@@ -118,7 +117,7 @@ vtkIdTypeArray *ELGACmp::isExisting(const std::vector<std::string>& locsReallyUs
 template<class T>
 vtkIdTypeArray *ELGACmp::createNew(const MEDCoupling::MEDFileFieldGlobsReal *globs, const std::vector<std::string>& locsReallyUsed, vtkDataArray *vtkd, vtkDataSet *ds, ExportedTinyInfo *internalInfo) const
 {
-  const int VTK_DATA_ARRAY_DELETE=vtkDataArrayTemplate<T>::VTK_DATA_ARRAY_DELETE;
+  const int VTK_DATA_ARRAY_DELETE=vtkAOSDataArrayTemplate<T>::VTK_DATA_ARRAY_DELETE;
   std::vector< std::vector<std::string> > locNames(_loc_names);
   std::vector<vtkIdTypeArray *> elgas(_elgas);
   std::vector< std::pair< vtkQuadratureSchemeDefinition *, unsigned char > > defs;
@@ -263,9 +262,9 @@ template<class T>
 void AssignDataPointerToVTK(typename MEDFileVTKTraits<T>::VtkType *vtkTab, typename MEDFileVTKTraits<T>::MCType *mcTab, bool noCpyNumNodes)
 {
   if(noCpyNumNodes)
-    vtkTab->SetArray(mcTab->getPointer(),mcTab->getNbOfElems(),1,vtkDataArrayTemplate<T>::VTK_DATA_ARRAY_FREE);
+    vtkTab->SetArray(mcTab->getPointer(),mcTab->getNbOfElems(),1,vtkAOSDataArrayTemplate<T>::VTK_DATA_ARRAY_FREE);
  else
-   { vtkTab->SetArray(mcTab->getPointer(),mcTab->getNbOfElems(),0,vtkDataArrayTemplate<T>::VTK_DATA_ARRAY_FREE); mcTab->accessToMemArray().setSpecificDeallocator(0); }
+   { vtkTab->SetArray(mcTab->getPointer(),mcTab->getNbOfElems(),0,vtkAOSDataArrayTemplate<T>::VTK_DATA_ARRAY_FREE); mcTab->accessToMemArray().setSpecificDeallocator(0); }
 }
 
 // here copy is always assumed.
@@ -291,7 +290,7 @@ void AssignToFieldData(DataArray *vPtr, const MEDTimeReq *tr, vtkFieldData *att,
                        const std::vector<TypeOfField>& discs, const ELGACmp& elgaCmp, const MEDCoupling::MEDFileFieldGlobsReal *globs,
                        MEDFileAnyTypeField1TS *f1ts, vtkDataSet *ds, ExportedTinyInfo *internalInfo)
 {
-  const int VTK_DATA_ARRAY_DELETE=vtkDataArrayTemplate<T>::VTK_DATA_ARRAY_DELETE;
+  const int VTK_DATA_ARRAY_DELETE=vtkAOSDataArrayTemplate<T>::VTK_DATA_ARRAY_DELETE;
   typename MEDFileVTKTraits<T>::MCType *vi(static_cast<typename MEDFileVTKTraits<T>::MCType *>(vPtr));
   typename MEDFileVTKTraits<T>::VtkType *vtkd(MEDFileVTKTraits<T>::VtkType::New());
   vtkd->SetNumberOfComponents((int)vi->getNumberOfComponents());
@@ -1291,11 +1290,10 @@ void MEDFileFieldRepresentationTree::loadInMemory(MEDCoupling::MEDFileFields *fi
   this->computeFullNameInLeaves();
 }
 
-void MEDFileFieldRepresentationTree::loadMainStructureOfFile(const char *fileName, bool isMEDOrSauv, int iPart, int nbOfParts)
+void MEDFileFieldRepresentationTree::loadMainStructureOfFile(const char *fileName, int iPart, int nbOfParts)
 {
   MCAuto<MEDFileMeshes> ms;
   MCAuto<MEDFileFields> fields;
-  if(isMEDOrSauv)
     {
       if((iPart==-1 && nbOfParts==-1) || (iPart==0 && nbOfParts==1))
         {
@@ -1336,23 +1334,6 @@ void MEDFileFieldRepresentationTree::loadMainStructureOfFile(const char *fileNam
 #endif
         }
     }
-  else
-    {
-      MCAuto<MEDCoupling::SauvReader> sr(MEDCoupling::SauvReader::New(fileName));
-      MCAuto<MEDCoupling::MEDFileData> mfd(sr->loadInMEDFileDS());
-      ms=mfd->getMeshes(); ms->incrRef();
-      int nbMeshes(ms->getNumberOfMeshes());
-      for(int i=0;i<nbMeshes;i++)
-        {
-          MEDCoupling::MEDFileMesh *tmp(ms->getMeshAtPos(i));
-          MEDCoupling::MEDFileUMesh *tmp2(dynamic_cast<MEDCoupling::MEDFileUMesh *>(tmp));
-          if(tmp2)
-            tmp2->forceComputationOfParts();
-        }
-      fields=mfd->getFields();
-      if(fields.isNotNull())
-        fields->incrRef();
-    }
   loadInMemory(fields,ms);
 }