#include <med.h>
#include <med_err.h>
+#include <med_proto.h>
#ifdef _DEBUG_
static int MYDEBUG = 0;
TFile(const TFile&);
public:
- TFile(const std::string& theFileName):
+ TFile(const std::string& theFileName, TInt theMinor=-1):
myCount(0),
myFid(0),
- myFileName(theFileName)
- {}
+ myFileName(theFileName),
+ myMinor(theMinor)
+ {
+ if ((myMinor < 0) || (myMinor > MED_MINOR_NUM)) myMinor = MED_MINOR_NUM;
+ }
~TFile()
{
{
if(myCount++ == 0){
const char* aFileName = myFileName.c_str();
- myFid = MEDfileOpen(aFileName,med_access_mode(theMode));
+ myFid = MEDfileVersionOpen(aFileName,med_access_mode(theMode), MED_MAJOR_NUM, myMinor, MED_RELEASE_NUM);
}
if(theErr)
*theErr = TErr(myFid);
else if(myFid < 0)
- EXCEPTION(std::runtime_error,"TFile - MEDfileOpen('"<<myFileName<<"',"<<theMode<<")");
+ EXCEPTION(std::runtime_error,"TFile - MEDfileVersionOpen('"<<myFileName<<"',"<<theMode<<"',"<< MED_MAJOR_NUM<<"',"<< myMinor<<"',"<< MED_RELEASE_NUM<<")");
}
const TIdt& Id() const
TInt myCount;
TIdt myFid;
std::string myFileName;
+ TInt myMinor;
};
class TFileWrapper
{
PFile myFile;
+ TInt myMinor;
public:
- TFileWrapper(const PFile& theFile, EModeAcces theMode, TErr* theErr = NULL):
- myFile(theFile)
+ TFileWrapper(const PFile& theFile, EModeAcces theMode, TErr* theErr = NULL, TInt theMinor=-1):
+ myFile(theFile),
+ myMinor(theMinor)
{
+ if (myMinor < 0) myMinor = MED_MINOR_NUM;
myFile->Open(theMode,theErr);
}
//---------------------------------------------------------------
- TVWrapper::TVWrapper(const std::string& theFileName):
- myFile(new TFile(theFileName))
+ TVWrapper::TVWrapper(const std::string& theFileName, TInt theMinor):
+ myMinor(theMinor),
+ myFile(new TFile(theFileName, theMinor))
{
TErr aRet;
myFile->Open( eLECTURE_ECRITURE, &aRet );
- // if(aRet < 0)
- // myFile->Close();
- // myFile->Open( eLECTURE_AJOUT, &aRet );
- // }
if(aRet < 0) {
myFile->Close();
myFile->Open( eLECTURE, &aRet );
TVWrapper
::GetNbMeshes(TErr* theErr)
{
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+ TFileWrapper aFileWrapper(myFile,eLECTURE,theErr, myMinor);
if(theErr && *theErr < 0)
return -1;
MED::TMeshInfo& theInfo,
TErr* theErr)
{
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+ TFileWrapper aFileWrapper(myFile,eLECTURE,theErr, myMinor);
if(theErr && *theErr < 0)
return;
EModeAcces theMode,
TErr* theErr)
{
- TFileWrapper aFileWrapper(myFile,theMode,theErr);
+ TFileWrapper aFileWrapper(myFile,theMode,theErr, myMinor);
if(theErr && *theErr < 0)
return;
::GetNbFamilies(const MED::TMeshInfo& theInfo,
TErr* theErr)
{
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+ TFileWrapper aFileWrapper(myFile,eLECTURE,theErr, myMinor);
if(theErr && *theErr < 0)
return -1;
const MED::TMeshInfo& theInfo,
TErr* theErr)
{
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+ TFileWrapper aFileWrapper(myFile,eLECTURE,theErr, myMinor);
if(theErr && *theErr < 0)
return -1;
const MED::TMeshInfo& theInfo,
TErr* theErr)
{
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+ TFileWrapper aFileWrapper(myFile,eLECTURE,theErr, myMinor);
if(theErr && *theErr < 0)
return -1;
MED::TFamilyInfo& theInfo,
TErr* theErr)
{
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+ TFileWrapper aFileWrapper(myFile,eLECTURE,theErr, myMinor);
if(theErr && *theErr < 0)
return;
EModeAcces theMode,
TErr* theErr)
{
- TFileWrapper aFileWrapper(myFile,theMode,theErr);
+ TFileWrapper aFileWrapper(myFile,theMode,theErr, myMinor);
if(theErr && *theErr < 0)
return;
EGeometrieElement theGeom,
TErr* theErr)
{
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+ TFileWrapper aFileWrapper(myFile,eLECTURE,theErr, myMinor);
if(theErr && *theErr < 0)
return;
EGeometrieElement theGeom,
TErr* theErr)
{
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+ TFileWrapper aFileWrapper(myFile,eLECTURE,theErr, myMinor);
if(theErr && *theErr < 0)
return;
EGeometrieElement theGeom,
TErr* theErr)
{
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+ TFileWrapper aFileWrapper(myFile,eLECTURE,theErr, myMinor);
if(theErr && *theErr < 0)
return;
EGeometrieElement theGeom,
TErr* theErr)
{
- TFileWrapper aFileWrapper(myFile,theMode,theErr);
+ TFileWrapper aFileWrapper(myFile,theMode,theErr, myMinor);
if(theErr && *theErr < 0)
return;
EGeometrieElement theGeom,
TErr* theErr)
{
- TFileWrapper aFileWrapper(myFile,theMode,theErr);
+ TFileWrapper aFileWrapper(myFile,theMode,theErr, myMinor);
if(theErr && *theErr < 0)
return;
EGeometrieElement theGeom,
TErr* theErr)
{
- TFileWrapper aFileWrapper(myFile,theMode,theErr);
+ TFileWrapper aFileWrapper(myFile,theMode,theErr, myMinor);
if(theErr && *theErr < 0)
return;
ETable theTable,
TErr* theErr)
{
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+ TFileWrapper aFileWrapper(myFile,eLECTURE,theErr, myMinor);
if(theErr && *theErr < 0)
return -1;
::GetNodeInfo(MED::TNodeInfo& theInfo,
TErr* theErr)
{
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+ TFileWrapper aFileWrapper(myFile,eLECTURE,theErr, myMinor);
if(theErr && *theErr < 0)
return;
EModeAcces theMode,
TErr* theErr)
{
- TFileWrapper aFileWrapper(myFile,theMode,theErr);
+ TFileWrapper aFileWrapper(myFile,theMode,theErr, myMinor);
if(theErr && *theErr < 0)
return;
::GetPolygoneInfo(MED::TPolygoneInfo& theInfo,
TErr* theErr)
{
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+ TFileWrapper aFileWrapper(myFile,eLECTURE,theErr, myMinor);
if(theErr && *theErr < 0)
return;
EModeAcces theMode,
TErr* theErr)
{
- TFileWrapper aFileWrapper(myFile,theMode,theErr);
+ TFileWrapper aFileWrapper(myFile,theMode,theErr, myMinor);
if(theErr && *theErr < 0)
return;
EConnectivite theConnMode,
TErr* theErr)
{
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+ TFileWrapper aFileWrapper(myFile,eLECTURE,theErr, myMinor);
if(theErr && *theErr < 0)
return 0;
::GetPolyedreInfo(TPolyedreInfo& theInfo,
TErr* theErr)
{
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+ TFileWrapper aFileWrapper(myFile,eLECTURE,theErr, myMinor);
if(theErr && *theErr < 0)
return;
EModeAcces theMode,
TErr* theErr)
{
- TFileWrapper aFileWrapper(myFile,theMode,theErr);
+ TFileWrapper aFileWrapper(myFile,theMode,theErr, myMinor);
if(theErr && *theErr < 0)
return;
EConnectivite theConnMode,
TErr* theErr)
{
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+ TFileWrapper aFileWrapper(myFile,eLECTURE,theErr, myMinor);
if(theErr && *theErr < 0)
EXCEPTION(std::runtime_error,"GetPolyedreConnSize - (...)");
{
TEntityInfo anInfo;
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+ TFileWrapper aFileWrapper(myFile,eLECTURE,theErr, myMinor);
if(theErr && *theErr < 0)
return anInfo;
EConnectivite theConnMode,
TErr* theErr)
{
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+ TFileWrapper aFileWrapper(myFile,eLECTURE,theErr, myMinor);
if(theErr && *theErr < 0)
return -1;
//----------------------------------------------------------------------------
void TVWrapper::GetCellInfo(MED::TCellInfo& theInfo, TErr* theErr)
{
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+ TFileWrapper aFileWrapper(myFile,eLECTURE,theErr, myMinor);
if(theErr && *theErr < 0)
return;
EModeAcces theMode,
TErr* theErr)
{
- TFileWrapper aFileWrapper(myFile,theMode,theErr);
+ TFileWrapper aFileWrapper(myFile,theMode,theErr, myMinor);
if(theErr && *theErr < 0)
return;
//! Read geom type of MED_BALL structural element
EGeometrieElement TVWrapper::GetBallGeom(const TMeshInfo& theMeshInfo)
{
- TFileWrapper aFileWrapper(myFile,eLECTURE);
+ TErr anError;
+ TFileWrapper aFileWrapper(myFile, eLECTURE, &anError, myMinor);
// read med_geometry_type of "MED_BALL" element
char geotypename[ MED_NAME_SIZE + 1] = MED_BALL_NAME;
//! Read number of balls in the Mesh
TInt TVWrapper::GetNbBalls(const TMeshInfo& theMeshInfo)
{
- TFileWrapper aFileWrapper(myFile,eLECTURE);
+ TErr anError;
+ TFileWrapper aFileWrapper(myFile, eLECTURE, &anError, myMinor);
EGeometrieElement ballType = GetBallGeom( theMeshInfo );
if ( ballType < 0 )
//! Read a MEDWrapped representation of MED_BALL from the MED file
void TVWrapper::GetBallInfo(TBallInfo& theInfo, TErr* theErr)
{
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+ TFileWrapper aFileWrapper(myFile,eLECTURE,theErr, myMinor);
// check geometry of MED_BALL
if ( theInfo.myGeom == eBALL )
//! Write a MEDWrapped representation of MED_BALL to the MED file
void TVWrapper::SetBallInfo(const TBallInfo& theInfo, EModeAcces theMode, TErr* theErr)
{
- TFileWrapper aFileWrapper(myFile,theMode,theErr);
+ TFileWrapper aFileWrapper(myFile,theMode,theErr, myMinor);
TErr ret;
char ballsupportname[MED_NAME_SIZE+1]="BALL_SUPPORT_MESH";
TVWrapper
::GetNbFields(TErr* theErr)
{
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+ TFileWrapper aFileWrapper(myFile,eLECTURE,theErr, myMinor);
if(theErr && *theErr < 0)
return -1;
::GetNbComp(TInt theFieldId,
TErr* theErr)
{
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+ TFileWrapper aFileWrapper(myFile,eLECTURE,theErr, myMinor);
if(theErr && *theErr < 0)
return -1;
MED::TFieldInfo& theInfo,
TErr* theErr)
{
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+ TFileWrapper aFileWrapper(myFile,eLECTURE,theErr, myMinor);
if(theErr && *theErr < 0)
return;
EModeAcces theMode,
TErr* theErr)
{
- TFileWrapper aFileWrapper(myFile,theMode,theErr);
+ TFileWrapper aFileWrapper(myFile,theMode,theErr, myMinor);
if(theErr && *theErr < 0)
return;
TVWrapper
::GetNbGauss(TErr* theErr)
{
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+ TFileWrapper aFileWrapper(myFile,eLECTURE,theErr, myMinor);
if(theErr && *theErr < 0)
return -1;
::GetGaussPreInfo(TInt theId,
TErr* theErr)
{
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+ TFileWrapper aFileWrapper(myFile,eLECTURE,theErr, myMinor);
if(theErr && *theErr < 0)
return TGaussInfo::TInfo( TGaussInfo::TKey(ePOINT1,""),0 );
TGaussInfo& theInfo,
TErr* theErr)
{
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+ TFileWrapper aFileWrapper(myFile,eLECTURE,theErr, myMinor);
if(theErr && *theErr < 0)
return;
TVWrapper
::GetNbProfiles(TErr* theErr)
{
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+ TFileWrapper aFileWrapper(myFile,eLECTURE,theErr, myMinor);
if(theErr && *theErr < 0)
return -1;
::GetProfilePreInfo(TInt theId,
TErr* theErr)
{
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+ TFileWrapper aFileWrapper(myFile,eLECTURE,theErr, myMinor);
if(theErr && *theErr < 0)
return TProfileInfo::TInfo();
TProfileInfo& theInfo,
TErr* theErr)
{
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+ TFileWrapper aFileWrapper(myFile,eLECTURE,theErr, myMinor);
if(theErr && *theErr < 0)
return;
EModeAcces theMode,
TErr* theErr)
{
- TFileWrapper aFileWrapper(myFile,theMode,theErr);
+ TFileWrapper aFileWrapper(myFile,theMode,theErr, myMinor);
if(theErr && *theErr < 0)
return;
TErr* theErr)
{
theEntity = EEntiteMaillage(-1);
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+ TFileWrapper aFileWrapper(myFile,eLECTURE,theErr, myMinor);
if(theErr){
if(theEntityInfo.empty())
MED::TTimeStampInfo& theInfo,
TErr* theErr)
{
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+ TFileWrapper aFileWrapper(myFile,eLECTURE,theErr, myMinor);
const TGeom2Size& aGeom2Size = theInfo.myGeom2Size;
const TKey2Gauss& theKey2Gauss,
TErr* theErr)
{
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+ TFileWrapper aFileWrapper(myFile,eLECTURE,theErr, myMinor);
if(theErr && *theErr < 0)
return;
EModeAcces theMode,
TErr* theErr)
{
- TFileWrapper aFileWrapper(myFile,theMode,theErr);
+ TFileWrapper aFileWrapper(myFile,theMode,theErr, myMinor);
if(theErr && *theErr < 0)
return;
{
if(theInfo.myMeshInfo->myType != eSTRUCTURE)
return;
- TFileWrapper aFileWrapper(myFile,theMode,theErr);
+ TFileWrapper aFileWrapper(myFile,theMode,theErr, myMinor);
if(theErr && *theErr < 0)
return;
::GetGrilleInfo(TGrilleInfo& theInfo,
TErr* theErr)
{
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+ TFileWrapper aFileWrapper(myFile,eLECTURE,theErr, myMinor);
if(theErr && *theErr < 0)
return;
EGrilleType& theGridType,
TErr* theErr)
{
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+ TFileWrapper aFileWrapper(myFile,eLECTURE,theErr, myMinor);
if(theErr && *theErr < 0)
EXCEPTION(std::runtime_error," GetGrilleType - aFileWrapper (...)");
TIntVector& theStruct,
TErr* theErr)
{
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+ TFileWrapper aFileWrapper(myFile,eLECTURE,theErr, myMinor);
if(theErr && *theErr < 0)
return;