From: jfa Date: Wed, 28 Mar 2007 08:03:32 +0000 (+0000) Subject: Import a new plugin, sent by Stephane LIAUZU X-Git-Tag: V4_0 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=8ee2e9eee670d8be29d55d7cf68c5332ba6a2543;p=plugins%2Fblsurfplugin.git Import a new plugin, sent by Stephane LIAUZU --- 8ee2e9eee670d8be29d55d7cf68c5332ba6a2543 diff --git a/INSTALL b/INSTALL new file mode 100644 index 0000000..31c3fda --- /dev/null +++ b/INSTALL @@ -0,0 +1,5 @@ +This is the version 3.2.0 of BLSURFPLUGIN +Compatible with : + - KERNEL 3.2.0 + - GUI 3.2.0 + - SMESH 3.2.0 diff --git a/Makefile.in b/Makefile.in new file mode 100644 index 0000000..5e3abf4 --- /dev/null +++ b/Makefile.in @@ -0,0 +1,93 @@ +# Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS, L3S, LJLL, MENSI +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ +# +# -* Makefile *- +# +# Author : Patrick GOLDBRONN (CEA) +# Date : 28/06/2001 +# + +# source path +top_srcdir=@top_srcdir@ +top_builddir=. +srcdir=@srcdir@ +VPATH=.:@srcdir@:@top_srcdir@/bin:@top_srcdir@/resources:./bin:@top_srcdir@/idl + + +@COMMENCE@ + +SUBDIRS = idl src adm_local + +RESOURCES_FILES = \ + BLSURFPlugin.xml \ + mesh_algo_BLSURF.png \ + mesh_hypo_BLSURF.png \ + mesh_tree_algo_BLSURF.png \ + mesh_tree_hypo_BLSURF.png \ + BLSURF.png + +BIN_SCRIPT = VERSION + +# copy header files in common directory ------------ + +ifeq ($(HAVE_SSTREAM),yes) + include_list=include/salome/SALOMEconfig.h +else + include_list=include/salome/SALOMEconfig.h include/salome/sstream +endif + +inc: idl $(include_list) + +include/salome/SALOMEconfig.h: salome_adm/unix/SALOMEconfig.ref + -$(RM) $@ + $(LN_S) ../../$< $@ + +# test if SALOMEconfig.h has changed (contents) +salome_adm/unix/SALOMEconfig.ref: salome_adm/unix/SALOMEconfig.h + @if ! [ -a $@ ]; then \ + cp -p -f $< $@; \ + fi; \ + if ! cmp $< $@; then \ + cp -p -f $< $@; \ + fi; \ + +include/salome/sstream: salome_adm/unix/sstream + -$(RM) $@ + $(LN_S) ../../$< $@ + +# install script in $(bindir) : +install-bin: $(BIN_SCRIPT) + $(INSTALL) -d $(bindir) + if test $(BIN_SCRIPT)X != X; then \ + $(INSTALL_PROGRAM) $^ $(bindir); \ + fi + +# CLEAN -------------------- + +distclean: distclean-other + +distclean-other: + -$(RM) salome_adm/unix/*~ salome_adm/unix/*% salome_adm/unix/*.bak salome_adm/unix/*.new salome_adm/unix/*.old + -$(RM) salome_adm/unix/make_* + -$(RM) salome_adm/unix/depend salome_adm/unix/SALOMEconfig.h + -$(RM) config.cache config.log config.status + +@MODULE@ + +install: install-bin diff --git a/README.txt b/README.txt new file mode 100644 index 0000000..702784f --- /dev/null +++ b/README.txt @@ -0,0 +1,84 @@ +1) Hypothèses + ---------- + +a) Une version de SALOME est installée dans le répertoire : + +b) Le produit BLSURF est installé dans le répertoire /BLSurf + +c) Le produit "decimesh" doit être dans la variable d'environnement PATH + +2) tgz + --- + +cd +tar zxf BLSURFPLUGIN_SRC.tgz + +3) Construire le plugin BLSURF + --------------------------- + +bash +cd +source env_build.sh +source BLSURFPLUGIN_SRC_3.2.4/env_blsurf.sh + +cd BLSURFPLUGIN_SRC_3.2.4 +./build_configure + +cd .. +mkdir BLSURFPLUGIN_BUILD +mkdir BLSURFPLUGIN_INSTALL +cd BLSURFPLUGIN_BUILD +../BLSURFPLUGIN_SRC_3.2.4/configure --prefix=/BLSURFPLUGIN_INSTALL + +# Dans les traces chercher la rubrique "Summary", +# et vérifier que toutes les réponses sont à yes. +# S'il y a au moins 1 "no", il faut résoudre cela avant de poursuivre. + +make +make install + +exit + +4) Lancer SALOME avec BLSURF + ------------------------- + +bash +cd + +cp BLSURFPLUGIN_SRC_3.2.4/SalomeApprc.3.2.4 ~/.SalomeApprc. +# Cette copie est à faire une fois + +source env_products.sh +source BLSURFPLUGIN_SRC_3.2.4/env_blsurf.sh + +runSalome + +5) Session interactive + ------------------- + +a) Aller dans le module de géométrie et construire une figure simple + +b) Aller dans le module de maillage + +c) Aller dans le menu de création d'un maillage + +d) Choisir la figure simple comme géométrie à mailler + +e) Aller dans l'onglet 2D + +f) Choisir BLSURF + +g) Cliquer dans le bouton parametre, une boite de dialogue apparait, cette boite n'est pas terminée. + Seul la case à cocher "optimize" est signifiante: + - décochée: uniquement BLSURF + - cochée : BLSURF + decimesh + +h) Cliquer OK + +i) Aller dans le menu de maillage et lancer l'item "Compute" + +j) Résultat: un maillage créer par BLSURF et visualiser dans SALOME + +k) Pour paramétrer BLSURF: il faut pour l'instant créer un fichier blsurf.env dans le répertoire de lancement de SALOME + +l) fin diff --git a/SalomeApprc.3.2.4 b/SalomeApprc.3.2.4 new file mode 100644 index 0000000..d748e5b --- /dev/null +++ b/SalomeApprc.3.2.4 @@ -0,0 +1,115 @@ + + +
+ + +
+
+ +
+
+ +
+
+ + + + +
+
+ + + + + + +
+
+ + + + + + + +
+
+ + +
+
+ +
+
+ + + +
+
+ + + + +
+
+ +
+
+ + + +
+
+ + + + + +
+
+ + +
+
+ + + + + + + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + +
+
+ + + + +
+
diff --git a/adm_local/Makefile.in b/adm_local/Makefile.in new file mode 100644 index 0000000..b19e7c1 --- /dev/null +++ b/adm_local/Makefile.in @@ -0,0 +1,60 @@ +# Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS, L3S, LJLL, MENSI +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ +# +# source path +top_srcdir=@top_srcdir@ +top_builddir=.. +srcdir=@srcdir@ +VPATH=.:$(srcdir)/adm_local + + +all: resources + +install: + cp -rf @top_srcdir@/adm_local @prefix@ + +bin: + +resources : + cp -rf @top_srcdir@/adm_local $(top_builddir) + +inc: + +lib: + +depend: + +depend_idl: + +install-end: + +install-include: + +install-bin: + +uninstall: + +uninstall-idl: + +distclean: + +clean: + +distclean-other: + diff --git a/adm_local/unix/config_files/check_BLSURFPLUGIN.m4 b/adm_local/unix/config_files/check_BLSURFPLUGIN.m4 new file mode 100644 index 0000000..0af102f --- /dev/null +++ b/adm_local/unix/config_files/check_BLSURFPLUGIN.m4 @@ -0,0 +1,86 @@ +AC_DEFUN([CHECK_BLSURF],[ + +AC_REQUIRE([AC_PROG_CXX])dnl +AC_REQUIRE([AC_PROG_CXXCPP])dnl + +AC_CHECKING(for BLSURF comercial product) + +AC_LANG_SAVE +AC_LANG_CPLUSPLUS + +AC_ARG_WITH(, + [ --with-BLSURF=DIR root directory path of BLSUF installation], + BLSURF_HOME=$withval,BLSURF_HOME="") + +BLSURF_INCLUDES="" +BLSURF_LIBS="" + +BLSURF_ok=no + +if test "x$BLSURF_HOME" == "x" ; then + +# no --with-BLSURF option used + if test "x$BLSURFHOME" != "x" ; then + + # BLSURFHOME environment variable defined + BLSURF_HOME=$BLSURFHOME + + fi +# +fi + +if test "x$BLSURF_HOME" != "x"; then + + echo + echo ------------------------------------------------- + echo You are about to choose to use somehow the + echo BLSURF commercial product to generate 2D mesh. + echo + + + + BLSURF_INCLUDES="-I$BLSURF_HOME/include" + BLSURF_LIBS="-L$BLSURF_HOME/lib -lBLSURF" + + CPPFLAGS_old="$CPPFLAGS" + CXXFLAGS_old="$CXXFLAGS" + LDFLAGS_old="$LDFLAGS" + + CPPFLAGS="$BLSURF_INCLUDES $CPPFLAGS" + CXXFLAGS="$BLSURF_INCLUDES $CXXFLAGS" + LDFLAGS="-L. -$BLSURF_LIBS $LDFLAGS" + + AC_MSG_CHECKING(for BLSURF header file) + + AC_CHECK_HEADER(blshare.h,BLSURF_ok=yes,BLSURF_ok=no) + if test "x$BLSURF_ok" == "xyes"; then + + AC_MSG_CHECKING(for BLSURF library) + + AC_TRY_COMPILE(#include "blshare.h", + BLSURF_init(); + ,BLSURF_ok=yes; + $CXX -shared -o linopt.o -c + ,BLSURF_ok=no) + + fi + + CPPFLAGS="$CPPFLAGS_old" + CXXFLAGS="$CXXFLAGS_old" + LDFLAGS="$LDFLAGS_old" + + if test "x$BLSURF_ok" == xno ; then + AC_MSG_RESULT(no) + AC_MSG_WARN(BLSURF includes or libraries are not found or are not properly installed) + else + AC_MSG_RESULT(yes) + fi + +fi + +AC_SUBST(BLSURF_INCLUDES) +AC_SUBST(BLSURF_LIBS) + +AC_LANG_RESTORE + +])dnl diff --git a/adm_local/unix/make_commence.in b/adm_local/unix/make_commence.in new file mode 100644 index 0000000..e2536f1 --- /dev/null +++ b/adm_local/unix/make_commence.in @@ -0,0 +1,284 @@ +# common directories to put headerfiles +inc_builddir=$(top_builddir)/include/salome + +@SET_MAKE@ +SHELL=/bin/sh + +# header missing + +HAVE_SSTREAM=@HAVE_SSTREAM@ + + +LIBS=@LIBS@ +LDFLAGS=@LDFLAGS@ -L$(top_builddir)/lib/salome -Xlinker -rpath-link -Xlinker $(top_builddir)/lib/salome +# add libstdc++ to link c++ library with libtool ! +LDFLAGS+= -lstdc++ + +CP=@CP@ + +# CPP + +CPP=@CPP@ +CXXCPP=@CXXCPP@ +CPPFLAGS=@CPPFLAGS@ -I$(inc_builddir) -I$(srcdir) -I. + +# C + +CC = @CC@ +CFLAGS = @CFLAGS@ +C_DEPEND_FLAG = @C_DEPEND_FLAG@ + +# C++ + +CXX = @CXX@ +CXXFLAGS = @CXXFLAGS@ +CXX_DEPEND_FLAG = @CXX_DEPEND_FLAG@ + +# BOOST Library + +BOOST_CPPFLAGS = @BOOST_CPPFLAGS@ + +# JAVA + +JAVA_INCLUDES = @JAVA_INCLUDES@ +JAVA_LIBS = @JAVA_LIBS@ +JAVA_LDPATH = @JAVA_LDPATH@ + +# PYTHON + +PYTHON = @PYTHON@ +PYTHONHOME = @PYTHONHOME@ +PYTHON_INCLUDES = @PYTHON_INCLUDES@ +PYTHON_LIBS = @PYTHON_LIBS@ +PYTHON_VERSION = @PYTHON_VERSION@ +PYTHON_SITE = @PYTHON_SITE@ +PYTHON_SITE_INSTALL = @PYTHON_SITE_INSTALL@ + +# QT + +QT_ROOT = @QT_ROOT@ +QT_INCLUDES = @QT_INCLUDES@ +QT_MT_INCLUDES = @QT_INCLUDES@ -DQT_THREAD_SUPPORT +QT_LIBS = @QT_LIBS@ +QT_MT_LIBS = @QT_MT_LIBS@ + +MOC = @MOC@ +UIC = @UIC@ +MSG2QM = @MSG2QM@ + +#QWT + +QWT_INCLUDES=@QWT_INCLUDES@ +QWT_LIBS=@QWT_LIBS@ + +# SIP +SIP = @SIP@ +SIP_INCLUDES = @SIP_INCLUDES@ +SIP_LIBS = @SIP_LIBS@ + +# PYQT +PYQT_SIPS = @PYQT_SIPS@ +PYQT_LIBS = @PYQT_LIBS@ + +# openGL +OGL_INCLUDES=@OGL_INCLUDES@ +OGL_LIBS=@OGL_LIBS@ + +# VTK +VTK_INCLUDES=@VTK_INCLUDES@ +VTK_LIBS=@VTK_LIBS@ + +# HDF5 + +HDF5_INCLUDES=@HDF5_INCLUDES@ +HDF5_LIBS=@HDF5_LIBS@ +HDF5_MT_LIBS=@HDF5_MT_LIBS@ + +# OpenCasCade + +OCC_INCLUDES=@CAS_CPPFLAGS@ +OCC_CXXFLAGS=@CAS_CXXFLAGS@ + +OCC_KERNEL_LIBS=@CAS_KERNEL@ +OCC_OCAF_LIBS=@CAS_OCAF@ +OCC_VIEWER_LIBS=@CAS_VIEWER@ +OCC_MODELER_LIBS=@CAS_MODELER@ +OCC_DATAEXCHANGE_LIBS=@CAS_DATAEXCHANGE@ +OCC_LIBS=@CAS_LDFLAGS@ +OCC_LDPATH=@CAS_LDPATH@ + +# MPICH + +MPICH_INCLUDES=@MPICH_INCLUDES@ +MPICH_LIBS=@MPICH_LIBS@ + +# Swig C++ Python + +SWIG = @SWIG@ +SWIG_FLAGS = @SWIG_FLAGS@ -I$(inc_builddir) -I$(srcdir) -I. + +# OMNIORB + +OMNIORB_ROOT = @OMNIORB_ROOT@ +OMNIORB_INCLUDES = @OMNIORB_INCLUDES@ +OMNIORB_LIBS = @OMNIORB_LIBS@ +OMNIORB_CXXFLAGS = @OMNIORB_CXXFLAGS@ + +OMNIORB_IDL = @OMNIORB_IDL@ +OMNIORB_IDLCXXFLAGS = @OMNIORB_IDLCXXFLAGS@ +OMNIORB_IDLPYFLAGS = @OMNIORB_IDLPYFLAGS@ -I$(srcdir) -I$(KERNEL_ROOT_DIR)/idl/salome \ + -I$(GEOM_ROOT_DIR)/idl/salome -I$(MED_ROOT_DIR)/idl/salome\ + -I$(SMESH_ROOT_DIR)/idl/salome + +OMNIORB_IDL_CLN_H = @OMNIORB_IDL_CLN_H@ +OMNIORB_IDL_CLN_CXX = @OMNIORB_IDL_CLN_CXX@ +OMNIORB_IDL_CLN_OBJ = @OMNIORB_IDL_CLN_OBJ@ + +OMNIORB_IDL_SRV_H = @OMNIORB_IDL_SRV_H@ +OMNIORB_IDL_SRV_CXX = @OMNIORB_IDL_SRV_CXX@ +OMNIORB_IDL_SRV_OBJ = @OMNIORB_IDL_SRV_OBJ@ + +# Default ORB + +CORBA_ROOT = @CORBA_ROOT@ +CORBA_INCLUDES = @CORBA_INCLUDES@ +CORBA_LIBS = @CORBA_LIBS@ +CORBA_CXXFLAGS = @CORBA_CXXFLAGS@ + +IDLCXXFLAGS = -bcxx @IDLCXXFLAGS@ -I$(srcdir) -I$(KERNEL_ROOT_DIR)/idl/salome \ + -I$(GEOM_ROOT_DIR)/idl/salome -I$(MED_ROOT_DIR)/idl/salome\ + -I$(SMESH_ROOT_DIR)/idl/salome +IDLPYFLAGS = @IDLPYFLAGS@ + +IDL = @IDL@ + +IDL_CLN_H = @IDL_CLN_H@ +IDL_CLN_CXX = @IDL_CLN_CXX@ +IDL_CLN_OBJ = @IDL_CLN_OBJ@ + +IDL_SRV_H = @IDL_SRV_H@ +IDL_SRV_CXX = @IDL_SRV_CXX@ +IDL_SRV_OBJ = @IDL_SRV_OBJ@ + +CPPFLAGS+= $(CORBA_INCLUDES) +CXXFLAGS+= $(CORBA_CXXFLAGS) + +# SALOME + +SALOME_INCLUDES = \ + -I$(KERNEL_ROOT_DIR)/include/salome \ + -I$(GEOM_ROOT_DIR)/include/salome \ + -I$(SMESH_ROOT_DIR)/include/salome + +CPPFLAGS += -DSOLIDGEOM -DLINUX $(OCC_INCLUDES) $(SALOME_INCLUDES) $(BOOST_CPPFLAGS) +CXXFLAGS += -DSOLIDGEOM -DLINUX $(OCC_CXXFLAGS) $(SALOME_INCLUDES) + +LDFLAGS += -L${KERNEL_ROOT_DIR}/lib@LIB_LOCATION_SUFFIX@/salome -L${SMESH_ROOT_DIR}/lib@LIB_LOCATION_SUFFIX@/salome -L${GEOM_ROOT_DIR}/lib@LIB_LOCATION_SUFFIX@/salome -lSMESHimpl -lSMESHEngine -lStdMeshers -lStdMeshersEngine -lSalomeGenericObj + +# add corba libs when link salome application ! +#LDFLAGS+= $(CORBA_LIBS) +LIBS+=$(CORBA_LIBS) + +## Shared libraries +LT_STATIC_EXEC=@LT_STATIC_EXEC@ +DYNAMIC_DIRS=@DYNAMIC_DIRS@ +LT_LIB=libtool +LT=$(top_builddir)/libtool +LT_COMPILE=$(LT) --mode=compile $(CC) +LT_LINK_LIB=$(LT_LIB) --mode=link $(CC) -rpath $(libdir) +LT_LINK_EXE=$(LT) --mode=link $(CC) $(LT_STATIC_EXEC) -dlopen self -rpath $(bindir) $(DYNAMIC_DIRS) +LT_RUN=$(LT) --mode=execute +LT_INSTALL_PROG=$(LT) --mode=install $(INSTALL_PROGRAM) +LT_INSTALL_LIB=$(LT) --mode=install $(INSTALL_DATA) +LT_UNINSTALL=$(LT) --mode=uninstall $(RM) + +INSTALL=@INSTALL@ +INSTALL_PROGRAM=@INSTALL_PROGRAM@ +INSTALL_DATA=@INSTALL_DATA@ + +# create a symbolic link (or a copie ?) +LN_S=@LN_S@ + +## Installation points +prefix=@prefix@ +exec_prefix=@exec_prefix@ +bindir=@bindir@/salome +libdir=@libdir@/salome +# warning : if user give this path in configure we could have salome/salome :-( +includedir=@includedir@/salome +datadir=@datadir@/salome +idldir=$(prefix)/idl/salome +sharedpydir=@libdir@/python$(PYTHON_VERSION)/site-packages/salome/shared_modules + +docdir=${prefix}/doc/salome + +# +# begin of package rules +# + +.PHONY: all lib bin inc resources docs tests install uninstall dep depend depend_idl cleandep mostlyclean clean distclean + +.SUFFIXES: .cxx .cc .c .f .o .lo .idl .py .i .ui .po .qm + +all: + $(MAKE) inc + $(MAKE) depend_idl + $(MAKE) depend + $(MAKE) lib + $(MAKE) bin + $(MAKE) resources + +# +# add target to build administrative files +# + +Makefile: $(top_builddir)/config.status $(srcdir)/Makefile.in + cd $(top_builddir) ; ./config.status + +LOCAL_MAKE = make_commence make_omniorb + +KERNEL_MAKE = make_module make_conclude depend SALOMEconfig.h F77config.h sstream envScript + +$(top_builddir)/config.status: $(top_srcdir)/configure \ + $(LOCAL_MAKE:%=$(top_srcdir)/adm_local/unix/%.in) \ + $(KERNEL_MAKE:%=$(KERNEL_ROOT_DIR)/salome_adm/unix/%.in) + cd $(top_builddir) ; ./config.status --recheck + +# VPATH contain $(srcdir), so make configure is good in top_srcdir and we must add target configure otherwise :-) +ifneq ($(top_srcdir),$(srcdir)) +configure: $(top_srcdir)/configure +endif + +$(top_srcdir)/configure: $(top_srcdir)/configure.in $(top_srcdir)/aclocal.m4 + cd $(top_srcdir) ; autoconf + +$(top_srcdir)/configure.in: $(top_srcdir)/configure.in.base + cd $(top_srcdir) && ./build_configure + + +ACLOCAL_KERNEL = \ +ac_cxx_bool.m4 check_corba.m4 \ +ac_cxx_depend_flag.m4 check_hdf5.m4 enable_pthreads.m4 \ +ac_cxx_mutable.m4 check_mico.m4 libtool.m4 \ +ac_cxx_namespaces.m4 check_omniorb.m4 pyembed.m4 \ +ac_cxx_partial_specialization.m4 python.m4 \ +ac_cxx_typename.m4 check_pthreads.m4 check_cas.m4 \ +ac_cc_warnings.m4 check_swig.m4 check_boost.m4 + +ACLOCAL_GUI = \ +check_vtk.m4 check_opengl.m4 check_qt.m4 \ +check_GUI.m4 check_corba_in_GUI.m4 + +ACLOCAL_GEOM = check_GEOM.m4 + +ACLOCAL_SMESH = check_SMESH.m4 + +$(top_srcdir)/aclocal.m4: $(ACLOCAL_KERNEL%=@KERNEL_ROOT_DIR@/salome_adm/unix/config_files/%) \ + $(ACLOCAL_GUI:%=@GUI_ROOT_DIR@/adm_local/unix/config_files/%) \ + $(ACLOCAL_GEOM:%=@GEOM_ROOT_DIR@/adm_local/unix/config_files/%) \ + $(ACLOCAL_SMESH:%=@SMESH_ROOT_DIR@/adm_local/unix/config_files/%) + cd $(top_srcdir) ; aclocal -I adm_local/unix/config_files -I @KERNEL_ROOT_DIR@/salome_adm/unix/config_files \ + -I @GUI_ROOT_DIR@/adm_local/unix/config_files \ + -I @GEOM_ROOT_DIR@/adm_local/unix/config_files \ + -I @SMESH_ROOT_DIR@/adm_local/unix/config_files + diff --git a/adm_local/unix/make_omniorb.in b/adm_local/unix/make_omniorb.in new file mode 100644 index 0000000..217e040 --- /dev/null +++ b/adm_local/unix/make_omniorb.in @@ -0,0 +1,61 @@ +#======================================================================= +# Begin specific part to omniorb +# (include from file adm/unix/make_omniorb generated by +# adm/unix/make_omniorb.in) +#======================================================================= +# -* Makefile *- +# +# Author : Patrick GOLDBRONN (CEA) +# Date : 29/06/2001 +# + +# Client and server object are the same with omniorb +# There are one header file and one source file generate + +#IDLOBJ=$(IDLSRC:%.idl=%$(IDL_CLN_OBJ)) + +# dependancies between idl and it's generated files +%$(OMNIORB_IDL_CLN_CXX) %$(OMNIORB_IDL_CLN_H): ${KERNEL_ROOT_DIR}/idl/salome/%.idl + $(OMNIORB_IDL) $(IDLCXXFLAGS) $(OMNIORB_IDLCXXFLAGS) $< + +%$(OMNIORB_IDL_CLN_CXX) %$(OMNIORB_IDL_CLN_H): ${GEOM_ROOT_DIR}/idl/salome/%.idl + $(OMNIORB_IDL) $(IDLCXXFLAGS) $(OMNIORB_IDLCXXFLAGS) $< + +#%$(OMNIORB_IDL_CLN_CXX) %$(OMNIORB_IDL_CLN_H): ${MED_ROOT_DIR}/idl/salome/%.idl +# $(OMNIORB_IDL) $(IDLCXXFLAGS) $(OMNIORB_IDLCXXFLAGS) $< + +%$(OMNIORB_IDL_CLN_CXX) %$(OMNIORB_IDL_CLN_H): ${SMESH_ROOT_DIR}/idl/salome/%.idl + $(OMNIORB_IDL) $(IDLCXXFLAGS) $(OMNIORB_IDLCXXFLAGS) $< + +%$(OMNIORB_IDL_CLN_CXX) %$(OMNIORB_IDL_CLN_H): ${top_builddir}/idl/salome/%.idl + $(OMNIORB_IDL) $(IDLCXXFLAGS) $(OMNIORB_IDLCXXFLAGS) $< + +# dependncies between idl files +depend_idl: .depidl + +# we use cpp to generate dependencies between idl files. +# we change cpp output to keep only idl file and transform it to get a suitable rule +.depidl: $(IDL_FILES) + @touch $@ + @for dep in $? dummy; do \ + if [ $$dep != "dummy" ]; then \ + echo Building dependencies for $$dep; \ + basedep=`basename $$dep .idl`; \ + header="$$basedep"$(IDL_CLN_H); \ + sed '\%^'"$$header"':%,\%[^\\]$$%d' <$@ >$@- && mv $@- $@; \ + $(CPP) $(C_DEPEND_FLAG) -I$(srcdir) $$dep 2>/dev/null | \ + sed `echo "s%$$basedep\\.idl%$$header:%g"` | \ + sed 's% $(srcdir)/% %g' | \ + sed 's% $(top_srcdir)/% %g' | \ + sed 's% $(top_builddir)/% %g' | \ + sed 's%^.*:\.o: *%%' | sed 's%^ *\\ *%%'| sed 's%^ *\(.*\):%\1:%' | \ + sed 's/\.idl/$(IDL_CLN_H)/' >>$@; \ + echo '' >>$@; \ + fi; \ + done ; + +-include .depidl + +#======================================================================= +# End specific part to omniorb +#======================================================================= diff --git a/bin/VERSION b/bin/VERSION new file mode 100755 index 0000000..bd2d125 --- /dev/null +++ b/bin/VERSION @@ -0,0 +1 @@ +THIS IS SALOME - BLSURFPLUGIN VERSION: 3.2.0 diff --git a/build_configure b/build_configure new file mode 100755 index 0000000..8e183ab --- /dev/null +++ b/build_configure @@ -0,0 +1,251 @@ +#!/bin/bash + +# +# Tool for updating list of .in file for the SALOME project +# and regenerating configure script +# +# Author : Marc Tajchman - CEA +# Date : 10/10/2002 +# + +ORIG_DIR=`pwd` +CONF_DIR=`echo $0 | sed -e "s,[^/]*$,,;s,/$,,;s,^$,.,"` + +######################################################################## +# Test if the KERNEL_ROOT_DIR is set correctly + +if test ! -d "${KERNEL_ROOT_DIR}"; then + echo "failed : KERNEL_ROOT_DIR variable is not correct !" + exit +fi + +# Test if the KERNEL_SRC is set correctly + +#if test ! -d "${KERNEL_SRC}"; then +# echo "failed : KERNEL_SRC variable is not correct !" +# exit +#fi +######################################################################## +# Test if the GUI_ROOT_DIR is set correctly + +if test ! -d "${GUI_ROOT_DIR}"; then + echo "failed : GUI_ROOT_DIR variable is not correct !" + exit +fi + +######################################################################## +# Test if the MED_ROOT_DIR is set correctly + +if test ! -d "${MED_ROOT_DIR}"; then + echo "failed : MED_ROOT_DIR variable is not correct !" + exit +fi + +######################################################################## +# Test if the GEOM_ROOT_DIR is set correctly + +if test ! -d "${GEOM_ROOT_DIR}"; then + echo "failed : GEOM_ROOT_DIR variable is not correct !" + exit +fi + +######################################################################## +# Test if the SMESH_ROOT_DIR is set correctly + +if test ! -d "${SMESH_ROOT_DIR}"; then + echo "failed : SMESH_ROOT_DIR variable is not correct !" + exit +fi + +######################################################################## +# find_in - utility function +# +# usage : +# find_in directory filename +# +# Finds files following the *.in pattern, recursively in the +# directory (first argument). +# Results are appended into the file (second argument) +# +# Difference from the standard unix find is that files are tested +# before directories +# + +find_in() +{ + local i + local f=$2 + +# if the first argument is not a directory, returns + + if [ ! -d "$1" ] ; then + return + fi + +# dont look in the CVS directories + + case $1 in + */CVS) return ;; + */adm_local/*) return ;; + *) ;; + esac + +# for each regular file contained in the directory +# test if it's a .in file + + for i in "$1"/* + do + if [ -f "$i" ] ; then + case $i in + *.in) echo " "$i" \\" >> $f;; + *) ;; + esac + fi + done + +# for each subdirectory of the first argument, proceeds recursively + + for i in "$1"/* + do + if [ -d "$i" ] ; then + find_in "$i" "$f" + fi + done +} + + +####################################################################### +# Generate list of .in files (Makefile.in, config.h.in, etc) +# appending it in file configure.in + +cd ${CONF_DIR} +ABS_CONF_DIR=`pwd` + +# +# Common part of the configure.in file +# +chmod u+w configure.in.base +if ! \cp -f configure.in.base configure.in_tmp1 +then + echo + echo "error : can't create files in" ${CONF_DIR} + echo "aborting ..." + chmod u-w configure.in.base + exit +fi +chmod u-w configure.in.base + +if [ -e "${CONF_DIR}/salome_adm" ] ; then + \rm -f ${CONF_DIR}/salome_adm +fi + +# make a link allowing AC_OUTPUT to find the salome_adm/.../*.in files +echo "" >> configure.in_tmp1 +echo 'ln -fs ${KERNEL_ROOT_DIR}/salome_adm ${ROOT_SRCDIR}/.' >> configure.in_tmp1 + +echo "" >> configure.in_tmp1 +echo "AC_OUTPUT([ \\" >> configure.in_tmp1 + +# +# List of .in files in the adm/unix directory +# These files MUST be on top of AC_OUTPUT list so we +# put them "manually" +# + +echo " ./salome_adm/unix/SALOMEconfig.h \\" >> configure.in_tmp1 +echo " ./salome_adm/unix/F77config.h \\" >> configure.in_tmp1 +echo " ./salome_adm/unix/sstream \\" >> configure.in_tmp1 +echo " ./salome_adm/unix/depend \\" >> configure.in_tmp1 +echo " ./adm_local/unix/make_omniorb:${ABS_CONF_DIR}/adm_local/unix/make_omniorb.in \\" >> configure.in_tmp1 +echo " ./salome_adm/unix/envScript \\" >> configure.in_tmp1 +echo " ./adm_local/unix/make_commence:${ABS_CONF_DIR}/adm_local/unix/make_commence.in \\" >> configure.in_tmp1 +echo " ./salome_adm/unix/make_conclude \\" >> configure.in_tmp1 +echo " ./salome_adm/unix/make_module \\" >> configure.in_tmp1 + +\rm -f configure.in_tmp2 configure.in_tmp3 +touch configure.in_tmp2 +find_in . configure.in_tmp2 +sed -e '/^...salome_adm/d' configure.in_tmp2 > configure.in_tmp3 +sed -e '/^...adm_local.unix.make_omniorb/d' configure.in_tmp3 configure.in_tmp2 +sed -e '/^...adm_local.unix.make_commence/d' configure.in_tmp2 > configure.in_tmp3 +sed -e '/configure.in/d' configure.in_tmp3 > configure.in_tmp2 +sed -e 's/.in / /' configure.in_tmp2 >> configure.in_tmp1 +#sed '/^.salome_adm/d' configure.in_tmp2 > configure.in_tmp3 +#sed '/configure.in/d' configure.in_tmp3 > configure.in_tmp2 +#sed 's/.in / /' configure.in_tmp2 >> configure.in_tmp1 + +echo "])" >> configure.in_tmp1 + +# delete the link created for AC_OUTPUT +echo "" >> configure.in_tmp1 +#echo 'rm -f ${ROOT_SRCDIR}/salome_adm' >> configure.in_tmp1 +\mv configure.in_tmp1 configure.in_new +\rm -f configure.in_tmp2 configure.in_tmp3 + + +######################################################################## +# Create new (or replace old) configure.in file +# Print a message if the file is write protected +# + +echo +if test ! -f configure.in +then + echo -n "Creating new file 'configure.in' ... " + if \mv configure.in_new configure.in >& /dev/null + then + echo "done" + else + echo "error, check your file permissions" + fi +else + echo -n "Updating 'configure.in' file ... " + if ! \cp configure.in configure.in_old >& /dev/null + then + echo + echo + echo "Can't backup previous configure.in" + echo -n "Continue (you will not be able to revert) - (Y/N) ? " + read R + case "x$R" in + xn*) exit;; + xN*) exit;; + esac + echo + echo -n " " + fi + if \cp configure.in_new configure.in >& /dev/null + then + echo "done" + else + echo + echo "error, can't update previous configure.in" + fi +fi + +######################################################################## +# Use autoconf to rebuild the configure script +# + +if test -f configure +then + echo -n "Updating 'configure' script ... " +else + echo -n "Creating 'configure' script ... " +fi + +aclocal -I adm_local/unix/config_files -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files \ + -I ${GUI_ROOT_DIR}/adm_local/unix/config_files \ + -I ${MED_ROOT_DIR}/adm_local/unix/config_files \ + -I ${GEOM_ROOT_DIR}/adm_local/unix/config_files \ + -I ${SMESH_ROOT_DIR}/adm_local/unix/config_files +if autoconf +then + echo "done" +else + echo "failed (check file permissions and/or user quotas ...)" +fi + +cd ${ORIG_DIR} + +echo diff --git a/configure.in.base b/configure.in.base new file mode 100644 index 0000000..ec10256 --- /dev/null +++ b/configure.in.base @@ -0,0 +1,427 @@ +# +# PLEASE DO NOT MODIFY configure.in FILE +# +# ALL CHANGES WILL BE DISCARDED BY THE NEXT +# build_configure COMMAND +# +# CHANGES MUST BE MADE IN configure.in.base FILE +# +# +# Author : Marc Tajchman (CEA) +# Date : 28/06/2001 +# Modified by : Patrick GOLDBRONN (CEA) +# Modified by : Marc Tajchman (CEA) +# +# Created from configure.in.base +# + +AC_INIT(src) +AC_CONFIG_AUX_DIR(${KERNEL_ROOT_DIR}/salome_adm/unix/config_files) +AC_CANONICAL_HOST + +PACKAGE=salome +AC_SUBST(PACKAGE) + +VERSION=0.0.1 +AC_SUBST(VERSION) + +dnl +dnl Initialize source and build root directories +dnl + +ROOT_BUILDDIR=`pwd` +ROOT_SRCDIR=`echo $0 | sed -e "s,[[^/]]*$,,;s,/$,,;s,^$,.,"` +cd $ROOT_SRCDIR +ROOT_SRCDIR=`pwd` +cd $ROOT_BUILDDIR + +AC_SUBST(ROOT_SRCDIR) +AC_SUBST(ROOT_BUILDDIR) + +echo +echo Source root directory : $ROOT_SRCDIR +echo Build root directory : $ROOT_BUILDDIR +echo +echo + +if test -z "$AR"; then + AC_CHECK_PROGS(AR,ar xar,:,$PATH) +fi +AC_SUBST(AR) + +dnl Export the AR macro so that it will be placed in the libtool file +dnl correctly. +export AR + +echo +echo --------------------------------------------- +echo testing make +echo --------------------------------------------- +echo + +AC_PROG_MAKE_SET +AC_PROG_INSTALL +dnl +dnl libtool macro check for CC, LD, NM, LN_S, RANLIB, STRIP + pour les librairies dynamiques ! + +AC_ENABLE_DEBUG(yes) +AC_DISABLE_PRODUCTION + +echo --------------------------------------------- +echo testing libtool +echo --------------------------------------------- + +dnl first, we set static to no! +dnl if we want it, use --enable-static +AC_ENABLE_STATIC(no) + +AC_LIBTOOL_DLOPEN +AC_PROG_LIBTOOL + +dnl Fix up the INSTALL macro if it s a relative path. We want the +dnl full-path to the binary instead. +case "$INSTALL" in + *install-sh*) + INSTALL='\${KERNEL_ROOT_DIR}'/salome_adm/unix/config_files/install-sh + ;; +esac + +echo +echo --------------------------------------------- +echo testing C/C++ +echo --------------------------------------------- +echo + +cc_ok=no +dnl inutil car libtool +dnl AC_PROG_CC +AC_PROG_CXX +AC_DEPEND_FLAG +# AC_CC_WARNINGS([ansi]) +cc_ok=yes + +dnl Library libdl : +AC_CHECK_LIB(dl,dlopen) + +dnl add library libm : +AC_CHECK_LIB(m,ceil) + +dnl +dnl Well we use sstream which is not in gcc pre-2.95.3 +dnl We must test if it exists. If not, add it in include ! +dnl + +AC_CXX_HAVE_SSTREAM + +dnl +dnl --------------------------------------------- +dnl testing MPICH +dnl --------------------------------------------- +dnl + +CHECK_MPICH + +echo +echo --------------------------------------------- +echo testing LEX \& YACC +echo --------------------------------------------- +echo + +lex_yacc_ok=no +AC_PROG_YACC +AC_PROG_LEX +lex_yacc_ok=yes + +echo +echo --------------------------------------------- +echo testing python +echo --------------------------------------------- +echo + +CHECK_PYTHON + +echo +echo --------------------------------------------- +echo BOOST Library +echo --------------------------------------------- +echo + +CHECK_BOOST + +dnl echo +dnl echo --------------------------------------------- +dnl echo testing java +dnl echo --------------------------------------------- +dnl echo + +dnl CHECK_JAVA + +echo +echo --------------------------------------------- +echo testing swig +echo --------------------------------------------- +echo + +CHECK_SWIG + +echo +echo --------------------------------------------- +echo testing threads +echo --------------------------------------------- +echo + +ENABLE_PTHREADS + +echo +echo --------------------------------------------- +echo testing omniORB +echo --------------------------------------------- +echo + +CHECK_OMNIORB + +dnl echo +dnl echo --------------------------------------------- +dnl echo testing mico +dnl echo --------------------------------------------- +dnl echo + +dnl CHECK_MICO + +echo +echo --------------------------------------------- +echo default ORB : omniORB +echo --------------------------------------------- +echo + +DEFAULT_ORB=omniORB +CHECK_CORBA + +AC_SUBST_FILE(CORBA) +corba=make_$ORB +CORBA=adm_local/unix/$corba + +echo +echo --------------------------------------------- +echo testing openGL +echo --------------------------------------------- +echo + +CHECK_OPENGL + +echo +echo --------------------------------------------- +echo testing QT +echo --------------------------------------------- +echo + +CHECK_QT + +echo +echo --------------------------------------------- +echo testing MSG2QM +echo --------------------------------------------- +echo + +CHECK_MSG2QM + +echo +echo --------------------------------------------- +echo testing VTK +echo --------------------------------------------- +echo + +CHECK_VTK + +echo +echo --------------------------------------------- +echo testing HDF5 +echo --------------------------------------------- +echo + +CHECK_HDF5 + +echo +echo --------------------------------------------- +echo Testing OpenCascade +echo --------------------------------------------- +echo + +CHECK_CAS + +echo +echo --------------------------------------------- +echo Testing html generators +echo --------------------------------------------- +echo + +CHECK_HTML_GENERATORS + +echo +echo --------------------------------------------- +echo Testing GUI +echo --------------------------------------------- +echo + +CHECK_SALOME_GUI + +echo +echo --------------------------------------------- +echo Testing full GUI +echo --------------------------------------------- +echo + +CHECK_CORBA_IN_GUI +if test "x${CORBA_IN_GUI}" != "xyes"; then + echo "failed : For configure BLSURFPLUGIN module necessary full GUI !" + exit +fi + +echo +echo --------------------------------------------- +echo Testing Kernel +echo --------------------------------------------- +echo + +CHECK_KERNEL + +echo +echo --------------------------------------------- +echo Testing Geom +echo --------------------------------------------- +echo + +CHECK_GEOM + +# echo +# echo --------------------------------------------- +# echo Testing Med +# echo --------------------------------------------- +# echo +# +# CHECK_MED + +echo +echo --------------------------------------------- +echo Testing BLSURF +echo --------------------------------------------- +echo + +CHECK_BLSURF + +echo +echo --------------------------------------------- +echo Testing SMesh +echo --------------------------------------------- +echo + +CHECK_SMESH + +echo +echo --------------------------------------------- +echo Summary +echo --------------------------------------------- +echo + +echo Configure +variables="cc_ok boost_ok lex_yacc_ok python_ok swig_ok threads_ok OpenGL_ok qt_ok vtk_ok hdf5_ok omniORB_ok occ_ok doxygen_ok graphviz_ok Kernel_ok Geom_ok SMesh_ok BLSURF_ok" + +for var in $variables +do + printf " %10s : " `echo \$var | sed -e "s,_ok,,"` + eval echo \$$var +done + +echo +echo "Default ORB : $DEFAULT_ORB" +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(MODULE) MODULE=salome_adm/unix/make_module + +dnl les dependences +AC_SUBST_FILE(DEPEND) DEPEND=salome_adm/unix/depend + +dnl We don t need to say when we re entering directories if we re using +dnl GNU make becuase make does it for us. +if test "X$GMAKE" = "Xyes"; then + AC_SUBST(SETX) SETX=":" +else + AC_SUBST(SETX) SETX="set -x" +fi + +# make other build directories +for rep in salome_adm adm_local doc bin/salome include/salome lib${LIB_LOCATION_SUFFIX}/salome share/salome/resources idl +do +# if test ! -d $rep ; then +# eval mkdir $rep +# fi + $INSTALL -d $rep +done + +echo +echo --------------------------------------------- +echo copying resource files, shell scripts, and +echo xml files +echo --------------------------------------------- +echo + + +dnl copy resources directories + +#for i in `find $ROOT_SRCDIR -name 'resources' -print` +#do +# local_res=`echo $i | sed -e "s,$ROOT_SRCDIR,.,"` +# local_res_dir=`echo $local_res | sed -e "s,[[^/]]*$,,;s,/$,,;s,^$,.,"` +# mkdir -p $local_res_dir +# cd $local_res_dir +# ln -fs $i +# echo $local_res +# cd $ROOT_BUILDDIR +#done + +dnl copy shells and utilities contained in the bin directory +dnl excluding .in files (treated in AC-OUTPUT below) and CVS +dnl directory + +#mkdir -p bin/salome +#cd bin/salome +#for i in $ROOT_SRCDIR/bin/* +#do +# local_bin=`echo $i | sed -e "s,$ROOT_SRCDIR,.,"` +# case "$local_bin" in +# *.in | *~) ;; +# ./bin/CVS | ./bin/salome) ;; +# *) /usr/bin/install -C $i .; echo $local_bin ;; +# esac +#done +#cd $ROOT_BUILDDIR + +AC_SUBST_FILE(ENVSCRIPT) ENVSCRIPT=salome_adm/unix/envScript + +dnl copy xml files to the build tree (lib directory) +dnl pourquoi ???? + +#cd lib +#for i in `find $ROOT_SRCDIR -name "*.xml" -print` +#do +# ln -fs $i +# echo `echo $i | sed -e "s,$ROOT_SRCDIR,.,"` +#done +#cd $ROOT_BUILDDIR + + +echo +echo --------------------------------------------- +echo generating Makefiles and configure files +echo --------------------------------------------- +echo + +#AC_OUTPUT_COMMANDS([ \ +# chmod +x ./bin/* \ +#]) + +## do not delete this line diff --git a/env_BLSURFplugin-Src.sh b/env_BLSURFplugin-Src.sh new file mode 100644 index 0000000..27dcce6 --- /dev/null +++ b/env_BLSURFplugin-Src.sh @@ -0,0 +1,3 @@ +#------ BLSURFplugin-Src ------ +export BLSURFPLUGIN_SRC_DIR=${INSTALL_ROOT}/BLSURFPLUGIN_SRC +## diff --git a/env_blsurf.sh b/env_blsurf.sh new file mode 100644 index 0000000..8f41511 --- /dev/null +++ b/env_blsurf.sh @@ -0,0 +1,18 @@ +#------ Licence Distene ------ +export DISTENE_LICENSE_FILE=${INSTALL_ROOT}/dlim8.key +## +#------ BLSURF ------ +export BLSURFHOME=${INSTALL_ROOT/BLSurf +## +#------ BLSURFplugin-Src ------ +export BLSURFPLUGIN_SRC_DIR=${INSTALL_ROOT}/BLSURFPLUGIN_SRC_3.2.4 +## +#------ BLSURFplugin-Bin ------ +export BLSURFPLUGIN_ROOT_DIR=${INSTALL_ROOT}/BLSURFPLUGIN_INSTALL +if [ -n "${ENV_FOR_LAUNCH}" ] ; then + if [ "${ENV_FOR_LAUNCH}" == "1" ] ; then + exportp LD_LIBRARY_PATH ${BLSURFPLUGIN_ROOT_DIR}/lib/salome:${BLSURFHOME}/lib + exportp PYTHONPATH ${BLSURFPLUGIN_ROOT_DIR}/lib64/salome:${BLSURFPLUGIN_ROOT_DIR}/lib64/python${PYTHON_VERSION}/site-packages/salome + fi +fi +## diff --git a/idl/BLSURFPlugin_Algorithm.idl b/idl/BLSURFPlugin_Algorithm.idl new file mode 100644 index 0000000..ecc7516 --- /dev/null +++ b/idl/BLSURFPlugin_Algorithm.idl @@ -0,0 +1,71 @@ +// 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 : BLSURFPlugin_Algorithm.idl +// Authors : Francis KLOSS (OCC) & Patrick LAUG (INRIA) & Lioka RAZAFINDRAZAKA (CEA) + +#ifndef _SMESH_BLSURFALGORITHM_IDL_ +#define _SMESH_BLSURFALGORITHM_IDL_ + +#include "SMESH_Hypothesis.idl" + +/*! + * BLSURFPlugin: interfaces to BLSURF related hypotheses and algorithms + */ +module BLSURFPlugin +{ + /*! + * BLSURFPlugin_BLSURF: interface of BLSURF algorithm + */ + interface BLSURFPlugin_BLSURF : SMESH::SMESH_2D_Algo + { + }; + + /*! + * BLSURFPlugin_Hypothesis: interface of "BLSURF parameters" hypothesis + */ + interface BLSURFPlugin_Hypothesis : SMESH::SMESH_Hypothesis + { + void SetPhysicalMesh(in long value); + long GetPhysicalMesh(); + + void SetPhySize(in double value); + double GetPhySize(); + + void SetGeometricMesh(in long value); + long GetGeometricMesh(); + + void SetAngleMeshS(in double value); + double GetAngleMeshS(); + + void SetGradation(in double value); + double GetGradation(); + + void SetQuadAllowed(in boolean value); + boolean GetQuadAllowed(); + + void SetDecimesh(in boolean value); + boolean GetDecimesh(); + }; + +}; + +#endif diff --git a/idl/Makefile.in b/idl/Makefile.in new file mode 100644 index 0000000..89d037a --- /dev/null +++ b/idl/Makefile.in @@ -0,0 +1,84 @@ +# Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS, L3S, LJLL, MENSI +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ +# +# +# generate dependencies for idl file : +# + +# source path +top_srcdir=@top_srcdir@ +top_builddir=.. +srcdir=@srcdir@ +VPATH=.:${KERNEL_ROOT_DIR}/idl/salome:${GEOM_ROOT_DIR}/idl/salome :${SMESH_ROOT_DIR}/idl/salome +#:${MED_ROOT_DIR}/idl/salome + +@COMMENCE@ + +IDL_FILES = BLSURFPlugin_Algorithm.idl + + +# copy all idl file in $(top_builddir)/idl +inc: $(top_builddir)/idl/salome $(IDL_FILES:%=$(top_builddir)/idl/salome/%) + +$(top_builddir)/idl/salome: + $(INSTALL) -d $@ + +$(IDL_FILES:%=$(top_builddir)/idl/salome/%):$(IDL_FILES:%=$(top_srcdir)/idl/%) + cp -f $^ $(top_builddir)/idl/salome + + +# python wrap +lib: pyidl + +PYTHON_BUILD_SITE=$(top_builddir)/lib/python$(PYTHON_VERSION)/site-packages/@PACKAGE@ + +pyidl: $(PYTHON_BUILD_SITE) $(IDL_FILES:%.idl=$(PYTHON_BUILD_SITE)/%_idl.py) + +$(PYTHON_BUILD_SITE): + $(INSTALL) -d $@ + +$(PYTHON_BUILD_SITE)/%_idl.py: $(top_builddir)/idl/salome/%.idl + $(OMNIORB_IDL) $(OMNIORB_IDLPYFLAGS) -C$(PYTHON_BUILD_SITE) $< + + +# install python client (generated from idl file) +install: $(IDL_FILES:%=$(top_builddir)/idl/salome/%) + $(INSTALL) -d $(idldir) $(PYTHON_SITE_INSTALL) + $(INSTALL_DATA) $^ $(idldir) + @for file in $^ dummy; do \ + if [ $$file != "dummy" ]; then \ + $(OMNIORB_IDL) $(OMNIORB_IDLPYFLAGS) -C$(PYTHON_SITE_INSTALL) $$file ; \ + fi ; \ + done ; + +uninstall: + -$(RM) $(IDL_FILES:%=$(idldir)/%) + -$(RM) $(IDL_FILES:%.idl=$(PYTHON_SITE_INSTALL)/%_idl.py) + +# clean +cleandep: + -$(RM) .dep* + +clean: cleandep + -$(RM) $(top_builddir)/idl/salome/*.idl + -$(RM) $(PYTHON_BUILD_SITE)/*.py + +distclean: clean + -$(RM) Makefile + diff --git a/resources/BLSURF.png b/resources/BLSURF.png new file mode 100644 index 0000000..487fdb7 Binary files /dev/null and b/resources/BLSURF.png differ diff --git a/resources/BLSURFPlugin.xml b/resources/BLSURFPlugin.xml new file mode 100644 index 0000000..30bcd8f --- /dev/null +++ b/resources/BLSURFPlugin.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + diff --git a/resources/mesh_algo_BLSURF.png b/resources/mesh_algo_BLSURF.png new file mode 100644 index 0000000..2629a2b Binary files /dev/null and b/resources/mesh_algo_BLSURF.png differ diff --git a/resources/mesh_hypo_BLSURF.png b/resources/mesh_hypo_BLSURF.png new file mode 100644 index 0000000..487fdb7 Binary files /dev/null and b/resources/mesh_hypo_BLSURF.png differ diff --git a/resources/mesh_tree_algo_BLSURF.png b/resources/mesh_tree_algo_BLSURF.png new file mode 100755 index 0000000..092eae3 Binary files /dev/null and b/resources/mesh_tree_algo_BLSURF.png differ diff --git a/resources/mesh_tree_hypo_BLSURF.png b/resources/mesh_tree_hypo_BLSURF.png new file mode 100644 index 0000000..cd813c8 Binary files /dev/null and b/resources/mesh_tree_hypo_BLSURF.png differ diff --git a/src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx b/src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx new file mode 100644 index 0000000..9a3e6aa --- /dev/null +++ b/src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx @@ -0,0 +1,433 @@ +// BLSURFPlugin : C++ implementation +// +// Copyright (C) 2006 OPEN CASCADE, CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// 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 : BLSURFPlugin_BLSURF.cxx +// Authors : Francis KLOSS (OCC) & Patrick LAUG (INRIA) & Lioka RAZAFINDRAZAKA (CEA) +// Date : 20/03/2006 +// Project : SALOME +//============================================================================= +using namespace std; + +#include "BLSURFPlugin_BLSURF.hxx" +#include "BLSURFPlugin_Hypothesis.hxx" + +#include +#include +#include + +#include +#include +#include + +#include + +#include +#include + +#include +#include +#include +#include +#include + +#include + +//============================================================================= +/*! + * + */ +//============================================================================= + +BLSURFPlugin_BLSURF::BLSURFPlugin_BLSURF(int hypId, int studyId, + SMESH_Gen* gen) + : SMESH_2D_Algo(hypId, studyId, gen) +{ + MESSAGE("BLSURFPlugin_BLSURF::BLSURFPlugin_BLSURF"); + + _name = "BLSURF"; + _shapeType = (1 << TopAbs_FACE); // 1 bit /shape type + _compatibleHypothesis.push_back("BLSURF_Parameters"); + _requireDescretBoundary = false; + _onlyUnaryInput = false; + _hypothesis = NULL; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +BLSURFPlugin_BLSURF::~BLSURFPlugin_BLSURF() +{ + MESSAGE("BLSURFPlugin_BLSURF::~BLSURFPlugin_BLSURF"); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +bool BLSURFPlugin_BLSURF::CheckHypothesis + (SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape, + SMESH_Hypothesis::Hypothesis_Status& aStatus) +{ + _hypothesis = NULL; + + list::const_iterator itl; + const SMESHDS_Hypothesis* theHyp; + + const list& hyps = GetUsedHypothesis(aMesh, aShape); + int nbHyp = hyps.size(); + if (!nbHyp) + { + aStatus = SMESH_Hypothesis::HYP_OK; + return true; // can work with no hypothesis + } + + itl = hyps.begin(); + theHyp = (*itl); // use only the first hypothesis + + string hypName = theHyp->GetName(); + + if (hypName == "BLSURF_Parameters") + { + _hypothesis = static_cast (theHyp); + ASSERT(_hypothesis); + aStatus = SMESH_Hypothesis::HYP_OK; + } + else + aStatus = SMESH_Hypothesis::HYP_INCOMPATIBLE; + + return aStatus == SMESH_Hypothesis::HYP_OK; +} + +//============================================================================= +/*! + * Pass parameters to BLSURF + */ +//============================================================================= + +void BLSURFPlugin_BLSURF::SetParameters(const BLSURFPlugin_Hypothesis* hyp) { + if (hyp) { + MESSAGE("BLSURFPlugin_BLSURF::SetParameters"); + _physicalMesh = (int) hyp->GetPhysicalMesh(); + _phySize = hyp->GetPhySize(); + _geometricMesh = (int) hyp->GetGeometricMesh(); + _angleMeshS = hyp->GetAngleMeshS(); + _gradation = hyp->GetGradation(); + _quadAllowed = hyp->GetQuadAllowed(); + _decimesh = hyp->GetDecimesh(); + } + + bool BlsurfEnvFile = true; + + if ( BlsurfEnvFile ) { + TCollection_AsciiString SalomeExecDir; + + char * Dir = getenv("PWD"); + SalomeExecDir = Dir; + SalomeExecDir += "/blsurf.env"; + + ofstream theBlsurfEnv ( SalomeExecDir.ToCString() , ios::out); + theBlsurfEnv << "verb 10" << endl; + theBlsurfEnv << "hphy_flag " << _physicalMesh << endl; + theBlsurfEnv << "hphydef " << _phySize << endl; + theBlsurfEnv << "hgeo_flag " << _geometricMesh << endl; + theBlsurfEnv << "angle_meshs " << _angleMeshS << endl; + theBlsurfEnv << "gradation " << _gradation << endl; + theBlsurfEnv << "topo_points 1" << endl; + theBlsurfEnv << "topo_project 1" << endl; + theBlsurfEnv << "topo_curves 1" << endl; + theBlsurfEnv << "surforient 1" << endl; + theBlsurfEnv << "decim " << _decimesh << endl; + theBlsurfEnv.close(); + } +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +bool BLSURFPlugin_BLSURF::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape) { + + SetParameters(_hypothesis); + + MESSAGE("BLSURFPlugin_BLSURF::Compute"); + + if (aShape.ShapeType() == TopAbs_COMPOUND) { + cout << " the shape is a COMPOUND" << endl; + } + else { + cout << " the shape is UNKNOWN" << endl; + }; + + int i=0; + if (1) { + for (TopExp_Explorer expf(aShape, TopAbs_FACE); expf.More(); expf.Next()) { + const TopoDS_Shape& face = expf.Current(); + i++; + int j=0; + for (TopExp_Explorer expe(face, TopAbs_EDGE); expe.More(); expe.Next()) { + const TopoDS_Shape& edge = expe.Current(); + j++; + int k=0; + for (TopExp_Explorer expv(edge, TopAbs_VERTEX); expv.More(); expv.Next()) { + k++; + } + // cout << " face " << i << " and its edge " << j << " has " << k << " vertices" << endl; + } + // cout << " face " << i << " has " << j << " edges" << endl; + } + // cout << " total number of faces = " << i << endl; + } + + BL_SURF mesh; + blw_* blw; + + cout << endl; + cout << "Beginning of Surface Mesh generation" << endl; + cout << endl; + if (!mesh.init(aShape)) + return(false); + cout << endl; + cout << "End of Surface Mesh generation" << endl; + cout << endl; + mesh.get_blw(blw); + + SMESHDS_Mesh* meshDS = aMesh.GetMeshDS(); + + if ( !_decimesh ) { + /* cf. export_mesh_all */ + int j, ip, ic, nptri, is, oriented, iF, nF, idom, ndom, v[5], verb; + double centre[3]; + char element[8]; + + verb = blw->env.verb; + blw->env.verb = 0; + assign_bls_mesh_num(blw); + blw->env.verb = verb; + + FOR (j, 0, 2) { + centre[j] = (blw->bls_glo.xyzmin[j] + blw->bls_glo.xyzmax[j]) * 0.5; + cout << "centre[" << j << "] : " << centre[j] << endl; + } + + /* points sommets des edges et des triangles */ + nptri = blw->bls_mesh_num.number_of_nodes; + if (blw->env.verb >= 10) + fprintf(blw->out, "export_salome: surface mesh contains %d vertices\n", nptri); + SMDS_MeshNode** nodes = new SMDS_MeshNode*[nptri+1]; + j = 0; + FOR (ip, 1, nptri) { + if (blw->bls_glo.vertices_xyz[3*ip-3] == BLHUGE) { + if (++j <= 10) { + fprintf(blw->out, "export_salome: unconnected vertex %d\n", ip); + if (j == 10) fprintf(blw->out, "export_salome: ...\n"); + } + nodes[ip] = meshDS->AddNode(centre[0], centre[1], centre[2]); + } + else { + double floatVal = blw->bls_glo.vertices_xyz[3*ip-3]; + // cout << "j : " << j << " node nmuber : " << ip << " --> first coordinate = " << floatVal << " != " << BLHUGE << endl; + nodes[ip] = meshDS->AddNode(blw->bls_glo.vertices_xyz[3*ip-3], blw->bls_glo.vertices_xyz[3*ip-2], blw->bls_glo.vertices_xyz[3*ip-1]); + // cout << "nodes[" << ip << "] : " << blw->bls_glo.vertices_xyz[3*ip-3] << ", " + // << blw->bls_glo.vertices_xyz[3*ip-2] << ", " + // << blw->bls_glo.vertices_xyz[3*ip-1] << endl; + } + } + + /* edges */ + int nbEdges = C3D.number_of_curves; + cout << "Number Of Edges : " << nbEdges << endl; + FOR (ic, 1, C3D.number_of_curves) { + //TopoDS_Edge topo_edge = mesh.all_edges[ic-1]->topology; + int np = C3D.TC[ic].number_of_points; + cout << "Number Of Nodes for edge " << ic << " : " << np << endl; + FOR (ip, 1, np-1) { + meshDS->AddEdge(nodes[C3D.TC[ic].iglopc[ip]], nodes[C3D.TC[ic].iglopc[ip+1]]); + } + } + + /* faces (triangles or quadrilaterals) */ + SMDS_MeshFace* face; + if (blw->bls_glo.number_of_patches <= 0) { + strcpy(element, "p1"); + } + else { + strcpy(element, TC2D[1].ms2d.element); + } + cout << endl; + cout << "Number_of_patches : " << blw->bls_glo.number_of_patches << endl; + cout << "Element : " << element << endl; + cout << "TC2D[1].ms2d.element : " << TC2D[1].ms2d.element << endl; + cout << endl; + if (STREQUAL(element, "p1")) { + if (blw->env.verb >= 10) + fprintf(blw->out, "export_salome: surface mesh contains %d triangles\n", blw->bls_mesh_num.ntri); + FOR (is, 1, blw->bls_glo.number_of_patches) { + TopoDS_Face topo_face = mesh.surfaces[is-1]->topology; + oriented = (TC2D[is].surforient >= 0); + // cout << endl; + // cout << "TC2D[is].surforient : " << TC2D[is].surforient << " --> oriented : " << oriented << endl; + nF = TC2D[is].ms2d.jmax_F; + ndom = TC2D[is].ms2d.ndom; + // cout << "nF : " << nF << endl; + // cout << "ndom : " << ndom << endl; + // cout << endl; + FOR (iF, 1, nF) { + idom = TC2D[is].ms2d.FRef[iF]; + if (!(1 <= idom && idom <= ndom)) + continue; + v[0] = TC2D[is].iglops[TC2D[is].ms2d.F[3*iF-3]]; + v[1] = TC2D[is].iglops[TC2D[is].ms2d.F[3*iF-2]]; + v[2] = TC2D[is].iglops[TC2D[is].ms2d.F[3*iF-1]]; + if (v[0]==v[1] || v[1]==v[2] || v[2]==v[0]) + continue; /* triangle degenere */ + // cout << "Triangle " << iF << " of face " << is; + if ( oriented) { + // cout << " doesn't need to be re-oriented" << endl; + face = meshDS->AddFace(nodes[v[2]], nodes[v[1]], nodes[v[0]]); + } + else { + // cout << " needs to be re-oriented" << endl; + face = meshDS->AddFace(nodes[v[0]], nodes[v[1]], nodes[v[2]]); + } + meshDS->SetMeshElementOnShape(face, topo_face); + } + } + } + delete nodes; + } + else { + cout << "decimesh is started" << endl; + system("decimesh"); + cout << "decimesh is finished" << endl; + + FILE* fic = fopen("x_h100.mesh", "r"); + char buf[200]; + do { + fscanf(fic, "%s\n", buf); + } + while (strcmp(buf, "Vertices")!=0); + int n_vtx; + fscanf(fic, "%d\n", &n_vtx); + cout << "number of vertices: " << n_vtx << endl; + + SMDS_MeshNode** nodes = new SMDS_MeshNode*[n_vtx+1]; + double coo_x, coo_y, coo_z; + for (int i=1; i<=n_vtx; i++) { + fscanf(fic, "%lf %lf %lf %*d\n", &coo_x, &coo_y, &coo_z); + nodes[i] = meshDS->AddNode(coo_x, coo_y, coo_z); + } + cout << "nodes are updated" << endl; + + fscanf(fic, "%*s\n"); + int n_tri, n1, n2, n3, iFace; + SMDS_MeshFace* face; + fscanf(fic, "%d\n", &n_tri); + cout << "number of triangles: " << n_tri << endl; + for (int i=0; iAddFace(nodes[n3], nodes[n2], nodes[n1]); + } + cout << "triangles are updated" << endl; + + char *keyWord; + fscanf(fic, "%s\n", keyWord); + cout << "keyWord : " << keyWord << endl; + int n_edges; + SMDS_MeshEdge* edge; + fscanf(fic, "%d\n", &n_edges); + cout << "number of edges: " << n_edges << endl; + for (int i=0; iAddEdge(nodes[n1], nodes[n2]); + //meshDS->SetMeshElementOnShape(edge, topo_edge); + } + cout << "edges are updated, and finished" << endl; + + fscanf(fic, "%s\n", keyWord); cout << "keyWord : " << keyWord << endl; + fscanf(fic, "%s\n", keyWord); cout << "keyWord : " << keyWord << endl; + fscanf(fic, "%s\n", keyWord); cout << "keyWord : " << keyWord << endl; + fscanf(fic, "%s\n", keyWord); cout << "keyWord : " << keyWord << endl; + fscanf(fic, "%s\n", keyWord); cout << "keyWord : " << keyWord << endl; + fscanf(fic, "%s\n", keyWord); cout << "keyWord : " << keyWord << endl; + + int number = fscanf(fic, "%lf %lf %*lf\n", &coo_x, &coo_y); + cout << "coo_x : " << coo_x << endl; + cout << "coo_y : " << coo_y << endl; + cout << "number : " << number << endl; + + fclose(fic); + } + + bool b = mesh.end(); + return(b); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +ostream & BLSURFPlugin_BLSURF::SaveTo(ostream & save) +{ + return save; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +istream & BLSURFPlugin_BLSURF::LoadFrom(istream & load) +{ + return load; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +ostream & operator << (ostream & save, BLSURFPlugin_BLSURF & hyp) +{ + return hyp.SaveTo( save ); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +istream & operator >> (istream & load, BLSURFPlugin_BLSURF & hyp) +{ + return hyp.LoadFrom( load ); +} diff --git a/src/BLSURFPlugin/BLSURFPlugin_BLSURF.hxx b/src/BLSURFPlugin/BLSURFPlugin_BLSURF.hxx new file mode 100644 index 0000000..fbd9fd0 --- /dev/null +++ b/src/BLSURFPlugin/BLSURFPlugin_BLSURF.hxx @@ -0,0 +1,69 @@ +// BLSURFPlugin : C++ implementation +// +// Copyright (C) 2006 OPEN CASCADE, CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// 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 : BLSURFPlugin_BLSURF.hxx +// Authors : Francis KLOSS (OCC) & Patrick LAUG (INRIA) & Lioka RAZAFINDRAZAKA (CEA) +// Date : 20/03/2006 +// Project : SALOME +//============================================================================= + +#ifndef _BLSURFPlugin_BLSURF_HXX_ +#define _BLSURFPlugin_BLSURF_HXX_ + +#include "SMESH_2D_Algo.hxx" +#include "SMESH_Mesh.hxx" +#include "Utils_SALOME_Exception.hxx" + +class BLSURFPlugin_Hypothesis; + +class BLSURFPlugin_BLSURF: public SMESH_2D_Algo { + public: + BLSURFPlugin_BLSURF(int hypId, int studyId, SMESH_Gen* gen); + + virtual ~BLSURFPlugin_BLSURF(); + + virtual bool CheckHypothesis(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape, + SMESH_Hypothesis::Hypothesis_Status& aStatus); + + void SetParameters(const BLSURFPlugin_Hypothesis* hyp); + + virtual bool Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape); + + ostream & SaveTo(ostream & save); + istream & LoadFrom(istream & load); + friend ostream & operator << (ostream & save, BLSURFPlugin_BLSURF & hyp); + friend istream & operator >> (istream & load, BLSURFPlugin_BLSURF & hyp); + + protected: + const BLSURFPlugin_Hypothesis* _hypothesis; + + private: + int _physicalMesh; + double _phySize; + int _geometricMesh; + double _angleMeshS; + double _gradation; + bool _quadAllowed; + bool _decimesh; +}; + +#endif diff --git a/src/BLSURFPlugin/BLSURFPlugin_BLSURF_i.cxx b/src/BLSURFPlugin/BLSURFPlugin_BLSURF_i.cxx new file mode 100644 index 0000000..f8d2cfc --- /dev/null +++ b/src/BLSURFPlugin/BLSURFPlugin_BLSURF_i.cxx @@ -0,0 +1,80 @@ +// BLSURFPlugin : idl implementation +// +// Copyright (C) 2006 OPEN CASCADE, CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// 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 : BLSURFPlugin_BLSURF_i.cxx +// Authors : Francis KLOSS (OCC) & Patrick LAUG (INRIA) +// Module : BLSURFPlugin + +using namespace std; +#include "BLSURFPlugin_BLSURF_i.hxx" +#include "SMESH_Gen.hxx" + +#include "Utils_CorbaException.hxx" +#include "utilities.h" + +//============================================================================= +/*! + * BLSURFPlugin_BLSURF_i::BLSURFPlugin_BLSURF_i + * + * Constructor + */ +//============================================================================= + +BLSURFPlugin_BLSURF_i::BLSURFPlugin_BLSURF_i( PortableServer::POA_ptr thePOA, + int theStudyId, + ::SMESH_Gen* theGenImpl ) + : SALOME::GenericObj_i( thePOA ), + SMESH_Hypothesis_i( thePOA ), + SMESH_Algo_i( thePOA ), + SMESH_2D_Algo_i( thePOA ) +{ + MESSAGE( "BLSURFPlugin_BLSURF_i::BLSURFPlugin_BLSURF_i" ); + myBaseImpl = new ::BLSURFPlugin_BLSURF( theGenImpl->GetANewId(), + theStudyId, + theGenImpl ); +} + +//============================================================================= +/*! + * BLSURFPlugin_BLSURF_i::~BLSURFPlugin_BLSURF_i + * + * Destructor + */ +//============================================================================= + +BLSURFPlugin_BLSURF_i::~BLSURFPlugin_BLSURF_i() +{ + MESSAGE( "BLSURFPlugin_BLSURF_i::~BLSURFPlugin_BLSURF_i" ); +} + +//============================================================================= +/*! + * BLSURFPlugin_BLSURF_i::GetImpl + * + * Get implementation + */ +//============================================================================= + +::BLSURFPlugin_BLSURF* BLSURFPlugin_BLSURF_i::GetImpl() +{ + MESSAGE( "BLSURFPlugin_BLSURF_i::GetImpl" ); + return ( ::BLSURFPlugin_BLSURF* )myBaseImpl; +} diff --git a/src/BLSURFPlugin/BLSURFPlugin_BLSURF_i.hxx b/src/BLSURFPlugin/BLSURFPlugin_BLSURF_i.hxx new file mode 100644 index 0000000..d078468 --- /dev/null +++ b/src/BLSURFPlugin/BLSURFPlugin_BLSURF_i.hxx @@ -0,0 +1,54 @@ +// BLSURFPlugin : idl implementation +// +// Copyright (C) 2006 OPEN CASCADE, CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// 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 : BLSURFPlugin_BLSURF_2D_i.hxx +// Authors : Francis KLOSS (OCC) & Patrick LAUG (INRIA) +// Module : BLSURFPlugin + +#ifndef _BLSURFPlugin_BLSURF_I_HXX_ +#define _BLSURFPlugin_BLSURF_I_HXX_ + +#include +#include CORBA_SERVER_HEADER(BLSURFPlugin_Algorithm) + +#include "SMESH_2D_Algo_i.hxx" +#include "BLSURFPlugin_BLSURF.hxx" + +// ====================================================== +// BLSUF 2d algorithm +// ====================================================== +class BLSURFPlugin_BLSURF_i: + public virtual POA_BLSURFPlugin::BLSURFPlugin_BLSURF, + public virtual SMESH_2D_Algo_i +{ +public: + // Constructor + BLSURFPlugin_BLSURF_i( PortableServer::POA_ptr thePOA, + int theStudyId, + ::SMESH_Gen* theGenImpl ); + // Destructor + virtual ~BLSURFPlugin_BLSURF_i(); + + // Get implementation + ::BLSURFPlugin_BLSURF* GetImpl(); +}; + +#endif diff --git a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.cxx b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.cxx new file mode 100644 index 0000000..df28210 --- /dev/null +++ b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.cxx @@ -0,0 +1,306 @@ +// BLSURFPlugin : C++ implementation +// +// Copyright (C) 2006 OPEN CASCADE, CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// 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 : BLSURFPlugin_Hypothesis.cxx +// Authors : Francis KLOSS (OCC) & Patrick LAUG (INRIA) & Lioka RAZAFINDRAZAKA (CEA) +// Date : 28/03/2006 +// Project : SALOME +//============================================================================= + +using namespace std; +#include +#include + +//============================================================================= +/*! + * + */ +//============================================================================= +BLSURFPlugin_Hypothesis::BLSURFPlugin_Hypothesis (int hypId, int studyId, + SMESH_Gen * gen) + : SMESH_Hypothesis(hypId, studyId, gen), + _physicalMesh(GetDefaultPhysicalMesh()), + _phySize(GetDefaultPhySize()), + _geometricMesh(GetDefaultGeometricMesh()), + _angleMeshS(GetDefaultAngleMeshS()), + _gradation(GetDefaultGradation()), + _quadAllowed(GetDefaultQuadAllowed()), + _decimesh(GetDefaultDecimesh()) +{ + _name = "BLSURF_Parameters"; + _param_algo_dim = 2; +} + +//============================================================================= +/*! + * + */ +//============================================================================= +void BLSURFPlugin_Hypothesis::SetPhysicalMesh(PhysicalMesh thePhysicalMesh) +{ + if (thePhysicalMesh != _physicalMesh) { + _physicalMesh = thePhysicalMesh; + switch( _physicalMesh ) { + case DefaultSize: + default: + _phySize = GetDefaultPhySize(); + break; + } + NotifySubMeshesHypothesisModification(); + } +} + +//============================================================================= +/*! + * + */ +//============================================================================= +void BLSURFPlugin_Hypothesis::SetPhySize(double theVal) +{ + if (theVal != _phySize) { + _phySize = theVal; + NotifySubMeshesHypothesisModification(); + } +} + +//============================================================================= +/*! + * + */ +//============================================================================= +void BLSURFPlugin_Hypothesis::SetGeometricMesh(GeometricMesh theGeometricMesh) +{ + if (theGeometricMesh != _geometricMesh) { + _geometricMesh = theGeometricMesh; + switch( _geometricMesh ) { + case DefaultGeom: + default: + _angleMeshS = GetDefaultAngleMeshS(); + _gradation = GetDefaultGradation(); + break; + } + NotifySubMeshesHypothesisModification(); + } +} + +//============================================================================= +/*! + * + */ +//============================================================================= +void BLSURFPlugin_Hypothesis::SetAngleMeshS(double theVal) +{ + if (theVal != _angleMeshS) { + _angleMeshS = theVal; + NotifySubMeshesHypothesisModification(); + } +} + +//============================================================================= +/*! + * + */ +//============================================================================= +void BLSURFPlugin_Hypothesis::SetGradation(double theVal) +{ + if (theVal != _gradation) { + _gradation = theVal; + NotifySubMeshesHypothesisModification(); + } +} + +//============================================================================= +/*! + * + */ +//============================================================================= +void BLSURFPlugin_Hypothesis::SetQuadAllowed(bool theVal) +{ + if (theVal != _quadAllowed) { + _quadAllowed = theVal; + NotifySubMeshesHypothesisModification(); + } +} + +//============================================================================= +/*! + * + */ +//============================================================================= +void BLSURFPlugin_Hypothesis::SetDecimesh(bool theVal) +{ + if (theVal != _decimesh) { + _decimesh = theVal; + NotifySubMeshesHypothesisModification(); + } +} + +//============================================================================= +/*! + * + */ +//============================================================================= +ostream & BLSURFPlugin_Hypothesis::SaveTo(ostream & save) +{ +// save << _maxSize << " " << _fineness; + +// if (_fineness == UserDefined) +// save << " " << _growthRate << " " << _nbSegPerEdge << " " << _nbSegPerRadius; + +// save << " " << (int)_secondOrder << " " << (int)_optimize; + + return save; +} + +//============================================================================= +/*! + * + */ +//============================================================================= +istream & BLSURFPlugin_Hypothesis::LoadFrom(istream & load) +{ +// bool isOK = true; +// int is; +// double val; + +// isOK = (load >> val); +// if (isOK) +// _maxSize = val; +// else +// load.clear(ios::badbit | load.rdstate()); + +// isOK = (load >> is); +// if (isOK) +// SetFineness((Fineness) is); +// else +// load.clear(ios::badbit | load.rdstate()); + +// if (_fineness == UserDefined) +// { +// isOK = (load >> val); +// if (isOK) +// _growthRate = val; +// else +// load.clear(ios::badbit | load.rdstate()); + +// isOK = (load >> val); +// if (isOK) +// _nbSegPerEdge = val; +// else +// load.clear(ios::badbit | load.rdstate()); + +// isOK = (load >> val); +// if (isOK) +// _nbSegPerRadius = val; +// else +// load.clear(ios::badbit | load.rdstate()); +// } + +// isOK = (load >> is); +// if (isOK) +// _secondOrder = (bool) is; +// else +// load.clear(ios::badbit | load.rdstate()); + +// isOK = (load >> is); +// if (isOK) +// _optimize = (bool) is; +// else +// load.clear(ios::badbit | load.rdstate()); + return load; +} + +//============================================================================= +/*! + * + */ +//============================================================================= +ostream & operator <<(ostream & save, BLSURFPlugin_Hypothesis & hyp) +{ + return hyp.SaveTo( save ); +} + +//============================================================================= +/*! + * + */ +//============================================================================= +istream & operator >>(istream & load, BLSURFPlugin_Hypothesis & hyp) +{ + return hyp.LoadFrom( load ); +} + + +//================================================================================ +/*! + * \brief Does nothing + * \param theMesh - the built mesh + * \param theShape - the geometry of interest + * \retval bool - always false + */ +//================================================================================ +bool BLSURFPlugin_Hypothesis::SetParametersByMesh(const SMESH_Mesh* theMesh, + const TopoDS_Shape& theShape) +{ + return false; +} + +//============================================================================= +BLSURFPlugin_Hypothesis::PhysicalMesh BLSURFPlugin_Hypothesis::GetDefaultPhysicalMesh() +{ + return PhysicalUserDefined; +} + +//============================================================================= +double BLSURFPlugin_Hypothesis::GetDefaultPhySize() +{ + return 10; +} + +//============================================================================= +BLSURFPlugin_Hypothesis::GeometricMesh BLSURFPlugin_Hypothesis::GetDefaultGeometricMesh() +{ + return DefaultGeom; +} + +//============================================================================= +double BLSURFPlugin_Hypothesis::GetDefaultAngleMeshS() +{ + return 8; +} + +//============================================================================= +double BLSURFPlugin_Hypothesis::GetDefaultGradation() +{ + return 1.1; +} + +//============================================================================= +bool BLSURFPlugin_Hypothesis::GetDefaultQuadAllowed() +{ + return false; +} + +//============================================================================= +bool BLSURFPlugin_Hypothesis::GetDefaultDecimesh() +{ + return false; +} diff --git a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.hxx b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.hxx new file mode 100644 index 0000000..89d1030 --- /dev/null +++ b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.hxx @@ -0,0 +1,105 @@ +// BLSURFPlugin : C++ implementation +// +// Copyright (C) 2006 OPEN CASCADE, CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// 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 : BLSURFPlugin_Hypothesis.hxx +// Authors : Francis KLOSS (OCC) & Patrick LAUG (INRIA) & Lioka RAZAFINDRAZAKA (CEA) +// Date : 27/03/2006 +// Project : SALOME +// $Header$ +//============================================================================= + +#ifndef _BLSURFPlugin_Hypothesis_HXX_ +#define _BLSURFPlugin_Hypothesis_HXX_ + +#include "SMESH_Hypothesis.hxx" +#include "Utils_SALOME_Exception.hxx" + +// Parameters for work of BLSURF + +class BLSURFPlugin_Hypothesis: public SMESH_Hypothesis +{ +public: + BLSURFPlugin_Hypothesis(int hypId, int studyId, SMESH_Gen * gen); + + enum PhysicalMesh { + DefaultSize, + PhysicalUserDefined + }; + + enum GeometricMesh { + DefaultGeom, + UserDefined + }; + + void SetPhysicalMesh(PhysicalMesh thePhysicalMesh); + PhysicalMesh GetPhysicalMesh() const { return _physicalMesh; } + + void SetPhySize(double thePhySize); + double GetPhySize() const { return _phySize; } + + void SetGeometricMesh(GeometricMesh theGeometricMesh); + GeometricMesh GetGeometricMesh() const { return _geometricMesh; } + + void SetAngleMeshS(double theAngle); + double GetAngleMeshS() const { return _angleMeshS; } + + void SetGradation(double theGradation); + double GetGradation() const { return _gradation; } + + void SetQuadAllowed(bool theVal); + bool GetQuadAllowed() const { return _quadAllowed; } + + void SetDecimesh(bool theVal); + bool GetDecimesh() const { return _decimesh; } + + static PhysicalMesh GetDefaultPhysicalMesh(); + static double GetDefaultPhySize(); + static GeometricMesh GetDefaultGeometricMesh(); + static double GetDefaultAngleMeshS(); + static double GetDefaultGradation(); + static bool GetDefaultQuadAllowed(); + static bool GetDefaultDecimesh(); + + // Persistence + virtual ostream & SaveTo(ostream & save); + virtual istream & LoadFrom(istream & load); + friend ostream & operator <<(ostream & save, BLSURFPlugin_Hypothesis & hyp); + friend istream & operator >>(istream & load, BLSURFPlugin_Hypothesis & hyp); + + /*! + * \brief Does nothing + * \param theMesh - the built mesh + * \param theShape - the geometry of interest + * \retval bool - always false + */ + virtual bool SetParametersByMesh(const SMESH_Mesh* theMesh, const TopoDS_Shape& theShape); + +private: + PhysicalMesh _physicalMesh; + double _phySize; + GeometricMesh _geometricMesh; + double _angleMeshS; + double _gradation; + bool _quadAllowed; + bool _decimesh; +}; + +#endif diff --git a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.cxx b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.cxx new file mode 100644 index 0000000..873492b --- /dev/null +++ b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.cxx @@ -0,0 +1,298 @@ +// BLSURFPlugin : C++ implementation +// +// Copyright (C) 2006 OPEN CASCADE, CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// 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 : BLSURFPlugin_Hypothesis_i.cxx +// Authors : Francis KLOSS (OCC) & Patrick LAUG (INRIA) & Lioka RAZAFINDRAZAKA (CEA) +// Date : 03/04/2006 +// Project : SALOME +//============================================================================= +using namespace std; + +#include "BLSURFPlugin_Hypothesis_i.hxx" +#include "SMESH_Gen.hxx" +#include "SMESH_PythonDump.hxx" + +#include "Utils_CorbaException.hxx" +#include "utilities.h" + +//============================================================================= +/*! + * BLSURFPlugin_Hypothesis_i::BLSURFPlugin_Hypothesis_i + * + * Constructor + */ +//============================================================================= +BLSURFPlugin_Hypothesis_i:: +BLSURFPlugin_Hypothesis_i (PortableServer::POA_ptr thePOA, + int theStudyId, + ::SMESH_Gen* theGenImpl) + : SALOME::GenericObj_i( thePOA ), + SMESH_Hypothesis_i( thePOA ) +{ + MESSAGE( "BLSURFPlugin_Hypothesis_i::BLSURFPlugin_Hypothesis_i" ); + myBaseImpl = new ::BLSURFPlugin_Hypothesis (theGenImpl->GetANewId(), + theStudyId, + theGenImpl); +} + +//============================================================================= +/*! + * BLSURFPlugin_Hypothesis_i::~BLSURFPlugin_Hypothesis_i + * + * Destructor + */ +//============================================================================= +BLSURFPlugin_Hypothesis_i::~BLSURFPlugin_Hypothesis_i() +{ + MESSAGE( "BLSURFPlugin_Hypothesis_i::~BLSURFPlugin_Hypothesis_i" ); +} + +//============================================================================= +/*! + * BLSURFPlugin_Hypothesis_i::SetPhysicalMesh + * + * Set PhysicalMesh + */ + +//============================================================================= +void BLSURFPlugin_Hypothesis_i::SetPhysicalMesh (CORBA::Long theValue) +{ + // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPhysicalMesh"); + ASSERT(myBaseImpl); + this->GetImpl()->SetPhysicalMesh((::BLSURFPlugin_Hypothesis::PhysicalMesh)theValue); + SMESH::TPythonDump() << _this() << ".SetPhysicalMesh( " << theValue << " )"; +} + +//============================================================================= +/*! + * BLSURFPlugin_Hypothesis_i::GetPhysicalMesh + * + * Get PhysicalMesh + */ +//============================================================================= +CORBA::Long BLSURFPlugin_Hypothesis_i::GetPhysicalMesh() +{ + // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPhysicalMesh"); + ASSERT(myBaseImpl); + return this->GetImpl()->GetPhysicalMesh(); +} + +//============================================================================= +/*! + * BLSURFPlugin_Hypothesis_i::SetPhySize + * + * Set PhySize + */ +//============================================================================= +void BLSURFPlugin_Hypothesis_i::SetPhySize (CORBA::Double theValue) +{ + // MESSAGE("BLSURFPlugin_Hypothesis_i::SetPhySize"); + ASSERT(myBaseImpl); + this->GetImpl()->SetPhySize(theValue); + SMESH::TPythonDump() << _this() << ".SetPhySize( " << theValue << " )"; +} + +//============================================================================= +/*! + * BLSURFPlugin_Hypothesis_i::GetPhySize + * + * Get PhySize + */ +//============================================================================= +CORBA::Double BLSURFPlugin_Hypothesis_i::GetPhySize() +{ + // MESSAGE("BLSURFPlugin_Hypothesis_i::GetPhySize"); + ASSERT(myBaseImpl); + return this->GetImpl()->GetPhySize(); +} + +//============================================================================= +/*! + * BLSURFPlugin_Hypothesis_i::SetGeometricMesh + * + * Set GeometricMesh + */ + +//============================================================================= +void BLSURFPlugin_Hypothesis_i::SetGeometricMesh (CORBA::Long theValue) +{ + // MESSAGE("BLSURFPlugin_Hypothesis_i::SetGeometricMesh"); + ASSERT(myBaseImpl); + this->GetImpl()->SetGeometricMesh((::BLSURFPlugin_Hypothesis::GeometricMesh)theValue); + SMESH::TPythonDump() << _this() << ".SetGeometricMesh( " << theValue << " )"; +} + +//============================================================================= +/*! + * BLSURFPlugin_Hypothesis_i::GetGeometricMesh + * + * Get GeometricMesh + */ +//============================================================================= +CORBA::Long BLSURFPlugin_Hypothesis_i::GetGeometricMesh() +{ + // MESSAGE("BLSURFPlugin_Hypothesis_i::GetGeometricMesh"); + ASSERT(myBaseImpl); + return this->GetImpl()->GetGeometricMesh(); +} + +//============================================================================= +/*! + * BLSURFPlugin_Hypothesis_i::SetAngleMeshS + * + * Set AngleMeshS + */ +//============================================================================= +void BLSURFPlugin_Hypothesis_i::SetAngleMeshS (CORBA::Double theValue) +{ + // MESSAGE("BLSURFPlugin_Hypothesis_i::SetAngleMeshS"); + ASSERT(myBaseImpl); + this->GetImpl()->SetAngleMeshS(theValue); + SMESH::TPythonDump() << _this() << ".SetAngleMeshS( " << theValue << " )"; +} + +//============================================================================= +/*! + * BLSURFPlugin_Hypothesis_i::GetAngleMeshS + * + * Get AngleMeshS + */ +//============================================================================= +CORBA::Double BLSURFPlugin_Hypothesis_i::GetAngleMeshS() +{ + // MESSAGE("BLSURFPlugin_Hypothesis_i::GetAngleMeshS"); + ASSERT(myBaseImpl); + return this->GetImpl()->GetAngleMeshS(); +} + +//============================================================================= +/*! + * BLSURFPlugin_Hypothesis_i::SetGradation + * + * Set Gradation + */ +//============================================================================= +void BLSURFPlugin_Hypothesis_i::SetGradation (CORBA::Double theValue) +{ + // MESSAGE("BLSURFPlugin_Hypothesis_i::SetGradation"); + ASSERT(myBaseImpl); + this->GetImpl()->SetGradation(theValue); + SMESH::TPythonDump() << _this() << ".SetGradation( " << theValue << " )"; +} + +//============================================================================= +/*! + * BLSURFPlugin_Hypothesis_i::GetGradation + * + * Get Gradation + */ +//============================================================================= +CORBA::Double BLSURFPlugin_Hypothesis_i::GetGradation() +{ + // MESSAGE("BLSURFPlugin_Hypothesis_i::GetGradation"); + ASSERT(myBaseImpl); + return this->GetImpl()->GetGradation(); +} + +//============================================================================= +/*! + * BLSURFPlugin_Hypothesis_i::SetQuadAllowed + * + * Set true or false + */ +//============================================================================= +void BLSURFPlugin_Hypothesis_i::SetQuadAllowed (CORBA::Boolean theValue) +{ + // MESSAGE("BLSURFPlugin_Hypothesis_i::SetQuadAllowed"); + ASSERT(myBaseImpl); + this->GetImpl()->SetQuadAllowed(theValue); + SMESH::TPythonDump() << _this() << ".SetQuadAllowed( " << theValue << " )"; +} + +//============================================================================= +/*! + * BLSURFPlugin_Hypothesis_i::GetQuadAllowed + * + * Get true or false + */ +//============================================================================= +CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetQuadAllowed() +{ + // MESSAGE("BLSURFPlugin_Hypothesis_i::GetQuadAllowed"); + ASSERT(myBaseImpl); + return this->GetImpl()->GetQuadAllowed(); +} + +//============================================================================= +/*! + * BLSURFPlugin_Hypothesis_i::SetDecimesh + * + * Set true or false + */ +//============================================================================= +void BLSURFPlugin_Hypothesis_i::SetDecimesh (CORBA::Boolean theValue) +{ + // MESSAGE("BLSURFPlugin_Hypothesis_i::SetDecimesh"); + ASSERT(myBaseImpl); + this->GetImpl()->SetDecimesh(theValue); + SMESH::TPythonDump() << _this() << ".SetDecimesh( " << theValue << " )"; +} + +//============================================================================= +/*! + * BLSURFPlugin_Hypothesis_i::GetDecimesh + * + * Get true or false + */ +//============================================================================= +CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetDecimesh() +{ + // MESSAGE("BLSURFPlugin_Hypothesis_i::GetDecimesh"); + ASSERT(myBaseImpl); + return this->GetImpl()->GetDecimesh(); +} + +//============================================================================= +/*! + * BLSURFPlugin_Hypothesis_i::GetImpl + * + * Get implementation + */ +//============================================================================= +::BLSURFPlugin_Hypothesis* BLSURFPlugin_Hypothesis_i::GetImpl() +{ + // MESSAGE("BLSURFPlugin_Hypothesis_i::GetImpl"); + return (::BLSURFPlugin_Hypothesis*)myBaseImpl; +} + +//================================================================================ +/*! + * \brief Verify whether hypothesis supports given entity type + * \param type - dimension (see SMESH::Dimension enumeration) + * \retval CORBA::Boolean - TRUE if dimension is supported, FALSE otherwise + * + * Verify whether hypothesis supports given entity type (see SMESH::Dimension enumeration) + */ +//================================================================================ +CORBA::Boolean BLSURFPlugin_Hypothesis_i::IsDimSupported( SMESH::Dimension type ) +{ + return type == SMESH::DIM_2D; +} diff --git a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.hxx b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.hxx new file mode 100644 index 0000000..0f3c536 --- /dev/null +++ b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.hxx @@ -0,0 +1,81 @@ +// BLSURFPlugin : C++ implementation +// +// Copyright (C) 2006 OPEN CASCADE, CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// 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 : BLSURFPlugin_Hypothesis_i.hxx +// Authors : Francis KLOSS (OCC) & Patrick LAUG (INRIA) & Lioka RAZAFINDRAZAKA (CEA) +// Date : 03/04/2006 +// Project : SALOME +//============================================================================= + +#ifndef _BLSURFPlugin_Hypothesis_i_HXX_ +#define _BLSURFPlugin_Hypothesis_i_HXX_ + +#include +#include CORBA_SERVER_HEADER(BLSURFPlugin_Algorithm) + +#include "SMESH_Hypothesis_i.hxx" +#include "BLSURFPlugin_Hypothesis.hxx" + +class SMESH_Gen; + +// BLSURFPlugin parameters hypothesis + +class BLSURFPlugin_Hypothesis_i: + public virtual POA_BLSURFPlugin::BLSURFPlugin_Hypothesis, + public virtual SMESH_Hypothesis_i +{ + public: + // Constructor + BLSURFPlugin_Hypothesis_i (PortableServer::POA_ptr thePOA, + int theStudyId, + ::SMESH_Gen* theGenImpl); + // Destructor + virtual ~BLSURFPlugin_Hypothesis_i(); + + void SetPhysicalMesh(CORBA::Long theValue); + CORBA::Long GetPhysicalMesh(); + + void SetPhySize(CORBA::Double theValue); + CORBA::Double GetPhySize(); + + void SetGeometricMesh(CORBA::Long theValue); + CORBA::Long GetGeometricMesh(); + + void SetAngleMeshS(CORBA::Double theValue); + CORBA::Double GetAngleMeshS(); + + void SetGradation(CORBA::Double theValue); + CORBA::Double GetGradation(); + + void SetQuadAllowed(CORBA::Boolean theValue); + CORBA::Boolean GetQuadAllowed(); + + void SetDecimesh(CORBA::Boolean theValue); + CORBA::Boolean GetDecimesh(); + + // Get implementation + ::BLSURFPlugin_Hypothesis* GetImpl(); + + // Verify whether hypothesis supports given entity type + CORBA::Boolean IsDimSupported( SMESH::Dimension type ); +}; + +#endif diff --git a/src/BLSURFPlugin/BLSURFPlugin_i.cxx b/src/BLSURFPlugin/BLSURFPlugin_i.cxx new file mode 100644 index 0000000..6ffe80c --- /dev/null +++ b/src/BLSURFPlugin/BLSURFPlugin_i.cxx @@ -0,0 +1,64 @@ +// SMESH BLSURFPlugin : implementaion of SMESH idl descriptions +// +// 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 : BLSURFPlugin_i.cxx +// Authors : Francis KLOSS (OCC) & Patrick LAUG (INRIA) +// Module : SMESH + +using namespace std; +#include "utilities.h" + +#include "BLSURFPlugin_BLSURF_i.hxx" +#include "BLSURFPlugin_Hypothesis_i.hxx" + +template class BLSURFPlugin_Creator_i:public HypothesisCreator_i +{ + // as we have 'module BLSURFPlugin' in BLSURFPlugin_Algorithm.idl + virtual std::string GetModuleName() { return "BLSURFPlugin"; } +}; + +//============================================================================= +/*! + * + */ +//============================================================================= + +extern "C" +{ + GenericHypothesisCreator_i* GetHypothesisCreator (const char* aHypName) + { + MESSAGE("GetHypothesisCreator " << aHypName); + + GenericHypothesisCreator_i* aCreator = 0; + + // Algorithms + if (strcmp(aHypName, "BLSURF") == 0) + aCreator = new BLSURFPlugin_Creator_i; + // Hypotheses + else if (strcmp(aHypName, "BLSURF_Parameters") == 0) + aCreator = new BLSURFPlugin_Creator_i; + else ; + + return aCreator; + } +} diff --git a/src/BLSURFPlugin/Makefile.in b/src/BLSURFPlugin/Makefile.in new file mode 100644 index 0000000..8c179f4 --- /dev/null +++ b/src/BLSURFPlugin/Makefile.in @@ -0,0 +1,61 @@ +# Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS, L3S, LJLL, MENSI +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ +# +# -* Makefile *- +# +# Author : Edward AGAPOV (OCC) +# Module : BLSURFPLUGIN +# Date : 10/01/2004 +# +# + +# source path +top_srcdir=@top_srcdir@ +top_builddir=../.. +srcdir=@srcdir@ +VPATH=.:@srcdir@:@top_srcdir@/idl:$(top_builddir)/idl:${KERNEL_ROOT_DIR}/idl/salome:${GUI_ROOT_DIR}/idl/salome:${GEOM_ROOT_DIR}/idl/salome:${SMESH_ROOT_DIR}/idl/salome:${MED_ROOT_DIR}/idl/salome + +@COMMENCE@ + +LIB_SRC = \ + BLSURFPlugin_BLSURF.cxx \ + BLSURFPlugin_BLSURF_i.cxx \ + BLSURFPlugin_Hypothesis.cxx \ + BLSURFPlugin_Hypothesis_i.cxx \ + BLSURFPlugin_i.cxx \ + cad_occ.cxx + +LIB_SERVER_IDL = BLSURFPlugin_Algorithm.idl + +LIB_CLIENT_IDL = \ + SALOME_Component.idl \ + SALOME_Comm.idl \ + GEOM_Gen.idl \ + MED.idl + +# Libraries targets +LIB = libBLSURFEngine.la + +BLSURF_INCLUDES = @BLSURF_INCLUDES@ +BLSURF_LIBS = "@BLSURF_LIBS@" +CPPFLAGS += $(BLSURF_INCLUDES) +CXXFLAGS += $(BLSURF_INCLUDES) +LDFLAGS += $(BLSURF_LIBS) + +@CONCLUDE@ diff --git a/src/BLSURFPlugin/cad_occ.cxx b/src/BLSURFPlugin/cad_occ.cxx new file mode 100644 index 0000000..0a3c04c --- /dev/null +++ b/src/BLSURFPlugin/cad_occ.cxx @@ -0,0 +1,588 @@ +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// File : BLSURFlugin_Mesher.cxx +// Authors : Francis KLOSS (OCC) & Patrick LAUG (INRIA) +// Date : 31/03/2006 +// Project : SALOME +//============================================================================= +// using namespace std; + +// #include "BLSURFPlugin_Mesher.hxx" +// #include "BLSURFPlugin_Hypothesis.hxx" + +// #include +// #include +// #include +// #include + +// #include + +// #include +// #include +// #include +// #include +// #include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define TSMO blw->bls_glo.tsmo + +bool BL_SURF::init(const TopoDS_Shape& _shape) { + cout << "BLSURF_init: begin" << endl; + + if (_shape.ShapeType() == TopAbs_COMPOUND) { + cout << "BLSURF_init: the shape is a COMPOUND" << endl; + } else { + cout << "BLSURF_init: the shape is UNKNOWN" << endl; + } + + cout << "BLSURF_init: exploring faces and edges " << endl; + int i=0; + for (TopExp_Explorer expf(_shape, TopAbs_FACE); expf.More(); expf.Next()) { + const TopoDS_Shape& face = expf.Current(); + i++; + int j=0; + for (TopExp_Explorer expe(face, TopAbs_EDGE); expe.More(); expe.Next()) { + // const TopoDS_Shape& edge = expe.Current(); -> warning: unused variable 'edge' + j++; + } + // cout << "BLSURF_init: face " << i << " has " << j << " edges" << endl; + } + cout << "BLSURF_init: total number of faces = " << i << endl; + + TopoDS_Shape the_shape; + the_shape = _shape; + + // return(true); + return(run(the_shape)); +} + +// #define TC2D blw.bls_glo.TC2dNew + +void BL_SURF::get_blw(blw_*& blw_param) { + blw_param = &blw; +} + +bool BL_SURF::end() { + bls_free(&blw); + if (blw.error[0]) { + return(false); + } else { + return(true); + } +} + +double norm(vector v) +{ + double res=0.; + for (int i=0;i operator-(vector v1, vector v2) +{ + assert(v1.size()==v2.size()); + vector res(v1.size(),0.); + for (int i=0;ibuild()) { + surfaces.push_back(bl_surface); + } else { + cout<<"Weird surface detected !"<Value(t); + C[0]=P.X(); C[1]=P.Y(); +} + +void BL_EDGE::method_curv1(const double &t, double *C) +{ + gp_Vec2d V1; + + V1=parametric_geometry->DN(t,1); + C[0]=V1.X(); C[1]=V1.Y(); +} + +void BL_EDGE::method_curv2(const double &t, double *C) +{ + gp_Vec2d V2; + + V2=parametric_geometry->DN(t,2); + C[0]=V2.X(); C[1]=V2.Y(); +} + +void BL_SURFACE::method_surf0(const double *UV, double *S) +{ + gp_Pnt P; + + P=geometry->Value(UV[0],UV[1]); // S.D0(U,V,P); + S[0]=P.X(); S[1]=P.Y(); S[2]=P.Z(); +} + +void BL_SURFACE::method_surf1(const double *UV, double *Su, double *Sv) +{ + gp_Pnt P; + gp_Vec D1U,D1V; + + geometry->D1(UV[0],UV[1],P,D1U,D1V); + Su[0]=D1U.X(); Su[1]=D1U.Y(); Su[2]=D1U.Z(); + Sv[0]=D1V.X(); Sv[1]=D1V.Y(); Sv[2]=D1V.Z(); +} + +void BL_SURFACE::method_surf2(const double *UV, double *Suu, double *Suv, double *Svv) +{ + gp_Pnt P; + gp_Vec D1U,D1V; + gp_Vec D2U,D2V,D2UV; + + geometry->D2(UV[0],UV[1],P,D1U,D1V,D2U,D2V,D2UV); + Suu[0]=D2U.X(); Suu[1]=D2U.Y(); Suu[2]=D2U.Z(); + Suv[0]=D2UV.X(); Suv[1]=D2UV.Y(); Suv[2]=D2UV.Z(); + Svv[0]=D2V.X(); Svv[1]=D2V.Y(); Svv[2]=D2V.Z(); +} + +static vector *current_list_of_faces=NULL; +BL_SURF* BL_SURF::active_blsurf=NULL; + +void cad_surf0 (blw_ *blw, int *refs, double *uv, double *S) +{ + BL_SURFACE *surf=(*current_list_of_faces)[*refs-1]; + surf->method_surf0(uv,S); +} + +void cad_surf1 (blw_ *blw, int *refs, double *uv, double *Su, double *Sv) +{ + BL_SURFACE *surf=(*current_list_of_faces)[*refs-1]; + surf->method_surf1(uv,Su,Sv); +} + +// calcul discret +// double du, dv, uvg[2], uvd[2], uvb[2], uvh[2], Sg[3], Sd[3], Sb[3], Sh[3]; +// double Sucont[3], Svcont[3]; +// if (*refs == 33) { +// Sucont[0] = Su[0]; Sucont[1] = Su[1]; Sucont[2] = Su[2]; +// Svcont[0] = Sv[0]; Svcont[1] = Sv[1]; Svcont[2] = Sv[2]; +// BL_SURFACE *surf=(*current_list_of_faces)[*refs-1]; +// du = (TSMO[*refs].uvmax[0] - TSMO[*refs].uvmin[0]) * 0.08; +// dv = (TSMO[*refs].uvmax[1] - TSMO[*refs].uvmin[1]) * 0.08; +// uvg[0] = uv[0]-du; +// uvg[1] = uv[1]; +// uvd[0] = uv[0]+du; +// uvd[1] = uv[1]; +// uvb[0] = uv[0]; +// uvb[1] = uv[1]-dv; +// uvh[0] = uv[0]; +// uvh[1] = uv[1]+dv; +// if (uvg[0] < TSMO[*refs].uvmin[0]) uvg[0] = TSMO[*refs].uvmin[0]; +// if (uvd[0] > TSMO[*refs].uvmax[0]) uvd[0] = TSMO[*refs].uvmax[0]; +// if (uvb[1] < TSMO[*refs].uvmin[1]) uvb[1] = TSMO[*refs].uvmin[1]; +// if (uvh[1] > TSMO[*refs].uvmax[1]) uvh[1] = TSMO[*refs].uvmax[1]; +// surf->method_surf0(uvg,Sg); +// surf->method_surf0(uvd,Sd); +// surf->method_surf0(uvb,Sb); +// surf->method_surf0(uvh,Sh); +// du = uvd[0] - uvg[0]; +// dv = uvh[1] - uvb[1]; +// Su[0] = (Sd[0] - Sg[0]) / du; +// Su[1] = (Sd[1] - Sg[1]) / du; +// Su[2] = (Sd[2] - Sg[2]) / du; +// Sv[0] = (Sh[0] - Sb[0]) / dv; +// Sv[1] = (Sh[1] - Sb[1]) / dv; +// Sv[2] = (Sh[2] - Sb[2]) / dv; +// fprintf(blw->out, "Su cont %g %g %g\n", Sucont[0], Sucont[1], Sucont[2]); +// fprintf(blw->out, "Su disc %g %g %g\n", Su[0], Su[1], Su[2]); +// fprintf(blw->out, "Sv cont %g %g %g\n", Svcont[0], Svcont[1], Svcont[2]); +// fprintf(blw->out, "Sv disc %g %g %g\n", Sv[0], Sv[1], Sv[2]); +// } + +void cad_surf2 (blw_ *blw, int *refs, double uv[2], double Suu[3], double Suv[3], double Svv[3]) +{ + BL_SURFACE *surf=(*current_list_of_faces)[*refs-1]; + surf->method_surf2(uv,Suu,Suv,Svv); + +// // calcul discret +// double du, dv, uvg[2], uvd[2], uvb[2], uvh[2], Sug[3], Sud[3], Sub[3], Suh[3], Svg[3], Svd[3], Svb[3], Svh[3]; +// double Suucont[3], Suvcont[3], Svvcont[3]; +// if (*refs >= 0) { +// Suucont[0] = Suu[0]; Suucont[1] = Suu[1]; Suucont[2] = Suu[2]; +// Suvcont[0] = Suv[0]; Suvcont[1] = Suv[1]; Suvcont[2] = Suv[2]; +// Svvcont[0] = Svv[0]; Svvcont[1] = Svv[1]; Svvcont[2] = Svv[2]; +// du = (TSMO[*refs].uvmax[0] - TSMO[*refs].uvmin[0]) * 0.08; +// dv = (TSMO[*refs].uvmax[1] - TSMO[*refs].uvmin[1]) * 0.08; +// uvg[0] = uv[0]-du; +// uvg[1] = uv[1]; +// uvd[0] = uv[0]+du; +// uvd[1] = uv[1]; +// uvb[0] = uv[0]; +// uvb[1] = uv[1]-dv; +// uvh[0] = uv[0]; +// uvh[1] = uv[1]+dv; +// if (uvg[0] < TSMO[*refs].uvmin[0]) uvg[0] = TSMO[*refs].uvmin[0]; +// if (uvd[0] > TSMO[*refs].uvmax[0]) uvd[0] = TSMO[*refs].uvmax[0]; +// if (uvb[1] < TSMO[*refs].uvmin[1]) uvb[1] = TSMO[*refs].uvmin[1]; +// if (uvh[1] > TSMO[*refs].uvmax[1]) uvh[1] = TSMO[*refs].uvmax[1]; +// surf->method_surf1(uvg,Sug,Svg); +// surf->method_surf1(uvd,Sud,Svd); +// surf->method_surf1(uvb,Sub,Svb); +// surf->method_surf1(uvh,Suh,Svh); +// du = uvd[0] - uvg[0]; +// dv = uvh[1] - uvb[1]; +// Suu[0] = (Sud[0] - Sug[0]) / du; +// Suu[1] = (Sud[1] - Sug[1]) / du; +// Suu[2] = (Sud[2] - Sug[2]) / du; +// Svv[0] = (Svh[0] - Svb[0]) / dv; +// Svv[1] = (Svh[1] - Svb[1]) / dv; +// Svv[2] = (Svh[2] - Svb[2]) / dv; +// Suv[0] = ((Suh[0] - Sub[0]) / dv + (Svd[0] - Svg[0]) / du) * 0.5; +// Suv[1] = ((Suh[1] - Sub[1]) / dv + (Svd[1] - Svg[1]) / du) * 0.5; +// Suv[2] = ((Suh[2] - Sub[2]) / dv + (Svd[2] - Svg[2]) / du) * 0.5; +// // fprintf(blw->out, "disc uv %g %g Suu %g %g %g\n", uv[0], uv[1], Suu[0], Suu[1], Suu[2]); +// // fprintf(blw->out, "Suv disc %g %g %g\n", Suv[0], Suv[1], Suv[2]); +// // fprintf(blw->out, "Svv disc %g %g %g\n", Svv[0], Svv[1], Svv[2]); +// } +} + +void cad_curvint (blw_ *blw, int *refs, int *ic, double *a, double *b) +{ + *a=(*current_list_of_faces)[*refs-1]->edges[*ic-1]->parametric_min; + *b=(*current_list_of_faces)[*refs-1]->edges[*ic-1]->parametric_max; +} + +void cad_curv0 (blw_ *blw, int *refs, int *ic, double *t, double *C) +{ + (*current_list_of_faces)[*refs-1]->edges[*ic-1]->method_curv0(*t,C); +} + +void cad_curv1 (blw_ *blw, int *refs, int *ic, double *t, double *Ct) +{ + (*current_list_of_faces)[*refs-1]->edges[*ic-1]->method_curv1(*t,Ct); +} + +void cad_curv2 (blw_ *blw, int *refs, int *ic, double *t, double *Ctt) +{ + (*current_list_of_faces)[*refs-1]->edges[*ic-1]->method_curv2(*t,Ctt); +} + +void cad_hphys (blw_ *blw, int *refs, double *uv, double *h) {} +void cad_hphyc (blw_ *blw, int *refs, int *ic, double *t, double *h) {} +void cad_hphyp (blw_ *blw, int *refp, double *h) {} + +void cad_rads (blw_ *blw, int *refs, double *uv, double *rhos) { + sprintf(blw->error, "cad_rads should not be called\n"); +} + +void cad_radc (blw_ *blw, int *refs, int *ic, double *t, double *rhoc) { + sprintf(blw->error, "cad_radc should not be called"); +} + +void cad_hageos(blw_ *blw, int *refs, double uv[2], double hageos[6]) { + sprintf(blw->error, "cad_hageos should not be called\n"); +} + +void cad_refphyc(blw_ *blw, int *refc, int *phyc) { + *phyc = *refc; +} + +void cad_refphyp(blw_ *blw, int *refp, int *phyp) { + *phyp = *refp; +} + +void cad_refphys(blw_ *blw, int *refs, int *phys) { + *phys = *refs; +} + +void cad_edgetag(blw_ *blw, int *refc, int *required) { + *required = 1; +} + +void cad_curvparam(blw_ *blw, int *refs, int *ic, int *n, double tab[]) { + *n = 0; +} + +void BL_SURF::init_tsmo(blw_ *blw) { /* cf. bls_read_pardom */ + int is, ns, ic, nc, j, igloP, igloQ, isurf; + TopoDS_Vertex v; + gp_Pnt p; + double a, b, uv[2], xyz[3], xyzP[3], xyzQ[3]; + + ns = surfaces.size(); + if (blw->env.verb >= 10) fprintf(blw->out, "\ninit_tsmo: %d surfaces\n", ns); + if (ns <= 0) { + TSMO = NULL; + blw->bls_glo.number_of_patches = 0; + return; + } + + TopTools_IndexedMapOfShape fmap_edges; + TopTools_IndexedMapOfShape fmap_points; + fmap_edges.Clear(); + fmap_points.Clear(); + for (isurf=0; isurftopology; + for (TopExp_Explorer ex_face(face ,TopAbs_EDGE); ex_face.More(); ex_face.Next()) { + TopoDS_Edge e = TopoDS::Edge(ex_face.Current()); + if (fmap_edges.FindIndex(e) <= 0) { /* not found => FindIndex = 0, found => FindIndex > 0 */ + fmap_edges.Add(e); + j = 0; + for (TopExp_Explorer ex_edge(e ,TopAbs_VERTEX); ex_edge.More(); ex_edge.Next()) { + v = TopoDS::Vertex(ex_edge.Current()); + ++j; + if (fmap_points.FindIndex(v) <= 0) fmap_points.Add(v); + } + if (j != 2) { + sprintf(blw->error, "init_tsmo: surface is=%d: an edge has %d != 2 extremities\n", isurf+1, j); return; + } + } + } + } + + MALLOC(surface_, TSMO, ns+1); if (blw->error[0]) return; + blw->bls_glo.number_of_patches = ns; + for (isurf=0; isurfedges.size(); + if (blw->env.verb >= 70) fprintf(blw->out, "init_tsmo: surface is=%d: %d curves\n", is, nc); + + bls_init_surface(blw, &(TSMO[is]), nc); + TSMO[is].iglos = is; + TSMO[is].pardom_side = 0; + TSMO[is].surforient = +1; + for (int icurv=0;icurvedges[icurv]; + TopoDS_Edge edge = curve->topology; + TSMO[is].TC[ic].igloc = fmap_edges.FindIndex(edge); + + TopExp_Explorer ex_edge(edge, TopAbs_VERTEX); + v = TopoDS::Vertex(ex_edge.Current()); + p = BRep_Tool::Pnt(v); + xyzP[0] = p.X(); xyzP[1] = p.Y(); xyzP[2] = p.Z(); + igloP = fmap_points.FindIndex(v); + + ex_edge.Next(); + v = TopoDS::Vertex(ex_edge.Current()); + p = BRep_Tool::Pnt(v); + xyzQ[0] = p.X(); xyzQ[1] = p.Y(); xyzQ[2] = p.Z(); + igloQ = fmap_points.FindIndex(v); + + cad_curvint (blw, &is, &ic, &a, &b); + cad_curv0 (blw, &is, &ic, &a, uv); + cad_surf0 (blw, &is, uv, xyz); + xyzP[0] -= xyz[0]; xyzP[1] -= xyz[1]; xyzP[2] -= xyz[2]; + xyzQ[0] -= xyz[0]; xyzQ[1] -= xyz[1]; xyzQ[2] -= xyz[2]; + if (NORM3DPOW2(xyzP) <= NORM3DPOW2(xyzQ)) { + TSMO[is].TC[ic].iglope[0] = igloP; + TSMO[is].TC[ic].iglope[1] = igloQ; + } else { + TSMO[is].TC[ic].iglope[0] = igloQ; + TSMO[is].TC[ic].iglope[1] = igloP; + } + } + } +} + +int BL_SURF::bls_main(blw_ *blw) { + FILE *file; + + /* banner */ + blw->out = stdout; + bls_banner(blw, 1); + + /* initialiser l'environnement de BLSURF */ + init_blsenv(blw); + + /* lire l'environnement de BLSURF */ + /* par defaut : strcpy(blw->dirname, ""); */ + /* sinon : strcpy(blw->dirname, "C:\\Documents and Settings\\xxx\\"); */ + sprintf(blw->filename, "%sblsurf.env", blw->dirname); + FOPEN(file, "r"); + if (blw->error[0]) { + fprintf(blw->out, "File blsurf.env not found. Default values will be used.\n"); + blw->error[0] = 0; + } else { + read_blsenv(blw, file); + FCLOSE(file); + if (blw->error[0]) goto error; /* read_blsenv: unknown keyword */ + } + + /* copier les variables communes entre "bl2denv" et blsenv (en particulier verb) */ + copy_common_env(blw); + + /* imprimer l'environnement de BLSURF */ + if (blw->env.verb >= 70) print_blsenv(blw); + + /* initialiser TSMO */ + current_list_of_faces = &surfaces; + BL_SURF::init_tsmo(blw); if (blw->error[0]) goto error; + + /* generer le maillage surfacique */ + bls_init(blw); if (blw->error[0]) goto error; + bls_mesh(blw); if (blw->error[0]) goto error; + bls_surforient(blw); if (blw->error[0]) goto error; + bls_export(blw); if (blw->error[0]) goto error; + /* a voir : les tableaux pointes par current_list_of_faces sont liberes ? handles ? */ + + bls_banner(blw, 2); + return(0); + + error: + fprintf(blw->out, "\nBLSURF ERROR MESSAGE:\n%s\n", blw->error); + bls_banner(blw, 2); + return(1); +} diff --git a/src/BLSURFPlugin/cad_occ.h b/src/BLSURFPlugin/cad_occ.h new file mode 100644 index 0000000..67766f0 --- /dev/null +++ b/src/BLSURFPlugin/cad_occ.h @@ -0,0 +1,188 @@ +#ifndef __BL_SURF__ +#define __BL_SURF__ + +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include + +class BL_SURFACE; +class BL_CURVE_SIZER; +class BL_SURFACE_SIZER; +class BL_POINT_SIZER; + +class BL_EDGE +{ + public : + Handle(Geom2d_Curve) parametric_geometry; + Handle(Geom_Curve) space_geometry; + TopoDS_Edge topology; + BL_SURFACE *boss; + BL_CURVE_SIZER *sizer; + bool splitted_closed; + int splitted_part; + vector P1,P2,MP; + string name; + int i_P1,i_P2; + int typc,refc; + + double parametric_min,parametric_max; + double space_min,space_max; + + BL_EDGE(TopoDS_Edge&,BL_SURFACE*,Handle(Geom2d_Curve),double,double); + ~BL_EDGE(); + + bool verification(); + + void method_curv0(const double&, double*); + void method_curv1(const double&, double*); + void method_curv2(const double&, double*); +}; + +class BL_POINT { + public : + BL_POINT_SIZER *sizer; + BL_SURFACE *boss; + double u,v; + + BL_POINT() { u=v=0.; boss=NULL; sizer=NULL; } + BL_POINT(BL_SURFACE *b, double du, double dv) { u=du; v=dv; boss=b; sizer=NULL; } + BL_POINT(double du, double dv) { u=du; v=dv; boss=NULL; sizer=NULL; } + ~BL_POINT() { } + + BL_POINT& operator=(BL_POINT p) { u=p.u; v=p.v; return(*this); } + bool operator==(BL_POINT p) { return((u==p.u)&&(v==p.v)); } +}; + +class BL_SURFACE { + public : + Handle(Geom_Surface) geometry; + TopoDS_Face topology; + bool to_delete; + + BL_SURFACE_SIZER *sizer; + vector edges; + vector points; + + BL_SURFACE(TopoDS_Face&); + ~BL_SURFACE(); + + bool build(); + bool verification(); + + void method_surf0(double const*, double*); + void method_surf1(double const*, double*, double*); + void method_surf2(double const*, double*, double*, double*); + + bool add(TopoDS_Edge&); + void add(double u, double v); +}; + +class BL_SURF +{ + protected: + + // void build_blsurf_data_file(); + void init_tsmo(blw_ *blw); + int bls_main(blw_ *blw); + + // void set_reference_points(); + void build_surfaces(TopoDS_Shape&); + // void build_from_occ_references(TopoDS_Shape&); + + void analyse_identical_faces(); + + public: + static BL_SURF *active_blsurf; + TopoDS_Shape the_object; + + vector all_edges; + vector surfaces; + + vector internal_points; + vector internal_face_points; + + vector internal_edges; + vector internal_faces; + + vector conforming_source_face; + vector conforming_dest_face; + + vector< vector* > faces_to_merge; + vector< vector* > vertices_tags; + vector< vector* > edges_tags; + + // string blsurf_fname; + // bool mesh_2D, auto_merge, use_occ_refs; + + // enum WHAT_MESH { SURFACE_MESH=0, VOLUME_MESH=1 }; + // enum MESH_ORDER { LINEAR=0, QUADRATIC=1 }; + + blw_ blw; + // int auto_connectivity; + // int Verbosity; + // int hphy_flag; + // int hinterpol_flag,hmean_flag; + // int eps_glue_flag,eps_ends_flag,eps_collapse_flag; + // double eps_glue,eps_ends,eps_collapse,shockmax; + // double angle_mesh,angle_smo; + // WHAT_MESH WhatMesh; + // MESH_ORDER MeshOrder; + // int ComponentToMesh; + + // double Pmin,Pmax; + // double Gmin,Gmax; + // vector Poptions; // Goptions + + // vector remaining_faces; + + BL_SURF() { + // Verbosity=25; + // hphy_flag=0; + // hinterpol_flag=0; + // hmean_flag=0; + // auto_connectivity=1; // PL valait 0 + // use_occ_refs=false; + // Poptions.resize(1); Poptions[0]=0; + // WhatMesh=SURFACE_MESH; + // MeshOrder=LINEAR; + // mesh_2D=false; + // eps_glue=eps_ends=eps_collapse=1e-8; + // eps_glue_flag=eps_ends_flag=eps_collapse_flag=0; + // shockmax=1.e100; + // blsurf_fname=""; + // auto_merge=false; + // ComponentToMesh=0; + // angle_mesh=8.; angle_smo=1.; + } + ~BL_SURF() { } + + bool init(const TopoDS_Shape&); + // int vertices(double*&); + void get_blw(blw_*&); + // int number_of_patches(); + // bool all_triangles(); + // void face_mesh(int is, int*& F, int*& FRef, int*& iglops, int& nF, int& ndom, int& surforient); + bool end(); + + bool run(TopoDS_Shape&); + bool run(); + void reset(); +}; + +#endif + +// PL Gmin, Gmax, hgeo_flag, Goptions ont deja ete elimines +// PL hphy_flag, Poptions, ... sont a eliminer aussi +// bls.Gmin=0.01; +// bls.Gmax=1000; +// bls.hgeo_flag=1; +// bls.Goptions[0]=1; diff --git a/src/GUI/BLSURFPluginGUI.cxx b/src/GUI/BLSURFPluginGUI.cxx new file mode 100755 index 0000000..f16fb52 --- /dev/null +++ b/src/GUI/BLSURFPluginGUI.cxx @@ -0,0 +1,43 @@ +// BLSURFPlugin GUI: GUI for plugged-in mesher BLSURFPlugin +// +// Copyright (C) 2003 CEA +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org or email : webmaster.salome@opencascade.org +// +// +// +// File : BLSURFPluginGUI.cxx +// Authors : Francis KLOSS (OCC) & Patrick LAUG (INRIA) +// Module : BLSURFPlugin + +#include "BLSURFPluginGUI_HypothesisCreator.h" + +//============================================================================= +/*! GetHypothesisCreator + * + */ +//============================================================================= +extern "C" +{ + SMESHGUI_GenericHypothesisCreator* GetHypothesisCreator( const QString& aHypType ) + { + SMESHGUI_GenericHypothesisCreator* aCreator = NULL; + if( aHypType=="BLSURF_Parameters" ) + aCreator = new BLSURFPluginGUI_HypothesisCreator( aHypType ); + return aCreator; + } +} diff --git a/src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx b/src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx new file mode 100644 index 0000000..5f3e0a9 --- /dev/null +++ b/src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx @@ -0,0 +1,314 @@ +// BLSURFPlugin GUI: GUI for plugged-in mesher BLSURFPlugin +// +// Copyright (C) 2003 CEA +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org or email : webmaster.salome@opencascade.org +// +// +// +// File : BLSURFPluginGUI_HypothesisCreator.cxx +// Authors : Francis KLOSS (OCC) & Patrick LAUG (INRIA) & Lioka RAZAFINDRAZAKA (CEA) +// Module : BLSURFPlugin +// $Header: + +#include "BLSURFPluginGUI_HypothesisCreator.h" + +#include +#include + +#include CORBA_SERVER_HEADER(BLSURFPlugin_Algorithm) + +#include + +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +enum PhysicalMesh + { + DefaultSize, + PhysicalUserDefined + }; + +enum GeometricMesh + { + DefaultGeom, + UserDefined + }; + +BLSURFPluginGUI_HypothesisCreator::BLSURFPluginGUI_HypothesisCreator( const QString& theHypType ) +: SMESHGUI_GenericHypothesisCreator( theHypType ), + myIs2D(true) +{ +} + +BLSURFPluginGUI_HypothesisCreator::~BLSURFPluginGUI_HypothesisCreator() +{ +} + +bool BLSURFPluginGUI_HypothesisCreator::checkParams() const +{ + BlsurfHypothesisData data_old, data_new; + readParamsFromHypo( data_old ); + readParamsFromWidgets( data_new ); + bool res = storeParamsToHypo( data_new ); + return res; +} + +QFrame* BLSURFPluginGUI_HypothesisCreator::buildFrame() +{ + QFrame* fr = new QFrame( 0, "myframe" ); + QVBoxLayout* lay = new QVBoxLayout( fr, 5, 0 ); + + QGroupBox* GroupC1 = new QGroupBox( 2, Qt::Horizontal, fr, "GroupC1" ); + lay->addWidget( GroupC1 ); + + GroupC1->setTitle( tr( "SMESH_ARGUMENTS" ) ); + GroupC1->layout()->setSpacing( 6 ); + GroupC1->layout()->setMargin( 11 ); + + myName = 0; + if( isCreation() ) { + new QLabel( tr( "SMESH_NAME" ), GroupC1 ); + myName = new QLineEdit( GroupC1 ); + } + + new QLabel( tr( "BLSURF_PHY_MESH" ), GroupC1 ); + myPhysicalMesh = new QtxComboBox( GroupC1 ); + QStringList physicalTypes; + physicalTypes.append( QObject::tr( "BLSURF_DEFAULT_USER" ) ); + physicalTypes.append( QObject::tr( "BLSURF_CUSTOM_USER" ) ); + myPhysicalMesh->insertStringList( physicalTypes ); + + new QLabel( tr( "BLSURF_HPHYDEF" ), GroupC1 ); + myPhySize = new QtxDblSpinBox( GroupC1 ); + myPhySize->setMinValue( 1e-02 ); + myPhySize->setMaxValue( 1e+02 ); + myPhySize->setLineStep( 1 ); + + new QLabel( tr( "BLSURF_GEOM_MESH" ), GroupC1 ); + myGeometricMesh = new QtxComboBox( GroupC1 ); + QStringList types; + types.append( QObject::tr( "BLSURF_DEFAULT_GEOM" ) ); + types.append( QObject::tr( "BLSURF_CUSTOM_GEOM" ) ); + myGeometricMesh->insertStringList( types ); + +// new QLabel( tr( "BLSURF_GROWTH_RATE" ), GroupC1 ); +// myGrowthRate = new QtxDblSpinBox( GroupC1 ); +// myGrowthRate->setMinValue( 0.1 ); +// myGrowthRate->setMaxValue( 10 ); +// myGrowthRate->setLineStep( 0.1 ); + + new QLabel( tr( "BLSURF_ANGLE_MESH_S" ), GroupC1 ); + myAngleMeshS = new QtxDblSpinBox( GroupC1 ); + myAngleMeshS->setMinValue( 0 ); + myAngleMeshS->setMaxValue( 16 ); + myAngleMeshS->setLineStep( 0.5 ); + + new QLabel( tr( "BLSURF_GRADATION" ), GroupC1 ); + myGradation = new QtxDblSpinBox( GroupC1 ); + myGradation->setMinValue( 1.1 ); + myGradation->setMaxValue( 1.5 ); + myGradation->setLineStep( 0.1 ); + +// new QLabel( tr( "BLSURF_SEG_PER_RADIUS" ), GroupC1 ); +// myNbSegPerRadius = new QtxDblSpinBox( GroupC1 ); +// myNbSegPerRadius->setMinValue( 0.2 ); +// myNbSegPerRadius->setMaxValue( 5.0 ); + + myAllowQuadrangles = new QCheckBox( tr( "BLSURF_ALLOW_QUADRANGLES" ), GroupC1 ); + GroupC1->addSpace(0); +// myIs2D = true; + + myDecimesh = new QCheckBox( tr( "BLSURF_DECIMESH" ), GroupC1 ); + GroupC1->addSpace(0); + + connect( myGeometricMesh, SIGNAL( activated( int ) ), this, SLOT( onGeometricMeshChanged() ) ); + connect( myPhysicalMesh, SIGNAL( activated( int ) ), this, SLOT( onPhysicalMeshChanged() ) ); + + return fr; +} + +void BLSURFPluginGUI_HypothesisCreator::retrieveParams() const +{ + BlsurfHypothesisData data; + readParamsFromHypo( data ); + + if( myName ) + myName->setText( data.myName ); + myPhysicalMesh->setCurrentItem( data.myPhysicalMesh ); + myPhySize->setValue( data.myPhySize ); + myGeometricMesh->setCurrentItem( data.myGeometricMesh ); + myAngleMeshS->setValue( data.myAngleMeshS); + myGradation->setValue( data.myGradation); + myAllowQuadrangles->setChecked( data.myAllowQuadrangles ); + myDecimesh->setChecked( data.myDecimesh ); + + // update widgets + + bool isPhysicalCustom = (myPhysicalMesh->currentItem() == PhysicalUserDefined); + myPhySize->setEnabled(isPhysicalCustom); + + bool isCustom = (myGeometricMesh->currentItem() == UserDefined); + myAngleMeshS->setEnabled(isCustom); + myGradation->setEnabled(isCustom); +} + +QString BLSURFPluginGUI_HypothesisCreator::storeParams() const +{ + BlsurfHypothesisData data; + readParamsFromWidgets( data ); + storeParamsToHypo( data ); + + QString guiHyp; + guiHyp += tr("BLSURF_PHY_MESH") + " = " + QString::number( data.myPhysicalMesh ) + "; "; + guiHyp += tr("BLSURF_HPHYDEF") + " = " + QString::number( data.myPhySize ) + "; "; + guiHyp += tr("BLSURF_GEOM_MESH") + " = " + QString::number( data.myGeometricMesh ) + "; "; + guiHyp += tr("BLSURF_ANGLE_MESH_S") + " = " + QString::number( data.myAngleMeshS ) + "; "; + guiHyp += tr("BLSURF_GRADATION") + " = " + QString::number( data.myGradation ) + "; "; + guiHyp += tr("BLSURF_ALLOW_QUADRANGLES") + " = " + QString(data.myAllowQuadrangles ? "yes" : "no") + "; "; + guiHyp += tr("BLSURF_DECIMESH") + " = " + QString(data.myDecimesh ? "yes" : "no") + "; "; + + cout << "guiHyp : " << guiHyp << endl; + + return guiHyp; +} + +bool BLSURFPluginGUI_HypothesisCreator::readParamsFromHypo( BlsurfHypothesisData& h_data ) const +{ + BLSURFPlugin::BLSURFPlugin_Hypothesis_var h = + BLSURFPlugin::BLSURFPlugin_Hypothesis::_narrow( initParamsHypothesis() ); + + HypothesisData* data = SMESH::GetHypothesisData( hypType() ); + h_data.myName = isCreation() && data ? data->Label : ""; + + h_data.myPhysicalMesh = (int) h->GetPhysicalMesh(); + h_data.myPhySize = h->GetPhySize(); + h_data.myGeometricMesh = (int) h->GetGeometricMesh(); + h_data.myAngleMeshS = h->GetAngleMeshS(); + h_data.myGradation = h->GetGradation(); + h_data.myAllowQuadrangles = h->GetQuadAllowed(); + h_data.myDecimesh = h->GetDecimesh(); + + return true; +} + +bool BLSURFPluginGUI_HypothesisCreator::storeParamsToHypo( const BlsurfHypothesisData& h_data ) const +{ + BLSURFPlugin::BLSURFPlugin_Hypothesis_var h = + BLSURFPlugin::BLSURFPlugin_Hypothesis::_narrow( hypothesis() ); + + bool ok = true; + try + { + if( isCreation() ) + SMESH::SetName( SMESH::FindSObject( h ), h_data.myName.latin1() ); + + h->SetPhysicalMesh( (int) h_data.myPhysicalMesh ); + h->SetPhySize( h_data.myPhySize ); + h->SetGeometricMesh( (int) h_data.myGeometricMesh ); + h->SetGradation( h_data.myGradation ); + h->SetQuadAllowed( h_data.myAllowQuadrangles ); + h->SetDecimesh( h_data.myDecimesh ); + + if( (int) h_data.myPhysicalMesh == PhysicalUserDefined ) + h->SetPhySize( h_data.myPhySize ); + + if( (int) h_data.myGeometricMesh == UserDefined ) + h->SetAngleMeshS( h_data.myAngleMeshS ); + } + catch(const SALOME::SALOME_Exception& ex) + { + SalomeApp_Tools::QtCatchCorbaException(ex); + ok = false; + } + return ok; +} + +bool BLSURFPluginGUI_HypothesisCreator::readParamsFromWidgets( BlsurfHypothesisData& h_data ) const +{ + h_data.myName = myName ? myName->text() : ""; + h_data.myPhysicalMesh = myPhysicalMesh->currentItem(); + h_data.myPhySize = myPhySize->value(); + h_data.myGeometricMesh = myGeometricMesh->currentItem(); + h_data.myAngleMeshS = myAngleMeshS->value(); + h_data.myGradation = myGradation->value(); + h_data.myAllowQuadrangles = myAllowQuadrangles->isChecked(); + h_data.myDecimesh = myDecimesh->isChecked(); + + return true; +} + +void BLSURFPluginGUI_HypothesisCreator::onPhysicalMeshChanged() { + bool isCustom = (myPhysicalMesh->currentItem() == PhysicalUserDefined); + myPhySize->setEnabled(isCustom); + + if ( ! isCustom ) { + double aPhySize; + switch( myPhysicalMesh->currentItem() ) { + case DefaultSize: + default: + aPhySize = 10; + break; + } + myPhySize->setValue( aPhySize ); + } +} + +void BLSURFPluginGUI_HypothesisCreator::onGeometricMeshChanged() { + bool isCustom = (myGeometricMesh->currentItem() == UserDefined); + myAngleMeshS->setEnabled(isCustom); + myGradation->setEnabled(isCustom); + + if ( ! isCustom ) { + double aAngleMeshS, aGradation; + switch( myGeometricMesh->currentItem() ) { + case DefaultGeom: + default: + aAngleMeshS = 8; + aGradation = 1.1; + break; + } + myAngleMeshS->setValue( aAngleMeshS ); + myGradation->setValue( aGradation ); + } +} + +QString BLSURFPluginGUI_HypothesisCreator::caption() const +{ + return tr( QString( "BLSURF_%1_TITLE" ).arg(myIs2D?QString("2D"):QString("3D")) ); +} + +QPixmap BLSURFPluginGUI_HypothesisCreator::icon() const +{ + QString hypIconName = tr( QString("ICON_DLG_BLSURF_PARAMETERS%1").arg(myIs2D?QString(""):QString("")) ); + return SUIT_Session::session()->resourceMgr()->loadPixmap( "BLSURFPlugin", hypIconName ); +} + +QString BLSURFPluginGUI_HypothesisCreator::type() const +{ + return tr( QString( "BLSURF_%1_HYPOTHESIS" ).arg(myIs2D?QString("2D"):QString("3D")) ); +} diff --git a/src/GUI/BLSURFPluginGUI_HypothesisCreator.h b/src/GUI/BLSURFPluginGUI_HypothesisCreator.h new file mode 100644 index 0000000..7a393ee --- /dev/null +++ b/src/GUI/BLSURFPluginGUI_HypothesisCreator.h @@ -0,0 +1,93 @@ +// BLSURFPlugin GUI: GUI for plugged-in mesher BLSURFPlugin +// +// Copyright (C) 2003 CEA +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org or email : webmaster.salome@opencascade.org +// +// +// +// File : BLSURFPluginGUI_HypothesisCreator.h +// Authors : Francis KLOSS (OCC) & Patrick LAUG (INRIA) & Lioka RAZAFINDRAZAKA (CEA) +// Module : BLSURFPlugin +// $Header: + +#ifndef BLSURFPLUGINGUI_HypothesisCreator_HeaderFile +#define BLSURFPLUGINGUI_HypothesisCreator_HeaderFile + +#include + +class QtxDblSpinBox; +class QtxComboBox; +class QCheckBox; +class QLineEdit; + +typedef struct +{ + int myPhysicalMesh, myGeometricMesh; + double myPhySize, myAngleMeshS, myGradation; + bool myAllowQuadrangles, myDecimesh; + QString myName; +} BlsurfHypothesisData; + +/*! + * \brief Class for creation of BLSURF hypotheses +*/ + +class BLSURFPlugin_Hypothesis; + +class BLSURFPluginGUI_HypothesisCreator : public SMESHGUI_GenericHypothesisCreator +{ + Q_OBJECT + +public: + BLSURFPluginGUI_HypothesisCreator( const QString& ); + virtual ~BLSURFPluginGUI_HypothesisCreator(); + + virtual bool checkParams() const; + +protected: + virtual QFrame* buildFrame (); + virtual void retrieveParams() const; + virtual QString storeParams () const; + + virtual QString caption() const; + virtual QPixmap icon() const; + virtual QString type() const; + +protected slots: + virtual void onPhysicalMeshChanged(); + virtual void onGeometricMeshChanged(); + +private: + bool readParamsFromHypo( BlsurfHypothesisData& ) const; + bool readParamsFromWidgets( BlsurfHypothesisData& ) const; + bool storeParamsToHypo( const BlsurfHypothesisData& ) const; + +private: + QLineEdit* myName; + QtxComboBox* myPhysicalMesh; + QtxDblSpinBox* myPhySize; + QtxComboBox* myGeometricMesh; + QtxDblSpinBox* myAngleMeshS; + QtxDblSpinBox* myGradation; + QCheckBox* myAllowQuadrangles; + QCheckBox* myDecimesh; + + bool myIs2D; +}; + +#endif diff --git a/src/GUI/BLSURFPlugin_images.po b/src/GUI/BLSURFPlugin_images.po new file mode 100755 index 0000000..56fcee0 --- /dev/null +++ b/src/GUI/BLSURFPlugin_images.po @@ -0,0 +1,59 @@ +# Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS, L3S, LJLL, MENSI +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ +# +# This is a Qt message file in .po format. Each msgid starts with +# a scope. This scope should *NOT* be translated - eg. "Foo::Bar" +# would be translated to "Pub", not "Foo::Pub". +msgid "" +msgstr "" +"Project-Id-Version: PROJECT VERSION\n" +"POT-Creation-Date: 2002-05-28 10:57:43 AM CEST\n" +"PO-Revision-Date: YYYY-MM-DD\n" +"Last-Translator: FULLNAME \n" +"Content-Type: text/plain; charset=iso-8859-1\n" + + +#----------------------------------------------------------- +# Hypothesis +#----------------------------------------------------------- + +msgid "ICON_DLG_BLSURF_PARAMETERS" +msgstr "mesh_hypo_BLSURF.png" + +msgid "ICON_DLG_BLSURF_PARAMETERS_2D" +msgstr "mesh_hypo_BLSURF.png" + +#----------------------------------------------------------- +# ObjectBrowser +#----------------------------------------------------------- + +msgid "ICON_SMESH_TREE_ALGO_BLSURF_3D" +msgstr "mesh_tree_algo_tetra.png" + +msgid "ICON_SMESH_TREE_ALGO_BLSURF_2D" +msgstr "mesh_tree_algo_BLSURF.png" + +msgid "ICON_SMESH_TREE_ALGO_BLSURF_2D3D" +msgstr "mesh_tree_algo_BLSURF.png" + +msgid "ICON_SMESH_TREE_HYPO_BLSURF_Parameters" +msgstr "mesh_tree_hypo_BLSURF.png" + +msgid "ICON_SMESH_TREE_HYPO_BLSURF_Parameters_2D" +msgstr "mesh_tree_hypo_BLSURF.png" diff --git a/src/GUI/BLSURFPlugin_msg_en.po b/src/GUI/BLSURFPlugin_msg_en.po new file mode 100755 index 0000000..0fe902b --- /dev/null +++ b/src/GUI/BLSURFPlugin_msg_en.po @@ -0,0 +1,78 @@ +# Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS, L3S, LJLL, MENSI +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ +# +# This is a Qt message file in .po format. Each msgid starts with +# a scope. This scope should *NOT* be translated - eg. "Foo::Bar" +# would be translated to "Pub", not "Foo::Pub". +// +// File : BLSURFPlugin_msg_en.po +// Authors : Francis KLOSS (OCC) & Patrick LAUG (INRIA) & Lioka RAZAFINDRAZAKA (CEA) +// Date : 28/03/2006 +// Project : SALOME +//============================================================================= + +msgid "" +msgstr "" +"Project-Id-Version: PROJECT VERSION\n" +"POT-Creation-Date: 2002-05-28 10:46:48 AM CEST\n" +"PO-Revision-Date: YYYY-MM-DD\n" +"Last-Translator: FULLNAME \n" +"Content-Type: text/plain; charset=iso-8859-1\n" + +msgid "BLSURF_2D_HYPOTHESIS" +msgstr "BLSURF 2D" + +msgid "BLSURF_PHY_MESH" +msgstr "Physical Mesh" + +msgid "BLSURF_DEFAULT_USER" +msgstr "Default" + +msgid "BLSURF_CUSTOM_USER" +msgstr "Custom" + +msgid "BLSURF_HPHYDEF" +msgstr "User Size" + +msgid "BLSURF_GEOM_MESH" +msgstr "Geometrical Mesh" + +msgid "BLSURF_DEFAULT_GEOM" +msgstr "Default" + +msgid "BLSURF_CUSTOM_GEOM" +msgstr "Custom" + +msgid "BLSURF_ANGLE_MESH_S" +msgstr "Angle Mesh S" + +msgid "BLSURF_GRADATION" +msgstr "Gradation" + +msgid "BLSURF_DECIMESH" +msgstr "Decimesh" + +msgid "BLSURF_ALLOW_QUADRANGLES" +msgstr "Allow Quadrangles" + +msgid "BLSURF_2D_TITLE" +msgstr "Hypothesis Construction" + +msgid "BLSURF_3D_TITLE" +msgstr "Hypothesis Construction" diff --git a/src/GUI/Makefile.in b/src/GUI/Makefile.in new file mode 100644 index 0000000..229ea57 --- /dev/null +++ b/src/GUI/Makefile.in @@ -0,0 +1,73 @@ +# Copyright (C) 2005 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS, L3S, LJLL, MENSI +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ +# +# File : Makefile.in +// Authors : Francis KLOSS (OCC) & Patrick LAUG (INRIA) +# Module : BLSURFPLUGIN + +top_srcdir=@top_srcdir@ +top_builddir=../.. +srcdir=@srcdir@ +VPATH=.:@srcdir@:@top_srcdir@/idl:$(top_builddir)/idl:${KERNEL_ROOT_DIR}/idl/salome:${GUI_ROOT_DIR}/idl/salome:${GEOM_ROOT_DIR}/idl/salome:${SMESH_ROOT_DIR}/idl/salome:${MED_ROOT_DIR}/idl/salome + +@COMMENCE@ + +# .po files to transform in .qm +PO_FILES = \ + BLSURFPlugin_images.po \ + BLSURFPlugin_msg_en.po + +# Libraries targets +LIB = libBLSURFPluginGUI.la + +LIB_SRC = \ + BLSURFPluginGUI.cxx \ + BLSURFPluginGUI_HypothesisCreator.cxx + +LIB_MOC = \ + BLSURFPluginGUI_HypothesisCreator.h + +LIB_CLIENT_IDL = \ + SALOME_Exception.idl \ + SALOME_GenericObj.idl \ + SALOME_Component.idl \ + SALOME_Comm.idl \ + GEOM_Gen.idl \ + MED.idl \ + SMESH_Gen.idl \ + SMESH_Mesh.idl \ + SMESH_Group.idl \ + BLSURFPlugin_Algorithm.idl + +LIB_SERVER_IDL = + +# additionnal information to compil and link file + +CPPFLAGS += $(QT_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) \ + -I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome \ + -I${GEOM_ROOT_DIR}/include/salome -I${SMESH_ROOT_DIR}/include/salome \ + $(BOOST_CPPFLAGS) +CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome \ + -I${GEOM_ROOT_DIR}/include/salome -I${SMESH_ROOT_DIR}/include/salome + +LDFLAGS += -lSMESH $(OCC_KERNEL_LIBS) -L${KERNEL_ROOT_DIR}/lib/salome \ + -L${GUI_ROOT_DIR}/lib/salome -L${GEOM_ROOT_DIR}/lib/salome \ + -L${SMESH_ROOT_DIR}/lib/salome + +@CONCLUDE@ diff --git a/src/Makefile.in b/src/Makefile.in new file mode 100644 index 0000000..eb2857b --- /dev/null +++ b/src/Makefile.in @@ -0,0 +1,35 @@ +# 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 : Makefile.in +# Author : Patrick GOLDBRONN (CEA) +# Module : SMESH + +top_srcdir=@top_srcdir@ +top_builddir=.. +srcdir=@srcdir@ +VPATH=.:@srcdir@ + +@COMMENCE@ + +SUBDIRS = BLSURFPlugin GUI + +@MODULE@