An optional argument --keep2DOri has been added to sauv2med utility that, if provided,
disables reversing mesh faces in 3D space.
//================================================================================
/*!
* \brief Makes ParaMEDMEM::MEDFileData from self
+ * \param [in] keep2DOri - to keep or not orientation of faces in 3D space
+ * \return ParaMEDMEM::MEDFileData* - conversion result
*/
//================================================================================
-ParaMEDMEM::MEDFileData* IntermediateMED::convertInMEDFileDS()
+ParaMEDMEM::MEDFileData* IntermediateMED::convertInMEDFileDS(bool keep2DOri)
{
- MEDCouplingAutoRefCountObjectPtr< MEDFileUMesh > mesh = makeMEDFileMesh();
+ MEDCouplingAutoRefCountObjectPtr< MEDFileUMesh > mesh = makeMEDFileMesh(keep2DOri);
MEDCouplingAutoRefCountObjectPtr< MEDFileFields > fields = makeMEDFileFields(mesh);
MEDCouplingAutoRefCountObjectPtr< MEDFileMeshes > meshes = MEDFileMeshes::New();
*/
//================================================================================
-ParaMEDMEM::MEDFileUMesh* IntermediateMED::makeMEDFileMesh()
+ParaMEDMEM::MEDFileUMesh* IntermediateMED::makeMEDFileMesh(bool keep2DOri)
{
// check if all needed piles are present
checkDataAvailability();
if ( _spaceDim == 2 || _spaceDim == 1 )
orientElements2D();
else if ( _spaceDim == 3 )
- orientElements3D();
+ orientElements3D( keep2DOri );
// process groups
decreaseHierarchicalDepthOfSubgroups();
*/
//================================================================================
-void IntermediateMED::orientElements3D()
+void IntermediateMED::orientElements3D(bool keep2DOri)
{
// set _reverse flags of faces
- orientFaces3D();
+ if ( !keep2DOri )
+ orientFaces3D();
// -----------------
// fix connectivity
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();
+
+ ParaMEDMEM::MEDFileData* convertInMEDFileDS(bool keep2DOri);
private:
- ParaMEDMEM::MEDFileUMesh* makeMEDFileMesh();
+ ParaMEDMEM::MEDFileUMesh* makeMEDFileMesh(bool keep2DOri);
ParaMEDMEM::DataArrayDouble * getCoords();
void setConnectivity( ParaMEDMEM::MEDFileUMesh* mesh, ParaMEDMEM::DataArrayDouble* coords );
void setGroups( ParaMEDMEM::MEDFileUMesh* mesh );
void eraseUselessGroups();
void detectMixDimGroups();
void orientElements2D();
- void orientElements3D();
+ void orientElements3D(bool keep2DOri);
void orientFaces3D();
void orientVolumes();
void numberElements();
*/
//================================================================================
-ParaMEDMEM::MEDFileData * SauvReader::loadInMEDFileDS()
+ParaMEDMEM::MEDFileData * SauvReader::loadInMEDFileDS(bool keep2DOri)
{
SauvUtilities::IntermediateMED iMed; // intermadiate DS
_iMed = &iMed;
THROW_IK_EXCEPTION("XDR : ENREGISTREMENT DE TYPE " << recordNumber << " not implemented!!!");
}
- ParaMEDMEM::MEDFileData* medFileData = iMed.convertInMEDFileDS();
+ ParaMEDMEM::MEDFileData* medFileData = iMed.convertInMEDFileDS( keep2DOri );
return medFileData;
}
{
public:
MEDLOADER_EXPORT static SauvReader* New(const std::string& fileName);
- MEDLOADER_EXPORT ParaMEDMEM::MEDFileData * loadInMEDFileDS();
+ MEDLOADER_EXPORT ParaMEDMEM::MEDFileData * loadInMEDFileDS(bool keep2DOri=false);
MEDLOADER_EXPORT ~SauvReader();
private:
{
public:
static SauvReader* New(const std::string& fileName) throw(INTERP_KERNEL::Exception);
- MEDFileData * loadInMEDFileDS() throw(INTERP_KERNEL::Exception);
+ MEDFileData * loadInMEDFileDS(bool keep2DOri=false) throw(INTERP_KERNEL::Exception);
%extend
{
SauvReader(const std::string& fileName) throw(INTERP_KERNEL::Exception)
#
if driver_in == "GIBI":
sr = SauvReader.New(file_in)
- mfd= sr.loadInMEDFileDS()
+ mfd= sr.loadInMEDFileDS( format )
pass
elif driver_in == "MED":
mfd = MEDFileData(file_in)
raise NotImplementedError("Driver in %s is unknown"%(driver_in))
def sauv2med(*argv):
- argv = list(argv)
+ keep2DOri = ( "--keep2DOri" in argv )
for arg in argv:
- convert(arg, "GIBI", "MED")
+ if not arg.startswith("--keep"):
+ convert(arg, "GIBI", "MED", format = keep2DOri)
pass
return