]> SALOME platform Git repositories - modules/paravis.git/commitdiff
Salome HOME
Merge branch 'origin/agy/feedbackads140304'
authorakl <akl@opencascade.com>
Wed, 26 Mar 2014 06:37:54 +0000 (10:37 +0400)
committerakl <akl@opencascade.com>
Wed, 26 Mar 2014 06:37:54 +0000 (10:37 +0400)
src/Plugins/MEDReader/IO/MEDFileFieldRepresentationTree.cxx
src/Plugins/MEDReader/IO/MEDTimeReq.cxx
src/Plugins/MEDReader/IO/MEDTimeReq.hxx
src/Plugins/MEDReader/IO/vtkExtractGroup.cxx
src/Plugins/MEDReader/IO/vtkExtractGroup.h
src/Plugins/MEDReader/ParaViewPlugin/Resources/MEDReaderServer.xml
src/Plugins/MEDReader/Test/CMakeLists.txt
src/Plugins/MEDReader/Test/testMEDReader0.py
src/Plugins/MEDReader/Test/testMEDReader9.py [new file with mode: 0644]

index 5b5a2893de3ed6da179fc48981921a0e75a997b2..8832df19c7e64f29d86ff4bf2226ed87c7a6f956 100644 (file)
@@ -1252,7 +1252,7 @@ vtkDataSet *MEDFileFieldRepresentationTree::buildVTKInstance(bool isStdOrMode, d
   if(!isStdOrMode)
     tr=new MEDStdTimeReq((int)zeTimeId);
   else
-    tr=new MEDModeTimeReq(tk.getTheVectOfBool());
+    tr=new MEDModeTimeReq(tk.getTheVectOfBool(),tk.getPostProcessedTime());
   vtkDataSet *ret(leaf.buildVTKInstanceNoTimeInterpolation(tr,_fields,_ms));
   delete tr;
   return ret;
index e2b0d939cf63ef5eeb73beaed1612ef85cc1a12c..13fb52076940ccfde1c65ba032b01bf3e18f6109 100644 (file)
@@ -74,7 +74,7 @@ void MEDStdTimeReq::operator++() const
 
 ///////////
 
-MEDModeTimeReq::MEDModeTimeReq(const std::vector<bool>& v):_v(v),_it(0),_sz(0)
+MEDModeTimeReq::MEDModeTimeReq(const std::vector<bool>& v, const std::vector<double>& ts):_v(v),_ts(ts),_it(0),_sz(0)
 {
 }
 
@@ -120,7 +120,9 @@ std::string MEDModeTimeReq::buildName(const std::string& name) const
   oss2.width(len);
   oss2.fill('0'); oss2 << _it;
   //
-  oss << oss2.str() << "]"; 
+  oss << oss2.str() << "]";
+  if(_it<(int)_ts.size())
+    oss << " - " << _ts[_it];
   return oss.str();
 }
 
index f4192411a9fc3cd3266ee194d1666bc141ada488..7102eca7df954718784c29806f7aaa0e61f0d9e4 100644 (file)
@@ -55,7 +55,7 @@ private:
 class MEDModeTimeReq : public MEDTimeReq
 {
 public:
-  MEDModeTimeReq(const std::vector<bool>& v);
+  MEDModeTimeReq(const std::vector<bool>& v, const std::vector<double>& ts);
   ~MEDModeTimeReq();
   int size() const;
   int getCurrent() const;
@@ -65,6 +65,7 @@ public:
   void operator++() const;
 private:
   std::vector<bool> _v;
+  std::vector<double> _ts;
   mutable int _it;
   mutable int _sz;
 };
index c2d3b1551df11a91544e6174a7d43a7029e88835..5eab0e9011aa5e435ae1036245fd9b960ca307f9 100644 (file)
@@ -111,6 +111,7 @@ class vtkExtractGroup::vtkExtractGroupInternal
 public:
   void loadFrom(vtkMutableDirectedGraph *sil);
   int getNumberOfEntries() const;
+  const char *getMeshName() const;
   const char *getKeyOfEntry(int i) const;
   bool getStatusOfEntryStr(const char *entry) const;
   void setStatusOfEntryStr(const char *entry, bool status);
@@ -125,6 +126,7 @@ private:
 private:
   std::vector<ExtractGroupGrp> _groups;
   std::vector<ExtractGroupFam> _fams;
+  std::string _mesh_name;
 };
 
 const char ExtractGroupGrp::START[]="GRP_";
@@ -180,6 +182,11 @@ bool vtkExtractGroup::vtkExtractGroupInternal::IsInformationOK(vtkInformation *i
   return false;
 }
 
