Merge with OCC_development_01

This commit is contained in:
admin 2005-01-20 06:25:54 +00:00
parent ed456586bf
commit 090aff0726
119 changed files with 10091 additions and 4204 deletions

View File

@ -27,6 +27,7 @@ mesh_algo_tetra.png \
mesh_angle.png \ mesh_angle.png \
mesh_area.png \ mesh_area.png \
mesh_aspect.png \ mesh_aspect.png \
mesh_aspect_3d.png \
mesh_compute.png \ mesh_compute.png \
mesh_connectivity.png \ mesh_connectivity.png \
mesh_diagonal.png \ mesh_diagonal.png \
@ -42,8 +43,11 @@ advanced_mesh_info.png \
standard_mesh_info.png \ standard_mesh_info.png \
mesh_init.png \ mesh_init.png \
mesh_length.png \ mesh_length.png \
mesh_length_2d.png \
mesh_free_edges.png \ mesh_free_edges.png \
mesh_free_edges_2d.png \
mesh_multi_edges.png \ mesh_multi_edges.png \
mesh_multi_edges_2d.png \
mesh_line_n.png \ mesh_line_n.png \
mesh_line.png \ mesh_line.png \
mesh_move_node.png \ mesh_move_node.png \
@ -95,6 +99,7 @@ mesh_smoothing.png \
mesh_renumbering_nodes.png \ mesh_renumbering_nodes.png \
mesh_renumbering_elements.png \ mesh_renumbering_elements.png \
mesh_extrusion.png \ mesh_extrusion.png \
mesh_extrusionpath.png \
mesh_revolution.png \ mesh_revolution.png \
ModuleMesh.png \ ModuleMesh.png \
mesh_unionGroups.png \ mesh_unionGroups.png \
@ -120,7 +125,9 @@ SMESHCatalog.xml \
flight_solid.brep \ flight_solid.brep \
mesh_pattern.png \ mesh_pattern.png \
pattern_sample_2d.png \ pattern_sample_2d.png \
pattern_sample_3D.png pattern_sample_3D.png \
mesh_add.png \
mesh_remove.png
BIN_SCRIPT= \ BIN_SCRIPT= \
VERSION VERSION

View File

@ -97,12 +97,6 @@ HDF5_INCLUDES=@HDF5_INCLUDES@
HDF5_LIBS=@HDF5_LIBS@ HDF5_LIBS=@HDF5_LIBS@
HDF5_MT_LIBS=@HDF5_MT_LIBS@ HDF5_MT_LIBS=@HDF5_MT_LIBS@
# MED2
MED2_INCLUDES=@MED2_INCLUDES@
MED2_LIBS=@MED2_LIBS@
MED2_MT_LIBS=@MED2_MT_LIBS@
# OpenCasCade # OpenCasCade
OCC_INCLUDES=@CAS_CPPFLAGS@ OCC_INCLUDES=@CAS_CPPFLAGS@
@ -251,8 +245,8 @@ ac_cxx_mutable.m4 check_mico.m4 libtool.m4 \
ac_cxx_namespaces.m4 check_omniorb.m4 pyembed.m4 \ 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_boost.m4 \
check_swig.m4 check_boost.m4 check_swig.m4
$(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

@ -233,14 +233,6 @@ echo
CHECK_HDF5 CHECK_HDF5
echo
echo ---------------------------------------------
echo testing MED2
echo ---------------------------------------------
echo
CHECK_MED2
echo echo
echo --------------------------------------------- echo ---------------------------------------------
echo Testing OpenCascade echo Testing OpenCascade
@ -288,7 +280,7 @@ echo ---------------------------------------------
echo echo
echo Configure echo Configure
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" variables="cc_ok boost_ok lex_yacc_ok python_ok swig_ok threads_ok OpenGL_ok qt_ok vtk_ok hdf5_ok omniORB_ok occ_ok doxygen_ok graphviz_ok Kernel_ok Geom_ok Med_ok"
for var in $variables for var in $variables
do do

View File

@ -16,13 +16,28 @@ doxygen=@DOXYGEN@
@COMMENCE@ @COMMENCE@
PYTHON_SCRIPTS = \
meshpy.py
docs: docs:
cp -fr $(srcdir)/SMESH ./INPUT; \ cp -fr $(srcdir)/SMESH ./INPUT; \
cd INPUT; \ cd INPUT; \
sed 's|../../../share/salome|$(root_srcdir)|' ./doxyfile > ./doxyfile1; \ sed 's|../../../share/salome|$(root_srcdir)|' ./doxyfile > ./doxyfile1; \
mv -f doxyfile1 doxyfile; \ mv -f doxyfile1 doxyfile; \
$(doxygen) ./doxyfile; \ $(doxygen) ./doxyfile; \
cd ..; \ mkdir py1; mkdir py2; \
cd ..
for file in $(PYTHON_SCRIPTS) dummy; do \
if [ $$file != "dummy" ]; then \
cp $(root_srcdir)/src/SMESH_SWIG/$$file INPUT/py1/; \
fi ; \
done
cd INPUT; \
python $(KERNEL_ROOT_DIR)/doc/salome/tui/KERNEL/pythfilter.py ./py1 ./py2; \
sed 's|list_py_files_to_process|$(PYTHON_SCRIPTS)|' ./doxyfile_py > py2/doxyfile_py; \
cd py2; \
$(doxygen) ./doxyfile_py; \
cd ../..; \
cp -fr $(srcdir)/SMESH/sources/static/*.* ./SMESH/ cp -fr $(srcdir)/SMESH/sources/static/*.* ./SMESH/
cp -fr $(srcdir)/SMESH/sources/ SMESH/ cp -fr $(srcdir)/SMESH/sources/ SMESH/
cp -fr $(srcdir)/SMESH/HTML/ SMESH/ cp -fr $(srcdir)/SMESH/HTML/ SMESH/

200
doc/salome/tui/SMESH/doxyfile_py Executable file
View File

@ -0,0 +1,200 @@
# Doxyfile 1.3-rc1
#---------------------------------------------------------------------------
# General configuration options
#---------------------------------------------------------------------------
PROJECT_NAME = "SALOME - SMESH - v.2.1.0"
PROJECT_NUMBER = id#1.1
OUTPUT_DIRECTORY = ../
OUTPUT_LANGUAGE = English
EXTRACT_ALL = YES
EXTRACT_PRIVATE = YES
EXTRACT_STATIC = YES
EXTRACT_LOCAL_CLASSES = YES
HIDE_UNDOC_MEMBERS = NO
HIDE_UNDOC_CLASSES = NO
HIDE_FRIEND_COMPOUNDS = NO
HIDE_IN_BODY_DOCS = NO
BRIEF_MEMBER_DESC = YES
REPEAT_BRIEF = NO
ALWAYS_DETAILED_SEC = YES
INLINE_INHERITED_MEMB = YES
FULL_PATH_NAMES = NO
STRIP_FROM_PATH =
INTERNAL_DOCS = YES
CASE_SENSE_NAMES = YES
SHORT_NAMES = NO
HIDE_SCOPE_NAMES = NO
VERBATIM_HEADERS = YES
SHOW_INCLUDE_FILES = YES
JAVADOC_AUTOBRIEF = YES
MULTILINE_CPP_IS_BRIEF = NO
DETAILS_AT_TOP = NO
INHERIT_DOCS = YES
INLINE_INFO = YES
SORT_MEMBER_DOCS = NO
DISTRIBUTE_GROUP_DOC = NO
TAB_SIZE = 5
GENERATE_TODOLIST = YES
GENERATE_TESTLIST = YES
GENERATE_BUGLIST = YES
GENERATE_DEPRECATEDLIST= YES
ALIASES =
ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 25
OPTIMIZE_OUTPUT_FOR_C = YES
OPTIMIZE_OUTPUT_JAVA = YES
SHOW_USED_FILES = NO
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------
QUIET = NO
WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES
WARN_FORMAT = "$file:$line: $text"
WARN_LOGFILE = log.txt
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = list_py_files_to_process
FILE_PATTERNS =
RECURSIVE = NO
EXCLUDE =
EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS =
EXAMPLE_PATH =
EXAMPLE_PATTERNS =
EXAMPLE_RECURSIVE = NO
IMAGE_PATH = ../sources/
INPUT_FILTER =
FILTER_SOURCE_FILES = YES
#---------------------------------------------------------------------------
# configuration options related to source browsing
#---------------------------------------------------------------------------
SOURCE_BROWSER = NO
INLINE_SOURCES = NO
STRIP_CODE_COMMENTS = YES
REFERENCED_BY_RELATION = NO
REFERENCES_RELATION = YES
#---------------------------------------------------------------------------
# configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
ALPHABETICAL_INDEX = NO
COLS_IN_ALPHA_INDEX = 5
IGNORE_PREFIX =
#---------------------------------------------------------------------------
# configuration options related to the HTML output
#---------------------------------------------------------------------------
GENERATE_HTML = YES
HTML_OUTPUT = ../SMESH/meshpy_doc
HTML_FILE_EXTENSION = .html
HTML_HEADER = ../sources/myheader_py2.html
HTML_FOOTER =
HTML_STYLESHEET =
HTML_ALIGN_MEMBERS = YES
GENERATE_HTMLHELP = NO
CHM_FILE =
HHC_LOCATION =
GENERATE_CHI = NO
BINARY_TOC = YES
TOC_EXPAND = YES
DISABLE_INDEX = YES
ENUM_VALUES_PER_LINE = 4
GENERATE_TREEVIEW = YES
TREEVIEW_WIDTH = 250
#---------------------------------------------------------------------------
# configuration options related to the LaTeX output
#---------------------------------------------------------------------------
GENERATE_LATEX = NO
LATEX_OUTPUT = latex
LATEX_CMD_NAME = latex
MAKEINDEX_CMD_NAME = makeindex
COMPACT_LATEX = NO
PAPER_TYPE = a4wide
EXTRA_PACKAGES =
LATEX_HEADER =
PDF_HYPERLINKS = NO
USE_PDFLATEX = NO
LATEX_BATCHMODE = NO
#---------------------------------------------------------------------------
# configuration options related to the RTF output
#---------------------------------------------------------------------------
GENERATE_RTF = NO
RTF_OUTPUT = rtf
COMPACT_RTF = NO
RTF_HYPERLINKS = NO
RTF_STYLESHEET_FILE =
RTF_EXTENSIONS_FILE =
#---------------------------------------------------------------------------
# configuration options related to the man page output
#---------------------------------------------------------------------------
GENERATE_MAN = NO
MAN_OUTPUT = man
MAN_EXTENSION = .3
MAN_LINKS = NO
#---------------------------------------------------------------------------
# configuration options related to the XML output
#---------------------------------------------------------------------------
GENERATE_XML = NO
XML_SCHEMA =
XML_DTD =
#---------------------------------------------------------------------------
# configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
GENERATE_AUTOGEN_DEF = NO
#---------------------------------------------------------------------------
# configuration options related to the Perl module output
#---------------------------------------------------------------------------
GENERATE_PERLMOD = NO
PERLMOD_LATEX = NO
PERLMOD_PRETTY = YES
PERLMOD_MAKEVAR_PREFIX =
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = YES
EXPAND_ONLY_PREDEF = NO
SEARCH_INCLUDES = YES
INCLUDE_PATH =
INCLUDE_FILE_PATTERNS =
PREDEFINED =
EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = NO
#---------------------------------------------------------------------------
# Configuration::addtions related to external references
#---------------------------------------------------------------------------
TAGFILES =
GENERATE_TAGFILE =
ALLEXTERNALS = NO
EXTERNAL_GROUPS = YES
PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
CLASS_DIAGRAMS = YES
HIDE_UNDOC_RELATIONS = NO
HAVE_DOT = YES
CLASS_GRAPH = YES
COLLABORATION_GRAPH = NO
TEMPLATE_RELATIONS = YES
INCLUDE_GRAPH = YES
INCLUDED_BY_GRAPH = NO
GRAPHICAL_HIERARCHY = YES
DOT_IMAGE_FORMAT = jpg
DOT_PATH =
DOTFILE_DIRS =
MAX_DOT_GRAPH_WIDTH = 1024
MAX_DOT_GRAPH_HEIGHT = 1200
GENERATE_LEGEND = NO
DOT_CLEANUP = YES
#---------------------------------------------------------------------------
# Configuration::addtions related to the search engine
#---------------------------------------------------------------------------
SEARCHENGINE = NO
CGI_NAME = search.cgi
CGI_URL =
DOC_URL =
DOC_ABSPATH =
BIN_ABSPATH = /usr/local/bin/
EXT_DOC_PATHS =

View File

@ -0,0 +1,24 @@
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="Mozilla/4.73 [en] (WinNT; I) [Netscape]">
<title>Main Page</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head>
<body>
&nbsp;
<center><table WIDTH="96%" >
<tr>
<td><a href="http://www.opencascade.com"><img src="../sources/logocorp.gif" BORDER=0 height=46 width=122></a></td>
<td>
<div align=right><a href="http://www.opencascade.org/SALOME/"><img src="../sources/application.gif" BORDER=0 height=46 width=108></a></div>
</td>
</tr>
</table></center>
</body>
</html>

View File

@ -18,5 +18,12 @@ aux1 = insFld(foldersTree, gFld("TUI Reference Guide", ""))
aux1 = insFld(foldersTree, gFld("IDL/Python mapping", "")) aux1 = insFld(foldersTree, gFld("IDL/Python mapping", ""))
insDoc(aux1, gLnk("Mapping of SMESH IDL definitions to Python language", "", "page2.html")) insDoc(aux1, gLnk("Mapping of SMESH IDL definitions to Python language", "", "page2.html"))
aux1 = insFld(foldersTree, gFld("Python Commands", "", "meshpy_doc/main.html"))
insDoc(aux1, gLnk("Package List", "", "meshpy_doc/namespaces.html"))
insDoc(aux1, gLnk("Data Structures", "", "meshpy_doc/annotated.html"))
insDoc(aux1, gLnk("Namespace Members", "", "meshpy_doc/namespacemembers.html"))
insDoc(aux1, gLnk("File List", "", "meshpy_doc/files.html"))
aux1 = insFld(foldersTree, gFld("Adding meshers in SMESH", "")) aux1 = insFld(foldersTree, gFld("Adding meshers in SMESH", ""))
insDoc(aux1, gLnk("Using Plugin mechanism in SMESH", "", "PluginMeshers.html")) insDoc(aux1, gLnk("Using Plugin mechanism in SMESH", "", "PluginMeshers.html"))

View File

@ -45,6 +45,7 @@ module SMESH
enum FunctorType enum FunctorType
{ {
FT_AspectRatio, FT_AspectRatio,
FT_AspectRatio3D,
FT_Warping, FT_Warping,
FT_MinimumAngle, FT_MinimumAngle,
FT_Taper, FT_Taper,
@ -53,10 +54,13 @@ module SMESH
FT_FreeBorders, FT_FreeBorders,
FT_FreeEdges, FT_FreeEdges,
FT_MultiConnection, FT_MultiConnection,
FT_MultiConnection2D,
FT_Length, FT_Length,
FT_Length2D,
FT_BelongToGeom, FT_BelongToGeom,
FT_BelongToPlane, FT_BelongToPlane,
FT_BelongToCylinder, FT_BelongToCylinder,
FT_LyingOnGeom,
FT_RangeOfIds, FT_RangeOfIds,
FT_LessThan, FT_LessThan,
FT_MoreThan, FT_MoreThan,
@ -95,12 +99,34 @@ module SMESH
}; };
interface MinimumAngle : NumericalFunctor{}; interface MinimumAngle : NumericalFunctor{};
interface AspectRatio : NumericalFunctor{}; interface AspectRatio : NumericalFunctor{};
interface AspectRatio3D : NumericalFunctor{};
interface Warping : NumericalFunctor{}; interface Warping : NumericalFunctor{};
interface Taper : NumericalFunctor{}; interface Taper : NumericalFunctor{};
interface Skew : NumericalFunctor{}; interface Skew : NumericalFunctor{};
interface Area : NumericalFunctor{}; interface Area : NumericalFunctor{};
interface Length : NumericalFunctor{}; interface Length : NumericalFunctor{};
interface Length2D : NumericalFunctor
{
struct Value
{
double myLength;
long myPnt1, myPnt2;
};
typedef sequence<Value> Values;
Values GetValues();
};
interface MultiConnection : NumericalFunctor{}; interface MultiConnection : NumericalFunctor{};
interface MultiConnection2D : NumericalFunctor
{
struct Value
{
long myNbConnects;
long myPnt1, myPnt2;
};
typedef sequence<Value> Values;
Values GetValues();
};
/*! /*!
* Predicates are intended for verification of criteria, * Predicates are intended for verification of criteria,
@ -155,6 +181,19 @@ module SMESH
void SetCylinder( in GEOM::GEOM_Object theGeom, in ElementType theType ); void SetCylinder( in GEOM::GEOM_Object theGeom, in ElementType theType );
}; };
/*!
* Logical functor (predicate) "Lying On Geometry".
* Verify whether mesh element or node lying or partially lying on the pointed Geom Object
*/
interface LyingOnGeom: Predicate
{
void SetGeom( in GEOM::GEOM_Object theGeom );
void SetElementType( in ElementType theType );
void SetShapeName( in string theName );
string GetShapeName();
};
/*! /*!
* Logical functor (predicate) "Free borders". * Logical functor (predicate) "Free borders".
* Verify whether 1D mesh element is free ( i.e. connected to one face only ) * Verify whether 1D mesh element is free ( i.e. connected to one face only )
@ -320,12 +359,15 @@ module SMESH
*/ */
MinimumAngle CreateMinimumAngle(); MinimumAngle CreateMinimumAngle();
AspectRatio CreateAspectRatio(); AspectRatio CreateAspectRatio();
AspectRatio3D CreateAspectRatio3D();
Warping CreateWarping(); Warping CreateWarping();
Taper CreateTaper(); Taper CreateTaper();
Skew CreateSkew(); Skew CreateSkew();
Area CreateArea(); Area CreateArea();
Length CreateLength(); Length CreateLength();
Length2D CreateLength2D();
MultiConnection CreateMultiConnection(); MultiConnection CreateMultiConnection();
MultiConnection2D CreateMultiConnection2D();
/*! /*!
* Create logical functors ( predicates ) * Create logical functors ( predicates )
@ -334,6 +376,8 @@ module SMESH
BelongToPlane CreateBelongToPlane(); BelongToPlane CreateBelongToPlane();
BelongToCylinder CreateBelongToCylinder(); BelongToCylinder CreateBelongToCylinder();
LyingOnGeom CreateLyingOnGeom();
FreeBorders CreateFreeBorders(); FreeBorders CreateFreeBorders();
FreeEdges CreateFreeEdges(); FreeEdges CreateFreeEdges();

View File

@ -132,6 +132,15 @@ module SMESH
DRS_FAIL // general failure (exception etc.) DRS_FAIL // general failure (exception etc.)
}; };
/*!
* Enumeration for DriverMED (used by Perform() method)
*/
enum MED_VERSION // in the order of severity
{
MED_V2_1,
MED_V2_2
};
typedef sequence<log_block> log_array; typedef sequence<log_block> log_array;
@ -315,12 +324,18 @@ module SMESH
raises (SALOME::SALOME_Exception); raises (SALOME::SALOME_Exception);
/*! /*!
* Export Mesh with DAT and MED Formats * Export Mesh to MED Formats
*/ */
void ExportDAT( in string file ) void ExportToMED( in string file, in boolean auto_groups, in MED_VERSION theVersion )
raises (SALOME::SALOME_Exception); raises (SALOME::SALOME_Exception);
void ExportMED( in string file, in boolean auto_groups ) void ExportMED( in string file, in boolean auto_groups )
raises (SALOME::SALOME_Exception); raises (SALOME::SALOME_Exception);
/*!
* Export Mesh to DAT, UNV and STL Formats
*/
void ExportDAT( in string file )
raises (SALOME::SALOME_Exception);
void ExportUNV( in string file ) void ExportUNV( in string file )
raises (SALOME::SALOME_Exception); raises (SALOME::SALOME_Exception);
void ExportSTL( in string file, in boolean isascii ) void ExportSTL( in string file, in boolean isascii )
@ -335,6 +350,9 @@ module SMESH
long NbNodes() long NbNodes()
raises (SALOME::SALOME_Exception); raises (SALOME::SALOME_Exception);
long NbElements()
raises (SALOME::SALOME_Exception);
long NbEdges() long NbEdges()
raises (SALOME::SALOME_Exception); raises (SALOME::SALOME_Exception);
@ -365,6 +383,15 @@ module SMESH
long NbSubMesh() long NbSubMesh()
raises (SALOME::SALOME_Exception); raises (SALOME::SALOME_Exception);
long_array GetElementsId()
raises (SALOME::SALOME_Exception);
long_array GetElementsByType( in ElementType theType )
raises (SALOME::SALOME_Exception);
long_array GetNodesId()
raises (SALOME::SALOME_Exception);
string Dump(); string Dump();
}; };
@ -508,6 +535,24 @@ module SMESH
in DirStruct StepVector, in DirStruct StepVector,
in long NbOfSteps); in long NbOfSteps);
void ExtrusionAlongPath(in long_array IDsOfElements,
in SMESH_Mesh PathMesh,
in GEOM::GEOM_Object PathShape,
in long NodeStart,
in boolean HasAngles,
in double_array Angles,
in boolean HasRefPoint,
in PointStruct RefPoint);
void ExtrusionAlongPathObject(in SMESH_IDSource theObject,
in SMESH_Mesh PathMesh,
in GEOM::GEOM_Object PathShape,
in long NodeStart,
in boolean HasAngles,
in double_array Angles,
in boolean HasRefPoint,
in PointStruct RefPoint);
enum MirrorType { POINT, AXIS, PLANE }; enum MirrorType { POINT, AXIS, PLANE };
void Mirror (in long_array IDsOfElements, void Mirror (in long_array IDsOfElements,

View File

@ -79,6 +79,28 @@ module SMESH
in GEOM::GEOM_Object theVertex000, in GEOM::GEOM_Object theVertex000,
in GEOM::GEOM_Object theVertex001); in GEOM::GEOM_Object theVertex001);
/*!
* Compute nodes coordinates applying
* the loaded pattern to mesh faces. The first key-point
* will be mapped into <theNodeIndexOnKeyPoint1>-th node of each face
*/
point_array ApplyToMeshFaces(in SMESH_Mesh theMesh,
in long_array theFacesIDs,
in long theNodeIndexOnKeyPoint1,
in boolean theReverse);
/*!
* Compute nodes coordinates applying
* the loaded pattern to hexahedrons. The (0,0,0) key-point
* will be mapped into <theNode000Index>-th node of each volume.
* The (0,0,1) key-point will be mapped into <theNode001Index>-th
* node of each volume.
*/
point_array ApplyToHexahedrons(in SMESH_Mesh theMesh,
in long_array theVolumesIDs,
in long theNode000Index,
in long theNode001Index);
/*! /*!
* Create nodes and elements in <theMesh> using nodes * Create nodes and elements in <theMesh> using nodes
* coordinates computed by either of Apply...() methods * coordinates computed by either of Apply...() methods

View File

@ -73,16 +73,21 @@
<!-- ************************** 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="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="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="Free Edges" 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="6003" pos-id="" label-id="Free borders" icon-id="mesh_free_edges.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <separator pos-id=""/>
<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="Free Edges" icon-id="mesh_free_edges_2d.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="6018" pos-id="" label-id="Length 2D" icon-id="mesh_length_2d.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="6019" pos-id="" label-id="Borders at Multi-Connection 2D" icon-id="mesh_multi_edges_2d.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="Warping" icon-id="mesh_wrap.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <popup-item item-id="6015" pos-id="" label-id="Warping" 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=""/>
<separator pos-id=""/>
<popup-item item-id="6017" pos-id="" label-id="Aspect Ratio 3D" icon-id="mesh_aspect_3d.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</menu-item> </menu-item>
<!-- ************************** Entity (menubar) ************************************ --> <!-- ************************** Entity (menubar) ************************************ -->
@ -122,6 +127,7 @@
<popup-item item-id="411" pos-id="" label-id="Cutting of quadrangles" icon-id="mesh_cutquad.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <popup-item item-id="411" pos-id="" label-id="Cutting of quadrangles" icon-id="mesh_cutquad.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="412" pos-id="" label-id="Smoothing" icon-id="mesh_smoothing.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <popup-item item-id="412" pos-id="" label-id="Smoothing" icon-id="mesh_smoothing.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="413" pos-id="" label-id="Extrusion" icon-id="mesh_extrusion.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <popup-item item-id="413" pos-id="" label-id="Extrusion" icon-id="mesh_extrusion.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="416" pos-id="" label-id="Extrusion along a path" icon-id="mesh_extrusionpath.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="414" pos-id="" label-id="Revolution" icon-id="mesh_revolution.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <popup-item item-id="414" pos-id="" label-id="Revolution" icon-id="mesh_revolution.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="415" pos-id="" label-id="Pattern mapping" icon-id="mesh_pattern.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <popup-item item-id="415" pos-id="" label-id="Pattern mapping" icon-id="mesh_pattern.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</menu-item> </menu-item>
@ -145,7 +151,11 @@
<separator pos-id=""/> <separator pos-id=""/>
<popup-item item-id="1006" pos-id="" label-id="Selection" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <popup-item item-id="1006" pos-id="" label-id="Selection" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/> <separator pos-id=""/>
<popup-item item-id="1007" pos-id="" label-id="Quality controls" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <submenu label-id="Quality controls" item-id="1007" pos-id="">
<popup-item item-id="10070" pos-id="" label-id="Precision" icon-id="" tooltip-id="" accel-id="" toggle-id="false" execute-action=""/>
<popup-item item-id="10071" pos-id="" label-id="Display Entity" icon-id="" tooltip-id="" accel-id="" toggle-id="true" execute-action=""/>
</submenu>
<endsubmenu />
</submenu> </submenu>
<endsubmenu /> <endsubmenu />
<separator pos-id="-1"/> <separator pos-id="-1"/>
@ -230,23 +240,36 @@
<popup-item item-id="213" pos-id="" label-id="Shrink" icon-id="mesh_shrink.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> </submenu>
<endsubmenu /> <endsubmenu />
<submenu label-id="Display Entity" item-id="1135" pos-id="">
<popup-item item-id="217" pos-id="" label-id="Edges" icon-id="mesh_line.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="218" pos-id="" label-id="Faces" icon-id="mesh_triangle.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="219" pos-id="" label-id="Volumes" icon-id="mesh_tetra.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/>
<popup-item item-id="220" pos-id="" label-id="All" icon-id="" 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="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=""/> <popup-item item-id="1133" pos-id="" label-id="Transparency" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="1134" pos-id="" label-id="Clipping" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <popup-item item-id="1134" pos-id="" label-id="Clipping" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/> <separator pos-id=""/>
<submenu label-id="Control" item-id="2000" pos-id=""> <submenu label-id="Control" item-id="2000" 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="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="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="Free Edges" 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="6003" pos-id="" label-id="Free borders" icon-id="mesh_free_edges.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <separator pos-id=""/>
<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="Free Edges" icon-id="mesh_free_edges_2d.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="6018" pos-id="" label-id="Length 2D" icon-id="mesh_length_2d.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="6019" pos-id="" label-id="Borders at Multi-Connection 2D" icon-id="mesh_multi_edges_2d.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="Warping" icon-id="mesh_wrap.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <popup-item item-id="6015" pos-id="" label-id="Warping" 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=""/>
<separator pos-id=""/> <separator pos-id=""/>
<popup-item item-id="200" pos-id="" label-id="Reset" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <popup-item item-id="6017" pos-id="" label-id="Aspect Ratio 3D" icon-id="mesh_aspect_3d.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/> <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=""/> <popup-item item-id="201" pos-id="" label-id="Scalar Bar Properties" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</submenu> </submenu>
@ -272,23 +295,36 @@
<popup-item item-id="213" pos-id="" label-id="Shrink" icon-id="mesh_shrink.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> </submenu>
<endsubmenu /> <endsubmenu />
<submenu label-id="Display Entity" item-id="1135" pos-id="">
<popup-item item-id="217" pos-id="" label-id="Edges" icon-id="mesh_line.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="218" pos-id="" label-id="Faces" icon-id="mesh_triangle.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="219" pos-id="" label-id="Volumes" icon-id="mesh_tetra.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/>
<popup-item item-id="220" pos-id="" label-id="All" icon-id="" 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="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=""/> <popup-item item-id="1133" pos-id="" label-id="Transparency" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="1134" pos-id="" label-id="Clipping" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <popup-item item-id="1134" pos-id="" label-id="Clipping" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/> <separator pos-id=""/>
<submenu label-id="Control" item-id="2000" pos-id=""> <submenu label-id="Control" item-id="2000" 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="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="Free Edges" icon-id="mesh_free_edges.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="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="6004" pos-id="" label-id="Borders at multi-connection" icon-id="mesh_multi_edges.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <separator pos-id=""/>
<popup-item item-id="6002" pos-id="" label-id="Free Edges" icon-id="mesh_free_edges_2d.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="6018" pos-id="" label-id="Length 2D" icon-id="mesh_length_2d.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="6019" pos-id="" label-id="Borders at Multi-Connection 2D" icon-id="mesh_multi_edges_2d.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="Warping" icon-id="mesh_wrap.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <popup-item item-id="6015" pos-id="" label-id="Warping" 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=""/>
<separator pos-id=""/> <separator pos-id=""/>
<popup-item item-id="200" pos-id="" label-id="Reset" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <popup-item item-id="6017" pos-id="" label-id="Aspect Ratio 3D" icon-id="mesh_aspect_3d.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/> <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=""/> <popup-item item-id="201" pos-id="" label-id="Scalar Bar Properties" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</submenu> </submenu>
@ -316,23 +352,36 @@
<popup-item item-id="213" pos-id="" label-id="Shrink" icon-id="mesh_shrink.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> </submenu>
<endsubmenu /> <endsubmenu />
<submenu label-id="Display Entity" item-id="1135" pos-id="">
<popup-item item-id="217" pos-id="" label-id="Edges" icon-id="mesh_line.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="218" pos-id="" label-id="Faces" icon-id="mesh_triangle.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="219" pos-id="" label-id="Volumes" icon-id="mesh_tetra.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/>
<popup-item item-id="220" pos-id="" label-id="All" icon-id="" 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="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=""/> <popup-item item-id="1133" pos-id="" label-id="Transparency" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="1134" pos-id="" label-id="Clipping" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <popup-item item-id="1134" pos-id="" label-id="Clipping" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/> <separator pos-id=""/>
<submenu label-id="Control" item-id="2000" pos-id=""> <submenu label-id="Control" item-id="2000" 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="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="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="Free Edges" 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="6003" pos-id="" label-id="Free borders" icon-id="mesh_free_edges.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <separator pos-id=""/>
<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="Free Edges" icon-id="mesh_free_edges_2d.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="6018" pos-id="" label-id="Length 2D" icon-id="mesh_length_2d.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="6019" pos-id="" label-id="Borders at Multi-Connection 2D" icon-id="mesh_multi_edges_2d.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="Warping" icon-id="mesh_wrap.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <popup-item item-id="6015" pos-id="" label-id="Warping" 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=""/>
<separator pos-id=""/> <separator pos-id=""/>
<popup-item item-id="200" pos-id="" label-id="Reset" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/> <popup-item item-id="6017" pos-id="" label-id="Aspect Ratio 3D" icon-id="mesh_aspect_3d.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/> <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=""/> <popup-item item-id="201" pos-id="" label-id="Scalar Bar Properties" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</submenu> </submenu>
@ -370,15 +419,20 @@
<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="Free Edges" icon-id="mesh_free_edges.png" tooltip-id="Free edges" 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="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="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=""/> <separatorTB/>
<toolbutton-item item-id="6002" label-id="Free Edges" icon-id="mesh_free_edges_2d.png" tooltip-id="Free edges" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="6018" label-id="Length 2D" icon-id="mesh_length_2d.png" tooltip-id="Length2D" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="6019" label-id="Borders at Multi-Connection 2D" icon-id="mesh_multi_edges_2d.png" tooltip-id="Multiconnection 2D" 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=""/>
<toolbutton-item item-id="6014" label-id="Minimum angle" icon-id="mesh_angle.png" tooltip-id="Minimum angle" accel-id="" toggle-id="" execute-action=""/> <toolbutton-item item-id="6014" label-id="Minimum Angle" icon-id="mesh_angle.png" tooltip-id="Minimum angle" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="6015" label-id="Warping" icon-id="mesh_wrap.png" tooltip-id="Warping angle" accel-id="" toggle-id="" execute-action=""/> <toolbutton-item item-id="6015" label-id="Warping" icon-id="mesh_wrap.png" tooltip-id="Warping angle" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="6016" label-id="Skew" icon-id="mesh_skew.png" tooltip-id="Skew" accel-id="" toggle-id="" execute-action=""/> <toolbutton-item item-id="6016" label-id="Skew" icon-id="mesh_skew.png" tooltip-id="Skew" accel-id="" toggle-id="" execute-action=""/>
<separatorTB/>
<toolbutton-item item-id="6017" label-id="Aspect Ratio 3D" icon-id="mesh_aspect_3d.png" tooltip-id="Aspect Ratio 3D" accel-id="" toggle-id="" execute-action=""/>
</toolbar> </toolbar>
<toolbar label-id="Add/Remove toolbar"> <toolbar label-id="Add/Remove toolbar">
@ -411,6 +465,7 @@
<toolbutton-item item-id="411" label-id="Cutting of quadrangles" icon-id="mesh_cutquad.png" tooltip-id="Cutting of quadrangles" accel-id="" toggle-id="" execute-action=""/> <toolbutton-item item-id="411" label-id="Cutting of quadrangles" icon-id="mesh_cutquad.png" tooltip-id="Cutting of quadrangles" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="412" label-id="Smoothing" icon-id="mesh_smoothing.png" tooltip-id="Smoothing" accel-id="" toggle-id="" execute-action=""/> <toolbutton-item item-id="412" label-id="Smoothing" icon-id="mesh_smoothing.png" tooltip-id="Smoothing" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="413" label-id="Extrusion" icon-id="mesh_extrusion.png" tooltip-id="Extrusion along a line" accel-id="" toggle-id="" execute-action=""/> <toolbutton-item item-id="413" label-id="Extrusion" icon-id="mesh_extrusion.png" tooltip-id="Extrusion along a line" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="416" label-id="Extrusion along a path" icon-id="mesh_extrusionpath.png" tooltip-id="Extrusion along a path" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="414" label-id="Revolution" icon-id="mesh_revolution.png" tooltip-id="Revolution around an axis" accel-id="" toggle-id="" execute-action=""/> <toolbutton-item item-id="414" label-id="Revolution" icon-id="mesh_revolution.png" tooltip-id="Revolution around an axis" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="415" label-id="Pattern mapping" icon-id="mesh_pattern.png" tooltip-id="2D and 3D pattern mapping" accel-id="" toggle-id="" execute-action=""/> <toolbutton-item item-id="415" label-id="Pattern mapping" icon-id="mesh_pattern.png" tooltip-id="2D and 3D pattern mapping" accel-id="" toggle-id="" execute-action=""/>
</toolbar> </toolbar>

BIN
resources/mesh_add.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 459 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 482 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 389 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 501 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 461 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 508 B

BIN
resources/mesh_remove.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 386 B

View File

@ -31,7 +31,7 @@ VPATH=.:@srcdir@:@top_srcdir@/idl:$(top_builddir)/idl
@COMMENCE@ @COMMENCE@
EXPORT_HEADERS = SMESH_Controls.hxx EXPORT_HEADERS = SMESH_Controls.hxx SMESH_ControlsDef.hxx
# Libraries targets # Libraries targets

View File

@ -17,7 +17,7 @@
// //
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
#include "SMESH_Controls.hxx" #include "SMESH_ControlsDef.hxx"
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
@ -29,7 +29,9 @@ int main(int argc, char** argv)
new Skew(); new Skew();
new Area(); new Area();
new Length(); new Length();
// new Length2D();
new MultiConnection(); new MultiConnection();
// new MultiConnection2D();
new FreeBorders(); new FreeBorders();
new LessThan(); new LessThan();
new MoreThan(); new MoreThan();

View File

@ -17,7 +17,7 @@
// //
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
#include "SMESH_Controls.hxx" #include "SMESH_ControlsDef.hxx"
#include <set> #include <set>
@ -33,7 +33,6 @@
#include <Geom_CylindricalSurface.hxx> #include <Geom_CylindricalSurface.hxx>
#include <Precision.hxx> #include <Precision.hxx>
#include <TColgp_Array1OfXYZ.hxx> #include <TColgp_Array1OfXYZ.hxx>
#include <TColgp_SequenceOfXYZ.hxx>
#include <TColStd_MapOfInteger.hxx> #include <TColStd_MapOfInteger.hxx>
#include <TColStd_SequenceOfAsciiString.hxx> #include <TColStd_SequenceOfAsciiString.hxx>
#include <TColStd_MapIteratorOfMapOfInteger.hxx> #include <TColStd_MapIteratorOfMapOfInteger.hxx>
@ -48,39 +47,41 @@
#include "SMDS_MeshNode.hxx" #include "SMDS_MeshNode.hxx"
/* /*
AUXILIARY METHODS AUXILIARY METHODS
*/ */
static inline double getAngle( const gp_XYZ& P1, const gp_XYZ& P2, const gp_XYZ& P3 ) namespace{
{ inline double getAngle( const gp_XYZ& P1, const gp_XYZ& P2, const gp_XYZ& P3 )
{
gp_Vec v1( P1 - P2 ), v2( P3 - P2 ); gp_Vec v1( P1 - P2 ), v2( P3 - P2 );
return v1.Magnitude() < gp::Resolution() || return v1.Magnitude() < gp::Resolution() ||
v2.Magnitude() < gp::Resolution() ? 0 : v1.Angle( v2 ); v2.Magnitude() < gp::Resolution() ? 0 : v1.Angle( v2 );
} }
static inline double getArea( const gp_XYZ& P1, const gp_XYZ& P2, const gp_XYZ& P3 ) inline double getArea( const gp_XYZ& P1, const gp_XYZ& P2, const gp_XYZ& P3 )
{ {
gp_Vec aVec1( P2 - P1 ); gp_Vec aVec1( P2 - P1 );
gp_Vec aVec2( P3 - P1 ); gp_Vec aVec2( P3 - P1 );
return ( aVec1 ^ aVec2 ).Magnitude() * 0.5; return ( aVec1 ^ aVec2 ).Magnitude() * 0.5;
} }
static inline double getArea( const gp_Pnt& P1, const gp_Pnt& P2, const gp_Pnt& P3 ) inline double getArea( const gp_Pnt& P1, const gp_Pnt& P2, const gp_Pnt& P3 )
{ {
return getArea( P1.XYZ(), P2.XYZ(), P3.XYZ() ); return getArea( P1.XYZ(), P2.XYZ(), P3.XYZ() );
} }
static inline double getDistance( const gp_XYZ& P1, const gp_XYZ& P2 )
{
inline double getDistance( const gp_XYZ& P1, const gp_XYZ& P2 )
{
double aDist = gp_Pnt( P1 ).Distance( gp_Pnt( P2 ) ); double aDist = gp_Pnt( P1 ).Distance( gp_Pnt( P2 ) );
return aDist; return aDist;
} }
static int getNbMultiConnection( SMDS_Mesh* theMesh, const int theId ) int getNbMultiConnection( SMDS_Mesh* theMesh, const int theId )
{ {
if ( theMesh == 0 ) if ( theMesh == 0 )
return 0; return 0;
@ -92,19 +93,15 @@ static int getNbMultiConnection( SMDS_Mesh* theMesh, const int theId )
int aResult = 0; int aResult = 0;
SMDS_ElemIteratorPtr anIter = anEdge->nodesIterator(); SMDS_ElemIteratorPtr anIter = anEdge->nodesIterator();
if ( anIter != 0 ) if ( anIter != 0 ) {
{ while( anIter->more() ) {
while( anIter->more() )
{
const SMDS_MeshNode* aNode = (SMDS_MeshNode*)anIter->next(); const SMDS_MeshNode* aNode = (SMDS_MeshNode*)anIter->next();
if ( aNode == 0 ) if ( aNode == 0 )
return 0; return 0;
SMDS_ElemIteratorPtr anElemIter = aNode->GetInverseElementIterator(); SMDS_ElemIteratorPtr anElemIter = aNode->GetInverseElementIterator();
while( anElemIter->more() ) while( anElemIter->more() ) {
{
const SMDS_MeshElement* anElem = anElemIter->next(); const SMDS_MeshElement* anElem = anElemIter->next();
if ( anElem != 0 && anElem->GetType() != SMDSAbs_Edge ) if ( anElem != 0 && anElem->GetType() != SMDSAbs_Edge ) {
{
int anId = anElem->GetID(); int anId = anElem->GetID();
if ( anIter->more() ) // i.e. first node if ( anIter->more() ) // i.e. first node
@ -117,9 +114,12 @@ static int getNbMultiConnection( SMDS_Mesh* theMesh, const int theId )
} }
return aResult; return aResult;
}
} }
using namespace SMESH::Controls; using namespace SMESH::Controls;
/* /*
@ -142,9 +142,9 @@ void NumericalFunctor::SetMesh( SMDS_Mesh* theMesh )
} }
bool NumericalFunctor::GetPoints(const int theId, bool NumericalFunctor::GetPoints(const int theId,
TColgp_SequenceOfXYZ& theRes ) const TSequenceOfXYZ& theRes ) const
{ {
theRes.Clear(); theRes.clear();
if ( myMesh == 0 ) if ( myMesh == 0 )
return false; return false;
@ -153,9 +153,9 @@ bool NumericalFunctor::GetPoints(const int theId,
} }
bool NumericalFunctor::GetPoints(const SMDS_MeshElement* anElem, bool NumericalFunctor::GetPoints(const SMDS_MeshElement* anElem,
TColgp_SequenceOfXYZ& theRes ) TSequenceOfXYZ& theRes )
{ {
theRes.Clear(); theRes.clear();
if ( anElem == 0) if ( anElem == 0)
return false; return false;
@ -167,8 +167,9 @@ bool NumericalFunctor::GetPoints(const SMDS_MeshElement* anElem,
while( anIter->more() ) while( anIter->more() )
{ {
const SMDS_MeshNode* aNode = (SMDS_MeshNode*)anIter->next(); const SMDS_MeshNode* aNode = (SMDS_MeshNode*)anIter->next();
if ( aNode != 0 ) if ( aNode != 0 ){
theRes.Append( gp_XYZ( aNode->X(), aNode->Y(), aNode->Z() ) ); theRes.push_back( gp_XYZ( aNode->X(), aNode->Y(), aNode->Z() ) );
}
} }
} }
@ -187,7 +188,7 @@ void NumericalFunctor::SetPrecision( const long thePrecision )
double NumericalFunctor::GetValue( long theId ) double NumericalFunctor::GetValue( long theId )
{ {
TColgp_SequenceOfXYZ P; TSequenceOfXYZ P;
if ( GetPoints( theId, P )) if ( GetPoints( theId, P ))
{ {
double aVal = GetValue( P ); double aVal = GetValue( P );
@ -196,7 +197,6 @@ double NumericalFunctor::GetValue( long theId )
double prec = pow( 10., (double)( myPrecision ) ); double prec = pow( 10., (double)( myPrecision ) );
aVal = floor( aVal * prec + 0.5 ) / prec; aVal = floor( aVal * prec + 0.5 ) / prec;
} }
return aVal; return aVal;
} }
@ -208,11 +208,11 @@ double NumericalFunctor::GetValue( long theId )
Description : Functor for calculation of minimum angle Description : Functor for calculation of minimum angle
*/ */
double MinimumAngle::GetValue( const TColgp_SequenceOfXYZ& P ) double MinimumAngle::GetValue( const TSequenceOfXYZ& P )
{ {
double aMin; double aMin;
if ( P.Length() == 3 ) if ( P.size() == 3 )
{ {
double A0 = getAngle( P( 3 ), P( 1 ), P( 2 ) ); double A0 = getAngle( P( 3 ), P( 1 ), P( 2 ) );
double A1 = getAngle( P( 1 ), P( 2 ), P( 3 ) ); double A1 = getAngle( P( 1 ), P( 2 ), P( 3 ) );
@ -220,7 +220,7 @@ double MinimumAngle::GetValue( const TColgp_SequenceOfXYZ& P )
aMin = Min( A0, Min( A1, A2 ) ); aMin = Min( A0, Min( A1, A2 ) );
} }
else if ( P.Length() == 4 ) else if ( P.size() == 4 )
{ {
double A0 = getAngle( P( 4 ), P( 1 ), P( 2 ) ); double A0 = getAngle( P( 4 ), P( 1 ), P( 2 ) );
double A1 = getAngle( P( 1 ), P( 2 ), P( 3 ) ); double A1 = getAngle( P( 1 ), P( 2 ), P( 3 ) );
@ -251,9 +251,9 @@ SMDSAbs_ElementType MinimumAngle::GetType() const
Class : AspectRatio Class : AspectRatio
Description : Functor for calculating aspect ratio Description : Functor for calculating aspect ratio
*/ */
double AspectRatio::GetValue( const TColgp_SequenceOfXYZ& P ) double AspectRatio::GetValue( const TSequenceOfXYZ& P )
{ {
int nbNodes = P.Length(); int nbNodes = P.size();
if ( nbNodes != 3 && nbNodes != 4 ) if ( nbNodes != 3 && nbNodes != 4 )
return 0; return 0;
@ -306,19 +306,20 @@ SMDSAbs_ElementType AspectRatio::GetType() const
Class : AspectRatio3D Class : AspectRatio3D
Description : Functor for calculating aspect ratio Description : Functor for calculating aspect ratio
*/ */
namespace{
static inline double getHalfPerimeter(double theTria[3]){ inline double getHalfPerimeter(double theTria[3]){
return (theTria[0] + theTria[1] + theTria[2])/2.0; return (theTria[0] + theTria[1] + theTria[2])/2.0;
} }
static inline double getArea(double theHalfPerim, double theTria[3]){ inline double getArea(double theHalfPerim, double theTria[3]){
return sqrt(theHalfPerim* return sqrt(theHalfPerim*
(theHalfPerim-theTria[0])* (theHalfPerim-theTria[0])*
(theHalfPerim-theTria[1])* (theHalfPerim-theTria[1])*
(theHalfPerim-theTria[2])); (theHalfPerim-theTria[2]));
} }
static inline double getVolume(double theLen[6]){ inline double getVolume(double theLen[6]){
double a2 = theLen[0]*theLen[0]; double a2 = theLen[0]*theLen[0];
double b2 = theLen[1]*theLen[1]; double b2 = theLen[1]*theLen[1];
double c2 = theLen[2]*theLen[2]; double c2 = theLen[2]*theLen[2];
@ -329,42 +330,57 @@ static inline double getVolume(double theLen[6]){
double Q = a2*(b2+d2-e2)-b2*(a2+d2-f2)-d2*(a2+b2-c2); double Q = a2*(b2+d2-e2)-b2*(a2+d2-f2)-d2*(a2+b2-c2);
double R = (b2+d2-e2)*(a2+d2-f2)*(a2+d2-f2); double R = (b2+d2-e2)*(a2+d2-f2)*(a2+d2-f2);
return sqrt(P-Q+R)/12.0; return sqrt(P-Q+R)/12.0;
} }
static inline double getHeight( const gp_Pnt& P1, const gp_Pnt& P2, inline double getVolume2(double theLen[6]){
const gp_Pnt& P3, const gp_Pnt& P4) double a2 = theLen[0]*theLen[0];
{ double b2 = theLen[1]*theLen[1];
gp_Vec aVec1( P2.XYZ() - P1.XYZ() ); double c2 = theLen[2]*theLen[2];
gp_Vec aVec2( P3.XYZ() - P1.XYZ() ); double d2 = theLen[3]*theLen[3];
gp_Vec aNorm = aVec1 ^ aVec2; double e2 = theLen[4]*theLen[4];
aNorm /= aNorm.Magnitude(); double f2 = theLen[5]*theLen[5];
gp_Vec aVec3( P4.XYZ() - P1.XYZ() );
double aDist = aVec1 * aVec2;
return fabs( aDist );
}
static inline double getMaxHeight( const TColgp_SequenceOfXYZ& P ) double P = a2*e2*(b2+c2+d2+f2-a2-e2);
{ double Q = b2*f2*(a2+c2+d2+e2-b2-f2);
double aHeight = getHeight(P(1),P(2),P(3),P(4)); double R = c2*d2*(a2+b2+e2+f2-c2-d2);
aHeight = max(aHeight,getHeight(P(1),P(2),P(4),P(3))); double S = a2*b2*d2+b2*c2*e2+a2*c2*f2+d2*e2*f2;
aHeight = max(aHeight,getHeight(P(1),P(3),P(4),P(2)));
aHeight = max(aHeight,getHeight(P(2),P(3),P(4),P(1))); return sqrt(P+Q+R-S)/12.0;
}
inline double getVolume(const TSequenceOfXYZ& P){
gp_Vec aVec1( P( 2 ) - P( 1 ) );
gp_Vec aVec2( P( 3 ) - P( 1 ) );
gp_Vec aVec3( P( 4 ) - P( 1 ) );
gp_Vec anAreaVec( aVec1 ^ aVec2 );
return abs(aVec3 * anAreaVec) / 6.0;
}
inline double getMaxHeight(double theLen[6])
{
double aHeight = max(theLen[0],theLen[1]);
aHeight = max(aHeight,theLen[2]);
aHeight = max(aHeight,theLen[3]);
aHeight = max(aHeight,theLen[4]);
aHeight = max(aHeight,theLen[5]);
return aHeight; return aHeight;
}
} }
double AspectRatio3D::GetValue( const TColgp_SequenceOfXYZ& P ) double AspectRatio3D::GetValue( const TSequenceOfXYZ& P )
{ {
double aQuality = 0.0; double aQuality = 0.0;
int nbNodes = P.Length(); int nbNodes = P.size();
switch(nbNodes){ switch(nbNodes){
case 4:{ case 4:{
double aLen[6] = { double aLen[6] = {
getDistance(P(1),P(2)), // a getDistance(P( 1 ),P( 2 )), // a
getDistance(P(2),P(3)), // b getDistance(P( 2 ),P( 3 )), // b
getDistance(P(3),P(1)), // c getDistance(P( 3 ),P( 1 )), // c
getDistance(P(2),P(4)), // d getDistance(P( 2 ),P( 4 )), // d
getDistance(P(3),P(4)), // e getDistance(P( 3 ),P( 4 )), // e
getDistance(P(1),P(4)) // f getDistance(P( 1 ),P( 4 )) // f
}; };
double aTria[4][3] = { double aTria[4][3] = {
{aLen[0],aLen[1],aLen[2]}, // abc {aLen[0],aLen[1],aLen[2]}, // abc
@ -372,15 +388,205 @@ double AspectRatio3D::GetValue( const TColgp_SequenceOfXYZ& P )
{aLen[1],aLen[3],aLen[4]}, // bde {aLen[1],aLen[3],aLen[4]}, // bde
{aLen[2],aLen[4],aLen[5]} // cef {aLen[2],aLen[4],aLen[5]} // cef
}; };
double aHalfPerim = getHalfPerimeter(aTria[0]); double aSumArea = 0.0;
double anArea = getArea(aHalfPerim,aTria[0]); double aHalfPerimeter = getHalfPerimeter(aTria[0]);
aHalfPerim = getHalfPerimeter(aTria[1]); double anArea = getArea(aHalfPerimeter,aTria[0]);
anArea += getArea(aHalfPerim,aTria[1]); aSumArea += anArea;
aHalfPerim = getHalfPerimeter(aTria[2]); aHalfPerimeter = getHalfPerimeter(aTria[1]);
anArea += getArea(aHalfPerim,aTria[2]); anArea = getArea(aHalfPerimeter,aTria[1]);
double aVolume = getVolume(aLen); aSumArea += anArea;
double aHeight = getMaxHeight(P); aHalfPerimeter = getHalfPerimeter(aTria[2]);
aQuality = 1.0/3.0*aHeight*anArea/aVolume; anArea = getArea(aHalfPerimeter,aTria[2]);
aSumArea += anArea;
aHalfPerimeter = getHalfPerimeter(aTria[3]);
anArea = getArea(aHalfPerimeter,aTria[3]);
aSumArea += anArea;
double aVolume = getVolume(P);
//double aVolume = getVolume(aLen);
double aHeight = getMaxHeight(aLen);
static double aCoeff = sqrt(6.0)/36.0;
aQuality = aCoeff*aHeight*aSumArea/aVolume;
break;
}
case 5:{
{
gp_XYZ aXYZ[4] = {P( 1 ),P( 2 ),P( 3 ),P( 5 )};
aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
}
{
gp_XYZ aXYZ[4] = {P( 1 ),P( 3 ),P( 4 ),P( 5 )};
aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
}
{
gp_XYZ aXYZ[4] = {P( 1 ),P( 2 ),P( 4 ),P( 5 )};
aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
}
{
gp_XYZ aXYZ[4] = {P( 2 ),P( 3 ),P( 4 ),P( 5 )};
aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
}
break;
}
case 6:{
{
gp_XYZ aXYZ[4] = {P( 1 ),P( 2 ),P( 4 ),P( 6 )};
aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
}
{
gp_XYZ aXYZ[4] = {P( 1 ),P( 2 ),P( 4 ),P( 3 )};
aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
}
{
gp_XYZ aXYZ[4] = {P( 1 ),P( 2 ),P( 5 ),P( 6 )};
aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
}
{
gp_XYZ aXYZ[4] = {P( 1 ),P( 2 ),P( 5 ),P( 3 )};
aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
}
{
gp_XYZ aXYZ[4] = {P( 2 ),P( 5 ),P( 4 ),P( 6 )};
aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
}
{
gp_XYZ aXYZ[4] = {P( 2 ),P( 5 ),P( 4 ),P( 3 )};
aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
}
break;
}
case 8:{
{
gp_XYZ aXYZ[4] = {P( 1 ),P( 2 ),P( 5 ),P( 3 )};
aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
}
{
gp_XYZ aXYZ[4] = {P( 1 ),P( 2 ),P( 5 ),P( 4 )};
aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
}
{
gp_XYZ aXYZ[4] = {P( 1 ),P( 2 ),P( 5 ),P( 7 )};
aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
}
{
gp_XYZ aXYZ[4] = {P( 1 ),P( 2 ),P( 5 ),P( 8 )};
aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
}
{
gp_XYZ aXYZ[4] = {P( 1 ),P( 2 ),P( 6 ),P( 3 )};
aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
}
{
gp_XYZ aXYZ[4] = {P( 1 ),P( 2 ),P( 6 ),P( 4 )};
aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
}
{
gp_XYZ aXYZ[4] = {P( 1 ),P( 2 ),P( 6 ),P( 7 )};
aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
}
{
gp_XYZ aXYZ[4] = {P( 1 ),P( 2 ),P( 6 ),P( 8 )};
aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
}
{
gp_XYZ aXYZ[4] = {P( 2 ),P( 6 ),P( 5 ),P( 3 )};
aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
}
{
gp_XYZ aXYZ[4] = {P( 2 ),P( 6 ),P( 5 ),P( 4 )};
aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
}
{
gp_XYZ aXYZ[4] = {P( 2 ),P( 6 ),P( 5 ),P( 7 )};
aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
}
{
gp_XYZ aXYZ[4] = {P( 2 ),P( 6 ),P( 5 ),P( 8 )};
aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
}
{
gp_XYZ aXYZ[4] = {P( 3 ),P( 4 ),P( 8 ),P( 1 )};
aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
}
{
gp_XYZ aXYZ[4] = {P( 3 ),P( 4 ),P( 8 ),P( 2 )};
aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
}
{
gp_XYZ aXYZ[4] = {P( 3 ),P( 4 ),P( 8 ),P( 5 )};
aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
}
{
gp_XYZ aXYZ[4] = {P( 3 ),P( 4 ),P( 8 ),P( 6 )};
aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
}
{
gp_XYZ aXYZ[4] = {P( 3 ),P( 4 ),P( 7 ),P( 1 )};
aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
}
{
gp_XYZ aXYZ[4] = {P( 3 ),P( 4 ),P( 7 ),P( 2 )};
aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
}
{
gp_XYZ aXYZ[4] = {P( 3 ),P( 4 ),P( 7 ),P( 5 )};
aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
}
{
gp_XYZ aXYZ[4] = {P( 3 ),P( 4 ),P( 7 ),P( 6 )};
aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
}
{
gp_XYZ aXYZ[4] = {P( 4 ),P( 8 ),P( 7 ),P( 1 )};
aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
}
{
gp_XYZ aXYZ[4] = {P( 4 ),P( 8 ),P( 7 ),P( 2 )};
aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
}
{
gp_XYZ aXYZ[4] = {P( 4 ),P( 8 ),P( 7 ),P( 5 )};
aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
}
{
gp_XYZ aXYZ[4] = {P( 4 ),P( 8 ),P( 7 ),P( 6 )};
aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
}
{
gp_XYZ aXYZ[4] = {P( 4 ),P( 8 ),P( 7 ),P( 2 )};
aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
}
{
gp_XYZ aXYZ[4] = {P( 4 ),P( 5 ),P( 8 ),P( 2 )};
aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
}
{
gp_XYZ aXYZ[4] = {P( 1 ),P( 4 ),P( 5 ),P( 3 )};
aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
}
{
gp_XYZ aXYZ[4] = {P( 3 ),P( 6 ),P( 7 ),P( 1 )};
aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
}
{
gp_XYZ aXYZ[4] = {P( 2 ),P( 3 ),P( 6 ),P( 4 )};
aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
}
{
gp_XYZ aXYZ[4] = {P( 5 ),P( 6 ),P( 8 ),P( 3 )};
aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
}
{
gp_XYZ aXYZ[4] = {P( 7 ),P( 8 ),P( 6 ),P( 1 )};
aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
}
{
gp_XYZ aXYZ[4] = {P( 1 ),P( 2 ),P( 4 ),P( 7 )};
aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
}
{
gp_XYZ aXYZ[4] = {P( 3 ),P( 4 ),P( 2 ),P( 5 )};
aQuality = max(GetValue(TSequenceOfXYZ(&aXYZ[0],&aXYZ[4])),aQuality);
}
break; break;
} }
} }
@ -405,9 +611,9 @@ SMDSAbs_ElementType AspectRatio3D::GetType() const
Class : Warping Class : Warping
Description : Functor for calculating warping Description : Functor for calculating warping
*/ */
double Warping::GetValue( const TColgp_SequenceOfXYZ& P ) double Warping::GetValue( const TSequenceOfXYZ& P )
{ {
if ( P.Length() != 4 ) if ( P.size() != 4 )
return 0; return 0;
gp_XYZ G = ( P( 1 ) + P( 2 ) + P( 3 ) + P( 4 ) ) / 4; gp_XYZ G = ( P( 1 ) + P( 2 ) + P( 3 ) + P( 4 ) ) / 4;
@ -462,9 +668,9 @@ SMDSAbs_ElementType Warping::GetType() const
Class : Taper Class : Taper
Description : Functor for calculating taper Description : Functor for calculating taper
*/ */
double Taper::GetValue( const TColgp_SequenceOfXYZ& P ) double Taper::GetValue( const TSequenceOfXYZ& P )
{ {
if ( P.Length() != 4 ) if ( P.size() != 4 )
return 0; return 0;
// Compute taper // Compute taper
@ -514,14 +720,14 @@ static inline double skewAngle( const gp_XYZ& p1, const gp_XYZ& p2, const gp_XYZ
return v1.Magnitude() < gp::Resolution() || v2.Magnitude() < gp::Resolution() ? 0 : v1.Angle( v2 ); return v1.Magnitude() < gp::Resolution() || v2.Magnitude() < gp::Resolution() ? 0 : v1.Angle( v2 );
} }
double Skew::GetValue( const TColgp_SequenceOfXYZ& P ) double Skew::GetValue( const TSequenceOfXYZ& P )
{ {
if ( P.Length() != 3 && P.Length() != 4 ) if ( P.size() != 3 && P.size() != 4 )
return 0; return 0;
// Compute skew // Compute skew
static double PI2 = PI / 2; static double PI2 = PI / 2;
if ( P.Length() == 3 ) if ( P.size() == 3 )
{ {
double A0 = fabs( PI2 - skewAngle( P( 3 ), P( 1 ), P( 2 ) ) ); double A0 = fabs( PI2 - skewAngle( P( 3 ), P( 1 ), P( 2 ) ) );
double A1 = fabs( PI2 - skewAngle( P( 1 ), P( 2 ), P( 3 ) ) ); double A1 = fabs( PI2 - skewAngle( P( 1 ), P( 2 ), P( 3 ) ) );
@ -562,11 +768,11 @@ SMDSAbs_ElementType Skew::GetType() const
Class : Area Class : Area
Description : Functor for calculating area Description : Functor for calculating area
*/ */
double Area::GetValue( const TColgp_SequenceOfXYZ& P ) double Area::GetValue( const TSequenceOfXYZ& P )
{ {
if ( P.Length() == 3 ) if ( P.size() == 3 )
return getArea( P( 1 ), P( 2 ), P( 3 ) ); return getArea( P( 1 ), P( 2 ), P( 3 ) );
else if ( P.Length() == 4 ) else if ( P.size() == 4 )
return getArea( P( 1 ), P( 2 ), P( 3 ) ) + getArea( P( 1 ), P( 3 ), P( 4 ) ); return getArea( P( 1 ), P( 2 ), P( 3 ) ) + getArea( P( 1 ), P( 3 ), P( 4 ) );
else else
return 0; return 0;
@ -587,9 +793,9 @@ SMDSAbs_ElementType Area::GetType() const
Class : Length Class : Length
Description : Functor for calculating length off edge Description : Functor for calculating length off edge
*/ */
double Length::GetValue( const TColgp_SequenceOfXYZ& P ) double Length::GetValue( const TSequenceOfXYZ& P )
{ {
return ( P.Length() == 2 ? getDistance( P( 1 ), P( 2 ) ) : 0 ); return ( P.size() == 2 ? getDistance( P( 1 ), P( 2 ) ) : 0 );
} }
double Length::GetBadRate( double Value, int /*nbNodes*/ ) const double Length::GetBadRate( double Value, int /*nbNodes*/ ) const
@ -602,12 +808,198 @@ SMDSAbs_ElementType Length::GetType() const
return SMDSAbs_Edge; return SMDSAbs_Edge;
} }
/*
Class : Length2D
Description : Functor for calculating length of edge
*/
double Length2D::GetValue( long theElementId)
{
TSequenceOfXYZ P;
if (GetPoints(theElementId,P)){
double aVal;// = GetValue( P );
const SMDS_MeshElement* aElem = myMesh->FindElement( theElementId );
SMDSAbs_ElementType aType = aElem->GetType();
int len = P.size();
switch (aType){
case SMDSAbs_All:
case SMDSAbs_Node:
case SMDSAbs_Edge:
if (len == 2){
aVal = getDistance( P( 1 ), P( 2 ) );
break;
}
case SMDSAbs_Face:
if (len == 3){ // triangles
double L1 = getDistance(P( 1 ),P( 2 ));
double L2 = getDistance(P( 2 ),P( 3 ));
double L3 = getDistance(P( 3 ),P( 1 ));
aVal = Max(L1,Max(L2,L3));
break;
}
else if (len == 4){ // quadrangles
double L1 = getDistance(P( 1 ),P( 2 ));
double L2 = getDistance(P( 2 ),P( 3 ));
double L3 = getDistance(P( 3 ),P( 4 ));
double L4 = getDistance(P( 4 ),P( 1 ));
aVal = Max(Max(L1,L2),Max(L3,L4));
break;
}
case SMDSAbs_Volume:
if (len == 4){ // tetraidrs
double L1 = getDistance(P( 1 ),P( 2 ));
double L2 = getDistance(P( 2 ),P( 3 ));
double L3 = getDistance(P( 3 ),P( 1 ));
double L4 = getDistance(P( 1 ),P( 4 ));
double L5 = getDistance(P( 2 ),P( 4 ));
double L6 = getDistance(P( 3 ),P( 4 ));
aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
break;
}
else if (len == 5){ // piramids
double L1 = getDistance(P( 1 ),P( 2 ));
double L2 = getDistance(P( 2 ),P( 3 ));
double L3 = getDistance(P( 3 ),P( 1 ));
double L4 = getDistance(P( 4 ),P( 1 ));
double L5 = getDistance(P( 1 ),P( 5 ));
double L6 = getDistance(P( 2 ),P( 5 ));
double L7 = getDistance(P( 3 ),P( 5 ));
double L8 = getDistance(P( 4 ),P( 5 ));
aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
aVal = Max(aVal,Max(L7,L8));
break;
}
else if (len == 6){ // pentaidres
double L1 = getDistance(P( 1 ),P( 2 ));
double L2 = getDistance(P( 2 ),P( 3 ));
double L3 = getDistance(P( 3 ),P( 1 ));
double L4 = getDistance(P( 4 ),P( 5 ));
double L5 = getDistance(P( 5 ),P( 6 ));
double L6 = getDistance(P( 6 ),P( 4 ));
double L7 = getDistance(P( 1 ),P( 4 ));
double L8 = getDistance(P( 2 ),P( 5 ));
double L9 = getDistance(P( 3 ),P( 6 ));
aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
aVal = Max(aVal,Max(Max(L7,L8),L9));
break;
}
else if (len == 8){ // hexaider
double L1 = getDistance(P( 1 ),P( 2 ));
double L2 = getDistance(P( 2 ),P( 3 ));
double L3 = getDistance(P( 3 ),P( 4 ));
double L4 = getDistance(P( 4 ),P( 1 ));
double L5 = getDistance(P( 5 ),P( 6 ));
double L6 = getDistance(P( 6 ),P( 7 ));
double L7 = getDistance(P( 7 ),P( 8 ));
double L8 = getDistance(P( 8 ),P( 5 ));
double L9 = getDistance(P( 1 ),P( 5 ));
double L10= getDistance(P( 2 ),P( 6 ));
double L11= getDistance(P( 3 ),P( 7 ));
double L12= getDistance(P( 4 ),P( 8 ));
aVal = Max(Max(Max(L1,L2),Max(L3,L4)),Max(L5,L6));
aVal = Max(aVal,Max(Max(L7,L8),Max(L9,L10)));
aVal = Max(aVal,Max(L11,L12));
break;
}
default: aVal=-1;
}
if (aVal <0){
return 0.;
}
if ( myPrecision >= 0 )
{
double prec = pow( 10., (double)( myPrecision ) );
aVal = floor( aVal * prec + 0.5 ) / prec;
}
return aVal;
}
return 0.;
}
double Length2D::GetBadRate( double Value, int /*nbNodes*/ ) const
{
return Value;
}
SMDSAbs_ElementType Length2D::GetType() const
{
return SMDSAbs_Face;
}
Length2D::Value::Value(double theLength,long thePntId1, long thePntId2):
myLength(theLength)
{
myPntId[0] = thePntId1; myPntId[1] = thePntId2;
if(thePntId1 > thePntId2){
myPntId[1] = thePntId1; myPntId[0] = thePntId2;
}
}
bool Length2D::Value::operator<(const Length2D::Value& x) const{
if(myPntId[0] < x.myPntId[0]) return true;
if(myPntId[0] == x.myPntId[0])
if(myPntId[1] < x.myPntId[1]) return true;
return false;
}
void Length2D::GetValues(TValues& theValues){
TValues aValues;
SMDS_FaceIteratorPtr anIter = myMesh->facesIterator();
for(; anIter->more(); ){
const SMDS_MeshFace* anElem = anIter->next();
SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator();
long aNodeId[2];
gp_Pnt P[3];
double aLength;
const SMDS_MeshElement* aNode;
if(aNodesIter->more()){
aNode = aNodesIter->next();
const SMDS_MeshNode* aNodes = (SMDS_MeshNode*) aNode;
P[0] = P[1] = gp_Pnt(aNodes->X(),aNodes->Y(),aNodes->Z());
aNodeId[0] = aNodeId[1] = aNode->GetID();
aLength = 0;
}
for(; aNodesIter->more(); ){
aNode = aNodesIter->next();
const SMDS_MeshNode* aNodes = (SMDS_MeshNode*) aNode;
long anId = aNode->GetID();
P[2] = gp_Pnt(aNodes->X(),aNodes->Y(),aNodes->Z());
aLength = P[1].Distance(P[2]);
Value aValue(aLength,aNodeId[1],anId);
aNodeId[1] = anId;
P[1] = P[2];
theValues.insert(aValue);
}
aLength = P[0].Distance(P[1]);
Value aValue(aLength,aNodeId[0],aNodeId[1]);
theValues.insert(aValue);
}
}
/* /*
Class : MultiConnection Class : MultiConnection
Description : Functor for calculating number of faces conneted to the edge Description : Functor for calculating number of faces conneted to the edge
*/ */
double MultiConnection::GetValue( const TColgp_SequenceOfXYZ& P ) double MultiConnection::GetValue( const TSequenceOfXYZ& P )
{ {
return 0; return 0;
} }
@ -626,6 +1018,148 @@ SMDSAbs_ElementType MultiConnection::GetType() const
return SMDSAbs_Edge; return SMDSAbs_Edge;
} }
/*
Class : MultiConnection2D
Description : Functor for calculating number of faces conneted to the edge
*/
double MultiConnection2D::GetValue( const TSequenceOfXYZ& P )
{
return 0;
}
double MultiConnection2D::GetValue( long theElementId )
{
TSequenceOfXYZ P;
int aResult = 0;
if (GetPoints(theElementId,P)){
double aVal;
const SMDS_MeshElement* anFaceElem = myMesh->FindElement( theElementId );
SMDSAbs_ElementType aType = anFaceElem->GetType();
int len = P.size();
TColStd_MapOfInteger aMap;
int aResult = 0;
switch (aType){
case SMDSAbs_All:
case SMDSAbs_Node:
case SMDSAbs_Edge:
case SMDSAbs_Face:
if (len == 3){ // triangles
int Nb[3] = {0,0,0};
int i=0;
SMDS_ElemIteratorPtr anIter = anFaceElem->nodesIterator();
if ( anIter != 0 ) {
while( anIter->more() ) {
const SMDS_MeshNode* aNode = (SMDS_MeshNode*)anIter->next();
if ( aNode == 0 ){
break;
}
SMDS_ElemIteratorPtr anElemIter = aNode->GetInverseElementIterator();
while( anElemIter->more() ) {
const SMDS_MeshElement* anElem = anElemIter->next();
if ( anElem != 0 && anElem->GetType() != SMDSAbs_Edge ) {
int anId = anElem->GetID();
if ( anIter->more() ) // i.e. first node
aMap.Add( anId );
else if ( aMap.Contains( anId ) ){
Nb[i]++;
}
}
else if ( anElem != 0 && anElem->GetType() == SMDSAbs_Edge ) i++;
}
}
}
aResult = Max(Max(Nb[0],Nb[1]),Nb[2]);
}
break;
case SMDSAbs_Volume:
default: aResult=0;
}
}
return aResult;//getNbMultiConnection( myMesh, theId );
}
double MultiConnection2D::GetBadRate( double Value, int /*nbNodes*/ ) const
{
return Value;
}
SMDSAbs_ElementType MultiConnection2D::GetType() const
{
return SMDSAbs_Face;
}
MultiConnection2D::Value::Value(long thePntId1, long thePntId2)
{
myPntId[0] = thePntId1; myPntId[1] = thePntId2;
if(thePntId1 > thePntId2){
myPntId[1] = thePntId1; myPntId[0] = thePntId2;
}
}
bool MultiConnection2D::Value::operator<(const MultiConnection2D::Value& x) const{
if(myPntId[0] < x.myPntId[0]) return true;
if(myPntId[0] == x.myPntId[0])
if(myPntId[1] < x.myPntId[1]) return true;
return false;
}
void MultiConnection2D::GetValues(MValues& theValues){
SMDS_FaceIteratorPtr anIter = myMesh->facesIterator();
for(; anIter->more(); ){
const SMDS_MeshFace* anElem = anIter->next();
long anElemId = anElem->GetID();
SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator();
long aNodeId[3];
//int aNbConnects=0;
const SMDS_MeshNode* aNode0;
const SMDS_MeshNode* aNode1;
const SMDS_MeshNode* aNode2;
if(aNodesIter->more()){
aNode0 = (SMDS_MeshNode*) aNodesIter->next();
aNode1 = aNode0;
const SMDS_MeshNode* aNodes = (SMDS_MeshNode*) aNode1;
aNodeId[0] = aNodeId[1] = aNodes->GetID();
}
for(; aNodesIter->more(); ){
aNode2 = (SMDS_MeshNode*) aNodesIter->next();
long anId = aNode2->GetID();
aNodeId[2] = anId;
Value aValue(aNodeId[1],aNodeId[2]);
MValues::iterator aItr = theValues.find(aValue);
if (aItr != theValues.end()){
aItr->second += 1;
//aNbConnects = nb;
} else {
theValues[aValue] = 1;
//aNbConnects = 1;
}
//cout << "NodeIds: "<<aNodeId[1]<<","<<aNodeId[2]<<" nbconn="<<aNbConnects<<endl;
aNodeId[1] = aNodeId[2];
aNode1 = aNode2;
}
Value aValue(aNodeId[0],aNodeId[2]);
MValues::iterator aItr = theValues.find(aValue);
if (aItr != theValues.end()){
aItr->second += 1;
//aNbConnects = nb;
} else {
theValues[aValue] = 1;
//aNbConnects = 1;
}
//cout << "NodeIds: "<<aNodeId[0]<<","<<aNodeId[2]<<" nbconn="<<aNbConnects<<endl;
}
}
/* /*
PREDICATES PREDICATES
@ -1426,7 +1960,6 @@ static gp_XYZ getNormale( const SMDS_MeshFace* theFace )
gp_XYZ n; gp_XYZ n;
int aNbNode = theFace->NbNodes(); int aNbNode = theFace->NbNodes();
TColgp_Array1OfXYZ anArrOfXYZ(1,4); TColgp_Array1OfXYZ anArrOfXYZ(1,4);
gp_XYZ p1, p2, p3, p4;
SMDS_ElemIteratorPtr aNodeItr = theFace->nodesIterator(); SMDS_ElemIteratorPtr aNodeItr = theFace->nodesIterator();
int i = 1; int i = 1;
for ( ; aNodeItr->more() && i <= 4; i++ ) for ( ; aNodeItr->more() && i <= 4; i++ )
@ -1612,7 +2145,7 @@ void ManifoldPart::getFacesByLink( const ManifoldPart::Link& theLink,
SMDS_MeshFace* aFace = (SMDS_MeshFace*)anItr->next(); SMDS_MeshFace* aFace = (SMDS_MeshFace*)anItr->next();
if ( !aFace ) if ( !aFace )
continue; continue;
aSetOfFaces.insert( aFace ); aSetOfFaces.Add( aFace );
} }
// take all faces that shared second node // take all faces that shared second node
anItr = theLink.myNode2->facesIterator(); anItr = theLink.myNode2->facesIterator();
@ -1620,7 +2153,7 @@ void ManifoldPart::getFacesByLink( const ManifoldPart::Link& theLink,
for ( ; anItr->more(); ) for ( ; anItr->more(); )
{ {
SMDS_MeshFace* aFace = (SMDS_MeshFace*)anItr->next(); SMDS_MeshFace* aFace = (SMDS_MeshFace*)anItr->next();
if ( aSetOfFaces.find( aFace ) != aSetOfFaces.end() ) if ( aSetOfFaces.Contains( aFace ) )
theFaces.push_back( aFace ); theFaces.push_back( aFace );
} }
} }

View File

@ -20,508 +20,24 @@
#ifndef _SMESH_CONTROLS_HXX_ #ifndef _SMESH_CONTROLS_HXX_
#define _SMESH_CONTROLS_HXX_ #define _SMESH_CONTROLS_HXX_
#include <set>
#include <map>
#include <vector>
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
#include "SMDSAbs_ElementType.hxx"
#include "SMDS_MeshNode.hxx"
#include <Geom_Surface.hxx>
#include <TColStd_SequenceOfInteger.hxx>
#include <TColStd_MapOfInteger.hxx>
#include <TCollection_AsciiString.hxx>
class SMDS_Mesh;
class SMESHDS_Mesh;
class SMESHDS_SubMesh;
class gp_Pnt;
class gp_XYZ;
class TColgp_SequenceOfXYZ;
class TopoDS_Shape;
class SMDS_MeshElement;
class SMDS_MeshFace;
class SMDS_MeshNode;
namespace SMESH{ namespace SMESH{
namespace Controls{ namespace Controls{
class Functor
{ class Functor;
public:
~Functor(){}
virtual void SetMesh( SMDS_Mesh* theMesh ) = 0;
virtual SMDSAbs_ElementType GetType() const = 0;
};
typedef boost::shared_ptr<Functor> FunctorPtr; typedef boost::shared_ptr<Functor> FunctorPtr;
class NumericalFunctor: public virtual Functor{
public:
NumericalFunctor();
virtual void SetMesh( SMDS_Mesh* theMesh );
virtual double GetValue( long theElementId );
virtual double GetValue( const TColgp_SequenceOfXYZ& thePoints ) = 0;
virtual SMDSAbs_ElementType GetType() const = 0;
virtual double GetBadRate( double Value, int nbNodes ) const = 0;
long GetPrecision() const;
void SetPrecision( const long thePrecision );
bool GetPoints (const int theId, class NumericalFunctor;
TColgp_SequenceOfXYZ& theRes ) const;
static bool GetPoints (const SMDS_MeshElement* theElem,
TColgp_SequenceOfXYZ& theRes );
protected:
SMDS_Mesh* myMesh;
long myPrecision;
};
typedef boost::shared_ptr<NumericalFunctor> NumericalFunctorPtr; typedef boost::shared_ptr<NumericalFunctor> NumericalFunctorPtr;
/* class Predicate;
Class : SMESH_MinimumAngle
Description : Functor for calculation of minimum angle
*/
class MinimumAngle: public virtual NumericalFunctor{
public:
virtual double GetValue( const TColgp_SequenceOfXYZ& thePoints );
virtual double GetBadRate( double Value, int nbNodes ) const;
virtual SMDSAbs_ElementType GetType() const;
};
/*
Class : AspectRatio
Description : Functor for calculating aspect ratio
*/
class AspectRatio: public virtual NumericalFunctor{
public:
virtual double GetValue( const TColgp_SequenceOfXYZ& thePoints );
virtual double GetBadRate( double Value, int nbNodes ) const;
virtual SMDSAbs_ElementType GetType() const;
};
/*
Class : AspectRatio3D
Description : Functor for calculating aspect ratio of 3D elems.
*/
class AspectRatio3D: public virtual NumericalFunctor{
public:
virtual double GetValue( const TColgp_SequenceOfXYZ& thePoints );
virtual double GetBadRate( double Value, int nbNodes ) const;
virtual SMDSAbs_ElementType GetType() const;
};
/*
Class : Warping
Description : Functor for calculating warping
*/
class Warping: public virtual NumericalFunctor{
public:
virtual double GetValue( const TColgp_SequenceOfXYZ& thePoints );
virtual double GetBadRate( double Value, int nbNodes ) const;
virtual SMDSAbs_ElementType GetType() const;
private:
double ComputeA( const gp_XYZ&, const gp_XYZ&, const gp_XYZ&, const gp_XYZ& ) const;
};
/*
Class : Taper
Description : Functor for calculating taper
*/
class Taper: public virtual NumericalFunctor{
public:
virtual double GetValue( const TColgp_SequenceOfXYZ& thePoints );
virtual double GetBadRate( double Value, int nbNodes ) const;
virtual SMDSAbs_ElementType GetType() const;
};
/*
Class : Skew
Description : Functor for calculating skew in degrees
*/
class Skew: public virtual NumericalFunctor{
public:
virtual double GetValue( const TColgp_SequenceOfXYZ& thePoints );
virtual double GetBadRate( double Value, int nbNodes ) const;
virtual SMDSAbs_ElementType GetType() const;
};
/*
Class : Area
Description : Functor for calculating area
*/
class Area: public virtual NumericalFunctor{
public:
virtual double GetValue( const TColgp_SequenceOfXYZ& thePoints );
virtual double GetBadRate( double Value, int nbNodes ) const;
virtual SMDSAbs_ElementType GetType() const;
};
/*
Class : Length
Description : Functor for calculating length of edge
*/
class Length: public virtual NumericalFunctor{
public:
virtual double GetValue( const TColgp_SequenceOfXYZ& thePoints );
virtual double GetBadRate( double Value, int nbNodes ) const;
virtual SMDSAbs_ElementType GetType() const;
};
/*
Class : MultiConnection
Description : Functor for calculating number of faces conneted to the edge
*/
class MultiConnection: public virtual NumericalFunctor{
public:
virtual double GetValue( long theElementId );
virtual double GetValue( const TColgp_SequenceOfXYZ& thePoints );
virtual double GetBadRate( double Value, int nbNodes ) const;
virtual SMDSAbs_ElementType GetType() const;
};
/*
PREDICATES
*/
/*
Class : Predicate
Description : Base class for all predicates
*/
class Predicate: public virtual Functor{
public:
virtual bool IsSatisfy( long theElementId ) = 0;
virtual SMDSAbs_ElementType GetType() const = 0;
};
typedef boost::shared_ptr<Predicate> PredicatePtr; typedef boost::shared_ptr<Predicate> PredicatePtr;
}
}
/*
Class : FreeBorders
Description : Predicate for free borders
*/
class FreeBorders: public virtual Predicate{
public:
FreeBorders();
virtual void SetMesh( SMDS_Mesh* theMesh );
virtual bool IsSatisfy( long theElementId );
virtual SMDSAbs_ElementType GetType() const;
protected:
SMDS_Mesh* myMesh;
};
/*
Class : FreeEdges
Description : Predicate for free Edges
*/
class FreeEdges: public virtual Predicate{
public:
FreeEdges();
virtual void SetMesh( SMDS_Mesh* theMesh );
virtual bool IsSatisfy( long theElementId );
virtual SMDSAbs_ElementType GetType() const;
static bool IsFreeEdge( const SMDS_MeshNode** theNodes, const int theFaceId );
typedef long TElemId;
struct Border{
TElemId myElemId;
TElemId myPntId[2];
Border(long theElemId, long thePntId1, long thePntId2);
bool operator<(const Border& x) const;
};
typedef std::set<Border> TBorders;
void GetBoreders(TBorders& theBorders);
protected:
SMDS_Mesh* myMesh;
};
typedef boost::shared_ptr<FreeEdges> FreeEdgesPtr;
/*
Class : RangeOfIds
Description : Predicate for Range of Ids.
Range may be specified with two ways.
1. Using AddToRange method
2. With SetRangeStr method. Parameter of this method is a string
like as "1,2,3,50-60,63,67,70-"
*/
class RangeOfIds: public virtual Predicate
{
public:
RangeOfIds();
virtual void SetMesh( SMDS_Mesh* theMesh );
virtual bool IsSatisfy( long theNodeId );
virtual SMDSAbs_ElementType GetType() const;
virtual void SetType( SMDSAbs_ElementType theType );
bool AddToRange( long theEntityId );
void GetRangeStr( TCollection_AsciiString& );
bool SetRangeStr( const TCollection_AsciiString& );
protected:
SMDS_Mesh* myMesh;
TColStd_SequenceOfInteger myMin;
TColStd_SequenceOfInteger myMax;
TColStd_MapOfInteger myIds;
SMDSAbs_ElementType myType;
};
typedef boost::shared_ptr<RangeOfIds> RangeOfIdsPtr;
/*
Class : Comparator
Description : Base class for comparators
*/
class Comparator: public virtual Predicate{
public:
Comparator();
virtual ~Comparator();
virtual void SetMesh( SMDS_Mesh* theMesh );
virtual void SetMargin(double theValue);
virtual void SetNumFunctor(NumericalFunctorPtr theFunct);
virtual bool IsSatisfy( long theElementId ) = 0;
virtual SMDSAbs_ElementType GetType() const;
double GetMargin();
protected:
double myMargin;
NumericalFunctorPtr myFunctor;
};
typedef boost::shared_ptr<Comparator> ComparatorPtr;
/*
Class : LessThan
Description : Comparator "<"
*/
class LessThan: public virtual Comparator{
public:
virtual bool IsSatisfy( long theElementId );
};
/*
Class : MoreThan
Description : Comparator ">"
*/
class MoreThan: public virtual Comparator{
public:
virtual bool IsSatisfy( long theElementId );
};
/*
Class : EqualTo
Description : Comparator "="
*/
class EqualTo: public virtual Comparator{
public:
EqualTo();
virtual bool IsSatisfy( long theElementId );
virtual void SetTolerance( double theTol );
virtual double GetTolerance();
private:
double myToler;
};
typedef boost::shared_ptr<EqualTo> EqualToPtr;
/*
Class : LogicalNOT
Description : Logical NOT predicate
*/
class LogicalNOT: public virtual Predicate{
public:
LogicalNOT();
virtual ~LogicalNOT();
virtual bool IsSatisfy( long theElementId );
virtual void SetMesh( SMDS_Mesh* theMesh );
virtual void SetPredicate(PredicatePtr thePred);
virtual SMDSAbs_ElementType GetType() const;
private:
PredicatePtr myPredicate;
};
typedef boost::shared_ptr<LogicalNOT> LogicalNOTPtr;
/*
Class : LogicalBinary
Description : Base class for binary logical predicate
*/
class LogicalBinary: public virtual Predicate{
public:
LogicalBinary();
virtual ~LogicalBinary();
virtual void SetMesh( SMDS_Mesh* theMesh );
virtual void SetPredicate1(PredicatePtr thePred);
virtual void SetPredicate2(PredicatePtr thePred);
virtual SMDSAbs_ElementType GetType() const;
protected:
PredicatePtr myPredicate1;
PredicatePtr myPredicate2;
};
typedef boost::shared_ptr<LogicalBinary> LogicalBinaryPtr;
/*
Class : LogicalAND
Description : Logical AND
*/
class LogicalAND: public virtual LogicalBinary{
public:
virtual bool IsSatisfy( long theElementId );
};
/*
Class : LogicalOR
Description : Logical OR
*/
class LogicalOR: public virtual LogicalBinary{
public:
virtual bool IsSatisfy( long theElementId );
};
/*
Class : ManifoldPart
Description : Predicate for manifold part of mesh
*/
class ManifoldPart: public virtual Predicate{
public:
/* internal class for algorithm uses */
class Link
{
public:
Link( SMDS_MeshNode* theNode1,
SMDS_MeshNode* theNode2 );
~Link();
bool IsEqual( const ManifoldPart::Link& theLink ) const;
bool operator<(const ManifoldPart::Link& x) const;
SMDS_MeshNode* myNode1;
SMDS_MeshNode* myNode2;
};
bool IsEqual( const ManifoldPart::Link& theLink1,
const ManifoldPart::Link& theLink2 );
typedef std::set<ManifoldPart::Link> TMapOfLink;
typedef std::vector<SMDS_MeshFace*> TVectorOfFacePtr;
typedef std::vector<ManifoldPart::Link> TVectorOfLink;
typedef std::map<SMDS_MeshFace*,int> TDataMapFacePtrInt;
typedef std::map<ManifoldPart::Link,SMDS_MeshFace*> TDataMapOfLinkFacePtr;
ManifoldPart();
~ManifoldPart();
virtual void SetMesh( SMDS_Mesh* theMesh );
// inoke when all parameters already set
virtual bool IsSatisfy( long theElementId );
virtual SMDSAbs_ElementType GetType() const;
void SetAngleTolerance( const double theAngToler );
double GetAngleTolerance() const;
void SetIsOnlyManifold( const bool theIsOnly );
void SetStartElem( const long theStartElemId );
private:
bool process();
bool findConnected( const TDataMapFacePtrInt& theAllFacePtrInt,
SMDS_MeshFace* theStartFace,
TMapOfLink& theNonManifold,
TColStd_MapOfInteger& theResFaces );
bool isInPlane( const SMDS_MeshFace* theFace1,
const SMDS_MeshFace* theFace2 );
void expandBoundary( TMapOfLink& theMapOfBoundary,
TVectorOfLink& theSeqOfBoundary,
TDataMapOfLinkFacePtr& theDMapLinkFacePtr,
TMapOfLink& theNonManifold,
SMDS_MeshFace* theNextFace ) const;
void getFacesByLink( const Link& theLink,
TVectorOfFacePtr& theFaces ) const;
private:
SMDS_Mesh* myMesh;
TColStd_MapOfInteger myMapIds;
TColStd_MapOfInteger myMapBadGeomIds;
TVectorOfFacePtr myAllFacePtr;
TDataMapFacePtrInt myAllFacePtrIntDMap;
double myAngToler;
bool myIsOnlyManifold;
long myStartElemId;
};
typedef boost::shared_ptr<ManifoldPart> ManifoldPartPtr;
/*
Class : ElementsOnSurface
Description : Predicate elements that lying on indicated surface
(plane or cylinder)
*/
class ElementsOnSurface : public virtual Predicate {
public:
ElementsOnSurface();
~ElementsOnSurface();
virtual void SetMesh( SMDS_Mesh* theMesh );
virtual bool IsSatisfy( long theElementId );
virtual SMDSAbs_ElementType GetType() const;
void SetTolerance( const double theToler );
double GetTolerance() const;
void SetSurface( const TopoDS_Shape& theShape,
const SMDSAbs_ElementType theType );
private:
void process();
void process( const SMDS_MeshElement* theElem );
bool isOnSurface( const SMDS_MeshNode* theNode ) const;
private:
SMDS_Mesh* myMesh;
TColStd_MapOfInteger myIds;
SMDSAbs_ElementType myType;
Handle(Geom_Surface) mySurf;
double myToler;
};
typedef boost::shared_ptr<ElementsOnSurface> ElementsOnSurfacePtr;
/*
FILTER
*/
class Filter{
public:
Filter();
virtual ~Filter();
virtual void SetPredicate(PredicatePtr thePred);
typedef std::vector<long> TIdSequence;
virtual TIdSequence GetElementsId( SMDS_Mesh* theMesh );
protected:
PredicatePtr myPredicate;
};
};
};
#endif #endif

View File

@ -0,0 +1,612 @@
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
#ifndef _SMESH_CONTROLSDEF_HXX_
#define _SMESH_CONTROLSDEF_HXX_
#include <set>
#include <map>
#include <vector>
#include <boost/shared_ptr.hpp>
#include <gp_XYZ.hxx>
#include <Geom_Surface.hxx>
#include <TColStd_SequenceOfInteger.hxx>
#include <TColStd_MapOfInteger.hxx>
#include <TCollection_AsciiString.hxx>
#include "SMDSAbs_ElementType.hxx"
#include "SMDS_MeshNode.hxx"
#include "SMESH_Controls.hxx"
class SMDS_MeshElement;
class SMDS_MeshFace;
class SMDS_MeshNode;
class SMDS_Mesh;
class SMESHDS_Mesh;
class SMESHDS_SubMesh;
class gp_Pnt;
class TopoDS_Shape;
namespace SMESH{
namespace Controls{
class TSequenceOfXYZ: public std::vector<gp_XYZ>
{
public:
typedef std::vector<gp_XYZ> TSuperClass;
TSequenceOfXYZ()
{}
TSequenceOfXYZ(size_type n):
TSuperClass(n)
{}
TSequenceOfXYZ(size_type n, const value_type& t):
TSuperClass(n,t)
{}
TSequenceOfXYZ(const TSequenceOfXYZ& theSequenceOfXYZ):
TSuperClass(theSequenceOfXYZ)
{}
template <class InputIterator>
TSequenceOfXYZ(InputIterator theBegin, InputIterator theEnd):
TSuperClass(theBegin,theEnd)
{}
TSequenceOfXYZ& operator=(const TSequenceOfXYZ& theSequenceOfXYZ){
TSuperClass::operator=(theSequenceOfXYZ);
return *this;
}
reference operator()(size_type n){
return TSuperClass::operator[](n-1);
}
const_reference operator()(size_type n) const{
return TSuperClass::operator[](n-1);
}
private:
reference operator[](size_type n);
const_reference operator[](size_type n) const;
};
class Functor
{
public:
~Functor(){}
virtual void SetMesh( SMDS_Mesh* theMesh ) = 0;
virtual SMDSAbs_ElementType GetType() const = 0;
};
class NumericalFunctor: public virtual Functor{
public:
NumericalFunctor();
virtual void SetMesh( SMDS_Mesh* theMesh );
virtual double GetValue( long theElementId );
virtual double GetValue(const TSequenceOfXYZ& thePoints) { return -1.0;};
virtual SMDSAbs_ElementType GetType() const = 0;
virtual double GetBadRate( double Value, int nbNodes ) const = 0;
long GetPrecision() const;
void SetPrecision( const long thePrecision );
bool GetPoints(const int theId,
TSequenceOfXYZ& theRes) const;
static bool GetPoints(const SMDS_MeshElement* theElem,
TSequenceOfXYZ& theRes);
protected:
SMDS_Mesh* myMesh;
long myPrecision;
};
/*
Class : SMESH_MinimumAngle
Description : Functor for calculation of minimum angle
*/
class MinimumAngle: public virtual NumericalFunctor{
public:
virtual double GetValue( const TSequenceOfXYZ& thePoints );
virtual double GetBadRate( double Value, int nbNodes ) const;
virtual SMDSAbs_ElementType GetType() const;
};
/*
Class : AspectRatio
Description : Functor for calculating aspect ratio
*/
class AspectRatio: public virtual NumericalFunctor{
public:
virtual double GetValue( const TSequenceOfXYZ& thePoints );
virtual double GetBadRate( double Value, int nbNodes ) const;
virtual SMDSAbs_ElementType GetType() const;
};
/*
Class : AspectRatio3D
Description : Functor for calculating aspect ratio of 3D elems.
*/
class AspectRatio3D: public virtual NumericalFunctor{
public:
virtual double GetValue( const TSequenceOfXYZ& thePoints );
virtual double GetBadRate( double Value, int nbNodes ) const;
virtual SMDSAbs_ElementType GetType() const;
};
/*
Class : Warping
Description : Functor for calculating warping
*/
class Warping: public virtual NumericalFunctor{
public:
virtual double GetValue( const TSequenceOfXYZ& thePoints );
virtual double GetBadRate( double Value, int nbNodes ) const;
virtual SMDSAbs_ElementType GetType() const;
private:
double ComputeA( const gp_XYZ&, const gp_XYZ&, const gp_XYZ&, const gp_XYZ& ) const;
};
/*
Class : Taper
Description : Functor for calculating taper
*/
class Taper: public virtual NumericalFunctor{
public:
virtual double GetValue( const TSequenceOfXYZ& thePoints );
virtual double GetBadRate( double Value, int nbNodes ) const;
virtual SMDSAbs_ElementType GetType() const;
};
/*
Class : Skew
Description : Functor for calculating skew in degrees
*/
class Skew: public virtual NumericalFunctor{
public:
virtual double GetValue( const TSequenceOfXYZ& thePoints );
virtual double GetBadRate( double Value, int nbNodes ) const;
virtual SMDSAbs_ElementType GetType() const;
};
/*
Class : Area
Description : Functor for calculating area
*/
class Area: public virtual NumericalFunctor{
public:
virtual double GetValue( const TSequenceOfXYZ& thePoints );
virtual double GetBadRate( double Value, int nbNodes ) const;
virtual SMDSAbs_ElementType GetType() const;
};
/*
Class : Length
Description : Functor for calculating length of edge
*/
class Length: public virtual NumericalFunctor{
public:
virtual double GetValue( const TSequenceOfXYZ& thePoints );
virtual double GetBadRate( double Value, int nbNodes ) const;
virtual SMDSAbs_ElementType GetType() const;
};
/*
Class : Length2D
Description : Functor for calculating length of edge
*/
class Length2D: public virtual NumericalFunctor{
public:
virtual double GetValue( long theElementId );
virtual double GetBadRate( double Value, int nbNodes ) const;
virtual SMDSAbs_ElementType GetType() const;
struct Value{
double myLength;
long myPntId[2];
Value(double theLength, long thePntId1, long thePntId2);
bool operator<(const Value& x) const;
};
typedef std::set<Value> TValues;
void GetValues(TValues& theValues);
};
typedef boost::shared_ptr<Length2D> Length2DPtr;
/*
Class : MultiConnection
Description : Functor for calculating number of faces conneted to the edge
*/
class MultiConnection: public virtual NumericalFunctor{
public:
virtual double GetValue( long theElementId );
virtual double GetValue( const TSequenceOfXYZ& thePoints );
virtual double GetBadRate( double Value, int nbNodes ) const;
virtual SMDSAbs_ElementType GetType() const;
};
/*
Class : MultiConnection2D
Description : Functor for calculating number of faces conneted to the edge
*/
class MultiConnection2D: public virtual NumericalFunctor{
public:
virtual double GetValue( long theElementId );
virtual double GetValue( const TSequenceOfXYZ& thePoints );
virtual double GetBadRate( double Value, int nbNodes ) const;
virtual SMDSAbs_ElementType GetType() const;
struct Value{
long myPntId[2];
Value(long thePntId1, long thePntId2);
bool operator<(const Value& x) const;
};
typedef std::map<Value,int> MValues;
void GetValues(MValues& theValues);
};
typedef boost::shared_ptr<MultiConnection2D> MultiConnection2DPtr;
/*
PREDICATES
*/
/*
Class : Predicate
Description : Base class for all predicates
*/
class Predicate: public virtual Functor{
public:
virtual bool IsSatisfy( long theElementId ) = 0;
virtual SMDSAbs_ElementType GetType() const = 0;
};
/*
Class : FreeBorders
Description : Predicate for free borders
*/
class FreeBorders: public virtual Predicate{
public:
FreeBorders();
virtual void SetMesh( SMDS_Mesh* theMesh );
virtual bool IsSatisfy( long theElementId );
virtual SMDSAbs_ElementType GetType() const;
protected:
SMDS_Mesh* myMesh;
};
/*
Class : FreeEdges
Description : Predicate for free Edges
*/
class FreeEdges: public virtual Predicate{
public:
FreeEdges();
virtual void SetMesh( SMDS_Mesh* theMesh );
virtual bool IsSatisfy( long theElementId );
virtual SMDSAbs_ElementType GetType() const;
static bool IsFreeEdge( const SMDS_MeshNode** theNodes, const int theFaceId );
typedef long TElemId;
struct Border{
TElemId myElemId;
TElemId myPntId[2];
Border(long theElemId, long thePntId1, long thePntId2);
bool operator<(const Border& x) const;
};
typedef std::set<Border> TBorders;
void GetBoreders(TBorders& theBorders);
protected:
SMDS_Mesh* myMesh;
};
typedef boost::shared_ptr<FreeEdges> FreeEdgesPtr;
/*
Class : RangeOfIds
Description : Predicate for Range of Ids.
Range may be specified with two ways.
1. Using AddToRange method
2. With SetRangeStr method. Parameter of this method is a string
like as "1,2,3,50-60,63,67,70-"
*/
class RangeOfIds: public virtual Predicate
{
public:
RangeOfIds();
virtual void SetMesh( SMDS_Mesh* theMesh );
virtual bool IsSatisfy( long theNodeId );
virtual SMDSAbs_ElementType GetType() const;
virtual void SetType( SMDSAbs_ElementType theType );
bool AddToRange( long theEntityId );
void GetRangeStr( TCollection_AsciiString& );
bool SetRangeStr( const TCollection_AsciiString& );
protected:
SMDS_Mesh* myMesh;
TColStd_SequenceOfInteger myMin;
TColStd_SequenceOfInteger myMax;
TColStd_MapOfInteger myIds;
SMDSAbs_ElementType myType;
};
typedef boost::shared_ptr<RangeOfIds> RangeOfIdsPtr;
/*
Class : Comparator
Description : Base class for comparators
*/
class Comparator: public virtual Predicate{
public:
Comparator();
virtual ~Comparator();
virtual void SetMesh( SMDS_Mesh* theMesh );
virtual void SetMargin(double theValue);
virtual void SetNumFunctor(NumericalFunctorPtr theFunct);
virtual bool IsSatisfy( long theElementId ) = 0;
virtual SMDSAbs_ElementType GetType() const;
double GetMargin();
protected:
double myMargin;
NumericalFunctorPtr myFunctor;
};
typedef boost::shared_ptr<Comparator> ComparatorPtr;
/*
Class : LessThan
Description : Comparator "<"
*/
class LessThan: public virtual Comparator{
public:
virtual bool IsSatisfy( long theElementId );
};
/*
Class : MoreThan
Description : Comparator ">"
*/
class MoreThan: public virtual Comparator{
public:
virtual bool IsSatisfy( long theElementId );
};
/*
Class : EqualTo
Description : Comparator "="
*/
class EqualTo: public virtual Comparator{
public:
EqualTo();
virtual bool IsSatisfy( long theElementId );
virtual void SetTolerance( double theTol );
virtual double GetTolerance();
private:
double myToler;
};
typedef boost::shared_ptr<EqualTo> EqualToPtr;
/*
Class : LogicalNOT
Description : Logical NOT predicate
*/
class LogicalNOT: public virtual Predicate{
public:
LogicalNOT();
virtual ~LogicalNOT();
virtual bool IsSatisfy( long theElementId );
virtual void SetMesh( SMDS_Mesh* theMesh );
virtual void SetPredicate(PredicatePtr thePred);
virtual SMDSAbs_ElementType GetType() const;
private:
PredicatePtr myPredicate;
};
typedef boost::shared_ptr<LogicalNOT> LogicalNOTPtr;
/*
Class : LogicalBinary
Description : Base class for binary logical predicate
*/
class LogicalBinary: public virtual Predicate{
public:
LogicalBinary();
virtual ~LogicalBinary();
virtual void SetMesh( SMDS_Mesh* theMesh );
virtual void SetPredicate1(PredicatePtr thePred);
virtual void SetPredicate2(PredicatePtr thePred);
virtual SMDSAbs_ElementType GetType() const;
protected:
PredicatePtr myPredicate1;
PredicatePtr myPredicate2;
};
typedef boost::shared_ptr<LogicalBinary> LogicalBinaryPtr;
/*
Class : LogicalAND
Description : Logical AND
*/
class LogicalAND: public virtual LogicalBinary{
public:
virtual bool IsSatisfy( long theElementId );
};
/*
Class : LogicalOR
Description : Logical OR
*/
class LogicalOR: public virtual LogicalBinary{
public:
virtual bool IsSatisfy( long theElementId );
};
/*
Class : ManifoldPart
Description : Predicate for manifold part of mesh
*/
class ManifoldPart: public virtual Predicate{
public:
/* internal class for algorithm uses */
class Link
{
public:
Link( SMDS_MeshNode* theNode1,
SMDS_MeshNode* theNode2 );
~Link();
bool IsEqual( const ManifoldPart::Link& theLink ) const;
bool operator<(const ManifoldPart::Link& x) const;
SMDS_MeshNode* myNode1;
SMDS_MeshNode* myNode2;
};
bool IsEqual( const ManifoldPart::Link& theLink1,
const ManifoldPart::Link& theLink2 );
typedef std::set<ManifoldPart::Link> TMapOfLink;
typedef std::vector<SMDS_MeshFace*> TVectorOfFacePtr;
typedef std::vector<ManifoldPart::Link> TVectorOfLink;
typedef std::map<SMDS_MeshFace*,int> TDataMapFacePtrInt;
typedef std::map<ManifoldPart::Link,SMDS_MeshFace*> TDataMapOfLinkFacePtr;
ManifoldPart();
~ManifoldPart();
virtual void SetMesh( SMDS_Mesh* theMesh );
// inoke when all parameters already set
virtual bool IsSatisfy( long theElementId );
virtual SMDSAbs_ElementType GetType() const;
void SetAngleTolerance( const double theAngToler );
double GetAngleTolerance() const;
void SetIsOnlyManifold( const bool theIsOnly );
void SetStartElem( const long theStartElemId );
private:
bool process();
bool findConnected( const TDataMapFacePtrInt& theAllFacePtrInt,
SMDS_MeshFace* theStartFace,
TMapOfLink& theNonManifold,
TColStd_MapOfInteger& theResFaces );
bool isInPlane( const SMDS_MeshFace* theFace1,
const SMDS_MeshFace* theFace2 );
void expandBoundary( TMapOfLink& theMapOfBoundary,
TVectorOfLink& theSeqOfBoundary,
TDataMapOfLinkFacePtr& theDMapLinkFacePtr,
TMapOfLink& theNonManifold,
SMDS_MeshFace* theNextFace ) const;
void getFacesByLink( const Link& theLink,
TVectorOfFacePtr& theFaces ) const;
private:
SMDS_Mesh* myMesh;
TColStd_MapOfInteger myMapIds;
TColStd_MapOfInteger myMapBadGeomIds;
TVectorOfFacePtr myAllFacePtr;
TDataMapFacePtrInt myAllFacePtrIntDMap;
double myAngToler;
bool myIsOnlyManifold;
long myStartElemId;
};
typedef boost::shared_ptr<ManifoldPart> ManifoldPartPtr;
/*
Class : ElementsOnSurface
Description : Predicate elements that lying on indicated surface
(plane or cylinder)
*/
class ElementsOnSurface : public virtual Predicate {
public:
ElementsOnSurface();
~ElementsOnSurface();
virtual void SetMesh( SMDS_Mesh* theMesh );
virtual bool IsSatisfy( long theElementId );
virtual SMDSAbs_ElementType GetType() const;
void SetTolerance( const double theToler );
double GetTolerance() const;
void SetSurface( const TopoDS_Shape& theShape,
const SMDSAbs_ElementType theType );
private:
void process();
void process( const SMDS_MeshElement* theElem );
bool isOnSurface( const SMDS_MeshNode* theNode ) const;
private:
SMDS_Mesh* myMesh;
TColStd_MapOfInteger myIds;
SMDSAbs_ElementType myType;
Handle(Geom_Surface) mySurf;
double myToler;
};
typedef boost::shared_ptr<ElementsOnSurface> ElementsOnSurfacePtr;
/*
FILTER
*/
class Filter{
public:
Filter();
virtual ~Filter();
virtual void SetPredicate(PredicatePtr thePred);
typedef std::vector<long> TIdSequence;
virtual TIdSequence GetElementsId( SMDS_Mesh* theMesh );
protected:
PredicatePtr myPredicate;
};
};
};
#endif

View File

@ -49,9 +49,9 @@ LIB_CLIENT_IDL =
LIB_SERVER_IDL = LIB_SERVER_IDL =
# additionnal information to compil and link file # additionnal information to compil and link file
CPPFLAGS += -I${KERNEL_ROOT_DIR}/include/salome $(BOOST_CPPFLAGS) CPPFLAGS += -I${KERNEL_ROOT_DIR}/include/salome $(OCC_INCLUDES) $(BOOST_CPPFLAGS)
CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome
LDFLAGS += -lMeshDriver LDFLAGS += -lMeshDriver $(OCC_KERNEL_LIBS)
LDFLAGSFORBIN += -lMeshDriver -lSMDS -L${KERNEL_ROOT_DIR}/lib/salome -lOpUtil -lSALOMELocalTrace LDFLAGSFORBIN += -lMeshDriver -lSMDS -L${KERNEL_ROOT_DIR}/lib/salome -lOpUtil -lSALOMELocalTrace

View File

@ -26,6 +26,8 @@
// $Header$ // $Header$
#include "DriverMED_Family.h" #include "DriverMED_Family.h"
#include "MED_Factory.hxx"
#include <sstream> #include <sstream>
using namespace std; using namespace std;
@ -204,8 +206,9 @@ list<DriverMED_FamilyPtr> DriverMED_Family::MakeFamilies
* Create TFamilyInfo for this family * Create TFamilyInfo for this family
*/ */
//============================================================================= //=============================================================================
MEDA::PFamilyInfo DriverMED_Family::GetFamilyInfo MED::PFamilyInfo
(const MEDA::PMeshInfo& theMeshInfo) const DriverMED_Family::GetFamilyInfo(const MED::PWrapper& theWrapper,
const MED::PMeshInfo& theMeshInfo) const
{ {
string aValue; string aValue;
ostringstream aStr; ostringstream aStr;
@ -215,11 +218,13 @@ MEDA::PFamilyInfo DriverMED_Family::GetFamilyInfo
MED::TIntVector anAttrIds (1, myId); // Id=0, MED::TIntVector anAttrIds (1, myId); // Id=0,
MED::TIntVector anAttrVals (1, myId); // Value=0 MED::TIntVector anAttrVals (1, myId); // Value=0
MEDA::PFamilyInfo anInfo = MEDA::TWrapper::CrFamilyInfo(theMeshInfo, MED::PFamilyInfo anInfo = theWrapper->CrFamilyInfo(theMeshInfo,
aValue, aValue,
myId, myId,
myGroupNames, myGroupNames,
anAttrDescs,anAttrIds,anAttrVals); anAttrDescs,
anAttrIds,
anAttrVals);
// cout << endl; // cout << endl;
// cout << "Groups: "; // cout << "Groups: ";

View File

@ -31,7 +31,7 @@
#include "SMDS_Mesh.hxx" #include "SMDS_Mesh.hxx"
#include "SMESHDS_GroupBase.hxx" #include "SMESHDS_GroupBase.hxx"
#include "SMESHDS_SubMesh.hxx" #include "SMESHDS_SubMesh.hxx"
#include "MEDA_Wrapper.hxx" #include "MED_Common.hxx"
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
#include <set> #include <set>
@ -63,7 +63,8 @@ class DriverMED_Family
// from <theGroups> and other sub-meshes from <theSubMeshes>. // from <theGroups> and other sub-meshes from <theSubMeshes>.
// Resulting families have no common elements. // Resulting families have no common elements.
MEDA::PFamilyInfo GetFamilyInfo (const MEDA::PMeshInfo& theMeshInfo) const; MED::PFamilyInfo GetFamilyInfo (const MED::PWrapper& theWrapper,
const MED::PMeshInfo& theMeshInfo) const;
// Create TFamilyInfo for this family // Create TFamilyInfo for this family
const std::set<const SMDS_MeshElement *>& GetElements () const { return myElements; } const std::set<const SMDS_MeshElement *>& GetElements () const { return myElements; }

View File

@ -33,20 +33,22 @@
#include "SMESHDS_Group.hxx" #include "SMESHDS_Group.hxx"
#include "MEDA_Wrapper.hxx" #include "MED_Factory.hxx"
#include "MED_Utilities.hxx" #include "MED_Utilities.hxx"
#include <stdlib.h> #include <stdlib.h>
#define _EDF_NODE_IDS_ #define _EDF_NODE_IDS_
using namespace MED;
void DriverMED_R_SMESHDS_Mesh::SetMeshName(string theMeshName) void DriverMED_R_SMESHDS_Mesh::SetMeshName(string theMeshName)
{ {
myMeshName = theMeshName; myMeshName = theMeshName;
} }
static const SMDS_MeshNode* static const SMDS_MeshNode*
FindNode(const SMDS_Mesh* theMesh, med_int theId){ FindNode(const SMDS_Mesh* theMesh, TInt theId){
const SMDS_MeshNode* aNode = theMesh->FindNode(theId); const SMDS_MeshNode* aNode = theMesh->FindNode(theId);
if(aNode) return aNode; if(aNode) return aNode;
EXCEPTION(runtime_error,"SMDS_Mesh::FindNode - cannot find a SMDS_MeshNode for ID = "<<theId); EXCEPTION(runtime_error,"SMDS_Mesh::FindNode - cannot find a SMDS_MeshNode for ID = "<<theId);
@ -54,15 +56,15 @@ FindNode(const SMDS_Mesh* theMesh, med_int theId){
enum ECoordName{eX, eY, eZ, eNone}; enum ECoordName{eX, eY, eZ, eNone};
typedef med_float (*TGetCoord)(MEDA::PNodeInfo&, med_int); typedef TFloat (*TGetCoord)(MED::PNodeInfo&, TInt);
template<ECoordName TheCoordId> template<ECoordName TheCoordId>
med_float GetCoord(MEDA::PNodeInfo& thePNodeInfo, med_int theElemId){ TFloat GetCoord(MED::PNodeInfo& thePNodeInfo, TInt theElemId){
return thePNodeInfo->GetNodeCoord(theElemId,TheCoordId); return thePNodeInfo->GetNodeCoord(theElemId,TheCoordId);
} }
template<> template<>
med_float GetCoord<eNone>(MEDA::PNodeInfo& thePNodeInfo, med_int theElemId){ TFloat GetCoord<eNone>(MED::PNodeInfo& thePNodeInfo, TInt theElemId){
return 0.0; return 0.0;
} }
@ -113,16 +115,16 @@ static TGetCoord aZGetCoord[3] = {
class TCoordHelper{ class TCoordHelper{
MEDA::PNodeInfo myPNodeInfo; MED::PNodeInfo myPNodeInfo;
TGetCoord* myGetCoord; TGetCoord* myGetCoord;
public: public:
TCoordHelper(const MEDA::PNodeInfo& thePNodeInfo, TCoordHelper(const MED::PNodeInfo& thePNodeInfo,
TGetCoord* theGetCoord): TGetCoord* theGetCoord):
myPNodeInfo(thePNodeInfo), myPNodeInfo(thePNodeInfo),
myGetCoord(theGetCoord) myGetCoord(theGetCoord)
{} {}
virtual ~TCoordHelper(){} virtual ~TCoordHelper(){}
med_float GetCoord(med_int theElemId, med_int theCoodId){ TFloat GetCoord(TInt theElemId, TInt theCoodId){
return (*myGetCoord[theCoodId])(myPNodeInfo,theElemId); return (*myGetCoord[theCoodId])(myPNodeInfo,theElemId);
} }
}; };
@ -133,18 +135,16 @@ Driver_Mesh::Status DriverMED_R_SMESHDS_Mesh::Perform()
{ {
Status aResult = DRS_FAIL; Status aResult = DRS_FAIL;
try{ try{
using namespace MEDA;
myFamilies.clear(); myFamilies.clear();
MESSAGE("Perform - myFile : "<<myFile); MESSAGE("Perform - myFile : "<<myFile);
TWrapper aMed(myFile); PWrapper aMed = CrWrapper(myFile);
aResult = DRS_EMPTY; aResult = DRS_EMPTY;
if(med_int aNbMeshes = aMed.GetNbMeshes()){ if(TInt aNbMeshes = aMed->GetNbMeshes()){
for(int iMesh = 0; iMesh < aNbMeshes; iMesh++){ for(int iMesh = 0; iMesh < aNbMeshes; iMesh++){
// Reading the MED mesh // Reading the MED mesh
//--------------------- //---------------------
PMeshInfo aMeshInfo = aMed.GetMeshInfo(iMesh); PMeshInfo aMeshInfo = aMed->GetPMeshInfo(iMesh+1);
string aMeshName; string aMeshName;
if (myMeshId != -1) { if (myMeshId != -1) {
ostringstream aMeshNameStr; ostringstream aMeshNameStr;
@ -156,22 +156,22 @@ Driver_Mesh::Status DriverMED_R_SMESHDS_Mesh::Perform()
MESSAGE("Perform - aMeshName : "<<aMeshName<<"; "<<aMeshInfo->GetName()); MESSAGE("Perform - aMeshName : "<<aMeshName<<"; "<<aMeshInfo->GetName());
if(aMeshName != aMeshInfo->GetName()) continue; if(aMeshName != aMeshInfo->GetName()) continue;
aResult = DRS_OK; aResult = DRS_OK;
med_int aMeshDim = aMeshInfo->GetDim(); //TInt aMeshDim = aMeshInfo->GetDim();
// Reading MED families to the temporary structure // Reading MED families to the temporary structure
//------------------------------------------------ //------------------------------------------------
med_int aNbFams = aMed.GetNbFamilies(aMeshInfo); TInt aNbFams = aMed->GetNbFamilies(aMeshInfo);
MESSAGE("Read " << aNbFams << " families"); MESSAGE("Read " << aNbFams << " families");
for (med_int iFam = 0; iFam < aNbFams; iFam++) { for (TInt iFam = 0; iFam < aNbFams; iFam++) {
PFamilyInfo aFamilyInfo = aMed.GetFamilyInfo(aMeshInfo, iFam); PFamilyInfo aFamilyInfo = aMed->GetPFamilyInfo(aMeshInfo, iFam+1);
med_int aFamId = aFamilyInfo->GetId(); TInt aFamId = aFamilyInfo->GetId();
MESSAGE("Family " << aFamId << " :"); MESSAGE("Family " << aFamId << " :");
DriverMED_FamilyPtr aFamily (new DriverMED_Family); DriverMED_FamilyPtr aFamily (new DriverMED_Family);
med_int aNbGrp = aFamilyInfo->GetNbGroup(); TInt aNbGrp = aFamilyInfo->GetNbGroup();
MESSAGE("belong to " << aNbGrp << " groups"); MESSAGE("belong to " << aNbGrp << " groups");
for (med_int iGr = 0; iGr < aNbGrp; iGr++) { for (TInt iGr = 0; iGr < aNbGrp; iGr++) {
string aGroupName = aFamilyInfo->GetGroupName(iGr); string aGroupName = aFamilyInfo->GetGroupName(iGr);
MESSAGE(aGroupName); MESSAGE(aGroupName);
aFamily->AddGroupName(aGroupName); aFamily->AddGroupName(aGroupName);
@ -181,13 +181,13 @@ Driver_Mesh::Status DriverMED_R_SMESHDS_Mesh::Perform()
// Reading MED nodes to the corresponding SMDS structure // Reading MED nodes to the corresponding SMDS structure
//------------------------------------------------------ //------------------------------------------------------
PNodeInfo aNodeInfo = aMed.GetNodeInfo(aMeshInfo); PNodeInfo aNodeInfo = aMed->GetPNodeInfo(aMeshInfo);
TCoordHelperPtr aCoordHelperPtr; TCoordHelperPtr aCoordHelperPtr;
{ {
med_int aMeshDimension = aMeshInfo->GetDim(); TInt aMeshDimension = aMeshInfo->GetDim();
bool anIsDimPresent[3] = {false, false, false}; bool anIsDimPresent[3] = {false, false, false};
for(med_int iDim = 0; iDim < aMeshDimension; iDim++){ for(TInt iDim = 0; iDim < aMeshDimension; iDim++){
string aDimName = aNodeInfo->GetCoordName(iDim); string aDimName = aNodeInfo->GetCoordName(iDim);
if(aDimName == "x" || aDimName == "X") if(aDimName == "x" || aDimName == "X")
anIsDimPresent[eX] = true; anIsDimPresent[eX] = true;
@ -219,12 +219,12 @@ Driver_Mesh::Status DriverMED_R_SMESHDS_Mesh::Perform()
} }
} }
med_booleen anIsNodeNum = aNodeInfo->IsElemNum(); EBooleen anIsNodeNum = aNodeInfo->IsElemNum();
med_int aNbElems = aNodeInfo->GetNbElem(); TInt aNbElems = aNodeInfo->GetNbElem();
MESSAGE("Perform - aNodeInfo->GetNbElem() = "<<aNbElems<<"; anIsNodeNum = "<<anIsNodeNum); MESSAGE("Perform - aNodeInfo->GetNbElem() = "<<aNbElems<<"; anIsNodeNum = "<<anIsNodeNum);
for(med_int iElem = 0; iElem < aNbElems; iElem++){ for(TInt iElem = 0; iElem < aNbElems; iElem++){
double aCoords[3] = {0.0, 0.0, 0.0}; double aCoords[3] = {0.0, 0.0, 0.0};
for(med_int iDim = 0; iDim < 3; iDim++) for(TInt iDim = 0; iDim < 3; iDim++)
aCoords[iDim] = aCoordHelperPtr->GetCoord(iElem,iDim); aCoords[iDim] = aCoordHelperPtr->GetCoord(iElem,iDim);
const SMDS_MeshNode* aNode; const SMDS_MeshNode* aNode;
if(anIsNodeNum) { if(anIsNodeNum) {
@ -237,7 +237,7 @@ Driver_Mesh::Status DriverMED_R_SMESHDS_Mesh::Perform()
//cout<<aNode->GetID()<<": "<<aNode->X()<<", "<<aNode->Y()<<", "<<aNode->Z()<<endl; //cout<<aNode->GetID()<<": "<<aNode->X()<<", "<<aNode->Y()<<", "<<aNode->Z()<<endl;
// Save reference to this node from its family // Save reference to this node from its family
med_int aFamNum = aNodeInfo->GetFamNum(iElem); TInt aFamNum = aNodeInfo->GetFamNum(iElem);
if (myFamilies.find(aFamNum) != myFamilies.end()) if (myFamilies.find(aFamNum) != myFamilies.end())
{ {
myFamilies[aFamNum]->AddElement(aNode); myFamilies[aFamNum]->AddElement(aNode);
@ -248,58 +248,58 @@ Driver_Mesh::Status DriverMED_R_SMESHDS_Mesh::Perform()
// Reading pre information about all MED cells // Reading pre information about all MED cells
//-------------------------------------------- //--------------------------------------------
bool takeNumbers = true; // initially we trust the numbers from file bool takeNumbers = true; // initially we trust the numbers from file
MED::TEntityInfo aEntityInfo = aMed.GetEntityInfo(aMeshInfo); MED::TEntityInfo aEntityInfo = aMed->GetEntityInfo(aMeshInfo);
MED::TEntityInfo::iterator anEntityIter = aEntityInfo.begin(); MED::TEntityInfo::iterator anEntityIter = aEntityInfo.begin();
for(; anEntityIter != aEntityInfo.end(); anEntityIter++){ for(; anEntityIter != aEntityInfo.end(); anEntityIter++){
const med_entite_maillage& anEntity = anEntityIter->first; const EEntiteMaillage& anEntity = anEntityIter->first;
if(anEntity == MED_NOEUD) continue; if(anEntity == eNOEUD) continue;
// Reading MED cells to the corresponding SMDS structure // Reading MED cells to the corresponding SMDS structure
//------------------------------------------------------ //------------------------------------------------------
const MED::TGeom& aTGeom = anEntityIter->second; const MED::TGeom& aTGeom = anEntityIter->second;
MED::TGeom::const_iterator anTGeomIter = aTGeom.begin(); MED::TGeom::const_iterator anTGeomIter = aTGeom.begin();
for(; anTGeomIter != aTGeom.end(); anTGeomIter++){ for(; anTGeomIter != aTGeom.end(); anTGeomIter++){
const med_geometrie_element& aGeom = anTGeomIter->first; const EGeometrieElement& aGeom = anTGeomIter->first;
if(aGeom == MED_POINT1) continue; if(aGeom == ePOINT1) continue;
PCellInfo aCellInfo = aMed.GetCellInfo(aMeshInfo,anEntity,aGeom); PCellInfo aCellInfo = aMed->GetPCellInfo(aMeshInfo,anEntity,aGeom);
med_booleen anIsElemNum = takeNumbers ? aCellInfo->IsElemNum() : MED_FAUX; EBooleen anIsElemNum = takeNumbers ? aCellInfo->IsElemNum() : eFAUX;
med_int aNbElems = aCellInfo->GetNbElem(); TInt aNbElems = aCellInfo->GetNbElem();
MESSAGE("Perform - anEntity = "<<anEntity<<"; anIsElemNum = "<<anIsElemNum); MESSAGE("Perform - anEntity = "<<anEntity<<"; anIsElemNum = "<<anIsElemNum);
MESSAGE("Perform - aGeom = "<<aGeom<<"; aNbElems = "<<aNbElems); MESSAGE("Perform - aGeom = "<<aGeom<<"; aNbElems = "<<aNbElems);
for(int iElem = 0; iElem < aNbElems; iElem++){ for(int iElem = 0; iElem < aNbElems; iElem++){
med_int aNbNodes = -1; TInt aNbNodes = -1;
switch(aGeom){ switch(aGeom){
case MED_SEG2: case eSEG2:
case MED_SEG3: case eSEG3:
aNbNodes = 2; aNbNodes = 2;
break; break;
case MED_TRIA3: case eTRIA3:
case MED_TRIA6: case eTRIA6:
aNbNodes = 3; aNbNodes = 3;
break; break;
break; break;
case MED_QUAD4: case eQUAD4:
case MED_QUAD8: case eQUAD8:
aNbNodes = 4; aNbNodes = 4;
break; break;
case MED_TETRA4: case eTETRA4:
case MED_TETRA10: case eTETRA10:
aNbNodes = 4; aNbNodes = 4;
break; break;
case MED_PYRA5: case ePYRA5:
case MED_PYRA13: case ePYRA13:
aNbNodes = 5; aNbNodes = 5;
break; break;
case MED_PENTA6: case ePENTA6:
case MED_PENTA15: case ePENTA15:
aNbNodes = 6; aNbNodes = 6;
break; break;
case MED_HEXA8: case eHEXA8:
case MED_HEXA20: case eHEXA20:
aNbNodes = 8; aNbNodes = 8;
break; break;
} }
vector<med_int> aNodeIds(aNbNodes); vector<TInt> aNodeIds(aNbNodes);
#ifdef _EDF_NODE_IDS_ #ifdef _EDF_NODE_IDS_
if(anIsNodeNum) { if(anIsNodeNum) {
for(int i = 0; i < aNbNodes; i++){ for(int i = 0; i < aNbNodes; i++){
@ -318,11 +318,11 @@ Driver_Mesh::Status DriverMED_R_SMESHDS_Mesh::Perform()
bool isRenum = false; bool isRenum = false;
SMDS_MeshElement* anElement = NULL; SMDS_MeshElement* anElement = NULL;
med_int aFamNum = aCellInfo->GetFamNum(iElem); TInt aFamNum = aCellInfo->GetFamNum(iElem);
try{ try{
switch(aGeom){ switch(aGeom){
case MED_SEG2: case eSEG2:
case MED_SEG3: case eSEG3:
if(anIsElemNum) if(anIsElemNum)
anElement = myMesh->AddEdgeWithID(aNodeIds[0], anElement = myMesh->AddEdgeWithID(aNodeIds[0],
aNodeIds[1], aNodeIds[1],
@ -333,8 +333,8 @@ Driver_Mesh::Status DriverMED_R_SMESHDS_Mesh::Perform()
isRenum = anIsElemNum; isRenum = anIsElemNum;
} }
break; break;
case MED_TRIA3: case eTRIA3:
case MED_TRIA6: case eTRIA6:
aNbNodes = 3; aNbNodes = 3;
if(anIsElemNum) if(anIsElemNum)
anElement = myMesh->AddFaceWithID(aNodeIds[0], anElement = myMesh->AddFaceWithID(aNodeIds[0],
@ -348,8 +348,8 @@ Driver_Mesh::Status DriverMED_R_SMESHDS_Mesh::Perform()
isRenum = anIsElemNum; isRenum = anIsElemNum;
} }
break; break;
case MED_QUAD4: case eQUAD4:
case MED_QUAD8: case eQUAD8:
aNbNodes = 4; aNbNodes = 4;
// There is some differnce between SMDS and MED // There is some differnce between SMDS and MED
if(anIsElemNum) if(anIsElemNum)
@ -366,8 +366,8 @@ Driver_Mesh::Status DriverMED_R_SMESHDS_Mesh::Perform()
isRenum = anIsElemNum; isRenum = anIsElemNum;
} }
break; break;
case MED_TETRA4: case eTETRA4:
case MED_TETRA10: case eTETRA10:
aNbNodes = 4; aNbNodes = 4;
if(anIsElemNum) if(anIsElemNum)
anElement = myMesh->AddVolumeWithID(aNodeIds[0], anElement = myMesh->AddVolumeWithID(aNodeIds[0],
@ -383,8 +383,8 @@ Driver_Mesh::Status DriverMED_R_SMESHDS_Mesh::Perform()
isRenum = anIsElemNum; isRenum = anIsElemNum;
} }
break; break;
case MED_PYRA5: case ePYRA5:
case MED_PYRA13: case ePYRA13:
aNbNodes = 5; aNbNodes = 5;
// There is some differnce between SMDS and MED // There is some differnce between SMDS and MED
if(anIsElemNum) if(anIsElemNum)
@ -403,8 +403,8 @@ Driver_Mesh::Status DriverMED_R_SMESHDS_Mesh::Perform()
isRenum = anIsElemNum; isRenum = anIsElemNum;
} }
break; break;
case MED_PENTA6: case ePENTA6:
case MED_PENTA15: case ePENTA15:
aNbNodes = 6; aNbNodes = 6;
if(anIsElemNum) if(anIsElemNum)
anElement = myMesh->AddVolumeWithID(aNodeIds[0], anElement = myMesh->AddVolumeWithID(aNodeIds[0],
@ -424,8 +424,8 @@ Driver_Mesh::Status DriverMED_R_SMESHDS_Mesh::Perform()
isRenum = anIsElemNum; isRenum = anIsElemNum;
} }
break; break;
case MED_HEXA8: case eHEXA8:
case MED_HEXA20: case eHEXA20:
aNbNodes = 8; aNbNodes = 8;
if(anIsElemNum) if(anIsElemNum)
anElement = myMesh->AddVolumeWithID(aNodeIds[0], anElement = myMesh->AddVolumeWithID(aNodeIds[0],
@ -463,7 +463,7 @@ Driver_Mesh::Status DriverMED_R_SMESHDS_Mesh::Perform()
} }
else { else {
if (isRenum) { if (isRenum) {
anIsElemNum = MED_FAUX; anIsElemNum = eFAUX;
takeNumbers = false; takeNumbers = false;
if (aResult < DRS_WARN_RENUMBER) if (aResult < DRS_WARN_RENUMBER)
aResult = DRS_WARN_RENUMBER; aResult = DRS_WARN_RENUMBER;
@ -496,17 +496,15 @@ list<string> DriverMED_R_SMESHDS_Mesh::GetMeshNames(Status& theStatus)
list<string> aMeshNames; list<string> aMeshNames;
try { try {
using namespace MEDA;
MESSAGE("GetMeshNames - myFile : " << myFile); MESSAGE("GetMeshNames - myFile : " << myFile);
theStatus = DRS_OK; theStatus = DRS_OK;
TWrapper aMed (myFile); PWrapper aMed = CrWrapper(myFile);
if (med_int aNbMeshes = aMed.GetNbMeshes()) { if (TInt aNbMeshes = aMed->GetNbMeshes()) {
for (int iMesh = 0; iMesh < aNbMeshes; iMesh++) { for (int iMesh = 0; iMesh < aNbMeshes; iMesh++) {
// Reading the MED mesh // Reading the MED mesh
//--------------------- //---------------------
PMeshInfo aMeshInfo = aMed.GetMeshInfo(iMesh); PMeshInfo aMeshInfo = aMed->GetPMeshInfo(iMesh+1);
aMeshNames.push_back(aMeshInfo->GetName()); aMeshNames.push_back(aMeshInfo->GetName());
} }
} }

View File

@ -35,13 +35,15 @@
#include "SMDS_MeshNode.hxx" #include "SMDS_MeshNode.hxx"
#include "utilities.h" #include "utilities.h"
#include "MEDA_Wrapper.hxx" #include "MED_Factory.hxx"
#include "MED_Utilities.hxx" #include "MED_Utilities.hxx"
#define _EDF_NODE_IDS_ #define _EDF_NODE_IDS_
//#define _ELEMENTS_BY_DIM_ //#define _ELEMENTS_BY_DIM_
using namespace std; using namespace std;
using namespace MED;
DriverMED_W_SMESHDS_Mesh::DriverMED_W_SMESHDS_Mesh(): DriverMED_W_SMESHDS_Mesh::DriverMED_W_SMESHDS_Mesh():
myAllSubMeshes (false), myAllSubMeshes (false),
@ -51,6 +53,17 @@ DriverMED_W_SMESHDS_Mesh::DriverMED_W_SMESHDS_Mesh():
myDoGroupOfVolumes (false) myDoGroupOfVolumes (false)
{} {}
void DriverMED_W_SMESHDS_Mesh::SetFile(const std::string& theFileName, MED::EVersion theId)
{
myMed = CrWrapper(theFileName,theId);
Driver_SMESHDS_Mesh::SetFile(theFileName);
}
void DriverMED_W_SMESHDS_Mesh::SetFile(const std::string& theFileName)
{
return SetFile(theFileName,MED::eV2_1);
}
void DriverMED_W_SMESHDS_Mesh::SetMeshName(const std::string& theMeshName) void DriverMED_W_SMESHDS_Mesh::SetMeshName(const std::string& theMeshName)
{ {
myMeshName = theMeshName; myMeshName = theMeshName;
@ -91,62 +104,63 @@ void DriverMED_W_SMESHDS_Mesh::AddGroupOfVolumes()
myDoGroupOfVolumes = true; myDoGroupOfVolumes = true;
} }
typedef double (SMDS_MeshNode::* TGetCoord)() const; namespace{
typedef const char* TName; typedef double (SMDS_MeshNode::* TGetCoord)() const;
typedef const char* TUnit; typedef const char* TName;
typedef const char* TUnit;
static TUnit aUnit[3] = {"m","m","m"}; TUnit aUnit[3] = {"m","m","m"};
static TGetCoord aXYZGetCoord[3] = { TGetCoord aXYZGetCoord[3] = {
&SMDS_MeshNode::X, &SMDS_MeshNode::X,
&SMDS_MeshNode::Y, &SMDS_MeshNode::Y,
&SMDS_MeshNode::Z &SMDS_MeshNode::Z
}; };
static TName aXYZName[3] = {"x","y","z"}; TName aXYZName[3] = {"x","y","z"};
static TGetCoord aXYGetCoord[2] = { TGetCoord aXYGetCoord[2] = {
&SMDS_MeshNode::X, &SMDS_MeshNode::X,
&SMDS_MeshNode::Y &SMDS_MeshNode::Y
}; };
static TName aXYName[2] = {"x","y"}; TName aXYName[2] = {"x","y"};
static TGetCoord aYZGetCoord[2] = { TGetCoord aYZGetCoord[2] = {
&SMDS_MeshNode::Y, &SMDS_MeshNode::Y,
&SMDS_MeshNode::Z &SMDS_MeshNode::Z
}; };
static TName aYZName[2] = {"y","z"}; TName aYZName[2] = {"y","z"};
static TGetCoord aXZGetCoord[2] = { TGetCoord aXZGetCoord[2] = {
&SMDS_MeshNode::X, &SMDS_MeshNode::X,
&SMDS_MeshNode::Z &SMDS_MeshNode::Z
}; };
static TName aXZName[2] = {"x","z"}; TName aXZName[2] = {"x","z"};
static TGetCoord aXGetCoord[1] = { TGetCoord aXGetCoord[1] = {
&SMDS_MeshNode::X &SMDS_MeshNode::X
}; };
static TName aXName[1] = {"x"}; TName aXName[1] = {"x"};
static TGetCoord aYGetCoord[1] = { TGetCoord aYGetCoord[1] = {
&SMDS_MeshNode::Y &SMDS_MeshNode::Y
}; };
static TName aYName[1] = {"y"}; TName aYName[1] = {"y"};
static TGetCoord aZGetCoord[1] = { TGetCoord aZGetCoord[1] = {
&SMDS_MeshNode::Z &SMDS_MeshNode::Z
}; };
static TName aZName[1] = {"z"}; TName aZName[1] = {"z"};
class TCoordHelper{ class TCoordHelper{
SMDS_NodeIteratorPtr myNodeIter; SMDS_NodeIteratorPtr myNodeIter;
const SMDS_MeshNode* myCurrentNode; const SMDS_MeshNode* myCurrentNode;
TGetCoord* myGetCoord; TGetCoord* myGetCoord;
TName* myName; TName* myName;
TUnit* myUnit; TUnit* myUnit;
public: public:
TCoordHelper(const SMDS_NodeIteratorPtr& theNodeIter, TCoordHelper(const SMDS_NodeIteratorPtr& theNodeIter,
TGetCoord* theGetCoord, TGetCoord* theGetCoord,
TName* theName, TName* theName,
@ -167,17 +181,19 @@ public:
MED::TIntVector::value_type GetID(){ MED::TIntVector::value_type GetID(){
return myCurrentNode->GetID(); return myCurrentNode->GetID();
} }
MED::TFloatVector::value_type GetCoord(med_int theCoodId){ MED::TFloatVector::value_type GetCoord(TInt theCoodId){
return (myCurrentNode->*myGetCoord[theCoodId])(); return (myCurrentNode->*myGetCoord[theCoodId])();
} }
MED::TStringVector::value_type GetName(med_int theDimId){ MED::TStringVector::value_type GetName(TInt theDimId){
return myName[theDimId]; return myName[theDimId];
} }
MED::TStringVector::value_type GetUnit(med_int theDimId){ MED::TStringVector::value_type GetUnit(TInt theDimId){
return myUnit[theDimId]; return myUnit[theDimId];
} }
}; };
typedef boost::shared_ptr<TCoordHelper> TCoordHelperPtr; typedef boost::shared_ptr<TCoordHelper> TCoordHelperPtr;
}
Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform() Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
@ -188,11 +204,7 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
return DRS_FAIL; return DRS_FAIL;
} }
try{ try{
using namespace MEDA;
using namespace boost;
MESSAGE("Perform - myFile : "<<myFile); MESSAGE("Perform - myFile : "<<myFile);
TWrapper aMed(myFile);
// Creating the MED mesh for corresponding SMDS structure // Creating the MED mesh for corresponding SMDS structure
//------------------------------------------------------- //-------------------------------------------------------
@ -206,7 +218,7 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
} }
// Mesh dimension definition // Mesh dimension definition
med_int aMeshDimension; TInt aMeshDimension;
TCoordHelperPtr aCoordHelperPtr; TCoordHelperPtr aCoordHelperPtr;
{ {
bool anIsXDimension = false; bool anIsXDimension = false;
@ -237,7 +249,6 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
anIsXDimension = (aBounds[1] - aBounds[0]) + abs(aBounds[1]) + abs(aBounds[0]) > EPS; anIsXDimension = (aBounds[1] - aBounds[0]) + abs(aBounds[1]) + abs(aBounds[0]) > EPS;
anIsYDimension = (aBounds[3] - aBounds[2]) + abs(aBounds[3]) + abs(aBounds[2]) > EPS; anIsYDimension = (aBounds[3] - aBounds[2]) + abs(aBounds[3]) + abs(aBounds[2]) > EPS;
anIsZDimension = (aBounds[5] - aBounds[4]) + abs(aBounds[5]) + abs(aBounds[4]) > EPS; anIsZDimension = (aBounds[5] - aBounds[4]) + abs(aBounds[5]) + abs(aBounds[4]) > EPS;
aMeshDimension = anIsXDimension + anIsYDimension + anIsZDimension; aMeshDimension = anIsXDimension + anIsYDimension + anIsZDimension;
if(!aMeshDimension) if(!aMeshDimension)
aMeshDimension = 3; aMeshDimension = 3;
@ -268,9 +279,9 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
} }
PMeshInfo aMeshInfo = TWrapper::CrMeshInfo(aMeshDimension,aMeshName); PMeshInfo aMeshInfo = myMed->CrMeshInfo(aMeshDimension,aMeshName);
MESSAGE("Add - aMeshName : "<<aMeshName<<"; "<<aMeshInfo->GetName()); MESSAGE("Add - aMeshName : "<<aMeshName<<"; "<<aMeshInfo->GetName());
aMed.SetMeshInfo(aMeshInfo); myMed->SetMeshInfo(aMeshInfo);
// Storing SMDS groups and sub-meshes // Storing SMDS groups and sub-meshes
//----------------------------------- //-----------------------------------
@ -303,8 +314,8 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
for (; aFamsIter != aFamilies.end(); aFamsIter++) for (; aFamsIter != aFamilies.end(); aFamsIter++)
{ {
PFamilyInfo aFamilyInfo = (*aFamsIter)->GetFamilyInfo(aMeshInfo); PFamilyInfo aFamilyInfo = (*aFamsIter)->GetFamilyInfo(myMed,aMeshInfo);
aMed.SetFamilyInfo(aFamilyInfo); myMed->SetFamilyInfo(aFamilyInfo);
int aFamId = (*aFamsIter)->GetId(); int aFamId = (*aFamsIter)->GetId();
const set<const SMDS_MeshElement *>& anElems = (*aFamsIter)->GetElements(); const set<const SMDS_MeshElement *>& anElems = (*aFamsIter)->GetElements();
@ -319,15 +330,15 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
// Storing SMDS nodes to the MED file for the MED mesh // Storing SMDS nodes to the MED file for the MED mesh
//---------------------------------------------------- //----------------------------------------------------
#ifdef _EDF_NODE_IDS_ #ifdef _EDF_NODE_IDS_
typedef map<med_int,med_int> TNodeIdMap; typedef map<TInt,TInt> TNodeIdMap;
TNodeIdMap aNodeIdMap; TNodeIdMap aNodeIdMap;
#endif #endif
med_int aNbElems = myMesh->NbNodes(); TInt aNbElems = myMesh->NbNodes();
MED::TIntVector anElemNums(aNbElems); MED::TIntVector anElemNums(aNbElems);
MED::TIntVector aFamilyNums(aNbElems); MED::TIntVector aFamilyNums(aNbElems);
MED::TFloatVector aCoordinates(aNbElems*aMeshDimension); MED::TFloatVector aCoordinates(aNbElems*aMeshDimension);
for(med_int iNode = 0, aStartId = 0; aCoordHelperPtr->Next(); iNode++, aStartId += aMeshDimension){ for(TInt iNode = 0, aStartId = 0; aCoordHelperPtr->Next(); iNode++, aStartId += aMeshDimension){
for(med_int iCoord = 0; iCoord < aMeshDimension; iCoord++){ for(TInt iCoord = 0; iCoord < aMeshDimension; iCoord++){
aCoordinates[aStartId+iCoord] = aCoordHelperPtr->GetCoord(iCoord); aCoordinates[aStartId+iCoord] = aCoordHelperPtr->GetCoord(iCoord);
} }
int aNodeID = aCoordHelperPtr->GetID(); int aNodeID = aCoordHelperPtr->GetID();
@ -344,14 +355,14 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
MED::TStringVector aCoordNames(aMeshDimension); MED::TStringVector aCoordNames(aMeshDimension);
MED::TStringVector aCoordUnits(aMeshDimension); MED::TStringVector aCoordUnits(aMeshDimension);
for(med_int iCoord = 0; iCoord < aMeshDimension; iCoord++){ for(TInt iCoord = 0; iCoord < aMeshDimension; iCoord++){
aCoordNames[iCoord] = aCoordHelperPtr->GetName(iCoord); aCoordNames[iCoord] = aCoordHelperPtr->GetName(iCoord);
aCoordUnits[iCoord] = aCoordHelperPtr->GetUnit(iCoord); aCoordUnits[iCoord] = aCoordHelperPtr->GetUnit(iCoord);
} }
const med_repere SMDS_COORDINATE_SYSTEM = MED_CART; const ERepere SMDS_COORDINATE_SYSTEM = eCART;
PNodeInfo aNodeInfo = TWrapper::CrNodeInfo(aMeshInfo, PNodeInfo aNodeInfo = myMed->CrNodeInfo(aMeshInfo,
SMDS_COORDINATE_SYSTEM, SMDS_COORDINATE_SYSTEM,
aCoordinates, aCoordinates,
aCoordNames, aCoordNames,
@ -359,29 +370,29 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
aFamilyNums, aFamilyNums,
anElemNums); anElemNums);
MESSAGE("Perform - aNodeInfo->GetNbElem() = "<<aNbElems); MESSAGE("Perform - aNodeInfo->GetNbElem() = "<<aNbElems);
aMed.SetNodeInfo(aNodeInfo); myMed->SetNodeInfo(aNodeInfo);
// Storing others SMDS elements to the MED file for the MED mesh // Storing others SMDS elements to the MED file for the MED mesh
//-------------------------------------------------------------- //--------------------------------------------------------------
med_entite_maillage SMDS_MED_ENTITY = MED_MAILLE; EEntiteMaillage SMDS_MED_ENTITY = eMAILLE;
const med_connectivite SMDS_MED_CONNECTIVITY = MED_NOD; const EConnectivite SMDS_MED_CONNECTIVITY = eNOD;
// Storing SMDS Edges // Storing SMDS Edges
if(med_int aNbElems = myMesh->NbEdges()){ if(TInt aNbElems = myMesh->NbEdges()){
#ifdef _ELEMENTS_BY_DIM_ #ifdef _ELEMENTS_BY_DIM_
SMDS_MED_ENTITY = MED_ARETE; SMDS_MED_ENTITY = eARETE;
#endif #endif
SMDS_EdgeIteratorPtr anIter = myMesh->edgesIterator(); SMDS_EdgeIteratorPtr anIter = myMesh->edgesIterator();
med_int aNbConnectivity = MED::GetNbConn(SMDS_MED_ENTITY,MED_SEG2,aMeshDimension); TInt aNbConnectivity = MED::GetNbConn(SMDS_MED_ENTITY,eSEG2,aMeshDimension);
MED::TIntVector anElemNums(aNbElems); MED::TIntVector anElemNums(aNbElems);
MED::TIntVector aFamilyNums(aNbElems); MED::TIntVector aFamilyNums(aNbElems);
MED::TIntVector aConnectivity(aNbElems*aNbConnectivity); MED::TIntVector aConnectivity(aNbElems*aNbConnectivity);
for(med_int iElem = 0, iConn = 0; anIter->more(); iElem++, iConn+=aNbConnectivity){ for(TInt iElem = 0, iConn = 0; anIter->more(); iElem++, iConn+=aNbConnectivity){
const SMDS_MeshEdge* anElem = anIter->next(); const SMDS_MeshEdge* anElem = anIter->next();
SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator(); SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator();
for(med_int iNode = 0; iNode < aNbConnectivity && aNodesIter->more(); iNode++){ for(TInt iNode = 0; iNode < aNbConnectivity && aNodesIter->more(); iNode++){
const SMDS_MeshElement* aNode = aNodesIter->next(); const SMDS_MeshElement* aNode = aNodesIter->next();
#ifdef _EDF_NODE_IDS_ #ifdef _EDF_NODE_IDS_
aConnectivity[iConn+iNode] = aNodeIdMap[aNode->GetID()]; aConnectivity[iConn+iNode] = aNodeIdMap[aNode->GetID()];
@ -397,23 +408,23 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
aFamilyNums[iElem] = myEdgesDefaultFamilyId; aFamilyNums[iElem] = myEdgesDefaultFamilyId;
} }
PCellInfo aCellInfo = TWrapper::CrCellInfo(aMeshInfo, PCellInfo aCellInfo = myMed->CrCellInfo(aMeshInfo,
SMDS_MED_ENTITY, SMDS_MED_ENTITY,
MED_SEG2, eSEG2,
SMDS_MED_CONNECTIVITY, SMDS_MED_CONNECTIVITY,
aConnectivity, aConnectivity,
aFamilyNums, aFamilyNums,
anElemNums); anElemNums);
aMed.SetCellInfo(aCellInfo); myMed->SetCellInfo(aCellInfo);
} }
// Storing SMDS Faces // Storing SMDS Faces
if(med_int aNbElems = myMesh->NbFaces()){ if(TInt aNbElems = myMesh->NbFaces()){
SMDS_FaceIteratorPtr anIter = myMesh->facesIterator(); SMDS_FaceIteratorPtr anIter = myMesh->facesIterator();
#ifdef _ELEMENTS_BY_DIM_ #ifdef _ELEMENTS_BY_DIM_
SMDS_MED_ENTITY = MED_FACE; SMDS_MED_ENTITY = eFACE;
#endif #endif
med_int aNbTriaConn = MED::GetNbConn(SMDS_MED_ENTITY,MED_TRIA3,aMeshDimension); TInt aNbTriaConn = MED::GetNbConn(SMDS_MED_ENTITY,eTRIA3,aMeshDimension);
MED::TIntVector anTriaElemNums; MED::TIntVector anTriaElemNums;
anTriaElemNums.reserve(aNbElems); anTriaElemNums.reserve(aNbElems);
MED::TIntVector aTriaFamilyNums; MED::TIntVector aTriaFamilyNums;
@ -421,7 +432,7 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
MED::TIntVector aTriaConn; MED::TIntVector aTriaConn;
aTriaConn.reserve(aNbElems*aNbTriaConn); aTriaConn.reserve(aNbElems*aNbTriaConn);
med_int aNbQuadConn = MED::GetNbConn(SMDS_MED_ENTITY,MED_QUAD4,aMeshDimension); TInt aNbQuadConn = MED::GetNbConn(SMDS_MED_ENTITY,eQUAD4,aMeshDimension);
MED::TIntVector aQuadElemNums; MED::TIntVector aQuadElemNums;
aQuadElemNums.reserve(aNbElems); aQuadElemNums.reserve(aNbElems);
MED::TIntVector aQuadFamilyNums; MED::TIntVector aQuadFamilyNums;
@ -429,11 +440,11 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
MED::TIntVector aQuadConn; MED::TIntVector aQuadConn;
aQuadConn.reserve(aNbElems*aNbQuadConn); aQuadConn.reserve(aNbElems*aNbQuadConn);
for(med_int iElem = 0; iElem < aNbElems && anIter->more(); iElem++){ for(TInt iElem = 0; iElem < aNbElems && anIter->more(); iElem++){
const SMDS_MeshFace* anElem = anIter->next(); const SMDS_MeshFace* anElem = anIter->next();
med_int aNbNodes = anElem->NbNodes(); TInt aNbNodes = anElem->NbNodes();
SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator(); SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator();
med_int aNbConnectivity; TInt aNbConnectivity;
MED::TIntVector* anElemNums; MED::TIntVector* anElemNums;
MED::TIntVector* aFamilyNums; MED::TIntVector* aFamilyNums;
MED::TIntVector* aConnectivity; MED::TIntVector* aConnectivity;
@ -452,12 +463,12 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
break; break;
} }
MED::TIntVector aVector(aNbNodes); MED::TIntVector aVector(aNbNodes);
for(med_int iNode = 0; aNodesIter->more(); iNode++){ for(TInt iNode = 0; aNodesIter->more(); iNode++){
const SMDS_MeshElement* aNode = aNodesIter->next(); const SMDS_MeshElement* aNode = aNodesIter->next();
aVector[iNode] = aNode->GetID(); aVector[iNode] = aNode->GetID();
} }
med_int aSize = aConnectivity->size(); TInt aSize = aConnectivity->size();
aConnectivity->resize(aSize+aNbConnectivity); aConnectivity->resize(aSize+aNbConnectivity);
// There is some differnce between SMDS and MED in cells mapping // There is some differnce between SMDS and MED in cells mapping
#ifdef _EDF_NODE_IDS_ #ifdef _EDF_NODE_IDS_
@ -468,7 +479,7 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
(*aConnectivity)[aSize+2] = aNodeIdMap[aVector[3]]; (*aConnectivity)[aSize+2] = aNodeIdMap[aVector[3]];
(*aConnectivity)[aSize+3] = aNodeIdMap[aVector[2]]; (*aConnectivity)[aSize+3] = aNodeIdMap[aVector[2]];
default: default:
for(med_int iNode = 0; iNode < aNbNodes; iNode++) for(TInt iNode = 0; iNode < aNbNodes; iNode++)
(*aConnectivity)[aSize+iNode] = aNodeIdMap[aVector[iNode]]; (*aConnectivity)[aSize+iNode] = aNodeIdMap[aVector[iNode]];
} }
#else #else
@ -479,7 +490,7 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
(*aConnectivity)[aSize+2] = aVector[3]; (*aConnectivity)[aSize+2] = aVector[3];
(*aConnectivity)[aSize+3] = aVector[2]; (*aConnectivity)[aSize+3] = aVector[2];
default: default:
for(med_int iNode = 0; iNode < aNbNodes; iNode++) for(TInt iNode = 0; iNode < aNbNodes; iNode++)
(*aConnectivity)[aSize+iNode] = aVector[iNode]; (*aConnectivity)[aSize+iNode] = aVector[iNode];
} }
#endif #endif
@ -490,37 +501,37 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
else else
aFamilyNums->push_back(myFacesDefaultFamilyId); aFamilyNums->push_back(myFacesDefaultFamilyId);
} }
if(med_int aNbElems = anTriaElemNums.size()){ if(TInt aNbElems = anTriaElemNums.size()){
PCellInfo aCellInfo = TWrapper::CrCellInfo(aMeshInfo, PCellInfo aCellInfo = myMed->CrCellInfo(aMeshInfo,
SMDS_MED_ENTITY, SMDS_MED_ENTITY,
MED_TRIA3, eTRIA3,
SMDS_MED_CONNECTIVITY, SMDS_MED_CONNECTIVITY,
aTriaConn, aTriaConn,
aTriaFamilyNums, aTriaFamilyNums,
anTriaElemNums); anTriaElemNums);
MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<MED_TRIA3<<"; aNbElems = "<<aNbElems); MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<eTRIA3<<"; aNbElems = "<<aNbElems);
aMed.SetCellInfo(aCellInfo); myMed->SetCellInfo(aCellInfo);
} }
if(med_int aNbElems = aQuadElemNums.size()){ if(TInt aNbElems = aQuadElemNums.size()){
PCellInfo aCellInfo = TWrapper::CrCellInfo(aMeshInfo, PCellInfo aCellInfo = myMed->CrCellInfo(aMeshInfo,
SMDS_MED_ENTITY, SMDS_MED_ENTITY,
MED_QUAD4, eQUAD4,
SMDS_MED_CONNECTIVITY, SMDS_MED_CONNECTIVITY,
aQuadConn, aQuadConn,
aQuadFamilyNums, aQuadFamilyNums,
aQuadElemNums); aQuadElemNums);
MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<MED_QUAD4<<"; aNbElems = "<<aNbElems); MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<eQUAD4<<"; aNbElems = "<<aNbElems);
aMed.SetCellInfo(aCellInfo); myMed->SetCellInfo(aCellInfo);
} }
} }
// Storing SMDS Volumes // Storing SMDS Volumes
if(med_int aNbElems = myMesh->NbVolumes()){ if(TInt aNbElems = myMesh->NbVolumes()){
SMDS_VolumeIteratorPtr anIter = myMesh->volumesIterator(); SMDS_VolumeIteratorPtr anIter = myMesh->volumesIterator();
#ifdef _ELEMENTS_BY_DIM_ #ifdef _ELEMENTS_BY_DIM_
SMDS_MED_ENTITY = MED_MAILLE; SMDS_MED_ENTITY = eMAILLE;
#endif #endif
med_int aNbTetraConn = MED::GetNbConn(SMDS_MED_ENTITY,MED_TETRA4,aMeshDimension); TInt aNbTetraConn = MED::GetNbConn(SMDS_MED_ENTITY,eTETRA4,aMeshDimension);
MED::TIntVector anTetraElemNums; MED::TIntVector anTetraElemNums;
anTetraElemNums.reserve(aNbElems); anTetraElemNums.reserve(aNbElems);
MED::TIntVector aTetraFamilyNums; MED::TIntVector aTetraFamilyNums;
@ -528,7 +539,7 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
MED::TIntVector aTetraConn; MED::TIntVector aTetraConn;
aTetraConn.reserve(aNbElems*aNbTetraConn); aTetraConn.reserve(aNbElems*aNbTetraConn);
med_int aNbPyraConn = MED::GetNbConn(SMDS_MED_ENTITY,MED_PYRA5,aMeshDimension); TInt aNbPyraConn = MED::GetNbConn(SMDS_MED_ENTITY,ePYRA5,aMeshDimension);
MED::TIntVector anPyraElemNums; MED::TIntVector anPyraElemNums;
anPyraElemNums.reserve(aNbElems); anPyraElemNums.reserve(aNbElems);
MED::TIntVector aPyraFamilyNums; MED::TIntVector aPyraFamilyNums;
@ -536,7 +547,7 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
MED::TIntVector aPyraConn; MED::TIntVector aPyraConn;
aPyraConn.reserve(aNbElems*aNbPyraConn); aPyraConn.reserve(aNbElems*aNbPyraConn);
med_int aNbPentaConn = MED::GetNbConn(SMDS_MED_ENTITY,MED_PENTA6,aMeshDimension); TInt aNbPentaConn = MED::GetNbConn(SMDS_MED_ENTITY,ePENTA6,aMeshDimension);
MED::TIntVector anPentaElemNums; MED::TIntVector anPentaElemNums;
anPentaElemNums.reserve(aNbElems); anPentaElemNums.reserve(aNbElems);
MED::TIntVector aPentaFamilyNums; MED::TIntVector aPentaFamilyNums;
@ -544,7 +555,7 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
MED::TIntVector aPentaConn; MED::TIntVector aPentaConn;
aPentaConn.reserve(aNbElems*aNbPentaConn); aPentaConn.reserve(aNbElems*aNbPentaConn);
med_int aNbHexaConn = MED::GetNbConn(SMDS_MED_ENTITY,MED_HEXA8,aMeshDimension); TInt aNbHexaConn = MED::GetNbConn(SMDS_MED_ENTITY,eHEXA8,aMeshDimension);
MED::TIntVector aHexaElemNums; MED::TIntVector aHexaElemNums;
aHexaElemNums.reserve(aNbElems); aHexaElemNums.reserve(aNbElems);
MED::TIntVector aHexaFamilyNums; MED::TIntVector aHexaFamilyNums;
@ -552,11 +563,11 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
MED::TIntVector aHexaConn; MED::TIntVector aHexaConn;
aHexaConn.reserve(aNbElems*aNbHexaConn); aHexaConn.reserve(aNbElems*aNbHexaConn);
for(med_int iElem = 0; iElem < aNbElems && anIter->more(); iElem++){ for(TInt iElem = 0; iElem < aNbElems && anIter->more(); iElem++){
const SMDS_MeshVolume* anElem = anIter->next(); const SMDS_MeshVolume* anElem = anIter->next();
med_int aNbNodes = anElem->NbNodes(); TInt aNbNodes = anElem->NbNodes();
SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator(); SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator();
med_int aNbConnectivity; TInt aNbConnectivity;
MED::TIntVector* anElemNums; MED::TIntVector* anElemNums;
MED::TIntVector* aFamilyNums; MED::TIntVector* aFamilyNums;
MED::TIntVector* aConnectivity; MED::TIntVector* aConnectivity;
@ -587,11 +598,11 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
} }
MED::TIntVector aVector(aNbNodes); MED::TIntVector aVector(aNbNodes);
for(med_int iNode = 0; aNodesIter->more(); iNode++){ for(TInt iNode = 0; aNodesIter->more(); iNode++){
const SMDS_MeshElement* aNode = aNodesIter->next(); const SMDS_MeshElement* aNode = aNodesIter->next();
aVector[iNode] = aNode->GetID(); aVector[iNode] = aNode->GetID();
} }
med_int aSize = aConnectivity->size(); TInt aSize = aConnectivity->size();
aConnectivity->resize(aSize+aNbConnectivity); aConnectivity->resize(aSize+aNbConnectivity);
// There is some difference between SMDS and MED in cells mapping // There is some difference between SMDS and MED in cells mapping
#ifdef _EDF_NODE_IDS_ #ifdef _EDF_NODE_IDS_
@ -603,7 +614,7 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
(*aConnectivity)[aSize+3] = aNodeIdMap[aVector[1]]; (*aConnectivity)[aSize+3] = aNodeIdMap[aVector[1]];
(*aConnectivity)[aSize+4] = aNodeIdMap[aVector[4]]; (*aConnectivity)[aSize+4] = aNodeIdMap[aVector[4]];
default: default:
for(med_int iNode = 0; iNode < aNbNodes; iNode++) for(TInt iNode = 0; iNode < aNbNodes; iNode++)
(*aConnectivity)[aSize+iNode] = aNodeIdMap[aVector[iNode]]; (*aConnectivity)[aSize+iNode] = aNodeIdMap[aVector[iNode]];
} }
#else #else
@ -615,7 +626,7 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
(*aConnectivity)[aSize+3] = aVector[1]; (*aConnectivity)[aSize+3] = aVector[1];
(*aConnectivity)[aSize+4] = aVector[4]; (*aConnectivity)[aSize+4] = aVector[4];
default: default:
for(med_int iNode = 0; iNode < aNbNodes; iNode++) for(TInt iNode = 0; iNode < aNbNodes; iNode++)
(*aConnectivity)[aSize+iNode] = aVector[iNode]; (*aConnectivity)[aSize+iNode] = aVector[iNode];
} }
#endif #endif
@ -627,49 +638,49 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
aFamilyNums->push_back(myVolumesDefaultFamilyId); aFamilyNums->push_back(myVolumesDefaultFamilyId);
} }
if(med_int aNbElems = anTetraElemNums.size()){ if(TInt aNbElems = anTetraElemNums.size()){
PCellInfo aCellInfo = TWrapper::CrCellInfo(aMeshInfo, PCellInfo aCellInfo = myMed->CrCellInfo(aMeshInfo,
SMDS_MED_ENTITY, SMDS_MED_ENTITY,
MED_TETRA4, eTETRA4,
SMDS_MED_CONNECTIVITY, SMDS_MED_CONNECTIVITY,
aTetraConn, aTetraConn,
aTetraFamilyNums, aTetraFamilyNums,
anTetraElemNums); anTetraElemNums);
MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<MED_TETRA4<<"; aNbElems = "<<aNbElems); MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<eTETRA4<<"; aNbElems = "<<aNbElems);
aMed.SetCellInfo(aCellInfo); myMed->SetCellInfo(aCellInfo);
} }
if(med_int aNbElems = anPyraElemNums.size()){ if(TInt aNbElems = anPyraElemNums.size()){
PCellInfo aCellInfo = TWrapper::CrCellInfo(aMeshInfo, PCellInfo aCellInfo = myMed->CrCellInfo(aMeshInfo,
SMDS_MED_ENTITY, SMDS_MED_ENTITY,
MED_PYRA5, ePYRA5,
SMDS_MED_CONNECTIVITY, SMDS_MED_CONNECTIVITY,
aPyraConn, aPyraConn,
aPyraFamilyNums, aPyraFamilyNums,
anPyraElemNums); anPyraElemNums);
MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<MED_PYRA5<<"; aNbElems = "<<aNbElems); MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<ePYRA5<<"; aNbElems = "<<aNbElems);
aMed.SetCellInfo(aCellInfo); myMed->SetCellInfo(aCellInfo);
} }
if(med_int aNbElems = anPentaElemNums.size()){ if(TInt aNbElems = anPentaElemNums.size()){
PCellInfo aCellInfo = TWrapper::CrCellInfo(aMeshInfo, PCellInfo aCellInfo = myMed->CrCellInfo(aMeshInfo,
SMDS_MED_ENTITY, SMDS_MED_ENTITY,
MED_PENTA6, ePENTA6,
SMDS_MED_CONNECTIVITY, SMDS_MED_CONNECTIVITY,
aPentaConn, aPentaConn,
aPentaFamilyNums, aPentaFamilyNums,
anPentaElemNums); anPentaElemNums);
MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<MED_PENTA6<<"; aNbElems = "<<aNbElems); MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<ePENTA6<<"; aNbElems = "<<aNbElems);
aMed.SetCellInfo(aCellInfo); myMed->SetCellInfo(aCellInfo);
} }
if(med_int aNbElems = aHexaElemNums.size()){ if(TInt aNbElems = aHexaElemNums.size()){
PCellInfo aCellInfo = TWrapper::CrCellInfo(aMeshInfo, PCellInfo aCellInfo = myMed->CrCellInfo(aMeshInfo,
SMDS_MED_ENTITY, SMDS_MED_ENTITY,
MED_HEXA8, eHEXA8,
SMDS_MED_CONNECTIVITY, SMDS_MED_CONNECTIVITY,
aHexaConn, aHexaConn,
aHexaFamilyNums, aHexaFamilyNums,
aHexaElemNums); aHexaElemNums);
MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<MED_HEXA8<<"; aNbElems = "<<aNbElems); MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<eHEXA8<<"; aNbElems = "<<aNbElems);
aMed.SetCellInfo(aCellInfo); myMed->SetCellInfo(aCellInfo);
} }
} }
}catch(const std::exception& exc){ }catch(const std::exception& exc){

View File

@ -28,6 +28,7 @@
#define _INCLUDE_DRIVERMED_W_SMESHDS_MESH #define _INCLUDE_DRIVERMED_W_SMESHDS_MESH
#include "Driver_SMESHDS_Mesh.h" #include "Driver_SMESHDS_Mesh.h"
#include "MED_Factory.hxx"
#include <string> #include <string>
#include <list> #include <list>
@ -43,6 +44,9 @@ class DriverMED_W_SMESHDS_Mesh: public Driver_SMESHDS_Mesh
DriverMED_W_SMESHDS_Mesh(); DriverMED_W_SMESHDS_Mesh();
virtual void SetFile(const std::string& theFileName);
void SetFile(const std::string& theFileName, MED::EVersion theId);
/*! sets file name; only for usage with Add(), not Write() /*! sets file name; only for usage with Add(), not Write()
*/ */
void AddGroupOfNodes(); void AddGroupOfNodes();
@ -63,6 +67,7 @@ class DriverMED_W_SMESHDS_Mesh: public Driver_SMESHDS_Mesh
private: private:
MED::PWrapper myMed;
std::string myMeshName; std::string myMeshName;
std::list<SMESHDS_GroupBase*> myGroups; std::list<SMESHDS_GroupBase*> myGroups;
bool myAllSubMeshes; bool myAllSubMeshes;

View File

@ -60,7 +60,7 @@ 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 $(BOOST_CPPFLAGS) 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) $(HDF5_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome
LDFLAGS += -lMeshDriver -L${KERNEL_ROOT_DIR}/lib/salome -lMEDWrapper LDFLAGS += -lMeshDriver -L${KERNEL_ROOT_DIR}/lib/salome -lMEDWrapper
LDFLAGSFORBIN += -lMeshDriver -lSMDS -lSMESHDS -L${KERNEL_ROOT_DIR}/lib/salome -lMEDWrapper -lOpUtil -lSALOMELocalTrace LDFLAGSFORBIN += -lMeshDriver -lSMDS -lSMESHDS -L${KERNEL_ROOT_DIR}/lib/salome -lMEDWrapper -lOpUtil -lSALOMELocalTrace

View File

@ -61,9 +61,9 @@ LIB_CLIENT_IDL =
LIB_SERVER_IDL = LIB_SERVER_IDL =
# additionnal information to compil and link file # additionnal information to compil and link file
CPPFLAGS += -I${KERNEL_ROOT_DIR}/include/salome $(BOOST_CPPFLAGS) CPPFLAGS += -I${KERNEL_ROOT_DIR}/include/salome $(OCC_INCLUDES) $(BOOST_CPPFLAGS)
CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome
LDFLAGS += -lMeshDriver LDFLAGS += -lMeshDriver $(OCC_KERNEL_LIBS)
LDFLAGSFORBIN += -lMeshDriver -lSMDS -L${KERNEL_ROOT_DIR}/lib/salome -lOpUtil -lSALOMELocalTrace LDFLAGSFORBIN += -lMeshDriver -lSMDS -L${KERNEL_ROOT_DIR}/lib/salome -lOpUtil -lSALOMELocalTrace

View File

@ -31,7 +31,7 @@ VPATH=.:@srcdir@:@top_srcdir@/idl:$(top_builddir)/idl
@COMMENCE@ @COMMENCE@
EXPORT_HEADERS = SMESH_Actor.h SMESH_Object.h SMESH_ActorUtils.h EXPORT_HEADERS = SMESH_Actor.h SMESH_Object.h SMESH_ObjectDef.h SMESH_ActorUtils.h
# Libraries targets # Libraries targets

View File

@ -27,13 +27,13 @@
// $Header$ // $Header$
#include "SMESH_Actor.h" #include "SMESH_ActorDef.h"
#include "SMESH_ActorUtils.h" #include "SMESH_ActorUtils.h"
#include "SMESH_DeviceActor.h" #include "SMESH_DeviceActor.h"
#include "SMESH_ControlsDef.hxx"
#include "SALOME_ExtractUnstructuredGrid.h" #include "SALOME_ExtractUnstructuredGrid.h"
#include "QAD_Config.h" #include "QAD_Config.h"
#include "utilities.h"
#include <qstringlist.h> #include <qstringlist.h>
#include <vtkTimeStamp.h> #include <vtkTimeStamp.h>
@ -69,20 +69,20 @@
#include <vtkPlane.h> #include <vtkPlane.h>
#include <vtkImplicitBoolean.h> #include <vtkImplicitBoolean.h>
#include "utilities.h"
#ifdef _DEBUG_ #ifdef _DEBUG_
static int MYDEBUG = 0; static int MYDEBUG = 0;
static int MYDEBUGWITHFILES = 0;
#else #else
static int MYDEBUG = 0; static int MYDEBUG = 0;
static int MYDEBUGWITHFILES = 0;
#endif #endif
static int aLineWidthInc = 2; static int aLineWidthInc = 2;
static int aPointSizeInc = 2; static int aPointSizeInc = 2;
SMESH_Actor* SMESH_Actor::New(){ SMESH_ActorDef* SMESH_ActorDef::New(){
return new SMESH_Actor(); return new SMESH_ActorDef();
} }
@ -91,7 +91,7 @@ SMESH_Actor* SMESH_Actor::New(TVisualObjPtr theVisualObj,
const char* theName, const char* theName,
int theIsClear) int theIsClear)
{ {
SMESH_Actor* anActor = SMESH_Actor::New(); SMESH_ActorDef* anActor = SMESH_ActorDef::New();
if(!anActor->Init(theVisualObj,theEntry,theName,theIsClear)){ if(!anActor->Init(theVisualObj,theEntry,theName,theIsClear)){
anActor->Delete(); anActor->Delete();
anActor = NULL; anActor = NULL;
@ -100,8 +100,8 @@ SMESH_Actor* SMESH_Actor::New(TVisualObjPtr theVisualObj,
} }
SMESH_Actor::SMESH_Actor(){ SMESH_ActorDef::SMESH_ActorDef(){
if(MYDEBUG) MESSAGE("SMESH_Actor"); if(MYDEBUG) MESSAGE("SMESH_ActorDef");
myTimeStamp = vtkTimeStamp::New(); myTimeStamp = vtkTimeStamp::New();
@ -284,8 +284,7 @@ SMESH_Actor::SMESH_Actor(){
myName = ""; myName = "";
myIO = NULL; myIO = NULL;
myColorMode = eNone; myControlMode = eNone;
my1DColorMode = e1DNone;
myControlActor = my2DActor; myControlActor = my2DActor;
//Definition of myScalarBarActor //Definition of myScalarBarActor
@ -439,6 +438,8 @@ SMESH_Actor::SMESH_Actor(){
myPtsLabeledDataMapper->SetLabelTextProperty(aPtsTextProp); myPtsLabeledDataMapper->SetLabelTextProperty(aPtsTextProp);
aPtsTextProp->Delete(); aPtsTextProp->Delete();
myEntityMode = eAllEntity;
myIsPointsLabeled = false; myIsPointsLabeled = false;
myPointLabels = vtkActor2D::New(); myPointLabels = vtkActor2D::New();
@ -491,8 +492,8 @@ SMESH_Actor::SMESH_Actor(){
} }
SMESH_Actor::~SMESH_Actor(){ SMESH_ActorDef::~SMESH_ActorDef(){
if(MYDEBUG) MESSAGE("~SMESH_Actor"); if(MYDEBUG) MESSAGE("~SMESH_ActorDef");
myScalarBarActor->Delete(); myScalarBarActor->Delete();
myLookupTable->Delete(); myLookupTable->Delete();
@ -562,7 +563,7 @@ SMESH_Actor::~SMESH_Actor(){
} }
void SMESH_Actor::SetPointsLabeled( bool theIsPointsLabeled ) void SMESH_ActorDef::SetPointsLabeled( bool theIsPointsLabeled )
{ {
vtkUnstructuredGrid* aGrid = GetUnstructuredGrid(); vtkUnstructuredGrid* aGrid = GetUnstructuredGrid();
myIsPointsLabeled = theIsPointsLabeled && aGrid->GetNumberOfPoints(); myIsPointsLabeled = theIsPointsLabeled && aGrid->GetNumberOfPoints();
@ -597,7 +598,7 @@ void SMESH_Actor::SetPointsLabeled( bool theIsPointsLabeled )
} }
void SMESH_Actor::SetCellsLabeled(bool theIsCellsLabeled){ void SMESH_ActorDef::SetCellsLabeled(bool theIsCellsLabeled){
vtkUnstructuredGrid* aGrid = GetUnstructuredGrid(); vtkUnstructuredGrid* aGrid = GetUnstructuredGrid();
myIsCellsLabeled = theIsCellsLabeled && aGrid->GetNumberOfPoints(); myIsCellsLabeled = theIsCellsLabeled && aGrid->GetNumberOfPoints();
if(myIsCellsLabeled){ if(myIsCellsLabeled){
@ -620,9 +621,8 @@ void SMESH_Actor::SetCellsLabeled(bool theIsCellsLabeled){
} }
void SMESH_Actor::SetControlMode(eControl theMode){ void SMESH_ActorDef::SetControlMode(eControl theMode){
myColorMode = eNone; myControlMode = eNone;
my1DColorMode = e1DNone;
my1DActor->GetMapper()->SetScalarVisibility(false); my1DActor->GetMapper()->SetScalarVisibility(false);
my2DActor->GetMapper()->SetScalarVisibility(false); my2DActor->GetMapper()->SetScalarVisibility(false);
@ -634,7 +634,7 @@ void SMESH_Actor::SetControlMode(eControl theMode){
if(anIsScalarVisible){ if(anIsScalarVisible){
SMESH::Controls::FunctorPtr aFunctor; SMESH::Controls::FunctorPtr aFunctor;
switch(theMode){ switch(theMode){
case eLengthEdges: case eLength:
{ {
SMESH::Controls::Length* aControl = new SMESH::Controls::Length(); SMESH::Controls::Length* aControl = new SMESH::Controls::Length();
aControl->SetPrecision( myControlsPrecision ); aControl->SetPrecision( myControlsPrecision );
@ -642,6 +642,12 @@ void SMESH_Actor::SetControlMode(eControl theMode){
myControlActor = my1DActor; myControlActor = my1DActor;
break; break;
} }
case eLength2D:
{
aFunctor.reset(new SMESH::Controls::Length2D());
myControlActor = my2DActor;
break;
}
case eFreeBorders: case eFreeBorders:
aFunctor.reset(new SMESH::Controls::FreeBorders()); aFunctor.reset(new SMESH::Controls::FreeBorders());
myControlActor = my1DActor; myControlActor = my1DActor;
@ -654,6 +660,10 @@ void SMESH_Actor::SetControlMode(eControl theMode){
aFunctor.reset(new SMESH::Controls::MultiConnection()); aFunctor.reset(new SMESH::Controls::MultiConnection());
myControlActor = my1DActor; myControlActor = my1DActor;
break; break;
case eMultiConnection2D:
aFunctor.reset(new SMESH::Controls::MultiConnection2D());
myControlActor = my2DActor;
break;
case eArea: case eArea:
{ {
SMESH::Controls::Area* aControl = new SMESH::Controls::Area(); SMESH::Controls::Area* aControl = new SMESH::Controls::Area();
@ -678,6 +688,14 @@ void SMESH_Actor::SetControlMode(eControl theMode){
myControlActor = my2DActor; myControlActor = my2DActor;
break; break;
} }
case eAspectRatio3D:
{
SMESH::Controls::AspectRatio3D* aControl = new SMESH::Controls::AspectRatio3D();
aControl->SetPrecision( myControlsPrecision );
aFunctor.reset( aControl );
myControlActor = my3DActor;
break;
}
case eMinimumAngle: case eMinimumAngle:
{ {
SMESH::Controls::MinimumAngle* aControl = new SMESH::Controls::MinimumAngle(); SMESH::Controls::MinimumAngle* aControl = new SMESH::Controls::MinimumAngle();
@ -709,17 +727,36 @@ void SMESH_Actor::SetControlMode(eControl theMode){
vtkUnstructuredGrid* aGrid = myControlActor->GetUnstructuredGrid(); vtkUnstructuredGrid* aGrid = myControlActor->GetUnstructuredGrid();
vtkIdType aNbCells = aGrid->GetNumberOfCells(); vtkIdType aNbCells = aGrid->GetNumberOfCells();
if(aNbCells){ if(aNbCells){
myColorMode = theMode; myControlMode = theMode;
if(theMode == eFreeBorders || theMode == eFreeEdges){ switch(myControlMode){
my1DColorMode = e1DHighlited; case eFreeEdges:
case eFreeBorders:
my1DExtActor->SetExtControlMode(aFunctor,myControlActor); my1DExtActor->SetExtControlMode(aFunctor,myControlActor);
}else{ break;
if(myControlActor == my1DActor) case eLength2D:
my1DColorMode = e1DColored; my1DExtActor->SetExtControlMode(aFunctor,myControlActor,myScalarBarActor,myLookupTable);
break;
case eMultiConnection2D:
my1DExtActor->SetExtControlMode(aFunctor,myControlActor,myScalarBarActor,myLookupTable);
break;
default:
myControlActor->SetControlMode(aFunctor,myScalarBarActor,myLookupTable); myControlActor->SetControlMode(aFunctor,myScalarBarActor,myLookupTable);
} }
} }
if(QAD_CONFIG->getSetting("SMESH:DispayEntity") == "true"){
if(myControlActor == my1DActor)
myEntityMode = eEdges;
else if(myControlActor == my2DActor)
myEntityMode = eFaces;
else if(myControlActor == my3DActor)
myEntityMode = eVolumes;
} }
}else if(QAD_CONFIG->getSetting("SMESH:DispayEntity") == "true"){
myEntityMode = eAllEntity;
}
SetRepresentation(GetRepresentation()); SetRepresentation(GetRepresentation());
myTimeStamp->Modified(); myTimeStamp->Modified();
@ -727,7 +764,7 @@ void SMESH_Actor::SetControlMode(eControl theMode){
} }
void SMESH_Actor::AddToRender(vtkRenderer* theRenderer){ void SMESH_ActorDef::AddToRender(vtkRenderer* theRenderer){
SALOME_Actor::AddToRender(theRenderer); SALOME_Actor::AddToRender(theRenderer);
theRenderer->AddActor(myNodeActor); theRenderer->AddActor(myNodeActor);
@ -751,7 +788,7 @@ void SMESH_Actor::AddToRender(vtkRenderer* theRenderer){
theRenderer->AddActor2D(myCellsLabels); theRenderer->AddActor2D(myCellsLabels);
} }
void SMESH_Actor::RemoveFromRender(vtkRenderer* theRenderer){ void SMESH_ActorDef::RemoveFromRender(vtkRenderer* theRenderer){
SALOME_Actor::RemoveFromRender(theRenderer); SALOME_Actor::RemoveFromRender(theRenderer);
theRenderer->RemoveActor(myNodeActor); theRenderer->RemoveActor(myNodeActor);
@ -772,7 +809,7 @@ void SMESH_Actor::RemoveFromRender(vtkRenderer* theRenderer){
} }
bool SMESH_Actor::Init(TVisualObjPtr theVisualObj, bool SMESH_ActorDef::Init(TVisualObjPtr theVisualObj,
const char* theEntry, const char* theEntry,
const char* theName, const char* theName,
int theIsClear) int theIsClear)
@ -809,6 +846,8 @@ bool SMESH_Actor::Init(TVisualObjPtr theVisualObj,
my3DActor->Init(myVisualObj,myImplicitBoolean); my3DActor->Init(myVisualObj,myImplicitBoolean);
my1DActor->GetMapper()->SetLookupTable(myLookupTable); my1DActor->GetMapper()->SetLookupTable(myLookupTable);
my1DExtActor->GetMapper()->SetLookupTable(myLookupTable);
my2DActor->GetMapper()->SetLookupTable(myLookupTable); my2DActor->GetMapper()->SetLookupTable(myLookupTable);
my3DActor->GetMapper()->SetLookupTable(myLookupTable); my3DActor->GetMapper()->SetLookupTable(myLookupTable);
@ -840,17 +879,17 @@ bool SMESH_Actor::Init(TVisualObjPtr theVisualObj,
} }
float* SMESH_Actor::GetBounds(){ float* SMESH_ActorDef::GetBounds(){
return myNodeActor->GetBounds(); return myNodeActor->GetBounds();
} }
vtkDataSet* SMESH_Actor::GetInput(){ vtkDataSet* SMESH_ActorDef::GetInput(){
return GetUnstructuredGrid(); return GetUnstructuredGrid();
} }
void SMESH_Actor::SetTransform(SALOME_Transform* theTransform){ void SMESH_ActorDef::SetTransform(SALOME_Transform* theTransform){
myNodeActor->SetTransform(theTransform); myNodeActor->SetTransform(theTransform);
myBaseActor->SetTransform(theTransform); myBaseActor->SetTransform(theTransform);
@ -867,27 +906,27 @@ void SMESH_Actor::SetTransform(SALOME_Transform* theTransform){
} }
void SMESH_Actor::SetMapper(vtkMapper* theMapper){ void SMESH_ActorDef::SetMapper(vtkMapper* theMapper){
vtkLODActor::SetMapper(theMapper); vtkLODActor::SetMapper(theMapper);
} }
void SMESH_Actor::ShallowCopy(vtkProp *prop){ void SMESH_ActorDef::ShallowCopy(vtkProp *prop){
SALOME_Actor::ShallowCopy(prop); SALOME_Actor::ShallowCopy(prop);
} }
vtkMapper* SMESH_Actor::GetMapper(){ vtkMapper* SMESH_ActorDef::GetMapper(){
return myPickableActor->GetMapper(); return myPickableActor->GetMapper();
} }
vtkUnstructuredGrid* SMESH_Actor::GetUnstructuredGrid(){ vtkUnstructuredGrid* SMESH_ActorDef::GetUnstructuredGrid(){
return myVisualObj->GetUnstructuredGrid(); return myVisualObj->GetUnstructuredGrid();
} }
bool SMESH_Actor::IsInfinitive(){ bool SMESH_ActorDef::IsInfinitive(){
vtkDataSet *aDataSet = myPickableActor->GetUnstructuredGrid(); vtkDataSet *aDataSet = myPickableActor->GetUnstructuredGrid();
aDataSet->Update(); aDataSet->Update();
myIsInfinite = aDataSet->GetNumberOfCells() == 0 || myIsInfinite = aDataSet->GetNumberOfCells() == 0 ||
@ -897,16 +936,16 @@ bool SMESH_Actor::IsInfinitive(){
} }
void SMESH_Actor::SetIsShrunkable(bool theShrunkable){ void SMESH_ActorDef::SetIsShrunkable(bool theShrunkable){
myIsShrinkable = theShrunkable; myIsShrinkable = theShrunkable;
Modified(); Modified();
} }
float SMESH_Actor::GetShrinkFactor(){ float SMESH_ActorDef::GetShrinkFactor(){
return myBaseActor->GetShrinkFactor(); return myBaseActor->GetShrinkFactor();
} }
void SMESH_Actor::SetShrinkFactor(float theValue){ void SMESH_ActorDef::SetShrinkFactor(float theValue){
myBaseActor->SetShrinkFactor(theValue); myBaseActor->SetShrinkFactor(theValue);
my1DActor->SetShrinkFactor(theValue); my1DActor->SetShrinkFactor(theValue);
@ -918,7 +957,7 @@ void SMESH_Actor::SetShrinkFactor(float theValue){
Modified(); Modified();
} }
void SMESH_Actor::SetShrink(){ void SMESH_ActorDef::SetShrink(){
if(!myIsShrinkable) return; if(!myIsShrinkable) return;
myBaseActor->SetShrink(); myBaseActor->SetShrink();
@ -933,7 +972,7 @@ void SMESH_Actor::SetShrink(){
Modified(); Modified();
} }
void SMESH_Actor::UnShrink(){ void SMESH_ActorDef::UnShrink(){
if(!myIsShrunk) return; if(!myIsShrunk) return;
myBaseActor->UnShrink(); myBaseActor->UnShrink();
@ -949,53 +988,32 @@ void SMESH_Actor::UnShrink(){
} }
int SMESH_Actor::GetNodeObjId(int theVtkID){ int SMESH_ActorDef::GetNodeObjId(int theVtkID){
return myPickableActor->GetNodeObjId(theVtkID); return myPickableActor->GetNodeObjId(theVtkID);
} }
float* SMESH_Actor::GetNodeCoord(int theObjID){ float* SMESH_ActorDef::GetNodeCoord(int theObjID){
return myPickableActor->GetNodeCoord(theObjID); return myPickableActor->GetNodeCoord(theObjID);
} }
int SMESH_Actor::GetElemObjId(int theVtkID){ int SMESH_ActorDef::GetElemObjId(int theVtkID){
return myPickableActor->GetElemObjId(theVtkID); return myPickableActor->GetElemObjId(theVtkID);
} }
vtkCell* SMESH_Actor::GetElemCell(int theObjID){ vtkCell* SMESH_ActorDef::GetElemCell(int theObjID){
return myPickableActor->GetElemCell(theObjID); return myPickableActor->GetElemCell(theObjID);
} }
void SMESH_Actor::SetVisibility(int theMode){ void SMESH_ActorDef::SetVisibility(int theMode){
SetVisibility(theMode,true); SetVisibility(theMode,true);
} }
void SMESH_Actor::SetVisibility(int theMode, bool theIsUpdateRepersentation){ void SMESH_ActorDef::SetVisibility(int theMode, bool theIsUpdateRepersentation){
SALOME_Actor::SetVisibility(theMode); SALOME_Actor::SetVisibility(theMode);
if(GetVisibility()){
if(theIsUpdateRepersentation)
SetRepresentation(GetRepresentation());
if(myColorMode != eNone){
if(my1DColorMode == e1DHighlited)
my1DExtActor->VisibilityOn();
else if(myControlActor->GetUnstructuredGrid()->GetNumberOfCells())
myScalarBarActor->VisibilityOn();
}
if(myRepresentation != ePoint)
myPickableActor->VisibilityOn();
my1DActor->VisibilityOn();
my2DActor->VisibilityOn();
my3DActor->VisibilityOn();
if(myIsPointsLabeled) myPointLabels->VisibilityOn();
if(myIsCellsLabeled) myCellsLabels->VisibilityOn();
}else{
myNodeActor->VisibilityOff(); myNodeActor->VisibilityOff();
myBaseActor->VisibilityOff(); myBaseActor->VisibilityOff();
@ -1008,15 +1026,72 @@ void SMESH_Actor::SetVisibility(int theMode, bool theIsUpdateRepersentation){
myScalarBarActor->VisibilityOff(); myScalarBarActor->VisibilityOff();
myPointLabels->VisibilityOff(); myPointLabels->VisibilityOff();
myCellsLabels->VisibilityOff(); myCellsLabels->VisibilityOff();
if(GetVisibility()){
if(theIsUpdateRepersentation)
SetRepresentation(GetRepresentation());
if(myControlMode != eNone){
switch(myControlMode){
case eFreeEdges:
case eFreeBorders:
my1DExtActor->VisibilityOn();
break;
case eLength2D:
my1DExtActor->VisibilityOn();
case eMultiConnection2D:
my1DExtActor->VisibilityOn();
default:
if(myControlActor->GetUnstructuredGrid()->GetNumberOfCells())
myScalarBarActor->VisibilityOn();
} }
}
if(myRepresentation != ePoint)
myPickableActor->VisibilityOn();
if(myEntityMode & eEdges)
my1DActor->VisibilityOn();
if(myEntityMode & eFaces)
my2DActor->VisibilityOn();
if(myEntityMode & eVolumes)
my3DActor->VisibilityOn();
if(myIsPointsLabeled)
myPointLabels->VisibilityOn();
if(myIsCellsLabeled)
myCellsLabels->VisibilityOn();
}
Modified(); Modified();
} }
void SMESH_Actor::SetRepresentation(int theMode){ void SMESH_ActorDef::SetEntityMode(unsigned int theMode){
int aNbEdges = myVisualObj->GetNbEntities(SMESH::EDGE); if(!myVisualObj->GetNbEntities(SMDSAbs_Edge))
int aNbFaces = myVisualObj->GetNbEntities(SMESH::FACE); theMode &= ~eEdges;
int aNbVolumes = myVisualObj->GetNbEntities(SMESH::VOLUME);
if(!myVisualObj->GetNbEntities(SMDSAbs_Face))
theMode &= ~eFaces;
if(!myVisualObj->GetNbEntities(SMDSAbs_Volume))
theMode &= ~eVolumes;
if(!theMode)
return;
myEntityMode = theMode;
SetVisibility(GetVisibility(),false);
}
void SMESH_ActorDef::SetRepresentation(int theMode){
int aNbEdges = myVisualObj->GetNbEntities(SMDSAbs_Edge);
int aNbFaces = myVisualObj->GetNbEntities(SMDSAbs_Face);
int aNbVolumes = myVisualObj->GetNbEntities(SMDSAbs_Volume);
if(theMode < 0){ if(theMode < 0){
myRepresentation = eSurface; myRepresentation = eSurface;
if(!aNbFaces && !aNbVolumes && aNbEdges){ if(!aNbFaces && !aNbVolumes && aNbEdges){
@ -1080,15 +1155,14 @@ void SMESH_Actor::SetRepresentation(int theMode){
my3DActor->SetRepresentation(aReperesent); my3DActor->SetRepresentation(aReperesent);
my1DExtActor->SetVisibility(false); my1DExtActor->SetVisibility(false);
switch(my1DColorMode){
case e1DColored: switch(myControlMode){
case eLength:
case eMultiConnection:
aProp = aBackProp = my1DProp; aProp = aBackProp = my1DProp;
if(myRepresentation != ePoint) if(myRepresentation != ePoint)
aReperesent = SMESH_DeviceActor::eInsideframe; aReperesent = SMESH_DeviceActor::eInsideframe;
break; break;
case e1DHighlited:
my1DExtActor->SetVisibility(true);
break;
} }
my1DActor->SetProperty(aProp); my1DActor->SetProperty(aProp);
@ -1111,17 +1185,17 @@ void SMESH_Actor::SetRepresentation(int theMode){
} }
void SMESH_Actor::SetPointRepresentation(bool theIsPointsVisible){ void SMESH_ActorDef::SetPointRepresentation(bool theIsPointsVisible){
myIsPointsVisible = theIsPointsVisible; myIsPointsVisible = theIsPointsVisible;
SetRepresentation(GetRepresentation()); SetRepresentation(GetRepresentation());
} }
bool SMESH_Actor::GetPointRepresentation(){ bool SMESH_ActorDef::GetPointRepresentation(){
return myIsPointsVisible || myIsPointsLabeled; return myIsPointsVisible || myIsPointsLabeled;
} }
void SMESH_Actor::UpdateHighlight(){ void SMESH_ActorDef::UpdateHighlight(){
myHighlitableActor->SetVisibility(false); myHighlitableActor->SetVisibility(false);
myHighlitableActor->SetHighlited(false); myHighlitableActor->SetHighlited(false);
@ -1151,20 +1225,20 @@ void SMESH_Actor::UpdateHighlight(){
} }
void SMESH_Actor::highlight(bool theHighlight){ void SMESH_ActorDef::highlight(bool theHighlight){
myIsHighlighted = theHighlight; myIsHighlighted = theHighlight;
UpdateHighlight(); UpdateHighlight();
} }
void SMESH_Actor::SetPreSelected(bool thePreselect){ void SMESH_ActorDef::SetPreSelected(bool thePreselect){
myIsPreselected = thePreselect; myIsPreselected = thePreselect;
UpdateHighlight(); UpdateHighlight();
} }
// From vtkFollower // From vtkFollower
int SMESH_Actor::RenderOpaqueGeometry(vtkViewport *vp) int SMESH_ActorDef::RenderOpaqueGeometry(vtkViewport *vp)
{ {
if (myPickableActor->GetIsOpaque()) if (myPickableActor->GetIsOpaque())
{ {
@ -1176,7 +1250,7 @@ int SMESH_Actor::RenderOpaqueGeometry(vtkViewport *vp)
} }
int SMESH_Actor::RenderTranslucentGeometry(vtkViewport *vp) int SMESH_ActorDef::RenderTranslucentGeometry(vtkViewport *vp)
{ {
if (!myPickableActor->GetIsOpaque()) if (!myPickableActor->GetIsOpaque())
{ {
@ -1188,42 +1262,35 @@ int SMESH_Actor::RenderTranslucentGeometry(vtkViewport *vp)
} }
void SMESH_Actor::Render(vtkRenderer *ren){ void SMESH_ActorDef::Render(vtkRenderer *ren){
unsigned long mTime = myTimeStamp->GetMTime(); unsigned long aTime = myTimeStamp->GetMTime();
unsigned long anObjTime = myVisualObj->GetUnstructuredGrid()->GetMTime(); unsigned long anObjTime = myVisualObj->GetUnstructuredGrid()->GetMTime();
if(anObjTime > mTime) unsigned long aClippingTime = myImplicitBoolean->GetMTime();
if(anObjTime > aTime || aClippingTime > aTime)
Update(); Update();
} }
void SMESH_Actor::Update(){ void SMESH_ActorDef::Update(){
SetVisibility(GetVisibility()); if(MYDEBUG) MESSAGE("SMESH_ActorDef::Update");
unsigned long int anObjTime = myVisualObj->GetUnstructuredGrid()->GetMTime();
unsigned long int aClippingTime = myImplicitBoolean->GetMTime();
unsigned long int aTime = myTimeStamp->GetMTime();
if(MYDEBUG) MESSAGE("SMESH_Actor::Update");
if(GetControlMode() != eNone) { if(GetControlMode() != eNone) {
if(anObjTime > aTime || aClippingTime > aTime){
SetControlMode(GetControlMode()); SetControlMode(GetControlMode());
SetVisibility(GetVisibility());
}
} }
if(myIsPointsLabeled){ if(myIsPointsLabeled){
if(anObjTime > aTime || aClippingTime > aTime)
SetPointsLabeled(myIsPointsLabeled); SetPointsLabeled(myIsPointsLabeled);
} }
if(myIsCellsLabeled){ if(myIsCellsLabeled){
if(anObjTime > aTime || aClippingTime > aTime)
SetCellsLabeled(myIsCellsLabeled); SetCellsLabeled(myIsCellsLabeled);
} }
SetVisibility(GetVisibility());
myTimeStamp->Modified(); myTimeStamp->Modified();
Modified(); Modified();
} }
void SMESH_Actor::ReleaseGraphicsResources(vtkWindow *renWin){ void SMESH_ActorDef::ReleaseGraphicsResources(vtkWindow *renWin){
SALOME_Actor::ReleaseGraphicsResources(renWin); SALOME_Actor::ReleaseGraphicsResources(renWin);
myPickableActor->ReleaseGraphicsResources(renWin); myPickableActor->ReleaseGraphicsResources(renWin);
@ -1238,7 +1305,7 @@ static void GetColor(vtkProperty *theProperty, float& r,float& g,float& b){
} }
void SMESH_Actor::SetOpacity(float theValue){ void SMESH_ActorDef::SetOpacity(float theValue){
mySurfaceProp->SetOpacity(theValue); mySurfaceProp->SetOpacity(theValue);
myBackSurfaceProp->SetOpacity(theValue); myBackSurfaceProp->SetOpacity(theValue);
myEdgeProp->SetOpacity(theValue); myEdgeProp->SetOpacity(theValue);
@ -1248,74 +1315,74 @@ void SMESH_Actor::SetOpacity(float theValue){
} }
float SMESH_Actor::GetOpacity(){ float SMESH_ActorDef::GetOpacity(){
return mySurfaceProp->GetOpacity(); return mySurfaceProp->GetOpacity();
} }
void SMESH_Actor::SetSufaceColor(float r,float g,float b){ void SMESH_ActorDef::SetSufaceColor(float r,float g,float b){
mySurfaceProp->SetColor(r,g,b); mySurfaceProp->SetColor(r,g,b);
Modified(); Modified();
} }
void SMESH_Actor::GetSufaceColor(float& r,float& g,float& b){ void SMESH_ActorDef::GetSufaceColor(float& r,float& g,float& b){
::GetColor(mySurfaceProp,r,g,b); ::GetColor(mySurfaceProp,r,g,b);
} }
void SMESH_Actor::SetBackSufaceColor(float r,float g,float b){ void SMESH_ActorDef::SetBackSufaceColor(float r,float g,float b){
myBackSurfaceProp->SetColor(r,g,b); myBackSurfaceProp->SetColor(r,g,b);
Modified(); Modified();
} }
void SMESH_Actor::GetBackSufaceColor(float& r,float& g,float& b){ void SMESH_ActorDef::GetBackSufaceColor(float& r,float& g,float& b){
::GetColor(myBackSurfaceProp,r,g,b); ::GetColor(myBackSurfaceProp,r,g,b);
} }
void SMESH_Actor::SetEdgeColor(float r,float g,float b){ void SMESH_ActorDef::SetEdgeColor(float r,float g,float b){
myEdgeProp->SetColor(r,g,b); myEdgeProp->SetColor(r,g,b);
my1DProp->SetColor(r,g,b); my1DProp->SetColor(r,g,b);
my1DExtProp->SetColor(1.0-r,1.0-g,1.0-b); my1DExtProp->SetColor(1.0-r,1.0-g,1.0-b);
Modified(); Modified();
} }
void SMESH_Actor::GetEdgeColor(float& r,float& g,float& b){ void SMESH_ActorDef::GetEdgeColor(float& r,float& g,float& b){
::GetColor(myEdgeProp,r,g,b); ::GetColor(myEdgeProp,r,g,b);
} }
void SMESH_Actor::SetNodeColor(float r,float g,float b){ void SMESH_ActorDef::SetNodeColor(float r,float g,float b){
myNodeProp->SetColor(r,g,b); myNodeProp->SetColor(r,g,b);
Modified(); Modified();
} }
void SMESH_Actor::GetNodeColor(float& r,float& g,float& b){ void SMESH_ActorDef::GetNodeColor(float& r,float& g,float& b){
::GetColor(myNodeProp,r,g,b); ::GetColor(myNodeProp,r,g,b);
} }
void SMESH_Actor::SetHighlightColor(float r,float g,float b){ void SMESH_ActorDef::SetHighlightColor(float r,float g,float b){
myHighlightProp->SetColor(r,g,b); myHighlightProp->SetColor(r,g,b);
Modified(); Modified();
} }
void SMESH_Actor::GetHighlightColor(float& r,float& g,float& b){ void SMESH_ActorDef::GetHighlightColor(float& r,float& g,float& b){
::GetColor(myHighlightProp,r,g,b); ::GetColor(myHighlightProp,r,g,b);
} }
void SMESH_Actor::SetPreHighlightColor(float r,float g,float b){ void SMESH_ActorDef::SetPreHighlightColor(float r,float g,float b){
myPreselectProp->SetColor(r,g,b); myPreselectProp->SetColor(r,g,b);
Modified(); Modified();
} }
void SMESH_Actor::GetPreHighlightColor(float& r,float& g,float& b){ void SMESH_ActorDef::GetPreHighlightColor(float& r,float& g,float& b){
::GetColor(myPreselectProp,r,g,b); ::GetColor(myPreselectProp,r,g,b);
} }
float SMESH_Actor::GetLineWidth(){ float SMESH_ActorDef::GetLineWidth(){
return myEdgeProp->GetLineWidth(); return myEdgeProp->GetLineWidth();
} }
void SMESH_Actor::SetLineWidth(float theVal){ void SMESH_ActorDef::SetLineWidth(float theVal){
myEdgeProp->SetLineWidth(theVal); myEdgeProp->SetLineWidth(theVal);
my1DProp->SetLineWidth(theVal + aLineWidthInc); my1DProp->SetLineWidth(theVal + aLineWidthInc);
@ -1325,7 +1392,7 @@ void SMESH_Actor::SetLineWidth(float theVal){
} }
void SMESH_Actor::SetNodeSize(float theVal){ void SMESH_ActorDef::SetNodeSize(float theVal){
myNodeProp->SetPointSize(theVal); myNodeProp->SetPointSize(theVal);
myHighlightProp->SetPointSize(theVal); myHighlightProp->SetPointSize(theVal);
myPreselectProp->SetPointSize(theVal); myPreselectProp->SetPointSize(theVal);
@ -1336,17 +1403,17 @@ void SMESH_Actor::SetNodeSize(float theVal){
Modified(); Modified();
} }
float SMESH_Actor::GetNodeSize(){ float SMESH_ActorDef::GetNodeSize(){
return myNodeProp->GetPointSize(); return myNodeProp->GetPointSize();
} }
int SMESH_Actor::GetObjDimension( const int theObjId ) int SMESH_ActorDef::GetObjDimension( const int theObjId )
{ {
return myVisualObj->GetElemDimension( theObjId ); return myVisualObj->GetElemDimension( theObjId );
} }
vtkImplicitBoolean* SMESH_Actor::GetPlaneContainer(){ vtkImplicitBoolean* SMESH_ActorDef::GetPlaneContainer(){
return myImplicitBoolean; return myImplicitBoolean;
} }
@ -1418,17 +1485,16 @@ static void PositionToDistance(vtkDataSet* theDataSet,
} }
void SMESH_Actor::SetPlaneParam(float theDir[3], float theDist, vtkPlane* thePlane) void SMESH_ActorDef::SetPlaneParam(float theDir[3], float theDist, vtkPlane* thePlane)
{ {
thePlane->SetNormal(theDir); thePlane->SetNormal(theDir);
float anOrigin[3]; float anOrigin[3];
::DistanceToPosition(GetUnstructuredGrid(),theDir,theDist,anOrigin); ::DistanceToPosition(GetUnstructuredGrid(),theDir,theDist,anOrigin);
thePlane->SetOrigin(anOrigin); thePlane->SetOrigin(anOrigin);
Update();
} }
void SMESH_Actor::GetPlaneParam(float theDir[3], float& theDist, vtkPlane* thePlane) void SMESH_ActorDef::GetPlaneParam(float theDir[3], float& theDist, vtkPlane* thePlane)
{ {
thePlane->GetNormal(theDir); thePlane->GetNormal(theDir);

View File

@ -32,33 +32,16 @@
#include "SALOME_Actor.h" #include "SALOME_Actor.h"
#include "SMESH_Object.h" #include "SMESH_Object.h"
class vtkProperty;
class vtkShrinkFilter;
class vtkPolyDataMapper;
class vtkUnstructuredGrid; class vtkUnstructuredGrid;
class vtkMergeFilter;
class vtkPolyData;
class vtkMapper;
class vtkActor2D;
class vtkMaskPoints;
class vtkCellCenters;
class vtkLabeledDataMapper;
class vtkSelectVisiblePoints;
class vtkScalarBarActor; class vtkScalarBarActor;
class vtkLookupTable;
class vtkPlane; class vtkPlane;
class vtkImplicitBoolean; class vtkImplicitBoolean;
class vtkTimeStamp; class SMESH_Actor: public SALOME_Actor
{
class SMESH_DeviceActor; static SMESH_Actor* New() { return NULL;}
class SMESH_Actor : public SALOME_Actor{
friend class SMESH_VisualObj;
public: public:
vtkTypeMacro(SMESH_Actor,SALOME_Actor); vtkTypeMacro(SMESH_Actor,SALOME_Actor);
@ -67,182 +50,66 @@ class SMESH_Actor : public SALOME_Actor{
const char* theName, const char* theName,
int theIsClear); int theIsClear);
virtual void ReleaseGraphicsResources(vtkWindow *renWin); virtual void SetSufaceColor(float r,float g,float b) = 0;
virtual int RenderOpaqueGeometry(vtkViewport *viewport); virtual void GetSufaceColor(float& r,float& g,float& b) = 0;
virtual int RenderTranslucentGeometry(vtkViewport *viewport);
virtual void Render(vtkRenderer *ren);
virtual void AddToRender(vtkRenderer* theRenderer); virtual void SetBackSufaceColor(float r,float g,float b) = 0;
virtual void RemoveFromRender(vtkRenderer* theRenderer); virtual void GetBackSufaceColor(float& r,float& g,float& b) = 0;
virtual bool hasHighlight() { return true; } virtual void SetEdgeColor(float r,float g,float b) = 0;
virtual void highlight(bool theHighlight); virtual void GetEdgeColor(float& r,float& g,float& b) = 0;
virtual void SetPreSelected(bool thePreselect = false);
virtual bool IsInfinitive(); virtual void SetNodeColor(float r,float g,float b) = 0;
virtual void GetNodeColor(float& r,float& g,float& b) = 0;
virtual void SetOpacity(float theValue); virtual void SetHighlightColor(float r,float g,float b) = 0;
virtual float GetOpacity(); virtual void GetHighlightColor(float& r,float& g,float& b) = 0;
void SetSufaceColor(float r,float g,float b); virtual void SetPreHighlightColor(float r,float g,float b) = 0;
void GetSufaceColor(float& r,float& g,float& b); virtual void GetPreHighlightColor(float& r,float& g,float& b) = 0;
void SetBackSufaceColor(float r,float g,float b); virtual float GetLineWidth() = 0;
void GetBackSufaceColor(float& r,float& g,float& b); virtual void SetLineWidth(float theVal) = 0;
void SetEdgeColor(float r,float g,float b); virtual void SetNodeSize(float size) = 0;
void GetEdgeColor(float& r,float& g,float& b); virtual float GetNodeSize() = 0;
void SetNodeColor(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);
float GetLineWidth();
void SetLineWidth(float theVal);
void SetNodeSize(float size) ;
float GetNodeSize() ;
virtual int GetNodeObjId(int theVtkID);
virtual float* GetNodeCoord(int theObjID);
virtual int GetElemObjId(int theVtkID);
virtual vtkCell* GetElemCell(int theObjID);
virtual int GetObjDimension( const int theObjId );
virtual void SetVisibility(int theMode);
void SetVisibility(int theMode, bool theIsUpdateRepersentation);
enum EReperesent { ePoint, eEdge, eSurface}; enum EReperesent { ePoint, eEdge, eSurface};
virtual void SetRepresentation(int theMode);
void SetPointRepresentation(bool theIsPointsVisible);
bool GetPointRepresentation();
virtual float* GetBounds(); enum EEntityMode { eEdges = 0x01, eFaces = 0x02, eVolumes = 0x04, eAllEntity = 0x07};
virtual void SetTransform(SALOME_Transform* theTransform); virtual void SetEntityMode(unsigned int theMode) = 0;
virtual unsigned int GetEntityMode() const = 0;
vtkUnstructuredGrid* GetUnstructuredGrid(); virtual void SetPointRepresentation(bool theIsPointsVisible) = 0;
virtual vtkDataSet* GetInput(); virtual bool GetPointRepresentation() = 0;
virtual vtkMapper* GetMapper();
virtual float GetShrinkFactor(); virtual vtkUnstructuredGrid* GetUnstructuredGrid() = 0;
virtual void SetShrinkFactor(float value );
virtual bool IsShrunkable() { return myIsShrinkable;} virtual void SetShrinkFactor(float theValue) = 0;
virtual bool IsShrunk() { return myIsShrunk;}
virtual void SetShrink();
virtual void UnShrink();
void SetPointsLabeled(bool theIsPointsLabeled); virtual void SetPointsLabeled(bool theIsPointsLabeled) = 0;
bool GetPointsLabeled(){ return myIsPointsLabeled;} virtual bool GetPointsLabeled() = 0;
void SetCellsLabeled(bool theIsCellsLabeled); virtual void SetCellsLabeled(bool theIsCellsLabeled) = 0;
bool GetCellsLabeled(){ return myIsCellsLabeled;} virtual bool GetCellsLabeled() = 0;
enum eControl{eNone, eLengthEdges, eFreeBorders, eFreeEdges, eMultiConnection, enum eControl{eNone, eLength, eLength2D, eFreeBorders, eFreeEdges, eMultiConnection,
eArea, eTaper, eAspectRatio, eMinimumAngle, eWarping, eSkew}; eArea, eTaper, eAspectRatio, eMinimumAngle, eWarping, eSkew,
void SetControlMode(eControl theMode); eAspectRatio3D, eMultiConnection2D};
eControl GetControlMode(){ return myColorMode;} virtual void SetControlMode(eControl theMode) = 0;
virtual eControl GetControlMode() = 0;
enum e1DControl{e1DNone, e1DColored, e1DHighlited}; virtual vtkScalarBarActor* GetScalarBarActor() = 0;
e1DControl Get1DControlMode(){ return my1DColorMode;}
vtkScalarBarActor* GetScalarBarActor(){ return myScalarBarActor;} virtual void SetPlaneParam(float theDir[3], float theDist, vtkPlane* thePlane) = 0;
virtual void GetPlaneParam(float theDir[3], float& theDist, vtkPlane* thePlane) = 0;
void SetPlaneParam(float theDir[3], float theDist, vtkPlane* thePlane); virtual vtkImplicitBoolean* GetPlaneContainer() = 0;
void GetPlaneParam(float theDir[3], float& theDist, vtkPlane* thePlane);
vtkImplicitBoolean* GetPlaneContainer(); virtual TVisualObjPtr GetObject() = 0;
TVisualObjPtr GetObject() { return myVisualObj;} virtual void SetControlsPrecision( const long ) = 0;
virtual long GetControlsPrecision() const = 0;
void SetControlsPrecision( const long p ) { myControlsPrecision = p; }
long GetControlsPrecision() const { return myControlsPrecision; }
protected:
TVisualObjPtr myVisualObj;
vtkTimeStamp* myTimeStamp;
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;
SMESH_DeviceActor* myNodeHighlitableActor;
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;
vtkImplicitBoolean* myImplicitBoolean;
long myControlsPrecision;
SMESH_Actor();
~SMESH_Actor();
bool Init(TVisualObjPtr theVisualObj,
const char* theEntry,
const char* theName,
int theIsClear);
void SetIsShrunkable(bool theShrunkable);
void UpdateHighlight();
void Update();
private:
// hide the two parameter Render() method from the user and the compiler.
virtual void Render(vtkRenderer *, vtkMapper *) {};
virtual void ShallowCopy(vtkProp *prop);
virtual void SetMapper(vtkMapper *);
static SMESH_Actor* New();
// Not implemented.
SMESH_Actor(const SMESH_Actor&);
void operator=(const SMESH_Actor&);
}; };

244
src/OBJECT/SMESH_ActorDef.h Normal file
View File

@ -0,0 +1,244 @@
// SMESH OBJECT : interactive object for SMESH visualization
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : SMESH_ActorDef.h
// Author : Nicolas REJNERI
// Module : SMESH
// $Header$
#ifndef SMESH_ACTORDEF_H
#define SMESH_ACTORDEF_H
#include "SMESH_Actor.h"
#include "SMESH_Object.h"
class vtkProperty;
class vtkShrinkFilter;
class vtkPolyDataMapper;
class vtkUnstructuredGrid;
class vtkMergeFilter;
class vtkPolyData;
class vtkMapper;
class vtkActor2D;
class vtkMaskPoints;
class vtkCellCenters;
class vtkLabeledDataMapper;
class vtkSelectVisiblePoints;
class vtkScalarBarActor;
class vtkLookupTable;
class vtkPlane;
class vtkImplicitBoolean;
class vtkTimeStamp;
class SMESH_DeviceActor;
class SMESH_ActorDef : public SMESH_Actor{
friend class SMESH_VisualObj;
friend class SMESH_Actor;
public:
vtkTypeMacro(SMESH_ActorDef,SMESH_Actor);
virtual void ReleaseGraphicsResources(vtkWindow *renWin);
virtual int RenderOpaqueGeometry(vtkViewport *viewport);
virtual int RenderTranslucentGeometry(vtkViewport *viewport);
virtual void Render(vtkRenderer *ren);
virtual void AddToRender(vtkRenderer* theRenderer);
virtual void RemoveFromRender(vtkRenderer* theRenderer);
virtual bool hasHighlight() { return true; }
virtual void highlight(bool theHighlight);
virtual void SetPreSelected(bool thePreselect = false);
virtual bool IsInfinitive();
virtual void SetOpacity(float theValue);
virtual float GetOpacity();
virtual void SetSufaceColor(float r,float g,float b);
virtual void GetSufaceColor(float& r,float& g,float& b);
virtual void SetBackSufaceColor(float r,float g,float b);
virtual void GetBackSufaceColor(float& r,float& g,float& b);
virtual void SetEdgeColor(float r,float g,float b);
virtual void GetEdgeColor(float& r,float& g,float& b);
virtual void SetNodeColor(float r,float g,float b);
virtual void GetNodeColor(float& r,float& g,float& b);
virtual void SetHighlightColor(float r,float g,float b);
virtual void GetHighlightColor(float& r,float& g,float& b);
virtual void SetPreHighlightColor(float r,float g,float b);
virtual void GetPreHighlightColor(float& r,float& g,float& b);
virtual float GetLineWidth();
virtual void SetLineWidth(float theVal);
virtual void SetNodeSize(float size) ;
virtual float GetNodeSize() ;
virtual int GetNodeObjId(int theVtkID);
virtual float* GetNodeCoord(int theObjID);
virtual int GetElemObjId(int theVtkID);
virtual vtkCell* GetElemCell(int theObjID);
virtual int GetObjDimension( const int theObjId );
virtual void SetVisibility(int theMode);
void SetVisibility(int theMode, bool theIsUpdateRepersentation);
virtual void SetRepresentation(int theMode);
virtual unsigned int GetEntityMode() const { return myEntityMode;}
virtual void SetEntityMode(unsigned int theMode);
virtual void SetPointRepresentation(bool theIsPointsVisible);
virtual bool GetPointRepresentation();
virtual float* GetBounds();
virtual void SetTransform(SALOME_Transform* theTransform);
virtual vtkUnstructuredGrid* GetUnstructuredGrid();
virtual vtkDataSet* GetInput();
virtual vtkMapper* GetMapper();
virtual float GetShrinkFactor();
virtual void SetShrinkFactor(float theValue);
virtual bool IsShrunkable() { return myIsShrinkable;}
virtual bool IsShrunk() { return myIsShrunk;}
virtual void SetShrink();
virtual void UnShrink();
virtual void SetPointsLabeled(bool theIsPointsLabeled);
virtual bool GetPointsLabeled(){ return myIsPointsLabeled;}
virtual void SetCellsLabeled(bool theIsCellsLabeled);
virtual bool GetCellsLabeled(){ return myIsCellsLabeled;}
virtual void SetControlMode(eControl theMode);
virtual eControl GetControlMode(){ return myControlMode;}
virtual vtkScalarBarActor* GetScalarBarActor(){ return myScalarBarActor;}
virtual void SetPlaneParam(float theDir[3], float theDist, vtkPlane* thePlane);
virtual void GetPlaneParam(float theDir[3], float& theDist, vtkPlane* thePlane);
virtual vtkImplicitBoolean* GetPlaneContainer();
virtual TVisualObjPtr GetObject() { return myVisualObj;}
virtual void SetControlsPrecision( const long p ) { myControlsPrecision = p; }
virtual long GetControlsPrecision() const { return myControlsPrecision; }
protected:
TVisualObjPtr myVisualObj;
vtkTimeStamp* myTimeStamp;
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;
SMESH_DeviceActor* myNodeHighlitableActor;
eControl myControlMode;
SMESH_DeviceActor* my2DActor;
SMESH_DeviceActor* my3DActor;
SMESH_DeviceActor* myControlActor;
vtkProperty* my1DProp;
SMESH_DeviceActor* my1DActor;
vtkProperty* my1DExtProp;
SMESH_DeviceActor* my1DExtActor;
unsigned int myEntityMode;
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;
vtkImplicitBoolean* myImplicitBoolean;
long myControlsPrecision;
SMESH_ActorDef();
~SMESH_ActorDef();
bool Init(TVisualObjPtr theVisualObj,
const char* theEntry,
const char* theName,
int theIsClear);
void SetIsShrunkable(bool theShrunkable);
void UpdateHighlight();
void Update();
private:
// hide the two parameter Render() method from the user and the compiler.
virtual void Render(vtkRenderer *, vtkMapper *) {};
virtual void ShallowCopy(vtkProp *prop);
virtual void SetMapper(vtkMapper *);
static SMESH_ActorDef* New();
// Not implemented.
SMESH_ActorDef(const SMESH_ActorDef&);
void operator=(const SMESH_ActorDef&);
};
#endif //SMESH_ACTORDEF_H

View File

@ -23,6 +23,9 @@
#include "QAD_Config.h" #include "QAD_Config.h"
#include "utilities.h" #include "utilities.h"
#include <vtkUnstructuredGrid.h>
#include <vtkUnstructuredGridWriter.h>
#ifdef _DEBUG_ #ifdef _DEBUG_
static int MYDEBUG = 1; static int MYDEBUG = 1;
#else #else
@ -30,10 +33,22 @@ static int MYDEBUG = 0;
#endif #endif
namespace SMESH{ namespace SMESH{
float GetFloat(const QString& theValue, float theDefault){ float GetFloat(const QString& theValue, float theDefault){
if(theValue.isEmpty()) return theDefault; if(theValue.isEmpty()) return theDefault;
QString aValue = QAD_CONFIG->getSetting(theValue); QString aValue = QAD_CONFIG->getSetting(theValue);
if(aValue.isEmpty()) return theDefault; if(aValue.isEmpty()) return theDefault;
return aValue.toFloat(); return aValue.toFloat();
} }
void WriteUnstructuredGrid(vtkUnstructuredGrid* theGrid, const char* theFileName){
vtkUnstructuredGridWriter* aWriter = vtkUnstructuredGridWriter::New();
aWriter->SetFileName(theFileName);
aWriter->SetInput(theGrid);
if(theGrid->GetNumberOfCells()){
aWriter->Write();
}
aWriter->Delete();
}
} }

View File

@ -22,10 +22,14 @@
#include <qstring.h> #include <qstring.h>
class vtkUnstructuredGrid;
namespace SMESH{ namespace SMESH{
float GetFloat(const QString& theValue, float theDefault = 0); float GetFloat(const QString& theValue, float theDefault = 0);
void WriteUnstructuredGrid(vtkUnstructuredGrid* theGrid, const char* theFileName);
} }
#endif #endif

View File

@ -24,19 +24,19 @@
// File : SMESH_Actor.cxx // File : SMESH_Actor.cxx
// Author : Nicolas REJNERI // Author : Nicolas REJNERI
// Module : SMESH // Module : SMESH
// $Header$ // $Header$Header$
#include "SMESH_DeviceActor.h" #include "SMESH_DeviceActor.h"
#include "SMESH_ExtractGeometry.h" #include "SMESH_ExtractGeometry.h"
#include "SMESH_ControlsDef.hxx"
#include "SMESH_ActorUtils.h"
#include "SALOME_Transform.h" #include "SALOME_Transform.h"
#include "SALOME_TransformFilter.h" #include "SALOME_TransformFilter.h"
#include "SALOME_PassThroughFilter.h" #include "SALOME_PassThroughFilter.h"
#include "SALOME_ExtractUnstructuredGrid.h" #include "SALOME_ExtractUnstructuredGrid.h"
#include "utilities.h"
// VTK Includes // VTK Includes
#include <vtkObjectFactory.h> #include <vtkObjectFactory.h>
#include <vtkShrinkFilter.h> #include <vtkShrinkFilter.h>
@ -61,12 +61,12 @@
#include <vtkImplicitBoolean.h> #include <vtkImplicitBoolean.h>
#include "utilities.h"
#ifdef _DEBUG_ #ifdef _DEBUG_
static int MYDEBUG = 0; static int MYDEBUG = 0;
static int MYDEBUGWITHFILES = 0;
#else #else
static int MYDEBUG = 0; static int MYDEBUG = 0;
static int MYDEBUGWITHFILES = 0;
#endif #endif
using namespace std; using namespace std;
@ -261,6 +261,146 @@ void SMESH_DeviceActor::SetControlMode(SMESH::Controls::FunctorPtr theFunctor,
theScalarBarActor->SetVisibility(anIsInitialized); theScalarBarActor->SetVisibility(anIsInitialized);
} }
void SMESH_DeviceActor::SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor,
SMESH_DeviceActor* theDeviceActor,
vtkScalarBarActor* theScalarBarActor,
vtkLookupTable* theLookupTable)
{
bool anIsInitialized = theFunctor;
using namespace SMESH::Controls;
if (anIsInitialized){
if (Length2D* aLength2D = dynamic_cast<Length2D*>(theFunctor.get())){
SMESH::Controls::Length2D::TValues aValues;
myVisualObj->UpdateFunctor(theFunctor);
aLength2D->GetValues(aValues);
vtkUnstructuredGrid* aDataSet = vtkUnstructuredGrid::New();
vtkUnstructuredGrid* aGrid = myVisualObj->GetUnstructuredGrid();
aDataSet->SetPoints(aGrid->GetPoints());
vtkIdType aNbCells = aValues.size();
vtkDoubleArray *aScalars = vtkDoubleArray::New();
aScalars->SetNumberOfComponents(1);
aScalars->SetNumberOfTuples(aNbCells);
vtkIdType aCellsSize = 3*aNbCells;
vtkCellArray* aConnectivity = vtkCellArray::New();
aConnectivity->Allocate( aCellsSize, 0 );
vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
aCellTypesArray->SetNumberOfComponents( 1 );
aCellTypesArray->Allocate( aNbCells * aCellTypesArray->GetNumberOfComponents() );
vtkIdList *anIdList = vtkIdList::New();
anIdList->SetNumberOfIds(2);
Length2D::TValues::const_iterator anIter = aValues.begin();
for(vtkIdType aVtkId = 0; anIter != aValues.end(); anIter++,aVtkId++){
const Length2D::Value& aValue = *anIter;
int aNode[2] = {
myVisualObj->GetNodeVTKId(aValue.myPntId[0]),
myVisualObj->GetNodeVTKId(aValue.myPntId[1])
};
if(aNode[0] >= 0 && aNode[1] >= 0){
anIdList->SetId( 0, aNode[0] );
anIdList->SetId( 1, aNode[1] );
aConnectivity->InsertNextCell( anIdList );
aCellTypesArray->InsertNextValue( VTK_LINE );
aScalars->SetValue(aVtkId,aValue.myLength);
}
}
vtkIntArray* aCellLocationsArray = vtkIntArray::New();
aCellLocationsArray->SetNumberOfComponents( 1 );
aCellLocationsArray->SetNumberOfTuples( aNbCells );
aConnectivity->InitTraversal();
for( vtkIdType idType = 0, *pts, npts; aConnectivity->GetNextCell( npts, pts ); idType++ )
aCellLocationsArray->SetValue( idType, aConnectivity->GetTraversalLocation( npts ) );
aDataSet->SetCells( aCellTypesArray, aCellLocationsArray,aConnectivity );
SetUnstructuredGrid(aDataSet);
aDataSet->GetCellData()->SetScalars(aScalars);
aScalars->Delete();
theLookupTable->SetRange(aScalars->GetRange());
theLookupTable->Build();
myMergeFilter->SetScalars(aDataSet);
aDataSet->Delete();
}
else if (MultiConnection2D* aMultiConnection2D = dynamic_cast<MultiConnection2D*>(theFunctor.get())){
SMESH::Controls::MultiConnection2D::MValues aValues;
myVisualObj->UpdateFunctor(theFunctor);
aMultiConnection2D->GetValues(aValues);
vtkUnstructuredGrid* aDataSet = vtkUnstructuredGrid::New();
vtkUnstructuredGrid* aGrid = myVisualObj->GetUnstructuredGrid();
aDataSet->SetPoints(aGrid->GetPoints());
vtkIdType aNbCells = aValues.size();
vtkDoubleArray *aScalars = vtkDoubleArray::New();
aScalars->SetNumberOfComponents(1);
aScalars->SetNumberOfTuples(aNbCells);
vtkIdType aCellsSize = 3*aNbCells;
vtkCellArray* aConnectivity = vtkCellArray::New();
aConnectivity->Allocate( aCellsSize, 0 );
vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
aCellTypesArray->SetNumberOfComponents( 1 );
aCellTypesArray->Allocate( aNbCells * aCellTypesArray->GetNumberOfComponents() );
vtkIdList *anIdList = vtkIdList::New();
anIdList->SetNumberOfIds(2);
MultiConnection2D::MValues::const_iterator anIter = aValues.begin();
int i = 0;
for(vtkIdType aVtkId; anIter != aValues.end(); anIter++,i++){
const MultiConnection2D::Value& aValue = (*anIter).first;
int aNode[2] = {
myVisualObj->GetNodeVTKId(aValue.myPntId[0]),
myVisualObj->GetNodeVTKId(aValue.myPntId[1])
};
if(aNode[0] >= 0 && aNode[1] >= 0){
anIdList->SetId( 0, aNode[0] );
anIdList->SetId( 1, aNode[1] );
aConnectivity->InsertNextCell( anIdList );
aCellTypesArray->InsertNextValue( VTK_LINE );
aScalars->SetValue(i,(*anIter).second);
}
}
vtkIntArray* aCellLocationsArray = vtkIntArray::New();
aCellLocationsArray->SetNumberOfComponents( 1 );
aCellLocationsArray->SetNumberOfTuples( aNbCells );
aConnectivity->InitTraversal();
for( vtkIdType idType = 0, *pts, npts; aConnectivity->GetNextCell( npts, pts ); idType++ )
aCellLocationsArray->SetValue( idType, aConnectivity->GetTraversalLocation( npts ) );
aDataSet->SetCells( aCellTypesArray, aCellLocationsArray,aConnectivity );
SetUnstructuredGrid(aDataSet);
aDataSet->GetCellData()->SetScalars(aScalars);
aScalars->Delete();
theLookupTable->SetRange(aScalars->GetRange());
theLookupTable->Build();
myMergeFilter->SetScalars(aDataSet);
aDataSet->Delete();
}
}
GetMapper()->SetScalarVisibility(anIsInitialized);
theScalarBarActor->SetVisibility(anIsInitialized);
}
void SMESH_DeviceActor::SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor, void SMESH_DeviceActor::SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor,
SMESH_DeviceActor* theDeviceActor) SMESH_DeviceActor* theDeviceActor)
@ -304,7 +444,7 @@ void SMESH_DeviceActor::SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor
anIdList->SetNumberOfIds(2); anIdList->SetNumberOfIds(2);
FreeEdges::TBorders::const_iterator anIter = aBorders.begin(); FreeEdges::TBorders::const_iterator anIter = aBorders.begin();
for(vtkIdType aVtkId; anIter != aBorders.end(); anIter++){ for(; anIter != aBorders.end(); anIter++){
const FreeEdges::Border& aBorder = *anIter; const FreeEdges::Border& aBorder = *anIter;
int aNode[2] = { int aNode[2] = {
myVisualObj->GetNodeVTKId(aBorder.myPntId[0]), myVisualObj->GetNodeVTKId(aBorder.myPntId[0]),
@ -335,6 +475,8 @@ void SMESH_DeviceActor::SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor
} }
unsigned long int SMESH_DeviceActor::GetMTime(){ unsigned long int SMESH_DeviceActor::GetMTime(){
unsigned long mTime = this->Superclass::GetMTime(); unsigned long mTime = this->Superclass::GetMTime();
mTime = max(mTime,myExtractGeometry->GetMTime()); mTime = max(mTime,myExtractGeometry->GetMTime());

View File

@ -55,7 +55,7 @@ class SMESH_ExtractGeometry;
class SMESH_DeviceActor: public vtkLODActor{ class SMESH_DeviceActor: public vtkLODActor{
friend class SMESH_Actor; friend class SMESH_ActorDef;
public: public:
vtkTypeMacro(SMESH_DeviceActor,vtkLODActor); vtkTypeMacro(SMESH_DeviceActor,vtkLODActor);
@ -94,6 +94,10 @@ class SMESH_DeviceActor: public vtkLODActor{
void SetControlMode(SMESH::Controls::FunctorPtr theFunctor, void SetControlMode(SMESH::Controls::FunctorPtr theFunctor,
vtkScalarBarActor* theScalarBarActor, vtkScalarBarActor* theScalarBarActor,
vtkLookupTable* theLookupTable); vtkLookupTable* theLookupTable);
void SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor,
SMESH_DeviceActor* theDeviceActor,
vtkScalarBarActor* theScalarBarActor,
vtkLookupTable* theLookupTable);
void SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor, void SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor,
SMESH_DeviceActor* theDeviceActor); SMESH_DeviceActor* theDeviceActor);

View File

@ -25,10 +25,13 @@
// Author : Nicolas REJNERI // Author : Nicolas REJNERI
// Module : SMESH // Module : SMESH
#include "SMESH_Object.h" #include "SMESH_ObjectDef.h"
#include "SMESH_ActorUtils.h"
#include "SMDS_Mesh.hxx" #include "SMDS_Mesh.hxx"
#include "SALOME_ExtractUnstructuredGrid.h"
#include "SMESH_Actor.h" #include "SMESH_Actor.h"
#include "SMESH_ControlsDef.hxx"
#include "SALOME_ExtractUnstructuredGrid.h"
#include CORBA_SERVER_HEADER(SALOME_Exception) #include CORBA_SERVER_HEADER(SALOME_Exception)
@ -39,8 +42,6 @@
#include <vtkUnsignedCharArray.h> #include <vtkUnsignedCharArray.h>
#include <vtkUnstructuredGrid.h> #include <vtkUnstructuredGrid.h>
#include <vtkUnstructuredGridWriter.h>
#include <vtkUnstructuredGridReader.h>
#include <memory> #include <memory>
#include <sstream> #include <sstream>
@ -68,17 +69,6 @@ static int MYDEBUGWITHFILES = 0;
#endif #endif
void WriteUnstructuredGrid(vtkUnstructuredGrid* theGrid, const char* theFileName){
vtkUnstructuredGridWriter* aWriter = vtkUnstructuredGridWriter::New();
aWriter->SetFileName(theFileName);
aWriter->SetInput(theGrid);
if(theGrid->GetNumberOfCells()){
aWriter->Write();
}
aWriter->Delete();
}
namespace{ namespace{
inline const SMDS_MeshNode* FindNode(const SMDS_Mesh* theMesh, int theId){ inline const SMDS_MeshNode* FindNode(const SMDS_Mesh* theMesh, int theId){
@ -117,7 +107,6 @@ namespace{
SMESH::log_array_var& theSeq, SMESH::log_array_var& theSeq,
CORBA::Long theId) CORBA::Long theId)
{ {
const SMESH::double_array& aCoords = theSeq[theId].coords;
const SMESH::long_array& anIndexes = theSeq[theId].indexes; const SMESH::long_array& anIndexes = theSeq[theId].indexes;
CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number; CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
if(3*aNbElems != anIndexes.length()) if(3*aNbElems != anIndexes.length())
@ -136,7 +125,6 @@ namespace{
SMESH::log_array_var& theSeq, SMESH::log_array_var& theSeq,
CORBA::Long theId) CORBA::Long theId)
{ {
const SMESH::double_array& aCoords = theSeq[theId].coords;
const SMESH::long_array& anIndexes = theSeq[theId].indexes; const SMESH::long_array& anIndexes = theSeq[theId].indexes;
CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number; CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
if(4*aNbElems != anIndexes.length()) if(4*aNbElems != anIndexes.length())
@ -156,7 +144,6 @@ namespace{
SMESH::log_array_var theSeq, SMESH::log_array_var theSeq,
CORBA::Long theId) CORBA::Long theId)
{ {
const SMESH::double_array& aCoords = theSeq[theId].coords;
const SMESH::long_array& anIndexes = theSeq[theId].indexes; const SMESH::long_array& anIndexes = theSeq[theId].indexes;
CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number; CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
if(5*aNbElems != anIndexes.length()) if(5*aNbElems != anIndexes.length())
@ -177,7 +164,6 @@ namespace{
SMESH::log_array_var& theSeq, SMESH::log_array_var& theSeq,
CORBA::Long theId) CORBA::Long theId)
{ {
const SMESH::double_array& aCoords = theSeq[theId].coords;
const SMESH::long_array& anIndexes = theSeq[theId].indexes; const SMESH::long_array& anIndexes = theSeq[theId].indexes;
CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number; CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
if(5*aNbElems != anIndexes.length()) if(5*aNbElems != anIndexes.length())
@ -198,7 +184,6 @@ namespace{
SMESH::log_array_var& theSeq, SMESH::log_array_var& theSeq,
CORBA::Long theId) CORBA::Long theId)
{ {
const SMESH::double_array& aCoords = theSeq[theId].coords;
const SMESH::long_array& anIndexes = theSeq[theId].indexes; const SMESH::long_array& anIndexes = theSeq[theId].indexes;
CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number; CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
if(6*aNbElems != anIndexes.length()) if(6*aNbElems != anIndexes.length())
@ -220,7 +205,6 @@ namespace{
SMESH::log_array_var& theSeq, SMESH::log_array_var& theSeq,
CORBA::Long theId) CORBA::Long theId)
{ {
const SMESH::double_array& aCoords = theSeq[theId].coords;
const SMESH::long_array& anIndexes = theSeq[theId].indexes; const SMESH::long_array& anIndexes = theSeq[theId].indexes;
CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number; CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
if(7*aNbElems != anIndexes.length()) if(7*aNbElems != anIndexes.length())
@ -243,7 +227,6 @@ namespace{
SMESH::log_array_var& theSeq, SMESH::log_array_var& theSeq,
CORBA::Long theId) CORBA::Long theId)
{ {
const SMESH::double_array& aCoords = theSeq[theId].coords;
const SMESH::long_array& anIndexes = theSeq[theId].indexes; const SMESH::long_array& anIndexes = theSeq[theId].indexes;
CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number; CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
if(9*aNbElems != anIndexes.length()) if(9*aNbElems != anIndexes.length())
@ -266,7 +249,7 @@ namespace{
} }
/* /*
Class : SMESH_VisualObj Class : SMESH_VisualObjDef
Description : Base class for all mesh objects to be visuilised Description : Base class for all mesh objects to be visuilised
*/ */
@ -274,18 +257,21 @@ namespace{
// function : getCellType // function : getCellType
// purpose : Get type of VTK cell // purpose : Get type of VTK cell
//================================================================================= //=================================================================================
static inline vtkIdType getCellType( const SMESH::ElementType theType, static inline vtkIdType getCellType( const SMDSAbs_ElementType theType,
const int theNbNodes ) const int theNbNodes )
{ {
switch( theType ) switch( theType )
{ {
case SMESH::EDGE: return theNbNodes == 2 ? VTK_LINE : VTK_EMPTY_CELL; case SMDSAbs_Edge:
return theNbNodes == 2 ? VTK_LINE : VTK_EMPTY_CELL;
case SMESH::FACE : if ( theNbNodes == 3 ) return VTK_TRIANGLE; case SMDSAbs_Face :
if ( theNbNodes == 3 ) return VTK_TRIANGLE;
else if ( theNbNodes == 4 ) return VTK_QUAD; else if ( theNbNodes == 4 ) return VTK_QUAD;
else return VTK_EMPTY_CELL; else return VTK_EMPTY_CELL;
case SMESH::VOLUME: if ( theNbNodes == 4 ) return VTK_TETRA; case SMDSAbs_Volume:
if ( theNbNodes == 4 ) return VTK_TETRA;
else if ( theNbNodes == 5 ) return VTK_PYRAMID; else if ( theNbNodes == 5 ) return VTK_PYRAMID;
else if ( theNbNodes == 6 ) return VTK_WEDGE; else if ( theNbNodes == 6 ) return VTK_WEDGE;
else if ( theNbNodes == 8 ) return VTK_HEXAHEDRON; else if ( theNbNodes == 8 ) return VTK_HEXAHEDRON;
@ -296,14 +282,14 @@ static inline vtkIdType getCellType( const SMESH::ElementType theType,
} }
//================================================================================= //=================================================================================
// functions : SMESH_VisualObj // functions : SMESH_VisualObjDef
// purpose : Constructor // purpose : Constructor
//================================================================================= //=================================================================================
SMESH_VisualObj::SMESH_VisualObj() SMESH_VisualObjDef::SMESH_VisualObjDef()
{ {
myGrid = vtkUnstructuredGrid::New(); myGrid = vtkUnstructuredGrid::New();
} }
SMESH_VisualObj::~SMESH_VisualObj() SMESH_VisualObjDef::~SMESH_VisualObjDef()
{ {
if ( MYDEBUG ) if ( MYDEBUG )
MESSAGE( "~SMESH_MeshObj - myGrid->GetReferenceCount() = " << myGrid->GetReferenceCount() ); MESSAGE( "~SMESH_MeshObj - myGrid->GetReferenceCount() = " << myGrid->GetReferenceCount() );
@ -314,37 +300,37 @@ SMESH_VisualObj::~SMESH_VisualObj()
// functions : GetNodeObjId, GetNodeVTKId, GetElemObjId, GetElemVTKId // functions : GetNodeObjId, GetNodeVTKId, GetElemObjId, GetElemVTKId
// purpose : Methods for retrieving VTK IDs by SMDS IDs and vice versa // purpose : Methods for retrieving VTK IDs by SMDS IDs and vice versa
//================================================================================= //=================================================================================
vtkIdType SMESH_VisualObj::GetNodeObjId( int theVTKID ) vtkIdType SMESH_VisualObjDef::GetNodeObjId( int theVTKID )
{ {
return myVTK2SMDSNodes.find(theVTKID) == myVTK2SMDSNodes.end() ? -1 : myVTK2SMDSNodes[theVTKID]; return myVTK2SMDSNodes.find(theVTKID) == myVTK2SMDSNodes.end() ? -1 : myVTK2SMDSNodes[theVTKID];
} }
vtkIdType SMESH_VisualObj::GetNodeVTKId( int theObjID ) vtkIdType SMESH_VisualObjDef::GetNodeVTKId( int theObjID )
{ {
return mySMDS2VTKNodes.find(theObjID) == mySMDS2VTKNodes.end() ? -1 : mySMDS2VTKNodes[theObjID]; return mySMDS2VTKNodes.find(theObjID) == mySMDS2VTKNodes.end() ? -1 : mySMDS2VTKNodes[theObjID];
} }
vtkIdType SMESH_VisualObj::GetElemObjId( int theVTKID ) vtkIdType SMESH_VisualObjDef::GetElemObjId( int theVTKID )
{ {
return myVTK2SMDSElems.find(theVTKID) == myVTK2SMDSElems.end() ? -1 : myVTK2SMDSElems[theVTKID]; return myVTK2SMDSElems.find(theVTKID) == myVTK2SMDSElems.end() ? -1 : myVTK2SMDSElems[theVTKID];
} }
vtkIdType SMESH_VisualObj::GetElemVTKId( int theObjID ) vtkIdType SMESH_VisualObjDef::GetElemVTKId( int theObjID )
{ {
return mySMDS2VTKElems.find(theObjID) == mySMDS2VTKElems.end() ? -1 : mySMDS2VTKElems[theObjID]; return mySMDS2VTKElems.find(theObjID) == mySMDS2VTKElems.end() ? -1 : mySMDS2VTKElems[theObjID];
} }
//================================================================================= //=================================================================================
// function : SMESH_VisualObj::createPoints // function : SMESH_VisualObjDef::createPoints
// purpose : Create points from nodes // purpose : Create points from nodes
//================================================================================= //=================================================================================
void SMESH_VisualObj::createPoints( vtkPoints* thePoints ) void SMESH_VisualObjDef::createPoints( vtkPoints* thePoints )
{ {
if ( thePoints == 0 ) if ( thePoints == 0 )
return; return;
TEntityList aNodes; TEntityList aNodes;
vtkIdType nbNodes = GetEntities( SMESH::NODE, aNodes ); vtkIdType nbNodes = GetEntities( SMDSAbs_Node, aNodes );
thePoints->SetNumberOfPoints( nbNodes ); thePoints->SetNumberOfPoints( nbNodes );
int nbPoints = 0; int nbPoints = 0;
@ -371,7 +357,7 @@ void SMESH_VisualObj::createPoints( vtkPoints* thePoints )
// function : buildPrs // function : buildPrs
// purpose : create VTK cells( fill unstructured grid ) // purpose : create VTK cells( fill unstructured grid )
//================================================================================= //=================================================================================
void SMESH_VisualObj::buildPrs() void SMESH_VisualObjDef::buildPrs()
{ {
try try
{ {
@ -395,18 +381,17 @@ void SMESH_VisualObj::buildPrs()
} }
if( MYDEBUG ) MESSAGE( "Update - myGrid->GetNumberOfCells() = "<<myGrid->GetNumberOfCells() ); if( MYDEBUG ) MESSAGE( "Update - myGrid->GetNumberOfCells() = "<<myGrid->GetNumberOfCells() );
if( MYDEBUGWITHFILES ) WriteUnstructuredGrid( myGrid,"/tmp/buildPrs" ); if( MYDEBUGWITHFILES ) SMESH::WriteUnstructuredGrid( myGrid,"/tmp/buildPrs" );
} }
//================================================================================= //=================================================================================
// function : buildNodePrs // function : buildNodePrs
// purpose : create VTK cells for nodes // purpose : create VTK cells for nodes
//================================================================================= //=================================================================================
void SMESH_VisualObj::buildNodePrs() void SMESH_VisualObjDef::buildNodePrs()
{ {
vtkPoints* aPoints = vtkPoints::New(); vtkPoints* aPoints = vtkPoints::New();
createPoints( aPoints ); createPoints( aPoints );
int nbPoints = aPoints->GetNumberOfPoints();
myGrid->SetPoints( aPoints ); myGrid->SetPoints( aPoints );
aPoints->Delete(); aPoints->Delete();
@ -414,6 +399,7 @@ void SMESH_VisualObj::buildNodePrs()
// Create cells // Create cells
/* /*
int nbPoints = aPoints->GetNumberOfPoints();
vtkIdList *anIdList = vtkIdList::New(); vtkIdList *anIdList = vtkIdList::New();
anIdList->SetNumberOfIds( 1 ); anIdList->SetNumberOfIds( 1 );
@ -452,7 +438,33 @@ void SMESH_VisualObj::buildNodePrs()
// function : buildElemPrs // function : buildElemPrs
// purpose : Create VTK cells for elements // purpose : Create VTK cells for elements
//================================================================================= //=================================================================================
void SMESH_VisualObj::buildElemPrs()
namespace{
typedef std::vector<const SMDS_MeshElement*> TConnect;
int GetConnect(const SMDS_ElemIteratorPtr& theNodesIter,
TConnect& theConnect)
{
theConnect.clear();
for(; theNodesIter->more();)
theConnect.push_back(theNodesIter->next());
return theConnect.size();
}
inline
void SetId(vtkIdList *theIdList,
const SMESH_VisualObjDef::TMapOfIds& theSMDS2VTKNodes,
const TConnect& theConnect,
int thePosition,
int theId)
{
theIdList->SetId(thePosition,theSMDS2VTKNodes.find(theConnect[theId]->GetID())->second);
}
}
void SMESH_VisualObjDef::buildElemPrs()
{ {
// Create points // Create points
@ -466,16 +478,16 @@ void SMESH_VisualObj::buildElemPrs()
// Calculate cells size // Calculate cells size
static SMESH::ElementType aTypes[ 3 ] = { SMESH::EDGE, SMESH::FACE, SMESH::VOLUME }; static SMDSAbs_ElementType aTypes[ 3 ] = { SMDSAbs_Edge, SMDSAbs_Face, SMDSAbs_Volume };
// get entity data // get entity data
map< int, int > nbEnts; map<SMDSAbs_ElementType,int> nbEnts;
map< int, TEntityList > anEnts; map<SMDSAbs_ElementType,TEntityList> anEnts;
for ( int i = 0; i <= 2; i++ ) for ( int i = 0; i <= 2; i++ )
nbEnts[ aTypes[ i ] ] = GetEntities( aTypes[ i ], anEnts[ aTypes[ i ] ] ); nbEnts[ aTypes[ i ] ] = GetEntities( aTypes[ i ], anEnts[ aTypes[ i ] ] );
vtkIdType aCellsSize = 3 * nbEnts[ SMESH::EDGE ]; vtkIdType aCellsSize = 3 * nbEnts[ SMDSAbs_Edge ];
for ( int i = 1; i <= 2; i++ ) // iterate through faces and volumes for ( int i = 1; i <= 2; i++ ) // iterate through faces and volumes
{ {
@ -488,7 +500,7 @@ void SMESH_VisualObj::buildElemPrs()
} }
} }
vtkIdType aNbCells = nbEnts[ SMESH::EDGE ] + nbEnts[ SMESH::FACE ] + nbEnts[ SMESH::VOLUME ]; vtkIdType aNbCells = nbEnts[ SMDSAbs_Edge ] + nbEnts[ SMDSAbs_Face ] + nbEnts[ SMDSAbs_Volume ];
if ( MYDEBUG ) if ( MYDEBUG )
MESSAGE( "Update - aNbCells = "<<aNbCells<<"; aCellsSize = "<<aCellsSize ); MESSAGE( "Update - aNbCells = "<<aNbCells<<"; aCellsSize = "<<aCellsSize );
@ -505,11 +517,15 @@ void SMESH_VisualObj::buildElemPrs()
vtkIdList *anIdList = vtkIdList::New(); vtkIdList *anIdList = vtkIdList::New();
vtkIdType iElem = 0; vtkIdType iElem = 0;
TConnect aConnect;
aConnect.reserve(VTK_CELL_SIZE);
for ( int i = 0; i <= 2; i++ ) // iterate through edges, faces and volumes for ( int i = 0; i <= 2; i++ ) // iterate through edges, faces and volumes
{ {
if( nbEnts[ aTypes[ i ] ] > 0 ) if( nbEnts[ aTypes[ i ] ] > 0 )
{ {
const TEntityList& aList = anEnts[ aTypes[ i ] ]; const SMDSAbs_ElementType& aType = aTypes[ i ];
const TEntityList& aList = anEnts[ aType ];
TEntityList::const_iterator anIter; TEntityList::const_iterator anIter;
for ( anIter = aList.begin(); anIter != aList.end(); ++anIter ) for ( anIter = aList.begin(); anIter != aList.end(); ++anIter )
{ {
@ -524,14 +540,48 @@ void SMESH_VisualObj::buildElemPrs()
myVTK2SMDSElems.insert( TMapOfIds::value_type( iElem, anId ) ); myVTK2SMDSElems.insert( TMapOfIds::value_type( iElem, anId ) );
SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator(); SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator();
for( vtkIdType aNodeId = 0; aNodesIter->more(); aNodeId++ ) switch(aType){
{ case SMDSAbs_Volume:{
int* aConnectivities = NULL;
GetConnect(aNodesIter,aConnect);
// Convertions connectivities from SMDS to VTK
switch(aNbNodes){
case 4:{
static int anIds[] = {0,2,1,3};
aConnectivities = anIds;
break;
}
case 5:{
static int anIds[] = {0,3,2,1,4};
aConnectivities = anIds;
break;
}
case 6:{
static int anIds[] = {0,1,2,3,4,5};
aConnectivities = anIds;
break;
}
case 8:{
static int anIds[] = {0,3,2,1,4,7,6,5};
aConnectivities = anIds;
break;
}}
if(aConnectivities)
for( vtkIdType aNodeId = 0; aNodeId < aNbNodes; aNodeId++ )
SetId(anIdList,mySMDS2VTKNodes,aConnect,aNodeId,aConnectivities[aNodeId]);
break;
}
default:
for( vtkIdType aNodeId = 0; aNodesIter->more(); aNodeId++ ){
const SMDS_MeshElement* aNode = aNodesIter->next(); const SMDS_MeshElement* aNode = aNodesIter->next();
anIdList->SetId( aNodeId, mySMDS2VTKNodes[aNode->GetID()] ); anIdList->SetId( aNodeId, mySMDS2VTKNodes[aNode->GetID()] );
} }
}
aConnectivity->InsertNextCell( anIdList ); aConnectivity->InsertNextCell( anIdList );
aCellTypesArray->InsertNextValue( getCellType( aTypes[ i ], aNbNodes ) ); aCellTypesArray->InsertNextValue( getCellType( aType, aNbNodes ) );
iElem++; iElem++;
} }
@ -560,7 +610,7 @@ void SMESH_VisualObj::buildElemPrs()
// function : GetEdgeNodes // function : GetEdgeNodes
// purpose : Retrieve ids of nodes from edge of elements ( edge is numbered from 1 ) // purpose : Retrieve ids of nodes from edge of elements ( edge is numbered from 1 )
//================================================================================= //=================================================================================
bool SMESH_VisualObj::GetEdgeNodes( const int theElemId, bool SMESH_VisualObjDef::GetEdgeNodes( const int theElemId,
const int theEdgeNum, const int theEdgeNum,
int& theNodeId1, int& theNodeId1,
int& theNodeId2 ) const int& theNodeId2 ) const
@ -650,7 +700,6 @@ void SMESH_MeshObj::Update( int theIsClear )
const SMESH::double_array& aCoords = aSeq[anId].coords; const SMESH::double_array& aCoords = aSeq[anId].coords;
const SMESH::long_array& anIndexes = aSeq[anId].indexes; const SMESH::long_array& anIndexes = aSeq[anId].indexes;
CORBA::Long anElemId = 0, aNbElems = aSeq[anId].number; CORBA::Long anElemId = 0, aNbElems = aSeq[anId].number;
SMDS_MeshElement* anElem = NULL;
CORBA::Long aCommand = aSeq[anId].commandType; CORBA::Long aCommand = aSeq[anId].commandType;
switch(aCommand) switch(aCommand)
@ -760,26 +809,26 @@ int SMESH_MeshObj::GetElemDimension( const int theObjId )
// function : GetEntities // function : GetEntities
// purpose : Get entities of specified type. Return number of entities // purpose : Get entities of specified type. Return number of entities
//================================================================================= //=================================================================================
int SMESH_MeshObj::GetNbEntities( const SMESH::ElementType theType) const int SMESH_MeshObj::GetNbEntities( const SMDSAbs_ElementType theType) const
{ {
switch ( theType ) switch ( theType )
{ {
case SMESH::NODE: case SMDSAbs_Node:
{ {
return myMesh->NbNodes(); return myMesh->NbNodes();
} }
break; break;
case SMESH::EDGE: case SMDSAbs_Edge:
{ {
return myMesh->NbEdges(); return myMesh->NbEdges();
} }
break; break;
case SMESH::FACE: case SMDSAbs_Face:
{ {
return myMesh->NbFaces(); return myMesh->NbFaces();
} }
break; break;
case SMESH::VOLUME: case SMDSAbs_Volume:
{ {
return myMesh->NbVolumes(); return myMesh->NbVolumes();
} }
@ -790,31 +839,31 @@ int SMESH_MeshObj::GetNbEntities( const SMESH::ElementType theType) const
} }
} }
int SMESH_MeshObj::GetEntities( const SMESH::ElementType theType, TEntityList& theObjs ) const int SMESH_MeshObj::GetEntities( const SMDSAbs_ElementType theType, TEntityList& theObjs ) const
{ {
theObjs.clear(); theObjs.clear();
switch ( theType ) switch ( theType )
{ {
case SMESH::NODE: case SMDSAbs_Node:
{ {
SMDS_NodeIteratorPtr anIter = myMesh->nodesIterator(); SMDS_NodeIteratorPtr anIter = myMesh->nodesIterator();
while ( anIter->more() ) theObjs.push_back( anIter->next() ); while ( anIter->more() ) theObjs.push_back( anIter->next() );
} }
break; break;
case SMESH::EDGE: case SMDSAbs_Edge:
{ {
SMDS_EdgeIteratorPtr anIter = myMesh->edgesIterator(); SMDS_EdgeIteratorPtr anIter = myMesh->edgesIterator();
while ( anIter->more() ) theObjs.push_back( anIter->next() ); while ( anIter->more() ) theObjs.push_back( anIter->next() );
} }
break; break;
case SMESH::FACE: case SMDSAbs_Face:
{ {
SMDS_FaceIteratorPtr anIter = myMesh->facesIterator(); SMDS_FaceIteratorPtr anIter = myMesh->facesIterator();
while ( anIter->more() ) theObjs.push_back( anIter->next() ); while ( anIter->more() ) theObjs.push_back( anIter->next() );
} }
break; break;
case SMESH::VOLUME: case SMDSAbs_Volume:
{ {
SMDS_VolumeIteratorPtr anIter = myMesh->volumesIterator(); SMDS_VolumeIteratorPtr anIter = myMesh->volumesIterator();
while ( anIter->more() ) theObjs.push_back( anIter->next() ); while ( anIter->more() ) theObjs.push_back( anIter->next() );
@ -964,14 +1013,14 @@ static int getNodesFromElems( SMESH::long_array_var& theElemIds,
// function : getPointers // function : getPointers
// purpose : Get std::list<const SMDS_MeshElement*> from list of IDs // purpose : Get std::list<const SMDS_MeshElement*> from list of IDs
//================================================================================= //=================================================================================
static int getPointers( const SMESH::ElementType theRequestType, static int getPointers( const SMDSAbs_ElementType theRequestType,
SMESH::long_array_var& theElemIds, SMESH::long_array_var& theElemIds,
const SMDS_Mesh* theMesh, const SMDS_Mesh* theMesh,
std::list<const SMDS_MeshElement*>& theResList ) std::list<const SMDS_MeshElement*>& theResList )
{ {
for ( CORBA::Long i = 0, n = theElemIds->length(); i < n; i++ ) for ( CORBA::Long i = 0, n = theElemIds->length(); i < n; i++ )
{ {
const SMDS_MeshElement* anElem = theRequestType == SMESH::NODE const SMDS_MeshElement* anElem = theRequestType == SMDSAbs_Node
? theMesh->FindNode( theElemIds[ i ] ) : theMesh->FindElement( theElemIds[ i ] ); ? theMesh->FindNode( theElemIds[ i ] ) : theMesh->FindElement( theElemIds[ i ] );
if ( anElem != 0 ) if ( anElem != 0 )
@ -986,15 +1035,15 @@ static int getPointers( const SMESH::ElementType theRequestType,
// function : GetEntities // function : GetEntities
// purpose : Get entities of specified type. Return number of entities // purpose : Get entities of specified type. Return number of entities
//================================================================================= //=================================================================================
int SMESH_GroupObj::GetNbEntities( const SMESH::ElementType theType) const int SMESH_GroupObj::GetNbEntities( const SMDSAbs_ElementType theType) const
{ {
if(myGroupServer->GetType() == theType){ if(SMDSAbs_ElementType(myGroupServer->GetType()) == theType){
return myGroupServer->Size(); return myGroupServer->Size();
} }
return 0; return 0;
} }
int SMESH_GroupObj::GetEntities( const SMESH::ElementType theType, TEntityList& theResList ) const int SMESH_GroupObj::GetEntities( const SMDSAbs_ElementType theType, TEntityList& theResList ) const
{ {
theResList.clear(); theResList.clear();
SMDS_Mesh* aMesh = myMeshObj->GetMesh(); SMDS_Mesh* aMesh = myMeshObj->GetMesh();
@ -1002,12 +1051,12 @@ int SMESH_GroupObj::GetEntities( const SMESH::ElementType theType, TEntityList&
if ( myGroupServer->Size() == 0 || aMesh == 0 ) if ( myGroupServer->Size() == 0 || aMesh == 0 )
return 0; return 0;
SMESH::ElementType aGrpType = myGroupServer->GetType(); SMDSAbs_ElementType aGrpType = SMDSAbs_ElementType(myGroupServer->GetType());
SMESH::long_array_var anIds = myGroupServer->GetListOfID(); SMESH::long_array_var anIds = myGroupServer->GetListOfID();
if ( aGrpType == theType ) if ( aGrpType == theType )
return getPointers( theType, anIds, aMesh, theResList ); return getPointers( theType, anIds, aMesh, theResList );
else if ( theType == SMESH::NODE ) else if ( theType == SMDSAbs_Node )
return getNodesFromElems( anIds, aMesh, theResList ); return getNodesFromElems( anIds, aMesh, theResList );
else else
return 0; return 0;
@ -1044,20 +1093,21 @@ SMESH_subMeshObj::~SMESH_subMeshObj()
// function : GetEntities // function : GetEntities
// purpose : Get entities of specified type. Return number of entities // purpose : Get entities of specified type. Return number of entities
//================================================================================= //=================================================================================
int SMESH_subMeshObj::GetNbEntities( const SMESH::ElementType theType) const int SMESH_subMeshObj::GetNbEntities( const SMDSAbs_ElementType theType) const
{ {
switch ( theType ) switch ( theType )
{ {
case SMESH::NODE: case SMDSAbs_Node:
{ {
return mySubMeshServer->GetNumberOfNodes( false ); return mySubMeshServer->GetNumberOfNodes( false );
} }
break; break;
case SMESH::EDGE: case SMDSAbs_Edge:
case SMESH::FACE: case SMDSAbs_Face:
case SMESH::VOLUME: case SMDSAbs_Volume:
{ {
SMESH::long_array_var anIds = mySubMeshServer->GetElementsByType( theType ); SMESH::long_array_var anIds =
mySubMeshServer->GetElementsByType( SMESH::ElementType(theType) );
return anIds->length(); return anIds->length();
} }
default: default:
@ -1066,7 +1116,7 @@ int SMESH_subMeshObj::GetNbEntities( const SMESH::ElementType theType) const
} }
} }
int SMESH_subMeshObj::GetEntities( const SMESH::ElementType theType, TEntityList& theResList ) const int SMESH_subMeshObj::GetEntities( const SMDSAbs_ElementType theType, TEntityList& theResList ) const
{ {
theResList.clear(); theResList.clear();
@ -1078,22 +1128,23 @@ int SMESH_subMeshObj::GetEntities( const SMESH::ElementType theType, TEntityList
if ( isNodal ) if ( isNodal )
{ {
if ( theType == SMESH::NODE ) if ( theType == SMDSAbs_Node )
{ {
SMESH::long_array_var anIds = mySubMeshServer->GetNodesId(); SMESH::long_array_var anIds = mySubMeshServer->GetNodesId();
return getPointers( SMESH::NODE, anIds, aMesh, theResList ); return getPointers( SMDSAbs_Node, anIds, aMesh, theResList );
} }
} }
else else
{ {
if ( theType == SMESH::NODE ) if ( theType == SMDSAbs_Node )
{ {
SMESH::long_array_var anIds = mySubMeshServer->GetElementsId(); SMESH::long_array_var anIds = mySubMeshServer->GetElementsId();
return getNodesFromElems( anIds, aMesh, theResList ); return getNodesFromElems( anIds, aMesh, theResList );
} }
else else
{ {
SMESH::long_array_var anIds = mySubMeshServer->GetElementsByType( theType ); SMESH::long_array_var anIds =
mySubMeshServer->GetElementsByType( SMESH::ElementType(theType) );
return getPointers( theType, anIds, aMesh, theResList ); return getPointers( theType, anIds, aMesh, theResList );
} }
} }

View File

@ -29,30 +29,14 @@
#ifndef SMESH_OBJECT_H #ifndef SMESH_OBJECT_H
#define SMESH_OBJECT_H #define SMESH_OBJECT_H
// IDL Headers
#include "SALOMEconfig.h"
#include CORBA_SERVER_HEADER(SMESH_Mesh)
#include CORBA_SERVER_HEADER(SMESH_Group)
#include <map>
#include <list>
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
#include <vtkSystemIncludes.h> #include <vtkSystemIncludes.h>
#include "SMESH_Controls.hxx" #include "SMESH_Controls.hxx"
#include "SMDSAbs_ElementType.hxx"
class vtkUnstructuredGrid;
class vtkPoints;
class SALOME_ExtractUnstructuredGrid;
class SMESH_Actor;
class SMDS_Mesh; class SMDS_Mesh;
class SMDS_MeshNode; class vtkUnstructuredGrid;
class SMDS_MeshElement;
class SMESH_VisualObj;
typedef boost::shared_ptr<SMESH_VisualObj> TVisualObjPtr;
/* /*
Class : SMESH_VisualObj Class : SMESH_VisualObj
@ -60,155 +44,27 @@ typedef boost::shared_ptr<SMESH_VisualObj> TVisualObjPtr;
*/ */
class SMESH_VisualObj class SMESH_VisualObj
{ {
protected:
typedef std::list<const SMDS_MeshElement*> TEntityList;
typedef std::map<vtkIdType,vtkIdType> TMapOfIds;
public: public:
SMESH_VisualObj();
virtual ~SMESH_VisualObj();
virtual void Update( int theIsClear = true ) = 0; virtual void Update( int theIsClear = true ) = 0;
virtual void UpdateFunctor( const SMESH::Controls::FunctorPtr& theFunctor ) = 0; virtual void UpdateFunctor( const SMESH::Controls::FunctorPtr& theFunctor ) = 0;
virtual int GetElemDimension( const int theObjId ) = 0; virtual int GetElemDimension( const int theObjId ) = 0;
virtual int GetNbEntities( const SMESH::ElementType) const = 0; virtual int GetNbEntities( const SMDSAbs_ElementType theType) const = 0;
virtual int GetEntities( const SMESH::ElementType, TEntityList& ) const = 0;
virtual bool IsNodePrs() const = 0;
virtual SMDS_Mesh* GetMesh() const = 0; virtual SMDS_Mesh* GetMesh() const = 0;
bool GetEdgeNodes( const int theElemId, virtual bool GetEdgeNodes( const int theElemId,
const int theEdgeNum, const int theEdgeNum,
int& theNodeId1, int& theNodeId1,
int& theNodeId2 ) const; int& theNodeId2 ) const = 0;
vtkUnstructuredGrid* GetUnstructuredGrid() { return myGrid; } virtual vtkUnstructuredGrid* GetUnstructuredGrid() = 0;
vtkIdType GetNodeObjId( int theVTKID ); virtual vtkIdType GetNodeObjId( int theVTKID ) = 0;
vtkIdType GetNodeVTKId( int theObjID ); virtual vtkIdType GetNodeVTKId( int theObjID ) = 0;
vtkIdType GetElemObjId( int theVTKID ); virtual vtkIdType GetElemObjId( int theVTKID ) = 0;
vtkIdType GetElemVTKId( int theObjID ); virtual vtkIdType GetElemVTKId( int theObjID ) = 0;
protected:
void createPoints( vtkPoints* );
void buildPrs();
void buildNodePrs();
void buildElemPrs();
private:
TMapOfIds mySMDS2VTKNodes;
TMapOfIds myVTK2SMDSNodes;
TMapOfIds mySMDS2VTKElems;
TMapOfIds myVTK2SMDSElems;
vtkUnstructuredGrid* myGrid;
}; };
typedef boost::shared_ptr<SMESH_VisualObj> TVisualObjPtr;
/*
Class : SMESH_MeshObj
Description : Class for visualisation of mesh
*/
class SMESH_MeshObj: public SMESH_VisualObj
{
public:
SMESH_MeshObj( SMESH::SMESH_Mesh_ptr );
virtual ~SMESH_MeshObj();
virtual void Update( int theIsClear = true );
virtual int GetNbEntities( const SMESH::ElementType) const;
virtual int GetEntities( const SMESH::ElementType, TEntityList& ) const;
virtual bool IsNodePrs() const;
virtual int GetElemDimension( const int theObjId );
virtual void UpdateFunctor( const SMESH::Controls::FunctorPtr& theFunctor );
SMESH::SMESH_Mesh_ptr GetMeshServer() { return myMeshServer.in(); }
SMDS_Mesh* GetMesh() const { return myMesh; }
protected:
SMESH::SMESH_Mesh_var myMeshServer;
SMDS_Mesh* myMesh;
};
/*
Class : SMESH_SubMeshObj
Description : Base class for visualisation of submeshes and groups
*/
class SMESH_SubMeshObj: public SMESH_VisualObj
{
public:
SMESH_SubMeshObj(SMESH_MeshObj* theMeshObj);
virtual ~SMESH_SubMeshObj();
virtual void Update( int theIsClear = true );
virtual void UpdateFunctor( const SMESH::Controls::FunctorPtr& theFunctor );
virtual int GetElemDimension( const int theObjId );
virtual SMDS_Mesh* GetMesh() const { return myMeshObj->GetMesh(); }
protected:
SMESH_MeshObj* myMeshObj;
};
/*
Class : SMESH_GroupObj
Description : Class for visualisation of groups
*/
class SMESH_GroupObj: public SMESH_SubMeshObj
{
public:
SMESH_GroupObj( SMESH::SMESH_GroupBase_ptr, SMESH_MeshObj* );
virtual ~SMESH_GroupObj();
virtual int GetNbEntities( const SMESH::ElementType) const;
virtual int GetEntities( const SMESH::ElementType, TEntityList& ) const;
virtual bool IsNodePrs() const;
private:
SMESH::SMESH_GroupBase_var myGroupServer;
};
/*
Class : SMESH_subMeshObj
Description : Class for visualisation of submeshes
*/
class SMESH_subMeshObj : public SMESH_SubMeshObj
{
public:
SMESH_subMeshObj( SMESH::SMESH_subMesh_ptr,
SMESH_MeshObj* );
virtual ~SMESH_subMeshObj();
virtual int GetNbEntities( const SMESH::ElementType) const;
virtual int GetEntities( const SMESH::ElementType, TEntityList& ) const;
virtual bool IsNodePrs() const;
protected:
SMESH::SMESH_subMesh_var mySubMeshServer;
};
extern void WriteUnstructuredGrid(vtkUnstructuredGrid* theGrid, const char* theFileName);
#endif #endif

View File

@ -0,0 +1,202 @@
// SMESH OBJECT : interactive object for SMESH visualization
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : SMESH_Object.h
// Author : Nicolas REJNERI
// Module : SMESH
// $Header$
#ifndef SMESH_OBJECTDEF_H
#define SMESH_OBJECTDEF_H
// IDL Headers
#include "SALOMEconfig.h"
#include CORBA_SERVER_HEADER(SMESH_Mesh)
#include CORBA_SERVER_HEADER(SMESH_Group)
#include <map>
#include <list>
#include "SMESH_Controls.hxx"
#include "SMESH_Object.h"
class vtkPoints;
class SALOME_ExtractUnstructuredGrid;
class SMESH_Actor;
class SMDS_MeshNode;
class SMDS_MeshElement;
/*
Class : SMESH_VisualObj
Description : Base class for all mesh objects to be visuilised
*/
class SMESH_VisualObjDef: public SMESH_VisualObj
{
public:
typedef std::list<const SMDS_MeshElement*> TEntityList;
typedef std::map<vtkIdType,vtkIdType> TMapOfIds;
SMESH_VisualObjDef();
virtual ~SMESH_VisualObjDef();
virtual void Update( int theIsClear = true ) = 0;
virtual void UpdateFunctor( const SMESH::Controls::FunctorPtr& theFunctor ) = 0;
virtual int GetElemDimension( const int theObjId ) = 0;
virtual int GetNbEntities( const SMDSAbs_ElementType theType) const = 0;
virtual int GetEntities( const SMDSAbs_ElementType, TEntityList& ) const = 0;
virtual bool IsNodePrs() const = 0;
virtual SMDS_Mesh* GetMesh() const = 0;
virtual bool GetEdgeNodes( const int theElemId,
const int theEdgeNum,
int& theNodeId1,
int& theNodeId2 ) const;
virtual vtkUnstructuredGrid* GetUnstructuredGrid() { return myGrid; }
virtual vtkIdType GetNodeObjId( int theVTKID );
virtual vtkIdType GetNodeVTKId( int theObjID );
virtual vtkIdType GetElemObjId( int theVTKID );
virtual vtkIdType GetElemVTKId( int theObjID );
protected:
void createPoints( vtkPoints* );
void buildPrs();
void buildNodePrs();
void buildElemPrs();
private:
TMapOfIds mySMDS2VTKNodes;
TMapOfIds myVTK2SMDSNodes;
TMapOfIds mySMDS2VTKElems;
TMapOfIds myVTK2SMDSElems;
vtkUnstructuredGrid* myGrid;
};
/*
Class : SMESH_MeshObj
Description : Class for visualisation of mesh
*/
class SMESH_MeshObj: public SMESH_VisualObjDef
{
public:
SMESH_MeshObj( SMESH::SMESH_Mesh_ptr );
virtual ~SMESH_MeshObj();
virtual void Update( int theIsClear = true );
virtual int GetNbEntities( const SMDSAbs_ElementType) const;
virtual int GetEntities( const SMDSAbs_ElementType, TEntityList& ) const;
virtual bool IsNodePrs() const;
virtual int GetElemDimension( const int theObjId );
virtual void UpdateFunctor( const SMESH::Controls::FunctorPtr& theFunctor );
SMESH::SMESH_Mesh_ptr GetMeshServer() { return myMeshServer.in(); }
SMDS_Mesh* GetMesh() const { return myMesh; }
protected:
SMESH::SMESH_Mesh_var myMeshServer;
SMDS_Mesh* myMesh;
};
/*
Class : SMESH_SubMeshObj
Description : Base class for visualisation of submeshes and groups
*/
class SMESH_SubMeshObj: public SMESH_VisualObjDef
{
public:
SMESH_SubMeshObj(SMESH_MeshObj* theMeshObj);
virtual ~SMESH_SubMeshObj();
virtual void Update( int theIsClear = true );
virtual void UpdateFunctor( const SMESH::Controls::FunctorPtr& theFunctor );
virtual int GetElemDimension( const int theObjId );
virtual SMDS_Mesh* GetMesh() const { return myMeshObj->GetMesh(); }
protected:
SMESH_MeshObj* myMeshObj;
};
/*
Class : SMESH_GroupObj
Description : Class for visualisation of groups
*/
class SMESH_GroupObj: public SMESH_SubMeshObj
{
public:
SMESH_GroupObj( SMESH::SMESH_GroupBase_ptr, SMESH_MeshObj* );
virtual ~SMESH_GroupObj();
virtual int GetNbEntities( const SMDSAbs_ElementType) const;
virtual int GetEntities( const SMDSAbs_ElementType, TEntityList& ) const;
virtual bool IsNodePrs() const;
private:
SMESH::SMESH_GroupBase_var myGroupServer;
};
/*
Class : SMESH_subMeshObj
Description : Class for visualisation of submeshes
*/
class SMESH_subMeshObj : public SMESH_SubMeshObj
{
public:
SMESH_subMeshObj( SMESH::SMESH_subMesh_ptr,
SMESH_MeshObj* );
virtual ~SMESH_subMeshObj();
virtual int GetNbEntities( const SMDSAbs_ElementType) const;
virtual int GetEntities( const SMDSAbs_ElementType, TEntityList& ) const;
virtual bool IsNodePrs() const;
protected:
SMESH::SMESH_subMesh_var mySubMeshServer;
};
#endif

View File

@ -88,6 +88,7 @@ EXPORT_HEADERS= \
SMDS_TypeOfPosition.hxx \ SMDS_TypeOfPosition.hxx \
SMDSAbs_ElementType.hxx \ SMDSAbs_ElementType.hxx \
SMDS_EdgePosition.hxx \ SMDS_EdgePosition.hxx \
SMDS_ElemIterator.hxx \
SMDS_FacePosition.hxx \ SMDS_FacePosition.hxx \
SMDS_Mesh.hxx \ SMDS_Mesh.hxx \
SMDS_MeshEdge.hxx \ SMDS_MeshEdge.hxx \
@ -125,9 +126,9 @@ 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 $(BOOST_CPPFLAGS) CPPFLAGS += -I${KERNEL_ROOT_DIR}/include/salome $(OCC_INCLUDES) $(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 $(OCC_KERNEL_LIBS)
# additional file to be cleaned # additional file to be cleaned

40
src/SMDS/SMDS_ElemIterator.hxx Executable file
View File

@ -0,0 +1,40 @@
// SMESH SMDS : implementaion of Salome mesh data structure
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : SMDS_MeshElement.hxx
// Module : SMESH
// Created: 12.01.05 18:02:52
// Author: Michael Sazonov
#ifndef SMDS_ElemIterator_HeaderFile
#define SMDS_ElemIterator_HeaderFile
#include "SMDS_Iterator.hxx"
#include <boost/shared_ptr.hpp>
class SMDS_MeshElement;
typedef SMDS_Iterator<const SMDS_MeshElement *> SMDS_ElemIterator;
typedef boost::shared_ptr<SMDS_Iterator<const SMDS_MeshElement *> > SMDS_ElemIteratorPtr;
#endif

View File

@ -19,6 +19,10 @@
// //
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
#ifdef _MSC_VER
#pragma warning(disable:4786)
#endif
#include "SMDS_FaceOfEdges.hxx" #include "SMDS_FaceOfEdges.hxx"
#include "SMDS_IteratorOfElements.hxx" #include "SMDS_IteratorOfElements.hxx"
#include "SMDS_MeshNode.hxx" #include "SMDS_MeshNode.hxx"
@ -32,7 +36,7 @@ using namespace std;
int SMDS_FaceOfEdges::NbEdges() const int SMDS_FaceOfEdges::NbEdges() const
{ {
return myEdges.size(); return myNbEdges;
} }
int SMDS_FaceOfEdges::NbFaces() const int SMDS_FaceOfEdges::NbFaces() const
@ -57,17 +61,23 @@ SMDSAbs_ElementType SMDS_FaceOfEdges::GetType() const
return SMDSAbs_Face; return SMDSAbs_Face;
} }
//=======================================================================
//function : elementsIterator
//purpose :
//=======================================================================
class SMDS_FaceOfEdges_MyIterator:public SMDS_ElemIterator class SMDS_FaceOfEdges_MyIterator:public SMDS_ElemIterator
{ {
const vector<const SMDS_MeshEdge*>& mySet; const SMDS_MeshEdge* const *mySet;
int myLength;
int index; int index;
public: public:
SMDS_FaceOfEdges_MyIterator(const vector<const SMDS_MeshEdge*>& s): SMDS_FaceOfEdges_MyIterator(const SMDS_MeshEdge* const *s, int l):
mySet(s),index(0) {} mySet(s),myLength(l),index(0) {}
bool more() bool more()
{ {
return index<mySet.size(); return index<myLength;
} }
const SMDS_MeshElement* next() const SMDS_MeshElement* next()
@ -76,19 +86,21 @@ class SMDS_FaceOfEdges_MyIterator:public SMDS_ElemIterator
return mySet[index-1]; return mySet[index-1];
} }
}; };
SMDS_ElemIteratorPtr SMDS_FaceOfEdges::
elementsIterator(SMDSAbs_ElementType type) const SMDS_ElemIteratorPtr SMDS_FaceOfEdges::elementsIterator
(SMDSAbs_ElementType type) const
{ {
switch(type) switch(type)
{ {
case SMDSAbs_Face: case SMDSAbs_Face:
return SMDS_MeshElement::elementsIterator(SMDSAbs_Face); return SMDS_MeshElement::elementsIterator(SMDSAbs_Face);
case SMDSAbs_Edge: case SMDSAbs_Edge:
return SMDS_ElemIteratorPtr(new SMDS_FaceOfEdges_MyIterator(myEdges)); return SMDS_ElemIteratorPtr(new SMDS_FaceOfEdges_MyIterator(myEdges,myNbEdges));
default: default:
return SMDS_ElemIteratorPtr return SMDS_ElemIteratorPtr
(new SMDS_IteratorOfElements (new SMDS_IteratorOfElements
(this,type, SMDS_ElemIteratorPtr(new SMDS_FaceOfEdges_MyIterator(myEdges)))); (this,type, SMDS_ElemIteratorPtr
(new SMDS_FaceOfEdges_MyIterator(myEdges,myNbEdges))));
} }
} }
@ -96,10 +108,11 @@ SMDS_FaceOfEdges::SMDS_FaceOfEdges(const SMDS_MeshEdge* edge1,
const SMDS_MeshEdge* edge2, const SMDS_MeshEdge* edge2,
const SMDS_MeshEdge* edge3) const SMDS_MeshEdge* edge3)
{ {
myEdges.resize(3); myNbEdges = 3;
myEdges[0]=edge1; myEdges[0]=edge1;
myEdges[1]=edge2; myEdges[1]=edge2;
myEdges[2]=edge3; myEdges[2]=edge3;
myEdges[3]=0;
} }
SMDS_FaceOfEdges::SMDS_FaceOfEdges(const SMDS_MeshEdge* edge1, SMDS_FaceOfEdges::SMDS_FaceOfEdges(const SMDS_MeshEdge* edge1,
@ -107,7 +120,7 @@ SMDS_FaceOfEdges::SMDS_FaceOfEdges(const SMDS_MeshEdge* edge1,
const SMDS_MeshEdge* edge3, const SMDS_MeshEdge* edge3,
const SMDS_MeshEdge* edge4) const SMDS_MeshEdge* edge4)
{ {
myEdges.resize(4); myNbEdges = 4;
myEdges[0]=edge1; myEdges[0]=edge1;
myEdges[1]=edge2; myEdges[1]=edge2;
myEdges[2]=edge3; myEdges[2]=edge3;

View File

@ -51,7 +51,8 @@ class SMDS_FaceOfEdges:public SMDS_MeshFace
elementsIterator(SMDSAbs_ElementType type) const; elementsIterator(SMDSAbs_ElementType type) const;
private: private:
std::vector<const SMDS_MeshEdge*> myEdges; const SMDS_MeshEdge* myEdges[4];
int myNbEdges;
}; };

View File

@ -19,6 +19,10 @@
// //
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
#ifdef _MSC_VER
#pragma warning(disable:4786)
#endif
#include "SMDS_FaceOfNodes.hxx" #include "SMDS_FaceOfNodes.hxx"
#include "SMDS_IteratorOfElements.hxx" #include "SMDS_IteratorOfElements.hxx"
#include "SMDS_MeshNode.hxx" #include "SMDS_MeshNode.hxx"
@ -43,8 +47,9 @@ int SMDS_FaceOfNodes::NbFaces() const
int SMDS_FaceOfNodes::NbNodes() const int SMDS_FaceOfNodes::NbNodes() const
{ {
return myNodes.size(); return myNbNodes;
} }
//======================================================================= //=======================================================================
//function : Print //function : Print
//purpose : //purpose :
@ -58,17 +63,23 @@ void SMDS_FaceOfNodes::Print(ostream & OS) const
OS << myNodes[i] << ") " << endl; OS << myNodes[i] << ") " << endl;
} }
//=======================================================================
//function : elementsIterator
//purpose :
//=======================================================================
class SMDS_FaceOfNodes_MyIterator:public SMDS_ElemIterator class SMDS_FaceOfNodes_MyIterator:public SMDS_ElemIterator
{ {
const vector<const SMDS_MeshNode*>& mySet; const SMDS_MeshNode* const *mySet;
int myLength;
int index; int index;
public: public:
SMDS_FaceOfNodes_MyIterator(const vector<const SMDS_MeshNode*>& s): SMDS_FaceOfNodes_MyIterator(const SMDS_MeshNode* const *s, int l):
mySet(s),index(0) {} mySet(s),myLength(l),index(0) {}
bool more() bool more()
{ {
return index<mySet.size(); return index<myLength;
} }
const SMDS_MeshElement* next() const SMDS_MeshElement* next()
@ -77,22 +88,24 @@ class SMDS_FaceOfNodes_MyIterator:public SMDS_ElemIterator
return mySet[index-1]; return mySet[index-1];
} }
}; };
SMDS_ElemIteratorPtr SMDS_FaceOfNodes::
elementsIterator(SMDSAbs_ElementType type) const SMDS_ElemIteratorPtr SMDS_FaceOfNodes::elementsIterator
(SMDSAbs_ElementType type) const
{ {
switch(type) switch(type)
{ {
case SMDSAbs_Face: case SMDSAbs_Face:
return SMDS_MeshElement::elementsIterator(SMDSAbs_Face); return SMDS_MeshElement::elementsIterator(SMDSAbs_Face);
case SMDSAbs_Node: case SMDSAbs_Node:
return SMDS_ElemIteratorPtr(new SMDS_FaceOfNodes_MyIterator(myNodes)); return SMDS_ElemIteratorPtr(new SMDS_FaceOfNodes_MyIterator(myNodes,myNbNodes));
case SMDSAbs_Edge: case SMDSAbs_Edge:
MESSAGE("Error : edge iterator for SMDS_FaceOfNodes not implemented"); MESSAGE("Error : edge iterator for SMDS_FaceOfNodes not implemented");
break; break;
default: default:
return SMDS_ElemIteratorPtr return SMDS_ElemIteratorPtr
(new SMDS_IteratorOfElements (new SMDS_IteratorOfElements
(this,type,SMDS_ElemIteratorPtr(new SMDS_FaceOfNodes_MyIterator(myNodes)))); (this,type,SMDS_ElemIteratorPtr
(new SMDS_FaceOfNodes_MyIterator(myNodes,myNbNodes))));
} }
return SMDS_ElemIteratorPtr(); return SMDS_ElemIteratorPtr();
} }
@ -101,10 +114,11 @@ SMDS_FaceOfNodes::SMDS_FaceOfNodes(const SMDS_MeshNode* node1,
const SMDS_MeshNode* node2, const SMDS_MeshNode* node2,
const SMDS_MeshNode* node3) const SMDS_MeshNode* node3)
{ {
myNodes.resize(3); myNbNodes = 3;
myNodes[0]=node1; myNodes[0]=node1;
myNodes[1]=node2; myNodes[1]=node2;
myNodes[2]=node3; myNodes[2]=node3;
myNodes[3]=0;
} }
SMDS_FaceOfNodes::SMDS_FaceOfNodes(const SMDS_MeshNode* node1, SMDS_FaceOfNodes::SMDS_FaceOfNodes(const SMDS_MeshNode* node1,
@ -112,7 +126,7 @@ SMDS_FaceOfNodes::SMDS_FaceOfNodes(const SMDS_MeshNode* node1,
const SMDS_MeshNode* node3, const SMDS_MeshNode* node3,
const SMDS_MeshNode* node4) const SMDS_MeshNode* node4)
{ {
myNodes.resize(4); myNbNodes = 4;
myNodes[0]=node1; myNodes[0]=node1;
myNodes[1]=node2; myNodes[1]=node2;
myNodes[2]=node3; myNodes[2]=node3;
@ -121,20 +135,13 @@ SMDS_FaceOfNodes::SMDS_FaceOfNodes(const SMDS_MeshNode* node1,
bool SMDS_FaceOfNodes::ChangeNodes(const SMDS_MeshNode* nodes[], bool SMDS_FaceOfNodes::ChangeNodes(const SMDS_MeshNode* nodes[],
const int nbNodes) const int nbNodes)
{ {
if (nbNodes == 3) { myNbNodes = nbNodes;
myNodes.resize(3);
myNodes[0]=nodes[0];
myNodes[1]=nodes[1];
myNodes[2]=nodes[2];
}
else if ( nbNodes == 4) {
myNodes.resize(4);
myNodes[0]=nodes[0]; myNodes[0]=nodes[0];
myNodes[1]=nodes[1]; myNodes[1]=nodes[1];
myNodes[2]=nodes[2]; myNodes[2]=nodes[2];
if (nbNodes == 4)
myNodes[3]=nodes[3]; myNodes[3]=nodes[3];
} else if (nbNodes != 3)
else
return false; return false;
return true; return true;

View File

@ -49,7 +49,8 @@ class SMDS_FaceOfNodes:public SMDS_MeshFace
elementsIterator(SMDSAbs_ElementType type) const; elementsIterator(SMDSAbs_ElementType type) const;
private: private:
std::vector<const SMDS_MeshNode*> myNodes; const SMDS_MeshNode* myNodes[4];
int myNbNodes;
}; };

View File

@ -19,11 +19,15 @@
// //
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
#ifdef _MSC_VER
#pragma warning(disable:4786)
#endif
#include "SMDS_IteratorOfElements.hxx" #include "SMDS_IteratorOfElements.hxx"
bool SMDS_IteratorOfElements::subMore() bool SMDS_IteratorOfElements::subMore()
{ {
if((t2Iterator==NULL)||(!t2Iterator->more())) if((t2Iterator.get()==NULL)||(!t2Iterator->more()))
{ {
if(t1Iterator->more()) if(t1Iterator->more())
{ {
@ -37,7 +41,7 @@ bool SMDS_IteratorOfElements::subMore()
const SMDS_MeshElement * SMDS_IteratorOfElements::subNext() const SMDS_MeshElement * SMDS_IteratorOfElements::subNext()
{ {
if((t2Iterator==NULL)||(!t2Iterator->more())) if((t2Iterator.get()==NULL)||(!t2Iterator->more()))
if(t1Iterator->more()) if(t1Iterator->more())
t2Iterator=t1Iterator->next()->elementsIterator(myType); t2Iterator=t1Iterator->next()->elementsIterator(myType);
return t2Iterator->next(); return t2Iterator->next();

View File

@ -19,6 +19,10 @@
// //
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
#ifdef _MSC_VER
#pragma warning(disable:4786)
#endif
#include "utilities.h" #include "utilities.h"
#include "SMDS_Mesh.hxx" #include "SMDS_Mesh.hxx"
#include "SMDS_VolumeOfNodes.hxx" #include "SMDS_VolumeOfNodes.hxx"
@ -27,13 +31,15 @@
#include "SMDS_FaceOfEdges.hxx" #include "SMDS_FaceOfEdges.hxx"
#include <algorithm> #include <algorithm>
#include <map>
using namespace std; using namespace std;
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
/// Create a new mesh object /// Create a new mesh object
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
SMDS_Mesh::SMDS_Mesh() SMDS_Mesh::SMDS_Mesh()
:myNodeIDFactory(new SMDS_MeshElementIDFactory()), :myParent(NULL),
myNodeIDFactory(new SMDS_MeshElementIDFactory()),
myElementIDFactory(new SMDS_MeshElementIDFactory()), myElementIDFactory(new SMDS_MeshElementIDFactory()),
myHasConstructionEdges(false), myHasConstructionFaces(false), myHasConstructionEdges(false), myHasConstructionFaces(false),
myHasInverseElements(true) myHasInverseElements(true)
@ -86,7 +92,7 @@ SMDS_MeshNode * SMDS_Mesh::AddNodeWithID(double x, double y, double z, int ID)
const SMDS_MeshElement *node = myNodeIDFactory->MeshElement(ID); const SMDS_MeshElement *node = myNodeIDFactory->MeshElement(ID);
if(!node){ if(!node){
SMDS_MeshNode * node=new SMDS_MeshNode(x, y, z); SMDS_MeshNode * node=new SMDS_MeshNode(x, y, z);
myNodes.insert(node); myNodes.Add(node);
myNodeIDFactory->BindID(ID,node); myNodeIDFactory->BindID(ID,node);
return node; return node;
}else }else
@ -137,7 +143,7 @@ SMDS_MeshEdge* SMDS_Mesh::AddEdgeWithID(const SMDS_MeshNode * n1,
node2=const_cast<SMDS_MeshNode*>(n2); node2=const_cast<SMDS_MeshNode*>(n2);
node1->AddInverseElement(edge); node1->AddInverseElement(edge);
node2->AddInverseElement(edge); node2->AddInverseElement(edge);
myEdges.insert(edge); myEdges.Add(edge);
return edge; return edge;
} }
else { else {
@ -266,7 +272,7 @@ SMDS_MeshFace* SMDS_Mesh::AddFaceWithID(const SMDS_MeshEdge * e1,
if (!hasConstructionEdges()) if (!hasConstructionEdges())
return NULL; return NULL;
SMDS_MeshFace * face = new SMDS_FaceOfEdges(e1,e2,e3); SMDS_MeshFace * face = new SMDS_FaceOfEdges(e1,e2,e3);
myFaces.insert(face); myFaces.Add(face);
if (!registerElement(ID, face)) { if (!registerElement(ID, face)) {
RemoveElement(face, false); RemoveElement(face, false);
@ -303,7 +309,7 @@ SMDS_MeshFace* SMDS_Mesh::AddFaceWithID(const SMDS_MeshEdge * e1,
if (!hasConstructionEdges()) if (!hasConstructionEdges())
return NULL; return NULL;
SMDS_MeshFace * face = new SMDS_FaceOfEdges(e1,e2,e3,e4); SMDS_MeshFace * face = new SMDS_FaceOfEdges(e1,e2,e3,e4);
myFaces.insert(face); myFaces.Add(face);
if (!registerElement(ID, face)) if (!registerElement(ID, face))
{ {
@ -370,7 +376,7 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
SMDS_MeshFace * f3=FindFaceOrCreate(n1,n3,n4); SMDS_MeshFace * f3=FindFaceOrCreate(n1,n3,n4);
SMDS_MeshFace * f4=FindFaceOrCreate(n2,n3,n4); SMDS_MeshFace * f4=FindFaceOrCreate(n2,n3,n4);
volume=new SMDS_VolumeOfFaces(f1,f2,f3,f4); volume=new SMDS_VolumeOfFaces(f1,f2,f3,f4);
myVolumes.insert(volume); myVolumes.Add(volume);
} }
else if(hasConstructionEdges()) { else if(hasConstructionEdges()) {
MESSAGE("Error : Not implemented"); MESSAGE("Error : Not implemented");
@ -378,7 +384,7 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
} }
else { else {
volume=new SMDS_VolumeOfNodes(n1,n2,n3,n4); volume=new SMDS_VolumeOfNodes(n1,n2,n3,n4);
myVolumes.insert(volume); myVolumes.Add(volume);
} }
if (!registerElement(ID, volume)) { if (!registerElement(ID, volume)) {
@ -452,7 +458,7 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
SMDS_MeshFace * f3=FindFaceOrCreate(n2,n3,n5); SMDS_MeshFace * f3=FindFaceOrCreate(n2,n3,n5);
SMDS_MeshFace * f4=FindFaceOrCreate(n3,n4,n5); SMDS_MeshFace * f4=FindFaceOrCreate(n3,n4,n5);
volume=new SMDS_VolumeOfFaces(f1,f2,f3,f4); volume=new SMDS_VolumeOfFaces(f1,f2,f3,f4);
myVolumes.insert(volume); myVolumes.Add(volume);
} }
else if(hasConstructionEdges()) { else if(hasConstructionEdges()) {
MESSAGE("Error : Not implemented"); MESSAGE("Error : Not implemented");
@ -460,7 +466,7 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
} }
else { else {
volume=new SMDS_VolumeOfNodes(n1,n2,n3,n4,n5); volume=new SMDS_VolumeOfNodes(n1,n2,n3,n4,n5);
myVolumes.insert(volume); myVolumes.Add(volume);
} }
if (!registerElement(ID, volume)) { if (!registerElement(ID, volume)) {
@ -539,7 +545,7 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
SMDS_MeshFace * f4=FindFaceOrCreate(n2,n5,n6,n3); SMDS_MeshFace * f4=FindFaceOrCreate(n2,n5,n6,n3);
SMDS_MeshFace * f5=FindFaceOrCreate(n3,n6,n4,n1); SMDS_MeshFace * f5=FindFaceOrCreate(n3,n6,n4,n1);
volume=new SMDS_VolumeOfFaces(f1,f2,f3,f4,f5); volume=new SMDS_VolumeOfFaces(f1,f2,f3,f4,f5);
myVolumes.insert(volume); myVolumes.Add(volume);
} }
else if(hasConstructionEdges()) { else if(hasConstructionEdges()) {
MESSAGE("Error : Not implemented"); MESSAGE("Error : Not implemented");
@ -547,7 +553,7 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
} }
else { else {
volume=new SMDS_VolumeOfNodes(n1,n2,n3,n4,n5,n6); volume=new SMDS_VolumeOfNodes(n1,n2,n3,n4,n5,n6);
myVolumes.insert(volume); myVolumes.Add(volume);
} }
if (!registerElement(ID, volume)) { if (!registerElement(ID, volume)) {
@ -638,7 +644,7 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
SMDS_MeshFace * f5=FindFaceOrCreate(n2,n3,n7,n6); SMDS_MeshFace * f5=FindFaceOrCreate(n2,n3,n7,n6);
SMDS_MeshFace * f6=FindFaceOrCreate(n3,n4,n8,n7); SMDS_MeshFace * f6=FindFaceOrCreate(n3,n4,n8,n7);
volume=new SMDS_VolumeOfFaces(f1,f2,f3,f4,f5,f6); volume=new SMDS_VolumeOfFaces(f1,f2,f3,f4,f5,f6);
myVolumes.insert(volume); myVolumes.Add(volume);
} }
else if(hasConstructionEdges()) { else if(hasConstructionEdges()) {
MESSAGE("Error : Not implemented"); MESSAGE("Error : Not implemented");
@ -647,7 +653,7 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshNode * n1,
else { else {
// volume=new SMDS_HexahedronOfNodes(n1,n2,n3,n4,n5,n6,n7,n8); // volume=new SMDS_HexahedronOfNodes(n1,n2,n3,n4,n5,n6,n7,n8);
volume=new SMDS_VolumeOfNodes(n1,n2,n3,n4,n5,n6,n7,n8); volume=new SMDS_VolumeOfNodes(n1,n2,n3,n4,n5,n6,n7,n8);
myVolumes.insert(volume); myVolumes.Add(volume);
} }
if (!registerElement(ID, volume)) { if (!registerElement(ID, volume)) {
@ -687,7 +693,7 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshFace * f1,
if (!hasConstructionFaces()) if (!hasConstructionFaces())
return NULL; return NULL;
SMDS_MeshVolume * volume = new SMDS_VolumeOfFaces(f1,f2,f3,f4); SMDS_MeshVolume * volume = new SMDS_VolumeOfFaces(f1,f2,f3,f4);
myVolumes.insert(volume); myVolumes.Add(volume);
if (!registerElement(ID, volume)) { if (!registerElement(ID, volume)) {
RemoveElement(volume, false); RemoveElement(volume, false);
@ -728,7 +734,7 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshFace * f1,
if (!hasConstructionFaces()) if (!hasConstructionFaces())
return NULL; return NULL;
SMDS_MeshVolume * volume = new SMDS_VolumeOfFaces(f1,f2,f3,f4,f5); SMDS_MeshVolume * volume = new SMDS_VolumeOfFaces(f1,f2,f3,f4,f5);
myVolumes.insert(volume); myVolumes.Add(volume);
if (!registerElement(ID, volume)) { if (!registerElement(ID, volume)) {
RemoveElement(volume, false); RemoveElement(volume, false);
@ -771,7 +777,7 @@ SMDS_MeshVolume* SMDS_Mesh::AddVolumeWithID(const SMDS_MeshFace * f1,
if (!hasConstructionFaces()) if (!hasConstructionFaces())
return NULL; return NULL;
SMDS_MeshVolume * volume = new SMDS_VolumeOfFaces(f1,f2,f3,f4,f5,f6); SMDS_MeshVolume * volume = new SMDS_VolumeOfFaces(f1,f2,f3,f4,f5,f6);
myVolumes.insert(volume); myVolumes.Add(volume);
if (!registerElement(ID, volume)) { if (!registerElement(ID, volume)) {
RemoveElement(volume, false); RemoveElement(volume, false);
@ -821,13 +827,13 @@ SMDS_MeshFace * SMDS_Mesh::createTriangle(const SMDS_MeshNode * node1,
edge3=FindEdgeOrCreate(node3,node1); edge3=FindEdgeOrCreate(node3,node1);
SMDS_MeshFace * face = new SMDS_FaceOfEdges(edge1,edge2,edge3); SMDS_MeshFace * face = new SMDS_FaceOfEdges(edge1,edge2,edge3);
myFaces.insert(face); myFaces.Add(face);
return face; return face;
} }
else else
{ {
SMDS_MeshFace * face = new SMDS_FaceOfNodes(node1,node2,node3); SMDS_MeshFace * face = new SMDS_FaceOfNodes(node1,node2,node3);
myFaces.insert(face); myFaces.Add(face);
return face; return face;
} }
} }
@ -850,13 +856,13 @@ SMDS_MeshFace * SMDS_Mesh::createQuadrangle(const SMDS_MeshNode * node1,
edge4=FindEdgeOrCreate(node4,node1); edge4=FindEdgeOrCreate(node4,node1);
SMDS_MeshFace * face = new SMDS_FaceOfEdges(edge1,edge2,edge3,edge4); SMDS_MeshFace * face = new SMDS_FaceOfEdges(edge1,edge2,edge3,edge4);
myFaces.insert(face); myFaces.Add(face);
return face; return face;
} }
else else
{ {
SMDS_MeshFace * face = new SMDS_FaceOfNodes(node1,node2,node3,node4); SMDS_MeshFace * face = new SMDS_FaceOfNodes(node1,node2,node3,node4);
myFaces.insert(face); myFaces.Add(face);
return face; return face;
} }
} }
@ -1051,7 +1057,7 @@ SMDS_MeshEdge* SMDS_Mesh::FindEdgeOrCreate(const SMDS_MeshNode * node1,
if(toReturn==NULL) if(toReturn==NULL)
{ {
toReturn=new SMDS_MeshEdge(node1,node2); toReturn=new SMDS_MeshEdge(node1,node2);
myEdges.insert(toReturn); myEdges.Add(toReturn);
} }
return toReturn; return toReturn;
} }
@ -1289,7 +1295,7 @@ void SMDS_Mesh::DebugStats() const
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
int SMDS_Mesh::NbNodes() const int SMDS_Mesh::NbNodes() const
{ {
return myNodes.size(); return myNodes.Size();
} }
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
@ -1297,7 +1303,7 @@ int SMDS_Mesh::NbNodes() const
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
int SMDS_Mesh::NbEdges() const int SMDS_Mesh::NbEdges() const
{ {
return myEdges.size(); return myEdges.Size();
} }
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
@ -1305,7 +1311,7 @@ int SMDS_Mesh::NbEdges() const
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
int SMDS_Mesh::NbFaces() const int SMDS_Mesh::NbFaces() const
{ {
return myFaces.size(); return myFaces.Size();
} }
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
@ -1313,7 +1319,7 @@ int SMDS_Mesh::NbFaces() const
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
int SMDS_Mesh::NbVolumes() const int SMDS_Mesh::NbVolumes() const
{ {
return myVolumes.size(); return myVolumes.Size();
} }
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
@ -1332,12 +1338,6 @@ int SMDS_Mesh::NbSubMesh() const
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
SMDS_Mesh::~SMDS_Mesh() SMDS_Mesh::~SMDS_Mesh()
{ {
if(myParent==NULL)
{
delete myNodeIDFactory;
delete myElementIDFactory;
}
list<SMDS_Mesh*>::iterator itc=myChildren.begin(); list<SMDS_Mesh*>::iterator itc=myChildren.begin();
while(itc!=myChildren.end()) while(itc!=myChildren.end())
{ {
@ -1345,31 +1345,41 @@ SMDS_Mesh::~SMDS_Mesh()
itc++; itc++;
} }
SMDS_NodeIteratorPtr itn=nodesIterator(); SetOfNodes::Iterator itn(myNodes);
while(itn->more()) for (; itn.More(); itn.Next())
delete itn.Value();
SetOfEdges::Iterator ite(myEdges);
for (; ite.More(); ite.Next())
{ {
delete itn->next(); SMDS_MeshElement* elem = ite.Value();
if(myParent!=NULL)
myElementIDFactory->ReleaseID(elem->GetID());
delete elem;
} }
set<SMDS_MeshEdge*>::iterator ite=myEdges.begin(); SetOfFaces::Iterator itf(myFaces);
while(ite!=myEdges.end()) for (; itf.More(); itf.Next())
{ {
delete *ite; SMDS_MeshElement* elem = itf.Value();
ite++; if(myParent!=NULL)
myElementIDFactory->ReleaseID(elem->GetID());
delete elem;
} }
set<SMDS_MeshFace*>::iterator itf=myFaces.begin(); SetOfVolumes::Iterator itv(myVolumes);
while(itf!=myFaces.end()) for (; itv.More(); itv.Next())
{ {
delete *itf; SMDS_MeshElement* elem = itv.Value();
itf++; if(myParent!=NULL)
myElementIDFactory->ReleaseID(elem->GetID());
delete elem;
} }
set<SMDS_MeshVolume*>::iterator itv=myVolumes.begin(); if(myParent==NULL)
while(itv!=myVolumes.end())
{ {
delete *itv; delete myNodeIDFactory;
itv++; delete myElementIDFactory;
} }
} }
@ -1433,98 +1443,66 @@ void SMDS_Mesh::setInverseElements(bool b)
} }
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
/// Return an iterator on nodes of the current mesh /// Return an iterator on nodes of the current mesh factory
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
class SMDS_Mesh_MyNodeIterator:public SMDS_NodeIterator class SMDS_Mesh_MyNodeIterator:public SMDS_NodeIterator
{ {
const SMDS_IdElementMap& myIdElemMap; SMDS_ElemIteratorPtr myIterator;
SMDS_IdElementMap::const_iterator myIterator;
public: public:
SMDS_Mesh_MyNodeIterator(const SMDS_IdElementMap& s):myIdElemMap(s) SMDS_Mesh_MyNodeIterator(const SMDS_ElemIteratorPtr& it):myIterator(it)
{ {}
myIterator=myIdElemMap.begin();
}
bool more() bool more()
{ {
return myIterator!=myIdElemMap.end(); return myIterator->more();
} }
const SMDS_MeshNode* next() const SMDS_MeshNode* next()
{ {
const SMDS_MeshElement* current=(*myIterator).second; return static_cast<const SMDS_MeshNode*>(myIterator->next());
myIterator++;
return static_cast<const SMDS_MeshNode*>( current );
} }
}; };
SMDS_NodeIteratorPtr SMDS_Mesh::nodesIterator() const SMDS_NodeIteratorPtr SMDS_Mesh::nodesIterator() const
{ {
return SMDS_NodeIteratorPtr return SMDS_NodeIteratorPtr
(new SMDS_Mesh_MyNodeIterator(myNodeIDFactory->GetIdElementMap())); (new SMDS_Mesh_MyNodeIterator(myNodeIDFactory->elementsIterator()));
} }
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
/// Return an iterator on nodes of the current mesh /// Return an iterator on elements of the current mesh factory
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
class SMDS_Mesh_MyElemIterator:public SMDS_ElemIterator
{
const SMDS_IdElementMap& myIdElemMap;
SMDS_IdElementMap::const_iterator myIterator;
public:
SMDS_Mesh_MyElemIterator(const SMDS_IdElementMap& s):myIdElemMap(s)
{
myIterator=myIdElemMap.begin();
}
bool more()
{
return myIterator!=myIdElemMap.end();
}
const SMDS_MeshElement* next()
{
const SMDS_MeshElement* current=(*myIterator).second;
myIterator++;
return current;
}
};
SMDS_ElemIteratorPtr SMDS_Mesh::elementsIterator() const SMDS_ElemIteratorPtr SMDS_Mesh::elementsIterator() const
{ {
return SMDS_ElemIteratorPtr return myElementIDFactory->elementsIterator();
(new SMDS_Mesh_MyElemIterator(myElementIDFactory->GetIdElementMap()));
} }
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
///Return an iterator on volumes of the current mesh. ///Return an iterator on edges of the current mesh.
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
class SMDS_Mesh_MyEdgeIterator:public SMDS_EdgeIterator class SMDS_Mesh_MyEdgeIterator:public SMDS_EdgeIterator
{ {
typedef SMDS_Mesh::SetOfEdges SetOfEdges; typedef SMDS_Mesh::SetOfEdges SetOfEdges;
const SetOfEdges& mySet; SetOfEdges::Iterator myIterator;
const SMDS_MeshEdge * myEdge;
SetOfEdges::iterator myIterator;
public: public:
SMDS_Mesh_MyEdgeIterator(const SetOfEdges& s):mySet(s) SMDS_Mesh_MyEdgeIterator(const SetOfEdges& s):myIterator(s)
{ {}
myIterator=mySet.begin();
}
bool more() bool more()
{ {
while((myIterator!=mySet.end())) while(myIterator.More())
{ {
if((*myIterator)->GetID()!=-1) if(myIterator.Value()->GetID()!=-1)
return true; return true;
myIterator++; myIterator.Next();
} }
return false; return false;
} }
const SMDS_MeshEdge* next() const SMDS_MeshEdge* next()
{ {
const SMDS_MeshEdge* current=*myIterator; const SMDS_MeshEdge* current = myIterator.Value();
myIterator++; myIterator.Next();
return current; return current;
} }
}; };
@ -1535,35 +1513,31 @@ SMDS_EdgeIteratorPtr SMDS_Mesh::edgesIterator() const
} }
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
///Return an iterator on faces of the current mesh. Once used this iterator ///Return an iterator on faces of the current mesh.
///must be free by the caller
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
class SMDS_Mesh_MyFaceIterator:public SMDS_FaceIterator class SMDS_Mesh_MyFaceIterator:public SMDS_FaceIterator
{ {
typedef SMDS_Mesh::SetOfFaces SetOfFaces; typedef SMDS_Mesh::SetOfFaces SetOfFaces;
const SetOfFaces& mySet; SetOfFaces::Iterator myIterator;
SetOfFaces::iterator myIterator;
public: public:
SMDS_Mesh_MyFaceIterator(const SetOfFaces& s):mySet(s) SMDS_Mesh_MyFaceIterator(const SetOfFaces& s):myIterator(s)
{ {}
myIterator=mySet.begin();
}
bool more() bool more()
{ {
while((myIterator!=mySet.end())) while(myIterator.More())
{ {
if((*myIterator)->GetID()!=-1) if(myIterator.Value()->GetID()!=-1)
return true; return true;
myIterator++; myIterator.Next();
} }
return false; return false;
} }
const SMDS_MeshFace* next() const SMDS_MeshFace* next()
{ {
const SMDS_MeshFace* current=*myIterator; const SMDS_MeshFace* current = myIterator.Value();
myIterator++; myIterator.Next();
return current; return current;
} }
}; };
@ -1574,29 +1548,25 @@ SMDS_FaceIteratorPtr SMDS_Mesh::facesIterator() const
} }
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
///Return an iterator on volumes of the current mesh. Once used this iterator ///Return an iterator on volumes of the current mesh.
///must be free by the caller
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
class SMDS_Mesh_MyVolumeIterator:public SMDS_VolumeIterator class SMDS_Mesh_MyVolumeIterator:public SMDS_VolumeIterator
{ {
typedef SMDS_Mesh::SetOfVolumes SetOfVolumes; typedef SMDS_Mesh::SetOfVolumes SetOfVolumes;
const SetOfVolumes& mySet; SetOfVolumes::Iterator myIterator;
SetOfVolumes::iterator myIterator;
public: public:
SMDS_Mesh_MyVolumeIterator(const SetOfVolumes& s):mySet(s) SMDS_Mesh_MyVolumeIterator(const SetOfVolumes& s):myIterator(s)
{ {}
myIterator=mySet.begin();
}
bool more() bool more()
{ {
return myIterator!=mySet.end(); return myIterator.More() != Standard_False;
} }
const SMDS_MeshVolume* next() const SMDS_MeshVolume* next()
{ {
const SMDS_MeshVolume* current=*myIterator; const SMDS_MeshVolume* current = myIterator.Value();
myIterator++; myIterator.Next();
return current; return current;
} }
}; };
@ -1634,7 +1604,9 @@ static set<const SMDS_MeshElement*> * intersectionOfSets(
static set<const SMDS_MeshElement*> * getFinitElements(const SMDS_MeshElement * element) static set<const SMDS_MeshElement*> * getFinitElements(const SMDS_MeshElement * element)
{ {
int numberOfSets=element->NbNodes(); int numberOfSets=element->NbNodes();
set<const SMDS_MeshElement*> initSet[numberOfSets]; auto_ptr<set<const SMDS_MeshElement*> > pInitSet
(new set<const SMDS_MeshElement*>[numberOfSets]);
set<const SMDS_MeshElement*> *initSet = &(*pInitSet);
SMDS_ElemIteratorPtr itNodes=element->nodesIterator(); SMDS_ElemIteratorPtr itNodes=element->nodesIterator();
@ -1822,15 +1794,15 @@ void SMDS_Mesh::RemoveElement(const SMDS_MeshElement * elem,
MESSAGE("Internal Error: This should not happen"); MESSAGE("Internal Error: This should not happen");
break; break;
case SMDSAbs_Edge: case SMDSAbs_Edge:
myEdges.erase(static_cast<SMDS_MeshEdge*> myEdges.Remove(static_cast<SMDS_MeshEdge*>
(const_cast<SMDS_MeshElement*>(*it))); (const_cast<SMDS_MeshElement*>(*it)));
break; break;
case SMDSAbs_Face: case SMDSAbs_Face:
myFaces.erase(static_cast<SMDS_MeshFace*> myFaces.Remove(static_cast<SMDS_MeshFace*>
(const_cast<SMDS_MeshElement*>(*it))); (const_cast<SMDS_MeshElement*>(*it)));
break; break;
case SMDSAbs_Volume: case SMDSAbs_Volume:
myVolumes.erase(static_cast<SMDS_MeshVolume*> myVolumes.Remove(static_cast<SMDS_MeshVolume*>
(const_cast<SMDS_MeshElement*>(*it))); (const_cast<SMDS_MeshElement*>(*it)));
break; break;
} }
@ -1848,7 +1820,7 @@ void SMDS_Mesh::RemoveElement(const SMDS_MeshElement * elem,
while(it!=s2->end()) while(it!=s2->end())
{ {
//MESSAGE( "SMDS: RM node " << (*it)->GetID() ); //MESSAGE( "SMDS: RM node " << (*it)->GetID() );
myNodes.erase(static_cast<SMDS_MeshNode*> myNodes.Remove(static_cast<SMDS_MeshNode*>
(const_cast<SMDS_MeshElement*>(*it))); (const_cast<SMDS_MeshElement*>(*it)));
myNodeIDFactory->ReleaseID((*it)->GetID()); myNodeIDFactory->ReleaseID((*it)->GetID());
removedNodes.push_back( (*it) ); removedNodes.push_back( (*it) );
@ -1941,23 +1913,27 @@ void SMDS_Mesh::Renumber (const bool isNodes, const int startID, const int del
SMDS_MeshElementIDFactory * idFactory = SMDS_MeshElementIDFactory * idFactory =
isNodes ? myNodeIDFactory : myElementIDFactory; isNodes ? myNodeIDFactory : myElementIDFactory;
// get existing elements in the order of ID increasing and release their ids // get existing elements in the order of ID increasing
list< SMDS_MeshElement * > elemList; map<int,SMDS_MeshElement*> elemMap;
const SMDS_IdElementMap& idElemMap = idFactory->GetIdElementMap(); SMDS_ElemIteratorPtr idElemIt = idFactory->elementsIterator();
SMDS_IdElementMap::const_iterator idElemIt = idElemMap.begin(); while ( idElemIt->more() ) {
while ( idElemIt != idElemMap.end() ) { SMDS_MeshElement* elem = const_cast<SMDS_MeshElement*>(idElemIt->next());
SMDS_MeshElement* elem = (*idElemIt).second; int id = elem->GetID();
int id = (*idElemIt).first; elemMap.insert(map<int,SMDS_MeshElement*>::value_type(id, elem));
idElemIt++; }
elemList.push_back( elem ); // release their ids
map<int,SMDS_MeshElement*>::iterator elemIt = elemMap.begin();
for ( ; elemIt != elemMap.end(); elemIt++ )
{
int id = (*elemIt).first;
idFactory->ReleaseID( id ); idFactory->ReleaseID( id );
} }
// set new IDs // set new IDs
int ID = startID; int ID = startID;
list< SMDS_MeshElement * >::iterator elemIt = elemList.begin(); elemIt = elemMap.begin();
for ( ; elemIt != elemList.end(); elemIt++ ) for ( ; elemIt != elemMap.end(); elemIt++ )
{ {
idFactory->BindID( ID, *elemIt ); idFactory->BindID( ID, (*elemIt).second );
ID += deltaID; ID += deltaID;
} }
} }

View File

@ -32,7 +32,8 @@
#include "SMDS_MeshFace.hxx" #include "SMDS_MeshFace.hxx"
#include "SMDS_MeshVolume.hxx" #include "SMDS_MeshVolume.hxx"
#include "SMDS_MeshElementIDFactory.hxx" #include "SMDS_MeshElementIDFactory.hxx"
#include "SMDS_Iterator.hxx" #include "SMDS_ElemIterator.hxx"
#include <NCollection_Map.hxx>
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
#include <set> #include <set>
@ -268,10 +269,10 @@ public:
*/ */
bool Contains (const SMDS_MeshElement* elem) const; bool Contains (const SMDS_MeshElement* elem) const;
typedef std::set<SMDS_MeshNode *> SetOfNodes; typedef NCollection_Map<SMDS_MeshNode *> SetOfNodes;
typedef std::set<SMDS_MeshEdge *> SetOfEdges; typedef NCollection_Map<SMDS_MeshEdge *> SetOfEdges;
typedef std::set<SMDS_MeshFace *> SetOfFaces; typedef NCollection_Map<SMDS_MeshFace *> SetOfFaces;
typedef std::set<SMDS_MeshVolume *> SetOfVolumes; typedef NCollection_Map<SMDS_MeshVolume *> SetOfVolumes;
private: private:
SMDS_Mesh(SMDS_Mesh * parent); SMDS_Mesh(SMDS_Mesh * parent);

View File

@ -25,6 +25,9 @@
// Author : Jean-Michel BOULCOURT // Author : Jean-Michel BOULCOURT
// Module : SMESH // Module : SMESH
#ifdef _MSC_VER
#pragma warning(disable:4786)
#endif
#include "SMDS_MeshEdge.hxx" #include "SMDS_MeshEdge.hxx"
#include "SMDS_IteratorOfElements.hxx" #include "SMDS_IteratorOfElements.hxx"

View File

@ -19,6 +19,10 @@
// //
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
#ifdef _MSC_VER
#pragma warning(disable:4786)
#endif
#include "SMDS_MeshElement.hxx" #include "SMDS_MeshElement.hxx"
#include "SMDS_MeshNode.hxx" #include "SMDS_MeshNode.hxx"
#include "SMDS_MeshEdge.hxx" #include "SMDS_MeshEdge.hxx"

View File

@ -29,20 +29,15 @@
#include "SMDSAbs_ElementType.hxx" #include "SMDSAbs_ElementType.hxx"
#include "SMDS_MeshObject.hxx" #include "SMDS_MeshObject.hxx"
#include "SMDS_Iterator.hxx" #include "SMDS_ElemIterator.hxx"
#include "SMDS_MeshElementIDFactory.hxx" #include "SMDS_MeshElementIDFactory.hxx"
#include <boost/shared_ptr.hpp>
#include <vector> #include <vector>
#include <iostream> #include <iostream>
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

View File

@ -25,6 +25,9 @@
// Author : Jean-Michel BOULCOURT // Author : Jean-Michel BOULCOURT
// Module : SMESH // Module : SMESH
#ifdef _MSC_VER
#pragma warning(disable:4786)
#endif
#include "SMDS_MeshElementIDFactory.hxx" #include "SMDS_MeshElementIDFactory.hxx"
#include "SMDS_MeshElement.hxx" #include "SMDS_MeshElement.hxx"
@ -35,7 +38,9 @@ using namespace std;
//function : SMDS_MeshElementIDFactory //function : SMDS_MeshElementIDFactory
//purpose : //purpose :
//======================================================================= //=======================================================================
SMDS_MeshElementIDFactory::SMDS_MeshElementIDFactory():SMDS_MeshIDFactory() SMDS_MeshElementIDFactory::SMDS_MeshElementIDFactory():
SMDS_MeshIDFactory(),
myMin(0), myMax(0)
{ {
} }
@ -45,10 +50,12 @@ SMDS_MeshElementIDFactory::SMDS_MeshElementIDFactory():SMDS_MeshIDFactory()
//======================================================================= //=======================================================================
bool SMDS_MeshElementIDFactory::BindID(int ID, SMDS_MeshElement * elem) bool SMDS_MeshElementIDFactory::BindID(int ID, SMDS_MeshElement * elem)
{ {
bool bound=myIDElements.insert( if (myIDElements.IsBound(ID))
map<int, SMDS_MeshElement*>::value_type(ID,elem)).second; return false;
if(bound) elem->myID=ID; myIDElements.Bind(ID,elem);
return bound; elem->myID=ID;
updateMinMax (ID);
return true;
} }
//======================================================================= //=======================================================================
@ -57,8 +64,9 @@ bool SMDS_MeshElementIDFactory::BindID(int ID, SMDS_MeshElement * elem)
//======================================================================= //=======================================================================
SMDS_MeshElement* SMDS_MeshElementIDFactory::MeshElement(int ID) SMDS_MeshElement* SMDS_MeshElementIDFactory::MeshElement(int ID)
{ {
map<int, SMDS_MeshElement*>::iterator it=myIDElements.find(ID); if (!myIDElements.IsBound(ID))
if(it==myIDElements.end()) return NULL; else return (*it).second; return NULL;
return myIDElements.Find(ID);
} }
@ -71,7 +79,7 @@ int SMDS_MeshElementIDFactory::GetFreeID()
int ID; int ID;
do { do {
ID = SMDS_MeshIDFactory::GetFreeID(); ID = SMDS_MeshIDFactory::GetFreeID();
} while (myIDElements.find(ID) != myIDElements.end()); } while (myIDElements.IsBound(ID));
return ID; return ID;
} }
@ -81,8 +89,12 @@ int SMDS_MeshElementIDFactory::GetFreeID()
//======================================================================= //=======================================================================
void SMDS_MeshElementIDFactory::ReleaseID(const int ID) void SMDS_MeshElementIDFactory::ReleaseID(const int ID)
{ {
myIDElements.erase(ID); myIDElements.UnBind(ID);
SMDS_MeshIDFactory::ReleaseID(ID); SMDS_MeshIDFactory::ReleaseID(ID);
if (ID == myMax)
myMax = 0;
if (ID == myMin)
myMin = 0;
} }
//======================================================================= //=======================================================================
@ -92,11 +104,9 @@ void SMDS_MeshElementIDFactory::ReleaseID(const int ID)
int SMDS_MeshElementIDFactory::GetMaxID() const int SMDS_MeshElementIDFactory::GetMaxID() const
{ {
map<int, SMDS_MeshElement*>::const_reverse_iterator it = myIDElements.rbegin(); if (myMax == 0)
if ( it != myIDElements.rend() ) updateMinMax();
return (*it).first; return myMax;
return 0;
} }
//======================================================================= //=======================================================================
@ -106,10 +116,54 @@ int SMDS_MeshElementIDFactory::GetMaxID() const
int SMDS_MeshElementIDFactory::GetMinID() const int SMDS_MeshElementIDFactory::GetMinID() const
{ {
map<int, SMDS_MeshElement*>::const_iterator it = myIDElements.begin(); if (myMin == 0)
if ( it != myIDElements.end() ) updateMinMax();
return (*it).first; return myMin;
return 0;
} }
//=======================================================================
//function : updateMinMax
//purpose :
//=======================================================================
void SMDS_MeshElementIDFactory::updateMinMax() const
{
myMin = IntegerLast();
myMax = 0;
SMDS_IdElementMap::Iterator it(myIDElements);
for (; it.More(); it.Next())
updateMinMax (it.Key());
if (myMin == IntegerLast())
myMin = 0;
}
//=======================================================================
//function : elementsIterator
//purpose : Return an iterator on elements of the factory
//=======================================================================
class SMDS_Fact_MyElemIterator:public SMDS_ElemIterator
{
SMDS_IdElementMap::Iterator myIterator;
public:
SMDS_Fact_MyElemIterator(const SMDS_IdElementMap& s):myIterator(s)
{}
bool more()
{
return myIterator.More() != Standard_False;
}
const SMDS_MeshElement* next()
{
const SMDS_MeshElement* current = myIterator.Value();
myIterator.Next();
return current;
}
};
SMDS_ElemIteratorPtr SMDS_MeshElementIDFactory::elementsIterator() const
{
return SMDS_ElemIteratorPtr
(new SMDS_Fact_MyElemIterator(myIDElements));
}

View File

@ -28,16 +28,17 @@
#define _SMDS_MeshElementIDFactory_HeaderFile #define _SMDS_MeshElementIDFactory_HeaderFile
#include "SMDS_MeshIDFactory.hxx" #include "SMDS_MeshIDFactory.hxx"
#include "SMDS_ElemIterator.hxx"
#include <map> #include <NCollection_DataMap.hxx>
class SMDS_MeshElement; class SMDS_MeshElement;
typedef std::map<int, SMDS_MeshElement *> SMDS_IdElementMap; typedef NCollection_DataMap<int, SMDS_MeshElement *> SMDS_IdElementMap;
class SMDS_MeshElementIDFactory:public SMDS_MeshIDFactory class SMDS_MeshElementIDFactory:public SMDS_MeshIDFactory
{ {
public: public:
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);
@ -45,9 +46,17 @@ class SMDS_MeshElementIDFactory:public SMDS_MeshIDFactory
virtual void ReleaseID(int ID); virtual void ReleaseID(int ID);
int GetMaxID() const; int GetMaxID() const;
int GetMinID() const; int GetMinID() const;
const SMDS_IdElementMap & GetIdElementMap() const { return myIDElements; } SMDS_ElemIteratorPtr elementsIterator() const;
private: private:
void updateMinMax() const;
void updateMinMax(int id) const
{
if (id > myMax) myMax = id;
if (id < myMin) myMin = id;
}
SMDS_IdElementMap myIDElements; SMDS_IdElementMap myIDElements;
mutable int myMin, myMax;
}; };

View File

@ -24,6 +24,10 @@
// Author : Jean-Michel BOULCOURT // Author : Jean-Michel BOULCOURT
// Module : SMESH // Module : SMESH
#ifdef _MSC_VER
#pragma warning(disable:4786)
#endif
#include "SMDS_MeshGroup.hxx" #include "SMDS_MeshGroup.hxx"
#include "utilities.h" #include "utilities.h"

View File

@ -65,7 +65,7 @@ class SMDS_MeshGroup:public SMDS_MeshObject
SMDS_MeshGroup(SMDS_MeshGroup* theParent, SMDS_MeshGroup(SMDS_MeshGroup* theParent,
const SMDSAbs_ElementType theType = SMDSAbs_All); const SMDSAbs_ElementType theType = SMDSAbs_All);
typedef std::set<const SMDS_MeshElement *>::iterator TIterator; typedef std::set<const SMDS_MeshElement *>::const_iterator TIterator;
const SMDS_Mesh * myMesh; const SMDS_Mesh * myMesh;
SMDSAbs_ElementType myType; SMDSAbs_ElementType myType;
std::set<const SMDS_MeshElement *> myElements; std::set<const SMDS_MeshElement *> myElements;

View File

@ -19,6 +19,9 @@
// //
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
#ifdef _MSC_VER
#pragma warning(disable:4786)
#endif
#include "SMDS_MeshNode.hxx" #include "SMDS_MeshNode.hxx"
#include "SMDS_SpacePosition.hxx" #include "SMDS_SpacePosition.hxx"
@ -44,7 +47,14 @@ SMDS_MeshNode::SMDS_MeshNode(double x, double y, double z):
void SMDS_MeshNode::RemoveInverseElement(const SMDS_MeshElement * parent) void SMDS_MeshNode::RemoveInverseElement(const SMDS_MeshElement * parent)
{ {
myInverseElements.erase(parent); NCollection_List<const SMDS_MeshElement*>::Iterator it(myInverseElements);
while (it.More()) {
const SMDS_MeshElement* elem = it.Value();
if (elem == parent)
myInverseElements.Remove(it);
else
it.Next();
}
} }
//======================================================================= //=======================================================================
@ -80,24 +90,21 @@ const SMDS_PositionPtr& SMDS_MeshNode::GetPosition() const
class SMDS_MeshNode_MyInvIterator:public SMDS_ElemIterator class SMDS_MeshNode_MyInvIterator:public SMDS_ElemIterator
{ {
const set<const SMDS_MeshElement*>& mySet; NCollection_List<const SMDS_MeshElement*>::Iterator myIterator;
set<const SMDS_MeshElement*>::iterator myIterator;
public: public:
SMDS_MeshNode_MyInvIterator(const set<const SMDS_MeshElement*>& s): SMDS_MeshNode_MyInvIterator(const NCollection_List<const SMDS_MeshElement*>& s):
mySet(s) myIterator(s)
{ {}
myIterator=mySet.begin();
}
bool more() bool more()
{ {
return myIterator!=mySet.end(); return myIterator.More() != Standard_False;
} }
const SMDS_MeshElement* next() const SMDS_MeshElement* next()
{ {
const SMDS_MeshElement* current=*myIterator; const SMDS_MeshElement* current=myIterator.Value();
myIterator++; myIterator.Next();
return current; return current;
} }
}; };
@ -112,39 +119,38 @@ SMDS_ElemIteratorPtr SMDS_MeshNode::
// wanted type elements. // wanted type elements.
class SMDS_MeshNode_MyIterator:public SMDS_ElemIterator class SMDS_MeshNode_MyIterator:public SMDS_ElemIterator
{ {
set<const SMDS_MeshElement*> mySet; NCollection_List<const SMDS_MeshElement*> mySet;
set<const SMDS_MeshElement*>::iterator myIterator; NCollection_List<const SMDS_MeshElement*>::Iterator myIterator;
public: public:
SMDS_MeshNode_MyIterator(SMDSAbs_ElementType type, SMDS_MeshNode_MyIterator(SMDSAbs_ElementType type,
const set<const SMDS_MeshElement*>& s) const NCollection_List<const SMDS_MeshElement*>& s)
{ {
const SMDS_MeshElement * e; const SMDS_MeshElement * e;
bool toInsert; bool toInsert;
set<const SMDS_MeshElement*>::iterator it=s.begin(); NCollection_List<const SMDS_MeshElement*>::Iterator it(s);
while(it!=s.end()) for(; it.More(); it.Next())
{ {
e=*it; e=it.Value();
switch(type) switch(type)
{ {
case SMDSAbs_Edge: toInsert=true; break; case SMDSAbs_Edge: toInsert=true; break;
case SMDSAbs_Face: toInsert=(e->GetType()!=SMDSAbs_Edge); break; case SMDSAbs_Face: toInsert=(e->GetType()!=SMDSAbs_Edge); break;
case SMDSAbs_Volume: toInsert=(e->GetType()==SMDSAbs_Volume); break; case SMDSAbs_Volume: toInsert=(e->GetType()==SMDSAbs_Volume); break;
} }
if(toInsert) mySet.insert(e); if(toInsert) mySet.Append(e);
it++;
} }
myIterator=mySet.begin(); myIterator.Init(mySet);
} }
bool more() bool more()
{ {
return myIterator!=mySet.end(); return myIterator.More() != Standard_False;
} }
const SMDS_MeshElement* next() const SMDS_MeshElement* next()
{ {
const SMDS_MeshElement* current=*myIterator; const SMDS_MeshElement* current=myIterator.Value();
myIterator++; myIterator.Next();
return current; return current;
} }
}; };
@ -199,7 +205,13 @@ SMDSAbs_ElementType SMDS_MeshNode::GetType() const
//======================================================================= //=======================================================================
void SMDS_MeshNode::AddInverseElement(const SMDS_MeshElement* ME) void SMDS_MeshNode::AddInverseElement(const SMDS_MeshElement* ME)
{ {
myInverseElements.insert(ME); NCollection_List<const SMDS_MeshElement*>::Iterator it(myInverseElements);
for (; it.More(); it.Next()) {
const SMDS_MeshElement* elem = it.Value();
if (elem == ME)
return;
}
myInverseElements.Append(ME);
} }
//======================================================================= //=======================================================================
@ -208,12 +220,12 @@ void SMDS_MeshNode::AddInverseElement(const SMDS_MeshElement* ME)
//======================================================================= //=======================================================================
void SMDS_MeshNode::ClearInverseElements() void SMDS_MeshNode::ClearInverseElements()
{ {
myInverseElements.clear(); myInverseElements.Clear();
} }
bool SMDS_MeshNode::emptyInverseElements() bool SMDS_MeshNode::emptyInverseElements()
{ {
return myInverseElements.empty(); return myInverseElements.IsEmpty() != Standard_False;
} }
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////

View File

@ -29,9 +29,7 @@
#include "SMDS_MeshElement.hxx" #include "SMDS_MeshElement.hxx"
#include "SMDS_Position.hxx" #include "SMDS_Position.hxx"
#include <NCollection_List.hxx>
#include <set>
class SMDS_MeshNode:public SMDS_MeshElement class SMDS_MeshNode:public SMDS_MeshElement
{ {
@ -61,7 +59,7 @@ class SMDS_MeshNode:public SMDS_MeshElement
private: private:
double myX, myY, myZ; double myX, myY, myZ;
SMDS_PositionPtr myPosition; SMDS_PositionPtr myPosition;
std::set<const SMDS_MeshElement*> myInverseElements; NCollection_List<const SMDS_MeshElement*> myInverseElements;
}; };
#endif #endif

View File

@ -49,7 +49,7 @@ SMDS_VertexPosition:: SMDS_VertexPosition(const int aVertexId)
const double *SMDS_VertexPosition::Coords() const const double *SMDS_VertexPosition::Coords() const
{ {
const static double origin[]={0,0,0}; const static double origin[]={0,0,0};
MESSAGE("SMDS_EdgePosition::Coords not implemented"); MESSAGE("SMDS_VertexPosition::Coords not implemented");
return origin; return origin;
} }

View File

@ -25,6 +25,10 @@
// Author : Jean-Michel BOULCOURT // Author : Jean-Michel BOULCOURT
// Module : SMESH // Module : SMESH
#ifdef _MSC_VER
#pragma warning(disable:4786)
#endif
#include "SMDS_VolumeOfFaces.hxx" #include "SMDS_VolumeOfFaces.hxx"
#include "SMDS_IteratorOfElements.hxx" #include "SMDS_IteratorOfElements.hxx"
@ -39,27 +43,28 @@ void SMDS_VolumeOfFaces::Print(ostream & OS) const
{ {
OS << "volume <" << GetID() << "> : "; OS << "volume <" << GetID() << "> : ";
int i; int i;
for (i = 0; i < myFaces.size()-1; ++i) OS << myFaces[i] << ","; for (i = 0; i < NbFaces()-1; ++i) OS << myFaces[i] << ",";
OS << myFaces[i]<< ") " << endl; OS << myFaces[i]<< ") " << endl;
} }
int SMDS_VolumeOfFaces::NbFaces() const int SMDS_VolumeOfFaces::NbFaces() const
{ {
return myFaces.size(); return myNbFaces;
} }
class SMDS_VolumeOfFaces_MyIterator:public SMDS_ElemIterator class SMDS_VolumeOfFaces_MyIterator:public SMDS_ElemIterator
{ {
const vector<const SMDS_MeshFace*>& mySet; const SMDS_MeshFace* const *mySet;
int myLength;
int index; int index;
public: public:
SMDS_VolumeOfFaces_MyIterator(const vector<const SMDS_MeshFace*>& s): SMDS_VolumeOfFaces_MyIterator(const SMDS_MeshFace* const *s, int l):
mySet(s),index(0) {} mySet(s),myLength(l),index(0) {}
bool more() bool more()
{ {
return index<mySet.size(); return index<myLength;
} }
const SMDS_MeshElement* next() const SMDS_MeshElement* next()
@ -77,11 +82,12 @@ SMDS_ElemIteratorPtr SMDS_VolumeOfFaces::
case SMDSAbs_Volume: case SMDSAbs_Volume:
return SMDS_MeshElement::elementsIterator(SMDSAbs_Volume); return SMDS_MeshElement::elementsIterator(SMDSAbs_Volume);
case SMDSAbs_Face: case SMDSAbs_Face:
return SMDS_ElemIteratorPtr(new SMDS_VolumeOfFaces_MyIterator(myFaces)); return SMDS_ElemIteratorPtr(new SMDS_VolumeOfFaces_MyIterator(myFaces,myNbFaces));
default: default:
return SMDS_ElemIteratorPtr return SMDS_ElemIteratorPtr
(new SMDS_IteratorOfElements (new SMDS_IteratorOfElements
(this,type,SMDS_ElemIteratorPtr(new SMDS_VolumeOfFaces_MyIterator(myFaces)))); (this,type,SMDS_ElemIteratorPtr
(new SMDS_VolumeOfFaces_MyIterator(myFaces,myNbFaces))));
} }
} }
@ -90,11 +96,13 @@ SMDS_VolumeOfFaces::SMDS_VolumeOfFaces(const SMDS_MeshFace * face1,
const SMDS_MeshFace * face3, const SMDS_MeshFace * face3,
const SMDS_MeshFace * face4) const SMDS_MeshFace * face4)
{ {
myFaces.resize(4); myNbFaces = 4;
myFaces[0]=face1; myFaces[0]=face1;
myFaces[1]=face2; myFaces[1]=face2;
myFaces[2]=face3; myFaces[2]=face3;
myFaces[3]=face4; myFaces[3]=face4;
myFaces[4]=0;
myFaces[5]=0;
} }
SMDS_VolumeOfFaces::SMDS_VolumeOfFaces(const SMDS_MeshFace * face1, SMDS_VolumeOfFaces::SMDS_VolumeOfFaces(const SMDS_MeshFace * face1,
@ -103,12 +111,13 @@ SMDS_VolumeOfFaces::SMDS_VolumeOfFaces(const SMDS_MeshFace * face1,
const SMDS_MeshFace * face4, const SMDS_MeshFace * face4,
const SMDS_MeshFace * face5) const SMDS_MeshFace * face5)
{ {
myFaces.resize(5); myNbFaces = 5;
myFaces[0]=face1; myFaces[0]=face1;
myFaces[1]=face2; myFaces[1]=face2;
myFaces[2]=face3; myFaces[2]=face3;
myFaces[3]=face4; myFaces[3]=face4;
myFaces[4]=face5; myFaces[4]=face5;
myFaces[5]=0;
} }
SMDS_VolumeOfFaces::SMDS_VolumeOfFaces(const SMDS_MeshFace * face1, SMDS_VolumeOfFaces::SMDS_VolumeOfFaces(const SMDS_MeshFace * face1,
@ -118,7 +127,7 @@ SMDS_VolumeOfFaces::SMDS_VolumeOfFaces(const SMDS_MeshFace * face1,
const SMDS_MeshFace * face5, const SMDS_MeshFace * face5,
const SMDS_MeshFace * face6) const SMDS_MeshFace * face6)
{ {
myFaces.resize(6); myNbFaces = 6;
myFaces[0]=face1; myFaces[0]=face1;
myFaces[1]=face2; myFaces[1]=face2;
myFaces[2]=face3; myFaces[2]=face3;

View File

@ -30,7 +30,6 @@
#include "SMDS_MeshVolume.hxx" #include "SMDS_MeshVolume.hxx"
#include "SMDS_MeshFace.hxx" #include "SMDS_MeshFace.hxx"
#include "SMDS_Iterator.hxx" #include "SMDS_Iterator.hxx"
#include <vector>
#include <iostream> #include <iostream>
@ -61,6 +60,7 @@ class SMDS_VolumeOfFaces:public SMDS_MeshVolume
protected: protected:
SMDS_ElemIteratorPtr SMDS_ElemIteratorPtr
elementsIterator(SMDSAbs_ElementType type) const; elementsIterator(SMDSAbs_ElementType type) const;
std::vector<const SMDS_MeshFace *> myFaces; const SMDS_MeshFace * myFaces[6];
int myNbFaces;
}; };
#endif #endif

View File

@ -19,6 +19,10 @@
// //
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
#ifdef _MSC_VER
#pragma warning(disable:4786)
#endif
#include "SMDS_VolumeOfNodes.hxx" #include "SMDS_VolumeOfNodes.hxx"
#include "SMDS_MeshNode.hxx" #include "SMDS_MeshNode.hxx"
#include "utilities.h" #include "utilities.h"
@ -39,7 +43,8 @@ SMDS_VolumeOfNodes::SMDS_VolumeOfNodes(
const SMDS_MeshNode * node7, const SMDS_MeshNode * node7,
const SMDS_MeshNode * node8) const SMDS_MeshNode * node8)
{ {
myNodes.resize(8); myNbNodes = 8;
myNodes = new const SMDS_MeshNode* [myNbNodes];
myNodes[0]=node1; myNodes[0]=node1;
myNodes[1]=node2; myNodes[1]=node2;
myNodes[2]=node3; myNodes[2]=node3;
@ -56,7 +61,8 @@ SMDS_VolumeOfNodes::SMDS_VolumeOfNodes(
const SMDS_MeshNode * node3, const SMDS_MeshNode * node3,
const SMDS_MeshNode * node4) const SMDS_MeshNode * node4)
{ {
myNodes.resize(4); myNbNodes = 4;
myNodes = new const SMDS_MeshNode* [myNbNodes];
myNodes[0]=node1; myNodes[0]=node1;
myNodes[1]=node2; myNodes[1]=node2;
myNodes[2]=node3; myNodes[2]=node3;
@ -70,7 +76,8 @@ SMDS_VolumeOfNodes::SMDS_VolumeOfNodes(
const SMDS_MeshNode * node4, const SMDS_MeshNode * node4,
const SMDS_MeshNode * node5) const SMDS_MeshNode * node5)
{ {
myNodes.resize(5); myNbNodes = 5;
myNodes = new const SMDS_MeshNode* [myNbNodes];
myNodes[0]=node1; myNodes[0]=node1;
myNodes[1]=node2; myNodes[1]=node2;
myNodes[2]=node3; myNodes[2]=node3;
@ -86,7 +93,8 @@ SMDS_VolumeOfNodes::SMDS_VolumeOfNodes(
const SMDS_MeshNode * node5, const SMDS_MeshNode * node5,
const SMDS_MeshNode * node6) const SMDS_MeshNode * node6)
{ {
myNodes.resize(6); myNbNodes = 6;
myNodes = new const SMDS_MeshNode* [myNbNodes];
myNodes[0]=node1; myNodes[0]=node1;
myNodes[1]=node2; myNodes[1]=node2;
myNodes[2]=node3; myNodes[2]=node3;
@ -94,18 +102,30 @@ SMDS_VolumeOfNodes::SMDS_VolumeOfNodes(
myNodes[4]=node5; myNodes[4]=node5;
myNodes[5]=node6; myNodes[5]=node6;
} }
bool SMDS_VolumeOfNodes::ChangeNodes(const SMDS_MeshNode* nodes[], bool SMDS_VolumeOfNodes::ChangeNodes(const SMDS_MeshNode* nodes[],
const int nbNodes) const int nbNodes)
{ {
if (nbNodes < 4 || nbNodes > 8 || nbNodes == 7) if (nbNodes < 4 || nbNodes > 8 || nbNodes == 7)
return false; return false;
myNodes.resize( nbNodes ); delete [] myNodes;
myNbNodes = nbNodes;
myNodes = new const SMDS_MeshNode* [myNbNodes];
for ( int i = 0; i < nbNodes; i++ ) for ( int i = 0; i < nbNodes; i++ )
myNodes[ i ] = nodes [ i ]; myNodes[ i ] = nodes [ i ];
return true; return true;
} }
SMDS_VolumeOfNodes::~SMDS_VolumeOfNodes()
{
if (myNodes != NULL) {
delete [] myNodes;
myNodes = NULL;
}
}
//======================================================================= //=======================================================================
//function : Print //function : Print
//purpose : //purpose :
@ -134,7 +154,7 @@ int SMDS_VolumeOfNodes::NbFaces() const
int SMDS_VolumeOfNodes::NbNodes() const int SMDS_VolumeOfNodes::NbNodes() const
{ {
return myNodes.size(); return myNbNodes;
} }
int SMDS_VolumeOfNodes::NbEdges() const int SMDS_VolumeOfNodes::NbEdges() const
@ -152,15 +172,16 @@ int SMDS_VolumeOfNodes::NbEdges() const
class SMDS_VolumeOfNodes_MyIterator:public SMDS_ElemIterator class SMDS_VolumeOfNodes_MyIterator:public SMDS_ElemIterator
{ {
const vector<const SMDS_MeshNode*>& mySet; const SMDS_MeshNode* const* mySet;
int myLength;
int index; int index;
public: public:
SMDS_VolumeOfNodes_MyIterator(const vector<const SMDS_MeshNode*>& s): SMDS_VolumeOfNodes_MyIterator(const SMDS_MeshNode* const* s, int l):
mySet(s),index(0) {} mySet(s),myLength(l),index(0) {}
bool more() bool more()
{ {
return index<mySet.size(); return index<myLength;
} }
const SMDS_MeshElement* next() const SMDS_MeshElement* next()
@ -178,7 +199,7 @@ SMDS_ElemIteratorPtr SMDS_VolumeOfNodes::
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 SMDS_ElemIteratorPtr(new SMDS_VolumeOfNodes_MyIterator(myNodes)); return SMDS_ElemIteratorPtr(new SMDS_VolumeOfNodes_MyIterator(myNodes,myNbNodes));
default: default:
MESSAGE("ERROR : Iterator not implemented"); MESSAGE("ERROR : Iterator not implemented");
return SMDS_ElemIteratorPtr((SMDS_ElemIterator*)NULL); return SMDS_ElemIteratorPtr((SMDS_ElemIterator*)NULL);

View File

@ -28,7 +28,6 @@
#define _SMDS_VolumeOfNodes_HeaderFile #define _SMDS_VolumeOfNodes_HeaderFile
#include "SMDS_MeshVolume.hxx" #include "SMDS_MeshVolume.hxx"
#include <vector>
class SMDS_VolumeOfNodes:public SMDS_MeshVolume class SMDS_VolumeOfNodes:public SMDS_MeshVolume
@ -64,6 +63,7 @@ class SMDS_VolumeOfNodes:public SMDS_MeshVolume
const SMDS_MeshNode * node8); const SMDS_MeshNode * node8);
bool ChangeNodes(const SMDS_MeshNode* nodes[], bool ChangeNodes(const SMDS_MeshNode* nodes[],
const int nbNodes); const int nbNodes);
~SMDS_VolumeOfNodes();
void Print(std::ostream & OS) const; void Print(std::ostream & OS) const;
int NbFaces() const; int NbFaces() const;
@ -73,6 +73,7 @@ class SMDS_VolumeOfNodes:public SMDS_MeshVolume
protected: protected:
SMDS_ElemIteratorPtr SMDS_ElemIteratorPtr
elementsIterator(SMDSAbs_ElementType type) const; elementsIterator(SMDSAbs_ElementType type) const;
std::vector<const SMDS_MeshNode *> myNodes; const SMDS_MeshNode** myNodes;
int myNbNodes;
}; };
#endif #endif

View File

@ -3,6 +3,9 @@
// Author : Edward AGAPOV (eap) // Author : Edward AGAPOV (eap)
// Copyright : Open CASCADE // Copyright : Open CASCADE
#ifdef _MSC_VER
#pragma warning(disable:4786)
#endif
#include "SMDS_VolumeTool.hxx" #include "SMDS_VolumeTool.hxx"
@ -10,35 +13,69 @@
#include "SMDS_MeshNode.hxx" #include "SMDS_MeshNode.hxx"
#include <map> #include <map>
#include <float.h> #include <float.h>
#include <math.h>
using namespace std; using namespace std;
// ======================================================
// Node indices in faces depending on volume orientation
// making most faces normals external
// ======================================================
/* /*
// N3 // N3
// + // +
// /|\ // /|\
// / | \ // / | \
// / | \ // / | \
// N0 +---|---+ N2 TETRAHEDRON // N0 +---|---+ N1 TETRAHEDRON
// \ | / // \ | /
// \ | / // \ | /
// \ | / // \ | /
// \|/ // \|/
// + // +
// N1 // N2
*/ */
static int Tetra_F [4][4] = { // FORWARD == REVERSED EXTERNAL static int Tetra_F [4][4] = { // FORWARD == EXTERNAL
{ 0, 1, 2, 0 }, // Bottom face has an internal normal, other - external { 0, 1, 2, 0 }, // All faces have external normals
{ 0, 3, 1, 0 },
{ 1, 3, 2, 1 },
{ 0, 2, 3, 0 }};
static int Tetra_R [4][4] = { // REVERSED
{ 0, 1, 2, 0 }, // All faces but a bottom have external normals
{ 0, 1, 3, 0 }, { 0, 1, 3, 0 },
{ 1, 2, 3, 1 }, { 1, 2, 3, 1 },
{ 0, 3, 2, 0 }}; { 0, 3, 2, 0 }};
static int Tetra_R [4][4] = { // REVERSED == FORWARD EXTERNAL static int Tetra_RE [4][4] = { // REVERSED -> FORWARD (EXTERNAL)
{ 0, 2, 1, 0 }, // All faces have external normals { 0, 2, 1, 0 }, // All faces have external normals
{ 0, 1, 3, 0 }, { 0, 1, 3, 0 },
{ 1, 2, 3, 1 }, { 1, 2, 3, 1 },
{ 0, 3, 2, 0 }}; { 0, 3, 2, 0 }};
static int Tetra_nbN [] = { 3, 3, 3, 3 }; static int Tetra_nbN [] = { 3, 3, 3, 3 };
//
// PYRAMID
//
static int Pyramid_F [5][5] = { // FORWARD == EXTERNAL
{ 0, 1, 2, 3, 0 }, // All faces have external normals
{ 0, 4, 1, 0, 4 },
{ 1, 4, 2, 1, 4 },
{ 2, 4, 3, 2, 4 },
{ 3, 4, 0, 3, 4 }};
static int Pyramid_R [5][5] = { // REVERSED
{ 0, 1, 2, 3, 0 }, // All faces but a bottom have external normals
{ 0, 1, 4, 0, 4 },
{ 1, 2, 4, 1, 4 },
{ 2, 3, 4, 2, 4 },
{ 3, 0, 4, 3, 4 }};
static int Pyramid_RE [5][5] = { // REVERSED -> FORWARD (EXTERNAL)
{ 0, 3, 2, 1, 0 }, // All faces but a bottom have external normals
{ 0, 1, 4, 0, 4 },
{ 1, 2, 4, 1, 4 },
{ 2, 3, 4, 2, 4 },
{ 3, 0, 4, 3, 4 }};
static int Pyramid_nbN [] = { 4, 3, 3, 3, 3 };
/* /*
// + N4 // + N4
// /|\ // /|\
@ -58,71 +95,71 @@ static int Penta_F [5][5] = { // FORWARD
{ 0, 1, 2, 0, 0 }, // Top face has an internal normal, other - external { 0, 1, 2, 0, 0 }, // Top face has an internal normal, other - external
{ 3, 4, 5, 3, 3 }, // 0 is bottom, 1 is top face { 3, 4, 5, 3, 3 }, // 0 is bottom, 1 is top face
{ 0, 2, 5, 3, 0 }, { 0, 2, 5, 3, 0 },
{ 1, 2, 5, 4, 1 }, { 1, 4, 5, 2, 1 },
{ 1, 0, 3, 4, 1 }}; { 0, 3, 4, 1, 0 }};
static int Penta_R [5][5] = { // REVERSED static int Penta_R [5][5] = { // REVERSED
{ 0, 2, 1, 0, 0 }, // Bottom face has an internal normal, other - external { 0, 1, 2, 0, 0 }, // Bottom face has an internal normal, other - external
{ 3, 5, 4, 3, 3 }, // 0 is bottom, 1 is top face { 3, 4, 5, 3, 3 }, // 0 is bottom, 1 is top face
{ 0, 2, 5, 3, 0 }, { 0, 3, 5, 2, 0 },
{ 1, 2, 5, 4, 1 }, { 1, 2, 5, 4, 1 },
{ 1, 0, 3, 4, 1 }}; { 0, 1, 4, 3, 0 }};
static int Penta_FE [5][5] = { // EXTERNAL static int Penta_FE [5][5] = { // FORWARD -> EXTERNAL
{ 0, 1, 2, 0, 0 }, { 0, 1, 2, 0, 0 },
{ 3, 5, 4, 3, 3 }, { 3, 5, 4, 3, 3 },
{ 0, 2, 5, 3, 0 }, { 0, 2, 5, 3, 0 },
{ 1, 4, 5, 2, 1 },
{ 0, 3, 4, 1, 0 }};
static int Penta_RE [5][5] = { // REVERSED -> EXTERNAL
{ 0, 2, 1, 0, 0 },
{ 3, 4, 5, 3, 3 },
{ 0, 3, 5, 2, 0 },
{ 1, 2, 5, 4, 1 }, { 1, 2, 5, 4, 1 },
{ 1, 0, 3, 4, 1 }}; { 0, 1, 4, 3, 0 }};
static int Penta_RE [5][5] = { // REVERSED EXTERNAL
{ 0, 0, 2, 1, 0 },
{ 3, 3, 4, 5, 3 },
{ 0, 2, 5, 3, 0 },
{ 1, 2, 5, 4, 1 },
{ 1, 0, 3, 4, 1 }};
static int Penta_nbN [] = { 3, 3, 4, 4, 4 }; static int Penta_nbN [] = { 3, 3, 4, 4, 4 };
/* /*
// N7+----------+N6 // N5+----------+N6
// /| /| // /| /|
// / | / | // / | / |
// / | / | // / | / |
// N4+----------+N5 | // N4+----------+N7 |
// | | | | HEXAHEDRON // | | | | HEXAHEDRON
// | | | | // | | | |
// | | | | // | | | |
// | N3+------|---+N2 // | N1+------|---+N2
// | / | / // | / | /
// | / | / // | / | /
// |/ |/ // |/ |/
// N0+----------+N1 // N0+----------+N3
*/ */
static int Hexa_F [6][5] = { // FORWARD static int Hexa_F [6][5] = { // FORWARD
{ 0, 1, 2, 3, 0 }, // opposite faces are neighbouring, { 0, 1, 2, 3, 0 }, // opposite faces are neighbouring,
{ 4, 5, 6, 7, 4 }, // even face normal is internal, odd - external { 4, 5, 6, 7, 4 }, // odd face(1,3,5) normal is internal, even(0,2,4) - external
{ 1, 0, 4, 5, 1 }, // same index nodes nodes of opposite faces are linked { 1, 0, 4, 5, 1 }, // same index nodes of opposite faces are linked
{ 2, 3, 7, 6, 2 }, { 2, 3, 7, 6, 2 },
{ 0, 3, 7, 4, 0 }, { 0, 3, 7, 4, 0 },
{ 1, 2, 6, 5, 1 }}; { 1, 2, 6, 5, 1 }};
static int Hexa_R [6][5] = { // REVERSED // static int Hexa_R [6][5] = { // REVERSED
{ 0, 3, 2, 1, 0 }, // opposite faces are neighbouring, // { 0, 3, 2, 1, 0 }, // opposite faces are neighbouring,
{ 4, 7, 6, 5, 4 }, // even face normal is external, odd - internal // { 4, 7, 6, 5, 4 }, // odd face(1,3,5) normal is external, even(0,2,4) - internal
{ 1, 5, 4, 0, 1 }, // same index nodes nodes of opposite faces are linked // { 1, 5, 4, 0, 1 }, // same index nodes of opposite faces are linked
{ 2, 6, 7, 3, 2 }, // { 2, 6, 7, 3, 2 },
{ 0, 4, 7, 3, 0 }, // { 0, 4, 7, 3, 0 },
// { 1, 5, 6, 2, 1 }};
static int Hexa_FE [6][5] = { // FORWARD -> EXTERNAL
{ 0, 1, 2, 3, 0 } , // opposite faces are neighbouring,
{ 4, 7, 6, 5, 4 }, // all face normals are external,
{ 0, 4, 5, 1, 0 }, // links in opposite faces: 0-0, 1-3, 2-2, 3-1
{ 3, 2, 6, 7, 3 },
{ 0, 3, 7, 4, 0 },
{ 1, 5, 6, 2, 1 }}; { 1, 5, 6, 2, 1 }};
static int Hexa_FE [6][5] = { // EXTERNAL static int Hexa_RE [6][5] = { // REVERSED -> EXTERNAL
{ 0, 3, 2, 1, 0 }, // opposite faces are neighbouring, { 0, 3, 2, 1, 0 }, // opposite faces are neighbouring,
{ 4, 5, 6, 7, 4 }, // all face normals are external, { 4, 5, 6, 7, 4 }, // all face normals are external,
{ 0, 1, 5, 4, 0 }, // links in opposite faces: 0-0, 1-3, 2-2, 3-1 { 0, 1, 5, 4, 0 }, // links in opposite faces: 0-0, 1-3, 2-2, 3-1
{ 3, 7, 6, 2, 3 }, { 3, 7, 6, 2, 3 },
{ 1, 2, 6, 5, 1 }, { 0, 4, 7, 3, 0 },
{ 0, 4, 7, 3, 0 }}; { 1, 2, 6, 5, 1 }};
static int Hexa_RE [6][5] = { // REVERSED EXTERNAL
{ 0, 1, 2, 3, 0 }, // opposite faces are neighbouring,
{ 4, 7, 6, 5, 4 }, // all face normals are external,
{ 0, 1, 5, 4, 0 }, // links in opposite faces: 0-0, 1-3, 2-2, 3-1
{ 3, 7, 6, 2, 3 },
{ 1, 2, 6, 5, 1 },
{ 0, 4, 7, 3, 0 }};
static int Hexa_nbN [] = { 4, 4, 4, 4, 4, 4 }; static int Hexa_nbN [] = { 4, 4, 4, 4, 4, 4 };
// ======================================================== // ========================================================
@ -166,7 +203,6 @@ SMDS_VolumeTool::SMDS_VolumeTool ()
myVolForward( true ), myVolForward( true ),
myNbFaces( 0 ), myNbFaces( 0 ),
myVolumeNbNodes( 0 ), myVolumeNbNodes( 0 ),
myForwardFaces( false ),
myExternalFaces( false ) myExternalFaces( false )
{ {
} }
@ -176,8 +212,7 @@ SMDS_VolumeTool::SMDS_VolumeTool ()
//======================================================================= //=======================================================================
SMDS_VolumeTool::SMDS_VolumeTool (const SMDS_MeshElement* theVolume) SMDS_VolumeTool::SMDS_VolumeTool (const SMDS_MeshElement* theVolume)
: myForwardFaces( false ), : myExternalFaces( false )
myExternalFaces( false )
{ {
Set( theVolume ); Set( theVolume );
} }
@ -208,6 +243,7 @@ bool SMDS_VolumeTool::Set (const SMDS_MeshElement* theVolume)
myVolumeNbNodes = theVolume->NbNodes(); myVolumeNbNodes = theVolume->NbNodes();
switch ( myVolumeNbNodes ) { switch ( myVolumeNbNodes ) {
case 4: case 4:
case 5:
case 6: case 6:
case 8: case 8:
{ {
@ -223,11 +259,13 @@ bool SMDS_VolumeTool::Set (const SMDS_MeshElement* theVolume)
// nb nodes in each face // nb nodes in each face
if ( myVolumeNbNodes == 4 ) if ( myVolumeNbNodes == 4 )
myFaceNbNodes = Tetra_nbN; myFaceNbNodes = Tetra_nbN;
else if ( myVolumeNbNodes == 5 )
myFaceNbNodes = Pyramid_nbN;
else if ( myVolumeNbNodes == 6 ) else if ( myVolumeNbNodes == 6 )
myFaceNbNodes = Penta_nbN; myFaceNbNodes = Penta_nbN;
else else
myFaceNbNodes = Hexa_nbN; myFaceNbNodes = Hexa_nbN;
break;
// define volume orientation // define volume orientation
XYZ botNormal; XYZ botNormal;
GetFaceNormal( 0, botNormal.x, botNormal.y, botNormal.z ); GetFaceNormal( 0, botNormal.x, botNormal.y, botNormal.z );
@ -236,9 +274,8 @@ bool SMDS_VolumeTool::Set (const SMDS_MeshElement* theVolume)
XYZ upDir (topNode->X() - botNode->X(), XYZ upDir (topNode->X() - botNode->X(),
topNode->Y() - botNode->Y(), topNode->Y() - botNode->Y(),
topNode->Z() - botNode->Z() ); topNode->Z() - botNode->Z() );
bool diffDir = ( botNormal.Dot( upDir ) < 0 ); myVolForward = ( botNormal.Dot( upDir ) < 0 );
myVolForward = ( myVolumeNbNodes == 6 ? diffDir : !diffDir ); break;
} }
default: myVolume = 0; default: myVolume = 0;
} }
@ -269,6 +306,9 @@ void SMDS_VolumeTool::Inverse ()
case 4: case 4:
SWAP_NODES( myVolumeNodes, 1, 2 ); SWAP_NODES( myVolumeNodes, 1, 2 );
break; break;
case 5:
SWAP_NODES( myVolumeNodes, 1, 3 );
break;
case 6: case 6:
SWAP_NODES( myVolumeNodes, 1, 2 ); SWAP_NODES( myVolumeNodes, 1, 2 );
SWAP_NODES( myVolumeNodes, 4, 5 ); SWAP_NODES( myVolumeNodes, 4, 5 );
@ -314,16 +354,6 @@ bool SMDS_VolumeTool::GetBaryCenter(double & X, double & Y, double & Z) const
return true; return true;
} }
//=======================================================================
//function : SetForwardOrientation
//purpose : Node order will be as for forward orientation
//=======================================================================
void SMDS_VolumeTool::SetForwardOrientation ()
{
myForwardFaces = true;
}
//======================================================================= //=======================================================================
//function : SetExternalNormal //function : SetExternalNormal
//purpose : Node order will be so that faces normals are external //purpose : Node order will be so that faces normals are external
@ -332,6 +362,7 @@ void SMDS_VolumeTool::SetForwardOrientation ()
void SMDS_VolumeTool::SetExternalNormal () void SMDS_VolumeTool::SetExternalNormal ()
{ {
myExternalFaces = true; myExternalFaces = true;
myCurFace = -1;
} }
//======================================================================= //=======================================================================
@ -382,14 +413,14 @@ const int* SMDS_VolumeTool::GetFaceNodesIndices( int faceIndex )
//======================================================================= //=======================================================================
bool SMDS_VolumeTool::GetFaceNodes (int faceIndex, bool SMDS_VolumeTool::GetFaceNodes (int faceIndex,
std::set<const SMDS_MeshNode*>& theFaceNodes ) set<const SMDS_MeshNode*>& theFaceNodes )
{ {
if ( !setFace( faceIndex )) if ( !setFace( faceIndex ))
return false; return false;
theFaceNodes.clear(); theFaceNodes.clear();
int iNode, nbNode = myFaceNbNodes[ faceIndex ]; int iNode, nbNode = myFaceNbNodes[ faceIndex ];
for ( int iNode = 0; iNode < nbNode; iNode++ ) for ( iNode = 0; iNode < nbNode; iNode++ )
theFaceNodes.insert( myFaceNodes[ iNode ]); theFaceNodes.insert( myFaceNodes[ iNode ]);
return true; return true;
@ -405,18 +436,18 @@ bool SMDS_VolumeTool::IsFaceExternal( int faceIndex )
if ( myExternalFaces || !myVolume ) if ( myExternalFaces || !myVolume )
return true; return true;
bool reversed = ( !myForwardFaces && !myVolForward );
switch ( myVolumeNbNodes ) { switch ( myVolumeNbNodes ) {
case 4: case 4:
// only the bottom of a forward tetrahedron can be internal case 5:
return ( reversed || faceIndex != 0 ); // only the bottom of a reversed tetrahedron can be internal
return ( myVolForward || faceIndex != 0 );
case 6: case 6:
// in a forward pentahedron, the top is internal, in a reversed one - bottom // in a forward pentahedron, the top is internal, in a reversed one - bottom
return ( reversed ? faceIndex != 0 : faceIndex != 1 ); return ( myVolForward ? faceIndex != 1 : faceIndex != 0 );
case 8: { case 8: {
// in a forward hexahedron, odd face normal is external, else vice versa // in a forward hexahedron, even face normal is external, odd - internal
bool odd = faceIndex % 2; bool odd = faceIndex % 2;
return ( reversed ? !odd : odd ); return ( myVolForward ? !odd : odd );
} }
default:; default:;
} }
@ -540,6 +571,15 @@ bool SMDS_VolumeTool::IsLinked (const int theNode1Index,
switch ( myVolumeNbNodes ) { switch ( myVolumeNbNodes ) {
case 4: case 4:
return true; return true;
case 5:
if ( maxInd == 4 )
return true;
switch ( maxInd - minInd ) {
case 1:
case 3: return true;
default:;
}
break;
case 6: case 6:
switch ( maxInd - minInd ) { switch ( maxInd - minInd ) {
case 1: return minInd != 2; case 1: return minInd != 2;
@ -735,25 +775,25 @@ bool SMDS_VolumeTool::setFace( int faceIndex )
switch ( myVolumeNbNodes ) { switch ( myVolumeNbNodes ) {
case 4: case 4:
if ( myExternalFaces ) if ( myExternalFaces )
myFaceNodeIndices = myVolForward ? Tetra_R[ faceIndex ] : Tetra_F[ faceIndex ]; myFaceNodeIndices = myVolForward ? Tetra_F[ faceIndex ] : Tetra_RE[ faceIndex ];
else if ( myForwardFaces )
myFaceNodeIndices = myVolForward ? Tetra_F[ faceIndex ] : Tetra_R[ faceIndex ];
else else
myFaceNodeIndices = Tetra_F[ faceIndex ]; myFaceNodeIndices = myVolForward ? Tetra_F[ faceIndex ] : Tetra_R[ faceIndex ];
break;
case 5:
if ( myExternalFaces )
myFaceNodeIndices = myVolForward ? Pyramid_F[ faceIndex ] : Pyramid_RE[ faceIndex ];
else
myFaceNodeIndices = myVolForward ? Pyramid_F[ faceIndex ] : Pyramid_R[ faceIndex ];
break; break;
case 6: case 6:
if ( myExternalFaces ) if ( myExternalFaces )
myFaceNodeIndices = myVolForward ? Penta_FE[ faceIndex ] : Penta_RE[ faceIndex ]; myFaceNodeIndices = myVolForward ? Penta_FE[ faceIndex ] : Penta_RE[ faceIndex ];
else if ( myForwardFaces )
myFaceNodeIndices = myVolForward ? Penta_F[ faceIndex ] : Penta_R[ faceIndex ];
else else
myFaceNodeIndices = Penta_F[ faceIndex ]; myFaceNodeIndices = myVolForward ? Penta_F[ faceIndex ] : Penta_R[ faceIndex ];
break; break;
case 8: case 8:
if ( myExternalFaces ) if ( myExternalFaces )
myFaceNodeIndices = myVolForward ? Hexa_FE[ faceIndex ] : Hexa_RE[ faceIndex ]; myFaceNodeIndices = myVolForward ? Hexa_FE[ faceIndex ] : Hexa_RE[ faceIndex ];
else if ( myForwardFaces )
myFaceNodeIndices = myVolForward ? Hexa_F[ faceIndex ] : Hexa_R[ faceIndex ];
else else
myFaceNodeIndices = Hexa_F[ faceIndex ]; myFaceNodeIndices = Hexa_F[ faceIndex ];
break; break;

View File

@ -62,7 +62,7 @@ class SMDS_VolumeTool
bool IsForward() const { return myVolForward; } bool IsForward() const { return myVolForward; }
// Check volume orientation. can be changed by Inverse(). // Check volume orientation. can be changed by Inverse().
// See node order of forward volumes at file bottom // See node order of forward volumes at the file bottom
void Inverse(); void Inverse();
// Change nodes order as if the volume changes its orientation: // Change nodes order as if the volume changes its orientation:
@ -101,12 +101,8 @@ class SMDS_VolumeTool
// info on faces // info on faces
// ------------- // -------------
void SetForwardOrientation ();
// Node order in faces will be as for forward orientation
void SetExternalNormal (); void SetExternalNormal ();
// Node order in faces will be so that faces normals are external. // Node order in faces will be so that faces normals are external.
// It overrides SetForwardOrientation()
int NbFaces() const { return myNbFaces; } int NbFaces() const { return myNbFaces; }
// Return number of faces of the volume. In the following // Return number of faces of the volume. In the following
@ -135,8 +131,7 @@ class SMDS_VolumeTool
bool IsFaceExternal( int faceIndex ); bool IsFaceExternal( int faceIndex );
// Check normal orientation of a face. // Check normal orientation of a face.
// SetForwardOrientation() and SetForwardOrientation() are taken // SetExternalNormal() is taken into account.
// into account.
bool IsFreeFace( int faceIndex ); bool IsFreeFace( int faceIndex );
// Check that all volumes built on the face nodes lays on one side // Check that all volumes built on the face nodes lays on one side
@ -169,7 +164,6 @@ class SMDS_VolumeTool
int myVolumeNbNodes; int myVolumeNbNodes;
const SMDS_MeshNode* myVolumeNodes[ 8 ]; const SMDS_MeshNode* myVolumeNodes[ 8 ];
bool myForwardFaces;
bool myExternalFaces; bool myExternalFaces;
int* myFaceNodeIndices; int* myFaceNodeIndices;
int* myFaceNbNodes; int* myFaceNbNodes;
@ -191,13 +185,13 @@ class SMDS_VolumeTool
// /|\ // /|\
// / | \ // / | \
// / | \ // / | \
// N0 +---|---+ N2 TETRAHEDRON // N0 +---|---+ N1 TETRAHEDRON
// \ | / // \ | /
// \ | / // \ | /
// \ | / // \ | /
// \|/ // \|/
// + // +
// N1 // N2
// + N4 // + N4
// /|\ // /|\
@ -213,18 +207,18 @@ class SMDS_VolumeTool
// |/ \| // |/ \|
// N0 +---------+ N2 // N0 +---------+ N2
// N7+----------+N6 // N5+----------+N6
// /| /| // /| /|
// / | / | // / | / |
// / | / | // / | / |
// N4+----------+N5 | // N4+----------+N7 |
// | | | | HEXAHEDRON // | | | | HEXAHEDRON
// | | | | // | | | |
// | | | | // | | | |
// | N3+------|---+N2 // | N1+------|---+N2
// | / | / // | / | /
// | / | / // | / | /
// |/ |/ // |/ |/
// N0+----------+N1 // N0+----------+N3
// //
*/ */

View File

@ -74,9 +74,9 @@ BIN =
BIN_SRC = BIN_SRC =
# additionnal information to compile and link file # additionnal information to compile and link file
CPPFLAGS+= $(OCC_INCLUDES) $(MED2_INCLUDES) $(HDF5_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome \ CPPFLAGS+= $(OCC_INCLUDES) $(HDF5_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome \
-I${GEOM_ROOT_DIR}/include/salome $(BOOST_CPPFLAGS) -I${GEOM_ROOT_DIR}/include/salome $(BOOST_CPPFLAGS)
CXXFLAGS+= $(OCC_CXXFLAGS) $(MED2_INCLUDES) $(HDF5_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome \ CXXFLAGS+= $(OCC_CXXFLAGS) $(HDF5_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome \
-I${GEOM_ROOT_DIR}/include/salome -I${GEOM_ROOT_DIR}/include/salome
LDFLAGS+= -L${KERNEL_ROOT_DIR}/lib/salome -L${GEOM_ROOT_DIR}/lib/salome -lNMTTools -lSMESHDS -lMeshDriverDAT -lMeshDriverSTL -lMeshDriverMED -lMeshDriverUNV LDFLAGS+= -L${KERNEL_ROOT_DIR}/lib/salome -L${GEOM_ROOT_DIR}/lib/salome -lNMTTools -lSMESHDS -lMeshDriverDAT -lMeshDriverSTL -lMeshDriverMED -lMeshDriverUNV

View File

@ -40,6 +40,9 @@
#include <gp_Vec.hxx> #include <gp_Vec.hxx>
#include <math_FunctionSetRoot.hxx> #include <math_FunctionSetRoot.hxx>
#include "SMDS_MeshNode.hxx"
#include "SMDS_MeshVolume.hxx"
#include "SMDS_VolumeTool.hxx"
#include "utilities.h" #include "utilities.h"
#include <list> #include <list>
@ -56,6 +59,8 @@ using namespace std;
double SMESH_Block::TEdge::GetU( const gp_XYZ& theParams ) const double SMESH_Block::TEdge::GetU( const gp_XYZ& theParams ) const
{ {
double u = theParams.Coord( myCoordInd ); double u = theParams.Coord( myCoordInd );
if ( myC3d.IsNull() ) // if mesh block
return u;
return ( 1 - u ) * myFirst + u * myLast; return ( 1 - u ) * myFirst + u * myLast;
} }
@ -66,25 +71,29 @@ double SMESH_Block::TEdge::GetU( const gp_XYZ& theParams ) const
gp_XYZ SMESH_Block::TEdge::Point( const gp_XYZ& theParams ) const gp_XYZ SMESH_Block::TEdge::Point( const gp_XYZ& theParams ) const
{ {
gp_XYZ p = myC3d->Value( GetU( theParams )).XYZ(); double u = GetU( theParams );
if ( myC3d.IsNull() ) // if mesh block
return myNodes[0] * ( 1 - u ) + myNodes[1] * u;
gp_XYZ p = myC3d->Value( u ).XYZ();
if ( myTrsf.Form() != gp_Identity ) if ( myTrsf.Form() != gp_Identity )
myTrsf.Transforms( p ); myTrsf.Transforms( p );
return p; return p;
} }
//======================================================================= //=======================================================================
//function : SMESH_Block::TFace::GetUV //function : SMESH_Block::TFace::GetCoefs
//purpose : //purpose : return coefficients for addition of [0-3]-th edge and vertex
//======================================================================= //=======================================================================
gp_XY SMESH_Block::TFace::GetUV( const gp_XYZ& theParams ) const void SMESH_Block::TFace::GetCoefs(int iE,
const gp_XYZ& theParams,
double& Ecoef,
double& Vcoef ) const
{ {
gp_XY uv(0.,0.);
double dU = theParams.Coord( GetUInd() ); double dU = theParams.Coord( GetUInd() );
double dV = theParams.Coord( GetVInd() ); double dV = theParams.Coord( GetVInd() );
for ( int iE = 0; iE < 4; iE++ ) // loop on 4 edges
{
double Ecoef = 0, Vcoef = 0;
switch ( iE ) { switch ( iE ) {
case 0: case 0:
Ecoef = ( 1 - dV ); // u0 Ecoef = ( 1 - dV ); // u0
@ -98,8 +107,22 @@ gp_XY SMESH_Block::TFace::GetUV( const gp_XYZ& theParams ) const
case 3: case 3:
Ecoef = dU ; // 1v Ecoef = dU ; // 1v
Vcoef = ( 1 - dU ) * dV ; break; // 01 Vcoef = ( 1 - dU ) * dV ; break; // 01
default:; default: ASSERT(0);
} }
}
//=======================================================================
//function : SMESH_Block::TFace::GetUV
//purpose :
//=======================================================================
gp_XY SMESH_Block::TFace::GetUV( const gp_XYZ& theParams ) const
{
gp_XY uv(0.,0.);
for ( int iE = 0; iE < 4; iE++ ) // loop on 4 edges
{
double Ecoef = 0, Vcoef = 0;
GetCoefs( iE, theParams, Ecoef, Vcoef );
// edge addition // edge addition
double u = theParams.Coord( myCoordInd[ iE ] ); double u = theParams.Coord( myCoordInd[ iE ] );
u = ( 1 - u ) * myFirst[ iE ] + u * myLast[ iE ]; u = ( 1 - u ) * myFirst[ iE ] + u * myLast[ iE ];
@ -117,10 +140,34 @@ gp_XY SMESH_Block::TFace::GetUV( const gp_XYZ& theParams ) const
gp_XYZ SMESH_Block::TFace::Point( const gp_XYZ& theParams ) const gp_XYZ SMESH_Block::TFace::Point( const gp_XYZ& theParams ) const
{ {
gp_XYZ p(0.,0.,0.);
if ( myS.IsNull() ) // if mesh block
{
for ( int iE = 0; iE < 4; iE++ ) // loop on 4 edges
{
double Ecoef = 0, Vcoef = 0;
GetCoefs( iE, theParams, Ecoef, Vcoef );
// edge addition
double u = theParams.Coord( myCoordInd[ iE ] );
int i1 = 0, i2 = 1;
switch ( iE ) {
case 1: i1 = 3; i2 = 2; break;
case 2: i1 = 1; i2 = 2; break;
case 3: i1 = 0; i2 = 3; break;
}
p += Ecoef * ( myNodes[ i1 ] * ( 1 - u ) + myNodes[ i2 ] * u );
// corner addition
p -= Vcoef * myNodes[ iE ];
}
}
else // shape block
{
gp_XY uv = GetUV( theParams ); gp_XY uv = GetUV( theParams );
gp_XYZ p = myS->Value( uv.X(), uv.Y() ).XYZ(); p = myS->Value( uv.X(), uv.Y() ).XYZ();
if ( myTrsf.Form() != gp_Identity ) if ( myTrsf.Form() != gp_Identity )
myTrsf.Transforms( p ); myTrsf.Transforms( p );
}
return p; return p;
} }
@ -274,7 +321,7 @@ Standard_Boolean SMESH_Block::Values(const math_Vector& theXYZ,
return true; return true;
} }
if ( theFxyz(1) < myValues[0] ) if ( theFxyz(1) < myValues[0] ) // a better guess
{ {
// 3 partial derivatives // 3 partial derivatives
gp_Vec drv[ 3 ]; gp_Vec drv[ 3 ];
@ -620,6 +667,175 @@ static int getOrderedEdges (const TopoDS_Face& theFace,
return aWireList.size(); return aWireList.size();
} }
//=======================================================================
//function : LoadMeshBlock
//purpose : prepare to work with theVolume
//=======================================================================
#define gpXYZ(n) gp_XYZ(n->X(),n->Y(),n->Z())
bool SMESH_Block::LoadMeshBlock(const SMDS_MeshVolume* theVolume,
const int theNode000Index,
const int theNode001Index,
vector<const SMDS_MeshNode*>& theOrderedNodes)
{
MESSAGE(" ::LoadMeshBlock()");
myNbIterations = 0;
mySumDist = 0;
myGridComputed = false;
SMDS_VolumeTool vTool;
if (!vTool.Set( theVolume ) || vTool.NbNodes() != 8 ||
!vTool.IsLinked( theNode000Index, theNode001Index )) {
MESSAGE(" Bad arguments ");
return false;
}
vTool.SetExternalNormal();
// In terms of indices used for access to nodes and faces in SMDS_VolumeTool:
int V000, V100, V010, V110, V001, V101, V011, V111; // 8 vertices
int Fxy0, Fxy1; // bottom and top faces
// vertices of faces
vector<int> vFxy0, vFxy1;
V000 = theNode000Index;
V001 = theNode001Index;
// get faces sharing V000 and V001
list<int> fV000, fV001;
int i, iF, iE, iN;
for ( iF = 0; iF < vTool.NbFaces(); ++iF ) {
const int* nid = vTool.GetFaceNodesIndices( iF );
for ( iN = 0; iN < 4; ++iN )
if ( nid[ iN ] == V000 ) {
fV000.push_back( iF );
} else if ( nid[ iN ] == V001 ) {
fV001.push_back( iF );
}
}
// find the bottom (Fxy0), the top (Fxy1) faces
list<int>::iterator fIt1, fIt2, Fxy0Pos;
for ( fIt1 = fV000.begin(); fIt1 != fV000.end(); fIt1++) {
fIt2 = std::find( fV001.begin(), fV001.end(), *fIt1 );
if ( fIt2 != fV001.end() ) { // *fIt1 is in the both lists
fV001.erase( fIt2 ); // erase Fx0z or F0yz from fV001
} else { // *fIt1 is in fV000 only
Fxy0Pos = fIt1; // points to Fxy0
}
}
Fxy0 = *Fxy0Pos;
Fxy1 = fV001.front();
const SMDS_MeshNode** nn = vTool.GetNodes();
// find bottom veritices, their order is that a face normal is external
vFxy0.resize(4);
const int* nid = vTool.GetFaceNodesIndices( Fxy0 );
for ( i = 0; i < 4; ++i )
if ( nid[ i ] == V000 )
break;
for ( iN = 0; iN < 4; ++iN, ++i ) {
if ( i == 4 ) i = 0;
vFxy0[ iN ] = nid[ i ];
}
// find top veritices, their order is that a face normal is external
vFxy1.resize(4);
nid = vTool.GetFaceNodesIndices( Fxy1 );
for ( i = 0; i < 4; ++i )
if ( nid[ i ] == V001 )
break;
for ( iN = 0; iN < 4; ++iN, ++i ) {
if ( i == 4 ) i = 0;
vFxy1[ iN ] = nid[ i ];
}
// find indices of the rest veritices
V100 = vFxy0[3];
V010 = vFxy0[1];
V110 = vFxy0[2];
V101 = vFxy1[1];
V011 = vFxy1[3];
V111 = vFxy1[2];
// set points coordinates
myPnt[ ID_V000 - 1 ] = gpXYZ( nn[ V000 ] );
myPnt[ ID_V100 - 1 ] = gpXYZ( nn[ V100 ] );
myPnt[ ID_V010 - 1 ] = gpXYZ( nn[ V010 ] );
myPnt[ ID_V110 - 1 ] = gpXYZ( nn[ V110 ] );
myPnt[ ID_V001 - 1 ] = gpXYZ( nn[ V001 ] );
myPnt[ ID_V101 - 1 ] = gpXYZ( nn[ V101 ] );
myPnt[ ID_V011 - 1 ] = gpXYZ( nn[ V011 ] );
myPnt[ ID_V111 - 1 ] = gpXYZ( nn[ V111 ] );
// fill theOrderedNodes
theOrderedNodes.resize( 8 );
theOrderedNodes[ 0 ] = nn[ V000 ];
theOrderedNodes[ 1 ] = nn[ V100 ];
theOrderedNodes[ 2 ] = nn[ V010 ];
theOrderedNodes[ 3 ] = nn[ V110 ];
theOrderedNodes[ 4 ] = nn[ V001 ];
theOrderedNodes[ 5 ] = nn[ V101 ];
theOrderedNodes[ 6 ] = nn[ V011 ];
theOrderedNodes[ 7 ] = nn[ V111 ];
// fill edges
myEdge[ ID_Ex00 - ID_Ex00 ].myNodes[ 0 ] = myPnt[ ID_V000 - 1 ];
myEdge[ ID_Ex00 - ID_Ex00 ].myNodes[ 1 ] = myPnt[ ID_V100 - 1 ];
myEdge[ ID_Ex10 - ID_Ex00 ].myNodes[ 0 ] = myPnt[ ID_V010 - 1 ];
myEdge[ ID_Ex10 - ID_Ex00 ].myNodes[ 1 ] = myPnt[ ID_V110 - 1 ];
myEdge[ ID_Ex01 - ID_Ex00 ].myNodes[ 0 ] = myPnt[ ID_V001 - 1 ];
myEdge[ ID_Ex01 - ID_Ex00 ].myNodes[ 1 ] = myPnt[ ID_V101 - 1 ];
myEdge[ ID_Ex11 - ID_Ex00 ].myNodes[ 0 ] = myPnt[ ID_V011 - 1 ];
myEdge[ ID_Ex11 - ID_Ex00 ].myNodes[ 1 ] = myPnt[ ID_V111 - 1 ];
myEdge[ ID_E0y0 - ID_Ex00 ].myNodes[ 0 ] = myPnt[ ID_V000 - 1 ];
myEdge[ ID_E0y0 - ID_Ex00 ].myNodes[ 1 ] = myPnt[ ID_V010 - 1 ];
myEdge[ ID_E1y0 - ID_Ex00 ].myNodes[ 0 ] = myPnt[ ID_V100 - 1 ];
myEdge[ ID_E1y0 - ID_Ex00 ].myNodes[ 1 ] = myPnt[ ID_V110 - 1 ];
myEdge[ ID_E0y1 - ID_Ex00 ].myNodes[ 0 ] = myPnt[ ID_V001 - 1 ];
myEdge[ ID_E0y1 - ID_Ex00 ].myNodes[ 1 ] = myPnt[ ID_V011 - 1 ];
myEdge[ ID_E1y1 - ID_Ex00 ].myNodes[ 0 ] = myPnt[ ID_V101 - 1 ];
myEdge[ ID_E1y1 - ID_Ex00 ].myNodes[ 1 ] = myPnt[ ID_V111 - 1 ];
myEdge[ ID_E00z - ID_Ex00 ].myNodes[ 0 ] = myPnt[ ID_V000 - 1 ];
myEdge[ ID_E00z - ID_Ex00 ].myNodes[ 1 ] = myPnt[ ID_V001 - 1 ];
myEdge[ ID_E10z - ID_Ex00 ].myNodes[ 0 ] = myPnt[ ID_V100 - 1 ];
myEdge[ ID_E10z - ID_Ex00 ].myNodes[ 1 ] = myPnt[ ID_V101 - 1 ];
myEdge[ ID_E01z - ID_Ex00 ].myNodes[ 0 ] = myPnt[ ID_V010 - 1 ];
myEdge[ ID_E01z - ID_Ex00 ].myNodes[ 1 ] = myPnt[ ID_V011 - 1 ];
myEdge[ ID_E11z - ID_Ex00 ].myNodes[ 0 ] = myPnt[ ID_V110 - 1 ];
myEdge[ ID_E11z - ID_Ex00 ].myNodes[ 1 ] = myPnt[ ID_V111 - 1 ];
for ( iE = ID_Ex00; iE <= ID_E11z; ++iE )
myEdge[ iE - ID_Ex00 ].myCoordInd = GetCoordIndOnEdge( iE );
// fill faces corners
for ( iF = ID_Fxy0; iF < ID_Shell; ++iF )
{
TFace& tFace = myFace[ iF - ID_Fxy0 ];
vector< int > edgeIdVec(4, -1);
GetFaceEdgesIDs( iF, edgeIdVec );
tFace.myNodes[ 0 ] = myEdge[ edgeIdVec [ 0 ] - ID_Ex00 ].myNodes[ 1 ];
tFace.myNodes[ 1 ] = myEdge[ edgeIdVec [ 0 ] - ID_Ex00 ].myNodes[ 0 ];
tFace.myNodes[ 2 ] = myEdge[ edgeIdVec [ 1 ] - ID_Ex00 ].myNodes[ 0 ];
tFace.myNodes[ 3 ] = myEdge[ edgeIdVec [ 1 ] - ID_Ex00 ].myNodes[ 1 ];
tFace.myCoordInd[ 0 ] = GetCoordIndOnEdge( edgeIdVec[ 0 ] );
tFace.myCoordInd[ 1 ] = GetCoordIndOnEdge( edgeIdVec[ 1 ] );
tFace.myCoordInd[ 2 ] = GetCoordIndOnEdge( edgeIdVec[ 2 ] );
tFace.myCoordInd[ 3 ] = GetCoordIndOnEdge( edgeIdVec[ 3 ] );
}
return true;
}
//======================================================================= //=======================================================================
//function : LoadBlockShapes //function : LoadBlockShapes
//purpose : add sub-shapes of theBlock to theShapeIDMap so that they get //purpose : add sub-shapes of theBlock to theShapeIDMap so that they get
@ -629,7 +845,6 @@ static int getOrderedEdges (const TopoDS_Face& theFace,
bool SMESH_Block::LoadBlockShapes(const TopoDS_Shell& theShell, bool SMESH_Block::LoadBlockShapes(const TopoDS_Shell& theShell,
const TopoDS_Vertex& theVertex000, const TopoDS_Vertex& theVertex000,
const TopoDS_Vertex& theVertex001, const TopoDS_Vertex& theVertex001,
// TopTools_IndexedMapOfShape& theShapeIDMap
TopTools_IndexedMapOfOrientedShape& theShapeIDMap ) TopTools_IndexedMapOfOrientedShape& theShapeIDMap )
{ {
MESSAGE(" ::LoadBlockShapes()"); MESSAGE(" ::LoadBlockShapes()");
@ -639,7 +854,7 @@ bool SMESH_Block::LoadBlockShapes(const TopoDS_Shell& theShell,
mySumDist = 0; mySumDist = 0;
myGridComputed = false; myGridComputed = false;
// 6 vertices // 8 vertices
TopoDS_Shape V000, V100, V010, V110, V001, V101, V011, V111; TopoDS_Shape V000, V100, V010, V110, V001, V101, V011, V111;
// 12 edges // 12 edges
TopoDS_Shape Ex00, Ex10, Ex01, Ex11; TopoDS_Shape Ex00, Ex10, Ex01, Ex11;
@ -976,6 +1191,7 @@ bool SMESH_Block::LoadBlockShapes(const TopoDS_Shell& theShell,
void SMESH_Block::GetFaceEdgesIDs (const int faceID, vector< int >& edgeVec ) void SMESH_Block::GetFaceEdgesIDs (const int faceID, vector< int >& edgeVec )
{ {
edgeVec.resize( 4 );
switch ( faceID ) { switch ( faceID ) {
case ID_Fxy0: case ID_Fxy0:
edgeVec[ 0 ] = ID_Ex00; edgeVec[ 0 ] = ID_Ex00;
@ -1017,3 +1233,69 @@ void SMESH_Block::GetFaceEdgesIDs (const int faceID, vector< int >& edgeVec )
MESSAGE(" GetFaceEdgesIDs(), wrong face ID: " << faceID ); MESSAGE(" GetFaceEdgesIDs(), wrong face ID: " << faceID );
} }
} }
//=======================================================================
//function : GetEdgeVertexIDs
//purpose : return vertex IDs of an edge
//=======================================================================
void SMESH_Block::GetEdgeVertexIDs (const int edgeID, vector< int >& vertexVec )
{
vertexVec.resize( 2 );
switch ( edgeID ) {
case ID_Ex00:
vertexVec[ 0 ] = ID_V000;
vertexVec[ 1 ] = ID_V100;
break;
case ID_Ex10:
vertexVec[ 0 ] = ID_V010;
vertexVec[ 1 ] = ID_V110;
break;
case ID_Ex01:
vertexVec[ 0 ] = ID_V001;
vertexVec[ 1 ] = ID_V101;
break;
case ID_Ex11:
vertexVec[ 0 ] = ID_V011;
vertexVec[ 1 ] = ID_V111;
break;
case ID_E0y0:
vertexVec[ 0 ] = ID_V000;
vertexVec[ 1 ] = ID_V010;
break;
case ID_E1y0:
vertexVec[ 0 ] = ID_V100;
vertexVec[ 1 ] = ID_V110;
break;
case ID_E0y1:
vertexVec[ 0 ] = ID_V001;
vertexVec[ 1 ] = ID_V011;
break;
case ID_E1y1:
vertexVec[ 0 ] = ID_V101;
vertexVec[ 1 ] = ID_V111;
break;
case ID_E00z:
vertexVec[ 0 ] = ID_V000;
vertexVec[ 1 ] = ID_V001;
break;
case ID_E10z:
vertexVec[ 0 ] = ID_V100;
vertexVec[ 1 ] = ID_V101;
break;
case ID_E01z:
vertexVec[ 0 ] = ID_V010;
vertexVec[ 1 ] = ID_V011;
break;
case ID_E11z:
vertexVec[ 0 ] = ID_V110;
vertexVec[ 1 ] = ID_V111;
break;
default:
MESSAGE(" GetEdgeVertexIDs(), wrong edge ID: " << edgeID );
}
}

View File

@ -44,6 +44,9 @@
#include <ostream> #include <ostream>
#include <vector> #include <vector>
class SMDS_MeshVolume;
class SMDS_MeshNode;
// ========================================================= // =========================================================
// class calculating coordinates of 3D points by normalized // class calculating coordinates of 3D points by normalized
// parameters inside the block and vice versa // parameters inside the block and vice versa
@ -85,6 +88,13 @@ class SMESH_Block: public math_FunctionSetWithDerivatives
// add sub-shapes of theBlock to theShapeIDMap so that they get // add sub-shapes of theBlock to theShapeIDMap so that they get
// IDs acoording to enum TShapeID // IDs acoording to enum TShapeID
bool LoadMeshBlock(const SMDS_MeshVolume* theVolume,
const int theNode000Index,
const int theNode001Index,
vector<const SMDS_MeshNode*>& theOrderedNodes);
// prepare to work with theVolume and
// return nodes in the order of TShapeID enum
static int GetShapeIDByParams ( const gp_XYZ& theParams ); static int GetShapeIDByParams ( const gp_XYZ& theParams );
// define an id of the block sub-shape by point parameters // define an id of the block sub-shape by point parameters
@ -117,6 +127,9 @@ class SMESH_Block: public math_FunctionSetWithDerivatives
static void GetFaceEdgesIDs (const int faceID, vector< int >& edgeVec ); static void GetFaceEdgesIDs (const int faceID, vector< int >& edgeVec );
// return edges IDs of a face in the order u0, u1, 0v, 1v // return edges IDs of a face in the order u0, u1, 0v, 1v
static void GetEdgeVertexIDs (const int edgeID, vector< int >& vertexVec );
// return vertex IDs of an edge
static int GetCoordIndOnEdge (const int theEdgeID) static int GetCoordIndOnEdge (const int theEdgeID)
{ return (theEdgeID < ID_E0y0) ? 1 : (theEdgeID < ID_E00z) ? 2 : 3; } { return (theEdgeID < ID_E0y0) ? 1 : (theEdgeID < ID_E00z) ? 2 : 3; }
// return an index of a coordinate which varies along the edge // return an index of a coordinate which varies along the edge
@ -161,6 +174,8 @@ class SMESH_Block: public math_FunctionSetWithDerivatives
gp_Trsf myTrsf; gp_Trsf myTrsf;
double GetU( const gp_XYZ& theParams ) const; double GetU( const gp_XYZ& theParams ) const;
gp_XYZ Point( const gp_XYZ& theParams ) const; gp_XYZ Point( const gp_XYZ& theParams ) const;
// if mesh volume
gp_XYZ myNodes[2];
}; };
struct TFace { struct TFace {
@ -178,10 +193,13 @@ class SMESH_Block: public math_FunctionSetWithDerivatives
gp_XYZ Point( const gp_XYZ& theParams ) const; gp_XYZ Point( const gp_XYZ& theParams ) const;
int GetUInd() const { return myCoordInd[ 0 ]; } int GetUInd() const { return myCoordInd[ 0 ]; }
int GetVInd() const { return myCoordInd[ 2 ]; } int GetVInd() const { return myCoordInd[ 2 ]; }
void GetCoefs( int i, const gp_XYZ& theParams, double& eCoef, double& vCoef ) const;
// if mesh volume
gp_XYZ myNodes[4];
}; };
TopoDS_Shell myShell; TopoDS_Shell myShell;
// geometry: // geometry in the order as in TShapeID:
// 8 vertices // 8 vertices
gp_XYZ myPnt[ 8 ]; gp_XYZ myPnt[ 8 ];
// 12 edges // 12 edges

View File

@ -631,11 +631,15 @@ throw(SALOME_Exception)
*/ */
//============================================================================= //=============================================================================
void SMESH_Mesh::ExportMED(const char *file, const char* theMeshName, bool theAutoGroups) throw(SALOME_Exception) void SMESH_Mesh::ExportMED(const char *file,
const char* theMeshName,
bool theAutoGroups,
int theVersion)
throw(SALOME_Exception)
{ {
Unexpect aCatch(SalomeException); Unexpect aCatch(SalomeException);
DriverMED_W_SMESHDS_Mesh myWriter; DriverMED_W_SMESHDS_Mesh myWriter;
myWriter.SetFile ( file ); myWriter.SetFile ( file, MED::EVersion(theVersion) );
myWriter.SetMesh ( _myMeshDS ); myWriter.SetMesh ( _myMeshDS );
if ( !theMeshName ) if ( !theMeshName )
myWriter.SetMeshId ( _idDoc ); myWriter.SetMeshId ( _idDoc );

View File

@ -136,8 +136,13 @@ public:
// return list of ancestors of theSubShape in the order // return list of ancestors of theSubShape in the order
// that lower dimention shapes come first. // that lower dimention shapes come first.
void ExportMED(const char *file,
const char* theMeshName = NULL,
bool theAutoGroups = true,
int theVersion = 0)
throw(SALOME_Exception);
void ExportDAT(const char *file) throw(SALOME_Exception); void ExportDAT(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);
void ExportSTL(const char *file, const bool isascii) throw(SALOME_Exception); void ExportSTL(const char *file, const bool isascii) throw(SALOME_Exception);

File diff suppressed because it is too large Load Diff

View File

@ -41,6 +41,7 @@ class SMDS_MeshFace;
class SMDS_MeshNode; class SMDS_MeshNode;
class gp_Ax1; class gp_Ax1;
class gp_Vec; class gp_Vec;
class gp_Pnt;
class SMESH_MeshEditor { class SMESH_MeshEditor {
public: public:
@ -121,18 +122,28 @@ class SMESH_MeshEditor {
// Generate new elements by extrusion of theElements // Generate new elements by extrusion of theElements
// by theStep by theNbSteps // by theStep by theNbSteps
int ExtrusionAlongTrack (std::set<const SMDS_MeshElement*> & theElements,
SMESH_subMesh* theTrackPattern,
const SMDS_MeshNode* theNodeStart,
const bool theHasAngles,
std::list<double>& theAngles,
const bool theHasRefPoint,
const gp_Pnt& theRefPoint);
// Generate new elements by extrusion of theElements along path given by theTrackPattern,
// theHasAngles are the rotation angles, base point can be given by theRefPoint
void Transform (std::set<const SMDS_MeshElement*> & theElements, void Transform (std::set<const SMDS_MeshElement*> & theElements,
const gp_Trsf& theTrsf, const gp_Trsf& theTrsf,
const bool theCopy); const bool theCopy);
// Move or copy theElements applying theTrsf to their nodes // Move or copy theElements applying theTrsf to their nodes
typedef std::list< std::list< const SMDS_MeshNode* > > TListOfListOfNodes; typedef std::list< std::list< const SMDS_MeshNode* > > TListOfListOfNodes;
void FindCoincidentNodes (const double theTolerance, void FindCoincidentNodes (std::set<const SMDS_MeshNode*> & theNodes,
const double theTolerance,
TListOfListOfNodes & theGroupsOfNodes); TListOfListOfNodes & theGroupsOfNodes);
// Return list of group of nodes close to each other within theTolerance // Return list of group of nodes close to each other within theTolerance.
// Search among theNodes or in the whole mesh if theNodes is empty.
void MergeNodes (TListOfListOfNodes & theNodeGroups); void MergeNodes (TListOfListOfNodes & theNodeGroups);
// In each group, the cdr of nodes are substituted by the first one // In each group, the cdr of nodes are substituted by the first one
@ -221,6 +232,19 @@ class SMESH_MeshEditor {
// Set 8 nodes of a hexahedron in a good order. // Set 8 nodes of a hexahedron in a good order.
// Return success status // Return success status
static void AddToSameGroups (const SMDS_MeshElement* elemToAdd,
const SMDS_MeshElement* elemInGroups,
SMESHDS_Mesh * aMesh);
// Add elemToAdd to the groups the elemInGroups belongs to
static const SMDS_MeshElement*
FindFaceInSet(const SMDS_MeshNode* n1,
const SMDS_MeshNode* n2,
const std::set<const SMDS_MeshElement*>& elemSet,
const std::set<const SMDS_MeshElement*>& avoidSet);
// Return a face having linked nodes n1 and n2 and which is
// - not in avoidSet,
// - in elemSet provided that !elemSet.empty()
int FindShape (const SMDS_MeshElement * theElem); int FindShape (const SMDS_MeshElement * theElem);
// Return an index of the shape theElem is on // Return an index of the shape theElem is on

View File

@ -23,11 +23,16 @@
#include "SMESH_Pattern.hxx" #include "SMESH_Pattern.hxx"
#include <Bnd_Box2d.hxx>
#include <BRepTools.hxx> #include <BRepTools.hxx>
#include <BRepTools_WireExplorer.hxx> #include <BRepTools_WireExplorer.hxx>
#include <BRep_Tool.hxx> #include <BRep_Tool.hxx>
#include <Bnd_Box.hxx>
#include <Bnd_Box2d.hxx>
#include <ElSLib.hxx>
#include <Extrema_GenExtPS.hxx>
#include <Extrema_POnSurf.hxx>
#include <Geom2d_Curve.hxx> #include <Geom2d_Curve.hxx>
#include <GeomAdaptor_Surface.hxx>
#include <Geom_Curve.hxx> #include <Geom_Curve.hxx>
#include <Geom_Surface.hxx> #include <Geom_Surface.hxx>
#include <IntAna2d_AnaIntersection.hxx> #include <IntAna2d_AnaIntersection.hxx>
@ -41,23 +46,24 @@
#include <TopoDS_Shell.hxx> #include <TopoDS_Shell.hxx>
#include <TopoDS_Vertex.hxx> #include <TopoDS_Vertex.hxx>
#include <TopoDS_Wire.hxx> #include <TopoDS_Wire.hxx>
#include <gp_Ax2.hxx>
#include <gp_Lin2d.hxx> #include <gp_Lin2d.hxx>
#include <gp_Pnt2d.hxx> #include <gp_Pnt2d.hxx>
#include <gp_Trsf.hxx> #include <gp_Trsf.hxx>
#include <gp_XY.hxx> #include <gp_XY.hxx>
#include <gp_XYZ.hxx> #include <gp_XYZ.hxx>
#include <Extrema_GenExtPS.hxx>
#include <Extrema_POnSurf.hxx>
#include <GeomAdaptor_Surface.hxx>
#include "SMDS_EdgePosition.hxx" #include "SMDS_EdgePosition.hxx"
#include "SMDS_FacePosition.hxx" #include "SMDS_FacePosition.hxx"
#include "SMDS_MeshElement.hxx" #include "SMDS_MeshElement.hxx"
#include "SMDS_MeshFace.hxx"
#include "SMDS_MeshNode.hxx" #include "SMDS_MeshNode.hxx"
#include "SMESHDS_Group.hxx"
#include "SMESHDS_Mesh.hxx" #include "SMESHDS_Mesh.hxx"
#include "SMESHDS_SubMesh.hxx" #include "SMESHDS_SubMesh.hxx"
#include "SMESH_Mesh.hxx"
#include "SMESH_Block.hxx" #include "SMESH_Block.hxx"
#include "SMESH_Mesh.hxx"
#include "SMESH_MeshEditor.hxx"
#include "SMESH_subMesh.hxx" #include "SMESH_subMesh.hxx"
#include "utilities.h" #include "utilities.h"
@ -401,9 +407,6 @@ template<typename T> struct TSizeCmp {
template<typename T> void sortBySize( list< list < T > > & theListOfList ) template<typename T> void sortBySize( list< list < T > > & theListOfList )
{ {
if ( theListOfList.size() > 2 ) { if ( theListOfList.size() > 2 ) {
// keep the car
//list < T > & aFront = theListOfList.front();
// sort the whole list
TSizeCmp< T > SizeCmp; TSizeCmp< T > SizeCmp;
theListOfList.sort( SizeCmp ); theListOfList.sort( SizeCmp );
} }
@ -599,7 +602,7 @@ bool SMESH_Pattern::Load (SMESH_Mesh* theMesh,
if ( nIdIt == nodePointIDMap.end() ) if ( nIdIt == nodePointIDMap.end() )
{ {
elemPoints.push_back( iPoint ); elemPoints.push_back( iPoint );
nodePointIDMap.insert( TNodePointIDMap::value_type( node, iPoint++ )); nodePointIDMap.insert( make_pair( node, iPoint++ ));
} }
else else
elemPoints.push_back( (*nIdIt).second ); elemPoints.push_back( (*nIdIt).second );
@ -684,7 +687,7 @@ bool SMESH_Pattern::Load (SMESH_Mesh* theMesh,
myKeyPointIDs.push_back( iPoint ); myKeyPointIDs.push_back( iPoint );
SMDS_NodeIteratorPtr nIt = vSubMesh->GetNodes(); SMDS_NodeIteratorPtr nIt = vSubMesh->GetNodes();
const SMDS_MeshNode* node = nIt->next(); const SMDS_MeshNode* node = nIt->next();
nodePointIDMap.insert( TNodePointIDMap::value_type( node, iPoint )); nodePointIDMap.insert( make_pair( node, iPoint ));
TPoint* keyPoint = &myPoints[ iPoint++ ]; TPoint* keyPoint = &myPoints[ iPoint++ ];
vPoint.push_back( keyPoint ); vPoint.push_back( keyPoint );
@ -724,7 +727,7 @@ bool SMESH_Pattern::Load (SMESH_Mesh* theMesh,
TPoint* p = & myPoints[ iPoint ]; TPoint* p = & myPoints[ iPoint ];
ePoints.push_back( p ); ePoints.push_back( p );
const SMDS_MeshNode* node = isForward ? (*unIt).second : (*unRIt).second; const SMDS_MeshNode* node = isForward ? (*unIt).second : (*unRIt).second;
nodePointIDMap.insert ( TNodePointIDMap::value_type( node, iPoint )); nodePointIDMap.insert ( make_pair( node, iPoint ));
if ( theProject ) if ( theProject )
p->myInitUV = project( node, projector ); p->myInitUV = project( node, projector );
@ -748,7 +751,7 @@ bool SMESH_Pattern::Load (SMESH_Mesh* theMesh,
myKeyPointIDs.push_back( iPoint ); myKeyPointIDs.push_back( iPoint );
SMDS_NodeIteratorPtr nIt = vSubMesh->GetNodes(); SMDS_NodeIteratorPtr nIt = vSubMesh->GetNodes();
const SMDS_MeshNode* node = nIt->next(); const SMDS_MeshNode* node = nIt->next();
nodePointIDMap.insert( TNodePointIDMap::value_type( node, iPoint )); nodePointIDMap.insert( make_pair( node, iPoint ));
TPoint* keyPoint = &myPoints[ iPoint++ ]; TPoint* keyPoint = &myPoints[ iPoint++ ];
vPoint2.push_back( keyPoint ); vPoint2.push_back( keyPoint );
@ -793,7 +796,7 @@ bool SMESH_Pattern::Load (SMESH_Mesh* theMesh,
{ {
const SMDS_MeshNode* node = const SMDS_MeshNode* node =
static_cast<const SMDS_MeshNode*>( nIt->next() ); static_cast<const SMDS_MeshNode*>( nIt->next() );
nodePointIDMap.insert( TNodePointIDMap::value_type( node, iPoint )); nodePointIDMap.insert( make_pair( node, iPoint ));
TPoint* p = &myPoints[ iPoint++ ]; TPoint* p = &myPoints[ iPoint++ ];
fPoints.push_back( p ); fPoints.push_back( p );
if ( theProject ) if ( theProject )
@ -2244,7 +2247,6 @@ bool SMESH_Pattern::Apply (const TopoDS_Face& theFace,
} }
int nbVertices = myShapeIDMap.Extent(); int nbVertices = myShapeIDMap.Extent();
//int nbSeamShapes = 0; // count twice seam edge and its vertices
for ( elIt = eList.begin(); elIt != eList.end(); elIt++ ) for ( elIt = eList.begin(); elIt != eList.end(); elIt++ )
myShapeIDMap.Add( *elIt ); myShapeIDMap.Add( *elIt );
@ -2441,6 +2443,461 @@ bool SMESH_Pattern::Apply (const TopoDS_Face& theFace,
return setErrorCode( ERR_OK ); return setErrorCode( ERR_OK );
} }
//=======================================================================
//function : Apply
//purpose : Compute nodes coordinates applying
// the loaded pattern to <theFace>. The first key-point
// will be mapped into <theNodeIndexOnKeyPoint1>-th node
//=======================================================================
bool SMESH_Pattern::Apply (const SMDS_MeshFace* theFace,
const int theNodeIndexOnKeyPoint1,
const bool theReverse)
{
MESSAGE(" ::Apply(MeshFace) " );
if ( !IsLoaded() ) {
MESSAGE( "Pattern not loaded" );
return setErrorCode( ERR_APPL_NOT_LOADED );
}
// check nb of nodes
if (theFace->NbNodes() != myNbKeyPntInBoundary.front() ) {
MESSAGE( myKeyPointIDs.size() << " != " << theFace->NbNodes() );
return setErrorCode( ERR_APPL_BAD_NB_VERTICES );
}
// find points on edges, it fills myNbKeyPntInBoundary
if ( !findBoundaryPoints() )
return false;
// check that there are no holes in a pattern
if (myNbKeyPntInBoundary.size() > 1 ) {
return setErrorCode( ERR_APPL_BAD_NB_VERTICES );
}
// Define the nodes order
list< const SMDS_MeshNode* > nodes;
list< const SMDS_MeshNode* >::iterator n = nodes.end();
SMDS_ElemIteratorPtr noIt = theFace->nodesIterator();
int iSub = 0;
while ( noIt->more() ) {
const SMDS_MeshNode* node = static_cast<const SMDS_MeshNode*>( noIt->next() );
nodes.push_back( node );
if ( iSub++ == theNodeIndexOnKeyPoint1 )
n = --nodes.end();
}
if ( n != nodes.end() ) {
if ( theReverse ) {
if ( n != --nodes.end() )
nodes.splice( nodes.begin(), nodes, ++n, nodes.end() );
nodes.reverse();
}
else if ( n != nodes.begin() )
nodes.splice( nodes.end(), nodes, nodes.begin(), n );
}
list< gp_XYZ > xyzList;
myOrderedNodes.resize( theFace->NbNodes() );
for ( iSub = 0, n = nodes.begin(); n != nodes.end(); ++n ) {
xyzList.push_back( gp_XYZ( (*n)->X(), (*n)->Y(), (*n)->Z() ));
myOrderedNodes[ iSub++] = *n;
}
// Define a face plane
list< gp_XYZ >::iterator xyzIt = xyzList.begin();
gp_Pnt P ( *xyzIt++ );
gp_Vec Vx( P, *xyzIt++ ), N;
do {
N = Vx ^ gp_Vec( P, *xyzIt++ );
} while ( N.SquareMagnitude() <= DBL_MIN && xyzIt != xyzList.end() );
if ( N.SquareMagnitude() <= DBL_MIN )
return setErrorCode( ERR_APPLF_BAD_FACE_GEOM );
gp_Ax2 pos( P, N, Vx );
// Compute UV of key-points on a plane
for ( xyzIt = xyzList.begin(), iSub = 1; xyzIt != xyzList.end(); xyzIt++, iSub++ )
{
gp_Vec vec ( pos.Location(), *xyzIt );
TPoint* p = getShapePoints( iSub ).front();
p->myUV.SetX( vec * pos.XDirection() );
p->myUV.SetY( vec * pos.YDirection() );
p->myXYZ = *xyzIt;
}
// points on edges to be used for UV computation of in-face points
list< list< TPoint* > > edgesPointsList;
edgesPointsList.push_back( list< TPoint* >() );
list< TPoint* > * edgesPoints = & edgesPointsList.back();
list< TPoint* >::iterator pIt;
// compute UV and XYZ of points on edges
for ( xyzIt = xyzList.begin(); xyzIt != xyzList.end(); iSub++ )
{
gp_XYZ& xyz1 = *xyzIt++;
gp_XYZ& xyz2 = ( xyzIt != xyzList.end() ) ? *xyzIt : xyzList.front();
list< TPoint* > & ePoints = getShapePoints( iSub );
ePoints.back()->myInitU = 1.0;
list< TPoint* >::const_iterator pIt = ++ePoints.begin();
while ( *pIt != ePoints.back() )
{
TPoint* p = *pIt++;
p->myXYZ = xyz1 * ( 1 - p->myInitU ) + xyz2 * p->myInitU;
gp_Vec vec ( pos.Location(), p->myXYZ );
p->myUV.SetX( vec * pos.XDirection() );
p->myUV.SetY( vec * pos.YDirection() );
}
// collect on-edge points (excluding the last one)
edgesPoints->insert( edgesPoints->end(), ePoints.begin(), --ePoints.end());
}
// Compute UV and XYZ of in-face points
// try to use a simple algo to compute UV
list< TPoint* > & fPoints = getShapePoints( iSub );
bool isDeformed = false;
for ( pIt = fPoints.begin(); !isDeformed && pIt != fPoints.end(); pIt++ )
if ( !compUVByIsoIntersection( edgesPointsList, (*pIt)->myInitUV,
(*pIt)->myUV, isDeformed )) {
MESSAGE("cant Apply(face)");
return false;
}
// try to use a complex algo if it is a difficult case
if ( isDeformed && !compUVByElasticIsolines( edgesPointsList, fPoints ))
{
for ( ; pIt != fPoints.end(); pIt++ ) // continue with the simple algo
if ( !compUVByIsoIntersection( edgesPointsList, (*pIt)->myInitUV,
(*pIt)->myUV, isDeformed )) {
MESSAGE("cant Apply(face)");
return false;
}
}
for ( pIt = fPoints.begin(); pIt != fPoints.end(); pIt++ )
{
(*pIt)->myXYZ = ElSLib::PlaneValue( (*pIt)->myUV.X(), (*pIt)->myUV.Y(), pos );
}
myIsComputed = true;
return setErrorCode( ERR_OK );
}
//=======================================================================
//function : undefinedXYZ
//purpose :
//=======================================================================
static const gp_XYZ& undefinedXYZ()
{
static gp_XYZ xyz( 1.e100, 0., 0. );
return xyz;
}
//=======================================================================
//function : isDefined
//purpose :
//=======================================================================
inline static bool isDefined(const gp_XYZ& theXYZ)
{
return theXYZ.X() < 1.e100;
}
//=======================================================================
//function : mergePoints
//purpose : Look for coincident points between myXYZs indexed with
// list<int> of each element of xyzIndGroups. Coincident indices
// are merged in myElemXYZIDs.
//=======================================================================
void SMESH_Pattern::mergePoints (map<TNodeSet, list<list<int> > >& indGroups,
map< int, list< list< int >* > > & reverseConnectivity)
{
map< TNodeSet, list< list< int > > >::iterator indListIt;
for ( indListIt = indGroups.begin(); indListIt != indGroups.end(); indListIt++ )
{
list<list< int > > groups = indListIt->second;
if ( groups.size() < 2 )
continue;
// const TNodeSet & nodes = indListIt->first;
// TNodeSet::const_iterator n = nodes.begin();
// for ( ; n != nodes.end(); n++ )
// cout << *n ;
// find tolerance
Bnd_Box box;
list< int >& indices = groups.front();
list< int >::iterator ind, ind1, ind2;
for ( ind = indices.begin(); ind != indices.end(); ind++ )
box.Add( gp_Pnt( myXYZ[ *ind ]));
double x, y, z, X, Y, Z;
box.Get( x, y, z, X, Y, Z );
gp_Pnt p( x, y, z ), P( X, Y, Z );
double tol2 = 1.e-4 * p.SquareDistance( P );
// compare points, replace indices
list< list< int > >::iterator grpIt1, grpIt2;
for ( grpIt1 = groups.begin(); grpIt1 != groups.end(); grpIt1++ )
{
list< int >& indices1 = *grpIt1;
grpIt2 = grpIt1;
for ( grpIt2++; grpIt2 != groups.end(); grpIt2++ )
{
list< int >& indices2 = *grpIt2;
for ( ind1 = indices1.begin(); ind1 != indices1.end(); ind1++ )
{
gp_XYZ& p1 = myXYZ[ *ind1 ];
ind2 = indices2.begin();
while ( ind2 != indices2.end() )
{
gp_XYZ& p2 = myXYZ[ *ind2 ];
//MESSAGE("COMP: " << *ind1 << " " << *ind2 << " X: " << p2.X() << " tol2: " << tol2);
if ( ( p1 - p2 ).SquareModulus() <= tol2 )
{
ASSERT( reverseConnectivity.find( *ind2 ) != reverseConnectivity.end() );
list< list< int >* > & elemXYZIDsList = reverseConnectivity[ *ind2 ];
list< list< int >* >::iterator elemXYZIDs = elemXYZIDsList.begin();
for ( ; elemXYZIDs != elemXYZIDsList.end(); elemXYZIDs++ )
{
ind = find( (*elemXYZIDs)->begin(), (*elemXYZIDs)->end(), *ind2 );
//MESSAGE( " Replace " << *ind << " with " << *ind1 );
myXYZ[ *ind ] = undefinedXYZ();
*ind = *ind1;
}
ind2 = indices2.erase( ind2 );
}
else
ind2++;
}
}
}
}
}
}
//=======================================================================
//function : Apply
//purpose : Compute nodes coordinates applying
// the loaded pattern to <theFaces>. The first key-point
// will be mapped into <theNodeIndexOnKeyPoint1>-th node
//=======================================================================
bool SMESH_Pattern::Apply (std::set<const SMDS_MeshFace*> theFaces,
const int theNodeIndexOnKeyPoint1,
const bool theReverse)
{
MESSAGE(" ::Apply(set<MeshFace>) " );
if ( !IsLoaded() ) {
MESSAGE( "Pattern not loaded" );
return setErrorCode( ERR_APPL_NOT_LOADED );
}
// find points on edges, it fills myNbKeyPntInBoundary
if ( !findBoundaryPoints() )
return false;
// check that there are no holes in a pattern
if (myNbKeyPntInBoundary.size() > 1 ) {
return setErrorCode( ERR_APPL_BAD_NB_VERTICES );
}
myXYZ.clear();
myElemXYZIDs.clear();
myXYZIdToNodeMap.clear();
myElements.clear();
myXYZ.resize( myPoints.size() * theFaces.size(), undefinedXYZ() );
myElements.reserve( theFaces.size() );
// to find point index
map< TPoint*, int > pointIndex;
for ( int i = 0; i < myPoints.size(); i++ )
pointIndex.insert( make_pair( & myPoints[ i ], i ));
// to merge nodes on edges of the elements being refined
typedef set<const SMDS_MeshNode*> TLink;
map< TLink, list< list< int > > > linkPointIndListMap;
map< int, list< list< int >* > > reverseConnectivity;
int ind1 = 0; // lowest point index for a face
// apply to each face in theFaces set
set<const SMDS_MeshFace*>::iterator face = theFaces.begin();
for ( ; face != theFaces.end(); ++face )
{
if ( !Apply( *face, theNodeIndexOnKeyPoint1, theReverse )) {
MESSAGE( "Failed on " << *face );
continue;
}
myElements.push_back( *face );
// store computed points belonging to elements
list< list< int > >::iterator ll = myElemPointIDs.begin();
for ( ; ll != myElemPointIDs.end(); ++ll )
{
myElemXYZIDs.push_back();
list< int >& xyzIds = myElemXYZIDs.back();
list< int >& pIds = *ll;
for ( list<int>::iterator id = pIds.begin(); id != pIds.end(); id++ ) {
int pIndex = *id + ind1;
xyzIds.push_back( pIndex );
myXYZ[ pIndex ] = myPoints[ *id ].myXYZ.XYZ();
reverseConnectivity[ pIndex ].push_back( & xyzIds );
}
}
// put points on links to linkPointIndListMap
int nbNodes = (*face)->NbNodes(), eID = nbNodes + 1;
for ( int i = 0; i < nbNodes; i++ )
{
const SMDS_MeshNode* n1 = myOrderedNodes[ i ];
const SMDS_MeshNode* n2 = myOrderedNodes[ i + 1 == nbNodes ? 0 : i + 1 ];
// make a link of node pointers
TLink link;
link.insert( n1 );
link.insert( n2 );
// add the link to the map
list< list< int > >& groups = linkPointIndListMap[ link ];
groups.push_back();
list< int >& indList = groups.back();
list< TPoint* > & linkPoints = getShapePoints( eID++ );
list< TPoint* >::iterator p = linkPoints.begin();
// map the first link point to n1
myXYZIdToNodeMap[ pointIndex[ *p ] + ind1 ] = n1;
// add points to the map excluding the end points
for ( p++; *p != linkPoints.back(); p++ )
indList.push_back( pointIndex[ *p ] + ind1 );
}
ind1 += myPoints.size();
}
mergePoints( linkPointIndListMap, reverseConnectivity );
return !myElemXYZIDs.empty();
}
//=======================================================================
//function : Apply
//purpose : Compute nodes coordinates applying
// the loaded pattern to <theVolumes>. The (0,0,0) key-point
// will be mapped into <theNode000Index>-th node. The
// (0,0,1) key-point will be mapped into <theNode000Index>-th
// node.
//=======================================================================
bool SMESH_Pattern::Apply (std::set<const SMDS_MeshVolume*> theVolumes,
const int theNode000Index,
const int theNode001Index)
{
MESSAGE(" ::Apply(set<MeshVolumes>) " );
if ( !IsLoaded() ) {
MESSAGE( "Pattern not loaded" );
return setErrorCode( ERR_APPL_NOT_LOADED );
}
// bind ID to points
if ( !findBoundaryPoints() )
return false;
// check that there are no holes in a pattern
if (myNbKeyPntInBoundary.size() > 1 ) {
return setErrorCode( ERR_APPL_BAD_NB_VERTICES );
}
myXYZ.clear();
myElemXYZIDs.clear();
myXYZIdToNodeMap.clear();
myElements.clear();
myXYZ.resize( myPoints.size() * theVolumes.size(), undefinedXYZ() );
myElements.reserve( theVolumes.size() );
// to find point index
map< TPoint*, int > pointIndex;
for ( int i = 0; i < myPoints.size(); i++ )
pointIndex.insert( make_pair( & myPoints[ i ], i ));
// to merge nodes on edges and faces of the elements being refined
map< TNodeSet, list< list< int > > > subPointIndListMap;
map< int, list< list< int >* > > reverseConnectivity;
int ind1 = 0; // lowest point index for an element
// apply to each element in theVolumes set
set<const SMDS_MeshVolume*>::iterator vol = theVolumes.begin();
for ( ; vol != theVolumes.end(); ++vol )
{
if ( !Apply( *vol, theNode000Index, theNode001Index )) {
MESSAGE( "Failed on " << *vol );
continue;
}
myElements.push_back( *vol );
// store computed points belonging to elements
list< list< int > >::iterator ll = myElemPointIDs.begin();
for ( ; ll != myElemPointIDs.end(); ++ll )
{
myElemXYZIDs.push_back();
list< int >& xyzIds = myElemXYZIDs.back();
list< int >& pIds = *ll;
for ( list<int>::iterator id = pIds.begin(); id != pIds.end(); id++ ) {
int pIndex = *id + ind1;
xyzIds.push_back( pIndex );
myXYZ[ pIndex ] = myPoints[ *id ].myXYZ.XYZ();
reverseConnectivity[ pIndex ].push_back( & xyzIds );
}
}
// put points on edges and faces to subPointIndListMap
for ( int Id = SMESH_Block::ID_V000; Id <= SMESH_Block::ID_F1yz; Id++ )
{
// make a set of sub-points
TNodeSet subNodes;
vector< int > subIDs;
if ( SMESH_Block::IsVertexID( Id )) {
// use nodes of refined volumes for merge
}
else if ( SMESH_Block::IsEdgeID( Id )) {
SMESH_Block::GetEdgeVertexIDs( Id, subIDs );
subNodes.insert( myOrderedNodes[ subIDs.front() - 1 ]);
subNodes.insert( myOrderedNodes[ subIDs.back() - 1 ]);
}
else {
SMESH_Block::GetFaceEdgesIDs( Id, subIDs );
int e1 = subIDs[ 0 ], e2 = subIDs[ 1 ];
SMESH_Block::GetEdgeVertexIDs( e1, subIDs );
subNodes.insert( myOrderedNodes[ subIDs.front() - 1 ]);
subNodes.insert( myOrderedNodes[ subIDs.back() - 1 ]);
SMESH_Block::GetEdgeVertexIDs( e2, subIDs );
subNodes.insert( myOrderedNodes[ subIDs.front() - 1 ]);
subNodes.insert( myOrderedNodes[ subIDs.back() - 1 ]);
}
list< list< int > >& groups = subPointIndListMap[ subNodes ];
groups.push_back();
list< int >& indList = groups.back();
// add points
list< TPoint* > & points = getShapePoints( Id );
list< TPoint* >::iterator p = points.begin();
if ( subNodes.empty() ) // vertex case
myXYZIdToNodeMap[ pointIndex[ *p ] + ind1 ] = myOrderedNodes[ Id - 1 ];
else
for ( ; p != points.end(); p++ )
indList.push_back( pointIndex[ *p ] + ind1 );
}
ind1 += myPoints.size();
}
mergePoints( subPointIndListMap, reverseConnectivity );
return !myElemXYZIDs.empty();
}
//======================================================================= //=======================================================================
//function : Load //function : Load
//purpose : Create a pattern from the mesh built on <theBlock> //purpose : Create a pattern from the mesh built on <theBlock>
@ -2486,7 +2943,7 @@ bool SMESH_Pattern::Load (SMESH_Mesh* theMesh,
// store a node and a point // store a node and a point
while ( nIt->more() ) { while ( nIt->more() ) {
const SMDS_MeshNode* node = static_cast<const SMDS_MeshNode*>( nIt->next() ); const SMDS_MeshNode* node = static_cast<const SMDS_MeshNode*>( nIt->next() );
nodePointIDMap.insert( TNodePointIDMap::value_type( node, iPoint )); nodePointIDMap.insert( make_pair( node, iPoint ));
if ( block.IsVertexID( shapeID )) if ( block.IsVertexID( shapeID ))
myKeyPointIDs.push_back( iPoint ); myKeyPointIDs.push_back( iPoint );
TPoint* p = & myPoints[ iPoint++ ]; TPoint* p = & myPoints[ iPoint++ ];
@ -2620,6 +3077,56 @@ bool SMESH_Pattern::Apply (const TopoDS_Shell& theBlock,
return setErrorCode( ERR_OK ); return setErrorCode( ERR_OK );
} }
//=======================================================================
//function : Apply
//purpose : Compute nodes coordinates applying
// the loaded pattern to <theVolume>. The (0,0,0) key-point
// will be mapped into <theNode000Index>-th node. The
// (0,0,1) key-point will be mapped into <theNode000Index>-th
// node.
//=======================================================================
bool SMESH_Pattern::Apply (const SMDS_MeshVolume* theVolume,
const int theNode000Index,
const int theNode001Index)
{
MESSAGE(" ::Apply(MeshVolume) " );
if (!findBoundaryPoints()) // bind ID to points
return false;
SMESH_Block block; // bind ID to shape
if (!block.LoadMeshBlock( theVolume, theNode000Index, theNode001Index, myOrderedNodes ))
return setErrorCode( ERR_APPLV_BAD_SHAPE );
// compute XYZ of points on shapes
for ( int ID = SMESH_Block::ID_V000; ID <= SMESH_Block::ID_Shell; ID++ )
{
list< TPoint* > & shapePoints = getShapePoints( ID );
list< TPoint* >::iterator pIt = shapePoints.begin();
if ( block.IsVertexID( ID ))
for ( ; pIt != shapePoints.end(); pIt++ ) {
block.VertexPoint( ID, (*pIt)->myXYZ.ChangeCoord() );
}
else if ( block.IsEdgeID( ID ))
for ( ; pIt != shapePoints.end(); pIt++ ) {
block.EdgePoint( ID, (*pIt)->myInitXYZ, (*pIt)->myXYZ.ChangeCoord() );
}
else if ( block.IsFaceID( ID ))
for ( ; pIt != shapePoints.end(); pIt++ ) {
block.FacePoint( ID, (*pIt)->myInitXYZ, (*pIt)->myXYZ.ChangeCoord() );
}
else
for ( ; pIt != shapePoints.end(); pIt++ )
block.ShellPoint( (*pIt)->myInitXYZ, (*pIt)->myXYZ.ChangeCoord() );
} // loop on block sub-shapes
myIsComputed = true;
return setErrorCode( ERR_OK );
}
//======================================================================= //=======================================================================
//function : MakeMesh //function : MakeMesh
//purpose : Create nodes and elements in <theMesh> using nodes //purpose : Create nodes and elements in <theMesh> using nodes
@ -2633,8 +3140,12 @@ bool SMESH_Pattern::MakeMesh(SMESH_Mesh* theMesh)
return setErrorCode( ERR_MAKEM_NOT_COMPUTED ); return setErrorCode( ERR_MAKEM_NOT_COMPUTED );
SMESHDS_Mesh* aMeshDS = theMesh->GetMeshDS(); SMESHDS_Mesh* aMeshDS = theMesh->GetMeshDS();
SMESH_MeshEditor editor( theMesh );
// clear elements and nodes existing on myShape // clear elements and nodes existing on myShape
if ( !myShape.IsNull() )
{
SMESH_subMesh * aSubMesh = theMesh->GetSubMeshContaining( myShape ); SMESH_subMesh * aSubMesh = theMesh->GetSubMeshContaining( myShape );
SMESHDS_SubMesh * aSubMeshDS = aMeshDS->MeshElements( myShape ); SMESHDS_SubMesh * aSubMeshDS = aMeshDS->MeshElements( myShape );
if ( aSubMesh ) if ( aSubMesh )
@ -2648,17 +3159,39 @@ bool SMESH_Pattern::MakeMesh(SMESH_Mesh* theMesh)
while ( nIt->more() ) while ( nIt->more() )
aMeshDS->RemoveNode( static_cast<const SMDS_MeshNode*>( nIt->next() )); aMeshDS->RemoveNode( static_cast<const SMDS_MeshNode*>( nIt->next() ));
} }
}
bool onMeshElements = ( !myElements.empty() );
// loop on sub-shapes of myShape: create nodes and build point-node map // loop on sub-shapes of myShape: create nodes and build point-node map
typedef map< TPoint*, const SMDS_MeshNode* > TPointNodeMap;
TPointNodeMap pointNodeMap; vector< const SMDS_MeshNode* > nodesVector;
map< TPoint*, const SMDS_MeshNode* > pointNodeMap;
if ( onMeshElements )
{
nodesVector.resize( myXYZ.size() );
for ( int i = 0; i < myXYZ.size(); ++i ) {
map< int, const SMDS_MeshNode*>::iterator idNode = myXYZIdToNodeMap.find( i );
if ( idNode != myXYZIdToNodeMap.end() )
nodesVector[ i ] = idNode->second;
else if ( isDefined( myXYZ[ i ] ))
nodesVector[ i ] = aMeshDS->AddNode (myXYZ[ i ].X(),
myXYZ[ i ].Y(),
myXYZ[ i ].Z());
}
}
else
{
map< int, list< TPoint* > >::iterator idPointIt = myShapeIDToPointsMap.begin(); map< int, list< TPoint* > >::iterator idPointIt = myShapeIDToPointsMap.begin();
for ( ; idPointIt != myShapeIDToPointsMap.end(); idPointIt++ ) for ( ; idPointIt != myShapeIDToPointsMap.end(); idPointIt++ )
{ {
const TopoDS_Shape & S = myShapeIDMap( (*idPointIt).first ); TopoDS_Shape S;
list< TPoint* > & points = (*idPointIt).second; SMESHDS_SubMesh * subMeshDS = 0;
SMESHDS_SubMesh * subMeshDS = aMeshDS->MeshElements( S ); if ( !myShapeIDMap.IsEmpty() ) {
SMESH_subMesh * subMesh = theMesh->GetSubMeshContaining( myShape ); S = myShapeIDMap( idPointIt->first );
subMeshDS = aMeshDS->MeshElements( S );
}
list< TPoint* > & points = idPointIt->second;
list< TPoint* >::iterator pIt = points.begin(); list< TPoint* >::iterator pIt = points.begin();
for ( ; pIt != points.end(); pIt++ ) for ( ; pIt != points.end(); pIt++ )
{ {
@ -2668,7 +3201,7 @@ bool SMESH_Pattern::MakeMesh(SMESH_Mesh* theMesh)
SMDS_MeshNode* node = aMeshDS->AddNode (point->myXYZ.X(), SMDS_MeshNode* node = aMeshDS->AddNode (point->myXYZ.X(),
point->myXYZ.Y(), point->myXYZ.Y(),
point->myXYZ.Z()); point->myXYZ.Z());
pointNodeMap.insert( TPointNodeMap::value_type( point, node )); pointNodeMap.insert( make_pair( point, node ));
if ( subMeshDS ) { if ( subMeshDS ) {
switch ( S.ShapeType() ) { switch ( S.ShapeType() ) {
case TopAbs_VERTEX: { case TopAbs_VERTEX: {
@ -2695,16 +3228,42 @@ bool SMESH_Pattern::MakeMesh(SMESH_Mesh* theMesh)
} }
} }
} }
// make that SMESH_subMesh::_computeState = COMPUTE_OK }
// so that operations with hypotheses will erase the mesh
// being built
if ( subMesh )
subMesh->ComputeStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE );
} }
// create elements // create elements
list<list< int > >::iterator epIt = myElemPointIDs.begin();
for ( ; epIt != myElemPointIDs.end(); epIt++ ) // shapes and groups myElements are on
vector< int > shapeIDs;
vector< list< SMESHDS_Group* > > groups;
if ( onMeshElements )
{
shapeIDs.resize( myElements.size() );
groups.resize( myElements.size() );
const set<SMESHDS_GroupBase*>& allGroups = aMeshDS->GetGroups();
set<SMESHDS_GroupBase*>::const_iterator grIt;
for ( int i = 0; i < myElements.size(); i++ )
{
shapeIDs[ i ] = editor.FindShape( myElements[ i ] );
for ( grIt = allGroups.begin(); grIt != allGroups.end(); grIt++ ) {
SMESHDS_Group* group = dynamic_cast<SMESHDS_Group*>( *grIt );
if ( group && group->SMDSGroup().Contains( myElements[ i ] ))
groups[ i ].push_back( group );
}
}
}
int nbElems = myElemPointIDs.size(); // nb elements in a pattern
list<list< int > >::iterator epIt, epEnd;
if ( onMeshElements ) {
epIt = myElemXYZIDs.begin();
epEnd = myElemXYZIDs.end();
}
else {
epIt = myElemPointIDs.begin();
epEnd = myElemPointIDs.end();
}
for ( int iElem = 0; epIt != epEnd; epIt++, iElem++ )
{ {
list< int > & elemPoints = *epIt; list< int > & elemPoints = *epIt;
// retrieve nodes // retrieve nodes
@ -2712,6 +3271,9 @@ bool SMESH_Pattern::MakeMesh(SMESH_Mesh* theMesh)
list< int >::iterator iIt = elemPoints.begin(); list< int >::iterator iIt = elemPoints.begin();
int nbNodes; int nbNodes;
for ( nbNodes = 0; iIt != elemPoints.end(); iIt++ ) { for ( nbNodes = 0; iIt != elemPoints.end(); iIt++ ) {
if ( onMeshElements )
nodes[ nbNodes++ ] = nodesVector[ *iIt ];
else
nodes[ nbNodes++ ] = pointNodeMap[ & myPoints[ *iIt ]]; nodes[ nbNodes++ ] = pointNodeMap[ & myPoints[ *iIt ]];
} }
// add an element // add an element
@ -2722,7 +3284,8 @@ bool SMESH_Pattern::MakeMesh(SMESH_Mesh* theMesh)
elem = aMeshDS->AddFace( nodes[0], nodes[1], nodes[2] ); break; elem = aMeshDS->AddFace( nodes[0], nodes[1], nodes[2] ); break;
case 4: case 4:
elem = aMeshDS->AddFace( nodes[0], nodes[1], nodes[2], nodes[3] ); break; elem = aMeshDS->AddFace( nodes[0], nodes[1], nodes[2], nodes[3] ); break;
default:; default:
ASSERT( nbNodes < 8 );
} }
} }
else { else {
@ -2738,13 +3301,51 @@ bool SMESH_Pattern::MakeMesh(SMESH_Mesh* theMesh)
case 8: case 8:
elem = aMeshDS->AddVolume (nodes[0], nodes[1], nodes[2], nodes[3], elem = aMeshDS->AddVolume (nodes[0], nodes[1], nodes[2], nodes[3],
nodes[4], nodes[5], nodes[6], nodes[7] ); break; nodes[4], nodes[5], nodes[6], nodes[7] ); break;
default:; default:
ASSERT( nbNodes < 8 );
} }
} }
if ( elem ) // set element on a shape
if ( elem && onMeshElements )
{
int elemIndex = iElem / nbElems;
if ( shapeIDs[ elemIndex ] > 0 )
aMeshDS->SetMeshElementOnShape( elem, shapeIDs[ elemIndex ] );
// add elem in groups
list< SMESHDS_Group* >::iterator g = groups[ elemIndex ].begin();
for ( ; g != groups[ elemIndex ].end(); ++g )
(*g)->SMDSGroup().Add( elem );
}
if ( elem && !myShape.IsNull() )
aMeshDS->SetMeshElementOnShape( elem, myShape ); aMeshDS->SetMeshElementOnShape( elem, myShape );
} }
// make that SMESH_subMesh::_computeState = COMPUTE_OK
// so that operations with hypotheses will erase the mesh being built
SMESH_subMesh * subMesh;
if ( !myShape.IsNull() ) {
subMesh = theMesh->GetSubMeshContaining( myShape );
if ( subMesh )
subMesh->ComputeStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE );
}
if ( onMeshElements ) {
list< int > elemIDs;
for ( int i = 0; i < myElements.size(); i++ )
{
int shapeID = shapeIDs[ i ];
if ( shapeID > 0 ) {
TopoDS_Shape S = aMeshDS->IndexToShape( shapeID );
subMesh = theMesh->GetSubMeshContaining( S );
if ( subMesh )
subMesh->ComputeStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE );
}
elemIDs.push_back( myElements[ i ]->GetID() );
}
// remove refined elements and their nodes
editor.Remove( elemIDs, false );
}
return setErrorCode( ERR_OK ); return setErrorCode( ERR_OK );
} }
@ -3026,6 +3627,7 @@ bool SMESH_Pattern::findBoundaryPoints()
double edgeLength = 0; double edgeLength = 0;
list< TPoint* >::iterator pIt = boundary->begin(); list< TPoint* >::iterator pIt = boundary->begin();
getShapePoints( edgeID ).push_back( *pIt ); getShapePoints( edgeID ).push_back( *pIt );
getShapePoints( vertexID++ ).push_back( *pIt );
for ( pIt++; pIt != boundary->end(); pIt++) for ( pIt++; pIt != boundary->end(); pIt++)
{ {
list< TPoint* > & edgePoints = getShapePoints( edgeID ); list< TPoint* > & edgePoints = getShapePoints( edgeID );
@ -3050,10 +3652,11 @@ bool SMESH_Pattern::findBoundaryPoints()
} }
// begin the next edge treatment // begin the next edge treatment
edgeLength = 0; edgeLength = 0;
getShapePoints( vertexID++ ).push_back( point );
edgeID++; edgeID++;
if ( point != boundary->front() ) if ( point != boundary->front() ) { // not the first key-point again
getShapePoints( edgeID ).push_back( point ); getShapePoints( edgeID ).push_back( point );
getShapePoints( vertexID++ ).push_back( point );
}
} }
} }
} }
@ -3153,17 +3756,23 @@ bool SMESH_Pattern::setShapeToMesh(const TopoDS_Shape& theShape)
//purpose : Return nodes coordinates computed by Apply() method //purpose : Return nodes coordinates computed by Apply() method
//======================================================================= //=======================================================================
bool SMESH_Pattern::GetMappedPoints ( list< const gp_XYZ * > & thePoints ) bool SMESH_Pattern::GetMappedPoints ( list< const gp_XYZ * > & thePoints ) const
{ {
thePoints.clear(); thePoints.clear();
if ( !myIsComputed ) if ( !myIsComputed )
return false; return false;
vector< TPoint >::iterator pVecIt = myPoints.begin(); if ( myElements.empty() ) { // applied to shape
vector< TPoint >::const_iterator pVecIt = myPoints.begin();
for ( ; pVecIt != myPoints.end(); pVecIt++ ) for ( ; pVecIt != myPoints.end(); pVecIt++ )
thePoints.push_back( & (*pVecIt).myXYZ.XYZ() ); thePoints.push_back( & (*pVecIt).myXYZ.XYZ() );
}
return ( thePoints.size() > 0 ); else { // applied to mesh elements
vector<gp_XYZ>::const_iterator xyz = myXYZ.begin();
for ( ; xyz != myXYZ.end(); ++xyz )
thePoints.push_back( & (*xyz) );
}
return !thePoints.empty();
} }

View File

@ -27,6 +27,7 @@
#include <vector> #include <vector>
#include <list> #include <list>
#include <map> #include <map>
#include <set>
#include <iostream> #include <iostream>
#include <TopoDS_Shape.hxx> #include <TopoDS_Shape.hxx>
@ -35,6 +36,10 @@
#include <gp_XY.hxx> #include <gp_XY.hxx>
#include <gp_Pnt.hxx> #include <gp_Pnt.hxx>
class SMDS_MeshElement;
class SMDS_MeshFace;
class SMDS_MeshVolume;
class SMDS_MeshNode;
class SMESH_Mesh; class SMESH_Mesh;
class TopoDS_Shell; class TopoDS_Shell;
class TopoDS_Vertex; class TopoDS_Vertex;
@ -56,7 +61,7 @@ class SMESH_Pattern {
// clear fields // clear fields
bool Load (const char* theFileContents); bool Load (const char* theFileContents);
// Load a pattern from <theFile> // Load a pattern from <theFileContents>
bool Load (SMESH_Mesh* theMesh, bool Load (SMESH_Mesh* theMesh,
const TopoDS_Face& theFace, const TopoDS_Face& theFace,
@ -88,7 +93,39 @@ class SMESH_Pattern {
// will be mapped into <theVertex000>. The // will be mapped into <theVertex000>. The
// (0,0,1) key-point will be mapped into <theVertex001>. // (0,0,1) key-point will be mapped into <theVertex001>.
bool GetMappedPoints ( std::list<const gp_XYZ *> & thePoints ); bool Apply (const SMDS_MeshFace* theFace,
const int theNodeIndexOnKeyPoint1,
const bool theReverse);
// Compute nodes coordinates applying
// the loaded pattern to <theFace>. The first key-point
// will be mapped into <theNodeIndexOnKeyPoint1>-th node
bool Apply (std::set<const SMDS_MeshFace*> theFaces,
const int theNodeIndexOnKeyPoint1,
const bool theReverse);
// Compute nodes coordinates applying
// the loaded pattern to <theFaces>. The first key-point
// will be mapped into <theNodeIndexOnKeyPoint1>-th node
bool Apply (const SMDS_MeshVolume* theVolume,
const int theNode000Index,
const int theNode001Index);
// Compute nodes coordinates applying
// the loaded pattern to <theVolume>. The (0,0,0) key-point
// will be mapped into <theNode000Index>-th node. The
// (0,0,1) key-point will be mapped into <theNode000Index>-th
// node.
bool Apply (std::set<const SMDS_MeshVolume*> theVolumes,
const int theNode000Index,
const int theNode001Index);
// Compute nodes coordinates applying
// the loaded pattern to <theVolumes>. The (0,0,0) key-point
// will be mapped into <theNode000Index>-th node. The
// (0,0,1) key-point will be mapped into <theNode000Index>-th
// node.
bool GetMappedPoints ( std::list<const gp_XYZ *> & thePoints ) const;
// Return nodes coordinates computed by Apply() method // Return nodes coordinates computed by Apply() method
bool MakeMesh(SMESH_Mesh* theMesh); bool MakeMesh(SMESH_Mesh* theMesh);
@ -131,6 +168,8 @@ class SMESH_Pattern {
ERR_APPLF_INTERNAL_EEROR, // program error ERR_APPLF_INTERNAL_EEROR, // program error
// Apply(volume) // Apply(volume)
ERR_APPLV_BAD_SHAPE, // volume is not a brick of 6 faces ERR_APPLV_BAD_SHAPE, // volume is not a brick of 6 faces
// Apply(mesh_face)
ERR_APPLF_BAD_FACE_GEOM, // bad face geometry
// MakeMesh // MakeMesh
ERR_MAKEM_NOT_COMPUTED // mapping failed ERR_MAKEM_NOT_COMPUTED // mapping failed
}; };
@ -152,7 +191,7 @@ class SMESH_Pattern {
// GetPoints() and GetMappedPoints() // GetPoints() and GetMappedPoints()
const std::list< std::list< int > >& GetElementPointIDs () const const std::list< std::list< int > >& GetElementPointIDs () const
{ return myElemPointIDs; } { return myElemXYZIDs.empty() ? myElemPointIDs : myElemXYZIDs; }
// Return nodal connectivity of the elements of the pattern // Return nodal connectivity of the elements of the pattern
void DumpPoints() const; void DumpPoints() const;
@ -231,6 +270,13 @@ class SMESH_Pattern {
// in a good order, point UVs on edges are computed and points // in a good order, point UVs on edges are computed and points
// are appended to theEdgesPointsList // are appended to theEdgesPointsList
typedef std::set<const SMDS_MeshNode*> TNodeSet;
void mergePoints (std::map<TNodeSet,std::list<std::list<int> > >& xyzIndGroups,
std::map< int, std::list< std::list< int >* > >& reverseConnectivity);
// Look for coincident points between myXYZs indexed with
// list<int> of each element of xyzIndGroups. Coincident indices
// are merged in myElemXYZIDs using reverseConnectivity.
private: private:
// fields // fields
@ -245,12 +291,21 @@ class SMESH_Pattern {
TopoDS_Shape myShape; TopoDS_Shape myShape;
// all functions assure that shapes are indexed so that first go // all functions assure that shapes are indexed so that first go
// ordered vertices, then ordered edge, then faces and a shell // ordered vertices, then ordered edge, then faces and maybe a shell
TopTools_IndexedMapOfOrientedShape myShapeIDMap; TopTools_IndexedMapOfOrientedShape myShapeIDMap;
//TopTools_IndexedMapOfShape myShapeIDMap; //TopTools_IndexedMapOfShape myShapeIDMap;
std::map< int, list< TPoint* > > myShapeIDToPointsMap; std::map< int, list< TPoint* > > myShapeIDToPointsMap;
std::list< int > myNbKeyPntInBoundary; //for the 2d case // for the 2d case:
// nb of key-points in each of pattern boundaries
std::list< int > myNbKeyPntInBoundary;
// to compute while applying to mesh elements, not to shapes
std::vector<gp_XYZ> myXYZ;
std::list< std::list< int > > myElemXYZIDs;
std::map< int, const SMDS_MeshNode*> myXYZIdToNodeMap; // map id to node of a refined element
std::vector<const SMDS_MeshElement*> myElements; // refined elements
std::vector<const SMDS_MeshNode*> myOrderedNodes;
}; };

View File

@ -42,6 +42,7 @@
#include <TopoDS_Face.hxx> #include <TopoDS_Face.hxx>
#include <TopoDS_Vertex.hxx> #include <TopoDS_Vertex.hxx>
#include <TopoDS_Edge.hxx> #include <TopoDS_Edge.hxx>
#include <map>
//Not portable see http://gcc.gnu.org/onlinedocs/libstdc++/faq/index.html#5_4 to know more. //Not portable see http://gcc.gnu.org/onlinedocs/libstdc++/faq/index.html#5_4 to know more.
#ifdef __GNUC__ #ifdef __GNUC__
@ -178,12 +179,12 @@ public:
bool HasMeshElements(const TopoDS_Shape & S); bool HasMeshElements(const TopoDS_Shape & S);
SMESHDS_SubMesh * MeshElements(const TopoDS_Shape & S); SMESHDS_SubMesh * MeshElements(const TopoDS_Shape & S);
SMESHDS_SubMesh * MeshElements(const int Index); SMESHDS_SubMesh * MeshElements(const int Index);
list<int> SubMeshIndices(); std::list<int> SubMeshIndices();
const std::map<int,SMESHDS_SubMesh*>& SubMeshes() const std::map<int,SMESHDS_SubMesh*>& SubMeshes()
{ return myShapeIndexToSubMesh; } { return myShapeIndexToSubMesh; }
bool HasHypothesis(const TopoDS_Shape & S); bool HasHypothesis(const TopoDS_Shape & S);
const list<const SMESHDS_Hypothesis*>& GetHypothesis(const TopoDS_Shape & S) const; const std::list<const SMESHDS_Hypothesis*>& GetHypothesis(const TopoDS_Shape & S) const;
SMESHDS_Script * GetScript(); SMESHDS_Script * GetScript();
void ClearScript(); void ClearScript();
int ShapeToIndex(const TopoDS_Shape & aShape); int ShapeToIndex(const TopoDS_Shape & aShape);
@ -200,7 +201,7 @@ public:
void AddGroup (SMESHDS_GroupBase* theGroup) { myGroups.insert(theGroup); } void AddGroup (SMESHDS_GroupBase* theGroup) { myGroups.insert(theGroup); }
void RemoveGroup (SMESHDS_GroupBase* theGroup) { myGroups.erase(theGroup); } void RemoveGroup (SMESHDS_GroupBase* theGroup) { myGroups.erase(theGroup); }
int GetNbGroups() const { return myGroups.size(); } int GetNbGroups() const { return myGroups.size(); }
const set<SMESHDS_GroupBase*>& GetGroups() const { return myGroups; } const std::set<SMESHDS_GroupBase*>& GetGroups() const { return myGroups; }
bool IsGroupOfSubShapes (const TopoDS_Shape& aSubShape) const; bool IsGroupOfSubShapes (const TopoDS_Shape& aSubShape) const;
@ -219,8 +220,8 @@ private:
int myMeshID; int myMeshID;
TopoDS_Shape myShape; TopoDS_Shape myShape;
TopTools_IndexedMapOfShape myIndexToShape; TopTools_IndexedMapOfShape myIndexToShape;
map<int,SMESHDS_SubMesh*> myShapeIndexToSubMesh; std::map<int,SMESHDS_SubMesh*> myShapeIndexToSubMesh;
set<SMESHDS_GroupBase*> myGroups; std::set<SMESHDS_GroupBase*> myGroups;
SMESHDS_Script* myScript; SMESHDS_Script* myScript;
}; };

View File

@ -88,6 +88,7 @@ LIB_SRC = SMESHGUI.cxx \
SMESHGUI_SmoothingDlg.cxx \ SMESHGUI_SmoothingDlg.cxx \
SMESHGUI_RenumberingDlg.cxx \ SMESHGUI_RenumberingDlg.cxx \
SMESHGUI_ExtrusionDlg.cxx \ SMESHGUI_ExtrusionDlg.cxx \
SMESHGUI_ExtrusionAlongPathDlg.cxx \
SMESHGUI_RevolutionDlg.cxx \ SMESHGUI_RevolutionDlg.cxx \
SMESHGUI_RotationDlg.cxx \ SMESHGUI_RotationDlg.cxx \
SMESHGUI_TranslationDlg.cxx \ SMESHGUI_TranslationDlg.cxx \
@ -138,6 +139,7 @@ LIB_MOC = \
SMESHGUI_SmoothingDlg.h \ SMESHGUI_SmoothingDlg.h \
SMESHGUI_RenumberingDlg.h \ SMESHGUI_RenumberingDlg.h \
SMESHGUI_ExtrusionDlg.h \ SMESHGUI_ExtrusionDlg.h \
SMESHGUI_ExtrusionAlongPathDlg.h \
SMESHGUI_RevolutionDlg.h \ SMESHGUI_RevolutionDlg.h \
SMESHGUI_RotationDlg.h \ SMESHGUI_RotationDlg.h \
SMESHGUI_TranslationDlg.h \ SMESHGUI_TranslationDlg.h \
@ -169,7 +171,7 @@ LIB_SERVER_IDL =
#BIN = SMESHBin #BIN = SMESHBin
CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) \ 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 \ -I${KERNEL_ROOT_DIR}/include/salome -I${GEOM_ROOT_DIR}/include/salome \
$(BOOST_CPPFLAGS) $(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

View File

@ -53,6 +53,7 @@
#include "SMESHGUI_SmoothingDlg.h" #include "SMESHGUI_SmoothingDlg.h"
#include "SMESHGUI_RenumberingDlg.h" #include "SMESHGUI_RenumberingDlg.h"
#include "SMESHGUI_ExtrusionDlg.h" #include "SMESHGUI_ExtrusionDlg.h"
#include "SMESHGUI_ExtrusionAlongPathDlg.h"
#include "SMESHGUI_RevolutionDlg.h" #include "SMESHGUI_RevolutionDlg.h"
#include "SMESHGUI_TranslationDlg.h" #include "SMESHGUI_TranslationDlg.h"
#include "SMESHGUI_RotationDlg.h" #include "SMESHGUI_RotationDlg.h"
@ -140,7 +141,9 @@ namespace{
void ExportMeshToFile(QAD_Desktop * parent, int theCommandID); void ExportMeshToFile(QAD_Desktop * parent, int theCommandID);
void SetViewMode(int theCommandID); void SetDisplayMode(int theCommandID);
void SetDisplayEntity(int theCommandID);
void Control( int theCommandID ); void Control( int theCommandID );
@ -153,15 +156,16 @@ namespace{
SMESH::SMESH_Gen_ptr theComponentMesh, SMESH::SMESH_Gen_ptr theComponentMesh,
int theCommandID) int theCommandID)
{ {
QString filter; QStringList filter;
string myExtension; string myExtension;
if(theCommandID == 113){ if(theCommandID == 113){
filter = QObject::tr("MED files (*.med)"); filter.append(QObject::tr("MED files (*.med)"));
filter.append(QObject::tr("All files (*)"));
}else if (theCommandID == 112){ }else if (theCommandID == 112){
filter = QObject::tr("IDEAS files (*.unv)"); filter.append(QObject::tr("IDEAS files (*.unv)"));
}else if (theCommandID == 111){ }else if (theCommandID == 111){
filter = QObject::tr("DAT files (*.dat)"); filter.append(QObject::tr("DAT files (*.dat)"));
} }
QString filename = QAD_FileDlg::getFileName(parent, QString filename = QAD_FileDlg::getFileName(parent,
"", "",
@ -237,9 +241,11 @@ namespace{
SMESH::SMESH_Mesh_var aMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(anIObject); SMESH::SMESH_Mesh_var aMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(anIObject);
if ( !aMesh->_is_nil() ) { if ( !aMesh->_is_nil() ) {
QString aFilter, aTitle = QObject::tr("Export mesh"); QString aFilter, aTitle = QObject::tr("Export mesh");
QMap<QString, SMESH::MED_VERSION> aFilterMap;
switch ( theCommandID ) { switch ( theCommandID ) {
case 122: case 122:
aFilter = QObject::tr("MED files (*.med)"); aFilterMap.insert( QObject::tr("MED 2.1 (*.med)"), SMESH::MED_V2_1 );
aFilterMap.insert( QObject::tr("MED 2.2 (*.med)"), SMESH::MED_V2_2 );
break; break;
case 121: case 121:
aFilter = QObject::tr("DAT files (*.dat)"); aFilter = QObject::tr("DAT files (*.dat)");
@ -261,7 +267,25 @@ namespace{
return; return;
}} }}
QString aFilename = QAD_FileDlg::getFileName(parent, "", aFilter, aTitle, false); QString aFilename;
SMESH::MED_VERSION aFormat;
if ( theCommandID != 122)
aFilename = QAD_FileDlg::getFileName(parent, "", aFilter, aTitle, false);
else
{
QStringList filters;
for ( QMap<QString, SMESH::MED_VERSION>::const_iterator it = aFilterMap.begin(); it != aFilterMap.end(); ++it )
filters.push_back( it.key() );
QAD_FileDlg* fd = new QAD_FileDlg( parent, false, true, true );
fd->setCaption( aTitle );
fd->setFilters( filters );
fd->exec();
aFilename = fd->selectedFile();
aFormat = aFilterMap[fd->selectedFilter()];
delete fd;
}
if ( !aFilename.isEmpty() ) { if ( !aFilename.isEmpty() ) {
// Check whether the file already exists and delete it if yes // Check whether the file already exists and delete it if yes
QFile aFile( aFilename ); QFile aFile( aFilename );
@ -270,7 +294,7 @@ namespace{
QAD_WaitCursor wc; QAD_WaitCursor wc;
switch ( theCommandID ) { switch ( theCommandID ) {
case 122: case 122:
aMesh->ExportMED( aFilename.latin1(), true ); // currently, automatic groups are always created aMesh->ExportToMED( aFilename.latin1(), false, aFormat ); // currently, automatic groups are never created
break; break;
case 121: case 121:
aMesh->ExportDAT( aFilename.latin1() ); aMesh->ExportDAT( aFilename.latin1() );
@ -286,19 +310,58 @@ namespace{
} }
} }
void SetViewMode(int theCommandID){ inline void InverseEntityMode(unsigned int& theOutputMode,
unsigned int theMode)
{
bool anIsNotPresent = ~theOutputMode & theMode;
if(anIsNotPresent)
theOutputMode |= theMode;
else
theOutputMode &= ~theMode;
}
void SetDisplayEntity(int theCommandID){
SALOME_Selection *Sel = SALOME_Selection::Selection(SMESH::GetActiveStudy()->getSelection());
if(Sel->IObjectCount() >= 1){
SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
for(; It.More(); It.Next()){
Handle(SALOME_InteractiveObject) IObject = It.Value();
if(IObject->hasEntry()){
if(SMESH_Actor *anActor = SMESH::FindActorByEntry(IObject->getEntry())){
unsigned int aMode = anActor->GetEntityMode();
switch(theCommandID){
case 217:
InverseEntityMode(aMode,SMESH_Actor::eEdges);
break;
case 218:
InverseEntityMode(aMode,SMESH_Actor::eFaces);
break;
case 219:
InverseEntityMode(aMode,SMESH_Actor::eVolumes);
break;
case 220:
aMode = SMESH_Actor::eAllEntity;
break;
}
if(aMode)
anActor->SetEntityMode(aMode);
}
}
}
}
}
void SetDisplayMode(int theCommandID){
SALOME_Selection *Sel = SALOME_Selection::Selection(SMESH::GetActiveStudy()->getSelection()); SALOME_Selection *Sel = SALOME_Selection::Selection(SMESH::GetActiveStudy()->getSelection());
if(Sel->IObjectCount() >= 1){ if(Sel->IObjectCount() >= 1){
switch(theCommandID){ switch(theCommandID){
case 1134:{ case 1134:{
SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog(); SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog();
SMESHGUI_ClippingDlg *aDlg =
new SMESHGUI_ClippingDlg(QAD_Application::getDesktop(),"",false); new SMESHGUI_ClippingDlg(QAD_Application::getDesktop(),"",false);
return; return;
} }
case 1133:{ case 1133:{
SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog(); SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog();
SMESHGUI_TransparencyDlg *aDlg =
new SMESHGUI_TransparencyDlg(QAD_Application::getDesktop(),"",false); new SMESHGUI_TransparencyDlg(QAD_Application::getDesktop(),"",false);
return; return;
}} }}
@ -504,7 +567,11 @@ namespace{
switch ( theCommandID ){ switch ( theCommandID ){
case 6001: case 6001:
aTitle = QObject::tr( "LENGTH_EDGES" ); aTitle = QObject::tr( "LENGTH_EDGES" );
aControl = SMESH_Actor::eLengthEdges; aControl = SMESH_Actor::eLength;
break;
case 6018:
aTitle = QObject::tr( "LENGTH2D_EDGES" );
aControl = SMESH_Actor::eLength2D;
break; break;
case 6002: case 6002:
aTitle = QObject::tr( "FREE_EDGES" ); aTitle = QObject::tr( "FREE_EDGES" );
@ -518,6 +585,10 @@ namespace{
aTitle = QObject::tr( "MULTI_BORDERS" ); aTitle = QObject::tr( "MULTI_BORDERS" );
aControl = SMESH_Actor::eMultiConnection; aControl = SMESH_Actor::eMultiConnection;
break; break;
case 6019:
aTitle = QObject::tr( "MULTI2D_BORDERS" );
aControl = SMESH_Actor::eMultiConnection2D;
break;
case 6011: case 6011:
aTitle = QObject::tr( "AREA_ELEMENTS" ); aTitle = QObject::tr( "AREA_ELEMENTS" );
aControl = SMESH_Actor::eArea; aControl = SMESH_Actor::eArea;
@ -530,6 +601,10 @@ namespace{
aTitle = QObject::tr( "ASPECTRATIO_ELEMENTS" ); aTitle = QObject::tr( "ASPECTRATIO_ELEMENTS" );
aControl = SMESH_Actor::eAspectRatio; aControl = SMESH_Actor::eAspectRatio;
break; break;
case 6017:
aTitle = QObject::tr( "ASPECTRATIO_3D_ELEMENTS" );
aControl = SMESH_Actor::eAspectRatio3D;
break;
case 6014: case 6014:
aTitle = QObject::tr( "MINIMUMANGLE_ELEMENTS" ); aTitle = QObject::tr( "MINIMUMANGLE_ELEMENTS" );
aControl = SMESH_Actor::eMinimumAngle; aControl = SMESH_Actor::eMinimumAngle;
@ -1029,14 +1104,22 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
case 1134: // Clipping case 1134: // Clipping
case 1133: // Tranparency case 1133: // Tranparency
case 1132: // Colors / Size case 1132: // Colors / Size
case 215:
case 213: // Display Mode
case 212: case 215: // Nodes
case 211: case 213: // Nodes
{ case 212: // Nodes
::SetViewMode(theCommandID); case 211: // Nodes
::SetDisplayMode(theCommandID);
break;
// Display Entity
case 217: // Edges
case 218: // Faces
case 219: // Volumes
case 220: // All Entity
::SetDisplayEntity(theCommandID);
break; break;
}
case 214: // UPDATE case 214: // UPDATE
{ {
@ -1076,7 +1159,7 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
EmitSignalDeactivateDialog(); EmitSignalDeactivateDialog();
SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection()); SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
SMESHGUI_NodesDlg *aDlg = new SMESHGUI_NodesDlg(parent, "", Sel); new SMESHGUI_NodesDlg(parent, "", Sel);
} }
else { else {
QAD_MessageBox::warn1(QAD_Application::getDesktop(), QAD_MessageBox::warn1(QAD_Application::getDesktop(),
@ -1092,7 +1175,7 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
if ( myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) if ( myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK )
{ {
EmitSignalDeactivateDialog(); EmitSignalDeactivateDialog();
SMESHGUI_FilterDlg *aDlg = new SMESHGUI_FilterDlg( parent, SMESH::EDGE ); new SMESHGUI_FilterDlg( parent, SMESH::EDGE );
} }
break; break;
} }
@ -1108,7 +1191,7 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
if(checkLock(aStudy)) break; if(checkLock(aStudy)) break;
SALOME_Selection *Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() ); SALOME_Selection *Sel = SALOME_Selection::Selection( myActiveStudy->getSelection() );
SMESHGUI_MoveNodesDlg *aDlg = new SMESHGUI_MoveNodesDlg( parent, Sel ); new SMESHGUI_MoveNodesDlg( parent, Sel );
break; break;
} }
@ -1216,7 +1299,7 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
EmitSignalDeactivateDialog(); EmitSignalDeactivateDialog();
SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection()); SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
SMESHGUI_AddSubMeshDlg *aDlg = new SMESHGUI_AddSubMeshDlg(parent, "", Sel); new SMESHGUI_AddSubMeshDlg(parent, "", Sel);
} }
else { else {
QAD_MessageBox::warn1(QAD_Application::getDesktop(), QAD_MessageBox::warn1(QAD_Application::getDesktop(),
@ -1231,7 +1314,7 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
if(checkLock(aStudy)) break; if(checkLock(aStudy)) break;
EmitSignalDeactivateDialog(); EmitSignalDeactivateDialog();
SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection()); SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
SMESHGUI_InitMeshDlg *aDlg = new SMESHGUI_InitMeshDlg(parent, "", Sel); new SMESHGUI_InitMeshDlg(parent, "", Sel);
break; break;
} }
@ -1240,7 +1323,7 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
if(checkLock(aStudy)) break; if(checkLock(aStudy)) break;
EmitSignalDeactivateDialog(); EmitSignalDeactivateDialog();
SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection()); SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
SMESHGUI_EditHypothesesDlg *aDlg = new SMESHGUI_EditHypothesesDlg(parent, "", Sel); new SMESHGUI_EditHypothesesDlg(parent, "", Sel);
break; break;
} }
@ -1249,7 +1332,7 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
if(checkLock(aStudy)) break; if(checkLock(aStudy)) break;
EmitSignalDeactivateDialog(); EmitSignalDeactivateDialog();
SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection()); SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
SMESHGUI_EditHypothesesDlg *aDlg = new SMESHGUI_EditHypothesesDlg(parent, "", Sel); new SMESHGUI_EditHypothesesDlg(parent, "", Sel);
break; break;
} }
@ -1258,7 +1341,7 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
if(checkLock(aStudy)) break; if(checkLock(aStudy)) break;
EmitSignalDeactivateDialog(); EmitSignalDeactivateDialog();
SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection()); SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
SMESHGUI_EditHypothesesDlg *aDlg = new SMESHGUI_EditHypothesesDlg(parent, "", Sel); new SMESHGUI_EditHypothesesDlg(parent, "", Sel);
break; break;
} }
@ -1331,7 +1414,7 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
EmitSignalDeactivateDialog(); EmitSignalDeactivateDialog();
SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection()); SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
SMESHGUI_SmoothingDlg *aDlg = new SMESHGUI_SmoothingDlg(parent, "", Sel); new SMESHGUI_SmoothingDlg(parent, "", Sel);
} }
else { else {
QAD_MessageBox::warn1(QAD_Application::getDesktop(), QAD_MessageBox::warn1(QAD_Application::getDesktop(),
@ -1346,7 +1429,7 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
EmitSignalDeactivateDialog(); EmitSignalDeactivateDialog();
SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection()); SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
SMESHGUI_ExtrusionDlg *aDlg = new SMESHGUI_ExtrusionDlg(parent, "", Sel); new SMESHGUI_ExtrusionDlg(parent, "", Sel);
} }
else { else {
QAD_MessageBox::warn1(QAD_Application::getDesktop(), QAD_MessageBox::warn1(QAD_Application::getDesktop(),
@ -1361,7 +1444,7 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
EmitSignalDeactivateDialog(); EmitSignalDeactivateDialog();
SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection()); SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
SMESHGUI_RevolutionDlg *aDlg = new SMESHGUI_RevolutionDlg(parent, "", Sel); new SMESHGUI_RevolutionDlg(parent, "", Sel);
} }
else { else {
QAD_MessageBox::warn1(QAD_Application::getDesktop(), QAD_MessageBox::warn1(QAD_Application::getDesktop(),
@ -1388,6 +1471,21 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
} }
break; break;
} }
case 416: // Extrusion along a path
{
if(checkLock(aStudy)) break;
if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
EmitSignalDeactivateDialog();
SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
new SMESHGUI_ExtrusionAlongPathDlg(parent, Sel);
}
else {
QAD_MessageBox::warn1(QAD_Application::getDesktop(),
tr("SMESH_WRN_WARNING"), tr("SMESH_WRN_VIEWER_VTK"),
tr("SMESH_BUT_OK"));
}
break;
}
case 801: // CREATE GROUP case 801: // CREATE GROUP
{ {
if(checkLock(aStudy)) break; if(checkLock(aStudy)) break;
@ -1544,7 +1642,7 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
for ( ; It.More(); It.Next() ) { for ( ; It.More(); It.Next() ) {
Sel->ClearIObjects(); Sel->ClearIObjects();
Sel->AddIObject( It.Value() ); Sel->AddIObject( It.Value() );
SMESHGUI_MeshInfosDlg *aDlg = new SMESHGUI_MeshInfosDlg(parent, "", false); new SMESHGUI_MeshInfosDlg(parent, "", false);
} }
// restore selection // restore selection
Sel->ClearIObjects(); Sel->ClearIObjects();
@ -1552,7 +1650,7 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
Sel->AddIObject( It.Value() ); Sel->AddIObject( It.Value() );
} }
else else
SMESHGUI_MeshInfosDlg *aDlg = new SMESHGUI_MeshInfosDlg(parent, "", false); new SMESHGUI_MeshInfosDlg(parent, "", false);
break; break;
} }
@ -1567,7 +1665,7 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
for ( ; It.More(); It.Next() ) { for ( ; It.More(); It.Next() ) {
Sel->ClearIObjects(); Sel->ClearIObjects();
Sel->AddIObject( It.Value() ); Sel->AddIObject( It.Value() );
SMESHGUI_StandardMeshInfosDlg *aDlg = new SMESHGUI_StandardMeshInfosDlg(parent, "", false); new SMESHGUI_StandardMeshInfosDlg(parent, "", false);
} }
// restore selection // restore selection
Sel->ClearIObjects(); Sel->ClearIObjects();
@ -1575,7 +1673,7 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
Sel->AddIObject( It.Value() ); Sel->AddIObject( It.Value() );
} }
else else
SMESHGUI_StandardMeshInfosDlg *aDlg = new SMESHGUI_StandardMeshInfosDlg(parent, "", false); new SMESHGUI_StandardMeshInfosDlg(parent, "", false);
break; break;
} }
@ -1605,12 +1703,23 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
break; break;
} }
case 1007: case 10070:
{ {
( new SMESHGUI_PrecisionDlg( parent ) )->exec(); ( new SMESHGUI_PrecisionDlg( parent ) )->exec();
break; break;
} }
case 10071:
{
parent->menuBar()->setItemChecked(10071, !parent->menuBar()->isItemChecked(10071));
if (parent->menuBar()->isItemChecked(10071)) {
QAD_CONFIG->addSetting("SMESH:DispayEntity","true");
}
else {
QAD_CONFIG->addSetting("SMESH:DispayEntity","false");
}
break;
}
case 1006: case 1006:
{ {
SMESHGUI_Preferences_SelectionDlg* aDlg = SMESHGUI_Preferences_SelectionDlg* aDlg =
@ -1825,7 +1934,6 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
type = SMDSAbs_Volume; nbNodes = 8; break; type = SMDSAbs_Volume; nbNodes = 8; break;
default:; default:;
} }
SMESHGUI_AddMeshElementDlg *aDlg =
new SMESHGUI_AddMeshElementDlg(parent, "", Sel, type, nbNodes); new SMESHGUI_AddMeshElementDlg(parent, "", Sel, type, nbNodes);
} }
else { else {
@ -1842,7 +1950,7 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
EmitSignalDeactivateDialog(); EmitSignalDeactivateDialog();
SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection()); SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
SMESHGUI_RemoveNodesDlg *aDlg = new SMESHGUI_RemoveNodesDlg(parent, "", Sel); new SMESHGUI_RemoveNodesDlg(parent, "", Sel);
} }
else { else {
QAD_MessageBox::warn1(QAD_Application::getDesktop(), QAD_MessageBox::warn1(QAD_Application::getDesktop(),
@ -1857,7 +1965,7 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
EmitSignalDeactivateDialog(); EmitSignalDeactivateDialog();
SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection()); SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
SMESHGUI_RemoveElementsDlg *aDlg = new SMESHGUI_RemoveElementsDlg(parent, "", Sel); new SMESHGUI_RemoveElementsDlg(parent, "", Sel);
} }
else else
{ {
@ -1873,7 +1981,7 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
EmitSignalDeactivateDialog(); EmitSignalDeactivateDialog();
SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection()); SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
SMESHGUI_RenumberingDlg *aDlg = new SMESHGUI_RenumberingDlg(parent, "", Sel, 0); new SMESHGUI_RenumberingDlg(parent, "", Sel, 0);
} }
else else
{ {
@ -1889,7 +1997,7 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
EmitSignalDeactivateDialog(); EmitSignalDeactivateDialog();
SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection()); SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
SMESHGUI_RenumberingDlg *aDlg = new SMESHGUI_RenumberingDlg(parent, "", Sel, 1); new SMESHGUI_RenumberingDlg(parent, "", Sel, 1);
} }
else else
{ {
@ -1905,7 +2013,7 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
EmitSignalDeactivateDialog(); EmitSignalDeactivateDialog();
SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection()); SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
SMESHGUI_TranslationDlg *aDlg = new SMESHGUI_TranslationDlg(parent, "", Sel); new SMESHGUI_TranslationDlg(parent, "", Sel);
} }
else { else {
QAD_MessageBox::warn1(QAD_Application::getDesktop(), QAD_MessageBox::warn1(QAD_Application::getDesktop(),
@ -1920,7 +2028,7 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
EmitSignalDeactivateDialog(); EmitSignalDeactivateDialog();
SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection()); SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
SMESHGUI_RotationDlg *aDlg = new SMESHGUI_RotationDlg(parent, "", Sel); new SMESHGUI_RotationDlg(parent, "", Sel);
} }
else { else {
QAD_MessageBox::warn1(QAD_Application::getDesktop(), QAD_MessageBox::warn1(QAD_Application::getDesktop(),
@ -1935,7 +2043,7 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
EmitSignalDeactivateDialog(); EmitSignalDeactivateDialog();
SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection()); SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
SMESHGUI_SymmetryDlg *aDlg = new SMESHGUI_SymmetryDlg(parent, "", Sel); new SMESHGUI_SymmetryDlg(parent, "", Sel);
} }
else { else {
QAD_MessageBox::warn1(QAD_Application::getDesktop(), QAD_MessageBox::warn1(QAD_Application::getDesktop(),
@ -1950,7 +2058,7 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
EmitSignalDeactivateDialog(); EmitSignalDeactivateDialog();
SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection()); SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
SMESHGUI_SewingDlg *aDlg = new SMESHGUI_SewingDlg(parent, "", Sel); new SMESHGUI_SewingDlg(parent, "", Sel);
} }
else { else {
QAD_MessageBox::warn1(QAD_Application::getDesktop(), QAD_MessageBox::warn1(QAD_Application::getDesktop(),
@ -1965,7 +2073,7 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { if (myActiveStudy->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
EmitSignalDeactivateDialog(); EmitSignalDeactivateDialog();
SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection()); SALOME_Selection *Sel = SALOME_Selection::Selection(myActiveStudy->getSelection());
SMESHGUI_MergeNodesDlg *aDlg = new SMESHGUI_MergeNodesDlg(parent, "", Sel); new SMESHGUI_MergeNodesDlg(parent, "", Sel);
} }
else { else {
QAD_MessageBox::warn1(QAD_Application::getDesktop(), QAD_MessageBox::warn1(QAD_Application::getDesktop(),
@ -1980,7 +2088,6 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
{ {
if(checkLock(aStudy)) break; if(checkLock(aStudy)) break;
EmitSignalDeactivateDialog(); EmitSignalDeactivateDialog();
SMESHGUI_CreateHypothesesDlg *aDlg =
new SMESHGUI_CreateHypothesesDlg (parent, "", FALSE, false); new SMESHGUI_CreateHypothesesDlg (parent, "", FALSE, false);
break; break;
} }
@ -1988,7 +2095,6 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
{ {
if(checkLock(aStudy)) break; if(checkLock(aStudy)) break;
EmitSignalDeactivateDialog(); EmitSignalDeactivateDialog();
SMESHGUI_CreateHypothesesDlg *aDlg =
new SMESHGUI_CreateHypothesesDlg (parent, "", FALSE, true); new SMESHGUI_CreateHypothesesDlg (parent, "", FALSE, true);
break; break;
} }
@ -2007,13 +2113,16 @@ bool SMESHGUI::OnGUIEvent(int theCommandID, QAD_Desktop * parent)
} }
break; break;
case 6016: // CONTROLS case 6017: // CONTROLS
case 6016:
case 6015: case 6015:
case 6014: case 6014:
case 6013: case 6013:
case 6012: case 6012:
case 6011: case 6011:
case 6001: case 6001:
case 6018:
case 6019:
case 6002: case 6002:
case 6003: case 6003:
case 6004: case 6004:
@ -2198,6 +2307,12 @@ bool SMESHGUI::SetSettings(QAD_Desktop * parent)
myAutomaticUpdate = false; myAutomaticUpdate = false;
} }
QString anIsDisplayEntity = QAD_CONFIG->getSetting("SMESH:DispayEntity");
if(anIsDisplayEntity.compare("true") == 0)
parent->menuBar()->setItemChecked(10071,true);
else
parent->menuBar()->setItemChecked(10071,false);
/* Selection */ /* Selection */
SMESH::UpdateSelectionProp(); SMESH::UpdateSelectionProp();
@ -2316,29 +2431,30 @@ bool SMESHGUI::CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QString
if ( !aGeomGroup->_is_nil() ) // group linked on geometry if ( !aGeomGroup->_is_nil() ) // group linked on geometry
popup->removeItem( 803 ); // EDIT GROUP popup->removeItem( 803 ); // EDIT GROUP
SMESH_Actor* ac = SMESH::FindActorByEntry(IObject->getEntry()); SMESH_Actor* anActor = SMESH::FindActorByEntry(IObject->getEntry());
// if object has actor // if object has actor
if ( ac && studyFrame->getTypeView() == VIEW_VTK ) { if ( anActor && studyFrame->getTypeView() == VIEW_VTK ) {
VTKViewer_RenderWindowInteractor* myRenderInter = SMESH::GetCurrentVtkView()->getRWInteractor(); VTKViewer_RenderWindowInteractor* myRenderInter = SMESH::GetCurrentVtkView()->getRWInteractor();
if ( myRenderInter->isVisible( IObject ) ) { if ( myRenderInter->isVisible( IObject ) ) {
popup->removeItem( QAD_Display_Popup_ID ); popup->removeItem( QAD_Display_Popup_ID );
popup->setItemChecked( 9010, ac->GetPointsLabeled() ); // Numbering / Display Nodes # popup->setItemChecked( 9010, anActor->GetPointsLabeled() ); // Numbering / Display Nodes #
popup->setItemChecked( 9011, ac->GetCellsLabeled() ); // Numbering / Display Elements # popup->setItemChecked( 9011, anActor->GetCellsLabeled() ); // Numbering / Display Elements #
TVisualObjPtr aVisualObj = ac->GetObject(); TVisualObjPtr aVisualObj = anActor->GetObject();
int aNbEdges = aVisualObj->GetNbEntities(SMESH::EDGE); int aNbEdges = aVisualObj->GetNbEntities(SMDSAbs_Edge);
int aNbFaces = aVisualObj->GetNbEntities(SMESH::FACE); int aNbFaces = aVisualObj->GetNbEntities(SMDSAbs_Face);
int aNbVolumes = aVisualObj->GetNbEntities(SMESH::VOLUME); int aNbVolumes = aVisualObj->GetNbEntities(SMDSAbs_Volume);
QMenuItem* mi = popup->findItem( 1131 ); QMenuItem* mi = popup->findItem( 1131 );
if ( mi && mi->popup() ) { if ( mi && mi->popup() ) {
int prType = ac->GetRepresentation(); int prType = anActor->GetRepresentation();
// Display Mode / Wireframe // Display Mode / Wireframe
if(!aNbFaces && !aNbVolumes && !aNbEdges){ if(aNbVolumes == 0 && aNbFaces == 0 && aNbEdges == 0){
mi->popup()->removeItem( 211 ); mi->popup()->removeItem( 211 );
}else{ }else{
mi->popup()->setItemChecked( 211, prType == SMESH_Actor::eEdge ); mi->popup()->setItemChecked( 211, prType == SMESH_Actor::eEdge );
} }
// Display Mode / Shading // Display Mode / Shading
if(!aNbFaces && !aNbVolumes){ if(aNbFaces == 0 && aNbVolumes == 0){
mi->popup()->removeItem( 212 ); mi->popup()->removeItem( 212 );
}else{ }else{
mi->popup()->setItemChecked( 212, prType == SMESH_Actor::eSurface ); mi->popup()->setItemChecked( 212, prType == SMESH_Actor::eSurface );
@ -2346,18 +2462,62 @@ bool SMESHGUI::CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QString
// Display Mode / Points // Display Mode / Points
mi->popup()->setItemChecked( 215, prType == SMESH_Actor::ePoint ); mi->popup()->setItemChecked( 215, prType == SMESH_Actor::ePoint );
// Display Mode / Shrink // Display Mode / Shrink
bool isShrunk = ac->IsShrunk(); bool isShrunk = anActor->IsShrunk();
bool isShrunkable = ac->IsShrunkable(); bool isShrunkable = anActor->IsShrunkable();
mi->popup()->setItemChecked( 213, isShrunk ); mi->popup()->setItemChecked( 213, isShrunk );
mi->popup()->setItemEnabled( 213, prType != SMESH_Actor::ePoint && isShrunkable); mi->popup()->setItemEnabled( 213, prType != SMESH_Actor::ePoint && isShrunkable);
} }
// Scalar Bar
// Display Entity
mi = popup->findItem( 1135 );
int aIsSomething=0;
if (aNbVolumes>0) aIsSomething++;
if (aNbFaces>0) aIsSomething++;
if (aNbEdges>0) aIsSomething++;
if ( mi && (aIsSomething <= 1)){
popup->removeItem(1135);
}else if ( mi && mi->popup() ) {
QPopupMenu* aPopup = mi->popup();
unsigned int aMode = anActor->GetEntityMode();
bool aIsVolumesMode = aMode & SMESH_Actor::eVolumes;
bool aIsFacesMode = aMode & SMESH_Actor::eFaces;
bool aIsEdgesMode = aMode & SMESH_Actor::eEdges;
if(aNbVolumes == 0)
aPopup->removeItem( 219 );
else
aPopup->setItemChecked( 219, aIsVolumesMode );
if(aNbFaces == 0)
aPopup->removeItem( 218 );
else
aPopup->setItemChecked( 218, aIsFacesMode );
if(aNbEdges == 0)
aPopup->removeItem( 217 );
else
aPopup->setItemChecked( 217, aIsEdgesMode );
bool aIsRemove = (aNbVolumes == 0 || aIsVolumesMode);
aIsRemove &= (aNbFaces == 0 || aIsFacesMode);
aIsRemove &= (aNbEdges == 0 || aIsEdgesMode);
if(aIsRemove)
aPopup->removeItem( 220 );
}
// Controls
mi = popup->findItem( 2000 ); mi = popup->findItem( 2000 );
if ( mi && mi->popup() ) { if ( mi && mi->popup() ) {
SMESH_Actor::eControl cMode = ac->GetControlMode(); SMESH_Actor::eControl cMode = anActor->GetControlMode();
switch ( cMode ) { switch ( cMode ) {
case SMESH_Actor::eLengthEdges: case SMESH_Actor::eLength:
mi->popup()->setItemChecked( 6001, true ); break; mi->popup()->setItemChecked( 6001, true ); break;
case SMESH_Actor::eLength2D:
mi->popup()->setItemChecked( 6018, true ); break;
case SMESH_Actor::eFreeEdges: case SMESH_Actor::eFreeEdges:
mi->popup()->setItemChecked( 6002, true ); mi->popup()->setItemChecked( 6002, true );
mi->popup()->removeItem( 201 ); mi->popup()->removeItem( 201 );
@ -2368,12 +2528,16 @@ bool SMESHGUI::CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QString
break; break;
case SMESH_Actor::eMultiConnection: case SMESH_Actor::eMultiConnection:
mi->popup()->setItemChecked( 6004, true ); break; mi->popup()->setItemChecked( 6004, true ); break;
case SMESH_Actor::eMultiConnection2D:
mi->popup()->setItemChecked( 6019, true ); break;
case SMESH_Actor::eArea: case SMESH_Actor::eArea:
mi->popup()->setItemChecked( 6011, true ); break; mi->popup()->setItemChecked( 6011, true ); break;
case SMESH_Actor::eTaper: case SMESH_Actor::eTaper:
mi->popup()->setItemChecked( 6012, true ); break; mi->popup()->setItemChecked( 6012, true ); break;
case SMESH_Actor::eAspectRatio: case SMESH_Actor::eAspectRatio:
mi->popup()->setItemChecked( 6013, true ); break; mi->popup()->setItemChecked( 6013, true ); break;
case SMESH_Actor::eAspectRatio3D:
mi->popup()->setItemChecked( 6017, true ); break;
case SMESH_Actor::eMinimumAngle: case SMESH_Actor::eMinimumAngle:
mi->popup()->setItemChecked( 6014, true ); break; mi->popup()->setItemChecked( 6014, true ); break;
case SMESH_Actor::eWarping: case SMESH_Actor::eWarping:
@ -2386,13 +2550,14 @@ bool SMESHGUI::CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QString
mi->popup()->removeItem( 201 ); mi->popup()->removeItem( 201 );
break; break;
} }
TVisualObjPtr aVisualObj = ac->GetObject(); TVisualObjPtr aVisualObj = anActor->GetObject();
if(!aNbEdges){ if(aNbEdges == 0){
mi->popup()->removeItem( 6001 ); mi->popup()->removeItem( 6001 );
mi->popup()->removeItem( 6003 ); mi->popup()->removeItem( 6003 );
mi->popup()->removeItem( 6004 ); mi->popup()->removeItem( 6004 );
} }
if(!aNbFaces){ if(aNbFaces == 0){
mi->popup()->removeItem( 6018 );
mi->popup()->removeItem( 6002 ); mi->popup()->removeItem( 6002 );
mi->popup()->removeItem( 6011 ); mi->popup()->removeItem( 6011 );
mi->popup()->removeItem( 6012 ); mi->popup()->removeItem( 6012 );
@ -2400,8 +2565,12 @@ bool SMESHGUI::CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QString
mi->popup()->removeItem( 6014 ); mi->popup()->removeItem( 6014 );
mi->popup()->removeItem( 6015 ); mi->popup()->removeItem( 6015 );
mi->popup()->removeItem( 6016 ); mi->popup()->removeItem( 6016 );
mi->popup()->removeItem( 6019 );
} }
if(!aNbFaces && !aNbEdges) if(aNbVolumes == 0){
mi->popup()->removeItem( 6017 );
}
if(aNbFaces == 0 && aNbEdges == 0 && aNbVolumes == 0)
popup->removeItem( 2000 ); // Scalar Bar popup->removeItem( 2000 ); // Scalar Bar
} }
} }

View File

@ -63,6 +63,11 @@
#include "SALOME_InteractiveObject.hxx" #include "SALOME_InteractiveObject.hxx"
#include "SMESH_ActorUtils.h" #include "SMESH_ActorUtils.h"
#include "VTKViewer_ViewFrame.h"
#include "VTKViewer_RenderWindow.h"
#include <vtkRenderer.h>
using namespace std; using namespace std;
@ -151,8 +156,6 @@ protected:
myActor->SetInfinitive(true); myActor->SetInfinitive(true);
myActor->SetMapper( myMapper ); myActor->SetMapper( myMapper );
static float anOpacity = 0.75;
vtkProperty* aProp = vtkProperty::New(); vtkProperty* aProp = vtkProperty::New();
float anRGB[3]; float anRGB[3];
anRGB[0] = SMESH::GetFloat("SMESH:SettingsFillColorRed", 0)/255.; anRGB[0] = SMESH::GetFloat("SMESH:SettingsFillColorRed", 0)/255.;
@ -375,9 +378,8 @@ SMESHGUI_ClippingDlg::SMESHGUI_ClippingDlg( QWidget* parent,
SMESHGUI_ClippingDlg::~SMESHGUI_ClippingDlg() SMESHGUI_ClippingDlg::~SMESHGUI_ClippingDlg()
{ {
// no need to delete child widgets, Qt does it all for us // no need to delete child widgets, Qt does it all for us
//cout<<"SMESHGUI_ClippingDlg::~SMESHGUI_ClippingDlg\n";
std::for_each(myPlanes.begin(),myPlanes.end(),TSetVisiblity(false)); std::for_each(myPlanes.begin(),myPlanes.end(),TSetVisiblity(false));
SMESH::GetCurrentVtkView()->Repaint(); SMESH::RenderViewFrame(SMESH::GetCurrentVtkView());
} }
@ -407,9 +409,7 @@ void SMESHGUI_ClippingDlg::ClickOnApply()
anOrientedPlane->Delete(); anOrientedPlane->Delete();
} }
myActor->SetVisibility(myActor->GetVisibility()); SMESH::RenderViewFrame(SMESH::GetCurrentVtkView());
SMESH::GetCurrentVtkView()->Repaint();
} }
} }
@ -466,7 +466,7 @@ void SMESHGUI_ClippingDlg::onSelectionChanged()
} }
} }
Sinchronize(); Sinchronize();
SMESH::GetCurrentVtkView()->Repaint(); SMESH::RenderViewFrame(SMESH::GetCurrentVtkView());
} }
@ -484,8 +484,7 @@ void SMESHGUI_ClippingDlg::onSelectPlane(int theIndex)
// Orientation // Orientation
SMESH::Orientation anOrientation = aPlane->GetOrientation(); SMESH::Orientation anOrientation = aPlane->GetOrientation();
// Distance and Rotations // Rotations
float aDistance;
double aRot[2] = {aPlane->myAngle[0], aPlane->myAngle[1]}; double aRot[2] = {aPlane->myAngle[0], aPlane->myAngle[1]};
// Set plane parameters in the dialog // Set plane parameters in the dialog
@ -550,7 +549,7 @@ void SMESHGUI_ClippingDlg::ClickOnDelete()
ClickOnApply(); ClickOnApply();
Sinchronize(); Sinchronize();
SMESH::GetCurrentVtkView()->Repaint(); SMESH::RenderViewFrame(SMESH::GetCurrentVtkView());
} }
@ -702,7 +701,6 @@ void SMESHGUI_ClippingDlg::SetCurrentPlaneParam()
myActor->SetPlaneParam(aNormal, getDistance(), aPlane); myActor->SetPlaneParam(aNormal, getDistance(), aPlane);
float* anOrig = aPlane->GetOrigin();
vtkDataSet* aDataSet = myActor->GetInput(); vtkDataSet* aDataSet = myActor->GetInput();
float *aPnt = aDataSet->GetCenter(); float *aPnt = aDataSet->GetCenter();
@ -746,11 +744,11 @@ void SMESHGUI_ClippingDlg::SetCurrentPlaneParam()
if(AutoApplyCheckBox->isChecked()) if(AutoApplyCheckBox->isChecked())
ClickOnApply(); ClickOnApply();
SMESH::GetCurrentVtkView()->Repaint(); SMESH::RenderViewFrame(SMESH::GetCurrentVtkView());
} }
void SMESHGUI_ClippingDlg::OnPreviewToggle(bool theIsToggled){ void SMESHGUI_ClippingDlg::OnPreviewToggle(bool theIsToggled){
std::for_each(myPlanes.begin(),myPlanes.end(),TSetVisiblity(theIsToggled)); std::for_each(myPlanes.begin(),myPlanes.end(),TSetVisiblity(theIsToggled));
SMESH::GetCurrentVtkView()->Repaint(); SMESH::RenderViewFrame(SMESH::GetCurrentVtkView());
} }

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,156 @@
// SMESH SMESHGUI : GUI for SMESH component
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : SMESHGUI_ExtrusionAlongPathDlg.h
// Author : Vadim SANDLER
// Module : SMESH
// $Header:
#ifndef DIALOGBOX_EXTRUSION_PATH_H
#define DIALOGBOX_EXTRUSION_PATH_H
#include "SALOME_Selection.h"
#include "SMESH_LogicalFilter.hxx"
#include "SMESH_TypeFilter.hxx"
// QT Includes
#include <qdialog.h>
class QButtonGroup;
class QRadioButton;
class QGroupBox;
class QLabel;
class QToolButton;
class QLineEdit;
class QCheckBox;
class QListBox;
class QPushButton;
class SMESHGUI_SpinBox;
class SMESHGUI;
class SMESH_Actor;
// IDL Headers
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SMESH_Mesh)
//=================================================================================
// class : SMESHGUI_ExtrusionAlongPathDlg
// purpose :
//=================================================================================
class SMESHGUI_ExtrusionAlongPathDlg : public QDialog
{
Q_OBJECT
class SetBusy {
public:
SetBusy( SMESHGUI_ExtrusionAlongPathDlg* _dlg ) { myDlg = _dlg; myDlg->myBusy = true; }
~SetBusy() { myDlg->myBusy = false; }
private:
SMESHGUI_ExtrusionAlongPathDlg* myDlg;
};
friend class SetBusy;
public:
SMESHGUI_ExtrusionAlongPathDlg( QWidget* parent = 0, SALOME_Selection* Sel = 0, bool modal = FALSE );
~SMESHGUI_ExtrusionAlongPathDlg();
bool eventFilter( QObject* object, QEvent* event );
protected slots:
void reject();
private:
void Init( bool ResetControls = true ) ;
void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */
int GetConstructorId();
void SetEditCurrentArgument( QToolButton* button );
SMESHGUI* mySMESHGUI ; /* Current SMESHGUI object */
SALOME_Selection* mySelection ; /* User shape selection */
QWidget* myEditCurrentArgument; /* Current argument */
bool myBusy;
SMESH::SMESH_IDSource_var myIDSource;
SMESH::SMESH_Mesh_var myMesh;
SMESH_Actor* myMeshActor;
SMESH::SMESH_Mesh_var myPathMesh;
GEOM::GEOM_Object_var myPathShape;
Handle(SMESH_LogicalFilter) myElementsFilter;
Handle(SMESH_TypeFilter) myPathMeshFilter;
int myType;
// widgets
QButtonGroup* ElementsTypeGrp;
QRadioButton* Elements1dRB;
QRadioButton* Elements2dRB;
QGroupBox* ArgumentsGrp;
QLabel* ElementsLab;
QToolButton* SelectElementsButton;
QLineEdit* ElementsLineEdit;
QCheckBox* MeshCheck;
QGroupBox* PathGrp;
QLabel* PathMeshLab;
QToolButton* SelectPathMeshButton;
QLineEdit* PathMeshLineEdit;
QLabel* PathShapeLab;
QToolButton* SelectPathShapeButton;
QLineEdit* PathShapeLineEdit;
QLabel* StartPointLab;
QToolButton* SelectStartPointButton;
QLineEdit* StartPointLineEdit;
QCheckBox* AnglesCheck;
QGroupBox* AnglesGrp;
QListBox* AnglesList;
QToolButton* AddAngleButton;
QToolButton* RemoveAngleButton;
SMESHGUI_SpinBox* AngleSpin;
QCheckBox* BasePointCheck;
QGroupBox* BasePointGrp;
QToolButton* SelectBasePointButton;
QLabel* XLab;
SMESHGUI_SpinBox* XSpin;
QLabel* YLab;
SMESHGUI_SpinBox* YSpin;
QLabel* ZLab;
SMESHGUI_SpinBox* ZSpin;
QGroupBox* ButtonsGrp;
QPushButton* OkButton;
QPushButton* ApplyButton;
QPushButton* CloseButton;
private slots:
void TypeChanged( int type );
void ClickOnOk();
bool ClickOnApply();
void SetEditCurrentArgument();
void SelectionIntoArgument();
void DeactivateActiveDialog();
void ActivateThisDialog();
void onTextChange(const QString&);
void onSelectMesh();
void onAnglesCheck();
void onBasePointCheck();
void OnAngleAdded();
void OnAngleRemoved();
};
#endif // DIALOGBOX_EXTRUSION_PATH_H

View File

@ -56,6 +56,10 @@
#include <qvalidator.h> #include <qvalidator.h>
#include <qpixmap.h> #include <qpixmap.h>
// IDL Headers
#include "SALOMEconfig.h"
#include CORBA_SERVER_HEADER(SMESH_Group)
using namespace std; using namespace std;
//================================================================================= //=================================================================================

View File

@ -81,6 +81,10 @@
#include <qobjectlist.h> #include <qobjectlist.h>
#include <qvalidator.h> #include <qvalidator.h>
// IDL Headers
#include "SALOMEconfig.h"
#include CORBA_SERVER_HEADER(SMESH_Group)
#define SPACING 5 #define SPACING 5
#define MARGIN 10 #define MARGIN 10
@ -654,7 +658,8 @@ bool SMESHGUI_FilterTable::IsValid( const bool theMess, const int theEntityType
if ( aCriterion == FT_RangeOfIds || if ( aCriterion == FT_RangeOfIds ||
aCriterion == FT_BelongToGeom || aCriterion == FT_BelongToGeom ||
aCriterion == FT_BelongToPlane || aCriterion == FT_BelongToPlane ||
aCriterion == FT_BelongToCylinder ) aCriterion == FT_BelongToCylinder ||
aCriterion == FT_LyingOnGeom)
{ {
if ( aTable->text( i, 2 ).isEmpty() ) if ( aTable->text( i, 2 ).isEmpty() )
{ {
@ -768,7 +773,8 @@ void SMESHGUI_FilterTable::GetCriterion( const int theRow,
if ( aCriterionType != FT_RangeOfIds && if ( aCriterionType != FT_RangeOfIds &&
aCriterionType != FT_BelongToGeom && aCriterionType != FT_BelongToGeom &&
aCriterionType != FT_BelongToPlane && aCriterionType != FT_BelongToPlane &&
aCriterionType != FT_BelongToCylinder ) aCriterionType != FT_BelongToCylinder &&
aCriterionType != FT_LyingOnGeom)
{ {
theCriterion.Compare = ( (ComboItem*)aTable->item( theRow, 1 ) )->GetValue(); theCriterion.Compare = ( (ComboItem*)aTable->item( theRow, 1 ) )->GetValue();
theCriterion.Threshold = aTable->item( theRow, 2 )->text().toDouble(); theCriterion.Threshold = aTable->item( theRow, 2 )->text().toDouble();
@ -813,7 +819,8 @@ void SMESHGUI_FilterTable::SetCriterion( const int theRow,
if ( theCriterion.Type != FT_RangeOfIds && if ( theCriterion.Type != FT_RangeOfIds &&
theCriterion.Type != FT_BelongToGeom && theCriterion.Type != FT_BelongToGeom &&
theCriterion.Type != FT_BelongToPlane && theCriterion.Type != FT_BelongToPlane &&
theCriterion.Type != FT_BelongToCylinder ) theCriterion.Type != FT_BelongToCylinder &&
theCriterion.Type != FT_LyingOnGeom)
aTable->setText( theRow, 2, QString( "%1" ).arg( theCriterion.Threshold, 0, 'g', 15 ) ); aTable->setText( theRow, 2, QString( "%1" ).arg( theCriterion.Threshold, 0, 'g', 15 ) );
else else
aTable->setText( theRow, 2, QString( theCriterion.ThresholdStr ) ); aTable->setText( theRow, 2, QString( theCriterion.ThresholdStr ) );
@ -902,7 +909,6 @@ void SMESHGUI_FilterTable::onAddBtn()
int aType = GetType(); int aType = GetType();
addRow( myTables[ aType ], aType ); addRow( myTables[ aType ], aType );
Table* aTable = myTables[ aType ];
Update(); Update();
} }
@ -965,6 +971,7 @@ void SMESHGUI_FilterTable::updateAdditionalWidget()
ComboItem* anItem = ( (ComboItem*)aTable->item( aRow, 0 ) ); ComboItem* anItem = ( (ComboItem*)aTable->item( aRow, 0 ) );
bool toEnable = ( (ComboItem*)aTable->item( aRow, 1 ) )->GetValue() == FT_EqualTo && bool toEnable = ( (ComboItem*)aTable->item( aRow, 1 ) )->GetValue() == FT_EqualTo &&
GetCriterionType( aRow ) != FT_BelongToGeom && GetCriterionType( aRow ) != FT_BelongToGeom &&
GetCriterionType( aRow ) != FT_LyingOnGeom &&
GetCriterionType( aRow ) != FT_RangeOfIds && GetCriterionType( aRow ) != FT_RangeOfIds &&
GetCriterionType( aRow ) != FT_FreeEdges; GetCriterionType( aRow ) != FT_FreeEdges;
if ( !myAddWidgets.contains( anItem ) ) if ( !myAddWidgets.contains( anItem ) )
@ -1047,7 +1054,8 @@ void SMESHGUI_FilterTable::onCriterionChanged( const int row, const int col, con
else if ( aCriterionType == SMESH::FT_RangeOfIds || else if ( aCriterionType == SMESH::FT_RangeOfIds ||
aCriterionType == SMESH::FT_BelongToGeom || aCriterionType == SMESH::FT_BelongToGeom ||
aCriterionType == SMESH::FT_BelongToPlane || aCriterionType == SMESH::FT_BelongToPlane ||
aCriterionType == SMESH::FT_BelongToCylinder ) aCriterionType == SMESH::FT_BelongToCylinder ||
aCriterionType == SMESH::FT_LyingOnGeom)
{ {
QMap<int, QString> aMap; QMap<int, QString> aMap;
aMap[ FT_EqualTo ] = tr( "EQUAL_TO" ); aMap[ FT_EqualTo ] = tr( "EQUAL_TO" );
@ -1239,6 +1247,7 @@ const QMap<int, QString>& SMESHGUI_FilterTable::getCriteria( const int theType )
aCriteria[ SMESH::FT_BelongToGeom ] = tr( "BELONG_TO_GEOM" ); aCriteria[ SMESH::FT_BelongToGeom ] = tr( "BELONG_TO_GEOM" );
aCriteria[ SMESH::FT_BelongToPlane ] = tr( "BELONG_TO_PLANE" ); aCriteria[ SMESH::FT_BelongToPlane ] = tr( "BELONG_TO_PLANE" );
aCriteria[ SMESH::FT_BelongToCylinder ] = tr( "BELONG_TO_CYLINDER" ); aCriteria[ SMESH::FT_BelongToCylinder ] = tr( "BELONG_TO_CYLINDER" );
aCriteria[ SMESH::FT_LyingOnGeom ] = tr( "LYING_ON_GEOM" );
} }
return aCriteria; return aCriteria;
} }
@ -1254,6 +1263,7 @@ const QMap<int, QString>& SMESHGUI_FilterTable::getCriteria( const int theType )
aCriteria[ SMESH::FT_BelongToGeom ] = tr( "BELONG_TO_GEOM" ); aCriteria[ SMESH::FT_BelongToGeom ] = tr( "BELONG_TO_GEOM" );
aCriteria[ SMESH::FT_BelongToPlane ] = tr( "BELONG_TO_PLANE" ); aCriteria[ SMESH::FT_BelongToPlane ] = tr( "BELONG_TO_PLANE" );
aCriteria[ SMESH::FT_BelongToCylinder ] = tr( "BELONG_TO_CYLINDER" ); aCriteria[ SMESH::FT_BelongToCylinder ] = tr( "BELONG_TO_CYLINDER" );
aCriteria[ SMESH::FT_LyingOnGeom ] = tr( "LYING_ON_GEOM" );
} }
return aCriteria; return aCriteria;
} }
@ -1273,6 +1283,9 @@ const QMap<int, QString>& SMESHGUI_FilterTable::getCriteria( const int theType )
aCriteria[ SMESH::FT_BelongToGeom ] = tr( "BELONG_TO_GEOM" ); aCriteria[ SMESH::FT_BelongToGeom ] = tr( "BELONG_TO_GEOM" );
aCriteria[ SMESH::FT_BelongToPlane ] = tr( "BELONG_TO_PLANE" ); aCriteria[ SMESH::FT_BelongToPlane ] = tr( "BELONG_TO_PLANE" );
aCriteria[ SMESH::FT_BelongToCylinder ] = tr( "BELONG_TO_CYLINDER" ); aCriteria[ SMESH::FT_BelongToCylinder ] = tr( "BELONG_TO_CYLINDER" );
aCriteria[ SMESH::FT_LyingOnGeom ] = tr( "LYING_ON_GEOM" );
aCriteria[ SMESH::FT_Length2D ] = tr( "LENGTH2D" );
aCriteria[ SMESH::FT_MultiConnection2D] = tr( "MULTI2D_BORDERS" );
} }
return aCriteria; return aCriteria;
} }
@ -1281,8 +1294,10 @@ const QMap<int, QString>& SMESHGUI_FilterTable::getCriteria( const int theType )
static QMap<int, QString> aCriteria; static QMap<int, QString> aCriteria;
if ( aCriteria.isEmpty() ) if ( aCriteria.isEmpty() )
{ {
aCriteria[ SMESH::FT_AspectRatio3D] = tr( "ASPECT_RATIO_3D" );
aCriteria[ SMESH::FT_RangeOfIds ] = tr( "RANGE_OF_IDS" ); aCriteria[ SMESH::FT_RangeOfIds ] = tr( "RANGE_OF_IDS" );
aCriteria[ SMESH::FT_BelongToGeom ] = tr( "BELONG_TO_GEOM" ); aCriteria[ SMESH::FT_BelongToGeom ] = tr( "BELONG_TO_GEOM" );
aCriteria[ SMESH::FT_LyingOnGeom ] = tr( "LYING_ON_GEOM" );
} }
return aCriteria; return aCriteria;
} }
@ -1341,9 +1356,6 @@ SMESHGUI_FilterTable::Table* SMESHGUI_FilterTable::createTable( QWidget* thePar
static int aLenCr = abs( aMaxLenCr - static int aLenCr = abs( aMaxLenCr -
aMetrics.width( tr( "CRITERION" ) ) ) / aMetrics.width( ' ' ) + 5; aMetrics.width( tr( "CRITERION" ) ) ) / aMetrics.width( ' ' ) + 5;
static int aLenCo = abs( maxLength( getCompare(), aMetrics ) -
aMetrics.width( tr( "COMPARE" ) ) ) / aMetrics.width( ' ' ) + 5;
QString aCrStr; QString aCrStr;
aCrStr.fill( ' ', aLenCr ); aCrStr.fill( ' ', aLenCr );
QString aCoStr; QString aCoStr;
@ -1999,7 +2011,8 @@ bool SMESHGUI_FilterDlg::isValid() const
int aType = myTable->GetCriterionType( i ); int aType = myTable->GetCriterionType( i );
if ( aType == FT_BelongToGeom || if ( aType == FT_BelongToGeom ||
aType == FT_BelongToPlane || aType == FT_BelongToPlane ||
aType == FT_BelongToCylinder ) aType == FT_BelongToCylinder ||
aType == FT_LyingOnGeom)
{ {
QString aName; QString aName;
myTable->GetThreshold( i, aName ); myTable->GetThreshold( i, aName );
@ -2312,7 +2325,7 @@ void SMESHGUI_FilterDlg::filterSelectionSource( const int theType,
if ( aSelMap.Extent() > 0 ) if ( aSelMap.Extent() > 0 )
{ {
if(SMESH_Actor *anActor = SMESH::FindActorByEntry( anIter.Key()->getEntry() ) ) if( SMESH::FindActorByEntry( anIter.Key()->getEntry() ) )
{ {
for ( int i = 1; i <= aSelMap.Extent(); i++ ) for ( int i = 1; i <= aSelMap.Extent(); i++ )
aToBeFiltered.Add( aSelMap(i) ); aToBeFiltered.Add( aSelMap(i) );
@ -2418,7 +2431,8 @@ void SMESHGUI_FilterDlg::onSelectionDone()
!myTable->CurrentCell( aRow, aCol ) || !myTable->CurrentCell( aRow, aCol ) ||
myTable->GetCriterionType( aRow ) != FT_BelongToGeom && myTable->GetCriterionType( aRow ) != FT_BelongToGeom &&
myTable->GetCriterionType( aRow ) != FT_BelongToPlane && myTable->GetCriterionType( aRow ) != FT_BelongToPlane &&
myTable->GetCriterionType( aRow ) != FT_BelongToCylinder) myTable->GetCriterionType( aRow ) != FT_BelongToCylinder &&
myTable->GetCriterionType( aRow ) != FT_LyingOnGeom )
return; return;
Handle(SALOME_InteractiveObject) anIO = mySelection->firstIObject() ; Handle(SALOME_InteractiveObject) anIO = mySelection->firstIObject() ;
@ -2461,9 +2475,10 @@ void SMESHGUI_FilterDlg::updateSelection()
if ( myTable->CurrentCell( aRow, aCol ) && if ( myTable->CurrentCell( aRow, aCol ) &&
( myTable->GetCriterionType( aRow ) == FT_BelongToGeom || ( myTable->GetCriterionType( aRow ) == FT_BelongToGeom ||
myTable->GetCriterionType( aRow ) == FT_BelongToPlane || myTable->GetCriterionType( aRow ) == FT_BelongToPlane ||
myTable->GetCriterionType( aRow ) == FT_BelongToCylinder ) ) myTable->GetCriterionType( aRow ) == FT_BelongToCylinder ||
myTable->GetCriterionType( aRow ) == FT_LyingOnGeom) )
{ {
if ( myTable->GetCriterionType( aRow ) == FT_BelongToGeom ) if ( myTable->GetCriterionType( aRow ) == FT_BelongToGeom || myTable->GetCriterionType( aRow ) == FT_LyingOnGeom )
mySelection->AddFilter( new SALOME_TypeFilter( "GEOM" ) ); mySelection->AddFilter( new SALOME_TypeFilter( "GEOM" ) );
else if ( myTable->GetCriterionType( aRow ) == FT_BelongToPlane ) else if ( myTable->GetCriterionType( aRow ) == FT_BelongToPlane )
mySelection->AddFilter( new GEOM_FaceFilter( StdSelect_Plane ) ); mySelection->AddFilter( new GEOM_FaceFilter( StdSelect_Plane ) );

View File

@ -498,6 +498,10 @@ void SMESHGUI_GroupDlg::onGrpTypeChanged(int id)
//================================================================================= //=================================================================================
void SMESHGUI_GroupDlg::setSelectionMode(int theMode) void SMESHGUI_GroupDlg::setSelectionMode(int theMode)
{ {
// PAL7314
if (myMesh->_is_nil())
return;
if (mySelectionMode != theMode) { if (mySelectionMode != theMode) {
mySelection->ClearIObjects(); mySelection->ClearIObjects();
mySelection->ClearFilters(); mySelection->ClearFilters();

View File

@ -43,6 +43,8 @@
#include "VTKViewer_ViewFrame.h" #include "VTKViewer_ViewFrame.h"
#include "SMESHGUI_PatternUtils.h" #include "SMESHGUI_PatternUtils.h"
#include "SMESH_ActorUtils.h" #include "SMESH_ActorUtils.h"
#include "SMDS_MeshElement.hxx"
#include "SMDS_Mesh.hxx"
#include <TColStd_MapOfInteger.hxx> #include <TColStd_MapOfInteger.hxx>
@ -57,6 +59,8 @@
#include <qbuttongroup.h> #include <qbuttongroup.h>
#include <qmessagebox.h> #include <qmessagebox.h>
#include <qcstring.h> #include <qcstring.h>
#include <qspinbox.h>
#include <qvaluelist.h>
#include <vtkCell.h> #include <vtkCell.h>
#include <vtkIdList.h> #include <vtkIdList.h>
@ -82,7 +86,8 @@ SMESHGUI_MeshPatternDlg::SMESHGUI_MeshPatternDlg( QWidget* theParent,
SALOME_Selection* theSelection, SALOME_Selection* theSelection,
const char* theName ) const char* theName )
: QDialog( theParent, theName, false, : QDialog( theParent, theName, false,
WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ),
myBusy( false )
{ {
setCaption( tr( "CAPTION" ) ); setCaption( tr( "CAPTION" ) );
@ -156,27 +161,52 @@ QFrame* SMESHGUI_MeshPatternDlg::createMainFrame( QWidget* theParent )
myOpenBtn->setPixmap( iconOpen ); myOpenBtn->setPixmap( iconOpen );
myNewBtn = new QPushButton( tr( "NEW" ), aNameGrp ); myNewBtn = new QPushButton( tr( "NEW" ), aNameGrp );
// selection widgets // Mode selection check box
QGroupBox* aGrp = new QGroupBox( 3, Qt::Horizontal, aPatGrp ); myRefine = new QCheckBox( tr( "REFINE" ), aPatGrp );
aGrp->setFrameStyle( QFrame::NoFrame );
aGrp->setInsideMargin( 0 ); // selection widgets for Apply to geom mode
myGeomGrp = new QGroupBox( 3, Qt::Horizontal, aPatGrp );
myGeomGrp->setFrameStyle( QFrame::NoFrame );
myGeomGrp->setInsideMargin( 0 );
for ( int i = Object; i <= Vertex2; i++ ) for ( int i = Object; i <= Vertex2; i++ )
{ {
mySelLbl[ i ] = new QLabel( aGrp ); mySelLbl[ i ] = new QLabel( myGeomGrp );
mySelBtn[ i ] = new QPushButton( aGrp ); mySelBtn[ i ] = new QPushButton( myGeomGrp );
mySelBtn[ i ]->setPixmap( iconSlct ); mySelBtn[ i ]->setPixmap( iconSlct );
mySelEdit[ i ] = new QLineEdit( aGrp ); mySelEdit[ i ] = new QLineEdit( myGeomGrp );
mySelEdit[ i ]->setReadOnly( true ); mySelEdit[ i ]->setReadOnly( true );
} }
// Widgets for refinement of existing mesh elements
myRefineGrp = new QFrame( aPatGrp );
myRefineGrp->setFrameStyle( QFrame::NoFrame );
QGridLayout* aRefGrid = new QGridLayout( myRefineGrp, 3, 3, 0, 5 );
mySelLbl[ Ids ] = new QLabel( myRefineGrp );
mySelBtn[ Ids ] = new QPushButton( myRefineGrp );
mySelBtn[ Ids ]->setPixmap( iconSlct );
mySelEdit[ Ids ] = new QLineEdit( myRefineGrp );
QLabel* aNodeLbl = new QLabel( tr( "NODE_1" ), myRefineGrp );
myNode1 = new QSpinBox( myRefineGrp );
myNode2Lbl = new QLabel( tr( "NODE_2" ), myRefineGrp );
myNode2 = new QSpinBox( myRefineGrp );
aRefGrid->addWidget( mySelLbl [ Ids ], 0, 0 );
aRefGrid->addWidget( mySelBtn [ Ids ], 0, 1 );
aRefGrid->addWidget( mySelEdit[ Ids ], 0, 2 );
aRefGrid->addWidget( aNodeLbl, 1, 0 );
aRefGrid->addMultiCellWidget( myNode1, 1, 1, 1, 2 );
aRefGrid->addWidget( myNode2Lbl, 2, 0 );
aRefGrid->addMultiCellWidget( myNode2, 2, 2, 1, 2 );
// reverse check box // reverse check box
myReverseChk = new QCheckBox( tr( "REVERSE" ), aPatGrp ); myReverseChk = new QCheckBox( tr( "REVERSE" ), aPatGrp );
// Pictures 2d and 3d // Pictures 2d and 3d
for ( int i = 0; i < 2; i++ ) for ( int i = 0; i < 2; i++ )
{ {
QWidget* aPreview, *aPicture;
if ( i == 0 ) if ( i == 0 )
{ {
myPicture2d = new SMESHGUI_PatternWidget( aPatGrp ), myPicture2d = new SMESHGUI_PatternWidget( aPatGrp ),
@ -209,6 +239,10 @@ QFrame* SMESHGUI_MeshPatternDlg::createMainFrame( QWidget* theParent )
connect( myNewBtn, SIGNAL( clicked() ), SLOT( onNew() ) ); connect( myNewBtn, SIGNAL( clicked() ), SLOT( onNew() ) );
connect( myReverseChk, SIGNAL( toggled( bool ) ), SLOT( onReverse( bool ) ) ); connect( myReverseChk, SIGNAL( toggled( bool ) ), SLOT( onReverse( bool ) ) );
connect( myPreviewChk, SIGNAL( toggled( bool ) ), SLOT( onPreview( bool ) ) ); connect( myPreviewChk, SIGNAL( toggled( bool ) ), SLOT( onPreview( bool ) ) );
connect( myRefine, SIGNAL( toggled( bool ) ), SLOT( onModeToggled( bool ) ) );
connect( myNode1, SIGNAL( valueChanged( int ) ), SLOT( onNodeChanged( int ) ) );
connect( myNode2, SIGNAL( valueChanged( int ) ), SLOT( onNodeChanged( int ) ) );
connect( mySelEdit[Ids], SIGNAL( textChanged( const QString& ) ), SLOT( onTextChanged( const QString& ) ) );
QMap< int, QPushButton* >::iterator anIter; QMap< int, QPushButton* >::iterator anIter;
for ( anIter = mySelBtn.begin(); anIter != mySelBtn.end(); ++anIter ) for ( anIter = mySelBtn.begin(); anIter != mySelBtn.end(); ++anIter )
@ -284,6 +318,7 @@ void SMESHGUI_MeshPatternDlg::Init( SALOME_Selection* theSelection )
myTypeGrp->setButton( Type_2d ); myTypeGrp->setButton( Type_2d );
onTypeChanged( Type_2d ); onTypeChanged( Type_2d );
onModeToggled( isRefine() );
updateGeometry(); updateGeometry();
@ -304,8 +339,10 @@ void SMESHGUI_MeshPatternDlg::Init( SALOME_Selection* theSelection )
//======================================================================= //=======================================================================
bool SMESHGUI_MeshPatternDlg::isValid( const bool theMess ) bool SMESHGUI_MeshPatternDlg::isValid( const bool theMess )
{ {
if ( myMesh->_is_nil() || myMeshShape->_is_nil() || myGeomObj[ Object ]->_is_nil() || QValueList<int> ids;
myGeomObj[ Vertex1 ]->_is_nil() || myType == Type_3d && myGeomObj[ Vertex2 ]->_is_nil() ) if ( ( isRefine() && ( myMesh->_is_nil() || !getIds( ids ) || getNode( false ) < 0 || myType == Type_3d && ( getNode( true ) < 0 || getNode( false ) == getNode( true ) ) ) )
|| ( !isRefine() && ( myMesh->_is_nil() || myMeshShape->_is_nil() || myGeomObj[ Object ]->_is_nil() ||
myGeomObj[ Vertex1 ]->_is_nil() || myType == Type_3d && myGeomObj[ Vertex2 ]->_is_nil() ) ) )
{ {
if ( theMess ) if ( theMess )
QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(), QMessageBox::information( SMESHGUI::GetSMESHGUI()->GetDesktop(),
@ -327,12 +364,28 @@ bool SMESHGUI_MeshPatternDlg::onApply()
if ( !isValid() ) if ( !isValid() )
return false; return false;
erasePreview();
if ( isRefine() ) { // Refining existing mesh elements
QValueList<int> ids;
getIds( ids );
SMESH::long_array_var varIds = new SMESH::long_array();
varIds->length( ids.count() );
int i = 0;
for ( QValueList<int>::iterator it = ids.begin(); it != ids.end(); ++it )
varIds[i++] = *it;
myType == Type_2d
? myPattern->ApplyToMeshFaces ( myMesh, varIds, getNode( false ), myReverseChk->isChecked() )
: myPattern->ApplyToHexahedrons( myMesh, varIds, getNode( false ), getNode( true ) );
}
else { // Applying a pattern to geometrical object
if ( myType == Type_2d ) if ( myType == Type_2d )
myPattern->ApplyToFace( myPattern->ApplyToFace(
myGeomObj[ Object ], myGeomObj[ Vertex1 ], myReverseChk->isChecked() ); myGeomObj[ Object ], myGeomObj[ Vertex1 ], myReverseChk->isChecked() );
else else
myPattern->ApplyTo3DBlock( myPattern->ApplyTo3DBlock(
myGeomObj[ Object ], myGeomObj[ Vertex1 ], myGeomObj[ Vertex2 ] ); myGeomObj[ Object ], myGeomObj[ Vertex1 ], myGeomObj[ Vertex2 ] );
}
if ( myPattern->MakeMesh( myMesh ) ) if ( myPattern->MakeMesh( myMesh ) )
{ {
@ -376,6 +429,7 @@ void SMESHGUI_MeshPatternDlg::onOk()
void SMESHGUI_MeshPatternDlg::onClose() void SMESHGUI_MeshPatternDlg::onClose()
{ {
mySelection->ClearFilters(); mySelection->ClearFilters();
SMESH::SetPickable();
QAD_Application::getDesktop()->SetSelectionMode( ActorSelection ); QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
disconnect( mySelection, 0, this, 0 ); disconnect( mySelection, 0, this, 0 );
disconnect( SMESHGUI::GetSMESHGUI(), 0, this, 0 ); disconnect( SMESHGUI::GetSMESHGUI(), 0, this, 0 );
@ -392,13 +446,16 @@ void SMESHGUI_MeshPatternDlg::onClose()
//======================================================================= //=======================================================================
void SMESHGUI_MeshPatternDlg::onSelectionDone() void SMESHGUI_MeshPatternDlg::onSelectionDone()
{ {
if ( myBusy )
return;
try try
{
if ( mySelInput == Mesh )
{ {
if ( mySelection->IObjectCount() != 1 ) if ( mySelection->IObjectCount() != 1 )
return; return;
if ( mySelInput == Mesh )
{
// Retrieve mesh from selection // Retrieve mesh from selection
Handle(SALOME_InteractiveObject) anIO = mySelection->firstIObject(); Handle(SALOME_InteractiveObject) anIO = mySelection->firstIObject();
SMESH::SMESH_Mesh_var aMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>( anIO ); SMESH::SMESH_Mesh_var aMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>( anIO );
@ -433,12 +490,12 @@ void SMESHGUI_MeshPatternDlg::onSelectionDone()
} }
if ( !isFound ) if ( !isFound )
return; myMeshShape = GEOM::GEOM_Object::_nil();
// Clear fields of geom objects if mesh was changed // Clear fields of geom objects if mesh was changed
if ( myMesh != aMesh ) if ( myMesh != aMesh )
{ {
for ( int i = Object; i <= Vertex2; i++ ) for ( int i = Object; i <= Ids; i++ )
{ {
myGeomObj[ i ] = GEOM::GEOM_Object::_nil(); myGeomObj[ i ] = GEOM::GEOM_Object::_nil();
mySelEdit[ i ]->setText( "" ); mySelEdit[ i ]->setText( "" );
@ -452,8 +509,20 @@ void SMESHGUI_MeshPatternDlg::onSelectionDone()
SMESH::GetNameOfSelectedIObjects( mySelection, aName ); SMESH::GetNameOfSelectedIObjects( mySelection, aName );
mySelEdit[ Mesh ]->setText( aName ); mySelEdit[ Mesh ]->setText( aName );
} }
else if ( mySelInput == Ids ) {
QString anIds;
if ( !SMESH::GetNameOfSelectedElements( mySelection, anIds ) )
anIds = "";
myBusy = true;
mySelEdit[ Ids ]->setText( anIds );
myBusy = false;
}
else else
{ {
if ( mySelection->IObjectCount() != 1 )
return;
// Get geom object from selection // Get geom object from selection
Handle(SALOME_InteractiveObject) anIO = mySelection->firstIObject(); Handle(SALOME_InteractiveObject) anIO = mySelection->firstIObject();
GEOM::GEOM_Object_var anObj = SMESH::IObjectToInterface<GEOM::GEOM_Object>( anIO ); GEOM::GEOM_Object_var anObj = SMESH::IObjectToInterface<GEOM::GEOM_Object>( anIO );
@ -538,6 +607,7 @@ void SMESHGUI_MeshPatternDlg::enterEvent( QEvent* )
setEnabled( true ); setEnabled( true );
activateSelection(); activateSelection();
connect( mySelection, SIGNAL( currentSelectionChanged() ), SLOT( onSelectionDone() ) ); connect( mySelection, SIGNAL( currentSelectionChanged() ), SLOT( onSelectionDone() ) );
onTextChanged( mySelEdit[Ids]->text() );
} }
@ -558,7 +628,7 @@ void SMESHGUI_MeshPatternDlg::closeEvent( QCloseEvent* e )
void SMESHGUI_MeshPatternDlg::onSelInputChanged() void SMESHGUI_MeshPatternDlg::onSelInputChanged()
{ {
const QObject* aSender = sender(); const QObject* aSender = sender();
for ( int i = Mesh; i <= Vertex2; i++ ) for ( int i = Mesh; i <= Ids; i++ )
if ( aSender == mySelBtn[ i ] ) if ( aSender == mySelBtn[ i ] )
mySelInput = i; mySelInput = i;
@ -798,7 +868,7 @@ void SMESHGUI_MeshPatternDlg::displayPreview()
vtkProperty* aProp = vtkProperty::New(); vtkProperty* aProp = vtkProperty::New();
aProp->SetRepresentationToWireframe(); aProp->SetRepresentationToWireframe();
aProp->SetColor( 250, 0, 250 ); aProp->SetColor( 250, 0, 250 );
if ( SMESH_Actor* anActor = SMESH::FindActorByObject( myMesh ) ) if ( SMESH::FindActorByObject( myMesh ) )
aProp->SetLineWidth( SMESH::GetFloat( "SMESH:SettingsWidth", 1 ) +1 ); aProp->SetLineWidth( SMESH::GetFloat( "SMESH:SettingsWidth", 1 ) +1 );
else else
aProp->SetLineWidth( 1 ); aProp->SetLineWidth( 1 );
@ -854,17 +924,23 @@ void SMESHGUI_MeshPatternDlg::updateWgState()
{ {
if ( myMesh->_is_nil() ) if ( myMesh->_is_nil() )
{ {
for ( int i = Object; i <= Vertex2; i++ ) for ( int i = Object; i <= Ids; i++ )
{ {
mySelBtn [ i ]->setEnabled( false ); mySelBtn [ i ]->setEnabled( false );
mySelEdit[ i ]->setEnabled( false ); mySelEdit[ i ]->setEnabled( false );
mySelEdit[ i ]->setText( "" ); mySelEdit[ i ]->setText( "" );
} }
myNode1->setEnabled( false );
myNode2->setEnabled( false );
myNode1->setRange( 0, 0 );
myNode2->setRange( 0, 0 );
} }
else else
{ {
mySelBtn [ Object ]->setEnabled( true ); mySelBtn [ Object ]->setEnabled( true );
mySelEdit[ Object ]->setEnabled( true ); mySelEdit[ Object ]->setEnabled( true );
mySelBtn [ Ids ] ->setEnabled( true );
mySelEdit[ Ids ] ->setEnabled( true );
if ( myGeomObj[ Object ]->_is_nil() ) if ( myGeomObj[ Object ]->_is_nil() )
{ {
@ -883,6 +959,23 @@ void SMESHGUI_MeshPatternDlg::updateWgState()
mySelEdit[ i ]->setEnabled( true ); mySelEdit[ i ]->setEnabled( true );
} }
} }
QValueList<int> ids;
if ( !CORBA::is_nil( myPattern ) && getIds( ids ) ) {
SMESH::long_array_var keyPoints = myPattern->GetKeyPoints();
if ( keyPoints->length() ) {
myNode1->setEnabled( true );
myNode2->setEnabled( true );
myNode1->setRange( 1, keyPoints->length() );
myNode2->setRange( 1, keyPoints->length() );
return;
}
}
myNode1->setEnabled( false );
myNode2->setEnabled( false );
myNode1->setRange( 0, 0 );
myNode2->setRange( 0, 0 );
} }
} }
@ -893,7 +986,20 @@ void SMESHGUI_MeshPatternDlg::updateWgState()
void SMESHGUI_MeshPatternDlg::activateSelection() void SMESHGUI_MeshPatternDlg::activateSelection()
{ {
mySelection->ClearFilters(); mySelection->ClearFilters();
if ( mySelInput == Ids ) {
SMESH_Actor* anActor = SMESH::FindActorByObject( myMesh );
if ( anActor )
SMESH::SetPickable(anActor);
if ( myType == Type_2d )
QAD_Application::getDesktop()->SetSelectionMode( FaceSelection, true );
else
QAD_Application::getDesktop()->SetSelectionMode( CellSelection, true );
}
else {
SMESH::SetPickable();
QAD_Application::getDesktop()->SetSelectionMode( ActorSelection ); QAD_Application::getDesktop()->SetSelectionMode( ActorSelection );
}
if ( mySelInput == Object && !myMeshShape->_is_nil() ) if ( mySelInput == Object && !myMeshShape->_is_nil() )
{ {
@ -991,9 +1097,11 @@ void SMESHGUI_MeshPatternDlg::onTypeChanged( int theType )
mySelEdit[ Object ]->setText( "" ); mySelEdit[ Object ]->setText( "" );
mySelEdit[ Vertex1 ]->setText( "" ); mySelEdit[ Vertex1 ]->setText( "" );
mySelEdit[ Vertex2 ]->setText( "" ); mySelEdit[ Vertex2 ]->setText( "" );
mySelEdit[ Ids ] ->setText( "" );
if ( theType == Type_2d ) if ( theType == Type_2d )
{ {
// Geom widgets
mySelLbl [ Vertex2 ]->hide(); mySelLbl [ Vertex2 ]->hide();
mySelBtn [ Vertex2 ]->hide(); mySelBtn [ Vertex2 ]->hide();
mySelEdit[ Vertex2 ]->hide(); mySelEdit[ Vertex2 ]->hide();
@ -1002,9 +1110,14 @@ void SMESHGUI_MeshPatternDlg::onTypeChanged( int theType )
myPicture3d->hide(); myPicture3d->hide();
mySelLbl[ Object ]->setText( tr( "FACE" ) ); mySelLbl[ Object ]->setText( tr( "FACE" ) );
mySelLbl[ Vertex1 ]->setText( tr( "VERTEX" ) ); mySelLbl[ Vertex1 ]->setText( tr( "VERTEX" ) );
// Refine widgets
mySelLbl[ Ids ]->setText( tr( "MESH_FACES" ) );
myNode2Lbl->hide();
myNode2 ->hide();
} }
else else
{ {
// Geom widgets
mySelLbl [ Vertex2 ]->show(); mySelLbl [ Vertex2 ]->show();
mySelBtn [ Vertex2 ]->show(); mySelBtn [ Vertex2 ]->show();
mySelEdit[ Vertex2 ]->show(); mySelEdit[ Vertex2 ]->show();
@ -1014,6 +1127,10 @@ void SMESHGUI_MeshPatternDlg::onTypeChanged( int theType )
mySelLbl[ Object ]->setText( tr( "3D_BLOCK" ) ); mySelLbl[ Object ]->setText( tr( "3D_BLOCK" ) );
mySelLbl[ Vertex1 ]->setText( tr( "VERTEX1" ) ); mySelLbl[ Vertex1 ]->setText( tr( "VERTEX1" ) );
mySelLbl[ Vertex2 ]->setText( tr( "VERTEX2" ) ); mySelLbl[ Vertex2 ]->setText( tr( "VERTEX2" ) );
// Refine widgets
mySelLbl[ Ids ]->setText( tr( "MESH_VOLUMES" ) );
myNode2Lbl->show();
myNode2 ->show();
} }
mySelInput = Mesh; mySelInput = Mesh;
@ -1031,9 +1148,23 @@ vtkUnstructuredGrid* SMESHGUI_MeshPatternDlg::getGrid()
try try
{ {
// Get points from pattern // Get points from pattern
SMESH::point_array_var pnts = myType == Type_2d SMESH::point_array_var pnts;
? myPattern->ApplyToFace( myGeomObj[ Object ], myGeomObj[ Vertex1 ], myReverseChk->isChecked() ) QValueList<int> ids;
if ( isRefine() && getIds( ids ) ) {
SMESH::long_array_var varIds = new SMESH::long_array();
varIds->length( ids.count() );
int i = 0;
for ( QValueList<int>::iterator it = ids.begin(); it != ids.end(); ++it )
varIds[i++] = *it;
pnts = myType == Type_2d
? myPattern->ApplyToMeshFaces ( myMesh, varIds, getNode( false ), myReverseChk->isChecked() )
: myPattern->ApplyToHexahedrons( myMesh, varIds, getNode( false ), getNode( true ) );
}
else {
pnts = myType == Type_2d
? myPattern->ApplyToFace ( myGeomObj[ Object ], myGeomObj[ Vertex1 ], myReverseChk->isChecked() )
: myPattern->ApplyTo3DBlock( myGeomObj[ Object ], myGeomObj[ Vertex1 ], myGeomObj[ Vertex2 ] ); : myPattern->ApplyTo3DBlock( myGeomObj[ Object ], myGeomObj[ Vertex1 ], myGeomObj[ Vertex2 ] );
}
SMESH::array_of_long_array_var elemPoints = myPattern->GetElementPoints(); SMESH::array_of_long_array_var elemPoints = myPattern->GetElementPoints();
@ -1130,22 +1261,112 @@ vtkUnstructuredGrid* SMESHGUI_MeshPatternDlg::getGrid()
} }
} }
//=======================================================================
// name : onModeToggled
// Purpose :
//=======================================================================
void SMESHGUI_MeshPatternDlg::onModeToggled( bool on )
{
on ? myRefineGrp->show() : myRefineGrp->hide();
on ? myGeomGrp->hide() : myGeomGrp->show();
}
//=======================================================================
// name : isRefine
// Purpose :
//=======================================================================
bool SMESHGUI_MeshPatternDlg::isRefine() const
{
return myRefine->isChecked();
}
//=======================================================================
//function : onTextChanged
//purpose :
//=======================================================================
void SMESHGUI_MeshPatternDlg::onTextChanged(const QString& theNewText)
{
if ( myBusy || !isRefine() )
return;
myBusy = true;
if ( mySelInput != Ids ) {
mySelInput = Ids;
activateSelection();
}
// hilight entered elements/nodes
SMDS_Mesh* aMesh = 0;
SMESH_Actor* anActor = SMESH::FindActorByObject( myMesh );
if ( anActor )
aMesh = anActor->GetObject()->GetMesh();
if ( aMesh ) {
mySelection->ClearIObjects();
mySelection->AddIObject( anActor->getIO() );
QStringList aListId = QStringList::split( " ", theNewText, false);
for ( int i = 0; i < aListId.count(); i++ ) {
const SMDS_MeshElement * e = aMesh->FindElement( aListId[ i ].toInt() );
if ( e && e->GetType() == ( myType == Type_2d ? SMDSAbs_Face : SMDSAbs_Volume ) ) {
if ( !mySelection->IsIndexSelected( anActor->getIO(), e->GetID() ) )
mySelection->AddOrRemoveIndex( anActor->getIO(), e->GetID(), true );
}
}
}
myBusy = false;
}
//=======================================================================
//function : onNodeChanged
//purpose :
//=======================================================================
void SMESHGUI_MeshPatternDlg::onNodeChanged( int value )
{
if ( myType == Type_3d ) {
QSpinBox* first = (QSpinBox*)sender();
QSpinBox* second = first == myNode1 ? myNode2 : myNode1;
int secondVal = second->value();
if ( secondVal == value ) {
secondVal = value == second->maxValue() ? second->minValue() : value + 1;
bool blocked = second->signalsBlocked();
second->blockSignals( true );
second->setValue( secondVal );
second->blockSignals( blocked );
}
}
displayPreview();
}
//=======================================================================
//function : getIds
//purpose :
//=======================================================================
bool SMESHGUI_MeshPatternDlg::getIds( QValueList<int>& ids ) const
{
ids.clear();
QStringList strIds = QStringList::split( " ", mySelEdit[Ids]->text() );
bool isOk;
int val;
for ( QStringList::iterator it = strIds.begin(); it != strIds.end(); ++it ) {
val = (*it).toInt( &isOk );
if ( isOk )
ids.append( val );
}
return ids.count();
}
//=======================================================================
//function : getNode1
//purpose :
//=======================================================================
int SMESHGUI_MeshPatternDlg::getNode( bool second ) const
{
return second ? myNode2->value() - 1 : myNode1->value() - 1;
}

View File

@ -45,6 +45,8 @@ class QRadioButton;
class QCheckBox; class QCheckBox;
class QButtonGroup; class QButtonGroup;
class QLabel; class QLabel;
class QSpinBox;
class QGroupBox;
class SMESHGUI_CreatePatternDlg; class SMESHGUI_CreatePatternDlg;
class SMESHGUI_PatternWidget; class SMESHGUI_PatternWidget;
class vtkUnstructuredGrid; class vtkUnstructuredGrid;
@ -63,7 +65,7 @@ class SMESHGUI_MeshPatternDlg : public QDialog
enum { Type_2d, Type_3d }; enum { Type_2d, Type_3d };
// selection input // selection input
enum { Mesh, Object, Vertex1, Vertex2 }; enum { Mesh, Object, Vertex1, Vertex2, Ids };
public: public:
SMESHGUI_MeshPatternDlg( QWidget*, SMESHGUI_MeshPatternDlg( QWidget*,
@ -85,12 +87,15 @@ private slots:
void onSelInputChanged(); void onSelInputChanged();
void onTypeChanged( int ); void onTypeChanged( int );
void onModeToggled( bool );
void onOpen(); void onOpen();
void onNew(); void onNew();
void onReverse( bool ); void onReverse( bool );
void onPreview( bool ); void onPreview( bool );
void onOkCreationDlg(); void onOkCreationDlg();
void onCloseCreationDlg(); void onCloseCreationDlg();
void onTextChanged( const QString& );
void onNodeChanged( int value );
private: private:
@ -108,6 +113,10 @@ private:
void enterEvent ( QEvent * ) ; void enterEvent ( QEvent * ) ;
bool isValid( const bool theMess = true ); bool isValid( const bool theMess = true );
void resetSelInput(); void resetSelInput();
bool isRefine() const;
bool getIds( QValueList<int>& ) const;
int getNode( bool = false ) const;
private: private:
@ -119,6 +128,14 @@ private:
QRadioButton* mySwitch2d; QRadioButton* mySwitch2d;
QRadioButton* mySwitch3d; QRadioButton* mySwitch3d;
QCheckBox* myRefine;
QFrame* myRefineGrp;
QSpinBox* myNode1;
QSpinBox* myNode2;
QLabel* myNode2Lbl;
QGroupBox* myGeomGrp;
QMap< int, QPushButton* > mySelBtn; QMap< int, QPushButton* > mySelBtn;
QMap< int, QLineEdit* > mySelEdit; QMap< int, QLineEdit* > mySelEdit;
QMap< int, QLabel* > mySelLbl; QMap< int, QLabel* > mySelLbl;
@ -139,6 +156,7 @@ private:
int myNbPoints; int myNbPoints;
int myType; int myType;
bool myIsCreateDlgOpen; bool myIsCreateDlgOpen;
bool myBusy;
SMESH::SMESH_Mesh_var myMesh; SMESH::SMESH_Mesh_var myMesh;
GEOM::GEOM_Object_var myMeshShape; GEOM::GEOM_Object_var myMeshShape;

View File

@ -70,6 +70,10 @@
#include <qpushbutton.h> #include <qpushbutton.h>
#include <qapplication.h> #include <qapplication.h>
// IDL Headers
#include "SALOMEconfig.h"
#include CORBA_SERVER_HEADER(SMESH_Group)
#define SPACING 5 #define SPACING 5
#define MARGIN 10 #define MARGIN 10
@ -152,11 +156,13 @@ QFrame* SMESHGUI_MultiEditDlg::createMainFrame( QWidget* theParent )
mySubmeshChk = new QCheckBox( tr( "SMESH_SUBMESH" ), aGrp ); mySubmeshChk = new QCheckBox( tr( "SMESH_SUBMESH" ), aGrp );
mySubmeshBtn = new QPushButton( aGrp ); mySubmeshBtn = new QPushButton( aGrp );
mySubmesh = new QLineEdit( aGrp ); mySubmesh = new QLineEdit( aGrp );
mySubmesh->setReadOnly( true );
mySubmeshBtn->setPixmap( aPix ); mySubmeshBtn->setPixmap( aPix );
myGroupChk = new QCheckBox( tr( "GROUP" ), aGrp ); myGroupChk = new QCheckBox( tr( "GROUP" ), aGrp );
myGroupBtn = new QPushButton( aGrp ); myGroupBtn = new QPushButton( aGrp );
myGroup = new QLineEdit( aGrp ); myGroup = new QLineEdit( aGrp );
myGroup->setReadOnly( true );
myGroupBtn->setPixmap( aPix ); myGroupBtn->setPixmap( aPix );
return aMainGrp; return aMainGrp;

View File

@ -46,6 +46,8 @@
#include "QAD_MessageBox.h" #include "QAD_MessageBox.h"
#include "SMESH_Actor.h" #include "SMESH_Actor.h"
#include "SMESH_ObjectDef.h"
#include "SMDS_Mesh.hxx" #include "SMDS_Mesh.hxx"
#include "SMDS_MeshNode.hxx" #include "SMDS_MeshNode.hxx"

View File

@ -602,7 +602,6 @@ void SMESHGUI_Preferences_ScalarBarDlg::onSelectionChanged()
myActor = anActor; myActor = anActor;
vtkScalarBarActor* myScalarBarActor = myActor->GetScalarBarActor(); vtkScalarBarActor* myScalarBarActor = myActor->GetScalarBarActor();
double aMin = 0.0, aMax = 0.0;
if ( myScalarBarActor->GetLookupTable() ) { if ( myScalarBarActor->GetLookupTable() ) {
float *range = myScalarBarActor->GetLookupTable()->GetRange(); float *range = myScalarBarActor->GetLookupTable()->GetRange();
myMinEdit->setText( QString::number( range[0] ) ); myMinEdit->setText( QString::number( range[0] ) );

View File

@ -246,7 +246,6 @@ void SMESHGUI_RenumberingDlg::ClickOnApply()
if ( !myMesh->_is_nil()) if ( !myMesh->_is_nil())
{ {
bool aResult = false;
try try
{ {
SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor(); SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();

View File

@ -56,6 +56,10 @@
#include <qvalidator.h> #include <qvalidator.h>
#include <qpixmap.h> #include <qpixmap.h>
// IDL Headers
#include "SALOMEconfig.h"
#include CORBA_SERVER_HEADER(SMESH_Group)
using namespace std; using namespace std;
//================================================================================= //=================================================================================

View File

@ -55,6 +55,10 @@
#include <qlayout.h> #include <qlayout.h>
#include <qpixmap.h> #include <qpixmap.h>
// IDL Headers
#include "SALOMEconfig.h"
#include CORBA_SERVER_HEADER(SMESH_Group)
using namespace std; using namespace std;
//================================================================================= //=================================================================================

View File

@ -58,6 +58,10 @@
#include <qvalidator.h> #include <qvalidator.h>
#include <qpixmap.h> #include <qpixmap.h>
// IDL Headers
#include "SALOMEconfig.h"
#include CORBA_SERVER_HEADER(SMESH_Group)
using namespace std; using namespace std;
//================================================================================= //=================================================================================

View File

@ -51,6 +51,7 @@ public :
void SetValue( double v ) ; void SetValue( double v ) ;
double GetValue() ; double GetValue() ;
QString GetString() ; QString GetString() ;
QLineEdit* editor() { return QAD_SpinBoxDbl::editor(); }
public slots: public slots:
void SetStep( double newStep ); void SetStep( double newStep );

View File

@ -55,6 +55,10 @@
#include <qlayout.h> #include <qlayout.h>
#include <qpixmap.h> #include <qpixmap.h>
// IDL Headers
#include "SALOMEconfig.h"
#include CORBA_SERVER_HEADER(SMESH_Group)
using namespace std; using namespace std;
//================================================================================= //=================================================================================

View File

@ -56,6 +56,10 @@
#include <qspinbox.h> #include <qspinbox.h>
#include <qpixmap.h> #include <qpixmap.h>
// IDL Headers
#include "SALOMEconfig.h"
#include CORBA_SERVER_HEADER(SMESH_Group)
using namespace std; using namespace std;
//================================================================================= //=================================================================================

View File

@ -50,6 +50,7 @@
#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes) #include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
#include "SMESH_Actor.h" #include "SMESH_Actor.h"
#include "SMESH_ObjectDef.h"
using namespace std; using namespace std;
@ -155,6 +156,19 @@ namespace SMESH{
} }
void RepaintViewFrame(VTKViewer_ViewFrame* theFrame)
{
theFrame->Repaint();
}
void RenderViewFrame(VTKViewer_ViewFrame* theFrame)
{
theFrame->getRW()->getRenderWindow()->Render();
theFrame->Repaint();
}
SMESH_Actor* FindActorByEntry(QAD_StudyFrame *theStudyFrame, SMESH_Actor* FindActorByEntry(QAD_StudyFrame *theStudyFrame,
const char* theEntry) const char* theEntry)
{ {
@ -506,7 +520,7 @@ namespace SMESH{
{ {
theName = ""; theName = "";
if(theIO->hasEntry()){ if(theIO->hasEntry()){
if(SMESH_Actor *anActor = FindActorByEntry(theIO->getEntry())){ if(FindActorByEntry(theIO->getEntry())){
TColStd_IndexedMapOfInteger aMapIndex; TColStd_IndexedMapOfInteger aMapIndex;
theSel->GetIndex(theIO,aMapIndex); theSel->GetIndex(theIO,aMapIndex);
for(int i = 1; i <= aMapIndex.Extent(); i++){ for(int i = 1; i <= aMapIndex.Extent(); i++){
@ -535,7 +549,7 @@ namespace SMESH{
{ {
theName = ""; theName = "";
if(theIO->hasEntry()){ if(theIO->hasEntry()){
if(SMESH_Actor *anActor = FindActorByEntry(theIO->getEntry())){ if(FindActorByEntry(theIO->getEntry())){
TColStd_IndexedMapOfInteger aMapIndex; TColStd_IndexedMapOfInteger aMapIndex;
theSel->GetIndex(theIO,aMapIndex); theSel->GetIndex(theIO,aMapIndex);
typedef std::set<int> TIdContainer; typedef std::set<int> TIdContainer;

View File

@ -63,6 +63,9 @@ namespace SMESH{
VTKViewer_ViewFrame* GetCurrentVtkView(); VTKViewer_ViewFrame* GetCurrentVtkView();
void RepaintViewFrame(VTKViewer_ViewFrame* theFrame);
void RenderViewFrame(VTKViewer_ViewFrame* theFrame);
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
SMESH_Actor* FindActorByEntry(QAD_StudyFrame *theStudyFrame, SMESH_Actor* FindActorByEntry(QAD_StudyFrame *theStudyFrame,

View File

@ -211,27 +211,12 @@ msgstr "pattern_sample_2d.png"
msgid "ICON_PATTERN_SAMPLE_3D" msgid "ICON_PATTERN_SAMPLE_3D"
msgstr "pattern_sample_3D.png" msgstr "pattern_sample_3D.png"
#-----------------------------------------------------------
# Add/Remove buttons
#-----------------------------------------------------------
msgid "ICON_APPEND"
msgstr "mesh_add.png"
msgid "ICON_REMOVE"
msgstr "mesh_remove.png"

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