Salome HOME
MEDReader again
[modules/med.git] / src / MEDLoader / MEDFileMeshLL.hxx
index f2d16704ba89be396756657627b9b86cc34dca64..9338ea825508c5da07ed1a129bce6fda31c83a7e 100644 (file)
@@ -26,6 +26,7 @@
 
 #include "MEDCouplingUMesh.hxx"
 #include "MEDCouplingCMesh.hxx"
+#include "MEDCoupling1GTUMesh.hxx"
 #include "MEDCouplingCurveLinearMesh.hxx"
 #include "MEDCouplingAutoRefCountObjectPtr.hxx"
 
@@ -35,6 +36,8 @@
 
 namespace ParaMEDMEM
 {
+  class MEDFileMeshReadSelector;
+  
   class MEDFileMeshL2 : public RefCountObject
   {
   public:
@@ -50,7 +53,7 @@ namespace ParaMEDMEM
     std::vector<std::string> getAxisInfoOnMesh(med_idt fid, int mId, const char *mName, ParaMEDMEM::MEDCouplingMeshType& meshType, int& nstep, int& Mdim) throw(INTERP_KERNEL::Exception);
     static int GetMeshIdFromName(med_idt fid, const char *mName, ParaMEDMEM::MEDCouplingMeshType& meshType, int& dt, int& it, std::string& dtunit1) throw(INTERP_KERNEL::Exception);
     static double CheckMeshTimeStep(med_idt fid, const char *mname, int nstep, int dt, int it) throw(INTERP_KERNEL::Exception);
-    static void ReadFamiliesAndGrps(med_idt fid, const char *mname, std::map<std::string,int>& fams, std::map<std::string, std::vector<std::string> >& grps);
+    static void ReadFamiliesAndGrps(med_idt fid, const char *mname, std::map<std::string,int>& fams, std::map<std::string, std::vector<std::string> >& grps, MEDFileMeshReadSelector *mrs);
     static void WriteFamiliesAndGrps(med_idt fid, const char *mname, const std::map<std::string,int>& fams, const std::map<std::string, std::vector<std::string> >& grps, int tooLongStrPol);
   protected:
     MEDFileString _name;
@@ -66,8 +69,8 @@ namespace ParaMEDMEM
   {
   public:
     MEDFileUMeshL2();
-    void loadAll(med_idt fid, int mId, const char *mName, int dt, int it);
-    void loadConnectivity(med_idt fid, int mdim, const char *mName, int dt, int it);
+    void loadAll(med_idt fid, int mId, const char *mName, int dt, int it, MEDFileMeshReadSelector *mrs);
+    void loadConnectivity(med_idt fid, int mdim, const char *mName, int dt, int it, MEDFileMeshReadSelector *mrs);
     void loadCoords(med_idt fid, int mId, const std::vector<std::string>& infosOnComp, const char *mName, int dt, int it) throw(INTERP_KERNEL::Exception);
     int getNumberOfLevels() const { return _per_type_mesh.size(); }
     bool emptyLev(int levId) const { return _per_type_mesh[levId].empty(); }
@@ -128,11 +131,43 @@ namespace ParaMEDMEM
     void updateTime() const;
   private:
     const MEDFileUMeshSplitL1 *_st;
-    mutable unsigned int _mpt_time;
-    mutable unsigned int _num_time;
+    mutable std::size_t _mpt_time;
+    mutable std::size_t _num_time;
     mutable MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> _m;
   };
 
+  class MEDFileUMeshAggregateCompute
+  {
+  public:
+    MEDFileUMeshAggregateCompute();
+    void assignParts(const std::vector< const MEDCoupling1GTUMesh * >& mParts);
+    void assignUMesh(MEDCouplingUMesh *m);
+    MEDCouplingUMesh *getUmesh() const;
+    std::vector<MEDCoupling1GTUMesh *> getParts() const;
+    std::vector<MEDCoupling1GTUMesh *> getPartsWithoutComputation() const throw(INTERP_KERNEL::Exception);
+    MEDCoupling1GTUMesh *getPartWithoutComputation(INTERP_KERNEL::NormalizedCellType gt) const throw(INTERP_KERNEL::Exception);
+    std::size_t getTimeOfThis() const;
+    std::size_t getHeapMemorySize() const;
+    MEDFileUMeshAggregateCompute deepCpy(DataArrayDouble *coords) const;
+    bool isEqual(const MEDFileUMeshAggregateCompute& other, double eps, std::string& what) const;
+    void clearNonDiscrAttributes() const;
+    void synchronizeTinyInfo(const MEDFileMesh& master) const;
+    bool empty() const;
+    int getMeshDimension() const;
+    std::vector<int> getDistributionOfTypes() const;
+    int getSize() const throw(INTERP_KERNEL::Exception);
+    void setCoords(DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
+  private:
+    void forceComputationOfPartsFromUMesh() const;
+    std::size_t getTimeOfParts() const;
+    std::size_t getTimeOfUMesh() const;
+  private:
+    mutable std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCoupling1GTUMesh> > _m_parts;
+    mutable std::size_t _mp_time;
+    mutable std::size_t _m_time;
+    mutable MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> _m;
+  };
+  
   class MEDFileUMeshSplitL1 : public RefCountObject
   {
     friend class MEDFileUMeshPermCompute;
@@ -142,7 +177,8 @@ namespace ParaMEDMEM
     MEDFileUMeshSplitL1(MEDCouplingUMesh *m);
     MEDFileUMeshSplitL1(MEDCouplingUMesh *m, bool newOrOld);
     std::size_t getHeapMemorySize() const;
-    MEDFileUMeshSplitL1 *deepCpy() const;
+    MEDFileUMeshSplitL1 *deepCpy(DataArrayDouble *coords) const;
+    void setCoords(DataArrayDouble *coords) throw(INTERP_KERNEL::Exception);
     bool isEqual(const MEDFileUMeshSplitL1 *other, double eps, std::string& what) const;
     void clearNonDiscrAttributes() const;
     void synchronizeTinyInfo(const MEDFileMesh& master) const;
@@ -155,6 +191,8 @@ namespace ParaMEDMEM
     MEDCouplingUMesh *getFamilyPart(const int *idsBg, const int *idsEnd, bool renum) const;
     DataArrayInt *getFamilyPartArr(const int *idsBg, const int *idsEnd, bool renum) const;
     MEDCouplingUMesh *getWholeMesh(bool renum) const;
+    std::vector<MEDCoupling1GTUMesh *> getDirectUndergroundSingleGeoTypeMeshes() const throw(INTERP_KERNEL::Exception) { return _m_by_types.getPartsWithoutComputation(); }
+    MEDCoupling1GTUMesh *getDirectUndergroundSingleGeoTypeMesh(INTERP_KERNEL::NormalizedCellType gt) const throw(INTERP_KERNEL::Exception) { return _m_by_types.getPartWithoutComputation(gt); }
     DataArrayInt *getOrCreateAndGetFamilyField() throw(INTERP_KERNEL::Exception);
     const DataArrayInt *getFamilyField() const;
     const DataArrayInt *getNumberField() const;
@@ -183,7 +221,7 @@ namespace ParaMEDMEM
     DataArrayInt *renumIfNeededArr(const DataArrayInt *da) const;
     void computeRevNum() const;
   private:
-    MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> _m_by_types;
+    MEDFileUMeshAggregateCompute _m_by_types;
     MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _fam;
     MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _num;
     MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar> _names;