+ MEDCouplingAutoRefCountObjectPtr<MEDFileMesh> mm(MEDFileMesh::New(fileName,meshName));
+ MEDFileMesh *mmPtr(mm);
+ MEDFileUMesh *mmuPtr=dynamic_cast<MEDFileUMesh *>(mmPtr);
+ if(mmuPtr)
+ return mmuPtr->getMeshAtLevel(meshDimRelToMax,true);
+ MEDFileCMesh *mmcPtr=dynamic_cast<MEDFileCMesh *>(mmPtr);
+ if(mmcPtr)
+ {
+ const MEDCouplingCMesh *ret(mmcPtr->getMesh()); ret->incrRef();
+ return const_cast<MEDCouplingCMesh *>(ret);
+ }
+ MEDFileCurveLinearMesh *mmc2Ptr=dynamic_cast<MEDFileCurveLinearMesh *>(mmPtr);
+ if(mmc2Ptr)
+ {
+ const MEDCouplingCurveLinearMesh *ret(mmc2Ptr->getMesh()); ret->incrRef();
+ return const_cast<MEDCouplingCurveLinearMesh *>(ret);
+ }
+ std::ostringstream oss; oss << "MEDLoader::ReadMeshFromFile : The mesh \"" << meshName << "\" in file \"" << fileName << "\" has not a recognized type !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+}
+
+ParaMEDMEM::MEDCouplingMesh *MEDLoader::ReadMeshFromFile(const std::string& fileName, int meshDimRelToMax)
+{
+ CheckFileForRead(fileName);
+ MEDCouplingAutoRefCountObjectPtr<MEDFileMesh> mm(MEDFileMesh::New(fileName));
+ MEDFileMesh *mmPtr(mm);
+ MEDFileUMesh *mmuPtr=dynamic_cast<MEDFileUMesh *>(mmPtr);
+ if(mmuPtr)
+ return mmuPtr->getMeshAtLevel(meshDimRelToMax,true);
+ MEDFileCMesh *mmcPtr=dynamic_cast<MEDFileCMesh *>(mmPtr);
+ if(mmcPtr)
+ {
+ const MEDCouplingCMesh *ret(mmcPtr->getMesh()); ret->incrRef();
+ return const_cast<MEDCouplingCMesh *>(ret);
+ }
+ MEDFileCurveLinearMesh *mmc2Ptr=dynamic_cast<MEDFileCurveLinearMesh *>(mmPtr);
+ if(mmc2Ptr)
+ {
+ const MEDCouplingCurveLinearMesh *ret(mmc2Ptr->getMesh()); ret->incrRef();
+ return const_cast<MEDCouplingCurveLinearMesh *>(ret);
+ }
+ std::ostringstream oss; oss << "MEDLoader::ReadMeshFromFile (2) : The first mesh \"" << mm->getName() << "\" in file \"" << fileName << "\" has not a recognized type !";
+ throw INTERP_KERNEL::Exception(oss.str().c_str());
+}
+
+ParaMEDMEM::MEDCouplingUMesh *MEDLoader::ReadUMeshFromFile(const std::string& fileName, const std::string& meshName, int meshDimRelToMax)
+{
+ CheckFileForRead(fileName);
+ MEDCouplingAutoRefCountObjectPtr<MEDFileMesh> mm(MEDFileMesh::New(fileName,meshName));