Salome HOME
Merge 'agy/br810_1' branch.
[tools/medcoupling.git] / src / MEDLoader / MEDFileFieldOverView.hxx
index b3b0436c56ab47cbe65ac2148fe6217402756053..ceceef473cf65056411af74f51775fd64657f7c1 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2014  CEA/DEN, EDF R&D
+// Copyright (C) 2007-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
@@ -23,7 +23,7 @@
 
 #include "MEDLoaderDefines.hxx"
 
-#include "MEDCouplingAutoRefCountObjectPtr.hxx"
+#include "MCAuto.hxx"
 #include "MEDCouplingRefCountObject.hxx"
 #include "MEDCoupling1GTUMesh.hxx"
 
@@ -32,7 +32,7 @@
 
 #include <vector>
 
-namespace ParaMEDMEM
+namespace MEDCoupling
 {
   class DataArrayInt;
   class MEDCouplingMesh;
@@ -51,7 +51,7 @@ namespace ParaMEDMEM
   public:
     MEDLOADER_EXPORT static MEDFileMeshStruct *New(const MEDFileMesh *mesh);
     std::size_t getHeapMemorySizeWithoutChildren() const;
-    std::vector<const BigMemoryObject *> getDirectChildren() const;
+    std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
     const MEDFileMesh *getTheMesh() const { return _mesh; }
     int getNumberOfNodes() const { return _nb_nodes; }
     bool doesManageGeoType(INTERP_KERNEL::NormalizedCellType t) const;
@@ -76,7 +76,7 @@ namespace ParaMEDMEM
   {
   public:
     std::size_t getHeapMemorySizeWithoutChildren() const;
-    std::vector<const BigMemoryObject *> getDirectChildren() const;
+    std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
   public:
     static MEDMeshMultiLev *New(const MEDFileMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities);
     static MEDMeshMultiLev *New(const MEDFileMesh *m, const std::vector<int>& levs);
@@ -89,11 +89,12 @@ namespace ParaMEDMEM
     MEDLOADER_EXPORT void retrieveNumberIdsOnCells(DataArrayInt *& numIds, bool& isWithoutCopy) const;
     MEDLOADER_EXPORT void retrieveFamilyIdsOnNodes(DataArrayInt *& famIds, bool& isWithoutCopy) const;
     MEDLOADER_EXPORT void retrieveNumberIdsOnNodes(DataArrayInt *& numIds, bool& isWithoutCopy) const;
+    MEDLOADER_EXPORT DataArrayInt *retrieveGlobalNodeIdsIfAny() const;
     MEDLOADER_EXPORT std::vector< INTERP_KERNEL::NormalizedCellType > getGeoTypes() const;
-    void setFamilyIdsOnCells(DataArrayInt *famIds, bool isNoCopy);
-    void setNumberIdsOnCells(DataArrayInt *numIds, bool isNoCopy);
-    void setFamilyIdsOnNodes(DataArrayInt *famIds, bool isNoCopy);
-    void setNumberIdsOnNodes(DataArrayInt *numIds, bool isNoCopy);
+    void setFamilyIdsOnCells(DataArrayInt *famIds);
+    void setNumberIdsOnCells(DataArrayInt *numIds);
+    void setFamilyIdsOnNodes(DataArrayInt *famIds);
+    void setNumberIdsOnNodes(DataArrayInt *numIds);
     virtual void selectPartOfNodes(const DataArrayInt *pflNodes) = 0;
     virtual MEDMeshMultiLev *prepare() const = 0;
     int getNumberOfCells(INTERP_KERNEL::NormalizedCellType t) const;
@@ -108,20 +109,16 @@ namespace ParaMEDMEM
     MEDMeshMultiLev(const MEDFileMesh *mesh, int nbNodes, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities);
   protected:
     const MEDFileMesh *_mesh;
-    std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > _pfls;
+    std::vector< MCAuto<DataArrayInt> > _pfls;
     std::vector< INTERP_KERNEL::NormalizedCellType > _geo_types;
     std::vector<int> _nb_entities;
-    MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _node_reduction;
+    MCAuto<DataArrayInt> _node_reduction;
     int _nb_nodes;
     //
-    MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _cell_fam_ids;
-    bool _cell_fam_ids_nocpy;
-    MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _cell_num_ids;
-    bool _cell_num_ids_nocpy;
-    MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _node_fam_ids;
-    bool _node_fam_ids_nocpy;
-    MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _node_num_ids;
-    bool _node_num_ids_nocpy;
+    MCAuto<DataArrayInt> _cell_fam_ids;
+    MCAuto<DataArrayInt> _cell_num_ids;
+    MCAuto<DataArrayInt> _node_fam_ids;
+    MCAuto<DataArrayInt> _node_num_ids;
   public:
     MEDLOADER_EXPORT static const int PARAMEDMEM_2_VTKTYPE_LGTH=34;
     MEDLOADER_EXPORT static const unsigned char PARAMEDMEM_2_VTKTYPE[PARAMEDMEM_2_VTKTYPE_LGTH];
@@ -137,20 +134,20 @@ namespace ParaMEDMEM
     static MEDUMeshMultiLev *New(const MEDFileUMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities);
     void selectPartOfNodes(const DataArrayInt *pflNodes);
     MEDMeshMultiLev *prepare() const;
-    MEDUMeshMultiLev(const MEDStructuredMeshMultiLev& other, const MEDCouplingAutoRefCountObjectPtr<MEDCoupling1GTUMesh>& part);
+    MEDUMeshMultiLev(const MEDStructuredMeshMultiLev& other, const MCAuto<MEDCoupling1GTUMesh>& part);
     MEDLOADER_EXPORT bool buildVTUArrays(DataArrayDouble *& coords, DataArrayByte *&types, DataArrayInt *&cellLocations, DataArrayInt *& cells, DataArrayInt *&faceLocations, DataArrayInt *&faces) const;
   protected:
     void appendVertices(const DataArrayInt *verticesToAdd, DataArrayInt *nr);
   private:
-    void reorderNodesIfNecessary(MEDCouplingAutoRefCountObjectPtr<DataArrayDouble>& coords, DataArrayInt *nodalConnVTK, DataArrayInt *polyhedNodalConnVTK) const;
+    void reorderNodesIfNecessary(MCAuto<DataArrayDouble>& coords, DataArrayInt *nodalConnVTK, DataArrayInt *polyhedNodalConnVTK) const;
   private:
     MEDUMeshMultiLev(const MEDUMeshMultiLev& other);
     MEDUMeshMultiLev(const MEDFileUMesh *m, const std::vector<int>& levs);
     MEDUMeshMultiLev(const MEDFileUMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities);
   private:
-    std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCoupling1GTUMesh> > _parts;
+    std::vector< MCAuto<MEDCoupling1GTUMesh> > _parts;
     //! this attribute is used only for mesh with no cells but having coordinates. For classical umeshes those pointer is equal to pointer of coordinates of instances in this->_parts.
-    MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> _coords;
+    MCAuto<DataArrayDouble> _coords;
   };
 
   class MEDStructuredMeshMultiLev : public MEDMeshMultiLev
@@ -170,10 +167,8 @@ namespace ParaMEDMEM
     void initStdFieldOfIntegers(const MEDFileStructuredMesh *m);
   protected:
     bool _is_internal;
-    MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _face_fam_ids;
-    bool _face_fam_ids_nocpy;
-    MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _face_num_ids;
-    bool _face_num_ids_nocpy;
+    MCAuto<DataArrayInt> _face_fam_ids;
+    MCAuto<DataArrayInt> _face_num_ids;
   };
 
   class MEDCMeshMultiLev : public MEDStructuredMeshMultiLev
