# BOOST Library
BOOST_CPPFLAGS = @BOOST_CPPFLAGS@
+BOOST_LIBS = @BOOST_LIBS@
# JAVA
AC_SUBST(BOOST_CPPFLAGS)
BOOST_CPPFLAGS=""
+
+AC_SUBST(BOOST_LIBS)
+BOOST_LIBS=""
+
boost_ok=no
if test -z ${BOOSTDIR}; then
fi
else
AC_MSG_RESULT(\$BOOSTDIR = ${BOOSTDIR})
- AC_CHECKING(for boost/shared_ptr.hpp header file)
+
dnl BOOST headers
+ AC_CHECKING(for boost/shared_ptr.hpp header file)
CPPFLAGS_old="${CPPFLAGS}"
- BOOST_CPPFLAGS="-I${BOOSTDIR}"
+ BOOST_CPPFLAGS="-I${BOOSTDIR}/include"
CPPFLAGS="${CPPFLAGS} ${BOOST_CPPFLAGS}"
AC_CHECK_HEADER(boost/shared_ptr.hpp,boost_ok=yes,boost_ok=no)
CPPFLAGS="${CPPFLAGS_old}"
+
+ if test "x${boost_ok}" = "xyes" ; then
+ AC_MSG_RESULT(\$BOOST_CPPFLAGS = ${BOOST_CPPFLAGS})
+ dnl BOOST libs
+ AC_CHECKING(for libboost_thread-mt.so library file)
+ AC_CHECK_FILE(${BOOSTDIR}/lib/libboost_thread-mt.so,boost_ok=yes,boost_ok=no)
+ if test "x${boost_ok}" = "xyes" ; then
+ BOOST_LIBS="-L${BOOSTDIR}/lib"
+ AC_MSG_RESULT(\$BOOST_LIBS = ${BOOST_LIBS})
+ fi
+ fi
fi
+AC_MSG_RESULT(for boost: $boost_ok)
+
AC_LANG_RESTORE
])dnl
-# Doxyfile 1.3-rc1
+# Doxyfile 1.3.7
#---------------------------------------------------------------------------
-# General configuration options
+# Project related configuration options
#---------------------------------------------------------------------------
PROJECT_NAME = "SALOME - MED - v.3.1.0"
PROJECT_NUMBER = id#1.1
OUTPUT_DIRECTORY = ../
+CREATE_SUBDIRS = NO
OUTPUT_LANGUAGE = English
+USE_WINDOWS_ENCODING = NO
+BRIEF_MEMBER_DESC = YES
+REPEAT_BRIEF = YES
+ABBREVIATE_BRIEF =
+ALWAYS_DETAILED_SEC = NO
+INLINE_INHERITED_MEMB = NO
+FULL_PATH_NAMES = NO
+STRIP_FROM_PATH =
+STRIP_FROM_INC_PATH =
+SHORT_NAMES = NO
+JAVADOC_AUTOBRIEF = YES
+MULTILINE_CPP_IS_BRIEF = NO
+DETAILS_AT_TOP = NO
+INHERIT_DOCS = NO
+DISTRIBUTE_GROUP_DOC = NO
+TAB_SIZE = 5
+ALIASES =
+OPTIMIZE_OUTPUT_FOR_C = YES
+OPTIMIZE_OUTPUT_JAVA = YES
+SUBGROUPING = YES
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
EXTRACT_ALL = YES
EXTRACT_PRIVATE = YES
EXTRACT_STATIC = YES
EXTRACT_LOCAL_CLASSES = YES
-HIDE_UNDOC_MEMBERS = NO
-HIDE_UNDOC_CLASSES = NO
+EXTRACT_LOCAL_METHODS = NO
+HIDE_UNDOC_MEMBERS = YES
+HIDE_UNDOC_CLASSES = YES
HIDE_FRIEND_COMPOUNDS = NO
HIDE_IN_BODY_DOCS = NO
-BRIEF_MEMBER_DESC = YES
-REPEAT_BRIEF = NO
-ALWAYS_DETAILED_SEC = YES
-INLINE_INHERITED_MEMB = YES
-FULL_PATH_NAMES = NO
-STRIP_FROM_PATH =
INTERNAL_DOCS = YES
CASE_SENSE_NAMES = YES
-SHORT_NAMES = NO
HIDE_SCOPE_NAMES = NO
-VERBATIM_HEADERS = YES
SHOW_INCLUDE_FILES = YES
-JAVADOC_AUTOBRIEF = YES
-MULTILINE_CPP_IS_BRIEF = NO
-DETAILS_AT_TOP = NO
-INHERIT_DOCS = YES
INLINE_INFO = YES
SORT_MEMBER_DOCS = NO
-DISTRIBUTE_GROUP_DOC = NO
-TAB_SIZE = 5
+SORT_BRIEF_DOCS = NO
+SORT_BY_SCOPE_NAME = NO
GENERATE_TODOLIST = YES
GENERATE_TESTLIST = YES
GENERATE_BUGLIST = YES
GENERATE_DEPRECATEDLIST= YES
-ALIASES =
ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 25
-OPTIMIZE_OUTPUT_FOR_C = YES
-OPTIMIZE_OUTPUT_JAVA = YES
SHOW_USED_FILES = NO
+
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------
QUIET = NO
WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES
+WARN_IF_DOC_ERROR = YES
WARN_FORMAT = "$file:$line: $text"
WARN_LOGFILE = log.txt
+
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
-INPUT = ../../../share/salome/idl/MED.idl \
- ../../../share/salome/idl/MED_Gen.idl
-FILE_PATTERNS =
-RECURSIVE = NO
+INPUT = ../../../share/salome/src \
+ ../../../share/salome/idl
+FILE_PATTERNS = *.idl *.h *.hh *.hxx *.c *.cc *.cxx *.ixx *.jxx
+RECURSIVE = YES
EXCLUDE =
EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS =
EXAMPLE_PATH =
EXAMPLE_PATTERNS =
-EXAMPLE_RECURSIVE = NO
+EXAMPLE_RECURSIVE = YES
IMAGE_PATH = sources/
INPUT_FILTER =
FILTER_SOURCE_FILES = YES
+
#---------------------------------------------------------------------------
# configuration options related to source browsing
#---------------------------------------------------------------------------
STRIP_CODE_COMMENTS = YES
REFERENCED_BY_RELATION = NO
REFERENCES_RELATION = YES
+VERBATIM_HEADERS = YES
+
#---------------------------------------------------------------------------
# configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
ALPHABETICAL_INDEX = NO
COLS_IN_ALPHA_INDEX = 5
IGNORE_PREFIX =
+
#---------------------------------------------------------------------------
# configuration options related to the HTML output
#---------------------------------------------------------------------------
ENUM_VALUES_PER_LINE = 4
GENERATE_TREEVIEW = YES
TREEVIEW_WIDTH = 250
+
#---------------------------------------------------------------------------
# configuration options related to the LaTeX output
#---------------------------------------------------------------------------
PDF_HYPERLINKS = NO
USE_PDFLATEX = NO
LATEX_BATCHMODE = NO
+LATEX_HIDE_INDICES = NO
+
#---------------------------------------------------------------------------
# configuration options related to the RTF output
#---------------------------------------------------------------------------
RTF_HYPERLINKS = NO
RTF_STYLESHEET_FILE =
RTF_EXTENSIONS_FILE =
+
#---------------------------------------------------------------------------
# configuration options related to the man page output
#---------------------------------------------------------------------------
MAN_OUTPUT = man
MAN_EXTENSION = .3
MAN_LINKS = NO
+
#---------------------------------------------------------------------------
# configuration options related to the XML output
#---------------------------------------------------------------------------
GENERATE_XML = NO
+XML_OUTPUT = xml
XML_SCHEMA =
XML_DTD =
+XML_PROGRAMLISTING = YES
+
#---------------------------------------------------------------------------
# configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
GENERATE_AUTOGEN_DEF = NO
+
#---------------------------------------------------------------------------
# configuration options related to the Perl module output
#---------------------------------------------------------------------------
PERLMOD_LATEX = NO
PERLMOD_PRETTY = YES
PERLMOD_MAKEVAR_PREFIX =
+
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
PREDEFINED =
EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = NO
+
#---------------------------------------------------------------------------
-# Configuration::addtions related to external references
+# Configuration::additions related to external references
#---------------------------------------------------------------------------
TAGFILES =
GENERATE_TAGFILE =
ALLEXTERNALS = NO
EXTERNAL_GROUPS = YES
PERL_PATH = /usr/bin/perl
+
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
HAVE_DOT = YES
CLASS_GRAPH = YES
COLLABORATION_GRAPH = NO
+UML_LOOK = NO
TEMPLATE_RELATIONS = YES
INCLUDE_GRAPH = YES
INCLUDED_BY_GRAPH = NO
+CALL_GRAPH = NO
GRAPHICAL_HIERARCHY = YES
DOT_IMAGE_FORMAT = jpg
DOT_PATH =
DOTFILE_DIRS =
MAX_DOT_GRAPH_WIDTH = 1024
MAX_DOT_GRAPH_HEIGHT = 1200
+MAX_DOT_GRAPH_DEPTH = 0
GENERATE_LEGEND = NO
DOT_CLEANUP = YES
+
#---------------------------------------------------------------------------
-# Configuration::addtions related to the search engine
+# Configuration::additions related to the search engine
#---------------------------------------------------------------------------
SEARCHENGINE = NO
-CGI_NAME = search.cgi
-CGI_URL =
-DOC_URL =
-DOC_ABSPATH =
-BIN_ABSPATH = /usr/local/bin/
-EXT_DOC_PATHS =
CPPFLAGS+=-U_DEBUG_ $(MED2_INCLUDES) $(HDF5_INCLUDES) -I../
CXXFLAGS+=-U_DEBUG_ @CXXTMPDPTHFLAGS@
#LDFLAGS+=$(MED2_LIBS) $(HDF5_LIBS)
-LDFLAGS+=-lm $(MED2_LIBS) $(HDF5_LIBS) -lMEDWrapper_V2_1
+LDFLAGS+=-lm $(MED2_LIBS) $(HDF5_LIBS) -lmed_V2_1
#LDFLAGSFORBIN+=$(MED2_LIBS) $(HDF5_LIBS) -L../.libs -lmedmem
-LDFLAGSFORBIN+=-lm $(MED2_LIBS) $(HDF5_LIBS) -L../.libs -lmedmem -lMEDWrapper_V2_1 -lMEDWrapperBase
+LDFLAGSFORBIN+=-lm $(MED2_LIBS) $(HDF5_LIBS) -L../.libs -lmedmem -lmed_V2_1
ifeq ($(MED_WITH_KERNEL),yes)
CPPFLAGS+= -I${KERNEL_ROOT_DIR}/include/salome
# additionnal information to compil and link file
-CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome -I${BOOSTDIR}
-LDFLAGS += -lSalomeApp -lMEDMEMImpl -lmedmem -lMEDEngine -I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome -I${BOOSTDIR}
+CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome ${BOOST_CPPFLAGS}
LDFLAGS += -lSalomeApp -lMEDMEMImpl -lmedmem -lMEDEngine -L${KERNEL_ROOT_DIR}/lib/salome -L${GUI_ROOT_DIR}/lib/salome
CXXFLAGS+=@CXXTMPDPTHFLAGS@
#LDFLAGS+=$(MED2_LIBS) $(HDF5_LIBS)
# change motivated by the bug KERNEL4778.
-LDFLAGS+=$(MED2_LIBS) $(HDF5_LIBS) -lMEDWrapper_V2_1 $(STDLIB)
+LDFLAGS+=$(MED2_LIBS) $(HDF5_LIBS) -lmed_V2_1 $(STDLIB)
#LDFLAGSFORBIN+=$(MED2_LIBS) $(HDF5_LIBS)
# change motivated by the bug KERNEL4778.
-LDFLAGSFORBIN+=-lm $(MED2_LIBS) $(HDF5_LIBS) -lMEDWrapper_V2_1 -lMEDWrapperBase
+LDFLAGSFORBIN+=-lm $(MED2_LIBS) $(HDF5_LIBS) -lmed_V2_1
ifeq ($(MED_WITH_KERNEL),yes)
CPPFLAGS+= -I${KERNEL_ROOT_DIR}/include/salome
// $Header$
#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;
#endif
-namespace MED{
+namespace MED
+{
//---------------------------------------------------------------
- TElemGroup
- GetElemsByEntity(TWrapper& theWrapper,
- const PMeshInfo& theMeshInfo,
- const MED::TEntityInfo& theEntityInfo)
+ TEntity2TGeom2ElemInfo
+ GetEntity2TGeom2ElemInfo(const PWrapper& theWrapper,
+ const PMeshInfo& theMeshInfo,
+ const MED::TEntityInfo& theEntityInfo)
{
MSG(MYDEBUG,"GetElemsByEntity(...)");
- TElemGroup aGroup;
+ TEntity2TGeom2ElemInfo anEntity2TGeom2ElemInfo;
MED::TEntityInfo::const_iterator anIter = theEntityInfo.begin();
for(; anIter != theEntityInfo.end(); anIter++){
const EEntiteMaillage& anEntity = anIter->first;
- const MED::TGeom& aGeom = anIter->second;
- TElemMap& anElemMap = aGroup[anEntity];
+ const TGeom2Size& aGeom2Size = anIter->second;
+ TGeom2ElemInfo& aGeom2ElemInfo = anEntity2TGeom2ElemInfo[anEntity];
if(anEntity == eNOEUD){
- anElemMap[ePOINT1] = theWrapper.GetPNodeInfo(theMeshInfo);
+ aGeom2ElemInfo[ePOINT1] = theWrapper->GetPNodeInfo(theMeshInfo);
continue;
}
- MED::TGeom::const_iterator anGeomIter = aGeom.begin();
- for(; anGeomIter != aGeom.end(); anGeomIter++){
- const EGeometrieElement& aGeo = anGeomIter->first;
- switch(aGeo){
+ TGeom2Size::const_iterator anIter2 = aGeom2Size.begin();
+ for(; anIter2 != aGeom2Size.end(); anIter2++){
+ const EGeometrieElement& aGeom = anIter2->first;
+ switch(aGeom){
case ePOLYGONE: {
- anElemMap[ePOLYGONE] = theWrapper.GetPPolygoneInfo(theMeshInfo,anEntity,aGeo);
+ aGeom2ElemInfo[ePOLYGONE] = theWrapper->GetPPolygoneInfo(theMeshInfo,anEntity,aGeom);
break;
}
case ePOLYEDRE: {
- anElemMap[ePOLYEDRE] = theWrapper.GetPPolyedreInfo(theMeshInfo,anEntity,aGeo);
+ aGeom2ElemInfo[ePOLYEDRE] = theWrapper->GetPPolyedreInfo(theMeshInfo,anEntity,aGeom);
break;
}
default: {
- anElemMap[aGeo] = theWrapper.GetPCellInfo(theMeshInfo,anEntity,aGeo);
+ aGeom2ElemInfo[aGeom] = theWrapper->GetPCellInfo(theMeshInfo,anEntity,aGeom);
}}
}
}
ADDMSG(MYDEBUG,"\n");
- return aGroup;
+ return anEntity2TGeom2ElemInfo;
}
//---------------------------------------------------------------
- TFamilyGroup
- GetFamilies(TWrapper& theWrapper,
- const PMeshInfo& theMeshInfo)
+ TFamilyInfoSet
+ GetFamilyInfoSet(const PWrapper& theWrapper,
+ const PMeshInfo& theMeshInfo)
{
MSG(MYDEBUG,"GetFamilies(...)");
TErr anErr;
- TFamilyGroup aGroup;
- TInt aNbFam = theWrapper.GetNbFamilies(*theMeshInfo);
+ TFamilyInfoSet aFamilyInfoSet;
+ TInt aNbFam = theWrapper->GetNbFamilies(*theMeshInfo);
INITMSG(MYDEBUG,"GetNbFamilies() = "<<aNbFam<<"\n");
for(TInt iFam = 1; iFam <= aNbFam; iFam++){
- PFamilyInfo aFamilyInfo = theWrapper.GetPFamilyInfo(theMeshInfo,iFam,&anErr);
+ PFamilyInfo aFamilyInfo = theWrapper->GetPFamilyInfo(theMeshInfo,iFam,&anErr);
if(anErr >= 0)
- aGroup.insert(aFamilyInfo);
+ aFamilyInfoSet.insert(aFamilyInfo);
}
ADDMSG(MYDEBUG,"\n");
- return aGroup;
+ return aFamilyInfoSet;
}
- TGroupInfo
- GetFamiliesByGroup(const TFamilyGroup& theGroupInfo)
+ //---------------------------------------------------------------
+ TGroupInfo
+ GetGroupInfo(const TFamilyInfoSet& theFamilyInfoSet)
{
MSG(MYDEBUG,"GetFamiliesByGroup(...)");
TGroupInfo aGroup;
- TFamilyGroup::const_iterator anIter = theGroupInfo.begin();
- for(; anIter != theGroupInfo.end(); anIter++){
+ TFamilyInfoSet::const_iterator anIter = theFamilyInfoSet.begin();
+ for(; anIter != theFamilyInfoSet.end(); anIter++){
const PFamilyInfo& aFamilyInfo = *anIter;
TInt aNbGroup = aFamilyInfo->GetNbGroup();
for(TInt iGroup = 0; iGroup < aNbGroup; iGroup++){
if(MYDEBUG){
TGroupInfo::const_iterator anIter = aGroup.begin();
for(; anIter != aGroup.end(); anIter++){
- string aName = anIter->first;
+ const std::string& aName = anIter->first;
INITMSG(MYDEBUG,"aGroupName = '"<<aName<<"'\n");
- const TFamilyGroup& aFamilyGroup = anIter->second;
- TFamilyGroup::const_iterator anFamIter = aFamilyGroup.begin();
- for(; anFamIter != aFamilyGroup.end(); anFamIter++){
+ const TFamilyInfoSet& aFamilyInfoSet = anIter->second;
+ TFamilyInfoSet::const_iterator anFamIter = aFamilyInfoSet.begin();
+ for(; anFamIter != aFamilyInfoSet.end(); anFamIter++){
const PFamilyInfo& aFamilyInfo = *anFamIter;
INITMSG(MYDEBUG,"aFamilyName = '"<<aFamilyInfo->GetName()<<"'\n");
}
//---------------------------------------------------------------
- TTimeStampGroup
- GetFieldsByEntity(TWrapper& theWrapper,
- const PMeshInfo& theMeshInfo,
- const MED::TEntityInfo& theEntityInfo)
+ TFieldInfo2TimeStampInfoSet
+ GetFieldInfo2TimeStampInfoSet(const PWrapper& theWrapper,
+ const PMeshInfo& theMeshInfo,
+ const MED::TEntityInfo& theEntityInfo)
{
MSG(MYDEBUG,"GetFieldsByEntity(...)");
- TTimeStampGroup aGroup;
- TInt aNbFields = theWrapper.GetNbFields();
+ TFieldInfo2TimeStampInfoSet aFieldInfo2TimeStampInfoSet;
+ TInt aNbFields = theWrapper->GetNbFields();
INITMSG(MYDEBUG,"GetNbFields() = "<<aNbFields<<"\n");
for(TInt iField = 1; iField <= aNbFields; iField++){
- PFieldInfo aFieldInfo = theWrapper.GetPFieldInfo(theMeshInfo,iField);
+ PFieldInfo aFieldInfo = theWrapper->GetPFieldInfo(theMeshInfo,iField);
INITMSG(MYDEBUG,"aFieldName = '"<<aFieldInfo->GetName()<<
"'; aNbComp = "<<aFieldInfo->GetNbComp()<<"; ");
- MED::TGeom aGeom;
+ TGeom2Size aGeom2Size;
EEntiteMaillage anEntity = EEntiteMaillage(-1);
- TInt aNbTimeStamps = theWrapper.GetNbTimeStamps(aFieldInfo,theEntityInfo,anEntity,aGeom);
+ TInt aNbTimeStamps = theWrapper->GetNbTimeStamps(aFieldInfo,theEntityInfo,anEntity,aGeom2Size);
ADDMSG(MYDEBUG,"anEntity = "<<anEntity<<"; GetNbTimeStamps = "<<aNbTimeStamps<<"\n");
for(TInt iTimeStamp = 1; iTimeStamp <= aNbTimeStamps; iTimeStamp++){
PTimeStampInfo aTimeStamp =
- theWrapper.GetPTimeStampInfo(aFieldInfo,anEntity,aGeom,iTimeStamp);
- aGroup[aFieldInfo].insert(aTimeStamp);
- INITMSG(MYDEBUG,"aDt = "<<aTimeStamp->GetDt()
- <<", Unit = \'"<<aTimeStamp->GetUnitDt()
- <<"\', aNbGauss = "<<aTimeStamp->GetNbGauss()<<"\n");
+ theWrapper->GetPTimeStampInfo(aFieldInfo,anEntity,aGeom2Size,iTimeStamp);
+ aFieldInfo2TimeStampInfoSet[aFieldInfo].insert(aTimeStamp);
+ INITMSG(MYDEBUG,
+ "aDt = "<<aTimeStamp->GetDt()<<
+ ", Unit = \'"<<aTimeStamp->GetUnitDt()<<"\n");
}
}
ADDMSG(MYDEBUG,"\n");
- return aGroup;
+ return aFieldInfo2TimeStampInfoSet;
}
- TFieldGroup
- GetFieldsByEntity(const TTimeStampGroup& theTimeStampGroup)
+ //---------------------------------------------------------------
+ TEntite2TFieldInfo2TimeStampInfoSet
+ GetEntite2TFieldInfo2TimeStampInfoSet(const TFieldInfo2TimeStampInfoSet& theFieldInfo2TimeStampInfoSet)
{
- TFieldGroup aGroup;
- TTimeStampGroup::const_iterator anIter = theTimeStampGroup.begin();
- for(; anIter != theTimeStampGroup.end(); anIter++){
+ TEntite2TFieldInfo2TimeStampInfoSet anEntite2TFieldInfo2TimeStampInfoSet;
+ TFieldInfo2TimeStampInfoSet::const_iterator anIter = theFieldInfo2TimeStampInfoSet.begin();
+ for(; anIter != theFieldInfo2TimeStampInfoSet.end(); anIter++){
+ const TTimeStampInfoSet& aTimeStampInfoSet = anIter->second;
//const PFieldInfo& aFieldInfo = anIter->first;
- const TTimeStampSet& aTimeStampSet = anIter->second;
- if(aTimeStampSet.empty()) continue;
- const PTimeStampInfo& aTimeStampInfo = *aTimeStampSet.begin();
- aGroup[aTimeStampInfo->GetEntity()].insert(*anIter);
+ if(aTimeStampInfoSet.empty())
+ continue;
+ const PTimeStampInfo& aTimeStampInfo = *aTimeStampInfoSet.begin();
+ anEntite2TFieldInfo2TimeStampInfoSet[aTimeStampInfo->GetEntity()].insert(*anIter);
}
- return aGroup;
+ return anEntite2TFieldInfo2TimeStampInfoSet;
}
- TFamilyByEntity
- GetFamiliesByEntity(TWrapper& theWrapper,
- const TElemGroup& theElemGroup,
- const TFamilyGroup& theFamilyGroup)
+ //---------------------------------------------------------------
+ bool
+ operator<(const TFamilyTSize& theLeft, const TFamilyTSize& theRight)
+ {
+ const MED::PFamilyInfo& aLeftInfo = boost::get<0>(theLeft);
+ const MED::PFamilyInfo& aRightInfo = boost::get<0>(theRight);
+ return aLeftInfo->GetId() < aRightInfo->GetId();
+ }
+
+
+ //---------------------------------------------------------------
+ TEntity2FamilySet
+ GetEntity2FamilySet(const PWrapper& theWrapper,
+ const TEntity2TGeom2ElemInfo& theEntity2TGeom2ElemInfo,
+ const TFamilyInfoSet& theFamilyInfoSet)
{
MSG(MYDEBUG,"GetFamiliesByEntity(...)");
- TFamilyByEntity aFamilyByEntity;
+ TEntity2FamilySet anEntity2FamilySet;
- typedef map<TInt,PFamilyInfo> TFamilyByIdMap;
- TFamilyByIdMap aFamilyByIdMap;
- TFamilyGroup::const_iterator anIter = theFamilyGroup.begin();
- for(; anIter != theFamilyGroup.end(); anIter++){
+ typedef map<TInt,PFamilyInfo> TId2Family;
+ TId2Family anId2Family;
+ TFamilyInfoSet::const_iterator anIter = theFamilyInfoSet.begin();
+ for(; anIter != theFamilyInfoSet.end(); anIter++){
const PFamilyInfo& aFamilyInfo = *anIter;
- aFamilyByIdMap.insert(TFamilyByIdMap::value_type(aFamilyInfo->GetId(),aFamilyInfo));
+ anId2Family.insert(TId2Family::value_type(aFamilyInfo->GetId(),aFamilyInfo));
}
- if(!aFamilyByIdMap.empty()){
- typedef set<TInt> TFamilyIdSet;
- typedef map<EEntiteMaillage,TFamilyIdSet> TFamilyIdByEntity;
- TFamilyIdByEntity aFamilyIdByEntity;
+ if(!anId2Family.empty()){
+ typedef std::map<TInt,TInt> TFamilyID2Size;
+ typedef map<EEntiteMaillage,TFamilyID2Size> TEntity2FamilyID;
+ TEntity2FamilyID anEntity2FamilyID;
- if(!theElemGroup.empty()){
- TElemGroup::const_iterator anIter = theElemGroup.begin();
- for(; anIter != theElemGroup.end(); anIter++){
+ if(!theEntity2TGeom2ElemInfo.empty()){
+ TEntity2TGeom2ElemInfo::const_iterator anIter = theEntity2TGeom2ElemInfo.begin();
+ for(; anIter != theEntity2TGeom2ElemInfo.end(); anIter++){
const EEntiteMaillage& anEntity = anIter->first;
- TFamilyIdSet& aFamilyIdSet = aFamilyIdByEntity[anEntity];
- const TElemMap& anElemMap = anIter->second;
- TElemMap::const_iterator anElemIter = anElemMap.begin();
- for(; anElemIter != anElemMap.end(); anElemIter++){
- const PElemInfo& aElemInfo = anElemIter->second;
+ TFamilyID2Size& aFamilyID2Size = anEntity2FamilyID[anEntity];
+ const TGeom2ElemInfo& aGeom2ElemInfo = anIter->second;
+ TGeom2ElemInfo::const_iterator aGeom2ElemInfoIter = aGeom2ElemInfo.begin();
+ for(; aGeom2ElemInfoIter != aGeom2ElemInfo.end(); aGeom2ElemInfoIter++){
+ const PElemInfo& aElemInfo = aGeom2ElemInfoIter->second;
if(TInt aNbElem = aElemInfo->GetNbElem()){
for(TInt i = 0; i < aNbElem; i++){
- aFamilyIdSet.insert(aElemInfo->GetFamNum(i));
+ aFamilyID2Size[aElemInfo->GetFamNum(i)] += 1;
}
}
}
}
}
- if(!aFamilyIdByEntity.empty()){
- TFamilyIdByEntity::const_iterator anIter = aFamilyIdByEntity.begin();
- for(; anIter != aFamilyIdByEntity.end(); anIter++){
+ if(!anEntity2FamilyID.empty()){
+ TEntity2FamilyID::const_iterator anIter = anEntity2FamilyID.begin();
+ for(; anIter != anEntity2FamilyID.end(); anIter++){
const EEntiteMaillage& anEntity = anIter->first;
INITMSG(MYDEBUG,"anEntity = "<<anEntity<<":\n");
- const TFamilyIdSet& aFamilyIdSet = anIter->second;
- TFamilyIdSet::const_iterator anFamilyIdIter = aFamilyIdSet.begin();
- for(; anFamilyIdIter != aFamilyIdSet.end(); anFamilyIdIter++){
- const TInt& aFamilyId = *anFamilyIdIter;
- TFamilyByIdMap::const_iterator
- anFamilyByIdMapIter = aFamilyByIdMap.find(aFamilyId);
- if(anFamilyByIdMapIter != aFamilyByIdMap.end()){
- const PFamilyInfo& aFamilyInfo = anFamilyByIdMapIter->second;
- aFamilyByEntity[anEntity].insert(aFamilyInfo);
+ const TFamilyID2Size& aFamilyID2Size = anIter->second;
+ TFamilyID2Size::const_iterator anIter2 = aFamilyID2Size.begin();
+ for(; anIter2 != aFamilyID2Size.end(); anIter2++){
+ TInt anId = anIter2->first;
+ TInt aSize = anIter2->second;
+ TId2Family::const_iterator anIter3 = anId2Family.find(anId);
+ if(anIter3 != anId2Family.end()){
+ const PFamilyInfo& aFamilyInfo = anIter3->second;
+ anEntity2FamilySet[anEntity].insert(TFamilyTSize(aFamilyInfo,aSize));
INITMSG(MYDEBUG,
"aFamilyName = '"<<aFamilyInfo->GetName()<<
"' anId = "<<aFamilyInfo->GetId()<<"\n");
}
}
ADDMSG(MYDEBUG,"\n");
- return aFamilyByEntity;
+ return anEntity2FamilySet;
}
+
+ //---------------------------------------------------------------
+ TKey2Gauss
+ GetKey2Gauss(const PWrapper& theWrapper,
+ TErr* theErr,
+ EModeSwitch theMode)
+ {
+ INITMSG(MYDEBUG,"GetKey2Gauss - theMode = "<<theMode<<endl);
+ TKey2Gauss aKey2Gauss;
+ TInt aNbGauss = theWrapper->GetNbGauss(theErr);
+ for(TInt anId = 1; anId <= aNbGauss; anId++){
+ TGaussInfo::TInfo aPreInfo = theWrapper->GetGaussPreInfo(anId);
+ PGaussInfo anInfo = theWrapper->CrGaussInfo(aPreInfo,theMode);
+ theWrapper->GetGaussInfo(anId,anInfo,theErr);
+ TGaussInfo::TKey aKey = boost::get<0>(aPreInfo);
+ aKey2Gauss[aKey] = anInfo;
+
+#ifdef _DEBUG_
+ const EGeometrieElement& aGeom = boost::get<0>(aKey);
+ const std::string& aName = boost::get<1>(aKey);
+ INITMSG(MYDEBUG,
+ "- aGeom = "<<aGeom<<
+ "; aName = '"<<aName<<"'"<<
+ endl);
+#endif
+
+ }
+ return aKey2Gauss;
+ }
+
+
+ //---------------------------------------------------------------
+ PProfileInfo
+ GetProfileInfo(const PWrapper& theWrapper,
+ const std::string& theProfileName,
+ TErr* theErr,
+ EModeProfil theMode)
+ {
+ PProfileInfo anInfo;
+ TInt aNbProfiles = theWrapper->GetNbProfiles(theErr);
+ for(TInt anId = 1; anId <= aNbProfiles; anId++){
+ TProfileInfo::TInfo aPreInfo = theWrapper->GetProfilePreInfo(anId);
+ const std::string& aName = boost::get<0>(aPreInfo);
+ if(aName == theProfileName)
+ return theWrapper->GetPProfileInfo(anId,theMode,theErr);
+ }
+ return anInfo;
+ }
+
+
+ //---------------------------------------------------------------
+ TMKey2Profile
+ GetMKey2Profile(const PWrapper& theWrapper,
+ TErr* theErr,
+ EModeProfil theMode)
+ {
+ INITMSG(MYDEBUG,"GetMKey2Profile - theMode = "<<theMode<<endl);
+ TKey2Profile aKey2Profile;
+ TInt aNbProfiles = theWrapper->GetNbProfiles(theErr);
+ for(TInt anId = 1; anId <= aNbProfiles; anId++){
+ TProfileInfo::TInfo aPreInfo = theWrapper->GetProfilePreInfo(anId);
+ PProfileInfo anInfo = theWrapper->GetPProfileInfo(anId,theMode,theErr);
+ const std::string& aName = boost::get<0>(aPreInfo);
+ aKey2Profile[aName] = anInfo;
+
+#ifdef _DEBUG_
+ INITMSG(MYDEBUG,
+ "- aName = '"<<aName<<"'"<<
+ " : "<<
+ endl);
+ TInt aNbElem = anInfo->myElemNum.size();
+ for(TInt iElem = 0; iElem < aNbElem; iElem++){
+ ADDMSG(MYVALUEDEBUG,anInfo->GetElemNum(iElem)<<", ");
+ }
+ ADDMSG(MYVALUEDEBUG,endl);
+#endif
+
+ }
+ return TMKey2Profile(theMode,aKey2Profile);
+ }
+
}
#define MED_Algorithm_HeaderFile
#include "MED_Structures.hxx"
-#include "MED_Wrapper.hxx"
#include <set>
-namespace MED{
+namespace MED
+{
//---------------------------------------------------------------
- typedef std::map<EGeometrieElement,PElemInfo> TElemMap;
- typedef std::map<EEntiteMaillage,TElemMap> TElemGroup;
+ typedef std::map<EGeometrieElement,PElemInfo> TGeom2ElemInfo;
+ typedef std::map<EEntiteMaillage,TGeom2ElemInfo> TEntity2TGeom2ElemInfo;
- TElemGroup GetElemsByEntity(TWrapper& theWrapper,
- const PMeshInfo& theMeshInfo,
- const MED::TEntityInfo& theEntityInfo);
+ //! Get set of TElemInfo by its geometrical type and corresponding MED ENTITY
+ TEntity2TGeom2ElemInfo
+ GetEntity2TGeom2ElemInfo(const PWrapper& theWrapper,
+ const PMeshInfo& theMeshInfo,
+ const MED::TEntityInfo& theEntityInfo);
//---------------------------------------------------------------
- typedef std::set<PFamilyInfo> TFamilyGroup;
-
- TFamilyGroup GetFamilies(TWrapper& theWrapper,
- const PMeshInfo& theMeshInfo);
+ typedef std::set<PFamilyInfo> TFamilyInfoSet;
+ //! Read set of MED FAMILIES for defined MED file
+ TFamilyInfoSet
+ GetFamilyInfoSet(const PWrapper& theWrapper,
+ const PMeshInfo& theMeshInfo);
+
//---------------------------------------------------------------
- typedef std::map<EEntiteMaillage,TFamilyGroup> TFamilyByEntity;
-
- TFamilyByEntity GetFamiliesByEntity(TWrapper& theWrapper,
- const TElemGroup& theElemGroup,
- const TFamilyGroup& theFamilyGroup);
+ typedef boost::tuple<PFamilyInfo,TInt> TFamilyTSize;
+
+ bool
+ operator<(const TFamilyTSize& theLeft, const TFamilyTSize& theRight);
+ typedef std::set<TFamilyTSize> TFamilyTSizeSet;
//---------------------------------------------------------------
- typedef std::map<std::string,TFamilyGroup> TGroupInfo;
+ typedef std::map<EEntiteMaillage,TFamilyTSizeSet> TEntity2FamilySet;
+
+ //! Split set of MED FAMILIES by corresponding MED ENTITY
+ TEntity2FamilySet
+ GetEntity2FamilySet(const PWrapper& theWrapper,
+ const TEntity2TGeom2ElemInfo& theEntity2TGeom2ElemInfo,
+ const TFamilyInfoSet& theFamilyInfoSet);
- TGroupInfo GetFamiliesByGroup(const TFamilyGroup& theGroupInfo);
+ //---------------------------------------------------------------
+ typedef std::map<std::string,TFamilyInfoSet> TGroupInfo;
+
+ //! Split the input set of MED FAMILIES by corresponding MED GROUPS
+ TGroupInfo
+ GetGroupInfo(const TFamilyInfoSet& theFamilyInfoSet);
+
//---------------------------------------------------------------
- typedef std::set<PTimeStampInfo> TTimeStampSet;
- typedef std::map<PFieldInfo,TTimeStampSet> TTimeStampGroup;
+ typedef std::set<PTimeStampInfo> TTimeStampInfoSet;
+ typedef std::map<PFieldInfo,TTimeStampInfoSet> TFieldInfo2TimeStampInfoSet;
+
+ //! Read set of MED TIMESTAMPS groupped by corresponding MED FIELDS
+ TFieldInfo2TimeStampInfoSet
+ GetFieldInfo2TimeStampInfoSet(const PWrapper& theWrapper,
+ const PMeshInfo& theMeshInfo,
+ const MED::TEntityInfo& theEntityInfo);
+
+
+ //---------------------------------------------------------------
+ typedef std::map<EEntiteMaillage,TFieldInfo2TimeStampInfoSet> TEntite2TFieldInfo2TimeStampInfoSet;
+
+ //! Split the input set of MED TIMESTAMPS by corresponding MED FIELDS and MED ENTITIES
+ TEntite2TFieldInfo2TimeStampInfoSet
+ GetEntite2TFieldInfo2TimeStampInfoSet(const TFieldInfo2TimeStampInfoSet& theFieldInfo2TimeStampInfoSet);
- TTimeStampGroup GetFieldsByEntity(TWrapper& theWrapper,
- const PMeshInfo& theMeshInfo,
- const MED::TEntityInfo& theEntityInfo);
+
+ //---------------------------------------------------------------
+ typedef std::map<TGaussInfo::TKey,PGaussInfo,TGaussInfo::TLess> TKey2Gauss;
+
+ //! Read set of MED GAUSS
+ TKey2Gauss
+ GetKey2Gauss(const PWrapper& theWrapper,
+ TErr* theErr = NULL,
+ EModeSwitch theMode = eFULL_INTERLACE);
//---------------------------------------------------------------
- typedef std::map<EEntiteMaillage,TTimeStampGroup> TFieldGroup;
+ //! Get MED PROFILE by its name
+ PProfileInfo
+ GetProfileInfo(const PWrapper& theWrapper,
+ const std::string& theProfileName,
+ TErr* theErr = NULL,
+ EModeProfil theMode = eCOMPACT);
- TFieldGroup GetFieldsByEntity(const TTimeStampGroup& theTimeStampGroup);
+ //---------------------------------------------------------------
+ typedef std::map<TProfileInfo::TKey,PProfileInfo> TKey2Profile;
+ typedef boost::tuple<EModeProfil,TKey2Profile> TMKey2Profile;
+
+ //! Read set of MED PROFILES
+ TMKey2Profile
+ GetMKey2Profile(const PWrapper& theWrapper,
+ TErr* theErr = NULL,
+ EModeProfil theMode = eCOMPACT);
}
#endif
#ifndef MED_Common_HeaderFile
#define MED_Common_HeaderFile
-#include <stdexcept>
-#include <valarray>
-#include <vector>
#include <string>
#include <set>
#include <map>
-extern "C"{
+extern "C"
+{
#include <hdf5.h>
}
-#include <boost/shared_ptr.hpp>
+#include <boost/tuple/tuple.hpp>
#include "SALOMEconfig.h"
+#include "MED_Vector.hxx"
+#include "MED_SharedPtr.hxx"
+#include "MED_SliceArray.hxx"
+
namespace MED{
enum EVersion {eVUnknown = -1, eV2_1, eV2_2};
-
- template<class T> class SharedPtr: public boost::shared_ptr<T>
- {
- public:
- SharedPtr() {}
-
- template<class Y>
- explicit SharedPtr(Y * p):
- boost::shared_ptr<T>(p)
- {}
-
- template<class Y>
- SharedPtr(SharedPtr<Y> const & r):
- boost::shared_ptr<T>(r,boost::detail::polymorphic_cast_tag())
- {}
-
- template<class Y>
- SharedPtr& operator=(SharedPtr<Y> const & r)
- {
- boost::shared_ptr<T>(r,boost::detail::polymorphic_cast_tag()).swap(*this);
- return *this;
- }
-
- template<class Y> SharedPtr& operator()(Y * p) // Y must be complete
- {
- return operator=<Y>(SharedPtr<Y>(p));
- }
-
- operator const T& () const
- {
- return *(this->get());
- }
-
- operator T& ()
- {
- return *(this->get());
- }
- };
-
-
- template<class TContainer>
- class ConstSliceArray
- {
- const TContainer& myConstContainer;
- std::slice mySlice;
- protected:
- size_t GetID(size_t theId) const
- {
- if(theId < mySlice.size()){
- size_t anId = mySlice.start() + theId*mySlice.stride();
- if(anId < myConstContainer.size())
- return anId;
- }
- throw std::out_of_range();
- return -1;
- }
-
- public:
- typedef typename TContainer::value_type TValue;
-
- ConstSliceArray(const TContainer& theContainer,
- const std::slice& theSlice):
- myConstContainer(theContainer),
- mySlice(theSlice)
- {
- }
-
- const TValue& operator[](size_t theId) const
- {
- return myConstContainer[GetID(theId)];
- }
-
- size_t size() const
- {
- return mySlice.size();
- }
- };
-
-
- template<class TContainer>
- class SliceArray: public ConstSliceArray<TContainer>
- {
- TContainer& myContainer;
-
- public:
- typedef ConstSliceArray<TContainer> TSupperClass;
- SliceArray(TContainer& theContainer,
- const std::slice& theSlice):
- TSupperClass(theContainer,theSlice),
- myContainer(theContainer)
- {
- }
-
- typename TSupperClass::TValue& operator[](size_t theId)
- {
- return myContainer[this->GetID(theId)];
- }
- };
-
-
typedef enum {eFAUX, eVRAI} EBooleen ;
typedef double TFloat;
#if defined(SUN4SOL2) || defined(PCLINUX) || defined(OSF1_32) || defined(IRIX64_32) || defined(RS6000) || defined(HP9000)
typedef hid_t TIdt;
typedef herr_t TErr;
+ typedef enum {eFULL_INTERLACE, eNO_INTERLACE} EModeSwitch;
+
typedef enum {eFLOAT64=6, eINT=26} ETypeChamp;
typedef enum {eNON_STRUCTURE, eSTRUCTURE} EMaillage;
typedef enum {eNO_PFLMOD, eGLOBAL, eCOMPACT} EModeProfil;
- typedef std::vector<TFloat> TFloatVector;
- typedef std::vector<std::string> TStringVector;
- typedef std::vector<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> TGeom;
- typedef std::map<EEntiteMaillage,TGeom> TEntityInfo;
+ typedef std::map<EGeometrieElement,TInt> TGeom2Size;
+ typedef std::map<EEntiteMaillage,TGeom2Size> TEntityInfo;
typedef std::set<EGeometrieElement> TGeomSet;
typedef std::map<EEntiteMaillage,TGeomSet> TEntity2GeomSet;
- const TEntity2GeomSet& GetEntity2GeomSet();
+ const TEntity2GeomSet&
+ GetEntity2GeomSet();
- template<int>
-
- TInt GetNbConn(EGeometrieElement typmai,
- EEntiteMaillage typent,
- TInt mdim);
+ template<EVersion>
+ TInt
+ GetDESCLength();
- template<>
- TInt GetNbConn<eV2_1>(EGeometrieElement typmai,
- EEntiteMaillage typent,
- TInt mdim);
-
- template<>
- TInt GetNbConn<eV2_2>(EGeometrieElement typmai,
- EEntiteMaillage typent,
- TInt mdim);
-
- TInt GetNbNodes(EGeometrieElement typmai);
+ template<EVersion>
+ TInt
+ GetIDENTLength();
+
+ template<EVersion>
+ TInt
+ GetNOMLength();
+
+ template<EVersion>
+ TInt
+ GetLNOMLength();
+
+ template<EVersion>
+ TInt
+ GetPNOMLength();
+
+ template<EVersion>
+ TInt
+ GetNbConn(EGeometrieElement typmai,
+ EEntiteMaillage typent,
+ TInt mdim);
+
+ TInt
+ GetNbNodes(EGeometrieElement typmai);
struct TNameInfo;
typedef SharedPtr<TNameInfo> PNameInfo;
struct TTimeStampInfo;
typedef SharedPtr<TTimeStampInfo> PTimeStampInfo;
+
+ struct TProfileInfo;
+ typedef SharedPtr<TProfileInfo> PProfileInfo;
+
+ struct TGaussInfo;
+ typedef SharedPtr<TGaussInfo> PGaussInfo;
struct TTimeStampVal;
typedef SharedPtr<TTimeStampVal> PTimeStampVal;
--- /dev/null
+//
+//
+// Copyright (C) 2003 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.
+//
+// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File :
+// Author :
+// Module :
+// $Header$
+
+#include "MED_CoordUtils.hxx"
+#include "MED_Utilities.hxx"
+
+namespace MED
+{
+
+ enum ECoordName{eX, eY, eZ, eNone};
+
+ template<ECoordName TCoordId>
+ TFloat
+ GetCoord(const TCCoordSlice& theCoordSlice)
+ {
+ return theCoordSlice[TCoordId];
+ }
+
+ template<>
+ TFloat
+ GetCoord<eNone>(const TCCoordSlice& theCoordSlice)
+ {
+ return 0.0;
+ }
+
+ TGetCoord
+ aXYZGetCoord[3] = {
+ &GetCoord<eX>,
+ &GetCoord<eY>,
+ &GetCoord<eZ>
+ };
+
+ TGetCoord
+ aXYGetCoord[3] = {
+ &GetCoord<eX>,
+ &GetCoord<eY>,
+ &GetCoord<eNone>
+ };
+
+ TGetCoord
+ aYZGetCoord[3] = {
+ &GetCoord<eNone>,
+ &GetCoord<eX>,
+ &GetCoord<eY>
+ };
+
+ TGetCoord
+ aXZGetCoord[3] = {
+ &GetCoord<eX>,
+ &GetCoord<eNone>,
+ &GetCoord<eY>
+ };
+
+
+ TGetCoord
+ aXGetCoord[3] = {
+ &GetCoord<eX>,
+ &GetCoord<eNone>,
+ &GetCoord<eNone>
+ };
+
+ TGetCoord
+ aYGetCoord[3] = {
+ &GetCoord<eNone>,
+ &GetCoord<eX>,
+ &GetCoord<eNone>
+ };
+
+ TGetCoord
+ aZGetCoord[3] = {
+ &GetCoord<eNone>,
+ &GetCoord<eNone>,
+ &GetCoord<eX>
+ };
+
+
+ //---------------------------------------------------------------
+ TCoordHelper
+ ::TCoordHelper(TGetCoord* theGetCoord):
+ myGetCoord(theGetCoord)
+ {}
+
+ TFloat
+ TCoordHelper
+ ::GetCoord(TCCoordSlice& theCoordSlice,
+ TInt theCoordId)
+ {
+ return (*myGetCoord[theCoordId])(theCoordSlice);
+ }
+
+
+ //---------------------------------------------------------------
+ PCoordHelper
+ GetCoordHelper(PNodeInfo theNodeInfo)
+ {
+ PCoordHelper aCoordHelper;
+ {
+ PMeshInfo aMeshInfo = theNodeInfo->GetMeshInfo();
+ TInt aMeshDimension = aMeshInfo->GetDim();
+ bool anIsDimPresent[3] = {false, false, false};
+ for(int iDim = 0; iDim < aMeshDimension; iDim++){
+ std::string aName = theNodeInfo->GetCoordName(iDim);
+ if(aName == "x" || aName == "X")
+ anIsDimPresent[eX] = true;
+ else if(aName == "y" || aName == "Y")
+ anIsDimPresent[eY] = true;
+ else if(aName == "z" || aName == "Z")
+ anIsDimPresent[eZ] = true;
+ }
+
+ switch(aMeshDimension){
+ case 3:
+ aCoordHelper.reset(new TCoordHelper(aXYZGetCoord));
+ break;
+ case 2:
+ if(anIsDimPresent[eY] && anIsDimPresent[eZ])
+ aCoordHelper.reset(new TCoordHelper(aYZGetCoord));
+ else if(anIsDimPresent[eX] && anIsDimPresent[eZ])
+ aCoordHelper.reset(new TCoordHelper(aXZGetCoord));
+ else
+ aCoordHelper.reset(new TCoordHelper(aXYGetCoord));
+ break;
+ case 1:
+ if(anIsDimPresent[eY])
+ aCoordHelper.reset(new TCoordHelper(aYGetCoord));
+ else if(anIsDimPresent[eZ])
+ aCoordHelper.reset(new TCoordHelper(aZGetCoord));
+ else
+ aCoordHelper.reset(new TCoordHelper(aXGetCoord));
+ break;
+ }
+ }
+ return aCoordHelper;
+ }
+}
--- /dev/null
+//
+//
+// Copyright (C) 2003 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.
+//
+// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File :
+// Author :
+// Module :
+// $Header$
+
+#ifndef MED_CoordUtils_HeaderFile
+#define MED_CoordUtils_HeaderFile
+
+#include "MED_Structures.hxx"
+
+namespace MED
+{
+ typedef TFloat (*TGetCoord)(const TCCoordSlice& theCoordSlice);
+
+
+ //---------------------------------------------------------------
+ class TCoordHelper
+ {
+ TGetCoord* myGetCoord;
+
+ public:
+ TCoordHelper(TGetCoord* theGetCoord);
+
+ TFloat
+ GetCoord(TCCoordSlice& theCoordSlice,
+ TInt theCoordId);
+ };
+ typedef SharedPtr<TCoordHelper> PCoordHelper;
+
+
+ //---------------------------------------------------------------
+ PCoordHelper
+ GetCoordHelper(PNodeInfo theNodeInfo);
+
+}
+
+#endif
--- /dev/null
+//
+//
+// Copyright (C) 2003 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.
+//
+// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File :
+// Author :
+// Module :
+// $Header$
+
+#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;
+#endif
+
+//#define _DEBUG_REF_COORDS_
+
+namespace MED
+{
+ //---------------------------------------------------------------
+ TGaussCoord
+ ::TGaussCoord():
+ TModeSwitchInfo(eFULL_INTERLACE),
+ myNbElem(0),
+ myNbGauss(0),
+ myDim(0),
+ myGaussStep(0)
+ {
+ }
+
+ void
+ TGaussCoord
+ ::Init(TInt theNbElem,
+ TInt theNbGauss,
+ TInt theDim,
+ EModeSwitch theMode)
+ {
+ myModeSwitch = theMode;
+
+ myNbElem = theNbElem;
+ myNbGauss = theNbGauss;
+ myDim = theDim;
+
+ myGaussStep = myNbGauss*myDim;
+
+ myGaussCoord.resize(theNbElem*myGaussStep);
+ }
+
+
+ TCCoordSliceArr
+ TGaussCoord
+ ::GetCoordSliceArr(TInt theElemId) const
+ {
+ TCCoordSliceArr aCoordSliceArr(myNbGauss);
+ if(GetModeSwitch() == eFULL_INTERLACE){
+ TInt anId = theElemId*myGaussStep;
+ for(TInt anGaussId = 0; anGaussId < myNbGauss; anGaussId++){
+ aCoordSliceArr[anGaussId] =
+ TCCoordSlice(myGaussCoord,std::slice(anId,myDim,1));
+ anId += myDim;
+ }
+ }
+ else{
+ for(TInt anGaussId = 0; anGaussId < myNbGauss; anGaussId++){
+ aCoordSliceArr[anGaussId] =
+ TCCoordSlice(myGaussCoord,std::slice(theElemId,myDim,myGaussStep));
+ }
+ }
+ return aCoordSliceArr;
+ }
+
+
+ TCoordSliceArr
+ TGaussCoord
+ ::GetCoordSliceArr(TInt theElemId)
+ {
+ TCoordSliceArr aCoordSliceArr(myNbGauss);
+ if(GetModeSwitch() == eFULL_INTERLACE){
+ TInt anId = theElemId*myGaussStep;
+ for(TInt anGaussId = 0; anGaussId < myNbGauss; anGaussId++){
+ aCoordSliceArr[anGaussId] =
+ TCoordSlice(myGaussCoord,std::slice(anId,myDim,1));
+ anId += myDim;
+ }
+ }
+ else{
+ for(TInt anGaussId = 0; anGaussId < myNbGauss; anGaussId++){
+ aCoordSliceArr[anGaussId] =
+ TCoordSlice(myGaussCoord,std::slice(theElemId,myDim,myGaussStep));
+ }
+ }
+ return aCoordSliceArr;
+ }
+
+
+ //---------------------------------------------------------------
+ inline
+ bool
+ IsEqual(TFloat theLeft, TFloat theRight)
+ {
+ static TFloat EPS = 1.0E-3;
+ if(fabs(theLeft) + fabs(theRight) > EPS)
+ return fabs(theLeft-theRight)/(fabs(theLeft)+fabs(theRight)) < EPS;
+ return true;
+ }
+
+
+ struct TShapeFun
+ {
+ class TFun
+ {
+ TFloatVector myFun;
+ TInt myNbRef;
+
+ public:
+
+ void
+ Init(TInt theNbGauss,
+ TInt theNbRef)
+ {
+ myFun.resize(theNbGauss*theNbRef);
+ myNbRef = theNbRef;
+ }
+
+ TCFloatVecSlice
+ GetFunSlice(TInt theGaussId) const
+ {
+ return TCFloatVecSlice(myFun,std::slice(theGaussId*myNbRef,myNbRef,1));
+ }
+
+ TFloatVecSlice
+ GetFunSlice(TInt theGaussId)
+ {
+ return TFloatVecSlice(myFun,std::slice(theGaussId*myNbRef,myNbRef,1));
+ }
+ };
+
+ typedef TVector<TCCoordSlice> TCCoordSliceArr;
+ typedef TVector<TCoordSlice> TCoordSliceArr;
+
+ TFloatVector myRefCoord;
+ TInt myDim;
+ TInt myNbRef;
+
+ TShapeFun(TInt theDim = 0, TInt theNbRef = 0):
+ myDim(theDim),
+ myNbRef(theNbRef),
+ myRefCoord(theNbRef*theDim)
+ {}
+
+ TInt
+ GetNbRef() const
+ {
+ return myNbRef;
+ }
+
+ TCCoordSlice
+ GetCoord(TInt theRefId) const
+ {
+ return TCCoordSlice(myRefCoord,std::slice(theRefId*myDim,myDim,1));
+ }
+
+ TCoordSlice
+ GetCoord(TInt theRefId)
+ {
+ return TCoordSlice(myRefCoord,std::slice(theRefId*myDim,myDim,1));
+ }
+
+ void
+ GetFun(const TShapeFun::TCCoordSliceArr& theRef,
+ const TShapeFun::TCCoordSliceArr& theGauss,
+ TFun& theFun) const
+ {
+ TInt aNbRef = theRef.size();
+ TInt aNbGauss = theGauss.size();
+ theFun.Init(aNbGauss,aNbRef);
+ }
+
+ virtual
+ void
+ InitFun(const TShapeFun::TCCoordSliceArr& theRef,
+ const TShapeFun::TCCoordSliceArr& theGauss,
+ TFun& theFun) const = 0;
+
+ virtual
+ bool
+ IsSatisfy(const TShapeFun::TCCoordSliceArr& theRefCoord) const
+ {
+ TInt aNbRef = theRefCoord.size();
+ TInt aNbRef2 = GetNbRef();
+ INITMSG(MYDEBUG,"TShapeFun::IsSatisfy "<<
+ "- aNbRef("<<aNbRef<<")"<<
+ "; aNbRef2("<<aNbRef2<<")\n");
+ bool anIsSatisfy = (aNbRef == aNbRef2);
+#ifndef _DEBUG_REF_COORDS_
+ static TInt NB_REF_TO_CHECK = 2;
+ aNbRef = NB_REF_TO_CHECK;
+#endif
+ if(anIsSatisfy){
+ for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
+ const TCCoordSlice& aCoord2 = theRefCoord[aRefId];
+ TCCoordSlice aCoord = GetCoord(aRefId);
+ TInt aDim = aCoord.size();
+ bool anIsEqual = false;
+ for(TInt anId = 0; anId < aDim; anId++){
+ anIsEqual = IsEqual(aCoord[anId],aCoord2[anId]);
+ if(!anIsEqual){
+ anIsSatisfy = false;
+ break;
+ }
+ }
+ if(!anIsEqual){
+ const TCCoordSlice& aCoord = theRefCoord[aRefId];
+ INITMSG(MYDEBUG,aRefId + 1<<":{");
+ TInt aDim = aCoord.size();
+ for(TInt anId = 0; anId < aDim; anId++)
+ ADDMSG(MYDEBUG,"\t"<<aCoord[anId]);
+ ADDMSG(MYDEBUG,"}\n");
+#ifndef _DEBUG_
+ return anIsSatisfy;
+#endif
+ }
+ }
+ }
+
+ return anIsSatisfy;
+ }
+
+ bool
+ Eval(const TCellInfo& theCellInfo,
+ const TNodeInfo& theNodeInfo,
+ const TElemNum& theElemNum,
+ const TShapeFun::TCCoordSliceArr& theRef,
+ const TShapeFun::TCCoordSliceArr& theGauss,
+ TGaussCoord& theGaussCoord,
+ EModeSwitch theMode)
+ {
+ INITMSG(MYDEBUG,"TShapeFun::Eval"<<endl);
+
+ if(IsSatisfy(theRef)){
+ const PMeshInfo& aMeshInfo = theCellInfo.GetMeshInfo();
+ TInt aDim = aMeshInfo->GetDim();
+ TInt aNbGauss = theGauss.size();
+
+ bool anIsSubMesh = !theElemNum.empty();
+ TInt aNbElem;
+ if(anIsSubMesh)
+ aNbElem = theElemNum.size();
+ else
+ aNbElem = theCellInfo.GetNbElem();
+
+ theGaussCoord.Init(aNbElem,aNbGauss,aDim,theMode);
+
+ TFun aFun;
+ InitFun(theRef,theGauss,aFun);
+ TInt aConnDim = theCellInfo.GetConnDim();
+
+ INITMSG(MYDEBUG,"aDim = "<<aDim<<
+ "; aNbGauss = "<<aNbGauss<<
+ "; aNbElem = "<<aNbElem<<
+ "; aNbNodes = "<<theNodeInfo.GetNbElem()<<
+ endl);
+
+ for(TInt anElemId = 0; anElemId < aNbElem; anElemId++){
+ TInt aCellId = anIsSubMesh? theElemNum[anElemId]-1: anElemId;
+ TCConnSlice aConnSlice = theCellInfo.GetConnSlice(aCellId);
+ TCoordSliceArr aCoordSliceArr = theGaussCoord.GetCoordSliceArr(anElemId);
+
+ for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){
+ TCoordSlice& aGaussCoordSlice = aCoordSliceArr[aGaussId];
+ TCFloatVecSlice aFunSlice = aFun.GetFunSlice(aGaussId);
+
+ for(TInt aConnId = 0; aConnId < aConnDim; aConnId++){
+ TInt aNodeId = aConnSlice[aConnId] - 1;
+ TCCoordSlice aNodeCoordSlice = theNodeInfo.GetCoordSlice(aNodeId);
+
+ for(TInt aDimId = 0; aDimId < aDim; aDimId++){
+ aGaussCoordSlice[aDimId] += aNodeCoordSlice[aDimId]*aFunSlice[aConnId];
+ }
+ }
+ }
+ }
+
+#ifdef _DEBUG_
+ {
+ INITMSG(MYVALUEDEBUG,"theGauss: ");
+ for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){
+ TCCoordSlice aCoordSlice = theGauss[aGaussId];
+ ADDMSG(MYVALUEDEBUG,"{");
+ for(TInt aDimId = 0; aDimId < aDim; aDimId++){
+ ADDMSG(MYVALUEDEBUG,aCoordSlice[aDimId]<<" ");
+ }
+ ADDMSG(MYVALUEDEBUG,"} ");
+ }
+ ADDMSG(MYVALUEDEBUG,endl);
+ }
+ for(TInt anElemId = 0; anElemId < aNbElem; anElemId++){
+ TCCoordSliceArr aCoordSliceArr = theGaussCoord.GetCoordSliceArr(anElemId);
+ INITMSG(MYVALUEDEBUG,"");
+ for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){
+ TCCoordSlice aCoordSlice = aCoordSliceArr[aGaussId];
+ ADDMSG(MYVALUEDEBUG,"{");
+ for(TInt aDimId = 0; aDimId < aDim; aDimId++){
+ ADDMSG(MYVALUEDEBUG,aCoordSlice[aDimId]<<" ");
+ }
+ ADDMSG(MYVALUEDEBUG,"} ");
+ }
+ ADDMSG(MYVALUEDEBUG,endl);
+ }
+#endif
+ return true;
+ }
+
+ return false;
+ }
+ };
+
+
+ //---------------------------------------------------------------
+ struct TSeg2a: TShapeFun
+ {
+ TSeg2a():
+ TShapeFun(1,2)
+ {
+ TInt aNbRef = GetNbRef();
+ for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
+ TCoordSlice aCoord = GetCoord(aRefId);
+ switch(aRefId){
+ case 0: aCoord[0] = -1.0; break;
+ case 1: aCoord[0] = 1.0; break;
+ }
+ }
+ }
+
+ virtual
+ void
+ InitFun(const TShapeFun::TCCoordSliceArr& theRef,
+ const TShapeFun::TCCoordSliceArr& theGauss,
+ TFun& theFun) const
+ {
+ GetFun(theRef,theGauss,theFun);
+
+ TInt aNbGauss = theGauss.size();
+ for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){
+ const TCCoordSlice& aCoord = theGauss[aGaussId];
+ TFloatVecSlice aSlice = theFun.GetFunSlice(aGaussId);
+
+ aSlice[0] = 0.5*(1.0 - aCoord[0]);
+ aSlice[1] = 0.5*(1.0 + aCoord[0]);
+ }
+ }
+ };
+
+
+ //---------------------------------------------------------------
+ struct TSeg3a: TShapeFun
+ {
+ TSeg3a():
+ TShapeFun(1,3)
+ {
+ TInt aNbRef = GetNbRef();
+ for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
+ TCoordSlice aCoord = GetCoord(aRefId);
+ switch(aRefId){
+ case 0: aCoord[0] = -1.0; break;
+ case 1: aCoord[0] = 1.0; break;
+ case 2: aCoord[0] = 0.0; break;
+ }
+ }
+ }
+
+ virtual
+ void
+ InitFun(const TShapeFun::TCCoordSliceArr& theRef,
+ const TShapeFun::TCCoordSliceArr& theGauss,
+ TFun& theFun) const
+ {
+ GetFun(theRef,theGauss,theFun);
+
+ TInt aNbGauss = theGauss.size();
+ for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){
+ const TCCoordSlice& aCoord = theGauss[aGaussId];
+ TFloatVecSlice aSlice = theFun.GetFunSlice(aGaussId);
+
+ aSlice[0] = 0.5*(1.0 - aCoord[0])*aCoord[0];
+ aSlice[1] = 0.5*(1.0 + aCoord[0])*aCoord[0];
+ aSlice[2] = (1.0 + aCoord[0])*(1.0 - aCoord[0]);
+ }
+ }
+ };
+
+
+ //---------------------------------------------------------------
+ struct TTria3a: TShapeFun
+ {
+ TTria3a():
+ TShapeFun(2,3)
+ {
+ TInt aNbRef = GetNbRef();
+ for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
+ TCoordSlice aCoord = GetCoord(aRefId);
+ switch(aRefId){
+ case 0: aCoord[0] = -1.0; aCoord[1] = 1.0; break;
+ case 1: aCoord[0] = -1.0; aCoord[1] = -1.0; break;
+ case 2: aCoord[0] = 1.0; aCoord[1] = -1.0; break;
+ }
+ }
+ }
+
+ virtual
+ void
+ InitFun(const TShapeFun::TCCoordSliceArr& theRef,
+ const TShapeFun::TCCoordSliceArr& theGauss,
+ TFun& theFun) const
+ {
+ GetFun(theRef,theGauss,theFun);
+
+ TInt aNbGauss = theGauss.size();
+ for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){
+ const TCCoordSlice& aCoord = theGauss[aGaussId];
+ TFloatVecSlice aSlice = theFun.GetFunSlice(aGaussId);
+
+ aSlice[0] = 0.5*(1.0 + aCoord[1]);
+ aSlice[1] = -0.5*(aCoord[0] + aCoord[1]);
+ aSlice[2] = 0.5*(1.0 + aCoord[0]);
+ }
+ }
+ };
+
+
+ //---------------------------------------------------------------
+ struct TTria6a: TShapeFun
+ {
+ TTria6a():
+ TShapeFun(2,6)
+ {
+ TInt aNbRef = GetNbRef();
+ for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
+ TCoordSlice aCoord = GetCoord(aRefId);
+ switch(aRefId){
+ case 0: aCoord[0] = -1.0; aCoord[1] = 1.0; break;
+ case 1: aCoord[0] = -1.0; aCoord[1] = -1.0; break;
+ case 2: aCoord[0] = 1.0; aCoord[1] = -1.0; break;
+
+ case 3: aCoord[0] = -1.0; aCoord[1] = 1.0; break;
+ case 4: aCoord[0] = 0.0; aCoord[1] = -1.0; break;
+ case 5: aCoord[0] = 0.0; aCoord[1] = 0.0; break;
+ }
+ }
+ }
+
+ virtual
+ void
+ InitFun(const TShapeFun::TCCoordSliceArr& theRef,
+ const TShapeFun::TCCoordSliceArr& theGauss,
+ TFun& theFun) const
+ {
+ GetFun(theRef,theGauss,theFun);
+
+ TInt aNbGauss = theGauss.size();
+ for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){
+ const TCCoordSlice& aCoord = theGauss[aGaussId];
+ TFloatVecSlice aSlice = theFun.GetFunSlice(aGaussId);
+
+ aSlice[0] = 0.5*(1.0 + aCoord[1])*aCoord[1];
+ aSlice[1] = 0.5*(aCoord[0] + aCoord[1])*(aCoord[0] + aCoord[1] + 1);
+ aSlice[2] = 0.5*(1.0 + aCoord[0])*aCoord[0];
+
+ aSlice[3] = -1.0*(1.0 + aCoord[1])*(aCoord[0] + aCoord[1]);
+ aSlice[4] = -1.0*(1.0 + aCoord[0])*(aCoord[0] + aCoord[1]);
+ aSlice[5] = (1.0 + aCoord[1])*(1.0 + aCoord[1]);
+ }
+ }
+ };
+
+
+ //---------------------------------------------------------------
+ struct TTria3b: TShapeFun
+ {
+ TTria3b():
+ TShapeFun(2,3)
+ {
+ TInt aNbRef = GetNbRef();
+ for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
+ TCoordSlice aCoord = GetCoord(aRefId);
+ switch(aRefId){
+ case 0: aCoord[0] = 0.0; aCoord[1] = 0.0; break;
+ case 1: aCoord[0] = 1.0; aCoord[1] = 0.0; break;
+ case 2: aCoord[0] = 0.0; aCoord[1] = 1.0; break;
+ }
+ }
+ }
+
+ virtual
+ void
+ InitFun(const TShapeFun::TCCoordSliceArr& theRef,
+ const TShapeFun::TCCoordSliceArr& theGauss,
+ TFun& theFun) const
+ {
+ GetFun(theRef,theGauss,theFun);
+
+ TInt aNbGauss = theGauss.size();
+ for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){
+ const TCCoordSlice& aCoord = theGauss[aGaussId];
+ TFloatVecSlice aSlice = theFun.GetFunSlice(aGaussId);
+
+ aSlice[0] = 1.0 - aCoord[0] - aCoord[1];
+ aSlice[1] = aCoord[0];
+ aSlice[2] = aCoord[1];
+ }
+ }
+ };
+
+
+ //---------------------------------------------------------------
+ struct TTria6b: TShapeFun
+ {
+ TTria6b():
+ TShapeFun(2,6)
+ {
+ TInt aNbRef = GetNbRef();
+ for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
+ TCoordSlice aCoord = GetCoord(aRefId);
+ switch(aRefId){
+ case 0: aCoord[0] = 0.0; aCoord[1] = 0.0; break;
+ case 1: aCoord[0] = 1.0; aCoord[1] = 0.0; break;
+ case 2: aCoord[0] = 0.0; aCoord[1] = 1.0; break;
+
+ case 3: aCoord[0] = 0.5; aCoord[1] = 0.0; break;
+ case 4: aCoord[0] = 0.5; aCoord[1] = 0.5; break;
+ case 5: aCoord[0] = 0.0; aCoord[1] = 0.5; break;
+ }
+ }
+ }
+
+ virtual
+ void
+ InitFun(const TShapeFun::TCCoordSliceArr& theRef,
+ const TShapeFun::TCCoordSliceArr& theGauss,
+ TFun& theFun) const
+ {
+ GetFun(theRef,theGauss,theFun);
+
+ TInt aNbGauss = theGauss.size();
+ for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){
+ const TCCoordSlice& aCoord = theGauss[aGaussId];
+ TFloatVecSlice aSlice = theFun.GetFunSlice(aGaussId);
+
+ aSlice[0] = (1.0 - aCoord[0] - aCoord[1])*(1.0 - 2.0*aCoord[0] - 2.0*aCoord[1]);
+ aSlice[1] = aCoord[0]*(2.0*aCoord[0] - 1.0);
+ aSlice[2] = aCoord[1]*(2.0*aCoord[1] - 1.0);
+
+ aSlice[3] = 4.0*aCoord[0]*(1.0 - aCoord[0] - aCoord[1]);
+ aSlice[4] = 4.0*aCoord[0]*aCoord[1];
+ aSlice[5] = 4.0*aCoord[1]*(1.0 - aCoord[0] - aCoord[1]);
+ }
+ }
+ };
+
+
+ //---------------------------------------------------------------
+ struct TQuad4a: TShapeFun
+ {
+ TQuad4a():
+ TShapeFun(2,4)
+ {
+ TInt aNbRef = GetNbRef();
+ for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
+ TCoordSlice aCoord = GetCoord(aRefId);
+ switch(aRefId){
+ case 0: aCoord[0] = -1.0; aCoord[1] = 1.0; break;
+ case 1: aCoord[0] = -1.0; aCoord[1] = -1.0; break;
+ case 2: aCoord[0] = 1.0; aCoord[1] = -1.0; break;
+ case 3: aCoord[0] = 1.0; aCoord[1] = 1.0; break;
+ }
+ }
+ }
+
+ virtual
+ void
+ InitFun(const TShapeFun::TCCoordSliceArr& theRef,
+ const TShapeFun::TCCoordSliceArr& theGauss,
+ TFun& theFun) const
+ {
+ GetFun(theRef,theGauss,theFun);
+
+ TInt aNbGauss = theGauss.size();
+ for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){
+ const TCCoordSlice& aCoord = theGauss[aGaussId];
+ TFloatVecSlice aSlice = theFun.GetFunSlice(aGaussId);
+
+ aSlice[0] = 0.25*(1.0 + aCoord[1])*(1.0 - aCoord[0]);
+ aSlice[1] = 0.25*(1.0 - aCoord[1])*(1.0 - aCoord[0]);
+ aSlice[2] = 0.25*(1.0 - aCoord[1])*(1.0 + aCoord[0]);
+ aSlice[3] = 0.25*(1.0 + aCoord[0])*(1.0 + aCoord[1]);
+ }
+ }
+ };
+
+
+ //---------------------------------------------------------------
+ struct TTetra4a: TShapeFun
+ {
+ TTetra4a():
+ TShapeFun(3,4)
+ {
+ TInt aNbRef = GetNbRef();
+ for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
+ TCoordSlice aCoord = GetCoord(aRefId);
+ switch(aRefId){
+ case 0: aCoord[0] = 0.0; aCoord[1] = 1.0; aCoord[2] = 0.0; break;
+ case 1: aCoord[0] = 0.0; aCoord[1] = 0.0; aCoord[2] = 1.0; break;
+ case 2: aCoord[0] = 0.0; aCoord[1] = 0.0; aCoord[2] = 0.0; break;
+ case 3: aCoord[0] = 1.0; aCoord[1] = 0.0; aCoord[2] = 0.0; break;
+ }
+ }
+ }
+
+ virtual
+ void
+ InitFun(const TShapeFun::TCCoordSliceArr& theRef,
+ const TShapeFun::TCCoordSliceArr& theGauss,
+ TFun& theFun) const
+ {
+ GetFun(theRef,theGauss,theFun);
+
+ TInt aNbGauss = theGauss.size();
+ for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){
+ const TCCoordSlice& aCoord = theGauss[aGaussId];
+ TFloatVecSlice aSlice = theFun.GetFunSlice(aGaussId);
+
+ aSlice[0] = aCoord[1];
+ aSlice[1] = aCoord[2];
+ aSlice[2] = 1.0 - aCoord[0] - aCoord[1] - aCoord[2];
+ aSlice[3] = aCoord[0];
+ }
+ }
+ };
+
+
+ //---------------------------------------------------------------
+ struct TTetra10a: TShapeFun
+ {
+ TTetra10a():
+ TShapeFun(3,10)
+ {
+ TInt aNbRef = GetNbRef();
+ for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
+ TCoordSlice aCoord = GetCoord(aRefId);
+ switch(aRefId){
+ case 0: aCoord[0] = 0.0; aCoord[1] = 1.0; aCoord[2] = 0.0; break;
+ case 1: aCoord[0] = 0.0; aCoord[1] = 0.0; aCoord[2] = 1.0; break;
+ case 2: aCoord[0] = 0.0; aCoord[1] = 0.0; aCoord[2] = 0.0; break;
+ case 3: aCoord[0] = 1.0; aCoord[1] = 0.0; aCoord[2] = 0.0; break;
+
+ case 4: aCoord[0] = 0.0; aCoord[1] = 0.5; aCoord[2] = 0.5; break;
+ case 5: aCoord[0] = 0.0; aCoord[1] = 0.0; aCoord[2] = 0.5; break;
+ case 6: aCoord[0] = 0.0; aCoord[1] = 0.5; aCoord[2] = 0.0; break;
+
+ case 7: aCoord[0] = 0.5; aCoord[1] = 0.5; aCoord[2] = 0.0; break;
+ case 8: aCoord[0] = 0.5; aCoord[1] = 0.0; aCoord[2] = 0.5; break;
+ case 9: aCoord[0] = 0.5; aCoord[1] = 0.0; aCoord[2] = 0.0; break;
+ }
+ }
+ }
+
+ virtual
+ void
+ InitFun(const TShapeFun::TCCoordSliceArr& theRef,
+ const TShapeFun::TCCoordSliceArr& theGauss,
+ TFun& theFun) const
+ {
+ GetFun(theRef,theGauss,theFun);
+
+ TInt aNbGauss = theGauss.size();
+ for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){
+ const TCCoordSlice& aCoord = theGauss[aGaussId];
+ TFloatVecSlice aSlice = theFun.GetFunSlice(aGaussId);
+
+ aSlice[0] = aCoord[1]*(2.0*aCoord[1] - 1.0);
+ aSlice[1] = aCoord[2]*(2.0*aCoord[2] - 1.0);
+ aSlice[2] = (1.0 - aCoord[0] - aCoord[1] - aCoord[2])*(1.0 - 2.0*aCoord[0] - 2.0*aCoord[1] - 2.0*aCoord[2]);
+ aSlice[3] = aCoord[0]*(2.0*aCoord[0] - 1.0);
+
+ aSlice[4] = 4.0*aCoord[1]*aCoord[2];
+ aSlice[5] = 4.0*aCoord[2]*(1.0 - aCoord[0] - aCoord[1] - aCoord[2]);
+ aSlice[6] = 4.0*aCoord[1]*(1.0 - aCoord[0] - aCoord[1] - aCoord[2]);
+
+ aSlice[7] = 4.0*aCoord[0]*aCoord[1];
+ aSlice[8] = 4.0*aCoord[0]*aCoord[2];
+ aSlice[9] = 4.0*aCoord[0]*(1.0 - aCoord[0] - aCoord[1] - aCoord[2]);
+ }
+ }
+ };
+
+
+ //---------------------------------------------------------------
+ struct THexa8a: TShapeFun
+ {
+ THexa8a():
+ TShapeFun(3,8)
+ {
+ TInt aNbRef = GetNbRef();
+ for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
+ TCoordSlice aCoord = GetCoord(aRefId);
+ switch(aRefId){
+ case 0: aCoord[0] = -1.0; aCoord[1] = -1.0; aCoord[2] = -1.0; break;
+ case 1: aCoord[0] = 1.0; aCoord[1] = -1.0; aCoord[2] = -1.0; break;
+ case 2: aCoord[0] = 1.0; aCoord[1] = 1.0; aCoord[2] = -1.0; break;
+ case 3: aCoord[0] = -1.0; aCoord[1] = 1.0; aCoord[2] = -1.0; break;
+ case 4: aCoord[0] = -1.0; aCoord[1] = -1.0; aCoord[2] = 1.0; break;
+ case 5: aCoord[0] = 1.0; aCoord[1] = -1.0; aCoord[2] = 1.0; break;
+ case 6: aCoord[0] = 1.0; aCoord[1] = 1.0; aCoord[2] = 1.0; break;
+ case 7: aCoord[0] = -1.0; aCoord[1] = 1.0; aCoord[2] = 1.0; break;
+ }
+ }
+ }
+
+ virtual
+ void
+ InitFun(const TShapeFun::TCCoordSliceArr& theRef,
+ const TShapeFun::TCCoordSliceArr& theGauss,
+ TFun& theFun) const
+ {
+ GetFun(theRef,theGauss,theFun);
+
+ TInt aNbGauss = theGauss.size();
+ for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){
+ const TCCoordSlice& aCoord = theGauss[aGaussId];
+ TFloatVecSlice aSlice = theFun.GetFunSlice(aGaussId);
+
+ aSlice[0] = 0.125*(1.0 - aCoord[0])*(1.0 - aCoord[1])*(1.0 - aCoord[2]);
+ aSlice[1] = 0.125*(1.0 + aCoord[0])*(1.0 - aCoord[1])*(1.0 - aCoord[2]);
+ aSlice[2] = 0.125*(1.0 + aCoord[0])*(1.0 + aCoord[1])*(1.0 - aCoord[2]);
+ aSlice[3] = 0.125*(1.0 - aCoord[0])*(1.0 + aCoord[1])*(1.0 - aCoord[2]);
+
+ aSlice[4] = 0.125*(1.0 - aCoord[0])*(1.0 - aCoord[1])*(1.0 + aCoord[2]);
+ aSlice[5] = 0.125*(1.0 + aCoord[0])*(1.0 - aCoord[1])*(1.0 + aCoord[2]);
+ aSlice[6] = 0.125*(1.0 + aCoord[0])*(1.0 + aCoord[1])*(1.0 + aCoord[2]);
+ aSlice[7] = 0.125*(1.0 - aCoord[0])*(1.0 + aCoord[1])*(1.0 + aCoord[2]);
+ }
+ }
+ };
+
+
+ struct THexa20a: TShapeFun
+ {
+ THexa20a(TInt theDim = 3, TInt theNbRef = 20):
+ TShapeFun(theDim,theNbRef)
+ {
+ TInt aNbRef = myRefCoord.size();
+ for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
+ TCoordSlice aCoord = GetCoord(aRefId);
+ switch(aRefId){
+ case 0: aCoord[0] = -1.0; aCoord[1] = -1.0; aCoord[2] = -1.0; break;
+ case 1: aCoord[0] = 1.0; aCoord[1] = -1.0; aCoord[2] = -1.0; break;
+ case 2: aCoord[0] = 1.0; aCoord[1] = 1.0; aCoord[2] = -1.0; break;
+ case 3: aCoord[0] = -1.0; aCoord[1] = 1.0; aCoord[2] = -1.0; break;
+ case 4: aCoord[0] = -1.0; aCoord[1] = -1.0; aCoord[2] = 1.0; break;
+ case 5: aCoord[0] = 1.0; aCoord[1] = -1.0; aCoord[2] = 1.0; break;
+ case 6: aCoord[0] = 1.0; aCoord[1] = 1.0; aCoord[2] = 1.0; break;
+ case 7: aCoord[0] = -1.0; aCoord[1] = 1.0; aCoord[2] = 1.0; break;
+
+ case 8: aCoord[0] = 0.0; aCoord[1] = -1.0; aCoord[2] = -1.0; break;
+ case 9: aCoord[0] = 1.0; aCoord[1] = 0.0; aCoord[2] = -1.0; break;
+ case 10: aCoord[0] = 0.0; aCoord[1] = 1.0; aCoord[2] = -1.0; break;
+ case 11: aCoord[0] = -1.0; aCoord[1] = 0.0; aCoord[2] = -1.0; break;
+ case 12: aCoord[0] = -1.0; aCoord[1] = -1.0; aCoord[2] = 0.0; break;
+ case 13: aCoord[0] = 1.0; aCoord[1] = -1.0; aCoord[2] = 0.0; break;
+ case 14: aCoord[0] = 1.0; aCoord[1] = 1.0; aCoord[2] = 0.0; break;
+ case 15: aCoord[0] = -1.0; aCoord[1] = 1.0; aCoord[2] = 0.0; break;
+ case 16: aCoord[0] = 0.0; aCoord[1] = -1.0; aCoord[2] = 1.0; break;
+ case 17: aCoord[0] = 1.0; aCoord[1] = 0.0; aCoord[2] = 1.0; break;
+ case 18: aCoord[0] = 0.0; aCoord[1] = 1.0; aCoord[2] = 1.0; break;
+ case 19: aCoord[0] = -1.0; aCoord[1] = 0.0; aCoord[2] = 1.0; break;
+ }
+ }
+ }
+
+ virtual
+ void
+ InitFun(const TShapeFun::TCCoordSliceArr& theRef,
+ const TShapeFun::TCCoordSliceArr& theGauss,
+ TFun& theFun) const
+ {
+ GetFun(theRef,theGauss,theFun);
+
+ TInt aNbGauss = theGauss.size();
+ for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){
+ const TCCoordSlice& aCoord = theGauss[aGaussId];
+ TFloatVecSlice aSlice = theFun.GetFunSlice(aGaussId);
+
+ aSlice[0] = 0.125*(1.0 - aCoord[0])*(1.0 - aCoord[1])*(1.0 - aCoord[2])*
+ (-2.0 - aCoord[0] - aCoord[1] - aCoord[2]);
+ aSlice[1] = 0.125*(1.0 + aCoord[0])*(1.0 - aCoord[1])*(1.0 - aCoord[2])*
+ (-2.0 + aCoord[0] - aCoord[1] - aCoord[2]);
+ aSlice[2] = 0.125*(1.0 + aCoord[0])*(1.0 + aCoord[1])*(1.0 - aCoord[2])*
+ (-2.0 + aCoord[0] + aCoord[1] - aCoord[2]);
+ aSlice[3] = 0.125*(1.0 - aCoord[0])*(1.0 + aCoord[1])*(1.0 - aCoord[2])*
+ (-2.0 - aCoord[0] + aCoord[1] - aCoord[2]);
+ aSlice[4] = 0.125*(1.0 - aCoord[0])*(1.0 - aCoord[1])*(1.0 + aCoord[2])*
+ (-2.0 - aCoord[0] - aCoord[1] + aCoord[2]);
+ aSlice[5] = 0.125*(1.0 + aCoord[0])*(1.0 - aCoord[1])*(1.0 + aCoord[2])*
+ (-2.0 + aCoord[0] - aCoord[1] + aCoord[2]);
+ aSlice[6] = 0.125*(1.0 + aCoord[0])*(1.0 + aCoord[1])*(1.0 + aCoord[2])*
+ (-2.0 + aCoord[0] + aCoord[1] + aCoord[2]);
+ aSlice[7] = 0.125*(1.0 - aCoord[0])*(1.0 + aCoord[1])*(1.0 + aCoord[2])*
+ (-2.0 - aCoord[0] + aCoord[1] + aCoord[2]);
+
+ aSlice[8] = 0.25*(1.0 - aCoord[0]*aCoord[0])*(1.0 - aCoord[1])*(1.0 - aCoord[2]);
+ aSlice[9] = 0.25*(1.0 - aCoord[1]*aCoord[1])*(1.0 + aCoord[0])*(1.0 - aCoord[2]);
+ aSlice[10] = 0.25*(1.0 - aCoord[0]*aCoord[0])*(1.0 + aCoord[1])*(1.0 - aCoord[2]);
+ aSlice[11] = 0.25*(1.0 - aCoord[1]*aCoord[1])*(1.0 - aCoord[0])*(1.0 - aCoord[2]);
+ aSlice[12] = 0.25*(1.0 - aCoord[2]*aCoord[2])*(1.0 - aCoord[0])*(1.0 - aCoord[1]);
+ aSlice[13] = 0.25*(1.0 - aCoord[2]*aCoord[2])*(1.0 + aCoord[0])*(1.0 - aCoord[1]);
+ aSlice[14] = 0.25*(1.0 - aCoord[2]*aCoord[2])*(1.0 + aCoord[0])*(1.0 + aCoord[1]);
+ aSlice[15] = 0.25*(1.0 - aCoord[2]*aCoord[2])*(1.0 - aCoord[0])*(1.0 + aCoord[1]);
+ aSlice[16] = 0.25*(1.0 - aCoord[0]*aCoord[0])*(1.0 - aCoord[1])*(1.0 + aCoord[2]);
+ aSlice[17] = 0.25*(1.0 - aCoord[1]*aCoord[1])*(1.0 + aCoord[0])*(1.0 + aCoord[2]);
+ aSlice[18] = 0.25*(1.0 - aCoord[0]*aCoord[0])*(1.0 + aCoord[1])*(1.0 + aCoord[2]);
+ aSlice[19] = 0.25*(1.0 - aCoord[1]*aCoord[1])*(1.0 - aCoord[0])*(1.0 + aCoord[2]);
+ }
+ }
+ };
+
+
+ //---------------------------------------------------------------
+ struct THexa27a: THexa20a
+ {
+ THexa27a():
+ THexa20a(3,27)
+ {
+ TInt aNbRef = myRefCoord.size();
+ for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
+ TCoordSlice aCoord = GetCoord(aRefId);
+ switch(aRefId){
+ case 20: aCoord[0] = 0.0; aCoord[1] = 0.0; aCoord[2] = -1.0; break;
+ case 21: aCoord[0] = 0.0; aCoord[1] = -1.0; aCoord[2] = 0.0; break;
+ case 22: aCoord[0] = 1.0; aCoord[1] = 0.0; aCoord[2] = 0.0; break;
+ case 23: aCoord[0] = 0.0; aCoord[1] = 1.0; aCoord[2] = 0.0; break;
+ case 24: aCoord[0] = -1.0; aCoord[1] = 0.0; aCoord[2] = 0.0; break;
+ case 25: aCoord[0] = 0.0; aCoord[1] = 0.0; aCoord[2] = 1.0; break;
+ case 26: aCoord[0] = 0.0; aCoord[1] = 0.0; aCoord[2] = 0.0; break;
+ }
+ }
+ }
+
+ virtual
+ void
+ InitFun(const TShapeFun::TCCoordSliceArr& theRef,
+ const TShapeFun::TCCoordSliceArr& theGauss,
+ TFun& theFun) const
+ {
+ GetFun(theRef,theGauss,theFun);
+
+ TInt aNbGauss = theGauss.size();
+ for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){
+ const TCCoordSlice& aCoord = theGauss[aGaussId];
+ TFloatVecSlice aSlice = theFun.GetFunSlice(aGaussId);
+
+ aSlice[0] = 0.125*aCoord[0]*(aCoord[0] - 1.0)*aCoord[1]*(aCoord[1] - 1.0)*aCoord[2]*(aCoord[2] - 1.0);
+ aSlice[1] = 0.125*aCoord[0]*(aCoord[0] + 1.0)*aCoord[1]*(aCoord[1] - 1.0)*aCoord[2]*(aCoord[2] - 1.0);
+ aSlice[2] = 0.125*aCoord[0]*(aCoord[0] + 1.0)*aCoord[1]*(aCoord[1] + 1.0)*aCoord[2]*(aCoord[2] - 1.0);
+ aSlice[3] = 0.125*aCoord[0]*(aCoord[0] - 1.0)*aCoord[1]*(aCoord[1] + 1.0)*aCoord[2]*(aCoord[2] - 1.0);
+ aSlice[4] = 0.125*aCoord[0]*(aCoord[0] + 1.0)*aCoord[1]*(aCoord[1] - 1.0)*aCoord[2]*(aCoord[2] + 1.0);
+ aSlice[5] = 0.125*aCoord[0]*(aCoord[0] + 1.0)*aCoord[1]*(aCoord[1] - 1.0)*aCoord[2]*(aCoord[2] + 1.0);
+ aSlice[6] = 0.125*aCoord[0]*(aCoord[0] + 1.0)*aCoord[1]*(aCoord[1] + 1.0)*aCoord[2]*(aCoord[2] + 1.0);
+ aSlice[7] = 0.125*aCoord[0]*(aCoord[0] - 1.0)*aCoord[1]*(aCoord[1] + 1.0)*aCoord[2]*(aCoord[2] + 1.0);
+
+ aSlice[8] = 0.25*(1.0 - aCoord[0]*aCoord[0])*aCoord[1]*(aCoord[1] - 1.0)*aCoord[2]*(aCoord[2] - 1.0);
+ aSlice[9] = 0.25*aCoord[0]*(aCoord[0] + 1.0)*(1.0 - aCoord[1]*aCoord[1])*aCoord[2]*(aCoord[2] - 1.0);
+ aSlice[10]= 0.25*aCoord[0]*(aCoord[0] + 1.0)*(1.0 - aCoord[1]*aCoord[1])*aCoord[2]*(aCoord[2] - 1.0);
+ aSlice[11]= 0.25*aCoord[0]*(aCoord[0] - 1.0)*(1.0 - aCoord[1]*aCoord[1])*aCoord[2]*(aCoord[2] - 1.0);
+ aSlice[12]= 0.25*aCoord[0]*(aCoord[0] - 1.0)*aCoord[1]*(aCoord[1] - 1.0)*(1.0 - aCoord[2]*aCoord[2]);
+ aSlice[13]= 0.25*aCoord[0]*(aCoord[0] + 1.0)*aCoord[1]*(aCoord[1] - 1.0)*(1.0 - aCoord[2]*aCoord[2]);
+ aSlice[14]= 0.25*aCoord[0]*(aCoord[0] + 1.0)*aCoord[1]*(aCoord[1] + 1.0)*(1.0 - aCoord[2]*aCoord[2]);
+ aSlice[15]= 0.25*aCoord[0]*(aCoord[0] - 1.0)*aCoord[1]*(aCoord[1] + 1.0)*(1.0 - aCoord[2]*aCoord[2]);
+ aSlice[16]= 0.25*(1.0 - aCoord[0]*aCoord[0])*aCoord[1]*(aCoord[1] - 1.0)*aCoord[2]*(aCoord[2] + 1.0);
+ aSlice[17]= 0.25*aCoord[0]*(aCoord[0] + 1.0)*(1.0 - aCoord[1]*aCoord[1])*aCoord[2]*(aCoord[2] + 1.0);
+ aSlice[18]= 0.25*(1.0 - aCoord[0]*aCoord[0])*aCoord[1]*(aCoord[1] + 1.0)*aCoord[2]*(aCoord[2] + 1.0);
+ aSlice[19]= 0.25*aCoord[0]*(aCoord[0] - 1.0)*(1.0 - aCoord[1]*aCoord[1])*aCoord[2]*(aCoord[2] + 1.0);
+ aSlice[20]= 0.25*(1.0 - aCoord[0]*aCoord[0])*(1.0 - aCoord[1]*aCoord[1])*aCoord[2]*(aCoord[2] - 1.0);
+ aSlice[21]= 0.25*(1.0 - aCoord[0]*aCoord[0])*aCoord[1]*(aCoord[1] - 1.0)*(1.0 - aCoord[2]*aCoord[2]);
+ aSlice[22]= 0.25*aCoord[0]*(aCoord[0] + 1.0)*(1.0 - aCoord[1]*aCoord[1])*(1.0 - aCoord[2]*aCoord[2]);
+ aSlice[23]= 0.25*(1.0 - aCoord[0]*aCoord[0])*aCoord[1]*(aCoord[1] + 1.0)*(1.0 - aCoord[2]*aCoord[2]);
+ aSlice[24]= 0.25*aCoord[0]*(aCoord[0] - 1.0)*(1.0 - aCoord[1]*aCoord[1])*(1.0 - aCoord[2]*aCoord[2]);
+ aSlice[25]= 0.25*(1.0 - aCoord[0]*aCoord[0])*(1.0 - aCoord[1]*aCoord[1])*aCoord[2]*(aCoord[2] + 1.0);
+ aSlice[26]= 0.25*(1.0 - aCoord[0]*aCoord[0])*(1.0 - aCoord[1]*aCoord[1])*(1.0 - aCoord[1]*aCoord[1]);
+ }
+ }
+ };
+
+
+ //---------------------------------------------------------------
+ struct TPenta6a: TShapeFun
+ {
+ TPenta6a():
+ TShapeFun(3,6)
+ {
+ TInt aNbRef = myRefCoord.size();
+ for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
+ TCoordSlice aCoord = GetCoord(aRefId);
+ switch(aRefId){
+ case 0: aCoord[0] = -1.0; aCoord[1] = 1.0; aCoord[2] = 0.0; break;
+ case 1: aCoord[0] = -1.0; aCoord[1] = -0.0; aCoord[2] = 1.0; break;
+ case 2: aCoord[0] = -1.0; aCoord[1] = 0.0; aCoord[2] = 0.0; break;
+ case 3: aCoord[0] = 1.0; aCoord[1] = 1.0; aCoord[2] = 0.0; break;
+ case 4: aCoord[0] = 1.0; aCoord[1] = 0.0; aCoord[2] = 1.0; break;
+ case 5: aCoord[0] = 1.0; aCoord[1] = 0.0; aCoord[2] = 0.0; break;
+ }
+ }
+ }
+
+ virtual
+ void
+ InitFun(const TShapeFun::TCCoordSliceArr& theRef,
+ const TShapeFun::TCCoordSliceArr& theGauss,
+ TFun& theFun) const
+ {
+ GetFun(theRef,theGauss,theFun);
+
+ TInt aNbGauss = theGauss.size();
+ for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){
+ const TCCoordSlice& aCoord = theGauss[aGaussId];
+ TFloatVecSlice aSlice = theFun.GetFunSlice(aGaussId);
+
+ aSlice[0] = 0.5*aCoord[1]*(1.0 - aCoord[0]);
+ aSlice[1] = 0.5*aCoord[2]*(1.0 - aCoord[0]);
+ aSlice[2] = 0.5*(1.0 - aCoord[1] - aCoord[2])*(1.0 - aCoord[0]);
+
+ aSlice[3] = 0.5*aCoord[1]*(aCoord[0] + 1.0);
+ aSlice[4] = 0.5*aCoord[2]*(aCoord[0] + 1.0);
+ aSlice[5] = 0.5*(1.0 - aCoord[1] - aCoord[2])*(1.0 + aCoord[0]);
+ }
+ }
+ };
+
+
+ //---------------------------------------------------------------
+ struct TPenta15a: TShapeFun
+ {
+ TPenta15a():
+ TShapeFun(3,15)
+ {
+ TInt aNbRef = myRefCoord.size();
+ for(TInt aRefId = 0; aRefId < aNbRef; aRefId++){
+ TCoordSlice aCoord = GetCoord(aRefId);
+ switch(aRefId){
+ case 0: aCoord[0] = -1.0; aCoord[1] = 1.0; aCoord[2] = 0.0; break;
+ case 1: aCoord[0] = -1.0; aCoord[1] = -0.0; aCoord[2] = 1.0; break;
+ case 2: aCoord[0] = -1.0; aCoord[1] = 0.0; aCoord[2] = 0.0; break;
+ case 3: aCoord[0] = 1.0; aCoord[1] = 1.0; aCoord[2] = 0.0; break;
+ case 4: aCoord[0] = 1.0; aCoord[1] = 0.0; aCoord[2] = 1.0; break;
+ case 5: aCoord[0] = 1.0; aCoord[1] = 0.0; aCoord[2] = 0.0; break;
+
+ case 6: aCoord[0] = -1.0; aCoord[1] = 0.5; aCoord[2] = 0.5; break;
+ case 7: aCoord[0] = -1.0; aCoord[1] = 0.0; aCoord[2] = 0.5; break;
+ case 8: aCoord[0] = -1.0; aCoord[1] = 0.5; aCoord[2] = 0.0; break;
+ case 9: aCoord[0] = 0.0; aCoord[1] = 1.0; aCoord[2] = 0.0; break;
+ case 10: aCoord[0] = 0.0; aCoord[1] = 0.0; aCoord[2] = 1.0; break;
+ case 11: aCoord[0] = 0.0; aCoord[1] = 0.0; aCoord[2] = 0.0; break;
+ case 12: aCoord[0] = 1.0; aCoord[1] = 0.5; aCoord[2] = 0.5; break;
+ case 13: aCoord[0] = 1.0; aCoord[1] = 0.0; aCoord[2] = 0.5; break;
+ case 14: aCoord[0] = 1.0; aCoord[1] = 0.5; aCoord[2] = 0.0; break;
+ }
+ }
+ }
+
+ virtual
+ void
+ InitFun(const TShapeFun::TCCoordSliceArr& theRef,
+ const TShapeFun::TCCoordSliceArr& theGauss,
+ TFun& theFun) const
+ {
+ GetFun(theRef,theGauss,theFun);
+
+ TInt aNbGauss = theGauss.size();
+ for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){
+ const TCCoordSlice& aCoord = theGauss[aGaussId];
+ TFloatVecSlice aSlice = theFun.GetFunSlice(aGaussId);
+
+ aSlice[0] = 0.5*aCoord[1]*(1.0 - aCoord[0])*(2.0*aCoord[1] - 2.0 - aCoord[0]);
+ aSlice[1] = 0.5*aCoord[2]*(1.0 - aCoord[0])*(2.0*aCoord[2] - 2.0 - aCoord[0]);
+ aSlice[2] = 0.5*(aCoord[0] - 1.0)*(1.0 - aCoord[1] - aCoord[2])*(aCoord[0] + 2.0*aCoord[1] + 2.0*aCoord[2]);
+
+ aSlice[3] = 0.5*aCoord[1]*(1.0 + aCoord[0])*(2.0*aCoord[1] - 2.0 - aCoord[0]);
+ aSlice[4] = 0.5*aCoord[2]*(1.0 + aCoord[0])*(2.0*aCoord[2] - 2.0 - aCoord[0]);
+ aSlice[5] = -0.5*(aCoord[0] + 1.0)*(1.0 - aCoord[1] - aCoord[2])*(-aCoord[0] + 2.0*aCoord[1] + 2.0*aCoord[2]);
+
+ aSlice[6] = 2.0*aCoord[1]*aCoord[2]*(1.0 - aCoord[0]);
+ aSlice[7] = 2.0*aCoord[2]*(1.0 - aCoord[1] - aCoord[2])*(1.0 - aCoord[0]);
+ aSlice[8] = 2.0*aCoord[1]*(1.0 - aCoord[1] - aCoord[2])*(1.0 - aCoord[0]);
+
+ aSlice[9] = aCoord[1]*(1.0 - aCoord[0]*aCoord[0]);
+ aSlice[10] = aCoord[2]*(1.0 - aCoord[0]*aCoord[0]);
+ aSlice[11] = (1.0 - aCoord[1] - aCoord[2])*(1.0 - aCoord[0]*aCoord[0]);
+
+ aSlice[12] = 2.0*aCoord[1]*aCoord[2]*(1.0 + aCoord[0]);
+ aSlice[13] = 2.0*aCoord[2]*(1.0 - aCoord[1] - aCoord[2])*(1.0 + aCoord[0]);
+ aSlice[14] = 2.0*aCoord[1]*(1.0 - aCoord[1] - aCoord[2])*(1.0 + aCoord[0]);
+ }
+ }
+ };
+
+
+ //---------------------------------------------------------------
+ bool
+ GetGaussCoord3D(const TGaussInfo& theGaussInfo,
+ const TCellInfo& theCellInfo,
+ const TNodeInfo& theNodeInfo,
+ TGaussCoord& theGaussCoord,
+ const TElemNum& theElemNum,
+ EModeSwitch theMode)
+ {
+ INITMSG(MYDEBUG,"GetGaussCoord3D\n");
+
+ if(theGaussInfo.myGeom == theCellInfo.myGeom){
+ EGeometrieElement aGeom = theGaussInfo.myGeom;
+
+ TInt aNbRef = theGaussInfo.GetNbRef();
+ TCCoordSliceArr aRefSlice(aNbRef);
+ for(TInt anId = 0; anId < aNbRef; anId++)
+ aRefSlice[anId] = theGaussInfo.GetRefCoordSlice(anId);
+
+ TInt aNbGauss = theGaussInfo.GetNbGauss();
+ TCCoordSliceArr aGaussSlice(aNbGauss);
+ for(TInt anId = 0; anId < aNbGauss; anId++)
+ aGaussSlice[anId] = theGaussInfo.GetGaussCoordSlice(anId);
+
+ switch(aGeom){
+ case eSEG2: {
+ INITMSG(MYDEBUG,"eSEG2"<<endl);
+
+ if(TSeg2a().Eval(theCellInfo,theNodeInfo,theElemNum,aRefSlice,aGaussSlice,theGaussCoord,theMode))
+ return true;
+
+ break;
+ }
+ case eSEG3: {
+ INITMSG(MYDEBUG,"eSEG3"<<endl);
+
+ if(TSeg3a().Eval(theCellInfo,theNodeInfo,theElemNum,aRefSlice,aGaussSlice,theGaussCoord,theMode))
+ return true;
+
+ break;
+ }
+ case eTRIA3: {
+ INITMSG(MYDEBUG,"eTRIA3"<<endl);
+
+ if(TTria3a().Eval(theCellInfo,theNodeInfo,theElemNum,aRefSlice,aGaussSlice,theGaussCoord,theMode))
+ return true;
+
+ if(TTria3b().Eval(theCellInfo,theNodeInfo,theElemNum,aRefSlice,aGaussSlice,theGaussCoord,theMode))
+ return true;
+
+ break;
+ }
+ case eTRIA6: {
+ INITMSG(MYDEBUG,"eTRIA6"<<endl);
+
+ if(TTria6a().Eval(theCellInfo,theNodeInfo,theElemNum,aRefSlice,aGaussSlice,theGaussCoord,theMode))
+ return true;
+
+ if(TTria6b().Eval(theCellInfo,theNodeInfo,theElemNum,aRefSlice,aGaussSlice,theGaussCoord,theMode))
+ return true;
+
+ break;
+ }
+ case eQUAD4: {
+ INITMSG(MYDEBUG,"eQUAD4"<<endl);
+
+ if(TQuad4a().Eval(theCellInfo,theNodeInfo,theElemNum,aRefSlice,aGaussSlice,theGaussCoord,theMode))
+ return true;
+
+ break;
+ }
+ case eQUAD8: {
+ INITMSG(MYDEBUG,"eQUAD8"<<endl);
+ break;
+ }
+ case eTETRA4: {
+ INITMSG(MYDEBUG,"eTETRA4"<<endl);
+
+ if(TTetra4a().Eval(theCellInfo,theNodeInfo,theElemNum,aRefSlice,aGaussSlice,theGaussCoord,theMode))
+ return true;
+
+ break;
+ }
+ case ePYRA5: {
+ INITMSG(MYDEBUG,"ePYRA5"<<endl);
+ break;
+ }
+ case ePENTA6: {
+ INITMSG(MYDEBUG,"ePENTA6"<<endl);
+
+ if(TPenta6a().Eval(theCellInfo,theNodeInfo,theElemNum,aRefSlice,aGaussSlice,theGaussCoord,theMode))
+ return true;
+
+ break;
+ }
+ case eHEXA8: {
+ INITMSG(MYDEBUG,"eHEXA8"<<endl);
+
+ if(THexa8a().Eval(theCellInfo,theNodeInfo,theElemNum,aRefSlice,aGaussSlice,theGaussCoord,theMode))
+ return true;
+
+ break;
+ }
+ case eTETRA10: {
+ INITMSG(MYDEBUG,"eTETRA10"<<endl);
+
+ if(TTetra10a().Eval(theCellInfo,theNodeInfo,theElemNum,aRefSlice,aGaussSlice,theGaussCoord,theMode))
+ return true;
+
+ break;
+ }
+ case ePYRA13: {
+ INITMSG(MYDEBUG,"ePYRA13"<<endl);
+ break;
+ }
+ case ePENTA15: {
+ INITMSG(MYDEBUG,"ePENTA15"<<endl);
+
+ if(TPenta15a().Eval(theCellInfo,theNodeInfo,theElemNum,aRefSlice,aGaussSlice,theGaussCoord,theMode))
+ return true;
+
+ break;
+ }
+ case eHEXA20: {
+ INITMSG(MYDEBUG,"eHEXA20"<<endl);
+
+ if(THexa20a().Eval(theCellInfo,theNodeInfo,theElemNum,aRefSlice,aGaussSlice,theGaussCoord,theMode))
+ return true;
+
+ break;
+ }
+ default:
+ INITMSG(MYDEBUG,"eNONE"<<endl);
+ return false;
+ }
+ }
+
+ return false;
+ }
+
+ //---------------------------------------------------------------
+ bool
+ GetBaryCenter(const TCellInfo& theCellInfo,
+ const TNodeInfo& theNodeInfo,
+ TGaussCoord& theGaussCoord,
+ const TElemNum& theElemNum,
+ EModeSwitch theMode)
+ {
+ INITMSG(MYDEBUG,"GetBaryCenter\n");
+ const PMeshInfo& aMeshInfo = theCellInfo.GetMeshInfo();
+ TInt aDim = aMeshInfo->GetDim();
+ static TInt aNbGauss = 1;
+
+ bool anIsSubMesh = !theElemNum.empty();
+ TInt aNbElem;
+ if(anIsSubMesh)
+ aNbElem = theElemNum.size();
+ else
+ aNbElem = theCellInfo.GetNbElem();
+
+ theGaussCoord.Init(aNbElem,aNbGauss,aDim,theMode);
+
+ INITMSGA(MYDEBUG,0,
+ "- aDim = "<<aDim<<
+ "; aNbGauss = "<<aNbGauss<<
+ "; aNbElem = "<<aNbElem<<
+ "; aNbNodes = "<<theNodeInfo.GetNbElem()<<
+ endl);
+
+ for(TInt anElemId = 0; anElemId < aNbElem; anElemId++){
+ TInt aCellId = anIsSubMesh? theElemNum[anElemId]-1: anElemId;
+ TCConnSlice aConnSlice = theCellInfo.GetConnSlice(aCellId);
+ TCoordSliceArr aCoordSliceArr = theGaussCoord.GetCoordSliceArr(anElemId);
+
+ TInt aConnDim = aConnSlice.size();
+
+ for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){
+ TCoordSlice& aGaussCoordSlice = aCoordSliceArr[aGaussId];
+
+ for(TInt aConnId = 0; aConnId < aConnDim; aConnId++){
+ TInt aNodeId = aConnSlice[aConnId] - 1;
+ TCCoordSlice aNodeCoordSlice = theNodeInfo.GetCoordSlice(aNodeId);
+
+ for(TInt aDimId = 0; aDimId < aDim; aDimId++){
+ aGaussCoordSlice[aDimId] += aNodeCoordSlice[aDimId];
+ }
+ }
+
+ for(TInt aDimId = 0; aDimId < aDim; aDimId++){
+ aGaussCoordSlice[aDimId] /= aConnDim;
+ }
+ }
+ }
+
+#ifdef _DEBUG_
+ for(TInt anElemId = 0; anElemId < aNbElem; anElemId++){
+ TCoordSliceArr aCoordSliceArr = theGaussCoord.GetCoordSliceArr(anElemId);
+ INITMSG(MYVALUEDEBUG,"");
+ for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){
+ TCoordSlice& aCoordSlice = aCoordSliceArr[aGaussId];
+ ADDMSG(MYVALUEDEBUG,"{");
+ for(TInt aDimId = 0; aDimId < aDim; aDimId++){
+ ADDMSG(MYVALUEDEBUG,aCoordSlice[aDimId]<<" ");
+ }
+ ADDMSG(MYVALUEDEBUG,"} ");
+ }
+ ADDMSG(MYVALUEDEBUG,endl);
+ }
+#endif
+
+ return true;
+ }
+
+
+ //---------------------------------------------------------------
+ bool
+ GetBaryCenter(const TPolygoneInfo& thePolygoneInfo,
+ const TNodeInfo& theNodeInfo,
+ TGaussCoord& theGaussCoord,
+ const TElemNum& theElemNum,
+ EModeSwitch theMode)
+ {
+ INITMSG(MYDEBUG,"GetBaryCenter\n");
+ const PMeshInfo& aMeshInfo = thePolygoneInfo.GetMeshInfo();
+ TInt aDim = aMeshInfo->GetDim();
+ static TInt aNbGauss = 1;
+
+ bool anIsSubMesh = !theElemNum.empty();
+ TInt aNbElem;
+ if(anIsSubMesh)
+ aNbElem = theElemNum.size();
+ else
+ aNbElem = thePolygoneInfo.GetNbElem();
+
+ theGaussCoord.Init(aNbElem,aNbGauss,aDim,theMode);
+
+ INITMSGA(MYDEBUG,0,
+ "- aDim = "<<aDim<<
+ "; aNbGauss = "<<aNbGauss<<
+ "; aNbElem = "<<aNbElem<<
+ "; aNbNodes = "<<theNodeInfo.GetNbElem()<<
+ endl);
+
+ for(TInt anElemId = 0; anElemId < aNbElem; anElemId++){
+ TInt aCellId = anIsSubMesh? theElemNum[anElemId]-1: anElemId;
+
+ TCoordSliceArr aCoordSliceArr = theGaussCoord.GetCoordSliceArr(anElemId);
+ TCConnSlice aConnSlice = thePolygoneInfo.GetConnSlice(aCellId);
+ TInt aNbConn = thePolygoneInfo.GetNbConn(aCellId);
+ TInt aNbNodes = thePolygoneInfo.GetNbConn(aCellId);
+
+ for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){
+ TCoordSlice& aGaussCoordSlice = aCoordSliceArr[aGaussId];
+
+ for(TInt aConnId = 0; aConnId < aNbConn; aConnId++){
+ TInt aNodeId = aConnSlice[aConnId] - 1;
+ TCCoordSlice aNodeCoordSlice = theNodeInfo.GetCoordSlice(aNodeId);
+
+ for(TInt aDimId = 0; aDimId < aDim; aDimId++){
+ aGaussCoordSlice[aDimId] += aNodeCoordSlice[aDimId];
+ }
+ }
+
+ for(TInt aDimId = 0; aDimId < aDim; aDimId++){
+ aGaussCoordSlice[aDimId] /= aNbNodes;
+ }
+ }
+ }
+
+ return true;
+ }
+
+
+ //---------------------------------------------------------------
+ bool
+ GetBaryCenter(const TPolyedreInfo& thePolyedreInfo,
+ const TNodeInfo& theNodeInfo,
+ TGaussCoord& theGaussCoord,
+ const TElemNum& theElemNum,
+ EModeSwitch theMode)
+ {
+ INITMSG(MYDEBUG,"GetBaryCenter\n");
+ const PMeshInfo& aMeshInfo = thePolyedreInfo.GetMeshInfo();
+ TInt aDim = aMeshInfo->GetDim();
+ static TInt aNbGauss = 1;
+
+ bool anIsSubMesh = !theElemNum.empty();
+ TInt aNbElem;
+ if(anIsSubMesh)
+ aNbElem = theElemNum.size();
+ else
+ aNbElem = thePolyedreInfo.GetNbElem();
+
+ theGaussCoord.Init(aNbElem,aNbGauss,aDim,theMode);
+
+ INITMSGA(MYDEBUG,0,
+ "- aDim = "<<aDim<<
+ "; aNbGauss = "<<aNbGauss<<
+ "; aNbElem = "<<aNbElem<<
+ "; aNbNodes = "<<theNodeInfo.GetNbElem()<<
+ endl);
+
+ for(TInt anElemId = 0; anElemId < aNbElem; anElemId++){
+ TInt aCellId = anIsSubMesh? theElemNum[anElemId]-1: anElemId;
+
+ TCoordSliceArr aCoordSliceArr = theGaussCoord.GetCoordSliceArr(anElemId);
+ TCConnSliceArr aConnSliceArr = thePolyedreInfo.GetConnSliceArr(aCellId);
+ TInt aNbFaces = aConnSliceArr.size();
+
+ TInt aNbNodes = thePolyedreInfo.GetNbNodes(aCellId);
+
+ for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){
+ TCoordSlice& aGaussCoordSlice = aCoordSliceArr[aGaussId];
+
+ for(TInt aFaceId = 0; aFaceId < aNbFaces; aFaceId++){
+ TCConnSlice aConnSlice = aConnSliceArr[aFaceId];
+ TInt aNbConn = aConnSlice.size();
+ for(TInt aConnId = 0; aConnId < aNbConn; aConnId++){
+ TInt aNodeId = aConnSlice[aConnId] - 1;
+ TCCoordSlice aNodeCoordSlice = theNodeInfo.GetCoordSlice(aNodeId);
+
+ for(TInt aDimId = 0; aDimId < aDim; aDimId++){
+ aGaussCoordSlice[aDimId] += aNodeCoordSlice[aDimId];
+ }
+ }
+ }
+ for(TInt aDimId = 0; aDimId < aDim; aDimId++){
+ aGaussCoordSlice[aDimId] /= aNbNodes;
+ }
+ }
+ }
+
+ return true;
+ }
+}
--- /dev/null
+//
+//
+// Copyright (C) 2003 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.
+//
+// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File :
+// Author :
+// Module :
+// $Header$
+
+#ifndef MED_GaussUtils_HeaderFile
+#define MED_GaussUtils_HeaderFile
+
+#include "MED_Structures.hxx"
+
+namespace MED
+{
+ //---------------------------------------------------------------
+ typedef TVector<TCCoordSlice> TCCoordSliceArr;
+ typedef TVector<TCoordSlice> TCoordSliceArr;
+
+ //! Define a helper class to handle Gauss Points coordinates
+ class TGaussCoord:
+ virtual TModeSwitchInfo
+ {
+ TInt myNbElem;
+ TInt myNbGauss;
+ TInt myDim;
+
+ TInt myGaussStep;
+
+ TNodeCoord myGaussCoord;
+
+ public:
+
+ TGaussCoord();
+
+ //! Get slice of the coordinate that corresponds to defined cell (const version)
+ TCCoordSliceArr
+ GetCoordSliceArr(TInt theElemId) const;
+
+ //! Get slice of the coordinate that corresponds to defined cell
+ TCoordSliceArr
+ GetCoordSliceArr(TInt theElemId);
+
+ //! To init the class
+ void
+ Init(TInt theNbElem,
+ TInt theNbGauss,
+ TInt theDim,
+ EModeSwitch theMode = eFULL_INTERLACE);
+
+ TInt
+ GetNbElem() const { return myNbElem; }
+
+ TInt
+ GetNbGauss() const { return myNbGauss; }
+
+ TInt
+ GetDim() const { return myDim; }
+ };
+
+
+ //---------------------------------------------------------------
+ //! To calculate Gauss Points coordinates
+ bool
+ 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
+ bool
+ GetBaryCenter(const TCellInfo& theCellInfo,
+ const TNodeInfo& theNodeInfo,
+ TGaussCoord& theGaussCoord,
+ const TElemNum& theElemNum = TElemNum(),
+ EModeSwitch theMode = eFULL_INTERLACE);
+
+ //! To calculate Gauss Points coordinates for defined TPolygoneInfo as its bary center
+ bool
+ GetBaryCenter(const TPolygoneInfo& thePolygoneInfo,
+ const TNodeInfo& theNodeInfo,
+ TGaussCoord& theGaussCoord,
+ const TElemNum& theElemNum = TElemNum(),
+ EModeSwitch theMode = eFULL_INTERLACE);
+
+ //! To calculate Gauss Points coordinates for defined TPolyedreInfo as its bary center
+ bool
+ GetBaryCenter(const TPolyedreInfo& thePolyedreInfo,
+ const TNodeInfo& theNodeInfo,
+ TGaussCoord& theGaussCoord,
+ const TElemNum& theElemNum = TElemNum(),
+ EModeSwitch theMode = eFULL_INTERLACE);
+}
+
+#endif
--- /dev/null
+//
+//
+// Copyright (C) 2003 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.
+//
+// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File :
+// Author :
+// Module :
+// $Header$
+
+#ifndef MED_SharedPtr_HeaderFile
+#define MED_SharedPtr_HeaderFile
+
+#include <boost/shared_ptr.hpp>
+
+namespace MED
+{
+
+ //! 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
+ for all of the MEDWrapper objects.
+ */
+ template<class T> class SharedPtr: public boost::shared_ptr<T>
+ {
+ public:
+ //! Default constructor
+ SharedPtr() {}
+
+ //! Construct the class by any type of a pointer
+ template<class Y>
+ explicit SharedPtr(Y * p):
+ boost::shared_ptr<T>(p)
+ {}
+
+ //! Construct the class by any specialisation of the class
+ template<class Y>
+ SharedPtr(SharedPtr<Y> const & r):
+ boost::shared_ptr<T>(r,boost::detail::dynamic_cast_tag())
+ {}
+
+ //! Copy-constructor
+ template<class Y>
+ SharedPtr&
+ operator=(SharedPtr<Y> const & r)
+ {
+ boost::shared_ptr<T>(r,boost::detail::dynamic_cast_tag()).swap(*this);
+ return *this;
+ }
+
+ //! Introduce a flexible way to reset the wrapped pointer
+ 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&
+ 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
+ {
+ return *(this->get());
+ }
+
+ //! To provide a flexible way to use reference to the wrapped pointer
+ operator T& ()
+ {
+ return *(this->get());
+ }
+ };
+
+}
+
+
+#endif
--- /dev/null
+//
+//
+// Copyright (C) 2003 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.
+//
+// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File :
+// Author :
+// Module :
+// $Header$
+
+#ifndef MED_SliceArray_HeaderFile
+#define MED_SliceArray_HeaderFile
+
+#include <valarray>
+#include <stdexcept>
+
+namespace MED
+{
+ //---------------------------------------------------------------
+ //! 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 TContainer>
+ class TCSlice
+ {
+ typedef const TContainer* PCContainer;
+ PCContainer myCContainer; //!< Reference to source multy-dimension data
+ std::slice mySlice; //!< Defines algorithm of index calculation
+ protected:
+ //! Calculate internal index to get proper element from the source multy-dimension data
+ size_t
+ GetID(size_t theId) const
+ {
+#ifdef _DEBUG_
+ size_t anId = -1;
+ if(theId < mySlice.size()){
+ anId = mySlice.start() + theId*mySlice.stride();
+ if(anId < myCContainer->size())
+ return anId;
+ }
+ throw std::out_of_range(std::string("TCSlice::GetID"));
+ return anId;
+#else
+ return mySlice.start() + theId*mySlice.stride();
+#endif
+ }
+
+ public:
+ typedef typename TContainer::value_type value_type;
+
+ //! Construct the class
+ TCSlice(const TContainer& theContainer,
+ const std::slice& theSlice):
+ myCContainer(&theContainer),
+ mySlice(theSlice)
+ {}
+
+ //! Default constructor (dangerous)
+ TCSlice():
+ myCContainer(NULL)
+ {}
+
+ //! Get element by its number (const version)
+ const value_type&
+ operator[](size_t theId) const
+ {
+ return (*myCContainer)[GetID(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 TContainer>
+ class TSlice: public TCSlice<TContainer>
+ {
+ typedef TContainer* PContainer;
+ PContainer myContainer;
+
+ public:
+ typedef typename TContainer::value_type value_type;
+ typedef TCSlice<TContainer> TSupperClass;
+
+ //! Construct the class
+ TSlice(TContainer& theContainer,
+ const std::slice& theSlice):
+ TSupperClass(theContainer,theSlice),
+ myContainer(&theContainer)
+ {
+ }
+
+ //! Default constructor (dangerous)
+ TSlice():
+ myContainer(NULL)
+ {}
+
+ //! Get element by its number
+ value_type&
+ operator[](size_t theId)
+ {
+ return (*myContainer)[this->GetID(theId)];
+ }
+ };
+
+}
+
+
+#endif
#include "MED_Structures.hxx"
#include "MED_Utilities.hxx"
-using namespace MED;
-
-#if defined __GNUC__
- #if __GNUC__ == 2
- #define __GNUC_2__
- #endif
-#endif
-#if defined __GNUC_2__
-#define GETINDEX(anArray,ind) anArray[ind]
-#else
-#define GETINDEX(anArray,ind) anArray.at(ind)
-#endif
-
-namespace MED{
+using namespace MED;
- TInt GetNbNodes(EGeometrieElement typmai)
+namespace MED
+{
+ TInt
+ GetNbNodes(EGeometrieElement typmai)
{
return typmai%100;
}
- template<>
- TInt GetNbConn<eV2_1>(EGeometrieElement typmai,
- EEntiteMaillage typent,
- TInt mdim)
+ std::string
+ GetString(TInt theId,
+ TInt theStep,
+ const TString& theString)
{
- TInt nsup = 0;
-
- if(typent == eMAILLE){
- TInt edim = typmai / 100;
- if(mdim == 2 || mdim == 3)
- if(edim == 1)
- nsup = 1;
-
- if(mdim == 3)
- if (edim == 2)
- nsup = 1;
- }
-
- return nsup + typmai%100;
+ const char* aPos = &theString[theId*theStep];
+ TInt aSize = std::min(TInt(strlen(aPos)),theStep);
+ return std::string(aPos,aSize);
}
- template<>
- TInt GetNbConn<eV2_2>(EGeometrieElement typmai,
- EEntiteMaillage typent,
- TInt mdim)
+ void
+ SetString(TInt theId,
+ TInt theStep,
+ TString& theString,
+ const std::string& theValue)
{
- return typmai%100;
+ TInt aSize = std::min(TInt(theValue.size()+1),theStep);
+ char* aPos = &theString[theId*theStep];
+ strncpy(aPos,theValue.c_str(),aSize);
}
- std::string GetString(TInt theId, TInt theStep,
- const TString& theString)
+ TInt
+ GetDimGaussCoord(EGeometrieElement theGeom)
{
- const char* aPos = &GETINDEX(theString,theId*theStep);
- TInt aSize = std::min(TInt(strlen(aPos)),theStep);
- return std::string(aPos,aSize);
+ return theGeom/100;
}
- void SetString(TInt theId, TInt theStep,
- TString& theString,
- const std::string& theValue)
+ TInt
+ GetNbRefCoord(EGeometrieElement theGeom)
{
- TInt aSize = std::min(TInt(theValue.size()+1),theStep);
- char* aPos = &GETINDEX(theString,theId*theStep);
- strncpy(aPos,theValue.c_str(),aSize);
+ return (theGeom%100);
}
}
//---------------------------------------------------------------
-TInt TFamilyInfo::GetAttrId(TInt theId) const {
- return GETINDEX(myAttrId,theId);
+TInt
+TFamilyInfo
+::GetAttrId(TInt theId) const
+{
+ return myAttrId[theId];
}
-TInt TFamilyInfo::GetAttrVal(TInt theId) const {
- return GETINDEX(myAttrVal,theId);
+TInt
+TFamilyInfo
+::GetAttrVal(TInt theId) const
+{
+ return myAttrVal[theId];
}
-void TFamilyInfo::SetAttrId(TInt theId,TInt theVal) {
- GETINDEX(myAttrId,theId) = theVal;
+void
+TFamilyInfo
+::SetAttrId(TInt theId,TInt theVal)
+{
+ myAttrId[theId] = theVal;
}
-void TFamilyInfo::SetAttrVal(TInt theId,TInt theVal) {
- GETINDEX(myAttrVal,theId) = theVal;
+void
+TFamilyInfo
+::SetAttrVal(TInt theId,TInt theVal)
+{
+ myAttrVal[theId] = theVal;
}
//---------------------------------------------------------------
-TInt TElemInfo::GetFamNum(TInt theId) const {
- return GETINDEX(myFamNum,theId);
+TInt
+TElemInfo
+::GetFamNum(TInt theId) const
+{
+ return myFamNum[theId];
}
-TInt TElemInfo::GetElemNum(TInt theId) const {
- return GETINDEX(myElemNum,theId);
+TInt
+TElemInfo
+::GetElemNum(TInt theId) const
+{
+ return myElemNum[theId];
}
-void TElemInfo::SetFamNum(TInt theId,TInt theVal) {
- GETINDEX(myFamNum,theId) = theVal;
+void
+TElemInfo
+::SetFamNum(TInt theId,TInt theVal)
+{
+ myFamNum[theId] = theVal;
}
//---------------------------------------------------------------
-TFloat TNodeInfo::GetNodeCoord(TInt theId,TInt theComp) const {
- return GETINDEX(myCoord,myMeshInfo->myDim*theId + theComp);
+TCCoordSlice
+TNodeInfo
+::GetCoordSlice(TInt theId) const
+{
+ TInt aDim = myMeshInfo->GetDim();
+ if(GetModeSwitch() == eFULL_INTERLACE)
+ return TCCoordSlice(myCoord,std::slice(theId*aDim,aDim,1));
+ else
+ return TCCoordSlice(myCoord,std::slice(theId,aDim,aDim));
}
-void TNodeInfo::SetNodeCoord(TInt theId,TInt theComp,TFloat theVal) {
- GETINDEX(myCoord,myMeshInfo->myDim*theId + theComp) = theVal;
+TCoordSlice
+TNodeInfo
+::GetCoordSlice(TInt theId)
+{
+ TInt aDim = myMeshInfo->GetDim();
+ if(GetModeSwitch() == eFULL_INTERLACE)
+ return TCoordSlice(myCoord,std::slice(theId*aDim,aDim,1));
+ else
+ return TCoordSlice(myCoord,std::slice(theId,aDim,aDim));
}
//---------------------------------------------------------------
-TInt TCellInfo::GetConn(TInt theElemId, TInt theConnId) const {
- return GETINDEX(myConn,GetConnDim()*theElemId + theConnId);
+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()));
+}
+
+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()));
}
-void TCellInfo::SetConn(TInt theElemId, TInt theConnId, TInt theVal){
- GETINDEX(myConn,GetConnDim()*theElemId + theConnId) = theVal;
+
+//---------------------------------------------------------------
+TInt
+TPolygoneInfo
+::GetNbConn(TInt theElemId) const
+{
+ return myIndex[theElemId + 1] - myIndex[theElemId];
}
-TConstConnSlice
-TCellInfo::GetConnSlice(TInt theElemId) const
+TCConnSlice
+TPolygoneInfo
+::GetConnSlice(TInt theElemId) const
{
- return TConstConnSlice(myConn,std::slice(GetConnDim()*theElemId,GetNbNodes(myTGeom),1));
+ return TCConnSlice(myConn,std::slice(myIndex[theElemId]-1,GetNbConn(theElemId),1));
}
TConnSlice
-TCellInfo::GetConnSlice(TInt theElemId)
+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
+::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
{
- return TConnSlice(myConn,std::slice(GetConnDim()*theElemId,GetNbNodes(myTGeom),1));
+ 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;
}
+
//---------------------------------------------------------------
-TInt TPolygoneInfo::GetNbConn(TInt theElemId) const {
- TInt i1 = GETINDEX(myIndex,theElemId);
- TInt i2 = GETINDEX(myIndex,theElemId+1);
- TInt ret = i2 - i1;
- return ret;
+TInt
+TProfileInfo
+::GetElemNum(TInt theId) const
+{
+ return myElemNum[theId];
+}
+
+void
+TProfileInfo
+::SetElemNum(TInt theId,TInt theVal)
+{
+ myElemNum[theId] = theVal;
}
//---------------------------------------------------------------
-TInt TPolyedreInfo::GetNbConn(TInt theElemId) const {
- TInt ind1 = GETINDEX(myIndex,theElemId);
- TInt ind2 = GETINDEX(myIndex,theElemId+1);
+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;
+}
+
+bool
+TGaussInfo::TLess
+::operator()(const TGaussInfo& theLeft, const TGaussInfo& theRight) const
+{
+ if(theLeft.myGeom != theRight.myGeom)
+ return theLeft.myGeom < theRight.myGeom;
- TInt inf1 = GETINDEX(myFacesIndex,ind1-1);
- TInt inf2 = GETINDEX(myFacesIndex,ind2-1);
+ if(theLeft.myRefCoord != theRight.myRefCoord)
+ return theLeft.myRefCoord < theRight.myRefCoord;
- TInt ret = inf2-inf1;
- return ret;
+ return theLeft.myGaussCoord < theRight.myGaussCoord;
+}
+
+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()));
+}
+
+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
+::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())
+ EXCEPTION(runtime_error,"TTimeStampInfo::GetNbGauss - myGeom2NbGauss.find(theGeom) fails");
+
+ return anIter->second;
+}
+
+
+//---------------------------------------------------------------
+void
+TMeshValue
+::Init(TInt theNbElem,
+ TInt theNbGauss,
+ TInt theNbComp,
+ EModeSwitch theMode)
+{
+ myModeSwitch = theMode;
+
+ myNbElem = theNbElem;
+ myNbGauss = theNbGauss;
+ myNbComp = theNbComp;
+
+ myStep = theNbComp*theNbGauss;
+
+ myValue.resize(theNbElem*myStep);
}
//---------------------------------------------------------------
-TFloat TTimeStampVal::GetVal(EGeometrieElement theGeom, TInt theId,
- TInt theComp, TInt theGauss) const {
- TInt aNbComp = myTimeStampInfo->myFieldInfo->myNbComp;
- TInt aNbGauss = myTimeStampInfo->myNbGauss;
- TInt aStep = aNbComp*aNbGauss;
- TMeshValue::const_iterator anIter = myMeshValue.find(theGeom);
- if(anIter != myMeshValue.end()){
- TFloat aRet=GETINDEX(anIter->second,theId*aStep + theComp*aNbGauss + theGauss);
- return aRet;
- }
- return TFloat();
-}
-
-void TTimeStampVal::SetVal(EGeometrieElement theGeom, TInt theId,
- TInt theComp, TFloat theVal, TInt theGauss)
-{
- TInt aNbComp = myTimeStampInfo->myFieldInfo->myNbComp;
- TInt aNbGauss = myTimeStampInfo->myNbGauss;
- TInt aStep = aNbComp*aNbGauss;
- GETINDEX(myMeshValue[theGeom],theId*aStep + theComp*aNbGauss + theGauss) = theVal;
+TCValueSliceArr
+TMeshValue
+::GetGaussValueSliceArr(TInt theElemId) const
+{
+ TCValueSliceArr aValueSliceArr(myNbGauss);
+ if(GetModeSwitch() == eFULL_INTERLACE){
+ TInt anId = theElemId*myStep;
+ for(TInt aGaussId = 0; aGaussId < myNbGauss; aGaussId++){
+ aValueSliceArr[aGaussId] =
+ TCValueSlice(myValue,std::slice(anId,myNbComp,1));
+ anId += myNbComp;
+ }
+ }
+ else{
+ for(TInt aGaussId = 0; aGaussId < myNbGauss; aGaussId++){
+ aValueSliceArr[aGaussId] =
+ TCValueSlice(myValue,std::slice(theElemId,myNbComp,myStep));
+ }
+ }
+ return aValueSliceArr;
+}
+
+TValueSliceArr
+TMeshValue
+::GetGaussValueSliceArr(TInt theElemId)
+{
+ TValueSliceArr aValueSliceArr(myNbGauss);
+ if(GetModeSwitch() == eFULL_INTERLACE){
+ TInt anId = theElemId*myStep;
+ for(TInt aGaussId = 0; aGaussId < myNbGauss; aGaussId++){
+ aValueSliceArr[aGaussId] =
+ TValueSlice(myValue,std::slice(anId,myNbComp,1));
+ anId += myNbComp;
+ }
+ }
+ else{
+ for(TInt aGaussId = 0; aGaussId < myNbGauss; aGaussId++){
+ aValueSliceArr[aGaussId] =
+ TValueSlice(myValue,std::slice(theElemId,myNbComp,myStep));
+ }
+ }
+ return aValueSliceArr;
+}
+
+//---------------------------------------------------------------
+TCValueSliceArr
+TMeshValue
+::GetCompValueSliceArr(TInt theElemId) const
+{
+ TCValueSliceArr aValueSliceArr(myNbComp);
+ if(GetModeSwitch() == eFULL_INTERLACE){
+ TInt anId = theElemId*myStep;
+ for(TInt aCompId = 0; aCompId < myNbComp; aCompId++){
+ aValueSliceArr[aCompId] =
+ TCValueSlice(myValue,std::slice(anId,myNbGauss,myNbComp));
+ anId += 1;
+ }
+ }
+ else{
+ for(TInt aCompId = 0; aCompId < myNbComp; aCompId++){
+ aValueSliceArr[aCompId] =
+ TCValueSlice(myValue,std::slice(theElemId,myNbGauss,myStep));
+ }
+ }
+ return aValueSliceArr;
+}
+
+
+TValueSliceArr
+TMeshValue
+::GetCompValueSliceArr(TInt theElemId)
+{
+ TValueSliceArr aValueSliceArr(myNbGauss);
+ if(GetModeSwitch() == eFULL_INTERLACE){
+ TInt anId = theElemId*myStep;
+ for(TInt aCompId = 0; aCompId < myNbComp; aCompId++){
+ aValueSliceArr[aCompId] =
+ TValueSlice(myValue,std::slice(anId,myNbGauss,myNbComp));
+ anId += 1;
+ }
+ }
+ else{
+ for(TInt aGaussId = 0; aGaussId < myNbGauss; aGaussId++){
+ aValueSliceArr[aGaussId] =
+ TValueSlice(myValue,std::slice(theElemId,myNbComp,myStep));
+ }
+ }
+ return aValueSliceArr;
+}
+
+
+//---------------------------------------------------------------
+const TMeshValue&
+TTimeStampVal
+::GetMeshValue(EGeometrieElement theGeom) const
+{
+ TGeom2Value::const_iterator anIter = myGeom2Value.find(theGeom);
+ if(anIter == myGeom2Value.end())
+ EXCEPTION(runtime_error,"TTimeStampVal::GetMeshValue - myGeom2Value.find(theGeom) fails");
+ return anIter->second;
+}
+
+TMeshValue&
+TTimeStampVal
+::GetMeshValue(EGeometrieElement theGeom)
+{
+ return myGeom2Value[theGeom];
}
#include "MED_Common.hxx"
-namespace MED{
+namespace MED
+{
//---------------------------------------------------------------
- typedef std::vector<char> TString;
+ //! Defines a type for managing sequence of strings
+ typedef TVector<char> TString;
+ //! Extract a substring from the sequence of the strings
std::string GetString(TInt theId, TInt theStep,
const TString& theString);
+ //! Set a substring in the sequence of the strings
void SetString(TInt theId, TInt theStep,
TString& theString,
const std::string& theValue);
//---------------------------------------------------------------
+ //! Define a parent class for all MEDWrapper classes
struct TBase
{
virtual ~TBase() {}
//---------------------------------------------------------------
+ //! Define a parent class for all named MED entities
struct TNameInfo: virtual TBase
{
- TString myName;
- virtual std::string GetName() const = 0;
- virtual void SetName(const std::string& theValue) = 0;
+ TString myName; //!< Keeps its name
+ virtual std::string GetName() const = 0; //!< Gets its name
+ virtual void SetName(const std::string& theValue) = 0; //!< Set a new name
};
//---------------------------------------------------------------
+ //! Define a parent class for all MED entities that contains a sequence of numbers
+ /*!
+ It defines through corresponding enumeration (EModeSwitch) how the sequence
+ should be interpreted in C or Fortran mode (eFULL_INTERLACE or eNON_INTERLACE).
+ */
+ struct TModeSwitchInfo: virtual TBase
+ {
+ //! To construct instance of the class by default
+ TModeSwitchInfo():
+ myModeSwitch(eFULL_INTERLACE)
+ {}
+
+ //! To construct instance of the class
+ TModeSwitchInfo(EModeSwitch theModeSwitch):
+ myModeSwitch(theModeSwitch)
+ {}
+
+ EModeSwitch myModeSwitch; //!< Keeps the
+ EModeSwitch GetModeSwitch() const { return myModeSwitch;}
+ };
+
+
+ //---------------------------------------------------------------
+ //! Define a base class which represents MED Mesh entity
struct TMeshInfo: virtual TNameInfo
{
- TInt myDim;
- TInt GetDim() const { return myDim;}
+ TInt myDim; //!< Dimension of the mesh (0, 1, 2 or 3)
+ TInt GetDim() const { return myDim;} //!< Gets dimension of the mesh
- EMaillage myType;
- EMaillage GetType() const { return myType;}
+ EMaillage myType; //!< Type of the mesh
+ EMaillage GetType() const { return myType;} //!< Gets type of the mesh
- TString myDesc;
- virtual std::string GetDesc() const = 0;
- virtual void SetDesc(const std::string& theValue) = 0;
+ TString myDesc; //!< Description of the mesh
+ virtual std::string GetDesc() const = 0; //!< Get description for the mesh
+ virtual void SetDesc(const std::string& theValue) = 0; //!< Sets description for the mesh
};
//---------------------------------------------------------------
- typedef std::vector<TInt> TFamAttr;
+ typedef TVector<TInt> TIntVector;
+ typedef TSlice<TIntVector> TIntVecSlice;
+ typedef TCSlice<TIntVector> TCIntVecSlice;
+ typedef TIntVector TFamAttr;
+
+ //! Define a base class which represents MED Family entity
struct TFamilyInfo: virtual TNameInfo
{
- PMeshInfo myMeshInfo;
- const PMeshInfo& GetMeshInfo() const { return myMeshInfo;}
+ PMeshInfo myMeshInfo; //!< A reference to correspondig MED Mesh
+ //! Get a reference to corresponding MED Mesh
+ const PMeshInfo& GetMeshInfo() const { return myMeshInfo;}
- TInt myId;
- TInt GetId() const { return myId;}
- void SetId(TInt theId) { myId = theId;}
+ 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 myNbGroup;
- TInt GetNbGroup() const { return myNbGroup;}
+ TInt myNbGroup; //!< Defines number MED Groups connected to
+ //! Gets number of MED GROUPS the MED FAMILY is bound to
+ TInt GetNbGroup() const { return myNbGroup;}
- TString myGroupNames;
+ //! Contains sequence of the names for the MED Groups connected to
+ 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;
- TInt GetNbAttr() const { return myNbAttr;}
+ TInt myNbAttr; //!< Defines number of the MED Family attributes
+ //! Gets number of attached attributes for the MED FAMILY
+ TInt GetNbAttr() const { return myNbAttr;}
- TFamAttr myAttrId;
+ //! Defines sequence of the indexes of the MED Family attributes
+ TFamAttr myAttrId;
+ //! Get MED FAMILY attribute by its number
TInt GetAttrId(TInt theId) const;
+ //! Set MED FAMILY attribute by its number
void SetAttrId(TInt theId, TInt theVal);
+ //! Defines sequence of the values of the MED Family attributes
TFamAttr myAttrVal;
+ //! Get MED FAMILY attribute by its number
TInt GetAttrVal(TInt theId) const;
+ //! Set MED FAMILY attribute by its number
void SetAttrVal(TInt theId, TInt theVal);
+ //! Defines sequence of the names of the MED Family attributes
TString myAttrDesc;
+ //! Get value of the MED FAMILY attribute by its number
virtual std::string GetAttrDesc(TInt theId) const = 0;
+ //! Set value of the MED FAMILY attribute by its number
virtual void SetAttrDesc(TInt theId, const std::string& theValue) = 0;
};
//---------------------------------------------------------------
- typedef std::vector<TInt> TElemNum;
+ typedef TIntVector TElemNum;
+ //! Define a parent class for all MED entities that describes mesh entites such as nodes and cells.
struct TElemInfo: virtual TBase
{
- PMeshInfo myMeshInfo;
+ PMeshInfo myMeshInfo; //!< A reference to correspondig MED Mesh
+ //! Get a reference to corresponding MED Mesh
const PMeshInfo& GetMeshInfo() const { return myMeshInfo;}
- TInt myNbElem;
- TInt GetNbElem() const { return myNbElem;}
+ TInt myNbElem; //<! Number of corresponding mesh entities
+ TInt GetNbElem() const { return myNbElem;} //! Get number of mesh elements
- TElemNum myFamNum;
+ //! Defines sequence MED Family indexes for corresponding mesh entites
+ 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
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;}
+ //! Contains sequence of the indexes for the mesh elements
TElemNum myElemNum;
+ //! Get a reference number of the mesh element by its order number
TInt GetElemNum(TInt theId) const;
+ //! Set a reference number for the mesh element by its order number
void SetElemNum(TInt theId, TInt theVal);
+ //! Defines if the mesh elements are named
EBooleen myIsElemNames;
+ //! Let know if the mesh elements havew names
EBooleen IsElemNames() const { return myIsElemNames;}
+ //! Contains sequence of the names for the mesh elements
TString myElemNames;
+ //! Get name of the mesh element by its order number
virtual std::string GetElemName(TInt theId) const = 0;
+ //! Set name of the mesh element by its order number
virtual void SetElemName(TInt theId, const std::string& theValue) = 0;
};
//---------------------------------------------------------------
- typedef std::vector<TFloat> TNodeCoord;
-
- struct TNodeInfo: virtual TElemInfo
+ typedef TVector<TFloat> TFloatVector;
+ typedef TSlice<TFloatVector> TFloatVecSlice;
+ typedef TCSlice<TFloatVector> TCFloatVecSlice;
+
+ typedef TFloatVector TNodeCoord;
+ typedef TFloatVecSlice TCoordSlice;
+ typedef TCFloatVecSlice TCCoordSlice;
+
+ //! Define a base class which represents MED Nodes entity
+ struct TNodeInfo:
+ virtual TElemInfo,
+ virtual TModeSwitchInfo
{
- TNodeCoord myCoord;
- TFloat GetNodeCoord(TInt theId, TInt theComp) const;
- void SetNodeCoord(TInt theId, TInt theComp, TFloat theVal);
+ TNodeCoord myCoord; //!< Contains all nodal coordinates
- ERepere mySystem;
+ //! Gives coordinates for mesh node by its number (const version)
+ TCCoordSlice GetCoordSlice(TInt theId) const;
+ //! Gives coordinates for mesh node by its number
+ TCoordSlice GetCoordSlice(TInt theId);
+
+ ERepere mySystem; //!< Defines, which coordinate system is used
+ //! Get which coordinate system is used for the node describing
ERepere GetSystem() const { return mySystem;}
+ //! Set coordinate system to be used for the node describing
void SetSystem(ERepere theSystem) { mySystem = theSystem;}
- TString myCoordNames;
+ TString myCoordNames; //!< Contains names for the coordinate dimensions
+ //! Get name of the coordinate dimension by its order number
virtual std::string GetCoordName(TInt theId) const = 0;
+ //! Set name of the coordinate dimension by its order number
virtual void SetCoordName(TInt theId, const std::string& theValue) = 0;
- TString myCoordUnits;
+ TString myCoordUnits; //!< Contains units for the coordinate dimensions
+ //! Get name of unit for the coordinate dimension by its order number
virtual std::string GetCoordUnit(TInt theId) const = 0;
+ //! Set name of unit for the coordinate dimension by its order number
virtual void SetCoordUnit(TInt theId, const std::string& theValue) = 0;
};
//---------------------------------------------------------------
- typedef SliceArray<TElemNum> TConnSlice;
- typedef ConstSliceArray<TElemNum> TConstConnSlice;
+ typedef TIntVecSlice TConnSlice;
+ typedef TCIntVecSlice TCConnSlice;
- struct TCellInfo: virtual TElemInfo
+ //! Define a base class which represents MED Cells entity
+ struct TCellInfo:
+ virtual TElemInfo,
+ virtual TModeSwitchInfo
{
- EEntiteMaillage myTEntity;
- EEntiteMaillage GetEntity() const { return myTEntity;}
+ 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;}
- EGeometrieElement myTGeom;
- EGeometrieElement GetGeom() const { return myTGeom;}
+ 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;}
- EConnectivite myTConn;
- EConnectivite GetConn() const { return myTConn;}
+ EConnectivite myConnMode; //!< Defines connectivity mode
+ //! Let known in what connectivity the cells are writen
+ EConnectivite GetConnMode() const { return myConnMode;}
- virtual TInt GetConnDim() const = 0;
+ virtual TInt GetConnDim() const = 0; //!< Gives step in the connectivity sequence
- TElemNum myConn;
- TConstConnSlice GetConnSlice(TInt theElemId) const;
- TConnSlice GetConnSlice(TInt theElemId);
+ TElemNum myConn; //!< Defines sequence which describe connectivity for ech of mesh cell
- TInt GetConn(TInt theElemId, TInt theConnId) const;
- void SetConn(TInt theElemId, TInt theConnId, TInt theVal);
+ //! Gives connectivities for mesh cell by its number (const version)
+ TCConnSlice GetConnSlice(TInt theElemId) const;
+ //! Gives connectivities for mesh cell by its number
+ TConnSlice GetConnSlice(TInt theElemId);
};
//---------------------------------------------------------------
- struct TPolygoneInfo: virtual TElemInfo
+ //! Define a base class which represents MED Polygon entity
+ struct TPolygoneInfo:
+ virtual TElemInfo
{
- EEntiteMaillage myTEntity; // MED_FACE|MED_MAILLE
- EEntiteMaillage GetEntity() const { return myTEntity;}
+ //! 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;}
- EGeometrieElement myTGeom; // ePOLYGONE
+ //! 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;}
- EConnectivite myTConn; // eNOD|eDESC(eDESC not used)
- EConnectivite GetConn() const { return myTConn;}
-
- TInt myConnDim;
- TInt GetConnDim() const { return myConnDim;}
+ //! Defines connectivity mode
+ EConnectivite myConnMode; // eNOD|eDESC(eDESC not used)
+ //! Let known in what connectivity the cells are writen
+ EConnectivite GetConnMode() const { return myConnMode;}
- TElemNum myConn; // Table de connectivities
- TElemNum GetConnectivite() const { return myConn;}
+ TElemNum myConn; //!< Table de connectivities
+ TElemNum myIndex; //!< Table de indexes
- TElemNum myIndex; // Table de indexes
- TElemNum GetIndex() {return myIndex;}
+ //! Gives number of the connectivities for the defined polygon
TInt GetNbConn(TInt theElemId) const;
+
+ //! Gives connectivities for polygon by its number (const version)
+ TCConnSlice GetConnSlice(TInt theElemId) const;
+ //! Gives connectivities for polygon by its number
+ TConnSlice GetConnSlice(TInt theElemId);
};
//---------------------------------------------------------------
- struct TPolyedreInfo: virtual TElemInfo
+ typedef TVector<TCConnSlice> TCConnSliceArr;
+ typedef TVector<TConnSlice> TConnSliceArr;
+
+ //! Define a base class which represents MED Polyedre entity
+ struct TPolyedreInfo:
+ virtual TElemInfo
{
- EEntiteMaillage myTEntity; // MED_FACE|MED_MAILLE
- EEntiteMaillage GetEntity() const { return myTEntity;}
+ //! 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;}
- EGeometrieElement myTGeom; // ePOLYEDRE
+ //! 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;}
- EConnectivite myTConn; // eNOD|eDESC(eDESC not used)
- EConnectivite GetConn() const { return myTConn;}
+ //! Defines connectivity mode
+ EConnectivite myConnMode; // eNOD|eDESC(eDESC not used)
+ //! Let known in what connectivity the cells are writen
+ EConnectivite GetConnMode() const { return myConnMode;}
- TInt myNbConn;
- TInt GetNbConn() const { return myNbConn;}
+ TElemNum myConn; //!< Table de connectivities
+ TElemNum myFaces; //!< Table de faces indexes
+ TElemNum myIndex; //!< Table de indexes
- TElemNum myConn; // Table de connectivities
- TElemNum GetConnectivite() const { return myConn;}
-
- TInt myNbFacesIndex;
- TInt GetNbFacesIndex() const { return myNbFacesIndex;}
-
- TElemNum myFacesIndex; // Table de faces indexes
- TElemNum GetFacesIndex() {return myFacesIndex;}
-
- TElemNum myIndex; // Table de indexes
- TElemNum GetIndex() {return myIndex;}
- TInt GetNbConn(TInt theElemId) const;
+ //! Gives number of the faces for the defined polyedre (const version)
+ TInt GetNbFaces(TInt theElemId) const;
+ //! Gives number of the nodes for the defined polyedre
+ TInt GetNbNodes(TInt theElemId) const;
+
+ //! Gives sequence of the face connectivities for polyedre by its number (const version)
+ TCConnSliceArr GetConnSliceArr(TInt theElemId) const;
+ //! Gives sequence of the face connectivities for polyedre by its number
+ TConnSliceArr GetConnSliceArr(TInt theElemId);
};
//---------------------------------------------------------------
- struct TFieldInfo: virtual TNameInfo
+ //! Define a base class which represents MED Field entity
+ struct TFieldInfo:
+ virtual TNameInfo
{
- PMeshInfo myMeshInfo;
+ PMeshInfo myMeshInfo; //!< A reference to correspondig MED Mesh
+ //! Get a reference to corresponding MED Mesh
const PMeshInfo& GetMeshInfo() const { return myMeshInfo;}
- ETypeChamp myType;
+ ETypeChamp myType; //!< Defines type of the MED Field
+ //! Let known what type of the MED FIELD is used
ETypeChamp GetType() const { return myType;}
- TInt myNbComp;
+ TInt myNbComp; //!< Defines number of components stored in the field
+ //! Get number of components for the MED FIELD
TInt GetNbComp() const { return myNbComp;}
- EBooleen myIsLocal;
+ EBooleen myIsLocal; //!< Defines if the MED Field is local
+ //! Let known is the MED FIELD is local or not
EBooleen GetIsLocal() const { return myIsLocal;}
- TInt myNbRef;
+ TInt myNbRef; //!< Defines number of refereces of the field
+ //! Let known number of references for the MED FIELD
TInt GetNbRef() const { return myNbRef;}
- TString myCompNames;
+ TString myCompNames; //!< Contains names for each of MED Field components
+ //! Get name of the component by its order number
virtual std::string GetCompName(TInt theId) const = 0;
+ //! Set name for the component by its order number
virtual void SetCompName(TInt theId, const std::string& theValue) = 0;
- TString myUnitNames;
+ TString myUnitNames; //!< Contains units for each of MED Field components
+ //! Get unit of the component by its order number
virtual std::string GetUnitName(TInt theId) const = 0;
+ //! Set unit for the component by its order number
virtual void SetUnitName(TInt theId, const std::string& theValue) = 0;
};
//---------------------------------------------------------------
- struct TTimeStampInfo: virtual TBase
+ //! Get dimension of the Gauss coordinates for the defined type of mesh cell
+ TInt
+ GetDimGaussCoord(EGeometrieElement theGeom);
+
+ //! Get number of referenced nodes for the defined type of mesh cell
+ TInt
+ GetNbRefCoord(EGeometrieElement theGeom);
+
+ typedef TFloatVector TWeight;
+
+ //! The class represents MED Gauss entity
+ struct TGaussInfo:
+ virtual TNameInfo,
+ virtual TModeSwitchInfo
+ {
+ typedef boost::tuple<EGeometrieElement,std::string> TKey;
+ typedef boost::tuple<TKey,TInt> TInfo;
+ struct TLess
+ {
+ bool
+ operator()(const TKey& theLeft, const TKey& theRight) const;
+
+ bool
+ operator()(const TGaussInfo& theLeft, const TGaussInfo& theRight) const;
+ };
+
+ //! Defines, which geometrical type the MED Gauss entity belongs to
+ EGeometrieElement myGeom;
+ //! Let known what MED geometrical type the MED GAUSS entity belong to
+ EGeometrieElement GetGeom() const { return myGeom;}
+
+ //! Contains coordinates for the refereced nodes
+ TNodeCoord myRefCoord;
+
+ //! Gives coordinates for the referenced node by its number
+ TCCoordSlice GetRefCoordSlice(TInt theId) const;
+ //! Gives coordinates for the referenced node by its number
+ TCoordSlice GetRefCoordSlice(TInt theId);
+
+ //! Contains coordinates for the Gauss points
+ TNodeCoord myGaussCoord;
+
+ //! Gives coordinates for the Gauss points by its number
+ TCCoordSlice GetGaussCoordSlice(TInt theId) const;
+ //! Gives coordinates for the Gauss points by its number
+ TCoordSlice GetGaussCoordSlice(TInt theId);
+
+ //! Contains wheights for the Gauss points
+ TWeight myWeight;
+
+ //! Gives number of the referenced nodes
+ TInt GetNbRef() const { return GetNbRefCoord(GetGeom());}
+
+ //! Gives dimension of the referenced nodes
+ TInt GetDim() const { return GetDimGaussCoord(GetGeom());}
+
+ //! Gives number of the Gauss Points
+ TInt GetNbGauss() const { return myGaussCoord.size()/GetDim();}
+ };
+
+
+ //---------------------------------------------------------------
+ typedef std::map<EGeometrieElement,PGaussInfo> TGeom2Gauss;
+ typedef std::map<EGeometrieElement,TInt> TGeom2NbGauss;
+
+ //! Define a base class which represents MED TimeStamp
+ struct TTimeStampInfo:
+ virtual TBase
{
- PFieldInfo myFieldInfo;
+ PFieldInfo myFieldInfo; //!< A reference to correspondig MED Field
+ //! Get a reference to corresponding MED Field
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;}
- TGeom myGeom;
- const TGeom& GetGeom() const { return myGeom;}
+ //! 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;}
+
+ 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 myNbGauss, myNumDt, myNumOrd;
- TInt GetNbGauss() const { return myNbGauss;}
- TInt GetNumDt() const { return myNumDt;}
- TInt GetNumOrd() const { return myNumOrd;}
+ TInt myNumDt; //!< Keeps number in time for the MED TimeStamp
+ TInt GetNumDt() const { return myNumDt;} //!< Defines number in time for the MED TimeStamp
- TFloat myDt;
- TFloat GetDt() const { return myDt;}
+ TInt myNumOrd; //!< Keeps number for the MED TimeStamp
+ TInt GetNumOrd() const { return myNumOrd;} //!< Defines number for the MED TimeStamp
- TString myGaussName;
- virtual std::string GetGaussName() const = 0;
- virtual void SetGaussName(const std::string& theValue) = 0;
+ TFloat myDt; //!< Keeps time for the MED TimeStamp
+ TFloat GetDt() const { return myDt;} //!< Defines time for the MED TimeStamp
- TString myUnitDt;
+ //! 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;}
+
+ TString myUnitDt; //!< Defines unit for the time for the MED TimeStamp
+ //! Get unit of time for the MED TimeStamp
virtual std::string GetUnitDt() const = 0;
+ //! Set unit of time for the MED TimeStamp
virtual void SetUnitDt(const std::string& theValue) = 0;
};
//---------------------------------------------------------------
- typedef std::vector<TFloat> TValue;
- typedef std::map<EGeometrieElement,TValue> TMeshValue;
+ //! The class represents MED Profile entity
+ struct TProfileInfo:
+ virtual TNameInfo
+ {
+ typedef std::string TKey;
+ typedef boost::tuple<TKey,TInt> TInfo;
+
+ EModeProfil myMode; //!< Keeps mode for the MED Profile
+ //! Let known what mode of MED Profile is used
+ EModeProfil GetMode() const { return myMode;}
+ //! Set mode for the MED Profile
+ void SetMode(EModeProfil theMode) { myMode = theMode;}
+
+ TElemNum myElemNum; //!< Keeps sequence of cell by its number which belong to the profile
+ //! Get number of mesh elelemts by its order number
+ TInt GetElemNum(TInt theId) const;
+ //! Set 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() != "";}
+
+ //! Let known size of the MED Profile
+ TInt GetSize() const { return myElemNum.size();}
+ };
+
+
+ //---------------------------------------------------------------
+ typedef TFloatVector TValue;
+ typedef TSlice<TValue> TValueSlice;
+ typedef TCSlice<TValue> TCValueSlice;
+
+ typedef TVector<TCValueSlice> TCValueSliceArr;
+ typedef TVector<TValueSlice> TValueSliceArr;
- struct TTimeStampVal: virtual TBase
+ //! The class is a helper one. It provide safe and flexible way to get access to values for a MED TimeStamp
+ struct TMeshValue:
+ virtual TModeSwitchInfo
{
- PTimeStampInfo myTimeStampInfo;
+ TValue myValue;
+
+ TInt myNbElem;
+ TInt myNbComp;
+ TInt myNbGauss;
+ TInt myStep;
+
+ //! Initialize the class
+ void
+ Init(TInt theNbElem,
+ TInt theNbGauss,
+ TInt theNbComp,
+ EModeSwitch theMode = eFULL_INTERLACE);
+
+ //! Iteration through Gauss Points by their components
+ TCValueSliceArr
+ GetGaussValueSliceArr(TInt theElemId) const;
+
+ //! Iteration through Gauss Points by their components
+ TValueSliceArr
+ GetGaussValueSliceArr(TInt theElemId);
+
+ //! Iteration through components by corresponding Gauss Points
+ TCValueSliceArr
+ GetCompValueSliceArr(TInt theElemId) const;
+
+ //! Iteration through components by corresponding Gauss Points
+ TValueSliceArr
+ GetCompValueSliceArr(TInt theElemId);
+ };
+
+
+ //---------------------------------------------------------------
+ typedef std::map<EGeometrieElement,TMeshValue> TGeom2Value;
+ typedef std::map<EGeometrieElement,PProfileInfo> TGeom2Profile;
+
+ //! The class implements a container for MED TimeStamp values
+ struct TTimeStampVal:
+ virtual TModeSwitchInfo
+ {
+ PTimeStampInfo myTimeStampInfo; //!< A reference to correspondig MED TimeStamp
+ //!< Get a reference to correspondig MED TimeStamp
const PTimeStampInfo& GetTimeStampInfo() const { return myTimeStampInfo;}
- TMeshValue myMeshValue;
- TFloat GetVal(EGeometrieElement theGeom, TInt theId,
- TInt theComp, TInt theGauss = 0) const;
+ //! 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;}
+
+ TGeom2Value myGeom2Value;
- void SetVal(EGeometrieElement theGeom, TInt theId,
- TInt theComp, TFloat theVal, TInt theGauss = 0);
- EModeProfil myPflMode;
- EModeProfil GetPflMode() const { return myPflMode;}
- void GetPflMode(EModeProfil theVal) { myPflMode = theVal;}
+ //! Keeps map of MED TimeStamp values per geometric type (const version)
+ const TMeshValue& GetMeshValue(EGeometrieElement theGeom) const;
- TString myPflName;
- virtual std::string GetPflName() const = 0;
- virtual void SetPflName(const std::string& theValue) = 0;
+ //! Keeps map of MED TimeStamp values per geometric type
+ TMeshValue& GetMeshValue(EGeometrieElement theGeom);
};
}
#include "MED_Structures.hxx"
-namespace MED{
-
- const TInt DESC = 200;
- const TInt IDENT = 8;
- const TInt NOM = 32;
- const TInt LNOM = 80;
-
+namespace MED
+{
//---------------------------------------------------------------
- template<TInt nPNOM, TInt nDESC, TInt nIDENT, TInt nNOM, TInt nLNOM, EVersion nV>
+ template<EVersion eVersion>
struct TTNameInfo: virtual TNameInfo
{
- TTNameInfo(const std::string& theValue = "")
+ TTNameInfo(const std::string& theValue)
{
- myName.resize(nNOM+1);
+ myName.resize(GetNOMLength<eVersion>()+1);
SetName(theValue);
}
- virtual std::string GetName() const {
- return GetString(0,nNOM,myName);
+ virtual
+ std::string
+ GetName() const
+ {
+ return GetString(0,GetNOMLength<eVersion>(),myName);
}
- virtual void SetName(const std::string& theValue){
- SetString(0,nNOM,myName,theValue);
+ virtual
+ void
+ SetName(const std::string& theValue)
+ {
+ SetString(0,GetNOMLength<eVersion>(),myName,theValue);
}
};
//---------------------------------------------------------------
- template<TInt nPNOM, TInt nDESC, TInt nIDENT, TInt nNOM, TInt nLNOM, EVersion nV>
+ template<EVersion eVersion>
struct TTMeshInfo:
virtual TMeshInfo,
- virtual TTNameInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
+ virtual TTNameInfo<eVersion>
{
- typedef TTNameInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV> TNameInfoBase;
+ typedef TTNameInfo<eVersion> TNameInfoBase;
TTMeshInfo(const PMeshInfo& theInfo):
TNameInfoBase(theInfo->GetName())
myDim = theInfo->GetDim();
myType = theInfo->GetType();
- myDesc.resize(nDESC+1);
+ myDesc.resize(GetDESCLength<eVersion>()+1);
SetDesc(theInfo->GetDesc());
}
- TTMeshInfo(TInt theDim = 0,
- const std::string& theValue = "",
- EMaillage theType = eNON_STRUCTURE,
- const std::string& theDesc = ""):
+ TTMeshInfo(TInt theDim,
+ const std::string& theValue,
+ EMaillage theType,
+ const std::string& theDesc):
TNameInfoBase(theValue)
{
myDim = theDim;
myType = theType;
- myDesc.resize(nDESC+1);
+ myDesc.resize(GetDESCLength<eVersion>()+1);
SetDesc(theDesc);
}
- virtual std::string GetDesc() const {
- return GetString(0,nDESC,myDesc);
+ virtual
+ std::string
+ GetDesc() const
+ {
+ return GetString(0,GetDESCLength<eVersion>(),myDesc);
}
- virtual void SetDesc(const std::string& theValue){
- SetString(0,nDESC,myDesc,theValue);
+ virtual
+ void
+ SetDesc(const std::string& theValue)
+ {
+ SetString(0,GetDESCLength<eVersion>(),myDesc,theValue);
}
};
//---------------------------------------------------------------
- template<TInt nPNOM, TInt nDESC, TInt nIDENT, TInt nNOM, TInt nLNOM, EVersion nV>
+ template<EVersion eVersion>
struct TTFamilyInfo:
virtual TFamilyInfo,
- virtual TTNameInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
+ virtual TTNameInfo<eVersion>
{
- typedef TTNameInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV> TNameInfoBase;
+ typedef TTNameInfo<eVersion> TNameInfoBase;
TTFamilyInfo(const PMeshInfo& theMeshInfo, const PFamilyInfo& theInfo):
TNameInfoBase(theInfo->GetName())
myId = theInfo->GetId();
myNbGroup = theInfo->GetNbGroup();
- myGroupNames.resize(myNbGroup*nLNOM+1);
+ myGroupNames.resize(myNbGroup*GetLNOMLength<eVersion>()+1);
if(myNbGroup){
for(TInt anId = 0; anId < myNbGroup; anId++){
SetGroupName(anId,theInfo->GetGroupName(anId));
myNbAttr = theInfo->GetNbAttr();
myAttrId.resize(myNbAttr);
myAttrVal.resize(myNbAttr);
- myAttrDesc.resize(myNbAttr*nDESC+1);
+ myAttrDesc.resize(myNbAttr*GetDESCLength<eVersion>()+1);
if(myNbAttr){
for(TInt anId = 0; anId < myNbAttr; anId++){
SetAttrDesc(anId,theInfo->GetAttrDesc(anId));
}
TTFamilyInfo(const PMeshInfo& theMeshInfo,
- TInt theNbGroup = 0,
- TInt theNbAttr = 0,
- TInt theId = 0,
- const std::string& theValue = ""):
+ TInt theNbGroup,
+ TInt theNbAttr,
+ TInt theId,
+ const std::string& theValue):
TNameInfoBase(theValue)
{
myMeshInfo = theMeshInfo;
myId = theId;
myNbGroup = theNbGroup;
- myGroupNames.resize(theNbGroup*nLNOM+1);
+ myGroupNames.resize(theNbGroup*GetLNOMLength<eVersion>()+1);
myNbAttr = theNbAttr;
myAttrId.resize(theNbAttr);
myAttrVal.resize(theNbAttr);
- myAttrDesc.resize(theNbAttr*nDESC+1);
+ myAttrDesc.resize(theNbAttr*GetDESCLength<eVersion>()+1);
}
TTFamilyInfo(const PMeshInfo& theMeshInfo,
const std::string& theValue,
TInt theId,
const TStringSet& theGroupNames,
- const TStringVector& theAttrDescs = TStringVector(),
- const TIntVector& theAttrIds = TIntVector(),
- const TIntVector& theAttrVals = TIntVector()):
+ const TStringVector& theAttrDescs,
+ const TIntVector& theAttrIds,
+ const TIntVector& theAttrVals):
TNameInfoBase(theValue)
{
myMeshInfo = theMeshInfo;
myId = theId;
myNbGroup = theGroupNames.size();
- myGroupNames.resize(myNbGroup*nLNOM+1);
+ myGroupNames.resize(myNbGroup*GetLNOMLength<eVersion>()+1);
if(myNbGroup){
TStringSet::const_iterator anIter = theGroupNames.begin();
for(TInt anId = 0; anIter != theGroupNames.end(); anIter++, anId++){
myNbAttr = theAttrDescs.size();
myAttrId.resize(myNbAttr);
myAttrVal.resize(myNbAttr);
- myAttrDesc.resize(myNbAttr*nDESC+1);
+ myAttrDesc.resize(myNbAttr*GetDESCLength<eVersion>()+1);
if(myNbAttr){
for(TInt anId = 0, anEnd = theAttrDescs.size(); anId < anEnd; anId++){
SetAttrDesc(anId,theAttrDescs[anId]);
}
}
- virtual std::string GetGroupName(TInt theId) const {
- return GetString(theId,nLNOM,myGroupNames);
+ virtual
+ std::string
+ GetGroupName(TInt theId) const
+ {
+ return GetString(theId,GetLNOMLength<eVersion>(),myGroupNames);
}
- virtual void SetGroupName(TInt theId, const std::string& theValue){
- SetString(theId,nLNOM,myGroupNames,theValue);
+ virtual
+ void
+ SetGroupName(TInt theId, const std::string& theValue)
+ {
+ SetString(theId,GetLNOMLength<eVersion>(),myGroupNames,theValue);
}
- virtual std::string GetAttrDesc(TInt theId) const {
- return GetString(theId,nDESC,myAttrDesc);
+ virtual
+ std::string
+ GetAttrDesc(TInt theId) const
+ {
+ return GetString(theId,GetDESCLength<eVersion>(),myAttrDesc);
}
- virtual void SetAttrDesc(TInt theId, const std::string& theValue){
- SetString(theId,nDESC,myAttrDesc,theValue);
+ virtual
+ void
+ SetAttrDesc(TInt theId, const std::string& theValue)
+ {
+ SetString(theId,GetDESCLength<eVersion>(),myAttrDesc,theValue);
}
};
//---------------------------------------------------------------
- template<TInt nPNOM, TInt nDESC, TInt nIDENT, TInt nNOM, TInt nLNOM, EVersion nV>
+ template<EVersion eVersion>
struct TTElemInfo: virtual TElemInfo
{
TTElemInfo(const PMeshInfo& theMeshInfo, const PElemInfo& theInfo)
myElemNum.resize(myIsElemNum == eFAUX? 0: myNbElem);
myIsElemNames = theInfo->IsElemNames();
- myElemNames.resize(myNbElem*nPNOM+1);
+ myElemNames.resize(myNbElem*GetPNOMLength<eVersion>()+1);
if(myNbElem){
for(TInt anId = 0; anId < myNbElem; anId++){
TTElemInfo(const PMeshInfo& theMeshInfo,
TInt theNbElem,
- EBooleen theIsElemNum = eVRAI,
- EBooleen theIsElemNames = eVRAI)
+ EBooleen theIsElemNum,
+ EBooleen theIsElemNames)
{
myMeshInfo = theMeshInfo;
myFamNum.resize(theNbElem);
myIsElemNum = theIsElemNum;
- myElemNum.resize(theIsElemNum == eFAUX? 0: theNbElem);
+ if(theIsElemNum)
+ myElemNum.resize(theNbElem);
myIsElemNames = theIsElemNames;
- myElemNames.resize(theNbElem*nPNOM+1);
+ if(theIsElemNames)
+ myElemNames.resize(theNbElem*GetPNOMLength<eVersion>()+1);
}
TTElemInfo(const PMeshInfo& theMeshInfo,
+ TInt theNbElem,
const TIntVector& theFamilyNums,
const TIntVector& theElemNums,
- const TStringVector& theElemNames = TStringVector())
+ const TStringVector& theElemNames)
{
myMeshInfo = theMeshInfo;
- myNbElem = theFamilyNums.size();
- myFamNum.resize(myNbElem);
+ myNbElem = theNbElem;
myIsElemNum = theElemNums.size()? eVRAI: eFAUX;
- myElemNum.resize(theElemNums.size());
+ if(myIsElemNum)
+ myElemNum.resize(theNbElem);
myIsElemNames = theElemNames.size()? eVRAI: eFAUX;
- myElemNames.resize(theElemNames.size()*nPNOM+1);
+ if(myIsElemNames)
+ myElemNames.resize(theNbElem*GetPNOMLength<eVersion>()+1);
- if(myNbElem){
- for(TInt anId = 0; anId < myNbElem; anId++){
- myFamNum[anId] = theFamilyNums[anId];
- }
- if(myIsElemNum == eVRAI){
- for(TInt anId = 0; anId < myNbElem; anId++){
- myElemNum[anId] = theElemNums[anId];
- }
- }
- if(myIsElemNames == eVRAI){
- for(TInt anId = 0; anId < myNbElem; anId++){
+ if(theNbElem){
+
+ myFamNum.resize(theNbElem);
+ if(theFamilyNums.size())
+ myFamNum = theFamilyNums;
+
+ if(myIsElemNum)
+ myElemNum = theElemNums;
+
+ if(myIsElemNames){
+ for(TInt anId = 0; anId < theNbElem; anId++){
const std::string& aVal = theElemNames[anId];
SetElemName(anId,aVal);
}
}
}
- virtual std::string GetElemName(TInt theId) const {
- return GetString(theId,nPNOM,myElemNames);
+ virtual
+ std::string
+ GetElemName(TInt theId) const
+ {
+ return GetString(theId,GetPNOMLength<eVersion>(),myElemNames);
}
- virtual void SetElemName(TInt theId, const std::string& theValue){
- SetString(theId,nPNOM,myElemNames,theValue);
+ virtual
+ void
+ SetElemName(TInt theId, const std::string& theValue)
+ {
+ SetString(theId,GetPNOMLength<eVersion>(),myElemNames,theValue);
}
};
//---------------------------------------------------------------
- template<TInt nPNOM, TInt nDESC, TInt nIDENT, TInt nNOM, TInt nLNOM, EVersion nV>
+ template<EVersion eVersion>
struct TTNodeInfo:
virtual TNodeInfo,
- virtual TTElemInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
+ virtual TTElemInfo<eVersion>
{
- typedef TTElemInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV> TElemInfoBase;
+ typedef TTElemInfo<eVersion> TElemInfoBase;
TTNodeInfo(const PMeshInfo& theMeshInfo, const PNodeInfo& theInfo):
- TElemInfoBase(theMeshInfo,theInfo)
+ TElemInfoBase(theMeshInfo,theInfo),
+ TNodeInfo(theInfo)
{
+ myModeSwitch = theInfo->GetModeSwitch();
+
mySystem = theInfo->GetSystem();
-
- TInt aDim = theMeshInfo->GetDim();
- TInt aNbElem = theInfo->GetNbElem();
- myCoord.resize(aNbElem*aDim);
- for(TInt anElemId = 0; anElemId < aNbElem; anElemId++){
- for(TInt anDimId = 0; anDimId < aDim; anDimId++){
- SetNodeCoord(anElemId,anDimId,theInfo->GetNodeCoord(anElemId,anDimId));
- }
- }
+ myCoord = theInfo->myCoord;
+
+ TInt aDim = theMeshInfo->GetDim();
- myCoordNames.resize(aDim*nPNOM+1);
- for(TInt anId = 0; anId < aDim; anId++){
+ myCoordNames.resize(aDim*GetPNOMLength<eVersion>()+1);
+ for(TInt anId = 0; anId < aDim; anId++)
SetCoordName(anId,theInfo->GetCoordName(anId));
- }
- myCoordUnits.resize(aDim*nPNOM+1);
- for(TInt anId = 0; anId < aDim; anId++){
+ myCoordUnits.resize(aDim*GetPNOMLength<eVersion>()+1);
+ for(TInt anId = 0; anId < aDim; anId++)
SetCoordUnit(anId,theInfo->GetCoordUnit(anId));
- }
}
TTNodeInfo(const PMeshInfo& theMeshInfo,
TInt theNbElem,
- ERepere theSystem = eCART,
- EBooleen theIsElemNum = eVRAI,
- EBooleen theIsElemNames = eVRAI):
+ EModeSwitch theMode,
+ ERepere theSystem,
+ EBooleen theIsElemNum,
+ EBooleen theIsElemNames):
TElemInfoBase(theMeshInfo,
theNbElem,
theIsElemNum,
- theIsElemNames)
+ theIsElemNames),
+ TModeSwitchInfo(theMode)
{
mySystem = theSystem;
+
myCoord.resize(theNbElem*theMeshInfo->myDim);
- myCoordNames.resize(theMeshInfo->myDim*nPNOM+1);
- myCoordUnits.resize(theMeshInfo->myDim*nPNOM+1);
+
+ if(theIsElemNum)
+ myCoordUnits.resize(theMeshInfo->myDim*GetPNOMLength<eVersion>()+1);
+
+ if(theIsElemNames)
+ myCoordNames.resize(theMeshInfo->myDim*GetPNOMLength<eVersion>()+1);
}
TTNodeInfo(const PMeshInfo& theMeshInfo,
- ERepere theSystem,
const TFloatVector& theNodeCoords,
+ EModeSwitch theMode,
+ ERepere theSystem,
const TStringVector& theCoordNames,
const TStringVector& theCoordUnits,
const TIntVector& theFamilyNums,
const TIntVector& theElemNums,
- const TStringVector& theElemNames = TStringVector()):
+ const TStringVector& theElemNames):
TElemInfoBase(theMeshInfo,
+ theNodeCoords.size()/theMeshInfo->GetDim(),
theFamilyNums,
theElemNums,
- theElemNames)
+ theElemNames),
+ TModeSwitchInfo(theMode)
{
mySystem = theSystem;
- myCoord.resize(theNodeCoords.size());
-
- for(TInt anId = 0, anEnd = myCoord.size(); anId < anEnd; anId++){
- myCoord[anId] = theNodeCoords[anId];
- }
+ myCoord = theNodeCoords;
+
TInt aDim = theMeshInfo->GetDim();
- myCoordNames.resize(aDim*nPNOM+1);
- for(TInt anId = 0; anId < aDim; anId++){
- SetCoordName(anId,theCoordNames[anId]);
- }
+
+ myCoordNames.resize(aDim*GetPNOMLength<eVersion>()+1);
+ if(!theCoordNames.empty())
+ for(TInt anId = 0; anId < aDim; anId++)
+ SetCoordName(anId,theCoordNames[anId]);
- myCoordUnits.resize(aDim*nPNOM+1);
- for(TInt anId = 0; anId < aDim; anId++){
- SetCoordUnit(anId,theCoordUnits[anId]);
- }
+ myCoordUnits.resize(aDim*GetPNOMLength<eVersion>()+1);
+ if(!theCoordUnits.empty())
+ for(TInt anId = 0; anId < aDim; anId++)
+ SetCoordUnit(anId,theCoordUnits[anId]);
}
- virtual std::string GetCoordName(TInt theId) const {
- return GetString(theId,nPNOM,myCoordNames);
+ virtual
+ std::string
+ GetCoordName(TInt theId) const
+ {
+ return GetString(theId,GetPNOMLength<eVersion>(),myCoordNames);
}
- virtual void SetCoordName(TInt theId, const std::string& theValue){
- SetString(theId,nPNOM,myCoordNames,theValue);
+ virtual
+ void
+ SetCoordName(TInt theId, const std::string& theValue)
+ {
+ SetString(theId,GetPNOMLength<eVersion>(),myCoordNames,theValue);
}
- virtual std::string GetCoordUnit(TInt theId) const {
- return GetString(theId,nPNOM,myCoordUnits);
+ virtual
+ std::string
+ GetCoordUnit(TInt theId) const
+ {
+ return GetString(theId,GetPNOMLength<eVersion>(),myCoordUnits);
}
- virtual void SetCoordUnit(TInt theId, const std::string& theValue){
- SetString(theId,nPNOM,myCoordUnits,theValue);
+ virtual
+ void
+ SetCoordUnit(TInt theId, const std::string& theValue)
+ {
+ SetString(theId,GetPNOMLength<eVersion>(),myCoordUnits,theValue);
}
};
//---------------------------------------------------------------
- template<TInt nPNOM, TInt nDESC, TInt nIDENT, TInt nNOM, TInt nLNOM, EVersion nV>
+ template<EVersion eVersion>
struct TTPolygoneInfo:
virtual TPolygoneInfo,
- virtual TTElemInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
+ virtual TTElemInfo<eVersion>
{
- typedef TTElemInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV> TElemInfoBase;
+ typedef TTElemInfo<eVersion> TElemInfoBase;
TTPolygoneInfo(const PMeshInfo& theMeshInfo, const PPolygoneInfo& theInfo):
TElemInfoBase(theMeshInfo,theInfo)
{
- myTEntity = theInfo->GetEntity();
- myTGeom = theInfo->GetGeom();
- myTConn = theInfo->GetConn();
- myConnDim = theInfo->GetConnDim();
- myConn = theInfo->GetConnectivite();
- myIndex = theInfo->GetIndex();
+ myEntity = theInfo->GetEntity();
+ myGeom = theInfo->GetGeom();
+
+ myIndex = theInfo->myIndex;
+ myConn = theInfo->myConn;
+
+ myConnMode = theInfo->GetConnMode();
}
TTPolygoneInfo(const PMeshInfo& theMeshInfo,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
TInt theNbElem,
- TInt theNbConn,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- EConnectivite theTConn = eNOD,
- EBooleen theIsElemNum = eVRAI,
- EBooleen theIsElemNames = eVRAI):
+ TInt theConnSize,
+ EConnectivite theConnMode,
+ EBooleen theIsElemNum,
+ EBooleen theIsElemNames):
TElemInfoBase(theMeshInfo,
theNbElem,
theIsElemNum,
theIsElemNames)
{
- myTEntity = theTEntity;
- myTGeom = theTGeom;
- myTConn = theTConn;
- myConnDim = theNbConn;
- myConn.resize(myConnDim);
+ myEntity = theEntity;
+ myGeom = theGeom;
+
myIndex.resize(theNbElem+1);
+ myConn.resize(theConnSize);
+
+ myConnMode = theConnMode;
}
TTPolygoneInfo(const PMeshInfo& theMeshInfo,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- EConnectivite theTConn,
- const TIntVector& theConnectivities,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
const TIntVector& theIndexes,
+ const TIntVector& theConnectivities,
+ EConnectivite theConnMode,
const TIntVector& theFamilyNums,
const TIntVector& theElemNums,
- const TStringVector& theElemNames = TStringVector()):
+ const TStringVector& theElemNames):
TElemInfoBase(theMeshInfo,
+ theIndexes.size() - 1,
theFamilyNums,
theElemNums,
theElemNames)
{
- myTEntity = theTEntity;
- myTGeom = theTGeom;
- myTConn = theTConn;
- myConnDim = theConnectivities.size();
- myConn = theConnectivities;
+ myEntity = theEntity;
+ myGeom = theGeom;
+
myIndex = theIndexes;
+ myConn = theConnectivities;
+
+ myConnMode = theConnMode;
}
};
//---------------------------------------------------------------
- template<TInt nPNOM, TInt nDESC, TInt nIDENT, TInt nNOM, TInt nLNOM, EVersion nV>
+ template<EVersion eVersion>
struct TTPolyedreInfo:
virtual TPolyedreInfo,
- virtual TTElemInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
+ virtual TTElemInfo<eVersion>
{
- typedef TTElemInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV> TElemInfoBase;
+ typedef TTElemInfo<eVersion> TElemInfoBase;
TTPolyedreInfo(const PMeshInfo& theMeshInfo, const PPolyedreInfo& theInfo):
TElemInfoBase(theMeshInfo,theInfo)
{
- myTEntity = theInfo->GetEntity();
- myTGeom = theInfo->GetGeom();
- myTConn = theInfo->GetConn();
- myNbConn = theInfo->GetNbConn();
- myNbFacesIndex = theInfo->GetNbFacesIndex();
- myConn = theInfo->GetConnectivite();
- myFacesIndex = theInfo->GetFacesIndex();
- myIndex = theInfo->GetIndex();
+ myEntity = theInfo->GetEntity();
+ myGeom = theInfo->GetGeom();
+
+ myIndex = theInfo->myIndex;
+ myFaces = theInfo->myFaces;
+ myConn = theInfo->myConn;
+
+ myConnMode = theInfo->GetConnMode();
}
TTPolyedreInfo(const PMeshInfo& theMeshInfo,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
TInt theNbElem,
- TInt theNbConn,
- TInt theNbFacesIndex,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- EConnectivite theTConn = eNOD,
- EBooleen theIsElemNum = eVRAI,
- EBooleen theIsElemNames = eVRAI):
+ TInt theNbFaces,
+ TInt theConnSize,
+ EConnectivite theConnMode,
+ EBooleen theIsElemNum,
+ EBooleen theIsElemNames):
TElemInfoBase(theMeshInfo,
theNbElem,
theIsElemNum,
theIsElemNames)
{
- myTEntity = theTEntity;
- myTGeom = theTGeom;
- myTConn = theTConn;
- myNbConn = theNbConn;
- myNbFacesIndex = theNbFacesIndex;
- myConn.resize(myNbConn);
- myFacesIndex.resize(myNbFacesIndex);
- myIndex.resize(theNbElem+1);
+ myEntity = theEntity;
+ myGeom = theGeom;
+
+ myIndex.resize(theNbElem + 1);
+ myFaces.resize(theNbFaces);
+ myConn.resize(theConnSize);
+
+ myConnMode = theConnMode;
}
TTPolyedreInfo(const PMeshInfo& theMeshInfo,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- EConnectivite theTConn,
- const TIntVector& theConnectivities,
- const TIntVector& theFacesIndexes,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
const TIntVector& theIndexes,
+ const TIntVector& theFaces,
+ const TIntVector& theConnectivities,
+ EConnectivite theConnMode,
const TIntVector& theFamilyNums,
const TIntVector& theElemNums,
- const TStringVector& theElemNames = TStringVector()):
+ const TStringVector& theElemNames):
TElemInfoBase(theMeshInfo,
+ theIndexes.size()-1,
theFamilyNums,
theElemNums,
theElemNames)
{
- myTEntity = theTEntity;
- myTGeom = theTGeom;
- myTConn = theTConn;
- myNbConn = theConnectivities.size();
- myNbFacesIndex = theFacesIndexes.size();
- myConn = theConnectivities;
- myFacesIndex = theFacesIndexes;
+ myEntity = theEntity;
+ myGeom = theGeom;
+
myIndex = theIndexes;
+ myFaces = theFaces;
+ myConn = theConnectivities;
+
+ myConnMode = theConnMode;
}
};
//---------------------------------------------------------------
- template<TInt nPNOM, TInt nDESC, TInt nIDENT, TInt nNOM, TInt nLNOM, EVersion nV>
+ template<EVersion eVersion>
struct TTCellInfo:
virtual TCellInfo,
- virtual TTElemInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
+ virtual TTElemInfo<eVersion>
{
- typedef TTElemInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV> TElemInfoBase;
+ typedef TTElemInfo<eVersion> TElemInfoBase;
TTCellInfo(const PMeshInfo& theMeshInfo, const PCellInfo& theInfo):
TElemInfoBase(theMeshInfo,theInfo)
{
- myTEntity = theInfo->GetEntity();
- myTGeom = theInfo->GetGeom();
- myTConn = theInfo->GetConn();
+ myEntity = theInfo->GetEntity();
+ myGeom = theInfo->GetGeom();
+ myConnMode = theInfo->GetConnMode();
- TInt aConnDim = GetNbNodes(myTGeom);
- myConn.resize(myNbElem*GetNbConn<nV>(myTGeom,myTEntity,myMeshInfo->myDim));
+ TInt aConnDim = GetNbNodes(myGeom);
+ myConn.resize(myNbElem*GetNbConn<eVersion>(myGeom,myEntity,myMeshInfo->myDim));
for(TInt anElemId = 0; anElemId < myNbElem; anElemId++){
+ TConnSlice aConnSlice = GetConnSlice(anElemId);
+ TCConnSlice aConnSlice2 = theInfo->GetConnSlice(anElemId);
for(TInt anConnId = 0; anConnId < aConnDim; anConnId++){
- SetConn(anElemId,anConnId,theInfo->GetConn(anElemId,anConnId));
+ aConnSlice[anConnId] = aConnSlice2[anConnId];
}
}
}
TTCellInfo(const PMeshInfo& theMeshInfo,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
TInt theNbElem,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- EConnectivite theTConn = eNOD,
- EBooleen theIsElemNum = eVRAI,
- EBooleen theIsElemNames = eVRAI):
+ EConnectivite theConnMode,
+ EBooleen theIsElemNum,
+ EBooleen theIsElemNames,
+ EModeSwitch theMode):
TElemInfoBase(theMeshInfo,
theNbElem,
theIsElemNum,
- theIsElemNames)
+ theIsElemNames),
+ TModeSwitchInfo(theMode)
{
- myTEntity = theTEntity;
- myTGeom = theTGeom;
- myTConn = theTConn;
- myConn.resize(theNbElem*GetNbConn<nV>(theTGeom,myTEntity,theMeshInfo->myDim));
+ myEntity = theEntity;
+ myGeom = theGeom;
+
+ myConnMode = theConnMode;
+ myConn.resize(theNbElem*GetNbConn<eVersion>(theGeom,myEntity,theMeshInfo->myDim));
}
TTCellInfo(const PMeshInfo& theMeshInfo,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- EConnectivite theTConn,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
const TIntVector& theConnectivities,
+ EConnectivite theConnMode,
const TIntVector& theFamilyNums,
const TIntVector& theElemNums,
- const TStringVector& theElemNames = TStringVector()):
+ const TStringVector& theElemNames,
+ EModeSwitch theMode):
TElemInfoBase(theMeshInfo,
+ theConnectivities.size()/GetNbNodes(theGeom),
theFamilyNums,
theElemNums,
- theElemNames)
+ theElemNames),
+ TModeSwitchInfo(theMode)
{
- myTEntity = theTEntity;
- myTGeom = theTGeom;
- myTConn = theTConn;
+ myEntity = theEntity;
+ myGeom = theGeom;
- TInt aConnDim = GetNbNodes(myTGeom);
- myNbElem = theConnectivities.size() / aConnDim;
- myConn.resize(myNbElem*GetNbConn<nV>(myTGeom,myTEntity,myMeshInfo->myDim));
+ myConnMode = theConnMode;
+ TInt aConnDim = GetNbNodes(myGeom);
+ myConn.resize(myNbElem*GetNbConn<eVersion>(myGeom,myEntity,myMeshInfo->myDim));
for(TInt anElemId = 0; anElemId < myNbElem; anElemId++){
+ TConnSlice aConnSlice = GetConnSlice(anElemId);
for(TInt anConnId = 0; anConnId < aConnDim; anConnId++){
- SetConn(anElemId,anConnId,theConnectivities[anElemId*aConnDim+anConnId]);
+ aConnSlice[anConnId] = theConnectivities[anElemId*aConnDim+anConnId];
}
}
}
- virtual TInt GetConnDim() const {
- return GetNbConn<nV>(myTGeom,myTEntity,myMeshInfo->myDim);
+ virtual
+ TInt
+ GetConnDim() const
+ {
+ return GetNbConn<eVersion>(myGeom,myEntity,myMeshInfo->myDim);
}
};
//---------------------------------------------------------------
- template<TInt nPNOM, TInt nDESC, TInt nIDENT, TInt nNOM, TInt nLNOM, EVersion nV>
+ template<EVersion eVersion>
struct TTFieldInfo:
virtual TFieldInfo,
- virtual TTNameInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
+ virtual TTNameInfo<eVersion>
{
- typedef TTNameInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV> TNameInfoBase;
+ typedef TTNameInfo<eVersion> TNameInfoBase;
TTFieldInfo(const PMeshInfo& theMeshInfo, const PFieldInfo& theInfo):
TNameInfoBase(theInfo->GetName())
myMeshInfo = theMeshInfo;
myNbComp = theInfo->GetNbComp();
- myCompNames.resize(myNbComp*nPNOM+1);
+ myCompNames.resize(myNbComp*GetPNOMLength<eVersion>()+1);
for(TInt anId = 0; anId < myNbComp; anId++){
SetCompName(anId,theInfo->GetCompName(anId));
}
- myUnitNames.resize(myNbComp*nPNOM+1);
+ myUnitNames.resize(myNbComp*GetPNOMLength<eVersion>()+1);
for(TInt anId = 0; anId < myNbComp; anId++){
SetUnitName(anId,theInfo->GetUnitName(anId));
}
}
TTFieldInfo(const PMeshInfo& theMeshInfo,
- TInt theNbComp = 0,
- ETypeChamp theType = eFLOAT64,
- const std::string& theValue = "",
- EBooleen theIsLocal = eVRAI,
- TInt theNbRef = 1):
+ TInt theNbComp,
+ ETypeChamp theType,
+ const std::string& theValue,
+ EBooleen theIsLocal,
+ TInt theNbRef):
TNameInfoBase(theValue)
{
myMeshInfo = theMeshInfo;
myNbComp = theNbComp;
- myCompNames.resize(theNbComp*nPNOM+1);
- myUnitNames.resize(theNbComp*nPNOM+1);
+ myCompNames.resize(theNbComp*GetPNOMLength<eVersion>()+1);
+ myUnitNames.resize(theNbComp*GetPNOMLength<eVersion>()+1);
myType = theType;
myNbRef = theNbRef;
}
- virtual std::string GetCompName(TInt theId) const {
- return GetString(theId,nPNOM,myCompNames);
+ virtual
+ std::string
+ GetCompName(TInt theId) const
+ {
+ return GetString(theId,GetPNOMLength<eVersion>(),myCompNames);
+ }
+
+ virtual
+ void
+ SetCompName(TInt theId, const std::string& theValue)
+ {
+ SetString(theId,GetPNOMLength<eVersion>(),myCompNames,theValue);
}
- virtual void SetCompName(TInt theId, const std::string& theValue){
- SetString(theId,nPNOM,myCompNames,theValue);
+ virtual
+ std::string
+ GetUnitName(TInt theId) const
+ {
+ return GetString(theId,GetPNOMLength<eVersion>(),myUnitNames);
}
- virtual std::string GetUnitName(TInt theId) const {
- return GetString(theId,nPNOM,myUnitNames);
+ virtual
+ void
+ SetUnitName(TInt theId, const std::string& theValue)
+ {
+ SetString(theId,GetPNOMLength<eVersion>(),myUnitNames,theValue);
}
+ };
+
- virtual void SetUnitName(TInt theId, const std::string& theValue){
- SetString(theId,nPNOM,myUnitNames,theValue);
+ //---------------------------------------------------------------
+ template<EVersion eVersion>
+ struct TTGaussInfo:
+ virtual TGaussInfo,
+ virtual TTNameInfo<eVersion>
+ {
+ typedef TTNameInfo<eVersion> TNameInfoBase;
+
+ TTGaussInfo(const TGaussInfo::TInfo& theInfo,
+ EModeSwitch theMode):
+ TNameInfoBase(boost::get<1>(boost::get<0>(theInfo))),
+ TModeSwitchInfo(theMode)
+ {
+ const TGaussInfo::TKey& aKey = boost::get<0>(theInfo);
+
+ myGeom = boost::get<0>(aKey);
+ myRefCoord.resize(GetNbRef()*GetDim());
+
+ TInt aNbGauss = boost::get<1>(theInfo);
+ myGaussCoord.resize(aNbGauss*GetDim());
+ myWeight.resize(aNbGauss);
}
};
//---------------------------------------------------------------
- template<TInt nPNOM, TInt nDESC, TInt nIDENT, TInt nNOM, TInt nLNOM, EVersion nV>
+ template<EVersion eVersion>
struct TTTimeStampInfo: virtual TTimeStampInfo
{
TTTimeStampInfo(const PFieldInfo& theFieldInfo, const PTimeStampInfo& theInfo)
myFieldInfo = theFieldInfo;
myEntity = theInfo->GetEntity();
- myGeom = theInfo->GetGeom();
+ myGeom2Size = theInfo->GetGeom2Size();
- myNbGauss = theInfo->GetNbGauss();
myNumDt = theInfo->GetNumDt();
myNumOrd = theInfo->GetNumOrd();
myDt = theInfo->GetDt();
- myUnitDt.resize(nPNOM+1);
+ myUnitDt.resize(GetPNOMLength<eVersion>()+1);
SetUnitDt(theInfo->GetUnitDt());
- myGaussName.resize(nNOM+1);
- SetGaussName(theInfo->GetGaussName());
+ myGeom2NbGauss = theInfo->myGeom2NbGauss;
+ myGeom2Gauss = theInfo->GetGeom2Gauss();
}
TTTimeStampInfo(const PFieldInfo& theFieldInfo,
EEntiteMaillage theEntity,
- const TGeom& theGeom,
- TInt theNbGauss = 0,
- TInt theNumDt = 0,
- TInt theNumOrd = 0,
- TFloat theDt = 0,
- const std::string& theUnitDt = "",
- const std::string& theGaussName = "")
+ const TGeom2Size& theGeom2Size,
+ const TGeom2NbGauss& theGeom2NbGauss,
+ TInt theNumDt,
+ TInt theNumOrd,
+ TFloat theDt,
+ const std::string& theUnitDt,
+ const TGeom2Gauss& theGeom2Gauss)
{
myFieldInfo = theFieldInfo;
myEntity = theEntity;
- myGeom = theGeom;
+ myGeom2Size = theGeom2Size;
- myNbGauss = theNbGauss;
myNumDt = theNumDt;
myNumOrd = theNumDt;
myDt = theDt;
- myUnitDt.resize(nPNOM+1);
+ myUnitDt.resize(GetPNOMLength<eVersion>()+1);
SetUnitDt(theUnitDt);
- myGaussName.resize(nNOM+1);
- SetGaussName(theGaussName);
+ myGeom2NbGauss = theGeom2NbGauss;
+ myGeom2Gauss = theGeom2Gauss;
}
- virtual std::string GetGaussName() const {
- return GetString(0,nNOM,myGaussName);
+ virtual
+ std::string
+ GetUnitDt() const
+ {
+ return GetString(0,GetPNOMLength<eVersion>(),myUnitDt);
}
- virtual void SetGaussName(const std::string& theValue){
- SetString(0,nNOM,myGaussName,theValue);
+ virtual
+ void
+ SetUnitDt(const std::string& theValue)
+ {
+ SetString(0,GetPNOMLength<eVersion>(),myUnitDt,theValue);
}
+ };
- virtual std::string GetUnitDt() const {
- return GetString(0,nPNOM,myUnitDt);
- }
- virtual void SetUnitDt(const std::string& theValue){
- SetString(0,nPNOM,myUnitDt,theValue);
+ //---------------------------------------------------------------
+ template<EVersion eVersion>
+ struct TTProfileInfo:
+ virtual TProfileInfo,
+ virtual TTNameInfo<eVersion>
+ {
+ typedef TTNameInfo<eVersion> TNameInfoBase;
+
+ TTProfileInfo(const TProfileInfo::TInfo& theInfo,
+ EModeProfil theMode):
+ TNameInfoBase(boost::get<0>(theInfo))
+ {
+ TInt aSize = boost::get<1>(theInfo);
+ myElemNum.resize(aSize);
+ myMode = aSize > 0? theMode: eNO_PFLMOD;
}
};
//---------------------------------------------------------------
- template<TInt nPNOM, TInt nDESC, TInt nIDENT, TInt nNOM, TInt nLNOM, EVersion nV>
+ template<EVersion eVersion>
struct TTTimeStampVal: virtual TTimeStampVal
{
- TTTimeStampVal(const PTimeStampInfo& theTimeStampInfo, const PTimeStampVal& theInfo)
+ TTTimeStampVal(const PTimeStampInfo& theTimeStampInfo,
+ const PTimeStampVal& theInfo)
{
myTimeStampInfo = theTimeStampInfo;
- myPflMode = theInfo->GetPflMode();
+ myGeom2Profile = theInfo->GetGeom2Profile();
- myPflName.resize(nNOM+1);
- SetPflName(theInfo->GetPflName());
-
- TInt aNbComp = theTimeStampInfo->GetFieldInfo()->GetNbComp();
- const TGeom& aTGeom = theTimeStampInfo->GetGeom();
- TInt aNbGauss = theTimeStampInfo->GetNbGauss();
- TGeom::const_iterator anIter = aTGeom.begin();
- for(; anIter != aTGeom.end(); anIter++){
- const EGeometrieElement& aGeom = anIter->first;
- TInt aNbElem = anIter->second;
- TInt aSize = aNbElem*aNbComp*aNbGauss;
- TValue& aValue = myMeshValue[aGeom];
- aValue.resize(aSize);
- for(TInt anElemId = 0; anElemId < aNbElem; anElemId++){
- for(TInt aCompId = 0; aCompId < aNbComp; aCompId++){
- for(TInt aGaussId = 0; aGaussId < aNbGauss; aGaussId++){
- SetVal(aGeom,anElemId,aCompId,theInfo->GetVal(aGeom,anElemId,aCompId,aGaussId),aGaussId);
- }
- }
- }
- }
+ myGeom2Value = theInfo->myGeom2Value;
}
TTTimeStampVal(const PTimeStampInfo& theTimeStampInfo,
- const std::string& thePflName = "",
- EModeProfil thePflMode = eCOMPACT)
+ const TGeom2Profile& theGeom2Profile,
+ EModeSwitch theMode):
+ TModeSwitchInfo(theMode)
{
myTimeStampInfo = theTimeStampInfo;
- myPflMode = thePflMode;
-
- myPflName.resize(nNOM+1);
- SetPflName(thePflName);
+ myGeom2Profile = theGeom2Profile;
TInt aNbComp = theTimeStampInfo->myFieldInfo->myNbComp;
- TInt aNbGauss = theTimeStampInfo->myNbGauss;
- const TGeom& aTGeom = theTimeStampInfo->myGeom;
- TGeom::const_iterator anIter = aTGeom.begin();
- for(; anIter != aTGeom.end(); anIter++){
+
+ const TGeom2Size& aGeom2Size = theTimeStampInfo->myGeom2Size;
+ TGeom2Size::const_iterator anIter = aGeom2Size.begin();
+ for(; anIter != aGeom2Size.end(); anIter++){
const EGeometrieElement& aGeom = anIter->first;
- TInt aNb = anIter->second*aNbComp*aNbGauss;
- myMeshValue[aGeom].resize(aNb);
- }
- }
+ TInt aNbElem = anIter->second;
- virtual std::string GetPflName() const {
- return GetString(0,nNOM,myPflName);
- }
-
- virtual void SetPflName(const std::string& theValue){
- SetString(0,nNOM,myPflName,theValue);
+ MED::PProfileInfo aProfileInfo;
+ MED::TGeom2Profile::const_iterator anIter = theGeom2Profile.find(aGeom);
+ if(anIter != theGeom2Profile.end())
+ aProfileInfo = anIter->second;
+
+ if(aProfileInfo && aProfileInfo->IsPresent())
+ aNbElem = aProfileInfo->GetSize();
+
+ TInt aNbGauss = theTimeStampInfo->GetNbGauss(aGeom);
+
+ TMeshValue& aMeshValue = GetMeshValue(aGeom);
+ aMeshValue.Init(aNbElem,aNbGauss,aNbComp);
+ }
}
};
#include "MED_TStructures.hxx"
#include "MED_Wrapper.hxx"
-namespace MED{
+namespace MED
+{
- template<TInt nPNOM, TInt nDESC, TInt nIDENT, TInt nNOM, TInt nLNOM, EVersion nV>
- class TTWrapper: public TWrapper{
+ template<EVersion eVersion>
+ class TTWrapper: public TWrapper
+ {
public:
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
virtual
EMaillage theType = eNON_STRUCTURE,
const std::string& theDesc = "")
{
- return PMeshInfo(new TTMeshInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
+ return PMeshInfo(new TTMeshInfo<eVersion>
(theDim,
theValue,
theType,
PMeshInfo
CrMeshInfo(const PMeshInfo& theInfo)
{
- return PMeshInfo(new TTMeshInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>(theInfo));
+ return PMeshInfo(new TTMeshInfo<eVersion>(theInfo));
}
TInt theId = 0,
const std::string& theValue = "")
{
- return PFamilyInfo(new TTFamilyInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
+ return PFamilyInfo(new TTFamilyInfo<eVersion>
(theMeshInfo,
theNbGroup,
theNbAttr,
const MED::TIntVector& theAttrIds = MED::TIntVector(),
const MED::TIntVector& theAttrVals = MED::TIntVector())
{
- return PFamilyInfo(new TTFamilyInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
+ return PFamilyInfo(new TTFamilyInfo<eVersion>
(theMeshInfo,
theValue,
theId,
CrFamilyInfo(const PMeshInfo& theMeshInfo,
const PFamilyInfo& theInfo)
{
- return PFamilyInfo(new TTFamilyInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
+ return PFamilyInfo(new TTFamilyInfo<eVersion>
(theMeshInfo,
theInfo));
}
PNodeInfo
CrNodeInfo(const PMeshInfo& theMeshInfo,
TInt theNbElem,
+ EModeSwitch theMode = eFULL_INTERLACE,
ERepere theSystem = eCART,
EBooleen theIsElemNum = eVRAI,
EBooleen theIsElemNames = eVRAI)
{
- return PNodeInfo(new TTNodeInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
+ return PNodeInfo(new TTNodeInfo<eVersion>
(theMeshInfo,
theNbElem,
+ theMode,
theSystem,
theIsElemNum,
theIsElemNames));
virtual
PNodeInfo
CrNodeInfo(const PMeshInfo& theMeshInfo,
- ERepere theSystem,
const TFloatVector& theNodeCoords,
- const TStringVector& theCoordNames,
- const TStringVector& theCoordUnits,
- const TIntVector& theFamilyNums,
- const TIntVector& theElemNums,
+ 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<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
+ return PNodeInfo(new TTNodeInfo<eVersion>
(theMeshInfo,
- theSystem,
theNodeCoords,
+ theMode,
+ theSystem,
theCoordNames,
theCoordUnits,
theFamilyNums,
CrNodeInfo(const PMeshInfo& theMeshInfo,
const PNodeInfo& theInfo)
{
- return PNodeInfo(new TTNodeInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
+ return PNodeInfo(new TTNodeInfo<eVersion>
(theMeshInfo,
theInfo));
}
virtual
PPolygoneInfo
CrPolygoneInfo(const PMeshInfo& theMeshInfo,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
TInt theNbElem,
- TInt theNbConn,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- EConnectivite theTConn = eNOD,
+ TInt theConnSize,
+ EConnectivite theConnMode = eNOD,
EBooleen theIsElemNum = eVRAI,
EBooleen theIsElemNames = eVRAI)
{
- return PPolygoneInfo(new TTPolygoneInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
+ return PPolygoneInfo(new TTPolygoneInfo<eVersion>
(theMeshInfo,
+ theEntity,
+ theGeom,
theNbElem,
- theNbConn,
- theTEntity,
- theTGeom,
- theTConn,
+ theConnSize,
+ theConnMode,
theIsElemNum,
theIsElemNames));
}
virtual
PPolygoneInfo
CrPolygoneInfo(const PMeshInfo& theMeshInfo,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- EConnectivite theTConn,
- const TIntVector& theConnectivities,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
const TIntVector& theIndexes,
- const TIntVector& theFamilyNums,
- const TIntVector& theElemNums,
+ const TIntVector& theConnectivities,
+ EConnectivite theConnMode = eNOD,
+ const TIntVector& theFamilyNums = TIntVector(),
+ const TIntVector& theElemNums = TIntVector(),
const TStringVector& theElemNames = TStringVector())
{
- return PPolygoneInfo(new TTPolygoneInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
+ return PPolygoneInfo(new TTPolygoneInfo<eVersion>
(theMeshInfo,
- theTEntity,
- theTGeom,
- theTConn,
- theConnectivities,
+ theEntity,
+ theGeom,
theIndexes,
+ theConnectivities,
+ theConnMode,
theFamilyNums,
theElemNums,
theElemNames));
CrPolygoneInfo(const PMeshInfo& theMeshInfo,
const PPolygoneInfo& theInfo)
{
- return PPolygoneInfo(new TTPolygoneInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
+ return PPolygoneInfo(new TTPolygoneInfo<eVersion>
(theMeshInfo,
theInfo));
}
virtual
PPolyedreInfo
CrPolyedreInfo(const PMeshInfo& theMeshInfo,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
TInt theNbElem,
- TInt theNbConn,
TInt theNbFaces,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- EConnectivite theTConn = eNOD,
+ TInt theConnSize,
+ EConnectivite theConnMode = eNOD,
EBooleen theIsElemNum = eVRAI,
EBooleen theIsElemNames = eVRAI)
{
- return PPolyedreInfo(new TTPolyedreInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
+ return PPolyedreInfo(new TTPolyedreInfo<eVersion>
(theMeshInfo,
+ theEntity,
+ theGeom,
theNbElem,
- theNbConn,
theNbFaces,
- theTEntity,
- theTGeom,
- theTConn,
+ theConnSize,
+ theConnMode,
theIsElemNum,
theIsElemNames));
}
virtual
PPolyedreInfo
CrPolyedreInfo(const PMeshInfo& theMeshInfo,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- EConnectivite theTConn,
- const TIntVector& theConnectivities,
- const TIntVector& theFacesIndexes,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
const TIntVector& theIndexes,
- const TIntVector& theFamilyNums,
- const TIntVector& theElemNums,
+ 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<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
+ return PPolyedreInfo(new TTPolyedreInfo<eVersion>
(theMeshInfo,
- theTEntity,
- theTGeom,
- theTConn,
- theConnectivities,
- theFacesIndexes,
+ theEntity,
+ theGeom,
theIndexes,
+ theFaces,
+ theConnectivities,
+ theConnMode,
theFamilyNums,
theElemNums,
theElemNames));
CrPolyedreInfo(const PMeshInfo& theMeshInfo,
const PPolyedreInfo& theInfo)
{
- return PPolyedreInfo(new TTPolyedreInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
+ return PPolyedreInfo(new TTPolyedreInfo<eVersion>
(theMeshInfo,
theInfo));
}
virtual
PCellInfo
CrCellInfo(const PMeshInfo& theMeshInfo,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
TInt theNbElem,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- EConnectivite theTConn = eNOD,
+ EConnectivite theConnMode = eNOD,
EBooleen theIsElemNum = eVRAI,
- EBooleen theIsElemNames = eVRAI)
+ EBooleen theIsElemNames = eVRAI,
+ EModeSwitch theMode = eFULL_INTERLACE)
{
- return PCellInfo(new TTCellInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
+ return PCellInfo(new TTCellInfo<eVersion>
(theMeshInfo,
+ theEntity,
+ theGeom,
theNbElem,
- theTEntity,
- theTGeom,
- theTConn,
+ theConnMode,
theIsElemNum,
- theIsElemNames));
+ theIsElemNames,
+ theMode));
}
virtual
PCellInfo
CrCellInfo(const PMeshInfo& theMeshInfo,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- EConnectivite theTConn,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
const TIntVector& theConnectivities,
- const TIntVector& theFamilyNums,
- const TIntVector& theElemNums,
- const TStringVector& theElemNames = TStringVector())
+ EConnectivite theConnMode = eNOD,
+ const TIntVector& theFamilyNums = TIntVector(),
+ const TIntVector& theElemNums = TIntVector(),
+ const TStringVector& theElemNames = TStringVector(),
+ EModeSwitch theMode = eFULL_INTERLACE)
{
- return PCellInfo(new TTCellInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
+ return PCellInfo(new TTCellInfo<eVersion>
(theMeshInfo,
- theTEntity,
- theTGeom,
- theTConn,
+ theEntity,
+ theGeom,
theConnectivities,
+ theConnMode,
theFamilyNums,
theElemNums,
- theElemNames));
+ theElemNames,
+ theMode));
}
virtual
CrCellInfo(const PMeshInfo& theMeshInfo,
const PCellInfo& theInfo)
{
- return PCellInfo(new TTCellInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
+ return PCellInfo(new TTCellInfo<eVersion>
(theMeshInfo,
theInfo));
}
EBooleen theIsLocal = eVRAI,
TInt theNbRef = 1)
{
- return PFieldInfo(new TTFieldInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
+ return PFieldInfo(new TTFieldInfo<eVersion>
(theMeshInfo,
theNbComp,
theType,
CrFieldInfo(const PMeshInfo& theMeshInfo,
const PFieldInfo& theInfo)
{
- return PFieldInfo(new TTFieldInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
+ return PFieldInfo(new TTFieldInfo<eVersion>
(theMeshInfo,
theInfo));
}
PTimeStampInfo
CrTimeStampInfo(const PFieldInfo& theFieldInfo,
EEntiteMaillage theEntity,
- const TGeom& theGeom,
- TInt theNbGauss = 0,
+ const TGeom2Size& theGeom2Size,
+ const TGeom2NbGauss& theGeom2NbGauss = TGeom2NbGauss(),
TInt theNumDt = 0,
TInt theNumOrd = 0,
TFloat theDt = 0,
const std::string& theUnitDt = "",
- const std::string& theGaussName = "")
+ const TGeom2Gauss& theGeom2Gauss = TGeom2Gauss())
{
- return PTimeStampInfo(new TTTimeStampInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
+ return PTimeStampInfo(new TTTimeStampInfo<eVersion>
(theFieldInfo,
theEntity,
- theGeom,
- theNbGauss,
+ theGeom2Size,
+ theGeom2NbGauss,
theNumDt,
theNumOrd,
theDt,
theUnitDt,
- theGaussName));
+ theGeom2Gauss));
}
virtual
CrTimeStampInfo(const PFieldInfo& theFieldInfo,
const PTimeStampInfo& theInfo)
{
- return PTimeStampInfo(new TTTimeStampInfo<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
+ return PTimeStampInfo(new TTTimeStampInfo<eVersion>
(theFieldInfo,
theInfo));
}
+
+
+ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ virtual
+ PGaussInfo
+ CrGaussInfo(const TGaussInfo::TInfo& theInfo,
+ EModeSwitch theMode = eFULL_INTERLACE)
+ {
+ return PGaussInfo(new TTGaussInfo<eVersion>
+ (theInfo,
+ theMode));
+ }
+
+
+ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ virtual
+ PProfileInfo
+ CrProfileInfo(const TProfileInfo::TInfo& theInfo,
+ EModeProfil theMode = eCOMPACT)
+ {
+ return PProfileInfo(new TTProfileInfo<eVersion>
+ (theInfo,
+ theMode));
+ }
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
virtual
PTimeStampVal
CrTimeStampVal(const PTimeStampInfo& theTimeStampInfo,
- const std::string& thePflName = "",
- EModeProfil thePflMode = eCOMPACT)
+ const TGeom2Profile& theGeom2Profile = TGeom2Profile(),
+ EModeSwitch theMode = eFULL_INTERLACE)
{
- return PTimeStampVal(new TTTimeStampVal<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
+ return PTimeStampVal(new TTTimeStampVal<eVersion>
(theTimeStampInfo,
- thePflName,
- thePflMode));
+ theGeom2Profile,
+ theMode));
}
virtual
CrTimeStampVal(const PTimeStampInfo& theTimeStampInfo,
const PTimeStampVal& theInfo)
{
- return PTimeStampVal(new TTTimeStampVal<nPNOM,nDESC,nIDENT,nNOM,nLNOM,nV>
+ return PTimeStampVal(new TTTimeStampVal<eVersion>
(theTimeStampInfo,
theInfo));
}
MED::PrefixPrinter::~PrefixPrinter()
{
- if(myIsActive)
+ if(myIsActive){
myCounter--;
+ if(myCounter < 0)
+ EXCEPTION(runtime_error,"PrefixPrinter::~PrefixPrinter() - myCounter("<<myCounter<<") < 0");
+ }
}
string MED::PrefixPrinter::GetPrefix()
{
- if(myCounter)
+ if(myCounter){
+ if(myCounter < 0)
+ EXCEPTION(runtime_error,"PrefixPrinter::~PrefixPrinter() - myCounter("<<myCounter<<") < 0");
return string(myCounter*2,' ');
+ }
return "";
}
};
};
-//#define _DEBUG_
#ifdef _DEBUG_
#define MSG(deb,msg) if(deb) std::cout<<MED::PrefixPrinter::GetPrefix()<<msg<<" ("<<__FILE__<<" ["<<__LINE__<<"])\n"
#define BEGMSG(deb,msg) if(deb) std::cout<<MED::PrefixPrinter::GetPrefix()<<msg
- #define INITMSG(deb,msg) MED::PrefixPrinter aPrefixPrinter(deb); BEGMSG(deb,msg)
+ #define INITMSGA(deb,lev,msg) MED::PrefixPrinter aPrefixPrinter_##lev(deb); BEGMSG(deb,msg)
+ #define INITMSG(deb,msg) INITMSGA(deb,,msg)
#define ADDMSG(deb,msg) if(deb) std::cout<<msg
#else
#define MSG(deb,msg)
#define BEGMSG(deb,msg)
+ #define INITMSGA(deb,lev,msg)
#define INITMSG(deb,msg)
#define ADDMSG(deb,msg)
#endif
--- /dev/null
+//
+//
+// Copyright (C) 2003 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.
+//
+// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File :
+// Author :
+// Module :
+// $Header$
+
+#ifndef MED_Vector_HeaderFile
+#define MED_Vector_HeaderFile
+
+#include <vector>
+
+#if !defined(__GNUC_2__) && defined(__GNUC__) && (__GNUC__ == 2)
+ #define __GNUC_2__
+#endif
+
+namespace MED
+{
+
+ //! 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:
+ typedef size_t size_type;
+
+ typedef std::vector<_Tp, _Alloc> superclass;
+ typedef typename superclass::allocator_type allocator_type;
+
+ typedef _Tp value_type;
+ typedef value_type& reference;
+ typedef const value_type& const_reference;
+
+ public:
+ explicit
+ TVector(const allocator_type& __a = allocator_type()):
+ superclass(__a)
+ {}
+
+ TVector(size_type __n, const value_type& __value,
+ const allocator_type& __a = allocator_type()):
+ superclass(__n, __value, __a)
+ {}
+
+ explicit
+ TVector(size_type __n):
+ superclass(__n)
+ {}
+
+ TVector(const TVector& __x):
+ superclass(__x)
+ {}
+
+ template<typename _InputIterator>
+ TVector(_InputIterator __first, _InputIterator __last,
+ const allocator_type& __a = allocator_type()):
+ superclass(__first, __last, __a)
+ {}
+
+ template<typename _Yp, typename _Al>
+ TVector(TVector<_Yp, _Al> __y):
+ superclass(__y.begin(), __y.end())
+ {}
+
+ TVector&
+ operator=(const TVector& __x)
+ {
+ superclass::operator=(__x);
+ return *this;
+ }
+
+ template<typename _Yp, typename _Al>
+ TVector&
+ operator=(TVector<_Yp, _Al> __y)
+ {
+ this->assign(__y.begin(), __y.end());
+ return *this;
+ }
+
+ reference
+ operator[](size_type __n)
+ {
+#if defined(__GNUC_2__)
+ return superclass::operator[](__n);
+#else
+ return this->at(__n);
+#endif
+ }
+
+ const_reference
+ operator[](size_type __n) const
+ {
+#if defined(__GNUC_2__)
+ return superclass::operator[](__n);
+#else
+ return this->at(__n);
+#endif
+ }
+ };
+
+}
+
+
+#endif
static int MYVALUEDEBUG = 0;
#endif
-namespace MED{
+namespace MED
+{
+ TLockProxy
+ ::TLockProxy(TWrapper* theWrapper):
+ myWrapper(theWrapper)
+ {
+ boost::detail::thread::lock_ops<TWrapper::TMutex>::lock(myWrapper->myMutex);
+ INITMSG(MYDEBUG,"TLockProxy() - this -"<<this<<"; myWrapper = "<<myWrapper<<endl);
+ }
+
+ TLockProxy
+ ::~TLockProxy()
+ {
+ INITMSG(MYDEBUG,"~TLockProxy() - this -"<<this<<"; myWrapper = "<<myWrapper<<endl);
+ boost::detail::thread::lock_ops<TWrapper::TMutex>::unlock(myWrapper->myMutex);
+ }
+
+ TWrapper*
+ TLockProxy
+ ::operator-> () const // never throws
+ {
+ return myWrapper;
+ }
+
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- PMeshInfo TWrapper::GetPMeshInfo(TInt theId,
- TErr* theErr)
+ PMeshInfo
+ TWrapper
+ ::GetPMeshInfo(TInt theId,
+ TErr* theErr)
{
PMeshInfo anInfo = CrMeshInfo();
GetMeshInfo(theId,*anInfo,theErr);
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- PFamilyInfo TWrapper::GetPFamilyInfo(const PMeshInfo& theMeshInfo,
- TInt theId,
- TErr* theErr)
+ PFamilyInfo
+ TWrapper
+ ::GetPFamilyInfo(const PMeshInfo& theMeshInfo,
+ TInt theId,
+ TErr* theErr)
{
TInt aNbAttr = GetNbFamAttr(theId,*theMeshInfo);
TInt aNbGroup = GetNbFamGroup(theId,*theMeshInfo);
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- PNodeInfo TWrapper::GetPNodeInfo(const PMeshInfo& theMeshInfo,
- TErr* theErr)
+ PNodeInfo
+ TWrapper
+ ::GetPNodeInfo(const PMeshInfo& theMeshInfo,
+ TErr* theErr)
{
TInt aNbElems = GetNbNodes(*theMeshInfo);
PNodeInfo anInfo = CrNodeInfo(theMeshInfo,aNbElems);
#ifdef _DEBUG_
TInt aDim = theMeshInfo->myDim;
TInt aNbElem = anInfo->GetNbElem();
- INITMSG(MYDEBUG,"GetPNodeInfo - 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,endl);
-
- BEGMSG(MYDEBUG,"GetPNodeInfo - GetFamNum: ");
- for(TInt iElem = 0; iElem < aNbElem; iElem++){
- ADDMSG(MYVALUEDEBUG,anInfo->GetFamNum(iElem)<<", ");
- }
- ADDMSG(MYDEBUG,endl);
-
- if(anInfo->IsElemNum()){
- BEGMSG(MYDEBUG,"GetPNodeInfo - GetElemNum: ");
+ INITMSG(MYDEBUG,"GetPNodeInfo: ");
+ {
+ INITMSG(MYDEBUG,"aCoords: "<<aNbElem<<": ");
+ TNodeCoord& aCoord = anInfo->myCoord;
for(TInt iElem = 0; iElem < aNbElem; iElem++){
- ADDMSG(MYVALUEDEBUG,anInfo->GetElemNum(iElem)<<", ");
+ for(TInt iDim = 0, anId = iElem*aDim; iDim < aDim; iDim++, anId++){
+ ADDMSG(MYVALUEDEBUG,aCoord[anId]<<",");
+ }
+ ADDMSG(MYVALUEDEBUG," ");
}
ADDMSG(MYDEBUG,endl);
+
+ BEGMSG(MYVALUEDEBUG,"GetFamNum: ");
+ for(TInt iElem = 0; iElem < aNbElem; iElem++){
+ ADDMSG(MYVALUEDEBUG,anInfo->GetFamNum(iElem)<<", ");
+ }
+ ADDMSG(MYVALUEDEBUG,endl);
+
+ if(anInfo->IsElemNum()){
+ BEGMSG(MYVALUEDEBUG,"GetElemNum: ");
+ for(TInt iElem = 0; iElem < aNbElem; iElem++){
+ ADDMSG(MYVALUEDEBUG,anInfo->GetElemNum(iElem)<<", ");
+ }
+ ADDMSG(MYVALUEDEBUG,endl);
+ }
}
-
ADDMSG(MYDEBUG,endl);
#endif
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- PPolygoneInfo TWrapper::GetPPolygoneInfo(const PMeshInfo& theMeshInfo,
- EEntiteMaillage theEntity,
- EGeometrieElement theGeom,
- EConnectivite theConn)
+ PPolygoneInfo
+ TWrapper
+ ::GetPPolygoneInfo(const PMeshInfo& theMeshInfo,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
+ EConnectivite theConnMode)
{
- TInt aNbElem = GetNbPolygones(*theMeshInfo,theEntity,theGeom,theConn);
- TInt aNbConn = GetNbPolygoneConn(*theMeshInfo,theEntity,theGeom,theConn);
- PPolygoneInfo anInfo = CrPolygoneInfo(theMeshInfo,aNbElem,aNbConn,theEntity,theGeom,theConn);
- GetPolygoneInfo(*anInfo);
+ 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_
- TElemNum aConn = anInfo->GetConnectivite();
- TElemNum aIndex = anInfo->GetIndex();
- TInt aNbIndex = aIndex.size();
- TInt aIndex0 = aIndex[0];
- INITMSG(MYDEBUG,"theGeom = "<<theGeom<<"; aNbElem = "<<aNbIndex-1<<": ");
- for(TInt iElem = 1; iElem < aNbIndex; iElem++){
- for (TInt i = aIndex0; i < aIndex[iElem];i++)
- ADDMSG(MYVALUEDEBUG,aConn[i-1]<<",");
+ 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," ");
- aIndex0 = aIndex[iElem];
- }
- ADDMSG(MYDEBUG,endl);
- BEGMSG(MYDEBUG,"Indexes: ");
- for(TInt iElem = 0; iElem < aIndex.size(); iElem++){
- ADDMSG(MYVALUEDEBUG,aIndex[iElem]<<",");
}
ADDMSG(MYDEBUG,endl);
#endif
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- PPolyedreInfo TWrapper::GetPPolyedreInfo(const PMeshInfo& theMeshInfo,
- EEntiteMaillage theEntity,
- EGeometrieElement theGeom,
- EConnectivite theConn)
+ PPolyedreInfo
+ TWrapper
+ ::GetPPolyedreInfo(const PMeshInfo& theMeshInfo,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
+ EConnectivite theConnMode)
{
- TInt aNbElem = GetNbPolyedres(*theMeshInfo,theEntity,theGeom,theConn);
- TInt aNbConn = 0;
- TInt aNbFaces = 0;
- GetNbPolyedreConnF(*theMeshInfo,theConn,aNbFaces,aNbConn);
- PPolyedreInfo anInfo = CrPolyedreInfo(theMeshInfo,aNbElem,aNbConn,aNbFaces,theEntity,theGeom,theConn);
- GetPolyedreInfo(*anInfo);
+ 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_
- TElemNum aConn = anInfo->GetConnectivite();
- TElemNum aFacesIndex = anInfo->GetFacesIndex();
- TElemNum aIndex = anInfo->GetIndex();
-
- TInt aNbIndex = aIndex.size();
-
- for (int aNp = 0; aNp < aNbIndex-1;aNp++){
- if (anInfo->IsElemNames())
- ADDMSG(MYDEBUG,anInfo->GetElemName(aNp)<<endl);
- else
- ADDMSG(MYDEBUG,"POLYEDRE "<<aNp+1<<endl);
-
- for (int aNf = aIndex[aNp]-1;aNf < aIndex[aNp+1]-1;aNf++){
- ADDMSG(MYDEBUG,"Face "<<aNf-aIndex[aNp]+2<<": [");
- for (int aNc = aFacesIndex[aNf]-1; aNc < aFacesIndex[aNf+1]-1;aNc++){
- ADDMSG(MYDEBUG," "<<aConn[aNc]);
+ 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," ]"<<endl;);
+ ADDMSG(MYDEBUG,"] ");
}
+ ADDMSG(MYDEBUG,"} ");
}
+ ADDMSG(MYDEBUG,endl);
#endif
return anInfo;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- PCellInfo TWrapper::GetPCellInfo(const PMeshInfo& theMeshInfo,
- EEntiteMaillage theEntity,
- EGeometrieElement theGeom,
- EConnectivite theConn,
- TErr* theErr)
+ PCellInfo
+ TWrapper
+ ::GetPCellInfo(const PMeshInfo& theMeshInfo,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
+ EConnectivite theConnMode,
+ TErr* theErr)
{
- TInt aNbElem = GetNbCells(*theMeshInfo,theEntity,theGeom,theConn);
- PCellInfo anInfo = CrCellInfo(theMeshInfo,aNbElem,theEntity,theGeom,theConn);
- GetCellInfo(*anInfo,theErr);
+ 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,anInfo->GetConn(iElem,iConn)<<",");
+ ADDMSG(MYVALUEDEBUG,aConnSlice[iConn]<<",");
}
ADDMSG(MYVALUEDEBUG," ");
}
ADDMSG(MYDEBUG,endl);
- BEGMSG(MYDEBUG,"GetPCellInfo - GetFamNum: ");
+ BEGMSG(MYVALUEDEBUG,"GetPCellInfo - GetFamNum: ");
for(TInt iElem = 0; iElem < aNbElem; iElem++){
ADDMSG(MYVALUEDEBUG,anInfo->GetFamNum(iElem)<<", ");
}
- ADDMSG(MYDEBUG,endl);
+ ADDMSG(MYVALUEDEBUG,endl);
if(anInfo->IsElemNum()){
- BEGMSG(MYDEBUG,"GetPCellInfo - GetElemNum: ");
+ BEGMSG(MYVALUEDEBUG,"GetPCellInfo - GetElemNum: ");
for(TInt iElem = 0; iElem < aNbElem; iElem++){
ADDMSG(MYVALUEDEBUG,anInfo->GetElemNum(iElem)<<", ");
}
- ADDMSG(MYDEBUG,endl);
+ ADDMSG(MYVALUEDEBUG,endl);
}
ADDMSG(MYDEBUG,endl);
#endif
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- PFieldInfo TWrapper::GetPFieldInfo(const PMeshInfo& theMeshInfo,
- TInt theId,
- TErr* theErr)
+ PFieldInfo
+ TWrapper
+ ::GetPFieldInfo(const PMeshInfo& theMeshInfo,
+ TInt theId,
+ TErr* theErr)
{
TInt aNbComp = GetNbComp(theId);
PFieldInfo anInfo = CrFieldInfo(theMeshInfo,aNbComp);
#ifdef _DEBUG_
INITMSG(MYDEBUG,
- "GetPFieldInfo - aNbComp = "<<aNbComp<<
- "; aType = "<<anInfo->GetType()<<"\n");
+ "GetPFieldInfo "<<
+ "- aName = '"<<anInfo->GetName()<<"'"<<
+ "; aType = "<<anInfo->GetType()<<
+ "; aNbComp = "<<aNbComp<<
+ endl);
#endif
return anInfo;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- PTimeStampInfo TWrapper::GetPTimeStampInfo(const PFieldInfo& theFieldInfo,
- EEntiteMaillage theEntity,
- const MED::TGeom& theGeom,
- TInt theId,
- TErr* theErr)
+ PTimeStampInfo
+ TWrapper
+ ::GetPTimeStampInfo(const PFieldInfo& theFieldInfo,
+ EEntiteMaillage theEntity,
+ const TGeom2Size& theGeom2Size,
+ TInt theId,
+ TErr* theErr)
{
- PTimeStampInfo anInfo = CrTimeStampInfo(theFieldInfo,theEntity,theGeom);
+ PTimeStampInfo anInfo = CrTimeStampInfo(theFieldInfo,theEntity,theGeom2Size);
GetTimeStampInfo(theId,*anInfo,theErr);
#ifdef _DEBUG_
- INITMSG(MYDEBUG,
- "GetPTimeStampInfo - aNbGauss = "<<anInfo->GetNbGauss()<<
- "; aNumDt = "<<anInfo->GetNumDt()<<"\n");
+ 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;
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- PTimeStampVal TWrapper::GetPTimeStampVal(const PTimeStampInfo& theTimeStampInfo,
- TErr* theErr)
+ 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;
+ }
+
+
+ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ PTimeStampVal
+ TWrapper
+ ::GetPTimeStampVal(const PTimeStampInfo& theTimeStampInfo,
+ const TMKey2Profile& theMKey2Profile,
+ const TKey2Gauss& theKey2Gauss,
+ TErr* theErr)
{
PTimeStampVal anInfo = CrTimeStampVal(theTimeStampInfo);
- GetTimeStampVal(*anInfo,theErr);
+ GetTimeStampVal(*anInfo,theMKey2Profile,theKey2Gauss,theErr);
#ifdef _DEBUG_
- TInt aNbGauss = theTimeStampInfo->GetNbGauss();
PFieldInfo aFieldInfo = theTimeStampInfo->GetFieldInfo();
- TInt aNbComp = aFieldInfo->GetNbComp();
INITMSG(MYDEBUG,"GetPTimeStampVal\n");
- TMeshValue& aMeshValue = anInfo->myMeshValue;
- TMeshValue::const_iterator aMeshValueIter = aMeshValue.begin();
- for(; aMeshValueIter != aMeshValue.end(); aMeshValueIter++){
- const EGeometrieElement& aGeom = aMeshValueIter->first;
- const TValue& aValue = aMeshValueIter->second;
- TInt iElemEnd = aValue.size() / aNbComp / aNbGauss;
- INITMSG(MYDEBUG,"aGeom = "<<aGeom<<" - "<<iElemEnd<<": ");
- for(TInt iElem = 0, anId = 0; iElem < iElemEnd; iElem++){
+ TGeom2Value& aGeom2Value = anInfo->myGeom2Value;
+ TGeom2Value::const_iterator anIter = aGeom2Value.begin();
+ for(; anIter != aGeom2Value.end(); anIter++){
+ const EGeometrieElement& aGeom = anIter->first;
+ const TMeshValue& 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++){
+ TCValueSliceArr aValueSliceArr = aMeshValue.GetGaussValueSliceArr(iElem);
ADDMSG(MYVALUEDEBUG,"{");
- for(TInt iComp = 0; iComp < aNbComp; iComp++){
- for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
- ADDMSG(MYVALUEDEBUG,aValue[anId++]<<" ");
+ for(TInt iGauss = 0; iGauss < aNbGauss; iGauss++){
+ const TCValueSlice& aValueSlice = aValueSliceArr[iGauss];
+ for(TInt iComp = 0; iComp < aNbComp; iComp++){
+ ADDMSG(MYVALUEDEBUG,aValueSlice[iComp]<<" ");
}
ADDMSG(MYVALUEDEBUG,"| ");
}
#define MED_Wrapper_HeaderFile
#include "MED_Structures.hxx"
+#include "MED_Algorithm.hxx"
-namespace MED{
+#include <boost/thread/mutex.hpp>
+
+namespace MED
+{
+
+ //----------------------------------------------------------------------------
+ //! Define a base class that wraps the MED API
+ struct TWrapper
+ {
+ typedef boost::mutex TMutex;
+ //! This is a syncronization primitive which allow to support thread safety for the MED access
+ TMutex myMutex;
- struct TWrapper{
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ //! Creates a MEDWrapper MED Mesh representation
virtual
PMeshInfo
CrMeshInfo(TInt theDim = 0,
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 a MEDWrapper MED Mesh representation by its number
virtual
void
- GetMeshInfo(TInt theMeshId, TMeshInfo&,
+ GetMeshInfo(TInt theMeshId,
+ TMeshInfo& theInfo,
TErr* theErr = NULL) = 0;
+ //! Write the MEDWrapper MED Mesh representation in the defined MED file
virtual
void
SetMeshInfo(const TMeshInfo& theInfo,
TErr* theErr = NULL) = 0;
+ //! Read a MEDWrapper MED Mesh representation by its number
virtual
PMeshInfo
GetPMeshInfo(TInt theId,
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ //! Read number of MED Family entities in the defined MED file
virtual
TInt
GetNbFamilies(const TMeshInfo& theMeshInfo,
TErr* theErr = NULL) = 0;
+ //! Read number of attributes for defined MED Family
virtual
TInt
GetNbFamAttr(TInt theFamId,
const TMeshInfo& theInfo,
TErr* theErr = NULL) = 0;
+ //! Read number of MED Groups where MED Family with the number belong to
virtual
TInt
GetNbFamGroup(TInt theFamId,
const TMeshInfo& theInfo,
TErr* theErr = NULL) = 0;
+ //! Read a MEDWrapper MED Family representation by its number
virtual
void
GetFamilyInfo(TInt theFamId,
TFamilyInfo& theInfo,
TErr* theErr = NULL) = 0;
+ //! Write a MEDWrapper MED Family representation by its number
virtual
void
SetFamilyInfo(const TFamilyInfo& theInfo,
TErr* theErr = NULL) = 0;
+ //! Creates a MEDWrapper MED Family representation
virtual
PFamilyInfo
CrFamilyInfo(const PMeshInfo& theMeshInfo,
TInt theId = 0,
const std::string& theValue = "") = 0;
+ //! Creates a MEDWrapper MED Family representation
virtual
PFamilyInfo
CrFamilyInfo(const PMeshInfo& theMeshInfo,
const TIntVector& theAttrIds = TIntVector(),
const TIntVector& theAttrVals = TIntVector()) = 0;
+ //! A 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
PFamilyInfo
GetPFamilyInfo(const PMeshInfo& theMeshInfo,
TInt theId,
TErr* theErr = NULL);
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ //! Read sequence of names for any descendant of TElemInfo
virtual
void
GetNames(TElemInfo& theInfo,
- TInt nb,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
+ TInt theNb,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
TErr* theErr = NULL)
{}
+ //! Read sequence of numerous for any descendant of TElemInfo
virtual
void
GetNumeration(TElemInfo& theInfo,
- TInt nb,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
+ TInt theNb,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
TErr* theErr = NULL)
{}
+ //! Read sequence MED Family indexes for any descendant of TElemInfo
virtual
void
GetFamilies(TElemInfo& theInfo,
- TInt nb,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
+ TInt theNb,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
TErr* theErr = NULL)
{}
+ //! Write sequence of names for any descendant of TElemInfo
virtual
void
SetNames(const TElemInfo& theInfo,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
TErr* theErr = NULL)
{}
+ //! Write sequence of numerous for any descendant of TElemInfo
virtual
void
SetNumeration(const TElemInfo& theInfo,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
TErr* theErr = NULL)
{}
+ //! Write sequence MED Family indexes for any descendant of TElemInfo
virtual
void
SetFamilies(const TElemInfo& theInfo,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
TErr* theErr = NULL)
{}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ //! Read number of nodes in defined MED Mesh
virtual
TInt
GetNbNodes(const TMeshInfo& theMeshInfo,
TErr* theErr = NULL) = 0;
+ //! Read a MEDWrapper MED Nodes representation from defined MED file
virtual
void
GetNodeInfo(TNodeInfo& theInfo,
TErr* theErr = NULL) = 0;
+ //! Write the MEDWrapper MED Nodes representation into defined MED file
virtual
void
SetNodeInfo(const TNodeInfo& theInfo,
TErr* theErr = NULL) = 0;
+ //! Creates a MEDWrapper MED Nodes representation
virtual
PNodeInfo
CrNodeInfo(const PMeshInfo& theMeshInfo,
TInt theNbElem,
+ EModeSwitch theMode = eFULL_INTERLACE,
ERepere theSystem = eCART,
EBooleen theIsElemNum = eVRAI,
EBooleen theIsElemNames = eVRAI) = 0;
+ //! Creates a MEDWrapper MED Nodes representation
virtual
PNodeInfo
CrNodeInfo(const PMeshInfo& theMeshInfo,
- ERepere theSystem,
const TFloatVector& theNodeCoords,
- const TStringVector& theCoordNames,
- const TStringVector& theCoordUnits,
- const TIntVector& theFamilyNums,
- const TIntVector& theElemNums,
+ 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()) = 0;
+ //! A 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
PNodeInfo
GetPNodeInfo(const PMeshInfo& theMeshInfo,
TErr* theErr = NULL);
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ //! Read a MEDWrapper MED Polygones representation from defined MED file
+ /*! This feature is support only for version of 2.2 and higher */
virtual
void
GetPolygoneInfo(TPolygoneInfo& theInfo,
TErr* theErr = NULL)
{}
+ //! Write a MEDWrapper MED Polygones representation from defined MED file
+ /*! This feature is support only for version of 2.2 and higher */
virtual
void
SetPolygoneInfo(const TPolygoneInfo& theInfo,
TErr* theErr = NULL)
{}
+ //! Read number of MED Polygones in defined MED Mesh
+ /*! This feature is support only for version of 2.2 and higher */
virtual
TInt
GetNbPolygones(const TMeshInfo& theMeshInfo,
- EEntiteMaillage,
- EGeometrieElement,
- EConnectivite,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
+ EConnectivite theConnMode = eNOD,
TErr* theErr = NULL)
- { return 0;}
+ {
+ return 0;
+ }
+ //! Read connectivity infroamtion for the MED Polygones in defined MED Mesh
+ /*! This feature is support only for version of 2.2 and higher */
virtual
TInt
- GetNbPolygoneConn(const TMeshInfo& theMeshInfo,
- EEntiteMaillage,
- EGeometrieElement,
- EConnectivite,
- TErr* theErr = NULL)
- { return 0;}
+ 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 support only for version of 2.2 and higher */
virtual
PPolygoneInfo
CrPolygoneInfo(const PMeshInfo& theMeshInfo,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
TInt theNbElem,
- TInt theNbConn,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- EConnectivite theTConn = eNOD,
+ TInt theConnSize,
+ EConnectivite theConnMode = eNOD,
EBooleen theIsElemNum = eVRAI,
EBooleen theIsElemNames = eVRAI)
{
return PPolygoneInfo();
}
+ //! Creates a MEDWrapper MED Polygones representation
+ /*! This feature is support only for version of 2.2 and higher */
virtual
PPolygoneInfo
CrPolygoneInfo(const PMeshInfo& theMeshInfo,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- EConnectivite theTConn,
- const TIntVector& theConnectivities,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
const TIntVector& theIndexes,
- const TIntVector& theFamilyNums,
- const TIntVector& theElemNums,
+ const TIntVector& theConnectivities,
+ EConnectivite theConnMode = eNOD,
+ const TIntVector& theFamilyNums = TIntVector(),
+ const TIntVector& theElemNums = TIntVector(),
const TStringVector& theElemNames = TStringVector())
{
return PPolygoneInfo();
}
+ //! A copy-constructor for the MEDWrapper MED Polygones representation
virtual
PPolygoneInfo
CrPolygoneInfo(const PMeshInfo& theMeshInfo,
return PPolygoneInfo();
}
+ //! Read a MEDWrapper MED Polygones representation from defined MED file
+ /*! This feature is support only for version of 2.2 and higher */
PPolygoneInfo
GetPPolygoneInfo(const PMeshInfo& theMeshInfo,
EEntiteMaillage theEntity,
EGeometrieElement theGeom,
- EConnectivite theConn = eNOD);
+ 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 */
virtual
TInt
GetNbPolyedres(const TMeshInfo& theMeshInfo,
- EEntiteMaillage,
- EGeometrieElement,
- EConnectivite,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
+ EConnectivite theConnMode = eNOD,
TErr* theErr = NULL)
- { return 0;}
+ {
+ return 0;
+ }
+ //! Read connectivity infroamtion for the MED Polyedres in defined MED Mesh
+ /*! This feature is support only for version of 2.2 and higher */
virtual
void
- GetNbPolyedreConnF(const TMeshInfo& theMeshInfo,
- EConnectivite theConn,
- TInt& nf,
- TInt& nc,
- TErr* theErr = NULL)
- {}
+ GetPolyedreConnSize(const TMeshInfo& theMeshInfo,
+ TInt& theNbFaces,
+ TInt& theConnSize,
+ EConnectivite theConnMode = eNOD,
+ TErr* theErr = NULL)
+ {
+ theNbFaces = theConnSize = 0;
+ }
virtual
PPolyedreInfo
CrPolyedreInfo(const PMeshInfo& theMeshInfo,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
TInt theNbElem,
- TInt theNbConn,
TInt theNbFaces,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- EConnectivite theTConn = eNOD,
+ 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 */
virtual
PPolyedreInfo
CrPolyedreInfo(const PMeshInfo& theMeshInfo,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- EConnectivite theTConn,
- const TIntVector& theConnectivities,
- const TIntVector& theFaces,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
const TIntVector& theIndexes,
- const TIntVector& theFamilyNums,
- const TIntVector& theElemNums,
+ const TIntVector& theFaces,
+ const TIntVector& theConnectivities,
+ EConnectivite theConnMode = eNOD,
+ const TIntVector& theFamilyNums = TIntVector(),
+ const TIntVector& theElemNums = TIntVector(),
const TStringVector& theElemNames = TStringVector())
{
return PPolyedreInfo();
}
+ //! A copy-constructor for the MEDWrapper MED Polyedres representation
virtual
PPolyedreInfo
CrPolyedreInfo(const PMeshInfo& theMeshInfo,
return PPolyedreInfo();
}
+ //! Read a MEDWrapper MED Polyedres representation from defined MED file
+ /*! This feature is support only for version of 2.2 and higher */
PPolyedreInfo
GetPPolyedreInfo(const PMeshInfo& theMeshInfo,
EEntiteMaillage theEntity,
EGeometrieElement theGeom,
- EConnectivite theConn = eNOD);
+ EConnectivite theConnMode = eNOD);
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ //! Get TEntityInfo which contains brief information about existing cells and their destribution among MED ENTITIES
virtual
TEntityInfo
GetEntityInfo(const TMeshInfo& theMeshInfo,
- EConnectivite theTConn = eNOD,
+ EConnectivite theConnMode = eNOD,
TErr* theErr = NULL) = 0;
+ //! Read number of cells for defined MED Mesh, ENTITY and geometrical type with define mode of connectivity
virtual
TInt
GetNbCells(const TMeshInfo& theMeshInfo,
- EEntiteMaillage,
- EGeometrieElement,
- EConnectivite theTConn = eNOD,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
+ EConnectivite theConnMode = eNOD,
TErr* theErr = NULL) = 0;
+ //! Read a MEDWrapper MED Cells representation from defined MED file
virtual
void
GetCellInfo(TCellInfo& theInfo,
TErr* theErr = NULL) = 0;
+ //! Write the MEDWrapper MED Cells representation into defined MED file
virtual
void
SetCellInfo(const TCellInfo& theInfo,
TErr* theErr = NULL) = 0;
+ //! Creates a MEDWrapper MED Cells representation
virtual
PCellInfo
CrCellInfo(const PMeshInfo& theMeshInfo,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
TInt theNbElem,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- EConnectivite theTConn = eNOD,
+ EConnectivite theConnMode = eNOD,
EBooleen theIsElemNum = eVRAI,
- EBooleen theIsElemNames = eVRAI) = 0;
+ EBooleen theIsElemNames = eVRAI,
+ EModeSwitch theMode = eFULL_INTERLACE) = 0;
+ //! Creates a MEDWrapper MED Cells representation
virtual
PCellInfo
CrCellInfo(const PMeshInfo& theMeshInfo,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- EConnectivite theTConn,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
const TIntVector& theConnectivities,
- const TIntVector& theFamilyNums,
- const TIntVector& theElemNums,
- const TStringVector& theElemNames = TStringVector()) = 0;
+ 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
virtual
PCellInfo
CrCellInfo(const PMeshInfo& theMeshInfo,
const PCellInfo& theInfo) = 0;
+ //! Read a MEDWrapper MED Cells representation from defined MED file
PCellInfo
GetPCellInfo(const PMeshInfo& theMeshInfo,
EEntiteMaillage theEntity,
EGeometrieElement theGeom,
- EConnectivite theConn = eNOD,
+ EConnectivite theConnMode = eNOD,
TErr* theErr = NULL);
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ //! Read number of MED FIELDS in defined MED Mesh
virtual
TInt
GetNbFields(TErr* theErr = NULL) = 0;
+ //! Read number of components for the defined 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
void
GetFieldInfo(TInt theFieldId,
TFieldInfo& theInfo,
TErr* theErr = NULL) = 0;
+ //! Write MEDWrapper MED FIELD representation into defined MED file
virtual
void
SetFieldInfo(const TFieldInfo& theInfo,
TErr* theErr = NULL) = 0;
+ //! Creates a MEDWrapper MED FIELD representation
virtual
PFieldInfo
CrFieldInfo(const PMeshInfo& theMeshInfo,
EBooleen theIsLocal = eVRAI,
TInt theNbRef = 1) = 0;
+ //! A 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
PFieldInfo
GetPFieldInfo(const PMeshInfo& theMeshInfo,
TInt theId,
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ //! Read number of MED GAUSS in defined MED Mesh
+ /*! This feature is support only for version of 2.2 and higher */
+ virtual
+ TInt
+ GetNbGauss(TErr* theErr = NULL)
+ {
+ return TInt();
+ }
+
+ //! 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
+ TGaussInfo::TInfo
+ GetGaussPreInfo(TInt theId,
+ TErr* theErr = NULL)
+ {
+ return TGaussInfo::TInfo();
+ }
+
+ //! 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
+ void
+ GetGaussInfo(TInt theId,
+ TGaussInfo& theInfo,
+ TErr* theErr = NULL)
+ {}
+
+ //! Creates a MEDWrapper MED GAUSS representation
+ /*! This feature is support only for version of 2.2 and higher */
+ virtual
+ PGaussInfo
+ CrGaussInfo(const TGaussInfo::TInfo& theInfo,
+ EModeSwitch theMode = eFULL_INTERLACE) = 0;
+
+
+ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ //! Read number of MED TIMESTAMPS in defined 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.
+ */
virtual
TInt
GetNbTimeStamps(const TFieldInfo& theInfo,
const TEntityInfo& theEntityInfo,
EEntiteMaillage& theEntity,
- TGeom& theGeom,
+ TGeom2Size& theGeom2Size,
TErr* theErr = NULL) = 0;
+ //! Read MEDWrapper MED TIMESTAMP representation by its order number
virtual
void
GetTimeStampInfo(TInt theTimeStampId,
TTimeStampInfo& theInfo,
TErr* theErr = NULL) = 0;
+ //! Creates a MEDWrapper MED TIMESTAMP representation
virtual
PTimeStampInfo
CrTimeStampInfo(const PFieldInfo& theFieldInfo,
EEntiteMaillage theEntity,
- const TGeom& theGeom,
- TInt theNbGauss = 0,
+ const TGeom2Size& theGeom2Size,
+ const TGeom2NbGauss& theGeom2NbGauss = TGeom2NbGauss(),
TInt theNumDt = 0,
TInt theNumOrd = 0,
TFloat theDt = 0,
const std::string& theUnitDt = "",
- const std::string& theGaussName = "") = 0;
+ const TGeom2Gauss& theGeom2Gauss = TGeom2Gauss()) = 0;
+ //! A 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
PTimeStampInfo
GetPTimeStampInfo(const PFieldInfo& theFieldInfo,
EEntiteMaillage theEntity,
- const MED::TGeom& theGeom,
+ const TGeom2Size& theGeom2Size,
TInt theId,
TErr* theErr = NULL);
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ //! Read number of MED PROFILES in defined MED Mesh
+ virtual
+ TInt
+ GetNbProfiles(TErr* theErr = NULL) = 0;
+
+ //! Read brief MED PROFILE information by its order number from defined MED Mesh
+ virtual
+ TProfileInfo::TInfo
+ GetProfilePreInfo(TInt theId,
+ TErr* theErr = NULL) = 0;
+
+ //! Read a MEDWrapper MED PROFILE representation by its order number from defined MED file
+ virtual
+ void
+ GetProfileInfo(TInt theId,
+ TProfileInfo& theInfo,
+ TErr* theErr = NULL) = 0;
+
+ //! Creates a MEDWrapper MED PROFILE representation
+ virtual
+ PProfileInfo
+ CrProfileInfo(const TProfileInfo::TInfo& theInfo,
+ EModeProfil theMode = eCOMPACT) = 0;
+
+ //! Read a MEDWrapper MED PROFILE representation by its order number from defined MED file
+ PProfileInfo
+ GetPProfileInfo(TInt theId,
+ EModeProfil theMode = eCOMPACT,
+ TErr* theErr = NULL);
+
+
+ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ //! Read the values for MEDWrapper MED TIEMSTAMP from defined MED file
virtual
void
GetTimeStampVal(TTimeStampVal& theVal,
+ const TMKey2Profile& theMKey2Profile,
+ const TKey2Gauss& theKey2Gauss,
TErr* theErr = NULL) = 0;
+ //! Write the values for MEDWrapper MED TIEMSTAMP to defined MED file
virtual
void
SetTimeStamp(const TTimeStampVal& theTimeStampVal,
TErr* theErr = NULL) = 0;
+ //! Creates the values for MEDWrapper MED TIEMSTAMP representation
virtual
PTimeStampVal
CrTimeStampVal(const PTimeStampInfo& theTimeStampInfo,
- const std::string& thePflName = "",
- EModeProfil thePflMode = eCOMPACT) = 0;
+ const TGeom2Profile& theGeom2Profile = TGeom2Profile(),
+ EModeSwitch theMode = eFULL_INTERLACE) = 0;
+ //! A copy-constructor for the values for MEDWrapper MED TIEMSTAMP representation
virtual
PTimeStampVal
CrTimeStampVal(const PTimeStampInfo& theTimeStampInfo,
const PTimeStampVal& theInfo) = 0;
+ //! Read the values for MEDWrapper MED TIEMSTAMP from defined MED file
PTimeStampVal
GetPTimeStampVal(const PTimeStampInfo& theTimeStampInfo,
+ const TMKey2Profile& theMKey2Profile,
+ const TKey2Gauss& theKey2Gauss,
TErr* theErr = NULL);
};
+
+ //----------------------------------------------------------------------------
+ //! This class provide thread-safety for MEDWrapper interaction
+ class TLockProxy
+ {
+ TLockProxy& operator=(const TLockProxy& );
+ TWrapper* myWrapper;
+
+ public:
+ TLockProxy(TWrapper* theWrapper);
+
+ ~TLockProxy();
+
+ TWrapper * operator-> () const;
+ };
+
+
+ //----------------------------------------------------------------------------
+ //! To specialize the SharedPtr for TWrapper
+ template<>
+ class SharedPtr<TWrapper>: public boost::shared_ptr<TWrapper>
+ {
+ public:
+ SharedPtr() {}
+
+ template<class Y>
+ explicit SharedPtr(Y * p):
+ boost::shared_ptr<TWrapper>(p)
+ {}
+
+ template<class Y>
+ SharedPtr(SharedPtr<Y> const & r):
+ boost::shared_ptr<TWrapper>(r,boost::detail::dynamic_cast_tag())
+ {}
+
+ template<class Y>
+ SharedPtr&
+ operator=(SharedPtr<Y> const & r)
+ {
+ boost::shared_ptr<TWrapper>(r,boost::detail::dynamic_cast_tag()).swap(*this);
+ return *this;
+ }
+
+ 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
+ {
+ return operator=<Y>(SharedPtr<Y>(r));
+ }
+
+ TLockProxy operator-> () const // never throws
+ {
+ return TLockProxy(this->get());
+ }
+
+ protected:
+ operator const TWrapper& () const;
+
+ operator TWrapper& ();
+
+ TWrapper& operator* () const;
+
+ TWrapper * get() const // never throws
+ {
+ return boost::shared_ptr<TWrapper>::get();
+ }
+ };
+
+ //----------------------------------------------------------------------------
+ typedef SharedPtr<TWrapper> PWrapper;
}
#endif
EXPORT_HEADERS = \
MED_Common.hxx \
+ MED_Vector.hxx \
+ MED_SharedPtr.hxx \
+ MED_SliceArray.hxx \
MED_Wrapper.hxx \
MED_TWrapper.hxx \
MED_Structures.hxx \
MED_TStructures.hxx \
MED_Algorithm.hxx \
+ MED_GaussUtils.hxx \
+ MED_CoordUtils.hxx \
MED_Utilities.hxx
# Libraries targets
LIB = libMEDWrapperBase.la
LIB_SRC = \
- MED_Structures.cxx MED_Wrapper.cxx \
- MED_Algorithm.cxx MED_Utilities.cxx
+ MED_Structures.cxx \
+ MED_Wrapper.cxx \
+ MED_Algorithm.cxx \
+ MED_GaussUtils.cxx \
+ MED_CoordUtils.cxx \
+ MED_Utilities.cxx
# Executables targets
BIN =
BIN_SRC =
-CPPFLAGS+= $(BOOST_CPPFLAGS) $(HDF5_INCLUDES) -D@MACHINE@
+CPPFLAGS+= $(BOOST_CPPFLAGS) $(HDF5_INCLUDES) -D@MACHINE@
-LDFLAGS+=
+LDFLAGS+= $(BOOST_LIBS) -lboost_thread-mt
@CONCLUDE@
#include "MED_Utilities.hxx"
#include "MED_Algorithm.hxx"
+#include "MED_GaussUtils.hxx"
#include "MED_Factory.hxx"
#ifdef _DEBUG_
static int MYDEBUG = 0;
#endif
-static int MYVALUEDEBUG = 0;
-
static int MYWRITEDEBUG = 1;
using namespace MED;
+#undef _DEBUG_
void CheckMed(const std::string& theFileName)
{
MSG(MYDEBUG,"CheckMed - theFileName = '"<<theFileName<<"'");
{
+ //TErr anErr;
PWrapper aMed = CrWrapper(theFileName);
+
+ TKey2Gauss aKey2Gauss = GetKey2Gauss(aMed);
+ TMKey2Profile aMKey2Profile = GetMKey2Profile(aMed);
+ INITMSG(MYDEBUG,"aMed->GetNbProfiles() = "<<aMed->GetNbProfiles()<<endl);
+
TInt aNbMeshes = aMed->GetNbMeshes();
- INITMSG(MYDEBUG,"GetNbMeshes() = "<<aNbMeshes<<endl);
+ BEGMSG(MYDEBUG,"GetNbMeshes() = "<<aNbMeshes<<endl);
for(TInt iMesh = 1; iMesh <= aNbMeshes; iMesh++){
PMeshInfo aMeshInfo = aMed->GetPMeshInfo(iMesh);
- INITMSG(MYDEBUG,"aMeshInfo->GetName() = "<<aMeshInfo->GetName()<<endl);
-
- //continue;
+ INITMSG(MYDEBUG,"aMeshInfo->GetName() = '"<<aMeshInfo->GetName()<<"'"<<endl);
TEntityInfo aEntityInfo = aMed->GetEntityInfo(aMeshInfo);
- TElemGroup aElemGroup = GetElemsByEntity(aMed,aMeshInfo,aEntityInfo);
-
- TFamilyGroup aFamilyGroup = GetFamilies(aMed,aMeshInfo);
+ TEntity2TGeom2ElemInfo anEntity2TGeom2ElemInfo =
+ GetEntity2TGeom2ElemInfo(aMed,aMeshInfo,aEntityInfo);
+
+ TFieldInfo2TimeStampInfoSet aFieldInfo2TimeStampInfoSet =
+ GetFieldInfo2TimeStampInfoSet(aMed,aMeshInfo,aEntityInfo);
- TFamilyByEntity aFamilyByEntity = GetFamiliesByEntity(aMed,aElemGroup,aFamilyGroup);
+ TEntite2TFieldInfo2TimeStampInfoSet anEntite2TFieldInfo2TimeStampInfoSet =
+ GetEntite2TFieldInfo2TimeStampInfoSet(aFieldInfo2TimeStampInfoSet);
+
+ TEntite2TFieldInfo2TimeStampInfoSet::const_iterator anEntite2TFieldInfo2TimeStampInfoSetIter =
+ anEntite2TFieldInfo2TimeStampInfoSet.begin();
+ for(; anEntite2TFieldInfo2TimeStampInfoSetIter != anEntite2TFieldInfo2TimeStampInfoSet.end(); anEntite2TFieldInfo2TimeStampInfoSetIter++){
+ const TFieldInfo2TimeStampInfoSet& aFieldInfo2TimeStampInfoSet = anEntite2TFieldInfo2TimeStampInfoSetIter->second;
+ TFieldInfo2TimeStampInfoSet::const_iterator aFieldInfo2TimeStampInfoSetIter = aFieldInfo2TimeStampInfoSet.begin();
+ for(; aFieldInfo2TimeStampInfoSetIter != aFieldInfo2TimeStampInfoSet.end(); aFieldInfo2TimeStampInfoSetIter++){
+ PFieldInfo aFieldInfo = aFieldInfo2TimeStampInfoSetIter->first;
+ INITMSG(MYDEBUG,
+ "GetPFieldInfo "<<
+ "- aName = '"<<aFieldInfo->GetName()<<"'"<<
+ "; aType = "<<aFieldInfo->GetType()<<
+ "; aNbComp = "<<aFieldInfo->GetNbComp()<<
+ endl);
+ const TTimeStampInfoSet& aTimeStampInfoSet = aFieldInfo2TimeStampInfoSetIter->second;
+ TTimeStampInfoSet::const_iterator aTimeStampInfoSettIter = aTimeStampInfoSet.begin();
+ for(; aTimeStampInfoSettIter != aTimeStampInfoSet.end(); aTimeStampInfoSettIter++){
+ PTimeStampInfo aTimeStampInfo = *aTimeStampInfoSettIter;
+ INITMSG(MYDEBUG,
+ "GetPTimeStampInfo "<<
+ "- anEntity = "<<aTimeStampInfo->GetEntity()<<
+ "; aNumDt = "<<aTimeStampInfo->GetNumDt()<<
+ endl);
+ PTimeStampVal aTimeStampVal = aMed->GetPTimeStampVal(aTimeStampInfo,
+ aMKey2Profile,
+ aKey2Gauss);
+ }
+ }
+ }
+
+ continue;
+
+ TFamilyInfoSet aFamilyInfoSet = GetFamilyInfoSet(aMed,aMeshInfo);
- TGroupInfo aGroupInfo = GetFamiliesByGroup(aFamilyGroup);
+ TEntity2FamilySet aEntity2FamilySet =
+ GetEntity2FamilySet(aMed,anEntity2TGeom2ElemInfo,aFamilyInfoSet);
- TTimeStampGroup aTimeStampGroup = GetFieldsByEntity(aMed,aMeshInfo,aEntityInfo);
+ TGroupInfo aGroupInfo = GetGroupInfo(aFamilyInfoSet);
- TFieldGroup aFieldGroup = GetFieldsByEntity(aTimeStampGroup);
-
- TFieldGroup::const_iterator aFieldGroupIter = aFieldGroup.begin();
- for(; aFieldGroupIter != aFieldGroup.end(); aFieldGroupIter++){
- const TTimeStampGroup& aTTimeStampGroup = aFieldGroupIter->second;
- TTimeStampGroup::const_iterator aTTimeStampGroupIter = aTTimeStampGroup.begin();
- for(; aTTimeStampGroupIter != aTTimeStampGroup.end(); aTTimeStampGroupIter++){
- PFieldInfo aFieldInfo = aTTimeStampGroupIter->first;
- const TTimeStampSet& aTimeStampSet = aTTimeStampGroupIter->second;
- TTimeStampSet::const_iterator aTTimeStampSetIter = aTimeStampSet.begin();
- for(; aTTimeStampSetIter != aTimeStampSet.end(); aTTimeStampSetIter++){
- PTimeStampInfo aTimeStampInfo = *aTTimeStampSetIter;
- TErr anErr;
- PTimeStampVal aTimeStampVal = aMed->GetPTimeStampVal(aTimeStampInfo,&anErr);
+ PNodeInfo aNodeInfo = aMed->GetPNodeInfo(aMeshInfo);
+ TEntity2TGeom2ElemInfo::const_iterator anIter = anEntity2TGeom2ElemInfo.begin();
+ for(; anIter != anEntity2TGeom2ElemInfo.end(); anIter++){
+ const EEntiteMaillage& anEntity = anIter->first;
+ if(anEntity != eNOEUD){
+ const TGeom2ElemInfo& aGeom2ElemInfo = anIter->second;
+ TKey2Gauss::const_iterator anIter2 = aKey2Gauss.begin();
+ for(; anIter2 != aKey2Gauss.end(); anIter2++){
+ const TGaussInfo::TKey& aKey = anIter2->first;
+ EGeometrieElement aGeom = boost::get<0>(aKey);
+ TGeom2ElemInfo::const_iterator anIter3 = aGeom2ElemInfo.find(aGeom);
+ if(anIter3 != aGeom2ElemInfo.end()){
+ if(PCellInfo aCellInfo = anIter3->second){
+ PGaussInfo aGaussInfo = anIter2->second;
+ TGaussCoord aGaussCoord;
+ GetGaussCoord3D(aGaussInfo,aCellInfo,aNodeInfo,aGaussCoord);
+ }
+ }
}
}
}
-
+
}
}
MSG(MYDEBUG,"OK");
const PWrapper& theMed2,
int theIncr)
{
+ TKey2Gauss aKey2Gauss = GetKey2Gauss(theMed);
+ TMKey2Profile aMKey2Profile = GetMKey2Profile(theMed);
+
TInt aNbMeshes = theMed->GetNbMeshes();
MSG(MYDEBUG,"aNbMeshes = "<<aNbMeshes);
std::string aName;
}
EEntiteMaillage anEntity;
- TGeom aTGeom;
+ TGeom2Size aGeom2Size;
TInt aNbTimeStamps =
- theMed->GetNbTimeStamps(aFieldInfo,aEntityInfo,anEntity,aTGeom);
+ theMed->GetNbTimeStamps(aFieldInfo,aEntityInfo,anEntity,aGeom2Size);
{
INITMSG(MYDEBUG,"GetNbTimeStamps = "<<aNbTimeStamps<<endl);
for(TInt iTimeStamp = 0; iTimeStamp < aNbTimeStamps; iTimeStamp++){
PTimeStampInfo aTimeStampInfo =
- theMed->GetPTimeStampInfo(aFieldInfo,anEntity,aTGeom,iTimeStamp+1);
+ theMed->GetPTimeStampInfo(aFieldInfo,anEntity,aGeom2Size,iTimeStamp+1);
TInt aNumDt = aTimeStampInfo->GetNumDt();
- TInt aNbGauss = aTimeStampInfo->GetNbGauss();
- INITMSG(MYDEBUG,"aNbGauss = "<<aNbGauss<<"; aNumDt = "<<aNumDt<<"\n");
+ INITMSG(MYDEBUG,"aNumDt = "<<aNumDt<<"\n");
PTimeStampInfo aTimeStampInfo2 =
theMed->CrTimeStampInfo(aFieldInfo2,aTimeStampInfo);
- PTimeStampVal aTimeStampVal = theMed->GetPTimeStampVal(aTimeStampInfo);
+ PTimeStampVal aTimeStampVal = theMed->GetPTimeStampVal(aTimeStampInfo,
+ aMKey2Profile,
+ aKey2Gauss);
- PTimeStampVal aTimeStampVal2 = theMed->CrTimeStampVal(aTimeStampInfo2,aTimeStampVal);
+ PTimeStampVal aTimeStampVal2 = theMed->CrTimeStampVal(aTimeStampInfo2,
+ aTimeStampVal);
if(MYWRITEDEBUG) theMed2->SetTimeStamp(aTimeStampVal2);
-
- TMeshValue& aMeshValue = aTimeStampVal->myMeshValue;
- TMeshValue::iterator aMeshValueIter = aMeshValue.begin();
- for(; aMeshValueIter != aMeshValue.end(); aMeshValueIter++){
- EGeometrieElement aGeom = aMeshValueIter->first;
- TValue aValue = aMeshValueIter->second;
- INITMSG(MYDEBUG,"aGeom = "<<aGeom<<"; aValue = "<<aValue.size()<<": ");
- for(TInt i = 0, iEnd = aValue.size()/aNbComp; i < iEnd; i++){
- for(TInt j = 0, ij = i*aNbComp; j < aNbComp; j++, ij++){
- ADDMSG(MYVALUEDEBUG,aValue[ij]<<",");
- }
- ADDMSG(MYVALUEDEBUG," ");
- }
- ADDMSG(MYDEBUG,"\n");
- }
}
}
}
if(MYWRITEDEBUG) theMed2->SetNodeInfo(aNodeInfo2);
continue;
}
- TGeom& aTGeom = anEntityInfoIter->second;
- TGeom::iterator anTGeomIter = aTGeom.begin();
- for(; anTGeomIter != aTGeom.end(); anTGeomIter++){
- const EGeometrieElement& aGeom = anTGeomIter->first;
- const TInt& aNbElem = anTGeomIter->second;
+ TGeom2Size& aGeom2Size = anEntityInfoIter->second;
+ TGeom2Size::iterator aGeomIter = aGeom2Size.begin();
+ for(; aGeomIter != aGeom2Size.end(); aGeomIter++){
+ const EGeometrieElement& aGeom = aGeomIter->first;
+ const TInt& aNbElem = aGeomIter->second;
INITMSG(MYDEBUG,"aGeom = "<<aGeom<<"; aNbElem = "<<aNbElem<<": ");
switch(aGeom){
- case ePOLYGONE:
- {
- PPolygoneInfo aPolygoneInfo = theMed->GetPPolygoneInfo(aMeshInfo,anEntity,aGeom);
- TElemNum aConn = aPolygoneInfo->GetConnectivite();
- TElemNum aIndex = aPolygoneInfo->GetIndex();
- TInt aNbIndex = aIndex.size();
- TInt aIndex0 = aIndex[0];
- for(TInt iElem = 1; iElem < aNbIndex; iElem++){
- for (TInt i = aIndex0; i < aIndex[iElem];i++)
- ADDMSG(MYVALUEDEBUG,aConn[i-1]<<",");
- ADDMSG(MYDEBUG," ");
- aIndex0 = aIndex[iElem];
- }
- ADDMSG(MYDEBUG,endl);
- INITMSG(MYDEBUG,"Indexes :");
- for(TInt iElem = 0; iElem < aIndex.size(); iElem++){
- ADDMSG(MYVALUEDEBUG,aIndex[iElem]<<",");
- }
- ADDMSG(MYDEBUG,endl);
- PPolygoneInfo aPolygoneInfo2 = theMed->CrPolygoneInfo(aMeshInfo2,aPolygoneInfo);
- if(MYWRITEDEBUG) theMed2->SetPolygoneInfo(aPolygoneInfo2);
- break;
- }
- case ePOLYEDRE:
- {
- PPolyedreInfo aPolyedreInfo = theMed->GetPPolyedreInfo(aMeshInfo,anEntity,aGeom);
- TElemNum aConn = aPolyedreInfo->GetConnectivite();
- TElemNum aFacesIndex = aPolyedreInfo->GetFacesIndex();
- TElemNum aIndex = aPolyedreInfo->GetIndex();
-
- TInt aNbIndex = aIndex.size();
-
- for (int aNp = 0; aNp < aNbIndex-1;aNp++){
- if (aPolyedreInfo->IsElemNames())
- ADDMSG(MYDEBUG,aPolyedreInfo->GetElemName(aNp)<<endl);
- else
- ADDMSG(MYDEBUG,"POLYEDRE "<<aNp+1<<endl);
-
- for (int aNf = aIndex[aNp]-1;aNf < aIndex[aNp+1]-1;aNf++){
- ADDMSG(MYDEBUG,"Face "<<aNf-aIndex[aNp]+2<<": [");
- for (int aNc = aFacesIndex[aNf]-1; aNc < aFacesIndex[aNf+1]-1;aNc++){
- ADDMSG(MYDEBUG," "<<aConn[aNc]);
- }
- ADDMSG(MYDEBUG," ]"<<endl;);
- }
- }
-
- PPolyedreInfo aPolyedreInfo2 = theMed->CrPolyedreInfo(aMeshInfo2,aPolyedreInfo);
- if(MYWRITEDEBUG) theMed2->SetPolyedreInfo(aPolyedreInfo2);
- break;
- }
+ case ePOLYGONE: {
+ PPolygoneInfo aPolygoneInfo = theMed->GetPPolygoneInfo(aMeshInfo,anEntity,aGeom);
+ PPolygoneInfo aPolygoneInfo2 = theMed->CrPolygoneInfo(aMeshInfo2,aPolygoneInfo);
+ if(MYWRITEDEBUG) theMed2->SetPolygoneInfo(aPolygoneInfo2);
+ break;
+ }
+ case ePOLYEDRE: {
+ PPolyedreInfo aPolyedreInfo = theMed->GetPPolyedreInfo(aMeshInfo,anEntity,aGeom);
+ PPolyedreInfo aPolyedreInfo2 = theMed->CrPolyedreInfo(aMeshInfo2,aPolyedreInfo);
+ if(MYWRITEDEBUG) theMed2->SetPolyedreInfo(aPolyedreInfo2);
+ break;
+ }
default:
PCellInfo aCellInfo = theMed->GetPCellInfo(aMeshInfo,anEntity,aGeom);
PCellInfo aCellInfo2 = theMed2->CrCellInfo(aMeshInfo2,aCellInfo);
int main(int argc, char** argv){
+#ifndef _DEBUG_
try{
+#endif
if(argc == 2)
CheckMed(argv[1]);
if(argc == 3)
if(argc == 5)
ReadMed(argv[1],argv[2],MED::EVersion(atoi(argv[3])),atoi(argv[4]));
return 0;
+#ifndef _DEBUG_
}catch(std::exception& exc){
MSG(MYDEBUG,"Follow exception was accured :\n"<<exc.what());
}catch(...){
MSG(MYDEBUG,"Unknown exception was accured");
}
+#endif
return 1;
}
LDFLAGS+= -lMEDWrapper_V2_2 -lMEDWrapper_V2_1
-LDFLAGSFORBIN=$(LDFLAGS) $(HDF5_LIBS) -lMEDWrapperBase
+LDFLAGSFORBIN=$(LDFLAGS) -lMEDWrapperBase $(BOOST_LIBS) -lboost_thread-mt -lmed_V2_1
@CONCLUDE@
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+
+#include <stdlib.h>
+#include "med_misc.hxx"
+
+/*
+ * - Nom de la fonction : _MED1cstring
+ * - Description : convertit une chaine de caracteres FORTRAN
+ * en une nouvelle chaine de caracteres C
+ * dont la longueur est passee en parametre.
+ * Les caracteres completes sont des blancs
+ * - Parametres :
+ * - chaine (IN) : la chaine FORTRAN
+ * - longueur_reelle (IN) : la longueur de la chaine FORTRAN
+ * - longueur_fixee (IN) : longueur de la chaine C a construire
+ * - Resultat : la nouvelle chaine C en cas de succes, NULL sinon
+ */
+
+namespace med_2_1{
+
+char *
+_MED1cstring(char *chaine,int longueur_reelle,int longueur_fixee)
+{
+ char *nouvelle;
+ int i;
+
+ if (longueur_reelle > longueur_fixee)
+ return NULL;
+
+ if ((nouvelle = (char *) malloc(sizeof(char)*(longueur_fixee+1))) == NULL)
+ return NULL;
+
+ for (i=0;i<longueur_reelle;i++)
+ *(nouvelle+i) = *(chaine+i);
+
+ for (i=longueur_reelle;i<longueur_fixee;i++)
+ *(nouvelle+i) = ' ';
+
+ *(nouvelle+longueur_fixee) = '\0';
+
+ return nouvelle;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include <stdlib.h>
+#include "med_misc.hxx"
+
+/*
+ * - Nom de la fonction _MED2cstring
+ * - Description : convertit une chaine de caracteres FORTRAN en
+ * nouvelle chaine de caracteres C
+ * - Parametres :
+ * - chaine (IN) : la chaine FORTRAN
+ * - longueur (IN) : longueur de la chaine
+ * - Resultat : la nouvelle chaine C en cas de succes, NULL sinon
+ */
+
+namespace med_2_1{
+
+char *
+_MED2cstring(char *chaine, int longueur)
+{
+ char *nouvelle;
+ char *temoin;
+ int long_reelle = longueur;
+ int i;
+
+ if ( longueur < 0 ) return NULL;
+
+ temoin = chaine+longueur-1;
+ while (*temoin == ' ' && (temoin != chaine) )
+ {
+ temoin --;
+ long_reelle--;
+ }
+ if ( *temoin == ' ') long_reelle = 0;
+
+ if ((nouvelle = (char *) malloc(sizeof(char)*(long_reelle+1))) == NULL)
+ return NULL;
+
+ for (i=0;i<long_reelle+1;i++)
+ *(nouvelle+i) = *(chaine+i);
+ *(nouvelle+long_reelle) = '\0';
+
+ return nouvelle;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+namespace med_2_1{
+
+med_err
+_MEDGeometrieElement(med_geometrie_element typ_geo[],med_entite_maillage typ_ent)
+{
+ int i;
+ med_geometrie_element typ_mai[MED_NBR_GEOMETRIE_MAILLE] = {MED_POINT1,MED_SEG2,
+ MED_SEG3,MED_TRIA3,
+ MED_TRIA6,MED_QUAD4,
+ MED_QUAD8,MED_TETRA4,
+ MED_TETRA10,MED_HEXA8,
+ MED_HEXA20,MED_PENTA6,
+ MED_PENTA15,MED_PYRA5,
+ MED_PYRA13};
+ med_geometrie_element typ_fac[MED_NBR_GEOMETRIE_FACE] = {MED_TRIA3,MED_TRIA6,
+ MED_QUAD4,MED_QUAD8};
+ med_geometrie_element typ_are[MED_NBR_GEOMETRIE_ARETE] = {MED_SEG2,MED_SEG3};
+
+ switch(typ_ent)
+ {
+ case MED_MAILLE :
+ for (i=0;i<MED_NBR_GEOMETRIE_MAILLE;i++)
+ typ_geo[i] = typ_mai[i];
+ break;
+
+ case MED_FACE :
+ for (i=0;i<MED_NBR_GEOMETRIE_FACE;i++)
+ typ_geo[i] = typ_fac[i];
+ break;
+
+ case MED_ARETE :
+ for (i=0;i<MED_NBR_GEOMETRIE_ARETE;i++)
+ typ_geo[i] = typ_are[i];
+ break;
+
+ default :
+ return -1;
+ }
+ return 0;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+/*
+ * - Nom de la fonction : _MEDattrFermer
+ * - Description : fermeture de l'acces a l'attribut dont l'ID est passe en
+ * parametre
+ * - Parametres :
+ * - pid (IN) : l'ID de l'objet HDF pere ou placer l'attribut
+ * - Resultat : 0 en cas de succes, -1 sinon
+ */
+
+namespace med_2_1{
+
+med_err
+_MEDattrFermer(med_idt id)
+{
+ med_err ret;
+
+ if ((ret = H5Aclose(id)) < 0)
+ return -1;
+
+ return 0;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+/*
+ * - Nom de la fonction : _MEDattrNumEcrire
+ * - Description : ecriture d'un attribut entier
+ * - Parametres :
+ * - pere (IN) : l'ID de l'objet HDF pere ou placer l'attribut
+ * - type (IN) : le type du champ {MED_REEL64,MED_INT}
+ * - nom (IN) : le nom de l'attribut
+ * - val (IN) : la valeur de l'attribut
+ * - Resultat : 0 en cas de succes, -1 sinon
+ */
+
+namespace med_2_1{
+
+med_err
+_MEDattrNumEcrire(med_idt pere,med_type_champ type,char *nom,unsigned char *val,
+ med_mode_acces mode)
+{
+ med_idt aid,attr;
+ med_err ret;
+ int type_hdf;
+
+ switch(type)
+ {
+ case MED_REEL64 :
+ /* 1) IA32 is LE but due to an (?HDF convertion BUG?) when using H5T_NATIVE_DOUBLE/MED_REEL64? under PCLINUX
+ the file read under SGI is incorrect
+ 2) Compaq OSF/1 is LE, since we force SGI64,SUN4SOL2,HP to write double in LE even if they are BE, mips OSF/1 must be BE
+ REM : Be careful of compatibility between MED files when changing this (med2.2) */
+#if defined(PCLINUX) || defined(OSF1)
+ type_hdf = H5T_IEEE_F64BE;
+#else
+ type_hdf = H5T_IEEE_F64LE;
+#endif
+ break;
+
+ case MED_INT :
+#if defined(IRIX64) || defined(OSF1)
+ type_hdf = H5T_NATIVE_LONG;
+#elif defined(PCLINUX)
+ /* This explicit convertion avoid a core dump between in HDF&ASTER when reading on SGI
+ a file written under a PCLINUX system (in founction H5Tconvert),
+ we don't know yet if it is an HDF bug or an ASTER one */
+ /* The problem seems to be in convertion process between INT32LE->INT32BE ? */
+ type_hdf = H5T_STD_I32BE;
+ if ((H5Tconvert(H5T_NATIVE_INT,H5T_STD_I32BE,1,(void *)val,NULL,NULL)) < 0)
+ return -1;
+#else
+ type_hdf = H5T_NATIVE_INT;
+#endif
+ break;
+
+ default :
+ return -1;
+ }
+
+ if ((aid = H5Screate(H5S_SCALAR)) < 0)
+ return -1;
+
+ if ( ((attr = H5Aopen_name(pere,nom)) > 0) && (mode != MED_REMP) )
+ return -1;
+ else
+ if ( attr < 0)
+ if ((attr = H5Acreate(pere,nom,type_hdf,aid,H5P_DEFAULT)) < 0) return -1;
+
+ if ((ret = H5Awrite(attr,type_hdf,val)) < 0)
+ return -1;
+
+
+ if ((ret = H5Sclose(aid)) < 0)
+ return -1;
+ if ((ret = H5Aclose(attr)) < 0)
+ return -1;
+
+#if defined(PCLINUX)
+ /* This explicit convertion cancel the previous on which avoid a mysterious bug between HDF&ASTER when reading
+ a file written under a PCLINUX system, we don't know yet if it is an HDF bug or an ASTER one */
+ if (type == MED_INT)
+ if ((H5Tconvert(H5T_STD_I32BE,H5T_NATIVE_INT,1,(void *)val,NULL,NULL)) < 0)
+ return -1;
+#endif
+
+ return 0;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+/*
+ * - Nom de la fonction : _MEDattrNumLire
+ * - Description : lecture d'un attribut entier
+ * - Parametres :
+ * - pere (IN) : l'ID de l'objet HDF pere ou placer l'attribut
+ * - type (IN) : le type du champ {MED_REEL64,MED_INT}
+ * - nom (IN) : le nom de l'attribut
+ * - val (OUT) : la valeur de l'attribut
+ * - Resultat : 0 en cas de succes, -1 sinon
+ */
+
+namespace med_2_1{
+
+med_err
+_MEDattrNumLire(med_idt pere,med_type_champ type,char *nom,unsigned char *val)
+{
+ med_idt attid;
+ med_err ret;
+ int type_hdf;
+
+ if ((attid = H5Aopen_name(pere,nom)) < 0)
+ return -1;
+
+ switch(type)
+ {
+ case MED_REEL64 :
+#if defined(PCLINUX) || defined(OSF1)
+ type_hdf = H5T_IEEE_F64BE;
+#else
+ type_hdf = H5T_IEEE_F64LE;
+#endif
+ break;
+
+ case MED_INT :
+#if defined(IRIX64) || defined(OSF1)
+ type_hdf = H5T_NATIVE_LONG;
+#else
+ type_hdf = H5T_NATIVE_INT;
+#endif
+ break;
+
+ default :
+ return -1;
+ }
+
+ if ((ret = H5Aread(attid,type_hdf,val)) < 0)
+ return -1;
+
+ if ((ret = H5Aclose(attid)) < 0)
+ return -1;
+
+ return 0;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+/*
+ * - Nom de la fonction : _MEDattrOuvrir
+ * - Description : acces a l'attribut dont le nom est passe en parametre
+ * - Parametres :
+ * - pid (IN) : l'ID de l'objet HDF pere ou placer l'attribut
+ * - nom (IN) : le nom de l'attribut
+ * - Resultat : ID de l'attribut en cas de succes, -1 sinon
+ */
+
+namespace med_2_1{
+
+med_idt
+_MEDattrOuvrir(med_idt pid,char * nom)
+{
+ med_idt aid;
+
+ if ((aid = H5Aopen_name(pid,nom)) < 0)
+ return -1;
+
+ return aid;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+/*
+ * - Nom de la fonction : _MEDattrStringEcrire
+ * - Description : ecriture d'un attribut chaine de caracteres
+ * - Parametres :
+ * - pere (IN) : l'ID de l'objet HDF pere ou placer l'attribut
+ * - nom (IN) : le nom de l'attribut
+ * - longueur (IN) : strlen(val)
+ * - val (IN) : la valeur de l'attribut
+ * - Resultat : 0 en cas de succes, -1 sinon
+ */
+
+namespace med_2_1{
+
+med_err
+_MEDattrStringEcrire(med_idt pere,char *nom,int longueur,char *val, med_mode_acces mode)
+{
+ med_idt aid,attr, datatype;
+ med_err ret;
+
+ if ((aid = H5Screate(H5S_SCALAR)) < 0)
+ return -1;
+ if((datatype = H5Tcopy(H5T_C_S1)) < 0)
+ return -1;
+ if((ret = H5Tset_size(datatype,longueur+1)) < 0)
+ return -1;
+
+ if ( ((attr = H5Aopen_name(pere,nom)) > 0)
+ && (mode != MED_REMP) )
+ return -1;
+ else
+ if ( attr < 0)
+ if ((attr = H5Acreate(pere,nom,datatype,aid,H5P_DEFAULT)) < 0) return -1;
+
+ if ((ret = H5Awrite(attr, datatype, val)) < 0)
+ return -1;
+
+ if ((ret = H5Sclose(aid)) < 0)
+ return -1;
+ if ((ret = H5Tclose(datatype)) < 0)
+ return -1;
+ if ((ret = H5Aclose(attr)) < 0)
+ return -1;
+
+ return 0;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+/*
+ * - Nom de la fonction : _MEDattrStringLire
+ * - Description : lecture d'un attribut chaine de caracteres
+ * - Parametres :
+ * - pere (IN) : l'ID de l'objet HDF pere ou placer l'attribut
+ * - nom (IN) : le nom de l'attribut
+ * - longueur (IN) : strlen(val)
+ * - val (OUT) : la valeur de l'attribut
+ * - Resultat : 0 en cas de succes, -1 sinon
+ */
+
+namespace med_2_1{
+
+med_err
+_MEDattrStringLire(med_idt pere,char *nom,int longueur,char *val)
+{
+ med_idt attid,datatype;
+ med_err ret;
+
+ if ((datatype = H5Tcopy(H5T_C_S1)) < 0)
+ return -1;
+ if ((ret = H5Tset_size(datatype,longueur+1)) < 0)
+ return -1;
+ if ((attid = H5Aopen_name(pere,nom)) < 0)
+ return -1;
+ if ((ret = H5Aread(attid,datatype,val)) < 0)
+ return -1;
+ if ((ret = H5Tclose(datatype)) < 0)
+ return -1;
+ if ((ret = H5Aclose(attid)) < 0)
+ return -1;
+
+ return 0;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med_outils.hxx"
+#include "med.hxx"
+
+#if defined(IRIX64)
+#define MED_INTEGER MED_INT64
+#else
+#define MED_INTEGER MED_INT32
+#endif
+
+namespace med_2_1{
+
+med_err
+MEDbodyFittedEcr(med_idt fid, char *maa, med_int mdim, med_float *coo, med_int *nbr, med_mode_switch mode_coo,
+ med_repere repere, char *nomcoo, char *unicoo, med_int *fam, med_int nnoeuds, med_mode_acces mode )
+{
+ /* ecriture des coordonnees */
+ med_idt maaid, noeid, dataset;
+ med_size dimd[1];
+ char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
+ med_int type_rep_int;
+ int d;
+ char *ds;
+
+ /* On inhibe le gestionnaire d'erreur HDF */
+ _MEDmodeErreurVerrouiller();
+
+ /* Si le maillage n'existe pas => erreur */
+ strcpy(chemin, MED_MAA);
+ strcat(chemin, maa);
+ if ((maaid = _MEDdatagroupOuvrir(fid, chemin)) < 0) {
+ return(-1);
+ };
+
+ /* Si le Data Group "NOE" n'existe pas on le cree */
+ if ((noeid = _MEDdatagroupOuvrir(maaid, MED_NOM_NOE)) < 0) {
+ if ((noeid = _MEDdatagroupCreer(maaid, MED_NOM_NOE)) < 0) {
+ return(-1);
+ };
+ };
+
+ /* Creation du Data Set "BOF" */
+ dimd[0] = nnoeuds*mdim;
+ if (_MEDdatasetNumEcrire(noeid, MED_NOM_BOF, MED_REEL64, mode_coo, mdim, MED_ALL, MED_NOPF, 0, 0, dimd, (unsigned char*)coo, mode) < 0) {
+ return(-1);
+ };
+
+ /* On re-ouvre le Data Set "BOF" pour y placer des attributs */
+ if ((dataset = _MEDdatasetOuvrir(noeid, MED_NOM_BOF)) < 0) {
+ return(-1);
+ };
+
+ /* Attribut NBR (nombre de noeuds) */
+ if (_MEDattrEntierEcrire(dataset, MED_NOM_NBR, &nnoeuds, mode) < 0) {
+ return(-1);
+ };
+
+ /* L'attribut "REP" */
+ type_rep_int = (med_int)repere;
+ if (_MEDattrEntierEcrire(dataset, MED_NOM_REP, &type_rep_int, mode) < 0) {
+ return(-1);
+ };
+
+ /* Attribut "NOM" */
+ if (_MEDattrStringEcrire(dataset, MED_NOM_NOM, mdim*MED_TAILLE_PNOM, nomcoo, mode) < 0) {
+ return(-1);
+ };
+
+ /* Attribut "UNI" */
+ if (_MEDattrStringEcrire(dataset, MED_NOM_UNI, mdim*MED_TAILLE_PNOM, unicoo, mode) < 0) {
+ return(-1);
+ };
+
+ if (_MEDdatasetFermer(dataset) < 0) return(-1);
+
+ dimd[0] = 1;
+ for (d=0; d<mdim; d++) {
+ switch (d) {
+ case 0 : {
+ ds = MED_NOM_IN1;
+ break;
+ };
+ case 1 : {
+ ds = MED_NOM_IN2;
+ break;
+ };
+ case 2 : {
+ ds = MED_NOM_IN3;
+ break;
+ };
+ default : {
+ return(-1);
+ };
+ };
+
+ /* Creation du Data Set "IN1", "IN2", "IN3" contenant la taille du bodyfitted sur cette dimension */
+ if (_MEDdatasetNumEcrire(noeid, ds, MED_INTEGER, mode_coo, MED_DIM1, MED_ALL, MED_NOPF, 0, 0, dimd, (unsigned char*)&nbr[d], mode) < 0) {
+ return(-1);
+ };
+
+ /* On re-ouvre ce Data Set pour y placer des attributs */
+ if ((dataset = _MEDdatasetOuvrir(noeid, ds)) < 0) {
+ return(-1);
+ };
+
+ /* Attribut NBR (nombre de noeuds dans l'une des dimensions) */
+ if (_MEDattrEntierEcrire(dataset, MED_NOM_NBR, &nbr[d], mode) < 0) {
+ return(-1);
+ };
+
+ if (_MEDdatasetFermer(dataset) < 0) return(-1);
+ };
+
+ /* Ecriture des numeros de familles */
+ if (MEDfamEcr(fid, maa, fam, nnoeuds, mode, MED_NOEUD, MED_POINT1) < 0) {
+ return(-1);
+ };
+
+ /* On ferme tout */
+ if (_MEDdatagroupFermer(noeid) < 0) return(-1);
+ if (_MEDdatagroupFermer(maaid) < 0) return(-1);
+ return(0);
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med_outils.hxx"
+#include "med.hxx"
+
+namespace med_2_1{
+
+med_err
+MEDbodyFittedLire(med_idt fid, char *maa, med_int mdim, med_float *coo, med_mode_switch mode_coo,
+ med_repere *repere, char *nomcoo, char *unicoo, med_int *fam, med_int nnoeuds )
+{
+ med_idt maaid, noeid, dataset;
+ char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
+ med_int type_rep_int;
+
+ /* On inhibe le gestionnaire d'erreur */
+ _MEDmodeErreurVerrouiller();
+
+ /* Si le maillage n'existe pas => erreur */
+ strcpy(chemin, MED_MAA);
+ strcat(chemin, maa);
+ maaid = _MEDdatagroupOuvrir(fid, chemin);
+ if (maaid < 0) return(-1);
+
+ /* Si le Data Group "NOE" n'existe pas => erreur */
+ noeid = _MEDdatagroupOuvrir(maaid, MED_NOM_NOE);
+ if (noeid < 0) return(-1);
+
+ /* Lecture du Data Set "BOF" */
+ if (_MEDdatasetNumLire(noeid, MED_NOM_BOF, MED_REEL64, mode_coo, mdim, MED_ALL, MED_NOPF, 0, 1, (unsigned char*)coo) < 0) {
+ return(-1);
+ };
+
+ /* On re-ouvre le Data Set "BOF" pour y lire des attributs */
+ dataset = _MEDdatasetOuvrir(noeid, MED_NOM_BOF);
+ if (dataset < 0) return(-1);
+
+ /* L'attribut "REP" */
+ if (_MEDattrEntierLire(dataset, MED_NOM_REP, &type_rep_int) < 0) {
+ return(-1);
+ } else {
+ *repere = (med_repere)type_rep_int;
+ };
+
+ /* Attribut "NOM" */
+ if (_MEDattrStringLire(dataset, MED_NOM_NOM, mdim*MED_TAILLE_PNOM, nomcoo) < 0) {
+ return(-1);
+ };
+
+ /* Attribut "UNI" */
+ if (_MEDattrStringLire(dataset, MED_NOM_UNI, mdim*MED_TAILLE_PNOM, unicoo) < 0) {
+ return(-1);
+ };
+
+ /* lecture des numeros de familles */
+ if (MEDfamLire(fid, maa, fam, nnoeuds, MED_NOEUD, MED_POINT1) < 0) {
+ return(-1);
+ };
+
+ /* On ferme tout */
+ if (_MEDdatasetFermer(dataset) < 0) {
+ return(-1);
+ };
+ if (_MEDdatagroupFermer(noeid) < 0) {
+ return(-1);
+ };
+ if (_MEDdatagroupFermer(maaid) < 0) {
+ return(-1);
+ };
+ return(0);
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+#include <string.h>
+#include <stdlib.h>
+
+namespace med_2_1{
+
+med_err
+MEDchampCr(med_idt fid, char *champ, med_type_champ type, char *comp,
+ char *unit,med_int ncomp)
+{
+ med_err ret = 0;
+ med_idt root,gid;
+ char chemin[MED_TAILLE_CHA+1];
+ med_size dimd[1];
+ med_int _type = (med_int) type;
+
+ /*
+ * On inhibe le gestionnaire d'erreur HDF 5
+ */
+ _MEDmodeErreurVerrouiller();
+
+ /*
+ * Si le Data Group "/CHA/" n'existe pas, on le cree
+ */
+ strncpy(chemin,MED_CHA,MED_TAILLE_CHA-1);
+ chemin[MED_TAILLE_CHA-1] = '\0';
+ if ((root = _MEDdatagroupOuvrir(fid,chemin)) < 0)
+ if ((root = _MEDdatagroupCreer(fid,chemin)) < 0)
+ return -1;
+
+ /*
+ * Si le Data Group cha n'existe pas, on le cree
+ * Sinon => erreur
+ */
+ if ((gid = _MEDdatagroupOuvrir(root,champ)) >= 0)
+ return -1;
+ if ((gid = _MEDdatagroupCreer(root,champ)) < 0)
+ return -1;
+
+ /*
+ * Les infos sur les composants du champ
+ */
+ if ((ret = _MEDattrEntierEcrire(gid,MED_NOM_NCO,&ncomp,MED_REMP)) < 0)
+ return -1;
+ if ((ret = _MEDattrEntierEcrire(gid,MED_NOM_TYP,&_type,MED_REMP)) < 0)
+ return -1;
+ if ((ret = _MEDattrStringEcrire(gid,MED_NOM_NOM,MED_TAILLE_PNOM*ncomp,comp,MED_REMP)) < 0)
+ return -1;
+ if ((ret = _MEDattrStringEcrire(gid,MED_NOM_UNI,MED_TAILLE_PNOM*ncomp,unit,MED_REMP)) < 0)
+ return -1;
+
+ /*
+ * On ferme tout
+ */
+ if ((ret = _MEDdatagroupFermer(gid)) < 0)
+ return -1;
+ if ((ret = _MEDdatagroupFermer(root)) < 0)
+ return -1;
+
+ return ret;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+#include <string.h>
+#include <stdlib.h>
+
+/*
+ * - Nom de la fonction : MEDchampEcr
+ * - Description : ecriture d'un Champ Résultat
+ * - Parametres :
+ * - fid (IN) : ID du fichier HDF courant
+ * - maa (IN) : le nom du maillage sur lequel s'applique le champ
+ * - cha (IN) : le nom du champ
+ * - val (IN) : valeurs du champ à stocker
+ * - interlace(IN) : entrelacement utilisé en mémoire {MED_FULL_INTERLACE,MED_NO_INTERLACE}
+ * - nbelem (IN) : nombre d'éléments (prend en compte le nbre
+ * de points de Gauss (c'est demandé à l'utilisateur ds la doc) mais pas le nbre de composantes)
+ * - ngauss (IN) : nbre de point de gauss utilisé (MED_NOPG si aucun)
+ * - numco (IN) : n° de la composante à stocker (MED_ALL si toutes)
+ * - profil (IN) : nom du profil utilisé (MED_NOPFL si inutilisé)
+ * - mode (IN) : mode d'ecriture MED (MED_ECRI | MED_REMP)
+ * - type_ent (IN) : entité concerné par le champ {MED_NOEUD,MED_ARETE,MED_FACE,MED_MAILLE}
+ * - type_geo (IN) : type géométrique de l'entité concerné {MED_POINT,MED_SEG2 ......}
+ * - numdt (IN) : n° du pas de temps (MED_NOPDT si aucun)
+ * - dt_unit (IN) : chaine de taille MED_NOMP indiquant l'unité du champ
+ * - dt (IN) : valeur du pas de temps
+ * - numo (IN) : n° d'ordre utilisé MED_NONOR si inutile
+ * - Resultat : 0 en cas de succes, -1 sinon
+ */
+
+namespace med_2_1{
+
+med_err
+MEDchampEcr(med_idt fid, char *maa, char *cha,unsigned char *val,med_mode_switch interlace,med_int nbelem,med_int ngauss,
+ med_int numco, char * profil, med_mode_acces mode, med_entite_maillage type_ent,
+ med_geometrie_element type_geo, med_int numdt,char * dt_unit, med_float dt, med_int numo)
+{
+ med_err ret;
+ med_idt chid,datagroup1,datagroup2;
+ med_int ncomp, chtype, i, locnumdt,pfluse;
+ char pflname [MED_TAILLE_NOM+1];
+ char maillage[MED_TAILLE_NOM+1];
+ char nomdatagroup1[2*MED_TAILLE_NOM_ENTITE+2],nomdatagroup2[2*MED_MAX_PARA+1];
+ char tmp1[MED_TAILLE_NOM_ENTITE+1];
+ med_size dimd[1],psize;
+ med_int *pfltabtmp=0;
+ med_ssize *pfltab=0;
+ char chemin[MED_TAILLE_CHA+MED_TAILLE_NOM+1];
+
+ /*
+ * On inhibe le gestionnaire d'erreur HDF 5
+ */
+ _MEDmodeErreurVerrouiller();
+
+
+ /*
+ * Si le Data Group cha n'existe pas => erreur
+ */
+ strcpy(chemin,MED_CHA);
+ strcat(chemin,cha);
+ if ((chid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
+ return -1;
+
+ /*
+ * Creation du datagroup de niveau 1 <type_ent>[.<type_geo>]
+ */
+
+ if ((ret = _MEDnomEntite(nomdatagroup1,type_ent)) < 0)
+ return -1;
+ if ((type_ent != MED_NOEUD))
+ {
+ if ((ret = _MEDnomGeometrie(tmp1,type_geo)) < 0)
+ return -1;
+ strcat(nomdatagroup1,".");
+ strcat(nomdatagroup1,tmp1);
+ }
+ datagroup1 = 0;
+ if ( (datagroup1 = _MEDdatagroupOuvrir(chid,nomdatagroup1)) < 0)
+ if ((datagroup1 = _MEDdatagroupCreer(chid,nomdatagroup1)) < 0)
+ return -1;
+
+ /* Creation du datagroup de niveau 2 <numdt>.<numoo> */
+ if ( numdt == MED_NOPDT) locnumdt = MED_NOPDT; else locnumdt = numdt;
+ sprintf(nomdatagroup2,"%*li%*li",MED_MAX_PARA,(long ) locnumdt,MED_MAX_PARA,(long ) numo);
+
+
+ /*Cree ou ouvre (en mode MED_REMP) le datagroup nomdatagroup2 */
+ datagroup2 = 0;
+ if (((datagroup2 = _MEDdatagroupOuvrir(datagroup1,nomdatagroup2)) > 0)
+ && (mode != MED_REMP))
+ return -1;
+ else
+ if (datagroup2 < 0)
+ if ((datagroup2 = _MEDdatagroupCreer(datagroup1,nomdatagroup2)) < 0)
+ return -1;
+
+ /*Cree ou ouvre (en mode MED_REMP) l'attribut MED_NOM_NDT */
+ if ((ret = _MEDattrEntierEcrire(datagroup2,MED_NOM_NDT,&numdt,mode)) < 0)
+ return -1;
+
+ /*Cree ou ouvre (en mode MED_REMP) l'attribut MED_NOM_PDT */
+ if ((ret = _MEDattrFloatEcrire(datagroup2,MED_NOM_PDT,&dt,mode)) < 0)
+ return -1;
+
+ /*Cree ou ouvre (en mode MED_REMP) l'attribut MED_NOM_NOR */
+ if ((ret = _MEDattrEntierEcrire(datagroup2,MED_NOM_NOR,&numo,mode)) < 0)
+ return -1;
+
+ /*Cree ou ouvre (en mode MED_REMP) l'attribut MED_NOM_NBR */
+ if ((ret = _MEDattrEntierEcrire(datagroup2,MED_NOM_NBR,&nbelem,mode)) < 0)
+ return -1;
+
+ /*Cree ou ouvre (en mode MED_REMP) l'attribut MED_MAA */
+ /* rem : Aucune verification de l'existence du maillage */
+ strncpy(maillage,maa,MED_TAILLE_NOM);
+ maillage[MED_TAILLE_NOM]='\0';
+ if ((ret = _MEDattrStringEcrire(datagroup2,MED_NOM_MAI,MED_TAILLE_NOM,maillage,mode)) < 0)
+ return -1;
+
+ /*Cree ou ouvre (en mode MED_REMP) l'attribut MED_NOM_PFL */
+ pfluse = 0;
+ if ( strlen(profil) == 0) /* idem MED_NOPFL*/
+ strncpy(pflname,MED_NOPFLi,MED_TAILLE_NOM+1);
+ else {
+ strncpy(pflname,profil,MED_TAILLE_NOM);
+ pflname[MED_TAILLE_NOM]='\0';
+ pfluse = 1;
+ }
+ if ((ret = _MEDattrStringEcrire(datagroup2,MED_NOM_PFL,MED_TAILLE_NOM,pflname,mode)) < 0)
+ return -1;
+
+ /*Cree ou ouvre (en mode MED_REMP) l'attribut MED_NOM_UNI */
+ if ( strlen(dt_unit) == 0) {
+ if ((ret = _MEDattrStringEcrire(datagroup2,MED_NOM_UNI,MED_TAILLE_PNOM," ",mode)) < 0)
+ return -1;
+ } else
+ if ((ret = _MEDattrStringEcrire(datagroup2,MED_NOM_UNI,MED_TAILLE_PNOM,dt_unit,mode)) < 0)
+ return -1;
+
+
+ /* Cree ou ouvre (en mode MED_REMP) l'attribut MED_NOM_NGAU */
+ /* Ecriture du nombre de pts de gauss propre au <type_ent>[.<type_geo>] */
+ /* On n'utilise pas ngauss=MED_NOPG mais ngauss=1 si aucun pt de gauss */
+ if ((ret = _MEDattrEntierEcrire(datagroup2,MED_NOM_NGA,&ngauss,mode)) < 0)
+ return -1;
+
+ /*Lecture de l'attribut MED_NOM_NCO */
+ if ((ret = _MEDattrEntierLire(chid,MED_NOM_NCO,&ncomp)) < 0)
+ return -1;
+
+ /*Determination de la taille dimd[0] du dataset à stocker*/
+ dimd[0] = nbelem*ncomp;
+
+ /* Gestion des profils*/
+ if ( pfluse ) {
+
+ if ( ( i = MEDnValProfil(fid,pflname) ) < 0 )
+ return -1;
+ else
+ psize = i;
+
+ pfltabtmp = (med_int *) malloc (sizeof(med_int)*psize);
+ pfltab = (med_ssize *) malloc (sizeof(med_ssize)*psize);
+ if ((ret = MEDprofilLire(fid,pfltabtmp,pflname)) < 0)
+ return -1;
+ for (i=0;i<psize;i++)
+ pfltab[i] = (med_ssize) pfltabtmp[i];
+
+ }
+ else
+ psize = MED_NOPF;
+
+
+ /*
+ * Ecriture du champ
+ */
+ if ((ret = _MEDattrEntierLire(chid,MED_NOM_TYP,&chtype)) < 0)
+ return -1;
+ switch(chtype)
+ {
+ case MED_REEL64 :
+ if ((ret = _MEDdatasetNumEcrire(datagroup2,MED_NOM_CO,MED_REEL64,interlace,ncomp,numco,psize,pfltab,ngauss,dimd,val,
+ mode)) < 0)
+ return -1;
+ break;
+
+ case MED_INT32 :
+#if defined(IRIX64)||defined(OSF1)
+ if ((ret = _MEDdatasetNumEcrire(datagroup2,MED_NOM_CO,MED_INT64,interlace,ncomp,numco,psize,pfltab,ngauss,dimd,val,
+ mode)) < 0)
+ return -1;
+#else
+ if ((ret = _MEDdatasetNumEcrire(datagroup2,MED_NOM_CO,MED_INT32,interlace,ncomp,numco,psize,pfltab,ngauss,dimd,val,
+ mode)) < 0)
+ return -1;
+#endif
+ break;
+
+ case MED_INT64 :
+#if defined(IRIX64)||defined(OSF1)
+ if ((ret = _MEDdatasetNumEcrire(datagroup2,MED_NOM_CO,MED_INT64,interlace,ncomp,numco,psize,pfltab,ngauss,dimd,val,
+ mode)) < 0)
+ return -1;
+#else
+ return -1;
+#endif
+ break;
+
+ default :
+ return -1;
+ }
+
+ /*
+ * On ferme tout
+ */
+ if ( pfluse ) { free(pfltab); free(pfltabtmp);}
+
+ if ((ret = _MEDdatagroupFermer(datagroup2)) < 0)
+ return -1;
+ if ((ret = _MEDdatagroupFermer(datagroup1)) < 0)
+ return -1;
+ if ((ret = _MEDdatagroupFermer(chid)) < 0)
+ return -1;
+
+ return 0;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+namespace med_2_1{
+
+med_err
+MEDchampInfo(med_idt fid,int indice,char *champ,
+ med_type_champ *type,char *comp,char *unit,
+ med_int ncomp)
+{
+ med_err ret=0;
+ med_idt gid;
+ char chemin[MED_TAILLE_CHA+MED_TAILLE_NOM+1];
+ int num;
+
+ /*
+ * On inhibe le gestionnaire d'erreur HDF 5
+ */
+ _MEDmodeErreurVerrouiller();
+
+ /*
+ * On recupere le nom du champ
+ */
+ num = indice - 1;
+ strcpy(chemin,MED_CHA);
+ if ((ret = _MEDobjetIdentifier(fid,chemin,num,champ)) < 0)
+ return -1;
+
+ /*
+ * Si le Data Group cha n'existe pas => erreur
+ */
+ strcat(chemin,champ);
+ if ((gid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
+ return -1;
+
+
+ /*
+ * La liste des attributs
+ */
+ if ((ret = _MEDattrEntierLire(gid,MED_NOM_TYP,(med_int*) type)) < 0)
+ return -1;
+ if ((ret = _MEDattrStringLire(gid,MED_NOM_NOM,ncomp*MED_TAILLE_PNOM,
+ comp)) < 0)
+ return -1;
+ if ((ret = _MEDattrStringLire(gid,MED_NOM_UNI,ncomp*MED_TAILLE_PNOM,
+ unit)) < 0)
+ return -1;
+
+ /*
+ * On ferme tout
+ */
+ if ((ret = _MEDdatagroupFermer(gid)) < 0)
+ return -1;
+
+ return 0;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+#include <string.h>
+#include <stdlib.h>
+
+ /*La taille de val allouée par l'utilisateur doit prendre en compte le nbre de points de gauss et le nbre de composantes*/
+
+namespace med_2_1{
+
+med_err
+MEDchampLire(med_idt fid,char *maa, char *cha, unsigned char *val,med_mode_switch interlace,med_int numco,
+ char *profil,med_entite_maillage type_ent, med_geometrie_element type_geo,
+ med_int numdt, med_int numo)
+ /* VERIFIER LA POSSIBILITE DE RELIRE L'UNITE DE PAS DE TEMPS (DS CHAMPINFO) */
+{
+ med_err ret;
+ med_idt chid, datagroup1, datagroup2;
+ med_int ncomp, chtype, ngauss, i, locnumdt, pfluse;
+ char nomdatagroup1[2*MED_TAILLE_NOM_ENTITE+2],nomdatagroup2[2*MED_MAX_PARA+1];
+ char tmp1[MED_TAILLE_NOM_ENTITE+1], pfltmp[MED_TAILLE_NOM+1];
+ char chemin[MED_TAILLE_CHA+MED_TAILLE_NOM+1];
+ med_size psize;
+ med_int *pfltabtmp=0;
+ med_ssize *pfltab=0;
+ char maatmp[MED_TAILLE_NOM+1];
+
+ /*
+ * On inhibe le gestionnaire d'erreur HDF 5
+ */
+ _MEDmodeErreurVerrouiller();
+
+ /*
+ * Si le Data Group cha n'existe pas => erreur
+ */
+ strcpy(chemin,MED_CHA);
+ strcat(chemin,cha);
+ if ((chid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
+ return -1;
+
+ /*
+ * Si le Data Group de niveau 1 <type_ent>[.<type_geo>] n'existe pas => erreur
+ */
+ if ((ret = _MEDnomEntite(nomdatagroup1,type_ent)) < 0)
+ return -1;
+ if ((type_ent != MED_NOEUD))
+ {
+ if ((ret = _MEDnomGeometrie(tmp1,type_geo)) < 0)
+ return -1;
+ strcat(nomdatagroup1,".");
+ strcat(nomdatagroup1,tmp1);
+ }
+ datagroup1 = 0;
+ if ( (datagroup1 = _MEDdatagroupOuvrir(chid,nomdatagroup1)) < 0 )
+ return -1;
+
+ /*
+ * Si le Data Group de niveau 2 <numdtt>.<numoo> n'existe pas => erreur
+ */
+ if ( numdt == MED_NOPDT) locnumdt = MED_NOPDT; else locnumdt = numdt;
+ sprintf(nomdatagroup2,"%*li%*li",MED_MAX_PARA,(long ) locnumdt,MED_MAX_PARA,(long ) numo);
+
+ datagroup2 = 0;
+ if ( (datagroup2 = _MEDdatagroupOuvrir(datagroup1,nomdatagroup2)) < 0)
+ return -1;
+
+ /* Lecture du nbre de composantes du champ */
+
+ if ((ret = _MEDattrEntierLire(chid,MED_NOM_NCO,&ncomp)) < 0)
+ return -1;
+
+ /* Gestion des profils*/
+
+ /*
+ * Lire le profil demandé
+ */
+
+ if ((ret = _MEDattrStringLire(datagroup2,MED_NOM_PFL,MED_TAILLE_NOM,pfltmp)) < 0)
+ return -1;
+
+ if ( pfluse = (strcmp(pfltmp,MED_NOPFLi) && strcmp(pfltmp,"")) ) /* le test "" pour des raisons de compatibilité */
+ {
+ strcpy(profil,pfltmp);
+ if ( (i = MEDnValProfil(fid,profil)) < 0 )
+ return -1;
+ else
+ psize = i;
+
+ pfltabtmp = (med_int *) malloc (sizeof(med_int)*psize);
+ pfltab = (med_ssize *) malloc (sizeof(med_ssize)*psize);
+ if ((ret = MEDprofilLire(fid,pfltabtmp,profil)) < 0)
+ return -1;
+ for (i=0;i<psize;i++)
+ pfltab[i] = (med_ssize) pfltabtmp[i];
+
+ }
+ else {
+ psize = MED_NOPF;
+ strcpy(profil,MED_NOPFL);
+ }
+
+ /*
+ * Lire le nom de maillage associé au champ
+ */
+ if ((ret = _MEDattrStringLire(datagroup2,MED_NOM_MAI,MED_TAILLE_NOM,maatmp)) < 0)
+ return -1;
+
+ if (strcmp(maa,maatmp))
+ return -1;
+
+ /* Lit le nbre de points de Gauss */
+ /* (attribut MED_NOM_NGAU) propre au <type_ent>[.<type_geo>] pour simplifier la relecture */
+ if ( (ret = _MEDattrEntierLire(datagroup2,MED_NOM_NGA,&ngauss)) < 0 )
+ return -1;
+
+ /*
+ * Lecture du champ
+ */
+
+ if ((ret = _MEDattrEntierLire(chid,MED_NOM_TYP,&chtype)) < 0)
+ return -1;
+
+ switch(chtype)
+ {
+ case MED_REEL64 :
+ if ((ret = _MEDdatasetNumLire(datagroup2,MED_NOM_CO,MED_REEL64,
+ interlace,ncomp,numco,
+ psize,pfltab,ngauss,val))< 0)
+ return -1;
+ break;
+
+ case MED_INT32 :
+#if defined(IRIX64)||defined(OSF1)
+ if ((ret = _MEDdatasetNumLire(datagroup2,MED_NOM_CO,MED_INT64,
+ interlace,ncomp,numco,
+ psize,pfltab,ngauss,val))< 0)
+ return -1;
+#else
+ if ((ret = _MEDdatasetNumLire(datagroup2,MED_NOM_CO,MED_INT32,
+ interlace,ncomp,numco,
+ psize, pfltab,ngauss,val))< 0)
+ return -1;
+#endif
+ break;
+
+ case MED_INT64 :
+#if defined(IRIX64)||defined(OSF1)
+ if ((ret = _MEDdatasetNumLire(datagroup2,MED_NOM_CO,MED_INT64,
+ interlace,ncomp,numco,
+ psize,pfltab,ngauss,val))< 0)
+ return -1;
+#else
+ return -1;
+#endif
+ break;
+
+ default :
+ return -1;
+ }
+
+ /*
+ * On ferme tout
+ */
+ if ( pfluse ) { free(pfltab); free(pfltabtmp);}
+
+ if ((ret = _MEDdatagroupFermer(datagroup2)) < 0)
+ return -1;
+ if ((ret = _MEDdatagroupFermer(datagroup1)) < 0)
+ return -1;
+ if ((ret = _MEDdatagroupFermer(chid)) < 0)
+ return -1;
+
+ return 0;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+#include <string.h>
+#include <stdlib.h>
+
+extern int mode_interlace;
+
+namespace med_2_1{
+
+med_err
+MEDconnEcr(med_idt fid,char *maa, med_int mdim, med_int *connectivite,med_mode_switch mode_switch,
+ med_int nbre,med_mode_acces mode,med_entite_maillage type_ent,
+ med_geometrie_element type_geo,med_connectivite type_conn)
+{
+ med_idt maaid, entid, geoid, dataset;
+ med_err ret;
+ med_size dimd[1];
+ char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
+ char nom_ent[MED_TAILLE_NOM_ENTITE+1];
+ char nom_geo[MED_TAILLE_NOM_ENTITE+1];
+ char nom_dataset[MED_TAILLE_NOM_ENTITE+1];
+ int dim, nnoe, ndes;
+ int nsup = 0;
+ int taille;
+
+ /*
+ * On inhibe le gestionnaire d'erreur HDF 5
+ */
+ _MEDmodeErreurVerrouiller();
+
+ /*
+ * Si le maillage n'existe pas => erreur
+ */
+ strcpy(chemin,MED_MAA);
+ strcat(chemin,maa);
+ if ((maaid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
+ return -1;
+
+ /*
+ * On met a jour le nom du Data Group representant
+ * le type des entites
+ */
+ if ((ret = _MEDnomEntite(nom_ent,type_ent)) < 0)
+ return -1;
+ /*
+ * Si le Data Group des entites n'existe pas on le cree
+ */
+ /*EF Gerer le mode */
+ if ((entid = _MEDdatagroupOuvrir(maaid,nom_ent)) < 0)
+ if ((entid = _MEDdatagroupCreer(maaid,nom_ent)) < 0)
+ return -1;
+
+ /*
+ * On cree s'il n'existe pas le Data Group du type geometrique
+ */
+ /*EF Gerer le mode */
+ if ((ret = _MEDnomGeometrie(nom_geo,type_geo)) < 0)
+ return -1;
+ if ((geoid = _MEDdatagroupOuvrir(entid,nom_geo)) < 0)
+ if ((geoid = _MEDdatagroupCreer(entid,nom_geo)) < 0)
+ return -1;
+
+ /*
+ * On regarde si le Data Set existe et on le cree sinon
+ */
+ if ((ret=_MEDparametresGeometrie(type_ent,type_geo,&dim,&nnoe,&ndes))<0)
+ return -1;
+ if (mdim == 2 || mdim == 3)
+ if (type_ent == MED_MAILLE && dim == 1)
+ nsup = 1;
+ if (mdim == 3)
+ if (type_ent == MED_MAILLE && dim == 2)
+ nsup = 1;
+ switch(type_conn)
+ {
+ case MED_NOD :
+ strcpy(nom_dataset,MED_NOM_NOD);
+ taille = nsup + nnoe;
+ break;
+
+ case MED_DESC :
+ strcpy(nom_dataset,MED_NOM_DES);
+ taille = nsup + ndes;
+ break;
+
+ default :
+ return -1;
+ }
+ dimd[0] = nbre*taille;
+#if defined(IRIX64)||defined(OSF1)
+ if ((ret = _MEDdatasetNumEcrire(geoid,nom_dataset,MED_INT64,mode_switch,(med_size)taille,MED_ALL,MED_NOPF,0,MED_NOPG,dimd,
+ (unsigned char*) connectivite,mode)) < 0)
+ return -1;
+#else
+ if ((ret = _MEDdatasetNumEcrire(geoid,nom_dataset,MED_INT32,mode_switch,(med_size)taille,MED_ALL,MED_NOPF,0,MED_NOPG,dimd,
+ (unsigned char*) connectivite,mode)) < 0)
+ return -1;
+#endif
+
+ /*
+ * Attribut NBR (nombre de noeuds ou d'elements)
+ */
+ if ((dataset = _MEDdatasetOuvrir(geoid,nom_dataset)) < 0)
+ return -1;
+ if ((ret = _MEDattrEntierEcrire(dataset,MED_NOM_NBR,&nbre,mode)) < 0)
+ return -1;
+
+ /*
+ * On ferme tout
+ */
+ if ((ret = _MEDdatasetFermer(dataset)) < 0)
+ return -1;
+ if ((ret = _MEDdatagroupFermer(geoid)) < 0)
+ return -1;
+ if ((ret = _MEDdatagroupFermer(entid)) < 0)
+ return -1;
+ if ((ret = _MEDdatagroupFermer(maaid)) < 0)
+ return -1;
+
+ return 0;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+#include <string.h>
+#include <stdlib.h>
+
+extern int mode_interlace;
+
+namespace med_2_1{
+
+med_err
+MEDconnLire(med_idt fid,char *maa,med_int mdim,med_int *connectivite,med_mode_switch mode_switch,
+ med_int * pfltabtmp, med_size psizetmp,
+ med_entite_maillage type_ent, med_geometrie_element type_geo,med_connectivite type_conn)
+{
+ med_idt maaid,entid,geoid;
+ med_err ret;
+ char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
+ char nom_ent[MED_TAILLE_NOM_ENTITE+1];
+ char nom_geo[MED_TAILLE_NOM_ENTITE+1];
+ char nom_dataset[MED_TAILLE_NOM_ENTITE+1];
+ med_ssize * pfltab;
+ med_size psize;
+ int dim,nnoe,ndes;
+ int nsup = 0;
+ int taille;
+ int i,j;
+
+ /*
+ * On inhibe le gestionnaire d'erreur HDF 5
+ */
+ _MEDmodeErreurVerrouiller();
+
+ /*
+ * Si le maillage n'existe pas => erreur
+ */
+ strcpy(chemin,MED_MAA);
+ strcat(chemin,maa);
+ if ((maaid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
+ return -1;
+
+ /*
+ * On met a jour le nom du Data Group representant
+ * le type des entites
+ */
+ if ((ret = _MEDnomEntite(nom_ent,type_ent)) < 0)
+ return -1;
+ /*
+ * Si le Data Group des entites n'existe pas => erreur
+ */
+ if ((entid = _MEDdatagroupOuvrir(maaid,nom_ent)) < 0)
+ return -1;
+
+ /*
+ * si le Data Group du type geometrique n'existe pas => erreur
+ */
+ if ((ret = _MEDnomGeometrie(nom_geo,type_geo)) < 0)
+ return -1;
+ if ((geoid = _MEDdatagroupOuvrir(entid,nom_geo)) < 0)
+ return -1;
+
+ /*
+ * Si le Data Set de la connectivite n'existe pas => erreur
+ * Si oui => on le lit
+ */
+ if ((ret=_MEDparametresGeometrie(type_ent,type_geo,&dim,&nnoe,&ndes))<0)
+ return -1;
+ if (mdim == 2 || mdim == 3)
+ if (type_ent == MED_MAILLE && dim == 1)
+ nsup = 1;
+ if (mdim == 3)
+ if (type_ent == MED_MAILLE && dim == 2)
+ nsup = 1;
+
+
+ psize = psizetmp;
+ switch(type_conn)
+ {
+ case MED_NOD :
+ strcpy(nom_dataset,MED_NOM_NOD);
+ taille = nsup + nnoe;
+ break;
+
+ case MED_DESC :
+ strcpy(nom_dataset,MED_NOM_DES);
+ taille = nsup + ndes;
+ if ( psizetmp != MED_NOPF ) {
+ psize = psizetmp;
+ pfltab = (med_ssize *) malloc (sizeof(med_ssize)*psize);
+ for (i=0;i<psizetmp;i++)
+ pfltab[i] = (med_ssize) (pfltabtmp[i]);
+ };
+
+ break;
+
+ default :
+ return -1;
+ }
+
+
+#if defined(IRIX64)||defined(OSF1)
+ if ((ret = _MEDdatasetNumLire(geoid,nom_dataset,MED_INT64,
+ mode_switch,(med_size)taille,MED_ALL,
+ psize,pfltab,MED_NOPG,
+ (unsigned char*) connectivite)) < 0)
+ return -1;
+#else
+ if ((ret = _MEDdatasetNumLire(geoid,nom_dataset,MED_INT32,
+ mode_switch,(med_size) taille,MED_ALL,
+ psize,pfltab,MED_NOPG,
+ (unsigned char*) connectivite)) < 0)
+ return -1;
+#endif
+
+ /*
+ * On ferme tout
+ */
+
+ if ( (psize != MED_NOPF) && (type_conn == MED_DESC) ) free(pfltab);
+
+ if ((ret = _MEDdatagroupFermer(geoid)) < 0)
+ return -1;
+ if ((ret = _MEDdatagroupFermer(entid)) < 0)
+ return -1;
+ if ((ret = _MEDdatagroupFermer(maaid)) < 0)
+ return -1;
+
+ return 0;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med_outils.hxx"
+#include "med.hxx"
+
+#include <stdlib.h>
+#include <string.h>
+
+namespace med_2_1{
+
+med_err
+MEDcoordEcr(med_idt fid, char *maa, med_int mdim, med_float *coo,
+ med_mode_switch mode_coo,med_int n,
+ med_mode_acces mode, med_repere type_rep, char *nom, char *unit)
+{
+ med_idt maaid, noeid, dataset;
+ med_err ret;
+ med_size dimd[1];
+ char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
+ med_int type_rep_int;
+ /*
+ * On inhibe le gestionnaire d'erreur HDF
+ */
+ _MEDmodeErreurVerrouiller();
+
+ /*
+ * Si le maillage n'existe pas => erreur
+ */
+ strcpy(chemin,MED_MAA);
+ strcat(chemin,maa);
+ if ((maaid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
+ return -1;
+
+ /*
+ * Si le Data Group "NOE" n'existe pas
+ * on le cree
+ */
+ /* EF : A faire : gerer le mode MED_REMP*/
+ if ((noeid = _MEDdatagroupOuvrir(maaid,MED_NOM_NOE)) < 0)
+ if ((noeid = _MEDdatagroupCreer(maaid,MED_NOM_NOE)) < 0)
+ return -1;
+
+ /*
+ * Creation du Data Set "COO"
+ */
+ dimd[0] = n*mdim;
+ if ((ret = _MEDdatasetNumEcrire(noeid,MED_NOM_COO,MED_REEL64,mode_coo,mdim,MED_ALL,MED_NOPF,0,MED_NOPG,dimd,
+ (unsigned char*) coo,mode)) < 0)
+ return -1;
+
+ /*
+ * On re-ouvre le Data Set "COO" pour y placer des attributs
+ */
+ if ((dataset = _MEDdatasetOuvrir(noeid,MED_NOM_COO)) < 0)
+ return -1;
+
+ /*
+ * Attribut NBR (nombre de noeuds)
+ */
+ if ((ret = _MEDattrEntierEcrire(dataset,MED_NOM_NBR,&n,mode)) < 0)
+ return -1;
+
+ /*
+ * L'attribut "REP"
+ */
+ type_rep_int = (med_int) type_rep;
+ if ((ret = _MEDattrEntierEcrire(dataset,MED_NOM_REP,&type_rep_int,mode)) < 0)
+ return -1;
+
+ /*
+ * Attribut "NOM"
+ */
+ if ((ret = _MEDattrStringEcrire(dataset,MED_NOM_NOM,mdim*MED_TAILLE_PNOM,nom,mode)) < 0)
+ return -1;
+
+ /*
+ * Attribut "UNI"
+ */
+ if ((ret = _MEDattrStringEcrire(dataset,MED_NOM_UNI,mdim*MED_TAILLE_PNOM,unit,mode)) < 0)
+ return -1;
+
+ /*
+ * On ferme tout
+ */
+ if ((ret = _MEDdatasetFermer(dataset)) < 0)
+ return -1;
+ if ((ret = _MEDdatagroupFermer(noeid)) < 0)
+ return -1;
+ if ((ret = _MEDdatagroupFermer(maaid)) < 0)
+ return -1;
+
+ return 0;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med_outils.hxx"
+#include "med.hxx"
+
+#include <string.h>
+#include <stdlib.h>
+
+extern int mode_interlace;
+
+namespace med_2_1{
+
+med_err
+MEDcoordLire(med_idt fid, char *maa, med_int mdim, med_float *coo,
+ med_mode_switch mode_coo,med_int numco,
+ med_int * pfltabtmp, med_size psize, med_repere *type_rep, char *nom, char *unit)
+{
+ med_idt maaid, noeid, dataset;
+ med_err ret;
+ char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
+ int i,j;
+ med_float *new_coo;
+ med_int type_rep_int;
+ med_ssize * pfltab;
+
+ /*
+ * On inhibe le gestionnaire d'erreur
+ */
+ _MEDmodeErreurVerrouiller();
+
+ /*
+ * Si le maillage n'existe pas => erreur
+ * Sinon on recupere sa dimension au passage
+ */
+ strcpy(chemin,MED_MAA);
+ strcat(chemin,maa);
+ if ((maaid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
+ return -1;
+
+ /*
+ * Si le Data Group "NOE" n'existe pas => erreur
+ */
+ if ((noeid = _MEDdatagroupOuvrir(maaid,MED_NOM_NOE)) < 0)
+ return -1;
+
+ /*
+ * Convertion de med_int en med_ssize
+ */
+ if ( psize != MED_NOPF ) {
+ pfltab = (med_ssize *) malloc (sizeof(med_ssize)*psize);
+ for (i=0;i<psize;i++)
+ pfltab[i] = (med_ssize) pfltabtmp[i];
+ }
+
+ /*
+ * Lecture du Data Set "COO"
+ */
+ if ((ret = _MEDdatasetNumLire(noeid,MED_NOM_COO,MED_REEL64,
+ mode_coo,mdim,numco,
+ psize,pfltab,MED_NOPG,
+ (unsigned char*) coo)) < 0)
+ return -1;
+
+
+
+ /*
+ * On re-ouvre le Data Set "COO" pour y lire des attributs
+ */
+ if ((dataset = _MEDdatasetOuvrir(noeid,MED_NOM_COO)) < 0)
+ return -1;
+
+ /*
+ * L'attribut "REP"
+ */
+ if ((ret = _MEDattrEntierLire(dataset,MED_NOM_REP,&type_rep_int)) < 0)
+ return -1;
+ else
+ *type_rep = (med_repere) type_rep_int;
+
+ /*
+ * Attribut "NOM"
+ */
+ if ((ret = _MEDattrStringLire(dataset,MED_NOM_NOM,mdim*MED_TAILLE_PNOM,
+ nom)) < 0)
+ return -1;
+
+ /*
+ * Attribut "UNI"
+ */
+ if ((ret = _MEDattrStringLire(dataset,MED_NOM_UNI,mdim*MED_TAILLE_PNOM,
+ unit)) < 0)
+ return -1;
+
+ /*
+ * On ferme tout
+ */
+ if ( psize != MED_NOPF ) free(pfltab);
+
+ if ((ret = _MEDdatasetFermer(dataset)) < 0)
+ return -1;
+ if ((ret = _MEDdatagroupFermer(noeid)) < 0)
+ return -1;
+ if ((ret = _MEDdatagroupFermer(maaid)) < 0)
+ return -1;
+
+ return 0;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include <stdlib.h>
+#include "med_misc.hxx"
+
+/*
+ * - Nom de la fonction _MEDcstringFree
+ * - Description : libere la chaine de caracteres creee par
+ * les routines _MEDXcstring
+ * - Parametres :
+ * - chaine (IN/OUT) : la chaine de caracteres a detruire
+ * - Resultat : 0 si succes, -1 sinon
+ */
+
+namespace med_2_1{
+
+med_err
+_MEDcstringFree(char *chaine)
+{
+
+ free(chaine);
+ return 0;
+
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+/*
+ * - Nom de la fonction : _MEDdatagroupCreer
+ * - Description : creation et ouverture d'un Datagroup HDF
+ * - Parametres :
+ * - pid (IN) : l'ID de l'objet pere
+ * - nom (IN) : le nom de l'objet fils
+ * - Resultat : l'ID du fils en cas de succes, -1 sinon
+ */
+
+namespace med_2_1{
+
+med_idt
+_MEDdatagroupCreer(med_idt pid, char *nom)
+{
+ med_idt id;
+
+ if ((id = H5Gcreate(pid,nom,0)) < 0)
+ return -1;
+
+ return id;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+/*
+ * - Nom de la fonction : _MEDdatagroupFermer
+ * - Description : fermeture d'un datagroup HDF
+ * - Parametres :
+ * - id (IN) : l'ID du datagroup
+ * - Resultat : 0 en cas de succes, -1 sinon
+ */
+
+namespace med_2_1{
+
+med_err
+_MEDdatagroupFermer(med_idt id)
+{
+ med_err ret;
+
+ if ((ret = H5Gclose(id)) < 0)
+ return -1;
+ else
+ return 0;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+/*
+ * - Nom de la fonction : _MEDdatagroupOuvrir
+ * - Description : ouverture d'un datagroup HDF
+ * - Parametres :
+ * - pid (IN) : l'ID de l'objet pere
+ * - nom (IN) : le nom de l'objet fils
+ * - Resultat : l'ID du fils en cas de succes, -1 sinon
+ */
+
+namespace med_2_1{
+
+med_idt
+_MEDdatagroupOuvrir(med_idt pid, char *nom)
+{
+ med_idt id;
+
+ if ((id = H5Gopen(pid,nom)) < 0)
+ return -1;
+
+ return id;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+/*
+ * - Nom de la fonction : _MEDdatasetFermer
+ * - Description : fermeture d'un objet HDF dataset
+ * - Parametres :
+ * - id (IN) : l'ID de l'objet HDF dataset
+ * - Resultat : 0 en cas de succes, -1 sinon
+ */
+
+namespace med_2_1{
+
+med_err
+_MEDdatasetFermer(med_idt id)
+{
+ med_err ret;
+
+ if ((ret = H5Dclose(id)) < 0)
+ return -1;
+
+ return 0;
+}
+
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include "med_outils.hxx"
+#include <stdlib.h>
+#include "hdf5_version2api.hxx"
+
+/*
+ * - Nom de la fonction : _MEDdatasetNumEcrire
+ * - Description : ecriture d'un dataset tableau numerique
+ * - Parametres :
+ * - pere (IN) : l'ID de l'objet HDF pere ou placer l'attribut
+ * - nom (IN) : le nom du dataset
+ * - type (IN) : type numerique MED { MED_REEL64 , MED_INT32 , MED_INT64 }
+ * - interlace (IN) : Choix du type d'entrelacement utilisé par l'appelant { MED_FULL_INTERLACE(x1,y1,z1,x2,...)) , MED_NO_INTERLACE(x1,x2,y1,y2,z1,z2) }
+ * - nbdim (IN) : Dimension des éléments
+ * - fixdim (IN) : MED_ALL ou n° de la dimension a enregistrer
+ * - psize (IN) : Taille du profil à utiliser, MED_NOPF si pas de profil
+ * (référence les élements, cette taille ne prend pas en compte le nombre de pts de gauss ni la dimension )
+ * - pfltab (IN) : Tableau contenant les n° déléments à traiter (1....oo)
+ * - pflmod (IN) : PARAMETRE A AJOUTER : Indique comment lire les informations en mémoire { MED_COMPACT, MED_GLOBALE }.
+ * - ngauss (IN) : Nombre de points de GAUSS par élément
+ * - size (IN) : Taille du tableau de valeurs
+ * (référence tous les élements, cette taille prend en compte le nombre de pts de gauss et la dimension )
+ * - val (IN) : valeurs du tableau
+ * - mode (IN) : mode d'ecriture MED (MED_ECRI | MED_REMP)
+ * - Resultat : 0 en cas de succes, -1 sinon
+ */
+
+namespace med_2_1{
+
+med_err
+_MEDdatasetNumEcrire(med_idt pere,char *nom, med_type_champ type,
+ med_mode_switch interlace, med_size nbdim, med_size fixdim,
+ med_size psize, med_ssize * pfltab, med_int ngauss,
+ med_size *size, unsigned char *val, med_mode_acces mode)
+{
+ med_idt dataset, dataspace = 0, memspace = 0;
+#ifdef HDF_NEW_API
+ med_size start_mem[1],start_data[1],*pflmem,*pfldsk;
+#else
+ med_ssize start_mem[1],start_data[1],*pflmem,*pfldsk;
+#endif
+ med_size stride[1],count[1],pcount[1],pflsize[1];
+ med_err ret;
+ int i,j,index,type_hdf;
+ int dim, firstdim, dimutil, lastdim ;
+ med_mode_profil pflmod;
+
+ /* Verify fixdim is between [0, nbdim] ( 0 is MED_ALL ) */
+ if ( ( fixdim < 0 ) || ( fixdim > nbdim ) )
+ return -1;
+
+ /* block pflmod to MED_COMPACT (until med2.2) */
+ pflmod = MED_COMPACT;
+
+ switch(type)
+ {
+ case MED_REEL64 :
+ /* 1) IA32 is LE but due to an (?HDF convertion BUG?) when using H5T_NATIVE_DOUBLE/MED_REEL64? under PCLINUX
+ the file read under SGI is incorrect
+ 2) Compaq OSF/1 is LE, since we force SGI64,SUN4SOL2,HP to write double in LE even if they are BE, mips OSF/1 must be BE
+ REM : Be careful of compatibility between MED files when changing this (med2.2) */
+#if defined(PCLINUX) || defined(OSF1)
+ type_hdf = H5T_IEEE_F64BE;
+#else
+ type_hdf = H5T_IEEE_F64LE;
+#endif
+ break;
+
+ case MED_INT32 :
+#if defined(PCLINUX)
+ type_hdf = H5T_STD_I32BE;
+ if ((H5Tconvert(H5T_NATIVE_INT,H5T_STD_I32BE,(hsize_t)*size,(void *)val,NULL,(hid_t)0)) < 0)
+ return -1;
+#else
+ type_hdf = H5T_NATIVE_INT;
+#endif
+ break;
+
+ case MED_INT64 :
+ type_hdf = H5T_NATIVE_LONG;
+ break;
+
+ default :
+ return -1;
+ }
+
+
+ if ((dataset = H5Dopen(pere,nom)) < 0)
+ {
+ /* Whatever the size of the profil is we create a dataset with the size of the value array */
+ /* Then if we used the MED_REMP mode we can append a new dimension to a previous one in the dataset */
+ /* When we'll use the compression mode, the space used by unused values would be easily compressed */
+
+ if ((dataspace = H5Screate_simple(1,size,NULL)) < 0)
+ return -1;
+ if ((dataset = H5Dcreate(pere,nom,type_hdf,dataspace,
+ H5P_DEFAULT)) < 0)
+ return -1;
+ }
+ else
+ if (mode != MED_REMP)
+ {
+ H5Dclose(dataset);
+ return -1;
+ }
+ else
+ if ((dataspace = H5Dget_space(dataset)) <0)
+ return -1;
+
+
+ switch(interlace)
+ { /* switch Interlace */
+ case MED_FULL_INTERLACE :
+
+ /*Initialisation des indices de boucle du traitement de l'entrelacement en fonction de la dimension fixee*/
+ if ( fixdim != MED_ALL)
+ {
+ firstdim = fixdim-1;
+ lastdim = fixdim;
+ dimutil = 1;
+ } else {
+ firstdim = 0;
+ lastdim = nbdim;
+ dimutil = nbdim;
+ }
+
+ count [0] = (*size)/(nbdim);
+
+
+ if ( psize == MED_NOPF ) {
+
+ /* Creation d'un data space mémoire de dimension 1, de longeur size, et de longeur maxi size */
+ if ( (memspace = H5Screate_simple (1, size, NULL)) <0)
+ return -1;
+
+ stride[0] = nbdim;
+
+ for (dim=firstdim; dim < lastdim; dim++) {
+
+ start_mem[0] = dim;
+ if ( (ret = H5Sselect_hyperslab (memspace, H5S_SELECT_SET, start_mem, stride,
+ count, NULL)) <0)
+ return -1;
+
+ start_data[0] = dim*count[0];
+ if ( (ret = H5Sselect_hyperslab (dataspace, H5S_SELECT_SET, start_data, NULL,
+ count, NULL)) <0)
+ return -1;
+
+ if ((ret = H5Dwrite(dataset,type_hdf,memspace,dataspace,
+ H5P_DEFAULT, val)) < 0)
+ return -1;
+ }
+
+ } else { /* psize != MED_NOPF */
+
+ pflsize [0] = psize*ngauss*nbdim;
+ pcount [0] = psize*ngauss*dimutil;
+#ifdef HDF_NEW_API
+ pflmem = (med_size *) malloc (sizeof(med_size)*pcount[0]);
+ pfldsk = (med_size *) malloc (sizeof(med_size)*pcount[0]);
+#else
+ pflmem = (med_ssize *) malloc (sizeof(med_ssize)*pcount[0]);
+ pfldsk = (med_ssize *) malloc (sizeof(med_ssize)*pcount[0]);
+#endif
+
+ switch(pflmod)
+ { /* switch pflmod pout FULL_INTERLACE*/
+ case MED_GLOBALE :
+
+ /* Creation d'un data space mémoire de dimension 1, de longeur size, et de longeur maxi size */
+ if ( (memspace = H5Screate_simple (1, size, NULL)) <0)
+ return -1;
+
+ for (dim=firstdim; dim < lastdim; dim++) {
+
+ for (i=0; i < psize; i++) /* i balaye les élements du profil */
+ for (j=0; j < ngauss; j++) {
+ index = i*ngauss+j + (dim-firstdim)*(psize*ngauss);
+ pflmem[index] = (pfltab[i]-1)*ngauss*nbdim + j*nbdim+dim;
+ pfldsk[index] = dim*count[0] + (pfltab[i]-1)*ngauss+j;
+ }
+ }
+
+#ifdef HDF_NEW_API
+ if ( (ret = H5Sselect_elements(memspace,H5S_SELECT_SET, pcount[0], (const hsize_t **) pflmem ) ) <0)
+ return -1;
+
+ if ( (ret = H5Sselect_elements(dataspace,H5S_SELECT_SET, pcount[0], (const hsize_t **) pfldsk ) ) <0)
+ return -1;
+#else
+ if ( (ret = H5Sselect_elements(memspace,H5S_SELECT_SET, pcount[0], (const hssize_t **) pflmem ) ) <0)
+ return -1;
+
+ if ( (ret = H5Sselect_elements(dataspace,H5S_SELECT_SET, pcount[0], (const hssize_t **) pfldsk ) ) <0)
+ return -1;
+#endif
+
+ break;
+
+ case MED_COMPACT :
+
+ /* Creation d'un data space mémoire de dimension 1, de la longeur du profil */
+ /* La dimension utilisée est ici nbdim, même pour un profil compact on suppose */
+ /* que l'utilisateur a toutes les coordonées stockées, même si il en demande qu'une */
+
+ if ( (memspace = H5Screate_simple (1, pflsize, NULL)) <0)
+ return -1;
+
+ for (dim=firstdim; dim < lastdim; dim++) {
+
+ for (i=0; i < psize; i++) /* i balaye les élements du profil */
+ for (j=0; j < ngauss; j++) {
+ index = i*ngauss+j + (dim-firstdim)*(psize*ngauss);
+ pflmem[index] = i*ngauss*nbdim + j*nbdim+dim;
+ pfldsk[index] = dim*count[0] + (pfltab[i]-1)*ngauss+j;
+ }
+ }
+
+#ifdef HDF_NEW_API
+ if ( (ret = H5Sselect_elements(memspace,H5S_SELECT_SET, pcount[0], (const hsize_t **) pflmem ) ) <0)
+ return -1;
+
+ if ( (ret = H5Sselect_elements(dataspace,H5S_SELECT_SET, pcount[0], (const hsize_t **) pfldsk ) ) <0)
+ return -1;
+#else
+ if ( (ret = H5Sselect_elements(memspace,H5S_SELECT_SET, pcount[0], (const hssize_t **) pflmem ) ) <0)
+ return -1;
+
+ if ( (ret = H5Sselect_elements(dataspace,H5S_SELECT_SET, pcount[0], (const hssize_t **) pfldsk ) ) <0)
+ return -1;
+#endif
+
+ break;
+
+ default :
+ return -1;
+ }
+
+ if ((ret = H5Dwrite(dataset,type_hdf,memspace,dataspace,H5P_DEFAULT, val)) < 0)
+ return -1;
+
+ free(pflmem);
+ free(pfldsk);
+ }
+
+
+ break;
+
+ case MED_NO_INTERLACE :
+
+ /*Initialisation des indices de boucle du traitement de l'entrelacement en fonction de la dimension fixee*/
+
+ count[0] = (*size)/nbdim;
+
+ if ( psize == MED_NOPF ) {
+
+ if ( fixdim != MED_ALL)
+ start_data[0] = (fixdim-1)*count[0];
+ else {
+ count[0] = *size;
+ start_data[0] = 0;
+ };
+
+ if ( (ret = H5Sselect_hyperslab (dataspace, H5S_SELECT_SET, start_data, NULL,
+ count, NULL)) <0)
+ return -1;
+
+ if ((ret = H5Dwrite(dataset,type_hdf,dataspace,dataspace,
+ H5P_DEFAULT, val)) < 0)
+ return -1;
+
+ } else {
+
+ if ( fixdim != MED_ALL)
+ {
+ firstdim = fixdim-1;
+ lastdim = fixdim;
+ dimutil = 1;
+ } else {
+ firstdim = 0;
+ lastdim = nbdim;
+ dimutil = nbdim;
+ }
+
+ pflsize [0] = psize*ngauss*nbdim;
+ pcount [0] = psize*ngauss*dimutil; /* nom pas très coherent avec count !!! A revoir */
+#ifdef HDF_NEW_API
+ pfldsk = (med_size *) malloc(sizeof(med_size)*pcount[0]);
+#else
+ pfldsk = (med_ssize *) malloc(sizeof(med_ssize)*pcount[0]);
+#endif
+
+ switch(pflmod)
+ { /*switch plfmod pour NO_INTERLACE */
+ case MED_GLOBALE :
+
+ for (dim=firstdim; dim < lastdim; dim++) {
+
+ for (i=0; i < psize; i++) /* i balaye le nbre d'élements du profil */
+ for (j=0; j < ngauss; j++) {
+ index = i*ngauss+j + (dim-firstdim)*(psize*ngauss);
+ pfldsk[index] = dim*count[0]+(pfltab[i]-1)*ngauss+j;
+ }
+ }
+
+#ifdef HDF_NEW_API
+ if ( (ret = H5Sselect_elements(dataspace,H5S_SELECT_SET,pcount[0], (const hsize_t **) pfldsk ) ) <0)
+ return -1;
+#else
+ if ( (ret = H5Sselect_elements(dataspace,H5S_SELECT_SET,pcount[0], (const hssize_t **) pfldsk ) ) <0)
+ return -1;
+#endif
+
+ if ((ret = H5Dwrite(dataset,type_hdf,dataspace,dataspace,H5P_DEFAULT, val)) < 0)
+ return -1;
+
+ break;
+
+ case MED_COMPACT :
+
+ /* Creation d'un data space mémoire de dimension 1, de la longeur du profil */
+ /* La dimension utilisée est ici nbdim, même pour un profil compact on suppose */
+ /* que l'utilisateur a toutes les coordonées stockées, même si il en demande qu'une */
+
+ if ( (memspace = H5Screate_simple (1, pflsize, NULL)) <0)
+ return -1;
+
+#ifdef HDF_NEW_API
+ pflmem = (med_size *) malloc (sizeof(med_size)*pcount[0]);
+#else
+ pflmem = (med_ssize *) malloc (sizeof(med_ssize)*pcount[0]);
+#endif
+
+ /* Le profil COMPACT est contigüe, mais il est possible que l'on selectionne uniquemenent une dimension*/
+
+ for (dim=firstdim; dim < lastdim; dim++) {
+
+ for (i=0; i < psize; i++) /* i balaye le nbre d'élements du profil */
+ for (j=0; j < ngauss; j++) {
+ index = i*ngauss+j + (dim-firstdim)*(psize*ngauss);
+ pflmem[index] = dim*(psize*ngauss) + (pfltab[i]-1)*ngauss+j;
+ pfldsk[index] = dim*count[0] + (pfltab[i]-1)*ngauss+j;
+ }
+ }
+
+#ifdef HDF_NEW_API
+ if ( (ret = H5Sselect_elements(memspace ,H5S_SELECT_SET,pcount[0], (const hsize_t **) pflmem ) ) <0)
+ return -1;
+
+ if ( (ret = H5Sselect_elements(dataspace,H5S_SELECT_SET,pcount[0], (const hsize_t **) pfldsk ) ) <0)
+ return -1;
+#else
+ if ( (ret = H5Sselect_elements(memspace ,H5S_SELECT_SET,pcount[0], (const hssize_t **) pflmem ) ) <0)
+ return -1;
+
+ if ( (ret = H5Sselect_elements(dataspace,H5S_SELECT_SET,pcount[0], (const hssize_t **) pfldsk ) ) <0)
+ return -1;
+#endif
+
+ if ((ret = H5Dwrite(dataset,type_hdf,memspace,dataspace,H5P_DEFAULT, val)) < 0)
+ return -1;
+
+ free(pflmem);
+
+ break;
+
+ default :
+ return -1;
+
+ }
+
+ free(pfldsk);
+
+ };
+
+ break;
+
+ default :
+ return -1;
+ }
+
+
+ if (memspace)
+ if ((ret = H5Sclose(memspace)) < 0)
+ return -1;
+
+ if ((ret = H5Sclose(dataspace)) < 0)
+ return -1;
+
+ if ((ret = H5Dclose(dataset)) < 0)
+ return -1;
+
+#if defined(PCLINUX)
+ if (type == MED_INT32)
+ if ((H5Tconvert(H5T_STD_I32BE,H5T_NATIVE_INT,(hsize_t)*size,(void *)val,NULL,(hid_t)0)) < 0)
+ return -1;
+#endif
+
+ return 0;
+}
+
+}
--- /dev/null
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include "med_outils.hxx"
+#include <stdlib.h>
+#include "hdf5_version2api.hxx"
+
+/*
+ * - Nom de la fonction : _MEDdatasetNumLire
+ * - Description : lecture d'un dataset tableau numerique
+ * - Parametres :
+ * - pere (IN) : l'ID de l'objet HDF pere ou placer l'attribut
+ * - nom (IN) : le nom du dataset
+ * - type (IN) : type numerique MED
+ * - interlace (IN) : Choix du type d'entrelacement demandé par l'appelant { MED_FULL_INTERLACE(x1,y1,z1,x2,...)) , MED_NO_INTERLACE(x1,x2,y1,y2,z1,z2) }
+ * - nbdim (IN) : Dimension des éléments
+ * - fixdim (IN) : MED_ALL ou n° de la dimension a enregistrer à partir de 1..oo
+ * - psize (IN) : Taille du profil à utiliser, MED_NOPF si pas de profil
+ * - pfltab (IN) : Tableau contenant les n° déléments à traiter (1....oo)
+ * - pflmod (IN) : PARAMETRE A AJOUTER : Indique comment lire les informations en mémoire { MED_COMPACT, MED_GLOBALE }.
+ * - ngauss (IN) : Nombre de points de GAUSS par élément
+ * - val (OUT) : valeurs du tableau
+ * - Resultat : 0 en cas de succes, -1 sinon
+ * Equivalent à l'ancienne routine si .....,MED_NO_INTERLACE,1,MED_ALL,MED_NOPF,0,1 (peu importe),....
+ */
+
+namespace med_2_1{
+
+med_err
+_MEDdatasetNumLire(med_idt pere,char *nom,med_type_champ type,
+ med_mode_switch interlace, med_size nbdim, med_size fixdim,
+ med_size psize, med_ssize * pfltab, med_int ngauss,
+ unsigned char *val)
+{
+ med_idt dataset, dataspace = 0, memspace = 0;
+#ifdef HDF_NEW_API
+ med_size start_mem[1],start_data[1],*pflmem=0,*pfldsk=0;
+#else
+ med_ssize start_mem[1],start_data[1],*pflmem=0,*pfldsk=0;
+#endif
+ med_size stride[1],count[1],pcount[1],size[1],pflsize[1];
+ med_err ret;
+ int i,j,index,type_hdf;
+ hid_t datatype;
+ size_t typesize;
+ int dim, firstdim, dimutil, lastdim;
+ med_mode_profil pflmod;
+
+ /* Verify fixdim is between [0, nbdim] ( 0 is MED_ALL ) */
+ if ( ( fixdim < 0 ) || ( fixdim > nbdim ) )
+ return -1;
+
+ /* block pflmod to MED_COMPACT (until med2.2) */
+ pflmod = MED_COMPACT;
+
+ switch(type)
+ {
+ case MED_REEL64 :
+ /* 1) IA32 is LE but due to an (?HDF convertion BUG?) when using H5T_NATIVE_DOUBLE/MED_REEL64? under PCLINUX
+ the file read under SGI is incorrect
+ 2) Compaq OSF/1 is LE, since we force SGI64,SUN4SOL2,HP to write double in LE even if they are BE, mips OSF/1 must be BE
+ REM : Be careful of compatibility between MED files when changing this (med2.2) */
+#if defined(PCLINUX) || defined(OSF1)
+ type_hdf = H5T_IEEE_F64BE;
+#else
+ type_hdf = H5T_IEEE_F64LE;
+#endif
+ break;
+
+ case MED_INT32 :
+ type_hdf = H5T_NATIVE_INT;
+ break;
+
+ case MED_INT64 :
+ type_hdf = H5T_NATIVE_LONG;
+ break;
+
+ default :
+ return -1;
+ }
+
+ /* Ouverture du Dataset à lire */
+ if ((dataset = H5Dopen(pere,nom)) < 0)
+ return -1;
+
+ /* Interrogation de la taille du dataset */
+ if ( (datatype = H5Dget_type(dataset )) < 0) return -1;
+ if ( (typesize = H5Tget_size(datatype)) < 0) return -1;
+ size[0] = H5Dget_storage_size(dataset) / typesize;
+ if ( H5Tclose(datatype) < 0) return -1;
+
+ /* Create dataspace */
+ if ((dataspace = H5Screate_simple(1,size,NULL)) < 0)
+ return -1;
+
+ switch(interlace)
+ {
+ case MED_FULL_INTERLACE :
+
+ /*Initialisation des indices de boucle du traitement de l'entrelacement en fonction de la dimension fixee*/
+ if ( fixdim != MED_ALL)
+ {
+ firstdim = fixdim-1;
+ lastdim = fixdim;
+ dimutil = 1;
+ } else {
+ firstdim = 0;
+ lastdim = nbdim;
+ dimutil = nbdim;
+ }
+
+ count [0] = (*size)/(nbdim);
+
+
+ /*rem: Pas de vérification de l'assertion (*size)=n*nbdim */
+ if ( psize == MED_NOPF ) {
+
+ /* Creation d'un data space mémoire de dimension 1, de longeur size, et de longeur maxi size */
+ if ( (memspace = H5Screate_simple (1, size, NULL)) <0)
+ return -1;
+
+ stride[0] = nbdim;
+
+ for (dim=firstdim; dim < lastdim; dim++) {
+
+ start_mem[0] = dim;
+ if ( (ret = H5Sselect_hyperslab (memspace, H5S_SELECT_SET, start_mem, stride,
+ count, NULL)) <0)
+ return -1;
+
+ start_data[0] = dim*count[0];
+ if ( (ret = H5Sselect_hyperslab (dataspace, H5S_SELECT_SET, start_data, NULL,
+ count, NULL)) <0)
+ return -1;
+
+ if ((ret = H5Dread(dataset,type_hdf,memspace,dataspace,
+ H5P_DEFAULT, val)) < 0)
+ return -1;
+ }
+
+ } else {
+
+ pflsize [0] = psize*ngauss*nbdim;
+ pcount [0] = psize*ngauss*dimutil;
+#ifdef HDF_NEW_API
+ pflmem = (med_size *) malloc (sizeof(med_size)*pcount[0]);
+ pfldsk = (med_size *) malloc (sizeof(med_size)*pcount[0]);
+#else
+ pflmem = (med_ssize *) malloc (sizeof(med_ssize)*pcount[0]);
+ pfldsk = (med_ssize *) malloc (sizeof(med_ssize)*pcount[0]);
+#endif
+
+ switch(pflmod)
+ { /* switch pflmod pour FULL_INTERLACE*/
+ case MED_GLOBALE :
+
+ /* Creation d'un data space mémoire de dimension 1, de longeur size, et de longeur maxi size */
+ if ( (memspace = H5Screate_simple (1, size, NULL)) <0)
+ return -1;
+
+ for (dim=firstdim; dim < lastdim; dim++) {
+
+ for (i=0; i < psize; i++) /* i balaye les élements du profil */
+ for (j=0; j < ngauss; j++) {
+ index = i*ngauss+j + (dim-firstdim)*(psize*ngauss);
+ pflmem[index] = (pfltab[i]-1)*ngauss*nbdim + j*nbdim+dim;
+ pfldsk[index] = dim*count[0] + (pfltab[i]-1)*ngauss+j;
+ }
+ }
+
+#ifdef HDF_NEW_API
+ if ( (ret = H5Sselect_elements(memspace ,H5S_SELECT_SET, pcount[0], (const hsize_t **) pflmem ) ) <0)
+ return -1;
+
+ if ( (ret = H5Sselect_elements(dataspace,H5S_SELECT_SET, pcount[0], (const hsize_t **) pfldsk ) ) <0)
+ return -1;
+#else
+ if ( (ret = H5Sselect_elements(memspace ,H5S_SELECT_SET, pcount[0], (const hssize_t **) pflmem ) ) <0)
+ return -1;
+
+ if ( (ret = H5Sselect_elements(dataspace,H5S_SELECT_SET, pcount[0], (const hssize_t **) pfldsk ) ) <0)
+ return -1;
+#endif
+
+ break;
+
+ case MED_COMPACT :
+
+ /* Creation d'un data space mémoire de dimension 1, de la longeur du profil */
+ /* La dimension utilisée est ici nbdim, même pour un profil compact on suppose */
+ /* que l'utilisateur a toutes les coordonées stockées, même si il en demande qu'une */
+
+ if ( (memspace = H5Screate_simple (1, pflsize, NULL)) <0)
+ return -1;
+
+ for (dim=firstdim; dim < lastdim; dim++) {
+
+ for (i=0; i < psize; i++) /* i balaye les élements du profil */
+ for (j=0; j < ngauss; j++) {
+ index = i*ngauss+j + (dim-firstdim)*(psize*ngauss);
+ pflmem[index] = i*ngauss*nbdim + j*nbdim+dim;
+ pfldsk[index] = dim*count[0] + (pfltab[i]-1)*ngauss+j;
+ }
+ }
+
+#ifdef HDF_NEW_API
+ if ( (ret = H5Sselect_elements(memspace ,H5S_SELECT_SET, pcount[0], (const hsize_t **) pflmem ) ) <0)
+ return -1;
+
+ if ( (ret = H5Sselect_elements(dataspace,H5S_SELECT_SET, pcount[0], (const hsize_t **) pfldsk ) ) <0)
+ return -1;
+#else
+ if ( (ret = H5Sselect_elements(memspace ,H5S_SELECT_SET, pcount[0], (const hssize_t **) pflmem ) ) <0)
+ return -1;
+
+ if ( (ret = H5Sselect_elements(dataspace,H5S_SELECT_SET, pcount[0], (const hssize_t **) pfldsk ) ) <0)
+ return -1;
+#endif
+
+ break;
+
+ default :
+ return -1;
+ }
+
+ if ((ret = H5Dread(dataset,type_hdf,memspace,dataspace,H5P_DEFAULT, val)) < 0)
+ return -1;
+
+ free(pflmem);
+ free(pfldsk);
+ }
+
+ break;
+
+ case MED_NO_INTERLACE :
+
+ /*Initialisation des indices de boucle du traitement de l'entrelacement en fonction de la dimension fixee*/
+
+ count[0] = (*size)/nbdim;
+
+ if ( psize == MED_NOPF ) {
+
+ if ( fixdim != MED_ALL)
+ start_data[0] = (fixdim-1)*count[0];
+ else {
+ count[0] = *size;
+ start_data[0] = 0;
+ };
+
+ if ( (ret = H5Sselect_hyperslab (dataspace, H5S_SELECT_SET, start_data, NULL,
+ count, NULL)) <0)
+ return -1;
+
+ if ((ret = H5Dread(dataset,type_hdf,dataspace,dataspace,
+ H5P_DEFAULT, val)) < 0)
+ return -1;
+
+ } else {
+
+ if ( fixdim != MED_ALL)
+ {
+ firstdim = fixdim-1;
+ lastdim = fixdim;
+ dimutil = 1;
+ } else {
+ firstdim = 0;
+ lastdim = nbdim;
+ dimutil = nbdim;
+ }
+
+ pflsize [0] = psize*ngauss*nbdim;
+ pcount [0] = psize*ngauss*dimutil; /* nom pas très coherent avec count !!! A revoir */
+#ifdef HDF_NEW_API
+ pfldsk = (med_size *) malloc(sizeof(med_size)*pcount[0]);
+#else
+ pfldsk = (med_ssize *) malloc(sizeof(med_ssize)*pcount[0]);
+#endif
+
+ switch(pflmod)
+ { /*switch plfmod pour NO_INTERLACE */
+ case MED_GLOBALE :
+
+ for (dim=firstdim; dim < lastdim; dim++) {
+
+ for (i=0; i < psize; i++) /* i balaye le nbre d'élements du profil */
+ for (j=0; j < ngauss; j++) {
+ index = i*ngauss+j + (dim-firstdim)*(psize*ngauss);
+ pfldsk[index] = dim*count[0]+(pfltab[i]-1)*ngauss+j;
+ }
+ }
+
+#ifdef HDF_NEW_API
+ if ( (ret = H5Sselect_elements(dataspace,H5S_SELECT_SET,pcount[0], (const hsize_t **) pfldsk ) ) <0)
+ return -1;
+#else
+ if ( (ret = H5Sselect_elements(dataspace,H5S_SELECT_SET,pcount[0], (const hssize_t **) pfldsk ) ) <0)
+ return -1;
+#endif
+
+ if ((ret = H5Dread(dataset,type_hdf,dataspace,dataspace,H5P_DEFAULT, val)) < 0)
+ return -1;
+
+ break;
+
+ case MED_COMPACT :
+
+ /* Creation d'un data space mémoire de dimension 1, de la longeur du profil */
+ /* La dimension utilisée est ici nbdim, même pour un profil compact on suppose */
+ /* que l'utilisateur a toutes les coordonées stockées, même si il en demande qu'une */
+
+ if ( (memspace = H5Screate_simple (1, pflsize, NULL)) <0)
+ return -1;
+
+#ifdef HDF_NEW_API
+ pflmem = (med_size *) malloc (sizeof(med_size)*pcount[0]);
+#else
+ pflmem = (med_ssize *) malloc (sizeof(med_ssize)*pcount[0]);
+#endif
+
+ /* Le profil COMPACT est contigüe, mais il est possible que l'on selectionne uniquemenent une dimension*/
+
+ for (dim=firstdim; dim < lastdim; dim++) {
+
+ for (i=0; i < psize; i++) /* i balaye le nbre d'élements du profil */
+ for (j=0; j < ngauss; j++) {
+ index = i*ngauss+j + (dim-firstdim)*(psize*ngauss);
+ pflmem[index] = dim*(psize*ngauss) + (pfltab[i]-1)*ngauss+j;
+ pfldsk[index] = dim*count[0] + (pfltab[i]-1)*ngauss+j;
+ }
+ }
+
+#ifdef HDF_NEW_API
+ if ( (ret = H5Sselect_elements(memspace ,H5S_SELECT_SET, pcount[0], (const hsize_t **) pflmem ) ) <0)
+ return -1;
+
+ if ( (ret = H5Sselect_elements(dataspace,H5S_SELECT_SET,pcount[0], (const hsize_t **) pfldsk ) ) <0)
+ return -1;
+#else
+ if ( (ret = H5Sselect_elements(memspace ,H5S_SELECT_SET, pcount[0], (const hssize_t **) pflmem ) ) <0)
+ return -1;
+
+ if ( (ret = H5Sselect_elements(dataspace,H5S_SELECT_SET,pcount[0], (const hssize_t **) pfldsk ) ) <0)
+ return -1;
+#endif
+
+ if ((ret = H5Dread(dataset,type_hdf,memspace,dataspace,H5P_DEFAULT, val)) < 0)
+ return -1;
+
+ break;
+
+ default :
+ return -1;
+
+ }
+
+ free(pfldsk);
+
+ };
+
+ break;
+
+ default :
+ return -1;
+ }
+
+
+
+ if (memspace)
+ if ((ret = H5Sclose(memspace)) < 0)
+ return -1;
+
+ if ((ret = H5Sclose(dataspace)) < 0)
+ return -1;
+
+ if ((ret = H5Dclose(dataset)) < 0)
+ return -1;
+
+ return 0;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+/*
+ * - Nom de la fonction : _MEDdatasetOuvrir
+ * - Description : ouverture d'un objet HDF dataset
+ * - Parametres :
+ * - pid (IN) : l'ID de l'objet HDF pere
+ * - nom (IN) : le nom du dataset
+ * - Resultat : ID du dataset en cas de succes, -1 sinon
+ */
+
+namespace med_2_1{
+
+med_idt
+_MEDdatasetOuvrir(med_idt pid,char *nom)
+{
+ med_idt id;
+
+ if ((id = H5Dopen(pid,nom)) < 0)
+ return -1;
+
+ return id;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+/*
+ * - Nom de la fonction : _MEDdatasetStringEcrire
+ * - Description : ecriture d'un dataset tableau de caracteres
+ * - Parametres :
+ * - pere (IN) : l'ID de l'objet HDF pere ou placer l'attribut
+ * - nom (IN) : le nom de l'attribut
+ * - dimd (IN) : profil du tableau
+ * - val (IN) : valeurs du tableau
+ * - mode (IN) : mode d'ecriture MED
+ * - Resultat : 0 en cas de succes, -1 sinon
+ */
+
+namespace med_2_1{
+
+med_err
+_MEDdatasetStringEcrire(med_idt pere,char *nom,med_size *dimd,
+ char *val, med_mode_acces mode)
+{
+ med_idt dataset;
+ med_idt datatype = 0;
+ med_idt dataspace = 0;
+ med_err ret;
+
+ if ((dataset = H5Dopen(pere,nom)) < 0)
+ {
+ if ((dataspace = H5Screate_simple(1,dimd,NULL)) < 0)
+ return -1;
+ if((datatype = H5Tcopy(H5T_C_S1)) < 0)
+ return -1;
+ if((ret = H5Tset_size(datatype,1)) < 0)
+ return -1;
+ if ((dataset = H5Dcreate(pere,nom,datatype,dataspace,
+ H5P_DEFAULT)) < 0)
+ return -1;
+ }
+ else
+ if (mode != MED_REMP)
+ {
+ H5Dclose(dataset);
+ return -1;
+ }
+ else
+ {
+ if ((dataspace = H5Screate_simple(1,dimd,NULL)) < 0)
+ return -1;
+ if((datatype = H5Tcopy(H5T_C_S1)) < 0)
+ return -1;
+ if((ret = H5Tset_size(datatype,1)) < 0)
+ return -1;
+ }
+ if ((ret = H5Dwrite(dataset,datatype,H5S_ALL,H5S_ALL,
+ H5P_DEFAULT, val)) < 0)
+ return -1;
+ if (dataspace)
+ if((ret = H5Sclose(dataspace)) < 0)
+ return -1;
+ if (datatype)
+ if ((ret = H5Tclose(datatype)) < 0)
+ return -1;
+ if ((ret = H5Dclose(dataset)) < 0)
+ return -1;
+
+ return 0;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+/*
+ * - Nom de la fonction : _MEDdatasetStringLire
+ * - Description : lecture d'un dataset tableau de caracteres
+ * - Parametres :
+ * - pere (IN) : l'ID de l'objet HDF pere ou placer l'attribut
+ * - nom (IN) : le nom de l'attribut
+ * - val (IN) : valeurs du tableau
+ * - Resultat : 0 en cas de succes, -1 sinon
+ */
+
+namespace med_2_1{
+
+med_err
+_MEDdatasetStringLire(med_idt pere,char *nom,char *val)
+{
+ med_idt dataset,datatype;
+ med_err ret;
+
+ if ((dataset = H5Dopen(pere,nom)) < 0)
+ return -1;
+ if ((datatype = H5Tcopy(H5T_C_S1)) < 0)
+ return -1;
+ if ((ret = H5Tset_size(datatype,1)) < 0)
+ return -1;
+ if ((ret = H5Dread(dataset,datatype,H5S_ALL,H5S_ALL,H5P_DEFAULT,val)) < 0)
+ return -1;
+ if ((ret = H5Tclose(datatype)) < 0)
+ return -1;
+ if ((ret = H5Dclose(dataset)) < 0)
+ return -1;
+
+ return 0;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+#include <string.h>
+#include <stdlib.h>
+
+namespace med_2_1{
+med_int
+MEDdimLire(med_idt fid, char *maillage)
+{
+ med_idt maaid;
+ med_err ret;
+ char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
+ med_int dim;
+
+ /*
+ * On inhibe le gestionnaire d'erreur
+ */
+ _MEDmodeErreurVerrouiller();
+
+ /*
+ * On regarde si le groupe existe => erreur si non
+ */
+ strcpy(chemin,MED_MAA);
+ strcat(chemin,maillage);
+ if ((maaid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
+ return -1;
+
+ /*
+ * On va lire l'attribut dimension
+ */
+ if ((ret = _MEDattrEntierLire(maaid,MED_NOM_DIM,&dim)) < 0)
+ return -1;
+
+ /*
+ * Fermetures des objets HDF
+ */
+ if ((ret = _MEDdatagroupFermer(maaid)) < 0)
+ return -1;
+
+ return dim;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+
+namespace med_2_1{
+
+med_err
+MEDelementsEcr(med_idt fid,char *maa,med_int mdim,med_int *connectivite,med_mode_switch mode_switch,
+ char *nom,med_booleen inom,med_int *num,med_booleen inum,
+ med_int *fam,med_int nele,med_entite_maillage typ_ent,
+ med_geometrie_element typ_geo,med_connectivite typ_conn,
+ med_mode_acces mode)
+{
+ med_err ret;
+
+ /* Ecriture de la connectivite */
+ if ((ret = MEDconnEcr(fid,maa,mdim,connectivite,mode_switch,nele,mode,typ_ent,typ_geo,
+ typ_conn)) < 0)
+ return -1;
+
+ /* Ecriture des noms */
+ if (inom == MED_VRAI)
+ if ((ret = MEDnomEcr(fid,maa,nom,nele,mode,typ_ent,typ_geo)) < 0)
+ return -1;
+
+ /* Ecriture des numeros */
+ if (inum == MED_VRAI)
+ if ((ret = MEDnumEcr(fid,maa,num,nele,mode,typ_ent,typ_geo)) < 0)
+ return -1;
+
+ /* Ecriture des numeros de familles */
+ if ((ret = MEDfamEcr(fid,maa,fam,nele,mode,typ_ent,typ_geo)) < 0)
+ return -1;
+
+ return 0;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+
+namespace med_2_1{
+
+med_err
+MEDelementsLire(med_idt fid,char *maa,med_int mdim,med_int *connectivite,med_mode_switch mode_switch,
+ char *nom,med_booleen *inom,med_int *num,med_booleen *inum,
+ med_int *fam,med_int nele,med_entite_maillage typ_ent,
+ med_geometrie_element typ_geo,med_connectivite typ_conn)
+{
+ med_err ret;
+
+ /* Lecure de la connectivite */
+ if ((ret = MEDconnLire(fid,maa,mdim,connectivite,mode_switch,0,MED_NOPF,
+ typ_ent,typ_geo,typ_conn)) < 0)
+ return -1;
+
+ /* Lecture des noms */
+ if ((ret = MEDnomLire(fid,maa,nom,nele,typ_ent,typ_geo)) < 0)
+ *inom = MED_FAUX;
+ else
+ *inom = MED_VRAI;
+
+ /* Lecture des numeros */
+ if ((ret = MEDnumLire(fid,maa,num,nele,typ_ent,typ_geo)) < 0)
+ *inum = MED_FAUX;
+ else
+ *inum = MED_VRAI;
+
+ /* Lecture des numeros de familles */
+ if ((ret = MEDfamLire(fid,maa,fam,nele,typ_ent,typ_geo)) < 0)
+ return -1;
+
+ return 0;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+#include <string.h>
+#include <stdlib.h>
+
+namespace med_2_1{
+
+med_err
+MEDequivCr(med_idt fid,char *maa, char *eq, char *desc)
+{
+ med_idt root,eqid;
+ med_err ret;
+ char chemin[MED_TAILLE_MAA+MED_TAILLE_EQS+MED_TAILLE_NOM+1];
+ char tmp[MED_TAILLE_EQS+1];
+
+ /*
+ * On inhibe le gestionnaire d'erreur HDF 5
+ */
+ _MEDmodeErreurVerrouiller();
+
+ /*
+ * Si le Data Group "EQS" n'existe pas, on le cree
+ */
+ strcpy(chemin,MED_MAA);
+ strcat(chemin,maa);
+ strncpy(tmp,MED_EQS,MED_TAILLE_EQS-1);
+ tmp[MED_TAILLE_EQS-1] = '\0';
+ strcat(chemin,tmp);
+ if ((root = _MEDdatagroupOuvrir(fid,chemin)) < 0)
+ if ((root = _MEDdatagroupCreer(fid,chemin)) < 0)
+ return -1;
+
+ /*
+ * Si une equivalence du meme nom existe => erreur
+ * Sinon on la cree
+ */
+ if ((eqid = _MEDdatagroupOuvrir(root,eq)) >= 0)
+ return -1;
+ if ((eqid = _MEDdatagroupCreer(root,eq)) < 0)
+ return -1;
+
+ /*
+ * L'attribut "DES"
+ */
+ if ((ret = _MEDattrStringEcrire(eqid,MED_NOM_DES,MED_TAILLE_DESC,desc,MED_REMP)) < 0)
+ return -1;
+
+ /*
+ * On ferme tout
+ */
+ if ((ret = _MEDdatagroupFermer(eqid)) < 0)
+ return -1;
+ if ((ret = _MEDdatagroupFermer(root)) < 0)
+ return -1;
+
+ return 0 ;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+#include <string.h>
+#include <stdlib.h>
+
+extern int mode_interlace;
+
+namespace med_2_1{
+
+med_err
+MEDequivEcr(med_idt fid, char *maa, char *eq, med_int *corr, med_int n,
+ med_mode_acces mode, med_entite_maillage typ_ent, med_geometrie_element typ_geo)
+{
+ med_idt eqid, datagroup;
+ med_err ret;
+ char chemin[MED_TAILLE_MAA+MED_TAILLE_EQS+2*MED_TAILLE_NOM+1];
+ char nomdatagroup[MED_TAILLE_NOM+1];
+ char tmp[MED_TAILLE_NOM_ENTITE+1];
+ med_size dimd[1];
+
+ if (typ_geo == MED_TETRA4 || typ_geo == MED_TETRA10 ||
+ typ_geo == MED_HEXA8 || typ_geo == MED_HEXA20 ||
+ typ_geo == MED_PENTA6 || typ_geo == MED_PENTA15 ||
+ typ_geo == MED_PYRA5 || typ_geo == MED_PYRA13)
+ return -1;
+
+ /*
+ * On inhibe le gestionnaire d'erreur HDF 5
+ */
+ _MEDmodeErreurVerrouiller();
+
+ /*
+ * Si le Data Group de "eq" n'existe pas => erreur
+ */
+ strcpy(chemin,MED_MAA);
+ strcat(chemin,maa);
+ strcat(chemin,MED_EQS);
+ strcat(chemin,eq);
+ if ((eqid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
+ return -1;
+
+ /*
+ * Ecriture de l'equivalence
+ */
+ if ((ret = _MEDnomEntite(nomdatagroup,typ_ent)) < 0)
+ return -1;
+ if ((typ_ent != MED_NOEUD))
+ {
+ if ((ret = _MEDnomGeometrie(tmp,typ_geo)) < 0)
+ return -1;
+ strcat(nomdatagroup,".");
+ strcat(nomdatagroup,tmp);
+ }
+ datagroup = 0;
+ if (((datagroup = _MEDdatagroupOuvrir(eqid,nomdatagroup)) > 0) &&
+ (mode != MED_REMP))
+ return -1;
+ else
+ if (datagroup > 0)
+ _MEDdatagroupFermer(datagroup);
+
+ /* EF : verifier que çà marche si le data groupe existe déjà */
+ if ((datagroup = _MEDdatagroupCreer(eqid,nomdatagroup)) < 0)
+ return -1;
+
+ if ((ret = _MEDattrEntierEcrire(datagroup,MED_NOM_NBR,&n,mode)) < 0)
+ return -1;
+
+ dimd[0] = 2*n;
+
+#if defined(IRIX64)||defined(OSF1)
+ if ((ret = _MEDdatasetNumEcrire(datagroup,MED_NOM_COR,MED_INT64,MED_NO_INTERLACE,MED_DIM1,MED_ALL,MED_NOPF,0,MED_NOPG,dimd,
+ (unsigned char*) corr,mode)) < 0)
+ return -1;
+#else
+ if ((ret = _MEDdatasetNumEcrire(datagroup,MED_NOM_COR,MED_INT32,MED_NO_INTERLACE,MED_DIM1,MED_ALL,MED_NOPF,0,MED_NOPG,dimd,
+ (unsigned char*) corr,mode)) < 0)
+ return -1;
+#endif
+
+ /*
+ * On ferme tout
+ */
+ if ((ret = _MEDdatagroupFermer(datagroup)) < 0)
+ return -1;
+ if ((ret = _MEDdatagroupFermer(eqid)) < 0)
+ return -1;
+
+ return 0;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+#include <string.h>
+#include <stdlib.h>
+
+namespace med_2_1{
+
+med_err
+MEDequivInfo(int fid, char *maa, int ind, char *eq, char *des)
+{
+ med_idt eqid;
+ med_err ret;
+ char chemin[MED_TAILLE_MAA+MED_TAILLE_EQS+2*MED_TAILLE_NOM+1];
+ int num;
+ int idx;
+
+ /*
+ * On inhibe le gestionnaire d'erreur HDF 5
+ */
+ _MEDmodeErreurVerrouiller();
+
+ /*
+ * On recupere le nom de l'equivalence
+ */
+ num = ind - 1;
+ strcpy(chemin,MED_MAA);
+ strcat(chemin,maa);
+ strcat(chemin,MED_EQS);
+ if ((idx = _MEDobjetIdentifier(fid,chemin,num,eq)) < 0)
+ return -1;
+
+ /*
+ * Si le Data Group eq n'existe pas => erreur
+ */
+ strcat(chemin,eq);
+ if ((eqid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
+ return -1;
+
+ /*
+ * L'attribut "DES"
+ */
+ if ((ret = _MEDattrStringLire(eqid,MED_NOM_DES,MED_TAILLE_DESC,des)) < 0)
+ return -1;
+
+ /*
+ * On ferme tout
+ */
+ if ((ret = _MEDdatagroupFermer(eqid)) < 0)
+ return -1;
+
+ return 0;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+#include <string.h>
+#include <stdlib.h>
+
+extern int mode_interlace;
+
+namespace med_2_1{
+
+med_err
+MEDequivLire(med_idt fid, char *maa, char *eq, med_int *corr, med_int n,
+ med_entite_maillage typ_ent,med_geometrie_element typ_geo)
+{
+ med_idt eqid, datagroup;
+ med_err ret;
+ char chemin[MED_TAILLE_MAA+MED_TAILLE_EQS+2*MED_TAILLE_NOM+1];
+ char nomdatagroup[MED_TAILLE_NOM+1];
+ char tmp[MED_TAILLE_NOM_ENTITE+1];
+
+ if (typ_geo == MED_TETRA4 || typ_geo == MED_TETRA10 ||
+ typ_geo == MED_HEXA8 || typ_geo == MED_HEXA20 ||
+ typ_geo == MED_PENTA6 || typ_geo == MED_PENTA15 ||
+ typ_geo == MED_PYRA5 || typ_geo == MED_PYRA13)
+ return -1;
+
+ /*
+ * On inhibe le gestionnaire d'erreur HDF 5
+ */
+ _MEDmodeErreurVerrouiller();
+
+ /*
+ * Si le Data Group de "eq" n'existe pas => erreur
+ */
+ strcpy(chemin,MED_MAA);
+ strcat(chemin,maa);
+ strcat(chemin,MED_EQS);
+ strcat(chemin,eq);
+ if ((eqid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
+ return -1;
+
+ /*
+ * Lecture de l'equivalence
+ */
+ if ((ret = _MEDnomEntite(nomdatagroup,typ_ent)) < 0)
+ return -1;
+ if ((typ_ent != MED_NOEUD))
+ {
+ if ((ret = _MEDnomGeometrie(tmp,typ_geo)) < 0)
+ return -1;
+ strcat(nomdatagroup,".");
+ strcat(nomdatagroup,tmp);
+ }
+ if ((datagroup = _MEDdatagroupOuvrir(eqid,nomdatagroup)) < 0)
+ return -1;
+#if defined(IRIX64)||defined(OSF1)
+ if ((ret = _MEDdatasetNumLire(datagroup,MED_NOM_COR,MED_INT64,
+ MED_NO_INTERLACE,1,MED_ALL,
+ MED_NOPF,0,MED_NOPG,
+ (unsigned char *) corr)) < 0)
+ return -1;
+#else
+ if ((ret = _MEDdatasetNumLire(datagroup,MED_NOM_COR,MED_INT32,
+ MED_NO_INTERLACE,1,MED_ALL,
+ MED_NOPF,0,MED_NOPG,
+ (unsigned char *) corr)) < 0)
+ return -1;
+#endif
+
+ /*
+ * On ferme tout
+ */
+ if ((ret = _MEDdatagroupFermer(datagroup)) < 0)
+ return -1;
+ if ((ret = _MEDdatagroupFermer(eqid)) < 0)
+ return -1;
+
+ return 0;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "med.hxx"
+
+
+/***********************************************************************
+ * FONCTION MEDfam2groA
+ *
+ * - DESCRIPTION : 1ere etape dans la conversion des familles de groupes
+ * MED en goupes de noeuds et d'elements.
+ * Calcul des tailles des tableaux a allouer pour stocker les
+ * groupes que l'on veut creer.
+ * Les parametres renvoyes sont :
+ * 1 - le nombre de groupes de noeuds a creer (ngn)
+ * 2 - le nombre de groupes d'elements (nge)
+ * 3 - le nombre total de noeuds composant l'ensemble des groupes
+ * de noeuds (nindn)
+ * 4 - le nombre total d'elements composant l'ensemble des groupes
+ * d'elements (ninde)
+ * Ces parametres doivent permettre de creer les tables suivantes :
+ * 1 - une table de taille (nindn) contenant pour chaque groupe
+ * de noeuds la liste des noeuds le composant. Cette table
+ * sera indexee par une table de taille (ngn) qui contiendra
+ * pour chaque noeud un numero d'indice. Une table de taille
+ * (ngn) qui contiendra la liste des noms des differents
+ * groupes de noeuds.
+ * 2 - idem pour les elements
+ * Le remplissage de ces tables est realise par la fonction
+ * MEDfam2groB().
+ *
+ * - PARAMETRES :
+ * NOM .E/S. TYPE . DESCRIPTION
+ * -------------------------------------------------------------------
+ * nfam .E . med_int . nombre de familles
+ * numfam .E . med_int*. table des numeros de familles
+ * numfamnoe .E . med_int*. table des numeros de familles
+ * . . . des noeuds
+ * nnoeuds .E . med_int . nombre de noeuds
+ * numfamele .E . med_int*. table des numeros de familles
+ * . . . des elements
+ * nelememts .E . . nombre total d'elements
+ * grofam .E . char* . liste des groupes de familles
+ * indfamgro .E . int* . liste des indices des groupes
+ * . . . de familles dans grofam
+ * ngn . S. med_int*. nombre de groupes de noeuds a
+ * . . creer
+ * nge . S. med_int*. nombre de groupes d'elements a
+ * . . creer
+ * nindn . S. med_int*. taille de la table
+ * . . des groupes de noeuds a creer
+ * ninde . S. med_int*. taille de la table
+ * . . des groupes d'elements
+ *
+ * - RESULTAT : 0 si succes et -1 sinon
+ *
+ ***********************************************************************/
+
+namespace med_2_1{
+
+med_err
+MEDfam2groA (med_int nfam,med_int *numfam,med_int *numfamnoe,
+ med_int nnoeuds,med_int *numfamele,med_int nelements,
+ char *grofam,int *indfamgro,
+ med_int *ngn,med_int *nge,med_int *nindn,med_int *ninde)
+{
+ int i,j,k;
+ char groupe[MED_TAILLE_LNOM];
+ char *nomgronoe,*nomgroele,*tmp;
+ med_int numc;
+ int nnoe = 0,nele = 0;
+ int flag = 0;
+
+ *ngn = 0;
+ *nge = 0;
+ *nindn = 0;
+ *ninde = 0;
+
+ tmp = NULL;
+ nomgronoe = NULL;
+ nomgroele = NULL;
+
+ /* Pour chaque famille, on regarde s'il y a de nouveaux groupes
+ de noeuds ou d'elements a creer. Pour chaque nouveau groupe,
+ on compte le nombre de noeuds ou d'elements qui devront lui etre
+ rataches */
+ for (i=1;i<=nfam;i++)
+ if ((*(indfamgro+i)-*(indfamgro+i-1))/MED_TAILLE_LNOM > 0)
+ {
+ /* on releve le numero de la famille courante */
+ numc = *(numfam+i-1);
+ nnoe = 0;
+ nele = 0;
+ /* si c'est une famille de noeuds, on compte le nombre de
+ noeuds qui y sont rattaches */
+ if (numc > 0)
+ for (j=0;j<nnoeuds;j++)
+ if (*(numfamnoe+j) == numc)
+ nnoe++;
+ /* si c'est une famille d'elements, on compte le nombre d'elements
+ qui y sont rattaches */
+ if (numc < 0)
+ for (j=0;j<nelements;j++)
+ if (*(numfamele+j) == numc)
+ nele++;
+ /* on parcourt la liste des groupes de la famille et pour chaque
+ groupe :
+ 1 - on met a jour les compteurs nindn et ninde ;
+ 2 - on verifie s'il s'agit d'un groupe deja repertorie.
+ Si c'est le cas on ne fait rien, sinon on met a jour les
+ compteurs ngn ou nge */
+ for (j=0;j<(*(indfamgro+i)-*(indfamgro+i-1))/MED_TAILLE_LNOM;j++)
+ {
+ strncpy(groupe,grofam+*(indfamgro+i-1)+j*MED_TAILLE_LNOM,
+ MED_TAILLE_LNOM);
+ if (numc > 0)
+ {
+ *nindn = *nindn+nnoe;
+ if (*ngn == 0)
+ {
+ *ngn = 1;
+ if ((nomgronoe=(char*)malloc(sizeof(char)*MED_TAILLE_LNOM))
+ == NULL)
+ return -1;
+ strncpy(nomgronoe,groupe,MED_TAILLE_LNOM);
+ }
+ else
+ {
+ flag = 0;
+ for (k=0;k<(*ngn);k++)
+ if (strncmp(groupe,nomgronoe+k*MED_TAILLE_LNOM,
+ MED_TAILLE_LNOM) == 0)
+ flag = 1;
+ if (flag == 0)
+ {
+ *ngn = *ngn + 1;
+ if ((tmp=(char*)malloc(sizeof(char)*
+ MED_TAILLE_LNOM**ngn)) == NULL)
+ return -1;
+ strncpy(tmp,nomgronoe,MED_TAILLE_LNOM*(*ngn-1));
+ strncpy(tmp+MED_TAILLE_LNOM*(*ngn-1),groupe,
+ MED_TAILLE_LNOM);
+ free(nomgronoe);
+ nomgronoe = tmp;
+ }
+ }
+ }
+ if (numc < 0)
+ {
+ *ninde = *ninde+nele;
+ if (*nge == 0)
+ {
+ *nge = 1;
+ if ((nomgroele=(char *)malloc(sizeof(char)*
+ MED_TAILLE_LNOM)) == NULL)
+ return -1;
+ strncpy(nomgroele,groupe,MED_TAILLE_LNOM);
+ }
+ else
+ {
+ flag = 0;
+ for (k=0;k<(*nge);k++)
+ if (strncmp(groupe,nomgroele+k*MED_TAILLE_LNOM,
+ MED_TAILLE_LNOM) == 0)
+ flag = 1;
+ if (flag == 0)
+ {
+ *nge = *nge + 1;
+ if ((tmp = (char*) malloc(sizeof(char)*MED_TAILLE_LNOM*
+ *nge)) == NULL)
+ return -1;
+ strncpy(tmp,nomgroele,MED_TAILLE_LNOM*(*nge-1));
+ strncpy(tmp+MED_TAILLE_LNOM*(*nge-1), groupe,
+ MED_TAILLE_LNOM);
+ free(nomgroele);
+ nomgroele = tmp;
+ }
+ }
+ }
+ }
+ }
+
+ /* nettoyage memoire */
+ free(nomgronoe);
+ free(nomgroele);
+
+ return 0;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "med.hxx"
+
+/***********************************************************************
+ * FONCTION MEDfam2groB
+ *
+ * - DESCRIPTION : 2e etape dans la conversion des familles MED en
+ * groupes de noeuds et d'elements. Les tables allouees a partir
+ * des parametres calcules par MEDfam2groA() sont passees en argument
+ * a MEDfam2groB et remplies par cette derniere fonction.
+ * Il s'agit de :
+ * 1 - la table des noms de groupes de noeuds, chaque nom ayant
+ * une taille de MED_TAILLE_LNOM
+ * 2 - la table des noms des groupes d'elements
+ * 3 - la table des groupes de noeuds -i.e. pour chaque groupe
+ * la liste des numeros des noeuds qui le composent
+ * 4 - la table d'indexation de la table des groupes de noeuds
+ * 5 - la table des groupes d'elements
+ * 6 - la table d'indexation de la table des groupes d'elements
+ *
+ * - PARAMETRES :
+ * NOM .E/S. TYPE . DESCRIPTION
+ * -------------------------------------------------------------------
+ * nfam .E . med_int . nombre de familles
+ * numfam .E . med_int*. table des numeros de familles
+ * numfamnoe .E . med_int*. table des numeros de familles
+ * . . . des noeuds
+ * nnoeuds .E . med_int . nombre de noeuds
+ * numfamele .E . med_int*. table des numeros de familles
+ * . . . des elements
+ * nelememts .E . med_int . nombre total d'elements
+ * grofam .E . char* . liste des groupes de familles
+ * indfamgro .E . int* . liste des indices des groupes
+ * . . . de familles dans indfamgro
+ * numnoeuds .E . med_int*. numeros des noeuds
+ * numele .E . med_int*. numeros des elements
+ * ngn .E . med_int . nombre de groupes de noeuds
+ * nge .E . med_int . nombre de groupes d'elements
+ * nindn .E . med_int . nombre d'indices dans la table
+ * . . des groupes de noeuds a creer
+ * ninde .E . med_int . nombre d'indices dans la table
+ * . . des groupes d'elements
+ * nomgronoe . S. char* . noms des groupes de noeuds
+ * nomgroele . S. char* . noms des groupes d'elements
+ * indgronoe . S. int* . indices des groupes de noeuds
+ * indgroele . S. int* . indices des groupes d'elements
+ * tabgronoe . S. med_int*. table des groupes de noeuds
+ * tabgroele . S. med_int*. table des groupes d'elements
+ *
+ * - RESULTAT : 0
+ *
+ ***********************************************************************/
+
+namespace med_2_1{
+
+med_err
+MEDfam2groB(med_int nfam,med_int *numfam,med_int *numfamnoe,
+ med_int nnoeuds,med_int *numfamele,med_int nelements,
+ char *grofam,int *indfamgro,med_int *numnoeuds,
+ med_int *numele,med_int ngn,med_int nge,med_int nindn,
+ med_int ninde,char *nomgronoe,char *nomgroele,
+ int *indgronoe,int *indgroele,
+ med_int *tabgronoe,med_int *tabgroele)
+{
+ int i,j,k;
+ char groupe[MED_TAILLE_LNOM];
+ med_int numc;
+ int nnoe = 0, nele = 0;
+ int flag = 0;
+ int nn = 0, ne = 0;
+ int pos, cpt;
+
+ /* initialisations */
+ for (i=0;i<=ngn;i++)
+ *(indgronoe+i) = 0;
+ for (i=0;i<=nge;i++)
+ *(indgroele+i) = 0;
+
+ /* 1ere passe : on passe en revue toutes les familles :
+ 1 - on etablit dans (nomgronoe) et dans (nomgroele) les listes
+ des noms de groupes de noeuds et d'elements
+ 2 - on place dans les tables d'index (indgronoe) et (indgroele)
+ le nombre de noeuds ou d'elements que chaque groupe se verra
+ attribuer */
+ for (i=1;i<=nfam;i++)
+ {
+ numc = *(numfam+i-1);
+ nnoe = 0;
+ nele = 0;
+ if (numc > 0)
+ for (j=0;j<nnoeuds;j++)
+ if (*(numfamnoe+j) == numc)
+ nnoe++;
+ if (numc < 0)
+ for (j=0;j<nelements;j++)
+ if (*(numfamele+j) == numc)
+ nele++;
+ for (j=0;j<(*(indfamgro+i)-*(indfamgro+i-1))/MED_TAILLE_LNOM; j++)
+ {
+ strncpy(groupe, grofam+*(indfamgro+i-1)+j*MED_TAILLE_LNOM,
+ MED_TAILLE_LNOM);
+ if (numc > 0)
+ {
+ if (nn == 0)
+ {
+ strncpy(nomgronoe,groupe,MED_TAILLE_LNOM);
+ nn = 1;
+ pos = 1;
+ }
+ else
+ {
+ flag = 0;
+ for (k=0; k<nn;k++)
+ if (strncmp(groupe,nomgronoe+k*MED_TAILLE_LNOM,
+ MED_TAILLE_LNOM) == 0)
+ {
+ flag = 1;
+ pos = k+1;
+ }
+ if (flag == 0)
+ {
+ strncpy(nomgronoe+nn*MED_TAILLE_LNOM,groupe,
+ MED_TAILLE_LNOM);
+ pos = nn + 1;
+ nn = nn + 1;
+ }
+ }
+ *(indgronoe+pos) = *(indgronoe+pos) + nnoe;
+ }
+ if (numc < 0)
+ {
+ if (ne == 0)
+ {
+ strncpy(nomgroele,groupe,MED_TAILLE_LNOM);
+ ne = 1;
+ pos = 1;
+ }
+ else
+ {
+ flag = 0;
+ for (k=0; k<ne;k++)
+ if (strncmp(groupe,nomgroele+k*MED_TAILLE_LNOM,
+ MED_TAILLE_LNOM) == 0)
+ {
+ flag = 1;
+ pos = k + 1;
+ }
+ if (flag == 0)
+ {
+ strncpy(nomgroele+ne*MED_TAILLE_LNOM,groupe,
+ MED_TAILLE_LNOM);
+ pos = ne + 1;
+ ne = ne + 1;
+ }
+ }
+ *(indgroele+pos) = *(indgroele+pos) + nele;
+ }
+ }
+ }
+ *(nomgronoe+ngn*MED_TAILLE_LNOM) = '\0';
+ *(nomgroele+nge*MED_TAILLE_LNOM) = '\0';
+
+ /* 2e passe : on construit les listes des index ainsi que les
+ les tables des groupes */
+ for (i=1;i<=ngn;i++)
+ {
+ cpt = 0;
+ *(indgronoe+i) = *(indgronoe+i-1) + *(indgronoe+i);
+ strncpy(groupe,nomgronoe+(i-1)*MED_TAILLE_LNOM,MED_TAILLE_LNOM);
+ for (j=1;j<=nfam;j++)
+ {
+ numc = *(numfam+j-1);
+ if (numc > 0)
+ {
+ flag = 0;
+ for (k=0;k<(*(indfamgro+j)-*(indfamgro+j-1))/MED_TAILLE_LNOM;
+ k++)
+ if (! strncmp(groupe,
+ grofam+*(indfamgro+j-1)+k*MED_TAILLE_LNOM,
+ MED_TAILLE_LNOM))
+ flag = 1;
+ if (flag == 1)
+ for (k=0;k<nnoeuds;k++)
+ if (*(numfamnoe+k) == numc)
+ {
+ *(tabgronoe+*(indgronoe+i-1)+cpt) = *(numnoeuds+k);
+ cpt++;
+ }
+ }
+ }
+ }
+
+ for (i=1;i<=nge;i++)
+ {
+ cpt = 0;
+ *(indgroele+i) = *(indgroele+i-1) + *(indgroele+i);
+ strncpy(groupe,nomgroele+(i-1)*MED_TAILLE_LNOM,MED_TAILLE_LNOM);
+ for (j=1;j<=nfam;j++)
+ {
+ numc = *(numfam+j-1);
+ if (numc < 0)
+ {
+ flag = 0;
+ for (k=0;k<(*(indfamgro+j)-*(indfamgro+j-1))/MED_TAILLE_LNOM;
+ k++)
+ if (! strncmp(groupe,
+ grofam+*(indfamgro+j-1)+k*MED_TAILLE_LNOM,
+ MED_TAILLE_LNOM))
+ flag = 1;
+ if (flag == 1)
+ for (k=0;k<nelements;k++)
+ if (*(numfamele+k) == numc)
+ {
+ *(tabgroele+*(indgroele+i-1)+cpt) = *(numele+k);
+ cpt++;
+ }
+ }
+ }
+ }
+
+ return 0;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+#include <string.h>
+#include <stdlib.h>
+
+namespace med_2_1{
+
+med_err
+MEDfamCr(med_idt fid,char* maa,char *famille,med_int numero,
+ med_int *attr_ident, med_int *attr_val, char *attr_desc,
+ med_int n_attr,char *groupe, med_int n_groupe)
+{
+ med_idt root, datagroup, famid;
+ med_err ret;
+ med_size dimd[1];
+ char chemin[MED_TAILLE_MAA+MED_TAILLE_FAS+MED_TAILLE_NOM+1];
+ char tmp[MED_TAILLE_FAS+1];
+
+ /*
+ * On inhibe le gestionnaire d'erreur HDF 5
+ */
+ _MEDmodeErreurVerrouiller();
+
+ /*
+ * Si le Data Group FAS n'existe pas, on le cree
+ */
+ strcpy(chemin,MED_MAA);
+ strcat(chemin,maa);
+ strncpy(tmp,MED_FAS,MED_TAILLE_FAS-1);
+ tmp[MED_TAILLE_FAS-1] = '\0';
+ strcat(chemin,tmp);
+ if ((root = _MEDdatagroupOuvrir(fid,chemin)) < 0)
+ if ((root = _MEDdatagroupCreer(fid,chemin)) < 0)
+ return -1;
+
+ /*
+ * Si le Data Group de meme nom que famille existe => erreur
+ * Sinon on le cree
+ */
+ if ((famid = _MEDdatagroupOuvrir(root,famille)) >= 0)
+ return -1;
+ if ((famid = _MEDdatagroupCreer(root,famille)) < 0)
+ return -1;
+
+ /*
+ * L'attribut NUM
+ */
+ if ((ret = _MEDattrEntierEcrire(famid,MED_NOM_NUM,&numero,MED_REMP)) < 0)
+ return -1;
+
+ /*
+ * Le Data Group "GRO"
+ */
+ if (n_groupe > 0)
+ {
+ /*
+ * On cree le Data Group
+ */
+ if ((datagroup = _MEDdatagroupCreer(famid,MED_NOM_GRO)) < 0)
+ return -1;
+
+ /*
+ * L'attribut "NBR"
+ */
+ if ((ret = _MEDattrEntierEcrire(datagroup,MED_NOM_NBR,&n_groupe,MED_REMP)) < 0)
+ return -1;
+
+ /*
+ * Data Set des noms des groupes "NOM"
+ */
+ dimd[0] = n_groupe*MED_TAILLE_LNOM+1;
+ if ((ret = _MEDdatasetStringEcrire(datagroup,MED_NOM_NOM,dimd,groupe,
+ MED_REMP))<0)
+ return -1;
+
+ /*
+ * On ferme le Data Group
+ */
+ if ((ret = _MEDdatagroupFermer(datagroup)) < 0)
+ return -1;
+ }
+
+ /*
+ * Le Data Group "ATT"
+ */
+
+ if (n_attr > 0)
+ {
+ if ((datagroup = _MEDdatagroupCreer(famid,MED_NOM_ATT)) < 0)
+ return -1;
+
+ /*
+ * L'attribut "NBR"
+ */
+ if ((ret = _MEDattrEntierEcrire(datagroup,MED_NOM_NBR,&n_attr,MED_REMP)) < 0)
+ return -1;
+
+ /*
+ * Le Data Set "IDE"
+ */
+ dimd[0] = n_attr;
+#if defined(IRIX64)||defined(OSF1)
+ if ((ret = _MEDdatasetNumEcrire(datagroup,MED_NOM_IDE,MED_INT64,MED_NO_INTERLACE,MED_DIM1,MED_ALL,MED_NOPF,0,MED_NOPG,dimd,
+ (unsigned char *)attr_ident,MED_REMP)) < 0)
+ return -1;
+#else
+ if ((ret = _MEDdatasetNumEcrire(datagroup,MED_NOM_IDE,MED_INT32,MED_NO_INTERLACE,MED_DIM1,MED_ALL,MED_NOPF,0,MED_NOPG,dimd,
+ (unsigned char *)attr_ident,MED_REMP)) < 0)
+ return -1;
+#endif
+
+ /*
+ * Le Data Set "VAL"
+ */
+ dimd[0] = n_attr;
+#if defined(IRIX64)||defined(OSF1)
+ if ((ret = _MEDdatasetNumEcrire(datagroup,MED_NOM_VAL,MED_INT64,MED_NO_INTERLACE,MED_DIM1,MED_ALL,MED_NOPF,0,MED_NOPG,dimd,
+ (unsigned char*)attr_val,MED_REMP)) < 0)
+ return -1;
+#else
+ if ((ret = _MEDdatasetNumEcrire(datagroup,MED_NOM_VAL,MED_INT32,MED_NO_INTERLACE,MED_DIM1,MED_ALL,MED_NOPF,0,MED_NOPG,dimd,
+ (unsigned char*)attr_val,MED_REMP)) < 0)
+ return -1;
+#endif
+
+ /*
+ * Le Data Set "DES"
+ */
+ dimd[0] = n_attr*MED_TAILLE_DESC+1;
+ if ((ret = _MEDdatasetStringEcrire(datagroup,MED_NOM_DES,dimd,attr_desc,
+ MED_REMP)) < 0)
+ return -1;
+
+ /*
+ * On ferme le Data Group
+ */
+ if ((ret = _MEDdatagroupFermer(datagroup)) < 0)
+ return -1;
+ }
+
+ /*
+ * On ferme tout
+ */
+ if ((ret = _MEDdatagroupFermer(famid)) < 0)
+ return -1;
+ if ((ret = _MEDdatagroupFermer(root)) < 0)
+ return -1;
+
+ return 0;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+#include <stdlib.h>
+#include <string.h>
+
+namespace med_2_1{
+
+med_err
+MEDfamEcr(med_idt fid,char *maa, med_int *fam, med_int n, med_mode_acces mode,
+ med_entite_maillage type_ent, med_geometrie_element type_geo)
+{
+ med_idt root, maaid, entid, geoid, dataset;
+ med_err ret;
+ med_size dimd[1];
+ char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
+ char nom_ent[MED_TAILLE_NOM_ENTITE+1];
+ char nom_geo[MED_TAILLE_NOM_ENTITE+1];
+
+ /*
+ * On inhibe le gestionnaire d'erreur HDF 5
+ */
+ _MEDmodeErreurVerrouiller();
+
+ /*
+ * Si le maillage n'existe pas => erreur
+ */
+ strcpy(chemin,MED_MAA);
+ strcat(chemin,maa);
+ if ((maaid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
+ return -1;
+
+ /*
+ * On met a jour le nom du Data Group representant
+ * le type des entites
+ */
+ if ((ret = _MEDnomEntite(nom_ent,type_ent)) < 0)
+ return -1;
+
+ /*
+ * Si le Data Group des entites n'existe pas on le cree
+ */
+ if ((entid = _MEDdatagroupOuvrir(maaid,nom_ent)) < 0)
+ if ((entid = _MEDdatagroupCreer(maaid,nom_ent)) < 0)
+ return -1;
+
+ /*
+ * Pour les mailles, les faces et le aretes, on cree
+ * s'il n'existe pas le Data Group du type geometrique
+ */
+ if ((type_ent==MED_MAILLE)||(type_ent==MED_FACE)||(type_ent==MED_ARETE))
+ {
+ if ((ret = _MEDnomGeometrie(nom_geo,type_geo)) < 0)
+ return -1;
+
+ if ((geoid = _MEDdatagroupOuvrir(entid,nom_geo)) < 0)
+ if ((geoid = _MEDdatagroupCreer(entid,nom_geo)) < 0)
+ return -1;
+ }
+ else
+ geoid = -1;
+
+ /*
+ * Creation du Data Set "FAM"
+ */
+ if (geoid == -1)
+ root = entid;
+ else
+ root = geoid;
+ dimd[0] = n;
+#if defined(IRIX64) || defined(OSF1)
+ if ((ret = _MEDdatasetNumEcrire(root,MED_NOM_FAM,MED_INT64,MED_NO_INTERLACE,MED_DIM1,MED_ALL,MED_NOPF,0,MED_NOPG,dimd,
+ (unsigned char*)fam,mode)) < 0)
+ return -1;
+#else
+ if ((ret = _MEDdatasetNumEcrire(root,MED_NOM_FAM,MED_INT32,MED_NO_INTERLACE,MED_DIM1,MED_ALL,MED_NOPF,0,MED_NOPG,dimd,
+ (unsigned char*)fam,mode)) < 0)
+ return -1;
+#endif
+
+ /*
+ * Attribut NBR (nombre de noeuds)
+ */
+ if ((dataset = _MEDdatasetOuvrir(root,MED_NOM_FAM)) < 0)
+ return -1;
+ if ((ret = _MEDattrEntierEcrire(dataset,MED_NOM_NBR,&n,mode)) < 0)
+ return -1;
+
+ /*
+ * On ferme tout
+ */
+ if ((ret = _MEDdatasetFermer(dataset)) < 0)
+ return -1;
+ if (geoid != -1)
+ if ((ret = _MEDdatagroupFermer(geoid)) < 0)
+ return -1;
+ if ((ret = _MEDdatagroupFermer(entid)) < 0)
+ return -1;
+ if ((ret = _MEDdatagroupFermer(maaid)) < 0)
+ return -1;
+
+ return 0;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+
+namespace med_2_1{
+
+med_err
+MEDfamGridEcr(med_idt fid, char *maa, med_int *fam, med_int n, med_mode_acces mode, med_entite_maillage type_ent) {
+ /* Ecrire des numeros de familles pour les grilles cartesiennes ou polaires :
+ - pour les noeuds
+ - pour les aretes
+ - pour les faces
+ - pour les mailles */
+
+ med_geometrie_element type_geo;
+
+ switch(type_ent) {
+ case MED_NOEUD : {
+ type_geo = MED_POINT1;
+ break;
+ };
+ case MED_ARETE : {
+ type_geo = MED_SEG2;
+ break;
+ };
+ case MED_FACE : {
+ type_geo = MED_QUAD4;
+ break;
+ };
+ case MED_MAILLE : {
+ type_geo = MED_HEXA8;
+ break;
+ };
+ default : {
+ return(-1);
+ };
+ };
+
+ return(MEDfamEcr(fid, maa, fam, n, mode, type_ent, type_geo));
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+
+namespace med_2_1{
+
+med_err
+MEDfamGridLire(med_idt fid, char *maa, med_int *fam, med_int n, med_entite_maillage type_ent) {
+ /* lecture des numeros de familles pour les grilles cartesiennes ou polaires :
+ - pour les noeuds
+ - pour les aretes
+ - pour les faces
+ - pour les mailles */
+
+ med_geometrie_element type_geo;
+
+ switch(type_ent) {
+ case MED_NOEUD : {
+ type_geo = MED_POINT1;
+ break;
+ };
+ case MED_ARETE : {
+ type_geo = MED_SEG2;
+ break;
+ };
+ case MED_FACE : {
+ type_geo = MED_QUAD4;
+ break;
+ };
+ case MED_MAILLE : {
+ type_geo = MED_HEXA8;
+ break;
+ };
+ default : {
+ return(-1);
+ };
+ };
+
+ return(MEDfamLire(fid, maa, fam, n, type_ent, type_geo));
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+#include <stdlib.h>
+#include <string.h>
+
+namespace med_2_1{
+
+med_err
+MEDfamInfo(med_idt fid,char *maa,int indice, char *famille,
+ med_int *numero,
+ med_int *attr_ident, med_int *attr_val, char *attr_desc,
+ med_int *n_attr, char *groupe ,med_int *n_groupe)
+{
+ med_idt famid,datagroup;
+ med_err ret;
+ char chemin[MED_TAILLE_MAA+MED_TAILLE_FAS+2*MED_TAILLE_NOM+1];
+ int num;
+
+ /*
+ * On inhibe le gestionnaire d'erreur HDF 5
+ */
+ _MEDmodeErreurVerrouiller();
+
+ /*
+ * On recupere le nom de la famille
+ */
+ num = indice - 1;
+ strcpy(chemin,MED_MAA);
+ strcat(chemin,maa);
+ strcat(chemin,MED_FAS);
+ if ((ret = _MEDobjetIdentifier(fid,chemin,num,famille)) < 0)
+ return -1;
+
+ /*
+ * Si le Data Group de la famille n'existe pas => erreur
+ */
+ strcat(chemin,famille);
+ if ((famid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
+ return -1;
+
+ /*
+ * L'attribut NUM
+ */
+ if ((ret = _MEDattrEntierLire(famid,MED_NOM_NUM,numero)) < 0)
+ return -1;
+
+ /*
+ * Le Data Group "GRO"
+ */
+ if ((datagroup = _MEDdatagroupOuvrir(famid,MED_NOM_GRO)) >= 0)
+ {
+ /*
+ * L'attribut "NBR"
+ */
+ if ((ret = _MEDattrEntierLire(datagroup,MED_NOM_NBR,n_groupe)) < 0)
+ return -1;
+
+ /*
+ * Data Set des noms des groupes "NOM"
+ */
+ if ((ret = _MEDdatasetStringLire(datagroup,MED_NOM_NOM,groupe)) < 0)
+ return -1;
+
+ /*
+ * On ferme le Data Group
+ */
+ if ((ret = _MEDdatagroupFermer(datagroup)) < 0)
+ return -1;
+ }
+ else
+ *n_groupe = 0;
+
+ /*
+ * Le Data Group "ATT"
+ */
+ if ((datagroup = _MEDdatagroupOuvrir(famid,MED_NOM_ATT)) >= 0)
+ {
+ /*
+ * L'attribut "NBR"
+ */
+ if ((ret = _MEDattrEntierLire(datagroup,MED_NOM_NBR,n_attr)) < 0)
+ return -1;
+
+ /*
+ * Le Data Set "IDE"
+ */
+#if defined(IRIX64)||defined(OSF1)
+ if ((ret = _MEDdatasetNumLire(datagroup,MED_NOM_IDE,MED_INT64,
+ MED_NO_INTERLACE,1,MED_ALL,
+ MED_NOPF,0,MED_NOPG,
+ (unsigned char*) attr_ident)) < 0)
+ return -1;
+#else
+ if ((ret = _MEDdatasetNumLire(datagroup,MED_NOM_IDE,MED_INT32,
+ MED_NO_INTERLACE,1,MED_ALL,
+ MED_NOPF,0,MED_NOPG,
+ (unsigned char*) attr_ident)) < 0)
+ return -1;
+#endif
+
+ /*
+ * Le Data Set "VAL"
+ */
+#if defined(IRIX64)||defined(OSF1)
+ if ((ret = _MEDdatasetNumLire(datagroup,MED_NOM_VAL,MED_INT64,
+ MED_NO_INTERLACE,1,MED_ALL,
+ MED_NOPF,0,MED_NOPG,
+ (unsigned char *) attr_val)) < 0)
+ return -1;
+#else
+ if ((ret = _MEDdatasetNumLire(datagroup,MED_NOM_VAL,MED_INT32,
+ MED_NO_INTERLACE,1,MED_ALL,
+ MED_NOPF,0,MED_NOPG,
+ (unsigned char *) attr_val)) < 0)
+ return -1;
+#endif
+
+ /*
+ * Le Data Set "DES"
+ */
+ ret = _MEDdatasetStringLire(datagroup,MED_NOM_DES,attr_desc);
+
+ /*
+ * On ferme le Data Group
+ */
+ if ((ret = _MEDdatagroupFermer(datagroup)) < 0)
+ return -1;
+ }
+ else
+ *n_attr = 0;
+
+ /*
+ * On ferme tout
+ */
+ if ((ret = _MEDdatagroupFermer(famid)) < 0)
+ return -1;
+
+ return 0;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+#include <stdlib.h>
+#include <string.h>
+
+namespace med_2_1{
+
+med_err
+MEDfamLire(med_idt fid,char *maa, med_int *fam, med_int n,
+ med_entite_maillage type_ent,med_geometrie_element type_geo)
+{
+ med_idt root,maaid, entid, geoid;
+ med_err ret;
+ char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
+ char nom_ent[MED_TAILLE_NOM_ENTITE+1];
+ char nom_geo[MED_TAILLE_NOM_ENTITE+1];
+
+ /*
+ * On inhibe le gestionnaire d'erreur HDF 5
+ */
+ _MEDmodeErreurVerrouiller();
+
+ /*
+ * Si le maillage n'existe pas => erreur
+ */
+ strcpy(chemin,MED_MAA);
+ strcat(chemin,maa);
+ if ((maaid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
+ return -1;
+
+ /*
+ * On met a jour le nom du Data Group representant
+ * le type des entites
+ */
+ if ((ret = _MEDnomEntite(nom_ent,type_ent)) < 0)
+ return -1;
+
+ /*
+ * Si le Data Group des entites n'existe pas => erreur
+ */
+ if ((entid = _MEDdatagroupOuvrir(maaid,nom_ent)) < 0)
+ return -1;
+
+ /*
+ * Pour les mailles, les faces et le aretes, on cree
+ * si le Data Group du type geometrique => erreur
+ */
+ if ((type_ent==MED_MAILLE)||(type_ent==MED_FACE)||(type_ent==MED_ARETE))
+ {
+ if ((ret = _MEDnomGeometrie(nom_geo,type_geo)) < 0)
+ return -1;
+ if ((geoid = _MEDdatagroupOuvrir(entid,nom_geo)) < 0)
+ return -1;
+ }
+ else
+ geoid = -1;
+
+ /*
+ * lecture du Data Set "FAM"
+ */
+ if (geoid == -1)
+ root = entid;
+ else
+ root = geoid;
+#if defined(IRIX64)||defined(OSF1)
+ if ((ret = _MEDdatasetNumLire(root,MED_NOM_FAM,MED_INT64,
+ MED_NO_INTERLACE,1,MED_ALL,
+ MED_NOPF,0,MED_NOPG,
+ (unsigned char *)fam)) < 0)
+ return -1;
+#else
+ if ((ret = _MEDdatasetNumLire(root,MED_NOM_FAM,MED_INT32,
+ MED_NO_INTERLACE,1,MED_ALL,
+ MED_NOPF,0,MED_NOPG,
+ (unsigned char *)fam)) < 0)
+ return -1;
+#endif
+
+ /*
+ * On ferme tout
+ */
+ if (geoid != -1)
+ if ((ret = _MEDdatagroupFermer(geoid)) < 0)
+ return -1;
+ if ((ret = _MEDdatagroupFermer(entid)) < 0)
+ return -1;
+ if ((ret = _MEDdatagroupFermer(maaid)) < 0)
+ return -1;
+
+ return 0;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+#include <stdio.h>
+
+namespace med_2_1{
+
+med_err
+MEDfamMaaCr(med_idt fid,char *maa,
+ med_int *numfam,med_int *attide,
+ med_int *attval,char *attdes,int *indatt,char *gro,int *indgro,
+ med_int nfamilles)
+{
+ med_err ret;
+ med_int i;
+ med_int natt,ngro;
+ med_int numf;
+ char nomfam[MED_TAILLE_NOM+1];
+
+ /* La famille de numero 0 n'a aucun attribut, ni aucun groupe
+ Les familles de numero > 0 sont des familles de noeuds
+ Les familles de numero < 0 sont des familles d'elements */
+ for (i=0;i<nfamilles;i++)
+ {
+ numf = *(numfam+i);
+ if (numf == 0)
+ strcpy(nomfam,"FAMILLE_0");
+ if (numf > 0)
+ {
+ strcpy(nomfam,"FAMILLE_NOEUD_");
+ sprintf(nomfam,"%s%d",nomfam,numf);
+ nomfam[MED_TAILLE_NOM] = '\0';
+ }
+ if (numf < 0)
+ {
+ strcpy(nomfam,"FAMILLE_ELEMENT_");
+ sprintf(nomfam,"%s%d",nomfam,-numf);
+ nomfam[MED_TAILLE_NOM] = '\0';
+ }
+ natt = *(indatt+i+1) - *(indatt+i);
+ ngro = (*(indgro+i+1) - *(indgro+i))/MED_TAILLE_LNOM;
+ if ((ret = MEDfamCr(fid,maa,nomfam,numf,
+ attide+*(indatt+i),
+ attval+*(indatt+i),
+ attdes+*(indatt+i)*MED_TAILLE_DESC,natt,
+ gro+*(indgro+i),ngro)) < 0)
+ return -1;
+ }
+
+ return 0;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+
+#include "med.hxx"
+
+namespace med_2_1{
+
+med_err
+MEDfamMaaInfo(med_idt fid,char *maa,med_int *nfam,med_int *nattc,
+ med_int *ngroc)
+{
+ med_int ret;
+ med_int i;
+
+ /* Lecture du nombre de familles */
+ if ((*nfam = MEDnFam(fid,maa,0,(med_dim_famille)0)) < 0)
+ return -1;
+
+ /* Lecture des nombres cumules de groupes et d'attributs dans toutes
+ les familles du maillage */
+ *nattc = 0;
+ *ngroc = 0;
+ for (i=0;i<*nfam;i++)
+ {
+ if ((ret = MEDnFam(fid,maa,i+1,MED_ATTR)) < 0)
+ return -1;
+ *nattc += ret;
+ if ((ret = MEDnFam(fid,maa,i+1,MED_GROUPE)) < 0)
+ return -1;
+ *ngroc += ret;
+ }
+
+ return 0;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+namespace med_2_1{
+
+med_err
+MEDfamMaaLire(med_idt fid,char *maa,med_int *numfam,med_int *attide,
+ med_int *attval,char *attdes,int *indatt,char *gro,int *indgro,
+ med_int nfamilles)
+{
+ med_err ret;
+ med_int natt,ngro;
+ med_int i;
+ char nom[MED_TAILLE_NOM+1];
+
+ *indatt = 0;
+ *indgro = 0;
+ for (i=0;i<nfamilles;i++)
+ {
+ if ((ret = MEDfamInfo(fid,maa,i+1,nom,numfam+i,attide+*(indatt+i),
+ attval+*(indatt+i),
+ attdes+*(indatt+i)*MED_TAILLE_DESC,
+ &natt,gro+*(indgro+i),&ngro)) < 0)
+ return -1;
+ *(indatt+i+1) = *(indatt+i)+natt;
+ *(indgro+i+1) = *(indgro+i)+ngro*MED_TAILLE_LNOM;
+ }
+
+ return 0;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med_outils.hxx"
+#include "med.hxx"
+
+namespace med_2_1{
+
+med_err
+MEDfermer(med_idt fid)
+{
+ /*
+ * On inhibe le gestionnaire d'erreur
+ */
+ _MEDmodeErreurVerrouiller();
+
+ /*
+ * On ferme le fichier MED
+ */
+ if (_MEDfichierFermer(fid) < 0)
+ return -1;
+ else
+ return 0;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+#include <string.h>
+
+namespace med_2_1{
+
+med_err
+MEDfichDesEcr(med_idt fid, char *des, med_mode_acces mode)
+{
+ med_idt attr;
+ med_idt root;
+ med_err ret;
+ char nom[] = MED_NOM_DESCRIPTEUR;
+ char chemin[MED_TAILLE_MAA+1];
+
+ /*
+ * On inhibe le gestionnaire d'erreur
+ */
+ _MEDmodeErreurVerrouiller();
+
+ /*
+ * On ouvre le Data Group racine
+ * s'il n'existe pas on le cree
+ */
+ strncpy(chemin,MED_MAA,MED_TAILLE_MAA-1);
+ chemin[MED_TAILLE_MAA-1] = '\0';
+ if ((root = _MEDdatagroupOuvrir(fid,chemin)) < 0)
+ if ((root = _MEDdatagroupCreer(fid,chemin)) < 0)
+ return -1;
+
+ /*
+ * On regarde si l'attribut existe
+ * Si oui on le met a jour en fonction
+ * du mode d'ouverture, sinon on le cree
+ */
+
+ if ((ret = _MEDattrStringEcrire(root,nom,MED_TAILLE_DESC,des,mode)) < 0)
+ return -1;
+
+ /*
+ * Fermetures
+ */
+
+ if ((ret = _MEDdatagroupFermer(root)) < 0)
+ return -1;
+
+ return 0;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+#include <string.h>
+
+namespace med_2_1{
+
+med_err
+MEDfichEntete(med_idt fid, med_fich_info quoi, char str[])
+{
+ med_idt atid, root;
+ med_err ret;
+ char locale[MED_TAILLE_DESC+1];
+ char chemin[MED_TAILLE_MAA+1];
+
+ switch (quoi)
+ {
+ case MED_HDF_VERSION :
+ strcpy(str,HDF_VERSION_ACTUELLE);
+ break;
+
+ case MED_VERSION :
+ strcpy(str,MED_VERSION_ACTUELLE);
+ break;
+
+ case MED_FICH_DES :
+ /*
+ * On inhibe le gestionnaire d'erreur HDF
+ */
+ _MEDmodeErreurVerrouiller();
+
+ /*
+ * On ouvre le Data Group racine
+ */
+ strncpy(chemin,MED_MAA,strlen(MED_MAA)-1);
+ chemin[MED_TAILLE_MAA-1] = '\0';
+ if ((root = _MEDdatagroupOuvrir(fid,chemin)) < 0)
+ return -1;
+
+ /*
+ * On regarde si l'attribut existe
+ * Si non => erreur
+ * Si oui => on le copie dans str
+ */
+ if ((ret = _MEDattrStringLire(root,MED_NOM_DESCRIPTEUR,
+ MED_TAILLE_DESC,locale)) < 0)
+ return -1;
+ strcpy(str,locale);
+
+ if ((ret == _MEDdatagroupFermer(root)) < 0)
+ return -1;
+
+ break;
+
+ default :
+ return -1;
+ }
+ return 0;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+/*
+ * - Nom de la fonction : _MEDfichierCreer
+ * - Description : creation d'un fichier HDF
+ * - Parametres :
+ * - nom (IN) : le nom du fichier
+ * - Resultat : ID du fichier en cas de succes, -1 sinon
+ */
+
+namespace med_2_1{
+
+med_idt
+_MEDfichierCreer(char *nom)
+{
+ med_idt fid,gid;
+ med_err ret;
+ med_int majeur = MED_NUM_MAJEUR;
+ med_int mineur = MED_NUM_MINEUR;
+ med_int release = MED_NUM_RELEASE;
+
+ /*
+ * On inhibe le gestionnaire d'erreur HDF 5
+ */
+ _MEDmodeErreurVerrouiller();
+
+ if ((fid = H5Fcreate(nom,H5F_ACC_TRUNC,
+ H5P_DEFAULT,H5P_DEFAULT)) < 0)
+ return -1;
+
+ if ((gid = _MEDdatagroupCreer(fid,MED_NOM_INFOS)) < 0)
+ return -1;
+
+ /* Numero de versions de MED */
+ if ((ret = _MEDattrEntierEcrire(gid,MED_NOM_MAJEUR,&majeur,MED_REMP)) < 0)
+ return -1;
+
+ if ((ret = _MEDattrEntierEcrire(gid,MED_NOM_MINEUR,&mineur,MED_REMP)) < 0)
+ return -1;
+
+ if ((ret = _MEDattrEntierEcrire(gid,MED_NOM_RELEASE,&release,MED_REMP)) < 0)
+ return -1;
+
+ /* On ferme tout */
+ if ((ret = _MEDdatagroupFermer(gid)) < 0)
+ return -1;
+
+ return fid;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+/*
+ * - Nom de la fonction : _MEDfichierFermer
+ * - Description : fermeture d'un fichier HDF
+ * - Parametres :
+ * - fid (IN) : ID du fichier
+ * - Resultat : 0 en cas de succes, -1 sinon
+ */
+
+namespace med_2_1{
+
+med_err
+_MEDfichierFermer(med_idt fid)
+{
+ med_err ret;
+
+ if ((ret = H5Fclose(fid)) < 0)
+ return -1;
+
+ return 0;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+/*
+ * - Nom de la fonction : _MEDfichierOuvrir
+ * - Description : ouverture d'un fichier HDF en fonction du mode passe
+ * en parametre
+ * - Parametres :
+ * - nom (IN) : le nom du fichier
+ * - mode (IN) : mode d'ouverture
+ * - Resultat : ID du fichier en cas de succes, -1 sinon
+ */
+
+namespace med_2_1{
+
+med_idt
+_MEDfichierOuvrir(char *nom,med_mode_acces mode)
+{
+ med_idt fid;
+ int hdf_mode;
+
+ switch(mode)
+ {
+ case MED_ECRI :
+ hdf_mode = H5F_ACC_RDWR;
+ break;
+
+ case MED_LECT :
+ hdf_mode = H5F_ACC_RDONLY;
+ break;
+
+ default :
+ return -1;
+ }
+
+ if ((fid = H5Fopen(nom,hdf_mode,H5P_DEFAULT)) < 0)
+ return -1;
+
+ return fid;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+namespace med_2_1{
+
+med_err
+MEDformatConforme(const char * nomfich)
+{
+
+ /*
+ * On inhibe le gestionnaire d'erreur
+ */
+ _MEDmodeErreurVerrouiller();
+
+
+ if ( H5Fis_hdf5(nomfich) > 0 )
+ return 0;
+ else
+ return -1;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include <string.h>
+
+/*
+ * Chaine C -> chaine FORTRAN completee par des blancs
+ */
+
+namespace med_2_1{
+
+med_err
+_MEDfstring(char *chaine, med_int longueur_fixee)
+{
+ int longueur_reelle, i;
+
+ if (longueur_fixee == 0 ) return 0;
+
+ longueur_reelle = strlen(chaine);
+ if (longueur_fixee < longueur_reelle)
+ return -1;
+
+ /* on supprime le caractere de fin de chaine C '\0'
+ et complete par des blancs */
+ for (i=longueur_reelle;i<longueur_fixee;i++)
+ *(chaine+i) = ' ';
+
+ return 0;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+namespace med_2_1{
+
+med_err
+MEDgridCr(med_idt fid, char *maillage, med_int dim, med_grid_type typ)
+{
+ med_idt maaid, root;
+ char chemin[MED_TAILLE_MAA+1];
+
+ /* On inhibe le gestionnaire d'erreur */
+ _MEDmodeErreurVerrouiller();
+
+ /* Si la racine n'existe pas on la cree */
+ strncpy(chemin, MED_MAA, strlen(MED_MAA)-1);
+ chemin[MED_TAILLE_MAA-1] = '\0';
+ if ((root = _MEDdatagroupOuvrir(fid, chemin)) < 0)
+ if ((root = _MEDdatagroupCreer(fid, chemin)) < 0)
+ return(-1);
+
+ /* si le maillage existe deja => erreur */
+ if (_MEDdatagroupOuvrir(root, maillage) > 0) {
+ return(-1);
+ };
+
+ /* Creation du Data Group */
+ maaid = _MEDdatagroupCreer(root, maillage);
+ if (maaid < 0) return(-1);
+
+ /* Creation de l'attribut dimension */
+ if (_MEDattrEntierEcrire(maaid, MED_NOM_DIM, &dim, MED_REMP) < 0) {
+ return(-1);
+ };
+
+ /* Creation de l'attribut grille */
+ if (_MEDattrEntierEcrire(maaid, MED_NOM_GRD, &typ, MED_REMP) < 0) {
+ return(-1);
+ };
+
+ /* Nettoyages divers */
+ if ( _MEDdatagroupFermer(maaid) < 0) return(-1);
+ if (_MEDdatagroupFermer(root) < 0) return(-1);
+ return(0);
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med_outils.hxx"
+#include "med.hxx"
+
+namespace med_2_1{
+
+med_err
+MEDgridEcr(med_idt fid, char *maa, med_int mdim, med_float *coo, med_int nb, med_int dim, med_mode_switch mode_coo,
+ med_repere repere, char *nomcoo, char *unicoo, med_mode_acces mode )
+{
+ /* ecriture des indices */
+
+ med_idt maaid, noeid, ds;
+ char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
+ med_size dimd[1];
+ char *dataset;
+ med_int type_rep_int;
+
+ /* On inhibe le gestionnaire d'erreur HDF */
+ _MEDmodeErreurVerrouiller();
+
+ /* Si le maillage n'existe pas => erreur */
+ strcpy(chemin, MED_MAA);
+ strcat(chemin, maa);
+ maaid = _MEDdatagroupOuvrir(fid, chemin);
+ if (maaid < 0) return(-1);
+
+ /* Si le Data Group "NOE" n'existe pas on le cree */
+ if ((noeid = _MEDdatagroupOuvrir(maaid, MED_NOM_NOE)) < 0) {
+ if ((noeid = _MEDdatagroupCreer(maaid, MED_NOM_NOE)) < 0) {
+ return(-1);
+ };
+ };
+
+ switch (dim) {
+ case 0 : {
+ dataset = MED_NOM_IN1;
+ break;
+ };
+ case 1 : {
+ dataset = MED_NOM_IN2;
+ break;
+ };
+ case 2 : {
+ dataset = MED_NOM_IN3;
+ break;
+ };
+ default : {
+ return(-1);
+ };
+ };
+
+ /* Creation du Data Set "IN1" ou "IN2" ou "IN3" */
+ dimd[0] = nb;
+ if (_MEDdatasetNumEcrire(noeid, dataset, MED_REEL64, mode_coo, 1, MED_ALL, MED_NOPF, 0, 0, dimd, (unsigned char*)coo, mode) < 0) {
+ return(-1);
+ };
+
+ /* On re-ouvre le Data Set "IN1" ou "IN2" ou "IN3" pour y placer des attributs */
+ if ((ds = _MEDdatasetOuvrir(noeid, dataset)) < 0) {
+ return(-1);
+ };
+
+ /* Attribut NBR (nombre de noeuds) */
+ if (_MEDattrEntierEcrire(ds, MED_NOM_NBR, &nb, mode) < 0) {
+ return(-1);
+ };
+
+ /* L'attribut "REP" */
+ type_rep_int = (med_int)repere;
+ if (_MEDattrEntierEcrire(ds, MED_NOM_REP, &type_rep_int, mode) < 0) {
+ return(-1);
+ };
+
+ /* Attribut "NOM" */
+ if (_MEDattrStringEcrire(ds, MED_NOM_NOM, mdim*MED_TAILLE_PNOM, nomcoo, mode) < 0) {
+ return(-1);
+ };
+
+ /* Attribut "UNI" */
+ if (_MEDattrStringEcrire(ds, MED_NOM_UNI, mdim*MED_TAILLE_PNOM, unicoo, mode) < 0) {
+ return(-1);
+ };
+
+ /* On ferme tout */
+ if (_MEDdatasetFermer(ds) < 0) return(-1);
+ if (_MEDdatagroupFermer(noeid) < 0) return(-1);
+ if (_MEDdatagroupFermer(maaid) < 0) return(-1);
+ return(0);
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+#include <string.h>
+#include <stdlib.h>
+
+namespace med_2_1{
+
+med_err
+MEDgridInfo(med_idt fid, int indice, med_int *isAGrid, med_grid_type *typ)
+{
+ int numero;
+ med_idt maaid;
+ char maillage[MED_TAILLE_NOM+1];
+ char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
+
+ /* On inhibe le gestionnaire d'erreur */
+ _MEDmodeErreurVerrouiller();
+
+ /* On recupere le nom du groupe de rang "indice" */
+ numero = indice-1;
+ if (_MEDobjetIdentifier(fid, MED_MAA, numero, maillage) < 0) {
+ return(-1);
+ };
+
+ /* On va chercher l'attribut dimension */
+ strcpy(chemin, MED_MAA);
+ strcat(chemin, maillage);
+ maaid = _MEDdatagroupOuvrir(fid, chemin);
+ if (maaid < 0) return(-1);
+
+ if (_MEDattrEntierLire(maaid, MED_NOM_GRD, typ) < 0) {
+ *isAGrid = 0;
+ } else {
+ *isAGrid = 1;
+ };
+
+ if (_MEDdatagroupFermer(maaid) < 0) return(-1);
+ return(0);
+}
+
+}
--- /dev/null
+#include "med_outils.hxx"
+#include "med.hxx"
+
+namespace med_2_1{
+
+med_err
+MEDgridLire(med_idt fid, char *maa, med_int mdim, med_float *coo, med_int dim, med_mode_switch mode_coo,
+ med_repere *repere, char *nomcoo, char *unicoo )
+{
+ med_idt maaid, noeid, ds;
+ char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
+ char *dataset;
+ med_int type_rep_int;
+
+ /* On inhibe le gestionnaire d'erreur */
+ _MEDmodeErreurVerrouiller();
+
+ /* Si le maillage n'existe pas => erreur */
+ strcpy(chemin, MED_MAA);
+ strcat(chemin, maa);
+ maaid = _MEDdatagroupOuvrir(fid, chemin);
+ if (maaid < 0) return(-1);
+
+ /* Si le Data Group "NOE" n'existe pas => erreur */
+ noeid = _MEDdatagroupOuvrir(maaid, MED_NOM_NOE);
+ if (noeid < 0) return(-1);
+
+ switch (dim) {
+ case 0 : {
+ dataset = MED_NOM_IN1;
+ break;
+ };
+ case 1 : {
+ dataset = MED_NOM_IN2;
+ break;
+ };
+ case 2 : {
+ dataset = MED_NOM_IN3;
+ break;
+ };
+ default : {
+ return(-1);
+ };
+ };
+
+ /* Lecture du Data Set "IN1" ou "IN2" ou "IN3" */
+ if (_MEDdatasetNumLire(noeid, dataset, MED_REEL64, mode_coo, 1, MED_ALL, MED_NOPF, 0, 1, (unsigned char*)coo) < 0) {
+ return(-1);
+ };
+
+ /* On re-ouvre le Data Set precedant pour y lire des attributs */
+ ds = _MEDdatasetOuvrir(noeid, dataset);
+ if (ds < 0) return(-1);
+
+ /* L'attribut "REP" */
+ if (_MEDattrEntierLire(ds, MED_NOM_REP, &type_rep_int) < 0) {
+ return(-1);
+ } else {
+ *repere = (med_repere)type_rep_int;
+ };
+
+ /* Attribut "NOM" */
+ if (_MEDattrStringLire(ds, MED_NOM_NOM, mdim*MED_TAILLE_PNOM, nomcoo) < 0) {
+ return(-1);
+ };
+
+ /* Attribut "UNI" */
+ if (_MEDattrStringLire(ds, MED_NOM_UNI, mdim*MED_TAILLE_PNOM, unicoo) < 0) {
+ return(-1);
+ };
+
+ /* On ferme tout */
+ if (_MEDdatasetFermer(ds) < 0) {
+ return(-1);
+ };
+ if (_MEDdatagroupFermer(noeid) < 0) {
+ return(-1);
+ };
+ if (_MEDdatagroupFermer(maaid) < 0) {
+ return(-1);
+ };
+ return(0);
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "med.hxx"
+
+/***********************************************************************
+ * FONCTION MEDgro2famA
+ *
+ * - DESCRIPTION : 1ere etape dans la conversion des groupes de noeuds
+ * et d'elements en familles MED.
+ * Calcul des tailles des tableaux que l'on devra allouer pour
+ * stocker les familles qui seront construites par MEDgro2famB().
+ * Les parametres renvoyes sont :
+ * 1 - le nombre de familles MED a creer (nfamg)
+ * 2 - le nombre de noms groupes associes a l'ensemble des familles
+ * MED (nindf)
+ * Ces parametres doivent permettre a l'appelant de creer les tables
+ * suivantes :
+ * 1 - une table des noms des groupes propres a chaque famille,
+ * de taille : nindf*MED_TAILLE_LNOM+1
+ * 2 - une table d'index donnant pour chaque famille son numero d'indice
+ * dans la table des noms, de taille : nfamg+1
+ * 3 - une table destinee a contenir la liste des numeros de familles
+ * a creer, de taille : nfamg
+ *
+ * - PARAMETRES :
+ * NOM .E/S. TYPE . DESCRIPTION
+ * -------------------------------------------------------------------
+ * nnoe .E . med_int . nombre de noeuds
+ * nele .E . med_int . nombre d'elements
+ * numnoe .E . med_int*. numeros des noeuds
+ * numele .E . med_int*. numeros des elements
+ * ngn .E . med_int . nombre de groupes de noeuds
+ * nge .E . med_int . nombre de groupes d'elements
+ * nindn .E . med_int . nombre d'indices dans la table
+ * . . . des groupes de noeuds
+ * ninde .E . med_int . nombre d'indices dans la table
+ * . . . de groupes d'elements
+ * indgronoe .E . int* . table index de la table des groupes
+ * . . . de noeuds
+ * indgroele .E . int* . table index de la table des groupes
+ * . . . d'elements
+ * tabgronoe .E . med_int*. table des groupes de noeuds
+ * tabgroele .E . med_int*. table des groupes d'elements
+ * nfamg . S. med_int*. nombre de familles MED a creer
+ * nidnf . S. med_int*. nombre de noms groupes associes a
+ * . . . l'ensemble des familles MED
+ *
+ * - RESULTAT : 0 si succes, -1 sinon
+ *
+ ***********************************************************************/
+
+namespace med_2_1{
+
+med_err
+MEDgro2famA (med_int nnoe,med_int nele,med_int *numnoe,med_int *numele,
+ med_int ngn,med_int nge,med_int nindn,
+ med_int ninde,int *indgronoe,int *indgroele,med_int *tabgronoe,
+ med_int *tabgroele,med_int *nfamg,med_int *nindf)
+{
+ int i,j,k;
+ int *famnoe,*famele,*tmp;
+ int *p;
+ int flag, num,exist;
+ int nfamn, nfame;
+ int fam01 = 0;
+ int fam02 = 0;
+
+ /* initialisations */
+ famnoe = NULL;
+ famele = NULL;
+
+ *nfamg = 0;
+ *nindf = 0;
+ nfamn = 0;
+ nfame = 0;
+
+ if ((ngn > 0) || (nge > 0))
+ {
+ /* pour chaque noeud :
+ 1 - on dresse la liste des groupes de noeuds auquel il appartient
+ 2 - en la comparant avec les listes pre-existantes, on
+ estime s'il est necessaire de creer une nouvelle famille de noeuds.
+ Si oui => on incremente le compteur local nfamn (nombre de familles
+ de noeuds)
+ on incremente le parametre nindf du nombre de groupes
+ que devra compter cette famille de noeuds
+ Si non => on ne fait rien */
+ for (i=0;i<nnoe;i++)
+ {
+ if ((tmp = (int*) malloc(sizeof(int)*ngn)) == NULL)
+ return -1;
+ num = *(numnoe+i);
+ for (j=0;j<ngn;j++)
+ {
+ flag = 0;
+ /* on regarde si le noeud appartient au groupe */
+ for (k=0;k<*(indgronoe+j+1)-*(indgronoe+j);k++)
+ if (num == *(tabgronoe+*(indgronoe+j)+k))
+ flag = 1;
+ /* on met le flag a jour dans tmp */
+ *(tmp+j) = flag;
+ }
+ /* on note la creation de la famille 0 */
+ if (fam01 == 0)
+ {
+ flag = 1;
+ for (j=0;j<ngn;j++)
+ if (*(tmp+j) == 1)
+ flag = 0;
+ if (flag == 1)
+ fam01 = 1;
+ }
+ /* faut-il creer une nouvelle famille ? */
+ if (famnoe == NULL)
+ {
+ exist = 0;
+ if ((famnoe = (int *) malloc (sizeof(int)*ngn)) == NULL)
+ return -1;
+ for (j=0;j<ngn;j++)
+ {
+ *(famnoe+j) = *(tmp+j);
+ if (*(famnoe+j) == 1)
+ *nindf = *nindf + 1;
+ }
+ nfamn = 1;
+ }
+ else
+ {
+ for (j=0;j<nfamn;j++)
+ {
+ p = famnoe + ngn*j;
+ for (k=0;k<ngn;k++)
+ {
+ if (*(p+k) != *(tmp+k))
+ {
+ exist = 0;
+ break;
+ }
+ else
+ exist = 1;
+ }
+ if (exist == 1)
+ break;
+ }
+ if (exist == 0)
+ {
+ nfamn = nfamn + 1;
+ p = famnoe;
+ if ((famnoe = (int*) malloc(sizeof(int)*ngn*nfamn)) == NULL)
+ return -1;
+ for (j=0;j<nfamn-1;j++)
+ for (k=0;k<ngn;k++)
+ *(famnoe+j*ngn+k) = *(p+j*ngn+k);
+ free(p);
+ p = famnoe+(nfamn-1)*ngn;
+ for (j=0;j<ngn;j++)
+ {
+ *(p+j) = *(tmp+j);
+ if (*(p+j) == 1)
+ *nindf = *nindf + 1;
+ }
+ }
+ }
+ free(tmp);
+ }
+
+ /* pour chaque element : idem que pour les noeuds */
+ for (i=0;i<nele;i++)
+ {
+ if ((tmp = (int*) malloc(sizeof(int)*nge)) == NULL)
+ return -1;
+ num = *(numele+i);
+ for (j=0;j<nge;j++)
+ {
+ flag = 0;
+ /* on regarde si l'element appartient au groupe */
+ for (k=0;k<*(indgroele+j+1)-*(indgroele+j);k++)
+ if (num == *(tabgroele+*(indgroele+j)+k))
+ flag = 1;
+ /* on met le flag a jour dans tmp */
+ *(tmp+j) = flag;
+ }
+ /* on note la creation de la famille 0 */
+ if (fam02 == 0)
+ {
+ flag = 1;
+ for (j=0;j<nge;j++)
+ if (*(tmp+j) == 1)
+ flag = 0;
+ if (flag == 1)
+ fam02 = 1;
+ }
+ /* faut-il creer une nouvelle famille ? */
+ if (famele == NULL)
+ {
+ exist = 0;
+ if ((famele = (int *) malloc (sizeof(int)*nge)) == NULL)
+ return -1;
+ for (j=0;j<nge;j++)
+ {
+ *(famele+j) = *(tmp+j);
+ if (*(famele+j) == 1)
+ *nindf = *nindf + 1;
+ }
+ nfame = 1;
+ }
+ else
+ {
+ for (j=0;j<nfame;j++)
+ {
+ p = famele + nge*j;
+ for (k=0;k<nge;k++)
+ {
+ if (*(p+k) != *(tmp+k))
+ {
+ exist = 0;
+ break;
+ }
+ else
+ exist = 1;
+ }
+ if (exist == 1)
+ break;
+ }
+ if (exist == 0)
+ {
+ nfame = nfame + 1;
+ p = famele;
+ if ((famele = (int*) malloc(sizeof(int)*nge*nfame)) == NULL)
+ return -1;
+ for (j=0;j<nfame-1;j++)
+ for (k=0;k<nge;k++)
+ *(famele+j*nge+k) = *(p+j*nge+k);
+ free(p);
+ p = famele+(nfame-1)*nge;
+ for (j=0;j<nge;j++)
+ {
+ *(p+j) = *(tmp+j);
+ if (*(p+j) == 1)
+ *nindf = *nindf + 1;
+ }
+ }
+ }
+ free(tmp);
+ }
+
+ /* la famille 0 existe pour les noeuds et les elements, on
+ ne la compte qu'une fois */
+ if (fam01 && fam02)
+ nfamn = nfamn - 1;
+
+ /* le nombre de familles a creer est egal au nombre de familles
+ de noeuds + nombre de familles d'elements */
+ *nfamg = nfamn + nfame;
+
+
+ /* Nettoyage memoire */
+ free(famnoe);
+ free(famele);
+ }
+ else
+ {
+ /* on a aucun groupes de noeuds ou d'elements */
+ *nfamg = 1; /* on a au moins la famille 0 */
+ *nindf = 0;
+ }
+
+ return 0;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "med.hxx"
+
+/***********************************************************************
+ * FONCTION MEDgro2famB
+ *
+ * - DESCRIPTION : 2eme etape dans la conversion des groupes de noeuds
+ * et d'elements en familles MED
+ * Mise a jour des tables suivantes passees en parametres :
+ * 1 - les nouveaux numeros des familles a creer
+ * 2 - les nouveaux numeros des familles des elements
+ * 3 - les nouveaux numeros des familles des noeuds
+ * 4 - les noms des groupes composant ces familles
+ * 5 - les index de la table des groupes
+ *
+ * - PARAMETRES :
+ * NOM .E/S. TYPE . DESCRIPTION
+ * -------------------------------------------------------------------
+ * nnoe .E . med_int . nombre de noeuds
+ * nele .E . med_int . nombre d'elements
+ * numnoe .E . med_int*. numeros des noeuds
+ * numele .E . med_int*. numeros des elements
+ * ngn .E . med_int . nombre de groupes de noeuds
+ * nge .E . med_int . nombre de groupes d'elements
+ * nindn .E . med_int . nombre d'indices dans la table
+ * . . . des groupes de noeuds
+ * ninde .E . med_int . nombre d'indices dans la table
+ * . . . de groupes d'elements
+ * nomgronoe .E . char* . noms des groupes de noeuds
+ * nomgroele .E . char* . noms des groupes d'elements
+ * indgronoe .E . int* . table index de la table des groupes
+ * . . . de noeuds
+ * indgroele .E . int* . table index de la table des groupes
+ * . . . d'elements
+ * tabgronoe .E . int* . table des groupes de noeuds
+ * tabgroele .E . int* . table des groupes d'elements
+ * nfamg .E . med_int . nombre de familles MED a creer
+ * nidnf .E . med_int . nombre de noms groupes associes a
+ * . . . l'ensemble des familles MED
+ * newnumfam . S. med_int*. nouveaux numeros de familles
+ * newnumfamele . S. med_int*. nouveaux numeros de familles des
+ * . . . elements
+ * newnumfamnoe . S. med_int*. nouveaux numeros de familles des
+ * . . . noeuds
+ * newindfamgro . S. int* . table des index de la table des
+ * . . . noms de groupes associes aux familles
+ * newfamgro . . char* . table des noms des groupes des
+ * . . . familles
+ *
+ * - RESULTAT : 0
+ *
+ ***********************************************************************/
+
+namespace med_2_1{
+
+med_err
+MEDgro2famB (med_int nnoe,med_int nele,med_int *numnoe,med_int *numele,
+ med_int ngn,med_int nge,med_int nindn,
+ med_int ninde, char *nomgronoe,char *nomgroele,
+ int *indgronoe,int *indgroele,med_int *tabgronoe,
+ med_int *tabgroele,med_int nfamg,med_int nindf,
+ med_int *newnumfam,med_int *newnumfamele,
+ med_int *newnumfamnoe,int *newindfamgro,
+ char *newfamgro)
+{
+ int i,j,k;
+
+ med_int *famnoe, *famele, *tmp;
+ med_int *p;
+ med_int num;
+ int flag,exist;
+ int nfamn, nfame;
+ int estfam0 = 1;
+ int newnumnoe, newnumele;
+ int tmp1;
+ int existfam0 = 0;
+ int ind = 0;
+
+ famnoe = NULL;
+ famele = NULL;
+
+ nfamn = 0;
+ nfame = 0;
+ newnumnoe = 0;
+ newnumele = 0;
+
+ *newindfamgro = 0;
+
+ if (nfamg > 1)
+ {
+ /* pour chaque noeud :
+ 1 - on dresse la liste des groupes de noeuds auquel il appartient
+ 2 - en la comparant avec les listes pre-existantes, on
+ estime s'il est necessaire de creer une nouvelle famille de noeuds.
+ Si oui => - on cree le numero de famille que l'on reporte
+ dans newnumfam
+ - on reporte ce numero dans newnumnoe
+ - on met a jour la table des noms des groupes des familles
+ ainsi que sa table d'index
+ Si non => on ne fait rien
+ ATTENTION : pour la famille 0, on ne met a jour que les numeros */
+ for (i=0;i<nnoe;i++)
+ {
+ if ((tmp = (med_int*) malloc(sizeof(med_int)*ngn)) == NULL)
+ return -1;
+ num = *(numnoe+i);
+ for (j=0;j<ngn;j++)
+ {
+ flag = 0;
+ /* on regarde si le noeud appartient au groupe */
+ for (k=0;k<*(indgronoe+j+1)-*(indgronoe+j);k++)
+ if (num == *(tabgronoe+*(indgronoe+j)+k))
+ flag = 1;
+ /* on met le flag a jour dans tmp */
+ *(tmp+j) = flag;
+ }
+ /* on regarde si le numero de famille est 0 */
+ estfam0 = 0;
+ flag = 1;
+ for (j=0;j<ngn;j++)
+ if (*(tmp+j) == 1)
+ flag = 0;
+ if (flag == 1)
+ {
+ estfam0 = 1;
+ *(newnumfamnoe+i) = 0;
+ }
+ if (flag == 1 && existfam0 == 0)
+ existfam0 = 1;
+ /* faut-il creer une nouvelle famille ? */
+ if (famnoe == NULL)
+ {
+ exist = 0;
+ if ((famnoe = (med_int *) malloc (sizeof(med_int)*ngn)) == NULL)
+ return -1;
+ /* on met a jour la table d'indices */
+ nfamn = 1;
+ *(newindfamgro+nfamn) = *(newindfamgro+nfamn-1);
+ for (j=0;j<ngn;j++)
+ {
+ tmp1 = *(tmp+j);
+ *(famnoe+j) = tmp1;
+ if (tmp1 == 1)
+ {
+ strncpy(newfamgro+*(newindfamgro+nfamn),
+ nomgronoe+j*MED_TAILLE_LNOM,MED_TAILLE_LNOM);
+ *(newindfamgro+nfamn) = *(newindfamgro+nfamn) +
+ MED_TAILLE_LNOM;
+ }
+ }
+ if (estfam0 == 0)
+ {
+ newnumnoe = 1;
+ *newnumfamnoe = newnumnoe;
+ *newnumfam = newnumnoe;
+ }
+ else
+ *newnumfam = 0;
+ }
+ else
+ {
+ for (j=0;j<nfamn;j++)
+ {
+ p = famnoe + ngn*j;
+ for (k=0;k<ngn;k++)
+ {
+ if (*(p+k) != *(tmp+k))
+ {
+ exist = 0;
+ break;
+ }
+ else
+ exist = 1;
+ }
+ if (exist == 1)
+ {
+ if (estfam0 == 0)
+ *(newnumfamnoe+i) = *(newnumfam+j);
+ break;
+ }
+ }
+ if (exist == 0)
+ {
+ nfamn = nfamn + 1;
+ *(newindfamgro+nfamn) = *(newindfamgro+nfamn-1);
+ p = famnoe;
+ if ((famnoe = (med_int*) malloc(sizeof(med_int)*ngn*nfamn))
+ == NULL)
+ return -1;
+ for (j=0;j<nfamn-1;j++)
+ for (k=0;k<ngn;k++)
+ *(famnoe+j*ngn+k) = *(p+j*ngn+k);
+ free(p);
+ p = famnoe+(nfamn-1)*ngn;
+ for (j=0;j<ngn;j++)
+ {
+ tmp1 = *(tmp+j);
+ *(p+j) = tmp1;
+ if (tmp1 == 1)
+ {
+ strncpy(newfamgro+*(newindfamgro+nfamn),
+ nomgronoe+j*MED_TAILLE_LNOM,MED_TAILLE_LNOM);
+ *(newindfamgro+nfamn) = *(newindfamgro + nfamn)
+ + MED_TAILLE_LNOM;
+ }
+ }
+ if (estfam0 == 0)
+ {
+ newnumnoe = newnumnoe + 1;
+ *(newnumfamnoe+i) = newnumnoe;
+ *(newnumfam+nfamn-1) = newnumnoe;
+ }
+ else
+ *(newnumfam+nfamn-1) = 0;
+ }
+ }
+ free(tmp);
+ }
+
+ /* pour chaque element :
+ 1 - on dresse la liste des groupes de noeuds auquel il appartient
+ 2 - en la comparant avec les listes pre-existantes, on
+ estime s'il est necessaire de creer une nouvelle famille d'elements.
+ Si oui => - on cree le numero de famille que l'on reporte
+ dans newnumfam
+ - on reporte ce numero dans newnumele
+ - on met a jour la table des noms des groupes des familles
+ ainsi que sa table d'index
+ Si non => on ne fait rien
+ ATTENTION : pour la famille 0, on ne met a jour que les numeros */
+ for (i=0;i<nele;i++)
+ {
+ if ((tmp = (med_int*) malloc(sizeof(med_int)*nge)) == NULL)
+ return -1;
+ num = *(numele+i);
+ for (j=0;j<nge;j++)
+ {
+ flag = 0;
+ /* on regarde si l'element appartient au groupe */
+ for (k=0;k<*(indgroele+j+1)-*(indgroele+j);k++)
+ if (num == *(tabgroele+*(indgroele+j)+k))
+ flag = 1;
+ /* on met le flag a jour dans tmp */
+ *(tmp+j) = flag;
+ }
+ /* on regarde si le numero de famille est 0 */
+ estfam0 = 0;
+ flag = 1;
+ for (j=0;j<nge;j++)
+ if (*(tmp+j) == 1)
+ flag = 0;
+ if (flag == 1)
+ {
+ estfam0 = 1;
+ *(newnumfamele+i) = 0;
+ }
+ /* faut-il creer une nouvelle famille ? */
+ if (famele == NULL)
+ {
+ if (!(estfam0&&existfam0))
+ {
+ exist = 0;
+ if ((famele = (med_int *) malloc (sizeof(med_int)*nge))
+ == NULL)
+ return -1;
+ nfame = 1;
+ *(newindfamgro+nfamn+nfame) = *(newindfamgro+nfamn+nfame-1);
+ for (j=0;j<nge;j++)
+ {
+ tmp1 = *(tmp+j);
+ *(famele+j) = tmp1;
+ if (tmp1 == 1)
+ {
+ strncpy(newfamgro+*(newindfamgro+nfamn+nfame),
+ nomgroele+j*MED_TAILLE_LNOM,MED_TAILLE_LNOM);
+ *(newindfamgro+nfamn+nfame) = *(newindfamgro+nfamn+nfame)
+ + MED_TAILLE_LNOM;
+ }
+ }
+ if (estfam0 == 0)
+ {
+ newnumele = -1;
+ *(newnumfamele+i) = newnumele;
+ *(newnumfam+nfamn+nfame-1) = newnumele;
+ }
+ else
+ {
+ newnumele = 0;
+ *(newnumfam+nfamn+nfame-1) = newnumele;
+ existfam0 = 1;
+ }
+ }
+ }
+ else
+ {
+ for (j=0;j<nfame;j++)
+ {
+ p = famele + nge*j;
+ for (k=0;k<nge;k++)
+ {
+ if (*(p+k) != *(tmp+k))
+ {
+ exist = 0;
+ break;
+ }
+ else
+ exist = 1;
+ }
+ if (exist == 1)
+ {
+ if (estfam0 == 0)
+ *(newnumfamele+i) = *(newnumfam+nfamn+j);
+ break;
+ }
+ }
+ if (exist == 0 && !(estfam0 && existfam0))
+ /* on cree une nouvelle famille */
+ {
+ nfame = nfame + 1;
+ *(newindfamgro+nfamn+nfame) = *(newindfamgro+nfamn+nfame-1);
+ p = famele;
+ if ((famele = (med_int*) malloc(sizeof(med_int)*nge*nfame))
+ == NULL)
+ return -1;
+ for (j=0;j<nfame-1;j++)
+ for (k=0;k<nge;k++)
+ *(famele+j*nge+k) = *(p+j*nge+k);
+ free(p);
+ p = famele+(nfame-1)*nge;
+ for (j=0;j<nge;j++)
+ {
+ tmp1 = *(tmp+j);
+ *(p+j) = tmp1;
+ if (tmp1 == 1)
+ {
+ strncpy((newfamgro+*(newindfamgro+nfamn+nfame)),
+ nomgroele+j*MED_TAILLE_LNOM,MED_TAILLE_LNOM);
+ *(newindfamgro+nfamn+nfame) =
+ *(newindfamgro+nfamn+nfame) + MED_TAILLE_LNOM;
+ }
+ }
+ if (estfam0 == 0)
+ {
+ newnumele = newnumele - 1;
+ *(newnumfamele+i) = newnumele;
+ *(newnumfam+nfamn+nfame-1) = newnumele;
+ }
+ else
+ if (existfam0 == 0)
+ {
+ *(newnumfam+nfamn+nfame-1) = 0;
+ existfam0 =1;
+ }
+ }
+ }
+ free(tmp);
+ }
+
+ *(newfamgro+MED_TAILLE_LNOM*nindf) = '\0';
+
+ free(famnoe);
+ free(famele);
+ }
+ else
+ {
+ *newnumfam = 0;
+ for (i=0;i<nele;i++)
+ *(newnumfamele+i) = 0;
+ for (i=0;i<nnoe;i++)
+ *(newnumfamnoe+i) = 0;
+ }
+
+ return 0;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+/*
+ * - Nom de la fonction : _MEDindiceInfo
+ * - Description : en argument de H5Giterate, donne le nom
+ * de l'objet HDF (data set ou data group)
+ * contenu dans l'objet HDF passe en argument
+ * - Parametres :
+ * - id (IN) : l'ID de l'objet HDF
+ * - nom (OUT) : le nom recupere
+ * - donnees (OUT) : tampon
+ * - Resultat : 1 en cas de succes, -1 sinon
+ */
+
+namespace med_2_1{
+
+med_err
+_MEDindiceInfo(med_idt id, const char *nom, void *donnees)
+{
+ if (donnees != NULL)
+ strcpy((char*)donnees,nom);
+ else
+ return -1;
+
+ return 1;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+/*
+ * - Nom de la fonction : _MEDindiceNum
+ * - Description : en argument de H5Giterate, donne le nombre
+ * d'objets HDF (data set ou data group)
+ * contenu dans l'objet HDF passe en argument
+ * - Parametres :
+ * - id (IN) : l'ID de l'objet HDF
+ * - nom (OUT) : le nom du sous-objet
+ * - donnees (OUT) : tampon
+ * - Resultat : le nombre d'objets en cas de succes, -1 sinon
+ */
+
+namespace med_2_1{
+
+med_err
+_MEDindiceNum(med_idt id,const char *nom, void *donnees)
+{
+ int *compteur;
+
+ compteur = (int *) donnees;
+ (*compteur)++;
+
+ return 0;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include "med_outils.hxx"
+#include <string.h>
+
+namespace med_2_1{
+
+med_int
+MEDlFichDes(med_idt fid)
+{
+ med_idt attr, root;
+ med_err ret=0;
+ char des[MED_TAILLE_DESC+1];
+ med_int longueur=0;
+ char nom[MED_TAILLE_NOM+1];
+ char chemin[MED_TAILLE_MAA+1];
+
+ /*
+ * On inhibe le gestionnaire d'erreur HDF
+ */
+ _MEDmodeErreurVerrouiller();
+
+ /*
+ * On ouvre le Data Group racine
+ */
+ strncpy(chemin,MED_MAA,MED_TAILLE_MAA-1);
+ chemin[MED_TAILLE_MAA-1] = '\0';
+ if ((root = _MEDdatagroupOuvrir(fid,chemin)) < 0)
+ return -1;
+
+ /*
+ * On regarde si l'attribut existe
+ * Si non => erreur
+ * Si oui => on retourne sa longueur
+ */
+ strcpy(nom,MED_NOM_DESCRIPTEUR);
+
+ if ((attr = _MEDattrOuvrir(root,nom)) < 0) {
+ _MEDdatagroupFermer(root);
+ longueur=0;
+ return 0;
+ }
+
+ if ((ret = _MEDattrFermer(attr)) < 0) {
+ _MEDdatagroupFermer(root);
+ return -1;
+ }
+
+ if ((ret = _MEDattrStringLire(root,nom,MED_TAILLE_DESC,des)) < 0) {
+ _MEDdatagroupFermer(root);
+ return -1;
+ }
+
+ longueur = strlen(des);
+
+ /*
+ * fermetures
+ */
+ if ((ret == _MEDdatagroupFermer(root)) < 0)
+ return -1;
+
+ return longueur;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+#include <string.h>
+#include <stdlib.h>
+
+namespace med_2_1{
+
+med_err
+MEDmaaCr(med_idt fid, char *maillage, med_int dim)
+{
+ med_idt maaid, root;
+ char chemin[MED_TAILLE_MAA+1];
+ med_err ret;
+
+ /*
+ * On inhibe le gestionnaire d'erreur
+ */
+ _MEDmodeErreurVerrouiller();
+
+ /*
+ * Si la racine n'existe pas on la cree
+ */
+ strncpy(chemin,MED_MAA,strlen(MED_MAA)-1);
+ chemin[MED_TAILLE_MAA-1] = '\0';
+ if ((root = _MEDdatagroupOuvrir(fid,chemin)) < 0)
+ if ((root = _MEDdatagroupCreer(fid,chemin)) < 0)
+ return -1;
+
+ /*
+ * si le maillage existe deja => erreur
+ */
+ if ((maaid = _MEDdatagroupOuvrir(root,maillage)) > 0)
+ return -1;
+
+ /*
+ * Creation du Data Group
+ */
+ if ((maaid = _MEDdatagroupCreer(root,maillage)) < 0)
+ return -1;
+
+ /*
+ * Creation de l'attribut dimension
+ */
+ if ((ret = _MEDattrEntierEcrire(maaid,MED_NOM_DIM,&dim,MED_REMP)) < 0)
+ return -1;
+
+ /*
+ * Nettoyages divers
+ */
+ if ((ret = _MEDdatagroupFermer(maaid)) < 0)
+ return -1;
+ if ((ret = _MEDdatagroupFermer(root)) < 0)
+ return -1;
+
+ return 0;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+#include <string.h>
+#include <stdlib.h>
+
+namespace med_2_1{
+
+med_err
+MEDmaaInfo(med_idt fid, int indice, char *maillage, med_int *dim)
+{
+ int numero;
+ med_idt maaid;
+ med_err ret;
+ char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
+
+ /*
+ * On inhibe le gestionnaire d'erreur
+ */
+ _MEDmodeErreurVerrouiller();
+
+ /*
+ * On recupere le nom du groupe de rang "indice"
+ */
+ numero = indice-1;
+ if ((ret = _MEDobjetIdentifier(fid,MED_MAA,numero,maillage)) < 0)
+ return -1;
+
+ /*
+ * On va chercher l'attribut dimension
+ */
+ strcpy(chemin,MED_MAA);
+ strcat(chemin,maillage);
+ if ((maaid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
+ return -1;
+ if ((ret = _MEDattrEntierLire(maaid,MED_NOM_DIM,dim)) < 0)
+ return -1;
+ if ((ret = _MEDdatagroupFermer(maaid)) < 0)
+ return -1;
+
+ return 0;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+/*
+ * - Nom de la fonction : _MEDmodeErreurVerrouiller
+ * - Description : inhibe le mode erreur HDF5
+ * - Parametres : aucun
+ * - Resultat : aucun
+ */
+
+namespace med_2_1{
+
+void
+_MEDmodeErreurVerrouiller()
+{
+ H5Eset_auto(NULL,NULL);
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include <string.h>
+#include <stdlib.h>
+#include "med_outils.hxx"
+
+namespace med_2_1{
+
+med_int
+MEDnChamp(med_idt fid, int indice)
+{
+ int n1;
+ med_int n2;
+ med_idt datagroup;
+ med_err ret;
+ char nomdatagroup[MED_TAILLE_NOM+1];
+ int num;
+ char chemin[MED_TAILLE_CHA+MED_TAILLE_NOM+1];
+
+ if (indice < 0)
+ return -1;
+
+ /*
+ * On inhibe le gestionnaire d'erreur HDF
+ */
+ _MEDmodeErreurVerrouiller();
+
+ /*
+ * Si le Data Group cha n'existe pas et indice == 0 => 0
+ * sinon erreur => erreur
+ */
+ strcpy(chemin,MED_CHA);
+
+ /*
+ * Si indice == 0 => nombre de champs
+ */
+ if (indice == 0)
+ {
+ n1 = 0;
+ _MEDnObjets(fid,chemin,&n1);
+ n2 = n1;
+ }
+
+ /*
+ * Si indice > 0 => nbre de composants
+ */
+ if (indice > 0)
+ {
+ /*
+ * On recupere le nom du champ
+ */
+ num = indice-1;
+ if ((ret = _MEDobjetIdentifier(fid,chemin,num,nomdatagroup)) < 0)
+ return -1;
+ strcat(chemin,nomdatagroup);
+ /*
+ * On recupere le nombre de composants
+ */
+ if ((datagroup = _MEDdatagroupOuvrir(fid,chemin)) < 0)
+ return -1;
+ if ((ret = _MEDattrEntierLire(datagroup,MED_NOM_NCO,&n2)) < 0)
+ return -1;
+ if ((ret = _MEDdatagroupFermer(datagroup)) < 0)
+ return -1;
+ }
+
+ return n2;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+#include <string.h>
+#include <stdlib.h>
+
+namespace med_2_1{
+
+med_int
+MEDnCorres(med_idt fid,char *maa,char *eq,med_entite_maillage typ_ent,
+ med_geometrie_element typ_geo)
+{
+ med_idt eqid, datagroup;
+ med_err ret;
+ char chemin[MED_TAILLE_MAA+MED_TAILLE_EQS+2*MED_TAILLE_NOM+1];
+ char nomdatagroup[MED_TAILLE_NOM+1];
+ char tmp[MED_TAILLE_NOM_ENTITE+1];
+ med_int n;
+
+ if (typ_geo == MED_TETRA4 || typ_geo == MED_TETRA10 ||
+ typ_geo == MED_HEXA8 || typ_geo == MED_HEXA20 ||
+ typ_geo == MED_PENTA6 || typ_geo == MED_PENTA15 ||
+ typ_geo == MED_PYRA5 || typ_geo == MED_PYRA13)
+ return -1;
+
+ /*
+ * On inhibe le gestionnaire d'erreur HDF 5
+ */
+ _MEDmodeErreurVerrouiller();
+
+ /*
+ * Si le Data Group de "eq" n'existe pas => erreur
+ */
+ strcpy(chemin,MED_MAA);
+ strcat(chemin,maa);
+ strcat(chemin,MED_EQS);
+ strcat(chemin,eq);
+ if ((eqid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
+ return -1;
+ if ((ret = _MEDnomEntite(nomdatagroup,typ_ent)) < 0)
+ return -1;
+ if ((typ_ent != MED_NOEUD))
+ {
+ if ((ret = _MEDnomGeometrie(tmp,typ_geo)) < 0)
+ return -1;
+ strcat(nomdatagroup,".");
+ strcat(nomdatagroup,tmp);
+ }
+ if ((datagroup = _MEDdatagroupOuvrir(eqid,nomdatagroup)) < 0)
+ return 0;
+ if ((ret = _MEDattrEntierLire(datagroup,MED_NOM_NBR,&n)) < 0)
+ return -1;
+
+ /*
+ * On ferme tout
+ */
+ if ((ret = _MEDdatagroupFermer(datagroup)) < 0)
+ return -1;
+ if ((ret = _MEDdatagroupFermer(eqid)) < 0)
+ return -1;
+
+ return n;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+#include <string.h>
+#include <stdlib.h>
+
+namespace med_2_1{
+
+med_int
+MEDnEntMaa(med_idt fid, char *maa, med_table quoi, med_entite_maillage type_ent,
+ med_geometrie_element type_geo, med_connectivite type_conn)
+{
+ med_idt root, maaid, entid,geoid, dataset=0;
+ med_err ret;
+ char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
+ char nom_ent[MED_TAILLE_NOM_ENTITE+1];
+ char nom_geo[MED_TAILLE_NOM_ENTITE+1];
+ char nom_dataset[MED_TAILLE_NOM_ENTITE+1];
+ med_int res = 0;
+
+ /*
+ * On inhibe le gestionnaire d'erreur HDF 5
+ */
+ _MEDmodeErreurVerrouiller();
+
+ /*
+ * Si le maillage n'existe pas => erreur
+ */
+ strcpy(chemin,MED_MAA);
+ strcat(chemin,maa);
+ if ((maaid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
+ return -1;
+
+ /*
+ * On met a jour le nom du Data Group representant
+ * le type des entites
+ */
+ if ((ret = _MEDnomEntite(nom_ent,type_ent)) < 0)
+ return -1;
+
+ /*
+ * Si le Data Group des entites n'existe pas => res = 0
+ */
+ entid = _MEDdatagroupOuvrir(maaid,nom_ent);
+
+ /*
+ * Pour les mailles, les faces et le aretes
+ * si le Data Group du type geometrique n'existe pas => res = 0
+ */
+ if ((type_ent==MED_MAILLE)||(type_ent==MED_FACE)||(type_ent==MED_ARETE))
+ {
+ if ((ret = _MEDnomGeometrie(nom_geo,type_geo)) < 0)
+ return -1;
+ geoid = _MEDdatagroupOuvrir(entid,nom_geo);
+ }
+ else
+ geoid = -1;
+
+ /*
+ * Ouverture du Data Set renvoye par _MEDnomDataset()
+ * S'il n'existe pas => erreur
+ * Sinon lecture de l'attribut NBR
+ */
+ if (geoid == -1)
+ root = entid;
+ else
+ root = geoid;
+ if ((ret = _MEDnomDataset(nom_dataset,quoi,type_conn)) < 0)
+ return -1;
+ dataset = _MEDdatasetOuvrir(root,nom_dataset);
+ if (dataset > 0)
+ if ((ret = _MEDattrEntierLire(dataset,MED_NOM_NBR,&res)) < 0)
+ return -1;
+
+ /*
+ * On ferme tout
+ */
+ if (dataset > 0)
+ if ((ret = _MEDdatasetFermer(dataset)) < 0)
+ return -1;
+ if (geoid > 0)
+ if ((ret = _MEDdatagroupFermer(geoid)) < 0)
+ return -1;
+ if (entid > 0)
+ if ((ret = _MEDdatagroupFermer(entid)) < 0)
+ return -1;
+ if ((ret = _MEDdatagroupFermer(maaid)) < 0)
+ return -1;
+
+ return res;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+
+namespace med_2_1{
+
+med_int
+MEDnEntites(med_idt fid,char *maa,med_entite_maillage typ_ent,
+ med_connectivite typ_con)
+{
+ med_int total = 0;
+ int i;
+ med_geometrie_element typ_mai[MED_NBR_GEOMETRIE_MAILLE] = {MED_POINT1,MED_SEG2,
+ MED_SEG3,MED_TRIA3,
+ MED_TRIA6,MED_QUAD4,
+ MED_QUAD8,MED_TETRA4,
+ MED_TETRA10,MED_HEXA8,
+ MED_HEXA20,MED_PENTA6,
+ MED_PENTA15,MED_PYRA5,
+ MED_PYRA13};
+ med_geometrie_element typ_fac[MED_NBR_GEOMETRIE_FACE] = {MED_TRIA3,MED_TRIA6,
+ MED_QUAD4,MED_QUAD8};
+ med_geometrie_element typ_are[MED_NBR_GEOMETRIE_ARETE] = {MED_SEG2,MED_SEG3};
+
+ switch (typ_ent)
+ {
+ case MED_MAILLE :
+ for (i=0;i<MED_NBR_GEOMETRIE_MAILLE;i++)
+ total += MEDnEntMaa(fid,maa,MED_CONN,MED_MAILLE,typ_mai[i],typ_con);
+ break;
+
+ case MED_FACE :
+ for (i=0;i<MED_NBR_GEOMETRIE_FACE;i++)
+ total += MEDnEntMaa(fid,maa,MED_CONN,MED_FACE,typ_fac[i],typ_con);
+ break;
+
+ case MED_ARETE :
+ for (i=0;i<MED_NBR_GEOMETRIE_ARETE;i++)
+ total += MEDnEntMaa(fid,maa,MED_CONN,MED_ARETE,typ_are[i],typ_con);
+ break;
+
+ case MED_NOEUD :
+ total = MEDnEntMaa(fid,maa,MED_COOR,MED_NOEUD,(med_geometrie_element)0,(med_connectivite)0);
+ break;
+
+ default :
+ total = -1;
+ }
+
+ return total;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+#include <string.h>
+#include <stdlib.h>
+
+namespace med_2_1{
+
+med_int
+MEDnEquiv(med_idt fid, char *maa)
+{
+ char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+MED_TAILLE_EQS+1];
+ int n;
+
+ /*
+ * On inhibe le gestionnaire d'erreur HDF 5
+ */
+ _MEDmodeErreurVerrouiller();
+
+ strcpy(chemin,MED_MAA);
+ strcat(chemin,maa);
+ strcat(chemin,MED_EQS);
+ n = 0;
+ _MEDnObjets(fid,chemin,&n);
+
+ return (med_int) n;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+#include <string.h>
+#include <stdlib.h>
+
+namespace med_2_1{
+
+med_int
+MEDnFam(med_idt fid,char *maa, int indice, med_dim_famille quoi)
+{
+ med_idt datagroup,famid;
+ med_err ret;
+ char chemin[MED_TAILLE_MAA+MED_TAILLE_FAS+2*MED_TAILLE_NOM+1];
+ med_int n;
+ int n_tmp;
+ int num;
+ char famille[MED_TAILLE_NOM+1];
+
+
+ /*
+ * On inhibe le gestionnaire d'erreur HDF
+ */
+ _MEDmodeErreurVerrouiller();
+
+ strcpy(chemin,MED_MAA);
+ strcat(chemin,maa);
+ strcat(chemin,MED_FAS);
+ if (indice == 0)
+ {
+ n_tmp = 0;
+ _MEDnObjets(fid,chemin,&n_tmp);
+ n = (med_int ) n_tmp;
+ }
+ else
+ {
+ /*
+ * On recupere le nom de la famille
+ */
+ num = indice - 1;
+ if ((ret = _MEDobjetIdentifier(fid,chemin,num,
+ famille)) < 0)
+ return -1;
+
+ /*
+ * Si le Data Group de la famille n'existe pas => erreur
+ */
+ strcat(chemin,famille);
+ if ((famid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
+ return -1;
+
+ switch (quoi)
+ {
+ case MED_GROUPE :
+ if ((datagroup = _MEDdatagroupOuvrir(famid,MED_NOM_GRO)) < 0)
+ n = 0;
+ else
+ {
+ if ((ret = _MEDattrEntierLire(datagroup,MED_NOM_NBR,&n)) < 0)
+ return -1;
+ if ((ret = _MEDdatagroupFermer(datagroup)) < 0)
+ return -1;
+ }
+ break;
+
+ case MED_ATTR :
+ if ((datagroup = _MEDdatagroupOuvrir(famid,MED_NOM_ATT)) < 0)
+ n = 0;
+ else
+ {
+ if ((ret = _MEDattrEntierLire(datagroup,MED_NOM_NBR,&n)) < 0)
+ return -1;
+ if ((ret = _MEDdatagroupFermer(datagroup)) < 0)
+ return -1;
+ }
+ break;
+
+ default :
+ return -1;
+ }
+
+ if ((ret = _MEDdatagroupFermer(famid)) < 0)
+ return -1;
+
+ }
+
+ return (med_int) n;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+namespace med_2_1{
+
+med_int
+MEDnGrid(med_idt fid, char *maa, med_grid n)
+{
+ med_idt maaid, entid, geoid, dataset;
+ char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
+ char nom_ent[MED_TAILLE_NOM_ENTITE+1];
+ char *nom_dataset;
+ med_int res = (-1);
+
+ /* On inhibe le gestionnaire d'erreur HDF 5 */
+ _MEDmodeErreurVerrouiller();
+
+ /* Si le maillage n'existe pas => erreur */
+ strcpy(chemin, MED_MAA);
+ strcat(chemin, maa);
+ maaid = _MEDdatagroupOuvrir(fid, chemin);
+ if (maaid < 0) return(-1);
+
+ switch (n) {
+ case MED_FAM_NOEUD : {
+ nom_dataset = MED_NOM_FAM;
+ if (_MEDnomEntite(nom_ent, MED_NOEUD) < 0) return(-1);
+ entid = _MEDdatagroupOuvrir(maaid, nom_ent);
+ break;
+ };
+ case MED_FAM_ARETE : {
+ nom_dataset = MED_NOM_FAM;
+ if (_MEDnomEntite(nom_ent, MED_ARETE) < 0) return(-1);
+ geoid = _MEDdatagroupOuvrir(maaid, nom_ent);
+ if (geoid < 0) return(-1);
+ if (_MEDnomGeometrie(nom_ent, MED_SEG2) < 0) return(-1);
+ entid = _MEDdatagroupOuvrir(geoid, nom_ent);
+ break;
+ };
+ case MED_FAM_FACE : {
+ nom_dataset = MED_NOM_FAM;
+ if (_MEDnomEntite(nom_ent, MED_FACE) < 0) return(-1);
+ geoid = _MEDdatagroupOuvrir(maaid, nom_ent);
+ if (geoid < 0) return(-1);
+ if (_MEDnomGeometrie(nom_ent, MED_QUAD4) < 0) return(-1);
+ entid = _MEDdatagroupOuvrir(geoid, nom_ent);
+ break;
+ };
+ case MED_FAM_MAILLE : {
+ nom_dataset = MED_NOM_FAM;
+ if (_MEDnomEntite(nom_ent, MED_MAILLE) < 0) return(-1);
+ geoid = _MEDdatagroupOuvrir(maaid, nom_ent);
+ if (geoid < 0) return(-1);
+ if (_MEDnomGeometrie(nom_ent, MED_HEXA8) < 0) return(-1);
+ entid = _MEDdatagroupOuvrir(geoid, nom_ent);
+ break;
+ };
+ case MED_GRID_NOEUD : {
+ nom_dataset = MED_NOM_BOF;
+ entid = _MEDdatagroupOuvrir(maaid, MED_NOM_NOE);
+ break;
+ };
+ case MED_GRID_D1 : {
+ nom_dataset = MED_NOM_IN1;
+ entid = _MEDdatagroupOuvrir(maaid, MED_NOM_NOE);
+ break;
+ };
+ case MED_GRID_D2 : {
+ nom_dataset = MED_NOM_IN2;
+ entid = _MEDdatagroupOuvrir(maaid, MED_NOM_NOE);
+ break;
+ };
+ case MED_GRID_D3 : {
+ nom_dataset = MED_NOM_IN3;
+ entid = _MEDdatagroupOuvrir(maaid, MED_NOM_NOE);
+ break;
+ };
+ default : {
+ return(-1);
+ };
+ };
+
+ if (entid < 0) return(-1);
+ dataset = _MEDdatasetOuvrir(entid, nom_dataset);
+ if (dataset < 0) return(-1);
+ if (_MEDattrEntierLire(dataset, MED_NOM_NBR, &res) < 0) return(-1);
+
+ /* On ferme tout */
+ if (_MEDdatasetFermer(dataset) < 0) return(-1);
+ if (_MEDdatagroupFermer(entid) < 0) return(-1);
+ if (_MEDdatagroupFermer(maaid) < 0) return(-1);
+
+ return(res);
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+#include <string.h>
+
+namespace med_2_1{
+
+med_int
+MEDnMaa(med_idt fid)
+{
+ int n;
+
+ _MEDmodeErreurVerrouiller();
+
+ n = 0;
+ _MEDnObjets(fid,MED_MAA,&n);
+
+ return (med_int) n;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+/*
+ * - Nom de la fonction : _MEDnObjets
+ * - Description : indique le nombre d'objets HDF contenu dans le
+ * datagroup passe en argument
+ * - Parametres :
+ * - fid (IN) : l'ID du fichier HDF
+ * - chemin (IN) : chemin d'acces au datagroup
+ * - n (OUT) : le nombre recherche
+ * - Resultat : 0 en cas de succes, -1 sinon
+ */
+
+namespace med_2_1{
+
+med_err
+_MEDnObjets(med_idt fid,char *chemin,int *n)
+{
+ int idx;
+
+ if ((idx = H5Giterate(fid,chemin,NULL,_MEDindiceNum,(void *)n)) < 0)
+ return -1;
+
+ return 0;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+#include <string.h>
+#include <stdlib.h>
+
+/*
+ * Nombre de Couple (PDT,NOR) pour le champ <cha>
+ */
+
+namespace med_2_1{
+
+med_int
+MEDnPasdetemps(med_idt fid,char *cha,med_entite_maillage type_ent,
+ med_geometrie_element type_geo)
+
+{
+ med_err ret;
+ int n1;
+ char nomdatagroup1[MED_TAILLE_NOM+1];
+ char tmp1 [MED_TAILLE_NOM_ENTITE+1];
+ char chemin [MED_TAILLE_CHA+(MED_TAILLE_NOM+1)+MED_TAILLE_NOM+1];
+
+ /*
+ * On inhibe le gestionnaire d'erreur HDF 5
+ */
+ _MEDmodeErreurVerrouiller();
+
+ /*
+ * Creation du chemin d'accès aux différents (PDT,NOR) pour les différents <type_ent>[.<type_geo>]
+ */
+ strcpy(chemin,MED_CHA);
+ strcat(chemin,cha);
+ strcat(chemin,"/");
+
+ if ((ret = _MEDnomEntite(nomdatagroup1,type_ent)) < 0)
+ return -1;
+ if ((type_ent != MED_NOEUD))
+ {
+ if ((ret = _MEDnomGeometrie(tmp1,type_geo)) < 0)
+ return -1;
+ strcat(nomdatagroup1,".");
+ strcat(nomdatagroup1,tmp1);
+ }
+ strcat(chemin,nomdatagroup1);
+
+ n1 =0;
+ _MEDnObjets(fid,chemin,&n1);
+
+ return (med_int) n1;
+
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+namespace med_2_1{
+
+med_int
+MEDnProfil(med_idt fid)
+{
+ int n;
+ med_err ret;
+
+ _MEDmodeErreurVerrouiller();
+
+ n = 0;
+ _MEDnObjets(fid,MED_PROFILS,&n);
+
+ return (med_int) n;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include <string.h>
+#include <stdlib.h>
+#include "med_outils.hxx"
+
+namespace med_2_1{
+
+med_int
+MEDnVal(med_idt fid, char *champ, med_entite_maillage type_ent,
+ med_geometrie_element type_geo,med_int numdt, med_int numo)
+{
+ med_int n;
+ med_idt datagroup;
+ med_err ret;
+ char nomdatagroup1[2*MED_TAILLE_NOM_ENTITE+2],nomdatagroup2[2*MED_MAX_PARA+1];
+ char tmp1 [MED_TAILLE_NOM_ENTITE+1];
+ char chemin [MED_TAILLE_CHA+(MED_TAILLE_NOM+1)+(2*MED_TAILLE_NOM_ENTITE+2)+(2*MED_MAX_PARA)+1+100];
+
+ /*
+ * On inhibe le gestionnaire d'erreur HDF
+ */
+ _MEDmodeErreurVerrouiller();
+
+ /*
+ * On cree le chemin d'accès
+ */
+ strcpy(chemin,MED_CHA);
+ strcat(chemin,champ);
+ strcat(chemin,"/");
+
+ /* On cree le nom du datagroup de niveau 1 */
+ if ((ret = _MEDnomEntite(nomdatagroup1,type_ent)) < 0)
+ return -1;
+ if ((type_ent != MED_NOEUD))
+ {
+ if ((ret = _MEDnomGeometrie(tmp1,type_geo)) < 0)
+ return -1;
+ strcat(nomdatagroup1,".");
+ strcat(nomdatagroup1,tmp1);
+ }
+ strcat(chemin,nomdatagroup1);
+ strcat(chemin,"/");
+
+ /* Creation du datagroup de niveau 2 <numdt>.<numoo> */
+ sprintf(nomdatagroup2,"%*li%*li",MED_MAX_PARA,(long ) numdt,MED_MAX_PARA,(long ) numo);
+ strcat(chemin,nomdatagroup2);
+
+ /*
+ * Acces au champ
+ */
+ if ((datagroup = _MEDdatagroupOuvrir(fid,chemin)) < 0)
+ return 0;
+ if ((ret = _MEDattrEntierLire(datagroup,MED_NOM_NBR,&n)) < 0)
+ return -1;
+
+ /*
+ * fermetures
+ */
+ if ((ret = _MEDdatagroupFermer(datagroup)) < 0)
+ return -1;
+
+ return n;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+#include <string.h>
+#include <stdlib.h>
+
+namespace med_2_1{
+
+med_int
+MEDnValProfil(med_idt fid, char *nom)
+{
+ med_int n = 0;
+ med_idt pid;
+ char chemin[MED_TAILLE_PROFILS+MED_TAILLE_NOM+1];
+ med_err ret;
+
+ /*
+ * On inhibe le gestionnaire d'erreur HDF 5
+ */
+ _MEDmodeErreurVerrouiller();
+
+ /*
+ * ouverture du groupe /PROFILS/"nom"
+ */
+ strcpy(chemin,MED_PROFILS);
+ strcat(chemin,nom);
+ if ((pid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
+ return -1;
+
+ if ((ret = _MEDattrEntierLire(pid,MED_NOM_N,&n)) < 0)
+ return ret;
+
+ /*
+ * On ferme tout
+ */
+ if ((ret = _MEDdatagroupFermer(pid)) < 0)
+ return -1;
+
+ return n;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+#include <string.h>
+#include <stdlib.h>
+
+namespace med_2_1{
+
+med_err
+MEDnbnoisEcr(med_idt fid, char *nom_maillage,med_int n)
+{
+ med_idt maaid;
+ char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
+ med_err ret;
+
+ /*
+ * On inhibe le gestionnaire d'erreur HDF
+ */
+ _MEDmodeErreurVerrouiller();
+
+ /*
+ * Si le maillage n'existe pas => erreur
+ */
+ strcpy(chemin,MED_MAA);
+ strcat(chemin,nom_maillage);
+ if ((maaid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
+ return -1;
+
+ /*
+ * Creation de l'attribut "Nombre de Noeuds Isoles"
+ */
+ if ((ret = _MEDattrEntierEcrire(maaid,MED_NOM_NNI,&n,MED_REMP)) < 0)
+ return -1;
+
+ /*
+ * Fermetures des objets
+ */
+ if ((ret = _MEDdatagroupFermer(maaid)) < 0)
+ return -1;
+
+ return 0;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+#include <string.h>
+#include <stdlib.h>
+
+namespace med_2_1{
+
+med_int
+MEDnbnoisLire(med_idt fid,char *nom_maillage)
+{
+ med_idt maaid;
+ med_err ret;
+ char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
+ med_int n;
+
+ /*
+ * On inhibe le gestionnaire d'erreur
+ */
+ _MEDmodeErreurVerrouiller();
+
+ /*
+ * On regarde si le maillage existe => erreur si non
+ */
+ strcpy(chemin,MED_MAA);
+ strcat(chemin,nom_maillage);
+ if ((maaid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
+ return -1;
+
+ /*
+ * On va lire l'attribut "NNI"
+ */
+ if ((ret = _MEDattrEntierLire(maaid,MED_NOM_NNI,&n)) < 0)
+ return -1;
+
+ /*
+ * Fermetures des objets HDF
+ */
+ if ((ret = _MEDdatagroupFermer(maaid)) < 0)
+ return -1;
+
+ return n;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+#include <string.h>
+#include <stdlib.h>
+
+namespace med_2_1{
+
+med_err
+MEDnbnomaEcr(med_idt fid, char *nom_maillage,med_int n)
+{
+ med_idt maaid;
+ char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
+ med_err ret;
+
+ /*
+ * On inhibe le gestionnaire d'erreur
+ */
+ _MEDmodeErreurVerrouiller();
+
+ /*
+ * Si le maillage n'existe pas => erreur
+ */
+ strcpy(chemin,MED_MAA);
+ strcat(chemin,nom_maillage);
+ if ((maaid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
+ return -1;
+
+ /*
+ * Creation de l'attribut "Nombre de Noeuds Max par maille"
+ */
+ if ((ret = _MEDattrEntierEcrire(maaid,MED_NOM_NNM,&n,MED_REMP)) < 0)
+ return -1;
+
+ /*
+ * Nettoyages divers
+ */
+ if ((ret = _MEDdatagroupFermer(maaid)) < 0)
+ return -1;
+
+ return 0;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+#include <string.h>
+#include <stdlib.h>
+
+namespace med_2_1{
+
+med_int
+MEDnbnomaLire(med_idt fid,char *nom_maillage)
+{
+ med_idt maaid;
+ med_err ret;
+ char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
+ med_int n;
+
+ /*
+ * On inhibe le gestionnaire d'erreur HDF
+ */
+ _MEDmodeErreurVerrouiller();
+
+ /*
+ * On regarde si le maillage existe => erreur si non
+ */
+ strcpy(chemin,MED_MAA);
+ strcat(chemin,nom_maillage);
+ if ((maaid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
+ return -1;
+
+ /*
+ * On va lire l'attribut "NNM"
+ */
+ if ((ret = _MEDattrEntierLire(maaid,MED_NOM_NNM,&n)) < 0)
+ return -1;
+
+ /*
+ * Fermetures des objets HDF
+ */
+ if ((ret = _MEDdatagroupFermer(maaid)) < 0)
+ return -1;
+
+ return n;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+#include <string.h>
+#include <stdlib.h>
+
+namespace med_2_1{
+
+med_err
+MEDnbnosoEcr(med_idt fid, char *nom_maillage,med_int n)
+{
+ med_idt maaid;
+ char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
+ med_err ret;
+
+ /*
+ * On inhibe le gestionnaire d'erreur HDF
+ */
+ _MEDmodeErreurVerrouiller();
+
+ /*
+ * Si le maillage n'existe pas => erreur
+ */
+ strcpy(chemin,MED_MAA);
+ strcat(chemin,nom_maillage);
+ if ((maaid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
+ return -1;
+
+ /*
+ * Creation de l'attribut "Nombre de Noeuds Sommets"
+ */
+ if ((ret = _MEDattrEntierEcrire(maaid,MED_NOM_NNS,&n,MED_REMP)) < 0)
+ return -1;
+
+ /*
+ * Fermetures
+ */
+ if ((ret = _MEDdatagroupFermer(maaid)) < 0)
+ return -1;
+
+ return 0;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med_outils.hxx"
+#include "med.hxx"
+
+#include <string.h>
+#include <stdlib.h>
+
+namespace med_2_1{
+
+med_int
+MEDnbnosoLire(med_idt fid,char *nom_maillage)
+{
+ med_idt maaid;
+ med_err ret;
+ char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
+ med_int n;
+
+ /*
+ * On inhibe le gestionnaire d'erreur
+ */
+ _MEDmodeErreurVerrouiller();
+
+ /*
+ * On regarde si le maillage existe => erreur si non
+ */
+ strcpy(chemin,MED_MAA);
+ strcat(chemin,nom_maillage);
+ if ((maaid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
+ return -1;
+
+ /*
+ * On va lire l'attribut "NNS"
+ */
+ if ((ret = _MEDattrEntierLire(maaid,MED_NOM_NNS,&n)) < 0)
+ return -1;
+
+ /*
+ * Fermetures des objets HDF
+ */
+ if ((ret = _MEDdatagroupFermer(maaid)) < 0)
+ return -1;
+
+ return n;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+
+namespace med_2_1{
+
+med_err
+MEDnoeudsEcr(med_idt fid,char *maa,med_int mdim,med_float *coord,
+ med_mode_switch mode_coo,
+ med_repere repere,char *nomcoo, char *unicoo,char *nom,
+ med_booleen inom,med_int *num,med_booleen inum,med_int *fam,
+ med_int nnoeuds,med_mode_acces mode)
+{
+ med_err ret;
+
+ /* ecriture des coordonnees */
+ if ((ret = MEDcoordEcr(fid,maa,mdim,coord,mode_coo,
+ nnoeuds,mode,repere,nomcoo,
+ unicoo)) < 0)
+ return -1;
+
+ /* ecriture des noms (facultatifs) */
+ if (inom == MED_VRAI)
+ if ((ret = MEDnomEcr(fid,maa,nom,nnoeuds,mode,MED_NOEUD,MED_POINT1)) < 0)
+ return -1;
+
+ /* ecriture des numeros (facultatifs) */
+ if (inum == MED_VRAI)
+ if ((ret = MEDnumEcr(fid,maa,num,nnoeuds,mode,MED_NOEUD,MED_POINT1)) < 0)
+ return -1;
+
+ /* ecriture des numeros de familles */
+ if ((ret = MEDfamEcr(fid,maa,fam,nnoeuds,mode,MED_NOEUD,MED_POINT1)) < 0)
+ return -1;
+
+ return 0;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+
+#include "med.hxx"
+
+namespace med_2_1{
+
+med_err
+MEDnoeudsLire(med_idt fid,char *maa,med_int mdim, med_float *coord,
+ med_mode_switch mode_coo,
+ med_repere *repere,char *nomcoo, char *unicoo,char *nom,
+ med_booleen *inom,med_int *num,med_booleen *inum,med_int *fam,
+ med_int nnoeuds)
+{
+ med_err ret;
+
+ /* lecture des coordonnees */
+ if ((ret = MEDcoordLire(fid,maa,mdim,coord,mode_coo,MED_ALL,0,MED_NOPF,repere,nomcoo,
+ unicoo)) < 0)
+ return -1;
+
+ /* lecture des noms (facultatifs) */
+ if ((ret = MEDnomLire(fid,maa,nom,nnoeuds,MED_NOEUD,MED_POINT1)) < 0)
+ *inom = MED_FAUX;
+ else
+ *inom = MED_VRAI;
+
+ /* lecture des numeros (facultatifs) */
+ if ((ret = MEDnumLire(fid,maa,num,nnoeuds,MED_NOEUD,MED_POINT1)) < 0)
+ *inum = MED_FAUX;
+ else
+ *inum = MED_VRAI;
+
+ /* lecture des numeros de familles */
+ if ((ret = MEDfamLire(fid,maa,fam,nnoeuds,MED_NOEUD,MED_POINT1)) < 0)
+ return -1;
+
+ return 0;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+/*
+ * - Nom de la fonction : _MEDnomDataset
+ * - Description : fournit un nom de dataset
+ * - Parametres :
+ * - nom_dataset (OUT) : le nom du data set
+ * - quoi (IN) : le type de table MED
+ * - type_conn (IN) : le type de connectivite
+ * - Resultat : 0 en cas de succes, -1 sinon
+ */
+
+namespace med_2_1{
+
+med_err
+_MEDnomDataset(char *nom_dataset,med_table quoi,med_connectivite type_conn)
+{
+ switch(quoi)
+ {
+ case MED_COOR :
+ strcpy(nom_dataset,MED_NOM_COO);
+ break;
+
+ case MED_CONN :
+ switch(type_conn)
+ {
+ case MED_NOD :
+ strcpy(nom_dataset,MED_NOM_NOD);
+ break;
+
+ case MED_DESC :
+ strcpy(nom_dataset,MED_NOM_DES);
+ break;
+
+ default :
+ return -1;
+ }
+ break;
+
+ case MED_NOM :
+ strcpy(nom_dataset,MED_NOM_NOM);
+ break;
+
+ case MED_NUM :
+ strcpy(nom_dataset,MED_NOM_NUM);
+ break;
+
+ case MED_FAM :
+ strcpy(nom_dataset,MED_NOM_FAM);
+ break;
+
+ default :
+ return -1;
+ }
+
+ return 0;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+#include <stdlib.h>
+#include <string.h>
+
+namespace med_2_1{
+
+med_err
+MEDnomEcr(med_idt fid,char *maa, char *nom, med_int n, med_mode_acces mode,
+ med_entite_maillage type_ent,med_geometrie_element type_geo)
+{
+ med_idt root, maaid, entid, geoid, dataset;
+ med_err ret;
+ med_size dimd[1];
+ char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
+ char nom_ent[MED_TAILLE_NOM_ENTITE+1];
+ char nom_geo[MED_TAILLE_NOM_ENTITE+1];
+
+ /*
+ * On inhibe le gestionnaire d'erreur HDF 5
+ */
+ _MEDmodeErreurVerrouiller();
+
+ /*
+ * Si le maillage n'existe pas => erreur
+ */
+ strcpy(chemin,MED_MAA);
+ strcat(chemin,maa);
+ if ((maaid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
+ return -1;
+
+ /*
+ * On met a jour le nom du Data Group representant
+ * le type des entites
+ */
+ if ((ret = _MEDnomEntite(nom_ent,type_ent)) < 0)
+ return -1;
+
+ /*
+ * Si le Data Group des entites n'existe pas on le cree
+ */
+ if ((entid = _MEDdatagroupOuvrir(maaid,nom_ent)) < 0)
+ if ((entid = _MEDdatagroupCreer(maaid,nom_ent)) < 0)
+ return -1;
+
+ /*
+ * Pour les mailles, les faces et le aretes, on cree
+ * s'il n'existe pas le Data Group du type geometrique
+ */
+ if ((type_ent==MED_MAILLE)||(type_ent==MED_FACE)||(type_ent==MED_ARETE))
+ {
+ if ((ret = _MEDnomGeometrie(nom_geo,type_geo)) < 0)
+ return -1;
+
+ if ((geoid = _MEDdatagroupOuvrir(entid,nom_geo)) < 0)
+ if ((geoid = _MEDdatagroupCreer(entid,nom_geo)) < 0)
+ return -1;
+ }
+ else
+ geoid = -1;
+
+ /*
+ * Creation du Data Set "NOM"
+ */
+ if (geoid == -1)
+ root = entid;
+ else
+ root = geoid;
+ dimd[0] = n*MED_TAILLE_PNOM+1;
+ if ((ret = _MEDdatasetStringEcrire(root,MED_NOM_NOM,dimd,nom,mode)) < 0)
+ return -1;
+
+ /*
+ * Attribut NBR (nombre de noeuds)
+ */
+ if ((dataset = _MEDdatasetOuvrir(root,MED_NOM_NOM)) < 0)
+ return -1;
+ if ((ret = _MEDattrEntierEcrire(dataset,MED_NOM_NBR,&n,mode)) < 0)
+ return -1;
+
+ /*
+ * On ferme tout
+ */
+ if ((ret = _MEDdatasetFermer(dataset)) < 0)
+ return -1;
+ if (geoid > 0)
+ if ((ret = _MEDdatagroupFermer(geoid)) < 0)
+ return -1;
+ if ((ret = _MEDdatagroupFermer(entid)) < 0)
+ return -1;
+ if ((ret = _MEDdatagroupFermer(maaid)) < 0)
+ return -1;
+
+ return 0;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+/*
+ * - Nom de la fonction : _MEDnomEntite
+ * - Description : fournit le nom associe a un type d'entite MED
+ * - Parametres :
+ * - nom_ent (OUT) : le nom de l'entite
+ * - type_ent (IN) : le type de l'entite
+ * - Resultat : 0 en cas de succes, -1 sinon
+ */
+
+namespace med_2_1{
+
+med_err
+_MEDnomEntite(char *nom_ent,med_entite_maillage type_ent)
+{
+ switch(type_ent)
+ {
+ case MED_NOEUD :
+ strcpy(nom_ent,MED_NOM_NOE);
+ break;
+
+ case MED_MAILLE :
+ strcpy(nom_ent,MED_NOM_MAI);
+ break;
+
+ case MED_FACE :
+ strcpy(nom_ent,MED_NOM_FAC);
+ break;
+
+ case MED_ARETE :
+ strcpy(nom_ent,MED_NOM_ARE);
+ break;
+
+ default :
+ return -1;
+ }
+ return 0;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+/*
+ * - Nom de la fonction : _MEDnomGeometrie
+ * - Description : fournit le nom de l'element geometrique associe
+ * au type geometrique MED
+ * - Parametres :
+ * - nom_geo (OUT) : le nom de l'element
+ * - type_geo (IN) : le type de l'element
+ * - Resultat : 0 en cas de succes, -1 sinon
+ */
+
+namespace med_2_1{
+
+med_err
+_MEDnomGeometrie(char *nom_geo,med_geometrie_element type_geo)
+{
+ switch (type_geo)
+ {
+ case MED_POINT1 :
+ strcpy(nom_geo,MED_NOM_PO1);
+ break;
+
+ case MED_SEG2 :
+ strcpy(nom_geo,MED_NOM_SE2);
+ break;
+
+ case MED_SEG3 :
+ strcpy(nom_geo,MED_NOM_SE3);
+ break;
+
+ case MED_TRIA3 :
+ strcpy(nom_geo,MED_NOM_TR3);
+ break;
+
+ case MED_TRIA6 :
+ strcpy(nom_geo,MED_NOM_TR6);
+ break;
+
+ case MED_QUAD4 :
+ strcpy(nom_geo,MED_NOM_QU4);
+ break;
+
+ case MED_QUAD8 :
+ strcpy(nom_geo,MED_NOM_QU8);
+ break;
+
+ case MED_TETRA4 :
+ strcpy(nom_geo,MED_NOM_TE4);
+ break;
+
+ case MED_TETRA10 :
+ strcpy(nom_geo,MED_NOM_T10);
+ break;
+
+ case MED_HEXA8 :
+ strcpy(nom_geo,MED_NOM_HE8);
+ break;
+
+ case MED_HEXA20 :
+ strcpy(nom_geo,MED_NOM_H20);
+ break;
+
+ case MED_PENTA6 :
+ strcpy(nom_geo,MED_NOM_PE6);
+ break;
+
+ case MED_PENTA15 :
+ strcpy(nom_geo,MED_NOM_P15);
+ break;
+
+ case MED_PYRA5 :
+ strcpy(nom_geo,MED_NOM_PY5);
+ break;
+
+ case MED_PYRA13 :
+ strcpy(nom_geo,MED_NOM_P13);
+ break;
+
+ default :
+ return -1;
+ }
+
+ return 0;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+#include <stdlib.h>
+#include <string.h>
+
+namespace med_2_1{
+
+med_err
+MEDnomLire(med_idt fid,char *maa, char *nom, med_int n,
+ med_entite_maillage type_ent,med_geometrie_element type_geo)
+{
+ med_idt root, maaid, entid, geoid;
+ med_err ret;
+ char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
+ char nom_ent[MED_TAILLE_NOM_ENTITE+1];
+ char nom_geo[MED_TAILLE_NOM_ENTITE+1];
+
+ /*
+ * On inhibe le gestionnaire d'erreur HDF 5
+ */
+ _MEDmodeErreurVerrouiller();
+
+ /*
+ * Si le maillage n'existe pas => erreur
+ */
+ strcpy(chemin,MED_MAA);
+ strcat(chemin,maa);
+ if ((maaid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
+ return -1;
+
+ /*
+ * On met a jour le nom du Data Group representant
+ * le type des entites
+ */
+ if ((ret = _MEDnomEntite(nom_ent,type_ent)) < 0)
+ return -1;
+
+ /*
+ * Si le Data Group des entites n'existe pas => erreur
+ */
+ if ((entid = _MEDdatagroupOuvrir(maaid,nom_ent)) < 0)
+ return -1;
+
+ /*
+ * Pour les mailles, les faces et le aretes,
+ * on ouvre le Data Group du type geometrique
+ */
+ if ((type_ent==MED_MAILLE)||(type_ent==MED_FACE)||(type_ent==MED_ARETE))
+ {
+ if ((ret = _MEDnomGeometrie(nom_geo,type_geo)) < 0)
+ return -1;
+ if ((geoid = _MEDdatagroupOuvrir(entid,nom_geo)) < 0)
+ return -1;
+ }
+ else
+ geoid = -1;
+
+ /*
+ * lecture du Data Set "NOM"
+ */
+ if (geoid == -1)
+ root = entid;
+ else
+ root = geoid;
+ if ((ret = _MEDdatasetStringLire(root,MED_NOM_NOM,nom)) < 0)
+ return -1;
+
+ /*
+ * On ferme tout
+ */
+ if (geoid > 0)
+ if ((ret = _MEDdatagroupFermer(geoid)) < 0)
+ return -1;
+ if ((ret = _MEDdatagroupFermer(entid)) < 0)
+ return -1;
+ if ((ret = _MEDdatagroupFermer(maaid)) < 0)
+ return -1;
+
+ return 0;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+#include <stdlib.h>
+#include <string.h>
+
+namespace med_2_1{
+
+med_err
+MEDnumEcr(med_idt fid,char *maa, med_int *num, med_int n, med_mode_acces mode,
+ med_entite_maillage type_ent,med_geometrie_element type_geo)
+{
+ med_idt root, maaid, entid, geoid, dataset;
+ med_err ret;
+ med_size dimd[1];
+ char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
+ char nom_ent[MED_TAILLE_NOM_ENTITE+1];
+ char nom_geo[MED_TAILLE_NOM_ENTITE+1];
+
+ /*
+ * On inhibe le gestionnaire d'erreur HDF 5
+ */
+ _MEDmodeErreurVerrouiller();
+
+ /*
+ * Si le maillage n'existe pas => erreur
+ */
+ strcpy(chemin,MED_MAA);
+ strcat(chemin,maa);
+ if ((maaid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
+ return -1;
+
+ /*
+ * On met a jour le nom du Data Group representant
+ * le type des entites
+ */
+ if ((ret = _MEDnomEntite(nom_ent,type_ent)) < 0)
+ return -1;
+
+ /*
+ * Si le Data Group des entites n'existe pas on le cree
+ */
+ if ((entid = _MEDdatagroupOuvrir(maaid,nom_ent)) < 0)
+ if ((root = _MEDdatagroupCreer(maaid,nom_ent)) < 0)
+ return -1;
+
+ /*
+ * Pour les mailles, les faces et le aretes, on cree
+ * s'il n'existe pas le Data Group du type geometrique
+ */
+ if ((type_ent==MED_MAILLE)||(type_ent==MED_FACE)||(type_ent==MED_ARETE))
+ {
+ if ((ret = _MEDnomGeometrie(nom_geo,type_geo)) < 0)
+ return -1;
+
+ if ((geoid = _MEDdatagroupOuvrir(entid,nom_geo)) < 0)
+ if ((geoid = _MEDdatagroupCreer(entid,nom_geo)) < 0)
+ return -1;
+ }
+ else
+ geoid = -1;
+
+ /*
+ * Creation du Data Set "NUM"
+ */
+ if (geoid == -1)
+ root = entid;
+ else
+ root = geoid;
+ dimd[0] = n;
+#if defined(IRIX64)||defined(OSF1)
+ if ((ret = _MEDdatasetNumEcrire(root,MED_NOM_NUM,MED_INT64,MED_NO_INTERLACE,MED_DIM1,MED_ALL,MED_NOPF,0,MED_NOPG,dimd,
+ (unsigned char*) num,mode)) < 0)
+ return -1;
+#else
+ if ((ret = _MEDdatasetNumEcrire(root,MED_NOM_NUM,MED_INT32,MED_NO_INTERLACE,MED_DIM1,MED_ALL,MED_NOPF,0,MED_NOPG,dimd,
+ (unsigned char*) num,mode)) < 0)
+ return -1;
+#endif
+
+ /*
+ * Attribut NBR (nombre de noeuds)
+ */
+ if ((dataset = _MEDdatasetOuvrir(root,MED_NOM_NUM)) < 0)
+ return -1;
+ if ((ret = _MEDattrEntierEcrire(dataset,MED_NOM_NBR,&n,mode)) < 0)
+ return -1;
+
+ /*
+ * On ferme tout
+ */
+ if ((ret = _MEDdatasetFermer(dataset)) < 0)
+ return -1;
+ if (geoid != -1)
+ if ((ret = _MEDdatagroupFermer(geoid)) < 0)
+ return -1;
+ if ((ret = _MEDdatagroupFermer(entid)) < 0)
+ return -1;
+ if ((ret = _MEDdatagroupFermer(maaid)) < 0)
+ return -1;
+
+ return 0;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+#include <stdlib.h>
+#include <string.h>
+
+namespace med_2_1{
+
+med_err
+MEDnumLire(med_idt fid,char *maa, med_int *num, med_int n,
+ med_entite_maillage type_ent,med_geometrie_element type_geo)
+{
+ med_idt root,maaid,entid,geoid;
+ med_err ret;
+ char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
+ char nom_ent[MED_TAILLE_NOM_ENTITE+1];
+ char nom_geo[MED_TAILLE_NOM_ENTITE+1];
+
+ /*
+ * On inhibe le gestionnaire d'erreur HDF 5
+ */
+ _MEDmodeErreurVerrouiller();
+
+ /*
+ * Si le maillage n'existe pas => erreur
+ */
+ strcpy(chemin,MED_MAA);
+ strcat(chemin,maa);
+ if ((maaid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
+ return -1;
+
+ /*
+ * On met a jour le nom du Data Group representant
+ * le type des entites
+ */
+ if ((ret = _MEDnomEntite(nom_ent,type_ent)) < 0)
+ return -1;
+
+ /*
+ * Si le Data Group des entites n'existe pas => erreur
+ */
+ if ((entid = _MEDdatagroupOuvrir(maaid,nom_ent)) < 0)
+ return -1;
+
+ /*
+ * Pour les mailles, les faces et le aretes,
+ * si le Data Group du type geometrique => erreur
+ */
+ if ((type_ent==MED_MAILLE)||(type_ent==MED_FACE)||(type_ent==MED_ARETE))
+ {
+ if ((ret = _MEDnomGeometrie(nom_geo,type_geo)) < 0)
+ return -1;
+ if ((geoid = _MEDdatagroupOuvrir(entid,nom_geo)) < 0)
+ return -1;
+ }
+ else
+ geoid = -1;
+
+ /*
+ * lecture du Data Set "NUM"
+ */
+ if (geoid == -1)
+ root = entid;
+ else
+ root = geoid;
+#if defined(IRIX64)||defined(OSF1)
+ if ((ret = _MEDdatasetNumLire(root,MED_NOM_NUM,MED_INT64,
+ MED_NO_INTERLACE,1,MED_ALL,
+ MED_NOPF,0,MED_NOPG,
+ (unsigned char*) num)) < 0)
+ return -1;
+#else
+ if ((ret = _MEDdatasetNumLire(root,MED_NOM_NUM,MED_INT32,
+ MED_NO_INTERLACE,1,MED_ALL,
+ MED_NOPF,0,MED_NOPG,
+ (unsigned char*) num)) < 0)
+ return -1;
+#endif
+
+ /*
+ * On ferme tout
+ */
+ if (geoid != -1)
+ if ((ret = _MEDdatagroupFermer(geoid)) < 0)
+ return -1;
+ if ((ret = _MEDdatagroupFermer(entid)) < 0)
+ return -1;
+ if ((ret = _MEDdatagroupFermer(maaid)) < 0)
+ return -1;
+
+ return 0;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+/*
+ * - Nom de la fonction : _MEDobjetIdentifier
+ * - Description : retrouve le nom de l'objet de rang "indice"
+ * se trouvant dans le datagroup "chemin"
+ * - Parametres :
+ * - fid (IN) : l'ID du fichier ou se trouve le datagroup
+ * - chemin (IN) : chemin d'acces au datagroup
+ * - indice (IN) : indice de l'objet du datagroup dont on veut
+ * le nom
+ * - nom (OUT) : le nom
+ * - Resultat : 0 en cas de succes, -1 sinon
+ */
+
+namespace med_2_1{
+
+med_err
+_MEDobjetIdentifier(med_idt fid,char *chemin,int indice,void *nom)
+{
+ int idx;
+
+ if ((idx = H5Giterate(fid,chemin,&indice,_MEDindiceInfo,
+ nom)) < 0)
+ return -1;
+
+ return 0;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+#ifdef PPRO_NT
+#define F_OK 0
+#else
+#include <unistd.h>
+#endif
+
+namespace med_2_1{
+
+med_idt
+MEDouvrir(char *nom, med_mode_acces mode_acces)
+{
+ med_idt fid;
+
+ /*
+ * On inhibe le gestionnaire d'erreur HDF
+ */
+ _MEDmodeErreurVerrouiller();
+
+ /*
+ * On ouvre le fichier MED sous HDF
+ */
+ switch(mode_acces)
+ {
+ case MED_LECT :
+ if (access(nom,F_OK))
+ return -1;
+ else
+ if ((fid = _MEDfichierOuvrir(nom,mode_acces)) < 0)
+ return -1;
+ break;
+
+ case MED_ECRI :
+ if (access(nom,F_OK))
+ {
+ if ((fid = _MEDfichierCreer(nom)) < 0)
+ return -1;
+ }
+ else
+ if ((fid = _MEDfichierOuvrir(nom,mode_acces)) < 0)
+ return -1;
+ break;
+
+ case MED_REMP :
+ if ((fid = _MEDfichierCreer(nom)) < 0)
+ return -1;
+ break;
+
+ default :
+ return -1;
+ }
+
+ return fid;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+/*
+ * - Nom de la fonction : _MEDparametresGeometrie
+ * - Description : fournit les parametres geometriques des differents
+ * entites et elements MED
+ * - Parametres :
+ * - typ_ent (IN) : type d'entite de l'element
+ * - type_geo (IN) : le type geometrique de l'element
+ * - dim (OUT) : dimension de l'element
+ * - nnoe (OUT) : nombre de noeuds composant l'element (connectivite
+ * nodale)
+ * - ndes (OUT) : nombre de composants dans l'elements (connectivite
+ * descendante)
+ * - Resultat : 0 en cas de succes, -1 sinon
+ */
+
+namespace med_2_1{
+
+med_err
+_MEDparametresGeometrie(med_entite_maillage type_ent,
+ med_geometrie_element type_geo, int *dim,
+ int *nnoe,int *ndes)
+{
+ *nnoe = type_geo % 100;
+ *dim = type_geo / 100;
+
+ switch(type_ent)
+ {
+ case MED_MAILLE :
+ switch (type_geo)
+ {
+ case MED_POINT1 :
+ *ndes = 0;
+ break;
+
+ case MED_SEG2 :
+ *ndes = 2;
+ break;
+
+ case MED_SEG3 :
+ *ndes = 3;
+ break;
+
+ case MED_TRIA3 :
+ *ndes = 3;
+ break;
+
+ case MED_TRIA6 :
+ *ndes = 3;
+ break;
+
+ case MED_QUAD4 :
+ *ndes = 4;
+ break;
+
+ case MED_QUAD8 :
+ *ndes = 4;
+ break;
+
+ case MED_TETRA4 :
+ *ndes = 4;
+ break;
+
+ case MED_TETRA10 :
+ *ndes = 4;
+ break;
+
+ case MED_HEXA8 :
+ *ndes = 6;
+ break;
+
+ case MED_HEXA20 :
+ *ndes = 6;
+ break;
+
+ case MED_PENTA6 :
+ *ndes = 5;
+ break;
+
+ case MED_PENTA15 :
+ *ndes = 5;
+ break;
+
+ case MED_PYRA5 :
+ *ndes = 5;
+ break;
+
+ case MED_PYRA13 :
+ *ndes = 5;
+ break;
+
+ default :
+ return -1;
+ }
+ break;
+
+ case MED_FACE :
+ switch(type_geo)
+ {
+ case MED_TRIA3 :
+ *ndes = 3;
+ break;
+
+ case MED_TRIA6 :
+ *ndes = 3;
+ break;
+
+ case MED_QUAD4 :
+ *ndes = 4;
+ break;
+
+ case MED_QUAD8 :
+ *ndes = 4;
+ break;
+
+ default :
+ return -1;
+ }
+ break;
+
+ case MED_ARETE :
+ switch(type_geo)
+ {
+ case MED_SEG2 :
+ *ndes = 2;
+ break;
+
+ case MED_SEG3 :
+ *ndes = 3;
+ break;
+
+ default :
+ return -1;
+ }
+ break;
+
+ default :
+ return -1;
+ }
+
+ return 0;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+/* Le nom de cette fonction n'est pas très bien choisie */
+
+namespace med_2_1{
+
+med_err
+MEDpasdetempsInfo(med_idt fid,char *champ
+ ,med_entite_maillage type_ent, med_geometrie_element type_geo,
+ int indice, char *maa, med_int * ngauss, med_int * numdt, char * dt_unit, med_float * dt,
+ med_int * numo)
+{
+
+ med_err ret=0;
+ med_int gauss_size;
+ med_idt gid;
+ char chemin[(MED_TAILLE_CHA+MED_TAILLE_NOM+1)+(2*MED_TAILLE_NOM_ENTITE+2)+2*MED_MAX_PARA+1];
+ int num;
+ char nomdatagroup1[2*MED_TAILLE_NOM_ENTITE+2],nomdatagroup2[2*MED_MAX_PARA+1];
+ char tmp1 [MED_TAILLE_NOM_ENTITE+1];
+
+ /*
+ * On inhibe le gestionnaire d'erreur HDF 5
+ */
+ _MEDmodeErreurVerrouiller();
+
+ /*
+ * On recupere le nom du datagroup <numdtt>.<numoo>
+ */
+ strcpy(chemin,MED_CHA);
+ strcat(chemin,champ);
+ strcat(chemin,"/");
+
+ if ((ret = _MEDnomEntite(nomdatagroup1,type_ent)) < 0)
+ return -1;
+ if ((type_ent != MED_NOEUD))
+ {
+ if ((ret = _MEDnomGeometrie(tmp1,type_geo)) < 0)
+ return -1;
+ strcat(nomdatagroup1,".");
+ strcat(nomdatagroup1,tmp1);
+ }
+ strcat(chemin,nomdatagroup1);
+ strcat(chemin,"/");
+
+ num = indice - 1;
+ if ((ret = _MEDobjetIdentifier(fid,chemin,num,nomdatagroup2)) < 0)
+ return -1;
+ strcat(chemin,nomdatagroup2);
+ if ((gid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
+ return -1;
+
+ /*
+ * La liste des attributs
+ */
+ if ((ret = _MEDattrStringLire(gid,MED_NOM_MAI,MED_TAILLE_NOM,maa)) < 0)
+ return -1;
+
+ if ((ret = _MEDattrEntierLire(gid,MED_NOM_NDT,(med_int*) numdt)) < 0)
+ return -1;
+
+ if ((ret = _MEDattrFloatLire(gid,MED_NOM_PDT,(med_float*) dt)) < 0)
+ return -1;
+
+ if ((ret = _MEDattrStringLire(gid,MED_NOM_UNI,MED_TAILLE_PNOM,dt_unit)) < 0)
+ return -1;
+
+ if ((ret = _MEDattrEntierLire(gid,MED_NOM_NOR,(med_int*) numo)) < 0)
+ return -1;
+
+ if ( (ret = _MEDattrEntierLire(gid,MED_NOM_NGA,ngauss)) < 0 )
+ return -1;
+
+
+ if ((ret = _MEDdatagroupFermer(gid)) < 0)
+ return -1;
+
+ return 0;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+#include <string.h>
+#include <stdlib.h>
+
+namespace med_2_1{
+
+med_err
+MEDprofilEcr(med_idt fid,med_int *pflval,med_int n,char *nom)
+{
+ med_idt root, pid, did;
+ med_size dimd[1];
+ med_err ret;
+ char chemin[MED_TAILLE_PROFILS+1];
+
+ /*
+ * On inhibe le gestionnaire d'erreur HDF 5
+ */
+ _MEDmodeErreurVerrouiller();
+
+ /*
+ * Si le groupe "PROFILS" n'existe pas, on le cree
+ */
+ strncpy(chemin,MED_PROFILS,MED_TAILLE_PROFILS-1);
+ chemin[MED_TAILLE_PROFILS-1] = '\0';
+ if ((root = _MEDdatagroupOuvrir(fid,chemin)) < 0)
+ if ((root = _MEDdatagroupCreer(fid,chemin)) < 0)
+ return -1;
+
+ /*
+ * Si le groupe "nom" n'existe pas, on le cree
+ * Sinon => erreur
+ */
+ if ((pid = _MEDdatagroupOuvrir(root,nom)) >= 0)
+ return -1;
+ if ((pid = _MEDdatagroupCreer(root,nom)) < 0)
+ return -1;
+
+ /*
+ * On stocke "n" sous forme d'attribut
+ */
+ if ((ret = _MEDattrEntierEcrire(pid,MED_NOM_N,&n,MED_REMP)) < 0)
+ return -1;
+
+ /*
+ * On stocke le profil dans un dataset
+ */
+ dimd[0] = n;
+#if defined(IRIX64)||defined(OSF1)
+ if ((ret = _MEDdatasetNumEcrire(pid,MED_NOM_PFL,MED_INT64,MED_NO_INTERLACE,MED_DIM1,MED_ALL,MED_NOPF,0,MED_NOPG,dimd,
+ (unsigned char*) pflval,MED_REMP)) < 0)
+ return -1;
+#else
+ if ((ret = _MEDdatasetNumEcrire(pid,MED_NOM_PFL,MED_INT32,MED_NO_INTERLACE,MED_DIM1,MED_ALL,MED_NOPF,0,MED_NOPG,dimd,
+ (unsigned char*) pflval,MED_REMP)) < 0)
+ return -1;
+#endif
+
+ /*
+ * On ferme tout
+ */
+ if ((ret = _MEDdatagroupFermer(pid)) < 0)
+ return -1;
+ if ((ret = _MEDdatagroupFermer(root)) < 0)
+ return -1;
+
+ return 0;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+#include <string.h>
+#include <stdlib.h>
+
+namespace med_2_1{
+
+med_err
+MEDprofilInfo(med_idt fid, int indice, char *profil, med_int *n)
+{
+ int numero;
+ med_idt proid;
+ med_err ret;
+ char chemin[MED_TAILLE_PROFILS+MED_TAILLE_NOM+1];
+
+ /*
+ * On inhibe le gestionnaire d'erreur
+ */
+ _MEDmodeErreurVerrouiller();
+
+ /*
+ * On recupere le nom du groupe de rang "indice"
+ */
+ numero = indice-1;
+ if ((ret = _MEDobjetIdentifier(fid,MED_PROFILS,numero,profil)) < 0)
+ return -1;
+
+ /*
+ * On va chercher l'attribut taille du profil
+ */
+ strcpy(chemin,MED_PROFILS);
+ strcat(chemin,profil);
+ if ((proid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
+ return -1;
+ if ((ret = _MEDattrEntierLire(proid,MED_NOM_N,n)) < 0)
+ return -1;
+ if ((ret = _MEDdatagroupFermer(proid)) < 0)
+ return -1;
+
+ return 0;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+#include <string.h>
+#include <stdlib.h>
+
+namespace med_2_1{
+
+med_err
+MEDprofilLire(med_idt fid,med_int *pflval, char *nom)
+{
+ med_err ret = 0;
+ med_idt pid,did;
+ char chemin[MED_TAILLE_PROFILS+MED_TAILLE_NOM+1];
+
+ /*
+ * On inhibe le gestionnaire d'erreur HDF 5
+ */
+ _MEDmodeErreurVerrouiller();
+
+ /*
+ * ouverture du groupe /PROFILS/"nom"
+ */
+ strcpy(chemin,MED_PROFILS);
+ strcat(chemin,nom);
+ if ((pid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
+ return -1;
+
+ /*
+ * Lecture du profil
+ */
+#if defined(IRIX64)||defined(OSF1)
+ if ((ret = _MEDdatasetNumLire(pid,MED_NOM_PFL,MED_INT64,
+ MED_NO_INTERLACE,1,MED_ALL,
+ MED_NOPF,0,MED_NOPG,
+ (unsigned char *) pflval)) < 0)
+ return -1;
+#else
+ if ((ret = _MEDdatasetNumLire(pid,MED_NOM_PFL,MED_INT32,
+ MED_NO_INTERLACE,1,MED_ALL,
+ MED_NOPF,0,MED_NOPG,
+ (unsigned char *) pflval)) < 0)
+ return -1;
+#endif
+
+ /*
+ * On ferme tout
+ */
+ if ((ret = _MEDdatagroupFermer(pid)) < 0)
+ return -1;
+
+ return ret;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+#include <string.h>
+#include <stdlib.h>
+
+#include <stdio.h>
+#include <time.h>
+
+#ifdef PPRO_NT
+// Windows Header Files:
+#include <windows.h>
+#include <Lmcons.h>
+#include <sys/timeb.h>
+#else
+#include <sys/time.h>
+#endif
+
+namespace med_2_1{
+
+med_err
+MEDunvCr(med_idt fid, char *maa)
+{
+ med_idt maaid;
+ char chemin [MED_TAILLE_MAA+MED_TAILLE_NOM+1];
+ char nomu [MED_TAILLE_LNOM+1];
+ time_t temps;
+#ifdef PPRO_NT
+ struct timeb tp;
+ char lpBuffer [UNLEN+1];
+ long nSize = UNLEN+1;
+#else
+ struct timeval tp;
+#endif
+ med_err ret;
+
+ /*
+ * On inhibe le gestionnaire d'erreur
+ */
+ _MEDmodeErreurVerrouiller();
+
+ /*
+ * Si le maillage n'existe pas => erreur
+ */
+ strcpy(chemin,MED_MAA);
+ strcat(chemin,maa);
+ if ((maaid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
+ return -1;
+
+ /*
+ * Creation/Ecriture de l'attribut nom universel
+ */
+
+#ifdef PPRO_NT
+ if ( GetUserName(lpBuffer,&nSize) == 0 ) return -1;
+ if ( nSize > MED_TAILLE_NOM ) nSize = MED_TAILLE_NOM;
+ strncpy(nomu,lpBuffer,nSize);
+ strcat(nomu," ");
+ temps=time(&temps);
+ strcat(nomu,ctime(&temps));
+ ftime(&tp);
+ nSize = strlen(nomu)-1;
+ if ( sprintf(&nomu[nSize]," %hu",tp.millitm) < 0 ) return -1;
+#else
+ if (cuserid(nomu) == (void*) NULL) return -1;
+ strcat(nomu," ");
+ temps=time(&temps);
+ strcat(nomu,ctime(&temps));
+ if ( gettimeofday(&tp,NULL) < 0 ) return -1;
+ if ( sprintf(&nomu[strlen(nomu)-1]," %li",tp.tv_usec) < 0 ) return -1;
+#endif
+ if ((ret = _MEDattrStringEcrire(maaid,MED_NOM_UNV,MED_TAILLE_LNOM,nomu,MED_REMP)) < 0)
+ return -1;
+
+ /*
+ * Nettoyages divers
+ */
+ if ((ret = _MEDdatagroupFermer(maaid)) < 0)
+ return -1;
+
+ return 0;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+#include <string.h>
+#include <stdlib.h>
+
+#include <stdio.h>
+#include <time.h>
+
+namespace med_2_1{
+
+med_err
+MEDunvLire(med_idt fid, char *maa,char *nomu)
+{
+ med_idt maaid;
+ char chemin [MED_TAILLE_MAA+MED_TAILLE_NOM+1];
+ med_err ret;
+
+ /*
+ * On inhibe le gestionnaire d'erreur
+ */
+ _MEDmodeErreurVerrouiller();
+
+ /*
+ * Si le maillage n'existe pas => erreur
+ */
+ strcpy(chemin,MED_MAA);
+ strcat(chemin,maa);
+ if ((maaid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
+ return -1;
+
+ /*
+ * Creation/Ecriture de l'attribut nom universel
+ */
+ if ((ret = _MEDattrStringLire(maaid,MED_NOM_UNV,MED_TAILLE_LNOM,
+ nomu )) < 0)
+ return -1;
+
+ /*
+ * Nettoyages divers
+ */
+ if ((ret = _MEDdatagroupFermer(maaid)) < 0)
+ return -1;
+
+ return 0;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+namespace med_2_1{
+
+med_err
+MEDversionConforme(const char *nom) {
+ med_int majeur, mineur;
+ med_idt fid, gid;
+ med_err ret;
+
+ /*
+ * On inhibe le gestionnaire d'erreur HDF
+ */
+ _MEDmodeErreurVerrouiller();
+
+ /*
+ * On ouvre le fichier MED en mode MED_LECT
+ */
+ if ((fid = _MEDfichierOuvrir((char *)nom,MED_LECT)) < 0)
+ return -1;
+
+ /*
+ * Lecture du numero de version
+ */
+ if ((gid = _MEDdatagroupOuvrir(fid,MED_NOM_INFOS)) < 0)
+ return -1;
+
+ if ((ret = _MEDattrEntierLire(gid,MED_NOM_MAJEUR,&majeur)) < 0)
+ return -1;
+
+ if ((ret = _MEDattrEntierLire(gid,MED_NOM_MINEUR,&mineur)) < 0)
+ return -1;
+
+ /*
+ * On ferme tout
+ */
+ if ((ret = _MEDdatagroupFermer(gid)) < 0)
+ return -1;
+
+ if ((ret = _MEDfichierFermer(fid)) < 0)
+ return -1;
+
+ if ((majeur == MED_NUM_MAJEUR) && (mineur == MED_NUM_MINEUR))
+ return 0;
+ else
+ return -1;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+namespace med_2_1{
+
+void
+MEDversionDonner(med_int *majeur, med_int *mineur, med_int *release) {
+ *majeur = MED_NUM_MAJEUR;
+ *mineur = MED_NUM_MINEUR;
+ *release = MED_NUM_RELEASE;
+}
+
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#include "med.hxx"
+#include "med_outils.hxx"
+
+namespace med_2_1{
+
+med_err
+MEDversionLire(med_idt fid, med_int *majeur, med_int *mineur, med_int *release)
+{
+ med_err ret = 0;
+ med_idt gid;
+
+ /* On ouvre le group ou se trouvent les infos */
+ if ((gid = _MEDdatagroupOuvrir(fid,MED_NOM_INFOS)) < 0) {
+ *majeur = 2;
+ *mineur = -1;
+ *release = -1;
+ ret = 0;
+ }
+ else {
+ if ((ret = _MEDattrEntierLire(gid,MED_NOM_MAJEUR,majeur)) < 0)
+ return -1;
+
+ if ((ret = _MEDattrEntierLire(gid,MED_NOM_MINEUR,mineur)) < 0)
+ return -1;
+
+ if ((ret = _MEDattrEntierLire(gid,MED_NOM_RELEASE,release)) < 0)
+ return -1;
+
+ /* On ferme tout */
+ if ((ret = _MEDdatagroupFermer(gid)) < 0)
+ return -1;
+ }
+
+ return ret;
+}
+
+}
--- /dev/null
+#
+#
+# Copyright (C) 2003 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.
+#
+# 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+#
+#
+#
+# File :
+# Author :
+# Module :
+# $Header$
+
+top_srcdir=@top_srcdir@
+top_builddir=../../../..
+srcdir=@srcdir@
+VPATH=.:@srcdir@:@top_srcdir@/idl
+
+
+@COMMENCE@
+
+LIB_SRC_TOOLS_HDFI= \
+MEDattrFermer.cxx \
+MEDattrNumEcrire.cxx \
+MEDattrNumLire.cxx \
+MEDattrOuvrir.cxx \
+MEDattrStringEcrire.cxx \
+MEDattrStringLire.cxx \
+MEDdatagroupCreer.cxx \
+MEDdatagroupFermer.cxx \
+MEDdatagroupOuvrir.cxx \
+MEDdatasetFermer.cxx \
+MEDdatasetNumEcrire.cxx \
+MEDdatasetNumLire.cxx \
+MEDdatasetOuvrir.cxx \
+MEDdatasetStringEcrire.cxx \
+MEDdatasetStringLire.cxx \
+MEDfichierCreer.cxx \
+MEDfichierFermer.cxx \
+MEDfichierOuvrir.cxx \
+MEDindiceInfo.cxx \
+MEDindiceNum.cxx \
+MEDmodeErreurVerrouiller.cxx \
+MEDnObjets.cxx \
+MEDobjetIdentifer.cxx
+
+LIB_SRC_TOOLS_MISC= \
+MED1cstring.cxx MEDnomDataset.cxx \
+MED2cstring.cxx MEDnomEntite.cxx \
+MEDGeometrieElement.cxx MEDnomGeometrie.cxx \
+MEDcstringFree.cxx MEDparametresGeometrie.cxx \
+MEDfstring.cxx
+
+LIB_SRC_API_CI= \
+MEDchampCr.cxx \
+MEDchampEcr.cxx \
+MEDchampInfo.cxx \
+MEDchampLire.cxx \
+MEDconnEcr.cxx \
+MEDconnLire.cxx \
+MEDcoordEcr.cxx \
+MEDcoordLire.cxx \
+MEDdimLire.cxx \
+MEDelementsEcr.cxx \
+MEDelementsLire.cxx \
+MEDequivCr.cxx \
+MEDequivEcr.cxx \
+MEDequivInfo.cxx \
+MEDequivLire.cxx \
+MEDfam2groA.cxx \
+MEDfam2groB.cxx \
+MEDfamCr.cxx \
+MEDfamEcr.cxx \
+MEDfamInfo.cxx \
+MEDfamLire.cxx \
+MEDfamMaaCr.cxx \
+MEDfamMaaInfo.cxx \
+MEDfamMaaLire.cxx \
+MEDfermer.cxx \
+MEDfichDesEcr.cxx \
+MEDfichEntete.cxx \
+MEDgro2famA.cxx \
+MEDgro2famB.cxx \
+MEDlFichDes.cxx \
+MEDmaaCr.cxx \
+MEDmaaInfo.cxx \
+MEDnChamp.cxx \
+MEDnCorres.cxx \
+MEDnEntMaa.cxx \
+MEDnEntites.cxx \
+MEDnEquiv.cxx \
+MEDnFam.cxx \
+MEDnMaa.cxx \
+MEDnPasdetemps.cxx \
+MEDnProfil.cxx \
+MEDnVal.cxx \
+MEDnValProfil.cxx \
+MEDnbnoisEcr.cxx \
+MEDnbnoisLire.cxx \
+MEDnbnomaEcr.cxx \
+MEDnbnomaLire.cxx \
+MEDnbnosoEcr.cxx \
+MEDnbnosoLire.cxx \
+MEDnoeudsEcr.cxx \
+MEDnoeudsLire.cxx \
+MEDnomEcr.cxx \
+MEDnomLire.cxx \
+MEDnumEcr.cxx \
+MEDnumLire.cxx \
+MEDouvrir.cxx \
+MEDpasdetempsInfo.cxx \
+MEDprofilEcr.cxx \
+MEDprofilLire.cxx \
+MEDprofilInfo.cxx \
+MEDunvCr.cxx \
+MEDunvLire.cxx \
+MEDformatConforme.cxx \
+MEDversionConforme.cxx \
+MEDversionDonner.cxx \
+MEDversionLire.cxx \
+MEDbodyFittedEcr.cxx \
+MEDbodyFittedLire.cxx \
+MEDfamGridEcr.cxx \
+MEDfamGridLire.cxx \
+MEDgridCr.cxx \
+MEDgridEcr.cxx \
+MEDgridInfo.cxx \
+MEDgridLire.cxx \
+MEDnGrid.cxx
+
+# Libraries targets
+
+LIB = libmed_V2_1.la
+LIB_SRC = \
+ $(LIB_SRC_TOOLS_HDFI) \
+ $(LIB_SRC_TOOLS_MISC) \
+ $(LIB_SRC_API_CI)
+
+EXPORT_HEADERS = \
+ med.hxx \
+ med_proto.hxx \
+ hdf5_version2api.hxx
+
+# Executables targets
+BIN = mdump_V2_1 test1_V2_1
+BIN_SRC =
+
+CPPFLAGS+= -D@MACHINE@ $(BOOST_CPPFLAGS) $(HDF5_INCLUDES)
+
+LDFLAGS+= $(HDF5_LIBS)
+
+LDFLAGSFORBIN=$(LDFLAGS)
+
+@CONCLUDE@
--- /dev/null
+
+#ifndef _hdf5_version2api_hxx_
+#define _hdf5_version2api_hxx_
+// Copyright (C) 2005 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.
+//
+// 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/
+//
+
+#include <H5public.h>
+
+#if H5_VERS_MAJOR < 1
+#elif H5_VERS_MAJOR == 1
+
+#if H5_VERS_MINOR < 6
+#elif H5_VERS_MINOR == 6
+
+#if H5_VERS_RELEASE < 4
+#else
+#define HDF_NEW_API
+#endif
+
+#else /* H5_VERS_MINOR >= 7 */
+#define HDF_NEW_API
+#endif /* H5_VERS_MINOR */
+
+#else /* H5_VERS_MAJOR >= 2 */
+#define HDF_NEW_API
+#endif /* H5_VERS_MAJOR */
+
+#endif
--- /dev/null
+/******************************************************************************
+ * - Nom du fichier : mdump.c
+ *
+ * - Description : utilitaire de dump pour fichier MED V2.1
+ *
+ *****************************************************************************/
+#define NBR_MAILLE_EQU 7
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include "med.hxx"
+using namespace med_2_1;
+
+/*******************************************************************
+ * DUMP D'UN FICHIER MED STRUCTURE EN GRILLE : *
+ * NOEUDS, ELEMENTS, FAMILLES, EQUIVALENCES, CHAMPS DE RESULTATS *
+ *******************************************************************/
+
+int grid_cartesian_or_polar(med_idt fid, int numero, med_mode_switch mode_coo) {
+ med_int mdim, nnoe, nfam, i, j;
+ char nommaa[MED_TAILLE_NOM+1];
+ char nom_universel[MED_TAILLE_LNOM+1];
+ med_float *coo;
+ med_int *fam;
+ char nomcoo[3*MED_TAILLE_PNOM+1];
+ char unicoo[3*MED_TAILLE_PNOM+1];
+ med_repere rep;
+ char str[MED_TAILLE_PNOM+1];
+
+ fprintf(stdout,"\n(****************************)\n");
+ fprintf(stdout,"(* INFORMATIONS GENERALES : *)\n");
+ fprintf(stdout,"(****************************)\n");
+
+ /* lecture du nom et de la dimension de la grille */
+ if (MEDmaaInfo(fid, numero, nommaa, &mdim) < 0) {
+ fprintf(stderr, ">> ERREUR : lecture du nom de la grille\n");
+ return(EXIT_FAILURE);
+ };
+ fprintf(stdout, "- Nom de la grille : <<%s>>\n", nommaa);
+ fprintf(stdout, "- Dimension de la grille : %d\n", mdim);
+
+ /* lecture du nom universel (presence optionnelle) */
+ if (MEDunvLire(fid, nommaa, nom_universel) > 0) {
+ fprintf(stdout, "- Nom universel de la grille : %s \n", nom_universel);
+ } else {
+ fprintf(stdout, "- Pas de nom universel \n");
+ };
+
+ /* nombre de familles */
+ nfam = MEDnFam(fid, nommaa, 0, (med_dim_famille)0);
+ if (nfam < 0) {
+ fprintf(stderr, ">> ERREUR : lecture du nombre de familles\n");
+ return(EXIT_FAILURE);
+ };
+ fprintf(stdout, "- Nombre de familles : %d \n", nfam);
+
+ fprintf(stdout, "\n- Lecture des indices : \n");
+ for (i=0; i<mdim; i++) {
+ fprintf(stdout, "-- Lecture de l'indice : %d\n", i);
+ nnoe = MEDnGrid(fid, nommaa, (med_grid)i);
+ fprintf(stdout, "-- nombre d'indice : %d\n", nnoe);
+ coo = (med_float*)malloc(sizeof(med_float)*nnoe);
+
+ if (MEDgridLire(fid, nommaa, mdim, coo, i, mode_coo, &rep, nomcoo, unicoo) < 0) {
+ fprintf(stderr, ">> ERREUR : lecture des indices \n");
+ return(EXIT_FAILURE);
+ };
+
+ fprintf(stdout, "- Type de repere des coordonnees : %d \n", rep);
+
+ fprintf(stdout, "- Nom des coordonnees : \n");
+ for (j=0; j<mdim; j++) {
+ strncpy(str, nomcoo+j*MED_TAILLE_PNOM, MED_TAILLE_PNOM);
+ str[MED_TAILLE_PNOM] = '\0';
+ fprintf(stdout, " %s ", str);
+ };
+
+ fprintf(stdout, "\n- Unites des coordonnees : \n");
+ for (j=0; j<mdim; j++) {
+ strncpy(str, unicoo+j*MED_TAILLE_PNOM, MED_TAILLE_PNOM);
+ str[MED_TAILLE_PNOM] = '\0';
+ fprintf(stdout, " %s ", str);
+ };
+
+ fprintf(stdout, "\n-- Coordonnees des indices : \n");
+ for (j=0; j<nnoe; j++) {
+ fprintf(stdout, " %f ", *(coo+j));
+ };
+
+ fprintf(stdout, "\n\n");
+ free(coo);
+ };
+
+ nfam = MEDnGrid(fid, nommaa, (med_grid)-2);
+ fprintf(stdout, "- Nombre de noeud pour les familles : %d\n", nfam);
+ if (nfam > 0) {
+ fam = (med_int*)malloc(sizeof(med_int)*nfam);
+ if (MEDfamGridLire(fid, nommaa, fam, nfam,MED_NOEUD) < 0) {
+ fprintf(stderr, ">> ERREUR : lecture des familles\n");
+ return(EXIT_FAILURE);
+ };
+
+ fprintf(stdout, "\n- Numeros des familles des noeuds :\n");
+ for (i=0; i<nfam; i++) {
+ fprintf(stdout, " %d ", *(fam+i));
+ };
+ fprintf(stdout, "\n");
+ free(fam);
+ };
+
+ return(0);
+}
+
+int grid_body_fitted(med_idt fid, int numero, med_mode_switch mode_coo) {
+ med_int mdim, nnoe, nfam, i;
+ char nommaa[MED_TAILLE_NOM+1];
+ char nom_universel[MED_TAILLE_LNOM+1];
+ char str[MED_TAILLE_PNOM+1];
+ char nomcoo[3*MED_TAILLE_PNOM+1];
+ char unicoo[3*MED_TAILLE_PNOM+1];
+ med_float *coo;
+ med_int *fam;
+ med_repere rep;
+
+ fprintf(stdout,"\n(****************************)\n");
+ fprintf(stdout,"(* INFORMATIONS GENERALES : *)\n");
+ fprintf(stdout,"(****************************)\n");
+
+ /* lecture du nom et de la dimension du maillage */
+ if (MEDmaaInfo(fid, numero, nommaa, &mdim) < 0) {
+ fprintf(stderr, ">> ERREUR : lecture du nom du maillage body fitted\n");
+ return(EXIT_FAILURE);
+ };
+ fprintf(stdout, "- Nom du maillage body fitted : <<%s>>\n", nommaa);
+ fprintf(stdout, "- Dimension du maillage body fitted : %d\n", mdim);
+
+ /* lecture du nom universel (presence optionnelle) */
+ if (MEDunvLire(fid, nommaa, nom_universel) > 0) {
+ fprintf(stdout, "- Nom universel du maillage body fitted : %s \n", nom_universel);
+ } else {
+ fprintf(stdout, "- Pas de nom universel \n");
+ };
+
+ /* Combien de noeuds ? */
+ /* nnoe = MEDnGrid(fid, nommaa, -1);*/
+ nnoe = MEDnGrid(fid, nommaa, MED_GRID_NOEUD);
+ if (nnoe < 0) {
+ fprintf(stderr, ">> ERREUR : lecture du nombre de noeuds (via MEDnGrid) \n");
+ return(EXIT_FAILURE);
+ };
+ fprintf(stdout, "- Nombre de noeuds : %d \n", nnoe);
+
+ /* Combien de noeuds dans la dimension 1 ? */
+ i = MEDnGrid(fid, nommaa, (med_grid)0);
+ if (i < 0) {
+ fprintf(stderr, ">> ERREUR : lecture du nombre de noeuds (via MEDnGrid) dans la dimension 1 \n");
+ return(EXIT_FAILURE);
+ };
+ fprintf(stdout, "- Nombre de noeuds dans la dimension 1 : %d \n", i);
+
+ /* Combien de noeuds dans la dimension 2 ? */
+ i = MEDnGrid(fid, nommaa, (med_grid)1);
+ if (i < 0) {
+ fprintf(stderr, ">> ERREUR : lecture du nombre de noeuds (via MEDnGrid) dans la dimension 2 \n");
+ return(EXIT_FAILURE);
+ };
+ fprintf(stdout, "- Nombre de noeuds dans la dimension 2 : %d \n", i);
+
+ /* nombre de familles */
+ nfam = MEDnFam(fid, nommaa, 0,(med_dim_famille)0);
+ if (nfam < 0) {
+ fprintf(stderr, ">> ERREUR : lecture du nombre de familles \n");
+ return(EXIT_FAILURE);
+ };
+ fprintf(stdout, "- Nombre de familles : %d \n", nfam);
+
+ coo = (med_float*)malloc(sizeof(med_float)*nnoe*mdim);
+ fam = (med_int*)malloc(sizeof(med_int)*nnoe);
+
+ if (MEDbodyFittedLire(fid, nommaa, mdim, coo, mode_coo, &rep, nomcoo, unicoo, fam, nnoe) < 0) {
+ fprintf(stderr, ">> ERREUR : lecture des noeuds \n");
+ return(EXIT_FAILURE);
+ };
+
+ fprintf(stdout, "- Type de repere des coordonnees : %d \n", rep);
+
+ fprintf(stdout, "- Nom des coordonnees : \n");
+ for (i=0; i<mdim; i++) {
+ strncpy(str, nomcoo+i*MED_TAILLE_PNOM, MED_TAILLE_PNOM);
+ str[MED_TAILLE_PNOM] = '\0';
+ fprintf(stdout, " %s ", str);
+ };
+
+ fprintf(stdout, "\n- Unites des coordonnees : \n");
+ for (i=0; i<mdim; i++) {
+ strncpy(str, unicoo+i*MED_TAILLE_PNOM, MED_TAILLE_PNOM);
+ str[MED_TAILLE_PNOM] = '\0';
+ fprintf(stdout, " %s ", str);
+ };
+
+ fprintf(stdout, "\n- Coordonnees des noeuds : \n");
+ for (i=0; i<nnoe*mdim; i++) {
+ fprintf(stdout, " %f ", *(coo+i));
+ };
+
+ fprintf(stdout, "\n- Numeros des familles des noeuds : \n");
+ for (i=0; i<nnoe; i++) {
+ fprintf(stdout, " %d ", *(fam+i));
+ };
+ fprintf(stdout, "\n");
+
+ if (nnoe) {
+ free(coo);
+ free(fam);
+ };
+ return(0);
+}
+
+int grid(med_idt fid, int numero, med_grid_type theType, med_mode_switch mode_coo) {
+ switch (theType) {
+ case MED_CARTESIAN : {
+ fprintf(stdout, "- Type de la grille : MED_CARTESIAN\n");
+ return(grid_cartesian_or_polar(fid, numero, mode_coo));
+ };
+ case MED_POLAR : {
+ fprintf(stdout, "- Type de la grille : MED_POLAR\n");
+ return(grid_cartesian_or_polar(fid, numero, mode_coo));
+ };
+ case MED_BODY_FITTED : {
+ fprintf(stdout, "- Type de la grille : MED_BODY_FITTED\n");
+ return(grid_body_fitted(fid, numero, mode_coo));
+ };
+ default : {
+ fprintf(stderr, ">> ERREUR : type de maillage inconnu\n");
+ return(EXIT_FAILURE);
+ };
+ };
+}
+
+/******************************************************************************
+ * DUMP D'UN FICHIER MED : NOEUDS,
+ * ELEMENTS, FAMILLES, EQUIVALENCES, CHAMPS DE RESULTATS
+ *****************************************************************************/
+
+int main (int argc, char **argv)
+{
+ med_err ret = 0;
+ med_idt fid;
+ int i,j,k,l,kp;
+ int numero;
+ char message[200];
+ /* nombre d'objets MED */
+ char nom_universel[MED_TAILLE_LNOM+1];
+ med_int long_fichier_en_tete;
+ char *fichier_en_tete;
+ char version_hdf[10];
+ char version_med[10];
+ med_int nmaa,mdim,nnoe;
+ med_int nmai[MED_NBR_GEOMETRIE_MAILLE],nfac[MED_NBR_GEOMETRIE_FACE];
+ med_int nare[MED_NBR_GEOMETRIE_ARETE];
+ /* nom du maillage */
+ char nommaa[MED_TAILLE_NOM+1];
+ /* noeuds */
+ med_float *coo;
+ char nomcoo[3*MED_TAILLE_PNOM+1];
+ char unicoo[3*MED_TAILLE_PNOM+1];
+ char *nomnoe;
+ med_int *numnoe;
+ med_int *nufano;
+ med_repere rep;
+ med_booleen inonoe,inunoe;
+ med_mode_switch mode_coo;
+ char str[MED_TAILLE_PNOM+1];
+ /* elements */
+ med_int nsup;
+ med_int edim;
+ med_int taille;
+ med_int *connectivite;
+ char *nomele;
+ med_int *numele;
+ med_int *nufael;
+ med_booleen inoele, inuele;
+ med_connectivite typ_con;
+ med_geometrie_element typgeo;
+ med_geometrie_element typmai[MED_NBR_GEOMETRIE_MAILLE] = {MED_POINT1,MED_SEG2,
+ MED_SEG3,MED_TRIA3,
+ MED_TRIA6,MED_QUAD4,
+ MED_QUAD8,MED_TETRA4,
+ MED_TETRA10,MED_HEXA8,
+ MED_HEXA20,MED_PENTA6,
+ MED_PENTA15,MED_PYRA5,
+ MED_PYRA13};
+ med_int desmai[MED_NBR_GEOMETRIE_MAILLE] = {0,2,3,3,3,4,4,4,4,6,6,5,5,5,5};
+ med_int nmailles[MED_NBR_GEOMETRIE_MAILLE];
+ char nommai[MED_NBR_GEOMETRIE_MAILLE] [MED_TAILLE_NOM+1] = {"MED_POINT1",
+ "MED_SEG2",
+ "MED_SEG3",
+ "MED_TRIA3",
+ "MED_TRIA6",
+ "MED_QUAD4",
+ "MED_QUAD8",
+ "MED_TETRA4",
+ "MED_TETRA10",
+ "MED_HEXA8",
+ "MED_HEXA20",
+ "MED_PENTA6",
+ "MED_PENTA15",
+ "MED_PYRA5",
+ "MED_PYRA13"};
+ med_geometrie_element typfac[MED_NBR_GEOMETRIE_FACE] = {MED_TRIA3,MED_TRIA6,
+ MED_QUAD4,MED_QUAD8};
+ med_int desfac[MED_NBR_GEOMETRIE_FACE] = {3,3,4,4};
+ med_int nfaces[MED_NBR_GEOMETRIE_FACE];
+ char nomfac[MED_NBR_GEOMETRIE_FACE][MED_TAILLE_NOM+1] = {"MED_TRIA3","MED_TRIA6",
+ "MED_QUAD4","MED_QUAD8"};
+ med_geometrie_element typare[MED_NBR_GEOMETRIE_ARETE] = {MED_SEG2,MED_SEG3};
+ med_int desare[MED_NBR_GEOMETRIE_ARETE] = {2,3};
+ med_int naretes[MED_NBR_GEOMETRIE_ARETE];
+ char nomare[MED_NBR_GEOMETRIE_ARETE] [MED_TAILLE_NOM+1] = {"MED_SEG2","MED_SEG3"};
+ /* familles */
+ med_int nfam;
+ med_int natt,ngro;
+ char *attdes,*gro;
+ med_int *attval,*attide;
+ char nomfam[MED_TAILLE_NOM+1];
+ med_int numfam;
+ char str1[MED_TAILLE_DESC+1];
+ char str2[MED_TAILLE_LNOM+1];
+ /* equivalences */
+ med_int nequ,ncor;
+ med_int *cor;
+ char equ[MED_TAILLE_NOM+1];
+ char des[MED_TAILLE_DESC+1];
+ /* champs de resultats */
+ char *comp;
+ char *unit;
+ char nomcha[MED_TAILLE_NOM+1];
+ char maillage_champ[MED_TAILLE_NOM+1];
+ med_int ncomp;
+ med_float *valr;
+ med_int *vale;
+ med_type_champ typcha;
+ med_int ncha;
+ med_int nval;
+ int reponse;
+ int lecture_en_tete_seulement = 0;
+ med_int npdt;
+ med_int ngauss,numdt,numo;
+ med_float dt;
+ char dtunit[MED_TAILLE_PNOM+1];
+ char pflnom[MED_TAILLE_NOM+1];
+ med_int pflsize;
+ med_int *pflval;
+ med_int isGrid;
+ med_grid_type theType;
+
+ /****************************************************************************
+ * TEST DU NOMBRE D'ARGUMENTS *
+ * argument 1 = nom du fichier MED *
+ ****************************************************************************/
+ if (argc != 2 && argc != 5)
+ {
+ fprintf(stderr,">> ERREUR : nombre de parametres incorrects \n");
+ exit(EXIT_FAILURE);
+ }
+
+ /****************************************************************************
+ * OUVERTURE DU FICHIER EN LECTURE *
+ ****************************************************************************/
+ fid = MEDouvrir(argv[1],MED_LECT);
+ if (fid < 0)
+ {
+ fprintf(stderr,">> ERREUR : ouverture du fichier %s \n",argv[1]);
+ exit(EXIT_FAILURE);
+ }
+
+
+ /****************************************************************************
+ * QUESTIONS PRELIMINAIRES *
+ * 1. Mode d'affichage des coordonnees (entrelace ou non) ? *
+ * 2. Connectivite des elements (nodale ou descendante) *
+ ****************************************************************************/
+ fprintf(stdout,"\n >>>>>> DUMP DU FICHIER %s >>>>>>\n",argv[1]);
+
+ /* en-tete du fichier (presence optionnelle) */
+ long_fichier_en_tete = MEDlFichDes(fid);
+ if (long_fichier_en_tete > 0)
+ {
+ fichier_en_tete = (char *) malloc(sizeof(char)*(long_fichier_en_tete+1));
+ ret = MEDfichEntete(fid,MED_FICH_DES,fichier_en_tete);
+ if (ret < 0)
+ {
+ fprintf(stderr,">> ERREUR : lecture de l'en-tete du fichier \n");
+ exit(EXIT_FAILURE);
+ }
+ fprintf(stdout,"- En-tete du fichier : %s \n",fichier_en_tete);
+ free(fichier_en_tete);
+ }
+ /* versions hdf et med */
+ ret = MEDfichEntete(fid,MED_HDF_VERSION,version_hdf);
+ if (ret < 0)
+ {
+ fprintf(stderr,">> ERREUR : lecture du numero de version de HDF \n");
+ exit(EXIT_FAILURE);
+ }
+ ret = MEDfichEntete(fid,MED_VERSION,version_med);
+ if (ret < 0)
+ {
+ fprintf(stderr,">> ERREUR : lecture du numero de version de MED \n");
+ exit(EXIT_FAILURE);
+ }
+ fprintf(stdout,"- Version de HDF utilisee : %s \n",version_hdf);
+ fprintf(stdout,"- Version de MED utilisee : %s \n",version_med);
+
+ if (argc == 2)
+ {
+ fprintf(stdout,"(*****************)\n");
+ fprintf(stdout,"(* PARAMETRAGE : *)\n");
+ fprintf(stdout,"(*****************)\n");
+ fprintf(stdout,"- Mode d'affichage des coordonnées des noeuds ? \n");
+ fprintf(stdout," 1. Mode entrelacé : taper 1 \n");
+ fprintf(stdout," 2. Mode non entrelacé : taper 2 \n");
+ reponse = 0;
+ do
+ {
+ fprintf(stdout," Reponse : ");
+ scanf("%d",&reponse);
+ }
+ while (reponse != 1 && reponse != 2);
+ if (reponse == 1)
+ mode_coo = MED_FULL_INTERLACE;
+ else
+ mode_coo = MED_NO_INTERLACE;
+
+ fprintf(stdout,"- Connectivité des éléments ? \n");
+ fprintf(stdout," 1. Nodale : taper 1 \n");
+ fprintf(stdout," 2. Descendante : taper 2 \n");
+ reponse = 0;
+ do
+ {
+ fprintf(stdout," Reponse : ");
+ scanf("%d",&reponse);
+ }
+ while (reponse != 1 && reponse != 2);
+ if (reponse == 1)
+ typ_con = MED_NOD;
+ else
+ typ_con = MED_DESC;
+ }
+ else
+ {
+ if (! strcmp(argv[3],"NODALE"))
+ typ_con = MED_NOD;
+ if (! strcmp(argv[3],"DESCENDANTE"))
+ typ_con = MED_DESC;
+
+ if (!strcmp(argv[4],"NO_INTERLACE"))
+ mode_coo = MED_NO_INTERLACE;
+ if (!strcmp(argv[4],"FULL_INTERLACE"))
+ mode_coo = MED_FULL_INTERLACE;
+ if (! strcmp(argv[4],"LECTURE_EN_TETE_SEULEMENT"))
+ lecture_en_tete_seulement = 1;
+
+ }
+
+ /****************************************************************************
+ * QUEL MAILLAGE LIRE *
+ ****************************************************************************/
+ nmaa = MEDnMaa(fid);
+ if (nmaa < 0)
+ {
+ fprintf(stderr,">> ERREUR : lecture du nombre de maillages \n");
+ exit(EXIT_FAILURE);
+ }
+
+ /* Quel maillage lire ? */
+ if (argc == 2)
+ {
+ fprintf(stdout,"- Il y a %d maillages dans ce fichier \n",nmaa);
+ fprintf(stdout," Lequel voulez-vous lire (1|2|3|...|n) ?\n");
+ do
+ {
+ fprintf(stdout," Reponse : ");
+ scanf("%d",&numero);
+ }
+ while (numero > nmaa || numero <= 0);
+ }
+ else
+ {
+ numero = atoi(argv[2]);
+ if (numero > nmaa || numero <= 0)
+ {
+ fprintf(stderr,">> ERREUR : il y a %d maillages dans ce fichier \n",
+ nmaa);
+ exit(EXIT_FAILURE);
+ }
+ }
+
+/*****************************************************************************
+ * QUELLE SORTE DE MAILLAGE : GRILLE OU PAS *
+ *****************************************************************************/
+
+ fprintf(stdout,"\n(**************************************************)\n");
+ fprintf(stdout,"(* MAILLAGE STRUCTURE (GRILLE) OU NON STRUCTURE : *)\n");
+ fprintf(stdout,"(**************************************************)\n");
+
+ /* lecture de la sorte de maillage : structure ou pas */
+ ret = MEDgridInfo(fid, numero, &isGrid, &theType);
+ if (ret < 0) {
+ fprintf(stderr, ">> ERREUR : lecture de la sorte de maillage (structure ou pas)\n");
+ exit(EXIT_FAILURE);
+ };
+ fprintf(stdout, "- Sorte de maillage : %s\n", isGrid? "structure (grille)": "non structure");
+ if (isGrid) {
+ ret = grid(fid, numero, theType, mode_coo);
+ if (ret == 0) {
+ ret = MEDfermer(fid);
+ if (ret == 0) {
+ fprintf(stdout, "\n >>>>>> FIN DU DUMP DU FICHIER %s >>>>>>\n", argv[1]);
+ } else {
+ fprintf(stderr, ">> ERREUR : erreur a la fermeture du fichier %s\n", argv[1]);
+ };
+ };
+ if (ret == 0) {
+ return(0);
+ } else {
+ exit(EXIT_FAILURE);
+ };
+ };
+
+ /****************************************************************************
+ * NOMBRES D'OBJETS MED *
+ ****************************************************************************/
+ fprintf(stdout,"\n(****************************)\n");
+ fprintf(stdout,"(* INFORMATIONS GENERALES : *)\n");
+ fprintf(stdout,"(****************************)\n");
+
+ /* lecture du nom et de la dimension du maillage */
+ ret = MEDmaaInfo(fid,numero,nommaa,&mdim);
+ if (ret < 0)
+ {
+ fprintf(stderr,">> ERREUR : lecture du nom du maillage \n");
+ exit(EXIT_FAILURE);
+ }
+ fprintf(stdout,"- Nom du maillage : <<%s>>\n",nommaa);
+ fprintf(stdout,"- Dimension du maillage : %d\n",mdim);
+
+ /* lecture du nom universel (presence optionnelle) */
+ ret = MEDunvLire(fid,nommaa,nom_universel);
+ if (ret > 0)
+ fprintf(stdout,"- Nom universel du maillage : %s \n",nom_universel);
+ else
+ fprintf(stdout,"- Pas de nom universel \n");
+
+
+ /* Combien de noeuds ? */
+ nnoe = MEDnEntMaa(fid,nommaa,MED_COOR,MED_NOEUD,(med_geometrie_element)0,(med_connectivite)0);
+ if (nnoe < 0)
+ {
+ fprintf(stderr,">> ERREUR : lecture du nombre de noeuds (via MEDnEntMaa) \n");
+ exit(EXIT_FAILURE);
+ }
+ fprintf(stdout,"- Nombre de noeuds : %d \n",nnoe);
+
+ /* Combien de mailles, faces ou aretes ? */
+ for (i=0;i<MED_NBR_GEOMETRIE_MAILLE;i++)
+ {
+ nmailles[i] = MEDnEntMaa(fid,nommaa,MED_CONN,MED_MAILLE,typmai[i],
+ typ_con);
+ if (nmailles[i] < 0)
+ {
+ fprintf(stderr,">> ERREUR : lecture du nombre de mailles \n");
+ exit(EXIT_FAILURE);
+ }
+ fprintf (stdout,"- Nombre de mailles de type %s : %d \n",nommai[i],nmailles[i]);
+ }
+
+ for (i=0;i<MED_NBR_GEOMETRIE_FACE;i++)
+ {
+ nfaces[i] = MEDnEntMaa(fid,nommaa,MED_CONN,MED_FACE,typfac[i],
+ typ_con);
+ if (nfaces[i] < 0)
+ {
+ fprintf(stderr,">> ERREUR : lecture du nombre de faces \n");
+ exit(EXIT_FAILURE);
+ }
+ fprintf (stdout,"- Nombre de faces de type %s : %d \n",nomfac[i],nfaces[i]);
+ }
+
+ for (i=0;i<MED_NBR_GEOMETRIE_ARETE;i++)
+ {
+ naretes[i] = MEDnEntMaa(fid,nommaa,MED_CONN,MED_ARETE,typare[i],
+ typ_con);
+ if (naretes[i] < 0)
+ {
+ fprintf(stderr,">> ERREUR : lecture du nombre d'aretes \n");
+ exit(EXIT_FAILURE);
+ }
+ fprintf (stdout,"- Nombre d'aretes de type %s : %d \n",nomare[i],naretes[i]);
+ }
+
+ /* nombre de familles */
+ nfam = MEDnFam(fid,nommaa,0,(med_dim_famille)0);
+ if (nfam < 0)
+ {
+ fprintf(stderr,">> ERREUR : lecture du nombre de familles \n");
+ exit(EXIT_FAILURE);
+ }
+ fprintf(stdout,"- Nombre de familles : %d \n",nfam);
+
+ /* combien d'equivalences dans le fichier */
+ nequ = MEDnEquiv(fid,nommaa);
+ if (nequ < 0)
+ {
+ fprintf(stderr,">> ERREUR : lecture du nombre d'equivalences \n");
+ exit(EXIT_FAILURE);
+ }
+ fprintf(stdout,"- Nombre d'equivalences : %d \n",nequ);
+
+ /* combien de champs dans le fichier */
+ ncha = MEDnChamp(fid,0);
+ if (ncha < 0)
+ {
+ fprintf(stderr,">> ERREUR : lecture du nombre de champs \n");
+ exit(EXIT_FAILURE);
+ }
+ fprintf(stdout,"- Nombre de champs : %d \n",ncha);
+
+ /* Doit-on s'arreter ? */
+ if (lecture_en_tete_seulement)
+ {
+ ret = MEDfermer(fid);
+ if (ret == 0)
+ {
+ fprintf(stdout,"\n >>>>>> FIN DU DUMP DU FICHIER %s >>>>>>\n",argv[1]);
+ return 0;
+ }
+ else
+ {
+ fprintf(stderr,">> ERREUR : fermeture du fichier %s \n",argv[1]);
+ exit(EXIT_FAILURE);
+ }
+ }
+
+ /****************************************************************************
+ * LECTURE DES NOEUDS *
+ ****************************************************************************/
+ fprintf(stdout,"\n(************************)\n");
+ fprintf(stdout,"(* NOEUDS DU MAILLAGE : *)\n");
+ fprintf(stdout,"(************************)\n");
+
+ /* Allocations memoires */
+ /* table des coordonnees
+ profil : (dimension * nombre de noeuds ) */
+ coo = (med_float*) malloc(sizeof(med_float)*nnoe*mdim);
+ /* table des numeros, des numeros de familles des noeuds
+ profil : (nombre de noeuds) */
+ numnoe = (med_int*) malloc(sizeof(med_int)*nnoe);
+ nufano = (med_int*) malloc(sizeof(med_int)*nnoe);
+ /* table des noms des noeuds
+ profil : (nnoe*MED_TAILLE_PNOM+1) */
+ nomnoe = (char*) malloc(MED_TAILLE_PNOM*nnoe+1);
+
+ /* lecture des noeuds :
+ - coordonnees
+ - noms (optionnel dans un fichier MED)
+ - numeros (optionnel dans un fichier MED)
+ - numeros des familles */
+ ret = MEDnoeudsLire(fid,nommaa,mdim,coo,mode_coo,&rep,
+ nomcoo,unicoo,nomnoe,&inonoe,numnoe,&inunoe,
+ nufano,nnoe);
+ if (ret < 0)
+ strcpy(message,">> ERREUR : lecture des noeuds \n");
+
+ /* affichage des resultats */
+ if (ret == 0)
+ {
+ fprintf(stdout,"- Type de repere des coordonnees : %d \n",rep);
+ fprintf(stdout,"- Nom des coordonnees : \n");
+ for (i=0;i<mdim;i++)
+ {
+ strncpy(str,nomcoo+i*MED_TAILLE_PNOM,MED_TAILLE_PNOM);
+ str[MED_TAILLE_PNOM] = '\0';
+ fprintf(stdout," %s ",str);
+ }
+ fprintf(stdout,"\n- Unites des coordonnees : \n");
+ for (i=0;i<mdim;i++)
+ {
+ strncpy(str,unicoo+i*MED_TAILLE_PNOM,MED_TAILLE_PNOM);
+ str[MED_TAILLE_PNOM] = '\0';
+ fprintf(stdout," %s ",str);
+ }
+ fprintf(stdout,"\n- Coordonnees des noeuds : \n");
+ for (i=0;i<nnoe*mdim;i++)
+ fprintf(stdout," %f ",*(coo+i));
+ if (inonoe)
+ {
+ fprintf(stdout,"\n- Noms des noeuds : \n");
+ for (i=0;i<nnoe;i++)
+ {
+ strncpy(str,nomnoe+i*MED_TAILLE_PNOM,MED_TAILLE_PNOM);
+ str[MED_TAILLE_PNOM] = '\0';
+ fprintf(stdout," %s ",str);
+ }
+ }
+ if (inunoe)
+ {
+ fprintf(stdout,"\n- Numeros des noeuds : \n");
+ for (i=0;i<nnoe;i++)
+ fprintf(stdout," %d ",*(numnoe+i));
+ }
+ fprintf(stdout,"\n- Numeros des familles des noeuds : \n");
+ for (i=0;i<nnoe;i++)
+ fprintf(stdout," %d ",*(nufano+i));
+ fprintf(stdout,"\n");
+ }
+
+ /* liberation memoire */
+ free(coo);
+ free(nomnoe);
+ free(numnoe);
+ free(nufano);
+
+ /****************************************************************************
+ * LECTURE DES ELEMENTS *
+ ****************************************************************************/
+ fprintf(stdout,"\n(**************************)\n");
+ fprintf(stdout,"(* ELEMENTS DU MAILLAGE : *)\n");
+ fprintf(stdout,"(**************************)");
+ /* Lecture des connectivites, noms, numeros des mailles */
+ if (ret == 0)
+ for (i=0;i<MED_NBR_GEOMETRIE_MAILLE;i++)
+ {
+ if (nmailles[i] > 0 && ret == 0)
+ {
+ /* dimension de la maille */
+ edim = typmai[i] / 100;
+ nsup = 0;
+ if (mdim == 2 || mdim == 3)
+ if (edim == 1)
+ nsup = 1;
+ if (mdim == 3)
+ if (edim == 2)
+ nsup = 1;
+ switch(typ_con)
+ {
+ case MED_NOD :
+ taille = nsup+typmai[i]%100;
+ break;
+
+ case MED_DESC :
+ taille = nsup+desmai[i];
+ break;
+
+ default :
+ ret = -1;
+ }
+
+ /* allocation memoire */
+ connectivite = (med_int*)malloc(sizeof(med_int)*
+ taille*nmailles[i]);
+ nomele = (char*)malloc(sizeof(char)*MED_TAILLE_PNOM*
+ nmailles[i]+1);
+ numele = (med_int*)malloc(sizeof(med_int)*
+ nmailles[i]);
+ nufael = (med_int*)malloc(sizeof(med_int)*
+ nmailles[i]);
+
+ /* lecture des données */
+ ret = MEDelementsLire(fid,nommaa,mdim,connectivite,mode_coo,
+ nomele,&inoele,numele,&inuele,nufael,
+ nmailles[i],MED_MAILLE,typmai[i],
+ typ_con);
+ if (ret < 0)
+ strcpy(message,">> ERREUR : lecture des mailles \n");
+
+ /* affichage des resultats */
+ if (ret == 0)
+ {
+ fprintf(stdout,"\n\n- Mailles de type %s : ", nommai[i]);
+ fprintf(stdout,"\n - Connectivité : \n");
+ for (j=0;j<nmailles[i]*taille;j++)
+ fprintf(stdout," %d ",*(connectivite+j));
+ if (inoele)
+ {
+ fprintf(stdout,"\n - Noms : \n");
+ for (j=0;j<nmailles[i];j++)
+ {
+ fprintf(stdout," %d ",*(connectivite+j));
+ strncpy(str,nomele+j*MED_TAILLE_PNOM,MED_TAILLE_PNOM);
+ str[MED_TAILLE_PNOM] = '\0';
+ fprintf(stdout," %s ",str);
+ }
+ }
+ if (inuele)
+ {
+ fprintf(stdout,"\n - Numeros :\n");
+ for (j=0;j<nmailles[i];j++)
+ fprintf(stdout," %d ",*(numele+j));
+ }
+ fprintf(stdout,"\n - Numéros de familles : \n");
+ for (j=0;j<nmailles[i];j++)
+ fprintf(stdout," %d ",*(nufael+j));
+ }
+
+ /* liberation memoire */
+ free(connectivite);
+ free(nomele);
+ free(numele);
+ free(nufael);
+ }
+ }
+
+ if (ret == 0)
+ for (i=0;i<MED_NBR_GEOMETRIE_FACE;i++)
+ {
+ if (nfaces[i] > 0 && ret == 0)
+ {
+ /* dimension de la face */
+ edim = typfac[i] / 100;
+ nsup = 0;
+ if (mdim == 2 || mdim == 3)
+ if (edim == 1)
+ nsup = 1;
+ if (mdim == 3)
+ if (edim == 2)
+ nsup = 1;
+ switch(typ_con)
+ {
+ case MED_NOD :
+ taille = nsup+typfac[i]%100;
+ break;
+
+ case MED_DESC :
+ taille = nsup+desfac[i];
+ break;
+
+ default :
+ ret = -1;
+ }
+
+ /* allocation memoire */
+ connectivite = (med_int*)malloc(sizeof(med_int)*
+ taille*nfaces[i]);
+ nomele = (char*)malloc(sizeof(char)*MED_TAILLE_PNOM*
+ nfaces[i]+1);
+ numele = (med_int*)malloc(sizeof(med_int)*
+ nfaces[i]);
+ nufael = (med_int*)malloc(sizeof(med_int)*
+ nfaces[i]);
+
+ /* lecture des données */
+ ret = MEDelementsLire(fid,nommaa,mdim,connectivite,mode_coo,
+ nomele,&inoele,numele,&inuele,nufael,
+ nfaces[i],MED_FACE,typfac[i],
+ typ_con);
+ if (ret < 0)
+ strcpy(message,">> ERREUR : lecture des faces \n");
+
+ /* affichage des resultats */
+ if (ret == 0)
+ {
+ fprintf(stdout,"\n- Faces de type %s : ", nomfac[i]);
+ fprintf(stdout,"\n - Connectivité : \n");
+ for (j=0;j<nfaces[i]*taille;j++)
+ fprintf(stdout," %d ",*(connectivite+j));
+ if (inoele)
+ {
+ fprintf(stdout,"\n - Noms : \n");
+ for (j=0;j<nfaces[i];j++)
+ {
+ fprintf(stdout," %d ",*(connectivite+j));
+ strncpy(str,nomele+j*MED_TAILLE_PNOM,MED_TAILLE_PNOM);
+ str[MED_TAILLE_PNOM] = '\0';
+ fprintf(stdout," %s ",str);
+ }
+ }
+ if (inuele)
+ {
+ fprintf(stdout,"\n - Numeros :\n");
+ for (j=0;j<nfaces[i];j++)
+ fprintf(stdout," %d ",*(numele+j));
+ }
+ fprintf(stdout,"\n - Numéros de familles : \n");
+ for (j=0;j<nfaces[i];j++)
+ fprintf(stdout," %d ",*(nufael+j));
+ }
+
+ /* liberation memoire */
+ free(connectivite);
+ free(nomele);
+ free(numele);
+ free(nufael);
+ }
+ }
+
+ if (ret == 0)
+ for (i=0;i<MED_NBR_GEOMETRIE_ARETE;i++)
+ {
+ if (naretes[i] > 0 && ret == 0)
+ {
+ /* dimension de l'arete */
+ edim = typare[i] / 100;
+ nsup = 0;
+ if (mdim == 2 || mdim == 3)
+ if (edim == 1)
+ nsup = 1;
+ if (mdim == 3)
+ if (edim == 2)
+ nsup = 1;
+ switch(typ_con)
+ {
+ case MED_NOD :
+ taille = nsup+typare[i]%100;
+ break;
+
+ case MED_DESC :
+ taille = nsup+desare[i];
+ break;
+
+ default :
+ ret = -1;
+ }
+
+ /* allocation memoire */
+ connectivite = (med_int*)malloc(sizeof(med_int)*
+ taille*naretes[i]);
+ nomele = (char*)malloc(sizeof(char)*MED_TAILLE_PNOM*
+ naretes[i]+1);
+ numele = (med_int*)malloc(sizeof(med_int)*
+ naretes[i]);
+ nufael = (med_int*)malloc(sizeof(med_int)*
+ naretes[i]);
+
+ /* lecture des données */
+ ret = MEDelementsLire(fid,nommaa,mdim,connectivite,mode_coo,
+ nomele,&inoele,numele,&inuele,nufael,
+ naretes[i],MED_ARETE,typare[i],
+ typ_con);
+ if (ret < 0)
+ strcpy(message,">> ERREUR : lecture des aretes \n");
+
+ /* affichage des resultats */
+ if (ret == 0)
+ {
+ fprintf(stdout,"\n- Aretes de type %d : ", nomare[i]);
+ fprintf(stdout,"\n - Connectivité : \n");
+ for (j=0;j<naretes[i]*taille;j++)
+ fprintf(stdout," %d ",*(connectivite+j));
+ if (inoele)
+ {
+ fprintf(stdout,"\n - Noms : \n");
+ for (j=0;j<naretes[i];j++)
+ {
+ fprintf(stdout," %d ",*(connectivite+j));
+ strncpy(str,nomele+j*MED_TAILLE_PNOM,MED_TAILLE_PNOM);
+ str[MED_TAILLE_PNOM] = '\0';
+ fprintf(stdout," %s ",str);
+ }
+ }
+ if (inuele)
+ {
+ fprintf(stdout,"\n - Numeros :\n");
+ for (j=0;j<naretes[i];j++)
+ fprintf(stdout," %d ",*(numele+j));
+ }
+ fprintf(stdout,"\n - Numéros de familles : \n");
+ for (j=0;j<naretes[i];j++)
+ fprintf(stdout," %d ",*(nufael+j));
+ }
+
+ /* liberation memoire */
+ free(connectivite);
+ free(nomele);
+ free(numele);
+ free(nufael);
+ }
+ }
+
+ /****************************************************************************
+ * LECTURE DES FAMILLES *
+ ****************************************************************************/
+ printf("\n(*************************)\n");
+ printf("(* FAMILLES DU MAILLAGE : *)\n");
+ printf("(*************************)\n");
+ if (ret == 0)
+ for (i=0;i<nfam;i++)
+ {
+
+ /* nombre de groupes */
+ ngro = MEDnFam(fid,nommaa,i+1,MED_GROUPE);
+ if (ngro < 0)
+ {
+ ret = -1;
+ strcpy(message,
+ ">> ERREUR : lecture du nombre de groupes d'une famille \n");
+ }
+
+ /* nombre d'attributs */
+ if (ret == 0)
+ {
+ natt = MEDnFam(fid,nommaa,i+1,MED_ATTR);
+ if (natt < 0)
+ {
+ ret = -1;
+ strcpy(message,
+ ">> ERREUR : lecture du nombre d'attributs d'une famille\n");
+ }
+ }
+
+ if (ret == 0)
+ fprintf(stdout,"- Famille %d a %d attributs et %d groupes \n",i+1,natt,ngro);
+
+ /* nom,numero,attributs,groupes */
+ if (ret == 0)
+ {
+ attide = (med_int*) malloc(sizeof(med_int)*natt);
+ attval = (med_int*) malloc(sizeof(med_int)*natt);
+ attdes = (char *) malloc(MED_TAILLE_DESC*natt+1);
+ gro = (char*) malloc(MED_TAILLE_LNOM*ngro+1);
+ ret = MEDfamInfo(fid,nommaa,i+1,nomfam,&numfam,attide,attval,
+ attdes,&natt,gro,&ngro);
+ fprintf(stdout," - Famille de nom %s et de numero %d : \n",nomfam,numfam);
+ fprintf(stdout," - Attributs : \n");
+ for (j=0;j<natt;j++)
+ {
+ strncpy(str1,attdes+j*MED_TAILLE_DESC,MED_TAILLE_DESC);
+ str1[MED_TAILLE_DESC] = '\0';
+ fprintf(stdout," ide = %d - val = %d - des = %s\n",*(attide+j),
+ *(attval+j),str1);
+ }
+ free(attide);
+ free(attval);
+ free(attdes);
+ fprintf(stdout," - Groupes :\n");
+ for (j=0;j<ngro;j++)
+ {
+ strncpy(str2,gro+j*MED_TAILLE_LNOM,MED_TAILLE_LNOM);
+ str2[MED_TAILLE_LNOM] = '\0';
+ fprintf(stdout," gro = %s\n",str2);
+ }
+ free(gro);
+ }
+ }
+
+ /****************************************************************************
+ * LECTURE DES EQUIVALENCES *
+ ****************************************************************************/
+ fprintf(stdout,"\n(******************************)\n");
+ fprintf(stdout,"(* EQUIVALENCES DU MAILLAGE : *)\n");
+ fprintf(stdout,"(******************************)\n");
+
+ /* lecture de toutes les equivalences associes a nommaa */
+ if (ret == 0)
+ for (i = 0;i<nequ;i++)
+ {
+ fprintf(stdout,"- Equivalence numero : %d ",i+1);
+
+ /* lecture des infos sur l'equivalence */
+ ret = MEDequivInfo(fid,nommaa,i+1,equ,des);
+ if (ret == 0)
+ {
+ fprintf(stdout,"\n - Nom de l'equivalence: %s \n",equ);
+ fprintf(stdout,"\n - Description de l'equivalence : %s \n",des);
+ }
+ else
+ strcpy(message,">> ERREUR : lecture informations sur equivalence\n");
+
+ /* lecture des correspondances sur les differents types d'entites */
+ if (ret == 0)
+ {
+ /* les noeuds */
+ if ((ncor = MEDnCorres(fid,nommaa,equ,MED_NOEUD,(med_geometrie_element)0)) < 0)
+ {
+ ret = -1;
+ strcpy(message,">> ERREUR : lecture nombre de correspondances\n");
+ }
+ else
+ fprintf(stdout,"\n - Il y a %d correspondances sur les noeuds \n",ncor);
+ if (ncor > 0)
+ {
+ cor = (med_int*) malloc(sizeof(med_int)*ncor*2);
+ ret = MEDequivLire(fid,nommaa,equ,cor,ncor,MED_NOEUD,(med_geometrie_element)0);
+ if (ret == 0)
+ for (j=0;j<ncor;j++)
+ fprintf(stdout,"\n - Correspondance %d : %d et %d \n",j+1,*(cor+2*j),
+ *(cor+2*j+1));
+ else
+ strcpy(message,">> ERREUR : lecture des correspondances\n");
+ free(cor);
+ }
+
+ /* sur les mailles : on ne prend pas en compte les mailles 3D */
+ if (ret ==0)
+ for (j=0;j<NBR_MAILLE_EQU;j++)
+ {
+ if ((ncor = MEDnCorres(fid,nommaa,equ,MED_MAILLE,typmai[j])) < 0)
+ {
+ ret = -1;
+ strcpy(message,
+ ">> ERREUR : lecture informations sur nombre de correspondances \n");
+ }
+ else
+ fprintf(stdout,"\n - Il y a %d correspondances sur les mailles %s \n",ncor,
+ nommai[j]);
+ if (ncor > 0)
+ {
+ cor = (med_int*) malloc(sizeof(med_int)*ncor*2);
+ ret = MEDequivLire(fid,nommaa,equ,cor,ncor,MED_MAILLE,
+ typmai[j]);
+ if (ret == 0)
+ for (k=0;k<ncor;k++)
+ fprintf(stdout,"\n - Correspondance %d : %d et %d \n",k+1,*(cor+2*k),
+ *(cor+2*k+1));
+ else
+ strcpy(message,">> ERREUR : correspondances\n");
+ free(cor);
+ }
+ }
+
+ /* sur les faces */
+ if (ret == 0)
+ for (j=0;j<MED_NBR_GEOMETRIE_FACE;j++)
+ {
+ if ((ncor = MEDnCorres(fid,nommaa,equ,MED_FACE,typfac[j])) < 0)
+ {
+ ret = -1;
+ strcpy(message,">> ERREUR : informations sur correspondances \n");
+ }
+ else
+ fprintf(stdout,"\n - Il y a %d correspondances sur les faces %s\n",ncor,
+ nomfac[j]);
+ if (ncor > 0)
+ {
+ cor = (med_int*) malloc(sizeof(med_int)*ncor*2);
+ ret = MEDequivLire(fid,nommaa,equ,cor,ncor,MED_FACE,
+ typfac[j]);
+ if (ret < 0)
+ strcpy(message,"ERREUR : lecture des equivalences \n");
+ else
+ for (k=0;k<ncor;k++)
+ fprintf(stdout,"\n - Correspondance %d : %d et %d \n",k+1,*(cor+2*k),
+ *(cor+2*k+1));
+ free(cor);
+ }
+ }
+
+ /* sur les aretes */
+ for (j=0;j<MED_NBR_GEOMETRIE_ARETE;j++)
+ {
+ if ((ncor = MEDnCorres(fid,nommaa,equ,MED_ARETE,typare[j])) < 0)
+ {
+ ret = -1;
+ strcpy(message,">> ERREUR : nombre de correspondances \n");
+ }
+ else
+ fprintf(stdout,"\n - Il y a %d correspondances sur les aretes %s \n",
+ ncor,nomare[j]);
+ if (ncor > 0)
+ {
+ cor = (med_int*) malloc(sizeof(med_int)*ncor*2);
+ ret = MEDequivLire(fid,nommaa,equ,cor,ncor,MED_ARETE,
+ typare[j]);
+ if (ret < 0)
+ strcpy(message,">> ERREUR : equivalences \n");
+ else
+ for (k=0;k<ncor;k++)
+ fprintf(stdout,"\n Correspondance %d : %d et %d \n",k+1,*(cor+2*k),
+ *(cor+2*k+1));
+ free(cor);
+ }
+ }
+ }
+ }
+
+ /****************************************************************************
+ * LECTURE DES CHAMPS *
+ ****************************************************************************/
+ fprintf(stdout,"\n(************************)\n");
+ fprintf(stdout,"(* CHAMPS DU MAILLAGE : *)\n");
+ fprintf(stdout,"(************************)\n");
+
+ if (ret == 0)
+ for (i=0;i<ncha;i++)
+ {
+ fprintf(stdout,"- Champ numero : %d \n",i+1);
+
+ /* combien de composantes */
+ if ((ncomp = MEDnChamp(fid,i+1)) < 0)
+ {
+ ret = -1;
+ strcpy(message,">> ERREUR : nombre de composants d'un champ\n");
+ }
+
+ /* allocation memoire de comp et unit*/
+ if (ret == 0)
+ {
+ comp = (char*) malloc(ncomp*MED_TAILLE_PNOM+1);
+ unit = (char*) malloc(ncomp*MED_TAILLE_PNOM+1);
+ }
+
+ /* infos sur les champs */
+ if (ret == 0)
+ ret = MEDchampInfo(fid,i+1,nomcha,&typcha,comp,unit,ncomp);
+ if (ret < 0)
+ strcpy(message,">> ERREUR : information sur les champs \n");
+
+ if (ret == 0) {
+ fprintf(stdout," - Nom du champ : %s de type %d\n",nomcha,typcha);
+ fprintf(stdout," - Nom des composantes : %s\n",comp);
+ fprintf(stdout," - Unites des composantes : %s \n",unit);
+ free(comp);
+ free(unit);
+ }
+
+
+ if (ret == 0) /* Valeurs sur les noeuds */
+ {
+ /* Combien de pas de temps ? */
+ npdt = MEDnPasdetemps(fid,nomcha,MED_NOEUD,(med_geometrie_element)0);
+ if (npdt < 0)
+ ret = -1;
+ if (ret == -1)
+ strcpy(message,">> ERREUR : la lecture du nombe de pas de temps");
+ else
+ fprintf(stdout,"\n - Il y a %d pas de temps sur les noeuds \n",npdt);
+
+ /* Lecture des valeurs pour tous les pas de temps */
+ if (ret == 0)
+ for (j=0;j<npdt;j++)
+ {
+ /* Informations sur les pas de temps */
+ if (ret == 0)
+ ret = MEDpasdetempsInfo(fid,nomcha,MED_NOEUD,(med_geometrie_element)0,
+ j+1, maillage_champ, &ngauss, &numdt, dtunit, &dt, &numo);
+
+ if (ret == 0 && (! strcmp(maillage_champ,nommaa)))
+ fprintf(stdout,"\n -> \tPas de Temps n° %4i (%f), N°d'ordre %4i, avec %i pts de gauss\n",
+ numdt,dt,numo,ngauss);
+ else
+ strcpy(message,">> ERREUR : information sur les pas de temps \n");
+
+ /* Combien de valeurs a lire ? */
+ if (ret == 0 && (! strcmp(maillage_champ,nommaa)))
+ {
+ if ((nval = MEDnVal(fid,nomcha,MED_NOEUD,(med_geometrie_element)0,numdt,numo)) < 0)
+ {
+ ret = -1;
+ strcpy(message,">> ERREUR : nombre de valeurs d'un champ\n");
+ }
+ else
+ fprintf(stdout,"\n - Il y a %d valeurs sur les noeuds \n",nval);
+ }
+
+ if (ret == 0 && (! strcmp(maillage_champ,nommaa)))
+ {
+ if (typcha == MED_REEL64)
+ {
+ valr = (med_float*) malloc(sizeof(med_float)*ncomp*nval);
+ ret = MEDchampLire(fid,nommaa,nomcha,(unsigned char*)valr,mode_coo,MED_ALL,
+ pflnom,MED_NOEUD,(med_geometrie_element)0,numdt,numo);
+
+ if (ret < 0)
+ strcpy(message,">> ERREUR : lecture des champs \n");
+ else
+ for (k=0;k<nval*ncomp;k++)
+ fprintf(stdout," %f ",*(valr+k));
+ free(valr);
+ }
+ else
+ {
+ vale = (med_int*) malloc(sizeof(med_int)*ncomp*nval);
+ ret = MEDchampLire(fid,nommaa,nomcha,(unsigned char*)vale,mode_coo,MED_ALL,
+ pflnom,MED_NOEUD,(med_geometrie_element)0,numdt,numo);
+ if (ret < 0)
+ strcpy(message,">> ERREUR : lecture des champs \n");
+ else
+ for (k=0;k<nval*ncomp;k++)
+ fprintf(stdout," %d ",*(vale+k));
+ free(vale);
+ }
+
+ /* Lecture d'un profil eventuel */
+ if (strcmp(pflnom,MED_NOPFL) == 0 )
+ fprintf(stdout,"\n \t- Pas de profil\n");
+ else
+ {
+ if ( (pflsize = MEDnValProfil(fid,pflnom)) <0)
+ {
+ ret = -1;
+ strcpy(message,">> ERREUR : lecture de la taille du profil \n");
+ }
+ else
+ {
+ fprintf(stdout,"\n \t- Profil : %s de taille %i\n",pflnom,pflsize);
+ pflval = (med_int*) malloc(sizeof(med_int)*pflsize);
+
+ if ( (ret = MEDprofilLire(fid,pflval,pflnom)) <0)
+ strcpy(message,">> ERREUR : lecture du profil \n");
+ else
+ for (l=0;l<pflsize;l++)
+ fprintf(stdout,"\t%i\n",*(pflval+l));
+
+ free(pflval);
+ }
+ }
+ }
+ }
+ }
+
+
+ if (ret == 0) /* Valeurs sur les mailles */
+ {
+ for (k=0;k<MED_NBR_GEOMETRIE_MAILLE;k++)
+ {
+ typgeo = typmai[k];
+
+ /* Combien de pas de temps ? */
+ npdt = MEDnPasdetemps(fid,nomcha,MED_MAILLE,typgeo);
+ if (npdt < 0)
+ ret = -1;
+ if (ret == -1)
+ strcpy(message,">> ERREUR : la lecture du nombe de pas de temps");
+ else
+ fprintf(stdout,"\n - Il y a %d pas de temps sur les mailles de type %d \n",npdt,typgeo);
+
+ /* Lecture des valeurs pour tous les pas de temps */
+ if (ret == 0)
+ for (j=0;j<npdt;j++)
+ {
+ /* Informations sur les pas de temps */
+ if (ret == 0)
+ ret = MEDpasdetempsInfo(fid,nomcha,MED_MAILLE,typgeo,
+ j+1, maillage_champ, &ngauss, &numdt, dtunit, &dt, &numo);
+
+ if (ret == 0 && (! strcmp(maillage_champ,nommaa)))
+ fprintf(stdout,"\n -> \tPas de Temps n° %4i (%f), N°d'ordre %4i, avec %i pts de gauss\n",
+ numdt,dt,numo,ngauss);
+ else
+ strcpy(message,">> ERREUR : information sur les pas de temps \n");
+
+ /* Combien de valeurs a lire ? */
+ if (ret == 0 && (! strcmp(maillage_champ,nommaa)))
+ {
+ if ((nval = MEDnVal(fid,nomcha,MED_MAILLE,typgeo,numdt,numo)) < 0)
+ {
+ ret = -1;
+ strcpy(message,">> ERREUR : nombre de valeurs d'un champ\n");
+ }
+ else
+ fprintf(stdout,"\n - Il y a %d valeurs sur les noeuds \n",nval);
+ }
+
+ if (ret == 0 && (! strcmp(maillage_champ,nommaa)))
+ {
+ if (typcha == MED_REEL64)
+ {
+ valr = (med_float*) malloc(sizeof(med_float)*ncomp*nval);
+ ret = MEDchampLire(fid,nommaa,nomcha,(unsigned char*)valr,mode_coo,MED_ALL,
+ pflnom,MED_MAILLE,typgeo,numdt,numo);
+ if (ret < 0)
+ strcpy(message,">> ERREUR : lecture des champs \n");
+ else
+ for (kp=0;kp<nval*ncomp;kp++)
+ fprintf(stdout," %f ",*(valr+kp));
+ free(valr);
+ }
+ else
+ {
+ vale = (med_int*) malloc(sizeof(med_int)*ncomp*nval);
+ ret = MEDchampLire(fid,nommaa,nomcha,(unsigned char*)vale,mode_coo,MED_ALL,
+ pflnom,MED_MAILLE,typgeo,numdt,numo);
+ if (ret < 0)
+ strcpy(message,">> ERREUR : lecture des champs \n");
+ else
+ for (kp=0;kp<nval*ncomp;kp++)
+ fprintf(stdout," %d ",*(vale+kp));
+ free(vale);
+ }
+
+ /* Lecture d'un profil eventuel */
+ if (strcmp(pflnom,MED_NOPFL) == 0 )
+ fprintf(stdout,"\n \t- Pas de profil\n");
+ else
+ {
+ if ( (pflsize = MEDnValProfil(fid,pflnom)) <0)
+ {
+ ret = -1;
+ strcpy(message,">> ERREUR : lecture de la taille du profil \n");
+ }
+ else
+ {
+ fprintf(stdout,"\n \t- Profil : %s de taille %i\n",pflnom,pflsize);
+ pflval = (med_int*) malloc(sizeof(med_int)*pflsize);
+
+ if ( (ret = MEDprofilLire(fid,pflval,pflnom)) <0)
+ strcpy(message,">> ERREUR : lecture du profil \n");
+ else
+ for (l=0;l<pflsize;l++)
+ fprintf(stdout,"\t%i\n",*(pflval+l));
+
+ free(pflval);
+ }
+ }
+ }
+ }
+ }
+ }
+
+
+ if (ret == 0) /* Valeurs sur les faces */
+ {
+ for (k=0;k<MED_NBR_GEOMETRIE_FACE;k++)
+ {
+ typgeo = typfac[k];
+
+ /* Combien de pas de temps ? */
+ npdt = MEDnPasdetemps(fid,nomcha,MED_FACE,typgeo);
+ if (npdt < 0)
+ ret = -1;
+ if (ret == -1)
+ strcpy(message,">> ERREUR : la lecture du nombe de pas de temps");
+ else
+ fprintf(stdout,"\n - Il y a %d pas de temps sur les faces de type %d \n",npdt,typgeo);
+
+ /* Lecture des valeurs pour tous les pas de temps */
+ if (ret == 0)
+ for (j=0;j<npdt;j++)
+ {
+ /* Informations sur les pas de temps */
+ if (ret == 0)
+ ret = MEDpasdetempsInfo(fid,nomcha,MED_FACE,typgeo,
+ j+1, maillage_champ, &ngauss, &numdt, dtunit, &dt, &numo);
+
+ if (ret == 0 && (! strcmp(maillage_champ,nommaa)))
+ fprintf(stdout,"\n -> \tPas de Temps n° %4i (%f), N°d'ordre %4i, avec %i pts de gauss\n",
+ numdt,dt,numo,ngauss);
+ else
+ strcpy(message,">> ERREUR : information sur les pas de temps \n");
+
+ /* Combien de valeurs a lire ? */
+ if (ret == 0 && (! strcmp(maillage_champ,nommaa)))
+ {
+ if ((nval = MEDnVal(fid,nomcha,MED_FACE,typgeo,numdt,numo)) < 0)
+ {
+ ret = -1;
+ strcpy(message,">> ERREUR : nombre de valeurs d'un champ\n");
+ }
+ else
+ fprintf(stdout,"\n - Il y a %d valeurs sur les noeuds \n",nval);
+ }
+
+ if (ret == 0 && (! strcmp(maillage_champ,nommaa)))
+ {
+ if (typcha == MED_REEL64)
+ {
+ valr = (med_float*) malloc(sizeof(med_float)*ncomp*nval);
+ ret = MEDchampLire(fid,nommaa,nomcha,(unsigned char*)valr,mode_coo,MED_ALL,
+ pflnom,MED_FACE,typgeo,numdt,numo);
+ if (ret < 0)
+ strcpy(message,">> ERREUR : lecture des champs \n");
+ else
+ for (kp=0;kp<nval*ncomp;kp++)
+ fprintf(stdout," %f ",*(valr+kp));
+ free(valr);
+ }
+ else
+ {
+ vale = (med_int*) malloc(sizeof(med_int)*ncomp*nval);
+ ret = MEDchampLire(fid,nommaa,nomcha,(unsigned char*)vale,mode_coo,MED_ALL,
+ pflnom,MED_FACE,typgeo,numdt,numo);
+ if (ret < 0)
+ strcpy(message,">> ERREUR : lecture des champs \n");
+ else
+ for (kp=0;kp<nval*ncomp;kp++)
+ fprintf(stdout," %d ",*(vale+kp));
+ free(vale);
+ }
+
+ /* Lecture d'un profil eventuel */
+ if (strcmp(pflnom,MED_NOPFL) == 0 )
+ fprintf(stdout,"\n \t- Pas de profil\n");
+ else
+ {
+ if ( (pflsize = MEDnValProfil(fid,pflnom)) <0)
+ {
+ ret = -1;
+ strcpy(message,">> ERREUR : lecture de la taille du profil \n");
+ }
+ else
+ {
+ fprintf(stdout,"\n \t- Profil : %s de taille %i\n",pflnom,pflsize);
+ pflval = (med_int*) malloc(sizeof(med_int)*pflsize);
+
+ if ( (ret = MEDprofilLire(fid,pflval,pflnom)) <0)
+ strcpy(message,">> ERREUR : lecture du profil \n");
+ else
+ for (l=0;l<pflsize;l++)
+ fprintf(stdout,"\t%i\n",*(pflval+l));
+
+ free(pflval);
+ }
+ }
+ }
+ }
+ }
+ }
+
+
+ if (ret == 0) /* Valeurs sur les aretes */
+ {
+ for (k=0;k<MED_NBR_GEOMETRIE_ARETE;k++)
+ {
+ typgeo = typare[k];
+
+ /* Combien de pas de temps ? */
+ npdt = MEDnPasdetemps(fid,nomcha,MED_ARETE,typgeo);
+ if (npdt < 0)
+ ret = -1;
+ if (ret == -1)
+ strcpy(message,">> ERREUR : la lecture du nombe de pas de temps");
+ else
+ fprintf(stdout,"\n - Il y a %d pas de temps sur les aretes de type %d \n",npdt,typgeo);
+
+ /* Lecture des valeurs pour tous les pas de temps */
+ if (ret == 0)
+ for (j=0;j<npdt;j++)
+ {
+ /* Informations sur les pas de temps */
+ if (ret == 0)
+ ret = MEDpasdetempsInfo(fid,nomcha,MED_ARETE,typgeo,
+ j+1, maillage_champ, &ngauss, &numdt, dtunit, &dt, &numo);
+
+ if (ret == 0 && (! strcmp(maillage_champ,nommaa)))
+ fprintf(stdout,"\n -> \tPas de Temps n° %4i (%f), N°d'ordre %4i, avec %i pts de gauss\n",
+ numdt,dt,numo,ngauss);
+ else
+ strcpy(message,">> ERREUR : information sur les pas de temps \n");
+
+ /* Combien de valeurs a lire ? */
+ if (ret == 0 && (! strcmp(maillage_champ,nommaa)))
+ {
+ if ((nval = MEDnVal(fid,nomcha,MED_ARETE,typgeo,numdt,numo)) < 0)
+ {
+ ret = -1;
+ strcpy(message,">> ERREUR : nombre de valeurs d'un champ\n");
+ }
+ else
+ fprintf(stdout,"\n - Il y a %d valeurs sur les noeuds \n",nval);
+ }
+
+ if (ret == 0 && (! strcmp(maillage_champ,nommaa)))
+ {
+ if (typcha == MED_REEL64)
+ {
+ valr = (med_float*) malloc(sizeof(med_float)*ncomp*nval);
+ ret = MEDchampLire(fid,nommaa,nomcha,(unsigned char*)valr,mode_coo,MED_ALL,
+ pflnom,MED_ARETE,typgeo,numdt,numo);
+ if (ret < 0)
+ strcpy(message,">> ERREUR : lecture des champs \n");
+ else
+ for (kp=0;kp<nval*ncomp;kp++)
+ fprintf(stdout," %f ",*(valr+kp));
+ free(valr);
+ }
+ else
+ {
+ vale = (med_int*) malloc(sizeof(med_int)*ncomp*nval);
+ ret = MEDchampLire(fid,nommaa,nomcha,(unsigned char*)vale,mode_coo,MED_ALL,
+ pflnom,MED_ARETE,typgeo,numdt,numo);
+ if (ret < 0)
+ strcpy(message,">> ERREUR : lecture des champs \n");
+ else
+ for (kp=0;kp<nval*ncomp;kp++)
+ fprintf(stdout," %d ",*(vale+kp));
+ free(vale);
+ }
+
+ /* Lecture d'un profil eventuel */
+ if (strcmp(pflnom,MED_NOPFL) == 0 )
+ fprintf(stdout,"\n \t- Pas de profil\n");
+ else
+ {
+ if ( (pflsize = MEDnValProfil(fid,pflnom)) <0)
+ {
+ ret = -1;
+ strcpy(message,">> ERREUR : lecture de la taille du profil \n");
+ }
+ else
+ {
+ fprintf(stdout,"\n \t- Profil : %s de taille %i\n",pflnom,pflsize);
+ pflval = (med_int*) malloc(sizeof(med_int)*pflsize);
+
+ if ( (ret = MEDprofilLire(fid,pflval,pflnom)) <0)
+ strcpy(message,">> ERREUR : lecture du profil \n");
+ else
+ for (l=0;l<pflsize;l++)
+ fprintf(stdout,"\t%i\n",*(pflval+l));
+
+ free(pflval);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ }
+
+ if (ret < 0)
+ fprintf(stderr,"%s\n",message);
+
+ /****************************************************************************
+ * FERMETURE DU FICHIER *
+ ****************************************************************************/
+ ret = MEDfermer(fid);
+
+ if (ret == 0)
+ fprintf(stdout,"\n >>>>>> FIN DU DUMP DU FICHIER %s >>>>>>\n",argv[1]);
+ else
+ fprintf(stderr,">> ERREUR : erreur a la fermeture du fichier %s\n",argv[1]);
+
+ return 0;
+}
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2003 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#ifndef MED_H
+#define MED_H
+
+extern "C"{
+#include <hdf5.h>
+}
+
+namespace med_2_1{
+
+#define MED_NULL (void *) NULL
+#define MED_MAX_PARA 20
+
+#define MED_TAILLE_DESC 200
+#define MED_TAILLE_IDENT 8
+#define MED_TAILLE_NOM 32
+#define MED_TAILLE_LNOM 80
+#define MED_TAILLE_PNOM 8
+
+/* Integration des developpements OCC */
+typedef enum {MED_CARTESIAN, MED_POLAR, MED_BODY_FITTED} med_grid_type;
+
+typedef enum {MED_GRID_D1=0, MED_GRID_D2=1, MED_GRID_D3=2,
+ MED_GRID_NOEUD=3,
+ MED_FAM_NOEUD=4, MED_FAM_ARETE=5, MED_FAM_FACE=6, MED_FAM_MAILLE=7 } med_grid;
+
+/* Fin de l'integration*/
+
+typedef enum {MED_FULL_INTERLACE,
+ MED_NO_INTERLACE} med_mode_switch;
+
+typedef enum {MED_GLOBALE,
+ MED_COMPACT } med_mode_profil;
+
+typedef enum {MED_LECT,MED_ECRI,MED_REMP} med_mode_acces;
+
+typedef enum {MED_MAILLE, MED_FACE, MED_ARETE, MED_NOEUD} med_entite_maillage;
+
+typedef enum {MED_COOR, MED_CONN, MED_NOM, MED_NUM, MED_FAM} med_table;
+
+typedef enum {MED_REEL64=6, MED_INT32=24,MED_INT64=26, MED_INT} med_type_champ;
+
+#define MED_NBR_GEOMETRIE_MAILLE 15
+#define MED_NBR_GEOMETRIE_FACE 4
+#define MED_NBR_GEOMETRIE_ARETE 2
+typedef enum {MED_POINT1=1, MED_SEG2=102, MED_SEG3=103, MED_TRIA3=203,
+ MED_QUAD4=204, MED_TRIA6=206,MED_QUAD8=208, MED_TETRA4=304,
+ MED_PYRA5=305, MED_PENTA6=306, MED_HEXA8=308, MED_TETRA10=310,
+ MED_PYRA13=313, MED_PENTA15=315, MED_HEXA20=320}
+med_geometrie_element;
+
+typedef enum {MED_NOD, MED_DESC} med_connectivite ;
+
+typedef enum {MED_CART, MED_CYL, MED_SPHER} med_repere;
+
+typedef enum {MED_FAUX, MED_VRAI} med_booleen ;
+
+typedef enum {MED_GROUPE, MED_ATTR, MED_FAMILLE} med_dim_famille;
+
+typedef enum {MED_COMP, MED_DTYPE} med_dim_champ;
+
+typedef enum {MED_HDF_VERSION, MED_VERSION, MED_FICH_DES} med_fich_info;
+
+#define MED_NOPG 1 /* -> pas de point de Gauss */
+#define MED_NOPFL "" /* -> pas de profils utilisateur */
+#define MED_NOPFLi " " /* Variable Interne */
+#define MED_NOPF 0 /* -> pas de profils pour _MEDdataseNnumEcrire */
+#define MED_NOPDT -1 /* rem: pas de pas de temps negatifs */
+#define MED_NONOR -1 /* rem: pas de n°ordre negatif */
+#define MED_DIM1 1 /* PAS */
+#define MED_ALL 0
+
+#if defined(SUN4SOL2) || defined(PCLINUX) || defined(OSF1_32) || defined(IRIX64_32) || defined(RS6000)
+/* interface C/FORTRAN */
+/* this true only with g77 and gcc : we must change it to use directly NOMF_... and INT32 or INT64 -
+ it will be more simple to understand and to use ! */
+#define NOMF_POST_UNDERSCORE
+
+/* correspondance des types avec HDF 5 */
+typedef hsize_t med_size;
+typedef hssize_t med_ssize;
+typedef hid_t med_idt;
+typedef herr_t med_err;
+
+/* types elementaires */
+typedef int med_int;
+typedef double med_float;
+#endif
+
+#if defined(HP9000)
+/* correspondance des types avec HDF 5 */
+typedef hsize_t med_size;
+typedef hssize_t med_ssize;
+typedef hid_t med_idt;
+typedef herr_t med_err;
+
+/* types elementaires */
+typedef int med_int;
+typedef double med_float;
+#endif
+
+#if defined(IRIX64) || defined(OSF1)
+#define NOMF_POST_UNDERSCORE
+
+/* correspondance des types avec HDF 5 */
+typedef hsize_t med_size;
+typedef hssize_t med_ssize;
+typedef hid_t med_idt;
+typedef herr_t med_err;
+
+/* types elementaires */
+typedef long med_int;
+typedef double med_float;
+#endif
+
+
+#if defined(PPRO_NT)
+/* correspondance des types avec HDF 5 */
+typedef hsize_t med_size;
+typedef hssize_t med_ssize;
+typedef hid_t med_idt;
+typedef herr_t med_err;
+
+/* types elementaires */
+typedef int med_int;
+typedef double med_float;
+#endif
+
+
+#if defined(NOMF_PRE_UNDERSCORE) && defined(NOMF_POST_UNDERSCORE)
+# define NOMF(x) _##x##_
+#endif
+#if defined(NOMF_PRE_UNDERSCORE) && !defined(NOMF_POST_UNDERSCORE)
+# define NOMF(x) _##x
+#endif
+#if !defined(NOMF_PRE_UNDERSCORE) && defined(NOMF_POST_UNDERSCORE)
+# define NOMF(x) x##_
+#endif
+#if !defined(NOMF_PRE_UNDERSCORE) && !defined(NOMF_POST_UNDERSCORE)
+# define NOMF(x) x
+#endif
+
+}
+
+#include "med_proto.hxx"
+
+#endif /* MED_H */
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#ifndef MED_HDFI_H
+#define MED_HDFI_H
+#include "med.hxx"
+
+/* FONCTIONS INTERFACE MED/HDF */
+namespace med_2_1{
+
+/* Gestion des fichiers HDF */
+extern
+med_idt _MEDfichierCreer(char *nom);
+
+extern
+med_idt _MEDfichierOuvrir(char *nom,med_mode_acces mode);
+
+extern
+med_err _MEDfichierFermer(med_idt fid);
+
+
+/* Gestion des datagroups HDF */
+extern
+med_idt _MEDdatagroupCreer(med_idt pid, char *nom);
+
+extern
+med_idt _MEDdatagroupOuvrir(med_idt pid, char *nom);
+
+extern
+med_err _MEDdatagroupFermer(med_idt id);
+
+
+/* Gestion des datasets HDF */
+
+extern
+med_idt _MEDdatasetOuvrir(med_idt pid,char *nom);
+
+extern
+med_err _MEDdatasetFermer(med_idt id);
+
+extern
+med_err _MEDdatasetNumEcrire (med_idt pere,char *nom, med_type_champ type,
+ med_mode_switch interlace, med_size nbdim, med_size fixdim,
+ med_size psize, med_ssize * profil, med_int ngauss,
+ med_size *size, unsigned char *val, med_mode_acces mode);
+
+
+extern
+med_err _MEDdatasetNumLire(med_idt pere,char *nom,med_type_champ type,
+ med_mode_switch interlace, med_size nbdim, med_size fixdim,
+ med_size psize, med_ssize * pfltab, med_int ngauss,
+ unsigned char *val);
+
+extern
+med_err _MEDdatasetStringEcrire(med_idt pere,char *nom,med_size *dimd,
+ char *val, med_mode_acces mode);
+
+extern
+med_err _MEDdatasetStringLire(med_idt pere,char *nom,char *val);
+
+/* Gestion des attributs HDF */
+extern
+med_idt _MEDattrOuvrir(med_idt pid,char * nom);
+
+extern
+med_err _MEDattrFermer(med_idt id);
+
+extern
+med_err _MEDattrNumEcrire(med_idt pere,med_type_champ type,char *nom,unsigned char *val,med_mode_acces mode);
+
+#define _MEDattrEntierEcrire(w,x,y,z) _MEDattrNumEcrire(w,MED_INT ,x,(unsigned char *) y,z)
+#define _MEDattrFloatEcrire(w,x,y,z) _MEDattrNumEcrire(w,MED_REEL64,x,(unsigned char *) y,z)
+
+extern
+med_err _MEDattrNumLire(med_idt pere,med_type_champ type,char *nom,unsigned char *val);
+
+#define _MEDattrEntierLire(x,y,z) _MEDattrNumLire(x,MED_INT ,y,(unsigned char*)z)
+#define _MEDattrFloatLire(x,y,z) _MEDattrNumLire(x,MED_REEL64,y,(unsigned char*)z)
+
+extern
+med_err _MEDattrStringEcrire(med_idt pere,char *nom,int longueur,char *val,med_mode_acces mode);
+
+extern
+med_err _MEDattrStringLire(med_idt pere,char *nom,int longueur,char *val);
+
+
+/* Divers */
+extern
+med_err _MEDindiceInfo(med_idt id, const char *nom, void *donnees);
+
+extern
+med_err _MEDindiceNum(med_idt id,const char *nom, void *donnees);
+
+extern
+med_err _MEDobjetIdentifier(med_idt fid,char *chemin,int indice,void *nom);
+
+extern
+med_err _MEDnObjets(med_idt fid,char *chemin,int *n);
+
+extern
+void _MEDmodeErreurVerrouiller();
+
+}
+
+#endif /* MED_HDFI_H */
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#ifndef MED_MISC_H
+#define MED_MISC_H
+#include "med.hxx"
+
+
+/* CHAINES DE CARACTERES FORTRAN => C */
+namespace med_2_1{
+
+extern
+char *_MED1cstring(char *chaine,int longueur_reelle,int longueur_fixee);
+
+extern
+char *_MED2cstring(char *chaine, int longueur);
+
+extern
+med_err _MEDcstringFree(char *chaine);
+
+extern
+med_err _MEDfstring(char *chaine, med_int longueur_fixee);
+
+/* Noms associes aux objets MED */
+extern
+med_err _MEDnomEntite(char *nom_ent,med_entite_maillage type_ent);
+
+extern
+med_err _MEDnomGeometrie(char *nom_geo,med_geometrie_element type_geo);
+
+extern
+med_err _MEDparametresGeometrie(med_entite_maillage type_ent,
+ med_geometrie_element type_geo, int *dim, int *nnoe,
+ int *ndes);
+extern
+med_err _MEDnomDataset(char *nom_dataset,med_table quoi,
+ med_connectivite type_conn);
+
+/* Geometrie des objets MED */
+extern
+med_err _MEDGeometrieElement(med_geometrie_element typ_geo[],
+ med_entite_maillage typ_ent);
+
+}
+
+#endif /* MED_MISC_H */
+
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2003 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#ifndef MED_OUTILS_H
+#define MED_OUTILS_H
+#include "med.hxx"
+
+#define MED_NOM_MAJEUR "MAJ"
+#define MED_NOM_MINEUR "MIN"
+#define MED_NOM_RELEASE "REL"
+
+#define MED_NUM_MAJEUR 2
+#define MED_NUM_MINEUR 1
+#define MED_NUM_RELEASE 6
+
+#define MED_NOM_INFOS "INFOS_GENERALES"
+
+#define MED_NOM_DESCRIPTEUR "descripteur de fichier"
+#define MED_VERSION_ACTUELLE "2.1.6"
+#define HDF_VERSION_ACTUELLE "5-1.4.4"
+
+/* Noms des data sets ou attributs correspondant a des entites MED */
+#define MED_TAILLE_NOM_ENTITE 3
+#define MED_NOM_NUM "NUM"
+#define MED_NOM_NBR "NBR"
+#define MED_NOM_NOM "NOM"
+#define MED_NOM_UNV "UNV"
+#define MED_NOM_NNS "NNS"
+#define MED_NOM_NNM "NNM"
+#define MED_NOM_NNI "NNI"
+#define MED_NOM_GRO "GRO"
+#define MED_NOM_ATT "ATT"
+#define MED_NOM_NCO "NCO"
+#define MED_NOM_DIM "DIM"
+#define MED_NOM_FAM "FAM"
+#define MED_NOM_IDE "IDE"
+#define MED_NOM_VAL "VAL"
+#define MED_NOM_DES "DES"
+#define MED_NOM_COR "COR"
+#define MED_NOM_DIM "DIM"
+#define MED_NOM_NOE "NOE"
+#define MED_NOM_COO "COO"
+#define MED_NOM_REP "REP"
+#define MED_NOM_UNI "UNI"
+#define MED_NOM_NOD "NOD"
+#define MED_NOM_TYP "TYP"
+#define MED_NOM_CO "CO"
+#define MED_NOM_NCW "NCW"
+#define MED_NOM_TYW "TYW"
+#define MED_NOM_MAI "MAI"
+#define MED_NOM_FAC "FAC"
+#define MED_NOM_ARE "ARE"
+#define MED_NOM_PO1 "PO1"
+#define MED_NOM_SE2 "SE2"
+#define MED_NOM_SE3 "SE3"
+#define MED_NOM_TR3 "TR3"
+#define MED_NOM_TR6 "TR6"
+#define MED_NOM_QU4 "QU4"
+#define MED_NOM_QU8 "QU8"
+#define MED_NOM_TE4 "TE4"
+#define MED_NOM_T10 "T10"
+#define MED_NOM_HE8 "HE8"
+#define MED_NOM_H20 "H20"
+#define MED_NOM_PE6 "PE6"
+#define MED_NOM_P15 "P15"
+#define MED_NOM_PY5 "PY5"
+#define MED_NOM_P13 "P13"
+
+#define MED_NOM_GEO "GEO"
+#define MED_NOM_GAU "GAU"
+#define MED_NOM_NGA "NGA"
+#define MED_NOM_N "N"
+#define MED_NOM_PFL "PFL"
+#define MED_NOM_NDT "NDT"
+#define MED_NOM_PDT "PDT"
+#define MED_NOM_NOR "NOR"
+
+/* Integration des developpements OCC */
+#define MED_NOM_GRD "GRD"
+#define MED_NOM_BOF "BOF"
+#define MED_NOM_IN1 "IN1"
+#define MED_NOM_IN2 "IN2"
+#define MED_NOM_IN3 "IN3"
+
+/* Nom du DATA GROUP CONTENANT TOUS LES MAILLAGES DU FICHIER HDF */
+#define MED_MAA "/ENS_MAA/"
+#define MED_TAILLE_MAA 9
+
+/* Nom du data group ou ranger les champs solution */
+#define MED_CHA "/CHA/"
+#define MED_TAILLE_CHA 5
+
+/* Nom du data group ou ranger les familles */
+#define MED_FAS "/FAS/"
+#define MED_TAILLE_FAS 5
+
+/* Nom du data group ou ranger les equivalences */
+#define MED_EQS "/EQS/"
+#define MED_TAILLE_EQS 5
+
+/* Nom du data groupe contenant les profils */
+#define MED_PROFILS "/PROFILS/"
+#define MED_TAILLE_PROFILS 9
+
+/*Pour eviter le bug solaris*/
+#include <malloc.h>
+
+/* Interface des routines du composant tools */
+#include "med_misc.hxx"
+#include "med_hdfi.hxx"
+#include "med_utils.hxx"
+#endif /* MED_OUTILS_H */
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+#ifndef MED_PROTO_H
+#define MED_PROTO_H
+
+/* Interface de l'API MED */
+namespace med_2_1{
+/* Fichier */
+extern med_idt
+MEDouvrir(char *nom, med_mode_acces mode_acces);
+extern med_err
+MEDfermer(med_idt fid);
+extern med_int
+MEDlFichDes(med_idt fid);
+extern med_err
+MEDfichEntete(med_idt fid, med_fich_info quoi, char str[]);
+extern med_err
+MEDfichDesEcr(med_idt fid, char *des, med_mode_acces mode);
+extern med_err
+MEDunvCr(med_idt fid, char *maa);
+extern med_err
+MEDunvLire(med_idt fid, char *maa,char *nomu);
+extern med_err
+MEDformatConforme(const char * nomfich);
+extern med_err
+MEDversionConforme(const char *nom);
+extern void
+MEDversionDonner(med_int *majeur, med_int *mineur, med_int *release);
+extern med_err
+MEDversionLire(med_idt fid, med_int *majeur, med_int *mineur, med_int *release);
+
+
+
+/* Maillage */
+extern med_err
+MEDmaaCr(med_idt fid, char *maillage, med_int dim);
+extern med_int
+MEDdimLire(med_idt fid, char *maillage);
+extern med_err
+MEDmaaInfo(med_idt fid, int indice, char *maillage, med_int *dim);
+extern med_int
+MEDnMaa(med_idt fid);
+extern med_err
+MEDnbnosoEcr(med_idt fid, char *nom_maillage,med_int n);
+extern med_int
+MEDnbnosoLire(med_idt fid,char *nom_maillage);
+extern med_err
+MEDnbnoisEcr(med_idt fid, char *nom_maillage,med_int n);
+extern med_int
+MEDnbnoisLire(med_idt fid,char *nom_maillage);
+extern med_err
+MEDnbnomaEcr(med_idt fid, char *nom_maillage,med_int n);
+extern med_int
+MEDnbnomaLire(med_idt fid,char *nom_maillage);
+
+/* EntMaillage */
+extern med_err
+MEDconnEcr(med_idt fid,char *maa, med_int mdim, med_int *connectivite,med_mode_switch mode_switch,
+ med_int nbre,med_mode_acces mode,med_entite_maillage type_ent,
+ med_geometrie_element type_geo,med_connectivite type_conn);
+
+extern med_err
+MEDconnLire(med_idt fid,char *maa,med_int mdim,med_int *connectivite,med_mode_switch mode_switch,
+ med_int * pfltab, med_size psize,
+ med_entite_maillage type_ent, med_geometrie_element type_geo,med_connectivite type_conn);
+extern med_err
+MEDnomEcr(med_idt fid,char *maa, char *nom, med_int n, med_mode_acces mode,
+ med_entite_maillage type_ent,med_geometrie_element type_geo);
+extern med_err
+MEDnomLire(med_idt fid,char *maa, char *nom, med_int n,
+ med_entite_maillage type_ent,med_geometrie_element type_geo);
+extern med_err
+MEDnumLire(med_idt fid,char *maa, med_int *num, med_int n,
+ med_entite_maillage type_ent,med_geometrie_element type_geo);
+extern med_err
+MEDnumEcr(med_idt fid,char *maa, med_int *num, med_int n, med_mode_acces mode,
+ med_entite_maillage type_ent,med_geometrie_element type_geo);
+extern med_err
+MEDcoordEcr(med_idt fid, char *maa, med_int mdim, med_float *coo,
+ med_mode_switch mode_coo,med_int n,
+ med_mode_acces mode, med_repere type_rep, char *nom, char *unit);
+extern med_err
+MEDcoordLire(med_idt fid, char *maa, med_int mdim, med_float *coo,
+ med_mode_switch mode_coo,med_int numco,
+ med_int * pfltab, med_size psize, med_repere *type_rep, char *nom, char *unit);
+
+extern med_int
+MEDnEntMaa(med_idt fid, char *maa, med_table quoi, med_entite_maillage type_ent,
+ med_geometrie_element type_geo, med_connectivite type_conn);
+
+
+/* Resultat */
+extern med_err MEDchampCr(med_idt fid, char *champ, med_type_champ type, char *comp,
+ char *unit,med_int ncomp);
+
+extern med_err
+MEDchampEcr(med_idt fid, char *maa, char *cha,unsigned char *val,med_mode_switch interlace,med_int nbelem,med_int ngauss,
+ med_int numco, char * profil, med_mode_acces mode, med_entite_maillage type_ent,
+ med_geometrie_element type_geo, med_int numdt,char * dt_unit, med_float dt, med_int numo);
+
+extern med_err
+MEDchampLire(med_idt fid,char *maa, char *cha, unsigned char *val,med_mode_switch interlace,med_int numco,
+ char *profil,med_entite_maillage type_ent, med_geometrie_element type_geo,
+ med_int numdt, med_int numo);
+
+extern med_err
+MEDchampInfo(med_idt fid,int indice,char *champ,
+ med_type_champ *type,char *comp,char *unit,
+ med_int ncomp);
+
+extern med_int
+MEDnChamp(med_idt fid, int indice);
+
+extern med_int
+MEDnVal(med_idt fid, char *champ, med_entite_maillage typ_ent,
+ med_geometrie_element typ_geo,med_int numdt, med_int numo);
+
+
+/* Famille */
+extern med_err
+MEDfamEcr(med_idt fid,char *maa, med_int *fam, med_int n, med_mode_acces mode,
+ med_entite_maillage type_ent, med_geometrie_element type_geo);
+extern med_err
+MEDfamLire(med_idt fid,char *maa, med_int *fam, med_int n,
+ med_entite_maillage type_ent,med_geometrie_element type_geo);
+extern med_err
+MEDfamCr(med_idt fid,char* maa,char *famille,med_int numero,
+ med_int *attr_ident, med_int *attr_val,char *attr_desc,med_int n_attr,
+ char *groupe , med_int n_groupe);
+extern med_int
+MEDnFam(med_idt fid,char *maa, int indice, med_dim_famille quoi);
+
+extern med_err
+MEDfamInfo(med_idt fid,char *maa,int indice, char *famille,
+ med_int *numero,
+ med_int *attr_ident, med_int *attr_val, char *attr_desc,
+ med_int *n_attr,char *groupe ,med_int *n_groupe);
+
+/* Equivalence */
+extern med_err
+MEDequivCr(med_idt fid,char *maa, char *eq, char *desc);
+extern med_err
+MEDequivLire(med_idt fid, char *maa, char *eq, med_int *corr, med_int n,
+ med_entite_maillage typ_ent,med_geometrie_element typ_geo);
+extern med_err
+MEDequivEcr(med_idt fid, char *maa, char *eq, med_int *corr, med_int n,
+ med_mode_acces mode, med_entite_maillage typ_ent, med_geometrie_element typ_geo);
+extern med_err
+MEDequivInfo(med_idt fid, char *maa, int ind, char *eq, char *des);
+extern med_int
+MEDnEquiv(med_idt fid, char *maa);
+extern med_int
+MEDnCorres(med_idt fid,char *maa,char *eq,med_entite_maillage typ_ent,
+ med_geometrie_element typ_geo);
+
+
+/* Routines de niveau intermediaire */
+extern med_int
+MEDnEntites(med_idt fid,char *maa,med_entite_maillage typ_ent,
+ med_connectivite typ_con);
+
+extern med_err
+MEDnoeudsLire(med_idt fid,char *maa,med_int mdim, med_float *coord,
+ med_mode_switch mode_coo,
+ med_repere *repere,char *nomcoo, char *unicoo,char *nom,
+ med_booleen *inom,med_int *num,med_booleen *inum,med_int *fam,
+ med_int nnoeuds);
+
+extern med_err
+MEDnoeudsEcr(med_idt fid,char *maa,med_int mdim,med_float *coord,
+ med_mode_switch mode_coo,
+ med_repere repere,char *nomcoo, char *unicoo,char *nom,
+ med_booleen inom,med_int *num,med_booleen inum,med_int *fam,
+ med_int nnoeuds,med_mode_acces mode);
+extern med_err
+MEDelementsEcr(med_idt fid,char *maa,med_int mdim,med_int *connectivite,med_mode_switch mode_switch,
+ char *nom,med_booleen inom,med_int *num,med_booleen inum,
+ med_int *fam,med_int nele,med_entite_maillage typ_ent,
+ med_geometrie_element typ_geo,med_connectivite typ_conn,med_mode_acces mode);
+extern med_err
+MEDelementsLire(med_idt fid,char *maa,med_int mdim,med_int *connectivite,med_mode_switch mode_switch,
+ char *nom,med_booleen *inom,med_int *num,med_booleen *inum,
+ med_int *fam,med_int nele,med_entite_maillage typ_ent,
+ med_geometrie_element typ_geo,med_connectivite typ_conn);
+
+/* Routines de haut niveau */
+
+/*(? On enlève le reste ?)*/
+
+extern med_err
+MEDfamMaaInfo(med_idt fid,char *maa,med_int *nfam,med_int *nattc,
+ med_int *ngroc);
+
+extern med_err
+MEDfamMaaLire(med_idt fid,char *maa,
+ med_int *numfam,med_int *attide,
+ med_int *attval,char *attdes,int *indatt,char *gro,int *indgro,
+ med_int nfamilles);
+
+extern med_err
+MEDfamMaaCr(med_idt fid,char *maa,
+ med_int *numfam,med_int *attide,
+ med_int *attval,char *attdes,int *indatt,char *gro,int *indgro,
+ med_int nfamilles);
+
+/* Routines concernant les profils */
+
+extern med_err
+MEDprofilInfo(med_idt fid, int indice, char *profil, med_int *n);
+
+extern med_int
+MEDnProfil(med_idt fid);
+
+extern med_err
+MEDprofilEcr(med_idt fid,med_int *pflval,med_int n,char *nom);
+
+extern med_int
+MEDnValProfil(med_idt fid, char *nom);
+
+extern med_err
+MEDprofilLire(med_idt fid, med_int *pflval, char *nom);
+
+/* Routines concernant les pas de temps/ numéros d'ordre */
+
+extern med_int
+MEDnPasdetemps(med_idt fid,char *cha,med_entite_maillage type_ent,
+ med_geometrie_element type_geo);
+
+extern med_err
+MEDpasdetempsInfo(med_idt fid,char *champ
+ ,med_entite_maillage type_ent, med_geometrie_element type_geo,
+ int indice, char *maa, med_int * ngauss, med_int * numdt, char * dt_unit, med_float * dt,
+ med_int * numo);
+
+/* Grilles */
+
+med_int MEDnGrid(med_idt fid, char *maa, med_grid n);
+med_err MEDgridCr(med_idt fid, char *maillage, med_int dim, med_grid_type typ);
+med_err MEDgridInfo(med_idt fid, int indice, med_int *isAGrid, med_grid_type *typ);
+med_err MEDgridEcr(
+ med_idt fid, char *maa, med_int mdim, med_float *coo, med_int nb, med_int dim, med_mode_switch mode_coo,
+ med_repere repere, char *nomcoo, char *unicoo, med_mode_acces mode );
+med_err MEDgridLire(
+ med_idt fid, char *maa, med_int mdim, med_float *coo, med_int dim, med_mode_switch mode_coo,
+ med_repere *repere, char *nomcoo, char *unicoo );
+med_err MEDfamGridEcr(med_idt fid, char *maa, med_int *fam, med_int n, med_mode_acces mode, med_entite_maillage type_ent);
+med_err MEDfamGridLire(med_idt fid, char *maa, med_int *fam, med_int n, med_entite_maillage type_ent);
+med_err MEDbodyFittedEcr(
+ med_idt fid, char *maa, med_int mdim, med_float *coo, med_int *nbr, med_mode_switch mode_coo,
+ med_repere repere, char *nomcoo, char *unicoo, med_int *fam, med_int nnoeuds, med_mode_acces mode );
+med_err MEDbodyFittedLire(
+ med_idt fid, char *maa, med_int mdim, med_float *coo, med_mode_switch mode_coo,
+ med_repere *repere, char *nomcoo, char *unicoo, med_int *fam, med_int nnoeuds );
+}
+
+#endif /* MED_PROTO_H */
+
+
+
+
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+# ifndef __UTILITES_H__
+# define __UTILITES_H__
+
+
+/* pour indiquer le statut des arguments des fonctions. */
+
+#ifdef _IN
+#error _IN already defined
+#endif
+#define _IN
+
+#ifdef _OUT
+#error _OUT already defined
+#endif
+#define _OUT
+
+#ifdef _INOUT
+#error _INOUT already defined
+#endif
+#define _INOUT
+
+#ifdef _UNUSED
+#error _UNUSED already defined
+#endif
+#define _UNUSED
+
+
+
+
+
+
+
+/* --- Pour afficher le nom du fichier source courant et le numero de la ligne courante --- */
+/* --- sur la stderr. --- */
+
+# define ICI {\
+ fflush(stdout);\
+ fprintf(stderr, "%s [%d] : " , __FILE__ , __LINE__ ) ;\
+ fflush(stderr) ;\
+ }
+
+
+
+
+
+
+
+/* --- Pour afficher la date et l'heure de la compilation du fichier source courant, --- */
+/* --- sur la stdout. --- */
+
+# ifdef INFOS_COMPILATION
+# error INFOS_COMPILATION already defined
+# endif
+# define INFOS_COMPILATION {\
+ fflush(stderr);\
+ fprintf(stdout, "%s [%d] : " , __FILE__ , __LINE__ ) ;\
+ fprintf(stdout,"Compilation le %s" , __DATE__);\
+ fprintf(stdout," a %s" , __TIME__ );\
+ fprintf(stdout,"\n\n\n" );\
+ fflush(stdout) ;\
+ }
+
+
+
+
+
+
+
+/* --- Pour attendre "secondes" secondes et afficher un message sur la stderr indiquant --- */
+/* --- cette attente volontaire. --- */
+
+# ifdef ATTENTE
+# error ATTENTE already defined
+# endif
+# define ATTENTE(secondes) {\
+ ICI ;\
+ fprintf( stderr, "ATTENTE de %d secondes" , secondes);\
+ fflush(stderr) ;\
+ sleep(secondes) ;\
+ fprintf( stderr, "\n" );\
+ fflush(stderr) ;\
+ }
+
+
+
+
+
+
+
+/* ---------- Les macros suivantes ne doivent pas deja exister ! ---------- */
+
+# ifdef EXECUTION
+# error EXECUTION already defined
+# endif
+# ifdef INTERRUPTION
+# error INTERRUPTION already defined
+# endif
+# ifdef ISCRUTE
+# error ISCRUTE already defined
+# endif
+# ifdef RSCRUTE
+# error RSCRUTE already defined
+# endif
+# ifdef SSCRUTE
+# error SSCRUTE already defined
+# endif
+# ifdef CSCRUTE
+# error CSCRUTE already defined
+# endif
+# ifdef XSCRUTE
+# error XSCRUTE already defined
+# endif
+# ifdef MESSAGE
+# error MESSAGE already defined
+# endif
+
+
+
+
+
+# ifdef _DEBOG_
+
+
+/* --- Pour tracer sur la stderr l'execution d"une instruction. --- */
+
+# define EXECUTION(instruction) {\
+ ICI ;\
+ fprintf( stderr,"INSTRUCTION %s" , #instruction ) ;\
+ fflush(stderr);\
+ instruction ;\
+ fflush(stdout);\
+ fprintf( stderr," FRANCHIE\n" ) ;\
+ fflush(stderr);\
+ }
+
+
+
+
+
+
+
+/* --- Pour afficher un message d'interruption volontaire et retourner le code retour --- */
+/* --- "code" --- */
+
+# define INTERRUPTION(code) {\
+ ICI ;\
+ fprintf( stderr," INTERRUPTION code = %d",code) ;\
+ fprintf(stderr,"\n") ;\
+ exit(code) ;\
+ }
+
+
+
+
+
+
+
+/* --- Pour conditionner la poursuite du traitement par la validite de la condition --- */
+/* --- "condiiton". --- */
+
+# ifndef ASSERT
+# define ASSERT(condition) if( !(condition) ){\
+ ICI ;\
+ fprintf(stderr,"condition %s VIOLEE\n",#condition);\
+ INTERRUPTION(17);\
+ }
+# endif /* # ifndef ASSERT */
+
+
+
+
+
+
+
+/* --- Pour afficher sur la stderr la valeur d'une variable precedee de son nom. --- */
+
+# define ISCRUTE(entier) {\
+ ICI ;\
+ fprintf(stderr,"%s = %d\n",#entier,entier) ;\
+ fflush(stderr) ;\
+ }
+# define RSCRUTE(reel) {\
+ ICI ;\
+ fprintf(stderr,"%s = %f\n",#reel,reel) ;\
+ fflush(stderr) ;\
+ }
+# define XSCRUTE(pointeur) {\
+ ICI ;\
+ fprintf(stderr,"%s = %x\n",#pointeur,pointeur) ;\
+ fflush(stderr) ;\
+ }
+# define CSCRUTE(car) {\
+ ICI ;\
+ fprintf(stderr,"%s = %c\n",#car,car) ;\
+ fflush(stderr) ;\
+ }
+# define SSCRUTE(chaine) {\
+ ICI ;\
+ fprintf(stderr,"%s = \"%s\"\n",#chaine,chaine) ;\
+ fflush(stderr) ;\
+ }
+# define MESSAGE(chaine) {\
+ ICI ;\
+ fprintf(stderr,"%s\n",chaine) ;\
+ fflush(stderr) ;\
+ }
+# define FIN(nom) {\
+ ICI ;\
+ fprintf( stderr , "} FIN %s\n\n\n" , nom ) ;\
+ fflush(stderr) ;\
+ }
+# define DEBUT(nom) {\
+ fprintf( stderr , "\n\n\n") ;\
+ ICI ;\
+ fprintf( stderr , "{ DEBUT %s\n" , nom ) ;\
+ fflush(stderr) ;\
+ }
+
+
+# else /* # ifdef _DEBOG_ */
+
+
+
+# define EXECUTION(instruction) instruction
+# define INTERRUPTION(code)
+
+# ifndef ASSERT
+# define ASSERT(condition)
+# endif
+
+# define ISCRUTE(entier)
+# define RSCRUTE(reel)
+# define CSCRUTE(car)
+# define SSCRUTE(chaine)
+# define MESSAGE(chaine)
+# define DEBUT(nom)
+# define FIN(nom)
+
+
+# endif /* # ifdef _DEBOG_ */
+
+
+# endif /* # ifndef __UTILITES_H__ */
--- /dev/null
+/*************************************************************************
+* COPYRIGHT (C) 1999 - 2002 EDF R&D
+* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
+* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
+* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
+*
+* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
+* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
+* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
+* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+*
+* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
+* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
+* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
+*
+*************************************************************************/
+
+/******************************************************************************
+ * - Nom du fichier : test1.c
+ *
+ * - Description : tests des routines d'ouverture/fermeture des
+ * fichiers MED
+ *
+ *****************************************************************************/
+
+#include "med.hxx"
+using namespace med_2_1;
+
+/******************************************************************************
+ * OUVERTURE/FERMETURE DE FICHIERS :
+ *
+ * Description :
+ * - ouverture du fichier en mode ecriture avec remplacement
+ * - ecriture d'une description du fichier (optionnel)
+ * - fermeture du fichier
+ * - ouverture du fichier en mode de lecture
+ * - fermeture du fichier
+ *****************************************************************************/
+
+int main (int argc, char **argv)
+{
+ med_err ret = 0;
+ med_idt fid;
+ char des[MED_TAILLE_DESC+1]="Ceci est un courte description du mon fichier test1.med";
+
+ fid = MEDouvrir("test1.med",MED_REMP);
+ if (fid < 0)
+ ret = -1;
+ printf("%d\n",ret);
+
+ if (ret == 0)
+ ret = MEDfichDesEcr(fid,des, MED_REMP);
+ printf("%d\n",ret);
+
+ ret = MEDfermer(fid);
+ printf("%d\n",ret);
+
+ fid = MEDouvrir("test1.med",MED_LECT);
+ if (fid < 0)
+ ret = -1;
+ printf("%d\n",ret);
+
+ ret = MEDfermer(fid);
+ printf("%d\n",ret);
+
+ return 0;
+}
+
+
+
+
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-
-#include <stdlib.h>
-#include "med_misc.hxx"
-
-/*
- * - Nom de la fonction : _MED1cstring
- * - Description : convertit une chaine de caracteres FORTRAN
- * en une nouvelle chaine de caracteres C
- * dont la longueur est passee en parametre.
- * Les caracteres completes sont des blancs
- * - Parametres :
- * - chaine (IN) : la chaine FORTRAN
- * - longueur_reelle (IN) : la longueur de la chaine FORTRAN
- * - longueur_fixee (IN) : longueur de la chaine C a construire
- * - Resultat : la nouvelle chaine C en cas de succes, NULL sinon
- */
-
-namespace med_2_1{
-
-char *
-_MED1cstring(char *chaine,int longueur_reelle,int longueur_fixee)
-{
- char *nouvelle;
- int i;
-
- if (longueur_reelle > longueur_fixee)
- return NULL;
-
- if ((nouvelle = (char *) malloc(sizeof(char)*(longueur_fixee+1))) == NULL)
- return NULL;
-
- for (i=0;i<longueur_reelle;i++)
- *(nouvelle+i) = *(chaine+i);
-
- for (i=longueur_reelle;i<longueur_fixee;i++)
- *(nouvelle+i) = ' ';
-
- *(nouvelle+longueur_fixee) = '\0';
-
- return nouvelle;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include <stdlib.h>
-#include "med_misc.hxx"
-
-/*
- * - Nom de la fonction _MED2cstring
- * - Description : convertit une chaine de caracteres FORTRAN en
- * nouvelle chaine de caracteres C
- * - Parametres :
- * - chaine (IN) : la chaine FORTRAN
- * - longueur (IN) : longueur de la chaine
- * - Resultat : la nouvelle chaine C en cas de succes, NULL sinon
- */
-
-namespace med_2_1{
-
-char *
-_MED2cstring(char *chaine, int longueur)
-{
- char *nouvelle;
- char *temoin;
- int long_reelle = longueur;
- int i;
-
- if ( longueur < 0 ) return NULL;
-
- temoin = chaine+longueur-1;
- while (*temoin == ' ' && (temoin != chaine) )
- {
- temoin --;
- long_reelle--;
- }
- if ( *temoin == ' ') long_reelle = 0;
-
- if ((nouvelle = (char *) malloc(sizeof(char)*(long_reelle+1))) == NULL)
- return NULL;
-
- for (i=0;i<long_reelle+1;i++)
- *(nouvelle+i) = *(chaine+i);
- *(nouvelle+long_reelle) = '\0';
-
- return nouvelle;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-namespace med_2_1{
-
-med_err
-_MEDGeometrieElement(med_geometrie_element typ_geo[],med_entite_maillage typ_ent)
-{
- int i;
- med_geometrie_element typ_mai[MED_NBR_GEOMETRIE_MAILLE] = {MED_POINT1,MED_SEG2,
- MED_SEG3,MED_TRIA3,
- MED_TRIA6,MED_QUAD4,
- MED_QUAD8,MED_TETRA4,
- MED_TETRA10,MED_HEXA8,
- MED_HEXA20,MED_PENTA6,
- MED_PENTA15,MED_PYRA5,
- MED_PYRA13};
- med_geometrie_element typ_fac[MED_NBR_GEOMETRIE_FACE] = {MED_TRIA3,MED_TRIA6,
- MED_QUAD4,MED_QUAD8};
- med_geometrie_element typ_are[MED_NBR_GEOMETRIE_ARETE] = {MED_SEG2,MED_SEG3};
-
- switch(typ_ent)
- {
- case MED_MAILLE :
- for (i=0;i<MED_NBR_GEOMETRIE_MAILLE;i++)
- typ_geo[i] = typ_mai[i];
- break;
-
- case MED_FACE :
- for (i=0;i<MED_NBR_GEOMETRIE_FACE;i++)
- typ_geo[i] = typ_fac[i];
- break;
-
- case MED_ARETE :
- for (i=0;i<MED_NBR_GEOMETRIE_ARETE;i++)
- typ_geo[i] = typ_are[i];
- break;
-
- default :
- return -1;
- }
- return 0;
-}
-
-}
+++ /dev/null
-//
-//
-// Copyright (C) 2003 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.
-//
-// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File :
-// Author :
-// Module :
-// $Header$
-
-#include "MED_V2_1_Wrapper.hxx"
-#include "MED_Utilities.hxx"
-
-#include "med.hxx"
-using namespace med_2_1;
-
-#ifdef _DEBUG_
-static int MYDEBUG = 0;
-#else
-static int MYDEBUG = 0;
-#endif
-
-
-
-namespace MED{
- namespace V2_1{
-
- //---------------------------------------------------------------
- class TFile{
- TFile();
- TFile(const TFile&);
-
- public:
- TFile(const std::string& theFileName):
- myFid(-1),
- myCount(0),
- myFileName(theFileName)
- {}
-
- ~TFile(){
- Close();
- }
-
- void Open(EModeAcces theMode, TErr* theErr = NULL){
- if(myCount++ == 0){
- char* aFileName = const_cast<char*>(myFileName.c_str());
- myFid = MEDouvrir(aFileName,med_mode_acces(theMode));
- }
- if(theErr){
- *theErr = TErr(myFid);
- INITMSG(MYDEBUG && myFid < 0,"TFile::Open - MED_MODE_ACCES = "<<theMode<<"; myFid = "<<myFid<<endl);
- }else if(myFid < 0)
- EXCEPTION(runtime_error,"TFile - MEDouvrir('"<<myFileName<<"',"<<theMode<<")");
- }
-
- const TIdt& Id() const {
- if(myFid < 0)
- EXCEPTION(runtime_error,"TFile - GetFid() < 0");
- return myFid;
- }
-
- void Close(){
- if(--myCount == 0)
- MEDfermer(myFid);
- }
-
- protected:
- std::string myFileName;
- TInt myCount;
- TIdt myFid;
- };
-
-
- //---------------------------------------------------------------
- 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))
- {}
-
-
- TInt TVWrapper::GetNbMeshes(TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECT,theErr);
-
- if(theErr && *theErr < 0)
- return -1;
-
- return MEDnMaa(myFile->Id());
- }
-
-
- void TVWrapper::GetMeshInfo(TInt theMeshId,
- MED::TMeshInfo& theInfo,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECT,theErr);
-
- if(theErr && *theErr < 0)
- return;
-
- TErr aRet = MEDmaaInfo(myFile->Id(),
- theMeshId,
- &theInfo.myName[0],
- (med_2_1::med_int *)&theInfo.myDim);
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(runtime_error,"GetMeshInfo - MEDmaaInfo(...)");
- }
-
-
- 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);
-
- TErr aRet = MEDmaaCr(myFile->Id(),
- &anInfo.myName[0],
- anInfo.myDim);
-
- INITMSG(MYDEBUG,"TVWrapper::SetMeshInfo - MED_MODE_ACCES = "<<theMode<<"; aRet = "<<aRet<<endl);
-
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(runtime_error,"SetMeshInfo - MEDmaaCr(...)");
- }
-
-
- void TVWrapper::SetMeshInfo(const MED::TMeshInfo& theInfo,
- TErr* theErr)
- {
- TErr aRet;
- SetMeshInfo(theInfo,eECRI,&aRet);
-
- if(aRet < 0)
- SetMeshInfo(theInfo,eREMP,theErr);
- }
-
-
- TInt TVWrapper::GetNbFamilies(const MED::TMeshInfo& theInfo,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECT,theErr);
-
- if(theErr && *theErr < 0)
- return -1;
-
- MED::TMeshInfo& anInfo = const_cast<MED::TMeshInfo&>(theInfo);
- return MEDnFam(myFile->Id(),
- &anInfo.myName[0],
- 0,
- MED_FAMILLE);
- }
-
-
- TInt TVWrapper::GetNbFamAttr(TInt theFamId,
- const MED::TMeshInfo& theInfo,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECT,theErr);
-
- if(theErr && *theErr < 0)
- return -1;
-
- MED::TMeshInfo& anInfo = const_cast<MED::TMeshInfo&>(theInfo);
- return MEDnFam(myFile->Id(),
- &anInfo.myName[0],
- theFamId,
- MED_ATTR);
- }
-
-
- TInt TVWrapper::GetNbFamGroup(TInt theFamId,
- const MED::TMeshInfo& theInfo,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECT,theErr);
-
- if(theErr && *theErr < 0)
- return -1;
-
- MED::TMeshInfo& anInfo = const_cast<MED::TMeshInfo&>(theInfo);
- return MEDnFam(myFile->Id(),
- &anInfo.myName[0],
- theFamId,
- MED_GROUPE);
- }
-
-
- void TVWrapper::GetFamilyInfo(TInt theFamId,
- MED::TFamilyInfo& theInfo,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECT,theErr);
-
- if(theErr && *theErr < 0)
- return;
-
- MED::TMeshInfo& aMeshInfo = *theInfo.myMeshInfo;
-
- TErr aRet = MEDfamInfo(myFile->Id(),
- &aMeshInfo.myName[0],
- theFamId,
- &theInfo.myName[0],
- (med_2_1::med_int *)&theInfo.myId,
- (med_2_1::med_int *)&theInfo.myAttrId[0],
- (med_2_1::med_int *)&theInfo.myAttrVal[0],
- &theInfo.myAttrDesc[0],
- (med_2_1::med_int *)&theInfo.myNbAttr,
- &theInfo.myGroupNames[0],
- (med_2_1::med_int *)&theInfo.myNbGroup);
-
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(runtime_error,"GetFamilyInfo - MEDfamInfo - "<<
- "&aMeshInfo.myName[0] = '"<<&aMeshInfo.myName[0]<<"'; "<<
- "theFamId = "<<theFamId<<"; "<<
- "&theInfo.myName[0] = '"<<&theInfo.myName[0]<<"'; "<<
- "theInfo.myId = "<<theInfo.myId);
- }
-
-
- 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;
-
- TErr aRet = MEDfamCr(myFile->Id(),
- &aMeshInfo.myName[0],
- &anInfo.myName[0],
- anInfo.myId,
- (med_2_1::med_int *)&anInfo.myAttrId[0],
- (med_2_1::med_int *)&anInfo.myAttrVal[0],
- &anInfo.myAttrDesc[0],
- anInfo.myNbAttr,
- &anInfo.myGroupNames[0],
- anInfo.myNbGroup);
-
- INITMSG(MYDEBUG && aRet,"TVWrapper::SetFamilyInfo - MED_MODE_ACCES = "<<theMode<<"; aRet = "<<aRet<<endl);
-
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(runtime_error,"SetFamilyInfo - MEDfamCr(...)");
- }
-
-
- void TVWrapper::SetFamilyInfo(const MED::TFamilyInfo& theInfo,
- TErr* theErr)
- {
- TErr aRet;
- SetFamilyInfo(theInfo,eECRI,&aRet);
-
- if(aRet < 0)
- SetFamilyInfo(theInfo,eREMP,theErr);
- }
-
-
- TInt TVWrapper::GetNbNodes(const MED::TMeshInfo& theMeshInfo,
- TErr* theErr)
- {
- MSG(MYDEBUG,"TVWrapper::GetNbNodes");
- INITMSG(MYDEBUG,"GetNbNodes ... ");
- TFileWrapper aFileWrapper(myFile,eLECT,theErr);
-
- if(theErr && *theErr < 0)
- return -1;
-
- MED::TMeshInfo& aMeshInfo = const_cast<MED::TMeshInfo&>(theMeshInfo);
-
- TInt aRet = MEDnEntMaa(myFile->Id(),
- &aMeshInfo.myName[0],
- MED_COOR,
- MED_NOEUD,
- med_geometrie_element(0),
- med_connectivite(0));
-
- ADDMSG(MYDEBUG," nbnodes="<<aRet<<" ... OK"<<endl);
- return aRet;
- }
-
-
- void TVWrapper::GetNodeInfo(MED::TNodeInfo& theInfo,
- TErr* theErr)
- {
- MSG(MYDEBUG,"TVWrapper::GetNodeInfo");
- INITMSG(MYDEBUG,"GetNodeInfo ... ");
- TFileWrapper aFileWrapper(myFile,eLECT,theErr);
-
- if(theErr && *theErr < 0)
- return;
-
- MED::TMeshInfo& aMeshInfo = *theInfo.myMeshInfo;
-
- med_repere& aRepere = (med_repere&)(theInfo.mySystem);
- med_booleen& anIsElemNames = (med_booleen&)(theInfo.myIsElemNames);
- med_booleen& anIsElemNum = (med_booleen&)(theInfo.myIsElemNum);
-
- TErr aRet = MEDnoeudsLire(myFile->Id(),
- &aMeshInfo.myName[0],
- aMeshInfo.myDim,
- &theInfo.myCoord[0],
- MED_FULL_INTERLACE,
- &aRepere,
- &theInfo.myCoordNames[0],
- &theInfo.myCoordUnits[0],
- &theInfo.myElemNames[0],
- &anIsElemNames,
- (med_2_1::med_int *)&theInfo.myElemNum[0],
- &anIsElemNum,
- (med_2_1::med_int *)&theInfo.myFamNum[0],
- theInfo.myNbElem);
-
- ADDMSG(MYDEBUG," myDim="<<aMeshInfo.myDim<<" myNbElem="<<theInfo.myNbElem<<" ... ");
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(runtime_error,"GetNodeInfo - MEDnoeudsLire(...)");
- ADDMSG(MYDEBUG,"OK"<<endl);
- }
-
-
- 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;
-
- med_repere& aRepere = (med_repere&)(theInfo.mySystem);
- med_booleen& anIsElemNames = (med_booleen&)(theInfo.myIsElemNames);
- med_booleen& anIsElemNum = (med_booleen&)(theInfo.myIsElemNum);
-
- TErr aRet = MEDnoeudsEcr(myFile->Id(),
- &aMeshInfo.myName[0],
- aMeshInfo.myDim,
- &anInfo.myCoord[0],
- MED_FULL_INTERLACE,
- aRepere,
- &anInfo.myCoordNames[0],
- &anInfo.myCoordUnits[0],
- &anInfo.myElemNames[0],
- anIsElemNames,
- (med_2_1::med_int *)&anInfo.myElemNum[0],
- anIsElemNum,
- (med_2_1::med_int *)&anInfo.myFamNum[0],
- anInfo.myNbElem,
- MED_REMP);
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(runtime_error,"SetNodeInfo - MEDnoeudsEcr(...)");
- }
-
-
- void TVWrapper::SetNodeInfo(const MED::TNodeInfo& theInfo,
- TErr* theErr)
- {
- TErr aRet;
- SetNodeInfo(theInfo,eECRI,&aRet);
-
- if(aRet < 0)
- SetNodeInfo(theInfo,eREMP,theErr);
- }
-
-
- TEntityInfo TVWrapper::GetEntityInfo(const MED::TMeshInfo& theMeshInfo,
- EConnectivite theTConn,
- TErr* theErr)
- {
- TEntityInfo anInfo;
-
- TFileWrapper aFileWrapper(myFile,eLECT,theErr);
-
- if(theErr && *theErr < 0)
- return anInfo;
-
- 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,theTConn,theErr);
- if(aNbElem > 0)
- anInfo[anEntity][aGeom] = aNbElem;
- }
- }
- }
- return anInfo;
- }
-
-
- TInt TVWrapper::GetNbCells(const MED::TMeshInfo& theMeshInfo,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- EConnectivite theTConn,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECT,theErr);
-
- if(theErr && *theErr < 0)
- return -1;
-
- MED::TMeshInfo& aMeshInfo = const_cast<MED::TMeshInfo&>(theMeshInfo);
-
- med_entite_maillage anEntity = med_entite_maillage(theTEntity);
- med_geometrie_element aGeom = med_geometrie_element(theTGeom);
- med_connectivite aConn = med_connectivite(theTConn);
-
- return MEDnEntMaa(myFile->Id(),
- &aMeshInfo.myName[0],
- MED_CONN,
- anEntity,
- aGeom,
- aConn);
- }
-
-
- void TVWrapper::GetCellInfo(MED::TCellInfo& theInfo,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECT,theErr);
-
- if(theErr && *theErr < 0)
- return;
-
- MED::TMeshInfo& aMeshInfo = *theInfo.myMeshInfo;
- TInt aNbElem = theInfo.myElemNum.size();
-
- med_booleen& anIsElemNames = (med_booleen&)(theInfo.myIsElemNames);
- med_booleen& anIsElemNum = (med_booleen&)(theInfo.myIsElemNum);
- med_entite_maillage& anEntity = (med_entite_maillage&)(theInfo.myTEntity);
- med_geometrie_element& aGeom = (med_geometrie_element&)(theInfo.myTGeom);
- med_connectivite& aConn = (med_connectivite&)(theInfo.myTConn);
-
- TErr aRet = MEDelementsLire(myFile->Id(),
- &aMeshInfo.myName[0],
- aMeshInfo.myDim,
- (med_2_1::med_int *)&theInfo.myConn[0],
- MED_FULL_INTERLACE,
- &theInfo.myElemNames[0],
- &anIsElemNames,
- (med_2_1::med_int *)&theInfo.myElemNum[0],
- &anIsElemNum,
- (med_2_1::med_int *)&theInfo.myFamNum[0],
- aNbElem,
- anEntity,
- aGeom,
- aConn);
-
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(runtime_error,"GetCellInfo - MEDelementsLire(...)");
- }
-
-
- 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;
-
- med_booleen& anIsElemNames = (med_booleen&)(theInfo.myIsElemNames);
- med_booleen& anIsElemNum = (med_booleen&)(theInfo.myIsElemNum);
- med_entite_maillage& anEntity = (med_entite_maillage&)(theInfo.myTEntity);
- med_geometrie_element& aGeom = (med_geometrie_element&)(theInfo.myTGeom);
- med_connectivite& aConn = (med_connectivite&)(theInfo.myTConn);
-
- TErr aRet = MEDelementsEcr(myFile->Id(),
- &aMeshInfo.myName[0],
- aMeshInfo.myDim,
- (med_2_1::med_int *)&anInfo.myConn[0],
- MED_FULL_INTERLACE,
- &anInfo.myElemNames[0],
- anIsElemNames,
- (med_2_1::med_int *)&anInfo.myElemNum[0],
- anIsElemNum,
- (med_2_1::med_int *)&anInfo.myFamNum[0],
- anInfo.myNbElem,
- anEntity,
- aGeom,
- aConn,
- MED_REMP);
-
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(runtime_error,"GetCellInfo - MEDelementsLire(...)");
- }
-
-
- void TVWrapper::SetCellInfo(const MED::TCellInfo& theInfo,
- TErr* theErr)
- {
- TErr aRet;
- SetCellInfo(theInfo,eECRI,&aRet);
-
- if(aRet < 0)
- SetCellInfo(theInfo,eREMP,theErr);
- }
-
-
- TInt TVWrapper::GetNbFields(TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECT,theErr);
-
- if(theErr && *theErr < 0)
- return -1;
-
- return MEDnChamp(myFile->Id(),0);
- }
-
-
- TInt TVWrapper::GetNbComp(TInt theFieldId,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECT,theErr);
-
- if(theErr && *theErr < 0)
- return -1;
-
- return MEDnChamp(myFile->Id(),theFieldId);
- }
-
-
- void TVWrapper::GetFieldInfo(TInt theFieldId,
- MED::TFieldInfo& theInfo,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECT,theErr);
-
- if(theErr && *theErr < 0)
- return;
-
- med_type_champ& aType = (med_type_champ&)(theInfo.myType);
-
- TErr aRet = MEDchampInfo(myFile->Id(),
- theFieldId,
- &theInfo.myName[0],
- &aType,
- &theInfo.myCompNames[0],
- &theInfo.myUnitNames[0],
- theInfo.myNbComp);
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(runtime_error,"GetFieldInfo - MEDchampInfo(...)");
- }
-
-
- 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);
-
- med_type_champ& aType = (med_type_champ&)(theInfo.myType);
-
- TErr aRet = MEDchampCr(myFile->Id(),
- &anInfo.myName[0],
- aType,
- &anInfo.myCompNames[0],
- &anInfo.myUnitNames[0],
- anInfo.myNbComp);
-
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(runtime_error,"SetFieldInfo - MEDchampCr(...)");
- }
-
-
- void TVWrapper::SetFieldInfo(const MED::TFieldInfo& theInfo,
- TErr* theErr)
- {
- try{
-
- TErr aRet;
- SetFieldInfo(theInfo,eECRI,&aRet);
-
- if(aRet < 0)
- SetFieldInfo(theInfo,eREMP,theErr);
-
- }catch(const std::exception& theExc){
- EXCEPTION(runtime_error,"SetFieldInfo(...)"<<endl<<
- theExc.what());
- }catch(...){
- throw;
- }
- }
-
-
- TInt TVWrapper::GetNbTimeStamps(const MED::TFieldInfo& theInfo,
- const MED::TEntityInfo& theEntityInfo,
- EEntiteMaillage& theEntity,
- TGeom& theGeom,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECT,theErr);
-
- if(theErr){
- if(theEntityInfo.empty())
- *theErr = -1;
- if(*theErr < 0)
- return -1;
- }else if(theEntityInfo.empty())
- EXCEPTION(runtime_error,"GetNbTimeStamps - There is no any Entity on the Mesh");
-
- theGeom.clear();
- TInt aNbTimeStamps = 0;
- MED::TFieldInfo& anInfo = const_cast<MED::TFieldInfo&>(theInfo);
- TEntityInfo::const_iterator anIter = theEntityInfo.begin();
- for(; anIter != theEntityInfo.end(); anIter++){
- const med_entite_maillage& anEntity = (const med_entite_maillage&)(anIter->first);
- const TGeom& aTGeom = anIter->second;
- TGeom::const_iterator anGeomIter = aTGeom.begin();
- for(; anGeomIter != aTGeom.end(); anGeomIter++){
- const med_geometrie_element& aGeom = (const med_geometrie_element&)(anGeomIter->first);
- aNbTimeStamps = MEDnPasdetemps(myFile->Id(),&anInfo.myName[0],anEntity,aGeom);
- if(aNbTimeStamps){
- theEntity = EEntiteMaillage(anEntity);
- theGeom[EGeometrieElement(aGeom)] = anGeomIter->second;
- }
- }
- if(aNbTimeStamps)
- break;
- }
- return aNbTimeStamps;
- }
-
-
- void TVWrapper::GetTimeStampInfo(TInt theTimeStampId,
- MED::TTimeStampInfo& theInfo,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECT,theErr);
-
- TGeom& aTGeom = theInfo.myGeom;
-
- if(theErr){
- if(aTGeom.empty())
- *theErr = -1;
- if(*theErr < 0)
- return;
- }else if(aTGeom.empty())
- EXCEPTION(runtime_error,"GetTimeStampInfo - There is no any cell");
-
- MED::TFieldInfo& aFieldInfo = *theInfo.myFieldInfo;
- MED::TMeshInfo& aMeshInfo = *aFieldInfo.myMeshInfo;
-
- med_entite_maillage& anEntity = (med_entite_maillage&)(theInfo.myEntity);
-
- TGeom::iterator anIter = aTGeom.begin();
- med_geometrie_element& aGeom = (med_geometrie_element&)(anIter->first);
-
- TErr aRet = MEDpasdetempsInfo(myFile->Id(),
- &aFieldInfo.myName[0],
- anEntity,
- aGeom,
- theTimeStampId,
- &aMeshInfo.myName[0],
- (med_2_1::med_int *)&theInfo.myNbGauss,
- (med_2_1::med_int *)&theInfo.myNumDt,
- &theInfo.myUnitDt[0],
- &theInfo.myDt,
- (med_2_1::med_int *)&theInfo.myNumOrd);
-
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(runtime_error,"GetTimeStampInfo - MEDpasdetempsInfo(...)");
-
- static TInt MAX_NB_GAUSS_POINTS = 32;
- if(theInfo.myNbGauss <= 0 || theInfo.myNbGauss > MAX_NB_GAUSS_POINTS)
- theInfo.myNbGauss = 1;
- }
-
-
- void TVWrapper::GetTimeStampVal(MED::TTimeStampVal& theVal,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,eLECT,theErr);
-
- if(theErr && *theErr < 0)
- return;
-
- TIdt anId = myFile->Id();
-
- MED::TTimeStampInfo& aTimeStampInfo = *theVal.myTimeStampInfo;
- MED::TFieldInfo& aFieldInfo = *aTimeStampInfo.myFieldInfo;
- MED::TMeshInfo& aMeshInfo = *aFieldInfo.myMeshInfo;
-
- med_entite_maillage& anEntity = (med_entite_maillage&)(aTimeStampInfo.myEntity);
- TGeom& aTGeom = aTimeStampInfo.myGeom;
- TGeom::iterator anIter = aTGeom.begin();
- for(; anIter != aTGeom.end(); anIter++){
- med_geometrie_element& aGeom = (med_geometrie_element&)(anIter->first);
- TInt aNbVal = MEDnVal(anId,
- &aFieldInfo.myName[0],
- anEntity,
- aGeom,
- aTimeStampInfo.myNumDt,
- aTimeStampInfo.myNumOrd);
- if(aNbVal <= 0){
- if(theErr){
- *theErr = -1;
- return;
- }
- EXCEPTION(runtime_error,"GetTimeStampInfo - MEDnVal(...) - aNbVal == "<<aNbVal<<" <= 0");
- }
-
- TValue& aValue = theVal.myMeshValue[EGeometrieElement(aGeom)];
- TInt iEnd = aNbVal*aFieldInfo.myNbComp;
-
- if(iEnd != aValue.size()){
- if(theErr){
- *theErr = -1;
- return;
- }
- EXCEPTION(runtime_error,
- "GetTimeStampInfo - iEnd("<<iEnd<<
- ") != aValue.size()("<<aValue.size()<<
- "); aNbVal = "<<aNbVal<<
- "; anEntity = "<<anEntity<<
- "; aGeom = "<<aGeom);
- }
-
- TErr aRet;
- switch(aFieldInfo.myType){
- case eFLOAT64: {
- std::vector<TFloat> anArray(iEnd);
- aRet = MEDchampLire(anId,
- &aMeshInfo.myName[0],
- &aFieldInfo.myName[0],
- (unsigned char*)&anArray[0],
- MED_FULL_INTERLACE,
- MED_ALL,
- &theVal.myPflName[0],
- anEntity,
- aGeom,
- aTimeStampInfo.myNumDt,
- aTimeStampInfo.myNumOrd);
- if(aRet >= 0)
- for(TInt i = 0; i < iEnd; i++)
- aValue[i] = anArray[i];
- break;
- }
- default: {
- std::vector<TInt> anArray(iEnd);
- aRet = MEDchampLire(anId,
- &aMeshInfo.myName[0],
- &aFieldInfo.myName[0],
- (unsigned char*)&anArray[0],
- MED_FULL_INTERLACE,
- MED_ALL,
- &theVal.myPflName[0],
- anEntity,
- aGeom,
- aTimeStampInfo.myNumDt,
- aTimeStampInfo.myNumOrd);
- if(aRet >= 0)
- for(med_int i = 0; i < iEnd; i++)
- aValue[i] = anArray[i];
- break;
- }}
- if(aRet < 0){
- if(theErr){
- *theErr = aRet;
- return;
- }
- EXCEPTION(runtime_error,"GetValTimeStamp - MEDchampLire(...)");
- }
- }
- }
-
-
- void TVWrapper::SetTimeStamp(const MED::TTimeStampVal& theVal,
- EModeAcces theMode,
- TErr* theErr)
- {
- TFileWrapper aFileWrapper(myFile,theMode,theErr);
-
- if(theErr && *theErr < 0)
- return;
-
- TErr aRet;
- TIdt anId = myFile->Id();
-
- MED::TTimeStampVal& aVal = const_cast<MED::TTimeStampVal&>(theVal);
- MED::TTimeStampInfo& aTimeStampInfo = *aVal.myTimeStampInfo;
- MED::TFieldInfo& aFieldInfo = *aTimeStampInfo.myFieldInfo;
- MED::TMeshInfo& aMeshInfo = *aFieldInfo.myMeshInfo;
- MED::TMeshValue& aMeshValue = aVal.myMeshValue;
-
- med_entite_maillage& anEntity = (med_entite_maillage&)(aTimeStampInfo.myEntity);
- TMeshValue::iterator anIter = aMeshValue.begin();
- for(; anIter != aMeshValue.end(); anIter++){
- med_geometrie_element& aGeom = (med_geometrie_element&)(anIter->first);
- TValue& aValue = aVal.myMeshValue[EGeometrieElement(aGeom)];
- med_int iEnd = aValue.size();
- med_int aNbVal = iEnd / aFieldInfo.myNbComp;
-
- switch(aFieldInfo.myType){
- case eFLOAT64: {
- std::vector<TFloat>& anArray = aValue;
-
- aRet = MEDchampEcr(anId,
- &aMeshInfo.myName[0],
- &aFieldInfo.myName[0],
- (unsigned char*)&anArray[0],
- MED_FULL_INTERLACE,
- aNbVal,
- aTimeStampInfo.myNbGauss,
- MED_ALL,
- &aVal.myPflName[0],
- MED_ECRI,
- anEntity,
- aGeom,
- aTimeStampInfo.myNumDt,
- &aTimeStampInfo.myUnitDt[0],
- aTimeStampInfo.myDt,
- aTimeStampInfo.myNumOrd);
- break;
- }
- default: {
- vector<TInt> anArray(iEnd);
- for(TInt i = 0; i< iEnd; i++) anArray[i] = TInt(aValue[i]);
-
- aRet = MEDchampEcr(anId,
- &aMeshInfo.myName[0],
- &aFieldInfo.myName[0],
- (unsigned char*)&anArray[0],
- MED_FULL_INTERLACE,
- aNbVal,
- aTimeStampInfo.myNbGauss,
- MED_ALL,
- &aVal.myPflName[0],
- MED_ECRI,
- anEntity,
- aGeom,
- aTimeStampInfo.myNumDt,
- &aTimeStampInfo.myUnitDt[0],
- aTimeStampInfo.myDt,
- aTimeStampInfo.myNumOrd);
- break;
- }}
-
- if(aRet < 0){
- if(theErr){
- *theErr = aRet;
- break;
- }
- EXCEPTION(runtime_error,"SetTimeStamp - MEDchampEcr(...)");
- }
-
- }
-
- INITMSG(MYDEBUG,"TVWrapper::SetMeshInfo - MED_MODE_ACCES = "<<theMode<<"; aRet = "<<aRet<<endl);
- }
-
-
- void TVWrapper::SetTimeStamp(const MED::TTimeStampVal& theVal,
- TErr* theErr)
- {
- TErr aRet;
- SetTimeStamp(theVal,eECRI,&aRet);
-
- if(aRet < 0)
- SetTimeStamp(theVal,eREMP,theErr);
- }
-
- }
-}
+++ /dev/null
-//
-//
-// Copyright (C) 2003 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.
-//
-// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File :
-// Author :
-// Module :
-// $Header$
-
-#ifndef MED_V2_1_Wrapper_HeaderFile
-#define MED_V2_1_Wrapper_HeaderFile
-
-#include "MED_TWrapper.hxx"
-
-namespace MED{
- namespace V2_1{
-
- const TInt PNOM = 8;
-
- typedef MED::TTMeshInfo<PNOM,DESC,IDENT,NOM,LNOM,eV2_1> TVMeshInfo;
-
- typedef MED::TTFamilyInfo<PNOM,DESC,IDENT,NOM,LNOM,eV2_1> TVFamilyInfo;
-
- typedef MED::TTNodeInfo<PNOM,DESC,IDENT,NOM,LNOM,eV2_1> TVNodeInfo;
-
- typedef MED::TTCellInfo<PNOM,DESC,IDENT,NOM,LNOM,eV2_1> TVCellInfo;
-
- typedef MED::TTFieldInfo<PNOM,DESC,IDENT,NOM,LNOM,eV2_1> TVFieldInfo;
-
- typedef MED::TTTimeStampInfo<PNOM,DESC,IDENT,NOM,LNOM,eV2_1> TVTimeStampInfo;
-
- typedef MED::TTTimeStampVal<PNOM,DESC,IDENT,NOM,LNOM,eV2_1> TVTimeStampVal;
-
- //---------------------------------------------------------------
- class TFile;
- typedef boost::shared_ptr<TFile> PFile;
-
- typedef enum {eLECT, eECRI, eREMP} EModeAcces;
-
- //---------------------------------------------------------------
- class TVWrapper: public MED::TTWrapper<PNOM,DESC,IDENT,NOM,LNOM,eV2_1>
- {
- 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 TInt GetNbNodes(const MED::TMeshInfo& theMeshInfo,
- 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 TEntityInfo GetEntityInfo(const MED::TMeshInfo& theMeshInfo,
- EConnectivite theTConn = eNOD,
- TErr* theErr = NULL);
-
- virtual TInt GetNbCells(const MED::TMeshInfo& theMeshInfo,
- EEntiteMaillage,
- EGeometrieElement,
- EConnectivite theTConn = 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);
-
-
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- 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 GetNbTimeStamps(const MED::TFieldInfo& theInfo,
- const MED::TEntityInfo& theEntityInfo,
- EEntiteMaillage& theEntity,
- TGeom& theGeom,
- TErr* theErr = NULL);
-
- virtual void GetTimeStampInfo(TInt theTimeStampId,
- MED::TTimeStampInfo& theInfo,
- TErr* theErr = NULL);
-
- virtual void GetTimeStampVal(MED::TTimeStampVal& theVal,
- TErr* theErr = NULL);
-
- virtual void SetTimeStamp(const MED::TTimeStampVal& theTimeStampVal,
- TErr* theErr = NULL);
-
- void SetTimeStamp(const MED::TTimeStampVal& theTimeStampVal,
- EModeAcces theMode,
- TErr* theErr = NULL);
-
- protected:
- PFile myFile;
- };
- }
-}
-
-#endif
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-/*
- * - Nom de la fonction : _MEDattrFermer
- * - Description : fermeture de l'acces a l'attribut dont l'ID est passe en
- * parametre
- * - Parametres :
- * - pid (IN) : l'ID de l'objet HDF pere ou placer l'attribut
- * - Resultat : 0 en cas de succes, -1 sinon
- */
-
-namespace med_2_1{
-
-med_err
-_MEDattrFermer(med_idt id)
-{
- med_err ret;
-
- if ((ret = H5Aclose(id)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-/*
- * - Nom de la fonction : _MEDattrNumEcrire
- * - Description : ecriture d'un attribut entier
- * - Parametres :
- * - pere (IN) : l'ID de l'objet HDF pere ou placer l'attribut
- * - type (IN) : le type du champ {MED_REEL64,MED_INT}
- * - nom (IN) : le nom de l'attribut
- * - val (IN) : la valeur de l'attribut
- * - Resultat : 0 en cas de succes, -1 sinon
- */
-
-namespace med_2_1{
-
-med_err
-_MEDattrNumEcrire(med_idt pere,med_type_champ type,char *nom,unsigned char *val,
- med_mode_acces mode)
-{
- med_idt aid,attr;
- med_err ret;
- int type_hdf;
-
- switch(type)
- {
- case MED_REEL64 :
- /* 1) IA32 is LE but due to an (?HDF convertion BUG?) when using H5T_NATIVE_DOUBLE/MED_REEL64? under PCLINUX
- the file read under SGI is incorrect
- 2) Compaq OSF/1 is LE, since we force SGI64,SUN4SOL2,HP to write double in LE even if they are BE, mips OSF/1 must be BE
- REM : Be careful of compatibility between MED files when changing this (med2.2) */
-#if defined(PCLINUX) || defined(OSF1)
- type_hdf = H5T_IEEE_F64BE;
-#else
- type_hdf = H5T_IEEE_F64LE;
-#endif
- break;
-
- case MED_INT :
-#if defined(IRIX64) || defined(OSF1)
- type_hdf = H5T_NATIVE_LONG;
-#elif defined(PCLINUX)
- /* This explicit convertion avoid a core dump between in HDF&ASTER when reading on SGI
- a file written under a PCLINUX system (in founction H5Tconvert),
- we don't know yet if it is an HDF bug or an ASTER one */
- /* The problem seems to be in convertion process between INT32LE->INT32BE ? */
- type_hdf = H5T_STD_I32BE;
- if ((H5Tconvert(H5T_NATIVE_INT,H5T_STD_I32BE,1,(void *)val,NULL,NULL)) < 0)
- return -1;
-#else
- type_hdf = H5T_NATIVE_INT;
-#endif
- break;
-
- default :
- return -1;
- }
-
- if ((aid = H5Screate(H5S_SCALAR)) < 0)
- return -1;
-
- if ( ((attr = H5Aopen_name(pere,nom)) > 0) && (mode != MED_REMP) )
- return -1;
- else
- if ( attr < 0)
- if ((attr = H5Acreate(pere,nom,type_hdf,aid,H5P_DEFAULT)) < 0) return -1;
-
- if ((ret = H5Awrite(attr,type_hdf,val)) < 0)
- return -1;
-
-
- if ((ret = H5Sclose(aid)) < 0)
- return -1;
- if ((ret = H5Aclose(attr)) < 0)
- return -1;
-
-#if defined(PCLINUX)
- /* This explicit convertion cancel the previous on which avoid a mysterious bug between HDF&ASTER when reading
- a file written under a PCLINUX system, we don't know yet if it is an HDF bug or an ASTER one */
- if (type == MED_INT)
- if ((H5Tconvert(H5T_STD_I32BE,H5T_NATIVE_INT,1,(void *)val,NULL,NULL)) < 0)
- return -1;
-#endif
-
- return 0;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-/*
- * - Nom de la fonction : _MEDattrNumLire
- * - Description : lecture d'un attribut entier
- * - Parametres :
- * - pere (IN) : l'ID de l'objet HDF pere ou placer l'attribut
- * - type (IN) : le type du champ {MED_REEL64,MED_INT}
- * - nom (IN) : le nom de l'attribut
- * - val (OUT) : la valeur de l'attribut
- * - Resultat : 0 en cas de succes, -1 sinon
- */
-
-namespace med_2_1{
-
-med_err
-_MEDattrNumLire(med_idt pere,med_type_champ type,char *nom,unsigned char *val)
-{
- med_idt attid;
- med_err ret;
- int type_hdf;
-
- if ((attid = H5Aopen_name(pere,nom)) < 0)
- return -1;
-
- switch(type)
- {
- case MED_REEL64 :
-#if defined(PCLINUX) || defined(OSF1)
- type_hdf = H5T_IEEE_F64BE;
-#else
- type_hdf = H5T_IEEE_F64LE;
-#endif
- break;
-
- case MED_INT :
-#if defined(IRIX64) || defined(OSF1)
- type_hdf = H5T_NATIVE_LONG;
-#else
- type_hdf = H5T_NATIVE_INT;
-#endif
- break;
-
- default :
- return -1;
- }
-
- if ((ret = H5Aread(attid,type_hdf,val)) < 0)
- return -1;
-
- if ((ret = H5Aclose(attid)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-/*
- * - Nom de la fonction : _MEDattrOuvrir
- * - Description : acces a l'attribut dont le nom est passe en parametre
- * - Parametres :
- * - pid (IN) : l'ID de l'objet HDF pere ou placer l'attribut
- * - nom (IN) : le nom de l'attribut
- * - Resultat : ID de l'attribut en cas de succes, -1 sinon
- */
-
-namespace med_2_1{
-
-med_idt
-_MEDattrOuvrir(med_idt pid,char * nom)
-{
- med_idt aid;
-
- if ((aid = H5Aopen_name(pid,nom)) < 0)
- return -1;
-
- return aid;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-/*
- * - Nom de la fonction : _MEDattrStringEcrire
- * - Description : ecriture d'un attribut chaine de caracteres
- * - Parametres :
- * - pere (IN) : l'ID de l'objet HDF pere ou placer l'attribut
- * - nom (IN) : le nom de l'attribut
- * - longueur (IN) : strlen(val)
- * - val (IN) : la valeur de l'attribut
- * - Resultat : 0 en cas de succes, -1 sinon
- */
-
-namespace med_2_1{
-
-med_err
-_MEDattrStringEcrire(med_idt pere,char *nom,int longueur,char *val, med_mode_acces mode)
-{
- med_idt aid,attr, datatype;
- med_err ret;
-
- if ((aid = H5Screate(H5S_SCALAR)) < 0)
- return -1;
- if((datatype = H5Tcopy(H5T_C_S1)) < 0)
- return -1;
- if((ret = H5Tset_size(datatype,longueur+1)) < 0)
- return -1;
-
- if ( ((attr = H5Aopen_name(pere,nom)) > 0)
- && (mode != MED_REMP) )
- return -1;
- else
- if ( attr < 0)
- if ((attr = H5Acreate(pere,nom,datatype,aid,H5P_DEFAULT)) < 0) return -1;
-
- if ((ret = H5Awrite(attr, datatype, val)) < 0)
- return -1;
-
- if ((ret = H5Sclose(aid)) < 0)
- return -1;
- if ((ret = H5Tclose(datatype)) < 0)
- return -1;
- if ((ret = H5Aclose(attr)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-/*
- * - Nom de la fonction : _MEDattrStringLire
- * - Description : lecture d'un attribut chaine de caracteres
- * - Parametres :
- * - pere (IN) : l'ID de l'objet HDF pere ou placer l'attribut
- * - nom (IN) : le nom de l'attribut
- * - longueur (IN) : strlen(val)
- * - val (OUT) : la valeur de l'attribut
- * - Resultat : 0 en cas de succes, -1 sinon
- */
-
-namespace med_2_1{
-
-med_err
-_MEDattrStringLire(med_idt pere,char *nom,int longueur,char *val)
-{
- med_idt attid,datatype;
- med_err ret;
-
- if ((datatype = H5Tcopy(H5T_C_S1)) < 0)
- return -1;
- if ((ret = H5Tset_size(datatype,longueur+1)) < 0)
- return -1;
- if ((attid = H5Aopen_name(pere,nom)) < 0)
- return -1;
- if ((ret = H5Aread(attid,datatype,val)) < 0)
- return -1;
- if ((ret = H5Tclose(datatype)) < 0)
- return -1;
- if ((ret = H5Aclose(attid)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med_outils.hxx"
-#include "med.hxx"
-
-#if defined(IRIX64)
-#define MED_INTEGER MED_INT64
-#else
-#define MED_INTEGER MED_INT32
-#endif
-
-namespace med_2_1{
-
-med_err
-MEDbodyFittedEcr(med_idt fid, char *maa, med_int mdim, med_float *coo, med_int *nbr, med_mode_switch mode_coo,
- med_repere repere, char *nomcoo, char *unicoo, med_int *fam, med_int nnoeuds, med_mode_acces mode )
-{
- /* ecriture des coordonnees */
- med_idt maaid, noeid, dataset;
- med_size dimd[1];
- char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
- med_int type_rep_int;
- int d;
- char *ds;
-
- /* On inhibe le gestionnaire d'erreur HDF */
- _MEDmodeErreurVerrouiller();
-
- /* Si le maillage n'existe pas => erreur */
- strcpy(chemin, MED_MAA);
- strcat(chemin, maa);
- if ((maaid = _MEDdatagroupOuvrir(fid, chemin)) < 0) {
- return(-1);
- };
-
- /* Si le Data Group "NOE" n'existe pas on le cree */
- if ((noeid = _MEDdatagroupOuvrir(maaid, MED_NOM_NOE)) < 0) {
- if ((noeid = _MEDdatagroupCreer(maaid, MED_NOM_NOE)) < 0) {
- return(-1);
- };
- };
-
- /* Creation du Data Set "BOF" */
- dimd[0] = nnoeuds*mdim;
- if (_MEDdatasetNumEcrire(noeid, MED_NOM_BOF, MED_REEL64, mode_coo, mdim, MED_ALL, MED_NOPF, 0, 0, dimd, (unsigned char*)coo, mode) < 0) {
- return(-1);
- };
-
- /* On re-ouvre le Data Set "BOF" pour y placer des attributs */
- if ((dataset = _MEDdatasetOuvrir(noeid, MED_NOM_BOF)) < 0) {
- return(-1);
- };
-
- /* Attribut NBR (nombre de noeuds) */
- if (_MEDattrEntierEcrire(dataset, MED_NOM_NBR, &nnoeuds, mode) < 0) {
- return(-1);
- };
-
- /* L'attribut "REP" */
- type_rep_int = (med_int)repere;
- if (_MEDattrEntierEcrire(dataset, MED_NOM_REP, &type_rep_int, mode) < 0) {
- return(-1);
- };
-
- /* Attribut "NOM" */
- if (_MEDattrStringEcrire(dataset, MED_NOM_NOM, mdim*MED_TAILLE_PNOM, nomcoo, mode) < 0) {
- return(-1);
- };
-
- /* Attribut "UNI" */
- if (_MEDattrStringEcrire(dataset, MED_NOM_UNI, mdim*MED_TAILLE_PNOM, unicoo, mode) < 0) {
- return(-1);
- };
-
- if (_MEDdatasetFermer(dataset) < 0) return(-1);
-
- dimd[0] = 1;
- for (d=0; d<mdim; d++) {
- switch (d) {
- case 0 : {
- ds = MED_NOM_IN1;
- break;
- };
- case 1 : {
- ds = MED_NOM_IN2;
- break;
- };
- case 2 : {
- ds = MED_NOM_IN3;
- break;
- };
- default : {
- return(-1);
- };
- };
-
- /* Creation du Data Set "IN1", "IN2", "IN3" contenant la taille du bodyfitted sur cette dimension */
- if (_MEDdatasetNumEcrire(noeid, ds, MED_INTEGER, mode_coo, MED_DIM1, MED_ALL, MED_NOPF, 0, 0, dimd, (unsigned char*)&nbr[d], mode) < 0) {
- return(-1);
- };
-
- /* On re-ouvre ce Data Set pour y placer des attributs */
- if ((dataset = _MEDdatasetOuvrir(noeid, ds)) < 0) {
- return(-1);
- };
-
- /* Attribut NBR (nombre de noeuds dans l'une des dimensions) */
- if (_MEDattrEntierEcrire(dataset, MED_NOM_NBR, &nbr[d], mode) < 0) {
- return(-1);
- };
-
- if (_MEDdatasetFermer(dataset) < 0) return(-1);
- };
-
- /* Ecriture des numeros de familles */
- if (MEDfamEcr(fid, maa, fam, nnoeuds, mode, MED_NOEUD, MED_POINT1) < 0) {
- return(-1);
- };
-
- /* On ferme tout */
- if (_MEDdatagroupFermer(noeid) < 0) return(-1);
- if (_MEDdatagroupFermer(maaid) < 0) return(-1);
- return(0);
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med_outils.hxx"
-#include "med.hxx"
-
-namespace med_2_1{
-
-med_err
-MEDbodyFittedLire(med_idt fid, char *maa, med_int mdim, med_float *coo, med_mode_switch mode_coo,
- med_repere *repere, char *nomcoo, char *unicoo, med_int *fam, med_int nnoeuds )
-{
- med_idt maaid, noeid, dataset;
- char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
- med_int type_rep_int;
-
- /* On inhibe le gestionnaire d'erreur */
- _MEDmodeErreurVerrouiller();
-
- /* Si le maillage n'existe pas => erreur */
- strcpy(chemin, MED_MAA);
- strcat(chemin, maa);
- maaid = _MEDdatagroupOuvrir(fid, chemin);
- if (maaid < 0) return(-1);
-
- /* Si le Data Group "NOE" n'existe pas => erreur */
- noeid = _MEDdatagroupOuvrir(maaid, MED_NOM_NOE);
- if (noeid < 0) return(-1);
-
- /* Lecture du Data Set "BOF" */
- if (_MEDdatasetNumLire(noeid, MED_NOM_BOF, MED_REEL64, mode_coo, mdim, MED_ALL, MED_NOPF, 0, 1, (unsigned char*)coo) < 0) {
- return(-1);
- };
-
- /* On re-ouvre le Data Set "BOF" pour y lire des attributs */
- dataset = _MEDdatasetOuvrir(noeid, MED_NOM_BOF);
- if (dataset < 0) return(-1);
-
- /* L'attribut "REP" */
- if (_MEDattrEntierLire(dataset, MED_NOM_REP, &type_rep_int) < 0) {
- return(-1);
- } else {
- *repere = (med_repere)type_rep_int;
- };
-
- /* Attribut "NOM" */
- if (_MEDattrStringLire(dataset, MED_NOM_NOM, mdim*MED_TAILLE_PNOM, nomcoo) < 0) {
- return(-1);
- };
-
- /* Attribut "UNI" */
- if (_MEDattrStringLire(dataset, MED_NOM_UNI, mdim*MED_TAILLE_PNOM, unicoo) < 0) {
- return(-1);
- };
-
- /* lecture des numeros de familles */
- if (MEDfamLire(fid, maa, fam, nnoeuds, MED_NOEUD, MED_POINT1) < 0) {
- return(-1);
- };
-
- /* On ferme tout */
- if (_MEDdatasetFermer(dataset) < 0) {
- return(-1);
- };
- if (_MEDdatagroupFermer(noeid) < 0) {
- return(-1);
- };
- if (_MEDdatagroupFermer(maaid) < 0) {
- return(-1);
- };
- return(0);
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <string.h>
-#include <stdlib.h>
-
-namespace med_2_1{
-
-med_err
-MEDchampCr(med_idt fid, char *champ, med_type_champ type, char *comp,
- char *unit,med_int ncomp)
-{
- med_err ret = 0;
- med_idt root,gid;
- char chemin[MED_TAILLE_CHA+1];
- med_size dimd[1];
- med_int _type = (med_int) type;
-
- /*
- * On inhibe le gestionnaire d'erreur HDF 5
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * Si le Data Group "/CHA/" n'existe pas, on le cree
- */
- strncpy(chemin,MED_CHA,MED_TAILLE_CHA-1);
- chemin[MED_TAILLE_CHA-1] = '\0';
- if ((root = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- if ((root = _MEDdatagroupCreer(fid,chemin)) < 0)
- return -1;
-
- /*
- * Si le Data Group cha n'existe pas, on le cree
- * Sinon => erreur
- */
- if ((gid = _MEDdatagroupOuvrir(root,champ)) >= 0)
- return -1;
- if ((gid = _MEDdatagroupCreer(root,champ)) < 0)
- return -1;
-
- /*
- * Les infos sur les composants du champ
- */
- if ((ret = _MEDattrEntierEcrire(gid,MED_NOM_NCO,&ncomp,MED_REMP)) < 0)
- return -1;
- if ((ret = _MEDattrEntierEcrire(gid,MED_NOM_TYP,&_type,MED_REMP)) < 0)
- return -1;
- if ((ret = _MEDattrStringEcrire(gid,MED_NOM_NOM,MED_TAILLE_PNOM*ncomp,comp,MED_REMP)) < 0)
- return -1;
- if ((ret = _MEDattrStringEcrire(gid,MED_NOM_UNI,MED_TAILLE_PNOM*ncomp,unit,MED_REMP)) < 0)
- return -1;
-
- /*
- * On ferme tout
- */
- if ((ret = _MEDdatagroupFermer(gid)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(root)) < 0)
- return -1;
-
- return ret;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <string.h>
-#include <stdlib.h>
-
-/*
- * - Nom de la fonction : MEDchampEcr
- * - Description : ecriture d'un Champ Résultat
- * - Parametres :
- * - fid (IN) : ID du fichier HDF courant
- * - maa (IN) : le nom du maillage sur lequel s'applique le champ
- * - cha (IN) : le nom du champ
- * - val (IN) : valeurs du champ à stocker
- * - interlace(IN) : entrelacement utilisé en mémoire {MED_FULL_INTERLACE,MED_NO_INTERLACE}
- * - nbelem (IN) : nombre d'éléments (prend en compte le nbre
- * de points de Gauss (c'est demandé à l'utilisateur ds la doc) mais pas le nbre de composantes)
- * - ngauss (IN) : nbre de point de gauss utilisé (MED_NOPG si aucun)
- * - numco (IN) : n° de la composante à stocker (MED_ALL si toutes)
- * - profil (IN) : nom du profil utilisé (MED_NOPFL si inutilisé)
- * - mode (IN) : mode d'ecriture MED (MED_ECRI | MED_REMP)
- * - type_ent (IN) : entité concerné par le champ {MED_NOEUD,MED_ARETE,MED_FACE,MED_MAILLE}
- * - type_geo (IN) : type géométrique de l'entité concerné {MED_POINT,MED_SEG2 ......}
- * - numdt (IN) : n° du pas de temps (MED_NOPDT si aucun)
- * - dt_unit (IN) : chaine de taille MED_NOMP indiquant l'unité du champ
- * - dt (IN) : valeur du pas de temps
- * - numo (IN) : n° d'ordre utilisé MED_NONOR si inutile
- * - Resultat : 0 en cas de succes, -1 sinon
- */
-
-namespace med_2_1{
-
-med_err
-MEDchampEcr(med_idt fid, char *maa, char *cha,unsigned char *val,med_mode_switch interlace,med_int nbelem,med_int ngauss,
- med_int numco, char * profil, med_mode_acces mode, med_entite_maillage type_ent,
- med_geometrie_element type_geo, med_int numdt,char * dt_unit, med_float dt, med_int numo)
-{
- med_err ret;
- med_idt chid,datagroup1,datagroup2;
- med_int ncomp, chtype, i, locnumdt,pfluse;
- char pflname [MED_TAILLE_NOM+1];
- char maillage[MED_TAILLE_NOM+1];
- char nomdatagroup1[2*MED_TAILLE_NOM_ENTITE+2],nomdatagroup2[2*MED_MAX_PARA+1];
- char tmp1[MED_TAILLE_NOM_ENTITE+1];
- med_size dimd[1],psize;
- med_int *pfltabtmp=0;
- med_ssize *pfltab=0;
- char chemin[MED_TAILLE_CHA+MED_TAILLE_NOM+1];
-
- /*
- * On inhibe le gestionnaire d'erreur HDF 5
- */
- _MEDmodeErreurVerrouiller();
-
-
- /*
- * Si le Data Group cha n'existe pas => erreur
- */
- strcpy(chemin,MED_CHA);
- strcat(chemin,cha);
- if ((chid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
-
- /*
- * Creation du datagroup de niveau 1 <type_ent>[.<type_geo>]
- */
-
- if ((ret = _MEDnomEntite(nomdatagroup1,type_ent)) < 0)
- return -1;
- if ((type_ent != MED_NOEUD))
- {
- if ((ret = _MEDnomGeometrie(tmp1,type_geo)) < 0)
- return -1;
- strcat(nomdatagroup1,".");
- strcat(nomdatagroup1,tmp1);
- }
- datagroup1 = 0;
- if ( (datagroup1 = _MEDdatagroupOuvrir(chid,nomdatagroup1)) < 0)
- if ((datagroup1 = _MEDdatagroupCreer(chid,nomdatagroup1)) < 0)
- return -1;
-
- /* Creation du datagroup de niveau 2 <numdt>.<numoo> */
- if ( numdt == MED_NOPDT) locnumdt = MED_NOPDT; else locnumdt = numdt;
- sprintf(nomdatagroup2,"%*li%*li",MED_MAX_PARA,(long ) locnumdt,MED_MAX_PARA,(long ) numo);
-
-
- /*Cree ou ouvre (en mode MED_REMP) le datagroup nomdatagroup2 */
- datagroup2 = 0;
- if (((datagroup2 = _MEDdatagroupOuvrir(datagroup1,nomdatagroup2)) > 0)
- && (mode != MED_REMP))
- return -1;
- else
- if (datagroup2 < 0)
- if ((datagroup2 = _MEDdatagroupCreer(datagroup1,nomdatagroup2)) < 0)
- return -1;
-
- /*Cree ou ouvre (en mode MED_REMP) l'attribut MED_NOM_NDT */
- if ((ret = _MEDattrEntierEcrire(datagroup2,MED_NOM_NDT,&numdt,mode)) < 0)
- return -1;
-
- /*Cree ou ouvre (en mode MED_REMP) l'attribut MED_NOM_PDT */
- if ((ret = _MEDattrFloatEcrire(datagroup2,MED_NOM_PDT,&dt,mode)) < 0)
- return -1;
-
- /*Cree ou ouvre (en mode MED_REMP) l'attribut MED_NOM_NOR */
- if ((ret = _MEDattrEntierEcrire(datagroup2,MED_NOM_NOR,&numo,mode)) < 0)
- return -1;
-
- /*Cree ou ouvre (en mode MED_REMP) l'attribut MED_NOM_NBR */
- if ((ret = _MEDattrEntierEcrire(datagroup2,MED_NOM_NBR,&nbelem,mode)) < 0)
- return -1;
-
- /*Cree ou ouvre (en mode MED_REMP) l'attribut MED_MAA */
- /* rem : Aucune verification de l'existence du maillage */
- strncpy(maillage,maa,MED_TAILLE_NOM);
- maillage[MED_TAILLE_NOM]='\0';
- if ((ret = _MEDattrStringEcrire(datagroup2,MED_NOM_MAI,MED_TAILLE_NOM,maillage,mode)) < 0)
- return -1;
-
- /*Cree ou ouvre (en mode MED_REMP) l'attribut MED_NOM_PFL */
- pfluse = 0;
- if ( strlen(profil) == 0) /* idem MED_NOPFL*/
- strncpy(pflname,MED_NOPFLi,MED_TAILLE_NOM+1);
- else {
- strncpy(pflname,profil,MED_TAILLE_NOM);
- pflname[MED_TAILLE_NOM]='\0';
- pfluse = 1;
- }
- if ((ret = _MEDattrStringEcrire(datagroup2,MED_NOM_PFL,MED_TAILLE_NOM,pflname,mode)) < 0)
- return -1;
-
- /*Cree ou ouvre (en mode MED_REMP) l'attribut MED_NOM_UNI */
- if ( strlen(dt_unit) == 0) {
- if ((ret = _MEDattrStringEcrire(datagroup2,MED_NOM_UNI,MED_TAILLE_PNOM," ",mode)) < 0)
- return -1;
- } else
- if ((ret = _MEDattrStringEcrire(datagroup2,MED_NOM_UNI,MED_TAILLE_PNOM,dt_unit,mode)) < 0)
- return -1;
-
-
- /* Cree ou ouvre (en mode MED_REMP) l'attribut MED_NOM_NGAU */
- /* Ecriture du nombre de pts de gauss propre au <type_ent>[.<type_geo>] */
- /* On n'utilise pas ngauss=MED_NOPG mais ngauss=1 si aucun pt de gauss */
- if ((ret = _MEDattrEntierEcrire(datagroup2,MED_NOM_NGA,&ngauss,mode)) < 0)
- return -1;
-
- /*Lecture de l'attribut MED_NOM_NCO */
- if ((ret = _MEDattrEntierLire(chid,MED_NOM_NCO,&ncomp)) < 0)
- return -1;
-
- /*Determination de la taille dimd[0] du dataset à stocker*/
- dimd[0] = nbelem*ncomp;
-
- /* Gestion des profils*/
- if ( pfluse ) {
-
- if ( ( i = MEDnValProfil(fid,pflname) ) < 0 )
- return -1;
- else
- psize = i;
-
- pfltabtmp = (med_int *) malloc (sizeof(med_int)*psize);
- pfltab = (med_ssize *) malloc (sizeof(med_ssize)*psize);
- if ((ret = MEDprofilLire(fid,pfltabtmp,pflname)) < 0)
- return -1;
- for (i=0;i<psize;i++)
- pfltab[i] = (med_ssize) pfltabtmp[i];
-
- }
- else
- psize = MED_NOPF;
-
-
- /*
- * Ecriture du champ
- */
- if ((ret = _MEDattrEntierLire(chid,MED_NOM_TYP,&chtype)) < 0)
- return -1;
- switch(chtype)
- {
- case MED_REEL64 :
- if ((ret = _MEDdatasetNumEcrire(datagroup2,MED_NOM_CO,MED_REEL64,interlace,ncomp,numco,psize,pfltab,ngauss,dimd,val,
- mode)) < 0)
- return -1;
- break;
-
- case MED_INT32 :
-#if defined(IRIX64)||defined(OSF1)
- if ((ret = _MEDdatasetNumEcrire(datagroup2,MED_NOM_CO,MED_INT64,interlace,ncomp,numco,psize,pfltab,ngauss,dimd,val,
- mode)) < 0)
- return -1;
-#else
- if ((ret = _MEDdatasetNumEcrire(datagroup2,MED_NOM_CO,MED_INT32,interlace,ncomp,numco,psize,pfltab,ngauss,dimd,val,
- mode)) < 0)
- return -1;
-#endif
- break;
-
- case MED_INT64 :
-#if defined(IRIX64)||defined(OSF1)
- if ((ret = _MEDdatasetNumEcrire(datagroup2,MED_NOM_CO,MED_INT64,interlace,ncomp,numco,psize,pfltab,ngauss,dimd,val,
- mode)) < 0)
- return -1;
-#else
- return -1;
-#endif
- break;
-
- default :
- return -1;
- }
-
- /*
- * On ferme tout
- */
- if ( pfluse ) { free(pfltab); free(pfltabtmp);}
-
- if ((ret = _MEDdatagroupFermer(datagroup2)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(datagroup1)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(chid)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-namespace med_2_1{
-
-med_err
-MEDchampInfo(med_idt fid,int indice,char *champ,
- med_type_champ *type,char *comp,char *unit,
- med_int ncomp)
-{
- med_err ret=0;
- med_idt gid;
- char chemin[MED_TAILLE_CHA+MED_TAILLE_NOM+1];
- int num;
-
- /*
- * On inhibe le gestionnaire d'erreur HDF 5
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * On recupere le nom du champ
- */
- num = indice - 1;
- strcpy(chemin,MED_CHA);
- if ((ret = _MEDobjetIdentifier(fid,chemin,num,champ)) < 0)
- return -1;
-
- /*
- * Si le Data Group cha n'existe pas => erreur
- */
- strcat(chemin,champ);
- if ((gid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
-
-
- /*
- * La liste des attributs
- */
- if ((ret = _MEDattrEntierLire(gid,MED_NOM_TYP,(med_int*) type)) < 0)
- return -1;
- if ((ret = _MEDattrStringLire(gid,MED_NOM_NOM,ncomp*MED_TAILLE_PNOM,
- comp)) < 0)
- return -1;
- if ((ret = _MEDattrStringLire(gid,MED_NOM_UNI,ncomp*MED_TAILLE_PNOM,
- unit)) < 0)
- return -1;
-
- /*
- * On ferme tout
- */
- if ((ret = _MEDdatagroupFermer(gid)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <string.h>
-#include <stdlib.h>
-
- /*La taille de val allouée par l'utilisateur doit prendre en compte le nbre de points de gauss et le nbre de composantes*/
-
-namespace med_2_1{
-
-med_err
-MEDchampLire(med_idt fid,char *maa, char *cha, unsigned char *val,med_mode_switch interlace,med_int numco,
- char *profil,med_entite_maillage type_ent, med_geometrie_element type_geo,
- med_int numdt, med_int numo)
- /* VERIFIER LA POSSIBILITE DE RELIRE L'UNITE DE PAS DE TEMPS (DS CHAMPINFO) */
-{
- med_err ret;
- med_idt chid, datagroup1, datagroup2;
- med_int ncomp, chtype, ngauss, i, locnumdt, pfluse;
- char nomdatagroup1[2*MED_TAILLE_NOM_ENTITE+2],nomdatagroup2[2*MED_MAX_PARA+1];
- char tmp1[MED_TAILLE_NOM_ENTITE+1], pfltmp[MED_TAILLE_NOM+1];
- char chemin[MED_TAILLE_CHA+MED_TAILLE_NOM+1];
- med_size psize;
- med_int *pfltabtmp=0;
- med_ssize *pfltab=0;
- char maatmp[MED_TAILLE_NOM+1];
-
- /*
- * On inhibe le gestionnaire d'erreur HDF 5
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * Si le Data Group cha n'existe pas => erreur
- */
- strcpy(chemin,MED_CHA);
- strcat(chemin,cha);
- if ((chid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
-
- /*
- * Si le Data Group de niveau 1 <type_ent>[.<type_geo>] n'existe pas => erreur
- */
- if ((ret = _MEDnomEntite(nomdatagroup1,type_ent)) < 0)
- return -1;
- if ((type_ent != MED_NOEUD))
- {
- if ((ret = _MEDnomGeometrie(tmp1,type_geo)) < 0)
- return -1;
- strcat(nomdatagroup1,".");
- strcat(nomdatagroup1,tmp1);
- }
- datagroup1 = 0;
- if ( (datagroup1 = _MEDdatagroupOuvrir(chid,nomdatagroup1)) < 0 )
- return -1;
-
- /*
- * Si le Data Group de niveau 2 <numdtt>.<numoo> n'existe pas => erreur
- */
- if ( numdt == MED_NOPDT) locnumdt = MED_NOPDT; else locnumdt = numdt;
- sprintf(nomdatagroup2,"%*li%*li",MED_MAX_PARA,(long ) locnumdt,MED_MAX_PARA,(long ) numo);
-
- datagroup2 = 0;
- if ( (datagroup2 = _MEDdatagroupOuvrir(datagroup1,nomdatagroup2)) < 0)
- return -1;
-
- /* Lecture du nbre de composantes du champ */
-
- if ((ret = _MEDattrEntierLire(chid,MED_NOM_NCO,&ncomp)) < 0)
- return -1;
-
- /* Gestion des profils*/
-
- /*
- * Lire le profil demandé
- */
-
- if ((ret = _MEDattrStringLire(datagroup2,MED_NOM_PFL,MED_TAILLE_NOM,pfltmp)) < 0)
- return -1;
-
- if ( pfluse = (strcmp(pfltmp,MED_NOPFLi) && strcmp(pfltmp,"")) ) /* le test "" pour des raisons de compatibilité */
- {
- strcpy(profil,pfltmp);
- if ( (i = MEDnValProfil(fid,profil)) < 0 )
- return -1;
- else
- psize = i;
-
- pfltabtmp = (med_int *) malloc (sizeof(med_int)*psize);
- pfltab = (med_ssize *) malloc (sizeof(med_ssize)*psize);
- if ((ret = MEDprofilLire(fid,pfltabtmp,profil)) < 0)
- return -1;
- for (i=0;i<psize;i++)
- pfltab[i] = (med_ssize) pfltabtmp[i];
-
- }
- else {
- psize = MED_NOPF;
- strcpy(profil,MED_NOPFL);
- }
-
- /*
- * Lire le nom de maillage associé au champ
- */
- if ((ret = _MEDattrStringLire(datagroup2,MED_NOM_MAI,MED_TAILLE_NOM,maatmp)) < 0)
- return -1;
-
- if (strcmp(maa,maatmp))
- return -1;
-
- /* Lit le nbre de points de Gauss */
- /* (attribut MED_NOM_NGAU) propre au <type_ent>[.<type_geo>] pour simplifier la relecture */
- if ( (ret = _MEDattrEntierLire(datagroup2,MED_NOM_NGA,&ngauss)) < 0 )
- return -1;
-
- /*
- * Lecture du champ
- */
-
- if ((ret = _MEDattrEntierLire(chid,MED_NOM_TYP,&chtype)) < 0)
- return -1;
-
- switch(chtype)
- {
- case MED_REEL64 :
- if ((ret = _MEDdatasetNumLire(datagroup2,MED_NOM_CO,MED_REEL64,
- interlace,ncomp,numco,
- psize,pfltab,ngauss,val))< 0)
- return -1;
- break;
-
- case MED_INT32 :
-#if defined(IRIX64)||defined(OSF1)
- if ((ret = _MEDdatasetNumLire(datagroup2,MED_NOM_CO,MED_INT64,
- interlace,ncomp,numco,
- psize,pfltab,ngauss,val))< 0)
- return -1;
-#else
- if ((ret = _MEDdatasetNumLire(datagroup2,MED_NOM_CO,MED_INT32,
- interlace,ncomp,numco,
- psize, pfltab,ngauss,val))< 0)
- return -1;
-#endif
- break;
-
- case MED_INT64 :
-#if defined(IRIX64)||defined(OSF1)
- if ((ret = _MEDdatasetNumLire(datagroup2,MED_NOM_CO,MED_INT64,
- interlace,ncomp,numco,
- psize,pfltab,ngauss,val))< 0)
- return -1;
-#else
- return -1;
-#endif
- break;
-
- default :
- return -1;
- }
-
- /*
- * On ferme tout
- */
- if ( pfluse ) { free(pfltab); free(pfltabtmp);}
-
- if ((ret = _MEDdatagroupFermer(datagroup2)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(datagroup1)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(chid)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <string.h>
-#include <stdlib.h>
-
-extern int mode_interlace;
-
-namespace med_2_1{
-
-med_err
-MEDconnEcr(med_idt fid,char *maa, med_int mdim, med_int *connectivite,med_mode_switch mode_switch,
- med_int nbre,med_mode_acces mode,med_entite_maillage type_ent,
- med_geometrie_element type_geo,med_connectivite type_conn)
-{
- med_idt maaid, entid, geoid, dataset;
- med_err ret;
- med_size dimd[1];
- char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
- char nom_ent[MED_TAILLE_NOM_ENTITE+1];
- char nom_geo[MED_TAILLE_NOM_ENTITE+1];
- char nom_dataset[MED_TAILLE_NOM_ENTITE+1];
- int dim, nnoe, ndes;
- int nsup = 0;
- int taille;
-
- /*
- * On inhibe le gestionnaire d'erreur HDF 5
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * Si le maillage n'existe pas => erreur
- */
- strcpy(chemin,MED_MAA);
- strcat(chemin,maa);
- if ((maaid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
-
- /*
- * On met a jour le nom du Data Group representant
- * le type des entites
- */
- if ((ret = _MEDnomEntite(nom_ent,type_ent)) < 0)
- return -1;
- /*
- * Si le Data Group des entites n'existe pas on le cree
- */
- /*EF Gerer le mode */
- if ((entid = _MEDdatagroupOuvrir(maaid,nom_ent)) < 0)
- if ((entid = _MEDdatagroupCreer(maaid,nom_ent)) < 0)
- return -1;
-
- /*
- * On cree s'il n'existe pas le Data Group du type geometrique
- */
- /*EF Gerer le mode */
- if ((ret = _MEDnomGeometrie(nom_geo,type_geo)) < 0)
- return -1;
- if ((geoid = _MEDdatagroupOuvrir(entid,nom_geo)) < 0)
- if ((geoid = _MEDdatagroupCreer(entid,nom_geo)) < 0)
- return -1;
-
- /*
- * On regarde si le Data Set existe et on le cree sinon
- */
- if ((ret=_MEDparametresGeometrie(type_ent,type_geo,&dim,&nnoe,&ndes))<0)
- return -1;
- if (mdim == 2 || mdim == 3)
- if (type_ent == MED_MAILLE && dim == 1)
- nsup = 1;
- if (mdim == 3)
- if (type_ent == MED_MAILLE && dim == 2)
- nsup = 1;
- switch(type_conn)
- {
- case MED_NOD :
- strcpy(nom_dataset,MED_NOM_NOD);
- taille = nsup + nnoe;
- break;
-
- case MED_DESC :
- strcpy(nom_dataset,MED_NOM_DES);
- taille = nsup + ndes;
- break;
-
- default :
- return -1;
- }
- dimd[0] = nbre*taille;
-#if defined(IRIX64)||defined(OSF1)
- if ((ret = _MEDdatasetNumEcrire(geoid,nom_dataset,MED_INT64,mode_switch,(med_size)taille,MED_ALL,MED_NOPF,0,MED_NOPG,dimd,
- (unsigned char*) connectivite,mode)) < 0)
- return -1;
-#else
- if ((ret = _MEDdatasetNumEcrire(geoid,nom_dataset,MED_INT32,mode_switch,(med_size)taille,MED_ALL,MED_NOPF,0,MED_NOPG,dimd,
- (unsigned char*) connectivite,mode)) < 0)
- return -1;
-#endif
-
- /*
- * Attribut NBR (nombre de noeuds ou d'elements)
- */
- if ((dataset = _MEDdatasetOuvrir(geoid,nom_dataset)) < 0)
- return -1;
- if ((ret = _MEDattrEntierEcrire(dataset,MED_NOM_NBR,&nbre,mode)) < 0)
- return -1;
-
- /*
- * On ferme tout
- */
- if ((ret = _MEDdatasetFermer(dataset)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(geoid)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(entid)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(maaid)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <string.h>
-#include <stdlib.h>
-
-extern int mode_interlace;
-
-namespace med_2_1{
-
-med_err
-MEDconnLire(med_idt fid,char *maa,med_int mdim,med_int *connectivite,med_mode_switch mode_switch,
- med_int * pfltabtmp, med_size psizetmp,
- med_entite_maillage type_ent, med_geometrie_element type_geo,med_connectivite type_conn)
-{
- med_idt maaid,entid,geoid;
- med_err ret;
- char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
- char nom_ent[MED_TAILLE_NOM_ENTITE+1];
- char nom_geo[MED_TAILLE_NOM_ENTITE+1];
- char nom_dataset[MED_TAILLE_NOM_ENTITE+1];
- med_ssize * pfltab;
- med_size psize;
- int dim,nnoe,ndes;
- int nsup = 0;
- int taille;
- int i,j;
-
- /*
- * On inhibe le gestionnaire d'erreur HDF 5
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * Si le maillage n'existe pas => erreur
- */
- strcpy(chemin,MED_MAA);
- strcat(chemin,maa);
- if ((maaid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
-
- /*
- * On met a jour le nom du Data Group representant
- * le type des entites
- */
- if ((ret = _MEDnomEntite(nom_ent,type_ent)) < 0)
- return -1;
- /*
- * Si le Data Group des entites n'existe pas => erreur
- */
- if ((entid = _MEDdatagroupOuvrir(maaid,nom_ent)) < 0)
- return -1;
-
- /*
- * si le Data Group du type geometrique n'existe pas => erreur
- */
- if ((ret = _MEDnomGeometrie(nom_geo,type_geo)) < 0)
- return -1;
- if ((geoid = _MEDdatagroupOuvrir(entid,nom_geo)) < 0)
- return -1;
-
- /*
- * Si le Data Set de la connectivite n'existe pas => erreur
- * Si oui => on le lit
- */
- if ((ret=_MEDparametresGeometrie(type_ent,type_geo,&dim,&nnoe,&ndes))<0)
- return -1;
- if (mdim == 2 || mdim == 3)
- if (type_ent == MED_MAILLE && dim == 1)
- nsup = 1;
- if (mdim == 3)
- if (type_ent == MED_MAILLE && dim == 2)
- nsup = 1;
-
-
- psize = psizetmp;
- switch(type_conn)
- {
- case MED_NOD :
- strcpy(nom_dataset,MED_NOM_NOD);
- taille = nsup + nnoe;
- break;
-
- case MED_DESC :
- strcpy(nom_dataset,MED_NOM_DES);
- taille = nsup + ndes;
- if ( psizetmp != MED_NOPF ) {
- psize = psizetmp;
- pfltab = (med_ssize *) malloc (sizeof(med_ssize)*psize);
- for (i=0;i<psizetmp;i++)
- pfltab[i] = (med_ssize) (pfltabtmp[i]);
- };
-
- break;
-
- default :
- return -1;
- }
-
-
-#if defined(IRIX64)||defined(OSF1)
- if ((ret = _MEDdatasetNumLire(geoid,nom_dataset,MED_INT64,
- mode_switch,(med_size)taille,MED_ALL,
- psize,pfltab,MED_NOPG,
- (unsigned char*) connectivite)) < 0)
- return -1;
-#else
- if ((ret = _MEDdatasetNumLire(geoid,nom_dataset,MED_INT32,
- mode_switch,(med_size) taille,MED_ALL,
- psize,pfltab,MED_NOPG,
- (unsigned char*) connectivite)) < 0)
- return -1;
-#endif
-
- /*
- * On ferme tout
- */
-
- if ( (psize != MED_NOPF) && (type_conn == MED_DESC) ) free(pfltab);
-
- if ((ret = _MEDdatagroupFermer(geoid)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(entid)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(maaid)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med_outils.hxx"
-#include "med.hxx"
-
-#include <stdlib.h>
-#include <string.h>
-
-namespace med_2_1{
-
-med_err
-MEDcoordEcr(med_idt fid, char *maa, med_int mdim, med_float *coo,
- med_mode_switch mode_coo,med_int n,
- med_mode_acces mode, med_repere type_rep, char *nom, char *unit)
-{
- med_idt maaid, noeid, dataset;
- med_err ret;
- med_size dimd[1];
- char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
- med_int type_rep_int;
- /*
- * On inhibe le gestionnaire d'erreur HDF
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * Si le maillage n'existe pas => erreur
- */
- strcpy(chemin,MED_MAA);
- strcat(chemin,maa);
- if ((maaid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
-
- /*
- * Si le Data Group "NOE" n'existe pas
- * on le cree
- */
- /* EF : A faire : gerer le mode MED_REMP*/
- if ((noeid = _MEDdatagroupOuvrir(maaid,MED_NOM_NOE)) < 0)
- if ((noeid = _MEDdatagroupCreer(maaid,MED_NOM_NOE)) < 0)
- return -1;
-
- /*
- * Creation du Data Set "COO"
- */
- dimd[0] = n*mdim;
- if ((ret = _MEDdatasetNumEcrire(noeid,MED_NOM_COO,MED_REEL64,mode_coo,mdim,MED_ALL,MED_NOPF,0,MED_NOPG,dimd,
- (unsigned char*) coo,mode)) < 0)
- return -1;
-
- /*
- * On re-ouvre le Data Set "COO" pour y placer des attributs
- */
- if ((dataset = _MEDdatasetOuvrir(noeid,MED_NOM_COO)) < 0)
- return -1;
-
- /*
- * Attribut NBR (nombre de noeuds)
- */
- if ((ret = _MEDattrEntierEcrire(dataset,MED_NOM_NBR,&n,mode)) < 0)
- return -1;
-
- /*
- * L'attribut "REP"
- */
- type_rep_int = (med_int) type_rep;
- if ((ret = _MEDattrEntierEcrire(dataset,MED_NOM_REP,&type_rep_int,mode)) < 0)
- return -1;
-
- /*
- * Attribut "NOM"
- */
- if ((ret = _MEDattrStringEcrire(dataset,MED_NOM_NOM,mdim*MED_TAILLE_PNOM,nom,mode)) < 0)
- return -1;
-
- /*
- * Attribut "UNI"
- */
- if ((ret = _MEDattrStringEcrire(dataset,MED_NOM_UNI,mdim*MED_TAILLE_PNOM,unit,mode)) < 0)
- return -1;
-
- /*
- * On ferme tout
- */
- if ((ret = _MEDdatasetFermer(dataset)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(noeid)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(maaid)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med_outils.hxx"
-#include "med.hxx"
-
-#include <string.h>
-#include <stdlib.h>
-
-extern int mode_interlace;
-
-namespace med_2_1{
-
-med_err
-MEDcoordLire(med_idt fid, char *maa, med_int mdim, med_float *coo,
- med_mode_switch mode_coo,med_int numco,
- med_int * pfltabtmp, med_size psize, med_repere *type_rep, char *nom, char *unit)
-{
- med_idt maaid, noeid, dataset;
- med_err ret;
- char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
- int i,j;
- med_float *new_coo;
- med_int type_rep_int;
- med_ssize * pfltab;
-
- /*
- * On inhibe le gestionnaire d'erreur
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * Si le maillage n'existe pas => erreur
- * Sinon on recupere sa dimension au passage
- */
- strcpy(chemin,MED_MAA);
- strcat(chemin,maa);
- if ((maaid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
-
- /*
- * Si le Data Group "NOE" n'existe pas => erreur
- */
- if ((noeid = _MEDdatagroupOuvrir(maaid,MED_NOM_NOE)) < 0)
- return -1;
-
- /*
- * Convertion de med_int en med_ssize
- */
- if ( psize != MED_NOPF ) {
- pfltab = (med_ssize *) malloc (sizeof(med_ssize)*psize);
- for (i=0;i<psize;i++)
- pfltab[i] = (med_ssize) pfltabtmp[i];
- }
-
- /*
- * Lecture du Data Set "COO"
- */
- if ((ret = _MEDdatasetNumLire(noeid,MED_NOM_COO,MED_REEL64,
- mode_coo,mdim,numco,
- psize,pfltab,MED_NOPG,
- (unsigned char*) coo)) < 0)
- return -1;
-
-
-
- /*
- * On re-ouvre le Data Set "COO" pour y lire des attributs
- */
- if ((dataset = _MEDdatasetOuvrir(noeid,MED_NOM_COO)) < 0)
- return -1;
-
- /*
- * L'attribut "REP"
- */
- if ((ret = _MEDattrEntierLire(dataset,MED_NOM_REP,&type_rep_int)) < 0)
- return -1;
- else
- *type_rep = (med_repere) type_rep_int;
-
- /*
- * Attribut "NOM"
- */
- if ((ret = _MEDattrStringLire(dataset,MED_NOM_NOM,mdim*MED_TAILLE_PNOM,
- nom)) < 0)
- return -1;
-
- /*
- * Attribut "UNI"
- */
- if ((ret = _MEDattrStringLire(dataset,MED_NOM_UNI,mdim*MED_TAILLE_PNOM,
- unit)) < 0)
- return -1;
-
- /*
- * On ferme tout
- */
- if ( psize != MED_NOPF ) free(pfltab);
-
- if ((ret = _MEDdatasetFermer(dataset)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(noeid)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(maaid)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include <stdlib.h>
-#include "med_misc.hxx"
-
-/*
- * - Nom de la fonction _MEDcstringFree
- * - Description : libere la chaine de caracteres creee par
- * les routines _MEDXcstring
- * - Parametres :
- * - chaine (IN/OUT) : la chaine de caracteres a detruire
- * - Resultat : 0 si succes, -1 sinon
- */
-
-namespace med_2_1{
-
-med_err
-_MEDcstringFree(char *chaine)
-{
-
- free(chaine);
- return 0;
-
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-/*
- * - Nom de la fonction : _MEDdatagroupCreer
- * - Description : creation et ouverture d'un Datagroup HDF
- * - Parametres :
- * - pid (IN) : l'ID de l'objet pere
- * - nom (IN) : le nom de l'objet fils
- * - Resultat : l'ID du fils en cas de succes, -1 sinon
- */
-
-namespace med_2_1{
-
-med_idt
-_MEDdatagroupCreer(med_idt pid, char *nom)
-{
- med_idt id;
-
- if ((id = H5Gcreate(pid,nom,0)) < 0)
- return -1;
-
- return id;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-/*
- * - Nom de la fonction : _MEDdatagroupFermer
- * - Description : fermeture d'un datagroup HDF
- * - Parametres :
- * - id (IN) : l'ID du datagroup
- * - Resultat : 0 en cas de succes, -1 sinon
- */
-
-namespace med_2_1{
-
-med_err
-_MEDdatagroupFermer(med_idt id)
-{
- med_err ret;
-
- if ((ret = H5Gclose(id)) < 0)
- return -1;
- else
- return 0;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-/*
- * - Nom de la fonction : _MEDdatagroupOuvrir
- * - Description : ouverture d'un datagroup HDF
- * - Parametres :
- * - pid (IN) : l'ID de l'objet pere
- * - nom (IN) : le nom de l'objet fils
- * - Resultat : l'ID du fils en cas de succes, -1 sinon
- */
-
-namespace med_2_1{
-
-med_idt
-_MEDdatagroupOuvrir(med_idt pid, char *nom)
-{
- med_idt id;
-
- if ((id = H5Gopen(pid,nom)) < 0)
- return -1;
-
- return id;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-/*
- * - Nom de la fonction : _MEDdatasetFermer
- * - Description : fermeture d'un objet HDF dataset
- * - Parametres :
- * - id (IN) : l'ID de l'objet HDF dataset
- * - Resultat : 0 en cas de succes, -1 sinon
- */
-
-namespace med_2_1{
-
-med_err
-_MEDdatasetFermer(med_idt id)
-{
- med_err ret;
-
- if ((ret = H5Dclose(id)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-#include <stdlib.h>
-
-/*
- * - Nom de la fonction : _MEDdatasetNumEcrire
- * - Description : ecriture d'un dataset tableau numerique
- * - Parametres :
- * - pere (IN) : l'ID de l'objet HDF pere ou placer l'attribut
- * - nom (IN) : le nom du dataset
- * - type (IN) : type numerique MED { MED_REEL64 , MED_INT32 , MED_INT64 }
- * - interlace (IN) : Choix du type d'entrelacement utilisé par l'appelant { MED_FULL_INTERLACE(x1,y1,z1,x2,...)) , MED_NO_INTERLACE(x1,x2,y1,y2,z1,z2) }
- * - nbdim (IN) : Dimension des éléments
- * - fixdim (IN) : MED_ALL ou n° de la dimension a enregistrer
- * - psize (IN) : Taille du profil à utiliser, MED_NOPF si pas de profil
- * (référence les élements, cette taille ne prend pas en compte le nombre de pts de gauss ni la dimension )
- * - pfltab (IN) : Tableau contenant les n° déléments à traiter (1....oo)
- * - pflmod (IN) : PARAMETRE A AJOUTER : Indique comment lire les informations en mémoire { MED_COMPACT, MED_GLOBALE }.
- * - ngauss (IN) : Nombre de points de GAUSS par élément
- * - size (IN) : Taille du tableau de valeurs
- * (référence tous les élements, cette taille prend en compte le nombre de pts de gauss et la dimension )
- * - val (IN) : valeurs du tableau
- * - mode (IN) : mode d'ecriture MED (MED_ECRI | MED_REMP)
- * - Resultat : 0 en cas de succes, -1 sinon
- */
-
-namespace med_2_1{
-
-med_err
-_MEDdatasetNumEcrire(med_idt pere,char *nom, med_type_champ type,
- med_mode_switch interlace, med_size nbdim, med_size fixdim,
- med_size psize, med_ssize * pfltab, med_int ngauss,
- med_size *size, unsigned char *val, med_mode_acces mode)
-{
- med_idt dataset, dataspace = 0, memspace = 0;
- med_ssize start_mem[1],start_data[1],*pflmem,*pfldsk;
- med_size stride[1],count[1],pcount[1],pflsize[1];
- med_err ret;
- int i,j,index,type_hdf;
- int dim, firstdim, dimutil, lastdim ;
- med_mode_profil pflmod;
-
- /* Verify fixdim is between [0, nbdim] ( 0 is MED_ALL ) */
- if ( ( fixdim < 0 ) || ( fixdim > nbdim ) )
- return -1;
-
- /* block pflmod to MED_COMPACT (until med2.2) */
- pflmod = MED_COMPACT;
-
- switch(type)
- {
- case MED_REEL64 :
- /* 1) IA32 is LE but due to an (?HDF convertion BUG?) when using H5T_NATIVE_DOUBLE/MED_REEL64? under PCLINUX
- the file read under SGI is incorrect
- 2) Compaq OSF/1 is LE, since we force SGI64,SUN4SOL2,HP to write double in LE even if they are BE, mips OSF/1 must be BE
- REM : Be careful of compatibility between MED files when changing this (med2.2) */
-#if defined(PCLINUX) || defined(OSF1)
- type_hdf = H5T_IEEE_F64BE;
-#else
- type_hdf = H5T_IEEE_F64LE;
-#endif
- break;
-
- case MED_INT32 :
-#if defined(PCLINUX)
- type_hdf = H5T_STD_I32BE;
- if ((H5Tconvert(H5T_NATIVE_INT,H5T_STD_I32BE,(hsize_t)*size,(void *)val,NULL,NULL)) < 0)
- return -1;
-#else
- type_hdf = H5T_NATIVE_INT;
-#endif
- break;
-
- case MED_INT64 :
- type_hdf = H5T_NATIVE_LONG;
- break;
-
- default :
- return -1;
- }
-
-
- if ((dataset = H5Dopen(pere,nom)) < 0)
- {
- /* Whatever the size of the profil is we create a dataset with the size of the value array */
- /* Then if we used the MED_REMP mode we can append a new dimension to a previous one in the dataset */
- /* When we'll use the compression mode, the space used by unused values would be easily compressed */
-
- if ((dataspace = H5Screate_simple(1,size,NULL)) < 0)
- return -1;
- if ((dataset = H5Dcreate(pere,nom,type_hdf,dataspace,
- H5P_DEFAULT)) < 0)
- return -1;
- }
- else
- if (mode != MED_REMP)
- {
- H5Dclose(dataset);
- return -1;
- }
- else
- if ((dataspace = H5Dget_space(dataset)) <0)
- return -1;
-
-
- switch(interlace)
- { /* switch Interlace */
- case MED_FULL_INTERLACE :
-
- /*Initialisation des indices de boucle du traitement de l'entrelacement en fonction de la dimension fixee*/
- if ( fixdim != MED_ALL)
- {
- firstdim = fixdim-1;
- lastdim = fixdim;
- dimutil = 1;
- } else {
- firstdim = 0;
- lastdim = nbdim;
- dimutil = nbdim;
- }
-
- count [0] = (*size)/(nbdim);
-
-
- if ( psize == MED_NOPF ) {
-
- /* Creation d'un data space mémoire de dimension 1, de longeur size, et de longeur maxi size */
- if ( (memspace = H5Screate_simple (1, size, NULL)) <0)
- return -1;
-
- stride[0] = nbdim;
-
- for (dim=firstdim; dim < lastdim; dim++) {
-
- start_mem[0] = dim;
- if ( (ret = H5Sselect_hyperslab (memspace, H5S_SELECT_SET, start_mem, stride,
- count, NULL)) <0)
- return -1;
-
- start_data[0] = dim*count[0];
- if ( (ret = H5Sselect_hyperslab (dataspace, H5S_SELECT_SET, start_data, NULL,
- count, NULL)) <0)
- return -1;
-
- if ((ret = H5Dwrite(dataset,type_hdf,memspace,dataspace,
- H5P_DEFAULT, val)) < 0)
- return -1;
- }
-
- } else { /* psize != MED_NOPF */
-
- pflsize [0] = psize*ngauss*nbdim;
- pcount [0] = psize*ngauss*dimutil;
- pflmem = (med_ssize *) malloc (sizeof(med_ssize)*pcount[0]);
- pfldsk = (med_ssize *) malloc (sizeof(med_ssize)*pcount[0]);
-
- switch(pflmod)
- { /* switch pflmod pout FULL_INTERLACE*/
- case MED_GLOBALE :
-
- /* Creation d'un data space mémoire de dimension 1, de longeur size, et de longeur maxi size */
- if ( (memspace = H5Screate_simple (1, size, NULL)) <0)
- return -1;
-
- for (dim=firstdim; dim < lastdim; dim++) {
-
- for (i=0; i < psize; i++) /* i balaye les élements du profil */
- for (j=0; j < ngauss; j++) {
- index = i*ngauss+j + (dim-firstdim)*(psize*ngauss);
- pflmem[index] = (pfltab[i]-1)*ngauss*nbdim + j*nbdim+dim;
- pfldsk[index] = dim*count[0] + (pfltab[i]-1)*ngauss+j;
- }
- }
-
- if ( (ret = H5Sselect_elements(memspace,H5S_SELECT_SET, pcount[0], (const hssize_t **) pflmem ) ) <0)
- return -1;
-
- if ( (ret = H5Sselect_elements(dataspace,H5S_SELECT_SET, pcount[0], (const hssize_t **) pfldsk ) ) <0)
- return -1;
-
- break;
-
- case MED_COMPACT :
-
- /* Creation d'un data space mémoire de dimension 1, de la longeur du profil */
- /* La dimension utilisée est ici nbdim, même pour un profil compact on suppose */
- /* que l'utilisateur a toutes les coordonées stockées, même si il en demande qu'une */
-
- if ( (memspace = H5Screate_simple (1, pflsize, NULL)) <0)
- return -1;
-
- for (dim=firstdim; dim < lastdim; dim++) {
-
- for (i=0; i < psize; i++) /* i balaye les élements du profil */
- for (j=0; j < ngauss; j++) {
- index = i*ngauss+j + (dim-firstdim)*(psize*ngauss);
- pflmem[index] = i*ngauss*nbdim + j*nbdim+dim;
- pfldsk[index] = dim*count[0] + (pfltab[i]-1)*ngauss+j;
- }
- }
-
- if ( (ret = H5Sselect_elements(memspace,H5S_SELECT_SET, pcount[0], (const hssize_t **) pflmem ) ) <0)
- return -1;
-
- if ( (ret = H5Sselect_elements(dataspace,H5S_SELECT_SET, pcount[0], (const hssize_t **) pfldsk ) ) <0)
- return -1;
-
- break;
-
- default :
- return -1;
- }
-
- if ((ret = H5Dwrite(dataset,type_hdf,memspace,dataspace,H5P_DEFAULT, val)) < 0)
- return -1;
-
- free(pflmem);
- free(pfldsk);
- }
-
-
- break;
-
- case MED_NO_INTERLACE :
-
- /*Initialisation des indices de boucle du traitement de l'entrelacement en fonction de la dimension fixee*/
-
- count[0] = (*size)/nbdim;
-
- if ( psize == MED_NOPF ) {
-
- if ( fixdim != MED_ALL)
- start_data[0] = (fixdim-1)*count[0];
- else {
- count[0] = *size;
- start_data[0] = 0;
- };
-
- if ( (ret = H5Sselect_hyperslab (dataspace, H5S_SELECT_SET, start_data, NULL,
- count, NULL)) <0)
- return -1;
-
- if ((ret = H5Dwrite(dataset,type_hdf,dataspace,dataspace,
- H5P_DEFAULT, val)) < 0)
- return -1;
-
- } else {
-
- if ( fixdim != MED_ALL)
- {
- firstdim = fixdim-1;
- lastdim = fixdim;
- dimutil = 1;
- } else {
- firstdim = 0;
- lastdim = nbdim;
- dimutil = nbdim;
- }
-
- pflsize [0] = psize*ngauss*nbdim;
- pcount [0] = psize*ngauss*dimutil; /* nom pas très coherent avec count !!! A revoir */
- pfldsk = (med_ssize *) malloc(sizeof(med_ssize)*pcount[0]);
-
- switch(pflmod)
- { /*switch plfmod pour NO_INTERLACE */
- case MED_GLOBALE :
-
- for (dim=firstdim; dim < lastdim; dim++) {
-
- for (i=0; i < psize; i++) /* i balaye le nbre d'élements du profil */
- for (j=0; j < ngauss; j++) {
- index = i*ngauss+j + (dim-firstdim)*(psize*ngauss);
- pfldsk[index] = dim*count[0]+(pfltab[i]-1)*ngauss+j;
- }
- }
-
- if ( (ret = H5Sselect_elements(dataspace,H5S_SELECT_SET,pcount[0], (const hssize_t **) pfldsk ) ) <0)
- return -1;
-
- if ((ret = H5Dwrite(dataset,type_hdf,dataspace,dataspace,H5P_DEFAULT, val)) < 0)
- return -1;
-
- break;
-
- case MED_COMPACT :
-
- /* Creation d'un data space mémoire de dimension 1, de la longeur du profil */
- /* La dimension utilisée est ici nbdim, même pour un profil compact on suppose */
- /* que l'utilisateur a toutes les coordonées stockées, même si il en demande qu'une */
-
- if ( (memspace = H5Screate_simple (1, pflsize, NULL)) <0)
- return -1;
-
- pflmem = (med_ssize *) malloc (sizeof(med_ssize)*pcount[0]);
-
- /* Le profil COMPACT est contigüe, mais il est possible que l'on selectionne uniquemenent une dimension*/
-
- for (dim=firstdim; dim < lastdim; dim++) {
-
- for (i=0; i < psize; i++) /* i balaye le nbre d'élements du profil */
- for (j=0; j < ngauss; j++) {
- index = i*ngauss+j + (dim-firstdim)*(psize*ngauss);
- pflmem[index] = dim*(psize*ngauss) + (pfltab[i]-1)*ngauss+j;
- pfldsk[index] = dim*count[0] + (pfltab[i]-1)*ngauss+j;
- }
- }
-
- if ( (ret = H5Sselect_elements(memspace ,H5S_SELECT_SET,pcount[0], (const hssize_t **) pflmem ) ) <0)
- return -1;
-
- if ( (ret = H5Sselect_elements(dataspace,H5S_SELECT_SET,pcount[0], (const hssize_t **) pfldsk ) ) <0)
- return -1;
-
- if ((ret = H5Dwrite(dataset,type_hdf,memspace,dataspace,H5P_DEFAULT, val)) < 0)
- return -1;
-
- free(pflmem);
-
- break;
-
- default :
- return -1;
-
- }
-
- free(pfldsk);
-
- };
-
- break;
-
- default :
- return -1;
- }
-
-
- if (memspace)
- if ((ret = H5Sclose(memspace)) < 0)
- return -1;
-
- if ((ret = H5Sclose(dataspace)) < 0)
- return -1;
-
- if ((ret = H5Dclose(dataset)) < 0)
- return -1;
-
-#if defined(PCLINUX)
- if (type == MED_INT32)
- if ((H5Tconvert(H5T_STD_I32BE,H5T_NATIVE_INT,(hsize_t)*size,(void *)val,NULL,NULL)) < 0)
- return -1;
-#endif
-
- return 0;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-#include <stdlib.h>
-
-/*
- * - Nom de la fonction : _MEDdatasetNumLire
- * - Description : lecture d'un dataset tableau numerique
- * - Parametres :
- * - pere (IN) : l'ID de l'objet HDF pere ou placer l'attribut
- * - nom (IN) : le nom du dataset
- * - type (IN) : type numerique MED
- * - interlace (IN) : Choix du type d'entrelacement demandé par l'appelant { MED_FULL_INTERLACE(x1,y1,z1,x2,...)) , MED_NO_INTERLACE(x1,x2,y1,y2,z1,z2) }
- * - nbdim (IN) : Dimension des éléments
- * - fixdim (IN) : MED_ALL ou n° de la dimension a enregistrer à partir de 1..oo
- * - psize (IN) : Taille du profil à utiliser, MED_NOPF si pas de profil
- * - pfltab (IN) : Tableau contenant les n° déléments à traiter (1....oo)
- * - pflmod (IN) : PARAMETRE A AJOUTER : Indique comment lire les informations en mémoire { MED_COMPACT, MED_GLOBALE }.
- * - ngauss (IN) : Nombre de points de GAUSS par élément
- * - val (OUT) : valeurs du tableau
- * - Resultat : 0 en cas de succes, -1 sinon
- * Equivalent à l'ancienne routine si .....,MED_NO_INTERLACE,1,MED_ALL,MED_NOPF,0,1 (peu importe),....
- */
-
-namespace med_2_1{
-
-med_err
-_MEDdatasetNumLire(med_idt pere,char *nom,med_type_champ type,
- med_mode_switch interlace, med_size nbdim, med_size fixdim,
- med_size psize, med_ssize * pfltab, med_int ngauss,
- unsigned char *val)
-{
- med_idt dataset, dataspace = 0, memspace = 0;
- med_ssize start_mem[1],start_data[1],*pflmem=0,*pfldsk=0;
- med_size stride[1],count[1],pcount[1],size[1],pflsize[1];
- med_err ret;
- int i,j,index,type_hdf;
- hid_t datatype;
- size_t typesize;
- int dim, firstdim, dimutil, lastdim;
- med_mode_profil pflmod;
-
- /* Verify fixdim is between [0, nbdim] ( 0 is MED_ALL ) */
- if ( ( fixdim < 0 ) || ( fixdim > nbdim ) )
- return -1;
-
- /* block pflmod to MED_COMPACT (until med2.2) */
- pflmod = MED_COMPACT;
-
- switch(type)
- {
- case MED_REEL64 :
- /* 1) IA32 is LE but due to an (?HDF convertion BUG?) when using H5T_NATIVE_DOUBLE/MED_REEL64? under PCLINUX
- the file read under SGI is incorrect
- 2) Compaq OSF/1 is LE, since we force SGI64,SUN4SOL2,HP to write double in LE even if they are BE, mips OSF/1 must be BE
- REM : Be careful of compatibility between MED files when changing this (med2.2) */
-#if defined(PCLINUX) || defined(OSF1)
- type_hdf = H5T_IEEE_F64BE;
-#else
- type_hdf = H5T_IEEE_F64LE;
-#endif
- break;
-
- case MED_INT32 :
- type_hdf = H5T_NATIVE_INT;
- break;
-
- case MED_INT64 :
- type_hdf = H5T_NATIVE_LONG;
- break;
-
- default :
- return -1;
- }
-
- /* Ouverture du Dataset à lire */
- if ((dataset = H5Dopen(pere,nom)) < 0)
- return -1;
-
- /* Interrogation de la taille du dataset */
- if ( (datatype = H5Dget_type(dataset )) < 0) return -1;
- if ( (typesize = H5Tget_size(datatype)) < 0) return -1;
- size[0] = H5Dget_storage_size(dataset) / typesize;
- if ( H5Tclose(datatype) < 0) return -1;
-
- /* Create dataspace */
- if ((dataspace = H5Screate_simple(1,size,NULL)) < 0)
- return -1;
-
- switch(interlace)
- {
- case MED_FULL_INTERLACE :
-
- /*Initialisation des indices de boucle du traitement de l'entrelacement en fonction de la dimension fixee*/
- if ( fixdim != MED_ALL)
- {
- firstdim = fixdim-1;
- lastdim = fixdim;
- dimutil = 1;
- } else {
- firstdim = 0;
- lastdim = nbdim;
- dimutil = nbdim;
- }
-
- count [0] = (*size)/(nbdim);
-
-
- /*rem: Pas de vérification de l'assertion (*size)=n*nbdim */
- if ( psize == MED_NOPF ) {
-
- /* Creation d'un data space mémoire de dimension 1, de longeur size, et de longeur maxi size */
- if ( (memspace = H5Screate_simple (1, size, NULL)) <0)
- return -1;
-
- stride[0] = nbdim;
-
- for (dim=firstdim; dim < lastdim; dim++) {
-
- start_mem[0] = dim;
- if ( (ret = H5Sselect_hyperslab (memspace, H5S_SELECT_SET, start_mem, stride,
- count, NULL)) <0)
- return -1;
-
- start_data[0] = dim*count[0];
- if ( (ret = H5Sselect_hyperslab (dataspace, H5S_SELECT_SET, start_data, NULL,
- count, NULL)) <0)
- return -1;
-
- if ((ret = H5Dread(dataset,type_hdf,memspace,dataspace,
- H5P_DEFAULT, val)) < 0)
- return -1;
- }
-
- } else {
-
- pflsize [0] = psize*ngauss*nbdim;
- pcount [0] = psize*ngauss*dimutil;
- pflmem = (med_ssize *) malloc (sizeof(med_ssize)*pcount[0]);
- pfldsk = (med_ssize *) malloc (sizeof(med_ssize)*pcount[0]);
-
- switch(pflmod)
- { /* switch pflmod pour FULL_INTERLACE*/
- case MED_GLOBALE :
-
- /* Creation d'un data space mémoire de dimension 1, de longeur size, et de longeur maxi size */
- if ( (memspace = H5Screate_simple (1, size, NULL)) <0)
- return -1;
-
- for (dim=firstdim; dim < lastdim; dim++) {
-
- for (i=0; i < psize; i++) /* i balaye les élements du profil */
- for (j=0; j < ngauss; j++) {
- index = i*ngauss+j + (dim-firstdim)*(psize*ngauss);
- pflmem[index] = (pfltab[i]-1)*ngauss*nbdim + j*nbdim+dim;
- pfldsk[index] = dim*count[0] + (pfltab[i]-1)*ngauss+j;
- }
- }
-
- if ( (ret = H5Sselect_elements(memspace ,H5S_SELECT_SET, pcount[0], (const hssize_t **) pflmem ) ) <0)
- return -1;
-
- if ( (ret = H5Sselect_elements(dataspace,H5S_SELECT_SET, pcount[0], (const hssize_t **) pfldsk ) ) <0)
- return -1;
-
- break;
-
- case MED_COMPACT :
-
- /* Creation d'un data space mémoire de dimension 1, de la longeur du profil */
- /* La dimension utilisée est ici nbdim, même pour un profil compact on suppose */
- /* que l'utilisateur a toutes les coordonées stockées, même si il en demande qu'une */
-
- if ( (memspace = H5Screate_simple (1, pflsize, NULL)) <0)
- return -1;
-
- for (dim=firstdim; dim < lastdim; dim++) {
-
- for (i=0; i < psize; i++) /* i balaye les élements du profil */
- for (j=0; j < ngauss; j++) {
- index = i*ngauss+j + (dim-firstdim)*(psize*ngauss);
- pflmem[index] = i*ngauss*nbdim + j*nbdim+dim;
- pfldsk[index] = dim*count[0] + (pfltab[i]-1)*ngauss+j;
- }
- }
-
- if ( (ret = H5Sselect_elements(memspace ,H5S_SELECT_SET, pcount[0], (const hssize_t **) pflmem ) ) <0)
- return -1;
-
- if ( (ret = H5Sselect_elements(dataspace,H5S_SELECT_SET, pcount[0], (const hssize_t **) pfldsk ) ) <0)
- return -1;
-
- break;
-
- default :
- return -1;
- }
-
- if ((ret = H5Dread(dataset,type_hdf,memspace,dataspace,H5P_DEFAULT, val)) < 0)
- return -1;
-
- free(pflmem);
- free(pfldsk);
- }
-
- break;
-
- case MED_NO_INTERLACE :
-
- /*Initialisation des indices de boucle du traitement de l'entrelacement en fonction de la dimension fixee*/
-
- count[0] = (*size)/nbdim;
-
- if ( psize == MED_NOPF ) {
-
- if ( fixdim != MED_ALL)
- start_data[0] = (fixdim-1)*count[0];
- else {
- count[0] = *size;
- start_data[0] = 0;
- };
-
- if ( (ret = H5Sselect_hyperslab (dataspace, H5S_SELECT_SET, start_data, NULL,
- count, NULL)) <0)
- return -1;
-
- if ((ret = H5Dread(dataset,type_hdf,dataspace,dataspace,
- H5P_DEFAULT, val)) < 0)
- return -1;
-
- } else {
-
- if ( fixdim != MED_ALL)
- {
- firstdim = fixdim-1;
- lastdim = fixdim;
- dimutil = 1;
- } else {
- firstdim = 0;
- lastdim = nbdim;
- dimutil = nbdim;
- }
-
- pflsize [0] = psize*ngauss*nbdim;
- pcount [0] = psize*ngauss*dimutil; /* nom pas très coherent avec count !!! A revoir */
- pfldsk = (med_ssize *) malloc(sizeof(med_ssize)*pcount[0]);
-
- switch(pflmod)
- { /*switch plfmod pour NO_INTERLACE */
- case MED_GLOBALE :
-
- for (dim=firstdim; dim < lastdim; dim++) {
-
- for (i=0; i < psize; i++) /* i balaye le nbre d'élements du profil */
- for (j=0; j < ngauss; j++) {
- index = i*ngauss+j + (dim-firstdim)*(psize*ngauss);
- pfldsk[index] = dim*count[0]+(pfltab[i]-1)*ngauss+j;
- }
- }
-
- if ( (ret = H5Sselect_elements(dataspace,H5S_SELECT_SET,pcount[0], (const hssize_t **) pfldsk ) ) <0)
- return -1;
-
- if ((ret = H5Dread(dataset,type_hdf,dataspace,dataspace,H5P_DEFAULT, val)) < 0)
- return -1;
-
- break;
-
- case MED_COMPACT :
-
- /* Creation d'un data space mémoire de dimension 1, de la longeur du profil */
- /* La dimension utilisée est ici nbdim, même pour un profil compact on suppose */
- /* que l'utilisateur a toutes les coordonées stockées, même si il en demande qu'une */
-
- if ( (memspace = H5Screate_simple (1, pflsize, NULL)) <0)
- return -1;
-
- pflmem = (med_ssize *) malloc (sizeof(med_ssize)*pcount[0]);
-
- /* Le profil COMPACT est contigüe, mais il est possible que l'on selectionne uniquemenent une dimension*/
-
- for (dim=firstdim; dim < lastdim; dim++) {
-
- for (i=0; i < psize; i++) /* i balaye le nbre d'élements du profil */
- for (j=0; j < ngauss; j++) {
- index = i*ngauss+j + (dim-firstdim)*(psize*ngauss);
- pflmem[index] = dim*(psize*ngauss) + (pfltab[i]-1)*ngauss+j;
- pfldsk[index] = dim*count[0] + (pfltab[i]-1)*ngauss+j;
- }
- }
-
- if ( (ret = H5Sselect_elements(memspace ,H5S_SELECT_SET, pcount[0], (const hssize_t **) pflmem ) ) <0)
- return -1;
-
- if ( (ret = H5Sselect_elements(dataspace,H5S_SELECT_SET,pcount[0], (const hssize_t **) pfldsk ) ) <0)
- return -1;
-
- if ((ret = H5Dread(dataset,type_hdf,memspace,dataspace,H5P_DEFAULT, val)) < 0)
- return -1;
-
- break;
-
- default :
- return -1;
-
- }
-
- free(pfldsk);
-
- };
-
- break;
-
- default :
- return -1;
- }
-
-
-
- if (memspace)
- if ((ret = H5Sclose(memspace)) < 0)
- return -1;
-
- if ((ret = H5Sclose(dataspace)) < 0)
- return -1;
-
- if ((ret = H5Dclose(dataset)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-/*
- * - Nom de la fonction : _MEDdatasetOuvrir
- * - Description : ouverture d'un objet HDF dataset
- * - Parametres :
- * - pid (IN) : l'ID de l'objet HDF pere
- * - nom (IN) : le nom du dataset
- * - Resultat : ID du dataset en cas de succes, -1 sinon
- */
-
-namespace med_2_1{
-
-med_idt
-_MEDdatasetOuvrir(med_idt pid,char *nom)
-{
- med_idt id;
-
- if ((id = H5Dopen(pid,nom)) < 0)
- return -1;
-
- return id;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-/*
- * - Nom de la fonction : _MEDdatasetStringEcrire
- * - Description : ecriture d'un dataset tableau de caracteres
- * - Parametres :
- * - pere (IN) : l'ID de l'objet HDF pere ou placer l'attribut
- * - nom (IN) : le nom de l'attribut
- * - dimd (IN) : profil du tableau
- * - val (IN) : valeurs du tableau
- * - mode (IN) : mode d'ecriture MED
- * - Resultat : 0 en cas de succes, -1 sinon
- */
-
-namespace med_2_1{
-
-med_err
-_MEDdatasetStringEcrire(med_idt pere,char *nom,med_size *dimd,
- char *val, med_mode_acces mode)
-{
- med_idt dataset;
- med_idt datatype = 0;
- med_idt dataspace = 0;
- med_err ret;
-
- if ((dataset = H5Dopen(pere,nom)) < 0)
- {
- if ((dataspace = H5Screate_simple(1,dimd,NULL)) < 0)
- return -1;
- if((datatype = H5Tcopy(H5T_C_S1)) < 0)
- return -1;
- if((ret = H5Tset_size(datatype,1)) < 0)
- return -1;
- if ((dataset = H5Dcreate(pere,nom,datatype,dataspace,
- H5P_DEFAULT)) < 0)
- return -1;
- }
- else
- if (mode != MED_REMP)
- {
- H5Dclose(dataset);
- return -1;
- }
- else
- {
- if ((dataspace = H5Screate_simple(1,dimd,NULL)) < 0)
- return -1;
- if((datatype = H5Tcopy(H5T_C_S1)) < 0)
- return -1;
- if((ret = H5Tset_size(datatype,1)) < 0)
- return -1;
- }
- if ((ret = H5Dwrite(dataset,datatype,H5S_ALL,H5S_ALL,
- H5P_DEFAULT, val)) < 0)
- return -1;
- if (dataspace)
- if((ret = H5Sclose(dataspace)) < 0)
- return -1;
- if (datatype)
- if ((ret = H5Tclose(datatype)) < 0)
- return -1;
- if ((ret = H5Dclose(dataset)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-/*
- * - Nom de la fonction : _MEDdatasetStringLire
- * - Description : lecture d'un dataset tableau de caracteres
- * - Parametres :
- * - pere (IN) : l'ID de l'objet HDF pere ou placer l'attribut
- * - nom (IN) : le nom de l'attribut
- * - val (IN) : valeurs du tableau
- * - Resultat : 0 en cas de succes, -1 sinon
- */
-
-namespace med_2_1{
-
-med_err
-_MEDdatasetStringLire(med_idt pere,char *nom,char *val)
-{
- med_idt dataset,datatype;
- med_err ret;
-
- if ((dataset = H5Dopen(pere,nom)) < 0)
- return -1;
- if ((datatype = H5Tcopy(H5T_C_S1)) < 0)
- return -1;
- if ((ret = H5Tset_size(datatype,1)) < 0)
- return -1;
- if ((ret = H5Dread(dataset,datatype,H5S_ALL,H5S_ALL,H5P_DEFAULT,val)) < 0)
- return -1;
- if ((ret = H5Tclose(datatype)) < 0)
- return -1;
- if ((ret = H5Dclose(dataset)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <string.h>
-#include <stdlib.h>
-
-namespace med_2_1{
-med_int
-MEDdimLire(med_idt fid, char *maillage)
-{
- med_idt maaid;
- med_err ret;
- char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
- med_int dim;
-
- /*
- * On inhibe le gestionnaire d'erreur
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * On regarde si le groupe existe => erreur si non
- */
- strcpy(chemin,MED_MAA);
- strcat(chemin,maillage);
- if ((maaid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
-
- /*
- * On va lire l'attribut dimension
- */
- if ((ret = _MEDattrEntierLire(maaid,MED_NOM_DIM,&dim)) < 0)
- return -1;
-
- /*
- * Fermetures des objets HDF
- */
- if ((ret = _MEDdatagroupFermer(maaid)) < 0)
- return -1;
-
- return dim;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-
-namespace med_2_1{
-
-med_err
-MEDelementsEcr(med_idt fid,char *maa,med_int mdim,med_int *connectivite,med_mode_switch mode_switch,
- char *nom,med_booleen inom,med_int *num,med_booleen inum,
- med_int *fam,med_int nele,med_entite_maillage typ_ent,
- med_geometrie_element typ_geo,med_connectivite typ_conn,
- med_mode_acces mode)
-{
- med_err ret;
-
- /* Ecriture de la connectivite */
- if ((ret = MEDconnEcr(fid,maa,mdim,connectivite,mode_switch,nele,mode,typ_ent,typ_geo,
- typ_conn)) < 0)
- return -1;
-
- /* Ecriture des noms */
- if (inom == MED_VRAI)
- if ((ret = MEDnomEcr(fid,maa,nom,nele,mode,typ_ent,typ_geo)) < 0)
- return -1;
-
- /* Ecriture des numeros */
- if (inum == MED_VRAI)
- if ((ret = MEDnumEcr(fid,maa,num,nele,mode,typ_ent,typ_geo)) < 0)
- return -1;
-
- /* Ecriture des numeros de familles */
- if ((ret = MEDfamEcr(fid,maa,fam,nele,mode,typ_ent,typ_geo)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-
-namespace med_2_1{
-
-med_err
-MEDelementsLire(med_idt fid,char *maa,med_int mdim,med_int *connectivite,med_mode_switch mode_switch,
- char *nom,med_booleen *inom,med_int *num,med_booleen *inum,
- med_int *fam,med_int nele,med_entite_maillage typ_ent,
- med_geometrie_element typ_geo,med_connectivite typ_conn)
-{
- med_err ret;
-
- /* Lecure de la connectivite */
- if ((ret = MEDconnLire(fid,maa,mdim,connectivite,mode_switch,0,MED_NOPF,
- typ_ent,typ_geo,typ_conn)) < 0)
- return -1;
-
- /* Lecture des noms */
- if ((ret = MEDnomLire(fid,maa,nom,nele,typ_ent,typ_geo)) < 0)
- *inom = MED_FAUX;
- else
- *inom = MED_VRAI;
-
- /* Lecture des numeros */
- if ((ret = MEDnumLire(fid,maa,num,nele,typ_ent,typ_geo)) < 0)
- *inum = MED_FAUX;
- else
- *inum = MED_VRAI;
-
- /* Lecture des numeros de familles */
- if ((ret = MEDfamLire(fid,maa,fam,nele,typ_ent,typ_geo)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <string.h>
-#include <stdlib.h>
-
-namespace med_2_1{
-
-med_err
-MEDequivCr(med_idt fid,char *maa, char *eq, char *desc)
-{
- med_idt root,eqid;
- med_err ret;
- char chemin[MED_TAILLE_MAA+MED_TAILLE_EQS+MED_TAILLE_NOM+1];
- char tmp[MED_TAILLE_EQS+1];
-
- /*
- * On inhibe le gestionnaire d'erreur HDF 5
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * Si le Data Group "EQS" n'existe pas, on le cree
- */
- strcpy(chemin,MED_MAA);
- strcat(chemin,maa);
- strncpy(tmp,MED_EQS,MED_TAILLE_EQS-1);
- tmp[MED_TAILLE_EQS-1] = '\0';
- strcat(chemin,tmp);
- if ((root = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- if ((root = _MEDdatagroupCreer(fid,chemin)) < 0)
- return -1;
-
- /*
- * Si une equivalence du meme nom existe => erreur
- * Sinon on la cree
- */
- if ((eqid = _MEDdatagroupOuvrir(root,eq)) >= 0)
- return -1;
- if ((eqid = _MEDdatagroupCreer(root,eq)) < 0)
- return -1;
-
- /*
- * L'attribut "DES"
- */
- if ((ret = _MEDattrStringEcrire(eqid,MED_NOM_DES,MED_TAILLE_DESC,desc,MED_REMP)) < 0)
- return -1;
-
- /*
- * On ferme tout
- */
- if ((ret = _MEDdatagroupFermer(eqid)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(root)) < 0)
- return -1;
-
- return 0 ;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <string.h>
-#include <stdlib.h>
-
-extern int mode_interlace;
-
-namespace med_2_1{
-
-med_err
-MEDequivEcr(med_idt fid, char *maa, char *eq, med_int *corr, med_int n,
- med_mode_acces mode, med_entite_maillage typ_ent, med_geometrie_element typ_geo)
-{
- med_idt eqid, datagroup;
- med_err ret;
- char chemin[MED_TAILLE_MAA+MED_TAILLE_EQS+2*MED_TAILLE_NOM+1];
- char nomdatagroup[MED_TAILLE_NOM+1];
- char tmp[MED_TAILLE_NOM_ENTITE+1];
- med_size dimd[1];
-
- if (typ_geo == MED_TETRA4 || typ_geo == MED_TETRA10 ||
- typ_geo == MED_HEXA8 || typ_geo == MED_HEXA20 ||
- typ_geo == MED_PENTA6 || typ_geo == MED_PENTA15 ||
- typ_geo == MED_PYRA5 || typ_geo == MED_PYRA13)
- return -1;
-
- /*
- * On inhibe le gestionnaire d'erreur HDF 5
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * Si le Data Group de "eq" n'existe pas => erreur
- */
- strcpy(chemin,MED_MAA);
- strcat(chemin,maa);
- strcat(chemin,MED_EQS);
- strcat(chemin,eq);
- if ((eqid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
-
- /*
- * Ecriture de l'equivalence
- */
- if ((ret = _MEDnomEntite(nomdatagroup,typ_ent)) < 0)
- return -1;
- if ((typ_ent != MED_NOEUD))
- {
- if ((ret = _MEDnomGeometrie(tmp,typ_geo)) < 0)
- return -1;
- strcat(nomdatagroup,".");
- strcat(nomdatagroup,tmp);
- }
- datagroup = 0;
- if (((datagroup = _MEDdatagroupOuvrir(eqid,nomdatagroup)) > 0) &&
- (mode != MED_REMP))
- return -1;
- else
- if (datagroup > 0)
- _MEDdatagroupFermer(datagroup);
-
- /* EF : verifier que çà marche si le data groupe existe déjà */
- if ((datagroup = _MEDdatagroupCreer(eqid,nomdatagroup)) < 0)
- return -1;
-
- if ((ret = _MEDattrEntierEcrire(datagroup,MED_NOM_NBR,&n,mode)) < 0)
- return -1;
-
- dimd[0] = 2*n;
-
-#if defined(IRIX64)||defined(OSF1)
- if ((ret = _MEDdatasetNumEcrire(datagroup,MED_NOM_COR,MED_INT64,MED_NO_INTERLACE,MED_DIM1,MED_ALL,MED_NOPF,0,MED_NOPG,dimd,
- (unsigned char*) corr,mode)) < 0)
- return -1;
-#else
- if ((ret = _MEDdatasetNumEcrire(datagroup,MED_NOM_COR,MED_INT32,MED_NO_INTERLACE,MED_DIM1,MED_ALL,MED_NOPF,0,MED_NOPG,dimd,
- (unsigned char*) corr,mode)) < 0)
- return -1;
-#endif
-
- /*
- * On ferme tout
- */
- if ((ret = _MEDdatagroupFermer(datagroup)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(eqid)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <string.h>
-#include <stdlib.h>
-
-namespace med_2_1{
-
-med_err
-MEDequivInfo(int fid, char *maa, int ind, char *eq, char *des)
-{
- med_idt eqid;
- med_err ret;
- char chemin[MED_TAILLE_MAA+MED_TAILLE_EQS+2*MED_TAILLE_NOM+1];
- int num;
- int idx;
-
- /*
- * On inhibe le gestionnaire d'erreur HDF 5
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * On recupere le nom de l'equivalence
- */
- num = ind - 1;
- strcpy(chemin,MED_MAA);
- strcat(chemin,maa);
- strcat(chemin,MED_EQS);
- if ((idx = _MEDobjetIdentifier(fid,chemin,num,eq)) < 0)
- return -1;
-
- /*
- * Si le Data Group eq n'existe pas => erreur
- */
- strcat(chemin,eq);
- if ((eqid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
-
- /*
- * L'attribut "DES"
- */
- if ((ret = _MEDattrStringLire(eqid,MED_NOM_DES,MED_TAILLE_DESC,des)) < 0)
- return -1;
-
- /*
- * On ferme tout
- */
- if ((ret = _MEDdatagroupFermer(eqid)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <string.h>
-#include <stdlib.h>
-
-extern int mode_interlace;
-
-namespace med_2_1{
-
-med_err
-MEDequivLire(med_idt fid, char *maa, char *eq, med_int *corr, med_int n,
- med_entite_maillage typ_ent,med_geometrie_element typ_geo)
-{
- med_idt eqid, datagroup;
- med_err ret;
- char chemin[MED_TAILLE_MAA+MED_TAILLE_EQS+2*MED_TAILLE_NOM+1];
- char nomdatagroup[MED_TAILLE_NOM+1];
- char tmp[MED_TAILLE_NOM_ENTITE+1];
-
- if (typ_geo == MED_TETRA4 || typ_geo == MED_TETRA10 ||
- typ_geo == MED_HEXA8 || typ_geo == MED_HEXA20 ||
- typ_geo == MED_PENTA6 || typ_geo == MED_PENTA15 ||
- typ_geo == MED_PYRA5 || typ_geo == MED_PYRA13)
- return -1;
-
- /*
- * On inhibe le gestionnaire d'erreur HDF 5
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * Si le Data Group de "eq" n'existe pas => erreur
- */
- strcpy(chemin,MED_MAA);
- strcat(chemin,maa);
- strcat(chemin,MED_EQS);
- strcat(chemin,eq);
- if ((eqid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
-
- /*
- * Lecture de l'equivalence
- */
- if ((ret = _MEDnomEntite(nomdatagroup,typ_ent)) < 0)
- return -1;
- if ((typ_ent != MED_NOEUD))
- {
- if ((ret = _MEDnomGeometrie(tmp,typ_geo)) < 0)
- return -1;
- strcat(nomdatagroup,".");
- strcat(nomdatagroup,tmp);
- }
- if ((datagroup = _MEDdatagroupOuvrir(eqid,nomdatagroup)) < 0)
- return -1;
-#if defined(IRIX64)||defined(OSF1)
- if ((ret = _MEDdatasetNumLire(datagroup,MED_NOM_COR,MED_INT64,
- MED_NO_INTERLACE,1,MED_ALL,
- MED_NOPF,0,MED_NOPG,
- (unsigned char *) corr)) < 0)
- return -1;
-#else
- if ((ret = _MEDdatasetNumLire(datagroup,MED_NOM_COR,MED_INT32,
- MED_NO_INTERLACE,1,MED_ALL,
- MED_NOPF,0,MED_NOPG,
- (unsigned char *) corr)) < 0)
- return -1;
-#endif
-
- /*
- * On ferme tout
- */
- if ((ret = _MEDdatagroupFermer(datagroup)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(eqid)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "med.hxx"
-
-
-/***********************************************************************
- * FONCTION MEDfam2groA
- *
- * - DESCRIPTION : 1ere etape dans la conversion des familles de groupes
- * MED en goupes de noeuds et d'elements.
- * Calcul des tailles des tableaux a allouer pour stocker les
- * groupes que l'on veut creer.
- * Les parametres renvoyes sont :
- * 1 - le nombre de groupes de noeuds a creer (ngn)
- * 2 - le nombre de groupes d'elements (nge)
- * 3 - le nombre total de noeuds composant l'ensemble des groupes
- * de noeuds (nindn)
- * 4 - le nombre total d'elements composant l'ensemble des groupes
- * d'elements (ninde)
- * Ces parametres doivent permettre de creer les tables suivantes :
- * 1 - une table de taille (nindn) contenant pour chaque groupe
- * de noeuds la liste des noeuds le composant. Cette table
- * sera indexee par une table de taille (ngn) qui contiendra
- * pour chaque noeud un numero d'indice. Une table de taille
- * (ngn) qui contiendra la liste des noms des differents
- * groupes de noeuds.
- * 2 - idem pour les elements
- * Le remplissage de ces tables est realise par la fonction
- * MEDfam2groB().
- *
- * - PARAMETRES :
- * NOM .E/S. TYPE . DESCRIPTION
- * -------------------------------------------------------------------
- * nfam .E . med_int . nombre de familles
- * numfam .E . med_int*. table des numeros de familles
- * numfamnoe .E . med_int*. table des numeros de familles
- * . . . des noeuds
- * nnoeuds .E . med_int . nombre de noeuds
- * numfamele .E . med_int*. table des numeros de familles
- * . . . des elements
- * nelememts .E . . nombre total d'elements
- * grofam .E . char* . liste des groupes de familles
- * indfamgro .E . int* . liste des indices des groupes
- * . . . de familles dans grofam
- * ngn . S. med_int*. nombre de groupes de noeuds a
- * . . creer
- * nge . S. med_int*. nombre de groupes d'elements a
- * . . creer
- * nindn . S. med_int*. taille de la table
- * . . des groupes de noeuds a creer
- * ninde . S. med_int*. taille de la table
- * . . des groupes d'elements
- *
- * - RESULTAT : 0 si succes et -1 sinon
- *
- ***********************************************************************/
-
-namespace med_2_1{
-
-med_err
-MEDfam2groA (med_int nfam,med_int *numfam,med_int *numfamnoe,
- med_int nnoeuds,med_int *numfamele,med_int nelements,
- char *grofam,int *indfamgro,
- med_int *ngn,med_int *nge,med_int *nindn,med_int *ninde)
-{
- int i,j,k;
- char groupe[MED_TAILLE_LNOM];
- char *nomgronoe,*nomgroele,*tmp;
- med_int numc;
- int nnoe = 0,nele = 0;
- int flag = 0;
-
- *ngn = 0;
- *nge = 0;
- *nindn = 0;
- *ninde = 0;
-
- tmp = NULL;
- nomgronoe = NULL;
- nomgroele = NULL;
-
- /* Pour chaque famille, on regarde s'il y a de nouveaux groupes
- de noeuds ou d'elements a creer. Pour chaque nouveau groupe,
- on compte le nombre de noeuds ou d'elements qui devront lui etre
- rataches */
- for (i=1;i<=nfam;i++)
- if ((*(indfamgro+i)-*(indfamgro+i-1))/MED_TAILLE_LNOM > 0)
- {
- /* on releve le numero de la famille courante */
- numc = *(numfam+i-1);
- nnoe = 0;
- nele = 0;
- /* si c'est une famille de noeuds, on compte le nombre de
- noeuds qui y sont rattaches */
- if (numc > 0)
- for (j=0;j<nnoeuds;j++)
- if (*(numfamnoe+j) == numc)
- nnoe++;
- /* si c'est une famille d'elements, on compte le nombre d'elements
- qui y sont rattaches */
- if (numc < 0)
- for (j=0;j<nelements;j++)
- if (*(numfamele+j) == numc)
- nele++;
- /* on parcourt la liste des groupes de la famille et pour chaque
- groupe :
- 1 - on met a jour les compteurs nindn et ninde ;
- 2 - on verifie s'il s'agit d'un groupe deja repertorie.
- Si c'est le cas on ne fait rien, sinon on met a jour les
- compteurs ngn ou nge */
- for (j=0;j<(*(indfamgro+i)-*(indfamgro+i-1))/MED_TAILLE_LNOM;j++)
- {
- strncpy(groupe,grofam+*(indfamgro+i-1)+j*MED_TAILLE_LNOM,
- MED_TAILLE_LNOM);
- if (numc > 0)
- {
- *nindn = *nindn+nnoe;
- if (*ngn == 0)
- {
- *ngn = 1;
- if ((nomgronoe=(char*)malloc(sizeof(char)*MED_TAILLE_LNOM))
- == NULL)
- return -1;
- strncpy(nomgronoe,groupe,MED_TAILLE_LNOM);
- }
- else
- {
- flag = 0;
- for (k=0;k<(*ngn);k++)
- if (strncmp(groupe,nomgronoe+k*MED_TAILLE_LNOM,
- MED_TAILLE_LNOM) == 0)
- flag = 1;
- if (flag == 0)
- {
- *ngn = *ngn + 1;
- if ((tmp=(char*)malloc(sizeof(char)*
- MED_TAILLE_LNOM**ngn)) == NULL)
- return -1;
- strncpy(tmp,nomgronoe,MED_TAILLE_LNOM*(*ngn-1));
- strncpy(tmp+MED_TAILLE_LNOM*(*ngn-1),groupe,
- MED_TAILLE_LNOM);
- free(nomgronoe);
- nomgronoe = tmp;
- }
- }
- }
- if (numc < 0)
- {
- *ninde = *ninde+nele;
- if (*nge == 0)
- {
- *nge = 1;
- if ((nomgroele=(char *)malloc(sizeof(char)*
- MED_TAILLE_LNOM)) == NULL)
- return -1;
- strncpy(nomgroele,groupe,MED_TAILLE_LNOM);
- }
- else
- {
- flag = 0;
- for (k=0;k<(*nge);k++)
- if (strncmp(groupe,nomgroele+k*MED_TAILLE_LNOM,
- MED_TAILLE_LNOM) == 0)
- flag = 1;
- if (flag == 0)
- {
- *nge = *nge + 1;
- if ((tmp = (char*) malloc(sizeof(char)*MED_TAILLE_LNOM*
- *nge)) == NULL)
- return -1;
- strncpy(tmp,nomgroele,MED_TAILLE_LNOM*(*nge-1));
- strncpy(tmp+MED_TAILLE_LNOM*(*nge-1), groupe,
- MED_TAILLE_LNOM);
- free(nomgroele);
- nomgroele = tmp;
- }
- }
- }
- }
- }
-
- /* nettoyage memoire */
- free(nomgronoe);
- free(nomgroele);
-
- return 0;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "med.hxx"
-
-/***********************************************************************
- * FONCTION MEDfam2groB
- *
- * - DESCRIPTION : 2e etape dans la conversion des familles MED en
- * groupes de noeuds et d'elements. Les tables allouees a partir
- * des parametres calcules par MEDfam2groA() sont passees en argument
- * a MEDfam2groB et remplies par cette derniere fonction.
- * Il s'agit de :
- * 1 - la table des noms de groupes de noeuds, chaque nom ayant
- * une taille de MED_TAILLE_LNOM
- * 2 - la table des noms des groupes d'elements
- * 3 - la table des groupes de noeuds -i.e. pour chaque groupe
- * la liste des numeros des noeuds qui le composent
- * 4 - la table d'indexation de la table des groupes de noeuds
- * 5 - la table des groupes d'elements
- * 6 - la table d'indexation de la table des groupes d'elements
- *
- * - PARAMETRES :
- * NOM .E/S. TYPE . DESCRIPTION
- * -------------------------------------------------------------------
- * nfam .E . med_int . nombre de familles
- * numfam .E . med_int*. table des numeros de familles
- * numfamnoe .E . med_int*. table des numeros de familles
- * . . . des noeuds
- * nnoeuds .E . med_int . nombre de noeuds
- * numfamele .E . med_int*. table des numeros de familles
- * . . . des elements
- * nelememts .E . med_int . nombre total d'elements
- * grofam .E . char* . liste des groupes de familles
- * indfamgro .E . int* . liste des indices des groupes
- * . . . de familles dans indfamgro
- * numnoeuds .E . med_int*. numeros des noeuds
- * numele .E . med_int*. numeros des elements
- * ngn .E . med_int . nombre de groupes de noeuds
- * nge .E . med_int . nombre de groupes d'elements
- * nindn .E . med_int . nombre d'indices dans la table
- * . . des groupes de noeuds a creer
- * ninde .E . med_int . nombre d'indices dans la table
- * . . des groupes d'elements
- * nomgronoe . S. char* . noms des groupes de noeuds
- * nomgroele . S. char* . noms des groupes d'elements
- * indgronoe . S. int* . indices des groupes de noeuds
- * indgroele . S. int* . indices des groupes d'elements
- * tabgronoe . S. med_int*. table des groupes de noeuds
- * tabgroele . S. med_int*. table des groupes d'elements
- *
- * - RESULTAT : 0
- *
- ***********************************************************************/
-
-namespace med_2_1{
-
-med_err
-MEDfam2groB(med_int nfam,med_int *numfam,med_int *numfamnoe,
- med_int nnoeuds,med_int *numfamele,med_int nelements,
- char *grofam,int *indfamgro,med_int *numnoeuds,
- med_int *numele,med_int ngn,med_int nge,med_int nindn,
- med_int ninde,char *nomgronoe,char *nomgroele,
- int *indgronoe,int *indgroele,
- med_int *tabgronoe,med_int *tabgroele)
-{
- int i,j,k;
- char groupe[MED_TAILLE_LNOM];
- med_int numc;
- int nnoe = 0, nele = 0;
- int flag = 0;
- int nn = 0, ne = 0;
- int pos, cpt;
-
- /* initialisations */
- for (i=0;i<=ngn;i++)
- *(indgronoe+i) = 0;
- for (i=0;i<=nge;i++)
- *(indgroele+i) = 0;
-
- /* 1ere passe : on passe en revue toutes les familles :
- 1 - on etablit dans (nomgronoe) et dans (nomgroele) les listes
- des noms de groupes de noeuds et d'elements
- 2 - on place dans les tables d'index (indgronoe) et (indgroele)
- le nombre de noeuds ou d'elements que chaque groupe se verra
- attribuer */
- for (i=1;i<=nfam;i++)
- {
- numc = *(numfam+i-1);
- nnoe = 0;
- nele = 0;
- if (numc > 0)
- for (j=0;j<nnoeuds;j++)
- if (*(numfamnoe+j) == numc)
- nnoe++;
- if (numc < 0)
- for (j=0;j<nelements;j++)
- if (*(numfamele+j) == numc)
- nele++;
- for (j=0;j<(*(indfamgro+i)-*(indfamgro+i-1))/MED_TAILLE_LNOM; j++)
- {
- strncpy(groupe, grofam+*(indfamgro+i-1)+j*MED_TAILLE_LNOM,
- MED_TAILLE_LNOM);
- if (numc > 0)
- {
- if (nn == 0)
- {
- strncpy(nomgronoe,groupe,MED_TAILLE_LNOM);
- nn = 1;
- pos = 1;
- }
- else
- {
- flag = 0;
- for (k=0; k<nn;k++)
- if (strncmp(groupe,nomgronoe+k*MED_TAILLE_LNOM,
- MED_TAILLE_LNOM) == 0)
- {
- flag = 1;
- pos = k+1;
- }
- if (flag == 0)
- {
- strncpy(nomgronoe+nn*MED_TAILLE_LNOM,groupe,
- MED_TAILLE_LNOM);
- pos = nn + 1;
- nn = nn + 1;
- }
- }
- *(indgronoe+pos) = *(indgronoe+pos) + nnoe;
- }
- if (numc < 0)
- {
- if (ne == 0)
- {
- strncpy(nomgroele,groupe,MED_TAILLE_LNOM);
- ne = 1;
- pos = 1;
- }
- else
- {
- flag = 0;
- for (k=0; k<ne;k++)
- if (strncmp(groupe,nomgroele+k*MED_TAILLE_LNOM,
- MED_TAILLE_LNOM) == 0)
- {
- flag = 1;
- pos = k + 1;
- }
- if (flag == 0)
- {
- strncpy(nomgroele+ne*MED_TAILLE_LNOM,groupe,
- MED_TAILLE_LNOM);
- pos = ne + 1;
- ne = ne + 1;
- }
- }
- *(indgroele+pos) = *(indgroele+pos) + nele;
- }
- }
- }
- *(nomgronoe+ngn*MED_TAILLE_LNOM) = '\0';
- *(nomgroele+nge*MED_TAILLE_LNOM) = '\0';
-
- /* 2e passe : on construit les listes des index ainsi que les
- les tables des groupes */
- for (i=1;i<=ngn;i++)
- {
- cpt = 0;
- *(indgronoe+i) = *(indgronoe+i-1) + *(indgronoe+i);
- strncpy(groupe,nomgronoe+(i-1)*MED_TAILLE_LNOM,MED_TAILLE_LNOM);
- for (j=1;j<=nfam;j++)
- {
- numc = *(numfam+j-1);
- if (numc > 0)
- {
- flag = 0;
- for (k=0;k<(*(indfamgro+j)-*(indfamgro+j-1))/MED_TAILLE_LNOM;
- k++)
- if (! strncmp(groupe,
- grofam+*(indfamgro+j-1)+k*MED_TAILLE_LNOM,
- MED_TAILLE_LNOM))
- flag = 1;
- if (flag == 1)
- for (k=0;k<nnoeuds;k++)
- if (*(numfamnoe+k) == numc)
- {
- *(tabgronoe+*(indgronoe+i-1)+cpt) = *(numnoeuds+k);
- cpt++;
- }
- }
- }
- }
-
- for (i=1;i<=nge;i++)
- {
- cpt = 0;
- *(indgroele+i) = *(indgroele+i-1) + *(indgroele+i);
- strncpy(groupe,nomgroele+(i-1)*MED_TAILLE_LNOM,MED_TAILLE_LNOM);
- for (j=1;j<=nfam;j++)
- {
- numc = *(numfam+j-1);
- if (numc < 0)
- {
- flag = 0;
- for (k=0;k<(*(indfamgro+j)-*(indfamgro+j-1))/MED_TAILLE_LNOM;
- k++)
- if (! strncmp(groupe,
- grofam+*(indfamgro+j-1)+k*MED_TAILLE_LNOM,
- MED_TAILLE_LNOM))
- flag = 1;
- if (flag == 1)
- for (k=0;k<nelements;k++)
- if (*(numfamele+k) == numc)
- {
- *(tabgroele+*(indgroele+i-1)+cpt) = *(numele+k);
- cpt++;
- }
- }
- }
- }
-
- return 0;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <string.h>
-#include <stdlib.h>
-
-namespace med_2_1{
-
-med_err
-MEDfamCr(med_idt fid,char* maa,char *famille,med_int numero,
- med_int *attr_ident, med_int *attr_val, char *attr_desc,
- med_int n_attr,char *groupe, med_int n_groupe)
-{
- med_idt root, datagroup, famid;
- med_err ret;
- med_size dimd[1];
- char chemin[MED_TAILLE_MAA+MED_TAILLE_FAS+MED_TAILLE_NOM+1];
- char tmp[MED_TAILLE_FAS+1];
-
- /*
- * On inhibe le gestionnaire d'erreur HDF 5
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * Si le Data Group FAS n'existe pas, on le cree
- */
- strcpy(chemin,MED_MAA);
- strcat(chemin,maa);
- strncpy(tmp,MED_FAS,MED_TAILLE_FAS-1);
- tmp[MED_TAILLE_FAS-1] = '\0';
- strcat(chemin,tmp);
- if ((root = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- if ((root = _MEDdatagroupCreer(fid,chemin)) < 0)
- return -1;
-
- /*
- * Si le Data Group de meme nom que famille existe => erreur
- * Sinon on le cree
- */
- if ((famid = _MEDdatagroupOuvrir(root,famille)) >= 0)
- return -1;
- if ((famid = _MEDdatagroupCreer(root,famille)) < 0)
- return -1;
-
- /*
- * L'attribut NUM
- */
- if ((ret = _MEDattrEntierEcrire(famid,MED_NOM_NUM,&numero,MED_REMP)) < 0)
- return -1;
-
- /*
- * Le Data Group "GRO"
- */
- if (n_groupe > 0)
- {
- /*
- * On cree le Data Group
- */
- if ((datagroup = _MEDdatagroupCreer(famid,MED_NOM_GRO)) < 0)
- return -1;
-
- /*
- * L'attribut "NBR"
- */
- if ((ret = _MEDattrEntierEcrire(datagroup,MED_NOM_NBR,&n_groupe,MED_REMP)) < 0)
- return -1;
-
- /*
- * Data Set des noms des groupes "NOM"
- */
- dimd[0] = n_groupe*MED_TAILLE_LNOM+1;
- if ((ret = _MEDdatasetStringEcrire(datagroup,MED_NOM_NOM,dimd,groupe,
- MED_REMP))<0)
- return -1;
-
- /*
- * On ferme le Data Group
- */
- if ((ret = _MEDdatagroupFermer(datagroup)) < 0)
- return -1;
- }
-
- /*
- * Le Data Group "ATT"
- */
-
- if (n_attr > 0)
- {
- if ((datagroup = _MEDdatagroupCreer(famid,MED_NOM_ATT)) < 0)
- return -1;
-
- /*
- * L'attribut "NBR"
- */
- if ((ret = _MEDattrEntierEcrire(datagroup,MED_NOM_NBR,&n_attr,MED_REMP)) < 0)
- return -1;
-
- /*
- * Le Data Set "IDE"
- */
- dimd[0] = n_attr;
-#if defined(IRIX64)||defined(OSF1)
- if ((ret = _MEDdatasetNumEcrire(datagroup,MED_NOM_IDE,MED_INT64,MED_NO_INTERLACE,MED_DIM1,MED_ALL,MED_NOPF,0,MED_NOPG,dimd,
- (unsigned char *)attr_ident,MED_REMP)) < 0)
- return -1;
-#else
- if ((ret = _MEDdatasetNumEcrire(datagroup,MED_NOM_IDE,MED_INT32,MED_NO_INTERLACE,MED_DIM1,MED_ALL,MED_NOPF,0,MED_NOPG,dimd,
- (unsigned char *)attr_ident,MED_REMP)) < 0)
- return -1;
-#endif
-
- /*
- * Le Data Set "VAL"
- */
- dimd[0] = n_attr;
-#if defined(IRIX64)||defined(OSF1)
- if ((ret = _MEDdatasetNumEcrire(datagroup,MED_NOM_VAL,MED_INT64,MED_NO_INTERLACE,MED_DIM1,MED_ALL,MED_NOPF,0,MED_NOPG,dimd,
- (unsigned char*)attr_val,MED_REMP)) < 0)
- return -1;
-#else
- if ((ret = _MEDdatasetNumEcrire(datagroup,MED_NOM_VAL,MED_INT32,MED_NO_INTERLACE,MED_DIM1,MED_ALL,MED_NOPF,0,MED_NOPG,dimd,
- (unsigned char*)attr_val,MED_REMP)) < 0)
- return -1;
-#endif
-
- /*
- * Le Data Set "DES"
- */
- dimd[0] = n_attr*MED_TAILLE_DESC+1;
- if ((ret = _MEDdatasetStringEcrire(datagroup,MED_NOM_DES,dimd,attr_desc,
- MED_REMP)) < 0)
- return -1;
-
- /*
- * On ferme le Data Group
- */
- if ((ret = _MEDdatagroupFermer(datagroup)) < 0)
- return -1;
- }
-
- /*
- * On ferme tout
- */
- if ((ret = _MEDdatagroupFermer(famid)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(root)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <stdlib.h>
-#include <string.h>
-
-namespace med_2_1{
-
-med_err
-MEDfamEcr(med_idt fid,char *maa, med_int *fam, med_int n, med_mode_acces mode,
- med_entite_maillage type_ent, med_geometrie_element type_geo)
-{
- med_idt root, maaid, entid, geoid, dataset;
- med_err ret;
- med_size dimd[1];
- char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
- char nom_ent[MED_TAILLE_NOM_ENTITE+1];
- char nom_geo[MED_TAILLE_NOM_ENTITE+1];
-
- /*
- * On inhibe le gestionnaire d'erreur HDF 5
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * Si le maillage n'existe pas => erreur
- */
- strcpy(chemin,MED_MAA);
- strcat(chemin,maa);
- if ((maaid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
-
- /*
- * On met a jour le nom du Data Group representant
- * le type des entites
- */
- if ((ret = _MEDnomEntite(nom_ent,type_ent)) < 0)
- return -1;
-
- /*
- * Si le Data Group des entites n'existe pas on le cree
- */
- if ((entid = _MEDdatagroupOuvrir(maaid,nom_ent)) < 0)
- if ((entid = _MEDdatagroupCreer(maaid,nom_ent)) < 0)
- return -1;
-
- /*
- * Pour les mailles, les faces et le aretes, on cree
- * s'il n'existe pas le Data Group du type geometrique
- */
- if ((type_ent==MED_MAILLE)||(type_ent==MED_FACE)||(type_ent==MED_ARETE))
- {
- if ((ret = _MEDnomGeometrie(nom_geo,type_geo)) < 0)
- return -1;
-
- if ((geoid = _MEDdatagroupOuvrir(entid,nom_geo)) < 0)
- if ((geoid = _MEDdatagroupCreer(entid,nom_geo)) < 0)
- return -1;
- }
- else
- geoid = -1;
-
- /*
- * Creation du Data Set "FAM"
- */
- if (geoid == -1)
- root = entid;
- else
- root = geoid;
- dimd[0] = n;
-#if defined(IRIX64) || defined(OSF1)
- if ((ret = _MEDdatasetNumEcrire(root,MED_NOM_FAM,MED_INT64,MED_NO_INTERLACE,MED_DIM1,MED_ALL,MED_NOPF,0,MED_NOPG,dimd,
- (unsigned char*)fam,mode)) < 0)
- return -1;
-#else
- if ((ret = _MEDdatasetNumEcrire(root,MED_NOM_FAM,MED_INT32,MED_NO_INTERLACE,MED_DIM1,MED_ALL,MED_NOPF,0,MED_NOPG,dimd,
- (unsigned char*)fam,mode)) < 0)
- return -1;
-#endif
-
- /*
- * Attribut NBR (nombre de noeuds)
- */
- if ((dataset = _MEDdatasetOuvrir(root,MED_NOM_FAM)) < 0)
- return -1;
- if ((ret = _MEDattrEntierEcrire(dataset,MED_NOM_NBR,&n,mode)) < 0)
- return -1;
-
- /*
- * On ferme tout
- */
- if ((ret = _MEDdatasetFermer(dataset)) < 0)
- return -1;
- if (geoid != -1)
- if ((ret = _MEDdatagroupFermer(geoid)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(entid)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(maaid)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-
-namespace med_2_1{
-
-med_err
-MEDfamGridEcr(med_idt fid, char *maa, med_int *fam, med_int n, med_mode_acces mode, med_entite_maillage type_ent) {
- /* Ecrire des numeros de familles pour les grilles cartesiennes ou polaires :
- - pour les noeuds
- - pour les aretes
- - pour les faces
- - pour les mailles */
-
- med_geometrie_element type_geo;
-
- switch(type_ent) {
- case MED_NOEUD : {
- type_geo = MED_POINT1;
- break;
- };
- case MED_ARETE : {
- type_geo = MED_SEG2;
- break;
- };
- case MED_FACE : {
- type_geo = MED_QUAD4;
- break;
- };
- case MED_MAILLE : {
- type_geo = MED_HEXA8;
- break;
- };
- default : {
- return(-1);
- };
- };
-
- return(MEDfamEcr(fid, maa, fam, n, mode, type_ent, type_geo));
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-
-namespace med_2_1{
-
-med_err
-MEDfamGridLire(med_idt fid, char *maa, med_int *fam, med_int n, med_entite_maillage type_ent) {
- /* lecture des numeros de familles pour les grilles cartesiennes ou polaires :
- - pour les noeuds
- - pour les aretes
- - pour les faces
- - pour les mailles */
-
- med_geometrie_element type_geo;
-
- switch(type_ent) {
- case MED_NOEUD : {
- type_geo = MED_POINT1;
- break;
- };
- case MED_ARETE : {
- type_geo = MED_SEG2;
- break;
- };
- case MED_FACE : {
- type_geo = MED_QUAD4;
- break;
- };
- case MED_MAILLE : {
- type_geo = MED_HEXA8;
- break;
- };
- default : {
- return(-1);
- };
- };
-
- return(MEDfamLire(fid, maa, fam, n, type_ent, type_geo));
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <stdlib.h>
-#include <string.h>
-
-namespace med_2_1{
-
-med_err
-MEDfamInfo(med_idt fid,char *maa,int indice, char *famille,
- med_int *numero,
- med_int *attr_ident, med_int *attr_val, char *attr_desc,
- med_int *n_attr, char *groupe ,med_int *n_groupe)
-{
- med_idt famid,datagroup;
- med_err ret;
- char chemin[MED_TAILLE_MAA+MED_TAILLE_FAS+2*MED_TAILLE_NOM+1];
- int num;
-
- /*
- * On inhibe le gestionnaire d'erreur HDF 5
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * On recupere le nom de la famille
- */
- num = indice - 1;
- strcpy(chemin,MED_MAA);
- strcat(chemin,maa);
- strcat(chemin,MED_FAS);
- if ((ret = _MEDobjetIdentifier(fid,chemin,num,famille)) < 0)
- return -1;
-
- /*
- * Si le Data Group de la famille n'existe pas => erreur
- */
- strcat(chemin,famille);
- if ((famid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
-
- /*
- * L'attribut NUM
- */
- if ((ret = _MEDattrEntierLire(famid,MED_NOM_NUM,numero)) < 0)
- return -1;
-
- /*
- * Le Data Group "GRO"
- */
- if ((datagroup = _MEDdatagroupOuvrir(famid,MED_NOM_GRO)) >= 0)
- {
- /*
- * L'attribut "NBR"
- */
- if ((ret = _MEDattrEntierLire(datagroup,MED_NOM_NBR,n_groupe)) < 0)
- return -1;
-
- /*
- * Data Set des noms des groupes "NOM"
- */
- if ((ret = _MEDdatasetStringLire(datagroup,MED_NOM_NOM,groupe)) < 0)
- return -1;
-
- /*
- * On ferme le Data Group
- */
- if ((ret = _MEDdatagroupFermer(datagroup)) < 0)
- return -1;
- }
- else
- *n_groupe = 0;
-
- /*
- * Le Data Group "ATT"
- */
- if ((datagroup = _MEDdatagroupOuvrir(famid,MED_NOM_ATT)) >= 0)
- {
- /*
- * L'attribut "NBR"
- */
- if ((ret = _MEDattrEntierLire(datagroup,MED_NOM_NBR,n_attr)) < 0)
- return -1;
-
- /*
- * Le Data Set "IDE"
- */
-#if defined(IRIX64)||defined(OSF1)
- if ((ret = _MEDdatasetNumLire(datagroup,MED_NOM_IDE,MED_INT64,
- MED_NO_INTERLACE,1,MED_ALL,
- MED_NOPF,0,MED_NOPG,
- (unsigned char*) attr_ident)) < 0)
- return -1;
-#else
- if ((ret = _MEDdatasetNumLire(datagroup,MED_NOM_IDE,MED_INT32,
- MED_NO_INTERLACE,1,MED_ALL,
- MED_NOPF,0,MED_NOPG,
- (unsigned char*) attr_ident)) < 0)
- return -1;
-#endif
-
- /*
- * Le Data Set "VAL"
- */
-#if defined(IRIX64)||defined(OSF1)
- if ((ret = _MEDdatasetNumLire(datagroup,MED_NOM_VAL,MED_INT64,
- MED_NO_INTERLACE,1,MED_ALL,
- MED_NOPF,0,MED_NOPG,
- (unsigned char *) attr_val)) < 0)
- return -1;
-#else
- if ((ret = _MEDdatasetNumLire(datagroup,MED_NOM_VAL,MED_INT32,
- MED_NO_INTERLACE,1,MED_ALL,
- MED_NOPF,0,MED_NOPG,
- (unsigned char *) attr_val)) < 0)
- return -1;
-#endif
-
- /*
- * Le Data Set "DES"
- */
- ret = _MEDdatasetStringLire(datagroup,MED_NOM_DES,attr_desc);
-
- /*
- * On ferme le Data Group
- */
- if ((ret = _MEDdatagroupFermer(datagroup)) < 0)
- return -1;
- }
- else
- *n_attr = 0;
-
- /*
- * On ferme tout
- */
- if ((ret = _MEDdatagroupFermer(famid)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <stdlib.h>
-#include <string.h>
-
-namespace med_2_1{
-
-med_err
-MEDfamLire(med_idt fid,char *maa, med_int *fam, med_int n,
- med_entite_maillage type_ent,med_geometrie_element type_geo)
-{
- med_idt root,maaid, entid, geoid;
- med_err ret;
- char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
- char nom_ent[MED_TAILLE_NOM_ENTITE+1];
- char nom_geo[MED_TAILLE_NOM_ENTITE+1];
-
- /*
- * On inhibe le gestionnaire d'erreur HDF 5
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * Si le maillage n'existe pas => erreur
- */
- strcpy(chemin,MED_MAA);
- strcat(chemin,maa);
- if ((maaid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
-
- /*
- * On met a jour le nom du Data Group representant
- * le type des entites
- */
- if ((ret = _MEDnomEntite(nom_ent,type_ent)) < 0)
- return -1;
-
- /*
- * Si le Data Group des entites n'existe pas => erreur
- */
- if ((entid = _MEDdatagroupOuvrir(maaid,nom_ent)) < 0)
- return -1;
-
- /*
- * Pour les mailles, les faces et le aretes, on cree
- * si le Data Group du type geometrique => erreur
- */
- if ((type_ent==MED_MAILLE)||(type_ent==MED_FACE)||(type_ent==MED_ARETE))
- {
- if ((ret = _MEDnomGeometrie(nom_geo,type_geo)) < 0)
- return -1;
- if ((geoid = _MEDdatagroupOuvrir(entid,nom_geo)) < 0)
- return -1;
- }
- else
- geoid = -1;
-
- /*
- * lecture du Data Set "FAM"
- */
- if (geoid == -1)
- root = entid;
- else
- root = geoid;
-#if defined(IRIX64)||defined(OSF1)
- if ((ret = _MEDdatasetNumLire(root,MED_NOM_FAM,MED_INT64,
- MED_NO_INTERLACE,1,MED_ALL,
- MED_NOPF,0,MED_NOPG,
- (unsigned char *)fam)) < 0)
- return -1;
-#else
- if ((ret = _MEDdatasetNumLire(root,MED_NOM_FAM,MED_INT32,
- MED_NO_INTERLACE,1,MED_ALL,
- MED_NOPF,0,MED_NOPG,
- (unsigned char *)fam)) < 0)
- return -1;
-#endif
-
- /*
- * On ferme tout
- */
- if (geoid != -1)
- if ((ret = _MEDdatagroupFermer(geoid)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(entid)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(maaid)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <stdio.h>
-
-namespace med_2_1{
-
-med_err
-MEDfamMaaCr(med_idt fid,char *maa,
- med_int *numfam,med_int *attide,
- med_int *attval,char *attdes,int *indatt,char *gro,int *indgro,
- med_int nfamilles)
-{
- med_err ret;
- med_int i;
- med_int natt,ngro;
- med_int numf;
- char nomfam[MED_TAILLE_NOM+1];
-
- /* La famille de numero 0 n'a aucun attribut, ni aucun groupe
- Les familles de numero > 0 sont des familles de noeuds
- Les familles de numero < 0 sont des familles d'elements */
- for (i=0;i<nfamilles;i++)
- {
- numf = *(numfam+i);
- if (numf == 0)
- strcpy(nomfam,"FAMILLE_0");
- if (numf > 0)
- {
- strcpy(nomfam,"FAMILLE_NOEUD_");
- sprintf(nomfam,"%s%d",nomfam,numf);
- nomfam[MED_TAILLE_NOM] = '\0';
- }
- if (numf < 0)
- {
- strcpy(nomfam,"FAMILLE_ELEMENT_");
- sprintf(nomfam,"%s%d",nomfam,-numf);
- nomfam[MED_TAILLE_NOM] = '\0';
- }
- natt = *(indatt+i+1) - *(indatt+i);
- ngro = (*(indgro+i+1) - *(indgro+i))/MED_TAILLE_LNOM;
- if ((ret = MEDfamCr(fid,maa,nomfam,numf,
- attide+*(indatt+i),
- attval+*(indatt+i),
- attdes+*(indatt+i)*MED_TAILLE_DESC,natt,
- gro+*(indgro+i),ngro)) < 0)
- return -1;
- }
-
- return 0;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-
-#include "med.hxx"
-
-namespace med_2_1{
-
-med_err
-MEDfamMaaInfo(med_idt fid,char *maa,med_int *nfam,med_int *nattc,
- med_int *ngroc)
-{
- med_int ret;
- med_int i;
-
- /* Lecture du nombre de familles */
- if ((*nfam = MEDnFam(fid,maa,0,(med_dim_famille)0)) < 0)
- return -1;
-
- /* Lecture des nombres cumules de groupes et d'attributs dans toutes
- les familles du maillage */
- *nattc = 0;
- *ngroc = 0;
- for (i=0;i<*nfam;i++)
- {
- if ((ret = MEDnFam(fid,maa,i+1,MED_ATTR)) < 0)
- return -1;
- *nattc += ret;
- if ((ret = MEDnFam(fid,maa,i+1,MED_GROUPE)) < 0)
- return -1;
- *ngroc += ret;
- }
-
- return 0;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-namespace med_2_1{
-
-med_err
-MEDfamMaaLire(med_idt fid,char *maa,med_int *numfam,med_int *attide,
- med_int *attval,char *attdes,int *indatt,char *gro,int *indgro,
- med_int nfamilles)
-{
- med_err ret;
- med_int natt,ngro;
- med_int i;
- char nom[MED_TAILLE_NOM+1];
-
- *indatt = 0;
- *indgro = 0;
- for (i=0;i<nfamilles;i++)
- {
- if ((ret = MEDfamInfo(fid,maa,i+1,nom,numfam+i,attide+*(indatt+i),
- attval+*(indatt+i),
- attdes+*(indatt+i)*MED_TAILLE_DESC,
- &natt,gro+*(indgro+i),&ngro)) < 0)
- return -1;
- *(indatt+i+1) = *(indatt+i)+natt;
- *(indgro+i+1) = *(indgro+i)+ngro*MED_TAILLE_LNOM;
- }
-
- return 0;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med_outils.hxx"
-#include "med.hxx"
-
-namespace med_2_1{
-
-med_err
-MEDfermer(med_idt fid)
-{
- /*
- * On inhibe le gestionnaire d'erreur
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * On ferme le fichier MED
- */
- if (_MEDfichierFermer(fid) < 0)
- return -1;
- else
- return 0;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <string.h>
-
-namespace med_2_1{
-
-med_err
-MEDfichDesEcr(med_idt fid, char *des, med_mode_acces mode)
-{
- med_idt attr;
- med_idt root;
- med_err ret;
- char nom[] = MED_NOM_DESCRIPTEUR;
- char chemin[MED_TAILLE_MAA+1];
-
- /*
- * On inhibe le gestionnaire d'erreur
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * On ouvre le Data Group racine
- * s'il n'existe pas on le cree
- */
- strncpy(chemin,MED_MAA,MED_TAILLE_MAA-1);
- chemin[MED_TAILLE_MAA-1] = '\0';
- if ((root = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- if ((root = _MEDdatagroupCreer(fid,chemin)) < 0)
- return -1;
-
- /*
- * On regarde si l'attribut existe
- * Si oui on le met a jour en fonction
- * du mode d'ouverture, sinon on le cree
- */
-
- if ((ret = _MEDattrStringEcrire(root,nom,MED_TAILLE_DESC,des,mode)) < 0)
- return -1;
-
- /*
- * Fermetures
- */
-
- if ((ret = _MEDdatagroupFermer(root)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <string.h>
-
-namespace med_2_1{
-
-med_err
-MEDfichEntete(med_idt fid, med_fich_info quoi, char str[])
-{
- med_idt atid, root;
- med_err ret;
- char locale[MED_TAILLE_DESC+1];
- char chemin[MED_TAILLE_MAA+1];
-
- switch (quoi)
- {
- case MED_HDF_VERSION :
- strcpy(str,HDF_VERSION_ACTUELLE);
- break;
-
- case MED_VERSION :
- strcpy(str,MED_VERSION_ACTUELLE);
- break;
-
- case MED_FICH_DES :
- /*
- * On inhibe le gestionnaire d'erreur HDF
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * On ouvre le Data Group racine
- */
- strncpy(chemin,MED_MAA,strlen(MED_MAA)-1);
- chemin[MED_TAILLE_MAA-1] = '\0';
- if ((root = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
-
- /*
- * On regarde si l'attribut existe
- * Si non => erreur
- * Si oui => on le copie dans str
- */
- if ((ret = _MEDattrStringLire(root,MED_NOM_DESCRIPTEUR,
- MED_TAILLE_DESC,locale)) < 0)
- return -1;
- strcpy(str,locale);
-
- if ((ret == _MEDdatagroupFermer(root)) < 0)
- return -1;
-
- break;
-
- default :
- return -1;
- }
- return 0;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-/*
- * - Nom de la fonction : _MEDfichierCreer
- * - Description : creation d'un fichier HDF
- * - Parametres :
- * - nom (IN) : le nom du fichier
- * - Resultat : ID du fichier en cas de succes, -1 sinon
- */
-
-namespace med_2_1{
-
-med_idt
-_MEDfichierCreer(char *nom)
-{
- med_idt fid,gid;
- med_err ret;
- med_int majeur = MED_NUM_MAJEUR;
- med_int mineur = MED_NUM_MINEUR;
- med_int release = MED_NUM_RELEASE;
-
- /*
- * On inhibe le gestionnaire d'erreur HDF 5
- */
- _MEDmodeErreurVerrouiller();
-
- if ((fid = H5Fcreate(nom,H5F_ACC_TRUNC,
- H5P_DEFAULT,H5P_DEFAULT)) < 0)
- return -1;
-
- if ((gid = _MEDdatagroupCreer(fid,MED_NOM_INFOS)) < 0)
- return -1;
-
- /* Numero de versions de MED */
- if ((ret = _MEDattrEntierEcrire(gid,MED_NOM_MAJEUR,&majeur,MED_REMP)) < 0)
- return -1;
-
- if ((ret = _MEDattrEntierEcrire(gid,MED_NOM_MINEUR,&mineur,MED_REMP)) < 0)
- return -1;
-
- if ((ret = _MEDattrEntierEcrire(gid,MED_NOM_RELEASE,&release,MED_REMP)) < 0)
- return -1;
-
- /* On ferme tout */
- if ((ret = _MEDdatagroupFermer(gid)) < 0)
- return -1;
-
- return fid;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-/*
- * - Nom de la fonction : _MEDfichierFermer
- * - Description : fermeture d'un fichier HDF
- * - Parametres :
- * - fid (IN) : ID du fichier
- * - Resultat : 0 en cas de succes, -1 sinon
- */
-
-namespace med_2_1{
-
-med_err
-_MEDfichierFermer(med_idt fid)
-{
- med_err ret;
-
- if ((ret = H5Fclose(fid)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-/*
- * - Nom de la fonction : _MEDfichierOuvrir
- * - Description : ouverture d'un fichier HDF en fonction du mode passe
- * en parametre
- * - Parametres :
- * - nom (IN) : le nom du fichier
- * - mode (IN) : mode d'ouverture
- * - Resultat : ID du fichier en cas de succes, -1 sinon
- */
-
-namespace med_2_1{
-
-med_idt
-_MEDfichierOuvrir(char *nom,med_mode_acces mode)
-{
- med_idt fid;
- int hdf_mode;
-
- switch(mode)
- {
- case MED_ECRI :
- hdf_mode = H5F_ACC_RDWR;
- break;
-
- case MED_LECT :
- hdf_mode = H5F_ACC_RDONLY;
- break;
-
- default :
- return -1;
- }
-
- if ((fid = H5Fopen(nom,hdf_mode,H5P_DEFAULT)) < 0)
- return -1;
-
- return fid;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-namespace med_2_1{
-
-med_err
-MEDformatConforme(const char * nomfich)
-{
-
- /*
- * On inhibe le gestionnaire d'erreur
- */
- _MEDmodeErreurVerrouiller();
-
-
- if ( H5Fis_hdf5(nomfich) > 0 )
- return 0;
- else
- return -1;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include <string.h>
-
-/*
- * Chaine C -> chaine FORTRAN completee par des blancs
- */
-
-namespace med_2_1{
-
-med_err
-_MEDfstring(char *chaine, med_int longueur_fixee)
-{
- int longueur_reelle, i;
-
- if (longueur_fixee == 0 ) return 0;
-
- longueur_reelle = strlen(chaine);
- if (longueur_fixee < longueur_reelle)
- return -1;
-
- /* on supprime le caractere de fin de chaine C '\0'
- et complete par des blancs */
- for (i=longueur_reelle;i<longueur_fixee;i++)
- *(chaine+i) = ' ';
-
- return 0;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-namespace med_2_1{
-
-med_err
-MEDgridCr(med_idt fid, char *maillage, med_int dim, med_grid_type typ)
-{
- med_idt maaid, root;
- char chemin[MED_TAILLE_MAA+1];
-
- /* On inhibe le gestionnaire d'erreur */
- _MEDmodeErreurVerrouiller();
-
- /* Si la racine n'existe pas on la cree */
- strncpy(chemin, MED_MAA, strlen(MED_MAA)-1);
- chemin[MED_TAILLE_MAA-1] = '\0';
- if ((root = _MEDdatagroupOuvrir(fid, chemin)) < 0)
- if ((root = _MEDdatagroupCreer(fid, chemin)) < 0)
- return(-1);
-
- /* si le maillage existe deja => erreur */
- if (_MEDdatagroupOuvrir(root, maillage) > 0) {
- return(-1);
- };
-
- /* Creation du Data Group */
- maaid = _MEDdatagroupCreer(root, maillage);
- if (maaid < 0) return(-1);
-
- /* Creation de l'attribut dimension */
- if (_MEDattrEntierEcrire(maaid, MED_NOM_DIM, &dim, MED_REMP) < 0) {
- return(-1);
- };
-
- /* Creation de l'attribut grille */
- if (_MEDattrEntierEcrire(maaid, MED_NOM_GRD, &typ, MED_REMP) < 0) {
- return(-1);
- };
-
- /* Nettoyages divers */
- if ( _MEDdatagroupFermer(maaid) < 0) return(-1);
- if (_MEDdatagroupFermer(root) < 0) return(-1);
- return(0);
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med_outils.hxx"
-#include "med.hxx"
-
-namespace med_2_1{
-
-med_err
-MEDgridEcr(med_idt fid, char *maa, med_int mdim, med_float *coo, med_int nb, med_int dim, med_mode_switch mode_coo,
- med_repere repere, char *nomcoo, char *unicoo, med_mode_acces mode )
-{
- /* ecriture des indices */
-
- med_idt maaid, noeid, ds;
- char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
- med_size dimd[1];
- char *dataset;
- med_int type_rep_int;
-
- /* On inhibe le gestionnaire d'erreur HDF */
- _MEDmodeErreurVerrouiller();
-
- /* Si le maillage n'existe pas => erreur */
- strcpy(chemin, MED_MAA);
- strcat(chemin, maa);
- maaid = _MEDdatagroupOuvrir(fid, chemin);
- if (maaid < 0) return(-1);
-
- /* Si le Data Group "NOE" n'existe pas on le cree */
- if ((noeid = _MEDdatagroupOuvrir(maaid, MED_NOM_NOE)) < 0) {
- if ((noeid = _MEDdatagroupCreer(maaid, MED_NOM_NOE)) < 0) {
- return(-1);
- };
- };
-
- switch (dim) {
- case 0 : {
- dataset = MED_NOM_IN1;
- break;
- };
- case 1 : {
- dataset = MED_NOM_IN2;
- break;
- };
- case 2 : {
- dataset = MED_NOM_IN3;
- break;
- };
- default : {
- return(-1);
- };
- };
-
- /* Creation du Data Set "IN1" ou "IN2" ou "IN3" */
- dimd[0] = nb;
- if (_MEDdatasetNumEcrire(noeid, dataset, MED_REEL64, mode_coo, 1, MED_ALL, MED_NOPF, 0, 0, dimd, (unsigned char*)coo, mode) < 0) {
- return(-1);
- };
-
- /* On re-ouvre le Data Set "IN1" ou "IN2" ou "IN3" pour y placer des attributs */
- if ((ds = _MEDdatasetOuvrir(noeid, dataset)) < 0) {
- return(-1);
- };
-
- /* Attribut NBR (nombre de noeuds) */
- if (_MEDattrEntierEcrire(ds, MED_NOM_NBR, &nb, mode) < 0) {
- return(-1);
- };
-
- /* L'attribut "REP" */
- type_rep_int = (med_int)repere;
- if (_MEDattrEntierEcrire(ds, MED_NOM_REP, &type_rep_int, mode) < 0) {
- return(-1);
- };
-
- /* Attribut "NOM" */
- if (_MEDattrStringEcrire(ds, MED_NOM_NOM, mdim*MED_TAILLE_PNOM, nomcoo, mode) < 0) {
- return(-1);
- };
-
- /* Attribut "UNI" */
- if (_MEDattrStringEcrire(ds, MED_NOM_UNI, mdim*MED_TAILLE_PNOM, unicoo, mode) < 0) {
- return(-1);
- };
-
- /* On ferme tout */
- if (_MEDdatasetFermer(ds) < 0) return(-1);
- if (_MEDdatagroupFermer(noeid) < 0) return(-1);
- if (_MEDdatagroupFermer(maaid) < 0) return(-1);
- return(0);
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <string.h>
-#include <stdlib.h>
-
-namespace med_2_1{
-
-med_err
-MEDgridInfo(med_idt fid, int indice, med_int *isAGrid, med_grid_type *typ)
-{
- int numero;
- med_idt maaid;
- char maillage[MED_TAILLE_NOM+1];
- char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
-
- /* On inhibe le gestionnaire d'erreur */
- _MEDmodeErreurVerrouiller();
-
- /* On recupere le nom du groupe de rang "indice" */
- numero = indice-1;
- if (_MEDobjetIdentifier(fid, MED_MAA, numero, maillage) < 0) {
- return(-1);
- };
-
- /* On va chercher l'attribut dimension */
- strcpy(chemin, MED_MAA);
- strcat(chemin, maillage);
- maaid = _MEDdatagroupOuvrir(fid, chemin);
- if (maaid < 0) return(-1);
-
- if (_MEDattrEntierLire(maaid, MED_NOM_GRD, typ) < 0) {
- *isAGrid = 0;
- } else {
- *isAGrid = 1;
- };
-
- if (_MEDdatagroupFermer(maaid) < 0) return(-1);
- return(0);
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-#include "med_outils.hxx"
-#include "med.hxx"
-
-namespace med_2_1{
-
-med_err
-MEDgridLire(med_idt fid, char *maa, med_int mdim, med_float *coo, med_int dim, med_mode_switch mode_coo,
- med_repere *repere, char *nomcoo, char *unicoo )
-{
- med_idt maaid, noeid, ds;
- char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
- char *dataset;
- med_int type_rep_int;
-
- /* On inhibe le gestionnaire d'erreur */
- _MEDmodeErreurVerrouiller();
-
- /* Si le maillage n'existe pas => erreur */
- strcpy(chemin, MED_MAA);
- strcat(chemin, maa);
- maaid = _MEDdatagroupOuvrir(fid, chemin);
- if (maaid < 0) return(-1);
-
- /* Si le Data Group "NOE" n'existe pas => erreur */
- noeid = _MEDdatagroupOuvrir(maaid, MED_NOM_NOE);
- if (noeid < 0) return(-1);
-
- switch (dim) {
- case 0 : {
- dataset = MED_NOM_IN1;
- break;
- };
- case 1 : {
- dataset = MED_NOM_IN2;
- break;
- };
- case 2 : {
- dataset = MED_NOM_IN3;
- break;
- };
- default : {
- return(-1);
- };
- };
-
- /* Lecture du Data Set "IN1" ou "IN2" ou "IN3" */
- if (_MEDdatasetNumLire(noeid, dataset, MED_REEL64, mode_coo, 1, MED_ALL, MED_NOPF, 0, 1, (unsigned char*)coo) < 0) {
- return(-1);
- };
-
- /* On re-ouvre le Data Set precedant pour y lire des attributs */
- ds = _MEDdatasetOuvrir(noeid, dataset);
- if (ds < 0) return(-1);
-
- /* L'attribut "REP" */
- if (_MEDattrEntierLire(ds, MED_NOM_REP, &type_rep_int) < 0) {
- return(-1);
- } else {
- *repere = (med_repere)type_rep_int;
- };
-
- /* Attribut "NOM" */
- if (_MEDattrStringLire(ds, MED_NOM_NOM, mdim*MED_TAILLE_PNOM, nomcoo) < 0) {
- return(-1);
- };
-
- /* Attribut "UNI" */
- if (_MEDattrStringLire(ds, MED_NOM_UNI, mdim*MED_TAILLE_PNOM, unicoo) < 0) {
- return(-1);
- };
-
- /* On ferme tout */
- if (_MEDdatasetFermer(ds) < 0) {
- return(-1);
- };
- if (_MEDdatagroupFermer(noeid) < 0) {
- return(-1);
- };
- if (_MEDdatagroupFermer(maaid) < 0) {
- return(-1);
- };
- return(0);
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "med.hxx"
-
-/***********************************************************************
- * FONCTION MEDgro2famA
- *
- * - DESCRIPTION : 1ere etape dans la conversion des groupes de noeuds
- * et d'elements en familles MED.
- * Calcul des tailles des tableaux que l'on devra allouer pour
- * stocker les familles qui seront construites par MEDgro2famB().
- * Les parametres renvoyes sont :
- * 1 - le nombre de familles MED a creer (nfamg)
- * 2 - le nombre de noms groupes associes a l'ensemble des familles
- * MED (nindf)
- * Ces parametres doivent permettre a l'appelant de creer les tables
- * suivantes :
- * 1 - une table des noms des groupes propres a chaque famille,
- * de taille : nindf*MED_TAILLE_LNOM+1
- * 2 - une table d'index donnant pour chaque famille son numero d'indice
- * dans la table des noms, de taille : nfamg+1
- * 3 - une table destinee a contenir la liste des numeros de familles
- * a creer, de taille : nfamg
- *
- * - PARAMETRES :
- * NOM .E/S. TYPE . DESCRIPTION
- * -------------------------------------------------------------------
- * nnoe .E . med_int . nombre de noeuds
- * nele .E . med_int . nombre d'elements
- * numnoe .E . med_int*. numeros des noeuds
- * numele .E . med_int*. numeros des elements
- * ngn .E . med_int . nombre de groupes de noeuds
- * nge .E . med_int . nombre de groupes d'elements
- * nindn .E . med_int . nombre d'indices dans la table
- * . . . des groupes de noeuds
- * ninde .E . med_int . nombre d'indices dans la table
- * . . . de groupes d'elements
- * indgronoe .E . int* . table index de la table des groupes
- * . . . de noeuds
- * indgroele .E . int* . table index de la table des groupes
- * . . . d'elements
- * tabgronoe .E . med_int*. table des groupes de noeuds
- * tabgroele .E . med_int*. table des groupes d'elements
- * nfamg . S. med_int*. nombre de familles MED a creer
- * nidnf . S. med_int*. nombre de noms groupes associes a
- * . . . l'ensemble des familles MED
- *
- * - RESULTAT : 0 si succes, -1 sinon
- *
- ***********************************************************************/
-
-namespace med_2_1{
-
-med_err
-MEDgro2famA (med_int nnoe,med_int nele,med_int *numnoe,med_int *numele,
- med_int ngn,med_int nge,med_int nindn,
- med_int ninde,int *indgronoe,int *indgroele,med_int *tabgronoe,
- med_int *tabgroele,med_int *nfamg,med_int *nindf)
-{
- int i,j,k;
- int *famnoe,*famele,*tmp;
- int *p;
- int flag, num,exist;
- int nfamn, nfame;
- int fam01 = 0;
- int fam02 = 0;
-
- /* initialisations */
- famnoe = NULL;
- famele = NULL;
-
- *nfamg = 0;
- *nindf = 0;
- nfamn = 0;
- nfame = 0;
-
- if ((ngn > 0) || (nge > 0))
- {
- /* pour chaque noeud :
- 1 - on dresse la liste des groupes de noeuds auquel il appartient
- 2 - en la comparant avec les listes pre-existantes, on
- estime s'il est necessaire de creer une nouvelle famille de noeuds.
- Si oui => on incremente le compteur local nfamn (nombre de familles
- de noeuds)
- on incremente le parametre nindf du nombre de groupes
- que devra compter cette famille de noeuds
- Si non => on ne fait rien */
- for (i=0;i<nnoe;i++)
- {
- if ((tmp = (int*) malloc(sizeof(int)*ngn)) == NULL)
- return -1;
- num = *(numnoe+i);
- for (j=0;j<ngn;j++)
- {
- flag = 0;
- /* on regarde si le noeud appartient au groupe */
- for (k=0;k<*(indgronoe+j+1)-*(indgronoe+j);k++)
- if (num == *(tabgronoe+*(indgronoe+j)+k))
- flag = 1;
- /* on met le flag a jour dans tmp */
- *(tmp+j) = flag;
- }
- /* on note la creation de la famille 0 */
- if (fam01 == 0)
- {
- flag = 1;
- for (j=0;j<ngn;j++)
- if (*(tmp+j) == 1)
- flag = 0;
- if (flag == 1)
- fam01 = 1;
- }
- /* faut-il creer une nouvelle famille ? */
- if (famnoe == NULL)
- {
- exist = 0;
- if ((famnoe = (int *) malloc (sizeof(int)*ngn)) == NULL)
- return -1;
- for (j=0;j<ngn;j++)
- {
- *(famnoe+j) = *(tmp+j);
- if (*(famnoe+j) == 1)
- *nindf = *nindf + 1;
- }
- nfamn = 1;
- }
- else
- {
- for (j=0;j<nfamn;j++)
- {
- p = famnoe + ngn*j;
- for (k=0;k<ngn;k++)
- {
- if (*(p+k) != *(tmp+k))
- {
- exist = 0;
- break;
- }
- else
- exist = 1;
- }
- if (exist == 1)
- break;
- }
- if (exist == 0)
- {
- nfamn = nfamn + 1;
- p = famnoe;
- if ((famnoe = (int*) malloc(sizeof(int)*ngn*nfamn)) == NULL)
- return -1;
- for (j=0;j<nfamn-1;j++)
- for (k=0;k<ngn;k++)
- *(famnoe+j*ngn+k) = *(p+j*ngn+k);
- free(p);
- p = famnoe+(nfamn-1)*ngn;
- for (j=0;j<ngn;j++)
- {
- *(p+j) = *(tmp+j);
- if (*(p+j) == 1)
- *nindf = *nindf + 1;
- }
- }
- }
- free(tmp);
- }
-
- /* pour chaque element : idem que pour les noeuds */
- for (i=0;i<nele;i++)
- {
- if ((tmp = (int*) malloc(sizeof(int)*nge)) == NULL)
- return -1;
- num = *(numele+i);
- for (j=0;j<nge;j++)
- {
- flag = 0;
- /* on regarde si l'element appartient au groupe */
- for (k=0;k<*(indgroele+j+1)-*(indgroele+j);k++)
- if (num == *(tabgroele+*(indgroele+j)+k))
- flag = 1;
- /* on met le flag a jour dans tmp */
- *(tmp+j) = flag;
- }
- /* on note la creation de la famille 0 */
- if (fam02 == 0)
- {
- flag = 1;
- for (j=0;j<nge;j++)
- if (*(tmp+j) == 1)
- flag = 0;
- if (flag == 1)
- fam02 = 1;
- }
- /* faut-il creer une nouvelle famille ? */
- if (famele == NULL)
- {
- exist = 0;
- if ((famele = (int *) malloc (sizeof(int)*nge)) == NULL)
- return -1;
- for (j=0;j<nge;j++)
- {
- *(famele+j) = *(tmp+j);
- if (*(famele+j) == 1)
- *nindf = *nindf + 1;
- }
- nfame = 1;
- }
- else
- {
- for (j=0;j<nfame;j++)
- {
- p = famele + nge*j;
- for (k=0;k<nge;k++)
- {
- if (*(p+k) != *(tmp+k))
- {
- exist = 0;
- break;
- }
- else
- exist = 1;
- }
- if (exist == 1)
- break;
- }
- if (exist == 0)
- {
- nfame = nfame + 1;
- p = famele;
- if ((famele = (int*) malloc(sizeof(int)*nge*nfame)) == NULL)
- return -1;
- for (j=0;j<nfame-1;j++)
- for (k=0;k<nge;k++)
- *(famele+j*nge+k) = *(p+j*nge+k);
- free(p);
- p = famele+(nfame-1)*nge;
- for (j=0;j<nge;j++)
- {
- *(p+j) = *(tmp+j);
- if (*(p+j) == 1)
- *nindf = *nindf + 1;
- }
- }
- }
- free(tmp);
- }
-
- /* la famille 0 existe pour les noeuds et les elements, on
- ne la compte qu'une fois */
- if (fam01 && fam02)
- nfamn = nfamn - 1;
-
- /* le nombre de familles a creer est egal au nombre de familles
- de noeuds + nombre de familles d'elements */
- *nfamg = nfamn + nfame;
-
-
- /* Nettoyage memoire */
- free(famnoe);
- free(famele);
- }
- else
- {
- /* on a aucun groupes de noeuds ou d'elements */
- *nfamg = 1; /* on a au moins la famille 0 */
- *nindf = 0;
- }
-
- return 0;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "med.hxx"
-
-/***********************************************************************
- * FONCTION MEDgro2famB
- *
- * - DESCRIPTION : 2eme etape dans la conversion des groupes de noeuds
- * et d'elements en familles MED
- * Mise a jour des tables suivantes passees en parametres :
- * 1 - les nouveaux numeros des familles a creer
- * 2 - les nouveaux numeros des familles des elements
- * 3 - les nouveaux numeros des familles des noeuds
- * 4 - les noms des groupes composant ces familles
- * 5 - les index de la table des groupes
- *
- * - PARAMETRES :
- * NOM .E/S. TYPE . DESCRIPTION
- * -------------------------------------------------------------------
- * nnoe .E . med_int . nombre de noeuds
- * nele .E . med_int . nombre d'elements
- * numnoe .E . med_int*. numeros des noeuds
- * numele .E . med_int*. numeros des elements
- * ngn .E . med_int . nombre de groupes de noeuds
- * nge .E . med_int . nombre de groupes d'elements
- * nindn .E . med_int . nombre d'indices dans la table
- * . . . des groupes de noeuds
- * ninde .E . med_int . nombre d'indices dans la table
- * . . . de groupes d'elements
- * nomgronoe .E . char* . noms des groupes de noeuds
- * nomgroele .E . char* . noms des groupes d'elements
- * indgronoe .E . int* . table index de la table des groupes
- * . . . de noeuds
- * indgroele .E . int* . table index de la table des groupes
- * . . . d'elements
- * tabgronoe .E . int* . table des groupes de noeuds
- * tabgroele .E . int* . table des groupes d'elements
- * nfamg .E . med_int . nombre de familles MED a creer
- * nidnf .E . med_int . nombre de noms groupes associes a
- * . . . l'ensemble des familles MED
- * newnumfam . S. med_int*. nouveaux numeros de familles
- * newnumfamele . S. med_int*. nouveaux numeros de familles des
- * . . . elements
- * newnumfamnoe . S. med_int*. nouveaux numeros de familles des
- * . . . noeuds
- * newindfamgro . S. int* . table des index de la table des
- * . . . noms de groupes associes aux familles
- * newfamgro . . char* . table des noms des groupes des
- * . . . familles
- *
- * - RESULTAT : 0
- *
- ***********************************************************************/
-
-namespace med_2_1{
-
-med_err
-MEDgro2famB (med_int nnoe,med_int nele,med_int *numnoe,med_int *numele,
- med_int ngn,med_int nge,med_int nindn,
- med_int ninde, char *nomgronoe,char *nomgroele,
- int *indgronoe,int *indgroele,med_int *tabgronoe,
- med_int *tabgroele,med_int nfamg,med_int nindf,
- med_int *newnumfam,med_int *newnumfamele,
- med_int *newnumfamnoe,int *newindfamgro,
- char *newfamgro)
-{
- int i,j,k;
-
- med_int *famnoe, *famele, *tmp;
- med_int *p;
- med_int num;
- int flag,exist;
- int nfamn, nfame;
- int estfam0 = 1;
- int newnumnoe, newnumele;
- int tmp1;
- int existfam0 = 0;
- int ind = 0;
-
- famnoe = NULL;
- famele = NULL;
-
- nfamn = 0;
- nfame = 0;
- newnumnoe = 0;
- newnumele = 0;
-
- *newindfamgro = 0;
-
- if (nfamg > 1)
- {
- /* pour chaque noeud :
- 1 - on dresse la liste des groupes de noeuds auquel il appartient
- 2 - en la comparant avec les listes pre-existantes, on
- estime s'il est necessaire de creer une nouvelle famille de noeuds.
- Si oui => - on cree le numero de famille que l'on reporte
- dans newnumfam
- - on reporte ce numero dans newnumnoe
- - on met a jour la table des noms des groupes des familles
- ainsi que sa table d'index
- Si non => on ne fait rien
- ATTENTION : pour la famille 0, on ne met a jour que les numeros */
- for (i=0;i<nnoe;i++)
- {
- if ((tmp = (med_int*) malloc(sizeof(med_int)*ngn)) == NULL)
- return -1;
- num = *(numnoe+i);
- for (j=0;j<ngn;j++)
- {
- flag = 0;
- /* on regarde si le noeud appartient au groupe */
- for (k=0;k<*(indgronoe+j+1)-*(indgronoe+j);k++)
- if (num == *(tabgronoe+*(indgronoe+j)+k))
- flag = 1;
- /* on met le flag a jour dans tmp */
- *(tmp+j) = flag;
- }
- /* on regarde si le numero de famille est 0 */
- estfam0 = 0;
- flag = 1;
- for (j=0;j<ngn;j++)
- if (*(tmp+j) == 1)
- flag = 0;
- if (flag == 1)
- {
- estfam0 = 1;
- *(newnumfamnoe+i) = 0;
- }
- if (flag == 1 && existfam0 == 0)
- existfam0 = 1;
- /* faut-il creer une nouvelle famille ? */
- if (famnoe == NULL)
- {
- exist = 0;
- if ((famnoe = (med_int *) malloc (sizeof(med_int)*ngn)) == NULL)
- return -1;
- /* on met a jour la table d'indices */
- nfamn = 1;
- *(newindfamgro+nfamn) = *(newindfamgro+nfamn-1);
- for (j=0;j<ngn;j++)
- {
- tmp1 = *(tmp+j);
- *(famnoe+j) = tmp1;
- if (tmp1 == 1)
- {
- strncpy(newfamgro+*(newindfamgro+nfamn),
- nomgronoe+j*MED_TAILLE_LNOM,MED_TAILLE_LNOM);
- *(newindfamgro+nfamn) = *(newindfamgro+nfamn) +
- MED_TAILLE_LNOM;
- }
- }
- if (estfam0 == 0)
- {
- newnumnoe = 1;
- *newnumfamnoe = newnumnoe;
- *newnumfam = newnumnoe;
- }
- else
- *newnumfam = 0;
- }
- else
- {
- for (j=0;j<nfamn;j++)
- {
- p = famnoe + ngn*j;
- for (k=0;k<ngn;k++)
- {
- if (*(p+k) != *(tmp+k))
- {
- exist = 0;
- break;
- }
- else
- exist = 1;
- }
- if (exist == 1)
- {
- if (estfam0 == 0)
- *(newnumfamnoe+i) = *(newnumfam+j);
- break;
- }
- }
- if (exist == 0)
- {
- nfamn = nfamn + 1;
- *(newindfamgro+nfamn) = *(newindfamgro+nfamn-1);
- p = famnoe;
- if ((famnoe = (med_int*) malloc(sizeof(med_int)*ngn*nfamn))
- == NULL)
- return -1;
- for (j=0;j<nfamn-1;j++)
- for (k=0;k<ngn;k++)
- *(famnoe+j*ngn+k) = *(p+j*ngn+k);
- free(p);
- p = famnoe+(nfamn-1)*ngn;
- for (j=0;j<ngn;j++)
- {
- tmp1 = *(tmp+j);
- *(p+j) = tmp1;
- if (tmp1 == 1)
- {
- strncpy(newfamgro+*(newindfamgro+nfamn),
- nomgronoe+j*MED_TAILLE_LNOM,MED_TAILLE_LNOM);
- *(newindfamgro+nfamn) = *(newindfamgro + nfamn)
- + MED_TAILLE_LNOM;
- }
- }
- if (estfam0 == 0)
- {
- newnumnoe = newnumnoe + 1;
- *(newnumfamnoe+i) = newnumnoe;
- *(newnumfam+nfamn-1) = newnumnoe;
- }
- else
- *(newnumfam+nfamn-1) = 0;
- }
- }
- free(tmp);
- }
-
- /* pour chaque element :
- 1 - on dresse la liste des groupes de noeuds auquel il appartient
- 2 - en la comparant avec les listes pre-existantes, on
- estime s'il est necessaire de creer une nouvelle famille d'elements.
- Si oui => - on cree le numero de famille que l'on reporte
- dans newnumfam
- - on reporte ce numero dans newnumele
- - on met a jour la table des noms des groupes des familles
- ainsi que sa table d'index
- Si non => on ne fait rien
- ATTENTION : pour la famille 0, on ne met a jour que les numeros */
- for (i=0;i<nele;i++)
- {
- if ((tmp = (med_int*) malloc(sizeof(med_int)*nge)) == NULL)
- return -1;
- num = *(numele+i);
- for (j=0;j<nge;j++)
- {
- flag = 0;
- /* on regarde si l'element appartient au groupe */
- for (k=0;k<*(indgroele+j+1)-*(indgroele+j);k++)
- if (num == *(tabgroele+*(indgroele+j)+k))
- flag = 1;
- /* on met le flag a jour dans tmp */
- *(tmp+j) = flag;
- }
- /* on regarde si le numero de famille est 0 */
- estfam0 = 0;
- flag = 1;
- for (j=0;j<nge;j++)
- if (*(tmp+j) == 1)
- flag = 0;
- if (flag == 1)
- {
- estfam0 = 1;
- *(newnumfamele+i) = 0;
- }
- /* faut-il creer une nouvelle famille ? */
- if (famele == NULL)
- {
- if (!(estfam0&&existfam0))
- {
- exist = 0;
- if ((famele = (med_int *) malloc (sizeof(med_int)*nge))
- == NULL)
- return -1;
- nfame = 1;
- *(newindfamgro+nfamn+nfame) = *(newindfamgro+nfamn+nfame-1);
- for (j=0;j<nge;j++)
- {
- tmp1 = *(tmp+j);
- *(famele+j) = tmp1;
- if (tmp1 == 1)
- {
- strncpy(newfamgro+*(newindfamgro+nfamn+nfame),
- nomgroele+j*MED_TAILLE_LNOM,MED_TAILLE_LNOM);
- *(newindfamgro+nfamn+nfame) = *(newindfamgro+nfamn+nfame)
- + MED_TAILLE_LNOM;
- }
- }
- if (estfam0 == 0)
- {
- newnumele = -1;
- *(newnumfamele+i) = newnumele;
- *(newnumfam+nfamn+nfame-1) = newnumele;
- }
- else
- {
- newnumele = 0;
- *(newnumfam+nfamn+nfame-1) = newnumele;
- existfam0 = 1;
- }
- }
- }
- else
- {
- for (j=0;j<nfame;j++)
- {
- p = famele + nge*j;
- for (k=0;k<nge;k++)
- {
- if (*(p+k) != *(tmp+k))
- {
- exist = 0;
- break;
- }
- else
- exist = 1;
- }
- if (exist == 1)
- {
- if (estfam0 == 0)
- *(newnumfamele+i) = *(newnumfam+nfamn+j);
- break;
- }
- }
- if (exist == 0 && !(estfam0 && existfam0))
- /* on cree une nouvelle famille */
- {
- nfame = nfame + 1;
- *(newindfamgro+nfamn+nfame) = *(newindfamgro+nfamn+nfame-1);
- p = famele;
- if ((famele = (med_int*) malloc(sizeof(med_int)*nge*nfame))
- == NULL)
- return -1;
- for (j=0;j<nfame-1;j++)
- for (k=0;k<nge;k++)
- *(famele+j*nge+k) = *(p+j*nge+k);
- free(p);
- p = famele+(nfame-1)*nge;
- for (j=0;j<nge;j++)
- {
- tmp1 = *(tmp+j);
- *(p+j) = tmp1;
- if (tmp1 == 1)
- {
- strncpy((newfamgro+*(newindfamgro+nfamn+nfame)),
- nomgroele+j*MED_TAILLE_LNOM,MED_TAILLE_LNOM);
- *(newindfamgro+nfamn+nfame) =
- *(newindfamgro+nfamn+nfame) + MED_TAILLE_LNOM;
- }
- }
- if (estfam0 == 0)
- {
- newnumele = newnumele - 1;
- *(newnumfamele+i) = newnumele;
- *(newnumfam+nfamn+nfame-1) = newnumele;
- }
- else
- if (existfam0 == 0)
- {
- *(newnumfam+nfamn+nfame-1) = 0;
- existfam0 =1;
- }
- }
- }
- free(tmp);
- }
-
- *(newfamgro+MED_TAILLE_LNOM*nindf) = '\0';
-
- free(famnoe);
- free(famele);
- }
- else
- {
- *newnumfam = 0;
- for (i=0;i<nele;i++)
- *(newnumfamele+i) = 0;
- for (i=0;i<nnoe;i++)
- *(newnumfamnoe+i) = 0;
- }
-
- return 0;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-/*
- * - Nom de la fonction : _MEDindiceInfo
- * - Description : en argument de H5Giterate, donne le nom
- * de l'objet HDF (data set ou data group)
- * contenu dans l'objet HDF passe en argument
- * - Parametres :
- * - id (IN) : l'ID de l'objet HDF
- * - nom (OUT) : le nom recupere
- * - donnees (OUT) : tampon
- * - Resultat : 1 en cas de succes, -1 sinon
- */
-
-namespace med_2_1{
-
-med_err
-_MEDindiceInfo(med_idt id, const char *nom, void *donnees)
-{
- if (donnees != NULL)
- strcpy((char*)donnees,nom);
- else
- return -1;
-
- return 1;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-/*
- * - Nom de la fonction : _MEDindiceNum
- * - Description : en argument de H5Giterate, donne le nombre
- * d'objets HDF (data set ou data group)
- * contenu dans l'objet HDF passe en argument
- * - Parametres :
- * - id (IN) : l'ID de l'objet HDF
- * - nom (OUT) : le nom du sous-objet
- * - donnees (OUT) : tampon
- * - Resultat : le nombre d'objets en cas de succes, -1 sinon
- */
-
-namespace med_2_1{
-
-med_err
-_MEDindiceNum(med_idt id,const char *nom, void *donnees)
-{
- int *compteur;
-
- compteur = (int *) donnees;
- (*compteur)++;
-
- return 0;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-#include <string.h>
-
-namespace med_2_1{
-
-med_int
-MEDlFichDes(med_idt fid)
-{
- med_idt attr, root;
- med_err ret=0;
- char des[MED_TAILLE_DESC+1];
- med_int longueur=0;
- char nom[MED_TAILLE_NOM+1];
- char chemin[MED_TAILLE_MAA+1];
-
- /*
- * On inhibe le gestionnaire d'erreur HDF
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * On ouvre le Data Group racine
- */
- strncpy(chemin,MED_MAA,MED_TAILLE_MAA-1);
- chemin[MED_TAILLE_MAA-1] = '\0';
- if ((root = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
-
- /*
- * On regarde si l'attribut existe
- * Si non => erreur
- * Si oui => on retourne sa longueur
- */
- strcpy(nom,MED_NOM_DESCRIPTEUR);
-
- if ((attr = _MEDattrOuvrir(root,nom)) < 0) {
- _MEDdatagroupFermer(root);
- longueur=0;
- return 0;
- }
-
- if ((ret = _MEDattrFermer(attr)) < 0) {
- _MEDdatagroupFermer(root);
- return -1;
- }
-
- if ((ret = _MEDattrStringLire(root,nom,MED_TAILLE_DESC,des)) < 0) {
- _MEDdatagroupFermer(root);
- return -1;
- }
-
- longueur = strlen(des);
-
- /*
- * fermetures
- */
- if ((ret == _MEDdatagroupFermer(root)) < 0)
- return -1;
-
- return longueur;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <string.h>
-#include <stdlib.h>
-
-namespace med_2_1{
-
-med_err
-MEDmaaCr(med_idt fid, char *maillage, med_int dim)
-{
- med_idt maaid, root;
- char chemin[MED_TAILLE_MAA+1];
- med_err ret;
-
- /*
- * On inhibe le gestionnaire d'erreur
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * Si la racine n'existe pas on la cree
- */
- strncpy(chemin,MED_MAA,strlen(MED_MAA)-1);
- chemin[MED_TAILLE_MAA-1] = '\0';
- if ((root = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- if ((root = _MEDdatagroupCreer(fid,chemin)) < 0)
- return -1;
-
- /*
- * si le maillage existe deja => erreur
- */
- if ((maaid = _MEDdatagroupOuvrir(root,maillage)) > 0)
- return -1;
-
- /*
- * Creation du Data Group
- */
- if ((maaid = _MEDdatagroupCreer(root,maillage)) < 0)
- return -1;
-
- /*
- * Creation de l'attribut dimension
- */
- if ((ret = _MEDattrEntierEcrire(maaid,MED_NOM_DIM,&dim,MED_REMP)) < 0)
- return -1;
-
- /*
- * Nettoyages divers
- */
- if ((ret = _MEDdatagroupFermer(maaid)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(root)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <string.h>
-#include <stdlib.h>
-
-namespace med_2_1{
-
-med_err
-MEDmaaInfo(med_idt fid, int indice, char *maillage, med_int *dim)
-{
- int numero;
- med_idt maaid;
- med_err ret;
- char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
-
- /*
- * On inhibe le gestionnaire d'erreur
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * On recupere le nom du groupe de rang "indice"
- */
- numero = indice-1;
- if ((ret = _MEDobjetIdentifier(fid,MED_MAA,numero,maillage)) < 0)
- return -1;
-
- /*
- * On va chercher l'attribut dimension
- */
- strcpy(chemin,MED_MAA);
- strcat(chemin,maillage);
- if ((maaid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
- if ((ret = _MEDattrEntierLire(maaid,MED_NOM_DIM,dim)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(maaid)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-/*
- * - Nom de la fonction : _MEDmodeErreurVerrouiller
- * - Description : inhibe le mode erreur HDF5
- * - Parametres : aucun
- * - Resultat : aucun
- */
-
-namespace med_2_1{
-
-void
-_MEDmodeErreurVerrouiller()
-{
- H5Eset_auto(NULL,NULL);
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include <string.h>
-#include <stdlib.h>
-#include "med_outils.hxx"
-
-namespace med_2_1{
-
-med_int
-MEDnChamp(med_idt fid, int indice)
-{
- int n1;
- med_int n2;
- med_idt datagroup;
- med_err ret;
- char nomdatagroup[MED_TAILLE_NOM+1];
- int num;
- char chemin[MED_TAILLE_CHA+MED_TAILLE_NOM+1];
-
- if (indice < 0)
- return -1;
-
- /*
- * On inhibe le gestionnaire d'erreur HDF
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * Si le Data Group cha n'existe pas et indice == 0 => 0
- * sinon erreur => erreur
- */
- strcpy(chemin,MED_CHA);
-
- /*
- * Si indice == 0 => nombre de champs
- */
- if (indice == 0)
- {
- n1 = 0;
- _MEDnObjets(fid,chemin,&n1);
- n2 = n1;
- }
-
- /*
- * Si indice > 0 => nbre de composants
- */
- if (indice > 0)
- {
- /*
- * On recupere le nom du champ
- */
- num = indice-1;
- if ((ret = _MEDobjetIdentifier(fid,chemin,num,nomdatagroup)) < 0)
- return -1;
- strcat(chemin,nomdatagroup);
- /*
- * On recupere le nombre de composants
- */
- if ((datagroup = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
- if ((ret = _MEDattrEntierLire(datagroup,MED_NOM_NCO,&n2)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(datagroup)) < 0)
- return -1;
- }
-
- return n2;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <string.h>
-#include <stdlib.h>
-
-namespace med_2_1{
-
-med_int
-MEDnCorres(med_idt fid,char *maa,char *eq,med_entite_maillage typ_ent,
- med_geometrie_element typ_geo)
-{
- med_idt eqid, datagroup;
- med_err ret;
- char chemin[MED_TAILLE_MAA+MED_TAILLE_EQS+2*MED_TAILLE_NOM+1];
- char nomdatagroup[MED_TAILLE_NOM+1];
- char tmp[MED_TAILLE_NOM_ENTITE+1];
- med_int n;
-
- if (typ_geo == MED_TETRA4 || typ_geo == MED_TETRA10 ||
- typ_geo == MED_HEXA8 || typ_geo == MED_HEXA20 ||
- typ_geo == MED_PENTA6 || typ_geo == MED_PENTA15 ||
- typ_geo == MED_PYRA5 || typ_geo == MED_PYRA13)
- return -1;
-
- /*
- * On inhibe le gestionnaire d'erreur HDF 5
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * Si le Data Group de "eq" n'existe pas => erreur
- */
- strcpy(chemin,MED_MAA);
- strcat(chemin,maa);
- strcat(chemin,MED_EQS);
- strcat(chemin,eq);
- if ((eqid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
- if ((ret = _MEDnomEntite(nomdatagroup,typ_ent)) < 0)
- return -1;
- if ((typ_ent != MED_NOEUD))
- {
- if ((ret = _MEDnomGeometrie(tmp,typ_geo)) < 0)
- return -1;
- strcat(nomdatagroup,".");
- strcat(nomdatagroup,tmp);
- }
- if ((datagroup = _MEDdatagroupOuvrir(eqid,nomdatagroup)) < 0)
- return 0;
- if ((ret = _MEDattrEntierLire(datagroup,MED_NOM_NBR,&n)) < 0)
- return -1;
-
- /*
- * On ferme tout
- */
- if ((ret = _MEDdatagroupFermer(datagroup)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(eqid)) < 0)
- return -1;
-
- return n;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <string.h>
-#include <stdlib.h>
-
-namespace med_2_1{
-
-med_int
-MEDnEntMaa(med_idt fid, char *maa, med_table quoi, med_entite_maillage type_ent,
- med_geometrie_element type_geo, med_connectivite type_conn)
-{
- med_idt root, maaid, entid,geoid, dataset=0;
- med_err ret;
- char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
- char nom_ent[MED_TAILLE_NOM_ENTITE+1];
- char nom_geo[MED_TAILLE_NOM_ENTITE+1];
- char nom_dataset[MED_TAILLE_NOM_ENTITE+1];
- med_int res = 0;
-
- /*
- * On inhibe le gestionnaire d'erreur HDF 5
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * Si le maillage n'existe pas => erreur
- */
- strcpy(chemin,MED_MAA);
- strcat(chemin,maa);
- if ((maaid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
-
- /*
- * On met a jour le nom du Data Group representant
- * le type des entites
- */
- if ((ret = _MEDnomEntite(nom_ent,type_ent)) < 0)
- return -1;
-
- /*
- * Si le Data Group des entites n'existe pas => res = 0
- */
- entid = _MEDdatagroupOuvrir(maaid,nom_ent);
-
- /*
- * Pour les mailles, les faces et le aretes
- * si le Data Group du type geometrique n'existe pas => res = 0
- */
- if ((type_ent==MED_MAILLE)||(type_ent==MED_FACE)||(type_ent==MED_ARETE))
- {
- if ((ret = _MEDnomGeometrie(nom_geo,type_geo)) < 0)
- return -1;
- geoid = _MEDdatagroupOuvrir(entid,nom_geo);
- }
- else
- geoid = -1;
-
- /*
- * Ouverture du Data Set renvoye par _MEDnomDataset()
- * S'il n'existe pas => erreur
- * Sinon lecture de l'attribut NBR
- */
- if (geoid == -1)
- root = entid;
- else
- root = geoid;
- if ((ret = _MEDnomDataset(nom_dataset,quoi,type_conn)) < 0)
- return -1;
- dataset = _MEDdatasetOuvrir(root,nom_dataset);
- if (dataset > 0)
- if ((ret = _MEDattrEntierLire(dataset,MED_NOM_NBR,&res)) < 0)
- return -1;
-
- /*
- * On ferme tout
- */
- if (dataset > 0)
- if ((ret = _MEDdatasetFermer(dataset)) < 0)
- return -1;
- if (geoid > 0)
- if ((ret = _MEDdatagroupFermer(geoid)) < 0)
- return -1;
- if (entid > 0)
- if ((ret = _MEDdatagroupFermer(entid)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(maaid)) < 0)
- return -1;
-
- return res;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-
-namespace med_2_1{
-
-med_int
-MEDnEntites(med_idt fid,char *maa,med_entite_maillage typ_ent,
- med_connectivite typ_con)
-{
- med_int total = 0;
- int i;
- med_geometrie_element typ_mai[MED_NBR_GEOMETRIE_MAILLE] = {MED_POINT1,MED_SEG2,
- MED_SEG3,MED_TRIA3,
- MED_TRIA6,MED_QUAD4,
- MED_QUAD8,MED_TETRA4,
- MED_TETRA10,MED_HEXA8,
- MED_HEXA20,MED_PENTA6,
- MED_PENTA15,MED_PYRA5,
- MED_PYRA13};
- med_geometrie_element typ_fac[MED_NBR_GEOMETRIE_FACE] = {MED_TRIA3,MED_TRIA6,
- MED_QUAD4,MED_QUAD8};
- med_geometrie_element typ_are[MED_NBR_GEOMETRIE_ARETE] = {MED_SEG2,MED_SEG3};
-
- switch (typ_ent)
- {
- case MED_MAILLE :
- for (i=0;i<MED_NBR_GEOMETRIE_MAILLE;i++)
- total += MEDnEntMaa(fid,maa,MED_CONN,MED_MAILLE,typ_mai[i],typ_con);
- break;
-
- case MED_FACE :
- for (i=0;i<MED_NBR_GEOMETRIE_FACE;i++)
- total += MEDnEntMaa(fid,maa,MED_CONN,MED_FACE,typ_fac[i],typ_con);
- break;
-
- case MED_ARETE :
- for (i=0;i<MED_NBR_GEOMETRIE_ARETE;i++)
- total += MEDnEntMaa(fid,maa,MED_CONN,MED_ARETE,typ_are[i],typ_con);
- break;
-
- case MED_NOEUD :
- total = MEDnEntMaa(fid,maa,MED_COOR,MED_NOEUD,(med_geometrie_element)0,(med_connectivite)0);
- break;
-
- default :
- total = -1;
- }
-
- return total;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <string.h>
-#include <stdlib.h>
-
-namespace med_2_1{
-
-med_int
-MEDnEquiv(med_idt fid, char *maa)
-{
- char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+MED_TAILLE_EQS+1];
- int n;
-
- /*
- * On inhibe le gestionnaire d'erreur HDF 5
- */
- _MEDmodeErreurVerrouiller();
-
- strcpy(chemin,MED_MAA);
- strcat(chemin,maa);
- strcat(chemin,MED_EQS);
- n = 0;
- _MEDnObjets(fid,chemin,&n);
-
- return (med_int) n;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <string.h>
-#include <stdlib.h>
-
-namespace med_2_1{
-
-med_int
-MEDnFam(med_idt fid,char *maa, int indice, med_dim_famille quoi)
-{
- med_idt datagroup,famid;
- med_err ret;
- char chemin[MED_TAILLE_MAA+MED_TAILLE_FAS+2*MED_TAILLE_NOM+1];
- med_int n;
- int n_tmp;
- int num;
- char famille[MED_TAILLE_NOM+1];
-
-
- /*
- * On inhibe le gestionnaire d'erreur HDF
- */
- _MEDmodeErreurVerrouiller();
-
- strcpy(chemin,MED_MAA);
- strcat(chemin,maa);
- strcat(chemin,MED_FAS);
- if (indice == 0)
- {
- n_tmp = 0;
- _MEDnObjets(fid,chemin,&n_tmp);
- n = (med_int ) n_tmp;
- }
- else
- {
- /*
- * On recupere le nom de la famille
- */
- num = indice - 1;
- if ((ret = _MEDobjetIdentifier(fid,chemin,num,
- famille)) < 0)
- return -1;
-
- /*
- * Si le Data Group de la famille n'existe pas => erreur
- */
- strcat(chemin,famille);
- if ((famid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
-
- switch (quoi)
- {
- case MED_GROUPE :
- if ((datagroup = _MEDdatagroupOuvrir(famid,MED_NOM_GRO)) < 0)
- n = 0;
- else
- {
- if ((ret = _MEDattrEntierLire(datagroup,MED_NOM_NBR,&n)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(datagroup)) < 0)
- return -1;
- }
- break;
-
- case MED_ATTR :
- if ((datagroup = _MEDdatagroupOuvrir(famid,MED_NOM_ATT)) < 0)
- n = 0;
- else
- {
- if ((ret = _MEDattrEntierLire(datagroup,MED_NOM_NBR,&n)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(datagroup)) < 0)
- return -1;
- }
- break;
-
- default :
- return -1;
- }
-
- if ((ret = _MEDdatagroupFermer(famid)) < 0)
- return -1;
-
- }
-
- return (med_int) n;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-namespace med_2_1{
-
-med_int
-MEDnGrid(med_idt fid, char *maa, med_grid n)
-{
- med_idt maaid, entid, geoid, dataset;
- char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
- char nom_ent[MED_TAILLE_NOM_ENTITE+1];
- char *nom_dataset;
- med_int res = (-1);
-
- /* On inhibe le gestionnaire d'erreur HDF 5 */
- _MEDmodeErreurVerrouiller();
-
- /* Si le maillage n'existe pas => erreur */
- strcpy(chemin, MED_MAA);
- strcat(chemin, maa);
- maaid = _MEDdatagroupOuvrir(fid, chemin);
- if (maaid < 0) return(-1);
-
- switch (n) {
- case MED_FAM_NOEUD : {
- nom_dataset = MED_NOM_FAM;
- if (_MEDnomEntite(nom_ent, MED_NOEUD) < 0) return(-1);
- entid = _MEDdatagroupOuvrir(maaid, nom_ent);
- break;
- };
- case MED_FAM_ARETE : {
- nom_dataset = MED_NOM_FAM;
- if (_MEDnomEntite(nom_ent, MED_ARETE) < 0) return(-1);
- geoid = _MEDdatagroupOuvrir(maaid, nom_ent);
- if (geoid < 0) return(-1);
- if (_MEDnomGeometrie(nom_ent, MED_SEG2) < 0) return(-1);
- entid = _MEDdatagroupOuvrir(geoid, nom_ent);
- break;
- };
- case MED_FAM_FACE : {
- nom_dataset = MED_NOM_FAM;
- if (_MEDnomEntite(nom_ent, MED_FACE) < 0) return(-1);
- geoid = _MEDdatagroupOuvrir(maaid, nom_ent);
- if (geoid < 0) return(-1);
- if (_MEDnomGeometrie(nom_ent, MED_QUAD4) < 0) return(-1);
- entid = _MEDdatagroupOuvrir(geoid, nom_ent);
- break;
- };
- case MED_FAM_MAILLE : {
- nom_dataset = MED_NOM_FAM;
- if (_MEDnomEntite(nom_ent, MED_MAILLE) < 0) return(-1);
- geoid = _MEDdatagroupOuvrir(maaid, nom_ent);
- if (geoid < 0) return(-1);
- if (_MEDnomGeometrie(nom_ent, MED_HEXA8) < 0) return(-1);
- entid = _MEDdatagroupOuvrir(geoid, nom_ent);
- break;
- };
- case MED_GRID_NOEUD : {
- nom_dataset = MED_NOM_BOF;
- entid = _MEDdatagroupOuvrir(maaid, MED_NOM_NOE);
- break;
- };
- case MED_GRID_D1 : {
- nom_dataset = MED_NOM_IN1;
- entid = _MEDdatagroupOuvrir(maaid, MED_NOM_NOE);
- break;
- };
- case MED_GRID_D2 : {
- nom_dataset = MED_NOM_IN2;
- entid = _MEDdatagroupOuvrir(maaid, MED_NOM_NOE);
- break;
- };
- case MED_GRID_D3 : {
- nom_dataset = MED_NOM_IN3;
- entid = _MEDdatagroupOuvrir(maaid, MED_NOM_NOE);
- break;
- };
- default : {
- return(-1);
- };
- };
-
- if (entid < 0) return(-1);
- dataset = _MEDdatasetOuvrir(entid, nom_dataset);
- if (dataset < 0) return(-1);
- if (_MEDattrEntierLire(dataset, MED_NOM_NBR, &res) < 0) return(-1);
-
- /* On ferme tout */
- if (_MEDdatasetFermer(dataset) < 0) return(-1);
- if (_MEDdatagroupFermer(entid) < 0) return(-1);
- if (_MEDdatagroupFermer(maaid) < 0) return(-1);
-
- return(res);
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <string.h>
-
-namespace med_2_1{
-
-med_int
-MEDnMaa(med_idt fid)
-{
- int n;
-
- _MEDmodeErreurVerrouiller();
-
- n = 0;
- _MEDnObjets(fid,MED_MAA,&n);
-
- return (med_int) n;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-/*
- * - Nom de la fonction : _MEDnObjets
- * - Description : indique le nombre d'objets HDF contenu dans le
- * datagroup passe en argument
- * - Parametres :
- * - fid (IN) : l'ID du fichier HDF
- * - chemin (IN) : chemin d'acces au datagroup
- * - n (OUT) : le nombre recherche
- * - Resultat : 0 en cas de succes, -1 sinon
- */
-
-namespace med_2_1{
-
-med_err
-_MEDnObjets(med_idt fid,char *chemin,int *n)
-{
- int idx;
-
- if ((idx = H5Giterate(fid,chemin,NULL,_MEDindiceNum,(void *)n)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <string.h>
-#include <stdlib.h>
-
-/*
- * Nombre de Couple (PDT,NOR) pour le champ <cha>
- */
-
-namespace med_2_1{
-
-med_int
-MEDnPasdetemps(med_idt fid,char *cha,med_entite_maillage type_ent,
- med_geometrie_element type_geo)
-
-{
- med_err ret;
- int n1;
- char nomdatagroup1[MED_TAILLE_NOM+1];
- char tmp1 [MED_TAILLE_NOM_ENTITE+1];
- char chemin [MED_TAILLE_CHA+(MED_TAILLE_NOM+1)+MED_TAILLE_NOM+1];
-
- /*
- * On inhibe le gestionnaire d'erreur HDF 5
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * Creation du chemin d'accès aux différents (PDT,NOR) pour les différents <type_ent>[.<type_geo>]
- */
- strcpy(chemin,MED_CHA);
- strcat(chemin,cha);
- strcat(chemin,"/");
-
- if ((ret = _MEDnomEntite(nomdatagroup1,type_ent)) < 0)
- return -1;
- if ((type_ent != MED_NOEUD))
- {
- if ((ret = _MEDnomGeometrie(tmp1,type_geo)) < 0)
- return -1;
- strcat(nomdatagroup1,".");
- strcat(nomdatagroup1,tmp1);
- }
- strcat(chemin,nomdatagroup1);
-
- n1 =0;
- _MEDnObjets(fid,chemin,&n1);
-
- return (med_int) n1;
-
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-namespace med_2_1{
-
-med_int
-MEDnProfil(med_idt fid)
-{
- int n;
- med_err ret;
-
- _MEDmodeErreurVerrouiller();
-
- n = 0;
- _MEDnObjets(fid,MED_PROFILS,&n);
-
- return (med_int) n;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include <string.h>
-#include <stdlib.h>
-#include "med_outils.hxx"
-
-namespace med_2_1{
-
-med_int
-MEDnVal(med_idt fid, char *champ, med_entite_maillage type_ent,
- med_geometrie_element type_geo,med_int numdt, med_int numo)
-{
- med_int n;
- med_idt datagroup;
- med_err ret;
- char nomdatagroup1[2*MED_TAILLE_NOM_ENTITE+2],nomdatagroup2[2*MED_MAX_PARA+1];
- char tmp1 [MED_TAILLE_NOM_ENTITE+1];
- char chemin [MED_TAILLE_CHA+(MED_TAILLE_NOM+1)+(2*MED_TAILLE_NOM_ENTITE+2)+(2*MED_MAX_PARA)+1+100];
-
- /*
- * On inhibe le gestionnaire d'erreur HDF
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * On cree le chemin d'accès
- */
- strcpy(chemin,MED_CHA);
- strcat(chemin,champ);
- strcat(chemin,"/");
-
- /* On cree le nom du datagroup de niveau 1 */
- if ((ret = _MEDnomEntite(nomdatagroup1,type_ent)) < 0)
- return -1;
- if ((type_ent != MED_NOEUD))
- {
- if ((ret = _MEDnomGeometrie(tmp1,type_geo)) < 0)
- return -1;
- strcat(nomdatagroup1,".");
- strcat(nomdatagroup1,tmp1);
- }
- strcat(chemin,nomdatagroup1);
- strcat(chemin,"/");
-
- /* Creation du datagroup de niveau 2 <numdt>.<numoo> */
- sprintf(nomdatagroup2,"%*li%*li",MED_MAX_PARA,(long ) numdt,MED_MAX_PARA,(long ) numo);
- strcat(chemin,nomdatagroup2);
-
- /*
- * Acces au champ
- */
- if ((datagroup = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return 0;
- if ((ret = _MEDattrEntierLire(datagroup,MED_NOM_NBR,&n)) < 0)
- return -1;
-
- /*
- * fermetures
- */
- if ((ret = _MEDdatagroupFermer(datagroup)) < 0)
- return -1;
-
- return n;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <string.h>
-#include <stdlib.h>
-
-namespace med_2_1{
-
-med_int
-MEDnValProfil(med_idt fid, char *nom)
-{
- med_int n = 0;
- med_idt pid;
- char chemin[MED_TAILLE_PROFILS+MED_TAILLE_NOM+1];
- med_err ret;
-
- /*
- * On inhibe le gestionnaire d'erreur HDF 5
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * ouverture du groupe /PROFILS/"nom"
- */
- strcpy(chemin,MED_PROFILS);
- strcat(chemin,nom);
- if ((pid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
-
- if ((ret = _MEDattrEntierLire(pid,MED_NOM_N,&n)) < 0)
- return ret;
-
- /*
- * On ferme tout
- */
- if ((ret = _MEDdatagroupFermer(pid)) < 0)
- return -1;
-
- return n;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <string.h>
-#include <stdlib.h>
-
-namespace med_2_1{
-
-med_err
-MEDnbnoisEcr(med_idt fid, char *nom_maillage,med_int n)
-{
- med_idt maaid;
- char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
- med_err ret;
-
- /*
- * On inhibe le gestionnaire d'erreur HDF
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * Si le maillage n'existe pas => erreur
- */
- strcpy(chemin,MED_MAA);
- strcat(chemin,nom_maillage);
- if ((maaid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
-
- /*
- * Creation de l'attribut "Nombre de Noeuds Isoles"
- */
- if ((ret = _MEDattrEntierEcrire(maaid,MED_NOM_NNI,&n,MED_REMP)) < 0)
- return -1;
-
- /*
- * Fermetures des objets
- */
- if ((ret = _MEDdatagroupFermer(maaid)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <string.h>
-#include <stdlib.h>
-
-namespace med_2_1{
-
-med_int
-MEDnbnoisLire(med_idt fid,char *nom_maillage)
-{
- med_idt maaid;
- med_err ret;
- char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
- med_int n;
-
- /*
- * On inhibe le gestionnaire d'erreur
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * On regarde si le maillage existe => erreur si non
- */
- strcpy(chemin,MED_MAA);
- strcat(chemin,nom_maillage);
- if ((maaid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
-
- /*
- * On va lire l'attribut "NNI"
- */
- if ((ret = _MEDattrEntierLire(maaid,MED_NOM_NNI,&n)) < 0)
- return -1;
-
- /*
- * Fermetures des objets HDF
- */
- if ((ret = _MEDdatagroupFermer(maaid)) < 0)
- return -1;
-
- return n;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <string.h>
-#include <stdlib.h>
-
-namespace med_2_1{
-
-med_err
-MEDnbnomaEcr(med_idt fid, char *nom_maillage,med_int n)
-{
- med_idt maaid;
- char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
- med_err ret;
-
- /*
- * On inhibe le gestionnaire d'erreur
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * Si le maillage n'existe pas => erreur
- */
- strcpy(chemin,MED_MAA);
- strcat(chemin,nom_maillage);
- if ((maaid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
-
- /*
- * Creation de l'attribut "Nombre de Noeuds Max par maille"
- */
- if ((ret = _MEDattrEntierEcrire(maaid,MED_NOM_NNM,&n,MED_REMP)) < 0)
- return -1;
-
- /*
- * Nettoyages divers
- */
- if ((ret = _MEDdatagroupFermer(maaid)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <string.h>
-#include <stdlib.h>
-
-namespace med_2_1{
-
-med_int
-MEDnbnomaLire(med_idt fid,char *nom_maillage)
-{
- med_idt maaid;
- med_err ret;
- char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
- med_int n;
-
- /*
- * On inhibe le gestionnaire d'erreur HDF
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * On regarde si le maillage existe => erreur si non
- */
- strcpy(chemin,MED_MAA);
- strcat(chemin,nom_maillage);
- if ((maaid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
-
- /*
- * On va lire l'attribut "NNM"
- */
- if ((ret = _MEDattrEntierLire(maaid,MED_NOM_NNM,&n)) < 0)
- return -1;
-
- /*
- * Fermetures des objets HDF
- */
- if ((ret = _MEDdatagroupFermer(maaid)) < 0)
- return -1;
-
- return n;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <string.h>
-#include <stdlib.h>
-
-namespace med_2_1{
-
-med_err
-MEDnbnosoEcr(med_idt fid, char *nom_maillage,med_int n)
-{
- med_idt maaid;
- char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
- med_err ret;
-
- /*
- * On inhibe le gestionnaire d'erreur HDF
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * Si le maillage n'existe pas => erreur
- */
- strcpy(chemin,MED_MAA);
- strcat(chemin,nom_maillage);
- if ((maaid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
-
- /*
- * Creation de l'attribut "Nombre de Noeuds Sommets"
- */
- if ((ret = _MEDattrEntierEcrire(maaid,MED_NOM_NNS,&n,MED_REMP)) < 0)
- return -1;
-
- /*
- * Fermetures
- */
- if ((ret = _MEDdatagroupFermer(maaid)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med_outils.hxx"
-#include "med.hxx"
-
-#include <string.h>
-#include <stdlib.h>
-
-namespace med_2_1{
-
-med_int
-MEDnbnosoLire(med_idt fid,char *nom_maillage)
-{
- med_idt maaid;
- med_err ret;
- char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
- med_int n;
-
- /*
- * On inhibe le gestionnaire d'erreur
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * On regarde si le maillage existe => erreur si non
- */
- strcpy(chemin,MED_MAA);
- strcat(chemin,nom_maillage);
- if ((maaid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
-
- /*
- * On va lire l'attribut "NNS"
- */
- if ((ret = _MEDattrEntierLire(maaid,MED_NOM_NNS,&n)) < 0)
- return -1;
-
- /*
- * Fermetures des objets HDF
- */
- if ((ret = _MEDdatagroupFermer(maaid)) < 0)
- return -1;
-
- return n;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-
-namespace med_2_1{
-
-med_err
-MEDnoeudsEcr(med_idt fid,char *maa,med_int mdim,med_float *coord,
- med_mode_switch mode_coo,
- med_repere repere,char *nomcoo, char *unicoo,char *nom,
- med_booleen inom,med_int *num,med_booleen inum,med_int *fam,
- med_int nnoeuds,med_mode_acces mode)
-{
- med_err ret;
-
- /* ecriture des coordonnees */
- if ((ret = MEDcoordEcr(fid,maa,mdim,coord,mode_coo,
- nnoeuds,mode,repere,nomcoo,
- unicoo)) < 0)
- return -1;
-
- /* ecriture des noms (facultatifs) */
- if (inom == MED_VRAI)
- if ((ret = MEDnomEcr(fid,maa,nom,nnoeuds,mode,MED_NOEUD,MED_POINT1)) < 0)
- return -1;
-
- /* ecriture des numeros (facultatifs) */
- if (inum == MED_VRAI)
- if ((ret = MEDnumEcr(fid,maa,num,nnoeuds,mode,MED_NOEUD,MED_POINT1)) < 0)
- return -1;
-
- /* ecriture des numeros de familles */
- if ((ret = MEDfamEcr(fid,maa,fam,nnoeuds,mode,MED_NOEUD,MED_POINT1)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-
-#include "med.hxx"
-
-namespace med_2_1{
-
-med_err
-MEDnoeudsLire(med_idt fid,char *maa,med_int mdim, med_float *coord,
- med_mode_switch mode_coo,
- med_repere *repere,char *nomcoo, char *unicoo,char *nom,
- med_booleen *inom,med_int *num,med_booleen *inum,med_int *fam,
- med_int nnoeuds)
-{
- med_err ret;
-
- /* lecture des coordonnees */
- if ((ret = MEDcoordLire(fid,maa,mdim,coord,mode_coo,MED_ALL,0,MED_NOPF,repere,nomcoo,
- unicoo)) < 0)
- return -1;
-
- /* lecture des noms (facultatifs) */
- if ((ret = MEDnomLire(fid,maa,nom,nnoeuds,MED_NOEUD,MED_POINT1)) < 0)
- *inom = MED_FAUX;
- else
- *inom = MED_VRAI;
-
- /* lecture des numeros (facultatifs) */
- if ((ret = MEDnumLire(fid,maa,num,nnoeuds,MED_NOEUD,MED_POINT1)) < 0)
- *inum = MED_FAUX;
- else
- *inum = MED_VRAI;
-
- /* lecture des numeros de familles */
- if ((ret = MEDfamLire(fid,maa,fam,nnoeuds,MED_NOEUD,MED_POINT1)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-/*
- * - Nom de la fonction : _MEDnomDataset
- * - Description : fournit un nom de dataset
- * - Parametres :
- * - nom_dataset (OUT) : le nom du data set
- * - quoi (IN) : le type de table MED
- * - type_conn (IN) : le type de connectivite
- * - Resultat : 0 en cas de succes, -1 sinon
- */
-
-namespace med_2_1{
-
-med_err
-_MEDnomDataset(char *nom_dataset,med_table quoi,med_connectivite type_conn)
-{
- switch(quoi)
- {
- case MED_COOR :
- strcpy(nom_dataset,MED_NOM_COO);
- break;
-
- case MED_CONN :
- switch(type_conn)
- {
- case MED_NOD :
- strcpy(nom_dataset,MED_NOM_NOD);
- break;
-
- case MED_DESC :
- strcpy(nom_dataset,MED_NOM_DES);
- break;
-
- default :
- return -1;
- }
- break;
-
- case MED_NOM :
- strcpy(nom_dataset,MED_NOM_NOM);
- break;
-
- case MED_NUM :
- strcpy(nom_dataset,MED_NOM_NUM);
- break;
-
- case MED_FAM :
- strcpy(nom_dataset,MED_NOM_FAM);
- break;
-
- default :
- return -1;
- }
-
- return 0;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <stdlib.h>
-#include <string.h>
-
-namespace med_2_1{
-
-med_err
-MEDnomEcr(med_idt fid,char *maa, char *nom, med_int n, med_mode_acces mode,
- med_entite_maillage type_ent,med_geometrie_element type_geo)
-{
- med_idt root, maaid, entid, geoid, dataset;
- med_err ret;
- med_size dimd[1];
- char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
- char nom_ent[MED_TAILLE_NOM_ENTITE+1];
- char nom_geo[MED_TAILLE_NOM_ENTITE+1];
-
- /*
- * On inhibe le gestionnaire d'erreur HDF 5
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * Si le maillage n'existe pas => erreur
- */
- strcpy(chemin,MED_MAA);
- strcat(chemin,maa);
- if ((maaid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
-
- /*
- * On met a jour le nom du Data Group representant
- * le type des entites
- */
- if ((ret = _MEDnomEntite(nom_ent,type_ent)) < 0)
- return -1;
-
- /*
- * Si le Data Group des entites n'existe pas on le cree
- */
- if ((entid = _MEDdatagroupOuvrir(maaid,nom_ent)) < 0)
- if ((entid = _MEDdatagroupCreer(maaid,nom_ent)) < 0)
- return -1;
-
- /*
- * Pour les mailles, les faces et le aretes, on cree
- * s'il n'existe pas le Data Group du type geometrique
- */
- if ((type_ent==MED_MAILLE)||(type_ent==MED_FACE)||(type_ent==MED_ARETE))
- {
- if ((ret = _MEDnomGeometrie(nom_geo,type_geo)) < 0)
- return -1;
-
- if ((geoid = _MEDdatagroupOuvrir(entid,nom_geo)) < 0)
- if ((geoid = _MEDdatagroupCreer(entid,nom_geo)) < 0)
- return -1;
- }
- else
- geoid = -1;
-
- /*
- * Creation du Data Set "NOM"
- */
- if (geoid == -1)
- root = entid;
- else
- root = geoid;
- dimd[0] = n*MED_TAILLE_PNOM+1;
- if ((ret = _MEDdatasetStringEcrire(root,MED_NOM_NOM,dimd,nom,mode)) < 0)
- return -1;
-
- /*
- * Attribut NBR (nombre de noeuds)
- */
- if ((dataset = _MEDdatasetOuvrir(root,MED_NOM_NOM)) < 0)
- return -1;
- if ((ret = _MEDattrEntierEcrire(dataset,MED_NOM_NBR,&n,mode)) < 0)
- return -1;
-
- /*
- * On ferme tout
- */
- if ((ret = _MEDdatasetFermer(dataset)) < 0)
- return -1;
- if (geoid > 0)
- if ((ret = _MEDdatagroupFermer(geoid)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(entid)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(maaid)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-/*
- * - Nom de la fonction : _MEDnomEntite
- * - Description : fournit le nom associe a un type d'entite MED
- * - Parametres :
- * - nom_ent (OUT) : le nom de l'entite
- * - type_ent (IN) : le type de l'entite
- * - Resultat : 0 en cas de succes, -1 sinon
- */
-
-namespace med_2_1{
-
-med_err
-_MEDnomEntite(char *nom_ent,med_entite_maillage type_ent)
-{
- switch(type_ent)
- {
- case MED_NOEUD :
- strcpy(nom_ent,MED_NOM_NOE);
- break;
-
- case MED_MAILLE :
- strcpy(nom_ent,MED_NOM_MAI);
- break;
-
- case MED_FACE :
- strcpy(nom_ent,MED_NOM_FAC);
- break;
-
- case MED_ARETE :
- strcpy(nom_ent,MED_NOM_ARE);
- break;
-
- default :
- return -1;
- }
- return 0;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-/*
- * - Nom de la fonction : _MEDnomGeometrie
- * - Description : fournit le nom de l'element geometrique associe
- * au type geometrique MED
- * - Parametres :
- * - nom_geo (OUT) : le nom de l'element
- * - type_geo (IN) : le type de l'element
- * - Resultat : 0 en cas de succes, -1 sinon
- */
-
-namespace med_2_1{
-
-med_err
-_MEDnomGeometrie(char *nom_geo,med_geometrie_element type_geo)
-{
- switch (type_geo)
- {
- case MED_POINT1 :
- strcpy(nom_geo,MED_NOM_PO1);
- break;
-
- case MED_SEG2 :
- strcpy(nom_geo,MED_NOM_SE2);
- break;
-
- case MED_SEG3 :
- strcpy(nom_geo,MED_NOM_SE3);
- break;
-
- case MED_TRIA3 :
- strcpy(nom_geo,MED_NOM_TR3);
- break;
-
- case MED_TRIA6 :
- strcpy(nom_geo,MED_NOM_TR6);
- break;
-
- case MED_QUAD4 :
- strcpy(nom_geo,MED_NOM_QU4);
- break;
-
- case MED_QUAD8 :
- strcpy(nom_geo,MED_NOM_QU8);
- break;
-
- case MED_TETRA4 :
- strcpy(nom_geo,MED_NOM_TE4);
- break;
-
- case MED_TETRA10 :
- strcpy(nom_geo,MED_NOM_T10);
- break;
-
- case MED_HEXA8 :
- strcpy(nom_geo,MED_NOM_HE8);
- break;
-
- case MED_HEXA20 :
- strcpy(nom_geo,MED_NOM_H20);
- break;
-
- case MED_PENTA6 :
- strcpy(nom_geo,MED_NOM_PE6);
- break;
-
- case MED_PENTA15 :
- strcpy(nom_geo,MED_NOM_P15);
- break;
-
- case MED_PYRA5 :
- strcpy(nom_geo,MED_NOM_PY5);
- break;
-
- case MED_PYRA13 :
- strcpy(nom_geo,MED_NOM_P13);
- break;
-
- default :
- return -1;
- }
-
- return 0;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <stdlib.h>
-#include <string.h>
-
-namespace med_2_1{
-
-med_err
-MEDnomLire(med_idt fid,char *maa, char *nom, med_int n,
- med_entite_maillage type_ent,med_geometrie_element type_geo)
-{
- med_idt root, maaid, entid, geoid;
- med_err ret;
- char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
- char nom_ent[MED_TAILLE_NOM_ENTITE+1];
- char nom_geo[MED_TAILLE_NOM_ENTITE+1];
-
- /*
- * On inhibe le gestionnaire d'erreur HDF 5
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * Si le maillage n'existe pas => erreur
- */
- strcpy(chemin,MED_MAA);
- strcat(chemin,maa);
- if ((maaid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
-
- /*
- * On met a jour le nom du Data Group representant
- * le type des entites
- */
- if ((ret = _MEDnomEntite(nom_ent,type_ent)) < 0)
- return -1;
-
- /*
- * Si le Data Group des entites n'existe pas => erreur
- */
- if ((entid = _MEDdatagroupOuvrir(maaid,nom_ent)) < 0)
- return -1;
-
- /*
- * Pour les mailles, les faces et le aretes,
- * on ouvre le Data Group du type geometrique
- */
- if ((type_ent==MED_MAILLE)||(type_ent==MED_FACE)||(type_ent==MED_ARETE))
- {
- if ((ret = _MEDnomGeometrie(nom_geo,type_geo)) < 0)
- return -1;
- if ((geoid = _MEDdatagroupOuvrir(entid,nom_geo)) < 0)
- return -1;
- }
- else
- geoid = -1;
-
- /*
- * lecture du Data Set "NOM"
- */
- if (geoid == -1)
- root = entid;
- else
- root = geoid;
- if ((ret = _MEDdatasetStringLire(root,MED_NOM_NOM,nom)) < 0)
- return -1;
-
- /*
- * On ferme tout
- */
- if (geoid > 0)
- if ((ret = _MEDdatagroupFermer(geoid)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(entid)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(maaid)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <stdlib.h>
-#include <string.h>
-
-namespace med_2_1{
-
-med_err
-MEDnumEcr(med_idt fid,char *maa, med_int *num, med_int n, med_mode_acces mode,
- med_entite_maillage type_ent,med_geometrie_element type_geo)
-{
- med_idt root, maaid, entid, geoid, dataset;
- med_err ret;
- med_size dimd[1];
- char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
- char nom_ent[MED_TAILLE_NOM_ENTITE+1];
- char nom_geo[MED_TAILLE_NOM_ENTITE+1];
-
- /*
- * On inhibe le gestionnaire d'erreur HDF 5
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * Si le maillage n'existe pas => erreur
- */
- strcpy(chemin,MED_MAA);
- strcat(chemin,maa);
- if ((maaid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
-
- /*
- * On met a jour le nom du Data Group representant
- * le type des entites
- */
- if ((ret = _MEDnomEntite(nom_ent,type_ent)) < 0)
- return -1;
-
- /*
- * Si le Data Group des entites n'existe pas on le cree
- */
- if ((entid = _MEDdatagroupOuvrir(maaid,nom_ent)) < 0)
- if ((root = _MEDdatagroupCreer(maaid,nom_ent)) < 0)
- return -1;
-
- /*
- * Pour les mailles, les faces et le aretes, on cree
- * s'il n'existe pas le Data Group du type geometrique
- */
- if ((type_ent==MED_MAILLE)||(type_ent==MED_FACE)||(type_ent==MED_ARETE))
- {
- if ((ret = _MEDnomGeometrie(nom_geo,type_geo)) < 0)
- return -1;
-
- if ((geoid = _MEDdatagroupOuvrir(entid,nom_geo)) < 0)
- if ((geoid = _MEDdatagroupCreer(entid,nom_geo)) < 0)
- return -1;
- }
- else
- geoid = -1;
-
- /*
- * Creation du Data Set "NUM"
- */
- if (geoid == -1)
- root = entid;
- else
- root = geoid;
- dimd[0] = n;
-#if defined(IRIX64)||defined(OSF1)
- if ((ret = _MEDdatasetNumEcrire(root,MED_NOM_NUM,MED_INT64,MED_NO_INTERLACE,MED_DIM1,MED_ALL,MED_NOPF,0,MED_NOPG,dimd,
- (unsigned char*) num,mode)) < 0)
- return -1;
-#else
- if ((ret = _MEDdatasetNumEcrire(root,MED_NOM_NUM,MED_INT32,MED_NO_INTERLACE,MED_DIM1,MED_ALL,MED_NOPF,0,MED_NOPG,dimd,
- (unsigned char*) num,mode)) < 0)
- return -1;
-#endif
-
- /*
- * Attribut NBR (nombre de noeuds)
- */
- if ((dataset = _MEDdatasetOuvrir(root,MED_NOM_NUM)) < 0)
- return -1;
- if ((ret = _MEDattrEntierEcrire(dataset,MED_NOM_NBR,&n,mode)) < 0)
- return -1;
-
- /*
- * On ferme tout
- */
- if ((ret = _MEDdatasetFermer(dataset)) < 0)
- return -1;
- if (geoid != -1)
- if ((ret = _MEDdatagroupFermer(geoid)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(entid)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(maaid)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <stdlib.h>
-#include <string.h>
-
-namespace med_2_1{
-
-med_err
-MEDnumLire(med_idt fid,char *maa, med_int *num, med_int n,
- med_entite_maillage type_ent,med_geometrie_element type_geo)
-{
- med_idt root,maaid,entid,geoid;
- med_err ret;
- char chemin[MED_TAILLE_MAA+MED_TAILLE_NOM+1];
- char nom_ent[MED_TAILLE_NOM_ENTITE+1];
- char nom_geo[MED_TAILLE_NOM_ENTITE+1];
-
- /*
- * On inhibe le gestionnaire d'erreur HDF 5
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * Si le maillage n'existe pas => erreur
- */
- strcpy(chemin,MED_MAA);
- strcat(chemin,maa);
- if ((maaid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
-
- /*
- * On met a jour le nom du Data Group representant
- * le type des entites
- */
- if ((ret = _MEDnomEntite(nom_ent,type_ent)) < 0)
- return -1;
-
- /*
- * Si le Data Group des entites n'existe pas => erreur
- */
- if ((entid = _MEDdatagroupOuvrir(maaid,nom_ent)) < 0)
- return -1;
-
- /*
- * Pour les mailles, les faces et le aretes,
- * si le Data Group du type geometrique => erreur
- */
- if ((type_ent==MED_MAILLE)||(type_ent==MED_FACE)||(type_ent==MED_ARETE))
- {
- if ((ret = _MEDnomGeometrie(nom_geo,type_geo)) < 0)
- return -1;
- if ((geoid = _MEDdatagroupOuvrir(entid,nom_geo)) < 0)
- return -1;
- }
- else
- geoid = -1;
-
- /*
- * lecture du Data Set "NUM"
- */
- if (geoid == -1)
- root = entid;
- else
- root = geoid;
-#if defined(IRIX64)||defined(OSF1)
- if ((ret = _MEDdatasetNumLire(root,MED_NOM_NUM,MED_INT64,
- MED_NO_INTERLACE,1,MED_ALL,
- MED_NOPF,0,MED_NOPG,
- (unsigned char*) num)) < 0)
- return -1;
-#else
- if ((ret = _MEDdatasetNumLire(root,MED_NOM_NUM,MED_INT32,
- MED_NO_INTERLACE,1,MED_ALL,
- MED_NOPF,0,MED_NOPG,
- (unsigned char*) num)) < 0)
- return -1;
-#endif
-
- /*
- * On ferme tout
- */
- if (geoid != -1)
- if ((ret = _MEDdatagroupFermer(geoid)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(entid)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(maaid)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-/*
- * - Nom de la fonction : _MEDobjetIdentifier
- * - Description : retrouve le nom de l'objet de rang "indice"
- * se trouvant dans le datagroup "chemin"
- * - Parametres :
- * - fid (IN) : l'ID du fichier ou se trouve le datagroup
- * - chemin (IN) : chemin d'acces au datagroup
- * - indice (IN) : indice de l'objet du datagroup dont on veut
- * le nom
- * - nom (OUT) : le nom
- * - Resultat : 0 en cas de succes, -1 sinon
- */
-
-namespace med_2_1{
-
-med_err
-_MEDobjetIdentifier(med_idt fid,char *chemin,int indice,void *nom)
-{
- int idx;
-
- if ((idx = H5Giterate(fid,chemin,&indice,_MEDindiceInfo,
- nom)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#ifdef PPRO_NT
-#define F_OK 0
-#else
-#include <unistd.h>
-#endif
-
-namespace med_2_1{
-
-med_idt
-MEDouvrir(char *nom, med_mode_acces mode_acces)
-{
- med_idt fid;
-
- /*
- * On inhibe le gestionnaire d'erreur HDF
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * On ouvre le fichier MED sous HDF
- */
- switch(mode_acces)
- {
- case MED_LECT :
- if (access(nom,F_OK))
- return -1;
- else
- if ((fid = _MEDfichierOuvrir(nom,mode_acces)) < 0)
- return -1;
- break;
-
- case MED_ECRI :
- if (access(nom,F_OK))
- {
- if ((fid = _MEDfichierCreer(nom)) < 0)
- return -1;
- }
- else
- if ((fid = _MEDfichierOuvrir(nom,mode_acces)) < 0)
- return -1;
- break;
-
- case MED_REMP :
- if ((fid = _MEDfichierCreer(nom)) < 0)
- return -1;
- break;
-
- default :
- return -1;
- }
-
- return fid;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-/*
- * - Nom de la fonction : _MEDparametresGeometrie
- * - Description : fournit les parametres geometriques des differents
- * entites et elements MED
- * - Parametres :
- * - typ_ent (IN) : type d'entite de l'element
- * - type_geo (IN) : le type geometrique de l'element
- * - dim (OUT) : dimension de l'element
- * - nnoe (OUT) : nombre de noeuds composant l'element (connectivite
- * nodale)
- * - ndes (OUT) : nombre de composants dans l'elements (connectivite
- * descendante)
- * - Resultat : 0 en cas de succes, -1 sinon
- */
-
-namespace med_2_1{
-
-med_err
-_MEDparametresGeometrie(med_entite_maillage type_ent,
- med_geometrie_element type_geo, int *dim,
- int *nnoe,int *ndes)
-{
- *nnoe = type_geo % 100;
- *dim = type_geo / 100;
-
- switch(type_ent)
- {
- case MED_MAILLE :
- switch (type_geo)
- {
- case MED_POINT1 :
- *ndes = 0;
- break;
-
- case MED_SEG2 :
- *ndes = 2;
- break;
-
- case MED_SEG3 :
- *ndes = 3;
- break;
-
- case MED_TRIA3 :
- *ndes = 3;
- break;
-
- case MED_TRIA6 :
- *ndes = 3;
- break;
-
- case MED_QUAD4 :
- *ndes = 4;
- break;
-
- case MED_QUAD8 :
- *ndes = 4;
- break;
-
- case MED_TETRA4 :
- *ndes = 4;
- break;
-
- case MED_TETRA10 :
- *ndes = 4;
- break;
-
- case MED_HEXA8 :
- *ndes = 6;
- break;
-
- case MED_HEXA20 :
- *ndes = 6;
- break;
-
- case MED_PENTA6 :
- *ndes = 5;
- break;
-
- case MED_PENTA15 :
- *ndes = 5;
- break;
-
- case MED_PYRA5 :
- *ndes = 5;
- break;
-
- case MED_PYRA13 :
- *ndes = 5;
- break;
-
- default :
- return -1;
- }
- break;
-
- case MED_FACE :
- switch(type_geo)
- {
- case MED_TRIA3 :
- *ndes = 3;
- break;
-
- case MED_TRIA6 :
- *ndes = 3;
- break;
-
- case MED_QUAD4 :
- *ndes = 4;
- break;
-
- case MED_QUAD8 :
- *ndes = 4;
- break;
-
- default :
- return -1;
- }
- break;
-
- case MED_ARETE :
- switch(type_geo)
- {
- case MED_SEG2 :
- *ndes = 2;
- break;
-
- case MED_SEG3 :
- *ndes = 3;
- break;
-
- default :
- return -1;
- }
- break;
-
- default :
- return -1;
- }
-
- return 0;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-/* Le nom de cette fonction n'est pas très bien choisie */
-
-namespace med_2_1{
-
-med_err
-MEDpasdetempsInfo(med_idt fid,char *champ
- ,med_entite_maillage type_ent, med_geometrie_element type_geo,
- int indice, char *maa, med_int * ngauss, med_int * numdt, char * dt_unit, med_float * dt,
- med_int * numo)
-{
-
- med_err ret=0;
- med_int gauss_size;
- med_idt gid;
- char chemin[(MED_TAILLE_CHA+MED_TAILLE_NOM+1)+(2*MED_TAILLE_NOM_ENTITE+2)+2*MED_MAX_PARA+1];
- int num;
- char nomdatagroup1[2*MED_TAILLE_NOM_ENTITE+2],nomdatagroup2[2*MED_MAX_PARA+1];
- char tmp1 [MED_TAILLE_NOM_ENTITE+1];
-
- /*
- * On inhibe le gestionnaire d'erreur HDF 5
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * On recupere le nom du datagroup <numdtt>.<numoo>
- */
- strcpy(chemin,MED_CHA);
- strcat(chemin,champ);
- strcat(chemin,"/");
-
- if ((ret = _MEDnomEntite(nomdatagroup1,type_ent)) < 0)
- return -1;
- if ((type_ent != MED_NOEUD))
- {
- if ((ret = _MEDnomGeometrie(tmp1,type_geo)) < 0)
- return -1;
- strcat(nomdatagroup1,".");
- strcat(nomdatagroup1,tmp1);
- }
- strcat(chemin,nomdatagroup1);
- strcat(chemin,"/");
-
- num = indice - 1;
- if ((ret = _MEDobjetIdentifier(fid,chemin,num,nomdatagroup2)) < 0)
- return -1;
- strcat(chemin,nomdatagroup2);
- if ((gid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
-
- /*
- * La liste des attributs
- */
- if ((ret = _MEDattrStringLire(gid,MED_NOM_MAI,MED_TAILLE_NOM,maa)) < 0)
- return -1;
-
- if ((ret = _MEDattrEntierLire(gid,MED_NOM_NDT,(med_int*) numdt)) < 0)
- return -1;
-
- if ((ret = _MEDattrFloatLire(gid,MED_NOM_PDT,(med_float*) dt)) < 0)
- return -1;
-
- if ((ret = _MEDattrStringLire(gid,MED_NOM_UNI,MED_TAILLE_PNOM,dt_unit)) < 0)
- return -1;
-
- if ((ret = _MEDattrEntierLire(gid,MED_NOM_NOR,(med_int*) numo)) < 0)
- return -1;
-
- if ( (ret = _MEDattrEntierLire(gid,MED_NOM_NGA,ngauss)) < 0 )
- return -1;
-
-
- if ((ret = _MEDdatagroupFermer(gid)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <string.h>
-#include <stdlib.h>
-
-namespace med_2_1{
-
-med_err
-MEDprofilEcr(med_idt fid,med_int *pflval,med_int n,char *nom)
-{
- med_idt root, pid, did;
- med_size dimd[1];
- med_err ret;
- char chemin[MED_TAILLE_PROFILS+1];
-
- /*
- * On inhibe le gestionnaire d'erreur HDF 5
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * Si le groupe "PROFILS" n'existe pas, on le cree
- */
- strncpy(chemin,MED_PROFILS,MED_TAILLE_PROFILS-1);
- chemin[MED_TAILLE_PROFILS-1] = '\0';
- if ((root = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- if ((root = _MEDdatagroupCreer(fid,chemin)) < 0)
- return -1;
-
- /*
- * Si le groupe "nom" n'existe pas, on le cree
- * Sinon => erreur
- */
- if ((pid = _MEDdatagroupOuvrir(root,nom)) >= 0)
- return -1;
- if ((pid = _MEDdatagroupCreer(root,nom)) < 0)
- return -1;
-
- /*
- * On stocke "n" sous forme d'attribut
- */
- if ((ret = _MEDattrEntierEcrire(pid,MED_NOM_N,&n,MED_REMP)) < 0)
- return -1;
-
- /*
- * On stocke le profil dans un dataset
- */
- dimd[0] = n;
-#if defined(IRIX64)||defined(OSF1)
- if ((ret = _MEDdatasetNumEcrire(pid,MED_NOM_PFL,MED_INT64,MED_NO_INTERLACE,MED_DIM1,MED_ALL,MED_NOPF,0,MED_NOPG,dimd,
- (unsigned char*) pflval,MED_REMP)) < 0)
- return -1;
-#else
- if ((ret = _MEDdatasetNumEcrire(pid,MED_NOM_PFL,MED_INT32,MED_NO_INTERLACE,MED_DIM1,MED_ALL,MED_NOPF,0,MED_NOPG,dimd,
- (unsigned char*) pflval,MED_REMP)) < 0)
- return -1;
-#endif
-
- /*
- * On ferme tout
- */
- if ((ret = _MEDdatagroupFermer(pid)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(root)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <string.h>
-#include <stdlib.h>
-
-namespace med_2_1{
-
-med_err
-MEDprofilInfo(med_idt fid, int indice, char *profil, med_int *n)
-{
- int numero;
- med_idt proid;
- med_err ret;
- char chemin[MED_TAILLE_PROFILS+MED_TAILLE_NOM+1];
-
- /*
- * On inhibe le gestionnaire d'erreur
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * On recupere le nom du groupe de rang "indice"
- */
- numero = indice-1;
- if ((ret = _MEDobjetIdentifier(fid,MED_PROFILS,numero,profil)) < 0)
- return -1;
-
- /*
- * On va chercher l'attribut taille du profil
- */
- strcpy(chemin,MED_PROFILS);
- strcat(chemin,profil);
- if ((proid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
- if ((ret = _MEDattrEntierLire(proid,MED_NOM_N,n)) < 0)
- return -1;
- if ((ret = _MEDdatagroupFermer(proid)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <string.h>
-#include <stdlib.h>
-
-namespace med_2_1{
-
-med_err
-MEDprofilLire(med_idt fid,med_int *pflval, char *nom)
-{
- med_err ret = 0;
- med_idt pid,did;
- char chemin[MED_TAILLE_PROFILS+MED_TAILLE_NOM+1];
-
- /*
- * On inhibe le gestionnaire d'erreur HDF 5
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * ouverture du groupe /PROFILS/"nom"
- */
- strcpy(chemin,MED_PROFILS);
- strcat(chemin,nom);
- if ((pid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
-
- /*
- * Lecture du profil
- */
-#if defined(IRIX64)||defined(OSF1)
- if ((ret = _MEDdatasetNumLire(pid,MED_NOM_PFL,MED_INT64,
- MED_NO_INTERLACE,1,MED_ALL,
- MED_NOPF,0,MED_NOPG,
- (unsigned char *) pflval)) < 0)
- return -1;
-#else
- if ((ret = _MEDdatasetNumLire(pid,MED_NOM_PFL,MED_INT32,
- MED_NO_INTERLACE,1,MED_ALL,
- MED_NOPF,0,MED_NOPG,
- (unsigned char *) pflval)) < 0)
- return -1;
-#endif
-
- /*
- * On ferme tout
- */
- if ((ret = _MEDdatagroupFermer(pid)) < 0)
- return -1;
-
- return ret;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <string.h>
-#include <stdlib.h>
-
-#include <stdio.h>
-#include <time.h>
-
-#ifdef PPRO_NT
-// Windows Header Files:
-#include <windows.h>
-#include <Lmcons.h>
-#include <sys/timeb.h>
-#else
-#include <sys/time.h>
-#endif
-
-namespace med_2_1{
-
-med_err
-MEDunvCr(med_idt fid, char *maa)
-{
- med_idt maaid;
- char chemin [MED_TAILLE_MAA+MED_TAILLE_NOM+1];
- char nomu [MED_TAILLE_LNOM+1];
- time_t temps;
-#ifdef PPRO_NT
- struct timeb tp;
- char lpBuffer [UNLEN+1];
- long nSize = UNLEN+1;
-#else
- struct timeval tp;
-#endif
- med_err ret;
-
- /*
- * On inhibe le gestionnaire d'erreur
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * Si le maillage n'existe pas => erreur
- */
- strcpy(chemin,MED_MAA);
- strcat(chemin,maa);
- if ((maaid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
-
- /*
- * Creation/Ecriture de l'attribut nom universel
- */
-
-#ifdef PPRO_NT
- if ( GetUserName(lpBuffer,&nSize) == 0 ) return -1;
- if ( nSize > MED_TAILLE_NOM ) nSize = MED_TAILLE_NOM;
- strncpy(nomu,lpBuffer,nSize);
- strcat(nomu," ");
- temps=time(&temps);
- strcat(nomu,ctime(&temps));
- ftime(&tp);
- nSize = strlen(nomu)-1;
- if ( sprintf(&nomu[nSize]," %hu",tp.millitm) < 0 ) return -1;
-#else
- if (cuserid(nomu) == (void*) NULL) return -1;
- strcat(nomu," ");
- temps=time(&temps);
- strcat(nomu,ctime(&temps));
- if ( gettimeofday(&tp,NULL) < 0 ) return -1;
- if ( sprintf(&nomu[strlen(nomu)-1]," %li",tp.tv_usec) < 0 ) return -1;
-#endif
- if ((ret = _MEDattrStringEcrire(maaid,MED_NOM_UNV,MED_TAILLE_LNOM,nomu,MED_REMP)) < 0)
- return -1;
-
- /*
- * Nettoyages divers
- */
- if ((ret = _MEDdatagroupFermer(maaid)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-#include <string.h>
-#include <stdlib.h>
-
-#include <stdio.h>
-#include <time.h>
-
-namespace med_2_1{
-
-med_err
-MEDunvLire(med_idt fid, char *maa,char *nomu)
-{
- med_idt maaid;
- char chemin [MED_TAILLE_MAA+MED_TAILLE_NOM+1];
- med_err ret;
-
- /*
- * On inhibe le gestionnaire d'erreur
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * Si le maillage n'existe pas => erreur
- */
- strcpy(chemin,MED_MAA);
- strcat(chemin,maa);
- if ((maaid = _MEDdatagroupOuvrir(fid,chemin)) < 0)
- return -1;
-
- /*
- * Creation/Ecriture de l'attribut nom universel
- */
- if ((ret = _MEDattrStringLire(maaid,MED_NOM_UNV,MED_TAILLE_LNOM,
- nomu )) < 0)
- return -1;
-
- /*
- * Nettoyages divers
- */
- if ((ret = _MEDdatagroupFermer(maaid)) < 0)
- return -1;
-
- return 0;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-namespace med_2_1{
-
-med_err
-MEDversionConforme(const char *nom) {
- med_int majeur, mineur;
- med_idt fid, gid;
- med_err ret;
-
- /*
- * On inhibe le gestionnaire d'erreur HDF
- */
- _MEDmodeErreurVerrouiller();
-
- /*
- * On ouvre le fichier MED en mode MED_LECT
- */
- if ((fid = _MEDfichierOuvrir((char *)nom,MED_LECT)) < 0)
- return -1;
-
- /*
- * Lecture du numero de version
- */
- if ((gid = _MEDdatagroupOuvrir(fid,MED_NOM_INFOS)) < 0)
- return -1;
-
- if ((ret = _MEDattrEntierLire(gid,MED_NOM_MAJEUR,&majeur)) < 0)
- return -1;
-
- if ((ret = _MEDattrEntierLire(gid,MED_NOM_MINEUR,&mineur)) < 0)
- return -1;
-
- /*
- * On ferme tout
- */
- if ((ret = _MEDdatagroupFermer(gid)) < 0)
- return -1;
-
- if ((ret = _MEDfichierFermer(fid)) < 0)
- return -1;
-
- if ((majeur == MED_NUM_MAJEUR) && (mineur == MED_NUM_MINEUR))
- return 0;
- else
- return -1;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-namespace med_2_1{
-
-void
-MEDversionDonner(med_int *majeur, med_int *mineur, med_int *release) {
- *majeur = MED_NUM_MAJEUR;
- *mineur = MED_NUM_MINEUR;
- *release = MED_NUM_RELEASE;
-}
-
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#include "med.hxx"
-#include "med_outils.hxx"
-
-namespace med_2_1{
-
-med_err
-MEDversionLire(med_idt fid, med_int *majeur, med_int *mineur, med_int *release)
-{
- med_err ret = 0;
- med_idt gid;
-
- /* On ouvre le group ou se trouvent les infos */
- if ((gid = _MEDdatagroupOuvrir(fid,MED_NOM_INFOS)) < 0) {
- *majeur = 2;
- *mineur = -1;
- *release = -1;
- ret = 0;
- }
- else {
- if ((ret = _MEDattrEntierLire(gid,MED_NOM_MAJEUR,majeur)) < 0)
- return -1;
-
- if ((ret = _MEDattrEntierLire(gid,MED_NOM_MINEUR,mineur)) < 0)
- return -1;
-
- if ((ret = _MEDattrEntierLire(gid,MED_NOM_RELEASE,release)) < 0)
- return -1;
-
- /* On ferme tout */
- if ((ret = _MEDdatagroupFermer(gid)) < 0)
- return -1;
- }
-
- return ret;
-}
-
-}
@COMMENCE@
-LIB_SRC_TOOLS_HDFI= \
-MEDattrFermer.cxx \
-MEDattrNumEcrire.cxx \
-MEDattrNumLire.cxx \
-MEDattrOuvrir.cxx \
-MEDattrStringEcrire.cxx \
-MEDattrStringLire.cxx \
-MEDdatagroupCreer.cxx \
-MEDdatagroupFermer.cxx \
-MEDdatagroupOuvrir.cxx \
-MEDdatasetFermer.cxx \
-MEDdatasetNumEcrire.cxx \
-MEDdatasetNumLire.cxx \
-MEDdatasetOuvrir.cxx \
-MEDdatasetStringEcrire.cxx \
-MEDdatasetStringLire.cxx \
-MEDfichierCreer.cxx \
-MEDfichierFermer.cxx \
-MEDfichierOuvrir.cxx \
-MEDindiceInfo.cxx \
-MEDindiceNum.cxx \
-MEDmodeErreurVerrouiller.cxx \
-MEDnObjets.cxx \
-MEDobjetIdentifer.cxx
+SUBDIRS = Core Wrapper
-LIB_SRC_TOOLS_MISC= \
-MED1cstring.cxx MEDnomDataset.cxx \
-MED2cstring.cxx MEDnomEntite.cxx \
-MEDGeometrieElement.cxx MEDnomGeometrie.cxx \
-MEDcstringFree.cxx MEDparametresGeometrie.cxx \
-MEDfstring.cxx
-
-LIB_SRC_API_CI= \
-MEDchampCr.cxx \
-MEDchampEcr.cxx \
-MEDchampInfo.cxx \
-MEDchampLire.cxx \
-MEDconnEcr.cxx \
-MEDconnLire.cxx \
-MEDcoordEcr.cxx \
-MEDcoordLire.cxx \
-MEDdimLire.cxx \
-MEDelementsEcr.cxx \
-MEDelementsLire.cxx \
-MEDequivCr.cxx \
-MEDequivEcr.cxx \
-MEDequivInfo.cxx \
-MEDequivLire.cxx \
-MEDfam2groA.cxx \
-MEDfam2groB.cxx \
-MEDfamCr.cxx \
-MEDfamEcr.cxx \
-MEDfamInfo.cxx \
-MEDfamLire.cxx \
-MEDfamMaaCr.cxx \
-MEDfamMaaInfo.cxx \
-MEDfamMaaLire.cxx \
-MEDfermer.cxx \
-MEDfichDesEcr.cxx \
-MEDfichEntete.cxx \
-MEDgro2famA.cxx \
-MEDgro2famB.cxx \
-MEDlFichDes.cxx \
-MEDmaaCr.cxx \
-MEDmaaInfo.cxx \
-MEDnChamp.cxx \
-MEDnCorres.cxx \
-MEDnEntMaa.cxx \
-MEDnEntites.cxx \
-MEDnEquiv.cxx \
-MEDnFam.cxx \
-MEDnMaa.cxx \
-MEDnPasdetemps.cxx \
-MEDnProfil.cxx \
-MEDnVal.cxx \
-MEDnValProfil.cxx \
-MEDnbnoisEcr.cxx \
-MEDnbnoisLire.cxx \
-MEDnbnomaEcr.cxx \
-MEDnbnomaLire.cxx \
-MEDnbnosoEcr.cxx \
-MEDnbnosoLire.cxx \
-MEDnoeudsEcr.cxx \
-MEDnoeudsLire.cxx \
-MEDnomEcr.cxx \
-MEDnomLire.cxx \
-MEDnumEcr.cxx \
-MEDnumLire.cxx \
-MEDouvrir.cxx \
-MEDpasdetempsInfo.cxx \
-MEDprofilEcr.cxx \
-MEDprofilLire.cxx \
-MEDprofilInfo.cxx \
-MEDunvCr.cxx \
-MEDunvLire.cxx \
-MEDformatConforme.cxx \
-MEDversionConforme.cxx \
-MEDversionDonner.cxx \
-MEDversionLire.cxx \
-MEDbodyFittedEcr.cxx \
-MEDbodyFittedLire.cxx \
-MEDfamGridEcr.cxx \
-MEDfamGridLire.cxx \
-MEDgridCr.cxx \
-MEDgridEcr.cxx \
-MEDgridInfo.cxx \
-MEDgridLire.cxx \
-MEDnGrid.cxx
-
-# Libraries targets
-
-LIB = libMEDWrapper_V2_1.la
-LIB_SRC = \
- $(LIB_SRC_TOOLS_HDFI) \
- $(LIB_SRC_TOOLS_MISC) \
- $(LIB_SRC_API_CI) \
- MED_V2_1_Wrapper.cxx
-
-EXPORT_HEADERS = \
- MED_V2_1_Wrapper.hxx \
- med.hxx \
- med_proto.hxx
-
-# Executables targets
-BIN = mdump_V2_1 test1_V2_1
-BIN_SRC =
-
-CPPFLAGS+= -D@MACHINE@ $(BOOST_CPPFLAGS) $(HDF5_INCLUDES)
-
-LDFLAGS+= $(HDF5_LIBS) -lMEDWrapperBase
-
-LDFLAGSFORBIN=$(LDFLAGS)
-
-@CONCLUDE@
+@MODULE@
--- /dev/null
+//
+//
+// Copyright (C) 2003 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.
+//
+// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File :
+// Author :
+// Module :
+// $Header$
+
+#include "MED_V2_1_Wrapper.hxx"
+#include "MED_Algorithm.hxx"
+#include "MED_Utilities.hxx"
+
+#include "med.hxx"
+using namespace med_2_1;
+
+#ifdef _DEBUG_
+static int MYDEBUG = 0;
+#else
+static int MYDEBUG = 0;
+#endif
+
+
+
+namespace MED
+{
+
+ template<>
+ TInt
+ GetDESCLength<eV2_1>()
+ {
+ return 200;
+ }
+
+ template<>
+ TInt
+ GetIDENTLength<eV2_1>()
+ {
+ return 8;
+ }
+
+ template<>
+ TInt
+ GetLNOMLength<eV2_1>()
+ {
+ return 80;
+ }
+
+ template<>
+ TInt
+ GetNOMLength<eV2_1>()
+ {
+ return 32;
+ }
+
+ template<>
+ TInt
+ GetPNOMLength<eV2_1>()
+ {
+ return 8;
+ }
+
+ template<>
+ TInt
+ GetNbConn<eV2_1>(EGeometrieElement typmai,
+ EEntiteMaillage typent,
+ TInt mdim)
+ {
+ TInt nsup = 0;
+
+ if(typent == eMAILLE){
+ TInt edim = typmai / 100;
+ if(mdim == 2 || mdim == 3)
+ if(edim == 1)
+ nsup = 1;
+
+ if(mdim == 3)
+ if (edim == 2)
+ nsup = 1;
+ }
+
+ return nsup + typmai%100;
+ }
+
+ namespace V2_1
+ {
+
+ //---------------------------------------------------------------
+ class TFile{
+ TFile();
+ TFile(const TFile&);
+
+ public:
+ TFile(const std::string& theFileName):
+ myFid(-1),
+ myCount(0),
+ myFileName(theFileName)
+ {}
+
+ ~TFile(){
+ Close();
+ }
+
+ void Open(EModeAcces theMode, TErr* theErr = NULL){
+ if(myCount++ == 0){
+ char* aFileName = const_cast<char*>(myFileName.c_str());
+ myFid = MEDouvrir(aFileName,med_mode_acces(theMode));
+ }
+ if(theErr){
+ *theErr = TErr(myFid);
+ INITMSG(MYDEBUG && myFid < 0,"TFile::Open - MED_MODE_ACCES = "<<theMode<<"; myFid = "<<myFid<<endl);
+ }else if(myFid < 0)
+ EXCEPTION(runtime_error,"TFile - MEDouvrir('"<<myFileName<<"',"<<theMode<<")");
+ }
+
+ const TIdt& Id() const {
+ if(myFid < 0)
+ EXCEPTION(runtime_error,"TFile - GetFid() < 0");
+ return myFid;
+ }
+
+ void Close(){
+ if(--myCount == 0)
+ MEDfermer(myFid);
+ }
+
+ protected:
+ std::string myFileName;
+ TInt myCount;
+ TIdt myFid;
+ };
+
+
+ //---------------------------------------------------------------
+ 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))
+ {}
+
+
+ TInt
+ TVWrapper
+ ::GetNbMeshes(TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile,eLECT,theErr);
+
+ if(theErr && *theErr < 0)
+ return -1;
+
+ return MEDnMaa(myFile->Id());
+ }
+
+
+ void
+ TVWrapper
+ ::GetMeshInfo(TInt theMeshId,
+ TMeshInfo& theInfo,
+ TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile,eLECT,theErr);
+
+ if(theErr && *theErr < 0)
+ return;
+
+ TErr aRet = MEDmaaInfo(myFile->Id(),
+ theMeshId,
+ &theInfo.myName[0],
+ (med_int*)&theInfo.myDim);
+ if(theErr)
+ *theErr = aRet;
+ else if(aRet < 0)
+ EXCEPTION(runtime_error,"GetMeshInfo - MEDmaaInfo(...)");
+ }
+
+
+ void
+ TVWrapper
+ ::SetMeshInfo(const TMeshInfo& theInfo,
+ EModeAcces theMode,
+ TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile,theMode,theErr);
+
+ if(theErr && *theErr < 0)
+ return;
+
+ TMeshInfo& anInfo = const_cast<TMeshInfo&>(theInfo);
+
+ TErr aRet = MEDmaaCr(myFile->Id(),
+ &anInfo.myName[0],
+ anInfo.myDim);
+
+ if(theErr)
+ *theErr = aRet;
+ else if(aRet < 0)
+ EXCEPTION(runtime_error,"SetMeshInfo - MEDmaaCr(...)");
+ }
+
+
+ void
+ TVWrapper
+ ::SetMeshInfo(const TMeshInfo& theInfo,
+ TErr* theErr)
+ {
+ TErr aRet;
+ SetMeshInfo(theInfo,eECRI,&aRet);
+
+ if(aRet < 0)
+ SetMeshInfo(theInfo,eREMP,theErr);
+ }
+
+
+ TInt
+ TVWrapper
+ ::GetNbFamilies(const TMeshInfo& theInfo,
+ TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile,eLECT,theErr);
+
+ if(theErr && *theErr < 0)
+ return -1;
+
+ TMeshInfo& anInfo = const_cast<TMeshInfo&>(theInfo);
+
+ return MEDnFam(myFile->Id(),
+ &anInfo.myName[0],
+ 0,
+ MED_FAMILLE);
+ }
+
+
+ TInt
+ TVWrapper
+ ::GetNbFamAttr(TInt theFamId,
+ const TMeshInfo& theInfo,
+ TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile,eLECT,theErr);
+
+ if(theErr && *theErr < 0)
+ return -1;
+
+ TMeshInfo& anInfo = const_cast<TMeshInfo&>(theInfo);
+
+ return MEDnFam(myFile->Id(),
+ &anInfo.myName[0],
+ theFamId,
+ MED_ATTR);
+ }
+
+
+ TInt
+ TVWrapper
+ ::GetNbFamGroup(TInt theFamId,
+ const TMeshInfo& theInfo,
+ TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile,eLECT,theErr);
+
+ if(theErr && *theErr < 0)
+ return -1;
+
+ TMeshInfo& anInfo = const_cast<TMeshInfo&>(theInfo);
+
+ return MEDnFam(myFile->Id(),
+ &anInfo.myName[0],
+ theFamId,
+ MED_GROUPE);
+ }
+
+
+ void
+ TVWrapper
+ ::GetFamilyInfo(TInt theFamId,
+ TFamilyInfo& theInfo,
+ TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile,eLECT,theErr);
+
+ if(theErr && *theErr < 0)
+ return;
+
+ TMeshInfo& aMeshInfo = *theInfo.myMeshInfo;
+
+ med_int* anAttrId = theInfo.myNbAttr > 0? (med_int*)&theInfo.myAttrId[0]: NULL;
+ med_int* anAttrVal = theInfo.myNbAttr > 0? (med_int*)&theInfo.myAttrVal[0]: NULL;
+ char* anAttrDesc = theInfo.myNbAttr > 0? &theInfo.myAttrDesc[0]: NULL;
+ char* aGroupNames = theInfo.myNbGroup > 0? &theInfo.myGroupNames[0]: NULL;
+
+ TErr aRet = MEDfamInfo(myFile->Id(),
+ &aMeshInfo.myName[0],
+ theFamId,
+ &theInfo.myName[0],
+ (med_int*)&theInfo.myId,
+ anAttrId,
+ anAttrVal,
+ anAttrDesc,
+ (med_int*)&theInfo.myNbAttr,
+ aGroupNames,
+ (med_int*)&theInfo.myNbGroup);
+
+ if(theErr)
+ *theErr = aRet;
+ else if(aRet < 0)
+ EXCEPTION(runtime_error,"GetFamilyInfo - MEDfamInfo - "<<
+ "&aMeshInfo.myName[0] = '"<<&aMeshInfo.myName[0]<<"'; "<<
+ "theFamId = "<<theFamId<<"; "<<
+ "&theInfo.myName[0] = '"<<&theInfo.myName[0]<<"'; "<<
+ "theInfo.myId = "<<theInfo.myId);
+ }
+
+
+ void
+ TVWrapper
+ ::SetFamilyInfo(const TFamilyInfo& theInfo,
+ EModeAcces theMode,
+ TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile,theMode,theErr);
+
+ if(theErr && *theErr < 0)
+ return;
+
+ TFamilyInfo& anInfo = const_cast<TFamilyInfo&>(theInfo);
+ TMeshInfo& aMeshInfo = *anInfo.myMeshInfo;
+
+ med_int* anAttrId = anInfo.myNbAttr > 0? (med_int*)&anInfo.myAttrId[0]: NULL;
+ med_int* anAttrVal = anInfo.myNbAttr > 0? (med_int*)&anInfo.myAttrVal[0]: NULL;
+ char* anAttrDesc = anInfo.myNbAttr > 0? &anInfo.myAttrDesc[0]: NULL;
+ char* aGroupNames = anInfo.myNbGroup > 0? &anInfo.myGroupNames[0]: NULL;
+
+ TErr aRet = MEDfamCr(myFile->Id(),
+ &aMeshInfo.myName[0],
+ &anInfo.myName[0],
+ anInfo.myId,
+ anAttrId,
+ anAttrVal,
+ anAttrDesc,
+ anInfo.myNbAttr,
+ aGroupNames,
+ anInfo.myNbGroup);
+
+ INITMSG(MYDEBUG && aRet,"TVWrapper::SetFamilyInfo - MED_MODE_ACCES = "<<theMode<<"; aRet = "<<aRet<<endl);
+
+ if(theErr)
+ *theErr = aRet;
+ else if(aRet < 0)
+ EXCEPTION(runtime_error,"SetFamilyInfo - MEDfamCr(...)");
+ }
+
+
+ void
+ TVWrapper
+ ::SetFamilyInfo(const TFamilyInfo& theInfo,
+ TErr* theErr)
+ {
+ TErr aRet;
+ SetFamilyInfo(theInfo,eECRI,&aRet);
+
+ if(aRet < 0)
+ SetFamilyInfo(theInfo,eREMP,theErr);
+ }
+
+
+ TInt
+ TVWrapper
+ ::GetNbNodes(const TMeshInfo& theMeshInfo,
+ TErr* theErr)
+ {
+ MSG(MYDEBUG,"TVWrapper::GetNbNodes");
+ TFileWrapper aFileWrapper(myFile,eLECT,theErr);
+
+ if(theErr && *theErr < 0)
+ return -1;
+
+ TMeshInfo& aMeshInfo = const_cast<TMeshInfo&>(theMeshInfo);
+
+ TInt aRet = MEDnEntMaa(myFile->Id(),
+ &aMeshInfo.myName[0],
+ MED_COOR,
+ MED_NOEUD,
+ med_geometrie_element(0),
+ med_connectivite(0));
+ return aRet;
+ }
+
+
+ void
+ TVWrapper
+ ::GetNodeInfo(TNodeInfo& theInfo,
+ TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile,eLECT,theErr);
+
+ if(theErr && *theErr < 0)
+ return;
+
+ TMeshInfo& aMeshInfo = *theInfo.myMeshInfo;
+
+ TErr aRet = MEDnoeudsLire(myFile->Id(),
+ &aMeshInfo.myName[0],
+ aMeshInfo.myDim,
+ &theInfo.myCoord[0],
+ med_mode_switch(theInfo.myModeSwitch),
+ (med_repere*)&theInfo.mySystem,
+ &theInfo.myCoordNames[0],
+ &theInfo.myCoordUnits[0],
+ &theInfo.myElemNames[0],
+ (med_booleen*)&theInfo.myIsElemNames,
+ (med_int*)&theInfo.myElemNum[0],
+ (med_booleen*)&theInfo.myIsElemNum,
+ (med_int*)&theInfo.myFamNum[0],
+ theInfo.myNbElem);
+
+ if(theErr)
+ *theErr = aRet;
+ else if(aRet < 0)
+ EXCEPTION(runtime_error,"GetNodeInfo - MEDnoeudsLire(...)");
+ }
+
+
+ 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;
+
+ char* anElemNames = theInfo.myIsElemNames? &anInfo.myElemNames[0]: NULL;
+ med_int* anElemNum = theInfo.myIsElemNum? &anInfo.myElemNum[0]: NULL;
+
+ TErr aRet = MEDnoeudsEcr(myFile->Id(),
+ &aMeshInfo.myName[0],
+ aMeshInfo.myDim,
+ &anInfo.myCoord[0],
+ med_mode_switch(theInfo.myModeSwitch),
+ med_repere(theInfo.mySystem),
+ &anInfo.myCoordNames[0],
+ &anInfo.myCoordUnits[0],
+ anElemNames,
+ med_booleen(theInfo.myIsElemNames),
+ anElemNum,
+ med_booleen(theInfo.myIsElemNum),
+ (med_int*)&anInfo.myFamNum[0],
+ anInfo.myNbElem,
+ MED_REMP);
+ if(theErr)
+ *theErr = aRet;
+ else if(aRet < 0)
+ EXCEPTION(runtime_error,"SetNodeInfo - MEDnoeudsEcr(...)");
+ }
+
+
+ void
+ TVWrapper
+ ::SetNodeInfo(const MED::TNodeInfo& theInfo,
+ TErr* theErr)
+ {
+ TErr aRet;
+ SetNodeInfo(theInfo,eECRI,&aRet);
+
+ if(aRet < 0)
+ SetNodeInfo(theInfo,eREMP,theErr);
+ }
+
+
+ TEntityInfo
+ TVWrapper
+ ::GetEntityInfo(const TMeshInfo& theMeshInfo,
+ EConnectivite theConnMode,
+ TErr* theErr)
+ {
+ TEntityInfo anInfo;
+
+ TFileWrapper aFileWrapper(myFile,eLECT,theErr);
+
+ if(theErr && *theErr < 0)
+ return anInfo;
+
+ 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)
+ anInfo[anEntity][aGeom] = aNbElem;
+ }
+ }
+ }
+ return anInfo;
+ }
+
+
+ TInt
+ TVWrapper
+ ::GetNbCells(const MED::TMeshInfo& theMeshInfo,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
+ EConnectivite theConnMode,
+ TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile,eLECT,theErr);
+
+ if(theErr && *theErr < 0)
+ return -1;
+
+ MED::TMeshInfo& aMeshInfo = const_cast<MED::TMeshInfo&>(theMeshInfo);
+
+ return MEDnEntMaa(myFile->Id(),
+ &aMeshInfo.myName[0],
+ MED_CONN,
+ med_entite_maillage(theEntity),
+ med_geometrie_element(theGeom),
+ med_connectivite(theConnMode));
+ }
+
+
+ void
+ TVWrapper
+ ::GetCellInfo(MED::TCellInfo& theInfo,
+ TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile,eLECT,theErr);
+
+ if(theErr && *theErr < 0)
+ return;
+
+ MED::TMeshInfo& aMeshInfo = *theInfo.myMeshInfo;
+ TInt aNbElem = theInfo.myElemNum.size();
+
+ TErr aRet;
+ aRet = MEDelementsLire(myFile->Id(),
+ &aMeshInfo.myName[0],
+ aMeshInfo.myDim,
+ (med_int*)&theInfo.myConn[0],
+ med_mode_switch(theInfo.myModeSwitch),
+ &theInfo.myElemNames[0],
+ (med_booleen*)&theInfo.myIsElemNames,
+ (med_int*)&theInfo.myElemNum[0],
+ (med_booleen*)&theInfo.myIsElemNum,
+ (med_int*)&theInfo.myFamNum[0],
+ aNbElem,
+ med_entite_maillage(theInfo.myEntity),
+ med_geometrie_element(theInfo.myGeom),
+ med_connectivite(theInfo.myConnMode));
+
+ if(theErr)
+ *theErr = aRet;
+ else if(aRet < 0)
+ EXCEPTION(runtime_error,"GetCellInfo - MEDelementsLire(...)");
+ }
+
+
+ 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;
+
+ char* anElemNames = theInfo.myIsElemNames? &anInfo.myElemNames[0]: NULL;
+ med_int* anElemNum = theInfo.myIsElemNum? &anInfo.myElemNum[0]: NULL;
+
+ TErr aRet;
+ aRet = MEDelementsEcr(myFile->Id(),
+ &aMeshInfo.myName[0],
+ aMeshInfo.myDim,
+ (med_int*)&anInfo.myConn[0],
+ med_mode_switch(theInfo.myModeSwitch),
+ anElemNames,
+ med_booleen(theInfo.myIsElemNames),
+ anElemNum,
+ med_booleen(theInfo.myIsElemNum),
+ (med_int*)&anInfo.myFamNum[0],
+ anInfo.myNbElem,
+ med_entite_maillage(theInfo.myEntity),
+ med_geometrie_element(theInfo.myGeom),
+ med_connectivite(theInfo.myConnMode),
+ MED_REMP);
+
+ if(theErr)
+ *theErr = aRet;
+ else if(aRet < 0)
+ EXCEPTION(runtime_error,"GetCellInfo - MEDelementsLire(...)");
+ }
+
+
+ void
+ TVWrapper
+ ::SetCellInfo(const MED::TCellInfo& theInfo,
+ TErr* theErr)
+ {
+ TErr aRet;
+ SetCellInfo(theInfo,eECRI,&aRet);
+
+ if(aRet < 0)
+ SetCellInfo(theInfo,eREMP,theErr);
+ }
+
+
+ TInt
+ TVWrapper
+ ::GetNbFields(TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile,eLECT,theErr);
+
+ if(theErr && *theErr < 0)
+ return -1;
+
+ return MEDnChamp(myFile->Id(),0);
+ }
+
+
+ TInt
+ TVWrapper
+ ::GetNbComp(TInt theFieldId,
+ TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile,eLECT,theErr);
+
+ if(theErr && *theErr < 0)
+ return -1;
+
+ return MEDnChamp(myFile->Id(),theFieldId);
+ }
+
+
+ void
+ TVWrapper
+ ::GetFieldInfo(TInt theFieldId,
+ MED::TFieldInfo& theInfo,
+ TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile,eLECT,theErr);
+
+ if(theErr && *theErr < 0)
+ return;
+
+ TErr aRet;
+ aRet = MEDchampInfo(myFile->Id(),
+ theFieldId,
+ &theInfo.myName[0],
+ (med_type_champ*)&theInfo.myType,
+ &theInfo.myCompNames[0],
+ &theInfo.myUnitNames[0],
+ theInfo.myNbComp);
+ if(theErr)
+ *theErr = aRet;
+ else if(aRet < 0)
+ EXCEPTION(runtime_error,"GetFieldInfo - MEDchampInfo(...)");
+ }
+
+
+ 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);
+
+ TErr aRet;
+ aRet = MEDchampCr(myFile->Id(),
+ &anInfo.myName[0],
+ med_type_champ(theInfo.myType),
+ &anInfo.myCompNames[0],
+ &anInfo.myUnitNames[0],
+ anInfo.myNbComp);
+
+ if(theErr)
+ *theErr = aRet;
+ else if(aRet < 0)
+ EXCEPTION(runtime_error,"SetFieldInfo - MEDchampCr(...)");
+ }
+
+
+ void
+ TVWrapper
+ ::SetFieldInfo(const MED::TFieldInfo& theInfo,
+ TErr* theErr)
+ {
+ try{
+
+ TErr aRet;
+ SetFieldInfo(theInfo,eECRI,&aRet);
+
+ if(aRet < 0)
+ SetFieldInfo(theInfo,eREMP,theErr);
+
+ }catch(const std::exception& theExc){
+ EXCEPTION(runtime_error,"SetFieldInfo(...)"<<endl<<
+ theExc.what());
+ }catch(...){
+ throw;
+ }
+ }
+
+ //-----------------------------------------------------------------
+ TInt
+ TVWrapper
+ ::GetNbProfiles(TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile,eLECT,theErr);
+
+ if(theErr && *theErr < 0)
+ return -1;
+
+ return MEDnProfil(myFile->Id());
+ }
+
+
+ TProfileInfo::TInfo
+ TVWrapper
+ ::GetProfilePreInfo(TInt theId,
+ TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile,eLECT,theErr);
+
+ if(theErr && *theErr < 0)
+ return TProfileInfo::TInfo("",-1);
+
+ TInt aSize = -1;
+ TVector<char> aName(GetNOMLength<eV2_1>()+1);
+
+ TErr aRet;
+ aRet = MEDprofilInfo(myFile->Id(),
+ theId,
+ &aName[0],
+ &aSize);
+ if(theErr)
+ *theErr = aRet;
+ else if(aRet < 0)
+ EXCEPTION(runtime_error,"GetProfilePreInfo - MEDprofilInfo(...)");
+
+ return TProfileInfo::TInfo(&aName[0],aSize);
+ }
+
+
+ void
+ TVWrapper
+ ::GetProfileInfo(TInt theId,
+ TProfileInfo& theInfo,
+ TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile,eLECT,theErr);
+
+ if(theErr && *theErr < 0)
+ return;
+
+ TErr aRet;
+ aRet = MEDprofilLire(myFile->Id(),
+ &theInfo.myElemNum[0],
+ &theInfo.myName[0]);
+ if(theErr)
+ *theErr = aRet;
+ else if(aRet < 0)
+ EXCEPTION(runtime_error,"SetNodeInfo - MEDprofilLire(...)");
+ }
+
+
+ //-----------------------------------------------------------------
+ TInt
+ TVWrapper
+ ::GetNbTimeStamps(const MED::TFieldInfo& theInfo,
+ const MED::TEntityInfo& theEntityInfo,
+ EEntiteMaillage& theEntity,
+ TGeom2Size& theGeom2Size,
+ TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile,eLECT,theErr);
+
+ if(theErr){
+ if(theEntityInfo.empty())
+ *theErr = -1;
+ if(*theErr < 0)
+ return -1;
+ }else if(theEntityInfo.empty())
+ EXCEPTION(runtime_error,"GetNbTimeStamps - There is no any Entity on the Mesh");
+
+ theGeom2Size.clear();
+ TInt aNbTimeStamps = 0;
+ TIdt anId = myFile->Id();
+
+ MED::TFieldInfo& anInfo = const_cast<MED::TFieldInfo&>(theInfo);
+ MED::TMeshInfo& aMeshInfo = anInfo.myMeshInfo;
+
+ TEntityInfo::const_iterator anIter = theEntityInfo.begin();
+ for(; anIter != theEntityInfo.end(); anIter++){
+ med_entite_maillage anEntity = med_entite_maillage(anIter->first);
+ const TGeom2Size& aGeom2Size = anIter->second;
+ TGeom2Size::const_iterator anGeomIter = aGeom2Size.begin();
+ for(; anGeomIter != aGeom2Size.end(); anGeomIter++){
+ med_geometrie_element aGeom = med_geometrie_element(anGeomIter->first);
+ TInt aNbStamps = MEDnPasdetemps(anId,
+ &anInfo.myName[0],
+ anEntity,
+ aGeom);
+ if(aNbStamps > 0){
+ INITMSG(MYDEBUG,
+ "GetNbTimeStamps aNbTimeStamps = "<<aNbStamps<<
+ "; aGeom = "<<aGeom<<"; anEntity = "<<anEntity<<"\n");
+ for(TInt iTimeStamp = 1; iTimeStamp <= aNbStamps; iTimeStamp++){
+ char aMaillageChamp[GetNOMLength<eV2_1>()+1];
+ char aDtUnit[GetPNOMLength<eV2_1>()+1];
+ med_int aNbGauss;
+ med_int aNumDt;
+ med_int aNumOrd;
+ med_float aDt;
+ TErr aRet = MEDpasdetempsInfo(anId,
+ &anInfo.myName[0],
+ anEntity,
+ aGeom,
+ iTimeStamp,
+ aMaillageChamp,
+ &aNbGauss,
+ &aNumDt,
+ aDtUnit,
+ &aDt,
+ &aNumOrd);
+
+ INITMSG(MYDEBUG,
+ "GetNbTimeStamps aMaillageChamp = '"<<aMaillageChamp<<"'"<<
+ "; aMeshName = '"<<&aMeshInfo.myName[0]<<"'\n");
+ if(aRet == 0 && (! strcmp(aMaillageChamp,&aMeshInfo.myName[0]))){
+ 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,eLECT,theErr);
+
+ const TGeom2Size& aGeom2Size = theInfo.myGeom2Size;
+
+ if(theErr){
+ if(aGeom2Size.empty())
+ *theErr = -1;
+ if(*theErr < 0)
+ return;
+ }else if(aGeom2Size.empty())
+ EXCEPTION(runtime_error,"GetTimeStampInfo - There is no any cell");
+
+ MED::TFieldInfo& aFieldInfo = *theInfo.myFieldInfo;
+ MED::TMeshInfo& aMeshInfo = *aFieldInfo.myMeshInfo;
+
+ TGeom2NbGauss& aGeom2NbGauss = theInfo.myGeom2NbGauss;
+
+ TGeom2Size::const_iterator anIter = aGeom2Size.begin();
+ for(; anIter != aGeom2Size.end(); anIter++){
+ const EGeometrieElement& aGeom = anIter->first;
+ med_int aNbGauss = -1;
+
+ TErr aRet;
+ aRet = MEDpasdetempsInfo(myFile->Id(),
+ &aFieldInfo.myName[0],
+ med_entite_maillage(theInfo.myEntity),
+ med_geometrie_element(anIter->first),
+ theTimeStampId,
+ &aMeshInfo.myName[0],
+ &aNbGauss,
+ (med_int*)&theInfo.myNumDt,
+ &theInfo.myUnitDt[0],
+ &theInfo.myDt,
+ (med_int*)&theInfo.myNumOrd);
+
+
+ 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(runtime_error,"GetTimeStampInfo - MEDpasdetempsInfo(...)");
+ }
+ }
+
+
+ void
+ TVWrapper
+ ::GetTimeStampVal(TTimeStampVal& theVal,
+ const TMKey2Profile& theMKey2Profile,
+ const TKey2Gauss& theKey2Gauss,
+ TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile,eLECT,theErr);
+
+ if(theErr && *theErr < 0)
+ return;
+
+ TIdt anId = myFile->Id();
+
+ MED::TTimeStampInfo& aTimeStampInfo = *theVal.myTimeStampInfo;
+ MED::TFieldInfo& aFieldInfo = *aTimeStampInfo.myFieldInfo;
+ MED::TMeshInfo& aMeshInfo = *aFieldInfo.myMeshInfo;
+
+ MED::TKey2Profile aKey2Profile = boost::get<1>(theMKey2Profile);
+ TVector<char> aProfileName(GetNOMLength<eV2_1>()+1);
+
+ TGeom2Size& aGeom2Size = aTimeStampInfo.myGeom2Size;
+ TGeom2Size::iterator anIter = aGeom2Size.begin();
+ for(; anIter != aGeom2Size.end(); anIter++){
+ EGeometrieElement aGeom = anIter->first;
+ TInt aNbVal = MEDnVal(anId,
+ &aFieldInfo.myName[0],
+ med_entite_maillage(aTimeStampInfo.myEntity),
+ med_geometrie_element(aGeom),
+ aTimeStampInfo.myNumDt,
+ aTimeStampInfo.myNumOrd);
+ if(aNbVal <= 0){
+ if(theErr){
+ *theErr = -1;
+ return;
+ }
+ EXCEPTION(runtime_error,"GetTimeStampVal - MEDnVal(...) - aNbVal == "<<aNbVal<<" <= 0");
+ }
+
+ TMeshValue& aMeshValue = theVal.GetMeshValue(aGeom);
+ TInt aNbGauss = aTimeStampInfo.GetNbGauss(aGeom);
+ TInt aNbElem = aNbVal / aNbGauss;
+ aMeshValue.Init(aNbElem,
+ aNbGauss,
+ aFieldInfo.myNbComp);
+ TValue& aValue = aMeshValue.myValue;
+ TInt anEnd = aValue.size();
+
+ INITMSG(MYDEBUG,
+ "TVWrapper::GetTimeStampVal - aGeom = "<<aGeom<<
+ "; aNbVal = "<<aNbVal<<
+ "; anEnd = "<<anEnd<<
+ "; aNbElem = "<<aNbElem<<
+ "; aNbGauss = "<<aNbGauss<<
+ "; aFieldInfo.myNbComp = "<<aFieldInfo.myNbComp<<
+ endl);
+
+ TErr aRet;
+ switch(aFieldInfo.myType){
+ case eFLOAT64: {
+ TVector<TFloat> anArray(anEnd);
+ aRet = MEDchampLire(anId,
+ &aMeshInfo.myName[0],
+ &aFieldInfo.myName[0],
+ (unsigned char*)&anArray[0],
+ med_mode_switch(theVal.myModeSwitch),
+ MED_ALL,
+ &aProfileName[0],
+ med_entite_maillage(aTimeStampInfo.myEntity),
+ med_geometrie_element(aGeom),
+ aTimeStampInfo.myNumDt,
+ aTimeStampInfo.myNumOrd);
+ if(aRet >= 0)
+ for(TInt anId = 0; anId < anEnd; anId++)
+ aValue[anId] = anArray[anId];
+ break;
+ }
+ default: {
+ TVector<TInt> anArray(anEnd);
+ aRet = MEDchampLire(anId,
+ &aMeshInfo.myName[0],
+ &aFieldInfo.myName[0],
+ (unsigned char*)&anArray[0],
+ med_mode_switch(theVal.myModeSwitch),
+ MED_ALL,
+ &aProfileName[0],
+ med_entite_maillage(aTimeStampInfo.myEntity),
+ med_geometrie_element(aGeom),
+ aTimeStampInfo.myNumDt,
+ aTimeStampInfo.myNumOrd);
+ if(aRet >= 0)
+ for(TInt anId = 0; anId < anEnd; anId++)
+ aValue[anId] = anArray[anId];
+ break;
+ }}
+
+ if(aRet < 0){
+ if(theErr){
+ *theErr = aRet;
+ return;
+ }
+ EXCEPTION(runtime_error,"GetTimeStampVal - MEDchampLire(...)");
+ }
+
+ MED::PProfileInfo aProfileInfo;
+ if(strcmp(&aProfileName[0],"") != 0){
+ MED::TKey2Profile::const_iterator anIter = aKey2Profile.find(&aProfileName[0]);
+ if(anIter != aKey2Profile.end()){
+ aProfileInfo = anIter->second;
+ theVal.myGeom2Profile[aGeom] = aProfileInfo;
+ }
+ }
+
+ if(aProfileInfo && aProfileInfo->IsPresent()){
+ TInt aSize = aProfileInfo->GetSize()*aFieldInfo.myNbComp*aNbGauss;
+ if(aSize > aValue.size()){
+ if(theErr){
+ *theErr = -1;
+ return;
+ }
+ EXCEPTION(runtime_error,
+ "GetTimeStampVal - aSize("<<aSize<<
+ ") > aValue.size()("<<aValue.size()<<
+ "); aNbVal = "<<aNbVal<<
+ "; anEntity = "<<aTimeStampInfo.myEntity<<
+ "; aGeom = "<<aGeom);
+ }else{
+ if(anEnd != aValue.size()){
+ if(theErr){
+ *theErr = -1;
+ return;
+ }
+ EXCEPTION(runtime_error,
+ "GetTimeStampVal - anEnd("<<anEnd<<
+ ") != aValue.size()("<<aValue.size()<<
+ "); aNbVal = "<<aNbVal<<
+ "; anEntity = "<<aTimeStampInfo.myEntity<<
+ "; aGeom = "<<aGeom);
+ }
+ }
+ }
+ }
+ }
+
+
+ void
+ TVWrapper
+ ::SetTimeStamp(const MED::TTimeStampVal& theVal,
+ EModeAcces theMode,
+ TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile,theMode,theErr);
+
+ if(theErr && *theErr < 0)
+ return;
+
+ TErr aRet;
+ TIdt anId = myFile->Id();
+
+ MED::TTimeStampVal& aVal = const_cast<MED::TTimeStampVal&>(theVal);
+ MED::TGeom2Profile& aGeom2Profile = aVal.myGeom2Profile;
+ MED::TTimeStampInfo& aTimeStampInfo = *aVal.myTimeStampInfo;
+ MED::TFieldInfo& aFieldInfo = *aTimeStampInfo.myFieldInfo;
+ MED::TMeshInfo& aMeshInfo = *aFieldInfo.myMeshInfo;
+ MED::TGeom2Value& aGeom2Value = aVal.myGeom2Value;
+
+ med_entite_maillage& anEntity = (med_entite_maillage&)(aTimeStampInfo.myEntity);
+ TGeom2Value::iterator anIter = aGeom2Value.begin();
+ for(; anIter != aGeom2Value.end(); anIter++){
+ EGeometrieElement aGeom = anIter->first;
+ TMeshValue& aMeshValue = anIter->second;
+
+ med_geometrie_element aMEDGeom = med_geometrie_element(aGeom);
+
+ MED::TProfileInfo& aProfileInfo = aGeom2Profile[aGeom];
+ med_int aNbGauss = aTimeStampInfo.GetNbGauss(aGeom);
+
+ med_int aNbVal = aMeshValue.myNbElem / aFieldInfo.myNbComp;
+ TValue& aValue = aMeshValue.myValue;
+ TInt anEnd = aValue.size();
+
+ switch(aFieldInfo.myType){
+ case eFLOAT64: {
+ TVector<TFloat>& anArray = aValue;
+
+ aRet = MEDchampEcr(anId,
+ &aMeshInfo.myName[0],
+ &aFieldInfo.myName[0],
+ (unsigned char*)&anArray[0],
+ med_mode_switch(theVal.myModeSwitch),
+ aNbVal,
+ aNbGauss,
+ MED_ALL,
+ &aProfileInfo.myName[0],
+ MED_ECRI,
+ anEntity,
+ aMEDGeom,
+ aTimeStampInfo.myNumDt,
+ &aTimeStampInfo.myUnitDt[0],
+ aTimeStampInfo.myDt,
+ aTimeStampInfo.myNumOrd);
+ break;
+ }
+ default: {
+ vector<TInt> anArray(anEnd);
+ for(TInt anID = 0; anID < anEnd; anID++)
+ anArray[anID] = TInt(aValue[anID]);
+
+ aRet = MEDchampEcr(anId,
+ &aMeshInfo.myName[0],
+ &aFieldInfo.myName[0],
+ (unsigned char*)&anArray[0],
+ med_mode_switch(theVal.myModeSwitch),
+ aNbVal,
+ aNbGauss,
+ MED_ALL,
+ &aProfileInfo.myName[0],
+ MED_ECRI,
+ anEntity,
+ aMEDGeom,
+ aTimeStampInfo.myNumDt,
+ &aTimeStampInfo.myUnitDt[0],
+ aTimeStampInfo.myDt,
+ aTimeStampInfo.myNumOrd);
+ break;
+ }}
+
+ if(aRet < 0){
+ if(theErr){
+ *theErr = aRet;
+ break;
+ }
+ EXCEPTION(runtime_error,"SetTimeStamp - MEDchampEcr(...)");
+ }
+
+ }
+
+ INITMSG(MYDEBUG,"TVWrapper::SetMeshInfo - MED_MODE_ACCES = "<<theMode<<"; aRet = "<<aRet<<endl);
+ }
+
+
+ void TVWrapper::SetTimeStamp(const MED::TTimeStampVal& theVal,
+ TErr* theErr)
+ {
+ TErr aRet;
+ SetTimeStamp(theVal,eECRI,&aRet);
+
+ if(aRet < 0)
+ SetTimeStamp(theVal,eREMP,theErr);
+ }
+
+ }
+}
--- /dev/null
+//
+//
+// Copyright (C) 2003 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.
+//
+// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File :
+// Author :
+// Module :
+// $Header$
+
+#ifndef MED_V2_1_Wrapper_HeaderFile
+#define MED_V2_1_Wrapper_HeaderFile
+
+#include "MED_TWrapper.hxx"
+
+namespace MED
+{
+ template<>
+ TInt
+ GetDESCLength<eV2_1>();
+
+ template<>
+ TInt
+ GetIDENTLength<eV2_1>();
+
+ template<>
+ TInt
+ GetNOMLength<eV2_1>();
+
+ template<>
+ TInt
+ GetLNOMLength<eV2_1>();
+
+ template<>
+ TInt
+ GetPNOMLength<eV2_1>();
+
+ template<>
+ TInt
+ GetNbConn<eV2_1>(EGeometrieElement typmai,
+ EEntiteMaillage typent,
+ TInt mdim);
+
+ namespace V2_1
+ {
+ typedef MED::TTMeshInfo<eV2_1> TVMeshInfo;
+
+ typedef MED::TTFamilyInfo<eV2_1> TVFamilyInfo;
+
+ typedef MED::TTNodeInfo<eV2_1> TVNodeInfo;
+
+ typedef MED::TTCellInfo<eV2_1> TVCellInfo;
+
+ typedef MED::TTFieldInfo<eV2_1> TVFieldInfo;
+
+ typedef MED::TTTimeStampInfo<eV2_1> TVTimeStampInfo;
+
+ typedef MED::TTTimeStampVal<eV2_1> TVTimeStampVal;
+
+ //---------------------------------------------------------------
+ class TFile;
+ typedef boost::shared_ptr<TFile> PFile;
+
+ typedef enum {eLECT, eECRI, eREMP} EModeAcces;
+
+ //---------------------------------------------------------------
+ class TVWrapper: public MED::TTWrapper<eV2_1>
+ {
+ 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
+ TInt
+ GetNbNodes(const MED::TMeshInfo& theMeshInfo,
+ 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
+ TEntityInfo
+ GetEntityInfo(const MED::TMeshInfo& theMeshInfo,
+ EConnectivite theConn = eNOD,
+ TErr* theErr = NULL);
+
+ virtual
+ TInt
+ GetNbCells(const MED::TMeshInfo& theMeshInfo,
+ EEntiteMaillage,
+ EGeometrieElement,
+ EConnectivite theConn = 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);
+
+
+ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ 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
+ GetNbProfiles(TErr* theErr = NULL);
+
+ virtual
+ TProfileInfo::TInfo
+ GetProfilePreInfo(TInt theId,
+ TErr* theErr = NULL);
+
+ virtual
+ void
+ GetProfileInfo(TInt theId,
+ TProfileInfo& theInfo,
+ 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
+ GetTimeStampVal(TTimeStampVal& theVal,
+ const TMKey2Profile& theMKey2Profile,
+ const TKey2Gauss& theKey2Gauss,
+ TErr* theErr = NULL);
+
+ virtual
+ void
+ SetTimeStamp(const MED::TTimeStampVal& theTimeStampVal,
+ TErr* theErr = NULL);
+
+ void
+ SetTimeStamp(const MED::TTimeStampVal& theTimeStampVal,
+ EModeAcces theMode,
+ TErr* theErr = NULL);
+
+ protected:
+ PFile myFile;
+ };
+ }
+}
+
+#endif
--- /dev/null
+#
+#
+# Copyright (C) 2003 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.
+#
+# 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+#
+#
+#
+# File :
+# Author :
+# Module :
+# $Header$
+
+top_srcdir=@top_srcdir@
+top_builddir=../../../..
+srcdir=@srcdir@
+VPATH=.:@srcdir@:@top_srcdir@/idl
+
+
+@COMMENCE@
+
+# Libraries targets
+
+LIB = libMEDWrapper_V2_1.la
+LIB_SRC = \
+ MED_V2_1_Wrapper.cxx
+
+EXPORT_HEADERS = \
+ MED_V2_1_Wrapper.hxx
+
+# Executables targets
+BIN =
+BIN_SRC =
+
+CPPFLAGS+= -D@MACHINE@ $(BOOST_CPPFLAGS) $(HDF5_INCLUDES)
+
+LDFLAGS+= $(HDF5_LIBS) -lMEDWrapperBase -lmed_V2_1
+
+LDFLAGSFORBIN=$(LDFLAGS)
+
+@CONCLUDE@
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/******************************************************************************
- * - Nom du fichier : mdump.c
- *
- * - Description : utilitaire de dump pour fichier MED V2.1
- *
- *****************************************************************************/
-#define NBR_MAILLE_EQU 7
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-#include "med.hxx"
-using namespace med_2_1;
-
-/*******************************************************************
- * DUMP D'UN FICHIER MED STRUCTURE EN GRILLE : *
- * NOEUDS, ELEMENTS, FAMILLES, EQUIVALENCES, CHAMPS DE RESULTATS *
- *******************************************************************/
-
-int grid_cartesian_or_polar(med_idt fid, int numero, med_mode_switch mode_coo) {
- med_int mdim, nnoe, nfam, i, j;
- char nommaa[MED_TAILLE_NOM+1];
- char nom_universel[MED_TAILLE_LNOM+1];
- med_float *coo;
- med_int *fam;
- char nomcoo[3*MED_TAILLE_PNOM+1];
- char unicoo[3*MED_TAILLE_PNOM+1];
- med_repere rep;
- char str[MED_TAILLE_PNOM+1];
-
- fprintf(stdout,"\n(****************************)\n");
- fprintf(stdout,"(* INFORMATIONS GENERALES : *)\n");
- fprintf(stdout,"(****************************)\n");
-
- /* lecture du nom et de la dimension de la grille */
- if (MEDmaaInfo(fid, numero, nommaa, &mdim) < 0) {
- fprintf(stderr, ">> ERREUR : lecture du nom de la grille\n");
- return(EXIT_FAILURE);
- };
- fprintf(stdout, "- Nom de la grille : <<%s>>\n", nommaa);
- fprintf(stdout, "- Dimension de la grille : %d\n", mdim);
-
- /* lecture du nom universel (presence optionnelle) */
- if (MEDunvLire(fid, nommaa, nom_universel) > 0) {
- fprintf(stdout, "- Nom universel de la grille : %s \n", nom_universel);
- } else {
- fprintf(stdout, "- Pas de nom universel \n");
- };
-
- /* nombre de familles */
- nfam = MEDnFam(fid, nommaa, 0, (med_dim_famille)0);
- if (nfam < 0) {
- fprintf(stderr, ">> ERREUR : lecture du nombre de familles\n");
- return(EXIT_FAILURE);
- };
- fprintf(stdout, "- Nombre de familles : %d \n", nfam);
-
- fprintf(stdout, "\n- Lecture des indices : \n");
- for (i=0; i<mdim; i++) {
- fprintf(stdout, "-- Lecture de l'indice : %d\n", i);
- nnoe = MEDnGrid(fid, nommaa, (med_grid)i);
- fprintf(stdout, "-- nombre d'indice : %d\n", nnoe);
- coo = (med_float*)malloc(sizeof(med_float)*nnoe);
-
- if (MEDgridLire(fid, nommaa, mdim, coo, i, mode_coo, &rep, nomcoo, unicoo) < 0) {
- fprintf(stderr, ">> ERREUR : lecture des indices \n");
- return(EXIT_FAILURE);
- };
-
- fprintf(stdout, "- Type de repere des coordonnees : %d \n", rep);
-
- fprintf(stdout, "- Nom des coordonnees : \n");
- for (j=0; j<mdim; j++) {
- strncpy(str, nomcoo+j*MED_TAILLE_PNOM, MED_TAILLE_PNOM);
- str[MED_TAILLE_PNOM] = '\0';
- fprintf(stdout, " %s ", str);
- };
-
- fprintf(stdout, "\n- Unites des coordonnees : \n");
- for (j=0; j<mdim; j++) {
- strncpy(str, unicoo+j*MED_TAILLE_PNOM, MED_TAILLE_PNOM);
- str[MED_TAILLE_PNOM] = '\0';
- fprintf(stdout, " %s ", str);
- };
-
- fprintf(stdout, "\n-- Coordonnees des indices : \n");
- for (j=0; j<nnoe; j++) {
- fprintf(stdout, " %f ", *(coo+j));
- };
-
- fprintf(stdout, "\n\n");
- free(coo);
- };
-
- nfam = MEDnGrid(fid, nommaa, (med_grid)-2);
- fprintf(stdout, "- Nombre de noeud pour les familles : %d\n", nfam);
- if (nfam > 0) {
- fam = (med_int*)malloc(sizeof(med_int)*nfam);
- if (MEDfamGridLire(fid, nommaa, fam, nfam,MED_NOEUD) < 0) {
- fprintf(stderr, ">> ERREUR : lecture des familles\n");
- return(EXIT_FAILURE);
- };
-
- fprintf(stdout, "\n- Numeros des familles des noeuds :\n");
- for (i=0; i<nfam; i++) {
- fprintf(stdout, " %d ", *(fam+i));
- };
- fprintf(stdout, "\n");
- free(fam);
- };
-
- return(0);
-}
-
-int grid_body_fitted(med_idt fid, int numero, med_mode_switch mode_coo) {
- med_int mdim, nnoe, nfam, i;
- char nommaa[MED_TAILLE_NOM+1];
- char nom_universel[MED_TAILLE_LNOM+1];
- char str[MED_TAILLE_PNOM+1];
- char nomcoo[3*MED_TAILLE_PNOM+1];
- char unicoo[3*MED_TAILLE_PNOM+1];
- med_float *coo;
- med_int *fam;
- med_repere rep;
-
- fprintf(stdout,"\n(****************************)\n");
- fprintf(stdout,"(* INFORMATIONS GENERALES : *)\n");
- fprintf(stdout,"(****************************)\n");
-
- /* lecture du nom et de la dimension du maillage */
- if (MEDmaaInfo(fid, numero, nommaa, &mdim) < 0) {
- fprintf(stderr, ">> ERREUR : lecture du nom du maillage body fitted\n");
- return(EXIT_FAILURE);
- };
- fprintf(stdout, "- Nom du maillage body fitted : <<%s>>\n", nommaa);
- fprintf(stdout, "- Dimension du maillage body fitted : %d\n", mdim);
-
- /* lecture du nom universel (presence optionnelle) */
- if (MEDunvLire(fid, nommaa, nom_universel) > 0) {
- fprintf(stdout, "- Nom universel du maillage body fitted : %s \n", nom_universel);
- } else {
- fprintf(stdout, "- Pas de nom universel \n");
- };
-
- /* Combien de noeuds ? */
- /* nnoe = MEDnGrid(fid, nommaa, -1);*/
- nnoe = MEDnGrid(fid, nommaa, MED_GRID_NOEUD);
- if (nnoe < 0) {
- fprintf(stderr, ">> ERREUR : lecture du nombre de noeuds (via MEDnGrid) \n");
- return(EXIT_FAILURE);
- };
- fprintf(stdout, "- Nombre de noeuds : %d \n", nnoe);
-
- /* Combien de noeuds dans la dimension 1 ? */
- i = MEDnGrid(fid, nommaa, (med_grid)0);
- if (i < 0) {
- fprintf(stderr, ">> ERREUR : lecture du nombre de noeuds (via MEDnGrid) dans la dimension 1 \n");
- return(EXIT_FAILURE);
- };
- fprintf(stdout, "- Nombre de noeuds dans la dimension 1 : %d \n", i);
-
- /* Combien de noeuds dans la dimension 2 ? */
- i = MEDnGrid(fid, nommaa, (med_grid)1);
- if (i < 0) {
- fprintf(stderr, ">> ERREUR : lecture du nombre de noeuds (via MEDnGrid) dans la dimension 2 \n");
- return(EXIT_FAILURE);
- };
- fprintf(stdout, "- Nombre de noeuds dans la dimension 2 : %d \n", i);
-
- /* nombre de familles */
- nfam = MEDnFam(fid, nommaa, 0,(med_dim_famille)0);
- if (nfam < 0) {
- fprintf(stderr, ">> ERREUR : lecture du nombre de familles \n");
- return(EXIT_FAILURE);
- };
- fprintf(stdout, "- Nombre de familles : %d \n", nfam);
-
- coo = (med_float*)malloc(sizeof(med_float)*nnoe*mdim);
- fam = (med_int*)malloc(sizeof(med_int)*nnoe);
-
- if (MEDbodyFittedLire(fid, nommaa, mdim, coo, mode_coo, &rep, nomcoo, unicoo, fam, nnoe) < 0) {
- fprintf(stderr, ">> ERREUR : lecture des noeuds \n");
- return(EXIT_FAILURE);
- };
-
- fprintf(stdout, "- Type de repere des coordonnees : %d \n", rep);
-
- fprintf(stdout, "- Nom des coordonnees : \n");
- for (i=0; i<mdim; i++) {
- strncpy(str, nomcoo+i*MED_TAILLE_PNOM, MED_TAILLE_PNOM);
- str[MED_TAILLE_PNOM] = '\0';
- fprintf(stdout, " %s ", str);
- };
-
- fprintf(stdout, "\n- Unites des coordonnees : \n");
- for (i=0; i<mdim; i++) {
- strncpy(str, unicoo+i*MED_TAILLE_PNOM, MED_TAILLE_PNOM);
- str[MED_TAILLE_PNOM] = '\0';
- fprintf(stdout, " %s ", str);
- };
-
- fprintf(stdout, "\n- Coordonnees des noeuds : \n");
- for (i=0; i<nnoe*mdim; i++) {
- fprintf(stdout, " %f ", *(coo+i));
- };
-
- fprintf(stdout, "\n- Numeros des familles des noeuds : \n");
- for (i=0; i<nnoe; i++) {
- fprintf(stdout, " %d ", *(fam+i));
- };
- fprintf(stdout, "\n");
-
- if (nnoe) {
- free(coo);
- free(fam);
- };
- return(0);
-}
-
-int grid(med_idt fid, int numero, med_grid_type theType, med_mode_switch mode_coo) {
- switch (theType) {
- case MED_CARTESIAN : {
- fprintf(stdout, "- Type de la grille : MED_CARTESIAN\n");
- return(grid_cartesian_or_polar(fid, numero, mode_coo));
- };
- case MED_POLAR : {
- fprintf(stdout, "- Type de la grille : MED_POLAR\n");
- return(grid_cartesian_or_polar(fid, numero, mode_coo));
- };
- case MED_BODY_FITTED : {
- fprintf(stdout, "- Type de la grille : MED_BODY_FITTED\n");
- return(grid_body_fitted(fid, numero, mode_coo));
- };
- default : {
- fprintf(stderr, ">> ERREUR : type de maillage inconnu\n");
- return(EXIT_FAILURE);
- };
- };
-}
-
-/******************************************************************************
- * DUMP D'UN FICHIER MED : NOEUDS,
- * ELEMENTS, FAMILLES, EQUIVALENCES, CHAMPS DE RESULTATS
- *****************************************************************************/
-
-int main (int argc, char **argv)
-{
- med_err ret = 0;
- med_idt fid;
- int i,j,k,l,kp;
- int numero;
- char message[200];
- /* nombre d'objets MED */
- char nom_universel[MED_TAILLE_LNOM+1];
- med_int long_fichier_en_tete;
- char *fichier_en_tete;
- char version_hdf[10];
- char version_med[10];
- med_int nmaa,mdim,nnoe;
- med_int nmai[MED_NBR_GEOMETRIE_MAILLE],nfac[MED_NBR_GEOMETRIE_FACE];
- med_int nare[MED_NBR_GEOMETRIE_ARETE];
- /* nom du maillage */
- char nommaa[MED_TAILLE_NOM+1];
- /* noeuds */
- med_float *coo;
- char nomcoo[3*MED_TAILLE_PNOM+1];
- char unicoo[3*MED_TAILLE_PNOM+1];
- char *nomnoe;
- med_int *numnoe;
- med_int *nufano;
- med_repere rep;
- med_booleen inonoe,inunoe;
- med_mode_switch mode_coo;
- char str[MED_TAILLE_PNOM+1];
- /* elements */
- med_int nsup;
- med_int edim;
- med_int taille;
- med_int *connectivite;
- char *nomele;
- med_int *numele;
- med_int *nufael;
- med_booleen inoele, inuele;
- med_connectivite typ_con;
- med_geometrie_element typgeo;
- med_geometrie_element typmai[MED_NBR_GEOMETRIE_MAILLE] = {MED_POINT1,MED_SEG2,
- MED_SEG3,MED_TRIA3,
- MED_TRIA6,MED_QUAD4,
- MED_QUAD8,MED_TETRA4,
- MED_TETRA10,MED_HEXA8,
- MED_HEXA20,MED_PENTA6,
- MED_PENTA15,MED_PYRA5,
- MED_PYRA13};
- med_int desmai[MED_NBR_GEOMETRIE_MAILLE] = {0,2,3,3,3,4,4,4,4,6,6,5,5,5,5};
- med_int nmailles[MED_NBR_GEOMETRIE_MAILLE];
- char nommai[MED_NBR_GEOMETRIE_MAILLE] [MED_TAILLE_NOM+1] = {"MED_POINT1",
- "MED_SEG2",
- "MED_SEG3",
- "MED_TRIA3",
- "MED_TRIA6",
- "MED_QUAD4",
- "MED_QUAD8",
- "MED_TETRA4",
- "MED_TETRA10",
- "MED_HEXA8",
- "MED_HEXA20",
- "MED_PENTA6",
- "MED_PENTA15",
- "MED_PYRA5",
- "MED_PYRA13"};
- med_geometrie_element typfac[MED_NBR_GEOMETRIE_FACE] = {MED_TRIA3,MED_TRIA6,
- MED_QUAD4,MED_QUAD8};
- med_int desfac[MED_NBR_GEOMETRIE_FACE] = {3,3,4,4};
- med_int nfaces[MED_NBR_GEOMETRIE_FACE];
- char nomfac[MED_NBR_GEOMETRIE_FACE][MED_TAILLE_NOM+1] = {"MED_TRIA3","MED_TRIA6",
- "MED_QUAD4","MED_QUAD8"};
- med_geometrie_element typare[MED_NBR_GEOMETRIE_ARETE] = {MED_SEG2,MED_SEG3};
- med_int desare[MED_NBR_GEOMETRIE_ARETE] = {2,3};
- med_int naretes[MED_NBR_GEOMETRIE_ARETE];
- char nomare[MED_NBR_GEOMETRIE_ARETE] [MED_TAILLE_NOM+1] = {"MED_SEG2","MED_SEG3"};
- /* familles */
- med_int nfam;
- med_int natt,ngro;
- char *attdes,*gro;
- med_int *attval,*attide;
- char nomfam[MED_TAILLE_NOM+1];
- med_int numfam;
- char str1[MED_TAILLE_DESC+1];
- char str2[MED_TAILLE_LNOM+1];
- /* equivalences */
- med_int nequ,ncor;
- med_int *cor;
- char equ[MED_TAILLE_NOM+1];
- char des[MED_TAILLE_DESC+1];
- /* champs de resultats */
- char *comp;
- char *unit;
- char nomcha[MED_TAILLE_NOM+1];
- char maillage_champ[MED_TAILLE_NOM+1];
- med_int ncomp;
- med_float *valr;
- med_int *vale;
- med_type_champ typcha;
- med_int ncha;
- med_int nval;
- int reponse;
- int lecture_en_tete_seulement = 0;
- med_int npdt;
- med_int ngauss,numdt,numo;
- med_float dt;
- char dtunit[MED_TAILLE_PNOM+1];
- char pflnom[MED_TAILLE_NOM+1];
- med_int pflsize;
- med_int *pflval;
- med_int isGrid;
- med_grid_type theType;
-
- /****************************************************************************
- * TEST DU NOMBRE D'ARGUMENTS *
- * argument 1 = nom du fichier MED *
- ****************************************************************************/
- if (argc != 2 && argc != 5)
- {
- fprintf(stderr,">> ERREUR : nombre de parametres incorrects \n");
- exit(EXIT_FAILURE);
- }
-
- /****************************************************************************
- * OUVERTURE DU FICHIER EN LECTURE *
- ****************************************************************************/
- fid = MEDouvrir(argv[1],MED_LECT);
- if (fid < 0)
- {
- fprintf(stderr,">> ERREUR : ouverture du fichier %s \n",argv[1]);
- exit(EXIT_FAILURE);
- }
-
-
- /****************************************************************************
- * QUESTIONS PRELIMINAIRES *
- * 1. Mode d'affichage des coordonnees (entrelace ou non) ? *
- * 2. Connectivite des elements (nodale ou descendante) *
- ****************************************************************************/
- fprintf(stdout,"\n >>>>>> DUMP DU FICHIER %s >>>>>>\n",argv[1]);
-
- /* en-tete du fichier (presence optionnelle) */
- long_fichier_en_tete = MEDlFichDes(fid);
- if (long_fichier_en_tete > 0)
- {
- fichier_en_tete = (char *) malloc(sizeof(char)*(long_fichier_en_tete+1));
- ret = MEDfichEntete(fid,MED_FICH_DES,fichier_en_tete);
- if (ret < 0)
- {
- fprintf(stderr,">> ERREUR : lecture de l'en-tete du fichier \n");
- exit(EXIT_FAILURE);
- }
- fprintf(stdout,"- En-tete du fichier : %s \n",fichier_en_tete);
- free(fichier_en_tete);
- }
- /* versions hdf et med */
- ret = MEDfichEntete(fid,MED_HDF_VERSION,version_hdf);
- if (ret < 0)
- {
- fprintf(stderr,">> ERREUR : lecture du numero de version de HDF \n");
- exit(EXIT_FAILURE);
- }
- ret = MEDfichEntete(fid,MED_VERSION,version_med);
- if (ret < 0)
- {
- fprintf(stderr,">> ERREUR : lecture du numero de version de MED \n");
- exit(EXIT_FAILURE);
- }
- fprintf(stdout,"- Version de HDF utilisee : %s \n",version_hdf);
- fprintf(stdout,"- Version de MED utilisee : %s \n",version_med);
-
- if (argc == 2)
- {
- fprintf(stdout,"(*****************)\n");
- fprintf(stdout,"(* PARAMETRAGE : *)\n");
- fprintf(stdout,"(*****************)\n");
- fprintf(stdout,"- Mode d'affichage des coordonnées des noeuds ? \n");
- fprintf(stdout," 1. Mode entrelacé : taper 1 \n");
- fprintf(stdout," 2. Mode non entrelacé : taper 2 \n");
- reponse = 0;
- do
- {
- fprintf(stdout," Reponse : ");
- scanf("%d",&reponse);
- }
- while (reponse != 1 && reponse != 2);
- if (reponse == 1)
- mode_coo = MED_FULL_INTERLACE;
- else
- mode_coo = MED_NO_INTERLACE;
-
- fprintf(stdout,"- Connectivité des éléments ? \n");
- fprintf(stdout," 1. Nodale : taper 1 \n");
- fprintf(stdout," 2. Descendante : taper 2 \n");
- reponse = 0;
- do
- {
- fprintf(stdout," Reponse : ");
- scanf("%d",&reponse);
- }
- while (reponse != 1 && reponse != 2);
- if (reponse == 1)
- typ_con = MED_NOD;
- else
- typ_con = MED_DESC;
- }
- else
- {
- if (! strcmp(argv[3],"NODALE"))
- typ_con = MED_NOD;
- if (! strcmp(argv[3],"DESCENDANTE"))
- typ_con = MED_DESC;
-
- if (!strcmp(argv[4],"NO_INTERLACE"))
- mode_coo = MED_NO_INTERLACE;
- if (!strcmp(argv[4],"FULL_INTERLACE"))
- mode_coo = MED_FULL_INTERLACE;
- if (! strcmp(argv[4],"LECTURE_EN_TETE_SEULEMENT"))
- lecture_en_tete_seulement = 1;
-
- }
-
- /****************************************************************************
- * QUEL MAILLAGE LIRE *
- ****************************************************************************/
- nmaa = MEDnMaa(fid);
- if (nmaa < 0)
- {
- fprintf(stderr,">> ERREUR : lecture du nombre de maillages \n");
- exit(EXIT_FAILURE);
- }
-
- /* Quel maillage lire ? */
- if (argc == 2)
- {
- fprintf(stdout,"- Il y a %d maillages dans ce fichier \n",nmaa);
- fprintf(stdout," Lequel voulez-vous lire (1|2|3|...|n) ?\n");
- do
- {
- fprintf(stdout," Reponse : ");
- scanf("%d",&numero);
- }
- while (numero > nmaa || numero <= 0);
- }
- else
- {
- numero = atoi(argv[2]);
- if (numero > nmaa || numero <= 0)
- {
- fprintf(stderr,">> ERREUR : il y a %d maillages dans ce fichier \n",
- nmaa);
- exit(EXIT_FAILURE);
- }
- }
-
-/*****************************************************************************
- * QUELLE SORTE DE MAILLAGE : GRILLE OU PAS *
- *****************************************************************************/
-
- fprintf(stdout,"\n(**************************************************)\n");
- fprintf(stdout,"(* MAILLAGE STRUCTURE (GRILLE) OU NON STRUCTURE : *)\n");
- fprintf(stdout,"(**************************************************)\n");
-
- /* lecture de la sorte de maillage : structure ou pas */
- ret = MEDgridInfo(fid, numero, &isGrid, &theType);
- if (ret < 0) {
- fprintf(stderr, ">> ERREUR : lecture de la sorte de maillage (structure ou pas)\n");
- exit(EXIT_FAILURE);
- };
- fprintf(stdout, "- Sorte de maillage : %s\n", isGrid? "structure (grille)": "non structure");
- if (isGrid) {
- ret = grid(fid, numero, theType, mode_coo);
- if (ret == 0) {
- ret = MEDfermer(fid);
- if (ret == 0) {
- fprintf(stdout, "\n >>>>>> FIN DU DUMP DU FICHIER %s >>>>>>\n", argv[1]);
- } else {
- fprintf(stderr, ">> ERREUR : erreur a la fermeture du fichier %s\n", argv[1]);
- };
- };
- if (ret == 0) {
- return(0);
- } else {
- exit(EXIT_FAILURE);
- };
- };
-
- /****************************************************************************
- * NOMBRES D'OBJETS MED *
- ****************************************************************************/
- fprintf(stdout,"\n(****************************)\n");
- fprintf(stdout,"(* INFORMATIONS GENERALES : *)\n");
- fprintf(stdout,"(****************************)\n");
-
- /* lecture du nom et de la dimension du maillage */
- ret = MEDmaaInfo(fid,numero,nommaa,&mdim);
- if (ret < 0)
- {
- fprintf(stderr,">> ERREUR : lecture du nom du maillage \n");
- exit(EXIT_FAILURE);
- }
- fprintf(stdout,"- Nom du maillage : <<%s>>\n",nommaa);
- fprintf(stdout,"- Dimension du maillage : %d\n",mdim);
-
- /* lecture du nom universel (presence optionnelle) */
- ret = MEDunvLire(fid,nommaa,nom_universel);
- if (ret > 0)
- fprintf(stdout,"- Nom universel du maillage : %s \n",nom_universel);
- else
- fprintf(stdout,"- Pas de nom universel \n");
-
-
- /* Combien de noeuds ? */
- nnoe = MEDnEntMaa(fid,nommaa,MED_COOR,MED_NOEUD,(med_geometrie_element)0,(med_connectivite)0);
- if (nnoe < 0)
- {
- fprintf(stderr,">> ERREUR : lecture du nombre de noeuds (via MEDnEntMaa) \n");
- exit(EXIT_FAILURE);
- }
- fprintf(stdout,"- Nombre de noeuds : %d \n",nnoe);
-
- /* Combien de mailles, faces ou aretes ? */
- for (i=0;i<MED_NBR_GEOMETRIE_MAILLE;i++)
- {
- nmailles[i] = MEDnEntMaa(fid,nommaa,MED_CONN,MED_MAILLE,typmai[i],
- typ_con);
- if (nmailles[i] < 0)
- {
- fprintf(stderr,">> ERREUR : lecture du nombre de mailles \n");
- exit(EXIT_FAILURE);
- }
- fprintf (stdout,"- Nombre de mailles de type %s : %d \n",nommai[i],nmailles[i]);
- }
-
- for (i=0;i<MED_NBR_GEOMETRIE_FACE;i++)
- {
- nfaces[i] = MEDnEntMaa(fid,nommaa,MED_CONN,MED_FACE,typfac[i],
- typ_con);
- if (nfaces[i] < 0)
- {
- fprintf(stderr,">> ERREUR : lecture du nombre de faces \n");
- exit(EXIT_FAILURE);
- }
- fprintf (stdout,"- Nombre de faces de type %s : %d \n",nomfac[i],nfaces[i]);
- }
-
- for (i=0;i<MED_NBR_GEOMETRIE_ARETE;i++)
- {
- naretes[i] = MEDnEntMaa(fid,nommaa,MED_CONN,MED_ARETE,typare[i],
- typ_con);
- if (naretes[i] < 0)
- {
- fprintf(stderr,">> ERREUR : lecture du nombre d'aretes \n");
- exit(EXIT_FAILURE);
- }
- fprintf (stdout,"- Nombre d'aretes de type %s : %d \n",nomare[i],naretes[i]);
- }
-
- /* nombre de familles */
- nfam = MEDnFam(fid,nommaa,0,(med_dim_famille)0);
- if (nfam < 0)
- {
- fprintf(stderr,">> ERREUR : lecture du nombre de familles \n");
- exit(EXIT_FAILURE);
- }
- fprintf(stdout,"- Nombre de familles : %d \n",nfam);
-
- /* combien d'equivalences dans le fichier */
- nequ = MEDnEquiv(fid,nommaa);
- if (nequ < 0)
- {
- fprintf(stderr,">> ERREUR : lecture du nombre d'equivalences \n");
- exit(EXIT_FAILURE);
- }
- fprintf(stdout,"- Nombre d'equivalences : %d \n",nequ);
-
- /* combien de champs dans le fichier */
- ncha = MEDnChamp(fid,0);
- if (ncha < 0)
- {
- fprintf(stderr,">> ERREUR : lecture du nombre de champs \n");
- exit(EXIT_FAILURE);
- }
- fprintf(stdout,"- Nombre de champs : %d \n",ncha);
-
- /* Doit-on s'arreter ? */
- if (lecture_en_tete_seulement)
- {
- ret = MEDfermer(fid);
- if (ret == 0)
- {
- fprintf(stdout,"\n >>>>>> FIN DU DUMP DU FICHIER %s >>>>>>\n",argv[1]);
- return 0;
- }
- else
- {
- fprintf(stderr,">> ERREUR : fermeture du fichier %s \n",argv[1]);
- exit(EXIT_FAILURE);
- }
- }
-
- /****************************************************************************
- * LECTURE DES NOEUDS *
- ****************************************************************************/
- fprintf(stdout,"\n(************************)\n");
- fprintf(stdout,"(* NOEUDS DU MAILLAGE : *)\n");
- fprintf(stdout,"(************************)\n");
-
- /* Allocations memoires */
- /* table des coordonnees
- profil : (dimension * nombre de noeuds ) */
- coo = (med_float*) malloc(sizeof(med_float)*nnoe*mdim);
- /* table des numeros, des numeros de familles des noeuds
- profil : (nombre de noeuds) */
- numnoe = (med_int*) malloc(sizeof(med_int)*nnoe);
- nufano = (med_int*) malloc(sizeof(med_int)*nnoe);
- /* table des noms des noeuds
- profil : (nnoe*MED_TAILLE_PNOM+1) */
- nomnoe = (char*) malloc(MED_TAILLE_PNOM*nnoe+1);
-
- /* lecture des noeuds :
- - coordonnees
- - noms (optionnel dans un fichier MED)
- - numeros (optionnel dans un fichier MED)
- - numeros des familles */
- ret = MEDnoeudsLire(fid,nommaa,mdim,coo,mode_coo,&rep,
- nomcoo,unicoo,nomnoe,&inonoe,numnoe,&inunoe,
- nufano,nnoe);
- if (ret < 0)
- strcpy(message,">> ERREUR : lecture des noeuds \n");
-
- /* affichage des resultats */
- if (ret == 0)
- {
- fprintf(stdout,"- Type de repere des coordonnees : %d \n",rep);
- fprintf(stdout,"- Nom des coordonnees : \n");
- for (i=0;i<mdim;i++)
- {
- strncpy(str,nomcoo+i*MED_TAILLE_PNOM,MED_TAILLE_PNOM);
- str[MED_TAILLE_PNOM] = '\0';
- fprintf(stdout," %s ",str);
- }
- fprintf(stdout,"\n- Unites des coordonnees : \n");
- for (i=0;i<mdim;i++)
- {
- strncpy(str,unicoo+i*MED_TAILLE_PNOM,MED_TAILLE_PNOM);
- str[MED_TAILLE_PNOM] = '\0';
- fprintf(stdout," %s ",str);
- }
- fprintf(stdout,"\n- Coordonnees des noeuds : \n");
- for (i=0;i<nnoe*mdim;i++)
- fprintf(stdout," %f ",*(coo+i));
- if (inonoe)
- {
- fprintf(stdout,"\n- Noms des noeuds : \n");
- for (i=0;i<nnoe;i++)
- {
- strncpy(str,nomnoe+i*MED_TAILLE_PNOM,MED_TAILLE_PNOM);
- str[MED_TAILLE_PNOM] = '\0';
- fprintf(stdout," %s ",str);
- }
- }
- if (inunoe)
- {
- fprintf(stdout,"\n- Numeros des noeuds : \n");
- for (i=0;i<nnoe;i++)
- fprintf(stdout," %d ",*(numnoe+i));
- }
- fprintf(stdout,"\n- Numeros des familles des noeuds : \n");
- for (i=0;i<nnoe;i++)
- fprintf(stdout," %d ",*(nufano+i));
- fprintf(stdout,"\n");
- }
-
- /* liberation memoire */
- free(coo);
- free(nomnoe);
- free(numnoe);
- free(nufano);
-
- /****************************************************************************
- * LECTURE DES ELEMENTS *
- ****************************************************************************/
- fprintf(stdout,"\n(**************************)\n");
- fprintf(stdout,"(* ELEMENTS DU MAILLAGE : *)\n");
- fprintf(stdout,"(**************************)");
- /* Lecture des connectivites, noms, numeros des mailles */
- if (ret == 0)
- for (i=0;i<MED_NBR_GEOMETRIE_MAILLE;i++)
- {
- if (nmailles[i] > 0 && ret == 0)
- {
- /* dimension de la maille */
- edim = typmai[i] / 100;
- nsup = 0;
- if (mdim == 2 || mdim == 3)
- if (edim == 1)
- nsup = 1;
- if (mdim == 3)
- if (edim == 2)
- nsup = 1;
- switch(typ_con)
- {
- case MED_NOD :
- taille = nsup+typmai[i]%100;
- break;
-
- case MED_DESC :
- taille = nsup+desmai[i];
- break;
-
- default :
- ret = -1;
- }
-
- /* allocation memoire */
- connectivite = (med_int*)malloc(sizeof(med_int)*
- taille*nmailles[i]);
- nomele = (char*)malloc(sizeof(char)*MED_TAILLE_PNOM*
- nmailles[i]+1);
- numele = (med_int*)malloc(sizeof(med_int)*
- nmailles[i]);
- nufael = (med_int*)malloc(sizeof(med_int)*
- nmailles[i]);
-
- /* lecture des données */
- ret = MEDelementsLire(fid,nommaa,mdim,connectivite,mode_coo,
- nomele,&inoele,numele,&inuele,nufael,
- nmailles[i],MED_MAILLE,typmai[i],
- typ_con);
- if (ret < 0)
- strcpy(message,">> ERREUR : lecture des mailles \n");
-
- /* affichage des resultats */
- if (ret == 0)
- {
- fprintf(stdout,"\n\n- Mailles de type %s : ", nommai[i]);
- fprintf(stdout,"\n - Connectivité : \n");
- for (j=0;j<nmailles[i]*taille;j++)
- fprintf(stdout," %d ",*(connectivite+j));
- if (inoele)
- {
- fprintf(stdout,"\n - Noms : \n");
- for (j=0;j<nmailles[i];j++)
- {
- fprintf(stdout," %d ",*(connectivite+j));
- strncpy(str,nomele+j*MED_TAILLE_PNOM,MED_TAILLE_PNOM);
- str[MED_TAILLE_PNOM] = '\0';
- fprintf(stdout," %s ",str);
- }
- }
- if (inuele)
- {
- fprintf(stdout,"\n - Numeros :\n");
- for (j=0;j<nmailles[i];j++)
- fprintf(stdout," %d ",*(numele+j));
- }
- fprintf(stdout,"\n - Numéros de familles : \n");
- for (j=0;j<nmailles[i];j++)
- fprintf(stdout," %d ",*(nufael+j));
- }
-
- /* liberation memoire */
- free(connectivite);
- free(nomele);
- free(numele);
- free(nufael);
- }
- }
-
- if (ret == 0)
- for (i=0;i<MED_NBR_GEOMETRIE_FACE;i++)
- {
- if (nfaces[i] > 0 && ret == 0)
- {
- /* dimension de la face */
- edim = typfac[i] / 100;
- nsup = 0;
- if (mdim == 2 || mdim == 3)
- if (edim == 1)
- nsup = 1;
- if (mdim == 3)
- if (edim == 2)
- nsup = 1;
- switch(typ_con)
- {
- case MED_NOD :
- taille = nsup+typfac[i]%100;
- break;
-
- case MED_DESC :
- taille = nsup+desfac[i];
- break;
-
- default :
- ret = -1;
- }
-
- /* allocation memoire */
- connectivite = (med_int*)malloc(sizeof(med_int)*
- taille*nfaces[i]);
- nomele = (char*)malloc(sizeof(char)*MED_TAILLE_PNOM*
- nfaces[i]+1);
- numele = (med_int*)malloc(sizeof(med_int)*
- nfaces[i]);
- nufael = (med_int*)malloc(sizeof(med_int)*
- nfaces[i]);
-
- /* lecture des données */
- ret = MEDelementsLire(fid,nommaa,mdim,connectivite,mode_coo,
- nomele,&inoele,numele,&inuele,nufael,
- nfaces[i],MED_FACE,typfac[i],
- typ_con);
- if (ret < 0)
- strcpy(message,">> ERREUR : lecture des faces \n");
-
- /* affichage des resultats */
- if (ret == 0)
- {
- fprintf(stdout,"\n- Faces de type %s : ", nomfac[i]);
- fprintf(stdout,"\n - Connectivité : \n");
- for (j=0;j<nfaces[i]*taille;j++)
- fprintf(stdout," %d ",*(connectivite+j));
- if (inoele)
- {
- fprintf(stdout,"\n - Noms : \n");
- for (j=0;j<nfaces[i];j++)
- {
- fprintf(stdout," %d ",*(connectivite+j));
- strncpy(str,nomele+j*MED_TAILLE_PNOM,MED_TAILLE_PNOM);
- str[MED_TAILLE_PNOM] = '\0';
- fprintf(stdout," %s ",str);
- }
- }
- if (inuele)
- {
- fprintf(stdout,"\n - Numeros :\n");
- for (j=0;j<nfaces[i];j++)
- fprintf(stdout," %d ",*(numele+j));
- }
- fprintf(stdout,"\n - Numéros de familles : \n");
- for (j=0;j<nfaces[i];j++)
- fprintf(stdout," %d ",*(nufael+j));
- }
-
- /* liberation memoire */
- free(connectivite);
- free(nomele);
- free(numele);
- free(nufael);
- }
- }
-
- if (ret == 0)
- for (i=0;i<MED_NBR_GEOMETRIE_ARETE;i++)
- {
- if (naretes[i] > 0 && ret == 0)
- {
- /* dimension de l'arete */
- edim = typare[i] / 100;
- nsup = 0;
- if (mdim == 2 || mdim == 3)
- if (edim == 1)
- nsup = 1;
- if (mdim == 3)
- if (edim == 2)
- nsup = 1;
- switch(typ_con)
- {
- case MED_NOD :
- taille = nsup+typare[i]%100;
- break;
-
- case MED_DESC :
- taille = nsup+desare[i];
- break;
-
- default :
- ret = -1;
- }
-
- /* allocation memoire */
- connectivite = (med_int*)malloc(sizeof(med_int)*
- taille*naretes[i]);
- nomele = (char*)malloc(sizeof(char)*MED_TAILLE_PNOM*
- naretes[i]+1);
- numele = (med_int*)malloc(sizeof(med_int)*
- naretes[i]);
- nufael = (med_int*)malloc(sizeof(med_int)*
- naretes[i]);
-
- /* lecture des données */
- ret = MEDelementsLire(fid,nommaa,mdim,connectivite,mode_coo,
- nomele,&inoele,numele,&inuele,nufael,
- naretes[i],MED_ARETE,typare[i],
- typ_con);
- if (ret < 0)
- strcpy(message,">> ERREUR : lecture des aretes \n");
-
- /* affichage des resultats */
- if (ret == 0)
- {
- fprintf(stdout,"\n- Aretes de type %d : ", nomare[i]);
- fprintf(stdout,"\n - Connectivité : \n");
- for (j=0;j<naretes[i]*taille;j++)
- fprintf(stdout," %d ",*(connectivite+j));
- if (inoele)
- {
- fprintf(stdout,"\n - Noms : \n");
- for (j=0;j<naretes[i];j++)
- {
- fprintf(stdout," %d ",*(connectivite+j));
- strncpy(str,nomele+j*MED_TAILLE_PNOM,MED_TAILLE_PNOM);
- str[MED_TAILLE_PNOM] = '\0';
- fprintf(stdout," %s ",str);
- }
- }
- if (inuele)
- {
- fprintf(stdout,"\n - Numeros :\n");
- for (j=0;j<naretes[i];j++)
- fprintf(stdout," %d ",*(numele+j));
- }
- fprintf(stdout,"\n - Numéros de familles : \n");
- for (j=0;j<naretes[i];j++)
- fprintf(stdout," %d ",*(nufael+j));
- }
-
- /* liberation memoire */
- free(connectivite);
- free(nomele);
- free(numele);
- free(nufael);
- }
- }
-
- /****************************************************************************
- * LECTURE DES FAMILLES *
- ****************************************************************************/
- printf("\n(*************************)\n");
- printf("(* FAMILLES DU MAILLAGE : *)\n");
- printf("(*************************)\n");
- if (ret == 0)
- for (i=0;i<nfam;i++)
- {
-
- /* nombre de groupes */
- ngro = MEDnFam(fid,nommaa,i+1,MED_GROUPE);
- if (ngro < 0)
- {
- ret = -1;
- strcpy(message,
- ">> ERREUR : lecture du nombre de groupes d'une famille \n");
- }
-
- /* nombre d'attributs */
- if (ret == 0)
- {
- natt = MEDnFam(fid,nommaa,i+1,MED_ATTR);
- if (natt < 0)
- {
- ret = -1;
- strcpy(message,
- ">> ERREUR : lecture du nombre d'attributs d'une famille\n");
- }
- }
-
- if (ret == 0)
- fprintf(stdout,"- Famille %d a %d attributs et %d groupes \n",i+1,natt,ngro);
-
- /* nom,numero,attributs,groupes */
- if (ret == 0)
- {
- attide = (med_int*) malloc(sizeof(med_int)*natt);
- attval = (med_int*) malloc(sizeof(med_int)*natt);
- attdes = (char *) malloc(MED_TAILLE_DESC*natt+1);
- gro = (char*) malloc(MED_TAILLE_LNOM*ngro+1);
- ret = MEDfamInfo(fid,nommaa,i+1,nomfam,&numfam,attide,attval,
- attdes,&natt,gro,&ngro);
- fprintf(stdout," - Famille de nom %s et de numero %d : \n",nomfam,numfam);
- fprintf(stdout," - Attributs : \n");
- for (j=0;j<natt;j++)
- {
- strncpy(str1,attdes+j*MED_TAILLE_DESC,MED_TAILLE_DESC);
- str1[MED_TAILLE_DESC] = '\0';
- fprintf(stdout," ide = %d - val = %d - des = %s\n",*(attide+j),
- *(attval+j),str1);
- }
- free(attide);
- free(attval);
- free(attdes);
- fprintf(stdout," - Groupes :\n");
- for (j=0;j<ngro;j++)
- {
- strncpy(str2,gro+j*MED_TAILLE_LNOM,MED_TAILLE_LNOM);
- str2[MED_TAILLE_LNOM] = '\0';
- fprintf(stdout," gro = %s\n",str2);
- }
- free(gro);
- }
- }
-
- /****************************************************************************
- * LECTURE DES EQUIVALENCES *
- ****************************************************************************/
- fprintf(stdout,"\n(******************************)\n");
- fprintf(stdout,"(* EQUIVALENCES DU MAILLAGE : *)\n");
- fprintf(stdout,"(******************************)\n");
-
- /* lecture de toutes les equivalences associes a nommaa */
- if (ret == 0)
- for (i = 0;i<nequ;i++)
- {
- fprintf(stdout,"- Equivalence numero : %d ",i+1);
-
- /* lecture des infos sur l'equivalence */
- ret = MEDequivInfo(fid,nommaa,i+1,equ,des);
- if (ret == 0)
- {
- fprintf(stdout,"\n - Nom de l'equivalence: %s \n",equ);
- fprintf(stdout,"\n - Description de l'equivalence : %s \n",des);
- }
- else
- strcpy(message,">> ERREUR : lecture informations sur equivalence\n");
-
- /* lecture des correspondances sur les differents types d'entites */
- if (ret == 0)
- {
- /* les noeuds */
- if ((ncor = MEDnCorres(fid,nommaa,equ,MED_NOEUD,(med_geometrie_element)0)) < 0)
- {
- ret = -1;
- strcpy(message,">> ERREUR : lecture nombre de correspondances\n");
- }
- else
- fprintf(stdout,"\n - Il y a %d correspondances sur les noeuds \n",ncor);
- if (ncor > 0)
- {
- cor = (med_int*) malloc(sizeof(med_int)*ncor*2);
- ret = MEDequivLire(fid,nommaa,equ,cor,ncor,MED_NOEUD,(med_geometrie_element)0);
- if (ret == 0)
- for (j=0;j<ncor;j++)
- fprintf(stdout,"\n - Correspondance %d : %d et %d \n",j+1,*(cor+2*j),
- *(cor+2*j+1));
- else
- strcpy(message,">> ERREUR : lecture des correspondances\n");
- free(cor);
- }
-
- /* sur les mailles : on ne prend pas en compte les mailles 3D */
- if (ret ==0)
- for (j=0;j<NBR_MAILLE_EQU;j++)
- {
- if ((ncor = MEDnCorres(fid,nommaa,equ,MED_MAILLE,typmai[j])) < 0)
- {
- ret = -1;
- strcpy(message,
- ">> ERREUR : lecture informations sur nombre de correspondances \n");
- }
- else
- fprintf(stdout,"\n - Il y a %d correspondances sur les mailles %s \n",ncor,
- nommai[j]);
- if (ncor > 0)
- {
- cor = (med_int*) malloc(sizeof(med_int)*ncor*2);
- ret = MEDequivLire(fid,nommaa,equ,cor,ncor,MED_MAILLE,
- typmai[j]);
- if (ret == 0)
- for (k=0;k<ncor;k++)
- fprintf(stdout,"\n - Correspondance %d : %d et %d \n",k+1,*(cor+2*k),
- *(cor+2*k+1));
- else
- strcpy(message,">> ERREUR : correspondances\n");
- free(cor);
- }
- }
-
- /* sur les faces */
- if (ret == 0)
- for (j=0;j<MED_NBR_GEOMETRIE_FACE;j++)
- {
- if ((ncor = MEDnCorres(fid,nommaa,equ,MED_FACE,typfac[j])) < 0)
- {
- ret = -1;
- strcpy(message,">> ERREUR : informations sur correspondances \n");
- }
- else
- fprintf(stdout,"\n - Il y a %d correspondances sur les faces %s\n",ncor,
- nomfac[j]);
- if (ncor > 0)
- {
- cor = (med_int*) malloc(sizeof(med_int)*ncor*2);
- ret = MEDequivLire(fid,nommaa,equ,cor,ncor,MED_FACE,
- typfac[j]);
- if (ret < 0)
- strcpy(message,"ERREUR : lecture des equivalences \n");
- else
- for (k=0;k<ncor;k++)
- fprintf(stdout,"\n - Correspondance %d : %d et %d \n",k+1,*(cor+2*k),
- *(cor+2*k+1));
- free(cor);
- }
- }
-
- /* sur les aretes */
- for (j=0;j<MED_NBR_GEOMETRIE_ARETE;j++)
- {
- if ((ncor = MEDnCorres(fid,nommaa,equ,MED_ARETE,typare[j])) < 0)
- {
- ret = -1;
- strcpy(message,">> ERREUR : nombre de correspondances \n");
- }
- else
- fprintf(stdout,"\n - Il y a %d correspondances sur les aretes %s \n",
- ncor,nomare[j]);
- if (ncor > 0)
- {
- cor = (med_int*) malloc(sizeof(med_int)*ncor*2);
- ret = MEDequivLire(fid,nommaa,equ,cor,ncor,MED_ARETE,
- typare[j]);
- if (ret < 0)
- strcpy(message,">> ERREUR : equivalences \n");
- else
- for (k=0;k<ncor;k++)
- fprintf(stdout,"\n Correspondance %d : %d et %d \n",k+1,*(cor+2*k),
- *(cor+2*k+1));
- free(cor);
- }
- }
- }
- }
-
- /****************************************************************************
- * LECTURE DES CHAMPS *
- ****************************************************************************/
- fprintf(stdout,"\n(************************)\n");
- fprintf(stdout,"(* CHAMPS DU MAILLAGE : *)\n");
- fprintf(stdout,"(************************)\n");
-
- if (ret == 0)
- for (i=0;i<ncha;i++)
- {
- fprintf(stdout,"- Champ numero : %d \n",i+1);
-
- /* combien de composantes */
- if ((ncomp = MEDnChamp(fid,i+1)) < 0)
- {
- ret = -1;
- strcpy(message,">> ERREUR : nombre de composants d'un champ\n");
- }
-
- /* allocation memoire de comp et unit*/
- if (ret == 0)
- {
- comp = (char*) malloc(ncomp*MED_TAILLE_PNOM+1);
- unit = (char*) malloc(ncomp*MED_TAILLE_PNOM+1);
- }
-
- /* infos sur les champs */
- if (ret == 0)
- ret = MEDchampInfo(fid,i+1,nomcha,&typcha,comp,unit,ncomp);
- if (ret < 0)
- strcpy(message,">> ERREUR : information sur les champs \n");
-
- if (ret == 0) {
- fprintf(stdout," - Nom du champ : %s de type %d\n",nomcha,typcha);
- fprintf(stdout," - Nom des composantes : %s\n",comp);
- fprintf(stdout," - Unites des composantes : %s \n",unit);
- free(comp);
- free(unit);
- }
-
-
- if (ret == 0) /* Valeurs sur les noeuds */
- {
- /* Combien de pas de temps ? */
- npdt = MEDnPasdetemps(fid,nomcha,MED_NOEUD,(med_geometrie_element)0);
- if (npdt < 0)
- ret = -1;
- if (ret == -1)
- strcpy(message,">> ERREUR : la lecture du nombe de pas de temps");
- else
- fprintf(stdout,"\n - Il y a %d pas de temps sur les noeuds \n",npdt);
-
- /* Lecture des valeurs pour tous les pas de temps */
- if (ret == 0)
- for (j=0;j<npdt;j++)
- {
- /* Informations sur les pas de temps */
- if (ret == 0)
- ret = MEDpasdetempsInfo(fid,nomcha,MED_NOEUD,(med_geometrie_element)0,
- j+1, maillage_champ, &ngauss, &numdt, dtunit, &dt, &numo);
-
- if (ret == 0 && (! strcmp(maillage_champ,nommaa)))
- fprintf(stdout,"\n -> \tPas de Temps n° %4i (%f), N°d'ordre %4i, avec %i pts de gauss\n",
- numdt,dt,numo,ngauss);
- else
- strcpy(message,">> ERREUR : information sur les pas de temps \n");
-
- /* Combien de valeurs a lire ? */
- if (ret == 0 && (! strcmp(maillage_champ,nommaa)))
- {
- if ((nval = MEDnVal(fid,nomcha,MED_NOEUD,(med_geometrie_element)0,numdt,numo)) < 0)
- {
- ret = -1;
- strcpy(message,">> ERREUR : nombre de valeurs d'un champ\n");
- }
- else
- fprintf(stdout,"\n - Il y a %d valeurs sur les noeuds \n",nval);
- }
-
- if (ret == 0 && (! strcmp(maillage_champ,nommaa)))
- {
- if (typcha == MED_REEL64)
- {
- valr = (med_float*) malloc(sizeof(med_float)*ncomp*nval);
- ret = MEDchampLire(fid,nommaa,nomcha,(unsigned char*)valr,mode_coo,MED_ALL,
- pflnom,MED_NOEUD,(med_geometrie_element)0,numdt,numo);
-
- if (ret < 0)
- strcpy(message,">> ERREUR : lecture des champs \n");
- else
- for (k=0;k<nval*ncomp;k++)
- fprintf(stdout," %f ",*(valr+k));
- free(valr);
- }
- else
- {
- vale = (med_int*) malloc(sizeof(med_int)*ncomp*nval);
- ret = MEDchampLire(fid,nommaa,nomcha,(unsigned char*)vale,mode_coo,MED_ALL,
- pflnom,MED_NOEUD,(med_geometrie_element)0,numdt,numo);
- if (ret < 0)
- strcpy(message,">> ERREUR : lecture des champs \n");
- else
- for (k=0;k<nval*ncomp;k++)
- fprintf(stdout," %d ",*(vale+k));
- free(vale);
- }
-
- /* Lecture d'un profil eventuel */
- if (strcmp(pflnom,MED_NOPFL) == 0 )
- fprintf(stdout,"\n \t- Pas de profil\n");
- else
- {
- if ( (pflsize = MEDnValProfil(fid,pflnom)) <0)
- {
- ret = -1;
- strcpy(message,">> ERREUR : lecture de la taille du profil \n");
- }
- else
- {
- fprintf(stdout,"\n \t- Profil : %s de taille %i\n",pflnom,pflsize);
- pflval = (med_int*) malloc(sizeof(med_int)*pflsize);
-
- if ( (ret = MEDprofilLire(fid,pflval,pflnom)) <0)
- strcpy(message,">> ERREUR : lecture du profil \n");
- else
- for (l=0;l<pflsize;l++)
- fprintf(stdout,"\t%i\n",*(pflval+l));
-
- free(pflval);
- }
- }
- }
- }
- }
-
-
- if (ret == 0) /* Valeurs sur les mailles */
- {
- for (k=0;k<MED_NBR_GEOMETRIE_MAILLE;k++)
- {
- typgeo = typmai[k];
-
- /* Combien de pas de temps ? */
- npdt = MEDnPasdetemps(fid,nomcha,MED_MAILLE,typgeo);
- if (npdt < 0)
- ret = -1;
- if (ret == -1)
- strcpy(message,">> ERREUR : la lecture du nombe de pas de temps");
- else
- fprintf(stdout,"\n - Il y a %d pas de temps sur les mailles de type %d \n",npdt,typgeo);
-
- /* Lecture des valeurs pour tous les pas de temps */
- if (ret == 0)
- for (j=0;j<npdt;j++)
- {
- /* Informations sur les pas de temps */
- if (ret == 0)
- ret = MEDpasdetempsInfo(fid,nomcha,MED_MAILLE,typgeo,
- j+1, maillage_champ, &ngauss, &numdt, dtunit, &dt, &numo);
-
- if (ret == 0 && (! strcmp(maillage_champ,nommaa)))
- fprintf(stdout,"\n -> \tPas de Temps n° %4i (%f), N°d'ordre %4i, avec %i pts de gauss\n",
- numdt,dt,numo,ngauss);
- else
- strcpy(message,">> ERREUR : information sur les pas de temps \n");
-
- /* Combien de valeurs a lire ? */
- if (ret == 0 && (! strcmp(maillage_champ,nommaa)))
- {
- if ((nval = MEDnVal(fid,nomcha,MED_MAILLE,typgeo,numdt,numo)) < 0)
- {
- ret = -1;
- strcpy(message,">> ERREUR : nombre de valeurs d'un champ\n");
- }
- else
- fprintf(stdout,"\n - Il y a %d valeurs sur les noeuds \n",nval);
- }
-
- if (ret == 0 && (! strcmp(maillage_champ,nommaa)))
- {
- if (typcha == MED_REEL64)
- {
- valr = (med_float*) malloc(sizeof(med_float)*ncomp*nval);
- ret = MEDchampLire(fid,nommaa,nomcha,(unsigned char*)valr,mode_coo,MED_ALL,
- pflnom,MED_MAILLE,typgeo,numdt,numo);
- if (ret < 0)
- strcpy(message,">> ERREUR : lecture des champs \n");
- else
- for (kp=0;kp<nval*ncomp;kp++)
- fprintf(stdout," %f ",*(valr+kp));
- free(valr);
- }
- else
- {
- vale = (med_int*) malloc(sizeof(med_int)*ncomp*nval);
- ret = MEDchampLire(fid,nommaa,nomcha,(unsigned char*)vale,mode_coo,MED_ALL,
- pflnom,MED_MAILLE,typgeo,numdt,numo);
- if (ret < 0)
- strcpy(message,">> ERREUR : lecture des champs \n");
- else
- for (kp=0;kp<nval*ncomp;kp++)
- fprintf(stdout," %d ",*(vale+kp));
- free(vale);
- }
-
- /* Lecture d'un profil eventuel */
- if (strcmp(pflnom,MED_NOPFL) == 0 )
- fprintf(stdout,"\n \t- Pas de profil\n");
- else
- {
- if ( (pflsize = MEDnValProfil(fid,pflnom)) <0)
- {
- ret = -1;
- strcpy(message,">> ERREUR : lecture de la taille du profil \n");
- }
- else
- {
- fprintf(stdout,"\n \t- Profil : %s de taille %i\n",pflnom,pflsize);
- pflval = (med_int*) malloc(sizeof(med_int)*pflsize);
-
- if ( (ret = MEDprofilLire(fid,pflval,pflnom)) <0)
- strcpy(message,">> ERREUR : lecture du profil \n");
- else
- for (l=0;l<pflsize;l++)
- fprintf(stdout,"\t%i\n",*(pflval+l));
-
- free(pflval);
- }
- }
- }
- }
- }
- }
-
-
- if (ret == 0) /* Valeurs sur les faces */
- {
- for (k=0;k<MED_NBR_GEOMETRIE_FACE;k++)
- {
- typgeo = typfac[k];
-
- /* Combien de pas de temps ? */
- npdt = MEDnPasdetemps(fid,nomcha,MED_FACE,typgeo);
- if (npdt < 0)
- ret = -1;
- if (ret == -1)
- strcpy(message,">> ERREUR : la lecture du nombe de pas de temps");
- else
- fprintf(stdout,"\n - Il y a %d pas de temps sur les faces de type %d \n",npdt,typgeo);
-
- /* Lecture des valeurs pour tous les pas de temps */
- if (ret == 0)
- for (j=0;j<npdt;j++)
- {
- /* Informations sur les pas de temps */
- if (ret == 0)
- ret = MEDpasdetempsInfo(fid,nomcha,MED_FACE,typgeo,
- j+1, maillage_champ, &ngauss, &numdt, dtunit, &dt, &numo);
-
- if (ret == 0 && (! strcmp(maillage_champ,nommaa)))
- fprintf(stdout,"\n -> \tPas de Temps n° %4i (%f), N°d'ordre %4i, avec %i pts de gauss\n",
- numdt,dt,numo,ngauss);
- else
- strcpy(message,">> ERREUR : information sur les pas de temps \n");
-
- /* Combien de valeurs a lire ? */
- if (ret == 0 && (! strcmp(maillage_champ,nommaa)))
- {
- if ((nval = MEDnVal(fid,nomcha,MED_FACE,typgeo,numdt,numo)) < 0)
- {
- ret = -1;
- strcpy(message,">> ERREUR : nombre de valeurs d'un champ\n");
- }
- else
- fprintf(stdout,"\n - Il y a %d valeurs sur les noeuds \n",nval);
- }
-
- if (ret == 0 && (! strcmp(maillage_champ,nommaa)))
- {
- if (typcha == MED_REEL64)
- {
- valr = (med_float*) malloc(sizeof(med_float)*ncomp*nval);
- ret = MEDchampLire(fid,nommaa,nomcha,(unsigned char*)valr,mode_coo,MED_ALL,
- pflnom,MED_FACE,typgeo,numdt,numo);
- if (ret < 0)
- strcpy(message,">> ERREUR : lecture des champs \n");
- else
- for (kp=0;kp<nval*ncomp;kp++)
- fprintf(stdout," %f ",*(valr+kp));
- free(valr);
- }
- else
- {
- vale = (med_int*) malloc(sizeof(med_int)*ncomp*nval);
- ret = MEDchampLire(fid,nommaa,nomcha,(unsigned char*)vale,mode_coo,MED_ALL,
- pflnom,MED_FACE,typgeo,numdt,numo);
- if (ret < 0)
- strcpy(message,">> ERREUR : lecture des champs \n");
- else
- for (kp=0;kp<nval*ncomp;kp++)
- fprintf(stdout," %d ",*(vale+kp));
- free(vale);
- }
-
- /* Lecture d'un profil eventuel */
- if (strcmp(pflnom,MED_NOPFL) == 0 )
- fprintf(stdout,"\n \t- Pas de profil\n");
- else
- {
- if ( (pflsize = MEDnValProfil(fid,pflnom)) <0)
- {
- ret = -1;
- strcpy(message,">> ERREUR : lecture de la taille du profil \n");
- }
- else
- {
- fprintf(stdout,"\n \t- Profil : %s de taille %i\n",pflnom,pflsize);
- pflval = (med_int*) malloc(sizeof(med_int)*pflsize);
-
- if ( (ret = MEDprofilLire(fid,pflval,pflnom)) <0)
- strcpy(message,">> ERREUR : lecture du profil \n");
- else
- for (l=0;l<pflsize;l++)
- fprintf(stdout,"\t%i\n",*(pflval+l));
-
- free(pflval);
- }
- }
- }
- }
- }
- }
-
-
- if (ret == 0) /* Valeurs sur les aretes */
- {
- for (k=0;k<MED_NBR_GEOMETRIE_ARETE;k++)
- {
- typgeo = typare[k];
-
- /* Combien de pas de temps ? */
- npdt = MEDnPasdetemps(fid,nomcha,MED_ARETE,typgeo);
- if (npdt < 0)
- ret = -1;
- if (ret == -1)
- strcpy(message,">> ERREUR : la lecture du nombe de pas de temps");
- else
- fprintf(stdout,"\n - Il y a %d pas de temps sur les aretes de type %d \n",npdt,typgeo);
-
- /* Lecture des valeurs pour tous les pas de temps */
- if (ret == 0)
- for (j=0;j<npdt;j++)
- {
- /* Informations sur les pas de temps */
- if (ret == 0)
- ret = MEDpasdetempsInfo(fid,nomcha,MED_ARETE,typgeo,
- j+1, maillage_champ, &ngauss, &numdt, dtunit, &dt, &numo);
-
- if (ret == 0 && (! strcmp(maillage_champ,nommaa)))
- fprintf(stdout,"\n -> \tPas de Temps n° %4i (%f), N°d'ordre %4i, avec %i pts de gauss\n",
- numdt,dt,numo,ngauss);
- else
- strcpy(message,">> ERREUR : information sur les pas de temps \n");
-
- /* Combien de valeurs a lire ? */
- if (ret == 0 && (! strcmp(maillage_champ,nommaa)))
- {
- if ((nval = MEDnVal(fid,nomcha,MED_ARETE,typgeo,numdt,numo)) < 0)
- {
- ret = -1;
- strcpy(message,">> ERREUR : nombre de valeurs d'un champ\n");
- }
- else
- fprintf(stdout,"\n - Il y a %d valeurs sur les noeuds \n",nval);
- }
-
- if (ret == 0 && (! strcmp(maillage_champ,nommaa)))
- {
- if (typcha == MED_REEL64)
- {
- valr = (med_float*) malloc(sizeof(med_float)*ncomp*nval);
- ret = MEDchampLire(fid,nommaa,nomcha,(unsigned char*)valr,mode_coo,MED_ALL,
- pflnom,MED_ARETE,typgeo,numdt,numo);
- if (ret < 0)
- strcpy(message,">> ERREUR : lecture des champs \n");
- else
- for (kp=0;kp<nval*ncomp;kp++)
- fprintf(stdout," %f ",*(valr+kp));
- free(valr);
- }
- else
- {
- vale = (med_int*) malloc(sizeof(med_int)*ncomp*nval);
- ret = MEDchampLire(fid,nommaa,nomcha,(unsigned char*)vale,mode_coo,MED_ALL,
- pflnom,MED_ARETE,typgeo,numdt,numo);
- if (ret < 0)
- strcpy(message,">> ERREUR : lecture des champs \n");
- else
- for (kp=0;kp<nval*ncomp;kp++)
- fprintf(stdout," %d ",*(vale+kp));
- free(vale);
- }
-
- /* Lecture d'un profil eventuel */
- if (strcmp(pflnom,MED_NOPFL) == 0 )
- fprintf(stdout,"\n \t- Pas de profil\n");
- else
- {
- if ( (pflsize = MEDnValProfil(fid,pflnom)) <0)
- {
- ret = -1;
- strcpy(message,">> ERREUR : lecture de la taille du profil \n");
- }
- else
- {
- fprintf(stdout,"\n \t- Profil : %s de taille %i\n",pflnom,pflsize);
- pflval = (med_int*) malloc(sizeof(med_int)*pflsize);
-
- if ( (ret = MEDprofilLire(fid,pflval,pflnom)) <0)
- strcpy(message,">> ERREUR : lecture du profil \n");
- else
- for (l=0;l<pflsize;l++)
- fprintf(stdout,"\t%i\n",*(pflval+l));
-
- free(pflval);
- }
- }
- }
- }
- }
- }
-
- }
-
- if (ret < 0)
- fprintf(stderr,"%s\n",message);
-
- /****************************************************************************
- * FERMETURE DU FICHIER *
- ****************************************************************************/
- ret = MEDfermer(fid);
-
- if (ret == 0)
- fprintf(stdout,"\n >>>>>> FIN DU DUMP DU FICHIER %s >>>>>>\n",argv[1]);
- else
- fprintf(stderr,">> ERREUR : erreur a la fermeture du fichier %s\n",argv[1]);
-
- return 0;
-}
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2003 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#ifndef MED_H
-#define MED_H
-
-extern "C"{
-#include <hdf5.h>
-}
-
-namespace med_2_1{
-
-#define MED_NULL (void *) NULL
-#define MED_MAX_PARA 20
-
-#define MED_TAILLE_DESC 200
-#define MED_TAILLE_IDENT 8
-#define MED_TAILLE_NOM 32
-#define MED_TAILLE_LNOM 80
-#define MED_TAILLE_PNOM 8
-
-/* Integration des developpements OCC */
-typedef enum {MED_CARTESIAN, MED_POLAR, MED_BODY_FITTED} med_grid_type;
-
-typedef enum {MED_GRID_D1=0, MED_GRID_D2=1, MED_GRID_D3=2,
- MED_GRID_NOEUD=3,
- MED_FAM_NOEUD=4, MED_FAM_ARETE=5, MED_FAM_FACE=6, MED_FAM_MAILLE=7 } med_grid;
-
-/* Fin de l'integration*/
-
-typedef enum {MED_FULL_INTERLACE,
- MED_NO_INTERLACE} med_mode_switch;
-
-typedef enum {MED_GLOBALE,
- MED_COMPACT } med_mode_profil;
-
-typedef enum {MED_LECT,MED_ECRI,MED_REMP} med_mode_acces;
-
-typedef enum {MED_MAILLE, MED_FACE, MED_ARETE, MED_NOEUD} med_entite_maillage;
-
-typedef enum {MED_COOR, MED_CONN, MED_NOM, MED_NUM, MED_FAM} med_table;
-
-typedef enum {MED_REEL64=6, MED_INT32=24,MED_INT64=26, MED_INT} med_type_champ;
-
-#define MED_NBR_GEOMETRIE_MAILLE 15
-#define MED_NBR_GEOMETRIE_FACE 4
-#define MED_NBR_GEOMETRIE_ARETE 2
-typedef enum {MED_POINT1=1, MED_SEG2=102, MED_SEG3=103, MED_TRIA3=203,
- MED_QUAD4=204, MED_TRIA6=206,MED_QUAD8=208, MED_TETRA4=304,
- MED_PYRA5=305, MED_PENTA6=306, MED_HEXA8=308, MED_TETRA10=310,
- MED_PYRA13=313, MED_PENTA15=315, MED_HEXA20=320}
-med_geometrie_element;
-
-typedef enum {MED_NOD, MED_DESC} med_connectivite ;
-
-typedef enum {MED_CART, MED_CYL, MED_SPHER} med_repere;
-
-typedef enum {MED_FAUX, MED_VRAI} med_booleen ;
-
-typedef enum {MED_GROUPE, MED_ATTR, MED_FAMILLE} med_dim_famille;
-
-typedef enum {MED_COMP, MED_DTYPE} med_dim_champ;
-
-typedef enum {MED_HDF_VERSION, MED_VERSION, MED_FICH_DES} med_fich_info;
-
-#define MED_NOPG 1 /* -> pas de point de Gauss */
-#define MED_NOPFL "" /* -> pas de profils utilisateur */
-#define MED_NOPFLi " " /* Variable Interne */
-#define MED_NOPF 0 /* -> pas de profils pour _MEDdataseNnumEcrire */
-#define MED_NOPDT -1 /* rem: pas de pas de temps negatifs */
-#define MED_NONOR -1 /* rem: pas de n°ordre negatif */
-#define MED_DIM1 1 /* PAS */
-#define MED_ALL 0
-
-#if defined(SUN4SOL2) || defined(PCLINUX) || defined(OSF1_32) || defined(IRIX64_32) || defined(RS6000)
-/* interface C/FORTRAN */
-/* this true only with g77 and gcc : we must change it to use directly NOMF_... and INT32 or INT64 -
- it will be more simple to understand and to use ! */
-#define NOMF_POST_UNDERSCORE
-
-/* correspondance des types avec HDF 5 */
-typedef hsize_t med_size;
-typedef hssize_t med_ssize;
-typedef hid_t med_idt;
-typedef herr_t med_err;
-
-/* types elementaires */
-typedef int med_int;
-typedef double med_float;
-#endif
-
-#if defined(HP9000)
-/* correspondance des types avec HDF 5 */
-typedef hsize_t med_size;
-typedef hssize_t med_ssize;
-typedef hid_t med_idt;
-typedef herr_t med_err;
-
-/* types elementaires */
-typedef int med_int;
-typedef double med_float;
-#endif
-
-#if defined(IRIX64) || defined(OSF1)
-#define NOMF_POST_UNDERSCORE
-
-/* correspondance des types avec HDF 5 */
-typedef hsize_t med_size;
-typedef hssize_t med_ssize;
-typedef hid_t med_idt;
-typedef herr_t med_err;
-
-/* types elementaires */
-typedef long med_int;
-typedef double med_float;
-#endif
-
-
-#if defined(PPRO_NT)
-/* correspondance des types avec HDF 5 */
-typedef hsize_t med_size;
-typedef hssize_t med_ssize;
-typedef hid_t med_idt;
-typedef herr_t med_err;
-
-/* types elementaires */
-typedef int med_int;
-typedef double med_float;
-#endif
-
-
-#if defined(NOMF_PRE_UNDERSCORE) && defined(NOMF_POST_UNDERSCORE)
-# define NOMF(x) _##x##_
-#endif
-#if defined(NOMF_PRE_UNDERSCORE) && !defined(NOMF_POST_UNDERSCORE)
-# define NOMF(x) _##x
-#endif
-#if !defined(NOMF_PRE_UNDERSCORE) && defined(NOMF_POST_UNDERSCORE)
-# define NOMF(x) x##_
-#endif
-#if !defined(NOMF_PRE_UNDERSCORE) && !defined(NOMF_POST_UNDERSCORE)
-# define NOMF(x) x
-#endif
-
-}
-
-#include "med_proto.hxx"
-
-#endif /* MED_H */
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#ifndef MED_HDFI_H
-#define MED_HDFI_H
-#include "med.hxx"
-
-/* FONCTIONS INTERFACE MED/HDF */
-namespace med_2_1{
-
-/* Gestion des fichiers HDF */
-extern
-med_idt _MEDfichierCreer(char *nom);
-
-extern
-med_idt _MEDfichierOuvrir(char *nom,med_mode_acces mode);
-
-extern
-med_err _MEDfichierFermer(med_idt fid);
-
-
-/* Gestion des datagroups HDF */
-extern
-med_idt _MEDdatagroupCreer(med_idt pid, char *nom);
-
-extern
-med_idt _MEDdatagroupOuvrir(med_idt pid, char *nom);
-
-extern
-med_err _MEDdatagroupFermer(med_idt id);
-
-
-/* Gestion des datasets HDF */
-
-extern
-med_idt _MEDdatasetOuvrir(med_idt pid,char *nom);
-
-extern
-med_err _MEDdatasetFermer(med_idt id);
-
-extern
-med_err _MEDdatasetNumEcrire (med_idt pere,char *nom, med_type_champ type,
- med_mode_switch interlace, med_size nbdim, med_size fixdim,
- med_size psize, med_ssize * profil, med_int ngauss,
- med_size *size, unsigned char *val, med_mode_acces mode);
-
-
-extern
-med_err _MEDdatasetNumLire(med_idt pere,char *nom,med_type_champ type,
- med_mode_switch interlace, med_size nbdim, med_size fixdim,
- med_size psize, med_ssize * pfltab, med_int ngauss,
- unsigned char *val);
-
-extern
-med_err _MEDdatasetStringEcrire(med_idt pere,char *nom,med_size *dimd,
- char *val, med_mode_acces mode);
-
-extern
-med_err _MEDdatasetStringLire(med_idt pere,char *nom,char *val);
-
-/* Gestion des attributs HDF */
-extern
-med_idt _MEDattrOuvrir(med_idt pid,char * nom);
-
-extern
-med_err _MEDattrFermer(med_idt id);
-
-extern
-med_err _MEDattrNumEcrire(med_idt pere,med_type_champ type,char *nom,unsigned char *val,med_mode_acces mode);
-
-#define _MEDattrEntierEcrire(w,x,y,z) _MEDattrNumEcrire(w,MED_INT ,x,(unsigned char *) y,z)
-#define _MEDattrFloatEcrire(w,x,y,z) _MEDattrNumEcrire(w,MED_REEL64,x,(unsigned char *) y,z)
-
-extern
-med_err _MEDattrNumLire(med_idt pere,med_type_champ type,char *nom,unsigned char *val);
-
-#define _MEDattrEntierLire(x,y,z) _MEDattrNumLire(x,MED_INT ,y,(unsigned char*)z)
-#define _MEDattrFloatLire(x,y,z) _MEDattrNumLire(x,MED_REEL64,y,(unsigned char*)z)
-
-extern
-med_err _MEDattrStringEcrire(med_idt pere,char *nom,int longueur,char *val,med_mode_acces mode);
-
-extern
-med_err _MEDattrStringLire(med_idt pere,char *nom,int longueur,char *val);
-
-
-/* Divers */
-extern
-med_err _MEDindiceInfo(med_idt id, const char *nom, void *donnees);
-
-extern
-med_err _MEDindiceNum(med_idt id,const char *nom, void *donnees);
-
-extern
-med_err _MEDobjetIdentifier(med_idt fid,char *chemin,int indice,void *nom);
-
-extern
-med_err _MEDnObjets(med_idt fid,char *chemin,int *n);
-
-extern
-void _MEDmodeErreurVerrouiller();
-
-}
-
-#endif /* MED_HDFI_H */
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#ifndef MED_MISC_H
-#define MED_MISC_H
-#include "med.hxx"
-
-
-/* CHAINES DE CARACTERES FORTRAN => C */
-namespace med_2_1{
-
-extern
-char *_MED1cstring(char *chaine,int longueur_reelle,int longueur_fixee);
-
-extern
-char *_MED2cstring(char *chaine, int longueur);
-
-extern
-med_err _MEDcstringFree(char *chaine);
-
-extern
-med_err _MEDfstring(char *chaine, med_int longueur_fixee);
-
-/* Noms associes aux objets MED */
-extern
-med_err _MEDnomEntite(char *nom_ent,med_entite_maillage type_ent);
-
-extern
-med_err _MEDnomGeometrie(char *nom_geo,med_geometrie_element type_geo);
-
-extern
-med_err _MEDparametresGeometrie(med_entite_maillage type_ent,
- med_geometrie_element type_geo, int *dim, int *nnoe,
- int *ndes);
-extern
-med_err _MEDnomDataset(char *nom_dataset,med_table quoi,
- med_connectivite type_conn);
-
-/* Geometrie des objets MED */
-extern
-med_err _MEDGeometrieElement(med_geometrie_element typ_geo[],
- med_entite_maillage typ_ent);
-
-}
-
-#endif /* MED_MISC_H */
-
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2003 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#ifndef MED_OUTILS_H
-#define MED_OUTILS_H
-#include "med.hxx"
-
-#define MED_NOM_MAJEUR "MAJ"
-#define MED_NOM_MINEUR "MIN"
-#define MED_NOM_RELEASE "REL"
-
-#define MED_NUM_MAJEUR 2
-#define MED_NUM_MINEUR 1
-#define MED_NUM_RELEASE 6
-
-#define MED_NOM_INFOS "INFOS_GENERALES"
-
-#define MED_NOM_DESCRIPTEUR "descripteur de fichier"
-#define MED_VERSION_ACTUELLE "2.1.6"
-#define HDF_VERSION_ACTUELLE "5-1.4.4"
-
-/* Noms des data sets ou attributs correspondant a des entites MED */
-#define MED_TAILLE_NOM_ENTITE 3
-#define MED_NOM_NUM "NUM"
-#define MED_NOM_NBR "NBR"
-#define MED_NOM_NOM "NOM"
-#define MED_NOM_UNV "UNV"
-#define MED_NOM_NNS "NNS"
-#define MED_NOM_NNM "NNM"
-#define MED_NOM_NNI "NNI"
-#define MED_NOM_GRO "GRO"
-#define MED_NOM_ATT "ATT"
-#define MED_NOM_NCO "NCO"
-#define MED_NOM_DIM "DIM"
-#define MED_NOM_FAM "FAM"
-#define MED_NOM_IDE "IDE"
-#define MED_NOM_VAL "VAL"
-#define MED_NOM_DES "DES"
-#define MED_NOM_COR "COR"
-#define MED_NOM_DIM "DIM"
-#define MED_NOM_NOE "NOE"
-#define MED_NOM_COO "COO"
-#define MED_NOM_REP "REP"
-#define MED_NOM_UNI "UNI"
-#define MED_NOM_NOD "NOD"
-#define MED_NOM_TYP "TYP"
-#define MED_NOM_CO "CO"
-#define MED_NOM_NCW "NCW"
-#define MED_NOM_TYW "TYW"
-#define MED_NOM_MAI "MAI"
-#define MED_NOM_FAC "FAC"
-#define MED_NOM_ARE "ARE"
-#define MED_NOM_PO1 "PO1"
-#define MED_NOM_SE2 "SE2"
-#define MED_NOM_SE3 "SE3"
-#define MED_NOM_TR3 "TR3"
-#define MED_NOM_TR6 "TR6"
-#define MED_NOM_QU4 "QU4"
-#define MED_NOM_QU8 "QU8"
-#define MED_NOM_TE4 "TE4"
-#define MED_NOM_T10 "T10"
-#define MED_NOM_HE8 "HE8"
-#define MED_NOM_H20 "H20"
-#define MED_NOM_PE6 "PE6"
-#define MED_NOM_P15 "P15"
-#define MED_NOM_PY5 "PY5"
-#define MED_NOM_P13 "P13"
-
-#define MED_NOM_GEO "GEO"
-#define MED_NOM_GAU "GAU"
-#define MED_NOM_NGA "NGA"
-#define MED_NOM_N "N"
-#define MED_NOM_PFL "PFL"
-#define MED_NOM_NDT "NDT"
-#define MED_NOM_PDT "PDT"
-#define MED_NOM_NOR "NOR"
-
-/* Integration des developpements OCC */
-#define MED_NOM_GRD "GRD"
-#define MED_NOM_BOF "BOF"
-#define MED_NOM_IN1 "IN1"
-#define MED_NOM_IN2 "IN2"
-#define MED_NOM_IN3 "IN3"
-
-/* Nom du DATA GROUP CONTENANT TOUS LES MAILLAGES DU FICHIER HDF */
-#define MED_MAA "/ENS_MAA/"
-#define MED_TAILLE_MAA 9
-
-/* Nom du data group ou ranger les champs solution */
-#define MED_CHA "/CHA/"
-#define MED_TAILLE_CHA 5
-
-/* Nom du data group ou ranger les familles */
-#define MED_FAS "/FAS/"
-#define MED_TAILLE_FAS 5
-
-/* Nom du data group ou ranger les equivalences */
-#define MED_EQS "/EQS/"
-#define MED_TAILLE_EQS 5
-
-/* Nom du data groupe contenant les profils */
-#define MED_PROFILS "/PROFILS/"
-#define MED_TAILLE_PROFILS 9
-
-/*Pour eviter le bug solaris*/
-#include <malloc.h>
-
-/* Interface des routines du composant tools */
-#include "med_misc.hxx"
-#include "med_hdfi.hxx"
-#include "med_utils.hxx"
-#endif /* MED_OUTILS_H */
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-#ifndef MED_PROTO_H
-#define MED_PROTO_H
-
-/* Interface de l'API MED */
-namespace med_2_1{
-/* Fichier */
-extern med_idt
-MEDouvrir(char *nom, med_mode_acces mode_acces);
-extern med_err
-MEDfermer(med_idt fid);
-extern med_int
-MEDlFichDes(med_idt fid);
-extern med_err
-MEDfichEntete(med_idt fid, med_fich_info quoi, char str[]);
-extern med_err
-MEDfichDesEcr(med_idt fid, char *des, med_mode_acces mode);
-extern med_err
-MEDunvCr(med_idt fid, char *maa);
-extern med_err
-MEDunvLire(med_idt fid, char *maa,char *nomu);
-extern med_err
-MEDformatConforme(const char * nomfich);
-extern med_err
-MEDversionConforme(const char *nom);
-extern void
-MEDversionDonner(med_int *majeur, med_int *mineur, med_int *release);
-extern med_err
-MEDversionLire(med_idt fid, med_int *majeur, med_int *mineur, med_int *release);
-
-
-
-/* Maillage */
-extern med_err
-MEDmaaCr(med_idt fid, char *maillage, med_int dim);
-extern med_int
-MEDdimLire(med_idt fid, char *maillage);
-extern med_err
-MEDmaaInfo(med_idt fid, int indice, char *maillage, med_int *dim);
-extern med_int
-MEDnMaa(med_idt fid);
-extern med_err
-MEDnbnosoEcr(med_idt fid, char *nom_maillage,med_int n);
-extern med_int
-MEDnbnosoLire(med_idt fid,char *nom_maillage);
-extern med_err
-MEDnbnoisEcr(med_idt fid, char *nom_maillage,med_int n);
-extern med_int
-MEDnbnoisLire(med_idt fid,char *nom_maillage);
-extern med_err
-MEDnbnomaEcr(med_idt fid, char *nom_maillage,med_int n);
-extern med_int
-MEDnbnomaLire(med_idt fid,char *nom_maillage);
-
-/* EntMaillage */
-extern med_err
-MEDconnEcr(med_idt fid,char *maa, med_int mdim, med_int *connectivite,med_mode_switch mode_switch,
- med_int nbre,med_mode_acces mode,med_entite_maillage type_ent,
- med_geometrie_element type_geo,med_connectivite type_conn);
-
-extern med_err
-MEDconnLire(med_idt fid,char *maa,med_int mdim,med_int *connectivite,med_mode_switch mode_switch,
- med_int * pfltab, med_size psize,
- med_entite_maillage type_ent, med_geometrie_element type_geo,med_connectivite type_conn);
-extern med_err
-MEDnomEcr(med_idt fid,char *maa, char *nom, med_int n, med_mode_acces mode,
- med_entite_maillage type_ent,med_geometrie_element type_geo);
-extern med_err
-MEDnomLire(med_idt fid,char *maa, char *nom, med_int n,
- med_entite_maillage type_ent,med_geometrie_element type_geo);
-extern med_err
-MEDnumLire(med_idt fid,char *maa, med_int *num, med_int n,
- med_entite_maillage type_ent,med_geometrie_element type_geo);
-extern med_err
-MEDnumEcr(med_idt fid,char *maa, med_int *num, med_int n, med_mode_acces mode,
- med_entite_maillage type_ent,med_geometrie_element type_geo);
-extern med_err
-MEDcoordEcr(med_idt fid, char *maa, med_int mdim, med_float *coo,
- med_mode_switch mode_coo,med_int n,
- med_mode_acces mode, med_repere type_rep, char *nom, char *unit);
-extern med_err
-MEDcoordLire(med_idt fid, char *maa, med_int mdim, med_float *coo,
- med_mode_switch mode_coo,med_int numco,
- med_int * pfltab, med_size psize, med_repere *type_rep, char *nom, char *unit);
-
-extern med_int
-MEDnEntMaa(med_idt fid, char *maa, med_table quoi, med_entite_maillage type_ent,
- med_geometrie_element type_geo, med_connectivite type_conn);
-
-
-/* Resultat */
-extern med_err MEDchampCr(med_idt fid, char *champ, med_type_champ type, char *comp,
- char *unit,med_int ncomp);
-
-extern med_err
-MEDchampEcr(med_idt fid, char *maa, char *cha,unsigned char *val,med_mode_switch interlace,med_int nbelem,med_int ngauss,
- med_int numco, char * profil, med_mode_acces mode, med_entite_maillage type_ent,
- med_geometrie_element type_geo, med_int numdt,char * dt_unit, med_float dt, med_int numo);
-
-extern med_err
-MEDchampLire(med_idt fid,char *maa, char *cha, unsigned char *val,med_mode_switch interlace,med_int numco,
- char *profil,med_entite_maillage type_ent, med_geometrie_element type_geo,
- med_int numdt, med_int numo);
-
-extern med_err
-MEDchampInfo(med_idt fid,int indice,char *champ,
- med_type_champ *type,char *comp,char *unit,
- med_int ncomp);
-
-extern med_int
-MEDnChamp(med_idt fid, int indice);
-
-extern med_int
-MEDnVal(med_idt fid, char *champ, med_entite_maillage typ_ent,
- med_geometrie_element typ_geo,med_int numdt, med_int numo);
-
-
-/* Famille */
-extern med_err
-MEDfamEcr(med_idt fid,char *maa, med_int *fam, med_int n, med_mode_acces mode,
- med_entite_maillage type_ent, med_geometrie_element type_geo);
-extern med_err
-MEDfamLire(med_idt fid,char *maa, med_int *fam, med_int n,
- med_entite_maillage type_ent,med_geometrie_element type_geo);
-extern med_err
-MEDfamCr(med_idt fid,char* maa,char *famille,med_int numero,
- med_int *attr_ident, med_int *attr_val,char *attr_desc,med_int n_attr,
- char *groupe , med_int n_groupe);
-extern med_int
-MEDnFam(med_idt fid,char *maa, int indice, med_dim_famille quoi);
-
-extern med_err
-MEDfamInfo(med_idt fid,char *maa,int indice, char *famille,
- med_int *numero,
- med_int *attr_ident, med_int *attr_val, char *attr_desc,
- med_int *n_attr,char *groupe ,med_int *n_groupe);
-
-/* Equivalence */
-extern med_err
-MEDequivCr(med_idt fid,char *maa, char *eq, char *desc);
-extern med_err
-MEDequivLire(med_idt fid, char *maa, char *eq, med_int *corr, med_int n,
- med_entite_maillage typ_ent,med_geometrie_element typ_geo);
-extern med_err
-MEDequivEcr(med_idt fid, char *maa, char *eq, med_int *corr, med_int n,
- med_mode_acces mode, med_entite_maillage typ_ent, med_geometrie_element typ_geo);
-extern med_err
-MEDequivInfo(med_idt fid, char *maa, int ind, char *eq, char *des);
-extern med_int
-MEDnEquiv(med_idt fid, char *maa);
-extern med_int
-MEDnCorres(med_idt fid,char *maa,char *eq,med_entite_maillage typ_ent,
- med_geometrie_element typ_geo);
-
-
-/* Routines de niveau intermediaire */
-extern med_int
-MEDnEntites(med_idt fid,char *maa,med_entite_maillage typ_ent,
- med_connectivite typ_con);
-
-extern med_err
-MEDnoeudsLire(med_idt fid,char *maa,med_int mdim, med_float *coord,
- med_mode_switch mode_coo,
- med_repere *repere,char *nomcoo, char *unicoo,char *nom,
- med_booleen *inom,med_int *num,med_booleen *inum,med_int *fam,
- med_int nnoeuds);
-
-extern med_err
-MEDnoeudsEcr(med_idt fid,char *maa,med_int mdim,med_float *coord,
- med_mode_switch mode_coo,
- med_repere repere,char *nomcoo, char *unicoo,char *nom,
- med_booleen inom,med_int *num,med_booleen inum,med_int *fam,
- med_int nnoeuds,med_mode_acces mode);
-extern med_err
-MEDelementsEcr(med_idt fid,char *maa,med_int mdim,med_int *connectivite,med_mode_switch mode_switch,
- char *nom,med_booleen inom,med_int *num,med_booleen inum,
- med_int *fam,med_int nele,med_entite_maillage typ_ent,
- med_geometrie_element typ_geo,med_connectivite typ_conn,med_mode_acces mode);
-extern med_err
-MEDelementsLire(med_idt fid,char *maa,med_int mdim,med_int *connectivite,med_mode_switch mode_switch,
- char *nom,med_booleen *inom,med_int *num,med_booleen *inum,
- med_int *fam,med_int nele,med_entite_maillage typ_ent,
- med_geometrie_element typ_geo,med_connectivite typ_conn);
-
-/* Routines de haut niveau */
-
-/*(? On enlève le reste ?)*/
-
-extern med_err
-MEDfamMaaInfo(med_idt fid,char *maa,med_int *nfam,med_int *nattc,
- med_int *ngroc);
-
-extern med_err
-MEDfamMaaLire(med_idt fid,char *maa,
- med_int *numfam,med_int *attide,
- med_int *attval,char *attdes,int *indatt,char *gro,int *indgro,
- med_int nfamilles);
-
-extern med_err
-MEDfamMaaCr(med_idt fid,char *maa,
- med_int *numfam,med_int *attide,
- med_int *attval,char *attdes,int *indatt,char *gro,int *indgro,
- med_int nfamilles);
-
-/* Routines concernant les profils */
-
-extern med_err
-MEDprofilInfo(med_idt fid, int indice, char *profil, med_int *n);
-
-extern med_int
-MEDnProfil(med_idt fid);
-
-extern med_err
-MEDprofilEcr(med_idt fid,med_int *pflval,med_int n,char *nom);
-
-extern med_int
-MEDnValProfil(med_idt fid, char *nom);
-
-extern med_err
-MEDprofilLire(med_idt fid, med_int *pflval, char *nom);
-
-/* Routines concernant les pas de temps/ numéros d'ordre */
-
-extern med_int
-MEDnPasdetemps(med_idt fid,char *cha,med_entite_maillage type_ent,
- med_geometrie_element type_geo);
-
-extern med_err
-MEDpasdetempsInfo(med_idt fid,char *champ
- ,med_entite_maillage type_ent, med_geometrie_element type_geo,
- int indice, char *maa, med_int * ngauss, med_int * numdt, char * dt_unit, med_float * dt,
- med_int * numo);
-
-/* Grilles */
-
-med_int MEDnGrid(med_idt fid, char *maa, med_grid n);
-med_err MEDgridCr(med_idt fid, char *maillage, med_int dim, med_grid_type typ);
-med_err MEDgridInfo(med_idt fid, int indice, med_int *isAGrid, med_grid_type *typ);
-med_err MEDgridEcr(
- med_idt fid, char *maa, med_int mdim, med_float *coo, med_int nb, med_int dim, med_mode_switch mode_coo,
- med_repere repere, char *nomcoo, char *unicoo, med_mode_acces mode );
-med_err MEDgridLire(
- med_idt fid, char *maa, med_int mdim, med_float *coo, med_int dim, med_mode_switch mode_coo,
- med_repere *repere, char *nomcoo, char *unicoo );
-med_err MEDfamGridEcr(med_idt fid, char *maa, med_int *fam, med_int n, med_mode_acces mode, med_entite_maillage type_ent);
-med_err MEDfamGridLire(med_idt fid, char *maa, med_int *fam, med_int n, med_entite_maillage type_ent);
-med_err MEDbodyFittedEcr(
- med_idt fid, char *maa, med_int mdim, med_float *coo, med_int *nbr, med_mode_switch mode_coo,
- med_repere repere, char *nomcoo, char *unicoo, med_int *fam, med_int nnoeuds, med_mode_acces mode );
-med_err MEDbodyFittedLire(
- med_idt fid, char *maa, med_int mdim, med_float *coo, med_mode_switch mode_coo,
- med_repere *repere, char *nomcoo, char *unicoo, med_int *fam, med_int nnoeuds );
-}
-
-#endif /* MED_PROTO_H */
-
-
-
-
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-# ifndef __UTILITES_H__
-# define __UTILITES_H__
-
-
-/* pour indiquer le statut des arguments des fonctions. */
-
-#ifdef _IN
-#error _IN already defined
-#endif
-#define _IN
-
-#ifdef _OUT
-#error _OUT already defined
-#endif
-#define _OUT
-
-#ifdef _INOUT
-#error _INOUT already defined
-#endif
-#define _INOUT
-
-#ifdef _UNUSED
-#error _UNUSED already defined
-#endif
-#define _UNUSED
-
-
-
-
-
-
-
-/* --- Pour afficher le nom du fichier source courant et le numero de la ligne courante --- */
-/* --- sur la stderr. --- */
-
-# define ICI {\
- fflush(stdout);\
- fprintf(stderr, "%s [%d] : " , __FILE__ , __LINE__ ) ;\
- fflush(stderr) ;\
- }
-
-
-
-
-
-
-
-/* --- Pour afficher la date et l'heure de la compilation du fichier source courant, --- */
-/* --- sur la stdout. --- */
-
-# ifdef INFOS_COMPILATION
-# error INFOS_COMPILATION already defined
-# endif
-# define INFOS_COMPILATION {\
- fflush(stderr);\
- fprintf(stdout, "%s [%d] : " , __FILE__ , __LINE__ ) ;\
- fprintf(stdout,"Compilation le %s" , __DATE__);\
- fprintf(stdout," a %s" , __TIME__ );\
- fprintf(stdout,"\n\n\n" );\
- fflush(stdout) ;\
- }
-
-
-
-
-
-
-
-/* --- Pour attendre "secondes" secondes et afficher un message sur la stderr indiquant --- */
-/* --- cette attente volontaire. --- */
-
-# ifdef ATTENTE
-# error ATTENTE already defined
-# endif
-# define ATTENTE(secondes) {\
- ICI ;\
- fprintf( stderr, "ATTENTE de %d secondes" , secondes);\
- fflush(stderr) ;\
- sleep(secondes) ;\
- fprintf( stderr, "\n" );\
- fflush(stderr) ;\
- }
-
-
-
-
-
-
-
-/* ---------- Les macros suivantes ne doivent pas deja exister ! ---------- */
-
-# ifdef EXECUTION
-# error EXECUTION already defined
-# endif
-# ifdef INTERRUPTION
-# error INTERRUPTION already defined
-# endif
-# ifdef ISCRUTE
-# error ISCRUTE already defined
-# endif
-# ifdef RSCRUTE
-# error RSCRUTE already defined
-# endif
-# ifdef SSCRUTE
-# error SSCRUTE already defined
-# endif
-# ifdef CSCRUTE
-# error CSCRUTE already defined
-# endif
-# ifdef XSCRUTE
-# error XSCRUTE already defined
-# endif
-# ifdef MESSAGE
-# error MESSAGE already defined
-# endif
-
-
-
-
-
-# ifdef _DEBOG_
-
-
-/* --- Pour tracer sur la stderr l'execution d"une instruction. --- */
-
-# define EXECUTION(instruction) {\
- ICI ;\
- fprintf( stderr,"INSTRUCTION %s" , #instruction ) ;\
- fflush(stderr);\
- instruction ;\
- fflush(stdout);\
- fprintf( stderr," FRANCHIE\n" ) ;\
- fflush(stderr);\
- }
-
-
-
-
-
-
-
-/* --- Pour afficher un message d'interruption volontaire et retourner le code retour --- */
-/* --- "code" --- */
-
-# define INTERRUPTION(code) {\
- ICI ;\
- fprintf( stderr," INTERRUPTION code = %d",code) ;\
- fprintf(stderr,"\n") ;\
- exit(code) ;\
- }
-
-
-
-
-
-
-
-/* --- Pour conditionner la poursuite du traitement par la validite de la condition --- */
-/* --- "condiiton". --- */
-
-# ifndef ASSERT
-# define ASSERT(condition) if( !(condition) ){\
- ICI ;\
- fprintf(stderr,"condition %s VIOLEE\n",#condition);\
- INTERRUPTION(17);\
- }
-# endif /* # ifndef ASSERT */
-
-
-
-
-
-
-
-/* --- Pour afficher sur la stderr la valeur d'une variable precedee de son nom. --- */
-
-# define ISCRUTE(entier) {\
- ICI ;\
- fprintf(stderr,"%s = %d\n",#entier,entier) ;\
- fflush(stderr) ;\
- }
-# define RSCRUTE(reel) {\
- ICI ;\
- fprintf(stderr,"%s = %f\n",#reel,reel) ;\
- fflush(stderr) ;\
- }
-# define XSCRUTE(pointeur) {\
- ICI ;\
- fprintf(stderr,"%s = %x\n",#pointeur,pointeur) ;\
- fflush(stderr) ;\
- }
-# define CSCRUTE(car) {\
- ICI ;\
- fprintf(stderr,"%s = %c\n",#car,car) ;\
- fflush(stderr) ;\
- }
-# define SSCRUTE(chaine) {\
- ICI ;\
- fprintf(stderr,"%s = \"%s\"\n",#chaine,chaine) ;\
- fflush(stderr) ;\
- }
-# define MESSAGE(chaine) {\
- ICI ;\
- fprintf(stderr,"%s\n",chaine) ;\
- fflush(stderr) ;\
- }
-# define FIN(nom) {\
- ICI ;\
- fprintf( stderr , "} FIN %s\n\n\n" , nom ) ;\
- fflush(stderr) ;\
- }
-# define DEBUT(nom) {\
- fprintf( stderr , "\n\n\n") ;\
- ICI ;\
- fprintf( stderr , "{ DEBUT %s\n" , nom ) ;\
- fflush(stderr) ;\
- }
-
-
-# else /* # ifdef _DEBOG_ */
-
-
-
-# define EXECUTION(instruction) instruction
-# define INTERRUPTION(code)
-
-# ifndef ASSERT
-# define ASSERT(condition)
-# endif
-
-# define ISCRUTE(entier)
-# define RSCRUTE(reel)
-# define CSCRUTE(car)
-# define SSCRUTE(chaine)
-# define MESSAGE(chaine)
-# define DEBUT(nom)
-# define FIN(nom)
-
-
-# endif /* # ifdef _DEBOG_ */
-
-
-# endif /* # ifndef __UTILITES_H__ */
+++ /dev/null
-// Copyright (C) 2005 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.
-//
-// 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/
-//
-/*************************************************************************
-* COPYRIGHT (C) 1999 - 2002 EDF R&D
-* THIS LIBRARY IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-* IT UNDER THE TERMS OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* AS PUBLISHED BY THE FREE SOFTWARE FOUNDATION;
-* EITHER VERSION 2.1 OF THE LICENSE, OR (AT YOUR OPTION) ANY LATER VERSION.
-*
-* THIS LIBRARY IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
-* WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
-* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
-* LESSER GENERAL PUBLIC LICENSE FOR MORE DETAILS.
-*
-* YOU SHOULD HAVE RECEIVED A COPY OF THE GNU LESSER GENERAL PUBLIC LICENSE
-* ALONG WITH THIS LIBRARY; IF NOT, WRITE TO THE FREE SOFTWARE FOUNDATION,
-* INC., 59 TEMPLE PLACE, SUITE 330, BOSTON, MA 02111-1307 USA
-*
-*************************************************************************/
-
-/******************************************************************************
- * - Nom du fichier : test1.c
- *
- * - Description : tests des routines d'ouverture/fermeture des
- * fichiers MED
- *
- *****************************************************************************/
-
-#include "med.hxx"
-using namespace med_2_1;
-
-/******************************************************************************
- * OUVERTURE/FERMETURE DE FICHIERS :
- *
- * Description :
- * - ouverture du fichier en mode ecriture avec remplacement
- * - ecriture d'une description du fichier (optionnel)
- * - fermeture du fichier
- * - ouverture du fichier en mode de lecture
- * - fermeture du fichier
- *****************************************************************************/
-
-int main (int argc, char **argv)
-{
- med_err ret = 0;
- med_idt fid;
- char des[MED_TAILLE_DESC+1]="Ceci est un courte description du mon fichier test1.med";
-
- fid = MEDouvrir("test1.med",MED_REMP);
- if (fid < 0)
- ret = -1;
- printf("%d\n",ret);
-
- if (ret == 0)
- ret = MEDfichDesEcr(fid,des, MED_REMP);
- printf("%d\n",ret);
-
- ret = MEDfermer(fid);
- printf("%d\n",ret);
-
- fid = MEDouvrir("test1.med",MED_LECT);
- if (fid < 0)
- ret = -1;
- printf("%d\n",ret);
-
- ret = MEDfermer(fid);
- printf("%d\n",ret);
-
- return 0;
-}
-
-
-
-
// $Header$
#include "MED_V2_2_Wrapper.hxx"
+#include "MED_Algorithm.hxx"
#include "MED_Utilities.hxx"
-extern "C"{
+extern "C"
+{
#include <med.h>
+
+med_err
+MEDgaussInfo(med_idt fid, int indice, char * locname, med_geometrie_element * type_geo,
+ med_int * ngauss );
}
#ifdef _DEBUG_
-namespace MED{
- namespace V2_2{
+namespace MED
+{
+ template<>
+ TInt
+ GetDESCLength<eV2_2>()
+ {
+ return 200;
+ }
+
+ template<>
+ TInt
+ GetIDENTLength<eV2_2>()
+ {
+ return 8;
+ }
+
+ template<>
+ TInt
+ GetNOMLength<eV2_2>()
+ {
+ return 32;
+ }
+
+ template<>
+ TInt
+ GetLNOMLength<eV2_2>()
+ {
+ return 80;
+ }
+
+ template<>
+ TInt
+ GetPNOMLength<eV2_2>()
+ {
+ return 16;
+ }
+
+ template<>
+ TInt
+ GetNbConn<eV2_2>(EGeometrieElement typmai,
+ EEntiteMaillage typent,
+ TInt mdim)
+ {
+ return typmai%100;
+ }
+
+ namespace V2_2
+ {
//---------------------------------------------------------------
class TFile{
}
- TInt TVWrapper::GetNbMeshes(TErr* theErr)
+ TInt
+ TVWrapper
+ ::GetNbMeshes(TErr* theErr)
{
TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
}
- void TVWrapper::GetMeshInfo(TInt theMeshId,
- MED::TMeshInfo& theInfo,
- TErr* theErr)
+ void
+ TVWrapper
+ ::GetMeshInfo(TInt theMeshId,
+ MED::TMeshInfo& theInfo,
+ TErr* theErr)
{
TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
if(theErr && !*theErr)
return;
- med_maillage& aType = (med_maillage&)(theInfo.myType);
-
TErr aRet = MEDmaaInfo(myFile->Id(),
theMeshId,
&theInfo.myName[0],
- (med_int *)&theInfo.myDim,
- &aType,
+ (med_int*)&theInfo.myDim,
+ (med_maillage*)&theInfo.myType,
&theInfo.myDesc[0]);
if(theErr)
*theErr = aRet;
}
- void TVWrapper::SetMeshInfo(const MED::TMeshInfo& theInfo,
- EModeAcces theMode,
- TErr* theErr)
+ void
+ TVWrapper
+ ::SetMeshInfo(const MED::TMeshInfo& theInfo,
+ EModeAcces theMode,
+ TErr* theErr)
{
TFileWrapper aFileWrapper(myFile,theMode,theErr);
MED::TMeshInfo& anInfo = const_cast<MED::TMeshInfo&>(theInfo);
- med_maillage& aType = (med_maillage&)(theInfo.myType);
-
TErr aRet = MEDmaaCr(myFile->Id(),
&anInfo.myName[0],
- anInfo.myDim,
- aType,
+ med_int(anInfo.myDim),
+ med_maillage(theInfo.myType),
&anInfo.myDesc[0]);
if(aRet == 0){
aRet = MEDunvCr(myFile->Id(),
}
- void TVWrapper::SetMeshInfo(const MED::TMeshInfo& theInfo,
- TErr* theErr)
+ void
+ TVWrapper
+ ::SetMeshInfo(const MED::TMeshInfo& theInfo,
+ TErr* theErr)
{
TErr aRet;
SetMeshInfo(theInfo,eLECTURE_ECRITURE,&aRet);
}
- TInt TVWrapper::GetNbFamilies(const MED::TMeshInfo& theInfo,
- TErr* theErr)
+ TInt
+ TVWrapper
+ ::GetNbFamilies(const MED::TMeshInfo& theInfo,
+ TErr* theErr)
{
TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
}
- TInt TVWrapper::GetNbFamAttr(TInt theFamId,
- const MED::TMeshInfo& theInfo,
- TErr* theErr)
+ TInt
+ TVWrapper
+ ::GetNbFamAttr(TInt theFamId,
+ const MED::TMeshInfo& theInfo,
+ TErr* theErr)
{
TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
}
- TInt TVWrapper::GetNbFamGroup(TInt theFamId,
- const MED::TMeshInfo& theInfo,
- TErr* theErr)
+ TInt
+ TVWrapper
+ ::GetNbFamGroup(TInt theFamId,
+ const MED::TMeshInfo& theInfo,
+ TErr* theErr)
{
TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
}
- void TVWrapper::GetFamilyInfo(TInt theFamId,
- MED::TFamilyInfo& theInfo,
- TErr* theErr)
+ void
+ TVWrapper
+ ::GetFamilyInfo(TInt theFamId,
+ MED::TFamilyInfo& theInfo,
+ TErr* theErr)
{
TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
MED::TMeshInfo& aMeshInfo = *theInfo.myMeshInfo;
+ med_int* anAttrId = theInfo.myNbAttr > 0? (med_int*)&theInfo.myAttrId[0]: NULL;
+ med_int* anAttrVal = theInfo.myNbAttr > 0? (med_int*)&theInfo.myAttrVal[0]: NULL;
+ char* anAttrDesc = theInfo.myNbAttr > 0? &theInfo.myAttrDesc[0]: NULL;
+ char* aGroupNames = theInfo.myNbGroup > 0? &theInfo.myGroupNames[0]: NULL;
+
TErr aRet = MEDfamInfo(myFile->Id(),
&aMeshInfo.myName[0],
theFamId,
&theInfo.myName[0],
- (med_int *)&theInfo.myId,
- (med_int *)&theInfo.myAttrId[0],
- (med_int *)&theInfo.myAttrVal[0],
- &theInfo.myAttrDesc[0],
- (med_int *)&theInfo.myNbAttr,
- &theInfo.myGroupNames[0],
- (med_int *)&theInfo.myNbGroup);
+ (med_int*)&theInfo.myId,
+ anAttrId,
+ anAttrVal,
+ anAttrDesc,
+ (med_int*)&theInfo.myNbAttr,
+ aGroupNames,
+ (med_int*)&theInfo.myNbGroup);
if(theErr)
*theErr = aRet;
"'; theFamId = "<<theFamId<<
"; theInfo.myNbGroup = "<<theInfo.myNbGroup<<
"; theInfo.myNbAttr = "<<theInfo.myNbAttr);
-
- INITMSG(MYDEBUG,"GetFamilyInfo - MEDfamInfo(...) - "<<
- " aMeshInfo.myName = '"<<&aMeshInfo.myName[0]<<
- "'; theFamId = "<<theFamId<<
- "; theInfo.myNbGroup = "<<theInfo.myNbGroup<<
- "; theInfo.myNbAttr = "<<theInfo.myNbAttr);
}
- void TVWrapper::SetFamilyInfo(const MED::TFamilyInfo& theInfo,
- EModeAcces theMode,
- TErr* theErr)
+ void
+ TVWrapper
+ ::SetFamilyInfo(const MED::TFamilyInfo& theInfo,
+ EModeAcces theMode,
+ TErr* theErr)
{
TFileWrapper aFileWrapper(myFile,theMode,theErr);
MED::TFamilyInfo& anInfo = const_cast<MED::TFamilyInfo&>(theInfo);
MED::TMeshInfo& aMeshInfo = *anInfo.myMeshInfo;
+ med_int* anAttrId = anInfo.myNbAttr > 0? (med_int*)&anInfo.myAttrId[0]: NULL;
+ med_int* anAttrVal = anInfo.myNbAttr > 0? (med_int*)&anInfo.myAttrVal[0]: NULL;
+ char* anAttrDesc = anInfo.myNbAttr > 0? &anInfo.myAttrDesc[0]: NULL;
+ char* aGroupNames = anInfo.myNbGroup > 0? &anInfo.myGroupNames[0]: NULL;
+
TErr aRet = MEDfamCr(myFile->Id(),
&aMeshInfo.myName[0],
&anInfo.myName[0],
anInfo.myId,
- (med_int*)&anInfo.myAttrId[0],
- (med_int*)&anInfo.myAttrVal[0],
- &anInfo.myAttrDesc[0],
+ anAttrId,
+ anAttrVal,
+ anAttrDesc,
anInfo.myNbAttr,
- &anInfo.myGroupNames[0],
+ aGroupNames,
anInfo.myNbGroup);
INITMSG(MYDEBUG,"TVWrapper::GetFamilyInfo - MED_MODE_ACCES = "<<theMode<<"; aRet = "<<aRet<<endl);
}
- void TVWrapper::SetFamilyInfo(const MED::TFamilyInfo& theInfo,
- TErr* theErr)
+ void
+ TVWrapper
+ ::SetFamilyInfo(const MED::TFamilyInfo& theInfo,
+ TErr* theErr)
{
TErr aRet;
SetFamilyInfo(theInfo,eLECTURE_ECRITURE,&aRet);
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- void TVWrapper::GetNames(TElemInfo& theInfo,
- TInt nb,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- TErr* theErr)
+ void
+ TVWrapper
+ ::GetNames(TElemInfo& theInfo,
+ TInt theNb,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
+ TErr* theErr)
{
TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
MED::TMeshInfo& aMeshInfo = *theInfo.myMeshInfo;
- med_entite_maillage& anEntity = (med_entite_maillage&)(theTEntity);
- med_geometrie_element& aGeom = (med_geometrie_element&)(theTGeom);
-
TErr aRet = MEDnomLire(myFile->Id(),
&aMeshInfo.myName[0],
&theInfo.myElemNames[0],
- nb,
- anEntity,
- aGeom);
+ theNb,
+ med_entite_maillage(theEntity),
+ med_geometrie_element(theGeom));
- theInfo.myIsElemNames = (theInfo.myElemNames).empty()? EBooleen(0) : EBooleen(1) ;
+ theInfo.myIsElemNames = (theInfo.myElemNames).empty()? eFAUX : eVRAI ;
if(theErr)
*theErr = aRet;
EXCEPTION(runtime_error,"GetNames - MEDnomLire(...)");
}
- void TVWrapper::GetNumeration(TElemInfo& theInfo,
- TInt nb,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- TErr* theErr)
+ void
+ TVWrapper
+ ::GetNumeration(TElemInfo& theInfo,
+ TInt theNb,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
+ TErr* theErr)
{
TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
MED::TMeshInfo& aMeshInfo = *theInfo.myMeshInfo;
- med_entite_maillage& anEntity = (med_entite_maillage&)(theTEntity);
- med_geometrie_element& aGeom = (med_geometrie_element&)(theTGeom);
+ med_entite_maillage& anEntity = (med_entite_maillage&)(theEntity);
+ med_geometrie_element& aGeom = (med_geometrie_element&)(theGeom);
TErr aRet = MEDnumLire(myFile->Id(),
&aMeshInfo.myName[0],
(med_int*)&theInfo.myElemNum[0],
- nb,
+ theNb,
anEntity,
aGeom);
- theInfo.myIsElemNum = (theInfo.myElemNum).empty()? EBooleen(0) : EBooleen(1) ;
+ theInfo.myIsElemNum = (theInfo.myElemNum).empty()? eFAUX : eVRAI ;
if(theErr)
*theErr = aRet;
EXCEPTION(runtime_error,"GetNumeration - MEDnumLire(...)");
}
- void TVWrapper::GetFamilies(TElemInfo& theInfo,
- TInt nb,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- TErr* theErr)
+ void
+ TVWrapper
+ ::GetFamilies(TElemInfo& theInfo,
+ TInt theNb,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
+ TErr* theErr)
{
TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
MED::TMeshInfo& aMeshInfo = *theInfo.myMeshInfo;
- med_entite_maillage& anEntity = (med_entite_maillage&)(theTEntity);
- med_geometrie_element& aGeom = (med_geometrie_element&)(theTGeom);
-
TErr aRet = MEDfamLire(myFile->Id(),
&aMeshInfo.myName[0],
(med_int*)&theInfo.myFamNum[0],
- nb,
- anEntity,
- aGeom);
+ theNb,
+ med_entite_maillage(theEntity),
+ med_geometrie_element(theGeom));
if(theErr)
*theErr = aRet;
EXCEPTION(runtime_error,"GetFamilies - MEDfamLire(...)");
}
- void TVWrapper::SetNames(const TElemInfo& theInfo,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- TErr* theErr)
+ void
+ TVWrapper
+ ::SetNames(const TElemInfo& theInfo,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
+ TErr* theErr)
{
- SetNames(theInfo,eLECTURE_ECRITURE,theTEntity,theTGeom,theErr);
+ SetNames(theInfo,eLECTURE_ECRITURE,theEntity,theGeom,theErr);
}
- void TVWrapper::SetNames(const TElemInfo& theInfo,
- EModeAcces theMode,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- TErr* theErr)
+ void
+ TVWrapper
+ ::SetNames(const TElemInfo& theInfo,
+ EModeAcces theMode,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
+ TErr* theErr)
{
TFileWrapper aFileWrapper(myFile,theMode,theErr);
MED::TElemInfo& anInfo = const_cast<MED::TElemInfo&>(theInfo);
MED::TMeshInfo& aMeshInfo = *anInfo.myMeshInfo;
- med_booleen& anIsElemNames = (med_booleen&)(theInfo.myIsElemNames);
- med_entite_maillage& anEntity = (med_entite_maillage&)(theTEntity);
- med_geometrie_element& aGeom = (med_geometrie_element&)(theTGeom);
-
TErr aRet = 0;
- if (anIsElemNames){
+ if(theInfo.myIsElemNames){
aRet = MEDnomEcr(myFile->Id(),
&aMeshInfo.myName[0],
&anInfo.myElemNames[0],
anInfo.myElemNames.size(),
- anEntity,
- aGeom);
+ med_entite_maillage(theEntity),
+ med_geometrie_element(theGeom));
if(theErr)
*theErr = aRet;
else if(aRet < 0)
}
}
- void TVWrapper::SetNumeration(const TElemInfo& theInfo,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- TErr* theErr)
+ void
+ TVWrapper
+ ::SetNumeration(const TElemInfo& theInfo,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
+ TErr* theErr)
{
- SetNumeration(theInfo,eLECTURE_ECRITURE,theTEntity,theTGeom,theErr);
+ SetNumeration(theInfo,eLECTURE_ECRITURE,theEntity,theGeom,theErr);
}
- void TVWrapper::SetNumeration(const TElemInfo& theInfo,
- EModeAcces theMode,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- TErr* theErr)
+ void
+ TVWrapper
+ ::SetNumeration(const TElemInfo& theInfo,
+ EModeAcces theMode,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
+ TErr* theErr)
{
TFileWrapper aFileWrapper(myFile,theMode,theErr);
MED::TElemInfo& anInfo = const_cast<MED::TElemInfo&>(theInfo);
MED::TMeshInfo& aMeshInfo = *anInfo.myMeshInfo;
- med_booleen& anIsElemNum = (med_booleen&)(theInfo.myIsElemNum);
- med_entite_maillage& anEntity = (med_entite_maillage&)(theTEntity);
- med_geometrie_element& aGeom = (med_geometrie_element&)(theTGeom);
-
TErr aRet = 0;
- if (anIsElemNum){
+ if(theInfo.myIsElemNum){
aRet = MEDnumEcr(myFile->Id(),
&aMeshInfo.myName[0],
(med_int*)&anInfo.myElemNum[0],
anInfo.myElemNum.size(),
- anEntity,
- aGeom);
+ med_entite_maillage(theEntity),
+ med_geometrie_element(theGeom));
if(theErr)
*theErr = aRet;
else if(aRet < 0)
}
}
- void TVWrapper::SetFamilies(const TElemInfo& theInfo,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- TErr* theErr)
+ void
+ TVWrapper
+ ::SetFamilies(const TElemInfo& theInfo,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
+ TErr* theErr)
{
- SetFamilies(theInfo,eLECTURE_ECRITURE,theTEntity,theTGeom,theErr);
+ SetFamilies(theInfo,eLECTURE_ECRITURE,theEntity,theGeom,theErr);
}
- void TVWrapper::SetFamilies(const TElemInfo& theInfo,
- EModeAcces theMode,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- TErr* theErr)
+ void
+ TVWrapper
+ ::SetFamilies(const TElemInfo& theInfo,
+ EModeAcces theMode,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
+ TErr* theErr)
{
TFileWrapper aFileWrapper(myFile,theMode,theErr);
MED::TElemInfo& anInfo = const_cast<MED::TElemInfo&>(theInfo);
MED::TMeshInfo& aMeshInfo = *anInfo.myMeshInfo;
- med_entite_maillage& anEntity = (med_entite_maillage&)(theTEntity);
- med_geometrie_element& aGeom = (med_geometrie_element&)(theTGeom);
-
TErr aRet = MEDfamEcr(myFile->Id(),
&aMeshInfo.myName[0],
- (med_int *)&anInfo.myFamNum[0],
+ (med_int*)&anInfo.myFamNum[0],
anInfo.myFamNum.size(),
- anEntity,
- aGeom);
+ med_entite_maillage(theEntity),
+ med_geometrie_element(theGeom));
if(theErr)
*theErr = aRet;
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- TInt TVWrapper::GetNbNodes(const MED::TMeshInfo& theMeshInfo,
- TErr* theErr)
+ TInt
+ TVWrapper
+ ::GetNbNodes(const MED::TMeshInfo& theMeshInfo,
+ TErr* theErr)
{
TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
}
- void TVWrapper::GetNodeInfo(MED::TNodeInfo& theInfo,
- TErr* theErr)
+ void
+ TVWrapper
+ ::GetNodeInfo(MED::TNodeInfo& theInfo,
+ TErr* theErr)
{
TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
MED::TMeshInfo& aMeshInfo = *theInfo.myMeshInfo;
- med_repere& aRepere = (med_repere&)(theInfo.mySystem);
- med_booleen& anIsElemNames = (med_booleen&)(theInfo.myIsElemNames);
- med_booleen& anIsElemNum = (med_booleen&)(theInfo.myIsElemNum);
+ char* anElemNames = theInfo.myIsElemNames? &theInfo.myElemNames[0]: NULL;
+ med_int* anElemNum = theInfo.myIsElemNum? &theInfo.myElemNum[0]: NULL;
TErr aRet = MEDnoeudsLire(myFile->Id(),
&aMeshInfo.myName[0],
aMeshInfo.myDim,
&theInfo.myCoord[0],
- MED_FULL_INTERLACE,
- &aRepere,
+ med_mode_switch(theInfo.myModeSwitch),
+ (med_repere*)&theInfo.mySystem,
&theInfo.myCoordNames[0],
&theInfo.myCoordUnits[0],
- &theInfo.myElemNames[0],
- &anIsElemNames,
- (med_int *)&theInfo.myElemNum[0],
- &anIsElemNum,
- (med_int *)&theInfo.myFamNum[0],
+ anElemNames,
+ (med_booleen*)&theInfo.myIsElemNames,
+ anElemNum,
+ (med_booleen*)&theInfo.myIsElemNum,
+ (med_int*)&theInfo.myFamNum[0],
theInfo.myNbElem);
if(theErr)
*theErr = aRet;
}
- void TVWrapper::SetNodeInfo(const MED::TNodeInfo& theInfo,
- EModeAcces theMode,
- TErr* theErr)
+ void
+ TVWrapper
+ ::SetNodeInfo(const MED::TNodeInfo& theInfo,
+ EModeAcces theMode,
+ TErr* theErr)
{
TFileWrapper aFileWrapper(myFile,theMode,theErr);
MED::TNodeInfo& anInfo = const_cast<MED::TNodeInfo&>(theInfo);
MED::TMeshInfo& aMeshInfo = *anInfo.myMeshInfo;
- med_repere& aRepere = (med_repere&)(theInfo.mySystem);
- med_booleen& anIsElemNames = (med_booleen&)(theInfo.myIsElemNames);
- med_booleen& anIsElemNum = (med_booleen&)(theInfo.myIsElemNum);
+ char* anElemNames = theInfo.myIsElemNames? &anInfo.myElemNames[0]: NULL;
+ med_int* anElemNum = theInfo.myIsElemNum? &anInfo.myElemNum[0]: NULL;
TErr aRet = MEDnoeudsEcr(myFile->Id(),
&aMeshInfo.myName[0],
aMeshInfo.myDim,
&anInfo.myCoord[0],
- MED_FULL_INTERLACE,
- aRepere,
+ med_mode_switch(theInfo.myModeSwitch),
+ med_repere(theInfo.mySystem),
&anInfo.myCoordNames[0],
&anInfo.myCoordUnits[0],
- &anInfo.myElemNames[0],
- anIsElemNames,
- (med_int *)&anInfo.myElemNum[0],
- anIsElemNum,
- (med_int *)&anInfo.myFamNum[0],
+ anElemNames,
+ med_booleen(theInfo.myIsElemNames),
+ anElemNum,
+ med_booleen(theInfo.myIsElemNum),
+ (med_int*)&anInfo.myFamNum[0],
anInfo.myNbElem);
if(theErr)
*theErr = aRet;
}
- void TVWrapper::SetNodeInfo(const MED::TNodeInfo& theInfo,
- TErr* theErr)
+ void
+ TVWrapper
+ ::SetNodeInfo(const MED::TNodeInfo& theInfo,
+ TErr* theErr)
{
TErr aRet;
SetNodeInfo(theInfo,eLECTURE_ECRITURE,&aRet);
SetNodeInfo(theInfo,eLECTURE_AJOUT,theErr);
}
- void TVWrapper::GetPolygoneInfo(MED::TPolygoneInfo& theInfo,
- TErr* theErr)
+
+ //-----------------------------------------------------------------
+ void
+ TVWrapper
+ ::GetPolygoneInfo(MED::TPolygoneInfo& theInfo,
+ TErr* theErr)
{
TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
MED::TMeshInfo& aMeshInfo = *theInfo.myMeshInfo;
TInt aNbElem = theInfo.myElemNum.size();
- med_entite_maillage& anEntity = (med_entite_maillage&)(theInfo.myTEntity);
- med_connectivite& aConn = (med_connectivite&)(theInfo.myTConn);
-
- TErr aRet = 0;
-
+ TErr aRet;
aRet = MEDpolygoneConnLire(myFile->Id(),
&aMeshInfo.myName[0],
- (med_int *)&theInfo.myIndex[0],
+ (med_int*)&theInfo.myIndex[0],
aNbElem+1,
- (med_int *)&theInfo.myConn[0],
- anEntity,
- aConn);
+ (med_int*)&theInfo.myConn[0],
+ med_entite_maillage(theInfo.myEntity),
+ med_connectivite(theInfo.myConnMode));
if(theErr)
*theErr = aRet;
else if(aRet < 0)
EXCEPTION(runtime_error,"GetPolygoneInfo - MEDpolygoneInfo(...)");
+ if(theInfo.myIsElemNames){
+ GetNames(theInfo,aNbElem,theInfo.myEntity,ePOLYGONE,&aRet);
+ if(theErr)
+ *theErr = aRet;
+ }
- GetNames(theInfo,aNbElem,theInfo.myTEntity,ePOLYGONE,&aRet);
- if(theErr)
- *theErr = aRet;
-
- GetNumeration(theInfo,aNbElem,theInfo.myTEntity,ePOLYGONE,&aRet);
- if(theErr)
- *theErr = aRet;
+ if(theInfo.myIsElemNum){
+ GetNumeration(theInfo,aNbElem,theInfo.myEntity,ePOLYGONE,&aRet);
+ if(theErr)
+ *theErr = aRet;
+ }
- GetFamilies(theInfo,aNbElem,theInfo.myTEntity,ePOLYGONE,&aRet);
+ GetFamilies(theInfo,aNbElem,theInfo.myEntity,ePOLYGONE,&aRet);
if(theErr)
*theErr = aRet;
}
- void TVWrapper::SetPolygoneInfo(const MED::TPolygoneInfo& theInfo,
- TErr* theErr)
+ 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)
+ void
+ TVWrapper
+ ::SetPolygoneInfo(const MED::TPolygoneInfo& theInfo,
+ EModeAcces theMode,
+ TErr* theErr)
{
TFileWrapper aFileWrapper(myFile,theMode,theErr);
MED::TPolygoneInfo& anInfo = const_cast<MED::TPolygoneInfo&>(theInfo);
MED::TMeshInfo& aMeshInfo = *anInfo.myMeshInfo;
- med_entite_maillage& anEntity = (med_entite_maillage&)(theInfo.myTEntity);
- med_connectivite& aConn = (med_connectivite&)(theInfo.myTConn);
-
TErr aRet = MEDpolygoneConnEcr(myFile->Id(),
&aMeshInfo.myName[0],
- (med_int *)&anInfo.myIndex[0],
+ (med_int*)&anInfo.myIndex[0],
anInfo.myNbElem+1,
- (med_int *)&anInfo.myConn[0],
- anEntity,
- aConn);
+ (med_int*)&anInfo.myConn[0],
+ med_entite_maillage(theInfo.myEntity),
+ med_connectivite(theInfo.myConnMode));
if(theErr)
*theErr = aRet;
else if(aRet < 0)
EXCEPTION(runtime_error,"SetPolygoneInfo - MEDpolygoneConnEcr(...)");
- SetNames(anInfo,theInfo.myTEntity,ePOLYGONE,&aRet);
+ SetNames(anInfo,theInfo.myEntity,ePOLYGONE,&aRet);
if(theErr)
*theErr = aRet;
- SetNumeration(anInfo,theInfo.myTEntity,ePOLYGONE,&aRet);
+ SetNumeration(anInfo,theInfo.myEntity,ePOLYGONE,&aRet);
if(theErr)
*theErr = aRet;
- SetFamilies(anInfo,theInfo.myTEntity,ePOLYGONE,&aRet);
+ SetFamilies(anInfo,theInfo.myEntity,ePOLYGONE,&aRet);
if(theErr)
*theErr = aRet;
}
- TInt TVWrapper::GetNbPolygones(const MED::TMeshInfo& theMeshInfo,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- EConnectivite theTConn,
- TErr* theErr)
+ TInt
+ TVWrapper
+ ::GetNbPolygones(const MED::TMeshInfo& theMeshInfo,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
+ EConnectivite theConnMode,
+ TErr* theErr)
{
- return GetNbCells(theMeshInfo,theTEntity,theTGeom,theTConn,theErr);
+ return GetNbCells(theMeshInfo,theEntity,theGeom,theConnMode,theErr);
}
- TInt TVWrapper::GetNbPolygoneConn(const MED::TMeshInfo& theMeshInfo,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- EConnectivite theTConn,
- TErr* theErr)
+ TInt
+ TVWrapper
+ ::GetPolygoneConnSize(const MED::TMeshInfo& theMeshInfo,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
+ EConnectivite theConnMode,
+ TErr* theErr)
{
TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
MED::TMeshInfo& aMeshInfo = const_cast<MED::TMeshInfo&>(theMeshInfo);
- med_entite_maillage& anEntity = (med_entite_maillage&)(theTEntity);
- med_connectivite& aConn = (med_connectivite&)(theTConn);
-
med_int taille = 0;
- TErr aRet = MEDpolygoneInfo(myFile->Id(),
- &aMeshInfo.myName[0],
- anEntity,
- aConn,
- &taille);
+ TErr aRet;
+ aRet = MEDpolygoneInfo(myFile->Id(),
+ &aMeshInfo.myName[0],
+ med_entite_maillage(theEntity),
+ med_connectivite(theConnMode),
+ &taille);
if(theErr)
*theErr = aRet;
return TInt(taille);
}
- void TVWrapper::GetPolyedreInfo(TPolyedreInfo& theInfo,
- TErr* theErr)
+ //-----------------------------------------------------------------
+ void
+ TVWrapper
+ ::GetPolyedreInfo(TPolyedreInfo& theInfo,
+ TErr* theErr)
{
TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
MED::TMeshInfo& aMeshInfo = *theInfo.myMeshInfo;
TInt aNbElem = theInfo.myElemNum.size();
- med_connectivite& aConn = (med_connectivite&)(theInfo.myTConn);
-
- TErr aRet = 0;
-
+ TErr aRet;
aRet = MEDpolyedreConnLire(myFile->Id(),
&aMeshInfo.myName[0],
- (med_int *)&theInfo.myIndex[0],
- aNbElem+1,
- (med_int *)&theInfo.myFacesIndex[0],
- theInfo.myNbFacesIndex,
- (med_int *)&theInfo.myConn[0],
- aConn);
+ (med_int*)&theInfo.myIndex[0],
+ aNbElem + 1,
+ (med_int*)&theInfo.myFaces[0],
+ theInfo.myFaces.size(),
+ (med_int*)&theInfo.myConn[0],
+ med_connectivite(theInfo.myConnMode));
if(theErr)
*theErr = aRet;
else if(aRet < 0)
EXCEPTION(runtime_error,"GetPolygoneInfo - MEDpolyedreConnLire(...)");
- GetNames(theInfo,aNbElem,theInfo.myTEntity,ePOLYEDRE,&aRet);
- if(theErr)
- *theErr = aRet;
+ if(theInfo.myIsElemNames){
+ GetNames(theInfo,aNbElem,theInfo.myEntity,ePOLYEDRE,&aRet);
+ if(theErr)
+ *theErr = aRet;
+ }
- GetNumeration(theInfo,aNbElem,theInfo.myTEntity,ePOLYEDRE,&aRet);
- if(theErr)
- *theErr = aRet;
+ if(theInfo.myIsElemNum){
+ GetNumeration(theInfo,aNbElem,theInfo.myEntity,ePOLYEDRE,&aRet);
+ if(theErr)
+ *theErr = aRet;
+ }
- GetFamilies(theInfo,aNbElem,theInfo.myTEntity,ePOLYEDRE,&aRet);
+ GetFamilies(theInfo,aNbElem,theInfo.myEntity,ePOLYEDRE,&aRet);
if(theErr)
*theErr = aRet;
}
- void TVWrapper::SetPolyedreInfo(const TPolyedreInfo& theInfo,
- TErr* theErr)
+ void
+ TVWrapper
+ ::SetPolyedreInfo(const TPolyedreInfo& theInfo,
+ TErr* theErr)
{
SetPolyedreInfo(theInfo,eLECTURE_ECRITURE,theErr);
}
- void TVWrapper::SetPolyedreInfo(const MED::TPolyedreInfo& theInfo,
- EModeAcces theMode,
- TErr* theErr)
+ void
+ TVWrapper
+ ::SetPolyedreInfo(const MED::TPolyedreInfo& theInfo,
+ EModeAcces theMode,
+ TErr* theErr)
{
TFileWrapper aFileWrapper(myFile,theMode,theErr);
MED::TPolyedreInfo& anInfo = const_cast<MED::TPolyedreInfo&>(theInfo);
MED::TMeshInfo& aMeshInfo = *anInfo.myMeshInfo;
- med_booleen& anIsElemNames = (med_booleen&)(theInfo.myIsElemNames);
- med_booleen& anIsElemNum = (med_booleen&)(theInfo.myIsElemNum);
- med_entite_maillage& anEntity = (med_entite_maillage&)(theInfo.myTEntity);
- med_connectivite& aConn = (med_connectivite&)(theInfo.myTConn);
-
- TErr aRet = MEDpolyedreConnEcr(myFile->Id(),
- &aMeshInfo.myName[0],
- (med_int *)&anInfo.myIndex[0],
- anInfo.myNbElem+1,
- (med_int *)&anInfo.myFacesIndex[0],
- anInfo.myNbFacesIndex,
- (med_int *)&anInfo.myConn[0],
- aConn);
+ TErr aRet;
+ aRet = MEDpolyedreConnEcr(myFile->Id(),
+ &aMeshInfo.myName[0],
+ (med_int*)&anInfo.myIndex[0],
+ anInfo.myNbElem+1,
+ (med_int*)&anInfo.myFaces[0],
+ anInfo.myFaces.size(),
+ (med_int*)&anInfo.myConn[0],
+ med_connectivite(theInfo.myConnMode));
if(theErr)
*theErr = aRet;
else if(aRet < 0)
EXCEPTION(runtime_error,"SetPolyedreInfo - MEDpolyedreConnEcr(...)");
- if (anIsElemNames){
+ if(theInfo.myIsElemNames){
aRet = MEDnomEcr(myFile->Id(),
&aMeshInfo.myName[0],
&anInfo.myElemNames[0],
anInfo.myElemNames.size(),
- anEntity,
+ med_entite_maillage(theInfo.myEntity),
MED_POLYEDRE);
if(theErr)
*theErr = aRet;
EXCEPTION(runtime_error,"SetPolyedreInfo - MEDnomEcr(...)");
}
- if (anIsElemNum){
+ if(theInfo.myIsElemNum){
aRet = MEDnumEcr(myFile->Id(),
&aMeshInfo.myName[0],
- (med_int *)&anInfo.myElemNum[0],
+ (med_int*)&anInfo.myElemNum[0],
anInfo.myElemNum.size(),
- anEntity,
+ med_entite_maillage(theInfo.myEntity),
MED_POLYEDRE);
if(theErr)
*theErr = aRet;
aRet = MEDfamEcr(myFile->Id(),
&aMeshInfo.myName[0],
- (med_int *)&anInfo.myFamNum[0],
+ (med_int*)&anInfo.myFamNum[0],
anInfo.myFamNum.size(),
- anEntity,
+ med_entite_maillage(theInfo.myEntity),
MED_POLYEDRE);
if(theErr)
EXCEPTION(runtime_error,"SetPolyedreInfo - MEDfamEcr(...)");
}
- TInt TVWrapper::GetNbPolyedres(const MED::TMeshInfo& theMeshInfo,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- EConnectivite theTConn,
- TErr* theErr)
+ TInt
+ TVWrapper
+ ::GetNbPolyedres(const MED::TMeshInfo& theMeshInfo,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
+ EConnectivite theConnMode,
+ TErr* theErr)
{
- return GetNbCells(theMeshInfo,theTEntity,theTGeom,theTConn,theErr);
+ return GetNbCells(theMeshInfo,theEntity,theGeom,theConnMode,theErr);
}
- void TVWrapper::GetNbPolyedreConnF(const MED::TMeshInfo& theMeshInfo,
- EConnectivite theTConn,
- TInt& nf,
- TInt& nc,
- TErr* theErr)
+ void
+ TVWrapper
+ ::GetPolyedreConnSize(const TMeshInfo& theMeshInfo,
+ TInt& theNbFaces,
+ TInt& theConnSize,
+ EConnectivite theConnMode,
+ TErr* theErr)
{
TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
- if(theErr && !*theErr) EXCEPTION(runtime_error,"GetPolyedreInfo - (...)");
+ if(theErr && !*theErr)
+ EXCEPTION(runtime_error,"GetPolyedreInfo - (...)");
MED::TMeshInfo& aMeshInfo = const_cast<MED::TMeshInfo&>(theMeshInfo);
- med_connectivite& aConn = (med_connectivite&)(theTConn);
TErr aRet = MEDpolyedreInfo(myFile->Id(),
&aMeshInfo.myName[0],
- aConn,
- (med_int *)&nf,
- (med_int *)&nc);
+ med_connectivite(theConnMode),
+ (med_int*)&theNbFaces,
+ (med_int*)&theConnSize);
if(theErr)
*theErr = aRet;
}
- TEntityInfo TVWrapper::GetEntityInfo(const MED::TMeshInfo& theMeshInfo,
- EConnectivite theTConn,
- TErr* theErr)
+ //-----------------------------------------------------------------
+ TEntityInfo
+ TVWrapper
+ ::GetEntityInfo(const MED::TMeshInfo& theMeshInfo,
+ EConnectivite theConnMode,
+ TErr* theErr)
{
TEntityInfo anInfo;
TGeomSet::const_iterator anIterEnd2 = aGeomSet.end();
for(; anIter2 != anIterEnd2; anIter2++){
const EGeometrieElement& aGeom = *anIter2;
- aNbElem = GetNbCells(theMeshInfo,anEntity,aGeom,theTConn,theErr);
+ aNbElem = GetNbCells(theMeshInfo,anEntity,aGeom,theConnMode,theErr);
if(aNbElem > 0)
anInfo[anEntity][aGeom] = aNbElem;
}
}
- TInt TVWrapper::GetNbCells(const MED::TMeshInfo& theMeshInfo,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
- EConnectivite theTConn,
- TErr* theErr)
+ //-----------------------------------------------------------------
+ TInt
+ TVWrapper
+ ::GetNbCells(const MED::TMeshInfo& theMeshInfo,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
+ EConnectivite theConnMode,
+ TErr* theErr)
{
TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
MED::TMeshInfo& aMeshInfo = const_cast<MED::TMeshInfo&>(theMeshInfo);
- med_entite_maillage anEntity = med_entite_maillage(theTEntity);
- med_geometrie_element aGeom = med_geometrie_element(theTGeom);
- med_connectivite aConn = med_connectivite(theTConn);
-
return MEDnEntMaa(myFile->Id(),
&aMeshInfo.myName[0],
MED_CONN,
- anEntity,
- aGeom,
- aConn);
+ med_entite_maillage(theEntity),
+ med_geometrie_element(theGeom),
+ med_connectivite(theConnMode));
}
- void TVWrapper::GetCellInfo(MED::TCellInfo& theInfo,
- TErr* theErr)
+ void
+ TVWrapper
+ ::GetCellInfo(MED::TCellInfo& theInfo,
+ TErr* theErr)
{
TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
MED::TMeshInfo& aMeshInfo = *theInfo.myMeshInfo;
TInt aNbElem = theInfo.myElemNum.size();
- med_booleen& anIsElemNames = (med_booleen&)(theInfo.myIsElemNames);
- med_booleen& anIsElemNum = (med_booleen&)(theInfo.myIsElemNum);
- med_entite_maillage& anEntity = (med_entite_maillage&)(theInfo.myTEntity);
- med_geometrie_element& aGeom = (med_geometrie_element&)(theInfo.myTGeom);
- med_connectivite& aConn = (med_connectivite&)(theInfo.myTConn);
-
- TErr aRet = MEDelementsLire(myFile->Id(),
- &aMeshInfo.myName[0],
- aMeshInfo.myDim,
- (med_int *)&theInfo.myConn[0],
- MED_FULL_INTERLACE,
- &theInfo.myElemNames[0],
- &anIsElemNames,
- (med_int *)&theInfo.myElemNum[0],
- &anIsElemNum,
- (med_int *)&theInfo.myFamNum[0],
- aNbElem,
- anEntity,
- aGeom,
- aConn);
+ char* anElemNames = theInfo.myIsElemNames? &theInfo.myElemNames[0]: NULL;
+ med_int* anElemNum = theInfo.myIsElemNum? &theInfo.myElemNum[0]: NULL;
+
+ TErr aRet;
+ aRet = MEDelementsLire(myFile->Id(),
+ &aMeshInfo.myName[0],
+ aMeshInfo.myDim,
+ (med_int*)&theInfo.myConn[0],
+ med_mode_switch(theInfo.myModeSwitch),
+ anElemNames,
+ (med_booleen*)&theInfo.myIsElemNames,
+ anElemNum,
+ (med_booleen*)&theInfo.myIsElemNum,
+ (med_int*)&theInfo.myFamNum[0],
+ aNbElem,
+ med_entite_maillage(theInfo.myEntity),
+ med_geometrie_element(theInfo.myGeom),
+ med_connectivite(theInfo.myConnMode));
if(theErr)
*theErr = aRet;
else if(aRet < 0)
}
- void TVWrapper::SetCellInfo(const MED::TCellInfo& theInfo,
- EModeAcces theMode,
- TErr* theErr)
+ void
+ TVWrapper
+ ::SetCellInfo(const MED::TCellInfo& theInfo,
+ EModeAcces theMode,
+ TErr* theErr)
{
TFileWrapper aFileWrapper(myFile,theMode,theErr);
MED::TCellInfo& anInfo = const_cast<MED::TCellInfo&>(theInfo);
MED::TMeshInfo& aMeshInfo = *anInfo.myMeshInfo;
- med_booleen& anIsElemNames = (med_booleen&)(theInfo.myIsElemNames);
- med_booleen& anIsElemNum = (med_booleen&)(theInfo.myIsElemNum);
- med_entite_maillage& anEntity = (med_entite_maillage&)(theInfo.myTEntity);
- med_geometrie_element& aGeom = (med_geometrie_element&)(theInfo.myTGeom);
- med_connectivite& aConn = (med_connectivite&)(theInfo.myTConn);
+ char* anElemNames = theInfo.myIsElemNames? &anInfo.myElemNames[0]: NULL;
+ med_int* anElemNum = theInfo.myIsElemNum? &anInfo.myElemNum[0]: NULL;
- TErr aRet = MEDelementsEcr(myFile->Id(),
- &aMeshInfo.myName[0],
- aMeshInfo.myDim,
- (med_int *)&anInfo.myConn[0],
- MED_FULL_INTERLACE,
- &anInfo.myElemNames[0],
- anIsElemNames,
- (med_int *)&anInfo.myElemNum[0],
- anIsElemNum,
- (med_int *)&anInfo.myFamNum[0],
- anInfo.myNbElem,
- anEntity,
- aGeom,
- aConn);
+ TErr aRet;
+ aRet = MEDelementsEcr(myFile->Id(),
+ &aMeshInfo.myName[0],
+ aMeshInfo.myDim,
+ (med_int*)&anInfo.myConn[0],
+ med_mode_switch(theInfo.myModeSwitch),
+ anElemNames,
+ med_booleen(theInfo.myIsElemNames),
+ anElemNum,
+ med_booleen(theInfo.myIsElemNum),
+ (med_int*)&anInfo.myFamNum[0],
+ anInfo.myNbElem,
+ med_entite_maillage(theInfo.myEntity),
+ med_geometrie_element(theInfo.myGeom),
+ med_connectivite(theInfo.myConnMode));
if(theErr)
*theErr = aRet;
}
- void TVWrapper::SetCellInfo(const MED::TCellInfo& theInfo,
- TErr* theErr)
+ void
+ TVWrapper
+ ::SetCellInfo(const MED::TCellInfo& theInfo,
+ TErr* theErr)
{
SetCellInfo(theInfo,eLECTURE_ECRITURE,theErr);
}
- TInt TVWrapper::GetNbFields(TErr* theErr)
+ //-----------------------------------------------------------------
+ TInt
+ TVWrapper
+ ::GetNbFields(TErr* theErr)
{
TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
}
- TInt TVWrapper::GetNbComp(TInt theFieldId,
- TErr* theErr)
+ TInt
+ TVWrapper
+ ::GetNbComp(TInt theFieldId,
+ TErr* theErr)
{
TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
}
- void TVWrapper::GetFieldInfo(TInt theFieldId,
- MED::TFieldInfo& theInfo,
+ void
+ TVWrapper
+ ::GetFieldInfo(TInt theFieldId,
+ MED::TFieldInfo& theInfo,
TErr* theErr)
{
TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
if(theErr && !*theErr)
return;
- med_type_champ& aType = (med_type_champ&)(theInfo.myType);
-
- TErr aRet = MEDchampInfo(myFile->Id(),
- theFieldId,
- &theInfo.myName[0],
- &aType,
- &theInfo.myCompNames[0],
- &theInfo.myUnitNames[0],
- theInfo.myNbComp);
+ TErr aRet;
+ aRet = MEDchampInfo(myFile->Id(),
+ theFieldId,
+ &theInfo.myName[0],
+ (med_type_champ*)&theInfo.myType,
+ &theInfo.myCompNames[0],
+ &theInfo.myUnitNames[0],
+ theInfo.myNbComp);
if(theErr)
*theErr = aRet;
else if(aRet < 0)
}
- void TVWrapper::SetFieldInfo(const MED::TFieldInfo& theInfo,
- EModeAcces theMode,
- TErr* theErr)
+ void
+ TVWrapper
+ ::SetFieldInfo(const MED::TFieldInfo& theInfo,
+ EModeAcces theMode,
+ TErr* theErr)
{
TFileWrapper aFileWrapper(myFile,theMode,theErr);
MED::TFieldInfo& anInfo = const_cast<MED::TFieldInfo&>(theInfo);
- med_type_champ& aType = (med_type_champ&)(theInfo.myType);
-
- TErr aRet = MEDchampCr(myFile->Id(),
- &anInfo.myName[0],
- aType,
- &anInfo.myCompNames[0],
- &anInfo.myUnitNames[0],
- anInfo.myNbComp);
+ TErr aRet;
+ aRet = MEDchampCr(myFile->Id(),
+ &anInfo.myName[0],
+ med_type_champ(theInfo.myType),
+ &anInfo.myCompNames[0],
+ &anInfo.myUnitNames[0],
+ anInfo.myNbComp);
if(theErr)
*theErr = aRet;
else if(aRet < 0)
}
- void TVWrapper::SetFieldInfo(const MED::TFieldInfo& theInfo,
- TErr* theErr)
+ void
+ TVWrapper
+ ::SetFieldInfo(const MED::TFieldInfo& theInfo,
+ TErr* theErr)
{
TErr aRet;
SetFieldInfo(theInfo,eLECTURE_ECRITURE,&aRet);
}
- TInt TVWrapper::GetNbTimeStamps(const MED::TFieldInfo& theInfo,
- const MED::TEntityInfo& theEntityInfo,
- EEntiteMaillage& theEntity,
- TGeom& theGeom,
- TErr* theErr)
+ //-----------------------------------------------------------------
+ TInt
+ TVWrapper
+ ::GetNbGauss(TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+
+ if(theErr && *theErr < 0)
+ return -1;
+
+ return MEDnGauss(myFile->Id());
+ }
+
+
+ TGaussInfo::TInfo
+ TVWrapper
+ ::GetGaussPreInfo(TInt theId,
+ TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+
+ if(theErr && *theErr < 0)
+ return TGaussInfo::TInfo();
+
+ med_int aNbGaussPoints = med_int();
+ TVector<char> aName(GetNOMLength<eV2_2>()+1);
+ med_geometrie_element aGeom = MED_NONE;
+
+ TErr aRet;
+ aRet = MEDgaussInfo(myFile->Id(),
+ theId,
+ &aName[0],
+ &aGeom,
+ &aNbGaussPoints);
+ if(theErr)
+ *theErr = aRet;
+ else if(aRet < 0)
+ EXCEPTION(runtime_error,"GetGaussPreInfo - MEDgaussInfo(...)");
+
+ 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;
+
+ TErr aRet;
+ aRet = MEDgaussLire(myFile->Id(),
+ &theInfo.myRefCoord[0],
+ &theInfo.myGaussCoord[0],
+ &theInfo.myWeight[0],
+ med_mode_switch(theInfo.myModeSwitch),
+ &theInfo.myName[0]);
+
+ if(theErr)
+ *theErr = aRet;
+ else if(aRet < 0)
+ EXCEPTION(runtime_error,"GetGaussInfo - MEDgaussLire(...)");
+ }
+
+
+ //-----------------------------------------------------------------
+ TInt
+ TVWrapper
+ ::GetNbProfiles(TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+
+ if(theErr && *theErr < 0)
+ return -1;
+
+ return MEDnProfil(myFile->Id());
+ }
+
+
+ TProfileInfo::TInfo
+ TVWrapper
+ ::GetProfilePreInfo(TInt theId,
+ TErr* theErr)
+ {
+ TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
+
+ if(theErr && *theErr < 0)
+ return TProfileInfo::TInfo();
+
+ TInt aSize = -1;
+ TVector<char> aName(GetNOMLength<eV2_2>()+1);
+
+ TErr aRet;
+ aRet = MEDprofilInfo(myFile->Id(),
+ theId,
+ &aName[0],
+ &aSize);
+ if(theErr)
+ *theErr = aRet;
+ else if(aRet < 0)
+ EXCEPTION(runtime_error,"GetProfilePreInfo - MEDprofilInfo(...)");
+
+ 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;
+
+ TErr aRet;
+ aRet = MEDprofilLire(myFile->Id(),
+ &theInfo.myElemNum[0],
+ &theInfo.myName[0]);
+ if(theErr)
+ *theErr = aRet;
+ else if(aRet < 0)
+ EXCEPTION(runtime_error,"GetProfileInfo - MEDprofilLire(...)");
+ }
+
+
+ //-----------------------------------------------------------------
+ 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);
}else if(theEntityInfo.empty())
EXCEPTION(runtime_error,"GetNbTimeStamps - There is no any Entity on the Mesh");
- theGeom.clear();
+ theGeom2Size.clear();
TInt aNbTimeStamps = 0;
+ TIdt anId = myFile->Id();
+
MED::TFieldInfo& anInfo = const_cast<MED::TFieldInfo&>(theInfo);
+ MED::TMeshInfo& aMeshInfo = anInfo.myMeshInfo;
+
TEntityInfo::const_iterator anIter = theEntityInfo.begin();
for(; anIter != theEntityInfo.end(); anIter++){
- const med_entite_maillage& anEntity = (const med_entite_maillage&)(anIter->first);
- const TGeom& aTGeom = anIter->second;
- TGeom::const_iterator anGeomIter = aTGeom.begin();
- for(; anGeomIter != aTGeom.end(); anGeomIter++){
- const med_geometrie_element& aGeom = (const med_geometrie_element&)(anGeomIter->first);
- TInt aTmp = MEDnPasdetemps(myFile->Id(),&anInfo.myName[0],anEntity,aGeom);
- aNbTimeStamps = max(aTmp,aNbTimeStamps);
- if (aNbTimeStamps<1)
- continue;
- BEGMSG(MYDEBUG,"GetNbTimeStamps aNbTimeStamps="<<aTmp<<"; aGeom="<<aGeom<<"; anEntity="<<anEntity<<"\n");
- if(aTmp){
- theEntity = EEntiteMaillage(anEntity);
- ADDMSG(MYDEBUG,"theEntity="<<theEntity<<"\n");
- theGeom[EGeometrieElement(aGeom)] = anGeomIter->second;
+ med_entite_maillage anEntity = med_entite_maillage(anIter->first);
+ const TGeom2Size& aGeom2Size = anIter->second;
+ TGeom2Size::const_iterator anGeomIter = aGeom2Size.begin();
+ for(; anGeomIter != aGeom2Size.end(); anGeomIter++){
+ med_geometrie_element aGeom = med_geometrie_element(anGeomIter->first);
+ TInt aNbStamps = MEDnPasdetemps(anId,
+ &anInfo.myName[0],
+ anEntity,
+ aGeom);
+ if(aNbStamps > 0){
+ INITMSG(MYDEBUG,
+ "GetNbTimeStamps aNbTimeStamps = "<<aNbStamps<<
+ "; aGeom = "<<aGeom<<"; anEntity = "<<anEntity<<"\n");
+ for(TInt iTimeStamp = 1; iTimeStamp <= aNbStamps; iTimeStamp++){
+ char aMaillageChamp[GetNOMLength<eV2_2>()+1];
+ char aDtUnit[GetPNOMLength<eV2_2>()+1];
+ med_int aNbGauss;
+ med_int aNumDt;
+ med_int aNumOrd;
+ med_float aDt;
+ med_booleen anIsLocal;
+ med_int aNbRef;
+ TErr aRet = MEDpasdetempsInfo(anId,
+ &anInfo.myName[0],
+ anEntity,
+ aGeom,
+ iTimeStamp,
+ &aNbGauss,
+ &aNumDt,
+ &aNumOrd,
+ aDtUnit,
+ &aDt,
+ aMaillageChamp,
+ &anIsLocal,
+ &aNbRef);
+ INITMSG(MYDEBUG,
+ "GetNbTimeStamps aMaillageChamp = '"<<aMaillageChamp<<"'"<<
+ "; aMeshName = '"<<&aMeshInfo.myName[0]<<"'\n");
+ if(aRet == 0 && (! strcmp(aMaillageChamp,&aMeshInfo.myName[0]))){
+ theGeom2Size[EGeometrieElement(aGeom)] = anGeomIter->second;
+ theEntity = EEntiteMaillage(anEntity);
+ aNbTimeStamps = aNbStamps;
+ }
+ }
}
}
- if(!theGeom.empty())
+ if(!theGeom2Size.empty())
break;
}
return aNbTimeStamps;
}
- void TVWrapper::GetTimeStampInfo(TInt theTimeStampId,
- MED::TTimeStampInfo& theInfo,
- TErr* theErr)
+ void
+ TVWrapper
+ ::GetTimeStampInfo(TInt theTimeStampId,
+ MED::TTimeStampInfo& theInfo,
+ TErr* theErr)
{
TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
- TGeom& aTGeom = theInfo.myGeom;
+ const TGeom2Size& aGeom2Size = theInfo.myGeom2Size;
if(theErr){
- if(aTGeom.empty())
+ if(aGeom2Size.empty())
*theErr = -1;
if(*theErr < 0)
return;
- }else if(aTGeom.empty())
+ }else if(aGeom2Size.empty())
EXCEPTION(runtime_error,"GetTimeStampInfo - There is no any cell");
MED::TFieldInfo& aFieldInfo = *theInfo.myFieldInfo;
MED::TMeshInfo& aMeshInfo = *aFieldInfo.myMeshInfo;
- med_entite_maillage& anEntity = (med_entite_maillage&)(theInfo.myEntity);
-
- TGeom::iterator anIter = aTGeom.begin();
- med_geometrie_element& aGeom = (med_geometrie_element&)(anIter->first);
-
- med_booleen& anIsLocal = (med_booleen&)(aFieldInfo.myIsLocal);
-
- TErr aRet = MEDpasdetempsInfo(myFile->Id(),
- &aFieldInfo.myName[0],
- anEntity,
- aGeom,
- theTimeStampId,
- (med_int *)&theInfo.myNbGauss,
- (med_int *)&theInfo.myNumDt,
- (med_int *)&theInfo.myNumOrd,
- &theInfo.myUnitDt[0],
- &theInfo.myDt,
- &aMeshInfo.myName[0],
- &anIsLocal,
- (med_int *)&aFieldInfo.myNbRef);
- if(theErr)
- *theErr = aRet;
- else if(aRet < 0)
- EXCEPTION(runtime_error,"GetTimeStampInfo - MEDpasdetempsInfo(...)");
-
- static TInt MAX_NB_GAUSS_POINTS = 32;
- if(theInfo.myNbGauss <= 0 || theInfo.myNbGauss > MAX_NB_GAUSS_POINTS)
- theInfo.myNbGauss = 1;
+ TGeom2NbGauss& aGeom2NbGauss = theInfo.myGeom2NbGauss;
+
+ TGeom2Size::const_iterator anIter = aGeom2Size.begin();
+ for(; anIter != aGeom2Size.end(); anIter++){
+ const EGeometrieElement& aGeom = anIter->first;
+ med_int aNbGauss = -1;
+
+ TErr aRet;
+ aRet = MEDpasdetempsInfo(myFile->Id(),
+ &aFieldInfo.myName[0],
+ med_entite_maillage(theInfo.myEntity),
+ med_geometrie_element(anIter->first),
+ theTimeStampId,
+ &aNbGauss,
+ (med_int*)&theInfo.myNumDt,
+ (med_int*)&theInfo.myNumOrd,
+ &theInfo.myUnitDt[0],
+ &theInfo.myDt,
+ &aMeshInfo.myName[0],
+ (med_booleen*)&aFieldInfo.myIsLocal,
+ (med_int*)&aFieldInfo.myNbRef);
+
+ 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(runtime_error,"GetTimeStampInfo - MEDpasdetempsInfo(...)");
+ }
}
- void TVWrapper::GetTimeStampVal(MED::TTimeStampVal& theVal,
- TErr* theErr)
+ void
+ TVWrapper
+ ::GetTimeStampVal(TTimeStampVal& theVal,
+ const TMKey2Profile& theMKey2Profile,
+ const TKey2Gauss& theKey2Gauss,
+ TErr* theErr)
{
TFileWrapper aFileWrapper(myFile,eLECTURE,theErr);
MED::TFieldInfo& aFieldInfo = *aTimeStampInfo.myFieldInfo;
MED::TMeshInfo& aMeshInfo = *aFieldInfo.myMeshInfo;
- med_entite_maillage& anEntity = (med_entite_maillage&)(aTimeStampInfo.myEntity);
- med_mode_profil& aPflMode = (med_mode_profil&)(theVal.myPflMode);
- TGeom& aTGeom = aTimeStampInfo.myGeom;
- TGeom::iterator anIter = aTGeom.begin();
- for(; anIter != aTGeom.end(); anIter++){
- med_geometrie_element& aGeom = (med_geometrie_element&)(anIter->first);
+ TGeom2Gauss& aGeom2Gauss = aTimeStampInfo.myGeom2Gauss;
+ TVector<char> aGaussName(GetNOMLength<eV2_2>()+1);
+
+ med_mode_profil aProfileMode = med_mode_profil(boost::get<0>(theMKey2Profile));
+ MED::TKey2Profile aKey2Profile = boost::get<1>(theMKey2Profile);
+ MED::TGeom2Profile& aGeom2Profile = theVal.myGeom2Profile;
+ TVector<char> aProfileName(GetNOMLength<eV2_2>()+1);
+
+ TGeom2Size& aGeom2Size = aTimeStampInfo.myGeom2Size;
+ TGeom2Size::iterator anIter = aGeom2Size.begin();
+ for(; anIter != aGeom2Size.end(); anIter++){
+ EGeometrieElement aGeom = anIter->first;
+ TInt aNbCells = anIter->second;
+
+ TInt aNbMeshRef = MEDnChampRef(anId,
+ &aFieldInfo.myName[0],
+ med_entite_maillage(aTimeStampInfo.myEntity),
+ med_geometrie_element(aGeom),
+ aTimeStampInfo.myNumDt,
+ aTimeStampInfo.myNumOrd);
+ if(aNbMeshRef < 1){
+ if(theErr){
+ *theErr = MED_FAUX;
+ return;
+ }
+ EXCEPTION(runtime_error,"GetTimeStampVal - MEDnChampRef(...) < 1");
+ }
+
+ TErr aRet;
+ med_int aNbGauss = -1;
+ aRet = MEDchampRefInfo(anId,
+ &aFieldInfo.myName[0],
+ med_entite_maillage(aTimeStampInfo.myEntity),
+ med_geometrie_element(aGeom),
+ aNbMeshRef,
+ aTimeStampInfo.myNumDt,
+ aTimeStampInfo.myNumOrd,
+ &aMeshInfo.myName[0],
+ (med_booleen*)&aFieldInfo.myIsLocal,
+ &aNbGauss);
+
+ if(aRet < 0){
+ if(theErr){
+ *theErr = MED_FAUX;
+ return;
+ }
+ EXCEPTION(runtime_error,"GetTimeStampVal - MEDchampRefInfo(...)");
+ }
+
TInt aNbVal = MEDnVal(anId,
&aFieldInfo.myName[0],
- anEntity,
- aGeom,
+ med_entite_maillage(aTimeStampInfo.myEntity),
+ med_geometrie_element(aGeom),
aTimeStampInfo.myNumDt,
aTimeStampInfo.myNumOrd,
&aMeshInfo.myName[0],
- aPflMode);
+ aProfileMode);
if(aNbVal <= 0){
if(theErr){
*theErr = -1;
EXCEPTION(runtime_error,"GetTimeStampInfo - MEDnVal(...) - aNbVal == "<<aNbVal<<" <= 0");
}
- TValue& aValue = theVal.myMeshValue[EGeometrieElement(aGeom)];
- TInt iEnd = aNbVal*aFieldInfo.myNbComp;
-
- if(iEnd != aValue.size()){
- if(theErr){
- *theErr = -1;
- return;
- }
- EXCEPTION(runtime_error,
- "GetTimeStampInfo - iEnd("<<iEnd<<
- ") != aValue.size()("<<aValue.size()<<
- "); aNbVal = "<<aNbVal<<
- "; anEntity = "<<anEntity<<
- "; aGeom = "<<aGeom);
- }
-
- TErr aRet;
+ TMeshValue& aMeshValue = theVal.GetMeshValue(aGeom);
+ TInt aNbElem = aNbVal / aNbGauss;
+ aMeshValue.Init(aNbElem,
+ aNbGauss,
+ aFieldInfo.myNbComp);
+ TValue& aValue = aMeshValue.myValue;
+ TInt anEnd = aValue.size();
+
switch(aFieldInfo.myType){
case eFLOAT64: {
- std::vector<TFloat> anArray(iEnd);
+ TVector<TFloat> anArray(anEnd);
aRet = MEDchampLire(anId,
&aMeshInfo.myName[0],
&aFieldInfo.myName[0],
(unsigned char*)&anArray[0],
- MED_FULL_INTERLACE,
+ med_mode_switch(theVal.myModeSwitch),
MED_ALL,
- &aTimeStampInfo.myGaussName[0],
- &theVal.myPflName[0],
- aPflMode,
- anEntity,
- aGeom,
+ &aGaussName[0],
+ &aProfileName[0],
+ aProfileMode,
+ med_entite_maillage(aTimeStampInfo.myEntity),
+ med_geometrie_element(aGeom),
aTimeStampInfo.myNumDt,
aTimeStampInfo.myNumOrd);
if(aRet >= 0)
- for(TInt i = 0; i < iEnd; i++)
- aValue[i] = anArray[i];
+ for(TInt anId = 0; anId < anEnd; anId++)
+ aValue[anId] = anArray[anId];
break;
}
default: {
- std::vector<TInt> anArray(iEnd);
+ TVector<TInt> anArray(anEnd);
aRet = MEDchampLire(anId,
&aMeshInfo.myName[0],
&aFieldInfo.myName[0],
(unsigned char*)&anArray[0],
- MED_FULL_INTERLACE,
+ med_mode_switch(theVal.myModeSwitch),
MED_ALL,
- &aTimeStampInfo.myGaussName[0],
- &theVal.myPflName[0],
- aPflMode,
- anEntity,
- aGeom,
+ &aGaussName[0],
+ &aProfileName[0],
+ aProfileMode,
+ med_entite_maillage(aTimeStampInfo.myEntity),
+ med_geometrie_element(aGeom),
aTimeStampInfo.myNumDt,
aTimeStampInfo.myNumOrd);
if(aRet >= 0)
- for(med_int i = 0; i < iEnd; i++)
- aValue[i] = anArray[i];
+ for(TInt anId = 0; anId < anEnd; anId++)
+ aValue[anId] = anArray[anId];
break;
}}
+
if(aRet < 0){
if(theErr){
*theErr = MED_FAUX;
}
EXCEPTION(runtime_error,"GetValTimeStamp - MEDchampLire(...)");
}
+
+ 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],"") != 0){
+ MED::TKey2Profile::const_iterator anIter = aKey2Profile.find(&aProfileName[0]);
+ if(anIter != aKey2Profile.end()){
+ aProfileInfo = anIter->second;
+ aGeom2Profile[aGeom] = aProfileInfo;
+ }
+ }
+
+ if(aNbGauss > 1 && !aGaussInfo){
+ if(theErr){
+ *theErr = MED_FAUX;
+ return;
+ }
+ EXCEPTION(runtime_error,"GetValTimeStamp "<<
+ "- aNbGauss("<<aNbGauss<<") > 1 && !aGaussInfo"<<
+ "; aGaussName = '"<<&aGaussName[0]<<"'"<<
+ "; aGeom = "<<aGeom<<
+ "");
+ }
+
+ if(aGaussInfo && aNbGauss != aGaussInfo->GetNbGauss()){
+ if(theErr){
+ *theErr = MED_FAUX;
+ return;
+ }
+ EXCEPTION(runtime_error,"GetValTimeStamp - aNbGauss != aGaussInfo->GetNbGauss()");
+ }
+
+ if(aProfileInfo && aProfileInfo->IsPresent()){
+ TInt aNbSubCells = aProfileInfo->GetSize();
+
+ TInt aSize = aNbSubCells*aFieldInfo.myNbComp*aNbGauss;
+ if(aSize != aValue.size()){
+ if(theErr){
+ *theErr = -1;
+ return;
+ }
+ EXCEPTION(runtime_error,
+ "GetTimeStampInfo - aSize("<<aSize<<
+ ") != aValue.size()("<<aValue.size()<<
+ "); aNbVal = "<<aNbVal<<
+ "; anEntity = "<<aTimeStampInfo.myEntity<<
+ "; aGeom = "<<aGeom<<
+ "; aNbCells = "<<aNbCells<<
+ "; aNbSubCells = "<<aNbSubCells<<
+ "; aNbComp = "<<aFieldInfo.myNbComp<<
+ "; aNbGauss = "<<aNbGauss<<
+ "");
+ }
+ }else{
+ if(anEnd != aValue.size()){
+ if(theErr){
+ *theErr = -1;
+ return;
+ }
+ EXCEPTION(runtime_error,
+ "GetTimeStampInfo - anEnd("<<anEnd<<
+ ") != aValue.size()("<<aValue.size()<<
+ "); aNbVal = "<<aNbVal<<
+ "; anEntity = "<<aTimeStampInfo.myEntity<<
+ "; aGeom = "<<aGeom<<
+ "; aNbCells = "<<aNbCells<<
+ "; aNbComp = "<<aFieldInfo.myNbComp<<
+ "; aNbGauss = "<<aNbGauss<<
+ "");
+ }
+ }
}
}
- void TVWrapper::SetTimeStamp(const MED::TTimeStampVal& theVal,
- EModeAcces theMode,
- TErr* theErr)
+ void
+ TVWrapper
+ ::SetTimeStamp(const MED::TTimeStampVal& theVal,
+ EModeAcces theMode,
+ TErr* theErr)
{
TFileWrapper aFileWrapper(myFile,theMode,theErr);
TIdt anId = myFile->Id();
MED::TTimeStampVal& aVal = const_cast<MED::TTimeStampVal&>(theVal);
+
MED::TTimeStampInfo& aTimeStampInfo = *aVal.myTimeStampInfo;
MED::TFieldInfo& aFieldInfo = *aTimeStampInfo.myFieldInfo;
MED::TMeshInfo& aMeshInfo = *aFieldInfo.myMeshInfo;
- MED::TMeshValue& aMeshValue = aVal.myMeshValue;
-
- med_entite_maillage& anEntity = (med_entite_maillage&)(aTimeStampInfo.myEntity);
- med_mode_profil& aPflMode = (med_mode_profil&)(theVal.myPflMode);
- TMeshValue::iterator anIter = aMeshValue.begin();
- for(; anIter != aMeshValue.end(); anIter++){
- med_geometrie_element& aGeom = (med_geometrie_element&)(anIter->first);
- TValue& aValue = aVal.myMeshValue[EGeometrieElement(aGeom)];
- med_int iEnd = aValue.size();
- med_int aNbVal = iEnd / aFieldInfo.myNbComp;
+ MED::TGeom2Value& aGeom2Value = aVal.myGeom2Value;
+
+ MED::TGeom2Gauss& aGeom2Gauss = aTimeStampInfo.myGeom2Gauss;
+ MED::TGeom2Profile& aGeom2Profile = aVal.myGeom2Profile;
+
+ TGeom2Value::iterator anIter = aGeom2Value.begin();
+ for(; anIter != aGeom2Value.end(); anIter++){
+ EGeometrieElement aGeom = anIter->first;
+ TMeshValue& aMeshValue = anIter->second;
+
+ TVector<char> aGaussName(GetNOMLength<eV2_2>()+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<eV2_2>()+1);
+ med_mode_profil aProfileMode = med_mode_profil(eNO_PFLMOD);
+ MED::TGeom2Profile::const_iterator aProfileIter = aGeom2Profile.find(aGeom);
+ if(aProfileIter != aGeom2Profile.end()){
+ MED::PProfileInfo aProfileInfo = aProfileIter->second;
+ aProfileMode = med_mode_profil(aProfileInfo->myMode);
+ strcpy(&aProfileName[0],&aProfileInfo->myName[0]);
+ }
+
+ med_int aNbVal = aMeshValue.myNbElem / aFieldInfo.myNbComp;
+ TValue& aValue = aMeshValue.myValue;
+ TInt anEnd = aValue.size();
switch(aFieldInfo.myType){
case eFLOAT64: {
- std::vector<TFloat>& anArray = aValue;
+ TVector<TFloat>& anArray = aValue;
aRet = MEDchampEcr(anId,
&aMeshInfo.myName[0],
&aFieldInfo.myName[0],
(unsigned char*)&anArray[0],
- MED_FULL_INTERLACE,
+ med_mode_switch(theVal.myModeSwitch),
aNbVal,
- &aTimeStampInfo.myGaussName[0],
+ &aGaussName[0],
MED_ALL,
- &aVal.myPflName[0],
- aPflMode,
- anEntity,
- aGeom,
+ &aProfileName[0],
+ aProfileMode,
+ med_entite_maillage(aTimeStampInfo.myEntity),
+ med_geometrie_element(aGeom),
aTimeStampInfo.myNumDt,
&aTimeStampInfo.myUnitDt[0],
aTimeStampInfo.myDt,
break;
}
default: {
- vector<TInt> anArray(iEnd);
- for(TInt i = 0; i< iEnd; i++) anArray[i] = TInt(aValue[i]);
+ vector<TInt> anArray(anEnd);
+ for(TInt anID = 0; anID < anEnd; anID++)
+ anArray[anID] = TInt(aValue[anID]);
aRet = MEDchampEcr(anId,
&aMeshInfo.myName[0],
&aFieldInfo.myName[0],
(unsigned char*)&anArray[0],
- MED_FULL_INTERLACE,
+ med_mode_switch(theVal.myModeSwitch),
aNbVal,
- &aTimeStampInfo.myGaussName[0],
+ &aGaussName[0],
MED_ALL,
- &aVal.myPflName[0],
- aPflMode,
- anEntity,
- aGeom,
+ &aProfileName[0],
+ aProfileMode,
+ med_entite_maillage(aTimeStampInfo.myEntity),
+ med_geometrie_element(aGeom),
aTimeStampInfo.myNumDt,
&aTimeStampInfo.myUnitDt[0],
aTimeStampInfo.myDt,
}
- void TVWrapper::SetTimeStamp(const MED::TTimeStampVal& theVal,
- TErr* theErr)
+ void
+ TVWrapper
+ ::SetTimeStamp(const MED::TTimeStampVal& theVal,
+ TErr* theErr)
{
TErr aRet;
SetTimeStamp(theVal,eLECTURE_ECRITURE,&aRet);
#include "MED_Structures.hxx"
#include "MED_TWrapper.hxx"
-namespace MED{
- namespace V2_2{
+namespace MED
+{
+ template<>
+ TInt
+ GetDESCLength<eV2_2>();
+
+ template<>
+ TInt
+ GetIDENTLength<eV2_2>();
+
+ template<>
+ TInt
+ GetNOMLength<eV2_2>();
+
+ template<>
+ TInt
+ GetLNOMLength<eV2_2>();
+
+ template<>
+ TInt
+ GetPNOMLength<eV2_2>();
- const TInt PNOM = 16;
+ template<>
+ TInt
+ GetNbConn<eV2_2>(EGeometrieElement typmai,
+ EEntiteMaillage typent,
+ TInt mdim);
- typedef MED::TTMeshInfo<PNOM,DESC,IDENT,NOM,LNOM,eV2_2> TVMeshInfo;
+ namespace V2_2
+ {
- typedef MED::TTFamilyInfo<PNOM,DESC,IDENT,NOM,LNOM,eV2_2> TVFamilyInfo;
+ typedef MED::TTMeshInfo<eV2_2> TVMeshInfo;
- typedef MED::TTNodeInfo<PNOM,DESC,IDENT,NOM,LNOM,eV2_2> TVNodeInfo;
+ typedef MED::TTFamilyInfo<eV2_2> TVFamilyInfo;
- typedef MED::TTCellInfo<PNOM,DESC,IDENT,NOM,LNOM,eV2_2> TVCellInfo;
+ typedef MED::TTNodeInfo<eV2_2> TVNodeInfo;
- typedef MED::TTFieldInfo<PNOM,DESC,IDENT,NOM,LNOM,eV2_2> TVFieldInfo;
+ typedef MED::TTCellInfo<eV2_2> TVCellInfo;
- typedef MED::TTTimeStampInfo<PNOM,DESC,IDENT,NOM,LNOM,eV2_2> TVTimeStampInfo;
+ typedef MED::TTFieldInfo<eV2_2> TVFieldInfo;
- typedef MED::TTTimeStampVal<PNOM,DESC,IDENT,NOM,LNOM,eV2_2> TVTimeStampVal;
+ typedef MED::TTTimeStampInfo<eV2_2> TVTimeStampInfo;
+
+ typedef MED::TTTimeStampVal<eV2_2> TVTimeStampVal;
//---------------------------------------------------------------
class TFile;
typedef enum {eLECTURE, eLECTURE_ECRITURE, eLECTURE_AJOUT, eCREATION} EModeAcces;
//---------------------------------------------------------------
- class TVWrapper: public MED::TTWrapper<PNOM,DESC,IDENT,NOM,LNOM,eV2_2>{
+ class TVWrapper: public MED::TTWrapper<eV2_2>
+ {
TVWrapper();
TVWrapper(const TVWrapper&);
TVWrapper& operator=(const TVWrapper&);
void
GetNames(TElemInfo& theInfo,
TInt nb,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
TErr* theErr = NULL);
virtual
void
GetNumeration(TElemInfo& theInfo,
TInt nb,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
TErr* theErr = NULL);
virtual
void
GetFamilies(TElemInfo& theInfo,
TInt nb,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
TErr* theErr = NULL);
virtual
void
SetNames(const TElemInfo& theInfo,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
TErr* theErr = NULL);
void
SetNames(const TElemInfo& theInfo,
EModeAcces theMode,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
TErr* theErr = NULL);
virtual
void
SetNumeration(const TElemInfo& theInfo,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
TErr* theErr = NULL);
void
SetNumeration(const TElemInfo& theInfo,
EModeAcces theMode,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
TErr* theErr = NULL);
virtual
void
SetFamilies(const TElemInfo& theInfo,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
TErr* theErr = NULL);
void
SetFamilies(const TElemInfo& theInfo,
EModeAcces theMode,
- EEntiteMaillage theTEntity,
- EGeometrieElement theTGeom,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
TErr* theErr = NULL);
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
virtual
TInt
GetNbPolygones(const TMeshInfo& theMeshInfo,
- EEntiteMaillage,
- EGeometrieElement,
- EConnectivite,
- TErr* theErr = NULL);
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
+ EConnectivite theConnMode = eNOD,
+ TErr* theErr = NULL);
virtual
TInt
- GetNbPolygoneConn(const TMeshInfo& theMeshInfo,
- EEntiteMaillage,
- EGeometrieElement,
- EConnectivite,
+ GetPolygoneConnSize(const TMeshInfo& theMeshInfo,
+ EEntiteMaillage theEntity,
+ EGeometrieElement theGeom,
+ EConnectivite theConnMode = eNOD,
TErr* theErr = NULL);
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
virtual
void
- GetNbPolyedreConnF(const TMeshInfo& theMeshInfo,
- EConnectivite,
- TInt& nf,
- TInt& nc,
- TErr* theErr = NULL);
+ GetPolyedreConnSize(const TMeshInfo& theMeshInfo,
+ TInt& theNbFaces,
+ TInt& theConnSize,
+ EConnectivite theConnMode = eNOD,
+ TErr* theErr = NULL);
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
virtual
TEntityInfo
GetEntityInfo(const MED::TMeshInfo& theMeshInfo,
- EConnectivite theTConn = eNOD,
+ EConnectivite theConnMode = eNOD,
TErr* theErr = NULL);
virtual
GetNbCells(const MED::TMeshInfo& theMeshInfo,
EEntiteMaillage,
EGeometrieElement,
- EConnectivite theTConn = eNOD,
+ EConnectivite theConnMode = eNOD,
TErr* theErr = NULL);
virtual
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
TInt
GetNbTimeStamps(const MED::TFieldInfo& theInfo,
const MED::TEntityInfo& theEntityInfo,
EEntiteMaillage& theEntity,
- TGeom& theGeom,
+ TGeom2Size& theGeom2Size,
TErr* theErr = NULL);
virtual
virtual
void
GetTimeStampVal(MED::TTimeStampVal& theVal,
+ const TMKey2Profile& theMKey2Profile,
+ const TKey2Gauss& theKey2Gauss,
TErr* theErr = NULL);
virtual