#include "MEDFileMesh.hxx"
#include "MEDLoaderBase.hxx"
#include "MEDFileUtilities.hxx"
+#include "MEDFileSafeCaller.txx"
#include "MEDFileFieldOverView.hxx"
#include "MEDCouplingFieldDouble.hxx"
{
INTERP_KERNEL::AutoPtr<char> locname(MEDLoaderBase::buildEmptyString(MED_NAME_SIZE));
int nbi,tmp1;
- med_int nbValsInFile=MEDfieldnValueWithProfileByName(fid,fieldName.c_str(),iteration,order,menti,mgeoti,_profile.c_str(),MED_COMPACT_PFLMODE,&tmp1,locname,&nbi);
+ med_int nbValsInFile(MEDfieldnValueWithProfileByName(fid,fieldName.c_str(),iteration,order,menti,mgeoti,_profile.c_str(),MED_COMPACT_PFLMODE,&tmp1,locname,&nbi));
if(_end-_start!=nbValsInFile*nbi)
{
std::ostringstream oss; oss << "MEDFileFieldPerMeshPerTypePerDisc::goReadZeValuesInFile : The number of tuples to read is " << nbValsInFile << "*" << nbi << " (nb integration points) ! But in data structure it values " << _end-_start << " is expected !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- MEDfieldValueWithProfileRd(fid,fieldName.c_str(),iteration,order,menti,mgeoti,MED_COMPACT_PFLMODE,_profile.c_str(),MED_FULL_INTERLACE,MED_ALL_CONSTITUENT,startFeedingPtr);
+ MEDFILESAFECALLERRD0(MEDfieldValueWithProfileRd,(fid,fieldName.c_str(),iteration,order,menti,mgeoti,MED_COMPACT_PFLMODE,_profile.c_str(),MED_FULL_INTERLACE,MED_ALL_CONSTITUENT,startFeedingPtr));
}
else
{
MED_ALL_CONSTITUENT,MED_FULL_INTERLACE,MED_COMPACT_STMODE,MED_NO_PROFILE,
/*start*/start+1,/*stride*/step,/*count*/1,/*blocksize*/nbOfEltsToLoad,
/*lastblocksize=useless because count=1*/0,&filter);
- MEDfieldValueAdvancedRd(fid,fieldName.c_str(),iteration,order,menti,mgeoti,&filter,startFeedingPtr);
+ MEDFILESAFECALLERRD0(MEDfieldValueAdvancedRd,(fid,fieldName.c_str(),iteration,order,menti,mgeoti,&filter,startFeedingPtr));
MEDfilterClose(&filter);
return ;
}
MED_ALL_CONSTITUENT,MED_FULL_INTERLACE,MED_COMPACT_STMODE,MED_NO_PROFILE,
/*start*/a+1,/*stride*/1,/*count*/1,/*blocksize*/nbOfEltsToLoad,
/*lastblocksize=useless because count=1*/0,&filter);
- MEDfieldValueAdvancedRd(fid,fieldName.c_str(),iteration,order,menti,mgeoti,&filter,reinterpret_cast<unsigned char *>(tmp->getPointer()));
+ MEDFILESAFECALLERRD0(MEDfieldValueAdvancedRd,(fid,fieldName.c_str(),iteration,order,menti,mgeoti,&filter,reinterpret_cast<unsigned char *>(tmp->getPointer())));
MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> feeder(DataArrayDouble::New());
feeder->useExternalArrayWithRWAccess(reinterpret_cast<double *>(startFeedingPtr),_nval,nbOfCompo);
feeder->setContigPartOfSelectedValues(0,tmp,myIds);
locToWrite=reinterpret_cast<const unsigned char *>(arrI->getConstPointer()+_start*arr->getNumberOfComponents());
else
throw INTERP_KERNEL::Exception("MEDFileFieldPerMeshPerTypePerDisc::writeLL : not recognized type of values ! Supported are FLOAT64 and INT32 !");
- MEDfieldValueWithProfileWr(fid,nasc.getName().c_str(),getIteration(),getOrder(),getTime(),menti,mgeoti,
- MED_COMPACT_PFLMODE,_profile.c_str(),_localization.c_str(),MED_FULL_INTERLACE,MED_ALL_CONSTITUENT,_nval,
- locToWrite);
+ MEDFILESAFECALLERWR0(MEDfieldValueWithProfileWr,(fid,nasc.getName().c_str(),getIteration(),getOrder(),getTime(),menti,mgeoti,
+ MED_COMPACT_PFLMODE,_profile.c_str(),_localization.c_str(),MED_FULL_INTERLACE,MED_ALL_CONSTITUENT,_nval,
+ locToWrite));
}
void MEDFileFieldPerMeshPerTypePerDisc::getCoarseData(TypeOfField& type, std::pair<int,int>& dad, std::string& pfl, std::string& loc) const
}
if(type==ON_CELLS)
{
- int nbProfiles2=MEDfieldnProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_NODE_ELEMENT,mgeoti,pflName,locName);
+ int nbProfiles2(MEDfieldnProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_NODE_ELEMENT,mgeoti,pflName,locName));
for(int i=0;i<nbProfiles2;i++)
_field_pm_pt_pd.push_back(MEDFileFieldPerMeshPerTypePerDisc::NewOnRead(this,ON_GAUSS_NE,i,pd));
}
}
if(MFFPMIter::IsPresenceOfNode(entities))
{
- int nbProfile=MEDfield23nProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_NODE,MED_NONE,meshCsit+1,meshName,pflName,locName);
+ int nbProfile(MEDfield23nProfile(fid,nasc.getName().c_str(),getIteration(),getOrder(),MED_NODE,MED_NONE,meshCsit+1,meshName,pflName,locName));
if(nbProfile>0)
{
const PartDefinition *pd(0);
if(id>=(int)_pfls.size())
_pfls.resize(id+1);
_pfls[id]=DataArrayInt::New();
- int lgth=MEDprofileSizeByName(fid,pflName.c_str());
+ int lgth(MEDprofileSizeByName(fid,pflName.c_str()));
_pfls[id]->setName(pflName);
_pfls[id]->alloc(lgth,1);
- MEDprofileRd(fid,pflName.c_str(),_pfls[id]->getPointer());
+ MEDFILESAFECALLERRD0(MEDprofileRd,(fid,pflName.c_str(),_pfls[id]->getPointer()));
_pfls[id]->applyLin(1,-1,0);//Converting into C format
}
{
INTERP_KERNEL::AutoPtr<char> pflName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
int sz;
- MEDprofileInfo(fid,i+1,pflName,&sz);
+ MEDFILESAFECALLERRD0(MEDprofileInfo,(fid,i+1,pflName,&sz));
std::string pflCpp=MEDLoaderBase::buildStringFromFortran(pflName,MED_NAME_SIZE);
if(i>=(int)_pfls.size())
_pfls.resize(i+1);
_pfls[i]=DataArrayInt::New();
_pfls[i]->alloc(sz,1);
_pfls[i]->setName(pflCpp.c_str());
- MEDprofileRd(fid,pflName,_pfls[i]->getPointer());
+ MEDFILESAFECALLERRD0(MEDprofileRd,(fid,pflName,_pfls[i]->getPointer()));
_pfls[i]->applyLin(1,-1,0);//Converting into C format
}
cpy->applyLin(1,1,0);
INTERP_KERNEL::AutoPtr<char> pflName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
MEDLoaderBase::safeStrCpy(_pfls[i]->getName().c_str(),MED_NAME_SIZE,pflName,opt.getTooLongStrPolicy());
- MEDprofileWr(fid,pflName,_pfls[i]->getNumberOfTuples(),cpy->getConstPointer());
+ MEDFILESAFECALLERWR0(MEDprofileWr,(fid,pflName,_pfls[i]->getNumberOfTuples(),cpy->getConstPointer()));
}
//
int nbOfLocs=_locs.size();
med_bool localMesh;
med_int meshnumdt,meshnumit;
INTERP_KERNEL::AutoPtr<char> meshName=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
- MEDfieldComputingStepInfo(fid,nasc.getName().c_str(),_csit,&numdt,&numit,&_dt);
- MEDfield23ComputingStepMeshInfo(fid,nasc.getName().c_str(),_csit,&numdt,&numit,&dt,&nmesh,meshName,&localMesh,&meshnumdt,&meshnumit);
+ MEDFILESAFECALLERRD0(MEDfieldComputingStepInfo,(fid,nasc.getName().c_str(),_csit,&numdt,&numit,&_dt));
+ MEDFILESAFECALLERRD0(MEDfield23ComputingStepMeshInfo,(fid,nasc.getName().c_str(),_csit,&numdt,&numit,&dt,&nmesh,meshName,&localMesh,&meshnumdt,&meshnumit));
if(_iteration!=numdt || _order!=numit)
throw INTERP_KERNEL::Exception("MEDFileAnyTypeField1TSWithoutSDA::loadBigArraysRecursively : unexpected exception internal error !");
_field_per_mesh.resize(nmesh);
//
med_int numdt,numit;
med_float dt;
- MEDfieldComputingStepInfo(fid,fieldName.c_str(),1,&numdt,&numit,&dt);
+ MEDFILESAFECALLERRD0(MEDfieldComputingStepInfo,(fid,fieldName.c_str(),1,&numdt,&numit,&dt));
ret->setTime(numdt,numit,dt);
ret->_csit=1;
if(loadAll)
//
med_int numdt,numit;
med_float dt;
- MEDfieldComputingStepInfo(fid,fieldName.c_str(),1,&numdt,&numit,&dt);
+ MEDFILESAFECALLERRD0(MEDfieldComputingStepInfo,(fid,fieldName.c_str(),1,&numdt,&numit,&dt));
ret->setTime(numdt,numit,dt);
ret->_csit=1;
if(loadAll)
{
med_int numdt,numit;
med_float dt;
- MEDfieldComputingStepInfo(fid,fieldName.c_str(),i+1,&numdt,&numit,&dt);
+ MEDFILESAFECALLERRD0(MEDfieldComputingStepInfo,(fid,fieldName.c_str(),i+1,&numdt,&numit,&dt));
if(numdt==iteration && numit==order)
{
found=true;
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
}
- int ncomp=MEDfieldnComponent(fid,fieldIdCFormat+1);
+ int ncomp(MEDfieldnComponent(fid,fieldIdCFormat+1));
INTERP_KERNEL::AutoPtr<char> comp=MEDLoaderBase::buildEmptyString(ncomp*MED_SNAME_SIZE);
INTERP_KERNEL::AutoPtr<char> unit=MEDLoaderBase::buildEmptyString(ncomp*MED_SNAME_SIZE);
INTERP_KERNEL::AutoPtr<char> dtunit=MEDLoaderBase::buildEmptyString(MED_LNAME_SIZE);
INTERP_KERNEL::AutoPtr<char> nomMaa=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
med_bool localMesh;
int nbOfStep;
- MEDfieldInfo(fid,fieldIdCFormat+1,nomcha,nomMaa,&localMesh,&typcha,comp,unit,dtunit,&nbOfStep);
+ MEDFILESAFECALLERRD0(MEDfieldInfo,(fid,fieldIdCFormat+1,nomcha,nomMaa,&localMesh,&typcha,comp,unit,dtunit,&nbOfStep));
fieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE);
dtunitOut=MEDLoaderBase::buildStringFromFortran(dtunit,MED_LNAME_SIZE);
infos.clear(); infos.resize(ncomp);
}
if(getName().empty())
throw INTERP_KERNEL::Exception("MEDFileField1TS::write : MED file does not accept field with empty name !");
- MEDfieldCr(fid,getName().c_str(),getMEDFileFieldType(),nbComp,comp,unit,getDtUnit().c_str(),getMeshName().c_str());
+ MEDFILESAFECALLERWR0(MEDfieldCr,(fid,getName().c_str(),getMEDFileFieldType(),nbComp,comp,unit,getDtUnit().c_str(),getMeshName().c_str()));
writeGlobals(fid,*this);
contentNotNullBase()->writeLL(fid,*this,*contentNotNullBase());
}
med_int numdt=0,numo=0;
med_int meshIt=0,meshOrder=0;
med_float dt=0.0;
- MEDfieldComputingStepMeshInfo(fid,_name.c_str(),i+1,&numdt,&numo,&dt,&meshIt,&meshOrder);
+ MEDFILESAFECALLERRD0(MEDfieldComputingStepMeshInfo,(fid,_name.c_str(),i+1,&numdt,&numo,&dt,&meshIt,&meshOrder));
switch(fieldTyp)
{
case MED_FLOAT64:
}
if(_name.empty())
throw INTERP_KERNEL::Exception("MEDFileFieldMultiTSWithoutSDA::write : MED file does not accept field with empty name !");
- MEDfieldCr(fid,_name.c_str(),getMEDFileFieldType(),nbComp,comp,unit,getDtUnit().c_str(),getMeshName().c_str());
+ MEDFILESAFECALLERWR0(MEDfieldCr,(fid,_name.c_str(),getMEDFileFieldType(),nbComp,comp,unit,getDtUnit().c_str(),getMeshName().c_str()));
int nbOfTS=_time_steps.size();
for(int i=0;i<nbOfTS;i++)
_time_steps[i]->writeLL(fid,opts,*this);
#include "MEDFileUtilities.hxx"
#include "MEDLoader.hxx"
#include "MEDLoaderBase.hxx"
+#include "MEDFileSafeCaller.txx"
#include "CellModel.hxx"
#include "InterpKernelAutoPtr.hxx"
{
if ( _is_nodal )
{
- MEDsubdomainCorrespondenceWr(fid, localMeshName.c_str(), jointName.c_str(),
- order, iteration,
- MED_NODE, MED_NONE,
- MED_NODE, MED_NONE,
- _correspondence->getNbOfElems()/2,
- _correspondence->getConstPointer());
+ MEDFILESAFECALLERWR0(MEDsubdomainCorrespondenceWr,(fid, localMeshName.c_str(), jointName.c_str(),
+ order, iteration,
+ MED_NODE, MED_NONE,
+ MED_NODE, MED_NONE,
+ _correspondence->getNbOfElems()/2,
+ _correspondence->getConstPointer()));
}
else
{
- MEDsubdomainCorrespondenceWr(fid, localMeshName.c_str(), jointName.c_str(),
- order, iteration,
- MED_CELL, typmai3[ _loc_geo_type ],
- MED_CELL, typmai3[ _rem_geo_type ],
- _correspondence->getNbOfElems()/2,
- _correspondence->getConstPointer());
+ MEDFILESAFECALLERWR0(MEDsubdomainCorrespondenceWr,(fid, localMeshName.c_str(), jointName.c_str(),
+ order, iteration,
+ MED_CELL, typmai3[ _loc_geo_type ],
+ MED_CELL, typmai3[ _rem_geo_type ],
+ _correspondence->getNbOfElems()/2,
+ _correspondence->getConstPointer()));
}
}
MEDFileJointOneStep::MEDFileJointOneStep(med_idt fid, const std::string& mName, const std::string& jointName, int num)
{
int order, iteration, ncorrespondence;
- MEDsubdomainComputingStepInfo(fid, mName.c_str(), jointName.c_str(), num, &order, &iteration, &ncorrespondence);
+ MEDFILESAFECALLERRD0(MEDsubdomainComputingStepInfo,(fid, mName.c_str(), jointName.c_str(), num, &order, &iteration, &ncorrespondence));
MEDFileJointOneStep::setOrder(order);
MEDFileJointOneStep::setIteration(iteration);
for ( int cur_it = 1; cur_it <= ncorrespondence; ++cur_it )
int num_entity;
med_entity_type loc_ent_type, rem_ent_type;
med_geometry_type loc_geo_type, rem_geo_type;
- MEDsubdomainCorrespondenceSizeInfo(fid, mName.c_str(), jointName.c_str(), order, iteration, cur_it,
- &loc_ent_type, &loc_geo_type, &rem_ent_type, &rem_geo_type, &num_entity);
+ MEDFILESAFECALLERRD0(MEDsubdomainCorrespondenceSizeInfo,(fid, mName.c_str(), jointName.c_str(), order, iteration, cur_it,
+ &loc_ent_type, &loc_geo_type, &rem_ent_type, &rem_geo_type, &num_entity));
if ( num_entity > 0 )
{
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> correspondence=DataArrayInt::New();
correspondence->alloc(num_entity*2, 1);
- MEDsubdomainCorrespondenceRd(fid, mName.c_str(), jointName.c_str(), order, iteration, loc_ent_type,
- loc_geo_type, rem_ent_type, rem_geo_type, correspondence->getPointer());
+ MEDFILESAFECALLERRD0(MEDsubdomainCorrespondenceRd,(fid, mName.c_str(), jointName.c_str(), order, iteration, loc_ent_type,
+ loc_geo_type, rem_ent_type, rem_geo_type, correspondence->getPointer()));
MEDFileJointCorrespondence *cor=MEDFileJointCorrespondence::New();
cor->setIsNodal( loc_ent_type == MED_NODE );
cor->setLocalGeometryType ( convertGeometryType( loc_geo_type ));
INTERP_KERNEL::AutoPtr<char> desc_name=MEDLoaderBase::buildEmptyString(MED_COMMENT_SIZE);
INTERP_KERNEL::AutoPtr<char> rem_mesh_name=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
int domain_number=0, nstep=0, nocstpncorrespondence=0;
- MEDsubdomainJointInfo(fid,mName.c_str(), curJoint, joint_name, desc_name, &domain_number,rem_mesh_name,
- &nstep, &nocstpncorrespondence);
+ MEDFILESAFECALLERRD0(MEDsubdomainJointInfo,(fid,mName.c_str(), curJoint, joint_name, desc_name, &domain_number,rem_mesh_name,
+ &nstep, &nocstpncorrespondence));
setLocalMeshName(mName);
setRemoteMeshName(MEDLoaderBase::buildStringFromFortran(rem_mesh_name,MED_NAME_SIZE));
setDescription(MEDLoaderBase::buildStringFromFortran(desc_name,MED_COMMENT_SIZE));
{
// if ( _loc_mesh_name.empty() )
// throw INTERP_KERNEL::Exception("MEDFileJoint::write : name of a local mesh not defined!");
- MEDsubdomainJointCr(fid,getLocalMeshName().c_str(),getJointName().c_str(),getDescription().c_str(),getDomainNumber(),getRemoteMeshName().c_str());
+ MEDFILESAFECALLERWR0(MEDsubdomainJointCr,(fid,getLocalMeshName().c_str(),getJointName().c_str(),getDescription().c_str(),getDomainNumber(),getRemoteMeshName().c_str()));
for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileJointOneStep> >::const_iterator it=_joint.begin();it!=_joint.end();it++) {
(*it)->writeLL(fid, getLocalMeshName(),getJointName());
}
#include "MEDFileFieldOverView.hxx"
#include "MEDFileField.hxx"
#include "MEDLoader.hxx"
+#include "MEDFileSafeCaller.txx"
#include "MEDLoaderBase.hxx"
#include "MEDCouplingUMesh.hxx"
*/
MEDFileJoints * MEDFileMesh::getJoints() const
{
- return (MEDFileJoints*) & (*_joints);
+ return const_cast<MEDFileJoints*>(& (*_joints));
}
void MEDFileMesh::setJoints( MEDFileJoints* joints )
MEDLoaderBase::safeStrCpy2(c.c_str(),MED_SNAME_SIZE-1,comp+i*MED_SNAME_SIZE,_too_long_str);//MED_TAILLE_PNOM-1 to avoid to write '\0' on next compo
MEDLoaderBase::safeStrCpy2(u.c_str(),MED_SNAME_SIZE-1,unit+i*MED_SNAME_SIZE,_too_long_str);//MED_TAILLE_PNOM-1 to avoid to write '\0' on next compo
}
- MEDmeshCr(fid,maa,spaceDim,mdim,MED_UNSTRUCTURED_MESH,desc,"",MED_SORT_DTIT,MED_CARTESIAN,comp,unit);
- MEDmeshUniversalNameWr(fid,maa);
+ MEDFILESAFECALLERWR0(MEDmeshCr,(fid,maa,spaceDim,mdim,MED_UNSTRUCTURED_MESH,desc,"",MED_SORT_DTIT,MED_CARTESIAN,comp,unit));
+ MEDFILESAFECALLERWR0(MEDmeshUniversalNameWr,(fid,maa));
std::string meshName(MEDLoaderBase::buildStringFromFortran(maa,MED_NAME_SIZE));
MEDFileUMeshL2::WriteCoords(fid,meshName,_iteration,_order,_time,_coords,_fam_coords,_num_coords,_name_coords);
for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileUMeshSplitL1> >::const_iterator it=_ms.begin();it!=_ms.end();it++)
{
famCells=DataArrayInt::New();
famCells->alloc(nbOfElt,1);
- MEDmeshEntityFamilyNumberRd(fid,mName.c_str(),dt,it,MED_CELL,geoTypeReq,famCells->getPointer());
+ MEDFILESAFECALLERRD0(MEDmeshEntityFamilyNumberRd,(fid,mName.c_str(),dt,it,MED_CELL,geoTypeReq,famCells->getPointer()));
}
}
nbOfElt=MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_CELL,geoTypeReq,MED_NUMBER,MED_NODAL,&chgt,&trsf);
{
numCells=DataArrayInt::New();
numCells->alloc(nbOfElt,1);
- MEDmeshEntityNumberRd(fid,mName.c_str(),dt,it,MED_CELL,geoTypeReq,numCells->getPointer());
+ MEDFILESAFECALLERRD0(MEDmeshEntityNumberRd,(fid,mName.c_str(),dt,it,MED_CELL,geoTypeReq,numCells->getPointer()));
}
}
nbOfElt=MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_CELL,geoTypeReq,MED_NAME,MED_NODAL,&chgt,&trsf);
{
namesCells=DataArrayAsciiChar::New();
namesCells->alloc(nbOfElt+1,MED_SNAME_SIZE);//not a bug to avoid the memory corruption due to last \0 at the end
- MEDmeshEntityNameRd(fid,mName.c_str(),dt,it,MED_CELL,geoTypeReq,namesCells->getPointer());
+ MEDFILESAFECALLERRD0(MEDmeshEntityNameRd,(fid,mName.c_str(),dt,it,MED_CELL,geoTypeReq,namesCells->getPointer()));
namesCells->reAlloc(nbOfElt);//not a bug to avoid the memory corruption due to last \0 at the end
}
}
setTimeUnit(strm->getTimeUnit());
MEDFileMeshL2::ReadFamiliesAndGrps(fid,mName,_families,_groups,mrs);
med_bool chgt=MED_FALSE,trsf=MED_FALSE;
- int nbOfElt=MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_FAMILY_NUMBER,MED_NODAL,&chgt,&trsf);
+ int nbOfElt(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_FAMILY_NUMBER,MED_NODAL,&chgt,&trsf));
if(nbOfElt>0)
{
if(!mrs || mrs->isNodeFamilyFieldReading())
_fam_nodes->alloc(nbNodes,1);//yes nbNodes and not nbOfElt see next line.
if(nbNodes>nbOfElt)//yes it appends some times... It explains surely the mdump implementation. Bug revealed by PARAVIS EDF #2475 on structured.med file where only 12 first nodes are !=0 so nbOfElt=12 and nbOfNodes=378...
_fam_nodes->fillWithZero();
- MEDmeshEntityFamilyNumberRd(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,_fam_nodes->getPointer());
+ MEDFILESAFECALLERRD0(MEDmeshEntityFamilyNumberRd,(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,_fam_nodes->getPointer()));
}
}
nbOfElt=MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_NUMBER,MED_NODAL,&chgt,&trsf);
{
_num_nodes=DataArrayInt::New();
_num_nodes->alloc(nbOfElt,1);
- MEDmeshEntityNumberRd(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,_num_nodes->getPointer());
+ MEDFILESAFECALLERRD0(MEDmeshEntityNumberRd,(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,_num_nodes->getPointer()));
}
}
nbOfElt=MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_NAME,MED_NODAL,&chgt,&trsf);
{
_names_nodes=DataArrayAsciiChar::New();
_names_nodes->alloc(nbOfElt+1,MED_SNAME_SIZE);//not a bug to avoid the memory corruption due to last \0 at the end
- MEDmeshEntityNameRd(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,_names_nodes->getPointer());
+ MEDFILESAFECALLERRD0(MEDmeshEntityNameRd,(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,_names_nodes->getPointer()));
_names_nodes->reAlloc(nbOfElt);//not a bug to avoid the memory corruption due to last \0 at the end
}
}
med_geometry_type geoTypeReq(GetGeoTypeFromMeshDim(meshDim)),geoTypeReq2(GetGeoTypeFromMeshDim(meshDim-1));
//
if((const DataArrayInt *)_fam_cells)
- MEDmeshEntityFamilyNumberWr(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq,_fam_cells->getNumberOfTuples(),_fam_cells->getConstPointer());
+ MEDFILESAFECALLERWR0(MEDmeshEntityFamilyNumberWr,(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq,_fam_cells->getNumberOfTuples(),_fam_cells->getConstPointer()));
if((const DataArrayInt *)_fam_faces)
- MEDmeshEntityFamilyNumberWr(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq2,_fam_faces->getNumberOfTuples(),_fam_faces->getConstPointer());
+ MEDFILESAFECALLERWR0(MEDmeshEntityFamilyNumberWr,(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq2,_fam_faces->getNumberOfTuples(),_fam_faces->getConstPointer()));
if((const DataArrayInt *)_fam_nodes)
- MEDmeshEntityFamilyNumberWr(fid,maa.c_str(),_iteration,_order,MED_NODE,MED_NONE,_fam_nodes->getNumberOfTuples(),_fam_nodes->getConstPointer());
+ MEDFILESAFECALLERWR0(MEDmeshEntityFamilyNumberWr,(fid,maa.c_str(),_iteration,_order,MED_NODE,MED_NONE,_fam_nodes->getNumberOfTuples(),_fam_nodes->getConstPointer()));
if((const DataArrayInt *)_num_cells)
- MEDmeshEntityNumberWr(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq,_num_cells->getNumberOfTuples(),_num_cells->getConstPointer());
+ MEDFILESAFECALLERWR0(MEDmeshEntityNumberWr,(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq,_num_cells->getNumberOfTuples(),_num_cells->getConstPointer()));
if((const DataArrayInt *)_num_faces)
- MEDmeshEntityNumberWr(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq2,_num_faces->getNumberOfTuples(),_num_faces->getConstPointer());
+ MEDFILESAFECALLERWR0(MEDmeshEntityNumberWr,(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq2,_num_faces->getNumberOfTuples(),_num_faces->getConstPointer()));
if((const DataArrayInt *)_num_nodes)
- MEDmeshEntityNumberWr(fid,maa.c_str(),_iteration,_order,MED_NODE,MED_NONE,_num_nodes->getNumberOfTuples(),_num_nodes->getConstPointer());
+ MEDFILESAFECALLERWR0(MEDmeshEntityNumberWr,(fid,maa.c_str(),_iteration,_order,MED_NODE,MED_NONE,_num_nodes->getNumberOfTuples(),_num_nodes->getConstPointer()));
if((const DataArrayAsciiChar *)_names_cells)
{
if(_names_cells->getNumberOfComponents()!=MED_SNAME_SIZE)
oss << " ! The array has " << _names_cells->getNumberOfComponents() << " components !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- MEDmeshEntityNameWr(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq,_names_cells->getNumberOfTuples(),_names_cells->getConstPointer());
+ MEDFILESAFECALLERWR0(MEDmeshEntityNameWr,(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq,_names_cells->getNumberOfTuples(),_names_cells->getConstPointer()));
}
if((const DataArrayAsciiChar *)_names_faces)
{
oss << " ! The array has " << _names_faces->getNumberOfComponents() << " components !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- MEDmeshEntityNameWr(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq2,_names_faces->getNumberOfTuples(),_names_faces->getConstPointer());
+ MEDFILESAFECALLERWR0(MEDmeshEntityNameWr,(fid,maa.c_str(),_iteration,_order,MED_CELL,geoTypeReq2,_names_faces->getNumberOfTuples(),_names_faces->getConstPointer()));
}
if((const DataArrayAsciiChar *)_names_nodes)
{
oss << " ! The array has " << _names_cells->getNumberOfComponents() << " components !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- MEDmeshEntityNameWr(fid,maa.c_str(),_iteration,_order,MED_NODE,MED_NONE,_names_nodes->getNumberOfTuples(),_names_nodes->getConstPointer());
+ MEDFILESAFECALLERWR0(MEDmeshEntityNameWr,(fid,maa.c_str(),_iteration,_order,MED_NODE,MED_NONE,_names_nodes->getNumberOfTuples(),_names_nodes->getConstPointer()));
}
//
MEDFileUMeshL2::WriteFamiliesAndGrps(fid,maa.c_str(),_families,_groups,_too_long_str);
MEDLoaderBase::safeStrCpy2(c.c_str(),MED_SNAME_SIZE-1,comp+i*MED_SNAME_SIZE,_too_long_str);//MED_TAILLE_PNOM-1 to avoid to write '\0' on next compo
MEDLoaderBase::safeStrCpy2(u.c_str(),MED_SNAME_SIZE-1,unit+i*MED_SNAME_SIZE,_too_long_str);//MED_TAILLE_PNOM-1 to avoid to write '\0' on next compo
}
- MEDmeshCr(fid,maa,spaceDim,spaceDim,MED_STRUCTURED_MESH,desc,dtunit,MED_SORT_DTIT,MED_CARTESIAN,comp,unit);
- MEDmeshUniversalNameWr(fid,maa);
- MEDmeshGridTypeWr(fid,maa,MED_CARTESIAN_GRID);
+ MEDFILESAFECALLERWR0(MEDmeshCr,(fid,maa,spaceDim,spaceDim,MED_STRUCTURED_MESH,desc,dtunit,MED_SORT_DTIT,MED_CARTESIAN,comp,unit));
+ MEDFILESAFECALLERWR0(MEDmeshUniversalNameWr,(fid,maa));
+ MEDFILESAFECALLERWR0(MEDmeshGridTypeWr,(fid,maa,MED_CARTESIAN_GRID));
for(int i=0;i<spaceDim;i++)
{
const DataArrayDouble *da=_cmesh->getCoordsAt(i);
- MEDmeshGridIndexCoordinateWr(fid,maa,_iteration,_order,_time,i+1,da->getNumberOfTuples(),da->getConstPointer());
+ MEDFILESAFECALLERWR0(MEDmeshGridIndexCoordinateWr,(fid,maa,_iteration,_order,_time,i+1,da->getNumberOfTuples(),da->getConstPointer()));
}
//
std::string meshName(MEDLoaderBase::buildStringFromFortran(maa,MED_NAME_SIZE));
MEDLoaderBase::safeStrCpy2(c.c_str(),MED_SNAME_SIZE-1,comp+i*MED_SNAME_SIZE,_too_long_str);//MED_TAILLE_PNOM-1 to avoid to write '\0' on next compo
MEDLoaderBase::safeStrCpy2(u.c_str(),MED_SNAME_SIZE-1,unit+i*MED_SNAME_SIZE,_too_long_str);//MED_TAILLE_PNOM-1 to avoid to write '\0' on next compo
}
- MEDmeshCr(fid,maa,spaceDim,meshDim,MED_STRUCTURED_MESH,desc,dtunit,MED_SORT_DTIT,MED_CARTESIAN,comp,unit);
- MEDmeshUniversalNameWr(fid,maa);
- MEDmeshGridTypeWr(fid,maa,MED_CURVILINEAR_GRID);
+ MEDFILESAFECALLERWR0(MEDmeshCr,(fid,maa,spaceDim,meshDim,MED_STRUCTURED_MESH,desc,dtunit,MED_SORT_DTIT,MED_CARTESIAN,comp,unit));
+ MEDFILESAFECALLERWR0(MEDmeshUniversalNameWr,(fid,maa));
+ MEDFILESAFECALLERWR0(MEDmeshGridTypeWr,(fid,maa,MED_CURVILINEAR_GRID));
std::vector<int> nodeGridSt=_clmesh->getNodeGridStructure();
- MEDmeshGridStructWr(fid,maa,_iteration,_order,_time,&nodeGridSt[0]);
+ MEDFILESAFECALLERWR0(MEDmeshGridStructWr,(fid,maa,_iteration,_order,_time,&nodeGridSt[0]));
- MEDmeshNodeCoordinateWr(fid,maa,_iteration,_order,_time,MED_FULL_INTERLACE,coords->getNumberOfTuples(),coords->begin());
+ MEDFILESAFECALLERWR0(MEDmeshNodeCoordinateWr,(fid,maa,_iteration,_order,_time,MED_FULL_INTERLACE,coords->getNumberOfTuples(),coords->begin()));
//
std::string meshName(MEDLoaderBase::buildStringFromFortran(maa,MED_NAME_SIZE));
MEDFileStructuredMesh::writeStructuredLL(fid,meshName);
void MEDFileMeshMultiTS::write(med_idt fid) const
{
- MEDFileJoints * joints = getJoints();
- bool jointsWritten = false;
+ MEDFileJoints *joints(getJoints());
+ bool jointsWritten(false);
for(std::vector< MEDCouplingAutoRefCountObjectPtr<MEDFileMesh> >::const_iterator it=_mesh_one_ts.begin();it!=_mesh_one_ts.end();it++)
{
(*it)->write(fid);
}
- ((MEDFileMeshMultiTS*)this)->setJoints( joints ); // restore joints
+ (const_cast<MEDFileMeshMultiTS*>(this))->setJoints( joints ); // restore joints
}
void MEDFileMeshMultiTS::write(const std::string& fileName, int mode) const
// Author : Anthony Geay (CEA/DEN)
#include "MEDFileMeshElt.hxx"
+#include "MEDFileSafeCaller.txx"
#include "MEDFileMeshReadSelector.hxx"
#include "MEDCouplingUMesh.hxx"
for(int i=0;i<3;i++)
{
med_bool changement,transformation;
- int tmp=MEDmeshnEntity(fid,mName,dt,it,entities[i],geoElt,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation);
+ int tmp(MEDmeshnEntity(fid,mName,dt,it,entities[i],geoElt,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation));
if(tmp>nbOfElt)
{
nbOfElt=tmp;
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> conn(DataArrayInt::New());
int nbOfNodesPerCell(mc->getNumberOfNodesPerCell());
conn->alloc(nbOfNodesPerCell*curNbOfElem,1);
- MEDmeshElementConnectivityRd(fid,mName,dt,it,entity,geoElt,MED_NODAL,MED_FULL_INTERLACE,conn->getPointer());
+ MEDFILESAFECALLERRD0(MEDmeshElementConnectivityRd,(fid,mName,dt,it,entity,geoElt,MED_NODAL,MED_FULL_INTERLACE,conn->getPointer()));
std::transform(conn->begin(),conn->end(),conn->getPointer(),std::bind2nd(std::plus<int>(),-1));
mc->setNodalConnectivity(conn);
loadCommonPart(fid,mName,dt,it,mdim,curNbOfElem,geoElt,entity,mrs);
MED_ALL_CONSTITUENT,MED_FULL_INTERLACE,MED_COMPACT_STMODE,MED_NO_PROFILE,
/*start*/strt+1,/*stride*/step,/*count*/1,/*blocksize*/nbOfEltsToLoad,
/*lastblocksize=useless because count=1*/0,&filter);
- MEDmeshElementConnectivityAdvancedRd(fid,mName,dt,it,entity,geoElt,MED_NODAL,&filter,conn->getPointer());
+ MEDFILESAFECALLERRD0(MEDmeshElementConnectivityAdvancedRd,(fid,mName,dt,it,entity,geoElt,MED_NODAL,&filter,conn->getPointer()));
MEDfilterClose(&filter);
std::transform(conn->begin(),conn->end(),conn->getPointer(),std::bind2nd(std::plus<int>(),-1));
mc->setNodalConnectivity(conn);
med_entity_type entity, MEDFileMeshReadSelector *mrs)
{
med_bool changement,transformation;
- med_int curNbOfElem=MEDmeshnEntity(fid,mName,dt,it,entity,geoElt,MED_INDEX_NODE,MED_NODAL,&changement,&transformation)-1;
+ med_int curNbOfElem(MEDmeshnEntity(fid,mName,dt,it,entity,geoElt,MED_INDEX_NODE,MED_NODAL,&changement,&transformation)-1);
_m=MEDCoupling1DGTUMesh::New(mName,geoElt==MED_POLYGON?INTERP_KERNEL::NORM_POLYGON:INTERP_KERNEL::NORM_QPOLYG);
MEDCouplingAutoRefCountObjectPtr<MEDCoupling1DGTUMesh> mc(DynamicCast<MEDCoupling1GTUMesh,MEDCoupling1DGTUMesh>(_m));
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> conn(DataArrayInt::New()),connI(DataArrayInt::New());
conn->alloc(arraySize,1); connI->alloc(curNbOfElem+1,1);
- MEDmeshPolygon2Rd(fid,mName,dt,it,MED_CELL,geoElt,MED_NODAL,connI->getPointer(),conn->getPointer());
+ MEDFILESAFECALLERRD0(MEDmeshPolygon2Rd,(fid,mName,dt,it,MED_CELL,geoElt,MED_NODAL,connI->getPointer(),conn->getPointer()));
std::transform(conn->begin(),conn->end(),conn->getPointer(),std::bind2nd(std::plus<int>(),-1));
std::transform(connI->begin(),connI->end(),connI->getPointer(),std::bind2nd(std::plus<int>(),-1));
mc->setNodalConnectivity(conn,connI);
med_entity_type entity, MEDFileMeshReadSelector *mrs)
{
med_bool changement,transformation;
- med_int indexFaceLgth=MEDmeshnEntity(fid,mName,dt,it,MED_CELL,MED_POLYHEDRON,MED_INDEX_NODE,MED_NODAL,&changement,&transformation);
- int curNbOfElem=MEDmeshnEntity(fid,mName,dt,it,MED_CELL,MED_POLYHEDRON,MED_INDEX_FACE,MED_NODAL,&changement,&transformation)-1;
+ med_int indexFaceLgth(MEDmeshnEntity(fid,mName,dt,it,MED_CELL,MED_POLYHEDRON,MED_INDEX_NODE,MED_NODAL,&changement,&transformation));
+ int curNbOfElem(MEDmeshnEntity(fid,mName,dt,it,MED_CELL,MED_POLYHEDRON,MED_INDEX_FACE,MED_NODAL,&changement,&transformation)-1);
_m=MEDCoupling1DGTUMesh::New(mName,INTERP_KERNEL::NORM_POLYHED);
MEDCouplingAutoRefCountObjectPtr<MEDCoupling1DGTUMesh> mc(DynamicCastSafe<MEDCoupling1GTUMesh,MEDCoupling1DGTUMesh>(_m));
INTERP_KERNEL::AutoPtr<int> index=new int[curNbOfElem+1];
INTERP_KERNEL::AutoPtr<int> indexFace=new int[indexFaceLgth];
INTERP_KERNEL::AutoPtr<int> locConn=new int[connFaceLgth];
- MEDmeshPolyhedronRd(fid,mName,dt,it,MED_CELL,MED_NODAL,index,indexFace,locConn);
+ MEDFILESAFECALLERRD0(MEDmeshPolyhedronRd,(fid,mName,dt,it,MED_CELL,MED_NODAL,index,indexFace,locConn));
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> conn(DataArrayInt::New()),connI(DataArrayInt::New());
int arraySize=connFaceLgth;
for(int i=0;i<curNbOfElem;i++)
throw INTERP_KERNEL::Exception("MEDFileUMeshPerType::Write : internal error #1 !");
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> arr(m0->getNodalConnectivity()->deepCpy());
std::transform(arr->begin(),arr->end(),arr->getPointer(),std::bind2nd(std::plus<int>(),1));
- MEDmeshElementConnectivityWr(fid,mname.c_str(),dt,it,timm,MED_CELL,curMedType,MED_NODAL,MED_FULL_INTERLACE,nbOfCells,arr->begin());
+ MEDFILESAFECALLERWR0(MEDmeshElementConnectivityWr,(fid,mname.c_str(),dt,it,timm,MED_CELL,curMedType,MED_NODAL,MED_FULL_INTERLACE,nbOfCells,arr->begin()));
}
else
{
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> arr(m0->getNodalConnectivity()->deepCpy()),arrI(m0->getNodalConnectivityIndex()->deepCpy());
std::transform(arr->begin(),arr->end(),arr->getPointer(),std::bind2nd(std::plus<int>(),1));
std::transform(arrI->begin(),arrI->end(),arrI->getPointer(),std::bind2nd(std::plus<int>(),1));
- MEDmeshPolygon2Wr(fid,mname.c_str(),dt,it,timm,MED_CELL,ikt==INTERP_KERNEL::NORM_POLYGON?MED_POLYGON:MED_POLYGON2,MED_NODAL,nbOfCells+1,arrI->begin(),arr->begin());
+ MEDFILESAFECALLERWR0(MEDmeshPolygon2Wr,(fid,mname.c_str(),dt,it,timm,MED_CELL,ikt==INTERP_KERNEL::NORM_POLYGON?MED_POLYGON:MED_POLYGON2,MED_NODAL,nbOfCells+1,arrI->begin(),arr->begin()));
}
else
{
}
w1[1]=w1[0]+nbOfFaces2;
}
- MEDmeshPolyhedronWr(fid,mname.c_str(),dt,it,timm,MED_CELL,MED_NODAL,nbOfCells+1,tab1,nbOfFaces+1,tab2,bigtab);
+ MEDFILESAFECALLERWR0(MEDmeshPolyhedronWr,(fid,mname.c_str(),dt,it,timm,MED_CELL,MED_NODAL,nbOfCells+1,tab1,nbOfFaces+1,tab2,bigtab));
}
}
if(fam)
- MEDmeshEntityFamilyNumberWr(fid,mname.c_str(),dt,it,MED_CELL,curMedType,nbOfCells,fam->getConstPointer());
+ MEDFILESAFECALLERWR0(MEDmeshEntityFamilyNumberWr,(fid,mname.c_str(),dt,it,MED_CELL,curMedType,nbOfCells,fam->getConstPointer()));
if(num)
- MEDmeshEntityNumberWr(fid,mname.c_str(),dt,it,MED_CELL,curMedType,nbOfCells,num->getConstPointer());
+ MEDFILESAFECALLERWR0(MEDmeshEntityNumberWr,(fid,mname.c_str(),dt,it,MED_CELL,curMedType,nbOfCells,num->getConstPointer()));
if(names)
{
if(names->getNumberOfComponents()!=MED_SNAME_SIZE)
oss << " ! The array has " << names->getNumberOfComponents() << " components !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- MEDmeshEntityNameWr(fid,mname.c_str(),dt,it,MED_CELL,curMedType,nbOfCells,names->getConstPointer());
+ MEDFILESAFECALLERWR0(MEDmeshEntityNameWr,(fid,mname.c_str(),dt,it,MED_CELL,curMedType,nbOfCells,names->getConstPointer()));
}
}
#include "MEDFileMeshLL.hxx"
#include "MEDFileMesh.hxx"
#include "MEDLoaderBase.hxx"
+#include "MEDFileSafeCaller.txx"
#include "MEDFileMeshReadSelector.hxx"
#include "MEDCouplingUMesh.hxx"
med_axis_type axistype;
for(int i=0;i<n && !found;i++)
{
- int naxis=MEDmeshnAxis(fid,i+1);
+ int naxis(MEDmeshnAxis(fid,i+1));
INTERP_KERNEL::AutoPtr<char> axisname=MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE);
INTERP_KERNEL::AutoPtr<char> axisunit=MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE);
- MEDmeshInfo(fid,i+1,nommaa,&spaceDim,&dim,&type_maillage,maillage_description,dtunit,&stype,&nstep,&axistype,axisname,axisunit);
+ MEDFILESAFECALLERRD0(MEDmeshInfo,(fid,i+1,nommaa,&spaceDim,&dim,&type_maillage,maillage_description,dtunit,&stype,&nstep,&axistype,axisname,axisunit));
dtunit1=MEDLoaderBase::buildStringFromFortran(dtunit,sizeof(dtunit));
std::string cur=MEDLoaderBase::buildStringFromFortran(nommaa,sizeof(nommaa));
ms.push_back(cur);
case MED_STRUCTURED_MESH:
{
med_grid_type gt;
- MEDmeshGridTypeRd(fid,mname.c_str(),>);
+ MEDFILESAFECALLERRD0(MEDmeshGridTypeRd,(fid,mname.c_str(),>));
switch(gt)
{
case MED_CARTESIAN_GRID:
}
med_int numdt,numit;
med_float dtt;
- MEDmeshComputationStepInfo(fid,mname.c_str(),1,&numdt,&numit,&dtt);
+ MEDFILESAFECALLERRD0(MEDmeshComputationStepInfo,(fid,mname.c_str(),1,&numdt,&numit,&dtt));
dt=numdt; it=numit;
return ret;
}
std::vector< std::pair<int,int> > p(nstep);
for(int i=0;i<nstep;i++)
{
- MEDmeshComputationStepInfo(fid,mName.c_str(),i+1,&numdt,&numit,&dtt);
+ MEDFILESAFECALLERRD0(MEDmeshComputationStepInfo,(fid,mName.c_str(),i+1,&numdt,&numit,&dtt));
p[i]=std::make_pair<int,int>(numdt,numit);
found=(numdt==dt) && (numit==numit);
}
med_int spaceDim;
med_sorting_type stype;
med_axis_type axistype;
- int naxis=MEDmeshnAxis(fid,mId);
+ int naxis(MEDmeshnAxis(fid,mId));
INTERP_KERNEL::AutoPtr<char> nameTmp=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
INTERP_KERNEL::AutoPtr<char> axisname=MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE);
INTERP_KERNEL::AutoPtr<char> axisunit=MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE);
if(MEDmeshInfo(fid,mId,nameTmp,&spaceDim,&Mdim,&type_maillage,_description.getPointer(),_dt_unit.getPointer(),
&stype,&nstep,&axistype,axisname,axisunit)!=0)
throw INTERP_KERNEL::Exception("A problem has been detected when trying to get info on mesh !");
- MEDmeshUniversalNameRd(fid,nameTmp,_univ_name.getPointer());
+ MEDFILESAFECALLERRD0(MEDmeshUniversalNameRd,(fid,nameTmp,_univ_name.getPointer()));
switch(type_maillage)
{
case MED_UNSTRUCTURED_MESH:
case MED_STRUCTURED_MESH:
{
med_grid_type gt;
- MEDmeshGridTypeRd(fid,mName.c_str(),>);
+ MEDFILESAFECALLERRD0(MEDmeshGridTypeRd,(fid,mName.c_str(),>));
switch(gt)
{
case MED_CARTESIAN_GRID:
_coords=DataArrayDouble::New();
_coords->alloc(nCoords,spaceDim);
double *coordsPtr(_coords->getPointer());
- MEDmeshNodeCoordinateRd(fid,mName.c_str(),dt,it,MED_FULL_INTERLACE,coordsPtr);
+ MEDFILESAFECALLERRD0(MEDmeshNodeCoordinateRd,(fid,mName.c_str(),dt,it,MED_FULL_INTERLACE,coordsPtr));
if(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,MED_FAMILY_NUMBER,MED_NODAL,&changement,&transformation)>0)
{
_fam_coords=DataArrayInt::New();
_fam_coords->alloc(nCoords,1);
- MEDmeshEntityFamilyNumberRd(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,_fam_coords->getPointer());
+ MEDFILESAFECALLERRD0(MEDmeshEntityFamilyNumberRd,(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,_fam_coords->getPointer()));
}
else
_fam_coords=0;
{
_num_coords=DataArrayInt::New();
_num_coords->alloc(nCoords,1);
- MEDmeshEntityNumberRd(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,_num_coords->getPointer());
+ MEDFILESAFECALLERRD0(MEDmeshEntityNumberRd,(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,_num_coords->getPointer()));
}
else
_num_coords=0;
{
_name_coords=DataArrayAsciiChar::New();
_name_coords->alloc(nCoords+1,MED_SNAME_SIZE);//not a bug to avoid the memory corruption due to last \0 at the end
- MEDmeshEntityNameRd(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,_name_coords->getPointer());
+ MEDFILESAFECALLERRD0(MEDmeshEntityNameRd,(fid,mName.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,_name_coords->getPointer()));
_name_coords->reAlloc(nCoords);//not a bug to avoid the memory corruption due to last \0 at the end
}
else
MED_ALL_CONSTITUENT,MED_FULL_INTERLACE,MED_COMPACT_STMODE,MED_NO_PROFILE,
/*start*/nMin+1,/*stride*/1,/*count*/1,/*blocksize*/nbNodesToLoad,
/*lastblocksize=useless because count=1*/0,&filter);
- MEDmeshNodeCoordinateAdvancedRd(fid,mName.c_str(),dt,it,&filter,_coords->getPointer());
+ MEDFILESAFECALLERRD0(MEDmeshNodeCoordinateAdvancedRd,(fid,mName.c_str(),dt,it,&filter,_coords->getPointer()));
_part_coords=PartDefinition::New(nMin,nMax,1);
MEDfilterClose(&filter);
MEDfilterBlockOfEntityCr(fid,nCoords,1,1,MED_ALL_CONSTITUENT,MED_FULL_INTERLACE,MED_COMPACT_STMODE,
{
_fam_coords=DataArrayInt::New();
_fam_coords->alloc(nbNodesToLoad,1);
- MEDmeshEntityAttributeAdvancedRd(fid,mName.c_str(),MED_FAMILY_NUMBER,dt,it,MED_NODE,MED_NO_GEOTYPE,&filter2,_fam_coords->getPointer());
+ MEDFILESAFECALLERRD0(MEDmeshEntityAttributeAdvancedRd,(fid,mName.c_str(),MED_FAMILY_NUMBER,dt,it,MED_NODE,MED_NO_GEOTYPE,&filter2,_fam_coords->getPointer()));
}
else
_fam_coords=0;
{
_num_coords=DataArrayInt::New();
_num_coords->alloc(nbNodesToLoad,1);
- MEDmeshEntityAttributeAdvancedRd(fid,mName.c_str(),MED_NUMBER,dt,it,MED_NODE,MED_NO_GEOTYPE,&filter2,_num_coords->getPointer());
+ MEDFILESAFECALLERRD0(MEDmeshEntityAttributeAdvancedRd,(fid,mName.c_str(),MED_NUMBER,dt,it,MED_NODE,MED_NO_GEOTYPE,&filter2,_num_coords->getPointer()));
}
else
_num_coords=0;
{
_name_coords=DataArrayAsciiChar::New();
_name_coords->alloc(nbNodesToLoad+1,MED_SNAME_SIZE);//not a bug to avoid the memory corruption due to last \0 at the end
- MEDmeshEntityAttributeAdvancedRd(fid,mName.c_str(),MED_NAME,dt,it,MED_NODE,MED_NO_GEOTYPE,&filter2,_name_coords->getPointer());
+ MEDFILESAFECALLERRD0(MEDmeshEntityAttributeAdvancedRd,(fid,mName.c_str(),MED_NAME,dt,it,MED_NODE,MED_NO_GEOTYPE,&filter2,_name_coords->getPointer()));
_name_coords->reAlloc(nbNodesToLoad);//not a bug to avoid the memory corruption due to last \0 at the end
}
else
{
if(!coords)
return ;
- MEDmeshNodeCoordinateWr(fid,mname.c_str(),dt,it,time,MED_FULL_INTERLACE,coords->getNumberOfTuples(),coords->getConstPointer());
+ MEDFILESAFECALLERWR0(MEDmeshNodeCoordinateWr,(fid,mname.c_str(),dt,it,time,MED_FULL_INTERLACE,coords->getNumberOfTuples(),coords->getConstPointer()));
if(famCoords)
- MEDmeshEntityFamilyNumberWr(fid,mname.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,famCoords->getNumberOfTuples(),famCoords->getConstPointer());
+ MEDFILESAFECALLERWR0(MEDmeshEntityFamilyNumberWr,(fid,mname.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,famCoords->getNumberOfTuples(),famCoords->getConstPointer()));
if(numCoords)
- MEDmeshEntityNumberWr(fid,mname.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,numCoords->getNumberOfTuples(),numCoords->getConstPointer());
+ MEDFILESAFECALLERWR0(MEDmeshEntityNumberWr,(fid,mname.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,numCoords->getNumberOfTuples(),numCoords->getConstPointer()));
if(nameCoords)
{
if(nameCoords->getNumberOfComponents()!=MED_SNAME_SIZE)
oss << " ! The array has " << nameCoords->getNumberOfComponents() << " components !";
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
- MEDmeshEntityNameWr(fid,mname.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,nameCoords->getNumberOfTuples(),nameCoords->getConstPointer());
+ MEDFILESAFECALLERWR0(MEDmeshEntityNameWr,(fid,mname.c_str(),dt,it,MED_NODE,MED_NO_GEOTYPE,nameCoords->getNumberOfTuples(),nameCoords->getConstPointer()));
}
}
_order=it;
//
med_grid_type gridtype;
- MEDmeshGridTypeRd(fid,mName.c_str(),&gridtype);
+ MEDFILESAFECALLERRD0(MEDmeshGridTypeRd,(fid,mName.c_str(),&gridtype));
if(gridtype!=MED_CARTESIAN_GRID)
throw INTERP_KERNEL::Exception("Invalid structured mesh ! Expected cartesian mesh type !");
_cmesh=MEDCouplingCMesh::New();
{
med_data_type dataTypeReq=GetDataTypeCorrespondingToSpaceId(i);
med_bool chgt=MED_FALSE,trsf=MED_FALSE;
- int nbOfElt=MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,dataTypeReq,MED_NO_CMODE,&chgt,&trsf);
+ int nbOfElt(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,dataTypeReq,MED_NO_CMODE,&chgt,&trsf));
MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> da=DataArrayDouble::New();
da->alloc(nbOfElt,1);
da->setInfoOnComponent(0,infosOnComp[i]);
- MEDmeshGridIndexCoordinateRd(fid,mName.c_str(),dt,it,i+1,da->getPointer());
+ MEDFILESAFECALLERRD0(MEDmeshGridIndexCoordinateRd,(fid,mName.c_str(),dt,it,i+1,da->getPointer()));
_cmesh->setCoordsAt(i,da);
}
}
//
_clmesh=MEDCouplingCurveLinearMesh::New();
INTERP_KERNEL::AutoPtr<int> stGrid=new int[Mdim];
- MEDmeshGridStructRd(fid,mName.c_str(),dt,it,stGrid);
+ MEDFILESAFECALLERRD0(MEDmeshGridStructRd,(fid,mName.c_str(),dt,it,stGrid));
_clmesh->setNodeGridStructure(stGrid,((int *)stGrid)+Mdim);
med_bool chgt=MED_FALSE,trsf=MED_FALSE;
- int nbNodes=MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&chgt,&trsf);
+ int nbNodes(MEDmeshnEntity(fid,mName.c_str(),dt,it,MED_NODE,MED_NONE,MED_COORDINATE,MED_NO_CMODE,&chgt,&trsf));
MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> da=DataArrayDouble::New();
da->alloc(nbNodes,infosOnComp.size());
da->setInfoOnComponents(infosOnComp);
- MEDmeshNodeCoordinateRd(fid,mName.c_str(),dt,it,MED_FULL_INTERLACE,da->getPointer());
+ MEDFILESAFECALLERRD0(MEDmeshNodeCoordinateRd,(fid,mName.c_str(),dt,it,MED_FULL_INTERLACE,da->getPointer()));
_clmesh->setCoords(da);
}
#include "MEDFileParameter.hxx"
#include "MEDFileUtilities.hxx"
+#include "MEDFileSafeCaller.txx"
#include "MEDLoaderBase.hxx"
#include "InterpKernelAutoPtr.hxx"
{
int locDt,locIt;
double tim;
- MEDparameterComputationStepInfo(fid,name.c_str(),i+1,&locDt,&locIt,&tim);
+ MEDFILESAFECALLERRD0(MEDparameterComputationStepInfo,(fid,name.c_str(),i+1,&locDt,&locIt,&tim));
if(dt==locDt && it==locIt)
{
_iteration=locDt; _order=locIt; _time=tim;
- MEDparameterValueRd(fid,name.c_str(),_iteration,_order,reinterpret_cast<unsigned char *const>(&_arr));
+ MEDFILESAFECALLERRD0(MEDparameterValueRd,(fid,name.c_str(),_iteration,_order,reinterpret_cast<unsigned char *const>(&_arr)));
return ;
}
else
void MEDFileParameterDouble1TSWTI::readValue(med_idt fid, const std::string& name)
{
- MEDparameterValueRd(fid,name.c_str(),_iteration,_order,reinterpret_cast<unsigned char *const>(&_arr));
+ MEDFILESAFECALLERRD0(MEDparameterValueRd,(fid,name.c_str(),_iteration,_order,reinterpret_cast<unsigned char *const>(&_arr)));
}
void MEDFileParameterDouble1TSWTI::finishLoading(med_idt fid, const std::string& name, int timeStepId)
{
int locDt,locIt;
double dt;
- MEDparameterComputationStepInfo(fid,name.c_str(),timeStepId+1,&locDt,&locIt,&dt);
+ MEDFILESAFECALLERRD0(MEDparameterComputationStepInfo,(fid,name.c_str(),timeStepId+1,&locDt,&locIt,&dt));
_iteration=locDt; _order=locIt; _time=dt;
- MEDparameterValueRd(fid,name.c_str(),_iteration,_order,reinterpret_cast<unsigned char *const>(&_arr));
+ MEDFILESAFECALLERRD0(MEDparameterValueRd,(fid,name.c_str(),_iteration,_order,reinterpret_cast<unsigned char *const>(&_arr)));
}
void MEDFileParameterDouble1TSWTI::writeLL(med_idt fid, const std::string& name, const MEDFileWritable& mw) const
{
char nameW[MED_NAME_SIZE+1];
MEDLoaderBase::safeStrCpy(name.c_str(),MED_NAME_SIZE,nameW,mw.getTooLongStrPolicy());
- MEDparameterValueWr(fid,nameW,_iteration,_order,_time,reinterpret_cast<const unsigned char *>(&_arr));
+ MEDFILESAFECALLERWR0(MEDparameterValueWr,(fid,nameW,_iteration,_order,_time,reinterpret_cast<const unsigned char *>(&_arr)));
}
std::size_t MEDFileParameterTinyInfo::getHeapMemSizeOfStrings() const
MEDLoaderBase::safeStrCpy(_name.c_str(),MED_NAME_SIZE,nameW,getTooLongStrPolicy());
MEDLoaderBase::safeStrCpy(_desc_name.c_str(),MED_COMMENT_SIZE,descW,getTooLongStrPolicy());
MEDLoaderBase::safeStrCpy(_dt_unit.c_str(),MED_SNAME_SIZE,dtunitW,getTooLongStrPolicy());
- MEDparameterCr(fid,nameW,typ,descW,dtunitW);
+ MEDFILESAFECALLERWR0(MEDparameterCr,(fid,nameW,typ,descW,dtunitW));
}
void MEDFileParameterTinyInfo::mainRepr(int bkOffset, std::ostream& oss) const
for(int i=0;i<nbPar;i++)
{
int nbOfSteps;
- MEDparameterInfo(fid,i+1,pName,¶mType,descName,unitName,&nbOfSteps);
+ MEDFILESAFECALLERRD0(MEDparameterInfo,(fid,i+1,pName,¶mType,descName,unitName,&nbOfSteps));
std::string paramNameCpp=MEDLoaderBase::buildStringFromFortran(pName,MED_NAME_SIZE);
if(paramNameCpp==paramName && paramType==MED_FLOAT64)
{
for(int i=0;i<nbPar;i++)
{
int nbOfSteps;
- MEDparameterInfo(fid,i+1,pName,¶mType,descName,unitName,&nbOfSteps);
+ MEDFILESAFECALLERRD0(MEDparameterInfo,(fid,i+1,pName,¶mType,descName,unitName,&nbOfSteps));
std::string paramNameCpp=MEDLoaderBase::buildStringFromFortran(pName,MED_NAME_SIZE);
if(paramNameCpp==paramName && paramType==MED_FLOAT64)
{
INTERP_KERNEL::AutoPtr<char> unitName=MEDLoaderBase::buildEmptyString(MED_SNAME_SIZE);
med_parameter_type paramType;
int nbOfSteps;
- MEDparameterInfo(fid,1,pName,¶mType,descName,unitName,&nbOfSteps);
+ MEDFILESAFECALLERRD0(MEDparameterInfo,(fid,1,pName,¶mType,descName,unitName,&nbOfSteps));
std::string paramNameCpp=MEDLoaderBase::buildStringFromFortran(pName,MED_NAME_SIZE);
if(paramType==MED_FLOAT64)
{
INTERP_KERNEL::AutoPtr<char> unitName=MEDLoaderBase::buildEmptyString(MED_SNAME_SIZE);
med_parameter_type paramType;
int nbOfSteps;
- MEDparameterInfo(fid,1,pName,¶mType,descName,unitName,&nbOfSteps);
+ MEDFILESAFECALLERRD0(MEDparameterInfo,(fid,1,pName,¶mType,descName,unitName,&nbOfSteps));
std::string paramNameCpp=MEDLoaderBase::buildStringFromFortran(pName,MED_NAME_SIZE);
_dt_unit=MEDLoaderBase::buildStringFromFortran(unitName,MED_SNAME_SIZE);
_name=paramNameCpp;
for(int i=0;i<nbPar;i++)
{
int nbOfSteps;
- MEDparameterInfo(fid,i+1,pName,¶mType,descName,unitName,&nbOfSteps);
+ MEDFILESAFECALLERRD0(MEDparameterInfo,(fid,i+1,pName,¶mType,descName,unitName,&nbOfSteps));
std::string paramNameCpp=MEDLoaderBase::buildStringFromFortran(pName,MED_NAME_SIZE);
if(paramNameCpp==paramName)
{
{
int dt,it;
double tim;
- MEDparameterComputationStepInfo(fid,_name.c_str(),i+1,&dt,&it,&tim);
+ MEDFILESAFECALLERRD0(MEDparameterComputationStepInfo,(fid,_name.c_str(),i+1,&dt,&it,&tim));
switch(typ)
{
case MED_FLOAT64:
for(int i=0;i<nbPar;i++)
{
int nbOfSteps;
- MEDparameterInfo(fid,i+1,pName,¶mType,descName,unitName,&nbOfSteps);
+ MEDFILESAFECALLERRD0(MEDparameterInfo,(fid,i+1,pName,¶mType,descName,unitName,&nbOfSteps));
std::string paramNameCpp=MEDLoaderBase::buildStringFromFortran(pName,MED_NAME_SIZE);
_params[i]=MEDFileParameterMultiTS::New(fileName,paramNameCpp);
}
--- /dev/null
+// Copyright (C) 2007-2015 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 __MEDFILESAFECALLER_TXX__
+#define __MEDFILESAFECALLER_TXX__
+
+#include "med.h"
+
+#include "InterpKernelException.hxx"
+
+#include <sstream>
+
+// TXX extension to avoid to be installed.
+
+// This macro calls safely MEDFile functions returning 0
+#define MEDFILESAFECALLER0(a,b) { med_err retCode(a b); \
+ if(retCode!=0) { std::ostringstream osszz; osszz << "Return code of MEDFile call \"" << #a << "\" is not 0 as expected ! ( Return code was "<< retCode << " at " << __FILE__ << ":" << __LINE__ << " )"; throw INTERP_KERNEL::Exception(osszz.str().c_str()); } }
+
+#define MEDFILESAFECALLERRD0(a,b) MEDFILESAFECALLER0(a,b)
+
+#define MEDFILESAFECALLERWR0(a,b) { med_err retCode(a b); \
+ if(retCode!=0) { std::ostringstream osszz; osszz << "Return code of MEDFile call \"" << #a << "\" is not 0 as expected during writing operation ! ( Return code was "<< retCode << " at " << __FILE__ << ":" << __LINE__ << " ). Check write access on MED file ?"; throw INTERP_KERNEL::Exception(osszz.str().c_str()); } }
+
+#endif
#include "MEDLoader.hxx"
#include "MEDLoaderBase.hxx"
#include "MEDFileUtilities.hxx"
+#include "MEDFileSafeCaller.txx"
#include "MEDFileMesh.hxx"
#include "MEDFileField.hxx"
#include "CellModel.hxx"
med_sorting_type sortingType;
med_int nstep;
med_axis_type axisType;
- int naxis=MEDmeshnAxis(fid,meshId);
+ int naxis(MEDmeshnAxis(fid,meshId));
INTERP_KERNEL::AutoPtr<char> axisname=MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE);
INTERP_KERNEL::AutoPtr<char> axisunit=MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE);
- MEDmeshInfo(fid,meshId,nommaa,&Sdim,&Mdim,&type_maillage,maillage_description,dt_unit,&sortingType,&nstep,&axisType,axisname,axisunit);
+ MEDFILESAFECALLERRD0(MEDmeshInfo,(fid,meshId,nommaa,&Sdim,&Mdim,&type_maillage,maillage_description,dt_unit,&sortingType,&nstep,&axisType,axisname,axisunit));
// limitation
if(nstep!=1)
{
}
med_int numdt,numit;
med_float dt;
- MEDmeshComputationStepInfo(fid,nommaa,1,&numdt,&numit,&dt);
+ MEDFILESAFECALLERRD0(MEDmeshComputationStepInfo,(fid,nommaa,1,&numdt,&numit,&dt));
// endlimitation
for(int i=0;i<MED_N_CELL_GEO_FIXED_CON;i++)
{
med_geometry_type curMedType=typmai[i];
med_bool changement,transformation;
- int curNbOfElemM=MEDmeshnEntity(fid,nommaa,numdt,numit,MED_CELL,curMedType,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation);
- int curNbOfElemF=MEDmeshnEntity(fid,nommaa,numdt,numit,MED_CELL,curMedType,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation);//limitation
+ int curNbOfElemM(MEDmeshnEntity(fid,nommaa,numdt,numit,MED_CELL,curMedType,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation));
+ int curNbOfElemF(MEDmeshnEntity(fid,nommaa,numdt,numit,MED_CELL,curMedType,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation));//limitation
int curNbOfElem;
med_entity_type whichEntity;
MEDLoaderNS::dispatchElems(curNbOfElemM,curNbOfElemF,curNbOfElem,whichEntity);
std::vector<std::string> ret(n);
for(int i=0;i<n;i++)
{
- int naxis=MEDmeshnAxis(fid,i+1);
+ int naxis(MEDmeshnAxis(fid,i+1));
INTERP_KERNEL::AutoPtr<char> axisname=MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE);
INTERP_KERNEL::AutoPtr<char> axisunit=MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE);
int nstep;
- MEDmeshInfo(fid,i+1,nommaa,&space_dim,&mesh_dim,&type_maillage,maillage_description,dtunit,&stype,&nstep,&axistype,axisname,axisunit);
+ MEDFILESAFECALLERRD0(MEDmeshInfo,(fid,i+1,nommaa,&space_dim,&mesh_dim,&type_maillage,maillage_description,dtunit,&stype,&nstep,&axistype,axisname,axisunit));
std::string cur=MEDLoaderBase::buildStringFromFortran(nommaa,sizeof(nommaa));
ret[i]=cur;
}
med_sorting_type sortingType;
med_int nstep;
med_axis_type axisType;
- int naxis=MEDmeshnAxis(fid,meshId);
+ int naxis(MEDmeshnAxis(fid,meshId));
INTERP_KERNEL::AutoPtr<char> axisname=MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE);
INTERP_KERNEL::AutoPtr<char> axisunit=MEDLoaderBase::buildEmptyString(naxis*MED_SNAME_SIZE);
- MEDmeshInfo(fid,meshId,nommaa,&spaceDim,&meshDim,&type_maillage,maillage_description,dt_unit,&sortingType,&nstep,&axisType,axisname,axisunit);
+ MEDFILESAFECALLERRD0(MEDmeshInfo,(fid,meshId,nommaa,&spaceDim,&meshDim,&type_maillage,maillage_description,dt_unit,&sortingType,&nstep,&axisType,axisname,axisunit));
if(type_maillage!=MED_UNSTRUCTURED_MESH)
{
std::ostringstream oss; oss << "MEDLoader::GetUMeshGlobalInfo : Mesh \""<< meshName << "\" in file \"" << fileName;
throw INTERP_KERNEL::Exception("MEDLoader::GetUMeshGlobalInfo : multisteps on mesh not managed !");
med_int numdt,numit;
med_float dt;
- MEDmeshComputationStepInfo(fid,nommaa,1,&numdt,&numit,&dt);
+ MEDFILESAFECALLERRD0(MEDmeshComputationStepInfo,(fid,nommaa,1,&numdt,&numit,&dt));
// endlimitation
std::vector<int> dims;
std::vector< std::pair<INTERP_KERNEL::NormalizedCellType,int> > geoTypes;
for(int i=0;i<MED_N_CELL_FIXED_GEO;i++)
{
med_geometry_type curMedType=typmai[i];
- int curNbOfElemM=MEDmeshnEntity(fid,nommaa,numdt,numit,MED_CELL,curMedType,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation);
+ int curNbOfElemM(MEDmeshnEntity(fid,nommaa,numdt,numit,MED_CELL,curMedType,MED_CONNECTIVITY,MED_NODAL,&changement,&transformation));
if(curNbOfElemM>0)
{
INTERP_KERNEL::NormalizedCellType typp=typmai2[i];
{
CheckFileForRead(fileName);
MEDFileUtilities::AutoFid fid=MEDfileOpen(fileName.c_str(),MED_ACC_RDONLY);
- med_int nbFields=MEDnField(fid);
+ med_int nbFields(MEDnField(fid));
std::vector<std::string> fields(nbFields);
med_field_type typcha;
for(int i=0;i<nbFields;i++)
{
- med_int ncomp=MEDfieldnComponent(fid,i+1);
+ med_int ncomp(MEDfieldnComponent(fid,i+1));
INTERP_KERNEL::AutoPtr<char> comp=new char[ncomp*MED_SNAME_SIZE+1];
INTERP_KERNEL::AutoPtr<char> unit=new char[ncomp*MED_SNAME_SIZE+1];
INTERP_KERNEL::AutoPtr<char> dt_unit=MEDLoaderBase::buildEmptyString(MED_LNAME_SIZE);
med_bool localmesh;
INTERP_KERNEL::AutoPtr<char> maa_ass=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
INTERP_KERNEL::AutoPtr<char> nomcha=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
- MEDfieldInfo(fid,i+1,nomcha,maa_ass,&localmesh,&typcha,comp,unit,dt_unit,&nbPdt);
+ MEDFILESAFECALLERRD0(MEDfieldInfo,(fid,i+1,nomcha,maa_ass,&localmesh,&typcha,comp,unit,dt_unit,&nbPdt));
std::string meshName=MEDLoaderBase::buildStringFromFortran(maa_ass,MED_NAME_SIZE);
std::string curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE+1);
if(curFieldName==fieldName)
//
for(int i=0;i<nbFields;i++)
{
- med_int ncomp=MEDfieldnComponent(fid,i+1);
+ med_int ncomp(MEDfieldnComponent(fid,i+1));
INTERP_KERNEL::AutoPtr<char> comp=new char[ncomp*MED_SNAME_SIZE+1];
INTERP_KERNEL::AutoPtr<char> unit=new char[ncomp*MED_SNAME_SIZE+1];
med_int nbPdt;
INTERP_KERNEL::AutoPtr<char> maa_ass=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
- MEDfieldInfo(fid,i+1,nomcha,maa_ass,&localmesh,&typcha,comp,unit,dt_unit,&nbPdt);
+ MEDFILESAFECALLERRD0(MEDfieldInfo,(fid,i+1,nomcha,maa_ass,&localmesh,&typcha,comp,unit,dt_unit,&nbPdt));
std::string meshName=MEDLoaderBase::buildStringFromFortran(maa_ass,MED_NAME_SIZE);
std::string curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE+1);
if(curFieldName==fieldName)
med_field_type typcha;
for(int i=0;i<nbFields;i++)
{
- med_int ncomp=MEDfieldnComponent(fid,i+1);
+ med_int ncomp(MEDfieldnComponent(fid,i+1));
INTERP_KERNEL::AutoPtr<char> comp=new char[ncomp*MED_SNAME_SIZE+1];
INTERP_KERNEL::AutoPtr<char> unit=new char[ncomp*MED_SNAME_SIZE+1];
INTERP_KERNEL::AutoPtr<char> nomcha=MEDLoaderBase::buildEmptyString(MED_NAME_SIZE);
INTERP_KERNEL::AutoPtr<char> dt_unit=new char[MED_LNAME_SIZE+1];
med_int nbPdt;
med_bool localmesh;
- MEDfieldInfo(fid,i+1,nomcha,maa_ass,&localmesh,&typcha,comp,unit,dt_unit,&nbPdt);
+ MEDFILESAFECALLERRD0(MEDfieldInfo,(fid,i+1,nomcha,maa_ass,&localmesh,&typcha,comp,unit,dt_unit,&nbPdt));
ret.push_back(std::string(nomcha));
}
return ret;
//
for(int i=0;i<nbFields;i++)
{
- med_int ncomp=MEDfieldnComponent(fid,i+1);
+ med_int ncomp(MEDfieldnComponent(fid,i+1));
INTERP_KERNEL::AutoPtr<char> comp=new char[ncomp*MED_SNAME_SIZE+1];
INTERP_KERNEL::AutoPtr<char> unit=new char[ncomp*MED_SNAME_SIZE+1];
INTERP_KERNEL::AutoPtr<char> dt_unit=new char[MED_LNAME_SIZE+1];
med_int nbPdt;
med_bool localmesh;
- MEDfieldInfo(fid,i+1,nomcha,maa_ass,&localmesh,&typcha,comp,unit,dt_unit,&nbPdt);
+ MEDFILESAFECALLERRD0(MEDfieldInfo,(fid,i+1,nomcha,maa_ass,&localmesh,&typcha,comp,unit,dt_unit,&nbPdt));
std::string curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE+1);
std::string curMeshName=MEDLoaderBase::buildStringFromFortran(maa_ass,MED_NAME_SIZE+1);
//
//
for(int i=0;i<nbFields;i++)
{
- med_int ncomp=MEDfieldnComponent(fid,i+1);
+ med_int ncomp(MEDfieldnComponent(fid,i+1));
INTERP_KERNEL::AutoPtr<char> comp=new char[ncomp*MED_SNAME_SIZE+1];
INTERP_KERNEL::AutoPtr<char> unit=new char[ncomp*MED_SNAME_SIZE+1];
- MEDfieldInfo(fid,i+1,nomcha,maa_ass,&localmesh,&typcha,comp,unit,dt_unit,&nbPdt);
+ MEDFILESAFECALLERRD0(MEDfieldInfo,(fid,i+1,nomcha,maa_ass,&localmesh,&typcha,comp,unit,dt_unit,&nbPdt));
std::string curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE+1);
std::string curMeshName=MEDLoaderBase::buildStringFromFortran(maa_ass,MED_NAME_SIZE+1);
int profilesize,nbi;
{
if(nbPdt>0)
{
- MEDfieldComputingStepInfo(fid,nomcha,1,&numdt,&numo,&dt);
- med_int nbOfVal=MEDfieldnValueWithProfile(fid,nomcha,numdt,numo,MED_CELL,typmai[j],1,MED_COMPACT_PFLMODE,
- pflname,&profilesize,locname,&nbi);
+ MEDFILESAFECALLERRD0(MEDfieldComputingStepInfo,(fid,nomcha,1,&numdt,&numo,&dt));
+ med_int nbOfVal(MEDfieldnValueWithProfile(fid,nomcha,numdt,numo,MED_CELL,typmai[j],1,MED_COMPACT_PFLMODE,
+ pflname,&profilesize,locname,&nbi));
if(nbOfVal>0)
{
found=true;
//
for(int i=0;i<nbFields;i++)
{
- med_int ncomp=MEDfieldnComponent(fid,i+1);
+ med_int ncomp(MEDfieldnComponent(fid,i+1));
INTERP_KERNEL::AutoPtr<char> comp=new char[ncomp*MED_SNAME_SIZE+1];
INTERP_KERNEL::AutoPtr<char> unit=new char[ncomp*MED_SNAME_SIZE+1];
med_int nbPdt;
- MEDfieldInfo(fid,i+1,nomcha,maa_ass,&localmesh,&typcha,comp,unit,dt_unit,&nbPdt);
+ MEDFILESAFECALLERRD0(MEDfieldInfo,(fid,i+1,nomcha,maa_ass,&localmesh,&typcha,comp,unit,dt_unit,&nbPdt));
std::string curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE+1);
std::string curMeshName=MEDLoaderBase::buildStringFromFortran(maa_ass,MED_NAME_SIZE+1);
if(nbPdt>0)
{
int profilesize,nbi;
- MEDfieldComputingStepInfo(fid,nomcha,1,&numdt,&numo,&dt);
- med_int nbOfVal=MEDfieldnValueWithProfile(fid,nomcha,numdt,numo,MED_NODE,MED_NONE,1,MED_COMPACT_PFLMODE,
- pflname,&profilesize,locname,&nbi);
+ MEDFILESAFECALLERRD0(MEDfieldComputingStepInfo,(fid,nomcha,1,&numdt,&numo,&dt));
+ med_int nbOfVal(MEDfieldnValueWithProfile(fid,nomcha,numdt,numo,MED_NODE,MED_NONE,1,MED_COMPACT_PFLMODE,
+ pflname,&profilesize,locname,&nbi));
if(curMeshName==meshName && nbOfVal>0)
{
ret.push_back(curFieldName);
std::ostringstream oss; oss << "MEDLoader::GetAllFieldIterations : No field with name \"" << fieldName<< "\" in file \"" << fileName << "\" ! Possible fields are : ";
for(int i=0;i<nbFields;i++)
{
- med_int ncomp=MEDfieldnComponent(fid,i+1);
+ med_int ncomp(MEDfieldnComponent(fid,i+1));
INTERP_KERNEL::AutoPtr<char> comp=new char[ncomp*MED_SNAME_SIZE+1];
INTERP_KERNEL::AutoPtr<char> unit=new char[ncomp*MED_SNAME_SIZE+1];
med_int nbPdt;
- MEDfieldInfo(fid,i+1,nomcha,maa_ass,&localmesh,&typcha,comp,unit,dt_unit,&nbPdt);
+ MEDFILESAFECALLERRD0(MEDfieldInfo,(fid,i+1,nomcha,maa_ass,&localmesh,&typcha,comp,unit,dt_unit,&nbPdt));
std::string curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE+1);
if(curFieldName==fieldName)
{
for(int k=0;k<nbPdt;k++)
{
- MEDfieldComputingStepInfo(fid,nomcha,k+1,&numdt,&numo,&dt);
+ MEDFILESAFECALLERRD0(MEDfieldComputingStepInfo,(fid,nomcha,k+1,&numdt,&numo,&dt));
ret.push_back(std::make_pair(std::make_pair(numdt,numo),dt));
}
return ret;
double ret=std::numeric_limits<double>::max();
for(int i=0;i<nbFields && !found;i++)
{
- med_int ncomp=MEDfieldnComponent(fid,i+1);
+ med_int ncomp(MEDfieldnComponent(fid,i+1));
INTERP_KERNEL::AutoPtr<char> comp=new char[ncomp*MED_SNAME_SIZE+1];
INTERP_KERNEL::AutoPtr<char> unit=new char[ncomp*MED_SNAME_SIZE+1];
med_int nbPdt;
- MEDfieldInfo(fid,i+1,nomcha,maa_ass,&local,&typcha,comp,unit,dt_unit,&nbPdt);
+ MEDFILESAFECALLERRD0(MEDfieldInfo,(fid,i+1,nomcha,maa_ass,&local,&typcha,comp,unit,dt_unit,&nbPdt));
std::string curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE+1);
if(curFieldName==fieldName)
{
found=true;
for(int k=0;k<nbPdt;k++)
{
- MEDfieldComputingStepInfo(fid,nomcha,k+1,&numdt,&numo,&dt);
+ MEDFILESAFECALLERRD0(MEDfieldComputingStepInfo,(fid,nomcha,k+1,&numdt,&numo,&dt));
if(numdt==iteration && numo==order)
{
found2=true;
std::set<std::string> s2;
for(int i=0;i<nbFields;i++)
{
- med_int ncomp=MEDfieldnComponent(fid,i+1);
+ med_int ncomp(MEDfieldnComponent(fid,i+1));
INTERP_KERNEL::AutoPtr<char> comp=new char[ncomp*MED_SNAME_SIZE+1];
INTERP_KERNEL::AutoPtr<char> unit=new char[ncomp*MED_SNAME_SIZE+1];
med_int nbPdt;
- MEDfieldInfo(fid,i+1,nomcha,maa_ass,&localmesh,&typcha,comp,unit,dt_unit,&nbPdt);
+ MEDFILESAFECALLERRD0(MEDfieldInfo,(fid,i+1,nomcha,maa_ass,&localmesh,&typcha,comp,unit,dt_unit,&nbPdt));
std::string curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE+1);
if(curFieldName==fieldName)
{
for(int k=0;k<nbPdt;k++)
{
int profilesize,nbi;
- MEDfieldComputingStepInfo(fid,nomcha,k+1,&numdt,&numo,&dt);
- med_int nbOfVal=MEDfieldnValueWithProfile(fid,nomcha,numdt,numo,MED_CELL,typmai[j],1,MED_COMPACT_PFLMODE,
- pflname,&profilesize,locname,&nbi);
+ MEDFILESAFECALLERRD0(MEDfieldComputingStepInfo,(fid,nomcha,k+1,&numdt,&numo,&dt));
+ med_int nbOfVal(MEDfieldnValueWithProfile(fid,nomcha,numdt,numo,MED_CELL,typmai[j],1,MED_COMPACT_PFLMODE,
+ pflname,&profilesize,locname,&nbi));
std::string maa_ass_cpp(maa_ass);
if(nbOfVal>0)
{
std::set<std::string> s2;
for(int i=0;i<nbFields;i++)
{
- med_int ncomp=MEDfieldnComponent(fid,i+1);
+ med_int ncomp(MEDfieldnComponent(fid,i+1));
INTERP_KERNEL::AutoPtr<char> comp=new char[ncomp*MED_SNAME_SIZE+1];
INTERP_KERNEL::AutoPtr<char> unit=new char[ncomp*MED_SNAME_SIZE+1];
med_int nbPdt;
- MEDfieldInfo(fid,i+1,nomcha,maa_ass,&localmesh,&typcha,comp,unit,dt_unit,&nbPdt);
+ MEDFILESAFECALLERRD0(MEDfieldInfo,(fid,i+1,nomcha,maa_ass,&localmesh,&typcha,comp,unit,dt_unit,&nbPdt));
std::string curFieldName=MEDLoaderBase::buildStringFromFortran(nomcha,MED_NAME_SIZE+1);
if(curFieldName==fieldName)
{
for(int k=0;k<nbPdt;k++)
{
int profilesize,nbi;
- MEDfieldComputingStepInfo(fid,nomcha,k+1,&numdt,&numo,&dt);
- med_int nbOfVal=MEDfieldnValueWithProfile(fid,nomcha,numdt,numo,MED_NODE,MED_NONE,1,MED_COMPACT_PFLMODE,
- pflname,&profilesize,locname,&nbi);
+ MEDFILESAFECALLERRD0(MEDfieldComputingStepInfo,(fid,nomcha,k+1,&numdt,&numo,&dt));
+ med_int nbOfVal(MEDfieldnValueWithProfile(fid,nomcha,numdt,numo,MED_NODE,MED_NONE,1,MED_COMPACT_PFLMODE,
+ pflname,&profilesize,locname,&nbi));
std::string maa_ass_cpp(maa_ass);
if(nbOfVal>0)
{