ret.push_back((const DataArrayAsciiChar *)_names_faces);
if((const DataArrayInt *)_rev_num_cells)
ret.push_back((const DataArrayInt *)_rev_num_cells);
+ if((const MEDCoupling1SGTUMesh*)_faces_if_necessary)
+ ret.push_back((const MEDCoupling1SGTUMesh*)_faces_if_necessary);
return ret;
}
{
if(!m)
throw INTERP_KERNEL::Exception("MEDFileStructuredMesh::getGenMeshAtLevel : level -1 requested must be non empty to be able to compute unstructured sub mesh !");
- return _faces_if_necessary;
+ buildMinusOneImplicitPartIfNeeded();
+ MEDCouplingMesh *ret(_faces_if_necessary);
+ if(ret)
+ ret->incrRef();
+ return ret;
}
default:
throw INTERP_KERNEL::Exception("MEDFileCurveLinearMesh does not support multi level for mesh 0 expected as input !");
const INTERP_KERNEL::CellModel& cm(INTERP_KERNEL::CellModel::GetCellModel(MEDCouplingStructuredMesh::GetGeoTypeGivenMeshDimension(getMeshDimension())));
if(cm.getReverseExtrudedType()!=gt)
throw INTERP_KERNEL::Exception(MSG);
- const MEDCouplingStructuredMesh *mcmesh(getStructuredMesh());
- _faces_if_necessary=mcmesh->build1SGTSubLevelMesh();
- return mcmesh->getNumberOfCellsOfSubLevelMesh();
+ buildImplicitPart();
+ return getStructuredMesh()->getNumberOfCellsOfSubLevelMesh();
}
else
{
}
}
+void MEDFileStructuredMesh::buildMinusOneImplicitPartIfNeeded() const
+{
+ const MEDCoupling1SGTUMesh *zeFaceMesh(_faces_if_necessary);
+ if(!zeFaceMesh)
+ buildImplicitPart();
+}
+
+void MEDFileStructuredMesh::buildImplicitPart() const
+{
+ const MEDCouplingStructuredMesh *mcmesh(getStructuredMesh());
+ if(!mcmesh)
+ throw INTERP_KERNEL::Exception("MEDFileStructuredMesh::buildImplicitPart : Unable to build the implicit part of structured mesh because no structured mesh at level 0 defined !");
+ _faces_if_necessary=mcmesh->build1SGTSubLevelMesh();
+}
+
void MEDFileStructuredMesh::releaseImplicitPartIfAny() const
{
_faces_if_necessary=0;
return new MEDFileMeshesIterator(this);
}
+/** Return a borrowed reference (caller is not responsible) */
MEDFileMesh *MEDFileMeshes::getMeshAtPos(int i) const
{
if(i<0 || i>=(int)_meshes.size())
return _meshes[i]->getOneTimeStep();
}
+/** Return a borrowed reference (caller is not responsible) */
MEDFileMesh *MEDFileMeshes::getMeshWithName(const std::string& mname) const
{
std::vector<std::string> ms=getMeshesNames();