+const char *vtkExtractGroup::vtkExtractGroupInternal::getMeshName() const
+{
+  return this->_mesh_name.c_str();
+}
+
 void vtkExtractGroup::vtkExtractGroupInternal::loadFrom(vtkMutableDirectedGraph *sil)
 {
   std::vector<ExtractGroupGrp> oldGrps(_groups); _groups.clear();
@@ -207,6 +214,7 @@ void vtkExtractGroup::vtkExtractGroupInternal::loadFrom(vtkMutableDirectedGraph
     {
       vtkIdType id1(it0->Next());
       std::string meshName((const char *)verticesNames2->GetValue(id1));
+      this->_mesh_name=meshName;
       vtkAdjacentVertexIterator *it1(vtkAdjacentVertexIterator::New());
       sil->GetAdjacentVertices(id1,it1);
       vtkIdType idZeGrps(it1->Next());//zeGroups
@@ -671,3 +679,8 @@ void vtkExtractGroup::SetGroupsFlagsStatus(const char *name, int status)
      this->Modified();
   //this->Internal->printMySelf(std::cerr);
 }
+
+const char *vtkExtractGroup::GetMeshName()
+{
+  return this->Internal->getMeshName();
+}
index 778b1d982822dfc24b3994b78346096ec739b5b6..c13ed1b1a1930b5b8be12e824fb21c705948c44c 100644 (file)
@@ -39,7 +39,7 @@ public:
   // Description:
   // Every time the SIL is updated a this will return a different value.
   virtual int GetSILUpdateStamp();
-
+  const char *GetMeshName();
 protected:
   vtkExtractGroup();
   ~vtkExtractGroup();
index 0006caf330045bef5ab1ecf802d54521ed14bb36..45e26622eca4ec6b51aa2fc0e4989e011ed444bd 100644 (file)
        is kept. When 1 the complementary part is selected.
        </Documentation>
       </IntVectorProperty>
+
+      <StringVectorProperty
+          name="MeshName"
+          command="GetMeshName"
+          number_of_elements="1"
+          animateable="0"
+          information_only="1">
+        <Documentation>
+          This property returns the name of the mesh.
+        </Documentation>
+      </StringVectorProperty>
     </SourceProxy>
   </ProxyGroup>
   
index 96afce8fe60024759d4e89681cb82b2ed78c8172..c83bdff80f792f42cfa9409262672fd2885eadfb 100644 (file)
@@ -36,3 +36,5 @@ ADD_TEST(testMEDReader7 ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/testMED
 SET_TESTS_PROPERTIES(testMEDReader7 PROPERTIES ENVIRONMENT "${tests_env}")
 ADD_TEST(testMEDReader8 ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/testMEDReader8.py)
 SET_TESTS_PROPERTIES(testMEDReader8 PROPERTIES ENVIRONMENT "${tests_env}")
+ADD_TEST(testMEDReader9 ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/testMEDReader9.py)
+SET_TESTS_PROPERTIES(testMEDReader9 PROPERTIES ENVIRONMENT "${tests_env}")
index 5b33b462eeb87023e13a106a5c9d7b19138e6914..0ade05bb60f842d8d3467452ea6f9bb4af6eaf65 100644 (file)
@@ -93,6 +93,8 @@ ExtractGroup1=ExtractGroup()
 ExtractGroup1.Input=ELNOMesh1
 ExtractGroup1.UpdatePipelineInformation()
 ExtractGroup1.AllGroups=['GRP_ba2','GRP_to1','GRP_web']
+assert(isinstance(ExtractGroup1.GetProperty("MeshName")[0],str))
+assert(ExtractGroup1.GetProperty("MeshName")[0]=="mesh")
 #
 DataRepresentation3 = Show()
 DataRepresentation3.ScaleFactor = 0.008999999705702066
diff --git a/src/Plugins/MEDReader/Test/testMEDReader9.py b/src/Plugins/MEDReader/Test/testMEDReader9.py
new file mode 100644 (file)
index 0000000..2f40282
--- /dev/null
@@ -0,0 +1,55 @@
+#  -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2014  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.
+#
+# 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
+#
+# Author : Anthony Geay
+
+from MEDLoader import *
+
+""" This test is a non regression test. Test that ExtractGroup adapt to the current mesh of MEDReader. A MED file containing 2 fields on a 2 different meshes.
+This test checks that the MeshName follows.
+"""
+
+fname="testMEDReader9.med"
+#########
+m1=MEDCouplingUMesh("m1",2) ; m1.setCoords(DataArrayDouble([(0.,0.),(1.,0.),(0.,1.)])) ; m1.allocateCells() ; m1.insertNextCell(NORM_TRI3,[0,1,2])
+m2=MEDCouplingUMesh("m2",2) ; m2.setCoords(DataArrayDouble([(0.,0.),(1.,0.),(0.,1.),(1.,1.)])) ; m2.allocateCells() ; m2.insertNextCell(NORM_QUAD4,[0,1,3,2])
+mm1=MEDFileUMesh() ; mm2=MEDFileUMesh()
+mm1.setMeshAtLevel(0,m1) ; mm2.setMeshAtLevel(0,m2)
+ms=MEDFileMeshes() ; ms.pushMesh(mm1) ; ms.pushMesh(mm2)
+f1=MEDCouplingFieldDouble(ON_CELLS) ; f1.setName("f1") ; f1.setMesh(m1) ; f1.setArray(DataArrayDouble([1.111]))
+f2=MEDCouplingFieldDouble(ON_CELLS) ; f2.setName("f2") ; f2.setMesh(m2) ; f2.setArray(DataArrayDouble([2.2222]))
+ff1=MEDFileField1TS() ; ff2=MEDFileField1TS()
+ff1.setFieldNoProfileSBT(f1) ; ff2.setFieldNoProfileSBT(f2)
+ms.write(fname,2)
+ff1.write(fname,0)
+ff2.write(fname,0)
+################### MED write is done -> Go to MEDReader
+from paraview.simple import *
+
+myMedReader=MEDReader(FileName=fname)
+myMedReader.AllArrays=['TS0/m1/ComSup0/f1@@][@@P0']
+myMedReader.UpdatePipelineInformation()
+ExtractGroup1=ExtractGroup(Input=myMedReader)
+ExtractGroup1.UpdatePipelineInformation()
+assert(ExtractGroup1.GetProperty("MeshName")[0]=="m1")
+myMedReader.AllArrays=['TS0/m2/ComSup0/f2@@][@@P0']
+myMedReader.UpdatePipeline()
+ExtractGroup2=ExtractGroup(Input=myMedReader)
+ExtractGroup2.UpdatePipelineInformation()
+assert(ExtractGroup2.GetProperty("MeshName")[0]=="m2")