extern med_geometry_type typmai[MED_N_CELL_FIXED_GEO];
extern INTERP_KERNEL::NormalizedCellType typmai2[MED_N_CELL_FIXED_GEO];
extern med_geometry_type typmainoeud[1];
-extern med_geometry_type typmai3[32];
+extern med_geometry_type typmai3[34];
using namespace ParaMEDMEM;
INTERP_KERNEL::AutoPtr<char> geointerpname=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
INTERP_KERNEL::AutoPtr<char> sectionmeshname=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
MEDlocalizationInfoByName(fid,locName,&geotype,&_dim,&_nb_gauss_pt,geointerpname,sectionmeshname,&nsectionmeshcell,§iongeotype);
- _geo_type=(INTERP_KERNEL::NormalizedCellType)(std::distance(typmai3,std::find(typmai3,typmai3+32,geotype)));
+ _geo_type=(INTERP_KERNEL::NormalizedCellType)(std::distance(typmai3,std::find(typmai3,typmai3+34,geotype)));
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(_geo_type);
_nb_node_per_cell=cm.getNumberOfNodes();
_ref_coo.resize(_dim*_nb_node_per_cell);
INTERP_KERNEL::AutoPtr<char> sectionmeshname=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
MEDlocalizationInfo(fid,id+1,locName,&geotype,&_dim,&_nb_gauss_pt,geointerpname,sectionmeshname,&nsectionmeshcell,§iongeotype);
_name=locName;
- _geo_type=(INTERP_KERNEL::NormalizedCellType)(std::distance(typmai3,std::find(typmai3,typmai3+32,geotype)));
+ _geo_type=(INTERP_KERNEL::NormalizedCellType)(std::distance(typmai3,std::find(typmai3,typmai3+34,geotype)));
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel(_geo_type);
_nb_node_per_cell=cm.getNumberOfNodes();
_ref_coo.resize(_dim*_nb_node_per_cell);
{
}
-MEDFileFieldPerMeshPerTypePerDisc::MEDFileFieldPerMeshPerTypePerDisc(const MEDFileFieldPerMeshPerTypePerDisc& other):_type(other._type),_father(0),_start(other._start),_end(other._end),_nval(other._nval),_profile(other._profile),_localization(other._localization),_loc_id(other._loc_id),_tmp_work1(other._tmp_work1)
+MEDFileFieldPerMeshPerTypePerDisc::MEDFileFieldPerMeshPerTypePerDisc(const MEDFileFieldPerMeshPerTypePerDisc& other):RefCountObject(other),_type(other._type),_father(0),_start(other._start),_end(other._end),_nval(other._nval),_profile(other._profile),_localization(other._localization),_loc_id(other._loc_id),_tmp_work1(other._tmp_work1)
{
}
if(!arr->isAllocated())
throw INTERP_KERNEL::Exception("MEDFileField1TSWithoutSDA::copyTinyInfoFrom : array is not allocated !");
_dt=field->getTime(_iteration,_order);
- int nbOfComponents=arr->getNumberOfComponents();
getOrCreateAndGetArray()->setInfoAndChangeNbOfCompo(arr->getInfoOnComponents());
if(!getOrCreateAndGetArray()->isAllocated())
{
* This method performs a copy with datatype modification ( float64->int32 ) of \a this. The globals information are copied
* following the given input policy.
*
- * \param [in] deepCpyGlobs - a boolean that indicates the behaviour concerning globals (profiles and localizations)
+ * \param [in] isDeepCpyGlobs - a boolean that indicates the behaviour concerning globals (profiles and localizations)
* By default (true) the globals are deeply copied.
* \return MEDFileIntField1TS * - a new object that is the result of the conversion of \a this to int32 field.
*/
-MEDFileIntField1TS *MEDFileField1TS::convertToInt(bool deepCpyGlobs) const
+MEDFileIntField1TS *MEDFileField1TS::convertToInt(bool isDeepCpyGlobs) const
{
MEDCouplingAutoRefCountObjectPtr<MEDFileIntField1TS> ret;
const MEDFileAnyTypeField1TSWithoutSDA *content(_content);
}
else
ret=MEDFileIntField1TS::New();
- if(deepCpyGlobs)
+ if(isDeepCpyGlobs)
ret->deepCpyGlobs(*this);
else
ret->shallowCpyGlobs(*this);
* This method performs a copy with datatype modification ( int32->float64 ) of \a this. The globals information are copied
* following the given input policy.
*
- * \param [in] deepCpyGlobs - a boolean that indicates the behaviour concerning globals (profiles and localizations)
+ * \param [in] isDeepCpyGlobs - a boolean that indicates the behaviour concerning globals (profiles and localizations)
* By default (true) the globals are deeply copied.
* \return MEDFileField1TS * - a new object that is the result of the conversion of \a this to float64 field.
*/
-MEDFileField1TS *MEDFileIntField1TS::convertToDouble(bool deepCpyGlobs) const
+MEDFileField1TS *MEDFileIntField1TS::convertToDouble(bool isDeepCpyGlobs) const
{
MEDCouplingAutoRefCountObjectPtr<MEDFileField1TS> ret;
const MEDFileAnyTypeField1TSWithoutSDA *content(_content);
}
else
ret=MEDFileField1TS::New();
- if(deepCpyGlobs)
+ if(isDeepCpyGlobs)
ret->deepCpyGlobs(*this);
else
ret->shallowCpyGlobs(*this);
/*!
* This method groups not null items in \a vectFMTS per time step series. Two time series are considered equal if the list of their pair of integers iteration,order are equal.
* The float64 value of time attached to the pair of integers are not considered here.
- *
+ * WARNING the returned pointers are not incremented. The caller is \b not responsible to deallocate them ! This method only reorganizes entries in \a vectFMTS.
+ *
* \param [in] vectFMTS - vector of not null fields defined on a same global data pointer.
* \throw If there is a null pointer in \a vectFMTS.
*/
* \param [in] vectFMTS - list of multi times step part all defined each on a same spatial discretization along time and pointing to a mesh whose name is equal to \c mesh->getName().
* \param [in] mesh - the mesh shared by all items in \a vectFMTS across time.
* \param [out] fsc - A vector having same size than returned vector. It specifies the support comporator of the corresponding vector of MEDFileAnyTypeFieldMultiTS in returned vector of vector.
+ * \return - A vector of vector of objects that contains the same pointers (objects) than thoose in \a vectFMTS except that there are organized differently. So pointers included in returned vector of vector should \b not been dealt by the caller.
*
* \throw If an element in \a vectFMTS has not only one spatial discretization set.
* \throw If an element in \a vectFMTS change of spatial discretization along time.
return ret;
std::vector<MEDFileAnyTypeFieldMultiTS *>::const_iterator it(vectFMTS.begin());
MEDFileAnyTypeFieldMultiTS *frstElt(*it);
+ if(!frstElt)
+ throw INTERP_KERNEL::Exception(msg);
std::size_t i=0;
std::vector<MEDFileAnyTypeFieldMultiTS *> vectFMTSNotNodes;
std::vector<MEDFileAnyTypeFieldMultiTS *> vectFMTSNodes;
for(;it!=vectFMTS.end();it++,i++)
{
+ if(!(*it))
+ throw INTERP_KERNEL::Exception(msg);
TypeOfField tof0,tof1;
- int ret=CheckSupportAcrossTime(frstElt,*it,mesh,tof0,tof1);
- if(ret>0)
+ if(CheckSupportAcrossTime(frstElt,*it,mesh,tof0,tof1)>0)
{
if(tof1!=ON_NODES)
vectFMTSNotNodes.push_back(*it);
* This method performs a copy with datatype modification ( float64->int32 ) of \a this. The globals information are copied
* following the given input policy.
*
- * \param [in] deepCpyGlobs - a boolean that indicates the behaviour concerning globals (profiles and localizations)
+ * \param [in] isDeepCpyGlobs - a boolean that indicates the behaviour concerning globals (profiles and localizations)
* By default (true) the globals are deeply copied.
* \return MEDFileIntFieldMultiTS * - a new object that is the result of the conversion of \a this to int32 field.
*/
-MEDFileIntFieldMultiTS *MEDFileFieldMultiTS::convertToInt(bool deepCpyGlobs) const
+MEDFileIntFieldMultiTS *MEDFileFieldMultiTS::convertToInt(bool isDeepCpyGlobs) const
{
MEDCouplingAutoRefCountObjectPtr<MEDFileIntFieldMultiTS> ret;
const MEDFileAnyTypeFieldMultiTSWithoutSDA *content(_content);
}
else
ret=MEDFileIntFieldMultiTS::New();
- if(deepCpyGlobs)
+ if(isDeepCpyGlobs)
ret->deepCpyGlobs(*this);
else
ret->shallowCpyGlobs(*this);
* This method performs a copy with datatype modification ( int32->float64 ) of \a this. The globals information are copied
* following the given input policy.
*
- * \param [in] deepCpyGlobs - a boolean that indicates the behaviour concerning globals (profiles and localizations)
+ * \param [in] isDeepCpyGlobs - a boolean that indicates the behaviour concerning globals (profiles and localizations)
* By default (true) the globals are deeply copied.
* \return MEDFileFieldMultiTS * - a new object that is the result of the conversion of \a this to float64 field.
*/
-MEDFileFieldMultiTS *MEDFileIntFieldMultiTS::convertToDouble(bool deepCpyGlobs) const
+MEDFileFieldMultiTS *MEDFileIntFieldMultiTS::convertToDouble(bool isDeepCpyGlobs) const
{
MEDCouplingAutoRefCountObjectPtr<MEDFileFieldMultiTS> ret;
const MEDFileAnyTypeFieldMultiTSWithoutSDA *content(_content);
}
else
ret=MEDFileFieldMultiTS::New();
- if(deepCpyGlobs)
+ if(isDeepCpyGlobs)
ret->deepCpyGlobs(*this);
else
ret->shallowCpyGlobs(*this);
MEDLOADER_EXPORT static MEDFileField1TS *New(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll=true);
MEDLOADER_EXPORT static MEDFileField1TS *New(const MEDFileField1TSWithoutSDA& other, bool shallowCopyOfContent);
MEDLOADER_EXPORT static MEDFileField1TS *New();
- MEDLOADER_EXPORT MEDFileIntField1TS *convertToInt(bool deepCpyGlobs=true) const;
+ MEDLOADER_EXPORT MEDFileIntField1TS *convertToInt(bool isDeepCpyGlobs=true) const;
//
MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const;
MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const;
MEDLOADER_EXPORT static MEDFileIntField1TS *New(const char *fileName, const char *fieldName, bool loadAll=true);
MEDLOADER_EXPORT static MEDFileIntField1TS *New(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll=true);
MEDLOADER_EXPORT static MEDFileIntField1TS *New(const MEDFileIntField1TSWithoutSDA& other, bool shallowCopyOfContent);
- MEDLOADER_EXPORT MEDFileField1TS *convertToDouble(bool deepCpyGlobs=true) const;
+ MEDLOADER_EXPORT MEDFileField1TS *convertToDouble(bool isDeepCpyGlobs=true) const;
MEDLOADER_EXPORT MEDFileAnyTypeField1TS *shallowCpy() const;
//
MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, DataArrayInt* &arrOut, int renumPol=0) const;
MEDLOADER_EXPORT static MEDFileFieldMultiTS *New(const MEDFileFieldMultiTSWithoutSDA& other, bool shallowCopyOfContent);
MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTS *shallowCpy() const;
MEDLOADER_EXPORT void checkCoherencyOfType(const MEDFileAnyTypeField1TS *f1ts) const;
- MEDLOADER_EXPORT MEDFileIntFieldMultiTS *convertToInt(bool deepCpyGlobs=true) const;
+ MEDLOADER_EXPORT MEDFileIntFieldMultiTS *convertToInt(bool isDeepCpyGlobs=true) const;
//
MEDLOADER_EXPORT MEDFileAnyTypeField1TS *getTimeStepAtPos(int pos) const;
MEDLOADER_EXPORT MEDFileAnyTypeField1TS *getTimeStep(int iteration, int order) const;
MEDLOADER_EXPORT MEDFileAnyTypeFieldMultiTS *shallowCpy() const;
MEDLOADER_EXPORT void checkCoherencyOfType(const MEDFileAnyTypeField1TS *f1ts) const;
MEDLOADER_EXPORT MEDFileAnyTypeField1TS *getTimeStepAtPos(int pos) const;
- MEDLOADER_EXPORT MEDFileFieldMultiTS *convertToDouble(bool deepCpyGlobs=true) const;
+ MEDLOADER_EXPORT MEDFileFieldMultiTS *convertToDouble(bool isDeepCpyGlobs=true) const;
//
MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int iteration, int order, int meshDimRelToMax, DataArrayInt* &arrOut, int renumPol=0) const;
MEDLOADER_EXPORT MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int iteration, int order, DataArrayInt* &arrOut, int renumPol=0) const;
_ms[pos]=0;
}
+/*!
+ * Sets a new MEDCoupling1GTUMesh at a given level in \a this mesh.
+ * \param [in] meshDimRelToMax - a relative level to set the mesh at.
+ * \param [in] m - the new mesh to set.
+ * \throw If the name or the description of \a this mesh and \a m are not empty and are
+ * different.
+ * \throw If the node coordinates array is set \a this in mesh and \a m refers to
+ * another node coordinates array.
+ * \throw If the mesh dimension of \a m does not correspond to \a meshDimRelToMax or
+ * to the existing meshes of other levels of \a this mesh.
+ */
+void MEDFileUMesh::setMeshAtLevel(int meshDimRelToMax, MEDCoupling1GTUMesh *m)
+{
+ MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshSplitL1> elt(new MEDFileUMeshSplitL1(m));
+ checkAndGiveEntryInSplitL1(meshDimRelToMax,m)=elt;
+}
+
/*!
* Sets a new MEDCouplingUMesh at a given level in \a this mesh.
* \param [in] meshDimRelToMax - a relative level to set the mesh at.
* to the existing meshes of other levels of \a this mesh.
*/
void MEDFileUMesh::setMeshAtLevel(int meshDimRelToMax, MEDCouplingUMesh *m, bool newOrOld)
+{
+ MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshSplitL1> elt(new MEDFileUMeshSplitL1(m,newOrOld));
+ checkAndGiveEntryInSplitL1(meshDimRelToMax,m)=elt;
+}
+
+MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshSplitL1>& MEDFileUMesh::checkAndGiveEntryInSplitL1(int meshDimRelToMax, MEDCouplingPointSet *m)
{
dealWithTinyInfo(m);
std::vector<int> levSet=getNonEmptyLevels();
if(sz>=(int)_ms.size())
_ms.resize(sz);
checkMeshDimCoherency(m->getMeshDimension(),meshDimRelToMax);
- _ms[sz-1]=new MEDFileUMeshSplitL1(m,newOrOld);
+ return _ms[sz-1];
}
else
- _ms[-meshDimRelToMax]=new MEDFileUMeshSplitL1(m,newOrOld);
+ return _ms[-meshDimRelToMax];
}
/*!
MEDLOADER_EXPORT void addNodeGroup(const DataArrayInt *ids);
MEDLOADER_EXPORT void addGroup(int meshDimRelToMaxExt, const DataArrayInt *ids);
MEDLOADER_EXPORT void removeMeshAtLevel(int meshDimRelToMax);
+ MEDLOADER_EXPORT void setMeshAtLevel(int meshDimRelToMax, MEDCoupling1GTUMesh *m);
MEDLOADER_EXPORT void setMeshAtLevel(int meshDimRelToMax, MEDCouplingUMesh *m, bool newOrOld=false);
MEDLOADER_EXPORT void setMeshes(const std::vector<const MEDCouplingUMesh *>& ms, bool renum=false);
MEDLOADER_EXPORT void setGroupsFromScratch(int meshDimRelToMax, const std::vector<const MEDCouplingUMesh *>& ms, bool renum=false);
void changeFamilyIdArr(int oldId, int newId);
std::list< MEDCouplingAutoRefCountObjectPtr<DataArrayInt> > getAllNonNullFamilyIds() const;
void addGroupUnderground(bool isNodeGroup, const DataArrayInt *ids, DataArrayInt *famArr);
+ MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshSplitL1>& checkAndGiveEntryInSplitL1(int meshDimRelToMax, MEDCouplingPointSet *m);
private:
std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshSplitL1> > _ms;
MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> _coords;
#include <iostream>
-extern med_geometry_type typmai3[32];
+extern med_geometry_type typmai3[34];
using namespace ParaMEDMEM;
loadFromStaticType(fid,mName,dt,it,mdim,curNbOfElem,geoElt,type,entity,mrs);
return;
}
- if(type==INTERP_KERNEL::NORM_POLYGON)
+ if(type==INTERP_KERNEL::NORM_POLYGON || type==INTERP_KERNEL::NORM_QPOLYG)
{
loadPolyg(fid,mName,dt,it,mdim,curNbOfElem,geoElt,entity,mrs);
return;
med_entity_type entity, MEDFileMeshReadSelector *mrs)
{
med_bool changement,transformation;
- med_int curNbOfElem=MEDmeshnEntity(fid,mName,dt,it,entity,MED_POLYGON,MED_INDEX_NODE,MED_NODAL,&changement,&transformation)-1;
- _m=MEDCoupling1DGTUMesh::New(mName,INTERP_KERNEL::NORM_POLYGON);
+ med_int curNbOfElem=MEDmeshnEntity(fid,mName,dt,it,entity,geoElt,MED_INDEX_NODE,MED_NODAL,&changement,&transformation)-1;
+ _m=MEDCoupling1DGTUMesh::New(mName,geoElt==MED_POLYGON?INTERP_KERNEL::NORM_POLYGON:INTERP_KERNEL::NORM_QPOLYG);
MEDCoupling1DGTUMesh *mc(dynamic_cast<MEDCoupling1DGTUMesh *>((MEDCoupling1GTUMesh *)_m));
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> conn(DataArrayInt::New()),connI(DataArrayInt::New());
conn->alloc(arraySize,1); connI->alloc(curNbOfElem+1,1);
- MEDmeshPolygonRd(fid,mName,dt,it,MED_CELL,MED_NODAL,connI->getPointer(),conn->getPointer());
+ MEDmeshPolygon2Rd(fid,mName,dt,it,MED_CELL,geoElt,MED_NODAL,connI->getPointer(),conn->getPointer());
std::transform(conn->begin(),conn->end(),conn->getPointer(),std::bind2nd(std::plus<int>(),-1));
std::transform(connI->begin(),connI->end(),connI->getPointer(),std::bind2nd(std::plus<int>(),-1));
mc->setNodalConnectivity(conn,connI);
- loadCommonPart(fid,mName,dt,it,mdim,curNbOfElem,MED_POLYGON,entity,mrs);
+ loadCommonPart(fid,mName,dt,it,mdim,curNbOfElem,geoElt,entity,mrs);
}
void MEDFileUMeshPerType::loadPolyh(med_idt fid, const char *mName, int dt, int it, int mdim, int connFaceLgth, med_geometry_type geoElt,
const MEDCoupling1DGTUMesh *m0(dynamic_cast<const MEDCoupling1DGTUMesh *>(m));
if(!m0)
throw INTERP_KERNEL::Exception("MEDFileUMeshPerType::Write : internal error #2 !");
- if(ikt==INTERP_KERNEL::NORM_POLYGON)
+ if(ikt==INTERP_KERNEL::NORM_POLYGON || ikt==INTERP_KERNEL::NORM_QPOLYG)
{
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> arr(m0->getNodalConnectivity()->deepCpy()),arrI(m0->getNodalConnectivityIndex()->deepCpy());
std::transform(arr->begin(),arr->end(),arr->getPointer(),std::bind2nd(std::plus<int>(),1));
std::transform(arrI->begin(),arrI->end(),arrI->getPointer(),std::bind2nd(std::plus<int>(),1));
- MEDmeshPolygonWr(fid,mname,dt,it,timm,MED_CELL,MED_NODAL,nbOfCells+1,arrI->begin(),arr->begin());
+ MEDmeshPolygon2Wr(fid,mname,dt,it,timm,MED_CELL,ikt==INTERP_KERNEL::NORM_POLYGON?MED_POLYGON:MED_POLYGON2,MED_NODAL,nbOfCells+1,arrI->begin(),arr->begin());
}
else
{
}
}
+MEDFileUMeshSplitL1::MEDFileUMeshSplitL1(MEDCoupling1GTUMesh *m):_m(this)
+{
+ std::vector< const MEDCoupling1GTUMesh * > v(1);
+ v[0]=m;
+ assignParts(v);
+}
+
MEDFileUMeshSplitL1::MEDFileUMeshSplitL1(MEDCouplingUMesh *m):_m(this)
{
assignMesh(m,true);
m->incrRef();
_m_by_types.assignUMesh(m);
}
+ assignCommonPart();
+}
+
+void MEDFileUMeshSplitL1::assignParts(const std::vector< const MEDCoupling1GTUMesh * >& mParts)
+{
+ _m_by_types.assignParts(mParts);
+ assignCommonPart();
+}
+
+void MEDFileUMeshSplitL1::assignCommonPart()
+{
_fam=DataArrayInt::New();
- _fam->alloc(m->getNumberOfCells(),1);
+ _fam->alloc(_m_by_types.getSize(),1);
_fam->fillWithValue(0);
}
public:
MEDFileUMeshSplitL1(const MEDFileUMeshSplitL1& other);
MEDFileUMeshSplitL1(const MEDFileUMeshL2& l2, const char *mName, int id);
+ MEDFileUMeshSplitL1(MEDCoupling1GTUMesh *m);
MEDFileUMeshSplitL1(MEDCouplingUMesh *m);
MEDFileUMeshSplitL1(MEDCouplingUMesh *m, bool newOrOld);
std::size_t getHeapMemorySizeWithoutChildren() const;
void clearNonDiscrAttributes() const;
void synchronizeTinyInfo(const MEDFileMesh& master) const;
void assignMesh(MEDCouplingUMesh *m, bool newOrOld);
+ void assignParts(const std::vector< const MEDCoupling1GTUMesh * >& mParts);
bool empty() const;
bool presenceOfOneFams(const std::vector<int>& ids) const;
int getMeshDimension() const;
static DataArrayInt *Renumber(const DataArrayInt *renum, const DataArrayInt *da);
static MEDCouplingUMesh *Renumber2(const DataArrayInt *renum, MEDCouplingUMesh *m, const int *cellIds);
private:
+ void assignCommonPart();
MEDCouplingUMesh *renumIfNeeded(MEDCouplingUMesh *m, const int *cellIds) const;
DataArrayInt *renumIfNeededArr(const DataArrayInt *da) const;
void computeRevNum() const;
MED_HEXA20,
MED_HEXA27,
MED_POLYGON,
+ MED_POLYGON2,
MED_POLYHEDRON };
med_geometry_type typmainoeud[1] = { MED_NONE };
INTERP_KERNEL::NORM_HEXA20,
INTERP_KERNEL::NORM_HEXA27,
INTERP_KERNEL::NORM_POLYGON,
+ INTERP_KERNEL::NORM_QPOLYG,
INTERP_KERNEL::NORM_POLYHED };
med_geometry_type typmai3[34] = { MED_POINT1,//0
MED_NONE,//29
MED_HEXA20,//30
MED_POLYHEDRON,//31
- MED_NONE,//32
+ MED_POLYGON2,//32
MED_NONE//33
};
#endif
}
+std::string MEDLoader::MEDFileVersionStr()
+{
+ return std::string(MED_VERSION_STR);
+}
+
+void MEDLoader::MEDFileVersion(int& major, int& minor, int& release)
+{
+ major=MED_NUM_MAJEUR;
+ minor=MED_NUM_MINEUR;
+ release=MED_NUM_RELEASE;
+}
+
/*!
* This method sets the epsilon value used for node comparison when trying to buid a profile for a field on node/cell on an already written mesh.
*/
return ret;
}
-MEDCouplingUMesh *MEDLoader::ReadUMeshFromFile(const char *fileName, const char *meshName, int meshDimRelToMax)
+ParaMEDMEM::MEDCouplingMesh *MEDLoader::ReadMeshFromFile(const char *fileName, const char *meshName, int meshDimRelToMax)
+{
+ CheckFileForRead(fileName);
+ 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 char *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 char *fileName, const char *meshName, int meshDimRelToMax)
{
CheckFileForRead(fileName);
MEDCouplingAutoRefCountObjectPtr<MEDFileMesh> mm=MEDFileMesh::New(fileName,meshName);
return ret.retn();
}
+void MEDLoader::WriteMesh(const char *fileName, const ParaMEDMEM::MEDCouplingMesh *mesh, bool writeFromScratch)
+{
+ if(!mesh)
+ throw INTERP_KERNEL::Exception("MEDLoader::WriteMesh : input mesh is null !");
+ const MEDCouplingUMesh *um(dynamic_cast<const MEDCouplingUMesh *>(mesh));
+ if(um)
+ {
+ WriteUMesh(fileName,um,writeFromScratch);
+ return ;
+ }
+ int mod=writeFromScratch?2:0;
+ const MEDCoupling1GTUMesh *um2(dynamic_cast<const MEDCoupling1GTUMesh *>(mesh));
+ if(um2)
+ {
+ MEDCouplingAutoRefCountObjectPtr<MEDFileUMesh> mmu=MEDFileUMesh::New();
+ mmu->setMeshAtLevel(0,const_cast<MEDCoupling1GTUMesh *>(um2));
+ mmu->write(fileName,mod);
+ return ;
+ }
+ const MEDCouplingCMesh *um3(dynamic_cast<const MEDCouplingCMesh *>(mesh));
+ if(um3)
+ {
+ MEDCouplingAutoRefCountObjectPtr<MEDFileCMesh> mmc=MEDFileCMesh::New();
+ mmc->setMesh(const_cast<MEDCouplingCMesh *>(um3));
+ mmc->write(fileName,mod);
+ return ;
+ }
+ const MEDCouplingCurveLinearMesh *um4(dynamic_cast<const MEDCouplingCurveLinearMesh *>(mesh));
+ if(um4)
+ {
+ MEDCouplingAutoRefCountObjectPtr<MEDFileCurveLinearMesh> mmc=MEDFileCurveLinearMesh::New();
+ mmc->setMesh(const_cast<MEDCouplingCurveLinearMesh *>(um4));
+ mmc->write(fileName,mod);
+ return ;
+ }
+ throw INTERP_KERNEL::Exception("MEDLoader::WriteMesh : only MEDCouplingUMesh, MEDCoupling1GTUMesh, MEDCouplingCMesh, MEDCouplingCurveLinear are dealed in this API for the moment !");
+}
+
void MEDLoader::WriteUMesh(const char *fileName, const ParaMEDMEM::MEDCouplingUMesh *mesh, bool writeFromScratch)
{
if(!mesh)
{
MEDCouplingAutoRefCountObjectPtr<MEDFileField1TS> ff=MEDFileField1TS::New();
MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> f2(f->deepCpy());
- const MEDCouplingMesh *m=f2->getMesh();
- const MEDCouplingUMesh *um=dynamic_cast<const MEDCouplingUMesh *>(m);
+ const MEDCouplingMesh *m(f2->getMesh());
+ const MEDCouplingUMesh *um(dynamic_cast<const MEDCouplingUMesh *>(m));
+ const MEDCoupling1GTUMesh *um2(dynamic_cast<const MEDCoupling1GTUMesh *>(m));
+ const MEDCouplingCMesh *um3(dynamic_cast<const MEDCouplingCMesh *>(m));
+ const MEDCouplingCurveLinearMesh *um4(dynamic_cast<const MEDCouplingCurveLinearMesh *>(m));
MEDCouplingAutoRefCountObjectPtr<MEDFileMesh> mm;
int mod=writeFromScratch?2:0;
if(um)
ff->setFieldNoProfileSBT(f2);
mmu->write(fileName,mod);
}
+ else if(um2)
+ {
+ MEDCouplingAutoRefCountObjectPtr<MEDFileUMesh> mmu=MEDFileUMesh::New();
+ mmu->setMeshAtLevel(0,const_cast<MEDCoupling1GTUMesh *>(um2));
+ ff->setFieldNoProfileSBT(f2);
+ mmu->write(fileName,mod);
+ }
+ else if(um3)
+ {
+ MEDCouplingAutoRefCountObjectPtr<MEDFileCMesh> mmc=MEDFileCMesh::New();
+ mmc->setMesh(const_cast<MEDCouplingCMesh *>(um3));
+ ff->setFieldNoProfileSBT(f2);
+ mmc->write(fileName,mod);
+ }
+ else if(um4)
+ {
+ MEDCouplingAutoRefCountObjectPtr<MEDFileCurveLinearMesh> mmc=MEDFileCurveLinearMesh::New();
+ mmc->setMesh(const_cast<MEDCouplingCurveLinearMesh *>(um4));
+ ff->setFieldNoProfileSBT(f2);
+ mmc->write(fileName,mod);
+ }
else
- throw INTERP_KERNEL::Exception("MEDLoaderNS::writeFieldWithoutReadingAndMappingOfMeshInFile : only umeshes are dealed in this API for the moment !");
+ throw INTERP_KERNEL::Exception("MEDLoaderNS::writeFieldWithoutReadingAndMappingOfMeshInFile : only MEDCouplingUMesh, MEDCoupling1GTUMesh, MEDCouplingCMesh, MEDCouplingCurveLinear are dealed in this API for the moment !");
ff->write(fileName,0);
}
namespace ParaMEDMEM
{
class DataArrayInt;
+ class MEDCouplingMesh;
class MEDCouplingUMesh;
class MEDCouplingFieldDouble;
}
static void SetCompPolicyForCell(int val);
static void SetTooLongStrPolicy(int val);
static bool HasXDR();
+ static std::string MEDFileVersionStr();
+ static void MEDFileVersion(int& major, int& minor, int& release);
static void CheckFileForRead(const char *fileName);
static std::vector<std::string> GetMeshNames(const char *fileName);
static std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > > GetUMeshGlobalInfo(const char *fileName, const char *meshName, int &meshDim, int& spaceDim, int& numberOfNodes);
static double GetTimeAttachedOnFieldIteration(const char *fileName, const char *fieldName, int iteration, int order);
static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFamilies(const char *fileName, const char *meshName, int meshDimRelToMax, const std::vector<std::string>& fams);
static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromGroups(const char *fileName, const char *meshName, int meshDimRelToMax, const std::vector<std::string>& grps);
+ static ParaMEDMEM::MEDCouplingMesh *ReadMeshFromFile(const char *fileName, const char *meshName, int meshDimRelToMax=0);
+ static ParaMEDMEM::MEDCouplingMesh *ReadMeshFromFile(const char *fileName, int meshDimRelToMax=0);
static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFile(const char *fileName, const char *meshName, int meshDimRelToMax=0);
static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFile(const char *fileName, int meshDimRelToMax=0);
static int ReadUMeshDimFromFile(const char *fileName, const char *meshName);
static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldNode(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order);
static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldGauss(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order);
static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldGaussNE(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order);
+ static void WriteMesh(const char *fileName, const ParaMEDMEM::MEDCouplingMesh *mesh, bool writeFromScratch);
static void WriteUMesh(const char *fileName, const ParaMEDMEM::MEDCouplingUMesh *mesh, bool writeFromScratch);
static void WriteUMeshDep(const char *fileName, const ParaMEDMEM::MEDCouplingUMesh *mesh, bool writeFromScratch);
static void WriteUMeshesPartition(const char *fileName, const char *meshName, const std::vector<const ParaMEDMEM::MEDCouplingUMesh *>& meshes, bool writeFromScratch);
%newobject MEDLoader::ReadUMeshFromFamilies;
%newobject MEDLoader::ReadUMeshFromGroups;
%newobject MEDLoader::ReadUMeshFromFile;
+%newobject MEDLoader::ReadMeshFromFile;
%newobject MEDLoader::ReadField;
%newobject MEDLoader::ReadFieldCell;
%newobject MEDLoader::ReadFieldNode;
{
public:
static bool HasXDR();
+ static std::string MEDFileVersionStr();
static void SetEpsilonForNodeComp(double val) throw(INTERP_KERNEL::Exception);
static void SetCompPolicyForCell(int val) throw(INTERP_KERNEL::Exception);
static void SetTooLongStrPolicy(int val) throw(INTERP_KERNEL::Exception);
static double GetTimeAttachedOnFieldIteration(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
%extend
{
+ static PyObject *MEDFileVersion()
+ {
+ int major,minor,release;
+ MEDLoader::MEDFileVersion(major,minor,release);
+ PyObject *ret(PyTuple_New(3));
+ PyTuple_SetItem(ret,0,SWIG_From_int(major));
+ PyTuple_SetItem(ret,1,SWIG_From_int(minor));
+ PyTuple_SetItem(ret,2,SWIG_From_int(release));
+ return ret;
+ }
+
static PyObject *GetFieldIterations(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception)
{
std::vector< std::pair<int,int> > res=MEDLoader::GetFieldIterations(type,fileName,meshName,fieldName);
return MEDLoader::ReadUMeshFromFamilies(fileName,meshName,meshDimRelToMax,fams);
}
}
+ static ParaMEDMEM::MEDCouplingMesh *ReadMeshFromFile(const char *fileName, const char *meshName, int meshDimRelToMax=0) throw(INTERP_KERNEL::Exception);
+ static ParaMEDMEM::MEDCouplingMesh *ReadMeshFromFile(const char *fileName, int meshDimRelToMax=0) throw(INTERP_KERNEL::Exception);
static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFile(const char *fileName, const char *meshName, int meshDimRelToMax=0) throw(INTERP_KERNEL::Exception);
static ParaMEDMEM::MEDCouplingUMesh *ReadUMeshFromFile(const char *fileName, int meshDimRelToMax=0) throw(INTERP_KERNEL::Exception);
static int ReadUMeshDimFromFile(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception);
static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldNode(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldGauss(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
static ParaMEDMEM::MEDCouplingFieldDouble *ReadFieldGaussNE(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception);
+ static void WriteMesh(const char *fileName, const ParaMEDMEM::MEDCouplingMesh *mesh, bool writeFromScratch) throw(INTERP_KERNEL::Exception);
static void WriteUMesh(const char *fileName, const ParaMEDMEM::MEDCouplingUMesh *mesh, bool writeFromScratch) throw(INTERP_KERNEL::Exception);
static void WriteUMeshDep(const char *fileName, const ParaMEDMEM::MEDCouplingUMesh *mesh, bool writeFromScratch) throw(INTERP_KERNEL::Exception);
static void WriteField(const char *fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch) throw(INTERP_KERNEL::Exception);
void addNodeGroup(const DataArrayInt *ids) throw(INTERP_KERNEL::Exception);
void addGroup(int meshDimRelToMaxExt, const DataArrayInt *ids) throw(INTERP_KERNEL::Exception);
void removeMeshAtLevel(int meshDimRelToMax) throw(INTERP_KERNEL::Exception);
+ void setMeshAtLevel(int meshDimRelToMax, MEDCoupling1GTUMesh *m) throw(INTERP_KERNEL::Exception);
void setMeshAtLevel(int meshDimRelToMax, MEDCouplingUMesh *m, bool newOrOld=false) throw(INTERP_KERNEL::Exception);
void optimizeFamilies() throw(INTERP_KERNEL::Exception);
DataArrayInt *zipCoords() throw(INTERP_KERNEL::Exception);
static MEDFileField1TS *New(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
static MEDFileField1TS *New(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
static MEDFileField1TS *New();
- ParaMEDMEM::MEDFileIntField1TS *convertToInt(bool deepCpyGlobs=true) const throw(INTERP_KERNEL::Exception);
+ ParaMEDMEM::MEDFileIntField1TS *convertToInt(bool isDeepCpyGlobs=true) const throw(INTERP_KERNEL::Exception);
MEDCouplingFieldDouble *getFieldAtLevel(TypeOfField type, int meshDimRelToMax, int renumPol=0) const throw(INTERP_KERNEL::Exception);
MEDCouplingFieldDouble *getFieldAtTopLevel(TypeOfField type, int renumPol=0) const throw(INTERP_KERNEL::Exception);
MEDCouplingFieldDouble *getFieldOnMeshAtLevel(TypeOfField type, const MEDCouplingMesh *mesh, int renumPol=0) const throw(INTERP_KERNEL::Exception);
static MEDFileIntField1TS *New(const char *fileName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
static MEDFileIntField1TS *New(const char *fileName, const char *fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
static MEDFileIntField1TS *New(const char *fileName, const char *fieldName, int iteration, int order, bool loadAll=true) throw(INTERP_KERNEL::Exception);
- ParaMEDMEM::MEDFileField1TS *convertToDouble(bool deepCpyGlobs=true) const throw(INTERP_KERNEL::Exception);
+ ParaMEDMEM::MEDFileField1TS *convertToDouble(bool isDeepCpyGlobs=true) const throw(INTERP_KERNEL::Exception);
//
void setFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals) throw(INTERP_KERNEL::Exception);
void setFieldProfile(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
//
void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception);
void appendFieldProfile(const MEDCouplingFieldDouble *field, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
- ParaMEDMEM::MEDFileIntFieldMultiTS *convertToInt(bool deepCpyGlobs=true) const throw(INTERP_KERNEL::Exception);
+ ParaMEDMEM::MEDFileIntFieldMultiTS *convertToInt(bool isDeepCpyGlobs=true) const throw(INTERP_KERNEL::Exception);
%extend
{
MEDFileFieldMultiTS()
//
void appendFieldNoProfileSBT(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals) throw(INTERP_KERNEL::Exception);
void appendFieldProfile(const MEDCouplingFieldDouble *field, const DataArrayInt *arrOfVals, const MEDFileMesh *mesh, int meshDimRelToMax, const DataArrayInt *profile) throw(INTERP_KERNEL::Exception);
- ParaMEDMEM::MEDFileFieldMultiTS *convertToDouble(bool deepCpyGlobs=true) const throw(INTERP_KERNEL::Exception);
+ ParaMEDMEM::MEDFileFieldMultiTS *convertToDouble(bool isDeepCpyGlobs=true) const throw(INTERP_KERNEL::Exception);
%extend
{
MEDFileIntFieldMultiTS()
f2=MEDLoader.MEDLoader.ReadFieldCell(fileName,m.getName(),0,f.getName(),-1,-1)
self.assertTrue(f.isEqual(f2,1e-12,1e-12))
pass
+
+ def testMultiMeshTypeWrite0(self):
+ fname="Pyfile73.med"
+ m=MEDLoader.MEDCoupling1SGTUMesh("mesh",MEDLoader.NORM_QUAD4) ; m.allocateCells()
+ m.insertNextCell([0,2,1,3])
+ m.setCoords(MEDLoader.DataArrayDouble([0.,0.,1.,1.,1.,0.,0.,1.],4,2))
+ #
+ ms=[m.deepCpy() for i in xrange(4)]
+ for i,elt in enumerate(ms):
+ elt.translate([float(i)*1.5,0.])
+ pass
+ #
+ m0=MEDLoader.MEDCoupling1SGTUMesh.Merge1SGTUMeshes(ms)
+ f=m0.getMeasureField(False) ; f.getArray().setInfoOnComponents(["ABC [defg]"])
+ MEDLoader.MEDLoader.WriteField(fname,f,True)
+ #
+ fRead=MEDLoader.MEDLoader.ReadFieldCell(fname,"merge",0,f.getName(),-1,-1)
+ fRead.setMesh(MEDLoader.MEDCoupling1SGTUMesh(fRead.getMesh()))
+ self.assertTrue(f.isEqual(fRead,1e-12,1e-12))
+ #
+ m0=m0.buildUnstructured() ; m0.convertAllToPoly()
+ m0=MEDLoader.MEDCoupling1DGTUMesh(m0)
+ f=m0.getMeasureField(False) ; f.getArray().setInfoOnComponents(["ABC [defg]"])
+ MEDLoader.MEDLoader.WriteField(fname,f,True)
+ #
+ fRead=MEDLoader.MEDLoader.ReadFieldCell(fname,"merge",0,f.getName(),-1,-1)
+ fRead.setMesh(MEDLoader.MEDCoupling1DGTUMesh(fRead.getMesh()))
+ self.assertTrue(f.isEqual(fRead,1e-12,1e-12))
+ #
+ m0=MEDLoader.MEDCouplingCMesh()
+ arr=MEDLoader.DataArrayDouble(4) ; arr.iota()
+ m0.setCoords(arr,arr)
+ m0.setName("mesh")
+ f=m0.getMeasureField(False) ; f.getArray().setInfoOnComponents(["ABC [defg]"])
+ MEDLoader.MEDLoader.WriteField(fname,f,True)
+ #
+ fRead=MEDLoader.MEDLoader.ReadFieldCell(fname,"mesh",0,f.getName(),-1,-1)
+ self.assertTrue(f.isEqual(fRead,1e-12,1e-12))
+ #
+ c=m0.buildUnstructured().getCoords()
+ m0=MEDLoader.MEDCouplingCurveLinearMesh("mesh")
+ m0.setNodeGridStructure([4,4])
+ m0.setCoords(c)
+ f=m0.getMeasureField(False) ; f.getArray().setInfoOnComponents(["ABC [defg]"])
+ MEDLoader.MEDLoader.WriteField(fname,f,True)
+ #
+ fRead=MEDLoader.MEDLoader.ReadFieldCell(fname,"mesh",0,f.getName(),-1,-1)
+ self.assertTrue(f.isEqual(fRead,1e-12,1e-12))
+ pass
+
+ def testMultiMeshTypeWrite1(self):
+ fname="Pyfile74.med"
+ m=MEDLoader.MEDCoupling1SGTUMesh("mesh",MEDLoader.NORM_QUAD4) ; m.allocateCells()
+ m.insertNextCell([0,2,1,3])
+ m.setCoords(MEDLoader.DataArrayDouble([0.,0.,1.,1.,1.,0.,0.,1.],4,2))
+ #
+ ms=[m.deepCpy() for i in xrange(4)]
+ for i,elt in enumerate(ms):
+ elt.translate([float(i)*1.5,0.])
+ pass
+ m0=MEDLoader.MEDCoupling1SGTUMesh.Merge1SGTUMeshes(ms)
+ MEDLoader.MEDLoader.WriteMesh(fname,m0,True)
+ #
+ mRead=MEDLoader.MEDLoader.ReadMeshFromFile(fname,"merge",0)
+ self.assertTrue(isinstance(mRead,MEDLoader.MEDCouplingUMesh))
+ mRead=MEDLoader.MEDCoupling1SGTUMesh(mRead)
+ self.assertTrue(m0.isEqual(mRead,1e-12))
+ #
+ m0=m0.buildUnstructured() ; m0.convertAllToPoly()
+ m0=MEDLoader.MEDCoupling1DGTUMesh(m0)
+ MEDLoader.MEDLoader.WriteMesh(fname,m0,True)
+ #
+ mRead=MEDLoader.MEDLoader.ReadMeshFromFile(fname,"merge",0)
+ mRead=MEDLoader.MEDCoupling1DGTUMesh(mRead)
+ self.assertTrue(m0.isEqual(mRead,1e-12))
+ #
+ m0=MEDLoader.MEDCouplingCMesh()
+ arr=MEDLoader.DataArrayDouble(4) ; arr.iota()
+ m0.setCoords(arr,arr)
+ m0.setName("mesh")
+ MEDLoader.MEDLoader.WriteMesh(fname,m0,True)
+ #
+ mRead=MEDLoader.MEDLoader.ReadMeshFromFile(fname,0)
+ self.assertTrue(isinstance(mRead,MEDLoader.MEDCouplingCMesh))
+ self.assertTrue(m0.isEqual(mRead,1e-12))
+ #
+ c=m0.buildUnstructured().getCoords()
+ m0=MEDLoader.MEDCouplingCurveLinearMesh("mesh")
+ m0.setNodeGridStructure([4,4])
+ m0.setCoords(c)
+ MEDLoader.MEDLoader.WriteMesh(fname,m0,True)
+ #
+ mRead=MEDLoader.MEDLoader.ReadMeshFromFile(fname,0)
+ self.assertTrue(isinstance(mRead,MEDLoader.MEDCouplingCurveLinearMesh))
+ self.assertTrue(m0.isEqual(mRead,1e-12))
+ pass
+
pass
unittest.main()
self.assertTrue(m.getFamilyFieldAtLevel(1).isEqual(DataArrayInt([-1,-1,-1,-1,-1,-2,-2,-2,-2,-2,-2,0,-1,-3,-3,-3])))
pass
- @unittest.skipUnless(False,"requires Vadim's green light")
+ #@unittest.skipUnless(False,"requires Vadim's green light")
def testWRQPolyg1(self):
fname="Pyfile72.med"
m=MEDCoupling1SGTUMesh("mesh",NORM_QUAD4) ; m.allocateCells()