Salome HOME
22612: [CEA 1189] sauv2med should not change faces orientation
authoreap <eap@opencascade.com>
Thu, 10 Jul 2014 12:36:41 +0000 (16:36 +0400)
committereap <eap@opencascade.com>
Thu, 10 Jul 2014 12:36:41 +0000 (16:36 +0400)
   Suppress fixing orientation of cells

doc/doxygen/doxfiles/tools.dox
src/MEDLoader/SauvMedConvertor.cxx
src/MEDLoader/SauvMedConvertor.hxx
src/MEDLoader/SauvReader.cxx
src/MEDLoader/SauvReader.hxx
src/MEDLoader/Swig/MEDLoaderCommon.i
src/MEDLoader/Swig/medutilities.py

index 2b16d2ae7f030304638e418356d94fe20d8e9f72..8bcba7cd2b2f4b2d5649eedbd83ef3721cbba12e 100644 (file)
@@ -86,9 +86,6 @@ sauv2med myfile.sauv
 \endcode
 generates a \a med file named \a myfile.sauv.med
 
-An optional argument -\-fix2DOri enables an attempt to orient adjacent 
-faces equally in 3D space.
-
 \section med2sauv med2sauv tool
 
 med2sauv operator is the operator that is inverse of sauv2med. Its
index a8fb6db55e41d3a29d97ffa8d72c7f047a9b6a9a..67e28ed1165844545a95d48adb5124509c965e04 100644 (file)
@@ -2373,14 +2373,12 @@ Group* IntermediateMED::addNewGroup(std::vector<SauvUtilities::Group*>* groupsTo
 //================================================================================
 /*!
  * \brief Makes ParaMEDMEM::MEDFileData from self
- *  \param [in] fix2DOri - to fix or not orientation of faces in 3D space
- *  \return ParaMEDMEM::MEDFileData* - conversion result
  */
 //================================================================================
 
-ParaMEDMEM::MEDFileData* IntermediateMED::convertInMEDFileDS(bool fix2DOri)
+ParaMEDMEM::MEDFileData* IntermediateMED::convertInMEDFileDS()
 {
-  MEDCouplingAutoRefCountObjectPtr< MEDFileUMesh >  mesh   = makeMEDFileMesh(fix2DOri);
+  MEDCouplingAutoRefCountObjectPtr< MEDFileUMesh >  mesh   = makeMEDFileMesh();
   MEDCouplingAutoRefCountObjectPtr< MEDFileFields > fields = makeMEDFileFields(mesh);
 
   MEDCouplingAutoRefCountObjectPtr< MEDFileMeshes > meshes = MEDFileMeshes::New();
@@ -2398,7 +2396,7 @@ ParaMEDMEM::MEDFileData* IntermediateMED::convertInMEDFileDS(bool fix2DOri)
  */
 //================================================================================
 
-ParaMEDMEM::MEDFileUMesh* IntermediateMED::makeMEDFileMesh(bool fix2DOri)
+ParaMEDMEM::MEDFileUMesh* IntermediateMED::makeMEDFileMesh()
 {
   // check if all needed piles are present
   checkDataAvailability();
@@ -2410,7 +2408,7 @@ ParaMEDMEM::MEDFileUMesh* IntermediateMED::makeMEDFileMesh(bool fix2DOri)
   if ( _spaceDim == 2 || _spaceDim == 1 )
     orientElements2D();
   else if ( _spaceDim == 3 )
-    orientElements3D( fix2DOri );
+    orientElements3D();
 
   // process groups
   decreaseHierarchicalDepthOfSubgroups();
@@ -2685,42 +2683,43 @@ void IntermediateMED::orientElements2D()
       // --------------------------
       // orient faces clockwise
       // --------------------------
-      int iQuad = isQuadratic ? 2 : 1;
-      for ( elemIt = faces->begin(), elemEnd = faces->end(); elemIt != elemEnd; elemIt++ )
-        {
-          // look for index of the most left node
-          int iLeft = 0, iNode, nbNodes = elemIt->_nodes.size() / iQuad;
-          double x, minX = nodeCoords( elemIt->_nodes[0] )[0];
-          for ( iNode = 1; iNode < nbNodes; ++iNode )
-            if (( x = nodeCoords( elemIt->_nodes[ iNode ])[ 0 ]) < minX )
-              minX = x, iLeft = iNode;
-
-          // indeces of the nodes neighboring the most left one
-          int iPrev = ( iLeft - 1 < 0 ) ? nbNodes - 1 : iLeft - 1;
-          int iNext = ( iLeft + 1 == nbNodes ) ? 0 : iLeft + 1;
-          // find components of prev-left and left-next vectors
-          double xP = nodeCoords( elemIt->_nodes[ iPrev ])[ 0 ];
-          double yP = nodeCoords( elemIt->_nodes[ iPrev ])[ 1 ];
-          double xN = nodeCoords( elemIt->_nodes[ iNext ])[ 0 ];
-          double yN = nodeCoords( elemIt->_nodes[ iNext ])[ 1 ];
-          double xL = nodeCoords( elemIt->_nodes[ iLeft ])[ 0 ];
-          double yL = nodeCoords( elemIt->_nodes[ iLeft ])[ 1 ];
-          double xPL = xL - xP, yPL = yL - yP; // components of prev-left vector
-          double xLN = xN - xL, yLN = yN - yL; // components of left-next vector
-          // normalise y of the vectors
-          double modPL = sqrt ( xPL * xPL + yPL * yPL );
-          double modLN = sqrt ( xLN * xLN + yLN * yLN );
-          if ( modLN > std::numeric_limits<double>::min() &&
-               modPL > std::numeric_limits<double>::min() )
-            {
-              yPL /= modPL;
-              yLN /= modLN;
-              // summary direction of neighboring links must be positive
-              bool clockwise = ( yPL + yLN > 0 );
-              if ( !clockwise )
-                reverse( *elemIt, swapVec );
-            }
-        }
+      // COMMENTED for issue 0022612 note 17739
+      // int iQuad = isQuadratic ? 2 : 1;
+      // for ( elemIt = faces->begin(), elemEnd = faces->end(); elemIt != elemEnd; elemIt++ )
+      //   {
+      //     // look for index of the most left node
+      //     int iLeft = 0, iNode, nbNodes = elemIt->_nodes.size() / iQuad;
+      //     double x, minX = nodeCoords( elemIt->_nodes[0] )[0];
+      //     for ( iNode = 1; iNode < nbNodes; ++iNode )
+      //       if (( x = nodeCoords( elemIt->_nodes[ iNode ])[ 0 ]) < minX )
+      //         minX = x, iLeft = iNode;
+
+      //     // indeces of the nodes neighboring the most left one
+      //     int iPrev = ( iLeft - 1 < 0 ) ? nbNodes - 1 : iLeft - 1;
+      //     int iNext = ( iLeft + 1 == nbNodes ) ? 0 : iLeft + 1;
+      //     // find components of prev-left and left-next vectors
+      //     double xP = nodeCoords( elemIt->_nodes[ iPrev ])[ 0 ];
+      //     double yP = nodeCoords( elemIt->_nodes[ iPrev ])[ 1 ];
+      //     double xN = nodeCoords( elemIt->_nodes[ iNext ])[ 0 ];
+      //     double yN = nodeCoords( elemIt->_nodes[ iNext ])[ 1 ];
+      //     double xL = nodeCoords( elemIt->_nodes[ iLeft ])[ 0 ];
+      //     double yL = nodeCoords( elemIt->_nodes[ iLeft ])[ 1 ];
+      //     double xPL = xL - xP, yPL = yL - yP; // components of prev-left vector
+      //     double xLN = xN - xL, yLN = yN - yL; // components of left-next vector
+      //     // normalise y of the vectors
+      //     double modPL = sqrt ( xPL * xPL + yPL * yPL );
+      //     double modLN = sqrt ( xLN * xLN + yLN * yLN );
+      //     if ( modLN > std::numeric_limits<double>::min() &&
+      //          modPL > std::numeric_limits<double>::min() )
+      //       {
+      //         yPL /= modPL;
+      //         yLN /= modLN;
+      //         // summary direction of neighboring links must be positive
+      //         bool clockwise = ( yPL + yLN > 0 );
+      //         if ( !clockwise )
+      //           reverse( *elemIt, swapVec );
+      //       }
+      //   }
     }
 }
 
@@ -2730,11 +2729,11 @@ void IntermediateMED::orientElements2D()
  */
 //================================================================================
 
-void IntermediateMED::orientElements3D(bool fix2DOri)
+void IntermediateMED::orientElements3D()
 {
   // set _reverse flags of faces
-  if ( fix2DOri )
-    orientFaces3D();
+  // COMMENTED for issue 0022612 note 17739
+  //orientFaces3D();
 
   // -----------------
   // fix connectivity
@@ -2766,7 +2765,8 @@ void IntermediateMED::orientElements3D(bool fix2DOri)
     }
   }
 
