SALOME PAL V1_4_1

This commit is contained in:
smh 2004-04-02 13:33:18 +00:00
parent 5980f7c6cc
commit 9313a9353c
158 changed files with 18447 additions and 15904 deletions

View File

@ -1,6 +1,6 @@
This is SMESH V1_4_0 This is SMESH V1_4_1
Compatible with : Compatible with :
GEOM V1_4_0 GEOM V1_4_1
KERNEL V1_4_0 KERNEL V1_4_1
MED V1_4_0 MED V1_4_1

View File

@ -14,7 +14,7 @@ VPATH=.:@srcdir@:@top_srcdir@/bin:@top_srcdir@/resources:./bin:@top_srcdir@/idl
@COMMENCE@ @COMMENCE@
SUBDIRS = idl src SUBDIRS = idl src doc
RESOURCES_FILES = \ RESOURCES_FILES = \
delete.png \ delete.png \
@ -40,6 +40,8 @@ mesh_hypo_volume.png \
mesh_info.png \ mesh_info.png \
mesh_init.png \ mesh_init.png \
mesh_length.png \ mesh_length.png \
mesh_free_edges.png \
mesh_multi_edges.png \
mesh_line_n.png \ mesh_line_n.png \
mesh_line.png \ mesh_line.png \
mesh_move_node.png \ mesh_move_node.png \
@ -71,6 +73,7 @@ mesh_tree_hypo.png \
mesh_tree_hypo_segment.png \ mesh_tree_hypo_segment.png \
mesh_tree_hypo_volume.png \ mesh_tree_hypo_volume.png \
mesh_tree_mesh.png \ mesh_tree_mesh.png \
mesh_tree_importedmesh.png \
mesh_tree_mesh_warn.png \ mesh_tree_mesh_warn.png \
mesh_triangle_n.png \ mesh_triangle_n.png \
mesh_triangle.png \ mesh_triangle.png \
@ -78,10 +81,16 @@ mesh_update.png \
mesh_vertex_n.png \ mesh_vertex_n.png \
mesh_vertex.png \ mesh_vertex.png \
mesh_wireframe.png \ mesh_wireframe.png \
mesh_points.png \
mesh_wrap.png \ mesh_wrap.png \
mesh_tree_group.png \
mesh_edit_group.png \
mesh_make_group.png \
ModuleMesh.png \ ModuleMesh.png \
select1.png \ select1.png \
SMESH_en.xml \ SMESH_en.xml \
SMESH.config \
StdMeshers.xml \
SMESHCatalog.xml \ SMESHCatalog.xml \
flight_solid.brep flight_solid.brep
@ -104,10 +113,10 @@ include/salome/SALOMEconfig.h: salome_adm/unix/SALOMEconfig.ref
# test if SALOMEconfig.h has changed (contents) # test if SALOMEconfig.h has changed (contents)
salome_adm/unix/SALOMEconfig.ref: salome_adm/unix/SALOMEconfig.h salome_adm/unix/SALOMEconfig.ref: salome_adm/unix/SALOMEconfig.h
@if ! [ -a $@ ]; then \ @if ! [ -a $@ ]; then \
cp -p $< $@; \ cp -p -f $< $@; \
fi; \ fi; \
if ! cmp $< $@; then \ if ! cmp $< $@; then \
cp -p $< $@; \ cp -p -f $< $@; \
fi; \ fi; \
include/salome/sstream: salome_adm/unix/sstream include/salome/sstream: salome_adm/unix/sstream
@ -131,7 +140,7 @@ install-include: $(include_list)
$(INSTALL) -d $(includedir) $(INSTALL) -d $(includedir)
@for f in X $(include_list); do \ @for f in X $(include_list); do \
if test $$f != X; then \ if test $$f != X; then \
($(INSTALL_DATA) $$f $(includedir)/. || exit 1); \ ($(INSTALL_DATA) -p $$f $(includedir)/. || exit 1); \
fi; \ fi; \
done done

View File

@ -47,7 +47,7 @@ if test -f ${GEOM_DIR}/bin/salome/libGEOM_Swig.py ; then
else else
AC_MSG_WARN("Cannot find compiled Geom module distribution") AC_MSG_WARN("Cannot find compiled Geom module distribution")
fi fi
AC_MSG_RESULT(for Geom: $Geom_ok) AC_MSG_RESULT(for Geom: $Geom_ok)
])dnl ])dnl

View File

@ -45,7 +45,7 @@ if test -f ${MED_DIR}/bin/salome/libMEDMEM_Swig.py ; then
AC_SUBST(MED_ROOT_DIR) AC_SUBST(MED_ROOT_DIR)
else else
AC_MSG_WARN("Cannot find compiled Med module distribution") AC_MSG_WARN("Cannot find Med module sources")
fi fi
AC_MSG_RESULT(for Med: $Med_ok) AC_MSG_RESULT(for Med: $Med_ok)

View File

@ -34,6 +34,10 @@ CXX = @CXX@
CXXFLAGS = @CXXFLAGS@ CXXFLAGS = @CXXFLAGS@
CXX_DEPEND_FLAG = @CXX_DEPEND_FLAG@ CXX_DEPEND_FLAG = @CXX_DEPEND_FLAG@
# BOOST Library
BOOST_CPPFLAGS = @BOOST_CPPFLAGS@
# JAVA # JAVA
JAVA_INCLUDES = @JAVA_INCLUDES@ JAVA_INCLUDES = @JAVA_INCLUDES@
@ -127,7 +131,8 @@ OMNIORB_CXXFLAGS = @OMNIORB_CXXFLAGS@
OMNIORB_IDL = @OMNIORB_IDL@ OMNIORB_IDL = @OMNIORB_IDL@
OMNIORB_IDLCXXFLAGS = @OMNIORB_IDLCXXFLAGS@ OMNIORB_IDLCXXFLAGS = @OMNIORB_IDLCXXFLAGS@
OMNIORB_IDLPYFLAGS = @OMNIORB_IDLPYFLAGS@ -I$(top_srcdir)/idl -I$(top_builddir)/idl -I$(KERNEL_ROOT_DIR)/idl/salome -I$(GEOM_ROOT_DIR)/idl/salome -I$(MED_ROOT_DIR)/idl/salome OMNIORB_IDLPYFLAGS = @OMNIORB_IDLPYFLAGS@ -I$(top_srcdir)/idl -I$(top_builddir)/idl/salome \
-I$(KERNEL_ROOT_DIR)/idl/salome -I$(GEOM_ROOT_DIR)/idl/salome -I$(MED_ROOT_DIR)/idl/salome
OMNIORB_IDL_CLN_H = @OMNIORB_IDL_CLN_H@ OMNIORB_IDL_CLN_H = @OMNIORB_IDL_CLN_H@
OMNIORB_IDL_CLN_CXX = @OMNIORB_IDL_CLN_CXX@ OMNIORB_IDL_CLN_CXX = @OMNIORB_IDL_CLN_CXX@
@ -144,7 +149,8 @@ CORBA_INCLUDES = @CORBA_INCLUDES@
CORBA_LIBS = @CORBA_LIBS@ CORBA_LIBS = @CORBA_LIBS@
CORBA_CXXFLAGS = @CORBA_CXXFLAGS@ CORBA_CXXFLAGS = @CORBA_CXXFLAGS@
IDLCXXFLAGS = -bcxx @IDLCXXFLAGS@ -I$(top_srcdir)/idl -I$(top_builddir)/idl -I$(KERNEL_ROOT_DIR)/idl/salome -I$(GEOM_ROOT_DIR)/idl/salome -I$(MED_ROOT_DIR)/idl/salome IDLCXXFLAGS = -bcxx @IDLCXXFLAGS@ -I$(top_srcdir)/idl -I$(top_builddir)/idl/salome \
-I$(KERNEL_ROOT_DIR)/idl/salome -I$(GEOM_ROOT_DIR)/idl/salome -I$(MED_ROOT_DIR)/idl/salome
IDLPYFLAGS = @IDLPYFLAGS@ IDLPYFLAGS = @IDLPYFLAGS@
IDL = @IDL@ IDL = @IDL@
@ -195,13 +201,13 @@ datadir=@datadir@/salome
idldir=$(prefix)/idl/salome idldir=$(prefix)/idl/salome
sharedpydir=@libdir@/python$(PYTHON_VERSION)/site-packages/salome/shared_modules sharedpydir=@libdir@/python$(PYTHON_VERSION)/site-packages/salome/shared_modules
docdir=$(datadir)/doc docdir=${prefix}/doc/salome
# #
# begin of package rules # begin of package rules
# #
.PHONY: all lib bin inc resources tests install uninstall dep depend depend_idl cleandep mostlyclean clean distclean .PHONY: all lib bin inc resources docs tests install uninstall dep depend depend_idl cleandep mostlyclean clean distclean
.SUFFIXES: .cxx .cc .c .f .o .lo .idl .py .i .ui .po .qm .SUFFIXES: .cxx .cc .c .f .o .lo .idl .py .i .ui .po .qm
@ -243,11 +249,7 @@ ac_cxx_namespaces.m4 check_omniorb.m4 pyembed.m4 \
ac_cxx_partial_specialization.m4 check_opengl.m4 python.m4 \ ac_cxx_partial_specialization.m4 check_opengl.m4 python.m4 \
ac_cxx_typename.m4 check_pthreads.m4 check_cas.m4 \ ac_cxx_typename.m4 check_pthreads.m4 check_cas.m4 \
ac_cc_warnings.m4 check_qt.m4 check_med2.m4 \ ac_cc_warnings.m4 check_qt.m4 check_med2.m4 \
check_swig.m4 check_swig.m4 check_boost.m4
#ifeq (@WITHNETGEN@,yes)
# ACLOCAL_SRC += check_Netgen.m4
#endif
$(top_srcdir)/aclocal.m4: $(ACLOCAL_SRC:%=@KERNEL_ROOT_DIR@/salome_adm/unix/config_files/%) $(top_srcdir)/aclocal.m4: $(ACLOCAL_SRC:%=@KERNEL_ROOT_DIR@/salome_adm/unix/config_files/%)
cd $(top_srcdir) ; aclocal --acdir=adm_local/unix/config_files -I @KERNEL_ROOT_DIR@/salome_adm/unix/config_files cd $(top_srcdir) ; aclocal --acdir=adm_local/unix/config_files -I @KERNEL_ROOT_DIR@/salome_adm/unix/config_files

View File

@ -1,2 +1,2 @@
THIS IS SALOME - SMESH VERSION: 1.4.0 THIS IS SALOME - SMESH VERSION: 1.4.1

View File

@ -113,6 +113,14 @@ dnl
AC_CXX_HAVE_SSTREAM AC_CXX_HAVE_SSTREAM
echo
echo ---------------------------------------------
echo BOOST Library
echo ---------------------------------------------
echo
CHECK_BOOST
dnl dnl
dnl --------------------------------------------- dnl ---------------------------------------------
dnl testing MPICH dnl testing MPICH
@ -273,14 +281,6 @@ echo
CHECK_MED CHECK_MED
echo
echo ---------------------------------------------
echo Testing Netgen
echo ---------------------------------------------
echo
CHECK_NETGEN
echo echo
echo --------------------------------------------- echo ---------------------------------------------
echo Summary echo Summary
@ -288,7 +288,7 @@ echo ---------------------------------------------
echo echo
echo Configure echo Configure
variables="cc_ok lex_yacc_ok python_ok swig_ok threads_ok OpenGL_ok qt_ok vtk_ok hdf5_ok med2_ok omniORB_ok occ_ok doxygen_ok graphviz_ok Kernel_ok Geom_ok Med_ok Netgen_ok" variables="cc_ok boost_ok lex_yacc_ok python_ok swig_ok threads_ok OpenGL_ok qt_ok vtk_ok hdf5_ok med2_ok omniORB_ok occ_ok doxygen_ok graphviz_ok Kernel_ok Geom_ok Med_ok"
for var in $variables for var in $variables
do do
@ -318,7 +318,7 @@ else
fi fi
# make other build directories # 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 for rep in salome_adm adm_local doc bin/salome include/salome lib/salome share/salome/resources idl
do do
# if test ! -d $rep ; then # if test ! -d $rep ; then
# eval mkdir $rep # eval mkdir $rep
@ -351,14 +351,15 @@ dnl copy shells and utilities contained in the bin directory
dnl excluding .in files (treated in AC-OUTPUT below) and CVS dnl excluding .in files (treated in AC-OUTPUT below) and CVS
dnl directory dnl directory
cd bin mkdir -p bin/salome
cd bin/salome
for i in $ROOT_SRCDIR/bin/* for i in $ROOT_SRCDIR/bin/*
do do
local_bin=`echo $i | sed -e "s,$ROOT_SRCDIR,.,"` local_bin=`echo $i | sed -e "s,$ROOT_SRCDIR,.,"`
case "$local_bin" in case "$local_bin" in
*.in | *~) ;; *.in | *~) ;;
./bin/CVS) ;; ./bin/CVS | ./bin/salome) ;;
*) ln -fs $i; echo $local_bin ;; *) /usr/bin/install -C $i .; echo $local_bin ;;
esac esac
done done
cd $ROOT_BUILDDIR cd $ROOT_BUILDDIR

View File

@ -11,9 +11,11 @@ top_builddir=..
srcdir=@srcdir@ srcdir=@srcdir@
VPATH=.:@srcdir@ VPATH=.:@srcdir@
SUBDIRS=html SUBDIRS= salome
doc: @COMMENCE@
docs:
@@SETX@; for d in $(SUBDIRS); do \ @@SETX@; for d in $(SUBDIRS); do \
(cd $$d && $(MAKE) $@) || exit 1; \ (cd $$d && $(MAKE) $@) || exit 1; \
done done
@ -31,3 +33,8 @@ install:
@@SETX@; for d in $(SUBDIRS); do \ @@SETX@; for d in $(SUBDIRS); do \
(cd $$d && $(MAKE) $@) || exit 1; \ (cd $$d && $(MAKE) $@) || exit 1; \
done done
uninstall:
@@SETX@; for d in $(SUBDIRS); do \
(cd $$d && $(MAKE) $@) || exit 1; \
done

View File

@ -6,7 +6,7 @@
top_srcdir=@top_srcdir@ top_srcdir=@top_srcdir@
top_builddir=.. top_builddir=..
srcdir=@srcdir@ srcdir=@srcdir@
VPATH=.:$(srcdir):${KERNEL_ROOT_DIR}/idl/salome:${GEOM_ROOT_DIR}/idl/salome:${MED_ROOT_DIR}/idl/salome VPATH=.:${KERNEL_ROOT_DIR}/idl/salome:${GEOM_ROOT_DIR}/idl/salome:${MED_ROOT_DIR}/idl/salome
@COMMENCE@ @COMMENCE@
@ -14,16 +14,21 @@ IDL_FILES = \
SMESH_Gen.idl \ SMESH_Gen.idl \
SMESH_Mesh.idl \ SMESH_Mesh.idl \
SMESH_Hypothesis.idl \ SMESH_Hypothesis.idl \
SMESH_BasicHypothesis.idl SMESH_BasicHypothesis.idl \
SMESH_Filter.idl \
SMESH_Group.idl
PY_CLIENT_IDL = $(IDL_FILES) PY_CLIENT_IDL = $(IDL_FILES)
# we copy all idl file in $(top_builddir)/idl # we copy all idl file in $(top_builddir)/idl
inc: $(IDL_FILES:%=$(top_builddir)/idl/%) inc: $(top_builddir)/idl/salome $(IDL_FILES:%=$(top_builddir)/idl/salome/%)
$(IDL_FILES:%=$(top_builddir)/idl/%):$(top_builddir)/idl/%:% $(top_builddir)/idl/salome:
mkdir $@
$(IDL_FILES:%=$(top_builddir)/idl/salome/%):$(IDL_FILES:%=$(top_srcdir)/idl/%)
# $(CP) $< $@ # $(CP) $< $@
cp -f $< $@ cp -f $^ $(top_builddir)/idl/salome
lib: pyidl lib: pyidl
@ -35,7 +40,7 @@ pyidl: $(PYTHON_BUILD_SITE) $(IDL_FILES:%.idl=$(PYTHON_BUILD_SITE)/%_idl.py)
$(PYTHON_BUILD_SITE): $(PYTHON_BUILD_SITE):
$(INSTALL) -d $@ $(INSTALL) -d $@
$(PYTHON_BUILD_SITE)/%_idl.py: %.idl $(PYTHON_BUILD_SITE)/%_idl.py: $(top_builddir)/idl/salome/%.idl
$(OMNIORB_IDL) $(OMNIORB_IDLPYFLAGS) -C$(PYTHON_BUILD_SITE) $< $(OMNIORB_IDL) $(OMNIORB_IDLPYFLAGS) -C$(PYTHON_BUILD_SITE) $<
@ -43,12 +48,12 @@ $(PYTHON_BUILD_SITE)/%_idl.py: %.idl
install: install-pyidl install-idl install: install-pyidl install-idl
# create directory $(idldir) and copy idl files into it # create directory $(idldir) and copy idl files into it
install-idl: $(IDL_FILES) install-idl: $(IDL_FILES:%=$(top_builddir)/idl/salome/%)
$(INSTALL) -d $(idldir) $(INSTALL) -d $(idldir)
$(INSTALL_DATA) $^ $(idldir) $(INSTALL_DATA) $^ $(idldir)
install-pyidl: $(IDL_FILES) install-pyidl: $(IDL_FILES:%=$(top_builddir)/idl/salome/%)
$(INSTALL) -d $(PYTHON_SITE_INSTALL) $(INSTALL) -d $(PYTHON_SITE_INSTALL)
@for file in $^ dummy; do \ @for file in $^ dummy; do \
if [ $$file != "dummy" ]; then \ if [ $$file != "dummy" ]; then \
@ -63,6 +68,6 @@ cleandep:
distclean: distclean:
-$(RM) *.py -$(RM) *.py
-$(RM) $(IDL_FILES:%=$(top_builddir)/idl/%) -$(RM) $(IDL_FILES:%=$(top_builddir)/idl/salome/%)
-$(RM) Makefile -$(RM) Makefile

View File

@ -30,67 +30,142 @@
#include "SMESH_Hypothesis.idl" #include "SMESH_Hypothesis.idl"
module SMESH /*!
* StdMeshers: interfaces to standard hypotheses and algorithms
*/
module StdMeshers
{ {
interface SMESH_LocalLength : SMESH_Hypothesis /*!
* StdMeshers_LocalLength: interface of "Average length" hypothesis
*/
interface StdMeshers_LocalLength : SMESH::SMESH_Hypothesis
{ {
/*!
* Sets <length> parameter value
*/
void SetLength(in double length) void SetLength(in double length)
raises (SALOME::SALOME_Exception); raises (SALOME::SALOME_Exception);
/*!
* Returns <length> parameter value
*/
double GetLength(); double GetLength();
}; };
interface SMESH_NumberOfSegments : SMESH_Hypothesis /*!
* StdMeshers_NumberOfSegments: interface of "Nb. Segments" hypothesis
*/
interface StdMeshers_NumberOfSegments : SMESH::SMESH_Hypothesis
{ {
/*!
* Sets <number of segments> parameter value
*/
void SetNumberOfSegments(in long segmentsNumber) void SetNumberOfSegments(in long segmentsNumber)
raises (SALOME::SALOME_Exception); raises (SALOME::SALOME_Exception);
/*!
* Returns <number of segments> parameter value
*/
long GetNumberOfSegments(); long GetNumberOfSegments();
/*!
* Sets <scale factor> parameter value
*/
void SetScaleFactor(in double scaleFactor) void SetScaleFactor(in double scaleFactor)
raises (SALOME::SALOME_Exception); raises (SALOME::SALOME_Exception);
/*!
* Returns <scale factor> parameter value
*/
double GetScaleFactor(); double GetScaleFactor();
}; };
interface SMESH_MaxElementArea : SMESH_Hypothesis /*!
* StdMeshers_MaxElementArea: interface of "Max. Triangle Area" hypothesis
*/
interface StdMeshers_MaxElementArea : SMESH::SMESH_Hypothesis
{ {
/*!
* Sets <maximum element area> parameter value
*/
void SetMaxElementArea(in double area) void SetMaxElementArea(in double area)
raises (SALOME::SALOME_Exception); raises (SALOME::SALOME_Exception);
/*!
* Returns <maximum element area> parameter value
*/
double GetMaxElementArea(); double GetMaxElementArea();
}; };
interface SMESH_LengthFromEdges : SMESH_Hypothesis /*!
* StdMeshers_LengthFromEdges: interface of "Length From Edges (2D Hyp. for Triangulator)" hypothesis
*/
interface StdMeshers_LengthFromEdges : SMESH::SMESH_Hypothesis
{ {
/*!
* Sets <mode> parameter value
*/
void SetMode(in long mode) void SetMode(in long mode)
raises (SALOME::SALOME_Exception); raises (SALOME::SALOME_Exception);
/*!
* Returns <mode> parameter value
*/
long GetMode(); long GetMode();
}; };
interface SMESH_MaxElementVolume : SMESH_Hypothesis /*!
* StdMeshers_MaxElementVolume: interface of "Max. Hexahedron or Tetrahedron Volume" hypothesis
*/
interface StdMeshers_MaxElementVolume : SMESH::SMESH_Hypothesis
{ {
/*!
* Sets <maximum element volume> parameter value
*/
void SetMaxElementVolume(in double volume) void SetMaxElementVolume(in double volume)
raises (SALOME::SALOME_Exception); raises (SALOME::SALOME_Exception);
/*!
* Returns <maximum element volume> parameter value
*/
double GetMaxElementVolume(); double GetMaxElementVolume();
}; };
interface SMESH_Regular_1D : SMESH_1D_Algo /*!
* StdMeshers_NotConformAllowed: interface of "Not Conform Mesh Allowed" hypothesis.
* Presence of this hypothesis permits to algorithm generation of not conform mesh.
*/
interface StdMeshers_NotConformAllowed : SMESH::SMESH_Hypothesis
{ {
}; };
interface SMESH_MEFISTO_2D : SMESH_2D_Algo /*!
* StdMeshers_Regular_1D: interface of "Wire discretisation" algorithm
*/
interface StdMeshers_Regular_1D : SMESH::SMESH_1D_Algo
{ {
}; };
interface SMESH_Quadrangle_2D : SMESH_2D_Algo /*!
* StdMeshers_MEFISTO_2D: interface of "Triangle (Mefisto)" algorithm
*/
interface StdMeshers_MEFISTO_2D : SMESH::SMESH_2D_Algo
{ {
}; };
interface SMESH_Hexa_3D : SMESH_3D_Algo /*!
* StdMeshers_Quadrangle_2D: interface of "Quadrangle (Mapping)" algorithm
*/
interface StdMeshers_Quadrangle_2D : SMESH::SMESH_2D_Algo
{ {
}; };
#ifdef HAVE_NETGEN /*!
interface SMESH_NETGEN_3D : SMESH_3D_Algo * StdMeshers_Hexa_3D: interface of "Hexahedron (i,j,k)" algorithm
*/
interface StdMeshers_Hexa_3D : SMESH::SMESH_3D_Algo
{ {
}; };
#endif
}; };

View File

@ -39,19 +39,35 @@
module SMESH module SMESH
{ {
typedef sequence<GEOM::GEOM_Shape> shape_array; typedef sequence<GEOM::GEOM_Shape> shape_array;
typedef sequence<SMESH_Mesh> mesh_array;
interface FilterManager;
interface SMESH_Gen : Engines::Component, SALOMEDS::Driver interface SMESH_Gen : Engines::Component, SALOMEDS::Driver
{ {
FilterManager CreateFilterManager();
/*! /*!
* Create an hypothesis that can be shared by differents parts of the mesh. Set the current study
*/
void SetCurrentStudy( in SALOMEDS::Study theStudy );
/*!
Get the current study
*/
SALOMEDS::Study GetCurrentStudy();
/*!
* Create a hypothesis that can be shared by differents parts of the mesh.
* An hypothesis is either: * An hypothesis is either:
* - a method used to generate or modify a part of the mesh (algorithm). * - a method used to generate or modify a part of the mesh (algorithm).
* - a parameter or a law used by an algorithm. * - a parameter or a law used by an algorithm.
* Algorithms are 1D, 2D or 3D. * Algorithms are 1D, 2D or 3D.
*/ */
SMESH_Hypothesis CreateHypothesis( in string anHyp, SMESH_Hypothesis CreateHypothesis( in string theHypName,
in long studyId) in string theLibName )
raises (SALOME::SALOME_Exception); raises ( SALOME::SALOME_Exception );
/*! /*!
* Create a Mesh object, given a geometry shape. * Create a Mesh object, given a geometry shape.
@ -60,49 +76,51 @@ module SMESH
* of TopoDS_Shapes and bind CORBA references of shape & subshapes * of TopoDS_Shapes and bind CORBA references of shape & subshapes
* with TopoDS_Shapes * with TopoDS_Shapes
*/ */
SMESH_Mesh Init(in GEOM::GEOM_Gen geomEngine, SMESH_Mesh CreateMesh( in GEOM::GEOM_Shape theShape )
in long studyId, raises ( SALOME::SALOME_Exception );
in GEOM::GEOM_Shape aShape)
raises (SALOME::SALOME_Exception); /*!
* Create Mesh object(s) importing data from given MED file
*/
mesh_array CreateMeshesFromMED( in string theFileName,
out SMESH::DriverMED_ReadStatus theStatus )
raises ( SALOME::SALOME_Exception );
/*! /*!
* Create a Mesh object, without a geometry shape reference * Create a Mesh object, without a geometry shape reference
*/ */
// SMESH_Mesh NewEmpty(in GEOM::GEOM_Gen geomEngine, // SMESH_Mesh NewEmpty()
// in long studyId) // raises ( SALOME::SALOME_Exception );
// raises (SALOME::SALOME_Exception);
/*! /*!
* Mesh a subShape. * Mesh a subShape.
* First, verify list of hypothesis associated with the subShape, * First, verify list of hypothesis associated with the subShape,
* return NOK if hypothesis are not sufficient * return NOK if hypothesis are not sufficient
*/ */
boolean Compute(in SMESH_Mesh aMesh, in GEOM::GEOM_Shape aSubShape) boolean Compute( in SMESH_Mesh theMesh,
raises (SALOME::SALOME_Exception); in GEOM::GEOM_Shape theSubShape )
raises ( SALOME::SALOME_Exception );
/*! /*!
* *
*/ */
boolean IsReadyToCompute(in SMESH_Mesh aMesh, in GEOM::GEOM_Shape aSubShape) boolean IsReadyToCompute( in SMESH_Mesh theMesh,
raises (SALOME::SALOME_Exception); in GEOM::GEOM_Shape theSubShape )
raises ( SALOME::SALOME_Exception );
/*! /*!
* *
*/ */
long_array GetSubShapesId(in GEOM::GEOM_Gen geomEngine, long_array GetSubShapesId( in GEOM::GEOM_Shape theMainShape,
in long studyId, in shape_array theListOfSubShape )
in GEOM::GEOM_Shape mainShape, raises ( SALOME::SALOME_Exception );
in shape_array listOfSubShape)
raises (SALOME::SALOME_Exception);
/*! /*!
* *
*/ */
// long_array GetSubMeshesState(in GEOM::GEOM_Gen geomEngine, // long_array GetSubMeshesState( in shape_array theListOfSubShape )
// in long studyId, // raises ( SALOME::SALOME_Exception );
// in shape_array listOfSubShape)
// raises (SALOME::SALOME_Exception);
}; };

View File

@ -27,26 +27,29 @@
#define _SMESH_HYPOTHESIS_IDL_ #define _SMESH_HYPOTHESIS_IDL_
#include "SALOME_Exception.idl" #include "SALOME_Exception.idl"
#include "SALOME_GenericObj.idl"
module SMESH module SMESH
{ {
interface SMESH_Hypothesis; interface SMESH_Hypothesis : SALOME::GenericObj
typedef sequence<SMESH_Hypothesis> ListOfHypothesis;
typedef sequence<string> ListOfHypothesisName;
interface SMESH_Hypothesis
{ {
/*! /*!
* Get the Hypothesis typeName * Get the Hypothesis typeName
*/ */
string GetName(); string GetName();
/*!
* Get the Hypothesis plugin library Name
*/
string GetLibName();
/*! /*!
* Get the internal Id * Get the internal Id
*/ */
long GetId(); long GetId();
}; };
typedef sequence<string> ListOfHypothesisName;
interface SMESH_Algo : SMESH_Hypothesis interface SMESH_Algo : SMESH_Hypothesis
{ {

View File

@ -27,13 +27,30 @@
#define _SMESH_MESH_IDL_ #define _SMESH_MESH_IDL_
#include "SALOME_Exception.idl" #include "SALOME_Exception.idl"
#include "SMESH_Hypothesis.idl" //#include "SMESH_Hypothesis.idl"
#include "SALOME_GenericObj.idl"
//#include "GEOM_Shape.idl"
//#include "MED.idl"
module GEOM
{
interface GEOM_Shape;
};
module SALOME_MED
{
interface MESH;
interface FAMILY;
};
#include "GEOM_Shape.idl"
#include "MED.idl"
module SMESH module SMESH
{ {
interface SMESH_Hypothesis;
typedef sequence<SMESH_Hypothesis> ListOfHypothesis;
typedef sequence<double> double_array ; typedef sequence<double> double_array ;
typedef sequence<long> long_array ; typedef sequence<long> long_array ;
typedef sequence<string> string_array ; typedef sequence<string> string_array ;
@ -59,12 +76,56 @@ module SMESH
double_array coords; double_array coords;
long_array indexes; long_array indexes;
}; };
/*!
* Enumeration for element type, like in SMDS
*/
enum ElementType
{
ALL,
NODE,
EDGE,
FACE,
VOLUME
};
/*!
* Enumeration for hypothesis status (used by AddHypothesis() and RemoveHypothesis() methods)
*/
enum Hypothesis_Status // in the order of severity
{
HYP_OK,
HYP_MISSING, // algo misses a hypothesis
HYP_CONCURENT, // several applicable hypotheses
HYP_BAD_PARAMETER,// hypothesis has a bad parameter value
HYP_UNKNOWN_FATAL,// --- all statuses below should be considered as fatal
// for Add/RemoveHypothesis operations
HYP_INCOMPATIBLE, // hypothesis does not fit algo
HYP_NOTCONFORM, // not conform mesh is produced appling a hypothesis
HYP_ALREADY_EXIST,// such hypothesis already exist
HYP_BAD_DIM // bad dimension
};
/*!
* Enumeration for DriverMED read status (used by ImportMEDFile() method)
*/
enum DriverMED_ReadStatus // in the order of severity
{
DRS_OK,
DRS_EMPTY, // a MED file contains no mesh with the given name
DRS_WARN_RENUMBER, // a MED file has overlapped ranges of element numbers,
// so the numbers from the file are ignored
DRS_WARN_SKIP_ELEM, // some elements were skipped due to incorrect file data
DRS_FAIL // general failure (exception etc.)
};
typedef sequence<log_block> log_array; typedef sequence<log_block> log_array;
interface SMESH_Group;
interface SMESH_subMesh; interface SMESH_subMesh;
interface SMESH_MeshEditor; interface SMESH_MeshEditor;
interface SMESH_Mesh interface SMESH_Mesh : SALOME::GenericObj
{ {
/*! /*!
* Associate a Shape to a Mesh created with NewEmpty * Associate a Shape to a Mesh created with NewEmpty
@ -79,7 +140,7 @@ module SMESH
* SubMesh will be used instead of SubShape in a next idl version to * SubMesh will be used instead of SubShape in a next idl version to
* adress a specific subMesh... * adress a specific subMesh...
*/ */
SMESH_subMesh GetElementsOnShape(in GEOM::GEOM_Shape aSubShape) SMESH_subMesh GetSubMesh(in GEOM::GEOM_Shape aSubShape, in string name)
raises (SALOME::SALOME_Exception); raises (SALOME::SALOME_Exception);
/*! /*!
@ -88,6 +149,25 @@ module SMESH
// SMESH_subMesh NewEmpty() // SMESH_subMesh NewEmpty()
// raises (SALOME::SALOME_Exception); // raises (SALOME::SALOME_Exception);
/*!
* Remove a submesh
*/
void RemoveSubMesh(in SMESH_subMesh aSubMesh)
raises (SALOME::SALOME_Exception);
/*!
* Create a group
*/
SMESH_Group CreateGroup( in ElementType elem_type,
in string name )
raises (SALOME::SALOME_Exception);
/*!
* Remove a group
*/
void RemoveGroup(in SMESH_Group aGroup)
raises (SALOME::SALOME_Exception);
/*! /*!
* Add hypothesis to the mesh, under a particular subShape * Add hypothesis to the mesh, under a particular subShape
* (or the main shape itself) * (or the main shape itself)
@ -105,7 +185,8 @@ module SMESH
* (or one previous hypothesis on the subShape) * (or one previous hypothesis on the subShape)
* raises exception if hypothesis has not been created * raises exception if hypothesis has not been created
*/ */
boolean AddHypothesis(in GEOM::GEOM_Shape aSubShape, in SMESH_Hypothesis anHyp) Hypothesis_Status AddHypothesis(in GEOM::GEOM_Shape aSubShape,
in SMESH_Hypothesis anHyp)
raises (SALOME::SALOME_Exception); raises (SALOME::SALOME_Exception);
// boolean AddHypothesis(in SMESH_subMesh aSubMesh, in SMESH_Hypothesis anHyp) // boolean AddHypothesis(in SMESH_subMesh aSubMesh, in SMESH_Hypothesis anHyp)
// raises (SALOME::SALOME_Exception); // raises (SALOME::SALOME_Exception);
@ -114,8 +195,8 @@ module SMESH
/*! /*!
* Remove an hypothesis previouly added with AddHypothesis. * Remove an hypothesis previouly added with AddHypothesis.
*/ */
boolean RemoveHypothesis(in GEOM::GEOM_Shape aSubShape, Hypothesis_Status RemoveHypothesis(in GEOM::GEOM_Shape aSubShape,
in SMESH_Hypothesis anHyp) in SMESH_Hypothesis anHyp)
raises (SALOME::SALOME_Exception); raises (SALOME::SALOME_Exception);
// boolean RemoveHypothesis(in SMESH_subMesh aSubMesh, // boolean RemoveHypothesis(in SMESH_subMesh aSubMesh,
// in SMESH_Hypothesis anHyp) // in SMESH_Hypothesis anHyp)
@ -165,7 +246,7 @@ module SMESH
*/ */
void ExportDAT( in string file ) void ExportDAT( in string file )
raises (SALOME::SALOME_Exception); raises (SALOME::SALOME_Exception);
void ExportMED( in string file ) void ExportMED( in string file, in boolean auto_groups )
raises (SALOME::SALOME_Exception); raises (SALOME::SALOME_Exception);
void ExportUNV( in string file ) void ExportUNV( in string file )
raises (SALOME::SALOME_Exception); raises (SALOME::SALOME_Exception);
@ -200,11 +281,19 @@ module SMESH
long NbHexas() long NbHexas()
raises (SALOME::SALOME_Exception); raises (SALOME::SALOME_Exception);
long NbPyramids()
raises (SALOME::SALOME_Exception);
long NbPrisms()
raises (SALOME::SALOME_Exception);
long NbSubMesh() long NbSubMesh()
raises (SALOME::SALOME_Exception); raises (SALOME::SALOME_Exception);
string Dump();
}; };
interface SMESH_subMesh interface SMESH_subMesh : SALOME::GenericObj
{ {
/*! /*!
* *
@ -224,6 +313,12 @@ module SMESH
long_array GetElementsId() long_array GetElementsId()
raises (SALOME::SALOME_Exception); raises (SALOME::SALOME_Exception);
/*!
*
*/
long_array GetElementsByType( in ElementType theType )
raises (SALOME::SALOME_Exception);
/*! /*!
* *
*/ */

View File

@ -17,7 +17,7 @@
<submenu label-id="Import" item-id="11" pos-id="8"> <submenu label-id="Import" item-id="11" pos-id="8">
<popup-item item-id="111" pos-id="" label-id="DAT file" icon-id="" tooltip-id="" accel-id="Ctrl+B" toggle-id="" execute-action=""/> <popup-item item-id="111" pos-id="" label-id="DAT file" icon-id="" tooltip-id="" accel-id="Ctrl+B" toggle-id="" execute-action=""/>
<popup-item item-id="112" pos-id="" label-id="UNV File" icon-id="" tooltip-id="" accel-id="Ctrl+I" toggle-id="" execute-action=""/> <popup-item item-id="112" pos-id="" label-id="UNV File" icon-id="" tooltip-id="" accel-id="Ctrl+I" toggle-id="" execute-action=""/>
<popup-item item-id="113" pos-id="" label-id="MED File" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <popup-item item-id="113" pos-id="" label-id="MED File" icon-id="" tooltip-id="" accel-id="Ctrl+M" toggle-id="" execute-action=""/>
</submenu> </submenu>
<endsubmenu /> <endsubmenu />
<submenu label-id="Export" item-id="12" pos-id="9"> <submenu label-id="Export" item-id="12" pos-id="9">
@ -37,37 +37,34 @@
<!-- ************************** Hypothesis (menubar) ************************************ --> <!-- ************************** Hypothesis (menubar) ************************************ -->
<menu-item label-id="Hypotheses" item-id="50" pos-id="3"> <menu-item label-id="Hypotheses" item-id="50" pos-id="3">
<popup-item item-id="5030" pos-id="" label-id="Average length" icon-id="mesh_hypo_length.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <popup-item item-id="5000" pos-id="" label-id="Create Hypotheses" icon-id="mesh_hypo_length.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="5031" pos-id="" label-id="Nb. Segments" icon-id="mesh_hypo_segment.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <popup-item item-id="5010" pos-id="" label-id="Create Algorithms" icon-id="mesh_algo_mefisto.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="5032" pos-id="" label-id="Max. Triangle Area" icon-id="mesh_hypo_area.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="5033" pos-id="" label-id="Max. Hexahedron or Tetrahedron Volume" icon-id="mesh_hypo_volume.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="5034" pos-id="" label-id="Length From Edges (2D Hyp. for Triangulator)" icon-id="mesh_hypo_length.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/>
<popup-item item-id="5000" pos-id="" label-id="Wire discretisation" icon-id="mesh_algo_regular.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="5010" pos-id="" label-id="Triangle (Mefisto)" icon-id="mesh_algo_mefisto.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="5011" pos-id="" label-id="Quadrangle (Mapping)" icon-id="mesh_algo_quad.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="5020" pos-id="" label-id="Hexahedron (i,j,k)" icon-id="mesh_algo_hexa.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="5021" pos-id="" label-id="Tetrahedron (Netgen)" icon-id="mesh_algo_tetra.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</menu-item> </menu-item>
<!-- ************************** Mesh (menubar) ************************************ --> <!-- ************************** Mesh (menubar) ************************************ -->
<menu-item label-id="Mesh" item-id="70" pos-id="4"> <menu-item label-id="Mesh" item-id="70" pos-id="4">
<popup-item item-id="703" pos-id="" label-id="Global Hyp." icon-id="mesh_init.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <popup-item item-id="703" pos-id="" label-id="Global Hypothesis" icon-id="mesh_init.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="702" pos-id="" label-id="Local Hyp." icon-id="mesh_add_sub.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <popup-item item-id="702" pos-id="" label-id="Local Hypothesis" icon-id="mesh_add_sub.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="704" pos-id="" label-id="Edit Hyp." icon-id="mesh_edit.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <popup-item item-id="704" pos-id="" label-id="Edit Hypothesis" icon-id="mesh_edit.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/> <separator pos-id=""/>
<popup-item item-id="701" pos-id="" label-id="Compute" icon-id="mesh_compute.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <popup-item item-id="701" pos-id="" label-id="Compute" icon-id="mesh_compute.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/> <separator pos-id=""/>
<popup-item item-id="801" pos-id="" label-id="Create Group" icon-id="mesh_tree_group.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="802" pos-id="" label-id="Construct Group" icon-id="mesh_make_group.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="803" pos-id="" label-id="Edit Group" icon-id="mesh_edit_group.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/>
<popup-item item-id="900" pos-id="" label-id="Mesh Infos" icon-id="mesh_info.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <popup-item item-id="900" pos-id="" label-id="Mesh Infos" icon-id="mesh_info.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</menu-item> </menu-item>
<!-- ************************** Control (menubar) ************************************ --> <!-- ************************** Control (menubar) ************************************ -->
<menu-item label-id="Controls" item-id="60" pos-id="5"> <menu-item label-id="Controls" item-id="60" pos-id="5">
<popup-item item-id="6001" pos-id="" label-id="Length" icon-id="mesh_length.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <popup-item item-id="6001" pos-id="" label-id="Length" icon-id="mesh_length.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="6002" pos-id="" label-id="Connectivity" icon-id="mesh_connectivity.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <popup-item item-id="6003" pos-id="" label-id="Free borders" icon-id="mesh_free_edges.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="6004" pos-id="" label-id="Borders at multi-connection" icon-id="mesh_multi_edges.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<!-- popup-item item-id="6002" pos-id="" label-id="Connectivity" icon-id="mesh_connectivity.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/ -->
<popup-item item-id="6011" pos-id="" label-id="Area" icon-id="mesh_area.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <popup-item item-id="6011" pos-id="" label-id="Area" icon-id="mesh_area.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="6012" pos-id="" label-id="Taper" icon-id="mesh_taper.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <popup-item item-id="6012" pos-id="" label-id="Taper" icon-id="mesh_taper.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="6013" pos-id="" label-id="Aspect Ratio" icon-id="mesh_aspect.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <popup-item item-id="6013" pos-id="" label-id="Aspect Ratio" icon-id="mesh_aspect.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="6014" pos-id="" label-id="Minimum angle" icon-id="mesh_angle.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <popup-item item-id="6014" pos-id="" label-id="Minimum angle" icon-id="mesh_angle.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="6015" pos-id="" label-id="Warp" icon-id="mesh_wrap.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <popup-item item-id="6015" pos-id="" label-id="Warp" icon-id="mesh_wrap.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="6016" pos-id="" label-id="Skew" icon-id="mesh_skew.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <popup-item item-id="6016" pos-id="" label-id="Skew" icon-id="mesh_skew.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
@ -90,30 +87,28 @@
</submenu> </submenu>
<endsubmenu /> <endsubmenu />
<popup-item item-id="405" pos-id="" label-id="Move Node" icon-id="mesh_move_node.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <popup-item item-id="405" pos-id="" label-id="Move Node" icon-id="mesh_move_node.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="806" pos-id="" label-id="Orientation" icon-id="mesh_orientation.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <popup-item item-id="406" pos-id="" label-id="Orientation" icon-id="mesh_orientation.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="807" pos-id="" label-id="Diagonal Inversion" icon-id="mesh_diagonal.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <popup-item item-id="407" pos-id="" label-id="Diagonal Inversion" icon-id="mesh_diagonal.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</menu-item>
<!-- ************************** Numbering (menubar) ************************************ -->
<menu-item label-id="Numbering" item-id="80" pos-id="7">
<popup-item item-id="9010" pos-id="" label-id="Display Nodes #" icon-id="" tooltip-id="" accel-id="" toggle-id="false" execute-action=""/>
<popup-item item-id="9011" pos-id="" label-id="Display Elements #" icon-id="" tooltip-id="" accel-id="" toggle-id="false" execute-action=""/>
</menu-item> </menu-item>
<!-- ********************************* Settings (menubar) ********************************* --> <!-- ********************************* Settings (menubar) ********************************* -->
<menu-item label-id="Preferences" item-id="4" pos-id=""> <menu-item label-id="Preferences" item-id="4" pos-id="">
<submenu label-id="Mesh" item-id="100" pos-id="-1"> <submenu label-id="Mesh" item-id="100" pos-id="-1">
<submenu label-id="Display Mode" item-id="1000" pos-id=""> <submenu label-id="Display Mode" item-id="1000" pos-id="">
<popup-item item-id="10001" pos-id="" label-id="Wireframe" icon-id="" tooltip-id="" accel-id="" toggle-id="false" execute-action=""/> <popup-item item-id="10001" pos-id="" label-id="Wireframe" icon-id="mesh_wireframe.png" tooltip-id="" accel-id="" toggle-id="false" execute-action=""/>
<popup-item item-id="10002" pos-id="" label-id="Shading" icon-id="" tooltip-id=""accel-id="" toggle-id="true" execute-action=""/> <popup-item item-id="10002" pos-id="" label-id="Shading" icon-id="mesh_shading.png" tooltip-id=""accel-id="" toggle-id="true" execute-action=""/>
<popup-item item-id="10003" pos-id="" label-id="Shrink" icon-id="" tooltip-id="" accel-id="" toggle-id="false" execute-action=""/> <popup-item item-id="10004" pos-id="" label-id="Nodes" icon-id="mesh_points.png" tooltip-id="" accel-id="" toggle-id="false" execute-action=""/>
<separator pos-id=""/>
<popup-item item-id="10003" pos-id="" label-id="Shrink" icon-id="mesh_shrink.png" tooltip-id="" accel-id="" toggle-id="false" execute-action=""/>
</submenu> </submenu>
<endsubmenu /> <endsubmenu />
<popup-item item-id="1001" pos-id="" label-id="Automatic Update" icon-id="" tooltip-id="" accel-id="" toggle-id="false" execute-action=""/> <popup-item item-id="1001" pos-id="" label-id="Automatic Update" icon-id="" tooltip-id="" accel-id="" toggle-id="false" execute-action=""/>
<separator pos-id=""/> <separator pos-id=""/>
<popup-item item-id="1003" pos-id="" label-id="Colors - Size" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <popup-item item-id="1003" pos-id="" label-id="Colors / Size" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/> <separator pos-id=""/>
<popup-item item-id="1005" pos-id="" label-id="Scalars Bar" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <popup-item item-id="1005" pos-id="" label-id="Scalar Bar" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/>
<popup-item item-id="1006" pos-id="" label-id="Selection" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</submenu> </submenu>
<endsubmenu /> <endsubmenu />
<separator pos-id="-1"/> <separator pos-id="-1"/>
@ -121,12 +116,6 @@
<!-- ********************************* View (menubar) ********************************* --> <!-- ********************************* View (menubar) ********************************* -->
<menu-item label-id="View" item-id="2" pos-id=""> <menu-item label-id="View" item-id="2" pos-id="">
<submenu label-id="Display Mode" item-id="21" pos-id="">
<popup-item item-id="211" pos-id="" label-id="Wireframe" icon-id="mesh_wireframe.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="212" pos-id="" label-id="Shading" icon-id="mesh_shading.png" tooltip-id=""accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="213" pos-id="" label-id="Shrink" icon-id="mesh_shrink.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</submenu>
<endsubmenu />
<separator pos-id=""/> <separator pos-id=""/>
<popup-item item-id="214" pos-id="" label-id="Update" icon-id="mesh_update.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <popup-item item-id="214" pos-id="" label-id="Update" icon-id="mesh_update.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</menu-item> </menu-item>
@ -134,83 +123,210 @@
<!-- ################################# POPUP MENU ################################# --> <!-- ################################# POPUP MENU ################################# -->
<popupmenu label-id="Popup for ObjectBrowser" context-id="" parent-id="ObjectBrowser" object-id="Mesh"> <popupmenu label-id="Popup for ObjectBrowser" context-id="" parent-id="ObjectBrowser" object-id="Mesh">
<popup-item item-id="705" pos-id="" label-id="Edit Global Hyp." icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <popup-item item-id="705" pos-id="" label-id="Edit Global Hypothesis" icon-id="mesh_edit.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/> <separator pos-id=""/>
<popup-item item-id="701" pos-id="" label-id="Compute" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <popup-item item-id="701" pos-id="" label-id="Compute" icon-id="mesh_compute.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="214" pos-id="" label-id="Update" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <popup-item item-id="214" pos-id="" label-id="Update" icon-id="mesh_update.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="900" pos-id="" label-id="Show Info" icon-id="mesh_info.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/>
<popup-item item-id="801" pos-id="" label-id="Create Group" icon-id="mesh_tree_group.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/> <separator pos-id=""/>
<popup-item item-id="1101" pos-id="" label-id="Rename" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <popup-item item-id="1101" pos-id="" label-id="Rename" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/>
<popup-item item-id="122" pos-id="" label-id="Export to MED" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</popupmenu> </popupmenu>
<popupmenu label-id="Popup for ObjectBrowser" context-id="" parent-id="ObjectBrowser" object-id="SubMesh"> <popupmenu label-id="Popup for ObjectBrowser" context-id="" parent-id="ObjectBrowser" object-id="SubMesh">
<popup-item item-id="706" pos-id="" label-id="Edit Local Hyp." icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <popup-item item-id="706" pos-id="" label-id="Edit Local Hypothesis" icon-id="mesh_edit.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/>
<popup-item item-id="214" pos-id="" label-id="Update" icon-id="mesh_update.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="900" pos-id="" label-id="Show Info" icon-id="mesh_info.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/>
<popup-item item-id="802" pos-id="" label-id="Construct Group" icon-id="mesh_make_group.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/>
<popup-item item-id="33" pos-id="" label-id="Delete" icon-id="delete.png" tooltip-id="" accel-id="" toggle-id="" execute-action="" />
</popupmenu>
<popupmenu label-id="Popup for ObjectBrowser" context-id="" parent-id="ObjectBrowser" object-id="Group">
<popup-item item-id="803" pos-id="" label-id="Edit" icon-id="mesh_edit_group.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/>
<popup-item item-id="214" pos-id="" label-id="Update" icon-id="mesh_update.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="900" pos-id="" label-id="Show Info" icon-id="mesh_info.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/>
<popup-item item-id="1101" pos-id="" label-id="Rename" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/>
<popup-item item-id="33" pos-id="" label-id="Delete" icon-id="delete.png" tooltip-id="" accel-id="" toggle-id="" execute-action="" />
</popupmenu> </popupmenu>
<popupmenu label-id="Popup for ObjectBrowser" context-id="" parent-id="ObjectBrowser" object-id="Hypothesis"> <popupmenu label-id="Popup for ObjectBrowser" context-id="" parent-id="ObjectBrowser" object-id="Hypothesis">
<popup-item item-id="1100" pos-id="" label-id="Edit" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <popup-item item-id="1100" pos-id="" label-id="Edit" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="1102" pos-id="" label-id="Unassign Hyp." icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <popup-item item-id="1102" pos-id="" label-id="Unassign Hypothesis" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="1101" pos-id="" label-id="Rename" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</popupmenu>
<popupmenu label-id="Popup for ObjectBrowser" context-id="" parent-id="ObjectBrowser" object-id="Algorithm">
<popup-item item-id="1102" pos-id="" label-id="Unassign Algo." icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="1101" pos-id="" label-id="Rename" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <popup-item item-id="1101" pos-id="" label-id="Rename" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</popupmenu> </popupmenu>
<popupmenu label-id="Popup for ObjectBrowser" context-id="" parent-id="ObjectBrowser" object-id="Algorithm">
<popup-item item-id="1102" pos-id="" label-id="Unassign Algorithm" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="1101" pos-id="" label-id="Rename" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</popupmenu>
<popupmenu label-id="Popup for Viewer" context-id="" parent-id="Viewer" object-id="Mesh"> <popupmenu label-id="Popup for Viewer" context-id="" parent-id="Viewer" object-id="Mesh">
<popup-item item-id="214" pos-id="" label-id="Update" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <popup-item item-id="214" pos-id="" label-id="Update" icon-id="mesh_update.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="900" pos-id="" label-id="Show Info" icon-id="mesh_info.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/> <separator pos-id=""/>
<submenu label-id="Properties" item-id="113" pos-id=""> <submenu label-id="Numbering" item-id="114" pos-id="">
<submenu label-id="Display Mode" item-id="1131" pos-id=""> <popup-item item-id="9010" pos-id="" label-id="Display Nodes #" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="211" pos-id="" label-id="Wireframe" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <popup-item item-id="9011" pos-id="" label-id="Display Elements #" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="212" pos-id="" label-id="Shading" icon-id="" tooltip-id=""accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="213" pos-id="" label-id="Shrink" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</submenu>
<endsubmenu />
<separator pos-id=""/>
<popup-item item-id="1132" pos-id="" label-id="Colors - Size" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="1133" pos-id="" label-id="Transparency" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</submenu> </submenu>
<endsubmenu /> <endsubmenu />
<separator pos-id=""/>
<submenu label-id="Display Mode" item-id="1131" pos-id="">
<popup-item item-id="211" pos-id="" label-id="Wireframe" icon-id="mesh_wireframe.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="212" pos-id="" label-id="Shading" icon-id="mesh_shading.png" tooltip-id=""accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="215" pos-id="" label-id="Nodes" icon-id="mesh_points.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/>
<popup-item item-id="213" pos-id="" label-id="Shrink" icon-id="mesh_shrink.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</submenu>
<endsubmenu />
<popup-item item-id="1132" pos-id="" label-id="Colors / Size" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="1133" pos-id="" label-id="Transparency" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/>
<submenu label-id="Control" item-id="2000" pos-id="">
<popup-item item-id="6001" pos-id="" label-id="Length" icon-id="mesh_length.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="6003" pos-id="" label-id="Free borders" icon-id="mesh_free_edges.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="6004" pos-id="" label-id="Borders at multi-connection" icon-id="mesh_multi_edges.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<!-- popup-item item-id="6002" pos-id="" label-id="Connectivity" icon-id="mesh_connectivity.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/ -->
<popup-item item-id="6011" pos-id="" label-id="Area" icon-id="mesh_area.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="6012" pos-id="" label-id="Taper" icon-id="mesh_taper.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="6013" pos-id="" label-id="Aspect Ratio" icon-id="mesh_aspect.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="6014" pos-id="" label-id="Minimum angle" icon-id="mesh_angle.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="6015" pos-id="" label-id="Warp" icon-id="mesh_wrap.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="6016" pos-id="" label-id="Skew" icon-id="mesh_skew.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/>
<popup-item item-id="200" pos-id="" label-id="Reset" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/>
<popup-item item-id="201" pos-id="" label-id="Scalar Bar Properties" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</submenu>
<endsubmenu />
<separator pos-id=""/>
</popupmenu> </popupmenu>
<popupmenu label-id="ScalarBar" context-id="" parent-id="Viewer" object-id="ScalarBar"> <popupmenu label-id="Popup for Viewer" context-id="" parent-id="Viewer" object-id="SubMesh">
<popup-item item-id="200" pos-id="" label-id="Erase" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <popup-item item-id="214" pos-id="" label-id="Update" icon-id="mesh_update.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="201" pos-id="" label-id="Edit" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <popup-item item-id="900" pos-id="" label-id="Show Info" icon-id="mesh_info.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="202" pos-id="" label-id="Update View" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <separator pos-id=""/>
<submenu label-id="Numbering" item-id="114" pos-id="">
<popup-item item-id="9010" pos-id="" label-id="Display Nodes #" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="9011" pos-id="" label-id="Display Elements #" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</submenu>
<endsubmenu />
<separator pos-id=""/>
<submenu label-id="Display Mode" item-id="1131" pos-id="">
<popup-item item-id="211" pos-id="" label-id="Wireframe" icon-id="mesh_wireframe.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="212" pos-id="" label-id="Shading" icon-id="mesh_shading.png" tooltip-id=""accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="215" pos-id="" label-id="Nodes" icon-id="mesh_points.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/>
<popup-item item-id="213" pos-id="" label-id="Shrink" icon-id="mesh_shrink.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</submenu>
<endsubmenu />
<popup-item item-id="1132" pos-id="" label-id="Colors / Size" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="1133" pos-id="" label-id="Transparency" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/>
<submenu label-id="Control" item-id="2000" pos-id="">
<popup-item item-id="6001" pos-id="" label-id="Length" icon-id="mesh_length.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="6003" pos-id="" label-id="Free borders" icon-id="mesh_free_edges.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="6004" pos-id="" label-id="Borders at multi-connection" icon-id="mesh_multi_edges.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<!-- popup-item item-id="6002" pos-id="" label-id="Connectivity" icon-id="mesh_connectivity.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/ -->
<popup-item item-id="6011" pos-id="" label-id="Area" icon-id="mesh_area.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="6012" pos-id="" label-id="Taper" icon-id="mesh_taper.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="6013" pos-id="" label-id="Aspect Ratio" icon-id="mesh_aspect.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="6014" pos-id="" label-id="Minimum angle" icon-id="mesh_angle.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="6015" pos-id="" label-id="Warp" icon-id="mesh_wrap.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="6016" pos-id="" label-id="Skew" icon-id="mesh_skew.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/>
<popup-item item-id="200" pos-id="" label-id="Reset" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/>
<popup-item item-id="201" pos-id="" label-id="Scalar Bar Properties" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</submenu>
<endsubmenu />
<separator pos-id=""/>
</popupmenu>
<popupmenu label-id="Popup for Viewer" context-id="" parent-id="Viewer" object-id="Group">
<popup-item item-id="803" pos-id="" label-id="Edit" icon-id="mesh_edit_group.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/>
<popup-item item-id="214" pos-id="" label-id="Update" icon-id="mesh_update.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="900" pos-id="" label-id="Show Info" icon-id="mesh_info.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/>
<submenu label-id="Numbering" item-id="114" pos-id="">
<popup-item item-id="9010" pos-id="" label-id="Display Nodes #" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="9011" pos-id="" label-id="Display Elements #" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</submenu>
<endsubmenu />
<separator pos-id=""/>
<submenu label-id="Display Mode" item-id="1131" pos-id="">
<popup-item item-id="211" pos-id="" label-id="Wireframe" icon-id="mesh_wireframe.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="212" pos-id="" label-id="Shading" icon-id="mesh_shading.png" tooltip-id=""accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="215" pos-id="" label-id="Nodes" icon-id="mesh_points.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/>
<popup-item item-id="213" pos-id="" label-id="Shrink" icon-id="mesh_shrink.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</submenu>
<endsubmenu />
<popup-item item-id="1132" pos-id="" label-id="Colors / Size" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="1133" pos-id="" label-id="Transparency" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/>
<submenu label-id="Control" item-id="2000" pos-id="">
<popup-item item-id="6001" pos-id="" label-id="Length" icon-id="mesh_length.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="6003" pos-id="" label-id="Free borders" icon-id="mesh_free_edges.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="6004" pos-id="" label-id="Borders at multi-connection" icon-id="mesh_multi_edges.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<!-- popup-item item-id="6002" pos-id="" label-id="Connectivity" icon-id="mesh_connectivity.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/ -->
<popup-item item-id="6011" pos-id="" label-id="Area" icon-id="mesh_area.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="6012" pos-id="" label-id="Taper" icon-id="mesh_taper.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="6013" pos-id="" label-id="Aspect Ratio" icon-id="mesh_aspect.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="6014" pos-id="" label-id="Minimum angle" icon-id="mesh_angle.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="6015" pos-id="" label-id="Warp" icon-id="mesh_wrap.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="6016" pos-id="" label-id="Skew" icon-id="mesh_skew.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/>
<popup-item item-id="200" pos-id="" label-id="Reset" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/>
<popup-item item-id="201" pos-id="" label-id="Scalar Bar Properties" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</submenu>
<endsubmenu />
<separator pos-id=""/>
</popupmenu>
<popupmenu label-id="Elements" context-id="" parent-id="Viewer" object-id="Elements">
<popup-item item-id="804" pos-id="" label-id="Add" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="805" pos-id="" label-id="Remove" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</popupmenu> </popupmenu>
</menubar> </menubar>
<!-- ///////////////////////////////////// TOOLBARS ////////////////////////////////////// --> <!-- ///////////////////////////////////// TOOLBARS ////////////////////////////////////// -->
<toolbar label-id="Mesh Toolbar"> <toolbar label-id="Mesh Toolbar">
<toolbutton-item item-id="703" pos-id="" label-id="Init" icon-id="mesh_init.png" tooltip-id="Global Hyp." accel-id="" toggle-id="" execute-action=""/> <toolbutton-item item-id="703" pos-id="" label-id="Init" icon-id="mesh_init.png" tooltip-id="Global Hypothesis" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="702" pos-id="" label-id="Add SubMesh" icon-id="mesh_add_sub.png" tooltip-id="Local Hyp." accel-id="" toggle-id="" execute-action=""/> <toolbutton-item item-id="702" pos-id="" label-id="Add SubMesh" icon-id="mesh_add_sub.png" tooltip-id="Local Hypothesis" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="704" pos-id="" label-id="Edit" icon-id="mesh_edit.png" tooltip-id="Edit Hyp." accel-id="" toggle-id="" execute-action=""/> <toolbutton-item item-id="704" pos-id="" label-id="Edit" icon-id="mesh_edit.png" tooltip-id="Edit Hypothesis" accel-id="" toggle-id="" execute-action=""/>
<separatorTB/> <separatorTB/>
<toolbutton-item item-id="701" pos-id="" label-id="Compute" icon-id="mesh_compute.png" tooltip-id="Compute" accel-id="" toggle-id="" execute-action=""/> <toolbutton-item item-id="701" pos-id="" label-id="Compute" icon-id="mesh_compute.png" tooltip-id="Compute" accel-id="" toggle-id="" execute-action=""/>
<separatorTB/> <separatorTB/>
<toolbutton-item item-id="801" pos-id="" label-id="Create Group" icon-id="mesh_tree_group.png" tooltip-id="Create Group" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="802" pos-id="" label-id="Construct Group" icon-id="mesh_make_group.png" tooltip-id="Construct Group" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="803" pos-id="" label-id="Edit Group" icon-id="mesh_edit_group.png" tooltip-id="Edit Group" accel-id="" toggle-id="" execute-action=""/>
<separatorTB/>
<toolbutton-item item-id="900" pos-id="" label-id="Mesh Infos" icon-id="mesh_info.png" tooltip-id="Mesh Infos" accel-id="" toggle-id="" execute-action=""/> <toolbutton-item item-id="900" pos-id="" label-id="Mesh Infos" icon-id="mesh_info.png" tooltip-id="Mesh Infos" accel-id="" toggle-id="" execute-action=""/>
</toolbar> </toolbar>
<toolbar label-id="Hypotheses Toolbar"> <toolbar label-id="Hypotheses Toolbar">
<toolbutton-item item-id="5030" label-id="Average length" icon-id="mesh_hypo_length.png" tooltip-id="Avreage length Hypothesis" accel-id="" toggle-id="" execute-action=""/> <toolbutton-item item-id="5000" label-id="Create Hypotheses" icon-id="mesh_hypo_length.png" tooltip-id="Create Hypotheses" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="5031" label-id="Segments" icon-id="mesh_hypo_segment.png" tooltip-id="Nb. Segments Hypothesis" accel-id="" toggle-id="" execute-action=""/> <toolbutton-item item-id="5010" label-id="Create Algorithms" icon-id="mesh_algo_mefisto.png" tooltip-id="Create Algorithms" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="5032" label-id="Max. Triangle Area" icon-id="mesh_hypo_area.png" tooltip-id="Max. Triangle Area Hypothesis" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="5033" label-id="Max. Hexahedron or Tetrahedron Volume" icon-id="mesh_hypo_volume.png" tooltip-id="Max. Hexahedron or Tetrahedron Volume Hypothesis" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="5034" label-id="Length From Edges (2D Hyp. for Triangulator)" icon-id="mesh_hypo_length.png" tooltip-id="Length From Edges Hypothesis" accel-id="" toggle-id="" execute-action=""/>
<separatorTB/>
<toolbutton-item item-id="5000" label-id="Wire Discretisation" icon-id="mesh_algo_regular.png" tooltip-id="Wire Discratisation Algorithm" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="5010" label-id="Triangle (Mefisto)" icon-id="mesh_algo_mefisto.png" tooltip-id="Triangle (Mefisto) Algorithm" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="5011" label-id="Quadrangle (Mapping)" icon-id="mesh_algo_quad.png" tooltip-id="Quadrangle (Mapping) Algorithm" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="5020" label-id="Hexahedron (i,j,k)" icon-id="mesh_algo_hexa.png" tooltip-id="Hexahedron (i,j,k) Algorithm" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="5021" label-id="Tetrahedron (Netgen)" icon-id="mesh_algo_hexa.png" tooltip-id="Tetrahedron (Netgen) Delaunay Algorithm" accel-id="" toggle-id="" execute-action=""/>
</toolbar> </toolbar>
<toolbar label-id="Controls toolbar"> <toolbar label-id="Controls toolbar">
<toolbutton-item item-id="6001" label-id="Length" icon-id="mesh_length.png" tooltip-id="Length" accel-id="" toggle-id="" execute-action=""/> <toolbutton-item item-id="6001" label-id="Length" icon-id="mesh_length.png" tooltip-id="Length" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="6002" label-id="Connectivity" icon-id="mesh_connectivity.png" tooltip-id="Connectivity" accel-id="" toggle-id="" execute-action=""/> <toolbutton-item item-id="6003" label-id="Free borders" icon-id="mesh_free_edges.png" tooltip-id="Free borders" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="6004" label-id="Borders at multi-connection" icon-id="mesh_multi_edges.png" tooltip-id="Borders at multi-connection" accel-id="" toggle-id="" execute-action=""/>
<!--<toolbutton-item item-id="6002" label-id="Connectivity" icon-id="mesh_connectivity.png" tooltip-id="Connectivity" accel-id="" toggle-id="" execute-action=""/>-->
<toolbutton-item item-id="6011" label-id="Area" icon-id="mesh_area.png" tooltip-id="Area" accel-id="" toggle-id="" execute-action=""/> <toolbutton-item item-id="6011" label-id="Area" icon-id="mesh_area.png" tooltip-id="Area" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="6012" label-id="Taper" icon-id="mesh_taper.png" tooltip-id="Taper" accel-id="" toggle-id="" execute-action=""/> <toolbutton-item item-id="6012" label-id="Taper" icon-id="mesh_taper.png" tooltip-id="Taper" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="6013" label-id="Aspect Ratio" icon-id="mesh_aspect.png" tooltip-id="Aspect Ratio" accel-id="" toggle-id="" execute-action=""/> <toolbutton-item item-id="6013" label-id="Aspect Ratio" icon-id="mesh_aspect.png" tooltip-id="Aspect Ratio" accel-id="" toggle-id="" execute-action=""/>
@ -233,16 +349,12 @@
<toolbar label-id="Modification toolbar"> <toolbar label-id="Modification toolbar">
<toolbutton-item item-id="405" label-id="Move Node" icon-id="mesh_move_node.png" tooltip-id="Move Node" accel-id="" toggle-id="" execute-action=""/> <toolbutton-item item-id="405" label-id="Move Node" icon-id="mesh_move_node.png" tooltip-id="Move Node" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="806" label-id="Orientation" icon-id="mesh_orientation.png" tooltip-id="Orientation" accel-id="" toggle-id="" execute-action=""/> <toolbutton-item item-id="406" label-id="Orientation" icon-id="mesh_orientation.png" tooltip-id="Orientation" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="807" label-id="Diagonal Inversion" icon-id="mesh_diagonal.png" tooltip-id="Diagonal Inversion" accel-id="" toggle-id="" execute-action=""/> <toolbutton-item item-id="407" label-id="Diagonal Inversion" icon-id="mesh_diagonal.png" tooltip-id="Diagonal Inversion" accel-id="" toggle-id="" execute-action=""/>
</toolbar> </toolbar>
<toolbar label-id="Display Mode Toolbar"> <toolbar label-id="Display Mode Toolbar">
<toolbutton-item item-id="214" pos-id="" label-id="Update" icon-id="mesh_update.png" tooltip-id="Update View" accel-id="" toggle-id="" execute-action=""/> <toolbutton-item item-id="214" pos-id="" label-id="Update" icon-id="mesh_update.png" tooltip-id="Update View" accel-id="" toggle-id="" execute-action=""/>
<separatorTB/>
<toolbutton-item item-id="211" pos-id="" label-id="Wireframe" icon-id="mesh_wireframe.png" tooltip-id="Wireframe" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="212" pos-id="" label-id="Shading" icon-id="mesh_shading.png" tooltip-id="shading" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="213" pos-id="" label-id="Shrink" icon-id="mesh_shrink.png" tooltip-id="shrink" accel-id="" toggle-id="" execute-action=""/>
</toolbar> </toolbar>
</desktop> </desktop>

View File

@ -17,7 +17,7 @@
<submenu label-id="Import" item-id="11" pos-id="8"> <submenu label-id="Import" item-id="11" pos-id="8">
<popup-item item-id="111" pos-id="" label-id="DAT file" icon-id="" tooltip-id="" accel-id="Ctrl+B" toggle-id="" execute-action=""/> <popup-item item-id="111" pos-id="" label-id="DAT file" icon-id="" tooltip-id="" accel-id="Ctrl+B" toggle-id="" execute-action=""/>
<popup-item item-id="112" pos-id="" label-id="UNV File" icon-id="" tooltip-id="" accel-id="Ctrl+I" toggle-id="" execute-action=""/> <popup-item item-id="112" pos-id="" label-id="UNV File" icon-id="" tooltip-id="" accel-id="Ctrl+I" toggle-id="" execute-action=""/>
<popup-item item-id="113" pos-id="" label-id="MED File" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <popup-item item-id="113" pos-id="" label-id="MED File" icon-id="" tooltip-id="" accel-id="Ctrl+M" toggle-id="" execute-action=""/>
</submenu> </submenu>
<endsubmenu /> <endsubmenu />
<submenu label-id="Export" item-id="12" pos-id="9"> <submenu label-id="Export" item-id="12" pos-id="9">
@ -37,17 +37,8 @@
<!-- ************************** Hypothesis (menubar) ************************************ --> <!-- ************************** Hypothesis (menubar) ************************************ -->
<menu-item label-id="Hypotheses" item-id="50" pos-id="3"> <menu-item label-id="Hypotheses" item-id="50" pos-id="3">
<popup-item item-id="5030" pos-id="" label-id="Average length" icon-id="mesh_hypo_length.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <popup-item item-id="5000" pos-id="" label-id="Create Hypothesis" icon-id="mesh_hypo_length.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="5031" pos-id="" label-id="Nb. Segments" icon-id="mesh_hypo_segment.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <popup-item item-id="5010" pos-id="" label-id="Create Algorithm" icon-id="mesh_algo_mefisto.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="5032" pos-id="" label-id="Max. Triangle Area" icon-id="mesh_hypo_area.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="5033" pos-id="" label-id="Max. Hexahedron or Tetrahedron Volume" icon-id="mesh_hypo_volume.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="5034" pos-id="" label-id="Length From Edges (2D Hyp. for Triangulator)" icon-id="mesh_hypo_length.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/>
<popup-item item-id="5000" pos-id="" label-id="Wire discretisation" icon-id="mesh_algo_regular.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="5010" pos-id="" label-id="Triangle (Mefisto)" icon-id="mesh_algo_mefisto.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="5011" pos-id="" label-id="Quadrangle (Mapping)" icon-id="mesh_algo_quad.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="5020" pos-id="" label-id="Hexahedron (i,j,k)" icon-id="mesh_algo_hexa.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="5021" pos-id="" label-id="Tetrahedron (Netgen)" icon-id="mesh_algo_tetra.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</menu-item> </menu-item>
<!-- ************************** Mesh (menubar) ************************************ --> <!-- ************************** Mesh (menubar) ************************************ -->
@ -58,6 +49,8 @@
<separator pos-id=""/> <separator pos-id=""/>
<popup-item item-id="701" pos-id="" label-id="Compute" icon-id="mesh_compute.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <popup-item item-id="701" pos-id="" label-id="Compute" icon-id="mesh_compute.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/> <separator pos-id=""/>
<popup-item item-id="801" pos-id="" label-id="Create Group" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/>
<popup-item item-id="900" pos-id="" label-id="Mesh Infos" icon-id="mesh_info.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <popup-item item-id="900" pos-id="" label-id="Mesh Infos" icon-id="mesh_info.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</menu-item> </menu-item>
@ -90,8 +83,8 @@
</submenu> </submenu>
<endsubmenu /> <endsubmenu />
<popup-item item-id="405" pos-id="" label-id="Move Node" icon-id="mesh_move_node.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <popup-item item-id="405" pos-id="" label-id="Move Node" icon-id="mesh_move_node.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="806" pos-id="" label-id="Orientation" icon-id="mesh_orientation.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <popup-item item-id="406" pos-id="" label-id="Orientation" icon-id="mesh_orientation.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="807" pos-id="" label-id="Diagonal Inversion" icon-id="mesh_diagonal.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <popup-item item-id="407" pos-id="" label-id="Diagonal Inversion" icon-id="mesh_diagonal.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</menu-item> </menu-item>
<!-- ************************** Numbering (menubar) ************************************ --> <!-- ************************** Numbering (menubar) ************************************ -->
@ -111,7 +104,7 @@
<endsubmenu /> <endsubmenu />
<popup-item item-id="1001" pos-id="" label-id="Automatic Update" icon-id="" tooltip-id="" accel-id="" toggle-id="false" execute-action=""/> <popup-item item-id="1001" pos-id="" label-id="Automatic Update" icon-id="" tooltip-id="" accel-id="" toggle-id="false" execute-action=""/>
<separator pos-id=""/> <separator pos-id=""/>
<popup-item item-id="1003" pos-id="" label-id="Colors - Size" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <popup-item item-id="1003" pos-id="" label-id="Colors - Size" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/> <separator pos-id=""/>
<popup-item item-id="1005" pos-id="" label-id="Scalars Bar" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <popup-item item-id="1005" pos-id="" label-id="Scalars Bar" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</submenu> </submenu>
@ -139,11 +132,15 @@
<popup-item item-id="701" pos-id="" label-id="Compute" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <popup-item item-id="701" pos-id="" label-id="Compute" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="214" pos-id="" label-id="Update" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <popup-item item-id="214" pos-id="" label-id="Update" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/> <separator pos-id=""/>
<popup-item item-id="801" pos-id="" label-id="Create Group" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/>
<popup-item item-id="1101" pos-id="" label-id="Rename" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <popup-item item-id="1101" pos-id="" label-id="Rename" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</popupmenu> </popupmenu>
<popupmenu label-id="Popup for ObjectBrowser" context-id="" parent-id="ObjectBrowser" object-id="SubMesh"> <popupmenu label-id="Popup for ObjectBrowser" context-id="" parent-id="ObjectBrowser" object-id="SubMesh">
<popup-item item-id="706" pos-id="" label-id="Edit Local Hyp." icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <popup-item item-id="706" pos-id="" label-id="Edit Local Hyp." icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/>
<popup-item item-id="802" pos-id="" label-id="Construct Group" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</popupmenu> </popupmenu>
<popupmenu label-id="Popup for ObjectBrowser" context-id="" parent-id="ObjectBrowser" object-id="Hypothesis"> <popupmenu label-id="Popup for ObjectBrowser" context-id="" parent-id="ObjectBrowser" object-id="Hypothesis">
@ -151,13 +148,13 @@
<popup-item item-id="1102" pos-id="" label-id="Unassign Hyp." icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <popup-item item-id="1102" pos-id="" label-id="Unassign Hyp." icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="1101" pos-id="" label-id="Rename" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <popup-item item-id="1101" pos-id="" label-id="Rename" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</popupmenu> </popupmenu>
<popupmenu label-id="Popup for ObjectBrowser" context-id="" parent-id="ObjectBrowser" object-id="Algorithm"> <popupmenu label-id="Popup for ObjectBrowser" context-id="" parent-id="ObjectBrowser" object-id="Algorithm">
<popup-item item-id="1102" pos-id="" label-id="Unassign Algo." icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <popup-item item-id="1102" pos-id="" label-id="Unassign Algo." icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="1101" pos-id="" label-id="Rename" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <popup-item item-id="1101" pos-id="" label-id="Rename" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</popupmenu> </popupmenu>
<popupmenu label-id="Popup for Viewer" context-id="" parent-id="Viewer" object-id="Mesh"> <popupmenu label-id="Popup for Viewer" context-id="" parent-id="Viewer" object-id="Mesh">
<popup-item item-id="214" pos-id="" label-id="Update" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <popup-item item-id="214" pos-id="" label-id="Update" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/> <separator pos-id=""/>
@ -195,17 +192,8 @@
</toolbar> </toolbar>
<toolbar label-id="Hypotheses Toolbar"> <toolbar label-id="Hypotheses Toolbar">
<toolbutton-item item-id="5030" label-id="Average length" icon-id="mesh_hypo_length.png" tooltip-id="Avreage length Hypothesis" accel-id="" toggle-id="" execute-action=""/> <toolbutton-item item-id="5000" label-id="Create Hypothesis" icon-id="mesh_hypo_length.png" tooltip-id="Create Hypothesis" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="5031" label-id="Segments" icon-id="mesh_hypo_segment.png" tooltip-id="Nb. Segments Hypothesis" accel-id="" toggle-id="" execute-action=""/> <toolbutton-item item-id="5010" label-id="Create Algorithm" icon-id="mesh_algo_mefisto.png" tooltip-id="Create Algorithm" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="5032" label-id="Max. Triangle Area" icon-id="mesh_hypo_area.png" tooltip-id="Max. Triangle Area Hypothesis" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="5033" label-id="Max. Hexahedron or Tetrahedron Volume" icon-id="mesh_hypo_volume.png" tooltip-id="Max. Hexahedron or Tetrahedron Volume Hypothesis" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="5034" label-id="Length From Edges (2D Hyp. for Triangulator)" icon-id="mesh_hypo_length.png" tooltip-id="Length From Edges Hypothesis" accel-id="" toggle-id="" execute-action=""/>
<separatorTB/>
<toolbutton-item item-id="5000" label-id="Wire Discretisation" icon-id="mesh_algo_regular.png" tooltip-id="Wire Discratisation Algorithm" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="5010" label-id="Triangle (Mefisto)" icon-id="mesh_algo_mefisto.png" tooltip-id="Triangle (Mefisto) Algorithm" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="5011" label-id="Quadrangle (Mapping)" icon-id="mesh_algo_quad.png" tooltip-id="Quadrangle (Mapping) Algorithm" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="5020" label-id="Hexahedron (i,j,k)" icon-id="mesh_algo_hexa.png" tooltip-id="Hexahedron (i,j,k) Algorithm" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="5021" label-id="Tetrahedron (Netgen)" icon-id="mesh_algo_hexa.png" tooltip-id="Tetrahedron (Netgen) Delaunay Algorithm" accel-id="" toggle-id="" execute-action=""/>
</toolbar> </toolbar>
<toolbar label-id="Controls toolbar"> <toolbar label-id="Controls toolbar">
@ -233,8 +221,8 @@
<toolbar label-id="Modification toolbar"> <toolbar label-id="Modification toolbar">
<toolbutton-item item-id="405" label-id="Move Node" icon-id="mesh_move_node.png" tooltip-id="Move Node" accel-id="" toggle-id="" execute-action=""/> <toolbutton-item item-id="405" label-id="Move Node" icon-id="mesh_move_node.png" tooltip-id="Move Node" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="806" label-id="Orientation" icon-id="mesh_orientation.png" tooltip-id="Orientation" accel-id="" toggle-id="" execute-action=""/> <toolbutton-item item-id="406" label-id="Orientation" icon-id="mesh_orientation.png" tooltip-id="Orientation" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="807" label-id="Diagonal Inversion" icon-id="mesh_diagonal.png" tooltip-id="Diagonal Inversion" accel-id="" toggle-id="" execute-action=""/> <toolbutton-item item-id="407" label-id="Diagonal Inversion" icon-id="mesh_diagonal.png" tooltip-id="Diagonal Inversion" accel-id="" toggle-id="" execute-action=""/>
</toolbar> </toolbar>
<toolbar label-id="Display Mode Toolbar"> <toolbar label-id="Display Mode Toolbar">

View File

@ -46,7 +46,7 @@ LIB_CLIENT_IDL =
LIB_SERVER_IDL = LIB_SERVER_IDL =
# additionnal information to compil and link file # additionnal information to compil and link file
CPPFLAGS += $(OCC_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome CPPFLAGS += $(OCC_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome $(BOOST_CPPFLAGS)
CXXFLAGS += $(OCC_CXXFLAGS) $(MED2_INCLUDES) -rdynamic -ldl -I${KERNEL_ROOT_DIR}/include/salome CXXFLAGS += $(OCC_CXXFLAGS) $(MED2_INCLUDES) -rdynamic -ldl -I${KERNEL_ROOT_DIR}/include/salome
LDFLAGS += $(MED2_LIBS) -lSMESHDS -lSMDS LDFLAGS += $(MED2_LIBS) -lSMESHDS -lSMDS

View File

@ -111,7 +111,7 @@ void DriverDAT_W_SMDS_Mesh::Write()
fprintf(stdout, "(* NOEUDS DU MAILLAGE : *)\n"); fprintf(stdout, "(* NOEUDS DU MAILLAGE : *)\n");
fprintf(stdout, "(************************)\n"); fprintf(stdout, "(************************)\n");
SMDS_Iterator<const SMDS_MeshNode *> * itNodes=myMesh->nodesIterator(); SMDS_NodeIteratorPtr itNodes=myMesh->nodesIterator();
while(itNodes->more()) while(itNodes->more())
{ {
const SMDS_MeshNode * node = itNodes->next(); const SMDS_MeshNode * node = itNodes->next();
@ -127,7 +127,7 @@ void DriverDAT_W_SMDS_Mesh::Write()
fprintf(stdout, "(**************************)"); fprintf(stdout, "(**************************)");
/* Ecriture des connectivites, noms, numeros des mailles */ /* Ecriture des connectivites, noms, numeros des mailles */
SMDS_Iterator<const SMDS_MeshEdge *> * itEdges=myMesh->edgesIterator(); SMDS_EdgeIteratorPtr itEdges=myMesh->edgesIterator();
while(itEdges->more()) while(itEdges->more())
{ {
const SMDS_MeshElement * elem = itEdges->next(); const SMDS_MeshElement * elem = itEdges->next();
@ -146,13 +146,13 @@ void DriverDAT_W_SMDS_Mesh::Write()
} }
} }
SMDS_Iterator<const SMDS_MeshElement *> * it=elem->nodesIterator(); SMDS_ElemIteratorPtr it=elem->nodesIterator();
while(it->more()) fprintf(myFileId, "%d ", it->next()->GetID()); while(it->more()) fprintf(myFileId, "%d ", it->next()->GetID());
fprintf(myFileId, "\n"); fprintf(myFileId, "\n");
} }
SMDS_Iterator<const SMDS_MeshFace *> * itFaces=myMesh->facesIterator(); SMDS_FaceIteratorPtr itFaces=myMesh->facesIterator();
while(itFaces->more()) while(itFaces->more())
{ {
const SMDS_MeshElement * elem = itFaces->next(); const SMDS_MeshElement * elem = itFaces->next();
@ -176,13 +176,13 @@ void DriverDAT_W_SMDS_Mesh::Write()
} }
} }
SMDS_Iterator<const SMDS_MeshElement *> * it=elem->nodesIterator(); SMDS_ElemIteratorPtr it=elem->nodesIterator();
while(it->more()) fprintf(myFileId, "%d ", it->next()->GetID()); while(it->more()) fprintf(myFileId, "%d ", it->next()->GetID());
fprintf(myFileId, "\n"); fprintf(myFileId, "\n");
} }
SMDS_Iterator<const SMDS_MeshVolume *> * itVolumes=myMesh->volumesIterator(); SMDS_VolumeIteratorPtr itVolumes=myMesh->volumesIterator();
while(itVolumes->more()) while(itVolumes->more())
{ {
const SMDS_MeshElement * elem = itVolumes->next(); const SMDS_MeshElement * elem = itVolumes->next();
@ -196,7 +196,7 @@ void DriverDAT_W_SMDS_Mesh::Write()
} }
} }
SMDS_Iterator<const SMDS_MeshElement *> * it=elem->nodesIterator(); SMDS_ElemIteratorPtr it=elem->nodesIterator();
while(it->more()) fprintf(myFileId, "%d ", it->next()->GetID()); while(it->more()) fprintf(myFileId, "%d ", it->next()->GetID());
fprintf(myFileId, "\n"); fprintf(myFileId, "\n");

View File

@ -125,14 +125,13 @@ void DriverDAT_W_SMESHDS_Mesh::Add()
fprintf(stdout, "(* NOEUDS DU MAILLAGE : *)\n"); fprintf(stdout, "(* NOEUDS DU MAILLAGE : *)\n");
fprintf(stdout, "(************************)\n"); fprintf(stdout, "(************************)\n");
SMDS_Iterator<const SMDS_MeshNode *> * itNodes=myMesh->nodesIterator(); SMDS_NodeIteratorPtr itNodes=myMesh->nodesIterator();
while(itNodes->more()) while(itNodes->more())
{ {
const SMDS_MeshNode * node = itNodes->next(); const SMDS_MeshNode * node = itNodes->next();
fprintf(myFileId, "%d %e %e %e\n", node->GetID(), node->X(), fprintf(myFileId, "%d %e %e %e\n", node->GetID(), node->X(),
node->Y(), node->Z()); node->Y(), node->Z());
} }
delete itNodes;
/**************************************************************************** /****************************************************************************
* ECRITURE DES ELEMENTS * * ECRITURE DES ELEMENTS *
@ -142,7 +141,7 @@ void DriverDAT_W_SMESHDS_Mesh::Add()
fprintf(stdout, "(**************************)"); fprintf(stdout, "(**************************)");
/* Ecriture des connectivites, noms, numeros des mailles */ /* Ecriture des connectivites, noms, numeros des mailles */
SMDS_Iterator<const SMDS_MeshEdge*> * itEdges=myMesh->edgesIterator(); SMDS_EdgeIteratorPtr itEdges=myMesh->edgesIterator();
while(itEdges->more()) while(itEdges->more())
{ {
const SMDS_MeshEdge * elem = itEdges->next(); const SMDS_MeshEdge * elem = itEdges->next();
@ -161,15 +160,14 @@ void DriverDAT_W_SMESHDS_Mesh::Add()
} }
} }
SMDS_Iterator<const SMDS_MeshElement *> * itNodes=elem->nodesIterator(); SMDS_ElemIteratorPtr itNodes=elem->nodesIterator();
while(itNodes->more()) while(itNodes->more())
fprintf(myFileId, "%d ", itNodes->next()->GetID()); fprintf(myFileId, "%d ", itNodes->next()->GetID());
fprintf(myFileId, "\n"); fprintf(myFileId, "\n");
} }
delete itEdges;
SMDS_Iterator<const SMDS_MeshFace *> * itFaces=myMesh->facesIterator(); SMDS_FaceIteratorPtr itFaces=myMesh->facesIterator();
while(itFaces->more()) while(itFaces->more())
{ {
const SMDS_MeshElement * elem = itFaces->next(); const SMDS_MeshElement * elem = itFaces->next();
@ -193,16 +191,14 @@ void DriverDAT_W_SMESHDS_Mesh::Add()
} }
} }
SMDS_Iterator<const SMDS_MeshElement *> * itNodes=elem->nodesIterator(); SMDS_ElemIteratorPtr itNodes=elem->nodesIterator();
while(itNodes->more()) while(itNodes->more())
fprintf(myFileId, "%d ", itNodes->next()->GetID()); fprintf(myFileId, "%d ", itNodes->next()->GetID());
delete itNodes;
fprintf(myFileId, "\n"); fprintf(myFileId, "\n");
} }
delete itFaces;
SMDS_Iterator<const SMDS_MeshVolume*> * itVolumes=myMesh->volumesIterator(); SMDS_VolumeIteratorPtr itVolumes=myMesh->volumesIterator();
while(itVolumes->more()) while(itVolumes->more())
{ {
const SMDS_MeshElement * elem = itVolumes->next(); const SMDS_MeshElement * elem = itVolumes->next();
@ -216,14 +212,12 @@ void DriverDAT_W_SMESHDS_Mesh::Add()
} }
} }
SMDS_Iterator<const SMDS_MeshElement *> * itNodes=elem->nodesIterator(); SMDS_ElemIteratorPtr itNodes=elem->nodesIterator();
while(itNodes->more()) while(itNodes->more())
fprintf(myFileId, "%d ", itNodes->next()->GetID()); fprintf(myFileId, "%d ", itNodes->next()->GetID());
delete itNodes;
fprintf(myFileId, "\n"); fprintf(myFileId, "\n");
} }
delete itVolumes;
fclose(myFileId); fclose(myFileId);
} }

View File

@ -46,7 +46,7 @@ LIB_CLIENT_IDL =
LIB_SERVER_IDL = LIB_SERVER_IDL =
# additionnal information to compil and link file # additionnal information to compil and link file
CPPFLAGS += $(OCC_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome CPPFLAGS += $(OCC_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome $(BOOST_CPPFLAGS)
CXXFLAGS += $(OCC_CXXFLAGS) $(MED2_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome CXXFLAGS += $(OCC_CXXFLAGS) $(MED2_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome
LDFLAGS += $(MED2_LIBS) -lMeshDriver LDFLAGS += $(MED2_LIBS) -lMeshDriver

File diff suppressed because it is too large Load Diff

View File

@ -29,34 +29,60 @@
#include "SMESHDS_Mesh.hxx" #include "SMESHDS_Mesh.hxx"
#include "Mesh_Reader.h" #include "Mesh_Reader.h"
#include "DriverMED_Family.h"
#include <vector> #include <list>
extern "C" extern "C"
{ {
#include <med.h> #include <med.h>
} }
using namespace std;
class SMESHDS_Group;
class SMESHDS_SubMesh;
class DriverMED_R_SMESHDS_Mesh:public Mesh_Reader class DriverMED_R_SMESHDS_Mesh:public Mesh_Reader
{ {
public:
public:DriverMED_R_SMESHDS_Mesh(); DriverMED_R_SMESHDS_Mesh();
~DriverMED_R_SMESHDS_Mesh(); ~DriverMED_R_SMESHDS_Mesh();
void Read(); enum ReadStatus {
void ReadMySelf(); DRS_OK,
void Add(); DRS_EMPTY, // a MED file contains no mesh with the given name
DRS_WARN_RENUMBER, // a MED file has overlapped ranges of element numbers,
// so the numbers from the file are ignored
DRS_WARN_SKIP_ELEM, // some elements were skipped due to incorrect file data
DRS_FAIL // general failure (exception etc.)
};
void SetMesh(SMDS_Mesh * aMesh); void Read();
void SetFile(string); ReadStatus ReadMySelf();
void SetFileId(med_idt); void Add();
void SetMeshId(int);
void LinkMeshToShape(string, string, vector < int >); list<string> GetGroupNames();
void GetGroup(SMESHDS_Group* theGroup);
void CreateAllSubMeshes();
void GetSubMesh(SMESHDS_SubMesh* theSubMesh, const int theId);
private: SMDS_Mesh * myMesh; list<string> GetMeshNames();
string myFile;
med_idt myFileId; void SetMesh(SMDS_Mesh * aMesh);
int myMeshId; void SetFile(string);
void SetFileId(med_idt);
void SetMeshId(int);
void SetMeshName(string theMeshName);
private:
SMDS_Mesh * myMesh;
string myFile;
med_idt myFileId;
int myMeshId;
string myMeshName;
map<int, DriverMED_FamilyPtr> myFamilies;
}; };
#endif #endif

View File

@ -207,7 +207,7 @@ void DriverMED_W_SMDS_Mesh::Write()
for (i = 0; i < MED_NBR_GEOMETRIE_MAILLE; i++) for (i = 0; i < MED_NBR_GEOMETRIE_MAILLE; i++)
nmailles[i] = 0; nmailles[i] = 0;
SMDS_Iterator<const SMDS_MeshFace *> * itFaces=myMesh->facesIterator(); SMDS_FaceIteratorPtr itFaces=myMesh->facesIterator();
int nb_of_nodes, nb_of_faces; int nb_of_nodes, nb_of_faces;
nb_of_faces = myMesh->NbFaces(); nb_of_faces = myMesh->NbFaces();
//SCRUTE(nb_of_faces); //SCRUTE(nb_of_faces);
@ -251,7 +251,7 @@ void DriverMED_W_SMDS_Mesh::Write()
} }
SMDS_Iterator<const SMDS_MeshVolume*> * itVolumes=myMesh->volumesIterator(); SMDS_VolumeIteratorPtr itVolumes=myMesh->volumesIterator();
while(itVolumes->more()) while(itVolumes->more())
{ {
const SMDS_MeshVolume * elem = itVolumes->next(); const SMDS_MeshVolume * elem = itVolumes->next();
@ -295,7 +295,7 @@ void DriverMED_W_SMDS_Mesh::Write()
nomnoe = ""; nomnoe = "";
i = 0; i = 0;
SMDS_Iterator<const SMDS_MeshNode *> * itNodes=myMesh->nodesIterator(); SMDS_NodeIteratorPtr itNodes=myMesh->nodesIterator();
while(itNodes->more()) while(itNodes->more())
{ {
const SMDS_MeshNode * node = itNodes->next(); const SMDS_MeshNode * node = itNodes->next();
@ -370,8 +370,7 @@ void DriverMED_W_SMDS_Mesh::Write()
//elem_id=*(numele+j); //elem_id=*(numele+j);
//fprintf(stdout,"%d \n",myId); //fprintf(stdout,"%d \n",myId);
SMDS_Iterator<const SMDS_MeshElement *> * itNode= SMDS_ElemIteratorPtr itNode= elem->nodesIterator();
elem->nodesIterator();
while(itNode->more()) while(itNode->more())
{ {

File diff suppressed because it is too large Load Diff

View File

@ -31,32 +31,66 @@
#include "Mesh_Writer.h" #include "Mesh_Writer.h"
#include <string> #include <string>
#include <list>
#include <map>
extern "C" extern "C"
{ {
#include <med.h> #include <med.h>
} }
using namespace std;
class SMESHDS_Group;
class SMESHDS_SubMesh;
class DriverMED_W_SMESHDS_Mesh:public Mesh_Writer class DriverMED_W_SMESHDS_Mesh:public Mesh_Writer
{ {
public:
public:DriverMED_W_SMESHDS_Mesh(); DriverMED_W_SMESHDS_Mesh();
~DriverMED_W_SMESHDS_Mesh(); ~DriverMED_W_SMESHDS_Mesh();
void Add(); /*! sets file name; only for usage with Add(), not Write()
void Write(); */
void SetMesh(SMDS_Mesh * aMesh); void SetFile(string);
void SetFile(string); void AddGroupOfNodes();
void AddGroupOfEdges();
void AddGroupOfFaces();
void AddGroupOfVolumes();
void SetFileId(med_idt); /*! functions to prepare adding one mesh
void SetMeshId(int); */
void SetMesh(SMDS_Mesh * aMesh);
void SetMeshId(int);
void SetMeshName(string theMeshName);
void AddGroup(SMESHDS_Group* theGroup);
void AddAllSubMeshes();
void AddSubMesh(SMESHDS_SubMesh* theSubMesh, int theID);
void CreateFamily(char *, char *, int, med_int); /*! add one mesh
*/
void Add();
private: SMDS_Mesh * myMesh; /*! functions to write via DriverMED_W_SMDS_Mesh (no groups)
string myFile; */
med_idt myFileId; void SetFileId(med_idt);
int myMeshId; void Write();
private:
SMDS_Mesh * myMesh;
string myFile;
med_idt myFileId;
int myMeshId;
string myMeshName;
list<SMESHDS_Group*> myGroups;
bool myAllSubMeshes;
map<int,SMESHDS_SubMesh*> mySubMeshes;
bool myDoGroupOfNodes;
bool myDoGroupOfEdges;
bool myDoGroupOfFaces;
bool myDoGroupOfVolumes;
}; };
#endif #endif

View File

@ -35,7 +35,10 @@ VPATH=.:@srcdir@
@COMMENCE@ @COMMENCE@
# header files # header files
EXPORT_HEADERS= DriverMED_R_SMDS_Mesh.h DriverMED_R_SMESHDS_Mesh.h DriverMED_R_SMESHDS_Document.h DriverMED_W_SMDS_Mesh.h DriverMED_W_SMESHDS_Mesh.h DriverMED_W_SMESHDS_Document.h EXPORT_HEADERS = \
DriverMED_R_SMDS_Mesh.h DriverMED_R_SMESHDS_Mesh.h DriverMED_R_SMESHDS_Document.h \
DriverMED_W_SMDS_Mesh.h DriverMED_W_SMESHDS_Mesh.h DriverMED_W_SMESHDS_Document.h \
DriverMED_Family.h
# Libraries targets # Libraries targets
LIB = libMeshDriverMED.la LIB = libMeshDriverMED.la
@ -45,15 +48,16 @@ LIB_SRC = \
DriverMED_R_SMESHDS_Document.cxx \ DriverMED_R_SMESHDS_Document.cxx \
DriverMED_W_SMDS_Mesh.cxx \ DriverMED_W_SMDS_Mesh.cxx \
DriverMED_W_SMESHDS_Document.cxx \ DriverMED_W_SMESHDS_Document.cxx \
DriverMED_W_SMESHDS_Mesh.cxx DriverMED_W_SMESHDS_Mesh.cxx \
DriverMED_Family.cxx
LIB_CLIENT_IDL = LIB_CLIENT_IDL =
LIB_SERVER_IDL = LIB_SERVER_IDL =
# additionnal information to compil and link file # additionnal information to compil and link file
CPPFLAGS += $(OCC_INCLUDES) $(QT_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome CPPFLAGS += $(OCC_INCLUDES) $(QT_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome $(BOOST_CPPFLAGS)
CXXFLAGS += $(OCC_CXXFLAGS) $(MED2_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome CXXFLAGS += $(OCC_CXXFLAGS) $(MED2_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome
LDFLAGS += $(MED2_LIBS) -lMeshDriver -lmed LDFLAGS += $(MED2_LIBS) -lMeshDriver -L${KERNEL_ROOT_DIR}/lib/salome -lMEDWrapper
%_moc.cxx: %.h %_moc.cxx: %.h
$(MOC) $< -o $@ $(MOC) $< -o $@

View File

@ -101,7 +101,7 @@ void DriverUNV_W_SMDS_Mesh::Write()
fprintf(myFileId, "%s\n", sUNV_SEPARATOR); fprintf(myFileId, "%s\n", sUNV_SEPARATOR);
fprintf(myFileId, "%s\n", sNODE_UNV_ID); fprintf(myFileId, "%s\n", sNODE_UNV_ID);
SMDS_Iterator<const SMDS_MeshNode *> * itNodes=myMesh->nodesIterator(); SMDS_NodeIteratorPtr itNodes=myMesh->nodesIterator();
while(itNodes->more()) while(itNodes->more())
{ {
const SMDS_MeshNode * node = itNodes->next(); const SMDS_MeshNode * node = itNodes->next();
@ -110,7 +110,6 @@ void DriverUNV_W_SMDS_Mesh::Write()
fprintf(myFileId, "%25.16E%25.16E%25.16E\n", node->X(), node->Y(), fprintf(myFileId, "%25.16E%25.16E%25.16E\n", node->X(), node->Y(),
node->Z()); node->Z());
} }
delete itNodes;
fprintf(myFileId, "%s\n", sUNV_SEPARATOR); fprintf(myFileId, "%s\n", sUNV_SEPARATOR);
/**************************************************************************** /****************************************************************************
@ -124,11 +123,11 @@ void DriverUNV_W_SMDS_Mesh::Write()
fprintf(myFileId, "%s\n", sUNV_SEPARATOR); fprintf(myFileId, "%s\n", sUNV_SEPARATOR);
fprintf(myFileId, "%s\n", sELT_UNV_ID); fprintf(myFileId, "%s\n", sELT_UNV_ID);
SMDS_Iterator<const SMDS_MeshEdge *> * itEdges=myMesh->edgesIterator(); SMDS_EdgeIteratorPtr itEdges=myMesh->edgesIterator();
while(itEdges->more()) while(itEdges->more())
{ {
const SMDS_MeshElement * elem = itEdges->next(); const SMDS_MeshElement * elem = itEdges->next();
SMDS_Iterator<const SMDS_MeshElement*> *itn=elem->nodesIterator(); SMDS_ElemIteratorPtr itn=elem->nodesIterator();
switch (elem->NbNodes()) switch (elem->NbNodes())
{ {
@ -149,11 +148,9 @@ void DriverUNV_W_SMDS_Mesh::Write()
break; break;
} }
delete itn;
} }
delete itEdges;
SMDS_Iterator<const SMDS_MeshFace*> * itFaces=myMesh->facesIterator(); SMDS_FaceIteratorPtr itFaces=myMesh->facesIterator();
while(itFaces->more()) while(itFaces->more())
{ {
const SMDS_MeshElement * elem = itFaces->next(); const SMDS_MeshElement * elem = itFaces->next();
@ -184,15 +181,13 @@ void DriverUNV_W_SMDS_Mesh::Write()
fprintf(myFileId, "element not registered\n"); fprintf(myFileId, "element not registered\n");
} }
SMDS_Iterator<const SMDS_MeshElement*> *itn=elem->nodesIterator(); SMDS_ElemIteratorPtr itn=elem->nodesIterator();
while(itn->more()) fprintf(myFileId, "%10d", itn->next()->GetID()); while(itn->more()) fprintf(myFileId, "%10d", itn->next()->GetID());
delete itn;
fprintf(myFileId, "\n"); fprintf(myFileId, "\n");
} }
delete itFaces;
SMDS_Iterator<const SMDS_MeshVolume*> * itVolumes=myMesh->volumesIterator(); SMDS_VolumeIteratorPtr itVolumes=myMesh->volumesIterator();
while(itVolumes->more()) while(itVolumes->more())
{ {
const SMDS_MeshElement * elem = itVolumes->next(); const SMDS_MeshElement * elem = itVolumes->next();
@ -216,13 +211,11 @@ void DriverUNV_W_SMDS_Mesh::Write()
break; break;
} }
SMDS_Iterator<const SMDS_MeshElement*> *itn=elem->nodesIterator(); SMDS_ElemIteratorPtr itn=elem->nodesIterator();
while(itn->more()) fprintf(myFileId, "%10d", itn->next()->GetID()); while(itn->more()) fprintf(myFileId, "%10d", itn->next()->GetID());
delete itn;
fprintf(myFileId, "\n"); fprintf(myFileId, "\n");
} }
delete itVolumes;
fprintf(myFileId, "%s\n", sUNV_SEPARATOR); fprintf(myFileId, "%s\n", sUNV_SEPARATOR);

View File

@ -112,7 +112,7 @@ void DriverUNV_W_SMESHDS_Mesh::Add()
fprintf(myFileId, "%s\n", sUNV_SEPARATOR); fprintf(myFileId, "%s\n", sUNV_SEPARATOR);
fprintf(myFileId, "%s\n", sNODE_UNV_ID); fprintf(myFileId, "%s\n", sNODE_UNV_ID);
SMDS_Iterator<const SMDS_MeshNode *> * itNodes=myMesh->nodesIterator(); SMDS_NodeIteratorPtr itNodes=myMesh->nodesIterator();
while(itNodes->more()) while(itNodes->more())
{ {
const SMDS_MeshNode * node = itNodes->next(); const SMDS_MeshNode * node = itNodes->next();
@ -121,7 +121,6 @@ void DriverUNV_W_SMESHDS_Mesh::Add()
fprintf(myFileId, "%25.16E%25.16E%25.16E\n", node->X(), node->Y(), fprintf(myFileId, "%25.16E%25.16E%25.16E\n", node->X(), node->Y(),
node->Z()); node->Z());
} }
delete itNodes;
fprintf(myFileId, "%s\n", sUNV_SEPARATOR); fprintf(myFileId, "%s\n", sUNV_SEPARATOR);
/**************************************************************************** /****************************************************************************
@ -135,11 +134,11 @@ void DriverUNV_W_SMESHDS_Mesh::Add()
fprintf(myFileId, "%s\n", sUNV_SEPARATOR); fprintf(myFileId, "%s\n", sUNV_SEPARATOR);
fprintf(myFileId, "%s\n", sELT_UNV_ID); fprintf(myFileId, "%s\n", sELT_UNV_ID);
SMDS_Iterator<const SMDS_MeshEdge *> * itEdges=myMesh->edgesIterator(); SMDS_EdgeIteratorPtr itEdges=myMesh->edgesIterator();
while(itEdges->more()) while(itEdges->more())
{ {
const SMDS_MeshEdge * elem = itEdges->next(); const SMDS_MeshEdge * elem = itEdges->next();
SMDS_Iterator<const SMDS_MeshElement*> *itn=elem->nodesIterator(); SMDS_ElemIteratorPtr itn=elem->nodesIterator();
switch (elem->NbNodes()) switch (elem->NbNodes())
{ {
@ -159,11 +158,9 @@ void DriverUNV_W_SMESHDS_Mesh::Add()
itn->next()->GetID(), itn->next()->GetID()); itn->next()->GetID(), itn->next()->GetID());
break; break;
} }
delete itn;
} }
delete itEdges;
SMDS_Iterator<const SMDS_MeshFace*> * itFaces=myMesh->facesIterator(); SMDS_FaceIteratorPtr itFaces=myMesh->facesIterator();
while(itFaces->more()) while(itFaces->more())
{ {
const SMDS_MeshElement * elem = itFaces->next(); const SMDS_MeshElement * elem = itFaces->next();
@ -194,15 +191,13 @@ void DriverUNV_W_SMESHDS_Mesh::Add()
fprintf(myFileId, "element not registered\n"); fprintf(myFileId, "element not registered\n");
} }
SMDS_Iterator<const SMDS_MeshElement*> *itn=elem->nodesIterator(); SMDS_ElemIteratorPtr itn=elem->nodesIterator();
while(itn->more()) fprintf(myFileId, "%10d", itn->next()->GetID()); while(itn->more()) fprintf(myFileId, "%10d", itn->next()->GetID());
delete itn;
fprintf(myFileId, "\n"); fprintf(myFileId, "\n");
} }
delete itFaces;
SMDS_Iterator<const SMDS_MeshVolume*> * itVolumes=myMesh->volumesIterator(); SMDS_VolumeIteratorPtr itVolumes=myMesh->volumesIterator();
while(itVolumes->more()) while(itVolumes->more())
{ {
const SMDS_MeshElement * elem = itVolumes->next(); const SMDS_MeshElement * elem = itVolumes->next();
@ -226,13 +221,11 @@ void DriverUNV_W_SMESHDS_Mesh::Add()
break; break;
} }
SMDS_Iterator<const SMDS_MeshElement*> *itn=elem->nodesIterator(); SMDS_ElemIteratorPtr itn=elem->nodesIterator();
while(itn->more()) fprintf(myFileId, "%10d", itn->next()->GetID()); while(itn->more()) fprintf(myFileId, "%10d", itn->next()->GetID());
delete itn;
fprintf(myFileId, "\n"); fprintf(myFileId, "\n");
} }
delete itVolumes;
fprintf(myFileId, "%s\n", sUNV_SEPARATOR); fprintf(myFileId, "%s\n", sUNV_SEPARATOR);
fclose(myFileId); fclose(myFileId);

View File

@ -53,7 +53,7 @@ LIB_CLIENT_IDL =
LIB_SERVER_IDL = LIB_SERVER_IDL =
# additionnal information to compil and link file # additionnal information to compil and link file
CPPFLAGS += $(OCC_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome CPPFLAGS += $(OCC_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome $(BOOST_CPPFLAGS)
CXXFLAGS += $(OCC_CXXFLAGS) $(MED2_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome CXXFLAGS += $(OCC_CXXFLAGS) $(MED2_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome
LDFLAGS += $(MED2_LIBS) -lMeshDriver LDFLAGS += $(MED2_LIBS) -lMeshDriver

View File

@ -31,14 +31,9 @@ VPATH=.:@srcdir@
@COMMENCE@ @COMMENCE@
SUBDIRS = OBJECT SMDS SMESHDS Driver DriverMED DriverDAT DriverUNV MEFISTO2 \ SUBDIRS = \
SMESH SMESH_I SMESHFiltersSelection SMESHGUI \ SMDS SMESHDS Driver DriverMED DriverDAT DriverUNV \
SMESH_SWIG SMESH SMESH_I OBJECT SMESHFiltersSelection SMESHGUI SMESH_SWIG \
MEFISTO2 StdMeshers StdMeshers_I StdMeshersGUI
ifeq (@WITHNETGEN@,yes)
SUBDIRS = OBJECT SMDS SMESHDS Driver DriverMED DriverDAT DriverUNV MEFISTO2 \
NETGEN SMESH SMESH_I SMESHFiltersSelection SMESHGUI \
SMESH_SWIG
endif
@MODULE@ @MODULE@

View File

@ -27,31 +27,32 @@
top_srcdir=@top_srcdir@ top_srcdir=@top_srcdir@
top_builddir=../.. top_builddir=../..
srcdir=@srcdir@ srcdir=@srcdir@
VPATH=.:@srcdir@:@top_srcdir@/idl:$(top_builddir)/idl:${KERNEL_ROOT_DIR}/idl/salome:${MED_ROOT_DIR}/idl/salome VPATH=.:@srcdir@:@top_srcdir@/idl:$(top_builddir)/idl
@COMMENCE@ @COMMENCE@
EXPORT_HEADERS = SMESH_Actor.h \ EXPORT_HEADERS = SMESH_Actor.h SMESH_Object.h
SMESH_Grid.h
# Libraries targets # Libraries targets
LIB = libSMESHObject.la LIB = libSMESHObject.la
LIB_SRC = SMESH_Actor.cxx \ LIB_SRC = SMESH_Object.cxx SMESH_DeviceActor.cxx SMESH_Actor.cxx
SMESH_Grid.cxx
LIB_CLIENT_IDL = SALOME_Exception.idl \
SALOME_GenericObj.idl \
SMESH_Mesh.idl \
SMESH_Filter.idl \
SMESH_Group.idl
LIB_CLIENT_IDL =
# Executables targets # Executables targets
BIN = BIN =
BIN_SRC = BIN_SRC =
CPPFLAGS+=$(QT_INCLUDES) $(PYTHON_INCLUDES) $(OCC_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome CPPFLAGS+=$(OCC_INCLUDES) $(VTK_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome \
LDFLAGS+=$(QT_MT_LIBS) $(OCC_KERNEL_LIBS) $(VTK_LIBS) $(OGL_LIBS) $(PYTHON_LIBS) -lSalomeObject -L${KERNEL_ROOT_DIR}/lib/salome $(BOOST_CPPFLAGS) $(QT_INCLUDES)
LDFLAGS+=$(OCC_KERNEL_LIBS) $(VTK_LIBS) -L${KERNEL_ROOT_DIR}/lib/salome -lSMDS \
%_moc.cxx: %.h -lSalomeGUI -lSalomeObject -lOpUtil
$(MOC) $< -o $@
@CONCLUDE@ @CONCLUDE@

File diff suppressed because it is too large Load Diff

View File

@ -30,126 +30,205 @@
#define SMESH_ACTOR_H #define SMESH_ACTOR_H
#include "SALOME_Actor.h" #include "SALOME_Actor.h"
#include "SMESH_Object.h"
// VTK Includes class vtkProperty;
#include <vtkActor.h> class vtkShrinkFilter;
#include <vtkDataSetMapper.h> class vtkPolyDataMapper;
#include <vtkUnstructuredGridReader.h> class vtkUnstructuredGrid;
class vtkMergeFilter;
class vtkPolyData;
// Open CASCADE Includes class vtkMapper;
#include <TColStd_IndexedMapOfInteger.hxx> class vtkActor2D;
#include <TColStd_DataMapOfIntegerInteger.hxx> class vtkMaskPoints;
class vtkLabeledDataMapper;
class vtkSelectVisiblePoints;
typedef struct rgbStruct class vtkScalarBarActor;
{ class vtkLookupTable;
float r;
float g;
float b;
} RGBStruct;
class SMESH_Actor : public SALOME_Actor { class SMESH_DeviceActor;
class SALOME_ExtractUnstructuredGrid;
class SMESH_Actor : public SALOME_Actor{
friend class SMESH_VisualObj;
public: public:
vtkTypeMacro(SMESH_Actor,SALOME_Actor); vtkTypeMacro(SMESH_Actor,SALOME_Actor);
static SMESH_Actor* New(TVisualObjPtr theVisualObj,
SMESH::FilterManager_ptr theFilterMgr,
const char* theEntry,
const char* theName,
int theIsClear);
virtual void ReleaseGraphicsResources(vtkWindow *renWin);
virtual int RenderOpaqueGeometry(vtkViewport *viewport);
virtual int RenderTranslucentGeometry(vtkViewport *viewport);
virtual void Render(vtkRenderer *ren);
static SMESH_Actor* New(); virtual void AddToRender(vtkRenderer* theRenderer);
virtual void RemoveFromRender(vtkRenderer* theRenderer);
// Description:
// This causes the actor to be rendered. It, in turn, will render the actor`s
// property and then mapper.
virtual void Render(vtkRenderer *, vtkMapper *);
// Description:
// This method is used internally by the rendering process.
// We overide the superclass method to properly set the estimated render time.
int RenderOpaqueGeometry(vtkViewport *viewport);
void ShallowCopy(vtkProp *prop);
void setReader(vtkUnstructuredGridReader* r) ;
vtkUnstructuredGridReader* getReader();
// Highlight
virtual bool hasHighlight() { return true; } virtual bool hasHighlight() { return true; }
virtual void highlight(Standard_Boolean highlight);
virtual void SetPreSelected(Standard_Boolean presel = Standard_False);
vtkMapper* getMapper(); virtual bool IsInfinitive();
void setDisplayMode(int); virtual void SetOpacity(float theValue);
virtual float GetOpacity();
void SetColor(float r,float g,float b); void SetSufaceColor(float r,float g,float b);
void GetColor(float& r,float& g,float& b); void GetSufaceColor(float& r,float& g,float& b);
void SetHighlightColor(float r,float g,float b);
void GetHighlightColor(float& r,float& g,float& b); void SetBackSufaceColor(float r,float g,float b);
void SetPreselectedColor(float r,float g,float b); void GetBackSufaceColor(float& r,float& g,float& b);
void GetPreselectedColor(float& r,float& g,float& b);
void SetEdgeColor(float r,float g,float b); void SetEdgeColor(float r,float g,float b);
void GetEdgeColor(float& r,float& g,float& b); void GetEdgeColor(float& r,float& g,float& b);
void SetEdgeHighlightColor(float r,float g,float b);
void GetEdgeHighlightColor(float& r,float& g,float& b);
void SetEdgePreselectedColor(float r,float g,float b);
void GetEdgePreselectedColor(float& r,float& g,float& b);
void SetNodeColor(float r,float g,float b); void SetNodeColor(float r,float g,float b);
void GetNodeColor(float& r,float& g,float& b); void GetNodeColor(float& r,float& g,float& b);
void SetHighlightColor(float r,float g,float b);
void GetHighlightColor(float& r,float& g,float& b);
void SetPreHighlightColor(float r,float g,float b);
void GetPreHighlightColor(float& r,float& g,float& b);
void SetNodeSize(int size) ; float GetLineWidth();
int GetNodeSize() ; void SetLineWidth(float theVal);
void SetNodeSize(float size) ;
float GetNodeSize() ;
void ClearNode(); virtual int GetObjId(int theVtkID);
void ClearElement(); virtual TVectorId GetVtkId(int theObjID);
void RemoveNode(int idSMESHDSnode); virtual int GetNodeObjId(int theVtkID);
void RemoveElement(int idSMESHDSelement); virtual TVectorId GetNodeVtkId(int theObjID);
void AddNode(int idSMESHDSnode, int idVTKnode); virtual int GetElemObjId(int theVtkID);
void AddElement(int idSMESHDSelement, int idVTKelement); virtual TVectorId GetElemVtkId(int theObjID);
int GetIdVTKNode(int idSMESHDSnode); virtual int GetObjDimension( const int theObjId );
int GetIdVTKElement(int idSMESHDSelement);
int GetIdSMESHDSNode(int idVTKnode); virtual void SetVisibility(int theMode);
int GetIdSMESHDSElement(int idVTKelement);
void SetIdsVTKNode(const TColStd_DataMapOfIntegerInteger& mapVTK); enum EReperesent { ePoint, eEdge, eSurface};
void SetIdsSMESHDSNode(const TColStd_DataMapOfIntegerInteger& mapSMESHDS); virtual void SetRepresentation(int theMode);
void SetPointRepresentation(int theIsPointsVisible);
bool GetPointRepresentation(){ return myIsPointsVisible;}
void SetIdsVTKElement(const TColStd_DataMapOfIntegerInteger& mapVTK); virtual vtkPolyData* GetPolyDataInput();
void SetIdsSMESHDSElement(const TColStd_DataMapOfIntegerInteger& mapSMESHDS); virtual void SetTransform(SALOME_Transform* theTransform);
vtkDataSet* DataSource; vtkUnstructuredGrid* GetUnstructuredGrid();
vtkActor* EdgeDevice; virtual vtkMapper* GetMapper();
vtkActor* EdgeShrinkDevice;
float GetShrinkFactor(); float GetShrinkFactor();
void SetShrinkFactor(float value ); void SetShrinkFactor(float value );
void GetChildActors(vtkActorCollection*); bool IsShrunkable() { return myIsShrinkable;}
bool IsShrunk() { return myIsShrunk;}
void SetShrink();
void UnShrink();
void SetVisibility(bool visibility); void SetPointsLabeled(bool theIsPointsLabeled);
bool GetPointsLabeled(){ return myIsPointsLabeled;}
void SetCellsLabeled(bool theIsCellsLabeled);
bool GetCellsLabeled(){ return myIsCellsLabeled;}
enum eControl{eNone, eLengthEdges, eFreeBorders, eMultiConnection,
eArea, eTaper, eAspectRatio, eMinimumAngle, eWarping, eSkew};
void SetControlMode(eControl theMode);
eControl GetControlMode(){ return myColorMode;}
enum e1DControl{e1DNone, e1DColored, e1DHighlited};
e1DControl Get1DControlMode(){ return my1DColorMode;}
vtkScalarBarActor* GetScalarBarActor(){ return myScalarBarActor;}
TVisualObjPtr GetObject() { return myVisualObj;}
protected: protected:
TVisualObjPtr myVisualObj;
SMESH::FilterManager_var myFilterMgr;
vtkScalarBarActor* myScalarBarActor;
vtkLookupTable* myLookupTable;
vtkProperty* mySurfaceProp;
vtkProperty* myBackSurfaceProp;
vtkProperty* myEdgeProp;
vtkProperty* myNodeProp;
SMESH_DeviceActor* myBaseActor;
SMESH_DeviceActor* myNodeActor;
SMESH_DeviceActor* myPickableActor;
vtkProperty* myHighlightProp;
vtkProperty* myPreselectProp;
SMESH_DeviceActor* myHighlitableActor;
eControl myColorMode;
SMESH_DeviceActor* my2DActor;
SMESH_DeviceActor* my3DActor;
SMESH_DeviceActor* myControlActor;
e1DControl my1DColorMode;
vtkProperty* my1DProp;
SMESH_DeviceActor* my1DActor;
vtkProperty* my1DExtProp;
SMESH_DeviceActor* my1DExtActor;
bool myIsPointsVisible;
bool myIsShrinkable;
bool myIsShrunk;
bool myIsPointsLabeled;
vtkUnstructuredGrid* myPointsNumDataSet;
vtkActor2D *myPointLabels;
vtkMaskPoints* myPtsMaskPoints;
vtkLabeledDataMapper* myPtsLabeledDataMapper;
vtkSelectVisiblePoints* myPtsSelectVisiblePoints;
bool myIsCellsLabeled;
vtkUnstructuredGrid* myCellsNumDataSet;
vtkActor2D *myCellsLabels;
vtkMaskPoints* myClsMaskPoints;
vtkCellCenters* myCellCenters;
vtkLabeledDataMapper* myClsLabeledDataMapper;
vtkSelectVisiblePoints* myClsSelectVisiblePoints;
SMESH_Actor(); SMESH_Actor();
~SMESH_Actor(); ~SMESH_Actor();
SMESH_Actor(const SMESH_Actor&) {};
void operator=(const SMESH_Actor&) {};
vtkUnstructuredGridReader* myReader; void Init(TVisualObjPtr theVisualObj,
SMESH::FilterManager_ptr theFilterMgr,
const char* theEntry,
const char* theName,
int theIsClear);
float myShrinkFactor; void SetUnstructuredGrid(vtkUnstructuredGrid* theGrid);
void SetIsShrunkable(bool theShrunkable);
void UpdateHighlight();
RGBStruct edgeColor; private:
RGBStruct edgeHighlightColor; // hide the two parameter Render() method from the user and the compiler.
RGBStruct edgePreselectedColor; virtual void Render(vtkRenderer *, vtkMapper *) {};
virtual void ShallowCopy(vtkProp *prop);
RGBStruct actorColor; virtual void SetMapper(vtkMapper *);
RGBStruct actorHighlightColor; static SMESH_Actor* New();
RGBStruct actorPreselectedColor;
RGBStruct actorNodeColor; // LPN
int actorNodeSize; // LPN
// Not implemented.
SMESH_Actor(const SMESH_Actor&);
void operator=(const SMESH_Actor&);
}; };
#endif //SMESH_ACTOR_H #endif //SMESH_ACTOR_H

View File

@ -123,7 +123,7 @@ EXPORT_HEADERS= \
#SMDS_MeshNodeIDFactory.hxx #SMDS_MeshNodeIDFactory.hxx
# additionnal information to compil and link file # additionnal information to compil and link file
CPPFLAGS += -I${KERNEL_ROOT_DIR}/include/salome CPPFLAGS += -I${KERNEL_ROOT_DIR}/include/salome $(BOOST_CPPFLAGS)
CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome
LDFLAGS += -L${KERNEL_ROOT_DIR}/lib/salome LDFLAGS += -L${KERNEL_ROOT_DIR}/lib/salome

View File

@ -38,7 +38,6 @@ class SMDS_EdgePosition:public SMDS_Position
SMDS_TypeOfPosition GetTypeOfPosition() const; SMDS_TypeOfPosition GetTypeOfPosition() const;
void SetUParameter(double aUparam); void SetUParameter(double aUparam);
double GetUParameter() const; double GetUParameter() const;
~SMDS_EdgePosition();
private: private:

View File

@ -55,39 +55,44 @@ SMDSAbs_ElementType SMDS_FaceOfEdges::GetType() const
return SMDSAbs_Face; return SMDSAbs_Face;
} }
SMDS_Iterator<const SMDS_MeshElement *> * SMDS_FaceOfEdges:: class SMDS_FaceOfEdges_MyIterator:public SMDS_ElemIterator
{
const vector<const SMDS_MeshEdge*>& mySet;
int index;
public:
SMDS_FaceOfEdges_MyIterator(const vector<const SMDS_MeshEdge*>& s):
mySet(s),index(0) {}
bool more()
{
return index<mySet.size();
}
const SMDS_MeshElement* next()
{
index++;
return mySet[index-1];
}
};
SMDS_ElemIteratorPtr SMDS_FaceOfEdges::
elementsIterator(SMDSAbs_ElementType type) const elementsIterator(SMDSAbs_ElementType type) const
{ {
class MyIterator:public SMDS_Iterator<const SMDS_MeshElement*>
{
const vector<const SMDS_MeshEdge*>& mySet;
int index;
public:
MyIterator(const vector<const SMDS_MeshEdge*>& s):mySet(s),index(0)
{}
bool more()
{
return index<mySet.size();
}
const SMDS_MeshElement* next()
{
index++;
return mySet[index-1];
}
};
switch(type) switch(type)
{ {
case SMDSAbs_Face:return SMDS_MeshElement::elementsIterator(SMDSAbs_Face); case SMDSAbs_Face:
case SMDSAbs_Edge:return new MyIterator(myEdges); return SMDS_MeshElement::elementsIterator(SMDSAbs_Face);
default:return new SMDS_IteratorOfElements(this,type,new MyIterator(myEdges)); case SMDSAbs_Edge:
return SMDS_ElemIteratorPtr(new SMDS_FaceOfEdges_MyIterator(myEdges));
default:
return SMDS_ElemIteratorPtr
(new SMDS_IteratorOfElements
(this,type, SMDS_ElemIteratorPtr(new SMDS_FaceOfEdges_MyIterator(myEdges))));
} }
} }
SMDS_FaceOfEdges::SMDS_FaceOfEdges(SMDS_MeshEdge* edge1, SMDS_MeshEdge* edge2, SMDS_FaceOfEdges::SMDS_FaceOfEdges(const SMDS_MeshEdge* edge1,
SMDS_MeshEdge* edge3) const SMDS_MeshEdge* edge2,
const SMDS_MeshEdge* edge3)
{ {
myEdges.resize(3); myEdges.resize(3);
myEdges[0]=edge1; myEdges[0]=edge1;
@ -95,8 +100,10 @@ SMDS_FaceOfEdges::SMDS_FaceOfEdges(SMDS_MeshEdge* edge1, SMDS_MeshEdge* edge2,
myEdges[2]=edge3; myEdges[2]=edge3;
} }
SMDS_FaceOfEdges::SMDS_FaceOfEdges(SMDS_MeshEdge* edge1, SMDS_MeshEdge* edge2, SMDS_FaceOfEdges::SMDS_FaceOfEdges(const SMDS_MeshEdge* edge1,
SMDS_MeshEdge* edge3, SMDS_MeshEdge* edge4) const SMDS_MeshEdge* edge2,
const SMDS_MeshEdge* edge3,
const SMDS_MeshEdge* edge4)
{ {
myEdges.resize(4); myEdges.resize(4);
myEdges[0]=edge1; myEdges[0]=edge1;
@ -108,7 +115,7 @@ SMDS_FaceOfEdges::SMDS_FaceOfEdges(SMDS_MeshEdge* edge1, SMDS_MeshEdge* edge2,
/*bool operator<(const SMDS_FaceOfEdges& f1, const SMDS_FaceOfEdges& f2) /*bool operator<(const SMDS_FaceOfEdges& f1, const SMDS_FaceOfEdges& f2)
{ {
set<SMDS_MeshNode> set1,set2; set<SMDS_MeshNode> set1,set2;
SMDS_Iterator<const SMDS_MeshElement*> * it; SMDS_ElemIteratorPtr it;
const SMDS_MeshNode * n; const SMDS_MeshNode * n;
it=f1.nodesIterator(); it=f1.nodesIterator();

View File

@ -31,10 +31,13 @@ class SMDS_FaceOfEdges:public SMDS_MeshFace
{ {
public: public:
void Print(ostream & OS) const; void Print(ostream & OS) const;
SMDS_FaceOfEdges(SMDS_MeshEdge* edge1, SMDS_MeshEdge* edge2, SMDS_FaceOfEdges(const SMDS_MeshEdge* edge1,
SMDS_MeshEdge* edge3); const SMDS_MeshEdge* edge2,
SMDS_FaceOfEdges(SMDS_MeshEdge* edge1, SMDS_MeshEdge* edge2, const SMDS_MeshEdge* edge3);
SMDS_MeshEdge* edge3, SMDS_MeshEdge* edge4); SMDS_FaceOfEdges(const SMDS_MeshEdge* edge1,
const SMDS_MeshEdge* edge2,
const SMDS_MeshEdge* edge3,
const SMDS_MeshEdge* edge4);
SMDSAbs_ElementType GetType() const; SMDSAbs_ElementType GetType() const;
int NbEdges() const; int NbEdges() const;
@ -42,7 +45,7 @@ class SMDS_FaceOfEdges:public SMDS_MeshFace
// friend bool operator<(const SMDS_FaceOfEdges& e1, const SMDS_FaceOfEdges& e2); // friend bool operator<(const SMDS_FaceOfEdges& e1, const SMDS_FaceOfEdges& e2);
protected: protected:
SMDS_Iterator<const SMDS_MeshElement *> * SMDS_ElemIteratorPtr
elementsIterator(SMDSAbs_ElementType type) const; elementsIterator(SMDSAbs_ElementType type) const;
private: private:

View File

@ -56,42 +56,47 @@ void SMDS_FaceOfNodes::Print(ostream & OS) const
OS << myNodes[i] << ") " << endl; OS << myNodes[i] << ") " << endl;
} }
SMDS_Iterator<const SMDS_MeshElement *> * SMDS_FaceOfNodes:: class SMDS_FaceOfNodes_MyIterator:public SMDS_ElemIterator
{
const vector<const SMDS_MeshNode*>& mySet;
int index;
public:
SMDS_FaceOfNodes_MyIterator(const vector<const SMDS_MeshNode*>& s):
mySet(s),index(0) {}
bool more()
{
return index<mySet.size();
}
const SMDS_MeshElement* next()
{
index++;
return mySet[index-1];
}
};
SMDS_ElemIteratorPtr SMDS_FaceOfNodes::
elementsIterator(SMDSAbs_ElementType type) const elementsIterator(SMDSAbs_ElementType type) const
{ {
class MyIterator:public SMDS_Iterator<const SMDS_MeshElement*> switch(type)
{ {
const vector<const SMDS_MeshNode*>& mySet; case SMDSAbs_Face:
int index; return SMDS_MeshElement::elementsIterator(SMDSAbs_Face);
public: case SMDSAbs_Node:
MyIterator(const vector<const SMDS_MeshNode*>& s):mySet(s),index(0) return SMDS_ElemIteratorPtr(new SMDS_FaceOfNodes_MyIterator(myNodes));
{} case SMDSAbs_Edge:
MESSAGE("Error : edge iterator for SMDS_FaceOfNodes not implemented");
bool more() break;
{ default:
return index<mySet.size(); return SMDS_ElemIteratorPtr
} (new SMDS_IteratorOfElements
(this,type,SMDS_ElemIteratorPtr(new SMDS_FaceOfNodes_MyIterator(myNodes))));
const SMDS_MeshElement* next() }
{
index++;
return mySet[index-1];
}
};
switch(type)
{
case SMDSAbs_Face:return SMDS_MeshElement::elementsIterator(SMDSAbs_Face);
case SMDSAbs_Node:return new MyIterator(myNodes);
case SMDSAbs_Edge:
MESSAGE("Error : edge iterator for SMDS_FaceOfNodes not implemented");
break;
default:return new SMDS_IteratorOfElements(this,type,new MyIterator(myNodes));
}
} }
SMDS_FaceOfNodes::SMDS_FaceOfNodes(SMDS_MeshNode* node1, SMDS_MeshNode* node2, SMDS_FaceOfNodes::SMDS_FaceOfNodes(const SMDS_MeshNode* node1,
SMDS_MeshNode* node3) const SMDS_MeshNode* node2,
const SMDS_MeshNode* node3)
{ {
myNodes.resize(3); myNodes.resize(3);
myNodes[0]=node1; myNodes[0]=node1;
@ -99,8 +104,10 @@ SMDS_FaceOfNodes::SMDS_FaceOfNodes(SMDS_MeshNode* node1, SMDS_MeshNode* node2,
myNodes[2]=node3; myNodes[2]=node3;
} }
SMDS_FaceOfNodes::SMDS_FaceOfNodes(SMDS_MeshNode* node1, SMDS_MeshNode* node2, SMDS_FaceOfNodes::SMDS_FaceOfNodes(const SMDS_MeshNode* node1,
SMDS_MeshNode* node3, SMDS_MeshNode* node4) const SMDS_MeshNode* node2,
const SMDS_MeshNode* node3,
const SMDS_MeshNode* node4)
{ {
myNodes.resize(4); myNodes.resize(4);
myNodes[0]=node1; myNodes[0]=node1;
@ -112,7 +119,7 @@ SMDS_FaceOfNodes::SMDS_FaceOfNodes(SMDS_MeshNode* node1, SMDS_MeshNode* node2,
/*bool operator<(const SMDS_FaceOfNodes& f1, const SMDS_FaceOfNodes& f2) /*bool operator<(const SMDS_FaceOfNodes& f1, const SMDS_FaceOfNodes& f2)
{ {
set<SMDS_MeshNode> set1,set2; set<SMDS_MeshNode> set1,set2;
SMDS_Iterator<const SMDS_MeshElement*> * it; SMDS_ElemIteratorPtr it;
const SMDS_MeshNode * n; const SMDS_MeshNode * n;
it=f1.nodesIterator(); it=f1.nodesIterator();

View File

@ -31,16 +31,19 @@ class SMDS_FaceOfNodes:public SMDS_MeshFace
{ {
public: public:
void Print(ostream & OS) const; void Print(ostream & OS) const;
SMDS_FaceOfNodes(SMDS_MeshNode* node1, SMDS_MeshNode* node2, SMDS_FaceOfNodes(const SMDS_MeshNode* node1,
SMDS_MeshNode* node3); const SMDS_MeshNode* node2,
SMDS_FaceOfNodes(SMDS_MeshNode* node1, SMDS_MeshNode* node2, const SMDS_MeshNode* node3);
SMDS_MeshNode* node3, SMDS_MeshNode* node4); SMDS_FaceOfNodes(const SMDS_MeshNode* node1,
const SMDS_MeshNode* node2,
const SMDS_MeshNode* node3,
const SMDS_MeshNode* node4);
int NbEdges() const; int NbEdges() const;
int NbFaces() const; int NbFaces() const;
int NbNodes() const; int NbNodes() const;
protected: protected:
SMDS_Iterator<const SMDS_MeshElement *> * SMDS_ElemIteratorPtr
elementsIterator(SMDSAbs_ElementType type) const; elementsIterator(SMDSAbs_ElementType type) const;
private: private:

View File

@ -29,14 +29,14 @@
/// 5,1 and 7,3 are an edges. /// 5,1 and 7,3 are an edges.
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
SMDS_HexahedronOfNodes::SMDS_HexahedronOfNodes( SMDS_HexahedronOfNodes::SMDS_HexahedronOfNodes(
SMDS_MeshNode * node1, const SMDS_MeshNode * node1,
SMDS_MeshNode * node2, const SMDS_MeshNode * node2,
SMDS_MeshNode * node3, const SMDS_MeshNode * node3,
SMDS_MeshNode * node4, const SMDS_MeshNode * node4,
SMDS_MeshNode * node5, const SMDS_MeshNode * node5,
SMDS_MeshNode * node6, const SMDS_MeshNode * node6,
SMDS_MeshNode * node7, const SMDS_MeshNode * node7,
SMDS_MeshNode * node8) const SMDS_MeshNode * node8)
{ {
myNodes[0]=node1; myNodes[0]=node1;
myNodes[1]=node2; myNodes[1]=node2;
@ -75,18 +75,18 @@ int SMDS_HexahedronOfNodes::NbEdges() const
return 12; return 12;
} }
SMDS_Iterator<const SMDS_MeshElement *> * SMDS_HexahedronOfNodes:: SMDS_ElemIteratorPtr SMDS_HexahedronOfNodes::
elementsIterator(SMDSAbs_ElementType type) const elementsIterator(SMDSAbs_ElementType type) const
{ {
switch(type) switch(type)
{ {
case SMDSAbs_Volume: case SMDSAbs_Volume:
return SMDS_MeshElement::elementsIterator(SMDSAbs_Volume); return SMDS_MeshElement::elementsIterator(SMDSAbs_Volume);
case SMDSAbs_Node: case SMDSAbs_Node:
return new SMDS_IteratorOfArray<const SMDS_MeshElement *, 8, return SMDS_ElemIteratorPtr (new SMDS_IteratorOfArray<const SMDS_MeshElement *, 8,
const SMDS_MeshNode*>(myNodes); const SMDS_MeshNode*>(myNodes));
default: MESSAGE("ERROR : Iterator not implemented"); default: MESSAGE("ERROR : Iterator not implemented");
} }
} }
SMDSAbs_ElementType SMDS_HexahedronOfNodes::GetType() const SMDSAbs_ElementType SMDS_HexahedronOfNodes::GetType() const

View File

@ -36,14 +36,14 @@ class SMDS_HexahedronOfNodes:public SMDS_MeshVolume
public: public:
SMDS_HexahedronOfNodes( SMDS_HexahedronOfNodes(
SMDS_MeshNode * node1, const SMDS_MeshNode * node1,
SMDS_MeshNode * node2, const SMDS_MeshNode * node2,
SMDS_MeshNode * node3, const SMDS_MeshNode * node3,
SMDS_MeshNode * node4, const SMDS_MeshNode * node4,
SMDS_MeshNode * node5, const SMDS_MeshNode * node5,
SMDS_MeshNode * node6, const SMDS_MeshNode * node6,
SMDS_MeshNode * node7, const SMDS_MeshNode * node7,
SMDS_MeshNode * node8); const SMDS_MeshNode * node8);
void Print(ostream & OS) const; void Print(ostream & OS) const;
int NbFaces() const; int NbFaces() const;
@ -51,7 +51,7 @@ class SMDS_HexahedronOfNodes:public SMDS_MeshVolume
int NbEdges() const; int NbEdges() const;
SMDSAbs_ElementType GetType() const; SMDSAbs_ElementType GetType() const;
protected: protected:
SMDS_Iterator<const SMDS_MeshElement *> * SMDS_ElemIteratorPtr
elementsIterator(SMDSAbs_ElementType type) const; elementsIterator(SMDSAbs_ElementType type) const;
const SMDS_MeshNode * myNodes[8]; const SMDS_MeshNode * myNodes[8];
}; };

View File

@ -36,7 +36,11 @@ template<typename VALUE> class SMDS_Iterator
virtual VALUE next()=0; virtual VALUE next()=0;
/// Delete the current element and step to the next one /// Delete the current element and step to the next one
virtual void remove(){}; virtual void remove(){}
/// Provide virtual destructor just for case if some derived iterator
/// must have a destructor
virtual ~SMDS_Iterator(){}
}; };
#endif #endif

View File

@ -27,7 +27,6 @@ bool SMDS_IteratorOfElements::subMore()
{ {
if(t1Iterator->more()) if(t1Iterator->more())
{ {
if(t2Iterator!=NULL) delete t2Iterator;
t2Iterator=t1Iterator->next()->elementsIterator(myType); t2Iterator=t1Iterator->next()->elementsIterator(myType);
return subMore(); return subMore();
} }
@ -39,13 +38,8 @@ bool SMDS_IteratorOfElements::subMore()
const SMDS_MeshElement * SMDS_IteratorOfElements::subNext() const SMDS_MeshElement * SMDS_IteratorOfElements::subNext()
{ {
if((t2Iterator==NULL)||(!t2Iterator->more())) if((t2Iterator==NULL)||(!t2Iterator->more()))
{
if(t1Iterator->more()) if(t1Iterator->more())
{
if(t2Iterator!=NULL) delete t2Iterator;
t2Iterator=t1Iterator->next()->elementsIterator(myType); t2Iterator=t1Iterator->next()->elementsIterator(myType);
}
}
return t2Iterator->next(); return t2Iterator->next();
} }
@ -54,9 +48,12 @@ const SMDS_MeshElement * SMDS_IteratorOfElements::subNext()
/// to the element element. it is the iterator to get connectivity of element /// to the element element. it is the iterator to get connectivity of element
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
SMDS_IteratorOfElements::SMDS_IteratorOfElements(const SMDS_MeshElement * element, SMDS_IteratorOfElements::SMDS_IteratorOfElements(const SMDS_MeshElement * element,
SMDSAbs_ElementType type, SMDS_Iterator<const SMDS_MeshElement *>* it) SMDSAbs_ElementType type,
:t1Iterator(it), t2Iterator(NULL), myType(type), myElement(element), const SMDS_ElemIteratorPtr& it)
myProxyElement(NULL) : t1Iterator(it),
t2Iterator(SMDS_ElemIteratorPtr((SMDS_ElemIterator*)NULL)),
myType(type), myElement(element),
myProxyElement(NULL)
{ {
while(subMore()) while(subMore())
alreadyReturnedElements.insert(subNext()); alreadyReturnedElements.insert(subNext());
@ -81,7 +78,7 @@ bool SMDS_IteratorOfElements::more()
if(myReverseIteration) if(myReverseIteration)
{ {
SMDS_Iterator<const SMDS_MeshElement*> * it= SMDS_ElemIteratorPtr it=
myProxyElement->elementsIterator(myElement->GetType()); myProxyElement->elementsIterator(myElement->GetType());
while(it->more()) while(it->more())
{ {
@ -103,9 +100,3 @@ const SMDS_MeshElement * SMDS_IteratorOfElements::next()
myProxyElement=NULL; myProxyElement=NULL;
return e; return e;
} }
SMDS_IteratorOfElements::~SMDS_IteratorOfElements()
{
delete t1Iterator;
if(t2Iterator!=NULL) delete t2Iterator;
}

View File

@ -25,7 +25,7 @@
using namespace std; using namespace std;
class SMDS_IteratorOfElements:public SMDS_Iterator<const SMDS_MeshElement *> class SMDS_IteratorOfElements:public SMDS_ElemIterator
{ {
public: public:
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
@ -33,14 +33,14 @@ class SMDS_IteratorOfElements:public SMDS_Iterator<const SMDS_MeshElement *>
/// to the element element. it is the iterator to get connectivity of element /// to the element element. it is the iterator to get connectivity of element
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
SMDS_IteratorOfElements(const SMDS_MeshElement * element, SMDS_IteratorOfElements(const SMDS_MeshElement * element,
SMDSAbs_ElementType type, SMDS_Iterator<const SMDS_MeshElement *>* it); SMDSAbs_ElementType type,
const SMDS_ElemIteratorPtr& it);
bool more(); bool more();
const SMDS_MeshElement * next(); const SMDS_MeshElement * next();
~SMDS_IteratorOfElements();
private: private:
SMDS_Iterator<const SMDS_MeshElement *> * t2Iterator; SMDS_ElemIteratorPtr t2Iterator;
SMDS_Iterator<const SMDS_MeshElement *> * t1Iterator; SMDS_ElemIteratorPtr t1Iterator;
SMDSAbs_ElementType myType; SMDSAbs_ElementType myType;
const SMDS_MeshElement * myProxyElement; const SMDS_MeshElement * myProxyElement;
const SMDS_MeshElement * myElement; const SMDS_MeshElement * myElement;

File diff suppressed because it is too large Load Diff

View File

@ -34,201 +34,281 @@
#include "SMDS_MeshElementIDFactory.hxx" #include "SMDS_MeshElementIDFactory.hxx"
#include "SMDS_Iterator.hxx" #include "SMDS_Iterator.hxx"
#include <boost/shared_ptr.hpp>
#include <set> #include <set>
#include <list> #include <list>
class SMDSControl_BoundaryEdges; class SMDSControl_BoundaryEdges;
class SMDS_Mesh:public SMDS_MeshObject typedef SMDS_Iterator<const SMDS_MeshNode *> SMDS_NodeIterator;
{ typedef boost::shared_ptr<SMDS_Iterator<const SMDS_MeshNode *> > SMDS_NodeIteratorPtr;
typedef SMDS_Iterator<const SMDS_MeshEdge *> SMDS_EdgeIterator;
typedef boost::shared_ptr<SMDS_Iterator<const SMDS_MeshEdge *> > SMDS_EdgeIteratorPtr;
typedef SMDS_Iterator<const SMDS_MeshFace *> SMDS_FaceIterator;
typedef boost::shared_ptr<SMDS_Iterator<const SMDS_MeshFace *> > SMDS_FaceIteratorPtr;
typedef SMDS_Iterator<const SMDS_MeshVolume *> SMDS_VolumeIterator;
typedef boost::shared_ptr<SMDS_Iterator<const SMDS_MeshVolume *> > SMDS_VolumeIteratorPtr;
public: class SMDS_Mesh:public SMDS_MeshObject{
public:
SMDS_Mesh();
SMDS_NodeIteratorPtr nodesIterator() const;
SMDS_EdgeIteratorPtr edgesIterator() const;
SMDS_FaceIteratorPtr facesIterator() const;
SMDS_VolumeIteratorPtr volumesIterator() const;
SMDS_Mesh *AddSubMesh();
virtual SMDS_MeshNode* AddNodeWithID(double x, double y, double z, int ID);
virtual SMDS_MeshNode* AddNode(double x, double y, double z);
virtual SMDS_MeshEdge* AddEdgeWithID(int n1, int n2, int ID);
virtual SMDS_MeshEdge* AddEdgeWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
int ID);
virtual SMDS_MeshEdge* AddEdge(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2);
virtual SMDS_MeshFace* AddFaceWithID(int n1, int n2, int n3, int ID);
virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
int ID);
virtual SMDS_MeshFace* AddFace(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3);
virtual SMDS_MeshFace* AddFaceWithID(int n1, int n2, int n3, int n4, int ID);
virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
int ID);
virtual SMDS_MeshFace* AddFace(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4);
virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshEdge * e1,
const SMDS_MeshEdge * e2,
const SMDS_MeshEdge * e3, int ID);
virtual SMDS_MeshFace* AddFace(const SMDS_MeshEdge * e1,
const SMDS_MeshEdge * e2,
const SMDS_MeshEdge * e3);
SMDS_Mesh(); virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshEdge * e1,
const SMDS_MeshEdge * e2,
const SMDS_MeshEdge * e3,
const SMDS_MeshEdge * e4, int ID);
virtual SMDS_MeshFace* AddFace(const SMDS_MeshEdge * e1,
const SMDS_MeshEdge * e2,
const SMDS_MeshEdge * e3,
const SMDS_MeshEdge * e4);
SMDS_Iterator<const SMDS_MeshNode *> * nodesIterator() const; virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4, int ID);
SMDS_Iterator<const SMDS_MeshEdge *> * edgesIterator() const; virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
SMDS_Iterator<const SMDS_MeshFace *> * facesIterator() const; const SMDS_MeshNode * n2,
SMDS_Iterator<const SMDS_MeshVolume *> * volumesIterator() const; const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
int ID);
virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4);
virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4,
int n5, int ID);
virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
int ID);
virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5);
virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4,
int n5, int n6, int ID);
virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n6,
int ID);
virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n6);
virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4,
int n5, int n6, int n7, int n8, int ID);
virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n6,
const SMDS_MeshNode * n7,
const SMDS_MeshNode * n8,
int ID);
virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n6,
const SMDS_MeshNode * n7,
const SMDS_MeshNode * n8);
SMDS_Mesh *AddSubMesh(); virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshFace * f1,
virtual SMDS_MeshNode* AddNode(double x, double y, double z); const SMDS_MeshFace * f2,
virtual SMDS_MeshNode* AddNodeWithID(double x, double y, double z, int ID); const SMDS_MeshFace * f3,
const SMDS_MeshFace * f4, int ID);
virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshFace * f1,
const SMDS_MeshFace * f2,
const SMDS_MeshFace * f3,
const SMDS_MeshFace * f4);
virtual SMDS_MeshEdge* AddEdge( virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshFace * f1,
const SMDS_MeshNode * n1, const SMDS_MeshFace * f2,
const SMDS_MeshNode * n2); const SMDS_MeshFace * f3,
virtual SMDS_MeshFace* AddFace( const SMDS_MeshFace * f4,
const SMDS_MeshNode * n1, const SMDS_MeshFace * f5, int ID);
const SMDS_MeshNode * n2, virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshFace * f1,
const SMDS_MeshNode * n3); const SMDS_MeshFace * f2,
virtual SMDS_MeshFace* AddFace( const SMDS_MeshFace * f3,
const SMDS_MeshNode * n1, const SMDS_MeshFace * f4,
const SMDS_MeshNode * n2, const SMDS_MeshFace * f5);
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4);
virtual SMDS_MeshVolume* AddVolume(
const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4);
virtual SMDS_MeshVolume* AddVolume(
const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5);
virtual SMDS_MeshVolume* AddVolume(
const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n6);
virtual SMDS_MeshVolume* AddVolume(
const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n6,
const SMDS_MeshNode * n7,
const SMDS_MeshNode * n8);
SMDS_MeshEdge* AddEdgeWithID(int n1, int n2, int ID); virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshFace * f1,
SMDS_MeshFace* AddFaceWithID(int n1, int n2, int n3, int ID); const SMDS_MeshFace * f2,
SMDS_MeshFace* AddFaceWithID(int n1, int n2, int n3, int n4, const SMDS_MeshFace * f3,
int ID); const SMDS_MeshFace * f4,
SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4, const SMDS_MeshFace * f5,
int ID); const SMDS_MeshFace * f6, int ID);
SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4, virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshFace * f1,
int n5, int ID); const SMDS_MeshFace * f2,
SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4, const SMDS_MeshFace * f3,
int n5, int n6, int ID); const SMDS_MeshFace * f4,
SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4, const SMDS_MeshFace * f5,
int n5, int n6, int n7, int n8, int ID); const SMDS_MeshFace * f6);
SMDS_MeshEdge* AddEdgeWithID( virtual void RemoveElement(const SMDS_MeshElement * elem,
const SMDS_MeshNode * n1, list<const SMDS_MeshElement *>& removedElems,
const SMDS_MeshNode * n2, int ID); list<const SMDS_MeshElement *>& removedNodes,
SMDS_MeshFace* AddFaceWithID( const bool removenodes = false);
const SMDS_MeshNode * n1, virtual void RemoveElement(const SMDS_MeshElement * elem, const bool removenodes = false);
const SMDS_MeshNode * n2, virtual void RemoveNode(const SMDS_MeshNode * node);
const SMDS_MeshNode * n3, int ID); virtual void RemoveEdge(const SMDS_MeshEdge * edge);
SMDS_MeshFace* AddFaceWithID( virtual void RemoveFace(const SMDS_MeshFace * face);
const SMDS_MeshNode * n1, virtual void RemoveVolume(const SMDS_MeshVolume * volume);
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3, virtual bool RemoveFromParent();
const SMDS_MeshNode * n4, int ID); virtual bool RemoveSubMesh(const SMDS_Mesh * aMesh);
SMDS_MeshVolume* AddVolumeWithID(
const SMDS_MeshNode * n1, const SMDS_MeshNode *FindNode(int idnode) const;
const SMDS_MeshNode * n2, const SMDS_MeshEdge *FindEdge(int idnode1, int idnode2) const;
const SMDS_MeshNode * n3, const SMDS_MeshFace *FindFace(int idnode1, int idnode2, int idnode3) const;
const SMDS_MeshNode * n4, int ID); const SMDS_MeshFace *FindFace(int idnode1, int idnode2, int idnode3, int idnode4) const;
SMDS_MeshVolume* AddVolumeWithID( const SMDS_MeshElement *FindElement(int IDelem) const;
const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5, int ID);
SMDS_MeshVolume* AddVolumeWithID(
const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n6, int ID);
SMDS_MeshVolume* AddVolumeWithID(
const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n6,
const SMDS_MeshNode * n7,
const SMDS_MeshNode * n8, int ID);
virtual void RemoveElement(const SMDS_MeshElement * elem, const bool removenodes =
false);
virtual void RemoveNode(const SMDS_MeshNode * node);
virtual void RemoveEdge(const SMDS_MeshEdge * edge);
virtual void RemoveFace(const SMDS_MeshFace * face);
virtual void RemoveVolume(const SMDS_MeshVolume * volume);
virtual bool RemoveFromParent();
virtual bool RemoveSubMesh(const SMDS_Mesh * aMesh);
const SMDS_MeshNode *FindNode(int idnode) const; int NbNodes() const;
const SMDS_MeshEdge *FindEdge(int idnode1, int idnode2) const; int NbEdges() const;
const SMDS_MeshFace *FindFace(int idnode1, int idnode2, int idnode3) const; int NbFaces() const;
const SMDS_MeshFace *FindFace(int idnode1, int idnode2, int idnode3, int idnode4) const; int NbVolumes() const;
const SMDS_MeshElement *FindElement(int IDelem) const; int NbSubMesh() const;
void DumpNodes() const;
int NbNodes() const; void DumpEdges() const;
int NbEdges() const; void DumpFaces() const;
int NbFaces() const; void DumpVolumes() const;
int NbVolumes() const; void DebugStats() const;
int NbSubMesh() const; SMDS_Mesh *boundaryFaces();
void DumpNodes() const; SMDS_Mesh *boundaryEdges();
void DumpEdges() const; virtual ~SMDS_Mesh();
void DumpFaces() const; bool hasConstructionEdges();
void DumpVolumes() const; bool hasConstructionFaces();
void DebugStats() const; bool hasInverseElements();
SMDS_Mesh *boundaryFaces(); void setConstructionEdges(bool);
SMDS_Mesh *boundaryEdges(); void setConstructionFaces(bool);
virtual ~SMDS_Mesh(); void setInverseElements(bool);
bool hasConstructionEdges();
bool hasConstructionFaces();
bool hasInverseElements();
void setConstructionEdges(bool);
void setConstructionFaces(bool);
void setInverseElements(bool);
private: /*!
SMDS_Mesh(SMDS_Mesh * parent); * Checks if the element is present in mesh.
SMDS_MeshFace * createTriangle(SMDS_MeshNode * node1, * Useful to determine dead pointers.
SMDS_MeshNode * node2, SMDS_MeshNode * node3); * Use this function for debug purpose only! Do not check in the code
SMDS_MeshFace * createQuadrangle(SMDS_MeshNode * node1, * using it even in _DEBUG_ mode
SMDS_MeshNode * node2, SMDS_MeshNode * node3, SMDS_MeshNode * node4); */
const SMDS_MeshEdge* FindEdge(const SMDS_MeshNode * n1, bool Contains (const SMDS_MeshElement* elem) const;
const SMDS_MeshNode * n2) const;
SMDS_MeshEdge* FindEdgeOrCreate(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2);
SMDS_MeshFace* FindFaceOrCreate(
const SMDS_MeshNode *n1,
const SMDS_MeshNode *n2,
const SMDS_MeshNode *n3);
const SMDS_MeshFace* FindFace(
const SMDS_MeshNode *n1,
const SMDS_MeshNode *n2,
const SMDS_MeshNode *n3,
const SMDS_MeshNode *n4) const;
SMDS_MeshFace* FindFaceOrCreate(
const SMDS_MeshNode *n1,
const SMDS_MeshNode *n2,
const SMDS_MeshNode *n3,
const SMDS_MeshNode *n4);
void addChildrenWithNodes(set<const SMDS_MeshElement*>& setOfChildren,
const SMDS_MeshElement * element, set<const SMDS_MeshElement*>& nodes);
// Fields PRIVATE typedef set<SMDS_MeshNode *> SetOfNodes;
typedef set<SMDS_MeshNode *> SetOfNodes; typedef set<SMDS_MeshEdge *> SetOfEdges;
typedef set<SMDS_MeshEdge *> SetOfEdges; typedef set<SMDS_MeshFace *> SetOfFaces;
typedef set<SMDS_MeshFace *> SetOfFaces; typedef set<SMDS_MeshVolume *> SetOfVolumes;
typedef set<SMDS_MeshVolume *> SetOfVolumes;
SetOfNodes myNodes; private:
SetOfEdges myEdges; SMDS_Mesh(SMDS_Mesh * parent);
SetOfFaces myFaces;
SetOfVolumes myVolumes;
SMDS_Mesh *myParent;
list<SMDS_Mesh *> myChildren;
SMDS_MeshElementIDFactory *myNodeIDFactory;
SMDS_MeshElementIDFactory *myElementIDFactory;
bool myHasConstructionEdges; SMDS_MeshFace * createTriangle(const SMDS_MeshNode * node1,
bool myHasConstructionFaces; const SMDS_MeshNode * node2,
bool myHasInverseElements; const SMDS_MeshNode * node3);
SMDS_MeshFace * createQuadrangle(const SMDS_MeshNode * node1,
const SMDS_MeshNode * node2,
const SMDS_MeshNode * node3,
const SMDS_MeshNode * node4);
bool registerElement(int ID, SMDS_MeshElement * element);
const SMDS_MeshEdge* FindEdge(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2) const;
SMDS_MeshEdge* FindEdgeOrCreate(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2);
const SMDS_MeshFace* FindFace(const SMDS_MeshNode *n1,
const SMDS_MeshNode *n2,
const SMDS_MeshNode *n3) const;
SMDS_MeshFace* FindFaceOrCreate(const SMDS_MeshNode *n1,
const SMDS_MeshNode *n2,
const SMDS_MeshNode *n3);
const SMDS_MeshFace* FindFace(const SMDS_MeshNode *n1,
const SMDS_MeshNode *n2,
const SMDS_MeshNode *n3,
const SMDS_MeshNode *n4) const;
SMDS_MeshFace* FindFaceOrCreate(const SMDS_MeshNode *n1,
const SMDS_MeshNode *n2,
const SMDS_MeshNode *n3,
const SMDS_MeshNode *n4);
void addChildrenWithNodes(set<const SMDS_MeshElement*>& setOfChildren,
const SMDS_MeshElement * element,
set<const SMDS_MeshElement*>& nodes);
// Fields PRIVATE
SetOfNodes myNodes;
SetOfEdges myEdges;
SetOfFaces myFaces;
SetOfVolumes myVolumes;
SMDS_Mesh *myParent;
list<SMDS_Mesh *> myChildren;
SMDS_MeshElementIDFactory *myNodeIDFactory;
SMDS_MeshElementIDFactory *myElementIDFactory;
bool myHasConstructionEdges;
bool myHasConstructionFaces;
bool myHasInverseElements;
}; };
#endif #endif

View File

@ -36,7 +36,8 @@
//purpose : //purpose :
//======================================================================= //=======================================================================
SMDS_MeshEdge::SMDS_MeshEdge(SMDS_MeshNode * node1, SMDS_MeshNode * node2) SMDS_MeshEdge::SMDS_MeshEdge(const SMDS_MeshNode * node1,
const SMDS_MeshNode * node2)
{ {
myNodes[0]=node1; myNodes[0]=node1;
myNodes[1]=node2; myNodes[1]=node2;
@ -68,36 +69,40 @@ SMDSAbs_ElementType SMDS_MeshEdge::GetType() const
return SMDSAbs_Edge; return SMDSAbs_Edge;
} }
SMDS_Iterator<const SMDS_MeshElement *> * SMDS_MeshEdge:: class SMDS_MeshEdge_MyNodeIterator:public SMDS_ElemIterator
{
const SMDS_MeshNode *const* myNodes;
int myIndex;
public:
SMDS_MeshEdge_MyNodeIterator(const SMDS_MeshNode * const* nodes):
myNodes(nodes),myIndex(0) {}
bool more()
{
return myIndex<2;
}
const SMDS_MeshElement* next()
{
myIndex++;
return myNodes[myIndex-1];
}
};
SMDS_ElemIteratorPtr SMDS_MeshEdge::
elementsIterator(SMDSAbs_ElementType type) const elementsIterator(SMDSAbs_ElementType type) const
{ {
class MyNodeIterator:public SMDS_Iterator<const SMDS_MeshElement *> switch(type)
{ {
SMDS_MeshNode *const* myNodes; case SMDSAbs_Edge:
int myIndex; return SMDS_MeshElement::elementsIterator(SMDSAbs_Edge);
public: case SMDSAbs_Node:
MyNodeIterator(SMDS_MeshNode * const* nodes):myNodes(nodes),myIndex(0) return SMDS_ElemIteratorPtr(new SMDS_MeshEdge_MyNodeIterator(myNodes));
{} default:
return SMDS_ElemIteratorPtr
bool more() (new SMDS_IteratorOfElements
{ (this,type, SMDS_ElemIteratorPtr(new SMDS_MeshEdge_MyNodeIterator(myNodes))));
return myIndex<2; }
}
const SMDS_MeshElement* next()
{
myIndex++;
return myNodes[myIndex-1];
}
};
switch(type)
{
case SMDSAbs_Edge:return SMDS_MeshElement::elementsIterator(SMDSAbs_Edge);
case SMDSAbs_Node:return new MyNodeIterator(myNodes);
default: return new SMDS_IteratorOfElements(this,type, nodesIterator());
}
} }
bool operator<(const SMDS_MeshEdge & e1, const SMDS_MeshEdge & e2) bool operator<(const SMDS_MeshEdge & e1, const SMDS_MeshEdge & e2)

View File

@ -34,7 +34,8 @@ class SMDS_MeshEdge:public SMDS_MeshElement
{ {
public: public:
SMDS_MeshEdge(SMDS_MeshNode * node1, SMDS_MeshNode * node2); SMDS_MeshEdge(const SMDS_MeshNode * node1,
const SMDS_MeshNode * node2);
void Print(ostream & OS) const; void Print(ostream & OS) const;
SMDSAbs_ElementType GetType() const; SMDSAbs_ElementType GetType() const;
@ -42,11 +43,11 @@ class SMDS_MeshEdge:public SMDS_MeshElement
int NbEdges() const; int NbEdges() const;
friend bool operator<(const SMDS_MeshEdge& e1, const SMDS_MeshEdge& e2); friend bool operator<(const SMDS_MeshEdge& e1, const SMDS_MeshEdge& e2);
protected: protected:
SMDS_Iterator<const SMDS_MeshElement *> * SMDS_ElemIteratorPtr
elementsIterator(SMDSAbs_ElementType type) const; elementsIterator(SMDSAbs_ElementType type) const;
private: private:
SMDS_MeshNode* myNodes[2]; const SMDS_MeshNode* myNodes[2];
}; };
#endif #endif

View File

@ -45,7 +45,7 @@ ostream & operator <<(ostream & OS, const SMDS_MeshElement * ME)
/// Create an iterator which iterate on nodes owned by the element. /// Create an iterator which iterate on nodes owned by the element.
/// This method call elementsIterator(). /// This method call elementsIterator().
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
SMDS_Iterator<const SMDS_MeshElement *> * SMDS_MeshElement::nodesIterator() const SMDS_ElemIteratorPtr SMDS_MeshElement::nodesIterator() const
{ {
return elementsIterator(SMDSAbs_Node); return elementsIterator(SMDSAbs_Node);
} }
@ -54,7 +54,7 @@ SMDS_Iterator<const SMDS_MeshElement *> * SMDS_MeshElement::nodesIterator() cons
/// Create an iterator which iterate on edges linked with or owned by the element. /// Create an iterator which iterate on edges linked with or owned by the element.
/// This method call elementsIterator(). /// This method call elementsIterator().
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
SMDS_Iterator<const SMDS_MeshElement *> * SMDS_MeshElement::edgesIterator() const SMDS_ElemIteratorPtr SMDS_MeshElement::edgesIterator() const
{ {
return elementsIterator(SMDSAbs_Edge); return elementsIterator(SMDSAbs_Edge);
} }
@ -63,7 +63,7 @@ SMDS_Iterator<const SMDS_MeshElement *> * SMDS_MeshElement::edgesIterator() cons
/// Create an iterator which iterate on faces linked with or owned by the element. /// Create an iterator which iterate on faces linked with or owned by the element.
/// This method call elementsIterator(). /// This method call elementsIterator().
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
SMDS_Iterator<const SMDS_MeshElement *> * SMDS_MeshElement::facesIterator() const SMDS_ElemIteratorPtr SMDS_MeshElement::facesIterator() const
{ {
return elementsIterator(SMDSAbs_Face); return elementsIterator(SMDSAbs_Face);
} }
@ -74,13 +74,12 @@ SMDS_Iterator<const SMDS_MeshElement *> * SMDS_MeshElement::facesIterator() cons
int SMDS_MeshElement::NbNodes() const int SMDS_MeshElement::NbNodes() const
{ {
int nbnodes=0; int nbnodes=0;
SMDS_Iterator<const SMDS_MeshElement *> * it=nodesIterator(); SMDS_ElemIteratorPtr it=nodesIterator();
while(it->more()) while(it->more())
{ {
it->next(); it->next();
nbnodes++; nbnodes++;
} }
delete it;
return nbnodes; return nbnodes;
} }
@ -90,13 +89,12 @@ int SMDS_MeshElement::NbNodes() const
int SMDS_MeshElement::NbEdges() const int SMDS_MeshElement::NbEdges() const
{ {
int nbedges=0; int nbedges=0;
SMDS_Iterator<const SMDS_MeshElement *> * it=edgesIterator(); SMDS_ElemIteratorPtr it=edgesIterator();
while(it->more()) while(it->more())
{ {
it->next(); it->next();
nbedges++; nbedges++;
} }
delete it;
return nbedges; return nbedges;
} }
@ -106,55 +104,52 @@ int SMDS_MeshElement::NbEdges() const
int SMDS_MeshElement::NbFaces() const int SMDS_MeshElement::NbFaces() const
{ {
int nbfaces=0; int nbfaces=0;
SMDS_Iterator<const SMDS_MeshElement *> * it=facesIterator(); SMDS_ElemIteratorPtr it=facesIterator();
while(it->more()) while(it->more())
{ {
it->next(); it->next();
nbfaces++; nbfaces++;
} }
delete it;
return nbfaces; return nbfaces;
} }
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
///Create and iterator which iterate on elements linked with the current element. ///Create an iterator which iterate on elements linked with the current element.
///The iterator must be free by the caller (call delete myIterator).
///@param type The of elements on which you want to iterate ///@param type The of elements on which you want to iterate
///@return An iterator, that you must free when you no longer need it ///@return A smart pointer to iterator, you are not to take care of freeing memory
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
SMDS_Iterator<const SMDS_MeshElement *> * SMDS_MeshElement:: class SMDS_MeshElement_MyIterator:public SMDS_ElemIterator
{
const SMDS_MeshElement * myElement;
bool myMore;
public:
SMDS_MeshElement_MyIterator(const SMDS_MeshElement * element):
myElement(element),myMore(true) {}
bool more()
{
return myMore;
}
const SMDS_MeshElement* next()
{
myMore=false;
return myElement;
}
};
SMDS_ElemIteratorPtr SMDS_MeshElement::
elementsIterator(SMDSAbs_ElementType type) const elementsIterator(SMDSAbs_ElementType type) const
{ {
/** @todo Check that iterator in the child classes return elements /** @todo Check that iterator in the child classes return elements
in the same order for each different implementation (i.e: SMDS_VolumeOfNodes in the same order for each different implementation (i.e: SMDS_VolumeOfNodes
and SMDS_VolumeOfFaces */ and SMDS_VolumeOfFaces */
class MyIterator:public SMDS_Iterator<const SMDS_MeshElement*>
{
const SMDS_MeshElement * myElement;
bool myMore;
public:
MyIterator(const SMDS_MeshElement * element):
myElement(element),myMore(true)
{
}
bool more()
{
return myMore;
}
const SMDS_MeshElement* next()
{
myMore=false;
return myElement;
}
};
if(type==GetType()) return new MyIterator(this); if(type==GetType())
return SMDS_ElemIteratorPtr(new SMDS_MeshElement_MyIterator(this));
else else
{ {
MESSAGE("Iterator not implemented"); MESSAGE("Iterator not implemented");
return NULL; return SMDS_ElemIteratorPtr((SMDS_ElemIterator*)NULL);
} }
} }

View File

@ -32,6 +32,7 @@
#include "SMDS_Iterator.hxx" #include "SMDS_Iterator.hxx"
#include "SMDS_MeshElementIDFactory.hxx" #include "SMDS_MeshElementIDFactory.hxx"
#include <boost/shared_ptr.hpp>
#include <vector> #include <vector>
#include <iostream> #include <iostream>
@ -39,6 +40,10 @@ using namespace std;
class SMDS_MeshNode; class SMDS_MeshNode;
class SMDS_MeshEdge; class SMDS_MeshEdge;
class SMDS_MeshFace; class SMDS_MeshFace;
class SMDS_MeshElement;
typedef SMDS_Iterator<const SMDS_MeshElement *> SMDS_ElemIterator;
typedef boost::shared_ptr<SMDS_Iterator<const SMDS_MeshElement *> > SMDS_ElemIteratorPtr;
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
/// Base class for elements /// Base class for elements
@ -47,10 +52,10 @@ class SMDS_MeshElement:public SMDS_MeshObject
{ {
public: public:
SMDS_Iterator<const SMDS_MeshElement *> * nodesIterator() const; SMDS_ElemIteratorPtr nodesIterator() const;
SMDS_Iterator<const SMDS_MeshElement *> * edgesIterator() const; SMDS_ElemIteratorPtr edgesIterator() const;
SMDS_Iterator<const SMDS_MeshElement *> * facesIterator() const; SMDS_ElemIteratorPtr facesIterator() const;
virtual SMDS_Iterator<const SMDS_MeshElement *> * virtual SMDS_ElemIteratorPtr
elementsIterator(SMDSAbs_ElementType type) const; elementsIterator(SMDSAbs_ElementType type) const;
virtual int NbNodes() const; virtual int NbNodes() const;

View File

@ -58,3 +58,27 @@ SMDS_MeshElement* SMDS_MeshElementIDFactory::MeshElement(int ID)
map<int, SMDS_MeshElement*>::iterator it=myIDElements.find(ID); map<int, SMDS_MeshElement*>::iterator it=myIDElements.find(ID);
if(it==myIDElements.end()) return NULL; else return (*it).second; if(it==myIDElements.end()) return NULL; else return (*it).second;
} }
//=======================================================================
//function : GetFreeID
//purpose :
//=======================================================================
int SMDS_MeshElementIDFactory::GetFreeID()
{
int ID;
do {
ID = SMDS_MeshIDFactory::GetFreeID();
} while (myIDElements.find(ID) != myIDElements.end());
return ID;
}
//=======================================================================
//function : ReleaseID
//purpose :
//=======================================================================
void SMDS_MeshElementIDFactory::ReleaseID(const int ID)
{
myIDElements.erase(ID);
SMDS_MeshIDFactory::ReleaseID(ID);
}

View File

@ -28,7 +28,6 @@
#define _SMDS_MeshElementIDFactory_HeaderFile #define _SMDS_MeshElementIDFactory_HeaderFile
#include "SMDS_MeshIDFactory.hxx" #include "SMDS_MeshIDFactory.hxx"
#include <SMDS_Iterator.hxx>
#include <map> #include <map>
using namespace std; using namespace std;
@ -41,6 +40,8 @@ class SMDS_MeshElementIDFactory:public SMDS_MeshIDFactory
SMDS_MeshElementIDFactory(); SMDS_MeshElementIDFactory();
bool BindID(int ID, SMDS_MeshElement * elem); bool BindID(int ID, SMDS_MeshElement * elem);
SMDS_MeshElement * MeshElement(int ID); SMDS_MeshElement * MeshElement(int ID);
virtual int GetFreeID();
virtual void ReleaseID(int ID);
private: private:
map<int, SMDS_MeshElement *> myIDElements; map<int, SMDS_MeshElement *> myIDElements;

View File

@ -32,8 +32,9 @@ using namespace std;
//purpose : //purpose :
//======================================================================= //=======================================================================
SMDS_MeshGroup::SMDS_MeshGroup(const SMDS_Mesh * aMesh) SMDS_MeshGroup::SMDS_MeshGroup(const SMDS_Mesh * theMesh,
:myMesh(aMesh),myType(SMDSAbs_All), myParent(NULL) const SMDSAbs_ElementType theType)
:myMesh(theMesh),myType(theType), myParent(NULL)
{ {
} }
@ -42,8 +43,9 @@ SMDS_MeshGroup::SMDS_MeshGroup(const SMDS_Mesh * aMesh)
//purpose : //purpose :
//======================================================================= //=======================================================================
SMDS_MeshGroup::SMDS_MeshGroup(SMDS_MeshGroup * parent) SMDS_MeshGroup::SMDS_MeshGroup(SMDS_MeshGroup * theParent,
:myMesh(parent->myMesh),myType(SMDSAbs_All), myParent(parent) const SMDSAbs_ElementType theType)
:myMesh(theParent->myMesh),myType(theType), myParent(theParent)
{ {
} }
@ -52,9 +54,10 @@ SMDS_MeshGroup::SMDS_MeshGroup(SMDS_MeshGroup * parent)
//purpose : //purpose :
//======================================================================= //=======================================================================
const SMDS_MeshGroup *SMDS_MeshGroup::AddSubGroup() const SMDS_MeshGroup *SMDS_MeshGroup::AddSubGroup
(const SMDSAbs_ElementType theType)
{ {
const SMDS_MeshGroup * subgroup = new SMDS_MeshGroup(this); const SMDS_MeshGroup * subgroup = new SMDS_MeshGroup(this,theType);
myChildren.insert(myChildren.end(),subgroup); myChildren.insert(myChildren.end(),subgroup);
return subgroup; return subgroup;
} }
@ -64,14 +67,14 @@ const SMDS_MeshGroup *SMDS_MeshGroup::AddSubGroup()
//purpose : //purpose :
//======================================================================= //=======================================================================
bool SMDS_MeshGroup::RemoveSubGroup(const SMDS_MeshGroup * aGroup) bool SMDS_MeshGroup::RemoveSubGroup(const SMDS_MeshGroup * theGroup)
{ {
bool found = false; bool found = false;
list<const SMDS_MeshGroup*>::iterator itgroup; list<const SMDS_MeshGroup*>::iterator itgroup;
for(itgroup=myChildren.begin(); itgroup!=myChildren.end(); itgroup++) for(itgroup=myChildren.begin(); itgroup!=myChildren.end(); itgroup++)
{ {
const SMDS_MeshGroup* subgroup=*itgroup; const SMDS_MeshGroup* subgroup=*itgroup;
if (subgroup == aGroup) if (subgroup == theGroup)
{ {
found = true; found = true;
myChildren.erase(itgroup); myChildren.erase(itgroup);
@ -106,39 +109,19 @@ void SMDS_MeshGroup::Clear()
myType = SMDSAbs_All; myType = SMDSAbs_All;
} }
//=======================================================================
//function : IsEmpty
//purpose :
//=======================================================================
bool SMDS_MeshGroup::IsEmpty() const
{
return myElements.empty();
}
//=======================================================================
//function : Extent
//purpose :
//=======================================================================
int SMDS_MeshGroup::Extent() const
{
return myElements.size();
}
//======================================================================= //=======================================================================
//function : Add //function : Add
//purpose : //purpose :
//======================================================================= //=======================================================================
void SMDS_MeshGroup::Add(const SMDS_MeshElement * ME) void SMDS_MeshGroup::Add(const SMDS_MeshElement * theElem)
{ {
// the type of the group is determined by the first element added // the type of the group is determined by the first element added
if (myElements.empty()) myType = ME->GetType(); if (myElements.empty()) myType = theElem->GetType();
else if (ME->GetType() != myType) else if (theElem->GetType() != myType)
MESSAGE("SMDS_MeshGroup::Add : Type Mismatch"); MESSAGE("SMDS_MeshGroup::Add : Type Mismatch");
myElements.insert(ME); myElements.insert(theElem);
} }
//======================================================================= //=======================================================================
@ -146,28 +129,29 @@ void SMDS_MeshGroup::Add(const SMDS_MeshElement * ME)
//purpose : //purpose :
//======================================================================= //=======================================================================
void SMDS_MeshGroup::Remove(const SMDS_MeshElement * ME) void SMDS_MeshGroup::Remove(const SMDS_MeshElement * theElem)
{ {
myElements.erase(ME); myElements.erase(theElem);
if (myElements.empty()) myType = SMDSAbs_All; if (myElements.empty()) myType = SMDSAbs_All;
} }
//=======================================================================
//function : Type
//purpose :
//=======================================================================
SMDSAbs_ElementType SMDS_MeshGroup::Type() const
{
return myType;
}
//======================================================================= //=======================================================================
//function : Contains //function : Contains
//purpose : //purpose :
//======================================================================= //=======================================================================
bool SMDS_MeshGroup::Contains(const SMDS_MeshElement * ME) const bool SMDS_MeshGroup::Contains(const SMDS_MeshElement * theElem) const
{ {
return myElements.find(ME)!=myElements.end(); return myElements.find(theElem)!=myElements.end();
}
//=======================================================================
//function : SetType
//purpose :
//=======================================================================
void SMDS_MeshGroup::SetType(const SMDSAbs_ElementType theType)
{
if (IsEmpty())
myType = theType;
} }

View File

@ -33,25 +33,44 @@ using namespace std;
class SMDS_MeshGroup:public SMDS_MeshObject class SMDS_MeshGroup:public SMDS_MeshObject
{ {
public: public:
SMDS_MeshGroup(const SMDS_Mesh * aMesh); SMDS_MeshGroup(const SMDS_Mesh * theMesh,
const SMDS_MeshGroup * AddSubGroup(); const SMDSAbs_ElementType theType = SMDSAbs_All);
virtual bool RemoveSubGroup(const SMDS_MeshGroup* aGroup); const SMDS_MeshGroup * AddSubGroup
(const SMDSAbs_ElementType theType = SMDSAbs_All);
virtual bool RemoveSubGroup(const SMDS_MeshGroup* theGroup);
virtual bool RemoveFromParent(); virtual bool RemoveFromParent();
void Clear();
void Add(const SMDS_MeshElement * ME); const SMDS_Mesh* GetMesh() const { return myMesh; }
void Remove(const SMDS_MeshElement * ME);
bool IsEmpty() const; void SetType (const SMDSAbs_ElementType theType);
int Extent() const; void Clear();
SMDSAbs_ElementType Type() const; void Add(const SMDS_MeshElement * theElem);
bool Contains(const SMDS_MeshElement * ME) const; void Remove(const SMDS_MeshElement * theElem);
bool IsEmpty() const { return myElements.empty(); }
~SMDS_MeshGroup(); int Extent() const { return myElements.size(); }
SMDSAbs_ElementType GetType() const { return myType; }
bool Contains(const SMDS_MeshElement * theElem) const;
void InitIterator() const
{ const_cast<iterator&>(myIterator) = myElements.begin(); }
bool More() const { return myIterator != myElements.end(); }
const SMDS_MeshElement* Next() const
{ return *(const_cast<iterator&>(myIterator))++; }
private: private:
SMDS_MeshGroup(SMDS_MeshGroup* parent); SMDS_MeshGroup(SMDS_MeshGroup* theParent,
const SMDS_Mesh *myMesh; const SMDSAbs_ElementType theType = SMDSAbs_All);
SMDSAbs_ElementType myType;
set<const SMDS_MeshElement *> myElements; typedef set<const SMDS_MeshElement *>::iterator iterator;
SMDS_MeshGroup * myParent; const SMDS_Mesh * myMesh;
list<const SMDS_MeshGroup*> myChildren; SMDSAbs_ElementType myType;
set<const SMDS_MeshElement *> myElements;
SMDS_MeshGroup * myParent;
list<const SMDS_MeshGroup*> myChildren;
iterator myIterator;
}; };
#endif #endif

View File

@ -54,5 +54,5 @@ int SMDS_MeshIDFactory::GetFreeID()
//======================================================================= //=======================================================================
void SMDS_MeshIDFactory::ReleaseID(const int ID) void SMDS_MeshIDFactory::ReleaseID(const int ID)
{ {
if (ID < myMaxID) myPoolOfID.push(ID); if (ID > 0 && ID < myMaxID) myPoolOfID.push(ID);
} }

View File

@ -61,7 +61,7 @@ void SMDS_MeshNode::Print(ostream & OS) const
//purpose : //purpose :
//======================================================================= //=======================================================================
void SMDS_MeshNode::SetPosition(SMDS_Position * aPos) void SMDS_MeshNode::SetPosition(const SMDS_PositionPtr& aPos)
{ {
myPosition = aPos; myPosition = aPos;
} }
@ -71,94 +71,92 @@ void SMDS_MeshNode::SetPosition(SMDS_Position * aPos)
//purpose : //purpose :
//======================================================================= //=======================================================================
SMDS_Position *SMDS_MeshNode::GetPosition() const SMDS_PositionPtr& SMDS_MeshNode::GetPosition() const
{ {
return myPosition; return myPosition;
} }
const SMDS_Position *SMDS_MeshNode::GetPosition() const class SMDS_MeshNode_MyInvIterator:public SMDS_ElemIterator
{ {
return myPosition; const set<const SMDS_MeshElement*>& mySet;
} set<const SMDS_MeshElement*>::iterator myIterator;
/** public:
*/ SMDS_MeshNode_MyInvIterator(const set<const SMDS_MeshElement*>& s):
SMDS_Iterator<const SMDS_MeshElement*> * SMDS_MeshNode:: mySet(s)
{
myIterator=mySet.begin();
}
bool more()
{
return myIterator!=mySet.end();
}
const SMDS_MeshElement* next()
{
const SMDS_MeshElement* current=*myIterator;
myIterator++;
return current;
}
};
SMDS_ElemIteratorPtr SMDS_MeshNode::
GetInverseElementIterator() const GetInverseElementIterator() const
{ {
class SMDS_InverseElementIterator:public SMDS_Iterator<const SMDS_MeshElement*> return SMDS_ElemIteratorPtr(new SMDS_MeshNode_MyInvIterator(myInverseElements));
{
const set<const SMDS_MeshElement*>& mySet;
set<const SMDS_MeshElement*>::iterator myIterator;
public:
SMDS_InverseElementIterator(const set<const SMDS_MeshElement*>& s):mySet(s)
{
myIterator=mySet.begin();
}
bool more()
{
return myIterator!=mySet.end();
}
const SMDS_MeshElement* next()
{
const SMDS_MeshElement* current=*myIterator;
myIterator++;
return current;
}
};
return new SMDS_InverseElementIterator(myInverseElements);
} }
SMDS_Iterator<const SMDS_MeshElement *> * SMDS_MeshNode:: // Same as GetInverseElementIterator but the create iterator only return
// wanted type elements.
class SMDS_MeshNode_MyIterator:public SMDS_ElemIterator
{
set<const SMDS_MeshElement*> mySet;
set<const SMDS_MeshElement*>::iterator myIterator;
public:
SMDS_MeshNode_MyIterator(SMDSAbs_ElementType type,
const set<const SMDS_MeshElement*>& s)
{
const SMDS_MeshElement * e;
bool toInsert;
set<const SMDS_MeshElement*>::iterator it=s.begin();
while(it!=s.end())
{
e=*it;
switch(type)
{
case SMDSAbs_Edge: toInsert=true; break;
case SMDSAbs_Face: toInsert=(e->GetType()!=SMDSAbs_Edge); break;
case SMDSAbs_Volume: toInsert=(e->GetType()==SMDSAbs_Volume); break;
}
if(toInsert) mySet.insert(e);
it++;
}
myIterator=mySet.begin();
}
bool more()
{
return myIterator!=mySet.end();
}
const SMDS_MeshElement* next()
{
const SMDS_MeshElement* current=*myIterator;
myIterator++;
return current;
}
};
SMDS_ElemIteratorPtr SMDS_MeshNode::
elementsIterator(SMDSAbs_ElementType type) const elementsIterator(SMDSAbs_ElementType type) const
{ {
// Same as GetInverseElementIterator but the create iterator only return if(type==SMDSAbs_Node)
// wanted type elements. return SMDS_MeshElement::elementsIterator(SMDSAbs_Node);
class MyIterator:public SMDS_Iterator<const SMDS_MeshElement*> else
{ return SMDS_ElemIteratorPtr
set<const SMDS_MeshElement*> mySet; (new SMDS_IteratorOfElements
set<const SMDS_MeshElement*>::iterator myIterator; (this,type,
public: SMDS_ElemIteratorPtr(new SMDS_MeshNode_MyIterator(type, myInverseElements))));
MyIterator(SMDSAbs_ElementType type,
const set<const SMDS_MeshElement*>& s)
{
const SMDS_MeshElement * e;
bool toInsert;
set<const SMDS_MeshElement*>::iterator it=s.begin();
while(it!=s.end())
{
e=*it;
switch(type)
{
case SMDSAbs_Edge: toInsert=true; break;
case SMDSAbs_Face: toInsert=(e->GetType()!=SMDSAbs_Edge); break;
case SMDSAbs_Volume: toInsert=(e->GetType()==SMDSAbs_Volume); break;
}
if(toInsert) mySet.insert(e);
it++;
}
myIterator=mySet.begin();
}
bool more()
{
return myIterator!=mySet.end();
}
const SMDS_MeshElement* next()
{
const SMDS_MeshElement* current=*myIterator;
myIterator++;
return current;
}
};
if(type==SMDSAbs_Node)
return SMDS_MeshElement::elementsIterator(SMDSAbs_Node);
else
return new SMDS_IteratorOfElements(this,type,
new MyIterator(type, myInverseElements));
} }
int SMDS_MeshNode::NbNodes() const int SMDS_MeshNode::NbNodes() const

View File

@ -46,22 +46,21 @@ class SMDS_MeshNode:public SMDS_MeshElement
void RemoveInverseElement(const SMDS_MeshElement * parent); void RemoveInverseElement(const SMDS_MeshElement * parent);
void ClearInverseElements(); void ClearInverseElements();
bool emptyInverseElements(); bool emptyInverseElements();
SMDS_Iterator<const SMDS_MeshElement*> * GetInverseElementIterator() const; SMDS_ElemIteratorPtr GetInverseElementIterator() const;
void SetPosition(SMDS_Position * aPos); void SetPosition(const SMDS_PositionPtr& aPos);
SMDS_Position *GetPosition(); const SMDS_PositionPtr& GetPosition() const;
const SMDS_Position *GetPosition() const;
SMDSAbs_ElementType GetType() const; SMDSAbs_ElementType GetType() const;
int NbNodes() const; int NbNodes() const;
void setXYZ(double x, double y, double z); void setXYZ(double x, double y, double z);
friend bool operator<(const SMDS_MeshNode& e1, const SMDS_MeshNode& e2); friend bool operator<(const SMDS_MeshNode& e1, const SMDS_MeshNode& e2);
protected: protected:
SMDS_Iterator<const SMDS_MeshElement *> * SMDS_ElemIteratorPtr
elementsIterator(SMDSAbs_ElementType type) const; elementsIterator(SMDSAbs_ElementType type) const;
private: private:
double myX, myY, myZ; double myX, myY, myZ;
SMDS_Position *myPosition; SMDS_PositionPtr myPosition;
set<const SMDS_MeshElement*> myInverseElements; set<const SMDS_MeshElement*> myInverseElements;
}; };

View File

@ -29,6 +29,7 @@
class SMDS_MeshObject class SMDS_MeshObject
{ {
public: public:
virtual ~SMDS_MeshObject() {}
}; };
#endif #endif

View File

@ -28,6 +28,10 @@
#define _SMDS_Position_HeaderFile #define _SMDS_Position_HeaderFile
#include "SMDS_TypeOfPosition.hxx" #include "SMDS_TypeOfPosition.hxx"
#include <boost/shared_ptr.hpp>
class SMDS_Position;
typedef boost::shared_ptr<SMDS_Position> SMDS_PositionPtr;
class SMDS_Position class SMDS_Position
{ {
@ -37,7 +41,7 @@ class SMDS_Position
virtual inline SMDS_TypeOfPosition GetTypeOfPosition() const = 0; virtual inline SMDS_TypeOfPosition GetTypeOfPosition() const = 0;
void SetShapeId(int aShapeId); void SetShapeId(int aShapeId);
int GetShapeId() const; int GetShapeId() const;
~SMDS_Position(); virtual ~SMDS_Position() {}
protected: protected:
SMDS_Position(int aShapeId); SMDS_Position(int aShapeId);

View File

@ -52,8 +52,8 @@ const double * SMDS_SpacePosition::Coords() const
return myCoords; return myCoords;
} }
SMDS_SpacePosition * SMDS_SpacePosition::originSpacePosition() SMDS_PositionPtr SMDS_SpacePosition::originSpacePosition()
{ {
static SMDS_SpacePosition * staticpos=new SMDS_SpacePosition(); static SMDS_PositionPtr staticpos (new SMDS_SpacePosition());
return staticpos; return staticpos;
} }

View File

@ -37,8 +37,7 @@ class SMDS_SpacePosition:public SMDS_Position
const virtual double * Coords() const; const virtual double * Coords() const;
virtual inline SMDS_TypeOfPosition GetTypeOfPosition() const; virtual inline SMDS_TypeOfPosition GetTypeOfPosition() const;
inline void SetCoords(const double x, const double y, const double z); inline void SetCoords(const double x, const double y, const double z);
~SMDS_SpacePosition(); static SMDS_PositionPtr originSpacePosition();
static SMDS_SpacePosition * originSpacePosition();
private: private:
double myCoords[3]; double myCoords[3];
}; };

View File

@ -56,42 +56,48 @@ void SMDS_Tria3OfNodes::Print(ostream & OS) const
OS << myNodes[i] << ") " << endl; OS << myNodes[i] << ") " << endl;
} }
SMDS_Iterator<const SMDS_MeshElement *> * SMDS_Tria3OfNodes:: class SMDS_Tria3OfNodes_MyIterator:public SMDS_ElemIterator
{
const SMDS_MeshNode * const* mySet;
int index;
public:
SMDS_Tria3OfNodes_MyIterator(const SMDS_MeshNode * const* s):
mySet(s),index(0) {}
bool more()
{
return index<3;
}
const SMDS_MeshElement* next()
{
index++;
return mySet[index-1];
}
};
SMDS_ElemIteratorPtr SMDS_Tria3OfNodes::
elementsIterator(SMDSAbs_ElementType type) const elementsIterator(SMDSAbs_ElementType type) const
{ {
class MyIterator:public SMDS_Iterator<const SMDS_MeshElement*> switch(type)
{ {
const SMDS_MeshNode * const* mySet; case SMDSAbs_Face:
int index; return SMDS_MeshElement::elementsIterator(SMDSAbs_Face);
public: case SMDSAbs_Node:
MyIterator(const SMDS_MeshNode * const* s):mySet(s),index(0) return SMDS_ElemIteratorPtr(new SMDS_Tria3OfNodes_MyIterator(myNodes));
{} case SMDSAbs_Edge:
MESSAGE("Error : edge iterator for SMDS_FaceOfNodes not implemented");
bool more() break;
{ default:
return index<3; return SMDS_ElemIteratorPtr
} (new SMDS_IteratorOfElements
(this,type,SMDS_ElemIteratorPtr(new SMDS_Tria3OfNodes_MyIterator(myNodes))));
const SMDS_MeshElement* next() }
{
index++;
return mySet[index-1];
}
};
switch(type)
{
case SMDSAbs_Face:return SMDS_MeshElement::elementsIterator(SMDSAbs_Face);
case SMDSAbs_Node:return new MyIterator(myNodes);
case SMDSAbs_Edge:
MESSAGE("Error : edge iterator for SMDS_FaceOfNodes not implemented");
break;
default:return new SMDS_IteratorOfElements(this,type,new MyIterator(myNodes));
}
} }
SMDS_Tria3OfNodes::SMDS_Tria3OfNodes(SMDS_MeshNode* node1, SMDS_MeshNode* node2, SMDS_Tria3OfNodes::SMDS_Tria3OfNodes(const SMDS_MeshNode* node1,
SMDS_MeshNode* node3) const SMDS_MeshNode* node2,
const SMDS_MeshNode* node3)
{ {
myNodes[0]=node1; myNodes[0]=node1;
myNodes[1]=node2; myNodes[1]=node2;

View File

@ -31,14 +31,15 @@ class SMDS_Tria3OfNodes:public SMDS_MeshFace
{ {
public: public:
void Print(ostream & OS) const; void Print(ostream & OS) const;
SMDS_Tria3OfNodes(SMDS_MeshNode* node1, SMDS_MeshNode* node2, SMDS_Tria3OfNodes(const SMDS_MeshNode* node1,
SMDS_MeshNode* node3); const SMDS_MeshNode* node2,
const SMDS_MeshNode* node3);
int NbEdges() const; int NbEdges() const;
int NbFaces() const; int NbFaces() const;
int NbNodes() const; int NbNodes() const;
protected: protected:
SMDS_Iterator<const SMDS_MeshElement *> * SMDS_ElemIteratorPtr
elementsIterator(SMDSAbs_ElementType type) const; elementsIterator(SMDSAbs_ElementType type) const;
private: private:

View File

@ -36,7 +36,6 @@ class SMDS_VertexPosition:public SMDS_Position
SMDS_TypeOfPosition GetTypeOfPosition() const; SMDS_TypeOfPosition GetTypeOfPosition() const;
SMDS_VertexPosition(int aVertexId=0); SMDS_VertexPosition(int aVertexId=0);
const double *Coords() const; const double *Coords() const;
~SMDS_VertexPosition();
}; };
#endif #endif

View File

@ -21,7 +21,7 @@
// //
// //
// //
// File : SMDS_MeshVolume.cxx // File : SMDS_VolumeOfFaces.cxx
// Author : Jean-Michel BOULCOURT // Author : Jean-Michel BOULCOURT
// Module : SMESH // Module : SMESH
@ -46,39 +46,46 @@ int SMDS_VolumeOfFaces::NbFaces() const
return myFaces.size(); return myFaces.size();
} }
SMDS_Iterator<const SMDS_MeshElement *> * SMDS_VolumeOfFaces:: class SMDS_VolumeOfFaces_MyIterator:public SMDS_ElemIterator
{
const vector<const SMDS_MeshFace*>& mySet;
int index;
public:
SMDS_VolumeOfFaces_MyIterator(const vector<const SMDS_MeshFace*>& s):
mySet(s),index(0) {}
bool more()
{
return index<mySet.size();
}
const SMDS_MeshElement* next()
{
index++;
return mySet[index-1];
}
};
SMDS_ElemIteratorPtr SMDS_VolumeOfFaces::
elementsIterator(SMDSAbs_ElementType type) const elementsIterator(SMDSAbs_ElementType type) const
{ {
class MyIterator:public SMDS_Iterator<const SMDS_MeshElement*> switch(type)
{ {
const vector<SMDS_MeshFace*>& mySet; case SMDSAbs_Volume:
int index; return SMDS_MeshElement::elementsIterator(SMDSAbs_Volume);
public: case SMDSAbs_Face:
MyIterator(const vector<SMDS_MeshFace*>& s):mySet(s),index(0) return SMDS_ElemIteratorPtr(new SMDS_VolumeOfFaces_MyIterator(myFaces));
{} default:
return SMDS_ElemIteratorPtr
bool more() (new SMDS_IteratorOfElements
{ (this,type,SMDS_ElemIteratorPtr(new SMDS_VolumeOfFaces_MyIterator(myFaces))));
return index<mySet.size(); }
}
const SMDS_MeshElement* next()
{
index++;
return mySet[index-1];
}
};
switch(type)
{
case SMDSAbs_Volume:return SMDS_MeshElement::elementsIterator(SMDSAbs_Volume);
case SMDSAbs_Face:return new MyIterator(myFaces);
default:return new SMDS_IteratorOfElements(this,type,new MyIterator(myFaces));
}
} }
SMDS_VolumeOfFaces::SMDS_VolumeOfFaces(SMDS_MeshFace * face1, SMDS_MeshFace * face2, SMDS_VolumeOfFaces::SMDS_VolumeOfFaces(const SMDS_MeshFace * face1,
SMDS_MeshFace * face3, SMDS_MeshFace * face4) const SMDS_MeshFace * face2,
const SMDS_MeshFace * face3,
const SMDS_MeshFace * face4)
{ {
myFaces.resize(4); myFaces.resize(4);
myFaces[0]=face1; myFaces[0]=face1;
@ -87,9 +94,11 @@ SMDS_VolumeOfFaces::SMDS_VolumeOfFaces(SMDS_MeshFace * face1, SMDS_MeshFace * fa
myFaces[3]=face4; myFaces[3]=face4;
} }
SMDS_VolumeOfFaces::SMDS_VolumeOfFaces(SMDS_MeshFace * face1, SMDS_MeshFace * face2, SMDS_VolumeOfFaces::SMDS_VolumeOfFaces(const SMDS_MeshFace * face1,
SMDS_MeshFace * face3, SMDS_MeshFace * face4, const SMDS_MeshFace * face2,
SMDS_MeshFace * face5) const SMDS_MeshFace * face3,
const SMDS_MeshFace * face4,
const SMDS_MeshFace * face5)
{ {
myFaces.resize(5); myFaces.resize(5);
myFaces[0]=face1; myFaces[0]=face1;
@ -99,9 +108,12 @@ SMDS_VolumeOfFaces::SMDS_VolumeOfFaces(SMDS_MeshFace * face1, SMDS_MeshFace * fa
myFaces[4]=face5; myFaces[4]=face5;
} }
SMDS_VolumeOfFaces::SMDS_VolumeOfFaces(SMDS_MeshFace * face1, SMDS_MeshFace * face2, SMDS_VolumeOfFaces::SMDS_VolumeOfFaces(const SMDS_MeshFace * face1,
SMDS_MeshFace * face3, SMDS_MeshFace * face4, const SMDS_MeshFace * face2,
SMDS_MeshFace * face5,SMDS_MeshFace * face6) const SMDS_MeshFace * face3,
const SMDS_MeshFace * face4,
const SMDS_MeshFace * face5,
const SMDS_MeshFace * face6)
{ {
myFaces.resize(6); myFaces.resize(6);
myFaces[0]=face1; myFaces[0]=face1;

View File

@ -21,7 +21,7 @@
// //
// //
// //
// File : SMDS_MeshVolume.hxx // File : SMDS_VolumeOfFaces.hxx
// Module : SMESH // Module : SMESH
#ifndef _SMDS_VolumeOfFaces_HeaderFile #ifndef _SMDS_VolumeOfFaces_HeaderFile
@ -38,22 +38,29 @@ class SMDS_VolumeOfFaces:public SMDS_MeshVolume
{ {
public: public:
SMDS_VolumeOfFaces(SMDS_MeshFace * face1, SMDS_MeshFace * face2, SMDS_VolumeOfFaces(const SMDS_MeshFace * face1,
SMDS_MeshFace * face3, SMDS_MeshFace * face4); const SMDS_MeshFace * face2,
SMDS_VolumeOfFaces(SMDS_MeshFace * face1, SMDS_MeshFace * face2, const SMDS_MeshFace * face3,
SMDS_MeshFace * face3, SMDS_MeshFace * face4, const SMDS_MeshFace * face4);
SMDS_MeshFace * face5); SMDS_VolumeOfFaces(const SMDS_MeshFace * face1,
SMDS_VolumeOfFaces(SMDS_MeshFace * face1, SMDS_MeshFace * face2, const SMDS_MeshFace * face2,
SMDS_MeshFace * face3, SMDS_MeshFace * face4, const SMDS_MeshFace * face3,
SMDS_MeshFace * face5,SMDS_MeshFace * face6); const SMDS_MeshFace * face4,
const SMDS_MeshFace * face5);
SMDS_VolumeOfFaces(const SMDS_MeshFace * face1,
const SMDS_MeshFace * face2,
const SMDS_MeshFace * face3,
const SMDS_MeshFace * face4,
const SMDS_MeshFace * face5,
const SMDS_MeshFace * face6);
void Print(ostream & OS) const; void Print(ostream & OS) const;
int NbFaces() const; int NbFaces() const;
protected: protected:
SMDS_Iterator<const SMDS_MeshElement *> * SMDS_ElemIteratorPtr
elementsIterator(SMDSAbs_ElementType type) const; elementsIterator(SMDSAbs_ElementType type) const;
vector<SMDS_MeshFace *> myFaces; vector<const SMDS_MeshFace *> myFaces;
}; };
#endif #endif

View File

@ -28,14 +28,14 @@
/// 5,1 and 7,3 are an edges. /// 5,1 and 7,3 are an edges.
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
SMDS_VolumeOfNodes::SMDS_VolumeOfNodes( SMDS_VolumeOfNodes::SMDS_VolumeOfNodes(
SMDS_MeshNode * node1, const SMDS_MeshNode * node1,
SMDS_MeshNode * node2, const SMDS_MeshNode * node2,
SMDS_MeshNode * node3, const SMDS_MeshNode * node3,
SMDS_MeshNode * node4, const SMDS_MeshNode * node4,
SMDS_MeshNode * node5, const SMDS_MeshNode * node5,
SMDS_MeshNode * node6, const SMDS_MeshNode * node6,
SMDS_MeshNode * node7, const SMDS_MeshNode * node7,
SMDS_MeshNode * node8) const SMDS_MeshNode * node8)
{ {
myNodes.resize(8); myNodes.resize(8);
myNodes[0]=node1; myNodes[0]=node1;
@ -49,10 +49,10 @@ SMDS_VolumeOfNodes::SMDS_VolumeOfNodes(
} }
SMDS_VolumeOfNodes::SMDS_VolumeOfNodes( SMDS_VolumeOfNodes::SMDS_VolumeOfNodes(
SMDS_MeshNode * node1, const SMDS_MeshNode * node1,
SMDS_MeshNode * node2, const SMDS_MeshNode * node2,
SMDS_MeshNode * node3, const SMDS_MeshNode * node3,
SMDS_MeshNode * node4) const SMDS_MeshNode * node4)
{ {
myNodes.resize(4); myNodes.resize(4);
myNodes[0]=node1; myNodes[0]=node1;
@ -62,11 +62,11 @@ SMDS_VolumeOfNodes::SMDS_VolumeOfNodes(
} }
SMDS_VolumeOfNodes::SMDS_VolumeOfNodes( SMDS_VolumeOfNodes::SMDS_VolumeOfNodes(
SMDS_MeshNode * node1, const SMDS_MeshNode * node1,
SMDS_MeshNode * node2, const SMDS_MeshNode * node2,
SMDS_MeshNode * node3, const SMDS_MeshNode * node3,
SMDS_MeshNode * node4, const SMDS_MeshNode * node4,
SMDS_MeshNode * node5) const SMDS_MeshNode * node5)
{ {
myNodes.resize(5); myNodes.resize(5);
myNodes[0]=node1; myNodes[0]=node1;
@ -77,12 +77,12 @@ SMDS_VolumeOfNodes::SMDS_VolumeOfNodes(
} }
SMDS_VolumeOfNodes::SMDS_VolumeOfNodes( SMDS_VolumeOfNodes::SMDS_VolumeOfNodes(
SMDS_MeshNode * node1, const SMDS_MeshNode * node1,
SMDS_MeshNode * node2, const SMDS_MeshNode * node2,
SMDS_MeshNode * node3, const SMDS_MeshNode * node3,
SMDS_MeshNode * node4, const SMDS_MeshNode * node4,
SMDS_MeshNode * node5, const SMDS_MeshNode * node5,
SMDS_MeshNode * node6) const SMDS_MeshNode * node6)
{ {
myNodes.resize(6); myNodes.resize(6);
myNodes[0]=node1; myNodes[0]=node1;
@ -134,34 +134,39 @@ int SMDS_VolumeOfNodes::NbEdges() const
} }
} }
SMDS_Iterator<const SMDS_MeshElement *> * SMDS_VolumeOfNodes:: class SMDS_VolumeOfNodes_MyIterator:public SMDS_ElemIterator
{
const vector<const SMDS_MeshNode*>& mySet;
int index;
public:
SMDS_VolumeOfNodes_MyIterator(const vector<const SMDS_MeshNode*>& s):
mySet(s),index(0) {}
bool more()
{
return index<mySet.size();
}
const SMDS_MeshElement* next()
{
index++;
return mySet[index-1];
}
};
SMDS_ElemIteratorPtr SMDS_VolumeOfNodes::
elementsIterator(SMDSAbs_ElementType type) const elementsIterator(SMDSAbs_ElementType type) const
{ {
class MyIterator:public SMDS_Iterator<const SMDS_MeshElement*> switch(type)
{ {
const vector<const SMDS_MeshNode*>& mySet; case SMDSAbs_Volume:
int index; return SMDS_MeshElement::elementsIterator(SMDSAbs_Volume);
public: case SMDSAbs_Node:
MyIterator(const vector<const SMDS_MeshNode*>& s):mySet(s),index(0) return SMDS_ElemIteratorPtr(new SMDS_VolumeOfNodes_MyIterator(myNodes));
{} default:
MESSAGE("ERROR : Iterator not implemented");
bool more() return SMDS_ElemIteratorPtr((SMDS_ElemIterator*)NULL);
{ }
return index<mySet.size();
}
const SMDS_MeshElement* next()
{
index++;
return mySet[index-1];
}
};
switch(type)
{
case SMDSAbs_Volume:return SMDS_MeshElement::elementsIterator(SMDSAbs_Volume);
case SMDSAbs_Node:return new MyIterator(myNodes);
default: MESSAGE("ERROR : Iterator not implemented");
}
} }
SMDSAbs_ElementType SMDS_VolumeOfNodes::GetType() const SMDSAbs_ElementType SMDS_VolumeOfNodes::GetType() const

View File

@ -36,32 +36,32 @@ class SMDS_VolumeOfNodes:public SMDS_MeshVolume
public: public:
SMDS_VolumeOfNodes( SMDS_VolumeOfNodes(
SMDS_MeshNode * node1, const SMDS_MeshNode * node1,
SMDS_MeshNode * node2, const SMDS_MeshNode * node2,
SMDS_MeshNode * node3, const SMDS_MeshNode * node3,
SMDS_MeshNode * node4); const SMDS_MeshNode * node4);
SMDS_VolumeOfNodes( SMDS_VolumeOfNodes(
SMDS_MeshNode * node1, const SMDS_MeshNode * node1,
SMDS_MeshNode * node2, const SMDS_MeshNode * node2,
SMDS_MeshNode * node3, const SMDS_MeshNode * node3,
SMDS_MeshNode * node4, const SMDS_MeshNode * node4,
SMDS_MeshNode * node5); const SMDS_MeshNode * node5);
SMDS_VolumeOfNodes( SMDS_VolumeOfNodes(
SMDS_MeshNode * node1, const SMDS_MeshNode * node1,
SMDS_MeshNode * node2, const SMDS_MeshNode * node2,
SMDS_MeshNode * node3, const SMDS_MeshNode * node3,
SMDS_MeshNode * node4, const SMDS_MeshNode * node4,
SMDS_MeshNode * node5, const SMDS_MeshNode * node5,
SMDS_MeshNode * node6); const SMDS_MeshNode * node6);
SMDS_VolumeOfNodes( SMDS_VolumeOfNodes(
SMDS_MeshNode * node1, const SMDS_MeshNode * node1,
SMDS_MeshNode * node2, const SMDS_MeshNode * node2,
SMDS_MeshNode * node3, const SMDS_MeshNode * node3,
SMDS_MeshNode * node4, const SMDS_MeshNode * node4,
SMDS_MeshNode * node5, const SMDS_MeshNode * node5,
SMDS_MeshNode * node6, const SMDS_MeshNode * node6,
SMDS_MeshNode * node7, const SMDS_MeshNode * node7,
SMDS_MeshNode * node8); const SMDS_MeshNode * node8);
void Print(ostream & OS) const; void Print(ostream & OS) const;
int NbFaces() const; int NbFaces() const;
@ -69,7 +69,7 @@ class SMDS_VolumeOfNodes:public SMDS_MeshVolume
int NbEdges() const; int NbEdges() const;
SMDSAbs_ElementType GetType() const; SMDSAbs_ElementType GetType() const;
protected: protected:
SMDS_Iterator<const SMDS_MeshElement *> * SMDS_ElemIteratorPtr
elementsIterator(SMDSAbs_ElementType type) const; elementsIterator(SMDSAbs_ElementType type) const;
vector<const SMDS_MeshNode *> myNodes; vector<const SMDS_MeshNode *> myNodes;
}; };

View File

@ -29,7 +29,7 @@
top_srcdir=@top_srcdir@ top_srcdir=@top_srcdir@
top_builddir=../.. top_builddir=../..
srcdir=@srcdir@ srcdir=@srcdir@
VPATH=.:@srcdir@:@top_srcdir@/idl:$(top_builddir)/idl:${KERNEL_ROOT_DIR}/idl/salome:${MED_ROOT_DIR}/idl/salome VPATH=.:@srcdir@:@top_srcdir@/idl:$(top_builddir)/idl
@COMMENCE@ @COMMENCE@
@ -40,22 +40,11 @@ EXPORT_HEADERS= \
SMESH_Mesh.hxx \ SMESH_Mesh.hxx \
SMESH_subMesh.hxx \ SMESH_subMesh.hxx \
SMESH_Hypothesis.hxx \ SMESH_Hypothesis.hxx \
SMESH_HypothesisFactory.hxx \
SMESH_Algo.hxx \ SMESH_Algo.hxx \
SMESH_1D_Algo.hxx \ SMESH_1D_Algo.hxx \
SMESH_2D_Algo.hxx \ SMESH_2D_Algo.hxx \
SMESH_3D_Algo.hxx \ SMESH_3D_Algo.hxx \
SMESH_NumberOfSegments.hxx \ SMESH_Group.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_NETGEN_3D.hxx \
SMESH_HypothesisCreator.hxx
EXPORT_PYSCRIPTS = EXPORT_PYSCRIPTS =
@ -65,20 +54,11 @@ LIB= libSMESHimpl.la
LIB_SRC = SMESH_Gen.cxx SMESH_Mesh.cxx SMESH_subMesh.cxx \ LIB_SRC = SMESH_Gen.cxx SMESH_Mesh.cxx SMESH_subMesh.cxx \
SMESH_Hypothesis.cxx \ SMESH_Hypothesis.cxx \
SMESH_HypothesisFactory.cxx \
SMESH_Algo.cxx \ SMESH_Algo.cxx \
SMESH_1D_Algo.cxx \ SMESH_1D_Algo.cxx \
SMESH_2D_Algo.cxx \ SMESH_2D_Algo.cxx \
SMESH_3D_Algo.cxx \ SMESH_3D_Algo.cxx \
SMESH_NumberOfSegments.cxx \ SMESH_Group.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_SERVER_IDL =
@ -89,20 +69,13 @@ BIN =
BIN_SRC = BIN_SRC =
# additionnal information to compil and link file # additionnal information to compil and link file
CPPFLAGS+= $(OCC_INCLUDES) $(MED2_INCLUDES) $(HDF5_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome CPPFLAGS+= $(OCC_INCLUDES) $(MED2_INCLUDES) $(HDF5_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome \
$(BOOST_CPPFLAGS)
CXXFLAGS+= $(OCC_CXXFLAGS) $(MED2_INCLUDES) $(HDF5_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome CXXFLAGS+= $(OCC_CXXFLAGS) $(MED2_INCLUDES) $(HDF5_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome
#IDLCXXFLAGS+= -Wbtp #IDLCXXFLAGS+= -Wbtp
LDFLAGS+= $(HDF5_LIBS) $(MED2_LIBS) -lOpUtil -lSMESHDS -lSMDS -lMEFISTO2D -lMeshDriverDAT -lMeshDriverMED -lMeshDriverUNV -L${KERNEL_ROOT_DIR}/lib/salome LDFLAGS+= $(HDF5_LIBS) $(MED2_LIBS) -lOpUtil -lSMESHDS -lSMDS -lMeshDriverDAT -lMeshDriverMED -lMeshDriverUNV -L${KERNEL_ROOT_DIR}/lib/salome
ifeq (@WITHNETGEN@,yes)
LIB_SRC+= SMESH_NETGEN_3D.cxx
NETGEN_INCLUDES=@NETGEN_INCLUDES@
CPPFLAGS+= $(NETGEN_INCLUDES)
CXXFLAGS+= $(NETGEN_INCLUDES)
LDFLAGS+= -lNETGEN
endif
@CONCLUDE@ @CONCLUDE@

View File

@ -26,7 +26,6 @@
// Module : SMESH // Module : SMESH
// $Header$ // $Header$
using namespace std;
using namespace std; using namespace std;
#include "SMESH_1D_Algo.hxx" #include "SMESH_1D_Algo.hxx"
#include "SMESH_Gen.hxx" #include "SMESH_Gen.hxx"
@ -55,47 +54,3 @@ 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;
}

View File

@ -37,13 +37,6 @@ class SMESH_1D_Algo:
public: public:
SMESH_1D_Algo(int hypId, int studyId, SMESH_Gen* gen); SMESH_1D_Algo(int hypId, int studyId, SMESH_Gen* gen);
virtual ~SMESH_1D_Algo(); 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 #endif

View File

@ -26,7 +26,6 @@
// Module : SMESH // Module : SMESH
// $Header$ // $Header$
using namespace std;
using namespace std; using namespace std;
#include "SMESH_2D_Algo.hxx" #include "SMESH_2D_Algo.hxx"
#include "SMESH_Gen.hxx" #include "SMESH_Gen.hxx"
@ -63,50 +62,6 @@ 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 SMESH_2D_Algo::NumberOfWires(const TopoDS_Shape& S)
{ {
int i = 0; int i = 0;

View File

@ -41,13 +41,6 @@ public:
int NumberOfWires(const TopoDS_Shape& S); int NumberOfWires(const TopoDS_Shape& S);
int NumberOfPoints(SMESH_Mesh& aMesh,const TopoDS_Wire& W); 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 #endif

View File

@ -26,7 +26,6 @@
// Module : SMESH // Module : SMESH
// $Header$ // $Header$
using namespace std;
using namespace std; using namespace std;
#include "SMESH_3D_Algo.hxx" #include "SMESH_3D_Algo.hxx"
#include "SMESH_Gen.hxx" #include "SMESH_Gen.hxx"
@ -56,47 +55,3 @@ SMESH_3D_Algo::SMESH_3D_Algo(int hypId, int studyId, SMESH_Gen* gen)
SMESH_3D_Algo::~SMESH_3D_Algo() 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;
}

View File

@ -37,13 +37,6 @@ class SMESH_3D_Algo:
public: public:
SMESH_3D_Algo(int hypId, int studyId, SMESH_Gen* gen); SMESH_3D_Algo(int hypId, int studyId, SMESH_Gen* gen);
virtual ~SMESH_3D_Algo(); 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 #endif

View File

@ -26,7 +26,6 @@
// Module : SMESH // Module : SMESH
// $Header$ // $Header$
using namespace std;
using namespace std; using namespace std;
#include "SMESH_Algo.hxx" #include "SMESH_Algo.hxx"
#include "SMESH_Gen.hxx" #include "SMESH_Gen.hxx"
@ -39,6 +38,8 @@ using namespace std;
#include "utilities.h" #include "utilities.h"
#include <algorithm> #include <algorithm>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
//============================================================================= //=============================================================================
/*! /*!
@ -52,6 +53,8 @@ SMESH_Algo::SMESH_Algo(int hypId, int studyId,
// _compatibleHypothesis.push_back("hypothese_bidon"); // _compatibleHypothesis.push_back("hypothese_bidon");
_type = ALGO; _type = ALGO;
gen->_mapAlgo[hypId] = this; gen->_mapAlgo[hypId] = this;
_onlyUnaryInput = _requireDescretBoundary = true;
} }
//============================================================================= //=============================================================================
@ -75,77 +78,6 @@ const vector < string > &SMESH_Algo::GetCompatibleHypothesis()
return _compatibleHypothesis; 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. * List the hypothesis used by the algorithm associated to the shape.
@ -164,12 +96,21 @@ const list <const SMESHDS_Hypothesis *> & SMESH_Algo::GetUsedHypothesis(
int nbHyp = _usedHypList.size(); int nbHyp = _usedHypList.size();
if (nbHyp == 0) if (nbHyp == 0)
{ {
TopoDS_Shape mainShape = aMesh.GetMeshDS()->ShapeToMesh(); TopTools_ListIteratorOfListOfShape ancIt( aMesh.GetAncestors( aShape ));
if (!mainShape.IsSame(aShape)) for (; ancIt.More(); ancIt.Next())
{ {
_usedHypList = GetAppliedHypothesis(aMesh, mainShape); // copy const TopoDS_Shape& ancestor = ancIt.Value();
nbHyp = _usedHypList.size(); _usedHypList = GetAppliedHypothesis(aMesh, ancestor); // copy
} nbHyp = _usedHypList.size();
if (nbHyp == 1)
break;
}
// TopoDS_Shape mainShape = aMesh.GetMeshDS()->ShapeToMesh();
// if (!mainShape.IsSame(aShape))
// {
// _usedHypList = GetAppliedHypothesis(aMesh, mainShape); // copy
// nbHyp = _usedHypList.size();
// }
} }
if (nbHyp > 1) if (nbHyp > 1)
_usedHypList.clear(); //only one compatible hypothesis allowed _usedHypList.clear(); //only one compatible hypothesis allowed

View File

@ -39,7 +39,7 @@
#include <list> #include <list>
using namespace std; using namespace std;
class SMESH_gen; class SMESH_Gen;
class SMESH_Mesh; class SMESH_Mesh;
class SMESH_Algo:public SMESH_Hypothesis class SMESH_Algo:public SMESH_Hypothesis
@ -49,10 +49,11 @@ class SMESH_Algo:public SMESH_Hypothesis
virtual ~ SMESH_Algo(); virtual ~ SMESH_Algo();
const vector < string > &GetCompatibleHypothesis(); const vector < string > &GetCompatibleHypothesis();
virtual bool CheckHypothesis(SMESH_Mesh & aMesh, virtual bool CheckHypothesis(SMESH_Mesh& aMesh,
const TopoDS_Shape & aShape); const TopoDS_Shape& aShape,
SMESH_Hypothesis::Hypothesis_Status& aStatus) = 0;
virtual bool Compute(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape); virtual bool Compute(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape) = 0;
virtual const list <const SMESHDS_Hypothesis *> & virtual const list <const SMESHDS_Hypothesis *> &
GetUsedHypothesis(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape); GetUsedHypothesis(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape);
@ -62,15 +63,29 @@ class SMESH_Algo:public SMESH_Hypothesis
static double EdgeLength(const TopoDS_Edge & E); static double EdgeLength(const TopoDS_Edge & E);
virtual ostream & SaveTo(ostream & save); public:
virtual istream & LoadFrom(istream & load); // algo features
friend ostream & operator <<(ostream & save, SMESH_Algo & hyp);
friend istream & operator >>(istream & load, SMESH_Algo & hyp);
protected: // SMESH_Hypothesis::GetDim();
vector<string> _compatibleHypothesis; // 1 - dimention of target mesh
list<const SMESHDS_Hypothesis *> _appliedHypList;
list<const SMESHDS_Hypothesis *> _usedHypList; bool OnlyUnaryInput() const { return _onlyUnaryInput; }
// 2 - is collection of tesselatable shapes inacceptable as input;
// "collection" means a shape containing shapes of dim equal
// to GetDim().
// Algo which can process a collection shape should expect
// an input temporary shape that is neither MainShape nor
// its child.
bool NeedDescretBoundary() const { return _requireDescretBoundary; }
// 3 - is a Dim-1 mesh prerequisite
protected:
bool _onlyUnaryInput;
bool _requireDescretBoundary;
vector<string> _compatibleHypothesis;
list<const SMESHDS_Hypothesis *> _appliedHypList;
list<const SMESHDS_Hypothesis *> _usedHypList;
}; };
#endif #endif

View File

@ -31,12 +31,16 @@
#include "SMDS_MeshElement.hxx" #include "SMDS_MeshElement.hxx"
#include "SMDS_MeshNode.hxx" #include "SMDS_MeshNode.hxx"
#include <gp_Pnt.hxx>
#include <BRep_Tool.hxx>
#include "utilities.h" #include "utilities.h"
#include "OpUtil.hxx" #include "OpUtil.hxx"
#include <gp_Pnt.hxx>
#include <BRep_Tool.hxx>
#include <TopTools_ListOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include "Utils_ExceptHandlers.hxx"
//============================================================================= //=============================================================================
/*! /*!
* default constructor: * default constructor:
@ -47,7 +51,7 @@ SMESH_Gen::SMESH_Gen()
{ {
MESSAGE("SMESH_Gen::SMESH_Gen"); MESSAGE("SMESH_Gen::SMESH_Gen");
_localId = 0; _localId = 0;
_hypothesisFactory.SetGen(this); _hypId = 0;
} }
//============================================================================= //=============================================================================
@ -67,7 +71,7 @@ SMESH_Gen::~SMESH_Gen()
*/ */
//============================================================================= //=============================================================================
SMESH_Hypothesis *SMESH_Gen::CreateHypothesis(const char *anHyp, int studyId) /*SMESH_Hypothesis *SMESH_Gen::CreateHypothesis(const char *anHyp, int studyId)
throw(SALOME_Exception) throw(SALOME_Exception)
{ {
@ -88,7 +92,7 @@ SMESH_Hypothesis *SMESH_Gen::CreateHypothesis(const char *anHyp, int studyId)
myStudyContext->myDocument->AddHypothesis(myHypothesis); myStudyContext->myDocument->AddHypothesis(myHypothesis);
return myHypothesis; return myHypothesis;
} }*/
//============================================================================= //=============================================================================
/*! /*!
@ -96,10 +100,11 @@ SMESH_Hypothesis *SMESH_Gen::CreateHypothesis(const char *anHyp, int studyId)
*/ */
//============================================================================= //=============================================================================
SMESH_Mesh *SMESH_Gen::Init(int studyId, const TopoDS_Shape & aShape) SMESH_Mesh* SMESH_Gen::CreateMesh(int studyId)
throw(SALOME_Exception) throw(SALOME_Exception)
{ {
MESSAGE("SMESH_Gen::Init"); Unexpect aCatch(SalomeException);
MESSAGE("SMESH_Gen::CreateMesh");
// if (aShape.ShapeType() == TopAbs_COMPOUND) // if (aShape.ShapeType() == TopAbs_COMPOUND)
// { // {
// INFOS("Mesh Compound not yet implemented!"); // INFOS("Mesh Compound not yet implemented!");
@ -120,7 +125,7 @@ throw(SALOME_Exception)
// associate a TopoDS_Shape to the mesh // associate a TopoDS_Shape to the mesh
mesh->ShapeToMesh(aShape); //mesh->ShapeToMesh(aShape);
return mesh; return mesh;
} }
@ -131,59 +136,487 @@ throw(SALOME_Exception)
//============================================================================= //=============================================================================
bool SMESH_Gen::Compute(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape) bool SMESH_Gen::Compute(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape)
throw(SALOME_Exception)
{ {
MESSAGE("SMESH_Gen::Compute"); MESSAGE("SMESH_Gen::Compute");
// bool isDone = false; // bool isDone = false;
/* /*
Algo : s'appuie ou non sur une geometrie Algo : s'appuie ou non sur une geometrie
Si geometrie: Si geometrie:
Vertex : rien à faire (range le point) Vertex : rien à faire (range le point)
Edge, Wire, collection d'edge et wire : 1D Edge, Wire, collection d'edge et wire : 1D
Face, Shell, collection de Face et Shells : 2D Face, Shell, collection de Face et Shells : 2D
Solid, Collection de Solid : 3D Solid, Collection de Solid : 3D
*/ */
// *** corriger commentaires // *** corriger commentaires
// check hypothesis associated to the mesh : // check hypothesis associated to the mesh :
// - only one algo : type compatible with the type of the shape // - only one algo : type compatible with the type of the shape
// - hypothesis = compatible with algo // - hypothesis = compatible with algo
// - check if hypothesis are applicable to this algo // - check if hypothesis are applicable to this algo
// - check contradictions within hypothesis // - check contradictions within hypothesis
// (test if enough hypothesis is done further) // (test if enough hypothesis is done further)
bool ret = true; bool ret = true;
SMESH_subMesh *sm = aMesh.GetSubMesh(aShape); if ( !CheckAlgoState( aMesh, aShape ))
// SCRUTE(sm); {
SMESH_subMesh *smToCompute = sm->GetFirstToCompute(); INFOS( "ABORT MESHING: some algos or hypothesis are missing");
while (smToCompute) return false;
{ }
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);
SMESHDS_Mesh * meshDS = aMesh.GetMeshDS();
//MESSAGE("point "<<nodeId<<" "<<P1.X()<<" "<<P1.Y()<<" "<<P1.Z());
SMDS_MeshNode * node = meshDS->AddNode(P1.X(), P1.Y(), P1.Z());
meshDS->SetNodeOnVertex(node, V1);
smToCompute->GetSubMeshDS();
smToCompute->_vertexSet = true;
smToCompute->ComputeStateEngine(SMESH_subMesh::COMPUTE);
}
smToCompute = sm->GetFirstToCompute();
}
return ret; SMESH_subMesh *sm = aMesh.GetSubMesh(aShape);
// -----------------------------------------------------------------
// apply algos that do not require descretized boundaries, starting
// from the most complex shapes
// -----------------------------------------------------------------
// map containing all subshapes in the order: vertices, edges, faces...
const map<int, SMESH_subMesh*>& smMap = sm->DependsOn();
map<int, SMESH_subMesh*>::const_reverse_iterator revItSub = smMap.rbegin();
SMESH_subMesh* smToCompute = sm;
while ( smToCompute )
{
const TopoDS_Shape& aSubShape = smToCompute->GetSubShape();
if ( GetShapeDim( aSubShape ) < 1 ) break;
SMESH_Algo* algo = GetAlgo( aMesh, aSubShape );
if (algo &&
!algo->NeedDescretBoundary() &&
smToCompute->GetComputeState() == SMESH_subMesh::READY_TO_COMPUTE )
{
ret = smToCompute->ComputeStateEngine( SMESH_subMesh::COMPUTE );
}
if (!ret)
return false;
// next subMesh
if (revItSub != smMap.rend())
{
smToCompute = (*revItSub).second;
revItSub++;
}
else
smToCompute = 0;
}
// -----------------------------------------------
// mesh the rest subshapes starting from vertices
// -----------------------------------------------
smToCompute = sm->GetFirstToCompute();
while (smToCompute)
{
TopoDS_Shape subShape = smToCompute->GetSubShape();
int dim = GetShapeDim(subShape);
if (dim > 0)
{
//MESSAGE ( "MESH shape id=" << smToCompute->GetId() <<
// " type=" << smToCompute->GetSubShape().ShapeType());
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);
SMESHDS_Mesh * meshDS = aMesh.GetMeshDS();
//MESSAGE("point "<<nodeId<<" "<<P1.X()<<" "<<P1.Y()<<" "<<P1.Z());
SMDS_MeshNode * node = meshDS->AddNode(P1.X(), P1.Y(), P1.Z());
if ( node ) { // san - increase robustness
meshDS->SetNodeOnVertex(node, V1);
smToCompute->GetSubMeshDS();
smToCompute->_vertexSet = true;
smToCompute->ComputeStateEngine(SMESH_subMesh::COMPUTE);
}
}
smToCompute = sm->GetFirstToCompute();
}
MESSAGE( "VSR - SMESH_Gen::Compute() finished" );
return ret;
}
//=======================================================================
//function : checkConformIgnoredAlgos
//purpose :
//=======================================================================
static bool checkConformIgnoredAlgos(SMESH_Mesh& aMesh,
SMESH_subMesh* aSubMesh,
const SMESH_Algo* aGlobIgnoAlgo,
const SMESH_Algo* aLocIgnoAlgo,
bool & checkConform,
map<int, SMESH_subMesh*>& aCheckedMap)
{
ASSERT( aSubMesh );
if ( aSubMesh->GetSubShape().ShapeType() == TopAbs_VERTEX)
return true;
bool ret = true;
const list<const SMESHDS_Hypothesis*>& listHyp =
aMesh.GetMeshDS()->GetHypothesis( aSubMesh->GetSubShape() );
list<const SMESHDS_Hypothesis*>::const_iterator it=listHyp.begin();
for ( ; it != listHyp.end(); it++)
{
const SMESHDS_Hypothesis * aHyp = *it;
if (aHyp->GetType() == SMESHDS_Hypothesis::PARAM_ALGO)
continue;
const SMESH_Algo* algo = dynamic_cast<const SMESH_Algo*> (aHyp);
ASSERT ( algo );
if ( aLocIgnoAlgo ) // algo is hidden by a local algo of upper dim
{
INFOS( "Local <" << algo->GetName() << "> is hidden by local <"
<< aLocIgnoAlgo->GetName() << ">");
}
else
{
bool isGlobal = (aMesh.IsMainShape( aSubMesh->GetSubShape() ));
int dim = algo->GetDim();
int aMaxGlobIgnoDim = ( aGlobIgnoAlgo ? aGlobIgnoAlgo->GetDim() : -1 );
if ( dim < aMaxGlobIgnoDim )
{
// algo is hidden by a global algo
INFOS( ( isGlobal ? "Global" : "Local" )
<< " <" << algo->GetName() << "> is hidden by global <"
<< aGlobIgnoAlgo->GetName() << ">");
}
else if ( !algo->NeedDescretBoundary() && !isGlobal)
{
// local algo is not hidden and hides algos on sub-shapes
if (checkConform && !aSubMesh->IsConform( algo ))
{
ret = false;
checkConform = false; // no more check conformity
INFOS( "ERROR: Local <" << algo->GetName() <<
"> would produce not conform mesh: "
"<Not Conform Mesh Allowed> hypotesis is missing");
}
// sub-algos will be hidden by a local <algo>
const map<int, SMESH_subMesh*>& smMap = aSubMesh->DependsOn();
map<int, SMESH_subMesh*>::const_reverse_iterator revItSub;
bool checkConform2 = false;
for ( revItSub = smMap.rbegin(); revItSub != smMap.rend(); revItSub++)
{
checkConformIgnoredAlgos (aMesh, (*revItSub).second, aGlobIgnoAlgo,
algo, checkConform2, aCheckedMap);
int key = (*revItSub).first;
SMESH_subMesh* sm = (*revItSub).second;
if ( aCheckedMap.find( key ) == aCheckedMap.end() )
{
aCheckedMap[ key ] = sm;
}
}
}
}
}
return ret;
}
//=======================================================================
//function : checkMissing
//purpose : notify on missing hypothesis
// Return false if algo or hipothesis is missing
//=======================================================================
static bool checkMissing(SMESH_Gen* aGen,
SMESH_Mesh& aMesh,
SMESH_subMesh* aSubMesh,
const int aTopAlgoDim,
bool* globalChecked,
const bool checkNoAlgo,
map<int, SMESH_subMesh*>& aCheckedMap)
{
if ( aSubMesh->GetSubShape().ShapeType() == TopAbs_VERTEX)
return true;
//MESSAGE("=====checkMissing");
int ret = true;
SMESH_Algo* algo = 0;
switch (aSubMesh->GetAlgoState())
{
case SMESH_subMesh::NO_ALGO: {
if (checkNoAlgo)
{
// should there be any algo?
int shapeDim = SMESH_Gen::GetShapeDim( aSubMesh->GetSubShape() );
if (aTopAlgoDim > shapeDim)
{
INFOS( "ERROR: " << shapeDim << "D algorithm is missing" );
ret = false;
}
}
return ret;
}
case SMESH_subMesh::MISSING_HYP: {
// notify if an algo missing hyp is attached to aSubMesh
algo = aGen->GetAlgo( aMesh, aSubMesh->GetSubShape() );
ASSERT( algo );
bool isGlobalAlgo = aGen->IsGlobalAlgo( algo, aMesh );
if (!isGlobalAlgo || !globalChecked[ algo->GetDim() ])
{
INFOS( "ERROR: " << (isGlobalAlgo ? "Global " : "Local ")
<< "<" << algo->GetName() << "> misses some hypothesis");
if (isGlobalAlgo)
globalChecked[ algo->GetDim() ] = true;
}
ret = false;
break;
}
case SMESH_subMesh::HYP_OK:
algo = aGen->GetAlgo( aMesh, aSubMesh->GetSubShape() );
ret = true;
break;
default: ASSERT(0);
}
// do not check under algo that hides sub-algos or
// re-start checking NO_ALGO state
ASSERT (algo);
bool isTopLocalAlgo =
( aTopAlgoDim <= algo->GetDim() && !aGen->IsGlobalAlgo( algo, aMesh ));
if (!algo->NeedDescretBoundary() || isTopLocalAlgo)
{
bool checkNoAlgo2 = ( algo->NeedDescretBoundary() );
const map<int, SMESH_subMesh*>& subMeshes = aSubMesh->DependsOn();
map<int, SMESH_subMesh*>::const_iterator itsub;
for (itsub = subMeshes.begin(); itsub != subMeshes.end(); itsub++)
{
// sub-meshes should not be checked further more
int key = (*itsub).first;
SMESH_subMesh* sm = (*itsub).second;
if ( aCheckedMap.find( key ) == aCheckedMap.end() )
aCheckedMap[ key ] = sm;
if (isTopLocalAlgo)
{
//check algo on sub-meshes
int aTopAlgoDim2 = algo->GetDim();
if (!checkMissing (aGen, aMesh, sm, aTopAlgoDim2,
globalChecked, checkNoAlgo2, aCheckedMap))
{
ret = false;
if (sm->GetAlgoState() == SMESH_subMesh::NO_ALGO )
checkNoAlgo2 = false;
}
}
}
}
return ret;
}
//=======================================================================
//function : CheckAlgoState
//purpose : notify on bad state of attached algos, return false
// if Compute() would fail because of some algo bad state
//=======================================================================
bool SMESH_Gen::CheckAlgoState(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape)
{
//MESSAGE("SMESH_Gen::CheckAlgoState");
bool ret = true;
bool hasAlgo = false;
SMESH_subMesh* sm = aMesh.GetSubMesh(aShape);
const SMESHDS_Mesh* meshDS = aMesh.GetMeshDS();
TopoDS_Shape mainShape = meshDS->ShapeToMesh();
// -----------------
// get global algos
// -----------------
const SMESH_Algo* aGlobAlgoArr[] = {0,0,0,0};
const list<const SMESHDS_Hypothesis*>& listHyp = meshDS->GetHypothesis( mainShape );
list<const SMESHDS_Hypothesis*>::const_iterator it=listHyp.begin();
for ( ; it != listHyp.end(); it++)
{
const SMESHDS_Hypothesis * aHyp = *it;
if (aHyp->GetType() == SMESHDS_Hypothesis::PARAM_ALGO)
continue;
const SMESH_Algo* algo = dynamic_cast<const SMESH_Algo*> (aHyp);
ASSERT ( algo );
int dim = algo->GetDim();
aGlobAlgoArr[ dim ] = algo;
hasAlgo = true;
}
// --------------------------------------------------------
// info on algos that will be ignored because of ones that
// don't NeedDescretBoundary() attached to super-shapes,
// check that a conform mesh will be produced
// --------------------------------------------------------
// find a global algo possibly hidding sub-algos
int dim;
const SMESH_Algo* aGlobIgnoAlgo = 0;
for (dim = 3; dim > 0; dim--)
{
if (aGlobAlgoArr[ dim ] &&
!aGlobAlgoArr[ dim ]->NeedDescretBoundary())
{
aGlobIgnoAlgo = aGlobAlgoArr[ dim ];
break;
}
}
const map<int, SMESH_subMesh*>& smMap = sm->DependsOn();
map<int, SMESH_subMesh*>::const_reverse_iterator revItSub = smMap.rbegin();
map<int, SMESH_subMesh*> aCheckedMap;
bool checkConform = ( !aMesh.IsNotConformAllowed() );
int aKey = 1;
SMESH_subMesh* smToCheck = sm;
// loop on aShape and its sub-shapes
while ( smToCheck )
{
if ( smToCheck->GetSubShape().ShapeType() == TopAbs_VERTEX)
break;
if ( aCheckedMap.find( aKey ) == aCheckedMap.end() )
if (!checkConformIgnoredAlgos (aMesh, smToCheck, aGlobIgnoAlgo,
0, checkConform, aCheckedMap))
ret = false;
if ( smToCheck->GetAlgoState() != SMESH_subMesh::NO_ALGO )
hasAlgo = true;
// next subMesh
if (revItSub != smMap.rend())
{
aKey = (*revItSub).first;
smToCheck = (*revItSub).second;
revItSub++;
}
else
{
smToCheck = 0;
}
}
// ----------------------------------------------------------------
// info on missing hypothesis and find out if all needed algos are
// well defined
// ----------------------------------------------------------------
//MESSAGE( "---info on missing hypothesis and find out if all needed algos are");
// find max dim of global algo
int aTopAlgoDim = 0;
for (dim = 3; dim > 0; dim--)
{
if (aGlobAlgoArr[ dim ])
{
aTopAlgoDim = dim;
break;
}
}
aCheckedMap.clear();
smToCheck = sm;
revItSub = smMap.rbegin();
bool checkNoAlgo = (bool) aTopAlgoDim;
bool globalChecked[] = { false, false, false, false };
// loop on aShape and its sub-shapes
while ( smToCheck )
{
if ( smToCheck->GetSubShape().ShapeType() == TopAbs_VERTEX)
break;
if ( aCheckedMap.find( aKey ) == aCheckedMap.end() )
if (!checkMissing (this, aMesh, smToCheck, aTopAlgoDim,
globalChecked, checkNoAlgo, aCheckedMap))
{
ret = false;
if (smToCheck->GetAlgoState() == SMESH_subMesh::NO_ALGO )
checkNoAlgo = false;
}
// next subMesh
if (revItSub != smMap.rend())
{
aKey = (*revItSub).first;
smToCheck = (*revItSub).second;
revItSub++;
}
else
smToCheck = 0;
}
if ( !hasAlgo )
INFOS( "None algorithm attached" );
return ( ret && hasAlgo );
}
//=======================================================================
//function : IsGlobalAlgo
//purpose : check if theAlgo is attached to the main shape
//=======================================================================
bool SMESH_Gen::IsGlobalAlgo(const SMESH_Algo* theAlgo, SMESH_Mesh& aMesh)
{
const SMESHDS_Mesh* meshDS = aMesh.GetMeshDS();
TopoDS_Shape mainShape = meshDS->ShapeToMesh();
const list<const SMESHDS_Hypothesis*>& listHyp = meshDS->GetHypothesis( mainShape );
list<const SMESHDS_Hypothesis*>::const_iterator it=listHyp.begin();
for ( ; it != listHyp.end(); it++)
if ( *it == theAlgo )
return true;
return false;
}
//=======================================================================
//function : getAlgoId
//purpose : return algo ID or -1 if not found
//=======================================================================
static int getAlgo(const list<const SMESHDS_Hypothesis*>& theHypList,
const int theAlgoDim,
const int theAlgoShapeType)
{
list<const SMESHDS_Hypothesis*>::const_iterator it = theHypList.begin();
int nb_algo = 0;
int algo_id = -1;
while (it!=theHypList.end())
{
const SMESH_Hypothesis *anHyp = static_cast< const SMESH_Hypothesis *>( *it );
if (anHyp->GetType() > SMESHDS_Hypothesis::PARAM_ALGO &&
anHyp->GetDim() == theAlgoDim &&
((anHyp->GetShapeType()) & (1 << theAlgoShapeType)))
{
nb_algo++;
algo_id = anHyp->GetID();
break;
}
//if (nb_algo > 1) return -1; // more than one algo
it++;
}
return algo_id;
} }
//============================================================================= //=============================================================================
@ -194,88 +627,113 @@ Solid, Collection de Solid : 3D
SMESH_Algo *SMESH_Gen::GetAlgo(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape) SMESH_Algo *SMESH_Gen::GetAlgo(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape)
{ {
//MESSAGE("SMESH_Gen::GetAlgo"); // MESSAGE("SMESH_Gen::GetAlgo");
const SMESHDS_Hypothesis *theHyp = NULL; const SMESHDS_Mesh * meshDS = aMesh.GetMeshDS();
SMESH_Algo *algo = NULL; int dim = GetShapeDim( aShape );
const SMESHDS_Mesh * meshDS = aMesh.GetMeshDS(); int shape_type = aShape.ShapeType();
int hypType; int algo_id = -1;
int hypId;
int algoDim;
// try shape first, then main shape algo_id = getAlgo( meshDS->GetHypothesis( aShape ), dim, shape_type );
TopoDS_Shape mainShape = meshDS->ShapeToMesh(); if (algo_id < 0)
const TopoDS_Shape *shapeToTry[2] = { &aShape, &mainShape }; {
// try ansestors
TopTools_ListIteratorOfListOfShape ancIt( aMesh.GetAncestors( aShape ));
for (; ancIt.More(); ancIt.Next())
{
const TopoDS_Shape& ancestor = ancIt.Value();
algo_id = getAlgo( meshDS->GetHypothesis( ancestor ), dim, shape_type );
if ( algo_id >= 0 )
break;
}
if (algo_id < 0) return NULL;
}
for (int iShape = 0; iShape < 2; iShape++) ASSERT(_mapAlgo.find(algo_id) != _mapAlgo.end());
{
TopoDS_Shape tryShape = (*shapeToTry[iShape]);
const list<const SMESHDS_Hypothesis*>& listHyp = return _mapAlgo[algo_id];
meshDS->GetHypothesis(tryShape);
list<const SMESHDS_Hypothesis*>::const_iterator it=listHyp.begin(); // const SMESHDS_Hypothesis *theHyp = NULL;
// SMESH_Algo *algo = NULL;
// const 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 list<const SMESHDS_Hypothesis*>& listHyp =
// meshDS->GetHypothesis(tryShape);
// list<const SMESHDS_Hypothesis*>::const_iterator it=listHyp.begin();
int nb_algo = 0; // int nb_algo = 0;
int shapeDim = GetShapeDim(aShape); // int shapeDim = GetShapeDim(aShape);
int typeOfShape = aShape.ShapeType(); // int typeOfShape = aShape.ShapeType();
while (it!=listHyp.end()) // while (it!=listHyp.end())
{ // {
const SMESHDS_Hypothesis *anHyp = *it; // const SMESHDS_Hypothesis *anHyp = *it;
hypType = anHyp->GetType(); // hypType = anHyp->GetType();
//SCRUTE(hypType); // //SCRUTE(hypType);
if (hypType > SMESHDS_Hypothesis::PARAM_ALGO) // if (hypType > SMESHDS_Hypothesis::PARAM_ALGO)
{ // {
switch (hypType) // switch (hypType)
{ // {
case SMESHDS_Hypothesis::ALGO_1D: // case SMESHDS_Hypothesis::ALGO_1D:
algoDim = 1; // algoDim = 1;
break; // break;
case SMESHDS_Hypothesis::ALGO_2D: // case SMESHDS_Hypothesis::ALGO_2D:
algoDim = 2; // algoDim = 2;
break; // break;
case SMESHDS_Hypothesis::ALGO_3D: // case SMESHDS_Hypothesis::ALGO_3D:
algoDim = 3; // algoDim = 3;
break; // break;
default: // default:
algoDim = 0; // algoDim = 0;
break; // break;
} // }
//SCRUTE(algoDim); // //SCRUTE(algoDim);
//SCRUTE(shapeDim); // //SCRUTE(shapeDim);
//SCRUTE(typeOfShape); // //SCRUTE(typeOfShape);
if (shapeDim == algoDim) // count only algos of shape dim. // if (shapeDim == algoDim) // count only algos of shape dim.
{ // discard algos for subshapes // { // discard algos for subshapes
hypId = anHyp->GetID(); // (of lower dim.) // hypId = anHyp->GetID(); // (of lower dim.)
ASSERT(_mapAlgo.find(hypId) != _mapAlgo.end()); // ASSERT(_mapAlgo.find(hypId) != _mapAlgo.end());
SMESH_Algo *anAlgo = _mapAlgo[hypId]; // SMESH_Algo *anAlgo = _mapAlgo[hypId];
//SCRUTE(anAlgo->GetShapeType()); // //SCRUTE(anAlgo->GetShapeType());
//if (anAlgo->GetShapeType() == typeOfShape) // //if (anAlgo->GetShapeType() == typeOfShape)
if ((anAlgo->GetShapeType()) & (1 << typeOfShape)) // if ((anAlgo->GetShapeType()) & (1 << typeOfShape))
{ // only specific TopoDS_Shape // { // only specific TopoDS_Shape
nb_algo++; // nb_algo++;
theHyp = anHyp; // theHyp = anHyp;
} // }
} // }
} // }
if (nb_algo > 1) return NULL; // more than one algo // if (nb_algo > 1) return NULL; // more than one algo
it++; // it++;
} // }
if (nb_algo == 1) // one algo found : OK // if (nb_algo == 1) // one algo found : OK
break; // do not try a parent shape // break; // do not try a parent shape
} // }
if (!theHyp) // if (!theHyp)
return NULL; // no algo found // return NULL; // no algo found
hypType = theHyp->GetType(); // hypType = theHyp->GetType();
hypId = theHyp->GetID(); // hypId = theHyp->GetID();
ASSERT(_mapAlgo.find(hypId) != _mapAlgo.end()); // ASSERT(_mapAlgo.find(hypId) != _mapAlgo.end());
algo = _mapAlgo[hypId]; // algo = _mapAlgo[hypId];
//MESSAGE("Algo found " << algo->GetName() << " Id " << hypId); // //MESSAGE("Algo found " << algo->GetName() << " Id " << hypId);
return algo; // return algo;
} }
//============================================================================= //=============================================================================
@ -365,16 +823,12 @@ const char *SMESH_Gen::LocalPersistentIDToIOR(const char *aLocalPersistentID)
*/ */
//============================================================================= //=============================================================================
int SMESH_Gen::GetShapeDim(const TopoDS_Shape & aShape) int SMESH_Gen::GetShapeDim(const TopAbs_ShapeEnum & aShapeType)
{ {
int shapeDim = -1; // Shape dimension: 0D, 1D, 2D, 3D int shapeDim = -1; // Shape dimension: 0D, 1D, 2D, 3D
int type = aShape.ShapeType(); int type = aShapeType;//.ShapeType();
switch (type) switch (type)
{ {
// case TopAbs_COMPOUND:
// {
// break;
// }
case TopAbs_COMPOUND: case TopAbs_COMPOUND:
case TopAbs_COMPSOLID: case TopAbs_COMPSOLID:
case TopAbs_SOLID: case TopAbs_SOLID:
@ -401,6 +855,17 @@ int SMESH_Gen::GetShapeDim(const TopoDS_Shape & aShape)
break; break;
} }
} }
// SCRUTE(shapeDim);
return shapeDim; return shapeDim;
} }
//=============================================================================
/*!
*
*/
//=============================================================================
int SMESH_Gen::GetANewId()
{
//MESSAGE("SMESH_Gen::GetANewId");
return _hypId++;
}

View File

@ -31,7 +31,6 @@
#include "Utils_SALOME_Exception.hxx" #include "Utils_SALOME_Exception.hxx"
#include "SMESH_HypothesisFactory.hxx"
#include "SMESH_Hypothesis.hxx" #include "SMESH_Hypothesis.hxx"
#include "SMESH_Algo.hxx" #include "SMESH_Algo.hxx"
#include "SMESH_1D_Algo.hxx" #include "SMESH_1D_Algo.hxx"
@ -55,42 +54,53 @@ typedef struct studyContextStruct
class SMESH_Gen class SMESH_Gen
{ {
public: public:
SMESH_Gen(); SMESH_Gen();
~SMESH_Gen(); ~SMESH_Gen();
SMESH_Hypothesis *CreateHypothesis(const char *anHyp, int studyId) // SMESH_Hypothesis *CreateHypothesis(const char *anHyp, int studyId)
throw(SALOME_Exception); // throw(SALOME_Exception);
SMESH_Mesh *Init(int studyId, const TopoDS_Shape & aShape) SMESH_Mesh* CreateMesh(int studyId)
throw(SALOME_Exception); throw(SALOME_Exception);
bool Compute(::SMESH_Mesh & aMesh, const TopoDS_Shape & aShape) bool Compute(::SMESH_Mesh & aMesh, const TopoDS_Shape & aShape);
throw(SALOME_Exception);
StudyContextStruct *GetStudyContext(int studyId);
static int GetShapeDim(const TopoDS_Shape & aShape); bool CheckAlgoState(SMESH_Mesh& aMesh, const TopoDS_Shape& aShape);
SMESH_Algo *GetAlgo(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape); // notify on bad state of attached algos, return false
// if Compute() would fail because of some algo bad state
// inherited methods from SALOMEDS::Driver
void Save(int studyId, const char *aUrlOfFile); StudyContextStruct *GetStudyContext(int studyId);
void Load(int studyId, const char *aUrlOfFile);
void Close(int studyId);
const char *ComponentDataType();
const char *IORToLocalPersistentID(const char *IORString, bool & IsAFile); static int GetShapeDim(const TopAbs_ShapeEnum & aShapeType);
const char *LocalPersistentIDToIOR(const char *aLocalPersistentID); static int GetShapeDim(const TopoDS_Shape & aShape)
{ return GetShapeDim( aShape.ShapeType() ); }
SMESH_Algo* GetAlgo(SMESH_Mesh & aMesh, const TopoDS_Shape & aShape);
static bool IsGlobalAlgo(const SMESH_Algo* theAlgo, SMESH_Mesh& aMesh);
SMESH_HypothesisFactory _hypothesisFactory; // inherited methods from SALOMEDS::Driver
map < int, SMESH_Algo * >_mapAlgo; void Save(int studyId, const char *aUrlOfFile);
map < int, SMESH_1D_Algo * >_map1D_Algo; void Load(int studyId, const char *aUrlOfFile);
map < int, SMESH_2D_Algo * >_map2D_Algo; void Close(int studyId);
map < int, SMESH_3D_Algo * >_map3D_Algo; const char *ComponentDataType();
private: const char *IORToLocalPersistentID(const char *IORString, bool & IsAFile);
int _localId; // unique Id of created objects, within SMESH_Gen entity const char *LocalPersistentIDToIOR(const char *aLocalPersistentID);
map < int, StudyContextStruct * >_mapStudyContext;
map < int, SMESH_Hypothesis * >_mapHypothesis; int GetANewId();
map < int, SMESH_Algo * >_mapAlgo;
map < int, SMESH_1D_Algo * >_map1D_Algo;
map < int, SMESH_2D_Algo * >_map2D_Algo;
map < int, SMESH_3D_Algo * >_map3D_Algo;
private:
int _localId; // unique Id of created objects, within SMESH_Gen entity
map < int, StudyContextStruct * >_mapStudyContext;
// hypotheses managing
int _hypId;
}; };
#endif #endif

View File

@ -48,8 +48,8 @@ SMESH_Hypothesis::SMESH_Hypothesis(int hypId,
StudyContextStruct* myStudyContext = _gen->GetStudyContext(_studyId); StudyContextStruct* myStudyContext = _gen->GetStudyContext(_studyId);
myStudyContext->mapHypothesis[_hypId] = this; myStudyContext->mapHypothesis[_hypId] = this;
_type = PARAM_ALGO; _type = PARAM_ALGO;
// _shapeType = -1; // to be set by algo with TopAbs_Enum
_shapeType = 0; // to be set by algo with TopAbs_Enum _shapeType = 0; // to be set by algo with TopAbs_Enum
_param_algo_dim = -1; // to be set by algo parameter
} }
//============================================================================= //=============================================================================
@ -69,7 +69,7 @@ SMESH_Hypothesis::~SMESH_Hypothesis()
*/ */
//============================================================================= //=============================================================================
int SMESH_Hypothesis::GetDim() int SMESH_Hypothesis::GetDim() const
{ {
int dim = -1; int dim = -1;
switch (_type) switch (_type)
@ -77,6 +77,7 @@ int SMESH_Hypothesis::GetDim()
case ALGO_1D: dim = 1; break; case ALGO_1D: dim = 1; break;
case ALGO_2D: dim = 2; break; case ALGO_2D: dim = 2; break;
case ALGO_3D: dim = 3; break; case ALGO_3D: dim = 3; break;
case PARAM_ALGO: dim = _param_algo_dim; break;
} }
return dim; return dim;
} }
@ -87,7 +88,7 @@ int SMESH_Hypothesis::GetDim()
*/ */
//============================================================================= //=============================================================================
int SMESH_Hypothesis::GetShapeType() int SMESH_Hypothesis::GetShapeType() const
{ {
return _shapeType; return _shapeType;
} }
@ -98,7 +99,7 @@ int SMESH_Hypothesis::GetShapeType()
*/ */
//============================================================================= //=============================================================================
int SMESH_Hypothesis::GetStudyId() int SMESH_Hypothesis::GetStudyId() const
{ {
return _studyId; return _studyId;
} }
@ -133,3 +134,28 @@ void SMESH_Hypothesis::NotifySubMeshesHypothesisModification()
} }
} }
//=============================================================================
/*!
*
*/
//=============================================================================
const char* SMESH_Hypothesis::GetLibName() const
{
// MESSAGE("SMESHDS_Hypothesis::GetLibName");
// SCRUTE(_LibName);
// SCRUTE(&_LibName);
return _libName.c_str();
}
//=============================================================================
/*!
*
*/
//=============================================================================
void SMESH_Hypothesis::SetLibName(const char* theLibName)
{
// MESSAGE("SMESHDS_Hypothesis::SetLibName");
_libName = string(theLibName);
}

View File

@ -36,17 +36,39 @@ class SMESH_Gen;
class SMESH_Hypothesis: public SMESHDS_Hypothesis class SMESH_Hypothesis: public SMESHDS_Hypothesis
{ {
public: public:
enum Hypothesis_Status // in the order of severity
{
HYP_OK,
HYP_MISSING, // algo misses a hypothesis
HYP_CONCURENT, // several applicable hypotheses
HYP_BAD_PARAMETER,// hypothesis has a bad parameter value
HYP_UNKNOWN_FATAL,// --- all statuses below should be considered as fatal
// for Add/RemoveHypothesis operations
HYP_INCOMPATIBLE, // hypothesis does not fit algo
HYP_NOTCONFORM, // not conform mesh is produced appling a hypothesis
HYP_ALREADY_EXIST,// such hypothesis already exist
HYP_BAD_DIM // bad dimension
};
static bool IsStatusFatal(Hypothesis_Status theStatus)
{ return theStatus >= HYP_UNKNOWN_FATAL; }
SMESH_Hypothesis(int hypId, int studyId, SMESH_Gen* gen); SMESH_Hypothesis(int hypId, int studyId, SMESH_Gen* gen);
virtual ~SMESH_Hypothesis(); virtual ~SMESH_Hypothesis();
int GetDim(); int GetDim() const;
int GetStudyId(); int GetStudyId() const;
void NotifySubMeshesHypothesisModification(); void NotifySubMeshesHypothesisModification();
int GetShapeType(); int GetShapeType() const;
const char* GetLibName() const;
void SetLibName(const char* theLibName);
protected: protected:
SMESH_Gen* _gen; SMESH_Gen* _gen;
int _studyId; int _studyId;
int _shapeType; int _shapeType;
int _param_algo_dim;
private:
string _libName;
}; };
#endif #endif

View File

@ -30,6 +30,8 @@
#include "SMESH_subMesh.hxx" #include "SMESH_subMesh.hxx"
#include "SMESH_Gen.hxx" #include "SMESH_Gen.hxx"
#include "SMESH_Hypothesis.hxx" #include "SMESH_Hypothesis.hxx"
#include "SMESH_Group.hxx"
#include "SMESHDS_Group.hxx"
#include "SMESHDS_Script.hxx" #include "SMESHDS_Script.hxx"
#include "SMDS_MeshVolume.hxx" #include "SMDS_MeshVolume.hxx"
@ -40,7 +42,15 @@
#include "DriverDAT_W_SMESHDS_Mesh.h" #include "DriverDAT_W_SMESHDS_Mesh.h"
#include "DriverUNV_W_SMESHDS_Mesh.h" #include "DriverUNV_W_SMESHDS_Mesh.h"
#include "DriverMED_R_SMESHDS_Mesh.h"
#include <TCollection_AsciiString.hxx> #include <TCollection_AsciiString.hxx>
#include <memory>
#include <TopTools_ListOfShape.hxx>
#include <TopExp.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include "Utils_ExceptHandlers.hxx"
//============================================================================= //=============================================================================
/*! /*!
@ -61,8 +71,8 @@ SMESH_Mesh::SMESH_Mesh()
*/ */
//============================================================================= //=============================================================================
SMESH_Mesh::SMESH_Mesh(int localId, SMESH_Mesh::SMESH_Mesh(int localId, int studyId, SMESH_Gen * gen, SMESHDS_Document * myDocument)
int studyId, SMESH_Gen * gen, SMESHDS_Document * myDocument) : _groupId( 0 )
{ {
MESSAGE("SMESH_Mesh::SMESH_Mesh(int localId)"); MESSAGE("SMESH_Mesh::SMESH_Mesh(int localId)");
_id = localId; _id = localId;
@ -82,7 +92,14 @@ SMESH_Mesh::SMESH_Mesh(int localId,
SMESH_Mesh::~SMESH_Mesh() SMESH_Mesh::~SMESH_Mesh()
{ {
MESSAGE("SMESH_Mesh::~SMESH_Mesh"); MESSAGE("SMESH_Mesh::~SMESH_Mesh");
// delete groups
map < int, SMESH_Group * >::iterator itg;
for (itg = _mapGroup.begin(); itg != _mapGroup.end(); itg++) {
SMESH_Group *aGroup = (*itg).second;
delete aGroup;
}
} }
//============================================================================= //=============================================================================
@ -91,9 +108,7 @@ SMESH_Mesh::~SMESH_Mesh()
*/ */
//============================================================================= //=============================================================================
void SMESH_Mesh::ShapeToMesh(const TopoDS_Shape & aShape) void SMESH_Mesh::ShapeToMesh(const TopoDS_Shape & aShape){
throw(SALOME_Exception)
{
MESSAGE("SMESH_Mesh::ShapeToMesh"); MESSAGE("SMESH_Mesh::ShapeToMesh");
if (_isShapeToMesh) if (_isShapeToMesh)
throw throw
@ -106,52 +121,42 @@ throw(SALOME_Exception)
TopExp::MapShapes(aShape, _subShapes); TopExp::MapShapes(aShape, _subShapes);
} }
//============================================================================= //=======================================================================
/*! //function : MEDToMesh
* //purpose :
*/ //=======================================================================
//=============================================================================
bool SMESH_Mesh::AddHypothesis(const TopoDS_Shape & aSubShape, int SMESH_Mesh::MEDToMesh(const char* theFileName, const char* theMeshName)
int anHypId) throw(SALOME_Exception)
{ {
MESSAGE("SMESH_Mesh::AddHypothesis"); MESSAGE("MEDToMesh - theFileName = "<<theFileName<<", mesh name = "<<theMeshName);
if(_isShapeToMesh)
throw SALOME_Exception(LOCALIZED("a shape to mesh as already been defined"));
_isShapeToMesh = true;
std::auto_ptr<DriverMED_R_SMESHDS_Mesh> myReader(new DriverMED_R_SMESHDS_Mesh);
myReader->SetMesh(_myMeshDS);
myReader->SetMeshId(-1);
myReader->SetFile(theFileName);
myReader->SetMeshName(theMeshName);
DriverMED_R_SMESHDS_Mesh::ReadStatus status = myReader->ReadMySelf();
MESSAGE("MEDToMesh - _myMeshDS->NbNodes() = "<<_myMeshDS->NbNodes());
MESSAGE("MEDToMesh - _myMeshDS->NbEdges() = "<<_myMeshDS->NbEdges());
MESSAGE("MEDToMesh - _myMeshDS->NbFaces() = "<<_myMeshDS->NbFaces());
MESSAGE("MEDToMesh - _myMeshDS->NbVolumes() = "<<_myMeshDS->NbVolumes());
StudyContextStruct *sc = _gen->GetStudyContext(_studyId); // Reading groups (sub-meshes are out of scope of MED import functionality)
if (sc->mapHypothesis.find(anHypId) == sc->mapHypothesis.end()) list<string> aGroupNames = myReader->GetGroupNames();
{ MESSAGE("MEDToMesh - Nb groups = "<<aGroupNames.size());
MESSAGE("Hypothesis ID does not give an hypothesis"); int anId;
SCRUTE(_studyId); for ( list<string>::iterator it = aGroupNames.begin(); it != aGroupNames.end(); it++ ) {
SCRUTE(anHypId); SMESH_Group* aGroup = AddGroup( SMDSAbs_All, it->c_str(), anId );
throw SALOME_Exception(LOCALIZED("hypothesis does not exist")); if ( aGroup ) {
} MESSAGE("MEDToMesh - group added: "<<it->c_str());
SMESHDS_Group* aGroupDS = aGroup->GetGroupDS();
SMESH_subMesh *subMesh = GetSubMesh(aSubShape); aGroupDS->SetStoreName( it->c_str() );
SMESH_Hypothesis *anHyp = sc->mapHypothesis[anHypId]; myReader->GetGroup( aGroupDS );
int event; }
}
// shape return (int) status;
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;
} }
//============================================================================= //=============================================================================
@ -160,9 +165,78 @@ bool SMESH_Mesh::AddHypothesis(const TopoDS_Shape & aSubShape,
*/ */
//============================================================================= //=============================================================================
bool SMESH_Mesh::RemoveHypothesis(const TopoDS_Shape & aSubShape, SMESH_Hypothesis::Hypothesis_Status
int anHypId)throw(SALOME_Exception) SMESH_Mesh::AddHypothesis(const TopoDS_Shape & aSubShape,
int anHypId) throw(SALOME_Exception)
{ {
Unexpect aCatch(SalomeException);
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];
SCRUTE( anHyp->GetName() );
int event;
bool isGlobalHyp = IsMainShape( aSubShape );
// NotConformAllowed can be only global
if ( !isGlobalHyp )
{
string hypName = anHyp->GetName();
if ( hypName == "NotConformAllowed" )
{
MESSAGE( "Hypotesis <NotConformAllowed> can be only global" );
return SMESH_Hypothesis::HYP_INCOMPATIBLE;
}
}
// shape
if (anHyp->GetType() == SMESHDS_Hypothesis::PARAM_ALGO)
event = SMESH_subMesh::ADD_HYP;
else
event = SMESH_subMesh::ADD_ALGO;
SMESH_Hypothesis::Hypothesis_Status ret = subMesh->AlgoStateEngine(event, anHyp);
// subShapes
if (!SMESH_Hypothesis::IsStatusFatal(ret) &&
!subMesh->IsApplicableHypotesis( anHyp )) // is added on father
{
if (anHyp->GetType() == SMESHDS_Hypothesis::PARAM_ALGO)
event = SMESH_subMesh::ADD_FATHER_HYP;
else
event = SMESH_subMesh::ADD_FATHER_ALGO;
SMESH_Hypothesis::Hypothesis_Status ret2 =
subMesh->SubMeshesAlgoStateEngine(event, anHyp);
if (ret2 > ret)
ret = ret2;
}
subMesh->DumpAlgoState(true);
SCRUTE(ret);
return ret;
}
//=============================================================================
/*!
*
*/
//=============================================================================
SMESH_Hypothesis::Hypothesis_Status
SMESH_Mesh::RemoveHypothesis(const TopoDS_Shape & aSubShape,
int anHypId)throw(SALOME_Exception)
{
Unexpect aCatch(SalomeException);
MESSAGE("SMESH_Mesh::RemoveHypothesis"); MESSAGE("SMESH_Mesh::RemoveHypothesis");
StudyContextStruct *sc = _gen->GetStudyContext(_studyId); StudyContextStruct *sc = _gen->GetStudyContext(_studyId);
@ -181,18 +255,20 @@ bool SMESH_Mesh::RemoveHypothesis(const TopoDS_Shape & aSubShape,
event = SMESH_subMesh::REMOVE_HYP; event = SMESH_subMesh::REMOVE_HYP;
else else
event = SMESH_subMesh::REMOVE_ALGO; event = SMESH_subMesh::REMOVE_ALGO;
int ret = subMesh->AlgoStateEngine(event, anHyp); SMESH_Hypothesis::Hypothesis_Status ret = subMesh->AlgoStateEngine(event, anHyp);
// subShapes (only when shape is mainShape) // subShapes
if (!SMESH_Hypothesis::IsStatusFatal(ret) &&
TopoDS_Shape mainShape = _myMeshDS->ShapeToMesh(); !subMesh->IsApplicableHypotesis( anHyp )) // is removed from father
if (aSubShape.IsSame(mainShape))
{ {
if (anHyp->GetType() == SMESHDS_Hypothesis::PARAM_ALGO) if (anHyp->GetType() == SMESHDS_Hypothesis::PARAM_ALGO)
event = SMESH_subMesh::REMOVE_FATHER_HYP; event = SMESH_subMesh::REMOVE_FATHER_HYP;
else else
event = SMESH_subMesh::REMOVE_FATHER_ALGO; event = SMESH_subMesh::REMOVE_FATHER_ALGO;
subMesh->SubMeshesAlgoStateEngine(event, anHyp); SMESH_Hypothesis::Hypothesis_Status ret2 =
subMesh->SubMeshesAlgoStateEngine(event, anHyp);
if (ret2 > ret) // more severe
ret = ret2;
} }
subMesh->DumpAlgoState(true); subMesh->DumpAlgoState(true);
@ -218,22 +294,24 @@ SMESHDS_Mesh * SMESH_Mesh::GetMeshDS()
//============================================================================= //=============================================================================
const list<const SMESHDS_Hypothesis*>& const list<const SMESHDS_Hypothesis*>&
SMESH_Mesh::GetHypothesisList(const TopoDS_Shape & aSubShape) SMESH_Mesh::GetHypothesisList(const TopoDS_Shape & aSubShape) const
throw(SALOME_Exception) throw(SALOME_Exception)
{ {
MESSAGE("SMESH_Mesh::GetHypothesisList"); Unexpect aCatch(SalomeException);
_subShapeHypothesisList.clear(); // MESSAGE("SMESH_Mesh::GetHypothesisList");
const list<const SMESHDS_Hypothesis*>& listHyp = // _subShapeHypothesisList.clear();
_myMeshDS->GetHypothesis(aSubShape); // const list<const SMESHDS_Hypothesis*>& listHyp =
// _myMeshDS->GetHypothesis(aSubShape);
list<const SMESHDS_Hypothesis*>::const_iterator it=listHyp.begin(); // list<const SMESHDS_Hypothesis*>::const_iterator it=listHyp.begin();
while (it!=listHyp.end()) // while (it!=listHyp.end())
{ // {
const SMESHDS_Hypothesis *anHyp = *it; // const SMESHDS_Hypothesis *anHyp = *it;
_subShapeHypothesisList.push_back(anHyp); // _subShapeHypothesisList.push_back(anHyp);
it++; // it++;
} // }
return _subShapeHypothesisList; // return _subShapeHypothesisList;
return _myMeshDS->GetHypothesis(aSubShape);
} }
//============================================================================= //=============================================================================
@ -244,6 +322,7 @@ const list<const SMESHDS_Hypothesis*>&
const list<SMESHDS_Command*> & SMESH_Mesh::GetLog() throw(SALOME_Exception) const list<SMESHDS_Command*> & SMESH_Mesh::GetLog() throw(SALOME_Exception)
{ {
Unexpect aCatch(SalomeException);
MESSAGE("SMESH_Mesh::GetLog"); MESSAGE("SMESH_Mesh::GetLog");
return _myMeshDS->GetScript()->GetCommands(); return _myMeshDS->GetScript()->GetCommands();
} }
@ -255,6 +334,7 @@ const list<SMESHDS_Command*> & SMESH_Mesh::GetLog() throw(SALOME_Exception)
//============================================================================= //=============================================================================
void SMESH_Mesh::ClearLog() throw(SALOME_Exception) void SMESH_Mesh::ClearLog() throw(SALOME_Exception)
{ {
Unexpect aCatch(SalomeException);
MESSAGE("SMESH_Mesh::ClearLog"); MESSAGE("SMESH_Mesh::ClearLog");
_myMeshDS->GetScript()->Clear(); _myMeshDS->GetScript()->Clear();
} }
@ -291,9 +371,11 @@ SMESH_Gen *SMESH_Mesh::GetGen()
SMESH_subMesh *SMESH_Mesh::GetSubMesh(const TopoDS_Shape & aSubShape) SMESH_subMesh *SMESH_Mesh::GetSubMesh(const TopoDS_Shape & aSubShape)
throw(SALOME_Exception) throw(SALOME_Exception)
{ {
Unexpect aCatch(SalomeException);
//MESSAGE("SMESH_Mesh::GetSubMesh"); //MESSAGE("SMESH_Mesh::GetSubMesh");
SMESH_subMesh *aSubMesh; SMESH_subMesh *aSubMesh;
int index = _subShapes.FindIndex(aSubShape); int index = _subShapes.FindIndex(aSubShape);
if (_mapSubMesh.find(index) != _mapSubMesh.end()) if (_mapSubMesh.find(index) != _mapSubMesh.end())
{ {
aSubMesh = _mapSubMesh[index]; aSubMesh = _mapSubMesh[index];
@ -343,6 +425,7 @@ throw(SALOME_Exception)
SMESH_subMesh *SMESH_Mesh::GetSubMeshContaining(const TopoDS_Shape & aSubShape) SMESH_subMesh *SMESH_Mesh::GetSubMeshContaining(const TopoDS_Shape & aSubShape)
throw(SALOME_Exception) throw(SALOME_Exception)
{ {
Unexpect aCatch(SalomeException);
//MESSAGE("SMESH_Mesh::GetSubMeshContaining"); //MESSAGE("SMESH_Mesh::GetSubMeshContaining");
bool isFound = false; bool isFound = false;
SMESH_subMesh *aSubMesh = NULL; SMESH_subMesh *aSubMesh = NULL;
@ -379,6 +462,68 @@ throw(SALOME_Exception)
return aSubMesh; return aSubMesh;
} }
//=======================================================================
//function : IsUsedHypothesis
//purpose : Return True if anHyp is used to mesh aSubShape
//=======================================================================
bool SMESH_Mesh::IsUsedHypothesis(SMESHDS_Hypothesis * anHyp,
const TopoDS_Shape & aSubShape)
{
//MESSAGE( "SMESH_Mesh::IsUsedHypothesis" );
// check if anHyp is applicable to aSubShape
SMESH_subMesh * subMesh = GetSubMeshContaining( aSubShape );
if (!subMesh ||
!subMesh->IsApplicableHypotesis(static_cast<SMESH_Hypothesis*>(anHyp)))
return false;
SMESH_Algo *algo = _gen->GetAlgo(*this, aSubShape);
// algorithm
if (anHyp->GetType() > SMESHDS_Hypothesis::PARAM_ALGO)
return ( anHyp == algo );
// algorithm parameter
if (algo)
{
// look trough hypotheses used by algo
const list <const SMESHDS_Hypothesis * >&usedHyps =
algo->GetUsedHypothesis(*this, aSubShape);
list <const SMESHDS_Hypothesis * >::const_iterator itl;
for (itl = usedHyps.begin(); itl != usedHyps.end(); itl++)
if (anHyp == (*itl))
return true;
}
else
{
// look through all assigned hypotheses
{
const list <const SMESHDS_Hypothesis * >&usedHyps =
_myMeshDS->GetHypothesis( aSubShape );
list <const SMESHDS_Hypothesis * >::const_iterator itl;
for (itl = usedHyps.begin(); itl != usedHyps.end(); itl++)
if (anHyp == (*itl))
return true;
}
// on ancestors
TopTools_ListIteratorOfListOfShape it( GetAncestors( aSubShape ));
for (; it.More(); it.Next())
{
const list <const SMESHDS_Hypothesis * >&usedHyps =
_myMeshDS->GetHypothesis( aSubShape );
list <const SMESHDS_Hypothesis * >::const_iterator itl;
for (itl = usedHyps.begin(); itl != usedHyps.end(); itl++)
if (anHyp == (*itl))
return true;
}
}
return false;
}
//============================================================================= //=============================================================================
/*! /*!
* *
@ -389,27 +534,14 @@ const list < SMESH_subMesh * >&
SMESH_Mesh::GetSubMeshUsingHypothesis(SMESHDS_Hypothesis * anHyp) SMESH_Mesh::GetSubMeshUsingHypothesis(SMESHDS_Hypothesis * anHyp)
throw(SALOME_Exception) throw(SALOME_Exception)
{ {
Unexpect aCatch(SalomeException);
MESSAGE("SMESH_Mesh::GetSubMeshUsingHypothesis"); MESSAGE("SMESH_Mesh::GetSubMeshUsingHypothesis");
map < int, SMESH_subMesh * >::iterator itsm; map < int, SMESH_subMesh * >::iterator itsm;
_subMeshesUsingHypothesisList.clear(); _subMeshesUsingHypothesisList.clear();
for (itsm = _mapSubMesh.begin(); itsm != _mapSubMesh.end(); itsm++) for (itsm = _mapSubMesh.begin(); itsm != _mapSubMesh.end(); itsm++)
{ {
SMESH_subMesh *aSubMesh = (*itsm).second; SMESH_subMesh *aSubMesh = (*itsm).second;
bool usesHyp = false; if ( IsUsedHypothesis ( anHyp, aSubMesh->GetSubShape() ))
SMESH_Algo *algo = _gen->GetAlgo(*this, aSubMesh->GetSubShape());
if (algo != NULL)
{
const list <const SMESHDS_Hypothesis * >&usedHyps
= algo->GetUsedHypothesis(*this, aSubMesh->GetSubShape());
list <const SMESHDS_Hypothesis * >::const_iterator itl;
for (itl = usedHyps.begin(); itl != usedHyps.end(); itl++)
if (anHyp == (*itl))
{
usesHyp = true;
break;
}
}
if (usesHyp)
_subMeshesUsingHypothesisList.push_back(aSubMesh); _subMeshesUsingHypothesisList.push_back(aSubMesh);
} }
return _subMeshesUsingHypothesisList; return _subMeshesUsingHypothesisList;
@ -421,17 +553,39 @@ throw(SALOME_Exception)
*/ */
//============================================================================= //=============================================================================
void SMESH_Mesh::ExportMED(const char *file) throw(SALOME_Exception) void SMESH_Mesh::ExportMED(const char *file, const char* theMeshName, bool theAutoGroups) throw(SALOME_Exception)
{ {
Mesh_Writer *myWriter = new DriverMED_W_SMESHDS_Mesh; Unexpect aCatch(SalomeException);
myWriter->SetFile(string(file)); std::auto_ptr<DriverMED_W_SMESHDS_Mesh> myWriter(new DriverMED_W_SMESHDS_Mesh);
myWriter->SetMesh(_myMeshDS); myWriter ->SetFile ( file );
MESSAGE(" _idDoc " << _idDoc) myWriter->SetMeshId(_idDoc); myWriter ->SetMesh ( _myMeshDS );
myWriter->Add(); if ( !theMeshName )
myWriter->SetMeshId ( _idDoc );
else {
myWriter->SetMeshId ( -1 );
myWriter->SetMeshName( theMeshName );
}
if ( theAutoGroups ) {
myWriter->AddGroupOfNodes();
myWriter->AddGroupOfEdges();
myWriter->AddGroupOfFaces();
myWriter->AddGroupOfVolumes();
}
for ( map<int, SMESH_Group*>::iterator it = _mapGroup.begin(); it != _mapGroup.end(); it++ ) {
SMESH_Group* aGroup = it->second;
SMESHDS_Group* aGroupDS = aGroup->GetGroupDS();
aGroupDS->SetStoreName( aGroup->GetName() );
myWriter->AddGroup( aGroupDS );
}
myWriter->Add();
} }
void SMESH_Mesh::ExportDAT(const char *file) throw(SALOME_Exception) void SMESH_Mesh::ExportDAT(const char *file) throw(SALOME_Exception)
{ {
Unexpect aCatch(SalomeException);
Mesh_Writer *myWriter = new DriverDAT_W_SMESHDS_Mesh; Mesh_Writer *myWriter = new DriverDAT_W_SMESHDS_Mesh;
myWriter->SetFile(string(file)); myWriter->SetFile(string(file));
myWriter->SetMesh(_myMeshDS); myWriter->SetMesh(_myMeshDS);
@ -441,6 +595,7 @@ void SMESH_Mesh::ExportDAT(const char *file) throw(SALOME_Exception)
void SMESH_Mesh::ExportUNV(const char *file) throw(SALOME_Exception) void SMESH_Mesh::ExportUNV(const char *file) throw(SALOME_Exception)
{ {
Unexpect aCatch(SalomeException);
Mesh_Writer *myWriter = new DriverUNV_W_SMESHDS_Mesh; Mesh_Writer *myWriter = new DriverUNV_W_SMESHDS_Mesh;
myWriter->SetFile(string(file)); myWriter->SetFile(string(file));
myWriter->SetMesh(_myMeshDS); myWriter->SetMesh(_myMeshDS);
@ -455,6 +610,7 @@ void SMESH_Mesh::ExportUNV(const char *file) throw(SALOME_Exception)
//============================================================================= //=============================================================================
int SMESH_Mesh::NbNodes() throw(SALOME_Exception) int SMESH_Mesh::NbNodes() throw(SALOME_Exception)
{ {
Unexpect aCatch(SalomeException);
return _myMeshDS->NbNodes(); return _myMeshDS->NbNodes();
} }
@ -465,6 +621,7 @@ int SMESH_Mesh::NbNodes() throw(SALOME_Exception)
//============================================================================= //=============================================================================
int SMESH_Mesh::NbEdges() throw(SALOME_Exception) int SMESH_Mesh::NbEdges() throw(SALOME_Exception)
{ {
Unexpect aCatch(SalomeException);
return _myMeshDS->NbEdges(); return _myMeshDS->NbEdges();
} }
@ -475,6 +632,7 @@ int SMESH_Mesh::NbEdges() throw(SALOME_Exception)
//============================================================================= //=============================================================================
int SMESH_Mesh::NbFaces() throw(SALOME_Exception) int SMESH_Mesh::NbFaces() throw(SALOME_Exception)
{ {
Unexpect aCatch(SalomeException);
return _myMeshDS->NbFaces(); return _myMeshDS->NbFaces();
} }
@ -483,11 +641,11 @@ int SMESH_Mesh::NbFaces() throw(SALOME_Exception)
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
int SMESH_Mesh::NbTriangles() throw(SALOME_Exception) int SMESH_Mesh::NbTriangles() throw(SALOME_Exception)
{ {
Unexpect aCatch(SalomeException);
int Nb = 0; int Nb = 0;
SMDS_Iterator<const SMDS_MeshFace*> * itFaces=_myMeshDS->facesIterator(); SMDS_FaceIteratorPtr itFaces=_myMeshDS->facesIterator();
while(itFaces->more()) if(itFaces->next()->NbNodes()==3) Nb++; while(itFaces->more()) if(itFaces->next()->NbNodes()==3) Nb++;
delete itFaces;
return Nb; return Nb;
} }
@ -496,11 +654,11 @@ int SMESH_Mesh::NbTriangles() throw(SALOME_Exception)
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
int SMESH_Mesh::NbQuadrangles() throw(SALOME_Exception) int SMESH_Mesh::NbQuadrangles() throw(SALOME_Exception)
{ {
Unexpect aCatch(SalomeException);
int Nb = 0; int Nb = 0;
SMDS_Iterator<const SMDS_MeshFace*> * itFaces=_myMeshDS->facesIterator(); SMDS_FaceIteratorPtr itFaces=_myMeshDS->facesIterator();
while(itFaces->more()) if(itFaces->next()->NbNodes()==4) Nb++; while(itFaces->more()) if(itFaces->next()->NbNodes()==4) Nb++;
delete itFaces;
return Nb; return Nb;
} }
@ -511,24 +669,43 @@ int SMESH_Mesh::NbQuadrangles() throw(SALOME_Exception)
//============================================================================= //=============================================================================
int SMESH_Mesh::NbVolumes() throw(SALOME_Exception) int SMESH_Mesh::NbVolumes() throw(SALOME_Exception)
{ {
Unexpect aCatch(SalomeException);
return _myMeshDS->NbVolumes(); return _myMeshDS->NbVolumes();
} }
int SMESH_Mesh::NbTetras() throw(SALOME_Exception) int SMESH_Mesh::NbTetras() throw(SALOME_Exception)
{ {
Unexpect aCatch(SalomeException);
int Nb = 0; int Nb = 0;
SMDS_Iterator<const SMDS_MeshVolume*> * itVolumes=_myMeshDS->volumesIterator(); SMDS_VolumeIteratorPtr itVolumes=_myMeshDS->volumesIterator();
while(itVolumes->more()) if(itVolumes->next()->NbNodes()==4) Nb++; while(itVolumes->more()) if(itVolumes->next()->NbNodes()==4) Nb++;
delete itVolumes;
return Nb; return Nb;
} }
int SMESH_Mesh::NbHexas() throw(SALOME_Exception) int SMESH_Mesh::NbHexas() throw(SALOME_Exception)
{ {
Unexpect aCatch(SalomeException);
int Nb = 0; int Nb = 0;
SMDS_Iterator<const SMDS_MeshVolume*> * itVolumes=_myMeshDS->volumesIterator(); SMDS_VolumeIteratorPtr itVolumes=_myMeshDS->volumesIterator();
while(itVolumes->more()) if(itVolumes->next()->NbNodes()==8) Nb++; while(itVolumes->more()) if(itVolumes->next()->NbNodes()==8) Nb++;
delete itVolumes; return Nb;
}
int SMESH_Mesh::NbPyramids() throw(SALOME_Exception)
{
Unexpect aCatch(SalomeException);
int Nb = 0;
SMDS_VolumeIteratorPtr itVolumes=_myMeshDS->volumesIterator();
while(itVolumes->more()) if(itVolumes->next()->NbNodes()==5) Nb++;
return Nb;
}
int SMESH_Mesh::NbPrisms() throw(SALOME_Exception)
{
Unexpect aCatch(SalomeException);
int Nb = 0;
SMDS_VolumeIteratorPtr itVolumes=_myMeshDS->volumesIterator();
while(itVolumes->more()) if(itVolumes->next()->NbNodes()==6) Nb++;
return Nb; return Nb;
} }
@ -539,5 +716,187 @@ int SMESH_Mesh::NbHexas() throw(SALOME_Exception)
//============================================================================= //=============================================================================
int SMESH_Mesh::NbSubMesh() throw(SALOME_Exception) int SMESH_Mesh::NbSubMesh() throw(SALOME_Exception)
{ {
Unexpect aCatch(SalomeException);
return _myMeshDS->NbSubMesh(); return _myMeshDS->NbSubMesh();
} }
//=======================================================================
//function : IsNotConformAllowed
//purpose : check if a hypothesis alowing notconform mesh is present
//=======================================================================
bool SMESH_Mesh::IsNotConformAllowed() const
{
MESSAGE("SMESH_Mesh::IsNotConformAllowed");
const list<const SMESHDS_Hypothesis*>& listHyp =
_myMeshDS->GetHypothesis( _myMeshDS->ShapeToMesh() );
list<const SMESHDS_Hypothesis*>::const_iterator it=listHyp.begin();
while (it!=listHyp.end())
{
const SMESHDS_Hypothesis *aHyp = *it;
string hypName = aHyp->GetName();
if ( hypName == "NotConformAllowed" )
return true;
it++;
}
return false;
}
//=======================================================================
//function : IsMainShape
//purpose :
//=======================================================================
bool SMESH_Mesh::IsMainShape(const TopoDS_Shape& theShape) const
{
return theShape.IsSame(_myMeshDS->ShapeToMesh() );
}
//=============================================================================
/*!
*
*/
//=============================================================================
SMESH_Group* SMESH_Mesh::AddGroup (const SMDSAbs_ElementType theType,
const char* theName,
int& theId)
{
if (_mapGroup.find(_groupId) != _mapGroup.end())
return NULL;
SMESH_Group* aGroup = new SMESH_Group (this, theType, theName);
theId = _groupId;
_mapGroup[_groupId++] = aGroup;
return aGroup;
}
//=============================================================================
/*!
*
*/
//=============================================================================
SMESH_Group* SMESH_Mesh::GetGroup (const int theGroupID)
{
if (_mapGroup.find(theGroupID) == _mapGroup.end())
return NULL;
return _mapGroup[theGroupID];
}
//=============================================================================
/*!
*
*/
//=============================================================================
list<int> SMESH_Mesh::GetGroupIds()
{
list<int> anIds;
for ( map<int, SMESH_Group*>::const_iterator it = _mapGroup.begin(); it != _mapGroup.end(); it++ )
anIds.push_back( it->first );
return anIds;
}
//=============================================================================
/*!
*
*/
//=============================================================================
void SMESH_Mesh::RemoveGroup (const int theGroupID)
{
if (_mapGroup.find(theGroupID) == _mapGroup.end())
return;
delete _mapGroup[theGroupID];
_mapGroup.erase (theGroupID);
}
//=======================================================================
//function : GetAncestors
//purpose : return list of ancestors of theSubShape in the order
// that lower dimention shapes come first.
//=======================================================================
const TopTools_ListOfShape& SMESH_Mesh::GetAncestors(const TopoDS_Shape& theS)
{
if ( _mapAncestors.IsEmpty() )
{
// fill _mapAncestors
int desType, ancType;
for ( desType = TopAbs_EDGE; desType > TopAbs_COMPOUND; desType-- )
for ( ancType = desType - 1; ancType >= TopAbs_COMPOUND; ancType-- )
TopExp::MapShapesAndAncestors (_myMeshDS->ShapeToMesh(),
(TopAbs_ShapeEnum) desType,
(TopAbs_ShapeEnum) ancType,
_mapAncestors );
}
if ( _mapAncestors.Contains( theS ) )
return _mapAncestors.FindFromKey( theS );
static TopTools_ListOfShape emptyList;
return emptyList;
}
//=======================================================================
//function : Dump
//purpose : dumps contents of mesh to stream [ debug purposes ]
//=======================================================================
ostream& SMESH_Mesh::Dump(ostream& save)
{
save << "========================== Dump contents of mesh ==========================" << endl;
save << "1) Total number of nodes: " << NbNodes() << endl;
save << "2) Total number of edges: " << NbEdges() << endl;
save << "3) Total number of faces: " << NbFaces() << endl;
if ( NbFaces() > 0 ) {
int nb3 = NbTriangles();
int nb4 = NbQuadrangles();
save << "3.1.) Number of triangles: " << nb3 << endl;
save << "3.2.) Number of quadrangles: " << nb4 << endl;
if ( nb3 + nb4 != NbFaces() ) {
map<int,int> myFaceMap;
SMDS_FaceIteratorPtr itFaces=_myMeshDS->facesIterator();
while( itFaces->more( ) ) {
int nbNodes = itFaces->next()->NbNodes();
if ( myFaceMap.find( nbNodes ) == myFaceMap.end() )
myFaceMap[ nbNodes ] = 0;
myFaceMap[ nbNodes ] = myFaceMap[ nbNodes ] + 1;
}
save << "3.3.) Faces in detail: " << endl;
map <int,int>::iterator itF;
for (itF = myFaceMap.begin(); itF != myFaceMap.end(); itF++)
save << "--> nb nodes: " << itF->first << " - nb elemens: " << itF->second << endl;
}
}
save << "4) Total number of volumes: " << NbVolumes() << endl;
if ( NbVolumes() > 0 ) {
int nb8 = NbHexas();
int nb4 = NbTetras();
int nb5 = NbPyramids();
int nb6 = NbPrisms();
save << "4.1.) Number of hexahedrons: " << nb8 << endl;
save << "4.2.) Number of tetrahedrons: " << nb4 << endl;
save << "4.3.) Number of prisms: " << nb6 << endl;
save << "4.4.) Number of pyramides: " << nb5 << endl;
if ( nb8 + nb4 + nb5 + nb6 != NbVolumes() ) {
map<int,int> myVolumesMap;
SMDS_VolumeIteratorPtr itVolumes=_myMeshDS->volumesIterator();
while( itVolumes->more( ) ) {
int nbNodes = itVolumes->next()->NbNodes();
if ( myVolumesMap.find( nbNodes ) == myVolumesMap.end() )
myVolumesMap[ nbNodes ] = 0;
myVolumesMap[ nbNodes ] = myVolumesMap[ nbNodes ] + 1;
}
save << "4.5.) Volumes in detail: " << endl;
map <int,int>::iterator itV;
for (itV = myVolumesMap.begin(); itV != myVolumesMap.end(); itV++)
save << "--> nb nodes: " << itV->first << " - nb elemens: " << itV->second << endl;
}
}
save << "===========================================================================" << endl;
return save;
}

View File

@ -34,6 +34,7 @@
#include "SMESHDS_Command.hxx" #include "SMESHDS_Command.hxx"
#include "SMESH_Hypothesis.hxx" #include "SMESH_Hypothesis.hxx"
#include "SMESH_subMesh.hxx" #include "SMESH_subMesh.hxx"
#include <SMDSAbs_ElementType.hxx>
#include "Utils_SALOME_Exception.hxx" #include "Utils_SALOME_Exception.hxx"
#include <TopExp.hxx> #include <TopExp.hxx>
@ -50,12 +51,25 @@
#include <TopoDS_Vertex.hxx> #include <TopoDS_Vertex.hxx>
#include <TopoDS_Shape.hxx> #include <TopoDS_Shape.hxx>
#include <TopTools_IndexedMapOfShape.hxx> #include <TopTools_IndexedMapOfShape.hxx>
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <vector> #include <vector>
#include <list> #include <list>
#include <map> #include <map>
#if (__GNUC__>2)
#include <string>
#include <istream>
#include <ostream>
#else
#include <string>
#include <istream.h>
#include <ostream.h>
#endif
class SMESH_Gen; class SMESH_Gen;
class SMESH_Group;
class TopTools_ListOfShape;
class SMESH_Mesh class SMESH_Mesh
{ {
@ -64,18 +78,24 @@ class SMESH_Mesh
SMESH_Mesh(int localId, int studyId, SMESH_Gen * gen, SMESH_Mesh(int localId, int studyId, SMESH_Gen * gen,
SMESHDS_Document * myDocument); SMESHDS_Document * myDocument);
virtual ~ SMESH_Mesh(); virtual ~SMESH_Mesh();
void ShapeToMesh(const TopoDS_Shape & aShape) throw(SALOME_Exception); void ShapeToMesh(const TopoDS_Shape & aShape);
/*!
* consult DriverMED_R_SMESHDS_Mesh::ReadStatus for returned value
*/
int MEDToMesh(const char* theFileName, const char* theMeshName);
bool AddHypothesis(const TopoDS_Shape & aSubShape, int anHypId) SMESH_Hypothesis::Hypothesis_Status
AddHypothesis(const TopoDS_Shape & aSubShape, int anHypId)
throw(SALOME_Exception); throw(SALOME_Exception);
bool RemoveHypothesis(const TopoDS_Shape & aSubShape, int anHypId) SMESH_Hypothesis::Hypothesis_Status
RemoveHypothesis(const TopoDS_Shape & aSubShape, int anHypId)
throw(SALOME_Exception); throw(SALOME_Exception);
const list <const SMESHDS_Hypothesis * >& const list <const SMESHDS_Hypothesis * >&
GetHypothesisList(const TopoDS_Shape & aSubShape) GetHypothesisList(const TopoDS_Shape & aSubShape) const
throw(SALOME_Exception); throw(SALOME_Exception);
const list<SMESHDS_Command*> & GetLog() throw(SALOME_Exception); const list<SMESHDS_Command*> & GetLog() throw(SALOME_Exception);
@ -101,8 +121,21 @@ class SMESH_Mesh
GetSubMeshUsingHypothesis(SMESHDS_Hypothesis * anHyp) GetSubMeshUsingHypothesis(SMESHDS_Hypothesis * anHyp)
throw(SALOME_Exception); throw(SALOME_Exception);
bool IsUsedHypothesis(SMESHDS_Hypothesis * anHyp,
const TopoDS_Shape & aSubShape);
// Return True if anHyp is used to mesh aSubShape
bool IsNotConformAllowed() const;
// check if a hypothesis alowing notconform mesh is present
bool IsMainShape(const TopoDS_Shape& theShape) const;
const TopTools_ListOfShape& GetAncestors(const TopoDS_Shape& theSubShape);
// return list of ancestors of theSubShape in the order
// that lower dimention shapes come first.
void ExportDAT(const char *file) throw(SALOME_Exception); void ExportDAT(const char *file) throw(SALOME_Exception);
void ExportMED(const char *file) throw(SALOME_Exception); void ExportMED(const char *file, const char* theMeshName = NULL, bool theAutoGroups = true) throw(SALOME_Exception);
void ExportUNV(const char *file) throw(SALOME_Exception); void ExportUNV(const char *file) throw(SALOME_Exception);
int NbNodes() throw(SALOME_Exception); int NbNodes() throw(SALOME_Exception);
@ -121,21 +154,43 @@ class SMESH_Mesh
int NbHexas() throw(SALOME_Exception); int NbHexas() throw(SALOME_Exception);
int NbPyramids() throw(SALOME_Exception);
int NbPrisms() throw(SALOME_Exception);
int NbSubMesh() throw(SALOME_Exception); int NbSubMesh() throw(SALOME_Exception);
int NbGroup() const { return _mapGroup.size(); }
SMESH_Group* AddGroup (const SMDSAbs_ElementType theType,
const char* theName,
int& theId);
SMESH_Group* GetGroup (const int theGroupID);
list<int> GetGroupIds();
void RemoveGroup (const int theGroupID);
ostream& Dump(ostream & save);
private: private:
int _id; // id given by creator (unique within the creator instance) int _id; // id given by creator (unique within the creator instance)
int _studyId; int _studyId;
int _idDoc; // id given by SMESHDS_Document int _idDoc; // id given by SMESHDS_Document
bool _isShapeToMesh; // set to true when a shape is given (only once) int _groupId; // id generator for group objects
bool _isShapeToMesh; // set to true when a shape is given (only once)
list<const SMESHDS_Hypothesis *> _subShapeHypothesisList; list<const SMESHDS_Hypothesis *> _subShapeHypothesisList;
list <SMESH_subMesh *> _subMeshesUsingHypothesisList; list <SMESH_subMesh *> _subMeshesUsingHypothesisList;
SMESHDS_Document * _myDocument; SMESHDS_Document * _myDocument;
SMESHDS_Mesh * _myMeshDS; SMESHDS_Mesh * _myMeshDS;
TopTools_IndexedMapOfShape _subShapes; TopTools_IndexedMapOfShape _subShapes;
map <int, SMESH_subMesh *>_mapSubMesh; map <int, SMESH_subMesh *> _mapSubMesh;
map <int, SMESH_Group *> _mapGroup;
SMESH_Gen *_gen; SMESH_Gen *_gen;
TopTools_IndexedDataMapOfShapeListOfShape _mapAncestors;
}; };
#endif #endif

File diff suppressed because it is too large Load Diff

View File

@ -31,6 +31,7 @@
#include "SMESHDS_Mesh.hxx" #include "SMESHDS_Mesh.hxx"
#include "SMESHDS_SubMesh.hxx" #include "SMESHDS_SubMesh.hxx"
#include "SMESH_Hypothesis.hxx"
#include "Utils_SALOME_Exception.hxx" #include "Utils_SALOME_Exception.hxx"
#include <TopoDS_Shape.hxx> #include <TopoDS_Shape.hxx>
#include <TColStd_IndexedMapOfTransient.hxx> #include <TColStd_IndexedMapOfTransient.hxx>
@ -42,90 +43,136 @@
class SMESH_Mesh; class SMESH_Mesh;
class SMESH_Hypothesis; class SMESH_Hypothesis;
class SMESH_Algo;
class SMESH_Gen;
class SMESH_subMesh class SMESH_subMesh
{ {
public: public:
SMESH_subMesh(int Id, SMESH_Mesh * father, SMESHDS_Mesh * meshDS, SMESH_subMesh(int Id, SMESH_Mesh * father, SMESHDS_Mesh * meshDS,
const TopoDS_Shape & aSubShape); const TopoDS_Shape & aSubShape);
virtual ~ SMESH_subMesh(); virtual ~ SMESH_subMesh();
int GetId(); int GetId() const;
// bool Contains(const TopoDS_Shape & aSubShape) // bool Contains(const TopoDS_Shape & aSubShape)
// throw (SALOME_Exception); // throw (SALOME_Exception);
SMESHDS_SubMesh * GetSubMeshDS() throw(SALOME_Exception); SMESHDS_SubMesh * GetSubMeshDS();
SMESH_subMesh *GetFirstToCompute() throw(SALOME_Exception); SMESHDS_SubMesh* CreateSubMeshDS();
// Explicit SMESHDS_SubMesh creation method, required for persistence mechanism
const map < int, SMESH_subMesh * >&DependsOn(); SMESH_subMesh *GetFirstToCompute();
const map < int, SMESH_subMesh * >&Dependants();
const TopoDS_Shape & GetSubShape(); const map < int, SMESH_subMesh * >&DependsOn();
//const map < int, SMESH_subMesh * >&Dependants();
bool _vertexSet; // only for vertex subMesh, set to false for dim > 0 const TopoDS_Shape & GetSubShape();
enum compute_state bool _vertexSet; // only for vertex subMesh, set to false for dim > 0
{ 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) enum compute_state
throw(SALOME_Exception); {
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, SUBMESH_RESTORED
};
void SubMeshesAlgoStateEngine(int event, SMESH_Hypothesis * anHyp) SMESH_Hypothesis::Hypothesis_Status
throw(SALOME_Exception); AlgoStateEngine(int event, SMESH_Hypothesis * anHyp);
void DumpAlgoState(bool isMain); SMESH_Hypothesis::Hypothesis_Status
SubMeshesAlgoStateEngine(int event, SMESH_Hypothesis * anHyp);
bool ComputeStateEngine(int event) throw(SALOME_Exception); int GetAlgoState() { return _algoState; }
int GetComputeState() void DumpAlgoState(bool isMain);
{
return _computeState;
};
protected: bool ComputeStateEngine(int event);
void InsertDependence(const TopoDS_Shape aSubShape);
// void FinalizeDependence(list<TopoDS_Shape>& shapeList);
bool SubMeshesComputed() throw(SALOME_Exception); int GetComputeState()
{
return _computeState;
};
bool SubMeshesReady(); bool IsConform(const SMESH_Algo* theAlgo);
// check if a conform mesh will be produced by the Algo
void RemoveSubMeshElementsAndNodes(); bool CanAddHypothesis(const SMESH_Hypothesis* theHypothesis) const;
void UpdateDependantsState(); // return true if theHypothesis can be attached to me:
void CleanDependants(); // its dimention is checked
void ExtractDependants(const TopTools_IndexedDataMapOfShapeListOfShape & M,
const TopAbs_ShapeEnum etype);
void SetAlgoState(int state);
TopoDS_Shape _subShape; bool IsApplicableHypotesis(const SMESH_Hypothesis* theHypothesis) const;
SMESHDS_Mesh * _meshDS; // return true if theHypothesis can be used to mesh me:
SMESHDS_SubMesh * _subMeshDS; // its shape type is checked
int _Id;
SMESH_Mesh *_father;
map < int, SMESH_subMesh * >_mapDepend;
map < int, SMESH_subMesh * >_mapDependants;
bool _dependenceAnalysed;
bool _dependantsFound;
int _algoState; protected:
int _oldAlgoState; void InsertDependence(const TopoDS_Shape aSubShape);
int _computeState;
bool SubMeshesComputed();
bool SubMeshesReady();
void RemoveSubMeshElementsAndNodes();
void UpdateDependantsState(const compute_event theEvent);
void UpdateSubMeshState(const compute_state theState);
void ComputeSubMeshStateEngine(int event);
void CleanDependants();
void CleanDependsOn();
void SetAlgoState(int state);
bool IsMeshComputed() const;
// check if _subMeshDS contains mesh elements
TopoDS_Shape GetCollection(SMESH_Gen * theGen, SMESH_Algo* theAlgo);
// return a shape containing all sub-shapes of the MainShape that can be
// meshed at once along with _subShape
bool ApplyToCollection (SMESH_Algo* theAlgo,
const TopoDS_Shape& theCollection);
// Apply theAlgo to all subshapes in theCollection
SMESH_Hypothesis::Hypothesis_Status CheckConcurentHypothesis (const int theHypType);
// check if there are several applicable hypothesis on fathers
int GetNbAttached(const TopoDS_Shape& theShape,
const SMESH_Hypothesis * theHyp,
const bool theAlgos = false);
// return nb of hypotheses attached to theShape.
// If theHyp is provided, similar but not same hypotheses
// are countered; else only applicable ones are countered
// depending on theAlgos flag
TopoDS_Shape _subShape;
SMESHDS_Mesh * _meshDS;
SMESHDS_SubMesh * _subMeshDS;
int _Id;
SMESH_Mesh *_father;
map < int, SMESH_subMesh * >_mapDepend;
//map < int, SMESH_subMesh * >_mapDependants;
bool _dependenceAnalysed;
//bool _dependantsFound;
int _algoState;
//int _oldAlgoState;
int _computeState;
}; };

View File

@ -42,7 +42,8 @@ LIB_SRC = \
SMESHDS_Script.cxx \ SMESHDS_Script.cxx \
SMESHDS_Command.cxx \ SMESHDS_Command.cxx \
SMESHDS_SubMesh.cxx \ SMESHDS_SubMesh.cxx \
SMESHDS_Mesh.cxx SMESHDS_Mesh.cxx \
SMESHDS_Group.cxx
LIB_CLIENT_IDL = LIB_CLIENT_IDL =
LIB_SERVER_IDL = LIB_SERVER_IDL =
@ -61,10 +62,11 @@ EXPORT_HEADERS= \
SMESHDS_Script.hxx \ SMESHDS_Script.hxx \
SMESHDS_Command.hxx \ SMESHDS_Command.hxx \
SMESHDS_CommandType.hxx \ SMESHDS_CommandType.hxx \
SMESHDS_SubMesh.hxx SMESHDS_SubMesh.hxx \
SMESHDS_Group.hxx
# additionnal information to compil and link file # additionnal information to compil and link file
CPPFLAGS += $(OCC_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome CPPFLAGS += $(OCC_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome $(BOOST_CPPFLAGS)
CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome
LDFLAGS += $(OCC_KERNEL_LIBS) LDFLAGS += $(OCC_KERNEL_LIBS)

View File

@ -100,11 +100,16 @@ bool SMESHDS_Mesh::RemoveHypothesis(const TopoDS_Shape & S,
//function : AddNode //function : AddNode
//purpose : //purpose :
//======================================================================= //=======================================================================
SMDS_MeshNode* SMESHDS_Mesh::AddNode(double x, double y, double z) SMDS_MeshNode* SMESHDS_Mesh::AddNode(double x, double y, double z){
{ SMDS_MeshNode* node = SMDS_Mesh::AddNode(x, y, z);
SMDS_MeshNode* node = SMDS_Mesh::AddNode(x, y, z); if(node!=NULL) myScript->AddNode(node->GetID(), x, y, z);
if(node!=NULL) myScript->AddNode(node->GetID(), x, y, z); return node;
return node; }
SMDS_MeshNode* SMESHDS_Mesh::AddNodeWithID(double x, double y, double z, int ID){
SMDS_MeshNode* node = SMDS_Mesh::AddNodeWithID(x,y,z,ID);
if(node!=NULL) myScript->AddNode(node->GetID(), x, y, z);
return node;
} }
//======================================================================= //=======================================================================
@ -113,137 +118,345 @@ SMDS_MeshNode* SMESHDS_Mesh::AddNode(double x, double y, double z)
//======================================================================= //=======================================================================
void SMESHDS_Mesh::MoveNode(const SMDS_MeshNode *n, double x, double y, double z) void SMESHDS_Mesh::MoveNode(const SMDS_MeshNode *n, double x, double y, double z)
{ {
SMDS_MeshNode * node=const_cast<SMDS_MeshNode*>(n); SMDS_MeshNode * node=const_cast<SMDS_MeshNode*>(n);
node->setXYZ(x,y,z); node->setXYZ(x,y,z);
myScript->MoveNode(n->GetID(), x, y, z); myScript->MoveNode(n->GetID(), x, y, z);
} }
//======================================================================= //=======================================================================
//function : AddEdge //function : AddEdge
//purpose : //purpose :
//======================================================================= //=======================================================================
SMDS_MeshEdge* SMESHDS_Mesh::AddEdgeWithID(int n1, int n2, int ID)
{
SMDS_MeshEdge* anElem = SMDS_Mesh::AddEdgeWithID(n1,n2,ID);
if(anElem) myScript->AddEdge(ID,n1,n2);
return anElem;
}
SMDS_MeshEdge* SMESHDS_Mesh::AddEdgeWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
int ID)
{
return AddEdgeWithID(n1->GetID(),
n2->GetID(),
ID);
}
SMDS_MeshEdge* SMESHDS_Mesh::AddEdge(const SMDS_MeshNode * n1, SMDS_MeshEdge* SMESHDS_Mesh::AddEdge(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2) const SMDS_MeshNode * n2)
{ {
SMDS_MeshEdge* e = SMDS_Mesh::AddEdge(n1,n2); SMDS_MeshEdge* anElem = SMDS_Mesh::AddEdge(n1,n2);
if(e!=NULL) myScript->AddEdge(e->GetID(), n1->GetID(), n2->GetID()); if(anElem) myScript->AddEdge(anElem->GetID(),
return e; n1->GetID(),
n2->GetID());
return anElem;
} }
//======================================================================= //=======================================================================
//function :AddFace //function :AddFace
//purpose : //purpose :
//======================================================================= //=======================================================================
SMDS_MeshFace* SMESHDS_Mesh::AddFaceWithID(int n1, int n2, int n3, int ID)
{
SMDS_MeshFace *anElem = SMDS_Mesh::AddFaceWithID(n1, n2, n3, ID);
if(anElem) myScript->AddFace(ID,n1,n2,n3);
return anElem;
}
SMDS_MeshFace* SMESHDS_Mesh::AddFaceWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
int ID)
{
return AddFaceWithID(n1->GetID(),
n2->GetID(),
n3->GetID(),
ID);
}
SMDS_MeshFace* SMESHDS_Mesh::AddFace( const SMDS_MeshNode * n1, SMDS_MeshFace* SMESHDS_Mesh::AddFace( const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2, const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3) const SMDS_MeshNode * n3)
{ {
SMDS_MeshFace *f = SMDS_Mesh::AddFace(n1, n2, n3); SMDS_MeshFace *anElem = SMDS_Mesh::AddFace(n1, n2, n3);
if(f!=NULL) myScript->AddFace(f->GetID(), n1->GetID(), n2->GetID(), if(anElem) myScript->AddFace(anElem->GetID(),
n3->GetID()); n1->GetID(),
return f; n2->GetID(),
n3->GetID());
return anElem;
} }
//======================================================================= //=======================================================================
//function :AddFace //function :AddFace
//purpose : //purpose :
//======================================================================= //=======================================================================
SMDS_MeshFace* SMESHDS_Mesh::AddFaceWithID(int n1, int n2, int n3, int n4, int ID)
{
SMDS_MeshFace *anElem = SMDS_Mesh::AddFaceWithID(n1, n2, n3, n4, ID);
if(anElem) myScript->AddFace(ID, n1, n2, n3, n4);
return anElem;
}
SMDS_MeshFace* SMESHDS_Mesh::AddFaceWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
int ID)
{
return AddFaceWithID(n1->GetID(),
n2->GetID(),
n3->GetID(),
n4->GetID(),
ID);
}
SMDS_MeshFace* SMESHDS_Mesh::AddFace(const SMDS_MeshNode * n1, SMDS_MeshFace* SMESHDS_Mesh::AddFace(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2, const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3, const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4) const SMDS_MeshNode * n4)
{ {
SMDS_MeshFace *f = SMDS_Mesh::AddFace(n1, n2, n3, n4); SMDS_MeshFace *anElem = SMDS_Mesh::AddFace(n1, n2, n3, n4);
if(f!=NULL) if(anElem) myScript->AddFace(anElem->GetID(),
myScript->AddFace(f->GetID(), n1->GetID(), n2->GetID(), n3->GetID(), n1->GetID(),
n4->GetID()); n2->GetID(),
return f; n3->GetID(),
n4->GetID());
return anElem;
} }
//======================================================================= //=======================================================================
//function :AddVolume //function :AddVolume
//purpose : //purpose :
//======================================================================= //=======================================================================
SMDS_MeshVolume* SMESHDS_Mesh::AddVolume( SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(int n1, int n2, int n3, int n4, int ID)
const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4)
{ {
SMDS_MeshVolume *f = SMDS_Mesh::AddVolume(n1, n2, n3, n4); SMDS_MeshVolume *anElem = SMDS_Mesh::AddVolumeWithID(n1, n2, n3, n4, ID);
if(f!=NULL) if(anElem) myScript->AddVolume(ID, n1, n2, n3, n4);
myScript->AddVolume(f->GetID(), n1->GetID(), n2->GetID(), n3->GetID(), return anElem;
n4->GetID()); }
return f;
SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
int ID)
{
return AddVolumeWithID(n1->GetID(),
n2->GetID(),
n3->GetID(),
n4->GetID(),
ID);
}
SMDS_MeshVolume* SMESHDS_Mesh::AddVolume(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4)
{
SMDS_MeshVolume *anElem = SMDS_Mesh::AddVolume(n1, n2, n3, n4);
if(anElem) myScript->AddVolume(anElem->GetID(),
n1->GetID(),
n2->GetID(),
n3->GetID(),
n4->GetID());
return anElem;
} }
//======================================================================= //=======================================================================
//function :AddVolume //function :AddVolume
//purpose : //purpose :
//======================================================================= //=======================================================================
SMDS_MeshVolume* SMESHDS_Mesh::AddVolume( SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(int n1, int n2, int n3, int n4, int n5, int ID)
const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5)
{ {
SMDS_MeshVolume *v = SMDS_Mesh::AddVolume(n1, n2, n3, n4, n5); SMDS_MeshVolume *anElem = SMDS_Mesh::AddVolumeWithID(n1, n2, n3, n4, n5, ID);
if(v!=NULL) if(anElem) myScript->AddVolume(ID, n1, n2, n3, n4, n5);
myScript->AddVolume(v->GetID(), n1->GetID(), n2->GetID(), n3->GetID(), return anElem;
n4->GetID(), n5->GetID()); }
return v;
SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
int ID)
{
return AddVolumeWithID(n1->GetID(),
n2->GetID(),
n3->GetID(),
n4->GetID(),
n5->GetID(),
ID);
}
SMDS_MeshVolume* SMESHDS_Mesh::AddVolume(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5)
{
SMDS_MeshVolume *anElem = SMDS_Mesh::AddVolume(n1, n2, n3, n4, n5);
if(anElem) myScript->AddVolume(anElem->GetID(),
n1->GetID(),
n2->GetID(),
n3->GetID(),
n4->GetID(),
n5->GetID());
return anElem;
} }
//======================================================================= //=======================================================================
//function :AddVolume //function :AddVolume
//purpose : //purpose :
//======================================================================= //=======================================================================
SMDS_MeshVolume* SMESHDS_Mesh::AddVolume( SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(int n1, int n2, int n3, int n4, int n5, int n6, int ID)
const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n6)
{ {
SMDS_MeshVolume *v= SMDS_Mesh::AddVolume(n1, n2, n3, n4, n5, n6); SMDS_MeshVolume *anElem= SMDS_Mesh::AddVolumeWithID(n1, n2, n3, n4, n5, n6, ID);
if(v!=NULL) if(anElem) myScript->AddVolume(ID, n1, n2, n3, n4, n5, n6);
myScript->AddVolume(v->GetID(), n1->GetID(), n2->GetID(), n3->GetID(), return anElem;
n4->GetID(), n5->GetID(), n6->GetID()); }
return v;
SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n6,
int ID)
{
return AddVolumeWithID(n1->GetID(),
n2->GetID(),
n3->GetID(),
n4->GetID(),
n5->GetID(),
n6->GetID(),
ID);
}
SMDS_MeshVolume* SMESHDS_Mesh::AddVolume(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n6)
{
SMDS_MeshVolume *anElem = SMDS_Mesh::AddVolume(n1, n2, n3, n4, n5, n6);
if(anElem) myScript->AddVolume(anElem->GetID(),
n1->GetID(),
n2->GetID(),
n3->GetID(),
n4->GetID(),
n5->GetID(),
n6->GetID());
return anElem;
} }
//======================================================================= //=======================================================================
//function :AddVolume //function :AddVolume
//purpose : //purpose :
//======================================================================= //=======================================================================
SMDS_MeshVolume* SMESHDS_Mesh::AddVolume( SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(int n1, int n2, int n3, int n4, int n5, int n6, int n7, int n8, int ID)
const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n6,
const SMDS_MeshNode * n7,
const SMDS_MeshNode * n8)
{ {
SMDS_MeshVolume *v= SMDS_MeshVolume *anElem= SMDS_Mesh::AddVolumeWithID(n1, n2, n3, n4, n5, n6, n7, n8, ID);
SMDS_Mesh::AddVolume(n1, n2, n3, n4, n5, n6, n7, n8); if(anElem) myScript->AddVolume(ID, n1, n2, n3, n4, n5, n6, n7, n8);
if(v!=NULL) return anElem;
myScript->AddVolume(v->GetID(), n1->GetID(), n2->GetID(), n3->GetID(),
n4->GetID(), n5->GetID(), n6->GetID(), n7->GetID(), n8->GetID());
return v;
} }
SMDS_MeshVolume* SMESHDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n6,
const SMDS_MeshNode * n7,
const SMDS_MeshNode * n8,
int ID)
{
return AddVolumeWithID(n1->GetID(),
n2->GetID(),
n3->GetID(),
n4->GetID(),
n5->GetID(),
n6->GetID(),
n7->GetID(),
n8->GetID(),
ID);
}
SMDS_MeshVolume* SMESHDS_Mesh::AddVolume(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n6,
const SMDS_MeshNode * n7,
const SMDS_MeshNode * n8)
{
SMDS_MeshVolume *anElem = SMDS_Mesh::AddVolume(n1, n2, n3, n4, n5, n6, n7, n8);
if(anElem) myScript->AddVolume(anElem->GetID(),
n1->GetID(),
n2->GetID(),
n3->GetID(),
n4->GetID(),
n5->GetID(),
n6->GetID(),
n7->GetID(),
n8->GetID());
return anElem;
}
//=======================================================================
//function : removeFromSubMeshes
//purpose :
//=======================================================================
static void removeFromSubMeshes (map<int,SMESHDS_SubMesh*> & theSubMeshes,
list<const SMDS_MeshElement *> & theElems,
const bool isNode)
{
if ( theElems.empty() )
return;
map<int,SMESHDS_SubMesh*>::iterator SubIt = theSubMeshes.begin();
for ( ; SubIt != theSubMeshes.end(); SubIt++ )
{
list<const SMDS_MeshElement *>::iterator elIt = theElems.begin();
while ( elIt != theElems.end() )
{
bool removed = false;
if ( isNode )
removed = (*SubIt).second->RemoveNode( static_cast<const SMDS_MeshNode*> (*elIt) );
else
removed = (*SubIt).second->RemoveElement( *elIt );
if (removed)
{
elIt = theElems.erase( elIt );
if ( theElems.empty() )
return; // all elements are found and removed
}
else
{
elIt++ ;
}
}
}
}
//======================================================================= //=======================================================================
//function : RemoveNode //function : RemoveNode
//purpose : //purpose :
//======================================================================= //=======================================================================
void SMESHDS_Mesh::RemoveNode(const SMDS_MeshNode * n) void SMESHDS_Mesh::RemoveNode(const SMDS_MeshNode * n)
{ {
SMDS_Mesh::RemoveNode(n); myScript->RemoveNode(n->GetID());
myScript->RemoveNode(n->GetID());
list<const SMDS_MeshElement *> removedElems;
list<const SMDS_MeshElement *> removedNodes;
SMDS_Mesh::RemoveElement( n, removedElems, removedNodes, true );
removeFromSubMeshes( myShapeIndexToSubMesh, removedElems, false );
removeFromSubMeshes( myShapeIndexToSubMesh, removedNodes, true );
} }
//======================================================================= //=======================================================================
@ -252,8 +465,20 @@ void SMESHDS_Mesh::RemoveNode(const SMDS_MeshNode * n)
//======================================================================== //========================================================================
void SMESHDS_Mesh::RemoveElement(const SMDS_MeshElement * elt) void SMESHDS_Mesh::RemoveElement(const SMDS_MeshElement * elt)
{ {
SMDS_Mesh::RemoveElement(elt); if (elt->GetType() == SMDSAbs_Node)
myScript->RemoveElement(elt->GetID()); {
RemoveNode( static_cast<const SMDS_MeshNode*>( elt ));
return;
}
myScript->RemoveElement(elt->GetID());
list<const SMDS_MeshElement *> removedElems;
list<const SMDS_MeshElement *> removedNodes;
SMDS_Mesh::RemoveElement(elt, removedElems, removedNodes, false);
removeFromSubMeshes( myShapeIndexToSubMesh, removedElems, false );
} }
//======================================================================= //=======================================================================
@ -291,7 +516,7 @@ void SMESHDS_Mesh::SetNodeOnFace(SMDS_MeshNode * aNode,
int Index = myIndexToShape.FindIndex(S); int Index = myIndexToShape.FindIndex(S);
//Set Position on Node //Set Position on Node
aNode->SetPosition(new SMDS_FacePosition(Index, 0., 0.)); aNode->SetPosition(SMDS_PositionPtr(new SMDS_FacePosition(Index, 0., 0.)));
//Update or build submesh //Update or build submesh
map<int,SMESHDS_SubMesh*>::iterator it=myShapeIndexToSubMesh.find(Index); map<int,SMESHDS_SubMesh*>::iterator it=myShapeIndexToSubMesh.find(Index);
@ -313,7 +538,7 @@ void SMESHDS_Mesh::SetNodeOnEdge(SMDS_MeshNode * aNode,
int Index = myIndexToShape.FindIndex(S); int Index = myIndexToShape.FindIndex(S);
//Set Position on Node //Set Position on Node
aNode->SetPosition(new SMDS_EdgePosition(Index, 0.)); aNode->SetPosition(SMDS_PositionPtr(new SMDS_EdgePosition(Index, 0.)));
//Update or build submesh //Update or build submesh
map<int,SMESHDS_SubMesh*>::iterator it=myShapeIndexToSubMesh.find(Index); map<int,SMESHDS_SubMesh*>::iterator it=myShapeIndexToSubMesh.find(Index);
@ -335,7 +560,7 @@ void SMESHDS_Mesh::SetNodeOnVertex(SMDS_MeshNode * aNode,
int Index = myIndexToShape.FindIndex(S); int Index = myIndexToShape.FindIndex(S);
//Set Position on Node //Set Position on Node
aNode->SetPosition(new SMDS_VertexPosition(Index)); aNode->SetPosition(SMDS_PositionPtr(new SMDS_VertexPosition(Index)));
//Update or build submesh //Update or build submesh
map<int,SMESHDS_SubMesh*>::iterator it=myShapeIndexToSubMesh.find(Index); map<int,SMESHDS_SubMesh*>::iterator it=myShapeIndexToSubMesh.find(Index);
@ -402,13 +627,40 @@ TopoDS_Shape SMESHDS_Mesh::ShapeToMesh() const
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
SMESHDS_SubMesh * SMESHDS_Mesh::MeshElements(const TopoDS_Shape & S) SMESHDS_SubMesh * SMESHDS_Mesh::MeshElements(const TopoDS_Shape & S)
{ {
if (myShape.IsNull()) MESSAGE("myShape is NULL"); if (myShape.IsNull()) MESSAGE("myShape is NULL");
int Index = myIndexToShape.FindIndex(S); int Index = myIndexToShape.FindIndex(S);
if (myShapeIndexToSubMesh.find(Index)!=myShapeIndexToSubMesh.end()) if (myShapeIndexToSubMesh.find(Index)!=myShapeIndexToSubMesh.end())
return myShapeIndexToSubMesh[Index]; return myShapeIndexToSubMesh[Index];
else else
return NULL; return NULL;
}
///////////////////////////////////////////////////////////////////////////////
/// Return the sub mesh by Id of shape it is linked to
///////////////////////////////////////////////////////////////////////////////
SMESHDS_SubMesh * SMESHDS_Mesh::MeshElements(const int Index)
{
if (myShape.IsNull()) MESSAGE("myShape is NULL");
if (myShapeIndexToSubMesh.find(Index)!=myShapeIndexToSubMesh.end())
return myShapeIndexToSubMesh[Index];
else
return NULL;
}
//=======================================================================
//function : SubMeshIndices
//purpose :
//=======================================================================
list<int> SMESHDS_Mesh::SubMeshIndices()
{
list<int> anIndices;
std::map<int,SMESHDS_SubMesh*>::iterator anIter = myShapeIndexToSubMesh.begin();
for (; anIter != myShapeIndexToSubMesh.end(); anIter++) {
anIndices.push_back((*anIter).first);
}
return anIndices;
} }
//======================================================================= //=======================================================================
@ -520,7 +772,7 @@ void SMESHDS_Mesh::SetNodeInVolume(const SMDS_MeshNode* aNode, int Index)
void SMESHDS_Mesh::SetNodeOnFace(SMDS_MeshNode* aNode, int Index) void SMESHDS_Mesh::SetNodeOnFace(SMDS_MeshNode* aNode, int Index)
{ {
//Set Position on Node //Set Position on Node
aNode->SetPosition(new SMDS_FacePosition(Index, 0., 0.)); aNode->SetPosition(SMDS_PositionPtr(new SMDS_FacePosition(Index, 0., 0.)));
//Update or build submesh //Update or build submesh
if (myShapeIndexToSubMesh.find(Index)==myShapeIndexToSubMesh.end()) if (myShapeIndexToSubMesh.find(Index)==myShapeIndexToSubMesh.end())
@ -536,7 +788,7 @@ void SMESHDS_Mesh::SetNodeOnFace(SMDS_MeshNode* aNode, int Index)
void SMESHDS_Mesh::SetNodeOnEdge(SMDS_MeshNode* aNode, int Index) void SMESHDS_Mesh::SetNodeOnEdge(SMDS_MeshNode* aNode, int Index)
{ {
//Set Position on Node //Set Position on Node
aNode->SetPosition(new SMDS_EdgePosition(Index, 0.)); aNode->SetPosition(SMDS_PositionPtr(new SMDS_EdgePosition(Index, 0.)));
//Update or build submesh //Update or build submesh
if (myShapeIndexToSubMesh.find(Index)==myShapeIndexToSubMesh.end()) if (myShapeIndexToSubMesh.find(Index)==myShapeIndexToSubMesh.end())
@ -552,7 +804,7 @@ void SMESHDS_Mesh::SetNodeOnEdge(SMDS_MeshNode* aNode, int Index)
void SMESHDS_Mesh::SetNodeOnVertex(SMDS_MeshNode* aNode, int Index) void SMESHDS_Mesh::SetNodeOnVertex(SMDS_MeshNode* aNode, int Index)
{ {
//Set Position on Node //Set Position on Node
aNode->SetPosition(new SMDS_VertexPosition(Index)); aNode->SetPosition(SMDS_PositionPtr(new SMDS_VertexPosition(Index)));
//Update or build submesh //Update or build submesh
if (myShapeIndexToSubMesh.find(Index)==myShapeIndexToSubMesh.end()) if (myShapeIndexToSubMesh.find(Index)==myShapeIndexToSubMesh.end())

View File

@ -49,102 +49,158 @@
#include <hash_map.h> #include <hash_map.h>
#else #else
#include <ext/hash_map> #include <ext/hash_map>
using namespace __gnu_cxx; namespace gstd = __gnu_cxx;
#endif #endif
#endif #endif
using namespace std; class SMESHDS_Mesh:public SMDS_Mesh{
public:
SMESHDS_Mesh(int MeshID);
void ShapeToMesh(const TopoDS_Shape & S);
bool AddHypothesis(const TopoDS_Shape & SS, const SMESHDS_Hypothesis * H);
bool RemoveHypothesis(const TopoDS_Shape & S, const SMESHDS_Hypothesis * H);
virtual SMDS_MeshNode* AddNodeWithID(double x, double y, double z, int ID);
virtual SMDS_MeshNode * AddNode(double x, double y, double z);
virtual SMDS_MeshEdge* AddEdgeWithID(int n1, int n2, int ID);
virtual SMDS_MeshEdge* AddEdgeWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
int ID);
virtual SMDS_MeshEdge* AddEdge(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2);
virtual SMDS_MeshFace* AddFaceWithID(int n1, int n2, int n3, int ID);
virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
int ID);
virtual SMDS_MeshFace* AddFace(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3);
class SMESHDS_Mesh:public SMDS_Mesh virtual SMDS_MeshFace* AddFaceWithID(int n1, int n2, int n3, int n4, int ID);
{ virtual SMDS_MeshFace* AddFaceWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
int ID);
virtual SMDS_MeshFace* AddFace(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4);
public: virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4, int ID);
virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
int ID);
virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4);
SMESHDS_Mesh(int MeshID); virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4, int n5, int ID);
void ShapeToMesh(const TopoDS_Shape & S); virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
bool AddHypothesis(const TopoDS_Shape & SS, const SMESHDS_Hypothesis * H); const SMDS_MeshNode * n2,
bool RemoveHypothesis(const TopoDS_Shape & S, const SMESHDS_Hypothesis * H); const SMDS_MeshNode * n3,
SMDS_MeshNode * AddNode(double x, double y, double z); const SMDS_MeshNode * n4,
void RemoveNode(const SMDS_MeshNode *); const SMDS_MeshNode * n5,
void MoveNode(const SMDS_MeshNode *, double x, double y, double z); int ID);
SMDS_MeshEdge* AddEdge( virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n1, const SMDS_MeshNode * n2,
const SMDS_MeshNode * n2); const SMDS_MeshNode * n3,
SMDS_MeshFace* AddFace( const SMDS_MeshNode * n4,
const SMDS_MeshNode * n1, const SMDS_MeshNode * n5);
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3);
SMDS_MeshFace* AddFace(
const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4);
SMDS_MeshVolume* AddVolume(
const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4);
SMDS_MeshVolume* AddVolume(
const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5);
SMDS_MeshVolume* AddVolume(
const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n6);
SMDS_MeshVolume* AddVolume(
const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n6,
const SMDS_MeshNode * n7,
const SMDS_MeshNode * n8);
void RemoveElement(const SMDS_MeshElement *);
void SetNodeInVolume(SMDS_MeshNode * aNode, const TopoDS_Shell & S);
void SetNodeOnFace(SMDS_MeshNode * aNode, const TopoDS_Face & S);
void SetNodeOnEdge(SMDS_MeshNode * aNode, const TopoDS_Edge & S);
void SetNodeOnVertex(SMDS_MeshNode * aNode, const TopoDS_Vertex & S);
void UnSetNodeOnShape(const SMDS_MeshNode * aNode);
void SetMeshElementOnShape(const SMDS_MeshElement * anElt,
const TopoDS_Shape & S);
void UnSetMeshElementOnShape(const SMDS_MeshElement * anElt,
const TopoDS_Shape & S);
TopoDS_Shape ShapeToMesh() const;
bool HasMeshElements(const TopoDS_Shape & S);
SMESHDS_SubMesh * MeshElements(const TopoDS_Shape & S);
bool HasHypothesis(const TopoDS_Shape & S);
const list<const SMESHDS_Hypothesis*>& GetHypothesis(const TopoDS_Shape & S) const;
SMESHDS_Script * GetScript();
void ClearScript();
int ShapeToIndex(const TopoDS_Shape & aShape);
TopoDS_Shape IndexToShape(int ShapeIndex);
void NewSubMesh(int Index);
void SetNodeInVolume(const SMDS_MeshNode * aNode, int Index);
void SetNodeOnFace(SMDS_MeshNode * aNode, int Index);
void SetNodeOnEdge(SMDS_MeshNode * aNode, int Index);
void SetNodeOnVertex(SMDS_MeshNode * aNode, int Index);
void SetMeshElementOnShape(const SMDS_MeshElement * anElt, int Index);
~SMESHDS_Mesh();
private: virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4, int n5, int n6, int ID);
struct HashTopoDS_Shape virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
{ const SMDS_MeshNode * n2,
size_t operator()(const TopoDS_Shape& S) const {return S.HashCode(2147483647);} const SMDS_MeshNode * n3,
}; const SMDS_MeshNode * n4,
typedef hash_map<TopoDS_Shape, list<const SMESHDS_Hypothesis*>,HashTopoDS_Shape > ShapeToHypothesis; const SMDS_MeshNode * n5,
int myMeshID; const SMDS_MeshNode * n6,
TopoDS_Shape myShape; int ID);
TopTools_IndexedMapOfShape myIndexToShape; virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
map<int,SMESHDS_SubMesh*> myShapeIndexToSubMesh; const SMDS_MeshNode * n2,
ShapeToHypothesis myShapeToHypothesis; const SMDS_MeshNode * n3,
SMESHDS_Script * myScript; const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n6);
virtual SMDS_MeshVolume* AddVolumeWithID(int n1, int n2, int n3, int n4, int n5, int n6, int n7, int n8, int ID);
virtual SMDS_MeshVolume* AddVolumeWithID(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n6,
const SMDS_MeshNode * n7,
const SMDS_MeshNode * n8,
int ID);
virtual SMDS_MeshVolume* AddVolume(const SMDS_MeshNode * n1,
const SMDS_MeshNode * n2,
const SMDS_MeshNode * n3,
const SMDS_MeshNode * n4,
const SMDS_MeshNode * n5,
const SMDS_MeshNode * n6,
const SMDS_MeshNode * n7,
const SMDS_MeshNode * n8);
void MoveNode(const SMDS_MeshNode *, double x, double y, double z);
virtual void RemoveNode(const SMDS_MeshNode *);
void RemoveElement(const SMDS_MeshElement *);
void SetNodeInVolume(SMDS_MeshNode * aNode, const TopoDS_Shell & S);
void SetNodeOnFace(SMDS_MeshNode * aNode, const TopoDS_Face & S);
void SetNodeOnEdge(SMDS_MeshNode * aNode, const TopoDS_Edge & S);
void SetNodeOnVertex(SMDS_MeshNode * aNode, const TopoDS_Vertex & S);
void UnSetNodeOnShape(const SMDS_MeshNode * aNode);
void SetMeshElementOnShape(const SMDS_MeshElement * anElt,
const TopoDS_Shape & S);
void UnSetMeshElementOnShape(const SMDS_MeshElement * anElt,
const TopoDS_Shape & S);
TopoDS_Shape ShapeToMesh() const;
bool HasMeshElements(const TopoDS_Shape & S);
SMESHDS_SubMesh * MeshElements(const TopoDS_Shape & S);
SMESHDS_SubMesh * MeshElements(const int Index);
list<int> SubMeshIndices();
const std::map<int,SMESHDS_SubMesh*>& SubMeshes()
{ return myShapeIndexToSubMesh; }
bool HasHypothesis(const TopoDS_Shape & S);
const list<const SMESHDS_Hypothesis*>& GetHypothesis(const TopoDS_Shape & S) const;
SMESHDS_Script * GetScript();
void ClearScript();
int ShapeToIndex(const TopoDS_Shape & aShape);
TopoDS_Shape IndexToShape(int ShapeIndex);
void NewSubMesh(int Index);
void SetNodeInVolume(const SMDS_MeshNode * aNode, int Index);
void SetNodeOnFace(SMDS_MeshNode * aNode, int Index);
void SetNodeOnEdge(SMDS_MeshNode * aNode, int Index);
void SetNodeOnVertex(SMDS_MeshNode * aNode, int Index);
void SetMeshElementOnShape(const SMDS_MeshElement * anElt, int Index);
~SMESHDS_Mesh();
private:
struct HashTopoDS_Shape{
size_t operator()(const TopoDS_Shape& S) const {
return S.HashCode(2147483647);
}
};
typedef std::list<const SMESHDS_Hypothesis*> THypList;
typedef gstd::hash_map<TopoDS_Shape,THypList,HashTopoDS_Shape> ShapeToHypothesis;
ShapeToHypothesis myShapeToHypothesis;
int myMeshID;
TopoDS_Shape myShape;
TopTools_IndexedMapOfShape myIndexToShape;
std::map<int,SMESHDS_SubMesh*> myShapeIndexToSubMesh;
SMESHDS_Script* myScript;
}; };
#endif #endif

View File

@ -42,9 +42,12 @@ void SMESHDS_SubMesh::AddElement(const SMDS_MeshElement * ME)
//function : RemoveElement //function : RemoveElement
//purpose : //purpose :
//======================================================================= //=======================================================================
void SMESHDS_SubMesh::RemoveElement(const SMDS_MeshElement * ME) bool SMESHDS_SubMesh::RemoveElement(const SMDS_MeshElement * ME)
{ {
myElements.erase(ME); if ( NbElements() )
return myElements.erase(ME);
return false;
} }
//======================================================================= //=======================================================================
@ -60,9 +63,12 @@ void SMESHDS_SubMesh::AddNode(const SMDS_MeshNode * N)
//function : RemoveNode //function : RemoveNode
//purpose : //purpose :
//======================================================================= //=======================================================================
void SMESHDS_SubMesh::RemoveNode(const SMDS_MeshNode * N) bool SMESHDS_SubMesh::RemoveNode(const SMDS_MeshNode * N)
{ {
myNodes.erase(N); if ( NbNodes() )
return myNodes.erase(N);
return false;
} }
//======================================================================= //=======================================================================
@ -85,8 +91,9 @@ int SMESHDS_SubMesh::NbNodes() const
template<typename T> class MySetIterator:public SMDS_Iterator<const T*> template<typename T> class MySetIterator:public SMDS_Iterator<const T*>
{ {
const set<const T*>& mySet; typedef const set<const T*> TSet;
set<const T*>::const_iterator myIt; typename TSet::const_iterator myIt;
TSet& mySet;
public: public:
MySetIterator(const set<const T*>& s):mySet(s), myIt(s.begin()) MySetIterator(const set<const T*>& s):mySet(s), myIt(s.begin())
@ -108,17 +115,17 @@ template<typename T> class MySetIterator:public SMDS_Iterator<const T*>
///Return an iterator on the elements of submesh ///Return an iterator on the elements of submesh
///The created iterator must be free by the caller ///The created iterator must be free by the caller
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
SMDS_Iterator<const SMDS_MeshElement*> * SMESHDS_SubMesh::GetElements() const SMDS_ElemIteratorPtr SMESHDS_SubMesh::GetElements() const
{ {
return new MySetIterator<SMDS_MeshElement>(myElements); return SMDS_ElemIteratorPtr(new MySetIterator<SMDS_MeshElement>(myElements));
} }
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
///Return an iterator on the nodes of submesh ///Return an iterator on the nodes of submesh
///The created iterator must be free by the caller ///The created iterator must be free by the caller
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
SMDS_Iterator<const SMDS_MeshNode*> * SMESHDS_SubMesh::GetNodes() const SMDS_NodeIteratorPtr SMESHDS_SubMesh::GetNodes() const
{ {
return new MySetIterator<SMDS_MeshNode>(myNodes); return SMDS_NodeIteratorPtr(new MySetIterator<SMDS_MeshNode>(myNodes));
} }

View File

@ -36,13 +36,13 @@ class SMESHDS_SubMesh
{ {
public: public:
void AddElement(const SMDS_MeshElement * ME); void AddElement(const SMDS_MeshElement * ME);
void RemoveElement(const SMDS_MeshElement * ME); bool RemoveElement(const SMDS_MeshElement * ME); // ret true if ME was in
void AddNode(const SMDS_MeshNode * ME); void AddNode(const SMDS_MeshNode * ME);
void RemoveNode(const SMDS_MeshNode * ME); bool RemoveNode(const SMDS_MeshNode * ME); // ret true if ME was in
int NbElements() const; int NbElements() const;
SMDS_Iterator<const SMDS_MeshElement*> * GetElements() const; SMDS_ElemIteratorPtr GetElements() const;
int NbNodes() const; int NbNodes() const;
SMDS_Iterator<const SMDS_MeshNode*> * GetNodes() const; SMDS_NodeIteratorPtr GetNodes() const;
private: private:
const SMDS_Mesh * myMesh; const SMDS_Mesh * myMesh;

View File

@ -17,5 +17,6 @@ enum MeshObjectType {
SUBMESH_EDGE, SUBMESH_EDGE,
SUBMESH_FACE, SUBMESH_FACE,
SUBMESH_SOLID, SUBMESH_SOLID,
SUBMESH_COMPOUND SUBMESH_COMPOUND,
GROUP
}; };

View File

@ -29,111 +29,92 @@ Standard_Boolean SMESH_TypeFilter::IsOk(const Handle(SALOME_InteractiveObject)&
if ( !meshFilter->IsOk(anObj) ) if ( !meshFilter->IsOk(anObj) )
return false; return false;
bool Ok = false;
if ( anObj->hasEntry() ) { if ( anObj->hasEntry() ) {
QAD_Study* ActiveStudy = QAD_Application::getDesktop()->getActiveStudy(); QAD_Study* ActiveStudy = QAD_Application::getDesktop()->getActiveStudy();
SALOMEDS::Study_var aStudy = ActiveStudy->getStudyDocument(); SALOMEDS::Study_var aStudy = ActiveStudy->getStudyDocument();
SALOMEDS::SObject_var obj = aStudy->FindObjectID( anObj->getEntry() ); SALOMEDS::SObject_var obj = aStudy->FindObjectID( anObj->getEntry() );
bool Ok = false; SALOMEDS::SObject_var objFather = obj->GetFather();
SALOMEDS::SComponent_var objComponent = obj->GetFatherComponent();
if ( strlen( obj->GetID() ) <= strlen( objComponent->GetID() ) )
return false;
switch ( myKind ) switch ( myKind )
{ {
case HYPOTHESIS: case HYPOTHESIS:
{ {
SALOMEDS::SObject_var objFather = obj->GetFather();
SALOMEDS::SComponent_var objComponent = obj->GetFatherComponent();
if (( objFather->Tag() == 1 ) && (strcmp( objFather->GetID(), objComponent->GetID() ) != 0 ) ) if (( objFather->Tag() == 1 ) && (strcmp( objFather->GetID(), objComponent->GetID() ) != 0 ) )
Ok = true; Ok = true;
break; break;
} }
case ALGORITHM: case ALGORITHM:
{ {
SALOMEDS::SObject_var objFather = obj->GetFather();
SALOMEDS::SComponent_var objComponent = obj->GetFatherComponent();
if (( objFather->Tag() == 2 ) && (strcmp( objFather->GetID(), objComponent->GetID() ) != 0 ) ) if (( objFather->Tag() == 2 ) && (strcmp( objFather->GetID(), objComponent->GetID() ) != 0 ) )
Ok = true; Ok = true;
break; break;
} }
case MESH: case MESH:
{ {
SALOMEDS::SObject_var objFather = obj->GetFather();
SALOMEDS::SComponent_var objComponent = obj->GetFatherComponent();
if (( obj->Tag() >= 3 ) && (strcmp( objFather->GetID(), objComponent->GetID() ) == 0 ) ) if (( obj->Tag() >= 3 ) && (strcmp( objFather->GetID(), objComponent->GetID() ) == 0 ) )
Ok = true; Ok = true;
break; break;
} }
case SUBMESH: case SUBMESH:
{ {
SALOMEDS::SObject_var objFather = obj->GetFather(); if (( objFather->Tag() >= 4 && objFather->Tag() < 9 ) && (strcmp( objFather->GetID(), objComponent->GetID() ) != 0 ) )
SALOMEDS::SComponent_var objComponent = obj->GetFatherComponent();
if (( objFather->Tag() >= 4 ) && (strcmp( objFather->GetID(), objComponent->GetID() ) != 0 ) )
Ok = true; Ok = true;
break; break;
} }
case MESHorSUBMESH: case MESHorSUBMESH:
{ {
SALOMEDS::SObject_var objFather = obj->GetFather();
SALOMEDS::SComponent_var objComponent = obj->GetFatherComponent();
if (( obj->Tag() >= 3 ) && (strcmp( objFather->GetID(), objComponent->GetID() ) == 0 ) ) if (( obj->Tag() >= 3 ) && (strcmp( objFather->GetID(), objComponent->GetID() ) == 0 ) )
Ok = true; Ok = true;
if (( objFather->Tag() >= 4 ) && (strcmp( objFather->GetID(), objComponent->GetID() ) != 0 ) ) if (( objFather->Tag() >= 4 && objFather->Tag() < 9 ) && (strcmp( objFather->GetID(), objComponent->GetID() ) != 0 ) )
Ok = true; Ok = true;
break; break;
} }
case SUBMESH_VERTEX: case SUBMESH_VERTEX: // Label "SubMeshes on vertexes"
{ {
SALOMEDS::SObject_var objFather = obj->GetFather();
SALOMEDS::SComponent_var objComponent = obj->GetFatherComponent();
if (( obj->Tag() == 4 ) && (strcmp( objFather->GetID(), objComponent->GetID() ) != 0 ) && ( objFather->Tag() >= 3 )) if (( obj->Tag() == 4 ) && (strcmp( objFather->GetID(), objComponent->GetID() ) != 0 ) && ( objFather->Tag() >= 3 ))
Ok = true; Ok = true;
break; break;
} }
case SUBMESH_EDGE: case SUBMESH_EDGE:
{ {
SALOMEDS::SObject_var objFather = obj->GetFather();
SALOMEDS::SComponent_var objComponent = obj->GetFatherComponent();
if (( obj->Tag() == 5 ) && (strcmp( objFather->GetID(), objComponent->GetID() ) != 0 ) && ( objFather->Tag() >= 3 )) if (( obj->Tag() == 5 ) && (strcmp( objFather->GetID(), objComponent->GetID() ) != 0 ) && ( objFather->Tag() >= 3 ))
Ok = true; Ok = true;
break; break;
} }
case SUBMESH_FACE: case SUBMESH_FACE:
{ {
SALOMEDS::SObject_var objFather = obj->GetFather();
SALOMEDS::SComponent_var objComponent = obj->GetFatherComponent();
if (( obj->Tag() == 6 ) && (strcmp( objFather->GetID(), objComponent->GetID() ) != 0 ) && ( objFather->Tag() >= 3 )) if (( obj->Tag() == 6 ) && (strcmp( objFather->GetID(), objComponent->GetID() ) != 0 ) && ( objFather->Tag() >= 3 ))
Ok = true; Ok = true;
break; break;
} }
case SUBMESH_SOLID: case SUBMESH_SOLID:
{ {
SALOMEDS::SObject_var objFather = obj->GetFather();
SALOMEDS::SComponent_var objComponent = obj->GetFatherComponent();
if (( obj->Tag() == 7 ) && (strcmp( objFather->GetID(), objComponent->GetID() ) != 0 ) && ( objFather->Tag() >= 3 )) if (( obj->Tag() == 7 ) && (strcmp( objFather->GetID(), objComponent->GetID() ) != 0 ) && ( objFather->Tag() >= 3 ))
Ok = true; Ok = true;
break; break;
} }
case SUBMESH_COMPOUND: case SUBMESH_COMPOUND:
{ {
SALOMEDS::SObject_var objFather = obj->GetFather();
SALOMEDS::SComponent_var objComponent = obj->GetFatherComponent();
if (( obj->Tag() == 8 ) && (strcmp( objFather->GetID(), objComponent->GetID() ) != 0 ) && ( objFather->Tag() >= 3 )) if (( obj->Tag() == 8 ) && (strcmp( objFather->GetID(), objComponent->GetID() ) != 0 ) && ( objFather->Tag() >= 3 ))
Ok = true; Ok = true;
break; break;
} }
case GROUP:
{
if (( objFather->Tag() >= 9 ) && (strcmp( objFather->GetID(), objComponent->GetID() ) != 0 ) )
Ok = true;
break;
}
} }
if ( Ok )
return true;
} }
return false; return Ok;
} }

View File

@ -29,14 +29,18 @@
top_srcdir=@top_srcdir@ top_srcdir=@top_srcdir@
top_builddir=../.. top_builddir=../..
srcdir=@srcdir@ srcdir=@srcdir@
VPATH=.:@srcdir@:@top_srcdir@/idl:$(top_builddir)/idl:${KERNEL_ROOT_DIR}/idl/salome:${MED_ROOT_DIR}/idl/salome VPATH=.:@srcdir@:@top_srcdir@/idl:$(top_builddir)/idl
@COMMENCE@ @COMMENCE@
# header files # header files
EXPORT_HEADERS= SMESHGUI_Swig.hxx \ EXPORT_HEADERS= SMESHGUI_Swig.hxx \
SMESHGUI_Swig.i SMESHGUI_Swig.i \
SMESHGUI.h \
SMESHGUI_Hypotheses.h \
SMESHGUI_SpinBox.h \
SMESHGUI_StudyAPI.h
# .po files to transform in .qm # .po files to transform in .qm
PO_FILES = \ PO_FILES = \
@ -53,28 +57,28 @@ LIB_SRC = SMESHGUI.cxx \
SMESHGUI_AddAlgorithmDlg.cxx \ SMESHGUI_AddAlgorithmDlg.cxx \
SMESHGUI_InitMeshDlg.cxx \ SMESHGUI_InitMeshDlg.cxx \
SMESHGUI_AddSubMeshDlg.cxx \ SMESHGUI_AddSubMeshDlg.cxx \
SMESHGUI_LocalLengthDlg.cxx \
SMESHGUI_NbSegmentsDlg.cxx \
SMESHGUI_TransparencyDlg.cxx \ SMESHGUI_TransparencyDlg.cxx \
SMESHGUI_GroupDlg.cxx \
SMESHGUI_RemoveNodesDlg.cxx \ SMESHGUI_RemoveNodesDlg.cxx \
SMESHGUI_RemoveElementsDlg.cxx \ SMESHGUI_RemoveElementsDlg.cxx \
SMESHGUI_MeshInfosDlg.cxx \ SMESHGUI_MeshInfosDlg.cxx \
SMESHGUI_Preferences_ColorDlg.cxx \ SMESHGUI_Preferences_ColorDlg.cxx \
SMESHGUI_MaxElementAreaDlg.cxx \
SMESHGUI_Preferences_ScalarBarDlg.cxx \ SMESHGUI_Preferences_ScalarBarDlg.cxx \
SMESHGUI_EditScalarBarDlg.cxx \ SMESHGUI_Preferences_SelectionDlg.cxx \
SMESHGUI_aParameterDlg.cxx \ SMESHGUI_aParameterDlg.cxx \
SMESHGUI_MaxElementVolumeDlg.cxx \
SMESHGUI_Swig.cxx \ SMESHGUI_Swig.cxx \
SMESHGUI_ComputeScalarValue.cxx \ SMESHGUI_ComputeScalarValue.cxx \
SMESHGUI_MoveNodesDlg.cxx \ SMESHGUI_MoveNodesDlg.cxx \
SMESHGUI_OrientationElementsDlg.cxx \ SMESHGUI_OrientationElementsDlg.cxx \
SMESHGUI_DiagonalInversionDlg.cxx \ SMESHGUI_DiagonalInversionDlg.cxx \
SMESHGUI_EdgesConnectivityDlg.cxx \
SMESHGUI_AddFaceDlg.cxx \ SMESHGUI_AddFaceDlg.cxx \
SMESHGUI_AddVolumeDlg.cxx \ SMESHGUI_AddVolumeDlg.cxx \
SMESHGUI_AddEdgeDlg.cxx \ SMESHGUI_AddEdgeDlg.cxx \
SMESHGUI_EditHypothesesDlg.cxx SMESHGUI_EditHypothesesDlg.cxx \
SMESHGUI_CreateHypothesesDlg.cxx \
SMESHGUI_XmlHandler.cxx \
SMESHGUI_Filter.cxx \
SMESHGUI_FilterDlg.cxx
LIB_MOC = \ LIB_MOC = \
SMESHGUI.h \ SMESHGUI.h \
@ -84,26 +88,24 @@ LIB_MOC = \
SMESHGUI_AddAlgorithmDlg.h \ SMESHGUI_AddAlgorithmDlg.h \
SMESHGUI_InitMeshDlg.h \ SMESHGUI_InitMeshDlg.h \
SMESHGUI_AddSubMeshDlg.h \ SMESHGUI_AddSubMeshDlg.h \
SMESHGUI_LocalLengthDlg.h \
SMESHGUI_NbSegmentsDlg.h \
SMESHGUI_TransparencyDlg.h \ SMESHGUI_TransparencyDlg.h \
SMESHGUI_GroupDlg.h \
SMESHGUI_RemoveNodesDlg.h \ SMESHGUI_RemoveNodesDlg.h \
SMESHGUI_RemoveElementsDlg.h \ SMESHGUI_RemoveElementsDlg.h \
SMESHGUI_MeshInfosDlg.h \ SMESHGUI_MeshInfosDlg.h \
SMESHGUI_Preferences_ColorDlg.h \ SMESHGUI_Preferences_ColorDlg.h \
SMESHGUI_MaxElementAreaDlg.h \
SMESHGUI_Preferences_ScalarBarDlg.h \ SMESHGUI_Preferences_ScalarBarDlg.h \
SMESHGUI_EditScalarBarDlg.h \ SMESHGUI_Preferences_SelectionDlg.h \
SMESHGUI_aParameterDlg.h \ SMESHGUI_aParameterDlg.h \
SMESHGUI_MaxElementVolumeDlg.h \
SMESHGUI_MoveNodesDlg.h \ SMESHGUI_MoveNodesDlg.h \
SMESHGUI_OrientationElementsDlg.h \ SMESHGUI_OrientationElementsDlg.h \
SMESHGUI_DiagonalInversionDlg.h \ SMESHGUI_DiagonalInversionDlg.h \
SMESHGUI_EdgesConnectivityDlg.h \
SMESHGUI_AddEdgeDlg.h \ SMESHGUI_AddEdgeDlg.h \
SMESHGUI_AddVolumeDlg.h \ SMESHGUI_AddVolumeDlg.h \
SMESHGUI_AddFaceDlg.h \ SMESHGUI_AddFaceDlg.h \
SMESHGUI_EditHypothesesDlg.h SMESHGUI_EditHypothesesDlg.h \
SMESHGUI_CreateHypothesesDlg.h \
SMESHGUI_FilterDlg.h
LIB_CLIENT_IDL = SALOME_Exception.idl \ LIB_CLIENT_IDL = SALOME_Exception.idl \
GEOM_Gen.idl \ GEOM_Gen.idl \
@ -111,21 +113,25 @@ LIB_CLIENT_IDL = SALOME_Exception.idl \
SMESH_Gen.idl \ SMESH_Gen.idl \
SMESH_Mesh.idl \ SMESH_Mesh.idl \
SMESH_Hypothesis.idl \ SMESH_Hypothesis.idl \
SMESH_BasicHypothesis.idl \ SMESH_Group.idl \
SALOMEDS.idl \ SALOMEDS.idl \
SALOMEDS_Attributes.idl \ SALOMEDS_Attributes.idl \
SALOME_ModuleCatalog.idl \ SALOME_ModuleCatalog.idl \
SALOME_Component.idl \ SALOME_Component.idl \
MED.idl MED.idl \
SMESH_Filter.idl \
SALOME_GenericObj.idl
LIB_SERVER_IDL = LIB_SERVER_IDL =
# additionnal information to compil and link file # additionnal information to compil and link file
CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) $(MED2_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome -I${GEOM_ROOT_DIR}/include/salome CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) \
$(MED2_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome -I${GEOM_ROOT_DIR}/include/salome \
$(BOOST_CPPFLAGS)
CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome -I${GEOM_ROOT_DIR}/include/salome CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome -I${GEOM_ROOT_DIR}/include/salome
#$(OCC_CXXFLAGS) #$(OCC_CXXFLAGS)
LDFLAGS += -lOCCViewer -lVTKViewer -lSalomeObject -lSalomeGUI -lSMESHObject -lSMDS -lSMESHDS -lSMESHFiltersSelection -lGEOMClient -lMeshDriverDAT -lMeshDriverMED -lMeshDriverUNV $(OCC_KERNEL_LIBS) -L${KERNEL_ROOT_DIR}/lib/salome -L${GEOM_ROOT_DIR}/lib/salome LDFLAGS += -lOCCViewer -lVTKViewer -lSalomeObject -lSalomeGUI -lSMESHObject -lSMDS -lSMESHDS -lSMESHFiltersSelection -lGEOMClient -lMeshDriverDAT -lMeshDriverMED -lMeshDriverUNV $(OCC_KERNEL_LIBS) -L${KERNEL_ROOT_DIR}/lib/salome -L${GEOM_ROOT_DIR}/lib/salome -lSalomeGenericObj
@CONCLUDE@ @CONCLUDE@

File diff suppressed because it is too large Load Diff

View File

@ -30,6 +30,7 @@
#define SMESHGUI_HeaderFile #define SMESHGUI_HeaderFile
#include "TColStd_MapOfInteger.hxx" #include "TColStd_MapOfInteger.hxx"
#include <map>
#include "SMESHDS_Document.hxx" #include "SMESHDS_Document.hxx"
@ -38,24 +39,30 @@
#include "SALOME_Selection.h" #include "SALOME_Selection.h"
#include "SALOME_InteractiveObject.hxx" #include "SALOME_InteractiveObject.hxx"
#include "SMESH_Actor.h"
#include "SMESHGUI_StudyAPI.h" #include "SMESHGUI_StudyAPI.h"
#include "SMESHGUI_Hypotheses.h"
// IDL Headers // IDL Headers
#include <SALOMEconfig.h> #include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SMESH_Gen) #include CORBA_SERVER_HEADER(SMESH_Gen)
#include CORBA_SERVER_HEADER(SMESH_Mesh) #include CORBA_SERVER_HEADER(SMESH_Mesh)
#include CORBA_SERVER_HEADER(SMESH_Group)
#include CORBA_SERVER_HEADER(SMESH_Hypothesis) #include CORBA_SERVER_HEADER(SMESH_Hypothesis)
#include CORBA_SERVER_HEADER(SMESH_BasicHypothesis)
#include CORBA_SERVER_HEADER(GEOM_Gen) #include CORBA_SERVER_HEADER(GEOM_Gen)
#include CORBA_SERVER_HEADER(SALOMEDS_Attributes) #include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
#include CORBA_SERVER_HEADER(SMESH_Filter)
// QT Includes // QT Includes
#include <qstringlist.h> #include <qstringlist.h>
// VTK Inlcudes // VTK Inlcludes
#include <vtkScalarBarActor.h>
class vtkActorCollection;
class vtkActor2DCollection;
class vtkScalarBarActor;
class vtkActor;
class SMESH_Actor;
//================================================================================= //=================================================================================
// class : SMESHGUI // class : SMESHGUI
@ -92,6 +99,13 @@ private :
bool myAutomaticUpdate; bool myAutomaticUpdate;
SMESH::FilterManager_var myFilterMgr;
// Hypotheses/algorithms from plugin libraries
map<string, HypothesisData*> myHypothesesMap;
map<string, HypothesisData*> myAlgorithmsMap;
map<string, SMESHGUI_GenericHypothesisCreator*> myHypCreatorMap;
public : public :
SMESHGUI(); SMESHGUI();
@ -105,8 +119,6 @@ public :
SALOMEDS::Study_ptr GetStudy(); SALOMEDS::Study_ptr GetStudy();
SMESHGUI_StudyAPI GetStudyAPI(); SMESHGUI_StudyAPI GetStudyAPI();
vtkScalarBarActor* GetScalarBar();
QDialog* GetActiveDialogBox() ; QDialog* GetActiveDialogBox() ;
void SetActiveDialogBox(QDialog* aDlg) ; void SetActiveDialogBox(QDialog* aDlg) ;
@ -140,79 +152,57 @@ public :
/* Mesh Management */ /* Mesh Management */
SMESH::SMESH_Mesh_ptr InitMesh( GEOM::GEOM_Shape_ptr aShape, QString NameMesh ); SMESH::SMESH_Mesh_ptr InitMesh( GEOM::GEOM_Shape_ptr aShape, QString NameMesh );
SMESH::SMESH_subMesh_ptr AddSubMesh( SMESH::SMESH_Mesh_ptr aMesh, GEOM::GEOM_Shape_ptr aShape, QString NameMesh ); SMESH::SMESH_subMesh_ptr AddSubMesh( SMESH::SMESH_Mesh_ptr aMesh, GEOM::GEOM_Shape_ptr aShape, QString NameMesh );
SMESH::SMESH_Group_ptr AddGroup( SMESH::SMESH_Mesh_ptr aMesh, SMESH::ElementType aType, QString aName );
/* Hypothesis Management */ /* Hypotheses and Algorithms Management */
SMESH::SMESH_Hypothesis_ptr CreateHypothesis( QString TypeHypothesis, QString NameHypothesis ); void InitAvailableHypotheses ();
void AddHypothesisOnMesh( SMESH::SMESH_Mesh_ptr aMesh, SMESH::SMESH_Hypothesis_ptr aHyp ) ; QStringList GetAvailableHypotheses (const bool isAlgo);
void AddHypothesisOnSubMesh( SMESH::SMESH_subMesh_ptr aSubMesh, SMESH::SMESH_Hypothesis_ptr aHyp ) ; HypothesisData* GetHypothesisData (const char* aHypType);
SMESHGUI_GenericHypothesisCreator* GetHypothesisCreator (const QString& aHypType);
void RemoveHypothesisOrAlgorithmOnMesh( const Handle(SALOME_InteractiveObject)& IObject ) ; SMESH::SMESH_Hypothesis_ptr CreateHypothesis (const QString& aHypType,
void RemoveHypothesisOrAlgorithmOnMesh( SALOMEDS::SObject_ptr MorSM, SMESH::SMESH_Hypothesis_ptr anHyp ) ; const QString& aHypName,
const bool isAlgo = false);
void CreateLocalLength( QString TypeHypothesis, QString NameHypothesis, double Length ); bool AddHypothesisOnMesh (SMESH::SMESH_Mesh_ptr aMesh, SMESH::SMESH_Hypothesis_ptr aHyp);
void CreateNbSegments( QString TypeHypothesis, QString NameHypothesis, int nbSegments ); bool AddAlgorithmOnMesh (SMESH::SMESH_Mesh_ptr aMesh, SMESH::SMESH_Hypothesis_ptr aHyp);
void CreateMaxElementArea( QString TypeHypothesis, QString NameHypothesis, double MaxArea );
void CreateMaxElementVolume( QString TypeHypothesis, QString NameHypothesis, double MaxVolume );
/* Algorithms Management */ bool AddHypothesisOnSubMesh (SMESH::SMESH_subMesh_ptr aSubMesh, SMESH::SMESH_Hypothesis_ptr aHyp);
void AddAlgorithmOnMesh( SMESH::SMESH_Mesh_ptr aMesh, SMESH::SMESH_Hypothesis_ptr aHyp ); bool AddAlgorithmOnSubMesh (SMESH::SMESH_subMesh_ptr aSubMesh, SMESH::SMESH_Hypothesis_ptr aHyp);
void AddAlgorithmOnSubMesh( SMESH::SMESH_subMesh_ptr aSubMesh, SMESH::SMESH_Hypothesis_ptr aHyp );
void CreateAlgorithm( QString TypeAlgo, QString NameAlgo ); bool RemoveHypothesisOrAlgorithmOnMesh (const Handle(SALOME_InteractiveObject)& IObject);
bool RemoveHypothesisOrAlgorithmOnMesh (SALOMEDS::SObject_ptr MorSM,
SMESH::SMESH_Hypothesis_ptr anHyp);
void SetPickable(SMESH_Actor* theActor = NULL);
/* NODES */ /* NODES */
void ViewNodes(); void ViewNodes();
vtkActor* SimulationMoveNode(SMESH_Actor* Mactor, int idnode); vtkActor* SimulationMoveNode(SMESH_Actor* Mactor, int idnode);
void MoveNode( SMESH::SMESH_Mesh_ptr aMesh, int idnode, float x, float y, float z); void MoveNode( SMESH::SMESH_Mesh_ptr aMesh, int idnode, float x, float y, float z);
void AddNode(SMESH_Actor*, int idnode, float x, float y, float z) ;
void AddNodes( SMESH_Actor* Mactor, int number,
const SMESH::double_array& coords, const SMESH::long_array& indexes);
void DisplaySimulationNode( SMESH::SMESH_Mesh_ptr aMesh, float x, float y, float z); void DisplaySimulationNode( SMESH::SMESH_Mesh_ptr aMesh, float x, float y, float z);
void DisplaySimulationMoveNode( vtkActor* ac, int idnode, float x, float y, float z); void DisplaySimulationMoveNode( vtkActor* ac, int idnode, float x, float y, float z);
void RemoveNode(SMESH_Actor*, int idnode) ;
void RemoveNodes(SMESH::SMESH_Mesh_ptr aMesh, const TColStd_MapOfInteger& MapIndex) ; void RemoveNodes(SMESH::SMESH_Mesh_ptr aMesh, const TColStd_MapOfInteger& MapIndex) ;
void RemoveNodes(SMESH_Actor* Mactor, int number,
const SMESH::double_array& coords, const SMESH::long_array& indexes);
/* EDGES */ /* EDGES */
void AddEdge(SMESH_Actor*, int idedge, int idnode1, int idnode2) ;
void AddEdges( SMESH_Actor* Mactor, int number,
const SMESH::double_array& coords, const SMESH::long_array& indexes);
void DisplayEdges(SMESH_Actor* ac, bool visibility = true); void DisplayEdges(SMESH_Actor* ac, bool visibility = true);
void DisplayEdgesConnectivityLegendBox(vtkActor *ac); void DisplayEdgesConnectivityLegendBox(vtkActor *ac);
void DisplaySimulationEdge( SMESH::SMESH_Mesh_ptr aMesh, const TColStd_MapOfInteger& MapIndex ); void DisplaySimulationEdge( SMESH::SMESH_Mesh_ptr aMesh, const TColStd_MapOfInteger& MapIndex );
/* TRIANGLES */ /* TRIANGLES */
void AddTriangle(SMESH_Actor*, int idtri, int idnode1, int idnode2, int idnode3) ;
void AddTriangles( SMESH_Actor* Mactor, int number,
const SMESH::double_array& coords, const SMESH::long_array& indexes);
void DisplaySimulationTriangle( SMESH::SMESH_Mesh_ptr aMesh, const TColStd_MapOfInteger& MapIndex, bool reverse ); void DisplaySimulationTriangle( SMESH::SMESH_Mesh_ptr aMesh, const TColStd_MapOfInteger& MapIndex, bool reverse );
/* QUADRANGLES */ /* QUADRANGLES */
void AddQuadrangle(SMESH_Actor*, int idquad, int idnode1, int idnode2,
int idnode3, int idnode4) ;
void AddQuadrangles( SMESH_Actor* Mactor, int number,
const SMESH::double_array& coords, const SMESH::long_array& indexes);
void DisplaySimulationQuadrangle( SMESH::SMESH_Mesh_ptr aMesh, const TColStd_MapOfInteger& MapIndex, bool reverse ); void DisplaySimulationQuadrangle( SMESH::SMESH_Mesh_ptr aMesh, const TColStd_MapOfInteger& MapIndex, bool reverse );
/* VOLUMES */ /* VOLUMES */
void AddTetra(SMESH_Actor*, int idtetra, int idnode1, int idnode2,
int idnode3, int idnode4) ;
void AddHexaedre(SMESH_Actor*, int idhexa, int idnode1, int idnode2,
int idnode3, int idnode4, int idnode5, int idnode6, int idnode7, int idnode8) ;
void AddTetras( SMESH_Actor* Mactor, int number,
const SMESH::double_array& coords, const SMESH::long_array& indexes);
void AddHexaedres( SMESH_Actor* Mactor, int number,
const SMESH::double_array& coords, const SMESH::long_array& indexes);
void DisplaySimulationTetra( SMESH::SMESH_Mesh_ptr aMesh, const TColStd_MapOfInteger& MapIndex ); void DisplaySimulationTetra( SMESH::SMESH_Mesh_ptr aMesh, const TColStd_MapOfInteger& MapIndex );
void DisplaySimulationHexa( SMESH::SMESH_Mesh_ptr aMesh, const TColStd_MapOfInteger& MapIndex ); void DisplaySimulationHexa( SMESH::SMESH_Mesh_ptr aMesh, const TColStd_MapOfInteger& MapIndex );
/* ELEMENTS */ /* ELEMENTS */
void RemoveElement(SMESH_Actor*, int idnode);
void RemoveElements(SMESH::SMESH_Mesh_ptr aMesh, const TColStd_MapOfInteger& MapIndex) ; void RemoveElements(SMESH::SMESH_Mesh_ptr aMesh, const TColStd_MapOfInteger& MapIndex) ;
void RemoveElements(SMESH_Actor* Mactor, int number,
const SMESH::double_array& coords, const SMESH::long_array& indexes);
void OrientationElements(SMESH::SMESH_Mesh_ptr aMesh, const TColStd_MapOfInteger& MapIndex); void OrientationElements(SMESH::SMESH_Mesh_ptr aMesh, const TColStd_MapOfInteger& MapIndex);
void DiagonalInversion(SMESH::SMESH_Mesh_ptr aMesh, const TColStd_MapOfInteger& MapIndex); void DiagonalInversion(SMESH::SMESH_Mesh_ptr aMesh, const TColStd_MapOfInteger& MapIndex);
@ -239,6 +229,7 @@ public :
SMESH::SMESH_Mesh_ptr ConvertIOinMesh(const Handle(SALOME_InteractiveObject)& IO, Standard_Boolean& testResult) ; SMESH::SMESH_Mesh_ptr ConvertIOinMesh(const Handle(SALOME_InteractiveObject)& IO, Standard_Boolean& testResult) ;
SMESH::SMESH_subMesh_ptr ConvertIOinSubMesh(const Handle(SALOME_InteractiveObject)& IO, Standard_Boolean& testResult) ; SMESH::SMESH_subMesh_ptr ConvertIOinSubMesh(const Handle(SALOME_InteractiveObject)& IO, Standard_Boolean& testResult) ;
SMESH::SMESH_Group_ptr ConvertIOinSMESHGroup(const Handle(SALOME_InteractiveObject)& IO, Standard_Boolean& testResult) ;
/* Geometry Client */ /* Geometry Client */
GEOM::GEOM_Shape_ptr ConvertIOinGEOMShape( const Handle(SALOME_InteractiveObject)& IO, GEOM::GEOM_Shape_ptr ConvertIOinGEOMShape( const Handle(SALOME_InteractiveObject)& IO,
@ -257,7 +248,7 @@ public :
void SetViewMode(int commandId); void SetViewMode(int commandId);
void ChangeRepresentation( SMESH_Actor* ac, int type ); void ChangeRepresentation( SMESH_Actor* ac, int type );
SMESH_Actor* FindActor(SMESH::SMESH_Mesh_ptr aMesh, SMESH_Actor* FindActor(CORBA::Object_ptr theObj,
Standard_Boolean& testResult, Standard_Boolean& testResult,
bool onlyInActiveView); bool onlyInActiveView);
SMESH_Actor* FindActorByEntry(QString entry, SMESH_Actor* FindActorByEntry(QString entry,
@ -282,10 +273,7 @@ public :
QString Bold, QString Italic, QString Shadow, QString Font, QString Bold, QString Italic, QString Shadow, QString Font,
QString Orientation, float Width, float Height, QString Orientation, float Width, float Height,
int NbColors, int NbLabels); int NbColors, int NbLabels);
void DisplayScalarBar(bool visibility); void SetDisplaySettings();
void UpdateScalarBar(float MinRange, float MaxRange);
void SetDisplaySettings();
SALOMEDS::Study::ListOfSObject* GetMeshesUsingAlgoOrHypothesis( SMESH::SMESH_Hypothesis_ptr AlgoOrHyp ) ; SALOMEDS::Study::ListOfSObject* GetMeshesUsingAlgoOrHypothesis( SMESH::SMESH_Hypothesis_ptr AlgoOrHyp ) ;
@ -303,11 +291,12 @@ public :
static void setOrb(); static void setOrb();
/* Import/Export */ //NBU /* Import/Export */ //NBU
static void Import_Document(QAD_Desktop* parent, int theCommandID);
static void Export_Document(QAD_Desktop* parent, int theCommandID);
static void Import_Mesh(QAD_Desktop* parent, int theCommandID); static void Import_Mesh(QAD_Desktop* parent, int theCommandID);
static void Export_Mesh(QAD_Desktop* parent, int theCommandID); static void Export_Mesh(QAD_Desktop* parent, int theCommandID);
/* Filter manager */
SMESH::FilterManager_ptr GetFilterMgr();
signals: signals:
void SignalDeactivateActiveDialog() ; void SignalDeactivateActiveDialog() ;
void SignalCloseAllDialogs() ; void SignalCloseAllDialogs() ;

View File

@ -255,7 +255,7 @@ void SMESHGUI_AddEdgeDlg::ClickOnOk()
//================================================================================= //=================================================================================
void SMESHGUI_AddEdgeDlg::ClickOnCancel() void SMESHGUI_AddEdgeDlg::ClickOnCancel()
{ {
QAD_Application::getDesktop()->SetSelectionMode( 4 ); QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
disconnect( mySelection, 0, this, 0 ); disconnect( mySelection, 0, this, 0 );
mySMESHGUI->ResetState() ; mySMESHGUI->ResetState() ;
mySMESHGUI->EraseSimulationActors(); mySMESHGUI->EraseSimulationActors();
@ -282,9 +282,9 @@ void SMESHGUI_AddEdgeDlg::SelectionIntoArgument()
if(nbNodes < 1) if(nbNodes < 1)
return ; return ;
if ( mySelection->SelectionMode() != 1 ) { if ( mySelection->SelectionMode() != NodeSelection ) {
QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("SMESH_WRN_WARNING"), QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("SMESH_WRN_WARNING"),
tr ("SMESH_WRN_SELECTIONMODE_NODES"), tr ("SMESH_BUT_YES") ); tr ("SMESH_WRN_SELECTIONMODE_NODES"), tr ("SMESH_BUT_OK") );
return; return;
} }

View File

@ -278,7 +278,7 @@ void SMESHGUI_AddFaceDlg::ClickOnOk()
//================================================================================= //=================================================================================
void SMESHGUI_AddFaceDlg::ClickOnCancel() void SMESHGUI_AddFaceDlg::ClickOnCancel()
{ {
QAD_Application::getDesktop()->SetSelectionMode( 4 ); QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
disconnect( mySelection, 0, this, 0 ); disconnect( mySelection, 0, this, 0 );
mySMESHGUI->ResetState() ; mySMESHGUI->ResetState() ;
mySMESHGUI->EraseSimulationActors(); mySMESHGUI->EraseSimulationActors();
@ -305,9 +305,9 @@ void SMESHGUI_AddFaceDlg::SelectionIntoArgument()
if(nbNodes < 1) if(nbNodes < 1)
return ; return ;
if ( mySelection->SelectionMode() != 1 ) { if ( mySelection->SelectionMode() != NodeSelection ) {
QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("SMESH_WRN_WARNING"), QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("SMESH_WRN_WARNING"),
tr ("SMESH_WRN_SELECTIONMODE_NODES"), tr ("SMESH_BUT_YES") ); tr ("SMESH_WRN_SELECTIONMODE_NODES"), tr ("SMESH_BUT_OK") );
return; return;
} }

View File

@ -33,23 +33,20 @@ using namespace std;
#include "QAD_Application.h" #include "QAD_Application.h"
#include "QAD_Desktop.h" #include "QAD_Desktop.h"
#include "QAD_MessageBox.h"
#include "QAD_WaitCursor.h"
#include "QAD_Operation.h"
#include "utilities.h" #include "utilities.h"
// QT Includes // QT Includes
#include <qbuttongroup.h>
#include <qgroupbox.h> #include <qgroupbox.h>
#include <qlabel.h> #include <qlabel.h>
#include <qlineedit.h> #include <qlineedit.h>
#include <qpushbutton.h> #include <qpushbutton.h>
#include <qradiobutton.h>
#include <qlayout.h> #include <qlayout.h>
#include <qvariant.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include <qimage.h>
#include <qpixmap.h> #include <qpixmap.h>
//================================================================================= //=================================================================================
// class : SMESHGUI_AddSubMeshDlg() // class : SMESHGUI_AddSubMeshDlg()
// purpose : Constructs a SMESHGUI_AddSubMeshDlg which is a child of 'parent', with the // purpose : Constructs a SMESHGUI_AddSubMeshDlg which is a child of 'parent', with the
@ -58,149 +55,97 @@ using namespace std;
// TRUE to construct a modal dialog. // TRUE to construct a modal dialog.
//================================================================================= //=================================================================================
SMESHGUI_AddSubMeshDlg::SMESHGUI_AddSubMeshDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl ) SMESHGUI_AddSubMeshDlg::SMESHGUI_AddSubMeshDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl )
: QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose )
{ {
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_DLG_ADD_SUBMESH")));
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_SELECT"))); QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "SMESH",tr("ICON_SELECT")));
if ( !name ) if ( !name )
setName( "SMESHGUI_AddSubMeshDlg" ); setName( "SMESHGUI_AddSubMeshDlg" );
resize( 303, 175 );
setCaption( tr( "SMESH_ADD_SUBMESH" ) ); setCaption( tr( "SMESH_ADD_SUBMESH" ) );
setSizeGripEnabled( TRUE ); setSizeGripEnabled( TRUE );
SMESHGUI_AddSubMeshDlgLayout = new QGridLayout( this ); QGridLayout* SMESHGUI_AddSubMeshDlgLayout = new QGridLayout( this );
SMESHGUI_AddSubMeshDlgLayout->setSpacing( 6 ); SMESHGUI_AddSubMeshDlgLayout->setSpacing( 6 );
SMESHGUI_AddSubMeshDlgLayout->setMargin( 11 ); SMESHGUI_AddSubMeshDlgLayout->setMargin( 11 );
/***************************************************************/ /***************************************************************/
GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); GroupC1 = new QGroupBox( tr( "SMESH_ARGUMENTS" ), this, "GroupC1" );
GroupConstructors->setTitle( tr( "SMESH_SUBMESH" ) );
GroupConstructors->setExclusive( TRUE );
GroupConstructors->setColumnLayout(0, Qt::Vertical );
GroupConstructors->layout()->setSpacing( 0 );
GroupConstructors->layout()->setMargin( 0 );
GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
GroupConstructorsLayout->setAlignment( Qt::AlignTop );
GroupConstructorsLayout->setSpacing( 6 );
GroupConstructorsLayout->setMargin( 11 );
Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
Constructor1->setText( tr( "" ) );
Constructor1->setPixmap( image1 );
Constructor1->setChecked( TRUE );
Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
Constructor1->setMinimumSize( QSize( 50, 0 ) );
GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupConstructorsLayout->addItem( spacer, 0, 1 );
SMESHGUI_AddSubMeshDlgLayout->addWidget( GroupConstructors, 0, 0 );
/***************************************************************/
GroupButtons = new QGroupBox( this, "GroupButtons" );
GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
GroupButtons->setTitle( tr( "" ) );
GroupButtons->setColumnLayout(0, Qt::Vertical );
GroupButtons->layout()->setSpacing( 0 );
GroupButtons->layout()->setMargin( 0 );
GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
GroupButtonsLayout->setAlignment( Qt::AlignTop );
GroupButtonsLayout->setSpacing( 6 );
GroupButtonsLayout->setMargin( 11 );
buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
buttonCancel->setText( tr( "SMESH_BUT_CLOSE" ) );
buttonCancel->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
buttonApply = new QPushButton( GroupButtons, "buttonApply" );
buttonApply->setText( tr( "SMESH_BUT_APPLY" ) );
buttonApply->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
GroupButtonsLayout->addItem( spacer_9, 0, 2 );
buttonOk = new QPushButton( GroupButtons, "buttonOk" );
buttonOk->setText( tr( "SMESH_BUT_OK" ) );
buttonOk->setAutoDefault( TRUE );
buttonOk->setDefault( TRUE );
GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
SMESHGUI_AddSubMeshDlgLayout->addWidget( GroupButtons, 2, 0 );
/***************************************************************/
GroupC1 = new QGroupBox( this, "GroupC1" );
GroupC1->setTitle( tr( "SMESH_ARGUMENTS" ) );
GroupC1->setMinimumSize( QSize( 0, 0 ) );
GroupC1->setFrameShape( QGroupBox::Box );
GroupC1->setFrameShadow( QGroupBox::Sunken );
GroupC1->setColumnLayout(0, Qt::Vertical ); GroupC1->setColumnLayout(0, Qt::Vertical );
GroupC1->layout()->setSpacing( 0 ); GroupC1->layout()->setSpacing( 0 );
GroupC1->layout()->setMargin( 0 ); GroupC1->layout()->setMargin( 0 );
GroupC1Layout = new QGridLayout( GroupC1->layout() ); QGridLayout* GroupC1Layout = new QGridLayout( GroupC1->layout() );
GroupC1Layout->setAlignment( Qt::AlignTop ); GroupC1Layout->setAlignment( Qt::AlignTop );
GroupC1Layout->setSpacing( 6 ); GroupC1Layout->setSpacing( 6 );
GroupC1Layout->setMargin( 11 ); GroupC1Layout->setMargin( 11 );
TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); TextLabel_NameMesh = new QLabel( tr( "SMESH_NAME" ), GroupC1, "TextLabel_NameMesh" );
TextLabelC1A1->setText( tr( "SMESH_OBJECT_MESH" ) ); GroupC1Layout->addWidget( TextLabel_NameMesh, 0, 0 );
TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) ); LineEdit_NameMesh = new QLineEdit( GroupC1, "LineEdit_NameMesh" );
TextLabelC1A1->setFrameShape( QLabel::NoFrame ); GroupC1Layout->addWidget( LineEdit_NameMesh, 0, 2 );
TextLabelC1A1->setFrameShadow( QLabel::Plain );
GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 ); TextLabelC1A1 = new QLabel( tr( "SMESH_OBJECT_MESH" ), GroupC1, "TextLabelC1A1" );
GroupC1Layout->addWidget( TextLabelC1A1, 1, 0 );
SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" ); SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" );
SelectButtonC1A1->setText( tr( "" ) );
SelectButtonC1A1->setPixmap( image0 ); SelectButtonC1A1->setPixmap( image0 );
SelectButtonC1A1->setToggleButton( FALSE ); SelectButtonC1A1->setToggleButton( FALSE );
GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); GroupC1Layout->addWidget( SelectButtonC1A1, 1, 1 );
LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" );
GroupC1Layout->addWidget( LineEditC1A1, 0, 2 ); GroupC1Layout->addWidget( LineEditC1A1, 1, 2 );
TextLabelC1A2 = new QLabel( GroupC1, "TextLabelC1A2" ); TextLabelC1A2 = new QLabel( tr( "SMESH_OBJECT_GEOM" ), GroupC1, "TextLabelC1A2" );
TextLabelC1A2->setText( tr( "SMESH_OBJECT_GEOM" ) ); GroupC1Layout->addWidget( TextLabelC1A2, 2, 0 );
TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) );
TextLabelC1A2->setFrameShape( QLabel::NoFrame );
TextLabelC1A2->setFrameShadow( QLabel::Plain );
GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 );
SelectButtonC1A2 = new QPushButton( GroupC1, "SelectButtonC1A2" ); SelectButtonC1A2 = new QPushButton( GroupC1, "SelectButtonC1A2" );
SelectButtonC1A2->setText( tr( "" ) );
SelectButtonC1A2->setPixmap( image0 ); SelectButtonC1A2->setPixmap( image0 );
SelectButtonC1A2->setToggleButton( FALSE ); SelectButtonC1A2->setToggleButton( FALSE );
GroupC1Layout->addWidget( SelectButtonC1A2, 1, 1 ); GroupC1Layout->addWidget( SelectButtonC1A2, 2, 1 );
LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" ); LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" );
GroupC1Layout->addWidget( LineEditC1A2, 1, 2 ); GroupC1Layout->addWidget( LineEditC1A2, 2, 2 );
TextLabel_NameMesh = new QLabel( GroupC1, "TextLabel_NameMesh" ); TextLabelC1A1Hyp = new QLabel( tr( "SMESH_OBJECT_HYPOTHESIS" ), GroupC1, "TextLabelC1A1Hyp" );
TextLabel_NameMesh->setText( tr( "SMESH_NAME" ) );
GroupC1Layout->addWidget( TextLabel_NameMesh, 2, 0 );
LineEdit_NameMesh = new QLineEdit( GroupC1, "LineEdit_NameMesh" );
GroupC1Layout->addWidget( LineEdit_NameMesh, 2, 2 );
TextLabelC1A1Hyp = new QLabel( GroupC1, "TextLabelC1A1Hyp" );
TextLabelC1A1Hyp->setText( tr( "SMESH_OBJECT_HYPOTHESIS" ) );
TextLabelC1A1Hyp->setMinimumSize( QSize( 50, 0 ) );
TextLabelC1A1Hyp->setFrameShape( QLabel::NoFrame );
TextLabelC1A1Hyp->setFrameShadow( QLabel::Plain );
GroupC1Layout->addWidget( TextLabelC1A1Hyp, 3, 0 ); GroupC1Layout->addWidget( TextLabelC1A1Hyp, 3, 0 );
SelectButtonC1A1Hyp = new QPushButton( GroupC1, "SelectButtonC1A1Hyp" ); SelectButtonC1A1Hyp = new QPushButton( GroupC1, "SelectButtonC1A1Hyp" );
SelectButtonC1A1Hyp->setText( tr( "" ) );
SelectButtonC1A1Hyp->setPixmap( image0 ); SelectButtonC1A1Hyp->setPixmap( image0 );
GroupC1Layout->addWidget( SelectButtonC1A1Hyp, 3, 1 ); GroupC1Layout->addWidget( SelectButtonC1A1Hyp, 3, 1 );
LineEditC1A1Hyp = new QLineEdit( GroupC1, "LineEditC1A1Hyp" ); LineEditC1A1Hyp = new QLineEdit( GroupC1, "LineEditC1A1Hyp" );
LineEditC1A1Hyp->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1Hyp->sizePolicy().hasHeightForWidth() ) );
GroupC1Layout->addWidget( LineEditC1A1Hyp, 3, 2 ); GroupC1Layout->addWidget( LineEditC1A1Hyp, 3, 2 );
TextLabelC1A1Algo = new QLabel( GroupC1, "TextLabelC1A1Algo" ); TextLabelC1A1Algo = new QLabel( tr( "SMESH_OBJECT_ALGORITHM" ), GroupC1, "TextLabelC1A1Algo" );
TextLabelC1A1Algo->setText( tr( "SMESH_OBJECT_ALGORITHM" ) );
TextLabelC1A1Algo->setMinimumSize( QSize( 50, 0 ) );
TextLabelC1A1Algo->setFrameShape( QLabel::NoFrame );
TextLabelC1A1Algo->setFrameShadow( QLabel::Plain );
GroupC1Layout->addWidget( TextLabelC1A1Algo, 4, 0 ); GroupC1Layout->addWidget( TextLabelC1A1Algo, 4, 0 );
SelectButtonC1A1Algo = new QPushButton( GroupC1, "SelectButtonC1A1Algo" ); SelectButtonC1A1Algo = new QPushButton( GroupC1, "SelectButtonC1A1Algo" );
SelectButtonC1A1Algo->setText( tr( "" ) );
SelectButtonC1A1Algo->setPixmap( image0 ); SelectButtonC1A1Algo->setPixmap( image0 );
GroupC1Layout->addWidget( SelectButtonC1A1Algo, 4, 1 ); GroupC1Layout->addWidget( SelectButtonC1A1Algo, 4, 1 );
LineEditC1A1Algo = new QLineEdit( GroupC1, "LineEditC1A1Algo" ); LineEditC1A1Algo = new QLineEdit( GroupC1, "LineEditC1A1Algo" );
LineEditC1A1Algo->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1Algo->sizePolicy().hasHeightForWidth() ) );
GroupC1Layout->addWidget( LineEditC1A1Algo, 4, 2 ); GroupC1Layout->addWidget( LineEditC1A1Algo, 4, 2 );
SMESHGUI_AddSubMeshDlgLayout->addWidget( GroupC1, 1, 0 ); SMESHGUI_AddSubMeshDlgLayout->addWidget( GroupC1, 1, 0 );
/***************************************************************/
Init(Sel) ; /***************************************************************/
GroupButtons = new QGroupBox( this, "GroupButtons" );
GroupButtons->setColumnLayout(0, Qt::Vertical );
GroupButtons->layout()->setSpacing( 0 );
GroupButtons->layout()->setMargin( 0 );
QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
GroupButtonsLayout->setAlignment( Qt::AlignTop );
GroupButtonsLayout->setSpacing( 6 );
GroupButtonsLayout->setMargin( 11 );
buttonOk = new QPushButton( tr( "SMESH_BUT_OK" ), GroupButtons, "buttonOk" );
buttonOk->setAutoDefault( TRUE );
buttonOk->setDefault( TRUE );
GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
buttonApply = new QPushButton( tr( "SMESH_BUT_APPLY" ), GroupButtons, "buttonApply" );
buttonApply->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
GroupButtonsLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 2 );
buttonCancel = new QPushButton( tr( "SMESH_BUT_CLOSE" ), GroupButtons, "buttonCancel" );
buttonCancel->setAutoDefault( TRUE );
GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
SMESHGUI_AddSubMeshDlgLayout->addWidget( GroupButtons, 2, 0 );
/***************************************************************/
Init( Sel ) ;
} }
@ -220,60 +165,41 @@ SMESHGUI_AddSubMeshDlg::~SMESHGUI_AddSubMeshDlg()
//================================================================================= //=================================================================================
void SMESHGUI_AddSubMeshDlg::Init( SALOME_Selection* Sel ) void SMESHGUI_AddSubMeshDlg::Init( SALOME_Selection* Sel )
{ {
GroupC1->show();
myConstructorId = 0 ;
Constructor1->setChecked( TRUE );
myEditCurrentArgument = LineEditC1A1 ;
mySelection = Sel; mySelection = Sel;
mySMESHGUI = SMESHGUI::GetSMESHGUI() ; mySMESHGUI = SMESHGUI::GetSMESHGUI() ;
mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ; mySMESHGUI->SetActiveDialogBox( (QDialog*)this ) ;
myGeomFilter = new SALOME_TypeFilter( "GEOM" ); myGeomFilter = new SALOME_TypeFilter( "GEOM" );
myMeshFilter = new SMESH_TypeFilter( MESH ); myMeshFilter = new SMESH_TypeFilter( MESH );
myAlgorithmFilter = new SMESH_TypeFilter( ALGORITHM );
myAlgorithmFilter = new SMESH_TypeFilter( ALGORITHM );
myHypothesisFilter = new SMESH_TypeFilter( HYPOTHESIS ); myHypothesisFilter = new SMESH_TypeFilter( HYPOTHESIS );
myNameSubMesh = "SubMesh";
myGeomShape = GEOM::GEOM_Shape::_nil();
myMesh = SMESH::SMESH_Mesh::_nil();
/* signals and slots connections */ /* signals and slots connections */
connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) ); connect( buttonApply, SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ; connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
connect( SelectButtonC1A2, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; connect( SelectButtonC1A2, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
connect( LineEdit_NameMesh, SIGNAL (textChanged(const QString&) ), this, SLOT( TextChangedInLineEdit(const QString&) ) ) ; connect( SelectButtonC1A1Hyp, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
connect( SelectButtonC1A1Hyp, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
connect( SelectButtonC1A1Algo, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; connect( SelectButtonC1A1Algo, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
connect( mySMESHGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ; connect( mySMESHGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
connect( mySMESHGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ; connect( mySMESHGUI, SIGNAL( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
int x, y ; int x, y ;
mySMESHGUI->DefineDlgPosition( this, x, y ) ; mySMESHGUI->DefineDlgPosition( this, x, y ) ;
this->move( x, y ) ; this->move( x, y ) ;
this->show() ; this->show() ;
LineEdit_NameMesh->setText( tr( "SMESH_SUBMESH" ) );
LineEdit_NameMesh->setFocus() ;
myEditCurrentArgument = LineEditC1A1 ;
mySelection->ClearFilters() ;
mySelection->AddFilter( myMeshFilter ) ;
SelectionIntoArgument(); SelectionIntoArgument();
return ;
}
//=================================================================================
// function : ConstructorsClicked()
// purpose : Radio button management
//=================================================================================
void SMESHGUI_AddSubMeshDlg::ConstructorsClicked(int constructorId)
{
return ;
} }
//================================================================================= //=================================================================================
@ -282,50 +208,77 @@ void SMESHGUI_AddSubMeshDlg::ConstructorsClicked(int constructorId)
//================================================================================= //=================================================================================
void SMESHGUI_AddSubMeshDlg::ClickOnOk() void SMESHGUI_AddSubMeshDlg::ClickOnOk()
{ {
this->ClickOnApply() ; if ( this->ClickOnApply() )
this->ClickOnCancel() ; this->ClickOnCancel() ;
} }
//================================================================================= //=================================================================================
// function : ClickOnApply() // function : ClickOnApply()
// purpose : // purpose :
//================================================================================= //=================================================================================
void SMESHGUI_AddSubMeshDlg::ClickOnApply() bool SMESHGUI_AddSubMeshDlg::ClickOnApply()
{ {
switch(myConstructorId) QString myNameSubMesh = LineEdit_NameMesh->text().stripWhiteSpace();
{ if ( myNameSubMesh.isEmpty() ) {
case 0 : QAD_MessageBox::warn1( this, tr( "SMESH_WRN_WARNING" ), tr( "SMESH_WRN_EMPTY_NAME" ), tr( "SMESH_BUT_OK" ) );
{ return false;
if ( !myNameSubMesh.isEmpty() && !myNameSubMesh.isNull() && }
!myGeomShape->_is_nil() && !myMesh->_is_nil()) {
mySubMesh = mySMESHGUI->AddSubMesh( myMesh, myGeomShape, myNameSubMesh ) ; if ( myMesh->_is_nil() || myGeomShape->_is_nil() || ( !HypoList.count() && !AlgoList.count() ) )
} return false;
if( myOkHypothesis && !mySubMesh->_is_nil() ) {
SALOME_ListIteratorOfListIO It( HypoList );
for(;It.More();It.Next()) {
Handle(SALOME_InteractiveObject) IObject = It.Value();
Standard_Boolean testResult;
myHypothesis = mySMESHGUI->ConvertIOinSMESHHypothesis(IObject, testResult) ;
if( testResult )
mySMESHGUI->AddHypothesisOnSubMesh(mySubMesh, myHypothesis) ;
}
}
if( myOkAlgorithm && !mySubMesh->_is_nil() ) { SALOMEDS::SObject_var aMeshSO = mySMESHGUI->GetStudyAPI().FindObject( myMesh );
SALOME_ListIteratorOfListIO It( AlgoList ); GEOM::GEOM_Shape_var myMainShape = mySMESHGUI->GetStudyAPI().GetShapeOnMeshOrSubMesh( aMeshSO );
for(;It.More();It.Next()) { if ( myMainShape->_is_nil() )
Handle(SALOME_InteractiveObject) IObject = It.Value(); return false;
Standard_Boolean testResult;
myAlgorithm = mySMESHGUI->ConvertIOinSMESHHypothesis(IObject, testResult) ; QAD_WaitCursor wc;
if( testResult )
mySMESHGUI->AddAlgorithmOnSubMesh(mySubMesh, myAlgorithm) ; QAD_Operation* op = new QAD_Operation( mySMESHGUI->GetActiveStudy() );
// start transaction
op->start();
// create submesh
SMESH::SMESH_subMesh_var aSubMesh = mySMESHGUI->AddSubMesh( myMesh, myGeomShape, myNameSubMesh ) ;
if ( !aSubMesh->_is_nil() ) {
// assign hypotheses
for( int i = 0; i < HypoList.count(); i++ ) {
SALOMEDS::SObject_var aHypSO = mySMESHGUI->GetStudy()->FindObjectID( HypoList[i] );
if ( !aHypSO->_is_nil() ) {
CORBA::Object_var anObject = aHypSO->GetObject();
if ( !CORBA::is_nil( anObject ) ) {
SMESH::SMESH_Hypothesis_var aHyp = SMESH::SMESH_Hypothesis::_narrow( anObject );
if ( !aHyp->_is_nil() )
if ( !mySMESHGUI->AddHypothesisOnSubMesh( aSubMesh, aHyp ) ) {
// abort transaction
op->abort();
return false;
} }
} }
break ;
} }
} }
// assign algorithms
for( int i = 0; i < AlgoList.count(); i++ ) {
SALOMEDS::SObject_var aHypSO = mySMESHGUI->GetStudy()->FindObjectID( AlgoList[i] );
if ( !aHypSO->_is_nil() ) {
CORBA::Object_var anObject = aHypSO->GetObject();
if ( !CORBA::is_nil( anObject ) ) {
SMESH::SMESH_Hypothesis_var aHyp = SMESH::SMESH_Hypothesis::_narrow( anObject );
if ( !aHyp->_is_nil() )
if ( !mySMESHGUI->AddAlgorithmOnSubMesh( aSubMesh, aHyp ) ) {
// abort transaction
op->abort();
return false;
}
}
}
}
}
// commit transaction
op->finish();
return true;
} }
@ -335,13 +288,20 @@ void SMESHGUI_AddSubMeshDlg::ClickOnApply()
//================================================================================= //=================================================================================
void SMESHGUI_AddSubMeshDlg::ClickOnCancel() void SMESHGUI_AddSubMeshDlg::ClickOnCancel()
{ {
disconnect( mySelection, 0, this, 0 ); close();
mySMESHGUI->ResetState() ;
mySelection->ClearFilters() ;
reject() ;
return ;
} }
static bool IsFatherOf( SALOMEDS::SObject_ptr SO, SALOMEDS::SObject_ptr fatherSO ) {
if ( !SO->_is_nil() && !fatherSO->_is_nil() ) {
SALOMEDS::SObject_var aSO = SO->GetFather();
while( strlen( aSO->GetID() ) >= strlen( fatherSO->GetID() ) ) {
if ( QString( aSO->GetID() ) == QString( fatherSO->GetID() ) )
return true;
aSO = aSO->GetFather();
}
}
return false;
}
//================================================================================= //=================================================================================
// function : SelectionIntoArgument() // function : SelectionIntoArgument()
@ -349,81 +309,88 @@ void SMESHGUI_AddSubMeshDlg::ClickOnCancel()
//================================================================================= //=================================================================================
void SMESHGUI_AddSubMeshDlg::SelectionIntoArgument() void SMESHGUI_AddSubMeshDlg::SelectionIntoArgument()
{ {
myEditCurrentArgument->setText("") ; SMESHGUI_StudyAPI myStudyAPI = mySMESHGUI->GetStudyAPI();
QString aString = ""; QString aString = "";
int nbSel = mySMESHGUI->GetNameOfSelectedIObjects(mySelection, aString) ; int nbSel = mySMESHGUI->GetNameOfSelectedIObjects(mySelection, aString) ;
switch (myConstructorId) if ( myEditCurrentArgument == LineEditC1A1 ) {
{ // mesh
case 0: if ( nbSel != 1 ) {
{ myMesh = SMESH::SMESH_Mesh::_nil();
if ( myEditCurrentArgument == LineEditC1A1 ) { aString = "";
if ( nbSel != 1 ) { }
myOkHypothesis = false; else {
myOkAlgorithm = false; Standard_Boolean testResult ;
return ; Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ;
} else { myMesh = mySMESHGUI->ConvertIOinMesh(IO, testResult) ;
Standard_Boolean testResult ; if( !testResult ) {
Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; myMesh = SMESH::SMESH_Mesh::_nil();
myMesh = mySMESHGUI->ConvertIOinMesh(IO, testResult) ; aString = "";
if( !testResult ) {
myMesh = SMESH::SMESH_Mesh::_nil();
return ;
}
}
} else if ( myEditCurrentArgument == LineEditC1A2 ) {
if ( nbSel != 1 ) {
myOkHypothesis = false;
myOkAlgorithm = false;
return ;
} else {
Standard_Boolean testResult ;
Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ;
myGeomShape = mySMESHGUI->ConvertIOinGEOMShape(IO, testResult) ;
if( !testResult ) {
myGeomShape = GEOM::GEOM_Shape::_nil();
return ;
}
}
} else if ( myEditCurrentArgument == LineEditC1A1Hyp ) {
if ( nbSel >= 1 ) {
HypoList.Clear();
SALOME_ListIteratorOfListIO Itinit( mySelection->StoredIObjects() );
for (; Itinit.More(); Itinit.Next()) {
HypoList.Append(Itinit.Value());
}
myOkHypothesis = true ;
if (nbSel > 1)
aString = tr("%1 Hypothesis").arg(nbSel) ;
LineEditC1A1Hyp->setText(aString) ;
}
else {
myOkHypothesis = false ;
return ;
}
} else if ( myEditCurrentArgument == LineEditC1A1Algo ) {
if ( nbSel >= 1 ) {
AlgoList.Clear();
SALOME_ListIteratorOfListIO Itinit( mySelection->StoredIObjects() );
for (; Itinit.More(); Itinit.Next()) {
AlgoList.Append(Itinit.Value());
}
myOkAlgorithm = true ;
if (nbSel > 1)
aString = tr("%1 Algorithms").arg(nbSel) ;
LineEditC1A1Algo->setText(aString) ;
}
else {
myOkAlgorithm = false ;
return ;
}
}
break;
} }
} }
myGeomShape = GEOM::GEOM_Shape::_nil();
LineEditC1A2->setText( "" );
}
else if ( myEditCurrentArgument == LineEditC1A2 ) {
// geom shape
if ( nbSel != 1 ) {
myGeomShape = GEOM::GEOM_Shape::_nil();
aString = "";
}
else {
Standard_Boolean testResult ;
Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ;
myGeomShape = mySMESHGUI->ConvertIOinGEOMShape(IO, testResult) ;
if( !testResult ) {
myGeomShape = GEOM::GEOM_Shape::_nil();
aString = "";
}
if ( !myMesh->_is_nil() ) {
SALOMEDS::SObject_var aMeshSO = myStudyAPI.FindObject( myMesh );
GEOM::GEOM_Shape_var aMainGeomShape = myStudyAPI.GetShapeOnMeshOrSubMesh( aMeshSO );
SALOMEDS::SObject_var aMainGeomShapeSO = myStudyAPI.FindObject( aMainGeomShape );
if ( aMainGeomShapeSO->_is_nil() || !IsFatherOf( mySMESHGUI->GetStudy()->FindObjectID( IO->getEntry() ), aMainGeomShapeSO ) ) {
myGeomShape = GEOM::GEOM_Shape::_nil();
aString = "";
}
}
}
}
else if ( myEditCurrentArgument == LineEditC1A1Hyp ) {
// hypotheses
HypoList.clear();
if ( nbSel >= 1 ) {
SALOME_ListIteratorOfListIO Itinit( mySelection->StoredIObjects() );
for ( ; Itinit.More(); Itinit.Next() ) {
HypoList.append( Itinit.Value()->getEntry() );
}
if ( nbSel > 1 )
aString = tr( "%1 Hypothesis" ).arg( nbSel ) ;
}
else {
aString = "";
}
}
else if ( myEditCurrentArgument == LineEditC1A1Algo ) {
// algorithms
AlgoList.clear();
if ( nbSel >= 1 ) {
SALOME_ListIteratorOfListIO Itinit( mySelection->StoredIObjects() );
for ( ; Itinit.More(); Itinit.Next() ) {
AlgoList.append( Itinit.Value()->getEntry() );
}
if ( nbSel > 1 )
aString = tr( "%1 Algorithms" ).arg( nbSel ) ;
}
else {
aString = "";
}
}
myEditCurrentArgument->setText(aString) ; myEditCurrentArgument->setText(aString) ;
UpdateControlState();
} }
@ -434,36 +401,28 @@ void SMESHGUI_AddSubMeshDlg::SelectionIntoArgument()
void SMESHGUI_AddSubMeshDlg::SetEditCurrentArgument() void SMESHGUI_AddSubMeshDlg::SetEditCurrentArgument()
{ {
QPushButton* send = (QPushButton*)sender(); QPushButton* send = (QPushButton*)sender();
switch (myConstructorId) if(send == SelectButtonC1A1) {
{ LineEditC1A1->setFocus() ;
case 0: /* default constructor */ myEditCurrentArgument = LineEditC1A1;
{ mySelection->ClearFilters() ;
if(send == SelectButtonC1A1) { mySelection->AddFilter(myMeshFilter) ;
LineEditC1A1->setFocus() ; } else if (send == SelectButtonC1A2) {
myEditCurrentArgument = LineEditC1A1; LineEditC1A2->setFocus() ;
mySelection->ClearFilters() ; myEditCurrentArgument = LineEditC1A2;
mySelection->AddFilter(myMeshFilter) ; mySelection->ClearFilters() ;
} else if (send == SelectButtonC1A2) { mySelection->AddFilter(myGeomFilter) ;
LineEditC1A2->setFocus() ; } else if( send == SelectButtonC1A1Hyp ) {
myEditCurrentArgument = LineEditC1A2; LineEditC1A1Hyp->setFocus() ;
mySelection->ClearFilters() ; myEditCurrentArgument = LineEditC1A1Hyp ;
mySelection->AddFilter(myGeomFilter) ; mySelection->ClearFilters() ;
} else if( send == SelectButtonC1A1Hyp ) { mySelection->AddFilter(myHypothesisFilter) ;
LineEditC1A1Hyp->setFocus() ; } else if( send == SelectButtonC1A1Algo ) {
myEditCurrentArgument = LineEditC1A1Hyp ; LineEditC1A1Algo->setFocus() ;
mySelection->ClearFilters() ; myEditCurrentArgument = LineEditC1A1Algo ;
mySelection->AddFilter(myHypothesisFilter) ; mySelection->ClearFilters() ;
} else if( send == SelectButtonC1A1Algo ) { mySelection->AddFilter(myAlgorithmFilter) ;
LineEditC1A1Algo->setFocus() ; }
myEditCurrentArgument = LineEditC1A1Algo ; SelectionIntoArgument() ;
mySelection->ClearFilters() ;
mySelection->AddFilter(myAlgorithmFilter) ;
}
SelectionIntoArgument() ;
break;
}
}
return ;
} }
//================================================================================= //=================================================================================
@ -472,9 +431,8 @@ void SMESHGUI_AddSubMeshDlg::SetEditCurrentArgument()
//================================================================================= //=================================================================================
void SMESHGUI_AddSubMeshDlg::DeactivateActiveDialog() void SMESHGUI_AddSubMeshDlg::DeactivateActiveDialog()
{ {
if ( GroupConstructors->isEnabled() ) { if ( GroupC1->isEnabled() ) {
disconnect( mySelection, 0, this, 0 ); disconnect( mySelection, 0, this, 0 );
GroupConstructors->setEnabled(false) ;
GroupC1->setEnabled(false) ; GroupC1->setEnabled(false) ;
GroupButtons->setEnabled(false) ; GroupButtons->setEnabled(false) ;
} }
@ -488,11 +446,9 @@ void SMESHGUI_AddSubMeshDlg::DeactivateActiveDialog()
void SMESHGUI_AddSubMeshDlg::ActivateThisDialog() void SMESHGUI_AddSubMeshDlg::ActivateThisDialog()
{ {
mySMESHGUI->EmitSignalDeactivateDialog() ; mySMESHGUI->EmitSignalDeactivateDialog() ;
GroupConstructors->setEnabled(true) ;
GroupC1->setEnabled(true) ; GroupC1->setEnabled(true) ;
GroupButtons->setEnabled(true) ; GroupButtons->setEnabled(true) ;
connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
return ;
} }
@ -502,10 +458,8 @@ void SMESHGUI_AddSubMeshDlg::ActivateThisDialog()
//================================================================================= //=================================================================================
void SMESHGUI_AddSubMeshDlg::enterEvent(QEvent* e) void SMESHGUI_AddSubMeshDlg::enterEvent(QEvent* e)
{ {
if ( GroupConstructors->isEnabled() ) if ( !GroupC1->isEnabled() )
return ; ActivateThisDialog() ;
ActivateThisDialog() ;
return ;
} }
@ -515,21 +469,31 @@ void SMESHGUI_AddSubMeshDlg::enterEvent(QEvent* e)
//================================================================================= //=================================================================================
void SMESHGUI_AddSubMeshDlg::closeEvent( QCloseEvent* e ) void SMESHGUI_AddSubMeshDlg::closeEvent( QCloseEvent* e )
{ {
this->ClickOnCancel() ; disconnect( mySelection, 0, this, 0 );
return ; mySMESHGUI->ResetState() ;
mySelection->ClearFilters() ;
QDialog::closeEvent( e );
} }
//================================================================================= //=================================================================================
// function : TextChangedInLineEdit() // function : UpdateControlState()
// purpose : // purpose :
//================================================================================= //=================================================================================
void SMESHGUI_AddSubMeshDlg::TextChangedInLineEdit(const QString& newText) void SMESHGUI_AddSubMeshDlg::UpdateControlState()
{ {
QLineEdit* send = (QLineEdit*)sender(); bool isEnabled = ( !myMesh->_is_nil() && !myGeomShape->_is_nil() && ( HypoList.count() || AlgoList.count() ) );
QString newT = strdup(newText) ; bool isImportedMesh = false;
if ( !myMesh->_is_nil() ) {
if (send == LineEdit_NameMesh) { SALOMEDS::SObject_var aMeshSO = mySMESHGUI->GetStudyAPI().FindObject( myMesh );
myNameSubMesh = newText; GEOM::GEOM_Shape_var myGeomShape = mySMESHGUI->GetStudyAPI().GetShapeOnMeshOrSubMesh( aMeshSO );
isImportedMesh = myGeomShape->_is_nil();
} }
return ;
buttonOk ->setEnabled( isEnabled && !isImportedMesh );
buttonApply->setEnabled( isEnabled && !isImportedMesh );
} }

View File

@ -34,8 +34,8 @@
#include "SMESH_TypeFilter.hxx" #include "SMESH_TypeFilter.hxx"
// QT Includes // QT Includes
#include <qvariant.h>
#include <qdialog.h> #include <qdialog.h>
#include <qstringlist.h>
// IDL Headers // IDL Headers
#include <SALOMEconfig.h> #include <SALOMEconfig.h>
@ -43,18 +43,12 @@
#include CORBA_SERVER_HEADER(GEOM_Shape) #include CORBA_SERVER_HEADER(GEOM_Shape)
#include CORBA_SERVER_HEADER(SMESH_Mesh) #include CORBA_SERVER_HEADER(SMESH_Mesh)
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QButtonGroup;
class QGroupBox; class QGroupBox;
class QLabel; class QLabel;
class QLineEdit; class QLineEdit;
class QPushButton; class QPushButton;
class QRadioButton;
class SMESHGUI; class SMESHGUI;
//================================================================================= //=================================================================================
// class : SMESHGUI_AddSubMeshDlg // class : SMESHGUI_AddSubMeshDlg
// purpose : // purpose :
@ -67,44 +61,36 @@ public:
SMESHGUI_AddSubMeshDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); SMESHGUI_AddSubMeshDlg( QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 );
~SMESHGUI_AddSubMeshDlg(); ~SMESHGUI_AddSubMeshDlg();
private: protected:
void Init( SALOME_Selection* Sel ) ;
void closeEvent( QCloseEvent* e ) ; void closeEvent( QCloseEvent* e ) ;
void enterEvent ( QEvent * ) ; void enterEvent ( QEvent * ) ;
private:
void Init( SALOME_Selection* Sel ) ;
void UpdateControlState();
private:
SMESHGUI* mySMESHGUI ; SMESHGUI* mySMESHGUI ;
SALOME_Selection* mySelection ; SALOME_Selection* mySelection ;
GEOM::GEOM_Shape_var myGeomShape ;
int myConstructorId ;
QLineEdit* myEditCurrentArgument;
SMESH::SMESH_Mesh_var myMesh; SMESH::SMESH_Mesh_var myMesh;
SMESH::SMESH_subMesh_var mySubMesh; GEOM::GEOM_Shape_var myGeomShape ;
QLineEdit* myEditCurrentArgument;
QString myNameSubMesh ;
Handle(SALOME_TypeFilter) myGeomFilter; Handle(SALOME_TypeFilter) myGeomFilter;
Handle(SMESH_TypeFilter) myMeshFilter; Handle(SMESH_TypeFilter) myMeshFilter;
Handle(SMESH_TypeFilter) myHypothesisFilter; Handle(SMESH_TypeFilter) myHypothesisFilter;
Handle(SMESH_TypeFilter) myAlgorithmFilter; Handle(SMESH_TypeFilter) myAlgorithmFilter;
SALOME_ListIO HypoList; QStringList HypoList;
SALOME_ListIO AlgoList; QStringList AlgoList;
bool myOkHypothesis;
bool myOkAlgorithm;
SMESH::SMESH_Hypothesis_var myHypothesis;
SMESH::SMESH_Hypothesis_var myAlgorithm;
QButtonGroup* GroupConstructors;
QRadioButton* Constructor1;
QGroupBox* GroupButtons; QGroupBox* GroupButtons;
QPushButton* buttonOk; QPushButton* buttonOk;
QPushButton* buttonCancel;
QPushButton* buttonApply; QPushButton* buttonApply;
QPushButton* buttonCancel;
QGroupBox* GroupC1; QGroupBox* GroupC1;
QLabel* TextLabel_NameMesh ; QLabel* TextLabel_NameMesh ;
QLineEdit* LineEdit_NameMesh ; QLineEdit* LineEdit_NameMesh ;
@ -124,22 +110,13 @@ private:
QLineEdit* LineEditC1A1Algo; QLineEdit* LineEditC1A1Algo;
private slots: private slots:
void ConstructorsClicked(int constructorId);
void ClickOnOk(); void ClickOnOk();
bool ClickOnApply();
void ClickOnCancel(); void ClickOnCancel();
void ClickOnApply();
void SetEditCurrentArgument() ; void SetEditCurrentArgument() ;
void SelectionIntoArgument() ; void SelectionIntoArgument() ;
void DeactivateActiveDialog() ; void DeactivateActiveDialog() ;
void ActivateThisDialog() ; void ActivateThisDialog() ;
void TextChangedInLineEdit(const QString& newText) ;
protected:
QGridLayout* SMESHGUI_AddSubMeshDlgLayout;
QGridLayout* GroupConstructorsLayout;
QGridLayout* GroupButtonsLayout;
QGridLayout* GroupC1Layout;
}; };
#endif // DIALOGBOX_ADD_SUBMESH_H #endif // DIALOGBOX_ADD_SUBMESH_H

View File

@ -270,7 +270,7 @@ void SMESHGUI_AddVolumeDlg::ClickOnOk()
//================================================================================= //=================================================================================
void SMESHGUI_AddVolumeDlg::ClickOnCancel() void SMESHGUI_AddVolumeDlg::ClickOnCancel()
{ {
QAD_Application::getDesktop()->SetSelectionMode( 4 ); QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
disconnect( mySelection, 0, this, 0 ); disconnect( mySelection, 0, this, 0 );
mySMESHGUI->ResetState() ; mySMESHGUI->ResetState() ;
mySMESHGUI->EraseSimulationActors(); mySMESHGUI->EraseSimulationActors();
@ -297,9 +297,9 @@ void SMESHGUI_AddVolumeDlg::SelectionIntoArgument()
if(nbNodes < 1) if(nbNodes < 1)
return ; return ;
if ( mySelection->SelectionMode() != 1 ) { if ( mySelection->SelectionMode() != NodeSelection ) {
QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("SMESH_WRN_WARNING"), QAD_MessageBox::warn1 ( QAD_Application::getDesktop(), tr ("SMESH_WRN_WARNING"),
tr ("SMESH_WRN_SELECTIONMODE_NODES"), tr ("SMESH_BUT_YES") ); tr ("SMESH_WRN_SELECTIONMODE_NODES"), tr ("SMESH_BUT_OK") );
return; return;
} }

View File

@ -247,7 +247,7 @@ void SMESHGUI_DiagonalInversionDlg::ClickOnOk()
//================================================================================= //=================================================================================
void SMESHGUI_DiagonalInversionDlg::ClickOnCancel() void SMESHGUI_DiagonalInversionDlg::ClickOnCancel()
{ {
QAD_Application::getDesktop()->SetSelectionMode( 4 ); QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
disconnect( mySelection, 0, this, 0 ); disconnect( mySelection, 0, this, 0 );
mySMESHGUI->ResetState() ; mySMESHGUI->ResetState() ;
reject() ; reject() ;
@ -265,7 +265,7 @@ void SMESHGUI_DiagonalInversionDlg::SelectionIntoArgument()
myOkElements = false; myOkElements = false;
QString aString = ""; QString aString = "";
if ( mySelection->SelectionMode() != 2 ) { if ( mySelection->SelectionMode() != EdgeSelection ) {
return; return;
} }

Some files were not shown because too many files have changed in this diff Show More