From 0b959120c59670d73c0a1f6d46bfa72a6ceb49cf Mon Sep 17 00:00:00 2001 From: nri Date: Mon, 19 May 2003 13:18:36 +0000 Subject: [PATCH] NRI : First integration. --- Makefile.in | 145 ++ build_configure | 206 +++ configure.in.base | 366 +++++ idl/Makefile.in | 76 + idl/SMESH_BasicHypothesis.idl | 64 + idl/SMESH_Gen.idl | 96 ++ idl/SMESH_Hypothesis.idl | 71 + idl/SMESH_Mesh.idl | 262 ++++ resources/ModuleMesh.png | Bin 0 -> 2629 bytes resources/SMESHCatalog.xml | 169 ++ resources/SMESH_en.xml | 246 +++ resources/SMESH_fr.xml | 246 +++ resources/delete.png | Bin 0 -> 943 bytes resources/mesh.png | Bin 0 -> 319 bytes resources/mesh_add_sub.png | Bin 0 -> 408 bytes resources/mesh_algo_hexa.png | Bin 0 -> 371 bytes resources/mesh_algo_mefisto.png | Bin 0 -> 556 bytes resources/mesh_algo_quad.png | Bin 0 -> 493 bytes resources/mesh_algo_regular.png | Bin 0 -> 581 bytes resources/mesh_angle.png | Bin 0 -> 369 bytes resources/mesh_area.png | Bin 0 -> 340 bytes resources/mesh_aspect.png | Bin 0 -> 419 bytes resources/mesh_compute.png | Bin 0 -> 826 bytes resources/mesh_connectivity.png | Bin 0 -> 346 bytes resources/mesh_diagonal.png | Bin 0 -> 435 bytes resources/mesh_edit.png | Bin 0 -> 547 bytes resources/mesh_hexa.png | Bin 0 -> 296 bytes resources/mesh_hexa_n.png | Bin 0 -> 681 bytes resources/mesh_hypo_area.png | Bin 0 -> 536 bytes resources/mesh_hypo_length.png | Bin 0 -> 641 bytes resources/mesh_hypo_segment.png | Bin 0 -> 610 bytes resources/mesh_hypo_volume.png | Bin 0 -> 376 bytes resources/mesh_info.png | Bin 0 -> 254 bytes resources/mesh_init.png | Bin 0 -> 420 bytes resources/mesh_length.png | Bin 0 -> 342 bytes resources/mesh_line.png | Bin 0 -> 164 bytes resources/mesh_line_n.png | Bin 0 -> 363 bytes resources/mesh_move_node.png | Bin 0 -> 285 bytes resources/mesh_orientation.png | Bin 0 -> 351 bytes resources/mesh_pyramid.png | Bin 0 -> 278 bytes resources/mesh_pyramid_n.png | Bin 0 -> 621 bytes resources/mesh_quad.png | Bin 0 -> 214 bytes resources/mesh_quad_n.png | Bin 0 -> 512 bytes resources/mesh_rem_element.png | Bin 0 -> 313 bytes resources/mesh_rem_node.png | Bin 0 -> 225 bytes resources/mesh_set_algo.png | Bin 0 -> 263 bytes resources/mesh_set_hypo.png | Bin 0 -> 235 bytes resources/mesh_shading.png | Bin 0 -> 352 bytes resources/mesh_shrink.png | Bin 0 -> 483 bytes resources/mesh_skew.png | Bin 0 -> 351 bytes resources/mesh_taper.png | Bin 0 -> 393 bytes resources/mesh_tetra.png | Bin 0 -> 267 bytes resources/mesh_tetra_n.png | Bin 0 -> 585 bytes resources/mesh_tree_algo.png | Bin 0 -> 169 bytes resources/mesh_tree_algo_hexa.png | Bin 0 -> 148 bytes resources/mesh_tree_algo_mefisto.png | Bin 0 -> 182 bytes resources/mesh_tree_algo_quad.png | Bin 0 -> 161 bytes resources/mesh_tree_algo_regular.png | Bin 0 -> 134 bytes resources/mesh_tree_hypo.png | Bin 0 -> 153 bytes resources/mesh_tree_hypo_area.png | Bin 0 -> 163 bytes resources/mesh_tree_hypo_length.png | Bin 0 -> 153 bytes resources/mesh_tree_hypo_segment.png | Bin 0 -> 142 bytes resources/mesh_tree_hypo_volume.png | Bin 0 -> 159 bytes resources/mesh_tree_mesh.png | Bin 0 -> 186 bytes resources/mesh_tree_mesh_warn.png | Bin 0 -> 166 bytes resources/mesh_triangle.png | Bin 0 -> 215 bytes resources/mesh_triangle_n.png | Bin 0 -> 446 bytes resources/mesh_update.png | Bin 0 -> 554 bytes resources/mesh_vertex.png | Bin 0 -> 104 bytes resources/mesh_vertex_n.png | Bin 0 -> 235 bytes resources/mesh_wireframe.png | Bin 0 -> 322 bytes resources/mesh_wrap.png | Bin 0 -> 454 bytes resources/select1.png | Bin 0 -> 976 bytes src/DriverDAT/DriverDAT_R_SMDS_Mesh.cxx | 175 +++ src/DriverDAT/DriverDAT_R_SMDS_Mesh.h | 30 + .../DriverDAT_R_SMESHDS_Document.cxx | 86 + src/DriverDAT/DriverDAT_R_SMESHDS_Document.h | 24 + src/DriverDAT/DriverDAT_R_SMESHDS_Mesh.cxx | 52 + src/DriverDAT/DriverDAT_R_SMESHDS_Mesh.h | 30 + src/DriverDAT/DriverDAT_W_SMDS_Mesh.cxx | 164 ++ src/DriverDAT/DriverDAT_W_SMDS_Mesh.h | 31 + .../DriverDAT_W_SMESHDS_Document.cxx | 78 + src/DriverDAT/DriverDAT_W_SMESHDS_Document.h | 25 + src/DriverDAT/DriverDAT_W_SMESHDS_Mesh.cxx | 175 +++ src/DriverDAT/DriverDAT_W_SMESHDS_Mesh.h | 31 + src/DriverDAT/Makefile.in | 39 + src/DriverMED/DriverMED_R_SMDS_Mesh.cxx | 1 + .../DriverMED_R_SMESHDS_Document.cxx | 1 + src/DriverMED/DriverMED_R_SMESHDS_Mesh.cxx | 1 + src/DriverMED/DriverMED_W_SMDS_Mesh.cxx | 1 + .../DriverMED_W_SMESHDS_Document.cxx | 1 + src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx | 69 +- src/DriverMED/Makefile.in | 2 +- src/DriverUNV/DriverUNV_R_SMDS_Mesh.cxx | 153 ++ src/DriverUNV/DriverUNV_R_SMDS_Mesh.h | 30 + .../DriverUNV_R_SMESHDS_Document.cxx | 85 + src/DriverUNV/DriverUNV_R_SMESHDS_Document.h | 24 + src/DriverUNV/DriverUNV_R_SMESHDS_Mesh.cxx | 48 + src/DriverUNV/DriverUNV_R_SMESHDS_Mesh.h | 30 + src/DriverUNV/DriverUNV_W_SMDS_Mesh.cxx | 196 +++ src/DriverUNV/DriverUNV_W_SMDS_Mesh.h | 31 + .../DriverUNV_W_SMESHDS_Document.cxx | 78 + src/DriverUNV/DriverUNV_W_SMESHDS_Document.h | 25 + src/DriverUNV/DriverUNV_W_SMESHDS_Mesh.cxx | 207 +++ src/DriverUNV/DriverUNV_W_SMESHDS_Mesh.h | 31 + src/DriverUNV/Makefile.in | 41 + src/SMESH/Makefile.in | 81 + src/SMESH/SMESH_1D_Algo.cxx | 82 + src/SMESH/SMESH_1D_Algo.hxx | 30 + src/SMESH/SMESH_2D_Algo.cxx | 117 ++ src/SMESH/SMESH_2D_Algo.hxx | 34 + src/SMESH/SMESH_3D_Algo.cxx | 83 + src/SMESH/SMESH_3D_Algo.hxx | 30 + src/SMESH/SMESH_Algo.cxx | 224 +++ src/SMESH/SMESH_Algo.hxx | 60 + src/SMESH/SMESH_Gen.cxx | 390 +++++ src/SMESH/SMESH_Gen.hxx | 76 + src/SMESH/SMESH_Hexa_3D.cxx | 960 +++++++++++ src/SMESH/SMESH_Hexa_3D.hxx | 119 ++ src/SMESH/SMESH_Hypothesis.cxx | 116 ++ src/SMESH/SMESH_Hypothesis.hxx | 33 + src/SMESH/SMESH_HypothesisCreator.hxx | 49 + src/SMESH/SMESH_HypothesisFactory.cxx | 154 ++ src/SMESH/SMESH_HypothesisFactory.hxx | 50 + src/SMESH/SMESH_LengthFromEdges.cxx | 117 ++ src/SMESH/SMESH_LengthFromEdges.hxx | 37 + src/SMESH/SMESH_LocalLength.cxx | 117 ++ src/SMESH/SMESH_LocalLength.hxx | 37 + src/SMESH/SMESH_MEFISTO_2D.cxx | 631 ++++++++ src/SMESH/SMESH_MEFISTO_2D.hxx | 67 + src/SMESH/SMESH_MaxElementArea.cxx | 117 ++ src/SMESH/SMESH_MaxElementArea.hxx | 37 + src/SMESH/SMESH_MaxElementVolume.cxx | 9 + src/SMESH/SMESH_MaxElementVolume.hxx | 8 + src/SMESH/SMESH_Mesh.cxx | 572 +++++++ src/SMESH/SMESH_Mesh.hxx | 146 ++ src/SMESH/SMESH_NumberOfSegments.cxx | 115 ++ src/SMESH/SMESH_NumberOfSegments.hxx | 37 + src/SMESH/SMESH_Quadrangle_2D.cxx | 650 ++++++++ src/SMESH/SMESH_Quadrangle_2D.hxx | 81 + src/SMESH/SMESH_Regular_1D.cxx | 305 ++++ src/SMESH/SMESH_Regular_1D.hxx | 43 + src/SMESH/SMESH_subMesh.cxx | 1397 +++++++++++++++++ src/SMESH/SMESH_subMesh.hxx | 109 ++ 144 files changed, 11257 insertions(+), 5 deletions(-) create mode 100644 Makefile.in create mode 100755 build_configure create mode 100644 configure.in.base create mode 100644 idl/Makefile.in create mode 100644 idl/SMESH_BasicHypothesis.idl create mode 100644 idl/SMESH_Gen.idl create mode 100644 idl/SMESH_Hypothesis.idl create mode 100644 idl/SMESH_Mesh.idl create mode 100755 resources/ModuleMesh.png create mode 100644 resources/SMESHCatalog.xml create mode 100644 resources/SMESH_en.xml create mode 100644 resources/SMESH_fr.xml create mode 100644 resources/delete.png create mode 100644 resources/mesh.png create mode 100644 resources/mesh_add_sub.png create mode 100644 resources/mesh_algo_hexa.png create mode 100644 resources/mesh_algo_mefisto.png create mode 100644 resources/mesh_algo_quad.png create mode 100644 resources/mesh_algo_regular.png create mode 100644 resources/mesh_angle.png create mode 100644 resources/mesh_area.png create mode 100644 resources/mesh_aspect.png create mode 100644 resources/mesh_compute.png create mode 100644 resources/mesh_connectivity.png create mode 100644 resources/mesh_diagonal.png create mode 100644 resources/mesh_edit.png create mode 100644 resources/mesh_hexa.png create mode 100644 resources/mesh_hexa_n.png create mode 100644 resources/mesh_hypo_area.png create mode 100644 resources/mesh_hypo_length.png create mode 100644 resources/mesh_hypo_segment.png create mode 100644 resources/mesh_hypo_volume.png create mode 100644 resources/mesh_info.png create mode 100644 resources/mesh_init.png create mode 100644 resources/mesh_length.png create mode 100644 resources/mesh_line.png create mode 100644 resources/mesh_line_n.png create mode 100644 resources/mesh_move_node.png create mode 100644 resources/mesh_orientation.png create mode 100644 resources/mesh_pyramid.png create mode 100644 resources/mesh_pyramid_n.png create mode 100644 resources/mesh_quad.png create mode 100644 resources/mesh_quad_n.png create mode 100644 resources/mesh_rem_element.png create mode 100644 resources/mesh_rem_node.png create mode 100644 resources/mesh_set_algo.png create mode 100644 resources/mesh_set_hypo.png create mode 100644 resources/mesh_shading.png create mode 100644 resources/mesh_shrink.png create mode 100644 resources/mesh_skew.png create mode 100644 resources/mesh_taper.png create mode 100644 resources/mesh_tetra.png create mode 100644 resources/mesh_tetra_n.png create mode 100644 resources/mesh_tree_algo.png create mode 100644 resources/mesh_tree_algo_hexa.png create mode 100644 resources/mesh_tree_algo_mefisto.png create mode 100644 resources/mesh_tree_algo_quad.png create mode 100644 resources/mesh_tree_algo_regular.png create mode 100644 resources/mesh_tree_hypo.png create mode 100644 resources/mesh_tree_hypo_area.png create mode 100644 resources/mesh_tree_hypo_length.png create mode 100644 resources/mesh_tree_hypo_segment.png create mode 100644 resources/mesh_tree_hypo_volume.png create mode 100644 resources/mesh_tree_mesh.png create mode 100644 resources/mesh_tree_mesh_warn.png create mode 100644 resources/mesh_triangle.png create mode 100644 resources/mesh_triangle_n.png create mode 100644 resources/mesh_update.png create mode 100644 resources/mesh_vertex.png create mode 100644 resources/mesh_vertex_n.png create mode 100644 resources/mesh_wireframe.png create mode 100644 resources/mesh_wrap.png create mode 100644 resources/select1.png create mode 100644 src/DriverDAT/DriverDAT_R_SMDS_Mesh.cxx create mode 100644 src/DriverDAT/DriverDAT_R_SMDS_Mesh.h create mode 100644 src/DriverDAT/DriverDAT_R_SMESHDS_Document.cxx create mode 100644 src/DriverDAT/DriverDAT_R_SMESHDS_Document.h create mode 100644 src/DriverDAT/DriverDAT_R_SMESHDS_Mesh.cxx create mode 100644 src/DriverDAT/DriverDAT_R_SMESHDS_Mesh.h create mode 100644 src/DriverDAT/DriverDAT_W_SMDS_Mesh.cxx create mode 100644 src/DriverDAT/DriverDAT_W_SMDS_Mesh.h create mode 100644 src/DriverDAT/DriverDAT_W_SMESHDS_Document.cxx create mode 100644 src/DriverDAT/DriverDAT_W_SMESHDS_Document.h create mode 100644 src/DriverDAT/DriverDAT_W_SMESHDS_Mesh.cxx create mode 100644 src/DriverDAT/DriverDAT_W_SMESHDS_Mesh.h create mode 100644 src/DriverDAT/Makefile.in create mode 100644 src/DriverUNV/DriverUNV_R_SMDS_Mesh.cxx create mode 100644 src/DriverUNV/DriverUNV_R_SMDS_Mesh.h create mode 100644 src/DriverUNV/DriverUNV_R_SMESHDS_Document.cxx create mode 100644 src/DriverUNV/DriverUNV_R_SMESHDS_Document.h create mode 100644 src/DriverUNV/DriverUNV_R_SMESHDS_Mesh.cxx create mode 100644 src/DriverUNV/DriverUNV_R_SMESHDS_Mesh.h create mode 100644 src/DriverUNV/DriverUNV_W_SMDS_Mesh.cxx create mode 100644 src/DriverUNV/DriverUNV_W_SMDS_Mesh.h create mode 100644 src/DriverUNV/DriverUNV_W_SMESHDS_Document.cxx create mode 100644 src/DriverUNV/DriverUNV_W_SMESHDS_Document.h create mode 100644 src/DriverUNV/DriverUNV_W_SMESHDS_Mesh.cxx create mode 100644 src/DriverUNV/DriverUNV_W_SMESHDS_Mesh.h create mode 100644 src/DriverUNV/Makefile.in create mode 100644 src/SMESH/Makefile.in create mode 100644 src/SMESH/SMESH_1D_Algo.cxx create mode 100644 src/SMESH/SMESH_1D_Algo.hxx create mode 100644 src/SMESH/SMESH_2D_Algo.cxx create mode 100644 src/SMESH/SMESH_2D_Algo.hxx create mode 100644 src/SMESH/SMESH_3D_Algo.cxx create mode 100644 src/SMESH/SMESH_3D_Algo.hxx create mode 100644 src/SMESH/SMESH_Algo.cxx create mode 100644 src/SMESH/SMESH_Algo.hxx create mode 100644 src/SMESH/SMESH_Gen.cxx create mode 100644 src/SMESH/SMESH_Gen.hxx create mode 100644 src/SMESH/SMESH_Hexa_3D.cxx create mode 100644 src/SMESH/SMESH_Hexa_3D.hxx create mode 100644 src/SMESH/SMESH_Hypothesis.cxx create mode 100644 src/SMESH/SMESH_Hypothesis.hxx create mode 100644 src/SMESH/SMESH_HypothesisCreator.hxx create mode 100644 src/SMESH/SMESH_HypothesisFactory.cxx create mode 100644 src/SMESH/SMESH_HypothesisFactory.hxx create mode 100644 src/SMESH/SMESH_LengthFromEdges.cxx create mode 100644 src/SMESH/SMESH_LengthFromEdges.hxx create mode 100644 src/SMESH/SMESH_LocalLength.cxx create mode 100644 src/SMESH/SMESH_LocalLength.hxx create mode 100644 src/SMESH/SMESH_MEFISTO_2D.cxx create mode 100644 src/SMESH/SMESH_MEFISTO_2D.hxx create mode 100644 src/SMESH/SMESH_MaxElementArea.cxx create mode 100644 src/SMESH/SMESH_MaxElementArea.hxx create mode 100644 src/SMESH/SMESH_MaxElementVolume.cxx create mode 100644 src/SMESH/SMESH_MaxElementVolume.hxx create mode 100644 src/SMESH/SMESH_Mesh.cxx create mode 100644 src/SMESH/SMESH_Mesh.hxx create mode 100644 src/SMESH/SMESH_NumberOfSegments.cxx create mode 100644 src/SMESH/SMESH_NumberOfSegments.hxx create mode 100644 src/SMESH/SMESH_Quadrangle_2D.cxx create mode 100644 src/SMESH/SMESH_Quadrangle_2D.hxx create mode 100644 src/SMESH/SMESH_Regular_1D.cxx create mode 100644 src/SMESH/SMESH_Regular_1D.hxx create mode 100644 src/SMESH/SMESH_subMesh.cxx create mode 100644 src/SMESH/SMESH_subMesh.hxx diff --git a/Makefile.in b/Makefile.in new file mode 100644 index 000000000..c74b898d4 --- /dev/null +++ b/Makefile.in @@ -0,0 +1,145 @@ +# -* Makefile *- +# +# Author : Patrick GOLDBRONN (CEA) +# Date : 28/06/2001 +# $Header$ +# + +# 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 + +RESOURCES_FILES = \ +delete.png \ +mesh_add_sub.png \ +mesh_algo_hexa.png \ +mesh_algo_mefisto.png \ +mesh_algo_quad.png \ +mesh_algo_regular.png \ +mesh_angle.png \ +mesh_area.png \ +mesh_aspect.png \ +mesh_compute.png \ +mesh_connectivity.png \ +mesh_diagonal.png \ +mesh_edit.png \ +mesh_hexa_n.png \ +mesh_hexa.png \ +mesh_hypo_area.png \ +mesh_hypo_length.png \ +mesh_hypo_segment.png \ +mesh_hypo_volume.png \ +mesh_info.png \ +mesh_init.png \ +mesh_length.png \ +mesh_line_n.png \ +mesh_line.png \ +mesh_move_node.png \ +mesh_orientation.png \ +mesh.png \ +mesh_pyramid_n.png \ +mesh_pyramid.png \ +mesh_quad_n.png \ +mesh_quad.png \ +mesh_rem_element.png \ +mesh_rem_node.png \ +mesh_set_algo.png \ +mesh_set_hypo.png \ +mesh_shading.png \ +mesh_shrink.png \ +mesh_skew.png \ +mesh_taper.png \ +mesh_tetra_n.png \ +mesh_tetra.png \ +mesh_tree_algo_hexa.png \ +mesh_tree_algo_mefisto.png \ +mesh_tree_algo.png \ +mesh_tree_algo_quad.png \ +mesh_tree_algo_regular.png \ +mesh_tree_hypo_area.png \ +mesh_tree_hypo_length.png \ +mesh_tree_hypo.png \ +mesh_tree_hypo_segment.png \ +mesh_tree_hypo_volume.png \ +mesh_tree_mesh.png \ +mesh_tree_mesh_warn.png \ +mesh_triangle_n.png \ +mesh_triangle.png \ +mesh_update.png \ +mesh_vertex_n.png \ +mesh_vertex.png \ +mesh_wireframe.png \ +mesh_wrap.png \ +ModuleMesh.png \ +select1.png \ +SMESH_en.xml + +# 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.h + -$(RM) $@ + $(LN_S) ../../$< $@ + +include/salome/sstream: salome_adm/unix/sstream + -$(RM) $@ + $(LN_S) ../../$< $@ + +depend: depend_idl + +depend_idl: + (cd idl ; $(MAKE) $@) || exit 1 + +# doc is already build : if you want to had documents, go manually to doc and run 'make doc' +#doc: +# (cd doc && $(MAKE) $@) || exit 1 + +install-end: +# finish libtool install +# @$(LT) --mode=finish $(libdir) + +install-include: $(include_list) + $(INSTALL) -d $(includedir) + @for f in X $(include_list); do \ + if test $$f != X; then \ + ($(INSTALL_DATA) $$f $(includedir)/. || exit 1); \ + fi; \ + done + +# install script in $(bindir) : +install-bin: $(BIN_SCRIPT) + $(INSTALL) -d $(bindir) + if test $(BIN_SCRIPT)X != X; then \ + $(INSTALL_PROGRAM) $^ $(bindir); \ + fi + +uninstall: uninstall-idl + +uninstall-idl: + $(RM) $(idldir)/*.idl + +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 install-include install-end + diff --git a/build_configure b/build_configure new file mode 100755 index 000000000..4edf6f44d --- /dev/null +++ b/build_configure @@ -0,0 +1,206 @@ +#!/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 +# $Header$ +# + +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 +######################################################################## +# 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 ;; + *) ;; + 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 + +# 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}/salome_adm' >> 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 " ./salome_adm/unix/make_omniorb \\" >> configure.in_tmp1 +echo " ./salome_adm/unix/envScript \\" >> configure.in_tmp1 +echo " ./salome_adm/unix/make_commence \\" >> 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 '/^.*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 --acdir=${KERNEL_ROOT_DIR}/salome_adm/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 000000000..9c6efd0ec --- /dev/null +++ b/configure.in.base @@ -0,0 +1,366 @@ +# +# 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 testing java +echo --------------------------------------------- +echo + +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 + +echo +echo --------------------------------------------- +echo testing mico +echo --------------------------------------------- +echo + +CHECK_MICO + +echo +echo --------------------------------------------- +echo default ORB : omniORB +echo --------------------------------------------- +echo + +DEFAULT_ORB=omniORB +CHECK_CORBA + +AC_SUBST_FILE(CORBA) +corba=make_$ORB +CORBA=salome_adm/unix/$corba + +echo +echo --------------------------------------------- +echo testing openGL +echo --------------------------------------------- +echo + +CHECK_OPENGL + +echo +echo --------------------------------------------- +echo testing QT +echo --------------------------------------------- +echo + +CHECK_QT + +echo +echo --------------------------------------------- +echo testing VTK +echo --------------------------------------------- +echo + +CHECK_VTK + +echo +echo --------------------------------------------- +echo testing HDF5 +echo --------------------------------------------- +echo + +CHECK_HDF5 + +echo +echo --------------------------------------------- +echo testing MED2 +echo --------------------------------------------- +echo + +CHECK_MED2 + +echo +echo --------------------------------------------- +echo Testing OpenCascade +echo --------------------------------------------- +echo + +CHECK_CAS + +echo +echo --------------------------------------------- +echo Testing Kernel +echo --------------------------------------------- +echo + +CHECK_KERNEL + +echo +echo --------------------------------------------- +echo Testing Geom +echo --------------------------------------------- +echo + +CHECK_GEOM + +echo +echo --------------------------------------------- +echo Summary +echo --------------------------------------------- +echo + +echo Configure +variables="cc_ok lex_yacc_ok python_ok java_ok swig_ok threads_ok OpenGL_ok qt_ok vtk_ok hdf5_ok med2_ok omniORB_ok mico_ok occ_ok Kernel_ok Geom_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=salome_adm/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/salome share/salome/resources share/salome/doc 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 + +cd bin +for i in $ROOT_SRCDIR/bin/* +do + local_bin=`echo $i | sed -e "s,$ROOT_SRCDIR,.,"` + case "$local_bin" in + *.in | *~) ;; + ./bin/CVS) ;; + *) ln -fs $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/idl/Makefile.in b/idl/Makefile.in new file mode 100644 index 000000000..a4e6eb1ef --- /dev/null +++ b/idl/Makefile.in @@ -0,0 +1,76 @@ +# +# generate dependencies for idl file : +# + +# source path +top_srcdir=@top_srcdir@ +top_builddir=.. +srcdir=@srcdir@ +VPATH=.:$(srcdir):${KERNEL_ROOT_DIR}/idl/salome:${GEOM_ROOT_DIR}/idl/salome + +@COMMENCE@ + +IDL_FILES = \ + SALOME_Component.idl \ + SALOMEDS.idl \ + SALOMEDS_Attributes.idl \ + SALOME_Exception.idl \ + Logger.idl \ + SALOME_ModuleCatalog.idl \ + GEOM_Shape.idl \ + GEOM_Gen.idl \ + SMESH_Gen.idl \ + SMESH_Mesh.idl \ + SMESH_Hypothesis.idl \ + SMESH_BasicHypothesis.idl + +PY_CLIENT_IDL = $(IDL_FILES) + +# we copy all idl file in $(top_builddir)/idl +inc: $(IDL_FILES:%=$(top_builddir)/idl/%) + +$(IDL_FILES:%=$(top_builddir)/idl/%):$(top_builddir)/idl/%:% +# $(CP) $< $@ + cp -f $< $@ + + +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: %.idl + $(OMNIORB_IDL) $(OMNIORB_IDLPYFLAGS) -C$(PYTHON_BUILD_SITE) $< + + +# install python client (generated from idl file +install: install-pyidl install-idl + +# create directory $(idldir) and copy idl files into it +install-idl: $(IDL_FILES) + $(INSTALL) -d $(idldir) + $(INSTALL_DATA) $^ $(idldir) + + +install-pyidl: $(IDL_FILES) + $(INSTALL) -d $(PYTHON_SITE_INSTALL) + @for file in $^ dummy; do \ + if [ $$file != "dummy" ]; then \ + $(OMNIORB_IDL) $(OMNIORB_IDLPYFLAGS) -C$(PYTHON_SITE_INSTALL) $$file ; \ + fi ; \ + done ; + +#@ CONCLUDE @ + +cleandep: + -$(RM) .dep* + +distclean: + -$(RM) *.py + -$(RM) $(IDL_FILES:%=$(top_builddir)/idl/%) + -$(RM) Makefile + diff --git a/idl/SMESH_BasicHypothesis.idl b/idl/SMESH_BasicHypothesis.idl new file mode 100644 index 000000000..694b791ba --- /dev/null +++ b/idl/SMESH_BasicHypothesis.idl @@ -0,0 +1,64 @@ +//============================================================================= +// File : SMESH_BasicHypothesis.idl +// Created : mer mai 15 13:37:18 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= + +#ifndef _SMESH_BASICHYPOTHESIS_IDL_ +#define _SMESH_BASICHYPOTHESIS_IDL_ + +#include "SALOME_Exception.idl" +#include "SMESH_Hypothesis.idl" + + +module SMESH +{ + interface SMESH_LocalLength : SMESH_Hypothesis + { + void SetLength(in double length) + raises (SALOME::SALOME_Exception); + double GetLength(); + }; + + interface SMESH_NumberOfSegments : SMESH_Hypothesis + { + void SetNumberOfSegments(in long segmentsNumber) + raises (SALOME::SALOME_Exception); + long GetNumberOfSegments(); + }; + + interface SMESH_MaxElementArea : SMESH_Hypothesis + { + void SetMaxElementArea(in double area) + raises (SALOME::SALOME_Exception); + double GetMaxElementArea(); + }; + + interface SMESH_MaxElementVolume : SMESH_Hypothesis + { + void SetMaxElementVolume(in double volume) + raises (SALOME::SALOME_Exception); + double GetMaxElementVolume(); + }; + + interface SMESH_Regular_1D : SMESH_1D_Algo + { + }; + + interface SMESH_MEFISTO_2D : SMESH_2D_Algo + { + }; + + interface SMESH_Quadrangle_2D : SMESH_2D_Algo + { + }; + + interface SMESH_Hexa_3D : SMESH_3D_Algo + { + }; +}; + +#endif diff --git a/idl/SMESH_Gen.idl b/idl/SMESH_Gen.idl new file mode 100644 index 000000000..5617d144b --- /dev/null +++ b/idl/SMESH_Gen.idl @@ -0,0 +1,96 @@ +//============================================================================= +// File : SMESH_Gen.idl +// Created : jeu avr 11 15:26:35 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= + +#ifndef _SMESH_GEN_IDL_ +#define _SMESH_GEN_IDL_ + +#include "SALOME_Exception.idl" +#include "SALOME_Component.idl" +#include "SALOMEDS.idl" + +#include "GEOM_Gen.idl" +#include "GEOM_Shape.idl" + +#include "SMESH_Mesh.idl" +#include "SMESH_Hypothesis.idl" + +module SMESH +{ + typedef sequence shape_array; + + interface SMESH_Gen : Engines::Component, SALOMEDS::Driver + { + /*! + * Create an hypothesis that can be shared by differents parts of the mesh. + * An hypothesis is either: + * - a method used to generate or modify a part of the mesh (algorithm). + * - a parameter or a law used by an algorithm. + * Algorithms are 1D, 2D or 3D. + */ + SMESH_Hypothesis CreateHypothesis( in string anHyp, + in long studyId) + raises (SALOME::SALOME_Exception); + + /*! + * Create a Mesh object, given a geometry shape. + * Mesh is created empty (no points, no elements). + * Shape is explored via GEOM_Client to create local copies. + * of TopoDS_Shapes and bind CORBA references of shape & subshapes + * with TopoDS_Shapes + */ + SMESH_Mesh Init(in GEOM::GEOM_Gen geomEngine, + in long studyId, + in GEOM::GEOM_Shape aShape) + raises (SALOME::SALOME_Exception); + + /*! + * Create a Mesh object, without a geometry shape reference + */ +// SMESH_Mesh NewEmpty(in GEOM::GEOM_Gen geomEngine, +// in long studyId) +// raises (SALOME::SALOME_Exception); + + /*! + * Mesh a subShape. + * First, verify list of hypothesis associated with the subShape, + * return NOK if hypothesis are not sufficient + */ + boolean Compute(in SMESH_Mesh aMesh, in GEOM::GEOM_Shape aSubShape) + raises (SALOME::SALOME_Exception); + + /*! + * + */ + + boolean IsReadyToCompute(in SMESH_Mesh aMesh, in GEOM::GEOM_Shape aSubShape) + raises (SALOME::SALOME_Exception); + + /*! + * + */ + long_array GetSubShapesId(in GEOM::GEOM_Gen geomEngine, + in long studyId, + in GEOM::GEOM_Shape mainShape, + in shape_array listOfSubShape) + raises (SALOME::SALOME_Exception); + + /*! + * + */ + // long_array GetSubMeshesState(in GEOM::GEOM_Gen geomEngine, + // in long studyId, + // in shape_array listOfSubShape) + // raises (SALOME::SALOME_Exception); + + + }; + +}; + +#endif diff --git a/idl/SMESH_Hypothesis.idl b/idl/SMESH_Hypothesis.idl new file mode 100644 index 000000000..ec61223eb --- /dev/null +++ b/idl/SMESH_Hypothesis.idl @@ -0,0 +1,71 @@ +//============================================================================= +// File : SMESH_Hypothesis.idl +// Created : jeu avr 11 19:26:16 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= + +#ifndef _SMESH_HYPOTHESIS_IDL_ +#define _SMESH_HYPOTHESIS_IDL_ + +#include "SALOME_Exception.idl" + +module SMESH +{ + interface SMESH_Hypothesis; + + typedef sequence ListOfHypothesis; + typedef sequence ListOfHypothesisName; + + interface SMESH_Hypothesis + { + /*! + * Get the Hypothesis typeName + */ + string GetName(); + + /*! + * Get the internal Id + */ + long GetId(); + }; + + interface SMESH_Algo : SMESH_Hypothesis + { + /*! + * Get list of hypothesis that can be used with this algorithm + */ + ListOfHypothesisName GetCompatibleHypothesis(); + + }; + + interface SMESH_1D_Algo : SMESH_Algo + { + /*! + * + */ + }; + + interface SMESH_2D_Algo : SMESH_Algo + { + /*! + * + */ + }; + + interface SMESH_3D_Algo : SMESH_Algo + { + /*! + * + */ + }; +}; + + // ----------------------------------------------------------------- + // Specific Algorithms in separate idl file + // ----------------------------------------------------------------- + + +#endif diff --git a/idl/SMESH_Mesh.idl b/idl/SMESH_Mesh.idl new file mode 100644 index 000000000..a25ba26bc --- /dev/null +++ b/idl/SMESH_Mesh.idl @@ -0,0 +1,262 @@ +//============================================================================= +// File : SMESH_Mesh.idl +// Created : jeu avr 11 15:31:39 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= + + +#ifndef _SMESH_MESH_IDL_ +#define _SMESH_MESH_IDL_ + +#include "SALOME_Exception.idl" +#include "SMESH_Hypothesis.idl" + +#include "GEOM_Shape.idl" +#include "MED.idl" + +module SMESH +{ + typedef sequence double_array ; + typedef sequence long_array ; + typedef sequence string_array ; + + enum log_command + { + ADD_NODE, + ADD_EDGE, + ADD_TRIANGLE, + ADD_QUADRANGLE, + ADD_TETRAHEDRON, + ADD_PYRAMID, + ADD_PRISM, + ADD_HEXAHEDRON, + REMOVE_NODE, + REMOVE_ELEMENT + }; + + struct log_block + { + long commandType; + long number; + double_array coords; + long_array indexes; + }; + + typedef sequence log_array; + + interface SMESH_subMesh; + interface SMESH_MeshEditor; + interface SMESH_Mesh + { + /*! + * Associate a Shape to a Mesh created with NewEmpty + */ + +// boolean SetMesh(in GEOM::GEOM_Shape aShape) +// raises (SALOME::SALOME_Exception); + + /*! + * Get the subMesh object associated to a subShape. The subMesh object + * gives access to nodes and elements IDs. + * SubMesh will be used instead of SubShape in a next idl version to + * adress a specific subMesh... + */ + SMESH_subMesh GetElementsOnShape(in GEOM::GEOM_Shape aSubShape) + raises (SALOME::SALOME_Exception); + + /*! + * Create a subMesh without reference to a subShape + */ +// SMESH_subMesh NewEmpty() +// raises (SALOME::SALOME_Exception); + + /*! + * Add hypothesis to the mesh, under a particular subShape + * (or the main shape itself) + * The Add method is only used to prepare the build of the mesh and store + * the algorithms and associated parameters. + * Actual job of mesh the shape is done by MESH_Gen. + * @params + * - aSubShape : subShape obtained by a shape explode in GEOM + * (or main shape) + * - anHyp : hypothesis object + * @return + * - OK if the hypothesis is compatible with the subShape + * (and all previous hypothesis on the subShape) + * - NOK if the hypothesis is not compatible with the subShape + * (or one previous hypothesis on the subShape) + * raises exception if hypothesis has not been created + */ + boolean AddHypothesis(in GEOM::GEOM_Shape aSubShape, in SMESH_Hypothesis anHyp) + raises (SALOME::SALOME_Exception); +// boolean AddHypothesis(in SMESH_subMesh aSubMesh, in SMESH_Hypothesis anHyp) +// raises (SALOME::SALOME_Exception); + + + /*! + * Remove an hypothesis previouly added with AddHypothesis. + */ + boolean RemoveHypothesis(in GEOM::GEOM_Shape aSubShape, + in SMESH_Hypothesis anHyp) + raises (SALOME::SALOME_Exception); +// boolean RemoveHypothesis(in SMESH_subMesh aSubMesh, +// in SMESH_Hypothesis anHyp) +// raises (SALOME::SALOME_Exception); + + /*! + * Get the list of hypothesis added on a subShape + */ + ListOfHypothesis GetHypothesisList(in GEOM::GEOM_Shape aSubShape) + raises (SALOME::SALOME_Exception); +// ListOfHypothesis GetHypothesisList(in SMESH_subMesh aSubMesh) +// raises (SALOME::SALOME_Exception); + + /*! + * Get the log of nodes and elements added or removed since previous + * clear of the log. + * @params + * - clearAfterGet : log is emptied after Get (safe if concurrents access) + */ + // string_array GetLog(in boolean clearAfterGet) + // raises (SALOME::SALOME_Exception); + log_array GetLog(in boolean clearAfterGet) + raises (SALOME::SALOME_Exception); + + /*! + * Clear the log of nodes and elements added or removed since previous + * clear. Must be used immediately after GetLog if clearAfterGet is false. + */ + void ClearLog() + raises (SALOME::SALOME_Exception); + + /*! + * Get the internal Id + */ + long GetId(); + + /*! + * Get the study Id + */ + long GetStudyId(); + + SMESH_MeshEditor GetMeshEditor() + raises (SALOME::SALOME_Exception); + + /*! + * Export Mesh with DAT and MED Formats + */ + void ExportDAT( in string file ) + raises (SALOME::SALOME_Exception); + void ExportMED( in string file ) + raises (SALOME::SALOME_Exception); + void ExportUNV( in string file ) + raises (SALOME::SALOME_Exception); + + /*! + * Get MED Mesh + */ + SALOME_MED::MESH GetMEDMesh() + raises (SALOME::SALOME_Exception); + + long NbNodes() + raises (SALOME::SALOME_Exception); + + long NbEdges() + raises (SALOME::SALOME_Exception); + + long NbFaces() + raises (SALOME::SALOME_Exception); + + long NbTriangles() + raises (SALOME::SALOME_Exception); + + long NbQuadrangles() + raises (SALOME::SALOME_Exception); + + long NbVolumes() + raises (SALOME::SALOME_Exception); + + long NbTetras() + raises (SALOME::SALOME_Exception); + + long NbHexas() + raises (SALOME::SALOME_Exception); + + long NbSubMesh() + raises (SALOME::SALOME_Exception); + }; + + interface SMESH_subMesh + { + /*! + * + */ + long GetNumberOfElements() + raises (SALOME::SALOME_Exception); + + /*! + * + */ + long GetNumberOfNodes() + raises (SALOME::SALOME_Exception); + + /*! + * + */ + long_array GetElementsId() + raises (SALOME::SALOME_Exception); + + /*! + * + */ + long_array GetNodesId() + raises (SALOME::SALOME_Exception); + + /*! + * Get SMESH_Mesh which stores nodes coordinates & elements definition + */ + SMESH_Mesh GetFather() + raises (SALOME::SALOME_Exception); + + /*! + * Get the internal Id + */ + long GetId(); + + /*! + * Get MED subMesh + */ + SALOME_MED::FAMILY GetFamily() + raises (SALOME::SALOME_Exception); + }; + + /* + * This interface makes modifications on the Mesh - removing elements and nodes + */ + interface SMESH_MeshEditor { + + + boolean RemoveElements(in long_array IDsOfElements) + raises (SALOME::SALOME_Exception); + + boolean RemoveNodes(in long_array IDsOfNodes) + raises (SALOME::SALOME_Exception); + + boolean AddNode(in double x, in double y, in double z) + raises (SALOME::SALOME_Exception); + + boolean AddEdge(in long_array IDsOfNodes) + raises (SALOME::SALOME_Exception); + + boolean AddFace(in long_array IDsOfNodes) + raises (SALOME::SALOME_Exception); + + boolean AddVolume(in long_array IDsOfNodes) + raises (SALOME::SALOME_Exception); + }; +}; + +#endif diff --git a/resources/ModuleMesh.png b/resources/ModuleMesh.png new file mode 100755 index 0000000000000000000000000000000000000000..5e781ac34ae9fb5c72ad6337e1fb71a085c6b4a5 GIT binary patch literal 2629 zcmV-L3cB@)P)4?V3no4>8@C)pYZ&=ZE4AwmD&Iv_3f*s8P+j+~lEHdzsy`M1H85UsN1{%e{sa z-?72mW&tUksAVw8P4TKd9Ni_+%NI4)Zr{2Z z9f-$f=Vo&I_I~ZzFJg}`J?I73Zr{4v*Vk9=>+7rPniiWq>!52|tgo-Hx_0~4)w{Rv zKG6Lh7=Xv0++R2P$_#C7Z6r^Q$?r?$6#)7N`l}w82eEJ4=cUl&PwuY<1KrG?b%>og z2tY8PVrElNP%-Th+;u-jBn5yztjM{+KsTlG3d{CN+n&99{yzY2eRTKg*vo^liSttc zC><3jsOZBAni@mzQ87*pVqVT*+smj=^hz+^h@Mt=4P@5T`ZSPp+LOPRUNsY-b z4m-FTew6pSAnb@|1(jqvfjK%2AiT2S$GkKly$}p^ll^lRe~15oq9`|Z3dFZ7>w!|) zAvd~=d3hu@^VU4kfjCAaMRI5yGn*ol&%mO1*EltZ?d0TKor?qm-L$o})#--KYIzml zLqGlld-m?Ru@gIX6~wRp?tC>EP$BG)dE+9vSC+BtdJN#!3=gF+LIRXE>7uDIk|)Q| z)EJ5QQGx-LQrSV*Gyp2=74EFx!QF6Q->EIT_5eV1AkOUE44`6;PLs)x*Z3`{lT0V% zyP3st0A}ZA$h{+|gO@x^8o;$P&dG`9f*M5qhTzm5TVZfumd5r4yvGH*$%oU z=G*T%yV`zN6q=ozLDxj)Anb_L7;bHVu8E99K_!zP7ys8Nvw0|rLc7wA;!}RMQ(JcJ z0htO5DptY8qfuj?-*#Tu!DPA#xZ+d52a2NXD1c#?9tZ|hIP9RQF*5ma`8=6UVA(d- zq$`1#S&=IBVFe?SLLXKL2D;_@f=adkpeQJclDnT;uxk(KJ(|qxjlrsGTFoOh{xgj} zyn;1Zdvf(a-QeaY*Gc{0j}+hA z0AR)aH9r~#Hmzl^sXpfAs^8n zKF^Vd5%-+x}+l2hZPyLn>7+) zQI##*&MEkx-AOQS3!tyBuL_WeA7vq5Y%&b$(%5+EMHcc!Y$qpZ6?UMYGIFV(g~bJ# zm1H2N6H=wJq&5{huSV=tYPZZnCyt$}{^jjIwZ*=lz`EvOW>ZX@?*+hlb5$BHPdu9< z^M-~s>5^F-$2cs!q<%}xaSs(q4rQc9T3DQ?`>~*qAz=sea0-@as3`yrgdL&-@hZUl z+JUNb5Q`AN%1xqUKp&|g98bk3_ z08tZ+pAXU->L>QJpr5X3u%t?@WZEN5a%1+a2>Skk{+2E2762!XovKC$;!Mx{4P1zw zIY{ixK{EMqS$HyekyUi99tWPL@w}tF-^J_|AvyFOO(@fsUSwp{z`Rti;$AT{LgHCc zyMTEqg=vofqS>)*n^JiNUDINva;duZ@!F%Fz1tQtBa)J(->bO#u!2DfYtqHcPKbbX zMPaihU3x>ks894_W+#X)#xYI}vXEcFNRP-E$-Gumt%rq}vuuZ?T@PlxM?>$qNOEY5 zSlbNIfjGH$;+*@#IUzUT!+j6$YikLhRCX{T)6!Tk@GRTGc5-NHY>Vbe4vkAMTo{^% zutPA=jde{ZPz6E7h5QOixFQ;zTA<6U1_D?pMQ^B=l@Chf{yL3y&5`xObzM+^jk>+t zdZ1C$kQN_OKAarGvK;}YMjs=R5?sy$1<|Y!cF4RoB@BynlN=f&`C|hLU1GroIquQu z!q9xp6N>2kURjp!c!F6&YRA1bwn8 z>|sGABK7;8#$skox@7XTA~!t2LcWN*K84az!OUKi-fBEBy=SZ8mTeP1-j6lu5Y6Hoc61sFU=>_?Bi^lpCa+LPLvN&ug?y1x*&!HEWegdSl$6`LrqyeS zZ9^K&OA|7_yi-pOO)-0Ao@DF(2iTNGy=L9h>tX{(W{gJJypS(KLFLYRyQ~4`=rqY; z19Nm*+%_}>dp+H1(o5E)D=xoArwInSo8H&d80Mu32}bnZp8>!N%9dWK>HlOpAyaBH zouK=%VAGsd?P6n~dok6xhBuPwM2&vq_q1d4XrfT5EYj8N+zk4#FhpN$=BBrBZ0=xF zc8~_v0)6w48EaUdqR*)kkN{;%P~Pc__-Zyr1Z)N)l&U8SMDuhZossXgy0zFMr*D09>*{KG zH8%e1bCOctwPE9M4;6_Y?*~LGO%9DowORLuD(87A*#l83uVC3Wv8NLh|MM@BLt_{r zQ3$;|(?t9zdZ=IS>F@B<8R#S!2ufwT1;E(GK(2G% zk>7dG>K>?{^yZ4{NeT6ZPP!ipGV|6v@#Fo>o)vSvYs%ECDN($93Y~#Y{2l%S`ySpW zuU)nPxO@99uIoPPZn&?zt{Yl(@5;iuEziQm8V=6c(XtQDBm$|~-LD}+_U@J>lll)-x}hwHjivsdP&q27oe z?`I)j+;SM3PrkFW^TwxbpEj+z + + + + + + + + + + + + + + SMESH + Mesh + NRI + 1.0 + New Mesh component + 1 + ModuleMesh.png + + + SMESH + + + + CreateHypothesis + + + + 1 + + + string + anHyp + + + + long + studyId + + + + + + SMESH_Hypothesis + aHyp + + + + + + Init + + + + 1 + + + GEOM_Gen + geomEngine + + + + long + studyId + + + + GEOM_Shape + aShape + + + + + + SMESH_Mesh + aMesh + + + + + + Compute + + + + 1 + + + SMESH_Mesh + aMesh + + + + GEOM_Shape + aSubShape + + + + + + boolean + res + Result + + + + + IsReadyToCompute + + + + 1 + + + SMESH_Mesh + aMesh + + + + GEOM_Shape + aSubShape + + + + + boolean + res + Result + + + + SMESH_Mesh + + + + AddHypothesis + + + + 1 + + + GEOM_Shape + aSubShape + + + + SMESH_Hypothesis + aHyp + + + + + + boolean + res + Result + + + + + + hostname = localhost + + + diff --git a/resources/SMESH_en.xml b/resources/SMESH_en.xml new file mode 100644 index 000000000..ea885d2ba --- /dev/null +++ b/resources/SMESH_en.xml @@ -0,0 +1,246 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/SMESH_fr.xml b/resources/SMESH_fr.xml new file mode 100644 index 000000000..480f0aaf2 --- /dev/null +++ b/resources/SMESH_fr.xml @@ -0,0 +1,246 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/delete.png b/resources/delete.png new file mode 100644 index 0000000000000000000000000000000000000000..8ae8475270846e746507f5bdd7752821fb1e88c9 GIT binary patch literal 943 zcmeAS@N?(olHy`uVBq!ia0vp^0zk~q!3-pCt=%unz`)E9;1l8sL#cK@(5tK^L4Lu&#Q&e+_cp#@pg^Rji(^Q|E#GsETnvgF%oh@G z|NsBVa=JU~LVs1qNz3`)HwMdQavt~mEVPW{xMI6d(A$KBu1e__8@xUpahmz;vqPyE v!~ecD?K;;U{BCHMV=yw=saPV-wD17?vMOc`V~)i0paAxC^>bP0l+XkK1JFi| literal 0 HcmV?d00001 diff --git a/resources/mesh.png b/resources/mesh.png new file mode 100644 index 0000000000000000000000000000000000000000..f8147b3f816c16894c554918d12c9f09147c4449 GIT binary patch literal 319 zcmV-F0l@x=P)G8k#GTtHpbp#SuqDliaWVHkP3jlf;sGOLVN>2!I22Kh&hA{8KnfZ@e3 z@#ipLlS7&s-Haf6%Xa3p*9Ieq3sUj;W8G0E@i|RnFam_`T|Jz`+`uS@dkOnt+-9+c z5%iiv(elC_q%ONo8wg@c-gKQ#@>62=n&IqahSTS%2W*33V;OCmLObB34};TzH!t&s z%~)>whVrXKsxp7iHvy5w?b+lDJ+=?%1ED9}CXJ(l+=%E;iT)_6Qm|UCfU?#aCU+CR z%j?cImNP`l((lV}H;gKnJDj+-~4|m+K$5!AQqRCd%yq0000ZrE5Jevrh3R~RTp$OX(E>?a{(7A)5T>9ODVw>OJ{e`O$r>c z81UjaUm9tE*}tEiKM*xRBl z=BTcrP((EOv}#l9(a;lzEOa-FCa~K#MXctV-qX5$yzUfzoDC*f%{SGxQa3B~EjkyS zgy+7dixC{UE8-<{pSyLnJAhDP(b@e25nzltN!EwE>8wg(Gz2J9$oCyS8wk4vC;N`WI8dF>52M6nn`WF2a|4w+(q@kdH&la03PxwcYDdn*1_ zTS=v+2_G;zKd8JL-%#Rws~oEo{u(8=>etHuYP*=a%6rH17T$#bWGP$@AsB|342ZD7 zZHUp3tz6~8F-074=@5Z&oA%nN)N6Fgw z_%7HtB5V(!*g$G>vJ|d{#}_x1&Bh6N3VI7r0MJvh5=76Lyc~un$rj^;0?1RCB%^v> z#Y*(529&wXj+4#C35B;8lolJB>!Ee^RIJ3~(~r*9n#%CNDixy^ur{z|2h0AFaoSh^Wn+E*DNkMEl|gZ6%eO zeMG><76gdzP0^?Vsj)rfa|J3t$*Dpb-leHskP#-2}qfIzGm7qh` z!T^pPa6d$(Q5{1`L?>5ec1JHp|E;dV`-=(0+eLy70E!HK ziUJ@a-{eFw)z_M|QP>;T zRQ1c2hyD8bC1DuXYcn&!v)fqDx%7Bx^}cq`GdExK_npxH&8i+;GLQ?pM&8;wq8I*{OkJZkuXdJ4NPNm$>j=(r!&t znBm>^nkKJbzxRDFsRI&@MmPyoR`e1%$Ft?%R~Uve%b84;Ow#yR{z;oj&88V1UM1t5 z%Z8y5JQs6S z$vQYDmD@wM^0is+=wZBPNX^XgBg3F?fUahldY#thS-hVogN#NY;L$AtdRPwE&XV|U zj|9W-?6@+C;tN6ZZEiX3v=0XbdKakH5LMp^p@E6HK;Xfx2Bj8jw~fWH-T`JaSMDpB zJm9GJaMX|i``7BjCRmC);Qb>8wnavz2BM2J%eM*4lekIB@W9y11jaVSL6?c<@1Ng; zi%s`g8KBmp-%irj+1EbvqUozd1LR_wS!-SS2E*_x8*p=`6_b=cF;%9p& Ta?$HR00000NkvXXu0mjfQ_m8? literal 0 HcmV?d00001 diff --git a/resources/mesh_angle.png b/resources/mesh_angle.png new file mode 100644 index 0000000000000000000000000000000000000000..5b03e5776e210888658ad5c354a9a9ca0f83f926 GIT binary patch literal 369 zcmV-%0gnEOP)Zq}6ox-n49}7Wk6a?Bh&rXYQmf`DmFPw@G*hLVf=gsTf&nQEmD~YvOn?U3{1cYU z=l}ih*$T&9^>AMtME*+!ULETHz(DCfbrK08!uoN&2!8RUCemE!wvSP`&)3W^w=b*3 z@X?Yxb?~R>6-o_`A3bE?Fa&k5!!8T|={Zk7Qo_9Z4jpPT%Lx^Efi@b81#Xmlte)^suUd5#d4M@DCjZjhTXp5v;MJw`kHKK=PjWQs%(M9R@mAXZUV+MKn$L1$Gk{ zhCi0qJfK6R`_vVAJ7dz!*k-$#^+=35lt|D<6BGAl?C-#KU`52=)4BQq8Hae6>&y1& P00000NkvXXu0mjf{RyUe literal 0 HcmV?d00001 diff --git a/resources/mesh_area.png b/resources/mesh_area.png new file mode 100644 index 0000000000000000000000000000000000000000..9c51c32edb3aed73cf343b8a982b29e7d20a56b6 GIT binary patch literal 340 zcmV-a0jvIrP)9XJ*-sXHKP6xOjMn#C|VE^4)2Fu@P{w8P|clg#~4M7$+McGHo&uyhy7D{F2&@K znZqe4r__1%Rgu@cDhYq_ANZZOv1aKMwuYtG8glEyb&>njBXBC-#7hh4regb?uF zBO*8)#u`NL0H!eCdO`>Q7;Cz?)~!2K>d}}PtnFZE22eWub70b#C74*jS(m*<^PVPe z%2PQ+*#cXPeAlhL!B78{rfb3q>?trUey(2IfDu)ltJu{2j7c|R$B*NtpG4N7Xu()R mK{1-KzXSV$6_MedZq+Zv18T2Uwb_&a0000D3J^mDFUR3#3?ukE-cwaq)D+}v%7u~ zDI<+!?XJK1=ii4y_}3WpEfCz23e=y0HpB;X&FL|}WqU-r)d+|WeQ2wGPbg4zOT?>I z*W9btR$BK^H1x2(R73N((cM-&v`siQL}yh*A$BSYuS(-wb4xXc^@Z7L#BrlR_IIV+ zD*AOewJ0oG@&U(=f&=30>y5~zqs;{*Kz?i{&^MT)S#KsYN++ysSy z;8Fy1g~B?JW357AuMnI93L8UUS75^$Vz?<5_7w}0V)pj#YzJpxnwdA>``-J$Hw`Rr zUyUlt(s*0wJO2l4a++}TRSXSm@JnFBQTU%UmH`{sn$5yeO~}p#0Ama$H-w|mzA1hV z*uaK|G4VL5naqNvg!I$_c6Yi+F06mDPBcsy+*@YeTtxTYS7d(+(c^^9##ILnWEa9l zPqVEP(lepE^8wK?Asq|Rx29&UTIvj=P-f|Cvn9Q3hYFciJ-?;kci6qVTUXee z`Ak*vWEWMLC7fSQc)=6=o)5s@7ag|O65^4|sIP#3V}gDcXu{^!O~)|(P00Qf(o?5q zEx^K3N&%p~xj0h7^iqibC=kp-u?rvr>%=K4IYcI?ftFMbN1-*jL2{wH z(CnH3e{XNb~p;{Y@D*Q1v3MM2#8A{#(B`Yj%&yB zxouWjD+}FgV56ZMt?#~e6L3dGc()YVb2iFOg~$YqdBFW^6WSh3PNw|CI)lRjT5G^o z8|>g-Z0|H93)udCe|BRxIIy3uMi!I>tl#r3U~d!JPdT!HJ^22>9u1G|Ym)-h$YdbpQYW literal 0 HcmV?d00001 diff --git a/resources/mesh_connectivity.png b/resources/mesh_connectivity.png new file mode 100644 index 0000000000000000000000000000000000000000..9ce3e445574d18cd40e1e36f6dec7732252c3cf4 GIT binary patch literal 346 zcmV-g0j2(lP)O1$YXrAtXhJWTUunj0_QY1to>SG=|pj3@!|KgmWQ_I#Z+-M){RU z2=CtANeYaAjRpWHfn}&Uz=zR|0=u2#cHjQVy>n9&jb~U7sOu9m@biA~FW6O;Rloz? z&ar*9;OkjJWugT{ArEZ#E!R&q-1>m$x9To5RiOE5g6S!+TX&Fq(3Iu&b2|nCfP|{V zv^F1`=)Jx15QV=DDrP~21SxchoI*H_<1+1TTb+cu!bN#tSBDq1~h4JQK(6L5D{>V__ zMh~!A?(pBMw-x)tp88lLk#q{L81EZd_$Sfa@9GTkZpn-eVEFSCh1`R;$r*FeqC-$ zthH2Cg{chHu|h) dcHi26@C)O{mNcsSmRkS-002ovPDHLkV1o0=#l-*s literal 0 HcmV?d00001 diff --git a/resources/mesh_edit.png b/resources/mesh_edit.png new file mode 100644 index 0000000000000000000000000000000000000000..5ad2f1504ea84cae3b94a6c6f2cb4b42130f167a GIT binary patch literal 547 zcmV+;0^I$HP)1j~v(fnhHJ zRy(^3Qi*jK2;B0W>bj?H!0qDvqGJ@7*}x@gdv(-r?qT)|W!FswH^=zl?1iTZRCr0N2Gf7!orM^*ox>0k}k{4i~`M0PWG zH9PYe#yOP)i$-P10$L9QrS^QNlyS4S7dvxIU1{-{*%*U0GfAL(0##uj)KR_4sdvlk zg|4|Kd1&zI=R?cqOiBrR-TvX7cS{S;+wgn>BZtOg6_w4(kHyVsZy-Z|K&H1+h834S zl@*cG&QU-ig!-L0b2!Hi@`Z07D+^m4Z$l8z6{bKslUBJ4I5j%i#C;~T}N9c;cd!I`~{!Ul&1RgQ}>e!HZ!zVVVbLE z-PlHj5U~&jKeIGE6FAxt*%PLj>u;TurHy5u-nSB2H?(y$2lh<{d0NuV#hs1uc9qp2 z7xl_J`pw0%z6osuL>6nQnrEZka5wAc8l4-Q9f%OCovIFhkw0}0000nxgt=Dtl>lcdu%%+L`v@bfcjuPj)yOpvie^^5l3eWD%9@`0Vz<4P-~$euEK-JbCy zgh0m9z|-j()h`fvK-tY~%js;bBOMyDM%7O30C0tC)B%V*K=lihQV8I+e60x^ozsf6 zF(-fl0j0=Vb>F2aMw+j+@A;@sb>qxGJ1R<@E45X|;`6^}2Ah~e5`btD5)qOuRBK=J{M7R&?=uaSS&RO+u1oViPvKbvOl0j$|x3 z|9H;u>(DBS>$!}6RF-8dPZcK11WBu^ApByXP1{pwy6u_^N)dZB=aV3 z7HtuZwVoH(=RA?lO6M{Ur^A3`@51w6OqMg*^U9^Xxz8>iA3}hJ1JH3?hz@kZ1JZe- zV@$uTWzP+X6hlvuzX;O6<5M47uv+`D+D{a+)Wp)~S9e25+N&#;vw-+C%=tLblcX}r zMnnNU2cFNj1ehf|Ps}+`9eAEBQD-=9{t6Q)0V9fs^Ur`chQ(PvZUMq5=4>{dB(?W% zH}Kuv6#56+XGTFFrhD*?qwu*3XUIFT+i;RnxdgVPKx{h$n*>8~K*F{{3S&^0Ln*v* z65_}Ew8*qhyDBlFWKuBJPe=N)DQKA~fXYdPEy5fpVZzaZLqyBl257fBplVrYBLib{ zy1lDON@2-|G-n}Ykg22Ha=|iVz~K=V`;kzKq-6$%*9TeC2vHUzFijhNQUciK>cA#V zcr3_N0IFmzx}z#I$MNpm-nZZtyeri){b- a1^fXkxYyqogPPR<0000z literal 0 HcmV?d00001 diff --git a/resources/mesh_hypo_length.png b/resources/mesh_hypo_length.png new file mode 100644 index 0000000000000000000000000000000000000000..d6106a3ea0e6ce69c1e604444325d650422e4a8c GIT binary patch literal 641 zcmV-{0)G98P)Y65QV?X1W3$fb)i|pQkJrowJ>EVYncOe{uR1$Nyjj(uwk`PTxKze*-SFZnMLf5 zZGmLPvXo}JGdH>!t={c>Z*Qd#UJO0a0$^gJUe1<(FRiuYg_U(;MQbh3=7Jz_a$L#2 zn!^Zz(z#EpmwacY- zyt^8qwFV%%iFho*7YEA*s(DvAe}!oapS%R2yvw& z9DwTqeF8jy-rs=tqcN`rHN{%9ov&zqJdX$ihuwLShua49l%8mGnN){dzPTm{2K=cF zFtJguzYpY$>z=O<=h@LkN5D*f$m%Ya`)T)9Xs!Ei%HcfgMnEtKd89iJ`zCnHl;`4q begS_0=KjG&L)HZ%00000NkvXXu0mjfhteo# literal 0 HcmV?d00001 diff --git a/resources/mesh_hypo_segment.png b/resources/mesh_hypo_segment.png new file mode 100644 index 0000000000000000000000000000000000000000..2d924502382b82403079930585fac2d70928e0d3 GIT binary patch literal 610 zcmV-o0-gPdP)Y65QRTw3{FgCZCTBne_$9`T9~k!$?#6U!fHY~fnlYEG0K$1EMhj3j4Ux7yJJ@% z=`7iDGu@e;lQetp-tN9V1vuU{l_&?0uF~NBX!mbdO1Zo!-F8ztrIfoE3l0ZYr%XCF zeG36ynsYJ%&buRk9-vB;i|-_IDSe9FY5-FW(;qt+U@~A5L9HQPNJwyUDFLV}_%erh zF3~lR;NpcOP18}*gOuZi#99M{2*3ig?+w>xy`E3`b^k(kSf4a&qzT)sba|G$ZC1MN z=D0fW{`#DcHffNuN|cjJiO~j22-Z;UKC20z5dSK%l-MNDW%T7 wO?;0pdGEvDIyxhR(ETwBBE{hL0O4RL!a!q{9xXSL;Yt9oH9<6Lzpj(e{T-9mxj_)&C! zPzUU4^P|@GZ$m_+)vjy%^bcq;UpeoyQ+M0QP9!e*Y7yyb5vhpi03eSc-eiT1hsWE- z(ZvDS1ZSCA*x|7j9Prwgt Wqu1owqKOUw0000+LB49>33jMxnX8U`{5 zqyeT886aEo{>^&^P99DM0U*TgLa57-4Z-Ki7jIrLNB|+og*d&8&j4Zo)-Xi(CMlM( zkg9n04Dn#F zhJvb7qeikV%Pl$iI3ekt-<@<9fPkY)cwD%?fPsu7=ogD0Py(^rPc>z)OrT~TnG-zf z3x-k@h4P?s{GDM93}usVpeifiU%Z2bXi-pL!m)eMmepp+HD+~|TF!4yAbm~+i3kuv zV0=0bnmKFmuujjCOSXpPnzF?Z6 zW~cY3m(yPN?7d}CKeL~OSXAtV!TNCx%ljoP?iLMJqQ$;RduB$mFU`Zl#tIlvNJfbT zh)&wsWo=OTW$&4gEJga1{;C<672Ey8s{HaQ!RV0dJ)d5!8A%knHu)p={kqf|LM%|u&;PXX2e5j z*=eoT{g_}G=`ocC@DyFFAk+EiH7|?u>0#AsdPt3guCZRNAzsFi7y0{8xXU5gCqF^2 zx2t-KfgnK6)dw3W&B2Cz;hRU0oim9$hO_XiuLxX33pF1GL+}IN{13;IF~d&L)9q&4 zsasU%aZh#G_+x7*?wIVFEvU-{_W^FbDH07*qoM6N<$g3)f42LJ#7 literal 0 HcmV?d00001 diff --git a/resources/mesh_line.png b/resources/mesh_line.png new file mode 100644 index 0000000000000000000000000000000000000000..f699e13d8e60fc723d98fc208e782afc85e5af2a GIT binary patch literal 164 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc1|)ksWqE;Awx^3@NX4Awlpp6ELJzpaKF&x` z;O6QV)MWT)Y%nQV;qRV3TYpMLUTn>JP|xOOp>{c7j^3AbSCvi&>`Cu2cLua-1=2eg*K M)78&qol`;+0Cx&G=l}o! literal 0 HcmV?d00001 diff --git a/resources/mesh_line_n.png b/resources/mesh_line_n.png new file mode 100644 index 0000000000000000000000000000000000000000..ce082c63c4af3e040cdc5101ca48cabb1103d518 GIT binary patch literal 363 zcmV-x0hIoUP)5@9qo@C&Y z_3l0E-6=f(iYWM{x@qlEW6xe@wVxpBaj!5?ML6LN%+`2`1Q8+2GxgAL1f!Paw8qtr zrfJ%OM_tbZ9(tOs@l{#zTD$|`R!7oh`m1uTLWzVpiTO^y0MM5=TL0_CrV~zu6wFceO)KYXF+f8J*}!`;$4$@=WPO(`?ScN}mRME@{xD%pnaP zy>L=L@7TTd=EK}o?cVzS_I%s)Ip`)N%QH1pRg?w0&z%>M078!%hO3LswN{lC02)1G zAO6v(AJd{N5NQ`lxMhVOE{1+gQ&Qq2Mxs#5BM=cZx>eV$x*xSyp-29(WtRW|002ov JPDHLkV1mNqpiuw- literal 0 HcmV?d00001 diff --git a/resources/mesh_move_node.png b/resources/mesh_move_node.png new file mode 100644 index 0000000000000000000000000000000000000000..678add55ef7c6878c13f59925a9aadd36d964ccf GIT binary patch literal 285 zcmV+&0pk9NP)u=N~ly^a~EQ|CdNLa}7YdH9p(+h`(^DB{sA1@a_>bEaPj~E002ovPDHLkV1mE-m#_c; literal 0 HcmV?d00001 diff --git a/resources/mesh_pyramid.png b/resources/mesh_pyramid.png new file mode 100644 index 0000000000000000000000000000000000000000..480f5730caa3f3b1babb48bf765a0c5eedf46243 GIT binary patch literal 278 zcmV+x0qOpUP)XE^STd7rDjyTpp#jP?OJBJ` z@BwdnX#~I6N_j+|s-QbP_TXw+VSR##5L`fT0nsIFtJ{$4a$ad@tYKqKw}^Y?Gp%$% z99=pL&`!DhZWeZ{&ZJNNH`IDsCi_k~c^PP((*(?VN~@$0Bu+8ZQe2+%HmLyru`a_4 c?D7lt1ENHgXR*1d3jhEB07*qoM6N<$f+GrWOaK4? literal 0 HcmV?d00001 diff --git a/resources/mesh_pyramid_n.png b/resources/mesh_pyramid_n.png new file mode 100644 index 0000000000000000000000000000000000000000..edde6a59fd181d4ab3807cdd3e5f5e063f1d1b43 GIT binary patch literal 621 zcmV-z0+RiSP)BjU6oo$r4Nsuq88Rqa3|?X~#9QcU+C>m(JO(<2{(zD(^^oRQ1Wy5FlQR@&30^}t zcL?zkus3%o_zec#!JrPZWIfs1dM91Ich5cd+#}UU_^;vQPqhMcLap*$IZAh&VzPCi z5Yc0lC`X}`qVus+tEzLXstPaw^?C$=oJ@DKTmx?)O4Nrx-Vy*go}gZj7&`;ntMg5R z(|O9YRJW5;1_of7WAu9)fVuwyz`>sn>EX$AOM<;BFm*ZyAYR56kceOo#{dLp0i91B zYdWV2Onw~zAR^Rt9dkHF&)O)Zn9invt!1{fy|4dZ28vQ0uQ8btK(`nfjQmLXk0_>ktNIYy2rR=HW4ZHCHGxSorTpT4M^ zVZ&UO!on24ltPT2M~R3aE1`Sdwb%oe&e0%BnTx;*Vu|?&uY&(8vX-^B00000NkvXX Hu0mjf;KLfY literal 0 HcmV?d00001 diff --git a/resources/mesh_quad.png b/resources/mesh_quad.png new file mode 100644 index 0000000000000000000000000000000000000000..1eba33ebb2e0e191c7184c441c21f29da75480a4 GIT binary patch literal 214 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc1|)ksWqEPDf}2yM0f@6sa}7d-Quh?D*Ez!W8Vg%_1S}y-HX#qip|wE1&Fj>uh4md2L${ zF^Y=Fe0=}sZ^?-bnrVUti=t01ZkSj7AX#JY;qnB=r88##*qSBdm3qfTqpt9-hxUiu z&#Eh*1)T@mo_+MSc3EIn_<8=}$FbK=+*xQ@z?^f@Wd1daGigAF OGI+ZBxvX3=k1C8YPXxbm+i6`_WtX03zX8|9%O85`_{4DJ-v- z$p~m_6AEHL4DALWi#^o+%R+3*P38AjUpdqVbf%fh6x=6?VG61`FRHhh@s!_SA{4h$!8aP7N z{=}<Q)y)c>=}{Kr z_a+@mDyU46lLMf&2AIy|Kx1J0vv+wc-V~Q`g8l$Q=Df!&8x-pR0000AaDtHDIh18vwp_ zf{?i~RIcFj+dIvrC(9AQoS`ByBv8b+PJHX6{K%4Jsn>4PYhR{}A=P$^MH9m~=;`~k zdOX#X<5#K{Y5W;yb${t;KAI)0R(Mb4Fb;ENTLauhxY&YCjKb@N?kc7QZk>4CCT`bF zDd##({!XkC+QA$lTP3uON6BDzKUTgh_V*!$&&Hn<)|Q`)|8MyhFP+`Lk&L1M00000 LNkvXXu0mjf!pMl; literal 0 HcmV?d00001 diff --git a/resources/mesh_rem_node.png b/resources/mesh_rem_node.png new file mode 100644 index 0000000000000000000000000000000000000000..c4f2834fc20166fb68db404c3f2f56fadcd07d9d GIT binary patch literal 225 zcmV<703QE|P)Q4BzZPkv#-2FuEmj`v6DN?F@OM`9F7!YvB* z);OIcg%~ux$Hio&zXKRz=!0223^BA}TD+=l|2FF@3u|3>aNUqv_Mg(w{*@2t^a=mK bUjTjpujP) zp||BgVu5+N76M_mPB4k!9w_nhF2^8EMf1vOghqBzZWrOr2X^>-_yIwuh)W(R(|!N| N002ovPDHLkV1ls-Zdm{T literal 0 HcmV?d00001 diff --git a/resources/mesh_set_hypo.png b/resources/mesh_set_hypo.png new file mode 100644 index 0000000000000000000000000000000000000000..68949b83e43af5e07537bcf67b56da58daf332be GIT binary patch literal 235 zcmV->9>~2hL}9CA09I6C*!$_8L#f_a0&`*t%N+uKd|;=)hc{n!PD)E13-bT~002ovPDHLkV1i;^VZ;Cc literal 0 HcmV?d00001 diff --git a/resources/mesh_shading.png b/resources/mesh_shading.png new file mode 100644 index 0000000000000000000000000000000000000000..a2535afaa1a7cfc71815ce1066cb54714c51d715 GIT binary patch literal 352 zcmV-m0iXVfP)Zq}6ox-n3=heJE%g*!!%7$KlmSIONF};55t7eHGPOzAo#NnaR;YT=aW_Lnx6VtCF5PwS9$f%)VNTHj@@w0*5?qS+vF?S{5*vS2+>gvpD~B)pGmUa=YHR|J*k%<^cmr yz9d*<0X8jWE0jV&gDvc)#eCq2&67==Ft7c#iez@Ea_76Y_X&YQw8KUkf0`uui-1C3B-j# zE&|$O##&jUA&}&OjU~aS_kR7B!11Lz`C42I6gb4^JfCdt>xqI3Z5Q_J%E zQlx7b$qp9XXsUI2ux9EGQ+F(XEJ@Y*0BGut^PlJN#!+ZE7lZ#diNMXGtxNQsh78V5 z&t|~Q)dm15B{GvN)B-Y4g*p!O(0x7aVCjdRaU5A)t`1!5MxzR~KNOf9Oej0pT?wMH zgweORTkK!~0$`+SU9!2_&=36#60UD=w|<<<94X~-;G~OR7fIO7pBulK%p|$Yk2{>) zrRD+eTuO;56nT-O3YBoUuj4daU9M*Jy8eC5IF374d)VUJ0#zvAPqj7*gMLXDCTO=aJ Z`UmoH?>WBknMVKs002ovPDHLkV1oI}+pqut literal 0 HcmV?d00001 diff --git a/resources/mesh_skew.png b/resources/mesh_skew.png new file mode 100644 index 0000000000000000000000000000000000000000..45cca1b3ebddfd5c6526bc5745e65af7170f547c GIT binary patch literal 351 zcmV-l0igbgP)15Juky6|+)^93Z#~zJih}Rq!=(1{DIi2zUy?rqKVN71_=Q zf-QF6yqR4YJU7kVZE^nv^wf=4YlE-8bLs3e1)+DynE7_mdqhwd!jy)^x+?Pd{5=YJ z+}u~|G)Ze<7d!=OX7{>7GbK*qkxQAHTgUGBa|FPJZv2-2YPWsa0w95~aEk%pOgjLP z9Om4J;U#tiIk*kH#x8WM9#*Djc#Rzte@gSI%t_Y{DBj@(tq$4Mz%z%Y3`L}}8w8fG zUR8U5_0xK?NDlOv=p*uJk`gB|B7zHDs}+F#+a6UNE!Z-YK(L`@$r3BJH=8o53K^XA xgbi&z$3dV7j@(Lu{%pz|z7Aehk*wa=%r8fkYkv-HcUk}d002ovPDHLkV1mX)mb(A| literal 0 HcmV?d00001 diff --git a/resources/mesh_taper.png b/resources/mesh_taper.png new file mode 100644 index 0000000000000000000000000000000000000000..68dbc66e6d8b02d6bc439066f7004534d4dd1dd8 GIT binary patch literal 393 zcmV;40e1e0P)b;z6hL1f!;h4~Y@7k9r$Ak(dZ7whiJ~5$Vyd`8#6r7NoC2w5$Pg(EmGD684yi*z z?0{7Iw>aO=@BeQH7%m!}%i{h47<&H%m1Y=%bMyQ_-=>yGmWeqFXnt|4>87^c3A)_e z56bU6%UenYUZ)=bygkBbGN2Q5oq6-;IeM>2v(z&bPl=<+!RFh1m3G_DEdVN3{wZ5K z8@AlhWKaXoo@M|@DD+g%0c;t-YPu=Gw+~n4x<~<2%42wJ=K>$w5f3tu^dnr*}kgRP@ma6hTo~ nN!aX-jrIH5Xswa`A+H)g;gEB`b!?|z00000NkvXXu0mjflJu}g literal 0 HcmV?d00001 diff --git a/resources/mesh_tetra.png b/resources/mesh_tetra.png new file mode 100644 index 0000000000000000000000000000000000000000..6812d5b68623ae785eeb1875885a7defa2297e86 GIT binary patch literal 267 zcmV+m0rdWfP)tt3Wm2L-P25{Q|9WsISv+ R@8JLd002ovPDHLkV1nJSaO400 literal 0 HcmV?d00001 diff --git a/resources/mesh_tetra_n.png b/resources/mesh_tetra_n.png new file mode 100644 index 0000000000000000000000000000000000000000..fa4d0fae9cf96049c3acb676ff2b347fed6d5df9 GIT binary patch literal 585 zcmV-P0=E5$P)Pp zhzR{bKOn$h2*SP5N|s$s4ZsN>{oQK0B8npt5*)0GaJyFu9ZY(2^!O0%`S}U(|Cky#w?)P1~wXpu69{^2$9z~kPr z-}{1<{`uHl7*>)9oCztu7Q5En6kOz)G!Zz8-M%zTMGct zTU!vVb^Z8qu#<~o7^I^VwJiEgVxbu}0T_NA0&xBPy8fr+az`$AUhO^;5t29|yUhS- zwwfh{h9Lc!n$>c}V!0rR6MG+40hJk8HFNsqG^os(>{n*gTCrJgh$Le8ZCG-D-{AcV XvqBA?DVDM%00000NkvXXu0mjf)!YSG literal 0 HcmV?d00001 diff --git a/resources/mesh_tree_algo.png b/resources/mesh_tree_algo.png new file mode 100644 index 0000000000000000000000000000000000000000..61b11bbdd529e9db5f988fd3efeb3c7b1a0eb565 GIT binary patch literal 169 zcmeAS@N?(olHy`uVBq!ia0vp^d?3uh1|;P@bT0y_0#6smkcv5LCtc)iP~dS{-&QJf zbS96nAs6#i`QGph*B;*=FAnZzTI+DJeZne%=PY9WHB2_|S9%1Cm2@AeI%%4+t@dq9 z!L=ZUsG`uIw~x-K@ybNIJmR*vCvo6^$e%CAPR8%Ot#=_&K9hk*A}IXAAGuEcrdvO^ SI!*xE&EV9Th$SfbOEWWb zhXuOXy!*jF<>)HG6`944Q+X2aSH;@+9bL>BJBKw=*le;R!|X(z7Lf#Fj>{`m7;a^= vSW8NYx@5atXJP7Cp{8_cWA>8p2Mi3y9?M94f1vRWXbpp>tDnm{r-UW|uA44F literal 0 HcmV?d00001 diff --git a/resources/mesh_tree_algo_mefisto.png b/resources/mesh_tree_algo_mefisto.png new file mode 100644 index 0000000000000000000000000000000000000000..5375071b54a0235db4aab0908907fcd9bfc27927 GIT binary patch literal 182 zcmeAS@N?(olHy`uVBq!ia0vp^d?3uh1|;P@bT0y_T2B|pkcv5T18?&lP~foXd2P{U zYUf9R^(awR5ir8s`esn^`O#AiAxFUk;( z5T1QNFeO0gU+L!NsfQw2gtxz5uDsyUJC|N}3A+m>t6W!o3u1U4l5+U&&Q;IDub(WL g=^Cq$*`GV7C)Swb*7-7PphFluUHx3vIVCg!0R8qsGynhq literal 0 HcmV?d00001 diff --git a/resources/mesh_tree_algo_quad.png b/resources/mesh_tree_algo_quad.png new file mode 100644 index 0000000000000000000000000000000000000000..fe6ce0285194cbf77f4e60f5037107ed61e71fca GIT binary patch literal 161 zcmeAS@N?(olHy`uVBq!ia0vp^d?3uh1|;P@bT0y_3{Mxwkcv55Ctl=jP~dTi?|p5+ zWh|IpB*MPRUd*E*!0_Jpy?4H9X?WkdW^m)K-^yK@mzpl=*UO1B7`AF{G@6~bY|abD zB(4P_jbwRycV^>rv&$d)l@mD5HROfzUue=VWtLeWE6ihdX9mzt22WQ% Jmvv4FO#qEwH{<{S literal 0 HcmV?d00001 diff --git a/resources/mesh_tree_algo_regular.png b/resources/mesh_tree_algo_regular.png new file mode 100644 index 0000000000000000000000000000000000000000..ecd1f73513bff745ff9c2792adedbb267c7c1243 GIT binary patch literal 134 zcmeAS@N?(olHy`uVBq!ia0vp^d?3uh1|;P@bT0xaUr!gukcv6UDL>9Th$SfbOHVp> z)_1z+mf!YF`FVT($j|H-U(7AAR&usN;H*MVfh#@!LhI9<{0^<0Iiumgs+l()9KYaG ivS(pt+LG!hR)*b7Q_fFo`TP%PFoUP7pUXO@geCxkJ}^W8 literal 0 HcmV?d00001 diff --git a/resources/mesh_tree_hypo.png b/resources/mesh_tree_hypo.png new file mode 100644 index 0000000000000000000000000000000000000000..3ab76a6e821acf3a04e4deea24d30022fb5d624c GIT binary patch literal 153 zcmeAS@N?(olHy`uVBq!ia0vp^d?3uh1|;P@bT0y_1Wy;okcv4|1097J6giq?|Nl?@ zcEv9{<)p5#t3r$DoK;M|>~i62IP%K4FG?A%?5MBpUt|4gxzA+zC11ZzmdKI;Vst08QsI AhX4Qo literal 0 HcmV?d00001 diff --git a/resources/mesh_tree_hypo_area.png b/resources/mesh_tree_hypo_area.png new file mode 100644 index 0000000000000000000000000000000000000000..22c8bd0ae432ef2c82e1f1ff986fd1504916df88 GIT binary patch literal 163 zcmeAS@N?(olHy`uVBq!ia0vp^d?3uh1|;P@bT0y_EKe85kcv5TCtl<|pupiGpZCtE z?~%jx{%cvLY&xAEL+&{q5!kQ9n80DZ*~52A%x=dMPy8l2s9rCxk8=sXfAuI=w%`3m z<1MD0Au+e?SH9S`t98$LPG|XohP#0snOEMboRO}N%450^@z_G|PU$YuKhvB-fwnSu My85}Sb4q9e0QO=%PXGV_ literal 0 HcmV?d00001 diff --git a/resources/mesh_tree_hypo_length.png b/resources/mesh_tree_hypo_length.png new file mode 100644 index 0000000000000000000000000000000000000000..abe34f5b471fc0d2a5cc125876e71850fcc22753 GIT binary patch literal 153 zcmeAS@N?(olHy`uVBq!ia0vp^d?3uh1|;P@bT0y_1Wy;okcv5LCk65yP~dQme*AZR zjJ?^MgAb>yiC23X=)$SEbkboNjblIWX;1vfDtxQiEil2IXW4?&t;ucLK6V% Ct~ww9 literal 0 HcmV?d00001 diff --git a/resources/mesh_tree_hypo_segment.png b/resources/mesh_tree_hypo_segment.png new file mode 100644 index 0000000000000000000000000000000000000000..1957e6d8fcc13868f52bcef9e4ff24dec42702a7 GIT binary patch literal 142 zcmeAS@N?(olHy`uVBq!ia0vp^d?3uh1|;P@bT0y_P)`@fkcwN$DL>9Th$S#i?(w+w zpSjY7LG9C<#SxF|HzXgdD88J!sOD^kZoxn0PNPR3K0Evry!+ST`9Xs``~T`a=H^VM qi#rX4<`!KL;{40pUa@=;BSZIAb@@e)6y1RqFnGH9xvX5*q7TeYt*E~)vzopr04Xy)_W%F@ literal 0 HcmV?d00001 diff --git a/resources/mesh_tree_mesh.png b/resources/mesh_tree_mesh.png new file mode 100644 index 0000000000000000000000000000000000000000..2a2ff57d6cc9a180a9070b0f1ccdf199293dde72 GIT binary patch literal 186 zcmeAS@N?(olHy`uVBq!ia0vp^d?3uh1|;P@bT0y_Mo$;Vkcv5TgKqO4P~fncweGRT zxhn>f7h4GYUBMsV)2mXWa7TNhg2k%WJkJ<2&o{64m|)+;x2Bzmso}^@VGEV-OG5mV zSv}|6)(SE>(lCWhrSPBH*R&|#;A3eUH@%LF`kHknoI~yCkCu7O2}N0KAK16l{mWdC0kclv8BYj8T}CeSeqp00i_>zopr0H_~FqyPW_ literal 0 HcmV?d00001 diff --git a/resources/mesh_tree_mesh_warn.png b/resources/mesh_tree_mesh_warn.png new file mode 100644 index 0000000000000000000000000000000000000000..d61b873c365922b18529c5db8154dccb4beeff01 GIT binary patch literal 166 zcmeAS@N?(olHy`uVBq!ia0vp^d?3uh1|;P@bT0y_Tu&Frkcv5TCk1jHFyL^We6J?` zR$$qJH_5VF1yV21*HU?+soE0OJMXNdq{NKRKU|y?RGvQD*vaUS;F&1g?7(#5d9TQ| z3c2u|;Y&7JdwrcF73{nq^6i^N6}Jn|>A&+bxn9zd`DnS&5BGhczt`U@J+3XVWO7X= P&|(HpS3j3^P6drMSwiW1k^7*G(8iQkKvmRf9kG1n2r5WoF$jb_`%1@3qzp1wU z%R+$~7p?^fnsZ7|FgEp9#63u>mOb@JPo`^*jmU?vDcAN`*xFf!pDI}!ugB)~Sm5hI zi`!BYws~{+uol(c2-7(u_Vd;>+3x@Pr$rvGF7{Z#-+n1^`4!n!%>1pFg8MIDm@5l( ODTAl0pUXO@geCw$PfFgClC?li}`uD1?!+u zAbmXm01N;uuFADnD6&;yx5+2Us)UjX_xicFc=V2r1ki z^)owy-=;@cpf`6D?J4Sa28?q601?3$0|3yIJepjn_sGF4m@A1lkCF<>T>>Q)h$srI zs~UQz-ND?|-$MPx#uzMLmToRv6*iQntV$$E+<|<^bLL>&xP#Htw#h~}k|-z$DL}jf zMj|ZFhxz3RDIlciNpjMM=J7iY+qGG@8i(d*vCAP_6;@AjXO$2}lAxrDcF}*JH?#g& zyHYNJoh-SF{caB&;A})R3~PV`w~Q}-Os~@!dbb5ESh`7VU9}#g#$&!8&jW)X-t=*T or022Afx)lo3`<1l`t;KH16dNM0za#rVE_OC07*qoM6N<$fCrBx8JevJnL-~ULohd)8xBt;Q^47LLyDI>GzIbq zd4>#uXgD|x26a%a^WU~ZejpIC{Lxq6uOtt{yVi&I#ex6N8Q#Di4BpuEafKcR4^!Se zQ#V(i>^HfSy~T#srv^1EzMgUW^A>=sA6IU?d?*n@F#kOF{;seCOIIl`uP>;*B3ow; zu9QOU6}8$vu%j-%o{=mQwAKhA2qz)YG$NP;G6rf;o#H>AsSmYc=7dY6qc17n%qiLYzhOI^5)q9CRrvXStgBH!>!m9MsAxP z)+%?>sJ-Ii+Xd+=ZKWGb0v6xfDwAc>3ap*7hY2170E$h)+v^+Jx4>u`A$&3DaR<>K zky~lcR;61Cn}O8o0IM#H2*Ysr9M(UU4<+HW4{DYW!olLNvDdpPaw}awK95IX=_<8A zUx0r+HiM5t`KvT)uX+IhWb3SD#p(3ase_TLCxk#$g8VM$pbr4fQ?*yeRKo}{5l-Ex sLa@h2YYU*lfdK*$fN#TSK3xF60l(h+Ph!VND*ylh07*qoM6N<$f^!J;;s5{u literal 0 HcmV?d00001 diff --git a/resources/mesh_vertex.png b/resources/mesh_vertex.png new file mode 100644 index 0000000000000000000000000000000000000000..b85d63a13b0d7ace6de162c8ed8427ab33ef18e9 GIT binary patch literal 104 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc1|)ksWqE;=zNd?0NX4Awlpp6ELJzpaK6c}k zk!0H>5OT0%O3;5}1ECje-zQuBm0Z=Q0r>mdKI;Vst03&1_ AbN~PV literal 0 HcmV?d00001 diff --git a/resources/mesh_vertex_n.png b/resources/mesh_vertex_n.png new file mode 100644 index 0000000000000000000000000000000000000000..dfbafc9459f0a87e916f7d5a8f5b2c961729cc2d GIT binary patch literal 235 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc1|)ksWqEBOF-JySSM+m8hcsRX_|rBEZb z;eD0H+JuBf^PU8)+9i-zeemkM3uU@(w;9UI1OK}V2MKv;M?`3>bvWsxz{$)!sUl4x j_*i4h*T3f<@;CCYIjGRoEhoAI=z0cES3j3^P6&Cb(<`H~x$+?AejeA{7pY3ahXEU#?pHwTI$@yK0{uam!wA z`km&M9aUfrTDT$xmpvq@r4~eWb26ae&>s*Hbhfz!EnH&GhWR!#{Z5F;l1O7Hm5%LT z0qCSdMChce3L<+li9`>JL-f+&@%yNB_O}AIgGICeaDUu0kUy47_C6LQwqRw+N!6Uq z0uU)mOpjJ2+rctjC+6E6Oy2_eC{KCyE=*7FgKc&wTA=6Y(Y9dQ!1bZhvkTpF literal 0 HcmV?d00001 diff --git a/resources/mesh_wrap.png b/resources/mesh_wrap.png new file mode 100644 index 0000000000000000000000000000000000000000..c919168bc71dd3bf5ed3a72e199dab1a1590a3e5 GIT binary patch literal 454 zcmV;%0XhDOP)8Y~A}B-Aucf^Z{zbcqj&-1i)%jT~xQ*E714z>}G{?p(DIZJB%1}O)m{&uVW)$;6O)4}igQV@L`@=r| z|7s{7O8~Mo^G%rq+S)Q>7G;PClE_Jii+SPef12)4>-V*@2kTYMvKf-L5D^)gH!-u3 wLP-RjYOc9Pr`p$M%E@J5ciDSueQkal-z+|vCd{+j5dZ)H07*qoM6N<$f)9|(iU0rr literal 0 HcmV?d00001 diff --git a/resources/select1.png b/resources/select1.png new file mode 100644 index 0000000000000000000000000000000000000000..99ebde65e86ffe25badbb1507f0286abbabd99ec GIT binary patch literal 976 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc3?z4jzqMyzU}gyL32{Ag(ZBjoa^c8=d#Wzp$P!dS9t;e literal 0 HcmV?d00001 diff --git a/src/DriverDAT/DriverDAT_R_SMDS_Mesh.cxx b/src/DriverDAT/DriverDAT_R_SMDS_Mesh.cxx new file mode 100644 index 000000000..72e0d30b6 --- /dev/null +++ b/src/DriverDAT/DriverDAT_R_SMDS_Mesh.cxx @@ -0,0 +1,175 @@ +using namespace std; +#include "DriverDAT_R_SMDS_Mesh.h" + +#include "utilities.h" + +DriverDAT_R_SMDS_Mesh::DriverDAT_R_SMDS_Mesh() { +; +} + +DriverDAT_R_SMDS_Mesh::~DriverDAT_R_SMDS_Mesh() { +; +} + +void DriverDAT_R_SMDS_Mesh::SetMesh(Handle(SMDS_Mesh)& aMesh) { + myMesh = aMesh; +} + +void DriverDAT_R_SMDS_Mesh::SetFile(string aFile) { + myFile = aFile; +} + +void DriverDAT_R_SMDS_Mesh::SetFileId(FILE* aFileId) { + myFileId = aFileId; +} + +void DriverDAT_R_SMDS_Mesh::SetMeshId(int aMeshId) { + myMeshId = aMeshId; +} + +void DriverDAT_R_SMDS_Mesh::Add() { + ; +} + +void DriverDAT_R_SMDS_Mesh::Read() { + + int i,j; + int nbNodes,nbCells; + int intNumPoint; + float coordX, coordY, coordZ; + int nbNoeuds; + + int intNumMaille,Degre; + int ValElement; + int ValDegre; + int NoeudsMaille[20]; + int NoeudMaille; + + bool ok; + + MESSAGE("in DriverDAT_R_SMDS_Mesh::Read()"); + /**************************************************************************** + * OUVERTURE DU FICHIER EN LECTURE * + ****************************************************************************/ + char* file2Read = (char*)myFile.c_str(); + myFileId = fopen(file2Read,"r"); + if (myFileId < 0) + { + fprintf(stderr,">> ERREUR : ouverture du fichier %s \n",file2Read); + exit(EXIT_FAILURE); + } + + fscanf(myFileId,"%d %d\n",&nbNodes,&nbCells); + + /**************************************************************************** + * LECTURE DES NOEUDS * + ****************************************************************************/ + fprintf(stdout,"\n(************************)\n"); + fprintf(stdout,"(* NOEUDS DU MAILLAGE : *)\n"); + fprintf(stdout,"(************************)\n"); + + for (i=0;iAddNodeWithID(coordX,coordY,coordZ,intNumPoint); + } + + fprintf(stdout,"%d noeuds\n",myMesh->NbNodes()); + /**************************************************************************** + * LECTURE DES ELEMENTS * + ****************************************************************************/ + fprintf(stdout,"\n(**************************)\n"); + fprintf(stdout,"(* ELEMENTS DU MAILLAGE : *)\n"); + fprintf(stdout,"(**************************)"); + + fprintf(stdout,"%d elements\n",nbCells); + + for (i=0; iAddEdgeWithID(NoeudsMaille[0],NoeudsMaille[1],intNumMaille); + break; + } + case 204 : ; + case 208 : ; + { + ValDegre=9; + nbNoeuds=4; + ok = myMesh->AddFaceWithID(NoeudsMaille[0],NoeudsMaille[1],NoeudsMaille[2],NoeudsMaille[3],intNumMaille); + break; + } + case 203 : ; + case 206 : ; + { + ValDegre=5; + nbNoeuds=3; + ok = myMesh->AddFaceWithID(NoeudsMaille[0],NoeudsMaille[1],NoeudsMaille[2],intNumMaille); + break; + } + case 308 : ; + case 320 : ; + { + ValDegre=12; + nbNoeuds=8; + if (ValElement==320) { + //A voir, correspondance VTK + NoeudsMaille[4]=NoeudsMaille[8]; + NoeudsMaille[5]=NoeudsMaille[9]; + NoeudsMaille[6]=NoeudsMaille[10]; + NoeudsMaille[7]=NoeudsMaille[11]; + } + ok = myMesh->AddVolumeWithID(NoeudsMaille[0],NoeudsMaille[1],NoeudsMaille[2],NoeudsMaille[3],NoeudsMaille[4],NoeudsMaille[5],NoeudsMaille[6],NoeudsMaille[7],intNumMaille); + break; + } + case 304 : ; + case 310 : ; + { + ValDegre=10; + nbNoeuds=4; + if (ValElement==310) + NoeudsMaille[3]=NoeudsMaille[6]; + ok = myMesh->AddVolumeWithID(NoeudsMaille[0],NoeudsMaille[1],NoeudsMaille[2],NoeudsMaille[3],intNumMaille); + break; + } + case 306 : ; + case 315 : ; + { + ValDegre=12; + nbNoeuds=8; + if (ValElement==315) { + NoeudsMaille[3]=NoeudsMaille[6]; + NoeudsMaille[4]=NoeudsMaille[7]; + NoeudsMaille[5]=NoeudsMaille[8]; + } + NoeudsMaille[7]=NoeudsMaille[5]; + NoeudsMaille[6]=NoeudsMaille[5]; + NoeudsMaille[5]=NoeudsMaille[4]; + NoeudsMaille[4]=NoeudsMaille[3]; + NoeudsMaille[3]=NoeudsMaille[2]; + ok = myMesh->AddVolumeWithID(NoeudsMaille[0],NoeudsMaille[1],NoeudsMaille[2],NoeudsMaille[3],NoeudsMaille[4],NoeudsMaille[5],intNumMaille); + break; + } + + } + } + + /**************************************************************************** + * FERMETURE DU FICHIER * + ****************************************************************************/ + fclose(myFileId); + +} diff --git a/src/DriverDAT/DriverDAT_R_SMDS_Mesh.h b/src/DriverDAT/DriverDAT_R_SMDS_Mesh.h new file mode 100644 index 000000000..0a8a86a29 --- /dev/null +++ b/src/DriverDAT/DriverDAT_R_SMDS_Mesh.h @@ -0,0 +1,30 @@ +#ifndef _INCLUDE_DRIVERDAT_R_SMDS_MESH +#define _INCLUDE_DRIVERDAT_R_SMDS_MESH + +#include + +#include "SMDS_Mesh.hxx" +#include "Mesh_Reader.h" + +class DriverDAT_R_SMDS_Mesh : public Mesh_Reader { + + public : + DriverDAT_R_SMDS_Mesh(); + ~DriverDAT_R_SMDS_Mesh(); + + void Add(); + void Read(); + void SetMesh(Handle(SMDS_Mesh)& aMesh); + void SetFile(string); + + void SetFileId(FILE*); + void SetMeshId(int); + + private : + Handle_SMDS_Mesh myMesh; + string myFile; + FILE* myFileId; + int myMeshId; + +}; +#endif diff --git a/src/DriverDAT/DriverDAT_R_SMESHDS_Document.cxx b/src/DriverDAT/DriverDAT_R_SMESHDS_Document.cxx new file mode 100644 index 000000000..a079dbd46 --- /dev/null +++ b/src/DriverDAT/DriverDAT_R_SMESHDS_Document.cxx @@ -0,0 +1,86 @@ +using namespace std; +#include "DriverDAT_R_SMESHDS_Document.h" +#include "DriverDAT_R_SMESHDS_Mesh.h" + +#include "utilities.h" + +int getOne() { + printf("in getOne"); + return (1); +} + +extern "C" { + // Document_Reader* maker() { + DriverDAT_R_SMESHDS_Document* maker() { + fprintf(stdout,"here in maker\n"); + return new DriverDAT_R_SMESHDS_Document; + } +} + +DriverDAT_R_SMESHDS_Document::DriverDAT_R_SMESHDS_Document() { + myFile = string(""); +} + +DriverDAT_R_SMESHDS_Document::~DriverDAT_R_SMESHDS_Document() { +; +} + +//void DriverDAT_R_SMESHDS_Document::SetFile(string aFile) { +//myFile = aFile; +//} + +//void DriverDAT_R_SMESHDS_Document::SetDocument(Handle(SMESHDS_Document)& aDoc) { +//myDocument = aDoc; +//} + +void DriverDAT_R_SMESHDS_Document::Read() { + + int myMeshId; + MESSAGE("in read"); + SCRUTE(myFile); + //Handle(SMESHDS_Document) myDocument = new SMESHDS_Document(1); + + /**************************************************************************** + * OUVERTURE DU FICHIER EN LECTURE * + ****************************************************************************/ + char* file2Read = (char*)myFile.c_str(); + FILE* fid = fopen(file2Read,"r"); + if (fid < 0) + { + fprintf(stderr,">> ERREUR : ouverture du fichier %s \n",file2Read); + exit(EXIT_FAILURE); + } + + /**************************************************************************** + * COMBIEN DE MAILLAGES ? * + ****************************************************************************/ + int nmaa = 1; + + /**************************************************************************** + * FERMETURE DU FICHIER * + ****************************************************************************/ + fclose(fid); + + printf("Nombre de maillages = %d\n",nmaa); + + string myClass = string("SMESHDS_Mesh"); + string myExtension = string("DAT"); + + for (int meshIt=1;meshIt<=nmaa;meshIt++) { + myMeshId = myDocument->NewMesh(); + + Handle(SMDS_Mesh) myMesh = myDocument->GetMesh(myMeshId); + + DriverDAT_R_SMESHDS_Mesh* myReader = new DriverDAT_R_SMESHDS_Mesh; + + + myReader->SetMesh(myMesh); + myReader->SetFile(myFile); + //myReader->SetFileId(fid); + + myReader->Read(); + + } + + +} diff --git a/src/DriverDAT/DriverDAT_R_SMESHDS_Document.h b/src/DriverDAT/DriverDAT_R_SMESHDS_Document.h new file mode 100644 index 000000000..83b67b5dd --- /dev/null +++ b/src/DriverDAT/DriverDAT_R_SMESHDS_Document.h @@ -0,0 +1,24 @@ +#ifndef _INCLUDE_DRIVERDAT_R_SMESHDS_DOCUMENT +#define _INCLUDE_DRIVERDAT_R_SMESHDS_DOCUMENT + +#include + +#include "SMESHDS_Document.hxx" +#include "Document_Reader.h" + +class DriverDAT_R_SMESHDS_Document : public Document_Reader { + +public : + DriverDAT_R_SMESHDS_Document(); + ~DriverDAT_R_SMESHDS_Document(); + + void Read(); + //void SetFile(string); + //void SetDocument(Handle_SMESHDS_Document&); + +private : + //Handle_SMESHDS_Document myDocument; + //string myFile; + +}; +#endif diff --git a/src/DriverDAT/DriverDAT_R_SMESHDS_Mesh.cxx b/src/DriverDAT/DriverDAT_R_SMESHDS_Mesh.cxx new file mode 100644 index 000000000..56fe86969 --- /dev/null +++ b/src/DriverDAT/DriverDAT_R_SMESHDS_Mesh.cxx @@ -0,0 +1,52 @@ +using namespace std; +#include "DriverDAT_R_SMESHDS_Mesh.h" +#include "DriverDAT_R_SMDS_Mesh.h" + +#include "utilities.h" + +DriverDAT_R_SMESHDS_Mesh::DriverDAT_R_SMESHDS_Mesh() { +; +} + +DriverDAT_R_SMESHDS_Mesh::~DriverDAT_R_SMESHDS_Mesh() { +; +} + +void DriverDAT_R_SMESHDS_Mesh::SetMesh(Handle(SMDS_Mesh)& aMesh) { + //myMesh = Handle(SMESHDS_Mesh)::DownCast(aMesh); + myMesh = aMesh; +} + +void DriverDAT_R_SMESHDS_Mesh::SetFile(string aFile) { + myFile = aFile; +} + +void DriverDAT_R_SMESHDS_Mesh::SetFileId(FILE* aFileId) { + myFileId = aFileId; +} + +void DriverDAT_R_SMESHDS_Mesh::SetMeshId(int aMeshId) { + myMeshId = aMeshId; +} + +void DriverDAT_R_SMESHDS_Mesh::Add() { + ; +} + +void DriverDAT_R_SMESHDS_Mesh::Read() { + string myClass = string("SMDS_Mesh"); + string myExtension = string("DAT"); + + MESSAGE("in DriverDAT_R_SMESHDS_Mesh::Read() 1"); + DriverDAT_R_SMDS_Mesh* myReader = new DriverDAT_R_SMDS_Mesh; + + MESSAGE("in DriverDAT_R_SMESHDS_Mesh::Read() 2"); + myReader->SetMesh(myMesh); + MESSAGE("in DriverDAT_R_SMESHDS_Mesh::Read() 3"); + myReader->SetFile(myFile); + //myReader->SetFileId(myFileId); + + MESSAGE("in DriverDAT_R_SMESHDS_Mesh::Read() 4"); + myReader->Read(); + +} diff --git a/src/DriverDAT/DriverDAT_R_SMESHDS_Mesh.h b/src/DriverDAT/DriverDAT_R_SMESHDS_Mesh.h new file mode 100644 index 000000000..bbcbd0064 --- /dev/null +++ b/src/DriverDAT/DriverDAT_R_SMESHDS_Mesh.h @@ -0,0 +1,30 @@ +#ifndef _INCLUDE_DRIVERDAT_R_SMESHDS_MESH +#define _INCLUDE_DRIVERDAT_R_SMESHDS_MESH + +#include + +#include "SMESHDS_Mesh.hxx" +#include "Mesh_Reader.h" + +class DriverDAT_R_SMESHDS_Mesh : public Mesh_Reader { + + public : + DriverDAT_R_SMESHDS_Mesh(); + ~DriverDAT_R_SMESHDS_Mesh(); + + void Add(); + void Read(); + void SetMesh(Handle(SMDS_Mesh)& aMesh); + void SetFile(string); + + void SetFileId(FILE*); + void SetMeshId(int); + +private : + Handle_SMDS_Mesh myMesh; + string myFile; + FILE* myFileId; + int myMeshId; + +}; +#endif diff --git a/src/DriverDAT/DriverDAT_W_SMDS_Mesh.cxx b/src/DriverDAT/DriverDAT_W_SMDS_Mesh.cxx new file mode 100644 index 000000000..0cc429ccc --- /dev/null +++ b/src/DriverDAT/DriverDAT_W_SMDS_Mesh.cxx @@ -0,0 +1,164 @@ +using namespace std; +#include "DriverDAT_W_SMDS_Mesh.h" + +#include "SMDS_MeshElement.hxx" +#include "SMDS_MeshNode.hxx" +#include "SMDS_MeshEdgesIterator.hxx" +#include "SMDS_MeshFacesIterator.hxx" +#include "SMDS_MeshNodesIterator.hxx" +#include "SMDS_MeshVolumesIterator.hxx" + +#include "utilities.h" + +DriverDAT_W_SMDS_Mesh::DriverDAT_W_SMDS_Mesh() { +; +} + +DriverDAT_W_SMDS_Mesh::~DriverDAT_W_SMDS_Mesh() { +; +} + +void DriverDAT_W_SMDS_Mesh::SetMesh(Handle(SMDS_Mesh)& aMesh) { + myMesh = aMesh; +} + +void DriverDAT_W_SMDS_Mesh::SetFile(string aFile) { + myFile = aFile; +} + +void DriverDAT_W_SMDS_Mesh::SetFileId(FILE* aFileId) { + myFileId = aFileId; +} + +void DriverDAT_W_SMDS_Mesh::SetMeshId(int aMeshId) { + myMeshId = aMeshId; +} + +void DriverDAT_W_SMDS_Mesh::Add() { + ; +} + +void DriverDAT_W_SMDS_Mesh::Write() { + + int nbNodes,nbCells; + int i; + + char* file2Read = (char*)myFile.c_str(); + myFileId = fopen(file2Read,"w+"); + if (myFileId < 0) + { + fprintf(stderr,">> ERREUR : ouverture du fichier %s \n",file2Read); + exit(EXIT_FAILURE); + } + SCRUTE(myMesh); + /**************************************************************************** + * NOMBRES D'OBJETS * + ****************************************************************************/ + fprintf(stdout,"\n(****************************)\n"); + fprintf(stdout,"(* INFORMATIONS GENERALES : *)\n"); + fprintf(stdout,"(****************************)\n"); + + /* Combien de noeuds ? */ + nbNodes = myMesh->NbNodes(); + + /* Combien de mailles, faces ou aretes ? */ + Standard_Integer nb_of_nodes, nb_of_edges,nb_of_faces, nb_of_volumes; + nb_of_edges = myMesh->NbEdges(); + nb_of_faces = myMesh->NbFaces(); + nb_of_volumes = myMesh->NbVolumes(); + nbCells = nb_of_edges + nb_of_faces + nb_of_volumes; + SCRUTE(nb_of_edges); + SCRUTE(nb_of_faces); + SCRUTE(nb_of_volumes); + + fprintf(stdout,"%d %d\n",nbNodes,nbCells); + fprintf(myFileId,"%d %d\n",nbNodes,nbCells); + + /**************************************************************************** + * ECRITURE DES NOEUDS * + ****************************************************************************/ + fprintf(stdout,"\n(************************)\n"); + fprintf(stdout,"(* NOEUDS DU MAILLAGE : *)\n"); + fprintf(stdout,"(************************)\n"); + + SMDS_MeshNodesIterator itNodes(myMesh); + for (;itNodes.More();itNodes.Next()) { + const Handle(SMDS_MeshElement)& elem = itNodes.Value(); + const Handle(SMDS_MeshNode)& node = myMesh->GetNode(1,elem); + + fprintf(myFileId,"%d %e %e %e\n",node->GetID(),node->X(),node->Y(),node->Z()); + } + + /**************************************************************************** + * ECRITURE DES ELEMENTS * + ****************************************************************************/ + fprintf(stdout,"\n(**************************)\n"); + fprintf(stdout,"(* ELEMENTS DU MAILLAGE : *)\n"); + fprintf(stdout,"(**************************)"); + /* Ecriture des connectivites, noms, numeros des mailles */ + + SMDS_MeshEdgesIterator itEdges(myMesh); + for (;itEdges.More();itEdges.Next()) { + const Handle(SMDS_MeshElement)& elem = itEdges.Value(); + + switch (elem->NbNodes()) { + case 2 : { + fprintf(myFileId,"%d %d ",elem->GetID(),102); + break; + } + case 3 : { + fprintf(myFileId,"%d %d ",elem->GetID(),103); + break; + } + } + + for (i=0;iNbNodes();i++) + fprintf(myFileId,"%d ",elem->GetConnection(i+1)); + + fprintf(myFileId,"\n"); + } + + SMDS_MeshFacesIterator itFaces(myMesh); + for (;itFaces.More();itFaces.Next()) { + const Handle(SMDS_MeshElement)& elem = itFaces.Value(); + + switch (elem->NbNodes()) { + case 3 : { + fprintf(myFileId,"%d %d ",elem->GetID(),203); + break; + } + case 4 : { + fprintf(myFileId,"%d %d ",elem->GetID(),204); + break; + } + case 6 : { + fprintf(myFileId,"%d %d ",elem->GetID(),206); + break; + } + } + + for (i=0;iNbNodes();i++) + fprintf(myFileId,"%d ",elem->GetConnection(i+1)); + + fprintf(myFileId,"\n"); + } + + SMDS_MeshVolumesIterator itVolumes(myMesh); + for (;itVolumes.More();itVolumes.Next()) { + const Handle(SMDS_MeshElement)& elem = itVolumes.Value(); + + switch (elem->NbNodes()) { + case 8 : { + fprintf(myFileId,"%d %d ",elem->GetID(),308); + break; + } + } + + for (i=0;iNbNodes();i++) + fprintf(myFileId,"%d ",elem->GetConnection(i+1)); + + fprintf(myFileId,"\n"); + } + + fclose (myFileId); +} diff --git a/src/DriverDAT/DriverDAT_W_SMDS_Mesh.h b/src/DriverDAT/DriverDAT_W_SMDS_Mesh.h new file mode 100644 index 000000000..06056db18 --- /dev/null +++ b/src/DriverDAT/DriverDAT_W_SMDS_Mesh.h @@ -0,0 +1,31 @@ +#ifndef _INCLUDE_DRIVERDAT_W_SMDS_MESH +#define _INCLUDE_DRIVERDAT_W_SMDS_MESH + +#include +#include + +#include "SMDS_Mesh.hxx" +#include "Mesh_Writer.h" + +class DriverDAT_W_SMDS_Mesh : public Mesh_Writer { + + public : + DriverDAT_W_SMDS_Mesh(); + ~DriverDAT_W_SMDS_Mesh(); + + void Add(); + void Write(); + void SetMesh(Handle(SMDS_Mesh)& aMesh); + void SetFile(string); + + void SetFileId(FILE*); + void SetMeshId(int); + +private : + Handle_SMDS_Mesh myMesh; + string myFile; + FILE* myFileId; + int myMeshId; + +}; +#endif diff --git a/src/DriverDAT/DriverDAT_W_SMESHDS_Document.cxx b/src/DriverDAT/DriverDAT_W_SMESHDS_Document.cxx new file mode 100644 index 000000000..1cdb67b37 --- /dev/null +++ b/src/DriverDAT/DriverDAT_W_SMESHDS_Document.cxx @@ -0,0 +1,78 @@ +using namespace std; +#include "DriverDAT_W_SMESHDS_Document.h" +#include "DriverDAT_W_SMESHDS_Mesh.h" + +#include "utilities.h" + +extern "C" +{ + Document_Writer* Wmaker() { + return new DriverDAT_W_SMESHDS_Document; + } +} + +DriverDAT_W_SMESHDS_Document::DriverDAT_W_SMESHDS_Document() { +; +} + +DriverDAT_W_SMESHDS_Document::~DriverDAT_W_SMESHDS_Document() { +; +} + +//void DriverDAT_W_SMESHDS_Document::SetFile(string aFile) { +//myFile = aFile; +//} + +//void DriverDAT_W_SMESHDS_Document::SetDocument(Handle(SMESHDS_Document)& aDocument) { +//myDocument = aDocument; +//} + +void DriverDAT_W_SMESHDS_Document::Write() { + + Handle(SMESHDS_Mesh) myMesh; + + /**************************************************************************** + * OUVERTURE DU FICHIER EN ECRITURE * + ****************************************************************************/ + char* file2Write = (char*)myFile.c_str(); + FILE* fid = fopen(file2Write,"w+"); + if (fid < 0) + { + fprintf(stderr,">> ERREUR : ouverture du fichier %s \n",file2Write); + exit(EXIT_FAILURE); + } + + /**************************************************************************** + * FERMETURE DU FICHIER * + ****************************************************************************/ + + fclose(fid); + + /******** Nombre de maillages ********/ + int nb_of_meshes = myDocument->NbMeshes(); //voir avec Yves + //nb_of_meshes = 1; + int numero = 0; + + string myClass = string("SMESHDS_Mesh"); + string myExtension = string("DAT"); + + //while (numeroGetMesh(numero); + myDocument->InitMeshesIterator(); + for (;myDocument->MoreMesh();myDocument->NextMesh()) { + numero++; + myMesh = myDocument->CurrentMesh(); + + DriverDAT_W_SMESHDS_Mesh* myWriter = new DriverDAT_W_SMESHDS_Mesh; + //Mesh_Writer* myWriter = Driver::GetMeshWriter(myExtension, myClass); + + myWriter->SetMesh(myMesh); + myWriter->SetFile(myFile); + SCRUTE(myMesh); + //myWriter->SetFileId(fid); + myWriter->SetMeshId(numero); + myWriter->Write(); + } + +} diff --git a/src/DriverDAT/DriverDAT_W_SMESHDS_Document.h b/src/DriverDAT/DriverDAT_W_SMESHDS_Document.h new file mode 100644 index 000000000..58df6cd9d --- /dev/null +++ b/src/DriverDAT/DriverDAT_W_SMESHDS_Document.h @@ -0,0 +1,25 @@ +#ifndef _INCLUDE_DRIVERDAT_W_SMESHDS_DOCUMENT +#define _INCLUDE_DRIVERDAT_W_SMESHDS_DOCUMENT + +#include +#include + +#include "SMESHDS_Document.hxx" +#include "Document_Writer.h" + +class DriverDAT_W_SMESHDS_Document : public Document_Writer { + +public : + DriverDAT_W_SMESHDS_Document(); + ~DriverDAT_W_SMESHDS_Document(); + + void Write(); + //void SetFile(string); + //void SetDocument(Handle(SMESHDS_Document)&); + +private : + //Handle_SMESHDS_Document myDocument; + //string myFile; + +}; +#endif diff --git a/src/DriverDAT/DriverDAT_W_SMESHDS_Mesh.cxx b/src/DriverDAT/DriverDAT_W_SMESHDS_Mesh.cxx new file mode 100644 index 000000000..9f202370c --- /dev/null +++ b/src/DriverDAT/DriverDAT_W_SMESHDS_Mesh.cxx @@ -0,0 +1,175 @@ +using namespace std; +#include "DriverDAT_W_SMESHDS_Mesh.h" +#include "DriverDAT_W_SMDS_Mesh.h" + +#include "SMDS_MeshElement.hxx" +#include "SMDS_MeshNode.hxx" +#include "SMDS_MeshEdgesIterator.hxx" +#include "SMDS_MeshFacesIterator.hxx" +#include "SMDS_MeshNodesIterator.hxx" +#include "SMDS_MeshVolumesIterator.hxx" + +#include "utilities.h" + +DriverDAT_W_SMESHDS_Mesh::DriverDAT_W_SMESHDS_Mesh() { +; +} + +DriverDAT_W_SMESHDS_Mesh::~DriverDAT_W_SMESHDS_Mesh() { +; +} + +void DriverDAT_W_SMESHDS_Mesh::SetMesh(Handle(SMDS_Mesh)& aMesh) { + //myMesh = Handle(SMESHDS_Mesh)::DownCast(aMesh); + myMesh = aMesh; +} + +void DriverDAT_W_SMESHDS_Mesh::SetFile(string aFile) { + myFile = aFile; +} + +void DriverDAT_W_SMESHDS_Mesh::SetFileId(FILE* aFileId) { + myFileId = aFileId; +} + +void DriverDAT_W_SMESHDS_Mesh::SetMeshId(int aMeshId) { + myMeshId = aMeshId; +} + +void DriverDAT_W_SMESHDS_Mesh::Write() { + + string myClass = string("SMDS_Mesh"); + string myExtension = string("DAT"); + + DriverDAT_W_SMDS_Mesh* myWriter = new DriverDAT_W_SMDS_Mesh; + + myWriter->SetMesh(myMesh); + myWriter->SetFile(myFile); + myWriter->SetMeshId(myMeshId); + //myWriter->SetFileId(myFileId); + + myWriter->Write(); + + +} +void DriverDAT_W_SMESHDS_Mesh::Add() { + int nbNodes,nbCells; + int i; + + char* file2Read = (char*)myFile.c_str(); + myFileId = fopen(file2Read,"w+"); + if (myFileId < 0) + { + fprintf(stderr,">> ERREUR : ouverture du fichier %s \n",file2Read); + exit(EXIT_FAILURE); + } + + /**************************************************************************** + * NOMBRES D'OBJETS * + ****************************************************************************/ + fprintf(stdout,"\n(****************************)\n"); + fprintf(stdout,"(* INFORMATIONS GENERALES : *)\n"); + fprintf(stdout,"(****************************)\n"); + + /* Combien de noeuds ? */ + nbNodes = myMesh->NbNodes(); + + /* Combien de mailles, faces ou aretes ? */ + Standard_Integer nb_of_nodes, nb_of_edges,nb_of_faces, nb_of_volumes; + nb_of_edges = myMesh->NbEdges(); + nb_of_faces = myMesh->NbFaces(); + nb_of_volumes = myMesh->NbVolumes(); + nbCells = nb_of_edges + nb_of_faces + nb_of_volumes; + + fprintf(stdout,"%d %d\n",nbNodes,nbCells); + fprintf(myFileId,"%d %d\n",nbNodes,nbCells); + + /**************************************************************************** + * ECRITURE DES NOEUDS * + ****************************************************************************/ + fprintf(stdout,"\n(************************)\n"); + fprintf(stdout,"(* NOEUDS DU MAILLAGE : *)\n"); + fprintf(stdout,"(************************)\n"); + + SMDS_MeshNodesIterator itNodes(myMesh); + for (;itNodes.More();itNodes.Next()) { + const Handle(SMDS_MeshElement)& elem = itNodes.Value(); + const Handle(SMDS_MeshNode)& node = myMesh->GetNode(1,elem); + + fprintf(myFileId,"%d %e %e %e\n",node->GetID(),node->X(),node->Y(),node->Z()); + } + + /**************************************************************************** + * ECRITURE DES ELEMENTS * + ****************************************************************************/ + fprintf(stdout,"\n(**************************)\n"); + fprintf(stdout,"(* ELEMENTS DU MAILLAGE : *)\n"); + fprintf(stdout,"(**************************)"); + /* Ecriture des connectivites, noms, numeros des mailles */ + + SMDS_MeshEdgesIterator itEdges(myMesh); + for (;itEdges.More();itEdges.Next()) { + const Handle(SMDS_MeshElement)& elem = itEdges.Value(); + + switch (elem->NbNodes()) { + case 2 : { + fprintf(myFileId,"%d %d ",elem->GetID(),102); + break; + } + case 3 : { + fprintf(myFileId,"%d %d ",elem->GetID(),103); + break; + } + } + + for (i=0;iNbNodes();i++) + fprintf(myFileId,"%d ",elem->GetConnection(i+1)); + + fprintf(myFileId,"\n"); + } + + SMDS_MeshFacesIterator itFaces(myMesh); + for (;itFaces.More();itFaces.Next()) { + const Handle(SMDS_MeshElement)& elem = itFaces.Value(); + + switch (elem->NbNodes()) { + case 3 : { + fprintf(myFileId,"%d %d ",elem->GetID(),203); + break; + } + case 4 : { + fprintf(myFileId,"%d %d ",elem->GetID(),204); + break; + } + case 6 : { + fprintf(myFileId,"%d %d ",elem->GetID(),206); + break; + } + } + + for (i=0;iNbNodes();i++) + fprintf(myFileId,"%d ",elem->GetConnection(i+1)); + + fprintf(myFileId,"\n"); + } + + SMDS_MeshVolumesIterator itVolumes(myMesh); + for (;itVolumes.More();itVolumes.Next()) { + const Handle(SMDS_MeshElement)& elem = itVolumes.Value(); + + switch (elem->NbNodes()) { + case 8 : { + fprintf(myFileId,"%d %d ",elem->GetID(),308); + break; + } + } + + for (i=0;iNbNodes();i++) + fprintf(myFileId,"%d ",elem->GetConnection(i+1)); + + fprintf(myFileId,"\n"); + } + + fclose (myFileId); +} + diff --git a/src/DriverDAT/DriverDAT_W_SMESHDS_Mesh.h b/src/DriverDAT/DriverDAT_W_SMESHDS_Mesh.h new file mode 100644 index 000000000..fe7e02de2 --- /dev/null +++ b/src/DriverDAT/DriverDAT_W_SMESHDS_Mesh.h @@ -0,0 +1,31 @@ +#ifndef _INCLUDE_DRIVERDAT_W_SMESHDS_MESH +#define _INCLUDE_DRIVERDAT_W_SMESHDS_MESH + +#include +#include + +#include "SMESHDS_Mesh.hxx" +#include "Mesh_Writer.h" + +class DriverDAT_W_SMESHDS_Mesh : public Mesh_Writer { + + public : + DriverDAT_W_SMESHDS_Mesh(); + ~DriverDAT_W_SMESHDS_Mesh(); + + void Add(); + void Write(); + void SetMesh(Handle(SMDS_Mesh)& aMesh); + void SetFile(string); + + void SetFileId(FILE*); + void SetMeshId(int); + +private : + Handle_SMDS_Mesh myMesh; + string myFile; + FILE* myFileId; + int myMeshId; + +}; +#endif diff --git a/src/DriverDAT/Makefile.in b/src/DriverDAT/Makefile.in new file mode 100644 index 000000000..a4c404d0c --- /dev/null +++ b/src/DriverDAT/Makefile.in @@ -0,0 +1,39 @@ +# -* Makefile *- +# +# Author : Marc Tajchman (CEA) +# Date : 5/07/2001 +# $Header$ +# + +# source path +top_srcdir=@top_srcdir@ +top_builddir=../.. +srcdir=@srcdir@ +VPATH=.:@srcdir@ + + +@COMMENCE@ + +# header files +EXPORT_HEADERS= DriverDAT_R_SMDS_Mesh.h DriverDAT_R_SMESHDS_Mesh.h DriverDAT_R_SMESHDS_Document.h DriverDAT_W_SMDS_Mesh.h DriverDAT_W_SMESHDS_Mesh.h DriverDAT_W_SMESHDS_Document.h + +# Libraries targets +LIB = libMeshDriverDAT.la +LIB_SRC = DriverDAT_R_SMDS_Mesh.cxx DriverDAT_R_SMESHDS_Mesh.cxx DriverDAT_R_SMESHDS_Document.cxx DriverDAT_W_SMDS_Mesh.cxx DriverDAT_W_SMESHDS_Mesh.cxx DriverDAT_W_SMESHDS_Document.cxx + +LIB_CLIENT_IDL = + +LIB_SERVER_IDL = + +# additionnal information to compil and link file +CPPFLAGS += $(OCC_INCLUDES) +CXXFLAGS += $(OCC_CXXFLAGS) $(MED2_INCLUDES) +LDFLAGS += $(OCC_LIBS) $(MED2_LIBS) -lMeshDriver + +%_moc.cxx: %.h + $(MOC) $< -o $@ + +@CONCLUDE@ + + + diff --git a/src/DriverMED/DriverMED_R_SMDS_Mesh.cxx b/src/DriverMED/DriverMED_R_SMDS_Mesh.cxx index 3109feb44..3a1ea510e 100644 --- a/src/DriverMED/DriverMED_R_SMDS_Mesh.cxx +++ b/src/DriverMED/DriverMED_R_SMDS_Mesh.cxx @@ -1,3 +1,4 @@ +using namespace std; #include "DriverMED_R_SMDS_Mesh.h" #include "utilities.h" diff --git a/src/DriverMED/DriverMED_R_SMESHDS_Document.cxx b/src/DriverMED/DriverMED_R_SMESHDS_Document.cxx index 4624786aa..60f3d5a5b 100644 --- a/src/DriverMED/DriverMED_R_SMESHDS_Document.cxx +++ b/src/DriverMED/DriverMED_R_SMESHDS_Document.cxx @@ -1,3 +1,4 @@ +using namespace std; #include "DriverMED_R_SMESHDS_Document.h" #include "DriverMED_R_SMESHDS_Mesh.h" #include "utilities.h" diff --git a/src/DriverMED/DriverMED_R_SMESHDS_Mesh.cxx b/src/DriverMED/DriverMED_R_SMESHDS_Mesh.cxx index 8e7ce6fcf..ada67b7ba 100644 --- a/src/DriverMED/DriverMED_R_SMESHDS_Mesh.cxx +++ b/src/DriverMED/DriverMED_R_SMESHDS_Mesh.cxx @@ -1,3 +1,4 @@ +using namespace std; #include "DriverMED_R_SMESHDS_Mesh.h" #include "DriverMED_R_SMDS_Mesh.h" #include "utilities.h" diff --git a/src/DriverMED/DriverMED_W_SMDS_Mesh.cxx b/src/DriverMED/DriverMED_W_SMDS_Mesh.cxx index 8e99c3774..be29c546e 100644 --- a/src/DriverMED/DriverMED_W_SMDS_Mesh.cxx +++ b/src/DriverMED/DriverMED_W_SMDS_Mesh.cxx @@ -1,3 +1,4 @@ +using namespace std; #include "DriverMED_W_SMDS_Mesh.h" #include "SMDS_MeshElement.hxx" diff --git a/src/DriverMED/DriverMED_W_SMESHDS_Document.cxx b/src/DriverMED/DriverMED_W_SMESHDS_Document.cxx index e88007459..8bfda5b31 100644 --- a/src/DriverMED/DriverMED_W_SMESHDS_Document.cxx +++ b/src/DriverMED/DriverMED_W_SMESHDS_Document.cxx @@ -1,3 +1,4 @@ +using namespace std; #include "DriverMED_W_SMESHDS_Document.h" #include "DriverMED_W_SMESHDS_Mesh.h" #include "utilities.h" diff --git a/src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx b/src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx index 312870edd..07845bb5f 100644 --- a/src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx +++ b/src/DriverMED/DriverMED_W_SMESHDS_Mesh.cxx @@ -1,3 +1,4 @@ +using namespace std; #include "DriverMED_W_SMESHDS_Mesh.h" #include "DriverMED_W_SMDS_Mesh.h" @@ -186,15 +187,65 @@ void DriverMED_W_SMESHDS_Mesh::Add() { /* calcul de la dimension */ mdim=2; double epsilon=0.00001; + double nodeRefX; + double nodeRefY; + double nodeRefZ; + + bool dimX = true; + bool dimY = true; + bool dimZ = true; + SMDS_MeshNodesIterator myItNodes(myMesh); + int inode = 0; for (;myItNodes.More();myItNodes.Next()) { const Handle(SMDS_MeshElement)& elem = myItNodes.Value(); const Handle(SMDS_MeshNode)& node = myMesh->GetNode(1,elem); - if ( fabs(node->Z()) > epsilon ) { - mdim=3; + if ( inode == 0 ) { + nodeRefX = fabs(node->X()); + nodeRefY = fabs(node->Y()); + nodeRefZ = fabs(node->Z()); + } + SCRUTE( inode ); + SCRUTE( nodeRefX ); + SCRUTE( nodeRefY ); + SCRUTE( nodeRefZ ); + + if ( inode !=0 ) { + if ( (fabs(fabs(node->X()) - nodeRefX) > epsilon ) && dimX ) + dimX = false; + if ( (fabs(fabs(node->Y()) - nodeRefY) > epsilon ) && dimY ) + dimY = false; + if ( (fabs(fabs(node->Z()) - nodeRefZ) > epsilon ) && dimZ ) + dimZ = false; + } + if ( !dimX && !dimY && !dimZ ) { + mdim = 3; break; } + inode++; } + + if ( mdim != 3 ) { + if ( dimX && dimY && dimZ ) + mdim = 0; + else if ( !dimX ) { + if ( dimY && dimZ ) + mdim = 1; + else if (( dimY && !dimZ ) || ( !dimY && dimZ ) ) + mdim = 2; + } else if ( !dimY ) { + if ( dimX && dimZ ) + mdim = 1; + else if (( dimX && !dimZ ) || ( !dimX && dimZ ) ) + mdim = 2; + } else if ( !dimZ ) { + if ( dimY && dimX ) + mdim = 1; + else if (( dimY && !dimX ) || ( !dimY && dimX ) ) + mdim = 2; + } + } + MESSAGE ( " mdim " << mdim ); /* creation du maillage */ @@ -339,8 +390,18 @@ void DriverMED_W_SMESHDS_Mesh::Add() { coo[i*3+1]=node->Y(); coo[i*3+2]=node->Z(); } else { - coo[i*2]=node->X(); - coo[i*2+1]=node->Y(); + if ( dimX ) { + coo[i*2]=node->Y(); + coo[i*2+1]=node->Z(); + } + if ( dimY ) { + coo[i*2]=node->X(); + coo[i*2+1]=node->Z(); + } + if ( dimZ ) { + coo[i*2]=node->X(); + coo[i*2+1]=node->Y(); + } } mapNoeud[node->GetID()] = i+1; diff --git a/src/DriverMED/Makefile.in b/src/DriverMED/Makefile.in index c3d9880bb..b8446eba1 100644 --- a/src/DriverMED/Makefile.in +++ b/src/DriverMED/Makefile.in @@ -7,7 +7,7 @@ # source path top_srcdir=@top_srcdir@ -top_builddir=../../.. +top_builddir=../.. srcdir=@srcdir@ VPATH=.:@srcdir@ diff --git a/src/DriverUNV/DriverUNV_R_SMDS_Mesh.cxx b/src/DriverUNV/DriverUNV_R_SMDS_Mesh.cxx new file mode 100644 index 000000000..b9de018aa --- /dev/null +++ b/src/DriverUNV/DriverUNV_R_SMDS_Mesh.cxx @@ -0,0 +1,153 @@ +using namespace std; +#include "DriverUNV_R_SMDS_Mesh.h" + +#include "utilities.h" + +DriverUNV_R_SMDS_Mesh::DriverUNV_R_SMDS_Mesh() { +; +} + +DriverUNV_R_SMDS_Mesh::~DriverUNV_R_SMDS_Mesh() { +; +} + +void DriverUNV_R_SMDS_Mesh::SetMesh(Handle(SMDS_Mesh)& aMesh) { + myMesh = aMesh; +} + +void DriverUNV_R_SMDS_Mesh::SetFile(string aFile) { + myFile = aFile; +} + +void DriverUNV_R_SMDS_Mesh::SetFileId(FILE* aFileId) { + myFileId = aFileId; +} + +void DriverUNV_R_SMDS_Mesh::SetMeshId(int aMeshId) { + myMeshId = aMeshId; +} + +void DriverUNV_R_SMDS_Mesh::Add() { + ; +} + +void DriverUNV_R_SMDS_Mesh::Read() { + + int cell=0,node=0,n1,n2,n3,n4,n_nodes,nodes[6],blockId,i; + char *s1,*s2,*s3; + string str1,str2,str3; + int i1=0; + bool ok, found_block2411, found_block2412; + + /**************************************************************************** + * OUVERTURE DU FICHIER EN LECTURE * + ****************************************************************************/ + char* file2Read = (char*)myFile.c_str(); + myFileId = fopen(file2Read,"r"); + if (myFileId < 0) + { + fprintf(stderr,">> ERREUR : ouverture du fichier %s \n",file2Read); + exit(EXIT_FAILURE); + } + + s1 = (char*) malloc(sizeof(char)*100); + s2 = (char*) malloc(sizeof(char)*100); + s3 = (char*) malloc(sizeof(char)*100); + + found_block2411 = false; + found_block2412 = false; + + do { + + while (i1==-1) { + fscanf(myFileId,"%d\n",&blockId); + switch (blockId) { + case 2411 : { + MESSAGE("BlockId "<AddNodeWithID(atof(str1.c_str()),atof(str2.c_str()),atof(str3.c_str()),node); + fscanf(myFileId,"%d",&node); + } + i1=0; + found_block2411 = true; + break; + } + case 2412 : { + MESSAGE("BlockId "<AddFaceWithID(nodes[0],nodes[1],nodes[2],cell); + } + else if (n_nodes==6) {//206 + for (i=1;i<=n_nodes;i++) + fscanf(myFileId,"%d",&nodes[i-1]); + ok = myMesh->AddFaceWithID(nodes[0],nodes[2],nodes[4],cell); + } + } + + else if ((n1==11)||(n1==21)||(n1==24)||(n1==25)) {//103 + fgets(s2,100,myFileId); + if (n_nodes==3) { + for (i=1;i<=n_nodes;i++) + fscanf(myFileId,"%d",&nodes[i-1]); + ok = myMesh->AddEdgeWithID(nodes[0],nodes[1],cell); + //MESSAGE("in 103 "<AddEdgeWithID(nodes[0],nodes[1],cell); + //MESSAGE("in 102 "< + +#include "SMDS_Mesh.hxx" +#include "Mesh_Reader.h" + +class DriverUNV_R_SMDS_Mesh : public Mesh_Reader { + + public : + DriverUNV_R_SMDS_Mesh(); + ~DriverUNV_R_SMDS_Mesh(); + + void Add(); + void Read(); + void SetMesh(Handle(SMDS_Mesh)& aMesh); + void SetFile(string); + + void SetFileId(FILE*); + void SetMeshId(int); + + private : + Handle_SMDS_Mesh myMesh; + string myFile; + FILE* myFileId; + int myMeshId; + +}; +#endif diff --git a/src/DriverUNV/DriverUNV_R_SMESHDS_Document.cxx b/src/DriverUNV/DriverUNV_R_SMESHDS_Document.cxx new file mode 100644 index 000000000..8debd497b --- /dev/null +++ b/src/DriverUNV/DriverUNV_R_SMESHDS_Document.cxx @@ -0,0 +1,85 @@ +using namespace std; +#include "DriverUNV_R_SMESHDS_Document.h" +#include "DriverUNV_R_SMESHDS_Mesh.h" + +#include "utilities.h" + +int getOne() { + printf("in getOne"); + return (1); +} + +extern "C" { + // Document_Reader* maker() { + DriverUNV_R_SMESHDS_Document* maker() { + fprintf(stdout,"here in maker\n"); + return new DriverUNV_R_SMESHDS_Document; + } +} + +DriverUNV_R_SMESHDS_Document::DriverUNV_R_SMESHDS_Document() { + myFile = string(""); +} + +DriverUNV_R_SMESHDS_Document::~DriverUNV_R_SMESHDS_Document() { +; +} + +//void DriverUNV_R_SMESHDS_Document::SetFile(string aFile) { +//myFile = aFile; +//} + +//void DriverUNV_R_SMESHDS_Document::SetDocument(Handle(SMESHDS_Document)& aDoc) { +//myDocument = aDoc; +//} + +void DriverUNV_R_SMESHDS_Document::Read() { + + int myMeshId; + SCRUTE(myFile); + //Handle(SMESHDS_Document) myDocument = new SMESHDS_Document(1); + + /**************************************************************************** + * OUVERTURE DU FICHIER EN LECTURE * + ****************************************************************************/ + char* file2Read = (char*)myFile.c_str(); + FILE* fid = fopen(file2Read,"r"); + if (fid < 0) + { + fprintf(stderr,">> ERREUR : ouverture du fichier %s \n",file2Read); + exit(EXIT_FAILURE); + } + + /**************************************************************************** + * COMBIEN DE MAILLAGES ? * + ****************************************************************************/ + int nmaa = 1; + + /**************************************************************************** + * FERMETURE DU FICHIER * + ****************************************************************************/ + fclose(fid); + + printf("Nombre de maillages = %d\n",nmaa); + + string myClass = string("SMESHDS_Mesh"); + string myExtension = string("UNV"); + + for (int meshIt=1;meshIt<=nmaa;meshIt++) { + myMeshId = myDocument->NewMesh(); + + Handle(SMDS_Mesh) myMesh = myDocument->GetMesh(myMeshId); + + DriverUNV_R_SMESHDS_Mesh* myReader = new DriverUNV_R_SMESHDS_Mesh; + + + myReader->SetMesh(myMesh); + myReader->SetFile(myFile); + //myReader->SetFileId(fid); + + myReader->Read(); + + } + + +} diff --git a/src/DriverUNV/DriverUNV_R_SMESHDS_Document.h b/src/DriverUNV/DriverUNV_R_SMESHDS_Document.h new file mode 100644 index 000000000..9fbd04f3a --- /dev/null +++ b/src/DriverUNV/DriverUNV_R_SMESHDS_Document.h @@ -0,0 +1,24 @@ +#ifndef _INCLUDE_DRIVERUNV_R_SMESHDS_DOCUMENT +#define _INCLUDE_DRIVERUNV_R_SMESHDS_DOCUMENT + +#include + +#include "SMESHDS_Document.hxx" +#include "Document_Reader.h" + +class DriverUNV_R_SMESHDS_Document : public Document_Reader { + +public : + DriverUNV_R_SMESHDS_Document(); + ~DriverUNV_R_SMESHDS_Document(); + + void Read(); + //void SetFile(string); + //void SetDocument(Handle_SMESHDS_Document&); + +private : + //Handle_SMESHDS_Document myDocument; + //string myFile; + +}; +#endif diff --git a/src/DriverUNV/DriverUNV_R_SMESHDS_Mesh.cxx b/src/DriverUNV/DriverUNV_R_SMESHDS_Mesh.cxx new file mode 100644 index 000000000..849a523d0 --- /dev/null +++ b/src/DriverUNV/DriverUNV_R_SMESHDS_Mesh.cxx @@ -0,0 +1,48 @@ +using namespace std; +#include "DriverUNV_R_SMESHDS_Mesh.h" +#include "DriverUNV_R_SMDS_Mesh.h" + +#include "utilities.h" + +DriverUNV_R_SMESHDS_Mesh::DriverUNV_R_SMESHDS_Mesh() { +; +} + +DriverUNV_R_SMESHDS_Mesh::~DriverUNV_R_SMESHDS_Mesh() { +; +} + +void DriverUNV_R_SMESHDS_Mesh::SetMesh(Handle(SMDS_Mesh)& aMesh) { + //myMesh = Handle(SMESHDS_Mesh)::DownCast(aMesh); + myMesh = aMesh; +} + +void DriverUNV_R_SMESHDS_Mesh::SetFile(string aFile) { + myFile = aFile; +} + +void DriverUNV_R_SMESHDS_Mesh::SetFileId(FILE* aFileId) { + myFileId = aFileId; +} + +void DriverUNV_R_SMESHDS_Mesh::SetMeshId(int aMeshId) { + myMeshId = aMeshId; +} + +void DriverUNV_R_SMESHDS_Mesh::Add() { + ; +} + +void DriverUNV_R_SMESHDS_Mesh::Read() { + string myClass = string("SMDS_Mesh"); + string myExtension = string("UNV"); + + DriverUNV_R_SMDS_Mesh* myReader = new DriverUNV_R_SMDS_Mesh; + + myReader->SetMesh(myMesh); + myReader->SetFile(myFile); + //myReader->SetFileId(myFileId); + + myReader->Read(); + +} diff --git a/src/DriverUNV/DriverUNV_R_SMESHDS_Mesh.h b/src/DriverUNV/DriverUNV_R_SMESHDS_Mesh.h new file mode 100644 index 000000000..0c3a7e6fa --- /dev/null +++ b/src/DriverUNV/DriverUNV_R_SMESHDS_Mesh.h @@ -0,0 +1,30 @@ +#ifndef _INCLUDE_DRIVERUNV_R_SMESHDS_MESH +#define _INCLUDE_DRIVERUNV_R_SMESHDS_MESH + +#include + +#include "SMESHDS_Mesh.hxx" +#include "Mesh_Reader.h" + +class DriverUNV_R_SMESHDS_Mesh : public Mesh_Reader { + + public : + DriverUNV_R_SMESHDS_Mesh(); + ~DriverUNV_R_SMESHDS_Mesh(); + + void Add(); + void Read(); + void SetMesh(Handle(SMDS_Mesh)& aMesh); + void SetFile(string); + + void SetFileId(FILE*); + void SetMeshId(int); + +private : + Handle_SMDS_Mesh myMesh; + string myFile; + FILE* myFileId; + int myMeshId; + +}; +#endif diff --git a/src/DriverUNV/DriverUNV_W_SMDS_Mesh.cxx b/src/DriverUNV/DriverUNV_W_SMDS_Mesh.cxx new file mode 100644 index 000000000..6bf42e674 --- /dev/null +++ b/src/DriverUNV/DriverUNV_W_SMDS_Mesh.cxx @@ -0,0 +1,196 @@ +using namespace std; +#include "DriverUNV_W_SMDS_Mesh.h" + +#include "SMDS_MeshElement.hxx" +#include "SMDS_MeshNode.hxx" +#include "SMDS_MeshEdgesIterator.hxx" +#include "SMDS_MeshFacesIterator.hxx" +#include "SMDS_MeshNodesIterator.hxx" +#include "SMDS_MeshVolumesIterator.hxx" + +#include + +#define sNODE_UNV_ID " 2411" +#define sELT_UNV_ID " 2412" +#define sUNV_SEPARATOR " -1" +#define sNODE_UNV_DESCR "%10d 1 1 11\n" +#define sELT_SURF_DESC "%10d %2d 1 1 11 %1d\n" +#define sELT_VOLU_DESC "%10d %2d 1 1 9 %1d\n" +#define sELT_BEAM_DESC1 "%10d %2d 1 1 7 %1d\n" +#define sELT_BEAM_DESC2 " 0 1 1\n" + +DriverUNV_W_SMDS_Mesh::DriverUNV_W_SMDS_Mesh() { +; +} + +DriverUNV_W_SMDS_Mesh::~DriverUNV_W_SMDS_Mesh() { +; +} + +void DriverUNV_W_SMDS_Mesh::SetMesh(Handle(SMDS_Mesh)& aMesh) { + myMesh = aMesh; +} + +void DriverUNV_W_SMDS_Mesh::SetFile(string aFile) { + myFile = aFile; +} + +void DriverUNV_W_SMDS_Mesh::SetFileId(FILE* aFileId) { + myFileId = aFileId; +} + +void DriverUNV_W_SMDS_Mesh::SetMeshId(int aMeshId) { + myMeshId = aMeshId; +} + +void DriverUNV_W_SMDS_Mesh::Add() { + ; +} + +void DriverUNV_W_SMDS_Mesh::Write() { + + int nbNodes,nbCells; + int i; + + char* file2Read = (char*)myFile.c_str(); + myFileId = fopen(file2Read,"w+"); + if (myFileId < 0) + { + fprintf(stderr,">> ERREUR : ouverture du fichier %s \n",file2Read); + exit(EXIT_FAILURE); + } + SCRUTE(myMesh); + /**************************************************************************** + * NOMBRES D'OBJETS * + ****************************************************************************/ + fprintf(stdout,"\n(****************************)\n"); + fprintf(stdout,"(* INFORMATIONS GENERALES : *)\n"); + fprintf(stdout,"(****************************)\n"); + + /* Combien de noeuds ? */ + nbNodes = myMesh->NbNodes(); + + /* Combien de mailles, faces ou aretes ? */ + Standard_Integer nb_of_nodes, nb_of_edges,nb_of_faces, nb_of_volumes; + nb_of_edges = myMesh->NbEdges(); + nb_of_faces = myMesh->NbFaces(); + nb_of_volumes = myMesh->NbVolumes(); + nbCells = nb_of_edges + nb_of_faces + nb_of_volumes; + SCRUTE(nb_of_edges); + SCRUTE(nb_of_faces); + SCRUTE(nb_of_volumes); + + fprintf(stdout,"%d %d\n",nbNodes,nbCells); + fprintf(myFileId,"%d %d\n",nbNodes,nbCells); + + /**************************************************************************** + * ECRITURE DES NOEUDS * + ****************************************************************************/ + fprintf(stdout,"\n(************************)\n"); + fprintf(stdout,"(* NOEUDS DU MAILLAGE : *)\n"); + fprintf(stdout,"(************************)\n"); + + SMDS_MeshNodesIterator itNodes(myMesh); + + fprintf(myFileId,"%s\n", sUNV_SEPARATOR); + fprintf(myFileId,"%s\n", sNODE_UNV_ID ); + + for (;itNodes.More();itNodes.Next()) { + const Handle(SMDS_MeshElement)& elem = itNodes.Value(); + const Handle(SMDS_MeshNode )& node = myMesh->GetNode(1, elem); + + fprintf(myFileId, sNODE_UNV_DESCR, node->GetID()); + fprintf(myFileId, "%25.16E%25.16E%25.16E\n", node->X(), node->Y(), node->Z()); + } + fprintf(myFileId,"%s\n", sUNV_SEPARATOR); + + /**************************************************************************** + * ECRITURE DES ELEMENTS * + ****************************************************************************/ + fprintf(stdout,"\n(**************************)\n"); + fprintf(stdout,"(* ELEMENTS DU MAILLAGE : *)\n"); + fprintf(stdout,"(**************************)"); + /* Ecriture des connectivites, noms, numeros des mailles */ + + fprintf(myFileId,"%s\n", sUNV_SEPARATOR); + fprintf(myFileId,"%s\n", sELT_UNV_ID ); + + SMDS_MeshEdgesIterator itEdges(myMesh); + for (;itEdges.More();itEdges.Next()) { + const Handle(SMDS_MeshElement)& elem = itEdges.Value(); + + switch (elem->NbNodes()) { + case 2 : { + fprintf(myFileId, sELT_BEAM_DESC1, elem->GetID(), 21, elem->NbNodes()); + fprintf(myFileId, sELT_BEAM_DESC2); + fprintf(myFileId, "%10d%10d\n", elem->GetConnection(1), elem->GetConnection(2)); + break; + } + case 3 : { + fprintf(myFileId, sELT_BEAM_DESC1, elem->GetID(), 24, elem->NbNodes()); + fprintf(myFileId, sELT_BEAM_DESC2); + fprintf(myFileId, "%10d%10d%10d\n",elem->GetConnection(1), elem->GetConnection(2), elem->GetConnection(3)); + break; + } + } + } + + SMDS_MeshFacesIterator itFaces(myMesh); + for (;itFaces.More();itFaces.Next()) { + const Handle(SMDS_MeshElement)& elem = itFaces.Value(); + + switch (elem->NbNodes()) { + case 3 : + // linear triangle + fprintf(myFileId, sELT_SURF_DESC, elem->GetID(), 74, elem->NbNodes()); + break; + case 4 : + // linear quadrilateral + fprintf(myFileId, sELT_SURF_DESC, elem->GetID(), 71, elem->NbNodes()); + break; + case 6 : + // parabolic triangle + fprintf(myFileId, sELT_SURF_DESC, elem->GetID(), 72, elem->NbNodes()); + break; + case 8 : + // parabolic quadrilateral + fprintf(myFileId, sELT_SURF_DESC, elem->GetID(), 75, elem->NbNodes()); + break; + default: + fprintf(myFileId, "element not registered\n"); + } + + for (i=0;iNbNodes();i++) + fprintf(myFileId,"%10d",elem->GetConnection(i+1)); + + fprintf(myFileId,"\n"); + } + + SMDS_MeshVolumesIterator itVolumes(myMesh); + for (;itVolumes.More();itVolumes.Next()) { + const Handle(SMDS_MeshElement)& elem = itVolumes.Value(); + + switch (elem->NbNodes()) { + case 4 : + // linear tetrahedron + fprintf(myFileId, sELT_SURF_DESC, elem->GetID(), 111, elem->NbNodes()); + break; + case 6 : + // linear tetrahedron + fprintf(myFileId, sELT_SURF_DESC, elem->GetID(), 112, elem->NbNodes()); + break; + case 8 : + // linear brick + fprintf(myFileId, sELT_SURF_DESC, elem->GetID(), 115, elem->NbNodes()); + break; + } + + for (i=0;iNbNodes();i++) + fprintf(myFileId,"%10d",elem->GetConnection(i+1)); + + fprintf(myFileId,"\n"); + } + fprintf(myFileId,"%s\n", sUNV_SEPARATOR); + + fclose (myFileId); +} diff --git a/src/DriverUNV/DriverUNV_W_SMDS_Mesh.h b/src/DriverUNV/DriverUNV_W_SMDS_Mesh.h new file mode 100644 index 000000000..141ab21db --- /dev/null +++ b/src/DriverUNV/DriverUNV_W_SMDS_Mesh.h @@ -0,0 +1,31 @@ +#ifndef _INCLUDE_DRIVERUNV_W_SMDS_MESH +#define _INCLUDE_DRIVERUNV_W_SMDS_MESH + +#include +#include + +#include "SMDS_Mesh.hxx" +#include "Mesh_Writer.h" + +class DriverUNV_W_SMDS_Mesh : public Mesh_Writer { + + public : + DriverUNV_W_SMDS_Mesh(); + ~DriverUNV_W_SMDS_Mesh(); + + void Add(); + void Write(); + void SetMesh(Handle(SMDS_Mesh)& aMesh); + void SetFile(string); + + void SetFileId(FILE*); + void SetMeshId(int); + +private : + Handle_SMDS_Mesh myMesh; + string myFile; + FILE* myFileId; + int myMeshId; + +}; +#endif diff --git a/src/DriverUNV/DriverUNV_W_SMESHDS_Document.cxx b/src/DriverUNV/DriverUNV_W_SMESHDS_Document.cxx new file mode 100644 index 000000000..7fb740cdd --- /dev/null +++ b/src/DriverUNV/DriverUNV_W_SMESHDS_Document.cxx @@ -0,0 +1,78 @@ +using namespace std; +#include "DriverUNV_W_SMESHDS_Document.h" +#include "DriverUNV_W_SMESHDS_Mesh.h" + +#include "utilities.h" + +extern "C" +{ + Document_Writer* Wmaker() { + return new DriverUNV_W_SMESHDS_Document; + } +} + +DriverUNV_W_SMESHDS_Document::DriverUNV_W_SMESHDS_Document() { +; +} + +DriverUNV_W_SMESHDS_Document::~DriverUNV_W_SMESHDS_Document() { +; +} + +//void DriverUNV_W_SMESHDS_Document::SetFile(string aFile) { +//myFile = aFile; +//} + +//void DriverUNV_W_SMESHDS_Document::SetDocument(Handle(SMESHDS_Document)& aDocument) { +//myDocument = aDocument; +//} + +void DriverUNV_W_SMESHDS_Document::Write() { + + Handle(SMESHDS_Mesh) myMesh; + + /**************************************************************************** + * OUVERTURE DU FICHIER EN ECRITURE * + ****************************************************************************/ + char* file2Write = (char*)myFile.c_str(); + FILE* fid = fopen(file2Write,"w+"); + if (fid < 0) + { + fprintf(stderr,">> ERREUR : ouverture du fichier %s \n",file2Write); + exit(EXIT_FAILURE); + } + + /**************************************************************************** + * FERMETURE DU FICHIER * + ****************************************************************************/ + + fclose(fid); + + /******** Nombre de maillages ********/ + int nb_of_meshes = myDocument->NbMeshes(); //voir avec Yves + //nb_of_meshes = 1; + int numero = 0; + + string myClass = string("SMESHDS_Mesh"); + string myExtension = string("UNV"); + + //while (numeroGetMesh(numero); + myDocument->InitMeshesIterator(); + for (;myDocument->MoreMesh();myDocument->NextMesh()) { + numero++; + myMesh = myDocument->CurrentMesh(); + + DriverUNV_W_SMESHDS_Mesh* myWriter = new DriverUNV_W_SMESHDS_Mesh; + //Mesh_Writer* myWriter = Driver::GetMeshWriter(myExtension, myClass); + + myWriter->SetMesh(myMesh); + myWriter->SetFile(myFile); + SCRUTE(myMesh); + //myWriter->SetFileId(fid); + myWriter->SetMeshId(numero); + myWriter->Write(); + } + +} diff --git a/src/DriverUNV/DriverUNV_W_SMESHDS_Document.h b/src/DriverUNV/DriverUNV_W_SMESHDS_Document.h new file mode 100644 index 000000000..7b71287d1 --- /dev/null +++ b/src/DriverUNV/DriverUNV_W_SMESHDS_Document.h @@ -0,0 +1,25 @@ +#ifndef _INCLUDE_DRIVERUNV_W_SMESHDS_DOCUMENT +#define _INCLUDE_DRIVERUNV_W_SMESHDS_DOCUMENT + +#include +#include + +#include "SMESHDS_Document.hxx" +#include "Document_Writer.h" + +class DriverUNV_W_SMESHDS_Document : public Document_Writer { + +public : + DriverUNV_W_SMESHDS_Document(); + ~DriverUNV_W_SMESHDS_Document(); + + void Write(); + //void SetFile(string); + //void SetDocument(Handle(SMESHDS_Document)&); + +private : + //Handle_SMESHDS_Document myDocument; + //string myFile; + +}; +#endif diff --git a/src/DriverUNV/DriverUNV_W_SMESHDS_Mesh.cxx b/src/DriverUNV/DriverUNV_W_SMESHDS_Mesh.cxx new file mode 100644 index 000000000..231bba3db --- /dev/null +++ b/src/DriverUNV/DriverUNV_W_SMESHDS_Mesh.cxx @@ -0,0 +1,207 @@ +using namespace std; +#include "DriverUNV_W_SMESHDS_Mesh.h" +#include "DriverUNV_W_SMDS_Mesh.h" + +#include "SMDS_MeshElement.hxx" +#include "SMDS_MeshNode.hxx" +#include "SMDS_MeshEdgesIterator.hxx" +#include "SMDS_MeshFacesIterator.hxx" +#include "SMDS_MeshNodesIterator.hxx" +#include "SMDS_MeshVolumesIterator.hxx" + +#include "utilities.h" + +#define sNODE_UNV_ID " 2411" +#define sELT_UNV_ID " 2412" +#define sUNV_SEPARATOR " -1" +#define sNODE_UNV_DESCR "%10d 1 1 11\n" +#define sELT_SURF_DESC "%10d %2d 1 1 11 %1d\n" +#define sELT_VOLU_DESC "%10d %2d 1 1 9 %1d\n" +#define sELT_BEAM_DESC1 "%10d %2d 1 1 7 %1d\n" +#define sELT_BEAM_DESC2 " 0 1 1\n" + +DriverUNV_W_SMESHDS_Mesh::DriverUNV_W_SMESHDS_Mesh() { +; +} + +DriverUNV_W_SMESHDS_Mesh::~DriverUNV_W_SMESHDS_Mesh() { +; +} + +void DriverUNV_W_SMESHDS_Mesh::SetMesh(Handle(SMDS_Mesh)& aMesh) { + //myMesh = Handle(SMESHDS_Mesh)::DownCast(aMesh); + myMesh = aMesh; +} + +void DriverUNV_W_SMESHDS_Mesh::SetFile(string aFile) { + myFile = aFile; +} + +void DriverUNV_W_SMESHDS_Mesh::SetFileId(FILE* aFileId) { + myFileId = aFileId; +} + +void DriverUNV_W_SMESHDS_Mesh::SetMeshId(int aMeshId) { + myMeshId = aMeshId; +} + +void DriverUNV_W_SMESHDS_Mesh::Write() { + + string myClass = string("SMDS_Mesh"); + string myExtension = string("UNV"); + + DriverUNV_W_SMDS_Mesh* myWriter = new DriverUNV_W_SMDS_Mesh; + + myWriter->SetMesh(myMesh); + myWriter->SetFile(myFile); + myWriter->SetMeshId(myMeshId); + //myWriter->SetFileId(myFileId); + + myWriter->Write(); + + +} +void DriverUNV_W_SMESHDS_Mesh::Add() { + int nbNodes,nbCells; + int i; + + char* file2Read = (char*)myFile.c_str(); + myFileId = fopen(file2Read,"w+"); + if (myFileId < 0) + { + fprintf(stderr,">> ERREUR : ouverture du fichier %s \n",file2Read); + exit(EXIT_FAILURE); + } + + /**************************************************************************** + * NOMBRES D'OBJETS * + ****************************************************************************/ + fprintf(stdout,"\n(****************************)\n"); + fprintf(stdout,"(* INFORMATIONS GENERALES : *)\n"); + fprintf(stdout,"(****************************)\n"); + + /* Combien de noeuds ? */ + nbNodes = myMesh->NbNodes(); + + /* Combien de mailles, faces ou aretes ? */ + Standard_Integer nb_of_nodes, nb_of_edges,nb_of_faces, nb_of_volumes; + nb_of_edges = myMesh->NbEdges(); + nb_of_faces = myMesh->NbFaces(); + nb_of_volumes = myMesh->NbVolumes(); + nbCells = nb_of_edges + nb_of_faces + nb_of_volumes; + + fprintf(stdout,"%d %d\n",nbNodes,nbCells); +//fprintf(myFileId,"%d %d\n",nbNodes,nbCells); + + /**************************************************************************** + * ECRITURE DES NOEUDS * + ****************************************************************************/ + fprintf(stdout,"\n(************************)\n"); + fprintf(stdout,"(* NOEUDS DU MAILLAGE : *)\n"); + fprintf(stdout,"(************************)\n"); + + SMDS_MeshNodesIterator itNodes(myMesh); + + fprintf(myFileId,"%s\n", sUNV_SEPARATOR); + fprintf(myFileId,"%s\n", sNODE_UNV_ID ); + + for (;itNodes.More();itNodes.Next()) { + const Handle(SMDS_MeshElement)& elem = itNodes.Value(); + const Handle(SMDS_MeshNode )& node = myMesh->GetNode(1, elem); + + fprintf(myFileId, sNODE_UNV_DESCR, node->GetID()); + fprintf(myFileId, "%25.16E%25.16E%25.16E\n", node->X(), node->Y(), node->Z()); + } + fprintf(myFileId,"%s\n", sUNV_SEPARATOR); + + /**************************************************************************** + * ECRITURE DES ELEMENTS * + ****************************************************************************/ + fprintf(stdout,"\n(**************************)\n"); + fprintf(stdout,"(* ELEMENTS DU MAILLAGE : *)\n"); + fprintf(stdout,"(**************************)"); + /* Ecriture des connectivites, noms, numeros des mailles */ + + fprintf(myFileId,"%s\n", sUNV_SEPARATOR); + fprintf(myFileId,"%s\n", sELT_UNV_ID ); + + SMDS_MeshEdgesIterator itEdges(myMesh); + for (;itEdges.More();itEdges.Next()) { + const Handle(SMDS_MeshElement)& elem = itEdges.Value(); + + switch (elem->NbNodes()) { + case 2 : { + fprintf(myFileId, sELT_BEAM_DESC1, elem->GetID(), 21, elem->NbNodes()); + fprintf(myFileId, sELT_BEAM_DESC2); + fprintf(myFileId, "%10d%10d\n", elem->GetConnection(1), elem->GetConnection(2)); + break; + } + case 3 : { + fprintf(myFileId, sELT_BEAM_DESC1, elem->GetID(), 24, elem->NbNodes()); + fprintf(myFileId, sELT_BEAM_DESC2); + fprintf(myFileId, "%10d%10d%10d\n",elem->GetConnection(1), elem->GetConnection(2), elem->GetConnection(3)); + break; + } + } + } + + SMDS_MeshFacesIterator itFaces(myMesh); + for (;itFaces.More();itFaces.Next()) { + const Handle(SMDS_MeshElement)& elem = itFaces.Value(); + + switch (elem->NbNodes()) { + case 3 : + // linear triangle + fprintf(myFileId, sELT_SURF_DESC, elem->GetID(), 74, elem->NbNodes()); + break; + case 4 : + // linear quadrilateral + fprintf(myFileId, sELT_SURF_DESC, elem->GetID(), 71, elem->NbNodes()); + break; + case 6 : + // parabolic triangle + fprintf(myFileId, sELT_SURF_DESC, elem->GetID(), 72, elem->NbNodes()); + break; + case 8 : + // parabolic quadrilateral + fprintf(myFileId, sELT_SURF_DESC, elem->GetID(), 75, elem->NbNodes()); + break; + default: + fprintf(myFileId, "element not registered\n"); + } + + for (i=0;iNbNodes();i++) + fprintf(myFileId,"%10d",elem->GetConnection(i+1)); + + fprintf(myFileId,"\n"); + } + + SMDS_MeshVolumesIterator itVolumes(myMesh); + for (;itVolumes.More();itVolumes.Next()) { + const Handle(SMDS_MeshElement)& elem = itVolumes.Value(); + + switch (elem->NbNodes()) { + case 4 : + // linear tetrahedron + fprintf(myFileId, sELT_SURF_DESC, elem->GetID(), 111, elem->NbNodes()); + break; + case 6 : + // linear tetrahedron + fprintf(myFileId, sELT_SURF_DESC, elem->GetID(), 112, elem->NbNodes()); + break; + case 8 : + // linear brick + fprintf(myFileId, sELT_SURF_DESC, elem->GetID(), 115, elem->NbNodes()); + break; + } + + for (i=0;iNbNodes();i++) + fprintf(myFileId,"%10d",elem->GetConnection(i+1)); + + fprintf(myFileId,"\n"); + } + fprintf(myFileId,"%s\n", sUNV_SEPARATOR); + + fclose (myFileId); +} + diff --git a/src/DriverUNV/DriverUNV_W_SMESHDS_Mesh.h b/src/DriverUNV/DriverUNV_W_SMESHDS_Mesh.h new file mode 100644 index 000000000..4cd508b2d --- /dev/null +++ b/src/DriverUNV/DriverUNV_W_SMESHDS_Mesh.h @@ -0,0 +1,31 @@ +#ifndef _INCLUDE_DRIVERUNV_W_SMESHDS_MESH +#define _INCLUDE_DRIVERUNV_W_SMESHDS_MESH + +#include +#include + +#include "SMESHDS_Mesh.hxx" +#include "Mesh_Writer.h" + +class DriverUNV_W_SMESHDS_Mesh : public Mesh_Writer { + + public : + DriverUNV_W_SMESHDS_Mesh(); + ~DriverUNV_W_SMESHDS_Mesh(); + + void Add(); + void Write(); + void SetMesh(Handle(SMDS_Mesh)& aMesh); + void SetFile(string); + + void SetFileId(FILE*); + void SetMeshId(int); + +private : + Handle_SMDS_Mesh myMesh; + string myFile; + FILE* myFileId; + int myMeshId; + +}; +#endif diff --git a/src/DriverUNV/Makefile.in b/src/DriverUNV/Makefile.in new file mode 100644 index 000000000..c9a4fa89a --- /dev/null +++ b/src/DriverUNV/Makefile.in @@ -0,0 +1,41 @@ +# -* Makefile *- +# +# Author : Marc Tajchman (CEA) +# Date : 5/07/2001 +# $Header$ +# + +# source path +top_srcdir=@top_srcdir@ +top_builddir=../.. +srcdir=@srcdir@ +VPATH=.:@srcdir@ + + +@COMMENCE@ + +# header files +EXPORT_HEADERS= DriverUNV_R_SMDS_Mesh.h DriverUNV_R_SMESHDS_Mesh.h DriverUNV_R_SMESHDS_Document.h \ + DriverUNV_W_SMDS_Mesh.h DriverUNV_W_SMESHDS_Mesh.h DriverUNV_W_SMESHDS_Document.h + +# Libraries targets +LIB = libMeshDriverUNV.la +LIB_SRC = DriverUNV_R_SMDS_Mesh.cxx DriverUNV_R_SMESHDS_Mesh.cxx DriverUNV_R_SMESHDS_Document.cxx \ + DriverUNV_W_SMDS_Mesh.cxx DriverUNV_W_SMESHDS_Mesh.cxx DriverUNV_W_SMESHDS_Document.cxx + +LIB_CLIENT_IDL = + +LIB_SERVER_IDL = + +# additionnal information to compil and link file +CPPFLAGS += $(OCC_INCLUDES) +CXXFLAGS += $(OCC_CXXFLAGS) $(MED2_INCLUDES) +LDFLAGS += $(OCC_LIBS) $(MED2_LIBS) -lMeshDriver + +%_moc.cxx: %.h + $(MOC) $< -o $@ + +@CONCLUDE@ + + + diff --git a/src/SMESH/Makefile.in b/src/SMESH/Makefile.in new file mode 100644 index 000000000..cfad95772 --- /dev/null +++ b/src/SMESH/Makefile.in @@ -0,0 +1,81 @@ +#============================================================================== +# File : Makefile.in +# Created : lun mai 6 13:33:11 CEST 2002 +# Author : Paul RASCLE, EDF +# Project : SALOME +# Copyright : EDF 2002 +# $Header$ +#============================================================================== + +# source path +top_srcdir=@top_srcdir@ +top_builddir=../.. +srcdir=@srcdir@ +VPATH=.:@srcdir@:@top_srcdir@/idl:$(top_builddir)/idl:${KERNEL_ROOT_DIR}/idl/salome:${MED_ROOT_DIR}/idl/salome + + +@COMMENCE@ + +# header files +EXPORT_HEADERS= \ + SMESH_Gen.hxx \ + SMESH_Mesh.hxx \ + SMESH_subMesh.hxx \ + SMESH_Hypothesis.hxx \ + SMESH_HypothesisFactory.hxx \ + SMESH_Algo.hxx \ + SMESH_1D_Algo.hxx \ + SMESH_2D_Algo.hxx \ + SMESH_3D_Algo.hxx \ + SMESH_NumberOfSegments.hxx \ + SMESH_LocalLength.hxx \ + SMESH_LengthFromEdges.hxx \ + SMESH_MaxElementArea.hxx \ + SMESH_MaxElementVolume.hxx \ + SMESH_Regular_1D.hxx \ + SMESH_Quadrangle_2D.hxx \ + SMESH_MEFISTO_2D.hxx \ + SMESH_Hexa_3D.hxx \ + SMESH_HypothesisCreator.hxx + +EXPORT_PYSCRIPTS = + +# Libraries targets + +LIB= libSMESHimpl.la + +LIB_SRC = SMESH_Gen.cxx SMESH_Mesh.cxx SMESH_subMesh.cxx \ + SMESH_Hypothesis.cxx \ + SMESH_HypothesisFactory.cxx \ + SMESH_Algo.cxx \ + SMESH_1D_Algo.cxx \ + SMESH_2D_Algo.cxx \ + SMESH_3D_Algo.cxx \ + SMESH_NumberOfSegments.cxx \ + SMESH_LocalLength.cxx \ + SMESH_LengthFromEdges.cxx \ + SMESH_MaxElementArea.cxx \ + SMESH_MaxElementVolume.cxx \ + SMESH_Regular_1D.cxx \ + SMESH_Quadrangle_2D.cxx \ + SMESH_MEFISTO_2D.cxx \ + SMESH_Hexa_3D.cxx + +LIB_SERVER_IDL = + +LIB_CLIENT_IDL = + +# Executables targets +BIN = +BIN_SRC = + +# additionnal information to compil and link file +CPPFLAGS+= $(OCC_INCLUDES) $(MED2_INCLUDES) $(HDF5_INCLUDES) +CXXFLAGS+= $(OCC_CXXFLAGS) $(MED2_INCLUDES) $(HDF5_INCLUDES) + +#IDLCXXFLAGS+= -Wbtp + +LDFLAGS+= $(OCC_LIBS) $(HDF5_LIBS) $(MED2_LIBS) -lOpUtil -lSMESHDS -lSMDS -lMEFISTO2D -lMeshDriverDAT -lMeshDriverMED -lMeshDriverUNV + +@CONCLUDE@ + diff --git a/src/SMESH/SMESH_1D_Algo.cxx b/src/SMESH/SMESH_1D_Algo.cxx new file mode 100644 index 000000000..0ccd5c7ae --- /dev/null +++ b/src/SMESH/SMESH_1D_Algo.cxx @@ -0,0 +1,82 @@ +using namespace std; +//============================================================================= +// File : SMESH_1D_Algo.cxx +// Created : sam mai 18 09:22:56 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= +using namespace std; + +#include "SMESH_1D_Algo.hxx" +#include "SMESH_Gen.hxx" + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_1D_Algo::SMESH_1D_Algo(int hypId, int studyId, SMESH_Gen* gen) + : SMESH_Algo(hypId, studyId, gen) +{ +// _compatibleHypothesis.push_back("hypothese_1D_bidon"); + _type = ALGO_1D; + gen->_map1D_Algo[hypId] = this; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_1D_Algo::~SMESH_1D_Algo() +{ +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +ostream & SMESH_1D_Algo::SaveTo(ostream & save) +{ + return save << this; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +istream & SMESH_1D_Algo::LoadFrom(istream & load) +{ + return load >> (*this); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +ostream& operator << (ostream & save, SMESH_1D_Algo & hyp) +{ + return save; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +istream& operator >> (istream & load, SMESH_1D_Algo & hyp) +{ + return load; +} + diff --git a/src/SMESH/SMESH_1D_Algo.hxx b/src/SMESH/SMESH_1D_Algo.hxx new file mode 100644 index 000000000..ad8278107 --- /dev/null +++ b/src/SMESH/SMESH_1D_Algo.hxx @@ -0,0 +1,30 @@ +//============================================================================= +// File : SMESH_1D_Algo.hxx +// Created : sam mai 18 09:23:02 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= + +#ifndef _SMESH_1D_ALGO_HXX_ +#define _SMESH_1D_ALGO_HXX_ + +#include "SMESH_Algo.hxx" + +class SMESH_1D_Algo: + public SMESH_Algo +{ +public: + SMESH_1D_Algo(int hypId, int studyId, SMESH_Gen* gen); + virtual ~SMESH_1D_Algo(); + + virtual ostream & SaveTo(ostream & save); + virtual istream & LoadFrom(istream & load); + friend ostream& operator << (ostream & save, SMESH_1D_Algo & hyp); + friend istream& operator >> (istream & load, SMESH_1D_Algo & hyp); + +protected: +}; + +#endif diff --git a/src/SMESH/SMESH_2D_Algo.cxx b/src/SMESH/SMESH_2D_Algo.cxx new file mode 100644 index 000000000..f42d78a6b --- /dev/null +++ b/src/SMESH/SMESH_2D_Algo.cxx @@ -0,0 +1,117 @@ +using namespace std; +//============================================================================= +// File : SMESH_2D_Algo.cxx +// Created : sam mai 18 09:23:44 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= +using namespace std; + +#include "SMESH_2D_Algo.hxx" +#include "SMESH_Gen.hxx" + +#include "utilities.h" + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_2D_Algo::SMESH_2D_Algo(int hypId, int studyId, SMESH_Gen* gen) + : SMESH_Algo(hypId, studyId, gen) +{ +// _compatibleHypothesis.push_back("hypothese_2D_bidon"); + _type = ALGO_2D; + gen->_map2D_Algo[hypId] = this; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_2D_Algo::~SMESH_2D_Algo() +{ +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +ostream & SMESH_2D_Algo::SaveTo(ostream & save) +{ + return save << this; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +istream & SMESH_2D_Algo::LoadFrom(istream & load) +{ + return load >> (*this); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +ostream& operator << (ostream & save, SMESH_2D_Algo & hyp) +{ + return save; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +istream& operator >> (istream & load, SMESH_2D_Algo & hyp) +{ + return load; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +int SMESH_2D_Algo::NumberOfWires(const TopoDS_Shape& S) +{ + int i = 0; + for (TopExp_Explorer exp(S,TopAbs_WIRE); exp.More(); exp.Next()) + i++; + return i; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +int SMESH_2D_Algo::NumberOfPoints(SMESH_Mesh& aMesh, const TopoDS_Wire& W) +{ + int nbPoints = 0; + for (TopExp_Explorer exp(W,TopAbs_EDGE); exp.More(); exp.Next()) + { + const TopoDS_Edge& E = TopoDS::Edge(exp.Current()); + int nb = aMesh.GetSubMesh(E)->GetSubMeshDS()->NbNodes(); + //SCRUTE(nb); + nbPoints += nb +1; // internal points plus 1 vertex of 2 (last point ?) + } + //SCRUTE(nbPoints); + return nbPoints; +} diff --git a/src/SMESH/SMESH_2D_Algo.hxx b/src/SMESH/SMESH_2D_Algo.hxx new file mode 100644 index 000000000..30bcc86ac --- /dev/null +++ b/src/SMESH/SMESH_2D_Algo.hxx @@ -0,0 +1,34 @@ +//============================================================================= +// File : SMESH_2D_Algo.hxx +// Created : sam mai 18 09:23:37 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= + +#ifndef _SMESH_2D_ALGO_HXX_ +#define _SMESH_2D_ALGO_HXX_ + +#include "SMESH_Algo.hxx" +#include + +class SMESH_2D_Algo: + public SMESH_Algo +{ +public: + SMESH_2D_Algo(int hypId, int studyId, SMESH_Gen* gen); + virtual ~SMESH_2D_Algo(); + + int NumberOfWires(const TopoDS_Shape& S); + int NumberOfPoints(SMESH_Mesh& aMesh,const TopoDS_Wire& W); + + virtual ostream & SaveTo(ostream & save); + virtual istream & LoadFrom(istream & load); + friend ostream& operator << (ostream & save, SMESH_2D_Algo & hyp); + friend istream& operator >> (istream & load, SMESH_2D_Algo & hyp); + +protected: +}; + +#endif diff --git a/src/SMESH/SMESH_3D_Algo.cxx b/src/SMESH/SMESH_3D_Algo.cxx new file mode 100644 index 000000000..0ddc26b1f --- /dev/null +++ b/src/SMESH/SMESH_3D_Algo.cxx @@ -0,0 +1,83 @@ +using namespace std; +//============================================================================= +// File : SMESH_3D_Algo.cxx +// Created : sam mai 18 09:24:52 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= +using namespace std; + +#include "SMESH_3D_Algo.hxx" +#include "SMESH_Gen.hxx" + +#include "utilities.h" + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_3D_Algo::SMESH_3D_Algo(int hypId, int studyId, SMESH_Gen* gen) + : SMESH_Algo(hypId, studyId, gen) +{ +// _compatibleHypothesis.push_back("hypothese_3D_bidon"); + _type = ALGO_3D; + gen->_map3D_Algo[hypId] = this; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_3D_Algo::~SMESH_3D_Algo() +{ +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +ostream & SMESH_3D_Algo::SaveTo(ostream & save) +{ + return save << this; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +istream & SMESH_3D_Algo::LoadFrom(istream & load) +{ + return load >> (*this); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +ostream& operator << (ostream & save, SMESH_3D_Algo & hyp) +{ + return save; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +istream& operator >> (istream & load, SMESH_3D_Algo & hyp) +{ + return load; +} diff --git a/src/SMESH/SMESH_3D_Algo.hxx b/src/SMESH/SMESH_3D_Algo.hxx new file mode 100644 index 000000000..9b3ca0b06 --- /dev/null +++ b/src/SMESH/SMESH_3D_Algo.hxx @@ -0,0 +1,30 @@ +//============================================================================= +// File : SMESH_3D_Algo.hxx +// Created : sam mai 18 09:24:47 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= + +#ifndef _SMESH_3D_ALGO_HXX_ +#define _SMESH_3D_ALGO_HXX_ + +#include "SMESH_Algo.hxx" + +class SMESH_3D_Algo: + public SMESH_Algo +{ +public: + SMESH_3D_Algo(int hypId, int studyId, SMESH_Gen* gen); + virtual ~SMESH_3D_Algo(); + + virtual ostream & SaveTo(ostream & save); + virtual istream & LoadFrom(istream & load); + friend ostream& operator << (ostream & save, SMESH_3D_Algo & hyp); + friend istream& operator >> (istream & load, SMESH_3D_Algo & hyp); + +protected: +}; + +#endif diff --git a/src/SMESH/SMESH_Algo.cxx b/src/SMESH/SMESH_Algo.cxx new file mode 100644 index 000000000..5fc603231 --- /dev/null +++ b/src/SMESH/SMESH_Algo.cxx @@ -0,0 +1,224 @@ +using namespace std; +//============================================================================= +// File : SMESH_Algo.cxx +// Created : sam mai 18 09:20:53 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= +using namespace std; + +#include "SMESH_Algo.hxx" +#include "SMESH_Gen.hxx" +#include "SMESH_Mesh.hxx" + +#include "SMESHDS_ListOfPtrHypothesis.hxx" +#include "SMESHDS_ListIteratorOfListOfPtrHypothesis.hxx" + +#include +#include +#include + +#include "utilities.h" + +#include + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_Algo::SMESH_Algo(int hypId, int studyId, SMESH_Gen* gen) + : SMESH_Hypothesis(hypId, studyId, gen) +{ +// _compatibleHypothesis.push_back("hypothese_bidon"); + _type = ALGO; + gen->_mapAlgo[hypId] = this; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_Algo::~SMESH_Algo() +{ +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +const vector & SMESH_Algo::GetCompatibleHypothesis() +{ + return _compatibleHypothesis; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +ostream & SMESH_Algo::SaveTo(ostream & save) +{ + return save << this; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +istream & SMESH_Algo::LoadFrom(istream & load) +{ + return load >> (*this); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +ostream& operator << (ostream & save, SMESH_Algo & hyp) +{ + return save; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +istream& operator >> (istream & load, SMESH_Algo & hyp) +{ + return load; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +bool SMESH_Algo::CheckHypothesis(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape) +{ + MESSAGE("SMESH_Algo::CheckHypothesis"); + ASSERT(0); // use method from derived classes + return false; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +bool SMESH_Algo::Compute(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape) +{ + MESSAGE("SMESH_Algo::Compute"); + ASSERT(0); // use method from derived classes + return false; +} + +//============================================================================= +/*! + * List the hypothesis used by the algorithm associated to the shape. + * Hypothesis associated to father shape -are- taken into account (see + * GetAppliedHypothesis). Relevant hypothesis have a name (type) listed in + * the algorithm. This method could be surcharged by specific algorithms, in + * case of several hypothesis simultaneously applicable. + */ +//============================================================================= + +const list& +SMESH_Algo::GetUsedHypothesis(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape) +{ + _usedHypList.clear(); + _usedHypList = GetAppliedHypothesis(aMesh, aShape); // copy + int nbHyp = _usedHypList.size(); + if (nbHyp == 0) + { + TopoDS_Shape mainShape = aMesh.GetMeshDS()->ShapeToMesh(); + if (!mainShape.IsSame(aShape)) + { + _usedHypList = GetAppliedHypothesis(aMesh, mainShape); // copy + nbHyp = _usedHypList.size(); + } + } + if (nbHyp > 1) _usedHypList.clear(); //only one compatible hypothesis allowed + return _usedHypList; +} + +//============================================================================= +/*! + * List the relevant hypothesis associated to the shape. Relevant hypothesis + * have a name (type) listed in the algorithm. Hypothesis associated to + * father shape -are not- taken into account (see GetUsedHypothesis) + */ +//============================================================================= + +const list& +SMESH_Algo::GetAppliedHypothesis(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape) +{ + const Handle(SMESHDS_Mesh)& meshDS = aMesh.GetMeshDS(); + const SMESHDS_ListOfPtrHypothesis& listHyp = meshDS->GetHypothesis(aShape); + SMESHDS_ListIteratorOfListOfPtrHypothesis it(listHyp); + + int hypType; + string hypName; + + _appliedHypList.clear(); + while (it.More()) + { + SMESHDS_Hypothesis* anHyp = it.Value(); + hypType = anHyp->GetType(); + //SCRUTE(hypType); + if (hypType == SMESHDS_Hypothesis::PARAM_ALGO) + { + hypName = anHyp->GetName(); + vector::iterator ith = find(_compatibleHypothesis.begin(), + _compatibleHypothesis.end(), + hypName); + if (ith != _compatibleHypothesis.end()) // count only relevant + { + _appliedHypList.push_back(anHyp); + //SCRUTE(hypName); + } + } + it.Next(); + } + return _appliedHypList; +} + + +//============================================================================= +/*! + * Compute length of an edge + */ +//============================================================================= + +double SMESH_Algo::EdgeLength(const TopoDS_Edge& E) +{ + double UMin = 0, UMax = 0; + TopLoc_Location L; + if (BRep_Tool::Degenerated(E)) return 0; + Handle (Geom_Curve) C = BRep_Tool::Curve(E, L, UMin, UMax); + GeomAdaptor_Curve AdaptCurve(C); + GCPnts_AbscissaPoint gabs; + double length = gabs.Length(AdaptCurve, UMin, UMax); + return length; +} + diff --git a/src/SMESH/SMESH_Algo.hxx b/src/SMESH/SMESH_Algo.hxx new file mode 100644 index 000000000..de6c67162 --- /dev/null +++ b/src/SMESH/SMESH_Algo.hxx @@ -0,0 +1,60 @@ +//============================================================================= +// File : SMESH_Algo.hxx +// Created : sam mai 18 09:20:46 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= + +#ifndef _SMESH_ALGO_HXX_ +#define _SMESH_ALGO_HXX_ + +#include "SMESH_Hypothesis.hxx" + +#include +#include + +#include +#include +#include + +class SMESH_gen; +class SMESH_Mesh; + +class SMESH_Algo: + public SMESH_Hypothesis +{ +public: + SMESH_Algo(int hypId, int studyId, SMESH_Gen* gen); + virtual ~SMESH_Algo(); + + const vector & GetCompatibleHypothesis(); + virtual bool CheckHypothesis(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape); + + virtual bool Compute(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape); + + virtual const list& + GetUsedHypothesis(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape); + + const list& + GetAppliedHypothesis(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape); + + static double EdgeLength(const TopoDS_Edge& E); + + virtual ostream & SaveTo(ostream & save); + virtual istream & LoadFrom(istream & load); + friend ostream& operator << (ostream & save, SMESH_Algo & hyp); + friend istream& operator >> (istream & load, SMESH_Algo & hyp); + +protected: + vector _compatibleHypothesis; + list _appliedHypList; + list _usedHypList; +}; + +#endif diff --git a/src/SMESH/SMESH_Gen.cxx b/src/SMESH/SMESH_Gen.cxx new file mode 100644 index 000000000..e6ed980b4 --- /dev/null +++ b/src/SMESH/SMESH_Gen.cxx @@ -0,0 +1,390 @@ +using namespace std; +//============================================================================= +// File : SMESH_Gen.cxx +// Created : sam mai 18 09:34:35 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= +using namespace std; + +#include "SMESH_Gen.hxx" + +#include "SMESH_subMesh.hxx" + +#include "SMESHDS_ListOfPtrHypothesis.hxx" +#include "SMESHDS_ListIteratorOfListOfPtrHypothesis.hxx" +#include "SMDS_MeshElement.hxx" +#include "SMDS_MeshNode.hxx" + +#include +#include + +#include "utilities.h" +#include "OpUtil.hxx" + +//============================================================================= +/*! + * default constructor: + */ +//============================================================================= + +SMESH_Gen::SMESH_Gen() +{ + MESSAGE("SMESH_Gen::SMESH_Gen"); + _localId = 0; + _hypothesisFactory.SetGen(this); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_Gen::~SMESH_Gen() +{ + MESSAGE("SMESH_Gen::~SMESH_Gen"); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_Hypothesis* SMESH_Gen::CreateHypothesis(const char* anHyp, + int studyId) + throw (SALOME_Exception) +{ + MESSAGE("SMESH_Gen::CreateHypothesis"); + + // Get studyContext, create it if it does'nt exist, with a SMESHDS_Document + + StudyContextStruct* myStudyContext = GetStudyContext(studyId); + + // create a new hypothesis object, store its ref. in studyContext + + SMESH_Hypothesis* myHypothesis = _hypothesisFactory.Create(anHyp, studyId); + int hypId = myHypothesis->GetID(); + myStudyContext->mapHypothesis[hypId] = myHypothesis; + SCRUTE(studyId); + SCRUTE(hypId); + + // store hypothesis in SMESHDS document + + myStudyContext->myDocument->AddHypothesis(myHypothesis); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_Mesh* SMESH_Gen::Init(int studyId, const TopoDS_Shape& aShape) + throw (SALOME_Exception) +{ + MESSAGE("SMESH_Gen::Init"); +// if (aShape.ShapeType() == TopAbs_COMPOUND) +// { +// INFOS("Mesh Compound not yet implemented!"); +// throw(SALOME_Exception(LOCALIZED("Mesh Compound not yet implemented!"))); +// } + + // Get studyContext, create it if it does'nt exist, with a SMESHDS_Document + + StudyContextStruct* myStudyContext = GetStudyContext(studyId); + + // create a new SMESH_mesh object + + SMESH_Mesh* mesh = new SMESH_Mesh(_localId++, + studyId, + this, + myStudyContext->myDocument); + myStudyContext->mapMesh[_localId] = mesh; + + // associate a TopoDS_Shape to the mesh + + mesh->ShapeToMesh(aShape); + return mesh; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +bool SMESH_Gen::Compute(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape) + throw (SALOME_Exception) +{ + MESSAGE("SMESH_Gen::Compute"); +// bool isDone = false; +/* +Algo : s'appuie ou non sur une geometrie +Si geometrie: +Vertex : rien à faire (range le point) +Edge, Wire, collection d'edge et wire : 1D +Face, Shell, collection de Face et Shells : 2D +Solid, Collection de Solid : 3D +*/ +// *** corriger commentaires + // check hypothesis associated to the mesh : + // - only one algo : type compatible with the type of the shape + // - hypothesis = compatible with algo + // - check if hypothesis are applicable to this algo + // - check contradictions within hypothesis + // (test if enough hypothesis is done further) + + bool ret = true; + + SMESH_subMesh* sm = aMesh.GetSubMesh(aShape); +// SCRUTE(sm); + SMESH_subMesh* smToCompute = sm->GetFirstToCompute(); + while (smToCompute) + { + TopoDS_Shape subShape = smToCompute->GetSubShape(); + int dim = GetShapeDim(subShape); + //SCRUTE(dim); + if (dim > 0) + { + bool ret1 = smToCompute->ComputeStateEngine(SMESH_subMesh::COMPUTE); + ret = ret && ret1; + } + else + { + ASSERT(dim == 0); + ASSERT(smToCompute->_vertexSet == false); + TopoDS_Vertex V1 = TopoDS::Vertex(subShape); + gp_Pnt P1 = BRep_Tool::Pnt(V1); + const Handle(SMESHDS_Mesh)& meshDS = aMesh.GetMeshDS(); + int nodeId = meshDS->AddNode(P1.X(), P1.Y(), P1.Z()); + //MESSAGE("point "<FindNode(nodeId); + Handle (SMDS_MeshNode) node = meshDS->GetNode(1, elt); + meshDS->SetNodeOnVertex(node, V1); + const Handle(SMESHDS_SubMesh)& subMeshDS + = smToCompute->GetSubMeshDS(); + smToCompute->_vertexSet = true; + bool ret1 = smToCompute->ComputeStateEngine(SMESH_subMesh::COMPUTE); + } + smToCompute = sm->GetFirstToCompute(); + } + + return ret; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_Algo* SMESH_Gen::GetAlgo(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape) +{ + //MESSAGE("SMESH_Gen::GetAlgo"); + + SMESHDS_Hypothesis* theHyp = NULL; + SMESH_Algo* algo = NULL; + const Handle(SMESHDS_Mesh)& meshDS = aMesh.GetMeshDS(); + int hypType; + int hypId; + int algoDim; + + // try shape first, then main shape + + TopoDS_Shape mainShape = meshDS->ShapeToMesh(); + const TopoDS_Shape* shapeToTry[2] = {&aShape, &mainShape}; + + for (int iShape=0; iShape<2; iShape++) + { + TopoDS_Shape tryShape = (*shapeToTry[iShape]); + + const SMESHDS_ListOfPtrHypothesis& listHyp + = meshDS->GetHypothesis(tryShape); + SMESHDS_ListIteratorOfListOfPtrHypothesis it(listHyp); + + int nb_algo = 0; + int shapeDim = GetShapeDim(aShape); + int typeOfShape = aShape.ShapeType(); + + while (it.More()) + { + SMESHDS_Hypothesis* anHyp = it.Value(); + hypType = anHyp->GetType(); +// SCRUTE(hypType); + if (hypType > SMESHDS_Hypothesis::PARAM_ALGO) + { + switch (hypType) + { + case SMESHDS_Hypothesis::ALGO_1D: algoDim=1; break; + case SMESHDS_Hypothesis::ALGO_2D: algoDim=2; break; + case SMESHDS_Hypothesis::ALGO_3D: algoDim=3; break; + default: algoDim=0; break; + } +// SCRUTE(algoDim); +// SCRUTE(shapeDim); +// SCRUTE(typeOfShape); + if (shapeDim == algoDim) // count only algos of shape dim. + { // discard algos for subshapes + hypId = anHyp->GetID(); // (of lower dim.) + ASSERT(_mapAlgo.find(hypId) != _mapAlgo.end()); + SMESH_Algo* anAlgo = _mapAlgo[hypId]; + //SCRUTE(anAlgo->GetShapeType()); +// if (anAlgo->GetShapeType() == typeOfShape) + if ((anAlgo->GetShapeType()) & (1 << typeOfShape)) + { // only specific TopoDS_Shape + nb_algo++; + theHyp = anHyp; + } + } + } + if (nb_algo > 1) return NULL; // more than one algo + it.Next(); + } + if (nb_algo == 1) // one algo found : OK + break; // do not try a parent shape + } + + if (!theHyp) return NULL; // no algo found + + hypType = theHyp->GetType(); + hypId = theHyp->GetID(); + + ASSERT(_mapAlgo.find(hypId) != _mapAlgo.end()); + algo = _mapAlgo[hypId]; + const char* algoName = algo->GetName(); + //MESSAGE("Algo found " << algoName << " Id " << hypId); + return algo; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +StudyContextStruct* SMESH_Gen::GetStudyContext(int studyId) +{ + // Get studyContext, create it if it does'nt exist, with a SMESHDS_Document + + if (_mapStudyContext.find(studyId) == _mapStudyContext.end()) + { + _mapStudyContext[studyId] = new StudyContextStruct; + _mapStudyContext[studyId]->myDocument = new SMESHDS_Document(studyId); + } + StudyContextStruct* myStudyContext = _mapStudyContext[studyId]; +// ASSERT(_mapStudyContext.find(studyId) != _mapStudyContext.end()); + return myStudyContext; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +void SMESH_Gen::Save(int studyId, const char *aUrlOfFile) +{ +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +void SMESH_Gen::Load(int studyId, const char *aUrlOfFile) +{ +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +void SMESH_Gen::Close(int studyId) +{ +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +const char* SMESH_Gen::ComponentDataType() +{ +} + + +//============================================================================= +/*! + * + */ +//============================================================================= + +const char* SMESH_Gen::IORToLocalPersistentID(const char* IORString, + bool& IsAFile) +{ +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +const char* SMESH_Gen::LocalPersistentIDToIOR(const char* aLocalPersistentID) +{ +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +int SMESH_Gen::GetShapeDim(const TopoDS_Shape& aShape) +{ + int shapeDim = -1; // Shape dimension: 0D, 1D, 2D, 3D + int type = aShape.ShapeType(); + switch (type) + { +// case TopAbs_COMPOUND: +// { +// break; +// } + case TopAbs_COMPOUND: + case TopAbs_COMPSOLID: + case TopAbs_SOLID: + case TopAbs_SHELL: + { + shapeDim = 3; + break; + } + // case TopAbs_SHELL: + case TopAbs_FACE: + { + shapeDim = 2; + break; + } + case TopAbs_WIRE: + case TopAbs_EDGE: + { + shapeDim = 1; + break; + } + case TopAbs_VERTEX: + { + shapeDim = 0; + break; + } + } +// SCRUTE(shapeDim); + return shapeDim; +} diff --git a/src/SMESH/SMESH_Gen.hxx b/src/SMESH/SMESH_Gen.hxx new file mode 100644 index 000000000..c74d398bf --- /dev/null +++ b/src/SMESH/SMESH_Gen.hxx @@ -0,0 +1,76 @@ +//============================================================================= +// File : SMESH_Gen.hxx +// Created : jeu mai 16 22:53:13 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= + +#ifndef _SMESH_GEN_HXX_ +#define _SMESH_GEN_HXX_ + +#include "Utils_SALOME_Exception.hxx" + +#include "SMESH_HypothesisFactory.hxx" +#include "SMESH_Hypothesis.hxx" +#include "SMESH_Algo.hxx" +#include "SMESH_1D_Algo.hxx" +#include "SMESH_2D_Algo.hxx" +#include "SMESH_3D_Algo.hxx" +#include "SMESH_Mesh.hxx" + +#include "SMESHDS_Document.hxx" + +#include + +#include + +typedef struct studyContextStruct +{ + map mapHypothesis; + map mapMesh; + Handle (SMESHDS_Document) myDocument; +} StudyContextStruct ; + +class SMESH_Gen +{ +public: + SMESH_Gen(); + ~SMESH_Gen(); + + SMESH_Hypothesis* CreateHypothesis(const char* anHyp, int studyId) + throw (SALOME_Exception); + SMESH_Mesh* Init(int studyId, const TopoDS_Shape& aShape) + throw (SALOME_Exception); + bool Compute(::SMESH_Mesh& aMesh, const TopoDS_Shape& aShape) + throw (SALOME_Exception); + StudyContextStruct* GetStudyContext(int studyId); + + static int GetShapeDim(const TopoDS_Shape& aShape); + SMESH_Algo* GetAlgo(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape); + + // inherited methods from SALOMEDS::Driver + + void Save(int studyId, const char *aUrlOfFile); + void Load(int studyId, const char *aUrlOfFile); + void Close(int studyId); + const char* ComponentDataType(); + + const char* IORToLocalPersistentID(const char* IORString, bool& IsAFile); + const char* LocalPersistentIDToIOR(const char* aLocalPersistentID); + + SMESH_HypothesisFactory _hypothesisFactory; + + map _mapAlgo; + map _map1D_Algo; + map _map2D_Algo; + map _map3D_Algo; + +private: + int _localId; // unique Id of created objects, within SMESH_Gen entity + map _mapStudyContext; + map _mapHypothesis; +}; + +#endif diff --git a/src/SMESH/SMESH_Hexa_3D.cxx b/src/SMESH/SMESH_Hexa_3D.cxx new file mode 100644 index 000000000..fb4578780 --- /dev/null +++ b/src/SMESH/SMESH_Hexa_3D.cxx @@ -0,0 +1,960 @@ +using namespace std; +//============================================================================= +// File : SMESH_Hexa_3D.cxx +// Created : sam mai 18 23:15:30 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= +using namespace std; + +#include "SMESH_Hexa_3D.hxx" +#include "SMESH_Quadrangle_2D.hxx" +#include "SMESH_Gen.hxx" +#include "SMESH_Mesh.hxx" + +#include "SMDS_MeshElement.hxx" +#include "SMDS_MeshNode.hxx" +#include "SMDS_FacePosition.hxx" + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "utilities.h" + + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_Hexa_3D::SMESH_Hexa_3D(int hypId, int studyId, + SMESH_Gen* gen) + : SMESH_3D_Algo(hypId, studyId, gen) +{ + MESSAGE("SMESH_Hexa_3D::SMESH_Hexa_3D"); + _name = "Hexa_3D"; +// _shapeType = TopAbs_SOLID; + _shapeType = (1 << TopAbs_SHELL) | (1 << TopAbs_SOLID);// 1 bit /shape type +// MESSAGE("_shapeType octal " << oct << _shapeType); + for (int i=0; i<6; i++) _quads[i] = 0; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_Hexa_3D::~SMESH_Hexa_3D() +{ + MESSAGE("SMESH_Hexa_3D::~SMESH_Hexa_3D"); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +bool SMESH_Hexa_3D::CheckHypothesis(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape) +{ + MESSAGE("SMESH_Hexa_3D::CheckHypothesis"); + + bool isOk = true; + + // nothing to check + + return isOk; +} + +//============================================================================= +/*! + * Hexahedron mesh on hexaedron like form + * -0. - shape and face mesh verification + * -1. - identify faces and vertices of the "cube" + * -2. - Algorithm from: + * "Application de l'interpolation transfinie à la création de maillages + * C0 ou G1 continus sur des triangles, quadrangles, tetraedres, pentaedres + * et hexaedres déformés." + * Alain PERONNET - 8 janvier 1999 + */ +//============================================================================= + +bool SMESH_Hexa_3D::Compute(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape) + throw (SALOME_Exception) +{ + MESSAGE("SMESH_Hexa_3D::Compute"); + + bool isOk = false; + const Handle(SMESHDS_Mesh)& meshDS = aMesh.GetMeshDS(); + SMESH_subMesh* theSubMesh = aMesh.GetSubMesh(aShape); + //const Handle(SMESHDS_SubMesh)& subMeshDS = theSubMesh->GetSubMeshDS(); + + // 0. - shape and face mesh verification + // 0.1 - shape must be a solid (or a shell) with 6 faces + MESSAGE("---"); + + vector meshFaces; + for (TopExp_Explorer exp(aShape,TopAbs_FACE);exp.More();exp.Next()) + { + SMESH_subMesh* aSubMesh = aMesh.GetSubMeshContaining(exp.Current()); + ASSERT (aSubMesh); + meshFaces.push_back(aSubMesh); + } + if (meshFaces.size() != 6) + { + SCRUTE(meshFaces.size()); + ASSERT(0); + return false; + } + + // 0.2 - is each face meshed with Quadrangle_2D? (so, with a wire of 4 edges) + MESSAGE("---"); + + for (int i=0; i<6; i++) + { + TopoDS_Shape aShape = meshFaces[i]->GetSubShape(); + SMESH_Algo* algo = _gen->GetAlgo(aMesh, aShape); + string algoName = algo->GetName(); + if (algoName != "Quadrangle_2D") + { + // *** delete _quads + SCRUTE(algoName); + ASSERT(0); + return false; + } + SMESH_Quadrangle_2D* quadAlgo =dynamic_cast (algo); + ASSERT(quadAlgo); + try + { + _quads[i] = quadAlgo->CheckAnd2Dcompute(aMesh, aShape); + // *** to delete after usage + } + catch (SALOME_Exception& S_ex) + { + // *** delete _quads + // *** throw exception + ASSERT(0); + } + } + + // 1. - identify faces and vertices of the "cube" + // 1.1 - ancestor maps vertex->edges in the cube + MESSAGE("---"); + + TopTools_IndexedDataMapOfShapeListOfShape MS; + TopExp::MapShapesAndAncestors(aShape, TopAbs_VERTEX, TopAbs_EDGE, MS); + + // 1.2 - first face is choosen as face Y=0 of the unit cube + MESSAGE("---"); + + const TopoDS_Shape& aFace = meshFaces[0]->GetSubShape(); + const TopoDS_Face& F = TopoDS::Face(aFace); + + // 1.3 - identify the 4 vertices of the face Y=0: V000, V100, V101, V001 + MESSAGE("---"); + + int i = 0; + TopoDS_Edge E = _quads[0]->edge[i]; //edge will be Y=0,Z=0 on unit cube + double f,l; + Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface(E,F,f,l); + TopoDS_Vertex VFirst, VLast; + TopExp::Vertices(E, VFirst, VLast); // corresponds to f and l + bool isForward = (((l-f)*(_quads[0]->last[i] - _quads[0]->first[i])) > 0); + + if (isForward) + { + _cube.V000 = VFirst; // will be (0,0,0) on the unit cube + _cube.V100 = VLast; // will be (1,0,0) on the unit cube + } + else + { + _cube.V000 = VLast; + _cube.V100 = VFirst; + } + + i = 1; + E = _quads[0]->edge[i]; + C2d = BRep_Tool::CurveOnSurface(E,F,f,l); + TopExp::Vertices(E, VFirst, VLast); + isForward = (((l-f)*(_quads[0]->last[i] - _quads[0]->first[i])) > 0); + if (isForward) _cube.V101 = VLast; // will be (1,0,1) on the unit cube + else _cube.V101 = VFirst; + + i = 2; + E = _quads[0]->edge[i]; + C2d = BRep_Tool::CurveOnSurface(E,F,f,l); + TopExp::Vertices(E, VFirst, VLast); + isForward = (((l-f)*(_quads[0]->last[i] - _quads[0]->first[i])) > 0); + if (isForward) _cube.V001 = VLast; // will be (0,0,1) on the unit cube + else _cube.V001 = VFirst; + + // 1.4 - find edge X=0, Z=0 (ancestor of V000 not in face Y=0) + // - find edge X=1, Z=0 (ancestor of V100 not in face Y=0) + // - find edge X=1, Z=1 (ancestor of V101 not in face Y=0) + // - find edge X=0, Z=1 (ancestor of V001 not in face Y=0) + MESSAGE("---"); + + TopoDS_Edge E_0Y0 = EdgeNotInFace(aMesh, aShape, F, _cube.V000, MS); + ASSERT(! E_0Y0.IsNull()); + + TopoDS_Edge E_1Y0 = EdgeNotInFace(aMesh, aShape, F, _cube.V100, MS); + ASSERT(! E_1Y0.IsNull()); + + TopoDS_Edge E_1Y1 = EdgeNotInFace(aMesh, aShape, F, _cube.V101, MS); + ASSERT(! E_1Y1.IsNull()); + + TopoDS_Edge E_0Y1 = EdgeNotInFace(aMesh, aShape, F, _cube.V001, MS); + ASSERT(! E_0Y1.IsNull()); + + // 1.5 - identify the 4 vertices in face Y=1: V010, V110, V111, V011 + MESSAGE("---"); + + TopExp::Vertices(E_0Y0, VFirst, VLast); + if (VFirst.IsSame(_cube.V000)) _cube.V010 = VLast; + else _cube.V010 = VFirst; + + TopExp::Vertices(E_1Y0, VFirst, VLast); + if (VFirst.IsSame(_cube.V100)) _cube.V110 = VLast; + else _cube.V110 = VFirst; + + TopExp::Vertices(E_1Y1, VFirst, VLast); + if (VFirst.IsSame(_cube.V101)) _cube.V111 = VLast; + else _cube.V111 = VFirst; + + TopExp::Vertices(E_0Y1, VFirst, VLast); + if (VFirst.IsSame(_cube.V001)) _cube.V011 = VLast; + else _cube.V011 = VFirst; + + // 1.6 - find remaining faces given 4 vertices + MESSAGE("---"); + + _indY0 = 0; + _cube.quad_Y0 = _quads[_indY0]; + + _indY1 = GetFaceIndex(aMesh, aShape, meshFaces, + _cube.V010,_cube.V011,_cube.V110,_cube.V111); + _cube.quad_Y1 = _quads[_indY1]; + + _indZ0 = GetFaceIndex(aMesh, aShape, meshFaces, + _cube.V000,_cube.V010,_cube.V100,_cube.V110); + _cube.quad_Z0 = _quads[_indZ0]; + + _indZ1 = GetFaceIndex(aMesh, aShape, meshFaces, + _cube.V001,_cube.V011,_cube.V101,_cube.V111); + _cube.quad_Z1 = _quads[_indZ1]; + + _indX0 = GetFaceIndex(aMesh, aShape, meshFaces, + _cube.V000,_cube.V001,_cube.V010,_cube.V011); + _cube.quad_X0 = _quads[_indX0]; + + _indX1 = GetFaceIndex(aMesh, aShape, meshFaces, + _cube.V100,_cube.V101,_cube.V110,_cube.V111); + _cube.quad_X1 = _quads[_indX1]; + + MESSAGE("---"); + + // 1.7 - get convertion coefs from face 2D normalized to 3D normalized + + Conv2DStruct cx0; // for face X=0 + Conv2DStruct cx1; // for face X=1 + Conv2DStruct cy0; + Conv2DStruct cy1; + Conv2DStruct cz0; + Conv2DStruct cz1; + + GetConv2DCoefs(*_cube.quad_X0, meshFaces[_indX0]->GetSubShape(), + _cube.V000,_cube.V010,_cube.V011,_cube.V001, + cx0); + GetConv2DCoefs(*_cube.quad_X1, meshFaces[_indX1]->GetSubShape(), + _cube.V100,_cube.V110,_cube.V111,_cube.V101, + cx1); + GetConv2DCoefs(*_cube.quad_Y0, meshFaces[_indY0]->GetSubShape(), + _cube.V000,_cube.V100,_cube.V101,_cube.V001, + cy0); + GetConv2DCoefs(*_cube.quad_Y1, meshFaces[_indY1]->GetSubShape(), + _cube.V010,_cube.V110,_cube.V111,_cube.V011, + cy1); + GetConv2DCoefs(*_cube.quad_Z0, meshFaces[_indZ0]->GetSubShape(), + _cube.V000,_cube.V100,_cube.V110,_cube.V010, + cz0); + GetConv2DCoefs(*_cube.quad_Z1, meshFaces[_indZ1]->GetSubShape(), + _cube.V001,_cube.V101,_cube.V111,_cube.V011, + cz1); + + // 1.8 - create a 3D structure for normalized values + + MESSAGE("---"); + int nbx = _cube.quad_Y0->nbPts[0]; + int nby = _cube.quad_Y0->nbPts[1]; + int nbz; + if (cx0.a1 != 0) nbz = _cube.quad_X0->nbPts[1]; + else nbz = _cube.quad_X0->nbPts[0]; + //SCRUTE(nbx); + //SCRUTE(nby); + //SCRUTE(nbz); + int nbxyz= nbx*nby*nbz; + Point3DStruct* np = new Point3DStruct[nbxyz]; + + // 1.9 - store node indexes of faces + + { + const TopoDS_Face& F = TopoDS::Face(meshFaces[_indX0]->GetSubShape()); + const TColStd_ListOfInteger& indElt + = aMesh.GetSubMesh(F)->GetSubMeshDS()->GetIDNodes(); + TColStd_ListIteratorOfListOfInteger itf(indElt); + + faceQuadStruct* quad = _cube.quad_X0; + int i=0; // j = x/face , k = y/face + int nbdown = quad->nbPts[0]; + int nbright = quad->nbPts[1]; + + for (; itf.More(); itf.Next()) + { + int nodeId = itf.Value(); + Handle (SMDS_MeshElement) elt = meshDS->FindNode(nodeId); + Handle (SMDS_MeshNode) node = meshDS->GetNode(1, elt); + Handle (SMDS_FacePosition) fpos + = Handle (SMDS_FacePosition)::DownCast(node->GetPosition()); + double ri = fpos->GetUParameter(); + double rj = fpos->GetVParameter(); + int i1 = int(ri); + int j1 = int(rj); + int ij1 = j1*nbdown +i1; + quad->uv_grid[ij1].nodeId = nodeId; + } + + for (int i1=0; i1uv_grid[ij1].nodeId; + //SCRUTE(np[ijk].nodeId); + } + } + + { + const TopoDS_Face& F = TopoDS::Face(meshFaces[_indX1]->GetSubShape()); + const TColStd_ListOfInteger& indElt + = aMesh.GetSubMesh(F)->GetSubMeshDS()->GetIDNodes(); + TColStd_ListIteratorOfListOfInteger itf(indElt); + + faceQuadStruct* quad = _cube.quad_X1; + int i=nbx-1; // j = x/face , k = y/face + int nbdown = quad->nbPts[0]; + int nbright = quad->nbPts[1]; + + for (; itf.More(); itf.Next()) + { + int nodeId = itf.Value(); + Handle (SMDS_MeshElement) elt = meshDS->FindNode(nodeId); + Handle (SMDS_MeshNode) node = meshDS->GetNode(1, elt); + Handle (SMDS_FacePosition) fpos + = Handle (SMDS_FacePosition)::DownCast(node->GetPosition()); + double ri = fpos->GetUParameter(); + double rj = fpos->GetVParameter(); + int i1 = int(ri); + int j1 = int(rj); + int ij1 = j1*nbdown +i1; + quad->uv_grid[ij1].nodeId = nodeId; + } + + for (int i1=0; i1uv_grid[ij1].nodeId; + //SCRUTE(np[ijk].nodeId); + } + } + + { + const TopoDS_Face& F = TopoDS::Face(meshFaces[_indY0]->GetSubShape()); + const TColStd_ListOfInteger& indElt + = aMesh.GetSubMesh(F)->GetSubMeshDS()->GetIDNodes(); + TColStd_ListIteratorOfListOfInteger itf(indElt); + + faceQuadStruct* quad = _cube.quad_Y0; + int j=0; // i = x/face , k = y/face + int nbdown = quad->nbPts[0]; + int nbright = quad->nbPts[1]; + + for (; itf.More(); itf.Next()) + { + int nodeId = itf.Value(); + Handle (SMDS_MeshElement) elt = meshDS->FindNode(nodeId); + Handle (SMDS_MeshNode) node = meshDS->GetNode(1, elt); + Handle (SMDS_FacePosition) fpos + = Handle (SMDS_FacePosition)::DownCast(node->GetPosition()); + double ri = fpos->GetUParameter(); + double rj = fpos->GetVParameter(); + int i1 = int(ri); + int j1 = int(rj); + int ij1 = j1*nbdown +i1; + quad->uv_grid[ij1].nodeId = nodeId; + } + + for (int i1=0; i1uv_grid[ij1].nodeId; + //SCRUTE(np[ijk].nodeId); + } + } + + { + const TopoDS_Face& F = TopoDS::Face(meshFaces[_indY1]->GetSubShape()); + const TColStd_ListOfInteger& indElt + = aMesh.GetSubMesh(F)->GetSubMeshDS()->GetIDNodes(); + TColStd_ListIteratorOfListOfInteger itf(indElt); + + faceQuadStruct* quad = _cube.quad_Y1; + int j=nby-1; // i = x/face , k = y/face + int nbdown = quad->nbPts[0]; + int nbright = quad->nbPts[1]; + + for (; itf.More(); itf.Next()) + { + int nodeId = itf.Value(); + Handle (SMDS_MeshElement) elt = meshDS->FindNode(nodeId); + Handle (SMDS_MeshNode) node = meshDS->GetNode(1, elt); + Handle (SMDS_FacePosition) fpos + = Handle (SMDS_FacePosition)::DownCast(node->GetPosition()); + double ri = fpos->GetUParameter(); + double rj = fpos->GetVParameter(); + int i1 = int(ri); + int j1 = int(rj); + int ij1 = j1*nbdown +i1; + quad->uv_grid[ij1].nodeId = nodeId; + } + + for (int i1=0; i1uv_grid[ij1].nodeId; + //SCRUTE(np[ijk].nodeId); + } + } + + { + const TopoDS_Face& F = TopoDS::Face(meshFaces[_indZ0]->GetSubShape()); + const TColStd_ListOfInteger& indElt + = aMesh.GetSubMesh(F)->GetSubMeshDS()->GetIDNodes(); + TColStd_ListIteratorOfListOfInteger itf(indElt); + + faceQuadStruct* quad = _cube.quad_Z0; + int k=0; // i = x/face , j = y/face + int nbdown = quad->nbPts[0]; + int nbright = quad->nbPts[1]; + + for (; itf.More(); itf.Next()) + { + int nodeId = itf.Value(); + Handle (SMDS_MeshElement) elt = meshDS->FindNode(nodeId); + Handle (SMDS_MeshNode) node = meshDS->GetNode(1, elt); + Handle (SMDS_FacePosition) fpos + = Handle (SMDS_FacePosition)::DownCast(node->GetPosition()); + double ri = fpos->GetUParameter(); + double rj = fpos->GetVParameter(); + int i1 = int(ri); + int j1 = int(rj); + int ij1 = j1*nbdown +i1; + quad->uv_grid[ij1].nodeId = nodeId; + } + + for (int i1=0; i1uv_grid[ij1].nodeId; + //SCRUTE(np[ijk].nodeId); + } + } + + { + const TopoDS_Face& F = TopoDS::Face(meshFaces[_indZ1]->GetSubShape()); + const TColStd_ListOfInteger& indElt + = aMesh.GetSubMesh(F)->GetSubMeshDS()->GetIDNodes(); + TColStd_ListIteratorOfListOfInteger itf(indElt); + + faceQuadStruct* quad = _cube.quad_Z1; + int k=nbz-1; // i = x/face , j = y/face + int nbdown = quad->nbPts[0]; + int nbright = quad->nbPts[1]; + + for (; itf.More(); itf.Next()) + { + int nodeId = itf.Value(); + Handle (SMDS_MeshElement) elt = meshDS->FindNode(nodeId); + Handle (SMDS_MeshNode) node = meshDS->GetNode(1, elt); + Handle (SMDS_FacePosition) fpos + = Handle (SMDS_FacePosition)::DownCast(node->GetPosition()); + double ri = fpos->GetUParameter(); + double rj = fpos->GetVParameter(); + int i1 = int(ri); + int j1 = int(rj); + int ij1 = j1*nbdown +i1; + quad->uv_grid[ij1].nodeId = nodeId; + } + + for (int i1=0; i1uv_grid[ij1].nodeId; + //SCRUTE(np[ijk].nodeId); + } + } + + // 2.0 - for each node of the cube: + // - get the 8 points 3D = 8 vertices of the cube + // - get the 12 points 3D on the 12 edges of the cube + // - get the 6 points 3D on the 6 faces with their ID + // - compute the point 3D + // - store the point 3D in SMESHDS, store its ID in 3D structure + + TopoDS_Shell aShell; + TopExp_Explorer exp(aShape,TopAbs_SHELL); + if (exp.More()) + { + aShell = TopoDS::Shell(exp.Current()); + } + else + { + MESSAGE("no shell..."); + ASSERT(0); + } + + MESSAGE("---"); + Pt3 p000, p001, p010, p011, p100, p101, p110, p111; + Pt3 px00, px01, px10, px11; + Pt3 p0y0, p0y1, p1y0, p1y1; + Pt3 p00z, p01z, p10z, p11z; + Pt3 pxy0, pxy1, px0z, px1z, p0yz, p1yz; + + GetPoint(p000, 0, 0, 0, nbx, nby, nbz, np, meshDS); + GetPoint(p001, 0, 0, nbz-1, nbx, nby, nbz, np, meshDS); + GetPoint(p010, 0, nby-1, 0, nbx, nby, nbz, np, meshDS); + GetPoint(p011, 0, nby-1, nbz-1, nbx, nby, nbz, np, meshDS); + GetPoint(p100, nbx-1, 0, 0, nbx, nby, nbz, np, meshDS); + GetPoint(p101, nbx-1, 0, nbz-1, nbx, nby, nbz, np, meshDS); + GetPoint(p110, nbx-1, nby-1, 0, nbx, nby, nbz, np, meshDS); + GetPoint(p111, nbx-1, nby-1, nbz-1, nbx, nby, nbz, np, meshDS); + + for (int i=1; iAddNode(X[0],X[1],X[2]); + //MESSAGE("point "<FindNode(myNodeId); + Handle (SMDS_MeshNode) node = meshDS->GetNode(1, elt); + + //meshDS->SetNodeInVolume(node, TopoDS::Solid(aShape)); + meshDS->SetNodeInVolume(node, aShell); + } + } + } + + //2.1 - for each node of the cube (less 3 *1 Faces): + // - store hexahedron in SMESHDS + + for (int i=0; iAddVolume(np[n1].nodeId, + np[n2].nodeId, + np[n3].nodeId, + np[n4].nodeId, + np[n5].nodeId, + np[n6].nodeId, + np[n7].nodeId, + np[n8].nodeId); + Handle (SMDS_MeshElement) elt = meshDS->FindElement(hexa); + meshDS->SetMeshElementOnShape(elt, aShell); + + // *** 5 tetrahedres ... verifier orientations, + // mettre en coherence &vec quadrangles-> triangles + // choisir afficher 1 parmi edges, face et volumes +// int tetra1 = meshDS->AddVolume(np[n1].nodeId, +// np[n2].nodeId, +// np[n4].nodeId, +// np[n5].nodeId); +// int tetra2 = meshDS->AddVolume(np[n2].nodeId, +// np[n3].nodeId, +// np[n4].nodeId, +// np[n7].nodeId); +// int tetra3 = meshDS->AddVolume(np[n5].nodeId, +// np[n6].nodeId, +// np[n7].nodeId, +// np[n2].nodeId); +// int tetra4 = meshDS->AddVolume(np[n5].nodeId, +// np[n7].nodeId, +// np[n8].nodeId, +// np[n4].nodeId); +// int tetra5 = meshDS->AddVolume(np[n5].nodeId, +// np[n7].nodeId, +// np[n2].nodeId, +// np[n4].nodeId); + + } + + return true; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +void SMESH_Hexa_3D::GetPoint(Pt3 p, + int i, int j, int k, + int nbx, int nby, int nbz, + Point3DStruct *np, + const Handle(SMESHDS_Mesh)& meshDS) +{ + int ijk = k*nbx*nby + j*nbx + i; + int nodeId = np[ijk].nodeId; + Handle (SMDS_MeshElement) elt = meshDS->FindNode(nodeId); + Handle (SMDS_MeshNode) node = meshDS->GetNode(1, elt); + p[0] = node->X(); + p[1] = node->Y(); + p[2] = node->Z(); + //MESSAGE(" "<& meshFaces, + const TopoDS_Vertex& V0, + const TopoDS_Vertex& V1, + const TopoDS_Vertex& V2, + const TopoDS_Vertex& V3) +{ + MESSAGE("SMESH_Hexa_3D::GetFaceIndex"); + int faceIndex = -1; + for (int i=1; i<6; i++) + { + const TopoDS_Shape& aFace = meshFaces[i]->GetSubShape(); + //const TopoDS_Face& F = TopoDS::Face(aFace); + TopTools_IndexedMapOfShape M; + TopExp::MapShapes(aFace, TopAbs_VERTEX, M); + bool verticesInShape = false; + if (M.Contains(V0)) + if (M.Contains(V1)) + if (M.Contains(V2)) + if (M.Contains(V3)) verticesInShape = true; + if (verticesInShape) + { + faceIndex = i; + break; + } + } + ASSERT(faceIndex>0); + SCRUTE(faceIndex); + return faceIndex; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +TopoDS_Edge +SMESH_Hexa_3D::EdgeNotInFace(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape, + const TopoDS_Face& aFace, + const TopoDS_Vertex& aVertex, + const TopTools_IndexedDataMapOfShapeListOfShape& MS) +{ + MESSAGE("SMESH_Hexa_3D::EdgeNotInFace"); + TopTools_IndexedDataMapOfShapeListOfShape MF; + TopExp::MapShapesAndAncestors(aFace, TopAbs_VERTEX, TopAbs_EDGE, MF); + const TopTools_ListOfShape& ancestorsInSolid = MS.FindFromKey(aVertex); + const TopTools_ListOfShape& ancestorsInFace = MF.FindFromKey(aVertex); + SCRUTE(ancestorsInSolid.Extent()); + SCRUTE(ancestorsInFace.Extent()); + ASSERT(ancestorsInSolid.Extent() == 6); // 6 (edges doublees) + ASSERT(ancestorsInFace.Extent() == 2); + + TopoDS_Edge E; + E.Nullify(); + TopTools_ListIteratorOfListOfShape its(ancestorsInSolid); + for ( ; its.More();its.Next()) + { + TopoDS_Shape ancestor = its.Value(); + TopTools_ListIteratorOfListOfShape itf(ancestorsInFace); + bool isInFace = false; + for ( ; itf.More();itf.Next()) + { + TopoDS_Shape ancestorInFace = itf.Value(); + if (ancestorInFace.IsSame(ancestor)) + { + isInFace = true; + break; + } + } + if (! isInFace) + { + E = TopoDS::Edge(ancestor); + break; + } + } + return E; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + + void SMESH_Hexa_3D::GetConv2DCoefs(const faceQuadStruct& quad, + const TopoDS_Shape& aShape, + const TopoDS_Vertex& V0, + const TopoDS_Vertex& V1, + const TopoDS_Vertex& V2, + const TopoDS_Vertex& V3, + Conv2DStruct& conv) +{ + MESSAGE("SMESH_Hexa_3D::GetConv2DCoefs"); + const TopoDS_Face& F = TopoDS::Face(aShape); + TopoDS_Edge E = quad.edge[0]; + double f,l; + Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface(E,F,f,l); + TopoDS_Vertex VFirst, VLast; + TopExp::Vertices(E, VFirst, VLast); // corresponds to f and l + bool isForward = (((l-f)*(quad.last[0] - quad.first[0])) > 0); + TopoDS_Vertex VA, VB; + if (isForward) + { + VA = VFirst; VB = VLast; + } + else + { + VA = VLast; VB = VFirst; + } + int a1,b1,c1,a2,b2,c2; + if (VA.IsSame(V0)) + if (VB.IsSame(V1)) + { + a1= 1; b1= 0; c1= 0; // x + a2= 0; b2= 1; c2= 0; // y + } + else + { + ASSERT(VB.IsSame(V3)); + a1= 0; b1= 1; c1= 0; // y + a2= 1; b2= 0; c2= 0; // x + } + if (VA.IsSame(V1)) + if (VB.IsSame(V2)) + { + a1= 0; b1=-1; c1= 1; // 1-y + a2= 1; b2= 0; c2= 0; // x + } + else + { + ASSERT(VB.IsSame(V0)); + a1=-1; b1= 0; c1= 1; // 1-x + a2= 0; b2= 1; c2= 0; // y + } + if (VA.IsSame(V2)) + if (VB.IsSame(V3)) + { + a1=-1; b1= 0; c1= 1; // 1-x + a2= 0; b2=-1; c2= 1; // 1-y + } + else + { + ASSERT(VB.IsSame(V1)); + a1= 0; b1=-1; c1= 1; // 1-y + a2=-1; b2= 0; c2= 1; // 1-x + } + if (VA.IsSame(V3)) + if (VB.IsSame(V0)) + { + a1= 0; b1= 1; c1= 0; // y + a2=-1; b2= 0; c2= 1; // 1-x + } + else + { + ASSERT(VB.IsSame(V2)); + a1= 1; b1= 0; c1= 0; // x + a2= 0; b2=-1; c2= 1; // 1-y + } + MESSAGE("X = "<> (*this); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +ostream & operator << (ostream & save, SMESH_Hexa_3D & hyp) +{ + return save; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +istream & operator >> (istream & load, SMESH_Hexa_3D & hyp) +{ + return load; +} diff --git a/src/SMESH/SMESH_Hexa_3D.hxx b/src/SMESH/SMESH_Hexa_3D.hxx new file mode 100644 index 000000000..434ace0ea --- /dev/null +++ b/src/SMESH/SMESH_Hexa_3D.hxx @@ -0,0 +1,119 @@ +//============================================================================= +// File : SMESH_Hexa_3D.hxx +// Created : sam mai 18 23:15:26 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= + +#ifndef _SMESH_HEXA_3D_HXX_ +#define _SMESH_HEXA_3D_HXX_ + +#include "SMESH_3D_Algo.hxx" +#include "SMESH_Mesh.hxx" +#include "SMESH_Quadrangle_2D.hxx" +#include "Utils_SALOME_Exception.hxx" + +typedef struct point3Dstruct +{ + int nodeId; +} Point3DStruct; + +typedef double Pt3[3]; + +typedef struct conv2dstruct +{ + double a1; // X = a1*x + b1*y + c1 + double b1; // Y = a2*x + b2*y + c2 + double c1; // a1, b1 a2, b2 in {-1,0,1} + double a2; // c1, c2 in {0,1} + double b2; + double c2; + int ia; // I = ia*i + ib*j + ic + int ib; + int ic; + int ja; // J = ja*i + jb*j + jc + int jb; + int jc; +} Conv2DStruct; + +typedef struct cubeStruct +{ + TopoDS_Vertex V000; + TopoDS_Vertex V001; + TopoDS_Vertex V010; + TopoDS_Vertex V011; + TopoDS_Vertex V100; + TopoDS_Vertex V101; + TopoDS_Vertex V110; + TopoDS_Vertex V111; + faceQuadStruct* quad_X0; + faceQuadStruct* quad_X1; + faceQuadStruct* quad_Y0; + faceQuadStruct* quad_Y1; + faceQuadStruct* quad_Z0; + faceQuadStruct* quad_Z1; + Point3DStruct* np; // normalised 3D coordinates +} CubeStruct; + +class SMESH_Hexa_3D: + public SMESH_3D_Algo +{ +public: + SMESH_Hexa_3D(int hypId, int studyId, SMESH_Gen* gen); + virtual ~SMESH_Hexa_3D(); + + virtual bool CheckHypothesis(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape); + + virtual bool Compute(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape) + throw (SALOME_Exception); + + ostream & SaveTo(ostream & save); + istream & LoadFrom(istream & load); + friend ostream & operator << (ostream & save, SMESH_Hexa_3D & hyp); + friend istream & operator >> (istream & load, SMESH_Hexa_3D & hyp); + +protected: + TopoDS_Edge + EdgeNotInFace(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape, + const TopoDS_Face& aFace, + const TopoDS_Vertex& aVertex, + const TopTools_IndexedDataMapOfShapeListOfShape& MS); + + int GetFaceIndex(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape, + const vector& meshFaces, + const TopoDS_Vertex& V0, + const TopoDS_Vertex& V1, + const TopoDS_Vertex& V2, + const TopoDS_Vertex& V3); + + void GetConv2DCoefs(const faceQuadStruct& quad, + const TopoDS_Shape& aShape, + const TopoDS_Vertex& V0, + const TopoDS_Vertex& V1, + const TopoDS_Vertex& V2, + const TopoDS_Vertex& V3, + Conv2DStruct& conv); + + void GetPoint(Pt3 p, + int i, int j, int k, + int nbx, int nby, int nbz, + Point3DStruct *np, + const Handle(SMESHDS_Mesh)& meshDS); + + CubeStruct _cube; + FaceQuadStruct* _quads[6]; + int _indX0; + int _indX1; + int _indY0; + int _indY1; + int _indZ0; + int _indZ1; +}; + +#endif diff --git a/src/SMESH/SMESH_Hypothesis.cxx b/src/SMESH/SMESH_Hypothesis.cxx new file mode 100644 index 000000000..fa092219f --- /dev/null +++ b/src/SMESH/SMESH_Hypothesis.cxx @@ -0,0 +1,116 @@ +using namespace std; +//============================================================================= +// File : SMESH_Hypothesis.cxx +// Created : sam mai 18 08:08:50 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= +using namespace std; + +#include "SMESH_Hypothesis.hxx" +#include "SMESH_Gen.hxx" +#include "utilities.h" + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_Hypothesis::SMESH_Hypothesis(int hypId, + int studyId, + SMESH_Gen* gen) : SMESHDS_Hypothesis(hypId) +{ + //MESSAGE("SMESH_Hypothesis::SMESH_Hypothesis"); + _gen = gen; + _studyId = studyId; + StudyContextStruct* myStudyContext = _gen->GetStudyContext(_studyId); + myStudyContext->mapHypothesis[_hypId] = this; + _type = PARAM_ALGO; +// _shapeType = -1; // to be set by algo with TopAbs_Enum + _shapeType = 0; // to be set by algo with TopAbs_Enum +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_Hypothesis::~SMESH_Hypothesis() +{ + MESSAGE("SMESH_Hypothesis::~SMESH_Hypothesis"); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +int SMESH_Hypothesis::GetDim() +{ + int dim = -1; + switch (_type) + { + case ALGO_1D: dim = 1; break; + case ALGO_2D: dim = 2; break; + case ALGO_3D: dim = 3; break; + } + return dim; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +int SMESH_Hypothesis::GetShapeType() +{ + return _shapeType; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +int SMESH_Hypothesis::GetStudyId() +{ + return _studyId; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +void SMESH_Hypothesis::NotifySubMeshesHypothesisModification() +{ + MESSAGE("SMESH_Hypothesis::NotifySubMeshesHypothesisModification"); + + // for all meshes in study + + StudyContextStruct* myStudyContext = _gen->GetStudyContext(_studyId); + map::iterator itm; + for (itm = myStudyContext->mapMesh.begin(); + itm != myStudyContext->mapMesh.end(); + itm++) + { + SMESH_Mesh* mesh = (*itm).second; + const list& subMeshes = + mesh->GetSubMeshUsingHypothesis(this); + + //for all subMeshes using hypothesis + + list::const_iterator its; + for (its = subMeshes.begin(); its != subMeshes.end(); its++) + (*its)->ComputeStateEngine(SMESH_subMesh::MODIF_HYP); + } +} + diff --git a/src/SMESH/SMESH_Hypothesis.hxx b/src/SMESH/SMESH_Hypothesis.hxx new file mode 100644 index 000000000..03b50b972 --- /dev/null +++ b/src/SMESH/SMESH_Hypothesis.hxx @@ -0,0 +1,33 @@ +//============================================================================= +// File : SMESH_Hypothesis.hxx +// Created : sam mai 18 08:07:54 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= + +#ifndef _SMESH_HYPOTHESIS_HXX_ +#define _SMESH_HYPOTHESIS_HXX_ + +#include "SMESHDS_Hypothesis.hxx" + +class SMESH_Gen; + +class SMESH_Hypothesis: public SMESHDS_Hypothesis +{ +public: + SMESH_Hypothesis(int hypId, int studyId, SMESH_Gen* gen); + virtual ~SMESH_Hypothesis(); + int GetDim(); + int GetStudyId(); + void NotifySubMeshesHypothesisModification(); + int GetShapeType(); + +protected: + SMESH_Gen* _gen; + int _studyId; + int _shapeType; +}; + +#endif diff --git a/src/SMESH/SMESH_HypothesisCreator.hxx b/src/SMESH/SMESH_HypothesisCreator.hxx new file mode 100644 index 000000000..e5a050cf1 --- /dev/null +++ b/src/SMESH/SMESH_HypothesisCreator.hxx @@ -0,0 +1,49 @@ +//============================================================================= +// File : SMESH_HypothesisCreator.hxx +// Created : lun mai 27 15:28:35 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= + +#ifndef _SMESH_HYPOTHESISCREATOR_HXX_ +#define _SMESH_HYPOTHESISCREATOR_HXX_ + +#include "SMESH_HypothesisFactory.hxx" + +class SMESH_gen; + +//============================================================================= +/*! + * Specific Hypothesis Creators are generated with a template which inherits a + * generic hypothesis creator. Each creator returns an hypothesis of the type + * given in the template. + */ +//============================================================================= + +template class SMESH_HypothesisCreator + : public GenericHypothesisCreator +{ +public: +// map _instances; + +// virtual T* GetInstance(int hypId) +// { +// if (_instances.find(hypId) != _instances.end()) +// return _instances[hypId]; +// else +// return NULL; +// } + + virtual T* Create (int hypId, int studyId, SMESH_Gen* gen) + { + T* anInstance= new T(hypId, studyId, gen); +// _gen->StoreHypothesisInstance(anInstance); +// _instances[hypId] = anInstance; + return anInstance; + }; +}; + + +#endif diff --git a/src/SMESH/SMESH_HypothesisFactory.cxx b/src/SMESH/SMESH_HypothesisFactory.cxx new file mode 100644 index 000000000..afbcf37a6 --- /dev/null +++ b/src/SMESH/SMESH_HypothesisFactory.cxx @@ -0,0 +1,154 @@ +using namespace std; +//============================================================================= +// File : SMESH_HypothesisFactory.cxx +// Created : mer mai 15 13:45:50 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= +using namespace std; + +#include "SMESH_HypothesisFactory.hxx" +#include "SMESH_Hypothesis.hxx" +#include "SMESH_HypothesisCreator.hxx" +#include "SMESH_Gen.hxx" + +#include "utilities.h" + +// Add new hypothesis here (include file) +//--------------------------------------- +#include "SMESH_LocalLength.hxx" +#include "SMESH_LengthFromEdges.hxx" +#include "SMESH_NumberOfSegments.hxx" +#include "SMESH_MaxElementArea.hxx" +#include "SMESH_Regular_1D.hxx" +#include "SMESH_MEFISTO_2D.hxx" +#include "SMESH_Quadrangle_2D.hxx" +#include "SMESH_Hexa_3D.hxx" + +//--------------------------------------- + +//============================================================================= +/*! + * Specific Hypothesis Creators are generated with a template which inherits a + * generic hypothesis creator. Each creator returns an hypothesis of the type + * given in the template. + */ +//============================================================================= + +// template class HypothesisCreator: public GenericHypothesisCreator +// { +// public: +// virtual T* Create (int hypId) +// { +// // return new T(hypId); +// }; + +// }; + +//============================================================================= +/*! + * Constructor: instanciate specific hypothesis creators, fill a private map + * indexed by hypothesis names. THIS METHOD MUST BE COMPLETED WHEN A NEW + * HYPOTHESIS IS ADDED. + * Specific hypothesis creator are defined with the above template. + * Hypothesis names are related to the corresponding class names: + * prefix = SMESH_ ; suffix = . + */ +//============================================================================= + +SMESH_HypothesisFactory::SMESH_HypothesisFactory() +{ + _hypId = 0; + +// Add new hypothesis here (creators) +//--------------------------------------- +_creatorMap["LocalLength"] = new SMESH_HypothesisCreator; +_creatorMap["NumberOfSegments"] = new SMESH_HypothesisCreator; +_creatorMap["LengthFromEdges"] = new SMESH_HypothesisCreator; +_creatorMap["MaxElementArea"] = new SMESH_HypothesisCreator; +_creatorMap["Regular_1D"] = new SMESH_HypothesisCreator; +_creatorMap["MEFISTO_2D"] = new SMESH_HypothesisCreator; +_creatorMap["Quadrangle_2D"] = new SMESH_HypothesisCreator; +_creatorMap["Hexa_3D"] = new SMESH_HypothesisCreator; + +//--------------------------------------- +} + +//============================================================================= +/*! + * Destructor: deletes specific hypothesis creators instanciated in the + * constructor. + */ +//============================================================================= + +SMESH_HypothesisFactory::~SMESH_HypothesisFactory() +{ + map::iterator it; + for (it = _creatorMap.begin(); it != _creatorMap.end(); it++) + { + delete (*it).second; + } + _creatorMap.clear(); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_Hypothesis* SMESH_HypothesisFactory::Create(const char* anHypName, + int studyId) + throw (SALOME_Exception) +{ + MESSAGE("SMESH_HypothesisFactory::Create " << anHypName); + if (_creatorMap.find(anHypName) == _creatorMap.end()) + throw(SALOME_Exception(LOCALIZED("bad hypothesis type name"))); + SMESH_Hypothesis* myHyp = _creatorMap[anHypName]->Create(_hypId++, + studyId, + _gen); + return myHyp; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +GenericHypothesisCreator* +SMESH_HypothesisFactory::GetCreator(const char* anHypName) + throw (SALOME_Exception) +{ + MESSAGE("SMESH_HypothesisFactory::GetCreator " << anHypName); + if (_creatorMap.find(anHypName) == _creatorMap.end()) + throw(SALOME_Exception(LOCALIZED("bad hypothesis type name"))); + return _creatorMap[anHypName]; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +int SMESH_HypothesisFactory::GetANewId() +{ + //MESSAGE("SMESH_HypothesisFactory::GetANewId"); + return _hypId++; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +void SMESH_HypothesisFactory::SetGen(SMESH_Gen* gen) +{ + //MESSAGE("SMESH_HypothesisFactory::SetGen"); + _gen = gen; +} + diff --git a/src/SMESH/SMESH_HypothesisFactory.hxx b/src/SMESH/SMESH_HypothesisFactory.hxx new file mode 100644 index 000000000..7ade68122 --- /dev/null +++ b/src/SMESH/SMESH_HypothesisFactory.hxx @@ -0,0 +1,50 @@ +//============================================================================= +// File : SMESH_HypothesisFactory.hxx +// Created : mer mai 15 13:45:47 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= + +#ifndef _SMESH_HYPOTHESISFACTORY_HXX_ +#define _SMESH_HYPOTHESISFACTORY_HXX_ + +#include "SMESH_Hypothesis.hxx" + +#include "Utils_SALOME_Exception.hxx" + +#include + +class SMESH_Gen; + +class GenericHypothesisCreator +{ +public: +// virtual SMESH_Hypothesis* GetInstance(int hypId) = 0; + virtual SMESH_Hypothesis* Create(int hypId, int studyId, SMESH_Gen* gen) = 0; +}; + +class SMESH_HypothesisFactory +{ +public: + SMESH_HypothesisFactory(); + virtual ~SMESH_HypothesisFactory(); + + void SetGen(SMESH_Gen* gen); + + SMESH_Hypothesis* Create(const char* anHypName, int studyId) + throw (SALOME_Exception); + + GenericHypothesisCreator* GetCreator(const char* anHypName) + throw (SALOME_Exception); + + int GetANewId(); + +private: + map _creatorMap; + int _hypId; + SMESH_Gen* _gen; +}; + +#endif diff --git a/src/SMESH/SMESH_LengthFromEdges.cxx b/src/SMESH/SMESH_LengthFromEdges.cxx new file mode 100644 index 000000000..191282813 --- /dev/null +++ b/src/SMESH/SMESH_LengthFromEdges.cxx @@ -0,0 +1,117 @@ +using namespace std; +//============================================================================= +// File : SMESH_LengthFromEdges.cxx +// Created : mar jun 11 22:42:30 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= +using namespace std; + +#include "SMESH_LengthFromEdges.hxx" +#include "utilities.h" + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_LengthFromEdges::SMESH_LengthFromEdges(int hypId, int studyId, SMESH_Gen* gen) + : SMESH_Hypothesis(hypId, studyId, gen) +{ + _mode =1; + _name = "LengthFromEdges"; +// SCRUTE(_name); +// SCRUTE(&_name); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_LengthFromEdges::~SMESH_LengthFromEdges() +{ +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +void SMESH_LengthFromEdges::SetMode(int mode) + throw (SALOME_Exception) +{ + int oldMode = _mode; + if (mode <= 0) + throw SALOME_Exception(LOCALIZED("mode must be positive")); + _mode = mode; + if (oldMode != _mode) + NotifySubMeshesHypothesisModification(); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +int SMESH_LengthFromEdges::GetMode() +{ + return _mode; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +ostream & SMESH_LengthFromEdges::SaveTo(ostream & save) +{ + return save << this; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +istream & SMESH_LengthFromEdges::LoadFrom(istream & load) +{ + return load >> (*this); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +ostream & operator << (ostream & save, SMESH_LengthFromEdges & hyp) +{ + save << hyp._mode; + return save; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +istream & operator >> (istream & load, SMESH_LengthFromEdges & hyp) +{ + bool isOK = true; + int a; + isOK = (load >> a); + if (isOK) hyp._mode = a; + else load.clear(ios::badbit | load.rdstate()); + return load; +} + diff --git a/src/SMESH/SMESH_LengthFromEdges.hxx b/src/SMESH/SMESH_LengthFromEdges.hxx new file mode 100644 index 000000000..3afeb784e --- /dev/null +++ b/src/SMESH/SMESH_LengthFromEdges.hxx @@ -0,0 +1,37 @@ +//============================================================================= +// File : SMESH_LengthFromEdges.hxx +// Created : mar jun 11 22:42:20 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= + +#ifndef _SMESH_LENGTHFROMEDGES_HXX_ +#define _SMESH_LENGTHFROMEDGES_HXX_ + +#include "SMESH_Hypothesis.hxx" +#include "Utils_SALOME_Exception.hxx" + +class SMESH_LengthFromEdges: + public SMESH_Hypothesis +{ +public: + SMESH_LengthFromEdges(int hypId, int studyId, SMESH_Gen* gen); + virtual ~SMESH_LengthFromEdges(); + + void SetMode(int mode) + throw (SALOME_Exception); + + int GetMode(); + + virtual ostream & SaveTo(ostream & save); + virtual istream & LoadFrom(istream & load); + friend ostream & operator << (ostream & save, SMESH_LengthFromEdges & hyp); + friend istream & operator >> (istream & load, SMESH_LengthFromEdges & hyp); + +protected: + int _mode; +}; + +#endif diff --git a/src/SMESH/SMESH_LocalLength.cxx b/src/SMESH/SMESH_LocalLength.cxx new file mode 100644 index 000000000..85f4fb7a8 --- /dev/null +++ b/src/SMESH/SMESH_LocalLength.cxx @@ -0,0 +1,117 @@ +using namespace std; +//============================================================================= +// File : SMESH_LocalLength.cxx +// Created : sam mai 18 08:10:23 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= +using namespace std; + +#include "SMESH_LocalLength.hxx" +#include "utilities.h" + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_LocalLength::SMESH_LocalLength(int hypId, int studyId, SMESH_Gen* gen) + : SMESH_Hypothesis(hypId, studyId, gen) +{ + _length =1.; + _name = "LocalLength"; +// SCRUTE(_name); +// SCRUTE(&_name); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_LocalLength::~SMESH_LocalLength() +{ +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +void SMESH_LocalLength::SetLength(double length) + throw (SALOME_Exception) +{ + double oldLength = _length; + if (length <= 0) + throw SALOME_Exception(LOCALIZED("length must be positive")); + _length = length; + if (oldLength != _length) + NotifySubMeshesHypothesisModification(); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +double SMESH_LocalLength::GetLength() +{ + return _length; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +ostream & SMESH_LocalLength::SaveTo(ostream & save) +{ + return save << this; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +istream & SMESH_LocalLength::LoadFrom(istream & load) +{ + return load >> (*this); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +ostream & operator << (ostream & save, SMESH_LocalLength & hyp) +{ + save << hyp._length; + return save; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +istream & operator >> (istream & load, SMESH_LocalLength & hyp) +{ + bool isOK = true; + double a; + isOK = (load >> a); + if (isOK) hyp._length = a; + else load.clear(ios::badbit | load.rdstate()); + return load; +} + diff --git a/src/SMESH/SMESH_LocalLength.hxx b/src/SMESH/SMESH_LocalLength.hxx new file mode 100644 index 000000000..120ce4291 --- /dev/null +++ b/src/SMESH/SMESH_LocalLength.hxx @@ -0,0 +1,37 @@ +//============================================================================= +// File : SMESH_LocalLength.hxx +// Created : sam mai 18 08:10:19 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= + +#ifndef _SMESH_LOCALLENGTH_HXX_ +#define _SMESH_LOCALLENGTH_HXX_ + +#include "SMESH_Hypothesis.hxx" +#include "Utils_SALOME_Exception.hxx" + +class SMESH_LocalLength: + public SMESH_Hypothesis +{ +public: + SMESH_LocalLength(int hypId, int studyId, SMESH_Gen* gen); + virtual ~SMESH_LocalLength(); + + void SetLength(double length) + throw (SALOME_Exception); + + double GetLength(); + + virtual ostream & SaveTo(ostream & save); + virtual istream & LoadFrom(istream & load); + friend ostream & operator << (ostream & save, SMESH_LocalLength & hyp); + friend istream & operator >> (istream & load, SMESH_LocalLength & hyp); + +protected: + double _length; +}; + +#endif diff --git a/src/SMESH/SMESH_MEFISTO_2D.cxx b/src/SMESH/SMESH_MEFISTO_2D.cxx new file mode 100644 index 000000000..f9d4fde0a --- /dev/null +++ b/src/SMESH/SMESH_MEFISTO_2D.cxx @@ -0,0 +1,631 @@ +using namespace std; +//============================================================================= +// File : SMESH_MEFISTO_2D.cxx +// Created : sam mai 18 08:10:55 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= +using namespace std; + +#include "SMESH_MEFISTO_2D.hxx" +#include "SMESH_Gen.hxx" +#include "SMESH_Mesh.hxx" + +#include "SMESH_MaxElementArea.hxx" +#include "SMESH_LengthFromEdges.hxx" + +#include "Rn.h" +#include "aptrte.h" + +#include "SMESHDS_ListOfPtrHypothesis.hxx" +#include "SMESHDS_ListIteratorOfListOfPtrHypothesis.hxx" +#include "SMDS_MeshElement.hxx" +#include "SMDS_MeshNode.hxx" +#include "SMDS_EdgePosition.hxx" +#include "SMDS_FacePosition.hxx" + +#include "utilities.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_MEFISTO_2D::SMESH_MEFISTO_2D(int hypId, int studyId, SMESH_Gen* gen) + : SMESH_2D_Algo(hypId, studyId, gen) +{ + MESSAGE("SMESH_MEFISTO_2D::SMESH_MEFISTO_2D"); + _name = "MEFISTO_2D"; +// _shapeType = TopAbs_FACE; + _shapeType = (1<::const_iterator itl; + SMESHDS_Hypothesis* theHyp; + + const list& hyps = GetUsedHypothesis(aMesh, aShape); + int nbHyp = hyps.size(); + if (nbHyp != 1) return false; // only one compatible hypothesis allowed + + itl = hyps.begin(); + theHyp = (*itl); + + string hypName = theHyp->GetName(); + int hypId = theHyp->GetID(); + //SCRUTE(hypName); + + bool isOk = false; + + if (hypName == "MaxElementArea") + { + _hypMaxElementArea = dynamic_cast (theHyp); + ASSERT(_hypMaxElementArea); + _maxElementArea = _hypMaxElementArea->GetMaxArea(); + _edgeLength = 0; + isOk =true; + } + + if (hypName == "LengthFromEdges") + { + _hypLengthFromEdges = dynamic_cast (theHyp); + ASSERT(_hypLengthFromEdges); + _edgeLength = 0; + _maxElementArea = 0; + isOk =true; + } + + + if (isOk) + { + isOk = false; + if (_maxElementArea > 0) + { + _edgeLength = 2*sqrt(_maxElementArea); // triangles : minorant + isOk = true; + } + else isOk = (_hypLengthFromEdges != NULL); // **** check mode + } + + //SCRUTE(_edgeLength); + //SCRUTE(_maxElementArea); + return isOk; +} + + +//============================================================================= +/*! + * + */ +//============================================================================= + +bool SMESH_MEFISTO_2D::Compute(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape) +{ + MESSAGE("SMESH_MEFISTO_2D::Compute"); + + if (_hypLengthFromEdges) + _edgeLength = ComputeEdgeElementLength(aMesh, aShape); + + bool isOk = false; + const Handle(SMESHDS_Mesh)& meshDS = aMesh.GetMeshDS(); + SMESH_subMesh* theSubMesh = aMesh.GetSubMesh(aShape); + + const TopoDS_Face& FF = TopoDS::Face(aShape); + bool faceIsForward = (FF.Orientation() == TopAbs_FORWARD); + TopoDS_Face F = TopoDS::Face(FF.Oriented(TopAbs_FORWARD)); + + Z nblf; //nombre de lignes fermees (enveloppe en tete) + Z *nudslf=NULL; //numero du dernier sommet de chaque ligne fermee + R2 *uvslf=NULL; + Z nbpti=0; //nombre points internes futurs sommets de la triangulation + R2 *uvpti=NULL; + + Z nbst; + R2 *uvst=NULL; + Z nbt; + Z *nust=NULL; + Z ierr=0; + + Z nutysu=1; // 1: il existe un fonction areteideale_() + // Z nutysu=0; // 0: on utilise aretmx + R aretmx=_edgeLength; // longueur max aretes future triangulation + //SCRUTE(aretmx); + + nblf = NumberOfWires(F); + //SCRUTE(nblf); + + nudslf = new Z[1+nblf]; + nudslf[0] = 0; + int iw = 1; + int nbpnt = 0; + + const TopoDS_Wire OW1 = BRepTools::OuterWire(F); + nbpnt += NumberOfPoints (aMesh, OW1); + nudslf [iw++] = nbpnt; + //SCRUTE(nbpnt); + + for (TopExp_Explorer exp (F, TopAbs_WIRE); exp.More(); exp.Next()) + { + const TopoDS_Wire& W = TopoDS::Wire(exp.Current()); + if (!OW1.IsSame(W)) + { + nbpnt += NumberOfPoints (aMesh, W); + nudslf [iw++] = nbpnt; + //SCRUTE(nbpnt); + } + } + + uvslf = new R2[nudslf[nblf]]; + //SCRUTE(nudslf[nblf]); + int m = 0; + + map mefistoToDS; // correspondence mefisto index--> points IDNodes + TopoDS_Wire OW = BRepTools::OuterWire(F); + LoadPoints (aMesh, F, OW, uvslf, m, mefistoToDS); + //SCRUTE(m); + + for (TopExp_Explorer exp (F, TopAbs_WIRE); exp.More(); exp.Next()) + { + const TopoDS_Wire& W = TopoDS::Wire(exp.Current()); + if (!OW.IsSame(W)) + { + LoadPoints (aMesh, F, W, uvslf, m, mefistoToDS); + //SCRUTE(m); + } + } +// SCRUTE(nudslf[nblf]); +// for (int i=0; i<=nblf; i++) +// { +// MESSAGE(" -+- " <& mefistoToDS) +{ + MESSAGE("SMESH_MEFISTO_2D::LoadPoints"); + + Handle (SMDS_Mesh) meshDS = aMesh.GetMeshDS(); + + double scalex; + double scaley; + TopoDS_Face F = TopoDS::Face(FF.Oriented(TopAbs_FORWARD)); + ComputeScaleOnFace(aMesh, F, scalex, scaley); + + TopoDS_Wire W = TopoDS::Wire(WW.Oriented(TopAbs_FORWARD)); + BRepTools_WireExplorer wexp(W,F); + for (wexp.Init(W,F);wexp.More(); wexp.Next()) + { + const TopoDS_Edge& E = wexp.Current(); + + // --- IDNodes of first and last Vertex + + TopoDS_Vertex VFirst, VLast; + TopExp::Vertices(E, VFirst, VLast); // corresponds to f and l + + ASSERT(!VFirst.IsNull()); + SMESH_subMesh* firstSubMesh = aMesh.GetSubMesh(VFirst); + const TColStd_ListOfInteger& lidf + = firstSubMesh->GetSubMeshDS()->GetIDNodes(); + int idFirst= lidf.First(); +// SCRUTE(idFirst); + + ASSERT(!VLast.IsNull()); + SMESH_subMesh* lastSubMesh = aMesh.GetSubMesh(VLast); + const TColStd_ListOfInteger& lidl + = lastSubMesh->GetSubMeshDS()->GetIDNodes(); + int idLast= lidl.First(); +// SCRUTE(idLast); + + // --- edge internal IDNodes (relies on good order storage, not checked) + + int nbPoints = aMesh.GetSubMesh(E)->GetSubMeshDS()->NbNodes(); + //SCRUTE(nbPoints); + + Standard_Real f,l; + Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface(E,F,f,l); + + const TColStd_ListOfInteger& indElt + = aMesh.GetSubMesh(E)->GetSubMeshDS()->GetIDNodes(); + TColStd_ListIteratorOfListOfInteger ite(indElt); + //SCRUTE(nbPoints); + //SCRUTE(indElt.Extent()); + ASSERT(nbPoints == indElt.Extent()); + bool isForward = (E.Orientation() == TopAbs_FORWARD); + map params; + for (; ite.More(); ite.Next()) + { + int nodeId = ite.Value(); + Handle (SMDS_MeshElement) elt = meshDS->FindNode(nodeId); + Handle (SMDS_MeshNode) node = meshDS->GetNode(1, elt); + Handle (SMDS_EdgePosition) epos + = Handle (SMDS_EdgePosition)::DownCast(node->GetPosition()); + double param = epos->GetUParameter(); + params[param] = nodeId; +// MESSAGE(" " << param << " " << params[param]); + } + + // --- load 2D values into MEFISTO structure, + // add IDNodes in mefistoToDS map + + if (E.Orientation() == TopAbs_FORWARD) + { + gp_Pnt2d p = C2d->Value(f); // first point = Vertex Forward + uvslf [m].x = scalex * p.X(); + uvslf [m].y = scaley * p.Y(); + mefistoToDS[m+1] = idFirst; + //MESSAGE(" "<::iterator itp = params.begin(); + for (Standard_Integer i = 1; i<=nbPoints; i++) // nbPoints internal + { + double param = (*itp).first; + gp_Pnt2d p = C2d->Value(param); + uvslf [m].x = scalex * p.X(); + uvslf [m].y = scaley * p.Y(); + mefistoToDS[m+1] = (*itp).second; +// MESSAGE(" "<Value(l); // last point = Vertex Reversed + uvslf [m].x = scalex * p.X(); + uvslf [m].y = scaley * p.Y(); + mefistoToDS[m+1] = idLast; +// MESSAGE(" "<::reverse_iterator itp = params.rbegin(); + for (Standard_Integer i = nbPoints ; i >= 1; i--) + { + double param = (*itp).first; + gp_Pnt2d p = C2d->Value(param); + uvslf [m].x = scalex * p.X(); + uvslf [m].y = scaley * p.Y(); + mefistoToDS[m+1] = (*itp).second; +// MESSAGE(" "<Value(param); + if (p.X() < xmin) xmin = p.X(); + if (p.X() > xmax) xmax = p.X(); + if (p.Y() < ymin) ymin = p.Y(); + if (p.Y() > ymax) ymax = p.Y(); +// MESSAGE(" "<< f<<" "<Value(xmin, ymoy); + gp_Pnt PY0 = S->Value(xmoy, ymin); + for (Standard_Integer i = 1; i<= nbp; i++) + { + double x = xmin + (double(i)/double(nbp))*(xmax-xmin); + gp_Pnt PX = S->Value(x,ymoy); + double y = ymin + (double(i)/double(nbp))*(ymax-ymin); + gp_Pnt PY = S->Value(xmoy,y); + length_x += PX.Distance(PX0); + length_y += PY.Distance(PY0); + PX0.SetCoord(PX.X(),PX.Y(),PX.Z()); + PY0.SetCoord(PY.X(),PY.Y(),PY.Z()); + } +// SCRUTE(length_x); +// SCRUTE(length_y); + scalex = length_x/(xmax - xmin); + scaley = length_y/(ymax - ymin); +// SCRUTE(scalex); +// SCRUTE(scaley); + ASSERT(scalex); + ASSERT(scaley); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +void SMESH_MEFISTO_2D::StoreResult (SMESH_Mesh& aMesh, + Z nbst, R2* uvst, Z nbt, Z* nust, + const TopoDS_Face& F, bool faceIsForward, + map& mefistoToDS) +{ + double scalex; + double scaley; + ComputeScaleOnFace(aMesh, F, scalex, scaley); + + Handle (SMESHDS_Mesh) meshDS = aMesh.GetMeshDS(); + + Z n,m; + Handle(Geom_Surface) S = BRep_Tool::Surface(F); + + for ( n=0; nValue(u,v); + + if (mefistoToDS.find(n+1) == mefistoToDS.end()) + { + int nodeId = meshDS->AddNode(P.X(), P.Y(), P.Z()); + Handle (SMDS_MeshElement) elt = meshDS->FindNode(nodeId); + Handle (SMDS_MeshNode) node = meshDS->GetNode(1, elt); + meshDS->SetNodeOnFace(node, F); + + //MESSAGE(nodeId<<" "<GetPosition()); + fpos->SetUParameter(u); + fpos->SetVParameter(v); + } + } + + m=0; + int mt=0; + + //SCRUTE(faceIsForward); + for ( n=1; n<=nbt; n++ ) + { + int inode1 = nust[m++]; + int inode2 = nust[m++]; + int inode3 = nust[m++]; + + int nodeId1 = mefistoToDS[inode1]; + int nodeId2 = mefistoToDS[inode2]; + int nodeId3 = mefistoToDS[inode3]; + //MESSAGE("-- "<AddFace(nodeId1, nodeId2, nodeId3); + } + else + { + faceId = meshDS->AddFace(nodeId1, nodeId3, nodeId2); + } + Handle (SMDS_MeshElement) elt = meshDS->FindElement(faceId); + meshDS->SetMeshElementOnShape(elt, F); + m++; + } +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +double SMESH_MEFISTO_2D::ComputeEdgeElementLength(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape) +{ + MESSAGE("SMESH_MEFISTO_2D::ComputeEdgeElementLength"); + // **** a mettre dans SMESH_2D_Algo ? + + const TopoDS_Face& FF = TopoDS::Face(aShape); + bool faceIsForward = (FF.Orientation() == TopAbs_FORWARD); + TopoDS_Face F = TopoDS::Face(FF.Oriented(TopAbs_FORWARD)); + + double meanElementLength = 100; + double wireLength =0; + int wireElementsNumber =0; + for (TopExp_Explorer exp (F, TopAbs_WIRE); exp.More(); exp.Next()) + { + const TopoDS_Wire& W = TopoDS::Wire(exp.Current()); + for (TopExp_Explorer expe(W,TopAbs_EDGE); expe.More(); expe.Next()) + { + const TopoDS_Edge& E = TopoDS::Edge(expe.Current()); + int nb = aMesh.GetSubMesh(E)->GetSubMeshDS()->NbNodes(); + double length = EdgeLength(E); + wireLength += length; + wireElementsNumber += nb; + } + } + if (wireElementsNumber) + meanElementLength = wireLength/wireElementsNumber; + //SCRUTE(meanElementLength); + return meanElementLength; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +ostream & SMESH_MEFISTO_2D::SaveTo(ostream & save) +{ + return save << this; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +istream & SMESH_MEFISTO_2D::LoadFrom(istream & load) +{ + return load >> (*this); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +ostream & operator << (ostream & save, SMESH_MEFISTO_2D & hyp) +{ + return save; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +istream & operator >> (istream & load, SMESH_MEFISTO_2D & hyp) +{ + return load; +} + diff --git a/src/SMESH/SMESH_MEFISTO_2D.hxx b/src/SMESH/SMESH_MEFISTO_2D.hxx new file mode 100644 index 000000000..dc631bda6 --- /dev/null +++ b/src/SMESH/SMESH_MEFISTO_2D.hxx @@ -0,0 +1,67 @@ +//============================================================================= +// File : SMESH_MEFISTO_2D.hxx +// Created : sam mai 18 08:10:50 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= + +#ifndef _SMESH_MEFISTO_2D_HXX_ +#define _SMESH_MEFISTO_2D_HXX_ + +#include "SMESH_2D_Algo.hxx" +#include "SMESH_MaxElementArea.hxx" +#include "SMESH_LengthFromEdges.hxx" +#include "Rn.h" + +#include + +#include + +class SMESH_MEFISTO_2D: + public SMESH_2D_Algo +{ +public: + SMESH_MEFISTO_2D(int hypId, int studyId, SMESH_Gen* gen); + virtual ~SMESH_MEFISTO_2D(); + + virtual bool CheckHypothesis(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape); + + virtual bool Compute(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape); + + double ComputeEdgeElementLength(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape); + + void LoadPoints(SMESH_Mesh& aMesh, + const TopoDS_Face& F, + const TopoDS_Wire& W, + R2* uvslf, + int& m, + map& mefistoToDS); + + void ComputeScaleOnFace(SMESH_Mesh& aMesh, + const TopoDS_Face& aFace, + double& scalex, + double& scaley); + + void StoreResult (SMESH_Mesh& aMesh, + Z nbst, R2* uvst, Z nbt, Z* nust, + const TopoDS_Face& F, bool faceIsForward, + map& mefistoToDS); + + ostream & SaveTo(ostream & save); + istream & LoadFrom(istream & load); + friend ostream & operator << (ostream & save, SMESH_MEFISTO_2D & hyp); + friend istream & operator >> (istream & load, SMESH_MEFISTO_2D & hyp); + +protected: + double _edgeLength; + double _maxElementArea; + SMESH_MaxElementArea* _hypMaxElementArea; + SMESH_LengthFromEdges* _hypLengthFromEdges; +}; + +#endif diff --git a/src/SMESH/SMESH_MaxElementArea.cxx b/src/SMESH/SMESH_MaxElementArea.cxx new file mode 100644 index 000000000..9b4668ce2 --- /dev/null +++ b/src/SMESH/SMESH_MaxElementArea.cxx @@ -0,0 +1,117 @@ +using namespace std; +//============================================================================= +// File : SMESH_MaxElementArea.cxx +// Created : sam mai 18 23:14:08 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= +using namespace std; + +#include "SMESH_MaxElementArea.hxx" +#include "utilities.h" + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_MaxElementArea::SMESH_MaxElementArea(int hypId, int studyId, SMESH_Gen* gen) + : SMESH_Hypothesis(hypId, studyId, gen) +{ + _maxArea =1.; + _name = "MaxElementArea"; +// SCRUTE(_name); +// SCRUTE(&_name); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_MaxElementArea::~SMESH_MaxElementArea() +{ +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +void SMESH_MaxElementArea::SetMaxArea(double maxArea) + throw (SALOME_Exception) +{ + double oldArea = _maxArea; + if (maxArea <= 0) + throw SALOME_Exception(LOCALIZED("maxArea must be positive")); + _maxArea = maxArea; + if (_maxArea != oldArea) + NotifySubMeshesHypothesisModification(); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +double SMESH_MaxElementArea::GetMaxArea() +{ + return _maxArea; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +ostream & SMESH_MaxElementArea::SaveTo(ostream & save) +{ + return save << this; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +istream & SMESH_MaxElementArea::LoadFrom(istream & load) +{ + return load >> (*this); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +ostream & operator << (ostream & save, SMESH_MaxElementArea & hyp) +{ + save << hyp._maxArea; + return save; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +istream & operator >> (istream & load, SMESH_MaxElementArea & hyp) +{ + bool isOK = true; + double a; + isOK = (load >> a); + if (isOK) hyp._maxArea = a; + else load.clear(ios::badbit | load.rdstate()); + return load; +} + diff --git a/src/SMESH/SMESH_MaxElementArea.hxx b/src/SMESH/SMESH_MaxElementArea.hxx new file mode 100644 index 000000000..f97040bdc --- /dev/null +++ b/src/SMESH/SMESH_MaxElementArea.hxx @@ -0,0 +1,37 @@ +//============================================================================= +// File : SMESH_MaxElementArea.hxx +// Created : sam mai 18 23:14:04 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= + +#ifndef _SMESH_MAXELEMENTAREA_HXX_ +#define _SMESH_MAXELEMENTAREA_HXX_ + +#include "SMESH_Hypothesis.hxx" +#include "Utils_SALOME_Exception.hxx" + +class SMESH_MaxElementArea: + public SMESH_Hypothesis +{ +public: + SMESH_MaxElementArea(int hypId, int studyId, SMESH_Gen* gen); + virtual ~SMESH_MaxElementArea(); + + void SetMaxArea(double maxArea) + throw (SALOME_Exception); + + double GetMaxArea(); + + virtual ostream & SaveTo(ostream & save); + virtual istream & LoadFrom(istream & load); + friend ostream & operator << (ostream & save, SMESH_MaxElementArea & hyp); + friend istream & operator >> (istream & load, SMESH_MaxElementArea & hyp); + +protected: + double _maxArea; +}; + +#endif diff --git a/src/SMESH/SMESH_MaxElementVolume.cxx b/src/SMESH/SMESH_MaxElementVolume.cxx new file mode 100644 index 000000000..c46bed8c5 --- /dev/null +++ b/src/SMESH/SMESH_MaxElementVolume.cxx @@ -0,0 +1,9 @@ +using namespace std; +//============================================================================= +// File : SMESH_MaxElementVolume.cxx +// Created : sam mai 18 23:14:45 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= diff --git a/src/SMESH/SMESH_MaxElementVolume.hxx b/src/SMESH/SMESH_MaxElementVolume.hxx new file mode 100644 index 000000000..2cf3716be --- /dev/null +++ b/src/SMESH/SMESH_MaxElementVolume.hxx @@ -0,0 +1,8 @@ +//============================================================================= +// File : SMESH_MaxElementVolume.hxx +// Created : sam mai 18 23:14:41 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= diff --git a/src/SMESH/SMESH_Mesh.cxx b/src/SMESH/SMESH_Mesh.cxx new file mode 100644 index 000000000..1f00fe8c4 --- /dev/null +++ b/src/SMESH/SMESH_Mesh.cxx @@ -0,0 +1,572 @@ +using namespace std; +//============================================================================= +// File : SMESH_Mesh.cxx +// Created : sam mai 18 08:08:43 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= +using namespace std; + +#include "SMESH_Mesh.hxx" +#include "SMESH_subMesh.hxx" +#include "SMESH_Gen.hxx" +#include "SMESH_Hypothesis.hxx" +#include "SMESHDS_Script.hxx" +//#include "SMESHDS_ListOfAsciiString.hxx" +//#include "SMESHDS_ListIteratorOfListOfAsciiString.hxx" +#include "SMESHDS_ListOfPtrHypothesis.hxx" +#include "SMESHDS_ListIteratorOfListOfPtrHypothesis.hxx" +#include "SMDS_MeshElement.hxx" +#include "SMDS_MeshFacesIterator.hxx" +#include "SMDS_MeshVolumesIterator.hxx" +#include "TCollection_AsciiString.hxx" + +#include "utilities.h" + +#include "Mesh_Writer.h" +#include "DriverMED_W_SMESHDS_Mesh.h" +#include "DriverDAT_W_SMESHDS_Mesh.h" +#include "DriverUNV_W_SMESHDS_Mesh.h" + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_Mesh::SMESH_Mesh() +{ + MESSAGE("SMESH_Mesh::SMESH_Mesh"); + _id = -1; + ASSERT(0); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_Mesh::SMESH_Mesh(int localId, + int studyId, + SMESH_Gen* gen, + const Handle(SMESHDS_Document)& myDocument) +{ + MESSAGE("SMESH_Mesh::SMESH_Mesh(int localId)"); + _id = localId; + _studyId = studyId; + _gen = gen; + _myDocument = myDocument; + _idDoc = _myDocument->NewMesh(); + _myMeshDS = _myDocument->GetMesh(_idDoc); + _isShapeToMesh = false; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_Mesh::~SMESH_Mesh() +{ + MESSAGE("SMESH_Mesh::~SMESH_Mesh"); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +void SMESH_Mesh::ShapeToMesh(const TopoDS_Shape& aShape) + throw (SALOME_Exception) +{ + MESSAGE("SMESH_Mesh::ShapeToMesh"); + if (_isShapeToMesh) + throw SALOME_Exception(LOCALIZED("a shape to mesh as already been defined")); + _isShapeToMesh = true; + _myMeshDS->ShapeToMesh(aShape); + + // NRI : 24/02/03 + TopExp::MapShapes(aShape,_subShapes); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +bool SMESH_Mesh::AddHypothesis(const TopoDS_Shape& aSubShape, + int anHypId) + throw (SALOME_Exception) +{ + MESSAGE("SMESH_Mesh::AddHypothesis"); + + StudyContextStruct* sc = _gen->GetStudyContext(_studyId); + if (sc->mapHypothesis.find(anHypId) == sc->mapHypothesis.end()) + { + MESSAGE("Hypothesis ID does not give an hypothesis"); + SCRUTE(_studyId); + SCRUTE(anHypId); + throw SALOME_Exception(LOCALIZED("hypothesis does not exist")); + } + + SMESH_subMesh* subMesh = GetSubMesh(aSubShape); + SMESH_Hypothesis* anHyp = sc->mapHypothesis[anHypId]; + int event; + + // shape + + if (anHyp->GetType() == SMESHDS_Hypothesis::PARAM_ALGO) + event = SMESH_subMesh::ADD_HYP; + else + event = SMESH_subMesh::ADD_ALGO; + int ret = subMesh->AlgoStateEngine(event, anHyp); + + // subShapes (only when shape is mainShape) + TopoDS_Shape mainShape = _myMeshDS->ShapeToMesh(); + if (aSubShape.IsSame(mainShape)) + { + if (anHyp->GetType() == SMESHDS_Hypothesis::PARAM_ALGO) + event = SMESH_subMesh::ADD_FATHER_HYP; + else + event = SMESH_subMesh::ADD_FATHER_ALGO; + subMesh->SubMeshesAlgoStateEngine(event, anHyp); + } + + subMesh->DumpAlgoState(true); + //SCRUTE(ret); + return ret; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +bool SMESH_Mesh::RemoveHypothesis(const TopoDS_Shape& aSubShape, + int anHypId) + throw (SALOME_Exception) +{ + MESSAGE("SMESH_Mesh::RemoveHypothesis"); + + StudyContextStruct* sc = _gen->GetStudyContext(_studyId); + if (sc->mapHypothesis.find(anHypId) == sc->mapHypothesis.end()) + throw SALOME_Exception(LOCALIZED("hypothesis does not exist")); + + SMESH_subMesh* subMesh = GetSubMesh(aSubShape); + SMESH_Hypothesis* anHyp = sc->mapHypothesis[anHypId]; + int hypType = anHyp->GetType(); + SCRUTE(hypType); + int event; + + // shape + + if (anHyp->GetType() == SMESHDS_Hypothesis::PARAM_ALGO) + event = SMESH_subMesh::REMOVE_HYP; + else + event = SMESH_subMesh::REMOVE_ALGO; + int ret = subMesh->AlgoStateEngine(event, anHyp); + + // subShapes (only when shape is mainShape) + + TopoDS_Shape mainShape = _myMeshDS->ShapeToMesh(); + if (aSubShape.IsSame(mainShape)) + { + if (anHyp->GetType() == SMESHDS_Hypothesis::PARAM_ALGO) + event = SMESH_subMesh::REMOVE_FATHER_HYP; + else + event = SMESH_subMesh::REMOVE_FATHER_ALGO; + subMesh->SubMeshesAlgoStateEngine(event, anHyp); + } + + subMesh->DumpAlgoState(true); + SCRUTE(ret); + return ret; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +const Handle(SMESHDS_Mesh)& SMESH_Mesh::GetMeshDS() +{ + return _myMeshDS; +} + + +//============================================================================= +/*! + * + */ +//============================================================================= + +const list& +SMESH_Mesh::GetHypothesisList(const TopoDS_Shape& aSubShape) + throw (SALOME_Exception) +{ + MESSAGE("SMESH_Mesh::GetHypothesisList"); + _subShapeHypothesisList.clear(); + const SMESHDS_ListOfPtrHypothesis& listHyp + = _myMeshDS->GetHypothesis(aSubShape); + SMESHDS_ListIteratorOfListOfPtrHypothesis it(listHyp); + while (it.More()) + { + SMESHDS_Hypothesis* anHyp = it.Value(); + _subShapeHypothesisList.push_back(anHyp); + it.Next(); + } + return _subShapeHypothesisList; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +const SMESHDS_ListOfCommand& SMESH_Mesh::GetLog() + throw (SALOME_Exception) +{ + MESSAGE("SMESH_Mesh::GetLog"); + Handle (SMESHDS_Script) scriptDS = _myMeshDS->GetScript(); + const SMESHDS_ListOfCommand& logDS = scriptDS->GetCommands(); +// SMESHDS_ListIteratorOfListOfCommand its; +// const SMESHDS_ListOfAsciiString& logDS = scriptDS->GetCommands(); +// SMESHDS_ListIteratorOfListOfAsciiString its; +// for (its.Initialize(logDS); its.More(); its.Next()) +// { +// SCRUTE(its.Value().ToCString()); +// } + return logDS; +} + +//============================================================================= +/*! + * + */ +//============================================================================= +void SMESH_Mesh::ClearLog() + throw (SALOME_Exception) +{ + MESSAGE("SMESH_Mesh::ClearLog"); + Handle (SMESHDS_Script) scriptDS = _myMeshDS->GetScript(); + scriptDS->Clear(); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +int SMESH_Mesh::GetId() +{ + MESSAGE("SMESH_Mesh::GetId"); + return _id; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_Gen* SMESH_Mesh::GetGen() +{ + return _gen; +} + +//============================================================================= +/*! + * Get or Create the SMESH_subMesh object implementation + */ +//============================================================================= + +SMESH_subMesh* SMESH_Mesh::GetSubMesh(const TopoDS_Shape & aSubShape) + throw (SALOME_Exception) +{ + //MESSAGE("SMESH_Mesh::GetSubMesh"); + SMESH_subMesh* aSubMesh; + int index = _subShapes.FindIndex(aSubShape); + if ( _mapSubMesh.find(index) != _mapSubMesh.end() ) { + aSubMesh = _mapSubMesh[index]; + } else { + aSubMesh = new SMESH_subMesh(index, this, _myMeshDS, aSubShape); + _mapSubMesh[index] = aSubMesh; + } + + /* NRI 24/02/2003 + int index = -1; + if (_subShapes.Contains(aSubShape)) + { + index = _subShapes.FindIndex(aSubShape); + ASSERT(_mapSubMesh.find(index) != _mapSubMesh.end()); + aSubMesh = _mapSubMesh[index]; + //MESSAGE("found submesh " << index); + } + else + { + index = _subShapes.Add(aSubShape); + aSubMesh = new SMESH_subMesh(index, this, _myMeshDS, aSubShape); + _mapSubMesh[index] = aSubMesh; + //MESSAGE("created submesh " << index); + } + */ + return aSubMesh; +} + +//============================================================================= +/*! + * Get the SMESH_subMesh object implementation. Dont create it, return null + * if it does not exist. + */ +//============================================================================= +// +// * Given a subShape, find if there is a subMesh associated to this subShape +// * or to a collection of shapes containing this subShape. Collection = +// * compsolid, shell, wire. +// * +// * WARNING : with arg = compsolid, shell or wire returns always NULL. +// * with a face inside a shell, and submesh created for both, if arg is face, +// * returns first created submesh of the two. +// * subMesh is not created, return may be NULL. + +SMESH_subMesh* SMESH_Mesh::GetSubMeshContaining(const TopoDS_Shape & aSubShape) + throw (SALOME_Exception) +{ + //MESSAGE("SMESH_Mesh::GetSubMeshContaining"); + bool isFound = false; + SMESH_subMesh* aSubMesh = NULL; + + int index = _subShapes.FindIndex(aSubShape); + if ( _mapSubMesh.find(index) != _mapSubMesh.end() ) { + aSubMesh = _mapSubMesh[index]; + isFound = true; + } + + /* NRI 24/02/2003 + int index = -1; + if (_subShapes.Contains(aSubShape)) + { + index = _subShapes.FindIndex(aSubShape); + ASSERT(_mapSubMesh.find(index) != _mapSubMesh.end()); + aSubMesh = _mapSubMesh[index]; + isFound = true; + //MESSAGE("found submesh " << index); + } + */ + +// map::iterator itsm; +// for (itsm = _mapSubMesh.begin(); itsm != _mapSubMesh.end(); itsm++) +// { +// aSubMesh = (*itsm).second; +// isFound = aSubMesh->Contains(aSubShape); +// if (isFound) break; +// } + + if (! isFound) aSubMesh = NULL; + return aSubMesh; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +const list & +SMESH_Mesh::GetSubMeshUsingHypothesis(SMESHDS_Hypothesis* anHyp) + throw (SALOME_Exception) +{ + MESSAGE("SMESH_Mesh::GetSubMeshUsingHypothesis"); + map::iterator itsm; + _subMeshesUsingHypothesisList.clear(); + for (itsm = _mapSubMesh.begin(); itsm != _mapSubMesh.end(); itsm++) + { + SMESH_subMesh* aSubMesh = (*itsm).second; + bool usesHyp = false; + SMESH_Algo* algo = _gen->GetAlgo(*this, aSubMesh->GetSubShape()); + if (algo != NULL) + { + const list& usedHyps + = algo->GetUsedHypothesis(*this, aSubMesh->GetSubShape()); + list::const_iterator itl; + for(itl=usedHyps.begin(); itl != usedHyps.end(); itl++) + if (anHyp == (*itl)) + { + usesHyp = true; + break; + } + } + if (usesHyp) _subMeshesUsingHypothesisList.push_back(aSubMesh); + } + return _subMeshesUsingHypothesisList; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +void SMESH_Mesh::ExportMED( const char* file ) + throw (SALOME_Exception) +{ + Mesh_Writer* myWriter = new DriverMED_W_SMESHDS_Mesh; + myWriter->SetFile( string(file) ); + myWriter->SetMesh( _myMeshDS ); + MESSAGE ( " _idDoc " << _idDoc ) + myWriter->SetMeshId( _idDoc ); + myWriter->Add(); +} + +void SMESH_Mesh::ExportDAT( const char* file ) + throw (SALOME_Exception) +{ + Mesh_Writer* myWriter = new DriverDAT_W_SMESHDS_Mesh; + myWriter->SetFile( string(file) ); + myWriter->SetMesh( _myMeshDS ); + myWriter->SetMeshId( _idDoc ); + myWriter->Add(); +} + +void SMESH_Mesh::ExportUNV( const char* file ) + throw (SALOME_Exception) +{ + Mesh_Writer* myWriter = new DriverUNV_W_SMESHDS_Mesh; + myWriter->SetFile( string(file) ); + myWriter->SetMesh( _myMeshDS ); + myWriter->SetMeshId( _idDoc ); + myWriter->Add(); +} + +//============================================================================= +/*! + * + */ +//============================================================================= +int SMESH_Mesh::NbNodes() + throw (SALOME_Exception) +{ + return _myMeshDS->NbNodes(); +} + +//============================================================================= +/*! + * + */ +//============================================================================= +int SMESH_Mesh::NbEdges() + throw (SALOME_Exception) +{ + return _myMeshDS->NbEdges(); +} + +//============================================================================= +/*! + * + */ +//============================================================================= +int SMESH_Mesh::NbFaces() + throw (SALOME_Exception) +{ + return _myMeshDS->NbFaces(); +} +int SMESH_Mesh::NbTriangles() + throw (SALOME_Exception) +{ + SMDS_MeshFacesIterator itFaces(_myMeshDS); + int Nb = 0; + for (;itFaces.More();itFaces.Next()) { + const Handle(SMDS_MeshElement)& elem = itFaces.Value(); + + switch (elem->NbNodes()) { + case 3 : { + Nb++; + break; + } + } + } + return Nb; +} +int SMESH_Mesh::NbQuadrangles() + throw (SALOME_Exception) +{ + SMDS_MeshFacesIterator itFaces(_myMeshDS); + int Nb = 0; + for (;itFaces.More();itFaces.Next()) { + const Handle(SMDS_MeshElement)& elem = itFaces.Value(); + + switch (elem->NbNodes()) { + case 4 : { + Nb++; + break; + } + } + } + return Nb; +} + +//============================================================================= +/*! + * + */ +//============================================================================= +int SMESH_Mesh::NbVolumes() + throw (SALOME_Exception) +{ + return _myMeshDS->NbVolumes(); +} +int SMESH_Mesh::NbTetras() + throw (SALOME_Exception) +{ + int Nb = 0; + SMDS_MeshVolumesIterator itVolumes(_myMeshDS); + for (;itVolumes.More();itVolumes.Next()) { + const Handle(SMDS_MeshElement)& elem = itVolumes.Value(); + + switch (elem->NbNodes()) { + case 4 : { + Nb++; + break; + } + } + } + return Nb; +} +int SMESH_Mesh::NbHexas() + throw (SALOME_Exception) +{ + int Nb = 0; + SMDS_MeshVolumesIterator itVolumes(_myMeshDS); + for (;itVolumes.More();itVolumes.Next()) { + const Handle(SMDS_MeshElement)& elem = itVolumes.Value(); + + switch (elem->NbNodes()) { + case 8 : { + Nb++; + break; + } + } + } + return Nb; +} + +//============================================================================= +/*! + * + */ +//============================================================================= +int SMESH_Mesh::NbSubMesh() + throw (SALOME_Exception) +{ + return _myMeshDS->NbSubMesh(); +} diff --git a/src/SMESH/SMESH_Mesh.hxx b/src/SMESH/SMESH_Mesh.hxx new file mode 100644 index 000000000..d677b4837 --- /dev/null +++ b/src/SMESH/SMESH_Mesh.hxx @@ -0,0 +1,146 @@ +//============================================================================= +// File : SMESH_Mesh.hxx +// Created : sam mai 18 08:07:35 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= + +#ifndef _SMESH_MESH_HXX_ +#define _SMESH_MESH_HXX_ + +#include "SMESHDS_Document.hxx" +#include "SMESHDS_Mesh.hxx" +#include "SMESH_Hypothesis.hxx" +#include "SMESH_subMesh.hxx" +#include "SMESHDS_ListOfCommand.hxx" +//#include "SMESHDS_ListOfAsciiString.hxx" +//#include "SMESHDS_ListIteratorOfListOfAsciiString.hxx" + + +#include "Utils_SALOME_Exception.hxx" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +class SMESH_Gen; + +class SMESH_Mesh +{ +public: + SMESH_Mesh(); + SMESH_Mesh(int localId, + int studyId, + SMESH_Gen* gen, + const Handle(SMESHDS_Document)& myDocument); + + virtual ~SMESH_Mesh(); + + void ShapeToMesh(const TopoDS_Shape& aShape) + throw (SALOME_Exception); + + bool AddHypothesis(const TopoDS_Shape& aSubShape, + int anHypId) + throw (SALOME_Exception); + + bool RemoveHypothesis(const TopoDS_Shape& aSubShape, + int anHypId) + throw (SALOME_Exception); + + const list& + GetHypothesisList(const TopoDS_Shape& aSubShape) + throw (SALOME_Exception); + + const SMESHDS_ListOfCommand& GetLog() + throw (SALOME_Exception); + +// const SMESHDS_ListOfAsciiString& GetLog() +// throw (SALOME_Exception); + + void ClearLog() + throw (SALOME_Exception); + + int GetId(); + + const Handle(SMESHDS_Mesh)& GetMeshDS(); + + SMESH_Gen* GetGen(); + + SMESH_subMesh* GetSubMesh(const TopoDS_Shape & aSubShape) + throw (SALOME_Exception); + + SMESH_subMesh* GetSubMeshContaining(const TopoDS_Shape & aSubShape) + throw (SALOME_Exception); + + const list & + GetSubMeshUsingHypothesis(SMESHDS_Hypothesis* anHyp) + throw (SALOME_Exception); + + void ExportDAT( const char* file ) + throw (SALOME_Exception); + void ExportMED( const char* file ) + throw (SALOME_Exception); + void ExportUNV( const char* file ) + throw (SALOME_Exception); + + int NbNodes() + throw (SALOME_Exception); + + int NbEdges() + throw (SALOME_Exception); + + int NbFaces() + throw (SALOME_Exception); + + int NbTriangles() + throw (SALOME_Exception); + + int NbQuadrangles() + throw (SALOME_Exception); + + int NbVolumes() + throw (SALOME_Exception); + + int NbTetras() + throw (SALOME_Exception); + + int NbHexas() + throw (SALOME_Exception); + + int NbSubMesh() + throw (SALOME_Exception); + + +private: + + int _id; // id given by creator (unique within the creator instance) + int _studyId; + int _idDoc; // id given by SMESHDS_Document + bool _isShapeToMesh; // set to true when a shape is given (only once) + list _subShapeHypothesisList; + list _subMeshesUsingHypothesisList; + Handle (SMESHDS_Document) _myDocument; + Handle (SMESHDS_Mesh) _myMeshDS; + TopTools_IndexedMapOfShape _subShapes; + map _mapSubMesh; + SMESH_Gen* _gen; +}; + +#endif diff --git a/src/SMESH/SMESH_NumberOfSegments.cxx b/src/SMESH/SMESH_NumberOfSegments.cxx new file mode 100644 index 000000000..2a2ae6b3e --- /dev/null +++ b/src/SMESH/SMESH_NumberOfSegments.cxx @@ -0,0 +1,115 @@ +using namespace std; +//============================================================================= +// File : SMESH_NumberOfSegments.cxx +// Created : sam mai 18 08:11:15 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= +using namespace std; + +#include "SMESH_NumberOfSegments.hxx" + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_NumberOfSegments::SMESH_NumberOfSegments(int hypId, int studyId, SMESH_Gen* gen) + : SMESH_Hypothesis(hypId, studyId, gen) +{ + _numberOfSegments = 1; + _name = "NumberOfSegments"; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_NumberOfSegments::~SMESH_NumberOfSegments() +{ +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +void SMESH_NumberOfSegments::SetNumberOfSegments(int segmentsNumber) + throw (SALOME_Exception) +{ + int oldNumberOfSegments = _numberOfSegments; + if (segmentsNumber <= 0) + throw SALOME_Exception(LOCALIZED("number of segments must be positive")); + _numberOfSegments = segmentsNumber; + + if (oldNumberOfSegments != _numberOfSegments) + NotifySubMeshesHypothesisModification(); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +int SMESH_NumberOfSegments::GetNumberOfSegments() +{ + return _numberOfSegments; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +ostream & SMESH_NumberOfSegments::SaveTo(ostream & save) +{ + return save << this; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +istream & SMESH_NumberOfSegments::LoadFrom(istream & load) +{ + return load >> (*this); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +ostream& operator << (ostream & save, SMESH_NumberOfSegments & hyp) +{ + save << hyp._numberOfSegments; + return save; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +istream& operator >> (istream & load, SMESH_NumberOfSegments & hyp) +{ + bool isOK = true; + int a; + isOK = (load >> a); + if (isOK) hyp._numberOfSegments = a; + else load.clear(ios::badbit | load.rdstate()); + return load; +} + diff --git a/src/SMESH/SMESH_NumberOfSegments.hxx b/src/SMESH/SMESH_NumberOfSegments.hxx new file mode 100644 index 000000000..c053211ef --- /dev/null +++ b/src/SMESH/SMESH_NumberOfSegments.hxx @@ -0,0 +1,37 @@ +//============================================================================= +// File : SMESH_NumberOfSegments.hxx +// Created : sam mai 18 08:11:20 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= + +#ifndef _SMESH_NUMBEROFSEGMENTS_HXX_ +#define _SMESH_NUMBEROFSEGMENTS_HXX_ + +#include "SMESH_Hypothesis.hxx" +#include "Utils_SALOME_Exception.hxx" + +class SMESH_NumberOfSegments: + public SMESH_Hypothesis +{ +public: + SMESH_NumberOfSegments(int hypId, int studyId, SMESH_Gen* gen); + virtual ~SMESH_NumberOfSegments(); + + void SetNumberOfSegments(int segmentsNumber) + throw (SALOME_Exception); + + int GetNumberOfSegments(); + + virtual ostream & SaveTo(ostream & save); + virtual istream & LoadFrom(istream & load); + friend ostream& operator << (ostream & save, SMESH_NumberOfSegments & hyp); + friend istream& operator >> (istream & load, SMESH_NumberOfSegments & hyp); + +protected: + int _numberOfSegments; +}; + +#endif diff --git a/src/SMESH/SMESH_Quadrangle_2D.cxx b/src/SMESH/SMESH_Quadrangle_2D.cxx new file mode 100644 index 000000000..11d86c82f --- /dev/null +++ b/src/SMESH/SMESH_Quadrangle_2D.cxx @@ -0,0 +1,650 @@ +using namespace std; +//============================================================================= +// File : SMESH_Quadrangle_2D.cxx +// Created : sam mai 18 08:11:32 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= +using namespace std; + +#include "SMESH_Quadrangle_2D.hxx" +#include "SMESH_Gen.hxx" +#include "SMESH_Mesh.hxx" + +#include "SMDS_MeshElement.hxx" +#include "SMDS_MeshNode.hxx" +#include "SMDS_EdgePosition.hxx" +#include "SMDS_FacePosition.hxx" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "utilities.h" + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_Quadrangle_2D::SMESH_Quadrangle_2D(int hypId, + int studyId, + SMESH_Gen* gen) + : SMESH_2D_Algo(hypId, studyId, gen) +{ + MESSAGE("SMESH_Quadrangle_2D::SMESH_Quadrangle_2D"); + _name = "Quadrangle_2D"; + // _shapeType = TopAbs_FACE; + _shapeType = (1<nbPts[0]; + int nbright = quad->nbPts[1]; + int nbVertices = nbdown*nbright; + int nbQuad = (nbdown-1)*(nbright-1); + //SCRUTE(nbVertices); + //SCRUTE(nbQuad); + + // const TopoDS_Face& FF = TopoDS::Face(aShape); + // bool faceIsForward = (FF.Orientation() == TopAbs_FORWARD); + // TopoDS_Face F = TopoDS::Face(FF.Oriented(TopAbs_FORWARD)); + const TopoDS_Face& F = TopoDS::Face(aShape); + bool faceIsForward = (F.Orientation() == TopAbs_FORWARD); + Handle(Geom_Surface) S = BRep_Tool::Surface(F); + + for (int i=1; iuv_grid[ij].u; + double v = quad->uv_grid[ij].v; + gp_Pnt P = S->Value(u,v); + int nodeId = meshDS->AddNode(P.X(), P.Y(), P.Z()); + //MESSAGE("point "<< nodeId<<" "<<" "<FindNode(nodeId); + Handle (SMDS_MeshNode) node = meshDS->GetNode(1, elt); + meshDS->SetNodeOnFace(node, F); + quad->uv_grid[ij].nodeId = nodeId; +// Handle (SMDS_FacePosition) fpos +// = new SMDS_FacePosition(theSubMesh->GetId(),i,j); // easier than u,v +// node->SetPosition(fpos); + Handle (SMDS_FacePosition) fpos + = Handle (SMDS_FacePosition)::DownCast(node->GetPosition()); + fpos->SetUParameter(i); + fpos->SetVParameter(j); + } + + // bool isQuadForward = ( faceIsForward == quad->isEdgeForward[0]); + for (int i=0; iuv_grid[ j *nbdown +i ].nodeId; + int b = quad->uv_grid[ j *nbdown +i+1].nodeId; + int c = quad->uv_grid[(j+1)*nbdown +i+1].nodeId; + int d = quad->uv_grid[(j+1)*nbdown +i ].nodeId; + int faceId; + // if (isQuadForward) faceId = meshDS->AddFace(a,b,c,d); + // else faceId = meshDS->AddFace(a,d,c,b); + faceId = meshDS->AddFace(a,b,c,d); + Handle (SMDS_MeshElement) elt = meshDS->FindElement(faceId); + meshDS->SetMeshElementOnShape(elt, F); + } + + QuadDelete(quad); + bool isOk = true; + return isOk; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +FaceQuadStruct* +SMESH_Quadrangle_2D::CheckAnd2Dcompute(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape) + throw (SALOME_Exception) +{ + //MESSAGE("SMESH_Quadrangle_2D::ComputeWithoutStore"); + + SMESH_subMesh* theSubMesh = aMesh.GetSubMesh(aShape); + + // const TopoDS_Face& FF = TopoDS::Face(aShape); + // bool faceIsForward = (FF.Orientation() == TopAbs_FORWARD); + // TopoDS_Face F = TopoDS::Face(FF.Oriented(TopAbs_FORWARD)); + const TopoDS_Face& F = TopoDS::Face(aShape); + bool faceIsForward = (F.Orientation() == TopAbs_FORWARD); + + // verify 1 wire only, with 4 edges, same number of points on opposite edges + + if (NumberOfWires (F) != 1) + { + MESSAGE("only 1 wire by face (quadrangles)"); + return 0; + //throw SALOME_Exception(LOCALIZED("only 1 wire by face (quadrangles)")); + } + // const TopoDS_Wire WW = BRepTools::OuterWire(F); + // TopoDS_Wire W = TopoDS::Wire(WW.Oriented(TopAbs_FORWARD)); + const TopoDS_Wire& W = BRepTools::OuterWire(F); + BRepTools_WireExplorer wexp(W,F); + + FaceQuadStruct* quad = new FaceQuadStruct; + for (int i=0; i<4; i++) quad->uv_edges[i] = 0; + quad->uv_grid = 0; + + int nbEdges = 0; + for (wexp.Init(W,F);wexp.More(); wexp.Next()) + { + // const TopoDS_Edge& EE = wexp.Current(); + // TopoDS_Edge E = TopoDS::Edge(EE.Oriented(TopAbs_FORWARD)); + const TopoDS_Edge& E = wexp.Current(); + int nb = aMesh.GetSubMesh(E)->GetSubMeshDS()->NbNodes(); + if (nbEdges < 4) + { + quad->edge[nbEdges] = E; + quad->nbPts[nbEdges] = nb +2; // internal points + 2 extrema + } + nbEdges++; + } + + if (nbEdges != 4) + { + MESSAGE("face must have 4 edges /quadrangles"); + QuadDelete(quad); + return 0; + //throw SALOME_Exception(LOCALIZED("face must have 4 edges /quadrangles")); + } + + if (quad->nbPts[0] != quad->nbPts[2]) + { + MESSAGE("different point number-opposed edge"); + QuadDelete(quad); + return 0; + //throw SALOME_Exception(LOCALIZED("different point number-opposed edge")); + } + + if (quad->nbPts[1] != quad->nbPts[3]) + { + MESSAGE("different point number-opposed edge"); + QuadDelete(quad); + return 0; + //throw SALOME_Exception(LOCALIZED("different point number-opposed edge")); + } + + // set normalized grid on unit square in parametric domain + + SetNormalizedGrid(aMesh, F, quad); + + return quad; +} + + +//============================================================================= +/*! + * + */ +//============================================================================= + + void SMESH_Quadrangle_2D::QuadDelete(FaceQuadStruct* quad) +{ + //MESSAGE("SMESH_Quadrangle_2D::QuadDelete"); + if (quad) + { + for (int i=0; i<4; i++) + { + if (quad->uv_edges[i]) delete [] quad->uv_edges[i]; + quad->edge[i].Nullify(); + } + if (quad->uv_grid) delete [] quad->uv_grid; + delete quad; + } +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +void SMESH_Quadrangle_2D::SetNormalizedGrid(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape, + FaceQuadStruct* quad) + throw (SALOME_Exception) +{ + // Algorithme décrit dans "Génération automatique de maillages" + // P.L. GEORGE, MASSON, § 6.4.1 p. 84-85 + // traitement dans le domaine paramétrique 2d u,v + // transport - projection sur le carré unité + + const TopoDS_Face& F = TopoDS::Face(aShape); + + // 1 --- find orientation of the 4 edges, by test on extrema + + // max min 0 x1 1 + // |<----north-2-------^ a3 -------------> a2 + // | | ^1 1^ + // west-3 east-1 =right | | + // | | ==> | | + // y0 | | y1 | | + // | | |0 0| + // v----south-0--------> a0 -------------> a1 + // min max 0 x0 1 + // =down + // + + Handle (Geom2d_Curve) c2d[4]; + gp_Pnt2d pf[4]; + gp_Pnt2d pl[4]; + for (int i=0; i<4; i++) + { + c2d[i] = BRep_Tool::CurveOnSurface(quad->edge[i], + F, + quad->first[i], + quad->last[i]); + pf[i] = c2d[i]->Value(quad->first[i]); + pl[i] = c2d[i]->Value(quad->last[i]); + quad->isEdgeForward[i] = false; + } + + double eps2d = 1.e-3; // *** utiliser plutot TopExp::CommonVertex, puis + // distances si piece fausse + int i=0; + if ((pf[1].Distance(pl[0]) < eps2d) || (pl[1].Distance(pl[0]) < eps2d)) + { + quad->isEdgeForward[0] = true; + } + else + { + double tmp =quad->first[0]; + quad->first[0] = quad->last[0]; + quad->last[0] = tmp; + pf[0] = c2d[0]->Value(quad->first[0]); + pl[0] = c2d[0]->Value(quad->last[0]); + } + for (int i=1; i<4; i++) + { + quad->isEdgeForward[i] = (pf[i].Distance(pl[i-1]) < eps2d); + if (! quad->isEdgeForward[i]) + { + double tmp =quad->first[i]; + quad->first[i] = quad->last[i]; + quad->last[i] = tmp; + pf[i] = c2d[i]->Value(quad->first[i]); + pl[i] = c2d[i]->Value(quad->last[i]); + //SCRUTE(pf[i].Distance(pl[i-1])); + ASSERT(pf[i].Distance(pl[i-1]) < eps2d); + } + } + //SCRUTE(pf[0].Distance(pl[3])); + ASSERT(pf[0].Distance(pl[3]) < eps2d); + +// for (int i=0; i<4; i++) +// { +// SCRUTE(quad->isEdgeForward[i]); +// MESSAGE(" -first "<uv_edges[i] = LoadEdgePoints(aMesh, F, + quad->edge[i], + quad->first[i], + quad->last[i]); + + // quad->isEdgeForward[i]); + } + for (int i=2; i<4; i++) + { + quad->uv_edges[i] = LoadEdgePoints(aMesh, F, + quad->edge[i], + quad->last[i], + quad->first[i]); + + // !quad->isEdgeForward[i]); + } + + // 3 --- 2D normalized values on unit square [0..1][0..1] + + int nbdown = quad->nbPts[0]; + int nbright = quad->nbPts[1]; + quad->uv_grid = new UVPtStruct[nbright*nbdown]; + + UVPtStruct* uv_grid = quad->uv_grid; + UVPtStruct* uv_e0 = quad->uv_edges[0]; + UVPtStruct* uv_e1 = quad->uv_edges[1]; + UVPtStruct* uv_e2 = quad->uv_edges[2]; + UVPtStruct* uv_e3 = quad->uv_edges[3]; + gp_Pnt2d a0 = pf[0]; + gp_Pnt2d a1 = pf[1]; + gp_Pnt2d a2 = pf[2]; + gp_Pnt2d a3 = pf[3]; + + // nodes Id on edges + + int j = 0; + for (int i=0; iValue(param_0); + gp_Pnt2d p1 = c2d[1]->Value(param_1); + gp_Pnt2d p2 = c2d[2]->Value(param_2); + gp_Pnt2d p3 = c2d[3]->Value(param_3); + + double u = (1-y)*p0.X() + x*p1.X() + y*p2.X() + (1-x)*p3.X(); + double v = (1-y)*p0.Y() + x*p1.Y() + y*p2.Y() + (1-x)*p3.Y(); + + u -= (1-x)*(1-y)*a0.X() + x*(1-y)*a1.X() + x*y*a2.X() + (1-x)*y*a3.X(); + v -= (1-x)*(1-y)*a0.Y() + x*(1-y)*a1.Y() + x*y*a2.Y() + (1-x)*y*a3.Y(); + + uv_grid[ij].u = u; + uv_grid[ij].v = v; + + //MESSAGE("-uv- "<GetSubMeshDS()->GetIDNodes(); + int idFirst= lidf.First(); + //SCRUTE(idFirst); + + ASSERT(!VLast.IsNull()); + SMESH_subMesh* lastSubMesh = aMesh.GetSubMesh(VLast); + const TColStd_ListOfInteger& lidl + = lastSubMesh->GetSubMeshDS()->GetIDNodes(); + int idLast= lidl.First(); + //SCRUTE(idLast); + + // --- edge internal IDNodes (relies on good order storage, not checked) + + int nbPoints = aMesh.GetSubMesh(E)->GetSubMeshDS()->NbNodes(); + //SCRUTE(nbPoints); + UVPtStruct * uvslf = new UVPtStruct[nbPoints+2]; + + double f,l; + Handle(Geom2d_Curve) C2d = BRep_Tool::CurveOnSurface(E,F,f,l); + + const TColStd_ListOfInteger& indElt + = aMesh.GetSubMesh(E)->GetSubMeshDS()->GetIDNodes(); + TColStd_ListIteratorOfListOfInteger ite(indElt); + //SCRUTE(nbPoints); + //SCRUTE(indElt.Extent()); + ASSERT(nbPoints == indElt.Extent()); + + map params; + for (; ite.More(); ite.Next()) + { + int nodeId = ite.Value(); + Handle (SMDS_MeshElement) elt = meshDS->FindNode(nodeId); + Handle (SMDS_MeshNode) node = meshDS->GetNode(1, elt); + Handle (SMDS_EdgePosition) epos + = Handle (SMDS_EdgePosition)::DownCast(node->GetPosition()); + double param = epos->GetUParameter(); + params[param] = nodeId; + } + + bool isForward = (((l-f)*(last-first)) > 0); + double paramin = 0; + double paramax = 0; + if (isForward) + { + paramin = f; + paramax = l; + gp_Pnt2d p = C2d->Value(f); // first point = Vertex Forward + uvslf [0].x = p.X(); + uvslf [0].y = p.Y(); + uvslf [0].param = f; + uvslf [0].nodeId = idFirst; + //MESSAGE("__ f "<::iterator itp = params.begin(); + for (int i = 1; i <= nbPoints; i++) // nbPoints internal + { + double param = (*itp).first; + int nodeId = (*itp).second; + gp_Pnt2d p = C2d->Value(param); + uvslf [i].x = p.X(); + uvslf [i].y = p.Y(); + uvslf[i].param = param; + uvslf[i].nodeId = nodeId; + //MESSAGE("__ "<Value(l); // last point = Vertex Reversed + uvslf [nbPoints+1].x = p.X(); + uvslf [nbPoints+1].y = p.Y(); + uvslf [nbPoints+1].param = l; + uvslf [nbPoints+1].nodeId = idLast; + //MESSAGE("__ l "<Value(l); // first point = Vertex Reversed + uvslf [0].x = p.X(); + uvslf [0].y = p.Y(); + uvslf [0].param = l; + uvslf [0].nodeId = idLast; + //MESSAGE("__ l "<::reverse_iterator itp = params.rbegin(); + for (int j = nbPoints; j >= 1; j--) // nbPoints internal + { + double param = (*itp).first; + int nodeId = (*itp).second; + int i = nbPoints +1 -j; + gp_Pnt2d p = C2d->Value(param); + uvslf [i].x = p.X(); + uvslf [i].y = p.Y(); + uvslf[i].param = param; + uvslf[i].nodeId = nodeId; + //MESSAGE("__ "<Value(f); // last point = Vertex Forward + uvslf [nbPoints+1].x = p.X(); + uvslf [nbPoints+1].y = p.Y(); + uvslf [nbPoints+1].param = f; + uvslf [nbPoints+1].nodeId = idFirst; + //MESSAGE("__ f "<> (*this); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +ostream & operator << (ostream & save, SMESH_Quadrangle_2D & hyp) +{ + return save; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +istream & operator >> (istream & load, SMESH_Quadrangle_2D & hyp) +{ + return load; +} diff --git a/src/SMESH/SMESH_Quadrangle_2D.hxx b/src/SMESH/SMESH_Quadrangle_2D.hxx new file mode 100644 index 000000000..9487f20c6 --- /dev/null +++ b/src/SMESH/SMESH_Quadrangle_2D.hxx @@ -0,0 +1,81 @@ +//============================================================================= +// File : SMESH_Quadrangle_2D.hxx +// Created : sam mai 18 08:11:36 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= + +#ifndef _SMESH_QUADRANGLE_2D_HXX_ +#define _SMESH_QUADRANGLE_2D_HXX_ + +#include "SMESH_2D_Algo.hxx" +#include "SMESH_Mesh.hxx" +#include "Utils_SALOME_Exception.hxx" + +typedef struct uvPtStruct +{ + double param; + double normParam; + double u; // original 2d parameter + double v; + double x; // 2d parameter, normalized [0,1] + double y; + int nodeId; +} UVPtStruct; + +typedef struct faceQuadStruct +{ + int nbPts[4]; + TopoDS_Edge edge[4]; + double first[4]; + double last[4]; + bool isEdgeForward[4]; + UVPtStruct* uv_edges[4]; + UVPtStruct* uv_grid; +} FaceQuadStruct; + +class SMESH_Quadrangle_2D: + public SMESH_2D_Algo +{ +public: + SMESH_Quadrangle_2D(int hypId, int studyId, SMESH_Gen* gen); + virtual ~SMESH_Quadrangle_2D(); + + virtual bool CheckHypothesis(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape); + + virtual bool Compute(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape) + throw (SALOME_Exception); + + FaceQuadStruct* CheckAnd2Dcompute(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape) + throw (SALOME_Exception); + + void QuadDelete(FaceQuadStruct* quad); + + ostream & SaveTo(ostream & save); + istream & LoadFrom(istream & load); + friend ostream & operator << (ostream & save, SMESH_Quadrangle_2D & hyp); + friend istream & operator >> (istream & load, SMESH_Quadrangle_2D & hyp); + +protected: + + void SetNormalizedGrid(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape, + FaceQuadStruct* quad) + throw (SALOME_Exception); + + UVPtStruct* LoadEdgePoints(SMESH_Mesh& aMesh, + const TopoDS_Face& F, + const TopoDS_Edge& E, + double first, + double last); +// bool isForward); + +// FaceQuadStruct _quadDesc; +}; + +#endif diff --git a/src/SMESH/SMESH_Regular_1D.cxx b/src/SMESH/SMESH_Regular_1D.cxx new file mode 100644 index 000000000..aec7b5367 --- /dev/null +++ b/src/SMESH/SMESH_Regular_1D.cxx @@ -0,0 +1,305 @@ +using namespace std; +//============================================================================= +// File : SMESH_Regular_1D.cxx +// Created : sam mai 18 08:11:58 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= +using namespace std; + +#include "SMESH_Regular_1D.hxx" +#include "SMESH_Gen.hxx" +#include "SMESH_Mesh.hxx" + +#include "SMESH_LocalLength.hxx" +#include "SMESH_NumberOfSegments.hxx" + +#include "SMESHDS_ListOfPtrHypothesis.hxx" +#include "SMESHDS_ListIteratorOfListOfPtrHypothesis.hxx" +#include "SMDS_MeshElement.hxx" +#include "SMDS_MeshNode.hxx" +#include "SMDS_EdgePosition.hxx" + +#include "utilities.h" + +#include +#include +#include +#include +#include +#include + +#include +#include + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_Regular_1D::SMESH_Regular_1D(int hypId, int studyId, SMESH_Gen* gen) + : SMESH_1D_Algo(hypId, studyId, gen) +{ + MESSAGE("SMESH_Regular_1D::SMESH_Regular_1D"); + _name = "Regular_1D"; + // _shapeType = TopAbs_EDGE; + _shapeType = (1<> (*this); +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +ostream& operator << (ostream & save, SMESH_Regular_1D & hyp) +{ + return save; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +istream& operator >> (istream & load, SMESH_Regular_1D & hyp) +{ + return load; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +bool SMESH_Regular_1D::CheckHypothesis(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape) +{ + //MESSAGE("SMESH_Regular_1D::CheckHypothesis"); + + list::const_iterator itl; + SMESHDS_Hypothesis* theHyp; + + const list& hyps = GetUsedHypothesis(aMesh, aShape); + int nbHyp = hyps.size(); + if (nbHyp != 1) return false; // only one compatible hypothesis allowed + + itl = hyps.begin(); + theHyp = (*itl); + + string hypName = theHyp->GetName(); + int hypId = theHyp->GetID(); + //SCRUTE(hypName); + + bool isOk = false; + + if (hypName == "LocalLength") + { + _hypLocalLength = dynamic_cast (theHyp); + ASSERT(_hypLocalLength); + _localLength = _hypLocalLength->GetLength(); + _numberOfSegments = 0; + isOk =true; + } + + if (hypName == "NumberOfSegments") + { + _hypNumberOfSegments = dynamic_cast (theHyp); + ASSERT(_hypNumberOfSegments); + _numberOfSegments = _hypNumberOfSegments->GetNumberOfSegments(); + _localLength = 0; + isOk = true; + } + + //SCRUTE(_localLength); + //SCRUTE(_numberOfSegments); + + return isOk; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +bool SMESH_Regular_1D::Compute(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape) +{ + //MESSAGE("SMESH_Regular_1D::Compute"); + + const Handle(SMESHDS_Mesh)& meshDS = aMesh.GetMeshDS(); + SMESH_subMesh* theSubMesh = aMesh.GetSubMesh(aShape); + + const TopoDS_Edge& EE = TopoDS::Edge(aShape); + TopoDS_Edge E = TopoDS::Edge(EE.Oriented(TopAbs_FORWARD)); + + double f,l; + Handle(Geom_Curve) Curve = BRep_Tool::Curve(E,f,l); + + TopoDS_Vertex VFirst, VLast; + TopExp::Vertices(E, VFirst, VLast); // Vfirst corresponds to f and Vlast to l + + double length = EdgeLength(E); + //SCRUTE(length); + + double eltSize = 1; +// if (_localLength > 0) eltSize = _localLength; + if (_localLength > 0) + { + double nbseg = ceil(length/_localLength); // integer sup + if (nbseg <=0) nbseg = 1; // degenerated edge + eltSize = length/nbseg; + } + else + { + ASSERT(_numberOfSegments> 0); + eltSize = length/_numberOfSegments; + } + + ASSERT(!VFirst.IsNull()); + SMESH_subMesh* firstSubMesh = aMesh.GetSubMesh(VFirst); + const TColStd_ListOfInteger& lidf + = firstSubMesh->GetSubMeshDS()->GetIDNodes(); + int idFirst= lidf.First(); + //SCRUTE(idFirst); + + ASSERT(!VLast.IsNull()); + SMESH_subMesh* lastSubMesh = aMesh.GetSubMesh(VLast); + const TColStd_ListOfInteger& lidl + = lastSubMesh->GetSubMeshDS()->GetIDNodes(); + int idLast= lidl.First(); + //SCRUTE(idLast); + + if (!Curve.IsNull()) + { + GeomAdaptor_Curve C3d(Curve); + GCPnts_UniformAbscissa Discret(C3d,eltSize,f,l); + int NbPoints = Discret.NbPoints(); + //MESSAGE("nb points on edge : "<Value(param); + + //Add the Node in the DataStructure + int nodeId = meshDS->AddNode(P.X(), P.Y(), P.Z()); + //MESSAGE("point "<FindNode(nodeId); + Handle (SMDS_MeshNode) node = meshDS->GetNode(1, elt); + meshDS->SetNodeOnEdge(node, E); + + // **** edgePosition associe au point = param. +// Handle (SMDS_EdgePosition) epos +// = new SMDS_EdgePosition(theSubMesh->GetId(),param); // non, deja cree +// node->SetPosition(epos); + Handle (SMDS_EdgePosition) epos + = Handle (SMDS_EdgePosition)::DownCast(node->GetPosition()); + epos->SetUParameter(param); + + int edgeId = meshDS->AddEdge(idPrev, nodeId); + elt = meshDS->FindElement(edgeId); + meshDS->SetMeshElementOnShape(elt, E); + idPrev = nodeId; + } + int edgeId = meshDS->AddEdge(idPrev, idLast); + Handle (SMDS_MeshElement) elt = meshDS->FindElement(edgeId); + meshDS->SetMeshElementOnShape(elt, E); + } + else + { +// MESSAGE ("Edge Degeneree non traitee --- arret"); +// ASSERT(0); + if (BRep_Tool::Degenerated(E)) + { + // Edge is a degenerated Edge : We put n = 5 points on the edge. + int NbPoints = 5; + BRep_Tool::Range(E,f,l); + double du = (l-f)/(NbPoints-1); + MESSAGE("************* Degenerated edge! *****************"); + + TopoDS_Vertex V1,V2; + TopExp::Vertices (E,V1,V2); + gp_Pnt P = BRep_Tool::Pnt(V1); + + int idPrev = idFirst; + for (int i=2; iAddNode(P.X(), P.Y(), P.Z()); + //MESSAGE("point "<FindNode(nodeId); + Handle (SMDS_MeshNode) node = meshDS->GetNode(1, elt); + meshDS->SetNodeOnEdge(node, E); + +// Handle (SMDS_EdgePosition) epos +// = new SMDS_EdgePosition(theSubMesh->GetId(),param); +// node->SetPosition(epos); + Handle (SMDS_EdgePosition) epos + = Handle (SMDS_EdgePosition)::DownCast(node->GetPosition()); + epos->SetUParameter(param); + + int edgeId = meshDS->AddEdge(idPrev, nodeId); + elt = meshDS->FindElement(edgeId); + meshDS->SetMeshElementOnShape(elt, E); + idPrev = nodeId; + } + int edgeId = meshDS->AddEdge(idPrev, idLast); + Handle (SMDS_MeshElement) elt = meshDS->FindElement(edgeId); + meshDS->SetMeshElementOnShape(elt, E); + } + else ASSERT(0); + } + return true; +} diff --git a/src/SMESH/SMESH_Regular_1D.hxx b/src/SMESH/SMESH_Regular_1D.hxx new file mode 100644 index 000000000..7188e7447 --- /dev/null +++ b/src/SMESH/SMESH_Regular_1D.hxx @@ -0,0 +1,43 @@ +//============================================================================= +// File : SMESH_Regular_1D.hxx +// Created : sam mai 18 08:11:54 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= + +#ifndef _SMESH_REGULAR_1D_HXX_ +#define _SMESH_REGULAR_1D_HXX_ + +#include "SMESH_1D_Algo.hxx" + +class SMESH_LocalLength; +class SMESH_NumberOfSegments; + +class SMESH_Regular_1D: + public SMESH_1D_Algo +{ +public: + SMESH_Regular_1D(int hypId, int studyId, SMESH_Gen* gen); + virtual ~SMESH_Regular_1D(); + + virtual bool CheckHypothesis(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape); + + virtual bool Compute(SMESH_Mesh& aMesh, + const TopoDS_Shape& aShape); + + ostream & SaveTo(ostream & save); + istream & LoadFrom(istream & load); + friend ostream & operator << (ostream & save, SMESH_Regular_1D & hyp); + friend istream & operator >> (istream & load, SMESH_Regular_1D & hyp); + +protected: + double _localLength; + int _numberOfSegments; + SMESH_LocalLength* _hypLocalLength; + SMESH_NumberOfSegments* _hypNumberOfSegments; +}; + +#endif diff --git a/src/SMESH/SMESH_subMesh.cxx b/src/SMESH/SMESH_subMesh.cxx new file mode 100644 index 000000000..1273bce7a --- /dev/null +++ b/src/SMESH/SMESH_subMesh.cxx @@ -0,0 +1,1397 @@ +using namespace std; +//============================================================================= +// File : SMESH_subMesh.cxx +// Created : jeu mai 30 13:28:32 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= + +using namespace std; + +#include "SMESH_subMesh.hxx" +#include "SMESH_Gen.hxx" +#include "SMESH_Mesh.hxx" +#include "SMESH_Hypothesis.hxx" +#include "SMESH_Algo.hxx" +#include "utilities.h" +#include "OpUtil.hxx" + +#include +#include +#include +#include +#include + +//============================================================================= +/*! + * default constructor: + */ +//============================================================================= + +SMESH_subMesh::SMESH_subMesh(int Id, + SMESH_Mesh* father, + const Handle(SMESHDS_Mesh)& meshDS, + const TopoDS_Shape & aSubShape) +{ + //MESSAGE("SMESH_subMesh::SMESH_subMesh"); + _subShape = aSubShape; + _meshDS = meshDS; + _subMeshDS = meshDS->MeshElements(_subShape); // may be null ... + _father = father; + _Id = Id; + _vertexSet = false; // only for Vertex subMesh + _dependenceAnalysed = false; + _dependantsFound = false; + + if (_subShape.ShapeType() == TopAbs_VERTEX) + { + _algoState = HYP_OK; + _computeState = READY_TO_COMPUTE; + } + else + { + _algoState = NO_ALGO; + _computeState = NOT_READY; + } +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_subMesh::~SMESH_subMesh() +{ + MESSAGE("SMESH_subMesh::~SMESH_subMesh"); + // **** +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +int SMESH_subMesh::GetId() +{ + //MESSAGE("SMESH_subMesh::GetId"); + return _Id; +} + +//============================================================================= +/*! + * Given a subShape, find the subMesh is associated to this subShape or + * to a collection of shapes containing this subShape. Collection = compsolid, + * shell, wire + */ +//============================================================================= + +// bool SMESH_subMesh::Contains(const TopoDS_Shape & aSubShape) +// throw (SALOME_Exception) +// { +// //MESSAGE("SMESH_subMesh::Contains"); +// bool contains = false; +// int type = _subShape.ShapeType(); +// int typesub = aSubShape.ShapeType(); +// //SCRUTE(type) +// //SCRUTE(typesub) +// switch (type) +// { +// // case TopAbs_COMPOUND: +// // { +// // //MESSAGE("---"); +// // throw SALOME_Exception(LOCALIZED("Compound not yet treated")); +// // break; +// // } +// case TopAbs_COMPSOLID: +// { +// //MESSAGE("---"); +// for (TopExp_Explorer exp(aSubShape,TopAbs_SOLID);exp.More();exp.Next()) +// { +// contains = _subShape.IsSame(exp.Current()); +// if (contains) break; +// } +// break; +// } +// case TopAbs_SHELL: +// { +// //MESSAGE("---"); +// for (TopExp_Explorer exp(aSubShape,TopAbs_FACE);exp.More();exp.Next()) +// { +// contains = _subShape.IsSame(exp.Current()); +// if (contains) break; +// } +// break; +// } +// case TopAbs_WIRE: +// { +// //MESSAGE("---"); +// for (TopExp_Explorer exp(aSubShape,TopAbs_EDGE);exp.More();exp.Next()) +// { +// contains = _subShape.IsSame(exp.Current()); +// if (contains) break; +// } +// break; +// } +// case TopAbs_COMPOUND: +// case TopAbs_SOLID: +// case TopAbs_FACE: +// case TopAbs_EDGE: +// case TopAbs_VERTEX: +// { +// //MESSAGE("---"); +// contains = _subShape.IsSame(aSubShape); +// break; +// } +// default: +// { +// break; +// } +// } +// //SCRUTE(contains); +// return contains; +// } + +//============================================================================= +/*! + * + */ +//============================================================================= + +const Handle(SMESHDS_SubMesh)& SMESH_subMesh::GetSubMeshDS() + throw (SALOME_Exception) +{ + //MESSAGE("SMESH_subMesh::GetSubMeshDS"); + if (_subMeshDS.IsNull()) + { + //MESSAGE("subMesh pointer still null, trying to get it..."); + _subMeshDS = _meshDS->MeshElements(_subShape); // may be null ... + if (_subMeshDS.IsNull()) + { + MESSAGE("problem... subMesh still empty"); + //NRI ASSERT(0); + //NRI throw SALOME_Exception(LOCALIZED(subMesh still empty)); + } + } + return _subMeshDS; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +SMESH_subMesh* SMESH_subMesh::GetFirstToCompute() + throw (SALOME_Exception) +{ + //MESSAGE("SMESH_subMesh::GetFirstToCompute"); + const map& subMeshes = DependsOn(); + SMESH_subMesh* firstToCompute = 0; + + map::const_iterator itsub; + for (itsub = subMeshes.begin(); itsub != subMeshes.end(); itsub++) + { + SMESH_subMesh* sm = (*itsub).second; +// SCRUTE(sm->GetId()); +// SCRUTE(sm->GetComputeState()); + bool readyToCompute = (sm->GetComputeState() == READY_TO_COMPUTE); + if (readyToCompute) + { + firstToCompute = sm; + //SCRUTE(sm->GetId()); + break; + } + } + if (firstToCompute) + { + //MESSAGE("--- submesh to compute"); + return firstToCompute; // a subMesh of this + } + if (_computeState == READY_TO_COMPUTE) + { + //MESSAGE("--- this to compute"); + return this; // this + } + //MESSAGE("--- nothing to compute"); + return 0; // nothing to compute +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +bool SMESH_subMesh::SubMeshesComputed() + throw (SALOME_Exception) +{ + //MESSAGE("SMESH_subMesh::SubMeshesComputed"); + const map& subMeshes = DependsOn(); + + bool subMeshesComputed = true; + map::const_iterator itsub; + for (itsub = subMeshes.begin(); itsub != subMeshes.end(); itsub++) + { + SMESH_subMesh* sm = (*itsub).second; +// SCRUTE(sm->GetId()); +// SCRUTE(sm->GetComputeState()); + bool computeOk = (sm->GetComputeState() == COMPUTE_OK); + if (! computeOk) + { + subMeshesComputed = false; + SCRUTE(sm->GetId()); + break; + } + } + return subMeshesComputed; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +bool SMESH_subMesh::SubMeshesReady() +{ + MESSAGE("SMESH_subMesh::SubMeshesReady"); + const map& subMeshes = DependsOn(); + + bool subMeshesReady = true; + map::const_iterator itsub; + for (itsub = subMeshes.begin(); itsub != subMeshes.end(); itsub++) + { + SMESH_subMesh* sm = (*itsub).second; +// SCRUTE(sm->GetId()); +// SCRUTE(sm->GetComputeState()); + bool computeOk = ( (sm->GetComputeState() == COMPUTE_OK) + || (sm->GetComputeState() == READY_TO_COMPUTE)) ; + if (! computeOk) + { + subMeshesReady = false; + SCRUTE(sm->GetId()); + break; + } + } + return subMeshesReady; +} + +//============================================================================= +/*! + * Construct dependence on first level subMeshes. complex shapes (compsolid, + * shell, wire) are not analysed the same way as simple shapes (solid, face, + * edge). + * For collection shapes (compsolid, shell, wire) prepare a list of submeshes + * with possible multiples occurences. Multiples occurences corresponds to + * internal frontiers within shapes of the collection and must not be keeped. + * See FinalizeDependence. + */ +//============================================================================= + +const map& SMESH_subMesh::DependsOn() +{ + if (_dependenceAnalysed) return _mapDepend; + + //MESSAGE("SMESH_subMesh::DependsOn"); + + int type = _subShape.ShapeType(); + //SCRUTE(type); + switch (type) + { + case TopAbs_COMPOUND: + { + //MESSAGE("compound"); + list shellInSolid; + for (TopExp_Explorer exp(_subShape,TopAbs_SOLID);exp.More();exp.Next()) + { + InsertDependence(exp.Current()); + for (TopExp_Explorer + exp2(exp.Current(),TopAbs_SHELL);exp2.More();exp2.Next()) + { + shellInSolid.push_back(exp2.Current()); + } + } + for (TopExp_Explorer exp(_subShape,TopAbs_SHELL);exp.More();exp.Next()) + { + list::iterator it1; + bool isInSolid = false; + for (it1 = shellInSolid.begin(); it1 != shellInSolid.end(); it1++) + { + TopoDS_Shape aShape = (*it1); + if (aShape.IsSame(exp.Current())) + { + isInSolid = true; + break; + } + } + if (!isInSolid) + InsertDependence(exp.Current()); //only shell not in solid + } + for (TopExp_Explorer exp(_subShape,TopAbs_FACE);exp.More();exp.Next()) + { + InsertDependence(exp.Current()); + } + for (TopExp_Explorer exp(_subShape,TopAbs_EDGE);exp.More();exp.Next()) + { + InsertDependence(exp.Current()); + } + break; + } + case TopAbs_COMPSOLID: + { + //MESSAGE("compsolid"); + for (TopExp_Explorer exp(_subShape,TopAbs_SOLID);exp.More();exp.Next()) + { + InsertDependence(exp.Current()); + } +// list shapeList; +// for (TopExp_Explorer exp(_subShape,TopAbs_SOLID);exp.More();exp.Next()) +// { +// for (TopExp_Explorer +// exp2(exp.Current(),TopAbs_FACE);exp2.More();exp2.Next()) +// { +// shapeList.push_back(exp2.Current()); +// } +// } +// FinalizeDependence(shapeList); + break; + } + case TopAbs_SHELL: + { + //MESSAGE("shell"); + for (TopExp_Explorer exp(_subShape,TopAbs_FACE);exp.More();exp.Next()) + { + InsertDependence(exp.Current()); + } +// list shapeList; +// for (TopExp_Explorer exp(_subShape,TopAbs_FACE);exp.More();exp.Next()) +// { +// for (TopExp_Explorer +// exp2(exp.Current(),TopAbs_EDGE);exp2.More();exp2.Next()) +// { +// shapeList.push_back(exp2.Current()); +// } +// } +// FinalizeDependence(shapeList); + break; + } + case TopAbs_WIRE: + { + //MESSAGE("wire"); + for (TopExp_Explorer exp(_subShape,TopAbs_EDGE);exp.More();exp.Next()) + { + InsertDependence(exp.Current()); + } +// list shapeList; +// for (TopExp_Explorer exp(_subShape,TopAbs_EDGE);exp.More();exp.Next()) +// { +// for (TopExp_Explorer +// exp2(exp.Current(),TopAbs_VERTEX);exp2.More();exp2.Next()) +// { +// shapeList.push_back(exp2.Current()); +// } +// } +// FinalizeDependence(shapeList); + break; + } + case TopAbs_SOLID: + { + //MESSAGE("solid"); +// for (TopExp_Explorer exp(_subShape,TopAbs_SHELL);exp.More();exp.Next()) +// { +// InsertDependence(exp.Current()); +// } + for (TopExp_Explorer exp(_subShape,TopAbs_FACE);exp.More();exp.Next()) + { + InsertDependence(exp.Current()); + } + break; + } + case TopAbs_FACE: + { + //MESSAGE("face"); +// for (TopExp_Explorer exp(_subShape,TopAbs_WIRE);exp.More();exp.Next()) +// { +// InsertDependence(exp.Current()); +// } + for (TopExp_Explorer exp(_subShape,TopAbs_EDGE);exp.More();exp.Next()) + { + InsertDependence(exp.Current()); + } + break; + } + case TopAbs_EDGE: + { + //MESSAGE("edge"); + for (TopExp_Explorer exp(_subShape,TopAbs_VERTEX);exp.More();exp.Next()) + { + InsertDependence(exp.Current()); + } + break; + } + case TopAbs_VERTEX: + { + break; + } + default: + { + break; + } + } + _dependenceAnalysed = true; + return _mapDepend; +} + +//============================================================================= +/*! + * For simple Shapes (solid, face, edge): add subMesh into dependence list. + */ +//============================================================================= + +void SMESH_subMesh::InsertDependence(const TopoDS_Shape aSubShape) +{ + //MESSAGE("SMESH_subMesh::InsertDependence"); + //SMESH_subMesh* aSubMesh = _father->GetSubMeshContaining(aSubShape); + //SCRUTE(aSubMesh); + //if (! aSubMesh) aSubMesh = _father->GetSubMesh(aSubShape); + + SMESH_subMesh* aSubMesh = _father->GetSubMesh(aSubShape); + int type = aSubShape.ShapeType(); + int ordType = 9 - type; // 2 = Vertex, 8 = CompSolid + int cle = aSubMesh->GetId(); + cle += 10000000 * ordType; // sort map by ordType then index + if (_mapDepend.find(cle) == _mapDepend.end()) + { + _mapDepend[cle] = aSubMesh; + const map& subMap = aSubMesh->DependsOn(); + map::const_iterator im; + for (im = subMap.begin(); im != subMap.end(); im++) + { + int clesub = (*im).first; + SMESH_subMesh* sm = (*im).second; + if (_mapDepend.find(clesub) == _mapDepend.end()) + _mapDepend[clesub] = sm; + } + } + +} + +//============================================================================= +/*! + * For collection shapes (compsolid, shell, wire). + * Add only subMesh figuring only once in multiset to dependence list + */ +//============================================================================= + +// void SMESH_subMesh::FinalizeDependence(list& shapeList) +// { +// //MESSAGE("SMESH_subMesh::FinalizeDependence"); +// list::iterator it1, it2; +// for(it1 = shapeList.begin(); it1 != shapeList.end(); it1++) +// { +// TopoDS_Shape aSubShape = (*it1); +// int count = 0; +// for(it2 = shapeList.begin(); it2 != shapeList.end(); it2++) +// { +// TopoDS_Shape other = (*it2); +// if (other.IsSame(aSubShape)) count++; +// } +// if (count == 1) InsertDependence(aSubShape); +// SCRUTE(count); +// } +// } + +//============================================================================= +/*! + * + */ +//============================================================================= + + const TopoDS_Shape& SMESH_subMesh::GetSubShape() +{ + //MESSAGE("SMESH_subMesh::GetSubShape"); + return _subShape; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +bool SMESH_subMesh::AlgoStateEngine(int event, SMESH_Hypothesis* anHyp) + throw (SALOME_Exception) +{ + // MESSAGE("SMESH_subMesh::AlgoStateEngine"); + //SCRUTE(_algoState); + //SCRUTE(event); + + // **** les retour des evenement shape sont significatifs + // (add ou remove fait ou non) + // le retour des evenement father n'indiquent pas que add ou remove fait + int dim = SMESH_Gen::GetShapeDim(_subShape); + + if (dim < 1) + { + _algoState = HYP_OK; + //SCRUTE(_algoState); + return true; + } + + SMESH_Gen* gen =_father->GetGen(); + bool ret; + _oldAlgoState = _algoState; + bool modifiedHyp = false; // if set to true, force event MODIF_ALGO_STATE + // in ComputeStateEngine + + switch (_algoState) + { + + // ---------------------------------------------------------------------- + + case NO_ALGO: + switch (event) + { + case ADD_HYP: + ASSERT(anHyp->GetType() == SMESHDS_Hypothesis::PARAM_ALGO); + ret = _meshDS->AddHypothesis(_subShape, anHyp); + break; + case ADD_ALGO: + ASSERT(anHyp->GetType() != SMESHDS_Hypothesis::PARAM_ALGO); + if (anHyp->GetDim() <= SMESH_Gen::GetShapeDim(_subShape)) + { + ret = _meshDS->AddHypothesis(_subShape, anHyp); +// if (ret &&(anHyp->GetDim() == SMESH_Gen::GetShapeDim(_subShape))) +// if (ret &&(anHyp->GetShapeType() == _subShape.ShapeType())) + if (ret &&(anHyp->GetShapeType() & (1<< _subShape.ShapeType()))) + { + SMESH_Algo* algo = gen->GetAlgo((*_father), _subShape); + ASSERT(algo); + ret = algo->CheckHypothesis((*_father),_subShape); + if (ret) SetAlgoState(HYP_OK); + else SetAlgoState(MISSING_HYP); + } + } + break; + case REMOVE_HYP: + ASSERT(anHyp->GetType() == SMESHDS_Hypothesis::PARAM_ALGO); + ret = _meshDS->RemoveHypothesis(_subShape, anHyp); + break; + case REMOVE_ALGO: + ASSERT(anHyp->GetType() != SMESHDS_Hypothesis::PARAM_ALGO); + ret = _meshDS->RemoveHypothesis(_subShape, anHyp); + break; + case ADD_FATHER_HYP: // nothing to do + break; + case ADD_FATHER_ALGO: // Algo just added in father + ASSERT(anHyp->GetType() != SMESHDS_Hypothesis::PARAM_ALGO); +// if (anHyp->GetDim() == SMESH_Gen::GetShapeDim(_subShape)) +// if (anHyp->GetShapeType() == _subShape.ShapeType()) + if (anHyp->GetShapeType() & (1<< _subShape.ShapeType())) + { + SMESH_Algo* algo = gen->GetAlgo((*_father), _subShape); + ASSERT(algo); + ret = algo->CheckHypothesis((*_father),_subShape); + if (ret) SetAlgoState(HYP_OK); + else SetAlgoState(MISSING_HYP); + } + break; + case REMOVE_FATHER_HYP: // nothing to do + break; + case REMOVE_FATHER_ALGO: // nothing to do + break; + default: + ASSERT(0); + break; + } + break; + + // ---------------------------------------------------------------------- + + case MISSING_HYP: + switch (event) + { + case ADD_HYP: + ASSERT(anHyp->GetType() == SMESHDS_Hypothesis::PARAM_ALGO); + ret = _meshDS->AddHypothesis(_subShape, anHyp); + if (ret) + { + SMESH_Algo* algo = gen->GetAlgo((*_father), _subShape); + ASSERT(algo); + ret = algo->CheckHypothesis((*_father),_subShape); + if (ret) SetAlgoState(HYP_OK); + else SetAlgoState(MISSING_HYP); + } + break; + case ADD_ALGO: //already existing algo : on father ? + ASSERT(anHyp->GetType() != SMESHDS_Hypothesis::PARAM_ALGO); + if (anHyp->GetDim() <= SMESH_Gen::GetShapeDim(_subShape)) + { + ret = _meshDS->AddHypothesis(_subShape, anHyp); +// if (ret &&(anHyp->GetDim() == SMESH_Gen::GetShapeDim(_subShape))) +// if (ret &&(anHyp->GetShapeType() == _subShape.ShapeType())) + if (ret &&(anHyp->GetShapeType() & (1<< _subShape.ShapeType()))) + { + SMESH_Algo* algo = gen->GetAlgo((*_father), _subShape); + if (algo == NULL) // two algo on the same subShape... + { + MESSAGE("two algo on the same subshape not allowed"); + ret = _meshDS->RemoveHypothesis(_subShape, anHyp); + ret = false; + } + else + { + ret = algo->CheckHypothesis((*_father),_subShape); + if (ret) SetAlgoState(HYP_OK); + else SetAlgoState(MISSING_HYP); + } + } + } + break; + case REMOVE_HYP: + ASSERT(anHyp->GetType() == SMESHDS_Hypothesis::PARAM_ALGO); + ret = _meshDS->RemoveHypothesis(_subShape, anHyp); + break; + case REMOVE_ALGO: // perhaps a father algo applies ? + ASSERT(anHyp->GetType() != SMESHDS_Hypothesis::PARAM_ALGO); + ret = _meshDS->RemoveHypothesis(_subShape, anHyp); +// if (ret &&(anHyp->GetDim() == SMESH_Gen::GetShapeDim(_subShape))) +// if (ret &&(anHyp->GetShapeType() == _subShape.ShapeType())) + if (ret &&(anHyp->GetShapeType() & (1<<_subShape.ShapeType()))) + { + SMESH_Algo* algo = gen->GetAlgo((*_father), _subShape); + if (algo == NULL) // no more algo applying on subShape... + { + SetAlgoState(NO_ALGO); + } + else + { + ret = algo->CheckHypothesis((*_father),_subShape); + if (ret) SetAlgoState(HYP_OK); + else SetAlgoState(MISSING_HYP); + } + } + break; + case ADD_FATHER_HYP: + ASSERT(anHyp->GetType() == SMESHDS_Hypothesis::PARAM_ALGO); + { + SMESH_Algo* algo = gen->GetAlgo((*_father), _subShape); + ASSERT(algo); + ret = algo->CheckHypothesis((*_father),_subShape); + if (ret) SetAlgoState(HYP_OK); + else SetAlgoState(MISSING_HYP); + } + break; + case ADD_FATHER_ALGO: // detect if two algo of same dim on father + ASSERT(anHyp->GetType() != SMESHDS_Hypothesis::PARAM_ALGO); +// if (anHyp->GetDim() == SMESH_Gen::GetShapeDim(_subShape)) +// if (anHyp->GetShapeType() == _subShape.ShapeType()) + if (anHyp->GetShapeType() & (1<< _subShape.ShapeType())) + { + SMESH_Algo* algo = gen->GetAlgo((*_father), _subShape); + if (algo == NULL) // two applying algo on father + { + MESSAGE("two applying algo on fatherShape..."); + SetAlgoState(NO_ALGO); + } + else + { + ret = algo->CheckHypothesis((*_father),_subShape); + if (ret) SetAlgoState(HYP_OK); + else SetAlgoState(MISSING_HYP); + } + } + break; + case REMOVE_FATHER_HYP: // nothing to do + break; + case REMOVE_FATHER_ALGO: + ASSERT(anHyp->GetType() != SMESHDS_Hypothesis::PARAM_ALGO); +// if (anHyp->GetDim() == SMESH_Gen::GetShapeDim(_subShape)) +// if (anHyp->GetShapeType() == _subShape.ShapeType()) + if (anHyp->GetShapeType() & (1<< _subShape.ShapeType())) + { + SMESH_Algo* algo = gen->GetAlgo((*_father), _subShape); + if (algo == NULL) // no more applying algo on father + { + SetAlgoState(NO_ALGO); + } + else + { + ret = algo->CheckHypothesis((*_father),_subShape); + if (ret) SetAlgoState(HYP_OK); + else SetAlgoState(MISSING_HYP); + } + } + break; + default: + ASSERT(0); + break; + } + break; + + // ---------------------------------------------------------------------- + + case HYP_OK: + switch (event) + { + case ADD_HYP: + { + ASSERT(anHyp->GetType() == SMESHDS_Hypothesis::PARAM_ALGO); + SMESH_Algo* algo = gen->GetAlgo((*_father), _subShape); + ASSERT(algo); + list originalUsedHyps + = algo->GetUsedHypothesis((*_father), _subShape); // copy + + ret = _meshDS->AddHypothesis(_subShape, anHyp); + if (ret) + { + ret = algo->CheckHypothesis((*_father),_subShape); + if (! ret) + { + INFOS("two applying algo on the same shape not allowed"); + ret = _meshDS->RemoveHypothesis(_subShape, anHyp); + ret = false; + } + else // compare SMESHDS_Hypothesis* lists (order important) + { + MESSAGE("---"); + const list& newUsedHyps + = algo->GetUsedHypothesis((*_father), _subShape); + modifiedHyp = (originalUsedHyps != newUsedHyps); + } + } + } + break; + case ADD_ALGO: //already existing algo : on father ? + ASSERT(anHyp->GetType() != SMESHDS_Hypothesis::PARAM_ALGO); + if (anHyp->GetDim() <= SMESH_Gen::GetShapeDim(_subShape)) + { + ret = _meshDS->AddHypothesis(_subShape, anHyp); +// if (ret &&(anHyp->GetDim() == SMESH_Gen::GetShapeDim(_subShape))) +// if (ret &&(anHyp->GetShapeType() == _subShape.ShapeType())) + if (ret &&(anHyp->GetShapeType() & (1<< _subShape.ShapeType()))) + { + SMESH_Algo* algo = gen->GetAlgo((*_father), _subShape); + if (algo == NULL) // two algo on the same subShape... + { + INFOS("two algo on the same subshape not allowed"); + ret = _meshDS->RemoveHypothesis(_subShape, anHyp); + ret = false; + } + else + { + ret = algo->CheckHypothesis((*_father),_subShape); + if (ret) SetAlgoState(HYP_OK); + else SetAlgoState(MISSING_HYP); + } + } + } + break; + case REMOVE_HYP: + ASSERT(anHyp->GetType() == SMESHDS_Hypothesis::PARAM_ALGO); + ret = _meshDS->RemoveHypothesis(_subShape, anHyp); + if (ret) + { + SMESH_Algo* algo = gen->GetAlgo((*_father), _subShape); + ASSERT(algo); + ret = algo->CheckHypothesis((*_father),_subShape); + if (ret) SetAlgoState(HYP_OK); + else SetAlgoState(MISSING_HYP); + modifiedHyp = true; + } + break; + case REMOVE_ALGO: // perhaps a father algo applies ? + ASSERT(anHyp->GetType() != SMESHDS_Hypothesis::PARAM_ALGO); + ret = _meshDS->RemoveHypothesis(_subShape, anHyp); +// if (ret &&(anHyp->GetDim() == SMESH_Gen::GetShapeDim(_subShape))) +// if (ret &&(anHyp->GetShapeType() == _subShape.ShapeType())) + if (ret &&(anHyp->GetShapeType() & (1<< _subShape.ShapeType()))) + { + SMESH_Algo* algo = gen->GetAlgo((*_father), _subShape); + if (algo == NULL) // no more algo applying on subShape... + { + SetAlgoState(NO_ALGO); + } + else + { + ret = algo->CheckHypothesis((*_father),_subShape); + if (ret) SetAlgoState(HYP_OK); + else SetAlgoState(MISSING_HYP); + } + } + break; + case ADD_FATHER_HYP: + ASSERT(anHyp->GetType() == SMESHDS_Hypothesis::PARAM_ALGO); + { + SMESH_Algo* algo = gen->GetAlgo((*_father), _subShape); + ASSERT(algo); + ret = algo->CheckHypothesis((*_father),_subShape); + if (ret) SetAlgoState(HYP_OK); + else SetAlgoState(MISSING_HYP); + } + break; + case ADD_FATHER_ALGO: // detect if two algo of same dim on father + ASSERT(anHyp->GetType() != SMESHDS_Hypothesis::PARAM_ALGO); +// if (anHyp->GetDim() == SMESH_Gen::GetShapeDim(_subShape)) +// if (anHyp->GetShapeType() == _subShape.ShapeType()) + if (anHyp->GetShapeType() & (1<< _subShape.ShapeType())) + { + SMESH_Algo* algo = gen->GetAlgo((*_father), _subShape); + if (algo == NULL) // two applying algo on father + { + MESSAGE("two applying algo on fatherShape..."); + SetAlgoState(NO_ALGO); + } + else + { + ret = algo->CheckHypothesis((*_father),_subShape); + if (ret) SetAlgoState(HYP_OK); + else SetAlgoState(MISSING_HYP); + } + } + break; + case REMOVE_FATHER_HYP: + ASSERT(anHyp->GetType() == SMESHDS_Hypothesis::PARAM_ALGO); + { + SMESH_Algo* algo = gen->GetAlgo((*_father), _subShape); + ASSERT(algo); + ret = algo->CheckHypothesis((*_father),_subShape); + if (ret) SetAlgoState(HYP_OK); + else SetAlgoState(MISSING_HYP); + } + break; + case REMOVE_FATHER_ALGO: + ASSERT(anHyp->GetType() != SMESHDS_Hypothesis::PARAM_ALGO); +// if (anHyp->GetDim() == SMESH_Gen::GetShapeDim(_subShape)) +// if (anHyp->GetShapeType() == _subShape.ShapeType()) + if (anHyp->GetShapeType() & (1<< _subShape.ShapeType())) + { + SMESH_Algo* algo = gen->GetAlgo((*_father), _subShape); + if (algo == NULL) // no more applying algo on father + { + SetAlgoState(NO_ALGO); + } + else + { + ret = algo->CheckHypothesis((*_father),_subShape); + if (ret) SetAlgoState(HYP_OK); + else SetAlgoState(MISSING_HYP); + } + } + break; + default: + ASSERT(0); + break; + } + break; + + // ---------------------------------------------------------------------- + + default: + ASSERT(0); + break; + } + //SCRUTE(_algoState); + if ((_algoState != _oldAlgoState) || modifiedHyp) + int retc = ComputeStateEngine(MODIF_ALGO_STATE); + return ret; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +void SMESH_subMesh::SetAlgoState(int state) +{ + if (state != _oldAlgoState) +// int retc = ComputeStateEngine(MODIF_ALGO_STATE); + _algoState = state; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +void SMESH_subMesh::SubMeshesAlgoStateEngine(int event, + SMESH_Hypothesis* anHyp) + throw (SALOME_Exception) +{ + //MESSAGE("SMESH_subMesh::SubMeshesAlgoStateEngine"); + int dim = SMESH_Gen::GetShapeDim(_subShape); + if (dim > 1) + { + const map& subMeshes = DependsOn(); + + map::const_iterator itsub; + for (itsub = subMeshes.begin(); itsub != subMeshes.end(); itsub++) + { + SMESH_subMesh* sm = (*itsub).second; + sm->AlgoStateEngine(event, anHyp); + } + } +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +void SMESH_subMesh::DumpAlgoState(bool isMain) +{ + int dim = SMESH_Gen::GetShapeDim(_subShape); +// if (dim < 1) return; + if (isMain) + { + const map& subMeshes = DependsOn(); + + map::const_iterator itsub; + for (itsub = subMeshes.begin(); itsub != subMeshes.end(); itsub++) + { + SMESH_subMesh* sm = (*itsub).second; + sm->DumpAlgoState(false); + } + } + int type = _subShape.ShapeType(); + MESSAGE("dim = " << dim << " type of shape " << type); + switch(_algoState) + { + case NO_ALGO: MESSAGE(" AlgoState = NO_ALGO"); break; + case MISSING_HYP: MESSAGE(" AlgoState = MISSING_HYP"); break; + case HYP_OK: MESSAGE(" AlgoState = HYP_OK"); break; + } + switch (_computeState) + { + case NOT_READY: MESSAGE(" ComputeState = NOT_READY"); break; + case READY_TO_COMPUTE: MESSAGE(" ComputeState = READY_TO_COMPUTE"); break; + case COMPUTE_OK: MESSAGE(" ComputeState = COMPUTE_OK"); break; + case FAILED_TO_COMPUTE: MESSAGE(" ComputeState = FAILED_TO_COMPUTE");break; + } +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +bool SMESH_subMesh::ComputeStateEngine(int event) + throw (SALOME_Exception) +{ + //MESSAGE("SMESH_subMesh::ComputeStateEngine"); + //SCRUTE(_computeState); + //SCRUTE(event); + + int dim = SMESH_Gen::GetShapeDim(_subShape); + + if (dim < 1) + { + if (_vertexSet) _computeState = COMPUTE_OK; + else _computeState = READY_TO_COMPUTE; + //SCRUTE(_computeState); + return true; + } + SMESH_Gen* gen =_father->GetGen(); + SMESH_Algo* algo = 0; + bool ret; + + switch(_computeState) + { + + // ---------------------------------------------------------------------- + + case NOT_READY: + switch (event) + { + case MODIF_HYP: // nothing to do + break; + case MODIF_ALGO_STATE: + if (_algoState == HYP_OK) + _computeState = READY_TO_COMPUTE; + break; + case COMPUTE: // nothing to do + break; + case CLEAN: // nothing to do + break; + case CLEANDEP: // nothing to do + RemoveSubMeshElementsAndNodes(); // recursive call... + break; + case SUBMESH_COMPUTED: // nothing to do + break; + default: + ASSERT(0); + break; + } + break; + + // ---------------------------------------------------------------------- + + case READY_TO_COMPUTE: + switch (event) + { + case MODIF_HYP: // nothing to do + break; + case MODIF_ALGO_STATE: + _computeState = NOT_READY; + algo = gen->GetAlgo((*_father), _subShape); + if (algo) + { + ret = algo->CheckHypothesis((*_father),_subShape); + if (ret) _computeState = READY_TO_COMPUTE; + } + break; + case COMPUTE: + { + algo = gen->GetAlgo((*_father), _subShape); + ASSERT(algo); + ret = algo->CheckHypothesis((*_father),_subShape); + if (! ret) + { + MESSAGE("***** verify compute state *****"); + _computeState = NOT_READY; + break; + } + ret = SubMeshesComputed(); + if (!ret) + { + MESSAGE("Some SubMeshes not computed"); + _computeState = FAILED_TO_COMPUTE; + break; + } + ret = algo->Compute((*_father),_subShape); + if (!ret) + { + MESSAGE("problem in algo execution: failed to compute"); + _computeState = FAILED_TO_COMPUTE; + break; + } + else + { + _computeState = COMPUTE_OK; + UpdateDependantsState(); // send event SUBMESH_COMPUTED + } + } + break; + case CLEAN: + _computeState = NOT_READY; + algo = gen->GetAlgo((*_father), _subShape); + if (algo) + { + ret = algo->CheckHypothesis((*_father),_subShape); + if (ret) _computeState = READY_TO_COMPUTE; + } + break; + case CLEANDEP: + RemoveSubMeshElementsAndNodes(); + _computeState = NOT_READY; + algo = gen->GetAlgo((*_father), _subShape); + if (algo) + { + ret = algo->CheckHypothesis((*_father),_subShape); + if (ret) _computeState = READY_TO_COMPUTE; + } + break; + case SUBMESH_COMPUTED: // nothing to do + break; + default: + ASSERT(0); + break; + } + break; + + // ---------------------------------------------------------------------- + + case COMPUTE_OK: + switch (event) + { + case MODIF_HYP: + CleanDependants(); // recursive recall with event CLEANDEP + break; + case MODIF_ALGO_STATE: + CleanDependants(); // recursive recall with event CLEANDEP + break; + case COMPUTE: // nothing to do + break; + case CLEAN: + CleanDependants(); // recursive recall with event CLEANDEP + break; + case CLEANDEP: + RemoveSubMeshElementsAndNodes(); + _computeState = NOT_READY; + algo = gen->GetAlgo((*_father), _subShape); + if (algo) + { + ret = algo->CheckHypothesis((*_father),_subShape); + if (ret) _computeState = READY_TO_COMPUTE; + } + break; + case SUBMESH_COMPUTED: // nothing to do + break; + default: + ASSERT(0); + break; + } + break; + + // ---------------------------------------------------------------------- + + case FAILED_TO_COMPUTE: + switch (event) + { + case MODIF_HYP: + if (_algoState == HYP_OK) + _computeState = READY_TO_COMPUTE; + else _computeState = NOT_READY; + break; + case MODIF_ALGO_STATE: + if (_algoState == HYP_OK) + _computeState = READY_TO_COMPUTE; + else _computeState = NOT_READY; + break; + case COMPUTE: // nothing to do + break; + case CLEAN: + break; + case CLEANDEP: + RemoveSubMeshElementsAndNodes(); + if (_algoState == HYP_OK) + _computeState = READY_TO_COMPUTE; + else _computeState = NOT_READY; + break; + case SUBMESH_COMPUTED: // allow retry compute + if (_algoState == HYP_OK) + _computeState = READY_TO_COMPUTE; + else _computeState = NOT_READY; + break; + default: + ASSERT(0); + break; + } + break; + + // ---------------------------------------------------------------------- + default: + ASSERT(0); + break; + } + + //SCRUTE(_computeState); + return ret; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +void SMESH_subMesh::UpdateDependantsState() +{ + //MESSAGE("SMESH_subMesh::UpdateDependantsState"); + + const map& dependants = Dependants(); + map::const_iterator its; + for (its = dependants.begin(); its != dependants.end(); its++) + { + SMESH_subMesh* sm = (*its).second; + //SCRUTE((*its).first); + sm->ComputeStateEngine(SUBMESH_COMPUTED); + } +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +void SMESH_subMesh::CleanDependants() +{ + MESSAGE("SMESH_subMesh::CleanDependants"); + // **** parcourir les ancetres dans l'ordre de dépendance + + const map& dependants = Dependants(); + map::const_iterator its; + for (its = dependants.begin(); its != dependants.end(); its++) + { + SMESH_subMesh* sm = (*its).second; + SCRUTE((*its).first); + sm->ComputeStateEngine(CLEANDEP); + } + ComputeStateEngine(CLEANDEP); +} +//============================================================================= +/*! + * + */ +//============================================================================= + +void SMESH_subMesh::RemoveSubMeshElementsAndNodes() +{ + MESSAGE("SMESH_subMesh::RemoveSubMeshElementsAndNodes"); + SCRUTE(_subShape.ShapeType()); + SCRUTE(_Id); + + _subMeshDS = _meshDS->MeshElements(_subShape); + if (!_subMeshDS.IsNull()) + { + const TColStd_ListOfInteger& indElt + = _subMeshDS->GetIDElements(); + TColStd_ListIteratorOfListOfInteger ite(indElt); + for (; ite.More(); ite.Next()) + { + int eltId = ite.Value(); + SCRUTE(eltId); + Handle (SMDS_MeshElement) elt = _meshDS->FindElement(eltId); + _subMeshDS->RemoveElement(elt); + _meshDS->RemoveElement(eltId); + } + + const TColStd_ListOfInteger& indNodes + = _subMeshDS->GetIDNodes(); + TColStd_ListIteratorOfListOfInteger itn(indNodes); + for (; itn.More(); itn.Next()) + { + int nodeId = itn.Value(); + SCRUTE(nodeId); + Handle (SMDS_MeshElement) elt = _meshDS->FindNode(nodeId); + Handle (SMDS_MeshNode) node = _meshDS->GetNode(1, elt); + _subMeshDS->RemoveNode(node); + _meshDS->RemoveNode(nodeId); + } + } +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +const map& SMESH_subMesh::Dependants() +{ + if (_dependantsFound) return _mapDependants; + + //MESSAGE("SMESH_subMesh::Dependants"); + + int shapeType = _subShape.ShapeType(); + //SCRUTE(shapeType); + TopTools_IndexedDataMapOfShapeListOfShape M; + TopoDS_Shape mainShape = _meshDS->ShapeToMesh(); + + switch (shapeType) + { + case TopAbs_VERTEX: + break; + case TopAbs_EDGE: + case TopAbs_WIRE: + TopExp::MapShapesAndAncestors(mainShape, TopAbs_EDGE, TopAbs_WIRE, M); + TopExp::MapShapesAndAncestors(mainShape, TopAbs_EDGE, TopAbs_FACE, M); + TopExp::MapShapesAndAncestors(mainShape, TopAbs_EDGE, TopAbs_SHELL, M); + TopExp::MapShapesAndAncestors(mainShape, TopAbs_EDGE, TopAbs_SOLID, M); + TopExp::MapShapesAndAncestors(mainShape, TopAbs_EDGE, TopAbs_COMPSOLID, M); + ExtractDependants(M, TopAbs_EDGE); + break; + case TopAbs_FACE: + case TopAbs_SHELL: + TopExp::MapShapesAndAncestors(mainShape, TopAbs_FACE, TopAbs_SHELL, M); + TopExp::MapShapesAndAncestors(mainShape, TopAbs_FACE, TopAbs_SOLID, M); + TopExp::MapShapesAndAncestors(mainShape, TopAbs_FACE, TopAbs_COMPSOLID, M); + ExtractDependants(M, TopAbs_FACE); + break; + case TopAbs_SOLID: + case TopAbs_COMPSOLID: + TopExp::MapShapesAndAncestors(mainShape, TopAbs_SOLID, TopAbs_COMPSOLID, M); + ExtractDependants(M, TopAbs_SOLID); + break; + case TopAbs_COMPOUND: + break; + } + + _dependantsFound = true; + return _mapDependants; +} + +//============================================================================= +/*! + * + */ +//============================================================================= + +void SMESH_subMesh::ExtractDependants(const TopTools_IndexedDataMapOfShapeListOfShape& M, + const TopAbs_ShapeEnum etype) +{ + //MESSAGE("SMESH_subMesh::ExtractDependants"); + + TopoDS_Shape mainShape = _meshDS->ShapeToMesh(); + int lg = M.Extent(); + //SCRUTE(lg); + + int shapeType = _subShape.ShapeType(); + switch (shapeType) + { + case TopAbs_VERTEX: + break; + case TopAbs_EDGE: + case TopAbs_FACE: + case TopAbs_SOLID: + { + const TopTools_ListOfShape& ancestors = M.FindFromKey(_subShape); + TopTools_ListIteratorOfListOfShape it(ancestors); + for ( ; it.More();it.Next()) + { + TopoDS_Shape ancestor = it.Value(); + SMESH_subMesh* aSubMesh = _father->GetSubMeshContaining(ancestor); + // if (! aSubMesh) aSubMesh = _father->GetSubMesh(ancestor); + if (aSubMesh) + { + int type = aSubMesh->_subShape.ShapeType(); + int cle = aSubMesh->GetId(); + cle += 10000000 * type; // sort map by ordType then index + if (_mapDependants.find(cle) == _mapDependants.end()) + { + _mapDependants[cle] = aSubMesh; + //SCRUTE(cle); + } + } + } + } + break; + case TopAbs_WIRE: + case TopAbs_SHELL: + case TopAbs_COMPSOLID: + for (TopExp_Explorer expE(_subShape, etype); expE.More(); expE.Next()) + { + TopoDS_Shape aShape = expE.Current(); + const TopTools_ListOfShape& ancestors = M.FindFromKey( aShape); + TopTools_ListIteratorOfListOfShape it(ancestors); + for ( ; it.More();it.Next()) + { + MESSAGE("---"); + TopoDS_Shape ancestor = it.Value(); + SMESH_subMesh* aSubMesh = _father->GetSubMeshContaining(ancestor); + if (! aSubMesh) aSubMesh = _father->GetSubMesh(ancestor); + int type = aSubMesh->_subShape.ShapeType(); + int cle = aSubMesh->GetId(); + cle += 10000000 * type; // sort map by ordType then index + if (_mapDependants.find(cle) == _mapDependants.end()) + { + _mapDependants[cle] = aSubMesh; + SCRUTE(cle); + } + } + } + break; + case TopAbs_COMPOUND: + break; + } +} + diff --git a/src/SMESH/SMESH_subMesh.hxx b/src/SMESH/SMESH_subMesh.hxx new file mode 100644 index 000000000..ab53a115c --- /dev/null +++ b/src/SMESH/SMESH_subMesh.hxx @@ -0,0 +1,109 @@ +//============================================================================= +// File : SMESH_subMesh.hxx +// Created : jeu mai 30 13:28:36 CEST 2002 +// Author : Paul RASCLE, EDF +// Project : SALOME +// Copyright : EDF 2002 +// $Header$ +//============================================================================= + +#ifndef _SMESH_SUBMESH_HXX_ +#define _SMESH_SUBMESH_HXX_ + +#include "SMESHDS_Mesh.hxx" +#include "SMESHDS_SubMesh.hxx" +#include "Utils_SALOME_Exception.hxx" +#include +#include +#include + +#include +#include +#include + +class SMESH_Mesh; +class SMESH_Hypothesis; + +class SMESH_subMesh +{ +public: + SMESH_subMesh(int Id, + SMESH_Mesh* father, + const Handle(SMESHDS_Mesh)& meshDS, + const TopoDS_Shape & aSubShape); + virtual ~SMESH_subMesh(); + + int GetId(); + +// bool Contains(const TopoDS_Shape & aSubShape) +// throw (SALOME_Exception); + + const Handle(SMESHDS_SubMesh)& GetSubMeshDS() + throw (SALOME_Exception); + + SMESH_subMesh* GetFirstToCompute() + throw (SALOME_Exception); + + const map& DependsOn(); + const map& Dependants(); + + const TopoDS_Shape& GetSubShape(); + + bool _vertexSet; // only for vertex subMesh, set to false for dim > 0 + + enum compute_state { NOT_READY, READY_TO_COMPUTE, + COMPUTE_OK, FAILED_TO_COMPUTE }; + enum algo_state { NO_ALGO, MISSING_HYP, HYP_OK }; + enum algo_event {ADD_HYP, ADD_ALGO, + REMOVE_HYP, REMOVE_ALGO, + ADD_FATHER_HYP, ADD_FATHER_ALGO, + REMOVE_FATHER_HYP, REMOVE_FATHER_ALGO}; + enum compute_event {MODIF_HYP, MODIF_ALGO_STATE, COMPUTE, + CLEAN, CLEANDEP, SUBMESH_COMPUTED}; + + bool AlgoStateEngine(int event, SMESH_Hypothesis* anHyp) + throw (SALOME_Exception); + + void SubMeshesAlgoStateEngine(int event, SMESH_Hypothesis* anHyp) + throw (SALOME_Exception); + + void DumpAlgoState(bool isMain); + + bool ComputeStateEngine(int event) + throw (SALOME_Exception); + + int GetComputeState() {return _computeState;}; + +protected: + void InsertDependence(const TopoDS_Shape aSubShape); +// void FinalizeDependence(list& shapeList); + + bool SubMeshesComputed() + throw (SALOME_Exception); + + bool SubMeshesReady(); + + void RemoveSubMeshElementsAndNodes(); + void UpdateDependantsState(); + void CleanDependants(); + void ExtractDependants(const TopTools_IndexedDataMapOfShapeListOfShape& M, + const TopAbs_ShapeEnum etype); + void SetAlgoState(int state); + + TopoDS_Shape _subShape; + Handle (SMESHDS_Mesh) _meshDS; + Handle (SMESHDS_SubMesh) _subMeshDS; + int _Id; + SMESH_Mesh* _father; + map _mapDepend; + map _mapDependants; + bool _dependenceAnalysed; + bool _dependantsFound; + + int _algoState; + int _oldAlgoState; + int _computeState; + +}; + +#endif -- 2.39.2