#include "DriverMED_W_Field.h"
-#include "MED_TFile.hxx"
#include "DriverMED.hxx"
#include "DriverMED_W_SMESHDS_Mesh.h"
#include "MED_Factory.hxx"
+#include "MED_TFile.hxx"
#include "MED_Utilities.hxx"
#include "MED_Wrapper.hxx"
#include "SMDS_IteratorOnIterators.hxx"
#include "SMDS_MeshElement.hxx"
#include "SMDS_SetIterator.hxx"
#include "SMESHDS_Mesh.hxx"
+#include "SMESH_TypeDefs.hxx"
//================================================================================
/*!
_nbElemsByGeom.resize( 1, std::make_pair( SMDSEntity_Last, 0 ));
// count nb of elems of each geometry
- for ( int iG = 0; iG < SMDSEntity_Last; ++iG )
+ SMDSAbs_EntityType geom = SMDSEntity_0D;
+ for ( ; geom < SMDSEntity_Last; SMESHUtils::Increment( geom ))
{
- SMDSAbs_EntityType geom = (SMDSAbs_EntityType) iG;
- SMDSAbs_ElementType t = SMDS_MeshCell::ElemType( geom );
+ SMDSAbs_ElementType t = SMDS_MeshCell::ElemType( geom );
if ( t != _elemType ) continue;
nbElems = mesh->GetMeshInfo().NbElements( geom );
*/
Driver_Mesh::Status DriverMED_W_Field_Mem::Perform()
{
- void *ptr(nullptr);
- std::size_t sz(0);
Driver_Mesh::Status status = Driver_Mesh::DRS_OK;
bool isClosed(false);
- MED::TMemFile *tfileInst = nullptr;
- char *initPtr(_data->getPointer());
- mcIdType initSz(_data->getNumberOfTuples());
+ void *ptr(_data->getPointer());
+ std::size_t sz(_data->getNumberOfTuples());
_data->accessToMemArray().setSpecificDeallocator(nullptr);
_data->useArray(nullptr,false,MEDCoupling::DeallocType::C_DEALLOC,0,1);
{// let braces to flush (call of MED::PWrapper myMed destructor)
- tfileInst = new MED::TMemFile(initPtr,initSz,&isClosed);
+ MED::TMemFile *tfileInst = new MED::TMemFile(&ptr,&sz,&isClosed);
MED::PWrapper myMed = MED::CrWrapperW(myFile, -1, tfileInst);
status = this->PerformInternal(myMed);
}
- if(tfileInst)
- {
- ptr = tfileInst->getData(); sz = tfileInst->getSize();
- }
+ if(!isClosed)
+ EXCEPTION(std::runtime_error, "TFTMemFile destructor : on destruction file has not been closed properly -> chunk of memory data may be invalid !");
_data = MEDCoupling::DataArrayByte::New();
_data->useArray(reinterpret_cast<char *>(ptr),true,MEDCoupling::DeallocType::C_DEALLOC,sz,1);
return status;