MED_SliceArray.hxx
MED_Structures.hxx
MED_TStructures.hxx
- MED_TWrapper.hxx
MED_Utilities.hxx
- MED_V2_2_Wrapper.hxx
MED_Vector.hxx
MED_Wrapper.hxx
MED_WrapperDef.hxx
# sources / static
SET(MEDWrapper_SOURCES
MED_Algorithm.cxx
+ MED_Common.cxx
MED_CoordUtils.cxx
MED_Factory.cxx
MED_GaussDef.cxx
MED_GaussUtils.cxx
MED_Structures.cxx
MED_Utilities.cxx
- MED_V2_2_Wrapper.cxx
MED_Wrapper.cxx
)
# --- rules ---
-
+
ADD_LIBRARY(MEDWrapper ${MEDWrapper_SOURCES})
TARGET_LINK_LIBRARIES(MEDWrapper ${_link_LIBRARIES})
INSTALL(TARGETS MEDWrapper EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
#include "MED_Algorithm.hxx"
#include "MED_Wrapper.hxx"
#include "MED_Utilities.hxx"
-
+
#ifdef _DEBUG_
static int MYDEBUG = 0;
static int MYVALUEDEBUG = 0;
#else
-// static int MYDEBUG = 0;
-// static int MYVALUEDEBUG = 0;
+static int MYDEBUG = 0;
+static int MYVALUEDEBUG = 0;
#endif
namespace MED
{
//---------------------------------------------------------------
- TEntity2TGeom2ElemInfo
- GetEntity2TGeom2ElemInfo(const PWrapper& theWrapper,
+ TEntity2TGeom2ElemInfo
+ GetEntity2TGeom2ElemInfo(const PWrapper& theWrapper,
const PMeshInfo& theMeshInfo,
const MED::TEntityInfo& theEntityInfo)
{
ADDMSG(MYDEBUG,"\n");
return anEntity2TGeom2ElemInfo;
}
-
-
+
//---------------------------------------------------------------
TFamilyInfoSet
GetFamilyInfoSet(const PWrapper& theWrapper,
return aFamilyInfoSet;
}
-
//---------------------------------------------------------------
TGroupInfo
GetGroupInfo(const TFamilyInfoSet& theFamilyInfoSet)
TInt aNbGroup = aFamilyInfo->GetNbGroup();
for(TInt iGroup = 0; iGroup < aNbGroup; iGroup++){
aGroup[aFamilyInfo->GetGroupName(iGroup)].insert(aFamilyInfo);
- }
+ }
}
#ifdef _DEBUG_
return aGroup;
}
-
//---------------------------------------------------------------
- TFieldInfo2TimeStampInfoSet
- GetFieldInfo2TimeStampInfoSet(const PWrapper& theWrapper,
+ TFieldInfo2TimeStampInfoSet
+ GetFieldInfo2TimeStampInfoSet(const PWrapper& theWrapper,
const PMeshInfo& theMeshInfo,
const MED::TEntityInfo& theEntityInfo)
{
TInt aNbTimeStamps = theWrapper->GetNbTimeStamps(aFieldInfo,theEntityInfo,anEntity,aGeom2Size);
ADDMSG(MYDEBUG,"anEntity = "<<anEntity<<"; GetNbTimeStamps = "<<aNbTimeStamps<<"\n");
for(TInt iTimeStamp = 1; iTimeStamp <= aNbTimeStamps; iTimeStamp++){
- PTimeStampInfo aTimeStamp =
+ PTimeStampInfo aTimeStamp =
theWrapper->GetPTimeStampInfo(aFieldInfo,anEntity,aGeom2Size,iTimeStamp);
aFieldInfo2TimeStampInfoSet[aFieldInfo].insert(aTimeStamp);
INITMSG(MYDEBUG,
ADDMSG(MYDEBUG,"\n");
return aFieldInfo2TimeStampInfoSet;
}
-
//---------------------------------------------------------------
- TEntite2TFieldInfo2TimeStampInfoSet
+ TEntite2TFieldInfo2TimeStampInfoSet
GetEntite2TFieldInfo2TimeStampInfoSet(const TFieldInfo2TimeStampInfoSet& theFieldInfo2TimeStampInfoSet)
{
TEntite2TFieldInfo2TimeStampInfoSet anEntite2TFieldInfo2TimeStampInfoSet;
for(; anIter != theFieldInfo2TimeStampInfoSet.end(); anIter++){
const TTimeStampInfoSet& aTimeStampInfoSet = anIter->second;
//const PFieldInfo& aFieldInfo = anIter->first;
- if(aTimeStampInfoSet.empty())
+ if(aTimeStampInfoSet.empty())
continue;
const PTimeStampInfo& aTimeStampInfo = *aTimeStampInfoSet.begin();
anEntite2TFieldInfo2TimeStampInfoSet[ConvertEntity(aTimeStampInfo->GetEntity())].insert(*anIter);
}
return anEntite2TFieldInfo2TimeStampInfoSet;
}
-
//---------------------------------------------------------------
bool
return aLeftInfo->GetId() < aRightInfo->GetId();
}
-
//---------------------------------------------------------------
- TEntity2FamilySet
- GetEntity2FamilySet(const PWrapper& theWrapper,
+ TEntity2FamilySet
+ GetEntity2FamilySet(const PWrapper& theWrapper,
const TEntity2TGeom2ElemInfo& theEntity2TGeom2ElemInfo,
const TFamilyInfoSet& theFamilyInfoSet)
{
MSG(MYDEBUG,"GetFamiliesByEntity(...)");
TEntity2FamilySet anEntity2FamilySet;
-
+
typedef std::map<TInt,PFamilyInfo> TId2Family;
TId2Family anId2Family;
TFamilyInfoSet::const_iterator anIter = theFamilyInfoSet.begin();
const PFamilyInfo& aFamilyInfo = *anIter;
anId2Family.insert(TId2Family::value_type(aFamilyInfo->GetId(),aFamilyInfo));
}
-
+
if(!anId2Family.empty()){
typedef std::map<TInt,TInt> TFamilyID2Size;
typedef std::map<EEntiteMaillage,TFamilyID2Size> TEntity2FamilyID;
TEntity2FamilyID anEntity2FamilyID;
-
+
if(!theEntity2TGeom2ElemInfo.empty()){
TEntity2TGeom2ElemInfo::const_iterator anIter = theEntity2TGeom2ElemInfo.begin();
for(; anIter != theEntity2TGeom2ElemInfo.end(); anIter++){
}
}
}
-
+
if(!anEntity2FamilyID.empty()){
TEntity2FamilyID::const_iterator anIter = anEntity2FamilyID.begin();
for(; anIter != anEntity2FamilyID.end(); anIter++){
}
}
}
- }
+ }
ADDMSG(MYDEBUG,"\n");
return anEntity2FamilySet;
}
-
//---------------------------------------------------------------
TKey2Gauss
- GetKey2Gauss(const PWrapper& theWrapper,
+ GetKey2Gauss(const PWrapper& theWrapper,
TErr* theErr,
EModeSwitch theMode)
{
return aKey2Gauss;
}
-
//---------------------------------------------------------------
PProfileInfo
- GetProfileInfo(const PWrapper& theWrapper,
+ GetProfileInfo(const PWrapper& theWrapper,
const std::string& theProfileName,
TErr* theErr,
EModeProfil theMode)
}
return anInfo;
}
-
//---------------------------------------------------------------
TMKey2Profile
- GetMKey2Profile(const PWrapper& theWrapper,
+ GetMKey2Profile(const PWrapper& theWrapper,
TErr* theErr,
EModeProfil theMode)
{
PProfileInfo anInfo = theWrapper->GetPProfileInfo(anId,theMode,theErr);
const std::string& aName = boost::get<0>(aPreInfo);
aKey2Profile[aName] = anInfo;
-
+
#ifdef _DEBUG_
INITMSG(MYDEBUG,
"- aName = '"<<aName<<"'"<<
}
ADDMSG(MYVALUEDEBUG, std::endl);
#endif
-
+
}
return TMKey2Profile(theMode,aKey2Profile);
}
//---------------------------------------------------------------
EEntiteMaillage
- GetEntityByFamilyId(PGrilleInfo& theInfo,TInt theId){
+ GetEntityByFamilyId(PGrilleInfo& theInfo,
+ TInt theId)
+ {
TElemNum::iterator aNodeFamIter = (theInfo->myFamNumNode).begin();
for(;aNodeFamIter != (theInfo->myFamNumNode).end(); aNodeFamIter++){
if(theId == *aNodeFamIter)
return EEntiteMaillage(-1);
}
+ //---------------------------------------------------------------
TFamilyID2NbCells
- GetFamilyID2NbCells(PGrilleInfo& theInfo){
+ GetFamilyID2NbCells(PGrilleInfo& theInfo)
+ {
TFamilyID2NbCells aFamily2NbCells;
TInt aNbNodes = theInfo->myFamNumNode.size();
TInt aNbCells = theInfo->myFamNum.size();
return aFamily2NbCells;
}
- EEntiteMaillage ConvertEntity(const EEntiteMaillage& aEntity){
+ //---------------------------------------------------------------
+ EEntiteMaillage
+ ConvertEntity(const EEntiteMaillage& aEntity)
+ {
switch( aEntity ){
-
case eNOEUD_ELEMENT:
- case eMAILLE: return eMAILLE; //eNOEUD_ELEMENT it is eMAILLE
-
+ case eMAILLE:
+ return eMAILLE; // eNOEUD_ELEMENT is eMAILLE
case eFACE:
case eARETE:
- case eNOEUD: return aEntity; break;
- default: return EEntiteMaillage(-1);
-
+ case eNOEUD:
+ return aEntity;
+ default:
+ break;
}
+ return EEntiteMaillage(-1);
}
}
#include "MED_WrapperDef.hxx"
#include "MED_Structures.hxx"
+#include <boost/tuple/tuple.hpp>
+
#include <set>
#include <string>
typedef std::map<TProfileInfo::TKey,PProfileInfo> TKey2Profile;
typedef boost::tuple<EModeProfil,TKey2Profile> TMKey2Profile;
typedef std::map<TInt,TInt> TFamilyID2NbCells;
-
+
//---------------------------------------------------------------
//! Get set of TElemInfo by its geometrical type and corresponding MED ENTITY
MEDWRAPPER_EXPORT
TEntity2TGeom2ElemInfo
- GetEntity2TGeom2ElemInfo(const PWrapper& theWrapper,
+ GetEntity2TGeom2ElemInfo(const PWrapper& theWrapper,
const PMeshInfo& theMeshInfo,
const MED::TEntityInfo& theEntityInfo);
//! Read set of MED FAMILIES for defined MED file
MEDWRAPPER_EXPORT
TFamilyInfoSet
- GetFamilyInfoSet(const PWrapper& theWrapper,
+ GetFamilyInfoSet(const PWrapper& theWrapper,
const PMeshInfo& theMeshInfo);
//---------------------------------------------------------------
//! Split set of MED FAMILIES by corresponding MED ENTITY
MEDWRAPPER_EXPORT
TEntity2FamilySet
- GetEntity2FamilySet(const PWrapper& theWrapper,
+ GetEntity2FamilySet(const PWrapper& theWrapper,
const TEntity2TGeom2ElemInfo& theEntity2TGeom2ElemInfo,
const TFamilyInfoSet& theFamilyInfoSet);
MEDWRAPPER_EXPORT
TGroupInfo
GetGroupInfo(const TFamilyInfoSet& theFamilyInfoSet);
-
+
//---------------------------------------------------------------
//! Read set of MED TIMESTAMPS groupped by corresponding MED FIELDS
MEDWRAPPER_EXPORT
TFieldInfo2TimeStampInfoSet
- GetFieldInfo2TimeStampInfoSet(const PWrapper& theWrapper,
+ GetFieldInfo2TimeStampInfoSet(const PWrapper& theWrapper,
const PMeshInfo& theMeshInfo,
const MED::TEntityInfo& theEntityInfo);
-
+
//---------------------------------------------------------------
//! Split the input set of MED TIMESTAMPS by corresponding MED FIELDS and MED ENTITIES
MEDWRAPPER_EXPORT
//! Read set of MED GAUSS
MEDWRAPPER_EXPORT
TKey2Gauss
- GetKey2Gauss(const PWrapper& theWrapper,
+ GetKey2Gauss(const PWrapper& theWrapper,
TErr* theErr = NULL,
EModeSwitch theMode = eFULL_INTERLACE);
//! Get MED PROFILE by its name
MEDWRAPPER_EXPORT
PProfileInfo
- GetProfileInfo(const PWrapper& theWrapper,
+ GetProfileInfo(const PWrapper& theWrapper,
const std::string& theProfileName,
TErr* theErr = NULL,
EModeProfil theMode = eCOMPACT);
//! Read set of MED PROFILES
MEDWRAPPER_EXPORT
TMKey2Profile
- GetMKey2Profile(const PWrapper& theWrapper,
+ GetMKey2Profile(const PWrapper& theWrapper,
TErr* theErr = NULL,
EModeProfil theMode = eCOMPACT);
--- /dev/null
+// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
+//
+// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// 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
+//
+
+#include "MED_Common.hxx"
+#include <med.h>
+
+namespace MED
+{
+ TInt
+ GetDESCLength()
+ {
+ return 200;
+ }
+
+ TInt
+ GetIDENTLength()
+ {
+ return 8;
+ }
+
+ TInt
+ GetNOMLength()
+ {
+ return 64;
+ }
+
+ TInt
+ GetLNOMLength()
+ {
+ return 80;
+ }
+
+ TInt
+ GetPNOMLength()
+ {
+ return 16;
+ }
+
+ void
+ GetVersionRelease(TInt& major, TInt& minor, TInt& release)
+ {
+ major = MED_MAJOR_NUM;
+ minor = MED_MINOR_NUM;
+ release = MED_RELEASE_NUM;
+ }
+
+ TInt
+ GetNbConn(EGeometrieElement typmai,
+ EEntiteMaillage typent,
+ TInt mdim)
+ {
+ return typmai % 100;
+ }
+
+ TInt
+ GetNbNodes(EGeometrieElement typmai)
+ {
+ return typmai % 100;
+ }
+
+ const MED::TEntity2GeomSet& GetEntity2GeomSet()
+ {
+ static MED::TEntity2GeomSet Entity2GeomSet;
+
+ if ( Entity2GeomSet.empty() ) {
+ TGeomSet& aGeomARETESet = Entity2GeomSet[MED::eARETE];
+ aGeomARETESet.insert(MED::eSEG2);
+ aGeomARETESet.insert(MED::eSEG3);
+
+ TGeomSet& aGeomFACESet = Entity2GeomSet[MED::eFACE];
+ aGeomFACESet.insert(MED::eTRIA3);
+ aGeomFACESet.insert(MED::eQUAD4);
+ aGeomFACESet.insert(MED::eTRIA6);
+ aGeomFACESet.insert(MED::eTRIA7);
+ aGeomFACESet.insert(MED::eQUAD8);
+ aGeomFACESet.insert(MED::eQUAD9);
+ aGeomFACESet.insert(MED::ePOLYGONE);
+ aGeomFACESet.insert(MED::ePOLYGON2);
+
+ TGeomSet& aGeomMAILLESet = Entity2GeomSet[MED::eMAILLE];
+ aGeomMAILLESet.insert(MED::ePOINT1);
+ aGeomMAILLESet.insert(aGeomARETESet.begin(), aGeomARETESet.end());
+ aGeomMAILLESet.insert(aGeomFACESet.begin(), aGeomFACESet.end());
+ aGeomMAILLESet.insert(MED::eTETRA4);
+ aGeomMAILLESet.insert(MED::ePYRA5);
+ aGeomMAILLESet.insert(MED::ePENTA6);
+ aGeomMAILLESet.insert(MED::eHEXA8);
+ aGeomMAILLESet.insert(MED::eOCTA12);
+ aGeomMAILLESet.insert(MED::eTETRA10);
+ aGeomMAILLESet.insert(MED::ePYRA13);
+ aGeomMAILLESet.insert(MED::ePENTA15);
+ aGeomMAILLESet.insert(MED::eHEXA20);
+ aGeomMAILLESet.insert(MED::eHEXA27);
+ aGeomMAILLESet.insert(MED::ePOLYEDRE);
+
+ /* This combination allows reading nb of models of structure elements */
+ Entity2GeomSet[MED::eSTRUCT_ELEMENT].insert(MED::eAllGeoType);
+ }
+
+ return Entity2GeomSet;
+ }
+}
#include "MED_WrapperDef.hxx"
#include "MED_Vector.hxx"
#include "MED_SharedPtr.hxx"
-#include "MED_SliceArray.hxx"
#include <string>
#include <set>
#include <hdf5.h>
-#include <boost/tuple/tuple.hpp>
-
#ifdef WIN32
#pragma warning(disable:4099)
#endif
namespace MED
{
- typedef enum {eFAUX, eVRAI} EBooleen ;
+ typedef enum {eFAUX, eVRAI} EBooleen;
typedef double TFloat;
#if defined(HAVE_F77INT64)
typedef long TInt;
#else
typedef int TInt;
-#endif
+#endif
typedef hid_t TIdt;
typedef herr_t TErr;
typedef enum {eFULL_INTERLACE, eNO_INTERLACE} EModeSwitch;
- typedef enum {eFLOAT64=6, eINT=24, eLONG=26 } ETypeChamp;
+ typedef enum {eFLOAT64=6, eINT=24, eLONG=26} ETypeChamp;
typedef enum {eNON_STRUCTURE, eSTRUCTURE} EMaillage;
- typedef enum {eCART, eCYL, eSPHER} ERepere;
+ typedef enum {eCART, eCYL, eSPHER} ERepere;
- typedef enum {eNOD, eDESC} EConnectivite ;
+ typedef enum {eNOD, eDESC} EConnectivite;
typedef enum {ePOINT1=1, eSEG2=102, eSEG3=103, eTRIA3=203,
- eQUAD4=204, eTRIA6=206, eTRIA7=207, eQUAD8=208, eQUAD9=209,eTETRA4=304,
- ePYRA5=305, ePENTA6=306, eHEXA8=308, eOCTA12=312, eTETRA10=310,
+ eQUAD4=204, eTRIA6=206, eTRIA7=207, eQUAD8=208, eQUAD9=209, eTETRA4=304,
+ ePYRA5=305, ePENTA6=306, eHEXA8=308, eOCTA12=312, eTETRA10=310,
ePYRA13=313, ePENTA15=315, eHEXA20=320, eHEXA27=327,
- ePOLYGONE=400, ePOLYGON2=420, ePOLYEDRE=500, eNONE=0,
- eBALL=1101 /*no such a type in med.h, it's just a trick*/,
- eAllGeoType=-1 } EGeometrieElement;
+ ePOLYGONE=400, ePOLYGON2=420, ePOLYEDRE=500, eNONE=0,
+ eBALL=1101, // no such a type in med.h, it's just a trick
+ eAllGeoType=-1} EGeometrieElement;
- typedef enum {eMAILLE, eFACE, eARETE, eNOEUD, eNOEUD_ELEMENT, eSTRUCT_ELEMENT} EEntiteMaillage;
+ typedef enum {eMAILLE, eFACE, eARETE, eNOEUD, eNOEUD_ELEMENT, eSTRUCT_ELEMENT} EEntiteMaillage;
- typedef enum {eNO_PFLMOD, eGLOBAL, eCOMPACT} EModeProfil;
+ typedef enum {eNO_PFLMOD, eGLOBAL, eCOMPACT} EModeProfil;
typedef enum {eGRILLE_CARTESIENNE, eGRILLE_POLAIRE, eGRILLE_STANDARD} EGrilleType;
typedef enum {eCOOR, eCONN, eNOM, eNUM, eFAM, eCOOR_IND1, eCOOR_IND2, eCOOR_IND3} ETable;
+ typedef TVector<TInt> TIntVector;
typedef TVector<TFloat> TFloatVector;
typedef TVector<std::string> TStringVector;
- typedef TVector<TInt> TIntVector;
typedef std::set<std::string> TStringSet;
-
+
typedef std::map<EGeometrieElement,TInt> TGeom2Size;
typedef std::map<EEntiteMaillage,TGeom2Size> TEntityInfo;
typedef std::set<EGeometrieElement> TGeomSet;
typedef std::map<EEntiteMaillage,TGeomSet> TEntity2GeomSet;
- MEDWRAPPER_EXPORT
- const TEntity2GeomSet&
- GetEntity2GeomSet();
-
- TInt MEDWRAPPER_EXPORT
- GetDESCLength();
-
- TInt MEDWRAPPER_EXPORT
- GetIDENTLength();
-
- TInt MEDWRAPPER_EXPORT
- GetNOMLength();
-
- TInt MEDWRAPPER_EXPORT
- GetLNOMLength();
-
- TInt MEDWRAPPER_EXPORT
- GetPNOMLength();
-
- void MEDWRAPPER_EXPORT
- GetVersionRelease(TInt& majeur, TInt& mineur, TInt& release);
-
- MEDWRAPPER_EXPORT
- TInt
- GetNbConn(EGeometrieElement typmai,
- EEntiteMaillage typent,
- TInt mdim);
-
- MEDWRAPPER_EXPORT
- TInt
- GetNbNodes(EGeometrieElement typmai);
-
struct TNameInfo;
typedef SharedPtr<TNameInfo> PNameInfo;
-
+
struct TMeshInfo;
typedef SharedPtr<TMeshInfo> PMeshInfo;
-
+
struct TFamilyInfo;
typedef SharedPtr<TFamilyInfo> PFamilyInfo;
struct TProfileInfo;
typedef SharedPtr<TProfileInfo> PProfileInfo;
-
+
struct TGaussInfo;
typedef SharedPtr<TGaussInfo> PGaussInfo;
-
+
class TGrilleInfo;
typedef SharedPtr<TGrilleInfo> PGrilleInfo;
struct TWrapper;
typedef SharedPtr<TWrapper> PWrapper;
+
+ MEDWRAPPER_EXPORT
+ TInt
+ GetDESCLength();
+
+ MEDWRAPPER_EXPORT
+ TInt
+ GetIDENTLength();
+
+ MEDWRAPPER_EXPORT
+ TInt
+ GetNOMLength();
+
+ MEDWRAPPER_EXPORT
+ TInt
+ GetLNOMLength();
+
+ MEDWRAPPER_EXPORT
+ TInt
+ GetPNOMLength();
+
+ MEDWRAPPER_EXPORT
+ void
+ GetVersionRelease(TInt&, TInt&, TInt&);
+
+ MEDWRAPPER_EXPORT
+ TInt
+ GetNbConn(EGeometrieElement, EEntiteMaillage, TInt);
+
+ MEDWRAPPER_EXPORT
+ TInt
+ GetNbNodes(EGeometrieElement typmai);
+
+ MEDWRAPPER_EXPORT
+ const TEntity2GeomSet&
+ GetEntity2GeomSet();
}
#endif // MED_Common_HeaderFile
#include "MED_CoordUtils.hxx"
#include "MED_Utilities.hxx"
-
+
namespace MED
{
enum ECoordName{eX, eY, eZ, eNone};
template<ECoordName TCoordId>
- TFloat
+ TFloat
GetCoord(const TCCoordSlice& theCoordSlice)
{
return theCoordSlice[TCoordId];
}
template<>
- TFloat
+ TFloat
GetCoord<eNone>(const TCCoordSlice& theCoordSlice)
{
return 0.0;
}
-
+
TGetCoord
aXYZGetCoord[3] = {
- &GetCoord<eX>,
- &GetCoord<eY>,
+ &GetCoord<eX>,
+ &GetCoord<eY>,
&GetCoord<eZ>
};
-
+
TGetCoord
aXYGetCoord[3] = {
- &GetCoord<eX>,
- &GetCoord<eY>,
+ &GetCoord<eX>,
+ &GetCoord<eY>,
&GetCoord<eNone>
};
-
+
TGetCoord
aYZGetCoord[3] = {
&GetCoord<eNone>,
- &GetCoord<eX>,
+ &GetCoord<eX>,
&GetCoord<eY>
};
-
- TGetCoord
+
+ TGetCoord
aXZGetCoord[3] = {
- &GetCoord<eX>,
+ &GetCoord<eX>,
&GetCoord<eNone>,
&GetCoord<eY>
};
-
-
- TGetCoord
+
+ TGetCoord
aXGetCoord[3] = {
- &GetCoord<eX>,
+ &GetCoord<eX>,
&GetCoord<eNone>,
&GetCoord<eNone>
};
-
+
TGetCoord
aYGetCoord[3] = {
&GetCoord<eNone>,
- &GetCoord<eX>,
+ &GetCoord<eX>,
&GetCoord<eNone>
};
&GetCoord<eX>
};
-
//---------------------------------------------------------------
TCoordHelper
::TCoordHelper(TGetCoord* theGetCoord):
myGetCoord(theGetCoord)
{}
- TFloat
+ TFloat
TCoordHelper
- ::GetCoord(TCCoordSlice& theCoordSlice,
+ ::GetCoord(TCCoordSlice& theCoordSlice,
TInt theCoordId)
{
return (*myGetCoord[theCoordId])(theCoordSlice);
}
-
//---------------------------------------------------------------
PCoordHelper
GetCoordHelper(PNodeInfo theNodeInfo)
class MEDWRAPPER_EXPORT TCoordHelper
{
TGetCoord* myGetCoord;
-
+
public:
TCoordHelper(TGetCoord* theGetCoord);
- TFloat
- GetCoord(TCCoordSlice& theCoordSlice,
+ TFloat
+ GetCoord(TCCoordSlice& theCoordSlice,
TInt theCoordId);
};
typedef SharedPtr<TCoordHelper> PCoordHelper;
//---------------------------------------------------------------
- MEDWRAPPER_EXPORT
+ MEDWRAPPER_EXPORT
PCoordHelper
GetCoordHelper(PNodeInfo theNodeInfo);
}
#include "MED_Factory.hxx"
#include "MED_Utilities.hxx"
-#include "MED_V2_2_Wrapper.hxx"
+#include "MED_Wrapper.hxx"
#include <stdio.h>
#include <errno.h>
PWrapper CrWrapperR(const std::string& fileName)
{
- PWrapper aWrapper;
if (!CheckCompatibility(fileName)) {
EXCEPTION(std::runtime_error, "Cannot open file '"<<fileName<<"'.");
}
- else {
- aWrapper = new MED::V2_2::TVWrapper(fileName);
- }
- return aWrapper;
+ return new MED::TWrapper(fileName);
}
PWrapper CrWrapperW(const std::string& fileName)
{
if (!CheckCompatibility(fileName))
remove(fileName.c_str());
- return new MED::V2_2::TVWrapper(fileName);
+ return new MED::TWrapper(fileName);
}
}
MEDWRAPPER_EXPORT
bool GetMEDVersion( const std::string&, int&, int&, int& );
-
+
MEDWRAPPER_EXPORT
bool CheckCompatibility( const std::string& );
-
+
MEDWRAPPER_EXPORT
PWrapper CrWrapperR( const std::string& );
namespace MED
{
- using namespace MED;
//---------------------------------------------------------------
void TGaussDef::add(const double x, const double weight)
aShapeFun.myRefCoord.end() );
}
-
//---------------------------------------------------------------
/*!
* \brief Fill definition of gauss points family
const double P1 = 1./1.8;
const double P2 = 1./1.125;
add( -a, P1 );
- add( 0, P2 );
+ add( 0, P2 );
add( a, P1 ); break;
}
case 4: {
const double P1 = 0.652145154862546, P2 = 0.347854845137454 ;
add( a, P1 );
add( -a, P1 );
- add( b, P2 );
+ add( b, P2 );
add( -b, P2 ); break;
}
default:
case 6: { // FPG6
const double P1 = 0.11169079483905, P2 = 0.0549758718227661;
const double a = 0.445948490915965, b = 0.091576213509771;
- add( b, b, P2 );
+ add( b, b, P2 );
add( 1-2*b, b, P2 );
add( b, 1-2*b, P2 );
add( a, 1-2*a, P1 );
- add( a, a, P1 );
+ add( a, a, P1 );
add( 1-2*a, a, P1 ); break;
}
case 7: { // FPG7
const double B = 0.101286507323456;
const double P1 = 0.066197076394253;
const double P2 = 0.062969590272413;
- add( 1/3., 1/3., 9/80. );
- add( A, A, P1 );
+ add( 1/3., 1/3., 9/80. );
+ add( A, A, P1 );
add( 1-2*A, A, P1 );
add( A, 1-2*A, P1 );
- add( B, B, P2 );
+ add( B, B, P2 );
add( 1-2*B, B, P2 );
add( B, 1-2*B, P2 ); break;
}
const double P1 = 0.025422453185103;
const double P2 = 0.058393137863189;
const double P3 = 0.041425537809187;
- add( A, A, P1 );
+ add( A, A, P1 );
add( 1-2*A, A, P1 );
add( A, 1-2*A, P1 );
- add( B, B, P2 );
+ add( B, B, P2 );
add( 1-2*B, B, P2 );
add( B, 1-2*B, P2 );
add( C, D, P3 );
case 6: {
const double P1 = 0.11169079483905, P2 = 0.0549758718227661;
const double A = 0.445948490915965, B = 0.091576213509771;
- add( 2*B-1, 1-4*B, 4*P2 );
+ add( 2*B-1, 1-4*B, 4*P2 );
add( 2*B-1, 2*B-1, 4*P2 );
add( 1-4*B, 2*B-1, 4*P2 );
add( 1-4*A, 2*A-1, 4*P1 );
- add( 2*A-1, 1-4*A, 4*P1 );
+ add( 2*A-1, 1-4*A, 4*P1 );
add( 2*A-1, 2*A-1, 4*P1 ); break;
}
default:
add( 0., 0., h3, p3 ); break;
}
case 27: { // FPG27
- const double a1 = 0.788073483;
- const double b6 = 0.499369002;
- const double b1 = 0.848418011;
- const double c8 = 0.478508449;
- const double c1 = 0.652816472;
- const double d12 = 0.032303742;
+ const double a1 = 0.788073483;
+ const double b6 = 0.499369002;
+ const double b1 = 0.848418011;
+ const double c8 = 0.478508449;
+ const double c1 = 0.652816472;
+ const double d12 = 0.032303742;
const double d1 = 1.106412899;
double z = 1/2., fz = b1/2*(1 - z);
add( 0., 0., z, a1 ); // 1
* \param geomType - element geometry (EGeometrieElement or med_geometrie_element)
* \param nbPoints - nb gauss point
* \param variant - [1-3] to choose the variant of definition
- *
+ *
* Throws in case of invalid parameters
- * variant == 1 refers to "Fonctions de forme et points d'integration
+ * variant == 1 refers to "Fonctions de forme et points d'integration
* des elements finis" v7.4 by J. PELLET, X. DESROCHES, 15/09/05
* variant == 2 refers to the same doc v6.4 by J.P. LEFEBVRE, X. DESROCHES, 03/07/03
* variant == 3 refers to the same doc v6.4, second variant for 2D elements
#include "MED_GaussUtils.hxx"
#include "MED_Utilities.hxx"
-
+
#ifdef _DEBUG_
static int MYDEBUG = 0;
static int MYVALUEDEBUG = 0;
#else
-// static int MYDEBUG = 0;
-// static int MYVALUEDEBUG = 0;
+static int MYDEBUG = 0;
+static int MYVALUEDEBUG = 0;
#endif
namespace MED
myGaussCoord.resize(theNbElem*myGaussStep);
}
-
TInt
TGaussCoord
::GetNbElem() const
- {
- return myNbElem;
+ {
+ return myNbElem;
}
-
+
TInt
TGaussCoord
::GetNbGauss() const
- {
- return myNbGauss;
+ {
+ return myNbGauss;
}
-
+
TInt
TGaussCoord
::GetDim() const
- {
- return myDim;
+ {
+ return myDim;
}
-
+
unsigned char*
TGaussCoord
::GetValuePtr()
return (unsigned char*)&(myGaussCoord[0]);
}
-
- TCCoordSliceArr
+ TCCoordSliceArr
TGaussCoord
::GetCoordSliceArr(TInt theElemId) const
{
return aCoordSliceArr;
}
-
- TCoordSliceArr
+ TCoordSliceArr
TGaussCoord
::GetCoordSliceArr(TInt theElemId)
{
return aCoordSliceArr;
}
-
//---------------------------------------------------------------
inline
- bool
+ bool
IsEqual(TFloat theLeft, TFloat theRight)
{
static TFloat EPS = 1.0E-3;
return true;
}
-
//---------------------------------------------------------------
class TShapeFun::TFun
{
myNbRef = theNbRef;
}
- TCFloatVecSlice
+ TCFloatVecSlice
GetFunSlice(TInt theGaussId) const
{
return TCFloatVecSlice(myFun,std::slice(theGaussId*myNbRef,myNbRef,1));
myNbRef(theNbRef)
{}
- TCCoordSlice
+ TCCoordSlice
TShapeFun::GetCoord(TInt theRefId) const
{
return TCCoordSlice(myRefCoord,std::slice(theRefId*myDim,myDim,1));
return TCoordSlice(myRefCoord,std::slice(theRefId*myDim,myDim,1));
}
- void
+ void
TShapeFun::GetFun(const TCCoordSliceArr& theRef,
const TCCoordSliceArr& theGauss,
TFun& theFun) const
theFun.Init(aNbGauss,aNbRef);
}
- bool
+ bool
TShapeFun::IsSatisfy(const TCCoordSliceArr& theRefCoord) const
{
TInt aNbRef = theRefCoord.size();
TCFloatVecSlice aFunSlice = aFun.GetFunSlice(aGaussId);
for(TInt aConnId = 0; aConnId < aConnDim; aConnId++){
- TInt aNodeId = aConnSlice[aConnId] - 1;
+ TInt aNodeId = aConnSlice[aConnId] - 1;
TCCoordSlice aNodeCoordSlice = theNodeInfo.GetCoordSlice(aNodeId);
for(TInt aDimId = 0; aDimId < aDim; aDimId++){
return false;
}
-
//---------------------------------------------------------------
TSeg2a::TSeg2a():TShapeFun(1,2)
{
}
}
-
//---------------------------------------------------------------
TSeg3a::TSeg3a():TShapeFun(1,3)
{
}
}
-
-
//---------------------------------------------------------------
TTria3a::TTria3a():
TShapeFun(2,3)
}
}
-
-
//---------------------------------------------------------------
TTria6a::TTria6a():TShapeFun(2,6)
{
}
}
-
-
//---------------------------------------------------------------
TTria3b::TTria3b():
TShapeFun(2,3)
}
}
-
-
//---------------------------------------------------------------
TTria6b::TTria6b():
TShapeFun(2,6)
}
}
-
-
//---------------------------------------------------------------
TQuad4a::TQuad4a():
TShapeFun(2,4)
}
}
-
-
//---------------------------------------------------------------
TQuad8a::TQuad8a():
TShapeFun(2,8)
}
}
-
-
//---------------------------------------------------------------
TQuad9a::TQuad9a():
TShapeFun(2,9)
}
}
-
-
//---------------------------------------------------------------
TQuad4b::TQuad4b():
TShapeFun(2,4)
}
}
-
-
//---------------------------------------------------------------
TQuad8b::TQuad8b():
TShapeFun(2,8)
}
}
-
-
//---------------------------------------------------------------
TQuad9b::TQuad9b():
TShapeFun(2,9)
}
}
-
-
//---------------------------------------------------------------
TTetra4a::TTetra4a():
TShapeFun(3,4)
}
}
-
-
//---------------------------------------------------------------
TTetra10a::TTetra10a():
TShapeFun(3,10)
}
}
-
-
//---------------------------------------------------------------
-
TTetra4b::TTetra4b():
TShapeFun(3,4)
{
}
}
-
-
//---------------------------------------------------------------
TTetra10b::TTetra10b():
TShapeFun(3,10)
}
}
-
-
//---------------------------------------------------------------
THexa8a::THexa8a():
TShapeFun(3,8)
}
}
-
//---------------------------------------------------------------
THexa20a::THexa20a(TInt theDim, TInt theNbRef):
TShapeFun(theDim,theNbRef)
}
}
-
-
//---------------------------------------------------------------
THexa27a::THexa27a():
THexa20a(3,27)
}
}
-
-
//---------------------------------------------------------------
THexa8b::THexa8b():
TShapeFun(3,8)
}
}
-
-
//---------------------------------------------------------------
THexa20b::THexa20b(TInt theDim, TInt theNbRef):
TShapeFun(theDim,theNbRef)
}
}
-
-
//---------------------------------------------------------------
TPenta6a::TPenta6a():
TShapeFun(3,6)
}
}
-
-
//---------------------------------------------------------------
TPenta6b::TPenta6b():
TShapeFun(3,6)
}
}
-
-
//---------------------------------------------------------------
TPenta15a::TPenta15a():
TShapeFun(3,15)
}
}
-
-
//---------------------------------------------------------------
TPenta15b::TPenta15b():
TShapeFun(3,15)
}
}
-
-
//---------------------------------------------------------------
TPyra5a::TPyra5a():
TShapeFun(3,5)
}
}
-
-
//---------------------------------------------------------------
TPyra5b::TPyra5b():
TShapeFun(3,5)
TInt aNbRef = myRefCoord.size();
for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
TCoordSlice aCoord = GetCoord(aRefId);
- switch(aRefId){
+ switch(aRefId){
case 0: aCoord[0] = 1.0; aCoord[1] = 0.0; aCoord[2] = 0.0; break;
case 3: aCoord[0] = 0.0; aCoord[1] = 1.0; aCoord[2] = 0.0; break;
case 2: aCoord[0] = -1.0; aCoord[1] = 0.0; aCoord[2] = 0.0; break;
TFun& theFun) const
{
GetFun(theRef,theGauss,theFun);
-
+
TInt aNbGauss = theGauss.size();
for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){
const TCCoordSlice& aCoord = theGauss[aGaussId];
aSlice[4] = aCoord[2];
}
}
-
-
//---------------------------------------------------------------
TPyra13a::TPyra13a():
}
}
-
-
//---------------------------------------------------------------
TPyra13b::TPyra13b():
TShapeFun(3,13)
}
}
-
-
//---------------------------------------------------------------
bool
- GetGaussCoord3D(const TGaussInfo& theGaussInfo,
+ GetGaussCoord3D(const TGaussInfo& theGaussInfo,
const TCellInfo& theCellInfo,
const TNodeInfo& theNodeInfo,
TGaussCoord& theGaussCoord,
break;
}
- default:
+ default:
INITMSG(MYDEBUG,"eNONE"<<std::endl);
return false;
}
TCoordSlice& aGaussCoordSlice = aCoordSliceArr[aGaussId];
for(TInt aConnId = 0; aConnId < aConnDim; aConnId++){
- TInt aNodeId = aConnSlice[aConnId] - 1;
+ TInt aNodeId = aConnSlice[aConnId] - 1;
TCCoordSlice aNodeCoordSlice = theNodeInfo.GetCoordSlice(aNodeId);
for(TInt aDimId = 0; aDimId < aDim; aDimId++){
return true;
}
-
//---------------------------------------------------------------
bool
GetBaryCenter(const TPolygoneInfo& thePolygoneInfo,
TCoordSlice& aGaussCoordSlice = aCoordSliceArr[aGaussId];
for(TInt aConnId = 0; aConnId < aNbConn; aConnId++){
- TInt aNodeId = aConnSlice[aConnId] - 1;
+ TInt aNodeId = aConnSlice[aConnId] - 1;
TCCoordSlice aNodeCoordSlice = theNodeInfo.GetCoordSlice(aNodeId);
for(TInt aDimId = 0; aDimId < aDim; aDimId++){
return true;
}
-
//---------------------------------------------------------------
bool
GetBaryCenter(const TPolyedreInfo& thePolyedreInfo,
TCConnSlice aConnSlice = aConnSliceArr[aFaceId];
TInt aNbConn = aConnSlice.size();
for(TInt aConnId = 0; aConnId < aNbConn; aConnId++){
- TInt aNodeId = aConnSlice[aConnId] - 1;
+ TInt aNodeId = aConnSlice[aConnId] - 1;
TCCoordSlice aNodeCoordSlice = theNodeInfo.GetCoordSlice(aNodeId);
for(TInt aDimId = 0; aDimId < aDim; aDimId++){
//! Define a helper class to handle Gauss Points coordinates
class MEDWRAPPER_EXPORT TGaussCoord:
- virtual TModeSwitchInfo
+ virtual TModeSwitchInfo
{
TInt myNbElem;
TInt myNbGauss;
TNodeCoord myGaussCoord;
public:
-
+
TGaussCoord();
//! To init the class
GetCoordSliceArr(TInt theElemId) const;
//! Get slice of the coordinate that corresponds to defined cell
- TCoordSliceArr
+ TCoordSliceArr
GetCoordSliceArr(TInt theElemId);
};
typedef SharedPtr<TGaussCoord> PGaussCoord;
-
//---------------------------------------------------------------
//! To calculate Gauss Points coordinates
- MEDWRAPPER_EXPORT
+ MEDWRAPPER_EXPORT
bool
- GetGaussCoord3D(const TGaussInfo& theGaussInfo,
+ GetGaussCoord3D(const TGaussInfo& theGaussInfo,
const TCellInfo& theCellInfo,
const TNodeInfo& theNodeInfo,
TGaussCoord& theGaussCoord,
const TElemNum& theElemNum = TElemNum(),
EModeSwitch theMode = eFULL_INTERLACE);
-
//---------------------------------------------------------------
//! To calculate Gauss Points coordinates for defined TCellInfo as its bary center
- MEDWRAPPER_EXPORT
+ MEDWRAPPER_EXPORT
bool
GetBaryCenter(const TCellInfo& theCellInfo,
const TNodeInfo& theNodeInfo,
EModeSwitch theMode = eFULL_INTERLACE);
//! To calculate Gauss Points coordinates for defined TPolygoneInfo as its bary center
- MEDWRAPPER_EXPORT
+ MEDWRAPPER_EXPORT
bool
GetBaryCenter(const TPolygoneInfo& thePolygoneInfo,
const TNodeInfo& theNodeInfo,
EModeSwitch theMode = eFULL_INTERLACE);
//! To calculate Gauss Points coordinates for defined TPolyedreInfo as its bary center
- MEDWRAPPER_EXPORT
+ MEDWRAPPER_EXPORT
bool
GetBaryCenter(const TPolyedreInfo& thePolyedreInfo,
const TNodeInfo& theNodeInfo,
struct MEDWRAPPER_EXPORT TShapeFun
{
class TFun;
-
+
TFloatVector myRefCoord;
TInt myDim;
TInt myNbRef;
void GetFun(const TCCoordSliceArr& theRef,
const TCCoordSliceArr& theGauss,
TFun& theFun) const;
- virtual
+ virtual
void InitFun(const TCCoordSliceArr& theRef,
const TCCoordSliceArr& theGauss,
TFun& theFun) const = 0;
//! To extend the boost::shared_ptr to support such features automatic dynamic cast
/*!
All entities of the MEDWrapper package are handled as pointer.
- This class was introduced to provide correct and flexible memory management
+ This class was introduced to provide correct and flexible memory management
for all of the MEDWrapper objects.
*/
template<class T> class SharedPtr: public boost::shared_ptr<T>
//! Construct the class by any type of a pointer
template<class Y>
- explicit SharedPtr(Y * p):
- boost::shared_ptr<T>(p)
+ explicit SharedPtr(Y * p):
+ boost::shared_ptr<T>(p)
{}
//! Construct the class by any specialisation of the class
//! Copy-constructor
template<class Y>
- SharedPtr&
+ SharedPtr&
operator=(SharedPtr<Y> const & r)
{
SharedPtr<T>(r).swap(*this);
}
//! Introduce a flexible way to reset the wrapped pointer
- template<class Y>
- SharedPtr&
+ template<class Y>
+ SharedPtr&
operator()(Y * p) // Y must be complete
{
return operator=<Y>(SharedPtr<Y>(p));
}
//! Introduce a flexible way to reset the wrapped pointer
- template<class Y>
- SharedPtr&
+ template<class Y>
+ SharedPtr&
operator()(SharedPtr<Y> const & r) // Y must be complete
{
return operator=<Y>(SharedPtr<Y>(r));
}
//! To provide a flexible way to use reference to the wrapped pointer (const version)
- operator const T& () const
- {
+ operator const T& () const
+ {
return *(this->get());
}
//! To provide a flexible way to use reference to the wrapped pointer
- operator T& ()
- {
+ operator T& ()
+ {
return *(this->get());
}
};
{
//---------------------------------------------------------------
//! This class intends to provide an uniform way to handle multy-dimention data (const version)
- /*!
+ /*!
It just contains pointer to real sequence and implement proper calcultion of its indexes.
This class deal with constant pointer to the sources data and provide const method to
read the them (data).
*/
- template<class TValueType>
+ template<class TValueType>
class TCSlice
{
const TValueType* myCValuePtr; //!< Reference to source multy-dimension data
{
return mySlice.start() + theId*mySlice.stride();
}
-
+
size_t
get_id(size_t theId) const
{
#endif
return calculate_id(theId);
}
-
+
size_t
get_id_at(size_t theId) const
{
//! Construct the class from bare pointer
TCSlice(const value_type* theValuePtr,
size_t theSourceSize,
- const std::slice& theSlice):
+ const std::slice& theSlice):
myCValuePtr(theValuePtr),
mySourceSize(theSourceSize),
mySlice(theSlice)
{}
-
+
//! Construct the class from corresponding container
TCSlice(const TVector<value_type>& theContainer,
- const std::slice& theSlice):
+ const std::slice& theSlice):
myCValuePtr(&theContainer[0]),
mySourceSize(theContainer.size()),
mySlice(theSlice)
{}
-
+
//! Default constructor (dangerous)
TCSlice():
myCValuePtr(NULL)
{}
//! Get element by its number (const version)
- const value_type&
+ const value_type&
operator[](size_t theId) const
{
return *(myCValuePtr + get_id(theId));
}
-
- const value_type&
+
+ const value_type&
at(size_t theId) const
{
return *(myCValuePtr + get_id_at(theId));
}
-
+
//! Get range of the order numbers
size_t
size() const
return mySlice.size();
}
};
-
//---------------------------------------------------------------
//! This class extend TCSlice functionality for non-constant case
- template<class TValueType>
+ template<class TValueType>
class TSlice: public TCSlice<TValueType>
{
TValueType* myValuePtr;
-
+
public:
typedef TValueType value_type;
typedef TCSlice<TValueType> TSupperClass;
//! Construct the class from bare pointer
TSlice(value_type* theValuePtr,
size_t theSourceSize,
- const std::slice& theSlice):
+ const std::slice& theSlice):
TSupperClass(theValuePtr, theSourceSize, theSlice),
myValuePtr(theValuePtr)
{}
-
+
//! Construct the class from corresponding container
TSlice(TVector<value_type>& theContainer,
- const std::slice& theSlice):
+ const std::slice& theSlice):
TSupperClass(theContainer, theSlice),
myValuePtr(&theContainer[0])
{}
-
+
//! Default constructor (dangerous)
TSlice():
myValuePtr(NULL)
{}
//! Get element by its number
- value_type&
+ value_type&
operator[](size_t theId)
{
return *(myValuePtr + this->get_id(theId));
}
- value_type&
+ value_type&
at(size_t theId)
{
return *(myValuePtr + this->get_id_at(theId));
#include <cstring>
-using namespace MED;
-
namespace MED
{
- TInt
- GetNbNodes(EGeometrieElement typmai)
- {
- return typmai%100;
- }
-
- std::string
- GetString(TInt theId,
- TInt theStep,
+ std::string
+ GetString(TInt theId,
+ TInt theStep,
const TString& theString)
{
const char* aPos = &theString[theId*theStep];
return std::string(aPos,aSize);
}
- void
- SetString(TInt theId,
- TInt theStep,
- TString& theString,
+ void
+ SetString(TInt theId,
+ TInt theStep,
+ TString& theString,
const std::string& theValue)
{
TInt aSize = std::min(TInt(theValue.size()+1),theStep);
strncpy(aPos,theValue.c_str(),aSize);
}
- void
- SetString(TInt theId,
- TInt theStep,
- TString& theString,
+ void
+ SetString(TInt theId,
+ TInt theStep,
+ TString& theString,
const TString& theValue)
{
TInt aSize = std::min(TInt(theValue.size()+1),theStep);
{
return theTimeStampValue;
}
-}
-
-//---------------------------------------------------------------
-TInt
-TFamilyInfo
-::GetAttrId(TInt theId) const
-{
- return myAttrId[theId];
-}
-
-TInt
-TFamilyInfo
-::GetAttrVal(TInt theId) const
-{
- return myAttrVal[theId];
-}
-void
-TFamilyInfo
-::SetAttrId(TInt theId,TInt theVal)
-{
- myAttrId[theId] = theVal;
-}
+ //---------------------------------------------------------------
+ TInt
+ TFamilyInfo
+ ::GetAttrId(TInt theId) const
+ {
+ return myAttrId[theId];
+ }
-void
-TFamilyInfo
-::SetAttrVal(TInt theId,TInt theVal)
-{
- myAttrVal[theId] = theVal;
-}
+ TInt
+ TFamilyInfo
+ ::GetAttrVal(TInt theId) const
+ {
+ return myAttrVal[theId];
+ }
-//---------------------------------------------------------------
-TInt
-TElemInfo
-::GetFamNum(TInt theId) const
-{
- return (*myFamNum)[theId];
-}
+ void
+ TFamilyInfo
+ ::SetAttrId(TInt theId,TInt theVal)
+ {
+ myAttrId[theId] = theVal;
+ }
-void
-TElemInfo
-::SetFamNum(TInt theId, TInt theVal)
-{
- (*myFamNum)[theId] = theVal;
- myIsFamNum = eVRAI;
-}
+ void
+ TFamilyInfo
+ ::SetAttrVal(TInt theId,TInt theVal)
+ {
+ myAttrVal[theId] = theVal;
+ }
-TInt
-TElemInfo
-::GetElemNum(TInt theId) const
-{
- return (*myElemNum)[theId];
-}
+ //---------------------------------------------------------------
+ TInt
+ TElemInfo
+ ::GetFamNum(TInt theId) const
+ {
+ return (*myFamNum)[theId];
+ }
-void
-TElemInfo
-::SetElemNum(TInt theId, TInt theVal)
-{
- (*myElemNum)[theId] = theVal;
-}
+ void
+ TElemInfo
+ ::SetFamNum(TInt theId, TInt theVal)
+ {
+ (*myFamNum)[theId] = theVal;
+ myIsFamNum = eVRAI;
+ }
-//---------------------------------------------------------------
-TCCoordSlice
-TNodeInfo
-::GetCoordSlice(TInt theId) const
-{
- TInt aDim = myMeshInfo->GetSpaceDim();
- if(GetModeSwitch() == eFULL_INTERLACE)
- return TCCoordSlice(*myCoord, std::slice(theId*aDim, aDim, 1));
- else
- return TCCoordSlice(*myCoord, std::slice(theId, aDim, aDim));
-}
+ TInt
+ TElemInfo
+ ::GetElemNum(TInt theId) const
+ {
+ return (*myElemNum)[theId];
+ }
-TCoordSlice
-TNodeInfo
-::GetCoordSlice(TInt theId)
-{
- TInt aDim = myMeshInfo->GetSpaceDim();
- if(GetModeSwitch() == eFULL_INTERLACE)
- return TCoordSlice(*myCoord, std::slice(theId*aDim,aDim,1));
- else
- return TCoordSlice(*myCoord, std::slice(theId,aDim,aDim));
-}
+ void
+ TElemInfo
+ ::SetElemNum(TInt theId, TInt theVal)
+ {
+ (*myElemNum)[theId] = theVal;
+ }
-//---------------------------------------------------------------
-TCConnSlice
-TCellInfo
-::GetConnSlice(TInt theElemId) const
-{
- if(GetModeSwitch() == eFULL_INTERLACE)
- return TCConnSlice(*myConn, std::slice(GetConnDim()*theElemId, GetNbNodes(myGeom), 1));
- else
- return TCConnSlice(*myConn, std::slice(theElemId, GetNbNodes(myGeom), GetConnDim()));
-}
+ //---------------------------------------------------------------
+ TCCoordSlice
+ TNodeInfo
+ ::GetCoordSlice(TInt theId) const
+ {
+ TInt aDim = myMeshInfo->GetSpaceDim();
+ if(GetModeSwitch() == eFULL_INTERLACE)
+ return TCCoordSlice(*myCoord, std::slice(theId*aDim, aDim, 1));
+ else
+ return TCCoordSlice(*myCoord, std::slice(theId, aDim, aDim));
+ }
-TConnSlice
-TCellInfo
-::GetConnSlice(TInt theElemId)
-{
- if(GetModeSwitch() == eFULL_INTERLACE)
- return TConnSlice(*myConn, std::slice(GetConnDim()*theElemId, GetNbNodes(myGeom), 1));
- else
- return TConnSlice(*myConn, std::slice(theElemId, GetNbNodes(myGeom), GetConnDim()));
-}
+ TCoordSlice
+ TNodeInfo
+ ::GetCoordSlice(TInt theId)
+ {
+ TInt aDim = myMeshInfo->GetSpaceDim();
+ if(GetModeSwitch() == eFULL_INTERLACE)
+ return TCoordSlice(*myCoord, std::slice(theId*aDim,aDim,1));
+ else
+ return TCoordSlice(*myCoord, std::slice(theId,aDim,aDim));
+ }
+ //---------------------------------------------------------------
+ TCConnSlice
+ TCellInfo
+ ::GetConnSlice(TInt theElemId) const
+ {
+ if(GetModeSwitch() == eFULL_INTERLACE)
+ return TCConnSlice(*myConn, std::slice(GetConnDim()*theElemId, GetNbNodes(myGeom), 1));
+ else
+ return TCConnSlice(*myConn, std::slice(theElemId, GetNbNodes(myGeom), GetConnDim()));
+ }
-//---------------------------------------------------------------
-TInt
-TPolygoneInfo
-::GetNbConn(TInt theElemId) const
-{
- return (*myIndex)[theElemId + 1] - (*myIndex)[theElemId];
-}
+ TConnSlice
+ TCellInfo
+ ::GetConnSlice(TInt theElemId)
+ {
+ if(GetModeSwitch() == eFULL_INTERLACE)
+ return TConnSlice(*myConn, std::slice(GetConnDim()*theElemId, GetNbNodes(myGeom), 1));
+ else
+ return TConnSlice(*myConn, std::slice(theElemId, GetNbNodes(myGeom), GetConnDim()));
+ }
-TCConnSlice
-TPolygoneInfo
-::GetConnSlice(TInt theElemId) const
-{
- return TCConnSlice(*myConn, std::slice((*myIndex)[theElemId] - 1, GetNbConn(theElemId), 1));
-}
+ //---------------------------------------------------------------
+ TInt
+ TPolygoneInfo
+ ::GetNbConn(TInt theElemId) const
+ {
+ return (*myIndex)[theElemId + 1] - (*myIndex)[theElemId];
+ }
-TConnSlice
-TPolygoneInfo
-::GetConnSlice(TInt theElemId)
-{
- return TConnSlice(*myConn, std::slice((*myIndex)[theElemId] - 1, GetNbConn(theElemId), 1));
-}
+ TCConnSlice
+ TPolygoneInfo
+ ::GetConnSlice(TInt theElemId) const
+ {
+ return TCConnSlice(*myConn, std::slice((*myIndex)[theElemId] - 1, GetNbConn(theElemId), 1));
+ }
+ TConnSlice
+ TPolygoneInfo
+ ::GetConnSlice(TInt theElemId)
+ {
+ return TConnSlice(*myConn, std::slice((*myIndex)[theElemId] - 1, GetNbConn(theElemId), 1));
+ }
-//---------------------------------------------------------------
-TInt
-TPolyedreInfo
-::GetNbFaces(TInt theElemId) const
-{
- return (*myIndex)[theElemId+1] - (*myIndex)[theElemId];
-}
+ //---------------------------------------------------------------
+ TInt
+ TPolyedreInfo
+ ::GetNbFaces(TInt theElemId) const
+ {
+ return (*myIndex)[theElemId+1] - (*myIndex)[theElemId];
+ }
-TInt
-TPolyedreInfo
-::GetNbNodes(TInt theElemId) const
-{
- TInt aNbNodes = 0;
- TInt aNbFaces = GetNbFaces(theElemId);
- TInt aStartFaceId = (*myIndex)[theElemId] - 1;
- for(TInt aFaceId = 0; aFaceId < aNbFaces; aFaceId++, aStartFaceId++){
- TInt aCurrentId = (*myFaces)[aStartFaceId];
- TInt aDiff = (*myFaces)[aStartFaceId + 1] - aCurrentId;
- aNbNodes += aDiff;
- }
- return aNbNodes;
-}
+ TInt
+ TPolyedreInfo
+ ::GetNbNodes(TInt theElemId) const
+ {
+ TInt aNbNodes = 0;
+ TInt aNbFaces = GetNbFaces(theElemId);
+ TInt aStartFaceId = (*myIndex)[theElemId] - 1;
+ for(TInt aFaceId = 0; aFaceId < aNbFaces; aFaceId++, aStartFaceId++){
+ TInt aCurrentId = (*myFaces)[aStartFaceId];
+ TInt aDiff = (*myFaces)[aStartFaceId + 1] - aCurrentId;
+ aNbNodes += aDiff;
+ }
+ return aNbNodes;
+ }
-TCConnSliceArr
-TPolyedreInfo
-::GetConnSliceArr(TInt theElemId) const
-{
- TInt aNbFaces = GetNbFaces(theElemId);
- TCConnSliceArr aConnSliceArr(aNbFaces);
- TInt aStartFaceId = (*myIndex)[theElemId] - 1;
- for(TInt aFaceId = 0; aFaceId < aNbFaces; aFaceId++, aStartFaceId++){
- TInt aCurrentId = (*myFaces)[aStartFaceId];
- TInt aDiff = (*myFaces)[aStartFaceId + 1] - aCurrentId;
- aConnSliceArr[aFaceId] =
- TCConnSlice(*myConn, std::slice(aCurrentId - 1, aDiff, 1));
- }
- return aConnSliceArr;
-}
+ TCConnSliceArr
+ TPolyedreInfo
+ ::GetConnSliceArr(TInt theElemId) const
+ {
+ TInt aNbFaces = GetNbFaces(theElemId);
+ TCConnSliceArr aConnSliceArr(aNbFaces);
+ TInt aStartFaceId = (*myIndex)[theElemId] - 1;
+ for(TInt aFaceId = 0; aFaceId < aNbFaces; aFaceId++, aStartFaceId++){
+ TInt aCurrentId = (*myFaces)[aStartFaceId];
+ TInt aDiff = (*myFaces)[aStartFaceId + 1] - aCurrentId;
+ aConnSliceArr[aFaceId] =
+ TCConnSlice(*myConn, std::slice(aCurrentId - 1, aDiff, 1));
+ }
+ return aConnSliceArr;
+ }
-TConnSliceArr
-TPolyedreInfo
-::GetConnSliceArr(TInt theElemId)
-{
- TInt aNbFaces = GetNbFaces(theElemId);
- TConnSliceArr aConnSliceArr(aNbFaces);
- TInt aStartFaceId = (*myIndex)[theElemId] - 1;
- for(TInt aFaceId = 0; aFaceId < aNbFaces; aFaceId++, aStartFaceId++){
- TInt aCurrentId = (*myFaces)[aStartFaceId];
- TInt aDiff = (*myFaces)[aStartFaceId + 1] - aCurrentId;
- aConnSliceArr[aFaceId] =
- TConnSlice(*myConn, std::slice(aCurrentId - 1, aDiff, 1));
- }
- return aConnSliceArr;
-}
+ TConnSliceArr
+ TPolyedreInfo
+ ::GetConnSliceArr(TInt theElemId)
+ {
+ TInt aNbFaces = GetNbFaces(theElemId);
+ TConnSliceArr aConnSliceArr(aNbFaces);
+ TInt aStartFaceId = (*myIndex)[theElemId] - 1;
+ for(TInt aFaceId = 0; aFaceId < aNbFaces; aFaceId++, aStartFaceId++){
+ TInt aCurrentId = (*myFaces)[aStartFaceId];
+ TInt aDiff = (*myFaces)[aStartFaceId + 1] - aCurrentId;
+ aConnSliceArr[aFaceId] =
+ TConnSlice(*myConn, std::slice(aCurrentId - 1, aDiff, 1));
+ }
+ return aConnSliceArr;
+ }
+ //---------------------------------------------------------------
+ TMeshValueBase
+ ::TMeshValueBase():
+ myNbElem(0),
+ myNbComp(0),
+ myNbGauss(0),
+ myStep(0)
+ {}
+
+ void
+ TMeshValueBase
+ ::Allocate(TInt theNbElem,
+ TInt theNbGauss,
+ TInt theNbComp,
+ EModeSwitch theMode)
+ {
+ myModeSwitch = theMode;
-//---------------------------------------------------------------
-TMeshValueBase
-::TMeshValueBase():
- myNbElem(0),
- myNbComp(0),
- myNbGauss(0),
- myStep(0)
-{}
-
-void
-TMeshValueBase
-::Allocate(TInt theNbElem,
- TInt theNbGauss,
- TInt theNbComp,
- EModeSwitch theMode)
-{
- myModeSwitch = theMode;
-
- myNbElem = theNbElem;
- myNbGauss = theNbGauss;
- myNbComp = theNbComp;
-
- myStep = theNbComp*theNbGauss;
-}
+ myNbElem = theNbElem;
+ myNbGauss = theNbGauss;
+ myNbComp = theNbComp;
-size_t
-TMeshValueBase
-::GetSize() const
-{
- return myNbElem * myStep;
-}
-
-size_t
-TMeshValueBase
-::GetNbVal() const
-{
- return myNbElem * myNbGauss;
-}
+ myStep = theNbComp*theNbGauss;
+ }
-size_t
-TMeshValueBase
-::GetNbGauss() const
-{
- return myNbGauss;
-}
+ size_t
+ TMeshValueBase
+ ::GetSize() const
+ {
+ return myNbElem * myStep;
+ }
-size_t
-TMeshValueBase
-::GetStep() const
-{
- return myStep;
-}
+ size_t
+ TMeshValueBase
+ ::GetNbVal() const
+ {
+ return myNbElem * myNbGauss;
+ }
+ size_t
+ TMeshValueBase
+ ::GetNbGauss() const
+ {
+ return myNbGauss;
+ }
-//---------------------------------------------------------------
-TInt
-TProfileInfo
-::GetElemNum(TInt theId) const
-{
- return (*myElemNum)[theId];
-}
+ size_t
+ TMeshValueBase
+ ::GetStep() const
+ {
+ return myStep;
+ }
-void
-TProfileInfo
-::SetElemNum(TInt theId,TInt theVal)
-{
- (*myElemNum)[theId] = theVal;
-}
+ //---------------------------------------------------------------
+ TInt
+ TProfileInfo
+ ::GetElemNum(TInt theId) const
+ {
+ return (*myElemNum)[theId];
+ }
-//---------------------------------------------------------------
-bool
-TGaussInfo::TLess
-::operator()(const TKey& theLeft, const TKey& theRight) const
-{
- EGeometrieElement aLGeom = boost::get<0>(theLeft);
- EGeometrieElement aRGeom = boost::get<0>(theRight);
- if(aLGeom != aRGeom)
- return aLGeom < aRGeom;
-
- const std::string& aLStr = boost::get<1>(theLeft);
- const std::string& aRStr = boost::get<1>(theRight);
- return aLStr < aRStr;
-}
+ void
+ TProfileInfo
+ ::SetElemNum(TInt theId,TInt theVal)
+ {
+ (*myElemNum)[theId] = theVal;
+ }
-bool
-TGaussInfo::TLess
-::operator()(const TGaussInfo& theLeft, const TGaussInfo& theRight) const
-{
- if(!&theLeft)
- return true;
+ //---------------------------------------------------------------
+ bool
+ TGaussInfo::TLess
+ ::operator()(const TKey& theLeft, const TKey& theRight) const
+ {
+ EGeometrieElement aLGeom = boost::get<0>(theLeft);
+ EGeometrieElement aRGeom = boost::get<0>(theRight);
+ if(aLGeom != aRGeom)
+ return aLGeom < aRGeom;
+
+ const std::string& aLStr = boost::get<1>(theLeft);
+ const std::string& aRStr = boost::get<1>(theRight);
+ return aLStr < aRStr;
+ }
- if(!&theRight)
- return false;
+ bool
+ TGaussInfo::TLess
+ ::operator()(const TGaussInfo& theLeft, const TGaussInfo& theRight) const
+ {
+ if(!&theLeft)
+ return true;
- if(theLeft.myGeom != theRight.myGeom)
- return theLeft.myGeom < theRight.myGeom;
+ if(!&theRight)
+ return false;
- if(theLeft.myRefCoord != theRight.myRefCoord)
- return theLeft.myRefCoord < theRight.myRefCoord;
+ if(theLeft.myGeom != theRight.myGeom)
+ return theLeft.myGeom < theRight.myGeom;
- return theLeft.myGaussCoord < theRight.myGaussCoord;
-}
+ if(theLeft.myRefCoord != theRight.myRefCoord)
+ return theLeft.myRefCoord < theRight.myRefCoord;
-TCCoordSlice
-TGaussInfo
-::GetRefCoordSlice(TInt theId) const
-{
- if(GetModeSwitch() == eFULL_INTERLACE)
- return TCCoordSlice(myRefCoord,std::slice(theId*GetDim(),GetDim(),1));
- else
- return TCCoordSlice(myRefCoord,std::slice(theId,GetDim(),GetDim()));
-}
+ return theLeft.myGaussCoord < theRight.myGaussCoord;
+ }
-TCoordSlice
-TGaussInfo
-::GetRefCoordSlice(TInt theId)
-{
- if(GetModeSwitch() == eFULL_INTERLACE)
- return TCoordSlice(myRefCoord,std::slice(theId*GetDim(),GetDim(),1));
- else
- return TCoordSlice(myRefCoord,std::slice(theId,GetDim(),GetDim()));
-}
+ TCCoordSlice
+ TGaussInfo
+ ::GetRefCoordSlice(TInt theId) const
+ {
+ if(GetModeSwitch() == eFULL_INTERLACE)
+ return TCCoordSlice(myRefCoord,std::slice(theId*GetDim(),GetDim(),1));
+ else
+ return TCCoordSlice(myRefCoord,std::slice(theId,GetDim(),GetDim()));
+ }
-TCCoordSlice
-TGaussInfo
-::GetGaussCoordSlice(TInt theId) const
-{
- if(GetModeSwitch() == eFULL_INTERLACE)
- return TCCoordSlice(myGaussCoord,std::slice(theId*GetDim(),GetDim(),1));
- else
- return TCCoordSlice(myGaussCoord,std::slice(theId,GetDim(),GetDim()));
-}
+ TCoordSlice
+ TGaussInfo
+ ::GetRefCoordSlice(TInt theId)
+ {
+ if(GetModeSwitch() == eFULL_INTERLACE)
+ return TCoordSlice(myRefCoord,std::slice(theId*GetDim(),GetDim(),1));
+ else
+ return TCoordSlice(myRefCoord,std::slice(theId,GetDim(),GetDim()));
+ }
-TCoordSlice
-TGaussInfo
-::GetGaussCoordSlice(TInt theId)
-{
- if(GetModeSwitch() == eFULL_INTERLACE)
- return TCoordSlice(myGaussCoord,std::slice(theId*GetDim(),GetNbGauss(),1));
- else
- return TCoordSlice(myGaussCoord,std::slice(theId,GetNbGauss(),GetDim()));
-}
+ TCCoordSlice
+ TGaussInfo
+ ::GetGaussCoordSlice(TInt theId) const
+ {
+ if(GetModeSwitch() == eFULL_INTERLACE)
+ return TCCoordSlice(myGaussCoord,std::slice(theId*GetDim(),GetDim(),1));
+ else
+ return TCCoordSlice(myGaussCoord,std::slice(theId,GetDim(),GetDim()));
+ }
+ TCoordSlice
+ TGaussInfo
+ ::GetGaussCoordSlice(TInt theId)
+ {
+ if(GetModeSwitch() == eFULL_INTERLACE)
+ return TCoordSlice(myGaussCoord,std::slice(theId*GetDim(),GetNbGauss(),1));
+ else
+ return TCoordSlice(myGaussCoord,std::slice(theId,GetNbGauss(),GetDim()));
+ }
-//---------------------------------------------------------------
-TInt
-TTimeStampInfo
-::GetNbGauss(EGeometrieElement theGeom) const
-{
- TGeom2NbGauss::const_iterator anIter = myGeom2NbGauss.find(theGeom);
- if(anIter == myGeom2NbGauss.end())
- return 1;//EXCEPTION(runtime_error,"TTimeStampInfo::GetNbGauss - myGeom2NbGauss.find(theGeom) fails");
+ //---------------------------------------------------------------
+ TInt
+ TTimeStampInfo
+ ::GetNbGauss(EGeometrieElement theGeom) const
+ {
+ TGeom2NbGauss::const_iterator anIter = myGeom2NbGauss.find(theGeom);
+ if(anIter == myGeom2NbGauss.end())
+ return 1;//EXCEPTION(runtime_error,"TTimeStampInfo::GetNbGauss - myGeom2NbGauss.find(theGeom) fails");
- return anIter->second;
-}
+ return anIter->second;
+ }
+ //---------------------------------------------------------------
+ // TGrilleInfo structure methods
+ //---------------------------------------------------------------
+ const EGrilleType&
+ TGrilleInfo
+ ::GetGrilleType() const
+ {
+ return myGrilleType;
+ }
-//---------------------------------------------------------------
-// TGrilleInfo structure methods
-//---------------------------------------------------------------
-const EGrilleType&
-TGrilleInfo
-::GetGrilleType() const
-{
- return myGrilleType;
-}
+ EGrilleType
+ TGrilleInfo
+ ::GetGrilleType()
+ {
+ return myGrilleType;
+ }
-EGrilleType
-TGrilleInfo
-::GetGrilleType()
-{
- return myGrilleType;
-}
+ void
+ TGrilleInfo
+ ::SetGrilleType(EGrilleType theGrilleType)
+ {
+ myGrilleType = theGrilleType;
+ }
-void
-TGrilleInfo
-::SetGrilleType(EGrilleType theGrilleType)
-{
- myGrilleType = theGrilleType;
-}
+ const
+ TIndexes&
+ TGrilleInfo
+ ::GetMapOfIndexes() const
+ {
+ return myIndixes;
+ }
-const
-TIndexes&
-TGrilleInfo
-::GetMapOfIndexes() const
-{
- return myIndixes;
-}
+ TIndexes&
+ TGrilleInfo
+ ::GetMapOfIndexes()
+ {
+ return myIndixes;
+ }
-TIndexes&
-TGrilleInfo
-::GetMapOfIndexes()
-{
- return myIndixes;
-}
+ const
+ TFloatVector&
+ TGrilleInfo
+ ::GetIndexes(TInt theAxisNumber) const
+ {
+ TIndexes::const_iterator aIter=myIndixes.find(theAxisNumber);
+ if(aIter==myIndixes.end())
+ EXCEPTION(std::runtime_error, "const TGrilleInfo::GetIndexes - myIndixes.find(theAxisNumber); fails");
+ return aIter->second;
+ }
-const
-TFloatVector&
-TGrilleInfo
-::GetIndexes(TInt theAxisNumber) const
-{
- TIndexes::const_iterator aIter=myIndixes.find(theAxisNumber);
- if(aIter==myIndixes.end())
- EXCEPTION(std::runtime_error, "const TGrilleInfo::GetIndexes - myIndixes.find(theAxisNumber); fails");
- return aIter->second;
-}
+ TFloatVector&
+ TGrilleInfo
+ ::GetIndexes(TInt theAxisNumber)
+ {
+ TIndexes::iterator aIter=myIndixes.find(theAxisNumber);
+ if(aIter==myIndixes.end())
+ EXCEPTION(std::runtime_error, "TGrilleInfo::GetIndexes - myIndixes.find(theAxisNumber="<<theAxisNumber<<"); fails");
+ return aIter->second;
+ }
-TFloatVector&
-TGrilleInfo
-::GetIndexes(TInt theAxisNumber)
-{
- TIndexes::iterator aIter=myIndixes.find(theAxisNumber);
- if(aIter==myIndixes.end())
- EXCEPTION(std::runtime_error, "TGrilleInfo::GetIndexes - myIndixes.find(theAxisNumber="<<theAxisNumber<<"); fails");
- return aIter->second;
-}
+ TInt
+ TGrilleInfo
+ ::GetNbIndexes(TInt theAxisNumber)
+ {
+ const TFloatVector& aVector=GetIndexes(theAxisNumber);
+ return aVector.size();
+ }
-TInt
-TGrilleInfo
-::GetNbIndexes(TInt theAxisNumber)
-{
- const TFloatVector& aVector=GetIndexes(theAxisNumber);
- return aVector.size();
-}
+ TInt
+ TGrilleInfo
+ ::GetNbNodes()
+ {
+ TInt nbNodes=0;
+ TInt aDim = myMeshInfo->GetDim();
+ for(int i=0;i<aDim;i++)
+ if(nbNodes == 0)
+ nbNodes = this->GetGrilleStructure()[i];
+ else
+ nbNodes = nbNodes*this->GetGrilleStructure()[i];
+
+ return nbNodes;
+ }
-TInt
-TGrilleInfo
-::GetNbNodes()
-{
- TInt nbNodes=0;
- TInt aDim = myMeshInfo->GetDim();
- for(int i=0;i<aDim;i++)
- if(nbNodes == 0)
- nbNodes = this->GetGrilleStructure()[i];
- else
- nbNodes = nbNodes*this->GetGrilleStructure()[i];
-
- return nbNodes;
-}
+ TInt
+ TGrilleInfo
+ ::GetNbCells()
+ {
+ TInt nbCells=0;
+ TInt aDim = myMeshInfo->GetDim();
+ for(int i=0;i<aDim;i++)
+ if(nbCells == 0)
+ nbCells = this->GetGrilleStructure()[i]-1;
+ else
+ nbCells = nbCells*(this->GetGrilleStructure()[i]-1);
+ return nbCells;
+ }
-TInt
-TGrilleInfo
-::GetNbCells()
-{
- TInt nbCells=0;
- TInt aDim = myMeshInfo->GetDim();
- for(int i=0;i<aDim;i++)
- if(nbCells == 0)
- nbCells = this->GetGrilleStructure()[i]-1;
- else
- nbCells = nbCells*(this->GetGrilleStructure()[i]-1);
- return nbCells;
-}
+ TInt
+ TGrilleInfo
+ ::GetNbSubCells()
+ {
+ TInt nb=0;
+ TInt aDim = myMeshInfo->GetDim();
+ switch (aDim) {
+ case 3:
+ nb =
+ (myGrilleStructure[0] ) * (myGrilleStructure[1]-1) * (myGrilleStructure[2]-1) +
+ (myGrilleStructure[0]-1) * (myGrilleStructure[1] ) * (myGrilleStructure[2]-1) +
+ (myGrilleStructure[0]-1) * (myGrilleStructure[1]-1) * (myGrilleStructure[2] );
+ break;
+ case 2:
+ nb =
+ (myGrilleStructure[0] ) * (myGrilleStructure[1]-1) +
+ (myGrilleStructure[0]-1) * (myGrilleStructure[1] );
+ break;
+ }
+ return nb;
+ }
-TInt
-TGrilleInfo
-::GetNbSubCells()
-{
- TInt nb=0;
- TInt aDim = myMeshInfo->GetDim();
- switch (aDim) {
- case 3:
- nb =
- (myGrilleStructure[0] ) * (myGrilleStructure[1]-1) * (myGrilleStructure[2]-1) +
- (myGrilleStructure[0]-1) * (myGrilleStructure[1] ) * (myGrilleStructure[2]-1) +
- (myGrilleStructure[0]-1) * (myGrilleStructure[1]-1) * (myGrilleStructure[2] );
- break;
- case 2:
- nb =
- (myGrilleStructure[0] ) * (myGrilleStructure[1]-1) +
- (myGrilleStructure[0]-1) * (myGrilleStructure[1] );
- break;
- }
- return nb;
-}
+ EGeometrieElement
+ TGrilleInfo
+ ::GetGeom()
+ {
+ TInt aDim = myMeshInfo->GetDim();
+ switch(aDim){
+ case 1:
+ return eSEG2;
+ case 2:
+ return eQUAD4;
+ case 3:
+ return eHEXA8;
+ default:
+ return eNONE;
+ }
+ }
-EGeometrieElement
-TGrilleInfo
-::GetGeom()
-{
- TInt aDim = myMeshInfo->GetDim();
- switch(aDim){
- case 1:
- return eSEG2;
- case 2:
- return eQUAD4;
- case 3:
- return eHEXA8;
- default:
+ EGeometrieElement
+ TGrilleInfo
+ ::GetSubGeom()
+ {
+ TInt aDim = myMeshInfo->GetDim();
+ switch(aDim){
+ case 2:
+ return eSEG2;
+ case 3:
+ return eQUAD4;
+ }
return eNONE;
}
-}
-EGeometrieElement
-TGrilleInfo
-::GetSubGeom()
-{
- TInt aDim = myMeshInfo->GetDim();
- switch(aDim){
- case 2:
- return eSEG2;
- case 3:
- return eQUAD4;
- }
- return eNONE;
-}
+ EEntiteMaillage
+ TGrilleInfo
+ ::GetEntity()
+ {
+ return eMAILLE;
+ }
-EEntiteMaillage
-TGrilleInfo
-::GetEntity()
-{
- return eMAILLE;
-}
+ EEntiteMaillage
+ TGrilleInfo
+ ::GetSubEntity()
+ {
+ TInt aDim = myMeshInfo->GetDim();
+ switch(aDim){
+ case 2:
+ return eARETE;
+ case 3:
+ return eFACE;
+ }
+ return EEntiteMaillage(-1);
+ }
-EEntiteMaillage
-TGrilleInfo
-::GetSubEntity()
-{
- TInt aDim = myMeshInfo->GetDim();
- switch(aDim){
- case 2:
- return eARETE;
- case 3:
- return eFACE;
- }
- return EEntiteMaillage(-1);
-}
+ const
+ TIntVector&
+ TGrilleInfo
+ ::GetGrilleStructure() const
+ {
+ return myGrilleStructure;
+ }
-const
-TIntVector&
-TGrilleInfo
-::GetGrilleStructure() const
-{
- return myGrilleStructure;
-}
+ TIntVector
+ TGrilleInfo
+ ::GetGrilleStructure()
+ {
+ return myGrilleStructure;
+ }
-TIntVector
-TGrilleInfo
-::GetGrilleStructure()
-{
- return myGrilleStructure;
-}
+ void
+ TGrilleInfo
+ ::SetGrilleStructure(TInt theAxis,TInt theNb)
+ {
+ if(theAxis >= 0 && theAxis <=2 && theNb >= 0)
+ myGrilleStructure[theAxis]=theNb;
+ }
-void
-TGrilleInfo
-::SetGrilleStructure(TInt theAxis,TInt theNb)
-{
- if(theAxis >= 0 && theAxis <=2 && theNb >= 0)
- myGrilleStructure[theAxis]=theNb;
-}
+ const
+ TNodeCoord&
+ TGrilleInfo
+ ::GetNodeCoord() const
+ {
+ return myCoord;
+ }
-const
-TNodeCoord&
-TGrilleInfo
-::GetNodeCoord() const
-{
- return myCoord;
-}
+ TNodeCoord&
+ TGrilleInfo
+ ::GetNodeCoord()
+ {
+ return myCoord;
+ }
-TNodeCoord&
-TGrilleInfo
-::GetNodeCoord()
-{
- return myCoord;
-}
+ TNodeCoord
+ TGrilleInfo
+ ::GetCoord(TInt theId)
+ {
+ TNodeCoord aCoord;
+ TInt aDim = myMeshInfo->GetDim();
+ TInt aNbNodes = this->GetNbNodes();
+ aCoord.resize(aDim);
+
+ if(theId >= aNbNodes)
+ EXCEPTION(std::runtime_error, "TGrilleInfo::GetCoord - theId out of range");
+
+ if(myGrilleType == eGRILLE_STANDARD){
+ switch(aDim){
+ case 3:
+ aCoord[2] = myCoord[aDim*theId+2];
+ case 2:
+ aCoord[1] = myCoord[aDim*theId+1];
+ case 1:{
+ aCoord[0] = myCoord[aDim*theId];
+ break;
+ }
+ }
+ } else {
-TNodeCoord
-TGrilleInfo
-::GetCoord(TInt theId)
-{
- TNodeCoord aCoord;
- TInt aDim = myMeshInfo->GetDim();
- TInt aNbNodes = this->GetNbNodes();
- aCoord.resize(aDim);
-
- if(theId >= aNbNodes)
- EXCEPTION(std::runtime_error, "TGrilleInfo::GetCoord - theId out of range");
-
- if(myGrilleType == eGRILLE_STANDARD){
- switch(aDim){
- case 3:
- aCoord[2] = myCoord[aDim*theId+2];
- case 2:
- aCoord[1] = myCoord[aDim*theId+1];
- case 1:{
- aCoord[0] = myCoord[aDim*theId];
- break;
- }
- }
- } else {
+ TFloatVector aVecX = this->GetIndexes(0);
+ TInt nbIndxX = this->GetNbIndexes(0);
- TFloatVector aVecX = this->GetIndexes(0);
- TInt nbIndxX = this->GetNbIndexes(0);
-
- switch(aDim){
- case 1:{
- aCoord[0] = aVecX[theId];
- break;
- }
- case 2:{
- TFloatVector aVecY = this->GetIndexes(1);
- TInt i,j,k;
- i = j = k = 0;
- i = theId % nbIndxX;
- j = theId / nbIndxX;
- if(myGrilleType == eGRILLE_CARTESIENNE){
- aCoord[0] = aVecX[i];
- aCoord[1] = aVecY[j];
- } else { // eGRILLE_POLAIRE (cylindrical)
- aCoord[0] = aVecX[i] * cos(aVecY[j]);
- aCoord[1] = aVecX[i] * sin(aVecY[j]);
+ switch(aDim){
+ case 1:{
+ aCoord[0] = aVecX[theId];
+ break;
+ }
+ case 2:{
+ TFloatVector aVecY = this->GetIndexes(1);
+ TInt i,j,k;
+ i = j = k = 0;
+ i = theId % nbIndxX;
+ j = theId / nbIndxX;
+ if(myGrilleType == eGRILLE_CARTESIENNE){
+ aCoord[0] = aVecX[i];
+ aCoord[1] = aVecY[j];
+ } else { // eGRILLE_POLAIRE (cylindrical)
+ aCoord[0] = aVecX[i] * cos(aVecY[j]);
+ aCoord[1] = aVecX[i] * sin(aVecY[j]);
+ }
+ break;
+ }
+ case 3:{
+ TFloatVector aVecY = this->GetIndexes(1);
+ TInt nbIndxY = this->GetNbIndexes(1);
+ TFloatVector aVecZ = this->GetIndexes(2);
+ TInt i,j,k;
+ i = j = k = 0;
+
+ i = theId % nbIndxX;
+ j = (theId / nbIndxX) % nbIndxY;
+ k = theId / (nbIndxX*nbIndxY);
+
+ if(myGrilleType == eGRILLE_CARTESIENNE){
+ aCoord[0] = aVecX[i];
+ aCoord[1] = aVecY[j];
+ aCoord[2] = aVecZ[k];
+ } else { // eGRILLE_POLAIRE (cylindrical)
+ aCoord[0] = aVecX[i] * cos(aVecY[j]);
+ aCoord[1] = aVecX[i] * sin(aVecY[j]);
+ aCoord[2] = aVecZ[k];
+ }
+
+ break;
}
- break;
- }
- case 3:{
- TFloatVector aVecY = this->GetIndexes(1);
- TInt nbIndxY = this->GetNbIndexes(1);
- TFloatVector aVecZ = this->GetIndexes(2);
- TInt i,j,k;
- i = j = k = 0;
-
- i = theId % nbIndxX;
- j = (theId / nbIndxX) % nbIndxY;
- k = theId / (nbIndxX*nbIndxY);
-
- if(myGrilleType == eGRILLE_CARTESIENNE){
- aCoord[0] = aVecX[i];
- aCoord[1] = aVecY[j];
- aCoord[2] = aVecZ[k];
- } else { // eGRILLE_POLAIRE (cylindrical)
- aCoord[0] = aVecX[i] * cos(aVecY[j]);
- aCoord[1] = aVecX[i] * sin(aVecY[j]);
- aCoord[2] = aVecZ[k];
}
-
- break;
- }
}
+
+ return aCoord;
}
- return aCoord;
-}
+ TIntVector
+ TGrilleInfo
+ ::GetConn(TInt theId, const bool isSub)
+ {
+ TIntVector anIndexes;
+ TInt aDim = myMeshInfo->GetDim();
-TIntVector
-TGrilleInfo
-::GetConn(TInt theId, const bool isSub)
-{
- TIntVector anIndexes;
- TInt aDim = myMeshInfo->GetDim();
-
- TInt idx;
- TInt iMin, jMin, kMin, iMax, jMax, kMax;
- TInt loc[3];
-
- loc[0] = loc[1] = loc[2] = 0;
- iMin = iMax = jMin = jMax = kMin = kMax = 0;
-
- switch(aDim) {
- case 3:
- {
- TInt nbX = this->GetGrilleStructure()[0];
- TInt nbY = this->GetGrilleStructure()[1];
- TInt nbZ = this->GetGrilleStructure()[2];
- TInt d01 = nbX*nbY, dX = 1, dY = 1, dZ = 1;
- if ( isSub )
+ TInt idx;
+ TInt iMin, jMin, kMin, iMax, jMax, kMax;
+ TInt loc[3];
+
+ loc[0] = loc[1] = loc[2] = 0;
+ iMin = iMax = jMin = jMax = kMin = kMax = 0;
+
+ switch(aDim) {
+ case 3:
{
- if ( theId < nbX * (nbY-1) * (nbZ-1))
- { // face is normal to X axis
- dX = 0;
- }
- else if ( theId < nbX * (nbY-1) * (nbZ-1) + (nbX-1) * nbY * (nbZ-1))
- { // face is normal to Y axis
- theId -= nbX * (nbY-1) * (nbZ-1);
- dY = 0;
- }
- else
+ TInt nbX = this->GetGrilleStructure()[0];
+ TInt nbY = this->GetGrilleStructure()[1];
+ TInt nbZ = this->GetGrilleStructure()[2];
+ TInt d01 = nbX*nbY, dX = 1, dY = 1, dZ = 1;
+ if ( isSub )
+ {
+ if ( theId < nbX * (nbY-1) * (nbZ-1))
+ { // face is normal to X axis
+ dX = 0;
+ }
+ else if ( theId < nbX * (nbY-1) * (nbZ-1) + (nbX-1) * nbY * (nbZ-1))
+ { // face is normal to Y axis
+ theId -= nbX * (nbY-1) * (nbZ-1);
+ dY = 0;
+ }
+ else
+ {
+ theId -= nbX * (nbY-1) * (nbZ-1) + (nbX-1) * nbY * (nbZ-1);
+ dZ = 0;
+ }
+ }
+ //else
{
- theId -= nbX * (nbY-1) * (nbZ-1) + (nbX-1) * nbY * (nbZ-1);
- dZ = 0;
+ iMin = theId % (nbX - dX);
+ jMin = (theId / (nbX - dX)) % (nbY - dY);
+ kMin = theId / ((nbX - dX) * (nbY - dY));
+ iMax = iMin+dX;
+ jMax = jMin+dY;
+ kMax = kMin+dZ;
}
+ for (loc[2]=kMin; loc[2]<=kMax; loc[2]++)
+ for (loc[1]=jMin; loc[1]<=jMax; loc[1]++)
+ for (loc[0]=iMin; loc[0]<=iMax; loc[0]++)
+ {
+ idx = loc[0] + loc[1]*nbX + loc[2]*d01;
+ anIndexes.push_back(idx);
+ }
+ break;
}
- //else
+ case 2:
{
- iMin = theId % (nbX - dX);
- jMin = (theId / (nbX - dX)) % (nbY - dY);
- kMin = theId / ((nbX - dX) * (nbY - dY));
+ TInt nbX = this->GetGrilleStructure()[0];
+ TInt nbY = this->GetGrilleStructure()[1];
+ TInt dX = 1, dY = 1;
+ if ( isSub )
+ {
+ if ( theId < nbX * (nbY-1))
+ { // edge is normal to X axis
+ dX = 0;
+ }
+ else
+ {
+ theId -= nbX * (nbY-1);
+ dY = 0;
+ }
+ }
+ iMin = theId % (nbX-dX);
+ jMin = theId / (nbX-dX);
iMax = iMin+dX;
jMax = jMin+dY;
- kMax = kMin+dZ;
- }
- for (loc[2]=kMin; loc[2]<=kMax; loc[2]++)
for (loc[1]=jMin; loc[1]<=jMax; loc[1]++)
for (loc[0]=iMin; loc[0]<=iMax; loc[0]++)
+ {
+ idx = loc[0] + loc[1]*nbX;
+ anIndexes.push_back(idx);
+ }
+ break;
+ }
+ case 1:
+ {
+ iMin = theId;
+ for (loc[0]=iMin; loc[0]<=iMin+1; loc[0]++)
{
- idx = loc[0] + loc[1]*nbX + loc[2]*d01;
+ idx = loc[0];
anIndexes.push_back(idx);
}
- break;
- }
- case 2:
- {
- TInt nbX = this->GetGrilleStructure()[0];
- TInt nbY = this->GetGrilleStructure()[1];
- TInt dX = 1, dY = 1;
- if ( isSub )
- {
- if ( theId < nbX * (nbY-1))
- { // edge is normal to X axis
- dX = 0;
- }
- else
- {
- theId -= nbX * (nbY-1);
- dY = 0;
- }
- }
- iMin = theId % (nbX-dX);
- jMin = theId / (nbX-dX);
- iMax = iMin+dX;
- jMax = jMin+dY;
- for (loc[1]=jMin; loc[1]<=jMax; loc[1]++)
- for (loc[0]=iMin; loc[0]<=iMax; loc[0]++)
- {
- idx = loc[0] + loc[1]*nbX;
- anIndexes.push_back(idx);
- }
- break;
- }
- case 1:
- {
- iMin = theId;
- for (loc[0]=iMin; loc[0]<=iMin+1; loc[0]++)
- {
- idx = loc[0];
- anIndexes.push_back(idx);
+ break;
}
- break;
}
- }
- return anIndexes;
-}
+ return anIndexes;
+ }
-TInt
-TGrilleInfo
-::GetFamNumNode(TInt theId) const
-{
- return myFamNumNode[theId];
-}
+ TInt
+ TGrilleInfo
+ ::GetFamNumNode(TInt theId) const
+ {
+ return myFamNumNode[theId];
+ }
-void
-TGrilleInfo
-::SetFamNumNode(TInt theId,TInt theVal)
-{
- myFamNumNode[theId] = theVal;
-}
+ void
+ TGrilleInfo
+ ::SetFamNumNode(TInt theId,TInt theVal)
+ {
+ myFamNumNode[theId] = theVal;
+ }
-TInt
-TGrilleInfo
-::GetFamNum(TInt theId) const
-{
- return myFamNum[theId];
-}
+ TInt
+ TGrilleInfo
+ ::GetFamNum(TInt theId) const
+ {
+ return myFamNum[theId];
+ }
-void
-TGrilleInfo
-::SetFamNum(TInt theId,TInt theVal)
-{
- myFamNum[theId] = theVal;
-}
+ void
+ TGrilleInfo
+ ::SetFamNum(TInt theId,TInt theVal)
+ {
+ myFamNum[theId] = theVal;
+ }
-TInt
-TGrilleInfo
-::GetFamSubNum(TInt theId) const
-{
- return myFamSubNum[theId];
-}
+ TInt
+ TGrilleInfo
+ ::GetFamSubNum(TInt theId) const
+ {
+ return myFamSubNum[theId];
+ }
-void
-TGrilleInfo
-::SetFamSubNum(TInt theId,TInt theVal)
-{
- myFamSubNum[theId] = theVal;
+ void
+ TGrilleInfo
+ ::SetFamSubNum(TInt theId,TInt theVal)
+ {
+ myFamSubNum[theId] = theVal;
+ }
}
#include "MED_WrapperDef.hxx"
#include "MED_Common.hxx"
#include "MED_Utilities.hxx"
+#include "MED_SliceArray.hxx"
+
+#include <boost/tuple/tuple.hpp>
#ifdef WIN32
#pragma warning(disable:4251)
{
//---------------------------------------------------------------
//! Defines a type for managing sequence of strings
- typedef TVector<char> TString;
+ typedef TVector<char> TString;
typedef SharedPtr<TString> PString;
+ //---------------------------------------------------------------
//! Extract a substring from the sequence of the strings
MEDWRAPPER_EXPORT
- std::string
- GetString(TInt theId, TInt theStep,
+ std::string
+ GetString(TInt theId,
+ TInt theStep,
const TString& theString);
-
+
+ //---------------------------------------------------------------
//! Set a substring in the sequence of the strings
- MEDWRAPPER_EXPORT
+ MEDWRAPPER_EXPORT
void
- SetString(TInt theId, TInt theStep,
- TString& theString,
- const std::string& theValue);
+ SetString(TInt theId,
+ TInt theStep,
+ TString& theString,
+ const std::string& theValue);
+ //---------------------------------------------------------------
//! Set a substring in the sequence of the strings
MEDWRAPPER_EXPORT
void
- SetString(TInt theId, TInt theStep,
- TString& theString,
- const TString& theValue);
+ SetString(TInt theId,
+ TInt theStep,
+ TString& theString,
+ const TString& theValue);
//---------------------------------------------------------------
//! Define a parent class for all MEDWrapper classes
struct MEDWRAPPER_EXPORT TBase
{
- virtual ~TBase() {}
+ virtual ~TBase() {}
};
//---------------------------------------------------------------
//---------------------------------------------------------------
//! Define a parent class for all MED entities that contains a sequence of numbers
/*!
- It defines through corresponding enumeration (EModeSwitch) how the sequence
+ It defines through corresponding enumeration (EModeSwitch) how the sequence
should be interpreted in C or Fortran mode (eFULL_INTERLACE or eNON_INTERLACE).
*/
struct MEDWRAPPER_EXPORT TModeSwitchInfo: virtual TBase
myModeSwitch(theModeSwitch)
{}
- EModeSwitch myModeSwitch; //!< Keeps the
- EModeSwitch GetModeSwitch() const { return myModeSwitch;}
+ EModeSwitch myModeSwitch; //!< Keeps the interlace mode
+ EModeSwitch GetModeSwitch() const { return myModeSwitch; }
};
//---------------------------------------------------------------
struct MEDWRAPPER_EXPORT TMeshInfo: virtual TNameInfo
{
TInt myDim; //!< Dimension of the mesh (0, 1, 2 or 3)
- TInt GetDim() const { return myDim;} //!< Gets dimension of the mesh
+ TInt GetDim() const { return myDim; } //!< Gets dimension of the mesh
TInt mySpaceDim;
TInt GetSpaceDim() const { return mySpaceDim; }
EMaillage myType; //!< Type of the mesh
- EMaillage GetType() const { return myType;} //!< Gets type of the mesh
+ EMaillage GetType() const { return myType; } //!< Gets type of the mesh
TString myDesc; //!< Description of the mesh
virtual std::string GetDesc() const = 0; //!< Get description for the mesh
};
//---------------------------------------------------------------
- typedef TVector<TInt> TIntVector;
typedef TSlice<TInt> TIntVecSlice;
typedef TCSlice<TInt> TCIntVecSlice;
-
typedef TIntVector TFamAttr;
+ //---------------------------------------------------------------
//! Define a base class which represents MED Family entity
struct MEDWRAPPER_EXPORT TFamilyInfo: virtual TNameInfo
{
PMeshInfo myMeshInfo; //!< A reference to correspondig MED Mesh
//! Get a reference to corresponding MED Mesh
- const PMeshInfo& GetMeshInfo() const { return myMeshInfo;}
+ const PMeshInfo& GetMeshInfo() const { return myMeshInfo; }
TInt myId; //!< An unique index of the MED FAMILY
- TInt GetId() const { return myId;} //!< Gets number of the MED FAMILY
- void SetId(TInt theId) { myId = theId;} //! Define number of the MED FAMILY
+ TInt GetId() const { return myId; } //!< Gets number of the MED FAMILY
+ void SetId(TInt theId) { myId = theId; } //! Define number of the MED FAMILY
TInt myNbGroup; //!< Defines number MED Groups connected to
//! Gets number of MED GROUPS the MED FAMILY is bound to
- TInt GetNbGroup() const { return myNbGroup;}
+ TInt GetNbGroup() const { return myNbGroup; }
//! Contains sequence of the names for the MED Groups connected to
- TString myGroupNames;
+ TString myGroupNames;
//! Gets name of a bound MED GROUP by its number
virtual std::string GetGroupName(TInt theId) const = 0;
//! Sets name of the defined MED GROUP by its number
virtual void SetGroupName(TInt theId, const std::string& theValue) = 0;
- TInt myNbAttr; //!< Defines number of the MED Family attributes
+ TInt myNbAttr; //!< Defines number of the MED Family attributes
//! Gets number of attached attributes for the MED FAMILY
- TInt GetNbAttr() const { return myNbAttr;}
+ TInt GetNbAttr() const { return myNbAttr; }
//! Defines sequence of the indexes of the MED Family attributes
- TFamAttr myAttrId;
+ TFamAttr myAttrId;
//! Get MED FAMILY attribute by its number
TInt GetAttrId(TInt theId) const;
//! Set MED FAMILY attribute by its number
//---------------------------------------------------------------
typedef TIntVector TElemNum;
typedef SharedPtr<TElemNum> PElemNum;
-
+
+ //---------------------------------------------------------------
//! Define a parent class for all MED entities that describes mesh entites such as nodes and cells.
struct MEDWRAPPER_EXPORT TElemInfo: virtual TBase
{
PMeshInfo myMeshInfo; //!< A reference to correspondig MED Mesh
//! Get a reference to corresponding MED Mesh
- const PMeshInfo& GetMeshInfo() const { return myMeshInfo;}
+ const PMeshInfo& GetMeshInfo() const { return myMeshInfo; }
TInt myNbElem; //<! Number of corresponding mesh entities
- TInt GetNbElem() const { return myNbElem;} //! Get number of mesh elements
-
+ TInt GetNbElem() const { return myNbElem; } //! Get number of mesh elements
+
//! Defines sequence MED Family indexes for corresponding mesh entites
- PElemNum myFamNum;
+ PElemNum myFamNum;
//! Get number of a MED FAMILY by order number of the mesh element
TInt GetFamNum(TInt theId) const;
- //! Set number of a MED FAMILY for the mesh element with the order number
+ //! Set number of a MED FAMILY for the mesh element with the order number
void SetFamNum(TInt theId, TInt theVal);
//! Defines if the mesh elements are indexed
EBooleen myIsElemNum;
//! Let know if the mesh elements are indexed
- EBooleen IsElemNum() const { return myIsElemNum;}
-
+ EBooleen IsElemNum() const { return myIsElemNum; }
+
//! Defines if the mesh elements family are indexed
EBooleen myIsFamNum;
//! Let know if the mesh elements family are indexed
- EBooleen IsFamNum() const { return myIsFamNum;}
-
+ EBooleen IsFamNum() const { return myIsFamNum; }
//! Contains sequence of the indexes for the mesh elements
PElemNum myElemNum;
//! Defines if the mesh elements are named
EBooleen myIsElemNames;
//! Let know if the mesh elements havew names
- EBooleen IsElemNames() const { return myIsElemNames;}
+ EBooleen IsElemNames() const { return myIsElemNames; }
//! Contains sequence of the names for the mesh elements
PString myElemNames;
};
//---------------------------------------------------------------
- typedef TVector<TFloat> TFloatVector;
typedef TSlice<TFloat> TFloatVecSlice;
typedef TCSlice<TFloat> TCFloatVecSlice;
-
typedef TFloatVector TNodeCoord;
typedef SharedPtr<TNodeCoord> PNodeCoord;
-
typedef TFloatVecSlice TCoordSlice;
typedef TCFloatVecSlice TCCoordSlice;
+ //---------------------------------------------------------------
//! Define a base class which represents MED Nodes entity
- struct MEDWRAPPER_EXPORT TNodeInfo:
+ struct MEDWRAPPER_EXPORT TNodeInfo:
virtual TElemInfo,
- virtual TModeSwitchInfo
+ virtual TModeSwitchInfo
{
PNodeCoord myCoord; //!< Contains all nodal coordinates
ERepere mySystem; //!< Defines, which coordinate system is used
//! Get which coordinate system is used for the node describing
- ERepere GetSystem() const { return mySystem;}
+ ERepere GetSystem() const { return mySystem; }
//! Set coordinate system to be used for the node describing
- void SetSystem(ERepere theSystem) { mySystem = theSystem;}
+ void SetSystem(ERepere theSystem) { mySystem = theSystem; }
TString myCoordNames; //!< Contains names for the coordinate dimensions
//! Get name of the coordinate dimension by its order number
typedef TIntVecSlice TConnSlice;
typedef TCIntVecSlice TCConnSlice;
+ //---------------------------------------------------------------
//! Define a base class which represents MED Cells entity
- struct MEDWRAPPER_EXPORT TCellInfo:
+ struct MEDWRAPPER_EXPORT TCellInfo:
virtual TElemInfo,
- virtual TModeSwitchInfo
+ virtual TModeSwitchInfo
{
EEntiteMaillage myEntity; //!< Defines the MED Entity where the mesh cells belongs to
//! Let known what MED ENTITY the cells belong to
- EEntiteMaillage GetEntity() const { return myEntity;}
+ EEntiteMaillage GetEntity() const { return myEntity; }
EGeometrieElement myGeom; //!< Defines the MED Geometric type of the instance
//! Let known what MED geometrical type the cells belong to
- EGeometrieElement GetGeom() const { return myGeom;}
+ EGeometrieElement GetGeom() const { return myGeom; }
EConnectivite myConnMode; //!< Defines connectivity mode
//! Let known in what connectivity the cells are writen
- EConnectivite GetConnMode() const { return myConnMode;}
+ EConnectivite GetConnMode() const { return myConnMode; }
virtual TInt GetConnDim() const = 0; //!< Gives step in the connectivity sequence
//---------------------------------------------------------------
//! Define a base class which represents MED Polygon entity
- struct MEDWRAPPER_EXPORT TPolygoneInfo:
+ struct MEDWRAPPER_EXPORT TPolygoneInfo:
virtual TElemInfo
{
//! Defines the MED Entity where the polygons belongs to
EEntiteMaillage myEntity; // MED_FACE|MED_MAILLE
//! Let known what MED ENTITY the MED Polygons belong to
- EEntiteMaillage GetEntity() const { return myEntity;}
+ EEntiteMaillage GetEntity() const { return myEntity; }
//! Defines the MED Geometric type of the instance
EGeometrieElement myGeom; // ePOLYGONE
//! Let known what MED geometrical type the MED Polygons belong to
- EGeometrieElement GetGeom() const { return ePOLYGONE;}
+ EGeometrieElement GetGeom() const { return ePOLYGONE; }
//! Defines connectivity mode
EConnectivite myConnMode; // eNOD|eDESC(eDESC not used)
//! Let known in what connectivity the cells are writen
- EConnectivite GetConnMode() const { return myConnMode;}
+ EConnectivite GetConnMode() const { return myConnMode; }
PElemNum myConn; //!< Table de connectivities
PElemNum myIndex; //!< Table de indexes
//---------------------------------------------------------------
//! Define a class representing MED_BALL structure element.
- //
- // This could be a generic class for any structure element
- // holding any number of contant and variable attributes
- // but it's too hard to implement
- //
- struct MEDWRAPPER_EXPORT TBallInfo:
+ /*!
+ This could be a generic class for any structure element
+ holding any number of contant and variable attributes
+ but it's too hard to implement
+ */
+ struct MEDWRAPPER_EXPORT TBallInfo:
virtual TCellInfo
{
TFloatVector myDiameters;
typedef TVector<TCConnSlice> TCConnSliceArr;
typedef TVector<TConnSlice> TConnSliceArr;
+ //---------------------------------------------------------------
//! Define a base class which represents MED Polyedre entity
- struct MEDWRAPPER_EXPORT TPolyedreInfo:
+ struct MEDWRAPPER_EXPORT TPolyedreInfo:
virtual TElemInfo
{
//! Defines the MED Entity where the polyedres belongs to
EEntiteMaillage myEntity; // MED_FACE|MED_MAILLE
//! Let known what MED ENTITY the MED Polyedres belong to
- EEntiteMaillage GetEntity() const { return myEntity;}
+ EEntiteMaillage GetEntity() const { return myEntity; }
//! Defines the MED Geometric type of the instance
EGeometrieElement myGeom; // ePOLYEDRE
//! Let known what MED geometrical type the MED Polyedres belong to
- EGeometrieElement GetGeom() const { return ePOLYEDRE;}
+ EGeometrieElement GetGeom() const { return ePOLYEDRE; }
//! Defines connectivity mode
EConnectivite myConnMode; // eNOD|eDESC(eDESC not used)
//! Let known in what connectivity the cells are writen
- EConnectivite GetConnMode() const { return myConnMode;}
+ EConnectivite GetConnMode() const { return myConnMode; }
PElemNum myConn; //!< Table de connectivities
PElemNum myFaces; //!< Table de faces indexes
//---------------------------------------------------------------
//! Define a base class which represents MED Field entity
- struct MEDWRAPPER_EXPORT TFieldInfo:
+ struct MEDWRAPPER_EXPORT TFieldInfo:
virtual TNameInfo
{
PMeshInfo myMeshInfo; //!< A reference to correspondig MED Mesh
//! Get a reference to corresponding MED Mesh
- const PMeshInfo& GetMeshInfo() const { return myMeshInfo;}
+ const PMeshInfo& GetMeshInfo() const { return myMeshInfo; }
ETypeChamp myType; //!< Defines type of the MED Field
//! Let known what type of the MED FIELD is used
- ETypeChamp GetType() const { return myType;}
+ ETypeChamp GetType() const { return myType; }
TInt myNbComp; //!< Defines number of components stored in the field
//! Get number of components for the MED FIELD
- TInt GetNbComp() const { return myNbComp;}
+ TInt GetNbComp() const { return myNbComp; }
EBooleen myIsLocal; //!< Defines if the MED Field is local
//! Let known is the MED FIELD is local or not
- EBooleen GetIsLocal() const { return myIsLocal;}
+ EBooleen GetIsLocal() const { return myIsLocal; }
TInt myNbRef; //!< Defines number of refereces of the field
//! Let known number of references for the MED FIELD
- TInt GetNbRef() const { return myNbRef;}
+ TInt GetNbRef() const { return myNbRef; }
TString myCompNames; //!< Contains names for each of MED Field components
//! Get name of the component by its order number
TInt
GetDimGaussCoord(EGeometrieElement theGeom);
+ //---------------------------------------------------------------
//! Get number of referenced nodes for the defined type of mesh cell
MEDWRAPPER_EXPORT
TInt
GetNbRefCoord(EGeometrieElement theGeom);
+ //---------------------------------------------------------------
typedef TFloatVector TWeight;
+ //---------------------------------------------------------------
//! The class represents MED Gauss entity
- struct MEDWRAPPER_EXPORT TGaussInfo:
+ struct MEDWRAPPER_EXPORT TGaussInfo:
virtual TNameInfo,
- virtual TModeSwitchInfo
+ virtual TModeSwitchInfo
{
typedef boost::tuple<EGeometrieElement,std::string> TKey;
typedef boost::tuple<TKey,TInt> TInfo;
};
//! Defines, which geometrical type the MED Gauss entity belongs to
- EGeometrieElement myGeom;
+ EGeometrieElement myGeom;
//! Let known what MED geometrical type the MED GAUSS entity belong to
- EGeometrieElement GetGeom() const { return myGeom;}
+ EGeometrieElement GetGeom() const { return myGeom; }
//! Contains coordinates for the refereced nodes
- TNodeCoord myRefCoord;
+ TNodeCoord myRefCoord;
//! Gives coordinates for the referenced node by its number
TCCoordSlice GetRefCoordSlice(TInt theId) const;
TWeight myWeight;
//! Gives number of the referenced nodes
- TInt GetNbRef() const { return GetNbRefCoord(GetGeom());}
+ TInt GetNbRef() const { return GetNbRefCoord(GetGeom()); }
//! Gives dimension of the referenced nodes
- TInt GetDim() const { return GetDimGaussCoord(GetGeom());}
+ TInt GetDim() const { return GetDimGaussCoord(GetGeom()); }
//! Gives number of the Gauss Points
- TInt GetNbGauss() const { return (TInt)(myGaussCoord.size()/GetDim());}
+ TInt GetNbGauss() const { return (TInt)(myGaussCoord.size() / GetDim()); }
};
//---------------------------------------------------------------
typedef std::map<EGeometrieElement,PGaussInfo> TGeom2Gauss;
typedef std::map<EGeometrieElement,TInt> TGeom2NbGauss;
+ //---------------------------------------------------------------
//! Define a base class which represents MED TimeStamp
- struct MEDWRAPPER_EXPORT TTimeStampInfo:
+ struct MEDWRAPPER_EXPORT TTimeStampInfo:
virtual TBase
{
PFieldInfo myFieldInfo; //!< A reference to correspondig MED Field
//! Get a reference to corresponding MED Field
- const PFieldInfo& GetFieldInfo() const { return myFieldInfo;}
+ const PFieldInfo& GetFieldInfo() const { return myFieldInfo; }
//! Defines the MED Entity where the MED TimeStamp belongs to
EEntiteMaillage myEntity;
//! Let known to what MED Entity the MED TimeStamp belong to
- EEntiteMaillage GetEntity() const { return myEntity;}
+ EEntiteMaillage GetEntity() const { return myEntity; }
//! Keeps map of number of cells per geometric type where the MED TimeStamp belongs to
TGeom2Size myGeom2Size;
//! Get map of number of cells per geometric type where the MED TimeStamp belongs to
- const TGeom2Size& GetGeom2Size() const { return myGeom2Size;}
+ const TGeom2Size& GetGeom2Size() const { return myGeom2Size; }
TGeom2NbGauss myGeom2NbGauss; //!< Keeps number of the Gauss Points for the MED TimeStamp
TInt GetNbGauss(EGeometrieElement theGeom) const; //!< Gives number of the Gauss Points for the MED TimeStamp
TInt myNumDt; //!< Keeps number in time for the MED TimeStamp
- TInt GetNumDt() const { return myNumDt;} //!< Defines number in time for the MED TimeStamp
+ TInt GetNumDt() const { return myNumDt; } //!< Defines number in time for the MED TimeStamp
TInt myNumOrd; //!< Keeps number for the MED TimeStamp
- TInt GetNumOrd() const { return myNumOrd;} //!< Defines number for the MED TimeStamp
+ TInt GetNumOrd() const { return myNumOrd; } //!< Defines number for the MED TimeStamp
TFloat myDt; //!< Keeps time for the MED TimeStamp
- TFloat GetDt() const { return myDt;} //!< Defines time for the MED TimeStamp
+ TFloat GetDt() const { return myDt; } //!< Defines time for the MED TimeStamp
//! Keeps map of MED Gauss entityes per geometric type
TGeom2Gauss myGeom2Gauss;
//! Gets a map of MED Gauss entityes per geometric type
- const TGeom2Gauss& GetGeom2Gauss() const { return myGeom2Gauss;}
+ const TGeom2Gauss& GetGeom2Gauss() const { return myGeom2Gauss; }
TString myUnitDt; //!< Defines unit for the time for the MED TimeStamp
//! Get unit of time for the MED TimeStamp
//---------------------------------------------------------------
//! The class represents MED Profile entity
- struct MEDWRAPPER_EXPORT TProfileInfo:
+ struct MEDWRAPPER_EXPORT TProfileInfo:
virtual TNameInfo
{
typedef std::string TKey;
EModeProfil myMode; //!< Keeps mode for the MED Profile
//! Let known what mode of MED Profile is used
- EModeProfil GetMode() const { return myMode;}
+ EModeProfil GetMode() const { return myMode; }
//! Set mode for the MED Profile
- void SetMode(EModeProfil theMode) { myMode = theMode;}
+ void SetMode(EModeProfil theMode) { myMode = theMode; }
PElemNum myElemNum; //!< Keeps sequence of cell by its number which belong to the profile
//! Get number of mesh elelemts by its order number
void SetElemNum(TInt theId, TInt theVal);
//! Let known is the MED Profile defined
- bool IsPresent() const { return GetName() != "";}
+ bool IsPresent() const { return GetName() != ""; }
//! Let known size of the MED Profile
- TInt GetSize() const { return (TInt)myElemNum->size();}
+ TInt GetSize() const { return (TInt)myElemNum->size(); }
};
//---------------------------------------------------------------
//! The class is a helper one. It provide safe and flexible way to get access to values for a MED TimeStamp
struct MEDWRAPPER_EXPORT TMeshValueBase:
- virtual TModeSwitchInfo
+ virtual TModeSwitchInfo
{
TInt myNbElem;
TInt myNbComp;
//! Returns size of the value container
size_t
GetSize() const;
-
+
//! Returns MED interpetation of the value size
size_t
GetNbVal() const;
-
+
//! Returns number of Gauss Points bounded with the value
size_t
GetNbGauss() const;
-
+
//! Returns step inside of the data array
size_t
GetStep() const;
-
+
//! Returns bare pointer on the internal value representation
virtual
unsigned char*
//! The class is a helper one. It provide safe and flexible way to get access to values for a MED TimeStamp
template<class TValueType>
struct TTMeshValue:
- virtual TMeshValueBase
+ virtual TMeshValueBase
{
typedef TValueType TValue;
typedef typename TValueType::value_type TElement;
typedef TSlice<TElement> TValueSlice;
typedef TCSlice<TElement> TCValueSlice;
-
+
typedef TVector<TCValueSlice> TCValueSliceArr;
typedef TVector<TValueSlice> TValueSliceArr;
-
+
TValue myValue;
//! Initialize the class
}
//! Iteration through Gauss Points by their components
- TValueSliceArr
+ TValueSliceArr
GetGaussValueSliceArr(TInt theElemId)
{
TValueSliceArr aValueSliceArr(myNbGauss);
}
//! Iteration through components by corresponding Gauss Points
- TValueSliceArr
+ TValueSliceArr
GetCompValueSliceArr(TInt theElemId)
{
if(GetModeSwitch() == eFULL_INTERLACE){
}
};
+ //---------------------------------------------------------------
typedef TTMeshValue<TFloatVector> TFloatMeshValue;
typedef TTMeshValue<TIntVector> TIntMeshValue;
//---------------------------------------------------------------
- // Backward compatibility declarations
+ // Backward compatibility declarations
typedef TFloatVector TValue;
typedef TSlice<TFloat> TValueSlice;
typedef TCSlice<TFloat> TCValueSlice;
-
+
typedef TVector<TCValueSlice> TCValueSliceArr;
typedef TVector<TValueSlice> TValueSliceArr;
-
+
typedef TFloatMeshValue TMeshValue;
typedef std::map<EGeometrieElement,TMeshValue> TGeom2Value;
typedef std::map<EGeometrieElement,PProfileInfo> TGeom2Profile;
typedef std::set<EGeometrieElement> TGeom;
+ //---------------------------------------------------------------
//! The class is a base class for MED TimeStamp values holder
- struct MEDWRAPPER_EXPORT TTimeStampValueBase:
- virtual TModeSwitchInfo
+ struct MEDWRAPPER_EXPORT TTimeStampValueBase:
+ virtual TModeSwitchInfo
{
//! A reference to correspondig MED TimeStamp
PTimeStampInfo myTimeStampInfo;
//!< Get a reference to correspondig MED TimeStamp
- const PTimeStampInfo& GetTimeStampInfo() const { return myTimeStampInfo;}
+ const PTimeStampInfo& GetTimeStampInfo() const { return myTimeStampInfo; }
//! Keeps set of MED EGeometrieElement which contains values for the timestamp
TGeomSet myGeomSet;
- const TGeomSet& GetGeomSet() const { return myGeomSet;}
+ const TGeomSet& GetGeomSet() const { return myGeomSet; }
//! Keeps map of MED Profiles per geometric type
TGeom2Profile myGeom2Profile;
//! Gets a map of MED Profiles per geometric type
- const TGeom2Profile& GetGeom2Profile() const { return myGeom2Profile;}
+ const TGeom2Profile& GetGeom2Profile() const { return myGeom2Profile; }
//! Gets type of the champ
- virtual
+ virtual
ETypeChamp
GetTypeChamp() const = 0;
//! Allocates values for the given geometry
- virtual
+ virtual
void
AllocateValue(EGeometrieElement theGeom,
TInt theNbElem,
TInt theNbGauss,
TInt theNbComp,
EModeSwitch theMode = eFULL_INTERLACE) = 0;
-
- virtual
+
+ virtual
size_t
GetValueSize(EGeometrieElement theGeom) const = 0;
-
- virtual
+
+ virtual
size_t
GetNbVal(EGeometrieElement theGeom) const = 0;
-
- virtual
+
+ virtual
size_t
GetNbGauss(EGeometrieElement theGeom) const = 0;
- virtual
+ virtual
unsigned char*
GetValuePtr(EGeometrieElement theGeom) = 0;
};
//---------------------------------------------------------------
//! The class implements a container for MED TimeStamp values
template<class TMeshValueType>
- struct TTimeStampValue:
- virtual TTimeStampValueBase
+ struct TTimeStampValue:
+ virtual TTimeStampValueBase
{
typedef TMeshValueType TTMeshValue;
typedef SharedPtr<TMeshValueType> PTMeshValue;
ETypeChamp myTypeChamp; //<! Keeps type of the champ
//! Gets type of the champ
- virtual
+ virtual
ETypeChamp
GetTypeChamp() const
{
//! Keeps map of MED TimeStamp values per geometric type (const version)
TTGeom2Value myGeom2Value;
- const TTGeom2Value&
+ const TTGeom2Value&
GetGeom2Value() const
{
return myGeom2Value;
}
//! Gets MED TimeStamp values for the given geometric type (const version)
- const PTMeshValue&
+ const PTMeshValue&
GetMeshValuePtr(EGeometrieElement theGeom) const
{
typename TTGeom2Value::const_iterator anIter = myGeom2Value.find(theGeom);
}
//! Gets MED TimeStamp values for the given geometric type
- PTMeshValue&
+ PTMeshValue&
GetMeshValuePtr(EGeometrieElement theGeom)
{
myGeomSet.insert(theGeom);
}
//! Gets MED TimeStamp values for the given geometric type (const version)
- const TTMeshValue&
+ const TTMeshValue&
GetMeshValue(EGeometrieElement theGeom) const
{
return *(this->GetMeshValuePtr(theGeom));
}
//! Gets MED TimeStamp values for the given geometric type
- TTMeshValue&
+ TTMeshValue&
GetMeshValue(EGeometrieElement theGeom)
{
return *(this->GetMeshValuePtr(theGeom));
typedef TTimeStampValue<TIntMeshValue> TIntTimeStampValue;
typedef SharedPtr<TIntTimeStampValue> PIntTimeStampValue;
-
+
PIntTimeStampValue MEDWRAPPER_EXPORT
CastToIntTimeStampValue(const PTimeStampValueBase& theTimeStampValue);
const EGeometrieElement& aGeom = anIter->first;
const typename TimeStampValueTypeFrom::TTMeshValue& aMeshValue = *anIter->second;
typename TimeStampValueTypeTo::TTMeshValue& aMeshValue2 = theTimeStampValueTo->GetMeshValue(aGeom);
- aMeshValue2.Allocate(aMeshValue.myNbElem,
- aMeshValue.myNbGauss,
+ aMeshValue2.Allocate(aMeshValue.myNbElem,
+ aMeshValue.myNbGauss,
aMeshValue.myNbComp,
aMeshValue.myModeSwitch);
const typename TimeStampValueTypeFrom::TTMeshValue::TValue& aValue = aMeshValue.myValue;
}
}
+ //---------------------------------------------------------------
template<class TMeshValueType>
void
CopyTimeStampValue(SharedPtr<TTimeStampValue<TMeshValueType> > theTimeStampValueFrom,
//---------------------------------------------------------------
inline
void
- CopyTimeStampValueBase(const PTimeStampValueBase& theValueFrom,
+ CopyTimeStampValueBase(const PTimeStampValueBase& theValueFrom,
const PTimeStampValueBase& theValueTo)
{
if(theValueFrom->GetTypeChamp() == theValueTo->GetTypeChamp()){
}
//---------------------------------------------------------------
- // Backward compatibility declarations
+ // Backward compatibility declarations
typedef TFloatTimeStampValue TTimeStampVal;
typedef PFloatTimeStampValue PTimeStampVal;
//---------------------------------------------------------------
typedef std::map<TInt,TFloatVector> TIndexes;
typedef std::map<TInt,TString> TNames;
-
+
+ //---------------------------------------------------------------
//! Define a base class which represents MED Grille (structured mesh)
struct MEDWRAPPER_EXPORT TGrilleInfo:
virtual TModeSwitchInfo
{
PMeshInfo myMeshInfo;
- const PMeshInfo& GetMeshInfo() const { return myMeshInfo;}
+ const PMeshInfo& GetMeshInfo() const { return myMeshInfo; }
TNodeCoord myCoord; //!< Contains all nodal coordinates, now used only for eGRILLE_STANDARD
//! Gives coordinates for mesh nodes (const version)
TFloatVector& GetIndexes(TInt theAxisNumber);
//!Gets a number of indices per axe
TInt GetNbIndexes(TInt theAxisNumber);
-
+
TInt GetNbNodes();//! Return count of all points
TInt GetNbCells();//! Return count of all cells
TInt GetNbSubCells();//! Return count of all entities of <mesh dimension-1>
TIntVector GetGrilleStructure();
//!Sets the grille structure of theAxis axe to theNb.
void SetGrilleStructure(TInt theAxis,TInt theNb);
-
+
/*!
*Defines sequence MED Family indexes for corresponding mesh entites
*/
- TElemNum myFamNum;
+ TElemNum myFamNum;
//! Get number of a MED FAMILY by order number of the mesh element
TInt GetFamNum(TInt theId) const;
- //! Set number of a MED FAMILY for the mesh element with the order number
+ //! Set number of a MED FAMILY for the mesh element with the order number
void SetFamNum(TInt theId, TInt theVal);
-
+
/*!
*Defines sequence MED Family indexes for sub entites
*/
- TElemNum myFamSubNum;
+ TElemNum myFamSubNum;
//! Get number of a MED FAMILY by order number of sub element
TInt GetFamSubNum(TInt theId) const;
//! Set number of a MED FAMILY for theId-th sub element
void SetFamSubNum(TInt theId, TInt theVal);
-
+
/*!
*Defines sequence MED Family indexes for corresponding mesh nodes
*/
TElemNum myFamNumNode;
//! Get number of a MED FAMILY by order number of the mesh node
TInt GetFamNumNode(TInt theId) const;
- //! Set number of a MED FAMILY for the mesh node with the order number
+ //! Set number of a MED FAMILY for the mesh node with the order number
void SetFamNumNode(TInt theId, TInt theVal);
};
}
+++ /dev/null
-// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// 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
-//
-
-#ifndef MED_TWrapper_HeaderFile
-#define MED_TWrapper_HeaderFile
-
-#include "MED_TStructures.hxx"
-#include "MED_Wrapper.hxx"
-
-namespace MED
-{
- class TTWrapper: public TWrapper
- {
- public:
- //----------------------------------------------------------------------------
- virtual
- PMeshInfo
- CrMeshInfo(TInt theDim = 0, TInt theSpaceDim = 0,
- const std::string& theValue = "",
- EMaillage theType = eNON_STRUCTURE,
- const std::string& theDesc = "")
- {
- return PMeshInfo(new TTMeshInfo
- (theDim,
- theSpaceDim,
- theValue,
- theType,
- theDesc));
- }
-
- //----------------------------------------------------------------------------
- virtual
- PMeshInfo
- CrMeshInfo(const PMeshInfo& theInfo)
- {
- return PMeshInfo(new TTMeshInfo(theInfo));
- }
-
- //----------------------------------------------------------------------------
- virtual
- PFamilyInfo
- CrFamilyInfo(const PMeshInfo& theMeshInfo,
- TInt theNbGroup = 0,
- TInt theNbAttr = 0,
- TInt theId = 0,
- const std::string& theValue = "")
- {
- return PFamilyInfo(new TTFamilyInfo
- (theMeshInfo,
- theNbGroup,
- theNbAttr,
- theId,
- theValue));
- }
-
- //----------------------------------------------------------------------------
- virtual
- PFamilyInfo
- CrFamilyInfo(const PMeshInfo& theMeshInfo,
- const std::string& theValue,
- TInt theId,
- const MED::TStringSet& theGroupNames,
- const MED::TStringVector& theAttrDescs = MED::TStringVector(),
- const MED::TIntVector& theAttrIds = MED::TIntVector(),
- const MED::TIntVector& theAttrVals = MED::TIntVector())
- {
- return PFamilyInfo(new TTFamilyInfo
- (theMeshInfo,
- theValue,
- theId,
- theGroupNames,
- theAttrDescs,
- theAttrIds,
- theAttrVals));
- }
-
- //----------------------------------------------------------------------------
- virtual
- PFamilyInfo
- CrFamilyInfo(const PMeshInfo& theMeshInfo,
- const PFamilyInfo& theInfo)
- {
- return PFamilyInfo(new TTFamilyInfo
- (theMeshInfo,
- theInfo));
- }
-
- //----------------------------------------------------------------------------
- virtual
- PElemInfo
- CrElemInfo(const PMeshInfo& theMeshInfo,
- TInt theNbElem,
- EBooleen theIsElemNum = eVRAI,
- EBooleen theIsElemNames = eVRAI)
- {
- return PElemInfo(new TTElemInfo
- (theMeshInfo,
- theNbElem,
- theIsElemNum,
- theIsElemNames));
- }
-
- //----------------------------------------------------------------------------
- virtual
- PElemInfo
- CrElemInfo(const PMeshInfo& theMeshInfo,
- TInt theNbElem,
- const TIntVector& theFamNum,
- const TIntVector& aElemNum,
- const TStringVector& aElemNames)
- {
- return PElemInfo(new TTElemInfo
- (theMeshInfo,
- theNbElem,
- theFamNum,
- aElemNum,
- aElemNames));
- }
-
- //----------------------------------------------------------------------------
- virtual
- PNodeInfo
- CrNodeInfo(const PMeshInfo& theMeshInfo,
- TInt theNbElem,
- EModeSwitch theMode = eFULL_INTERLACE,
- ERepere theSystem = eCART,
- EBooleen theIsElemNum = eVRAI,
- EBooleen theIsElemNames = eVRAI)
- {
- return PNodeInfo(new TTNodeInfo
- (theMeshInfo,
- theNbElem,
- theMode,
- theSystem,
- theIsElemNum,
- theIsElemNames));
- }
-
- //----------------------------------------------------------------------------
- virtual
- PNodeInfo
- CrNodeInfo(const PMeshInfo& theMeshInfo,
- const TFloatVector& theNodeCoords,
- EModeSwitch theMode = eFULL_INTERLACE,
- ERepere theSystem = eCART,
- const TStringVector& theCoordNames = TStringVector(),
- const TStringVector& theCoordUnits = TStringVector(),
- const TIntVector& theFamilyNums = TIntVector(),
- const TIntVector& theElemNums = TIntVector(),
- const TStringVector& theElemNames = TStringVector())
- {
- return PNodeInfo(new TTNodeInfo
- (theMeshInfo,
- theNodeCoords,
- theMode,
- theSystem,
- theCoordNames,
- theCoordUnits,
- theFamilyNums,
- theElemNums,
- theElemNames));
- }
-
- //----------------------------------------------------------------------------
- virtual
- PNodeInfo
- CrNodeInfo(const PMeshInfo& theMeshInfo,
- const PNodeInfo& theInfo)
- {
- return PNodeInfo(new TTNodeInfo
- (theMeshInfo,
- theInfo));
- }
-
- //----------------------------------------------------------------------------
- virtual
- PPolygoneInfo
- CrPolygoneInfo(const PMeshInfo& theMeshInfo,
- EEntiteMaillage theEntity,
- EGeometrieElement theGeom,
- TInt theNbElem,
- TInt theConnSize,
- EConnectivite theConnMode = eNOD,
- EBooleen theIsElemNum = eVRAI,
- EBooleen theIsElemNames = eVRAI)
- {
- return PPolygoneInfo(new TTPolygoneInfo
- (theMeshInfo,
- theEntity,
- theGeom,
- theNbElem,
- theConnSize,
- theConnMode,
- theIsElemNum,
- theIsElemNames));
- }
-
- //----------------------------------------------------------------------------
- virtual
- PPolygoneInfo
- CrPolygoneInfo(const PMeshInfo& theMeshInfo,
- EEntiteMaillage theEntity,
- EGeometrieElement theGeom,
- const TIntVector& theIndexes,
- const TIntVector& theConnectivities,
- EConnectivite theConnMode = eNOD,
- const TIntVector& theFamilyNums = TIntVector(),
- const TIntVector& theElemNums = TIntVector(),
- const TStringVector& theElemNames = TStringVector())
- {
- return PPolygoneInfo(new TTPolygoneInfo
- (theMeshInfo,
- theEntity,
- theGeom,
- theIndexes,
- theConnectivities,
- theConnMode,
- theFamilyNums,
- theElemNums,
- theElemNames));
- }
-
- //----------------------------------------------------------------------------
- virtual
- PPolygoneInfo
- CrPolygoneInfo(const PMeshInfo& theMeshInfo,
- const PPolygoneInfo& theInfo)
- {
- return PPolygoneInfo(new TTPolygoneInfo
- (theMeshInfo,
- theInfo));
- }
-
- //----------------------------------------------------------------------------
- virtual
- PPolyedreInfo
- CrPolyedreInfo(const PMeshInfo& theMeshInfo,
- EEntiteMaillage theEntity,
- EGeometrieElement theGeom,
- TInt theNbElem,
- TInt theNbFaces,
- TInt theConnSize,
- EConnectivite theConnMode = eNOD,
- EBooleen theIsElemNum = eVRAI,
- EBooleen theIsElemNames = eVRAI)
- {
- return PPolyedreInfo(new TTPolyedreInfo
- (theMeshInfo,
- theEntity,
- theGeom,
- theNbElem,
- theNbFaces,
- theConnSize,
- theConnMode,
- theIsElemNum,
- theIsElemNames));
- }
-
- //----------------------------------------------------------------------------
- virtual
- PPolyedreInfo
- CrPolyedreInfo(const PMeshInfo& theMeshInfo,
- EEntiteMaillage theEntity,
- EGeometrieElement theGeom,
- const TIntVector& theIndexes,
- const TIntVector& theFaces,
- const TIntVector& theConnectivities,
- EConnectivite theConnMode = eNOD,
- const TIntVector& theFamilyNums = TIntVector(),
- const TIntVector& theElemNums = TIntVector(),
- const TStringVector& theElemNames = TStringVector())
- {
- return PPolyedreInfo(new TTPolyedreInfo
- (theMeshInfo,
- theEntity,
- theGeom,
- theIndexes,
- theFaces,
- theConnectivities,
- theConnMode,
- theFamilyNums,
- theElemNums,
- theElemNames));
- }
-
- //----------------------------------------------------------------------------
- virtual
- PPolyedreInfo
- CrPolyedreInfo(const PMeshInfo& theMeshInfo,
- const PPolyedreInfo& theInfo)
- {
- return PPolyedreInfo(new TTPolyedreInfo
- (theMeshInfo,
- theInfo));
- }
-
- //----------------------------------------------------------------------------
- virtual
- PCellInfo
- CrCellInfo(const PMeshInfo& theMeshInfo,
- EEntiteMaillage theEntity,
- EGeometrieElement theGeom,
- TInt theNbElem,
- EConnectivite theConnMode = eNOD,
- EBooleen theIsElemNum = eVRAI,
- EBooleen theIsElemNames = eVRAI,
- EModeSwitch theMode = eFULL_INTERLACE)
- {
- return PCellInfo(new TTCellInfo
- (theMeshInfo,
- theEntity,
- theGeom,
- theNbElem,
- theConnMode,
- theIsElemNum,
- theIsElemNames,
- theMode));
- }
-
- //----------------------------------------------------------------------------
- virtual
- PCellInfo
- CrCellInfo(const PMeshInfo& theMeshInfo,
- EEntiteMaillage theEntity,
- EGeometrieElement theGeom,
- const TIntVector& theConnectivities,
- EConnectivite theConnMode = eNOD,
- const TIntVector& theFamilyNums = TIntVector(),
- const TIntVector& theElemNums = TIntVector(),
- const TStringVector& theElemNames = TStringVector(),
- EModeSwitch theMode = eFULL_INTERLACE)
- {
- return PCellInfo(new TTCellInfo
- (theMeshInfo,
- theEntity,
- theGeom,
- theConnectivities,
- theConnMode,
- theFamilyNums,
- theElemNums,
- theElemNames,
- theMode));
- }
-
- //----------------------------------------------------------------------------
- virtual
- PCellInfo
- CrCellInfo(const PMeshInfo& theMeshInfo,
- const PCellInfo& theInfo)
- {
- return PCellInfo(new TTCellInfo
- (theMeshInfo,
- theInfo));
- }
-
- //----------------------------------------------------------------------------
- //! Creates a MEDWrapper MED Balls representation
- virtual PBallInfo CrBallInfo(const PMeshInfo& theMeshInfo,
- TInt theNbBalls,
- EBooleen theIsElemNum = eVRAI)
- {
- return PBallInfo( new TTBallInfo( theMeshInfo, theNbBalls, theIsElemNum ));
- }
-
- //----------------------------------------------------------------------------
- //! Creates a MEDWrapper MED Balls representation
- virtual PBallInfo CrBallInfo(const PMeshInfo& theMeshInfo,
- const TIntVector& theNodes,
- TFloatVector& theDiameters,
- const TIntVector& theFamilyNums = TIntVector(),
- const TIntVector& theElemNums = TIntVector())
- {
- return PBallInfo( new TTBallInfo( theMeshInfo, theNodes, theDiameters,
- theFamilyNums, theElemNums));
- }
-
- //----------------------------------------------------------------------------
- //! A copy-constructor for the MEDWrapper MED Balls representation
- virtual PBallInfo CrBallInfo(const PMeshInfo& theMeshInfo,
- const PBallInfo& theInfo)
- {
- return PBallInfo( new TTBallInfo( theMeshInfo, theInfo ));
- }
-
- //----------------------------------------------------------------------------
- virtual
- PFieldInfo
- CrFieldInfo(const PMeshInfo& theMeshInfo,
- TInt theNbComp = 0,
- ETypeChamp theType = eFLOAT64,
- const std::string& theValue = "",
- EBooleen theIsLocal = eVRAI,
- TInt theNbRef = 1)
- {
- return PFieldInfo(new TTFieldInfo
- (theMeshInfo,
- theNbComp,
- theType,
- theValue,
- theIsLocal,
- theNbRef));
- }
-
- //----------------------------------------------------------------------------
- virtual
- PFieldInfo
- CrFieldInfo(const PMeshInfo& theMeshInfo,
- const PFieldInfo& theInfo)
- {
- return PFieldInfo(new TTFieldInfo
- (theMeshInfo,
- theInfo));
- }
-
- //----------------------------------------------------------------------------
- virtual
- PTimeStampInfo
- CrTimeStampInfo(const PFieldInfo& theFieldInfo,
- EEntiteMaillage theEntity,
- const TGeom2Size& theGeom2Size,
- const TGeom2NbGauss& theGeom2NbGauss = TGeom2NbGauss(),
- TInt theNumDt = 0,
- TInt theNumOrd = 0,
- TFloat theDt = 0,
- const std::string& theUnitDt = "",
- const TGeom2Gauss& theGeom2Gauss = TGeom2Gauss())
- {
- return PTimeStampInfo(new TTTimeStampInfo
- (theFieldInfo,
- theEntity,
- theGeom2Size,
- theGeom2NbGauss,
- theNumDt,
- theNumOrd,
- theDt,
- theUnitDt,
- theGeom2Gauss));
- }
-
- //----------------------------------------------------------------------------
- virtual
- PTimeStampInfo
- CrTimeStampInfo(const PFieldInfo& theFieldInfo,
- const PTimeStampInfo& theInfo)
- {
- return PTimeStampInfo(new TTTimeStampInfo
- (theFieldInfo,
- theInfo));
- }
-
- //----------------------------------------------------------------------------
- virtual
- PGaussInfo
- CrGaussInfo(const TGaussInfo::TInfo& theInfo,
- EModeSwitch theMode = eFULL_INTERLACE)
- {
- return PGaussInfo(new TTGaussInfo
- (theInfo,
- theMode));
- }
-
- //----------------------------------------------------------------------------
- virtual
- PProfileInfo
- CrProfileInfo(const TProfileInfo::TInfo& theInfo,
- EModeProfil theMode = eCOMPACT)
- {
- return PProfileInfo(new TTProfileInfo
- (theInfo,
- theMode));
- }
-
- //----------------------------------------------------------------------------
- virtual
- PTimeStampValueBase
- CrTimeStampValue(const PTimeStampInfo& theTimeStampInfo,
- ETypeChamp theTypeChamp,
- const TGeom2Profile& theGeom2Profile = TGeom2Profile(),
- EModeSwitch theMode = eFULL_INTERLACE)
- {
- if(theTypeChamp == eFLOAT64)
- return PTimeStampValueBase(new TTTimeStampValue<TFloatMeshValue>
- (theTimeStampInfo,
- theTypeChamp,
- theGeom2Profile,
- theMode));
- return PTimeStampValueBase(new TTTimeStampValue<TIntMeshValue>
- (theTimeStampInfo,
- theTypeChamp,
- theGeom2Profile,
- theMode));
- }
-
- //----------------------------------------------------------------------------
- virtual
- PTimeStampValueBase
- CrTimeStampValue(const PTimeStampInfo& theTimeStampInfo,
- const PTimeStampValueBase& theInfo,
- ETypeChamp theTypeChamp)
- {
- if(theTypeChamp == eFLOAT64)
- return PTimeStampValueBase(new TTTimeStampValue<TFloatMeshValue>
- (theTimeStampInfo,
- theInfo,
- theTypeChamp));
- return PTimeStampValueBase(new TTTimeStampValue<TIntMeshValue>
- (theTimeStampInfo,
- theInfo,
- theTypeChamp));
- }
-
- //----------------------------------------------------------------------------
- virtual
- PGrilleInfo
- CrGrilleInfo(const PMeshInfo& theMeshInfo,
- const PGrilleInfo& theInfo)
- {
- return PGrilleInfo(new TTGrilleInfo
- (theMeshInfo,
- theInfo));
- }
-
- //----------------------------------------------------------------------------
- virtual
- PGrilleInfo
- CrGrilleInfo(const PMeshInfo& theMeshInfo,
- const EGrilleType& type)
- {
- return PGrilleInfo(new TTGrilleInfo
- (theMeshInfo,
- type));
- }
-
- //----------------------------------------------------------------------------
- virtual
- PGrilleInfo
- CrGrilleInfo(const PMeshInfo& theMeshInfo,
- const EGrilleType& type,
- const TInt& nbNodes)
- {
- return PGrilleInfo(new TTGrilleInfo
- (theMeshInfo,
- type,
- nbNodes));
- }
-
- //----------------------------------------------------------------------------
- virtual
- PGrilleInfo
- CrGrilleInfo(const PMeshInfo& theMeshInfo,
- const EGrilleType& type,
- const MED::TIntVector& nbNodeVec)
- {
- return PGrilleInfo(new TTGrilleInfo
- (theMeshInfo,
- type,
- nbNodeVec));
- }
- };
-}
-
-#endif // MED_TWrapper_HeaderFile
#ifdef _DEBUG_
static int MYDEBUG = 0;
#else
-// static int MYDEBUG = 0;
+static int MYDEBUG = 0;
#endif
int MED::PrefixPrinter::myCounter = 0;
}
return "";
}
-
-const MED::TEntity2GeomSet& MED::GetEntity2GeomSet()
-{
- static MED::TEntity2GeomSet Entity2GeomSet;
- using namespace MED;
-
- if ( Entity2GeomSet.empty() ) {
- TGeomSet& aGeomARETESet = Entity2GeomSet[eARETE];
- aGeomARETESet.insert(eSEG2);
- aGeomARETESet.insert(eSEG3);
-
- TGeomSet& aGeomFACESet = Entity2GeomSet[eFACE];
- aGeomFACESet.insert(eTRIA3);
- aGeomFACESet.insert(eQUAD4);
- aGeomFACESet.insert(eTRIA6);
- aGeomFACESet.insert(eTRIA7);
- aGeomFACESet.insert(eQUAD8);
- aGeomFACESet.insert(eQUAD9);
- aGeomFACESet.insert(ePOLYGONE);
- aGeomFACESet.insert(ePOLYGON2);
-
- TGeomSet& aGeomMAILLESet = Entity2GeomSet[eMAILLE];
- aGeomMAILLESet.insert(ePOINT1);
- aGeomMAILLESet.insert(aGeomARETESet.begin(),aGeomARETESet.end());
- aGeomMAILLESet.insert(aGeomFACESet.begin(),aGeomFACESet.end());
- aGeomMAILLESet.insert(eTETRA4);
- aGeomMAILLESet.insert(ePYRA5);
- aGeomMAILLESet.insert(ePENTA6);
- aGeomMAILLESet.insert(eHEXA8);
- aGeomMAILLESet.insert(eOCTA12);
- aGeomMAILLESet.insert(eTETRA10);
- aGeomMAILLESet.insert(ePYRA13);
- aGeomMAILLESet.insert(ePENTA15);
- aGeomMAILLESet.insert(eHEXA20);
- aGeomMAILLESet.insert(eHEXA27);
- aGeomMAILLESet.insert(ePOLYEDRE);
-
- /* This combination allows reading nb of models of structure elements */
- Entity2GeomSet[eSTRUCT_ELEMENT].insert(eAllGeoType);
- }
-
- return Entity2GeomSet;
-}
#include "MED_WrapperDef.hxx"
-#include <iostream>
-#include <sstream>
+#include <iostream>
+#include <sstream>
#include <string>
#include <string.h>
#include <stdexcept>
+++ /dev/null
-// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// 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
-//
-
-#include "MED_V2_2_Wrapper.hxx"
-#include "MED_Algorithm.hxx"
-#include "MED_Utilities.hxx"
-
-#include <med.h>
-#include <med_err.h>
-
-#ifdef _DEBUG_
-static int MYDEBUG = 0;
-// #else
-// static int MYDEBUG = 0;
-#endif
-
-namespace MED
-{
- TInt
- GetDESCLength()
- {
- return 200;
- }
-
- TInt
- GetIDENTLength()
- {
- return 8;
- }
-
- TInt
- GetNOMLength()
- {
- return 64;
- }
-
- TInt
- GetLNOMLength()
- {
- return 80;
- }
-
- TInt
- GetPNOMLength()
- {
- return 16;
- }
-
- void
- GetVersionRelease(TInt& majeur, TInt& mineur, TInt& release)
- {
- majeur=MED_MAJOR_NUM;
- mineur=MED_MINOR_NUM;
- release=MED_RELEASE_NUM;
- }
-
- TInt
- GetNbConn(EGeometrieElement typmai,
- EEntiteMaillage typent,
- TInt mdim)
- {
- return typmai%100;
- }
-
- namespace V2_2
- {
- //---------------------------------------------------------------
- class TFile{
- TFile();
- TFile(const TFile&);
-
- public:
- TFile(const std::string& theFileName):
- myCount(0),
- myFid(0),
- myFileName(theFileName)
- {}
-
- ~TFile()
- {
- Close();
- }
-
- void
- Open(EModeAcces theMode, TErr* theErr = NULL)
- {
- if(myCount++ == 0){
- const char* aFileName = myFileName.c_str();
- myFid = MEDfileOpen(aFileName,med_access_mode(theMode));
- }
- if(theErr)
- *theErr = TErr(myFid);
- else if(myFid < 0)
- EXCEPTION(std::runtime_error,"TFile - MEDfileOpen('"<<myFileName<<"',"<<theMode<<")");
- }
-
- const TIdt& Id() const
- {
- if(myFid < 0)
- EXCEPTION(std::runtime_error,"TFile - GetFid() < 0");
- return myFid;
- }
-
- void Close()
- {
- if(--myCount == 0)
- MEDfileClose(myFid);
- }
-
- protected:
- TInt myCount;
- TIdt myFid;
- std::string myFileName;
- };
-
- //---------------------------------------------------------------
- class TFileWrapper
- {
- PFile myFile;
-
- public:
- TFileWrapper(const PFile& theFile, EModeAcces theMode, TErr* theErr = NULL):
- myFile(theFile)
- {
- myFile->Open(theMode,theErr);
- }
-
- ~TFileWrapper()
- {
- myFile->Close();
- }
- };
-
- //---------------------------------------------------------------
- TVWrapper::TVWrapper(const std::string& theFileName):
- myFile(new TFile(theFileName))
- {
- 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 );
- }
- if(aRet < 0) {
- myFile->Close();
- myFile->Open( eCREATION, &aRet );
- }
- }
-
- //----------------------------------------------------------------------------
- TInt
- TVWrapper
- ::GetNbMeshes(TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
-
- if(theErr && *theErr < 0)
- return -1;
-
- return MEDnMesh(myFile->Id());
- }
-
- //----------------------------------------------------------------------------
- void
- TVWrapper
- ::GetMeshInfo(TInt theMeshId,
- MED::TMeshInfo& theInfo,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
-
- if(theErr && *theErr < 0)
- return;
-
- TValueHolder<TString, char> aMeshName(theInfo.myName);
- TValueHolder<TInt, med_int> aDim(theInfo.myDim);
- TValueHolder<TInt, med_int> aSpaceDim(theInfo.mySpaceDim);
- TValueHolder<EMaillage, med_mesh_type> aType(theInfo.myType);
- char dtunit[MED_SNAME_SIZE+1];
- med_sorting_type sorttype;
- med_int nstep;
- med_axis_type at;
- int naxis=MEDmeshnAxis(myFile->Id(),theMeshId);
- char *axisname=new char[naxis*MED_SNAME_SIZE+1];
- char *axisunit=new char[naxis*MED_SNAME_SIZE+1];
- TErr aRet = MEDmeshInfo(myFile->Id(),
- theMeshId,
- &aMeshName,
- &aSpaceDim,
- &aDim,
- &aType,
- &theInfo.myDesc[0],
- dtunit,
- &sorttype,
- &nstep,
- &at,
- axisname,
- axisunit);
- delete [] axisname;
- delete [] axisunit;
- if(aRet < 0)
- EXCEPTION(std::runtime_error,"GetMeshInfo - MEDmeshInfo(...)");
- }
-
- //----------------------------------------------------------------------------
- void
- TVWrapper
- ::SetMeshInfo(const MED::TMeshInfo& theInfo,
- EModeAcces theMode,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,theMode,theErr);
-
- if(theErr && *theErr < 0)
- return;
-
- MED::TMeshInfo& anInfo = const_cast<MED::TMeshInfo&>(theInfo);
-
- TValueHolder<TString, char> aMeshName(anInfo.myName);
- TValueHolder<TInt, med_int> aDim(anInfo.myDim);
- TValueHolder<TInt, med_int> aSpaceDim(anInfo.mySpaceDim);
- TValueHolder<EMaillage, med_mesh_type> aType(anInfo.myType);
- TValueHolder<TString, char> aDesc(anInfo.myDesc);
-
- char *nam=new char[aSpaceDim*MED_SNAME_SIZE+1];
- std::fill(nam,nam+aSpaceDim*MED_SNAME_SIZE+1,'\0');
- char *unit=new char[aSpaceDim*MED_SNAME_SIZE+1];
- std::fill(unit,unit+aSpaceDim*MED_SNAME_SIZE+1,'\0');
- TErr aRet = MEDmeshCr(myFile->Id(),
- &aMeshName,
- aSpaceDim,
- aDim,
- aType,
- &aDesc,
- "",
- MED_SORT_DTIT,
- MED_CARTESIAN,
- nam,
- unit);
- delete [] nam;
- delete [] unit;
-
- //if(aRet == 0)
- // aRet = MEDunvCr(myFile->Id(),&aMeshName);
-
- INITMSG(MYDEBUG,"TVWrapper::SetMeshInfo - MED_MODE_ACCES = "<<theMode<<"; aRet = "<<aRet<<std::endl);
-
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(std::runtime_error,"SetMeshInfo - MEDmeshCr(...)");
- }
-
- //----------------------------------------------------------------------------
- void
- TVWrapper
- ::SetMeshInfo(const MED::TMeshInfo& theInfo,
- TErr* theErr)
- {
- TErr aRet;
- SetMeshInfo(theInfo,eLECTURE_ECRITURE,&aRet);
-
- if(aRet < 0)
- SetMeshInfo(theInfo,eLECTURE_AJOUT,&aRet);
-
- if(aRet < 0)
- SetMeshInfo(theInfo,eCREATION,&aRet);
-
- if(theErr)
- *theErr = aRet;
- }
-
- //----------------------------------------------------------------------------
- TInt
- TVWrapper
- ::GetNbFamilies(const MED::TMeshInfo& theInfo,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
-
- if(theErr && *theErr < 0)
- return -1;
-
- MED::TMeshInfo& anInfo = const_cast<MED::TMeshInfo&>(theInfo);
- TValueHolder<TString, char> aName(anInfo.myName);
- return MEDnFamily(myFile->Id(),&aName);
- }
-
- //----------------------------------------------------------------------------
- TInt
- TVWrapper
- ::GetNbFamAttr(TInt theFamId,
- const MED::TMeshInfo& theInfo,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
-
- if(theErr && *theErr < 0)
- return -1;
-
- MED::TMeshInfo& anInfo = const_cast<MED::TMeshInfo&>(theInfo);
-
- TValueHolder<TString, char> aName(anInfo.myName);
-
- return MEDnFamily23Attribute(myFile->Id(),&aName,theFamId);
- }
-
- //----------------------------------------------------------------------------
- TInt
- TVWrapper
- ::GetNbFamGroup(TInt theFamId,
- const MED::TMeshInfo& theInfo,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
-
- if(theErr && *theErr < 0)
- return -1;
-
- MED::TMeshInfo& anInfo = const_cast<MED::TMeshInfo&>(theInfo);
-
- TValueHolder<TString, char> aName(anInfo.myName);
-
- return MEDnFamilyGroup(myFile->Id(),&aName,theFamId);
- }
-
- //----------------------------------------------------------------------------
- void
- TVWrapper
- ::GetFamilyInfo(TInt theFamId,
- MED::TFamilyInfo& theInfo,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
-
- if(theErr && *theErr < 0)
- return;
-
- MED::TMeshInfo& aMeshInfo = *theInfo.myMeshInfo;
-
- TValueHolder<TString, char> aMeshName(aMeshInfo.myName);
- TValueHolder<TString, char> aFamilyName(theInfo.myName);
- TValueHolder<TInt, med_int> aFamilyId(theInfo.myId);
- TValueHolder<TFamAttr, med_int> anAttrId(theInfo.myAttrId);
- TValueHolder<TFamAttr, med_int> anAttrVal(theInfo.myAttrVal);
- TValueHolder<TString, char> anAttrDesc(theInfo.myAttrDesc);
- TValueHolder<TString, char> aGroupNames(theInfo.myGroupNames);
-
- TErr aRet = MEDfamily23Info(myFile->Id(),
- &aMeshName,
- theFamId,
- &aFamilyName,
- &anAttrId,
- &anAttrVal,
- &anAttrDesc,
- &aFamilyId,
- &aGroupNames);
-
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(std::runtime_error,"GetFamilyInfo - MEDfamily23Info(...) - "<<
- " aMeshInfo.myName = '"<<&aMeshName<<
- "'; theFamId = "<<theFamId<<
- "; theInfo.myNbGroup = "<<theInfo.myNbGroup<<
- "; theInfo.myNbAttr = "<<theInfo.myNbAttr);
- }
-
- //----------------------------------------------------------------------------
- void
- TVWrapper
- ::SetFamilyInfo(const MED::TFamilyInfo& theInfo,
- EModeAcces theMode,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,theMode,theErr);
-
- if(theErr && *theErr < 0)
- return;
-
- MED::TFamilyInfo& anInfo = const_cast<MED::TFamilyInfo&>(theInfo);
- MED::TMeshInfo& aMeshInfo = *anInfo.myMeshInfo;
-
- TValueHolder<TString, char> aMeshName(aMeshInfo.myName);
- TValueHolder<TString, char> aFamilyName(anInfo.myName);
- TValueHolder<TInt, med_int> aFamilyId(anInfo.myId);
- TValueHolder<TFamAttr, med_int> anAttrId(anInfo.myAttrId);
- TValueHolder<TFamAttr, med_int> anAttrVal(anInfo.myAttrVal);
- TValueHolder<TInt, med_int> aNbAttr(anInfo.myNbAttr);
- TValueHolder<TString, char> anAttrDesc(anInfo.myAttrDesc);
- TValueHolder<TInt, med_int> aNbGroup(anInfo.myNbGroup);
- TValueHolder<TString, char> aGroupNames(anInfo.myGroupNames);
-
- TErr aRet = MEDfamilyCr(myFile->Id(),
- &aMeshName,
- &aFamilyName,
- aFamilyId,
- aNbGroup,
- &aGroupNames);
-
- INITMSG(MYDEBUG,"TVWrapper::SetFamilyInfo - MED_MODE_ACCES = "<<theMode<<"; aRet = "<<aRet<<std::endl);
-
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(std::runtime_error,"SetFamilyInfo - MEDfamilyCr(...)");
- }
-
- //----------------------------------------------------------------------------
- void
- TVWrapper
- ::SetFamilyInfo(const MED::TFamilyInfo& theInfo,
- TErr* theErr)
- {
- TErr aRet;
- SetFamilyInfo(theInfo,eLECTURE_ECRITURE,&aRet);
-
- if(aRet < 0)
- SetFamilyInfo(theInfo,eLECTURE_AJOUT,&aRet);
-
- if(theErr)
- *theErr = aRet;
- }
-
- //----------------------------------------------------------------------------
- void
- TVWrapper
- ::GetNames(TElemInfo& theInfo,
- TInt theNb,
- EEntiteMaillage theEntity,
- EGeometrieElement theGeom,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
-
- if(theErr && *theErr < 0)
- return;
-
- if ( theGeom == eBALL )
- theGeom = GetBallGeom( theInfo.myMeshInfo );
-
- MED::TMeshInfo& aMeshInfo = *theInfo.myMeshInfo;
-
- TValueHolder<TString, char> aMeshName (aMeshInfo.myName);
- TValueHolder<TString, char> anElemNames(theInfo.myElemNames);
- TValueHolder<EEntiteMaillage, med_entity_type> anEntity (theEntity);
- TValueHolder<EGeometrieElement, med_geometry_type> aGeom (theGeom);
-
- TErr aRet = MEDmeshEntityNameRd(myFile->Id(),
- &aMeshName,
- MED_NO_DT,
- MED_NO_IT,
- anEntity,
- aGeom,
- &anElemNames);
-
- theInfo.myIsElemNames = aRet != 0? eFAUX : eVRAI ;
-
- if(theErr)
- *theErr = aRet;
- }
-
- //----------------------------------------------------------------------------
- void
- TVWrapper
- ::GetNumeration(TElemInfo& theInfo,
- TInt theNb,
- EEntiteMaillage theEntity,
- EGeometrieElement theGeom,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
-
- if(theErr && *theErr < 0)
- return;
-
- if ( theGeom == eBALL )
- theGeom = GetBallGeom( theInfo.myMeshInfo );
-
- MED::TMeshInfo& aMeshInfo = *theInfo.myMeshInfo;
-
- TValueHolder<TString, char> aMeshName(aMeshInfo.myName);
- TValueHolder<TElemNum, med_int> anElemNum(theInfo.myElemNum);
- TValueHolder<EEntiteMaillage, med_entity_type> anEntity (theEntity);
- TValueHolder<EGeometrieElement, med_geometry_type> aGeom (theGeom);
-
- TErr aRet = MEDmeshEntityNumberRd(myFile->Id(),
- &aMeshName,
- MED_NO_DT,
- MED_NO_IT,
- anEntity,
- aGeom,
- &anElemNum);
-
- theInfo.myIsElemNum = aRet != 0? eFAUX : eVRAI;
-
- if(theErr)
- *theErr = aRet;
- }
-
- //----------------------------------------------------------------------------
- void
- TVWrapper
- ::GetFamilies(TElemInfo& theInfo,
- TInt theNb,
- EEntiteMaillage theEntity,
- EGeometrieElement theGeom,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
-
- if(theErr && *theErr < 0)
- return;
-
- if ( theGeom == eBALL )
- theGeom = GetBallGeom( theInfo.myMeshInfo );
-
- MED::TMeshInfo& aMeshInfo = *theInfo.myMeshInfo;
-
- TValueHolder<TString, char> aMeshName(aMeshInfo.myName);
- TValueHolder<TElemNum, med_int> aFamNum (theInfo.myFamNum);
- TValueHolder<EEntiteMaillage, med_entity_type> anEntity (theEntity);
- TValueHolder<EGeometrieElement, med_geometry_type> aGeom (theGeom);
-
- TErr aRet = MEDmeshEntityFamilyNumberRd(myFile->Id(),
- &aMeshName,
- MED_NO_DT,
- MED_NO_IT,
- anEntity,
- aGeom,
- &aFamNum);
-
- if(aRet < 0)
- {
-// if (aRet == MED_ERR_DOESNTEXIST) // --- only valid with MED3.x files
- {
- int aSize = (int)theInfo.myFamNum->size();
- theInfo.myFamNum->clear();
- theInfo.myFamNum->resize(aSize,0);
- aRet = 0;
- }
-// else
-// EXCEPTION(std::runtime_error,"GetGrilleInfo - MEDmeshEntityFamilyNumberRd(...) of CELLS");
- }
- if(theErr)
- *theErr = aRet;
- }
-
- //----------------------------------------------------------------------------
- void
- TVWrapper
- ::SetNames(const TElemInfo& theInfo,
- EEntiteMaillage theEntity,
- EGeometrieElement theGeom,
- TErr* theErr)
- {
- SetNames(theInfo,eLECTURE_ECRITURE,theEntity,theGeom,theErr);
- }
-
- //----------------------------------------------------------------------------
- void
- TVWrapper
- ::SetNames(const TElemInfo& theInfo,
- EModeAcces theMode,
- EEntiteMaillage theEntity,
- EGeometrieElement theGeom,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,theMode,theErr);
-
- if(theErr && *theErr < 0)
- return;
-
- if ( theGeom == eBALL )
- theGeom = GetBallGeom( theInfo.myMeshInfo );
-
- MED::TElemInfo& anInfo = const_cast<MED::TElemInfo&>(theInfo);
- MED::TMeshInfo& aMeshInfo = *anInfo.myMeshInfo;
-
- TErr aRet = 0;
- if(theInfo.myIsElemNames)
- {
- TValueHolder<TString, char> aMeshName (aMeshInfo.myName);
- TValueHolder<TString, char> anElemNames(anInfo.myElemNames);
- TValueHolder<EEntiteMaillage, med_entity_type> anEntity (theEntity);
- TValueHolder<EGeometrieElement, med_geometry_type> aGeom (theGeom);
-
- aRet = MEDmeshEntityNameWr(myFile->Id(),
- &aMeshName,
- MED_NO_DT,
- MED_NO_IT,
- anEntity,
- aGeom,
- (TInt)anInfo.myElemNames->size(),
- &anElemNames);
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(std::runtime_error,"SetNames - MEDmeshEntityNameWr(...)");
- }
- }
-
- //----------------------------------------------------------------------------
- void
- TVWrapper
- ::SetNumeration(const TElemInfo& theInfo,
- EEntiteMaillage theEntity,
- EGeometrieElement theGeom,
- TErr* theErr)
- {
- SetNumeration(theInfo,eLECTURE_ECRITURE,theEntity,theGeom,theErr);
- }
-
- //----------------------------------------------------------------------------
- void
- TVWrapper
- ::SetNumeration(const TElemInfo& theInfo,
- EModeAcces theMode,
- EEntiteMaillage theEntity,
- EGeometrieElement theGeom,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,theMode,theErr);
-
- if(theErr && *theErr < 0)
- return;
-
- if ( theGeom == eBALL )
- theGeom = GetBallGeom( theInfo.myMeshInfo );
-
- MED::TElemInfo& anInfo = const_cast<MED::TElemInfo&>(theInfo);
- MED::TMeshInfo& aMeshInfo = *anInfo.myMeshInfo;
-
- TErr aRet = 0;
- if(theInfo.myIsElemNum)
- {
- TValueHolder<TString, char> aMeshName(aMeshInfo.myName);
- TValueHolder<TElemNum, med_int> anElemNum(anInfo.myElemNum);
- TValueHolder<EEntiteMaillage, med_entity_type> anEntity (theEntity);
- TValueHolder<EGeometrieElement, med_geometry_type> aGeom (theGeom);
-
- aRet = MEDmeshEntityNumberWr(myFile->Id(),
- &aMeshName,
- MED_NO_DT,
- MED_NO_IT,
- anEntity,
- aGeom,
- (TInt)anInfo.myElemNum->size(),
- &anElemNum);
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(std::runtime_error,"SetNumeration - MEDmeshEntityNumberWr(...)");
- }
- }
-
- //----------------------------------------------------------------------------
- void
- TVWrapper
- ::SetFamilies(const TElemInfo& theInfo,
- EEntiteMaillage theEntity,
- EGeometrieElement theGeom,
- TErr* theErr)
- {
- SetFamilies(theInfo,eLECTURE_ECRITURE,theEntity,theGeom,theErr);
- }
-
- //----------------------------------------------------------------------------
- void
- TVWrapper
- ::SetFamilies(const TElemInfo& theInfo,
- EModeAcces theMode,
- EEntiteMaillage theEntity,
- EGeometrieElement theGeom,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,theMode,theErr);
-
- if(theErr && *theErr < 0)
- return;
-
- if ( theGeom == eBALL )
- theGeom = GetBallGeom( theInfo.myMeshInfo );
-
- MED::TElemInfo& anInfo = const_cast<MED::TElemInfo&>(theInfo);
- MED::TMeshInfo& aMeshInfo = *anInfo.myMeshInfo;
-
- TValueHolder<TString, char> aMeshName(aMeshInfo.myName);
- TValueHolder<TElemNum, med_int> aFamNum (anInfo.myFamNum);
- TValueHolder<EEntiteMaillage, med_entity_type> anEntity (theEntity);
- TValueHolder<EGeometrieElement, med_geometry_type> aGeom (theGeom);
-
- TErr aRet = MEDmeshEntityFamilyNumberWr(myFile->Id(),
- &aMeshName,
- MED_NO_DT,
- MED_NO_IT,
- anEntity,
- aGeom,
- (TInt)anInfo.myFamNum->size(),
- &aFamNum);
-
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(std::runtime_error,"SetFamilies - MEDmeshEntityFamilyNumberWr(...)");
- }
-
- //----------------------------------------------------------------------------
- TInt
- TVWrapper
- ::GetNbNodes(const MED::TMeshInfo& theMeshInfo,
- ETable theTable,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
-
- if(theErr && *theErr < 0)
- return -1;
-
- MED::TMeshInfo& aMeshInfo = const_cast<MED::TMeshInfo&>(theMeshInfo);
-
- TValueHolder<TString, char> aMeshName(aMeshInfo.myName);
- TValueHolder<ETable, med_data_type > aTable(theTable);
- med_bool chgt,trsf;
- return MEDmeshnEntity(myFile->Id(),
- &aMeshName,
- MED_NO_DT,
- MED_NO_IT,
- MED_NODE,
- MED_NO_GEOTYPE,
- aTable,
- MED_NO_CMODE,
- &chgt,
- &trsf);
- }
-
- //----------------------------------------------------------------------------
- void
- TVWrapper
- ::GetNodeInfo(MED::TNodeInfo& theInfo,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
-
- if(theErr && *theErr < 0)
- return;
-
- MED::TMeshInfo& aMeshInfo = *theInfo.myMeshInfo;
-
- TValueHolder<TString, char> aMeshName(aMeshInfo.myName);
- TValueHolder<TInt, med_int> aDim(aMeshInfo.myDim);
- TValueHolder<TNodeCoord, med_float> aCoord(theInfo.myCoord);
- TValueHolder<EModeSwitch, med_switch_mode> aModeSwitch(theInfo.myModeSwitch);
- TValueHolder<ERepere, med_axis_type> aSystem(theInfo.mySystem);
- TValueHolder<TString, char> aCoordNames(theInfo.myCoordNames);
- TValueHolder<TString, char> aCoordUnits(theInfo.myCoordUnits);
- TValueHolder<TString, char> anElemNames(theInfo.myElemNames);
- //TValueHolder<EBooleen, med_bool> anIsElemNames(theInfo.myIsElemNames);
- TValueHolder<TElemNum, med_int> anElemNum(theInfo.myElemNum);
- //TValueHolder<EBooleen, med_bool> anIsElemNum(theInfo.myIsElemNum);
- TValueHolder<TElemNum, med_int> aFamNum(theInfo.myFamNum);
- TValueHolder<TInt, med_int> aNbElem(theInfo.myNbElem);
-
- TErr aRet = MEDmeshNodeCoordinateRd(myFile->Id(),
- &aMeshName,
- MED_NO_DT,
- MED_NO_IT,
- aModeSwitch,
- &aCoord);
-
- TErr aRet2 =MEDmeshEntityFamilyNumberRd(myFile->Id(),
- &aMeshName,
- MED_NO_DT,
- MED_NO_IT,
- MED_NODE,
- MED_NO_GEOTYPE ,
- &aFamNum);
- if (aRet2 < 0)
- {
-// if (aRet2 == MED_ERR_DOESNTEXIST) // --- only valid with MED3.x files
- {
- int mySize = (int)theInfo.myFamNum->size();
- theInfo.myFamNum->clear();
- theInfo.myFamNum->resize(mySize,0);
- }
-// else
-// EXCEPTION(std::runtime_error,"GetNodeInfo - MEDmeshEntityFamilyNumberRd(...)");
- }
-
- if ( MEDmeshEntityNameRd(myFile->Id(),
- &aMeshName,
- MED_NO_DT,
- MED_NO_IT,
- MED_NODE,
- MED_NO_GEOTYPE ,
- &anElemNames) < 0) theInfo.myIsElemNames=eFAUX;
-
- if ( MEDmeshEntityNumberRd(myFile->Id(),
- &aMeshName,
- MED_NO_DT,
- MED_NO_IT,
- MED_NODE,
- MED_NO_GEOTYPE ,
- &anElemNum) < 0 ) theInfo.myIsElemNum=eFAUX;
-
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(std::runtime_error,"GetNodeInfo - MEDmeshNodeCoordinateRd(...)");
- }
-
- //----------------------------------------------------------------------------
- void
- TVWrapper
- ::SetNodeInfo(const MED::TNodeInfo& theInfo,
- EModeAcces theMode,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,theMode,theErr);
-
- if(theErr && *theErr < 0)
- return;
-
- MED::TNodeInfo& anInfo = const_cast<MED::TNodeInfo&>(theInfo);
- MED::TMeshInfo& aMeshInfo = *anInfo.myMeshInfo;
-
- TValueHolder<TString, char> aMeshName (aMeshInfo.myName);
- TValueHolder<TNodeCoord, med_float> aCoord (anInfo.myCoord);
- TValueHolder<EModeSwitch, med_switch_mode> aModeSwitch (anInfo.myModeSwitch);
- TValueHolder<ERepere, med_axis_type> aSystem (anInfo.mySystem);
- TValueHolder<TString, char> aCoordNames (anInfo.myCoordNames);
- TValueHolder<TString, char> aCoordUnits (anInfo.myCoordUnits);
- TValueHolder<TString, char> anElemNames (anInfo.myElemNames);
- TValueHolder<EBooleen, med_bool> anIsElemNames(anInfo.myIsElemNames);
- TValueHolder<TElemNum, med_int> anElemNum (anInfo.myElemNum);
- TValueHolder<EBooleen, med_bool> anIsElemNum (anInfo.myIsElemNum);
- TValueHolder<TElemNum, med_int> aFamNum (anInfo.myFamNum);
- TValueHolder<TInt, med_int> aNbElem (anInfo.myNbElem);
-
- TErr aRet = MEDmeshNodeCoordinateWr(myFile->Id(),
- &aMeshName,
- MED_NO_DT,
- MED_NO_IT,
- MED_NO_DT,
- aModeSwitch,
- aNbElem,
- &aCoord);
-
- MEDmeshEntityFamilyNumberWr(myFile->Id(),
- &aMeshName,
- MED_NO_DT,
- MED_NO_IT,
- MED_NODE,
- MED_NO_GEOTYPE,
- aNbElem,
- &aFamNum);
- if(anIsElemNames)
- MEDmeshEntityNameWr(myFile->Id(),
- &aMeshName,
- MED_NO_DT,
- MED_NO_IT,
- MED_NODE,
- MED_NO_GEOTYPE,
- aNbElem,
- &anElemNames);
- if(anIsElemNum)
- MEDmeshEntityNumberWr(myFile->Id(),
- &aMeshName,
- MED_NO_DT,
- MED_NO_IT,
- MED_NODE,
- MED_NO_GEOTYPE,
- aNbElem,
- &anElemNum);
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(std::runtime_error,"SetNodeInfo - MEDmeshNodeCoordinateWr(...)");
- }
-
- //----------------------------------------------------------------------------
- void
- TVWrapper
- ::SetNodeInfo(const MED::TNodeInfo& theInfo,
- TErr* theErr)
- {
- TErr aRet;
- SetNodeInfo(theInfo,eLECTURE_ECRITURE,&aRet);
-
- if(aRet < 0)
- SetNodeInfo(theInfo,eLECTURE_AJOUT,&aRet);
-
- if(theErr)
- *theErr = aRet;
- }
-
- //-----------------------------------------------------------------
- void
- TVWrapper
- ::GetPolygoneInfo(MED::TPolygoneInfo& theInfo,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
-
- if(theErr && *theErr < 0)
- return;
-
- MED::TMeshInfo& aMeshInfo = *theInfo.myMeshInfo;
-
- TValueHolder<TString, char > aMeshName(aMeshInfo.myName);
- TValueHolder<TElemNum, med_int > anIndex (theInfo.myIndex);
- TValueHolder<TElemNum, med_int > aConn (theInfo.myConn);
- TValueHolder<EEntiteMaillage, med_entity_type > anEntity (theInfo.myEntity);
- TValueHolder<EGeometrieElement, med_geometry_type> aGeom (theInfo.myGeom);
- TValueHolder<EConnectivite, med_connectivity_mode> aConnMode(theInfo.myConnMode);
- TInt aNbElem = (TInt)theInfo.myElemNum->size();
-
- TErr aRet;
- aRet = MEDmeshPolygon2Rd(myFile->Id(), &aMeshName,
- MED_NO_DT, MED_NO_IT,
- anEntity, aGeom,
- aConnMode, &anIndex, &aConn);
-
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(std::runtime_error,"GetPolygoneInfo - MEDmeshPolygonRd(...)");
-
- if(theInfo.myIsElemNames){
- GetNames(theInfo,aNbElem,theInfo.myEntity,theInfo.myGeom,&aRet);
- if(theErr)
- *theErr = aRet;
- }
-
- if(theInfo.myIsElemNum){
- GetNumeration(theInfo,aNbElem,theInfo.myEntity,theInfo.myGeom,&aRet);
- if(theErr)
- *theErr = aRet;
- }
-
- GetFamilies(theInfo,aNbElem,theInfo.myEntity,theInfo.myGeom,&aRet);
- if(theErr)
- *theErr = aRet;
- }
-
- //----------------------------------------------------------------------------
- void
- TVWrapper
- ::SetPolygoneInfo(const MED::TPolygoneInfo& theInfo,
- TErr* theErr)
- {
- SetPolygoneInfo(theInfo,eLECTURE_ECRITURE,theErr);
- }
-
- //----------------------------------------------------------------------------
- void
- TVWrapper
- ::SetPolygoneInfo(const MED::TPolygoneInfo& theInfo,
- EModeAcces theMode,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,theMode,theErr);
-
- if(theErr && *theErr < 0)
- return;
-
- MED::TPolygoneInfo& anInfo = const_cast<MED::TPolygoneInfo&>(theInfo);
- MED::TMeshInfo& aMeshInfo = *anInfo.myMeshInfo;
-
- TValueHolder<TString, char > aMeshName(aMeshInfo.myName);
- TValueHolder<TElemNum, med_int > anIndex (anInfo.myIndex);
- TValueHolder<TElemNum, med_int > aConn (anInfo.myConn);
- TValueHolder<EEntiteMaillage, med_entity_type > anEntity (anInfo.myEntity);
- TValueHolder<EGeometrieElement, med_geometry_type> aGeom (anInfo.myGeom);
- TValueHolder<EConnectivite, med_connectivity_mode> aConnMode(anInfo.myConnMode);
-
- TErr aRet = MEDmeshPolygon2Wr(myFile->Id(), &aMeshName,
- MED_NO_DT, MED_NO_IT, MED_UNDEF_DT,
- anEntity, aGeom,
- aConnMode, anInfo.myNbElem + 1,
- &anIndex, &aConn);
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(std::runtime_error,"SetPolygoneInfo - MEDmeshPolygonWr(...)");
-
- SetNames(anInfo,theInfo.myEntity,anInfo.myGeom,&aRet);
- if(theErr)
- *theErr = aRet;
-
- SetNumeration(anInfo,theInfo.myEntity,anInfo.myGeom,&aRet);
- if(theErr)
- *theErr = aRet;
-
- SetFamilies(anInfo,theInfo.myEntity,anInfo.myGeom,&aRet);
- if(theErr)
- *theErr = aRet;
- }
-
- //----------------------------------------------------------------------------
- TInt
- TVWrapper
- ::GetNbPolygones(const MED::TMeshInfo& theMeshInfo,
- EEntiteMaillage theEntity,
- EGeometrieElement theGeom,
- EConnectivite theConnMode,
- TErr* theErr)
- {
- return GetNbCells(theMeshInfo,theEntity,theGeom,theConnMode,theErr);
- }
-
- //----------------------------------------------------------------------------
- TInt
- TVWrapper
- ::GetPolygoneConnSize(const MED::TMeshInfo& theMeshInfo,
- EEntiteMaillage theEntity,
- EGeometrieElement theGeom,
- EConnectivite theConnMode,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
-
- if(theErr && *theErr < 0)
- return 0;
-
- MED::TMeshInfo& aMeshInfo = const_cast<MED::TMeshInfo&>(theMeshInfo);
-
- TValueHolder<TString, char> aMeshName(aMeshInfo.myName);
- med_int aTaille = 0;
- med_bool chgt,trsf;
- aTaille=MEDmeshnEntity(myFile->Id(),
- &aMeshName,
- MED_NO_DT,
- MED_NO_IT,
- med_entity_type(theEntity),
- med_geometry_type(theGeom),
- MED_CONNECTIVITY,
- med_connectivity_mode(theConnMode),
- &chgt,
- &trsf);
-
-
- if(aTaille < 0)
- EXCEPTION(std::runtime_error,"GetPolygoneInfo - MEDmeshnEntity(...)");
-
- return TInt(aTaille);
- }
-
- //-----------------------------------------------------------------
- void
- TVWrapper
- ::GetPolyedreInfo(TPolyedreInfo& theInfo,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
-
- if(theErr && *theErr < 0)
- return;
-
- MED::TMeshInfo& aMeshInfo = *theInfo.myMeshInfo;
-
- TValueHolder<TString, char> aMeshName(aMeshInfo.myName);
- TInt aNbElem = (TInt)theInfo.myElemNum->size();
- TValueHolder<TElemNum, med_int> anIndex(theInfo.myIndex);
- TValueHolder<TElemNum, med_int> aFaces(theInfo.myFaces);
- TValueHolder<TElemNum, med_int> aConn(theInfo.myConn);
- TValueHolder<EConnectivite, med_connectivity_mode> aConnMode(theInfo.myConnMode);
-
- TErr aRet;
- aRet = MEDmeshPolyhedronRd(myFile->Id(),
- &aMeshName,
- MED_NO_DT,
- MED_NO_IT,
- MED_CELL,
- aConnMode,
- &anIndex,
- &aFaces,
- &aConn);
-
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(std::runtime_error,"GetPolygoneInfo - MEDmeshPolyhedronRd(...)");
-
- if(theInfo.myIsElemNames){
- GetNames(theInfo,aNbElem,theInfo.myEntity,ePOLYEDRE,&aRet);
- if(theErr)
- *theErr = aRet;
- }
-
- if(theInfo.myIsElemNum){
- GetNumeration(theInfo,aNbElem,theInfo.myEntity,ePOLYEDRE,&aRet);
- if(theErr)
- *theErr = aRet;
- }
-
- GetFamilies(theInfo,aNbElem,theInfo.myEntity,ePOLYEDRE,&aRet);
- if(theErr)
- *theErr = aRet;
- }
-
- //----------------------------------------------------------------------------
- void
- TVWrapper
- ::SetPolyedreInfo(const TPolyedreInfo& theInfo,
- TErr* theErr)
- {
- SetPolyedreInfo(theInfo,eLECTURE_ECRITURE,theErr);
- }
-
- //----------------------------------------------------------------------------
- void
- TVWrapper
- ::SetPolyedreInfo(const MED::TPolyedreInfo& theInfo,
- EModeAcces theMode,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,theMode,theErr);
-
- if(theErr && *theErr < 0)
- return;
-
- MED::TPolyedreInfo& anInfo = const_cast<MED::TPolyedreInfo&>(theInfo);
- MED::TMeshInfo& aMeshInfo = *anInfo.myMeshInfo;
-
- TValueHolder<TString, char> aMeshName(aMeshInfo.myName);
- TValueHolder<TElemNum, med_int> anIndex(anInfo.myIndex);
- TValueHolder<TElemNum, med_int> aFaces(anInfo.myFaces);
- TValueHolder<TElemNum, med_int> aConn(anInfo.myConn);
- TValueHolder<EConnectivite, med_connectivity_mode> aConnMode(anInfo.myConnMode);
-
- TErr aRet;
- aRet = MEDmeshPolyhedronWr(myFile->Id(),
- &aMeshName,
- MED_NO_DT,
- MED_NO_IT,
- MED_UNDEF_DT,
- MED_CELL,
- aConnMode,
- anInfo.myNbElem+1,
- &anIndex,
- (TInt)anInfo.myFaces->size(),
- &aFaces,
- &aConn);
-
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(std::runtime_error,"SetPolyedreInfo - MEDmeshPolyhedronWr(...)");
-
- TValueHolder<EEntiteMaillage, med_entity_type> anEntity(anInfo.myEntity);
-
- if(theInfo.myIsElemNames){
- TValueHolder<TString, char> anElemNames(anInfo.myElemNames);
- aRet = MEDmeshEntityNameWr(myFile->Id(),
- &aMeshName,
- MED_NO_DT,
- MED_NO_IT,
- anEntity,
- MED_POLYHEDRON,
- (TInt)anInfo.myElemNames->size(),
- &anElemNames);
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(std::runtime_error,"SetPolyedreInfo - MEDmeshEntityNameWr(...)");
- }
-
- if(theInfo.myIsElemNum){
- TValueHolder<TElemNum, med_int> anElemNum(anInfo.myElemNum);
- aRet = MEDmeshEntityNumberWr(myFile->Id(),
- &aMeshName,
- MED_NO_DT,
- MED_NO_IT,
- anEntity,
- MED_POLYHEDRON,
- (TInt)anInfo.myElemNum->size(),
- &anElemNum);
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(std::runtime_error,"SetPolyedreInfo - MEDmeshEntityNumberWr(...)");
- }
-
-
- TValueHolder<TElemNum, med_int> aFamNum(anInfo.myFamNum);
- aRet = MEDmeshEntityFamilyNumberWr(myFile->Id(),
- &aMeshName,
- MED_NO_DT,
- MED_NO_IT,
- anEntity,
- MED_POLYHEDRON,
- (TInt)anInfo.myFamNum->size(),
- &aFamNum);
-
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(std::runtime_error,"SetPolyedreInfo - MEDmeshEntityFamilyNumberWr(...)");
- }
-
- //----------------------------------------------------------------------------
- TInt
- TVWrapper
- ::GetNbPolyedres(const MED::TMeshInfo& theMeshInfo,
- EEntiteMaillage theEntity,
- EGeometrieElement theGeom,
- EConnectivite theConnMode,
- TErr* theErr)
- {
- return GetNbCells(theMeshInfo,theEntity,theGeom,theConnMode,theErr);
- }
-
- //----------------------------------------------------------------------------
- void
- TVWrapper ::GetPolyedreConnSize(const TMeshInfo& theMeshInfo,
- TInt& theNbFaces,
- TInt& theConnSize,
- EConnectivite theConnMode,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
-
- if(theErr && *theErr < 0)
- EXCEPTION(std::runtime_error,"GetPolyedreConnSize - (...)");
-
- MED::TMeshInfo& aMeshInfo = const_cast<MED::TMeshInfo&>(theMeshInfo);
-
- TValueHolder<TString, char> aMeshName(aMeshInfo.myName);
- TValueHolder<EConnectivite, med_connectivity_mode> aConnMode(theConnMode);
- //TValueHolder<TInt, med_int> aNbFaces(theNbFaces);
- //TValueHolder<TInt, med_int> aConnSize(theConnSize);
-
- med_bool chgt,trsf;
- theNbFaces = MEDmeshnEntity(myFile->Id(),
- &aMeshName,
- MED_NO_DT,
- MED_NO_IT,
- MED_CELL,
- MED_POLYHEDRON,
- MED_INDEX_NODE,
- aConnMode,
- &chgt,
- &trsf);
-
- theConnSize = MEDmeshnEntity(myFile->Id(),
- &aMeshName,
- MED_NO_DT,
- MED_NO_IT,
- MED_CELL,
- MED_POLYHEDRON,
- MED_CONNECTIVITY,
- aConnMode,
- &chgt,
- &trsf);
-
- if(theNbFaces < 0 || theConnSize<0)
- EXCEPTION(std::runtime_error,"GetPolygoneInfo - MEDmeshnEntity(...)");
-
- }
-
- //-----------------------------------------------------------------
- TEntityInfo
- TVWrapper
- ::GetEntityInfo(const MED::TMeshInfo& theMeshInfo,
- EConnectivite theConnMode,
- TErr* theErr)
- {
- TEntityInfo anInfo;
-
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
-
- if(theErr && *theErr < 0)
- return anInfo;
-
- if(theMeshInfo.GetType() == eNON_STRUCTURE) {
- TInt aNbElem = GetNbNodes(theMeshInfo);
- if(aNbElem > 0){
- anInfo[eNOEUD][ePOINT1] = aNbElem;
- const TEntity2GeomSet& anEntity2GeomSet = GetEntity2GeomSet();
- TEntity2GeomSet::const_iterator anIter = anEntity2GeomSet.begin();
- TEntity2GeomSet::const_iterator anIterEnd = anEntity2GeomSet.end();
- for(; anIter != anIterEnd; anIter++){
- const EEntiteMaillage& anEntity = anIter->first;
- const TGeomSet& aGeomSet = anIter->second;
- TGeomSet::const_iterator anIter2 = aGeomSet.begin();
- TGeomSet::const_iterator anIterEnd2 = aGeomSet.end();
- for(; anIter2 != anIterEnd2; anIter2++){
- const EGeometrieElement& aGeom = *anIter2;
- aNbElem = GetNbCells(theMeshInfo,anEntity,aGeom,theConnMode,theErr);
- if(aNbElem > 0) {
- if ( anEntity == eSTRUCT_ELEMENT ) {
- const TInt nbStructTypes = aNbElem;
- for ( TInt structType = 0; structType < nbStructTypes; ++structType ) {
- // check type name to keep only "MED_BALL" structured element
- TValueHolder<TString, char> aMeshName((TString&) theMeshInfo.myName );
- char geotypename[ MED_NAME_SIZE + 1] = "";
- med_geometry_type geotype;
- MEDmeshEntityInfo( myFile->Id(), &aMeshName, MED_NO_DT, MED_NO_IT,
- med_entity_type(anEntity), structType+1,
- geotypename, &geotype);
- if ( strcmp( geotypename, MED_BALL_NAME ) == 0 ) {
- aNbElem = GetNbCells( theMeshInfo, anEntity, EGeometrieElement(geotype),
- theConnMode, theErr);
- if ( aNbElem > 0 )
- anInfo[anEntity][EGeometrieElement(geotype)] = aNbElem;
- }
- }
- }
- else {
- anInfo[anEntity][aGeom] = aNbElem;
- }
- }
- }
- }
- }
- } else { // eSTRUCTURE
- EGrilleType aGrilleType;
- TInt aNbNodes = 1;
- TInt aNbElem = 1;
- TInt aNbSub = 0;
- TInt aDim = theMeshInfo.GetDim();
- EGeometrieElement aGeom, aSubGeom;
- EEntiteMaillage aSubEntity = eMAILLE;
-
- GetGrilleType(theMeshInfo, aGrilleType);
-
- TIntVector aStruct(aDim);
- if(aGrilleType == eGRILLE_STANDARD)
- {
- GetGrilleStruct(theMeshInfo, aStruct, theErr);
- }
- else
- { // eGRILLE_CARTESIENNE and eGRILLE_POLAIRE
- ETable aTable[3] = { eCOOR_IND1, eCOOR_IND2, eCOOR_IND3 };
- for(med_int anAxis = 0; anAxis < aDim; anAxis++)
- aStruct[ anAxis ] = GetNbNodes(theMeshInfo, aTable[anAxis]);
- }
- for(med_int i = 0; i < aDim; i++){
- aNbNodes = aNbNodes * aStruct[i];
- aNbElem = aNbElem * (aStruct[i] - 1);
- }
- switch(aDim){
- case 1:
- aGeom = eSEG2;
- break;
- case 2:
- aGeom = eQUAD4;
- aSubGeom = eSEG2;
- aSubEntity = eARETE;
- aNbSub =
- (aStruct[0] ) * (aStruct[1]-1) +
- (aStruct[0]-1) * (aStruct[1] );
- break;
- case 3:
- aGeom = eHEXA8;
- aSubGeom = eQUAD4;
- aSubEntity = eFACE;
- aNbSub =
- (aStruct[0] ) * (aStruct[1]-1) * (aStruct[2]-1) +
- (aStruct[0]-1) * (aStruct[1] ) * (aStruct[2]-1) +
- (aStruct[0]-1) * (aStruct[1]-1) * (aStruct[2] );
- break;
- }
- anInfo[eNOEUD][ePOINT1] = aNbNodes;
- anInfo[eMAILLE][aGeom] = aNbElem;
- if ( aDim > 1 )
- anInfo[aSubEntity][aSubGeom] = aNbSub;
- }
- return anInfo;
- }
-
- //-----------------------------------------------------------------
- TInt TVWrapper::GetNbCells(const MED::TMeshInfo& theMeshInfo,
- EEntiteMaillage theEntity,
- EGeometrieElement theGeom,
- EConnectivite theConnMode,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
-
- if(theErr && *theErr < 0)
- return -1;
-
- MED::TMeshInfo& aMeshInfo = const_cast<MED::TMeshInfo&>(theMeshInfo);
- TValueHolder<TString, char> aMeshName(aMeshInfo.myName);
- med_bool chgt,trsf;
- switch ( theGeom )
- {
- case MED::ePOLYGONE:
- case MED::ePOLYGON2:
- {
- return MEDmeshnEntity(myFile->Id(),&aMeshName,
- MED_NO_DT,MED_NO_IT,
- med_entity_type(theEntity),med_geometry_type(theGeom),
- MED_INDEX_NODE,med_connectivity_mode(theConnMode),
- &chgt,&trsf)-1;
- }
- case MED::ePOLYEDRE:
- {
- return MEDmeshnEntity(myFile->Id(),&aMeshName,
- MED_NO_DT,MED_NO_IT,
- med_entity_type(theEntity),MED_POLYHEDRON,
- MED_INDEX_FACE,med_connectivity_mode(theConnMode),
- &chgt,&trsf)-1;
- }
- case MED::eBALL:
- {
- return GetNbBalls( theMeshInfo );
- }
- default:
- {
- return MEDmeshnEntity(myFile->Id(),&aMeshName,
- MED_NO_DT,MED_NO_IT,
- med_entity_type(theEntity),med_geometry_type(theGeom),
- MED_CONNECTIVITY,med_connectivity_mode(theConnMode),
- &chgt,&trsf);
- }
- }
- return 0;
- }
-
- //----------------------------------------------------------------------------
- void TVWrapper::GetCellInfo(MED::TCellInfo& theInfo, TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
-
- if(theErr && *theErr < 0)
- return;
-
- MED::TMeshInfo& aMeshInfo = *theInfo.myMeshInfo;
-
- TValueHolder<TString, char> aMeshName (aMeshInfo.myName);
- TValueHolder<TElemNum, med_int> aConn (theInfo.myConn);
- TValueHolder<EModeSwitch, med_switch_mode> aModeSwitch (theInfo.myModeSwitch);
- TValueHolder<TString, char> anElemNames (theInfo.myElemNames);
- TValueHolder<EBooleen, med_bool> anIsElemNames(theInfo.myIsElemNames);
- TValueHolder<TElemNum, med_int> anElemNum (theInfo.myElemNum);
- TValueHolder<EBooleen, med_bool> anIsElemNum (theInfo.myIsElemNum);
- TValueHolder<TElemNum, med_int> aFamNum (theInfo.myFamNum);
- TValueHolder<EBooleen, med_bool> anIsFamNum (theInfo.myIsFamNum);
- TValueHolder<EEntiteMaillage, med_entity_type> anEntity (theInfo.myEntity);
- TValueHolder<EGeometrieElement, med_geometry_type> aGeom (theInfo.myGeom);
- TValueHolder<EConnectivite, med_connectivity_mode> aConnMode (theInfo.myConnMode);
-
- TErr aRet;
- aRet = MEDmeshElementRd(myFile->Id(),
- &aMeshName,
- MED_NO_DT,
- MED_NO_IT,
- anEntity,
- aGeom,
- aConnMode,
- aModeSwitch,
- &aConn,
- &anIsElemNames,
- &anElemNames,
- &anIsElemNum,
- &anElemNum,
- &anIsFamNum,
- &aFamNum);
-
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(std::runtime_error,"GetCellInfo - MEDmeshElementRd(...)");
-
- if (anIsFamNum == MED_FALSE)
- {
- int mySize = (int) theInfo.myFamNum->size();
- theInfo.myFamNum->clear();
- theInfo.myFamNum->resize(mySize, 0);
- }
-
- }
-
- //----------------------------------------------------------------------------
- void
- TVWrapper
- ::SetCellInfo(const MED::TCellInfo& theInfo,
- EModeAcces theMode,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,theMode,theErr);
-
- if(theErr && *theErr < 0)
- return;
-
- MED::TCellInfo& anInfo = const_cast<MED::TCellInfo&>(theInfo);
- MED::TMeshInfo& aMeshInfo = *anInfo.myMeshInfo;
-
- TValueHolder<TString, char> aMeshName (aMeshInfo.myName);
- TValueHolder<TElemNum, med_int> aConn (anInfo.myConn);
- TValueHolder<EModeSwitch, med_switch_mode> aModeSwitch (anInfo.myModeSwitch);
- TValueHolder<TString, char> anElemNames (anInfo.myElemNames);
- TValueHolder<EBooleen, med_bool> anIsElemNames(anInfo.myIsElemNames);
- TValueHolder<TElemNum, med_int> anElemNum (anInfo.myElemNum);
- TValueHolder<EBooleen, med_bool> anIsElemNum (anInfo.myIsElemNum);
- TValueHolder<TElemNum, med_int> aFamNum (anInfo.myFamNum);
- TValueHolder<EBooleen, med_bool> anIsFamNum (anInfo.myIsFamNum);
- TValueHolder<EEntiteMaillage, med_entity_type> anEntity (anInfo.myEntity);
- TValueHolder<EGeometrieElement, med_geometry_type> aGeom (anInfo.myGeom);
- TValueHolder<EConnectivite, med_connectivity_mode> aConnMode (anInfo.myConnMode);
- TValueHolder<TInt, med_int> aNbElem (anInfo.myNbElem);
-
- TErr aRet;
- aRet = MEDmeshElementConnectivityWr(myFile->Id(),
- &aMeshName,
- MED_NO_DT,
- MED_NO_IT,
- MED_UNDEF_DT,
- anEntity,
- aGeom,
- aConnMode,
- aModeSwitch,
- aNbElem,
- &aConn);
-
- MEDmeshEntityFamilyNumberWr(myFile->Id(),
- &aMeshName,
- MED_NO_DT,
- MED_NO_IT,
- anEntity,
- aGeom,
- aNbElem,
- &aFamNum);
- if(anIsElemNames)
- MEDmeshEntityNameWr(myFile->Id(),
- &aMeshName,
- MED_NO_DT,
- MED_NO_IT,
- anEntity,
- aGeom,
- aNbElem,
- &anElemNames);
- if(anIsElemNum)
- MEDmeshEntityNumberWr(myFile->Id(),
- &aMeshName,
- MED_NO_DT,
- MED_NO_IT,
- anEntity,
- aGeom,
- aNbElem,
- &anElemNum);
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(std::runtime_error,"SetCellInfo - MEDmeshElementWr(...)");
- }
-
- //----------------------------------------------------------------------------
- void
- TVWrapper
- ::SetCellInfo(const MED::TCellInfo& theInfo,
- TErr* theErr)
- {
- SetCellInfo(theInfo,eLECTURE_ECRITURE,theErr);
- }
-
- //----------------------------------------------------------------------------
- //! Read geom type of MED_BALL structural element
- EGeometrieElement TVWrapper::GetBallGeom(const TMeshInfo& theMeshInfo)
- {
- TFileWrapper aFileWrapper(myFile,eLECTURE);
-
- // read med_geometry_type of "MED_BALL" element
- char geotypename[ MED_NAME_SIZE + 1] = MED_BALL_NAME;
- return EGeometrieElement( MEDstructElementGeotype( myFile->Id(), geotypename ) );
- }
-
- //----------------------------------------------------------------------------
- //! Read number of balls in the Mesh
- TInt TVWrapper::GetNbBalls(const TMeshInfo& theMeshInfo)
- {
- TFileWrapper aFileWrapper(myFile,eLECTURE);
-
- EGeometrieElement ballType = GetBallGeom( theMeshInfo );
- if ( ballType < 0 )
- return 0;
-
- return GetNbCells( theMeshInfo, eSTRUCT_ELEMENT, ballType, eNOD );
- }
-
- //----------------------------------------------------------------------------
- //! Read a MEDWrapped representation of MED_BALL from the MED file
- void TVWrapper::GetBallInfo(TBallInfo& theInfo, TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
-
- // check geometry of MED_BALL
- if ( theInfo.myGeom == eBALL )
- {
- theInfo.myGeom = GetBallGeom( *theInfo.myMeshInfo );
- if ( theInfo.myGeom < 0 ) {
- if ( !theErr )
- EXCEPTION(std::runtime_error,"GetBallInfo - no balls in the mesh");
- *theErr = theInfo.myGeom;
- return;
- }
- }
-
- // read nodes ids
- GetCellInfo( theInfo );
-
- // read diameters
- TValueHolder<TString, char> aMeshName (theInfo.myMeshInfo->myName);
- TValueHolder<EGeometrieElement, med_geometry_type> aGeom (theInfo.myGeom);
- TValueHolder<TFloatVector, void> aDiam (theInfo.myDiameters);
- char varattname[ MED_NAME_SIZE + 1] = MED_BALL_DIAMETER;
-
- TErr aRet = MEDmeshStructElementVarAttRd( myFile->Id(), &aMeshName,
- MED_NO_DT, MED_NO_IT,
- aGeom,
- varattname,
- &aDiam);
- if ( theErr )
- *theErr = aRet;
- else if ( aRet < 0 )
- EXCEPTION(std::runtime_error,"GetBallInfo - pb at reading diameters");
- }
-
- //----------------------------------------------------------------------------
- //! 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);
-
- TErr ret;
- char ballsupportname[MED_NAME_SIZE+1]="BALL_SUPPORT_MESH";
- EGeometrieElement ballGeom = GetBallGeom( *theInfo.myMeshInfo );
- if ( ballGeom < 0 )
- {
- // no ball model in the file, create support mesh for it
- char dummyname [MED_NAME_SIZE*3+1]="";
- if (( ret = MEDsupportMeshCr( myFile->Id(),
- ballsupportname,
- theInfo.myMeshInfo->GetSpaceDim(),
- theInfo.myMeshInfo->GetDim(),
- "Support mesh for a ball model",
- MED_CARTESIAN,
- /*axisname=*/dummyname, /*unitname=*/dummyname)) < 0) {
- if ( !theErr )
- EXCEPTION(std::runtime_error,"SetBallInfo - MEDsupportMeshCr");
- *theErr = ret;
- return;
- }
- // write coordinates of 1 node
- med_float coord[3] = {0,0,0};
- if ((ret = MEDmeshNodeCoordinateWr(myFile->Id(),
- ballsupportname, MED_NO_DT, MED_NO_IT, 0.0,
- MED_FULL_INTERLACE, /*nnode=*/1, coord)) < 0) {
- if ( !theErr )
- EXCEPTION(std::runtime_error,"SetBallInfo - MEDmeshNodeCoordinateWr");
- *theErr = ret;
- return;
- }
- // ball model creation
- char geotypename[ MED_NAME_SIZE + 1] = MED_BALL_NAME;
- if (( ballGeom = (EGeometrieElement) MEDstructElementCr(myFile->Id(),
- geotypename,
- theInfo.myMeshInfo->GetSpaceDim(),
- ballsupportname,
- MED_NODE,MED_NONE)) < 0 ) {
- if ( !theErr )
- EXCEPTION(std::runtime_error,"SetBallInfo - MEDstructElementCr");
- *theErr = ret;
- return;
- }
- // create diameter attribute
- if (( ret = MEDstructElementVarAttCr(myFile->Id(),
- geotypename, MED_BALL_DIAMETER,
- MED_ATT_FLOAT64, /*ncomp=*/1)) < 0) {
- if ( !theErr )
- EXCEPTION(std::runtime_error,"SetBallInfo - MEDstructElementVarAttCr");
- *theErr = ret;
- return;
- }
- } // ballGeom < 0
-
- TBallInfo& aBallInfo = ((TBallInfo&) theInfo );
- aBallInfo.myGeom = ballGeom;
-
- // write node ids
- SetCellInfo(theInfo,theMode,theErr);
- if ( theErr && theErr < 0 )
- return;
-
- // write diameter
- TValueHolder<TString, char> aMeshName (aBallInfo.myMeshInfo->myName);
- TValueHolder<EGeometrieElement, med_geometry_type> aGeom (aBallInfo.myGeom);
- TValueHolder<TFloatVector, void> aDiam (aBallInfo.myDiameters);
- ret = MEDmeshStructElementVarAttWr(myFile->Id(), &aMeshName,
- MED_NO_DT, MED_NO_IT,
- aGeom, MED_BALL_DIAMETER,
- theInfo.myNbElem, &aDiam);
- if ( theErr )
- *theErr = ret;
- else if ( ret < 0 )
- EXCEPTION(std::runtime_error,"SetBallInfo - MEDmeshStructElementVarAttWr");
- }
-
- //----------------------------------------------------------------------------
- //! Write a MEDWrapped representation of MED_BALL to the MED file
- void TVWrapper::SetBallInfo(const TBallInfo& theInfo, TErr* theErr)
- {
- SetBallInfo( theInfo, eLECTURE_ECRITURE, theErr );
- }
-
- //-----------------------------------------------------------------
- TInt
- TVWrapper
- ::GetNbFields(TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
-
- if(theErr && *theErr < 0)
- return -1;
-
- return MEDnField(myFile->Id());
- }
-
- //----------------------------------------------------------------------------
- TInt
- TVWrapper
- ::GetNbComp(TInt theFieldId,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
-
- if(theErr && *theErr < 0)
- return -1;
-
- return MEDfieldnComponent(myFile->Id(),theFieldId);
- }
-
- //----------------------------------------------------------------------------
- void
- TVWrapper
- ::GetFieldInfo(TInt theFieldId,
- MED::TFieldInfo& theInfo,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
-
- if(theErr && *theErr < 0)
- return;
-
- TString aFieldName(256); // Protect from memory problems with too long names
- TValueHolder<ETypeChamp, med_field_type> aType(theInfo.myType);
- TValueHolder<TString, char> aCompNames(theInfo.myCompNames);
- TValueHolder<TString, char> anUnitNames(theInfo.myUnitNames);
- MED::TMeshInfo& aMeshInfo = theInfo.myMeshInfo;
-
- TErr aRet;
- med_bool local;
- char dtunit[MED_SNAME_SIZE+1];
- char local_mesh_name[MED_NAME_SIZE+1]="";
- med_int nbofstp;
- theInfo.myNbComp = MEDfieldnComponent(myFile->Id(),theFieldId);
- aRet = MEDfieldInfo(myFile->Id(),
- theFieldId,
- &aFieldName[0],
- local_mesh_name,
- &local,
- &aType,
- &aCompNames,
- &anUnitNames,
- dtunit,
- &nbofstp);
-
- if(strcmp(&aMeshInfo.myName[0],local_mesh_name) != 0 ) {
- if(theErr)
- *theErr = -1;
- return;
- }
-
- theInfo.SetName(aFieldName);
-
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(std::runtime_error,"GetFieldInfo - MEDfieldInfo(...)");
- }
-
- //----------------------------------------------------------------------------
- void
- TVWrapper
- ::SetFieldInfo(const MED::TFieldInfo& theInfo,
- EModeAcces theMode,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,theMode,theErr);
-
- if(theErr && *theErr < 0)
- return;
-
- MED::TFieldInfo& anInfo = const_cast<MED::TFieldInfo&>(theInfo);
-
- TValueHolder<TString, char> aFieldName(anInfo.myName);
- TValueHolder<ETypeChamp, med_field_type> aType(anInfo.myType);
- TValueHolder<TString, char> aCompNames(anInfo.myCompNames);
- TValueHolder<TString, char> anUnitNames(anInfo.myUnitNames);
- MED::TMeshInfo& aMeshInfo = anInfo.myMeshInfo;
- TErr aRet;
- char dtunit[MED_SNAME_SIZE+1];
- std::fill(dtunit,dtunit+MED_SNAME_SIZE+1,'\0');
- aRet = MEDfieldCr(myFile->Id(),
- &aFieldName,
- aType,
- anInfo.myNbComp,
- &aCompNames,
- &anUnitNames,
- dtunit,
- &aMeshInfo.myName[0]);
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(std::runtime_error,"SetFieldInfo - MEDfieldCr(...)");
- }
-
- //----------------------------------------------------------------------------
- void
- TVWrapper
- ::SetFieldInfo(const MED::TFieldInfo& theInfo,
- TErr* theErr)
- {
- TErr aRet;
- SetFieldInfo(theInfo,eLECTURE_ECRITURE,&aRet);
-
- if(aRet < 0)
- SetFieldInfo(theInfo,eLECTURE_AJOUT,&aRet);
-
- if(theErr)
- *theErr = aRet;
- }
-
- //----------------------------------------------------------------------------
- TInt
- TVWrapper
- ::GetNbGauss(TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
-
- if(theErr && *theErr < 0)
- return -1;
-
- return MEDnLocalization(myFile->Id());
- }
-
- //----------------------------------------------------------------------------
- TGaussInfo::TInfo
- TVWrapper
- ::GetGaussPreInfo(TInt theId,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
-
- if(theErr && *theErr < 0)
- return TGaussInfo::TInfo( TGaussInfo::TKey(ePOINT1,""),0 );
-
- med_int aNbGaussPoints = med_int();
- TVector<char> aName(GetNOMLength()+1);
- med_geometry_type aGeom = MED_NONE;
-
- TErr aRet;
- med_int dim;
- char geointerpname[MED_NAME_SIZE+1]="";
- char ipointstructmeshname[MED_NAME_SIZE+1]="";
- med_int nsectionmeshcell;
- med_geometry_type sectiongeotype;
- aRet = MEDlocalizationInfo (myFile->Id(),
- theId,
- &aName[0],
- &aGeom,
- &dim,
- &aNbGaussPoints,
- geointerpname,
- ipointstructmeshname,
- &nsectionmeshcell,
- §iongeotype);
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(std::runtime_error,"GetGaussPreInfo - MEDlocalizationInfo(...)");
- return TGaussInfo::TInfo(TGaussInfo::TKey(EGeometrieElement(aGeom),&aName[0]),
- TInt(aNbGaussPoints));
- }
-
- //----------------------------------------------------------------------------
- void
- TVWrapper
- ::GetGaussInfo(TInt theId,
- TGaussInfo& theInfo,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
-
- if(theErr && *theErr < 0)
- return;
-
- TValueHolder<TNodeCoord, med_float> aRefCoord(theInfo.myRefCoord);
- TValueHolder<TNodeCoord, med_float> aGaussCoord(theInfo.myGaussCoord);
- TValueHolder<TWeight, med_float> aWeight(theInfo.myWeight);
- TValueHolder<EModeSwitch, med_switch_mode> aModeSwitch(theInfo.myModeSwitch);
- TValueHolder<TString, char> aGaussName(theInfo.myName);
-
- TErr aRet;
- aRet = MEDlocalizationRd(myFile->Id(),
- &aGaussName,
- aModeSwitch,
- &aRefCoord,
- &aGaussCoord,
- &aWeight);
-
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(std::runtime_error,"GetGaussInfo - MEDlocalizationRd(...)");
- }
-
- //----------------------------------------------------------------------------
- TInt
- TVWrapper
- ::GetNbProfiles(TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
-
- if(theErr && *theErr < 0)
- return -1;
-
- return MEDnProfile(myFile->Id());
- }
-
- TProfileInfo::TInfo
- TVWrapper
- ::GetProfilePreInfo(TInt theId,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
-
- if(theErr && *theErr < 0)
- return TProfileInfo::TInfo();
-
- med_int aSize = -1;
- TVector<char> aName(GetNOMLength()+1);
-
- TErr aRet;
- aRet = MEDprofileInfo(myFile->Id(),
- theId,
- &aName[0],
- &aSize);
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(std::runtime_error,"GetProfilePreInfo - MEDprofileInfo(...)");
-
- return TProfileInfo::TInfo(&aName[0],aSize);
- }
-
- void
- TVWrapper
- ::GetProfileInfo(TInt theId,
- TProfileInfo& theInfo,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
-
- if(theErr && *theErr < 0)
- return;
-
- TProfileInfo& anInfo = const_cast<TProfileInfo&>(theInfo);
- TValueHolder<TElemNum, med_int> anElemNum(anInfo.myElemNum);
- TValueHolder<TString, char> aProfileName(anInfo.myName);
-
- TErr aRet;
- aRet = MEDprofileRd(myFile->Id(),
- &aProfileName,
- &anElemNum);
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(std::runtime_error,"GetProfileInfo - MEDprofileRd(...)");
- }
-
- void
- TVWrapper
- ::SetProfileInfo(const TProfileInfo& theInfo,
- EModeAcces theMode,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,theMode,theErr);
-
- if(theErr && *theErr < 0)
- return;
-
- TProfileInfo& anInfo = const_cast<TProfileInfo&>(theInfo);
- TValueHolder<TElemNum, med_int> anElemNum(anInfo.myElemNum);
- TValueHolder<TString, char> aProfileName(anInfo.myName);
-
- TErr aRet;
- aRet = MEDprofileWr(myFile->Id(), // descripteur du fichier.
- &aProfileName, // tableau de valeurs du profil.
- theInfo.GetSize(), // taille du profil.
- &anElemNum); // nom profil.
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(std::runtime_error,"SetProfileInfo - MEDprofileWr(...)");
- }
-
- void
- TVWrapper
- ::SetProfileInfo(const TProfileInfo& theInfo,
- TErr* theErr)
- {
- TErr aRet;
- SetProfileInfo(theInfo,eLECTURE_ECRITURE,&aRet);
-
- if(aRet < 0)
- SetProfileInfo(theInfo,eLECTURE_AJOUT,&aRet);
-
- if(aRet < 0)
- SetProfileInfo(theInfo,eCREATION,&aRet);
-
- if(theErr)
- *theErr = aRet;
- }
-
- //-----------------------------------------------------------------
- TInt
- TVWrapper
- ::GetNbTimeStamps(const MED::TFieldInfo& theInfo,
- const MED::TEntityInfo& theEntityInfo,
- EEntiteMaillage& theEntity,
- TGeom2Size& theGeom2Size,
- TErr* theErr)
- {
- theEntity = EEntiteMaillage(-1);
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
-
- if(theErr){
- if(theEntityInfo.empty())
- *theErr = -1;
- if(*theErr < 0)
- return -1;
- }else if(theEntityInfo.empty())
- EXCEPTION(std::runtime_error,"GetNbTimeStamps - There is no any Entity on the Mesh");
-
- bool anIsPerformAdditionalCheck = GetNbMeshes() > 1;
-
- theGeom2Size.clear();
- TInt aNbTimeStamps = 0;
- TIdt anId = myFile->Id();
-
- MED::TFieldInfo& anInfo = const_cast<MED::TFieldInfo&>(theInfo);
- TValueHolder<TString, char> aFieldName(anInfo.myName);
- MED::TMeshInfo& aMeshInfo = anInfo.myMeshInfo;
-
- // workaround for IPAL13676
- MED::TEntityInfo localEntityInfo = theEntityInfo;
- TEntityInfo::iterator anLocalIter = localEntityInfo.find(eMAILLE);
- if(anLocalIter != localEntityInfo.end()){
- localEntityInfo[eNOEUD_ELEMENT] = anLocalIter->second;
- }
-
- TEntityInfo::const_iterator anIter = localEntityInfo.begin();
- for(; anIter != localEntityInfo.end(); anIter++){
- med_entity_type anEntity = med_entity_type(anIter->first);
- const TGeom2Size& aGeom2Size = anIter->second;
- TGeom2Size::const_iterator anGeomIter = aGeom2Size.begin();
- for(; anGeomIter != aGeom2Size.end(); anGeomIter++){
- med_geometry_type aGeom = med_geometry_type(anGeomIter->first);
- char aMeshName[MED_NAME_SIZE+1];
- med_bool islocal;
- med_field_type ft;
- char dtunit[MED_SNAME_SIZE+1];
- med_int myNbComp = MEDfieldnComponentByName(anId,&aFieldName);
- char *cname=new char[myNbComp*MED_SNAME_SIZE+1];
- char *unitname=new char[myNbComp*MED_SNAME_SIZE+1];
- TInt aNbStamps;
- MEDfieldInfoByName(anId,
- &aFieldName,
- aMeshName,
- &islocal,
- &ft,
- cname,
- unitname,
- dtunit,
- &aNbStamps);
- delete [] cname;
- delete [] unitname;
- med_int nval = 0;
- med_int aNumDt;
- med_int aNumOrd;
- med_float aDt;
- if (aNbStamps > 0)
- {
- MEDfieldComputingStepInfo(anId,
- &aFieldName,
- 1,
- &aNumDt,
- &aNumOrd,
- &aDt);
- char profilename[MED_NAME_SIZE+1];
- char locname[MED_NAME_SIZE+1];
- med_int profilsize;
- med_int aNbGauss;
-
- // protection from crash (division by zero)
- // inside MEDfieldnValueWithProfile function
- // caused by the workaround for IPAL13676 (see above)
- if( anEntity == MED_NODE_ELEMENT && aGeom % 100 == 0 )
- continue;
-
- nval = MEDfieldnValueWithProfile(anId,
- &aFieldName,
- aNumDt,
- aNumOrd,
- anEntity,
- med_geometry_type(aGeom),
- 1,
- MED_COMPACT_STMODE,
- profilename,
- &profilsize,
- locname,
- &aNbGauss);
- }
- bool anIsSatisfied =(nval > 0);
- if(anIsSatisfied){
- INITMSG(MYDEBUG,
- "GetNbTimeStamps aNbTimeStamps = "<<aNbStamps<<
- "; aGeom = "<<aGeom<<"; anEntity = "<<anEntity<<"\n");
- if(anIsPerformAdditionalCheck){
- anIsSatisfied = !strcmp(&aMeshName[0],&aMeshInfo.myName[0]);
- if(!anIsSatisfied){
- INITMSG(MYDEBUG,
- "GetNbTimeStamps aMeshName = '"<<&aMeshName[0]<<"' != "<<
- "; aMeshInfo.myName = '"<<&aMeshInfo.myName[0]<<"'\n");
- }
- }
- }
- if(anIsSatisfied){
- theGeom2Size[EGeometrieElement(aGeom)] = anGeomIter->second;
- theEntity = EEntiteMaillage(anEntity);
- aNbTimeStamps = aNbStamps;
- }
- }
- if(!theGeom2Size.empty())
- break;
- }
- return aNbTimeStamps;
- }
-
- //----------------------------------------------------------------------------
- void
- TVWrapper
- ::GetTimeStampInfo(TInt theTimeStampId,
- MED::TTimeStampInfo& theInfo,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
-
- const TGeom2Size& aGeom2Size = theInfo.myGeom2Size;
-
- if(theErr){
- if(aGeom2Size.empty())
- *theErr = -1;
- if(*theErr < 0)
- return;
- }else if(aGeom2Size.empty())
- EXCEPTION(std::runtime_error,"GetTimeStampInfo - There is no any cell");
-
- MED::TFieldInfo& aFieldInfo = *theInfo.myFieldInfo;
- MED::TMeshInfo& aMeshInfo = *aFieldInfo.myMeshInfo;
-
- TValueHolder<TString, char> aFieldName(aFieldInfo.myName);
- TValueHolder<EEntiteMaillage, med_entity_type> anEntity(theInfo.myEntity);
- TValueHolder<TInt, med_int> aNumDt(theInfo.myNumDt);
- TValueHolder<TInt, med_int> aNumOrd(theInfo.myNumOrd);
- TValueHolder<TString, char> anUnitDt(theInfo.myUnitDt);
- TValueHolder<TFloat, med_float> aDt(theInfo.myDt);
- TValueHolder<TString, char> aMeshName(aMeshInfo.myName);
- TValueHolder<EBooleen, med_bool> anIsLocal(aFieldInfo.myIsLocal);
- TValueHolder<TInt, med_int> aNbRef(aFieldInfo.myNbRef);
-
- TGeom2NbGauss& aGeom2NbGauss = theInfo.myGeom2NbGauss;
-
- // just to get a time stamp unit (anUnitDt)
- med_field_type aFieldType;
- med_int aNbComp = MEDfieldnComponentByName(myFile->Id(), &aFieldName);
- char *aCompName = new char[aNbComp*MED_SNAME_SIZE+1];
- char *aCompUnit = new char[aNbComp*MED_SNAME_SIZE+1];
- TInt aNbStamps;
- MEDfieldInfoByName(myFile->Id(),
- &aFieldName,
- &aMeshName,
- &anIsLocal,
- &aFieldType,
- aCompName,
- aCompUnit,
- &anUnitDt,
- &aNbStamps);
- delete [] aCompName;
- delete [] aCompUnit;
-
- TGeom2Size::const_iterator anIter = aGeom2Size.begin();
- for(; anIter != aGeom2Size.end(); anIter++){
- const EGeometrieElement& aGeom = anIter->first;
- med_int aNbGauss = -1;
-
- TErr aRet;
- aRet = MEDfieldComputingStepInfo(myFile->Id(),
- &aFieldName,
- theTimeStampId,
- &aNumDt,
- &aNumOrd,
- &aDt);
- char profilename[MED_NAME_SIZE+1];
- med_int profilsize;
- char locname[MED_NAME_SIZE+1];
- MEDfieldnValueWithProfile(myFile->Id(),
- &aFieldName,
- aNumDt,
- aNumOrd,
- anEntity,
- med_geometry_type(aGeom),
- 1,
- MED_COMPACT_STMODE,
- profilename,
- &profilsize,
- locname,
- &aNbGauss);
-
- static TInt MAX_NB_GAUSS_POINTS = 32;
- if(aNbGauss <= 0 || aNbGauss > MAX_NB_GAUSS_POINTS)
- aNbGauss = 1;
-
- aGeom2NbGauss[aGeom] = aNbGauss;
-
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(std::runtime_error,"GetTimeStampInfo - MEDfieldnValueWithProfile(...)");
- }
- }
-
- //----------------------------------------------------------------------------
- void
- TVWrapper
- ::GetTimeStampValue(const PTimeStampValueBase& theTimeStampValue,
- const TMKey2Profile& theMKey2Profile,
- const TKey2Gauss& theKey2Gauss,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
-
- if(theErr && *theErr < 0)
- return;
-
- TIdt anId = myFile->Id();
-
- TValueHolder<EModeSwitch, med_switch_mode> aModeSwitch(theTimeStampValue->myModeSwitch);
- MED::TGeom2Profile& aGeom2Profile = theTimeStampValue->myGeom2Profile;
-
- MED::PTimeStampInfo aTimeStampInfo = theTimeStampValue->myTimeStampInfo;
- TValueHolder<EEntiteMaillage, med_entity_type> anEntity(aTimeStampInfo->myEntity);
- TValueHolder<TInt, med_int> aNumDt(aTimeStampInfo->myNumDt);
- TValueHolder<TInt, med_int> aNumOrd(aTimeStampInfo->myNumOrd);
-
- MED::PFieldInfo aFieldInfo = aTimeStampInfo->myFieldInfo;
- TValueHolder<TString, char> aFieldName(aFieldInfo->myName);
- TValueHolder<EBooleen, med_bool> anIsLocal(aFieldInfo->myIsLocal);
-
- MED::PMeshInfo aMeshInfo = aFieldInfo->myMeshInfo;
- TValueHolder<TString, char> aMeshName(aMeshInfo->myName);
-
- TGeom2Gauss& aGeom2Gauss = aTimeStampInfo->myGeom2Gauss;
- TVector<char> aGaussName(GetNOMLength()+1);
-
- med_storage_mode aProfileMode = med_storage_mode(boost::get<0>(theMKey2Profile));
- MED::TKey2Profile aKey2Profile = boost::get<1>(theMKey2Profile);
- TVector<char> aProfileName(GetNOMLength()+1);
-
- TGeom2Size& aGeom2Size = aTimeStampInfo->myGeom2Size;
- TGeom2Size::iterator anIter = aGeom2Size.begin();
- for(; anIter != aGeom2Size.end(); anIter++){
- EGeometrieElement aGeom = anIter->first;
- TInt aNbElem = anIter->second;
- med_int profilesize,aNbGauss;
-
- TInt aNbVal = MEDfieldnValueWithProfile(anId,
- &aFieldName,
- aNumDt,
- aNumOrd,
- anEntity,
- med_geometry_type(aGeom),
- 1,
- aProfileMode,
- &aProfileName[0],
- &profilesize,
- &aGaussName[0],
- &aNbGauss);
-
- if(aNbVal <= 0){
- if(theErr){
- *theErr = -1;
- return;
- }
- EXCEPTION(std::runtime_error,"GetTimeStampValue - MEDfieldnValueWithProfile(...) - aNbVal == "<<aNbVal<<" <= 0");
- }
-
- TInt aNbComp = aFieldInfo->myNbComp;
- TInt aNbValue = aNbVal;// / aNbGauss; rules in MED changed
- theTimeStampValue->AllocateValue(aGeom,
- aNbValue,
- aNbGauss,
- aNbComp);
- TInt aValueSize = theTimeStampValue->GetValueSize(aGeom);
-
- INITMSG(MYDEBUG,
- "TVWrapper::GetTimeStampValue - aGeom = "<<aGeom<<
- "; aNbVal = "<<aNbVal<<
- "; aNbValue = "<<aNbValue<<
- "; aNbGauss = "<<aNbGauss<<
- "; aNbComp = "<<aNbComp<<
- std::endl);
-
- TErr aRet = MEDfieldValueWithProfileRd(anId,
- &aFieldName,
- aNumDt,
- aNumOrd,
- anEntity,
- med_geometry_type(aGeom),
- aProfileMode,
- &aProfileName[0],
- aModeSwitch,
- MED_ALL_CONSTITUENT,
- theTimeStampValue->GetValuePtr(aGeom));
- if(aRet < 0){
- if(theErr){
- *theErr = MED_FALSE;
- return;
- }
- EXCEPTION(std::runtime_error,"GetTimeStampValue - MEDfieldValueWithProfileRd(...)");
- }
-
- MED::PGaussInfo aGaussInfo;
- TGaussInfo::TKey aKey(aGeom,&aGaussName[0]);
- if(strcmp(&aGaussName[0],"") != 0){
- MED::TKey2Gauss::const_iterator anIter = theKey2Gauss.find(aKey);
- if(anIter != theKey2Gauss.end()){
- aGaussInfo = anIter->second;
- aGeom2Gauss[aGeom] = aGaussInfo;
- }
- }
-
- MED::PProfileInfo aProfileInfo;
- if(strcmp(&aProfileName[0],MED_NO_PROFILE) != 0){
- MED::TKey2Profile::const_iterator anIter = aKey2Profile.find(&aProfileName[0]);
- if(anIter != aKey2Profile.end()){
- aProfileInfo = anIter->second;
- aGeom2Profile[aGeom] = aProfileInfo;
- }
- }
-
- if(aGaussInfo && aNbGauss != aGaussInfo->GetNbGauss()){
- if(theErr){
- *theErr = MED_FALSE;
- return;
- }
- EXCEPTION(std::runtime_error,"GetTimeStampValue - aNbGauss != aGaussInfo->GetNbGauss()");
- }
-
- if(aProfileInfo && aProfileInfo->IsPresent()){
- TInt aNbSubElem = aProfileInfo->GetSize();
- TInt aProfileSize = aNbSubElem*aNbComp*aNbGauss;
- if(aProfileSize != aValueSize){
- if(theErr){
- *theErr = -1;
- return;
- }
- EXCEPTION(std::runtime_error,
- "GetTimeStampValue - aProfileSize("<<aProfileSize<<
- ") != aValueSize("<<aValueSize<<
- "); aNbVal = "<<aNbVal<<
- "; anEntity = "<<anEntity<<
- "; aGeom = "<<aGeom<<
- "; aNbElem = "<<aNbElem<<
- "; aNbSubElem = "<<aNbSubElem<<
- "; aNbComp = "<<aNbComp<<
- "; aNbGauss = "<<aNbGauss<<
- "");
- }
- }else{
- if((aProfileMode == MED_GLOBAL_STMODE) && (aNbElem != aNbValue)){
- if(theErr){
- *theErr = -1;
- return;
- }
- EXCEPTION(std::runtime_error,
- "GetTimeStampValue - aNbElem("<<aNbElem<<
- ") != aNbValue("<<aNbValue<<
- "); aNbVal = "<<aNbVal<<
- "; anEntity = "<<anEntity<<
- "; aGeom = "<<aGeom<<
- "; aNbElem = "<<aNbElem<<
- "; aNbComp = "<<aNbComp<<
- "; aNbGauss = "<<aNbGauss<<
- "");
- }
- }
- }
- }
-
- //----------------------------------------------------------------------------
- void
- TVWrapper
- ::SetTimeStampValue(const MED::PTimeStampValueBase& theTimeStampValue,
- EModeAcces theMode,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,theMode,theErr);
-
- if(theErr && *theErr < 0)
- return;
-
- TErr aRet;
- TIdt anId = myFile->Id();
-
- TValueHolder<EModeSwitch, med_switch_mode> aModeSwitch(theTimeStampValue->myModeSwitch);
- MED::TGeom2Profile& aGeom2Profile = theTimeStampValue->myGeom2Profile;
-
- MED::PTimeStampInfo aTimeStampInfo = theTimeStampValue->myTimeStampInfo;
- TValueHolder<EEntiteMaillage, med_entity_type> anEntity(aTimeStampInfo->myEntity);
- TValueHolder<TInt, med_int> aNumDt(aTimeStampInfo->myNumDt);
- TValueHolder<TInt, med_int> aNumOrd(aTimeStampInfo->myNumOrd);
- TValueHolder<TString, char> anUnitDt(aTimeStampInfo->myUnitDt);
- TValueHolder<TFloat, med_float> aDt(aTimeStampInfo->myDt);
- MED::TGeom2Gauss& aGeom2Gauss = aTimeStampInfo->myGeom2Gauss;
-
- MED::PFieldInfo aFieldInfo = aTimeStampInfo->myFieldInfo;
- TValueHolder<TString, char> aFieldName(aFieldInfo->myName);
-
- MED::PMeshInfo aMeshInfo = aFieldInfo->myMeshInfo;
- TValueHolder<TString, char> aMeshName(aMeshInfo->myName);
-
- const TGeomSet& aGeomSet = theTimeStampValue->myGeomSet;
- TGeomSet::const_iterator anIter = aGeomSet.begin();
- for(; anIter != aGeomSet.end(); anIter++){
- EGeometrieElement aGeom = *anIter;
-
- TVector<char> aGaussName(GetNOMLength()+1);
- MED::TGeom2Gauss::const_iterator aGaussIter = aGeom2Gauss.find(aGeom);
- if(aGaussIter != aGeom2Gauss.end()){
- MED::PGaussInfo aGaussInfo = aGaussIter->second;
- strcpy(&aGaussName[0],&aGaussInfo->myName[0]);
- }
-
- TVector<char> aProfileName(GetNOMLength()+1);
- med_storage_mode aProfileMode = med_storage_mode(eNO_PFLMOD);
- MED::TGeom2Profile::const_iterator aProfileIter = aGeom2Profile.find(aGeom);
- if(aProfileIter != aGeom2Profile.end()){
- MED::PProfileInfo aProfileInfo = aProfileIter->second;
- aProfileMode = med_storage_mode(aProfileInfo->myMode);
- strcpy(&aProfileName[0],&aProfileInfo->myName[0]);
- }
-
- med_int aNbVal = theTimeStampValue->GetNbVal(aGeom);
-
- aRet = MEDfieldValueWithProfileWr(anId,
- &aFieldName,
- aNumDt,
- aNumOrd,
- aDt,
- anEntity,
- med_geometry_type(aGeom),
- aProfileMode,
- &aProfileName[0],
- &aGaussName[0],
- aModeSwitch,
- MED_ALL_CONSTITUENT,
- aNbVal,
- theTimeStampValue->GetValuePtr(aGeom));
- if(aRet < 0){
- if(theErr){
- *theErr = MED_FALSE;
- break;
- }
- EXCEPTION(std::runtime_error,"SetTimeStampValue - MEDfieldValueWithProfileWr(...)");
- }
-
- }
-
- INITMSG(MYDEBUG,"TVWrapper::SetTimeStampValue - MED_MODE_ACCES = "<<theMode<<"; aRet = "<<aRet<<std::endl);
- }
-
- //----------------------------------------------------------------------------
- void
- TVWrapper
- ::SetTimeStampValue(const PTimeStampValueBase& theTimeStampValue,
- TErr* theErr)
- {
- TErr aRet;
- SetTimeStampValue(theTimeStampValue,eLECTURE_ECRITURE,&aRet);
-
- if(aRet < 0)
- SetTimeStampValue(theTimeStampValue,eLECTURE_AJOUT,&aRet);
-
- if(theErr)
- *theErr = aRet;
- }
-
- //----------------------------------------------------------------------------
- void
- TVWrapper
- ::SetGrilleInfo(const MED::TGrilleInfo& theInfo,
- TErr* theErr)
- {
- SetGrilleInfo(theInfo,eLECTURE_ECRITURE,theErr);
- }
-
- //----------------------------------------------------------------------------
- void
- TVWrapper
- ::SetGrilleInfo(const MED::TGrilleInfo& theInfo,
- EModeAcces theMode,
- TErr* theErr)
- {
- if(theInfo.myMeshInfo->myType != eSTRUCTURE)
- return;
- TFileWrapper aFileWrapper(myFile,theMode,theErr);
-
- if(theErr && *theErr < 0)
- return;
-
- MED::TGrilleInfo& anInfo = const_cast<MED::TGrilleInfo&>(theInfo);
-
- MED::TMeshInfo& aMeshInfo = *anInfo.myMeshInfo;
- TValueHolder<TString, char> aMeshName(aMeshInfo.myName);
-
- TValueHolder<EGrilleType, med_grid_type > aGrilleType(anInfo.myGrilleType);
-
- TErr aRet = 0;
- aRet = MEDmeshGridTypeRd(myFile->Id(),
- &aMeshName,
- &aGrilleType);
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(std::runtime_error,"SetGrilleInfo - MEDmeshGridTypeRd(...)");
-
- if(anInfo.myGrilleType == eGRILLE_STANDARD){
- TValueHolder<TNodeCoord, med_float> aCoord(anInfo.myCoord);
- TValueHolder<EModeSwitch, med_switch_mode> aModeSwitch(anInfo.myModeSwitch);
- TValueHolder<TString, char> aCoordNames(anInfo.myCoordNames);
- TValueHolder<TString, char> aCoordUnits(anInfo.myCoordUnits);
- med_int aNbNoeuds = med_int(anInfo.myCoord.size() / aMeshInfo.myDim);
- //med_axis_type aRepere = MED_CARTESIAN;
-
- aRet = MEDmeshNodeCoordinateWr(myFile->Id(),
- &aMeshName,
- MED_NO_DT,
- MED_NO_IT,
- MED_UNDEF_DT,
- aModeSwitch,
- aNbNoeuds,
- &aCoord);
-
- if(aRet < 0)
- EXCEPTION(std::runtime_error,"SetGrilleInfo - MEDmeshNodeCoordinateWr(...)");
-
- TValueHolder<TIntVector, med_int> aGrilleStructure(anInfo.myGrilleStructure);
- aRet = MEDmeshGridStructWr(myFile->Id(),
- &aMeshName,
- MED_NO_DT,
- MED_NO_IT,
- MED_UNDEF_DT,
- &aGrilleStructure);
- if(aRet < 0)
- EXCEPTION(std::runtime_error,"SetGrilleInfo - MEDmeshGridStructWr(...)");
-
- } else {
- for(med_int aAxis = 0; aAxis < aMeshInfo.myDim; aAxis++){
- aRet = MEDmeshGridIndexCoordinateWr(myFile->Id(),
- &aMeshName,
- MED_NO_DT,
- MED_NO_IT,
- MED_UNDEF_DT,
- aAxis+1,
- anInfo.GetIndexes(aAxis).size(),
- &anInfo.GetIndexes(aAxis)[0]);
-
- if(aRet < 0)
- EXCEPTION(std::runtime_error,"SetGrilleInfo - MEDmeshGridIndexCoordinateWr(...)");
- }
-
- }
-
- return;
- }
-
- //----------------------------------------------------------------------------
- void
- TVWrapper
- ::GetGrilleInfo(TGrilleInfo& theInfo,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
-
- if(theErr && *theErr < 0)
- return;
-
- MED::TMeshInfo& aMeshInfo = *theInfo.myMeshInfo;
- TValueHolder<TString, char> aMeshName(aMeshInfo.myName);
- EMaillage aMaillageType = aMeshInfo.myType;
-
- GetGrilleType(aMeshInfo, theInfo.myGrilleType, theErr);
- EGrilleType aGrilleType = theInfo.myGrilleType;
-
- TErr aRet = 0;
- if(aMaillageType == eSTRUCTURE && aGrilleType == eGRILLE_STANDARD) {
- GetGrilleStruct(aMeshInfo, theInfo.myGrilleStructure, theErr);
-
- TValueHolder<TNodeCoord, med_float> aCoord(theInfo.myCoord);
- TValueHolder<EModeSwitch, med_switch_mode> aModeSwitch(theInfo.myModeSwitch);
- TValueHolder<TString, char> aCoordNames(theInfo.myCoordNames);
- TValueHolder<TString, char> aCoordUnits(theInfo.myCoordUnits);
- //med_axis_type aRepere;
-
- aRet = MEDmeshNodeCoordinateRd(myFile->Id(),
- &aMeshName,
- MED_NO_DT,
- MED_NO_IT,
- aModeSwitch,
- &aCoord);
-
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(std::runtime_error,"GetGrilleInfo - MEDmeshNodeCoordinateRd(...)");
-
- //TInt aNbNodes = theInfo.GetNbNodes();//GetNbFamilies(aMeshInfo);
- TValueHolder<TElemNum, med_int> aFamNumNode(theInfo.myFamNumNode);
-
- aRet = MEDmeshEntityFamilyNumberRd(myFile->Id(),
- &aMeshName,
- MED_NO_DT,
- MED_NO_IT,
- MED_NODE,
- MED_NO_GEOTYPE,
- &aFamNumNode);
-
- if(aRet < 0)
- {
-// if (aRet == MED_ERR_DOESNTEXIST) // --- only valid with MED3.x files
- {
- int mySize = (int)theInfo.myFamNumNode.size();
- theInfo.myFamNumNode.clear();
- theInfo.myFamNumNode.resize(mySize,0);
- aRet = 0;
- }
-// else
-// EXCEPTION(std::runtime_error,"GetGrilleInfo - MEDmeshEntityFamilyNumberRd(...)");
- }
- if(theErr)
- *theErr = aRet;
-
- //============================
- }
-
- if(aMaillageType == eSTRUCTURE && aGrilleType != eGRILLE_STANDARD){
- ETable aTable = eCOOR_IND1;
- for(med_int anAxis = 1; anAxis <= aMeshInfo.myDim; anAxis++){
- switch(anAxis){
- case 1 :
- aTable = eCOOR_IND1;
- break;
- case 2 :
- aTable = eCOOR_IND2;
- break;
- case 3 :
- aTable = eCOOR_IND3;
- break;
- default :
- aRet = -1;
- }
-
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(std::runtime_error,"GetGrilleInfo - anAxis number out of range(...)");
-
- TInt aNbIndexes = GetNbNodes(aMeshInfo,aTable);
- if(aNbIndexes < 0)
- EXCEPTION(std::runtime_error,"GetGrilleInfo - Erreur a la lecture de la taille de l'indice");
-
- TValueHolder<TFloatVector, med_float> anIndexes(theInfo.GetIndexes(anAxis-1));
- //TValueHolder<ETable, med_data_type > table(aTable);
- //char aCompNames[MED_SNAME_SIZE+1];
- //char anUnitNames[MED_SNAME_SIZE+1];
- aRet=MEDmeshGridIndexCoordinateRd(myFile->Id(),&aMeshName,
- MED_NO_DT,MED_NO_IT,
- anAxis,
- &anIndexes);
-
- //theInfo.SetCoordName(anAxis-1, aCompNames);
- //theInfo.SetCoordUnit(anAxis-1, anUnitNames);
- theInfo.SetGrilleStructure(anAxis-1, aNbIndexes);
-
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(std::runtime_error,"GetGrilleInfo - MEDindicesCoordLire(...)");
- }
- }
-
- EGeometrieElement aGeom = theInfo.GetGeom();
- EEntiteMaillage aEntity = theInfo.GetEntity();
- TInt aNbCells = theInfo.GetNbCells();
-
- theInfo.myFamNum.resize(aNbCells);
- TValueHolder<TElemNum, med_int> aFamNum(theInfo.myFamNum);
-
- aRet = MEDmeshEntityFamilyNumberRd(myFile->Id(),
- &aMeshName,MED_NO_DT,MED_NO_IT,med_entity_type(aEntity),
- med_geometry_type(aGeom),&aFamNum);
-
- if ( aMeshInfo.myDim == 3 )
- {
- aGeom = theInfo.GetSubGeom();
- aEntity = theInfo.GetSubEntity();
- aNbCells = theInfo.GetNbSubCells();
-
- theInfo.myFamSubNum.resize(aNbCells,0);
- TValueHolder<TElemNum, med_int> aFamNum(theInfo.myFamSubNum);
-
- aRet = MEDmeshEntityFamilyNumberRd(myFile->Id(),
- &aMeshName,MED_NO_DT,MED_NO_IT,
- med_entity_type(aEntity),
- med_geometry_type(aGeom),&aFamNum);
- }
- if(aRet < 0)
- {
-// if (aRet == MED_ERR_DOESNTEXIST) // --- only valid with MED3.x files
- {
- int mySize = (int)theInfo.myFamNumNode.size();
- theInfo.myFamNumNode.clear();
- theInfo.myFamNumNode.resize(mySize,0);
- aRet = 0;
- }
-// else
-// EXCEPTION(std::runtime_error,"GetGrilleInfo - MEDmeshEntityFamilyNumberRd(...)");
- }
- if(theErr)
- *theErr = aRet;
- }
-
- void
- TVWrapper
- ::GetGrilleType(const MED::TMeshInfo& theMeshInfo,
- EGrilleType& theGridType,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
-
- if(theErr && *theErr < 0)
- EXCEPTION(std::runtime_error," GetGrilleType - aFileWrapper (...)");
-
- MED::TMeshInfo& aMeshInfo = const_cast<MED::TMeshInfo&>(theMeshInfo);
-
- if(aMeshInfo.myType == eSTRUCTURE){
- TValueHolder<TString, char> aMeshName(aMeshInfo.myName);
- TValueHolder<EGrilleType, med_grid_type> aGridType(theGridType);
- TErr aRet = MEDmeshGridTypeRd(myFile->Id(),
- &aMeshName,
- &aGridType);
-
- if(aRet < 0)
- EXCEPTION(std::runtime_error,"GetGrilleInfo - MEDmeshGridTypeRd(...)");
- }
- }
-
- void
- TVWrapper
- ::GetGrilleStruct(const MED::TMeshInfo& theMeshInfo,
- TIntVector& theStruct,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
-
- if(theErr && *theErr < 0)
- return;
-
- TErr aRet;
- MED::TMeshInfo& aMeshInfo = const_cast<MED::TMeshInfo&>(theMeshInfo);
-
- TValueHolder<TString, char> aMeshName(aMeshInfo.myName);
- TValueHolder<TIntVector, med_int> aGridStructure(theStruct);
-
- aRet = MEDmeshGridStructRd(myFile->Id(),
- &aMeshName,
- MED_NO_DT,
- MED_NO_IT,
- &aGridStructure);
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(std::runtime_error,"GetGrilleInfo - MEDmeshGridStructRd(...)");
- }
- }
-}
+++ /dev/null
-// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
-//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
-//
-// 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
-//
-
-#ifndef MED_V2_2_Wrapper_HeaderFile
-#define MED_V2_2_Wrapper_HeaderFile
-
-#include "MED_WrapperDef.hxx"
-#include "MED_Structures.hxx"
-#include "MED_TWrapper.hxx"
-
-namespace MED
-{
- namespace V2_2
- {
- //----------------------------------------------------------------------------
- class TFile;
- typedef boost::shared_ptr<TFile> PFile;
-
- typedef enum {eLECTURE, eLECTURE_ECRITURE, eLECTURE_AJOUT, eCREATION} EModeAcces;
-
- //----------------------------------------------------------------------------
- class MEDWRAPPER_EXPORT TVWrapper: public MED::TTWrapper
- {
- TVWrapper();
- TVWrapper(const TVWrapper&);
- TVWrapper& operator=(const TVWrapper&);
-
- public:
- TVWrapper(const std::string& theFileName);
-
- //----------------------------------------------------------------------------
- virtual
- TInt
- GetNbMeshes(TErr* theErr = NULL);
-
- virtual
- void
- GetMeshInfo(TInt theMeshId, MED::TMeshInfo&,
- TErr* theErr = NULL);
-
- virtual
- void
- SetMeshInfo(const MED::TMeshInfo& theInfo,
- TErr* theErr = NULL);
-
- void SetMeshInfo(const MED::TMeshInfo& theInfo,
- EModeAcces theMode,
- TErr* theErr = NULL);
-
-
- //----------------------------------------------------------------------------
- virtual
- TInt
- GetNbFamilies(const MED::TMeshInfo& theMeshInfo,
- TErr* theErr = NULL);
-
- virtual
- TInt
- GetNbFamAttr(TInt theFamId,
- const MED::TMeshInfo& theInfo,
- TErr* theErr = NULL);
-
- virtual
- TInt
- GetNbFamGroup(TInt theFamId,
- const MED::TMeshInfo& theInfo,
- TErr* theErr = NULL);
-
- virtual
- void
- GetFamilyInfo(TInt theFamId,
- MED::TFamilyInfo& theInfo,
- TErr* theErr = NULL);
-
- virtual
- void
- SetFamilyInfo(const MED::TFamilyInfo& theInfo,
- TErr* theErr = NULL);
-
- void
- SetFamilyInfo(const MED::TFamilyInfo& theInfo,
- EModeAcces theMode,
- TErr* theErr = NULL);
-
-
- //----------------------------------------------------------------------------
- virtual
- void
- GetNames(TElemInfo& theInfo,
- TInt nb,
- EEntiteMaillage theEntity,
- EGeometrieElement theGeom,
- TErr* theErr = NULL);
-
- virtual
- void
- GetNumeration(TElemInfo& theInfo,
- TInt nb,
- EEntiteMaillage theEntity,
- EGeometrieElement theGeom,
- TErr* theErr = NULL);
-
- virtual
- void
- GetFamilies(TElemInfo& theInfo,
- TInt nb,
- EEntiteMaillage theEntity,
- EGeometrieElement theGeom,
- TErr* theErr = NULL);
-
- virtual
- void
- SetNames(const TElemInfo& theInfo,
- EEntiteMaillage theEntity,
- EGeometrieElement theGeom,
- TErr* theErr = NULL);
-
- void
- SetNames(const TElemInfo& theInfo,
- EModeAcces theMode,
- EEntiteMaillage theEntity,
- EGeometrieElement theGeom,
- TErr* theErr = NULL);
-
- virtual
- void
- SetNumeration(const TElemInfo& theInfo,
- EEntiteMaillage theEntity,
- EGeometrieElement theGeom,
- TErr* theErr = NULL);
- void
- SetNumeration(const TElemInfo& theInfo,
- EModeAcces theMode,
- EEntiteMaillage theEntity,
- EGeometrieElement theGeom,
- TErr* theErr = NULL);
-
- virtual
- void
- SetFamilies(const TElemInfo& theInfo,
- EEntiteMaillage theEntity,
- EGeometrieElement theGeom,
- TErr* theErr = NULL);
- void
- SetFamilies(const TElemInfo& theInfo,
- EModeAcces theMode,
- EEntiteMaillage theEntity,
- EGeometrieElement theGeom,
- TErr* theErr = NULL);
-
- //----------------------------------------------------------------------------
- virtual
- TInt
- GetNbNodes(const MED::TMeshInfo& theMeshInfo,
- TErr* theErr = NULL)
- {
- return GetNbNodes(theMeshInfo,eCOOR,theErr);
- }
-
- TInt
- GetNbNodes(const MED::TMeshInfo& theMeshInfo,
- ETable theTable,
- TErr* theErr = NULL);
-
- virtual
- void
- GetNodeInfo(MED::TNodeInfo& theInfo,
- TErr* theErr = NULL);
-
- virtual
- void
- SetNodeInfo(const MED::TNodeInfo& theInfo,
- TErr* theErr = NULL);
-
- void
- SetNodeInfo(const MED::TNodeInfo& theInfo,
- EModeAcces theMode,
- TErr* theErr = NULL);
-
- //----------------------------------------------------------------------------
- virtual
- void
- GetPolygoneInfo(TPolygoneInfo& theInfo,
- TErr* theErr = NULL);
-
- virtual
- void
- SetPolygoneInfo(const TPolygoneInfo& theInfo,
- TErr* theErr = NULL);
-
- void
- SetPolygoneInfo(const MED::TPolygoneInfo& theInfo,
- EModeAcces theMode,
- TErr* theErr = NULL);
-
- virtual
- TInt
- GetNbPolygones(const TMeshInfo& theMeshInfo,
- EEntiteMaillage theEntity,
- EGeometrieElement theGeom,
- EConnectivite theConnMode = eNOD,
- TErr* theErr = NULL);
-
- virtual
- TInt
- GetPolygoneConnSize(const TMeshInfo& theMeshInfo,
- EEntiteMaillage theEntity,
- EGeometrieElement theGeom,
- EConnectivite theConnMode = eNOD,
- TErr* theErr = NULL);
-
- //----------------------------------------------------------------------------
- virtual
- void
- GetPolyedreInfo(TPolyedreInfo& theInfo,
- TErr* theErr = NULL);
-
- virtual
- void
- SetPolyedreInfo(const TPolyedreInfo& theInfo,
- TErr* theErr = NULL);
-
- void
- SetPolyedreInfo(const MED::TPolyedreInfo& theInfo,
- EModeAcces theMode,
- TErr* theErr = NULL);
-
- virtual
- TInt
- GetNbPolyedres(const TMeshInfo& theMeshInfo,
- EEntiteMaillage,
- EGeometrieElement,
- EConnectivite,
- TErr* theErr = NULL);
-
- virtual
- void
- GetPolyedreConnSize(const TMeshInfo& theMeshInfo,
- TInt& theNbFaces,
- TInt& theConnSize,
- EConnectivite theConnMode = eNOD,
- TErr* theErr = NULL);
-
- //----------------------------------------------------------------------------
- virtual
- TEntityInfo
- GetEntityInfo(const MED::TMeshInfo& theMeshInfo,
- EConnectivite theConnMode = eNOD,
- TErr* theErr = NULL);
-
- virtual
- TInt
- GetNbCells(const MED::TMeshInfo& theMeshInfo,
- EEntiteMaillage,
- EGeometrieElement,
- EConnectivite theConnMode = eNOD,
- TErr* theErr = NULL);
-
- virtual
- void
- GetCellInfo(MED::TCellInfo& theInfo,
- TErr* theErr = NULL);
-
- virtual
- void
- SetCellInfo(const MED::TCellInfo& theInfo,
- TErr* theErr = NULL);
-
- void
- SetCellInfo(const MED::TCellInfo& theInfo,
- EModeAcces theMode,
- TErr* theErr = NULL);
-
- //----------------------------------------------------------------------------
- //! Read geom type of MED_BALL structural element
- EGeometrieElement GetBallGeom(const TMeshInfo& theMeshInfo);
-
- //! Read number of balls in the Mesh
- virtual TInt GetNbBalls(const TMeshInfo& theMeshInfo);
-
- //! Read a MEDWrapped representation of MED_BALL from the MED file
- virtual void GetBallInfo(TBallInfo& theInfo, TErr* theErr = NULL);
-
- //! Write a MEDWrapped representation of MED_BALL to the MED file
- virtual void SetBallInfo(const TBallInfo& theInfo, TErr* theErr);
-
- //! Write a MEDWrapped representation of MED_BALL to the MED file
- void SetBallInfo(const TBallInfo& theInfo, EModeAcces theMode, TErr* theErr);
-
- //----------------------------------------------------------------------------
- virtual
- TInt
- GetNbFields(TErr* theErr = NULL);
-
- virtual
- TInt
- GetNbComp(TInt theFieldId,
- TErr* theErr = NULL);
-
- virtual
- void
- GetFieldInfo(TInt theFieldId,
- MED::TFieldInfo& theInfo,
- TErr* theErr = NULL);
-
- virtual
- void
- SetFieldInfo(const MED::TFieldInfo& theInfo,
- TErr* theErr = NULL);
-
- void
- SetFieldInfo(const MED::TFieldInfo& theInfo,
- EModeAcces theMode,
- TErr* theErr = NULL);
-
- //----------------------------------------------------------------------------
- virtual
- TInt
- GetNbGauss(TErr* theErr = NULL);
-
- virtual
- TGaussInfo::TInfo
- GetGaussPreInfo(TInt theId,
- TErr* theErr = NULL);
-
- virtual
- void
- GetGaussInfo(TInt theId,
- TGaussInfo& theInfo,
- TErr* theErr = NULL);
-
- //----------------------------------------------------------------------------
- virtual
- TInt
- GetNbProfiles(TErr* theErr = NULL);
-
- virtual
- TProfileInfo::TInfo
- GetProfilePreInfo(TInt theId,
- TErr* theErr = NULL);
-
- virtual
- void
- GetProfileInfo(TInt theId,
- TProfileInfo& theInfo,
- TErr* theErr = NULL);
-
- virtual
- void
- SetProfileInfo(const TProfileInfo& theInfo,
- TErr* theErr = NULL);
-
- void
- SetProfileInfo(const TProfileInfo& theInfo,
- EModeAcces theMode,
- TErr* theErr = NULL);
-
- //----------------------------------------------------------------------------
- virtual
- TInt
- GetNbTimeStamps(const MED::TFieldInfo& theInfo,
- const MED::TEntityInfo& theEntityInfo,
- EEntiteMaillage& theEntity,
- TGeom2Size& theGeom2Size,
- TErr* theErr = NULL);
-
- virtual
- void
- GetTimeStampInfo(TInt theTimeStampId,
- MED::TTimeStampInfo& theInfo,
- TErr* theErr = NULL);
-
- virtual
- void
- GetTimeStampValue(const PTimeStampValueBase& theTimeStampValue,
- const TMKey2Profile& theMKey2Profile,
- const TKey2Gauss& theKey2Gauss,
- TErr* theErr = NULL);
-
- virtual
- void
- SetTimeStampValue(const PTimeStampValueBase& theTimeStampValue,
- TErr* theErr = NULL);
-
- void
- SetTimeStampValue(const PTimeStampValueBase& theTimeStampValue,
- EModeAcces theMode,
- TErr* theErr = NULL);
-
-
- //----------------------------------------------------------------------------
- virtual
- void
- GetGrilleInfo(TGrilleInfo& theGrilleInfo,
- TErr* theErr = NULL);
-
- virtual
- void
- SetGrilleInfo(const MED::TGrilleInfo& theGrilleInfo,
- TErr* theErr = NULL);
-
- void
- SetGrilleInfo(const MED::TGrilleInfo& theGrilleInfo,
- EModeAcces theMode,
- TErr* theErr = NULL);
-
- virtual
- void
- GetGrilleType(const MED::TMeshInfo& theMeshInfo,
- EGrilleType& type,
- TErr* theErr = NULL);
-
- void
- GetGrilleStruct(const MED::TMeshInfo& theMeshInfo,
- TIntVector& theStruct,
- TErr* theErr = NULL);
-
- protected:
- PFile myFile;
- };
- }
-}
-
-#endif // MED_V2_2_Wrapper_HeaderFile
namespace MED
{
- //! Main purpose to introduce the class was to customize operator []
+ //! Main purpose to introduce the class was to customize operator []
template<typename _Tp, typename _Alloc = std::allocator<_Tp> >
class TVector : public std::vector<_Tp, _Alloc>
{
public:
explicit
- TVector(const allocator_type& __a = allocator_type()):
- superclass(__a)
+ TVector(const allocator_type& __a = allocator_type()):
+ superclass(__a)
{}
-
+
TVector(size_type __n, const value_type& __val,
const allocator_type& __a = allocator_type()):
superclass(__n, __val, __a)
{}
-
+
explicit
TVector(size_type __n):
superclass(__n)
//
#include "MED_Wrapper.hxx"
+#include "MED_TStructures.hxx"
#include "MED_Utilities.hxx"
-
+
+#include <med.h>
+#include <med_err.h>
+
#include <boost/version.hpp>
#ifdef _DEBUG_
static int MYDEBUG = 0;
static int MYVALUEDEBUG = 0;
#else
-// static int MYDEBUG = 0;
-// static int MYVALUEDEBUG = 0;
+static int MYDEBUG = 0;
+static int MYVALUEDEBUG = 0;
#endif
namespace MED
{
+ //---------------------------------------------------------------
TLockProxy
::TLockProxy(TWrapper* theWrapper):
myWrapper(theWrapper)
#else
boost::detail::thread::lock_ops<TWrapper::TMutex>::lock(myWrapper->myMutex);
#endif
- INITMSG(MYDEBUG,"TLockProxy() - this -"<<this<<"; myWrapper = "<<myWrapper<<std::endl);
+ INITMSG(MYDEBUG, "TLockProxy() - this -"<<this<<"; myWrapper = "<<myWrapper<<std::endl);
}
-
+
TLockProxy
::~TLockProxy()
{
- INITMSG(MYDEBUG,"~TLockProxy() - this -"<<this<<"; myWrapper = "<<myWrapper<<std::endl);
+ INITMSG(MYDEBUG, "~TLockProxy() - this -"<<this<<"; myWrapper = "<<myWrapper<<std::endl);
#if BOOST_VERSION >= 103500
myWrapper->myMutex.unlock();
#else
boost::detail::thread::lock_ops<TWrapper::TMutex>::unlock(myWrapper->myMutex);
#endif
}
-
+
TWrapper*
TLockProxy
- ::operator-> () const // never throws
+ ::operator->() const // never throws
{
return myWrapper;
}
+ //---------------------------------------------------------------
+ class TFile
+ {
+ TFile();
+ TFile(const TFile&);
+
+ public:
+ TFile(const std::string& theFileName):
+ myCount(0),
+ myFid(0),
+ myFileName(theFileName)
+ {}
+
+ ~TFile()
+ {
+ Close();
+ }
+
+ void
+ Open(EModeAcces theMode,
+ TErr* theErr = NULL)
+ {
+ if (myCount++ == 0) {
+ const char* aFileName = myFileName.c_str();
+ myFid = MEDfileOpen(aFileName, med_access_mode(theMode));
+ }
+ if (theErr)
+ *theErr = TErr(myFid);
+ else if (myFid < 0)
+ EXCEPTION(std::runtime_error, "TFile - MEDfileOpen('"<<myFileName<<"',"<<theMode<<")");
+ }
+
+ const TIdt&
+ Id() const
+ {
+ if (myFid < 0)
+ EXCEPTION(std::runtime_error, "TFile - GetFid() < 0");
+ return myFid;
+ }
+
+ void
+ Close()
+ {
+ if (--myCount == 0)
+ MEDfileClose(myFid);
+ }
+
+ protected:
+ TInt myCount;
+ TIdt myFid;
+ std::string myFileName;
+ };
+
+ //---------------------------------------------------------------
+ class TFileWrapper
+ {
+ PFile myFile;
+
+ public:
+ TFileWrapper(const PFile& theFile,
+ EModeAcces theMode,
+ TErr* theErr = NULL):
+ myFile(theFile)
+ {
+ myFile->Open(theMode, theErr);
+ }
+
+ ~TFileWrapper()
+ {
+ myFile->Close();
+ }
+ };
+
+ //----------------------------------------------------------------------------
+ template<class TimeStampValueType>
+ void
+ Print(SharedPtr<TimeStampValueType> theTimeStampValue)
+ {
+ INITMSG(MYDEBUG,"Print - TimeStampValue\n");
+ typename TimeStampValueType::TTGeom2Value& aGeom2Value = theTimeStampValue->myGeom2Value;
+ typename TimeStampValueType::TTGeom2Value::const_iterator anIter = aGeom2Value.begin();
+ for (; anIter != aGeom2Value.end(); anIter++) {
+ const EGeometrieElement& aGeom = anIter->first;
+ const typename TimeStampValueType::TTMeshValue& aMeshValue = anIter->second;
+ TInt aNbElem = aMeshValue.myNbElem;
+ TInt aNbGauss = aMeshValue.myNbGauss;
+ TInt aNbComp = aMeshValue.myNbComp;
+ INITMSG(MYDEBUG, "aGeom = "<<aGeom<<" - "<<aNbElem<<": ");
+ for (TInt iElem = 0; iElem < aNbElem; iElem++) {
+ typename TimeStampValueType::TTMeshValue::TCValueSliceArr aValueSliceArr =
+ aMeshValue.GetGaussValueSliceArr(iElem);
+ ADDMSG(MYVALUEDEBUG, "{");
+ for (TInt iGauss = 0; iGauss < aNbGauss; iGauss++) {
+ const typename TimeStampValueType::TTMeshValue::TCValueSlice& aValueSlice =
+ aValueSliceArr[iGauss];
+ for (TInt iComp = 0; iComp < aNbComp; iComp++) {
+ ADDMSG(MYVALUEDEBUG, aValueSlice[iComp]<<" ");
+ }
+ ADDMSG(MYVALUEDEBUG, "| ");
+ }
+ ADDMSG(MYVALUEDEBUG, "} ");
+ }
+ ADDMSG(MYDEBUG, "\n");
+ }
+ }
+
+ //---------------------------------------------------------------
+ TWrapper
+ ::TWrapper(const std::string& theFileName):
+ myFile(new TFile(theFileName))
+ {
+ 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);
+ }
+ if (aRet < 0) {
+ myFile->Close();
+ myFile->Open(eCREATION, &aRet);
+ }
+ }
+
+ //----------------------------------------------------------------------------
+ TWrapper::
+ ~TWrapper()
+ {
+ }
+
+ //----------------------------------------------------------------------------
+ TInt
+ TWrapper
+ ::GetNbMeshes(TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+
+ if (theErr && *theErr < 0)
+ return -1;
+
+ return MEDnMesh(myFile->Id());
+ }
+
+ //----------------------------------------------------------------------------
+ void
+ TWrapper
+ ::GetMeshInfo(TInt theMeshId,
+ MED::TMeshInfo& theInfo,
+ TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+
+ if (theErr && *theErr < 0)
+ return;
+
+ TValueHolder<TString, char> aMeshName(theInfo.myName);
+ TValueHolder<TInt, med_int> aDim(theInfo.myDim);
+ TValueHolder<TInt, med_int> aSpaceDim(theInfo.mySpaceDim);
+ TValueHolder<EMaillage, med_mesh_type> aType(theInfo.myType);
+ char dtunit[MED_SNAME_SIZE+1];
+ med_sorting_type sorttype;
+ med_int nstep;
+ med_axis_type at;
+ int naxis = MEDmeshnAxis(myFile->Id(), theMeshId);
+ char *axisname = new char[naxis*MED_SNAME_SIZE+1];
+ char *axisunit = new char[naxis*MED_SNAME_SIZE+1];
+ TErr aRet = MEDmeshInfo(myFile->Id(),
+ theMeshId,
+ &aMeshName,
+ &aSpaceDim,
+ &aDim,
+ &aType,
+ &theInfo.myDesc[0],
+ dtunit,
+ &sorttype,
+ &nstep,
+ &at,
+ axisname,
+ axisunit);
+ delete [] axisname;
+ delete [] axisunit;
+ if (aRet < 0)
+ EXCEPTION(std::runtime_error, "GetMeshInfo - MEDmeshInfo(...)");
+ }
+
+ //----------------------------------------------------------------------------
+ void
+ TWrapper
+ ::SetMeshInfo(const MED::TMeshInfo& theInfo,
+ TErr* theErr)
+ {
+ TErr aRet;
+ SetMeshInfo(theInfo, eLECTURE_ECRITURE, &aRet);
+
+ if (aRet < 0)
+ SetMeshInfo(theInfo, eLECTURE_AJOUT, &aRet);
+
+ if (aRet < 0)
+ SetMeshInfo(theInfo, eCREATION, &aRet);
+
+ if (theErr)
+ *theErr = aRet;
+ }
+
+ //----------------------------------------------------------------------------
+ void
+ TWrapper
+ ::SetMeshInfo(const MED::TMeshInfo& theInfo,
+ EModeAcces theMode,
+ TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile, theMode, theErr);
+
+ if (theErr && *theErr < 0)
+ return;
+
+ MED::TMeshInfo& anInfo = const_cast<MED::TMeshInfo&>(theInfo);
+
+ TValueHolder<TString, char> aMeshName(anInfo.myName);
+ TValueHolder<TInt, med_int> aDim(anInfo.myDim);
+ TValueHolder<TInt, med_int> aSpaceDim(anInfo.mySpaceDim);
+ TValueHolder<EMaillage, med_mesh_type> aType(anInfo.myType);
+ TValueHolder<TString, char> aDesc(anInfo.myDesc);
+
+ char *nam = new char[aSpaceDim*MED_SNAME_SIZE+1];
+ std::fill(nam, nam+aSpaceDim*MED_SNAME_SIZE+1, '\0');
+ char *unit = new char[aSpaceDim*MED_SNAME_SIZE+1];
+ std::fill(unit, unit+aSpaceDim*MED_SNAME_SIZE+1, '\0');
+ TErr aRet = MEDmeshCr(myFile->Id(),
+ &aMeshName,
+ aSpaceDim,
+ aDim,
+ aType,
+ &aDesc,
+ "",
+ MED_SORT_DTIT,
+ MED_CARTESIAN,
+ nam,
+ unit);
+ delete [] nam;
+ delete [] unit;
+
+ //if (aRet == 0)
+ // aRet = MEDunvCr(myFile->Id(),&aMeshName);
+
+ INITMSG(MYDEBUG, "TWrapper::SetMeshInfo - MED_MODE_ACCES = "<<theMode<<"; aRet = "<<aRet<<std::endl);
+
+ if (theErr)
+ *theErr = aRet;
+ else if (aRet < 0)
+ EXCEPTION(std::runtime_error, "SetMeshInfo - MEDmeshCr(...)");
+ }
+
+ //----------------------------------------------------------------------------
+ PMeshInfo
+ TWrapper
+ ::CrMeshInfo(TInt theDim,
+ TInt theSpaceDim,
+ const std::string& theValue,
+ EMaillage theType,
+ const std::string& theDesc)
+ {
+ return PMeshInfo(new TTMeshInfo
+ (theDim,
+ theSpaceDim,
+ theValue,
+ theType,
+ theDesc));
+ }
+
//----------------------------------------------------------------------------
- TWrapper::~TWrapper()
+ PMeshInfo
+ TWrapper
+ ::CrMeshInfo(const PMeshInfo& theInfo)
{
+ return PMeshInfo(new TTMeshInfo(theInfo));
}
//----------------------------------------------------------------------------
TErr* theErr)
{
PMeshInfo anInfo = CrMeshInfo();
- GetMeshInfo(theId,*anInfo,theErr);
+ GetMeshInfo(theId, *anInfo, theErr);
return anInfo;
}
+ //----------------------------------------------------------------------------
+ TInt
+ TWrapper
+ ::GetNbFamilies(const MED::TMeshInfo& theInfo,
+ TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+
+ if (theErr && *theErr < 0)
+ return -1;
+
+ MED::TMeshInfo& anInfo = const_cast<MED::TMeshInfo&>(theInfo);
+ TValueHolder<TString, char> aName(anInfo.myName);
+ return MEDnFamily(myFile->Id(), &aName);
+ }
+
+ //----------------------------------------------------------------------------
+ TInt
+ TWrapper
+ ::GetNbFamAttr(TInt theFamId,
+ const MED::TMeshInfo& theInfo,
+ TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+
+ if (theErr && *theErr < 0)
+ return -1;
+
+ MED::TMeshInfo& anInfo = const_cast<MED::TMeshInfo&>(theInfo);
+
+ TValueHolder<TString, char> aName(anInfo.myName);
+
+ return MEDnFamily23Attribute(myFile->Id(), &aName, theFamId);
+ }
+
+ //----------------------------------------------------------------------------
+ TInt
+ TWrapper
+ ::GetNbFamGroup(TInt theFamId,
+ const MED::TMeshInfo& theInfo,
+ TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+
+ if (theErr && *theErr < 0)
+ return -1;
+
+ MED::TMeshInfo& anInfo = const_cast<MED::TMeshInfo&>(theInfo);
+
+ TValueHolder<TString, char> aName(anInfo.myName);
+
+ return MEDnFamilyGroup(myFile->Id(), &aName, theFamId);
+ }
+
+ //----------------------------------------------------------------------------
+ void
+ TWrapper
+ ::GetFamilyInfo(TInt theFamId,
+ MED::TFamilyInfo& theInfo,
+ TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+
+ if (theErr && *theErr < 0)
+ return;
+
+ MED::TMeshInfo& aMeshInfo = *theInfo.myMeshInfo;
+
+ TValueHolder<TString, char> aMeshName(aMeshInfo.myName);
+ TValueHolder<TString, char> aFamilyName(theInfo.myName);
+ TValueHolder<TInt, med_int> aFamilyId(theInfo.myId);
+ TValueHolder<TFamAttr, med_int> anAttrId(theInfo.myAttrId);
+ TValueHolder<TFamAttr, med_int> anAttrVal(theInfo.myAttrVal);
+ TValueHolder<TString, char> anAttrDesc(theInfo.myAttrDesc);
+ TValueHolder<TString, char> aGroupNames(theInfo.myGroupNames);
+
+ TErr aRet = MEDfamily23Info(myFile->Id(),
+ &aMeshName,
+ theFamId,
+ &aFamilyName,
+ &anAttrId,
+ &anAttrVal,
+ &anAttrDesc,
+ &aFamilyId,
+ &aGroupNames);
+
+ if (theErr)
+ *theErr = aRet;
+ else if (aRet < 0)
+ EXCEPTION(std::runtime_error, "GetFamilyInfo - MEDfamily23Info(...) - "<<
+ " aMeshInfo.myName = '"<<&aMeshName<<
+ "'; theFamId = "<<theFamId<<
+ "; theInfo.myNbGroup = "<<theInfo.myNbGroup<<
+ "; theInfo.myNbAttr = "<<theInfo.myNbAttr);
+ }
+
+ //----------------------------------------------------------------------------
+ void
+ TWrapper
+ ::SetFamilyInfo(const MED::TFamilyInfo& theInfo,
+ TErr* theErr)
+ {
+ TErr aRet;
+ SetFamilyInfo(theInfo, eLECTURE_ECRITURE, &aRet);
+
+ if (aRet < 0)
+ SetFamilyInfo(theInfo, eLECTURE_AJOUT, &aRet);
+
+ if (theErr)
+ *theErr = aRet;
+ }
+
+ //----------------------------------------------------------------------------
+ void
+ TWrapper
+ ::SetFamilyInfo(const MED::TFamilyInfo& theInfo,
+ EModeAcces theMode,
+ TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile, theMode, theErr);
+
+ if (theErr && *theErr < 0)
+ return;
+
+ MED::TFamilyInfo& anInfo = const_cast<MED::TFamilyInfo&>(theInfo);
+ MED::TMeshInfo& aMeshInfo = *anInfo.myMeshInfo;
+
+ TValueHolder<TString, char> aMeshName(aMeshInfo.myName);
+ TValueHolder<TString, char> aFamilyName(anInfo.myName);
+ TValueHolder<TInt, med_int> aFamilyId(anInfo.myId);
+ TValueHolder<TFamAttr, med_int> anAttrId(anInfo.myAttrId);
+ TValueHolder<TFamAttr, med_int> anAttrVal(anInfo.myAttrVal);
+ TValueHolder<TInt, med_int> aNbAttr(anInfo.myNbAttr);
+ TValueHolder<TString, char> anAttrDesc(anInfo.myAttrDesc);
+ TValueHolder<TInt, med_int> aNbGroup(anInfo.myNbGroup);
+ TValueHolder<TString, char> aGroupNames(anInfo.myGroupNames);
+
+ TErr aRet = MEDfamilyCr(myFile->Id(),
+ &aMeshName,
+ &aFamilyName,
+ aFamilyId,
+ aNbGroup,
+ &aGroupNames);
+
+ INITMSG(MYDEBUG, "TWrapper::SetFamilyInfo - MED_MODE_ACCES = "<<theMode<<"; aRet = "<<aRet<<std::endl);
+
+ if (theErr)
+ *theErr = aRet;
+ else if (aRet < 0)
+ EXCEPTION(std::runtime_error, "SetFamilyInfo - MEDfamilyCr(...)");
+ }
+
+ //----------------------------------------------------------------------------
+ PFamilyInfo
+ TWrapper
+ ::CrFamilyInfo(const PMeshInfo& theMeshInfo,
+ TInt theNbGroup,
+ TInt theNbAttr,
+ TInt theId,
+ const std::string& theValue)
+ {
+ return PFamilyInfo(new TTFamilyInfo
+ (theMeshInfo,
+ theNbGroup,
+ theNbAttr,
+ theId,
+ theValue));
+ }
+
+ //----------------------------------------------------------------------------
+ PFamilyInfo
+ TWrapper
+ ::CrFamilyInfo(const PMeshInfo& theMeshInfo,
+ const std::string& theValue,
+ TInt theId,
+ const MED::TStringSet& theGroupNames,
+ const MED::TStringVector& theAttrDescs,
+ const MED::TIntVector& theAttrIds,
+ const MED::TIntVector& theAttrVals)
+ {
+ return PFamilyInfo(new TTFamilyInfo
+ (theMeshInfo,
+ theValue,
+ theId,
+ theGroupNames,
+ theAttrDescs,
+ theAttrIds,
+ theAttrVals));
+ }
+
+ //----------------------------------------------------------------------------
+ PFamilyInfo
+ TWrapper
+ ::CrFamilyInfo(const PMeshInfo& theMeshInfo,
+ const PFamilyInfo& theInfo)
+ {
+ return PFamilyInfo(new TTFamilyInfo
+ (theMeshInfo,
+ theInfo));
+ }
//----------------------------------------------------------------------------
- PFamilyInfo
+ PFamilyInfo
TWrapper
- ::GetPFamilyInfo(const PMeshInfo& theMeshInfo,
+ ::GetPFamilyInfo(const PMeshInfo& theMeshInfo,
TInt theId,
TErr* theErr)
{
// must be reimplemented in connection with mesh type eSTRUCTURE
- // if(theMeshInfo->GetType() != eNON_STRUCTURE)
+ // if (theMeshInfo->GetType() != eNON_STRUCTURE)
// return PFamilyInfo();
-
- TInt aNbAttr = GetNbFamAttr(theId,*theMeshInfo);
- TInt aNbGroup = GetNbFamGroup(theId,*theMeshInfo);
- PFamilyInfo anInfo = CrFamilyInfo(theMeshInfo,aNbGroup,aNbAttr);
- GetFamilyInfo(theId,*anInfo,theErr);
+
+ TInt aNbAttr = GetNbFamAttr(theId, *theMeshInfo);
+ TInt aNbGroup = GetNbFamGroup(theId, *theMeshInfo);
+ PFamilyInfo anInfo = CrFamilyInfo(theMeshInfo, aNbGroup, aNbAttr);
+ GetFamilyInfo(theId, *anInfo, theErr);
#ifdef _DEBUG_
std::string aName = anInfo->GetName();
- INITMSG(MYDEBUG,"GetPFamilyInfo - aFamilyName = '"<<aName<<
+ INITMSG(MYDEBUG, "GetPFamilyInfo - aFamilyName = '"<<aName<<
"'; andId = "<<anInfo->GetId()<<
"; aNbAttr = "<<aNbAttr<<
"; aNbGroup = "<<aNbGroup<<"\n");
- for(TInt iGroup = 0; iGroup < aNbGroup; iGroup++){
+ for (TInt iGroup = 0; iGroup < aNbGroup; iGroup++) {
aName = anInfo->GetGroupName(iGroup);
- INITMSG(MYDEBUG,"aGroupName = '"<<aName<<"'\n");
+ INITMSG(MYDEBUG, "aGroupName = '"<<aName<<"'\n");
}
#endif
-
+
return anInfo;
}
+ //----------------------------------------------------------------------------
+ void
+ TWrapper
+ ::GetNames(TElemInfo& theInfo,
+ TInt theNb,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
+ TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+
+ if (theErr && *theErr < 0)
+ return;
+
+ if (theGeom == eBALL)
+ theGeom = GetBallGeom(theInfo.myMeshInfo);
+
+ MED::TMeshInfo& aMeshInfo = *theInfo.myMeshInfo;
+
+ TValueHolder<TString, char> aMeshName (aMeshInfo.myName);
+ TValueHolder<TString, char> anElemNames(theInfo.myElemNames);
+ TValueHolder<EEntiteMaillage, med_entity_type> anEntity (theEntity);
+ TValueHolder<EGeometrieElement, med_geometry_type> aGeom (theGeom);
+
+ TErr aRet = MEDmeshEntityNameRd(myFile->Id(),
+ &aMeshName,
+ MED_NO_DT,
+ MED_NO_IT,
+ anEntity,
+ aGeom,
+ &anElemNames);
+
+ theInfo.myIsElemNames = aRet != 0? eFAUX : eVRAI ;
+
+ if (theErr)
+ *theErr = aRet;
+ }
+
+ //----------------------------------------------------------------------------
+ void
+ TWrapper
+ ::SetNames(const TElemInfo& theInfo,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
+ TErr* theErr)
+ {
+ SetNames(theInfo, eLECTURE_ECRITURE, theEntity, theGeom, theErr);
+ }
//----------------------------------------------------------------------------
- PNodeInfo
+ void
TWrapper
- ::GetPNodeInfo(const PMeshInfo& theMeshInfo,
- TErr* theErr)
+ ::SetNames(const TElemInfo& theInfo,
+ EModeAcces theMode,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
+ TErr* theErr)
{
- TInt aNbElems = GetNbNodes(*theMeshInfo);
- if(aNbElems == 0){
- return PNodeInfo();
- }
+ TFileWrapper aFileWrapper(myFile, theMode, theErr);
- PNodeInfo anInfo = CrNodeInfo(theMeshInfo,aNbElems);
- GetNodeInfo(*anInfo,theErr);
+ if (theErr && *theErr < 0)
+ return;
-#ifdef _DEBUG_
- TInt aDim = theMeshInfo->myDim;
- TInt aNbElem = anInfo->GetNbElem();
- INITMSG(MYDEBUG,"GetPNodeInfo: ");
- {
- INITMSG(MYDEBUG,"aCoords: "<<aNbElem<<": ");
- TNodeCoord& aCoord = anInfo->myCoord;
- for(TInt iElem = 0; iElem < aNbElem; iElem++){
- for(TInt iDim = 0, anId = iElem*aDim; iDim < aDim; iDim++, anId++){
- ADDMSG(MYVALUEDEBUG,aCoord[anId]<<",");
- }
- ADDMSG(MYVALUEDEBUG," ");
- }
- ADDMSG(MYDEBUG, std::endl);
-
- BEGMSG(MYVALUEDEBUG, "GetFamNum: ");
- for(TInt iElem = 0; iElem < aNbElem; iElem++){
- ADDMSG(MYVALUEDEBUG,anInfo->GetFamNum(iElem)<<", ");
- }
- ADDMSG(MYVALUEDEBUG, std::endl);
-
- if(anInfo->IsElemNum()){
- BEGMSG(MYVALUEDEBUG,"GetElemNum: ");
- for(TInt iElem = 0; iElem < aNbElem; iElem++){
- ADDMSG(MYVALUEDEBUG,anInfo->GetElemNum(iElem)<<", ");
- }
- ADDMSG(MYVALUEDEBUG, std::endl);
- }
+ if (theGeom == eBALL)
+ theGeom = GetBallGeom(theInfo.myMeshInfo);
+
+ MED::TElemInfo& anInfo = const_cast<MED::TElemInfo&>(theInfo);
+ MED::TMeshInfo& aMeshInfo = *anInfo.myMeshInfo;
+
+ TErr aRet = 0;
+ if (theInfo.myIsElemNames) {
+ TValueHolder<TString, char> aMeshName (aMeshInfo.myName);
+ TValueHolder<TString, char> anElemNames(anInfo.myElemNames);
+ TValueHolder<EEntiteMaillage, med_entity_type> anEntity (theEntity);
+ TValueHolder<EGeometrieElement, med_geometry_type> aGeom (theGeom);
+
+ aRet = MEDmeshEntityNameWr(myFile->Id(),
+ &aMeshName,
+ MED_NO_DT,
+ MED_NO_IT,
+ anEntity,
+ aGeom,
+ (TInt)anInfo.myElemNames->size(),
+ &anElemNames);
+ if (theErr)
+ *theErr = aRet;
+ else if (aRet < 0)
+ EXCEPTION(std::runtime_error, "SetNames - MEDmeshEntityNameWr(...)");
}
- ADDMSG(MYDEBUG, std::endl);
-#endif
-
- return anInfo;
}
//----------------------------------------------------------------------------
- PPolygoneInfo
+ void
TWrapper
- ::GetPPolygoneInfo(const PMeshInfo& theMeshInfo,
- EEntiteMaillage theEntity,
- EGeometrieElement theGeom,
- EConnectivite theConnMode)
+ ::GetNumeration(TElemInfo& theInfo,
+ TInt theNb,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
+ TErr* theErr)
{
- if(theMeshInfo->GetType() != eNON_STRUCTURE)
- return PPolygoneInfo();
+ TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
- TInt aNbElem = GetNbPolygones(theMeshInfo,theEntity,theGeom,theConnMode);
- TInt aConnSize = GetPolygoneConnSize(theMeshInfo,theEntity,theGeom,theConnMode);
- PPolygoneInfo anInfo = CrPolygoneInfo(theMeshInfo,theEntity,theGeom,aNbElem,aConnSize,theConnMode);
- GetPolygoneInfo(anInfo);
+ if (theErr && *theErr < 0)
+ return;
-#ifdef _DEBUG_
- INITMSG(MYDEBUG,"GetPPolygoneInfo"<<
- " - theGeom = "<<theGeom<<
- "; aNbElem = "<<aNbElem<<": ");
- for(TInt iElem = 1; iElem < aNbElem; iElem++){
- TCConnSlice aConnSlice = anInfo->GetConnSlice(iElem);
- TInt aConnDim = aConnSlice.size();
- for(TInt iConn = 0; iConn < aConnDim; iConn++){
- ADDMSG(MYVALUEDEBUG,aConnSlice[iConn]<<",");
- }
- ADDMSG(MYDEBUG," ");
- }
- ADDMSG(MYDEBUG, std::endl);
-#endif
+ if (theGeom == eBALL)
+ theGeom = GetBallGeom(theInfo.myMeshInfo);
- return anInfo;
+ MED::TMeshInfo& aMeshInfo = *theInfo.myMeshInfo;
+
+ TValueHolder<TString, char> aMeshName(aMeshInfo.myName);
+ TValueHolder<TElemNum, med_int> anElemNum(theInfo.myElemNum);
+ TValueHolder<EEntiteMaillage, med_entity_type> anEntity (theEntity);
+ TValueHolder<EGeometrieElement, med_geometry_type> aGeom (theGeom);
+
+ TErr aRet = MEDmeshEntityNumberRd(myFile->Id(),
+ &aMeshName,
+ MED_NO_DT,
+ MED_NO_IT,
+ anEntity,
+ aGeom,
+ &anElemNum);
+
+ theInfo.myIsElemNum = aRet != 0? eFAUX : eVRAI;
+
+ if (theErr)
+ *theErr = aRet;
}
-
+
//----------------------------------------------------------------------------
- PPolyedreInfo
+ void
TWrapper
- ::GetPPolyedreInfo(const PMeshInfo& theMeshInfo,
- EEntiteMaillage theEntity,
- EGeometrieElement theGeom,
- EConnectivite theConnMode)
+ ::SetNumeration(const TElemInfo& theInfo,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
+ TErr* theErr)
{
- if(theMeshInfo->GetType() != eNON_STRUCTURE)
- return PPolyedreInfo();
- TInt aNbElem = GetNbPolyedres(theMeshInfo,theEntity,theGeom,theConnMode);
- TInt aNbFaces, aConnSize;
- GetPolyedreConnSize(theMeshInfo,aNbFaces,aConnSize,theConnMode);
- PPolyedreInfo anInfo = CrPolyedreInfo(theMeshInfo,theEntity,theGeom,aNbElem,aNbFaces,aConnSize,theConnMode);
- GetPolyedreInfo(anInfo);
+ SetNumeration(theInfo, eLECTURE_ECRITURE, theEntity, theGeom, theErr);
+ }
+
+ //----------------------------------------------------------------------------
+ void
+ TWrapper
+ ::SetNumeration(const TElemInfo& theInfo,
+ EModeAcces theMode,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
+ TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile, theMode, theErr);
+
+ if (theErr && *theErr < 0)
+ return;
+
+ if (theGeom == eBALL)
+ theGeom = GetBallGeom(theInfo.myMeshInfo);
+
+ MED::TElemInfo& anInfo = const_cast<MED::TElemInfo&>(theInfo);
+ MED::TMeshInfo& aMeshInfo = *anInfo.myMeshInfo;
+
+ TErr aRet = 0;
+ if (theInfo.myIsElemNum) {
+ TValueHolder<TString, char> aMeshName(aMeshInfo.myName);
+ TValueHolder<TElemNum, med_int> anElemNum(anInfo.myElemNum);
+ TValueHolder<EEntiteMaillage, med_entity_type> anEntity (theEntity);
+ TValueHolder<EGeometrieElement, med_geometry_type> aGeom (theGeom);
+
+ aRet = MEDmeshEntityNumberWr(myFile->Id(),
+ &aMeshName,
+ MED_NO_DT,
+ MED_NO_IT,
+ anEntity,
+ aGeom,
+ (TInt)anInfo.myElemNum->size(),
+ &anElemNum);
+ if (theErr)
+ *theErr = aRet;
+ else if (aRet < 0)
+ EXCEPTION(std::runtime_error, "SetNumeration - MEDmeshEntityNumberWr(...)");
+ }
+ }
+
+ //----------------------------------------------------------------------------
+ void
+ TWrapper
+ ::GetFamilies(TElemInfo& theInfo,
+ TInt theNb,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
+ TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+
+ if (theErr && *theErr < 0)
+ return;
+
+ if (theGeom == eBALL)
+ theGeom = GetBallGeom(theInfo.myMeshInfo);
+
+ MED::TMeshInfo& aMeshInfo = *theInfo.myMeshInfo;
+
+ TValueHolder<TString, char> aMeshName(aMeshInfo.myName);
+ TValueHolder<TElemNum, med_int> aFamNum (theInfo.myFamNum);
+ TValueHolder<EEntiteMaillage, med_entity_type> anEntity (theEntity);
+ TValueHolder<EGeometrieElement, med_geometry_type> aGeom (theGeom);
+
+ TErr aRet = MEDmeshEntityFamilyNumberRd(myFile->Id(),
+ &aMeshName,
+ MED_NO_DT,
+ MED_NO_IT,
+ anEntity,
+ aGeom,
+ &aFamNum);
+
+ if (aRet < 0) {
+ // if (aRet == MED_ERR_DOESNTEXIST) // --- only valid with MED3.x files
+ {
+ int aSize = (int)theInfo.myFamNum->size();
+ theInfo.myFamNum->clear();
+ theInfo.myFamNum->resize(aSize,0);
+ aRet = 0;
+ }
+ // else
+ // EXCEPTION(std::runtime_error,"GetGrilleInfo - MEDmeshEntityFamilyNumberRd(...) of CELLS");
+ }
+ if (theErr)
+ *theErr = aRet;
+ }
+
+ //----------------------------------------------------------------------------
+ void
+ TWrapper
+ ::SetFamilies(const TElemInfo& theInfo,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
+ TErr* theErr)
+ {
+ SetFamilies(theInfo, eLECTURE_ECRITURE, theEntity, theGeom, theErr);
+ }
+
+ //----------------------------------------------------------------------------
+ void
+ TWrapper
+ ::SetFamilies(const TElemInfo& theInfo,
+ EModeAcces theMode,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
+ TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile, theMode, theErr);
+
+ if (theErr && *theErr < 0)
+ return;
+
+ if (theGeom == eBALL)
+ theGeom = GetBallGeom(theInfo.myMeshInfo);
+
+ MED::TElemInfo& anInfo = const_cast<MED::TElemInfo&>(theInfo);
+ MED::TMeshInfo& aMeshInfo = *anInfo.myMeshInfo;
+
+ TValueHolder<TString, char> aMeshName(aMeshInfo.myName);
+ TValueHolder<TElemNum, med_int> aFamNum (anInfo.myFamNum);
+ TValueHolder<EEntiteMaillage, med_entity_type> anEntity (theEntity);
+ TValueHolder<EGeometrieElement, med_geometry_type> aGeom (theGeom);
+
+ TErr aRet = MEDmeshEntityFamilyNumberWr(myFile->Id(),
+ &aMeshName,
+ MED_NO_DT,
+ MED_NO_IT,
+ anEntity,
+ aGeom,
+ (TInt)anInfo.myFamNum->size(),
+ &aFamNum);
+
+ if (theErr)
+ *theErr = aRet;
+ else if (aRet < 0)
+ EXCEPTION(std::runtime_error, "SetFamilies - MEDmeshEntityFamilyNumberWr(...)");
+ }
+
+ //----------------------------------------------------------------------------
+ TInt
+ TWrapper
+ ::GetNbNodes(const MED::TMeshInfo& theMeshInfo,
+ TErr* theErr)
+ {
+ return GetNbNodes(theMeshInfo, eCOOR, theErr);
+ }
+
+ //----------------------------------------------------------------------------
+ TInt
+ TWrapper
+ ::GetNbNodes(const MED::TMeshInfo& theMeshInfo,
+ ETable theTable,
+ TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+
+ if (theErr && *theErr < 0)
+ return -1;
+
+ MED::TMeshInfo& aMeshInfo = const_cast<MED::TMeshInfo&>(theMeshInfo);
+
+ TValueHolder<TString, char> aMeshName(aMeshInfo.myName);
+ TValueHolder<ETable, med_data_type > aTable(theTable);
+ med_bool chgt,trsf;
+ return MEDmeshnEntity(myFile->Id(),
+ &aMeshName,
+ MED_NO_DT,
+ MED_NO_IT,
+ MED_NODE,
+ MED_NO_GEOTYPE,
+ aTable,
+ MED_NO_CMODE,
+ &chgt,
+ &trsf);
+ }
+
+ //----------------------------------------------------------------------------
+ void
+ TWrapper
+ ::GetNodeInfo(MED::TNodeInfo& theInfo,
+ TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+
+ if (theErr && *theErr < 0)
+ return;
+
+ MED::TMeshInfo& aMeshInfo = *theInfo.myMeshInfo;
+
+ TValueHolder<TString, char> aMeshName(aMeshInfo.myName);
+ TValueHolder<TInt, med_int> aDim(aMeshInfo.myDim);
+ TValueHolder<TNodeCoord, med_float> aCoord(theInfo.myCoord);
+ TValueHolder<EModeSwitch, med_switch_mode> aModeSwitch(theInfo.myModeSwitch);
+ TValueHolder<ERepere, med_axis_type> aSystem(theInfo.mySystem);
+ TValueHolder<TString, char> aCoordNames(theInfo.myCoordNames);
+ TValueHolder<TString, char> aCoordUnits(theInfo.myCoordUnits);
+ TValueHolder<TString, char> anElemNames(theInfo.myElemNames);
+ //TValueHolder<EBooleen, med_bool> anIsElemNames(theInfo.myIsElemNames);
+ TValueHolder<TElemNum, med_int> anElemNum(theInfo.myElemNum);
+ //TValueHolder<EBooleen, med_bool> anIsElemNum(theInfo.myIsElemNum);
+ TValueHolder<TElemNum, med_int> aFamNum(theInfo.myFamNum);
+ TValueHolder<TInt, med_int> aNbElem(theInfo.myNbElem);
+
+ TErr aRet = MEDmeshNodeCoordinateRd(myFile->Id(),
+ &aMeshName,
+ MED_NO_DT,
+ MED_NO_IT,
+ aModeSwitch,
+ &aCoord);
+
+ TErr aRet2 =MEDmeshEntityFamilyNumberRd(myFile->Id(),
+ &aMeshName,
+ MED_NO_DT,
+ MED_NO_IT,
+ MED_NODE,
+ MED_NO_GEOTYPE,
+ &aFamNum);
+ if (aRet2 < 0) {
+ // if (aRet2 == MED_ERR_DOESNTEXIST) // --- only valid with MED3.x files
+ {
+ int mySize = (int)theInfo.myFamNum->size();
+ theInfo.myFamNum->clear();
+ theInfo.myFamNum->resize(mySize,0);
+ }
+ // else
+ // EXCEPTION(std::runtime_error,"GetNodeInfo - MEDmeshEntityFamilyNumberRd(...)");
+ }
+
+ if (MEDmeshEntityNameRd(myFile->Id(),
+ &aMeshName,
+ MED_NO_DT,
+ MED_NO_IT,
+ MED_NODE,
+ MED_NO_GEOTYPE,
+ &anElemNames) < 0) theInfo.myIsElemNames=eFAUX;
+
+ if (MEDmeshEntityNumberRd(myFile->Id(),
+ &aMeshName,
+ MED_NO_DT,
+ MED_NO_IT,
+ MED_NODE,
+ MED_NO_GEOTYPE,
+ &anElemNum) < 0) theInfo.myIsElemNum=eFAUX;
+
+ if (theErr)
+ *theErr = aRet;
+ else if (aRet < 0)
+ EXCEPTION(std::runtime_error, "GetNodeInfo - MEDmeshNodeCoordinateRd(...)");
+ }
+
+ //----------------------------------------------------------------------------
+ void
+ TWrapper
+ ::SetNodeInfo(const MED::TNodeInfo& theInfo,
+ TErr* theErr)
+ {
+ TErr aRet;
+ SetNodeInfo(theInfo, eLECTURE_ECRITURE, &aRet);
+
+ if (aRet < 0)
+ SetNodeInfo(theInfo, eLECTURE_AJOUT, &aRet);
+
+ if (theErr)
+ *theErr = aRet;
+ }
+
+ //----------------------------------------------------------------------------
+ void
+ TWrapper
+ ::SetNodeInfo(const MED::TNodeInfo& theInfo,
+ EModeAcces theMode,
+ TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile, theMode, theErr);
+
+ if (theErr && *theErr < 0)
+ return;
+
+ MED::TNodeInfo& anInfo = const_cast<MED::TNodeInfo&>(theInfo);
+ MED::TMeshInfo& aMeshInfo = *anInfo.myMeshInfo;
+
+ TValueHolder<TString, char> aMeshName (aMeshInfo.myName);
+ TValueHolder<TNodeCoord, med_float> aCoord (anInfo.myCoord);
+ TValueHolder<EModeSwitch, med_switch_mode> aModeSwitch (anInfo.myModeSwitch);
+ TValueHolder<ERepere, med_axis_type> aSystem (anInfo.mySystem);
+ TValueHolder<TString, char> aCoordNames (anInfo.myCoordNames);
+ TValueHolder<TString, char> aCoordUnits (anInfo.myCoordUnits);
+ TValueHolder<TString, char> anElemNames (anInfo.myElemNames);
+ TValueHolder<EBooleen, med_bool> anIsElemNames(anInfo.myIsElemNames);
+ TValueHolder<TElemNum, med_int> anElemNum (anInfo.myElemNum);
+ TValueHolder<EBooleen, med_bool> anIsElemNum (anInfo.myIsElemNum);
+ TValueHolder<TElemNum, med_int> aFamNum (anInfo.myFamNum);
+ TValueHolder<TInt, med_int> aNbElem (anInfo.myNbElem);
+
+ TErr aRet = MEDmeshNodeCoordinateWr(myFile->Id(),
+ &aMeshName,
+ MED_NO_DT,
+ MED_NO_IT,
+ MED_NO_DT,
+ aModeSwitch,
+ aNbElem,
+ &aCoord);
+
+ MEDmeshEntityFamilyNumberWr(myFile->Id(),
+ &aMeshName,
+ MED_NO_DT,
+ MED_NO_IT,
+ MED_NODE,
+ MED_NO_GEOTYPE,
+ aNbElem,
+ &aFamNum);
+ if (anIsElemNames)
+ MEDmeshEntityNameWr(myFile->Id(),
+ &aMeshName,
+ MED_NO_DT,
+ MED_NO_IT,
+ MED_NODE,
+ MED_NO_GEOTYPE,
+ aNbElem,
+ &anElemNames);
+ if (anIsElemNum)
+ MEDmeshEntityNumberWr(myFile->Id(),
+ &aMeshName,
+ MED_NO_DT,
+ MED_NO_IT,
+ MED_NODE,
+ MED_NO_GEOTYPE,
+ aNbElem,
+ &anElemNum);
+ if (theErr)
+ *theErr = aRet;
+ else if (aRet < 0)
+ EXCEPTION(std::runtime_error, "SetNodeInfo - MEDmeshNodeCoordinateWr(...)");
+ }
+
+ //----------------------------------------------------------------------------
+ PNodeInfo
+ TWrapper
+ ::CrNodeInfo(const PMeshInfo& theMeshInfo,
+ TInt theNbElem,
+ EModeSwitch theMode,
+ ERepere theSystem,
+ EBooleen theIsElemNum,
+ EBooleen theIsElemNames)
+ {
+ return PNodeInfo(new TTNodeInfo
+ (theMeshInfo,
+ theNbElem,
+ theMode,
+ theSystem,
+ theIsElemNum,
+ theIsElemNames));
+ }
+
+ //----------------------------------------------------------------------------
+ PNodeInfo
+ TWrapper
+ ::CrNodeInfo(const PMeshInfo& theMeshInfo,
+ const TFloatVector& theNodeCoords,
+ EModeSwitch theMode,
+ ERepere theSystem,
+ const TStringVector& theCoordNames,
+ const TStringVector& theCoordUnits,
+ const TIntVector& theFamilyNums,
+ const TIntVector& theElemNums,
+ const TStringVector& theElemNames)
+ {
+ return PNodeInfo(new TTNodeInfo
+ (theMeshInfo,
+ theNodeCoords,
+ theMode,
+ theSystem,
+ theCoordNames,
+ theCoordUnits,
+ theFamilyNums,
+ theElemNums,
+ theElemNames));
+ }
+
+ //----------------------------------------------------------------------------
+ PNodeInfo
+ TWrapper
+ ::CrNodeInfo(const PMeshInfo& theMeshInfo,
+ const PNodeInfo& theInfo)
+ {
+ return PNodeInfo(new TTNodeInfo
+ (theMeshInfo,
+ theInfo));
+ }
+
+ //----------------------------------------------------------------------------
+ PNodeInfo
+ TWrapper
+ ::GetPNodeInfo(const PMeshInfo& theMeshInfo,
+ TErr* theErr)
+ {
+ TInt aNbElems = GetNbNodes(*theMeshInfo);
+ if (aNbElems == 0) {
+ return PNodeInfo();
+ }
+
+ PNodeInfo anInfo = CrNodeInfo(theMeshInfo, aNbElems);
+ GetNodeInfo(*anInfo, theErr);
#ifdef _DEBUG_
- INITMSG(MYDEBUG,"GetPPolyedreInfo"<<
- " - theGeom = "<<theGeom<<
- "; aNbElem = "<<aNbElem<<": ");
- for(TInt iElem = 0; iElem < aNbElem; iElem++){
- TCConnSliceArr aConnSliceArr = anInfo->GetConnSliceArr(iElem);
- TInt aNbFaces = aConnSliceArr.size();
- ADDMSG(MYDEBUG,"{");
- for(TInt iFace = 0; iFace < aNbFaces; iFace++){
- TCConnSlice aConnSlice = aConnSliceArr[iFace];
- TInt aNbConn = aConnSlice.size();
- ADDMSG(MYDEBUG,"[");
- for(TInt iConn = 0; iConn < aNbConn; iConn++){
- ADDMSG(MYVALUEDEBUG,aConnSlice[iConn]<<",");
+ TInt aDim = theMeshInfo->myDim;
+ TInt aNbElem = anInfo->GetNbElem();
+ INITMSG(MYDEBUG, "GetPNodeInfo: ");
+ {
+ INITMSG(MYDEBUG, "aCoords: "<<aNbElem<<": ");
+ TNodeCoord& aCoord = anInfo->myCoord;
+ for (TInt iElem = 0; iElem < aNbElem; iElem++) {
+ for (TInt iDim = 0, anId = iElem*aDim; iDim < aDim; iDim++, anId++) {
+ ADDMSG(MYVALUEDEBUG, aCoord[anId]<<",");
+ }
+ ADDMSG(MYVALUEDEBUG, " ");
+ }
+ ADDMSG(MYDEBUG, std::endl);
+
+ BEGMSG(MYVALUEDEBUG, "GetFamNum: ");
+ for (TInt iElem = 0; iElem < aNbElem; iElem++) {
+ ADDMSG(MYVALUEDEBUG, anInfo->GetFamNum(iElem)<<", ");
+ }
+ ADDMSG(MYVALUEDEBUG, std::endl);
+
+ if (anInfo->IsElemNum()) {
+ BEGMSG(MYVALUEDEBUG, "GetElemNum: ");
+ for (TInt iElem = 0; iElem < aNbElem; iElem++) {
+ ADDMSG(MYVALUEDEBUG, anInfo->GetElemNum(iElem)<<", ");
}
- ADDMSG(MYDEBUG,"] ");
+ ADDMSG(MYVALUEDEBUG, std::endl);
}
- ADDMSG(MYDEBUG,"} ");
}
ADDMSG(MYDEBUG, std::endl);
#endif
return anInfo;
}
-
+
+ //----------------------------------------------------------------------------
+ PElemInfo
+ TWrapper
+ ::CrElemInfo(const PMeshInfo& theMeshInfo,
+ TInt theNbElem,
+ EBooleen theIsElemNum,
+ EBooleen theIsElemNames)
+ {
+ return PElemInfo(new TTElemInfo
+ (theMeshInfo,
+ theNbElem,
+ theIsElemNum,
+ theIsElemNames));
+ }
+
+ //----------------------------------------------------------------------------
+ PElemInfo
+ TWrapper
+ ::CrElemInfo(const PMeshInfo& theMeshInfo,
+ TInt theNbElem,
+ const TIntVector& theFamNum,
+ const TIntVector& aElemNum,
+ const TStringVector& aElemNames)
+ {
+ return PElemInfo(new TTElemInfo
+ (theMeshInfo,
+ theNbElem,
+ theFamNum,
+ aElemNum,
+ aElemNames));
+ }
+
//----------------------------------------------------------------------------
- PElemInfo
+ PElemInfo
TWrapper
::GetPElemInfo(const PMeshInfo& theMeshInfo,
- EEntiteMaillage theEntity,
- EGeometrieElement theGeom,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
EConnectivite theConnMode,
TErr* theErr)
{
EMaillage aType = theMeshInfo->GetType();
- if(aType == eNON_STRUCTURE){
- switch(theGeom){
+ if (aType == eNON_STRUCTURE) {
+ switch (theGeom) {
case ePOINT1:
- if(theEntity == eNOEUD)
- return GetPNodeInfo(theMeshInfo,theErr);
- return GetPCellInfo(theMeshInfo,theEntity,theGeom,theConnMode,theErr);
+ if (theEntity == eNOEUD)
+ return GetPNodeInfo(theMeshInfo, theErr);
+ return GetPCellInfo(theMeshInfo, theEntity, theGeom, theConnMode, theErr);
break;
case ePOLYGONE:
- return GetPPolygoneInfo(theMeshInfo,theEntity,theGeom,theConnMode);
+ return GetPPolygoneInfo(theMeshInfo, theEntity, theGeom, theConnMode);
break;
case ePOLYEDRE:
- return GetPPolyedreInfo(theMeshInfo,theEntity,theGeom,theConnMode);
+ return GetPPolyedreInfo(theMeshInfo, theEntity, theGeom, theConnMode);
break;
default:
- return GetPCellInfo(theMeshInfo,theEntity,theGeom,theConnMode,theErr);
+ return GetPCellInfo(theMeshInfo, theEntity, theGeom, theConnMode, theErr);
}
- } else {
+ }
+ else {
PGrilleInfo aGrille = GetPGrilleInfo(theMeshInfo);
TInt nbElems;
EBooleen theIsElemNum = eFAUX;
// nodes
- switch(theGeom){
+ switch (theGeom) {
case ePOINT1:
nbElems = aGrille->GetNbNodes();
theIsElemNum = eVRAI;
default:
nbElems = 0;
}
-
+
TIntVector aFamNum;
TIntVector aElemNum;
TStringVector aElemNames;
-
+
PElemInfo aElemInfo;
- if(theGeom == ePOINT1){
+ if (theGeom == ePOINT1) {
aElemInfo = CrElemInfo(theMeshInfo,
nbElems,
theIsElemNum);
MED::TElemInfo &aTElemInfo = *aElemInfo;
// must be reimplemente in connection with mesh type eSTRUCTURE
-// GetNumeration(aTElemInfo,
-// nbElems,
-// theEntity,
-// theGeom,
-// theErr);
-
+ // GetNumeration(aTElemInfo,
+ // nbElems,
+ // theEntity,
+ // theGeom,
+ // theErr);
+
GetFamilies(aTElemInfo,
nbElems,
theEntity,
theGeom,
theErr);
-
+
// must be reimplemente in connection with mesh type eSTRUCTURE
-// GetNames(aTElemInfo,
-// nbElems,
-// theEntity,
-// theGeom,
-// theErr);
- } else {
+ // GetNames(aTElemInfo,
+ // nbElems,
+ // theEntity,
+ // theGeom,
+ // theErr);
+ }
+ else {
aElemInfo = CrElemInfo(theMeshInfo,
nbElems,
aFamNum,
aElemNum,
aElemNames);
}
-
+
return aElemInfo;
}
return PElemInfo();
}
+ //----------------------------------------------------------------------------
+ TInt
+ TWrapper
+ ::GetNbPolygones(const MED::TMeshInfo& theMeshInfo,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
+ EConnectivite theConnMode,
+ TErr* theErr)
+ {
+ return GetNbCells(theMeshInfo, theEntity, theGeom, theConnMode, theErr);
+ }
+
+ //----------------------------------------------------------------------------
+ TInt
+ TWrapper
+ ::GetPolygoneConnSize(const MED::TMeshInfo& theMeshInfo,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
+ EConnectivite theConnMode,
+ TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+
+ if (theErr && *theErr < 0)
+ return 0;
+
+ MED::TMeshInfo& aMeshInfo = const_cast<MED::TMeshInfo&>(theMeshInfo);
+
+ TValueHolder<TString, char> aMeshName(aMeshInfo.myName);
+ med_int aTaille = 0;
+ med_bool chgt,trsf;
+ aTaille=MEDmeshnEntity(myFile->Id(),
+ &aMeshName,
+ MED_NO_DT,
+ MED_NO_IT,
+ med_entity_type(theEntity),
+ med_geometry_type(theGeom),
+ MED_CONNECTIVITY,
+ med_connectivity_mode(theConnMode),
+ &chgt,
+ &trsf);
+
+ if (aTaille < 0)
+ EXCEPTION(std::runtime_error, "GetPolygoneInfo - MEDmeshnEntity(...)");
+
+ return TInt(aTaille);
+ }
+
+ //-----------------------------------------------------------------
+ void
+ TWrapper
+ ::GetPolygoneInfo(MED::TPolygoneInfo& theInfo,
+ TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+
+ if (theErr && *theErr < 0)
+ return;
+
+ MED::TMeshInfo& aMeshInfo = *theInfo.myMeshInfo;
+
+ TValueHolder<TString, char > aMeshName(aMeshInfo.myName);
+ TValueHolder<TElemNum, med_int > anIndex (theInfo.myIndex);
+ TValueHolder<TElemNum, med_int > aConn (theInfo.myConn);
+ TValueHolder<EEntiteMaillage, med_entity_type > anEntity (theInfo.myEntity);
+ TValueHolder<EGeometrieElement, med_geometry_type> aGeom (theInfo.myGeom);
+ TValueHolder<EConnectivite, med_connectivity_mode> aConnMode(theInfo.myConnMode);
+ TInt aNbElem = (TInt)theInfo.myElemNum->size();
+
+ TErr aRet;
+ aRet = MEDmeshPolygon2Rd(myFile->Id(), &aMeshName,
+ MED_NO_DT, MED_NO_IT,
+ anEntity, aGeom,
+ aConnMode, &anIndex, &aConn);
+
+ if (theErr)
+ *theErr = aRet;
+ else if (aRet < 0)
+ EXCEPTION(std::runtime_error, "GetPolygoneInfo - MEDmeshPolygonRd(...)");
+
+ if (theInfo.myIsElemNames) {
+ GetNames(theInfo, aNbElem, theInfo.myEntity, theInfo.myGeom, &aRet);
+ if (theErr)
+ *theErr = aRet;
+ }
+
+ if (theInfo.myIsElemNum) {
+ GetNumeration(theInfo, aNbElem, theInfo.myEntity, theInfo.myGeom, &aRet);
+ if (theErr)
+ *theErr = aRet;
+ }
+
+ GetFamilies(theInfo, aNbElem, theInfo.myEntity, theInfo.myGeom, &aRet);
+ if (theErr)
+ *theErr = aRet;
+ }
+
+ //----------------------------------------------------------------------------
+ void
+ TWrapper
+ ::SetPolygoneInfo(const MED::TPolygoneInfo& theInfo,
+ TErr* theErr)
+ {
+ SetPolygoneInfo(theInfo, eLECTURE_ECRITURE, theErr);
+ }
+
+ //----------------------------------------------------------------------------
+ void
+ TWrapper
+ ::SetPolygoneInfo(const MED::TPolygoneInfo& theInfo,
+ EModeAcces theMode,
+ TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile, theMode, theErr);
+
+ if (theErr && *theErr < 0)
+ return;
+
+ MED::TPolygoneInfo& anInfo = const_cast<MED::TPolygoneInfo&>(theInfo);
+ MED::TMeshInfo& aMeshInfo = *anInfo.myMeshInfo;
+
+ TValueHolder<TString, char > aMeshName(aMeshInfo.myName);
+ TValueHolder<TElemNum, med_int > anIndex (anInfo.myIndex);
+ TValueHolder<TElemNum, med_int > aConn (anInfo.myConn);
+ TValueHolder<EEntiteMaillage, med_entity_type > anEntity (anInfo.myEntity);
+ TValueHolder<EGeometrieElement, med_geometry_type> aGeom (anInfo.myGeom);
+ TValueHolder<EConnectivite, med_connectivity_mode> aConnMode(anInfo.myConnMode);
+
+ TErr aRet = MEDmeshPolygon2Wr(myFile->Id(), &aMeshName,
+ MED_NO_DT, MED_NO_IT, MED_UNDEF_DT,
+ anEntity, aGeom,
+ aConnMode, anInfo.myNbElem + 1,
+ &anIndex, &aConn);
+ if (theErr)
+ *theErr = aRet;
+ else if (aRet < 0)
+ EXCEPTION(std::runtime_error, "SetPolygoneInfo - MEDmeshPolygonWr(...)");
+
+ SetNames(anInfo, theInfo.myEntity, anInfo.myGeom, &aRet);
+ if (theErr)
+ *theErr = aRet;
+
+ SetNumeration(anInfo, theInfo.myEntity, anInfo.myGeom, &aRet);
+ if (theErr)
+ *theErr = aRet;
+
+ SetFamilies(anInfo, theInfo.myEntity, anInfo.myGeom, &aRet);
+ if (theErr)
+ *theErr = aRet;
+ }
+
+ //----------------------------------------------------------------------------
+ PPolygoneInfo
+ TWrapper
+ ::CrPolygoneInfo(const PMeshInfo& theMeshInfo,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
+ TInt theNbElem,
+ TInt theConnSize,
+ EConnectivite theConnMode,
+ EBooleen theIsElemNum,
+ EBooleen theIsElemNames)
+ {
+ return PPolygoneInfo(new TTPolygoneInfo
+ (theMeshInfo,
+ theEntity,
+ theGeom,
+ theNbElem,
+ theConnSize,
+ theConnMode,
+ theIsElemNum,
+ theIsElemNames));
+ }
+
+ //----------------------------------------------------------------------------
+ PPolygoneInfo
+ TWrapper
+ ::CrPolygoneInfo(const PMeshInfo& theMeshInfo,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
+ const TIntVector& theIndexes,
+ const TIntVector& theConnectivities,
+ EConnectivite theConnMode,
+ const TIntVector& theFamilyNums,
+ const TIntVector& theElemNums,
+ const TStringVector& theElemNames)
+ {
+ return PPolygoneInfo(new TTPolygoneInfo
+ (theMeshInfo,
+ theEntity,
+ theGeom,
+ theIndexes,
+ theConnectivities,
+ theConnMode,
+ theFamilyNums,
+ theElemNums,
+ theElemNames));
+ }
+
+ //----------------------------------------------------------------------------
+ PPolygoneInfo
+ TWrapper
+ ::CrPolygoneInfo(const PMeshInfo& theMeshInfo,
+ const PPolygoneInfo& theInfo)
+ {
+ return PPolygoneInfo(new TTPolygoneInfo
+ (theMeshInfo,
+ theInfo));
+ }
+
+ //----------------------------------------------------------------------------
+ PPolygoneInfo
+ TWrapper
+ ::GetPPolygoneInfo(const PMeshInfo& theMeshInfo,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
+ EConnectivite theConnMode)
+ {
+ if (theMeshInfo->GetType() != eNON_STRUCTURE)
+ return PPolygoneInfo();
+
+ TInt aNbElem = GetNbPolygones(theMeshInfo, theEntity, theGeom, theConnMode);
+ TInt aConnSize = GetPolygoneConnSize(theMeshInfo, theEntity, theGeom, theConnMode);
+ PPolygoneInfo anInfo = CrPolygoneInfo(theMeshInfo, theEntity, theGeom, aNbElem, aConnSize, theConnMode);
+ GetPolygoneInfo(anInfo);
+
+#ifdef _DEBUG_
+ INITMSG(MYDEBUG, "GetPPolygoneInfo"<<
+ " - theGeom = "<<theGeom<<
+ "; aNbElem = "<<aNbElem<<": ");
+ for (TInt iElem = 1; iElem < aNbElem; iElem++) {
+ TCConnSlice aConnSlice = anInfo->GetConnSlice(iElem);
+ TInt aConnDim = aConnSlice.size();
+ for (TInt iConn = 0; iConn < aConnDim; iConn++) {
+ ADDMSG(MYVALUEDEBUG, aConnSlice[iConn]<<",");
+ }
+ ADDMSG(MYDEBUG, " ");
+ }
+ ADDMSG(MYDEBUG, std::endl);
+#endif
+
+ return anInfo;
+ }
+
+ //----------------------------------------------------------------------------
+ TInt
+ TWrapper
+ ::GetNbPolyedres(const MED::TMeshInfo& theMeshInfo,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
+ EConnectivite theConnMode,
+ TErr* theErr)
+ {
+ return GetNbCells(theMeshInfo, theEntity, theGeom, theConnMode, theErr);
+ }
+
+ //----------------------------------------------------------------------------
+ void
+ TWrapper
+ ::GetPolyedreConnSize(const TMeshInfo& theMeshInfo,
+ TInt& theNbFaces,
+ TInt& theConnSize,
+ EConnectivite theConnMode,
+ TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+
+ if (theErr && *theErr < 0)
+ EXCEPTION(std::runtime_error, "GetPolyedreConnSize - (...)");
+
+ MED::TMeshInfo& aMeshInfo = const_cast<MED::TMeshInfo&>(theMeshInfo);
+
+ TValueHolder<TString, char> aMeshName(aMeshInfo.myName);
+ TValueHolder<EConnectivite, med_connectivity_mode> aConnMode(theConnMode);
+ //TValueHolder<TInt, med_int> aNbFaces(theNbFaces);
+ //TValueHolder<TInt, med_int> aConnSize(theConnSize);
+
+ med_bool chgt, trsf;
+ theNbFaces = MEDmeshnEntity(myFile->Id(),
+ &aMeshName,
+ MED_NO_DT,
+ MED_NO_IT,
+ MED_CELL,
+ MED_POLYHEDRON,
+ MED_INDEX_NODE,
+ aConnMode,
+ &chgt,
+ &trsf);
+
+ theConnSize = MEDmeshnEntity(myFile->Id(),
+ &aMeshName,
+ MED_NO_DT,
+ MED_NO_IT,
+ MED_CELL,
+ MED_POLYHEDRON,
+ MED_CONNECTIVITY,
+ aConnMode,
+ &chgt,
+ &trsf);
+
+ if (theNbFaces < 0 || theConnSize<0)
+ EXCEPTION(std::runtime_error, "GetPolygoneInfo - MEDmeshnEntity(...)");
+
+ }
+
+ //-----------------------------------------------------------------
+ void
+ TWrapper
+ ::GetPolyedreInfo(TPolyedreInfo& theInfo,
+ TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+
+ if (theErr && *theErr < 0)
+ return;
+
+ MED::TMeshInfo& aMeshInfo = *theInfo.myMeshInfo;
+
+ TValueHolder<TString, char> aMeshName(aMeshInfo.myName);
+ TInt aNbElem = (TInt)theInfo.myElemNum->size();
+ TValueHolder<TElemNum, med_int> anIndex(theInfo.myIndex);
+ TValueHolder<TElemNum, med_int> aFaces(theInfo.myFaces);
+ TValueHolder<TElemNum, med_int> aConn(theInfo.myConn);
+ TValueHolder<EConnectivite, med_connectivity_mode> aConnMode(theInfo.myConnMode);
+
+ TErr aRet;
+ aRet = MEDmeshPolyhedronRd(myFile->Id(),
+ &aMeshName,
+ MED_NO_DT,
+ MED_NO_IT,
+ MED_CELL,
+ aConnMode,
+ &anIndex,
+ &aFaces,
+ &aConn);
+
+ if (theErr)
+ *theErr = aRet;
+ else if (aRet < 0)
+ EXCEPTION(std::runtime_error, "GetPolygoneInfo - MEDmeshPolyhedronRd(...)");
+
+ if (theInfo.myIsElemNames) {
+ GetNames(theInfo, aNbElem, theInfo.myEntity, ePOLYEDRE, &aRet);
+ if (theErr)
+ *theErr = aRet;
+ }
+
+ if (theInfo.myIsElemNum) {
+ GetNumeration(theInfo, aNbElem, theInfo.myEntity, ePOLYEDRE, &aRet);
+ if (theErr)
+ *theErr = aRet;
+ }
+
+ GetFamilies(theInfo, aNbElem, theInfo.myEntity, ePOLYEDRE, &aRet);
+ if (theErr)
+ *theErr = aRet;
+ }
+
+ //----------------------------------------------------------------------------
+ void
+ TWrapper
+ ::SetPolyedreInfo(const TPolyedreInfo& theInfo,
+ TErr* theErr)
+ {
+ SetPolyedreInfo(theInfo, eLECTURE_ECRITURE, theErr);
+ }
+
+ //----------------------------------------------------------------------------
+ void
+ TWrapper
+ ::SetPolyedreInfo(const MED::TPolyedreInfo& theInfo,
+ EModeAcces theMode,
+ TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile, theMode, theErr);
+
+ if (theErr && *theErr < 0)
+ return;
+
+ MED::TPolyedreInfo& anInfo = const_cast<MED::TPolyedreInfo&>(theInfo);
+ MED::TMeshInfo& aMeshInfo = *anInfo.myMeshInfo;
+
+ TValueHolder<TString, char> aMeshName(aMeshInfo.myName);
+ TValueHolder<TElemNum, med_int> anIndex(anInfo.myIndex);
+ TValueHolder<TElemNum, med_int> aFaces(anInfo.myFaces);
+ TValueHolder<TElemNum, med_int> aConn(anInfo.myConn);
+ TValueHolder<EConnectivite, med_connectivity_mode> aConnMode(anInfo.myConnMode);
+
+ TErr aRet;
+ aRet = MEDmeshPolyhedronWr(myFile->Id(),
+ &aMeshName,
+ MED_NO_DT,
+ MED_NO_IT,
+ MED_UNDEF_DT,
+ MED_CELL,
+ aConnMode,
+ anInfo.myNbElem+1,
+ &anIndex,
+ (TInt)anInfo.myFaces->size(),
+ &aFaces,
+ &aConn);
+
+ if (theErr)
+ *theErr = aRet;
+ else if (aRet < 0)
+ EXCEPTION(std::runtime_error, "SetPolyedreInfo - MEDmeshPolyhedronWr(...)");
+
+ TValueHolder<EEntiteMaillage, med_entity_type> anEntity(anInfo.myEntity);
+
+ if (theInfo.myIsElemNames) {
+ TValueHolder<TString, char> anElemNames(anInfo.myElemNames);
+ aRet = MEDmeshEntityNameWr(myFile->Id(),
+ &aMeshName,
+ MED_NO_DT,
+ MED_NO_IT,
+ anEntity,
+ MED_POLYHEDRON,
+ (TInt)anInfo.myElemNames->size(),
+ &anElemNames);
+ if (theErr)
+ *theErr = aRet;
+ else if (aRet < 0)
+ EXCEPTION(std::runtime_error, "SetPolyedreInfo - MEDmeshEntityNameWr(...)");
+ }
+
+ if (theInfo.myIsElemNum) {
+ TValueHolder<TElemNum, med_int> anElemNum(anInfo.myElemNum);
+ aRet = MEDmeshEntityNumberWr(myFile->Id(),
+ &aMeshName,
+ MED_NO_DT,
+ MED_NO_IT,
+ anEntity,
+ MED_POLYHEDRON,
+ (TInt)anInfo.myElemNum->size(),
+ &anElemNum);
+ if (theErr)
+ *theErr = aRet;
+ else if (aRet < 0)
+ EXCEPTION(std::runtime_error, "SetPolyedreInfo - MEDmeshEntityNumberWr(...)");
+ }
+
+ TValueHolder<TElemNum, med_int> aFamNum(anInfo.myFamNum);
+ aRet = MEDmeshEntityFamilyNumberWr(myFile->Id(),
+ &aMeshName,
+ MED_NO_DT,
+ MED_NO_IT,
+ anEntity,
+ MED_POLYHEDRON,
+ (TInt)anInfo.myFamNum->size(),
+ &aFamNum);
+
+ if (theErr)
+ *theErr = aRet;
+ else if (aRet < 0)
+ EXCEPTION(std::runtime_error, "SetPolyedreInfo - MEDmeshEntityFamilyNumberWr(...)");
+ }
+
+ //----------------------------------------------------------------------------
+ PPolyedreInfo
+ TWrapper
+ ::CrPolyedreInfo(const PMeshInfo& theMeshInfo,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
+ TInt theNbElem,
+ TInt theNbFaces,
+ TInt theConnSize,
+ EConnectivite theConnMode,
+ EBooleen theIsElemNum,
+ EBooleen theIsElemNames)
+ {
+ return PPolyedreInfo(new TTPolyedreInfo
+ (theMeshInfo,
+ theEntity,
+ theGeom,
+ theNbElem,
+ theNbFaces,
+ theConnSize,
+ theConnMode,
+ theIsElemNum,
+ theIsElemNames));
+ }
+
+ //----------------------------------------------------------------------------
+ PPolyedreInfo
+ TWrapper
+ ::CrPolyedreInfo(const PMeshInfo& theMeshInfo,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
+ const TIntVector& theIndexes,
+ const TIntVector& theFaces,
+ const TIntVector& theConnectivities,
+ EConnectivite theConnMode,
+ const TIntVector& theFamilyNums,
+ const TIntVector& theElemNums,
+ const TStringVector& theElemNames)
+ {
+ return PPolyedreInfo(new TTPolyedreInfo
+ (theMeshInfo,
+ theEntity,
+ theGeom,
+ theIndexes,
+ theFaces,
+ theConnectivities,
+ theConnMode,
+ theFamilyNums,
+ theElemNums,
+ theElemNames));
+ }
+
+ //----------------------------------------------------------------------------
+ PPolyedreInfo
+ TWrapper
+ ::CrPolyedreInfo(const PMeshInfo& theMeshInfo,
+ const PPolyedreInfo& theInfo)
+ {
+ return PPolyedreInfo(new TTPolyedreInfo
+ (theMeshInfo,
+ theInfo));
+ }
+
+ //----------------------------------------------------------------------------
+ PPolyedreInfo
+ TWrapper
+ ::GetPPolyedreInfo(const PMeshInfo& theMeshInfo,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
+ EConnectivite theConnMode)
+ {
+ if (theMeshInfo->GetType() != eNON_STRUCTURE)
+ return PPolyedreInfo();
+ TInt aNbElem = GetNbPolyedres(theMeshInfo, theEntity, theGeom, theConnMode);
+ TInt aNbFaces, aConnSize;
+ GetPolyedreConnSize(theMeshInfo, aNbFaces, aConnSize, theConnMode);
+ PPolyedreInfo anInfo = CrPolyedreInfo(theMeshInfo, theEntity, theGeom, aNbElem, aNbFaces, aConnSize, theConnMode);
+ GetPolyedreInfo(anInfo);
+
+#ifdef _DEBUG_
+ INITMSG(MYDEBUG, "GetPPolyedreInfo"<<
+ " - theGeom = "<<theGeom<<
+ "; aNbElem = "<<aNbElem<<": ");
+ for (TInt iElem = 0; iElem < aNbElem; iElem++) {
+ TCConnSliceArr aConnSliceArr = anInfo->GetConnSliceArr(iElem);
+ TInt aNbFaces = aConnSliceArr.size();
+ ADDMSG(MYDEBUG, "{");
+ for (TInt iFace = 0; iFace < aNbFaces; iFace++) {
+ TCConnSlice aConnSlice = aConnSliceArr[iFace];
+ TInt aNbConn = aConnSlice.size();
+ ADDMSG(MYDEBUG, "[");
+ for (TInt iConn = 0; iConn < aNbConn; iConn++) {
+ ADDMSG(MYVALUEDEBUG, aConnSlice[iConn]<<",");
+ }
+ ADDMSG(MYDEBUG, "] ");
+ }
+ ADDMSG(MYDEBUG, "} ");
+ }
+ ADDMSG(MYDEBUG, std::endl);
+#endif
+
+ return anInfo;
+ }
+
+ //-----------------------------------------------------------------
+ TEntityInfo
+ TWrapper
+ ::GetEntityInfo(const MED::TMeshInfo& theMeshInfo,
+ EConnectivite theConnMode,
+ TErr* theErr)
+ {
+ TEntityInfo anInfo;
+
+ TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+
+ if (theErr && *theErr < 0)
+ return anInfo;
+
+ if (theMeshInfo.GetType() == eNON_STRUCTURE) {
+ TInt aNbElem = GetNbNodes(theMeshInfo);
+ if (aNbElem > 0) {
+ anInfo[eNOEUD][ePOINT1] = aNbElem;
+ const TEntity2GeomSet& anEntity2GeomSet = GetEntity2GeomSet();
+ TEntity2GeomSet::const_iterator anIter = anEntity2GeomSet.begin();
+ TEntity2GeomSet::const_iterator anIterEnd = anEntity2GeomSet.end();
+ for (; anIter != anIterEnd; anIter++) {
+ const EEntiteMaillage& anEntity = anIter->first;
+ const TGeomSet& aGeomSet = anIter->second;
+ TGeomSet::const_iterator anIter2 = aGeomSet.begin();
+ TGeomSet::const_iterator anIterEnd2 = aGeomSet.end();
+ for (; anIter2 != anIterEnd2; anIter2++) {
+ const EGeometrieElement& aGeom = *anIter2;
+ aNbElem = GetNbCells(theMeshInfo, anEntity, aGeom, theConnMode, theErr);
+ if (aNbElem > 0) {
+ if (anEntity == eSTRUCT_ELEMENT) {
+ const TInt nbStructTypes = aNbElem;
+ for (TInt structType = 0; structType < nbStructTypes; ++structType) {
+ // check type name to keep only "MED_BALL" structured element
+ TValueHolder<TString, char> aMeshName((TString&) theMeshInfo.myName);
+ char geotypename[ MED_NAME_SIZE + 1] = "";
+ med_geometry_type geotype;
+ MEDmeshEntityInfo(myFile->Id(), &aMeshName, MED_NO_DT, MED_NO_IT,
+ med_entity_type(anEntity), structType+1,
+ geotypename, &geotype);
+ if (strcmp(geotypename, MED_BALL_NAME) == 0) {
+ aNbElem = GetNbCells(theMeshInfo, anEntity, EGeometrieElement(geotype),
+ theConnMode, theErr);
+ if (aNbElem > 0)
+ anInfo[anEntity][EGeometrieElement(geotype)] = aNbElem;
+ }
+ }
+ }
+ else {
+ anInfo[anEntity][aGeom] = aNbElem;
+ }
+ }
+ }
+ }
+ }
+ }
+ else { // eSTRUCTURE
+ EGrilleType aGrilleType;
+ TInt aNbNodes = 1;
+ TInt aNbElem = 1;
+ TInt aNbSub = 0;
+ TInt aDim = theMeshInfo.GetDim();
+ EGeometrieElement aGeom, aSubGeom;
+ EEntiteMaillage aSubEntity = eMAILLE;
+
+ GetGrilleType(theMeshInfo, aGrilleType);
+
+ TIntVector aStruct(aDim);
+ if (aGrilleType == eGRILLE_STANDARD)
+ {
+ GetGrilleStruct(theMeshInfo, aStruct, theErr);
+ }
+ else
+ { // eGRILLE_CARTESIENNE and eGRILLE_POLAIRE
+ ETable aTable[3] = { eCOOR_IND1, eCOOR_IND2, eCOOR_IND3 };
+ for (med_int anAxis = 0; anAxis < aDim; anAxis++)
+ aStruct[ anAxis ] = GetNbNodes(theMeshInfo, aTable[anAxis]);
+ }
+ for (med_int i = 0; i < aDim; i++) {
+ aNbNodes = aNbNodes * aStruct[i];
+ aNbElem = aNbElem * (aStruct[i] - 1);
+ }
+ switch (aDim) {
+ case 1:
+ aGeom = eSEG2;
+ break;
+ case 2:
+ aGeom = eQUAD4;
+ aSubGeom = eSEG2;
+ aSubEntity = eARETE;
+ aNbSub =
+ (aStruct[0]) * (aStruct[1]-1) +
+ (aStruct[0]-1) * (aStruct[1]);
+ break;
+ case 3:
+ aGeom = eHEXA8;
+ aSubGeom = eQUAD4;
+ aSubEntity = eFACE;
+ aNbSub =
+ (aStruct[0]) * (aStruct[1]-1) * (aStruct[2]-1) +
+ (aStruct[0]-1) * (aStruct[1]) * (aStruct[2]-1) +
+ (aStruct[0]-1) * (aStruct[1]-1) * (aStruct[2]);
+ break;
+ }
+ anInfo[eNOEUD][ePOINT1] = aNbNodes;
+ anInfo[eMAILLE][aGeom] = aNbElem;
+ if (aDim > 1)
+ anInfo[aSubEntity][aSubGeom] = aNbSub;
+ }
+ return anInfo;
+ }
+
+ //-----------------------------------------------------------------
+ TInt
+ TWrapper
+ ::GetNbCells(const MED::TMeshInfo& theMeshInfo,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
+ EConnectivite theConnMode,
+ TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+
+ if (theErr && *theErr < 0)
+ return -1;
+
+ MED::TMeshInfo& aMeshInfo = const_cast<MED::TMeshInfo&>(theMeshInfo);
+ TValueHolder<TString, char> aMeshName(aMeshInfo.myName);
+ med_bool chgt, trsf;
+ switch (theGeom)
+ {
+ case MED::ePOLYGONE:
+ case MED::ePOLYGON2:
+ {
+ return MEDmeshnEntity(myFile->Id(), &aMeshName,
+ MED_NO_DT, MED_NO_IT,
+ med_entity_type(theEntity), med_geometry_type(theGeom),
+ MED_INDEX_NODE, med_connectivity_mode(theConnMode),
+ &chgt, &trsf)-1;
+ }
+ case MED::ePOLYEDRE:
+ {
+ return MEDmeshnEntity(myFile->Id(), &aMeshName,
+ MED_NO_DT, MED_NO_IT,
+ med_entity_type(theEntity), MED_POLYHEDRON,
+ MED_INDEX_FACE, med_connectivity_mode(theConnMode),
+ &chgt, &trsf)-1;
+ }
+ case MED::eBALL:
+ {
+ return GetNbBalls(theMeshInfo);
+ }
+ default:
+ {
+ return MEDmeshnEntity(myFile->Id(), &aMeshName,
+ MED_NO_DT, MED_NO_IT,
+ med_entity_type(theEntity), med_geometry_type(theGeom),
+ MED_CONNECTIVITY, med_connectivity_mode(theConnMode),
+ &chgt, &trsf);
+ }
+ }
+ return 0;
+ }
+
+ //----------------------------------------------------------------------------
+ void
+ TWrapper
+ ::GetCellInfo(MED::TCellInfo& theInfo,
+ TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+
+ if (theErr && *theErr < 0)
+ return;
+
+ MED::TMeshInfo& aMeshInfo = *theInfo.myMeshInfo;
+
+ TValueHolder<TString, char> aMeshName (aMeshInfo.myName);
+ TValueHolder<TElemNum, med_int> aConn (theInfo.myConn);
+ TValueHolder<EModeSwitch, med_switch_mode> aModeSwitch (theInfo.myModeSwitch);
+ TValueHolder<TString, char> anElemNames (theInfo.myElemNames);
+ TValueHolder<EBooleen, med_bool> anIsElemNames(theInfo.myIsElemNames);
+ TValueHolder<TElemNum, med_int> anElemNum (theInfo.myElemNum);
+ TValueHolder<EBooleen, med_bool> anIsElemNum (theInfo.myIsElemNum);
+ TValueHolder<TElemNum, med_int> aFamNum (theInfo.myFamNum);
+ TValueHolder<EBooleen, med_bool> anIsFamNum (theInfo.myIsFamNum);
+ TValueHolder<EEntiteMaillage, med_entity_type> anEntity (theInfo.myEntity);
+ TValueHolder<EGeometrieElement, med_geometry_type> aGeom (theInfo.myGeom);
+ TValueHolder<EConnectivite, med_connectivity_mode> aConnMode (theInfo.myConnMode);
+
+ TErr aRet;
+ aRet = MEDmeshElementRd(myFile->Id(),
+ &aMeshName,
+ MED_NO_DT,
+ MED_NO_IT,
+ anEntity,
+ aGeom,
+ aConnMode,
+ aModeSwitch,
+ &aConn,
+ &anIsElemNames,
+ &anElemNames,
+ &anIsElemNum,
+ &anElemNum,
+ &anIsFamNum,
+ &aFamNum);
+
+ if (theErr)
+ *theErr = aRet;
+ else if (aRet < 0)
+ EXCEPTION(std::runtime_error, "GetCellInfo - MEDmeshElementRd(...)");
+
+ if (anIsFamNum == MED_FALSE)
+ {
+ int mySize = (int) theInfo.myFamNum->size();
+ theInfo.myFamNum->clear();
+ theInfo.myFamNum->resize(mySize, 0);
+ }
+
+ }
+
+ //----------------------------------------------------------------------------
+ void
+ TWrapper
+ ::SetCellInfo(const MED::TCellInfo& theInfo,
+ TErr* theErr)
+ {
+ SetCellInfo(theInfo, eLECTURE_ECRITURE, theErr);
+ }
+
+ //----------------------------------------------------------------------------
+ void
+ TWrapper
+ ::SetCellInfo(const MED::TCellInfo& theInfo,
+ EModeAcces theMode,
+ TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile, theMode, theErr);
+
+ if (theErr && *theErr < 0)
+ return;
+
+ MED::TCellInfo& anInfo = const_cast<MED::TCellInfo&>(theInfo);
+ MED::TMeshInfo& aMeshInfo = *anInfo.myMeshInfo;
+
+ TValueHolder<TString, char> aMeshName (aMeshInfo.myName);
+ TValueHolder<TElemNum, med_int> aConn (anInfo.myConn);
+ TValueHolder<EModeSwitch, med_switch_mode> aModeSwitch (anInfo.myModeSwitch);
+ TValueHolder<TString, char> anElemNames (anInfo.myElemNames);
+ TValueHolder<EBooleen, med_bool> anIsElemNames(anInfo.myIsElemNames);
+ TValueHolder<TElemNum, med_int> anElemNum (anInfo.myElemNum);
+ TValueHolder<EBooleen, med_bool> anIsElemNum (anInfo.myIsElemNum);
+ TValueHolder<TElemNum, med_int> aFamNum (anInfo.myFamNum);
+ TValueHolder<EBooleen, med_bool> anIsFamNum (anInfo.myIsFamNum);
+ TValueHolder<EEntiteMaillage, med_entity_type> anEntity (anInfo.myEntity);
+ TValueHolder<EGeometrieElement, med_geometry_type> aGeom (anInfo.myGeom);
+ TValueHolder<EConnectivite, med_connectivity_mode> aConnMode (anInfo.myConnMode);
+ TValueHolder<TInt, med_int> aNbElem (anInfo.myNbElem);
+
+ TErr aRet;
+ aRet = MEDmeshElementConnectivityWr(myFile->Id(),
+ &aMeshName,
+ MED_NO_DT,
+ MED_NO_IT,
+ MED_UNDEF_DT,
+ anEntity,
+ aGeom,
+ aConnMode,
+ aModeSwitch,
+ aNbElem,
+ &aConn);
+
+ MEDmeshEntityFamilyNumberWr(myFile->Id(),
+ &aMeshName,
+ MED_NO_DT,
+ MED_NO_IT,
+ anEntity,
+ aGeom,
+ aNbElem,
+ &aFamNum);
+ if (anIsElemNames)
+ MEDmeshEntityNameWr(myFile->Id(),
+ &aMeshName,
+ MED_NO_DT,
+ MED_NO_IT,
+ anEntity,
+ aGeom,
+ aNbElem,
+ &anElemNames);
+ if (anIsElemNum)
+ MEDmeshEntityNumberWr(myFile->Id(),
+ &aMeshName,
+ MED_NO_DT,
+ MED_NO_IT,
+ anEntity,
+ aGeom,
+ aNbElem,
+ &anElemNum);
+ if (theErr)
+ *theErr = aRet;
+ else if (aRet < 0)
+ EXCEPTION(std::runtime_error, "SetCellInfo - MEDmeshElementWr(...)");
+ }
+
+ //----------------------------------------------------------------------------
+ PCellInfo
+ TWrapper
+ ::CrCellInfo(const PMeshInfo& theMeshInfo,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
+ TInt theNbElem,
+ EConnectivite theConnMode,
+ EBooleen theIsElemNum,
+ EBooleen theIsElemNames,
+ EModeSwitch theMode)
+ {
+ return PCellInfo(new TTCellInfo
+ (theMeshInfo,
+ theEntity,
+ theGeom,
+ theNbElem,
+ theConnMode,
+ theIsElemNum,
+ theIsElemNames,
+ theMode));
+ }
+
+ //----------------------------------------------------------------------------
+ PCellInfo
+ TWrapper
+ ::CrCellInfo(const PMeshInfo& theMeshInfo,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
+ const TIntVector& theConnectivities,
+ EConnectivite theConnMode,
+ const TIntVector& theFamilyNums,
+ const TIntVector& theElemNums,
+ const TStringVector& theElemNames,
+ EModeSwitch theMode)
+ {
+ return PCellInfo(new TTCellInfo
+ (theMeshInfo,
+ theEntity,
+ theGeom,
+ theConnectivities,
+ theConnMode,
+ theFamilyNums,
+ theElemNums,
+ theElemNames,
+ theMode));
+ }
+
+ //----------------------------------------------------------------------------
+ PCellInfo
+ TWrapper
+ ::CrCellInfo(const PMeshInfo& theMeshInfo,
+ const PCellInfo& theInfo)
+ {
+ return PCellInfo(new TTCellInfo
+ (theMeshInfo,
+ theInfo));
+ }
+
+ //----------------------------------------------------------------------------
+ PCellInfo
+ TWrapper
+ ::GetPCellInfo(const PMeshInfo& theMeshInfo,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
+ EConnectivite theConnMode,
+ TErr* theErr)
+ {
+ if (theMeshInfo->GetType() != eNON_STRUCTURE)
+ return PCellInfo();
+ TInt aNbElem = GetNbCells(theMeshInfo, theEntity, theGeom, theConnMode);
+ PCellInfo anInfo = CrCellInfo(theMeshInfo, theEntity, theGeom, aNbElem, theConnMode);
+ GetCellInfo(anInfo, theErr);
+
+#ifdef _DEBUG_
+ TInt aConnDim = anInfo->GetConnDim();
+ INITMSG(MYDEBUG, "GetPCellInfo - theEntity = "<<theEntity<<"; theGeom = "<<theGeom<<"; aConnDim: "<<aConnDim<<"\n");
+ BEGMSG(MYDEBUG, "GetPCellInfo - aNbElem: "<<aNbElem<<": ");
+ for (TInt iElem = 0; iElem < aNbElem; iElem++) {
+ TCConnSlice aConnSlice = anInfo->GetConnSlice(iElem);
+ for (TInt iConn = 0; iConn < aConnDim; iConn++) {
+ ADDMSG(MYVALUEDEBUG, aConnSlice[iConn]<<",");
+ }
+ ADDMSG(MYVALUEDEBUG, " ");
+ }
+ ADDMSG(MYDEBUG, std::endl);
+
+ BEGMSG(MYVALUEDEBUG, "GetPCellInfo - GetFamNum: ");
+ for (TInt iElem = 0; iElem < aNbElem; iElem++) {
+ ADDMSG(MYVALUEDEBUG, anInfo->GetFamNum(iElem)<<", ");
+ }
+ ADDMSG(MYVALUEDEBUG, std::endl);
+
+ if (anInfo->IsElemNum()) {
+ BEGMSG(MYVALUEDEBUG, "GetPCellInfo - GetElemNum: ");
+ for (TInt iElem = 0; iElem < aNbElem; iElem++) {
+ ADDMSG(MYVALUEDEBUG, anInfo->GetElemNum(iElem)<<", ");
+ }
+ ADDMSG(MYVALUEDEBUG, std::endl);
+ }
+ ADDMSG(MYDEBUG, std::endl);
+#endif
+
+ return anInfo;
+ }
+
+ //----------------------------------------------------------------------------
+ EGeometrieElement
+ TWrapper
+ ::GetBallGeom(const TMeshInfo& theMeshInfo)
+ {
+ TFileWrapper aFileWrapper(myFile, eLECTURE);
+
+ // read med_geometry_type of "MED_BALL" element
+ char geotypename[ MED_NAME_SIZE + 1] = MED_BALL_NAME;
+ return EGeometrieElement(MEDstructElementGeotype(myFile->Id(), geotypename));
+ }
+
+ //----------------------------------------------------------------------------
+ TInt
+ TWrapper
+ ::GetNbBalls(const TMeshInfo& theMeshInfo)
+ {
+ TFileWrapper aFileWrapper(myFile, eLECTURE);
+
+ EGeometrieElement ballType = GetBallGeom(theMeshInfo);
+ if (ballType < 0)
+ return 0;
+
+ return GetNbCells(theMeshInfo, eSTRUCT_ELEMENT, ballType, eNOD);
+ }
+
+ //----------------------------------------------------------------------------
+ void
+ TWrapper
+ ::GetBallInfo(TBallInfo& theInfo,
+ TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+
+ // check geometry of MED_BALL
+ if (theInfo.myGeom == eBALL)
+ {
+ theInfo.myGeom = GetBallGeom(*theInfo.myMeshInfo);
+ if (theInfo.myGeom < 0) {
+ if (!theErr)
+ EXCEPTION(std::runtime_error, "GetBallInfo - no balls in the mesh");
+ *theErr = theInfo.myGeom;
+ return;
+ }
+ }
+
+ // read nodes ids
+ GetCellInfo(theInfo);
+
+ // read diameters
+ TValueHolder<TString, char> aMeshName (theInfo.myMeshInfo->myName);
+ TValueHolder<EGeometrieElement, med_geometry_type> aGeom (theInfo.myGeom);
+ TValueHolder<TFloatVector, void> aDiam (theInfo.myDiameters);
+ char varattname[ MED_NAME_SIZE + 1] = MED_BALL_DIAMETER;
+
+ TErr aRet = MEDmeshStructElementVarAttRd(myFile->Id(), &aMeshName,
+ MED_NO_DT, MED_NO_IT,
+ aGeom,
+ varattname,
+ &aDiam);
+ if (theErr)
+ *theErr = aRet;
+ else if (aRet < 0)
+ EXCEPTION(std::runtime_error, "GetBallInfo - pb at reading diameters");
+ }
+
+ //----------------------------------------------------------------------------
+ void
+ TWrapper
+ ::SetBallInfo(const TBallInfo& theInfo,
+ TErr* theErr)
+ {
+ SetBallInfo(theInfo, eLECTURE_ECRITURE, theErr);
+ }
+
+ //----------------------------------------------------------------------------
+ void
+ TWrapper
+ ::SetBallInfo(const TBallInfo& theInfo,
+ EModeAcces theMode,
+ TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile, theMode, theErr);
+
+ TErr ret;
+ char ballsupportname[MED_NAME_SIZE+1] = "BALL_SUPPORT_MESH";
+ EGeometrieElement ballGeom = GetBallGeom(*theInfo.myMeshInfo);
+ if (ballGeom < 0)
+ {
+ // no ball model in the file, create support mesh for it
+ char dummyname [MED_NAME_SIZE*3+1] = "";
+ if ((ret = MEDsupportMeshCr(myFile->Id(),
+ ballsupportname,
+ theInfo.myMeshInfo->GetSpaceDim(),
+ theInfo.myMeshInfo->GetDim(),
+ "Support mesh for a ball model",
+ MED_CARTESIAN,
+ /*axisname=*/dummyname,
+ /*unitname=*/dummyname)) < 0) {
+ if (!theErr)
+ EXCEPTION(std::runtime_error, "SetBallInfo - MEDsupportMeshCr");
+ *theErr = ret;
+ return;
+ }
+ // write coordinates of 1 node
+ med_float coord[3] = {0, 0, 0};
+ if ((ret = MEDmeshNodeCoordinateWr(myFile->Id(),
+ ballsupportname, MED_NO_DT, MED_NO_IT, 0.0,
+ MED_FULL_INTERLACE, /*nnode=*/1, coord)) < 0) {
+ if (!theErr)
+ EXCEPTION(std::runtime_error, "SetBallInfo - MEDmeshNodeCoordinateWr");
+ *theErr = ret;
+ return;
+ }
+ // ball model creation
+ char geotypename[ MED_NAME_SIZE + 1] = MED_BALL_NAME;
+ if ((ballGeom = (EGeometrieElement) MEDstructElementCr(myFile->Id(),
+ geotypename,
+ theInfo.myMeshInfo->GetSpaceDim(),
+ ballsupportname,
+ MED_NODE,MED_NONE)) < 0) {
+ if (!theErr)
+ EXCEPTION(std::runtime_error, "SetBallInfo - MEDstructElementCr");
+ *theErr = ret;
+ return;
+ }
+ // create diameter attribute
+ if ((ret = MEDstructElementVarAttCr(myFile->Id(),
+ geotypename, MED_BALL_DIAMETER,
+ MED_ATT_FLOAT64, /*ncomp=*/1)) < 0) {
+ if (!theErr)
+ EXCEPTION(std::runtime_error, "SetBallInfo - MEDstructElementVarAttCr");
+ *theErr = ret;
+ return;
+ }
+ } // ballGeom < 0
+
+ TBallInfo& aBallInfo = ((TBallInfo&) theInfo);
+ aBallInfo.myGeom = ballGeom;
+
+ // write node ids
+ SetCellInfo(theInfo, theMode, theErr);
+ if (theErr && theErr < 0)
+ return;
+
+ // write diameter
+ TValueHolder<TString, char> aMeshName (aBallInfo.myMeshInfo->myName);
+ TValueHolder<EGeometrieElement, med_geometry_type> aGeom (aBallInfo.myGeom);
+ TValueHolder<TFloatVector, void> aDiam (aBallInfo.myDiameters);
+ ret = MEDmeshStructElementVarAttWr(myFile->Id(), &aMeshName,
+ MED_NO_DT, MED_NO_IT,
+ aGeom, MED_BALL_DIAMETER,
+ theInfo.myNbElem, &aDiam);
+ if (theErr)
+ *theErr = ret;
+ else if (ret < 0)
+ EXCEPTION(std::runtime_error, "SetBallInfo - MEDmeshStructElementVarAttWr");
+ }
+
+ //----------------------------------------------------------------------------
+ PBallInfo
+ TWrapper
+ ::CrBallInfo(const PMeshInfo& theMeshInfo,
+ TInt theNbBalls,
+ EBooleen theIsElemNum)
+ {
+ return PBallInfo(new TTBallInfo(theMeshInfo, theNbBalls, theIsElemNum));
+ }
+
+ //----------------------------------------------------------------------------
+ PBallInfo
+ TWrapper
+ ::CrBallInfo(const PMeshInfo& theMeshInfo,
+ const TIntVector& theNodes,
+ TFloatVector& theDiameters,
+ const TIntVector& theFamilyNums,
+ const TIntVector& theElemNums)
+ {
+ return PBallInfo(new TTBallInfo(theMeshInfo, theNodes, theDiameters,
+ theFamilyNums, theElemNums));
+ }
+
+ //----------------------------------------------------------------------------
+ PBallInfo
+ TWrapper
+ ::CrBallInfo(const PMeshInfo& theMeshInfo,
+ const PBallInfo& theInfo)
+ {
+ return PBallInfo(new TTBallInfo(theMeshInfo, theInfo));
+ }
+
+ //----------------------------------------------------------------------------
+ PBallInfo
+ TWrapper
+ ::GetPBallInfo(const PMeshInfo& theMeshInfo)
+ {
+ TInt nbBalls = GetNbBalls(theMeshInfo);
+ if (nbBalls < 1) return PBallInfo();
+
+ PBallInfo anInfo = CrBallInfo(theMeshInfo, nbBalls);
+ GetBallInfo(anInfo);
+
+ return anInfo;
+ }
+
+ //-----------------------------------------------------------------
+ TInt
+ TWrapper
+ ::GetNbFields(TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+
+ if (theErr && *theErr < 0)
+ return -1;
+
+ return MEDnField(myFile->Id());
+ }
+
+ //----------------------------------------------------------------------------
+ TInt
+ TWrapper
+ ::GetNbComp(TInt theFieldId,
+ TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+
+ if (theErr && *theErr < 0)
+ return -1;
+
+ return MEDfieldnComponent(myFile->Id(), theFieldId);
+ }
+
+ //----------------------------------------------------------------------------
+ void
+ TWrapper
+ ::GetFieldInfo(TInt theFieldId,
+ MED::TFieldInfo& theInfo,
+ TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+
+ if (theErr && *theErr < 0)
+ return;
+
+ TString aFieldName(256); // Protect from memory problems with too long names
+ TValueHolder<ETypeChamp, med_field_type> aType(theInfo.myType);
+ TValueHolder<TString, char> aCompNames(theInfo.myCompNames);
+ TValueHolder<TString, char> anUnitNames(theInfo.myUnitNames);
+ MED::TMeshInfo& aMeshInfo = theInfo.myMeshInfo;
+
+ TErr aRet;
+ med_bool local;
+ char dtunit[MED_SNAME_SIZE+1];
+ char local_mesh_name[MED_NAME_SIZE+1]="";
+ med_int nbofstp;
+ theInfo.myNbComp = MEDfieldnComponent(myFile->Id(), theFieldId);
+ aRet = MEDfieldInfo(myFile->Id(),
+ theFieldId,
+ &aFieldName[0],
+ local_mesh_name,
+ &local,
+ &aType,
+ &aCompNames,
+ &anUnitNames,
+ dtunit,
+ &nbofstp);
+
+ if (strcmp(&aMeshInfo.myName[0], local_mesh_name) != 0) {
+ if (theErr)
+ *theErr = -1;
+ return;
+ }
+
+ theInfo.SetName(aFieldName);
+
+ if (theErr)
+ *theErr = aRet;
+ else if (aRet < 0)
+ EXCEPTION(std::runtime_error, "GetFieldInfo - MEDfieldInfo(...)");
+ }
+
+ //----------------------------------------------------------------------------
+ void
+ TWrapper
+ ::SetFieldInfo(const MED::TFieldInfo& theInfo,
+ TErr* theErr)
+ {
+ TErr aRet;
+ SetFieldInfo(theInfo, eLECTURE_ECRITURE, &aRet);
+
+ if (aRet < 0)
+ SetFieldInfo(theInfo, eLECTURE_AJOUT, &aRet);
+
+ if (theErr)
+ *theErr = aRet;
+ }
+
+ //----------------------------------------------------------------------------
+ void
+ TWrapper
+ ::SetFieldInfo(const MED::TFieldInfo& theInfo,
+ EModeAcces theMode,
+ TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile, theMode, theErr);
+
+ if (theErr && *theErr < 0)
+ return;
+
+ MED::TFieldInfo& anInfo = const_cast<MED::TFieldInfo&>(theInfo);
+
+ TValueHolder<TString, char> aFieldName(anInfo.myName);
+ TValueHolder<ETypeChamp, med_field_type> aType(anInfo.myType);
+ TValueHolder<TString, char> aCompNames(anInfo.myCompNames);
+ TValueHolder<TString, char> anUnitNames(anInfo.myUnitNames);
+ MED::TMeshInfo& aMeshInfo = anInfo.myMeshInfo;
+ TErr aRet;
+ char dtunit[MED_SNAME_SIZE+1];
+ std::fill(dtunit, dtunit+MED_SNAME_SIZE+1, '\0');
+ aRet = MEDfieldCr(myFile->Id(),
+ &aFieldName,
+ aType,
+ anInfo.myNbComp,
+ &aCompNames,
+ &anUnitNames,
+ dtunit,
+ &aMeshInfo.myName[0]);
+ if (theErr)
+ *theErr = aRet;
+ else if (aRet < 0)
+ EXCEPTION(std::runtime_error, "SetFieldInfo - MEDfieldCr(...)");
+ }
+
+ //----------------------------------------------------------------------------
+ PFieldInfo
+ TWrapper
+ ::CrFieldInfo(const PMeshInfo& theMeshInfo,
+ TInt theNbComp,
+ ETypeChamp theType,
+ const std::string& theValue,
+ EBooleen theIsLocal,
+ TInt theNbRef)
+ {
+ return PFieldInfo(new TTFieldInfo
+ (theMeshInfo,
+ theNbComp,
+ theType,
+ theValue,
+ theIsLocal,
+ theNbRef));
+ }
+
+ //----------------------------------------------------------------------------
+ PFieldInfo
+ TWrapper
+ ::CrFieldInfo(const PMeshInfo& theMeshInfo,
+ const PFieldInfo& theInfo)
+ {
+ return PFieldInfo(new TTFieldInfo
+ (theMeshInfo,
+ theInfo));
+ }
+
+ //----------------------------------------------------------------------------
+ PFieldInfo
+ TWrapper
+ ::GetPFieldInfo(const PMeshInfo& theMeshInfo,
+ TInt theId,
+ TErr* theErr)
+ {
+ TInt aNbComp = GetNbComp(theId);
+ PFieldInfo anInfo = CrFieldInfo(theMeshInfo, aNbComp);
+ GetFieldInfo(theId, *anInfo, theErr);
+
+#ifdef _DEBUG_
+ INITMSG(MYDEBUG,
+ "GetPFieldInfo "<<
+ "- aName = '"<<anInfo->GetName()<<"'"<<
+ "; aType = "<<anInfo->GetType()<<
+ "; aNbComp = "<<aNbComp<<
+ std::endl);
+#endif
+
+ return anInfo;
+ }
+
+ //----------------------------------------------------------------------------
+ TInt
+ TWrapper
+ ::GetNbGauss(TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+
+ if (theErr && *theErr < 0)
+ return -1;
+
+ return MEDnLocalization(myFile->Id());
+ }
+
+ //----------------------------------------------------------------------------
+ TGaussInfo::TInfo
+ TWrapper
+ ::GetGaussPreInfo(TInt theId,
+ TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+
+ if (theErr && *theErr < 0)
+ return TGaussInfo::TInfo(TGaussInfo::TKey(ePOINT1, ""), 0);
+
+ med_int aNbGaussPoints = med_int();
+ TVector<char> aName(GetNOMLength()+1);
+ med_geometry_type aGeom = MED_NONE;
+
+ TErr aRet;
+ med_int dim;
+ char geointerpname[MED_NAME_SIZE+1] = "";
+ char ipointstructmeshname[MED_NAME_SIZE+1] = "";
+ med_int nsectionmeshcell;
+ med_geometry_type sectiongeotype;
+ aRet = MEDlocalizationInfo (myFile->Id(),
+ theId,
+ &aName[0],
+ &aGeom,
+ &dim,
+ &aNbGaussPoints,
+ geointerpname,
+ ipointstructmeshname,
+ &nsectionmeshcell,
+ §iongeotype);
+ if (theErr)
+ *theErr = aRet;
+ else if (aRet < 0)
+ EXCEPTION(std::runtime_error, "GetGaussPreInfo - MEDlocalizationInfo(...)");
+ return TGaussInfo::TInfo(TGaussInfo::TKey(EGeometrieElement(aGeom), &aName[0]),
+ TInt(aNbGaussPoints));
+ }
+
+ //----------------------------------------------------------------------------
+ void
+ TWrapper
+ ::GetGaussInfo(TInt theId,
+ TGaussInfo& theInfo,
+ TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+
+ if (theErr && *theErr < 0)
+ return;
+
+ TValueHolder<TNodeCoord, med_float> aRefCoord(theInfo.myRefCoord);
+ TValueHolder<TNodeCoord, med_float> aGaussCoord(theInfo.myGaussCoord);
+ TValueHolder<TWeight, med_float> aWeight(theInfo.myWeight);
+ TValueHolder<EModeSwitch, med_switch_mode> aModeSwitch(theInfo.myModeSwitch);
+ TValueHolder<TString, char> aGaussName(theInfo.myName);
+
+ TErr aRet;
+ aRet = MEDlocalizationRd(myFile->Id(),
+ &aGaussName,
+ aModeSwitch,
+ &aRefCoord,
+ &aGaussCoord,
+ &aWeight);
+
+ if (theErr)
+ *theErr = aRet;
+ else if (aRet < 0)
+ EXCEPTION(std::runtime_error, "GetGaussInfo - MEDlocalizationRd(...)");
+ }
+
+ //----------------------------------------------------------------------------
+ PGaussInfo
+ TWrapper
+ ::CrGaussInfo(const TGaussInfo::TInfo& theInfo,
+ EModeSwitch theMode)
+ {
+ return PGaussInfo(new TTGaussInfo
+ (theInfo,
+ theMode));
+ }
+
+ //-----------------------------------------------------------------
+ TInt
+ TWrapper
+ ::GetNbTimeStamps(const MED::TFieldInfo& theInfo,
+ const MED::TEntityInfo& theEntityInfo,
+ EEntiteMaillage& theEntity,
+ TGeom2Size& theGeom2Size,
+ TErr* theErr)
+ {
+ theEntity = EEntiteMaillage(-1);
+ TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+
+ if (theErr) {
+ if (theEntityInfo.empty())
+ *theErr = -1;
+ if (*theErr < 0)
+ return -1;
+ }
+ else if (theEntityInfo.empty())
+ EXCEPTION(std::runtime_error, "GetNbTimeStamps - There is no any Entity on the Mesh");
+
+ bool anIsPerformAdditionalCheck = GetNbMeshes() > 1;
+
+ theGeom2Size.clear();
+ TInt aNbTimeStamps = 0;
+ TIdt anId = myFile->Id();
+
+ MED::TFieldInfo& anInfo = const_cast<MED::TFieldInfo&>(theInfo);
+ TValueHolder<TString, char> aFieldName(anInfo.myName);
+ MED::TMeshInfo& aMeshInfo = anInfo.myMeshInfo;
+
+ // workaround for IPAL13676
+ MED::TEntityInfo localEntityInfo = theEntityInfo;
+ TEntityInfo::iterator anLocalIter = localEntityInfo.find(eMAILLE);
+ if (anLocalIter != localEntityInfo.end()) {
+ localEntityInfo[eNOEUD_ELEMENT] = anLocalIter->second;
+ }
+
+ TEntityInfo::const_iterator anIter = localEntityInfo.begin();
+ for (; anIter != localEntityInfo.end(); anIter++) {
+ med_entity_type anEntity = med_entity_type(anIter->first);
+ const TGeom2Size& aGeom2Size = anIter->second;
+ TGeom2Size::const_iterator anGeomIter = aGeom2Size.begin();
+ for (; anGeomIter != aGeom2Size.end(); anGeomIter++) {
+ med_geometry_type aGeom = med_geometry_type(anGeomIter->first);
+ char aMeshName[MED_NAME_SIZE+1];
+ med_bool islocal;
+ med_field_type ft;
+ char dtunit[MED_SNAME_SIZE+1];
+ med_int myNbComp = MEDfieldnComponentByName(anId, &aFieldName);
+ char *cname=new char[myNbComp*MED_SNAME_SIZE+1];
+ char *unitname=new char[myNbComp*MED_SNAME_SIZE+1];
+ TInt aNbStamps;
+ MEDfieldInfoByName(anId,
+ &aFieldName,
+ aMeshName,
+ &islocal,
+ &ft,
+ cname,
+ unitname,
+ dtunit,
+ &aNbStamps);
+ delete [] cname;
+ delete [] unitname;
+ med_int nval = 0;
+ med_int aNumDt;
+ med_int aNumOrd;
+ med_float aDt;
+ if (aNbStamps > 0)
+ {
+ MEDfieldComputingStepInfo(anId,
+ &aFieldName,
+ 1,
+ &aNumDt,
+ &aNumOrd,
+ &aDt);
+ char profilename[MED_NAME_SIZE+1];
+ char locname[MED_NAME_SIZE+1];
+ med_int profilsize;
+ med_int aNbGauss;
+
+ // protection from crash (division by zero)
+ // inside MEDfieldnValueWithProfile function
+ // caused by the workaround for IPAL13676 (see above)
+ if (anEntity == MED_NODE_ELEMENT && aGeom % 100 == 0)
+ continue;
+
+ nval = MEDfieldnValueWithProfile(anId,
+ &aFieldName,
+ aNumDt,
+ aNumOrd,
+ anEntity,
+ med_geometry_type(aGeom),
+ 1,
+ MED_COMPACT_STMODE,
+ profilename,
+ &profilsize,
+ locname,
+ &aNbGauss);
+ }
+ bool anIsSatisfied =(nval > 0);
+ if (anIsSatisfied) {
+ INITMSG(MYDEBUG,
+ "GetNbTimeStamps aNbTimeStamps = "<<aNbStamps<<
+ "; aGeom = "<<aGeom<<"; anEntity = "<<anEntity<<"\n");
+ if (anIsPerformAdditionalCheck) {
+ anIsSatisfied = !strcmp(&aMeshName[0], &aMeshInfo.myName[0]);
+ if (!anIsSatisfied) {
+ INITMSG(MYDEBUG,
+ "GetNbTimeStamps aMeshName = '"<<&aMeshName[0]<<"' != "<<
+ "; aMeshInfo.myName = '"<<&aMeshInfo.myName[0]<<"'\n");
+ }
+ }
+ }
+ if (anIsSatisfied) {
+ theGeom2Size[EGeometrieElement(aGeom)] = anGeomIter->second;
+ theEntity = EEntiteMaillage(anEntity);
+ aNbTimeStamps = aNbStamps;
+ }
+ }
+ if (!theGeom2Size.empty())
+ break;
+ }
+ return aNbTimeStamps;
+ }
+
+ //----------------------------------------------------------------------------
+ void
+ TWrapper
+ ::GetTimeStampInfo(TInt theTimeStampId,
+ MED::TTimeStampInfo& theInfo,
+ TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+
+ const TGeom2Size& aGeom2Size = theInfo.myGeom2Size;
+
+ if (theErr) {
+ if (aGeom2Size.empty())
+ *theErr = -1;
+ if (*theErr < 0)
+ return;
+ }
+ else if (aGeom2Size.empty())
+ EXCEPTION(std::runtime_error, "GetTimeStampInfo - There is no any cell");
+
+ MED::TFieldInfo& aFieldInfo = *theInfo.myFieldInfo;
+ MED::TMeshInfo& aMeshInfo = *aFieldInfo.myMeshInfo;
+
+ TValueHolder<TString, char> aFieldName(aFieldInfo.myName);
+ TValueHolder<EEntiteMaillage, med_entity_type> anEntity(theInfo.myEntity);
+ TValueHolder<TInt, med_int> aNumDt(theInfo.myNumDt);
+ TValueHolder<TInt, med_int> aNumOrd(theInfo.myNumOrd);
+ TValueHolder<TString, char> anUnitDt(theInfo.myUnitDt);
+ TValueHolder<TFloat, med_float> aDt(theInfo.myDt);
+ TValueHolder<TString, char> aMeshName(aMeshInfo.myName);
+ TValueHolder<EBooleen, med_bool> anIsLocal(aFieldInfo.myIsLocal);
+ TValueHolder<TInt, med_int> aNbRef(aFieldInfo.myNbRef);
+
+ TGeom2NbGauss& aGeom2NbGauss = theInfo.myGeom2NbGauss;
+
+ // just to get a time stamp unit (anUnitDt)
+ med_field_type aFieldType;
+ med_int aNbComp = MEDfieldnComponentByName(myFile->Id(), &aFieldName);
+ char *aCompName = new char[aNbComp*MED_SNAME_SIZE+1];
+ char *aCompUnit = new char[aNbComp*MED_SNAME_SIZE+1];
+ TInt aNbStamps;
+ MEDfieldInfoByName(myFile->Id(),
+ &aFieldName,
+ &aMeshName,
+ &anIsLocal,
+ &aFieldType,
+ aCompName,
+ aCompUnit,
+ &anUnitDt,
+ &aNbStamps);
+ delete [] aCompName;
+ delete [] aCompUnit;
+
+ TGeom2Size::const_iterator anIter = aGeom2Size.begin();
+ for (; anIter != aGeom2Size.end(); anIter++) {
+ const EGeometrieElement& aGeom = anIter->first;
+ med_int aNbGauss = -1;
+
+ TErr aRet;
+ aRet = MEDfieldComputingStepInfo(myFile->Id(),
+ &aFieldName,
+ theTimeStampId,
+ &aNumDt,
+ &aNumOrd,
+ &aDt);
+ char profilename[MED_NAME_SIZE+1];
+ med_int profilsize;
+ char locname[MED_NAME_SIZE+1];
+ MEDfieldnValueWithProfile(myFile->Id(),
+ &aFieldName,
+ aNumDt,
+ aNumOrd,
+ anEntity,
+ med_geometry_type(aGeom),
+ 1,
+ MED_COMPACT_STMODE,
+ profilename,
+ &profilsize,
+ locname,
+ &aNbGauss);
+
+ static TInt MAX_NB_GAUSS_POINTS = 32;
+ if (aNbGauss <= 0 || aNbGauss > MAX_NB_GAUSS_POINTS)
+ aNbGauss = 1;
+
+ aGeom2NbGauss[aGeom] = aNbGauss;
+
+ if (theErr)
+ *theErr = aRet;
+ else if (aRet < 0)
+ EXCEPTION(std::runtime_error, "GetTimeStampInfo - MEDfieldnValueWithProfile(...)");
+ }
+ }
+
+ //----------------------------------------------------------------------------
+ PTimeStampInfo
+ TWrapper
+ ::CrTimeStampInfo(const PFieldInfo& theFieldInfo,
+ EEntiteMaillage theEntity,
+ const TGeom2Size& theGeom2Size,
+ const TGeom2NbGauss& theGeom2NbGauss,
+ TInt theNumDt,
+ TInt theNumOrd,
+ TFloat theDt,
+ const std::string& theUnitDt,
+ const TGeom2Gauss& theGeom2Gauss)
+ {
+ return PTimeStampInfo(new TTTimeStampInfo
+ (theFieldInfo,
+ theEntity,
+ theGeom2Size,
+ theGeom2NbGauss,
+ theNumDt,
+ theNumOrd,
+ theDt,
+ theUnitDt,
+ theGeom2Gauss));
+ }
+
+ //----------------------------------------------------------------------------
+ PTimeStampInfo
+ TWrapper
+ ::CrTimeStampInfo(const PFieldInfo& theFieldInfo,
+ const PTimeStampInfo& theInfo)
+ {
+ return PTimeStampInfo(new TTTimeStampInfo
+ (theFieldInfo,
+ theInfo));
+ }
+
+ //----------------------------------------------------------------------------
+ PTimeStampInfo
+ TWrapper
+ ::GetPTimeStampInfo(const PFieldInfo& theFieldInfo,
+ EEntiteMaillage theEntity,
+ const TGeom2Size& theGeom2Size,
+ TInt theId,
+ TErr* theErr)
+ {
+ PTimeStampInfo anInfo = CrTimeStampInfo(theFieldInfo, theEntity, theGeom2Size);
+ GetTimeStampInfo(theId, *anInfo, theErr);
+
+#ifdef _DEBUG_
+ INITMSG(MYDEBUG, "GetPTimeStampInfo - anEntity = "<<anInfo->GetEntity()<<"\n");
+ TGeom2NbGauss& aGeom2NbGauss = anInfo->myGeom2NbGauss;
+ TGeom2NbGauss::const_iterator anIter = aGeom2NbGauss.begin();
+ for (; anIter != aGeom2NbGauss.end(); anIter++) {
+ const EGeometrieElement& aGeom = anIter->first;
+ INITMSG(MYDEBUG, "aGeom = "<<aGeom<<" - "<<aGeom2NbGauss[aGeom]<<";\n");
+ }
+#endif
+
+ return anInfo;
+ }
+
+ //----------------------------------------------------------------------------
+ TInt
+ TWrapper
+ ::GetNbProfiles(TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+
+ if (theErr && *theErr < 0)
+ return -1;
+
+ return MEDnProfile(myFile->Id());
+ }
+
+ //----------------------------------------------------------------------------
+ TProfileInfo::TInfo
+ TWrapper
+ ::GetProfilePreInfo(TInt theId,
+ TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+
+ if (theErr && *theErr < 0)
+ return TProfileInfo::TInfo();
+
+ med_int aSize = -1;
+ TVector<char> aName(GetNOMLength()+1);
+
+ TErr aRet;
+ aRet = MEDprofileInfo(myFile->Id(),
+ theId,
+ &aName[0],
+ &aSize);
+ if (theErr)
+ *theErr = aRet;
+ else if (aRet < 0)
+ EXCEPTION(std::runtime_error, "GetProfilePreInfo - MEDprofileInfo(...)");
+
+ return TProfileInfo::TInfo(&aName[0], aSize);
+ }
+
+ //----------------------------------------------------------------------------
+ void
+ TWrapper
+ ::GetProfileInfo(TInt theId,
+ TProfileInfo& theInfo,
+ TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+
+ if (theErr && *theErr < 0)
+ return;
+
+ TProfileInfo& anInfo = const_cast<TProfileInfo&>(theInfo);
+ TValueHolder<TElemNum, med_int> anElemNum(anInfo.myElemNum);
+ TValueHolder<TString, char> aProfileName(anInfo.myName);
+
+ TErr aRet;
+ aRet = MEDprofileRd(myFile->Id(),
+ &aProfileName,
+ &anElemNum);
+ if (theErr)
+ *theErr = aRet;
+ else if (aRet < 0)
+ EXCEPTION(std::runtime_error, "GetProfileInfo - MEDprofileRd(...)");
+ }
+
+ //----------------------------------------------------------------------------
+ void
+ TWrapper
+ ::SetProfileInfo(const TProfileInfo& theInfo,
+ TErr* theErr)
+ {
+ TErr aRet;
+ SetProfileInfo(theInfo, eLECTURE_ECRITURE, &aRet);
+
+ if (aRet < 0)
+ SetProfileInfo(theInfo, eLECTURE_AJOUT, &aRet);
+
+ if (aRet < 0)
+ SetProfileInfo(theInfo, eCREATION, &aRet);
+
+ if (theErr)
+ *theErr = aRet;
+ }
+
+ //----------------------------------------------------------------------------
+ void
+ TWrapper
+ ::SetProfileInfo(const TProfileInfo& theInfo,
+ EModeAcces theMode,
+ TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile, theMode, theErr);
+
+ if (theErr && *theErr < 0)
+ return;
+
+ TProfileInfo& anInfo = const_cast<TProfileInfo&>(theInfo);
+ TValueHolder<TElemNum, med_int> anElemNum(anInfo.myElemNum);
+ TValueHolder<TString, char> aProfileName(anInfo.myName);
+
+ TErr aRet;
+ aRet = MEDprofileWr(myFile->Id(), // descripteur du fichier.
+ &aProfileName, // tableau de valeurs du profil.
+ theInfo.GetSize(), // taille du profil.
+ &anElemNum); // nom profil.
+ if (theErr)
+ *theErr = aRet;
+ else if (aRet < 0)
+ EXCEPTION(std::runtime_error, "SetProfileInfo - MEDprofileWr(...)");
+ }
+
+ //----------------------------------------------------------------------------
+ PProfileInfo
+ TWrapper
+ ::CrProfileInfo(const TProfileInfo::TInfo& theInfo,
+ EModeProfil theMode)
+ {
+ return PProfileInfo(new TTProfileInfo
+ (theInfo,
+ theMode));
+ }
+
+ //----------------------------------------------------------------------------
+ PProfileInfo
+ TWrapper
+ ::GetPProfileInfo(TInt theId,
+ EModeProfil theMode,
+ TErr* theErr)
+ {
+ TProfileInfo::TInfo aPreInfo = GetProfilePreInfo(theId);
+ PProfileInfo anInfo = CrProfileInfo(aPreInfo, theMode);
+ GetProfileInfo(theId, *anInfo, theErr);
+
+ return anInfo;
+ }
+
+ //----------------------------------------------------------------------------
+ void
+ TWrapper
+ ::GetTimeStampValue(const PTimeStampValueBase& theTimeStampValue,
+ const TMKey2Profile& theMKey2Profile,
+ const TKey2Gauss& theKey2Gauss,
+ TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+
+ if (theErr && *theErr < 0)
+ return;
+
+ TIdt anId = myFile->Id();
+
+ TValueHolder<EModeSwitch, med_switch_mode> aModeSwitch(theTimeStampValue->myModeSwitch);
+ MED::TGeom2Profile& aGeom2Profile = theTimeStampValue->myGeom2Profile;
+
+ MED::PTimeStampInfo aTimeStampInfo = theTimeStampValue->myTimeStampInfo;
+ TValueHolder<EEntiteMaillage, med_entity_type> anEntity(aTimeStampInfo->myEntity);
+ TValueHolder<TInt, med_int> aNumDt(aTimeStampInfo->myNumDt);
+ TValueHolder<TInt, med_int> aNumOrd(aTimeStampInfo->myNumOrd);
+
+ MED::PFieldInfo aFieldInfo = aTimeStampInfo->myFieldInfo;
+ TValueHolder<TString, char> aFieldName(aFieldInfo->myName);
+ TValueHolder<EBooleen, med_bool> anIsLocal(aFieldInfo->myIsLocal);
+
+ MED::PMeshInfo aMeshInfo = aFieldInfo->myMeshInfo;
+ TValueHolder<TString, char> aMeshName(aMeshInfo->myName);
+
+ TGeom2Gauss& aGeom2Gauss = aTimeStampInfo->myGeom2Gauss;
+ TVector<char> aGaussName(GetNOMLength()+1);
+
+ med_storage_mode aProfileMode = med_storage_mode(boost::get<0>(theMKey2Profile));
+ MED::TKey2Profile aKey2Profile = boost::get<1>(theMKey2Profile);
+ TVector<char> aProfileName(GetNOMLength()+1);
+
+ TGeom2Size& aGeom2Size = aTimeStampInfo->myGeom2Size;
+ TGeom2Size::iterator anIter = aGeom2Size.begin();
+ for (; anIter != aGeom2Size.end(); anIter++) {
+ EGeometrieElement aGeom = anIter->first;
+ TInt aNbElem = anIter->second;
+ med_int profilesize, aNbGauss;
+
+ TInt aNbVal = MEDfieldnValueWithProfile(anId,
+ &aFieldName,
+ aNumDt,
+ aNumOrd,
+ anEntity,
+ med_geometry_type(aGeom),
+ 1,
+ aProfileMode,
+ &aProfileName[0],
+ &profilesize,
+ &aGaussName[0],
+ &aNbGauss);
+
+ if (aNbVal <= 0) {
+ if (theErr) {
+ *theErr = -1;
+ return;
+ }
+ EXCEPTION(std::runtime_error, "GetTimeStampValue - MEDfieldnValueWithProfile(...) - aNbVal == "<<aNbVal<<" <= 0");
+ }
+
+ TInt aNbComp = aFieldInfo->myNbComp;
+ TInt aNbValue = aNbVal;// / aNbGauss; rules in MED changed
+ theTimeStampValue->AllocateValue(aGeom,
+ aNbValue,
+ aNbGauss,
+ aNbComp);
+ TInt aValueSize = theTimeStampValue->GetValueSize(aGeom);
+
+ INITMSG(MYDEBUG,
+ "TWrapper::GetTimeStampValue - aGeom = "<<aGeom<<
+ "; aNbVal = "<<aNbVal<<
+ "; aNbValue = "<<aNbValue<<
+ "; aNbGauss = "<<aNbGauss<<
+ "; aNbComp = "<<aNbComp<<
+ std::endl);
+
+ TErr aRet = MEDfieldValueWithProfileRd(anId,
+ &aFieldName,
+ aNumDt,
+ aNumOrd,
+ anEntity,
+ med_geometry_type(aGeom),
+ aProfileMode,
+ &aProfileName[0],
+ aModeSwitch,
+ MED_ALL_CONSTITUENT,
+ theTimeStampValue->GetValuePtr(aGeom));
+ if (aRet < 0) {
+ if (theErr) {
+ *theErr = MED_FALSE;
+ return;
+ }
+ EXCEPTION(std::runtime_error, "GetTimeStampValue - MEDfieldValueWithProfileRd(...)");
+ }
- //----------------------------------------------------------------------------
- PCellInfo
- TWrapper
- ::GetPCellInfo(const PMeshInfo& theMeshInfo,
- EEntiteMaillage theEntity,
- EGeometrieElement theGeom,
- EConnectivite theConnMode,
- TErr* theErr)
- {
- if(theMeshInfo->GetType() != eNON_STRUCTURE)
- return PCellInfo();
- TInt aNbElem = GetNbCells(theMeshInfo,theEntity,theGeom,theConnMode);
- PCellInfo anInfo = CrCellInfo(theMeshInfo,theEntity,theGeom,aNbElem,theConnMode);
- GetCellInfo(anInfo,theErr);
+ MED::PGaussInfo aGaussInfo;
+ TGaussInfo::TKey aKey(aGeom, &aGaussName[0]);
+ if (strcmp(&aGaussName[0], "") != 0) {
+ MED::TKey2Gauss::const_iterator anIter = theKey2Gauss.find(aKey);
+ if (anIter != theKey2Gauss.end()) {
+ aGaussInfo = anIter->second;
+ aGeom2Gauss[aGeom] = aGaussInfo;
+ }
+ }
-#ifdef _DEBUG_
- TInt aConnDim = anInfo->GetConnDim();
- INITMSG(MYDEBUG,"GetPCellInfo - theEntity = "<<theEntity<<"; theGeom = "<<theGeom<<"; aConnDim: "<<aConnDim<<"\n");
- BEGMSG(MYDEBUG,"GetPCellInfo - aNbElem: "<<aNbElem<<": ");
- for(TInt iElem = 0; iElem < aNbElem; iElem++){
- TCConnSlice aConnSlice = anInfo->GetConnSlice(iElem);
- for(TInt iConn = 0; iConn < aConnDim; iConn++){
- ADDMSG(MYVALUEDEBUG,aConnSlice[iConn]<<",");
+ MED::PProfileInfo aProfileInfo;
+ if (strcmp(&aProfileName[0], MED_NO_PROFILE) != 0) {
+ MED::TKey2Profile::const_iterator anIter = aKey2Profile.find(&aProfileName[0]);
+ if (anIter != aKey2Profile.end()) {
+ aProfileInfo = anIter->second;
+ aGeom2Profile[aGeom] = aProfileInfo;
+ }
}
- ADDMSG(MYVALUEDEBUG," ");
- }
- ADDMSG(MYDEBUG, std::endl);
- BEGMSG(MYVALUEDEBUG,"GetPCellInfo - GetFamNum: ");
- for(TInt iElem = 0; iElem < aNbElem; iElem++){
- ADDMSG(MYVALUEDEBUG,anInfo->GetFamNum(iElem)<<", ");
- }
- ADDMSG(MYVALUEDEBUG, std::endl);
+ if (aGaussInfo && aNbGauss != aGaussInfo->GetNbGauss()) {
+ if (theErr) {
+ *theErr = MED_FALSE;
+ return;
+ }
+ EXCEPTION(std::runtime_error, "GetTimeStampValue - aNbGauss != aGaussInfo->GetNbGauss()");
+ }
- if(anInfo->IsElemNum()){
- BEGMSG(MYVALUEDEBUG,"GetPCellInfo - GetElemNum: ");
- for(TInt iElem = 0; iElem < aNbElem; iElem++){
- ADDMSG(MYVALUEDEBUG,anInfo->GetElemNum(iElem)<<", ");
+ if (aProfileInfo && aProfileInfo->IsPresent()) {
+ TInt aNbSubElem = aProfileInfo->GetSize();
+ TInt aProfileSize = aNbSubElem*aNbComp*aNbGauss;
+ if (aProfileSize != aValueSize) {
+ if (theErr) {
+ *theErr = -1;
+ return;
+ }
+ EXCEPTION(std::runtime_error,
+ "GetTimeStampValue - aProfileSize("<<aProfileSize<<
+ ") != aValueSize("<<aValueSize<<
+ "); aNbVal = "<<aNbVal<<
+ "; anEntity = "<<anEntity<<
+ "; aGeom = "<<aGeom<<
+ "; aNbElem = "<<aNbElem<<
+ "; aNbSubElem = "<<aNbSubElem<<
+ "; aNbComp = "<<aNbComp<<
+ "; aNbGauss = "<<aNbGauss<<
+ "");
+ }
+ }
+ else{
+ if ((aProfileMode == MED_GLOBAL_STMODE) && (aNbElem != aNbValue)) {
+ if (theErr) {
+ *theErr = -1;
+ return;
+ }
+ EXCEPTION(std::runtime_error,
+ "GetTimeStampValue - aNbElem("<<aNbElem<<
+ ") != aNbValue("<<aNbValue<<
+ "); aNbVal = "<<aNbVal<<
+ "; anEntity = "<<anEntity<<
+ "; aGeom = "<<aGeom<<
+ "; aNbElem = "<<aNbElem<<
+ "; aNbComp = "<<aNbComp<<
+ "; aNbGauss = "<<aNbGauss<<
+ "");
+ }
}
- ADDMSG(MYVALUEDEBUG, std::endl);
}
- ADDMSG(MYDEBUG, std::endl);
-#endif
-
- return anInfo;
}
//----------------------------------------------------------------------------
- //! Read a MEDWrapped representation of MED Balls from the MED file
- PBallInfo
+ void
TWrapper
- ::GetPBallInfo(const PMeshInfo& theMeshInfo)
+ ::SetTimeStampValue(const PTimeStampValueBase& theTimeStampValue,
+ TErr* theErr)
{
- TInt nbBalls = GetNbBalls(theMeshInfo);
- if ( nbBalls < 1 ) return PBallInfo();
+ TErr aRet;
+ SetTimeStampValue(theTimeStampValue, eLECTURE_ECRITURE, &aRet);
- PBallInfo anInfo = CrBallInfo( theMeshInfo, nbBalls );
- GetBallInfo(anInfo);
+ if (aRet < 0)
+ SetTimeStampValue(theTimeStampValue, eLECTURE_AJOUT, &aRet);
- return anInfo;
+ if (theErr)
+ *theErr = aRet;
}
+
//----------------------------------------------------------------------------
- PFieldInfo
+ void
TWrapper
- ::GetPFieldInfo(const PMeshInfo& theMeshInfo,
- TInt theId,
- TErr* theErr)
+ ::SetTimeStampValue(const MED::PTimeStampValueBase& theTimeStampValue,
+ EModeAcces theMode,
+ TErr* theErr)
{
- TInt aNbComp = GetNbComp(theId);
- PFieldInfo anInfo = CrFieldInfo(theMeshInfo,aNbComp);
- GetFieldInfo(theId,*anInfo,theErr);
+ TFileWrapper aFileWrapper(myFile, theMode, theErr);
-#ifdef _DEBUG_
- INITMSG(MYDEBUG,
- "GetPFieldInfo "<<
- "- aName = '"<<anInfo->GetName()<<"'"<<
- "; aType = "<<anInfo->GetType()<<
- "; aNbComp = "<<aNbComp<<
- std::endl);
-#endif
-
- return anInfo;
- }
+ if (theErr && *theErr < 0)
+ return;
+ TErr aRet;
+ TIdt anId = myFile->Id();
- //----------------------------------------------------------------------------
- PTimeStampInfo
- TWrapper
- ::GetPTimeStampInfo(const PFieldInfo& theFieldInfo,
- EEntiteMaillage theEntity,
- const TGeom2Size& theGeom2Size,
- TInt theId,
- TErr* theErr)
- {
- PTimeStampInfo anInfo = CrTimeStampInfo(theFieldInfo,theEntity,theGeom2Size);
- GetTimeStampInfo(theId,*anInfo,theErr);
+ TValueHolder<EModeSwitch, med_switch_mode> aModeSwitch(theTimeStampValue->myModeSwitch);
+ MED::TGeom2Profile& aGeom2Profile = theTimeStampValue->myGeom2Profile;
+
+ MED::PTimeStampInfo aTimeStampInfo = theTimeStampValue->myTimeStampInfo;
+ TValueHolder<EEntiteMaillage, med_entity_type> anEntity(aTimeStampInfo->myEntity);
+ TValueHolder<TInt, med_int> aNumDt(aTimeStampInfo->myNumDt);
+ TValueHolder<TInt, med_int> aNumOrd(aTimeStampInfo->myNumOrd);
+ TValueHolder<TString, char> anUnitDt(aTimeStampInfo->myUnitDt);
+ TValueHolder<TFloat, med_float> aDt(aTimeStampInfo->myDt);
+ MED::TGeom2Gauss& aGeom2Gauss = aTimeStampInfo->myGeom2Gauss;
+
+ MED::PFieldInfo aFieldInfo = aTimeStampInfo->myFieldInfo;
+ TValueHolder<TString, char> aFieldName(aFieldInfo->myName);
+
+ MED::PMeshInfo aMeshInfo = aFieldInfo->myMeshInfo;
+ TValueHolder<TString, char> aMeshName(aMeshInfo->myName);
+
+ const TGeomSet& aGeomSet = theTimeStampValue->myGeomSet;
+ TGeomSet::const_iterator anIter = aGeomSet.begin();
+ for (; anIter != aGeomSet.end(); anIter++) {
+ EGeometrieElement aGeom = *anIter;
+
+ TVector<char> aGaussName(GetNOMLength()+1);
+ MED::TGeom2Gauss::const_iterator aGaussIter = aGeom2Gauss.find(aGeom);
+ if (aGaussIter != aGeom2Gauss.end()) {
+ MED::PGaussInfo aGaussInfo = aGaussIter->second;
+ strcpy(&aGaussName[0], &aGaussInfo->myName[0]);
+ }
+
+ TVector<char> aProfileName(GetNOMLength()+1);
+ med_storage_mode aProfileMode = med_storage_mode(eNO_PFLMOD);
+ MED::TGeom2Profile::const_iterator aProfileIter = aGeom2Profile.find(aGeom);
+ if (aProfileIter != aGeom2Profile.end()) {
+ MED::PProfileInfo aProfileInfo = aProfileIter->second;
+ aProfileMode = med_storage_mode(aProfileInfo->myMode);
+ strcpy(&aProfileName[0], &aProfileInfo->myName[0]);
+ }
+
+ med_int aNbVal = theTimeStampValue->GetNbVal(aGeom);
+
+ aRet = MEDfieldValueWithProfileWr(anId,
+ &aFieldName,
+ aNumDt,
+ aNumOrd,
+ aDt,
+ anEntity,
+ med_geometry_type(aGeom),
+ aProfileMode,
+ &aProfileName[0],
+ &aGaussName[0],
+ aModeSwitch,
+ MED_ALL_CONSTITUENT,
+ aNbVal,
+ theTimeStampValue->GetValuePtr(aGeom));
+ if (aRet < 0) {
+ if (theErr) {
+ *theErr = MED_FALSE;
+ break;
+ }
+ EXCEPTION(std::runtime_error, "SetTimeStampValue - MEDfieldValueWithProfileWr(...)");
+ }
-#ifdef _DEBUG_
- INITMSG(MYDEBUG,"GetPTimeStampInfo - anEntity = "<<anInfo->GetEntity()<<"\n");
- TGeom2NbGauss& aGeom2NbGauss = anInfo->myGeom2NbGauss;
- TGeom2NbGauss::const_iterator anIter = aGeom2NbGauss.begin();
- for(; anIter != aGeom2NbGauss.end(); anIter++){
- const EGeometrieElement& aGeom = anIter->first;
- INITMSG(MYDEBUG,"aGeom = "<<aGeom<<" - "<<aGeom2NbGauss[aGeom]<<";\n");
}
-#endif
- return anInfo;
+ INITMSG(MYDEBUG, "TWrapper::SetTimeStampValue - MED_MODE_ACCES = "<<theMode<<"; aRet = "<<aRet<<std::endl);
}
-
//----------------------------------------------------------------------------
- PProfileInfo
+ PTimeStampValueBase
TWrapper
- ::GetPProfileInfo(TInt theId,
- EModeProfil theMode,
- TErr* theErr)
+ ::CrTimeStampValue(const PTimeStampInfo& theTimeStampInfo,
+ ETypeChamp theTypeChamp,
+ const TGeom2Profile& theGeom2Profile,
+ EModeSwitch theMode)
{
- TProfileInfo::TInfo aPreInfo = GetProfilePreInfo(theId);
- PProfileInfo anInfo = CrProfileInfo(aPreInfo,theMode);
- GetProfileInfo(theId,*anInfo,theErr);
-
- return anInfo;
+ if (theTypeChamp == eFLOAT64)
+ return PTimeStampValueBase(new TTTimeStampValue<TFloatMeshValue>
+ (theTimeStampInfo,
+ theTypeChamp,
+ theGeom2Profile,
+ theMode));
+ return PTimeStampValueBase(new TTTimeStampValue<TIntMeshValue>
+ (theTimeStampInfo,
+ theTypeChamp,
+ theGeom2Profile,
+ theMode));
}
-
//----------------------------------------------------------------------------
PTimeStampValueBase
TWrapper
theMode);
}
+ //----------------------------------------------------------------------------
+ PTimeStampValueBase
+ TWrapper
+ ::CrTimeStampValue(const PTimeStampInfo& theTimeStampInfo,
+ const PTimeStampValueBase& theInfo,
+ ETypeChamp theTypeChamp)
+ {
+ if (theTypeChamp == eFLOAT64)
+ return PTimeStampValueBase(new TTTimeStampValue<TFloatMeshValue>
+ (theTimeStampInfo,
+ theInfo,
+ theTypeChamp));
+ return PTimeStampValueBase(new TTTimeStampValue<TIntMeshValue>
+ (theTimeStampInfo,
+ theInfo,
+ theTypeChamp));
+ }
+
//----------------------------------------------------------------------------
PTimeStampValueBase
TWrapper
}
//----------------------------------------------------------------------------
- template<class TimeStampValueType>
- void
- Print(SharedPtr<TimeStampValueType> theTimeStampValue)
- {
- INITMSG(MYDEBUG,"Print - TimeStampValue\n");
- typename TimeStampValueType::TTGeom2Value& aGeom2Value = theTimeStampValue->myGeom2Value;
- typename TimeStampValueType::TTGeom2Value::const_iterator anIter = aGeom2Value.begin();
- for(; anIter != aGeom2Value.end(); anIter++){
- const EGeometrieElement& aGeom = anIter->first;
- const typename TimeStampValueType::TTMeshValue& aMeshValue = anIter->second;
- TInt aNbElem = aMeshValue.myNbElem;
- TInt aNbGauss = aMeshValue.myNbGauss;
- TInt aNbComp = aMeshValue.myNbComp;
- INITMSG(MYDEBUG,"aGeom = "<<aGeom<<" - "<<aNbElem<<": ");
- for(TInt iElem = 0; iElem < aNbElem; iElem++){
- typename TimeStampValueType::TTMeshValue::TCValueSliceArr aValueSliceArr = aMeshValue.GetGaussValueSliceArr(iElem);
- ADDMSG(MYVALUEDEBUG,"{");
- for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
- const typename TimeStampValueType::TTMeshValue::TCValueSlice& aValueSlice = aValueSliceArr[iGauss];
- for(TInt iComp = 0; iComp < aNbComp; iComp++){
- ADDMSG(MYVALUEDEBUG,aValueSlice[iComp]<<" ");
- }
- ADDMSG(MYVALUEDEBUG,"| ");
- }
- ADDMSG(MYVALUEDEBUG,"} ");
- }
- ADDMSG(MYDEBUG,"\n");
- }
- }
-
- //----------------------------------------------------------------------------
- PTimeStampValueBase
+ PTimeStampValueBase
TWrapper
::GetPTimeStampValue(const PTimeStampInfo& theTimeStampInfo,
const TMKey2Profile& theMKey2Profile,
PFieldInfo aFieldInfo = theTimeStampInfo->GetFieldInfo();
PTimeStampValueBase anInfo = CrTimeStampValue(theTimeStampInfo,
aFieldInfo->GetType());
- GetTimeStampValue(anInfo,
- theMKey2Profile,
+ GetTimeStampValue(anInfo,
+ theMKey2Profile,
theKey2Gauss,
theErr);
#ifdef _DEBUG_
- if(aFieldInfo->GetType() == eFLOAT64)
+ if (aFieldInfo->GetType() == eFLOAT64)
Print<TFloatTimeStampValue>(anInfo);
else
Print<TIntTimeStampValue>(anInfo);
}
//----------------------------------------------------------------------------
- void
+ void
TWrapper
::GetTimeStampVal(const PTimeStampVal& theVal,
const TMKey2Profile& theMKey2Profile,
{
PTimeStampInfo aTimeStampInfo = theVal->GetTimeStampInfo();
PFieldInfo aFieldInfo = aTimeStampInfo->GetFieldInfo();
- if(aFieldInfo->GetType() == eFLOAT64)
+ if (aFieldInfo->GetType() == eFLOAT64)
GetTimeStampValue(theVal,
theMKey2Profile,
theKey2Gauss,
{
PTimeStampInfo aTimeStampInfo = theVal->GetTimeStampInfo();
PFieldInfo aFieldInfo = aTimeStampInfo->GetFieldInfo();
- if(aFieldInfo->GetType() == eFLOAT64)
+ if (aFieldInfo->GetType() == eFLOAT64)
SetTimeStampValue(theVal, theErr);
else{
PTimeStampValueBase aVal = CrTimeStampValue(aTimeStampInfo,
}
//----------------------------------------------------------------------------
- PTimeStampVal
+ PTimeStampVal
TWrapper
::GetPTimeStampVal(const PTimeStampInfo& theTimeStampInfo,
const TMKey2Profile& theMKey2Profile,
TErr* theErr)
{
PTimeStampVal anInfo = CrTimeStampVal(theTimeStampInfo);
- GetTimeStampVal(anInfo,
- theMKey2Profile,
+ GetTimeStampVal(anInfo,
+ theMKey2Profile,
theKey2Gauss,
theErr);
return anInfo;
TWrapper
::GetPGrilleInfo(const PMeshInfo& theMeshInfo)
{
- if(theMeshInfo->GetType() != eSTRUCTURE)
+ if (theMeshInfo->GetType() != eSTRUCTURE)
return PGrilleInfo();
EGrilleType type;
- GetGrilleType(*theMeshInfo,type);
+ GetGrilleType(*theMeshInfo, type);
PGrilleInfo anInfo;
- if(type == eGRILLE_STANDARD){
+ if (type == eGRILLE_STANDARD) {
const TInt nnoeuds = GetNbNodes(*theMeshInfo);
- anInfo = CrGrilleInfo(theMeshInfo,type,nnoeuds);
+ anInfo = CrGrilleInfo(theMeshInfo, type, nnoeuds);
}
else {
TIntVector aVec;
aVec.resize(theMeshInfo->GetDim());
- for(int aAxe=0;aAxe<theMeshInfo->GetDim();aAxe++){
+ for (int aAxe=0;aAxe<theMeshInfo->GetDim();aAxe++) {
ETable aATable = eCOOR_IND1;
- switch(aAxe){
+ switch (aAxe) {
case 0:
aATable = eCOOR_IND1;
break;
aATable = eCOOR_IND3;
break;
}
- aVec[aAxe] = GetNbNodes(*theMeshInfo,aATable);
+ aVec[aAxe] = GetNbNodes(*theMeshInfo, aATable);
}
- anInfo = CrGrilleInfo(theMeshInfo,type,aVec);
+ anInfo = CrGrilleInfo(theMeshInfo, type, aVec);
}
GetGrilleInfo(anInfo);
anInfo->SetGrilleType(type);
#ifdef _DEBUG_
- INITMSG(MYDEBUG,"GetPGrilleInfo: ");
+ INITMSG(MYDEBUG, "GetPGrilleInfo: ");
{
TInt aNbElem = anInfo->GetNbNodes();
- BEGMSG(MYVALUEDEBUG,"GetFamNumNode: ");
- for(TInt iElem = 0; iElem < aNbElem; iElem++){
- ADDMSG(MYVALUEDEBUG,anInfo->GetFamNumNode(iElem)<<", ");
+ BEGMSG(MYVALUEDEBUG, "GetFamNumNode: ");
+ for (TInt iElem = 0; iElem < aNbElem; iElem++) {
+ ADDMSG(MYVALUEDEBUG, anInfo->GetFamNumNode(iElem)<<", ");
}
TInt aNbCells = anInfo->GetNbCells();
- BEGMSG(MYVALUEDEBUG,"GetFamNum: ");
- for(TInt iElem = 0; iElem < aNbCells; iElem++){
- ADDMSG(MYVALUEDEBUG,anInfo->GetFamNum(iElem)<<", ");
+ BEGMSG(MYVALUEDEBUG, "GetFamNum: ");
+ for (TInt iElem = 0; iElem < aNbCells; iElem++) {
+ ADDMSG(MYVALUEDEBUG, anInfo->GetFamNum(iElem)<<", ");
}
ADDMSG(MYVALUEDEBUG, std::endl);
- BEGMSG(MYVALUEDEBUG,"GetCoordName: ");
- for(TInt iElem = 0; iElem < theMeshInfo->GetDim(); iElem++){
- ADDMSG(MYVALUEDEBUG,anInfo->GetCoordName(iElem)<<", ");
+ BEGMSG(MYVALUEDEBUG, "GetCoordName: ");
+ for (TInt iElem = 0; iElem < theMeshInfo->GetDim(); iElem++) {
+ ADDMSG(MYVALUEDEBUG, anInfo->GetCoordName(iElem)<<", ");
}
ADDMSG(MYVALUEDEBUG, std::endl);
- BEGMSG(MYVALUEDEBUG,"GetCoordUnit: ");
- for(TInt iElem = 0; iElem < theMeshInfo->GetDim(); iElem++){
- ADDMSG(MYVALUEDEBUG,anInfo->GetCoordUnit(iElem)<<", ");
+ BEGMSG(MYVALUEDEBUG, "GetCoordUnit: ");
+ for (TInt iElem = 0; iElem < theMeshInfo->GetDim(); iElem++) {
+ ADDMSG(MYVALUEDEBUG, anInfo->GetCoordUnit(iElem)<<", ");
}
ADDMSG(MYVALUEDEBUG, std::endl);
-
+
}
#endif
-
+
return anInfo;
}
-
+
//----------------------------------------------------------------------------
PGrilleInfo
TWrapper
::GetPGrilleInfo(const PMeshInfo& theMeshInfo,
const PGrilleInfo& theInfo)
{
- PGrilleInfo anInfo = CrGrilleInfo(theMeshInfo,theInfo);
+ PGrilleInfo anInfo = CrGrilleInfo(theMeshInfo, theInfo);
return anInfo;
- }
+ }
+
+ //----------------------------------------------------------------------------
+ void
+ TWrapper
+ ::GetGrilleInfo(TGrilleInfo& theInfo,
+ TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+
+ if (theErr && *theErr < 0)
+ return;
+
+ MED::TMeshInfo& aMeshInfo = *theInfo.myMeshInfo;
+ TValueHolder<TString, char> aMeshName(aMeshInfo.myName);
+ EMaillage aMaillageType = aMeshInfo.myType;
+
+ GetGrilleType(aMeshInfo, theInfo.myGrilleType, theErr);
+ EGrilleType aGrilleType = theInfo.myGrilleType;
+
+ TErr aRet = 0;
+ if (aMaillageType == eSTRUCTURE && aGrilleType == eGRILLE_STANDARD) {
+ GetGrilleStruct(aMeshInfo, theInfo.myGrilleStructure, theErr);
+
+ TValueHolder<TNodeCoord, med_float> aCoord(theInfo.myCoord);
+ TValueHolder<EModeSwitch, med_switch_mode> aModeSwitch(theInfo.myModeSwitch);
+ TValueHolder<TString, char> aCoordNames(theInfo.myCoordNames);
+ TValueHolder<TString, char> aCoordUnits(theInfo.myCoordUnits);
+ //med_axis_type aRepere;
+
+ aRet = MEDmeshNodeCoordinateRd(myFile->Id(),
+ &aMeshName,
+ MED_NO_DT,
+ MED_NO_IT,
+ aModeSwitch,
+ &aCoord);
+
+ if (theErr)
+ *theErr = aRet;
+ else if (aRet < 0)
+ EXCEPTION(std::runtime_error, "GetGrilleInfo - MEDmeshNodeCoordinateRd(...)");
+
+ //TInt aNbNodes = theInfo.GetNbNodes();//GetNbFamilies(aMeshInfo);
+ TValueHolder<TElemNum, med_int> aFamNumNode(theInfo.myFamNumNode);
+
+ aRet = MEDmeshEntityFamilyNumberRd(myFile->Id(),
+ &aMeshName,
+ MED_NO_DT,
+ MED_NO_IT,
+ MED_NODE,
+ MED_NO_GEOTYPE,
+ &aFamNumNode);
+
+ if (aRet < 0) {
+ // if (aRet == MED_ERR_DOESNTEXIST) // --- only valid with MED3.x files
+ {
+ int mySize = (int)theInfo.myFamNumNode.size();
+ theInfo.myFamNumNode.clear();
+ theInfo.myFamNumNode.resize(mySize,0);
+ aRet = 0;
+ }
+ // else
+ // EXCEPTION(std::runtime_error, "GetGrilleInfo - MEDmeshEntityFamilyNumberRd(...)");
+ }
+ if (theErr)
+ *theErr = aRet;
+
+ //============================
+ }
+
+ if (aMaillageType == eSTRUCTURE && aGrilleType != eGRILLE_STANDARD) {
+ ETable aTable = eCOOR_IND1;
+ for (med_int anAxis = 1; anAxis <= aMeshInfo.myDim; anAxis++) {
+ switch (anAxis) {
+ case 1:
+ aTable = eCOOR_IND1;
+ break;
+ case 2:
+ aTable = eCOOR_IND2;
+ break;
+ case 3:
+ aTable = eCOOR_IND3;
+ break;
+ default:
+ aRet = -1;
+ }
+
+ if (theErr)
+ *theErr = aRet;
+ else if (aRet < 0)
+ EXCEPTION(std::runtime_error, "GetGrilleInfo - anAxis number out of range(...)");
+
+ TInt aNbIndexes = GetNbNodes(aMeshInfo, aTable);
+ if (aNbIndexes < 0)
+ EXCEPTION(std::runtime_error, "GetGrilleInfo - Erreur a la lecture de la taille de l'indice");
+
+ TValueHolder<TFloatVector, med_float> anIndexes(theInfo.GetIndexes(anAxis-1));
+ //TValueHolder<ETable, med_data_type > table(aTable);
+ //char aCompNames[MED_SNAME_SIZE+1];
+ //char anUnitNames[MED_SNAME_SIZE+1];
+ aRet=MEDmeshGridIndexCoordinateRd(myFile->Id(),
+ &aMeshName,
+ MED_NO_DT,MED_NO_IT,
+ anAxis,
+ &anIndexes);
+
+ //theInfo.SetCoordName(anAxis-1, aCompNames);
+ //theInfo.SetCoordUnit(anAxis-1, anUnitNames);
+ theInfo.SetGrilleStructure(anAxis-1, aNbIndexes);
+
+ if (theErr)
+ *theErr = aRet;
+ else if (aRet < 0)
+ EXCEPTION(std::runtime_error, "GetGrilleInfo - MEDindicesCoordLire(...)");
+ }
+ }
+
+ EGeometrieElement aGeom = theInfo.GetGeom();
+ EEntiteMaillage aEntity = theInfo.GetEntity();
+ TInt aNbCells = theInfo.GetNbCells();
+
+ theInfo.myFamNum.resize(aNbCells);
+ TValueHolder<TElemNum, med_int> aFamNum(theInfo.myFamNum);
+
+ aRet = MEDmeshEntityFamilyNumberRd(myFile->Id(),
+ &aMeshName, MED_NO_DT, MED_NO_IT, med_entity_type(aEntity),
+ med_geometry_type(aGeom), &aFamNum);
+
+ if (aMeshInfo.myDim == 3)
+ {
+ aGeom = theInfo.GetSubGeom();
+ aEntity = theInfo.GetSubEntity();
+ aNbCells = theInfo.GetNbSubCells();
+
+ theInfo.myFamSubNum.resize(aNbCells, 0);
+ TValueHolder<TElemNum, med_int> aFamNum(theInfo.myFamSubNum);
+
+ aRet = MEDmeshEntityFamilyNumberRd(myFile->Id(),
+ &aMeshName,
+ MED_NO_DT,
+ MED_NO_IT,
+ med_entity_type(aEntity),
+ med_geometry_type(aGeom),
+ &aFamNum);
+ }
+ if (aRet < 0) {
+ // if (aRet == MED_ERR_DOESNTEXIST) // --- only valid with MED3.x files
+ {
+ int mySize = (int)theInfo.myFamNumNode.size();
+ theInfo.myFamNumNode.clear();
+ theInfo.myFamNumNode.resize(mySize, 0);
+ aRet = 0;
+ }
+ // else
+ // EXCEPTION(std::runtime_error,"GetGrilleInfo - MEDmeshEntityFamilyNumberRd(...)");
+ }
+ if (theErr)
+ *theErr = aRet;
+ }
+
+ //----------------------------------------------------------------------------
+ void
+ TWrapper
+ ::SetGrilleInfo(const MED::TGrilleInfo& theInfo,
+ TErr* theErr)
+ {
+ SetGrilleInfo(theInfo, eLECTURE_ECRITURE, theErr);
+ }
+
+ //----------------------------------------------------------------------------
+ void
+ TWrapper
+ ::SetGrilleInfo(const MED::TGrilleInfo& theInfo,
+ EModeAcces theMode,
+ TErr* theErr)
+ {
+ if (theInfo.myMeshInfo->myType != eSTRUCTURE)
+ return;
+ TFileWrapper aFileWrapper(myFile, theMode, theErr);
+
+ if (theErr && *theErr < 0)
+ return;
+
+ MED::TGrilleInfo& anInfo = const_cast<MED::TGrilleInfo&>(theInfo);
+
+ MED::TMeshInfo& aMeshInfo = *anInfo.myMeshInfo;
+ TValueHolder<TString, char> aMeshName(aMeshInfo.myName);
+
+ TValueHolder<EGrilleType, med_grid_type > aGrilleType(anInfo.myGrilleType);
+
+ TErr aRet = 0;
+ aRet = MEDmeshGridTypeRd(myFile->Id(),
+ &aMeshName,
+ &aGrilleType);
+ if (theErr)
+ *theErr = aRet;
+ else if (aRet < 0)
+ EXCEPTION(std::runtime_error, "SetGrilleInfo - MEDmeshGridTypeRd(...)");
+
+ if (anInfo.myGrilleType == eGRILLE_STANDARD) {
+ TValueHolder<TNodeCoord, med_float> aCoord(anInfo.myCoord);
+ TValueHolder<EModeSwitch, med_switch_mode> aModeSwitch(anInfo.myModeSwitch);
+ TValueHolder<TString, char> aCoordNames(anInfo.myCoordNames);
+ TValueHolder<TString, char> aCoordUnits(anInfo.myCoordUnits);
+ med_int aNbNoeuds = med_int(anInfo.myCoord.size() / aMeshInfo.myDim);
+ //med_axis_type aRepere = MED_CARTESIAN;
+
+ aRet = MEDmeshNodeCoordinateWr(myFile->Id(),
+ &aMeshName,
+ MED_NO_DT,
+ MED_NO_IT,
+ MED_UNDEF_DT,
+ aModeSwitch,
+ aNbNoeuds,
+ &aCoord);
+
+ if (aRet < 0)
+ EXCEPTION(std::runtime_error, "SetGrilleInfo - MEDmeshNodeCoordinateWr(...)");
+
+ TValueHolder<TIntVector, med_int> aGrilleStructure(anInfo.myGrilleStructure);
+ aRet = MEDmeshGridStructWr(myFile->Id(),
+ &aMeshName,
+ MED_NO_DT,
+ MED_NO_IT,
+ MED_UNDEF_DT,
+ &aGrilleStructure);
+ if (aRet < 0)
+ EXCEPTION(std::runtime_error, "SetGrilleInfo - MEDmeshGridStructWr(...)");
+
+ }
+ else {
+ for (med_int aAxis = 0; aAxis < aMeshInfo.myDim; aAxis++) {
+ aRet = MEDmeshGridIndexCoordinateWr(myFile->Id(),
+ &aMeshName,
+ MED_NO_DT,
+ MED_NO_IT,
+ MED_UNDEF_DT,
+ aAxis+1,
+ anInfo.GetIndexes(aAxis).size(),
+ &anInfo.GetIndexes(aAxis)[0]);
+
+ if (aRet < 0)
+ EXCEPTION(std::runtime_error, "SetGrilleInfo - MEDmeshGridIndexCoordinateWr(...)");
+ }
+
+ }
+
+ return;
+ }
+
+ //----------------------------------------------------------------------------
+ PGrilleInfo
+ TWrapper
+ ::CrGrilleInfo(const PMeshInfo& theMeshInfo,
+ const PGrilleInfo& theInfo)
+ {
+ return PGrilleInfo(new TTGrilleInfo
+ (theMeshInfo,
+ theInfo));
+ }
+
+ //----------------------------------------------------------------------------
+ PGrilleInfo
+ TWrapper
+ ::CrGrilleInfo(const PMeshInfo& theMeshInfo)
+ {
+ return PGrilleInfo(); // not implemented????
+ }
+
+ //----------------------------------------------------------------------------
+ PGrilleInfo
+ TWrapper
+ ::CrGrilleInfo(const PMeshInfo& theMeshInfo,
+ const EGrilleType& type)
+ {
+ return PGrilleInfo(new TTGrilleInfo
+ (theMeshInfo,
+ type));
+ }
+
+ //----------------------------------------------------------------------------
+ PGrilleInfo
+ TWrapper
+ ::CrGrilleInfo(const PMeshInfo& theMeshInfo,
+ const EGrilleType& type,
+ const TInt& nbNodes)
+ {
+ return PGrilleInfo(new TTGrilleInfo
+ (theMeshInfo,
+ type,
+ nbNodes));
+ }
+
+ //----------------------------------------------------------------------------
+ PGrilleInfo
+ TWrapper
+ ::CrGrilleInfo(const PMeshInfo& theMeshInfo,
+ const EGrilleType& type,
+ const MED::TIntVector& nbNodeVec)
+ {
+ return PGrilleInfo(new TTGrilleInfo
+ (theMeshInfo,
+ type,
+ nbNodeVec));
+ }
+
+ //----------------------------------------------------------------------------
+ void
+ TWrapper
+ ::GetGrilleType(const MED::TMeshInfo& theMeshInfo,
+ EGrilleType& theGridType,
+ TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+
+ if (theErr && *theErr < 0)
+ EXCEPTION(std::runtime_error, " GetGrilleType - aFileWrapper (...)");
+
+ MED::TMeshInfo& aMeshInfo = const_cast<MED::TMeshInfo&>(theMeshInfo);
+
+ if (aMeshInfo.myType == eSTRUCTURE) {
+ TValueHolder<TString, char> aMeshName(aMeshInfo.myName);
+ TValueHolder<EGrilleType, med_grid_type> aGridType(theGridType);
+ TErr aRet = MEDmeshGridTypeRd(myFile->Id(),
+ &aMeshName,
+ &aGridType);
+
+ if (aRet < 0)
+ EXCEPTION(std::runtime_error, "GetGrilleInfo - MEDmeshGridTypeRd(...)");
+ }
+ }
+
+ //----------------------------------------------------------------------------
+ void
+ TWrapper
+ ::GetGrilleStruct(const MED::TMeshInfo& theMeshInfo,
+ TIntVector& theStruct,
+ TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile, eLECTURE, theErr);
+
+ if (theErr && *theErr < 0)
+ return;
+
+ TErr aRet;
+ MED::TMeshInfo& aMeshInfo = const_cast<MED::TMeshInfo&>(theMeshInfo);
+
+ TValueHolder<TString, char> aMeshName(aMeshInfo.myName);
+ TValueHolder<TIntVector, med_int> aGridStructure(theStruct);
+
+ aRet = MEDmeshGridStructRd(myFile->Id(),
+ &aMeshName,
+ MED_NO_DT,
+ MED_NO_IT,
+ &aGridStructure);
+ if (theErr)
+ *theErr = aRet;
+ else if (aRet < 0)
+ EXCEPTION(std::runtime_error, "GetGrilleInfo - MEDmeshGridStructRd(...)");
+ }
}
namespace MED
{
//----------------------------------------------------------------------------
- //! Define a base class that wraps the MED API
- struct MEDWRAPPER_EXPORT TWrapper
+ class TFile;
+ typedef boost::shared_ptr<TFile> PFile;
+
+ typedef enum {eLECTURE, eLECTURE_ECRITURE, eLECTURE_AJOUT, eCREATION} EModeAcces;
+
+ //----------------------------------------------------------------------------
+ //! Class that wraps the MED API
+ class MEDWRAPPER_EXPORT TWrapper
{
+ friend class TLockProxy;
+
typedef boost::mutex TMutex;
- //! This is a syncronization primitive which allow to support thread safety for the MED access
+ //! Syncronization primitive that allows supporting thread safety for the MED access
TMutex myMutex;
+ TWrapper();
+ TWrapper(const TWrapper&);
+ TWrapper& operator=(const TWrapper&);
+
+ public:
+ TWrapper(const std::string& theFileName);
+
virtual
~TWrapper();
- //----------------------------------------------------------------------------
- //! Creates a MEDWrapper MED Mesh representation
- virtual
- PMeshInfo
- CrMeshInfo(TInt theDim = 0, TInt theSpaceDim = 0,
- const std::string& theValue = "",
- EMaillage theType = eNON_STRUCTURE,
- const std::string& theDesc = "") = 0;
-
- //! A copy-constructor for the MEDWrapper MED Mesh representation
- virtual
- PMeshInfo
- CrMeshInfo(const PMeshInfo& theInfo) = 0;
-
- //! Read number of MED Mesh entities in the defined MED file
- virtual
- TInt
- GetNbMeshes(TErr* theErr = NULL) = 0;
-
+ //! Read number of MED Mesh entities in the MED file
+ virtual
+ TInt
+ GetNbMeshes(TErr* theErr = NULL);
+
//! Read a MEDWrapper MED Mesh representation by its number
- virtual
- void
- GetMeshInfo(TInt theMeshId,
+ virtual
+ void
+ GetMeshInfo(TInt theMeshId,
TMeshInfo& theInfo,
- TErr* theErr = NULL) = 0;
+ TErr* theErr = NULL);
- //! Write the MEDWrapper MED Mesh representation in the defined MED file
- virtual
+ //! Write the MEDWrapper MED Mesh representation into the MED file
+ virtual
void
SetMeshInfo(const TMeshInfo& theInfo,
- TErr* theErr = NULL) = 0;
-
- //! Read a MEDWrapper MED Mesh representation by its number
- virtual
+ TErr* theErr = NULL);
+
+ void
+ SetMeshInfo(const MED::TMeshInfo& theInfo,
+ EModeAcces theMode,
+ TErr* theErr = NULL);
+
+ //! Create a MEDWrapper MED Mesh representation
+ virtual
+ PMeshInfo
+ CrMeshInfo(TInt theDim = 0,
+ TInt theSpaceDim = 0,
+ const std::string& theValue = "",
+ EMaillage theType = eNON_STRUCTURE,
+ const std::string& theDesc = "");
+
+ //! Copy constructor for the MEDWrapper MED Mesh representation
+ virtual
+ PMeshInfo
+ CrMeshInfo(const PMeshInfo& theInfo);
+
+ //! Get a MEDWrapper MED Mesh representation by its number
+ virtual
PMeshInfo
GetPMeshInfo(TInt theId,
TErr* theErr = NULL);
- //----------------------------------------------------------------------------
- //! Read number of MED Family entities in the defined MED file
- virtual
+ //! Read number of MED Family entities in the MED file
+ virtual
TInt
GetNbFamilies(const TMeshInfo& theMeshInfo,
- TErr* theErr = NULL) = 0;
+ TErr* theErr = NULL);
- //! Read number of attributes for defined MED Family
- virtual
+ //! Read number of attributes for MED Family
+ virtual
TInt
- GetNbFamAttr(TInt theFamId,
+ GetNbFamAttr(TInt theFamId,
const TMeshInfo& theInfo,
- TErr* theErr = NULL) = 0;
-
- //! Read number of MED Groups where MED Family with the number belong to
+ TErr* theErr = NULL);
+
+ //! Read number of MED Groups to which the MED Family belongs to
virtual
TInt
- GetNbFamGroup(TInt theFamId,
+ GetNbFamGroup(TInt theFamId,
const TMeshInfo& theInfo,
- TErr* theErr = NULL) = 0;
-
+ TErr* theErr = NULL);
+
//! Read a MEDWrapper MED Family representation by its number
virtual
void
- GetFamilyInfo(TInt theFamId,
+ GetFamilyInfo(TInt theFamId,
TFamilyInfo& theInfo,
- TErr* theErr = NULL) = 0;
-
- //! Write a MEDWrapper MED Family representation by its number
+ TErr* theErr = NULL);
+
+ //! Write a MEDWrapper MED Family representation into the MED file
virtual
void
SetFamilyInfo(const TFamilyInfo& theInfo,
- TErr* theErr = NULL) = 0;
-
- //! Creates a MEDWrapper MED Family representation
- virtual
+ TErr* theErr = NULL);
+
+ void
+ SetFamilyInfo(const MED::TFamilyInfo& theInfo,
+ EModeAcces theMode,
+ TErr* theErr = NULL);
+
+ //! Create a MEDWrapper MED Family representation
+ virtual
PFamilyInfo
CrFamilyInfo(const PMeshInfo& theMeshInfo,
- TInt theNbGroup = 0,
+ TInt theNbGroup = 0,
TInt theNbAttr = 0,
TInt theId = 0,
- const std::string& theValue = "") = 0;
-
- //! Creates a MEDWrapper MED Family representation
- virtual
+ const std::string& theValue = "");
+
+ //! Create a MEDWrapper MED Family representation
+ virtual
PFamilyInfo
CrFamilyInfo(const PMeshInfo& theMeshInfo,
const std::string& theValue,
TInt theId,
- const TStringSet& theGroupNames,
- const TStringVector& theAttrDescs = TStringVector(),
- const TIntVector& theAttrIds = TIntVector(),
- const TIntVector& theAttrVals = TIntVector()) = 0;
-
- //! A copy-constructor for the MEDWrapper MED Family representation
+ const TStringSet& theGroupNames,
+ const TStringVector& theAttrDescs = TStringVector(),
+ const TIntVector& theAttrIds = TIntVector(),
+ const TIntVector& theAttrVals = TIntVector());
+
+ //! Copy constructor for the MEDWrapper MED Family representation
virtual
PFamilyInfo
CrFamilyInfo(const PMeshInfo& theMeshInfo,
- const PFamilyInfo& theInfo) = 0;
-
- //! Write a MEDWrapper MED Family representation by its number
+ const PFamilyInfo& theInfo);
+
+ //! Get a MEDWrapper MED Family representation by its number
PFamilyInfo
- GetPFamilyInfo(const PMeshInfo& theMeshInfo,
+ GetPFamilyInfo(const PMeshInfo& theMeshInfo,
TInt theId,
TErr* theErr = NULL);
-
- //----------------------------------------------------------------------------
+
//! Read sequence of names for any descendant of TElemInfo
virtual
void
GetNames(TElemInfo& theInfo,
TInt theNb,
- EEntiteMaillage theEntity,
+ EEntiteMaillage theEntity,
EGeometrieElement theGeom,
- TErr* theErr = NULL)
- {}
+ TErr* theErr = NULL);
+
+ //! Write sequence of names for any descendant of TElemInfo
+ virtual
+ void
+ SetNames(const TElemInfo& theInfo,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
+ TErr* theErr = NULL);
- //! Read sequence of numerous for any descendant of TElemInfo
+ void
+ SetNames(const TElemInfo& theInfo,
+ EModeAcces theMode,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
+ TErr* theErr = NULL);
+
+ //! Read sequence of numerated data for any descendant of TElemInfo
virtual
void
GetNumeration(TElemInfo& theInfo,
TInt theNb,
- EEntiteMaillage theEntity,
+ EEntiteMaillage theEntity,
EGeometrieElement theGeom,
- TErr* theErr = NULL)
- {}
+ TErr* theErr = NULL);
- //! Read sequence MED Family indexes for any descendant of TElemInfo
+ //! Write sequence of numerated data for any descendant of TElemInfo
virtual
void
- GetFamilies(TElemInfo& theInfo,
- TInt theNb,
- EEntiteMaillage theEntity,
- EGeometrieElement theGeom,
- TErr* theErr = NULL)
- {}
+ SetNumeration(const TElemInfo& theInfo,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
+ TErr* theErr = NULL);
- //! Write sequence of names for any descendant of TElemInfo
- virtual
void
- SetNames(const TElemInfo& theInfo,
- EEntiteMaillage theEntity,
- EGeometrieElement theGeom,
- TErr* theErr = NULL)
- {}
+ SetNumeration(const TElemInfo& theInfo,
+ EModeAcces theMode,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
+ TErr* theErr = NULL);
- //! Write sequence of numerous for any descendant of TElemInfo
+ //! Read sequence of MED Families' indices for any descendant of TElemInfo
virtual
void
- SetNumeration(const TElemInfo& theInfo,
- EEntiteMaillage theEntity,
- EGeometrieElement theGeom,
- TErr* theErr = NULL)
- {}
+ GetFamilies(TElemInfo& theInfo,
+ TInt theNb,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
+ TErr* theErr = NULL);
- //! Write sequence MED Family indexes for any descendant of TElemInfo
+ //! Write sequence of MED Families' indices for any descendant of TElemInfo
virtual
void
SetFamilies(const TElemInfo& theInfo,
- EEntiteMaillage theEntity,
+ EEntiteMaillage theEntity,
EGeometrieElement theGeom,
- TErr* theErr = NULL)
- {}
+ TErr* theErr = NULL);
- //! Read a MEDWrapper MED Element representation from defined MED file
- PElemInfo
- GetPElemInfo(const PMeshInfo& theMeshInfo,
- EEntiteMaillage theEntity = eNOEUD,
- EGeometrieElement theGeom = ePOINT1,
- EConnectivite theConnMode = eNOD,
- TErr* theErr = NULL);
+ void
+ SetFamilies(const TElemInfo& theInfo,
+ EModeAcces theMode,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
+ TErr* theErr = NULL);
- //----------------------------------------------------------------------------
- //! Read number of nodes in defined MED Mesh
+ //! Read number of nodes in MED Mesh
virtual
TInt
GetNbNodes(const TMeshInfo& theMeshInfo,
- TErr* theErr = NULL) = 0;
-
+ TErr* theErr = NULL);
+
virtual
TInt
GetNbNodes(const TMeshInfo& theMeshInfo,
ETable theTable,
- TErr* theErr = NULL)
- {
- return 0;
- }
+ TErr* theErr = NULL);
- //! Read a MEDWrapper MED Nodes representation from defined MED file
+ //! Read a MEDWrapper MED Nodes representation from the MED file
virtual
void
GetNodeInfo(TNodeInfo& theInfo,
- TErr* theErr = NULL) = 0;
+ TErr* theErr = NULL);
- //! Write the MEDWrapper MED Nodes representation into defined MED file
- virtual
+ //! Write the MEDWrapper MED Nodes representation into the MED file
+ virtual
void
SetNodeInfo(const TNodeInfo& theInfo,
- TErr* theErr = NULL) = 0;
-
- //! Creates a MEDWrapper MED Nodes representation
- virtual
- PElemInfo
- CrElemInfo(const PMeshInfo& theMeshInfo,
- TInt theNbElem,
- EBooleen theIsElemNum = eVRAI,
- EBooleen theIsElemNames = eVRAI)
- {
- return PElemInfo();
- }
+ TErr* theErr = NULL);
- //! Creates a MEDWrapper MED Nodes representation
- virtual
- PElemInfo
- CrElemInfo(const PMeshInfo& theMeshInfo,
- TInt theNbElem,
- const TIntVector& theFamNum,
- const TIntVector& aElemNum,
- const TStringVector& aElemNames)
- {
- return PElemInfo();
- }
+ void
+ SetNodeInfo(const MED::TNodeInfo& theInfo,
+ EModeAcces theMode,
+ TErr* theErr = NULL);
- //! Creates a MEDWrapper MED Nodes representation
+ //! Create a MEDWrapper MED Nodes representation
virtual
PNodeInfo
- CrNodeInfo(const PMeshInfo& theMeshInfo,
+ CrNodeInfo(const PMeshInfo& theMeshInfo,
TInt theNbElem,
EModeSwitch theMode = eFULL_INTERLACE,
- ERepere theSystem = eCART,
+ ERepere theSystem = eCART,
EBooleen theIsElemNum = eVRAI,
- EBooleen theIsElemNames = eVRAI) = 0;
+ EBooleen theIsElemNames = eVRAI);
- //! Creates a MEDWrapper MED Nodes representation
- virtual
+ //! Create a MEDWrapper MED Nodes representation
+ virtual
PNodeInfo
- CrNodeInfo(const PMeshInfo& theMeshInfo,
+ CrNodeInfo(const PMeshInfo& theMeshInfo,
const TFloatVector& theNodeCoords,
EModeSwitch theMode = eFULL_INTERLACE,
- ERepere theSystem = eCART,
+ ERepere theSystem = eCART,
const TStringVector& theCoordNames = TStringVector(),
const TStringVector& theCoordUnits = TStringVector(),
const TIntVector& theFamilyNums = TIntVector(),
const TIntVector& theElemNums = TIntVector(),
- const TStringVector& theElemNames = TStringVector()) = 0;
-
- //! A copy-constructor for the MEDWrapper MED Nodes representation
+ const TStringVector& theElemNames = TStringVector());
+
+ //! Copy constructor for the MEDWrapper MED Nodes representation
virtual
PNodeInfo
CrNodeInfo(const PMeshInfo& theMeshInfo,
- const PNodeInfo& theInfo) = 0;
-
- //! Read a MEDWrapper MED Nodes representation from defined MED file
+ const PNodeInfo& theInfo);
+
+ //! Get a MEDWrapper MED Nodes representation from the MED file
PNodeInfo
GetPNodeInfo(const PMeshInfo& theMeshInfo,
TErr* theErr = NULL);
-
- //----------------------------------------------------------------------------
- //! Read a MEDWrapper MED Polygones representation from defined MED file
- /*! This feature is supported only for version of 2.2 and higher */
+
+ //! Create a MEDWrapper MED Elements representation
virtual
- void
- GetPolygoneInfo(TPolygoneInfo& theInfo,
- TErr* theErr = NULL)
- {}
+ PElemInfo
+ CrElemInfo(const PMeshInfo& theMeshInfo,
+ TInt theNbElem,
+ EBooleen theIsElemNum = eVRAI,
+ EBooleen theIsElemNames = eVRAI);
- //! Write a MEDWrapper MED Polygones representation from defined MED file
- /*! This feature is supported only for version of 2.2 and higher */
+ //! Create a MEDWrapper MED Elements representation
virtual
- void
- SetPolygoneInfo(const TPolygoneInfo& theInfo,
- TErr* theErr = NULL)
- {}
+ PElemInfo
+ CrElemInfo(const PMeshInfo& theMeshInfo,
+ TInt theNbElem,
+ const TIntVector& theFamNum,
+ const TIntVector& aElemNum,
+ const TStringVector& aElemNames);
- //! Read number of MED Polygones in defined MED Mesh
- /*! This feature is supported only for version of 2.2 and higher */
+ //! Get a MEDWrapper MED Element representation from the MED file
+ PElemInfo
+ GetPElemInfo(const PMeshInfo& theMeshInfo,
+ EEntiteMaillage theEntity = eNOEUD,
+ EGeometrieElement theGeom = ePOINT1,
+ EConnectivite theConnMode = eNOD,
+ TErr* theErr = NULL);
+
+ //! Read number of MED Polygones in MED Mesh
virtual
TInt
GetNbPolygones(const TMeshInfo& theMeshInfo,
EEntiteMaillage theEntity,
EGeometrieElement theGeom,
EConnectivite theConnMode = eNOD,
- TErr* theErr = NULL)
- {
- return 0;
- }
+ TErr* theErr = NULL);
- //! Read connectivity infroamtion for the MED Polygones in defined MED Mesh
- /*! This feature is supported only for version of 2.2 and higher */
+ //! Read connectivity information for the MED Polygones in defined MED Mesh
virtual
TInt
GetPolygoneConnSize(const TMeshInfo& theMeshInfo,
EEntiteMaillage theEntity,
EGeometrieElement theGeom,
EConnectivite theConnMode = eNOD,
- TErr* theErr = NULL)
- {
- return 0;
- }
-
- //! Creates a MEDWrapper MED Polygones representation
- /*! This feature is supported only for version of 2.2 and higher */
- virtual
+ TErr* theErr = NULL);
+
+ //! Read a MEDWrapper MED Polygones representation from the MED file
+ virtual
+ void
+ GetPolygoneInfo(TPolygoneInfo& theInfo,
+ TErr* theErr = NULL);
+
+ //! Write a MEDWrapper MED Polygones representation into the MED file
+ virtual
+ void
+ SetPolygoneInfo(const TPolygoneInfo& theInfo,
+ TErr* theErr = NULL);
+
+ void
+ SetPolygoneInfo(const MED::TPolygoneInfo& theInfo,
+ EModeAcces theMode,
+ TErr* theErr = NULL);
+
+ //! Create a MEDWrapper MED Polygones representation
+ virtual
PPolygoneInfo
- CrPolygoneInfo(const PMeshInfo& theMeshInfo,
- EEntiteMaillage theEntity,
+ CrPolygoneInfo(const PMeshInfo& theMeshInfo,
+ EEntiteMaillage theEntity,
EGeometrieElement theGeom,
TInt theNbElem,
TInt theConnSize,
EConnectivite theConnMode = eNOD,
EBooleen theIsElemNum = eVRAI,
- EBooleen theIsElemNames = eVRAI)
- {
- return PPolygoneInfo();
- }
-
- //! Creates a MEDWrapper MED Polygones representation
- /*! This feature is supported only for version of 2.2 and higher */
+ EBooleen theIsElemNames = eVRAI);
+
+ //! Create a MEDWrapper MED Polygones representation
virtual
- PPolygoneInfo
- CrPolygoneInfo(const PMeshInfo& theMeshInfo,
- EEntiteMaillage theEntity,
+ PPolygoneInfo
+ CrPolygoneInfo(const PMeshInfo& theMeshInfo,
+ EEntiteMaillage theEntity,
EGeometrieElement theGeom,
const TIntVector& theIndexes,
const TIntVector& theConnectivities,
EConnectivite theConnMode = eNOD,
const TIntVector& theFamilyNums = TIntVector(),
const TIntVector& theElemNums = TIntVector(),
- const TStringVector& theElemNames = TStringVector())
- {
- return PPolygoneInfo();
- }
+ const TStringVector& theElemNames = TStringVector());
- //! A copy-constructor for the MEDWrapper MED Polygones representation
+ //! Copy constructor for the MEDWrapper MED Polygones representation
virtual
PPolygoneInfo
CrPolygoneInfo(const PMeshInfo& theMeshInfo,
- const PPolygoneInfo& theInfo)
- {
- return PPolygoneInfo();
- }
-
- //! Read a MEDWrapper MED Polygones representation from defined MED file
- /*! This feature is support only for version of 2.2 and higher */
+ const PPolygoneInfo& theInfo);
+
+ //! Get a MEDWrapper MED Polygones representation from the MED file
PPolygoneInfo
GetPPolygoneInfo(const PMeshInfo& theMeshInfo,
- EEntiteMaillage theEntity,
- EGeometrieElement theGeom,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
EConnectivite theConnMode = eNOD);
-
- //----------------------------------------------------------------------------
- //! Read a MEDWrapper MED Polyedres representation from defined MED file
- /*! This feature is support only for version of 2.2 and higher */
- virtual
- void
- GetPolyedreInfo(TPolyedreInfo& theInfo,
- TErr* theErr = NULL)
- {}
- //! Write a MEDWrapper MED Polyedres representation from defined MED file
- /*! This feature is support only for version of 2.2 and higher */
- virtual
- void
- SetPolyedreInfo(const TPolyedreInfo& theInfo,
- TErr* theErr = NULL)
- {}
-
- //! Read number of MED Polyedres in defined MED Mesh
- /*! This feature is support only for version of 2.2 and higher */
+ //! Read number of MED Polyedres in MED Mesh
virtual
TInt
GetNbPolyedres(const TMeshInfo& theMeshInfo,
EEntiteMaillage theEntity,
EGeometrieElement theGeom,
EConnectivite theConnMode = eNOD,
- TErr* theErr = NULL)
- {
- return 0;
- }
+ TErr* theErr = NULL);
- //! Read connectivity infroamtion for the MED Polyedres in defined MED Mesh
- /*! This feature is support only for version of 2.2 and higher */
- virtual
+ //! Read connectivity information for the MED Polyedres in MED Mesh
+ virtual
void
GetPolyedreConnSize(const TMeshInfo& theMeshInfo,
TInt& theNbFaces,
TInt& theConnSize,
EConnectivite theConnMode = eNOD,
- TErr* theErr = NULL)
- {
- theNbFaces = theConnSize = 0;
- }
-
+ TErr* theErr = NULL);
+
+ //! Read a MEDWrapper MED Polyedres representation from the MED file
+ virtual
+ void
+ GetPolyedreInfo(TPolyedreInfo& theInfo,
+ TErr* theErr = NULL);
+
+ //! Write a MEDWrapper MED Polyedres representation into the MED file
+ virtual
+ void
+ SetPolyedreInfo(const TPolyedreInfo& theInfo,
+ TErr* theErr = NULL);
+
+ void
+ SetPolyedreInfo(const MED::TPolyedreInfo& theInfo,
+ EModeAcces theMode,
+ TErr* theErr = NULL);
+
+ //! Create a MEDWrapper MED Polyedres representation
virtual
PPolyedreInfo
- CrPolyedreInfo(const PMeshInfo& theMeshInfo,
- EEntiteMaillage theEntity,
+ CrPolyedreInfo(const PMeshInfo& theMeshInfo,
+ EEntiteMaillage theEntity,
EGeometrieElement theGeom,
TInt theNbElem,
TInt theNbFaces,
TInt theConnSize,
EConnectivite theConnMode = eNOD,
EBooleen theIsElemNum = eVRAI,
- EBooleen theIsElemNames = eVRAI)
- {
- return PPolyedreInfo();
- }
-
- //! Creates a MEDWrapper MED Polyedres representation
- /*! This feature is support only for version of 2.2 and higher */
+ EBooleen theIsElemNames = eVRAI);
+
+ //! Create a MEDWrapper MED Polyedres representation
virtual
PPolyedreInfo
- CrPolyedreInfo(const PMeshInfo& theMeshInfo,
- EEntiteMaillage theEntity,
+ CrPolyedreInfo(const PMeshInfo& theMeshInfo,
+ EEntiteMaillage theEntity,
EGeometrieElement theGeom,
const TIntVector& theIndexes,
const TIntVector& theFaces,
EConnectivite theConnMode = eNOD,
const TIntVector& theFamilyNums = TIntVector(),
const TIntVector& theElemNums = TIntVector(),
- const TStringVector& theElemNames = TStringVector())
- {
- return PPolyedreInfo();
- }
+ const TStringVector& theElemNames = TStringVector());
- //! A copy-constructor for the MEDWrapper MED Polyedres representation
+ //! Copy constructor for the MEDWrapper MED Polyedres representation
virtual
PPolyedreInfo
CrPolyedreInfo(const PMeshInfo& theMeshInfo,
- const PPolyedreInfo& theInfo)
- {
- return PPolyedreInfo();
- }
-
- //! Read a MEDWrapper MED Polyedres representation from defined MED file
- /*! This feature is support only for version of 2.2 and higher */
+ const PPolyedreInfo& theInfo);
+
+ //! Get a MEDWrapper MED Polyedres representation from the MED file
PPolyedreInfo
GetPPolyedreInfo(const PMeshInfo& theMeshInfo,
- EEntiteMaillage theEntity,
- EGeometrieElement theGeom,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
EConnectivite theConnMode = eNOD);
-
- //----------------------------------------------------------------------------
- //! Get TEntityInfo which contains brief information about existing cells and their destribution among MED ENTITIES
+
+ //! Get TEntityInfo which contains brief information about existing cells
+ // and their destribution among MED ENTITIES
virtual
TEntityInfo
GetEntityInfo(const TMeshInfo& theMeshInfo,
EConnectivite theConnMode = eNOD,
- TErr* theErr = NULL) = 0;
-
- //! Read number of cells for defined MED Mesh, ENTITY and geometrical type with define mode of connectivity
+ TErr* theErr = NULL);
+
+ //! Read number of cells for defined MED Mesh, ENTITY and geometrical type with given connectivity mode
virtual
TInt
- GetNbCells(const TMeshInfo& theMeshInfo,
- EEntiteMaillage theEntity,
- EGeometrieElement theGeom,
+ GetNbCells(const TMeshInfo& theMeshInfo,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
EConnectivite theConnMode = eNOD,
- TErr* theErr = NULL) = 0;
-
- //! Read a MEDWrapper MED Cells representation from defined MED file
+ TErr* theErr = NULL);
+
+ //! Read a MEDWrapper MED Cells representation from the MED file
virtual
void
GetCellInfo(TCellInfo& theInfo,
- TErr* theErr = NULL) = 0;
-
- //! Write the MEDWrapper MED Cells representation into defined MED file
- virtual
+ TErr* theErr = NULL);
+
+ //! Write the MEDWrapper MED Cells representation into the MED file
+ virtual
void
SetCellInfo(const TCellInfo& theInfo,
- TErr* theErr = NULL) = 0;
-
- //! Creates a MEDWrapper MED Cells representation
+ TErr* theErr = NULL);
+
+ void
+ SetCellInfo(const MED::TCellInfo& theInfo,
+ EModeAcces theMode,
+ TErr* theErr = NULL);
+
+ //! Create a MEDWrapper MED Cells representation
virtual
PCellInfo
- CrCellInfo(const PMeshInfo& theMeshInfo,
- EEntiteMaillage theEntity,
+ CrCellInfo(const PMeshInfo& theMeshInfo,
+ EEntiteMaillage theEntity,
EGeometrieElement theGeom,
TInt theNbElem,
EConnectivite theConnMode = eNOD,
EBooleen theIsElemNum = eVRAI,
EBooleen theIsElemNames = eVRAI,
- EModeSwitch theMode = eFULL_INTERLACE) = 0;
-
- //! Creates a MEDWrapper MED Cells representation
+ EModeSwitch theMode = eFULL_INTERLACE);
+
+ //! Create a MEDWrapper MED Cells representation
virtual
PCellInfo
- CrCellInfo(const PMeshInfo& theMeshInfo,
- EEntiteMaillage theEntity,
+ CrCellInfo(const PMeshInfo& theMeshInfo,
+ EEntiteMaillage theEntity,
EGeometrieElement theGeom,
const TIntVector& theConnectivities,
EConnectivite theConnMode = eNOD,
const TIntVector& theFamilyNums = TIntVector(),
const TIntVector& theElemNums = TIntVector(),
const TStringVector& theElemNames = TStringVector(),
- EModeSwitch theMode = eFULL_INTERLACE) = 0;
-
- //! A copy-constructor for the MEDWrapper MED Cells representation
+ EModeSwitch theMode = eFULL_INTERLACE);
+
+ //! Copy constructor for the MEDWrapper MED Cells representation
virtual
PCellInfo
CrCellInfo(const PMeshInfo& theMeshInfo,
- const PCellInfo& theInfo) = 0;
-
- //! Read a MEDWrapper MED Cells representation from defined MED file
+ const PCellInfo& theInfo);
+
+ //! Get a MEDWrapper MED Cells representation from the MED file
PCellInfo
GetPCellInfo(const PMeshInfo& theMeshInfo,
- EEntiteMaillage theEntity,
- EGeometrieElement theGeom,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
EConnectivite theConnMode = eNOD,
TErr* theErr = NULL);
- //----------------------------------------------------------------------------
+ //! Read geom type of MED_BALL structural element
+ EGeometrieElement
+ GetBallGeom(const TMeshInfo& theMeshInfo);
+
//! Read number of balls in the Mesh
/*! This feature is supported since version 3.0 */
virtual
TInt
- GetNbBalls(const TMeshInfo& theMeshInfo)
- {
- return 0;
- }
+ GetNbBalls(const TMeshInfo& theMeshInfo);
- //! Read a MEDWrapped representation of MED_BALL from the MED file
+ //! Read a MEDWrapper representation of MED_BALL from the MED file
/*! This feature is supported since version 3.0 */
virtual
void
GetBallInfo(TBallInfo& theInfo,
- TErr* theErr = NULL)
- {}
+ TErr* theErr = NULL);
- //! Write a MEDWrapped representation of MED_BALL to the MED file
+ //! Write a MEDWrapper representation of MED_BALL into the MED file
/*! This feature is supported since version 3.0 */
virtual
void
SetBallInfo(const TBallInfo& theInfo,
- TErr* theErr = NULL)
- {}
+ TErr* theErr = NULL);
+
+ void
+ SetBallInfo(const TBallInfo& theInfo,
+ EModeAcces theMode,
+ TErr* theErr);
- //! Creates a MEDWrapper MED Balls representation
+ //! Create a MEDWrapper MED Balls representation
/*! This feature is supported since version 3.0 */
- virtual
+ virtual
PBallInfo
- CrBallInfo(const PMeshInfo& theMeshInfo,
- TInt theNbBalls,
- EBooleen theIsElemNum = eVRAI)
- {
- return PBallInfo();
- }
+ CrBallInfo(const PMeshInfo& theMeshInfo,
+ TInt theNbBalls,
+ EBooleen theIsElemNum = eVRAI);
- //! Creates a MEDWrapper MED Balls representation
+ //! Create a MEDWrapper MED Balls representation
/*! This feature is supported since version 3.0 */
virtual
- PBallInfo
- CrBallInfo(const PMeshInfo& theMeshInfo,
+ PBallInfo
+ CrBallInfo(const PMeshInfo& theMeshInfo,
const TIntVector& theNodes,
- TFloatVector& theDiameters,
+ TFloatVector& theDiameters,
const TIntVector& theFamilyNums = TIntVector(),
- const TIntVector& theElemNums = TIntVector())
- {
- return PBallInfo();
- }
+ const TIntVector& theElemNums = TIntVector());
- //! A copy-constructor for the MEDWrapped MED Balls representation
+ //! Copy constructor for the MEDWrapper MED Balls representation
+ /*! This feature is supported since version 3.0 */
virtual
PBallInfo
CrBallInfo(const PMeshInfo& theMeshInfo,
- const PBallInfo& theInfo)
- {
- return PBallInfo();
- }
-
- //! Read a MEDWrapped MED Balls representation from defined MED file
+ const PBallInfo& theInfo);
+
+ //! Get a MEDWrapper MED Balls representation from the MED file
/*! This feature is supported since version 3.0 */
virtual
PBallInfo
GetPBallInfo(const PMeshInfo& theMeshInfo);
- //----------------------------------------------------------------------------
- //! Read number of MED FIELDS in defined MED Mesh
- virtual
+ //! Read number of MED FIELDS in the MED Mesh
+ virtual
TInt
- GetNbFields(TErr* theErr = NULL) = 0;
-
- //! Read number of components for the defined MED FIELD by its order number
+ GetNbFields(TErr* theErr = NULL);
+
+ //! Read number of components for the MED FIELD by its order number
virtual
TInt
GetNbComp(TInt theFieldId,
- TErr* theErr = NULL) = 0;
-
- //! Read MEDWrapper MED FIELD representation by its order number
- virtual
+ TErr* theErr = NULL);
+
+ //! Read MEDWrapper MED FIELD representation from the MED file by its order number
+ virtual
void
- GetFieldInfo(TInt theFieldId,
+ GetFieldInfo(TInt theFieldId,
TFieldInfo& theInfo,
- TErr* theErr = NULL) = 0;
+ TErr* theErr = NULL);
- //! Write MEDWrapper MED FIELD representation into defined MED file
- virtual
+ //! Write MEDWrapper MED FIELD representation into the MED file
+ virtual
void
SetFieldInfo(const TFieldInfo& theInfo,
- TErr* theErr = NULL) = 0;
-
- //! Creates a MEDWrapper MED FIELD representation
- virtual
+ TErr* theErr = NULL);
+
+ void
+ SetFieldInfo(const MED::TFieldInfo& theInfo,
+ EModeAcces theMode,
+ TErr* theErr = NULL);
+
+ //! Create a MEDWrapper MED FIELD representation
+ virtual
PFieldInfo
- CrFieldInfo(const PMeshInfo& theMeshInfo,
+ CrFieldInfo(const PMeshInfo& theMeshInfo,
TInt theNbComp = 0,
ETypeChamp theType = eFLOAT64,
const std::string& theValue = "",
EBooleen theIsLocal = eVRAI,
- TInt theNbRef = 1) = 0;
+ TInt theNbRef = 1);
- //! A copy-constructor for the MEDWrapper MED FIELD representation
- virtual
+ //! Copy constructor for the MEDWrapper MED FIELD representation
+ virtual
PFieldInfo
CrFieldInfo(const PMeshInfo& theMeshInfo,
- const PFieldInfo& theInfo) = 0;
-
- //! Read a MEDWrapper MED FIELD representation from defined MED file
+ const PFieldInfo& theInfo);
+
+ //! Get a MEDWrapper MED FIELD representation from the MED file
PFieldInfo
- GetPFieldInfo(const PMeshInfo& theMeshInfo,
+ GetPFieldInfo(const PMeshInfo& theMeshInfo,
TInt theId,
TErr* theErr = NULL);
- //----------------------------------------------------------------------------
- //! Read number of MED GAUSS in defined MED Mesh
- /*! This feature is support only for version of 2.2 and higher */
- virtual
+ //! Read number of MED GAUSS in the MED Mesh
+ virtual
TInt
- GetNbGauss(TErr* theErr = NULL)
- {
- return TInt();
- }
+ GetNbGauss(TErr* theErr = NULL);
- //! Read brief MED GAUSS information by its order number from defined MED Mesh
- /*! This feature is support only for version of 2.2 and higher */
- virtual
+ //! Read brief MED GAUSS information by its order number from the MED file
+ virtual
TGaussInfo::TInfo
- GetGaussPreInfo(TInt theId,
- TErr* theErr = NULL)
- {
- return TGaussInfo::TInfo( TGaussInfo::TKey(ePOINT1,""),0 );
- }
-
- //! Read a MEDWrapper MED GAUSS representation by its order number from defined MED file
- /*! This feature is support only for version of 2.2 and higher */
- virtual
+ GetGaussPreInfo(TInt theId,
+ TErr* theErr = NULL);
+
+ //! Read a MEDWrapper MED GAUSS representation by its order number from the MED file
+ virtual
void
- GetGaussInfo(TInt theId,
+ GetGaussInfo(TInt theId,
TGaussInfo& theInfo,
- TErr* theErr = NULL)
- {}
+ TErr* theErr = NULL);
- //! Creates a MEDWrapper MED GAUSS representation
- /*! This feature is support only for version of 2.2 and higher */
+ //! Create a MEDWrapper MED GAUSS representation
virtual
PGaussInfo
CrGaussInfo(const TGaussInfo::TInfo& theInfo,
- EModeSwitch theMode = eFULL_INTERLACE) = 0;
+ EModeSwitch theMode = eFULL_INTERLACE);
- //----------------------------------------------------------------------------
- //! Read number of MED TIMESTAMPS in defined MED Mesh
+ //! Read number of MED TIMESTAMPS in the MED Mesh
/*!
- By the way some additional information can be obtained:
- - to what MED ENTITY the MED TIMESTAMP conntected to;
- - on what geometrical types the MED TIMESTAMP defined to.
+ In addition, the following information can be obtained:
+ - what MED ENTITY the MED TIMESTAMP is connected to;
+ - what geometrical types the MED TIMESTAMP is defined on.
*/
- virtual
+ virtual
TInt
- GetNbTimeStamps(const TFieldInfo& theInfo,
+ GetNbTimeStamps(const TFieldInfo& theInfo,
const TEntityInfo& theEntityInfo,
EEntiteMaillage& theEntity,
TGeom2Size& theGeom2Size,
- TErr* theErr = NULL) = 0;
-
- //! Read MEDWrapper MED TIMESTAMP representation by its order number
- virtual
+ TErr* theErr = NULL);
+
+ //! Read MEDWrapper MED TIMESTAMP representation by its order number from the MED file
+ virtual
void
- GetTimeStampInfo(TInt theTimeStampId,
+ GetTimeStampInfo(TInt theTimeStampId,
TTimeStampInfo& theInfo,
- TErr* theErr = NULL) = 0;
+ TErr* theErr = NULL);
- //! Creates a MEDWrapper MED TIMESTAMP representation
- virtual
+ //! Create a MEDWrapper MED TIMESTAMP representation
+ virtual
PTimeStampInfo
- CrTimeStampInfo(const PFieldInfo& theFieldInfo,
+ CrTimeStampInfo(const PFieldInfo& theFieldInfo,
EEntiteMaillage theEntity,
const TGeom2Size& theGeom2Size,
const TGeom2NbGauss& theGeom2NbGauss = TGeom2NbGauss(),
TInt theNumOrd = 0,
TFloat theDt = 0,
const std::string& theUnitDt = "",
- const TGeom2Gauss& theGeom2Gauss = TGeom2Gauss()) = 0;
+ const TGeom2Gauss& theGeom2Gauss = TGeom2Gauss());
- //! A copy-constructor for the MEDWrapper MED TIMESTAMP representation
- virtual
- PTimeStampInfo
+ //! Copy constructor for the MEDWrapper MED TIMESTAMP representation
+ virtual
+ PTimeStampInfo
CrTimeStampInfo(const PFieldInfo& theFieldInfo,
- const PTimeStampInfo& theInfo) = 0;
-
- //! Read MEDWrapper MED TIMESTAMP representation by its order number
+ const PTimeStampInfo& theInfo);
+
+ //! Get MEDWrapper MED TIMESTAMP representation from the MED file
PTimeStampInfo
GetPTimeStampInfo(const PFieldInfo& theFieldInfo,
EEntiteMaillage theEntity,
TInt theId,
TErr* theErr = NULL);
- //----------------------------------------------------------------------------
- //! Read number of MED PROFILES in defined MED Mesh
- virtual
+ //! Read number of MED PROFILES in the MED file
+ virtual
TInt
- GetNbProfiles(TErr* theErr = NULL) = 0;
+ GetNbProfiles(TErr* theErr = NULL);
- //! Read brief MED PROFILE information by its order number from defined MED Mesh
- virtual
+ //! Read brief MED PROFILE information by its order number from the MED file
+ virtual
TProfileInfo::TInfo
- GetProfilePreInfo(TInt theId,
- TErr* theErr = NULL) = 0;
+ GetProfilePreInfo(TInt theId,
+ TErr* theErr = NULL);
- //! Read a MEDWrapper MED PROFILE representation by its order number from defined MED file
- virtual
+ //! Read a MEDWrapper MED PROFILE representation by its order number from the MED file
+ virtual
void
- GetProfileInfo(TInt theId,
+ GetProfileInfo(TInt theId,
TProfileInfo& theInfo,
- TErr* theErr = NULL) = 0;
+ TErr* theErr = NULL);
- //! Creates a MEDWrapper MED PROFILE representation
+ //! Write a MEDWrapper MED PROFILE representation into the MED file
virtual
- PProfileInfo
- CrProfileInfo(const TProfileInfo::TInfo& theInfo,
- EModeProfil theMode = eCOMPACT) = 0;
+ void
+ SetProfileInfo(const TProfileInfo& theInfo,
+ TErr* theErr = NULL);
- //! Write a MEDWrapper MED PROFILE representation
- virtual
void
SetProfileInfo(const TProfileInfo& theInfo,
- TErr* theErr = NULL) = 0;
+ EModeAcces theMode,
+ TErr* theErr = NULL);
- //! Read a MEDWrapper MED PROFILE representation by its order number from defined MED file
+ //! Create a MEDWrapper MED PROFILE representation
+ virtual
+ PProfileInfo
+ CrProfileInfo(const TProfileInfo::TInfo& theInfo,
+ EModeProfil theMode = eCOMPACT);
+
+ //! Get a MEDWrapper MED PROFILE representation from the MED file
PProfileInfo
GetPProfileInfo(TInt theId,
EModeProfil theMode = eCOMPACT,
TErr* theErr = NULL);
- //----------------------------------------------------------------------------
- //! Read the values for MEDWrapper MED TIEMSTAMP from defined MED file
- virtual
+ //! Read the values for MEDWrapper MED TIMESTAMP from the MED file
+ virtual
void
GetTimeStampValue(const PTimeStampValueBase& theTimeStampValue,
const TMKey2Profile& theMKey2Profile,
const TKey2Gauss& theKey2Gauss,
- TErr* theErr = NULL) = 0;
-
- //! Write the values for MEDWrapper MED TIEMSTAMP to defined MED file
- virtual
+ TErr* theErr = NULL);
+
+ //! Write the values for MEDWrapper MED TIMESTAMP into the MED file
+ virtual
void
SetTimeStampValue(const PTimeStampValueBase& theTimeStampValue,
- TErr* theErr = NULL) = 0;
-
- //! Creates the values for MEDWrapper MED TIEMSTAMP representation
+ TErr* theErr = NULL);
+
+ void
+ SetTimeStampValue(const PTimeStampValueBase& theTimeStampValue,
+ EModeAcces theMode,
+ TErr* theErr = NULL);
+
+ //! Create the values for MEDWrapper MED TIMESTAMP representation
virtual
PTimeStampValueBase
CrTimeStampValue(const PTimeStampInfo& theTimeStampInfo,
ETypeChamp theTypeChamp,
const TGeom2Profile& theGeom2Profile = TGeom2Profile(),
- EModeSwitch theMode = eFULL_INTERLACE) = 0;
+ EModeSwitch theMode = eFULL_INTERLACE);
- //! Creates the values for MEDWrapper MED TIEMSTAMP representation
+ //! Create the values for MEDWrapper MED TIMESTAMP representation
virtual
PTimeStampValueBase
CrTimeStampValue(const PTimeStampInfo& theTimeStampInfo,
const TGeom2Profile& theGeom2Profile = TGeom2Profile(),
EModeSwitch theMode = eFULL_INTERLACE);
- //! A copy-constructor for the values for MEDWrapper MED TIEMSTAMP representation
- virtual
+ //! Copy constructor for the values for MEDWrapper MED TIMESTAMP representation
+ virtual
PTimeStampValueBase
CrTimeStampValue(const PTimeStampInfo& theTimeStampInfo,
const PTimeStampValueBase& theInfo,
- ETypeChamp theTypeChamp) = 0;
-
- //! A copy-constructor for the values for MEDWrapper MED TIEMSTAMP representation
- virtual
+ ETypeChamp theTypeChamp);
+
+ //! Copy constructor for the values for MEDWrapper MED TIMESTAMP representation
+ virtual
PTimeStampValueBase
CrTimeStampValue(const PTimeStampInfo& theTimeStampInfo,
const PTimeStampValueBase& theInfo);
-
- //! Read the values for MEDWrapper MED TIEMSTAMP from defined MED file
+
+ //! Get the values for MEDWrapper MED TIMESTAMP from the MED file
PTimeStampValueBase
GetPTimeStampValue(const PTimeStampInfo& theTimeStampInfo,
const TMKey2Profile& theMKey2Profile,
const TKey2Gauss& theKey2Gauss,
TErr* theErr = NULL);
-
- //----------------------------------------------------------------------------
- // Backward compatibility declarations
- //! Read the values for MEDWrapper MED TIEMSTAMP from defined MED file
- virtual
+
+ //
+ // Backward compatibility declarations
+ //
+
+ //! Read the values for MEDWrapper MED TIMESTAMP from the MED file
+ virtual
void
GetTimeStampVal(const PTimeStampVal& theVal,
const TMKey2Profile& theMKey2Profile,
const TKey2Gauss& theKey2Gauss,
TErr* theErr = NULL);
-
- //! Write the values for MEDWrapper MED TIEMSTAMP to defined MED file
- virtual
+
+ //! Write the values for MEDWrapper MED TIMESTAMP into the MED file
+ virtual
void
SetTimeStamp(const PTimeStampVal& theVal,
TErr* theErr = NULL);
-
- //! Creates the values for MEDWrapper MED TIEMSTAMP representation
+
+ //! Create the values for MEDWrapper MED TIMESTAMP representation
virtual
PTimeStampVal
CrTimeStampVal(const PTimeStampInfo& theTimeStampInfo,
const TGeom2Profile& theGeom2Profile = TGeom2Profile(),
EModeSwitch theMode = eFULL_INTERLACE);
- //! A copy-constructor for the values for MEDWrapper MED TIEMSTAMP representation
- virtual
+ //! Copy constructor for the values for MEDWrapper MED TIMESTAMP representation
+ virtual
PTimeStampVal
CrTimeStampVal(const PTimeStampInfo& theTimeStampInfo,
const PTimeStampVal& theInfo);
-
- //! Read the values for MEDWrapper MED TIEMSTAMP from defined MED file
+
+ //! Get the values for MEDWrapper MED TIMESTAMP from the MED file
PTimeStampVal
GetPTimeStampVal(const PTimeStampInfo& theTimeStampInfo,
const TMKey2Profile& theMKey2Profile,
const TKey2Gauss& theKey2Gauss,
TErr* theErr = NULL);
- //----------------------------------------------------------------------------
- //! Read a MEDWrapper MED Grille representation from defined MED file
- /*! This feature is support only for version of 2.2 and higher */
+ //! Read a MEDWrapper MED Grille representation from the MED file
PGrilleInfo
GetPGrilleInfo(const PMeshInfo& theMeshInfo);
- //! Read a MEDWrapper MED Grille representation from defined MED file
- /*! This feature is support only for version of 2.2 and higher */
+ //! Read a MEDWrapper MED Grille representation from the MED file
PGrilleInfo
GetPGrilleInfo(const PMeshInfo& theMeshInfo,
const PGrilleInfo& theInfo);
- //! Read a MEDWrapper MED Grille representation from defined MED file
- /*! This feature is support only for version of 2.2 and higher */
+ //! Read a MEDWrapper MED Grille representation from the MED file
virtual
void
GetGrilleInfo(TGrilleInfo& theInfo,
- TErr* theErr = NULL)
- {}
+ TErr* theErr = NULL);
- //! Write the MEDWrapper MED Grille representation into defined MED file
- /*! This feature is support only for version of 2.2 and higher */
- virtual
+ //! Write the MEDWrapper MED Grille representation into the MED file
+ virtual
void
SetGrilleInfo(const TGrilleInfo& theInfo,
- TErr* theErr = NULL)
- {}
+ TErr* theErr = NULL);
+
+ void
+ SetGrilleInfo(const MED::TGrilleInfo& theGrilleInfo,
+ EModeAcces theMode,
+ TErr* theErr = NULL);
- /*! This feature is support only for version of 2.2 and higher */
+ //! Create the MEDWrapper MED Grille representation
virtual
PGrilleInfo
CrGrilleInfo(const PMeshInfo& theMeshInfo,
- const PGrilleInfo& theGrilleInfo)
- {
- return PGrilleInfo();
- }
+ const PGrilleInfo& theGrilleInfo);
- /*! This feature is support only for version of 2.2 and higher */
+ //! Create the MEDWrapper MED Grille representation
virtual
PGrilleInfo
- CrGrilleInfo(const PMeshInfo& theMeshInfo)
- {
- return PGrilleInfo();
- }
-
- /*! This feature is support only for version of 2.2 and higher */
+ CrGrilleInfo(const PMeshInfo& theMeshInfo);
+
+ //! Create the MEDWrapper MED Grille representation
virtual
PGrilleInfo
CrGrilleInfo(const PMeshInfo& theMeshInfo,
- const EGrilleType& type)
- {
- return PGrilleInfo();
- }
-
- /*! This feature is support only for version of 2.2 and higher */
+ const EGrilleType& type);
+
+ //! Create the MEDWrapper MED Grille representation
virtual
PGrilleInfo
CrGrilleInfo(const PMeshInfo& theMeshInfo,
const EGrilleType& type,
- const TInt& nbNodes)
- {
- return PGrilleInfo();
- }
+ const TInt& nbNodes);
- /*! This feature is support only for version of 2.2 and higher */
+ //! Create the MEDWrapper MED Grille representation
virtual
PGrilleInfo
CrGrilleInfo(const PMeshInfo& theMeshInfo,
const EGrilleType& type,
- const MED::TIntVector& nbNodeVec)
- {
- return PGrilleInfo();
- }
+ const MED::TIntVector& nbNodeVec);
- /*! This feature is support only for version of 2.2 and higher */
+ //! Get a MEDWrapper MED Grille type
virtual
void
GetGrilleType(const TMeshInfo& theMeshInfo,
EGrilleType& type,
- TErr* theErr = NULL)
- {
- }
+ TErr* theErr = NULL);
+
+ //! Get a MEDWrapper MED Grille structure
+ void
+ GetGrilleStruct(const MED::TMeshInfo& theMeshInfo,
+ TIntVector& theStruct,
+ TErr* theErr = NULL);
+
+ protected:
+ PFile myFile;
};
//----------------------------------------------------------------------------
- //! This class provide thread-safety for MEDWrapper interaction
+ typedef SharedPtr<TWrapper> PWrapper;
+
+ //----------------------------------------------------------------------------
+ //! This class provides thread-safety for MEDWrapper interaction
class MEDWRAPPER_EXPORT TLockProxy
{
TLockProxy& operator=(const TLockProxy& );
public:
TLockProxy(TWrapper* theWrapper);
-
~TLockProxy();
- TWrapper * operator-> () const;
+ TWrapper* operator->() const;
};
//----------------------------------------------------------------------------
- //! To specialize the SharedPtr for TWrapper
- template<>
+ //! Specialization of SharedPtr for TWrapper
+ template<>
class MEDWRAPPER_EXPORT SharedPtr<TWrapper>: public boost::shared_ptr<TWrapper>
{
public:
{}
template<class Y>
- explicit SharedPtr(Y * p):
- boost::shared_ptr<TWrapper>(p)
+ explicit SharedPtr(Y* p):
+ boost::shared_ptr<TWrapper>(p)
{}
template<class Y>
- SharedPtr(SharedPtr<Y> const & r):
+ SharedPtr(const SharedPtr<Y>& r):
boost::shared_ptr<TWrapper>(boost::dynamic_pointer_cast<TWrapper,Y>(r))
{}
template<class Y>
- SharedPtr&
- operator=(SharedPtr<Y> const & r)
+ SharedPtr&
+ operator=(const SharedPtr<Y>& r)
{
SharedPtr<TWrapper>(r).swap(*this);
return *this;
}
- template<class Y>
- SharedPtr&
- operator()(Y * p) // Y must be complete
+ template<class Y>
+ SharedPtr&
+ operator()(Y* p) // Y must be complete
{
return operator=<Y>(SharedPtr<Y>(p));
}
- template<class Y>
- SharedPtr&
- operator()(SharedPtr<Y> const & r) // Y must be complete
+ template<class Y>
+ SharedPtr&
+ operator()(const SharedPtr<Y>& r) // Y must be complete
{
return operator=<Y>(SharedPtr<Y>(r));
}
- TLockProxy operator-> () const // never throws
+ TLockProxy
+ operator->() const // never throws
{
return TLockProxy(this->get());
}
-
+
protected:
- operator const TWrapper& () const;
+ operator const TWrapper&() const;
- operator TWrapper& ();
+ operator TWrapper&();
- TWrapper& operator* () const;
+ TWrapper&
+ operator*() const;
- TWrapper * get() const // never throws
+ TWrapper*
+ get() const // never throws
{
return boost::shared_ptr<TWrapper>::get();
}
};
-
- //----------------------------------------------------------------------------
- typedef SharedPtr<TWrapper> PWrapper;
}
#endif // MED_Wrapper_HeaderFile
//
#include "SMESHGUI_FileInfoDlg.h"
-#include "MED_Common.hxx"
-
#include <QGridLayout>
#include <QLabel>
#include <QLineEdit>