HAVE_SSTREAM=@HAVE_SSTREAM@
-LIBS=@LIBS@
+LIBS=@LIBS@
+LIBSFORBIN=@LIBS@
LDFLAGS=@LDFLAGS@ -L$(top_builddir)/lib/salome -Xlinker -rpath-link -Xlinker -L$(top_builddir)/lib/salome
+LDFLAGSFORBIN=@LDFLAGS@ -L$(top_builddir)/lib/salome -Xlinker -rpath-link -Xlinker -L$(top_builddir)/lib/salome
# add libstdc++ to link c++ library with libtool !
LDFLAGS+= -lstdc++
+LDFLAGSFORBIN+= -lstdc++
CP=@CP@
--- /dev/null
+#=======================================================================
+# This section of this makefile comes from the file
+# 'adm/unix/make_conclude' which was generated with config.status
+# from file adm/unix/make_conclude.in
+#=======================================================================
+# -* Makefile *-
+#
+# Authors : Patrick GOLDBRONN (CEA) - Marc Tajchman (CEA)
+# Date : 6/07/2001
+# $Header$
+#
+
+# ORB Specifics rules
+@CORBA@
+
+# transform idl reference in appropriate obj file
+LIB_CLIENT_SRC = $(LIB_CLIENT_IDL:%.idl=%$(IDL_CLN_CXX))
+LIB_SERVER_SRC = $(LIB_SERVER_IDL:%.idl=%$(IDL_SRV_CXX))
+LIB_MOC_SRC = $(LIB_MOC:%.h=%_moc.cxx)
+LIB_SRC+=$(LIB_MOC_SRC)
+LIB_SWIG_SRC = $(SWIG_DEF:%.i=%_wrap.cxx)
+LIB_DEP= $(LIB_SRC) $(LIB_CLIENT_SRC) $(LIB_SERVER_SRC) $(LIB_SWIG_SRC)
+
+LIB_CLIENT_OBJ = $(LIB_CLIENT_IDL:%.idl=%$(IDL_CLN_OBJ))
+LIB_SERVER_OBJ = $(LIB_SERVER_IDL:%.idl=%$(IDL_SRV_OBJ))
+
+
+# transform c file in appropriate libtool obj file (.c, .cc and .cxx)
+LIB_OBJ_C = $(patsubst %.c, %.lo, $(filter %.c, $(LIB_SRC)))
+LIB_OBJ_CC = $(patsubst %.cc, %.lo, $(filter %.cc, $(LIB_SRC)))
+LIB_OBJ_CXX = $(patsubst %.cxx, %.lo, $(filter %.cxx, $(LIB_SRC)))
+LIB_SWIG_OBJ = $(LIB_SWIG_SRC:%.cxx=%.lo)
+LIB_OBJ_F = $(patsubst %.f, %.lo, $(filter %.f, $(LIB_SRC)))
+
+# all libtool obj file in library
+LIB_OBJ = $(LIB_OBJ_CXX) $(LIB_OBJ_CC) $(LIB_OBJ_C) $(LIB_CLIENT_OBJ:%.o=%.lo) $(LIB_SERVER_OBJ:%.o=%.lo) $(LIB_SWIG_OBJ) $(LIB_OBJ_F)
+
+# LIB_BUILD = $(LIB:%.la=$(top_builddir)/lib/salome/%.la)
+LIB_BUILD = $(patsubst %.la, $(top_builddir)/lib/salome/%.la, $(filter %.la, $(LIB)))
+LIB_BUILD_A = $(patsubst %.a, $(top_builddir)/lib/salome/%.a, $(filter %.a, $(LIB)))
+
+ifneq ($(findstring cmodule.la,$(filter %.la, $(LIB))),)
+LIB_SWIG = $(patsubst %cmodule.la,%.so, $(filter %.la, $(LIB)))
+else
+LIB_SWIG =
+endif
+
+lib: $(LIB_BUILD) $(LIB_CLIENT_PY)
+# we don't build static library !
+
+$(LIB_BUILD): $(top_builddir)/lib/salome/%.la: %.la
+ -$(RM) $@
+ -$(RM) $(patsubst %.la, %.so, $@)
+ -$(RM) $(patsubst %.la, %.a, $@)
+ ln -sf $(CURDIR)/$< $@ || true
+ ln -sf $(patsubst %.la, %.so, $(CURDIR)/.libs/$<) \
+ $(patsubst %.la, %.so, $@) || true
+ ln -sf $(patsubst %.la, %.so, $(CURDIR)/.libs/$<).0 \
+ $(patsubst %.la, %.so, $@).0 || true
+
+ if ! test -z $(LIB_SWIG) ; then \
+ ln -sf $(patsubst %.la,%.so, $(CURDIR)/.libs/$<) $(top_builddir)/lib/salome/_$(LIB_SWIG) || true;\
+ fi;
+
+$(LIB_BUILD_A): $(top_builddir)/lib/salome/%.a: %.a
+ -$(RM) $@
+ ln -sf $(CURDIR)/$< $@ || true
+
+$(LIB): $(LIB_OBJ)
+ @$(LT) --mode=link $(CXX) -rpath $(libdir) -o $@ $(CXXFLAGS) $(LIB_OBJ) $(LDFLAGS) $(LIBS)
+
+# transform idl reference in appropriate obj file
+BIN_CLIENT_SRC = $(BIN_CLIENT_IDL:%.idl=%$(IDL_CLN_CXX))
+BIN_SERVER_SRC = $(BIN_SERVER_IDL:%.idl=%$(IDL_SRV_CXX))
+BIN_MOC_SRC = $(BIN_MOC:%.h=%_moc.cxx)
+BIN_SRC+=$(BIN_MOC_SRC)
+BIN_DEP=$(BIN:%=%.cxx) $(BIN_SRC) $(BIN_CLIENT_SRC) $(BIN_SERVER_SRC)
+
+BIN_CLIENT_OBJ = $(BIN_CLIENT_IDL:%.idl=%$(IDL_CLN_OBJ))
+BIN_SERVER_OBJ = $(BIN_SERVER_IDL:%.idl=%$(IDL_SRV_OBJ))
+# transform c file in appropriate libtool obj file (.c)
+BIN_OBJ_C = $(patsubst %.c, %.o, $(filter %.c, $(BIN_SRC)))
+# transform c++ file in appropriate libtool obj file (.cc and .cxx)
+BIN_OBJ_CC = $(patsubst %.cc, %.o, $(filter %.cc, $(BIN_SRC)))
+BIN_OBJ_CXX = $(patsubst %.cxx, %.o, $(filter %.cxx, $(BIN_SRC)))
+# all obj file in bin target
+BIN_OBJ = $(BIN_OBJ_CC) $(BIN_OBJ_CXX) $(BIN_OBJ_C) $(BIN_CLIENT_OBJ) $(BIN_SERVER_OBJ)
+
+bin: $(BIN:%=$(top_builddir)/bin/salome/%) $(BIN) $(LIB) pyscripts sharedpyscripts
+
+BIN_LIB=$(LIB:lib%.la=-l%)
+
+$(BIN:%=$(top_builddir)/bin/salome/%) $(TEST_PROGS:%=$(top_builddir)/bin/salome/%): $(top_builddir)/bin/salome/%: %
+ -$(RM) $@
+ ln -sf $(CURDIR)/$< $@
+
+$(BIN) $(TEST_PROGS): %: %.lo $(BIN_OBJ)
+ $(CXX) $(CXXFLAGS) -o $@ $^ $(BIN_LIB) $(LDFLAGSFORBIN) $(LIBSFORBIN)
+
+# copy python scripts in $(top_builddir)/bin/salome
+#
+DEST_PYSCRIPTS = $(EXPORT_PYSCRIPTS:%=$(top_builddir)/bin/salome/%)
+pyscripts: $(DEST_PYSCRIPTS)
+$(DEST_PYSCRIPTS): $(top_builddir)/bin/salome/%: %
+ cp -f $< $@
+
+# copy pyqt files in $(PYTHON_SHARED_SITE)
+#
+PYTHON_SHARED_SITE=$(top_builddir)/lib/python$(PYTHON_VERSION)/site-packages/salome/shared_modules
+
+$(PYTHON_SHARED_SITE):
+ $(INSTALL) -d $@
+
+DEST_SHAREDPYSCRIPTS = $(EXPORT_SHAREDPYSCRIPTS:%=$(PYTHON_SHARED_SITE)/%)
+sharedpyscripts: $(PYTHON_SHARED_SITE) $(DEST_SHAREDPYSCRIPTS)
+$(DEST_SHAREDPYSCRIPTS): $(PYTHON_SHARED_SITE)/%: %
+ cp -f $< $@
+
+check: test
+
+tests: test
+
+test: $(LIB) $(TEST_PROGS:%=$(top_builddir)/bin/salome/%)
+
+
+# copy header file in $(inc_builddir)
+#
+DEST_HEADERS = $(EXPORT_HEADERS:%=$(inc_builddir)/%)
+inc: $(DEST_HEADERS)
+$(DEST_HEADERS): $(inc_builddir)/%: %
+ cp -f $< $@
+
+# build resources file (icons and messages) : .qm file from .po file
+resources: $(PO_FILES:%.po=$(top_builddir)/share/salome/resources/%.qm)
+
+# Make installation directories if they don't exist.
+$(libdir) $(includedir) $(bindir) $(datadir) $(idldir) $(sharedpydir):
+ $(INSTALL) -d $@ && chmod 755 $@
+
+# Install the library, the public header files, and programs.
+install: $(LIB) $(BIN) $(TEST_PROGS) $(libdir) $(includedir) $(bindir) $(datadir) $(idldir) install-python install-sharedpyqt install-qm
+ @for f in X $(LIB); do \
+ if test $$f != X; then \
+ ($(LT_INSTALL_LIB) $$f $(libdir)/. || exit 1); \
+ fi; \
+ done
+ @if ! test -z $(LIB_SWIG) ; then \
+ (cd $(libdir); ln -sf $(patsubst %.so, %cmodule.so, $(LIB_SWIG)) _$(LIB_SWIG) || true); \
+ fi;
+ @for f in X $(BIN); do \
+ if test $$f != X; then \
+ ($(LT_INSTALL_PROG) $$f $(bindir)/. || exit 1); \
+ fi; \
+ done
+# Install tests programmes in bindir
+ @for f in X $(TEST_PROGS); do \
+ if test $$f != X; then \
+ ($(LT_INSTALL_PROG) $$f $(bindir)/. || exit 1); \
+ fi; \
+ done
+# Install exported includes in includedir
+ @for f in X $(EXPORT_HEADERS:%=$(srcdir)/%); do \
+ if test $$f != X; then \
+ (cp -p $$f $(includedir) || exit 1); \
+ fi; \
+ done
+
+# Install python script in $(bindir)
+install-python: $(bindir) $(EXPORT_PYSCRIPTS:%=install-%)
+
+$(EXPORT_PYSCRIPTS:%=install-%): install-%: %
+ $(INSTALL_PROGRAM) $< $(bindir)/.
+
+#install-python: $(bindir) $(EXPORT_PYSCRIPTS)
+# @for f in X $(EXPORT_PYSCRIPTS); do \
+# if test $$f != X; then \
+# ($(INSTALL_PROGRAM) $$f $(bindir)/. || exit 1); \
+# fi; \
+# done
+
+# Install pyqt script in $(install-sharedpyqt)
+install-sharedpyqt: $(sharedpydir) $(EXPORT_SHAREDPYSCRIPTS:%=install-%)
+
+$(EXPORT_SHAREDPYSCRIPTS:%=install-%): install-%: %
+ $(INSTALL_PROGRAM) $< $(sharedpydir)/.
+
+
+# generic rule to install .qm files :
+install-qm: resources
+ $(INSTALL) -d $(datadir)/resources
+ @for f in X $(PO_FILES:%.po=$(top_builddir)/share/salome/resources/%.qm); do \
+ if test $$f != X; then \
+ ($(INSTALL_DATA) $$f $(datadir)/resources/. || exit 1); \
+ fi; \
+ done
+
+# Removes those things that `make install' (would have) installed.
+uninstall:
+ @if test "X$(LIB)" != X; then \
+ for f in $(LIB); do \
+ $(LT_UNINSTALL) $(libdir)/$$f; \
+ done; \
+ fi
+ @if test "X$(BIN)" != X; then \
+ for f in $(BIN); do \
+ $(LT_UNINSTALL) $(bindir)/$$f; \
+ done; \
+ fi
+ @for f in X $(TEST_PROGS); do \
+ if test $$f != X; then \
+ $(LT_UNINSTALL) $(bindir)/$$f; \
+ fi; \
+ done
+# Uninstall exported includes in includedir
+ @for f in X $(EXPORT_HEADERS); do \
+ if test $$f != X; then \
+ $(LT_UNINSTALL) $(includedir)/$$f; \
+ fi; \
+ done
+# Uninstall python script in $(bindir)
+ @for f in X $(EXPORT_PYSCRIPTS); do \
+ if test $$f != X; then \
+ $(LT_UNINSTALL) $(bindir)/$$f ; \
+ fi; \
+ done
+
+# Uninstall pyqt script in $(sharedpydir)
+ @for f in X $(EXPORT_SHAREDPYSCRIPTS); do \
+ if test $$f != X; then \
+ $(LT_UNINSTALL) $(sharedpydir)/$$f ; \
+ fi; \
+ done
+
+# Uninstall qm files
+ @for f in X $(PO_FILES:%.po=%.qm); do \
+ if test $$f != X; then \
+ $(LT_UNINSTALL) $(datadir)/resources/$$f ; \
+ fi; \
+ done
+
+# remove all dependencies files
+#
+cleandep:
+ -$(RM) .dep*
+
+# Removes temporary files without removing the final target files. That is,
+# remove things like object files but not libraries or executables.
+#
+mostlyclean: cleandep
+ -$(RM) $(LIB_OBJ) $(LIB_OBJ:.lo=.o)
+ -$(RM) $(BIN_OBJ) $(BIN:%=%.o)
+ -$(RM) $(TEST_OBJ) $(TEST_OBJ:.lo=.o)
+ -$(RM) $(PROG_OBJ) $(PROG_OBJ:.lo=.o) $(MOSTLYCLEAN)
+
+# Like `mostlyclean' except it also removes the final targets: things like
+# libraries and executables. This target doesn't remove any file that
+# is part of the SALOME distribution.
+#
+clean: mostlyclean
+ -$(RM) $(LIB) $(TEST_PROGS) $(BIN) $(CLEAN)
+ -$(RM) TAGS *~ *# core *.core
+ -$(RM) -r .libs
+ -$(RM) $(top_builddir)/lib/salome/$(LIB)
+ -$(RM) $(patsubst %,$(top_builddir)/bin/salome/%, $(BIN))
+ -$(RM) $(patsubst %.la, %.so, $(top_builddir)/lib/salome/$(LIB))
+ -$(RM) $(patsubst %.la, %.a, $(top_builddir)/lib/salome/$(LIB))
+# remove idl generated files (sources)
+ -$(RM) $(LIB_CLIENT_SRC) $(LIB_SERVER_SRC) $(BIN_CLIENT_SRC) $(BIN_SERVER_SRC)
+# remove idl generated files (headers)
+ -$(RM) $(LIB_CLIENT_IDL:%.idl=%$(IDL_CLN_H)) $(LIB_SERVER_IDL:%.idl=%$(IDL_SRV_H))
+ -$(RM) $(BIN_CLIENT_IDL:%.idl=%$(IDL_CLN_H)) $(BIN_SERVER_IDL:%.idl=%$(IDL_SRV_H))
+ -$(RM) $(LIB_MOC_SRC) $(BIN_MOC_SRC)
+ -$(RM) $(LIB_SWIG_SRC)
+
+# Like `clean' except it also removes files that were created by running
+# configure. If you've unpacked the source and built without creating
+# any other files, then `make distclean' will leave only the files that were
+# in the distribution.
+#
+distclean: clean
+ #remove qm file !
+ -$(RM) $(PO_FILES:%.po=%.qm) $(PO_FILES:%.po=$(top_builddir)/share/salome/resources/%.qm)
+ #remove include files
+ -$(RM) $(DEST_HEADERS)
+ -$(RM) $(DISTCLEAN) *.bak *.old *.new .dep*
+ @if test -f $(srcdir)/Makefile.in; then \
+ (@SETX@; $(RM) Makefile); \
+ fi
+
+
+#implicits rules
+.cc.o:
+ $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $<
+
+.cc.lo:
+ $(LT) --mode=compile $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $<
+
+.cxx.o:
+ $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $<
+
+.cxx.lo:
+ $(LT) --mode=compile $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $<
+
+.c.o:
+ $(CC) $(CFLAGS) $(CPPFLAGS) -c $<
+
+.c.lo:
+ $(LT_COMPILE) $(CFLAGS) $(CPPFLAGS) -c $<
+
+.f.o:
+ $(FC) $(FFLAGS) -c $< -o $@
+
+.f.lo:
+ $(LT) --mode=compile $(FC) $(FFLAGS) -c $<
+
+.ui.h:
+ $(UIC) -o $@ $<
+
+.ui.cxx:
+ $(UIC) -o $@ -i $*.h $<
+
+#pattern rules
+%_moc.cxx : %.h
+ $(MOC) $< -o $@
+
+%_wrap.cxx : %.i
+ $(SWIG) $(SWIG_FLAGS) -o $@ $<
+
+$(top_builddir)/share/salome/resources/%.qm: %.po
+ if test -e ${KERNEL_ROOT_DIR}/bin/salome/msg2qm ; then \
+ ${KERNEL_ROOT_DIR}/bin/salome/msg2qm $< $@ ; \
+ else \
+ $(top_builddir)/bin/salome/msg2qm $< $@ ; \
+ fi
+
+#------------------------------------------------------------------------------
+# The following section of this makefile contains dependencies between the
+# source files and the header files. If GNU make and GCC are being used then
+# the dependencies are in the form of rules that cause the information to
+# be kept updated automatically. Otherwise the dependencies are listed
+# explicitly and come from the `.distdep' files in the various directories.
+# These files are part of the distribution and are generated automatically on
+# GNU/GCC systems.
+#------------------------------------------------------------------------------
+
+@DEPEND@
dnl generals files which could be included in every makefile
AC_SUBST_FILE(COMMENCE) COMMENCE=adm_local/unix/make_commence
-AC_SUBST_FILE(CONCLUDE) CONCLUDE=salome_adm/unix/make_conclude
+AC_SUBST_FILE(CONCLUDE) CONCLUDE=adm_local/unix/make_conclude
AC_SUBST_FILE(MODULE) MODULE=salome_adm/unix/make_module
dnl les dependences
--- /dev/null
+//=============================================================================
+// File : Med_Gen.idl
+// Project : SALOME
+// Copyright : EDF 2001
+//=============================================================================
+
+#ifndef _Med_GEN_IDL_
+#define _Med_GEN_IDL_
+
+
+#include "SALOME_Exception.idl"
+#include "SALOME_Component.idl"
+#include "SALOMEDS.idl"
+#include "MED.idl"
+
+module SALOME_MED
+{
+ interface MED_Gen : Engines::Component, SALOMEDS::Driver
+ {
+ SALOME_MED::MESH readMeshInFile(in string fileName,
+ in string studyName,
+ in string meshName )
+ raises (SALOME::SALOME_Exception);
+ SALOME_MED::FIELD readFieldInFile(in string fileName,
+ in string studyName,
+ in string fieldName,
+ in long ordre,
+ in long iter )
+ raises (SALOME::SALOME_Exception);
+ SALOME_MED::MED readStructFile(in string fileName,
+ in string studyName )
+ raises (SALOME::SALOME_Exception);
+
+ void readStructFileWithFieldType(in string fileName,
+ in string studyName )
+ raises (SALOME::SALOME_Exception);
+ };
+
+};
+
+#endif
IDL_FILES = \
MED.idl \
- Med_Gen.idl \
+ MED_Gen.idl \
Compo1Py.idl
PY_CLIENT_IDL = $(IDL_FILES)
+++ /dev/null
-//=============================================================================
-// File : Med_Gen.idl
-// Project : SALOME
-// Copyright : EDF 2001
-//=============================================================================
-
-#ifndef _Med_GEN_IDL_
-#define _Med_GEN_IDL_
-
-
-#include "SALOME_Exception.idl"
-#include "SALOME_Component.idl"
-#include "SALOMEDS.idl"
-#include "MED.idl"
-
-module Engines
-{
- interface Med_Gen : Engines::Component, SALOMEDS::Driver
- {
- SALOME_MED::MESH readMeshInFile(in string fileName,
- in string studyName,
- in string meshName )
- raises (SALOME::SALOME_Exception);
- SALOME_MED::FIELD readFieldInFile(in string fileName,
- in string studyName,
- in string fieldName,
- in long ordre,
- in long iter )
- raises (SALOME::SALOME_Exception);
- SALOME_MED::MED readStructFile(in string fileName,
- in string studyName )
- raises (SALOME::SALOME_Exception);
-
- void readStructFileWithFieldType(in string fileName,
- in string studyName )
- raises (SALOME::SALOME_Exception);
- };
-
-};
-
-#endif
med=salome.lcc.FindOrLoadComponent("FactoryServer", "MED")
import os
-filePath=os.getenv("SALOME_BUILD")
-filePath=filePath+"/../SALOME_ROOT/data/"
+#
+#befor running this script, please be sure about the path the file fileName
+#
+filePath=os.environ["MED_ROOT_DIR"]
+filePath=filePath+"/share/salome/resources/"
fileName="pointe.med"
fileTout=filePath+fileName
print fileTout
med.readStructFile(fileTout,salome.myStudyName)
-
import SALOME
import os
-filePath=os.getenv("SALOME_BUILD")
-filePath=filePath+"/../SALOME_ROOT/data/"
+filePath=os.environ["MED_ROOT_DIR"]
+filePath=filePath+"/share/salome/resources/"
+medFile=filePath+"mesh.med"
med=salome.lcc.FindOrLoadComponent("FactoryServer", "MED")
try:
- mesh=med.readMeshInFile(filePath+"/mesh.med", salome.myStudyName,"Mesh 1")
+ mesh=med.readMeshInFile(medFile, salome.myStudyName,"Mesh 1")
except SALOME.SALOME_Exception, ex:
print ex.details
print ex.details.type
print mesh.getName()
print mesh.getNumberOfNodes()
+medFile = filePath+"pointe.med"
try:
- field=med.readFieldInFile(filePath+"/pointe.med",salome.myStudyName,"fieldcelldouble",-1,-1)
+ field=med.readFieldInFile(medFile,salome.myStudyName,"fieldcelldouble",-1,-1)
except SALOME.SALOME_Exception, ex:
print ex.details
print ex.details.type
LIB = libMEDEngine.la
LIB_SRC = Med_Gen_i.cxx
-LIB_SERVER_IDL = Med_Gen.idl SALOME_Component.idl \
+LIB_SERVER_IDL = MED_Gen.idl SALOME_Component.idl \
SALOME_Exception.idl MED.idl
LIB_CLIENT_IDL = SALOMEDS.idl SALOMEDS_Attributes.idl SALOME_ModuleCatalog.idl
CPPFLAGS += $(OCC_INCLUDES) $(MED2_INCLUDES) $(HDF5_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome
CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome
-LDFLAGS+= $(OCC_LIBS) $(HDF5_LIBS) -lSalomeContainer -lSalomeHDFPersist -lSalomeDS -lSalomeNS -lRegistry -lOpUtil -lmedmem -lMEDImpl -L${KERNEL_ROOT_DIR}/lib/salome
+LDFLAGS+= $(OCC_LIBS) $(HDF5_LIBS) -lSalomeContainer -lSalomeHDFPersist -lSalomeDS -lSalomeNS -lRegistry -lOpUtil -lMEDMEMImpl -L${KERNEL_ROOT_DIR}/lib/salome
MED.hh MEDSK.cc: MED.idl
// Module : MED
// $Header$
-using namespace std;
using namespace std;
#include "Med_Gen_i.hxx"
-#include "Mesh_i.hxx"
-#include "Med_i.hxx"
-#include "FieldInt_i.hxx"
-#include "FieldDouble_i.hxx"
-#include "Support_i.hxx"
+#include "MEDMEM_Mesh_i.hxx"
+#include "MEDMEM_Med_i.hxx"
+#include "MEDMEM_FieldInt_i.hxx"
+#include "MEDMEM_FieldDouble_i.hxx"
+#include "MEDMEM_Support_i.hxx"
#include "MEDMEM_Mesh.hxx"
#include <HDFascii.hxx>
#include "SALOMEDS_Tool.hxx"
+using namespace MEDMEM;
+
// Initialisation des variables statiques
map <string, string> Med_Gen_i::_MedCorbaObj;
string Med_Gen_i::_myFileName="";
if ( !Comp->_is_nil() ) {
aName->SetValue( Comp->componentusername() );
}
- aBuilder->DefineComponentInstance(aFather, Med_Gen::_this());
+ aBuilder->DefineComponentInstance(aFather, MED_Gen::_this());
}
if (CORBA::is_nil(theSObject)) {
#include <SALOMEconfig.h>
#include <map>
-#include CORBA_SERVER_HEADER(Med_Gen)
+#include CORBA_SERVER_HEADER(MED_Gen)
#include CORBA_SERVER_HEADER(MED)
#include CORBA_SERVER_HEADER(SALOME_ModuleCatalog)
#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
class Med_Gen_i:
- public POA_Engines::Med_Gen,
+ public POA_SALOME_MED::MED_Gen,
public Engines_Component_i
{
private:
LIB_MOC = MedGUI.h
LIB_CLIENT_IDL = SALOMEDS.idl SALOME_Exception.idl \
- Med_Gen.idl MED.idl \
+ MED_Gen.idl MED.idl \
SALOMEDS_Attributes.idl
# SMESH_Mesh.idl SMESH_Hypothesis.idl SMESH_BasicHypothesis.idl \
# GEOM_Shape.idl SALOMEDS_Attributes.idl
CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome
CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome
-LDFLAGS += -lSalomeGUI -lmedmem -lMEDImpl -lMEDEngine -L${KERNEL_ROOT_DIR}/lib/salome
+LDFLAGS += -lSalomeGUI -lMEDMEMImpl -lmedmem -lMEDEngine -L${KERNEL_ROOT_DIR}/lib/salome
MED.hh MEDSK.cc: MED.idl
int myStudyId = myActiveStudy->getStudyId();
// load MED engine
- Engines::Med_Gen_ptr medgen = InitMedGen(parent);
+ SALOME_MED::MED_Gen_ptr medgen = InitMedGen(parent);
// Selection du Fichier
file = QAD_FileDlg::getFileName(parent,
int myStudyId = myActiveStudy->getStudyId();
// load MED engine
- Engines::Med_Gen_ptr medgen = InitMedGen(parent);
+ SALOME_MED::MED_Gen_ptr medgen = InitMedGen(parent);
// Selection du Fichier
file = QAD_FileDlg::getFileName(parent,
int myStudyId = myActiveStudy->getStudyId();
// load MED engine
- Engines::Med_Gen_ptr medgen = InitMedGen(parent);
+ SALOME_MED::MED_Gen_ptr medgen = InitMedGen(parent);
// Selection du Fichier
file = QAD_FileDlg::getFileName(parent,
int k = MEDMesh->getNumberOfNodes() ;
SCRUTE(k);
- Engines::double_array_var coords = MEDMesh->getCoordinates( SALOME_MED::MED_FULL_INTERLACE );
+ SALOME_MED::double_array_var coords = MEDMesh->getCoordinates( SALOME_MED::MED_FULL_INTERLACE );
int i = 0;
int lu = 0;
while (lu < k ) {
SCRUTE(identfam);
int nbelemnts=Families[k]->getNumberOfElements(SALOME_MED::MED_NONE);
SCRUTE(nbelemnts);
- Engines::long_array_var tabnoeuds=Families[k]->getNumber(SALOME_MED::MED_NONE);
+ SALOME_MED::long_array_var tabnoeuds=Families[k]->getNumber(SALOME_MED::MED_NONE);
for (int l=0;l<tabnoeuds->length();l++)
SCRUTE(tabnoeuds[l]);
}
// SCRUTE(nomFam);
// int identfam=Family->getIdentifier();
// SCRUTE(identfam);
- // Engines::long_array_var tabnoeuds=Family->getNumber(SALOME_MED::MED_NONE);
+ // SALOME_MED::long_array_var tabnoeuds=Family->getNumber(SALOME_MED::MED_NONE);
// for (int l=0;l<tabnoeuds->length();l++)
// SCRUTE(tabnoeuds[l]);
// if ( Fam->_is_nil() )
// return false;
-// Engines::long_array_var tabnoeuds=Fam->getNumber(SALOME_MED::MED_NONE);
+// SALOME_MED::long_array_var tabnoeuds=Fam->getNumber(SALOME_MED::MED_NONE);
// for (int l=0;l<tabnoeuds->length();l++)
// SCRUTE(tabnoeuds[l]);
if ( Fam->_is_nil() )
return false;
- Engines::long_array_var tabnoeuds=Fam->getNumber(SALOME_MED::MED_NONE);
+ SALOME_MED::long_array_var tabnoeuds=Fam->getNumber(SALOME_MED::MED_NONE);
for (int l=0;l<tabnoeuds->length();l++)
SCRUTE(tabnoeuds[l]);
*
*/
//=============================================================================
-Engines::Med_Gen_ptr MedGUI::InitMedGen(QAD_Desktop* parent)
+SALOME_MED::MED_Gen_ptr MedGUI::InitMedGen(QAD_Desktop* parent)
{
Engines::Component_var comp =
parent->getEngine("FactoryServer", "MED");
MESSAGE("_________________________________________");
- Engines::Med_Gen_var clr = Engines::Med_Gen::_narrow(comp);
+ SALOME_MED::MED_Gen_var clr = SALOME_MED::MED_Gen::_narrow(comp);
ASSERT(!CORBA::is_nil(clr));
return clr._retn();
}
#include "QAD_StudyFrame.h"
#include <SALOMEconfig.h>
-#include CORBA_CLIENT_HEADER(Med_Gen)
+#include CORBA_CLIENT_HEADER(MED_Gen)
//#include CORBA_CLIENT_HEADER(SMESH_Mesh)
#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
static void ActiveStudyChanged ( QAD_Desktop* parent );
- static Engines::Med_Gen_ptr InitMedGen(QAD_Desktop* parent);
+ static SALOME_MED::MED_Gen_ptr InitMedGen(QAD_Desktop* parent);
static bool DumpMesh( SALOME_MED::MESH_var aMesh );
// static bool DumpSubMesh( SMESH::SMESH_subMesh_ptr aSubMesh ) ;
A simple test program (testUArray) allows to test this class.
*/
+namespace MEDMEM {
template <class T> class MEDARRAY
{
private :
bool isOtherCalculated() const {return (const T*)_valuesOther != NULL;}
void clearOtherMode();
};
+}
//-------------------------------------------------//
// //
#include "utilities.h"
#include "MEDMEM_CellModel.hxx"
+using namespace MEDMEM;
CELLMODEL::CELLMODEL(medGeometryElement t)
{
}
}
-ostream & operator<<(ostream &os,const CELLMODEL &my)
+ostream & MEDMEM::operator<<(ostream &os,const CELLMODEL &my)
{
os << "Cell Model :" << endl ;
os << " - name : " << my._name << endl;
}
return os;
}
+/*
+*/
// Return number of constituents type (which dimension is _dimension-1).
int CELLMODEL::getNumberOfConstituentsType() const
the cell model it describes as cell dimensions, number of nodes...
*/
+namespace MEDMEM {
class CELLMODEL
{
map<medGeometryElement,int> getNumberOfConstituentsForeachType() const;
+};
};
// ------------------------------------------
// Methodes Inline
// ------------------------------------------
+using namespace MEDMEM;
inline CELLMODEL::CELLMODEL():
_type(MED_NONE),
_dimension(0),
#include "MEDMEM_STRING.hxx"
#include <iomanip>
+using namespace MEDMEM;
/*!
Default Constructor. /n
Default for Entity is MED_CELL and type of Connectivity is MED_NODAL */
}
-ostream & operator<<(ostream &os, CONNECTIVITY &co)
+ostream & MEDMEM::operator<<(ostream &os, CONNECTIVITY &co)
{
os << endl << "------------- Entity = ";
switch (co._entity)
using namespace MED_EN;
+namespace MEDMEM {
class MEDSKYLINEARRAY;
class CELLMODEL;
class FAMILY;
const med_int* getNeighbourhood() const;
+};
};
/*----------------------*/
/* Methodes Inline */
/*----------------------*/
+using namespace MEDMEM;
/*! Returns the medEntityMesh */
//--------------------------------------------------//
#include "MEDMEM_STRING.hxx"
#include "utilities.h"
+using namespace MEDMEM;
/*! Default Constructor : should not be used */
//----------------------------------------------------------//
spaceDimension and numberOfNodes can be found in _coordinate object.
*/
+namespace MEDMEM {
class COORDINATE
{
const string * getCoordinatesUnits() const;
string getCoordinateUnit(int Axis) const;
};
+};
#endif /* COORDINATE_HXX */
#include "MEDMEM_Mesh.hxx"
#include "MEDMEM_Group.hxx"
#include <algorithm>
+using namespace MEDMEM;
// Cet opérateur permet d'ordonner les mailles dans un set suivant l'ordre requis par MED
END_OF(LOC);
};
-std::ostream& operator << (std::ostream& os, const _maille& ma)
+std::ostream& MEDMEM::operator << (std::ostream& os, const _maille& ma)
{
os << "maille " << ma.ordre << " (" << ma.geometricType << ") : < ";
std::vector< std::map<int,_noeud>::iterator >::const_iterator i=ma.sommets.begin();
return os;
}
-std::ostream& operator << (std::ostream& os, const _groupe& gr)
+std::ostream& MEDMEM::operator << (std::ostream& os, const _groupe& gr)
{
os << "--- Groupe " << gr.nom << " --- " << std::endl ;
os << " -> liste des sous-groupes : ";
return os;
}
-std::ostream& operator << (std::ostream& os, const _noeud& no)
+std::ostream& MEDMEM::operator << (std::ostream& os, const _noeud& no)
{
os << "noeud " << no.number << " : < ";
std::vector<double>::const_iterator i=no.coord.begin();
return os;
}
-std::ostream& operator << (std::ostream& os, const _intermediateMED& mi)
+std::ostream& MEDMEM::operator << (std::ostream& os, const _intermediateMED& mi)
{
os << "Set des mailles : " << std::endl;
for( std::set<_maille>::const_iterator i=mi.maillage.begin(); i!=mi.maillage.end(); ++i)
#include <map>
#include <iostream>
+namespace MEDMEM {
class MESH;
class CONNECTIVITY;
class COORDINATE;
class GROUP;
-
struct _noeud
{
mutable int number;
std::ostream& operator << (std::ostream& , const _noeud& );
std::ostream& operator << (std::ostream& , const _intermediateMED& );
+};
#endif /* DRIVERTOOLS_HXX */
assert( table.find( (int)MED_PYRA13 ) != table.end() ) ;
}
-// GEO_NAME::~GEO_NAME()
-// {
+GEO_NAME::~GEO_NAME()
+{
// MESSAGE(" destructor GEO_NAME::~GEO_NAME() "<< size() );
-// // clear();
+// clear();
// MESSAGE(" end of destructor GEO_NAME::~GEO_NAME() "<< size() );
-// }
+}
string & GEO_NAME::operator[]( const med_geometrie_element &c ) const
{
table[(int)MED_NOEUD ] = "MED_NOEUD";
}
-// ENT_NAME::~ENT_NAME()
-// {
+ENT_NAME::~ENT_NAME()
+{
// MESSAGE(" destructor ENT_NAME::~ENT_NAME() "<< size() );
-// // clear();
+// clear();
// MESSAGE(" end of destructor ENT_NAME::~ENT_NAME() "<< size() );
-// }
+}
string & ENT_NAME::operator[]( const med_entite_maillage &c ) const
{
}
-// MESH_ENTITIES::~MESH_ENTITIES()
-// {
+MESH_ENTITIES::~MESH_ENTITIES()
+{
// MESSAGE(" destructor MESH_ENTITIES::~MESH_ENTITIES() "<< size() );
-// // clear();
+// clear();
// MESSAGE(" end of destructor MESH_ENTITIES::~MESH_ENTITIES() "<< size() );
-// }
+}
const list<med_geometrie_element> & MESH_ENTITIES::operator[]( const med_entite_maillage &c ) const
{
#include "MEDMEM_define.hxx"
#include "utilities.h"
-namespace MED_FR
-{
+namespace MED_FR {
/*! This Class inherits from map. /n
It is a constant map association int (which is a med_geometrie_element) and string. /n
public :
GEO_NAME();
- // ~GEO_NAME();
+ ~GEO_NAME();
string & operator[]( const MED_FR::med_geometrie_element &c ) const;
} ;
public :
ENT_NAME ();
- // ~ENT_NAME();
+ ~ENT_NAME();
string & operator[]( const MED_FR::med_entite_maillage &c ) const;
} ;
public :
MESH_ENTITIES ();
- // ~MESH_ENTITIES();
+ ~MESH_ENTITIES();
const list<MED_FR::med_geometrie_element> & operator[]( const MED_FR::med_entite_maillage &c ) const;
private:
#include "utilities.h"
#include "MEDMEM_Exception.hxx"
+using namespace MEDMEM;
extern "C"
{
Operator << : put the message to the given stream.
*/
// ------------------------------------------------------- //
-ostream & operator<<( ostream &os , const MEDEXCEPTION &ex )
+ostream & MEDMEM::operator<<( ostream &os , const MEDEXCEPTION &ex )
// ------------------------------------------------------- //
{
os << ex._text ;
Class used to throws exception.\n
Inherits from public exception.
*/
+namespace MEDMEM {
//--------------------------------------//
class MEDEXCEPTION : public exception
//--------------------------------------//
~MED_DRIVER_NOT_FOUND_EXCEPTION() throw();
};
+};
#endif /* MEDEXCEPTION_HXX */
#include "MEDMEM_Mesh.hxx"
#include "MEDMEM_Family.hxx"
+using namespace MEDMEM;
FAMILY::FAMILY():_identifier(0), _numberOfAttribute(0),
_attributeIdentifier((int*)NULL),_attributeValue((int*)NULL), _attributeDescription((string*)NULL),
return *this;
};
-ostream & operator<<(ostream &os, FAMILY &myFamily)
+ostream & MEDMEM::operator<<(ostream &os, FAMILY &myFamily)
{
// how do cast without duplicate ?
os << (SUPPORT) myFamily;
All families on one entity represent a mesh partition for this entity.
*/
-
+namespace MEDMEM {
class FAMILY : virtual public SUPPORT
{
protected :
inline string getAttributeDescription(int i) const;
inline string getGroupName(int i) const;
};
+};
+using namespace MEDMEM;
// inline methods :
-
/*! Sets the attribute _identifier to Identifier. */
//----------------------------------------------
inline void FAMILY::setIdentifier(int Identifier)
{
return _groupName[i-1] ;
}
-
-
#endif /* FAMILY_HXX */
using namespace std;
#include "MEDMEM_Field.hxx"
+using namespace MEDMEM;
// ---------------------------------
// FIELD_ : Constructors
*/
+namespace MEDMEM {
class FIELD_ // GENERIC POINTER TO a template <class T> class FIELD
{
protected:
inline med_type_champ getValueType () const;
};
+};
// ---------------------------------
// Implemented Methods : constructor
// ---------------------------------
+using namespace MEDMEM;
// -----------------
// Methodes Inline
*/
+namespace MEDMEM {
template <class T> class FIELD : public FIELD_
{
*/
void getBarycenter() const throw (MEDEXCEPTION) ;
};
+};
// --------------------
// Implemented Methods
// --------------------
+using namespace MEDMEM;
/*!
Constructor with no parameter, most of the attribut members are set to NULL.
/*!
Constructor with parameters such that all attrribut are set but the _value
- attrribut is allocated but not set.
+ attribut is allocated but not set.
*/
template <class T> FIELD<T>::FIELD(const SUPPORT * Support,
const int NumberOfComponents, const medModeSwitch Mode) throw (MEDEXCEPTION) :
#include "MEDMEM_GenDriver.hxx"
#include "MEDMEM_STRING.hxx"
#include "MEDMEM_Exception.hxx"
+using namespace MEDMEM;
GENDRIVER::GENDRIVER(): _id(MED_INVALID),
_fileName(""),
GENDRIVER::~GENDRIVER() {}
-GENDRIVER & GENDRIVER::operator=(const GENDRIVER & genDriver) {
+GENDRIVER & MEDMEM::GENDRIVER::operator=(const GENDRIVER & genDriver)
+{
const char * LOC = " GENDRIVER & GENDRIVER::operator=(const GENDRIVER & genDriver) : ";
BEGIN_OF(LOC);
-
_fileName = genDriver._fileName;
_accessMode = genDriver._accessMode;
_status = genDriver._status;
END_OF(LOC);
}
-ostream & operator<<(ostream &os,const GENDRIVER & drv)
+ostream & MEDMEM::operator<<(ostream &os,const GENDRIVER & drv)
{
switch (drv._accessMode)
{
}
// Test if this driver has been created from MED driver
-bool GENDRIVER::operator ==(const GENDRIVER &genDriver) const {
+bool MEDMEM::GENDRIVER::operator ==(const GENDRIVER &genDriver) const {
const char * LOC = "bool GENDRIVER::operator ==(const GENDRIVER &genDriver) const : ";
/* Generic Read/Write Driver Class for Meshes & Fields */
-/* Modify the following line to add a new driver type (step 1) */
-typedef enum { MED_DRIVER = 0, GIBI_DRIVER = 1, VTK_DRIVER = 254, NO_DRIVER = 255 } driverTypes;
using namespace MED_EN;
using namespace std;
Virtual class GENDRIVER use by all driver.
*/
+namespace MEDMEM {
+/* Modify the following line to add a new driver type (step 1) */
+typedef enum { MED_DRIVER = 0, GIBI_DRIVER = 1, VTK_DRIVER = 254, NO_DRIVER = 255 } driverTypes;
class GENDRIVER {
protected :
void setFileName ( const string & fileName);
med_mode_acces getAccessMode() const;
};
+};
#endif /* GENDRIVER_HXX */
/////
using namespace MED_EN;
+using namespace MEDMEM;
/////
#include <iomanip>
/////
-class MESH;
-class FAMILY;
-class GROUP;
-class CONNECTIVITY;
-
/*!
Driver GIBI for MESH.
*/
-
+namespace MEDMEM {
+class MESH;
+class FAMILY;
+class GROUP;
+class CONNECTIVITY;
class GIBI_MESH_DRIVER : public GENDRIVER
{
protected:
GENDRIVER * copy(void) const ;
};
+};
#endif /* GIBI_MESH_DRIVER_HXX */
#include "MEDMEM_Grid.hxx"
#include <MEDMEM_CellModel.hxx>
#include <MEDMEM_SkyLineArray.hxx>
+using namespace MEDMEM;
//=======================================================================
//function : GRID
// class containing structured mesh data
+namespace MEDMEM {
class GRID: public MESH
{
protected:
friend class MED_MESH_WRONLY_DRIVER;
};
+};
+using namespace MEDMEM;
//----------------------------------//
#include "MEDMEM_Group.hxx"
#include "MEDMEM_Family.hxx"
+using namespace MEDMEM;
GROUP::GROUP():_numberOfFamilies(0),_family()
{
return *this;
};
-ostream & operator<<(ostream &os, GROUP &myGroup)
+ostream & MEDMEM::operator<<(ostream &os, GROUP &myGroup)
{
os << (SUPPORT) myGroup;
it++ ;
}
- MESSAGE(LOC<<"Printing of the object GROUP built "<< *this);
+ MESSAGE(LOC<<"Printing of the object GROUP built "<< (GROUP)*this);
END_OF(LOC);
};
#include <vector>
#include <list>
-//#include "MEDMEM_Support.hxx"
#include "MEDMEM_Family.hxx"
-class FAMILY;
/*!
*/
+namespace MEDMEM {
+class FAMILY;
class GROUP : virtual public SUPPORT
{
protected :
inline FAMILY * getFamily(int i) const ;
};
+};
// inline method :
+using namespace MEDMEM;
/*! set the attribut _numberOfFamilies to numberOfFamilies */
//----------------------------------------------------------
// les classes de wrapping
+namespace MEDMEM {
template <int DIMENSION> class Wrapper_Noeud
{
protected :
}
int size() const {return nbr_noeuds;}
};
+};
#endif
# include "MEDMEM_Exception.hxx"
# include "utilities.h"
+using namespace MEDMEM;
/*!
Constructor.
# include "MEDMEM_VtkMedDriver.hxx"
# include "MEDMEM_Exception.hxx"
-//using namespace MED_EN;
+using namespace MED_EN;
+namespace MEDMEM {
class MESH;
class FIELD_;
class SUPPORT ;
//friend ostream & operator<<(ostream &os,const MED & med);
};
+};
#endif
//using namespace MED_FR ;
+namespace MEDMEM {
template <class T> class FIELD;
// A QD LA CLASSE MED_ALL_ELEMENTS_DRIVER.... :) pour mutualiser le open ..... avec led _medIdt...
GENDRIVER * copy( void ) const ;
};
+}
/*-------------------------*/
/* template implementation */
/*-------------------------*/
+using namespace MEDMEM;
/*--------------------- DRIVER PART -------------------------------*/
template <class T> void MED_FIELD_DRIVER<T>::setFieldName(const string & fieldName)
MED_FIELD_RDONLY_DRIVER<T>::read();
END_OF("MED_FIELD_RDWR_DRIVER::read(void)");
}
-
/*-----------------------------------------------------------------*/
#endif /* MED_FIELD_DRIVER_HXX */
# include "MEDMEM_define.hxx"
using namespace MED_FR;
+using namespace MEDMEM;
MED_MED_DRIVER::MED_MED_DRIVER(): GENDRIVER(),
_ptrMed((MED * const)MED_NULL),_medIdt(MED_INVALID)
#include "MEDMEM_STRING.hxx"
#include "utilities.h"
#include "MEDMEM_Exception.hxx"
-
#include "MEDMEM_GenDriver.hxx"
-
#include "MEDMEM_define.hxx"
-//using namaspace MED_FR ;
-
-class MESH;
-class FIELD_;
-class MED;
-
/*!
Driver Med for MED.
*/
// This driver pilots within a MED class read/write accesses of fields/meshes
+namespace MEDMEM {
+class MESH;
+class FIELD_;
+class MED;
+
class MED_MED_DRIVER : public GENDRIVER
{
protected:
virtual GENDRIVER * copy ( void ) const ;
};
+};
#endif /* MED_MED_DRIVER_HXX */
#include "MEDMEM_CellModel.hxx"
#include "MEDMEM_Grid.hxx"
+using namespace MEDMEM;
extern "C" {
extern med_idt _MEDdatagroupOuvrir(med_idt pid, char *nom);
extern med_err _MEDdatagroupFermer(med_idt id);
#include "MEDMEM_Exception.hxx"
#include "utilities.h"
-class MESH;
-class FAMILY;
-class GROUP;
-class CONNECTIVITY;
-
/*!
Driver Med for MESH.
*/
+namespace MEDMEM {
+class MESH;
+class FAMILY;
+class GROUP;
+class CONNECTIVITY;
class MED_MESH_DRIVER : public GENDRIVER
{
protected:
GENDRIVER * copy(void) const ;
};
+};
#endif /* MED_MESH_DRIVER_HXX */
#include "MEDMEM_Coordinate.hxx"
#include "MEDMEM_Connectivity.hxx"
#include "MEDMEM_CellModel.hxx"
+using namespace MEDMEM;
//#include "MEDMEM_Grid.hxx" this inclision should have never be here !!!
//update Families with content list
// return N;
// }
-ostream & operator<<(ostream &os, const MESH &myMesh)
+ostream & MEDMEM::operator<<(ostream &os, const MESH &myMesh)
{
int spacedimension = myMesh.getSpaceDimension();
int meshdimension = myMesh.getMeshDimension();
#include "MEDMEM_VtkMeshDriver.hxx"
-class CELLMODEL;
-class FAMILY;
-class GROUP;
-class SUPPORT;
-template <class T> class FIELD;
//class GENDRIVER;
//class MED_MESH_RDONLY_DRIVER;
*/
+namespace MEDMEM {
+
+template <class T> class FIELD;
+
+class CELLMODEL;
+class FAMILY;
+class GROUP;
+class SUPPORT;
class MESH
{
*/
SUPPORT * intersectSupports(const vector<SUPPORT *> Supports) const throw (MEDEXCEPTION) ;
};
+};
+using namespace MEDMEM;
// ---------------------------------------
// Methodes Inline
// ---------------------------------------
throw MEDEXCEPTION("MESH::getNumberOfGroups : Unknown entity");
}
}
-const vector<FAMILY*> MESH::getFamilies(medEntityMesh entity) const
+const vector<MEDMEM::FAMILY*> MESH::getFamilies(medEntityMesh entity) const
{
switch (entity) {
case MED_NODE :
}
}
-const FAMILY* MESH::getFamily(medEntityMesh entity, int i) const
+const MEDMEM::FAMILY* MESH::getFamily(medEntityMesh entity, int i) const
{
if (i<=0)
throw MEDEXCEPTION("MESH::getFamily(i) : argument i must be > 0");
#include "MEDMEM_Meshing.hxx"
#include "MEDMEM_Group.hxx"
+using namespace MEDMEM;
/*! Create an empty MESH. */
MESHING::MESHING(): MESH()
This class MESHING is a special class to set a MESH object.
*/
+namespace MEDMEM {
class MESHING: public MESH
{
public :
void addGroup (const GROUP & Group)
throw (MEDEXCEPTION) ;
};
+};
#endif /* MESHING_HXX */
they are the same (positive or negative cycle) !
*/
-
+namespace MEDMEM {
class MEDMODULUSARRAY {
private:
int _length ;
int compare(const MEDMODULUSARRAY &modulusArray) const;
};
+};
+using namespace MEDMEM;
MEDMODULUSARRAY::MEDMODULUSARRAY(int length, const int * array) :
_length(length), _array(array)
In these cases, memory will be desallocated at object destruction. In all other cases,
the desallocator will only nullify pointers.
*/
+namespace MEDMEM {
template <typename T> class PointerOf
{
void set( const int &size, const T *pointer ) ;
PointerOf<T>& operator=( const PointerOf<T> &pointer ) ;
} ;
+} ;
// ------------------------------------------------------------ //
// //
// //
// ------------------------------------------------------------ //
+using namespace MEDMEM;
/*! Creates a null T* pointer and sets the boolean (for desallocation) to false. */
template <typename T> PointerOf<T>::PointerOf() : _pointer(0), _done(false)
msgErr << "This Object cannot be instanciated by now ! Try "<< 11 << "times just to see what happens ";
throw SALOME_EXCEPTION (LOCALIZED(msgErr)) ;
*/
+namespace MEDMEM {
class STRING : public string
{
}
} ;
+} ;
# endif
using namespace std;
#include "MEDMEM_SkyLineArray.hxx"
#include "utilities.h"
+using namespace MEDMEM;
MEDSKYLINEARRAY::MEDSKYLINEARRAY(): _count(0), _length(0),
_index((med_int*)NULL),_value((med_int*)NULL)
#include "MEDMEM_PointerOf.hxx"
#include "MEDMEM_define.hxx"
-using MED_EN::med_int ;
+using MED_EN::med_int;
+namespace MEDMEM {
class MEDSKYLINEARRAY
{
private :
inline void setIJ(med_int i, med_int j, med_int value) throw (MEDEXCEPTION) ;
inline void setIndexValue(med_int i, med_int value) throw (MEDEXCEPTION) ;
-} ;
-
+};
+}
+using namespace MEDMEM;
// ---------------------------------------
// Methodes Inline
// ---------------------------------------
throw MEDEXCEPTION("MEDSKYLINEARRAY::setIndexValue : argument is out of range") ;
_value[i-1]=value ;
}
-
# endif
#include "MEDMEM_Mesh.hxx"
using namespace MED_EN;
+using namespace MEDMEM;
/* This class is a generic class for family and group */
operator <<.
*/
//--------------------------------------------------
-ostream & operator<<(ostream &os, const SUPPORT &my)
+ostream & MEDMEM::operator<<(ostream &os, const SUPPORT &my)
//--------------------------------------------------
{
os << "Name : "<< my.getName() << endl ;
#include "MEDMEM_STRING.hxx"
#include "MEDMEM_Exception.hxx"
#include "MEDMEM_define.hxx"
-
#include "MEDMEM_SkyLineArray.hxx"
-//#include "MEDMEM_Mesh.hxx"
using namespace MED_EN;
+using namespace MEDMEM;
-class MESH ;
/*!
*/
+namespace MEDMEM {
+class MESH ;
class SUPPORT
{
protected:
void intersecting(SUPPORT * mySupport) throw (MEDEXCEPTION) ;
};
+};
// _____________________
// Methodes Inline
// _____________________
+using namespace MEDMEM;
/*!
This method returns the number of all elements of the type GeometricType.
-#include "MEDMEM_TypeMeshDriver.hxx"
+using namespace std;
+#include "MEDMEM_TypeMeshDriver.hxx"
#include "MEDMEM_DriversDef.hxx"
#include "MEDMEM_Family.hxx"
#include "MEDMEM_Connectivity.hxx"
#include "MEDMEM_Mesh.hxx"
#include "MEDMEM_CellModel.hxx"
+using namespace MEDMEM;
// Every memory allocation made in the MedDriver members function are desallocated in the Mesh destructor
#include "MEDMEM_Exception.hxx"
#include "utilities.h"
-class MESH;
-class FAMILY;
-class GROUP;
-class CONNECTIVITY;
+using namesapce MEDMEM;
/*!
*/
+namespace MEDMEM {
+class MESH;
+class FAMILY;
+class GROUP;
+class CONNECTIVITY;
class TYPE_MESH_DRIVER : public GENDRIVER
{
protected:
GENDRIVER * copy(void) const ;
};
+};
#endif /* TYPE_MESH_DRIVER_HXX */
*/
#include "MEDMEM_Unit.hxx"
+using namespace MEDMEM;
UNIT::UNIT():_name(""),_description(""),_masse(0),_length(0),_time(0),_temperature(0),_matterQuantity(0),_currentStrength(0),_lightIntensity(0) {
MESSAGE("UNIT()");
#include "MEDMEM_define.hxx"
//using namespace MED_EN;
+namespace MEDMEM {
class UNIT {
protected:
string _name ;
inline int getLightIntensity() const ;
} ;
+} ;
// inline method :
+using namespace MEDMEM;
inline void UNIT::setName(string Name) {
_name = Name ;
};
-#ifdef _SALOME
-
-# include <utilities.h>
-
-#else
-
-# include <cstdlib>
-# include <iostream>
-using namespace std;
-
-/* --- INFOS is always defined (without _DEBUG_): to be used for warnings, with release version --- */
-
-# define HEREWEARE {cout<<flush ; cerr << __FILE__ << " [" << __LINE__ << "] : " << flush ;}
-# define INFOS(chain) {HEREWEARE ; cerr << chain << endl ;}
-# define PYSCRIPT(chain) {cout<<flush ; cerr << "---PYSCRIPT--- " << chain << endl ;}
-
-
-/* --- To print date and time of compilation of current source on stdout --- */
-
-# if defined ( __GNUC__ )
-# define COMPILER "g++" ;
-# elif defined ( __sun )
-# define COMPILER "CC" ;
-# elif defined ( __KCC )
-# define COMPILER "KCC" ;
-# elif defined ( __PGI )
-# define COMPILER "pgCC" ;
-# else
-# define COMPILER "undefined" ;
-# endif
-
-# ifdef INFOS_COMPILATION
-# error INFOS_COMPILATION already defined
-# endif
-# define INFOS_COMPILATION {\
- cerr << flush;\
- cout << __FILE__ ;\
- cout << " [" << __LINE__ << "] : " ;\
- cout << "COMPILED with " << COMPILER ;\
- cout << ", " << __DATE__ ; \
- cout << " at " << __TIME__ << endl ;\
- cout << "\n\n" ;\
- cout << flush ;\
- }
-
-# ifdef _DEBUG_
-
-/* --- the following MACROS are useful at debug time --- */
-
-# define HERE {cout<<flush ; cerr << "- Trace " << __FILE__ << " [" << __LINE__ << "] : " << flush ;}
-# define SCRUTE(var) {HERE ; cerr << #var << "=" << var << endl ;}
-# define MESSAGE(chain) {HERE ; cerr << chain << endl ;}
-# define INTERRUPTION(code) {HERE ; cerr << "INTERRUPTION return code= " << code << endl ; exit(code) ;}
-
-# ifndef ASSERT
-# define ASSERT(condition) if (!(condition)){ HERE ; cerr << "CONDITION " << #condition << " NOT VERIFIED"<< endl ; INTERRUPTION(1) ;}
-# endif /* ASSERT */
-
-#define REPERE {cout<<flush ; cerr << " --------------" << endl << flush ;}
-#define BEGIN_OF(chain) {REPERE ; HERE ; cerr << "Begin of: " << chain << endl ; REPERE ; }
-#define END_OF(chain) {REPERE ; HERE ; cerr << "Normal end of: " << chain << endl ; REPERE ; }
-
-
-
-# else /* ifdef _DEBUG_*/
-
-# define HERE
-# define SCRUTE(var) {}
-# define MESSAGE(chain) {}
-# define INTERRUPTION(code) {}
-
-# ifndef ASSERT
-# define ASSERT(condition) {}
-# endif /* ASSERT */
-
-#define REPERE
-#define BEGIN_OF(chain) {}
-#define END_OF(chain) {}
-
-#endif
-
+#ifdef _SALOME\r
+\r
+# include <utilities.h>\r
+\r
+#else\r
+\r
+#ifndef __MEDMEM_UTILITIES\r
+#define __MEDMEM_UTILITIES\r
+\r
+# include <cstdlib>\r
+# include <iostream>\r
+using namespace std;\r
+\r
+/* --- INFOS is always defined (without _DEBUG_): to be used for warnings, with release version --- */\r
+\r
+# define HEREWEARE {cout<<flush ; cerr << __FILE__ << " [" << __LINE__ << "] : " << flush ;}\r
+# define INFOS(chain) {HEREWEARE ; cerr << chain << endl ;}\r
+# define PYSCRIPT(chain) {cout<<flush ; cerr << "---PYSCRIPT--- " << chain << endl ;}\r
+\r
+\r
+/* --- To print date and time of compilation of current source on stdout --- */\r
+\r
+# if defined ( __GNUC__ )\r
+# define COMPILER "g++" ;\r
+# elif defined ( __sun )\r
+# define COMPILER "CC" ;\r
+# elif defined ( __KCC )\r
+# define COMPILER "KCC" ;\r
+# elif defined ( __PGI )\r
+# define COMPILER "pgCC" ;\r
+# else\r
+# define COMPILER "undefined" ;\r
+# endif\r
+\r
+# ifdef INFOS_COMPILATION\r
+# undef INFOS_COMPILATION\r
+# endif\r
+# define INFOS_COMPILATION {\\r
+ cerr << flush;\\r
+ cout << __FILE__ ;\\r
+ cout << " [" << __LINE__ << "] : " ;\\r
+ cout << "COMPILED with " << COMPILER ;\\r
+ cout << ", " << __DATE__ ; \\r
+ cout << " at " << __TIME__ << endl ;\\r
+ cout << "\n\n" ;\\r
+ cout << flush ;\\r
+ }\r
+\r
+# ifdef _DEBUG_\r
+\r
+/* --- the following MACROS are useful at debug time --- */\r
+\r
+# define HERE {cout<<flush ; cerr << "- Trace " << __FILE__ << " [" << __LINE__ << "] : " << flush ;}\r
+# define SCRUTE(var) {HERE ; cerr << #var << "=" << var << endl ;}\r
+# define MESSAGE(chain) {HERE ; cerr << chain << endl ;}\r
+# define INTERRUPTION(code) {HERE ; cerr << "INTERRUPTION return code= " << code << endl ; exit(code) ;}\r
+\r
+# ifndef ASSERT\r
+# define ASSERT(condition) if (!(condition)){ HERE ; cerr << "CONDITION " << #condition << " NOT VERIFIED"<< endl ; INTERRUPTION(1) ;}\r
+# endif /* ASSERT */\r
+\r
+#define REPERE {cout<<flush ; cerr << " --------------" << endl << flush ;}\r
+#define BEGIN_OF(chain) {REPERE ; HERE ; cerr << "Begin of: " << chain << endl ; REPERE ; }\r
+#define END_OF(chain) {REPERE ; HERE ; cerr << "Normal end of: " << chain << endl ; REPERE ; }\r
+\r
+\r
+\r
+# else /* ifdef _DEBUG_*/\r
+\r
+# define HERE\r
+# define SCRUTE(var) {}\r
+# define MESSAGE(chain) {}\r
+# define INTERRUPTION(code) {}\r
+\r
+# ifndef ASSERT\r
+# define ASSERT(condition) {}\r
+# endif /* ASSERT */\r
+\r
+#define REPERE\r
+#define BEGIN_OF(chain) {}\r
+#define END_OF(chain) {}\r
+\r
+#endif\r
+\r
+#endif\r
+#endif\r
#include "MEDMEM_Mesh.hxx"
#include "MEDMEM_CellModel.hxx"
-//using namespace MED_FR ;
+using namespace MEDMEM ;
-template <class T> class FIELD;
/*!
*/
+namespace MEDMEM {
+template <class T> class FIELD;
template <class T> class VTK_FIELD_DRIVER : public GENDRIVER
{
protected:
GENDRIVER * copy ( void ) const ;
};
+};
/*-------------------------*/
/* template implementation */
/*--------------------- DRIVER PART -------------------------------*/
+using namespace MEDMEM;
template <class T> void VTK_FIELD_DRIVER<T>::setFieldName(const string & fieldName)
{
_fieldName = fieldName;
#include "MEDMEM_Support.hxx"
#include "MEDMEM_Mesh.hxx"
#include "MEDMEM_CellModel.hxx"
+using namespace MEDMEM;
VTK_MED_DRIVER::VTK_MED_DRIVER(): GENDRIVER(),
_ptrMed((MED * const)MED_NULL)
using namespace std ;
+
+namespace MEDMEM {
class MESH;
class SUPPORT;
class FIELD_;
class MED;
-
// This driver pilots within a VTK class read/write accesses of fields/meshes
class VTK_MED_DRIVER : public GENDRIVER
{
void writeField(FIELD_ * myField,string name) const ;
};
+};
#endif /* VTK_MED_DRIVER_HXX */
#include "MEDMEM_Grid.hxx"
#include <sstream>
+using namespace MEDMEM;
VTK_MESH_DRIVER::VTK_MESH_DRIVER(): GENDRIVER(),
_ptrMesh((MESH * const)MED_NULL)
#include <fstream>
-class MESH;
-class FAMILY;
-class GROUP;
-class CONNECTIVITY;
/*!
Generic part : implement open and close methods.
*/
+namespace MEDMEM {
+class MESH;
+class FAMILY;
+class GROUP;
+class CONNECTIVITY;
class VTK_MESH_DRIVER : public GENDRIVER
{
protected:
GENDRIVER * copy ( void ) const;
};
+};
#endif /* VTK_MESH_DRIVER_HXX */
CXXFLAGS+=-ftemplate-depth-42 -I${KERNEL_ROOT_DIR}/include/salome
LDFLAGS+=$(MED2_LIBS) $(HDF5_LIBS) -lSalomeLoggerServer -L${KERNEL_ROOT_DIR}/lib/salome
+LDFLAGSFORBIN+=$(MED2_LIBS) $(HDF5_LIBS) -lSalomeLoggerServer -L${KERNEL_ROOT_DIR}/lib/salome
+
+LIBSFORBIN=
+
+LDFLAGS=
+
+LIBS=
+
# build create_mesh :
bin: create_mesh create_mesh_c2q4s2 create_mesh_c3h8q4 create_mesh_c3h8q4_wrong create_mesh_c2q4s2_wrong create_grid create_mesh_c2q4 create_mesh_c3h8
-create_mesh create_mesh_c2q4s2 create_mesh_c3h8q4 create_grid create_mesh_c2q4 create_mesh_c3h8: %: %.c
- $(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $(MED2_LIBS) $(HDF5_LIBS) $(LDFLAGS) $<
+create_mesh create_mesh_c2q4s2 create_mesh_c3h8q4 create_grid create_mesh_c2q4 create_mesh_c3h8 create_mesh_c3h8q4_wrong create_mesh_c2q4s2_wrong: %: %.c
+ $(CC) $(CFLAGS) $(CPPFLAGS) -o $@ $(MED2_LIBS) $(HDF5_LIBS) $<
@CONCLUDE@
#include "MEDMEM_Exception.hxx"
#include "MEDMEM_Med.hxx"
+using namespace MEDMEM;
void usage(char * name)
{
cout << " " << name << " <input med file> <output med file> " <<endl ;
#include "MEDMEM_MedMedDriver.hxx"
#include "MEDMEM_MedMeshDriver.hxx"
+using namespace MEDMEM;
int main (int argc, char ** argv) {
string filenameIN = argv[1] ;
#include "MEDMEM_Field.hxx"
#include "MEDMEM_VtkMedDriver.hxx"
+using namespace MEDMEM;
void usage(char * name)
{
cout << " " << name << " <input med file> <output vtk file> " <<endl ;
#include "MEDMEM_Field.hxx"
#include "MEDMEM_define.hxx"
+using namespace MEDMEM;
double dmax(double x, double y) { return (x>y)?x:y;}
#include "utilities.h"
#include "MEDMEM_Array.hxx"
+using namespace MEDMEM;
int main (int argc, char ** argv) {
int SpaceDimension = 3 ;
#include "MEDMEM_CellModel.hxx"
#include "MEDMEM_DriversDef.hxx"
+using namespace MEDMEM;
int main (int argc, char ** argv) {
list<MED_FR::med_geometrie_element> geomList = MED_FR::meshEntities[MED_FR::MED_MAILLE] ;
list<MED_FR::med_geometrie_element>::iterator itGeomList ;
#include "MEDMEM_Field.hxx"
using namespace std;
+using namespace MEDMEM;
int main (int argc, char ** argv) {
#include "utilities.h"
#include "MEDMEM_ModulusArray.hxx"
+using namespace MEDMEM;
int main (int argc, char ** argv) {
using namespace std;
#include "utilities.h"
#include "MEDMEM_SkyLineArray.hxx"
+using namespace MEDMEM;
int main (int argc, char ** argv) {
#include "MEDMEM_Support.hxx"
#include "MEDMEM_Field.hxx"
#include "MEDMEM_define.hxx"
+using namespace MEDMEM;
void affiche_medarray(MEDARRAY<double> & myMedArray)
#include "MEDMEM_Support.hxx"
#include "MEDMEM_Field.hxx"
#include "MEDMEM_define.hxx"
+using namespace MEDMEM;
void affiche_connectivity(const CONNECTIVITY * myConnectivity, MESH * myMesh)
{
#include "MEDMEM_Support.hxx"
#include "MEDMEM_Field.hxx"
#include "MEDMEM_define.hxx"
+using namespace MEDMEM;
void affiche_tableau(const double * myArray, int nb_lignes, int nb_colonnes)
#include "MEDMEM_Field.hxx"
#include "MEDMEM_define.hxx"
+using namespace MEDMEM;
void affiche_support(const SUPPORT * mySupport)
{
#include "MEDMEM_Support.hxx"
#include "MEDMEM_Field.hxx"
#include "MEDMEM_define.hxx"
+using namespace MEDMEM;
void affiche_field_(FIELD_ * myField, const SUPPORT * mySupport)
#include "MEDMEM_Support.hxx"
#include "MEDMEM_Field.hxx"
#include "MEDMEM_define.hxx"
+using namespace MEDMEM;
void affiche_field(FIELD_ * myField, const SUPPORT * mySupport)
#include "MEDMEM_Field.hxx"
#include "MEDMEM_define.hxx"
+using namespace MEDMEM;
void affiche_support(const SUPPORT * mySupport)
{
#include "MEDMEM_Field.hxx"
#include "MEDMEM_define.hxx"
+using namespace MEDMEM;
void affiche_medarray(MEDARRAY<double> & myMedArray)
{
#include "MEDMEM_Support.hxx"
#include "MEDMEM_Field.hxx"
#include "MEDMEM_define.hxx"
+using namespace MEDMEM;
int main (int argc, char ** argv) {
#include "MEDMEM_Support.hxx"
#include "MEDMEM_Field.hxx"
#include "MEDMEM_define.hxx"
+using namespace MEDMEM;
void affiche_support(const SUPPORT * mySupport)
+using namespace std;
+
#include "MEDMEM_GibiMeshDriver.hxx"
#include "MEDMEM_Mesh.hxx"
-
+using namespace MEDMEM;
int main (int argc, char ** argv)
{
/* process the arguments */
using namespace std;
+using namespace MEDMEM;
void affiche_field_(FIELD_ * myField, const SUPPORT * mySupport)
{
cout << "Field "<< myField->getName() << " : " <<myField->getDescription() << endl ;
#include "MEDMEM_Field.hxx"
#include "MEDMEM_define.hxx"
+using namespace MEDMEM;
int myfunction1(int x)
{
return 2*x;
#include "MEDMEM_Exception.hxx"
#include "MEDMEM_define.hxx"
#include "MEDMEM_Mesh.hxx"
+using namespace MEDMEM;
void usage(char * name)
{
#include "MEDMEM_define.hxx"
#include "MEDMEM_Mesh.hxx"
#include "MEDMEM_DriversDef.hxx"
+using namespace MEDMEM;
void usage(char * name)
{
#include <cstdlib> // pour l'acces à EXIT_SUCCESS et EXIT_FAILURE
#include "utilities.h"
#include "MEDMEM_Array.hxx"
+using namespace MEDMEM;
void imprime(string titre,const int * myValues,const int * myOthers, int lignes, int colonnes)
{
#include <cstdlib> // pour l'acces à EXIT_SUCCESS et EXIT_FAILURE
#include "utilities.h"
#include "MEDMEM_Array.hxx"
+using namespace MEDMEM;
int main (int argc, char ** argv)
{
#include "MEDMEM_CellModel.hxx"
#include "MEDMEM_define.hxx"
#include "MEDMEM_DriversDef.hxx"
+using namespace MEDMEM;
void usage(char * name)
{
#include "MEDMEM_Array.hxx"
#include "MEDMEM_Coordinate.hxx"
#include <string>
+using namespace MEDMEM;
void usage(char * name)
{
#include <cstdlib>
#include "MEDMEM_STRING.hxx"
#include "MEDMEM_Exception.hxx"
+using namespace MEDMEM;
int main (int argc, char ** argv)
{
#include <exception>
#include "utilities.h"
#include "MEDMEM_ModulusArray.hxx"
+using namespace MEDMEM;
int main (int argc, char ** argv)
{
#include "utilities.h"
#include "MEDMEM_PointerOf.hxx"
#include "MEDMEM_Exception.hxx"
+using namespace MEDMEM;
int main (int argc, char ** argv)
#include <cstdlib>
#include "utilities.h"
#include "MEDMEM_SkyLineArray.hxx"
+using namespace MEDMEM;
int main (int argc, char ** argv)
{
#include <exception>
#include "MEDMEM_Unit.hxx"
+using namespace MEDMEM;
int main (int argc, char ** argv)
{
--- /dev/null
+//=============================================================================
+// File : MEDMEM_Family_i.cxx
+// Project : SALOME
+// Copyright : EDF 2002
+// Author : EDF
+// $Header: /export/home/PAL/MED_SRC/src/MEDMEM_I/MEDMEM_Family_i.cxx
+//=============================================================================
+
+#include "utilities.h"
+#include "Utils_CorbaException.hxx"
+#include "MEDMEM_Family_i.hxx"
+#include "MEDMEM_Family.hxx"
+using namespace MEDMEM;
+
+//=============================================================================
+/*!
+ * Default constructor
+ */
+//=============================================================================
+FAMILY_i::FAMILY_i(): _family((::FAMILY*)NULL),
+ SUPPORT_i()
+{
+ BEGIN_OF("Default Constructor FAMILY_i");
+ END_OF("Default Constructor FAMILY_i");
+}
+//=============================================================================
+/*!
+ * Copy Constructor
+ */
+//=============================================================================
+FAMILY_i::FAMILY_i(const FAMILY_i & f): _family(f._family),
+ SUPPORT_i(f._family)
+{
+ BEGIN_OF("Default Constructor FAMILY_i");
+ END_OF("Default Constructor FAMILY_i");
+}
+//=============================================================================
+/*!
+ * Destructor
+ */
+//=============================================================================
+FAMILY_i::~FAMILY_i()
+{
+}
+//=============================================================================
+/*!
+ * Constructor
+ */
+//=============================================================================
+FAMILY_i::FAMILY_i(const ::FAMILY * const f): _family(f),
+ SUPPORT_i(f)
+{
+ BEGIN_OF("Constructor FAMILY_i");
+ END_OF("Constructor FAMILY_i");
+}
+//=============================================================================
+/*!
+ * CORBA: Accessor for Family's Identifier
+ */
+//=============================================================================
+
+CORBA::Long FAMILY_i::getIdentifier()
+throw (SALOME::SALOME_Exception)
+{
+ if (_family==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
+ SALOME::INTERNAL_ERROR);
+ try
+ {
+ return _family->getIdentifier();
+ }
+ catch(MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to acces Family Identifier");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(),SALOME::INTERNAL_ERROR);
+ }
+
+}
+//=============================================================================
+/*!
+ * CORBA: Accessor for number of attributes
+ */
+//=============================================================================
+CORBA::Long FAMILY_i::getNumberOfAttributes()
+throw (SALOME::SALOME_Exception)
+{
+ if (_family==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
+ SALOME::INTERNAL_ERROR);
+ try
+ {
+ return _family->getNumberOfAttributes();
+ }
+ catch(MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to get number of attributes");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(),SALOME::INTERNAL_ERROR);
+ }
+}
+//=============================================================================
+/*!
+ * CORBA: Accessor for attributes identifiers
+ */
+//=============================================================================
+SALOME_MED::long_array* FAMILY_i::getAttributesIdentifiers()
+throw (SALOME::SALOME_Exception)
+{
+ if (_family==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
+ SALOME::INTERNAL_ERROR);
+ SALOME_MED::long_array_var myseq= new SALOME_MED::long_array;
+ try
+ {
+ int nbAttribute=_family->getNumberOfAttributes();
+ myseq->length(nbAttribute);
+ int * identifiers=_family->getAttributesIdentifiers();
+ for (int i=0;i<nbAttribute;i++)
+ {
+ myseq[i]=identifiers[i];
+ }
+ }
+ catch(MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to acces Family Identifiers");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(),SALOME::INTERNAL_ERROR);
+ }
+ return myseq._retn();
+}
+//=============================================================================
+/*!
+ * CORBA: Accessor for attribute identifier I
+ */
+//=============================================================================
+CORBA::Long FAMILY_i::getAttributeIdentifier(CORBA::Long i)
+throw (SALOME::SALOME_Exception)
+{
+ if (_family==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
+ SALOME::INTERNAL_ERROR);
+ try
+ {
+ return _family->getAttributeIdentifier(i);
+ }
+ catch(MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to acces Family Identifier");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(),SALOME::INTERNAL_ERROR);
+ }
+
+}
+//=============================================================================
+/*!
+ * CORBA: Accessor for attributes values
+ */
+//=============================================================================
+SALOME_MED::long_array* FAMILY_i::getAttributesValues()
+throw (SALOME::SALOME_Exception)
+{
+ if (_family==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
+ SALOME::INTERNAL_ERROR);
+ SALOME_MED::long_array_var myseq= new SALOME_MED::long_array;
+ try
+ {
+ int nbAttribute=_family->getNumberOfAttributes();
+ myseq->length(nbAttribute);
+ int * values=_family->getAttributesValues();
+ for (int i=0;i<nbAttribute;i++)
+ {
+ myseq[i]=values[i];
+ }
+ }
+ catch(MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to acces attributs values");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(),SALOME::INTERNAL_ERROR);
+ }
+ return myseq._retn();
+}
+//=============================================================================
+/*!
+ * CORBA: Accessor for attribute value I
+ */
+//=============================================================================
+CORBA::Long FAMILY_i::getAttributeValue(CORBA::Long i)
+throw (SALOME::SALOME_Exception)
+{
+ if (_family==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
+ SALOME::INTERNAL_ERROR);
+ try
+ {
+ return _family->getAttributeValue(i);
+ }
+ catch(MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to acces specified attribut value");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(),SALOME::INTERNAL_ERROR);
+ }
+}
+//=============================================================================
+/*!
+ * CORBA: Accessor for attributes desriptions
+ */
+//=============================================================================
+SALOME_MED::string_array * FAMILY_i::getAttributesDescriptions()
+throw (SALOME::SALOME_Exception)
+{
+ if (_family==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
+ SALOME::INTERNAL_ERROR);
+
+ SALOME_MED::string_array_var myseq = new SALOME_MED::string_array;
+ try
+ {
+ int nbAttribute=_family->getNumberOfAttributes();
+ myseq->length(nbAttribute);
+ string * descattribute=_family->getAttributesDescriptions();
+ for (int i=0;i<nbAttribute;i++)
+ {
+ myseq[i]=CORBA::string_dup(descattribute[i].c_str());
+ }
+ }
+ catch(MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to acces attributs descriptions");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(),SALOME::INTERNAL_ERROR);
+ }
+ return myseq._retn();
+
+}
+//=============================================================================
+/*!
+ * CORBA: Accessor for attribute description i
+ */
+//=============================================================================
+char * FAMILY_i::getAttributeDescription( CORBA::Long i)
+throw (SALOME::SALOME_Exception)
+{
+ if (_family==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
+ SALOME::INTERNAL_ERROR);
+ try
+ {
+ return CORBA::string_dup(_family->getAttributeDescription(i).c_str());
+ }
+ catch(MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to acces specified attribut description");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(),SALOME::INTERNAL_ERROR);
+ }
+}
+
+//=============================================================================
+/*!
+ * CORBA: Accessor for number of groups the family belongs to
+ */
+//=============================================================================
+CORBA::Long FAMILY_i::getNumberOfGroups()
+throw (SALOME::SALOME_Exception)
+{
+ if (_family==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
+ SALOME::INTERNAL_ERROR);
+ try
+ {
+ return _family->getNumberOfGroups();
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to acces specified attribut value");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(),SALOME::INTERNAL_ERROR);
+ }
+}
+//=============================================================================
+/*!
+ * CORBA: Accessor for groups names
+ */
+//=============================================================================
+SALOME_MED::string_array * FAMILY_i::getGroupsNames()
+throw (SALOME::SALOME_Exception)
+{
+ if (_family==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
+ SALOME::INTERNAL_ERROR);
+
+ SALOME_MED::string_array_var myseq = new SALOME_MED::string_array;
+ try
+ {
+ int nbGroups=_family->getNumberOfGroups();
+ myseq->length(nbGroups);
+ string * descGroups=_family->getGroupsNames();
+ for (int i=0;i<nbGroups;i++)
+ {
+ myseq[i]=CORBA::string_dup(descGroups[i].c_str());
+ }
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to acces attributs descriptions");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(),SALOME::INTERNAL_ERROR);
+ }
+ return myseq._retn();
+
+}
+//=============================================================================
+/*!
+ * CORBA: Accessor for attribute description i
+ */
+//=============================================================================
+char * FAMILY_i::getGroupName( CORBA::Long i)
+throw (SALOME::SALOME_Exception)
+{
+ if (_family==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
+ SALOME::INTERNAL_ERROR);
+ try
+ {
+ return CORBA::string_dup(_family->getGroupName(i).c_str());
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to acces specified attribut description");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(),SALOME::INTERNAL_ERROR);
+ }
+}
+
--- /dev/null
+//=============================================================================
+// File : MEDMEM_Family_i.hxx
+// Project : SALOME
+// Copyright : EDF 2002
+// Author : EDF
+// $Header: /export/home/PAL/MED_SRC/src/MEDMEM_I/MEDMEM_Family_i.hxx
+//=============================================================================
+#ifndef MED_FAMILY_I_HXX_
+#define MED_FAMILY_I_HXX_
+
+
+#include "MEDMEM_Support_i.hxx"
+
+namespace MEDMEM {
+class FAMILY;
+class FAMILY_i:
+ public POA_SALOME_MED::FAMILY,
+ public SUPPORT_i
+{
+protected :
+ FAMILY_i();
+ ~FAMILY_i();
+
+ // C++ object containing values
+ const ::MEDMEM::FAMILY * const _family ;
+
+public :
+ // Constructors and associated internal methods
+ FAMILY_i(const ::MEDMEM::FAMILY * const f);
+ FAMILY_i(const FAMILY_i & f);
+
+ CORBA::Long getIdentifier()
+ throw (SALOME::SALOME_Exception);
+ CORBA::Long getNumberOfAttributes()
+ throw (SALOME::SALOME_Exception);
+ SALOME_MED::long_array* getAttributesIdentifiers()
+ throw (SALOME::SALOME_Exception);
+ CORBA::Long getAttributeIdentifier(CORBA::Long i)
+ throw (SALOME::SALOME_Exception);
+ SALOME_MED::long_array* getAttributesValues()
+ throw (SALOME::SALOME_Exception);
+ CORBA::Long getAttributeValue(CORBA::Long i)
+ throw (SALOME::SALOME_Exception);
+ SALOME_MED::string_array* getAttributesDescriptions()
+ throw (SALOME::SALOME_Exception);
+ char* getAttributeDescription( CORBA::Long i)
+ throw (SALOME::SALOME_Exception);
+ CORBA::Long getNumberOfGroups()
+ throw (SALOME::SALOME_Exception);
+ char * getGroupName( CORBA::Long i)
+ throw (SALOME::SALOME_Exception);
+ SALOME_MED::string_array* getGroupsNames()
+ throw (SALOME::SALOME_Exception);
+
+};
+}
+#endif /* MED_FAMILY_I_HXX_ */
--- /dev/null
+//=============================================================================
+// File : MEDMEM_Fielddouble_i.hxx
+// Project : SALOME
+// Author : EDF
+// Copyright : EDF 2002
+// $Header: /export/home/PAL/MED_SRC/src/MEDMEM_I/MEDMEM_Fielddouble_i.hxx
+//=============================================================================
+
+#include "MEDMEM_FieldDouble_i.hxx"
+#include "utilities.h"
+#include "MEDMEM_convert.hxx"
+using namespace MEDMEM;
+
+//=============================================================================
+/*!
+ * Default constructor
+ */
+//=============================================================================
+FIELDDOUBLE_i::FIELDDOUBLE_i(): FIELDOF_i<double>()
+{
+ BEGIN_OF("Default Constructor FIELDDOUBLE_i");
+ END_OF("Default Constructor FIELDDOUBLE_i");
+}
+//=============================================================================
+/*!
+ * Destructor
+ */
+//=============================================================================
+FIELDDOUBLE_i::~FIELDDOUBLE_i()
+{
+ BEGIN_OF("Default Destructor FIELDDOUBLE_i");
+ END_OF("Default Destructor FIELDDOUBLE_i");
+}
+//=============================================================================
+/*!
+ * Constructor par recopie
+ */
+//=============================================================================
+FIELDDOUBLE_i::FIELDDOUBLE_i(FIELDDOUBLE_i & fd):
+ FIELDOF_i<double>(fd._fieldTptr)
+{
+ BEGIN_OF("Default Constructor FIELDDOUBLE_i");
+ END_OF("Default Constructor FIELDDOUBLE_i");
+}
+//=============================================================================
+/*!
+ * Default constructor
+ */
+//=============================================================================
+FIELDDOUBLE_i::FIELDDOUBLE_i(SALOME_MED::SUPPORT_ptr mySupportIOR,::FIELD<double> * const f): FIELDOF_i<double>(mySupportIOR,f)
+{
+ BEGIN_OF("Constructor FIELDDOUBLE_i");
+ END_OF(" Constructor FIELDDOUBLE_i");
+}
+
+//=============================================================================
+/*!
+ * CORBA: Accessor for Field's values
+*/
+//=============================================================================
+
+SALOME_MED::double_array* FIELDDOUBLE_i::getValue( SALOME_MED::medModeSwitch mode )
+throw (SALOME::SALOME_Exception)
+{
+ if (_fieldTptr==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
+ SALOME::INTERNAL_ERROR);
+ SALOME_MED::double_array_var myseq = new SALOME_MED::double_array;
+ try
+ {
+ int nbval=_fieldTptr->getNumberOfComponents();
+
+ // Ajout NB pour avoir la valeur correct de nbval
+ SALOME_MED::medEntityMesh entity = _support->getEntity();
+ if (_support->isOnAllElements())
+ {
+ if (entity == SALOME_MED::MED_NODE)
+ nbval = (_support->getMesh()->getNumberOfNodes())*nbval;
+ else
+ nbval = (_support->getMesh()->getNumberOfElements(entity,SALOME_MED::MED_ALL_ELEMENTS))*nbval;
+ }
+ else
+ {
+ nbval = (_support->getNumberOfElements(SALOME_MED::MED_ALL_ELEMENTS))*nbval;
+ }
+
+ medModeSwitch modemed=convertIdlModeToMedMode(mode);
+ const double * values =_fieldTptr->getValue(modemed);
+
+ myseq->length(nbval);
+ for (int i=0; i<nbval; i++)
+ {
+ myseq[i]=values[i];
+ };
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to acces Field ");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+ return myseq._retn();
+}
--- /dev/null
+//=============================================================================
+// File : MEDMEM_Fielddouble_i.hxx
+// Project : SALOME
+// Author : EDF
+// Copyright : EDF 2002
+// $Header: /export/home/PAL/MED_SRC/src/MEDMEM_I/MEDMEM_Fielddouble_i.hxx
+//=============================================================================
+
+#ifndef MED_FIELDDOUBLE_I_HXX_
+#define MED_FIELDDOUBLE_I_HXX_
+
+#include <SALOMEconfig.h>
+
+#include CORBA_SERVER_HEADER(MED)
+
+#include "MEDMEM_Field_i.hxx"
+#include "MEDMEM_FieldOf_i.hxx"
+
+#include "MEDMEM_Field.hxx"
+
+namespace MEDMEM {
+class FIELDDOUBLE_i: public FIELDOF_i<double>
+{
+private:
+
+public:
+ FIELDDOUBLE_i();
+ ~FIELDDOUBLE_i();
+ FIELDDOUBLE_i(SALOME_MED::SUPPORT_ptr mySupportIOR,::FIELD<double> * const f);
+ FIELDDOUBLE_i(FIELDDOUBLE_i & f);
+
+ SALOME_MED::double_array * getValue (SALOME_MED::medModeSwitch mode )
+ throw (SALOME::SALOME_Exception);
+};
+}
+
+
+#endif /* MED_FIELDDOUBLE_I_HXX_ */
--- /dev/null
+//=============================================================================
+// File : MEDMEM_Fieldint_i.hxx
+// Project : SALOME
+// Author : EDF
+// Copyright : EDF 2002
+// $Header: /export/home/PAL/MED_SRC/src/MEDMEM_I/MEDMEM_Fieldint_i.hxx
+//=============================================================================
+
+#include "utilities.h"
+#include "MEDMEM_FieldInt_i.hxx"
+#include "MEDMEM_convert.hxx"
+using namespace MEDMEM;
+
+//=============================================================================
+/*!
+ * Default constructor
+ */
+//=============================================================================
+FIELDINT_i::FIELDINT_i(): FIELDOF_i<int>()
+{
+ BEGIN_OF("Default Constructor FIELDINT_i");
+ END_OF("Default Constructor FIELDINT_i");
+}
+//=============================================================================
+/*!
+ * Destructor
+ */
+//=============================================================================
+FIELDINT_i::~FIELDINT_i()
+{
+ BEGIN_OF("Default Destructor FIELDINT_i");
+ END_OF("Default Destructor FIELDINT_i");
+}
+//=============================================================================
+/*!
+ * Default constructor
+ */
+//=============================================================================
+FIELDINT_i::FIELDINT_i(SALOME_MED::SUPPORT_ptr mySupportIOR, ::FIELD<int> * const f): FIELDOF_i<int>(mySupportIOR,f)
+{
+ BEGIN_OF("Constructor FIELDINT_i");
+ END_OF(" Constructor FIELDINT_i");
+}
+//=============================================================================
+/*!
+ * Constructor par recopie
+ */
+//=============================================================================
+FIELDINT_i::FIELDINT_i(FIELDINT_i &fi):
+ FIELDOF_i<int>(fi._fieldTptr)
+{
+ BEGIN_OF("Constructor FIELDINT_i");
+ END_OF(" Constructor FIELDINT_i");
+}
+
+//=============================================================================
+/*!
+ * CORBA: Accessor for Field's values
+*/
+//=============================================================================
+
+SALOME_MED::long_array* FIELDINT_i::getValue( SALOME_MED::medModeSwitch mode )
+throw (SALOME::SALOME_Exception)
+{
+ if (_fieldTptr==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
+ SALOME::INTERNAL_ERROR);
+ SALOME_MED::long_array_var myseq = new SALOME_MED::long_array;
+ try
+ {
+ int nbval=_fieldTptr->getNumberOfComponents();
+
+ // Ajout NB pour avoir la valeur correct de nbval
+ SALOME_MED::medEntityMesh entity = _support->getEntity();
+ if (_support->isOnAllElements())
+ {
+ if (entity == SALOME_MED::MED_NODE)
+ nbval = (_support->getMesh()->getNumberOfNodes())*nbval;
+ else
+ nbval = (_support->getMesh()->getNumberOfElements(entity,SALOME_MED::MED_ALL_ELEMENTS))*nbval;
+ }
+ else
+ {
+ nbval = (_support->getNumberOfElements(SALOME_MED::MED_ALL_ELEMENTS))*nbval;
+ }
+
+ medModeSwitch modemed=convertIdlModeToMedMode(mode);
+ const int * values =_fieldTptr->getValue(modemed);
+
+ myseq->length(nbval);
+ for (int i=0; i<nbval; i++)
+ {
+ myseq[i]=values[i];
+ };
+ }
+ catch(MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to acces Field");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+ return myseq._retn();
+}
--- /dev/null
+//=============================================================================
+// File : MEDMEM_FieldInt_i.hxx
+// Project : SALOME
+// Author : EDF
+// Copyright : EDF 2002
+// $Header: /export/home/PAL/MED_SRC/src/MEDMEM_I/MEDMEM_FieldInt_i.hxx
+//=============================================================================
+
+#ifndef MED_FIELDINT_I_HXX_
+#define MED_FIELDINT_I_HXX_
+
+#include <SALOMEconfig.h>
+
+#include CORBA_SERVER_HEADER(MED)
+
+#include "MEDMEM_Field_i.hxx"
+#include "MEDMEM_FieldOf_i.hxx"
+
+#include "MEDMEM_Field.hxx"
+
+namespace MEDMEM {
+class FIELDINT_i: public FIELDOF_i<int>
+{
+private:
+ FIELDINT_i();
+
+public:
+ ~FIELDINT_i();
+ FIELDINT_i(SALOME_MED::SUPPORT_ptr mySupportIOR, ::FIELD<int> * const f);
+ FIELDINT_i(FIELDINT_i & f);
+ SALOME_MED::long_array * getValue (SALOME_MED::medModeSwitch mode )
+ throw (SALOME::SALOME_Exception);
+};
+}
+#endif /* MED_FIELDINT_I_HXX_ */
--- /dev/null
+//=============================================================================
+// File : MEDMEM_FieldOf_i.hxx
+// Project : SALOME
+// Author : EDF
+// Copyright : EDF 2002
+// $Header: /export/home/PAL/MED_SRC/src/MEDMEM_I/MEDMEM_FieldOf_i.hxx
+//=============================================================================
+
+
+#ifndef MED_FIELDOF_I_HXX_
+#define MED_FIELDOF_I_HXX_
+
+#include <map>
+#include <string>
+# include <sstream>
+
+#include <SALOMEconfig.h>
+
+# include "Utils_ORB_INIT.hxx"
+# include "Utils_SINGLETON.hxx"
+
+#include CORBA_SERVER_HEADER(MED)
+#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+
+#include "MEDMEM_Field_i.hxx"
+#include "MEDMEM_Support_i.hxx"
+
+#include "MEDMEM_convert.hxx"
+
+#include "MEDMEM_Support.hxx"
+#include "MEDMEM_Field.hxx"
+
+namespace MEDMEM {
+template <class T> class FIELDOF_i: public FIELD_i
+{
+public :
+ static map < int, ::MEDMEM::FIELD<T> * > fieldMap ;
+protected :
+ static int fieldIndex ;
+
+protected :
+ // C++ object containing values
+
+ ::MEDMEM::FIELD<T> * const _fieldTptr;
+ const int _corbaIndex;
+ string _FieldId;
+
+ // CORBA : SUPPORT IOR
+ const SALOME_MED::SUPPORT_ptr _support ;
+
+
+public :
+ // Constructors and associated internal methods
+ FIELDOF_i();
+ FIELDOF_i(SALOME_MED::SUPPORT_ptr support,::FIELD<T> * const field);
+ FIELDOF_i(::FIELD<T> * const f);
+ FIELDOF_i(FIELDOF_i & f);
+ ~FIELDOF_i();
+
+ char * getName() throw (SALOME::SALOME_Exception);
+ char * getDescription() throw (SALOME::SALOME_Exception);
+ SALOME_MED::SUPPORT_ptr getSupport() throw (SALOME::SALOME_Exception);
+ CORBA::Long getNumberOfComponents()
+ throw (SALOME::SALOME_Exception);
+ char * getComponentName(CORBA::Long i)
+ throw (SALOME::SALOME_Exception);
+ char * getComponentUnit(CORBA::Long i)
+ throw (SALOME::SALOME_Exception);
+ CORBA::Long getIterationNumber()
+ throw (SALOME::SALOME_Exception);
+ CORBA::Long getOrderNumber() throw (SALOME::SALOME_Exception);
+ CORBA::Double getTime() throw (SALOME::SALOME_Exception);
+ CORBA::Long getCorbaIndex() throw (SALOME::SALOME_Exception);
+
+ SALOME_MED::string_array * getComponentsNames() throw (SALOME::SALOME_Exception);
+ SALOME_MED::string_array * getComponentsUnits() throw (SALOME::SALOME_Exception);
+ void addInStudy(SALOMEDS::Study_ptr myStudy,
+ SALOME_MED::FIELD_ptr myIor)
+ throw (SALOME::SALOME_Exception,
+ SALOMEDS::StudyBuilder::LockProtection);
+
+ CORBA::Long addDriver (SALOME_MED::medDriverTypes driverType,
+ const char* fileName, const char* fieldName)
+ throw (SALOME::SALOME_Exception);
+ void rmDriver (CORBA::Long i) throw (SALOME::SALOME_Exception);
+ void read (CORBA::Long i) throw (SALOME::SALOME_Exception);
+ void write (CORBA::Long i, const char* driverFieldName)
+ throw (SALOME::SALOME_Exception);
+
+ // Cuisine Interne
+ ::FIELD<T> * constructConstField() const;
+
+ };
+}
+using namespace MEDMEM;
+template <class T> map < int, ::FIELD<T> * > FIELDOF_i<T>::fieldMap ;
+template <class T> int FIELDOF_i<T>::fieldIndex = 0;
+//=============================================================================
+/*!
+ * Default constructor
+ */
+//=============================================================================
+
+//template <class T> FIELDOF_i<T>::FIELDOF_i():_fieldTptr(FIELDOF_i<T>::constructConstField())
+template <class T> FIELDOF_i<T>::FIELDOF_i():_fieldTptr(constructConstField()),
+ _support((SALOME_MED::SUPPORT_ptr) NULL)
+{
+ BEGIN_OF("Default Constructor Field_i");
+ END_OF(" Default Constructor Field_i");
+}
+//=============================================================================
+/*!
+ * Destructor
+ */
+//=============================================================================
+template <class T> FIELDOF_i<T>::~FIELDOF_i()
+{
+}
+//=============================================================================
+/*!
+ * Constructor
+ */
+//=============================================================================
+template <class T> FIELDOF_i<T>::FIELDOF_i(SALOME_MED::SUPPORT_ptr support,::FIELD<T> * const field):
+ _fieldTptr(field),
+ _corbaIndex(FIELDOF_i<T>::fieldIndex++),
+ _FieldId(""),
+ _support(SALOME_MED::SUPPORT::_duplicate(support))
+{
+ BEGIN_OF("Constructor FIELDOF_i(SALOME_MED::SUPPORT_ptr support,::FIELD<T> * const field)");
+ FIELDOF_i<T>::fieldMap[_corbaIndex]=_fieldTptr;
+
+ MESSAGE("FIELDOF_i<T>::FIELDOF_i Checking of pointeurs !!!");
+
+ SCRUTE(_fieldTptr);
+ SCRUTE(_support);
+ SCRUTE(_support->getMesh());
+
+ END_OF("Constructor FIELDOF_i(SALOME_MED::SUPPORT_ptr support,::FIELD<T> * const field)");
+}
+
+
+template <class T> FIELDOF_i<T>::FIELDOF_i( FIELD<T> * const f):
+ _fieldTptr(f),
+ _corbaIndex(FIELDOF_i<T>::fieldIndex++),
+ _FieldId(""),
+ _support((SALOME_MED::SUPPORT_ptr) NULL)
+{
+ BEGIN_OF("Constructor Field_i");
+ FIELDOF_i<T>::fieldMap[_corbaIndex]=_fieldTptr;
+ END_OF("Constructor Field_i");
+}
+//=============================================================================
+/*!
+ * Constructor par recopie
+ */
+//=============================================================================
+template <class T> FIELDOF_i<T>::FIELDOF_i( FIELDOF_i & f):_fieldTptr(f._fieldTptr),
+ _corbaIndex(FIELDOF_i<T>::fieldIndex++),
+ _FieldId("")
+{
+ BEGIN_OF("Constructor Field_i");
+ FIELDOF_i<T>::fieldMap[_corbaIndex]=_fieldTptr;
+ END_OF("Constructor Field_i");
+}
+//=============================================================================
+/*!
+ * Constructor d un pointeur constant
+ */
+//=============================================================================
+template <class T> ::FIELD<T> * FIELDOF_i<T>::constructConstField() const
+{
+ ::FIELD<T> * const ptrField =new ::FIELD<T>();
+ return ptrField;
+}
+//=============================================================================
+/*!
+ * CORBA: Accessor for Fields's Name
+ */
+//=============================================================================
+template <class T> char * FIELDOF_i<T>::getName()
+throw (SALOME::SALOME_Exception)
+{
+ if (_fieldTptr==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
+ SALOME::INTERNAL_ERROR);
+ try
+ {
+ return CORBA::string_dup(_fieldTptr->getName().c_str());
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Exception en accedant au nom");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+}
+//=============================================================================
+/*!
+ * CORBA: Accessor for Fields's Description
+ */
+//=============================================================================
+template <class T> char * FIELDOF_i<T>::getDescription()
+throw (SALOME::SALOME_Exception)
+{
+ if (_fieldTptr==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
+ SALOME::INTERNAL_ERROR);
+ try
+ {
+ return CORBA::string_dup(_fieldTptr->getDescription().c_str());
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Exception en accedant a la description");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+}
+//=============================================================================
+/*!
+ * CORBA: Accessor for Fields's Support
+ */
+//=============================================================================
+
+template <class T> SALOME_MED::SUPPORT_ptr FIELDOF_i<T>::getSupport()
+ throw (SALOME::SALOME_Exception)
+{
+ BEGIN_OF("SALOME_MED::SUPPORT_ptr FIELDOF_i<T>::getSupport()");
+
+ if (_fieldTptr==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Field",
+ SALOME::INTERNAL_ERROR);
+ if (_support==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No Support in Field",
+ SALOME::INTERNAL_ERROR);
+
+ SCRUTE(_fieldTptr);
+
+ SCRUTE(_support);
+
+ SALOME_MED::SUPPORT_ptr support = SALOME_MED::SUPPORT::_duplicate(_support);
+
+ END_OF("SALOME_MED::SUPPORT_ptr FIELDOF_i<T>::getSupport()");
+
+ return support ;
+}
+//=============================================================================
+/*!
+ * CORBA: Accessor for Fields's Number of components
+ */
+//=============================================================================
+template <class T> CORBA::Long FIELDOF_i<T>::getNumberOfComponents()
+throw (SALOME::SALOME_Exception)
+{
+ if (_fieldTptr==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
+ SALOME::INTERNAL_ERROR);
+ try
+ {
+ return _fieldTptr->getNumberOfComponents();
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Exception en accedant au support");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+}
+//=============================================================================
+/*!
+ * CORBA: Accessor for names of component I
+ */
+//=============================================================================
+template <class T> char * FIELDOF_i<T>::getComponentName(CORBA::Long i)
+throw (SALOME::SALOME_Exception)
+{
+ if (_fieldTptr==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
+ SALOME::INTERNAL_ERROR);
+ try
+ {
+ return CORBA::string_dup(_fieldTptr->getComponentName(i).c_str());
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Exception en accedant au nom d un component");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+}
+//=============================================================================
+/*!
+ * CORBA: Accessor for unit of component I
+ */
+//=============================================================================
+template <class T> char * FIELDOF_i<T>::getComponentUnit(CORBA::Long i)
+throw (SALOME::SALOME_Exception)
+{
+ if (_fieldTptr==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
+ SALOME::INTERNAL_ERROR);
+ try
+ {
+ return CORBA::string_dup(_fieldTptr->getMEDComponentUnit(i).c_str());
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Exception en accedant au nom d un component");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+}
+//=============================================================================
+/*!
+ * CORBA: Accessor for iteration number
+ */
+//=============================================================================
+template <class T> CORBA::Long FIELDOF_i<T>::getIterationNumber()
+throw (SALOME::SALOME_Exception)
+{
+ if (_fieldTptr==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
+ SALOME::INTERNAL_ERROR);
+ try
+ {
+ return _fieldTptr->getIterationNumber();
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Exception en accedant au champ");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+}
+//=============================================================================
+/*!
+ * CORBA: Accessor for Corba Number
+ */
+//=============================================================================
+template <class T> CORBA::Long FIELDOF_i<T>::getCorbaIndex()
+throw (SALOME::SALOME_Exception)
+{
+ if (_fieldTptr==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
+ SALOME::INTERNAL_ERROR);
+ return _corbaIndex;
+
+}
+//=============================================================================
+/*!
+ * CORBA: Accessor for iteration number
+ */
+//=============================================================================
+template <class T> CORBA::Long FIELDOF_i<T>::getOrderNumber()
+throw (SALOME::SALOME_Exception)
+{
+ if (_fieldTptr==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
+ SALOME::INTERNAL_ERROR);
+ try
+ {
+ return _fieldTptr->getOrderNumber();
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Exception en accedant au champ");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+}
+//=============================================================================
+/*!
+ * CORBA: Accessor
+ */
+//=============================================================================
+template <class T> CORBA::Double FIELDOF_i<T>::getTime()
+throw (SALOME::SALOME_Exception)
+{
+ if (_fieldTptr==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
+ SALOME::INTERNAL_ERROR);
+ try
+ {
+ return _fieldTptr->getTime();
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Exception en accedant au champ");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+}
+//=============================================================================
+/*!
+ * CORBA: Accessor for Fields's Components names
+ */
+//=============================================================================
+template <class T> SALOME_MED::string_array * FIELDOF_i<T>::getComponentsNames()
+throw (SALOME::SALOME_Exception)
+{
+ if (_fieldTptr==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
+ SALOME::INTERNAL_ERROR);
+ SALOME_MED::string_array_var myseq = new SALOME_MED::string_array;
+ try
+ {
+ int nbcom = _fieldTptr->getNumberOfComponents();
+ myseq->length(nbcom);
+ const string * namecom=_fieldTptr->getComponentsNames();
+ for (int i=0;i<nbcom;i++)
+ {
+ myseq[i]=CORBA::string_dup(namecom[i].c_str());
+ }
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Exception en accedant au champ");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+ return myseq._retn();
+}
+//=============================================================================
+/*!
+ * CORBA: Accessor for Fields's Components units
+ */
+//=============================================================================
+template <class T> SALOME_MED::string_array * FIELDOF_i<T>::getComponentsUnits()
+throw (SALOME::SALOME_Exception)
+{
+ if (_fieldTptr==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
+ SALOME::INTERNAL_ERROR);
+ SALOME_MED::string_array_var myseq = new SALOME_MED::string_array;
+ try
+ {
+ int nbcom = _fieldTptr->getNumberOfComponents();
+ myseq->length(nbcom);
+ const string * unitcom=_fieldTptr->getMEDComponentsUnits();
+ for (int i=0;i<nbcom;i++)
+ {
+ myseq[i]=CORBA::string_dup(unitcom[i].c_str());
+ }
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Exception en accedant au champ");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+ return myseq._retn();
+}
+//=============================================================================
+/*!
+ * CORBA: Add in Study
+ */
+//=============================================================================
+template <class T> void FIELDOF_i<T>::addInStudy(SALOMEDS::Study_ptr myStudy,
+ SALOME_MED::FIELD_ptr myIor )
+ throw (SALOME::SALOME_Exception, SALOMEDS::StudyBuilder::LockProtection)
+{
+ BEGIN_OF(" FIELDOF_i::addInStudy");
+ if (_fieldTptr==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
+ SALOME::INTERNAL_ERROR);
+ if ( _FieldId != "" )
+ {
+ MESSAGE("Field already in Study");
+ THROW_SALOME_CORBA_EXCEPTION("Field already in Study", \
+ SALOME::BAD_PARAM);
+ };
+
+
+ SALOMEDS::StudyBuilder_var myBuilder = myStudy->NewBuilder();
+ SALOMEDS::GenericAttribute_var anAttr;
+ SALOMEDS::AttributeName_var aName;
+ SALOMEDS::AttributeIOR_var aIOR;
+
+ // Create SComponent labelled 'Med'
+ SALOMEDS::SComponent_var medfather = myStudy->FindComponent("MED");
+ if ( CORBA::is_nil(medfather) )
+ THROW_SALOME_CORBA_EXCEPTION("SComponent labelled 'MED' not Found",SALOME::INTERNAL_ERROR);
+
+ // Create SObject labelled 'MEDFIELD' if it doesn't already exit
+ SALOMEDS::SObject_var medfieldfather = myStudy->FindObject("MEDFIELD");
+ if ( CORBA::is_nil(medfieldfather) )
+ {
+ MESSAGE("Add Object 'MEDFIELD'");
+ medfieldfather = myBuilder->NewObject(medfather);
+ anAttr = myBuilder->FindOrCreateAttribute(medfieldfather, "AttributeName");
+ aName = SALOMEDS::AttributeName::_narrow(anAttr);
+ aName->SetValue("MEDFIELD");
+
+ } ;
+
+ // Create SObject labelled 'FIELDNAME' if it doesn't already exit
+ SALOMEDS::SObject_var medfieldnamefather = myStudy->FindObject((_fieldTptr->getName()).c_str());
+ if ( CORBA::is_nil(medfieldnamefather) )
+ {
+ MESSAGE("Add Object "<<_fieldTptr->getName());
+ medfieldnamefather = myBuilder->NewObject(medfieldfather);
+ anAttr = myBuilder->FindOrCreateAttribute(medfieldnamefather, "AttributeName");
+ aName = SALOMEDS::AttributeName::_narrow(anAttr);
+ aName->SetValue((_fieldTptr->getName()).c_str());
+
+ } ;
+
+ // Create object labelled according to Field's Name
+
+ MESSAGE("Add a Field Object under "<<_fieldTptr->getName());
+ myBuilder->NewCommand();
+ SALOMEDS::SObject_var newObj = myBuilder->NewObject(medfieldnamefather);
+
+ ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
+ ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting()) ;
+ CORBA::ORB_var &orb = init(0,0);
+
+ ostringstream iterationName ;
+ iterationName<<"("<<_fieldTptr->getIterationNumber()<<","<<_fieldTptr->getOrderNumber()<<")";
+ anAttr = myBuilder->FindOrCreateAttribute(newObj, "AttributeName");
+ aName = SALOMEDS::AttributeName::_narrow(anAttr);
+ aName->SetValue(iterationName.str().c_str());
+
+ string iorStr = orb->object_to_string(myIor);
+ anAttr = myBuilder->FindOrCreateAttribute(newObj, "AttributeIOR");
+ aIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
+ aIOR->SetValue(iorStr.c_str());
+
+ SALOMEDS::SObject_var supportObject = myStudy->FindObject(_support->getName());
+ if ( CORBA::is_nil(supportObject) )
+ {
+ MESSAGE("FIELDOF_i::addInStudy : SUPPORT not found") ;
+ }
+ else
+ {
+ SALOMEDS::SObject_var newObjSupport = myBuilder->NewObject(newObj);
+ myBuilder->Addreference(newObjSupport,supportObject);
+ }
+ myBuilder->CommitCommand();
+ _FieldId = newObj->GetID();
+ MESSAGE("FIELDOF_i::addInStudy _FieldId="<< _FieldId);
+
+ END_OF(" FIELDOF_i::addInStudy");
+
+}
+//=============================================================================
+/*!
+ * CORBA: write
+ */
+//=============================================================================
+template <class T> void FIELDOF_i<T>::write (CORBA::Long i, const char* driverFieldName)
+throw (SALOME::SALOME_Exception)
+{
+ if (_fieldTptr==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
+ SALOME::INTERNAL_ERROR);
+ try
+ {
+ _fieldTptr->write(i,driverFieldName);
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Exception en accedant au champ");
+ THROW_SALOME_CORBA_EXCEPTION("Unable to acces Field C++ Object"\
+ ,SALOME::INTERNAL_ERROR);
+ }
+}
+//=============================================================================
+/*!
+ * CORBA: read
+ */
+//=============================================================================
+template <class T> void FIELDOF_i<T>::read (CORBA::Long i)
+throw (SALOME::SALOME_Exception)
+{
+ if (_fieldTptr==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
+ SALOME::INTERNAL_ERROR);
+ try
+ {
+ _fieldTptr->read(i);
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Exception en accedant au champ");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+}
+//=============================================================================
+/*!
+ * CORBA: rmDriver
+ */
+//=============================================================================
+template <class T> void FIELDOF_i<T>::rmDriver (CORBA::Long i)
+throw (SALOME::SALOME_Exception)
+{
+ if (_fieldTptr==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
+ SALOME::INTERNAL_ERROR);
+ try
+ {
+ _fieldTptr->rmDriver(i);
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Exception en accedant au champ");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+}
+//=============================================================================
+/*!
+ * CORBA: addDriver
+ */
+//=============================================================================
+template <class T> CORBA::Long FIELDOF_i<T>::addDriver (SALOME_MED::medDriverTypes driverType,
+ const char* fileName, const char* fieldName) throw (SALOME::SALOME_Exception)
+{
+ if (_fieldTptr==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
+ SALOME::INTERNAL_ERROR);
+ try
+ {
+ int drivernum=_fieldTptr->addDriver(
+ convertIdlDriverToMedDriver(driverType),
+ fileName,
+ fieldName);
+ return drivernum;
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Exception en accedant au champ");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+}
+
+#endif /* MED_FIELDOF_I_HXX_ */
--- /dev/null
+//=============================================================================
+// File : MEDMEM_Field_i.cxx
+// Created : mer fév 20 15:47:57 CET 2002
+// Author : EDF
+// Project : SALOME
+// Copyright : EDF 2002
+// $Header: /export/home/PAL/MED_SRC/src/MEDMEM_I/MEDMEM_Field_i.cxx
+//=============================================================================
+# include "MEDMEM_Field_i.hxx"
+using namespace MEDMEM;
+
+FIELD_i::FIELD_i()
+{
+}
+FIELD_i::FIELD_i(const FIELD_i & x)
+{
+}
+FIELD_i::~FIELD_i()
+{
+}
+
--- /dev/null
+//=============================================================================
+// File : MEDMEM_Field_i.hxx
+// Created : mer fév 20 15:47:57 CET 2002
+// Author : EDF
+// Project : SALOME
+// Copyright : EDF 2002
+// $Header: /export/home/PAL/MED_SRC/src/MEDMEM_I/MEDMEM_Field_i.hxx
+//=============================================================================
+# ifndef __FIELD_I_H__
+# define __FIELD_I_H__
+
+# include <SALOMEconfig.h>
+
+# include CORBA_SERVER_HEADER(MED)
+# include "Utils_CorbaException.hxx"
+
+namespace MEDMEM {
+class FIELD_i
+{
+
+protected :
+ FIELD_i();
+
+public :
+ FIELD_i( const FIELD_i & x);
+ ~FIELD_i();
+ virtual char * getName()
+ throw (SALOME::SALOME_Exception) = 0;
+ virtual char * getDescription()
+ throw (SALOME::SALOME_Exception) = 0;
+ virtual SALOME_MED::SUPPORT_ptr getSupport()
+ throw (SALOME::SALOME_Exception) = 0;
+ virtual CORBA::Long getNumberOfComponents()
+ throw (SALOME::SALOME_Exception) = 0;
+ virtual char * getComponentName(CORBA::Long i)
+ throw (SALOME::SALOME_Exception) = 0;
+ virtual char * getComponentUnit(CORBA::Long i)
+ throw (SALOME::SALOME_Exception) = 0;
+ virtual CORBA::Long getIterationNumber()
+ throw (SALOME::SALOME_Exception) = 0;
+ virtual CORBA::Long getOrderNumber()
+ throw (SALOME::SALOME_Exception) = 0;
+ virtual CORBA::Double getTime()
+ throw (SALOME::SALOME_Exception) = 0;
+ virtual CORBA::Long getCorbaIndex()
+ throw (SALOME::SALOME_Exception) = 0;
+ virtual SALOME_MED::string_array * getComponentsNames()
+ throw (SALOME::SALOME_Exception) = 0;
+ virtual SALOME_MED::string_array * getComponentsUnits()
+ throw (SALOME::SALOME_Exception) = 0;
+ virtual void addInStudy(SALOMEDS::Study_ptr myStudy ,
+ SALOME_MED::FIELD_ptr myIor)
+ throw (SALOME::SALOME_Exception,
+ SALOMEDS::StudyBuilder::LockProtection) = 0;
+ virtual CORBA::Long addDriver (SALOME_MED::medDriverTypes driverType,
+ const char* fileName,
+ const char* fieldName)
+ throw (SALOME::SALOME_Exception) = 0;
+ virtual void rmDriver (CORBA::Long i)
+ throw (SALOME::SALOME_Exception) = 0;
+ virtual void read (CORBA::Long i)
+ throw (SALOME::SALOME_Exception) = 0;
+ virtual void write (CORBA::Long i,
+ const char* driverFieldName)
+ throw (SALOME::SALOME_Exception) = 0;
+};
+};
+# endif /* ifndef ____FIELD_I_H__ */
--- /dev/null
+//=============================================================================
+// File : MEDMEM_Group_i.cxx
+// Project : SALOME
+// Author : EDF
+// Copyright : EDF 2002
+// $Header: /export/home/PAL/MED_SRC/src/MEDMEM_I/MEDMEM_Group_i.cxx
+//=============================================================================
+
+#include <vector>
+
+#include "utilities.h"
+#include "Utils_CorbaException.hxx"
+
+#include "MEDMEM_Group_i.hxx"
+#include "MEDMEM_Family_i.hxx"
+
+#include "MEDMEM_Group.hxx"
+#include "MEDMEM_Family.hxx"
+using namespace MEDMEM;
+
+//=============================================================================
+/*!
+ * Default constructor
+ */
+//=============================================================================
+GROUP_i::GROUP_i():_group((::GROUP*)NULL),
+ SUPPORT_i()
+{
+ BEGIN_OF("Default Constructor GROUP_i");
+ END_OF("Default Constructor GROUP_i");
+};
+//=============================================================================
+/*!
+ * Destructor
+ */
+//=============================================================================
+GROUP_i::~GROUP_i()
+{
+};
+//=============================================================================
+/*!
+ * Constructor
+ */
+//=============================================================================
+GROUP_i::GROUP_i(const ::GROUP * const g):_group(g),
+ SUPPORT_i(g)
+{
+ BEGIN_OF("Constructor GROUP_i");
+ END_OF("Constructor GROUP_i");
+};
+//=============================================================================
+/*!
+ * Constructor par recopie
+ */
+//=============================================================================
+GROUP_i::GROUP_i(const GROUP_i & g):_group(g._group),
+ SUPPORT_i(g._group)
+{
+ BEGIN_OF("Constructor GROUP_i");
+ END_OF("Constructor GROUP_i");
+};
+//=============================================================================
+/*!
+ * CORBA: Number of Families existing in the group
+ */
+//=============================================================================
+
+CORBA::Long GROUP_i::getNumberOfFamilies()
+throw (SALOME::SALOME_Exception)
+{
+ if (_group==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Group",\
+ SALOME::INTERNAL_ERROR);
+ try
+ {
+ return _group->getNumberOfFamilies();
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to get number of families of the group");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+};
+//=============================================================================
+/*!
+ * CORBA: Returns references for families within the group
+ */
+//=============================================================================
+
+SALOME_MED::Family_array* GROUP_i::getFamilies()
+throw (SALOME::SALOME_Exception)
+{
+ if (_group==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Group",\
+ SALOME::INTERNAL_ERROR);
+ SALOME_MED::Family_array_var myseq = new SALOME_MED::Family_array;
+ try
+ {
+ int nbfam= _group->getNumberOfFamilies();
+ myseq->length(nbfam);
+ vector<FAMILY*> fam(nbfam);
+ fam = _group->getFamilies();
+ for (int i=0;i<nbfam;i++)
+ {
+ FAMILY_i * f1=new FAMILY_i(fam[i]);
+ SALOME_MED::FAMILY_ptr f2 =
+ f1->POA_SALOME_MED::FAMILY::_this();
+ f1->_remove_ref();
+ myseq[i] = f2;
+ }
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to access families");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+ return myseq._retn();
+};
+//=============================================================================
+/*!
+ * CORBA: Returns reference for family I within the group
+ */
+//=============================================================================
+
+SALOME_MED::FAMILY_ptr GROUP_i::getFamily(CORBA::Long i)
+throw (SALOME::SALOME_Exception)
+{
+ if (_group==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Group",\
+ SALOME::INTERNAL_ERROR);
+ try
+ {
+ FAMILY * fam=_group->getFamily(i);
+ FAMILY_i * f1=new FAMILY_i(fam);
+ SALOME_MED::FAMILY_ptr f2 = f1->POA_SALOME_MED::FAMILY::_this();
+ f1->_remove_ref();
+ return (SALOME_MED::FAMILY::_duplicate(f2));
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to acces to the specified family");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+};
--- /dev/null
+//=============================================================================
+// File : MEDMEM_Group_i.hxx
+// Project : SALOME
+// Author : EDF
+// Copyright : EDF 2002
+// $Header: /export/home/PAL/MED_SRC/src/MEDMEM_I/MEDMEM_Group_i.hxx
+//=============================================================================
+#ifndef MED_GROUP_I_HXX_
+#define MED_GROUP_I_HXX_
+
+#include "MEDMEM_Support_i.hxx"
+
+namespace MEDMEM {
+class FAMILY_i;
+class GROUP;
+
+class GROUP_i:
+ public POA_SALOME_MED::GROUP,
+ public SUPPORT_i
+{
+protected :
+ GROUP_i();
+ ~GROUP_i();
+
+ // C++ object containing values
+ const ::MEDMEM::GROUP * const _group;
+
+public :
+ // Constructors and associated internal methods
+ GROUP_i(const ::MEDMEM::GROUP * const g);
+ GROUP_i(const GROUP_i & g);
+
+ CORBA::Long getNumberOfFamilies()
+ throw (SALOME::SALOME_Exception);
+ SALOME_MED::Family_array* getFamilies()
+ throw (SALOME::SALOME_Exception);
+ SALOME_MED::FAMILY_ptr getFamily(CORBA::Long i)
+ throw (SALOME::SALOME_Exception);
+};
+}
+
+#endif /* MED_GROUP_I_HXX_ */
--- /dev/null
+using namespace std;
+//=============================================================================
+// File : MEDMEM_Med_i.cxx
+// Project : SALOME
+// Author : EDF
+// Copyright : EDF 2002
+// $Header: /export/home/PAL/MED_SRC/src/MEDMEM_I/MEDMEM_i.cxx
+//=============================================================================
+
+#include <deque>
+
+//#include "MEDMEM_Field.hxx"
+
+#include "MEDMEM_Med_i.hxx"
+#include "MEDMEM_Mesh_i.hxx"
+#include "MEDMEM_FieldDouble_i.hxx"
+#include "MEDMEM_FieldInt_i.hxx"
+#include "MEDMEM_Support_i.hxx"
+#include "MEDMEM_Family_i.hxx"
+#include "MEDMEM_Group_i.hxx"
+#include "MEDMEM_convert.hxx"
+
+#include "MEDMEM_DriversDef.hxx"
+#include "utilities.h"
+#include "Utils_CorbaException.hxx"
+using namespace MEDMEM;
+
+//=============================================================================
+/*!
+ * Default constructor
+ */
+//=================================POA_SALOME_MED::FAMILY::_============================================
+MED_i::MED_i():_med((::MED*)NULL)
+{
+ BEGIN_OF("Default Constructor MED_i");
+ END_OF("Default Constructor MED_i");
+}
+//=============================================================================
+/*!
+ * methods
+ */
+//=============================================================================
+void MED_i::init(SALOMEDS::Study_ptr myStudy,driverTypes driverType, const string & fileName)
+{
+ const char * LOC = "MED_i::init(driverTypes, const string &)";
+ BEGIN_OF(LOC);
+
+ // we create all IOR from _med
+ _med = new ::MED(driverType,fileName);
+
+ // MESHES :
+ deque<string> meshesNames = _med->getMeshNames();
+ int numberOfMeshes = meshesNames.size();
+ for (int i=0; i<numberOfMeshes; i++)
+ {
+ ::MESH * myMesh = _med->getMesh(meshesNames[i]);
+ myMesh->read();
+ MESH_i * myMeshI = new MESH_i(myMesh);
+ SALOME_MED::MESH_ptr myMeshIOR = myMeshI->_this();
+ _meshes[meshesNames[i]] = myMeshIOR;
+ myMeshI->addInStudy(myStudy,myMeshIOR,fileName);
+ }
+
+ // SUPPORTS :
+ _med->updateSupport();
+
+ // FAMILIES :
+ // we add all families
+ vector<FAMILY*> familyVector;
+ vector<FAMILY*>::iterator familyVectorIt;
+ // GROUPS :
+ // we add all groups
+ vector<GROUP*> groupVector;
+ vector<GROUP*>::iterator groupVectorIt;
+
+ MED_FR::MESH_ENTITIES::const_iterator currentEntity;
+ for (int i=0; i<numberOfMeshes; i++)
+ {
+ ::MESH * ptrMesh = _med->getMesh(meshesNames[i]);
+ for (currentEntity = MED_FR::meshEntities.begin();
+ currentEntity != MED_FR::meshEntities.end();
+ currentEntity++)
+ {
+ // family :
+ familyVector = ptrMesh->getFamilies((MED_EN::medEntityMesh)(*currentEntity).first);
+ for (familyVectorIt = familyVector.begin();
+ familyVectorIt != familyVector.end();
+ familyVectorIt++)
+ {
+ FAMILY_i * myFamilyI = new FAMILY_i(*familyVectorIt);
+ SALOME_MED::FAMILY_ptr myFamilyIOR = myFamilyI->POA_SALOME_MED::FAMILY::_this();
+ myFamilyI->addInStudy(myStudy,myFamilyIOR);
+ }
+
+ // group :
+ groupVector = ptrMesh->getGroups((MED_EN::medEntityMesh)(*currentEntity).first);
+ for (groupVectorIt = groupVector.begin();
+ groupVectorIt != groupVector.end();
+ groupVectorIt++)
+ {
+ GROUP_i * myGroupI = new GROUP_i(*groupVectorIt);
+ SALOME_MED::GROUP_ptr myGroupIOR = myGroupI->POA_SALOME_MED::GROUP::_this();
+ myGroupI->addInStudy(myStudy,myGroupIOR);
+ }
+ }
+ }
+
+ for (int i=0; i<numberOfMeshes; i++)
+ {
+ map<MED_FR::med_entite_maillage,::SUPPORT*> mySupports = _med->getSupports(meshesNames[i]);
+ map<MED_FR::med_entite_maillage,::SUPPORT*>::const_iterator itSupport;
+ map<MED_FR::med_entite_maillage, SALOME_MED::SUPPORT_ptr> & mySupportsIOR
+ = _supports[meshesNames[i]];
+ for ( itSupport = mySupports.begin(); itSupport != mySupports.end(); itSupport++ )
+ {
+ SUPPORT_i * mySupportI = new SUPPORT_i((*itSupport).second);
+ SALOME_MED::SUPPORT_ptr mySupportIOR = mySupportI->_this();
+ mySupportsIOR[(*itSupport).first] = mySupportIOR;
+ mySupportI->addInStudy(myStudy,mySupportIOR);
+ }
+ }
+
+ // FIELDS :
+ deque<string> fieldsNames = _med->getFieldNames();
+ int numberOfFields = fieldsNames.size();
+ for (int i=0; i<numberOfFields; i++)
+ {
+ deque<DT_IT_> myIteration = _med->getFieldIteration (fieldsNames[i]);
+ int numberOfIteration = myIteration.size();
+ for (int j=0; j<numberOfIteration; j++)
+ {
+ ::FIELD_ * myField = _med->getField(fieldsNames[i], myIteration[j].dt, myIteration[j].it);
+ string meshName = myField->getSupport()->getMesh()->getName();
+ medEntityMesh myEntity = myField->getSupport()->getEntity();
+ map<string, map<MED_FR::med_entite_maillage, SALOME_MED::SUPPORT_ptr> >::const_iterator
+ itSupportOnMesh = _supports.find(meshName);
+ if ( itSupportOnMesh == _supports.end() )
+ throw MED_EXCEPTION ( LOCALIZED( STRING(LOC)
+ << "There is no support on mesh named |"
+ << meshName << "|" ));
+ const map<MED_FR::med_entite_maillage, SALOME_MED::SUPPORT_ptr> & SupportOnMesh
+ = (*itSupportOnMesh).second;
+ map<MED_FR::med_entite_maillage,SALOME_MED::SUPPORT_ptr>::const_iterator itSupport
+ = SupportOnMesh.find((MED_FR::med_entite_maillage)myEntity);
+ if (itSupport == SupportOnMesh.end())
+ throw MED_EXCEPTION ( LOCALIZED( STRING(LOC)
+ << "There is no support on entity "
+ << entity << " in mesh named |"
+ << meshName << "|"));
+ SALOME_MED::SUPPORT_ptr mySupportIOR = (*itSupport).second;
+ med_type_champ type = myField->getValueType();
+ SALOME_MED::FIELD_ptr myFieldIOR;
+ switch (type)
+ {
+ case MED_FR::MED_INT32 :
+ {
+ ((FIELD<int>*)myField)->read();
+ FIELDINT_i * myFieldIntI = new FIELDINT_i(mySupportIOR,(FIELD<int>*)myField);
+ POA_SALOME_MED::FIELD_tie<FIELD_i> * myFieldTie
+ = new POA_SALOME_MED::FIELD_tie<FIELD_i>(myFieldIntI);
+ myFieldIOR = myFieldTie->_this();
+ myFieldIntI->addInStudy(myStudy,myFieldIOR);
+ break;
+ }
+
+ case MED_FR::MED_REEL64:
+ {
+ ((FIELD<double>*)myField)->read();
+ FIELDDOUBLE_i * myFieldDoubleI
+ = new FIELDDOUBLE_i(mySupportIOR,(FIELD<double>*)myField);
+ POA_SALOME_MED::FIELD_tie<FIELD_i> * myFieldTie
+ = new POA_SALOME_MED::FIELD_tie<FIELD_i>(myFieldDoubleI);
+ myFieldIOR = myFieldTie->_this();
+ myFieldDoubleI->addInStudy(myStudy,myFieldIOR);
+ break;
+ }
+ default:
+ {
+ throw MED_EXCEPTION ( LOCALIZED( STRING(LOC)
+ <<" * Iteration "<<FieldIteration[j].dt
+ <<", order number "<<FieldIteration[j].it
+ <<" has wrong type : "<<type));
+ break;
+ }
+ }
+
+ DT_IT_ dtIt;
+ dtIt.dt = myIteration[j].dt;
+ dtIt.it = myIteration[j].it;
+ _fields[fieldsNames[i]][dtIt] = myFieldIOR;
+ }
+ }
+
+ END_OF(LOC);
+}
+
+//=============================================================================
+/*!
+ * methods
+ */
+//=============================================================================
+void MED_i::initWithFieldType(SALOMEDS::Study_ptr myStudy,driverTypes driverType, const string & fileName)
+{
+ const char * LOC = "MED_i::initWithFieldType(driverTypes, const string &)";
+ BEGIN_OF(LOC);
+
+ // we create all IOR from _med
+ _med = new ::MED(driverType,fileName);
+
+ // MESHES :
+ deque<string> meshesNames = _med->getMeshNames();
+ int numberOfMeshes = meshesNames.size();
+ for (int i=0; i<numberOfMeshes; i++)
+ {
+ ::MESH * myMesh = _med->getMesh(meshesNames[i]);
+ myMesh->read();
+ MESH_i * myMeshI = new MESH_i(myMesh);
+ SALOME_MED::MESH_ptr myMeshIOR = myMeshI->_this();
+ _meshes[meshesNames[i]]=myMeshIOR;
+ myMeshI->addInStudy(myStudy,myMeshIOR);
+ }
+
+ // SUPPORTS :
+ _med->updateSupport();
+ for (int i=0; i<numberOfMeshes; i++)
+ {
+ map<MED_FR::med_entite_maillage,::SUPPORT*> mySupports = _med->getSupports(meshesNames[i]);
+ map<MED_FR::med_entite_maillage,::SUPPORT*>::const_iterator itSupport;
+ map<MED_FR::med_entite_maillage,SALOME_MED::SUPPORT_ptr> &
+ mySupportsIOR = _supports[meshesNames[i]];
+ for (itSupport=mySupports.begin(); itSupport!=mySupports.end(); itSupport++ )
+ {
+ SUPPORT_i * mySupportI = new SUPPORT_i((*itSupport).second);
+ SALOME_MED::SUPPORT_ptr mySupportIOR = mySupportI->_this();
+ mySupportsIOR[(*itSupport).first]= mySupportIOR;
+ mySupportI->addInStudy(myStudy,mySupportIOR);
+ }
+ }
+
+ // FIELDS :
+ deque<string> fieldsNames = _med->getFieldNames();
+ int numberOfFields = fieldsNames.size();
+ for (int i=0; i<numberOfFields; i++)
+ {
+ deque<DT_IT_> myIteration = _med->getFieldIteration (fieldsNames[i]);
+ int numberOfIteration = myIteration.size();
+ for (int j=0; j<numberOfIteration; j++)
+ {
+ ::FIELD_ * myField = _med->getField(fieldsNames[i],myIteration[j].dt,myIteration[j].it);
+ string meshName = myField->getSupport()->getMesh()->getName();
+ medEntityMesh myEntity = myField->getSupport()->getEntity();
+ map<string, map<MED_FR::med_entite_maillage,SALOME_MED::SUPPORT_ptr> >::const_iterator
+ itSupportOnMesh = _supports.find(meshName);
+ if (itSupportOnMesh == _supports.end() )
+ throw MED_EXCEPTION ( LOCALIZED( STRING(LOC)
+ << "There is no support on mesh named |"
+ << meshName << "|"));
+ const map<MED_FR::med_entite_maillage,SALOME_MED::SUPPORT_ptr> & SupportOnMesh
+ = (*itSupportOnMesh).second;
+ map<MED_FR::med_entite_maillage,SALOME_MED::SUPPORT_ptr>::const_iterator itSupport
+ = SupportOnMesh.find((MED_FR::med_entite_maillage)myEntity);
+ if (itSupport == SupportOnMesh.end() )
+ throw MED_EXCEPTION ( LOCALIZED( STRING(LOC)
+ << "There is no support on entity "
+ << entity << " in mesh named |"
+ << meshName << "|"));
+ SALOME_MED::SUPPORT_ptr mySupportIOR = (*itSupport).second;
+ med_type_champ type = myField->getValueType();
+
+ DT_IT_ dtIt;
+ dtIt.dt = myIteration[j].dt;
+ dtIt.it = myIteration[j].it;
+
+ switch (type)
+ {
+ case MED_FR::MED_INT32:
+ {
+ ((FIELD<int>*)myField)->read();
+ FIELDINT_i * myFieldIntI
+ = new FIELDINT_i(mySupportIOR,(FIELD<int>*)myField);
+ SALOME_MED::FIELDINT_ptr myFieldIntIOR;
+ POA_SALOME_MED::FIELDINT_tie<FIELDINT_i> * myFieldIntTie
+ = new POA_SALOME_MED::FIELDINT_tie<FIELDINT_i>(myFieldIntI);
+ myFieldIntIOR = myFieldIntTie->_this();
+ myFieldIntI->addInStudy(myStudy,myFieldIntIOR);
+ _fields[fieldsNames[i]][dtIt] = myFieldIntIOR;
+ break;
+ }
+
+ case MED_FR::MED_REEL64:
+ {
+ ((FIELD<double>*)myField)->read();
+ FIELDDOUBLE_i * myFieldDoubleI
+ = new FIELDDOUBLE_i(mySupportIOR,(FIELD<double>*)myField);
+ SALOME_MED::FIELDDOUBLE_ptr myFieldDoubleIOR;
+ POA_SALOME_MED::FIELDDOUBLE_tie<FIELDDOUBLE_i> * myFieldDoubleTie
+ = new POA_SALOME_MED::FIELDDOUBLE_tie<FIELDDOUBLE_i>(myFieldDoubleI);
+ myFieldDoubleIOR = myFieldDoubleTie->_this();
+ myFieldDoubleI->addInStudy(myStudy,myFieldDoubleIOR);
+ _fields[fieldsNames[i]][dtIt] = myFieldDoubleIOR;
+ break;
+ }
+
+ default:
+ {
+ throw MED_EXCEPTION ( LOCALIZED( STRING(LOC)
+ <<" * Iteration "<<FieldIteration[j].dt
+ <<", order number "<<FieldIteration[j].it
+ <<" has wrong type : "<<type));
+ break;
+ }
+ }
+ }
+ }
+
+ END_OF(LOC);
+}
+
+//=============================================================================
+/*!
+ * Destructor
+ */
+//=============================================================================
+MED_i::~MED_i()
+{
+}
+//=============================================================================
+/*!
+ * CORBA: Accessor for Number of meshes
+ */
+//=============================================================================
+CORBA::Long MED_i::getNumberOfMeshes()
+throw (SALOME::SALOME_Exception)
+{
+ if (_med==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Med object",\
+ SALOME::INTERNAL_ERROR);
+ try
+ {
+ return _med->getNumberOfMeshes();
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to get the number of meshes in Med Object");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+}
+//=============================================================================
+/*!
+ * CORBA: Accessor for Number of fields
+ */
+//=============================================================================
+CORBA::Long MED_i::getNumberOfFields()
+throw (SALOME::SALOME_Exception)
+{
+ if (_med==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Med object",\
+ SALOME::INTERNAL_ERROR);
+ try
+ {
+ return _med->getNumberOfFields();
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to get the number of fields in Med Object");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+}
+//=============================================================================
+/*!
+ * CORBA: Accessor for meshes names
+ */
+//=============================================================================
+SALOME_MED::string_array * MED_i::getMeshNames()
+throw (SALOME::SALOME_Exception)
+{
+ if (_med==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Med object",\
+ SALOME::INTERNAL_ERROR);
+ SALOME_MED::string_array_var myseq = new SALOME_MED::string_array;
+ try
+ {
+ int nbMeshes=_med->getNumberOfMeshes();
+ myseq->length(nbMeshes);
+ string * nameMeshes = new string[nbMeshes];
+ _med->getMeshNames(nameMeshes);
+ for (int i=0;i<nbMeshes;i++)
+ {
+ myseq[i]=CORBA::string_dup(nameMeshes[i].c_str());
+ }
+ delete [] nameMeshes;
+ nameMeshes=NULL;
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to get the names of the meshes in Med Object");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+ return myseq._retn();
+}
+//=============================================================================
+/*!
+ * CORBA: Accessor for fields names
+ */
+//=============================================================================
+SALOME_MED::string_array * MED_i::getFieldNames()
+throw (SALOME::SALOME_Exception)
+{
+ if (_med==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Med object",\
+ SALOME::INTERNAL_ERROR);
+ SALOME_MED::string_array_var myseq = new SALOME_MED::string_array;
+ try
+ {
+ int nbFields=_med->getNumberOfFields();
+ myseq->length(nbFields);
+ string * nameFields = new string[nbFields];
+ _med->getFieldNames(nameFields);
+ for (int i=0;i<nbFields;i++)
+ {
+ myseq[i]=CORBA::string_dup(nameFields[i].c_str());
+ }
+ delete nameFields;
+ nameFields=NULL;
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to get the names of the fields in Med Object");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+ return myseq._retn();
+}
+//=============================================================================
+/*!
+ * CORBA: Accessor for a specific mesh
+ */
+//=============================================================================
+SALOME_MED::MESH_ptr MED_i::getMeshByName(const char* meshName)
+throw (SALOME::SALOME_Exception)
+{
+ if (_med==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Med object",\
+ SALOME::INTERNAL_ERROR);
+ try
+ {
+ MESH * mesh=_med->getMesh(meshName);
+ MESH_i * m1 = new MESH_i(mesh);
+ SALOME_MED::MESH_ptr m2 = m1->POA_SALOME_MED::MESH::_this();
+ m1->_remove_ref();
+ return (SALOME_MED::MESH::_duplicate(m2));
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to get the specified mesh");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+
+}
+//=============================================================================
+/*!
+ * CORBA: Accessor for a specific mesh
+ */
+//=============================================================================
+SALOME_MED::MESH_ptr MED_i::getMesh(SALOME_MED::FIELD_ptr fieldPtr)
+throw (SALOME::SALOME_Exception)
+{
+ if (_med==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Med object",\
+ SALOME::INTERNAL_ERROR);
+ int ind=fieldPtr->getCorbaIndex();
+ SCRUTE(ind);
+
+ MESH * mesh;
+ SALOME_MED::FIELDINT_var fieldint =SALOME_MED::FIELDINT::_narrow(fieldPtr);
+ if (CORBA::is_nil(fieldint))
+ {
+ MESSAGE("Double");
+ SALOME_MED::FIELDDOUBLE_var fielddouble =
+ SALOME_MED::FIELDDOUBLE::_narrow(fieldPtr);
+ ASSERT(!CORBA::is_nil(fielddouble));
+ ASSERT(FIELDOF_i<double>::fieldMap.find(ind)
+ !=FIELDOF_i<double>::fieldMap.end());
+ ::FIELD<double> * fdouble = FIELDOF_i<double>::fieldMap[ind];
+ MESH * mesh=_med->getMesh(fdouble);
+ }
+ else
+ {
+ MESSAGE("Integer");
+ ASSERT(FIELDOF_i<int>::fieldMap.find(ind)!=FIELDOF_i<int>::fieldMap.end());
+ ::FIELD<int> * fint = FIELDOF_i<int>::fieldMap[ind];
+ MESH * mesh=_med->getMesh(fint);
+ }
+ MESH_i * meshi = new MESH_i(mesh);
+ SALOME_MED::MESH_ptr meshptr = meshi->POA_SALOME_MED::MESH::_this();
+ meshi->_remove_ref();
+ return (SALOME_MED::MESH::_duplicate(meshptr));
+
+}
+//=============================================================================
+/*!
+ * CORBA: Accessor for a specific field
+ */
+//=============================================================================
+SALOME_MED::FIELD_ptr MED_i::getField(const char* fieldName,
+ CORBA::Long pasTemps,
+ CORBA::Long numOrdre )
+throw (SALOME::SALOME_Exception)
+{
+ const char * LOC="MED_i::getField(const char*,CORBA::Long,CORBA::Long) ";
+ BEGIN_OF(LOC);
+
+ DT_IT_ dtIt;
+
+ dtIt.dt= (int)pasTemps;
+ dtIt.it= (int)numOrdre;
+
+ map<string,MAP_IOR_DT_IT_>::const_iterator itFields = _fields.find(fieldName);
+
+ if ( itFields == _fields.end() )
+ THROW_SALOME_CORBA_EXCEPTION("Field not found !", SALOME::INTERNAL_ERROR);
+
+ const MAP_IOR_DT_IT_ & map_dtIt = (*itFields).second;
+ MAP_IOR_DT_IT_::const_iterator itMap_dtIt = map_dtIt.find(dtIt);
+
+ if ( itMap_dtIt == map_dtIt.end() )
+ THROW_SALOME_CORBA_EXCEPTION("Iteration not found !", SALOME::INTERNAL_ERROR);
+
+ END_OF(LOC);
+ return (*itMap_dtIt).second;
+
+}
+//=============================================================================
+/*!
+ * CORBA: Accessor for a specific field
+ */
+//=============================================================================
+CORBA::Long MED_i::addDriver(SALOME_MED::medDriverTypes driverType, const char* fileName)
+throw (SALOME::SALOME_Exception)
+{
+ if (_med==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Med object",\
+ SALOME::INTERNAL_ERROR);
+ try
+ {
+ int driv=_med->addDriver(convertIdlDriverToMedDriver(driverType),
+ fileName);
+ return driv;
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to add a driver to the med object");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+
+}
+//=============================================================================
+/*!
+ * CORBA: relase the driver (mandatory)
+ */
+//=============================================================================
+void MED_i::rmDriver(CORBA::Long i)
+throw (SALOME::SALOME_Exception)
+{
+ if (_med==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Med object",\
+ SALOME::INTERNAL_ERROR);
+ try
+ {
+ _med->rmDriver(i);
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to unlink the driver from the med object");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+}
+//=============================================================================
+/*!
+ * CORBA: read med objects relations
+ */
+//=============================================================================
+void MED_i::readFileStruct(CORBA::Long i)
+throw (SALOME::SALOME_Exception)
+{
+ if (_med==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Med object",\
+ SALOME::INTERNAL_ERROR);
+ try
+ {
+ _med->readFileStruct(i);
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to read the structure of this file ");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+}
+//=============================================================================
+/*!
+ * CORBA: write specifics objects f
+ */
+//=============================================================================
+void MED_i::writeFrom(CORBA::Long i)
+throw (SALOME::SALOME_Exception)
+{
+ if (_med==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Med object",\
+ SALOME::INTERNAL_ERROR);
+ try
+ {
+ _med->writeFrom(i);
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to write this driver ");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+}
+//=============================================================================
+/*!
+ * CORBA: write objects
+ */
+//=============================================================================
+void MED_i::write(CORBA::Long i)
+throw (SALOME::SALOME_Exception)
+{
+ if (_med==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Med object",\
+ SALOME::INTERNAL_ERROR);
+ try
+ {
+ _med->write(i);
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to write this file ");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+}
+//=============================================================================
+/*!
+ * CORBA: Add Mesh in Med objects
+ */
+//=============================================================================
+void MED_i::addMesh(SALOME_MED::MESH_ptr ptrMesh)
+throw (SALOME::SALOME_Exception)
+{
+ if (_med==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Med object",\
+ SALOME::INTERNAL_ERROR);
+ try
+ {
+ int ind=ptrMesh->getCorbaIndex();
+ SCRUTE(ind);
+ ASSERT(MESH_i::meshMap.find(ind) !=MESH_i::meshMap.end());
+ MESH * mesh= MESH_i::meshMap[ind];
+ _med->addMesh(mesh);
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to link this mesh to this med object");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+}
+//=============================================================================
+/*!
+ * CORBA: Add field in Med objects
+ */
+//=============================================================================
+void MED_i::addField(SALOME_MED::FIELD_ptr ptrField)
+throw (SALOME::SALOME_Exception)
+{
+ if (_med==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Med object",\
+ SALOME::INTERNAL_ERROR);
+ int ind=ptrField->getCorbaIndex();
+ SCRUTE(ind);
+
+ SALOME_MED::FIELDINT_var fieldint =SALOME_MED::FIELDINT::_narrow(ptrField);
+ if (CORBA::is_nil(fieldint))
+ {
+ MESSAGE("Double");
+ SALOME_MED::FIELDDOUBLE_var fielddouble =
+ SALOME_MED::FIELDDOUBLE::_narrow(ptrField);
+ ASSERT(!CORBA::is_nil(fielddouble));
+ ASSERT(FIELDOF_i<double>::fieldMap.find(ind)
+ !=FIELDOF_i<double>::fieldMap.end());
+ ::FIELD<double> * fdouble = FIELDOF_i<double>::fieldMap[ind];
+ // A modifier
+ //_med->addField(fdouble);
+ }
+ else
+ {
+ MESSAGE("Integer");
+ ASSERT(FIELDOF_i<int>::fieldMap.find(ind)!=FIELDOF_i<int>::fieldMap.end());
+ ::FIELD<int> * fint = FIELDOF_i<int>::fieldMap[ind];
+ //_med->addField(fint);
+ }
+}
+//=============================================================================
+/*!
+ * CORBA: Add Med in Study
+ */
+//=============================================================================
+void MED_i::addInStudy(SALOMEDS::Study_ptr myStudy, SALOME_MED::MED_ptr myIor)
+throw (SALOME::SALOME_Exception,SALOMEDS::StudyBuilder::LockProtection)
+{
+ BEGIN_OF("MED_Mesh_i::addInStudy");
+ if ( _medId != "" )
+ {
+ MESSAGE("Med already in Study");
+ THROW_SALOME_CORBA_EXCEPTION("Med already in Study", \
+ SALOME::BAD_PARAM);
+ };
+
+ SALOMEDS::StudyBuilder_var myBuilder = myStudy->NewBuilder();
+ myBuilder->NewCommand();
+ SALOMEDS::GenericAttribute_var anAttr;
+ SALOMEDS::AttributeName_var aName;
+ SALOMEDS::AttributeIOR_var aIOR;
+
+ // Create SComponent labelled 'MED' if it doesn't already exit
+ SALOMEDS::SComponent_var medfather = myStudy->FindComponent("MED");
+ if ( CORBA::is_nil(medfather) )
+ {
+ THROW_SALOME_CORBA_EXCEPTION("Component Med not found",
+ SALOME::BAD_PARAM);
+ };
+
+ MESSAGE("Add a MED Object under Med");
+ SALOMEDS::SObject_var newObj = myBuilder->NewObject(medfather);
+
+ ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance();
+ ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting());
+ CORBA::ORB_var &orb = init(0,0);
+ string iorStr = orb->object_to_string(myIor);
+ anAttr = myBuilder->FindOrCreateAttribute(newObj, "AttributeIOR");
+ aIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
+ aIOR->SetValue(iorStr.c_str());
+ anAttr = myBuilder->FindOrCreateAttribute(newObj, "AttributeName");
+ aName = SALOMEDS::AttributeName::_narrow(anAttr);
+ aName->SetValue("Objet MED");
+ _medId = newObj->GetID();
+ myBuilder->CommitCommand();
+
+ END_OF("Med_i::addInStudy(SALOMEDS::Study_ptr myStudy)");
+}
+
--- /dev/null
+//=============================================================================
+// File : MEDMEM_Med_i.hxx
+// Project : SALOME
+// Author : EDF
+// Copyright : EDF 2002
+// $Header: /export/home/PAL/MED_SRC/src/MEDMEM_I/MEDMEM_Med_i.hxx
+//=============================================================================
+
+#ifndef _MED_MED_I_HXX_
+#define _MED_MED_I_HXX_
+
+#include <string>
+
+#include <SALOMEconfig.h>
+
+#include CORBA_SERVER_HEADER(MED)
+#include CORBA_SERVER_HEADER(SALOMEDS)
+#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+
+#include "MEDMEM_Med.hxx"
+
+namespace MEDMEM {
+typedef map<DT_IT_, SALOME_MED::FIELD_ptr, LT_DT_IT_ > MAP_IOR_DT_IT_;
+
+class MED_i: public POA_SALOME_MED::MED
+{
+
+private :
+
+protected:
+ // C++ object containing values
+ //::MED * const _med;
+ ::MEDMEM::MED * _med;
+ string _medId;
+
+ map<string,SALOME_MED::MESH_ptr> _meshes; // We can't have two MESHes with the same name.
+
+ map<string,map<MED_FR::med_entite_maillage,SALOME_MED::SUPPORT_ptr> > _supports;
+
+ map<string,MAP_IOR_DT_IT_> _fields; // We can't have two FIELDs with the same name.
+
+public:
+ // Constructors and associated internal methods
+ MED_i();
+ // MED_i(::MED * const m);
+ // MED_i(MED_i & m);
+ ~MED_i();
+
+ void init(SALOMEDS::Study_ptr myStudy, driverTypes driverType, const string & fileName); // Analyse the file <fileName> by calling readFileStruct
+
+ void initWithFieldType(SALOMEDS::Study_ptr myStudy, driverTypes driverType, const string & fileName); // Same method as above but with storage of fields with their type
+
+ // IDL Methods
+ CORBA::Long getNumberOfMeshes() throw (SALOME::SALOME_Exception);
+ CORBA::Long getNumberOfFields() throw (SALOME::SALOME_Exception);
+ SALOME_MED::string_array * getMeshNames() throw (SALOME::SALOME_Exception);
+ SALOME_MED::string_array * getFieldNames() throw (SALOME::SALOME_Exception);
+ SALOME_MED::MESH_ptr getMeshByName(const char* meshName)
+ throw (SALOME::SALOME_Exception);
+ SALOME_MED::MESH_ptr getMesh(SALOME_MED::FIELD_ptr fieldPtr)
+ throw (SALOME::SALOME_Exception);
+ SALOME_MED::FIELD_ptr getField(const char* fieldName,
+ CORBA::Long pasTemps,
+ CORBA::Long numOrdre)
+ throw (SALOME::SALOME_Exception);
+ CORBA::Long addDriver(SALOME_MED::medDriverTypes driverType,
+ const char* fileName)
+ throw (SALOME::SALOME_Exception);
+ void rmDriver(CORBA::Long i)
+ throw (SALOME::SALOME_Exception);
+ void readFileStruct(CORBA::Long i)
+ throw (SALOME::SALOME_Exception);
+ void writeFrom(CORBA::Long i)
+ throw (SALOME::SALOME_Exception);
+ void write(CORBA::Long i)
+ throw (SALOME::SALOME_Exception);
+ void addMesh(SALOME_MED::MESH_ptr ptrMesh)
+ throw (SALOME::SALOME_Exception);
+ void addField(SALOME_MED::FIELD_ptr ptrField)
+ throw (SALOME::SALOME_Exception);
+ void addInStudy(SALOMEDS::Study_ptr myStudy,
+ SALOME_MED::MED_ptr myIor)
+ throw (SALOME::SALOME_Exception,
+ SALOMEDS::StudyBuilder::LockProtection);
+};
+}
+
+#endif /* _MED_MED_I_HXX_ */
--- /dev/null
+//=============================================================================
+// File : MEDMEM_Mesh_i.cxx
+// Project : SALOME
+// Author : EDF
+// Copyright : EDF 2002
+// $Header: /export/home/PAL/MED_SRC/src/MEDMEM_I/MEDMEM_Mesh_i.cxx
+//=============================================================================
+
+#include <vector>
+
+#include "utilities.h"
+#include "Utils_CorbaException.hxx"
+#include "Utils_ORB_INIT.hxx"
+#include "Utils_SINGLETON.hxx"
+
+#include "MEDMEM_convert.hxx"
+#include "MEDMEM_Mesh_i.hxx"
+#include "MEDMEM_Support_i.hxx"
+#include "MEDMEM_Family_i.hxx"
+#include "MEDMEM_Group_i.hxx"
+#include "MEDMEM_FieldDouble_i.hxx"
+
+#include "MEDMEM_Mesh.hxx"
+#include "MEDMEM_Family.hxx"
+#include "MEDMEM_Group.hxx"
+#include "MEDMEM_CellModel.hxx"
+using namespace MEDMEM;
+
+// Initialisation des variables statiques
+map < int, ::MESH *> MESH_i::meshMap ;
+int MESH_i::meshIndex = 0 ;
+
+
+
+//=============================================================================
+/*!
+ * Default constructor
+ */
+//=============================================================================
+MESH_i::MESH_i(): _mesh(constructConstMesh()),
+ _corbaIndex(MESH_i::meshIndex++),
+ _meshId("")
+{
+ BEGIN_OF("Default Constructor MESH_i");
+ MESH_i::meshMap[_corbaIndex]=_mesh;
+ END_OF("Default Constructor MESH_i");
+}
+//=============================================================================
+/*!
+ * Destructor
+ */
+//=============================================================================
+MESH_i::~MESH_i()
+{
+}
+//=============================================================================
+/*!
+ * Constructor
+ */
+//=============================================================================
+MESH_i::MESH_i(::MESH * const m ) :_mesh(m),
+ _corbaIndex(MESH_i::meshIndex++),
+ _meshId("")
+{
+ BEGIN_OF("Constructor MESH_i(::MESH * const m )");
+ MESH_i::meshMap[_corbaIndex]=_mesh;
+ SCRUTE(_mesh);
+
+ END_OF("Constructor MESH_i(::MESH * const m )");
+}
+//=============================================================================
+/*!
+ * Copy Constructor
+ */
+//=============================================================================
+//MESH_i::MESH_i(const MESH_i & m) :_mesh(m._mesh),
+MESH_i::MESH_i( MESH_i & m) :_mesh(m._mesh),
+ _corbaIndex(MESH_i::meshIndex++),
+ _meshId("")
+{
+ BEGIN_OF("Constructor MESH_i");
+ MESH_i::meshMap[_corbaIndex]=_mesh;
+ END_OF("Constructor MESH_i");
+}
+//=============================================================================
+/*!
+ * Internal Method in order to have a const ptr
+ */
+//=============================================================================
+::MESH * MESH_i::constructConstMesh() const
+{
+ ::MESH * const ptrMesh =new ::MESH();
+ return ptrMesh;
+}
+//=============================================================================
+/*!
+ * CORBA: Accessor for Name
+ */
+//=============================================================================
+char * MESH_i::getName()
+throw (SALOME::SALOME_Exception)
+{
+ if (_mesh==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
+ SALOME::INTERNAL_ERROR);
+
+ try
+ {
+ return CORBA::string_dup(_mesh->getName().c_str());
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to acces the mesh name");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+}
+//=============================================================================
+/*!
+ * CORBA: Accessor for corbaindex cuisine interne
+ */
+//=============================================================================
+CORBA::Long MESH_i::getCorbaIndex()
+throw (SALOME::SALOME_Exception)
+{
+ if (_mesh==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
+ SALOME::INTERNAL_ERROR);
+ return _corbaIndex;
+}
+//=============================================================================
+/*!
+ * CORBA: Accessor for Space Dimension
+ */
+//=============================================================================
+CORBA::Long MESH_i::getSpaceDimension()
+throw (SALOME::SALOME_Exception)
+{
+ if (_mesh==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
+ SALOME::INTERNAL_ERROR);
+ try
+ {
+ return _mesh->getSpaceDimension();
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to acces the space dimension ");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+}
+//=============================================================================
+/*!
+ * CORBA: Accessor for Mesh Dimension
+ */
+//=============================================================================
+CORBA::Long MESH_i::getMeshDimension()
+throw (SALOME::SALOME_Exception)
+{
+ if (_mesh==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
+ SALOME::INTERNAL_ERROR);
+ try
+ {
+ return _mesh->getMeshDimension();
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to acces the mesh dimension ");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+}
+//=============================================================================
+/*!
+ * CORBA: boolean indicating if mesh is a Grid
+ */
+//=============================================================================
+CORBA::Boolean MESH_i::getIsAGrid()
+throw (SALOME::SALOME_Exception)
+{
+ if (_mesh==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
+ SALOME::INTERNAL_ERROR);
+ try
+ {
+ return _mesh->getIsAGrid();
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to acces mesh flag isAGrid");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+}
+//=============================================================================
+/*!
+ * CORBA: boolean indicating if connectivity exists
+ */
+//=============================================================================
+CORBA::Boolean MESH_i::existConnectivity
+ (SALOME_MED::medConnectivity connectivityType,
+ SALOME_MED::medEntityMesh entity)
+throw (SALOME::SALOME_Exception)
+{
+ if (_mesh==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
+ SALOME::INTERNAL_ERROR);
+ try
+ {
+ return _mesh->existConnectivity(connectivityType,
+ convertIdlEntToMedEnt(entity)); }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to acces mesh flag existConnectivity");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+}
+
+//=============================================================================
+/*!
+ * CORBA: Accessor for Coordinates System
+ */
+//=============================================================================
+char * MESH_i::getCoordinatesSystem()
+throw (SALOME::SALOME_Exception)
+{
+ if (_mesh==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
+ SALOME::INTERNAL_ERROR);
+
+ try
+ {
+ return CORBA::string_dup(_mesh->getCoordinatesSystem().c_str());
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to acces the type of CoordinatesSystem");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+}
+//=============================================================================
+/*!
+ * CORBA: Accessor for a specific coordinate
+ */
+//=============================================================================
+double MESH_i::getCoordinate(CORBA::Long Number, CORBA::Long Axis)
+throw (SALOME::SALOME_Exception)
+{
+ if (_mesh==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
+ SALOME::INTERNAL_ERROR);
+ try
+ {
+ return _mesh->getCoordinate(Number,Axis);
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to acces this coordinate");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+}
+//=============================================================================
+/*!
+ * CORBA: Accessor for Coordinates
+ */
+//=============================================================================
+SALOME_MED::double_array * MESH_i::getCoordinates(SALOME_MED::medModeSwitch typeSwitch)
+throw (SALOME::SALOME_Exception)
+{
+ if (_mesh==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
+ SALOME::INTERNAL_ERROR);
+ SALOME_MED::double_array_var myseq = new SALOME_MED::double_array;
+ try
+ {
+ int spaceDimension=_mesh->getSpaceDimension();
+ int nbNodes=_mesh->getNumberOfNodes();
+ const double * coordinates =_mesh->getCoordinates(
+ convertIdlModeToMedMode(typeSwitch));
+
+ myseq->length(nbNodes*spaceDimension);
+ for (int i=0; i<nbNodes*spaceDimension; i++)
+ {
+ myseq[i]=coordinates[i];
+ };
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to acces the coordinates");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+ return myseq._retn();
+}
+//=============================================================================
+/*!
+ * CORBA: Accessor for Coordinates Names
+ */
+//=============================================================================
+SALOME_MED::string_array * MESH_i::getCoordinatesNames()
+throw (SALOME::SALOME_Exception)
+{
+ if (_mesh==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
+ SALOME::INTERNAL_ERROR);
+ SALOME_MED::string_array_var myseq = new SALOME_MED::string_array;
+ try
+ {
+ int spaceDimension=_mesh->getSpaceDimension();
+ const string * coordinatesName =_mesh->getCoordinatesNames();
+ myseq->length(spaceDimension);
+ for (int i=0; i<spaceDimension; i++)
+ {
+ myseq[i]=CORBA::string_dup(coordinatesName[i].c_str());
+ }
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to acces the coordinates names");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+ return myseq._retn();
+
+}
+//=============================================================================
+/*!
+ * CORBA: Accessor for Coordinates Units
+ */
+//=============================================================================
+SALOME_MED::string_array * MESH_i::getCoordinatesUnits()
+throw (SALOME::SALOME_Exception)
+{
+ if (_mesh==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
+ SALOME::INTERNAL_ERROR);
+ SALOME_MED::string_array_var myseq = new SALOME_MED::string_array;
+ try
+ {
+ int spaceDimension=_mesh->getSpaceDimension();
+ const string * coordinatesUnits =_mesh->getCoordinatesUnits();
+ myseq->length(spaceDimension);
+ for (int i=0; i<spaceDimension; i++)
+ {
+ myseq[i]=CORBA::string_dup(coordinatesUnits[i].c_str());
+ };
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to acces the coordinates units");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+ return myseq._retn();
+}
+//=============================================================================
+/*!
+ * CORBA: Accessor for Number of Nodes
+ */
+//=============================================================================
+CORBA::Long MESH_i::getNumberOfNodes()
+throw (SALOME::SALOME_Exception)
+{
+ if (_mesh==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
+ SALOME::INTERNAL_ERROR);
+ try
+ {
+ return _mesh->getNumberOfNodes();
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to acces number of nodes");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+}
+//=============================================================================
+/*!
+ * CORBA: Accessor for number of Types
+ */
+//=============================================================================
+CORBA::Long MESH_i::getNumberOfTypes(SALOME_MED::medEntityMesh entity)
+throw (SALOME::SALOME_Exception)
+{
+ if (_mesh==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
+ SALOME::INTERNAL_ERROR);
+ try
+ {
+ return _mesh->getNumberOfTypes(convertIdlEntToMedEnt(entity));
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to acces number of differents types");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+}
+//=============================================================================
+/*!
+ * CORBA: Accessor for existing geometry element types
+ */
+//=============================================================================
+SALOME_MED::medGeometryElement MESH_i::getElementType (SALOME_MED::medEntityMesh entity,
+ CORBA::Long number)
+throw (SALOME::SALOME_Exception)
+{
+ if (_mesh==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
+ SALOME::INTERNAL_ERROR);
+ try
+ {
+ return _mesh->getElementType(convertIdlEntToMedEnt(entity),number);
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to acces number of differents element types");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+}
+
+//=============================================================================
+/*!
+ * CORBA: Accessor for existing geometry element types
+ * Not implemented for MED_ALL_ENTITIES
+ */
+//=============================================================================
+SALOME_MED::medGeometryElement_array * MESH_i::getTypes (SALOME_MED::medEntityMesh entity)
+throw (SALOME::SALOME_Exception)
+{
+ if (_mesh==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
+ SALOME::INTERNAL_ERROR);
+ if (entity ==SALOME_MED::MED_ALL_ENTITIES)
+ THROW_SALOME_CORBA_EXCEPTION("Not implemented for MED_ALL_ENTITIES",\
+ SALOME::BAD_PARAM);
+ SALOME_MED::medGeometryElement_array_var myseq =
+ new SALOME_MED::medGeometryElement_array;
+ try
+ {
+ int nbTypes=_mesh->getNumberOfTypes(convertIdlEntToMedEnt(entity));
+ const medGeometryElement * elemts =_mesh->getTypes(
+ convertIdlEntToMedEnt(entity));
+ myseq->length(nbTypes);
+ for (int i=0; i<nbTypes; i++)
+ {
+ myseq[i]=convertMedEltToIdlElt(elemts[i]);
+ };
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to acces coordinates");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+ return myseq._retn();
+}
+//=============================================================================
+/*!
+ * CORBA: Returns number of elements of type medGeometryElement
+ * Not implemented for MED_ALL_ELEMENTS
+* implemented for MED_ALL_ENTITIES
+ */
+//=============================================================================
+CORBA::Long MESH_i::getNumberOfElements(SALOME_MED::medEntityMesh entity,
+ SALOME_MED::medGeometryElement geomElement)
+throw (SALOME::SALOME_Exception)
+{
+ if (_mesh==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
+ SALOME::INTERNAL_ERROR);
+ if (verifieParam(entity,geomElement)==false)
+ THROW_SALOME_CORBA_EXCEPTION("parameters don't match",\
+ SALOME::BAD_PARAM);
+
+ try
+ {
+ return _mesh->getNumberOfElements(convertIdlEntToMedEnt(entity),
+ convertIdlEltToMedElt(geomElement));
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to acces number of elements");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+}
+//=============================================================================
+/*!
+ * CORBA: Accessor for connectivities
+ */
+//=============================================================================
+SALOME_MED::long_array * MESH_i::getConnectivity(SALOME_MED::medModeSwitch typeSwitch,
+ SALOME_MED::medConnectivity mode,
+ SALOME_MED::medEntityMesh entity,
+ SALOME_MED::medGeometryElement geomElement)
+throw (SALOME::SALOME_Exception)
+{
+ if (_mesh==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
+ SALOME::INTERNAL_ERROR);
+ if (verifieParam(entity,geomElement)==false)
+ THROW_SALOME_CORBA_EXCEPTION("parameters don't match",\
+ SALOME::BAD_PARAM);
+ SALOME_MED::long_array_var myseq= new SALOME_MED::long_array;
+ try
+ {
+ int nbelements;
+ int elt1 = _mesh->getNumberOfElements(
+ convertIdlEntToMedEnt(entity),
+ convertIdlEltToMedElt(geomElement));
+SCRUTE(elt1);
+ if ( mode == SALOME_MED::MED_DESCENDING)
+ {
+MESSAGE("MED_DESCENDING");
+ int elt2 =(_mesh->getCellsTypes(MED_CELL))->getNumberOfConstituents(1);
+ //int elt2 =(_mesh->getTypes(convertIdlEltToMedElt(geomElement)))->getNumberOfConstituents(1);
+ nbelements= elt2 * elt1;
+SCRUTE(elt2);
+ }
+ else
+ {
+MESSAGE("MED_NODAL");
+ const int * tab=_mesh->getConnectivityIndex(
+ convertIdlConnToMedConn(mode),
+ convertIdlEntToMedEnt(entity));
+ nbelements = tab[elt1 ] - 1 ;
+ }
+SCRUTE(entity);
+SCRUTE(geomElement);
+SCRUTE(nbelements);
+ myseq->length(nbelements);
+ const int * numbers=_mesh->getConnectivity(convertIdlModeToMedMode(typeSwitch),
+ convertIdlConnToMedConn(mode),
+ convertIdlEntToMedEnt(entity),
+ convertIdlEltToMedElt(geomElement));
+ for (int i=0;i<nbelements;i++)
+ {
+ myseq[i]=numbers[i];
+ }
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to acces connectivities");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+ return myseq._retn();
+}
+//=============================================================================
+/*!
+ * CORBA: Accessor for connectivities
+ */
+//=============================================================================
+SALOME_MED::long_array* MESH_i::getConnectivityIndex(SALOME_MED::medConnectivity mode,
+ SALOME_MED::medEntityMesh entity)
+throw (SALOME::SALOME_Exception)
+{
+ if (_mesh==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
+ SALOME::INTERNAL_ERROR);
+ SALOME_MED::long_array_var myseq= new SALOME_MED::long_array;
+ try
+ {
+ int nbelements = _mesh->getNumberOfElements(
+ convertIdlEntToMedEnt(entity),
+ MED_ALL_ELEMENTS);
+ myseq->length(nbelements);
+ const int * numbers=_mesh->getConnectivityIndex(convertIdlConnToMedConn(mode),
+ convertIdlEntToMedEnt(entity));
+ for (int i=0;i<nbelements;i++)
+ {
+ myseq[i]=numbers[i];
+ }
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to acces connectivities index");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+ return myseq._retn();
+}
+//=============================================================================
+/*!
+ * CORBA: Accessor for connectivities
+ */
+//=============================================================================
+SALOME_MED::long_array* MESH_i::getGlobalNumberingIndex( SALOME_MED::medEntityMesh entity)
+throw (SALOME::SALOME_Exception)
+{
+ if (_mesh==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
+ SALOME::INTERNAL_ERROR);
+ SALOME_MED::long_array_var myseq= new SALOME_MED::long_array;
+ try
+ {
+ int nbelements = _mesh->getNumberOfTypes( convertIdlEntToMedEnt(entity)) + 1;
+ myseq->length(nbelements);
+ const int * numbers=_mesh->getGlobalNumberingIndex( convertIdlEntToMedEnt(entity));
+ for (int i=0;i<nbelements;i++)
+ {
+ myseq[i]=numbers[i];
+ }
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to acces global index");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+ return myseq._retn();
+}
+
+//=============================================================================
+/*!
+ * CORBA: get global element number in connectivity array
+ * not implemented for MED_NODE and MED_ALL_ENTITIES,
+ * MED_NONE and MED_ALL_ELEMENTS.
+ */
+//=============================================================================
+CORBA::Long MESH_i::getElementNumber(SALOME_MED::medConnectivity mode,
+ SALOME_MED::medEntityMesh entity,
+ SALOME_MED::medGeometryElement type,
+ const SALOME_MED::long_array& connectivity)
+ throw (SALOME::SALOME_Exception)
+{
+ if (_mesh==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", SALOME::INTERNAL_ERROR);
+ int numberOfValue = connectivity.length() ;
+ int * myConnectivity = new int[numberOfValue] ;
+ for (int i=0; i<numberOfValue; i++)
+ myConnectivity[i]=connectivity[i] ;
+
+ int result ;
+ try {
+ result = _mesh->getElementNumber(convertIdlConnToMedConn(mode),
+ convertIdlEntToMedEnt(entity),
+ convertIdlEltToMedElt(type),
+ myConnectivity) ;
+ }
+ catch (MEDEXCEPTION &ex) {
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+ return result ;
+}
+//=============================================================================
+/*!
+ * CORBA: Accessor for Ascendant connectivities
+ * not implemented for MED_ALL_ENTITIES and MED_MAILLE
+ */
+//=============================================================================
+SALOME_MED::long_array* MESH_i::getReverseConnectivity(SALOME_MED::medConnectivity mode)
+throw (SALOME::SALOME_Exception)
+{
+ if (_mesh==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
+ SALOME::INTERNAL_ERROR);
+ SALOME_MED::long_array_var myseq= new SALOME_MED::long_array;
+ try
+ {
+ int nbelements;
+ if ( mode == SALOME_MED::MED_DESCENDING)
+ {
+ nbelements =(_mesh->getNumberOfNodes())+1;
+ }
+ else
+ {
+ nbelements = _mesh->getNumberOfElements(MED_FACE,MED_ALL_ELEMENTS);
+ }
+ SCRUTE(nbelements);
+ myseq->length(nbelements);
+ const int * numbers=_mesh->getReverseConnectivity(convertIdlConnToMedConn(mode));
+ for (int i=0;i<nbelements;i++)
+ {
+ myseq[i]=numbers[i];
+ }
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to acces reverse connectivities");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+ return myseq._retn();
+}
+//=============================================================================
+/*!
+ * CORBA: Accessor for connectivities
+ */
+//=============================================================================
+SALOME_MED::long_array* MESH_i::getReverseConnectivityIndex(SALOME_MED::medConnectivity mode)
+throw (SALOME::SALOME_Exception)
+{
+ if (_mesh==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
+ SALOME::INTERNAL_ERROR);
+ SALOME_MED::long_array_var myseq= new SALOME_MED::long_array;
+ try
+ {
+ int nbelements;
+ if ( mode == SALOME_MED::MED_DESCENDING)
+ {
+ nbelements =_mesh->getNumberOfNodes();
+ }
+ else
+ {
+ int dim=_mesh->getMeshDimension();
+ if ( dim == 3)
+ nbelements = _mesh->getNumberOfElements(MED_FACE,MED_ALL_ELEMENTS);
+ else
+ if (dim == 2)
+ nbelements = _mesh->getNumberOfElements(MED_EDGE,MED_ALL_ELEMENTS);
+ else
+ THROW_SALOME_CORBA_EXCEPTION("Pb ", \
+ SALOME::INTERNAL_ERROR);
+ }
+
+ myseq->length(nbelements);
+ const int * numbers=_mesh->getReverseConnectivityIndex(convertIdlConnToMedConn(mode));
+ for (int i=0;i<nbelements;i++)
+ {
+ myseq[i]=numbers[i];
+ }
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to acces reverse connectivities index");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+ return myseq._retn();
+}
+//=============================================================================
+/*!
+ * CORBA: Returns number of families within the mesh
+ */
+//=============================================================================
+CORBA::Long MESH_i::getNumberOfFamilies(SALOME_MED::medEntityMesh entity)
+throw (SALOME::SALOME_Exception)
+{
+ if (_mesh==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
+ SALOME::INTERNAL_ERROR);
+ try
+ {
+ return _mesh->getNumberOfFamilies(convertIdlEntToMedEnt(entity));
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to acces number of families of the mesh");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+}
+//=============================================================================
+/*!
+ * CORBA: Returns number of groups within the mesh
+ */
+//=============================================================================
+CORBA::Long MESH_i::getNumberOfGroups(SALOME_MED::medEntityMesh entity)
+throw (SALOME::SALOME_Exception)
+{
+ if (_mesh==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
+ SALOME::INTERNAL_ERROR);
+ try
+ {
+ return _mesh->getNumberOfGroups(convertIdlEntToMedEnt(entity));
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to acces number of groups of the mesh");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+}
+//=============================================================================
+/*!
+ * CORBA: Returns references for families within the mesh
+ */
+//=============================================================================
+SALOME_MED::Family_array * MESH_i::getFamilies(SALOME_MED::medEntityMesh entity)
+throw (SALOME::SALOME_Exception)
+{
+ if (_mesh==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
+ SALOME::INTERNAL_ERROR);
+ SALOME_MED::Family_array_var myseq = new SALOME_MED::Family_array;
+ try
+ {
+ int nbfam= _mesh->getNumberOfFamilies(convertIdlEntToMedEnt(entity));
+ myseq->length(nbfam);
+ vector<FAMILY*> fam(nbfam);
+ fam = _mesh->getFamilies(convertIdlEntToMedEnt(entity));
+ for (int i=0;i<nbfam;i++)
+ {
+ FAMILY_i * f1=new FAMILY_i(fam[i]);
+ SALOME_MED::FAMILY_ptr f2 =
+ f1->POA_SALOME_MED::FAMILY::_this();
+ f1->_remove_ref();
+ myseq[i] = f2;
+ }
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to acces families of the mesh");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+ return myseq._retn();
+}
+//=============================================================================
+/*!
+ * CORBA: Returns Coordinates global informations
+ */
+//=============================================================================
+SALOME_MED::MESH::coordinateInfos * MESH_i::getCoordGlobal()
+throw (SALOME::SALOME_Exception)
+{
+ if (_mesh==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
+ SALOME::INTERNAL_ERROR);
+ SALOME_MED::MESH::coordinateInfos_var all = new SALOME_MED::MESH::coordinateInfos;
+ try
+ {
+ all->coordSystem = CORBA::string_dup(_mesh->getCoordinatesSystem().c_str());
+
+ int spaceDimension=_mesh->getSpaceDimension();
+ const string * coordinatesUnits =_mesh->getCoordinatesUnits();
+ const string * coordinatesName =_mesh->getCoordinatesNames();
+
+ all->coordUnits.length(spaceDimension);
+ all->coordNames.length(spaceDimension);
+ for (int i=0; i<spaceDimension; i++)
+ {
+ all->coordUnits[i]=CORBA::string_dup(coordinatesUnits[i].c_str());
+ all->coordNames[i]=CORBA::string_dup(coordinatesName[i].c_str());
+ }
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to acces coordinate information ");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+ return all._retn();
+}
+//=============================================================================
+/*!
+ * CORBA: Returns connectivity global informations
+ */
+//=============================================================================
+SALOME_MED::MESH::connectivityInfos * MESH_i::getConnectGlobal
+ (SALOME_MED::medEntityMesh entity)
+throw (SALOME::SALOME_Exception)
+{
+ if (_mesh==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
+ SALOME::INTERNAL_ERROR);
+ SALOME_MED::MESH::connectivityInfos_var all=new SALOME_MED::MESH::connectivityInfos;
+ try
+ {
+ all->numberOfNodes = _mesh->getNumberOfNodes();
+
+ int nbTypes=_mesh->getNumberOfTypes(convertIdlEntToMedEnt(entity));
+ const medGeometryElement * elemts =_mesh->getTypes(
+ convertIdlEntToMedEnt(entity));
+ all->meshTypes.length(nbTypes);
+ all->numberOfElements.length(nbTypes);
+ for (int i=0; i<nbTypes; i++)
+ {
+ all->meshTypes[i]=convertMedEltToIdlElt(elemts[i]);
+ all->numberOfElements[i]=_mesh->getNumberOfElements(
+ convertIdlEntToMedEnt(entity),elemts[i]);
+ }
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to acces connectivities informations");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+ return all._retn();
+}
+
+//=============================================================================
+/*!
+ * CORBA: Returns references for family i within the mesh
+ */
+//=============================================================================
+SALOME_MED::FAMILY_ptr MESH_i::getFamily(SALOME_MED::medEntityMesh entity,
+ CORBA::Long i)
+throw (SALOME::SALOME_Exception)
+{
+ if (_mesh==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
+ SALOME::INTERNAL_ERROR);
+ try
+ {
+ const FAMILY * fam = _mesh->getFamily(convertIdlEntToMedEnt(entity),i);
+ FAMILY_i * f1=new FAMILY_i(fam);
+ SALOME_MED::FAMILY_ptr f2 = f1->POA_SALOME_MED::FAMILY::_this();
+ f1->_remove_ref();
+ return (SALOME_MED::FAMILY::_duplicate(f2));
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to acces specified family of the mesh");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+
+}
+//=============================================================================
+/*
+ * CORBA: Returns Mesh global informations
+ */
+//=============================================================================
+SALOME_MED::MESH::meshInfos * MESH_i::getMeshGlobal()
+throw (SALOME::SALOME_Exception)
+{
+ if (_mesh==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
+ SALOME::INTERNAL_ERROR);
+ SALOME_MED::MESH::meshInfos_var all = new SALOME_MED::MESH::meshInfos;
+ try
+ {
+ all->name = CORBA::string_dup(_mesh->getName().c_str());
+ all->spaceDimension = _mesh->getSpaceDimension();
+ all->meshDimension = _mesh->getMeshDimension();
+ all->numberOfNodes = _mesh->getNumberOfNodes();
+ all->isAGrid = _mesh->getIsAGrid();
+
+ int nbFam= _mesh->getNumberOfFamilies(MED_NODE);
+ all->famNode.length(nbFam);
+ vector<FAMILY*> vNode (nbFam);
+ vNode = _mesh->getFamilies(MED_NODE);
+ for (int i=0;i<nbFam;i++)
+ {
+ FAMILY_i * f1=new FAMILY_i(vNode[i]);
+ SALOME_MED::FAMILY_ptr f2 = f1->POA_SALOME_MED::FAMILY::_this();
+ f1->_remove_ref();
+ all->famNode[i] = f2;
+ }
+
+ nbFam = _mesh->getNumberOfFamilies(MED_EDGE);
+ all->famEdge.length(nbFam);
+ vector<FAMILY*> vEdge (nbFam);
+ vEdge = _mesh->getFamilies(MED_EDGE);
+ for (int i=0;i<nbFam;i++)
+ for (int i=0;i<nbFam;i++)
+ {
+ FAMILY_i * f1=new FAMILY_i(vEdge[i]);
+ SALOME_MED::FAMILY_ptr f2 = f1->POA_SALOME_MED::FAMILY::_this();
+ f1->_remove_ref();
+ all->famEdge[i] = f2;
+ }
+
+ nbFam = _mesh->getNumberOfFamilies(MED_FACE);
+ all->famFace.length(nbFam);
+ vector<FAMILY*> vFace (nbFam);
+ vFace = _mesh->getFamilies(MED_FACE);
+ for (int i=0;i<nbFam;i++)
+ {
+ FAMILY_i * f1=new FAMILY_i(vFace[i]);
+ SALOME_MED::FAMILY_ptr f2 = f1->POA_SALOME_MED::FAMILY::_this();
+ f1->_remove_ref();
+ all->famFace[i] = f2;
+ }
+
+ nbFam = _mesh->getNumberOfFamilies(MED_CELL);
+ all->famCell.length(nbFam);
+ vector<FAMILY*> vCell (nbFam);
+ vCell = _mesh->getFamilies(MED_CELL);
+ for (int i=0;i<nbFam;i++)
+ {
+ FAMILY_i * f1=new FAMILY_i(vCell[i]);
+ SALOME_MED::FAMILY_ptr f2 = f1->POA_SALOME_MED::FAMILY::_this();
+ f1->_remove_ref();
+ all->famCell[i] = f2;
+ }
+
+ int nbGroup = _mesh->getNumberOfGroups(MED_NODE);
+ all->groupNode.length(nbGroup);
+ vector<GROUP*> gNode (nbGroup);
+ gNode = _mesh->getGroups(MED_NODE);
+ for (int i=0;i<nbGroup;i++)
+ {
+ GROUP_i * f1=new GROUP_i(gNode[i]);
+ SALOME_MED::GROUP_ptr f2 = f1->POA_SALOME_MED::GROUP::_this();
+ f1->_remove_ref();
+ all->groupNode[i] = f2;
+ }
+
+ nbGroup = _mesh->getNumberOfGroups(MED_EDGE);
+ all->groupEdge.length(nbGroup);
+ vector<GROUP*> gEdge (nbGroup);
+ gEdge = _mesh->getGroups(MED_EDGE);
+ for (int i=0;i<nbGroup;i++)
+ {
+ GROUP_i * f1=new GROUP_i(gEdge[i]);
+ SALOME_MED::GROUP_ptr f2 = f1->POA_SALOME_MED::GROUP::_this();
+ f1->_remove_ref();
+ all->groupEdge[i] = f2;
+ }
+ nbGroup = _mesh->getNumberOfGroups(MED_FACE);
+ all->groupFace.length(nbGroup);
+ vector<GROUP*> gFace (nbGroup);
+ gFace = _mesh->getGroups(MED_FACE);
+ for (int i=0;i<nbGroup;i++)
+ {
+ GROUP_i * f1=new GROUP_i(gFace[i]);
+ SALOME_MED::GROUP_ptr f2 = f1->POA_SALOME_MED::GROUP::_this();
+ f1->_remove_ref();
+ all->groupFace[i] = f2;
+ }
+
+ nbGroup = _mesh->getNumberOfGroups(MED_CELL);
+ all->groupCell.length(nbGroup);
+ vector<GROUP*> gCell (nbGroup);
+ gCell = _mesh->getGroups(MED_CELL);
+ for (int i=0;i<nbGroup;i++)
+ {
+ GROUP_i * f1=new GROUP_i(gCell[i]);
+ SALOME_MED::GROUP_ptr f2 = f1->POA_SALOME_MED::GROUP::_this();
+ f1->_remove_ref();
+ all->groupCell[i] = f2;
+ }
+
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to acces mesh");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+ return all._retn();
+}
+//=============================================================================
+ /*
+ * CORBA: Returns references for groups within the mesh
+ */
+//=============================================================================
+SALOME_MED::Group_array * MESH_i::getGroups(SALOME_MED::medEntityMesh entity)
+throw (SALOME::SALOME_Exception)
+{
+ if (_mesh==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
+ SALOME::INTERNAL_ERROR);
+ SALOME_MED::Group_array_var myseq = new SALOME_MED::Group_array;
+ try
+ {
+ int nbgroups = _mesh->getNumberOfGroups(convertIdlEntToMedEnt(entity));
+ myseq->length(nbgroups);
+ vector<GROUP*> groups(nbgroups);
+ groups = _mesh->getGroups(convertIdlEntToMedEnt(entity));
+ for (int i=0;i<nbgroups;i++)
+ {
+ GROUP_i * f1=new GROUP_i(groups[i]);
+ SALOME_MED::GROUP_ptr f2 = f1->POA_SALOME_MED::GROUP::_this();
+ f1->_remove_ref();
+ myseq[i] = f2;
+ }
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to acces number of groups of the mesh");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+ return myseq._retn();
+}
+//=============================================================================
+/*!
+ * CORBA: Returns references for group i within the mesh
+ */
+//=============================================================================
+SALOME_MED::GROUP_ptr MESH_i::getGroup(SALOME_MED::medEntityMesh entity,
+ CORBA::Long i)
+throw (SALOME::SALOME_Exception)
+{
+ if (_mesh==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
+ SALOME::INTERNAL_ERROR);
+ try
+ {
+ const GROUP * grou = _mesh->getGroup(convertIdlEntToMedEnt(entity),i);
+ GROUP_i * f1=new GROUP_i(grou);
+ SALOME_MED::GROUP_ptr f2 = f1->POA_SALOME_MED::GROUP::_this();
+ f1->_remove_ref();
+ return (SALOME_MED::GROUP::_duplicate(f2));
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to acces specified group of the mesh");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+}
+//=============================================================================
+/*!
+ * CORBA:
+ */
+//=============================================================================
+SALOME_MED::SUPPORT_ptr MESH_i::getBoundaryElements(SALOME_MED::medEntityMesh entity)
+throw (SALOME::SALOME_Exception)
+{
+ if (_mesh==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
+ SALOME::INTERNAL_ERROR);
+ try
+ {
+ SUPPORT * myNewSupport = _mesh->getBoundaryElements(convertIdlEntToMedEnt(entity));
+ SUPPORT_i * mySupportI = new SUPPORT_i(myNewSupport);
+ SALOME_MED::SUPPORT_ptr mySupportIOR = mySupportI->_this() ;
+ return (SALOME_MED::SUPPORT::_duplicate(mySupportIOR));
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to get the volume ");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+}
+//=============================================================================
+/*!
+ * CORBA:
+ */
+//=============================================================================
+SALOME_MED::FIELD_ptr MESH_i::getVolume(SALOME_MED::SUPPORT_ptr mySupport)
+throw (SALOME::SALOME_Exception)
+{
+ if (_mesh==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
+ SALOME::INTERNAL_ERROR); try
+ {
+ int sup = mySupport->getCorbaIndex();
+ ASSERT(SUPPORT_i::supportMap.find(sup)!=SUPPORT_i::supportMap.end());
+ const SUPPORT * myCppSupport=SUPPORT_i::supportMap[sup];
+ ::FIELD<double>*f=_mesh->getVolume( myCppSupport);
+ FIELDDOUBLE_i * medf = new FIELDDOUBLE_i(mySupport,f);
+ POA_SALOME_MED::FIELDDOUBLE_tie<FIELDDOUBLE_i> * f1 =
+ new POA_SALOME_MED::FIELDDOUBLE_tie<FIELDDOUBLE_i>(medf,true);
+ SALOME_MED::FIELDDOUBLE_ptr f2 = f1->_this();
+ f1->_remove_ref();
+ return (SALOME_MED::FIELD::_duplicate(f2));
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to get the volume ");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+}
+//=============================================================================
+/*!
+ * CORBA:
+ */
+//=============================================================================
+SALOME_MED::SUPPORT_ptr MESH_i::getSkin(SALOME_MED::SUPPORT_ptr mySupport3D)
+throw (SALOME::SALOME_Exception)
+{
+ if (_mesh==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
+ SALOME::INTERNAL_ERROR);
+ try
+ {
+ int sup = mySupport3D->getCorbaIndex();
+ ASSERT(SUPPORT_i::supportMap.find(sup)!=SUPPORT_i::supportMap.end());
+ const SUPPORT * myCppSupport=SUPPORT_i::supportMap[sup];
+ SUPPORT * myNewSupport = _mesh->getSkin(myCppSupport);
+ SUPPORT_i * mySupportI = new SUPPORT_i(myNewSupport);
+ SALOME_MED::SUPPORT_ptr mySupportIOR = mySupportI->_this() ;
+ return (SALOME_MED::SUPPORT::_duplicate(mySupportIOR));
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to get the volume ");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+}
+//=============================================================================
+/*!
+ * CORBA:
+ */
+//=============================================================================
+SALOME_MED::FIELD_ptr MESH_i::getArea(SALOME_MED::SUPPORT_ptr mySupport)
+throw (SALOME::SALOME_Exception)
+{
+ if (_mesh==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
+ SALOME::INTERNAL_ERROR);
+ try
+ {
+ int sup = mySupport->getCorbaIndex();
+ ASSERT(SUPPORT_i::supportMap.find(sup)!=SUPPORT_i::supportMap.end());
+ const SUPPORT * myCppSupport=SUPPORT_i::supportMap[sup];
+ ::FIELD<double>*f=_mesh->getArea( myCppSupport);
+ FIELDDOUBLE_i * medf = new FIELDDOUBLE_i(mySupport,f);
+ POA_SALOME_MED::FIELDDOUBLE_tie<FIELDDOUBLE_i> * f1 =
+ new POA_SALOME_MED::FIELDDOUBLE_tie<FIELDDOUBLE_i>(medf,true);
+ SALOME_MED::FIELDDOUBLE_ptr f2 = f1->_this();
+ f1->_remove_ref();
+ return (SALOME_MED::FIELD::_duplicate(f2));
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to get the area ");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+}
+//=============================================================================
+/*!
+ * CORBA:
+ */
+//=============================================================================
+SALOME_MED::FIELD_ptr MESH_i::getLength(SALOME_MED::SUPPORT_ptr mySupport)
+throw (SALOME::SALOME_Exception)
+{
+ if (_mesh==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
+ SALOME::INTERNAL_ERROR);
+ try
+ {
+ int sup = mySupport->getCorbaIndex();
+ ASSERT(SUPPORT_i::supportMap.find(sup)!=SUPPORT_i::supportMap.end());
+ const SUPPORT * myCppSupport=SUPPORT_i::supportMap[sup];
+ ::FIELD<double>*f=_mesh->getLength( myCppSupport);
+ FIELDDOUBLE_i * medf = new FIELDDOUBLE_i(mySupport,f);
+ POA_SALOME_MED::FIELDDOUBLE_tie<FIELDDOUBLE_i> * f1 =
+ new POA_SALOME_MED::FIELDDOUBLE_tie<FIELDDOUBLE_i>(medf,true);
+ SALOME_MED::FIELDDOUBLE_ptr f2 = f1->_this();
+ f1->_remove_ref();
+ return (SALOME_MED::FIELD::_duplicate(f2));
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to get the length ");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+}
+//=============================================================================
+/*!
+ * CORBA:
+ */
+//=============================================================================
+SALOME_MED::FIELD_ptr MESH_i::getNormal(SALOME_MED::SUPPORT_ptr mySupport)
+throw (SALOME::SALOME_Exception)
+{
+ if (_mesh==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
+ SALOME::INTERNAL_ERROR);
+ try
+ {
+ int sup = mySupport->getCorbaIndex();
+ ASSERT(SUPPORT_i::supportMap.find(sup)!=SUPPORT_i::supportMap.end());
+ const SUPPORT * myCppSupport=SUPPORT_i::supportMap[sup];
+ ::FIELD<double>*f=_mesh->getNormal( myCppSupport);
+ FIELDDOUBLE_i * medf = new FIELDDOUBLE_i(mySupport,f);
+ POA_SALOME_MED::FIELDDOUBLE_tie<FIELDDOUBLE_i> * f1 =
+ new POA_SALOME_MED::FIELDDOUBLE_tie<FIELDDOUBLE_i>(medf,true);
+ SALOME_MED::FIELDDOUBLE_ptr f2 = f1->_this();
+ f1->_remove_ref();
+ return (SALOME_MED::FIELD::_duplicate(f2));
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to get the normal ");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+}
+//=============================================================================
+/*!
+ * CORBA:
+ */
+//=============================================================================
+SALOME_MED::FIELD_ptr MESH_i::getBarycenter(SALOME_MED::SUPPORT_ptr mySupport)
+throw (SALOME::SALOME_Exception)
+{
+ if (_mesh==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
+ SALOME::INTERNAL_ERROR);
+ try
+ {
+ int sup = mySupport->getCorbaIndex();
+ ASSERT(SUPPORT_i::supportMap.find(sup)!=SUPPORT_i::supportMap.end());
+ const SUPPORT * myCppSupport=SUPPORT_i::supportMap[sup];
+ ::FIELD<double>*f=_mesh->getBarycenter( myCppSupport);
+ FIELDDOUBLE_i * medf = new FIELDDOUBLE_i(mySupport,f);
+ POA_SALOME_MED::FIELDDOUBLE_tie<FIELDDOUBLE_i> * f1 =
+ new POA_SALOME_MED::FIELDDOUBLE_tie<FIELDDOUBLE_i>(medf,true);
+ SALOME_MED::FIELDDOUBLE_ptr f2 = f1->_this();
+ f1->_remove_ref();
+ return (SALOME_MED::FIELD::_duplicate(f2));
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to get the barycenter ");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+}
+//=============================================================================
+/*!
+ * CORBA:
+ */
+//=============================================================================
+SALOME_MED::FIELD_ptr MESH_i::getNeighbourhood(SALOME_MED::SUPPORT_ptr mySupport)
+throw (SALOME::SALOME_Exception)
+{
+ if (_mesh==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
+ SALOME::INTERNAL_ERROR);
+ MESSAGE("Not Implemented");
+}
+//=============================================================================
+/*!
+ * CORBA: add the Mesh in the StudyManager
+ */
+//=============================================================================
+void MESH_i::addInStudy(SALOMEDS::Study_ptr myStudy,SALOME_MED::MESH_ptr myIor )
+throw (SALOME::SALOME_Exception,SALOMEDS::StudyBuilder::LockProtection)
+{
+ BEGIN_OF("MED_Mesh_i::addInStudy");
+ if ( _meshId != "" )
+ {
+ MESSAGE("Mesh already in Study");
+ THROW_SALOME_CORBA_EXCEPTION("Mesh already in Study", \
+ SALOME::BAD_PARAM);
+ };
+
+ SALOMEDS::StudyBuilder_var myBuilder = myStudy->NewBuilder();
+ SALOMEDS::GenericAttribute_var anAttr;
+ SALOMEDS::AttributeName_var aName;
+ SALOMEDS::AttributeIOR_var aIOR;
+
+ // Find SComponent labelled 'MED'
+ SALOMEDS::SComponent_var medfather = myStudy->FindComponent("MED");
+ myBuilder->NewCommand();
+ if ( CORBA::is_nil(medfather) )
+ THROW_SALOME_CORBA_EXCEPTION("SComponent labelled 'Med' not Found",SALOME::INTERNAL_ERROR);
+
+ // Create SObject labelled 'MESH' if it doesn't already exit
+ SALOMEDS::SObject_var medmeshfather = myStudy->FindObject("MEDMESH");
+ if ( CORBA::is_nil(medmeshfather) )
+ {
+ MESSAGE("Add Object MEDMESH");
+ medmeshfather = myBuilder->NewObject(medfather);
+ //medmeshfather.Name = "MEDMESH" ;
+ anAttr = myBuilder->FindOrCreateAttribute(medmeshfather, "AttributeName");
+ aName = SALOMEDS::AttributeName::_narrow(anAttr);
+ aName->SetValue("MEDMESH");
+
+ } ;
+
+ MESSAGE("Add a mesh Object under MED/MEDMESH");
+ SALOMEDS::SObject_var newObj = myBuilder->NewObject(medmeshfather);
+
+ ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
+ ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting()) ;
+ CORBA::ORB_var &orb = init(0,0);
+ string iorStr = orb->object_to_string(myIor);
+ anAttr = myBuilder->FindOrCreateAttribute(newObj, "AttributeIOR");
+ aIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
+ aIOR->SetValue(iorStr.c_str());
+ anAttr = myBuilder->FindOrCreateAttribute(newObj, "AttributeName");
+ aName = SALOMEDS::AttributeName::_narrow(anAttr);
+ aName->SetValue(_mesh->getName().c_str());
+ _meshId = newObj->GetID();
+ myBuilder->CommitCommand();
+
+ END_OF("Mesh_i::addInStudy(SALOMEDS::Study_ptr myStudy)");
+}
+//=============================================================================
+/*!
+ * CORBA: add the Mesh in the StudyManager
+ */
+//=============================================================================
+void MESH_i::addInStudy(SALOMEDS::Study_ptr myStudy,SALOME_MED::MESH_ptr myIor,const string & fileName )
+throw (SALOME::SALOME_Exception,SALOMEDS::StudyBuilder::LockProtection)
+{
+ BEGIN_OF("MED_Mesh_i::addInStudy");
+ if ( _meshId != "" )
+ {
+ MESSAGE("Mesh already in Study");
+ THROW_SALOME_CORBA_EXCEPTION("Mesh already in Study", \
+ SALOME::BAD_PARAM);
+ };
+
+ SALOMEDS::StudyBuilder_var myBuilder = myStudy->NewBuilder();
+ SALOMEDS::GenericAttribute_var anAttr;
+ SALOMEDS::AttributeName_var aName;
+ SALOMEDS::AttributeIOR_var aIOR;
+ SALOMEDS::AttributeComment_var aComment;
+
+ // Find SComponent labelled 'Med'
+ SALOMEDS::SComponent_var medfather = myStudy->FindComponent("MED");
+ if ( CORBA::is_nil(medfather) )
+ THROW_SALOME_CORBA_EXCEPTION("SComponent labelled 'Med' not Found",SALOME::INTERNAL_ERROR);
+
+ // Create SObject labelled 'MESH' if it doesn't already exit
+ SALOMEDS::SObject_var medmeshfather = myStudy->FindObject("MEDMESH");
+ if ( CORBA::is_nil(medmeshfather) )
+ {
+ MESSAGE("Add Object MEDMESH");
+ medmeshfather = myBuilder->NewObject(medfather);
+ //medmeshfather.Name = "MEDMESH" ;
+ anAttr = myBuilder->FindOrCreateAttribute(medmeshfather, "AttributeName");
+ aName = SALOMEDS::AttributeName::_narrow(anAttr);
+ aName->SetValue("MEDMESH");
+
+ } ;
+
+ MESSAGE("Add a mesh Object under MED/MEDMESH");
+ myBuilder->NewCommand();
+ SALOMEDS::SObject_var newObj = myBuilder->NewObject(medmeshfather);
+
+ ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
+ ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting()) ;
+ CORBA::ORB_var &orb = init(0,0);
+ string iorStr = orb->object_to_string(myIor);
+ anAttr = myBuilder->FindOrCreateAttribute(newObj, "AttributeIOR");
+ aIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
+ aIOR->SetValue(iorStr.c_str());
+ anAttr = myBuilder->FindOrCreateAttribute(newObj, "AttributeName");
+ aName = SALOMEDS::AttributeName::_narrow(anAttr);
+ aName->SetValue(_mesh->getName().c_str());
+ anAttr = myBuilder->FindOrCreateAttribute(newObj, "AttributeComment");
+ aComment = SALOMEDS::AttributeComment::_narrow(anAttr);
+ aComment->SetValue(fileName.c_str());
+ _meshId = newObj->GetID();
+ myBuilder->CommitCommand();
+
+ END_OF("Mesh_i::addInStudy(SALOMEDS::Study_ptr myStudy)");
+}
+//=============================================================================
+
+//=============================================================================
+/*!
+ * CORBA: write mesh in a med file
+ */
+//=============================================================================
+void MESH_i::write(CORBA::Long i, const char* driverMeshName)
+throw (SALOME::SALOME_Exception)
+{
+ if (_mesh==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
+ SALOME::INTERNAL_ERROR);
+ try
+ {
+ _mesh->write(i,driverMeshName);
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to write the mesh ");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+}
+//=============================================================================
+/*!
+ * CORBA: read mesh in a med file
+ */
+//=============================================================================
+void MESH_i::read(CORBA::Long i)
+throw (SALOME::SALOME_Exception)
+{
+ if (_mesh==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
+ SALOME::INTERNAL_ERROR);
+ try
+ {
+ _mesh->read(i);
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to read the mesh ");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+}
+//=============================================================================
+/*!
+ * CORBA : release driver
+ */
+//=============================================================================
+void MESH_i::rmDriver(CORBA::Long i)
+throw (SALOME::SALOME_Exception)
+{
+ if (_mesh==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
+ SALOME::INTERNAL_ERROR);
+ try
+ {
+ _mesh->rmDriver();
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to unlink the mesh from the driver ");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ THROW_SALOME_CORBA_EXCEPTION("Unable to acces Support C++ Object"\
+ ,SALOME::INTERNAL_ERROR);
+ }
+}
+//=============================================================================
+/*!
+ * CORBA : attach driver
+ */
+//=============================================================================
+CORBA::Long MESH_i::addDriver(SALOME_MED::medDriverTypes driverType,
+ const char* fileName, const char* meshName)
+throw (SALOME::SALOME_Exception)
+{
+ if (_mesh==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
+ SALOME::INTERNAL_ERROR);
+ try
+ {
+ int drivernum=_mesh->addDriver(
+ convertIdlDriverToMedDriver(driverType),
+ fileName,
+ meshName);
+ return drivernum;
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to link the mesh to the driver ");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+}
+
--- /dev/null
+//=============================================================================
+// File : MEDMEM_Mesh_i.hxx
+// Project : SALOME
+// Author : EDF
+// Copyright : EDF 2002
+// $Header: /export/home/PAL/MED_SRC/src/MEDMEM_I/MEDMEM_Mesh_i.hxx
+//=============================================================================
+
+#ifndef _MED_MESH_I_HXX_
+#define _MED_MESH_I_HXX_
+
+#include <map>
+#include <string>
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(MED)
+#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+
+namespace MEDMEM {
+class MESH;
+class MESH_i:
+ public POA_SALOME_MED::MESH,
+ public PortableServer::RefCountServantBase
+// public SALOME_MED_Component_i
+{
+public :
+ static map < int,::MEDMEM::MESH *> meshMap;
+private :
+ static int meshIndex;
+
+private :
+
+protected:
+ // C++ object containing values
+ ::MEDMEM::MESH * const _mesh;
+ const int _corbaIndex;
+ string _meshId;
+
+
+public:
+
+ // Constructors and associated internal methods
+ MESH_i();
+ MESH_i(::MEDMEM::MESH * const m);
+ MESH_i(MESH_i & m);
+ ~MESH_i();
+
+ // IDL Methods
+ char * getName() throw (SALOME::SALOME_Exception);
+
+ CORBA::Long getSpaceDimension() throw (SALOME::SALOME_Exception);
+
+ CORBA::Long getMeshDimension() throw (SALOME::SALOME_Exception);
+
+ CORBA::Boolean getIsAGrid() throw (SALOME::SALOME_Exception);
+
+ CORBA::Boolean existConnectivity
+ ( SALOME_MED::medConnectivity connectivityType,
+ SALOME_MED::medEntityMesh entity)
+ throw (SALOME::SALOME_Exception);
+
+ char * getCoordinatesSystem()
+ throw (SALOME::SALOME_Exception);
+
+ SALOME_MED::double_array* getCoordinates(SALOME_MED::medModeSwitch typeSwitch)
+ throw (SALOME::SALOME_Exception);
+
+ double getCoordinate(CORBA::Long Number, CORBA::Long Axis)
+ throw (SALOME::SALOME_Exception);
+
+ SALOME_MED::string_array* getCoordinatesNames()
+ throw (SALOME::SALOME_Exception);
+
+ SALOME_MED::string_array* getCoordinatesUnits()
+ throw (SALOME::SALOME_Exception);
+
+ CORBA::Long getNumberOfNodes()
+ throw (SALOME::SALOME_Exception);
+
+ CORBA::Long getNumberOfTypes (SALOME_MED::medEntityMesh entity)
+ throw (SALOME::SALOME_Exception);
+
+ SALOME_MED::medGeometryElement_array* getTypes(SALOME_MED::medEntityMesh entity)
+ throw (SALOME::SALOME_Exception);
+
+ SALOME_MED::medGeometryElement getElementType(SALOME_MED::medEntityMesh entity,
+ CORBA::Long number)
+ throw (SALOME::SALOME_Exception);
+
+
+ CORBA::Long getNumberOfElements (SALOME_MED::medEntityMesh entity,
+ SALOME_MED::medGeometryElement geomElement)
+ throw (SALOME::SALOME_Exception);
+
+ SALOME_MED::long_array* getConnectivity(SALOME_MED::medModeSwitch typeSwitch,
+ SALOME_MED::medConnectivity mode,
+ SALOME_MED::medEntityMesh entity,
+ SALOME_MED::medGeometryElement geomElement)
+ throw (SALOME::SALOME_Exception);
+
+ SALOME_MED::long_array* getConnectivityIndex(SALOME_MED::medConnectivity mode,
+ SALOME_MED::medEntityMesh entity)
+ throw (SALOME::SALOME_Exception);
+
+ SALOME_MED::long_array* getGlobalNumberingIndex(SALOME_MED::medEntityMesh entity)
+ throw (SALOME::SALOME_Exception);
+
+ CORBA::Long getElementNumber(SALOME_MED::medConnectivity mode,
+ SALOME_MED::medEntityMesh entity,
+ SALOME_MED::medGeometryElement type,
+ const SALOME_MED::long_array& connectivity)
+ throw (SALOME::SALOME_Exception);
+
+ SALOME_MED::long_array* getReverseConnectivity(SALOME_MED::medConnectivity mode)
+ throw (SALOME::SALOME_Exception);
+
+ SALOME_MED::long_array* getReverseConnectivityIndex(SALOME_MED::medConnectivity mode)
+ throw (SALOME::SALOME_Exception);
+
+ // Family and Group
+ CORBA::Long getNumberOfFamilies(SALOME_MED::medEntityMesh entity)
+ throw (SALOME::SALOME_Exception);
+ CORBA::Long getNumberOfGroups(SALOME_MED::medEntityMesh entity)
+ throw (SALOME::SALOME_Exception);
+ SALOME_MED::Family_array* getFamilies(SALOME_MED::medEntityMesh entity)
+ throw (SALOME::SALOME_Exception);
+ SALOME_MED::FAMILY_ptr getFamily (SALOME_MED::medEntityMesh entity,
+ CORBA::Long i)
+ throw (SALOME::SALOME_Exception);
+ SALOME_MED::Group_array* getGroups(SALOME_MED::medEntityMesh entity)
+ throw (SALOME::SALOME_Exception);
+ SALOME_MED::GROUP_ptr getGroup (SALOME_MED::medEntityMesh entity,
+ CORBA::Long i)
+ throw (SALOME::SALOME_Exception);
+ //
+ SALOME_MED::SUPPORT_ptr getBoundaryElements(SALOME_MED::medEntityMesh entity)
+ throw (SALOME::SALOME_Exception);
+ SALOME_MED::SUPPORT_ptr getSkin (SALOME_MED::SUPPORT_ptr mySupport3D)
+ throw (SALOME::SALOME_Exception);
+ //
+ SALOME_MED::FIELD_ptr getVolume (SALOME_MED::SUPPORT_ptr mySupport)
+ throw (SALOME::SALOME_Exception);
+ SALOME_MED::FIELD_ptr getArea (SALOME_MED::SUPPORT_ptr mySupport)
+ throw (SALOME::SALOME_Exception);
+ SALOME_MED::FIELD_ptr getLength (SALOME_MED::SUPPORT_ptr mySupport)
+ throw (SALOME::SALOME_Exception);
+ SALOME_MED::FIELD_ptr getNormal (SALOME_MED::SUPPORT_ptr mySupport)
+ throw (SALOME::SALOME_Exception);
+ SALOME_MED::FIELD_ptr getBarycenter (SALOME_MED::SUPPORT_ptr mySupport)
+ throw (SALOME::SALOME_Exception);
+ SALOME_MED::FIELD_ptr getNeighbourhood (SALOME_MED::SUPPORT_ptr mySupport)
+ throw (SALOME::SALOME_Exception);
+
+
+ // Others
+ void addInStudy (SALOMEDS::Study_ptr myStudy,
+ SALOME_MED::MESH_ptr myIor)
+ throw (SALOME::SALOME_Exception, SALOMEDS::StudyBuilder::LockProtection);
+ void addInStudy (SALOMEDS::Study_ptr myStudy,
+ SALOME_MED::MESH_ptr myIor,
+ const string & fileName)
+ throw (SALOME::SALOME_Exception, SALOMEDS::StudyBuilder::LockProtection);
+ CORBA::Long addDriver (SALOME_MED::medDriverTypes driverType,
+ const char* fileName, const char* meshName)
+ throw (SALOME::SALOME_Exception);
+ void rmDriver (CORBA::Long i) throw (SALOME::SALOME_Exception);
+ void read (CORBA::Long i) throw (SALOME::SALOME_Exception);
+ void write (CORBA::Long i, const char* driverMeshName)
+ throw (SALOME::SALOME_Exception);
+
+ // Cuisine interne
+ CORBA::Long getCorbaIndex() throw (SALOME::SALOME_Exception);
+ ::MEDMEM::MESH * constructConstMesh() const;
+ SALOME_MED::MESH::meshInfos * getMeshGlobal()
+ throw (SALOME::SALOME_Exception);
+ SALOME_MED::MESH::coordinateInfos * getCoordGlobal()
+ throw (SALOME::SALOME_Exception);
+ SALOME_MED::MESH::connectivityInfos * getConnectGlobal
+ (SALOME_MED::medEntityMesh entity)
+ throw (SALOME::SALOME_Exception);
+};
+}
+
+#endif /* _MED_MESH_I_HXX_ */
--- /dev/null
+//=============================================================================
+// File : MEDMEM_Support_i.cxx
+// Project : SALOME
+// Author : EDF
+// Copyright : EDF 2002
+// $Header: /export/home/PAL/MED_SRC/src/MEDMEM_I/MEDMEM_Support_i.cxx
+//=============================================================================
+
+#include "utilities.h"
+#include "Utils_CorbaException.hxx"
+#include "Utils_ORB_INIT.hxx"
+#include "Utils_SINGLETON.hxx"
+
+#include CORBA_SERVER_HEADER(MED)
+#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
+
+
+#include "MEDMEM_define.hxx"
+#include "MEDMEM_Support.hxx"
+
+#include "MEDMEM_Support_i.hxx"
+#include "MEDMEM_Mesh_i.hxx"
+#include "MEDMEM_convert.hxx"
+using namespace MEDMEM;
+
+// Initialisation des variables statiques
+map < int, ::SUPPORT *> SUPPORT_i::supportMap ;
+int SUPPORT_i::supportIndex = 0 ;
+
+
+//=============================================================================
+/*!
+ * Default constructor
+ */
+//=============================================================================
+SUPPORT_i::SUPPORT_i() :_support((::SUPPORT *)NULL)
+{
+ BEGIN_OF("Default Constructor SUPPORT_i");
+ END_OF("Default Constructor SUPPORT_i");
+}
+
+//=============================================================================
+/*!
+ * Constructor
+ */
+//=============================================================================
+SUPPORT_i::SUPPORT_i(const ::SUPPORT * const s) :_support(s),
+ _corbaIndex(SUPPORT_i::supportIndex++)
+{
+ BEGIN_OF("Constructor SUPPORT_i");
+ SUPPORT_i::supportMap[_corbaIndex]=(::SUPPORT *)_support;
+ END_OF("Constructor SUPPORT_i");
+}
+//=============================================================================
+/*!
+ * Constructor
+ */
+//=============================================================================
+SUPPORT_i::SUPPORT_i(const SUPPORT_i &s) :_support(s._support),
+ _corbaIndex(SUPPORT_i::supportIndex++)
+{
+ BEGIN_OF("Constructor SUPPORT_i");
+ SUPPORT_i::supportMap[_corbaIndex]=(::SUPPORT *)_support;
+ END_OF("Constructor SUPPORT_i");
+}
+//=============================================================================
+/*!
+ * Destructor
+ */
+//=============================================================================
+
+SUPPORT_i::~SUPPORT_i()
+{
+}
+//=============================================================================
+/*!
+ * CORBA: Accessor for Corba Index
+ */
+//=============================================================================
+
+CORBA::Long SUPPORT_i::getCorbaIndex()
+throw (SALOME::SALOME_Exception)
+{
+ if (_support==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Support", \
+ SALOME::INTERNAL_ERROR);
+ return _corbaIndex;
+}
+
+//=============================================================================
+/*!
+ * CORBA: Accessor for Name
+ */
+//=============================================================================
+
+char * SUPPORT_i::getName()
+throw (SALOME::SALOME_Exception)
+{
+ if (_support==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Support", \
+ SALOME::INTERNAL_ERROR);
+ try
+ {
+ return CORBA::string_dup(_support->getName().c_str());
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to access the name of the support ");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+
+}
+
+//=============================================================================
+/*!
+ * CORBA: Accessor for Description
+ */
+//=============================================================================
+
+char* SUPPORT_i::getDescription()
+throw (SALOME::SALOME_Exception)
+{
+ if (_support==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Support", \
+ SALOME::INTERNAL_ERROR);
+ try
+ {
+ return CORBA::string_dup(_support->getDescription().c_str());
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to access the description of the support ");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+}
+
+//=============================================================================
+/*!
+ * CORBA: Accessor for Description and Name
+ */
+//=============================================================================
+
+SALOME_MED::SUPPORT::supportInfos * SUPPORT_i::getSupportGlobal()
+throw (SALOME::SALOME_Exception)
+{
+ if (_support==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Support", \
+ SALOME::INTERNAL_ERROR);
+ SALOME_MED::SUPPORT::supportInfos_var all = new SALOME_MED::SUPPORT::supportInfos;
+ try
+ {
+ all->name = CORBA::string_dup(_support->getName().c_str());
+ all->description = CORBA::string_dup(_support->getDescription().c_str());
+ const int numberOfTypes = _support->getNumberOfTypes();
+ all->numberOfGeometricType = numberOfTypes;
+
+ all->types.length(numberOfTypes);
+ all->nbEltTypes.length(numberOfTypes);
+ const medGeometryElement * elemts = _support->getTypes();
+ for (int i=0;i<numberOfTypes;i++)
+ {
+ all->types[i] = convertMedEltToIdlElt(elemts[i]);
+ all->nbEltTypes[i] = _support->getNumberOfElements(elemts[i]);
+ }
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to access the description of the support ");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+ return all._retn();
+
+}
+
+
+//=============================================================================
+/*!
+ * CORBA: Accessor for Mesh
+ */
+//=============================================================================
+
+SALOME_MED::MESH_ptr SUPPORT_i::getMesh()
+throw (SALOME::SALOME_Exception)
+{
+ BEGIN_OF("SALOME_MED::MESH_ptr SUPPORT_i::getMesh()");
+
+ if (_support==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Support", \
+ SALOME::INTERNAL_ERROR);
+ try
+ {
+ MESH * mesh = _support->getMesh();
+
+ SCRUTE(mesh) ;
+
+ MESH_i * m1 = new MESH_i(mesh);
+ SALOME_MED::MESH_ptr m2 = m1->POA_SALOME_MED::MESH::_this();
+ MESSAGE("SALOME_MED::MESH_ptr SUPPORT_i::getMesh() checking des pointeurs CORBA");
+
+ SCRUTE(m1);
+ SCRUTE(m2);
+
+ m1->_remove_ref();
+
+ END_OF("SALOME_MED::MESH_ptr SUPPORT_i::getMesh()");
+
+ return (SALOME_MED::MESH::_duplicate(m2));
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to access the assoicated mesh");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+}
+
+//=============================================================================
+/*!
+ * CORBA: boolean indicating if support concerns all elements
+ */
+//=============================================================================
+
+CORBA::Boolean SUPPORT_i::isOnAllElements()
+throw (SALOME::SALOME_Exception)
+{
+ if (_support==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Support", \
+ SALOME::INTERNAL_ERROR);
+ try
+ {
+ return _support->isOnAllElements();
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to access the type of the support");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+}
+
+//=============================================================================
+/*!
+ * CORBA:
+ */
+//=============================================================================
+CORBA::Long SUPPORT_i::getNumberOfTypes()
+throw (SALOME::SALOME_Exception)
+{
+ if (_support==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Support", \
+ SALOME::INTERNAL_ERROR);
+ try
+ {
+ return _support->getNumberOfTypes();
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to access number of support different types");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+
+}
+
+
+//=============================================================================
+/*!
+ * CORBA: Accessor for type of support's entity
+ */
+//=============================================================================
+
+SALOME_MED::medEntityMesh SUPPORT_i::getEntity()
+throw (SALOME::SALOME_Exception)
+{
+ BEGIN_OF("SALOME_MED::medEntityMesh SUPPORT_i::getEntity()");
+
+ if (_support==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Support", \
+ SALOME::INTERNAL_ERROR);
+ try
+ {
+ END_OF("SALOME_MED::medEntityMesh SUPPORT_i::getEntity()");
+ return convertMedEntToIdlEnt(_support->getEntity());
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to access support s entity");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+}
+
+//=============================================================================
+/*!
+ * CORBA: Accessor for types of geometry elements
+ */
+//=============================================================================
+
+SALOME_MED::medGeometryElement_array * SUPPORT_i::getTypes()
+throw (SALOME::SALOME_Exception)
+{
+ if (_support==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Support", \
+ SALOME::INTERNAL_ERROR);
+ SALOME_MED::medGeometryElement_array_var myseq = new SALOME_MED::medGeometryElement_array;
+ try
+ {
+ int mySeqLength=_support->getNumberOfTypes();
+ myseq->length(mySeqLength);
+ const medGeometryElement * elemts = _support->getTypes();
+ for (int i=0;i<mySeqLength;i++)
+ {
+ myseq[i]=convertMedEltToIdlElt(elemts[i]);
+ }
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to access support different types");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+ return myseq._retn();
+}
+
+//=============================================================================
+/*!
+ * CORBA: Number of different types of geometry elements
+ * existing in the support
+ */
+//=============================================================================
+CORBA::Long SUPPORT_i::getNumberOfElements(SALOME_MED::medGeometryElement geomElement)
+throw (SALOME::SALOME_Exception)
+{
+
+ SCRUTE(geomElement);
+ SCRUTE(SALOME_MED::MED_ALL_ELEMENTS);
+
+ if (_support==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Support", \
+ SALOME::INTERNAL_ERROR);
+ try
+ {
+ return _support->getNumberOfElements(convertIdlEltToMedElt(geomElement));
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to access the number of support different types");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+
+}
+
+//=============================================================================
+/*!
+ * CORBA: get Nodes
+ */
+//=============================================================================
+
+SALOME_MED::long_array * SUPPORT_i::getNumber(SALOME_MED::medGeometryElement geomElement)
+throw (SALOME::SALOME_Exception)
+{
+ SCRUTE(_support);
+ SCRUTE(geomElement);
+ SCRUTE(convertIdlEltToMedElt(geomElement));
+
+ if (_support==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Support", \
+ SALOME::INTERNAL_ERROR);
+ SALOME_MED::long_array_var myseq= new SALOME_MED::long_array;
+ try
+ {
+ int nbelements=_support->getNumberOfElements(convertIdlEltToMedElt(geomElement));
+ myseq->length(nbelements);
+SCRUTE(_support->getName());
+SCRUTE(nbelements);
+SCRUTE(convertIdlEltToMedElt(geomElement));
+ const int * numbers=_support->getNumber(convertIdlEltToMedElt(geomElement));
+ for (int i=0;i<nbelements;i++)
+ {
+ myseq[i]=numbers[i];
+SCRUTE(numbers[i]);
+ }
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to access the support optionnal index");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+ return myseq._retn();
+
+}
+//=============================================================================
+/*!
+ * CORBA: Global Nodes Index (optionnaly designed by the user)
+ * CORBA: ??????????????????????????????
+ */
+//=============================================================================
+
+SALOME_MED::long_array * SUPPORT_i::getNumberIndex()
+throw (SALOME::SALOME_Exception)
+{
+ if (_support==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Support", \
+ SALOME::INTERNAL_ERROR);
+ SALOME_MED::long_array_var myseq= new SALOME_MED::long_array;
+ try
+ {
+ MESSAGE ("Nombre d'elements mis de façon stupide a MED_ALL_ELEMENTS");
+ int nbelements=_support->getNumberOfElements(::MED_ALL_ELEMENTS);
+ myseq->length(nbelements);
+ const int * numbers=_support->getNumberIndex();
+ for (int i=0;i<nbelements;i++)
+ {
+ myseq[i]=numbers[i];
+ }
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to access the support index");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+ return myseq._retn();
+
+}
+//=============================================================================
+/*!
+ * CORBA:
+ */
+//=============================================================================
+
+void SUPPORT_i::getBoundaryElements()
+throw (SALOME::SALOME_Exception)
+{
+ if (_support==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Support", \
+ SALOME::INTERNAL_ERROR);
+ try
+ {
+ (const_cast< ::SUPPORT *>(_support))->getBoundaryElements();
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to access elements");
+ THROW_SALOME_CORBA_EXCEPTION("Unable to acces Support C++ Object"\
+ ,SALOME::INTERNAL_ERROR);
+ }
+}
+
+
+//=============================================================================
+/*!
+ * CORBA: Array containing indexes for elements included in the support
+ */
+//=============================================================================
+
+CORBA::Long SUPPORT_i::getNumberOfGaussPoint(SALOME_MED::medGeometryElement geomElement)
+throw (SALOME::SALOME_Exception)
+{
+ if (_support==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Support", \
+ SALOME::INTERNAL_ERROR);
+ try
+ {
+ return _support->getNumberOfGaussPoint(convertIdlEltToMedElt(geomElement));
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to access number of Gauss points");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+}
+//=============================================================================
+/*!
+ * CORBA: Global Nodes Index (optionnaly designed by the user)
+ */
+//=============================================================================
+SALOME_MED::long_array * SUPPORT_i::getNumbersOfGaussPoint()
+throw (SALOME::SALOME_Exception)
+{
+ if (_support==NULL)
+ THROW_SALOME_CORBA_EXCEPTION("No associated Support", \
+ SALOME::INTERNAL_ERROR);
+ SALOME_MED::long_array_var myseq= new SALOME_MED::long_array;
+ try
+ {
+ int mySeqLength=_support->getNumberOfTypes();
+ myseq->length(mySeqLength);
+ const medGeometryElement * elemts = _support->getTypes();
+ for (int i=0;i<mySeqLength;i++)
+ {
+ myseq[i]= _support->getNumberOfGaussPoint(elemts[i]);
+ }
+ }
+ catch (MEDEXCEPTION &ex)
+ {
+ MESSAGE("Unable to access number of Gauss points");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
+ }
+}
+//=============================================================================
+/*!
+ * CORBA: add the Support in the StudyManager
+ */
+//=============================================================================
+void SUPPORT_i::addInStudy (SALOMEDS::Study_ptr myStudy, SALOME_MED::SUPPORT_ptr myIor)
+ throw (SALOME::SALOME_Exception,SALOMEDS::StudyBuilder::LockProtection)
+{
+ BEGIN_OF("SUPPORT_i::addInStudy");
+
+ if ( _supportId != "" )
+ {
+ MESSAGE("Support already in Study");
+ THROW_SALOME_CORBA_EXCEPTION("Support already in Study", \
+ SALOME::BAD_PARAM);
+ };
+
+ if ( CORBA::is_nil(myStudy) )
+ {
+ MESSAGE("Study not found");
+ THROW_SALOME_CORBA_EXCEPTION("Study deleted !!!",
+ SALOME::INTERNAL_ERROR);
+ }
+
+
+ SALOMEDS::StudyBuilder_var myBuilder = myStudy->NewBuilder();
+ SALOMEDS::GenericAttribute_var anAttr;
+ SALOMEDS::AttributeName_var aName;
+ SALOMEDS::AttributeIOR_var aIOR;
+
+ // Find SComponent labelled 'Med'
+ MESSAGE("Find SComponent labelled 'MED'");
+ SALOMEDS::SComponent_var medfather = myStudy->FindComponent("MED");
+ if ( CORBA::is_nil(medfather) )
+ {
+ MESSAGE("MED not found");
+ THROW_SALOME_CORBA_EXCEPTION("SComponent labelled 'Med' not Found",SALOME::INTERNAL_ERROR);
+ }
+
+ // Find SObject MESH (represent mesh in support)
+ SALOMEDS::SObject_var medmeshfather = myStudy->FindObject("MEDMESH");
+ if ( CORBA::is_nil(medmeshfather) )
+ {
+ MESSAGE("No MEDMESH Found in study")
+ THROW_SALOME_CORBA_EXCEPTION("SObject labelled 'MEDMESH' not Found",SALOME::INTERNAL_ERROR);
+ }
+ cout << "Find SObject MESH (represent mesh in support)"<< flush;
+
+ string meshName = getMesh()->getName() ;
+
+ // seulement sous Med : il peut y avoir le meme sous SMESH !!!
+ SALOMEDS::SObject_var medsupportfather = myStudy->FindObject(meshName.c_str());
+ if ( CORBA::is_nil(medsupportfather) )
+ THROW_SALOME_CORBA_EXCEPTION("SObject Mesh in Support not Found",SALOME::INTERNAL_ERROR);
+ // perhaps add MESH automatically ?
+
+ MESSAGE("Add a support Object under MED/MESH/MESHNAME");
+ SALOMEDS::SObject_var medsupfather = myStudy->FindObject("MEDSUPPORT");
+ if ( CORBA::is_nil(medsupfather) )
+ {
+ MESSAGE("Add Object MEDSUPPORT");
+ medsupfather = myBuilder->NewObject(medmeshfather);
+ anAttr = myBuilder->FindOrCreateAttribute(medsupfather, "AttributeName");
+ aName = SALOMEDS::AttributeName::_narrow(anAttr);
+ aName->SetValue("MEDSUPPORT");
+
+ } ;
+
+
+ //myBuilder->NewCommand();
+ SALOMEDS::SObject_var supportEntry = myStudy->FindObject(_support->getName().c_str());
+ // c'est pas bon, car il faut rechercher uniquement sous le bon MESH !!!
+ if ( CORBA::is_nil(supportEntry) )
+ {
+ // not already in study : we create it !
+ SALOMEDS::SObject_var newObj = myBuilder->NewObject(medsupfather);
+ ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
+ ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting()) ;
+ CORBA::ORB_var &orb = init(0,0);
+ string iorStr = orb->object_to_string(myIor);
+ anAttr = myBuilder->FindOrCreateAttribute(newObj, "AttributeIOR");
+ aIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
+ aIOR->SetValue(iorStr.c_str());
+ anAttr = myBuilder->FindOrCreateAttribute(newObj, "AttributeName");
+ aName = SALOMEDS::AttributeName::_narrow(anAttr);
+ aName->SetValue(_support->getName().c_str());
+ _supportId = newObj->GetID();
+ }
+ else
+ {
+ // already in study : put new AttributeIOR !
+ ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
+ ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting()) ;
+ CORBA::ORB_var &orb = init(0,0);
+ string iorStr = orb->object_to_string(myIor);
+ anAttr = myBuilder->FindOrCreateAttribute(supportEntry, "AttributeIOR");
+ aIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
+ aIOR->SetValue(iorStr.c_str());
+ }
+ myBuilder->CommitCommand();
+
+ END_OF("SUPPORT_i::addInStudy");
+}
--- /dev/null
+//=============================================================================
+// File : MEDMEM_Support_i.hxx
+// Project : SALOME
+// Author : EDF
+// Copyright : EDF 2002
+// $Header: /export/home/PAL/MED/src/MEDMEM_I/MEDMEM_Support_i.hxx
+//=============================================================================
+
+#ifndef _MED_SUPPORT_I_HXX_
+#define _MED_SUPPORT_I_HXX_
+
+#include <map>
+#include <string>
+
+#include <SALOMEconfig.h>
+
+#include CORBA_SERVER_HEADER(MED)
+
+namespace MEDMEM {
+class SUPPORT;
+class SALOME_MED::MESH;
+
+class SUPPORT_i:
+ public POA_SALOME_MED::SUPPORT,
+ public PortableServer::RefCountServantBase
+{
+public :
+ static map < int,::MEDMEM::SUPPORT *> supportMap;
+private :
+ static int supportIndex;
+
+protected :
+
+ // C++ object containing values
+ const ::MEDMEM::SUPPORT * const _support;
+ const int _corbaIndex ;
+ string _supportId ;
+
+public:
+
+ SUPPORT_i();
+ ~SUPPORT_i();
+
+ // Constructors and associated internal methods
+ SUPPORT_i(const ::MEDMEM::SUPPORT * const s);
+ SUPPORT_i(const SUPPORT_i & s);
+
+ // IDL Methods
+ char * getName() throw (SALOME::SALOME_Exception);
+ char * getDescription() throw (SALOME::SALOME_Exception);
+ SALOME_MED::MESH_ptr getMesh() throw (SALOME::SALOME_Exception);
+ CORBA::Boolean isOnAllElements() throw (SALOME::SALOME_Exception);
+ SALOME_MED::medEntityMesh getEntity() throw (SALOME::SALOME_Exception);
+ CORBA::Long getNumberOfElements(SALOME_MED::medGeometryElement geomElement)
+ throw (SALOME::SALOME_Exception);
+ CORBA::Long getNumberOfTypes()
+ throw (SALOME::SALOME_Exception);
+ SALOME_MED::long_array* getNumber(SALOME_MED::medGeometryElement geomElement)
+ throw (SALOME::SALOME_Exception);
+ SALOME_MED::long_array* getNumberIndex()
+ throw (SALOME::SALOME_Exception);
+ CORBA::Long getNumberOfGaussPoint(SALOME_MED::medGeometryElement geomElement)
+ throw (SALOME::SALOME_Exception);
+ SALOME_MED::long_array* getNumbersOfGaussPoint()
+ throw (SALOME::SALOME_Exception);
+
+ SALOME_MED::medGeometryElement_array* getTypes()
+ throw (SALOME::SALOME_Exception);
+
+ void getBoundaryElements() throw (SALOME::SALOME_Exception);
+
+
+ // Others
+ void addInStudy (SALOMEDS::Study_ptr myStudy,
+ SALOME_MED::SUPPORT_ptr myIor)
+ throw (SALOME::SALOME_Exception, SALOMEDS::StudyBuilder::LockProtection);
+
+
+ // Cuisine interne
+ CORBA::Long getCorbaIndex() throw (SALOME::SALOME_Exception);
+ SALOME_MED::SUPPORT::supportInfos * getSupportGlobal() throw (SALOME::SALOME_Exception);
+};
+}
+
+#endif /* _MED_SUPPORT_I_HXX_ */
--- /dev/null
+//=============================================================================
+// File : MEDMEM_convert.cxx
+// Created : mer fév 20 15:47:57 CET 2002
+// Author : EDF
+// Project : SALOME
+// Copyright : EDF 2002
+// $Header: /export/home/PAL/MED_SRC/src/MEDMEM_I/MEDMEM_convert.cxx
+//=============================================================================
+
+#include "utilities.h"
+#include "Utils_CorbaException.hxx"
+
+#include "MEDMEM_convert.hxx"
+
+
+SALOME_MED::medGeometryElement convertMedEltToIdlElt(medGeometryElement element)
+throw (SALOME::SALOME_Exception)
+{
+ switch (element)
+ {
+ case MED_NONE : return SALOME_MED::MED_NONE;
+ case MED_POINT1 : return SALOME_MED::MED_POINT1;
+ case MED_SEG2 : return SALOME_MED::MED_SEG2;
+ case MED_SEG3 : return SALOME_MED::MED_SEG3;
+ case MED_TRIA3 : return SALOME_MED::MED_TRIA3;
+ case MED_QUAD4 : return SALOME_MED::MED_QUAD4;
+ case MED_TRIA6 : return SALOME_MED::MED_TRIA6;
+ case MED_QUAD8 : return SALOME_MED::MED_QUAD8;
+ case MED_TETRA4 : return SALOME_MED::MED_TETRA4;
+ case MED_PYRA5 : return SALOME_MED::MED_PYRA5;
+ case MED_PENTA6 : return SALOME_MED::MED_PENTA6;
+ case MED_HEXA8 : return SALOME_MED::MED_HEXA8;
+ case MED_TETRA10 : return SALOME_MED::MED_TETRA10;
+ case MED_PYRA13 : return SALOME_MED::MED_PYRA13;
+ case MED_PENTA15 : return SALOME_MED::MED_PENTA15;
+ case MED_HEXA20 : return SALOME_MED::MED_HEXA20;
+ case MED_ALL_ELEMENTS : return SALOME_MED::MED_ALL_ELEMENTS;
+ default :
+ { MESSAGE("Unknown Geometry Element");
+ THROW_SALOME_CORBA_EXCEPTION("Unknown Geometry Element",
+ SALOME::INTERNAL_ERROR);
+ }
+ }
+}
+
+medGeometryElement convertIdlEltToMedElt(SALOME_MED::medGeometryElement element)
+throw (SALOME::SALOME_Exception)
+{
+
+ SCRUTE(element);
+
+ switch (element)
+ {
+ case SALOME_MED::MED_NONE : return MED_NONE;
+ case SALOME_MED::MED_POINT1 : return MED_POINT1;
+ case SALOME_MED::MED_SEG2 : return MED_SEG2;
+ case SALOME_MED::MED_SEG3 : return MED_SEG3;
+ case SALOME_MED::MED_TRIA3 : return MED_TRIA3;
+ case SALOME_MED::MED_QUAD4 : return MED_QUAD4;
+ case SALOME_MED::MED_TRIA6 : return MED_TRIA6;
+ case SALOME_MED::MED_QUAD8 : return MED_QUAD8;
+ case SALOME_MED::MED_TETRA4 : return MED_TETRA4;
+ case SALOME_MED::MED_PYRA5 : return MED_PYRA5;
+ case SALOME_MED::MED_PENTA6 : return MED_PENTA6;
+ case SALOME_MED::MED_HEXA8 : return MED_HEXA8;
+ case SALOME_MED::MED_TETRA10 : return MED_TETRA10;
+ case SALOME_MED::MED_PYRA13 : return MED_PYRA13;
+ case SALOME_MED::MED_PENTA15 : return MED_PENTA15;
+ case SALOME_MED::MED_HEXA20 : return MED_HEXA20;
+ case SALOME_MED::MED_ALL_ELEMENTS : return MED_ALL_ELEMENTS;
+ default :
+ { MESSAGE("unknown Geometry Element");
+ THROW_SALOME_CORBA_EXCEPTION("Unknown Geometry Element",
+ SALOME::INTERNAL_ERROR);
+ }
+ }
+}
+
+SALOME_MED::medEntityMesh convertMedEntToIdlEnt(medEntityMesh entity)
+throw (SALOME::SALOME_Exception)
+{
+ switch (entity)
+ {
+ case MED_CELL : return SALOME_MED::MED_CELL;
+ case MED_FACE : return SALOME_MED::MED_FACE;
+ case MED_EDGE : return SALOME_MED::MED_EDGE;
+ case MED_NODE : return SALOME_MED::MED_NODE;
+ case MED_ALL_ENTITIES : return SALOME_MED::MED_ALL_ENTITIES;
+ default :
+ { MESSAGE("Unknown entity element");
+ THROW_SALOME_CORBA_EXCEPTION("Unknown Entity Element",
+ SALOME::INTERNAL_ERROR);
+ }
+ }
+}
+
+medEntityMesh convertIdlEntToMedEnt(SALOME_MED::medEntityMesh entity)
+throw (SALOME::SALOME_Exception)
+{
+ switch (entity)
+ {
+ case SALOME_MED::MED_CELL : return MED_CELL;
+ case SALOME_MED::MED_FACE : return MED_FACE;
+ case SALOME_MED::MED_EDGE : return MED_EDGE;
+ case SALOME_MED::MED_NODE : return MED_NODE;
+ case SALOME_MED::MED_ALL_ENTITIES : return MED_ALL_ENTITIES;
+ default :
+ { MESSAGE("Unknown Entity Element");
+ THROW_SALOME_CORBA_EXCEPTION("Unknown Entity Element",
+ SALOME::INTERNAL_ERROR);
+ }
+ }
+}
+
+medModeSwitch convertIdlModeToMedMode(SALOME_MED::medModeSwitch mode)
+throw (SALOME::SALOME_Exception)
+{
+ switch (mode)
+ {
+ case SALOME_MED::MED_FULL_INTERLACE : return MED_FULL_INTERLACE;
+ case SALOME_MED::MED_NO_INTERLACE : return MED_NO_INTERLACE;
+ default :
+ { MESSAGE("Unknown interlace mode");
+ THROW_SALOME_CORBA_EXCEPTION("Unknown interlace mode",
+ SALOME::INTERNAL_ERROR);
+ }
+ }
+}
+
+SALOME_MED::medModeSwitch convertMedModeToIdlMode(medModeSwitch mode)
+throw (SALOME::SALOME_Exception)
+{
+ switch (mode)
+ {
+ case MED_FULL_INTERLACE : return SALOME_MED::MED_FULL_INTERLACE;
+ case MED_NO_INTERLACE : return SALOME_MED::MED_NO_INTERLACE;
+ default :
+ { MESSAGE("Unknown interlace mode");
+ THROW_SALOME_CORBA_EXCEPTION("Unknown interlace mode",
+ SALOME::INTERNAL_ERROR);
+ }
+ }
+}
+SALOME_MED::medConnectivity convertMedConnToIdlConn(medConnectivity connectivite)
+throw (SALOME::SALOME_Exception)
+{
+ switch (connectivite)
+ {
+ case MED_NODAL : return SALOME_MED::MED_NODAL;
+ case MED_DESCENDING : return SALOME_MED::MED_DESCENDING;
+ default :
+ { MESSAGE("Unknown connectivity type");
+ THROW_SALOME_CORBA_EXCEPTION("Unknown connectivity type",
+ SALOME::INTERNAL_ERROR);
+ }
+ }
+}
+medConnectivity convertIdlConnToMedConn(SALOME_MED::medConnectivity connectivite)
+throw (SALOME::SALOME_Exception)
+{
+ switch (connectivite)
+ {
+ case SALOME_MED::MED_NODAL : return MED_NODAL;
+ case SALOME_MED::MED_DESCENDING : return MED_DESCENDING;
+ default :
+ { MESSAGE("Unknown connectivity type");
+ THROW_SALOME_CORBA_EXCEPTION("Unknown connectivity type",
+ SALOME::INTERNAL_ERROR);
+ }
+ }
+}
+SALOME_MED::medDriverTypes convertMedDriverToIdlDriver(MEDMEM::driverTypes driverType)
+throw (SALOME::SALOME_Exception)
+{
+ switch (driverType)
+ {
+ case MEDMEM::MED_DRIVER : return SALOME_MED::MED_DRIVER;
+ case MEDMEM::VTK_DRIVER : return SALOME_MED::VTK_DRIVER;
+ case MEDMEM::NO_DRIVER : return SALOME_MED::NO_DRIVER;
+ default :
+ { MESSAGE("Unknown driver type");
+ THROW_SALOME_CORBA_EXCEPTION("Unknown driver type",
+ SALOME::INTERNAL_ERROR);
+ }
+ }
+}
+
+MEDMEM::driverTypes convertIdlDriverToMedDriver(SALOME_MED::medDriverTypes driverType)
+throw (SALOME::SALOME_Exception)
+{
+ switch (driverType)
+ {
+ case SALOME_MED::MED_DRIVER : return MEDMEM::MED_DRIVER;
+ case SALOME_MED::VTK_DRIVER : return MEDMEM::VTK_DRIVER;
+ case SALOME_MED::NO_DRIVER : return MEDMEM::NO_DRIVER;
+ default :
+ { MESSAGE("Unknown driver type");
+ THROW_SALOME_CORBA_EXCEPTION("Unknown driver type",
+ SALOME::INTERNAL_ERROR);
+ }
+ }
+}
+bool verifieParam (SALOME_MED::medEntityMesh entity,SALOME_MED::medGeometryElement geomElement)
+throw (SALOME::SALOME_Exception)
+{
+ SCRUTE(entity);
+ SCRUTE(geomElement);
+ bool coherent=false;
+ switch (entity)
+ {
+ case SALOME_MED::MED_FACE :
+ {
+ switch (geomElement)
+ {
+ case SALOME_MED::MED_TRIA3 : coherent=true;
+ case SALOME_MED::MED_QUAD4 : coherent=true;
+ case SALOME_MED::MED_TRIA6 : coherent=true;
+ case SALOME_MED::MED_QUAD8 : coherent=true;
+ }
+ break;
+ }
+ case SALOME_MED::MED_CELL :
+ {
+ switch (geomElement)
+ {
+ case SALOME_MED::MED_POINT1 : coherent=true;
+ case SALOME_MED::MED_SEG2 : coherent=true;
+ case SALOME_MED::MED_SEG3 : coherent=true;
+ case SALOME_MED::MED_TRIA3 : coherent=true;
+ case SALOME_MED::MED_TRIA6 : coherent=true;
+ case SALOME_MED::MED_QUAD4 : coherent=true;
+ case SALOME_MED::MED_QUAD8 : coherent=true;
+ case SALOME_MED::MED_TETRA4 : coherent=true;
+ case SALOME_MED::MED_TETRA10 : coherent=true;
+ case SALOME_MED::MED_HEXA8 : coherent=true;
+ case SALOME_MED::MED_HEXA20 : coherent=true;
+ case SALOME_MED::MED_PENTA6 : coherent=true;
+ case SALOME_MED::MED_PENTA15 : coherent=true;
+ case SALOME_MED::MED_PYRA5 : coherent=true;
+ case SALOME_MED::MED_PYRA13 : coherent=true;
+ }
+ break;
+ }
+ case SALOME_MED::MED_EDGE :
+ {
+ switch (geomElement)
+ {
+ case SALOME_MED::MED_SEG2 : coherent=true;
+ case SALOME_MED::MED_SEG3 : coherent=true;
+ }
+ break;
+ }
+ case SALOME_MED::MED_NODE :
+ {
+ switch (geomElement)
+ {
+ case SALOME_MED::MED_POINT1 : coherent=true;
+ }
+ break;
+ }
+ case SALOME_MED::MED_ALL_ENTITIES :
+ {
+ switch (geomElement)
+ {
+ case SALOME_MED::MED_NONE : coherent=true;
+ }
+ break;
+ }
+ default :
+ { MESSAGE("Unknown geometric entity");
+ THROW_SALOME_CORBA_EXCEPTION("Unknown geometric entity",
+ SALOME::INTERNAL_ERROR);
+ }
+ break;
+ }
+
+ switch (geomElement)
+ {
+ case SALOME_MED::MED_ALL_ELEMENTS : coherent=true;
+ }
+ return coherent;
+}
--- /dev/null
+//=============================================================================
+// File : MEDMEM_convert.hxx
+// Created : mer fév 20 15:47:57 CET 2002
+// Author : EDF
+// Project : SALOME
+// Copyright : EDF 2002
+// $Header: /export/home/PAL/MED_SRC/src/MEDMEM_I/MEDMEM_convert.hxx
+//=============================================================================
+# if ! defined ( __CONVERT_H__ )
+# define __CONVERT_H__
+
+#include <SALOMEconfig.h>
+#include CORBA_SERVER_HEADER(MED)
+#include "MEDMEM_define.hxx"
+
+using namespace MED_EN;
+
+#include "MEDMEM_GenDriver.hxx"
+
+SALOME_MED::medGeometryElement convertMedEltToIdlElt(medGeometryElement element)
+ throw (SALOME::SALOME_Exception);
+SALOME_MED::medEntityMesh convertMedEntToIdlEnt(medEntityMesh entity)
+ throw (SALOME::SALOME_Exception);
+SALOME_MED::medModeSwitch convertMedModeToIdlMode(medModeSwitch mode)
+ throw (SALOME::SALOME_Exception);
+SALOME_MED::medDriverTypes convertMedDriverToIdlDriver(MEDMEM::driverTypes driverType)
+ throw (SALOME::SALOME_Exception);
+SALOME_MED::medConnectivity convertMedConnToIdlConn(medConnectivity connectivite)
+ throw (SALOME::SALOME_Exception);
+
+medGeometryElement convertIdlEltToMedElt (SALOME_MED::medGeometryElement element)
+ throw (SALOME::SALOME_Exception);
+medEntityMesh convertIdlEntToMedEnt(SALOME_MED::medEntityMesh entity)
+ throw (SALOME::SALOME_Exception);
+medModeSwitch convertIdlModeToMedMode(SALOME_MED::medModeSwitch mode)
+ throw (SALOME::SALOME_Exception);
+MEDMEM::driverTypes convertIdlDriverToMedDriver(SALOME_MED::medDriverTypes driverType)
+ throw (SALOME::SALOME_Exception);
+medConnectivity convertIdlConnToMedConn(SALOME_MED::medConnectivity connectivite)
+ throw (SALOME::SALOME_Exception);
+
+
+bool verifieParam (SALOME_MED::medEntityMesh entity, SALOME_MED::medGeometryElement geomElement)
+ throw (SALOME::SALOME_Exception);
+
+# endif /* # if ! defined ( __CONVERT_H__ ) */
--- /dev/null
+# MED MEDMEM_I : MED idl descriptions implementation based on the classes of MEDMEM
+#
+# 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
+#
+#
+#
+# Author : Marc Tajchman
+# Module : MED
+# $Header: /export/home/PAL/MED_SRC/src/MEDMEM_I/Makefile.in
+
+top_srcdir=@top_srcdir@
+top_builddir=../..
+srcdir=@srcdir@
+VPATH=.:@srcdir@:@top_srcdir@/idl:$(top_builddir)/idl:${KERNEL_ROOT_DIR}/idl/salome
+
+MACHINE=PCLINUX
+
+@COMMENCE@
+
+
+#EXPORT_PYSCRIPTS = \
+# testMed.py
+
+EXPORT_HEADERS = \
+ MEDMEM_convert.hxx \
+ MEDMEM_Med_i.hxx \
+ MEDMEM_Family_i.hxx \
+ MEDMEM_FieldDouble_i.hxx \
+ MEDMEM_FieldInt_i.hxx \
+ MEDMEM_FieldOf_i.hxx \
+ MEDMEM_Field_i.hxx \
+ MEDMEM_Group_i.hxx \
+ MEDMEM_Mesh_i.hxx \
+ MEDMEM_Support_i.hxx
+
+# Libraries targets
+
+LIB=libMEDMEMImpl.la
+LIB_SRC = MEDMEM_Med_i.cxx MEDMEM_Family_i.cxx MEDMEM_FieldDouble_i.cxx MEDMEM_FieldInt_i.cxx MEDMEM_Field_i.cxx MEDMEM_Group_i.cxx MEDMEM_Mesh_i.cxx MEDMEM_Support_i.cxx MEDMEM_convert.cxx
+LIB_SERVER_IDL = MED.idl
+LIB_CLIENT_IDL= SALOME_Component.idl SALOMEDS.idl SALOMEDS_Attributes.idl SALOME_Exception.idl
+
+# Executables targets
+BIN_SRC =
+BIN_SERVER_IDL =
+BIN_CLIENT_IDL =
+
+
+CPPFLAGS+= $(MED2_INCLUDES) $(HDF5_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome
+CXXFLAGS=-g -D_DEBUG_ -D__x86__ -D__linux__ -I${KERNEL_ROOT_DIR}/include/salome
+LDFLAGS+=$(MED2_LIBS) $(HDF5_LIBS) -lmedmem -lOpUtil -L${KERNEL_ROOT_DIR}/lib/salome
+#LDFLAGS+=-lmedmem -L. -lSalomeContainer -lSalomeNS -lRegistry -lOpUtil -lSalomeNotification
+# does we put only -lSalomeContainer and compiler retrieves -lSalomeNS -lRegistry -lOpUtil ????
+
+MED.hh MEDSK.cc: MED.idl
+ omniidl -bcxx -Wbtp -I$(top_builddir)/idl -I${KERNEL_ROOT_DIR}/idl/salome $^
+
+@CONCLUDE@
--- /dev/null
+Users Guide
+
+1. You can see file med_test2.cxx for an example of using library
+
+2. To get meshes and fields from an MED file, the simplest way is to create a MED object with argument string filename. It scan MED file to get all meshes and fields in it. After you could say to MED object to read a particular mesh or field and get it with appropriate method of MED object (see MED.hxx and med_test2.cxx)
+
+3. When you have a Mesh object (or Field object), you could get information in using get_... methods (see Mesh.hxx, Support.hxx, Field.hxx and med_test2.cxx)
+
+I work on documentation with doxygen tool.
+
+
+Patrick GOLDBRONN
+DEN/DM2S/SFME/LGLS
+patrick.goldbronn@cea.fr
+tel : 0169087355
using namespace std;
#include "MEDMEM_SWIG_FieldDouble.hxx"
+using namespace MEDMEM;
//=============================================================================
/*!
CXXFLAGS=-g -D_DEBUG_ -D__x86__ -D__linux__
CXXFLAGS+=-ftemplate-depth-42 -I${KERNEL_ROOT_DIR}/include/salome
LIBS= $(PYTHON_LIBS)
-LDFLAGS+= -lmedmem $(MED2_LIBS) $(HDF5_LIBS)
+LDFLAGS+= -lmedmem $(MED2_LIBS) $(HDF5_LIBS) -lSalomeLoggerServer -L${KERNEL_ROOT_DIR}/lib/salome
#############################################################################
# (avoids incomplete import at run time)
print "============== import MED_idl ======================="
-print "============== import Med_Gen_idl ======================="
+print "============== import MED_Gen_idl ======================="
import MED_idl
-import Med_Gen_idl
+import MED_Gen_idl
# this function is required
"""
This function initializes shared modules that need to be
"""
- pass
\ No newline at end of file
+ pass
@COMMENCE@
-SUBDIRS = MEDMEM MEDMEM_SWIG MedMem MED MEDGUI MedCorba_Swig MED_SWIG MedClient
+SUBDIRS = MEDMEM MEDMEM_SWIG MEDMEM_I MED MEDGUI MedCorba_Swig MED_SWIG MedClient
@MODULE@
-#include <convert.hxx>
+#include "MEDMEM_convert.hxx"
+#include "Utils_CorbaException.hxx"
#include "UtilClient.hxx"
#include "CONNECTIVITYClient.hxx"
+using namespace MEDMEM;
+//=============================================================================
+/*!
+ * Constructeur
+ */
+//=============================================================================
+
CONNECTIVITYClient::CONNECTIVITYClient(const SALOME_MED::MESH_ptr m,
medEntityMesh Entity) :
CONNECTIVITY(m->getNumberOfTypes(Entity), Entity),
END_OF("CONNECTIVITYClient::CONNECTIVITYClient()");
}
+//=============================================================================
+/*!
+ * Destructeur
+ */
+//=============================================================================
CONNECTIVITYClient::~CONNECTIVITYClient()
{
BEGIN_OF("CONNECTIVITYClient::~CONNECTIVITYClient()");
END_OF("CONNECTIVITYClient::~CONNECTIVITYClient()");
}
+//=============================================================================
+/*!
+ * Remplit les informations nécessaires
+ * 1 seul appel Corba
+ */
+//=============================================================================
void CONNECTIVITYClient::blankCopy()
{
BEGIN_OF("CONNECTIVITYClient::blankCopy()");
- _numberOfNodes = IOR_Mesh->getNumberOfNodes();
+ SALOME_MED::MESH::connectivityInfos *all = new SALOME_MED::MESH::connectivityInfos;
+ medEntityMesh Entity = getEntity();
+ try
+ {
+ all= IOR_Mesh->getConnectGlobal(Entity);
+ }
+ catch (const exception & ex)
+ {
+ MESSAGE("Unable to acces Global information");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what() ,SALOME::INTERNAL_ERROR);
+ }
+
+ //_numberOfNodes = IOR_Mesh->getNumberOfNodes();
+ _numberOfNodes = all->numberOfNodes;
- medEntityMesh Entity = getEntity();
medGeometryElement * Types;
long iT, nT;
+ //convertCorbaArray<SALOME_MED::medGeometryElement>
+ // (Types, nT, IOR_Mesh->getTypes(Entity));
convertCorbaArray<SALOME_MED::medGeometryElement>
- (Types, nT, IOR_Mesh->getTypes(Entity));
+ (Types, nT, &all->meshTypes);
ASSERT(nT == (int) getNumberOfTypes(Entity));
SCRUTE(nT);
_totalNumberOfElements_client = 0L;
_numberOfElements_client = new long[nT];
- for (iT=0; iT<nT; iT++) {
- _numberOfElements_client[iT]
- = IOR_Mesh->getNumberOfElements(Entity, Types[iT]);
+ for (iT=0; iT<nT; iT++)
+ {
+ //_numberOfElements_client[iT]
+ // = IOR_Mesh->getNumberOfElements(Entity, Types[iT]);
+ _numberOfElements_client[iT] = all->numberOfElements[iT];
_totalNumberOfElements_client += _numberOfElements_client[iT];
SCRUTE(iT);
SCRUTE(_numberOfElements_client[iT]);
END_OF("CONNECTIVITYClient::blankCopy()");
}
+//=============================================================================
+/*!
+ */
+//=============================================================================
void CONNECTIVITYClient::fillCopy()
{
END_OF("void CONNECTIVITYClient::fillCopy()");
}
+//=============================================================================
+/*!
+ */
+//=============================================================================
med_int CONNECTIVITYClient::getNumberOf(medEntityMesh Entity,
medGeometryElement Type) const
{
return n;
}
+//=============================================================================
+/*!
+ */
+//=============================================================================
const med_int * CONNECTIVITYClient::getConnectivity
(medConnectivity ConnectivityType,
medEntityMesh Entity,
return c;
}
+//=============================================================================
+/*!
+ */
+//=============================================================================
const med_int * CONNECTIVITYClient::getConnectivityIndex
(medConnectivity ConnectivityType,
medEntityMesh Entity)
return c;
}
+//=============================================================================
+/*!
+ */
+//=============================================================================
void CONNECTIVITYClient::calculateConnectivity
(medConnectivity connectivityType,
medEntityMesh Entity)
END_OF("void CONNECTIVITYClient::calculateConnectivity()");
}
+//=============================================================================
+/*!
+ */
+//=============================================================================
void CONNECTIVITYClient::updateFamily (vector<FAMILY*> myFamilies)
{
BEGIN_OF("void CONNECTIVITYClient::updateFamily()");
END_OF("void CONNECTIVITYClient::updateFamily()");
}
+//=============================================================================
+/*!
+ */
+//=============================================================================
const int * CONNECTIVITYClient::getGlobalNumberingIndex
(medEntityMesh Entity) const throw (MEDEXCEPTION)
{
END_OF("void CONNECTIVITYClient::getGlobalNumberingIndex()");
}
+//=============================================================================
+/*!
+ */
+//=============================================================================
bool CONNECTIVITYClient::existConnectivity(medConnectivity ConnectivityType,
medEntityMesh Entity) const
{
return b;
}
+//=============================================================================
+/*!
+ */
+//=============================================================================
const med_int * CONNECTIVITYClient::getReverseConnectivity
(medConnectivity ConnectivityType,
medEntityMesh Entity) throw (MEDEXCEPTION)
return c;
}
+//=============================================================================
+/*!
+ */
+//=============================================================================
const med_int * CONNECTIVITYClient::getReverseConnectivityIndex
(medConnectivity ConnectivityType,
medEntityMesh Entity) throw (MEDEXCEPTION)
return c;
}
+//=============================================================================
+/*!
+ */
+//=============================================================================
const med_int* CONNECTIVITYClient::getValue(medConnectivity TypeConnectivity,
medGeometryElement Type)
{
return c;
}
+//=============================================================================
+/*!
+ */
+//=============================================================================
const med_int* CONNECTIVITYClient::getValueIndex(medConnectivity TypeConnectivity)
{
BEGIN_OF("void CONNECTIVITYClient::getValueIndex()");
return c;
}
+//=============================================================================
+/*!
+ */
+//=============================================================================
const med_int* CONNECTIVITYClient::getNeighbourhood() const
{
BEGIN_OF("void CONNECTIVITYClient::getNeighbourhood()");
#include "MEDMEM_Connectivity.hxx"
#include CORBA_CLIENT_HEADER(MED)
+namespace MEDMEM {
class CONNECTIVITYClient : public CONNECTIVITY {
protected:
const med_int* getValueIndex (medConnectivity TypeConnectivity);
const med_int* getNeighbourhood() const;
};
+};
#endif
+#define _DEBUG_
#include "COORDINATEClient.hxx"
#include <string>
#include "UtilClient.hxx"
+#include "Utils_CorbaException.hxx"
+
+using namespace MEDMEM;
+//=============================================================================
+/*!
+ * Constructeur
+ */
+//=============================================================================
COORDINATEClient::COORDINATEClient(const SALOME_MED::MESH_ptr m,
medModeSwitch Mode) :
END_OF("COORDINATEClient::COORDINATEClient(...)");
}
-
+//=============================================================================
+/*!
+ * Remplit les informations générales
+ */
+//=============================================================================
void COORDINATEClient::blankCopy()
{
BEGIN_OF("void COORDINATEClient::blankCopy()");
std::string *tA;
long nA;
-
- convertCorbaArray(tA, nA, IOR_Mesh->getCoordinatesNames());
+ SALOME_MED::MESH::coordinateInfos *all = new SALOME_MED::MESH::coordinateInfos;
+ try
+ {
+ all= IOR_Mesh->getCoordGlobal();
+ }
+ catch (const exception & ex)
+ {
+ MESSAGE("Unable to acces Global information");
+ THROW_SALOME_CORBA_EXCEPTION(ex.what() ,SALOME::INTERNAL_ERROR);
+ }
+
+ //convertCorbaArray(tA, nA, IOR_Mesh->getCoordinatesNames());
+ convertCorbaArray(tA, nA, &all->coordNames);
ASSERT(nA == getSpaceDimension());
setCoordinatesNames(tA);
delete [] tA;
- convertCorbaArray(tA, nA, IOR_Mesh->getCoordinatesUnits());
+ //convertCorbaArray(tA, nA, IOR_Mesh->getCoordinatesUnits());
+ convertCorbaArray(tA, nA, &all->coordUnits);
ASSERT(nA == getSpaceDimension());
setCoordinatesUnits(tA);
delete [] tA;
- setCoordinatesSystem(IOR_Mesh->getCoordinatesSystem());
+
+ setCoordinatesSystem( CORBA::string_dup(all->coordSystem));
_complete = false;
END_OF("void COORDINATEClient::blankCopy()");
}
+//=============================================================================
+/*!
+ * Remplit les coordonnées
+ */
+//=============================================================================
void COORDINATEClient::fillCopy()
{
BEGIN_OF("void COORDINATEClient::fillCopy()");
+ //PN ?? Est-ce qu on peut pas mettre une variable dans COORDINATEClient
+ // qu on remplirait dans blankCopy ??
long nN = IOR_Mesh->getNumberOfNodes();
double *tC;
long nC;
END_OF("void COORDINATEClient::fillCopy()");
}
+//=============================================================================
+/*!
+ * Retourne les coordonnées
+ */
+//=============================================================================
const double * COORDINATEClient::getCoordinates(medModeSwitch Mode)
{
return c;
}
+//=============================================================================
+/*!
+ * Retourne une coordonnée
+ */
+//=============================================================================
-double COORDINATEClient::getCoordinate(int Number,int Axis)
+double COORDINATEClient::getCoordinate(int Number,int Axis)
{
BEGIN_OF("void COORDINATEClient::getCoordinate()");
return d;
}
-
+//=============================================================================
+/*!
+ * Retourne un axe
+ */
+//=============================================================================
const double * COORDINATEClient::getCoordinateAxis(int Axis)
{
BEGIN_OF("void COORDINATEClient::getCoordinateAxis()");
return c;
}
-
+//=============================================================================
+/*!
+ * Retourne le nombre de noeuds
+ */
+//=============================================================================
const int* COORDINATEClient::getNodesNumbers() const
{
BEGIN_OF("void COORDINATEClient::getNodesNumbers()");
#include "MEDMEM_Coordinate.hxx"
#include CORBA_CLIENT_HEADER(MED)
+namespace MEDMEM {
class COORDINATEClient : public COORDINATE {
protected:
virtual const int* getNodesNumbers() const;
};
+};
#endif
#include "FAMILYClient.hxx"
#include "MESHClient.hxx"
#include "UtilClient.hxx"
-
-FAMILYClient::FAMILYClient(const SALOME_MED::FAMILY_ptr F,
- MESH * M)
- : SUPPORTClient(F, M),
+using namespace MEDMEM;
+//=============================================================================
+/*!
+ * Constructeur
+ */
+//=============================================================================
+FAMILYClient::FAMILYClient(const SALOME_MED::FAMILY_ptr S,
+ MESH * M)
+ : SUPPORTClient(S, M),
FAMILY(),
- IOR_Family(SALOME_MED::FAMILY::_duplicate(F))
+ IOR_Family(SALOME_MED::FAMILY::_duplicate(S))
{
BEGIN_OF("FAMILYClient::FAMILYClient(SALOME_MED::FAMILY_ptr m)");
- SCRUTE(F);
+ SCRUTE(S);
SCRUTE(M);
blankCopy(false);
END_OF("FAMILYClient::FAMILYClient(SALOME_MED::FAMILY_ptr m)");
}
-
+//=============================================================================
+/*!
+ * Remplit les informations générales
+ */
+//=============================================================================
void FAMILYClient::blankCopy(bool blankSupport)
{
BEGIN_OF("FAMILYClient::blankCopy()");
if (blankSupport)
SUPPORTClient::blankCopy();
- MESSAGE("");
-
// setIdentifier(IOR_Family->getIdentifier());
// int nAttr, nGr, n;
END_OF("FAMILYClient::blankCopy()");
}
+//=============================================================================
+/*!
+ * Remplit les informations générales
+ */
+//=============================================================================
void FAMILYClient::fillCopy(bool fillSupport)
{
BEGIN_OF("FAMILYClient::fillCopy()");
END_OF("FAMILYClient::fillCopy()");
}
+//=============================================================================
+/*!
+ * Destructeur
+ */
+//=============================================================================
FAMILYClient::~FAMILYClient()
{
#include "SUPPORTClient.hxx"
+namespace MEDMEM {
class FAMILYClient :
public SUPPORTClient, public FAMILY {
virtual void fillCopy(bool fillSupport = true);
};
+};
#endif
#include "MEDMEM_Field.hxx"
#include CORBA_CLIENT_HEADER(MED)
+namespace MEDMEM {
template <typename T>
class FIELDClient : virtual public FIELD<T> {
END_OF("FIELDClient::~FIELDClient");
}
+}
#endif
#include "GROUPClient.hxx"
#include "MESHClient.hxx"
+using namespace MEDMEM;
+
+//=============================================================================
+/*!
+ * Constructeur
+ */
+//=============================================================================
GROUPClient::GROUPClient(const SALOME_MED::GROUP_ptr G,
MESH * M)
END_OF("GROUPClient::GROUPClient()");
}
-
+//=============================================================================
+/*!
+ * Remplit les informations générales
+ */
+//=============================================================================
void GROUPClient::blankCopy()
{
BEGIN_OF("GROUPClient::blankCopy()");
END_OF("GROUPClient::blankCopy()");
}
+//=============================================================================
+/*!
+ * Remplit les informations
+ */
+//=============================================================================
void GROUPClient::fillCopy()
{
END_OF("GROUPClient::fillCopy()");
}
+//=============================================================================
+/*!
+ * Destructeur
+ */
+//=============================================================================
GROUPClient::~GROUPClient()
{
#include CORBA_CLIENT_HEADER(MED)
#include "SUPPORTClient.hxx"
+namespace MEDMEM {
class GROUPClient :
public SUPPORTClient,
public GROUP
virtual void fillCopy();
};
+}
#endif
#include "MESHClient.hxx"
-#include <convert.hxx>
+#include "MEDMEM_convert.hxx"
#include "UtilClient.hxx"
#include "COORDINATEClient.hxx"
#include "CONNECTIVITYClient.hxx"
#include "FAMILYClient.hxx"
#include "GROUPClient.hxx"
+//=============================================================================
+/*!
+ * Constructeur
+ */
+//=============================================================================
MESHClient::MESHClient(const SALOME_MED::MESH_ptr m) :
MESH(),
END_OF("MESHClient::MESHClient(SALOME_MED::MESH_ptr m)");
}
+//=============================================================================
+/*!
+ * Transforme un IOR Famille en Famille Client
+ */
+//=============================================================================
-FAMILY * convertFamily(const SALOME_MED::FAMILY_ptr &F, MESH *M) {
+FAMILY * convertFamily(const SALOME_MED::FAMILY_ptr &F, MESH *M)
+{
return new FAMILYClient(F, M);
}
-
-GROUP * convertGroup(const SALOME_MED::GROUP_ptr &F, MESH *M) {
+//=============================================================================
+/*!
+ * Transforme un IOR groupe en groupe Client
+ */
+//=============================================================================
+GROUP * convertGroup(const SALOME_MED::GROUP_ptr &F, MESH *M)
+{
return new GROUPClient(F, M);
}
-
+//=============================================================================
+/*!
+ * Remplit les informations générales
+ */
+//=============================================================================
void MESHClient::blankCopy()
{
BEGIN_OF("MESHClient::blankCopy()");
-
- CORBA::String_var s;
+ SALOME_MED::MESH::meshInfos * all = new SALOME_MED::MESH::meshInfos;
+ all = IOR_Mesh->getMeshGlobal();
+
+ //CORBA::String_var s;
+ //s= IOR_Mesh->getName(); _name = s;
+ //_spaceDimension = IOR_Mesh->getSpaceDimension();
+ //_meshDimension = IOR_Mesh->getMeshDimension();
+ //_numberOfNodes = IOR_Mesh->getNumberOfNodes();
- s= IOR_Mesh->getName(); _name = s;
- _spaceDimension = IOR_Mesh->getSpaceDimension();
- _meshDimension = IOR_Mesh->getMeshDimension();
- _numberOfNodes = IOR_Mesh->getNumberOfNodes();
-
- COORDINATEClient *_coord
- = dynamic_cast<COORDINATEClient*>(_coordinate);
- ASSERT(_coord);
+ _name = all->name;
+ _spaceDimension = all->spaceDimension;
+ _meshDimension = all->meshDimension;
+ _numberOfNodes = all->numberOfNodes;
+
+ COORDINATEClient *_coord
+ = dynamic_cast<COORDINATEClient*>(_coordinate);
+ ASSERT(_coord);
CONNECTIVITYClient *_connect
= dynamic_cast<CONNECTIVITYClient*>(_connectivity);
ASSERT(_connect);
- _coord->blankCopy();
+ _coord->blankCopy();
_connect->blankCopy();
- MESSAGE("");
convertCorbaArray<SALOME_MED::FAMILY_ptr>
(_familyNode,
_numberOfNodesFamilies,
- IOR_Mesh->getFamilies(MED_NODE),
+ //IOR_Mesh->getFamilies(MED_NODE),
+ &all->famNode,
(void *) (convertFamily), this);
- MESSAGE("");
convertCorbaArray<SALOME_MED::FAMILY_ptr>
(_familyEdge,
_numberOfEdgesFamilies,
- IOR_Mesh->getFamilies(MED_EDGE),
+ //IOR_Mesh->getFamilies(MED_EDGE),
+ &all->famEdge,
(void *) (convertFamily), this);
- MESSAGE("");
convertCorbaArray<SALOME_MED::FAMILY_ptr>
(_familyFace,
_numberOfFacesFamilies,
- IOR_Mesh->getFamilies(MED_FACE),
+ //IOR_Mesh->getFamilies(MED_FACE),
+ &all->famFace,
(void *) (convertFamily), this);
- MESSAGE("");
convertCorbaArray<SALOME_MED::FAMILY_ptr>
(_familyCell,
_numberOfCellsFamilies,
- IOR_Mesh->getFamilies(MED_CELL),
+ //IOR_Mesh->getFamilies(MED_CELL),
+ &all->famCell,
(void *) (convertFamily), this);
- MESSAGE("");
convertCorbaArray<SALOME_MED::GROUP_ptr>
(_groupNode,
_numberOfNodesGroups,
- IOR_Mesh->getGroups(MED_NODE),
+ //IOR_Mesh->getGroups(MED_NODE),
+ &all->groupNode,
(void *) (convertGroup), this);
- MESSAGE("");
convertCorbaArray<SALOME_MED::GROUP_ptr>
(_groupEdge,
_numberOfEdgesGroups,
- IOR_Mesh->getGroups(MED_EDGE),
+ //IOR_Mesh->getGroups(MED_EDGE),
+ &all->groupEdge,
(void *) (convertGroup), this);
- MESSAGE("");
convertCorbaArray<SALOME_MED::GROUP_ptr>
(_groupFace,
_numberOfFacesGroups,
- IOR_Mesh->getGroups(MED_FACE),
+ //IOR_Mesh->getGroups(MED_FACE),
+ &all->groupFace,
(void *) (convertGroup), this);
- MESSAGE("");
convertCorbaArray<SALOME_MED::GROUP_ptr>
(_groupCell,
_numberOfCellsGroups,
- IOR_Mesh->getGroups(MED_CELL),
+ //IOR_Mesh->getGroups(MED_CELL),
+ &all->groupCell,
(void *) (convertGroup), this);
- MESSAGE("");
_complete = false;
END_OF("MESHClient::blankCopy()");
}
+//=============================================================================
+/*!
+ * Remplit les informations sur les coordonnees et la connectivite
+ */
+//=============================================================================
void MESHClient::fillCopy()
{
END_OF("MESHClient::fillCopy()");
}
+//=============================================================================
+/*!
+ * Destructeur
+ */
+//=============================================================================
MESHClient::~MESHClient()
{
#include "MEDMEM_Mesh.hxx"
#include CORBA_CLIENT_HEADER(MED)
+namespace MEDMEM {
class MESHClient : public MESH {
private :
void fillCopy();
};
+}
#endif
+#include "Utils_CorbaException.hxx"
#include "UtilClient.hxx"
#include "SUPPORTClient.hxx"
#include "MESHClient.hxx"
+using namespace MEDMEM;
+
+//=============================================================================
+/*!
+ * Constructeur
+ */
+//=============================================================================
+
SUPPORTClient::SUPPORTClient(const SALOME_MED::SUPPORT_ptr S,
MESH * M) :
SUPPORT(),
END_OF("SUPPORTClient::SUPPORTClient(SALOME_MED::SUPPORT_ptr m)");
}
-
+//=============================================================================
+/*!
+ * Remplit les informations générales
+ */
+//=============================================================================
void SUPPORTClient::blankCopy()
{
BEGIN_OF("SUPPORTClient::blankCopy");
- setName(IOR_Support->getName());
- setDescription(IOR_Support->getDescription());
- setAll(IOR_Support->isOnAllElements());
- setEntity(IOR_Support->getEntity());
-
- convertCorbaArray(_geometricType, _numberOfGeometricType,
- IOR_Support->getTypes());
-
- int *nE = new int[_numberOfGeometricType];
- int i;
- for (i=0; i<_numberOfGeometricType; i++)
- nE[i] = IOR_Support->getNumberOfElements(_geometricType[i]);
- setNumberOfElements(nE);
- SCRUTE(_totalNumberOfElements);
-
- SCRUTE(_name);
- SCRUTE(_description);
-
- _complete_support = false;
+ try
+ {
+ SALOME_MED::SUPPORT::supportInfos *all = new SALOME_MED::SUPPORT::supportInfos;
+ all= IOR_Support->getSupportGlobal();
+
+ _name = all->name;
+ _description = all->description;
+ setAll(all->isOnAllElements);
+ setEntity(all->entity);
+// modifs PN
+ setNumberOfGeometricType(all->numberOfGeometricType);
+ convertCorbaArray(_geometricType, _numberOfGeometricType,
+ &all->types);
+
+ //_name = IOR_Support->getName();
+ //_description = IOR_Support->getDescription();
+ //setAll(IOR_Support->isOnAllElements());
+ //setEntity(IOR_Support->getEntity());
+
+ SCRUTE(_name);
+ SCRUTE(_description);
+ //convertCorbaArray(_geometricType, _numberOfGeometricType,
+ // IOR_Support->getTypes());
+
+ int *nE = new int[_numberOfGeometricType];
+ int i;
+ for (i=0; i<_numberOfGeometricType; i++)
+ {
+ nE[i] = all->nbEltTypes[i];
+ }
+ setNumberOfElements(nE);
+ SCRUTE(_totalNumberOfElements);
+ _complete_support = false;
+ }
+ catch( const CORBA::Exception &ex )
+ {
+ MESSAGE("Erreur CORBA dans la communication" ) ;
+ THROW_SALOME_CORBA_EXCEPTION("No associated Support", \
+ SALOME::INTERNAL_ERROR);
+ }
END_OF("SUPPORTClient::blankCopy");
}
-
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
void SUPPORTClient::fillCopy()
{
BEGIN_OF("SUPPORTClient::fillCopy");
- int * index, * value;
- long n_index, n_value;
-
- MESSAGE("");
- try {
- convertCorbaArray(value, n_value,
- IOR_Support->getNumber(MED_ALL_ELEMENTS));
- }
- catch (...) {
- std::cerr << "erreur ...." << std::endl;
- exit(-1);
- }
+ if (!_complete_support) {
- SCRUTE(n_value);
- SCRUTE(value[0]);
- SCRUTE(value[1]);
- MESSAGE("");
+ int * index, * value;
+ long n_index, n_value;
- try {
+ convertCorbaArray(value, n_value,
+ IOR_Support->getNumber(MED_ALL_ELEMENTS));
convertCorbaArray(index, n_index,
IOR_Support->getNumberIndex());
+
+ SCRUTE(n_index);
+ SCRUTE(n_value);
+ setNumber(index, value);
+
+ delete [] index;
+ delete [] value;
+
+ _complete_support = true;
}
- catch (...) {
- std::cerr << "erreur ...." << std::endl;
- exit(-1);
- }
-
- SCRUTE(n_index);
- SCRUTE(n_value);
- setNumber(index, value);
-
- delete [] index;
- delete [] value;
-
- _complete_support = true;
END_OF("SUPPORTClient::fillCopy");
}
-
-
+//=============================================================================
+/*!
+ * Destructeur
+ */
+//=============================================================================
SUPPORTClient::~SUPPORTClient()
{
BEGIN_OF("SUPPORTClient::~SUPPORTClient");
END_OF("SUPPORTClient::~SUPPORTClient");
}
+//=============================================================================
+/*!
+ * Destructeur
+ */
+//=============================================================================
MEDSKYLINEARRAY * SUPPORTClient::getnumber() const throw (MEDEXCEPTION)
{
BEGIN_OF("SUPPORTClient::getnumber()");
return m;
}
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
const int * SUPPORTClient::getNumber(medGeometryElement GeometricType)
const throw (MEDEXCEPTION)
{
return n;
}
+//=============================================================================
+/*!
+ *
+ */
+//=============================================================================
const int * SUPPORTClient::getNumberIndex() const throw (MEDEXCEPTION)
{
BEGIN_OF("SUPPORTClient::getnumberIndex()");
#include CORBA_CLIENT_HEADER(MED)
+namespace MEDMEM {
class SUPPORTClient : virtual public SUPPORT {
private :
const throw (MEDEXCEPTION);
};
+}
#endif
#include <vector>
#include <utilities.h>
+namespace MEDMEM {
template <typename TLocal,
typename TCorbaSeq,
typename Tint>
}
}
+}
#endif
+++ /dev/null
-<?xml version='1.0' encoding='us-ascii' ?>
-
-<!-- XML component catalog -->
-<begin-catalog>
-
-<!-- Path prefix information -->
-
-<path-prefix-list>
-</path-prefix-list>
-
-<!-- Component list -->
-<component-list>
- <component>
- <!-- Component identification -->
- <component-name>Compo1Py</component-name>
- <component-type>Solver</component-type>
- <component-author>RASCLE</component-author>
- <component-version> 1.0</component-version>
- <component-comment>Essai Aster</component-comment>
- <component-multistudy>1</component-multistudy>
- <component-icone>ModuleASTER.png</component-icone>
- <constraint>hostname = localhost</constraint>
- </component>
-</component-list>
-</begin-catalog>
top_srcdir=@top_srcdir@
top_builddir=../../../..
srcdir=@srcdir@
-VPATH=.:@srcdir@:@top_srcdir@/bin:@top_srcdir@/resources:@top_builddir@/bin:@top_srcdir@/idl:${KERNEL_ROOT_DIR}/idl/salome
+VPATH=.:@srcdir@:@top_srcdir@/bin:@top_srcdir@/resources:@srcdir@/resources:@top_srcdir@/idl:${KERNEL_ROOT_DIR}/idl/salome
@COMMENCE@
LDFLAGS+=
+# copy python scripts in $(top_builddir)/bin/salome
+#
+DEST_PYSCRIPTS = $(EXPORT_PYSCRIPTS:%=$(top_builddir)/bin/salome/%)
+pyscripts: $(DEST_PYSCRIPTS)
+$(DEST_PYSCRIPTS): $(top_builddir)/bin/salome/%: %
+ cp -f $< $@
+
+# Install python script in $(bindir)
+install-python: $(bindir) $(EXPORT_PYSCRIPTS:%=install-%)
+
+$(EXPORT_PYSCRIPTS:%=install-%): install-%: %
+ $(INSTALL_PROGRAM) $< $(bindir)/.
@MODULE@
+bin: pyscripts
+
+install: install-python
--- /dev/null
+<?xml version='1.0' encoding='us-ascii' ?>
+
+<!-- XML component catalog -->
+<begin-catalog>
+
+<!-- Path prefix information -->
+
+<path-prefix-list>
+</path-prefix-list>
+
+<!-- Component list -->
+<component-list>
+ <component>
+ <!-- Component identification -->
+ <component-name>Compo1Py</component-name>
+ <component-type>Solver</component-type>
+ <component-author>RASCLE</component-author>
+ <component-version> 1.0</component-version>
+ <component-comment>Essai Aster</component-comment>
+ <component-multistudy>1</component-multistudy>
+ <component-icone>ModuleASTER.png</component-icone>
+ <constraint>hostname = localhost</constraint>
+ </component>
+</component-list>
+</begin-catalog>
LIB_CLIENT_IDL= SALOME_Component.idl SALOMEDS.idl SALOMEDS_Attributes.idl SALOME_Exception.idl MED.idl
CPPFLAGS += ${MED2_INCLUDES} ${HDF5_INCLUDES} ${PYTHON_INCLUDES} -I${KERNEL_ROOT_DIR}/include/salome
-LIBS = -L${KERNEL_ROOT_DIR}/lib/salome -lMEDClientcmodule -lMEDMEM_Swigcmodule -lMEDImpl -lmedmem ${MED2_LIBS} ${HDF5_LIBS}
+LIBS = -L${KERNEL_ROOT_DIR}/lib/salome -lMEDClientcmodule -lMEDMEM_Swigcmodule -lmedmem -lMEDMEMImpl ${MED2_LIBS} ${HDF5_LIBS}
# Executables targets
CXXFLAGS=-g -D_DEBUG_ -D__x86__ -D__linux__
CXXFLAGS+=-ftemplate-depth-42 -I${KERNEL_ROOT_DIR}/include/salome
LIBS= $(PYTHON_LIBS)
-LDFLAGS+= -lMEDImpl -lMEDMEM_Swigcmodule -L${KERNEL_ROOT_DIR}/lib/salome
+LDFLAGS+=$(MED2_LIBS) $(HDF5_LIBS) -lMEDMEMImpl -lmedmem -lMEDMEM_Swigcmodule -L${KERNEL_ROOT_DIR}/lib/salome -lSalomeLoggerServer -L${KERNEL_ROOT_DIR}/lib/salome
#############################################################################
from random import *
+import os
+
+filePath=os.environ["MED_ROOT_DIR"]
+filePath=filePath+"/share/salome/resources/"
+
#==============================================================================
def AnalyzeField(field):
print ""
#medFile = "carre_en_quad4_seg2.med"
-medFile = "cube_hexa8_quad4.med"
+medFile = filePath + "cube_hexa8_quad4.med"
print "Loading of the Med Component"
print ""
%include "libMEDMEM_Swig.i"
%{
-#include "convert.hxx"
-#include "Family_i.hxx"
-#include "FieldDouble_i.hxx"
-#include "Field_i.hxx"
-#include "FieldInt_i.hxx"
-#include "FieldOf_i.hxx"
-#include "Group_i.hxx"
-#include "Med_i.hxx"
-#include "Mesh_i.hxx"
-#include "Support_i.hxx"
+#include "MEDMEM_convert.hxx"
+#include "MEDMEM_Family_i.hxx"
+#include "MEDMEM_FieldDouble_i.hxx"
+#include "MEDMEM_Field_i.hxx"
+#include "MEDMEM_FieldInt_i.hxx"
+#include "MEDMEM_FieldOf_i.hxx"
+#include "MEDMEM_Group_i.hxx"
+#include "MEDMEM_Med_i.hxx"
+#include "MEDMEM_Mesh_i.hxx"
+#include "MEDMEM_Support_i.hxx"
#include "MEDMEM_SWIG_FieldDouble.hxx"
#include "MEDMEM_SWIG_FieldInt.hxx"
%}
from random import *
+import os
+
+filePath=os.environ["MED_ROOT_DIR"]
+filePath=filePath+"/share/salome/resources/"
+
#==============================================================================
def AnalyzeField(field):
print ""
#medFile = "carre_en_quad4_seg2.med"
-medFile = "cube_hexa8_quad4.med"
+medFile = filePath + "cube_hexa8_quad4.med"
print "Loading of the Med Component"
print ""
+++ /dev/null
-//=============================================================================
-// File : Family_i.cxx
-// Project : SALOME
-// Copyright : EDF 2002
-// Author : EDF
-// $Header: /export/home/CVS/SALOME_ROOT/MED/src/MedMem/Family_i.cxx
-//=============================================================================
-
-#include "utilities.h"
-#include "Family_i.hxx"
-#include "Utils_CorbaException.hxx"
-#include "MEDMEM_Family.hxx"
-
-//=============================================================================
-/*!
- * Default constructor
- */
-//=============================================================================
-FAMILY_i::FAMILY_i(): _family((::FAMILY*)NULL),
- SUPPORT_i()
-{
- BEGIN_OF("Default Constructor FAMILY_i");
- END_OF("Default Constructor FAMILY_i");
-}
-//=============================================================================
-/*!
- * Copy Constructor
- */
-//=============================================================================
-FAMILY_i::FAMILY_i(const FAMILY_i & f): _family(f._family),
- SUPPORT_i(f._family)
-{
- BEGIN_OF("Default Constructor FAMILY_i");
- END_OF("Default Constructor FAMILY_i");
-}
-//=============================================================================
-/*!
- * Destructor
- */
-//=============================================================================
-FAMILY_i::~FAMILY_i()
-{
-}
-//=============================================================================
-/*!
- * Constructor
- */
-//=============================================================================
-FAMILY_i::FAMILY_i(const ::FAMILY * const f): _family(f),
- SUPPORT_i(f)
-{
- BEGIN_OF("Constructor FAMILY_i");
- END_OF("Constructor FAMILY_i");
-}
-//=============================================================================
-/*!
- * CORBA: Accessor for Family's Identifier
- */
-//=============================================================================
-
-CORBA::Long FAMILY_i::getIdentifier()
-throw (SALOME::SALOME_Exception)
-{
- if (_family==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
- SALOME::INTERNAL_ERROR);
- try
- {
- return _family->getIdentifier();
- }
- catch(...)
- {
- MESSAGE("Unable to acces Family Identifier");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Family C++ Object"
- ,SALOME::INTERNAL_ERROR);
- }
-
-}
-//=============================================================================
-/*!
- * CORBA: Accessor for number of attributes
- */
-//=============================================================================
-CORBA::Long FAMILY_i::getNumberOfAttributes()
-throw (SALOME::SALOME_Exception)
-{
- if (_family==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
- SALOME::INTERNAL_ERROR);
- try
- {
- return _family->getNumberOfAttributes();
- }
- catch(...)
- {
- MESSAGE("Unable to get number of attributes");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Family C++ Object"
- ,SALOME::INTERNAL_ERROR);
- }
-}
-//=============================================================================
-/*!
- * CORBA: Accessor for attributes identifiers
- */
-//=============================================================================
-Engines::long_array* FAMILY_i::getAttributesIdentifiers()
-throw (SALOME::SALOME_Exception)
-{
- if (_family==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
- SALOME::INTERNAL_ERROR);
- Engines::long_array_var myseq= new Engines::long_array;
- try
- {
- int nbAttribute=_family->getNumberOfAttributes();
- myseq->length(nbAttribute);
- int * identifiers=_family->getAttributesIdentifiers();
- for (int i=0;i<nbAttribute;i++)
- {
- myseq[i]=identifiers[i];
- }
- }
- catch(...)
- {
- MESSAGE("Unable to acces Family Identifiers");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Family C++ Object"\
- ,SALOME::INTERNAL_ERROR);
- }
- return myseq._retn();
-}
-//=============================================================================
-/*!
- * CORBA: Accessor for attribute identifier I
- */
-//=============================================================================
-CORBA::Long FAMILY_i::getAttributeIdentifier(CORBA::Long i)
-throw (SALOME::SALOME_Exception)
-{
- if (_family==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
- SALOME::INTERNAL_ERROR);
- try
- {
- return _family->getAttributeIdentifier(i);
- }
- catch(...)
- {
- MESSAGE("Unable to acces Family Identifier");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Family C++ Object"\
- ,SALOME::INTERNAL_ERROR);
- }
-
-}
-//=============================================================================
-/*!
- * CORBA: Accessor for attributes values
- */
-//=============================================================================
-Engines::long_array* FAMILY_i::getAttributesValues()
-throw (SALOME::SALOME_Exception)
-{
- if (_family==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
- SALOME::INTERNAL_ERROR);
- Engines::long_array_var myseq= new Engines::long_array;
- try
- {
- int nbAttribute=_family->getNumberOfAttributes();
- myseq->length(nbAttribute);
- int * values=_family->getAttributesValues();
- for (int i=0;i<nbAttribute;i++)
- {
- myseq[i]=values[i];
- }
- }
- catch(...)
- {
- MESSAGE("Unable to acces attributs values");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Family C++ Object"
- ,SALOME::INTERNAL_ERROR);
- }
- return myseq._retn();
-}
-//=============================================================================
-/*!
- * CORBA: Accessor for attribute value I
- */
-//=============================================================================
-CORBA::Long FAMILY_i::getAttributeValue(CORBA::Long i)
-throw (SALOME::SALOME_Exception)
-{
- if (_family==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
- SALOME::INTERNAL_ERROR);
- try
- {
- return _family->getAttributeValue(i);
- }
- catch(...)
- {
- MESSAGE("Unable to acces specified attribut value");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Family C++ Object"\
- ,SALOME::INTERNAL_ERROR);
- }
-}
-//=============================================================================
-/*!
- * CORBA: Accessor for attributes desriptions
- */
-//=============================================================================
-Engines::string_array * FAMILY_i::getAttributesDescriptions()
-throw (SALOME::SALOME_Exception)
-{
- if (_family==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
- SALOME::INTERNAL_ERROR);
-
- Engines::string_array_var myseq = new Engines::string_array;
- try
- {
- int nbAttribute=_family->getNumberOfAttributes();
- myseq->length(nbAttribute);
- string * descattribute=_family->getAttributesDescriptions();
- for (int i=0;i<nbAttribute;i++)
- {
- myseq[i]=CORBA::string_dup(descattribute[i].c_str());
- }
- }
- catch(...)
- {
- MESSAGE("Unable to acces attributs descriptions");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Family C++ Object"\
- ,SALOME::INTERNAL_ERROR);
- }
- return myseq._retn();
-
-}
-//=============================================================================
-/*!
- * CORBA: Accessor for attribute description i
- */
-//=============================================================================
-char * FAMILY_i::getAttributeDescription( CORBA::Long i)
-throw (SALOME::SALOME_Exception)
-{
- if (_family==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Family",\
- SALOME::INTERNAL_ERROR);
- try
- {
- return CORBA::string_dup(_family->getAttributeDescription(i).c_str());
- }
- catch(...)
- {
- MESSAGE("Unable to acces specified attribut description");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Family C++ Object"\
- ,SALOME::INTERNAL_ERROR);
- }
-}
-
+++ /dev/null
-//=============================================================================
-// File : Family_i.hxx
-// Project : SALOME
-// Copyright : EDF 2002
-// Author : EDF
-// $Header: /export/home/CVS/SALOME_ROOT/MED/src/MedMem/Family_i.hxx
-//=============================================================================
-#ifndef MED_FAMILY_I_HXX_
-#define MED_FAMILY_I_HXX_
-
-
-#include "Support_i.hxx"
-
-class FAMILY;
-class FAMILY_i:
- public POA_SALOME_MED::FAMILY,
- public SUPPORT_i
-{
-protected :
- FAMILY_i();
- ~FAMILY_i();
-
- // C++ object containing values
- const ::FAMILY * const _family ;
-
-public :
- // Constructors and associated internal methods
- FAMILY_i(const ::FAMILY * const f);
- FAMILY_i(const FAMILY_i & f);
-
- CORBA::Long getIdentifier()
- throw (SALOME::SALOME_Exception);
- CORBA::Long getNumberOfAttributes()
- throw (SALOME::SALOME_Exception);
- Engines::long_array* getAttributesIdentifiers()
- throw (SALOME::SALOME_Exception);
- CORBA::Long getAttributeIdentifier(CORBA::Long i)
- throw (SALOME::SALOME_Exception);
- Engines::long_array* getAttributesValues()
- throw (SALOME::SALOME_Exception);
- CORBA::Long getAttributeValue(CORBA::Long i)
- throw (SALOME::SALOME_Exception);
- Engines::string_array* getAttributesDescriptions()
- throw (SALOME::SALOME_Exception);
- char* getAttributeDescription( CORBA::Long i)
- throw (SALOME::SALOME_Exception);
-
-};
-#endif /* MED_FAMILY_I_HXX_ */
+++ /dev/null
-//=============================================================================
-// File : Fielddouble_i.hxx
-// Project : SALOME
-// Author : EDF
-// Copyright : EDF 2002
-// $Header: /export/home/CVS/SALOME_ROOT/MED/src/MedMem/Fielddouble_i.hxx
-//=============================================================================
-
-#include "FieldDouble_i.hxx"
-#include "utilities.h"
-#include "convert.hxx"
-
-//=============================================================================
-/*!
- * Default constructor
- */
-//=============================================================================
-FIELDDOUBLE_i::FIELDDOUBLE_i(): FIELDOF_i<double>()
-{
- BEGIN_OF("Default Constructor FIELDDOUBLE_i");
- END_OF("Default Constructor FIELDDOUBLE_i");
-}
-//=============================================================================
-/*!
- * Destructor
- */
-//=============================================================================
-FIELDDOUBLE_i::~FIELDDOUBLE_i()
-{
- BEGIN_OF("Default Destructor FIELDDOUBLE_i");
- END_OF("Default Destructor FIELDDOUBLE_i");
-}
-//=============================================================================
-/*!
- * Constructor par recopie
- */
-//=============================================================================
-FIELDDOUBLE_i::FIELDDOUBLE_i(FIELDDOUBLE_i & fd):
- FIELDOF_i<double>(fd._fieldTptr)
-{
- BEGIN_OF("Default Constructor FIELDDOUBLE_i");
- END_OF("Default Constructor FIELDDOUBLE_i");
-}
-//=============================================================================
-/*!
- * Default constructor
- */
-//=============================================================================
-FIELDDOUBLE_i::FIELDDOUBLE_i(SALOME_MED::SUPPORT_ptr mySupportIOR,::FIELD<double> * const f): FIELDOF_i<double>(mySupportIOR,f)
-{
- BEGIN_OF("Constructor FIELDDOUBLE_i");
- END_OF(" Constructor FIELDDOUBLE_i");
-}
-
-//=============================================================================
-/*!
- * CORBA: Accessor for Field's values
-*/
-//=============================================================================
-
-Engines::double_array* FIELDDOUBLE_i::getValue( SALOME_MED::medModeSwitch mode )
-throw (SALOME::SALOME_Exception)
-{
- if (_fieldTptr==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
- SALOME::INTERNAL_ERROR);
- Engines::double_array_var myseq = new Engines::double_array;
- try
- {
- int nbval=_fieldTptr->getNumberOfComponents();
-
- // Ajout NB pour avoir la valeur correct de nbval
- SALOME_MED::medEntityMesh entity = _support->getEntity();
- if (_support->isOnAllElements())
- {
- if (entity == SALOME_MED::MED_NODE)
- nbval = (_support->getMesh()->getNumberOfNodes())*nbval;
- else
- nbval = (_support->getMesh()->getNumberOfElements(entity,SALOME_MED::MED_ALL_ELEMENTS))*nbval;
- }
- else
- {
- nbval = (_support->getNumberOfElements(SALOME_MED::MED_ALL_ELEMENTS))*nbval;
- }
-
- medModeSwitch modemed=convertIdlModeToMedMode(mode);
- const double * values =_fieldTptr->getValue(modemed);
-
- myseq->length(nbval);
- for (int i=0; i<nbval; i++)
- {
- myseq[i]=values[i];
- };
- }
- catch(...)
- {
- MESSAGE("Unable to acces Field ");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Field C++ Object"\
- ,SALOME::INTERNAL_ERROR);
- }
- return myseq._retn();
-}
+++ /dev/null
-//=============================================================================
-// File : Fielddouble_i.hxx
-// Project : SALOME
-// Author : EDF
-// Copyright : EDF 2002
-// $Header: /export/home/CVS/SALOME_ROOT/MED/src/MedMem/Fielddouble_i.hxx
-//=============================================================================
-
-#ifndef MED_FIELDDOUBLE_I_HXX_
-#define MED_FIELDDOUBLE_I_HXX_
-
-#include <SALOMEconfig.h>
-
-#include CORBA_SERVER_HEADER(MED)
-
-#include "Field_i.hxx"
-#include "FieldOf_i.hxx"
-
-#include "MEDMEM_Field.hxx"
-
-class FIELDDOUBLE_i: public FIELDOF_i<double>
-{
-private:
-
-public:
- FIELDDOUBLE_i();
- ~FIELDDOUBLE_i();
- FIELDDOUBLE_i(SALOME_MED::SUPPORT_ptr mySupportIOR,::FIELD<double> * const f);
- FIELDDOUBLE_i(FIELDDOUBLE_i & f);
-
- Engines::double_array * getValue (SALOME_MED::medModeSwitch mode )
- throw (SALOME::SALOME_Exception);
-};
-
-
-#endif /* MED_FIELDDOUBLE_I_HXX_ */
+++ /dev/null
-//=============================================================================
-// File : Fieldint_i.hxx
-// Project : SALOME
-// Author : EDF
-// Copyright : EDF 2002
-// $Header: /export/home/CVS/SALOME_ROOT/MED/src/MedMem/Fieldint_i.hxx
-//=============================================================================
-
-#include "FieldInt_i.hxx"
-#include "utilities.h"
-#include "convert.hxx"
-
-//=============================================================================
-/*!
- * Default constructor
- */
-//=============================================================================
-FIELDINT_i::FIELDINT_i(): FIELDOF_i<int>()
-{
- BEGIN_OF("Default Constructor FIELDINT_i");
- END_OF("Default Constructor FIELDINT_i");
-}
-//=============================================================================
-/*!
- * Destructor
- */
-//=============================================================================
-FIELDINT_i::~FIELDINT_i()
-{
- BEGIN_OF("Default Destructor FIELDINT_i");
- END_OF("Default Destructor FIELDINT_i");
-}
-//=============================================================================
-/*!
- * Default constructor
- */
-//=============================================================================
-FIELDINT_i::FIELDINT_i(SALOME_MED::SUPPORT_ptr mySupportIOR, ::FIELD<int> * const f): FIELDOF_i<int>(mySupportIOR,f)
-{
- BEGIN_OF("Constructor FIELDINT_i");
- END_OF(" Constructor FIELDINT_i");
-}
-//=============================================================================
-/*!
- * Constructor par recopie
- */
-//=============================================================================
-FIELDINT_i::FIELDINT_i(FIELDINT_i &fi):
- FIELDOF_i<int>(fi._fieldTptr)
-{
- BEGIN_OF("Constructor FIELDINT_i");
- END_OF(" Constructor FIELDINT_i");
-}
-
-//=============================================================================
-/*!
- * CORBA: Accessor for Field's values
-*/
-//=============================================================================
-
-Engines::long_array* FIELDINT_i::getValue( SALOME_MED::medModeSwitch mode )
-throw (SALOME::SALOME_Exception)
-{
- if (_fieldTptr==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
- SALOME::INTERNAL_ERROR);
- Engines::long_array_var myseq = new Engines::long_array;
- try
- {
- int nbval=_fieldTptr->getNumberOfComponents();
-
- // Ajout NB pour avoir la valeur correct de nbval
- SALOME_MED::medEntityMesh entity = _support->getEntity();
- if (_support->isOnAllElements())
- {
- if (entity == SALOME_MED::MED_NODE)
- nbval = (_support->getMesh()->getNumberOfNodes())*nbval;
- else
- nbval = (_support->getMesh()->getNumberOfElements(entity,SALOME_MED::MED_ALL_ELEMENTS))*nbval;
- }
- else
- {
- nbval = (_support->getNumberOfElements(SALOME_MED::MED_ALL_ELEMENTS))*nbval;
- }
-
- medModeSwitch modemed=convertIdlModeToMedMode(mode);
- const int * values =_fieldTptr->getValue(modemed);
-
- myseq->length(nbval);
- for (int i=0; i<nbval; i++)
- {
- myseq[i]=values[i];
- };
- }
- catch(...)
- {
- MESSAGE("Unable to acces Field");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Field C++ Object"\
- ,SALOME::INTERNAL_ERROR);
- }
- return myseq._retn();
-}
+++ /dev/null
-//=============================================================================
-// File : FieldInt_i.hxx
-// Project : SALOME
-// Author : EDF
-// Copyright : EDF 2002
-// $Header: /export/home/CVS/SALOME_ROOT/MED/src/MedMem/FieldInt_i.hxx
-//=============================================================================
-
-#ifndef MED_FIELDINT_I_HXX_
-#define MED_FIELDINT_I_HXX_
-
-#include <SALOMEconfig.h>
-
-#include CORBA_SERVER_HEADER(MED)
-
-#include "Field_i.hxx"
-#include "FieldOf_i.hxx"
-
-#include "MEDMEM_Field.hxx"
-
-class FIELDINT_i: public FIELDOF_i<int>
-{
-private:
- FIELDINT_i();
-
-public:
- ~FIELDINT_i();
- FIELDINT_i(SALOME_MED::SUPPORT_ptr mySupportIOR, ::FIELD<int> * const f);
- FIELDINT_i(FIELDINT_i & f);
- Engines::long_array * getValue (SALOME_MED::medModeSwitch mode )
- throw (SALOME::SALOME_Exception);
-};
-#endif /* MED_FIELDINT_I_HXX_ */
+++ /dev/null
-//=============================================================================
-// File : FieldOf_i.hxx
-// Project : SALOME
-// Author : EDF
-// Copyright : EDF 2002
-// $Header: /export/home/CVS/SALOME_ROOT/MED/src/MedMem/FieldOf_i.hxx
-//=============================================================================
-
-
-#ifndef MED_FIELDOF_I_HXX_
-#define MED_FIELDOF_I_HXX_
-
-#include <map>
-#include <string>
-# include <sstream>
-
-#include <SALOMEconfig.h>
-
-# include "Utils_ORB_INIT.hxx"
-# include "Utils_SINGLETON.hxx"
-
-#include CORBA_SERVER_HEADER(MED)
-#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
-
-#include "Field_i.hxx"
-#include "Support_i.hxx"
-
-#include "convert.hxx"
-
-#include "MEDMEM_Support.hxx"
-#include "MEDMEM_Field.hxx"
-
-template <class T> class FIELDOF_i: public FIELD_i
-{
-public :
- static map < int, ::FIELD<T> * > fieldMap ;
-protected :
- static int fieldIndex ;
-
-protected :
- // C++ object containing values
-
- ::FIELD<T> * const _fieldTptr;
- const int _corbaIndex;
- string _FieldId;
-
- // CORBA : SUPPORT IOR
- const SALOME_MED::SUPPORT_ptr _support ;
-
-
-public :
- // Constructors and associated internal methods
- FIELDOF_i();
- FIELDOF_i(SALOME_MED::SUPPORT_ptr support,::FIELD<T> * const field);
- FIELDOF_i(::FIELD<T> * const f);
- FIELDOF_i(FIELDOF_i & f);
- ~FIELDOF_i();
-
- char * getName() throw (SALOME::SALOME_Exception);
- char * getDescription() throw (SALOME::SALOME_Exception);
- SALOME_MED::SUPPORT_ptr getSupport() throw (SALOME::SALOME_Exception);
- CORBA::Long getNumberOfComponents()
- throw (SALOME::SALOME_Exception);
- char * getComponentName(CORBA::Long i)
- throw (SALOME::SALOME_Exception);
- char * getComponentUnit(CORBA::Long i)
- throw (SALOME::SALOME_Exception);
- CORBA::Long getIterationNumber()
- throw (SALOME::SALOME_Exception);
- CORBA::Long getOrderNumber() throw (SALOME::SALOME_Exception);
- CORBA::Double getTime() throw (SALOME::SALOME_Exception);
- CORBA::Long getCorbaIndex() throw (SALOME::SALOME_Exception);
-
- Engines::string_array * getComponentsNames() throw (SALOME::SALOME_Exception);
- Engines::string_array * getComponentsUnits() throw (SALOME::SALOME_Exception);
- void addInStudy(SALOMEDS::Study_ptr myStudy,
- SALOME_MED::FIELD_ptr myIor) throw (SALOME::SALOME_Exception);
-
- CORBA::Long addDriver (SALOME_MED::medDriverTypes driverType,
- const char* fileName, const char* fieldName)
- throw (SALOME::SALOME_Exception);
- void rmDriver (CORBA::Long i) throw (SALOME::SALOME_Exception);
- void read (CORBA::Long i) throw (SALOME::SALOME_Exception);
- void write (CORBA::Long i, const char* driverFieldName)
- throw (SALOME::SALOME_Exception);
-
- // Cuisine Interne
- ::FIELD<T> * constructConstField() const;
-
- };
-template <class T> map < int, ::FIELD<T> * > FIELDOF_i<T>::fieldMap ;
-template <class T> int FIELDOF_i<T>::fieldIndex = 0;
-//=============================================================================
-/*!
- * Default constructor
- */
-//=============================================================================
-
-//template <class T> FIELDOF_i<T>::FIELDOF_i():_fieldTptr(FIELDOF_i<T>::constructConstField())
-template <class T> FIELDOF_i<T>::FIELDOF_i():_fieldTptr(constructConstField()),
- _support((SALOME_MED::SUPPORT_ptr) NULL)
-{
- BEGIN_OF("Default Constructor Field_i");
- END_OF(" Default Constructor Field_i");
-}
-//=============================================================================
-/*!
- * Destructor
- */
-//=============================================================================
-template <class T> FIELDOF_i<T>::~FIELDOF_i()
-{
-}
-//=============================================================================
-/*!
- * Constructor
- */
-//=============================================================================
-template <class T> FIELDOF_i<T>::FIELDOF_i(SALOME_MED::SUPPORT_ptr support,::FIELD<T> * const field):
- _fieldTptr(field),
- _corbaIndex(FIELDOF_i<T>::fieldIndex++),
- _FieldId(""),
- _support(SALOME_MED::SUPPORT::_duplicate(support))
-{
- BEGIN_OF("Constructor FIELDOF_i(SALOME_MED::SUPPORT_ptr support,::FIELD<T> * const field)");
- FIELDOF_i<T>::fieldMap[_corbaIndex]=_fieldTptr;
-
- MESSAGE("FIELDOF_i<T>::FIELDOF_i Checking of pointeurs !!!");
-
- SCRUTE(_fieldTptr);
- SCRUTE(_support);
- SCRUTE(_support->getMesh());
-
- END_OF("Constructor FIELDOF_i(SALOME_MED::SUPPORT_ptr support,::FIELD<T> * const field)");
-}
-
-
-template <class T> FIELDOF_i<T>::FIELDOF_i( FIELD<T> * const f):
- _fieldTptr(f),
- _corbaIndex(FIELDOF_i<T>::fieldIndex++),
- _FieldId(""),
- _support((SALOME_MED::SUPPORT_ptr) NULL)
-{
- BEGIN_OF("Constructor Field_i");
- FIELDOF_i<T>::fieldMap[_corbaIndex]=_fieldTptr;
- END_OF("Constructor Field_i");
-}
-//=============================================================================
-/*!
- * Constructor par recopie
- */
-//=============================================================================
-template <class T> FIELDOF_i<T>::FIELDOF_i( FIELDOF_i & f):_fieldTptr(f._fieldTptr),
- _corbaIndex(FIELDOF_i<T>::fieldIndex++),
- _FieldId("")
-{
- BEGIN_OF("Constructor Field_i");
- FIELDOF_i<T>::fieldMap[_corbaIndex]=_fieldTptr;
- END_OF("Constructor Field_i");
-}
-//=============================================================================
-/*!
- * Constructor d un pointeur constant
- */
-//=============================================================================
-template <class T> ::FIELD<T> * FIELDOF_i<T>::constructConstField() const
-{
- ::FIELD<T> * const ptrField =new ::FIELD<T>();
- return ptrField;
-}
-//=============================================================================
-/*!
- * CORBA: Accessor for Fields's Name
- */
-//=============================================================================
-template <class T> char * FIELDOF_i<T>::getName()
-throw (SALOME::SALOME_Exception)
-{
- if (_fieldTptr==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
- SALOME::INTERNAL_ERROR);
- try
- {
- return CORBA::string_dup(_fieldTptr->getName().c_str());
- }
- catch(...)
- {
- MESSAGE("Exception en accedant au nom");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Field C++ Object"\
- ,SALOME::INTERNAL_ERROR);
- }
-}
-//=============================================================================
-/*!
- * CORBA: Accessor for Fields's Description
- */
-//=============================================================================
-template <class T> char * FIELDOF_i<T>::getDescription()
-throw (SALOME::SALOME_Exception)
-{
- if (_fieldTptr==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
- SALOME::INTERNAL_ERROR);
- try
- {
- return CORBA::string_dup(_fieldTptr->getDescription().c_str());
- }
- catch(...)
- {
- MESSAGE("Exception en accedant a la description");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Field C++ Object"\
- ,SALOME::INTERNAL_ERROR);
- }
-}
-//=============================================================================
-/*!
- * CORBA: Accessor for Fields's Support
- */
-//=============================================================================
-
-template <class T> SALOME_MED::SUPPORT_ptr FIELDOF_i<T>::getSupport()
- throw (SALOME::SALOME_Exception)
-{
- BEGIN_OF("SALOME_MED::SUPPORT_ptr FIELDOF_i<T>::getSupport()");
-
- if (_fieldTptr==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Field",
- SALOME::INTERNAL_ERROR);
- if (_support==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No Support in Field",
- SALOME::INTERNAL_ERROR);
-
- SCRUTE(_fieldTptr);
-
- SCRUTE(_support);
-
- SALOME_MED::SUPPORT_ptr support = SALOME_MED::SUPPORT::_duplicate(_support);
-
- END_OF("SALOME_MED::SUPPORT_ptr FIELDOF_i<T>::getSupport()");
-
- return support ;
-}
-//=============================================================================
-/*!
- * CORBA: Accessor for Fields's Number of components
- */
-//=============================================================================
-template <class T> CORBA::Long FIELDOF_i<T>::getNumberOfComponents()
-throw (SALOME::SALOME_Exception)
-{
- if (_fieldTptr==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
- SALOME::INTERNAL_ERROR);
- try
- {
- return _fieldTptr->getNumberOfComponents();
- }
- catch(...)
- {
- MESSAGE("Exception en accedant au support");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Field C++ Object"\
- ,SALOME::INTERNAL_ERROR);
- }
-}
-//=============================================================================
-/*!
- * CORBA: Accessor for names of component I
- */
-//=============================================================================
-template <class T> char * FIELDOF_i<T>::getComponentName(CORBA::Long i)
-throw (SALOME::SALOME_Exception)
-{
- if (_fieldTptr==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
- SALOME::INTERNAL_ERROR);
- try
- {
- return CORBA::string_dup(_fieldTptr->getComponentName(i).c_str());
- }
- catch(...)
- {
- MESSAGE("Exception en accedant au nom d un component");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Field C++ Object"\
- ,SALOME::INTERNAL_ERROR);
- }
-}
-//=============================================================================
-/*!
- * CORBA: Accessor for unit of component I
- */
-//=============================================================================
-template <class T> char * FIELDOF_i<T>::getComponentUnit(CORBA::Long i)
-throw (SALOME::SALOME_Exception)
-{
- if (_fieldTptr==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
- SALOME::INTERNAL_ERROR);
- try
- {
- return CORBA::string_dup(_fieldTptr->getMEDComponentUnit(i).c_str());
- }
- catch(...)
- {
- MESSAGE("Exception en accedant au nom d un component");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Field C++ Object"\
- ,SALOME::INTERNAL_ERROR);
- }
-}
-//=============================================================================
-/*!
- * CORBA: Accessor for iteration number
- */
-//=============================================================================
-template <class T> CORBA::Long FIELDOF_i<T>::getIterationNumber()
-throw (SALOME::SALOME_Exception)
-{
- if (_fieldTptr==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
- SALOME::INTERNAL_ERROR);
- try
- {
- return _fieldTptr->getIterationNumber();
- }
- catch(...)
- {
- MESSAGE("Exception en accedant au champ");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Field C++ Object"\
- ,SALOME::INTERNAL_ERROR);
- }
-}
-//=============================================================================
-/*!
- * CORBA: Accessor for Corba Number
- */
-//=============================================================================
-template <class T> CORBA::Long FIELDOF_i<T>::getCorbaIndex()
-throw (SALOME::SALOME_Exception)
-{
- if (_fieldTptr==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
- SALOME::INTERNAL_ERROR);
- return _corbaIndex;
-
-}
-//=============================================================================
-/*!
- * CORBA: Accessor for iteration number
- */
-//=============================================================================
-template <class T> CORBA::Long FIELDOF_i<T>::getOrderNumber()
-throw (SALOME::SALOME_Exception)
-{
- if (_fieldTptr==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
- SALOME::INTERNAL_ERROR);
- try
- {
- return _fieldTptr->getOrderNumber();
- }
- catch(...)
- {
- MESSAGE("Exception en accedant au champ");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Field C++ Object"\
- ,SALOME::INTERNAL_ERROR);
- }
-}
-//=============================================================================
-/*!
- * CORBA: Accessor
- */
-//=============================================================================
-template <class T> CORBA::Double FIELDOF_i<T>::getTime()
-throw (SALOME::SALOME_Exception)
-{
- if (_fieldTptr==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
- SALOME::INTERNAL_ERROR);
- try
- {
- return _fieldTptr->getTime();
- }
- catch(...)
- {
- MESSAGE("Exception en accedant au champ");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Field C++ Object"\
- ,SALOME::INTERNAL_ERROR);
- }
-}
-//=============================================================================
-/*!
- * CORBA: Accessor for Fields's Components names
- */
-//=============================================================================
-template <class T> Engines::string_array * FIELDOF_i<T>::getComponentsNames()
-throw (SALOME::SALOME_Exception)
-{
- if (_fieldTptr==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
- SALOME::INTERNAL_ERROR);
- Engines::string_array_var myseq = new Engines::string_array;
- try
- {
- int nbcom = _fieldTptr->getNumberOfComponents();
- myseq->length(nbcom);
- const string * namecom=_fieldTptr->getComponentsNames();
- for (int i=0;i<nbcom;i++)
- {
- myseq[i]=CORBA::string_dup(namecom[i].c_str());
- }
- }
- catch(...)
- {
- MESSAGE("Exception en accedant au champ");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Field C++ Object"\
- ,SALOME::INTERNAL_ERROR);
- }
- return myseq._retn();
-}
-//=============================================================================
-/*!
- * CORBA: Accessor for Fields's Components units
- */
-//=============================================================================
-template <class T> Engines::string_array * FIELDOF_i<T>::getComponentsUnits()
-throw (SALOME::SALOME_Exception)
-{
- if (_fieldTptr==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
- SALOME::INTERNAL_ERROR);
- Engines::string_array_var myseq = new Engines::string_array;
- try
- {
- int nbcom = _fieldTptr->getNumberOfComponents();
- myseq->length(nbcom);
- const string * unitcom=_fieldTptr->getMEDComponentsUnits();
- for (int i=0;i<nbcom;i++)
- {
- myseq[i]=CORBA::string_dup(unitcom[i].c_str());
- }
- }
- catch(...)
- {
- MESSAGE("Exception en accedant au champ");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Field C++ Object"\
- ,SALOME::INTERNAL_ERROR);
- }
- return myseq._retn();
-}
-//=============================================================================
-/*!
- * CORBA: Add in Study
- */
-//=============================================================================
-template <class T> void FIELDOF_i<T>::addInStudy(SALOMEDS::Study_ptr myStudy,
- SALOME_MED::FIELD_ptr myIor )
-throw (SALOME::SALOME_Exception)
-{
- BEGIN_OF(" FIELDOF_i::addInStudy");
- if (_fieldTptr==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
- SALOME::INTERNAL_ERROR);
- if ( _FieldId != "" )
- {
- MESSAGE("Field already in Study");
- THROW_SALOME_CORBA_EXCEPTION("Field already in Study", \
- SALOME::BAD_PARAM);
- };
-
-
- SALOMEDS::StudyBuilder_var myBuilder = myStudy->NewBuilder();
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeName_var aName;
- SALOMEDS::AttributeIOR_var aIOR;
-
- // Create SComponent labelled 'Med'
- // SALOMEDS::SComponent_var medfather = myStudy->FindComponent("Med");
- SALOMEDS::SComponent_var medfather = myStudy->FindComponent("MED");
- if ( CORBA::is_nil(medfather) )
- THROW_SALOME_CORBA_EXCEPTION("SComponent labelled 'Med' not Found",SALOME::INTERNAL_ERROR);
-
- // Create SObject labelled 'MEDFIELD' if it doesn't already exit
- SALOMEDS::SObject_var medfieldfather = myStudy->FindObject("MEDFIELD");
- if ( CORBA::is_nil(medfieldfather) )
- {
- MESSAGE("Add Object 'MEDFIELD'");
- medfieldfather = myBuilder->NewObject(medfather);
- anAttr = myBuilder->FindOrCreateAttribute(medfieldfather, "AttributeName");
- aName = SALOMEDS::AttributeName::_narrow(anAttr);
- aName->SetValue("MEDFIELD");
-
- } ;
-
- // Create SObject labelled 'FIELDNAME' if it doesn't already exit
- SALOMEDS::SObject_var medfieldnamefather = myStudy->FindObject((_fieldTptr->getName()).c_str());
- if ( CORBA::is_nil(medfieldnamefather) )
- {
- MESSAGE("Add Object "<<_fieldTptr->getName());
- medfieldnamefather = myBuilder->NewObject(medfieldfather);
- anAttr = myBuilder->FindOrCreateAttribute(medfieldnamefather, "AttributeName");
- aName = SALOMEDS::AttributeName::_narrow(anAttr);
- aName->SetValue((_fieldTptr->getName()).c_str());
-
- } ;
-
- // Create object labelled according to Field's Name
-
- MESSAGE("Add a Field Object under "<<_fieldTptr->getName());
- myBuilder->NewCommand();
- SALOMEDS::SObject_var newObj = myBuilder->NewObject(medfieldnamefather);
-
- ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
- ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting()) ;
- CORBA::ORB_var &orb = init(0,0);
-
- ostringstream iterationName ;
- iterationName<<"("<<_fieldTptr->getIterationNumber()<<","<<_fieldTptr->getOrderNumber()<<")";
- anAttr = myBuilder->FindOrCreateAttribute(newObj, "AttributeName");
- aName = SALOMEDS::AttributeName::_narrow(anAttr);
- aName->SetValue(iterationName.str().c_str());
-
- string iorStr = orb->object_to_string(myIor);
- anAttr = myBuilder->FindOrCreateAttribute(newObj, "AttributeIOR");
- aIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
- aIOR->SetValue(iorStr.c_str());
-
- SALOMEDS::SObject_var supportObject = myStudy->FindObject(_support->getName());
- if ( CORBA::is_nil(supportObject) ) {
- MESSAGE("FIELDOF_i::addInStudy : SUPPORT not found") ;
- } else {
- SALOMEDS::SObject_var newObjSupport = myBuilder->NewObject(newObj);
- myBuilder->Addreference(newObjSupport,supportObject);
- }
- _FieldId = newObj->GetID();
- MESSAGE("FIELDOF_i::addInStudy _FieldId="<< _FieldId);
-
- END_OF(" FIELDOF_i::addInStudy");
-
-}
-//=============================================================================
-/*!
- * CORBA: write
- */
-//=============================================================================
-template <class T> void FIELDOF_i<T>::write (CORBA::Long i, const char* driverFieldName)
-throw (SALOME::SALOME_Exception)
-{
- if (_fieldTptr==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
- SALOME::INTERNAL_ERROR);
- try
- {
- _fieldTptr->write(i,driverFieldName);
- }
- catch(...)
- {
- MESSAGE("Exception en accedant au champ");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Field C++ Object"\
- ,SALOME::INTERNAL_ERROR);
- }
-}
-//=============================================================================
-/*!
- * CORBA: read
- */
-//=============================================================================
-template <class T> void FIELDOF_i<T>::read (CORBA::Long i)
-throw (SALOME::SALOME_Exception)
-{
- if (_fieldTptr==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
- SALOME::INTERNAL_ERROR);
- try
- {
- _fieldTptr->read(i);
- }
- catch(...)
- {
- MESSAGE("Exception en accedant au champ");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Field C++ Object"\
- ,SALOME::INTERNAL_ERROR);
- }
-}
-//=============================================================================
-/*!
- * CORBA: rmDriver
- */
-//=============================================================================
-template <class T> void FIELDOF_i<T>::rmDriver (CORBA::Long i)
-throw (SALOME::SALOME_Exception)
-{
- if (_fieldTptr==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
- SALOME::INTERNAL_ERROR);
- try
- {
- _fieldTptr->rmDriver(i);
- }
- catch(...)
- {
- MESSAGE("Exception en accedant au champ");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Field C++ Object"\
- ,SALOME::INTERNAL_ERROR);
- }
-}
-//=============================================================================
-/*!
- * CORBA: addDriver
- */
-//=============================================================================
-template <class T> CORBA::Long FIELDOF_i<T>::addDriver (SALOME_MED::medDriverTypes driverType,
- const char* fileName, const char* fieldName) throw (SALOME::SALOME_Exception)
-{
- if (_fieldTptr==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Field", \
- SALOME::INTERNAL_ERROR);
- try
- {
- int drivernum=_fieldTptr->addDriver(
- convertIdlDriverToMedDriver(driverType),
- fileName,
- fieldName);
- return drivernum;
- }
- catch(...)
- {
- MESSAGE("Exception en accedant au champ");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Field C++ Object"\
- ,SALOME::INTERNAL_ERROR);
- }
-}
-
-#endif /* MED_FIELDOF_I_HXX_ */
+++ /dev/null
-//=============================================================================
-// File : Field_i.cxx
-// Created : mer fév 20 15:47:57 CET 2002
-// Author : EDF
-// Project : SALOME
-// Copyright : EDF 2002
-// $Header: /export/home/CVS/SALOME_ROOT/MED/src/MedMem/Field_i.cxx
-//=============================================================================
-# include "Field_i.hxx"
-
-FIELD_i::FIELD_i()
-{
-}
-FIELD_i::FIELD_i(const FIELD_i & x)
-{
-}
-FIELD_i::~FIELD_i()
-{
-}
-
+++ /dev/null
-//=============================================================================
-// File : Field_i.hxx
-// Created : mer fév 20 15:47:57 CET 2002
-// Author : EDF
-// Project : SALOME
-// Copyright : EDF 2002
-// $Header: /export/home/CVS/SALOME_ROOT/MED/src/MedMem/Field_i.hxx
-//=============================================================================
-# ifndef __FIELD_I_H__
-# define __FIELD_I_H__
-
-# include <SALOMEconfig.h>
-
-//# include "SALOME_Component_i.hxx"
-# include CORBA_SERVER_HEADER(MED)
-
-# include "Utils_CorbaException.hxx"
-
-class FIELD_i
-{
-
-protected :
- FIELD_i();
-
-public :
- FIELD_i( const FIELD_i & x);
- ~FIELD_i();
- virtual char * getName()
- throw (SALOME::SALOME_Exception) = 0;
- virtual char * getDescription()
- throw (SALOME::SALOME_Exception) = 0;
- virtual SALOME_MED::SUPPORT_ptr getSupport()
- throw (SALOME::SALOME_Exception) = 0;
- virtual CORBA::Long getNumberOfComponents()
- throw (SALOME::SALOME_Exception) = 0;
- virtual char * getComponentName(CORBA::Long i)
- throw (SALOME::SALOME_Exception) = 0;
- virtual char * getComponentUnit(CORBA::Long i)
- throw (SALOME::SALOME_Exception) = 0;
- virtual CORBA::Long getIterationNumber()
- throw (SALOME::SALOME_Exception) = 0;
- virtual CORBA::Long getOrderNumber()
- throw (SALOME::SALOME_Exception) = 0;
- virtual CORBA::Double getTime()
- throw (SALOME::SALOME_Exception) = 0;
- virtual CORBA::Long getCorbaIndex()
- throw (SALOME::SALOME_Exception) = 0;
- virtual Engines::string_array * getComponentsNames()
- throw (SALOME::SALOME_Exception) = 0;
- virtual Engines::string_array * getComponentsUnits()
- throw (SALOME::SALOME_Exception) = 0;
- virtual void addInStudy(SALOMEDS::Study_ptr myStudy ,
- SALOME_MED::FIELD_ptr myIor)
- throw (SALOME::SALOME_Exception) = 0;
- virtual CORBA::Long addDriver (SALOME_MED::medDriverTypes driverType,
- const char* fileName,
- const char* fieldName)
- throw (SALOME::SALOME_Exception) = 0;
- virtual void rmDriver (CORBA::Long i)
- throw (SALOME::SALOME_Exception) = 0;
- virtual void read (CORBA::Long i)
- throw (SALOME::SALOME_Exception) = 0;
- virtual void write (CORBA::Long i,
- const char* driverFieldName)
- throw (SALOME::SALOME_Exception) = 0;
-};
-# endif /* ifndef ____FIELD_I_H__ */
+++ /dev/null
-//=============================================================================
-// File : Group_i.cxx
-// Project : SALOME
-// Author : EDF
-// Copyright : EDF 2002
-// $Header: /export/home/CVS/SALOME_ROOT/MED/src/MedMem/
-//=============================================================================
-
-#include <vector>
-
-#include "utilities.h"
-#include "Utils_CorbaException.hxx"
-
-#include "Group_i.hxx"
-#include "Family_i.hxx"
-
-#include "MEDMEM_Group.hxx"
-#include "MEDMEM_Family.hxx"
-
-//=============================================================================
-/*!
- * Default constructor
- */
-//=============================================================================
-GROUP_i::GROUP_i():_group((::GROUP*)NULL),
- SUPPORT_i()
-{
- BEGIN_OF("Default Constructor GROUP_i");
- END_OF("Default Constructor GROUP_i");
-};
-//=============================================================================
-/*!
- * Destructor
- */
-//=============================================================================
-GROUP_i::~GROUP_i()
-{
-};
-//=============================================================================
-/*!
- * Constructor
- */
-//=============================================================================
-GROUP_i::GROUP_i(const ::GROUP * const g):_group(g),
- SUPPORT_i(g)
-{
- BEGIN_OF("Constructor GROUP_i");
- END_OF("Constructor GROUP_i");
-};
-//=============================================================================
-/*!
- * Constructor par recopie
- */
-//=============================================================================
-GROUP_i::GROUP_i(const GROUP_i & g):_group(g._group),
- SUPPORT_i(g._group)
-{
- BEGIN_OF("Constructor GROUP_i");
- END_OF("Constructor GROUP_i");
-};
-//=============================================================================
-/*!
- * CORBA: Number of Families existing in the group
- */
-//=============================================================================
-
-CORBA::Long GROUP_i::getNumberOfFamilies()
-throw (SALOME::SALOME_Exception)
-{
- if (_group==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Group",\
- SALOME::INTERNAL_ERROR);
- try
- {
- return _group->getNumberOfFamilies();
- }
- catch(...)
- {
- MESSAGE("Unable to get number of families of the group");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Group C++ Object"\
- ,SALOME::INTERNAL_ERROR);
- }
-};
-//=============================================================================
-/*!
- * CORBA: Returns references for families within the group
- */
-//=============================================================================
-
-SALOME_MED::Family_array* GROUP_i::getFamilies()
-throw (SALOME::SALOME_Exception)
-{
- if (_group==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Group",\
- SALOME::INTERNAL_ERROR);
- SALOME_MED::Family_array_var myseq = new SALOME_MED::Family_array;
- try
- {
- int nbfam= _group->getNumberOfFamilies();
- myseq->length(nbfam);
- vector<FAMILY*> fam(nbfam);
- fam = _group->getFamilies();
- for (int i=0;i<nbfam;i++)
- {
- FAMILY_i * f1=new FAMILY_i(fam[i]);
- SALOME_MED::FAMILY_ptr f2 =
- f1->POA_SALOME_MED::FAMILY::_this();
- f1->_remove_ref();
- myseq[i] = f2;
- }
- }
- catch(...)
- {
- MESSAGE("Unable to access families");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Family C++ Object"\
- ,SALOME::INTERNAL_ERROR);
- }
- return myseq._retn();
-};
-//=============================================================================
-/*!
- * CORBA: Returns reference for family I within the group
- */
-//=============================================================================
-
-SALOME_MED::FAMILY_ptr GROUP_i::getFamily(CORBA::Long i)
-throw (SALOME::SALOME_Exception)
-{
- if (_group==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Group",\
- SALOME::INTERNAL_ERROR);
- try
- {
- FAMILY * fam=_group->getFamily(i);
- FAMILY_i * f1=new FAMILY_i(fam);
- SALOME_MED::FAMILY_ptr f2 = f1->POA_SALOME_MED::FAMILY::_this();
- f1->_remove_ref();
- return (SALOME_MED::FAMILY::_duplicate(f2));
- }
- catch(...)
- {
- MESSAGE("Unable to acces to the specified family");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Family C++ Object"\
- ,SALOME::INTERNAL_ERROR);
- }
-};
+++ /dev/null
-//=============================================================================
-// File : Group_i.hxx
-// Project : SALOME
-// Author : EDF
-// Copyright : EDF 2002
-// $Header: /export/home/CVS/SALOME_ROOT/MED/src/MedMem/Group_i.hxx
-//=============================================================================
-#ifndef MED_GROUP_I_HXX_
-#define MED_GROUP_I_HXX_
-
-#include "Support_i.hxx"
-
-class FAMILY_i;
-class GROUP;
-
-class GROUP_i:
- public POA_SALOME_MED::GROUP,
- public SUPPORT_i
-{
-protected :
- GROUP_i();
- ~GROUP_i();
-
- // C++ object containing values
- const ::GROUP * const _group;
-
-public :
- // Constructors and associated internal methods
- GROUP_i(const ::GROUP * const g);
- GROUP_i(const GROUP_i & g);
-
- CORBA::Long getNumberOfFamilies()
- throw (SALOME::SALOME_Exception);
- SALOME_MED::Family_array* getFamilies()
- throw (SALOME::SALOME_Exception);
- SALOME_MED::FAMILY_ptr getFamily(CORBA::Long i)
- throw (SALOME::SALOME_Exception);
-};
-
-#endif /* MED_GROUP_I_HXX_ */
+++ /dev/null
-# MED MedMem : MED idl descriptions implementation based on the classes of MEDMEM
-#
-# 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 : Field_i.hxx
-# Author : Marc Tajchman
-# Module : MED
-# $Header: /export/home/CVS/SALOME_ROOT/MED/src/MedMem/Makefile.in
-
-top_srcdir=@top_srcdir@
-top_builddir=../..
-srcdir=@srcdir@
-VPATH=.:@srcdir@:@top_srcdir@/idl:$(top_builddir)/idl:${KERNEL_ROOT_DIR}/idl/salome
-
-MACHINE=PCLINUX
-
-@COMMENCE@
-
-
-#EXPORT_PYSCRIPTS = \
-# testMed.py
-
-EXPORT_HEADERS = \
- convert.hxx \
- Med_i.hxx \
- Family_i.hxx \
- FieldDouble_i.hxx \
- FieldInt_i.hxx \
- FieldOf_i.hxx \
- Field_i.hxx \
- Group_i.hxx \
- Mesh_i.hxx \
- Support_i.hxx
-
-# Libraries targets
-
-LIB=libMEDImpl.la
-LIB_SRC = Med_i.cxx Family_i.cxx FieldDouble_i.cxx FieldInt_i.cxx Field_i.cxx Group_i.cxx Mesh_i.cxx Support_i.cxx convert.cxx
-LIB_SERVER_IDL = MED.idl
-LIB_CLIENT_IDL= SALOME_Component.idl SALOMEDS.idl SALOMEDS_Attributes.idl SALOME_Exception.idl
-
-# Executables targets
-BIN_SRC =
-BIN_SERVER_IDL =
-BIN_CLIENT_IDL =
-
-
-CPPFLAGS+= $(MED2_INCLUDES) $(HDF5_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome
-CXXFLAGS=-g -D_DEBUG_ -D__x86__ -D__linux__ -I${KERNEL_ROOT_DIR}/include/salome
-LDFLAGS+=-lmedmem -lOpUtil -L${KERNEL_ROOT_DIR}/lib/salome
-#LDFLAGS+=-lmedmem -L. -lSalomeContainer -lSalomeNS -lRegistry -lOpUtil -lSalomeNotification
-# does we put only -lSalomeContainer and compiler retrieves -lSalomeNS -lRegistry -lOpUtil ????
-
-MED.hh MEDSK.cc: MED.idl
- omniidl -bcxx -Wbtp -I$(top_builddir)/idl -I${KERNEL_ROOT_DIR}/idl/salome $^
-
-@CONCLUDE@
+++ /dev/null
-//=============================================================================
-// File : Med_i.cxx
-// Project : SALOME
-// Author : EDF
-// Copyright : EDF 2002
-// $Header: /export/home/CVS/SALOME_ROOT/MED/src/MedMem/Med_i.cxx
-//=============================================================================
-
-#include <deque>
-
-//#include "MEDMEM_Field.hxx"
-
-#include "Med_i.hxx"
-#include "Mesh_i.hxx"
-#include "FieldDouble_i.hxx"
-#include "FieldInt_i.hxx"
-#include "Support_i.hxx"
-#include "Family_i.hxx"
-#include "Group_i.hxx"
-
-#include "MEDMEM_DriversDef.hxx"
-#include "convert.hxx"
-#include "utilities.h"
-#include "Utils_CorbaException.hxx"
-
-//=============================================================================
-/*!
- * Default constructor
- */
-//=================================POA_SALOME_MED::FAMILY::_============================================
-MED_i::MED_i():_med((::MED*)NULL)
-{
- BEGIN_OF("Default Constructor MED_i");
- END_OF("Default Constructor MED_i");
-}
-//=============================================================================
-/*!
- * methods
- */
-//=============================================================================
-void MED_i::init(SALOMEDS::Study_ptr myStudy,driverTypes driverType, const string & fileName)
-{
- const char * LOC = "MED_i::init(driverTypes, const string &)" ;
- BEGIN_OF(LOC);
-
- _med = new ::MED(driverType,fileName) ;
- // we create all IOR from _med
-
- // MESH :
- deque<string> meshesNames = _med->getMeshNames() ;
- int numberOfMeshes = meshesNames.size() ;
- for (int i=0; i<numberOfMeshes; i++) {
- ::MESH * myMesh = _med->getMesh(meshesNames[i]) ;
- myMesh->read() ;
- MESH_i * myMeshI = new MESH_i(myMesh) ;
- SALOME_MED::MESH_ptr myMeshIOR = myMeshI->_this() ;
- _meshes[meshesNames[i]]=myMeshIOR ;
- myMeshI->addInStudy(myStudy,myMeshIOR,fileName) ;
- }
-
- // SUPPORT :
- _med->updateSupport() ;
-
- // we add all group and family in study :
- // we add all families
- vector<FAMILY*> familyVector ;
- vector<FAMILY*>::iterator familyVectorIt ;
- // we add all groups
- vector<GROUP*> groupVector ;
- vector<GROUP*>::iterator groupVectorIt ;
-
- MED_FR::MESH_ENTITIES::const_iterator currentEntity;
- for (int i=0; i<numberOfMeshes; i++) {
- ::MESH * ptrMesh = _med->getMesh(meshesNames[i]) ;
- for (currentEntity=MED_FR::meshEntities.begin();currentEntity != MED_FR::meshEntities.end(); currentEntity++) {
- // family :
- familyVector = ptrMesh->getFamilies((MED_EN::medEntityMesh)(*currentEntity).first) ;
- for(familyVectorIt=familyVector.begin();familyVectorIt!=familyVector.end();familyVectorIt++) {
- FAMILY_i * myFamilyI = new FAMILY_i(*familyVectorIt);
- SALOME_MED::FAMILY_ptr myFamilyIOR = myFamilyI->POA_SALOME_MED::FAMILY::_this() ;
- myFamilyI->addInStudy(myStudy,myFamilyIOR) ;
- }
- // group :
- groupVector = ptrMesh->getGroups((MED_EN::medEntityMesh)(*currentEntity).first) ;
- for(groupVectorIt=groupVector.begin();groupVectorIt!=groupVector.end();groupVectorIt++) {
- GROUP_i * myGroupI = new GROUP_i(*groupVectorIt);
- SALOME_MED::GROUP_ptr myGroupIOR = myGroupI->POA_SALOME_MED::GROUP::_this() ;
- myGroupI->addInStudy(myStudy,myGroupIOR) ;
- }
- }
- }
-
- for (int i=0; i<numberOfMeshes; i++) {
- map<MED_FR::med_entite_maillage,::SUPPORT*> mySupports = _med->getSupports(meshesNames[i]) ;
- map<MED_FR::med_entite_maillage,::SUPPORT*>::const_iterator itSupport ;
- map<MED_FR::med_entite_maillage,SALOME_MED::SUPPORT_ptr> & mySupportsIOR = _supports[meshesNames[i]] ;
- for ( itSupport=mySupports.begin(); itSupport!=mySupports.end(); itSupport++ ) {
- SUPPORT_i * mySupportI = new SUPPORT_i((*itSupport).second);
- SALOME_MED::SUPPORT_ptr mySupportIOR = mySupportI->_this() ;
- mySupportsIOR[(*itSupport).first]= mySupportIOR ;
- mySupportI->addInStudy(myStudy,mySupportIOR) ;
- }
- }
-
- // FIELD :
- deque<string> fieldsNames = _med->getFieldNames() ;
- int numberOfFields = fieldsNames.size() ;
- for (int i=0; i<numberOfFields; i++) {
- deque<DT_IT_> myIteration = _med->getFieldIteration (fieldsNames[i]) ;
- int numberOfIteration = myIteration.size() ;
- for (int j=0; j<numberOfIteration; j++) {
- ::FIELD_ * myField = _med->getField(fieldsNames[i],myIteration[j].dt,myIteration[j].it) ;
- string meshName = myField->getSupport()->getMesh()->getName() ;
- medEntityMesh myEntity = myField->getSupport()->getEntity() ;
- map<string, map<MED_FR::med_entite_maillage,SALOME_MED::SUPPORT_ptr> >::const_iterator itSupportOnMesh = _supports.find(meshName) ;
- if ( itSupportOnMesh == _supports.end() )
- throw MED_EXCEPTION ( LOCALIZED( STRING(LOC)
- << "There is no support on mesh named |"
- << meshName << "|"
- )
- );
- const map<MED_FR::med_entite_maillage,SALOME_MED::SUPPORT_ptr> & SupportOnMesh = (*itSupportOnMesh).second ;
- map<MED_FR::med_entite_maillage,SALOME_MED::SUPPORT_ptr>::const_iterator itSupport = SupportOnMesh.find((MED_FR::med_entite_maillage)myEntity) ;
- if (itSupport == SupportOnMesh.end() )
- throw MED_EXCEPTION ( LOCALIZED( STRING(LOC)
- << "There is no support on entity "
- << entity << " in mesh named |"
- << meshName << "|"
- )
- );
- SALOME_MED::SUPPORT_ptr mySupportIOR = (*itSupport).second ;
- med_type_champ type = myField->getValueType() ;
- SALOME_MED::FIELD_ptr myFieldIOR ;
- switch (type) {
- case MED_FR::MED_INT32: {
- ((FIELD<int>*)myField)->read() ;
- FIELDINT_i * myFieldIntI = new FIELDINT_i(mySupportIOR,(FIELD<int>*)myField);
- //SALOME_MED::FIELDINT_ptr myFieldIntIOR = myFieldIntI->_this() ;
- POA_SALOME_MED::FIELD_tie<FIELD_i> * myFieldTie = new POA_SALOME_MED::FIELD_tie<FIELD_i>(myFieldIntI) ;
- myFieldIOR = myFieldTie->_this() ;
- myFieldIntI->addInStudy(myStudy,myFieldIOR) ;
-
- break ;
- }
- // else
- case MED_FR::MED_REEL64: {
- ((FIELD<double>*)myField)->read() ;
- FIELDDOUBLE_i * myFieldDoubleI = new FIELDDOUBLE_i(mySupportIOR,(FIELD<double>*)myField);
- //SALOME_MED::FIELDDOUBLE_ptr myFieldDoubleIOR = myFieldDoubleI->_this() ;
- POA_SALOME_MED::FIELD_tie<FIELD_i> * myFieldTie= new POA_SALOME_MED::FIELD_tie<FIELD_i>(myFieldDoubleI) ;
- myFieldIOR = myFieldTie->_this() ;
- myFieldDoubleI->addInStudy(myStudy,myFieldIOR) ;
- break ;
- }
- default: {
- throw MED_EXCEPTION ( LOCALIZED( STRING(LOC)
- <<" * Iteration "<<FieldIteration[j].dt
- <<", order number "<<FieldIteration[j].it
- <<" has wrond type : "<<type)
- );
- break ;
- }
- }
- // SALOME_MED::FIELD_ptr myFieldIOR = myFieldI->POA_SALOME_MED::FIELD::_this() ;
- DT_IT_ dtIt;
- dtIt.dt = myIteration[j].dt ;
- dtIt.it = myIteration[j].it ;
- _fields[fieldsNames[i]][dtIt] = myFieldIOR ;
- }
- }
-
- END_OF(LOC);
-}
-
-//=============================================================================
-/*!
- * methods
- */
-//=============================================================================
-void MED_i::initWithFieldType(SALOMEDS::Study_ptr myStudy,driverTypes driverType, const string & fileName)
-{
- const char * LOC = "MED_i::initWithFieldType(driverTypes, const string &)" ;
- BEGIN_OF(LOC);
-
- _med = new ::MED(driverType,fileName) ;
- // we create all IOR from _med
-
- // MESH :
- deque<string> meshesNames = _med->getMeshNames() ;
- int numberOfMeshes = meshesNames.size() ;
- for (int i=0; i<numberOfMeshes; i++) {
- ::MESH * myMesh = _med->getMesh(meshesNames[i]) ;
- myMesh->read() ;
- MESH_i * myMeshI = new MESH_i(myMesh) ;
- SALOME_MED::MESH_ptr myMeshIOR = myMeshI->_this() ;
- //POA_SALOME_MED::MESH_tie<MESH_i> * myMeshTie = new POA_SALOME_MED::MESH_tie<MESH_i>(myMeshI) ;
- //SALOME_MED::MESH_ptr myMeshIOR = myMeshTie->_this() ;
- _meshes[meshesNames[i]]=myMeshIOR ;
- myMeshI->addInStudy(myStudy,myMeshIOR) ;
- }
-
- // SUPPORT :
- _med->updateSupport() ;
- for (int i=0; i<numberOfMeshes; i++) {
- map<MED_FR::med_entite_maillage,::SUPPORT*> mySupports = _med->getSupports(meshesNames[i]) ;
- map<MED_FR::med_entite_maillage,::SUPPORT*>::const_iterator itSupport ;
- map<MED_FR::med_entite_maillage,SALOME_MED::SUPPORT_ptr> & mySupportsIOR = _supports[meshesNames[i]] ;
- for ( itSupport=mySupports.begin(); itSupport!=mySupports.end(); itSupport++ ) {
- SUPPORT_i * mySupportI = new SUPPORT_i((*itSupport).second);
- SALOME_MED::SUPPORT_ptr mySupportIOR = mySupportI->_this() ;
- //POA_SALOME_MED::SUPPORT_tie<SUPPORT_i> * mySupportTie = new POA_SALOME_MED::SUPPORT_tie<SUPPORT_i>(mySupportI) ;
- //SALOME_MED::SUPPORT_ptr mySupportIOR = mySupportTie->_this() ;
- mySupportsIOR[(*itSupport).first]= mySupportIOR ;
- mySupportI->addInStudy(myStudy,mySupportIOR) ;
- }
- }
-
- // FIELD :
- deque<string> fieldsNames = _med->getFieldNames() ;
- int numberOfFields = fieldsNames.size() ;
- for (int i=0; i<numberOfFields; i++) {
- deque<DT_IT_> myIteration = _med->getFieldIteration (fieldsNames[i]) ;
- int numberOfIteration = myIteration.size() ;
- for (int j=0; j<numberOfIteration; j++) {
- ::FIELD_ * myField = _med->getField(fieldsNames[i],myIteration[j].dt,myIteration[j].it) ;
- string meshName = myField->getSupport()->getMesh()->getName() ;
- medEntityMesh myEntity = myField->getSupport()->getEntity() ;
- map<string, map<MED_FR::med_entite_maillage,SALOME_MED::SUPPORT_ptr> >::const_iterator itSupportOnMesh = _supports.find(meshName) ;
- if ( itSupportOnMesh == _supports.end() )
- throw MED_EXCEPTION ( LOCALIZED( STRING(LOC)
- << "There is no support on mesh named |"
- << meshName << "|"
- )
- );
- const map<MED_FR::med_entite_maillage,SALOME_MED::SUPPORT_ptr> & SupportOnMesh = (*itSupportOnMesh).second ;
- map<MED_FR::med_entite_maillage,SALOME_MED::SUPPORT_ptr>::const_iterator itSupport = SupportOnMesh.find((MED_FR::med_entite_maillage)myEntity) ;
- if (itSupport == SupportOnMesh.end() )
- throw MED_EXCEPTION ( LOCALIZED( STRING(LOC)
- << "There is no support on entity "
- << entity << " in mesh named |"
- << meshName << "|"
- )
- );
- SALOME_MED::SUPPORT_ptr mySupportIOR = (*itSupport).second ;
- med_type_champ type = myField->getValueType() ;
- // SALOME_MED::FIELD_ptr myFieldIOR ;
-
- DT_IT_ dtIt;
- dtIt.dt = myIteration[j].dt ;
- dtIt.it = myIteration[j].it ;
-
- switch (type) {
- case MED_FR::MED_INT32: {
- ((FIELD<int>*)myField)->read() ;
- FIELDINT_i * myFieldIntI = new FIELDINT_i(mySupportIOR,(FIELD<int>*)myField);
- //SALOME_MED::FIELDINT_ptr myFieldIntIOR = myFieldIntI->_this() ;
- // POA_SALOME_MED::FIELD_tie<FIELD_i> * myFieldTie = new POA_SALOME_MED::FIELD_tie<FIELD_i>(myFieldIntI) ;
- // myFieldIOR = myFieldTie->_this() ;
- // myFieldIntI->addInStudy(myStudy,myFieldIOR) ;
-
- SALOME_MED::FIELDINT_ptr myFieldIntIOR ;
- POA_SALOME_MED::FIELDINT_tie<FIELDINT_i> * myFieldIntTie = new POA_SALOME_MED::FIELDINT_tie<FIELDINT_i>(myFieldIntI) ;
- myFieldIntIOR = myFieldIntTie->_this() ;
- myFieldIntI->addInStudy(myStudy,myFieldIntIOR) ;
-
- _fields[fieldsNames[i]][dtIt] = myFieldIntIOR ;
-
- break ;
- }
- // else
- case MED_FR::MED_REEL64: {
- ((FIELD<double>*)myField)->read() ;
- FIELDDOUBLE_i * myFieldDoubleI = new FIELDDOUBLE_i(mySupportIOR,(FIELD<double>*)myField);
- //SALOME_MED::FIELDDOUBLE_ptr myFieldDoubleIOR = myFieldDoubleI->_this() ;
- // POA_SALOME_MED::FIELD_tie<FIELD_i> * myFieldTie= new POA_SALOME_MED::FIELD_tie<FIELD_i>(myFieldDoubleI) ;
- // myFieldIOR = myFieldTie->_this() ;
- // myFieldDoubleI->addInStudy(myStudy,myFieldIOR) ;
-
- SALOME_MED::FIELDDOUBLE_ptr myFieldDoubleIOR ;
- POA_SALOME_MED::FIELDDOUBLE_tie<FIELDDOUBLE_i> * myFieldDoubleTie = new POA_SALOME_MED::FIELDDOUBLE_tie<FIELDDOUBLE_i>(myFieldDoubleI) ;
- myFieldDoubleIOR = myFieldDoubleTie->_this() ;
- myFieldDoubleI->addInStudy(myStudy,myFieldDoubleIOR) ;
-
- _fields[fieldsNames[i]][dtIt] = myFieldDoubleIOR ;
-
- break ;
- }
- default: {
- throw MED_EXCEPTION ( LOCALIZED( STRING(LOC)
- <<" * Iteration "<<FieldIteration[j].dt
- <<", order number "<<FieldIteration[j].it
- <<" has wrond type : "<<type)
- );
- break ;
- }
- }
- // SALOME_MED::FIELD_ptr myFieldIOR = myFieldI->POA_SALOME_MED::FIELD::_this() ;
- // DT_IT_ dtIt;
- // dtIt.dt = myIteration[j].dt ;
- // dtIt.it = myIteration[j].it ;
- // _fields[fieldsNames[i]][dtIt] = myFieldIOR ;
- }
- }
-
- END_OF(LOC);
-}
-
-// MED_i::MED_i(::MED * const m):_med(m)
-// {
-// BEGIN_OF("Constructor MED_i");
-// END_OF("Constructor MED_i");
-// }
-//=============================================================================
-/*!
- * Constructor par recopie
- */
-//=============================================================================
-// MED_i::MED_i(MED_i & m):_med(m._med)
-// {
-// BEGIN_OF("Constructor par recopie MED_i");
-// END_OF("Constructorpar recopie MED_i");
-// }
-//=============================================================================
-/*!
- * Destructor
- */
-//=============================================================================
-MED_i::~MED_i()
-{
-}
-//=============================================================================
-/*!
- * CORBA: Accessor for Number of meshes
- */
-//=============================================================================
-CORBA::Long MED_i::getNumberOfMeshes()
-throw (SALOME::SALOME_Exception)
-{
- if (_med==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Med object",\
- SALOME::INTERNAL_ERROR);
- try
- {
- return _med->getNumberOfMeshes();
- }
- catch(...)
- {
- MESSAGE("Unable to get the number of meshes in Med Object");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces MED C++ Object"
- ,SALOME::INTERNAL_ERROR);
- }
-}
-//=============================================================================
-/*!
- * CORBA: Accessor for Number of fields
- */
-//=============================================================================
-CORBA::Long MED_i::getNumberOfFields()
-throw (SALOME::SALOME_Exception)
-{
- if (_med==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Med object",\
- SALOME::INTERNAL_ERROR);
- try
- {
- return _med->getNumberOfFields();
- }
- catch(...)
- {
- MESSAGE("Unable to get the number of fields in Med Object");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces MED C++ Object"
- ,SALOME::INTERNAL_ERROR);
- }
-}
-//=============================================================================
-/*!
- * CORBA: Accessor for meshes names
- */
-//=============================================================================
-Engines::string_array * MED_i::getMeshNames()
-throw (SALOME::SALOME_Exception)
-{
- if (_med==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Med object",\
- SALOME::INTERNAL_ERROR);
- Engines::string_array_var myseq = new Engines::string_array;
- try
- {
- int nbMeshes=_med->getNumberOfMeshes();
- myseq->length(nbMeshes);
- string * nameMeshes = new string[nbMeshes];
- _med->getMeshNames(nameMeshes);
- for (int i=0;i<nbMeshes;i++)
- {
- myseq[i]=CORBA::string_dup(nameMeshes[i].c_str());
- }
- delete [] nameMeshes;
- nameMeshes=NULL;
- }
- catch(...)
- {
- MESSAGE("Unable to get the names of the meshes in Med Object");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces MED C++ Object"
- ,SALOME::INTERNAL_ERROR);
- }
- return myseq._retn();
-}
-//=============================================================================
-/*!
- * CORBA: Accessor for fields names
- */
-//=============================================================================
-Engines::string_array * MED_i::getFieldNames()
-throw (SALOME::SALOME_Exception)
-{
- if (_med==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Med object",\
- SALOME::INTERNAL_ERROR);
- Engines::string_array_var myseq = new Engines::string_array;
- try
- {
- int nbFields=_med->getNumberOfFields();
- myseq->length(nbFields);
- string * nameFields = new string[nbFields];
- _med->getFieldNames(nameFields);
- for (int i=0;i<nbFields;i++)
- {
- myseq[i]=CORBA::string_dup(nameFields[i].c_str());
- }
- delete nameFields;
- nameFields=NULL;
- }
- catch(...)
- {
- MESSAGE("Unable to get the names of the fields in Med Object");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces MED C++ Object"
- ,SALOME::INTERNAL_ERROR);
- }
- return myseq._retn();
-}
-//=============================================================================
-/*!
- * CORBA: Accessor for a specific mesh
- */
-//=============================================================================
-SALOME_MED::MESH_ptr MED_i::getMeshByName(const char* meshName)
-throw (SALOME::SALOME_Exception)
-{
- if (_med==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Med object",\
- SALOME::INTERNAL_ERROR);
- try
- {
- MESH * mesh=_med->getMesh(meshName);
- MESH_i * m1 = new MESH_i(mesh);
- SALOME_MED::MESH_ptr m2 = m1->POA_SALOME_MED::MESH::_this();
- m1->_remove_ref();
- return (SALOME_MED::MESH::_duplicate(m2));
- }
- catch(...)
- {
- MESSAGE("Unable to get the specified mesh");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces MED C++ Object"
- ,SALOME::INTERNAL_ERROR);
- }
-
-}
-//=============================================================================
-/*!
- * CORBA: Accessor for a specific mesh
- */
-//=============================================================================
-SALOME_MED::MESH_ptr MED_i::getMesh(SALOME_MED::FIELD_ptr fieldPtr)
-throw (SALOME::SALOME_Exception)
-{
- if (_med==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Med object",\
- SALOME::INTERNAL_ERROR);
- int ind=fieldPtr->getCorbaIndex();
- SCRUTE(ind);
-
- MESH * mesh;
- SALOME_MED::FIELDINT_var fieldint =SALOME_MED::FIELDINT::_narrow(fieldPtr);
- if (CORBA::is_nil(fieldint))
- {
- MESSAGE("Double");
- SALOME_MED::FIELDDOUBLE_var fielddouble =
- SALOME_MED::FIELDDOUBLE::_narrow(fieldPtr);
- ASSERT(!CORBA::is_nil(fielddouble));
- ASSERT(FIELDOF_i<double>::fieldMap.find(ind)
- !=FIELDOF_i<double>::fieldMap.end());
- ::FIELD<double> * fdouble = FIELDOF_i<double>::fieldMap[ind];
- MESH * mesh=_med->getMesh(fdouble);
- }
- else
- {
- MESSAGE("Integer");
- ASSERT(FIELDOF_i<int>::fieldMap.find(ind)!=FIELDOF_i<int>::fieldMap.end());
- ::FIELD<int> * fint = FIELDOF_i<int>::fieldMap[ind];
- MESH * mesh=_med->getMesh(fint);
- }
- MESH_i * meshi = new MESH_i(mesh);
- SALOME_MED::MESH_ptr meshptr = meshi->POA_SALOME_MED::MESH::_this();
- meshi->_remove_ref();
- return (SALOME_MED::MESH::_duplicate(meshptr));
-
-}
-//=============================================================================
-/*!
- * CORBA: Accessor for a specific field
- */
-//=============================================================================
-SALOME_MED::FIELD_ptr MED_i::getField(const char* fieldName,
- CORBA::Long pasTemps,
- CORBA::Long numOrdre )
-throw (SALOME::SALOME_Exception)
-{
- const char * LOC="MED_i::getField(const char*,CORBA::Long,CORBA::Long) " ;
- BEGIN_OF(LOC) ;
-
- DT_IT_ dtIt;
-
- dtIt.dt= (int)pasTemps;
- dtIt.it= (int)numOrdre;
-
- map<string,MAP_IOR_DT_IT_>::const_iterator itFields = _fields.find(fieldName);
-
- if ( itFields == _fields.end() )
- THROW_SALOME_CORBA_EXCEPTION("Field not found !", SALOME::INTERNAL_ERROR) ;
-
- const MAP_IOR_DT_IT_ & map_dtIt = (*itFields).second ;
- MAP_IOR_DT_IT_::const_iterator itMap_dtIt = map_dtIt.find(dtIt);
-
- if ( itMap_dtIt == map_dtIt.end() )
- THROW_SALOME_CORBA_EXCEPTION("Iteration not found !", SALOME::INTERNAL_ERROR) ;
-
- END_OF(LOC) ;
- return (*itMap_dtIt).second;
-
-// if (_med==NULL)
-// THROW_SALOME_CORBA_EXCEPTION("No associated Med object",\
-// SALOME::INTERNAL_ERROR);
-// try
-// {
-// if (dynamic_cast<FIELD<int> * >
-// (_med->getField(fieldName,pasTemps,numOrdre)) !=NULL)
-// {
-// MESSAGE("Champ d entier");
-// ::FIELD<int>*f=dynamic_cast<FIELD<int> * >
-// (_med->getField(fieldName,pasTemps,numOrdre));
-// FIELDINT_i * medf = new FIELDINT_i(f);
-// POA_SALOME_MED::FIELDINT_tie<FIELDINT_i> * f1 =
-// new POA_SALOME_MED::FIELDINT_tie<FIELDINT_i>(medf,true);
-// SALOME_MED::FIELDINT_ptr f2 = f1->_this();
-// f1->_remove_ref();
-// return f2;
-
-// }
-// else
-// {
-// ASSERT (dynamic_cast<FIELD<double>* >(_med->getField(fieldName,pasTemps,numOrdre))!=NULL);
-// MESSAGE("Champ de double");
-// ::FIELD<double>*f=dynamic_cast<FIELD<double>* >
-// (_med->getField(fieldName,pasTemps,numOrdre));
-// FIELDDOUBLE_i * medf = new FIELDDOUBLE_i(f);
-// POA_SALOME_MED::FIELDDOUBLE_tie<FIELDDOUBLE_i> * f1 =
-// new POA_SALOME_MED::FIELDDOUBLE_tie<FIELDDOUBLE_i>(medf,true);
-// SALOME_MED::FIELDDOUBLE_ptr f2 = f1->_this();
-// f1->_remove_ref();
-// return f2;
-// }
-// }
-// catch(...)
-// {
-// MESSAGE("Exception en accedant a l objet C++ Med");
-// THROW_SALOME_CORBA_EXCEPTION("Unable to acces MED C++ Object"
-// ,SALOME::INTERNAL_ERROR);
-// }
-}
-//=============================================================================
-/*!
- * CORBA: Accessor for a specific field
- */
-//=============================================================================
-CORBA::Long MED_i::addDriver(SALOME_MED::medDriverTypes driverType, const char* fileName)
-throw (SALOME::SALOME_Exception)
-{
- if (_med==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Med object",\
- SALOME::INTERNAL_ERROR);
- try
- {
- int driv=_med->addDriver(convertIdlDriverToMedDriver(driverType),
- fileName);
- return driv;
- }
- catch(...)
- {
- MESSAGE("Unable to add a driver to the med object");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces MED C++ Object"
- ,SALOME::INTERNAL_ERROR);
- }
-
-}
-//=============================================================================
-/*!
- * CORBA: relase the driver (mandatory)
- */
-//=============================================================================
-void MED_i::rmDriver(CORBA::Long i)
-throw (SALOME::SALOME_Exception)
-{
- if (_med==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Med object",\
- SALOME::INTERNAL_ERROR);
- try
- {
- _med->rmDriver(i);
- }
- catch(...)
- {
- MESSAGE("Unable to unlink the driver from the med object");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces MED C++ Object"
- ,SALOME::INTERNAL_ERROR);
- }
-}
-//=============================================================================
-/*!
- * CORBA: read med objects relations
- */
-//=============================================================================
-void MED_i::readFileStruct(CORBA::Long i)
-throw (SALOME::SALOME_Exception)
-{
- if (_med==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Med object",\
- SALOME::INTERNAL_ERROR);
- try
- {
- _med->readFileStruct(i);
- }
- catch(...)
- {
- MESSAGE("Unable to read the structure of this file ");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces MED C++ Object"
- ,SALOME::INTERNAL_ERROR);
- }
-}
-//=============================================================================
-/*!
- * CORBA: write specifics objects f
- */
-//=============================================================================
-void MED_i::writeFrom(CORBA::Long i)
-throw (SALOME::SALOME_Exception)
-{
- if (_med==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Med object",\
- SALOME::INTERNAL_ERROR);
- try
- {
- _med->writeFrom(i);
- }
- catch(...)
- {
- MESSAGE("Unable to write this driver ");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces MED C++ Object"
- ,SALOME::INTERNAL_ERROR);
- }
-}
-//=============================================================================
-/*!
- * CORBA: write objects
- */
-//=============================================================================
-void MED_i::write(CORBA::Long i)
-throw (SALOME::SALOME_Exception)
-{
- if (_med==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Med object",\
- SALOME::INTERNAL_ERROR);
- try
- {
- _med->write(i);
- }
- catch(...)
- {
- MESSAGE("Unable to write this file ");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces MED C++ Object"
- ,SALOME::INTERNAL_ERROR);
- }
-}
-//=============================================================================
-/*!
- * CORBA: Add Mesh in Med objects
- */
-//=============================================================================
-void MED_i::addMesh(SALOME_MED::MESH_ptr ptrMesh)
-throw (SALOME::SALOME_Exception)
-{
- if (_med==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Med object",\
- SALOME::INTERNAL_ERROR);
- try
- {
- int ind=ptrMesh->getCorbaIndex();
- SCRUTE(ind);
- ASSERT(MESH_i::meshMap.find(ind) !=MESH_i::meshMap.end());
- MESH * mesh= MESH_i::meshMap[ind];
- _med->addMesh(mesh);
- }
- catch(...)
- {
- MESSAGE("Unable to link this mesh to this med object");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces MED C++ Object"
- ,SALOME::INTERNAL_ERROR);
- }
-}
-//=============================================================================
-/*!
- * CORBA: Add field in Med objects
- */
-//=============================================================================
-void MED_i::addField(SALOME_MED::FIELD_ptr ptrField)
-throw (SALOME::SALOME_Exception)
-{
- if (_med==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Med object",\
- SALOME::INTERNAL_ERROR);
- int ind=ptrField->getCorbaIndex();
- SCRUTE(ind);
-
- SALOME_MED::FIELDINT_var fieldint =SALOME_MED::FIELDINT::_narrow(ptrField);
- if (CORBA::is_nil(fieldint))
- {
- MESSAGE("Double");
- SALOME_MED::FIELDDOUBLE_var fielddouble =
- SALOME_MED::FIELDDOUBLE::_narrow(ptrField);
- ASSERT(!CORBA::is_nil(fielddouble));
- ASSERT(FIELDOF_i<double>::fieldMap.find(ind)
- !=FIELDOF_i<double>::fieldMap.end());
- ::FIELD<double> * fdouble = FIELDOF_i<double>::fieldMap[ind];
- // A modifier
- //_med->addField(fdouble);
- }
- else
- {
- MESSAGE("Integer");
- ASSERT(FIELDOF_i<int>::fieldMap.find(ind)!=FIELDOF_i<int>::fieldMap.end());
- ::FIELD<int> * fint = FIELDOF_i<int>::fieldMap[ind];
- //_med->addField(fint);
- }
-}
-//=============================================================================
-/*!
- * CORBA: Add Med in Study
- */
-//=============================================================================
-void MED_i::addInStudy(SALOMEDS::Study_ptr myStudy, SALOME_MED::MED_ptr myIor)
-throw (SALOME::SALOME_Exception)
-{
- BEGIN_OF("MED_Mesh_i::addInStudy");
- if ( _medId != "" )
- {
- MESSAGE("Med already in Study");
- THROW_SALOME_CORBA_EXCEPTION("Med already in Study", \
- SALOME::BAD_PARAM);
- };
-
- SALOMEDS::StudyBuilder_var myBuilder = myStudy->NewBuilder();
- myBuilder->NewCommand();
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeName_var aName;
- SALOMEDS::AttributeIOR_var aIOR;
-
- // Create SComponent labelled 'MED' if it doesn't already exit
- // SALOMEDS::SComponent_var medfather = myStudy->FindComponent("Med");
- SALOMEDS::SComponent_var medfather = myStudy->FindComponent("MED");
- if ( CORBA::is_nil(medfather) )
- {
- THROW_SALOME_CORBA_EXCEPTION("Component Med not found",
- SALOME::BAD_PARAM);
- } ;
-
- MESSAGE("Add a MED Object under Med");
- SALOMEDS::SObject_var newObj = myBuilder->NewObject(medfather);
-
- ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
- ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting()) ;
- CORBA::ORB_var &orb = init(0,0);
- string iorStr = orb->object_to_string(myIor);
- anAttr = myBuilder->FindOrCreateAttribute(newObj, "AttributeIOR");
- aIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
- aIOR->SetValue(iorStr.c_str());
- anAttr = myBuilder->FindOrCreateAttribute(newObj, "AttributeName");
- aName = SALOMEDS::AttributeName::_narrow(anAttr);
- aName->SetValue("Objet MED");
- _medId = newObj->GetID();
- myBuilder->CommitCommand();
-
- END_OF("Med_i::addInStudy(SALOMEDS::Study_ptr myStudy)");
-}
-
-
-
-
+++ /dev/null
-//=============================================================================
-// File : Med_i.hxx
-// Project : SALOME
-// Author : EDF
-// Copyright : EDF 2002
-// $Header: /export/home/CVS/SALOME_ROOT/MED/src/MedMem/Med_i.hxx
-//=============================================================================
-
-#ifndef _MED_MED_I_HXX_
-#define _MED_MED_I_HXX_
-
-#include <string>
-
-#include <SALOMEconfig.h>
-
-#include CORBA_SERVER_HEADER(MED)
-#include CORBA_SERVER_HEADER(SALOMEDS)
-#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
-
-#include "MEDMEM_Med.hxx"
-
-typedef map<DT_IT_, SALOME_MED::FIELD_ptr, LT_DT_IT_ > MAP_IOR_DT_IT_;
-
-class MED_i: public POA_SALOME_MED::MED
-{
-
-private :
-
-protected:
- // C++ object containing values
- //::MED * const _med;
- ::MED * _med;
- string _medId;
-
- map<string,SALOME_MED::MESH_ptr> _meshes; // We can't have two MESHes with the same name.
-
- map<string,map<MED_FR::med_entite_maillage,SALOME_MED::SUPPORT_ptr> > _supports;
-
- map<string,MAP_IOR_DT_IT_> _fields; // We can't have two FIELDs with the same name.
-
-public:
- // Constructors and associated internal methods
- MED_i();
- // MED_i(::MED * const m);
- // MED_i(MED_i & m);
- ~MED_i();
-
- void init(SALOMEDS::Study_ptr myStudy, driverTypes driverType, const string & fileName); // Analyse the file <fileName> by calling readFileStruct
-
- void initWithFieldType(SALOMEDS::Study_ptr myStudy, driverTypes driverType, const string & fileName); // Same method as above but with storage of fields with their type
-
- // IDL Methods
- CORBA::Long getNumberOfMeshes() throw (SALOME::SALOME_Exception);
- CORBA::Long getNumberOfFields() throw (SALOME::SALOME_Exception);
- Engines::string_array * getMeshNames() throw (SALOME::SALOME_Exception);
- Engines::string_array * getFieldNames() throw (SALOME::SALOME_Exception);
- SALOME_MED::MESH_ptr getMeshByName(const char* meshName)
- throw (SALOME::SALOME_Exception);
- SALOME_MED::MESH_ptr getMesh(SALOME_MED::FIELD_ptr fieldPtr)
- throw (SALOME::SALOME_Exception);
- SALOME_MED::FIELD_ptr getField(const char* fieldName,
- CORBA::Long pasTemps,
- CORBA::Long numOrdre)
- throw (SALOME::SALOME_Exception);
- CORBA::Long addDriver(SALOME_MED::medDriverTypes driverType,
- const char* fileName)
- throw (SALOME::SALOME_Exception);
- void rmDriver(CORBA::Long i)
- throw (SALOME::SALOME_Exception);
- void readFileStruct(CORBA::Long i)
- throw (SALOME::SALOME_Exception);
- void writeFrom(CORBA::Long i)
- throw (SALOME::SALOME_Exception);
- void write(CORBA::Long i)
- throw (SALOME::SALOME_Exception);
- void addMesh(SALOME_MED::MESH_ptr ptrMesh)
- throw (SALOME::SALOME_Exception);
- void addField(SALOME_MED::FIELD_ptr ptrField)
- throw (SALOME::SALOME_Exception);
- void addInStudy(SALOMEDS::Study_ptr myStudy,
- SALOME_MED::MED_ptr myIor)
- throw (SALOME::SALOME_Exception);
-};
-
-#endif /* _MED_MED_I_HXX_ */
+++ /dev/null
-//=============================================================================
-// File : Mesh_i.cxx
-// Project : SALOME
-// Author : EDF
-// Copyright : EDF 2002
-// $Header: /export/home/CVS/SALOME_ROOT/MED/src/MedMem/Mesh_i.cxx
-//=============================================================================
-
-#include <vector>
-
-#include "utilities.h"
-#include "Utils_CorbaException.hxx"
-#include "Utils_ORB_INIT.hxx"
-#include "Utils_SINGLETON.hxx"
-
-#include "convert.hxx"
-#include "Mesh_i.hxx"
-#include "Support_i.hxx"
-#include "Family_i.hxx"
-#include "Group_i.hxx"
-#include "FieldDouble_i.hxx"
-
-#include "MEDMEM_Mesh.hxx"
-#include "MEDMEM_Family.hxx"
-#include "MEDMEM_Group.hxx"
-#include "MEDMEM_CellModel.hxx"
-
-// Initialisation des variables statiques
-map < int, ::MESH *> MESH_i::meshMap ;
-int MESH_i::meshIndex = 0 ;
-
-
-
-//=============================================================================
-/*!
- * Default constructor
- */
-//=============================================================================
-MESH_i::MESH_i(): _mesh(constructConstMesh()),
- _corbaIndex(MESH_i::meshIndex++),
- _meshId("")
-{
- BEGIN_OF("Default Constructor MESH_i");
- MESH_i::meshMap[_corbaIndex]=_mesh;
- END_OF("Default Constructor MESH_i");
-}
-//=============================================================================
-/*!
- * Destructor
- */
-//=============================================================================
-MESH_i::~MESH_i()
-{
-}
-//=============================================================================
-/*!
- * Constructor
- */
-//=============================================================================
-MESH_i::MESH_i(::MESH * const m ) :_mesh(m),
- _corbaIndex(MESH_i::meshIndex++),
- _meshId("")
-{
- BEGIN_OF("Constructor MESH_i(::MESH * const m )");
- MESH_i::meshMap[_corbaIndex]=_mesh;
-
- SCRUTE(_mesh);
-
- END_OF("Constructor MESH_i(::MESH * const m )");
-}
-//=============================================================================
-/*!
- * Copy Constructor
- */
-//=============================================================================
-//MESH_i::MESH_i(const MESH_i & m) :_mesh(m._mesh),
-MESH_i::MESH_i( MESH_i & m) :_mesh(m._mesh),
- _corbaIndex(MESH_i::meshIndex++),
- _meshId("")
-{
- BEGIN_OF("Constructor MESH_i");
- MESH_i::meshMap[_corbaIndex]=_mesh;
- END_OF("Constructor MESH_i");
-}
-//=============================================================================
-/*!
- * Internal Method in order to have a const ptr
- */
-//=============================================================================
-::MESH * MESH_i::constructConstMesh() const
-{
- ::MESH * const ptrMesh =new ::MESH();
- return ptrMesh;
-}
-//=============================================================================
-/*!
- * CORBA: Accessor for Name
- */
-//=============================================================================
-char * MESH_i::getName()
-throw (SALOME::SALOME_Exception)
-{
- if (_mesh==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
- SALOME::INTERNAL_ERROR);
-
- try
- {
- return CORBA::string_dup(_mesh->getName().c_str());
- }
- catch(...)
- {
- MESSAGE("Unable to acces the mesh name");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object"\
- ,SALOME::INTERNAL_ERROR);
- }
-}
-//=============================================================================
-/*!
- * CORBA: Accessor for corbaindex cuisine interne
- */
-//=============================================================================
-CORBA::Long MESH_i::getCorbaIndex()
-throw (SALOME::SALOME_Exception)
-{
- if (_mesh==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
- SALOME::INTERNAL_ERROR);
- return _corbaIndex;
-}
-//=============================================================================
-/*!
- * CORBA: Accessor for Space Dimension
- */
-//=============================================================================
-CORBA::Long MESH_i::getSpaceDimension()
-throw (SALOME::SALOME_Exception)
-{
- if (_mesh==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
- SALOME::INTERNAL_ERROR);
- try
- {
- return _mesh->getSpaceDimension();
- }
- catch(...)
- {
- MESSAGE("Unable to acces the space dimension ");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object"\
- ,SALOME::INTERNAL_ERROR);
- }
-}
-//=============================================================================
-/*!
- * CORBA: Accessor for Mesh Dimension
- */
-//=============================================================================
-CORBA::Long MESH_i::getMeshDimension()
-throw (SALOME::SALOME_Exception)
-{
- if (_mesh==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
- SALOME::INTERNAL_ERROR);
- try
- {
- return _mesh->getMeshDimension();
- }
- catch(...)
- {
- MESSAGE("Unable to acces the mesh dimension ");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object"\
- ,SALOME::INTERNAL_ERROR);
- }
-}
-//=============================================================================
-/*!
- * CORBA: Accessor for Coordinates System
- */
-//=============================================================================
-char * MESH_i::getCoordinatesSystem()
-throw (SALOME::SALOME_Exception)
-{
- if (_mesh==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
- SALOME::INTERNAL_ERROR);
-
- try
- {
- return CORBA::string_dup(_mesh->getCoordinatesSystem().c_str());
- }
- catch(...)
- {
- MESSAGE("Unable to acces the type of CoordinatesSystem");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object"\
- ,SALOME::INTERNAL_ERROR);
- }
-}
-//=============================================================================
-/*!
- * CORBA: Accessor for Coordinates
- */
-//=============================================================================
-Engines::double_array * MESH_i::getCoordinates(SALOME_MED::medModeSwitch typeSwitch)
-throw (SALOME::SALOME_Exception)
-{
- if (_mesh==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
- SALOME::INTERNAL_ERROR);
- Engines::double_array_var myseq = new Engines::double_array;
- try
- {
- int spaceDimension=_mesh->getSpaceDimension();
- int nbNodes=_mesh->getNumberOfNodes();
- const double * coordinates =_mesh->getCoordinates(
- convertIdlModeToMedMode(typeSwitch));
-
- myseq->length(nbNodes*spaceDimension);
- for (int i=0; i<nbNodes*spaceDimension; i++)
- {
- myseq[i]=coordinates[i];
- };
- }
- catch(...)
- {
- MESSAGE("Unable to acces the coordinates");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object"\
- ,SALOME::INTERNAL_ERROR);
- }
- return myseq._retn();
-}
-//=============================================================================
-/*!
- * CORBA: Accessor for Coordinates Names
- */
-//=============================================================================
-Engines::string_array * MESH_i::getCoordinatesNames()
-throw (SALOME::SALOME_Exception)
-{
- if (_mesh==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
- SALOME::INTERNAL_ERROR);
- Engines::string_array_var myseq = new Engines::string_array;
- try
- {
- int spaceDimension=_mesh->getSpaceDimension();
- const string * coordinatesName =_mesh->getCoordinatesNames();
- myseq->length(spaceDimension);
- for (int i=0; i<spaceDimension; i++)
- {
- myseq[i]=CORBA::string_dup(coordinatesName[i].c_str());
- }
- }
- catch(...)
- {
- MESSAGE("Unable to acces the coordinates names");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object"\
- ,SALOME::INTERNAL_ERROR);
- }
- return myseq._retn();
-
-}
-//=============================================================================
-/*!
- * CORBA: Accessor for Coordinates Units
- */
-//=============================================================================
-Engines::string_array * MESH_i::getCoordinatesUnits()
-throw (SALOME::SALOME_Exception)
-{
- if (_mesh==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
- SALOME::INTERNAL_ERROR);
- Engines::string_array_var myseq = new Engines::string_array;
- try
- {
- int spaceDimension=_mesh->getSpaceDimension();
- const string * coordinatesUnits =_mesh->getCoordinatesUnits();
- myseq->length(spaceDimension);
- for (int i=0; i<spaceDimension; i++)
- {
- myseq[i]=CORBA::string_dup(coordinatesUnits[i].c_str());
- };
- }
- catch(...)
- {
- MESSAGE("Unable to acces the coordinates units");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object"\
- ,SALOME::INTERNAL_ERROR);
- }
- return myseq._retn();
-}
-//=============================================================================
-/*!
- * CORBA: Accessor for Number of Nodes
- */
-//=============================================================================
-CORBA::Long MESH_i::getNumberOfNodes()
-throw (SALOME::SALOME_Exception)
-{
- if (_mesh==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
- SALOME::INTERNAL_ERROR);
- try
- {
- return _mesh->getNumberOfNodes();
- }
- catch(...)
- {
- MESSAGE("Unable to acces number of nodes");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object"\
- ,SALOME::INTERNAL_ERROR);
- }
-}
-//=============================================================================
-/*!
- * CORBA: Accessor for number of Types
- */
-//=============================================================================
-CORBA::Long MESH_i::getNumberOfTypes(SALOME_MED::medEntityMesh entity)
-throw (SALOME::SALOME_Exception)
-{
- if (_mesh==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
- SALOME::INTERNAL_ERROR);
- try
- {
- return _mesh->getNumberOfTypes(convertIdlEntToMedEnt(entity));
- }
- catch(...)
- {
- MESSAGE("Unable to acces number of differents types");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object"\
- ,SALOME::INTERNAL_ERROR);
- }
-}
-
-//=============================================================================
-/*!
- * CORBA: Accessor for existing geometry element types
- * Not implemented for MED_ALL_ENTITIES
- */
-//=============================================================================
-SALOME_MED::medGeometryElement_array * MESH_i::getTypes (SALOME_MED::medEntityMesh entity)
-throw (SALOME::SALOME_Exception)
-{
- if (_mesh==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
- SALOME::INTERNAL_ERROR);
- if (entity ==SALOME_MED::MED_ALL_ENTITIES)
- THROW_SALOME_CORBA_EXCEPTION("Not implemented for MED_ALL_ENTITIES",\
- SALOME::BAD_PARAM);
- SALOME_MED::medGeometryElement_array_var myseq =
- new SALOME_MED::medGeometryElement_array;
- try
- {
- int nbTypes=_mesh->getNumberOfTypes(convertIdlEntToMedEnt(entity));
- const medGeometryElement * elemts =_mesh->getTypes(
- convertIdlEntToMedEnt(entity));
- myseq->length(nbTypes);
- for (int i=0; i<nbTypes; i++)
- {
- myseq[i]=convertMedEltToIdlElt(elemts[i]);
- };
- }
- catch(...)
- {
- MESSAGE("Unable to acces coordinates");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object"\
- ,SALOME::INTERNAL_ERROR);
- }
- return myseq._retn();
-}
-//=============================================================================
-/*!
- * CORBA: Returns number of elements of type medGeometryElement
- * Not implemented for MED_ALL_ELEMENTS
-* implemented for MED_ALL_ENTITIES
- */
-//=============================================================================
-CORBA::Long MESH_i::getNumberOfElements(SALOME_MED::medEntityMesh entity,
- SALOME_MED::medGeometryElement geomElement)
-throw (SALOME::SALOME_Exception)
-{
- if (_mesh==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
- SALOME::INTERNAL_ERROR);
- if (verifieParam(entity,geomElement)==false)
- THROW_SALOME_CORBA_EXCEPTION("parameters don't match",\
- SALOME::BAD_PARAM);
-
- try
- {
- return _mesh->getNumberOfElements(convertIdlEntToMedEnt(entity),
- convertIdlEltToMedElt(geomElement));
- }
- catch(...)
- {
- MESSAGE("Unable to acces number of elements");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object"\
- ,SALOME::INTERNAL_ERROR);
- }
-}
-//=============================================================================
-/*!
- * CORBA: Accessor for connectivities
- */
-//=============================================================================
-Engines::long_array * MESH_i::getConnectivity(SALOME_MED::medModeSwitch typeSwitch,
- SALOME_MED::medConnectivity mode,
- SALOME_MED::medEntityMesh entity,
- SALOME_MED::medGeometryElement geomElement)
-throw (SALOME::SALOME_Exception)
-{
- if (_mesh==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
- SALOME::INTERNAL_ERROR);
- if (verifieParam(entity,geomElement)==false)
- THROW_SALOME_CORBA_EXCEPTION("parameters don't match",\
- SALOME::BAD_PARAM);
- Engines::long_array_var myseq= new Engines::long_array;
- try
- {
- int nbelements;
- int elt1 = _mesh->getNumberOfElements(
- convertIdlEntToMedEnt(entity),
- convertIdlEltToMedElt(geomElement));
-SCRUTE(elt1);
- if ( mode == SALOME_MED::MED_DESCENDING)
- {
-MESSAGE("MED_DESCENDING");
- int elt2 =(_mesh->getCellsTypes(MED_CELL))->getNumberOfConstituents(1);
- //int elt2 =(_mesh->getTypes(convertIdlEltToMedElt(geomElement)))->getNumberOfConstituents(1);
- nbelements= elt2 * elt1;
-SCRUTE(elt2);
- }
- else
- {
-MESSAGE("MED_NODAL");
- const int * tab=_mesh->getConnectivityIndex(
- convertIdlConnToMedConn(mode),
- convertIdlEntToMedEnt(entity));
- nbelements = tab[elt1 ] - 1 ;
- }
-SCRUTE(entity);
-SCRUTE(geomElement);
-SCRUTE(nbelements);
- myseq->length(nbelements);
- const int * numbers=_mesh->getConnectivity(convertIdlModeToMedMode(typeSwitch),
- convertIdlConnToMedConn(mode),
- convertIdlEntToMedEnt(entity),
- convertIdlEltToMedElt(geomElement));
- for (int i=0;i<nbelements;i++)
- {
- myseq[i]=numbers[i];
- }
- }
- catch(...)
- {
- MESSAGE("Unable to acces connectivities");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object"\
- ,SALOME::INTERNAL_ERROR);
- }
- return myseq._retn();
-}
-//=============================================================================
-/*!
- * CORBA: Accessor for connectivities
- */
-//=============================================================================
-Engines::long_array* MESH_i::getConnectivityIndex(SALOME_MED::medConnectivity mode,
- SALOME_MED::medEntityMesh entity)
-throw (SALOME::SALOME_Exception)
-{
- if (_mesh==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
- SALOME::INTERNAL_ERROR);
- Engines::long_array_var myseq= new Engines::long_array;
- try
- {
- int nbelements = _mesh->getNumberOfElements(
- convertIdlEntToMedEnt(entity),
- MED_ALL_ELEMENTS);
- myseq->length(nbelements);
- const int * numbers=_mesh->getConnectivityIndex(convertIdlConnToMedConn(mode),
- convertIdlEntToMedEnt(entity));
- for (int i=0;i<nbelements;i++)
- {
- myseq[i]=numbers[i];
- }
- }
- catch(...)
- {
- MESSAGE("Unable to acces connectivities index");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object"\
- ,SALOME::INTERNAL_ERROR);
- }
- return myseq._retn();
-}
-//=============================================================================
-/*!
- * CORBA: get global element number in connectivity array
- * not implemented for MED_NODE and MED_ALL_ENTITIES,
- * MED_NONE and MED_ALL_ELEMENTS.
- */
-//=============================================================================
-CORBA::Long MESH_i::getElementNumber(SALOME_MED::medConnectivity mode,
- SALOME_MED::medEntityMesh entity,
- SALOME_MED::medGeometryElement type,
- const Engines::long_array& connectivity)
- throw (SALOME::SALOME_Exception)
-{
- if (_mesh==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", SALOME::INTERNAL_ERROR);
- int numberOfValue = connectivity.length() ;
- int * myConnectivity = new int[numberOfValue] ;
- for (int i=0; i<numberOfValue; i++)
- myConnectivity[i]=connectivity[i] ;
-
- int result ;
- try {
- result = _mesh->getElementNumber(convertIdlConnToMedConn(mode),
- convertIdlEntToMedEnt(entity),
- convertIdlEltToMedElt(type),
- myConnectivity) ;
- }
- catch (MEDEXCEPTION &ex) {
- THROW_SALOME_CORBA_EXCEPTION(ex.what(), SALOME::INTERNAL_ERROR);
- }
- return result ;
-}
-//=============================================================================
-/*!
- * CORBA: Accessor for Ascendant connectivities
- * not implemented for MED_ALL_ENTITIES and MED_MAILLE
- */
-//=============================================================================
-Engines::long_array* MESH_i::getReverseConnectivity(SALOME_MED::medConnectivity mode)
-throw (SALOME::SALOME_Exception)
-{
- if (_mesh==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
- SALOME::INTERNAL_ERROR);
- Engines::long_array_var myseq= new Engines::long_array;
- try
- {
- int nbelements;
- if ( mode == SALOME_MED::MED_DESCENDING)
- {
- nbelements =(_mesh->getNumberOfNodes())+1;
- }
- else
- {
- nbelements = _mesh->getNumberOfElements(MED_FACE,MED_ALL_ELEMENTS);
- }
- SCRUTE(nbelements);
- myseq->length(nbelements);
- const int * numbers=_mesh->getReverseConnectivity(convertIdlConnToMedConn(mode));
- for (int i=0;i<nbelements;i++)
- {
- myseq[i]=numbers[i];
- }
- }
- catch(...)
- {
- MESSAGE("Unable to acces reverse connectivities");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object"\
- ,SALOME::INTERNAL_ERROR);
- }
- return myseq._retn();
-}
-//=============================================================================
-/*!
- * CORBA: Accessor for connectivities
- */
-//=============================================================================
-Engines::long_array* MESH_i::getReverseConnectivityIndex(SALOME_MED::medConnectivity mode)
-throw (SALOME::SALOME_Exception)
-{
- if (_mesh==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
- SALOME::INTERNAL_ERROR);
- Engines::long_array_var myseq= new Engines::long_array;
- try
- {
- int nbelements;
- if ( mode == SALOME_MED::MED_DESCENDING)
- {
- nbelements =_mesh->getNumberOfNodes();
- }
- else
- {
- int dim=_mesh->getMeshDimension();
- if ( dim == 3)
- nbelements = _mesh->getNumberOfElements(MED_FACE,MED_ALL_ELEMENTS);
- else
- if (dim == 2)
- nbelements = _mesh->getNumberOfElements(MED_EDGE,MED_ALL_ELEMENTS);
- else
- THROW_SALOME_CORBA_EXCEPTION("Pb ", \
- SALOME::INTERNAL_ERROR);
- }
-
- myseq->length(nbelements);
- const int * numbers=_mesh->getReverseConnectivityIndex(convertIdlConnToMedConn(mode));
- for (int i=0;i<nbelements;i++)
- {
- myseq[i]=numbers[i];
- }
- }
- catch(...)
- {
- MESSAGE("Unable to acces reverse connectivities index");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object"\
- ,SALOME::INTERNAL_ERROR);
- }
- return myseq._retn();
-}
-//=============================================================================
-/*!
- * CORBA: Returns number of families within the mesh
- */
-//=============================================================================
-CORBA::Long MESH_i::getNumberOfFamilies(SALOME_MED::medEntityMesh entity)
-throw (SALOME::SALOME_Exception)
-{
- if (_mesh==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
- SALOME::INTERNAL_ERROR);
- try
- {
- return _mesh->getNumberOfFamilies(convertIdlEntToMedEnt(entity));
- }
- catch(...)
- {
- MESSAGE("Unable to acces number of families of the mesh");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object"\
- ,SALOME::INTERNAL_ERROR);
- }
-}
-//=============================================================================
-/*!
- * CORBA: Returns number of groups within the mesh
- */
-//=============================================================================
-CORBA::Long MESH_i::getNumberOfGroups(SALOME_MED::medEntityMesh entity)
-throw (SALOME::SALOME_Exception)
-{
- if (_mesh==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
- SALOME::INTERNAL_ERROR);
- try
- {
- return _mesh->getNumberOfGroups(convertIdlEntToMedEnt(entity));
- }
- catch(...)
- {
- MESSAGE("Unable to acces number of groups of the mesh");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object"\
- ,SALOME::INTERNAL_ERROR);
- }
-}
-//=============================================================================
-/*!
- * CORBA: Returns references for families within the mesh
- */
-//=============================================================================
-SALOME_MED::Family_array * MESH_i::getFamilies(SALOME_MED::medEntityMesh entity)
-throw (SALOME::SALOME_Exception)
-{
- if (_mesh==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
- SALOME::INTERNAL_ERROR);
- SALOME_MED::Family_array_var myseq = new SALOME_MED::Family_array;
- try
- {
- int nbfam= _mesh->getNumberOfFamilies(convertIdlEntToMedEnt(entity));
- myseq->length(nbfam);
- vector<FAMILY*> fam(nbfam);
- fam = _mesh->getFamilies(convertIdlEntToMedEnt(entity));
- for (int i=0;i<nbfam;i++)
- {
- FAMILY_i * f1=new FAMILY_i(fam[i]);
- SALOME_MED::FAMILY_ptr f2 =
- f1->POA_SALOME_MED::FAMILY::_this();
- f1->_remove_ref();
- myseq[i] = f2;
- }
- }
- catch(...)
- {
- MESSAGE("Unable to acces families of the mesh");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object"\
- ,SALOME::INTERNAL_ERROR);
- }
- return myseq._retn();
-}
-//=============================================================================
-/*!
- * CORBA: Returns references for family i within the mesh
- */
-//=============================================================================
-SALOME_MED::FAMILY_ptr MESH_i::getFamily(SALOME_MED::medEntityMesh entity,
- CORBA::Long i)
-throw (SALOME::SALOME_Exception)
-{
- if (_mesh==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
- SALOME::INTERNAL_ERROR);
- try
- {
- const FAMILY * fam = _mesh->getFamily(convertIdlEntToMedEnt(entity),i);
- FAMILY_i * f1=new FAMILY_i(fam);
- SALOME_MED::FAMILY_ptr f2 = f1->POA_SALOME_MED::FAMILY::_this();
- f1->_remove_ref();
- return (SALOME_MED::FAMILY::_duplicate(f2));
- }
- catch(...)
- {
- MESSAGE("Unable to acces specified family of the mesh");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Family C++ Object"\
- ,SALOME::INTERNAL_ERROR);
- }
-
-}
-//=============================================================================
-/*!
- * CORBA: Returns references for groups within the mesh
- */
-//=============================================================================
-SALOME_MED::Group_array * MESH_i::getGroups(SALOME_MED::medEntityMesh entity)
-throw (SALOME::SALOME_Exception)
-{
- if (_mesh==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
- SALOME::INTERNAL_ERROR);
- SALOME_MED::Group_array_var myseq = new SALOME_MED::Group_array;
- try
- {
- int nbgroups = _mesh->getNumberOfGroups(convertIdlEntToMedEnt(entity));
- myseq->length(nbgroups);
- vector<GROUP*> groups(nbgroups);
- groups = _mesh->getGroups(convertIdlEntToMedEnt(entity));
- for (int i=0;i<nbgroups;i++)
- {
- GROUP_i * f1=new GROUP_i(groups[i]);
- SALOME_MED::GROUP_ptr f2 = f1->POA_SALOME_MED::GROUP::_this();
- f1->_remove_ref();
- myseq[i] = f2;
- }
- }
- catch(...)
- {
- MESSAGE("Unable to acces number of groups of the mesh");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object"\
- ,SALOME::INTERNAL_ERROR);
- }
- return myseq._retn();
-}
-//=============================================================================
-/*!
- * CORBA: Returns references for group i within the mesh
- */
-//=============================================================================
-SALOME_MED::GROUP_ptr MESH_i::getGroup(SALOME_MED::medEntityMesh entity,
- CORBA::Long i)
-throw (SALOME::SALOME_Exception)
-{
- if (_mesh==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
- SALOME::INTERNAL_ERROR);
- try
- {
- const GROUP * grou = _mesh->getGroup(convertIdlEntToMedEnt(entity),i);
- GROUP_i * f1=new GROUP_i(grou);
- SALOME_MED::GROUP_ptr f2 = f1->POA_SALOME_MED::GROUP::_this();
- f1->_remove_ref();
- return (SALOME_MED::GROUP::_duplicate(f2));
- }
- catch(...)
- {
- MESSAGE("Unable to acces specified group of the mesh");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Mesh C++ Object"\
- ,SALOME::INTERNAL_ERROR);
- }
-}
-//=============================================================================
-/*!
- * CORBA:
- */
-//=============================================================================
-SALOME_MED::FIELD_ptr MESH_i::getVolume(SALOME_MED::SUPPORT_ptr mySupport)
-throw (SALOME::SALOME_Exception)
-{
- if (_mesh==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
- SALOME::INTERNAL_ERROR);
- try
- {
- int sup = mySupport->getCorbaIndex();
- ASSERT(SUPPORT_i::supportMap.find(sup)!=SUPPORT_i::supportMap.end());
- const SUPPORT * myCppSupport=SUPPORT_i::supportMap[sup];
- ::FIELD<double>*f=_mesh->getVolume( myCppSupport);
- FIELDDOUBLE_i * medf = new FIELDDOUBLE_i(mySupport,f);
- POA_SALOME_MED::FIELDDOUBLE_tie<FIELDDOUBLE_i> * f1 =
- new POA_SALOME_MED::FIELDDOUBLE_tie<FIELDDOUBLE_i>(medf,true);
- SALOME_MED::FIELDDOUBLE_ptr f2 = f1->_this();
- f1->_remove_ref();
- return (SALOME_MED::FIELD::_duplicate(f2));
- }
- catch(...)
- {
- MESSAGE("Unable to get the volume ");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Support C++ Object"\
- ,SALOME::INTERNAL_ERROR);
- }
-}
-//=============================================================================
-/*!
- * CORBA:
- */
-//=============================================================================
-SALOME_MED::FIELD_ptr MESH_i::getArea(SALOME_MED::SUPPORT_ptr mySupport)
-throw (SALOME::SALOME_Exception)
-{
- if (_mesh==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
- SALOME::INTERNAL_ERROR);
- try
- {
- int sup = mySupport->getCorbaIndex();
- ASSERT(SUPPORT_i::supportMap.find(sup)!=SUPPORT_i::supportMap.end());
- const SUPPORT * myCppSupport=SUPPORT_i::supportMap[sup];
- ::FIELD<double>*f=_mesh->getArea( myCppSupport);
- FIELDDOUBLE_i * medf = new FIELDDOUBLE_i(mySupport,f);
- POA_SALOME_MED::FIELDDOUBLE_tie<FIELDDOUBLE_i> * f1 =
- new POA_SALOME_MED::FIELDDOUBLE_tie<FIELDDOUBLE_i>(medf,true);
- SALOME_MED::FIELDDOUBLE_ptr f2 = f1->_this();
- f1->_remove_ref();
- return (SALOME_MED::FIELD::_duplicate(f2));
- }
- catch(...)
- {
- MESSAGE("Unable to get the area ");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Support C++ Object"\
- ,SALOME::INTERNAL_ERROR);
- }
-}
-//=============================================================================
-/*!
- * CORBA:
- */
-//=============================================================================
-SALOME_MED::FIELD_ptr MESH_i::getLength(SALOME_MED::SUPPORT_ptr mySupport)
-throw (SALOME::SALOME_Exception)
-{
- if (_mesh==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
- SALOME::INTERNAL_ERROR);
- try
- {
- int sup = mySupport->getCorbaIndex();
- ASSERT(SUPPORT_i::supportMap.find(sup)!=SUPPORT_i::supportMap.end());
- const SUPPORT * myCppSupport=SUPPORT_i::supportMap[sup];
- ::FIELD<double>*f=_mesh->getLength( myCppSupport);
- FIELDDOUBLE_i * medf = new FIELDDOUBLE_i(mySupport,f);
- POA_SALOME_MED::FIELDDOUBLE_tie<FIELDDOUBLE_i> * f1 =
- new POA_SALOME_MED::FIELDDOUBLE_tie<FIELDDOUBLE_i>(medf,true);
- SALOME_MED::FIELDDOUBLE_ptr f2 = f1->_this();
- f1->_remove_ref();
- return (SALOME_MED::FIELD::_duplicate(f2));
- }
- catch(...)
- {
- MESSAGE("Unable to get the length ");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Support C++ Object"\
- ,SALOME::INTERNAL_ERROR);
- }
-}
-//=============================================================================
-/*!
- * CORBA:
- */
-//=============================================================================
-SALOME_MED::FIELD_ptr MESH_i::getNormal(SALOME_MED::SUPPORT_ptr mySupport)
-throw (SALOME::SALOME_Exception)
-{
- if (_mesh==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
- SALOME::INTERNAL_ERROR);
- try
- {
- int sup = mySupport->getCorbaIndex();
- ASSERT(SUPPORT_i::supportMap.find(sup)!=SUPPORT_i::supportMap.end());
- const SUPPORT * myCppSupport=SUPPORT_i::supportMap[sup];
- ::FIELD<double>*f=_mesh->getNormal( myCppSupport);
- FIELDDOUBLE_i * medf = new FIELDDOUBLE_i(mySupport,f);
- POA_SALOME_MED::FIELDDOUBLE_tie<FIELDDOUBLE_i> * f1 =
- new POA_SALOME_MED::FIELDDOUBLE_tie<FIELDDOUBLE_i>(medf,true);
- SALOME_MED::FIELDDOUBLE_ptr f2 = f1->_this();
- f1->_remove_ref();
- return (SALOME_MED::FIELD::_duplicate(f2));
- }
- catch(...)
- {
- MESSAGE("Unable to get the normal ");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Support C++ Object"\
- ,SALOME::INTERNAL_ERROR);
- }
-}
-//=============================================================================
-/*!
- * CORBA:
- */
-//=============================================================================
-SALOME_MED::FIELD_ptr MESH_i::getBarycenter(SALOME_MED::SUPPORT_ptr mySupport)
-throw (SALOME::SALOME_Exception)
-{
- if (_mesh==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
- SALOME::INTERNAL_ERROR);
- try
- {
- int sup = mySupport->getCorbaIndex();
- ASSERT(SUPPORT_i::supportMap.find(sup)!=SUPPORT_i::supportMap.end());
- const SUPPORT * myCppSupport=SUPPORT_i::supportMap[sup];
- ::FIELD<double>*f=_mesh->getBarycenter( myCppSupport);
- FIELDDOUBLE_i * medf = new FIELDDOUBLE_i(mySupport,f);
- POA_SALOME_MED::FIELDDOUBLE_tie<FIELDDOUBLE_i> * f1 =
- new POA_SALOME_MED::FIELDDOUBLE_tie<FIELDDOUBLE_i>(medf,true);
- SALOME_MED::FIELDDOUBLE_ptr f2 = f1->_this();
- f1->_remove_ref();
- return (SALOME_MED::FIELD::_duplicate(f2));
- }
- catch(...)
- {
- MESSAGE("Unable to get the barycenter ");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Support C++ Object"\
- ,SALOME::INTERNAL_ERROR);
- }
-}
-//=============================================================================
-/*!
- * CORBA:
- */
-//=============================================================================
-SALOME_MED::FIELD_ptr MESH_i::getNeighbourhood(SALOME_MED::SUPPORT_ptr mySupport)
-throw (SALOME::SALOME_Exception)
-{
- if (_mesh==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
- SALOME::INTERNAL_ERROR);
- MESSAGE("Not Implemented");
-}
-//=============================================================================
-/*!
- * CORBA: add the Mesh in the StudyManager
- */
-//=============================================================================
-void MESH_i::addInStudy(SALOMEDS::Study_ptr myStudy,SALOME_MED::MESH_ptr myIor )
-throw (SALOME::SALOME_Exception)
-{
- BEGIN_OF("MED_Mesh_i::addInStudy");
- if ( _meshId != "" )
- {
- MESSAGE("Mesh already in Study");
- THROW_SALOME_CORBA_EXCEPTION("Mesh already in Study", \
- SALOME::BAD_PARAM);
- };
-
- SALOMEDS::StudyBuilder_var myBuilder = myStudy->NewBuilder();
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeName_var aName;
- SALOMEDS::AttributeIOR_var aIOR;
-
- // Find SComponent labelled 'MED'
- // SALOMEDS::SComponent_var medfather = myStudy->FindComponent("Med");
- SALOMEDS::SComponent_var medfather = myStudy->FindComponent("MED");
- if ( CORBA::is_nil(medfather) )
- THROW_SALOME_CORBA_EXCEPTION("SComponent labelled 'Med' not Found",SALOME::INTERNAL_ERROR);
-
- // Create SObject labelled 'MESH' if it doesn't already exit
- SALOMEDS::SObject_var medmeshfather = myStudy->FindObject("MEDMESH");
- if ( CORBA::is_nil(medmeshfather) )
- {
- MESSAGE("Add Object MEDMESH");
- medmeshfather = myBuilder->NewObject(medfather);
- //medmeshfather.Name = "MEDMESH" ;
- anAttr = myBuilder->FindOrCreateAttribute(medmeshfather, "AttributeName");
- aName = SALOMEDS::AttributeName::_narrow(anAttr);
- aName->SetValue("MEDMESH");
-
- } ;
-
- MESSAGE("Add a mesh Object under MED/MEDMESH");
- myBuilder->NewCommand();
- SALOMEDS::SObject_var newObj = myBuilder->NewObject(medmeshfather);
-
- ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
- ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting()) ;
- CORBA::ORB_var &orb = init(0,0);
- string iorStr = orb->object_to_string(myIor);
- anAttr = myBuilder->FindOrCreateAttribute(newObj, "AttributeIOR");
- aIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
- aIOR->SetValue(iorStr.c_str());
- anAttr = myBuilder->FindOrCreateAttribute(newObj, "AttributeName");
- aName = SALOMEDS::AttributeName::_narrow(anAttr);
- aName->SetValue(_mesh->getName().c_str());
- _meshId = newObj->GetID();
- myBuilder->CommitCommand();
-
- END_OF("Mesh_i::addInStudy(SALOMEDS::Study_ptr myStudy)");
-}
-//=============================================================================
-/*!
- * CORBA: add the Mesh in the StudyManager
- */
-//=============================================================================
-void MESH_i::addInStudy(SALOMEDS::Study_ptr myStudy,SALOME_MED::MESH_ptr myIor,const string & fileName )
-throw (SALOME::SALOME_Exception)
-{
- BEGIN_OF("MED_Mesh_i::addInStudy");
- if ( _meshId != "" )
- {
- MESSAGE("Mesh already in Study");
- THROW_SALOME_CORBA_EXCEPTION("Mesh already in Study", \
- SALOME::BAD_PARAM);
- };
-
- SALOMEDS::StudyBuilder_var myBuilder = myStudy->NewBuilder();
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeName_var aName;
- SALOMEDS::AttributeIOR_var aIOR;
- SALOMEDS::AttributeComment_var aComment;
-
- // Find SComponent labelled 'Med'
- // SALOMEDS::SComponent_var medfather = myStudy->FindComponent("Med");
- SALOMEDS::SComponent_var medfather = myStudy->FindComponent("MED");
- if ( CORBA::is_nil(medfather) )
- THROW_SALOME_CORBA_EXCEPTION("SComponent labelled 'Med' not Found",SALOME::INTERNAL_ERROR);
-
- // Create SObject labelled 'MESH' if it doesn't already exit
- SALOMEDS::SObject_var medmeshfather = myStudy->FindObject("MEDMESH");
- if ( CORBA::is_nil(medmeshfather) )
- {
- MESSAGE("Add Object MEDMESH");
- medmeshfather = myBuilder->NewObject(medfather);
- //medmeshfather.Name = "MEDMESH" ;
- anAttr = myBuilder->FindOrCreateAttribute(medmeshfather, "AttributeName");
- aName = SALOMEDS::AttributeName::_narrow(anAttr);
- aName->SetValue("MEDMESH");
-
- } ;
-
- MESSAGE("Add a mesh Object under MED/MEDMESH");
- myBuilder->NewCommand();
- SALOMEDS::SObject_var newObj = myBuilder->NewObject(medmeshfather);
-
- ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
- ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting()) ;
- CORBA::ORB_var &orb = init(0,0);
- string iorStr = orb->object_to_string(myIor);
- anAttr = myBuilder->FindOrCreateAttribute(newObj, "AttributeIOR");
- aIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
- aIOR->SetValue(iorStr.c_str());
- anAttr = myBuilder->FindOrCreateAttribute(newObj, "AttributeName");
- aName = SALOMEDS::AttributeName::_narrow(anAttr);
- aName->SetValue(_mesh->getName().c_str());
- anAttr = myBuilder->FindOrCreateAttribute(newObj, "AttributeComment");
- aComment = SALOMEDS::AttributeComment::_narrow(anAttr);
- aComment->SetValue(fileName.c_str());
- _meshId = newObj->GetID();
- myBuilder->CommitCommand();
-
- END_OF("Mesh_i::addInStudy(SALOMEDS::Study_ptr myStudy)");
-}
-//=============================================================================
-
-//=============================================================================
-/*!
- * CORBA: write mesh in a med file
- */
-//=============================================================================
-void MESH_i::write(CORBA::Long i, const char* driverMeshName)
-throw (SALOME::SALOME_Exception)
-{
- if (_mesh==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
- SALOME::INTERNAL_ERROR);
- try
- {
- _mesh->write(i,driverMeshName);
- }
- catch(...)
- {
- MESSAGE("Unable to write the mesh ");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Support C++ Object"\
- ,SALOME::INTERNAL_ERROR);
- }
-}
-//=============================================================================
-/*!
- * CORBA: read mesh in a med file
- */
-//=============================================================================
-void MESH_i::read(CORBA::Long i)
-throw (SALOME::SALOME_Exception)
-{
- if (_mesh==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
- SALOME::INTERNAL_ERROR);
- try
- {
- _mesh->read(i);
- }
- catch(...)
- {
- MESSAGE("Unable to read the mesh ");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Support C++ Object"\
- ,SALOME::INTERNAL_ERROR);
- }
-}
-//=============================================================================
-/*!
- * CORBA : release driver
- */
-//=============================================================================
-void MESH_i::rmDriver(CORBA::Long i)
-throw (SALOME::SALOME_Exception)
-{
- if (_mesh==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
- SALOME::INTERNAL_ERROR);
- try
- {
- _mesh->rmDriver();
- }
- catch(...)
- {
- MESSAGE("Unable to unlink the mesh from the driver ");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Support C++ Object"\
- ,SALOME::INTERNAL_ERROR);
- }
-}
-//=============================================================================
-/*!
- * CORBA : attach driver
- */
-//=============================================================================
-CORBA::Long MESH_i::addDriver(SALOME_MED::medDriverTypes driverType,
- const char* fileName, const char* meshName)
-throw (SALOME::SALOME_Exception)
-{
- if (_mesh==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Mesh", \
- SALOME::INTERNAL_ERROR);
- try
- {
- int drivernum=_mesh->addDriver(
- convertIdlDriverToMedDriver(driverType),
- fileName,
- meshName);
- return drivernum;
- }
- catch(...)
- {
- MESSAGE("Unable to link the mesh to the driver ");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Support C++ Object"\
- ,SALOME::INTERNAL_ERROR);
- }
-}
-
+++ /dev/null
-//=============================================================================
-// File : Mesh_i.hxx
-// Project : SALOME
-// Author : EDF
-// Copyright : EDF 2002
-// $Header: /export/home/CVS/SALOME_ROOT/MED/src/MedMem/Mesh_i.hxx
-//=============================================================================
-
-#ifndef _MED_MESH_I_HXX_
-#define _MED_MESH_I_HXX_
-
-#include <map>
-#include <string>
-
-#include <SALOMEconfig.h>
-//#include "SALOME_Component_i.hxx"
-#include CORBA_SERVER_HEADER(MED)
-#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
-//#include "MED.hh"
-
-class MESH;
-class MESH_i:
- public POA_SALOME_MED::MESH,
- public PortableServer::RefCountServantBase
-// public Engines_Component_i
-{
-public :
- static map < int,::MESH *> meshMap;
-private :
- static int meshIndex;
-
-private :
-
-protected:
- // C++ object containing values
- ::MESH * const _mesh;
- const int _corbaIndex;
- string _meshId;
-
-
-public:
-
- // Constructors and associated internal methods
- MESH_i();
- MESH_i(::MESH * const m);
- MESH_i(MESH_i & m);
- ~MESH_i();
-
- // IDL Methods
- char * getName() throw (SALOME::SALOME_Exception);
-
- CORBA::Long getSpaceDimension() throw (SALOME::SALOME_Exception);
-
- CORBA::Long getMeshDimension() throw (SALOME::SALOME_Exception);
-
- char * getCoordinatesSystem()
- throw (SALOME::SALOME_Exception);
-
- Engines::double_array* getCoordinates(SALOME_MED::medModeSwitch typeSwitch)
- throw (SALOME::SALOME_Exception);
-
- Engines::string_array* getCoordinatesNames()
- throw (SALOME::SALOME_Exception);
-
- Engines::string_array* getCoordinatesUnits()
- throw (SALOME::SALOME_Exception);
-
- CORBA::Long getNumberOfNodes()
- throw (SALOME::SALOME_Exception);
-
- CORBA::Long getNumberOfTypes (SALOME_MED::medEntityMesh entity)
- throw (SALOME::SALOME_Exception);
-
- SALOME_MED::medGeometryElement_array* getTypes(SALOME_MED::medEntityMesh entity)
- throw (SALOME::SALOME_Exception);
-
- CORBA::Long getNumberOfElements (SALOME_MED::medEntityMesh entity,
- SALOME_MED::medGeometryElement geomElement)
- throw (SALOME::SALOME_Exception);
-
- Engines::long_array* getConnectivity(SALOME_MED::medModeSwitch typeSwitch,
- SALOME_MED::medConnectivity mode,
- SALOME_MED::medEntityMesh entity,
- SALOME_MED::medGeometryElement geomElement)
- throw (SALOME::SALOME_Exception);
-
- Engines::long_array* getConnectivityIndex(SALOME_MED::medConnectivity mode,
- SALOME_MED::medEntityMesh entity)
- throw (SALOME::SALOME_Exception);
-
- CORBA::Long getElementNumber(SALOME_MED::medConnectivity mode,
- SALOME_MED::medEntityMesh entity,
- SALOME_MED::medGeometryElement type,
- const Engines::long_array& connectivity)
- throw (SALOME::SALOME_Exception);
-
- Engines::long_array* getReverseConnectivity(SALOME_MED::medConnectivity mode)
- throw (SALOME::SALOME_Exception);
-
- Engines::long_array* getReverseConnectivityIndex(SALOME_MED::medConnectivity mode)
- throw (SALOME::SALOME_Exception);
-
- // Family and Group
- CORBA::Long getNumberOfFamilies (SALOME_MED::medEntityMesh entity)
- throw (SALOME::SALOME_Exception);
- CORBA::Long getNumberOfGroups (SALOME_MED::medEntityMesh entity)
- throw (SALOME::SALOME_Exception);
- SALOME_MED::Family_array* getFamilies (SALOME_MED::medEntityMesh entity)
- throw (SALOME::SALOME_Exception);
- SALOME_MED::FAMILY_ptr getFamily (SALOME_MED::medEntityMesh entity,
- CORBA::Long i)
- throw (SALOME::SALOME_Exception);
- SALOME_MED::Group_array* getGroups (SALOME_MED::medEntityMesh entity)
- throw (SALOME::SALOME_Exception);
- SALOME_MED::GROUP_ptr getGroup (SALOME_MED::medEntityMesh entity,
- CORBA::Long i)
- throw (SALOME::SALOME_Exception);
- //
- SALOME_MED::FIELD_ptr getVolume (SALOME_MED::SUPPORT_ptr mySupport)
- throw (SALOME::SALOME_Exception);
- SALOME_MED::FIELD_ptr getArea (SALOME_MED::SUPPORT_ptr mySupport)
- throw (SALOME::SALOME_Exception);
- SALOME_MED::FIELD_ptr getLength (SALOME_MED::SUPPORT_ptr mySupport)
- throw (SALOME::SALOME_Exception);
- SALOME_MED::FIELD_ptr getNormal (SALOME_MED::SUPPORT_ptr mySupport)
- throw (SALOME::SALOME_Exception);
- SALOME_MED::FIELD_ptr getBarycenter (SALOME_MED::SUPPORT_ptr mySupport)
- throw (SALOME::SALOME_Exception);
- SALOME_MED::FIELD_ptr getNeighbourhood (SALOME_MED::SUPPORT_ptr mySupport)
- throw (SALOME::SALOME_Exception);
-
-
- // Others
- void addInStudy (SALOMEDS::Study_ptr myStudy,
- SALOME_MED::MESH_ptr myIor) throw (SALOME::SALOME_Exception);
- void addInStudy (SALOMEDS::Study_ptr myStudy,
- SALOME_MED::MESH_ptr myIor,
- const string & fileName) throw (SALOME::SALOME_Exception);
- CORBA::Long addDriver (SALOME_MED::medDriverTypes driverType,
- const char* fileName, const char* meshName)
- throw (SALOME::SALOME_Exception);
- void rmDriver (CORBA::Long i) throw (SALOME::SALOME_Exception);
- void read (CORBA::Long i) throw (SALOME::SALOME_Exception);
- void write (CORBA::Long i, const char* driverMeshName)
- throw (SALOME::SALOME_Exception);
-
- // Cuisine interne
- CORBA::Long getCorbaIndex() throw (SALOME::SALOME_Exception);
- ::MESH * constructConstMesh() const;
-};
-
-#endif /* _MED_MESH_I_HXX_ */
+++ /dev/null
-Users Guide
-
-1. You can see file med_test2.cxx for an example of using library
-
-2. To get meshes and fields from an MED file, the simplest way is to create a MED object with argument string filename. It scan MED file to get all meshes and fields in it. After you could say to MED object to read a particular mesh or field and get it with appropriate method of MED object (see MED.hxx and med_test2.cxx)
-
-3. When you have a Mesh object (or Field object), you could get information in using get_... methods (see Mesh.hxx, Support.hxx, Field.hxx and med_test2.cxx)
-
-I work on documentation with doxygen tool.
-
-
-Patrick GOLDBRONN
-DEN/DM2S/SFME/LGLS
-patrick.goldbronn@cea.fr
-tel : 0169087355
+++ /dev/null
-//=============================================================================
-// File : Support_i.cxx
-// Project : SALOME
-// Author : EDF
-// Copyright : EDF 2002
-// $Header: /export/home/CVS/SALOME_ROOT/MED/src/MedMem/Support_i.cxx
-//=============================================================================
-
-#include "utilities.h"
-#include "Utils_CorbaException.hxx"
-#include "Utils_ORB_INIT.hxx"
-#include "Utils_SINGLETON.hxx"
-
-#include CORBA_SERVER_HEADER(MED)
-#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
-
-
-#include "MEDMEM_define.hxx"
-#include "MEDMEM_Support.hxx"
-
-#include "Support_i.hxx"
-#include "Mesh_i.hxx"
-#include "convert.hxx"
-
-// Initialisation des variables statiques
-map < int, ::SUPPORT *> SUPPORT_i::supportMap ;
-int SUPPORT_i::supportIndex = 0 ;
-
-
-//=============================================================================
-/*!
- * Default constructor
- */
-//=============================================================================
-SUPPORT_i::SUPPORT_i() :_support((::SUPPORT *)NULL)
-{
- BEGIN_OF("Default Constructor SUPPORT_i");
- END_OF("Default Constructor SUPPORT_i");
-}
-
-//=============================================================================
-/*!
- * Constructor
- */
-//=============================================================================
-SUPPORT_i::SUPPORT_i(const ::SUPPORT * const s) :_support(s),
- _corbaIndex(SUPPORT_i::supportIndex++)
-{
- BEGIN_OF("Constructor SUPPORT_i");
- SUPPORT_i::supportMap[_corbaIndex]=(::SUPPORT *)_support;
- END_OF("Constructor SUPPORT_i");
-}
-//=============================================================================
-/*!
- * Constructor
- */
-//=============================================================================
-SUPPORT_i::SUPPORT_i(const SUPPORT_i &s) :_support(s._support),
- _corbaIndex(SUPPORT_i::supportIndex++)
-{
- BEGIN_OF("Constructor SUPPORT_i");
- SUPPORT_i::supportMap[_corbaIndex]=(::SUPPORT *)_support;
- END_OF("Constructor SUPPORT_i");
-}
-//=============================================================================
-/*!
- * Destructor
- */
-//=============================================================================
-
-SUPPORT_i::~SUPPORT_i()
-{
-}
-//=============================================================================
-/*!
- * CORBA: Accessor for Corba Index
- */
-//=============================================================================
-
-CORBA::Long SUPPORT_i::getCorbaIndex()
-throw (SALOME::SALOME_Exception)
-{
- if (_support==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Support", \
- SALOME::INTERNAL_ERROR);
- return _corbaIndex;
-}
-
-//=============================================================================
-/*!
- * CORBA: Accessor for Name
- */
-//=============================================================================
-
-char * SUPPORT_i::getName()
-throw (SALOME::SALOME_Exception)
-{
- if (_support==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Support", \
- SALOME::INTERNAL_ERROR);
- try
- {
- return CORBA::string_dup(_support->getName().c_str());
- }
- catch(...)
- {
- MESSAGE("Unable to access the name of the support ");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Support C++ Object"\
- ,SALOME::INTERNAL_ERROR);
- }
-
-}
-
-//=============================================================================
-/*!
- * CORBA: Accessor for Description
- */
-//=============================================================================
-
-char* SUPPORT_i::getDescription()
-throw (SALOME::SALOME_Exception)
-{
- if (_support==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Support", \
- SALOME::INTERNAL_ERROR);
- try
- {
- return CORBA::string_dup(_support->getDescription().c_str());
- }
- catch(...)
- {
- MESSAGE("Unable to access the description of the support ");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Support C++ Object"\
- ,SALOME::INTERNAL_ERROR);
- }
-}
-
-//=============================================================================
-/*!
- * CORBA: Accessor for Mesh
- */
-//=============================================================================
-
-SALOME_MED::MESH_ptr SUPPORT_i::getMesh()
-throw (SALOME::SALOME_Exception)
-{
- BEGIN_OF("SALOME_MED::MESH_ptr SUPPORT_i::getMesh()");
-
- if (_support==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Support", \
- SALOME::INTERNAL_ERROR);
- try
- {
- MESH * mesh = _support->getMesh();
-
- SCRUTE(mesh) ;
-
- MESH_i * m1 = new MESH_i(mesh);
- SALOME_MED::MESH_ptr m2 = m1->POA_SALOME_MED::MESH::_this();
-
-
-
- MESSAGE("SALOME_MED::MESH_ptr SUPPORT_i::getMesh() checking des pointeurs CORBA");
-
- SCRUTE(m1);
- SCRUTE(m2);
-
- m1->_remove_ref();
-
- END_OF("SALOME_MED::MESH_ptr SUPPORT_i::getMesh()");
-
- return (SALOME_MED::MESH::_duplicate(m2));
- }
- catch(...)
- {
- MESSAGE("Unable to access the assoicated mesh");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Support C++ Object"\
- ,SALOME::INTERNAL_ERROR);
- }
-}
-
-//=============================================================================
-/*!
- * CORBA: boolean indicating if support concerns all elements
- */
-//=============================================================================
-
-CORBA::Boolean SUPPORT_i::isOnAllElements()
-throw (SALOME::SALOME_Exception)
-{
- if (_support==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Support", \
- SALOME::INTERNAL_ERROR);
- try
- {
- return _support->isOnAllElements();
- }
- catch(...)
- {
- MESSAGE("Unable to access the type of the support");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Support C++ Object"\
- ,SALOME::INTERNAL_ERROR);
- }
-}
-
-//=============================================================================
-/*!
- * CORBA: Accessor for type of support's entity
- */
-//=============================================================================
-
-SALOME_MED::medEntityMesh SUPPORT_i::getEntity()
-throw (SALOME::SALOME_Exception)
-{
- BEGIN_OF("SALOME_MED::medEntityMesh SUPPORT_i::getEntity()");
-
- if (_support==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Support", \
- SALOME::INTERNAL_ERROR);
- try
- {
- END_OF("SALOME_MED::medEntityMesh SUPPORT_i::getEntity()");
- return convertMedEntToIdlEnt(_support->getEntity());
- }
- catch(...)
- {
- MESSAGE("Unable to access support s entity");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Support C++ Object", \
- SALOME::INTERNAL_ERROR);
- }
-}
-
-//=============================================================================
-/*!
- * CORBA: Accessor for types of geometry elements
- */
-//=============================================================================
-
-SALOME_MED::medGeometryElement_array * SUPPORT_i::getTypes()
-throw (SALOME::SALOME_Exception)
-{
- if (_support==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Support", \
- SALOME::INTERNAL_ERROR);
- SALOME_MED::medGeometryElement_array_var myseq = new SALOME_MED::medGeometryElement_array;
- try
- {
- int mySeqLength=_support->getNumberOfTypes();
- myseq->length(mySeqLength);
- const medGeometryElement * elemts = _support->getTypes();
- for (int i=0;i<mySeqLength;i++)
- {
- myseq[i]=convertMedEltToIdlElt(elemts[i]);
- }
- }
- catch(...)
- {
- MESSAGE("Unable to access support different types");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Support C++ Object", \
- SALOME::INTERNAL_ERROR);
- }
- return myseq._retn();
-}
-
-//=============================================================================
-/*!
- * CORBA: Number of different types of geometry elements
- * existing in the support
- */
-//=============================================================================
-CORBA::Long SUPPORT_i::getNumberOfElements(SALOME_MED::medGeometryElement geomElement)
-throw (SALOME::SALOME_Exception)
-{
-
- SCRUTE(geomElement);
- SCRUTE(SALOME_MED::MED_ALL_ELEMENTS);
-
- if (_support==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Support", \
- SALOME::INTERNAL_ERROR);
- try
- {
- return _support->getNumberOfElements(convertIdlEltToMedElt(geomElement));
- }
- catch(...)
- {
- MESSAGE("Unable to access the number of support different types");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Support C++ Object"\
- ,SALOME::INTERNAL_ERROR);
- }
-
-}
-
-//=============================================================================
-/*!
- * CORBA: get Nodes
- */
-//=============================================================================
-
-Engines::long_array * SUPPORT_i::getNumber(SALOME_MED::medGeometryElement geomElement)
-throw (SALOME::SALOME_Exception)
-{
- SCRUTE(_support);
- SCRUTE(geomElement);
- SCRUTE(convertIdlEltToMedElt(geomElement));
-
- if (_support==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Support", \
- SALOME::INTERNAL_ERROR);
- Engines::long_array_var myseq= new Engines::long_array;
- try
- {
- int nbelements=_support->getNumberOfElements(convertIdlEltToMedElt(geomElement));
- myseq->length(nbelements);
-SCRUTE(_support->getName());
-SCRUTE(nbelements);
-SCRUTE(convertIdlEltToMedElt(geomElement));
- const int * numbers=_support->getNumber(convertIdlEltToMedElt(geomElement));
- for (int i=0;i<nbelements;i++)
- {
- myseq[i]=numbers[i];
-SCRUTE(numbers[i]);
- }
- }
- catch(...)
- {
- MESSAGE("Unable to access the support optionnal index");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Support C++ Object"\
- ,SALOME::INTERNAL_ERROR);
- }
- return myseq._retn();
-
-}
-//=============================================================================
-/*!
- * CORBA: Global Nodes Index (optionnaly designed by the user)
- * CORBA: ??????????????????????????????
- */
-//=============================================================================
-
-Engines::long_array * SUPPORT_i::getNumberIndex()
-throw (SALOME::SALOME_Exception)
-{
- if (_support==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Support", \
- SALOME::INTERNAL_ERROR);
- Engines::long_array_var myseq= new Engines::long_array;
- try
- {
- MESSAGE ("Nombre d'elements mis de façon stupide a MED_ALL_ELEMENTS");
- int nbelements=_support->getNumberOfElements(::MED_ALL_ELEMENTS);
- myseq->length(nbelements);
- const int * numbers=_support->getNumberIndex();
- for (int i=0;i<nbelements;i++)
- {
- myseq[i]=numbers[i];
- }
- }
- catch(...)
- {
- MESSAGE("Unable to access the support index");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Support C++ Object"\
- ,SALOME::INTERNAL_ERROR);
- }
- return myseq._retn();
-
-}
-
-//=============================================================================
-/*!
- * CORBA: Array containing indexes for elements included in the support
- */
-//=============================================================================
-
-CORBA::Long SUPPORT_i::getNumberOfGaussPoints(SALOME_MED::medGeometryElement geomElement)
-throw (SALOME::SALOME_Exception)
-{
- if (_support==NULL)
- THROW_SALOME_CORBA_EXCEPTION("No associated Support", \
- SALOME::INTERNAL_ERROR);
- try
- {
- return _support->getNumberOfGaussPoint(convertIdlEltToMedElt(geomElement));
- }
- catch(...)
- {
- MESSAGE("Unable to access number of Gauss points");
- THROW_SALOME_CORBA_EXCEPTION("Unable to acces Support C++ Object"\
- ,SALOME::INTERNAL_ERROR);
- }
-}
-
-//=============================================================================
-/*!
- * CORBA: add the Support in the StudyManager
- */
-//=============================================================================
-void SUPPORT_i::addInStudy (SALOMEDS::Study_ptr myStudy, SALOME_MED::SUPPORT_ptr myIor)
- throw (SALOME::SALOME_Exception)
-{
- BEGIN_OF("SUPPORT_i::addInStudy");
-
- if ( _supportId != "" )
- {
- MESSAGE("Support already in Study");
- THROW_SALOME_CORBA_EXCEPTION("Support already in Study", \
- SALOME::BAD_PARAM);
- };
-
- SALOMEDS::StudyBuilder_var myBuilder = myStudy->NewBuilder();
- SALOMEDS::GenericAttribute_var anAttr;
- SALOMEDS::AttributeName_var aName;
- SALOMEDS::AttributeIOR_var aIOR;
-
- // Find SComponent labelled 'Med'
- MESSAGE("Find SComponent labelled 'Med'");
- // SALOMEDS::SComponent_var medfather = myStudy->FindComponent("Med");
- SALOMEDS::SComponent_var medfather = myStudy->FindComponent("MED");
- if ( CORBA::is_nil(medfather) )
- THROW_SALOME_CORBA_EXCEPTION("SComponent labelled 'Med' not Found",SALOME::INTERNAL_ERROR);
-
- if ( CORBA::is_nil(myStudy) )
- THROW_SALOME_CORBA_EXCEPTION("Study deleted !!!",SALOME::INTERNAL_ERROR);
-
- // Find SObject MESH (represent mesh in support)
- SALOMEDS::SObject_var medmeshfather = myStudy->FindObject("MEDMESH");
- if ( CORBA::is_nil(medmeshfather) )
- {
- cout << "On a leve l exception" << flush;
- THROW_SALOME_CORBA_EXCEPTION("SObject labelled 'MEDMESH' not Found",SALOME::INTERNAL_ERROR);
- }
- cout << "Find SObject MESH (represent mesh in support)"<< flush;
-
- string meshName = getMesh()->getName() ;
-
- // seulement sous Med : il peut y avoir le meme sous SMESH !!!
- SALOMEDS::SObject_var medsupportfather = myStudy->FindObject(meshName.c_str());
- if ( CORBA::is_nil(medsupportfather) )
- THROW_SALOME_CORBA_EXCEPTION("SObject Mesh in Support not Found",SALOME::INTERNAL_ERROR);
- // perhaps add MESH automatically ?
-
- MESSAGE("Add a support Object under MED/MESH/MESHNAME");
- SALOMEDS::SObject_var medsupfather = myStudy->FindObject("MEDSUPPORT");
- if ( CORBA::is_nil(medsupfather) )
- {
- MESSAGE("Add Object MEDSUPPORT");
- medsupfather = myBuilder->NewObject(medmeshfather);
- anAttr = myBuilder->FindOrCreateAttribute(medsupfather, "AttributeName");
- aName = SALOMEDS::AttributeName::_narrow(anAttr);
- aName->SetValue("MEDSUPPORT");
-
- } ;
-
-
- //myBuilder->NewCommand();
- SALOMEDS::SObject_var supportEntry = myStudy->FindObject(_support->getName().c_str());
- // c'est pas bon, car il faut rechercher uniquement sous le bon MESH !!!
- if ( CORBA::is_nil(supportEntry) )
- {
- // not already in study : we create it !
- SALOMEDS::SObject_var newObj = myBuilder->NewObject(medsupfather);
- ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
- ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting()) ;
- CORBA::ORB_var &orb = init(0,0);
- string iorStr = orb->object_to_string(myIor);
- anAttr = myBuilder->FindOrCreateAttribute(newObj, "AttributeIOR");
- aIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
- aIOR->SetValue(iorStr.c_str());
- anAttr = myBuilder->FindOrCreateAttribute(newObj, "AttributeName");
- aName = SALOMEDS::AttributeName::_narrow(anAttr);
- aName->SetValue(_support->getName().c_str());
- _supportId = newObj->GetID();
- }
- else
- {
- // already in study : put new AttributeIOR !
- ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
- ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting()) ;
- CORBA::ORB_var &orb = init(0,0);
- string iorStr = orb->object_to_string(myIor);
- anAttr = myBuilder->FindOrCreateAttribute(supportEntry, "AttributeIOR");
- aIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
- aIOR->SetValue(iorStr.c_str());
- }
- myBuilder->CommitCommand();
-
- END_OF("SUPPORT_i::addInStudy");
-}
+++ /dev/null
-//=============================================================================
-// File : Support_i.hxx
-// Project : SALOME
-// Author : EDF
-// Copyright : EDF 2002
-// $Header: /export/home/CVS/SALOME_ROOT/MED/src/MedMem/Support_i.hxx
-//=============================================================================
-
-#ifndef _MED_SUPPORT_I_HXX_
-#define _MED_SUPPORT_I_HXX_
-
-#include <map>
-#include <string>
-
-#include <SALOMEconfig.h>
-
-#include CORBA_SERVER_HEADER(MED)
-
-class SUPPORT;
-class SALOME_MED::MESH;
-
-class SUPPORT_i:
- public POA_SALOME_MED::SUPPORT,
- public PortableServer::RefCountServantBase
-{
-public :
- static map < int,::SUPPORT *> supportMap;
-private :
- static int supportIndex;
-
-protected :
-
- // C++ object containing values
- const ::SUPPORT * const _support;
- const int _corbaIndex ;
- string _supportId ;
-
-public:
-
- SUPPORT_i();
- ~SUPPORT_i();
-
- // Constructors and associated internal methods
- SUPPORT_i(const ::SUPPORT * const s);
- SUPPORT_i(const SUPPORT_i & s);
-
- // IDL Methods
- char * getName() throw (SALOME::SALOME_Exception);
- char * getDescription() throw (SALOME::SALOME_Exception);
- SALOME_MED::MESH_ptr getMesh() throw (SALOME::SALOME_Exception);
- CORBA::Boolean isOnAllElements() throw (SALOME::SALOME_Exception);
- SALOME_MED::medEntityMesh getEntity() throw (SALOME::SALOME_Exception);
- CORBA::Long getNumberOfElements(SALOME_MED::medGeometryElement geomElement)
- throw (SALOME::SALOME_Exception);
- Engines::long_array* getNumber(SALOME_MED::medGeometryElement geomElement)
- throw (SALOME::SALOME_Exception);
- Engines::long_array* getNumberIndex()
- throw (SALOME::SALOME_Exception);
- CORBA::Long getNumberOfGaussPoints(SALOME_MED::medGeometryElement geomElement)
- throw (SALOME::SALOME_Exception);
- SALOME_MED::medGeometryElement_array* getTypes()
- throw (SALOME::SALOME_Exception);
-
- // Others
- void addInStudy (SALOMEDS::Study_ptr myStudy,
- SALOME_MED::SUPPORT_ptr myIor)
- throw (SALOME::SALOME_Exception);
-
- // Cuisine interne
- CORBA::Long getCorbaIndex() throw (SALOME::SALOME_Exception);
-};
-
-#endif /* _MED_SUPPORT_I_HXX_ */
+++ /dev/null
-//=============================================================================
-// File : convert.cxx
-// Created : mer fév 20 15:47:57 CET 2002
-// Author : EDF
-// Project : SALOME
-// Copyright : EDF 2002
-// $Header: /export/home/CVS/SALOME_ROOT/MED/src/MedMem/convert.cxx
-//=============================================================================
-
-#include "utilities.h"
-#include "Utils_CorbaException.hxx"
-
-#include "convert.hxx"
-
-
-SALOME_MED::medGeometryElement convertMedEltToIdlElt(medGeometryElement element)
-throw (SALOME::SALOME_Exception)
-{
- switch (element)
- {
- case MED_NONE : return SALOME_MED::MED_NONE;
- case MED_POINT1 : return SALOME_MED::MED_POINT1;
- case MED_SEG2 : return SALOME_MED::MED_SEG2;
- case MED_SEG3 : return SALOME_MED::MED_SEG3;
- case MED_TRIA3 : return SALOME_MED::MED_TRIA3;
- case MED_QUAD4 : return SALOME_MED::MED_QUAD4;
- case MED_TRIA6 : return SALOME_MED::MED_TRIA6;
- case MED_QUAD8 : return SALOME_MED::MED_QUAD8;
- case MED_TETRA4 : return SALOME_MED::MED_TETRA4;
- case MED_PYRA5 : return SALOME_MED::MED_PYRA5;
- case MED_PENTA6 : return SALOME_MED::MED_PENTA6;
- case MED_HEXA8 : return SALOME_MED::MED_HEXA8;
- case MED_TETRA10 : return SALOME_MED::MED_TETRA10;
- case MED_PYRA13 : return SALOME_MED::MED_PYRA13;
- case MED_PENTA15 : return SALOME_MED::MED_PENTA15;
- case MED_HEXA20 : return SALOME_MED::MED_HEXA20;
- case MED_ALL_ELEMENTS : return SALOME_MED::MED_ALL_ELEMENTS;
- default :
- { MESSAGE("Unknown Geometry Element");
- THROW_SALOME_CORBA_EXCEPTION("Unknown Geometry Element",
- SALOME::INTERNAL_ERROR);
- }
- }
-}
-
-medGeometryElement convertIdlEltToMedElt(SALOME_MED::medGeometryElement element)
-throw (SALOME::SALOME_Exception)
-{
-
- SCRUTE(element);
-
- switch (element)
- {
- case SALOME_MED::MED_NONE : return MED_NONE;
- case SALOME_MED::MED_POINT1 : return MED_POINT1;
- case SALOME_MED::MED_SEG2 : return MED_SEG2;
- case SALOME_MED::MED_SEG3 : return MED_SEG3;
- case SALOME_MED::MED_TRIA3 : return MED_TRIA3;
- case SALOME_MED::MED_QUAD4 : return MED_QUAD4;
- case SALOME_MED::MED_TRIA6 : return MED_TRIA6;
- case SALOME_MED::MED_QUAD8 : return MED_QUAD8;
- case SALOME_MED::MED_TETRA4 : return MED_TETRA4;
- case SALOME_MED::MED_PYRA5 : return MED_PYRA5;
- case SALOME_MED::MED_PENTA6 : return MED_PENTA6;
- case SALOME_MED::MED_HEXA8 : return MED_HEXA8;
- case SALOME_MED::MED_TETRA10 : return MED_TETRA10;
- case SALOME_MED::MED_PYRA13 : return MED_PYRA13;
- case SALOME_MED::MED_PENTA15 : return MED_PENTA15;
- case SALOME_MED::MED_HEXA20 : return MED_HEXA20;
- case SALOME_MED::MED_ALL_ELEMENTS : return MED_ALL_ELEMENTS;
- default :
- { MESSAGE("unknown Geometry Element");
- THROW_SALOME_CORBA_EXCEPTION("Unknown Geometry Element",
- SALOME::INTERNAL_ERROR);
- }
- }
-}
-
-SALOME_MED::medEntityMesh convertMedEntToIdlEnt(medEntityMesh entity)
-throw (SALOME::SALOME_Exception)
-{
- switch (entity)
- {
- case MED_CELL : return SALOME_MED::MED_CELL;
- case MED_FACE : return SALOME_MED::MED_FACE;
- case MED_EDGE : return SALOME_MED::MED_EDGE;
- case MED_NODE : return SALOME_MED::MED_NODE;
- case MED_ALL_ENTITIES : return SALOME_MED::MED_ALL_ENTITIES;
- default :
- { MESSAGE("Unknown entity element");
- THROW_SALOME_CORBA_EXCEPTION("Unknown Entity Element",
- SALOME::INTERNAL_ERROR);
- }
- }
-}
-
-medEntityMesh convertIdlEntToMedEnt(SALOME_MED::medEntityMesh entity)
-throw (SALOME::SALOME_Exception)
-{
- switch (entity)
- {
- case SALOME_MED::MED_CELL : return MED_CELL;
- case SALOME_MED::MED_FACE : return MED_FACE;
- case SALOME_MED::MED_EDGE : return MED_EDGE;
- case SALOME_MED::MED_NODE : return MED_NODE;
- case SALOME_MED::MED_ALL_ENTITIES : return MED_ALL_ENTITIES;
- default :
- { MESSAGE("Unknown Entity Element");
- THROW_SALOME_CORBA_EXCEPTION("Unknown Entity Element",
- SALOME::INTERNAL_ERROR);
- }
- }
-}
-
-medModeSwitch convertIdlModeToMedMode(SALOME_MED::medModeSwitch mode)
-throw (SALOME::SALOME_Exception)
-{
- switch (mode)
- {
- case SALOME_MED::MED_FULL_INTERLACE : return MED_FULL_INTERLACE;
- case SALOME_MED::MED_NO_INTERLACE : return MED_NO_INTERLACE;
- default :
- { MESSAGE("Unknown interlace mode");
- THROW_SALOME_CORBA_EXCEPTION("Unknown interlace mode",
- SALOME::INTERNAL_ERROR);
- }
- }
-}
-
-SALOME_MED::medModeSwitch convertMedModeToIdlMode(medModeSwitch mode)
-throw (SALOME::SALOME_Exception)
-{
- switch (mode)
- {
- case MED_FULL_INTERLACE : return SALOME_MED::MED_FULL_INTERLACE;
- case MED_NO_INTERLACE : return SALOME_MED::MED_NO_INTERLACE;
- default :
- { MESSAGE("Unknown interlace mode");
- THROW_SALOME_CORBA_EXCEPTION("Unknown interlace mode",
- SALOME::INTERNAL_ERROR);
- }
- }
-}
-SALOME_MED::medConnectivity convertMedConnToIdlConn(medConnectivity connectivite)
-throw (SALOME::SALOME_Exception)
-{
- switch (connectivite)
- {
- case MED_NODAL : return SALOME_MED::MED_NODAL;
- case MED_DESCENDING : return SALOME_MED::MED_DESCENDING;
- default :
- { MESSAGE("Unknown connectivity type");
- THROW_SALOME_CORBA_EXCEPTION("Unknown connectivity type",
- SALOME::INTERNAL_ERROR);
- }
- }
-}
-medConnectivity convertIdlConnToMedConn(SALOME_MED::medConnectivity connectivite)
-throw (SALOME::SALOME_Exception)
-{
- switch (connectivite)
- {
- case SALOME_MED::MED_NODAL : return MED_NODAL;
- case SALOME_MED::MED_DESCENDING : return MED_DESCENDING;
- default :
- { MESSAGE("Unknown connectivity type");
- THROW_SALOME_CORBA_EXCEPTION("Unknown connectivity type",
- SALOME::INTERNAL_ERROR);
- }
- }
-}
-SALOME_MED::medDriverTypes convertMedDriverToIdlDriver(driverTypes driverType)
-throw (SALOME::SALOME_Exception)
-{
- switch (driverType)
- {
- case MED_DRIVER : return SALOME_MED::MED_DRIVER;
- case VTK_DRIVER : return SALOME_MED::VTK_DRIVER;
- case NO_DRIVER : return SALOME_MED::NO_DRIVER;
- default :
- { MESSAGE("Unknown driver type");
- THROW_SALOME_CORBA_EXCEPTION("Unknown driver type",
- SALOME::INTERNAL_ERROR);
- }
- }
-}
-
-driverTypes convertIdlDriverToMedDriver(SALOME_MED::medDriverTypes driverType)
-throw (SALOME::SALOME_Exception)
-{
- switch (driverType)
- {
- case SALOME_MED::MED_DRIVER : return MED_DRIVER;
- case SALOME_MED::VTK_DRIVER : return VTK_DRIVER;
- case SALOME_MED::NO_DRIVER : return NO_DRIVER;
- default :
- { MESSAGE("Unknown driver type");
- THROW_SALOME_CORBA_EXCEPTION("Unknown driver type",
- SALOME::INTERNAL_ERROR);
- }
- }
-}
-bool verifieParam (SALOME_MED::medEntityMesh entity,SALOME_MED::medGeometryElement geomElement)
-throw (SALOME::SALOME_Exception)
-{
- SCRUTE(entity);
- SCRUTE(geomElement);
- bool coherent=false;
- switch (entity)
- {
- case SALOME_MED::MED_FACE :
- {
- switch (geomElement)
- {
- case SALOME_MED::MED_TRIA3 : coherent=true;
- case SALOME_MED::MED_QUAD4 : coherent=true;
- case SALOME_MED::MED_TRIA6 : coherent=true;
- case SALOME_MED::MED_QUAD8 : coherent=true;
- }
- break;
- }
- case SALOME_MED::MED_CELL :
- {
- switch (geomElement)
- {
- case SALOME_MED::MED_POINT1 : coherent=true;
- case SALOME_MED::MED_SEG2 : coherent=true;
- case SALOME_MED::MED_SEG3 : coherent=true;
- case SALOME_MED::MED_TRIA3 : coherent=true;
- case SALOME_MED::MED_TRIA6 : coherent=true;
- case SALOME_MED::MED_QUAD4 : coherent=true;
- case SALOME_MED::MED_QUAD8 : coherent=true;
- case SALOME_MED::MED_TETRA4 : coherent=true;
- case SALOME_MED::MED_TETRA10 : coherent=true;
- case SALOME_MED::MED_HEXA8 : coherent=true;
- case SALOME_MED::MED_HEXA20 : coherent=true;
- case SALOME_MED::MED_PENTA6 : coherent=true;
- case SALOME_MED::MED_PENTA15 : coherent=true;
- case SALOME_MED::MED_PYRA5 : coherent=true;
- case SALOME_MED::MED_PYRA13 : coherent=true;
- }
- break;
- }
- case SALOME_MED::MED_EDGE :
- {
- switch (geomElement)
- {
- case SALOME_MED::MED_SEG2 : coherent=true;
- case SALOME_MED::MED_SEG3 : coherent=true;
- }
- break;
- }
- case SALOME_MED::MED_NODE :
- {
- switch (geomElement)
- {
- case SALOME_MED::MED_POINT1 : coherent=true;
- }
- break;
- }
- case SALOME_MED::MED_ALL_ENTITIES :
- {
- switch (geomElement)
- {
- case SALOME_MED::MED_NONE : coherent=true;
- }
- break;
- }
- default :
- { MESSAGE("Unknown geometric entity");
- THROW_SALOME_CORBA_EXCEPTION("Unknown geometric entity",
- SALOME::INTERNAL_ERROR);
- }
- break;
- }
-
- switch (geomElement)
- {
- case SALOME_MED::MED_ALL_ELEMENTS : coherent=true;
- }
- return coherent;
-}
+++ /dev/null
-//=============================================================================
-// File : convert.hxx
-// Created : mer fév 20 15:47:57 CET 2002
-// Author : EDF
-// Project : SALOME
-// Copyright : EDF 2002
-// $Header: /export/home/CVS/SALOME_ROOT/MED/src/MedMem/convert.hxx
-//=============================================================================
-# if ! defined ( __CONVERT_H__ )
-# define __CONVERT_H__
-
-#include <SALOMEconfig.h>
-
-#include CORBA_SERVER_HEADER(MED)
-
-#include "MEDMEM_define.hxx"
-
-using namespace MED_EN;
-
-#include "MEDMEM_GenDriver.hxx"
-
-SALOME_MED::medGeometryElement convertMedEltToIdlElt(medGeometryElement element)
- throw (SALOME::SALOME_Exception);
-SALOME_MED::medEntityMesh convertMedEntToIdlEnt(medEntityMesh entity)
- throw (SALOME::SALOME_Exception);
-SALOME_MED::medModeSwitch convertMedModeToIdlMode(medModeSwitch mode)
- throw (SALOME::SALOME_Exception);
-SALOME_MED::medDriverTypes convertMedDriverToIdlDriver(driverTypes driverType)
- throw (SALOME::SALOME_Exception);
-SALOME_MED::medConnectivity convertMedConnToIdlConn(medConnectivity connectivite)
- throw (SALOME::SALOME_Exception);
-
-medGeometryElement convertIdlEltToMedElt (SALOME_MED::medGeometryElement element)
- throw (SALOME::SALOME_Exception);
-medEntityMesh convertIdlEntToMedEnt(SALOME_MED::medEntityMesh entity)
- throw (SALOME::SALOME_Exception);
-medModeSwitch convertIdlModeToMedMode(SALOME_MED::medModeSwitch mode)
- throw (SALOME::SALOME_Exception);
-driverTypes convertIdlDriverToMedDriver(SALOME_MED::medDriverTypes driverType)
- throw (SALOME::SALOME_Exception);
-medConnectivity convertIdlConnToMedConn(SALOME_MED::medConnectivity connectivite)
- throw (SALOME::SALOME_Exception);
-
-
-bool verifieParam (SALOME_MED::medEntityMesh entity, SALOME_MED::medGeometryElement geomElement)
- throw (SALOME::SALOME_Exception);
-
-# endif /* # if ! defined ( __CONVERT_H__ ) */