From: ageay Date: Wed, 8 Feb 2012 10:25:03 +0000 (+0000) Subject: GF new func. X-Git-Tag: V6_main_FINAL~883 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=66488e6e5aeac572c3189bc9c09226ccbb4c6e97;p=tools%2Fmedcoupling.git GF new func. --- diff --git a/src/MEDLoader/MEDFileField.cxx b/src/MEDLoader/MEDFileField.cxx index 5512563c7..797b97394 100644 --- a/src/MEDLoader/MEDFileField.cxx +++ b/src/MEDLoader/MEDFileField.cxx @@ -451,6 +451,15 @@ DataArrayDouble *MEDFileFieldPerMeshPerTypePerDisc::getUndergroundDataArray() co return const_cast(ret); } +void MEDFileFieldPerMeshPerTypePerDisc::fillValues(int discId, int& startTupleId, int& startEntryId, std::vector< std::pair,std::pair > >& entries, double *vals) const +{ + int endTupleId=startTupleId+_arr->getNumberOfTuples(); + entries[startEntryId]=std::pair ,std::pair >(std::pair((int)getGeoType(),discId),std::pair(startTupleId,endTupleId)); + std::copy(_arr->begin(),_arr->end(),vals+startTupleId*_arr->getNumberOfComponents()); + startEntryId++; + startTupleId=endTupleId; +} + void MEDFileFieldPerMeshPerTypePerDisc::writeLL(med_idt fid) const throw(INTERP_KERNEL::Exception) { TypeOfField type=getType(); @@ -738,6 +747,15 @@ std::string MEDFileFieldPerMeshPerType::getMeshName() const return _father->getMeshName(); } +void MEDFileFieldPerMeshPerType::getSizes(int& globalSz, int& nbOfEntries) const +{ + for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++) + { + globalSz+=(*it)->getUndergroundDataArray()->getNumberOfTuples(); + } + nbOfEntries+=(int)_field_pm_pt_pd.size(); +} + INTERP_KERNEL::NormalizedCellType MEDFileFieldPerMeshPerType::getGeoType() const { return _geo_type; @@ -799,6 +817,15 @@ DataArrayDouble *MEDFileFieldPerMeshPerType::getUndergroundDataArray() const thr return _field_pm_pt_pd[0]->getUndergroundDataArray(); } +void MEDFileFieldPerMeshPerType::fillValues(int& startTupleId, int& startEntryId, std::vector< std::pair,std::pair > >& entries, double *vals) const +{ + int i=0; + for(std::vector< MEDCouplingAutoRefCountObjectPtr >::const_iterator it=_field_pm_pt_pd.begin();it!=_field_pm_pt_pd.end();it++,i++) + { + (*it)->fillValues(i,startTupleId,startEntryId,entries,vals); + } +} + MEDFileFieldPerMeshPerType::MEDFileFieldPerMeshPerType(MEDFileFieldPerMesh *fath, INTERP_KERNEL::NormalizedCellType geoType) throw(INTERP_KERNEL::Exception):_father(fath),_geo_type(geoType) { } @@ -1255,6 +1282,30 @@ DataArrayDouble *MEDFileFieldPerMesh::getUndergroundDataArray() const throw(INTE return _field_pm_pt[0]->getUndergroundDataArray(); } +DataArrayDouble *MEDFileFieldPerMesh::getUndergroundDataArrayExt(std::vector< std::pair,std::pair > >& entries) const throw(INTERP_KERNEL::Exception) +{ + int globalSz=0; + int nbOfEntries=0; + for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) + { + (*it)->getSizes(globalSz,nbOfEntries); + } + MEDCouplingAutoRefCountObjectPtr ret=DataArrayDouble::New(); + int nbOfComponents=_father->getInfo().size(); + ret->alloc(globalSz,nbOfComponents); + ret->setInfoOnComponents(_father->getInfo()); + entries.resize(nbOfEntries); + double *pt=ret->getPointer(); + globalSz=0; + nbOfEntries=0; + for(std::vector< MEDCouplingAutoRefCountObjectPtr< MEDFileFieldPerMeshPerType > >::const_iterator it=_field_pm_pt.begin();it!=_field_pm_pt.end();it++) + { + (*it)->fillValues(globalSz,nbOfEntries,entries,pt); + } + ret->incrRef(); + return ret; +} + int MEDFileFieldPerMesh::addNewEntryIfNecessary(INTERP_KERNEL::NormalizedCellType type) { int i=0; @@ -1876,7 +1927,7 @@ void MEDFileField1TSWithoutDAS::copyTinyInfoFrom(const MEDCouplingFieldDouble *f if(!arr) throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutDAS::copyTinyInfoFrom : no array set !"); _dt=field->getTime(_iteration,_order); - _infos=arr->getInfoOnComponent(); + _infos=arr->getInfoOnComponents(); } std::string MEDFileField1TSWithoutDAS::getMeshName() const throw(INTERP_KERNEL::Exception) @@ -2174,7 +2225,8 @@ DataArrayDouble *MEDFileField1TSWithoutDAS::getFieldWithProfile(TypeOfField type } /*! - * This method retrieves direct access to the underground ParaMEDMEM::DataArrayDouble instance. + * This method retrieves direct access to the underground ParaMEDMEM::DataArrayDouble instance. The returned array is not a newly + * created array so it should \b not be dealed by the caller. * This method allows to the user a direct access to the values. * This method throws an exception if 'this' is composed with multiple arrays due to cell type splitting (field on cells and field on gauss points). */ @@ -2187,6 +2239,22 @@ DataArrayDouble *MEDFileField1TSWithoutDAS::getUndergroundDataArray() const thro return _field_per_mesh[0]->getUndergroundDataArray(); } +/*! + * This method returns an array that the caller must deal with (contrary to those returned by MEDFileField1TSWithoutDAS::getUndergroundDataArray method). + * The returned array is the result of the aggregation of all sub arrays stored in the MED file. So to allow the caller to select the output param + * 'entries' is returned. This output param is a vector of a pair of 2 pairs. The first pair of pair informs of the geometric type it refers to and the discretization + * id attached to it. The second pair of pair precise the range [begin,end) into the returned array. + * This method makes the hypothesis that the field lies only on one mesh. If it is not the case an exception will be thrown. + */ +DataArrayDouble *MEDFileField1TSWithoutDAS::getUndergroundDataArrayExt(std::vector< std::pair,std::pair > >& entries) const throw(INTERP_KERNEL::Exception) +{ + if(_field_per_mesh.size()!=1) + throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutDAS::getUndergroundDataArrayExt : field lies on several meshes, this method has no sense !"); + if(_field_per_mesh[0]==0) + throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutDAS::getUndergroundDataArrayExt : no field specified !"); + return _field_per_mesh[0]->getUndergroundDataArrayExt(entries); +} + MEDFileField1TSWithoutDAS::MEDFileField1TSWithoutDAS(const char *fieldName, int csit, int iteration, int order, const std::vector& infos):_name(fieldName),_infos(infos),_csit(csit),_iteration(iteration),_order(order) { @@ -2467,6 +2535,22 @@ const std::vector& MEDFileFieldMultiTSWithoutDAS::getInfo() const t return _time_steps[0]->getInfo(); } +/*! + * See doc at MEDFileField1TSWithoutDAS::getUndergroundDataArray + */ +DataArrayDouble *MEDFileFieldMultiTSWithoutDAS::getUndergroundDataArray(int iteration, int order) const throw(INTERP_KERNEL::Exception) +{ + return getTimeStepEntry(iteration,order).getUndergroundDataArray(); +} + +/*! + * See doc at MEDFileField1TSWithoutDAS::getUndergroundDataArrayExt + */ +DataArrayDouble *MEDFileFieldMultiTSWithoutDAS::getUndergroundDataArrayExt(int iteration, int order, std::vector< std::pair,std::pair > >& entries) const throw(INTERP_KERNEL::Exception) +{ + return getTimeStepEntry(iteration,order).getUndergroundDataArrayExt(entries); +} + std::string MEDFileFieldMultiTSWithoutDAS::getMeshName() const throw(INTERP_KERNEL::Exception) { if(_time_steps.empty()) @@ -2530,7 +2614,7 @@ void MEDFileFieldMultiTSWithoutDAS::copyTinyInfoFrom(const MEDCouplingFieldDoubl const DataArrayDouble *arr=field->getArray(); if(!arr) throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutDAS::copyTinyInfoFrom : no array set !"); - _infos=arr->getInfoOnComponent(); + _infos=arr->getInfoOnComponents(); } void MEDFileFieldMultiTSWithoutDAS::checkCoherencyOfTinyInfo(const MEDCouplingFieldDouble *field) const throw(INTERP_KERNEL::Exception) @@ -2545,12 +2629,12 @@ void MEDFileFieldMultiTSWithoutDAS::checkCoherencyOfTinyInfo(const MEDCouplingFi const DataArrayDouble *arr=field->getArray(); if(!arr) throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutDAS::checkCoherencyOfTinyInfo : no array set !"); - if(_infos!=arr->getInfoOnComponent()) + if(_infos!=arr->getInfoOnComponents()) { std::ostringstream oss; oss << MSG << "components ! should be \""; std::copy(_infos.begin(),_infos.end(),std::ostream_iterator(oss,", ")); oss << " But compo in input fields are : "; - std::vector tmp=arr->getInfoOnComponent(); + std::vector tmp=arr->getInfoOnComponents(); std::copy(tmp.begin(),tmp.end(),std::ostream_iterator(oss,", ")); oss << " !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); diff --git a/src/MEDLoader/MEDFileField.hxx b/src/MEDLoader/MEDFileField.hxx index 29fb1b555..f861fea33 100644 --- a/src/MEDLoader/MEDFileField.hxx +++ b/src/MEDLoader/MEDFileField.hxx @@ -115,6 +115,7 @@ namespace ParaMEDMEM void getFieldAtLevel(TypeOfField type, const MEDFieldFieldGlobsReal *glob, std::vector& dads, std::vector& pfls, std::vector& locs, std::vector& geoTypes) const; DataArrayDouble *getUndergroundDataArray() const throw(INTERP_KERNEL::Exception); + void fillValues(int discId, int& startTupleId, int& startEntryId, std::vector< std::pair,std::pair > >& entries, double *vals) const; static int ConvertType(TypeOfField type, int locId) throw(INTERP_KERNEL::Exception); private: MEDFileFieldPerMeshPerTypePerDisc(MEDFileFieldPerMeshPerType *fath, med_idt fid, TypeOfField type, int profileIt) throw(INTERP_KERNEL::Exception); @@ -151,6 +152,7 @@ namespace ParaMEDMEM double getTime() const; std::string getName() const; std::string getMeshName() const; + void getSizes(int& globalSz, int& nbOfEntries) const; INTERP_KERNEL::NormalizedCellType getGeoType() const; int getNumberOfComponents() const; const std::vector& getInfo() const; @@ -158,6 +160,7 @@ namespace ParaMEDMEM std::vector getLocsReallyUsed() const; void getFieldAtLevel(int meshDim, TypeOfField type, const MEDFieldFieldGlobsReal *glob, std::vector& dads, std::vector& pfls, std::vector& locs, std::vector& geoTypes) const; DataArrayDouble *getUndergroundDataArray() const throw(INTERP_KERNEL::Exception); + void fillValues(int& startTupleId, int& startEntryId, std::vector< std::pair,std::pair > >& entries, double *vals) const; static med_entity_type ConvertIntoMEDFileType(TypeOfField ikType, INTERP_KERNEL::NormalizedCellType ikGeoType, med_geometry_type& medfGeoType); private: std::vector addNewEntryIfNecessary(const MEDCouplingFieldDouble *field, int offset, int nbOfCells) throw(INTERP_KERNEL::Exception); @@ -202,6 +205,7 @@ namespace ParaMEDMEM MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, const MEDFieldFieldGlobsReal *glob, const MEDCouplingMesh *mesh, bool& isPfl) const throw(INTERP_KERNEL::Exception); DataArrayDouble *getFieldOnMeshAtLevelWithPfl(TypeOfField type, const MEDCouplingMesh *mesh, DataArrayInt *&pfl, const MEDFieldFieldGlobsReal *glob) const throw(INTERP_KERNEL::Exception); DataArrayDouble *getUndergroundDataArray() const throw(INTERP_KERNEL::Exception); + DataArrayDouble *getUndergroundDataArrayExt(std::vector< std::pair,std::pair > >& entries) const throw(INTERP_KERNEL::Exception); private: int addNewEntryIfNecessary(INTERP_KERNEL::NormalizedCellType type); MEDCouplingFieldDouble *finishField(TypeOfField type, const MEDFieldFieldGlobsReal *glob, @@ -343,6 +347,7 @@ namespace ParaMEDMEM MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, int renumPol, const MEDFieldFieldGlobsReal *glob, const MEDCouplingMesh *mesh, const DataArrayInt *cellRenum, const DataArrayInt *nodeRenum) const throw(INTERP_KERNEL::Exception); DataArrayDouble *getFieldWithProfile(TypeOfField type, int meshDimRelToMax, const MEDFileMesh *mesh, DataArrayInt *&pfl, const MEDFieldFieldGlobsReal *glob) const throw(INTERP_KERNEL::Exception); DataArrayDouble *getUndergroundDataArray() const throw(INTERP_KERNEL::Exception); + DataArrayDouble *getUndergroundDataArrayExt(std::vector< std::pair,std::pair > >& entries) const throw(INTERP_KERNEL::Exception); protected: int addNewEntryIfNecessary(const MEDCouplingMesh *mesh) throw(INTERP_KERNEL::Exception); int getMeshIdFromMeshName(const char *mName) const throw(INTERP_KERNEL::Exception); @@ -398,6 +403,8 @@ namespace ParaMEDMEM std::vector< std::pair > getTimeSteps(std::vector& ret1) const throw(INTERP_KERNEL::Exception); std::string getMeshName() const throw(INTERP_KERNEL::Exception); const std::vector& getInfo() const throw(INTERP_KERNEL::Exception); + DataArrayDouble *getUndergroundDataArray(int iteration, int order) const throw(INTERP_KERNEL::Exception); + DataArrayDouble *getUndergroundDataArrayExt(int iteration, int order, std::vector< std::pair,std::pair > >& entries) const throw(INTERP_KERNEL::Exception); public: std::vector getPflsReallyUsed2() const; std::vector getLocsReallyUsed2() const; diff --git a/src/MEDLoader/MEDFileMesh.cxx b/src/MEDLoader/MEDFileMesh.cxx index dbef046d0..f0b4c0769 100644 --- a/src/MEDLoader/MEDFileMesh.cxx +++ b/src/MEDLoader/MEDFileMesh.cxx @@ -974,8 +974,8 @@ void MEDFileUMesh::loadUMeshFromFile(med_idt fid, const char *mName, int dt, int int mid=MEDFileUMeshL2::GetMeshIdFromName(fid,mName,meshType,dummy0,dummy1,dummy2); if(meshType!=UNSTRUCTURED) { - std::ostringstream oss; oss << "Trying to load as unstructured an existing mesh with name '" << mName << "' !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); + std::ostringstream oss; oss << "Trying to load as unstructured an existing mesh with name '" << mName << "' !"; + throw INTERP_KERNEL::Exception(oss.str().c_str()); } loaderl2.loadAll(fid,mid,mName,dt,it); int lev=loaderl2.getNumberOfLevels(); diff --git a/src/MEDLoader/MEDLoader.cxx b/src/MEDLoader/MEDLoader.cxx index 2012f6fdb..cd1944075 100644 --- a/src/MEDLoader/MEDLoader.cxx +++ b/src/MEDLoader/MEDLoader.cxx @@ -349,6 +349,108 @@ std::vector MEDLoader::GetMeshNames(const char *fileName) throw(INT return ret; } +std::vector< std::pair > MEDLoader::GetComponentsNamesOfField(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception) +{ + CheckFileForRead(fileName); + MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY); + med_int nbFields=MEDnField(fid); + std::vector fields(nbFields); + med_field_type typcha; + for(int i=0;i comp=new char[ncomp*MED_SNAME_SIZE+1]; + INTERP_KERNEL::AutoPtr unit=new char[ncomp*MED_SNAME_SIZE+1]; + INTERP_KERNEL::AutoPtr dt_unit=MEDLoaderBase::buildEmptyString(MED_LNAME_SIZE); + med_int nbPdt; + med_bool localmesh; + INTERP_KERNEL::AutoPtr maa_ass=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE); + INTERP_KERNEL::AutoPtr nomcha=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE); + MEDfieldInfo(fid,i+1,nomcha,maa_ass,&localmesh,&typcha,comp,unit,dt_unit,&nbPdt); + std::string meshName=MEDLoaderBase::buildStringFromFortran(maa_ass,MED_NAME_SIZE); + std::string curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE+1); + if(curFieldName==fieldName) + { + std::vector< std::pair > ret(ncomp); + for(int j=0;j(MEDLoaderBase::buildStringFromFortran(((char *)comp)+j*MED_SNAME_SIZE,MED_SNAME_SIZE), + MEDLoaderBase::buildStringFromFortran(((char *)unit)+j*MED_SNAME_SIZE,MED_SNAME_SIZE)); + return ret; + } + fields[i]=curFieldName; + } + std::ostringstream oss; oss << "MEDLoader::GetComponentsNamesOfField : no such field \"" << fieldName << "\" in file \"" << fileName << "\" !" << std::endl; + oss << "Possible field names are : " << std::endl; + std::copy(fields.begin(),fields.end(),std::ostream_iterator(oss," ")); + throw INTERP_KERNEL::Exception(oss.str().c_str()); +} + +/*! + * Given a 'fileName' and a 'meshName' this method returns global information concerning this mesh. + * It returns, in this order : + * - number of cells sorted by dimension and by geometry type. The first entry in the vector is the maximal dimension, the 2nd in the vector is the maximal dimension-1... + * - the mesh dimension + * - the space dimension + * - the number of nodes + */ +std::vector< std::vector< std::pair > > MEDLoader::GetUMeshGlobalInfo(const char *fileName, const char *meshName, int &meshDim, int& spaceDim, int& numberOfNodes) throw(INTERP_KERNEL::Exception) +{ + CheckFileForRead(fileName); + MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY); + std::set poss; + char nommaa[MED_NAME_SIZE+1]; + char maillage_description[MED_COMMENT_SIZE+1]; + med_mesh_type type_maillage; + std::string trueMeshName; + med_int meshId=MEDLoaderNS::getIdFromMeshName(fid,meshName,trueMeshName); + INTERP_KERNEL::AutoPtr dt_unit=MEDLoaderBase::buildEmptyString(MED_LNAME_SIZE); + med_sorting_type sortingType; + med_int nstep; + med_axis_type axisType; + int naxis=MEDmeshnAxis(fid,meshId); + INTERP_KERNEL::AutoPtr axisname=MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE); + INTERP_KERNEL::AutoPtr axisunit=MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE); + MEDmeshInfo(fid,meshId,nommaa,&spaceDim,&meshDim,&type_maillage,maillage_description,dt_unit,&sortingType,&nstep,&axisType,axisname,axisunit); + if(type_maillage!=MED_UNSTRUCTURED_MESH) + { + std::ostringstream oss; oss << "MEDLoader::GetUMeshGlobalInfo : Mesh \""<< meshName << "\" in file \"" << fileName; + oss << "\" exists but it is not an unstructured mesh ! This method is not relevant for mesh types that are not unstructured !"; + throw INTERP_KERNEL::Exception(oss.str().c_str()); + } + // limitation + if(nstep!=1) + throw INTERP_KERNEL::Exception("MEDLoader::GetUMeshGlobalInfo : multisteps on mesh not managed !"); + med_int numdt,numit; + med_float dt; + MEDmeshComputationStepInfo(fid,nommaa,1,&numdt,&numit,&dt); + // endlimitation + std::vector dims; + std::vector< std::pair > geoTypes; + med_bool changement,transformation; + for(int i=0;i0) + { + INTERP_KERNEL::NormalizedCellType typp=typmai2[i]; + int mdimCell=INTERP_KERNEL::CellModel::GetCellModel(typp).getDimension(); + dims.push_back(mdimCell); + geoTypes.push_back(std::pair((int)typp,curNbOfElemM)); + } + } + int maxLev=*std::max_element(dims.begin(),dims.end()); + int lowLev=*std::min_element(dims.begin(),dims.end()); + int nbOfLevels=maxLev-lowLev+1; + std::vector< std::vector< std::pair > > ret(nbOfLevels); + for(std::size_t i=0;i MEDLoader::GetMeshNamesOnField(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception) { CheckFileForRead(fileName); diff --git a/src/MEDLoader/MEDLoader.hxx b/src/MEDLoader/MEDLoader.hxx index 46a867355..4e7f6a522 100644 --- a/src/MEDLoader/MEDLoader.hxx +++ b/src/MEDLoader/MEDLoader.hxx @@ -88,6 +88,8 @@ class MEDLOADER_EXPORT MEDLoader static void setTooLongStrPolicy(int val) throw(INTERP_KERNEL::Exception); static void CheckFileForRead(const char *fileName) throw(INTERP_KERNEL::Exception); static std::vector GetMeshNames(const char *fileName) throw(INTERP_KERNEL::Exception); + static std::vector< std::vector< std::pair > > GetUMeshGlobalInfo(const char *fileName, const char *meshName, int &meshDim, int& spaceDim, int& numberOfNodes) throw(INTERP_KERNEL::Exception); + static std::vector< std::pair > GetComponentsNamesOfField(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception); static std::vector GetMeshNamesOnField(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception); static std::vector GetMeshGroupsNames(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception); static std::vector GetMeshFamiliesNames(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception); diff --git a/src/MEDLoader/Swig/MEDLoader.i b/src/MEDLoader/Swig/MEDLoader.i index 82cc924f1..ec3ab77a0 100644 --- a/src/MEDLoader/Swig/MEDLoader.i +++ b/src/MEDLoader/Swig/MEDLoader.i @@ -95,6 +95,7 @@ using namespace ParaMEDMEM; %newobject ParaMEDMEM::MEDFileField1TS::getFieldAtTopLevel; %newobject ParaMEDMEM::MEDFileField1TS::getFieldOnMeshAtLevel; %newobject ParaMEDMEM::MEDFileField1TS::getFieldAtLevelOld; +%newobject ParaMEDMEM::MEDFileFieldMultiTSWithoutDAS::getUndergroundDataArray; %newobject ParaMEDMEM::MEDFileData::New; %newobject ParaMEDMEM::MEDFileData::getMeshes; @@ -197,6 +198,47 @@ public: } return ret; } + static PyObject *GetComponentsNamesOfField(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception) + { + std::vector< std::pair > res=MEDLoader::GetComponentsNamesOfField(fileName,fieldName); + PyObject *ret=PyList_New(res.size()); + int rk=0; + for(std::vector< std::pair >::const_iterator iter=res.begin();iter!=res.end();iter++,rk++) + { + PyObject *elt=PyTuple_New(2); + PyTuple_SetItem(elt,0,PyString_FromString((*iter).first.c_str())); + PyTuple_SetItem(elt,1,PyString_FromString((*iter).second.c_str())); + PyList_SetItem(ret,rk,elt); + } + return ret; + } + static PyObject *GetUMeshGlobalInfo(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception) + { + int meshDim,spaceDim,numberOfNodes; + std::vector< std::vector< std::pair > > res=MEDLoader::GetUMeshGlobalInfo(fileName,meshName,meshDim,spaceDim,numberOfNodes); + PyObject *ret=PyTuple_New(4); + PyObject *elt0=PyList_New(res.size()); + int i=0; + for(std::vector< std::vector< std::pair > >::const_iterator it=res.begin();it!=res.end();it++,i++) + { + const std::vector< std::pair >&obj2=(*it); + int j=0; + PyObject *elt1=PyList_New(obj2.size()); + for(std::vector< std::pair >::const_iterator it2=obj2.begin();it2!=obj2.end();it2++,j++) + { + PyObject *elt2=PyTuple_New(2); + PyTuple_SetItem(elt2,0,SWIG_From_int((*it2).first)); + PyTuple_SetItem(elt2,1,SWIG_From_int((*it2).second)); + PyList_SetItem(elt1,j,elt2); + } + PyList_SetItem(elt0,i,elt1); + } + PyTuple_SetItem(ret,0,elt0); + PyTuple_SetItem(ret,1,SWIG_From_int(meshDim)); + PyTuple_SetItem(ret,2,SWIG_From_int(spaceDim)); + PyTuple_SetItem(ret,3,SWIG_From_int(numberOfNodes)); + return ret; + } static PyObject *ReadFieldsOnSameMesh(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, PyObject *liIts) throw(INTERP_KERNEL::Exception) { @@ -693,6 +735,31 @@ namespace ParaMEDMEM ret->incrRef(); return ret; } + + PyObject *getUndergroundDataArrayExt() const throw(INTERP_KERNEL::Exception) + { + std::vector< std::pair,std::pair > > elt1Cpp; + DataArrayDouble *elt0=self->getUndergroundDataArrayExt(elt1Cpp); + PyObject *ret=PyTuple_New(2); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elt0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 )); + std::size_t sz=elt1Cpp.size(); + PyObject *elt=PyList_New(sz); + for(std::size_t i=0;igetUndergroundDataArray(iteration,order); + if(ret) + ret->incrRef(); + return ret; + } + PyObject *getUndergroundDataArrayExt(int iteration, int order) const throw(INTERP_KERNEL::Exception) + { + std::vector< std::pair,std::pair > > elt1Cpp; + DataArrayDouble *elt0=self->getUndergroundDataArrayExt(iteration,order,elt1Cpp); + PyObject *ret=PyTuple_New(2); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(elt0),SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, SWIG_POINTER_OWN | 0 )); + std::size_t sz=elt1Cpp.size(); + PyObject *elt=PyList_New(sz); + for(std::size_t i=0;i