@@ -189,7 +184,7 @@ namespace ParaMEDMEM
     MEDCMeshMultiLev(const MEDFileCMesh *m, const std::vector<int>& levs);
     MEDCMeshMultiLev(const MEDFileCMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities);
   private:
-    std::vector< MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> > _coords;
+    std::vector< MCAuto<DataArrayDouble> > _coords;
   };
 
   class MEDCurveLinearMeshMultiLev : public MEDStructuredMeshMultiLev
@@ -205,7 +200,7 @@ namespace ParaMEDMEM
     MEDCurveLinearMeshMultiLev(const MEDFileCurveLinearMesh *m, const std::vector<int>& levs);
     MEDCurveLinearMeshMultiLev(const MEDFileCurveLinearMesh *m, const std::vector<INTERP_KERNEL::NormalizedCellType>& gts, const std::vector<const DataArrayInt *>& pfls, const std::vector<int>& nbEntities);
   private:
-    MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> _coords;
+    MCAuto<DataArrayDouble> _coords;
     std::vector<int> _structure;
   };
 
@@ -219,7 +214,7 @@ namespace ParaMEDMEM
     void checkWithMeshStructForGaussPT(const MEDFileMeshStruct *mst, const MEDFileFieldGlobsReal *globs);
     //
     MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
-    MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildren() const;
+    MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
     //
     const DataArrayInt *getPfl(const MEDFileFieldGlobsReal *globs) const;
     INTERP_KERNEL::NormalizedCellType getGeo() const { return _geo_type; }
@@ -239,7 +234,7 @@ namespace ParaMEDMEM
   private:
     INTERP_KERNEL::NormalizedCellType _geo_type;
     std::pair<int,int> _start_end;
-    MEDCouplingAutoRefCountObjectPtr<DataArrayInt> _pfl;
+    MCAuto<DataArrayInt> _pfl;
     std::string _loc;
     int _nb_of_entity;
   };
@@ -247,12 +242,12 @@ namespace ParaMEDMEM
   class MEDFileField1TSStructItem : public BigMemoryObject
   {
   public:
-    MEDFileField1TSStructItem() { }
+    MEDFileField1TSStructItem():_computed(false),_type(ON_CELLS) { }
     MEDFileField1TSStructItem(TypeOfField a, const std::vector< MEDFileField1TSStructItem2 >& b);
     void checkWithMeshStruct(const MEDFileMeshStruct *mst, const MEDFileFieldGlobsReal *globs);
     bool operator==(const MEDFileField1TSStructItem& other) const;
     MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
-    MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildren() const;
+    MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
     bool isEntityCell() const;
     bool isComputed() const { return _computed; }
     TypeOfField getType() const { return _type; }
@@ -279,7 +274,7 @@ namespace ParaMEDMEM
     static MEDFileField1TSStruct *New(const MEDFileAnyTypeField1TS *ref, MEDFileMeshStruct *mst);
     void checkWithMeshStruct(MEDFileMeshStruct *mst, const MEDFileFieldGlobsReal *globs);
     std::size_t getHeapMemorySizeWithoutChildren() const;
-    std::vector<const BigMemoryObject *> getDirectChildren() const;
+    std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
     bool isEqualConsideringThePast(const MEDFileAnyTypeField1TS *other, const MEDFileMeshStruct *mst) const;
     bool isSupportSameAs(const MEDFileAnyTypeField1TS *other, const MEDFileMeshStruct *meshSt);
     bool isCompatibleWithNodesDiscr(const MEDFileAnyTypeField1TS *other, const MEDFileMeshStruct *meshSt);
@@ -305,12 +300,12 @@ namespace ParaMEDMEM
     bool isEqual(const MEDFileAnyTypeFieldMultiTS *other);
     bool isCompatibleWithNodesDiscr(const MEDFileAnyTypeFieldMultiTS *other);
     std::size_t getHeapMemorySizeWithoutChildren() const;
-    std::vector<const BigMemoryObject *> getDirectChildren() const;
+    std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
   private:
     MEDFileFastCellSupportComparator(const MEDFileMeshStruct *m, const MEDFileAnyTypeFieldMultiTS *ref);
   private:
-    MEDCouplingAutoRefCountObjectPtr<MEDFileMeshStruct> _mesh_comp;
-    std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileField1TSStruct> > _f1ts_cmps;
+    MCAuto<MEDFileMeshStruct> _mesh_comp;
+    std::vector< MCAuto<MEDFileField1TSStruct> > _f1ts_cmps;
   };
 }