Salome HOME
#19727 [CEA][Windows] MEDCOUPLING MEDFileMesh.hxx
[tools/medcoupling.git] / src / MEDLoader / SauvMedConvertor.hxx
index ebaf41919957960f3aea58a4ada921414a53fd1a..f07364f60c756f077593018069129d6631a7b59d 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2014  CEA/DEN, EDF R&D
+// Copyright (C) 2007-2020  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
@@ -28,6 +28,7 @@
 #include "NormalizedUnstructuredMesh.hxx"
 #include "MEDCouplingRefCountObject.hxx"
 #include "SauvUtilities.hxx"
+#include "MCType.hxx"
 
 #include <vector>
 #include <set>
@@ -35,7 +36,7 @@
 #include <list>
 #include <algorithm>
 
-namespace ParaMEDMEM
+namespace MEDCoupling
 {
   class DataArrayDouble;
   class DataArrayInt;
@@ -50,7 +51,7 @@ namespace SauvUtilities
   struct IntermediateMED;
 
   // ==============================================================================
-  typedef int                TID;  // an ID countered from 1
+  typedef mcIdType           TID;  // an ID countered from 1
   typedef std::pair<TID,TID> Link; // a pair of node numbers
 
   typedef INTERP_KERNEL::NormalizedCellType TCellType;
@@ -69,7 +70,7 @@ namespace SauvUtilities
   struct Cell
   {
     std::vector< Node* > _nodes;
-    mutable bool         _reverse; // to reverse orienation of a face only
+    mutable bool         _reverse; // to reverse orientation of a face only
     mutable TID*         _sortedNodeIDs; // for comparison
     mutable TID          _number;
 
@@ -102,11 +103,11 @@ namespace SauvUtilities
                                             reference is converted into a copy of the medGroup
                                             (issue 0021311)
                                          */
-    ParaMEDMEM::DataArrayInt* _medGroup;   // result of conversion
-    std::vector< unsigned >   _relocTable; // for _cells[i] gives its index in _medGroup
+    MEDCoupling::DataArrayIdType* _medGroup;   // result of conversion
+    std::vector< mcIdType >       _relocTable; // for _cells[i] gives its index in _medGroup
 
     bool empty() const { return _cells.empty() && _groups.empty(); }
-    int  size()  const;
+    mcIdType  size()  const;
     Group():_cellType(INTERP_KERNEL::NORM_ERROR), _isProfile(false), _medGroup(NULL) {}
   };
 
@@ -125,7 +126,7 @@ namespace SauvUtilities
 
       void setData( int nb_comp, Group* supp )
       { _support = supp; _comp_names.resize(nb_comp); _nb_gauss.resize(nb_comp,1); }
-      int  nbComponents() const { return _comp_names.size(); }
+      int  nbComponents() const { return (int)_comp_names.size(); }
       std::string & compName( int i_comp ) { return _comp_names[ i_comp ]; }
       bool isSameNbGauss() const { return *std::max_element( _nb_gauss.begin(), _nb_gauss.end() ) ==
           *std::min_element( _nb_gauss.begin(), _nb_gauss.end() ); }
@@ -144,7 +145,7 @@ namespace SauvUtilities
                                         is the same and supports of subcomponents do not overlap
                                      */
     std::vector< std::vector< double > > _comp_values;
-    ParaMEDMEM::MEDFileFieldMultiTS*     _curMedField;
+    MEDCoupling::MEDFileFieldMultiTS*     _curMedField;
 
     DoubleField( int nb_sub, int total_nb_comp )
       : _sub(nb_sub), _group(NULL), _curMedField(NULL) { _comp_values.reserve( total_nb_comp ); }
@@ -155,13 +156,13 @@ namespace SauvUtilities
 
     bool isMultiTimeStamps() const;
     bool isMedCompatible(bool& sameNbGauss) const;
-    ParaMEDMEM::TypeOfField getMedType( const int iSub=0 ) const;
-    ParaMEDMEM::TypeOfTimeDiscretization getMedTimeDisc() const;
-    int getNbTuples( const int iSub=0 ) const;
+    MEDCoupling::TypeOfField getMedType( const int iSub=0 ) const;
+    MEDCoupling::TypeOfTimeDiscretization getMedTimeDisc() const;
+    mcIdType getNbTuples( const int iSub=0 ) const;
     int getNbValuesPerElement( const int iSub=0 ) const;
     int getNbGauss( const int iSub=0 ) const;
     const Group* getSupport( const int iSub=0 ) const;
-    int setValues( double * valPtr, const int iSub, const int elemShift=0 ) const;
+    mcIdType setValues( double * valPtr, const int iSub, const mcIdType elemShift=0 ) const;
     void splitSubWithDiffNbGauss();
 
     //virtual void dump(std::ostream&) const;
@@ -169,7 +170,7 @@ namespace SauvUtilities
   };
   // ==============================================================================
   /*!
-   * \if developper
+   * \if developer
    * Iterator on set of Cell's of given dimension
    * \endif
    */
