Salome HOME
Indices are stored as mcIdType type instead of int to support switch to 64bits indexing
[tools/medcoupling.git] / src / MEDCoupling / MEDCouplingField.hxx
index 52a2b92c020353dcf29d469e741be28333629933..c472db057b2444fed48160ae029ecbebb6a345e4 100644 (file)
@@ -1,9 +1,9 @@
-// Copyright (C) 2007-2013  CEA/DEN, EDF R&D
+// Copyright (C) 2007-2019  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.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 #include "MEDCouplingNatureOfField.hxx"
 #include "MEDCouplingRefCountObject.hxx"
 #include "NormalizedUnstructuredMesh.hxx"
-#include "MEDCouplingAutoRefCountObjectPtr.hxx"
+#include "MCAuto.hxx"
 #include "MEDCouplingFieldDiscretization.hxx"
 #include "InterpKernelException.hxx"
 
 #include <string>
 #include <vector>
 
-namespace ParaMEDMEM
+namespace MEDCoupling
 {
-  class DataArrayInt;
+  class DataArrayIdType;
   class DataArrayDouble;
   class MEDCouplingMesh;
   class MEDCouplingFieldDouble;
   class MEDCouplingGaussLocalization;
 
-  class MEDCOUPLING_EXPORT MEDCouplingField : public RefCountObject, public TimeLabel
+  class MEDCouplingField : public RefCountObject, public TimeLabel
   {
   public:
-    virtual void checkCoherency() const throw(INTERP_KERNEL::Exception) = 0;
-    virtual bool areCompatibleForMerge(const MEDCouplingField *other) const;
-    virtual bool areStrictlyCompatible(const MEDCouplingField *other) const;
-    virtual bool isEqualIfNotWhy(const MEDCouplingField *other, double meshPrec, double valsPrec, std::string& reason) const throw(INTERP_KERNEL::Exception);
-    virtual bool isEqual(const MEDCouplingField *other, double meshPrec, double valsPrec) const;
-    virtual bool isEqualWithoutConsideringStr(const MEDCouplingField *other, double meshPrec, double valsPrec) const;
-    virtual void copyTinyStringsFrom(const MEDCouplingField *other) throw(INTERP_KERNEL::Exception);
-    void setMesh(const ParaMEDMEM::MEDCouplingMesh *mesh);
-    const ParaMEDMEM::MEDCouplingMesh *getMesh() const { return _mesh; }
-    void setName(const char *name) { _name=name; }
-    const char *getDescription() const { return _desc.c_str(); }
-    void setDescription(const char *desc) { _desc=desc; }
-    const char *getName() const { return _name.c_str(); }
-    TypeOfField getTypeOfField() const;
-    NatureOfField getNature() const;
-    virtual void setNature(NatureOfField nat) throw(INTERP_KERNEL::Exception);
-    DataArrayDouble *getLocalizationOfDiscr() const throw(INTERP_KERNEL::Exception);
-    MEDCouplingFieldDouble *buildMeasureField(bool isAbs) const throw(INTERP_KERNEL::Exception);
-    MEDCouplingMesh *buildSubMeshData(const int *start, const int *end, DataArrayInt *&di) const;
-    MEDCouplingMesh *buildSubMeshDataRange(int begin, int end, int step, int& beginOut, int& endOut, int& stepOut, DataArrayInt *&di) const;
-    DataArrayInt *computeTupleIdsToSelectFromCellIds(const int *startCellIds, const int *endCellIds) const;
-    const MEDCouplingFieldDiscretization *getDiscretization() const { return _type; }
-    MEDCouplingFieldDiscretization *getDiscretization() { return _type; }
-    void setDiscretization(MEDCouplingFieldDiscretization *newDisc);
-    int getNumberOfTuplesExpected() const throw(INTERP_KERNEL::Exception);
-    int getNumberOfMeshPlacesExpected() const throw(INTERP_KERNEL::Exception);
+    MEDCOUPLING_EXPORT virtual void checkConsistencyLight() const;
+    MEDCOUPLING_EXPORT virtual bool areCompatibleForMerge(const MEDCouplingField *other) const;
+    MEDCOUPLING_EXPORT virtual bool areStrictlyCompatible(const MEDCouplingField *other) const;
+    MEDCOUPLING_EXPORT virtual bool areStrictlyCompatibleForMulDiv(const MEDCouplingField *other) const;
+    MEDCOUPLING_EXPORT virtual void copyTinyStringsFrom(const MEDCouplingField *other);
+    MEDCOUPLING_EXPORT void setMesh(const MEDCoupling::MEDCouplingMesh *mesh);
+    MEDCOUPLING_EXPORT const MEDCoupling::MEDCouplingMesh *getMesh() const { return _mesh; }
+    MEDCOUPLING_EXPORT MEDCoupling::MEDCouplingMesh *getMesh() { return const_cast<MEDCoupling::MEDCouplingMesh *>(_mesh); }
+    MEDCOUPLING_EXPORT void setName(const std::string& name) { _name=name; }
+    MEDCOUPLING_EXPORT std::string getDescription() const { return _desc; }
+    MEDCOUPLING_EXPORT void setDescription(const std::string& desc) { _desc=desc; }
+    MEDCOUPLING_EXPORT std::string getName() const { return _name; }
+    MEDCOUPLING_EXPORT TypeOfField getTypeOfField() const;
+    MEDCOUPLING_EXPORT NatureOfField getNature() const;
+    MEDCOUPLING_EXPORT virtual void setNature(NatureOfField nat);
+    MEDCOUPLING_EXPORT DataArrayDouble *getLocalizationOfDiscr() const;
+    MEDCOUPLING_EXPORT MEDCouplingFieldDouble *buildMeasureField(bool isAbs) const;
+    MEDCOUPLING_EXPORT MEDCouplingMesh *buildSubMeshData(const mcIdType *start, const mcIdType *end, DataArrayIdType *&di) const;
+    MEDCOUPLING_EXPORT MEDCouplingMesh *buildSubMeshDataRange(mcIdType begin, mcIdType end, mcIdType step, mcIdType& beginOut, mcIdType& endOut, mcIdType& stepOut, DataArrayIdType *&di) const;
+    MEDCOUPLING_EXPORT DataArrayIdType *computeTupleIdsToSelectFromCellIds(const mcIdType *startCellIds, const mcIdType *endCellIds) const;
+    MEDCOUPLING_EXPORT const MEDCouplingFieldDiscretization *getDiscretization() const { return _type; }
+    MEDCOUPLING_EXPORT MEDCouplingFieldDiscretization *getDiscretization() { return _type; }
+    MEDCOUPLING_EXPORT void setDiscretization(MEDCouplingFieldDiscretization *newDisc);
+    MEDCOUPLING_EXPORT mcIdType getNumberOfTuplesExpected() const;
+    MEDCOUPLING_EXPORT mcIdType getNumberOfMeshPlacesExpected() const;
     // Gauss point specific methods
-    void setGaussLocalizationOnType(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
-                                    const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception);
-    void setGaussLocalizationOnCells(const int *begin, const int *end, const std::vector<double>& refCoo,
-                                     const std::vector<double>& gsCoo, const std::vector<double>& wg) throw(INTERP_KERNEL::Exception);
-    void clearGaussLocalizations();
-    MEDCouplingGaussLocalization& getGaussLocalization(int locId) throw(INTERP_KERNEL::Exception);
-    int getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
-    std::set<int> getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception);
-    int getNbOfGaussLocalization() const throw(INTERP_KERNEL::Exception);
-    int getGaussLocalizationIdOfOneCell(int cellId) const throw(INTERP_KERNEL::Exception);
-    void getCellIdsHavingGaussLocalization(int locId, std::vector<int>& cellIds) const throw(INTERP_KERNEL::Exception);
-    const MEDCouplingGaussLocalization& getGaussLocalization(int locId) const throw(INTERP_KERNEL::Exception);
-    void updateTime() const;
-    std::size_t getHeapMemorySize() const;
+    MEDCOUPLING_EXPORT void setGaussLocalizationOnType(INTERP_KERNEL::NormalizedCellType type, const std::vector<double>& refCoo,
+                                                       const std::vector<double>& gsCoo, const std::vector<double>& wg);
+    MEDCOUPLING_EXPORT void setGaussLocalizationOnCells(const mcIdType *begin, const mcIdType *end, const std::vector<double>& refCoo,
+                                                        const std::vector<double>& gsCoo, const std::vector<double>& wg);
+    MEDCOUPLING_EXPORT void clearGaussLocalizations();
+    MEDCOUPLING_EXPORT MEDCouplingGaussLocalization& getGaussLocalization(int locId);
+    MEDCOUPLING_EXPORT mcIdType getGaussLocalizationIdOfOneType(INTERP_KERNEL::NormalizedCellType type) const;
+    MEDCOUPLING_EXPORT std::set<mcIdType> getGaussLocalizationIdsOfOneType(INTERP_KERNEL::NormalizedCellType type) const;
+    MEDCOUPLING_EXPORT mcIdType getNbOfGaussLocalization() const;
+    MEDCOUPLING_EXPORT mcIdType getGaussLocalizationIdOfOneCell(mcIdType cellId) const;
+    MEDCOUPLING_EXPORT void getCellIdsHavingGaussLocalization(int locId, std::vector<mcIdType>& cellIds) const;
+    MEDCOUPLING_EXPORT const MEDCouplingGaussLocalization& getGaussLocalization(int locId) const;
+    MEDCOUPLING_EXPORT void updateTime() const;
+    MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
+    MEDCOUPLING_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
     // for MED file RW
-    int getNumberOfTuplesExpectedRegardingCode(const std::vector<int>& code, const std::vector<const DataArrayInt *>& idsPerType) const throw(INTERP_KERNEL::Exception);
-    virtual void reprQuickOverview(std::ostream& stream) const throw(INTERP_KERNEL::Exception) = 0;
+    MEDCOUPLING_EXPORT mcIdType getNumberOfTuplesExpectedRegardingCode(const std::vector<mcIdType>& code, const std::vector<const DataArrayIdType *>& idsPerType) const;
+    MEDCOUPLING_EXPORT virtual void reprQuickOverview(std::ostream& stream) const = 0;
   protected:
-    MEDCouplingField(TypeOfField type);
-    MEDCouplingField(const MEDCouplingField& other, bool deepCopy=true);
-    MEDCouplingField(MEDCouplingFieldDiscretization *type, NatureOfField nature=NoNature);
-    virtual ~MEDCouplingField();
+    MEDCOUPLING_EXPORT MEDCouplingField(TypeOfField type);
+    MEDCOUPLING_EXPORT MEDCouplingField(const MEDCouplingField& other, bool deepCopy=true);
+    MEDCOUPLING_EXPORT MEDCouplingField(MEDCouplingFieldDiscretization *type, NatureOfField nature=NoNature);
+    MEDCOUPLING_EXPORT virtual ~MEDCouplingField();
+    MEDCOUPLING_EXPORT bool isEqualIfNotWhyProtected(const MEDCouplingField *other, double meshPrec, std::string& reason) const;
+    MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStrProtected(const MEDCouplingField *other, double meshPrec) const;
   protected:
     std::string _name;
     std::string _desc;
     NatureOfField _nature;
     const MEDCouplingMesh *_mesh;
-    MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDiscretization> _type;
+    MCAuto<MEDCouplingFieldDiscretization> _type;
   };
 }