{
med_memfile memfile;
memfile.app_image_ptr=0;
+ memfile.app_image_size=0;
{
- MEDFileUtilities::AutoFid fid=MEDmemFileOpen("",&memfile,MED_FALSE,MED_ACC_CREAT);
+ MEDFileUtilities::AutoFid fid=MEDmemFileOpen("",&memfile,MED_FALSE,MED_ACC_CREAT);//MED_ACC_CREAT
item2BSerialized.writeLL(fid);
}
MEDCouplingAutoRefCountObjectPtr<DataArrayByte> ret(DataArrayByte::New());
%newobject ParaMEDMEM::MEDFileAnyTypeField1TS::New;
%newobject ParaMEDMEM::MEDFileAnyTypeField1TS::shallowCpy;
%newobject ParaMEDMEM::MEDFileAnyTypeField1TS::deepCpy;
+%newobject ParaMEDMEM::MEDFileAnyTypeField1TS::serialize;
%newobject ParaMEDMEM::MEDFileField1TS::New;
%newobject ParaMEDMEM::MEDFileField1TS::getFieldAtLevel;
%newobject ParaMEDMEM::MEDFileField1TS::getFieldAtTopLevel;
static MEDFileAnyTypeField1TS *New(const std::string& fileName, const std::string& fieldName, bool loadAll=true) throw(INTERP_KERNEL::Exception);
static MEDFileAnyTypeField1TS *New(const std::string& fileName, const std::string& fieldName, int iteration, int order, bool loadAll=true) throw(INTERP_KERNEL::Exception);
void write(const std::string& fileName, int mode) const throw(INTERP_KERNEL::Exception);
+ DataArrayByte *serialize() const throw(INTERP_KERNEL::Exception);
void loadArrays() throw(INTERP_KERNEL::Exception);
void loadArraysIfNecessary() throw(INTERP_KERNEL::Exception);
void unloadArrays() throw(INTERP_KERNEL::Exception);
return MEDFileField1TS::New();
}
+ static MEDFileField1TS *New(DataArrayByte *dab) throw(INTERP_KERNEL::Exception)
+ {
+ if(!dab)
+ throw INTERP_KERNEL::Exception("MEDFileField1TS::New : null input pointer !");
+ dab->checkAllocated();
+ if(dab->getNumberOfComponents()!=1)
+ throw INTERP_KERNEL::Exception("MEDFileField1TS::New : number of components is expected to be 1 !");
+ char *ptr=reinterpret_cast<char *>(malloc(dab->getNumberOfTuples()));
+ std::copy(dab->begin(),dab->end(),ptr);
+ med_memfile memfile;
+ memfile.app_image_ptr=ptr;
+ memfile.app_image_size=dab->getNumberOfTuples();
+ MEDFileUtilities::AutoFid fid=MEDmemFileOpen("",&memfile,MED_FALSE,MED_ACC_RDWR);
+ return MEDFileField1TS::New(fid,true);
+ }
+
void copyTinyInfoFrom(const MEDCouplingFieldDouble *field) throw(INTERP_KERNEL::Exception)
{
const DataArrayDouble *arr=0;
os.remove(errfname)
#
pass
+#class MEDLoaderTest(unittest.TestCase):
+ def tessMEDFileMemSerialization1(self):# second : build a file from scratch
+ m=MEDCouplingCMesh()
+ arr=DataArrayDouble(11) ; arr.iota()
+ m.setCoords(arr,arr)
+ m.setName("mesh")
+ mm=MEDFileCMesh()
+ mm.setMesh(m)
+ #
+ f=MEDCouplingFieldDouble(ON_CELLS)
+ f.setName("field")
+ f.setMesh(m)
+ f.setArray(DataArrayDouble(100))
+ f.getArray()[:]=100.
+ f.checkCoherency()
+ f1ts=MEDFileField1TS()
+ f1ts.setFieldNoProfileSBT(f)
+ #
+ toto=f1ts.serialize()
+ pass
pass