@@ -194,7 +195,7 @@ namespace SauvUtilities
 
   // ==============================================================================
   /*!
-   * \if developper
+   * \if developer
    * Container of Node's. Prevents re-allocation at addition of Node's
    * \endif
    */
@@ -225,7 +226,7 @@ namespace SauvUtilities
 
   // ==============================================================================
   /*!
-   * \if developper
+   * \if developer
    * Intermediate structure used to store data read from the Sauve format file.
    * The structure provides functions that transform the stored data to the MED format
    *
@@ -252,27 +253,27 @@ namespace SauvUtilities
     ~IntermediateMED();
 
     Node* getNode( TID nID ) { return _points.getNode( nID ); }
-    int getNbCellsOfType( TCellType type ) const { return _cellsByType[type].size(); }
+    mcIdType getNbCellsOfType( TCellType type ) const { return ToIdType(_cellsByType[type].size()); }
     const Cell* insert(TCellType type, const Cell& ma) { return &( *_cellsByType[type].insert( ma ).first ); }
     Group* addNewGroup(std::vector<SauvUtilities::Group*>* groupsToFix=0);
-    ParaMEDMEM::MEDFileData* convertInMEDFileDS();
+    MEDCoupling::MEDFileData* convertInMEDFileDS();
 
   private:
 
-    ParaMEDMEM::MEDFileUMesh* makeMEDFileMesh();
-    ParaMEDMEM::DataArrayDouble * getCoords();
-    void setConnectivity( ParaMEDMEM::MEDFileUMesh* mesh, ParaMEDMEM::DataArrayDouble* coords );
-    void setGroups( ParaMEDMEM::MEDFileUMesh* mesh );
-    ParaMEDMEM::MEDFileFields * makeMEDFileFields(ParaMEDMEM::MEDFileUMesh* mesh);
+    MEDCoupling::MEDFileUMesh* makeMEDFileMesh();
+    MEDCoupling::DataArrayDouble * getCoords();
+    void setConnectivity( MEDCoupling::MEDFileUMesh* mesh, MEDCoupling::DataArrayDouble* coords );
+    void setGroups( MEDCoupling::MEDFileUMesh* mesh );
+    MEDCoupling::MEDFileFields * makeMEDFileFields(MEDCoupling::MEDFileUMesh* mesh);
     void setFields( SauvUtilities::DoubleField*    fld,
-                    ParaMEDMEM::MEDFileFields*     medFields,
-                    ParaMEDMEM::MEDFileUMesh*      mesh,
+                    MEDCoupling::MEDFileFields*     medFields,
+                    MEDCoupling::MEDFileUMesh*      mesh,
                     const TID                      castemID,
                     std::set< std::string >&       usedNames);
     void setTS( SauvUtilities::DoubleField*  fld,
-                ParaMEDMEM::DataArrayDouble* values,
-                ParaMEDMEM::MEDFileFields*   medFields,
-                ParaMEDMEM::MEDFileUMesh*    mesh,
+                MEDCoupling::DataArrayDouble* values,
+                MEDCoupling::MEDFileFields*   medFields,
+                MEDCoupling::MEDFileUMesh*    mesh,
                 const int                    iSub=0);
     void checkDataAvailability() const;
     void setGroupLongNames();
@@ -325,7 +326,7 @@ namespace SauvUtilities
     virtual double getDouble() const;
     virtual std::string getName() const;
     int lineNb() const { return _lineNb; }
-
+    std::string getClassName() const override { return std::string("ASCIIReader"); }
   private:
 
     bool getLine(char* & line);
@@ -363,7 +364,7 @@ namespace SauvUtilities
     virtual float  getFloat() const;
     virtual double getDouble() const;
     virtual std::string getName() const;
-
+    std::string getClassName() const override { return std::string("XDRReader"); }
   private:
 
     void init( int nbToRead, int width = 0 );