-  orientVolumes();
+  // COMMENTED for issue 0022612 note 17739
+  //orientVolumes();
 }
 
 //================================================================================
index efd55aa1f2a0e4c1f199da650dde7293b12f98b0..ebaf41919957960f3aea58a4ada921414a53fd1a 100644 (file)
@@ -255,12 +255,11 @@ namespace SauvUtilities
     int getNbCellsOfType( TCellType type ) const { return _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(bool fix2DOri);
+    ParaMEDMEM::MEDFileData* convertInMEDFileDS();
 
   private:
 
-    ParaMEDMEM::MEDFileUMesh* makeMEDFileMesh(bool fix2DOri);
+    ParaMEDMEM::MEDFileUMesh* makeMEDFileMesh();
     ParaMEDMEM::DataArrayDouble * getCoords();
     void setConnectivity( ParaMEDMEM::MEDFileUMesh* mesh, ParaMEDMEM::DataArrayDouble* coords );
     void setGroups( ParaMEDMEM::MEDFileUMesh* mesh );
@@ -284,7 +283,7 @@ namespace SauvUtilities
     void eraseUselessGroups();
     void detectMixDimGroups();
     void orientElements2D();
-    void orientElements3D(bool fix2DOri);
+    void orientElements3D();
     void orientFaces3D();
     void orientVolumes();
     void numberElements();
index a943bcf2d9be379f7c1da4d707c95793ab0b1684..9b0fce3b8693f17e86cef8f31260ffeb2db73f52 100644 (file)
@@ -112,7 +112,7 @@ std::string SauvReader::lineNb() const
  */
 //================================================================================
 
-ParaMEDMEM::MEDFileData * SauvReader::loadInMEDFileDS(bool fix2DOri)
+ParaMEDMEM::MEDFileData * SauvReader::loadInMEDFileDS()
 {
   SauvUtilities::IntermediateMED iMed; // intermadiate DS
   _iMed = &iMed;
@@ -146,7 +146,7 @@ ParaMEDMEM::MEDFileData * SauvReader::loadInMEDFileDS(bool fix2DOri)
           THROW_IK_EXCEPTION("XDR : ENREGISTREMENT DE TYPE " << recordNumber << " not implemented!!!");
     }
 
-  ParaMEDMEM::MEDFileData* medFileData = iMed.convertInMEDFileDS( fix2DOri );
+  ParaMEDMEM::MEDFileData* medFileData = iMed.convertInMEDFileDS();
 
   return medFileData;
 }
