From 9f5dbfb52e5f1bebdf2b7ff0106868917f7fd9d5 Mon Sep 17 00:00:00 2001 From: Anthony Geay Date: Fri, 17 Oct 2014 15:00:54 +0200 Subject: [PATCH] Solve bug EDF#8655 definitely. --- .../IO/MEDFileFieldRepresentationTree.cxx | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/Plugins/MEDReader/IO/MEDFileFieldRepresentationTree.cxx b/src/Plugins/MEDReader/IO/MEDFileFieldRepresentationTree.cxx index 3669c63c..f9df2d33 100644 --- a/src/Plugins/MEDReader/IO/MEDFileFieldRepresentationTree.cxx +++ b/src/Plugins/MEDReader/IO/MEDFileFieldRepresentationTree.cxx @@ -1151,7 +1151,24 @@ void MEDFileFieldRepresentationTree::loadMainStructureOfFile(const char *fileNam { MEDCouplingAutoRefCountObjectPtr fmts((*fields)->getFieldAtPos((int)j)); std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeFieldMultiTS > > tmp(fmts->splitDiscretizations()); - allFMTSLeavesToDisplaySafe.insert(allFMTSLeavesToDisplaySafe.end(),tmp.begin(),tmp.end()); + // EDF 8655 + for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeFieldMultiTS > >::const_iterator it=tmp.begin();it!=tmp.end();it++) + { + if(!(*it)->presenceOfMultiDiscPerGeoType()) + allFMTSLeavesToDisplaySafe.push_back(*it); + else + {// The case of some parts of field have more than one discretization per geo type. + std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeFieldMultiTS > > subTmp((*it)->splitMultiDiscrPerGeoTypes()); + std::size_t it0Cnt(0); + for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileAnyTypeFieldMultiTS > >::iterator it0=subTmp.begin();it0!=subTmp.end();it0++,it0Cnt++)//not const because setName + { + std::ostringstream oss; oss << (*it0)->getName() << "_" << std::setfill('M') << std::setw(3) << it0Cnt; + (*it0)->setName(oss.str()); + allFMTSLeavesToDisplaySafe.push_back(*it0); + } + } + } + // end EDF 8655 } } std::vector< MEDFileAnyTypeFieldMultiTS *> allFMTSLeavesToDisplay(allFMTSLeavesToDisplaySafe.size()); -- 2.39.2