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
};
namespace MEDLoaderNS
{
- int readUMeshDimFromFile(const char *fileName, const char *meshName, std::vector<int>& possibilities);
+ int readUMeshDimFromFile(const std::string& fileName, const std::string& meshName, std::vector<int>& possibilities);
void dispatchElems(int nbOfElemCell, int nbOfElemFace, int& nbOfElem, med_entity_type& whichEntity);
- void writeFieldWithoutReadingAndMappingOfMeshInFile(const char *fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch);
- med_int getIdFromMeshName(med_idt fid, const char *meshName, std::string& trueMeshName) throw(INTERP_KERNEL::Exception);
+ void writeFieldWithoutReadingAndMappingOfMeshInFile(const std::string& fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch);
+ med_int getIdFromMeshName(med_idt fid, const std::string& meshName, std::string& trueMeshName) throw(INTERP_KERNEL::Exception);
std::vector<std::string> getMeshNamesFid(med_idt fid);
}
/// @cond INTERNAL
/*!
- * This method returns a first quick overview of mesh with name 'meshName' into the file 'fileName'.
+ * This method returns a first quick overview of mesh with name \a meshName into the file \a fileName.
* @param possibilities the relativeToMeshDim authorized to returned maxdim. This vector is systematically cleared at the begin of this method.
* @return the maximal mesh dimension of specified mesh. If nothing found -1 is returned.
*/
-int MEDLoaderNS::readUMeshDimFromFile(const char *fileName, const char *meshName, std::vector<int>& possibilities)
+int MEDLoaderNS::readUMeshDimFromFile(const std::string& fileName, const std::string& meshName, std::vector<int>& possibilities)
{
possibilities.clear();
- MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+ MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
int ret;
std::set<int> poss;
char nommaa[MED_NAME_SIZE+1];
return ret;
}
-med_int MEDLoaderNS::getIdFromMeshName(med_idt fid, const char *meshName, std::string& trueMeshName) throw(INTERP_KERNEL::Exception)
+med_int MEDLoaderNS::getIdFromMeshName(med_idt fid, const std::string& meshName, std::string& trueMeshName) throw(INTERP_KERNEL::Exception)
{
- if(meshName==0)
+ if(meshName.empty())
{
std::vector<std::string> meshes=getMeshNamesFid(fid);
if(meshes.empty())
/// @endcond
+void MEDLoader::AssignStaticWritePropertiesTo(ParaMEDMEM::MEDFileWritable& obj)
+{
+ obj.setTooLongStrPolicy(_TOO_LONG_STR);
+}
+
+bool MEDLoader::HasXDR()
+{
+#ifdef HAS_XDR
+ return true;
+#else
+ return false;
+#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.
*/
-void MEDLoader::SetEpsilonForNodeComp(double val) throw(INTERP_KERNEL::Exception)
+void MEDLoader::SetEpsilonForNodeComp(double val)
{
_EPS_FOR_NODE_COMP=val;
}
/*!
* This method sets the policy comparison when trying to fit the already written mesh on a field. The semantic of the policy is specified in MEDCouplingUMesh::zipConnectivityTraducer.
*/
-void MEDLoader::SetCompPolicyForCell(int val) throw(INTERP_KERNEL::Exception)
+void MEDLoader::SetCompPolicyForCell(int val)
{
_COMP_FOR_CELL=val;
}
* This method set the behaviour of MEDLoader when a too long string is seen in datastructure before copy it in MED file.
* By default (0) an exception is thrown. If equal to 1 a warning is emitted in std_err but no exception is thrown.
*/
-void MEDLoader::SetTooLongStrPolicy(int val) throw(INTERP_KERNEL::Exception)
+void MEDLoader::SetTooLongStrPolicy(int val)
{
_TOO_LONG_STR=val;
}
* - the space dimension
* - the number of nodes
*/
-std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > > MEDLoader::GetUMeshGlobalInfo(const char *fileName, const char *meshName, int &meshDim, int& spaceDim, int& numberOfNodes) throw(INTERP_KERNEL::Exception)
+std::vector< std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > > MEDLoader::GetUMeshGlobalInfo(const std::string& fileName, const std::string& meshName, int &meshDim, int& spaceDim, int& numberOfNodes)
{
CheckFileForRead(fileName);
- MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+ MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
std::set<int> poss;
char nommaa[MED_NAME_SIZE+1];
char maillage_description[MED_COMMENT_SIZE+1];
return ret;
}
-void MEDLoader::CheckFileForRead(const char *fileName) throw(INTERP_KERNEL::Exception)
+void MEDLoader::CheckFileForRead(const std::string& fileName)
{
MEDFileUtilities::CheckFileForRead(fileName);
}
-std::vector<std::string> MEDLoader::GetMeshNames(const char *fileName) throw(INTERP_KERNEL::Exception)
+std::vector<std::string> MEDLoader::GetMeshNames(const std::string& fileName)
{
CheckFileForRead(fileName);
- MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+ MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
std::vector<std::string> ret=MEDLoaderNS::getMeshNamesFid(fid);
return ret;
}
-std::vector< std::pair<std::string,std::string> > MEDLoader::GetComponentsNamesOfField(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
+std::vector< std::pair<std::string,std::string> > MEDLoader::GetComponentsNamesOfField(const std::string& fileName, const std::string& fieldName)
{
CheckFileForRead(fileName);
- MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+ MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
med_int nbFields=MEDnField(fid);
std::vector<std::string> fields(nbFields);
med_field_type typcha;
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
-std::vector<std::string> MEDLoader::GetMeshNamesOnField(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
+std::vector<std::string> MEDLoader::GetMeshNamesOnField(const std::string& fileName, const std::string& fieldName)
{
CheckFileForRead(fileName);
std::vector<std::string> ret;
//
- MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+ MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
med_int nbFields=MEDnField(fid);
//
med_field_type typcha;
return ret;
}
-std::vector<std::string> MEDLoader::GetMeshFamiliesNames(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception)
+std::vector<std::string> MEDLoader::GetMeshFamiliesNames(const std::string& fileName, const std::string& meshName)
{
CheckFileForRead(fileName);
- MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
- med_int nfam=MEDnFamily(fid,meshName);
+ MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
+ med_int nfam=MEDnFamily(fid,meshName.c_str());
std::vector<std::string> ret(nfam);
char nomfam[MED_NAME_SIZE+1];
med_int numfam;
for(int i=0;i<nfam;i++)
{
- int ngro=MEDnFamilyGroup(fid,meshName,i+1);
- med_int natt=MEDnFamily23Attribute(fid,meshName,i+1);
+ int ngro=MEDnFamilyGroup(fid,meshName.c_str(),i+1);
+ med_int natt=MEDnFamily23Attribute(fid,meshName.c_str(),i+1);
INTERP_KERNEL::AutoPtr<med_int> attide=new med_int[natt];
INTERP_KERNEL::AutoPtr<med_int> attval=new med_int[natt];
INTERP_KERNEL::AutoPtr<char> attdes=new char[MED_COMMENT_SIZE*natt+1];
INTERP_KERNEL::AutoPtr<char> gro=new char[MED_LNAME_SIZE*ngro+1];
- MEDfamily23Info(fid,meshName,i+1,nomfam,attide,attval,attdes,&numfam,gro);
+ MEDfamily23Info(fid,meshName.c_str(),i+1,nomfam,attide,attval,attdes,&numfam,gro);
std::string cur=MEDLoaderBase::buildStringFromFortran(nomfam,sizeof(nomfam));
ret[i]=cur;
}
}
-std::vector<std::string> MEDLoader::GetMeshFamiliesNamesOnGroup(const char *fileName, const char *meshName, const char *grpName) throw(INTERP_KERNEL::Exception)
+std::vector<std::string> MEDLoader::GetMeshFamiliesNamesOnGroup(const std::string& fileName, const std::string& meshName, const std::string& grpName)
{
CheckFileForRead(fileName);
- MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
- med_int nfam=MEDnFamily(fid,meshName);
+ MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
+ med_int nfam=MEDnFamily(fid,meshName.c_str());
std::vector<std::string> ret;
char nomfam[MED_NAME_SIZE+1];
med_int numfam;
for(int i=0;i<nfam;i++)
{
- int ngro=MEDnFamilyGroup(fid,meshName,i+1);
- med_int natt=MEDnFamily23Attribute(fid,meshName,i+1);
+ int ngro=MEDnFamilyGroup(fid,meshName.c_str(),i+1);
+ med_int natt=MEDnFamily23Attribute(fid,meshName.c_str(),i+1);
INTERP_KERNEL::AutoPtr<med_int> attide=new med_int[natt];
INTERP_KERNEL::AutoPtr<med_int> attval=new med_int[natt];
INTERP_KERNEL::AutoPtr<char> attdes=new char[MED_COMMENT_SIZE*natt+1];
INTERP_KERNEL::AutoPtr<char> gro=new char[MED_LNAME_SIZE*ngro+1];
- MEDfamily23Info(fid,meshName,i+1,nomfam,attide,attval,attdes,&numfam,gro);
+ MEDfamily23Info(fid,meshName.c_str(),i+1,nomfam,attide,attval,attdes,&numfam,gro);
std::string cur=MEDLoaderBase::buildStringFromFortran(nomfam,sizeof(nomfam));
for(int j=0;j<ngro;j++)
{
return ret;
}
-std::vector<std::string> MEDLoader::GetMeshGroupsNamesOnFamily(const char *fileName, const char *meshName, const char *famName) throw(INTERP_KERNEL::Exception)
+std::vector<std::string> MEDLoader::GetMeshGroupsNamesOnFamily(const std::string& fileName, const std::string& meshName, const std::string& famName)
{
CheckFileForRead(fileName);
- MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
- med_int nfam=MEDnFamily(fid,meshName);
+ MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
+ med_int nfam=MEDnFamily(fid,meshName.c_str());
std::vector<std::string> ret;
char nomfam[MED_NAME_SIZE+1];
med_int numfam;
bool found=false;
for(int i=0;i<nfam && !found;i++)
{
- int ngro=MEDnFamilyGroup(fid,meshName,i+1);
- med_int natt=MEDnFamily23Attribute(fid,meshName,i+1);
+ int ngro=MEDnFamilyGroup(fid,meshName.c_str(),i+1);
+ med_int natt=MEDnFamily23Attribute(fid,meshName.c_str(),i+1);
INTERP_KERNEL::AutoPtr<med_int> attide=new med_int[natt];
INTERP_KERNEL::AutoPtr<med_int> attval=new med_int[natt];
INTERP_KERNEL::AutoPtr<char> attdes=new char[MED_COMMENT_SIZE*natt+1];
INTERP_KERNEL::AutoPtr<char> gro=new char[MED_LNAME_SIZE*ngro+1];
- MEDfamily23Info(fid,meshName,i+1,nomfam,attide,attval,attdes,&numfam,gro);
+ MEDfamily23Info(fid,meshName.c_str(),i+1,nomfam,attide,attval,attdes,&numfam,gro);
std::string cur=MEDLoaderBase::buildStringFromFortran(nomfam,sizeof(nomfam));
found=(cur==famName);
if(found)
}
-std::vector<std::string> MEDLoader::GetMeshGroupsNames(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception)
+std::vector<std::string> MEDLoader::GetMeshGroupsNames(const std::string& fileName, const std::string& meshName)
{
CheckFileForRead(fileName);
- MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
- med_int nfam=MEDnFamily(fid,meshName);
+ MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
+ med_int nfam=MEDnFamily(fid,meshName.c_str());
std::vector<std::string> ret;
char nomfam[MED_NAME_SIZE+1];
med_int numfam;
for(int i=0;i<nfam;i++)
{
- int ngro=MEDnFamilyGroup(fid,meshName,i+1);
- med_int natt=MEDnFamily23Attribute(fid,meshName,i+1);
+ int ngro=MEDnFamilyGroup(fid,meshName.c_str(),i+1);
+ med_int natt=MEDnFamily23Attribute(fid,meshName.c_str(),i+1);
INTERP_KERNEL::AutoPtr<med_int> attide=new med_int[natt];
INTERP_KERNEL::AutoPtr<med_int> attval=new med_int[natt];
INTERP_KERNEL::AutoPtr<char> attdes=new char[MED_COMMENT_SIZE*natt+1];
INTERP_KERNEL::AutoPtr<char> gro=new char[MED_LNAME_SIZE*ngro+1];
- MEDfamily23Info(fid,meshName,i+1,nomfam,attide,attval,attdes,&numfam,gro);
+ MEDfamily23Info(fid,meshName.c_str(),i+1,nomfam,attide,attval,attdes,&numfam,gro);
for(int j=0;j<ngro;j++)
{
std::string cur=MEDLoaderBase::buildStringFromFortran(gro+j*MED_LNAME_SIZE,MED_LNAME_SIZE);
}
return ret;
}
-std::vector<ParaMEDMEM::TypeOfField> MEDLoader::GetTypesOfField(const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception)
+std::vector<ParaMEDMEM::TypeOfField> MEDLoader::GetTypesOfField(const std::string& fileName, const std::string& meshName, const std::string& fieldName)
{
CheckFileForRead(fileName);
std::vector<ParaMEDMEM::TypeOfField> ret;
- MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+ MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
med_int nbFields=MEDnField(fid);
//
med_field_type typcha;
return ret;
}
-std::vector<std::string> MEDLoader::GetAllFieldNames(const char *fileName) throw(INTERP_KERNEL::Exception)
+std::vector<std::string> MEDLoader::GetAllFieldNames(const std::string& fileName)
{
CheckFileForRead(fileName);
std::vector<std::string> ret;
- MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+ MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
med_int nbFields=MEDnField(fid);
med_field_type typcha;
for(int i=0;i<nbFields;i++)
return ret;
}
-std::vector<std::string> MEDLoader::GetAllFieldNamesOnMesh(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception)
+std::vector<std::string> MEDLoader::GetAllFieldNamesOnMesh(const std::string& fileName, const std::string& meshName)
{
CheckFileForRead(fileName);
std::vector<std::string> ret;
- MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+ MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
med_int nbFields=MEDnField(fid);
//
med_field_type typcha;
return ret;
}
-std::vector<std::string> MEDLoader::GetFieldNamesOnMesh(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception)
+std::vector<std::string> MEDLoader::GetFieldNamesOnMesh(ParaMEDMEM::TypeOfField type, const std::string& fileName, const std::string& meshName)
{
CheckFileForRead(fileName);
switch(type)
}
}
-std::vector<std::string> MEDLoader::GetCellFieldNamesOnMesh(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception)
+std::vector<std::string> MEDLoader::GetCellFieldNamesOnMesh(const std::string& fileName, const std::string& meshName)
{
CheckFileForRead(fileName);
std::vector<std::string> ret;
- MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+ MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
med_int nbFields=MEDnField(fid);
//
med_field_type typcha;
return ret;
}
-std::vector<std::string> MEDLoader::GetNodeFieldNamesOnMesh(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception)
+std::vector<std::string> MEDLoader::GetNodeFieldNamesOnMesh(const std::string& fileName, const std::string& meshName)
{
CheckFileForRead(fileName);
std::vector<std::string> ret;
- MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+ MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
med_int nbFields=MEDnField(fid);
char pflname[MED_NAME_SIZE+1]="";
char locname[MED_NAME_SIZE+1]="";
return ret;
}
-std::vector< std::pair< std::pair<int,int>, double> > MEDLoader::GetAllFieldIterations(const char *fileName, const char *fieldName) throw(INTERP_KERNEL::Exception)
+std::vector< std::pair< std::pair<int,int>, double> > MEDLoader::GetAllFieldIterations(const std::string& fileName, const std::string& fieldName)
{
CheckFileForRead(fileName);
std::vector< std::pair< std::pair<int,int>, double > > ret;
- MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+ MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
med_int nbFields=MEDnField(fid);
//
med_field_type typcha;
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
-double MEDLoader::GetTimeAttachedOnFieldIteration(const char *fileName, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception)
+double MEDLoader::GetTimeAttachedOnFieldIteration(const std::string& fileName, const std::string& fieldName, int iteration, int order)
{
CheckFileForRead(fileName);
- MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+ MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
med_int nbFields=MEDnField(fid);
//
med_field_type typcha;
return ret;
}
-std::vector< std::pair<int,int> > MEDLoader::GetFieldIterations(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception)
+std::vector< std::pair<int,int> > MEDLoader::GetFieldIterations(ParaMEDMEM::TypeOfField type, const std::string& fileName, const std::string& meshName, const std::string& fieldName)
{
CheckFileForRead(fileName);
switch(type)
}
}
-std::vector< std::pair<int,int> > MEDLoader::GetCellFieldIterations(const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception)
+std::vector< std::pair<int,int> > MEDLoader::GetCellFieldIterations(const std::string& fileName, const std::string& meshName, const std::string& fieldName)
{
CheckFileForRead(fileName);
std::string meshNameCpp(meshName);
std::vector< std::pair<int,int> > ret;
- MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+ MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
med_int nbFields=MEDnField(fid);
//
med_field_type typcha;
return ret;
}
-std::vector< std::pair<int,int> > MEDLoader::GetNodeFieldIterations(const char *fileName, const char *meshName, const char *fieldName) throw(INTERP_KERNEL::Exception)
+std::vector< std::pair<int,int> > MEDLoader::GetNodeFieldIterations(const std::string& fileName, const std::string& meshName, const std::string& fieldName)
{
CheckFileForRead(fileName);
std::string meshNameCpp(meshName);
std::vector< std::pair<int,int> > ret;
- MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName,MED_ACC_RDONLY);
+ MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
med_int nbFields=MEDnField(fid);
//
med_field_type typcha;
return ret;
}
-MEDCouplingUMesh *MEDLoader::ReadUMeshFromFile(const char *fileName, const char *meshName, int meshDimRelToMax) throw(INTERP_KERNEL::Exception)
+ParaMEDMEM::MEDCouplingMesh *MEDLoader::ReadMeshFromFile(const std::string& fileName, const std::string& meshName, int meshDimRelToMax)
{
CheckFileForRead(fileName);
- MEDCouplingAutoRefCountObjectPtr<MEDFileMesh> mm=MEDFileMesh::New(fileName,meshName);
+ 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));
MEDFileMesh *mmPtr(mm);
MEDFileUMesh *mmuPtr=dynamic_cast<MEDFileUMesh *>(mmPtr);
if(!mmuPtr)
return mmuPtr->getMeshAtLevel(meshDimRelToMax,true);
}
-ParaMEDMEM::MEDCouplingUMesh *MEDLoader::ReadUMeshFromFile(const char *fileName, int meshDimRelToMax) throw(INTERP_KERNEL::Exception)
+ParaMEDMEM::MEDCouplingUMesh *MEDLoader::ReadUMeshFromFile(const std::string& fileName, int meshDimRelToMax)
{
CheckFileForRead(fileName);
- MEDCouplingAutoRefCountObjectPtr<MEDFileMesh> mm=MEDFileMesh::New(fileName);
+ MEDCouplingAutoRefCountObjectPtr<MEDFileMesh> mm(MEDFileMesh::New(fileName));
MEDFileMesh *mmPtr(mm);
MEDFileUMesh *mmuPtr=dynamic_cast<MEDFileUMesh *>(mmPtr);
if(!mmuPtr)
return mmuPtr->getMeshAtLevel(meshDimRelToMax,true);
}
-int MEDLoader::ReadUMeshDimFromFile(const char *fileName, const char *meshName) throw(INTERP_KERNEL::Exception)
+int MEDLoader::ReadUMeshDimFromFile(const std::string& fileName, const std::string& meshName)
{
CheckFileForRead(fileName);
std::vector<int> poss;
return MEDLoaderNS::readUMeshDimFromFile(fileName,meshName,poss);
}
-ParaMEDMEM::MEDCouplingUMesh *MEDLoader::ReadUMeshFromFamilies(const char *fileName, const char *meshName, int meshDimRelToMax, const std::vector<std::string>& fams) throw(INTERP_KERNEL::Exception)
+ParaMEDMEM::MEDCouplingUMesh *MEDLoader::ReadUMeshFromFamilies(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::vector<std::string>& fams)
{
CheckFileForRead(fileName);
- MEDCouplingAutoRefCountObjectPtr<MEDFileMesh> mm=MEDFileMesh::New(fileName,meshName);
+ MEDCouplingAutoRefCountObjectPtr<MEDFileMesh> mm(MEDFileMesh::New(fileName,meshName));
MEDFileMesh *mmPtr(mm);
MEDFileUMesh *mmuPtr=dynamic_cast<MEDFileUMesh *>(mmPtr);
if(!mmuPtr)
return mmuPtr->getFamilies(meshDimRelToMax,fams,true);
}
-ParaMEDMEM::MEDCouplingUMesh *MEDLoader::ReadUMeshFromGroups(const char *fileName, const char *meshName, int meshDimRelToMax, const std::vector<std::string>& grps) throw(INTERP_KERNEL::Exception)
+ParaMEDMEM::MEDCouplingUMesh *MEDLoader::ReadUMeshFromGroups(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::vector<std::string>& grps)
{
CheckFileForRead(fileName);
MEDCouplingAutoRefCountObjectPtr<MEDFileMesh> mm=MEDFileMesh::New(fileName,meshName);
return mmuPtr->getGroups(meshDimRelToMax,grps,true);
}
-ParaMEDMEM::MEDCouplingFieldDouble *MEDLoader::ReadField(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception)
+ParaMEDMEM::MEDCouplingFieldDouble *MEDLoader::ReadField(ParaMEDMEM::TypeOfField type, const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order)
{
CheckFileForRead(fileName);
switch(type)
}
}
-std::vector<ParaMEDMEM::MEDCouplingFieldDouble *> MEDLoader::ReadFieldsOnSameMesh(ParaMEDMEM::TypeOfField type, const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName,
+std::vector<ParaMEDMEM::MEDCouplingFieldDouble *> MEDLoader::ReadFieldsOnSameMesh(ParaMEDMEM::TypeOfField type, const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName,
const std::vector<std::pair<int,int> >& its) throw(INTERP_KERNEL::Exception)
{
if(its.empty())
return ret;
}
-std::vector<ParaMEDMEM::MEDCouplingFieldDouble *> MEDLoader::ReadFieldsCellOnSameMesh(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName,
+std::vector<ParaMEDMEM::MEDCouplingFieldDouble *> MEDLoader::ReadFieldsCellOnSameMesh(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName,
const std::vector<std::pair<int,int> >& its) throw(INTERP_KERNEL::Exception)
{
return ReadFieldsOnSameMesh(ON_CELLS,fileName,meshName,meshDimRelToMax,fieldName,its);
}
-std::vector<ParaMEDMEM::MEDCouplingFieldDouble *> MEDLoader::ReadFieldsNodeOnSameMesh(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName,
+std::vector<ParaMEDMEM::MEDCouplingFieldDouble *> MEDLoader::ReadFieldsNodeOnSameMesh(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName,
const std::vector<std::pair<int,int> >& its) throw(INTERP_KERNEL::Exception)
{
return ReadFieldsOnSameMesh(ON_NODES,fileName,meshName,meshDimRelToMax,fieldName,its);
}
-std::vector<ParaMEDMEM::MEDCouplingFieldDouble *> MEDLoader::ReadFieldsGaussOnSameMesh(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName,
+std::vector<ParaMEDMEM::MEDCouplingFieldDouble *> MEDLoader::ReadFieldsGaussOnSameMesh(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName,
const std::vector<std::pair<int,int> >& its) throw(INTERP_KERNEL::Exception)
{
return ReadFieldsOnSameMesh(ON_GAUSS_PT,fileName,meshName,meshDimRelToMax,fieldName,its);
}
-std::vector<ParaMEDMEM::MEDCouplingFieldDouble *> MEDLoader::ReadFieldsGaussNEOnSameMesh(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName,
+std::vector<ParaMEDMEM::MEDCouplingFieldDouble *> MEDLoader::ReadFieldsGaussNEOnSameMesh(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName,
const std::vector<std::pair<int,int> >& its) throw(INTERP_KERNEL::Exception)
{
return ReadFieldsOnSameMesh(ON_GAUSS_NE,fileName,meshName,meshDimRelToMax,fieldName,its);
}
-ParaMEDMEM::MEDCouplingFieldDouble *MEDLoader::ReadFieldCell(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception)
+ParaMEDMEM::MEDCouplingFieldDouble *MEDLoader::ReadFieldCell(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order)
{
MEDCouplingAutoRefCountObjectPtr<MEDFileField1TS> ff=MEDFileField1TS::New(fileName,fieldName,iteration,order);
MEDCouplingAutoRefCountObjectPtr<MEDFileMesh> mm=MEDFileMesh::New(fileName,meshName);
return ret.retn();
}
-ParaMEDMEM::MEDCouplingFieldDouble *MEDLoader::ReadFieldNode(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception)
+ParaMEDMEM::MEDCouplingFieldDouble *MEDLoader::ReadFieldNode(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order)
{
MEDCouplingAutoRefCountObjectPtr<MEDFileField1TS> ff=MEDFileField1TS::New(fileName,fieldName,iteration,order);
MEDCouplingAutoRefCountObjectPtr<MEDFileMesh> mm=MEDFileMesh::New(fileName,meshName);
return ret.retn();
}
-ParaMEDMEM::MEDCouplingFieldDouble *MEDLoader::ReadFieldGauss(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception)
+ParaMEDMEM::MEDCouplingFieldDouble *MEDLoader::ReadFieldGauss(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order)
{
MEDCouplingAutoRefCountObjectPtr<MEDFileField1TS> ff=MEDFileField1TS::New(fileName,fieldName,iteration,order);
MEDCouplingAutoRefCountObjectPtr<MEDFileMesh> mm=MEDFileMesh::New(fileName,meshName);
return ret.retn();
}
-ParaMEDMEM::MEDCouplingFieldDouble *MEDLoader::ReadFieldGaussNE(const char *fileName, const char *meshName, int meshDimRelToMax, const char *fieldName, int iteration, int order) throw(INTERP_KERNEL::Exception)
+ParaMEDMEM::MEDCouplingFieldDouble *MEDLoader::ReadFieldGaussNE(const std::string& fileName, const std::string& meshName, int meshDimRelToMax, const std::string& fieldName, int iteration, int order)
{
MEDCouplingAutoRefCountObjectPtr<MEDFileField1TS> ff=MEDFileField1TS::New(fileName,fieldName,iteration,order);
MEDCouplingAutoRefCountObjectPtr<MEDFileMesh> mm=MEDFileMesh::New(fileName,meshName);
return ret.retn();
}
-void MEDLoader::WriteUMesh(const char *fileName, const ParaMEDMEM::MEDCouplingUMesh *mesh, bool writeFromScratch) throw(INTERP_KERNEL::Exception)
+void MEDLoader::WriteMesh(const std::string& 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());
+ AssignStaticWritePropertiesTo(*mmu);
+ 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());
+ AssignStaticWritePropertiesTo(*mmc);
+ 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());
+ AssignStaticWritePropertiesTo(*mmc);
+ 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 std::string& fileName, const ParaMEDMEM::MEDCouplingUMesh *mesh, bool writeFromScratch)
{
if(!mesh)
throw INTERP_KERNEL::Exception("MEDLoader::WriteUMesh : input mesh is null !");
int mod=writeFromScratch?2:0;
- MEDCouplingAutoRefCountObjectPtr<MEDFileUMesh> m=MEDFileUMesh::New();
- m->setMeshAtLevel(0,static_cast<MEDCouplingUMesh *>(mesh->deepCpy()),true);
+ MEDCouplingAutoRefCountObjectPtr<MEDFileUMesh> m(MEDFileUMesh::New());
+ AssignStaticWritePropertiesTo(*m);
+ MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> mcpy(static_cast<MEDCouplingUMesh *>(mesh->deepCpy()));
+ m->setMeshAtLevel(0,mcpy,true);
m->write(fileName,mod);
}
-void MEDLoader::WriteUMeshDep(const char *fileName, const ParaMEDMEM::MEDCouplingUMesh *mesh, bool writeFromScratch) throw(INTERP_KERNEL::Exception)
+void MEDLoader::WriteUMeshDep(const std::string& fileName, const ParaMEDMEM::MEDCouplingUMesh *mesh, bool writeFromScratch)
{
MEDLoader::WriteUMesh(fileName,mesh,writeFromScratch);
}
-void MEDLoader::WriteUMeshesPartition(const char *fileName, const char *meshNameC, const std::vector<const ParaMEDMEM::MEDCouplingUMesh *>& meshes, bool writeFromScratch) throw(INTERP_KERNEL::Exception)
+void MEDLoader::WriteUMeshesPartition(const std::string& fileName, const std::string& meshNameC, const std::vector<const ParaMEDMEM::MEDCouplingUMesh *>& meshes, bool writeFromScratch)
{
std::string meshName(meshNameC);
if(meshName.empty())
std::ostringstream oss; oss << "File with name \'" << fileName << "\' has not valid permissions !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- MEDCouplingAutoRefCountObjectPtr<MEDFileUMesh> m=MEDFileUMesh::New();
+ MEDCouplingAutoRefCountObjectPtr<MEDFileUMesh> m(MEDFileUMesh::New());
+ AssignStaticWritePropertiesTo(*m);
m->setGroupsFromScratch(0,meshes,true);
m->setName(meshNameC);
int mod=writeFromScratch?2:0;
m->write(fileName,mod);
}
-void MEDLoader::WriteUMeshesPartitionDep(const char *fileName, const char *meshNameC, const std::vector<const ParaMEDMEM::MEDCouplingUMesh *>& meshes, bool writeFromScratch) throw(INTERP_KERNEL::Exception)
+void MEDLoader::WriteUMeshesPartitionDep(const std::string& fileName, const std::string& meshNameC, const std::vector<const ParaMEDMEM::MEDCouplingUMesh *>& meshes, bool writeFromScratch)
{
WriteUMeshesPartition(fileName,meshNameC,meshes,writeFromScratch);
}
-void MEDLoader::WriteUMeshes(const char *fileName, const std::vector<const ParaMEDMEM::MEDCouplingUMesh *>& meshes, bool writeFromScratch) throw(INTERP_KERNEL::Exception)
+void MEDLoader::WriteUMeshes(const std::string& fileName, const std::vector<const ParaMEDMEM::MEDCouplingUMesh *>& meshes, bool writeFromScratch)
{
int mod=writeFromScratch?2:0;
- MEDCouplingAutoRefCountObjectPtr<MEDFileUMesh> m=MEDFileUMesh::New();
+ MEDCouplingAutoRefCountObjectPtr<MEDFileUMesh> m(MEDFileUMesh::New());
+ AssignStaticWritePropertiesTo(*m);
m->setMeshes(meshes,true);
m->write(fileName,mod);
}
-void MEDLoaderNS::writeFieldWithoutReadingAndMappingOfMeshInFile(const char *fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch)
+void MEDLoaderNS::writeFieldWithoutReadingAndMappingOfMeshInFile(const std::string& fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch)
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileField1TS> ff=MEDFileField1TS::New();
+ MEDCouplingAutoRefCountObjectPtr<MEDFileField1TS> ff(MEDFileField1TS::New());
+ MEDLoader::AssignStaticWritePropertiesTo(*ff);
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)
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileUMesh> mmu=MEDFileUMesh::New();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> o2n=um->getRenumArrForMEDFileFrmt();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> n2o=o2n->invertArrayO2N2N2O(o2n->getNumberOfTuples());
+ MEDCouplingAutoRefCountObjectPtr<MEDFileUMesh> mmu(MEDFileUMesh::New());
+ MEDLoader::AssignStaticWritePropertiesTo(*mmu);
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> o2n(um->getRenumArrForMEDFileFrmt());
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> n2o(o2n->invertArrayO2N2N2O(o2n->getNumberOfTuples()));
f2->renumberCells(o2n->begin(),false);
mmu->setMeshAtLevel(0,const_cast<MEDCouplingUMesh *>(static_cast<const MEDCouplingUMesh *>(f2->getMesh())));
mmu->setRenumFieldArr(0,n2o);
ff->setFieldNoProfileSBT(f2);
mmu->write(fileName,mod);
}
+ else if(um2)
+ {
+ MEDCouplingAutoRefCountObjectPtr<MEDFileUMesh> mmu(MEDFileUMesh::New());
+ MEDLoader::AssignStaticWritePropertiesTo(*mmu);
+ mmu->setMeshAtLevel(0,const_cast<MEDCoupling1GTUMesh *>(um2));
+ ff->setFieldNoProfileSBT(f2);
+ mmu->write(fileName,mod);
+ }
+ else if(um3)
+ {
+ MEDCouplingAutoRefCountObjectPtr<MEDFileCMesh> mmc(MEDFileCMesh::New());
+ MEDLoader::AssignStaticWritePropertiesTo(*mmc);
+ mmc->setMesh(const_cast<MEDCouplingCMesh *>(um3));
+ ff->setFieldNoProfileSBT(f2);
+ mmc->write(fileName,mod);
+ }
+ else if(um4)
+ {
+ MEDCouplingAutoRefCountObjectPtr<MEDFileCurveLinearMesh> mmc(MEDFileCurveLinearMesh::New());
+ MEDLoader::AssignStaticWritePropertiesTo(*mmc);
+ 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);
}
-void MEDLoader::WriteField(const char *fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch) throw(INTERP_KERNEL::Exception)
+void MEDLoader::WriteField(const std::string& fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch)
{
if(!f)
throw INTERP_KERNEL::Exception("MEDLoader::WriteField : input field is NULL !");
MEDLoaderNS::writeFieldWithoutReadingAndMappingOfMeshInFile(fileName,f,false);
else
{
- MEDCouplingAutoRefCountObjectPtr<MEDFileMesh> mm=MEDFileMesh::New(fileName,f->getMesh()->getName());
+ MEDCouplingAutoRefCountObjectPtr<MEDFileMesh> mm(MEDFileMesh::New(fileName,f->getMesh()->getName().c_str()));
+ AssignStaticWritePropertiesTo(*mm);
const MEDFileMesh *mmPtr(mm);
const MEDFileUMesh *mmuPtr=dynamic_cast<const MEDFileUMesh *>(mmPtr);
if(!mmuPtr)
std::ostringstream oss; oss << "MEDLoader::WriteField : The file \""<< fileName << "\" already contains a mesh named \""<< f->getMesh()->getName() << "\" and this mesh in the file is not compatible (a subpart) with the mesh you intend to write ! This is maybe due to a too strict policy ! Try with to lease it by calling SetCompPolicyForCell !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- MEDCouplingAutoRefCountObjectPtr<MEDFileField1TS> f1ts=MEDFileField1TS::New();
+ MEDCouplingAutoRefCountObjectPtr<MEDFileField1TS> f1ts(MEDFileField1TS::New());
+ AssignStaticWritePropertiesTo(*f1ts);
if(part->isIdentity() && part->getNumberOfTuples()==mread->getNumberOfCells())
f1ts->setFieldNoProfileSBT(f2);
else
std::ostringstream oss; oss << "MEDLoader::WriteField : The file \""<< fileName << "\" already contains a mesh named \""<< f->getMesh()->getName() << "\" and this mesh in the file is not compatible (a subpart regarding nodes) with the mesh you intend to write ! This is maybe due to a too strict epsilon ! Try with to lease it by calling SetEpsilonForNodeComp !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- MEDCouplingAutoRefCountObjectPtr<MEDFileField1TS> f1ts=MEDFileField1TS::New();
+ MEDCouplingAutoRefCountObjectPtr<MEDFileField1TS> f1ts(MEDFileField1TS::New());
+ AssignStaticWritePropertiesTo(*f1ts);
if(part->isIdentity() && part->getNumberOfTuples()==mread->getNumberOfNodes())
f1ts->setFieldNoProfileSBT(f2);
else
}
}
-void MEDLoader::WriteFieldDep(const char *fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch) throw(INTERP_KERNEL::Exception)
+void MEDLoader::WriteFieldDep(const std::string& fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch)
{
WriteField(fileName,f,writeFromScratch);
}
-void MEDLoader::WriteFieldUsingAlreadyWrittenMesh(const char *fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f) throw(INTERP_KERNEL::Exception)
+void MEDLoader::WriteFieldUsingAlreadyWrittenMesh(const std::string& fileName, const ParaMEDMEM::MEDCouplingFieldDouble *f)
{
if(!f)
throw INTERP_KERNEL::Exception("MEDLoader::WriteFieldUsingAlreadyWrittenMesh : input field is null !");
std::ostringstream oss; oss << "File with name \'" << fileName << "\' has not valid permissions or not exists !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- MEDCouplingAutoRefCountObjectPtr<MEDFileField1TS> f1ts=MEDFileField1TS::New();
- MEDCouplingUMesh *m=dynamic_cast<MEDCouplingUMesh *>(const_cast<MEDCouplingMesh *>(f->getMesh()));
- if(!m)
- throw INTERP_KERNEL::Exception("MEDLoader::WriteFieldUsingAlreadyWrittenMesh : only umesh in input field supported !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> o2n=m->getRenumArrForMEDFileFrmt();
- MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> f2(f->deepCpy());
- f2->renumberCells(o2n->begin(),false);
- f1ts->setFieldNoProfileSBT(f2);
+ MEDCouplingAutoRefCountObjectPtr<MEDFileField1TS> f1ts(MEDFileField1TS::New());
+ AssignStaticWritePropertiesTo(*f1ts);
+ MEDCouplingUMesh *m(dynamic_cast<MEDCouplingUMesh *>(const_cast<MEDCouplingMesh *>(f->getMesh())));
+ if(m)
+ {
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> o2n(m->getRenumArrForMEDFileFrmt());
+ MEDCouplingAutoRefCountObjectPtr<MEDCouplingFieldDouble> f2(f->deepCpy());
+ f2->renumberCells(o2n->begin(),false);
+ f1ts->setFieldNoProfileSBT(f2);
+ }
+ else
+ f1ts->setFieldNoProfileSBT(f);
f1ts->write(fileName,0);
}