index 1a07854e6d89a6dfdbda229e8f51f489582982ec..533ae0ba451f801456050f6054fd36b1689a63f2 100644 (file)
@@ -47,7 +47,7 @@ class SauvReader : public ParaMEDMEM::RefCountObject
 {
  public:
   MEDLOADER_EXPORT static SauvReader* New(const std::string& fileName);
-  MEDLOADER_EXPORT ParaMEDMEM::MEDFileData * loadInMEDFileDS(bool fix2DOri=false);
+  MEDLOADER_EXPORT ParaMEDMEM::MEDFileData * loadInMEDFileDS();
   MEDLOADER_EXPORT ~SauvReader();
 
  private:
index 5c3c7c81150c9ed0e928a1dadbad6074b10befb3..7a53ab79b46b65fcb48c4c4d134a0d2df767b793 100644 (file)
@@ -2841,7 +2841,7 @@ namespace ParaMEDMEM
   {
   public:
     static SauvReader* New(const std::string& fileName) throw(INTERP_KERNEL::Exception);
-    MEDFileData * loadInMEDFileDS(bool fix2DOri=false) throw(INTERP_KERNEL::Exception);
+    MEDFileData * loadInMEDFileDS() throw(INTERP_KERNEL::Exception);
     %extend
     {
       SauvReader(const std::string& fileName) throw(INTERP_KERNEL::Exception)
index 06fa149f6ac805740541191c1003eeef64189691..98c06bf197e2fe72ea094655ddf88ec84fa70ed8 100644 (file)
@@ -49,7 +49,7 @@ def convert(file_in, driver_in, driver_out, format=1, file_out=None):
     #
     if driver_in == "GIBI":
         sr = SauvReader.New(file_in)
-        mfd= sr.loadInMEDFileDS( format )
+        mfd= sr.loadInMEDFileDS()
         pass
     elif driver_in == "MED":
         mfd = MEDFileData(file_in)
@@ -110,10 +110,9 @@ def convert(file_in, driver_in, driver_out, format=1, file_out=None):
         raise NotImplementedError("Driver in %s is unknown"%(driver_in))
 
 def sauv2med(*argv):
-    fix2DOri = ( "--fix2DOri" in argv )
+    argv = list(argv)
     for arg in argv:
-        if not arg.startswith("--fix"):
-            convert(arg, "GIBI", "MED", format = fix2DOri)
+        convert(arg, "GIBI", "MED")
         pass
     return