From: nadir Date: Tue, 23 Sep 2003 13:15:43 +0000 (+0000) Subject: Merging with the MAN_SALOME2 branch X-Git-Tag: V1_2_3~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=cb1b13ea4e5da9d76168d2c3ca74f718a5922045;p=modules%2Fmed.git Merging with the MAN_SALOME2 branch --- diff --git a/adm_local/unix/make_commence.in b/adm_local/unix/make_commence.in index f6d5ea9cc..6def7e777 100644 --- a/adm_local/unix/make_commence.in +++ b/adm_local/unix/make_commence.in @@ -9,10 +9,13 @@ SHELL=/bin/sh 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@ diff --git a/adm_local/unix/make_conclude.in b/adm_local/unix/make_conclude.in new file mode 100644 index 000000000..5b49c545c --- /dev/null +++ b/adm_local/unix/make_conclude.in @@ -0,0 +1,346 @@ +#======================================================================= +# 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@ diff --git a/configure.in.base b/configure.in.base index 212a37556..064d002ba 100644 --- a/configure.in.base +++ b/configure.in.base @@ -279,7 +279,7 @@ echo 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 diff --git a/idl/MED_Gen.idl b/idl/MED_Gen.idl new file mode 100644 index 000000000..86a68ba5a --- /dev/null +++ b/idl/MED_Gen.idl @@ -0,0 +1,41 @@ +//============================================================================= +// 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 diff --git a/idl/Makefile.in b/idl/Makefile.in index 434a0fec7..49273ade4 100644 --- a/idl/Makefile.in +++ b/idl/Makefile.in @@ -12,7 +12,7 @@ VPATH=.:$(srcdir):${KERNEL_ROOT_DIR}/idl/salome IDL_FILES = \ MED.idl \ - Med_Gen.idl \ + MED_Gen.idl \ Compo1Py.idl PY_CLIENT_IDL = $(IDL_FILES) diff --git a/idl/Med_Gen.idl b/idl/Med_Gen.idl deleted file mode 100644 index 5b0ebf458..000000000 --- a/idl/Med_Gen.idl +++ /dev/null @@ -1,41 +0,0 @@ -//============================================================================= -// 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 diff --git a/src/MED/MED_test1.py b/src/MED/MED_test1.py index d5ac9907d..c2c342d49 100755 --- a/src/MED/MED_test1.py +++ b/src/MED/MED_test1.py @@ -31,12 +31,14 @@ import salome 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) - diff --git a/src/MED/MED_test2.py b/src/MED/MED_test2.py index 901ee2926..946583ead 100755 --- a/src/MED/MED_test2.py +++ b/src/MED/MED_test2.py @@ -30,13 +30,14 @@ import salome 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 @@ -49,8 +50,9 @@ except SALOME.SALOME_Exception, ex: 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 diff --git a/src/MED/Makefile.in b/src/MED/Makefile.in index c5a639de5..0ba0a5cb2 100644 --- a/src/MED/Makefile.in +++ b/src/MED/Makefile.in @@ -40,7 +40,7 @@ EXPORT_PYSCRIPTS = MED_test1.py MED_test2.py 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 @@ -54,7 +54,7 @@ BIN_SRC = 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 diff --git a/src/MED/Med_Gen_i.cxx b/src/MED/Med_Gen_i.cxx index 347a8304c..b214dfb14 100755 --- a/src/MED/Med_Gen_i.cxx +++ b/src/MED/Med_Gen_i.cxx @@ -26,15 +26,14 @@ // 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" @@ -61,6 +60,8 @@ using namespace std; #include #include "SALOMEDS_Tool.hxx" +using namespace MEDMEM; + // Initialisation des variables statiques map Med_Gen_i::_MedCorbaObj; string Med_Gen_i::_myFileName=""; @@ -934,7 +935,7 @@ SALOMEDS::SObject_ptr Med_Gen_i::PublishInStudy(SALOMEDS::Study_ptr theStudy, 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)) { diff --git a/src/MED/Med_Gen_i.hxx b/src/MED/Med_Gen_i.hxx index cbc9db16e..630cb8f87 100644 --- a/src/MED/Med_Gen_i.hxx +++ b/src/MED/Med_Gen_i.hxx @@ -31,7 +31,7 @@ #include #include -#include CORBA_SERVER_HEADER(Med_Gen) +#include CORBA_SERVER_HEADER(MED_Gen) #include CORBA_SERVER_HEADER(MED) #include CORBA_SERVER_HEADER(SALOME_ModuleCatalog) @@ -41,7 +41,7 @@ #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: diff --git a/src/MEDGUI/Makefile.in b/src/MEDGUI/Makefile.in index 447045ff2..d42339648 100644 --- a/src/MEDGUI/Makefile.in +++ b/src/MEDGUI/Makefile.in @@ -50,7 +50,7 @@ LIB_SRC = MedGUI.cxx 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 @@ -62,7 +62,7 @@ LIB_SERVER_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 diff --git a/src/MEDGUI/MedGUI.cxx b/src/MEDGUI/MedGUI.cxx index 09bdce969..392a96214 100644 --- a/src/MEDGUI/MedGUI.cxx +++ b/src/MEDGUI/MedGUI.cxx @@ -85,7 +85,7 @@ bool MedGUI::OnGUIEvent (int theCommandID, QAD_Desktop* 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, @@ -139,7 +139,7 @@ bool MedGUI::OnGUIEvent (int theCommandID, QAD_Desktop* 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, @@ -192,7 +192,7 @@ bool MedGUI::OnGUIEvent (int theCommandID, QAD_Desktop* 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, @@ -458,7 +458,7 @@ bool MedGUI::DumpMesh( SALOME_MED::MESH_var MEDMesh) 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 ) { @@ -487,7 +487,7 @@ bool MedGUI::DumpMesh( SALOME_MED::MESH_var MEDMesh) 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;llength();l++) SCRUTE(tabnoeuds[l]); } @@ -499,7 +499,7 @@ bool MedGUI::DumpMesh( SALOME_MED::MESH_var MEDMesh) // 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;llength();l++) // SCRUTE(tabnoeuds[l]); @@ -520,7 +520,7 @@ bool MedGUI::DumpMesh( SALOME_MED::MESH_var MEDMesh) // 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;llength();l++) // SCRUTE(tabnoeuds[l]); @@ -537,7 +537,7 @@ bool MedGUI::DumpSubMesh( SALOME_MED::FAMILY_var Fam ) 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;llength();l++) SCRUTE(tabnoeuds[l]); @@ -549,12 +549,12 @@ bool MedGUI::DumpSubMesh( SALOME_MED::FAMILY_var Fam ) * */ //============================================================================= -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(); } diff --git a/src/MEDGUI/MedGUI.h b/src/MEDGUI/MedGUI.h index a0be4e6c0..45f3d6734 100644 --- a/src/MEDGUI/MedGUI.h +++ b/src/MEDGUI/MedGUI.h @@ -14,7 +14,7 @@ #include "QAD_StudyFrame.h" #include -#include CORBA_CLIENT_HEADER(Med_Gen) +#include CORBA_CLIENT_HEADER(MED_Gen) //#include CORBA_CLIENT_HEADER(SMESH_Mesh) #include CORBA_SERVER_HEADER(SALOMEDS_Attributes) @@ -50,7 +50,7 @@ public: 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 ) ; diff --git a/src/MEDMEM/MEDMEM_Array.hxx b/src/MEDMEM/MEDMEM_Array.hxx index e0d049821..d032a9273 100644 --- a/src/MEDMEM/MEDMEM_Array.hxx +++ b/src/MEDMEM/MEDMEM_Array.hxx @@ -39,6 +39,7 @@ using namespace MED_EN; A simple test program (testUArray) allows to test this class. */ +namespace MEDMEM { template class MEDARRAY { private : @@ -96,6 +97,7 @@ public : bool isOtherCalculated() const {return (const T*)_valuesOther != NULL;} void clearOtherMode(); }; +} //-------------------------------------------------// // // diff --git a/src/MEDMEM/MEDMEM_CellModel.cxx b/src/MEDMEM/MEDMEM_CellModel.cxx index e45ed624b..5f272ef6b 100644 --- a/src/MEDMEM/MEDMEM_CellModel.cxx +++ b/src/MEDMEM/MEDMEM_CellModel.cxx @@ -6,6 +6,7 @@ using namespace std; #include "utilities.h" #include "MEDMEM_CellModel.hxx" +using namespace MEDMEM; CELLMODEL::CELLMODEL(medGeometryElement t) { @@ -1352,7 +1353,7 @@ 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; @@ -1380,6 +1381,8 @@ ostream & operator<<(ostream &os,const CELLMODEL &my) } return os; } +/* +*/ // Return number of constituents type (which dimension is _dimension-1). int CELLMODEL::getNumberOfConstituentsType() const diff --git a/src/MEDMEM/MEDMEM_CellModel.hxx b/src/MEDMEM/MEDMEM_CellModel.hxx index 068d7b443..97b905e4d 100644 --- a/src/MEDMEM/MEDMEM_CellModel.hxx +++ b/src/MEDMEM/MEDMEM_CellModel.hxx @@ -24,6 +24,7 @@ using namespace MED_EN; the cell model it describes as cell dimensions, number of nodes... */ +namespace MEDMEM { class CELLMODEL { @@ -135,12 +136,14 @@ public : map getNumberOfConstituentsForeachType() const; +}; }; // ------------------------------------------ // Methodes Inline // ------------------------------------------ +using namespace MEDMEM; inline CELLMODEL::CELLMODEL(): _type(MED_NONE), _dimension(0), diff --git a/src/MEDMEM/MEDMEM_Connectivity.cxx b/src/MEDMEM/MEDMEM_Connectivity.cxx index b785bdf50..9d57d54db 100644 --- a/src/MEDMEM/MEDMEM_Connectivity.cxx +++ b/src/MEDMEM/MEDMEM_Connectivity.cxx @@ -10,6 +10,7 @@ using namespace std; #include "MEDMEM_STRING.hxx" #include +using namespace MEDMEM; /*! Default Constructor. /n Default for Entity is MED_CELL and type of Connectivity is MED_NODAL */ @@ -1523,7 +1524,7 @@ medGeometryElement CONNECTIVITY::getElementType(medEntityMesh Entity,int globalN } -ostream & operator<<(ostream &os, CONNECTIVITY &co) +ostream & MEDMEM::operator<<(ostream &os, CONNECTIVITY &co) { os << endl << "------------- Entity = "; switch (co._entity) diff --git a/src/MEDMEM/MEDMEM_Connectivity.hxx b/src/MEDMEM/MEDMEM_Connectivity.hxx index c0ec8c098..9444b2257 100644 --- a/src/MEDMEM/MEDMEM_Connectivity.hxx +++ b/src/MEDMEM/MEDMEM_Connectivity.hxx @@ -9,6 +9,7 @@ using namespace MED_EN; +namespace MEDMEM { class MEDSKYLINEARRAY; class CELLMODEL; class FAMILY; @@ -189,10 +190,12 @@ public: const med_int* getNeighbourhood() const; +}; }; /*----------------------*/ /* Methodes Inline */ /*----------------------*/ +using namespace MEDMEM; /*! Returns the medEntityMesh */ //--------------------------------------------------// diff --git a/src/MEDMEM/MEDMEM_Coordinate.cxx b/src/MEDMEM/MEDMEM_Coordinate.cxx index caae4090b..d968d8ec0 100644 --- a/src/MEDMEM/MEDMEM_Coordinate.cxx +++ b/src/MEDMEM/MEDMEM_Coordinate.cxx @@ -4,6 +4,7 @@ using namespace std; #include "MEDMEM_STRING.hxx" #include "utilities.h" +using namespace MEDMEM; /*! Default Constructor : should not be used */ //----------------------------------------------------------// diff --git a/src/MEDMEM/MEDMEM_Coordinate.hxx b/src/MEDMEM/MEDMEM_Coordinate.hxx index d77b84839..b4d5454df 100644 --- a/src/MEDMEM/MEDMEM_Coordinate.hxx +++ b/src/MEDMEM/MEDMEM_Coordinate.hxx @@ -22,6 +22,7 @@ spaceDimension and numberOfNodes can be found in _coordinate object. */ +namespace MEDMEM { class COORDINATE { @@ -88,5 +89,6 @@ public : const string * getCoordinatesUnits() const; string getCoordinateUnit(int Axis) const; }; +}; #endif /* COORDINATE_HXX */ diff --git a/src/MEDMEM/MEDMEM_DriverTools.cxx b/src/MEDMEM/MEDMEM_DriverTools.cxx index 82451e50d..0c929d513 100644 --- a/src/MEDMEM/MEDMEM_DriverTools.cxx +++ b/src/MEDMEM/MEDMEM_DriverTools.cxx @@ -5,6 +5,7 @@ using namespace std; #include "MEDMEM_Mesh.hxx" #include "MEDMEM_Group.hxx" #include +using namespace MEDMEM; // Cet opérateur permet d'ordonner les mailles dans un set suivant l'ordre requis par MED @@ -66,7 +67,7 @@ return entity; 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::iterator >::const_iterator i=ma.sommets.begin(); @@ -77,7 +78,7 @@ std::ostream& operator << (std::ostream& os, const _maille& ma) 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 : "; @@ -89,7 +90,7 @@ std::ostream& operator << (std::ostream& os, const _groupe& gr) 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::const_iterator i=no.coord.begin(); @@ -100,7 +101,7 @@ std::ostream& operator << (std::ostream& os, const _noeud& no) 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) diff --git a/src/MEDMEM/MEDMEM_DriverTools.hxx b/src/MEDMEM/MEDMEM_DriverTools.hxx index 7ea40d0e1..58d6d5a8a 100644 --- a/src/MEDMEM/MEDMEM_DriverTools.hxx +++ b/src/MEDMEM/MEDMEM_DriverTools.hxx @@ -11,11 +11,11 @@ #include #include +namespace MEDMEM { class MESH; class CONNECTIVITY; class COORDINATE; class GROUP; - struct _noeud { mutable int number; @@ -88,4 +88,5 @@ std::ostream& operator << (std::ostream& , const _groupe& ); std::ostream& operator << (std::ostream& , const _noeud& ); std::ostream& operator << (std::ostream& , const _intermediateMED& ); +}; #endif /* DRIVERTOOLS_HXX */ diff --git a/src/MEDMEM/MEDMEM_DriversDef.cxx b/src/MEDMEM/MEDMEM_DriversDef.cxx index da6b09546..2d38da5e8 100644 --- a/src/MEDMEM/MEDMEM_DriversDef.cxx +++ b/src/MEDMEM/MEDMEM_DriversDef.cxx @@ -28,12 +28,12 @@ GEO_NAME::GEO_NAME() : map() 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 { @@ -55,12 +55,12 @@ ENT_NAME::ENT_NAME() : map() 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 { @@ -126,12 +126,12 @@ MESH_ENTITIES::MESH_ENTITIES () : map >() } -// 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 & MESH_ENTITIES::operator[]( const med_entite_maillage &c ) const { diff --git a/src/MEDMEM/MEDMEM_DriversDef.hxx b/src/MEDMEM/MEDMEM_DriversDef.hxx index c26be1766..981f0b7a5 100644 --- a/src/MEDMEM/MEDMEM_DriversDef.hxx +++ b/src/MEDMEM/MEDMEM_DriversDef.hxx @@ -10,8 +10,7 @@ using namespace std ; #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 @@ -28,7 +27,7 @@ class GEO_NAME : public map public : GEO_NAME(); - // ~GEO_NAME(); + ~GEO_NAME(); string & operator[]( const MED_FR::med_geometrie_element &c ) const; } ; @@ -52,7 +51,7 @@ class ENT_NAME : public map public : ENT_NAME (); - // ~ENT_NAME(); + ~ENT_NAME(); string & operator[]( const MED_FR::med_entite_maillage &c ) const; } ; @@ -77,7 +76,7 @@ class MESH_ENTITIES : public map public : MESH_ENTITIES (); - // ~MESH_ENTITIES(); + ~MESH_ENTITIES(); const list & operator[]( const MED_FR::med_entite_maillage &c ) const; private: diff --git a/src/MEDMEM/MEDMEM_Exception.cxx b/src/MEDMEM/MEDMEM_Exception.cxx index bafedca54..ccd7c216a 100644 --- a/src/MEDMEM/MEDMEM_Exception.cxx +++ b/src/MEDMEM/MEDMEM_Exception.cxx @@ -8,6 +8,7 @@ using namespace std; #include "utilities.h" #include "MEDMEM_Exception.hxx" +using namespace MEDMEM; extern "C" { @@ -130,7 +131,7 @@ MEDEXCEPTION::MEDEXCEPTION( const MEDEXCEPTION &ex ): _text(duplicate(ex._text)) 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 ; diff --git a/src/MEDMEM/MEDMEM_Exception.hxx b/src/MEDMEM/MEDMEM_Exception.hxx index e6eb49a4c..43906d2ce 100644 --- a/src/MEDMEM/MEDMEM_Exception.hxx +++ b/src/MEDMEM/MEDMEM_Exception.hxx @@ -21,6 +21,7 @@ using namespace std; Class used to throws exception.\n Inherits from public exception. */ +namespace MEDMEM { //--------------------------------------// class MEDEXCEPTION : public exception //--------------------------------------// @@ -55,5 +56,6 @@ public : ~MED_DRIVER_NOT_FOUND_EXCEPTION() throw(); }; +}; #endif /* MEDEXCEPTION_HXX */ diff --git a/src/MEDMEM/MEDMEM_Family.cxx b/src/MEDMEM/MEDMEM_Family.cxx index 45d647b2f..14da5dd6e 100644 --- a/src/MEDMEM/MEDMEM_Family.cxx +++ b/src/MEDMEM/MEDMEM_Family.cxx @@ -6,6 +6,7 @@ using namespace std; #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), @@ -229,7 +230,7 @@ FAMILY & FAMILY::operator=(const FAMILY &fam) return *this; }; -ostream & operator<<(ostream &os, FAMILY &myFamily) +ostream & MEDMEM::operator<<(ostream &os, FAMILY &myFamily) { // how do cast without duplicate ? os << (SUPPORT) myFamily; diff --git a/src/MEDMEM/MEDMEM_Family.hxx b/src/MEDMEM/MEDMEM_Family.hxx index 2be15c6c0..55c442c55 100644 --- a/src/MEDMEM/MEDMEM_Family.hxx +++ b/src/MEDMEM/MEDMEM_Family.hxx @@ -14,7 +14,7 @@ All families on one entity represent a mesh partition for this entity. */ - +namespace MEDMEM { class FAMILY : virtual public SUPPORT { protected : @@ -119,9 +119,10 @@ public: 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) @@ -261,6 +262,4 @@ inline string FAMILY::getGroupName(int i) const { return _groupName[i-1] ; } - - #endif /* FAMILY_HXX */ diff --git a/src/MEDMEM/MEDMEM_Field.cxx b/src/MEDMEM/MEDMEM_Field.cxx index 7c52fc42f..c36f44dc9 100644 --- a/src/MEDMEM/MEDMEM_Field.cxx +++ b/src/MEDMEM/MEDMEM_Field.cxx @@ -1,5 +1,6 @@ using namespace std; #include "MEDMEM_Field.hxx" +using namespace MEDMEM; // --------------------------------- // FIELD_ : Constructors diff --git a/src/MEDMEM/MEDMEM_Field.hxx b/src/MEDMEM/MEDMEM_Field.hxx index b1127f69d..f086d493a 100644 --- a/src/MEDMEM/MEDMEM_Field.hxx +++ b/src/MEDMEM/MEDMEM_Field.hxx @@ -36,6 +36,7 @@ using namespace MED_EN; */ +namespace MEDMEM { class FIELD_ // GENERIC POINTER TO a template class FIELD { protected: @@ -220,10 +221,12 @@ public: inline med_type_champ getValueType () const; }; +}; // --------------------------------- // Implemented Methods : constructor // --------------------------------- +using namespace MEDMEM; // ----------------- // Methodes Inline @@ -535,6 +538,7 @@ inline void FIELD_::setValueType (const med_type_champ ValueType) */ +namespace MEDMEM { template class FIELD : public FIELD_ { @@ -703,10 +707,12 @@ public: */ void getBarycenter() const throw (MEDEXCEPTION) ; }; +}; // -------------------- // Implemented Methods // -------------------- +using namespace MEDMEM; /*! Constructor with no parameter, most of the attribut members are set to NULL. @@ -719,7 +725,7 @@ template FIELD::FIELD(): /*! 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 FIELD::FIELD(const SUPPORT * Support, const int NumberOfComponents, const medModeSwitch Mode) throw (MEDEXCEPTION) : diff --git a/src/MEDMEM/MEDMEM_GenDriver.cxx b/src/MEDMEM/MEDMEM_GenDriver.cxx index 1545acf2b..e99ec8af4 100644 --- a/src/MEDMEM/MEDMEM_GenDriver.cxx +++ b/src/MEDMEM/MEDMEM_GenDriver.cxx @@ -2,6 +2,7 @@ using namespace std; #include "MEDMEM_GenDriver.hxx" #include "MEDMEM_STRING.hxx" #include "MEDMEM_Exception.hxx" +using namespace MEDMEM; GENDRIVER::GENDRIVER(): _id(MED_INVALID), _fileName(""), @@ -28,11 +29,11 @@ GENDRIVER::GENDRIVER(const GENDRIVER & genDriver): 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; @@ -109,7 +110,7 @@ med_mode_acces GENDRIVER::getAccessMode() const { END_OF(LOC); } -ostream & operator<<(ostream &os,const GENDRIVER & drv) +ostream & MEDMEM::operator<<(ostream &os,const GENDRIVER & drv) { switch (drv._accessMode) { @@ -139,7 +140,7 @@ ostream & operator<<(ostream &os,const GENDRIVER & drv) } // 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 : "; diff --git a/src/MEDMEM/MEDMEM_GenDriver.hxx b/src/MEDMEM/MEDMEM_GenDriver.hxx index 0fcdeda65..3f95c40f6 100644 --- a/src/MEDMEM/MEDMEM_GenDriver.hxx +++ b/src/MEDMEM/MEDMEM_GenDriver.hxx @@ -8,8 +8,6 @@ /* 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; @@ -19,7 +17,10 @@ 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 : @@ -107,6 +108,7 @@ public: void setFileName ( const string & fileName); med_mode_acces getAccessMode() const; }; +}; #endif /* GENDRIVER_HXX */ diff --git a/src/MEDMEM/MEDMEM_GibiMeshDriver.cxx b/src/MEDMEM/MEDMEM_GibiMeshDriver.cxx index 0de7ab1a8..7c6c4e4ab 100644 --- a/src/MEDMEM/MEDMEM_GibiMeshDriver.cxx +++ b/src/MEDMEM/MEDMEM_GibiMeshDriver.cxx @@ -17,6 +17,7 @@ using namespace std; ///// using namespace MED_EN; +using namespace MEDMEM; ///// diff --git a/src/MEDMEM/MEDMEM_GibiMeshDriver.hxx b/src/MEDMEM/MEDMEM_GibiMeshDriver.hxx index bc25416b9..4d8148a91 100644 --- a/src/MEDMEM/MEDMEM_GibiMeshDriver.hxx +++ b/src/MEDMEM/MEDMEM_GibiMeshDriver.hxx @@ -17,11 +17,6 @@ #include ///// -class MESH; -class FAMILY; -class GROUP; -class CONNECTIVITY; - /*! Driver GIBI for MESH. @@ -30,7 +25,11 @@ class CONNECTIVITY; */ - +namespace MEDMEM { +class MESH; +class FAMILY; +class GROUP; +class CONNECTIVITY; class GIBI_MESH_DRIVER : public GENDRIVER { protected: @@ -227,6 +226,7 @@ private: GENDRIVER * copy(void) const ; }; +}; #endif /* GIBI_MESH_DRIVER_HXX */ diff --git a/src/MEDMEM/MEDMEM_Grid.cxx b/src/MEDMEM/MEDMEM_Grid.cxx index d6f2d6b6a..1aa63e7b9 100644 --- a/src/MEDMEM/MEDMEM_Grid.cxx +++ b/src/MEDMEM/MEDMEM_Grid.cxx @@ -13,6 +13,7 @@ using namespace std; #include "MEDMEM_Grid.hxx" #include #include +using namespace MEDMEM; //======================================================================= //function : GRID diff --git a/src/MEDMEM/MEDMEM_Grid.hxx b/src/MEDMEM/MEDMEM_Grid.hxx index 4c19f2149..d39659b9b 100644 --- a/src/MEDMEM/MEDMEM_Grid.hxx +++ b/src/MEDMEM/MEDMEM_Grid.hxx @@ -15,6 +15,7 @@ // class containing structured mesh data +namespace MEDMEM { class GRID: public MESH { protected: @@ -249,6 +250,8 @@ class GRID: public MESH friend class MED_MESH_WRONLY_DRIVER; }; +}; +using namespace MEDMEM; //----------------------------------// diff --git a/src/MEDMEM/MEDMEM_Group.cxx b/src/MEDMEM/MEDMEM_Group.cxx index b59d981a5..0d7abc27c 100644 --- a/src/MEDMEM/MEDMEM_Group.cxx +++ b/src/MEDMEM/MEDMEM_Group.cxx @@ -7,6 +7,7 @@ using namespace std; #include "MEDMEM_Group.hxx" #include "MEDMEM_Family.hxx" +using namespace MEDMEM; GROUP::GROUP():_numberOfFamilies(0),_family() { @@ -26,7 +27,7 @@ GROUP & GROUP::operator=(const GROUP &group) return *this; }; -ostream & operator<<(ostream &os, GROUP &myGroup) +ostream & MEDMEM::operator<<(ostream &os, GROUP &myGroup) { os << (SUPPORT) myGroup; @@ -107,7 +108,7 @@ GROUP::GROUP(const string & name, const list & families) throw (MEDEXCE it++ ; } - MESSAGE(LOC<<"Printing of the object GROUP built "<< *this); + MESSAGE(LOC<<"Printing of the object GROUP built "<< (GROUP)*this); END_OF(LOC); }; diff --git a/src/MEDMEM/MEDMEM_Group.hxx b/src/MEDMEM/MEDMEM_Group.hxx index 46e3ab9ef..f0cde2141 100644 --- a/src/MEDMEM/MEDMEM_Group.hxx +++ b/src/MEDMEM/MEDMEM_Group.hxx @@ -8,10 +8,8 @@ #include #include -//#include "MEDMEM_Support.hxx" #include "MEDMEM_Family.hxx" -class FAMILY; /*! @@ -21,6 +19,8 @@ class FAMILY; */ +namespace MEDMEM { +class FAMILY; class GROUP : virtual public SUPPORT { protected : @@ -63,8 +63,10 @@ public: inline FAMILY * getFamily(int i) const ; }; +}; // inline method : +using namespace MEDMEM; /*! set the attribut _numberOfFamilies to numberOfFamilies */ //---------------------------------------------------------- diff --git a/src/MEDMEM/MEDMEM_InterpolationWrappers.hxx b/src/MEDMEM/MEDMEM_InterpolationWrappers.hxx index 766994fed..6f5462768 100644 --- a/src/MEDMEM/MEDMEM_InterpolationWrappers.hxx +++ b/src/MEDMEM/MEDMEM_InterpolationWrappers.hxx @@ -4,6 +4,7 @@ // les classes de wrapping +namespace MEDMEM { template class Wrapper_Noeud { protected : @@ -71,5 +72,6 @@ template class Wrapper_Nuage } int size() const {return nbr_noeuds;} }; +}; #endif diff --git a/src/MEDMEM/MEDMEM_Med.cxx b/src/MEDMEM/MEDMEM_Med.cxx index 31821b8cc..1ba0f9ba5 100644 --- a/src/MEDMEM/MEDMEM_Med.cxx +++ b/src/MEDMEM/MEDMEM_Med.cxx @@ -11,6 +11,7 @@ using namespace std; # include "MEDMEM_Exception.hxx" # include "utilities.h" +using namespace MEDMEM; /*! Constructor. diff --git a/src/MEDMEM/MEDMEM_Med.hxx b/src/MEDMEM/MEDMEM_Med.hxx index 137120ae3..adf96c1b6 100644 --- a/src/MEDMEM/MEDMEM_Med.hxx +++ b/src/MEDMEM/MEDMEM_Med.hxx @@ -15,9 +15,10 @@ # include "MEDMEM_VtkMedDriver.hxx" # include "MEDMEM_Exception.hxx" -//using namespace MED_EN; +using namespace MED_EN; +namespace MEDMEM { class MESH; class FIELD_; class SUPPORT ; @@ -144,6 +145,7 @@ public: //friend ostream & operator<<(ostream &os,const MED & med); }; +}; #endif diff --git a/src/MEDMEM/MEDMEM_MedFieldDriver.hxx b/src/MEDMEM/MEDMEM_MedFieldDriver.hxx index 490fd4b56..a95deb874 100644 --- a/src/MEDMEM/MEDMEM_MedFieldDriver.hxx +++ b/src/MEDMEM/MEDMEM_MedFieldDriver.hxx @@ -18,6 +18,7 @@ //using namespace MED_FR ; +namespace MEDMEM { template class FIELD; // A QD LA CLASSE MED_ALL_ELEMENTS_DRIVER.... :) pour mutualiser le open ..... avec led _medIdt... @@ -305,12 +306,14 @@ private: GENDRIVER * copy( void ) const ; }; +} /*-------------------------*/ /* template implementation */ /*-------------------------*/ +using namespace MEDMEM; /*--------------------- DRIVER PART -------------------------------*/ template void MED_FIELD_DRIVER::setFieldName(const string & fieldName) @@ -795,7 +798,6 @@ template void MED_FIELD_RDWR_DRIVER::read (void) MED_FIELD_RDONLY_DRIVER::read(); END_OF("MED_FIELD_RDWR_DRIVER::read(void)"); } - /*-----------------------------------------------------------------*/ #endif /* MED_FIELD_DRIVER_HXX */ diff --git a/src/MEDMEM/MEDMEM_MedMedDriver.cxx b/src/MEDMEM/MEDMEM_MedMedDriver.cxx index fe58c36c6..c07475635 100644 --- a/src/MEDMEM/MEDMEM_MedMedDriver.cxx +++ b/src/MEDMEM/MEDMEM_MedMedDriver.cxx @@ -15,6 +15,7 @@ using namespace std; # 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) diff --git a/src/MEDMEM/MEDMEM_MedMedDriver.hxx b/src/MEDMEM/MEDMEM_MedMedDriver.hxx index 0b401b81d..579e36330 100644 --- a/src/MEDMEM/MEDMEM_MedMedDriver.hxx +++ b/src/MEDMEM/MEDMEM_MedMedDriver.hxx @@ -5,17 +5,9 @@ #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. @@ -25,6 +17,11 @@ class 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: @@ -238,5 +235,6 @@ private: virtual GENDRIVER * copy ( void ) const ; }; +}; #endif /* MED_MED_DRIVER_HXX */ diff --git a/src/MEDMEM/MEDMEM_MedMeshDriver.cxx b/src/MEDMEM/MEDMEM_MedMeshDriver.cxx index 1c5e9e232..7ac848673 100644 --- a/src/MEDMEM/MEDMEM_MedMeshDriver.cxx +++ b/src/MEDMEM/MEDMEM_MedMeshDriver.cxx @@ -11,6 +11,7 @@ using namespace std; #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); diff --git a/src/MEDMEM/MEDMEM_MedMeshDriver.hxx b/src/MEDMEM/MEDMEM_MedMeshDriver.hxx index 9762d263c..348a3337c 100644 --- a/src/MEDMEM/MEDMEM_MedMeshDriver.hxx +++ b/src/MEDMEM/MEDMEM_MedMeshDriver.hxx @@ -10,11 +10,6 @@ #include "MEDMEM_Exception.hxx" #include "utilities.h" -class MESH; -class FAMILY; -class GROUP; -class CONNECTIVITY; - /*! Driver Med for MESH. @@ -23,6 +18,11 @@ class CONNECTIVITY; */ +namespace MEDMEM { +class MESH; +class FAMILY; +class GROUP; +class CONNECTIVITY; class MED_MESH_DRIVER : public GENDRIVER { protected: @@ -232,5 +232,6 @@ private: GENDRIVER * copy(void) const ; }; +}; #endif /* MED_MESH_DRIVER_HXX */ diff --git a/src/MEDMEM/MEDMEM_Mesh.cxx b/src/MEDMEM/MEDMEM_Mesh.cxx index 93d7cfc59..c635c30be 100644 --- a/src/MEDMEM/MEDMEM_Mesh.cxx +++ b/src/MEDMEM/MEDMEM_Mesh.cxx @@ -19,6 +19,7 @@ using namespace std; #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 @@ -398,7 +399,7 @@ MESH::MESH(driverTypes driverType, const string & fileName/*=""*/, const string // 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(); diff --git a/src/MEDMEM/MEDMEM_Mesh.hxx b/src/MEDMEM/MEDMEM_Mesh.hxx index ac8954cee..2179a54c4 100644 --- a/src/MEDMEM/MEDMEM_Mesh.hxx +++ b/src/MEDMEM/MEDMEM_Mesh.hxx @@ -20,12 +20,7 @@ #include "MEDMEM_VtkMeshDriver.hxx" -class CELLMODEL; -class FAMILY; -class GROUP; -class SUPPORT; -template class FIELD; //class GENDRIVER; //class MED_MESH_RDONLY_DRIVER; @@ -46,6 +41,14 @@ using namespace MED_EN; */ +namespace MEDMEM { + +template class FIELD; + +class CELLMODEL; +class FAMILY; +class GROUP; +class SUPPORT; class MESH { @@ -264,7 +267,9 @@ public : */ SUPPORT * intersectSupports(const vector Supports) const throw (MEDEXCEPTION) ; }; +}; +using namespace MEDMEM; // --------------------------------------- // Methodes Inline // --------------------------------------- @@ -669,7 +674,7 @@ inline int MESH::getNumberOfGroups (medEntityMesh entity) const throw MEDEXCEPTION("MESH::getNumberOfGroups : Unknown entity"); } } -const vector MESH::getFamilies(medEntityMesh entity) const +const vector MESH::getFamilies(medEntityMesh entity) const { switch (entity) { case MED_NODE : @@ -701,7 +706,7 @@ const vector MESH::getGroups(medEntityMesh entity) const } } -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"); diff --git a/src/MEDMEM/MEDMEM_Meshing.cxx b/src/MEDMEM/MEDMEM_Meshing.cxx index 2f90a5df3..0291fcc97 100644 --- a/src/MEDMEM/MEDMEM_Meshing.cxx +++ b/src/MEDMEM/MEDMEM_Meshing.cxx @@ -13,6 +13,7 @@ using namespace std; #include "MEDMEM_Meshing.hxx" #include "MEDMEM_Group.hxx" +using namespace MEDMEM; /*! Create an empty MESH. */ MESHING::MESHING(): MESH() diff --git a/src/MEDMEM/MEDMEM_Meshing.hxx b/src/MEDMEM/MEDMEM_Meshing.hxx index cb68c5466..164ed112c 100644 --- a/src/MEDMEM/MEDMEM_Meshing.hxx +++ b/src/MEDMEM/MEDMEM_Meshing.hxx @@ -14,6 +14,7 @@ using namespace MED_EN; This class MESHING is a special class to set a MESH object. */ +namespace MEDMEM { class MESHING: public MESH { public : @@ -63,5 +64,6 @@ public : void addGroup (const GROUP & Group) throw (MEDEXCEPTION) ; }; +}; #endif /* MESHING_HXX */ diff --git a/src/MEDMEM/MEDMEM_ModulusArray.hxx b/src/MEDMEM/MEDMEM_ModulusArray.hxx index 956c1d69c..706324b60 100644 --- a/src/MEDMEM/MEDMEM_ModulusArray.hxx +++ b/src/MEDMEM/MEDMEM_ModulusArray.hxx @@ -11,7 +11,7 @@ they are the same (positive or negative cycle) ! */ - +namespace MEDMEM { class MEDMODULUSARRAY { private: int _length ; @@ -26,6 +26,8 @@ public: int compare(const MEDMODULUSARRAY &modulusArray) const; }; +}; +using namespace MEDMEM; MEDMODULUSARRAY::MEDMODULUSARRAY(int length, const int * array) : _length(length), _array(array) diff --git a/src/MEDMEM/MEDMEM_PointerOf.hxx b/src/MEDMEM/MEDMEM_PointerOf.hxx index 1b7b6ede2..be3201043 100644 --- a/src/MEDMEM/MEDMEM_PointerOf.hxx +++ b/src/MEDMEM/MEDMEM_PointerOf.hxx @@ -13,6 +13,7 @@ In these cases, memory will be desallocated at object destruction. In all other cases, the desallocator will only nullify pointers. */ +namespace MEDMEM { template class PointerOf { @@ -37,6 +38,7 @@ public : void set( const int &size, const T *pointer ) ; PointerOf& operator=( const PointerOf &pointer ) ; } ; +} ; // ------------------------------------------------------------ // // // @@ -44,6 +46,7 @@ public : // // // ------------------------------------------------------------ // +using namespace MEDMEM; /*! Creates a null T* pointer and sets the boolean (for desallocation) to false. */ template PointerOf::PointerOf() : _pointer(0), _done(false) diff --git a/src/MEDMEM/MEDMEM_STRING.hxx b/src/MEDMEM/MEDMEM_STRING.hxx index fde1ee095..3965a6527 100644 --- a/src/MEDMEM/MEDMEM_STRING.hxx +++ b/src/MEDMEM/MEDMEM_STRING.hxx @@ -14,6 +14,7 @@ using namespace std; 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 { @@ -65,5 +66,6 @@ public : } } ; +} ; # endif diff --git a/src/MEDMEM/MEDMEM_SkyLineArray.cxx b/src/MEDMEM/MEDMEM_SkyLineArray.cxx index 13f24e3be..00cf6fac4 100644 --- a/src/MEDMEM/MEDMEM_SkyLineArray.cxx +++ b/src/MEDMEM/MEDMEM_SkyLineArray.cxx @@ -1,6 +1,7 @@ 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) diff --git a/src/MEDMEM/MEDMEM_SkyLineArray.hxx b/src/MEDMEM/MEDMEM_SkyLineArray.hxx index 5440f6fdf..c2e822af3 100644 --- a/src/MEDMEM/MEDMEM_SkyLineArray.hxx +++ b/src/MEDMEM/MEDMEM_SkyLineArray.hxx @@ -6,8 +6,9 @@ #include "MEDMEM_PointerOf.hxx" #include "MEDMEM_define.hxx" -using MED_EN::med_int ; +using MED_EN::med_int; +namespace MEDMEM { class MEDSKYLINEARRAY { private : @@ -41,8 +42,9 @@ public : 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 // --------------------------------------- @@ -140,5 +142,4 @@ inline void MEDSKYLINEARRAY::setIndexValue(med_int i, med_int value) throw (MEDE throw MEDEXCEPTION("MEDSKYLINEARRAY::setIndexValue : argument is out of range") ; _value[i-1]=value ; } - # endif diff --git a/src/MEDMEM/MEDMEM_Support.cxx b/src/MEDMEM/MEDMEM_Support.cxx index 0cdfe0192..6b9c0d759 100644 --- a/src/MEDMEM/MEDMEM_Support.cxx +++ b/src/MEDMEM/MEDMEM_Support.cxx @@ -17,6 +17,7 @@ using namespace std; #include "MEDMEM_Mesh.hxx" using namespace MED_EN; +using namespace MEDMEM; /* This class is a generic class for family and group */ @@ -136,7 +137,7 @@ SUPPORT::~SUPPORT() operator <<. */ //-------------------------------------------------- -ostream & operator<<(ostream &os, const SUPPORT &my) +ostream & MEDMEM::operator<<(ostream &os, const SUPPORT &my) //-------------------------------------------------- { os << "Name : "<< my.getName() << endl ; diff --git a/src/MEDMEM/MEDMEM_Support.hxx b/src/MEDMEM/MEDMEM_Support.hxx index 378df16d8..be8fa933b 100644 --- a/src/MEDMEM/MEDMEM_Support.hxx +++ b/src/MEDMEM/MEDMEM_Support.hxx @@ -13,13 +13,11 @@ #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 ; /*! @@ -30,6 +28,8 @@ class MESH ; */ +namespace MEDMEM { +class MESH ; class SUPPORT { protected: @@ -194,10 +194,12 @@ public: void intersecting(SUPPORT * mySupport) throw (MEDEXCEPTION) ; }; +}; // _____________________ // Methodes Inline // _____________________ +using namespace MEDMEM; /*! This method returns the number of all elements of the type GeometricType. diff --git a/src/MEDMEM/MEDMEM_TypeMeshDriver.cxx b/src/MEDMEM/MEDMEM_TypeMeshDriver.cxx index 721d61692..d290d76f9 100644 --- a/src/MEDMEM/MEDMEM_TypeMeshDriver.cxx +++ b/src/MEDMEM/MEDMEM_TypeMeshDriver.cxx @@ -1,5 +1,6 @@ -#include "MEDMEM_TypeMeshDriver.hxx" +using namespace std; +#include "MEDMEM_TypeMeshDriver.hxx" #include "MEDMEM_DriversDef.hxx" #include "MEDMEM_Family.hxx" @@ -8,6 +9,7 @@ #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 diff --git a/src/MEDMEM/MEDMEM_TypeMeshDriver.hxx b/src/MEDMEM/MEDMEM_TypeMeshDriver.hxx index 1354d3ef3..c729dac00 100644 --- a/src/MEDMEM/MEDMEM_TypeMeshDriver.hxx +++ b/src/MEDMEM/MEDMEM_TypeMeshDriver.hxx @@ -11,10 +11,7 @@ #include "MEDMEM_Exception.hxx" #include "utilities.h" -class MESH; -class FAMILY; -class GROUP; -class CONNECTIVITY; +using namesapce MEDMEM; /*! @@ -25,6 +22,11 @@ class CONNECTIVITY; */ +namespace MEDMEM { +class MESH; +class FAMILY; +class GROUP; +class CONNECTIVITY; class TYPE_MESH_DRIVER : public GENDRIVER { protected: @@ -204,6 +206,7 @@ private: GENDRIVER * copy(void) const ; }; +}; #endif /* TYPE_MESH_DRIVER_HXX */ diff --git a/src/MEDMEM/MEDMEM_Unit.cxx b/src/MEDMEM/MEDMEM_Unit.cxx index 8648722bb..accea0a21 100644 --- a/src/MEDMEM/MEDMEM_Unit.cxx +++ b/src/MEDMEM/MEDMEM_Unit.cxx @@ -5,6 +5,7 @@ using namespace std; */ #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()"); diff --git a/src/MEDMEM/MEDMEM_Unit.hxx b/src/MEDMEM/MEDMEM_Unit.hxx index 81a24f860..924273da1 100644 --- a/src/MEDMEM/MEDMEM_Unit.hxx +++ b/src/MEDMEM/MEDMEM_Unit.hxx @@ -13,6 +13,7 @@ #include "MEDMEM_define.hxx" //using namespace MED_EN; +namespace MEDMEM { class UNIT { protected: string _name ; @@ -58,9 +59,11 @@ public: inline int getLightIntensity() const ; } ; +} ; // inline method : +using namespace MEDMEM; inline void UNIT::setName(string Name) { _name = Name ; }; diff --git a/src/MEDMEM/MEDMEM_Utilities.hxx b/src/MEDMEM/MEDMEM_Utilities.hxx index 8c281321d..b7d76b620 100644 --- a/src/MEDMEM/MEDMEM_Utilities.hxx +++ b/src/MEDMEM/MEDMEM_Utilities.hxx @@ -1,81 +1,86 @@ -#ifdef _SALOME - -# include - -#else - -# include -# include -using namespace std; - -/* --- INFOS is always defined (without _DEBUG_): to be used for warnings, with release version --- */ - -# define HEREWEARE {cout< + +#else + +#ifndef __MEDMEM_UTILITIES +#define __MEDMEM_UTILITIES + +# include +# include +using namespace std; + +/* --- INFOS is always defined (without _DEBUG_): to be used for warnings, with release version --- */ + +# define HEREWEARE {cout< class FIELD; /*! @@ -29,6 +28,8 @@ template class FIELD; */ +namespace MEDMEM { +template class FIELD; template class VTK_FIELD_DRIVER : public GENDRIVER { protected: @@ -262,6 +263,7 @@ private: GENDRIVER * copy ( void ) const ; }; +}; /*-------------------------*/ /* template implementation */ @@ -269,6 +271,7 @@ private: /*--------------------- DRIVER PART -------------------------------*/ +using namespace MEDMEM; template void VTK_FIELD_DRIVER::setFieldName(const string & fieldName) { _fieldName = fieldName; diff --git a/src/MEDMEM/MEDMEM_VtkMedDriver.cxx b/src/MEDMEM/MEDMEM_VtkMedDriver.cxx index 78e3e982b..4fa27bae7 100644 --- a/src/MEDMEM/MEDMEM_VtkMedDriver.cxx +++ b/src/MEDMEM/MEDMEM_VtkMedDriver.cxx @@ -9,6 +9,7 @@ using namespace std; #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) diff --git a/src/MEDMEM/MEDMEM_VtkMedDriver.hxx b/src/MEDMEM/MEDMEM_VtkMedDriver.hxx index 72ee1d0a7..a3bd2fbfa 100644 --- a/src/MEDMEM/MEDMEM_VtkMedDriver.hxx +++ b/src/MEDMEM/MEDMEM_VtkMedDriver.hxx @@ -12,11 +12,12 @@ 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 { @@ -55,6 +56,7 @@ private : void writeField(FIELD_ * myField,string name) const ; }; +}; #endif /* VTK_MED_DRIVER_HXX */ diff --git a/src/MEDMEM/MEDMEM_VtkMeshDriver.cxx b/src/MEDMEM/MEDMEM_VtkMeshDriver.cxx index b991bcd10..258aac37c 100644 --- a/src/MEDMEM/MEDMEM_VtkMeshDriver.cxx +++ b/src/MEDMEM/MEDMEM_VtkMeshDriver.cxx @@ -12,6 +12,7 @@ using namespace std; #include "MEDMEM_Grid.hxx" #include +using namespace MEDMEM; VTK_MESH_DRIVER::VTK_MESH_DRIVER(): GENDRIVER(), _ptrMesh((MESH * const)MED_NULL) diff --git a/src/MEDMEM/MEDMEM_VtkMeshDriver.hxx b/src/MEDMEM/MEDMEM_VtkMeshDriver.hxx index dd795f46c..033e5dc3b 100644 --- a/src/MEDMEM/MEDMEM_VtkMeshDriver.hxx +++ b/src/MEDMEM/MEDMEM_VtkMeshDriver.hxx @@ -12,10 +12,6 @@ #include -class MESH; -class FAMILY; -class GROUP; -class CONNECTIVITY; /*! @@ -24,6 +20,11 @@ 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: @@ -76,5 +77,6 @@ private: GENDRIVER * copy ( void ) const; }; +}; #endif /* VTK_MESH_DRIVER_HXX */ diff --git a/src/MEDMEM/Makefile.in b/src/MEDMEM/Makefile.in index 99295e104..c8718cb8b 100644 --- a/src/MEDMEM/Makefile.in +++ b/src/MEDMEM/Makefile.in @@ -112,10 +112,18 @@ CPPFLAGS+=$(MED2_INCLUDES) $(HDF5_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome 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@ diff --git a/src/MEDMEM/duplicateMED.cxx b/src/MEDMEM/duplicateMED.cxx index 75a3e23e9..4bfe99192 100644 --- a/src/MEDMEM/duplicateMED.cxx +++ b/src/MEDMEM/duplicateMED.cxx @@ -4,6 +4,7 @@ using namespace std; #include "MEDMEM_Exception.hxx" #include "MEDMEM_Med.hxx" +using namespace MEDMEM; void usage(char * name) { cout << " " << name << " " < " <y)?x:y;} diff --git a/src/MEDMEM/test_MEDMEM_Array.cxx b/src/MEDMEM/test_MEDMEM_Array.cxx index be5040b3e..e030a8623 100644 --- a/src/MEDMEM/test_MEDMEM_Array.cxx +++ b/src/MEDMEM/test_MEDMEM_Array.cxx @@ -2,6 +2,7 @@ using namespace std; #include "utilities.h" #include "MEDMEM_Array.hxx" +using namespace MEDMEM; int main (int argc, char ** argv) { int SpaceDimension = 3 ; diff --git a/src/MEDMEM/test_MEDMEM_CellModel.cxx b/src/MEDMEM/test_MEDMEM_CellModel.cxx index c125aed14..695be92a9 100644 --- a/src/MEDMEM/test_MEDMEM_CellModel.cxx +++ b/src/MEDMEM/test_MEDMEM_CellModel.cxx @@ -3,6 +3,7 @@ using namespace std; #include "MEDMEM_CellModel.hxx" #include "MEDMEM_DriversDef.hxx" +using namespace MEDMEM; int main (int argc, char ** argv) { list geomList = MED_FR::meshEntities[MED_FR::MED_MAILLE] ; list::iterator itGeomList ; diff --git a/src/MEDMEM/test_MEDMEM_Meshing.cxx b/src/MEDMEM/test_MEDMEM_Meshing.cxx index feea08dea..df7346404 100644 --- a/src/MEDMEM/test_MEDMEM_Meshing.cxx +++ b/src/MEDMEM/test_MEDMEM_Meshing.cxx @@ -3,6 +3,7 @@ #include "MEDMEM_Field.hxx" using namespace std; +using namespace MEDMEM; int main (int argc, char ** argv) { diff --git a/src/MEDMEM/test_MEDMEM_ModulusArray.cxx b/src/MEDMEM/test_MEDMEM_ModulusArray.cxx index 97f6bf302..d7103e87c 100644 --- a/src/MEDMEM/test_MEDMEM_ModulusArray.cxx +++ b/src/MEDMEM/test_MEDMEM_ModulusArray.cxx @@ -2,6 +2,7 @@ using namespace std; #include "utilities.h" #include "MEDMEM_ModulusArray.hxx" +using namespace MEDMEM; int main (int argc, char ** argv) { diff --git a/src/MEDMEM/test_MEDMEM_SkyLineArray.cxx b/src/MEDMEM/test_MEDMEM_SkyLineArray.cxx index 6d7dc268e..a03100fd1 100644 --- a/src/MEDMEM/test_MEDMEM_SkyLineArray.cxx +++ b/src/MEDMEM/test_MEDMEM_SkyLineArray.cxx @@ -1,6 +1,7 @@ using namespace std; #include "utilities.h" #include "MEDMEM_SkyLineArray.hxx" +using namespace MEDMEM; int main (int argc, char ** argv) { diff --git a/src/MEDMEM/test_affect_medarray.cxx b/src/MEDMEM/test_affect_medarray.cxx index eb72d86d3..055fff524 100644 --- a/src/MEDMEM/test_affect_medarray.cxx +++ b/src/MEDMEM/test_affect_medarray.cxx @@ -17,6 +17,7 @@ using namespace std; #include "MEDMEM_Support.hxx" #include "MEDMEM_Field.hxx" #include "MEDMEM_define.hxx" +using namespace MEDMEM; void affiche_medarray(MEDARRAY & myMedArray) diff --git a/src/MEDMEM/test_copie_connectivity.cxx b/src/MEDMEM/test_copie_connectivity.cxx index 962de0640..e27c3e2a3 100644 --- a/src/MEDMEM/test_copie_connectivity.cxx +++ b/src/MEDMEM/test_copie_connectivity.cxx @@ -17,6 +17,7 @@ using namespace std; #include "MEDMEM_Support.hxx" #include "MEDMEM_Field.hxx" #include "MEDMEM_define.hxx" +using namespace MEDMEM; void affiche_connectivity(const CONNECTIVITY * myConnectivity, MESH * myMesh) { diff --git a/src/MEDMEM/test_copie_coordinate.cxx b/src/MEDMEM/test_copie_coordinate.cxx index 4a40c89df..612b023bd 100644 --- a/src/MEDMEM/test_copie_coordinate.cxx +++ b/src/MEDMEM/test_copie_coordinate.cxx @@ -17,6 +17,7 @@ using namespace std; #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) diff --git a/src/MEDMEM/test_copie_family.cxx b/src/MEDMEM/test_copie_family.cxx index 34633dc27..4c825af0e 100644 --- a/src/MEDMEM/test_copie_family.cxx +++ b/src/MEDMEM/test_copie_family.cxx @@ -15,6 +15,7 @@ using namespace std; #include "MEDMEM_Field.hxx" #include "MEDMEM_define.hxx" +using namespace MEDMEM; void affiche_support(const SUPPORT * mySupport) { diff --git a/src/MEDMEM/test_copie_fieldT.cxx b/src/MEDMEM/test_copie_fieldT.cxx index fc9ad2142..21faeeede 100644 --- a/src/MEDMEM/test_copie_fieldT.cxx +++ b/src/MEDMEM/test_copie_fieldT.cxx @@ -17,6 +17,7 @@ using namespace std; #include "MEDMEM_Support.hxx" #include "MEDMEM_Field.hxx" #include "MEDMEM_define.hxx" +using namespace MEDMEM; void affiche_field_(FIELD_ * myField, const SUPPORT * mySupport) diff --git a/src/MEDMEM/test_copie_field_.cxx b/src/MEDMEM/test_copie_field_.cxx index 0598a26b1..13f3054f9 100644 --- a/src/MEDMEM/test_copie_field_.cxx +++ b/src/MEDMEM/test_copie_field_.cxx @@ -16,6 +16,7 @@ #include "MEDMEM_Support.hxx" #include "MEDMEM_Field.hxx" #include "MEDMEM_define.hxx" +using namespace MEDMEM; void affiche_field(FIELD_ * myField, const SUPPORT * mySupport) diff --git a/src/MEDMEM/test_copie_group.cxx b/src/MEDMEM/test_copie_group.cxx index 96e464f7d..d45c9c2ca 100644 --- a/src/MEDMEM/test_copie_group.cxx +++ b/src/MEDMEM/test_copie_group.cxx @@ -15,6 +15,7 @@ using namespace std; #include "MEDMEM_Field.hxx" #include "MEDMEM_define.hxx" +using namespace MEDMEM; void affiche_support(const SUPPORT * mySupport) { diff --git a/src/MEDMEM/test_copie_medarray.cxx b/src/MEDMEM/test_copie_medarray.cxx index 3cd8745bc..bbb6561e6 100644 --- a/src/MEDMEM/test_copie_medarray.cxx +++ b/src/MEDMEM/test_copie_medarray.cxx @@ -18,6 +18,7 @@ using namespace std; #include "MEDMEM_Field.hxx" #include "MEDMEM_define.hxx" +using namespace MEDMEM; void affiche_medarray(MEDARRAY & myMedArray) { diff --git a/src/MEDMEM/test_copie_mesh.cxx b/src/MEDMEM/test_copie_mesh.cxx index c8e83c56e..4fd1ebdad 100644 --- a/src/MEDMEM/test_copie_mesh.cxx +++ b/src/MEDMEM/test_copie_mesh.cxx @@ -14,6 +14,7 @@ using namespace std; #include "MEDMEM_Support.hxx" #include "MEDMEM_Field.hxx" #include "MEDMEM_define.hxx" +using namespace MEDMEM; int main (int argc, char ** argv) { diff --git a/src/MEDMEM/test_copie_support.cxx b/src/MEDMEM/test_copie_support.cxx index 5abfe4f5e..6a7367ddb 100644 --- a/src/MEDMEM/test_copie_support.cxx +++ b/src/MEDMEM/test_copie_support.cxx @@ -14,6 +14,7 @@ using namespace std; #include "MEDMEM_Support.hxx" #include "MEDMEM_Field.hxx" #include "MEDMEM_define.hxx" +using namespace MEDMEM; void affiche_support(const SUPPORT * mySupport) diff --git a/src/MEDMEM/test_gibi_driver.cxx b/src/MEDMEM/test_gibi_driver.cxx index cfa50ec21..216da9797 100644 --- a/src/MEDMEM/test_gibi_driver.cxx +++ b/src/MEDMEM/test_gibi_driver.cxx @@ -1,6 +1,8 @@ +using namespace std; + #include "MEDMEM_GibiMeshDriver.hxx" #include "MEDMEM_Mesh.hxx" - +using namespace MEDMEM; int main (int argc, char ** argv) { /* process the arguments */ diff --git a/src/MEDMEM/test_operation_fielddouble.cxx b/src/MEDMEM/test_operation_fielddouble.cxx index 4338f6ed5..5dfa91737 100644 --- a/src/MEDMEM/test_operation_fielddouble.cxx +++ b/src/MEDMEM/test_operation_fielddouble.cxx @@ -23,6 +23,7 @@ double myfunction1(double x) using namespace std; +using namespace MEDMEM; void affiche_field_(FIELD_ * myField, const SUPPORT * mySupport) { cout << "Field "<< myField->getName() << " : " <getDescription() << endl ; diff --git a/src/MEDMEM/test_operation_fieldint.cxx b/src/MEDMEM/test_operation_fieldint.cxx index 48e33eaba..e0389cfbd 100644 --- a/src/MEDMEM/test_operation_fieldint.cxx +++ b/src/MEDMEM/test_operation_fieldint.cxx @@ -16,6 +16,7 @@ #include "MEDMEM_Field.hxx" #include "MEDMEM_define.hxx" +using namespace MEDMEM; int myfunction1(int x) { return 2*x; diff --git a/src/MEDMEM/tests/readCoordinate.cxx b/src/MEDMEM/tests/readCoordinate.cxx index 1e8d451b0..71f0d1008 100755 --- a/src/MEDMEM/tests/readCoordinate.cxx +++ b/src/MEDMEM/tests/readCoordinate.cxx @@ -27,6 +27,7 @@ using namespace std; #include "MEDMEM_Exception.hxx" #include "MEDMEM_define.hxx" #include "MEDMEM_Mesh.hxx" +using namespace MEDMEM; void usage(char * name) { diff --git a/src/MEDMEM/tests/readEntete.cxx b/src/MEDMEM/tests/readEntete.cxx index 56f008638..01e83ce3a 100755 --- a/src/MEDMEM/tests/readEntete.cxx +++ b/src/MEDMEM/tests/readEntete.cxx @@ -28,6 +28,7 @@ using namespace std; #include "MEDMEM_define.hxx" #include "MEDMEM_Mesh.hxx" #include "MEDMEM_DriversDef.hxx" +using namespace MEDMEM; void usage(char * name) { diff --git a/src/MEDMEM/tests/testUArray.cxx b/src/MEDMEM/tests/testUArray.cxx index 7f9b534e8..405de1350 100755 --- a/src/MEDMEM/tests/testUArray.cxx +++ b/src/MEDMEM/tests/testUArray.cxx @@ -26,6 +26,7 @@ using namespace std; #include // 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) { diff --git a/src/MEDMEM/tests/testUArray.cxx.ok b/src/MEDMEM/tests/testUArray.cxx.ok index 73b0b894a..8ed37162c 100755 --- a/src/MEDMEM/tests/testUArray.cxx.ok +++ b/src/MEDMEM/tests/testUArray.cxx.ok @@ -1,6 +1,7 @@ #include // pour l'acces à EXIT_SUCCESS et EXIT_FAILURE #include "utilities.h" #include "MEDMEM_Array.hxx" +using namespace MEDMEM; int main (int argc, char ** argv) { diff --git a/src/MEDMEM/tests/testUCellModel.cxx b/src/MEDMEM/tests/testUCellModel.cxx index d8119e65c..96f6e3d01 100755 --- a/src/MEDMEM/tests/testUCellModel.cxx +++ b/src/MEDMEM/tests/testUCellModel.cxx @@ -30,6 +30,7 @@ using namespace std; #include "MEDMEM_CellModel.hxx" #include "MEDMEM_define.hxx" #include "MEDMEM_DriversDef.hxx" +using namespace MEDMEM; void usage(char * name) { diff --git a/src/MEDMEM/tests/testUCoordinate.cxx b/src/MEDMEM/tests/testUCoordinate.cxx index 41529316a..53841bdbc 100755 --- a/src/MEDMEM/tests/testUCoordinate.cxx +++ b/src/MEDMEM/tests/testUCoordinate.cxx @@ -31,6 +31,7 @@ using namespace std; #include "MEDMEM_Array.hxx" #include "MEDMEM_Coordinate.hxx" #include +using namespace MEDMEM; void usage(char * name) { diff --git a/src/MEDMEM/tests/testUMedException.cxx b/src/MEDMEM/tests/testUMedException.cxx index 5a2b501d7..7b735f1d4 100644 --- a/src/MEDMEM/tests/testUMedException.cxx +++ b/src/MEDMEM/tests/testUMedException.cxx @@ -26,6 +26,7 @@ using namespace std; #include #include "MEDMEM_STRING.hxx" #include "MEDMEM_Exception.hxx" +using namespace MEDMEM; int main (int argc, char ** argv) { diff --git a/src/MEDMEM/tests/testUModulusArray.cxx b/src/MEDMEM/tests/testUModulusArray.cxx index bfa5890b4..663197935 100644 --- a/src/MEDMEM/tests/testUModulusArray.cxx +++ b/src/MEDMEM/tests/testUModulusArray.cxx @@ -27,6 +27,7 @@ using namespace std; #include #include "utilities.h" #include "MEDMEM_ModulusArray.hxx" +using namespace MEDMEM; int main (int argc, char ** argv) { diff --git a/src/MEDMEM/tests/testUPointerOf.cxx b/src/MEDMEM/tests/testUPointerOf.cxx index b3c213a92..ce6c48d5d 100644 --- a/src/MEDMEM/tests/testUPointerOf.cxx +++ b/src/MEDMEM/tests/testUPointerOf.cxx @@ -9,6 +9,7 @@ using namespace std; #include "utilities.h" #include "MEDMEM_PointerOf.hxx" #include "MEDMEM_Exception.hxx" +using namespace MEDMEM; int main (int argc, char ** argv) diff --git a/src/MEDMEM/tests/testUSkyLineArray.cxx b/src/MEDMEM/tests/testUSkyLineArray.cxx index c48cfae10..b3d6f3dcb 100644 --- a/src/MEDMEM/tests/testUSkyLineArray.cxx +++ b/src/MEDMEM/tests/testUSkyLineArray.cxx @@ -26,6 +26,7 @@ using namespace std; #include #include "utilities.h" #include "MEDMEM_SkyLineArray.hxx" +using namespace MEDMEM; int main (int argc, char ** argv) { diff --git a/src/MEDMEM/tests/testUUnit.cxx b/src/MEDMEM/tests/testUUnit.cxx index 8cc40135f..a4fbe348c 100755 --- a/src/MEDMEM/tests/testUUnit.cxx +++ b/src/MEDMEM/tests/testUUnit.cxx @@ -27,6 +27,7 @@ using namespace std; #include #include "MEDMEM_Unit.hxx" +using namespace MEDMEM; int main (int argc, char ** argv) { diff --git a/src/MEDMEM_I/MEDMEM_Family_i.cxx b/src/MEDMEM_I/MEDMEM_Family_i.cxx new file mode 100644 index 000000000..33f00038f --- /dev/null +++ b/src/MEDMEM_I/MEDMEM_Family_i.cxx @@ -0,0 +1,327 @@ +//============================================================================= +// 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;igetAttributeIdentifier(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;igetAttributeValue(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;igetAttributeDescription(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;igetGroupName(i).c_str()); + } + catch (MEDEXCEPTION &ex) + { + MESSAGE("Unable to acces specified attribut description"); + THROW_SALOME_CORBA_EXCEPTION(ex.what(),SALOME::INTERNAL_ERROR); + } +} + diff --git a/src/MEDMEM_I/MEDMEM_Family_i.hxx b/src/MEDMEM_I/MEDMEM_Family_i.hxx new file mode 100644 index 000000000..20ac7ce88 --- /dev/null +++ b/src/MEDMEM_I/MEDMEM_Family_i.hxx @@ -0,0 +1,57 @@ +//============================================================================= +// 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_ */ diff --git a/src/MEDMEM_I/MEDMEM_FieldDouble_i.cxx b/src/MEDMEM_I/MEDMEM_FieldDouble_i.cxx new file mode 100644 index 000000000..2ea79bba3 --- /dev/null +++ b/src/MEDMEM_I/MEDMEM_FieldDouble_i.cxx @@ -0,0 +1,102 @@ +//============================================================================= +// 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() +{ + 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(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 * const f): FIELDOF_i(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 + +#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 +{ +private: + +public: + FIELDDOUBLE_i(); + ~FIELDDOUBLE_i(); + FIELDDOUBLE_i(SALOME_MED::SUPPORT_ptr mySupportIOR,::FIELD * 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_ */ diff --git a/src/MEDMEM_I/MEDMEM_FieldInt_i.cxx b/src/MEDMEM_I/MEDMEM_FieldInt_i.cxx new file mode 100644 index 000000000..f3d40e209 --- /dev/null +++ b/src/MEDMEM_I/MEDMEM_FieldInt_i.cxx @@ -0,0 +1,102 @@ +//============================================================================= +// 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() +{ + 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 * const f): FIELDOF_i(mySupportIOR,f) +{ + BEGIN_OF("Constructor FIELDINT_i"); + END_OF(" Constructor FIELDINT_i"); +} +//============================================================================= +/*! + * Constructor par recopie + */ +//============================================================================= +FIELDINT_i::FIELDINT_i(FIELDINT_i &fi): + FIELDOF_i(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 + +#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 +{ +private: + FIELDINT_i(); + +public: + ~FIELDINT_i(); + FIELDINT_i(SALOME_MED::SUPPORT_ptr mySupportIOR, ::FIELD * 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_ */ diff --git a/src/MEDMEM_I/MEDMEM_FieldOf_i.hxx b/src/MEDMEM_I/MEDMEM_FieldOf_i.hxx new file mode 100644 index 000000000..3b0e93b44 --- /dev/null +++ b/src/MEDMEM_I/MEDMEM_FieldOf_i.hxx @@ -0,0 +1,627 @@ +//============================================================================= +// 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 +#include +# include + +#include + +# 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 FIELDOF_i: public FIELD_i +{ +public : + static map < int, ::MEDMEM::FIELD * > fieldMap ; +protected : + static int fieldIndex ; + +protected : + // C++ object containing values + + ::MEDMEM::FIELD * 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 * const field); + FIELDOF_i(::FIELD * 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 * constructConstField() const; + + }; +} +using namespace MEDMEM; +template map < int, ::FIELD * > FIELDOF_i::fieldMap ; +template int FIELDOF_i::fieldIndex = 0; +//============================================================================= +/*! + * Default constructor + */ +//============================================================================= + +//template FIELDOF_i::FIELDOF_i():_fieldTptr(FIELDOF_i::constructConstField()) +template FIELDOF_i::FIELDOF_i():_fieldTptr(constructConstField()), + _support((SALOME_MED::SUPPORT_ptr) NULL) +{ + BEGIN_OF("Default Constructor Field_i"); + END_OF(" Default Constructor Field_i"); +} +//============================================================================= +/*! + * Destructor + */ +//============================================================================= +template FIELDOF_i::~FIELDOF_i() +{ +} +//============================================================================= +/*! + * Constructor + */ +//============================================================================= +template FIELDOF_i::FIELDOF_i(SALOME_MED::SUPPORT_ptr support,::FIELD * const field): + _fieldTptr(field), + _corbaIndex(FIELDOF_i::fieldIndex++), + _FieldId(""), + _support(SALOME_MED::SUPPORT::_duplicate(support)) +{ + BEGIN_OF("Constructor FIELDOF_i(SALOME_MED::SUPPORT_ptr support,::FIELD * const field)"); + FIELDOF_i::fieldMap[_corbaIndex]=_fieldTptr; + + MESSAGE("FIELDOF_i::FIELDOF_i Checking of pointeurs !!!"); + + SCRUTE(_fieldTptr); + SCRUTE(_support); + SCRUTE(_support->getMesh()); + + END_OF("Constructor FIELDOF_i(SALOME_MED::SUPPORT_ptr support,::FIELD * const field)"); +} + + +template FIELDOF_i::FIELDOF_i( FIELD * const f): + _fieldTptr(f), + _corbaIndex(FIELDOF_i::fieldIndex++), + _FieldId(""), + _support((SALOME_MED::SUPPORT_ptr) NULL) +{ + BEGIN_OF("Constructor Field_i"); + FIELDOF_i::fieldMap[_corbaIndex]=_fieldTptr; + END_OF("Constructor Field_i"); +} +//============================================================================= +/*! + * Constructor par recopie + */ +//============================================================================= +template FIELDOF_i::FIELDOF_i( FIELDOF_i & f):_fieldTptr(f._fieldTptr), + _corbaIndex(FIELDOF_i::fieldIndex++), + _FieldId("") +{ + BEGIN_OF("Constructor Field_i"); + FIELDOF_i::fieldMap[_corbaIndex]=_fieldTptr; + END_OF("Constructor Field_i"); +} +//============================================================================= +/*! + * Constructor d un pointeur constant + */ +//============================================================================= +template ::FIELD * FIELDOF_i::constructConstField() const +{ + ::FIELD * const ptrField =new ::FIELD(); + return ptrField; +} +//============================================================================= +/*! + * CORBA: Accessor for Fields's Name + */ +//============================================================================= +template char * FIELDOF_i::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 char * FIELDOF_i::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 SALOME_MED::SUPPORT_ptr FIELDOF_i::getSupport() + throw (SALOME::SALOME_Exception) +{ + BEGIN_OF("SALOME_MED::SUPPORT_ptr FIELDOF_i::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::getSupport()"); + + return support ; +} +//============================================================================= +/*! + * CORBA: Accessor for Fields's Number of components + */ +//============================================================================= +template CORBA::Long FIELDOF_i::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 char * FIELDOF_i::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 char * FIELDOF_i::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 CORBA::Long FIELDOF_i::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 CORBA::Long FIELDOF_i::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 CORBA::Long FIELDOF_i::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 CORBA::Double FIELDOF_i::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 SALOME_MED::string_array * FIELDOF_i::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 SALOME_MED::string_array * FIELDOF_i::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 void FIELDOF_i::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_::Instance() ; + ASSERT(SINGLETON_::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 void FIELDOF_i::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 void FIELDOF_i::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 void FIELDOF_i::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 CORBA::Long FIELDOF_i::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_ */ diff --git a/src/MEDMEM_I/MEDMEM_Field_i.cxx b/src/MEDMEM_I/MEDMEM_Field_i.cxx new file mode 100644 index 000000000..84584e430 --- /dev/null +++ b/src/MEDMEM_I/MEDMEM_Field_i.cxx @@ -0,0 +1,21 @@ +//============================================================================= +// 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() +{ +} + diff --git a/src/MEDMEM_I/MEDMEM_Field_i.hxx b/src/MEDMEM_I/MEDMEM_Field_i.hxx new file mode 100644 index 000000000..e0f195cac --- /dev/null +++ b/src/MEDMEM_I/MEDMEM_Field_i.hxx @@ -0,0 +1,68 @@ +//============================================================================= +// 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 + +# 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__ */ diff --git a/src/MEDMEM_I/MEDMEM_Group_i.cxx b/src/MEDMEM_I/MEDMEM_Group_i.cxx new file mode 100644 index 000000000..d405cdf50 --- /dev/null +++ b/src/MEDMEM_I/MEDMEM_Group_i.cxx @@ -0,0 +1,144 @@ +//============================================================================= +// 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 + +#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 fam(nbfam); + fam = _group->getFamilies(); + for (int i=0;iPOA_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); + } +}; diff --git a/src/MEDMEM_I/MEDMEM_Group_i.hxx b/src/MEDMEM_I/MEDMEM_Group_i.hxx new file mode 100644 index 000000000..5af4b6122 --- /dev/null +++ b/src/MEDMEM_I/MEDMEM_Group_i.hxx @@ -0,0 +1,42 @@ +//============================================================================= +// 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_ */ diff --git a/src/MEDMEM_I/MEDMEM_Med_i.cxx b/src/MEDMEM_I/MEDMEM_Med_i.cxx new file mode 100644 index 000000000..2efef40bc --- /dev/null +++ b/src/MEDMEM_I/MEDMEM_Med_i.cxx @@ -0,0 +1,748 @@ +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 + +//#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 meshesNames = _med->getMeshNames(); + int numberOfMeshes = meshesNames.size(); + for (int i=0; igetMesh(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 familyVector; + vector::iterator familyVectorIt; + // GROUPS : + // we add all groups + vector groupVector; + vector::iterator groupVectorIt; + + MED_FR::MESH_ENTITIES::const_iterator currentEntity; + for (int i=0; igetMesh(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 mySupports = _med->getSupports(meshesNames[i]); + map::const_iterator itSupport; + map & 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 fieldsNames = _med->getFieldNames(); + int numberOfFields = fieldsNames.size(); + for (int i=0; i myIteration = _med->getFieldIteration (fieldsNames[i]); + int numberOfIteration = myIteration.size(); + for (int j=0; jgetField(fieldsNames[i], myIteration[j].dt, myIteration[j].it); + string meshName = myField->getSupport()->getMesh()->getName(); + medEntityMesh myEntity = myField->getSupport()->getEntity(); + map >::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 & SupportOnMesh + = (*itSupportOnMesh).second; + map::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*)myField)->read(); + FIELDINT_i * myFieldIntI = new FIELDINT_i(mySupportIOR,(FIELD*)myField); + POA_SALOME_MED::FIELD_tie * myFieldTie + = new POA_SALOME_MED::FIELD_tie(myFieldIntI); + myFieldIOR = myFieldTie->_this(); + myFieldIntI->addInStudy(myStudy,myFieldIOR); + break; + } + + case MED_FR::MED_REEL64: + { + ((FIELD*)myField)->read(); + FIELDDOUBLE_i * myFieldDoubleI + = new FIELDDOUBLE_i(mySupportIOR,(FIELD*)myField); + POA_SALOME_MED::FIELD_tie * myFieldTie + = new POA_SALOME_MED::FIELD_tie(myFieldDoubleI); + myFieldIOR = myFieldTie->_this(); + myFieldDoubleI->addInStudy(myStudy,myFieldIOR); + break; + } + default: + { + throw MED_EXCEPTION ( LOCALIZED( STRING(LOC) + <<" * Iteration "< meshesNames = _med->getMeshNames(); + int numberOfMeshes = meshesNames.size(); + for (int i=0; igetMesh(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 mySupports = _med->getSupports(meshesNames[i]); + map::const_iterator itSupport; + map & + 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 fieldsNames = _med->getFieldNames(); + int numberOfFields = fieldsNames.size(); + for (int i=0; i myIteration = _med->getFieldIteration (fieldsNames[i]); + int numberOfIteration = myIteration.size(); + for (int j=0; jgetField(fieldsNames[i],myIteration[j].dt,myIteration[j].it); + string meshName = myField->getSupport()->getMesh()->getName(); + medEntityMesh myEntity = myField->getSupport()->getEntity(); + map >::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 & SupportOnMesh + = (*itSupportOnMesh).second; + map::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*)myField)->read(); + FIELDINT_i * myFieldIntI + = new FIELDINT_i(mySupportIOR,(FIELD*)myField); + SALOME_MED::FIELDINT_ptr myFieldIntIOR; + POA_SALOME_MED::FIELDINT_tie * myFieldIntTie + = new POA_SALOME_MED::FIELDINT_tie(myFieldIntI); + myFieldIntIOR = myFieldIntTie->_this(); + myFieldIntI->addInStudy(myStudy,myFieldIntIOR); + _fields[fieldsNames[i]][dtIt] = myFieldIntIOR; + break; + } + + case MED_FR::MED_REEL64: + { + ((FIELD*)myField)->read(); + FIELDDOUBLE_i * myFieldDoubleI + = new FIELDDOUBLE_i(mySupportIOR,(FIELD*)myField); + SALOME_MED::FIELDDOUBLE_ptr myFieldDoubleIOR; + POA_SALOME_MED::FIELDDOUBLE_tie * myFieldDoubleTie + = new POA_SALOME_MED::FIELDDOUBLE_tie(myFieldDoubleI); + myFieldDoubleIOR = myFieldDoubleTie->_this(); + myFieldDoubleI->addInStudy(myStudy,myFieldDoubleIOR); + _fields[fieldsNames[i]][dtIt] = myFieldDoubleIOR; + break; + } + + default: + { + throw MED_EXCEPTION ( LOCALIZED( STRING(LOC) + <<" * Iteration "<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;igetNumberOfFields(); + myseq->length(nbFields); + string * nameFields = new string[nbFields]; + _med->getFieldNames(nameFields); + for (int i=0;igetMesh(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::fieldMap.find(ind) + !=FIELDOF_i::fieldMap.end()); + ::FIELD * fdouble = FIELDOF_i::fieldMap[ind]; + MESH * mesh=_med->getMesh(fdouble); + } + else + { + MESSAGE("Integer"); + ASSERT(FIELDOF_i::fieldMap.find(ind)!=FIELDOF_i::fieldMap.end()); + ::FIELD * fint = FIELDOF_i::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::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::fieldMap.find(ind) + !=FIELDOF_i::fieldMap.end()); + ::FIELD * fdouble = FIELDOF_i::fieldMap[ind]; + // A modifier + //_med->addField(fdouble); + } + else + { + MESSAGE("Integer"); + ASSERT(FIELDOF_i::fieldMap.find(ind)!=FIELDOF_i::fieldMap.end()); + ::FIELD * fint = FIELDOF_i::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_::Instance(); + ASSERT(SINGLETON_::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)"); +} + diff --git a/src/MEDMEM_I/MEDMEM_Med_i.hxx b/src/MEDMEM_I/MEDMEM_Med_i.hxx new file mode 100644 index 000000000..b2decc829 --- /dev/null +++ b/src/MEDMEM_I/MEDMEM_Med_i.hxx @@ -0,0 +1,88 @@ +//============================================================================= +// 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 + +#include + +#include CORBA_SERVER_HEADER(MED) +#include CORBA_SERVER_HEADER(SALOMEDS) +#include CORBA_SERVER_HEADER(SALOMEDS_Attributes) + +#include "MEDMEM_Med.hxx" + +namespace MEDMEM { +typedef map 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 _meshes; // We can't have two MESHes with the same name. + + map > _supports; + + map _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 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_ */ diff --git a/src/MEDMEM_I/MEDMEM_Mesh_i.cxx b/src/MEDMEM_I/MEDMEM_Mesh_i.cxx new file mode 100644 index 000000000..97abcd905 --- /dev/null +++ b/src/MEDMEM_I/MEDMEM_Mesh_i.cxx @@ -0,0 +1,1505 @@ +//============================================================================= +// 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 + +#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; igetSpaceDimension(); + const string * coordinatesName =_mesh->getCoordinatesNames(); + myseq->length(spaceDimension); + for (int i=0; igetSpaceDimension(); + const string * coordinatesUnits =_mesh->getCoordinatesUnits(); + myseq->length(spaceDimension); + for (int i=0; igetNumberOfNodes(); + } + 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; igetNumberOfElements(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;igetNumberOfElements( + convertIdlEntToMedEnt(entity), + MED_ALL_ELEMENTS); + myseq->length(nbelements); + const int * numbers=_mesh->getConnectivityIndex(convertIdlConnToMedConn(mode), + convertIdlEntToMedEnt(entity)); + for (int i=0;igetNumberOfTypes( convertIdlEntToMedEnt(entity)) + 1; + myseq->length(nbelements); + const int * numbers=_mesh->getGlobalNumberingIndex( convertIdlEntToMedEnt(entity)); + for (int i=0;igetElementNumber(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;igetNumberOfNodes(); + } + 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;igetNumberOfFamilies(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 fam(nbfam); + fam = _mesh->getFamilies(convertIdlEntToMedEnt(entity)); + for (int i=0;iPOA_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; icoordUnits[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; imeshTypes[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 vNode (nbFam); + vNode = _mesh->getFamilies(MED_NODE); + for (int i=0;iPOA_SALOME_MED::FAMILY::_this(); + f1->_remove_ref(); + all->famNode[i] = f2; + } + + nbFam = _mesh->getNumberOfFamilies(MED_EDGE); + all->famEdge.length(nbFam); + vector vEdge (nbFam); + vEdge = _mesh->getFamilies(MED_EDGE); + for (int i=0;iPOA_SALOME_MED::FAMILY::_this(); + f1->_remove_ref(); + all->famEdge[i] = f2; + } + + nbFam = _mesh->getNumberOfFamilies(MED_FACE); + all->famFace.length(nbFam); + vector vFace (nbFam); + vFace = _mesh->getFamilies(MED_FACE); + for (int i=0;iPOA_SALOME_MED::FAMILY::_this(); + f1->_remove_ref(); + all->famFace[i] = f2; + } + + nbFam = _mesh->getNumberOfFamilies(MED_CELL); + all->famCell.length(nbFam); + vector vCell (nbFam); + vCell = _mesh->getFamilies(MED_CELL); + for (int i=0;iPOA_SALOME_MED::FAMILY::_this(); + f1->_remove_ref(); + all->famCell[i] = f2; + } + + int nbGroup = _mesh->getNumberOfGroups(MED_NODE); + all->groupNode.length(nbGroup); + vector gNode (nbGroup); + gNode = _mesh->getGroups(MED_NODE); + for (int i=0;iPOA_SALOME_MED::GROUP::_this(); + f1->_remove_ref(); + all->groupNode[i] = f2; + } + + nbGroup = _mesh->getNumberOfGroups(MED_EDGE); + all->groupEdge.length(nbGroup); + vector gEdge (nbGroup); + gEdge = _mesh->getGroups(MED_EDGE); + for (int i=0;iPOA_SALOME_MED::GROUP::_this(); + f1->_remove_ref(); + all->groupEdge[i] = f2; + } + nbGroup = _mesh->getNumberOfGroups(MED_FACE); + all->groupFace.length(nbGroup); + vector gFace (nbGroup); + gFace = _mesh->getGroups(MED_FACE); + for (int i=0;iPOA_SALOME_MED::GROUP::_this(); + f1->_remove_ref(); + all->groupFace[i] = f2; + } + + nbGroup = _mesh->getNumberOfGroups(MED_CELL); + all->groupCell.length(nbGroup); + vector gCell (nbGroup); + gCell = _mesh->getGroups(MED_CELL); + for (int i=0;iPOA_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 groups(nbgroups); + groups = _mesh->getGroups(convertIdlEntToMedEnt(entity)); + for (int i=0;iPOA_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*f=_mesh->getVolume( myCppSupport); + FIELDDOUBLE_i * medf = new FIELDDOUBLE_i(mySupport,f); + POA_SALOME_MED::FIELDDOUBLE_tie * f1 = + new POA_SALOME_MED::FIELDDOUBLE_tie(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*f=_mesh->getArea( myCppSupport); + FIELDDOUBLE_i * medf = new FIELDDOUBLE_i(mySupport,f); + POA_SALOME_MED::FIELDDOUBLE_tie * f1 = + new POA_SALOME_MED::FIELDDOUBLE_tie(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*f=_mesh->getLength( myCppSupport); + FIELDDOUBLE_i * medf = new FIELDDOUBLE_i(mySupport,f); + POA_SALOME_MED::FIELDDOUBLE_tie * f1 = + new POA_SALOME_MED::FIELDDOUBLE_tie(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*f=_mesh->getNormal( myCppSupport); + FIELDDOUBLE_i * medf = new FIELDDOUBLE_i(mySupport,f); + POA_SALOME_MED::FIELDDOUBLE_tie * f1 = + new POA_SALOME_MED::FIELDDOUBLE_tie(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*f=_mesh->getBarycenter( myCppSupport); + FIELDDOUBLE_i * medf = new FIELDDOUBLE_i(mySupport,f); + POA_SALOME_MED::FIELDDOUBLE_tie * f1 = + new POA_SALOME_MED::FIELDDOUBLE_tie(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_::Instance() ; + ASSERT(SINGLETON_::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_::Instance() ; + ASSERT(SINGLETON_::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); + } +} + diff --git a/src/MEDMEM_I/MEDMEM_Mesh_i.hxx b/src/MEDMEM_I/MEDMEM_Mesh_i.hxx new file mode 100644 index 000000000..de4ba198a --- /dev/null +++ b/src/MEDMEM_I/MEDMEM_Mesh_i.hxx @@ -0,0 +1,184 @@ +//============================================================================= +// 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 +#include + +#include +#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_ */ diff --git a/src/MEDMEM_I/MEDMEM_Support_i.cxx b/src/MEDMEM_I/MEDMEM_Support_i.cxx new file mode 100644 index 000000000..3886faab2 --- /dev/null +++ b/src/MEDMEM_I/MEDMEM_Support_i.cxx @@ -0,0 +1,597 @@ +//============================================================================= +// 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;itypes[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;igetNumberOfElements(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;igetNumberOfElements(::MED_ALL_ELEMENTS); + myseq->length(nbelements); + const int * numbers=_support->getNumberIndex(); + for (int i=0;i(_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;igetNumberOfGaussPoint(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_::Instance() ; + ASSERT(SINGLETON_::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_::Instance() ; + ASSERT(SINGLETON_::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"); +} diff --git a/src/MEDMEM_I/MEDMEM_Support_i.hxx b/src/MEDMEM_I/MEDMEM_Support_i.hxx new file mode 100644 index 000000000..03afd5a87 --- /dev/null +++ b/src/MEDMEM_I/MEDMEM_Support_i.hxx @@ -0,0 +1,85 @@ +//============================================================================= +// 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 +#include + +#include + +#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_ */ diff --git a/src/MEDMEM_I/MEDMEM_convert.cxx b/src/MEDMEM_I/MEDMEM_convert.cxx new file mode 100644 index 000000000..1e6cdaa76 --- /dev/null +++ b/src/MEDMEM_I/MEDMEM_convert.cxx @@ -0,0 +1,282 @@ +//============================================================================= +// 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; +} diff --git a/src/MEDMEM_I/MEDMEM_convert.hxx b/src/MEDMEM_I/MEDMEM_convert.hxx new file mode 100644 index 000000000..abdef9937 --- /dev/null +++ b/src/MEDMEM_I/MEDMEM_convert.hxx @@ -0,0 +1,46 @@ +//============================================================================= +// 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 +#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__ ) */ diff --git a/src/MEDMEM_I/Makefile.in b/src/MEDMEM_I/Makefile.in new file mode 100644 index 000000000..ca4f62793 --- /dev/null +++ b/src/MEDMEM_I/Makefile.in @@ -0,0 +1,75 @@ +# 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@ diff --git a/src/MEDMEM_I/README b/src/MEDMEM_I/README new file mode 100644 index 000000000..4db505ab6 --- /dev/null +++ b/src/MEDMEM_I/README @@ -0,0 +1,15 @@ +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 diff --git a/src/MEDMEM_SWIG/MEDMEM_SWIG_FieldDouble.cxx b/src/MEDMEM_SWIG/MEDMEM_SWIG_FieldDouble.cxx index 4a7d77514..ca035fdb1 100644 --- a/src/MEDMEM_SWIG/MEDMEM_SWIG_FieldDouble.cxx +++ b/src/MEDMEM_SWIG/MEDMEM_SWIG_FieldDouble.cxx @@ -1,5 +1,6 @@ using namespace std; #include "MEDMEM_SWIG_FieldDouble.hxx" +using namespace MEDMEM; //============================================================================= /*! diff --git a/src/MEDMEM_SWIG/Makefile.in b/src/MEDMEM_SWIG/Makefile.in index 8c5657104..327b82a75 100644 --- a/src/MEDMEM_SWIG/Makefile.in +++ b/src/MEDMEM_SWIG/Makefile.in @@ -59,7 +59,7 @@ CPPFLAGS+= $(PYTHON_INCLUDES) $(MED2_INCLUDES) $(HDF5_INCLUDES) -I${KERNEL_ROOT_ 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 ############################################################################# diff --git a/src/MED_SWIG/MED_shared_modules.py b/src/MED_SWIG/MED_shared_modules.py index 036caa329..bf550b3e9 100644 --- a/src/MED_SWIG/MED_shared_modules.py +++ b/src/MED_SWIG/MED_shared_modules.py @@ -7,10 +7,10 @@ # (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 @@ -18,4 +18,4 @@ def init_shared_modules(): """ This function initializes shared modules that need to be """ - pass \ No newline at end of file + pass diff --git a/src/Makefile.in b/src/Makefile.in index a46e29848..25fc25743 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -31,6 +31,6 @@ VPATH=.:@srcdir@ @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@ diff --git a/src/MedClient/src/CONNECTIVITYClient.cxx b/src/MedClient/src/CONNECTIVITYClient.cxx index 440ab6136..2a33eb8ca 100644 --- a/src/MedClient/src/CONNECTIVITYClient.cxx +++ b/src/MedClient/src/CONNECTIVITYClient.cxx @@ -1,7 +1,15 @@ -#include +#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), @@ -18,6 +26,11 @@ CONNECTIVITYClient::CONNECTIVITYClient(const SALOME_MED::MESH_ptr m, END_OF("CONNECTIVITYClient::CONNECTIVITYClient()"); } +//============================================================================= +/*! + * Destructeur + */ +//============================================================================= CONNECTIVITYClient::~CONNECTIVITYClient() { BEGIN_OF("CONNECTIVITYClient::~CONNECTIVITYClient()"); @@ -28,18 +41,38 @@ 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 + // (Types, nT, IOR_Mesh->getTypes(Entity)); convertCorbaArray - (Types, nT, IOR_Mesh->getTypes(Entity)); + (Types, nT, &all->meshTypes); ASSERT(nT == (int) getNumberOfTypes(Entity)); SCRUTE(nT); @@ -48,9 +81,11 @@ void CONNECTIVITYClient::blankCopy() _totalNumberOfElements_client = 0L; _numberOfElements_client = new long[nT]; - for (iT=0; iTgetNumberOfElements(Entity, Types[iT]); + for (iT=0; iTgetNumberOfElements(Entity, Types[iT]); + _numberOfElements_client[iT] = all->numberOfElements[iT]; _totalNumberOfElements_client += _numberOfElements_client[iT]; SCRUTE(iT); SCRUTE(_numberOfElements_client[iT]); @@ -61,6 +96,10 @@ void CONNECTIVITYClient::blankCopy() END_OF("CONNECTIVITYClient::blankCopy()"); } +//============================================================================= +/*! + */ +//============================================================================= void CONNECTIVITYClient::fillCopy() { @@ -109,6 +148,10 @@ void CONNECTIVITYClient::fillCopy() END_OF("void CONNECTIVITYClient::fillCopy()"); } +//============================================================================= +/*! + */ +//============================================================================= med_int CONNECTIVITYClient::getNumberOf(medEntityMesh Entity, medGeometryElement Type) const { @@ -146,6 +189,10 @@ med_int CONNECTIVITYClient::getNumberOf(medEntityMesh Entity, return n; } +//============================================================================= +/*! + */ +//============================================================================= const med_int * CONNECTIVITYClient::getConnectivity (medConnectivity ConnectivityType, medEntityMesh Entity, @@ -163,6 +210,10 @@ const med_int * CONNECTIVITYClient::getConnectivity return c; } +//============================================================================= +/*! + */ +//============================================================================= const med_int * CONNECTIVITYClient::getConnectivityIndex (medConnectivity ConnectivityType, medEntityMesh Entity) @@ -179,6 +230,10 @@ const med_int * CONNECTIVITYClient::getConnectivityIndex return c; } +//============================================================================= +/*! + */ +//============================================================================= void CONNECTIVITYClient::calculateConnectivity (medConnectivity connectivityType, medEntityMesh Entity) @@ -193,6 +248,10 @@ void CONNECTIVITYClient::calculateConnectivity END_OF("void CONNECTIVITYClient::calculateConnectivity()"); } +//============================================================================= +/*! + */ +//============================================================================= void CONNECTIVITYClient::updateFamily (vector myFamilies) { BEGIN_OF("void CONNECTIVITYClient::updateFamily()"); @@ -205,6 +264,10 @@ void CONNECTIVITYClient::updateFamily (vector myFamilies) END_OF("void CONNECTIVITYClient::updateFamily()"); } +//============================================================================= +/*! + */ +//============================================================================= const int * CONNECTIVITYClient::getGlobalNumberingIndex (medEntityMesh Entity) const throw (MEDEXCEPTION) { @@ -218,6 +281,10 @@ const int * CONNECTIVITYClient::getGlobalNumberingIndex END_OF("void CONNECTIVITYClient::getGlobalNumberingIndex()"); } +//============================================================================= +/*! + */ +//============================================================================= bool CONNECTIVITYClient::existConnectivity(medConnectivity ConnectivityType, medEntityMesh Entity) const { @@ -233,6 +300,10 @@ bool CONNECTIVITYClient::existConnectivity(medConnectivity ConnectivityType, return b; } +//============================================================================= +/*! + */ +//============================================================================= const med_int * CONNECTIVITYClient::getReverseConnectivity (medConnectivity ConnectivityType, medEntityMesh Entity) throw (MEDEXCEPTION) @@ -250,6 +321,10 @@ const med_int * CONNECTIVITYClient::getReverseConnectivity return c; } +//============================================================================= +/*! + */ +//============================================================================= const med_int * CONNECTIVITYClient::getReverseConnectivityIndex (medConnectivity ConnectivityType, medEntityMesh Entity) throw (MEDEXCEPTION) @@ -267,6 +342,10 @@ const med_int * CONNECTIVITYClient::getReverseConnectivityIndex return c; } +//============================================================================= +/*! + */ +//============================================================================= const med_int* CONNECTIVITYClient::getValue(medConnectivity TypeConnectivity, medGeometryElement Type) { @@ -282,6 +361,10 @@ const med_int* CONNECTIVITYClient::getValue(medConnectivity TypeConnectivity, return c; } +//============================================================================= +/*! + */ +//============================================================================= const med_int* CONNECTIVITYClient::getValueIndex(medConnectivity TypeConnectivity) { BEGIN_OF("void CONNECTIVITYClient::getValueIndex()"); @@ -296,6 +379,10 @@ const med_int* CONNECTIVITYClient::getValueIndex(medConnectivity TypeConnectivit return c; } +//============================================================================= +/*! + */ +//============================================================================= const med_int* CONNECTIVITYClient::getNeighbourhood() const { BEGIN_OF("void CONNECTIVITYClient::getNeighbourhood()"); diff --git a/src/MedClient/src/CONNECTIVITYClient.hxx b/src/MedClient/src/CONNECTIVITYClient.hxx index 9240db5e5..b3c611ccf 100644 --- a/src/MedClient/src/CONNECTIVITYClient.hxx +++ b/src/MedClient/src/CONNECTIVITYClient.hxx @@ -5,6 +5,7 @@ #include "MEDMEM_Connectivity.hxx" #include CORBA_CLIENT_HEADER(MED) +namespace MEDMEM { class CONNECTIVITYClient : public CONNECTIVITY { protected: @@ -57,6 +58,7 @@ public: const med_int* getValueIndex (medConnectivity TypeConnectivity); const med_int* getNeighbourhood() const; }; +}; #endif diff --git a/src/MedClient/src/COORDINATEClient.cxx b/src/MedClient/src/COORDINATEClient.cxx index f5ebf51b0..428ba09ff 100644 --- a/src/MedClient/src/COORDINATEClient.cxx +++ b/src/MedClient/src/COORDINATEClient.cxx @@ -1,6 +1,15 @@ +#define _DEBUG_ #include "COORDINATEClient.hxx" #include #include "UtilClient.hxx" +#include "Utils_CorbaException.hxx" + +using namespace MEDMEM; +//============================================================================= +/*! + * Constructeur + */ +//============================================================================= COORDINATEClient::COORDINATEClient(const SALOME_MED::MESH_ptr m, medModeSwitch Mode) : @@ -14,35 +23,59 @@ COORDINATEClient::COORDINATEClient(const SALOME_MED::MESH_ptr m, 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; @@ -57,6 +90,11 @@ void COORDINATEClient::fillCopy() END_OF("void COORDINATEClient::fillCopy()"); } +//============================================================================= +/*! + * Retourne les coordonnées + */ +//============================================================================= const double * COORDINATEClient::getCoordinates(medModeSwitch Mode) { @@ -69,8 +107,13 @@ 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()"); @@ -81,7 +124,11 @@ double COORDINATEClient::getCoordinate(int Number,int Axis) return d; } - +//============================================================================= +/*! + * Retourne un axe + */ +//============================================================================= const double * COORDINATEClient::getCoordinateAxis(int Axis) { BEGIN_OF("void COORDINATEClient::getCoordinateAxis()"); @@ -93,7 +140,11 @@ const double * COORDINATEClient::getCoordinateAxis(int Axis) return c; } - +//============================================================================= +/*! + * Retourne le nombre de noeuds + */ +//============================================================================= const int* COORDINATEClient::getNodesNumbers() const { BEGIN_OF("void COORDINATEClient::getNodesNumbers()"); diff --git a/src/MedClient/src/COORDINATEClient.hxx b/src/MedClient/src/COORDINATEClient.hxx index 2f64e4636..51037c880 100644 --- a/src/MedClient/src/COORDINATEClient.hxx +++ b/src/MedClient/src/COORDINATEClient.hxx @@ -5,6 +5,7 @@ #include "MEDMEM_Coordinate.hxx" #include CORBA_CLIENT_HEADER(MED) +namespace MEDMEM { class COORDINATEClient : public COORDINATE { protected: @@ -55,5 +56,6 @@ public: virtual const int* getNodesNumbers() const; }; +}; #endif diff --git a/src/MedClient/src/FAMILYClient.cxx b/src/MedClient/src/FAMILYClient.cxx index a648cd9a2..95aa12c27 100644 --- a/src/MedClient/src/FAMILYClient.cxx +++ b/src/MedClient/src/FAMILYClient.cxx @@ -1,23 +1,32 @@ #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()"); @@ -25,8 +34,6 @@ void FAMILYClient::blankCopy(bool blankSupport) if (blankSupport) SUPPORTClient::blankCopy(); - MESSAGE(""); - // setIdentifier(IOR_Family->getIdentifier()); // int nAttr, nGr, n; @@ -60,6 +67,11 @@ void FAMILYClient::blankCopy(bool blankSupport) END_OF("FAMILYClient::blankCopy()"); } +//============================================================================= +/*! + * Remplit les informations générales + */ +//============================================================================= void FAMILYClient::fillCopy(bool fillSupport) { BEGIN_OF("FAMILYClient::fillCopy()"); @@ -75,6 +87,11 @@ void FAMILYClient::fillCopy(bool fillSupport) END_OF("FAMILYClient::fillCopy()"); } +//============================================================================= +/*! + * Destructeur + */ +//============================================================================= FAMILYClient::~FAMILYClient() { diff --git a/src/MedClient/src/FAMILYClient.hxx b/src/MedClient/src/FAMILYClient.hxx index c74ef20db..61b12302e 100644 --- a/src/MedClient/src/FAMILYClient.hxx +++ b/src/MedClient/src/FAMILYClient.hxx @@ -8,6 +8,7 @@ #include "SUPPORTClient.hxx" +namespace MEDMEM { class FAMILYClient : public SUPPORTClient, public FAMILY { @@ -27,5 +28,6 @@ public : virtual void fillCopy(bool fillSupport = true); }; +}; #endif diff --git a/src/MedClient/src/FIELDClient.hxx b/src/MedClient/src/FIELDClient.hxx index 0582515ef..ed097814a 100644 --- a/src/MedClient/src/FIELDClient.hxx +++ b/src/MedClient/src/FIELDClient.hxx @@ -6,6 +6,7 @@ #include "MEDMEM_Field.hxx" #include CORBA_CLIENT_HEADER(MED) +namespace MEDMEM { template class FIELDClient : virtual public FIELD { @@ -66,5 +67,6 @@ FIELDClient::~FIELDClient() END_OF("FIELDClient::~FIELDClient"); } +} #endif diff --git a/src/MedClient/src/GROUPClient.cxx b/src/MedClient/src/GROUPClient.cxx index 99ec27a1e..df0e753b4 100644 --- a/src/MedClient/src/GROUPClient.cxx +++ b/src/MedClient/src/GROUPClient.cxx @@ -1,5 +1,12 @@ #include "GROUPClient.hxx" #include "MESHClient.hxx" +using namespace MEDMEM; + +//============================================================================= +/*! + * Constructeur + */ +//============================================================================= GROUPClient::GROUPClient(const SALOME_MED::GROUP_ptr G, MESH * M) @@ -15,7 +22,11 @@ GROUPClient::GROUPClient(const SALOME_MED::GROUP_ptr G, END_OF("GROUPClient::GROUPClient()"); } - +//============================================================================= +/*! + * Remplit les informations générales + */ +//============================================================================= void GROUPClient::blankCopy() { BEGIN_OF("GROUPClient::blankCopy()"); @@ -25,6 +36,11 @@ void GROUPClient::blankCopy() END_OF("GROUPClient::blankCopy()"); } +//============================================================================= +/*! + * Remplit les informations + */ +//============================================================================= void GROUPClient::fillCopy() { @@ -36,6 +52,11 @@ void GROUPClient::fillCopy() END_OF("GROUPClient::fillCopy()"); } +//============================================================================= +/*! + * Destructeur + */ +//============================================================================= GROUPClient::~GROUPClient() { diff --git a/src/MedClient/src/GROUPClient.hxx b/src/MedClient/src/GROUPClient.hxx index fd6d32edd..869baa8e3 100644 --- a/src/MedClient/src/GROUPClient.hxx +++ b/src/MedClient/src/GROUPClient.hxx @@ -7,6 +7,7 @@ #include CORBA_CLIENT_HEADER(MED) #include "SUPPORTClient.hxx" +namespace MEDMEM { class GROUPClient : public SUPPORTClient, public GROUP @@ -28,5 +29,6 @@ public : virtual void fillCopy(); }; +} #endif diff --git a/src/MedClient/src/MESHClient.cxx b/src/MedClient/src/MESHClient.cxx index 4a530dfe9..a9d8e57da 100644 --- a/src/MedClient/src/MESHClient.cxx +++ b/src/MedClient/src/MESHClient.cxx @@ -1,10 +1,15 @@ #include "MESHClient.hxx" -#include +#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(), @@ -23,97 +28,122 @@ MESHClient::MESHClient(const SALOME_MED::MESH_ptr m) : 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(_coordinate); - ASSERT(_coord); + _name = all->name; + _spaceDimension = all->spaceDimension; + _meshDimension = all->meshDimension; + _numberOfNodes = all->numberOfNodes; + + COORDINATEClient *_coord + = dynamic_cast(_coordinate); + ASSERT(_coord); CONNECTIVITYClient *_connect = dynamic_cast(_connectivity); ASSERT(_connect); - _coord->blankCopy(); + _coord->blankCopy(); _connect->blankCopy(); - MESSAGE(""); convertCorbaArray (_familyNode, _numberOfNodesFamilies, - IOR_Mesh->getFamilies(MED_NODE), + //IOR_Mesh->getFamilies(MED_NODE), + &all->famNode, (void *) (convertFamily), this); - MESSAGE(""); convertCorbaArray (_familyEdge, _numberOfEdgesFamilies, - IOR_Mesh->getFamilies(MED_EDGE), + //IOR_Mesh->getFamilies(MED_EDGE), + &all->famEdge, (void *) (convertFamily), this); - MESSAGE(""); convertCorbaArray (_familyFace, _numberOfFacesFamilies, - IOR_Mesh->getFamilies(MED_FACE), + //IOR_Mesh->getFamilies(MED_FACE), + &all->famFace, (void *) (convertFamily), this); - MESSAGE(""); convertCorbaArray (_familyCell, _numberOfCellsFamilies, - IOR_Mesh->getFamilies(MED_CELL), + //IOR_Mesh->getFamilies(MED_CELL), + &all->famCell, (void *) (convertFamily), this); - MESSAGE(""); convertCorbaArray (_groupNode, _numberOfNodesGroups, - IOR_Mesh->getGroups(MED_NODE), + //IOR_Mesh->getGroups(MED_NODE), + &all->groupNode, (void *) (convertGroup), this); - MESSAGE(""); convertCorbaArray (_groupEdge, _numberOfEdgesGroups, - IOR_Mesh->getGroups(MED_EDGE), + //IOR_Mesh->getGroups(MED_EDGE), + &all->groupEdge, (void *) (convertGroup), this); - MESSAGE(""); convertCorbaArray (_groupFace, _numberOfFacesGroups, - IOR_Mesh->getGroups(MED_FACE), + //IOR_Mesh->getGroups(MED_FACE), + &all->groupFace, (void *) (convertGroup), this); - MESSAGE(""); convertCorbaArray (_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() { @@ -134,6 +164,11 @@ void MESHClient::fillCopy() END_OF("MESHClient::fillCopy()"); } +//============================================================================= +/*! + * Destructeur + */ +//============================================================================= MESHClient::~MESHClient() { diff --git a/src/MedClient/src/MESHClient.hxx b/src/MedClient/src/MESHClient.hxx index 4b268edbb..ffaf903b1 100644 --- a/src/MedClient/src/MESHClient.hxx +++ b/src/MedClient/src/MESHClient.hxx @@ -6,6 +6,7 @@ #include "MEDMEM_Mesh.hxx" #include CORBA_CLIENT_HEADER(MED) +namespace MEDMEM { class MESHClient : public MESH { private : @@ -25,6 +26,7 @@ public : void fillCopy(); }; +} #endif diff --git a/src/MedClient/src/SUPPORTClient.cxx b/src/MedClient/src/SUPPORTClient.cxx index 37ed8d6ef..83b573981 100644 --- a/src/MedClient/src/SUPPORTClient.cxx +++ b/src/MedClient/src/SUPPORTClient.cxx @@ -1,7 +1,16 @@ +#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(), @@ -18,79 +27,95 @@ SUPPORTClient::SUPPORTClient(const SALOME_MED::SUPPORT_ptr S, 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"); @@ -98,6 +123,11 @@ SUPPORTClient::~SUPPORTClient() END_OF("SUPPORTClient::~SUPPORTClient"); } +//============================================================================= +/*! + * Destructeur + */ +//============================================================================= MEDSKYLINEARRAY * SUPPORTClient::getnumber() const throw (MEDEXCEPTION) { BEGIN_OF("SUPPORTClient::getnumber()"); @@ -109,6 +139,11 @@ MEDSKYLINEARRAY * SUPPORTClient::getnumber() const throw (MEDEXCEPTION) return m; } +//============================================================================= +/*! + * + */ +//============================================================================= const int * SUPPORTClient::getNumber(medGeometryElement GeometricType) const throw (MEDEXCEPTION) { @@ -121,6 +156,11 @@ const int * SUPPORTClient::getNumber(medGeometryElement GeometricType) return n; } +//============================================================================= +/*! + * + */ +//============================================================================= const int * SUPPORTClient::getNumberIndex() const throw (MEDEXCEPTION) { BEGIN_OF("SUPPORTClient::getnumberIndex()"); diff --git a/src/MedClient/src/SUPPORTClient.hxx b/src/MedClient/src/SUPPORTClient.hxx index 6e03691db..4018cfed9 100644 --- a/src/MedClient/src/SUPPORTClient.hxx +++ b/src/MedClient/src/SUPPORTClient.hxx @@ -7,6 +7,7 @@ #include CORBA_CLIENT_HEADER(MED) +namespace MEDMEM { class SUPPORTClient : virtual public SUPPORT { private : @@ -32,6 +33,7 @@ public : const throw (MEDEXCEPTION); }; +} #endif diff --git a/src/MedClient/src/UtilClient.hxx b/src/MedClient/src/UtilClient.hxx index d497d3108..bbe64a6a2 100644 --- a/src/MedClient/src/UtilClient.hxx +++ b/src/MedClient/src/UtilClient.hxx @@ -4,6 +4,7 @@ #include #include +namespace MEDMEM { template @@ -109,5 +110,6 @@ inline void convertCorbaArray (vector & T, int &nT, } } +} #endif diff --git a/src/MedClient/test/test1/CatalogModuleTest.xml b/src/MedClient/test/test1/CatalogModuleTest.xml deleted file mode 100644 index 431ae25c8..000000000 --- a/src/MedClient/test/test1/CatalogModuleTest.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - Compo1Py - Solver - RASCLE - 1.0 - Essai Aster - 1 - ModuleASTER.png - hostname = localhost - - - diff --git a/src/MedClient/test/test1/Makefile.in b/src/MedClient/test/test1/Makefile.in index 9f11c82d3..bbf3c0778 100644 --- a/src/MedClient/test/test1/Makefile.in +++ b/src/MedClient/test/test1/Makefile.in @@ -28,7 +28,7 @@ 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@ @@ -51,6 +51,21 @@ BIN_SRC = 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 diff --git a/src/MedClient/test/test1/resources/CatalogModuleTest.xml b/src/MedClient/test/test1/resources/CatalogModuleTest.xml new file mode 100644 index 000000000..431ae25c8 --- /dev/null +++ b/src/MedClient/test/test1/resources/CatalogModuleTest.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + Compo1Py + Solver + RASCLE + 1.0 + Essai Aster + 1 + ModuleASTER.png + hostname = localhost + + + diff --git a/src/MedClient/test/test2/Makefile.in b/src/MedClient/test/test2/Makefile.in index 8b2a5d4e2..3d323f8fd 100644 --- a/src/MedClient/test/test2/Makefile.in +++ b/src/MedClient/test/test2/Makefile.in @@ -43,7 +43,7 @@ LIB_SRC = Compo2.cxx 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 diff --git a/src/MedCorba_Swig/Makefile.in b/src/MedCorba_Swig/Makefile.in index cc7d34f40..47dd326ca 100644 --- a/src/MedCorba_Swig/Makefile.in +++ b/src/MedCorba_Swig/Makefile.in @@ -54,7 +54,7 @@ CPPFLAGS+= $(PYTHON_INCLUDES) $(MED2_INCLUDES) $(HDF5_INCLUDES) -I${KERNEL_ROOT_ 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 ############################################################################# diff --git a/src/MedCorba_Swig/batchmode_medcorba_test.py b/src/MedCorba_Swig/batchmode_medcorba_test.py index 2b2877259..cbd5273e1 100755 --- a/src/MedCorba_Swig/batchmode_medcorba_test.py +++ b/src/MedCorba_Swig/batchmode_medcorba_test.py @@ -15,6 +15,11 @@ from libMedCorba_Swig import * from random import * +import os + +filePath=os.environ["MED_ROOT_DIR"] +filePath=filePath+"/share/salome/resources/" + #============================================================================== def AnalyzeField(field): @@ -101,7 +106,7 @@ print "We are working in the study ",studyCurrent," with the ID ",studyCurrentId 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 "" diff --git a/src/MedCorba_Swig/libMedCorba_Swig.i b/src/MedCorba_Swig/libMedCorba_Swig.i index 6035d7b98..3c6755ebe 100644 --- a/src/MedCorba_Swig/libMedCorba_Swig.i +++ b/src/MedCorba_Swig/libMedCorba_Swig.i @@ -3,16 +3,16 @@ %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" %} diff --git a/src/MedCorba_Swig/medcorba_test.py b/src/MedCorba_Swig/medcorba_test.py index 46a45ea96..8bae396ea 100644 --- a/src/MedCorba_Swig/medcorba_test.py +++ b/src/MedCorba_Swig/medcorba_test.py @@ -32,6 +32,11 @@ from libMedCorba_Swig import * from random import * +import os + +filePath=os.environ["MED_ROOT_DIR"] +filePath=filePath+"/share/salome/resources/" + #============================================================================== def AnalyzeField(field): @@ -105,7 +110,7 @@ print "We are working in the study ",studyCurrent," with the ID ",studyCurrentId 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 "" diff --git a/src/MedMem/Family_i.cxx b/src/MedMem/Family_i.cxx deleted file mode 100644 index 3f2d3fb37..000000000 --- a/src/MedMem/Family_i.cxx +++ /dev/null @@ -1,260 +0,0 @@ -//============================================================================= -// 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;igetAttributeIdentifier(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;igetAttributeValue(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;igetAttributeDescription(i).c_str()); - } - catch(...) - { - MESSAGE("Unable to acces specified attribut description"); - THROW_SALOME_CORBA_EXCEPTION("Unable to acces Family C++ Object"\ - ,SALOME::INTERNAL_ERROR); - } -} - diff --git a/src/MedMem/Family_i.hxx b/src/MedMem/Family_i.hxx deleted file mode 100644 index 11a9b3e7c..000000000 --- a/src/MedMem/Family_i.hxx +++ /dev/null @@ -1,49 +0,0 @@ -//============================================================================= -// 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_ */ diff --git a/src/MedMem/FieldDouble_i.cxx b/src/MedMem/FieldDouble_i.cxx deleted file mode 100644 index f10252705..000000000 --- a/src/MedMem/FieldDouble_i.cxx +++ /dev/null @@ -1,102 +0,0 @@ -//============================================================================= -// 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() -{ - 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(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 * const f): FIELDOF_i(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 - -#include CORBA_SERVER_HEADER(MED) - -#include "Field_i.hxx" -#include "FieldOf_i.hxx" - -#include "MEDMEM_Field.hxx" - -class FIELDDOUBLE_i: public FIELDOF_i -{ -private: - -public: - FIELDDOUBLE_i(); - ~FIELDDOUBLE_i(); - FIELDDOUBLE_i(SALOME_MED::SUPPORT_ptr mySupportIOR,::FIELD * const f); - FIELDDOUBLE_i(FIELDDOUBLE_i & f); - - Engines::double_array * getValue (SALOME_MED::medModeSwitch mode ) - throw (SALOME::SALOME_Exception); -}; - - -#endif /* MED_FIELDDOUBLE_I_HXX_ */ diff --git a/src/MedMem/FieldInt_i.cxx b/src/MedMem/FieldInt_i.cxx deleted file mode 100644 index c0a52b84d..000000000 --- a/src/MedMem/FieldInt_i.cxx +++ /dev/null @@ -1,102 +0,0 @@ -//============================================================================= -// 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() -{ - 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 * const f): FIELDOF_i(mySupportIOR,f) -{ - BEGIN_OF("Constructor FIELDINT_i"); - END_OF(" Constructor FIELDINT_i"); -} -//============================================================================= -/*! - * Constructor par recopie - */ -//============================================================================= -FIELDINT_i::FIELDINT_i(FIELDINT_i &fi): - FIELDOF_i(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 - -#include CORBA_SERVER_HEADER(MED) - -#include "Field_i.hxx" -#include "FieldOf_i.hxx" - -#include "MEDMEM_Field.hxx" - -class FIELDINT_i: public FIELDOF_i -{ -private: - FIELDINT_i(); - -public: - ~FIELDINT_i(); - FIELDINT_i(SALOME_MED::SUPPORT_ptr mySupportIOR, ::FIELD * const f); - FIELDINT_i(FIELDINT_i & f); - Engines::long_array * getValue (SALOME_MED::medModeSwitch mode ) - throw (SALOME::SALOME_Exception); -}; -#endif /* MED_FIELDINT_I_HXX_ */ diff --git a/src/MedMem/FieldOf_i.hxx b/src/MedMem/FieldOf_i.hxx deleted file mode 100644 index 11679ba70..000000000 --- a/src/MedMem/FieldOf_i.hxx +++ /dev/null @@ -1,632 +0,0 @@ -//============================================================================= -// 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 -#include -# include - -#include - -# 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 FIELDOF_i: public FIELD_i -{ -public : - static map < int, ::FIELD * > fieldMap ; -protected : - static int fieldIndex ; - -protected : - // C++ object containing values - - ::FIELD * 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 * const field); - FIELDOF_i(::FIELD * 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 * constructConstField() const; - - }; -template map < int, ::FIELD * > FIELDOF_i::fieldMap ; -template int FIELDOF_i::fieldIndex = 0; -//============================================================================= -/*! - * Default constructor - */ -//============================================================================= - -//template FIELDOF_i::FIELDOF_i():_fieldTptr(FIELDOF_i::constructConstField()) -template FIELDOF_i::FIELDOF_i():_fieldTptr(constructConstField()), - _support((SALOME_MED::SUPPORT_ptr) NULL) -{ - BEGIN_OF("Default Constructor Field_i"); - END_OF(" Default Constructor Field_i"); -} -//============================================================================= -/*! - * Destructor - */ -//============================================================================= -template FIELDOF_i::~FIELDOF_i() -{ -} -//============================================================================= -/*! - * Constructor - */ -//============================================================================= -template FIELDOF_i::FIELDOF_i(SALOME_MED::SUPPORT_ptr support,::FIELD * const field): - _fieldTptr(field), - _corbaIndex(FIELDOF_i::fieldIndex++), - _FieldId(""), - _support(SALOME_MED::SUPPORT::_duplicate(support)) -{ - BEGIN_OF("Constructor FIELDOF_i(SALOME_MED::SUPPORT_ptr support,::FIELD * const field)"); - FIELDOF_i::fieldMap[_corbaIndex]=_fieldTptr; - - MESSAGE("FIELDOF_i::FIELDOF_i Checking of pointeurs !!!"); - - SCRUTE(_fieldTptr); - SCRUTE(_support); - SCRUTE(_support->getMesh()); - - END_OF("Constructor FIELDOF_i(SALOME_MED::SUPPORT_ptr support,::FIELD * const field)"); -} - - -template FIELDOF_i::FIELDOF_i( FIELD * const f): - _fieldTptr(f), - _corbaIndex(FIELDOF_i::fieldIndex++), - _FieldId(""), - _support((SALOME_MED::SUPPORT_ptr) NULL) -{ - BEGIN_OF("Constructor Field_i"); - FIELDOF_i::fieldMap[_corbaIndex]=_fieldTptr; - END_OF("Constructor Field_i"); -} -//============================================================================= -/*! - * Constructor par recopie - */ -//============================================================================= -template FIELDOF_i::FIELDOF_i( FIELDOF_i & f):_fieldTptr(f._fieldTptr), - _corbaIndex(FIELDOF_i::fieldIndex++), - _FieldId("") -{ - BEGIN_OF("Constructor Field_i"); - FIELDOF_i::fieldMap[_corbaIndex]=_fieldTptr; - END_OF("Constructor Field_i"); -} -//============================================================================= -/*! - * Constructor d un pointeur constant - */ -//============================================================================= -template ::FIELD * FIELDOF_i::constructConstField() const -{ - ::FIELD * const ptrField =new ::FIELD(); - return ptrField; -} -//============================================================================= -/*! - * CORBA: Accessor for Fields's Name - */ -//============================================================================= -template char * FIELDOF_i::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 char * FIELDOF_i::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 SALOME_MED::SUPPORT_ptr FIELDOF_i::getSupport() - throw (SALOME::SALOME_Exception) -{ - BEGIN_OF("SALOME_MED::SUPPORT_ptr FIELDOF_i::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::getSupport()"); - - return support ; -} -//============================================================================= -/*! - * CORBA: Accessor for Fields's Number of components - */ -//============================================================================= -template CORBA::Long FIELDOF_i::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 char * FIELDOF_i::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 char * FIELDOF_i::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 CORBA::Long FIELDOF_i::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 CORBA::Long FIELDOF_i::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 CORBA::Long FIELDOF_i::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 CORBA::Double FIELDOF_i::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 Engines::string_array * FIELDOF_i::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 Engines::string_array * FIELDOF_i::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 void FIELDOF_i::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_::Instance() ; - ASSERT(SINGLETON_::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 void FIELDOF_i::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 void FIELDOF_i::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 void FIELDOF_i::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 CORBA::Long FIELDOF_i::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_ */ diff --git a/src/MedMem/Field_i.cxx b/src/MedMem/Field_i.cxx deleted file mode 100644 index a4c941c85..000000000 --- a/src/MedMem/Field_i.cxx +++ /dev/null @@ -1,20 +0,0 @@ -//============================================================================= -// 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() -{ -} - diff --git a/src/MedMem/Field_i.hxx b/src/MedMem/Field_i.hxx deleted file mode 100644 index 22fa2d998..000000000 --- a/src/MedMem/Field_i.hxx +++ /dev/null @@ -1,67 +0,0 @@ -//============================================================================= -// 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 - -//# 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__ */ diff --git a/src/MedMem/Group_i.cxx b/src/MedMem/Group_i.cxx deleted file mode 100644 index d9e89d87e..000000000 --- a/src/MedMem/Group_i.cxx +++ /dev/null @@ -1,146 +0,0 @@ -//============================================================================= -// File : Group_i.cxx -// Project : SALOME -// Author : EDF -// Copyright : EDF 2002 -// $Header: /export/home/CVS/SALOME_ROOT/MED/src/MedMem/ -//============================================================================= - -#include - -#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 fam(nbfam); - fam = _group->getFamilies(); - for (int i=0;iPOA_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); - } -}; diff --git a/src/MedMem/Group_i.hxx b/src/MedMem/Group_i.hxx deleted file mode 100644 index 12419693b..000000000 --- a/src/MedMem/Group_i.hxx +++ /dev/null @@ -1,40 +0,0 @@ -//============================================================================= -// 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_ */ diff --git a/src/MedMem/Makefile.in b/src/MedMem/Makefile.in deleted file mode 100644 index d7144451a..000000000 --- a/src/MedMem/Makefile.in +++ /dev/null @@ -1,76 +0,0 @@ -# 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@ diff --git a/src/MedMem/Med_i.cxx b/src/MedMem/Med_i.cxx deleted file mode 100644 index f31df036e..000000000 --- a/src/MedMem/Med_i.cxx +++ /dev/null @@ -1,806 +0,0 @@ -//============================================================================= -// File : Med_i.cxx -// Project : SALOME -// Author : EDF -// Copyright : EDF 2002 -// $Header: /export/home/CVS/SALOME_ROOT/MED/src/MedMem/Med_i.cxx -//============================================================================= - -#include - -//#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 meshesNames = _med->getMeshNames() ; - int numberOfMeshes = meshesNames.size() ; - for (int i=0; igetMesh(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 familyVector ; - vector::iterator familyVectorIt ; - // we add all groups - vector groupVector ; - vector::iterator groupVectorIt ; - - MED_FR::MESH_ENTITIES::const_iterator currentEntity; - for (int i=0; igetMesh(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 mySupports = _med->getSupports(meshesNames[i]) ; - map::const_iterator itSupport ; - map & 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 fieldsNames = _med->getFieldNames() ; - int numberOfFields = fieldsNames.size() ; - for (int i=0; i myIteration = _med->getFieldIteration (fieldsNames[i]) ; - int numberOfIteration = myIteration.size() ; - for (int j=0; jgetField(fieldsNames[i],myIteration[j].dt,myIteration[j].it) ; - string meshName = myField->getSupport()->getMesh()->getName() ; - medEntityMesh myEntity = myField->getSupport()->getEntity() ; - map >::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 & SupportOnMesh = (*itSupportOnMesh).second ; - map::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*)myField)->read() ; - FIELDINT_i * myFieldIntI = new FIELDINT_i(mySupportIOR,(FIELD*)myField); - //SALOME_MED::FIELDINT_ptr myFieldIntIOR = myFieldIntI->_this() ; - POA_SALOME_MED::FIELD_tie * myFieldTie = new POA_SALOME_MED::FIELD_tie(myFieldIntI) ; - myFieldIOR = myFieldTie->_this() ; - myFieldIntI->addInStudy(myStudy,myFieldIOR) ; - - break ; - } - // else - case MED_FR::MED_REEL64: { - ((FIELD*)myField)->read() ; - FIELDDOUBLE_i * myFieldDoubleI = new FIELDDOUBLE_i(mySupportIOR,(FIELD*)myField); - //SALOME_MED::FIELDDOUBLE_ptr myFieldDoubleIOR = myFieldDoubleI->_this() ; - POA_SALOME_MED::FIELD_tie * myFieldTie= new POA_SALOME_MED::FIELD_tie(myFieldDoubleI) ; - myFieldIOR = myFieldTie->_this() ; - myFieldDoubleI->addInStudy(myStudy,myFieldIOR) ; - break ; - } - default: { - throw MED_EXCEPTION ( LOCALIZED( STRING(LOC) - <<" * Iteration "<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 meshesNames = _med->getMeshNames() ; - int numberOfMeshes = meshesNames.size() ; - for (int i=0; igetMesh(meshesNames[i]) ; - myMesh->read() ; - MESH_i * myMeshI = new MESH_i(myMesh) ; - SALOME_MED::MESH_ptr myMeshIOR = myMeshI->_this() ; - //POA_SALOME_MED::MESH_tie * myMeshTie = new POA_SALOME_MED::MESH_tie(myMeshI) ; - //SALOME_MED::MESH_ptr myMeshIOR = myMeshTie->_this() ; - _meshes[meshesNames[i]]=myMeshIOR ; - myMeshI->addInStudy(myStudy,myMeshIOR) ; - } - - // SUPPORT : - _med->updateSupport() ; - for (int i=0; i mySupports = _med->getSupports(meshesNames[i]) ; - map::const_iterator itSupport ; - map & 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 * mySupportTie = new POA_SALOME_MED::SUPPORT_tie(mySupportI) ; - //SALOME_MED::SUPPORT_ptr mySupportIOR = mySupportTie->_this() ; - mySupportsIOR[(*itSupport).first]= mySupportIOR ; - mySupportI->addInStudy(myStudy,mySupportIOR) ; - } - } - - // FIELD : - deque fieldsNames = _med->getFieldNames() ; - int numberOfFields = fieldsNames.size() ; - for (int i=0; i myIteration = _med->getFieldIteration (fieldsNames[i]) ; - int numberOfIteration = myIteration.size() ; - for (int j=0; jgetField(fieldsNames[i],myIteration[j].dt,myIteration[j].it) ; - string meshName = myField->getSupport()->getMesh()->getName() ; - medEntityMesh myEntity = myField->getSupport()->getEntity() ; - map >::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 & SupportOnMesh = (*itSupportOnMesh).second ; - map::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*)myField)->read() ; - FIELDINT_i * myFieldIntI = new FIELDINT_i(mySupportIOR,(FIELD*)myField); - //SALOME_MED::FIELDINT_ptr myFieldIntIOR = myFieldIntI->_this() ; - // POA_SALOME_MED::FIELD_tie * myFieldTie = new POA_SALOME_MED::FIELD_tie(myFieldIntI) ; - // myFieldIOR = myFieldTie->_this() ; - // myFieldIntI->addInStudy(myStudy,myFieldIOR) ; - - SALOME_MED::FIELDINT_ptr myFieldIntIOR ; - POA_SALOME_MED::FIELDINT_tie * myFieldIntTie = new POA_SALOME_MED::FIELDINT_tie(myFieldIntI) ; - myFieldIntIOR = myFieldIntTie->_this() ; - myFieldIntI->addInStudy(myStudy,myFieldIntIOR) ; - - _fields[fieldsNames[i]][dtIt] = myFieldIntIOR ; - - break ; - } - // else - case MED_FR::MED_REEL64: { - ((FIELD*)myField)->read() ; - FIELDDOUBLE_i * myFieldDoubleI = new FIELDDOUBLE_i(mySupportIOR,(FIELD*)myField); - //SALOME_MED::FIELDDOUBLE_ptr myFieldDoubleIOR = myFieldDoubleI->_this() ; - // POA_SALOME_MED::FIELD_tie * myFieldTie= new POA_SALOME_MED::FIELD_tie(myFieldDoubleI) ; - // myFieldIOR = myFieldTie->_this() ; - // myFieldDoubleI->addInStudy(myStudy,myFieldIOR) ; - - SALOME_MED::FIELDDOUBLE_ptr myFieldDoubleIOR ; - POA_SALOME_MED::FIELDDOUBLE_tie * myFieldDoubleTie = new POA_SALOME_MED::FIELDDOUBLE_tie(myFieldDoubleI) ; - myFieldDoubleIOR = myFieldDoubleTie->_this() ; - myFieldDoubleI->addInStudy(myStudy,myFieldDoubleIOR) ; - - _fields[fieldsNames[i]][dtIt] = myFieldDoubleIOR ; - - break ; - } - default: { - throw MED_EXCEPTION ( LOCALIZED( STRING(LOC) - <<" * Iteration "<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;igetNumberOfFields(); - myseq->length(nbFields); - string * nameFields = new string[nbFields]; - _med->getFieldNames(nameFields); - for (int i=0;igetMesh(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::fieldMap.find(ind) - !=FIELDOF_i::fieldMap.end()); - ::FIELD * fdouble = FIELDOF_i::fieldMap[ind]; - MESH * mesh=_med->getMesh(fdouble); - } - else - { - MESSAGE("Integer"); - ASSERT(FIELDOF_i::fieldMap.find(ind)!=FIELDOF_i::fieldMap.end()); - ::FIELD * fint = FIELDOF_i::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::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 * > -// (_med->getField(fieldName,pasTemps,numOrdre)) !=NULL) -// { -// MESSAGE("Champ d entier"); -// ::FIELD*f=dynamic_cast * > -// (_med->getField(fieldName,pasTemps,numOrdre)); -// FIELDINT_i * medf = new FIELDINT_i(f); -// POA_SALOME_MED::FIELDINT_tie * f1 = -// new POA_SALOME_MED::FIELDINT_tie(medf,true); -// SALOME_MED::FIELDINT_ptr f2 = f1->_this(); -// f1->_remove_ref(); -// return f2; - -// } -// else -// { -// ASSERT (dynamic_cast* >(_med->getField(fieldName,pasTemps,numOrdre))!=NULL); -// MESSAGE("Champ de double"); -// ::FIELD*f=dynamic_cast* > -// (_med->getField(fieldName,pasTemps,numOrdre)); -// FIELDDOUBLE_i * medf = new FIELDDOUBLE_i(f); -// POA_SALOME_MED::FIELDDOUBLE_tie * f1 = -// new POA_SALOME_MED::FIELDDOUBLE_tie(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::fieldMap.find(ind) - !=FIELDOF_i::fieldMap.end()); - ::FIELD * fdouble = FIELDOF_i::fieldMap[ind]; - // A modifier - //_med->addField(fdouble); - } - else - { - MESSAGE("Integer"); - ASSERT(FIELDOF_i::fieldMap.find(ind)!=FIELDOF_i::fieldMap.end()); - ::FIELD * fint = FIELDOF_i::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_::Instance() ; - ASSERT(SINGLETON_::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)"); -} - - - - diff --git a/src/MedMem/Med_i.hxx b/src/MedMem/Med_i.hxx deleted file mode 100644 index c50baec47..000000000 --- a/src/MedMem/Med_i.hxx +++ /dev/null @@ -1,85 +0,0 @@ -//============================================================================= -// 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 - -#include - -#include CORBA_SERVER_HEADER(MED) -#include CORBA_SERVER_HEADER(SALOMEDS) -#include CORBA_SERVER_HEADER(SALOMEDS_Attributes) - -#include "MEDMEM_Med.hxx" - -typedef map 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 _meshes; // We can't have two MESHes with the same name. - - map > _supports; - - map _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 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_ */ diff --git a/src/MedMem/Mesh_i.cxx b/src/MedMem/Mesh_i.cxx deleted file mode 100644 index f984f0259..000000000 --- a/src/MedMem/Mesh_i.cxx +++ /dev/null @@ -1,1171 +0,0 @@ -//============================================================================= -// File : Mesh_i.cxx -// Project : SALOME -// Author : EDF -// Copyright : EDF 2002 -// $Header: /export/home/CVS/SALOME_ROOT/MED/src/MedMem/Mesh_i.cxx -//============================================================================= - -#include - -#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; igetSpaceDimension(); - const string * coordinatesName =_mesh->getCoordinatesNames(); - myseq->length(spaceDimension); - for (int i=0; igetSpaceDimension(); - const string * coordinatesUnits =_mesh->getCoordinatesUnits(); - myseq->length(spaceDimension); - for (int i=0; igetNumberOfNodes(); - } - 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; igetNumberOfElements(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;igetNumberOfElements( - convertIdlEntToMedEnt(entity), - MED_ALL_ELEMENTS); - myseq->length(nbelements); - const int * numbers=_mesh->getConnectivityIndex(convertIdlConnToMedConn(mode), - convertIdlEntToMedEnt(entity)); - for (int i=0;igetElementNumber(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;igetNumberOfNodes(); - } - 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;igetNumberOfFamilies(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 fam(nbfam); - fam = _mesh->getFamilies(convertIdlEntToMedEnt(entity)); - for (int i=0;iPOA_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 groups(nbgroups); - groups = _mesh->getGroups(convertIdlEntToMedEnt(entity)); - for (int i=0;iPOA_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*f=_mesh->getVolume( myCppSupport); - FIELDDOUBLE_i * medf = new FIELDDOUBLE_i(mySupport,f); - POA_SALOME_MED::FIELDDOUBLE_tie * f1 = - new POA_SALOME_MED::FIELDDOUBLE_tie(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*f=_mesh->getArea( myCppSupport); - FIELDDOUBLE_i * medf = new FIELDDOUBLE_i(mySupport,f); - POA_SALOME_MED::FIELDDOUBLE_tie * f1 = - new POA_SALOME_MED::FIELDDOUBLE_tie(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*f=_mesh->getLength( myCppSupport); - FIELDDOUBLE_i * medf = new FIELDDOUBLE_i(mySupport,f); - POA_SALOME_MED::FIELDDOUBLE_tie * f1 = - new POA_SALOME_MED::FIELDDOUBLE_tie(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*f=_mesh->getNormal( myCppSupport); - FIELDDOUBLE_i * medf = new FIELDDOUBLE_i(mySupport,f); - POA_SALOME_MED::FIELDDOUBLE_tie * f1 = - new POA_SALOME_MED::FIELDDOUBLE_tie(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*f=_mesh->getBarycenter( myCppSupport); - FIELDDOUBLE_i * medf = new FIELDDOUBLE_i(mySupport,f); - POA_SALOME_MED::FIELDDOUBLE_tie * f1 = - new POA_SALOME_MED::FIELDDOUBLE_tie(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_::Instance() ; - ASSERT(SINGLETON_::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_::Instance() ; - ASSERT(SINGLETON_::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); - } -} - diff --git a/src/MedMem/Mesh_i.hxx b/src/MedMem/Mesh_i.hxx deleted file mode 100644 index a2b167114..000000000 --- a/src/MedMem/Mesh_i.hxx +++ /dev/null @@ -1,152 +0,0 @@ -//============================================================================= -// 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 -#include - -#include -//#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_ */ diff --git a/src/MedMem/README b/src/MedMem/README deleted file mode 100644 index 4db505ab6..000000000 --- a/src/MedMem/README +++ /dev/null @@ -1,15 +0,0 @@ -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 diff --git a/src/MedMem/Support_i.cxx b/src/MedMem/Support_i.cxx deleted file mode 100644 index 31f3d1e84..000000000 --- a/src/MedMem/Support_i.cxx +++ /dev/null @@ -1,488 +0,0 @@ -//============================================================================= -// 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;igetNumberOfElements(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;igetNumberOfElements(::MED_ALL_ELEMENTS); - myseq->length(nbelements); - const int * numbers=_support->getNumberIndex(); - for (int i=0;igetNumberOfGaussPoint(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_::Instance() ; - ASSERT(SINGLETON_::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_::Instance() ; - ASSERT(SINGLETON_::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"); -} diff --git a/src/MedMem/Support_i.hxx b/src/MedMem/Support_i.hxx deleted file mode 100644 index 8929bf5fd..000000000 --- a/src/MedMem/Support_i.hxx +++ /dev/null @@ -1,73 +0,0 @@ -//============================================================================= -// 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 -#include - -#include - -#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_ */ diff --git a/src/MedMem/convert.cxx b/src/MedMem/convert.cxx deleted file mode 100644 index 9bd0ee293..000000000 --- a/src/MedMem/convert.cxx +++ /dev/null @@ -1,282 +0,0 @@ -//============================================================================= -// 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; -} diff --git a/src/MedMem/convert.hxx b/src/MedMem/convert.hxx deleted file mode 100644 index 78a5de6e9..000000000 --- a/src/MedMem/convert.hxx +++ /dev/null @@ -1,48 +0,0 @@ -//============================================================================= -// 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 - -#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__ ) */