]> SALOME platform Git repositories - modules/med.git/commitdiff
Salome HOME
MED file mesh loading on demand.
authorageay <ageay>
Mon, 1 Jul 2013 06:40:00 +0000 (06:40 +0000)
committerageay <ageay>
Mon, 1 Jul 2013 06:40:00 +0000 (06:40 +0000)
src/MEDLoader/CMakeLists.txt
src/MEDLoader/MEDFileMeshReadSelector.cxx [new file with mode: 0644]
src/MEDLoader/MEDFileMeshReadSelector.hxx [new file with mode: 0644]
src/MEDLoader/Makefile.am
src/MEDLoader/Swig/MEDLoaderCommon.i

index 8666e2b552364dcbc2e888de60186157dad11939..43f3ea1610e979a9c08e52889faa5b13ba5273b3 100644 (file)
@@ -45,6 +45,7 @@ SET(medloader_SOURCES
   MEDFileField.cxx
   MEDFileParameter.cxx
   MEDFileData.cxx
+  MEDFileMeshReadSelector.cxx
   SauvMedConvertor.cxx
   SauvReader.cxx
   SauvWriter.cxx
diff --git a/src/MEDLoader/MEDFileMeshReadSelector.cxx b/src/MEDLoader/MEDFileMeshReadSelector.cxx
new file mode 100644 (file)
index 0000000..9aad4e9
--- /dev/null
@@ -0,0 +1,95 @@
+// Copyright (C) 2007-2013  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 (CEA/DEN)
+
+#include "MEDFileMeshReadSelector.hxx"
+
+using namespace ParaMEDMEM;
+
+MEDFileMeshReadSelector::MEDFileMeshReadSelector():_code(0)
+{
+}
+
+MEDFileMeshReadSelector::MEDFileMeshReadSelector(unsigned int code):_code(code)
+{
+}
+
+unsigned int MEDFileMeshReadSelector::getCode() const
+{
+  return _code;
+}
+
+void MEDFileMeshReadSelector::setCode(unsigned int newCode)
+{
+  _code=newCode;
+}
+
+bool MEDFileMeshReadSelector::isCellFamilyFieldReading() const
+{
+  return _code & 0x00000001;
+}
+
+bool MEDFileMeshReadSelector::isNodeFamilyFieldReading() const
+{
+  return _code & 0x00000002;
+}
+
+bool MEDFileMeshReadSelector::isCellNameFieldReading() const
+{
+  return _code & 0x00000004;
+}
+
+bool MEDFileMeshReadSelector::isNodeNameFieldReading() const
+{
+  return _code & 0x00000008;
+}
+
+void MEDFileMeshReadSelector::setCellFamilyFieldReading(bool b)
+{
+}
+
+void MEDFileMeshReadSelector::setNodeFamilyFieldReading(bool b)
+{
+}
+
+void MEDFileMeshReadSelector::setCellNameFieldReading(bool b)
+{
+}
+
+void MEDFileMeshReadSelector::setNodeNameFieldReading(bool b)
+{
+}
+
+void MEDFileMeshReadSelector::reprAll(std::ostream& str) const
+{
+  str << "MEDFileMeshReadSelector (code=" << _code << ") : \n";
+  str << "Read family field on cells : " << ReprStatus(isCellFamilyFieldReading()) << std::endl;
+  str << "Read family field on nodes : " << ReprStatus(isNodeFamilyFieldReading()) << std::endl;
+  str << "Read family name on cells : " << ReprStatus(isCellNameFieldReading()) << std::endl;
+  str << "Read family name on nodes : " << ReprStatus(isNodeNameFieldReading());
+}
+
+std::string MEDFileMeshReadSelector::ReprStatus(bool v)
+{
+  if(v)
+    return std::string("ON");
+  else
+    return std::string("OFF");
+}
+
diff --git a/src/MEDLoader/MEDFileMeshReadSelector.hxx b/src/MEDLoader/MEDFileMeshReadSelector.hxx
new file mode 100644 (file)
index 0000000..15ac3ad
--- /dev/null
@@ -0,0 +1,58 @@
+// Copyright (C) 2007-2013  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 (CEA/DEN)
+
+#ifndef __MEDFILEMESHREADSELECTOR_HXX__
+#define __MEDFILEMESHREADSELECTOR_HXX__
+
+#include "MEDLoaderDefines.hxx"
+
+#include <sstream>
+#include <string>
+
+namespace ParaMEDMEM
+{
+  class MEDLOADER_EXPORT MEDFileMeshReadSelector
+  {
+  public:
+    MEDFileMeshReadSelector();
+    MEDFileMeshReadSelector(unsigned int code);
+    unsigned int getCode() const;
+    void setCode(unsigned int newCode);
+    bool isCellFamilyFieldReading() const;
+    bool isNodeFamilyFieldReading() const;
+    bool isCellNameFieldReading() const;
+    bool isNodeNameFieldReading() const;
+    void setCellFamilyFieldReading(bool b);
+    void setNodeFamilyFieldReading(bool b);
+    void setCellNameFieldReading(bool b);
+    void setNodeNameFieldReading(bool b);
+    void reprAll(std::ostream& str) const;
+  private:
+    static std::string ReprStatus(bool v);
+  private:
+    //bit #0 cell family field
+    //bit #1 node family field
+    //bit #2 cell name field
+    //bit #3 node name field
+    unsigned int _code;
+  };
+}
+
+#endif
index 3120813c495f9f6b38c7b50b690b2ea352c8085d..d60916ef44345883e89459230570a7e3416f8f0f 100755 (executable)
@@ -46,7 +46,7 @@ MEDLoader.cxx MEDLoaderBase.cxx MEDFileUtilities.cxx      \
 MEDFileMesh.cxx MEDFileMeshElt.cxx MEDFileBasis.cxx       \
 MEDFileMeshLL.cxx MEDFileField.cxx MEDFileData.cxx        \
 SauvMedConvertor.cxx SauvReader.cxx SauvWriter.cxx        \
-MEDFileParameter.cxx
+MEDFileParameter.cxx MEDFileMeshReadSelector.cxx
 
 libmedloader_la_CPPFLAGS= $(MED3_INCLUDES) $(HDF5_INCLUDES) @CXXTMPDPTHFLAGS@ \
        -I$(srcdir)/../INTERP_KERNEL \
index 8e26820ea3143638472fa5944adab7d75094859b..246a1b266d04a8ffeb693a1230fdea78556a4e79 100644 (file)
@@ -31,6 +31,7 @@
 #include "MEDFileField.hxx"
 #include "MEDFileParameter.hxx"
 #include "MEDFileData.hxx"
+#include "MEDFileMeshReadSelector.hxx"
 #include "MEDLoaderTypemaps.i"
 #include "SauvReader.hxx"
 #include "SauvWriter.hxx"
@@ -390,6 +391,38 @@ namespace ParaMEDMEM
     void setZipConnPolicy(int newVal) throw(INTERP_KERNEL::Exception);
   };
 
+  class MEDFileMeshReadSelector
+  {
+  public:
+    MEDFileMeshReadSelector();
+    MEDFileMeshReadSelector(unsigned int code);
+    unsigned int getCode() const;
+    void setCode(unsigned int newCode);
+    bool isCellFamilyFieldReading() const;
+    bool isNodeFamilyFieldReading() const;
+    bool isCellNameFieldReading() const;
+    bool isNodeNameFieldReading() const;
+    void setCellFamilyFieldReading(bool b);
+    void setNodeFamilyFieldReading(bool b);
+    void setCellNameFieldReading(bool b);
+    void setNodeNameFieldReading(bool b);
+    %extend
+    {
+      std::string __str__() const throw(INTERP_KERNEL::Exception)
+      {
+        std::ostringstream oss;
+        self->reprAll(oss);
+        return oss.str();
+      }
+      
+      std::string __repr__() const throw(INTERP_KERNEL::Exception)
+      {
+        std::ostringstream oss; oss << "MEDFileMeshReadSelector C++ instance at " << self << " (with code=" << self->getCode() << ").";
+        return oss.str();
+      }
+    }
+  };
+
   class MEDFileMesh : public RefCountObject, public MEDFileWritable
   {
   public: