+ throw INTERP_KERNEL::Exception("MEDFileStructuredMesh::getGeoTypesAtLevel : only 2 levels available at most : 0 and -1 !");
+ }
+}
+
+void MEDFileStructuredMesh::whichAreNodesFetched(const MEDFileField1TSStructItem& st, const MEDFileFieldGlobsReal *globs, std::vector<bool>& nodesFetched) const
+{
+ if(st.getNumberOfItems()!=1)
+ throw INTERP_KERNEL::Exception("MEDFileStructuredMesh::whichAreNodesFetched : The sturture of field is not lying on single geo type ! it is not managed yet for structured mesh !");
+ if(st[0].getGeo()!=MEDCouplingStructuredMesh::GetGeoTypeGivenMeshDimension(getMeshDimension()))
+ throw INTERP_KERNEL::Exception("MEDFileStructuredMesh::whichAreNodesFetched : The sturture of field is not lying on expected geo type !");
+ if(getNumberOfNodes()!=(int)nodesFetched.size())
+ throw INTERP_KERNEL::Exception("MEDFileStructuredMesh::whichAreNodesFetched : invalid size of array !");
+ if(st[0].getPflName().empty())
+ {
+ std::fill(nodesFetched.begin(),nodesFetched.end(),true);
+ return ;
+ }
+ const DataArrayInt *arr(globs->getProfile(st[0].getPflName()));
+ const MEDCouplingStructuredMesh *cmesh=getStructuredMesh();//cmesh not null because getNumberOfNodes called before
+ int sz(nodesFetched.size());
+ for(const int *work=arr->begin();work!=arr->end();work++)
+ {
+ std::vector<int> conn;
+ cmesh->getNodeIdsOfCell(*work,conn);
+ for(std::vector<int>::const_iterator it=conn.begin();it!=conn.end();it++)
+ if(*it>=0 && *it<sz)
+ nodesFetched[*it]=true;
+ else
+ throw INTERP_KERNEL::Exception("MEDFileStructuredMesh::whichAreNodesFetched : internal error !");
+ }
+}
+
+med_geometry_type MEDFileStructuredMesh::GetGeoTypeFromMeshDim(int meshDim)
+{
+ INTERP_KERNEL::NormalizedCellType ct(MEDCouplingStructuredMesh::GetGeoTypeGivenMeshDimension(meshDim));
+ return typmai3[ct];
+}
+
+void MEDFileStructuredMesh::LoadStrMeshDAFromFile(med_idt fid, int meshDim, int dt, int it, const std::string& mName, MEDFileMeshReadSelector *mrs,
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt>& famCells, MEDCouplingAutoRefCountObjectPtr<DataArrayInt>& numCells, MEDCouplingAutoRefCountObjectPtr<DataArrayAsciiChar>& namesCells)
+{
+ med_bool chgt=MED_FALSE,trsf=MED_FALSE;
+ med_geometry_type geoTypeReq=MEDFileStructuredMesh::GetGeoTypeFromMeshDim(meshDim);
+ int nbOfElt(0);
+ nbOfElt=MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_CELL,geoTypeReq,MED_FAMILY_NUMBER,MED_NODAL,&chgt,&trsf);
+ if(nbOfElt>0)
+ {
+ if(!mrs || mrs->isCellFamilyFieldReading())
+ {
+ famCells=DataArrayInt::New();
+ famCells->alloc(nbOfElt,1);
+ MEDmeshEntityFamilyNumberRd(fid,mName.c_str(),dt,it,MED_CELL,geoTypeReq,famCells->getPointer());
+ }
+ }
+ nbOfElt=MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_CELL,geoTypeReq,MED_NUMBER,MED_NODAL,&chgt,&trsf);
+ if(nbOfElt>0)
+ {
+ if(!mrs || mrs->isCellNumFieldReading())
+ {
+ numCells=DataArrayInt::New();
+ numCells->alloc(nbOfElt,1);
+ MEDmeshEntityNumberRd(fid,mName.c_str(),dt,it,MED_CELL,geoTypeReq,numCells->getPointer());
+ }
+ }
+ nbOfElt=MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_CELL,geoTypeReq,MED_NAME,MED_NODAL,&chgt,&trsf);
+ if(nbOfElt>0)
+ {
+ if(!mrs || mrs->isCellNameFieldReading())
+ {
+ namesCells=DataArrayAsciiChar::New();
+ namesCells->alloc(nbOfElt+1,MED_SNAME_SIZE);//not a bug to avoid the memory corruption due to last \0 at the end
+ MEDmeshEntityNameRd(fid,mName.c_str(),dt,it,MED_CELL,geoTypeReq,namesCells->getPointer());
+ namesCells->reAlloc(nbOfElt);//not a bug to avoid the memory corruption due to last \0 at the end
+ }