From ba63422f07d64dc36cbdeed4060a00db1069d9db Mon Sep 17 00:00:00 2001 From: eap Date: Fri, 27 Jun 2014 19:10:48 +0400 Subject: [PATCH] 22612: [CEA 1189] sauv2med should not change faces orientation Invert a default behavior --- doc/doxygen/doxfiles/tools.dox | 5 ++--- src/MEDLoader/SauvMedConvertor.cxx | 14 +++++++------- src/MEDLoader/SauvMedConvertor.hxx | 6 +++--- src/MEDLoader/SauvReader.cxx | 4 ++-- src/MEDLoader/SauvReader.hxx | 2 +- src/MEDLoader/Swig/MEDLoaderCommon.i | 2 +- src/MEDLoader/Swig/medutilities.py | 6 +++--- 7 files changed, 19 insertions(+), 20 deletions(-) diff --git a/doc/doxygen/doxfiles/tools.dox b/doc/doxygen/doxfiles/tools.dox index f5dcb1df5..b6a51b31c 100644 --- a/doc/doxygen/doxfiles/tools.dox +++ b/doc/doxygen/doxfiles/tools.dox @@ -86,9 +86,8 @@ sauv2med myfile.sauv \endcode generates a \a med file named \a myfile.sauv.med -An optional argument --keep2DOri allows preventing reversion of mesh faces -in 3D space. If this option is not provided, there is an attempt to orient -adjacent faces equally. +An optional argument --fix2DOri enables an attempt to orient adjacent +faces equally in 3D space. \section med2sauv med2sauv tool diff --git a/src/MEDLoader/SauvMedConvertor.cxx b/src/MEDLoader/SauvMedConvertor.cxx index 4c9caf41f..a8fb6db55 100644 --- a/src/MEDLoader/SauvMedConvertor.cxx +++ b/src/MEDLoader/SauvMedConvertor.cxx @@ -2373,14 +2373,14 @@ Group* IntermediateMED::addNewGroup(std::vector* groupsTo //================================================================================ /*! * \brief Makes ParaMEDMEM::MEDFileData from self - * \param [in] keep2DOri - to keep or not orientation of faces in 3D space + * \param [in] fix2DOri - to fix or not orientation of faces in 3D space * \return ParaMEDMEM::MEDFileData* - conversion result */ //================================================================================ -ParaMEDMEM::MEDFileData* IntermediateMED::convertInMEDFileDS(bool keep2DOri) +ParaMEDMEM::MEDFileData* IntermediateMED::convertInMEDFileDS(bool fix2DOri) { - MEDCouplingAutoRefCountObjectPtr< MEDFileUMesh > mesh = makeMEDFileMesh(keep2DOri); + MEDCouplingAutoRefCountObjectPtr< MEDFileUMesh > mesh = makeMEDFileMesh(fix2DOri); MEDCouplingAutoRefCountObjectPtr< MEDFileFields > fields = makeMEDFileFields(mesh); MEDCouplingAutoRefCountObjectPtr< MEDFileMeshes > meshes = MEDFileMeshes::New(); @@ -2398,7 +2398,7 @@ ParaMEDMEM::MEDFileData* IntermediateMED::convertInMEDFileDS(bool keep2DOri) */ //================================================================================ -ParaMEDMEM::MEDFileUMesh* IntermediateMED::makeMEDFileMesh(bool keep2DOri) +ParaMEDMEM::MEDFileUMesh* IntermediateMED::makeMEDFileMesh(bool fix2DOri) { // check if all needed piles are present checkDataAvailability(); @@ -2410,7 +2410,7 @@ ParaMEDMEM::MEDFileUMesh* IntermediateMED::makeMEDFileMesh(bool keep2DOri) if ( _spaceDim == 2 || _spaceDim == 1 ) orientElements2D(); else if ( _spaceDim == 3 ) - orientElements3D( keep2DOri ); + orientElements3D( fix2DOri ); // process groups decreaseHierarchicalDepthOfSubgroups(); @@ -2730,10 +2730,10 @@ void IntermediateMED::orientElements2D() */ //================================================================================ -void IntermediateMED::orientElements3D(bool keep2DOri) +void IntermediateMED::orientElements3D(bool fix2DOri) { // set _reverse flags of faces - if ( !keep2DOri ) + if ( fix2DOri ) orientFaces3D(); // ----------------- diff --git a/src/MEDLoader/SauvMedConvertor.hxx b/src/MEDLoader/SauvMedConvertor.hxx index 7d076876f..efd55aa1f 100644 --- a/src/MEDLoader/SauvMedConvertor.hxx +++ b/src/MEDLoader/SauvMedConvertor.hxx @@ -256,11 +256,11 @@ namespace SauvUtilities const Cell* insert(TCellType type, const Cell& ma) { return &( *_cellsByType[type].insert( ma ).first ); } Group* addNewGroup(std::vector* groupsToFix=0); - ParaMEDMEM::MEDFileData* convertInMEDFileDS(bool keep2DOri); + ParaMEDMEM::MEDFileData* convertInMEDFileDS(bool fix2DOri); private: - ParaMEDMEM::MEDFileUMesh* makeMEDFileMesh(bool keep2DOri); + ParaMEDMEM::MEDFileUMesh* makeMEDFileMesh(bool fix2DOri); ParaMEDMEM::DataArrayDouble * getCoords(); void setConnectivity( ParaMEDMEM::MEDFileUMesh* mesh, ParaMEDMEM::DataArrayDouble* coords ); void setGroups( ParaMEDMEM::MEDFileUMesh* mesh ); @@ -284,7 +284,7 @@ namespace SauvUtilities void eraseUselessGroups(); void detectMixDimGroups(); void orientElements2D(); - void orientElements3D(bool keep2DOri); + void orientElements3D(bool fix2DOri); void orientFaces3D(); void orientVolumes(); void numberElements(); diff --git a/src/MEDLoader/SauvReader.cxx b/src/MEDLoader/SauvReader.cxx index 65b24cca9..a943bcf2d 100644 --- a/src/MEDLoader/SauvReader.cxx +++ b/src/MEDLoader/SauvReader.cxx @@ -112,7 +112,7 @@ std::string SauvReader::lineNb() const */ //================================================================================ -ParaMEDMEM::MEDFileData * SauvReader::loadInMEDFileDS(bool keep2DOri) +ParaMEDMEM::MEDFileData * SauvReader::loadInMEDFileDS(bool fix2DOri) { SauvUtilities::IntermediateMED iMed; // intermadiate DS _iMed = &iMed; @@ -146,7 +146,7 @@ ParaMEDMEM::MEDFileData * SauvReader::loadInMEDFileDS(bool keep2DOri) THROW_IK_EXCEPTION("XDR : ENREGISTREMENT DE TYPE " << recordNumber << " not implemented!!!"); } - ParaMEDMEM::MEDFileData* medFileData = iMed.convertInMEDFileDS( keep2DOri ); + ParaMEDMEM::MEDFileData* medFileData = iMed.convertInMEDFileDS( fix2DOri ); return medFileData; } diff --git a/src/MEDLoader/SauvReader.hxx b/src/MEDLoader/SauvReader.hxx index bc0ae764b..1a07854e6 100644 --- a/src/MEDLoader/SauvReader.hxx +++ b/src/MEDLoader/SauvReader.hxx @@ -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 keep2DOri=false); + MEDLOADER_EXPORT ParaMEDMEM::MEDFileData * loadInMEDFileDS(bool fix2DOri=false); MEDLOADER_EXPORT ~SauvReader(); private: diff --git a/src/MEDLoader/Swig/MEDLoaderCommon.i b/src/MEDLoader/Swig/MEDLoaderCommon.i index 3b44ba218..5c3c7c811 100644 --- a/src/MEDLoader/Swig/MEDLoaderCommon.i +++ b/src/MEDLoader/Swig/MEDLoaderCommon.i @@ -2841,7 +2841,7 @@ namespace ParaMEDMEM { public: static SauvReader* New(const std::string& fileName) throw(INTERP_KERNEL::Exception); - MEDFileData * loadInMEDFileDS(bool keep2DOri=false) throw(INTERP_KERNEL::Exception); + MEDFileData * loadInMEDFileDS(bool fix2DOri=false) throw(INTERP_KERNEL::Exception); %extend { SauvReader(const std::string& fileName) throw(INTERP_KERNEL::Exception) diff --git a/src/MEDLoader/Swig/medutilities.py b/src/MEDLoader/Swig/medutilities.py index c99898e0c..06fa149f6 100644 --- a/src/MEDLoader/Swig/medutilities.py +++ b/src/MEDLoader/Swig/medutilities.py @@ -110,10 +110,10 @@ 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): - keep2DOri = ( "--keep2DOri" in argv ) + fix2DOri = ( "--fix2DOri" in argv ) for arg in argv: - if not arg.startswith("--keep"): - convert(arg, "GIBI", "MED", format = keep2DOri) + if not arg.startswith("--fix"): + convert(arg, "GIBI", "MED", format = fix2DOri) pass return -- 2.39.2