MEDFileData.cxx
MEDFileFieldOverView.cxx
MEDFileMeshReadSelector.cxx
+ MEDFileMeshSupport.cxx
SauvMedConvertor.cxx
SauvReader.cxx
SauvWriter.cxx
// Author : Anthony Geay (CEA/DEN)
#include "MEDFileData.hxx"
+#include "MEDLoaderBase.hxx"
+#include "MEDFileSafeCaller.txx"
+
+#include "InterpKernelAutoPtr.hxx"
using namespace MEDCoupling;
MEDFileData *MEDFileData::deepCopy() const
{
MCAuto<MEDFileFields> fields;
- if((const MEDFileFields *)_fields)
+ if(_fields.isNotNull())
fields=_fields->deepCopy();
MCAuto<MEDFileMeshes> meshes;
- if((const MEDFileMeshes *)_meshes)
+ if(_meshes.isNotNull())
meshes=_meshes->deepCopy();
MCAuto<MEDFileParameters> params;
- if((const MEDFileParameters *)_params)
+ if(_params.isNotNull())
params=_params->deepCopy();
MCAuto<MEDFileData> ret(MEDFileData::New());
ret->_fields=fields; ret->_meshes=meshes; ret->_params=params;
std::size_t MEDFileData::getHeapMemorySizeWithoutChildren() const
{
- return 0;
+ return _header.capacity();
}
std::vector<const BigMemoryObject *> MEDFileData::getDirectChildrenWithNull() const
MEDFileData::MEDFileData(med_idt fid)
try
{
- _fields=MEDFileFields::New(fid);
- _meshes=MEDFileMeshes::New(fid);
- _params=MEDFileParameters::New(fid);
+ readHeader(fid);
+ _fields=MEDFileFields::New(fid);
+ _meshes=MEDFileMeshes::New(fid);
+ _params=MEDFileParameters::New(fid);
}
catch(INTERP_KERNEL::Exception& e)
{
void MEDFileData::writeLL(med_idt fid) const
{
+ writeHeader(fid);
const MEDFileMeshes *ms(_meshes);
if(ms)
ms->writeLL(fid);
if(ps)
ps->writeLL(fid);
}
+
+std::string MEDFileData::getHeader() const
+{
+ return _header;
+}
+
+
+void MEDFileData::setHeader(const std::string& header)
+{
+ _header=header;
+}
+
+void MEDFileData::readHeader(med_idt fid)
+{
+ INTERP_KERNEL::AutoPtr<char> header(MEDLoaderBase::buildEmptyString(MED_COMMENT_SIZE));
+ MEDFILESAFECALLERRD0(MEDfileCommentRd,(fid,header));
+ _header=MEDLoaderBase::buildStringFromFortran(header,MED_COMMENT_SIZE);
+}
+
+void MEDFileData::writeHeader(med_idt fid) const
+{
+ INTERP_KERNEL::AutoPtr<char> header(MEDLoaderBase::buildEmptyString(MED_COMMENT_SIZE));
+ MEDLoaderBase::safeStrCpy(_header.c_str(),MED_COMMENT_SIZE,header,_too_long_str);
+ MEDFILESAFECALLERWR0(MEDfileCommentWr,(fid,header));
+}
#include "MEDFileParameter.hxx"
#include "MEDFileField.hxx"
#include "MEDFileMesh.hxx"
+#include "MEDFileMeshSupport.hxx"
namespace MEDCoupling
{
MEDLOADER_EXPORT int getNumberOfParams() const;
MEDLOADER_EXPORT std::string simpleRepr() const;
//
+ MEDLOADER_EXPORT std::string getHeader() const;
+ MEDLOADER_EXPORT void setHeader(const std::string& header);
+ //
MEDLOADER_EXPORT bool changeMeshNames(const std::vector< std::pair<std::string,std::string> >& modifTab);
MEDLOADER_EXPORT bool changeMeshName(const std::string& oldMeshName, const std::string& newMeshName);
MEDLOADER_EXPORT bool unPolyzeMeshes();
private:
MEDFileData();
MEDFileData(med_idt fid);
+ void readHeader(med_idt fid);
+ void writeHeader(med_idt fid) const;
private:
MCAuto<MEDFileFields> _fields;
MCAuto<MEDFileMeshes> _meshes;
MCAuto<MEDFileParameters> _params;
+ std::vector< MCAuto<MEDFileMeshSupport> > _mesh_supports;
+ std::string _header;
};
}
--- /dev/null
+// Copyright (C) 2007-2017 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// Author : Anthony Geay (EDF R&D)
+
+#include "MEDFileMeshSupport.hxx"
+
+#include "MEDLoaderBase.hxx"
+#include "MEDFileSafeCaller.txx"
+
+#include "InterpKernelAutoPtr.hxx"
+
+using namespace MEDCoupling;
+
+MEDFileMeshSupport *MEDFileMeshSupport::New()
+{
+ return new MEDFileMeshSupport;
+}
+
+MEDFileMeshSupport *MEDFileMeshSupport::New(const std::string& fileName, int smid)
+{
+ MEDFileUtilities::AutoFid fid(OpenMEDFileForRead(fileName));
+ return New(fid,smid);
+}
+
+MEDFileMeshSupport *MEDFileMeshSupport::New(med_idt fid, int smid)
+{
+ return new MEDFileMeshSupport(fid,smid);
+}
+
+std::vector<const BigMemoryObject *> MEDFileMeshSupport::getDirectChildrenWithNull() const
+{
+ return std::vector<const BigMemoryObject *>();
+}
+
+std::size_t MEDFileMeshSupport::getHeapMemorySizeWithoutChildren() const
+{
+ return 0;
+}
+
+int MEDFileMeshSupport::getSpaceDim() const
+{
+ return _space_dim;
+}
+
+void MEDFileMeshSupport::setSpaceDim(int dim)
+{
+ _space_dim=dim;
+}
+
+int MEDFileMeshSupport::getMeshDim() const
+{
+ return _mesh_dim;
+}
+
+void MEDFileMeshSupport::setMeshDim(int dim)
+{
+ _mesh_dim=dim;
+}
+
+void MEDFileMeshSupport::writeLL(med_idt fid) const
+{
+}
+
+MEDFileMeshSupport::MEDFileMeshSupport(med_idt fid, int smid)
+{
+ INTERP_KERNEL::AutoPtr<char> msn(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE));
+ INTERP_KERNEL::AutoPtr<char> description(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE));
+ med_axis_type axType;
+ int nAxis(MEDsupportMeshnAxis(fid,smid));
+ INTERP_KERNEL::AutoPtr<char> axisName(new char[MED_SNAME_SIZE*nAxis+1]),axisUnit(new char[MED_SNAME_SIZE*nAxis+1]);
+ MEDFILESAFECALLERRD0(MEDsupportMeshInfo,(fid,smid,msn,&_space_dim,&_mesh_dim,description,&axType,axisName,axisUnit));
+}
+
+MEDFileMeshSupport::MEDFileMeshSupport():_space_dim(-1),_mesh_dim(-1)
+{
+}
--- /dev/null
+// Copyright (C) 2007-2017 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// Author : Anthony Geay (EDF R&D)
+
+#ifndef __MEDFILEMESHSUPPORT_HXX__
+#define __MEDFILEMESHSUPPORT_HXX__
+
+#include "MEDLoaderDefines.hxx"
+#include "MEDFileUtilities.txx"
+
+#include "MEDCouplingRefCountObject.hxx"
+
+namespace MEDCoupling
+{
+ class MEDFileMeshSupport : public RefCountObject, public MEDFileWritableStandAlone
+ {
+ public:
+ MEDLOADER_EXPORT static MEDFileMeshSupport *New(const std::string& fileName);
+ MEDLOADER_EXPORT static MEDFileMeshSupport *New(const std::string& fileName, int smid);
+ MEDLOADER_EXPORT static MEDFileMeshSupport *New(med_idt fid, int smid);
+ MEDLOADER_EXPORT static MEDFileMeshSupport *New();
+ MEDLOADER_EXPORT std::vector<const BigMemoryObject *> getDirectChildrenWithNull() const;
+ MEDLOADER_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const;
+ MEDLOADER_EXPORT int getSpaceDim() const;
+ MEDLOADER_EXPORT void setSpaceDim(int dim);
+ MEDLOADER_EXPORT int getMeshDim() const;
+ MEDLOADER_EXPORT void setMeshDim(int dim);
+ private:
+ void writeLL(med_idt fid) const;
+ MEDFileMeshSupport(med_idt fid, int smid);
+ MEDFileMeshSupport();
+ private:
+ int _space_dim;
+ int _mesh_dim;
+ std::string _description;
+ };
+}
+
+#endif
//
bool changeMeshName(const std::string& oldMeshName, const std::string& newMeshName) throw(INTERP_KERNEL::Exception);
bool unPolyzeMeshes() throw(INTERP_KERNEL::Exception);
+ std::string getHeader() const throw(INTERP_KERNEL::Exception);
+ void setHeader(const std::string& header) throw(INTERP_KERNEL::Exception);
//
%extend
{