void MEDLoaderNS::writeFieldAndMeshDirectly(const char *fileName, ParaMEDMEM::MEDCouplingFieldDouble *f, bool forceFromScratch)
{
+ std::string meshName(f->getMesh()->getName());
+ if(meshName.empty())
+ throw INTERP_KERNEL::Exception("Trying to write a mesh (f->getMesh()) with no name ! MED file format needs a not empty mesh name !");
+ std::string fieldName(f->getName());
+ if(fieldName.empty())
+ throw INTERP_KERNEL::Exception("Trying to write a field with no name ! MED file format needs a not empty field name !");
MEDCouplingUMesh *mesh=dynamic_cast<MEDCouplingUMesh *>((MEDCouplingMesh *)f->getMesh());
writeUMeshDirectly(fileName,mesh,forceFromScratch);
appendFieldDirectly(fileName,f);
void MEDLoader::WriteUMesh(const char *fileName, ParaMEDMEM::MEDCouplingUMesh *mesh, bool writeFromScratch)
{
+ std::string meshName(mesh->getName());
+ if(meshName.empty())
+ throw INTERP_KERNEL::Exception("Trying to write a unstructured mesh with no name ! MED file format needs a not empty mesh name !");
int status=MEDLoaderBase::getStatusOfFile(fileName);
if(status!=MEDLoaderBase::EXIST_RW && status!=MEDLoaderBase::NOT_EXIST)
{
void MEDLoader::WriteField(const char *fileName, ParaMEDMEM::MEDCouplingFieldDouble *f, bool writeFromScratch)
{
- f->checkCoherency();
int status=MEDLoaderBase::getStatusOfFile(fileName);
if(status!=MEDLoaderBase::EXIST_RW && status!=MEDLoaderBase::NOT_EXIST)
{