diff --git a/Makefile.in b/Makefile.in
index 7b95934ee..dfbd2629a 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -27,6 +27,7 @@ mesh_algo_tetra.png \
mesh_angle.png \
mesh_area.png \
mesh_aspect.png \
+mesh_aspect_3d.png \
mesh_compute.png \
mesh_connectivity.png \
mesh_diagonal.png \
@@ -42,8 +43,11 @@ advanced_mesh_info.png \
standard_mesh_info.png \
mesh_init.png \
mesh_length.png \
+mesh_length_2d.png \
mesh_free_edges.png \
+mesh_free_edges_2d.png \
mesh_multi_edges.png \
+mesh_multi_edges_2d.png \
mesh_line_n.png \
mesh_line.png \
mesh_move_node.png \
@@ -95,6 +99,7 @@ mesh_smoothing.png \
mesh_renumbering_nodes.png \
mesh_renumbering_elements.png \
mesh_extrusion.png \
+mesh_extrusionpath.png \
mesh_revolution.png \
ModuleMesh.png \
mesh_unionGroups.png \
@@ -120,7 +125,9 @@ SMESHCatalog.xml \
flight_solid.brep \
mesh_pattern.png \
pattern_sample_2d.png \
-pattern_sample_3D.png
+pattern_sample_3D.png \
+mesh_add.png \
+mesh_remove.png
BIN_SCRIPT= \
VERSION
diff --git a/adm_local/unix/make_commence.in b/adm_local/unix/make_commence.in
index 43b015ee6..1a315f806 100644
--- a/adm_local/unix/make_commence.in
+++ b/adm_local/unix/make_commence.in
@@ -97,12 +97,6 @@ HDF5_INCLUDES=@HDF5_INCLUDES@
HDF5_LIBS=@HDF5_LIBS@
HDF5_MT_LIBS=@HDF5_MT_LIBS@
-# MED2
-
-MED2_INCLUDES=@MED2_INCLUDES@
-MED2_LIBS=@MED2_LIBS@
-MED2_MT_LIBS=@MED2_MT_LIBS@
-
# OpenCasCade
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_partial_specialization.m4 check_opengl.m4 python.m4 \
ac_cxx_typename.m4 check_pthreads.m4 check_cas.m4 \
-ac_cc_warnings.m4 check_qt.m4 check_med2.m4 \
-check_swig.m4 check_boost.m4
+ac_cc_warnings.m4 check_qt.m4 check_boost.m4 \
+check_swig.m4
$(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
diff --git a/configure.in.base b/configure.in.base
index 16b6b77fa..38caec219 100644
--- a/configure.in.base
+++ b/configure.in.base
@@ -233,14 +233,6 @@ echo
CHECK_HDF5
-echo
-echo ---------------------------------------------
-echo testing MED2
-echo ---------------------------------------------
-echo
-
-CHECK_MED2
-
echo
echo ---------------------------------------------
echo Testing OpenCascade
@@ -288,7 +280,7 @@ echo ---------------------------------------------
echo
echo Configure
-variables="cc_ok boost_ok lex_yacc_ok python_ok swig_ok threads_ok OpenGL_ok qt_ok vtk_ok hdf5_ok 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
do
diff --git a/doc/salome/tui/Makefile.in b/doc/salome/tui/Makefile.in
index 8d8b65de9..fa7151e47 100644
--- a/doc/salome/tui/Makefile.in
+++ b/doc/salome/tui/Makefile.in
@@ -16,13 +16,28 @@ doxygen=@DOXYGEN@
@COMMENCE@
+PYTHON_SCRIPTS = \
+ meshpy.py
+
docs:
cp -fr $(srcdir)/SMESH ./INPUT; \
cd INPUT; \
sed 's|../../../share/salome|$(root_srcdir)|' ./doxyfile > ./doxyfile1; \
mv -f doxyfile1 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/ SMESH/
cp -fr $(srcdir)/SMESH/HTML/ SMESH/
diff --git a/doc/salome/tui/SMESH/doxyfile_py b/doc/salome/tui/SMESH/doxyfile_py
new file mode 100755
index 000000000..8569636d5
--- /dev/null
+++ b/doc/salome/tui/SMESH/doxyfile_py
@@ -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 =
diff --git a/doc/salome/tui/SMESH/sources/myheader_py2.html b/doc/salome/tui/SMESH/sources/myheader_py2.html
new file mode 100755
index 000000000..372b2247f
--- /dev/null
+++ b/doc/salome/tui/SMESH/sources/myheader_py2.html
@@ -0,0 +1,24 @@
+
+
+
+
+
+ Main Page
+
+
+
+
+
+
+ |
+
+
+
+
+ |
+
+
+
+
+
+
diff --git a/doc/salome/tui/SMESH/sources/static/tree.js b/doc/salome/tui/SMESH/sources/static/tree.js
index e1c95ec93..b2a9953b2 100755
--- a/doc/salome/tui/SMESH/sources/static/tree.js
+++ b/doc/salome/tui/SMESH/sources/static/tree.js
@@ -18,5 +18,12 @@ aux1 = insFld(foldersTree, gFld("TUI Reference Guide", ""))
aux1 = insFld(foldersTree, gFld("IDL/Python mapping", ""))
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", ""))
insDoc(aux1, gLnk("Using Plugin mechanism in SMESH", "", "PluginMeshers.html"))
diff --git a/idl/SMESH_Filter.idl b/idl/SMESH_Filter.idl
index d1f0c3d9f..c66a90ea0 100644
--- a/idl/SMESH_Filter.idl
+++ b/idl/SMESH_Filter.idl
@@ -1,379 +1,423 @@
-// 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_Filter.idl
-// Author : Alexey Petrov, OCC
-
-#ifndef _SMESH_FILTER_IDL_
-#define _SMESH_FILTER_IDL_
-
-#include "SALOME_Exception.idl"
-#include "SALOME_GenericObj.idl"
-#include "SMESH_Mesh.idl"
-
-
-module GEOM
-{
- interface GEOM_Object;
-};
-
-
-module SMESH
-{
-
- /*!
- * Enumeration of functor types
- */
- enum FunctorType
- {
- FT_AspectRatio,
- FT_Warping,
- FT_MinimumAngle,
- FT_Taper,
- FT_Skew,
- FT_Area,
- FT_FreeBorders,
- FT_FreeEdges,
- FT_MultiConnection,
- FT_Length,
- FT_BelongToGeom,
- FT_BelongToPlane,
- FT_BelongToCylinder,
- FT_RangeOfIds,
- FT_LessThan,
- FT_MoreThan,
- FT_EqualTo,
- FT_LogicalNOT,
- FT_LogicalAND,
- FT_LogicalOR,
- FT_Undefined
- };
-
- /*!
- * Base interface for all functors ( i.e. numerical functors and predicates )
- */
- interface Functor: SALOME::GenericObj
- {
- void SetMesh( in SMESH_Mesh theMesh );
- FunctorType GetFunctorType();
- ElementType GetElementType();
- };
-
-
-
- /*!
- * Numerical functors are intended for calculating value by Id of mesh entity
- */
- interface NumericalFunctor: Functor
- {
- double GetValue( in long theElementId );
-
- /*!
- * Set precision for calculation. It is a position after point which is
- * used to functor value after calculation.
- */
- void SetPrecision( in long thePrecision );
- long GetPrecision();
- };
- interface MinimumAngle : NumericalFunctor{};
- interface AspectRatio : NumericalFunctor{};
- interface Warping : NumericalFunctor{};
- interface Taper : NumericalFunctor{};
- interface Skew : NumericalFunctor{};
- interface Area : NumericalFunctor{};
- interface Length : NumericalFunctor{};
- interface MultiConnection : NumericalFunctor{};
-
- /*!
- * Predicates are intended for verification of criteria,
- * must return bool value by mesh id
- */
- interface Predicate: Functor
- {
- boolean IsSatisfy( in long thEntityId );
- };
-
- /*!
- * Logical functor (predicate) "Belong To Geometry".
- * Verify whether mesh element or node belong to pointed Geom Object
- */
- interface BelongToGeom: Predicate
- {
- void SetGeom( in GEOM::GEOM_Object theGeom );
- void SetElementType( in ElementType theType );
-
- void SetShapeName( in string theName );
- string GetShapeName();
- };
-
- /*!
- * Logical functor (predicate) "Belong To Surface".
- * Base interface for "belong to plane" and "belong to cylinder interfaces"
- */
- interface BelongToSurface: Predicate
- {
- void SetTolerance( in double theToler );
- double GetTolerance();
- void SetShapeName( in string theName, in ElementType theType );
- string GetShapeName();
- };
-
-
- /*!
- * Logical functor (predicate) "Belong To Plane".
- * Verify whether mesh element lie in pointed Geom planar object
- */
- interface BelongToPlane: BelongToSurface
- {
- void SetPlane( in GEOM::GEOM_Object theGeom, in ElementType theType );
- };
-
- /*!
- * Logical functor (predicate) "Belong To Culinder".
- * Verify whether mesh element lie in pointed Geom cylindrical object
- */
- interface BelongToCylinder: BelongToSurface
- {
- void SetCylinder( in GEOM::GEOM_Object theGeom, in ElementType theType );
- };
-
- /*!
- * Logical functor (predicate) "Free borders".
- * Verify whether 1D mesh element is free ( i.e. connected to one face only )
- */
- interface FreeBorders: Predicate{};
-
- /*!
- * Logical functor (predicate) "Free edges".
- * Verify whether 2D mesh element has free edges( i.e. edges connected to one face only )
- */
- interface FreeEdges: Predicate
-
- {
- struct Border
- {
- long myElemId;
- long myPnt1, myPnt2;
- };
- typedef sequence Borders;
- Borders GetBorders();
- };
-
-
- /*!
- * Abstract logical functor (predicate) "RangeOfIds".
- * Verify whether an Entity Id belongs to defined sequence of id's
- */
- interface RangeOfIds: Predicate
- {
- void SetRange( in long_array theIds );
- boolean SetRangeStr( in string theRange );
- string GetRangeStr();
-
- void SetElementType( in ElementType theType );
- };
-
- /*!
- * Comparator. Predicate for compare value calculated
- * by numerical functor with threshold value
- */
- interface Comparator: Predicate
- {
- void SetMargin( in double theValue );
- void SetNumFunctor( in NumericalFunctor theFunct );
- double GetMargin();
- };
- interface LessThan: Comparator{};
- interface MoreThan: Comparator{};
- interface EqualTo : Comparator
- {
- void SetTolerance( in double theToler );
- double GetTolerance();
- };
-
- /*!
- * Logical predicates are intended for compose predicates using boolean operations
- */
- interface Logical: Predicate{};
-
- interface LogicalNOT: Logical
- {
- void SetPredicate(in Predicate thePredicate);
- };
-
- interface LogicalBinary: Logical
-{
- void SetPredicate1( in Predicate thePredicate );
- void SetPredicate2( in Predicate thePredicate );
- };
-
- interface LogicalAND: LogicalBinary{};
- interface LogicalOR : LogicalBinary{};
-
- /*!
- * Filter
- */
- interface Filter: SALOME::GenericObj
- {
- /*!
- * Structure containing information about one criterion
- * Type - FT_Taper, FT_Skew ...
- * Compare - FT_LessThan, FT_MoreThan, FT_EqualTo
- * Threshold - threshold value
- * UnaryOp - unary logical operation: FT_LogicalNOT or FT_Undefined
- * BinaryOp - binary logical operation FT_LogicalAND, FT_LogicalOR or
- * (FT_Undefined must be for the last criterion)
- * ThresholdStr - Threshold value defined as string. Used for:
- * 1. Diaposon of identifiers. Example: "1,2,3,5-10,12,27-29"
- * 2. BelongToGeom predicate for storing name of shape
- * Tolerance - Tolerance is used for comparators (EqualTo comparision) and for
- * "Belong to plane" and "Belong to cylinder" predicates
- * TypeOfElement - type of element SMESH::NODE, SMESH::FACE (used by BelongToGeom predicate only)
- * Precision - Precision of numerical functors
- */
- struct Criterion
- {
- long Type;
- long Compare;
- double Threshold;
- string ThresholdStr;
- long UnaryOp;
- long BinaryOp;
- double Tolerance;
- ElementType TypeOfElement;
- long Precision;
- };
-
- typedef sequence Criteria;
-
- void SetPredicate( in Predicate thePredicate );
- long_array GetElementsId( in SMESH_Mesh theMesh );
- ElementType GetElementType();
- Predicate GetPredicate();
-
- boolean GetCriteria( out Criteria theCriteria );
- boolean SetCriteria( in Criteria theCriteria );
- };
-
-
- /*!
- * Interface for working with library of filters
- */
- interface FilterLibrary : SALOME::GenericObj
- {
- /*!
- * Copy filter from library by name (new filter is created)
- */
- Filter Copy( in string theFilterName );
-
- /*!
- * Methods for editing library
- */
- boolean Add ( in string theFilterName, in Filter theFilter );
- boolean AddEmpty( in string theFilterName, in ElementType theType ); // add empty filter
- boolean Delete ( in string theFilterName );
- boolean Replace ( in string theFilterName, in string theNewName, in Filter theFilter );
-
- /*!
- * Save library on disk
- */
- boolean Save();
- boolean SaveAs( in string aFileName );
-
- /*!
- * Query methods
- */
- boolean IsPresent( in string aFilterName );
- long NbFilters( in ElementType aType );
- string_array GetNames( in ElementType aType );
- string_array GetAllNames();
- void SetFileName( in string aFilterName );
- string GetFileName();
- };
-
-
- /*!
- * Interface of Filter manager
- */
- interface FilterManager: SALOME::GenericObj
- {
- /*!
- * Create numerical functors
- */
- MinimumAngle CreateMinimumAngle();
- AspectRatio CreateAspectRatio();
- Warping CreateWarping();
- Taper CreateTaper();
- Skew CreateSkew();
- Area CreateArea();
- Length CreateLength();
- MultiConnection CreateMultiConnection();
-
- /*!
- * Create logical functors ( predicates )
- */
- BelongToGeom CreateBelongToGeom();
- BelongToPlane CreateBelongToPlane();
- BelongToCylinder CreateBelongToCylinder();
-
- FreeBorders CreateFreeBorders();
- FreeEdges CreateFreeEdges();
-
- RangeOfIds CreateRangeOfIds();
-
- /*!
- * Create comparators ( predicates )
- */
- LessThan CreateLessThan();
- MoreThan CreateMoreThan();
- EqualTo CreateEqualTo();
-
- /*!
- * Create boolean operations ( predicates )
- */
- LogicalNOT CreateLogicalNOT();
- LogicalAND CreateLogicalAND();
- LogicalOR CreateLogicalOR();
-
- /*!
- * Create filter
- */
- Filter CreateFilter();
-
- /*!
- * Load filter library. If libary does not exist it is created
- */
- FilterLibrary LoadLibrary( in string aFileName );
-
- /*!
- * Create new library
- */
- FilterLibrary CreateLibrary();
-
- /*!
- * Delete library
- */
- boolean DeleteLibrary( in string aFileName );
- };
-};
-
-
-#endif
+// 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_Filter.idl
+// Author : Alexey Petrov, OCC
+
+#ifndef _SMESH_FILTER_IDL_
+#define _SMESH_FILTER_IDL_
+
+#include "SALOME_Exception.idl"
+#include "SALOME_GenericObj.idl"
+#include "SMESH_Mesh.idl"
+
+
+module GEOM
+{
+ interface GEOM_Object;
+};
+
+
+module SMESH
+{
+
+ /*!
+ * Enumeration of functor types
+ */
+ enum FunctorType
+ {
+ FT_AspectRatio,
+ FT_AspectRatio3D,
+ FT_Warping,
+ FT_MinimumAngle,
+ FT_Taper,
+ FT_Skew,
+ FT_Area,
+ FT_FreeBorders,
+ FT_FreeEdges,
+ FT_MultiConnection,
+ FT_MultiConnection2D,
+ FT_Length,
+ FT_Length2D,
+ FT_BelongToGeom,
+ FT_BelongToPlane,
+ FT_BelongToCylinder,
+ FT_LyingOnGeom,
+ FT_RangeOfIds,
+ FT_LessThan,
+ FT_MoreThan,
+ FT_EqualTo,
+ FT_LogicalNOT,
+ FT_LogicalAND,
+ FT_LogicalOR,
+ FT_Undefined
+ };
+
+ /*!
+ * Base interface for all functors ( i.e. numerical functors and predicates )
+ */
+ interface Functor: SALOME::GenericObj
+ {
+ void SetMesh( in SMESH_Mesh theMesh );
+ FunctorType GetFunctorType();
+ ElementType GetElementType();
+ };
+
+
+
+ /*!
+ * Numerical functors are intended for calculating value by Id of mesh entity
+ */
+ interface NumericalFunctor: Functor
+ {
+ double GetValue( in long theElementId );
+
+ /*!
+ * Set precision for calculation. It is a position after point which is
+ * used to functor value after calculation.
+ */
+ void SetPrecision( in long thePrecision );
+ long GetPrecision();
+ };
+ interface MinimumAngle : NumericalFunctor{};
+ interface AspectRatio : NumericalFunctor{};
+ interface AspectRatio3D : NumericalFunctor{};
+ interface Warping : NumericalFunctor{};
+ interface Taper : NumericalFunctor{};
+ interface Skew : NumericalFunctor{};
+ interface Area : NumericalFunctor{};
+ interface Length : NumericalFunctor{};
+ interface Length2D : NumericalFunctor
+ {
+ struct Value
+ {
+ double myLength;
+ long myPnt1, myPnt2;
+ };
+ typedef sequence Values;
+ Values GetValues();
+ };
+ interface MultiConnection : NumericalFunctor{};
+ interface MultiConnection2D : NumericalFunctor
+ {
+ struct Value
+ {
+ long myNbConnects;
+ long myPnt1, myPnt2;
+ };
+
+ typedef sequence Values;
+ Values GetValues();
+ };
+
+ /*!
+ * Predicates are intended for verification of criteria,
+ * must return bool value by mesh id
+ */
+ interface Predicate: Functor
+ {
+ boolean IsSatisfy( in long thEntityId );
+ };
+
+ /*!
+ * Logical functor (predicate) "Belong To Geometry".
+ * Verify whether mesh element or node belong to pointed Geom Object
+ */
+ interface BelongToGeom: Predicate
+ {
+ void SetGeom( in GEOM::GEOM_Object theGeom );
+ void SetElementType( in ElementType theType );
+
+ void SetShapeName( in string theName );
+ string GetShapeName();
+ };
+
+ /*!
+ * Logical functor (predicate) "Belong To Surface".
+ * Base interface for "belong to plane" and "belong to cylinder interfaces"
+ */
+ interface BelongToSurface: Predicate
+ {
+ void SetTolerance( in double theToler );
+ double GetTolerance();
+ void SetShapeName( in string theName, in ElementType theType );
+ string GetShapeName();
+ };
+
+
+ /*!
+ * Logical functor (predicate) "Belong To Plane".
+ * Verify whether mesh element lie in pointed Geom planar object
+ */
+ interface BelongToPlane: BelongToSurface
+ {
+ void SetPlane( in GEOM::GEOM_Object theGeom, in ElementType theType );
+ };
+
+ /*!
+ * Logical functor (predicate) "Belong To Culinder".
+ * Verify whether mesh element lie in pointed Geom cylindrical object
+ */
+ interface BelongToCylinder: BelongToSurface
+ {
+ 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".
+ * Verify whether 1D mesh element is free ( i.e. connected to one face only )
+ */
+ interface FreeBorders: Predicate{};
+
+ /*!
+ * Logical functor (predicate) "Free edges".
+ * Verify whether 2D mesh element has free edges( i.e. edges connected to one face only )
+ */
+ interface FreeEdges: Predicate
+
+ {
+ struct Border
+ {
+ long myElemId;
+ long myPnt1, myPnt2;
+ };
+ typedef sequence Borders;
+ Borders GetBorders();
+ };
+
+
+ /*!
+ * Abstract logical functor (predicate) "RangeOfIds".
+ * Verify whether an Entity Id belongs to defined sequence of id's
+ */
+ interface RangeOfIds: Predicate
+ {
+ void SetRange( in long_array theIds );
+ boolean SetRangeStr( in string theRange );
+ string GetRangeStr();
+
+ void SetElementType( in ElementType theType );
+ };
+
+ /*!
+ * Comparator. Predicate for compare value calculated
+ * by numerical functor with threshold value
+ */
+ interface Comparator: Predicate
+ {
+ void SetMargin( in double theValue );
+ void SetNumFunctor( in NumericalFunctor theFunct );
+ double GetMargin();
+ };
+ interface LessThan: Comparator{};
+ interface MoreThan: Comparator{};
+ interface EqualTo : Comparator
+ {
+ void SetTolerance( in double theToler );
+ double GetTolerance();
+ };
+
+ /*!
+ * Logical predicates are intended for compose predicates using boolean operations
+ */
+ interface Logical: Predicate{};
+
+ interface LogicalNOT: Logical
+ {
+ void SetPredicate(in Predicate thePredicate);
+ };
+
+ interface LogicalBinary: Logical
+{
+ void SetPredicate1( in Predicate thePredicate );
+ void SetPredicate2( in Predicate thePredicate );
+ };
+
+ interface LogicalAND: LogicalBinary{};
+ interface LogicalOR : LogicalBinary{};
+
+ /*!
+ * Filter
+ */
+ interface Filter: SALOME::GenericObj
+ {
+ /*!
+ * Structure containing information about one criterion
+ * Type - FT_Taper, FT_Skew ...
+ * Compare - FT_LessThan, FT_MoreThan, FT_EqualTo
+ * Threshold - threshold value
+ * UnaryOp - unary logical operation: FT_LogicalNOT or FT_Undefined
+ * BinaryOp - binary logical operation FT_LogicalAND, FT_LogicalOR or
+ * (FT_Undefined must be for the last criterion)
+ * ThresholdStr - Threshold value defined as string. Used for:
+ * 1. Diaposon of identifiers. Example: "1,2,3,5-10,12,27-29"
+ * 2. BelongToGeom predicate for storing name of shape
+ * Tolerance - Tolerance is used for comparators (EqualTo comparision) and for
+ * "Belong to plane" and "Belong to cylinder" predicates
+ * TypeOfElement - type of element SMESH::NODE, SMESH::FACE (used by BelongToGeom predicate only)
+ * Precision - Precision of numerical functors
+ */
+ struct Criterion
+ {
+ long Type;
+ long Compare;
+ double Threshold;
+ string ThresholdStr;
+ long UnaryOp;
+ long BinaryOp;
+ double Tolerance;
+ ElementType TypeOfElement;
+ long Precision;
+ };
+
+ typedef sequence Criteria;
+
+ void SetPredicate( in Predicate thePredicate );
+ long_array GetElementsId( in SMESH_Mesh theMesh );
+ ElementType GetElementType();
+ Predicate GetPredicate();
+
+ boolean GetCriteria( out Criteria theCriteria );
+ boolean SetCriteria( in Criteria theCriteria );
+ };
+
+
+ /*!
+ * Interface for working with library of filters
+ */
+ interface FilterLibrary : SALOME::GenericObj
+ {
+ /*!
+ * Copy filter from library by name (new filter is created)
+ */
+ Filter Copy( in string theFilterName );
+
+ /*!
+ * Methods for editing library
+ */
+ boolean Add ( in string theFilterName, in Filter theFilter );
+ boolean AddEmpty( in string theFilterName, in ElementType theType ); // add empty filter
+ boolean Delete ( in string theFilterName );
+ boolean Replace ( in string theFilterName, in string theNewName, in Filter theFilter );
+
+ /*!
+ * Save library on disk
+ */
+ boolean Save();
+ boolean SaveAs( in string aFileName );
+
+ /*!
+ * Query methods
+ */
+ boolean IsPresent( in string aFilterName );
+ long NbFilters( in ElementType aType );
+ string_array GetNames( in ElementType aType );
+ string_array GetAllNames();
+ void SetFileName( in string aFilterName );
+ string GetFileName();
+ };
+
+
+ /*!
+ * Interface of Filter manager
+ */
+ interface FilterManager: SALOME::GenericObj
+ {
+ /*!
+ * Create numerical functors
+ */
+ MinimumAngle CreateMinimumAngle();
+ AspectRatio CreateAspectRatio();
+ AspectRatio3D CreateAspectRatio3D();
+ Warping CreateWarping();
+ Taper CreateTaper();
+ Skew CreateSkew();
+ Area CreateArea();
+ Length CreateLength();
+ Length2D CreateLength2D();
+ MultiConnection CreateMultiConnection();
+ MultiConnection2D CreateMultiConnection2D();
+
+ /*!
+ * Create logical functors ( predicates )
+ */
+ BelongToGeom CreateBelongToGeom();
+ BelongToPlane CreateBelongToPlane();
+ BelongToCylinder CreateBelongToCylinder();
+
+ LyingOnGeom CreateLyingOnGeom();
+
+ FreeBorders CreateFreeBorders();
+ FreeEdges CreateFreeEdges();
+
+ RangeOfIds CreateRangeOfIds();
+
+ /*!
+ * Create comparators ( predicates )
+ */
+ LessThan CreateLessThan();
+ MoreThan CreateMoreThan();
+ EqualTo CreateEqualTo();
+
+ /*!
+ * Create boolean operations ( predicates )
+ */
+ LogicalNOT CreateLogicalNOT();
+ LogicalAND CreateLogicalAND();
+ LogicalOR CreateLogicalOR();
+
+ /*!
+ * Create filter
+ */
+ Filter CreateFilter();
+
+ /*!
+ * Load filter library. If libary does not exist it is created
+ */
+ FilterLibrary LoadLibrary( in string aFileName );
+
+ /*!
+ * Create new library
+ */
+ FilterLibrary CreateLibrary();
+
+ /*!
+ * Delete library
+ */
+ boolean DeleteLibrary( in string aFileName );
+ };
+};
+
+
+#endif
diff --git a/idl/SMESH_Mesh.idl b/idl/SMESH_Mesh.idl
index d64d9389f..77d9d186e 100644
--- a/idl/SMESH_Mesh.idl
+++ b/idl/SMESH_Mesh.idl
@@ -132,6 +132,15 @@ module SMESH
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_array;
@@ -315,12 +324,18 @@ module SMESH
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);
void ExportMED( in string file, in boolean auto_groups )
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 )
raises (SALOME::SALOME_Exception);
void ExportSTL( in string file, in boolean isascii )
@@ -335,6 +350,9 @@ module SMESH
long NbNodes()
raises (SALOME::SALOME_Exception);
+ long NbElements()
+ raises (SALOME::SALOME_Exception);
+
long NbEdges()
raises (SALOME::SALOME_Exception);
@@ -365,6 +383,15 @@ module SMESH
long NbSubMesh()
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();
};
@@ -508,6 +535,24 @@ module SMESH
in DirStruct StepVector,
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 };
void Mirror (in long_array IDsOfElements,
diff --git a/idl/SMESH_Pattern.idl b/idl/SMESH_Pattern.idl
index 1b626ad5e..f02fe4326 100644
--- a/idl/SMESH_Pattern.idl
+++ b/idl/SMESH_Pattern.idl
@@ -79,6 +79,28 @@ module SMESH
in GEOM::GEOM_Object theVertex000,
in GEOM::GEOM_Object theVertex001);
+ /*!
+ * Compute nodes coordinates applying
+ * the loaded pattern to mesh faces. The first key-point
+ * will be mapped into -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 -th node of each volume.
+ * The (0,0,1) key-point will be mapped into -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 using nodes
* coordinates computed by either of Apply...() methods
diff --git a/resources/SMESH_en.xml b/resources/SMESH_en.xml
index b574a7f2f..0bbbc4597 100644
--- a/resources/SMESH_en.xml
+++ b/resources/SMESH_en.xml
@@ -73,16 +73,21 @@
+
-
-
-
+
+
+
+
+
-
+
+
+
@@ -122,6 +127,7 @@
+
@@ -129,7 +135,7 @@
-
+
@@ -145,7 +151,11 @@
-
+
+
+
+
+
@@ -230,23 +240,36 @@
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
+
+
+
-
+
-
+
@@ -272,23 +295,36 @@
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
+
+
+
-
+
-
+
@@ -316,23 +352,36 @@
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
+
+
+
-
+
-
+
@@ -370,15 +419,20 @@
-
-
-
+
+
+
+
+
+
-
+
+
+
@@ -411,6 +465,7 @@
+
diff --git a/resources/mesh_add.png b/resources/mesh_add.png
new file mode 100755
index 000000000..2dde69a72
Binary files /dev/null and b/resources/mesh_add.png differ
diff --git a/resources/mesh_aspect_3d.png b/resources/mesh_aspect_3d.png
new file mode 100644
index 000000000..479263444
Binary files /dev/null and b/resources/mesh_aspect_3d.png differ
diff --git a/resources/mesh_extrusionpath.png b/resources/mesh_extrusionpath.png
new file mode 100644
index 000000000..47f0aa76a
Binary files /dev/null and b/resources/mesh_extrusionpath.png differ
diff --git a/resources/mesh_free_edges_2d.png b/resources/mesh_free_edges_2d.png
new file mode 100644
index 000000000..cc6cdb8ad
Binary files /dev/null and b/resources/mesh_free_edges_2d.png differ
diff --git a/resources/mesh_length_2d.png b/resources/mesh_length_2d.png
new file mode 100644
index 000000000..0009dc0cc
Binary files /dev/null and b/resources/mesh_length_2d.png differ
diff --git a/resources/mesh_multi_edges_2d.png b/resources/mesh_multi_edges_2d.png
new file mode 100644
index 000000000..627ceebbf
Binary files /dev/null and b/resources/mesh_multi_edges_2d.png differ
diff --git a/resources/mesh_remove.png b/resources/mesh_remove.png
new file mode 100755
index 000000000..960f1ac00
Binary files /dev/null and b/resources/mesh_remove.png differ
diff --git a/src/Controls/Makefile.in b/src/Controls/Makefile.in
index 556958d66..2a862b834 100644
--- a/src/Controls/Makefile.in
+++ b/src/Controls/Makefile.in
@@ -31,7 +31,7 @@ VPATH=.:@srcdir@:@top_srcdir@/idl:$(top_builddir)/idl
@COMMENCE@
-EXPORT_HEADERS = SMESH_Controls.hxx
+EXPORT_HEADERS = SMESH_Controls.hxx SMESH_ControlsDef.hxx
# Libraries targets
diff --git a/src/Controls/SMESHControls.cxx b/src/Controls/SMESHControls.cxx
index 10ecd711a..0c8d145a3 100644
--- a/src/Controls/SMESHControls.cxx
+++ b/src/Controls/SMESHControls.cxx
@@ -17,7 +17,7 @@
//
// 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)
{
@@ -29,7 +29,9 @@ int main(int argc, char** argv)
new Skew();
new Area();
new Length();
+ // new Length2D();
new MultiConnection();
+ // new MultiConnection2D();
new FreeBorders();
new LessThan();
new MoreThan();
diff --git a/src/Controls/SMESH_Controls.cxx b/src/Controls/SMESH_Controls.cxx
index a0dd64e13..2bf885a7a 100644
--- a/src/Controls/SMESH_Controls.cxx
+++ b/src/Controls/SMESH_Controls.cxx
@@ -17,7 +17,7 @@
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-#include "SMESH_Controls.hxx"
+#include "SMESH_ControlsDef.hxx"
#include
@@ -33,7 +33,6 @@
#include
#include
#include
-#include
#include
#include
#include
@@ -48,78 +47,79 @@
#include "SMDS_MeshNode.hxx"
-
/*
AUXILIARY METHODS
*/
-static inline double getAngle( const gp_XYZ& P1, const gp_XYZ& P2, const gp_XYZ& P3 )
-{
- gp_Vec v1( P1 - P2 ), v2( P3 - P2 );
-
- return v1.Magnitude() < gp::Resolution() ||
- v2.Magnitude() < gp::Resolution() ? 0 : v1.Angle( v2 );
-}
-
-static inline double getArea( const gp_XYZ& P1, const gp_XYZ& P2, const gp_XYZ& P3 )
-{
- gp_Vec aVec1( P2 - P1 );
- gp_Vec aVec2( P3 - P1 );
- return ( aVec1 ^ aVec2 ).Magnitude() * 0.5;
-}
-
-static inline double getArea( const gp_Pnt& P1, const gp_Pnt& P2, const gp_Pnt& P3 )
-{
- return getArea( P1.XYZ(), P2.XYZ(), P3.XYZ() );
-}
-
-static inline double getDistance( const gp_XYZ& P1, const gp_XYZ& P2 )
-{
- double aDist = gp_Pnt( P1 ).Distance( gp_Pnt( P2 ) );
- return aDist;
-}
-
-static int getNbMultiConnection( SMDS_Mesh* theMesh, const int theId )
-{
- if ( theMesh == 0 )
- return 0;
-
- const SMDS_MeshElement* anEdge = theMesh->FindElement( theId );
- if ( anEdge == 0 || anEdge->GetType() != SMDSAbs_Edge || anEdge->NbNodes() != 2 )
- return 0;
-
- TColStd_MapOfInteger aMap;
-
- int aResult = 0;
- SMDS_ElemIteratorPtr anIter = anEdge->nodesIterator();
- if ( anIter != 0 )
+namespace{
+ inline double getAngle( const gp_XYZ& P1, const gp_XYZ& P2, const gp_XYZ& P3 )
{
- while( anIter->more() )
- {
- const SMDS_MeshNode* aNode = (SMDS_MeshNode*)anIter->next();
- if ( aNode == 0 )
- return 0;
- 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 ) )
- aResult++;
- }
- }
- }
+ gp_Vec v1( P1 - P2 ), v2( P3 - P2 );
+
+ return v1.Magnitude() < gp::Resolution() ||
+ v2.Magnitude() < gp::Resolution() ? 0 : v1.Angle( v2 );
+ }
+
+ inline double getArea( const gp_XYZ& P1, const gp_XYZ& P2, const gp_XYZ& P3 )
+ {
+ gp_Vec aVec1( P2 - P1 );
+ gp_Vec aVec2( P3 - P1 );
+ return ( aVec1 ^ aVec2 ).Magnitude() * 0.5;
+ }
+
+ inline double getArea( const gp_Pnt& P1, const gp_Pnt& P2, const gp_Pnt& P3 )
+ {
+ return getArea( P1.XYZ(), P2.XYZ(), P3.XYZ() );
+ }
+
+
+
+ inline double getDistance( const gp_XYZ& P1, const gp_XYZ& P2 )
+ {
+ double aDist = gp_Pnt( P1 ).Distance( gp_Pnt( P2 ) );
+ return aDist;
+ }
+
+ int getNbMultiConnection( SMDS_Mesh* theMesh, const int theId )
+ {
+ if ( theMesh == 0 )
+ return 0;
+
+ const SMDS_MeshElement* anEdge = theMesh->FindElement( theId );
+ if ( anEdge == 0 || anEdge->GetType() != SMDSAbs_Edge || anEdge->NbNodes() != 2 )
+ return 0;
+
+ TColStd_MapOfInteger aMap;
+
+ int aResult = 0;
+ SMDS_ElemIteratorPtr anIter = anEdge->nodesIterator();
+ if ( anIter != 0 ) {
+ while( anIter->more() ) {
+ const SMDS_MeshNode* aNode = (SMDS_MeshNode*)anIter->next();
+ if ( aNode == 0 )
+ return 0;
+ 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 ) )
+ aResult++;
+ }
+ }
+ }
+ }
+
+ return aResult;
}
- return aResult;
}
+
using namespace SMESH::Controls;
/*
@@ -141,10 +141,10 @@ void NumericalFunctor::SetMesh( SMDS_Mesh* theMesh )
myMesh = theMesh;
}
-bool NumericalFunctor::GetPoints(const int theId,
- TColgp_SequenceOfXYZ& theRes ) const
+bool NumericalFunctor::GetPoints(const int theId,
+ TSequenceOfXYZ& theRes ) const
{
- theRes.Clear();
+ theRes.clear();
if ( myMesh == 0 )
return false;
@@ -153,9 +153,9 @@ bool NumericalFunctor::GetPoints(const int theId,
}
bool NumericalFunctor::GetPoints(const SMDS_MeshElement* anElem,
- TColgp_SequenceOfXYZ& theRes )
+ TSequenceOfXYZ& theRes )
{
- theRes.Clear();
+ theRes.clear();
if ( anElem == 0)
return false;
@@ -167,8 +167,9 @@ bool NumericalFunctor::GetPoints(const SMDS_MeshElement* anElem,
while( anIter->more() )
{
const SMDS_MeshNode* aNode = (SMDS_MeshNode*)anIter->next();
- if ( aNode != 0 )
- theRes.Append( gp_XYZ( aNode->X(), aNode->Y(), aNode->Z() ) );
+ if ( aNode != 0 ){
+ 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 )
{
- TColgp_SequenceOfXYZ P;
+ TSequenceOfXYZ P;
if ( GetPoints( theId, P ))
{
double aVal = GetValue( P );
@@ -196,7 +197,6 @@ double NumericalFunctor::GetValue( long theId )
double prec = pow( 10., (double)( myPrecision ) );
aVal = floor( aVal * prec + 0.5 ) / prec;
}
-
return aVal;
}
@@ -208,11 +208,11 @@ double NumericalFunctor::GetValue( long theId )
Description : Functor for calculation of minimum angle
*/
-double MinimumAngle::GetValue( const TColgp_SequenceOfXYZ& P )
+double MinimumAngle::GetValue( const TSequenceOfXYZ& P )
{
double aMin;
- if ( P.Length() == 3 )
+ if ( P.size() == 3 )
{
double A0 = getAngle( P( 3 ), P( 1 ), P( 2 ) );
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 ) );
}
- else if ( P.Length() == 4 )
+ else if ( P.size() == 4 )
{
double A0 = getAngle( P( 4 ), P( 1 ), P( 2 ) );
double A1 = getAngle( P( 1 ), P( 2 ), P( 3 ) );
@@ -251,9 +251,9 @@ SMDSAbs_ElementType MinimumAngle::GetType() const
Class : AspectRatio
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 )
return 0;
@@ -306,65 +306,81 @@ SMDSAbs_ElementType AspectRatio::GetType() const
Class : AspectRatio3D
Description : Functor for calculating aspect ratio
*/
+namespace{
+
+ inline double getHalfPerimeter(double theTria[3]){
+ return (theTria[0] + theTria[1] + theTria[2])/2.0;
+ }
+
+ inline double getArea(double theHalfPerim, double theTria[3]){
+ return sqrt(theHalfPerim*
+ (theHalfPerim-theTria[0])*
+ (theHalfPerim-theTria[1])*
+ (theHalfPerim-theTria[2]));
+ }
+
+ inline double getVolume(double theLen[6]){
+ double a2 = theLen[0]*theLen[0];
+ double b2 = theLen[1]*theLen[1];
+ double c2 = theLen[2]*theLen[2];
+ double d2 = theLen[3]*theLen[3];
+ double e2 = theLen[4]*theLen[4];
+ double f2 = theLen[5]*theLen[5];
+ double P = 4.0*a2*b2*d2;
+ 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);
+ return sqrt(P-Q+R)/12.0;
+ }
+
+ inline double getVolume2(double theLen[6]){
+ double a2 = theLen[0]*theLen[0];
+ double b2 = theLen[1]*theLen[1];
+ double c2 = theLen[2]*theLen[2];
+ double d2 = theLen[3]*theLen[3];
+ double e2 = theLen[4]*theLen[4];
+ double f2 = theLen[5]*theLen[5];
+
+ double P = a2*e2*(b2+c2+d2+f2-a2-e2);
+ double Q = b2*f2*(a2+c2+d2+e2-b2-f2);
+ double R = c2*d2*(a2+b2+e2+f2-c2-d2);
+ double S = a2*b2*d2+b2*c2*e2+a2*c2*f2+d2*e2*f2;
+
+ 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;
+ }
-static inline double getHalfPerimeter(double theTria[3]){
- return (theTria[0] + theTria[1] + theTria[2])/2.0;
}
-static inline double getArea(double theHalfPerim, double theTria[3]){
- return sqrt(theHalfPerim*
- (theHalfPerim-theTria[0])*
- (theHalfPerim-theTria[1])*
- (theHalfPerim-theTria[2]));
-}
-
-static inline double getVolume(double theLen[6]){
- double a2 = theLen[0]*theLen[0];
- double b2 = theLen[1]*theLen[1];
- double c2 = theLen[2]*theLen[2];
- double d2 = theLen[3]*theLen[3];
- double e2 = theLen[4]*theLen[4];
- double f2 = theLen[5]*theLen[5];
- double P = 4.0*a2*b2*d2;
- 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);
- return sqrt(P-Q+R)/12.0;
-}
-
-static inline double getHeight( const gp_Pnt& P1, const gp_Pnt& P2,
- const gp_Pnt& P3, const gp_Pnt& P4)
-{
- gp_Vec aVec1( P2.XYZ() - P1.XYZ() );
- gp_Vec aVec2( P3.XYZ() - P1.XYZ() );
- gp_Vec aNorm = aVec1 ^ aVec2;
- aNorm /= aNorm.Magnitude();
- gp_Vec aVec3( P4.XYZ() - P1.XYZ() );
- double aDist = aVec1 * aVec2;
- return fabs( aDist );
-}
-
-static inline double getMaxHeight( const TColgp_SequenceOfXYZ& P )
-{
- double aHeight = getHeight(P(1),P(2),P(3),P(4));
- aHeight = max(aHeight,getHeight(P(1),P(2),P(4),P(3)));
- 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 aHeight;
-}
-
-double AspectRatio3D::GetValue( const TColgp_SequenceOfXYZ& P )
+double AspectRatio3D::GetValue( const TSequenceOfXYZ& P )
{
double aQuality = 0.0;
- int nbNodes = P.Length();
+ int nbNodes = P.size();
switch(nbNodes){
case 4:{
double aLen[6] = {
- getDistance(P(1),P(2)), // a
- getDistance(P(2),P(3)), // b
- getDistance(P(3),P(1)), // c
- getDistance(P(2),P(4)), // d
- getDistance(P(3),P(4)), // e
- getDistance(P(1),P(4)) // f
+ getDistance(P( 1 ),P( 2 )), // a
+ getDistance(P( 2 ),P( 3 )), // b
+ getDistance(P( 3 ),P( 1 )), // c
+ getDistance(P( 2 ),P( 4 )), // d
+ getDistance(P( 3 ),P( 4 )), // e
+ getDistance(P( 1 ),P( 4 )) // f
};
double aTria[4][3] = {
{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[2],aLen[4],aLen[5]} // cef
};
- double aHalfPerim = getHalfPerimeter(aTria[0]);
- double anArea = getArea(aHalfPerim,aTria[0]);
- aHalfPerim = getHalfPerimeter(aTria[1]);
- anArea += getArea(aHalfPerim,aTria[1]);
- aHalfPerim = getHalfPerimeter(aTria[2]);
- anArea += getArea(aHalfPerim,aTria[2]);
- double aVolume = getVolume(aLen);
- double aHeight = getMaxHeight(P);
- aQuality = 1.0/3.0*aHeight*anArea/aVolume;
+ double aSumArea = 0.0;
+ double aHalfPerimeter = getHalfPerimeter(aTria[0]);
+ double anArea = getArea(aHalfPerimeter,aTria[0]);
+ aSumArea += anArea;
+ aHalfPerimeter = getHalfPerimeter(aTria[1]);
+ anArea = getArea(aHalfPerimeter,aTria[1]);
+ aSumArea += anArea;
+ aHalfPerimeter = getHalfPerimeter(aTria[2]);
+ 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;
}
}
@@ -405,9 +611,9 @@ SMDSAbs_ElementType AspectRatio3D::GetType() const
Class : 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;
gp_XYZ G = ( P( 1 ) + P( 2 ) + P( 3 ) + P( 4 ) ) / 4;
@@ -462,9 +668,9 @@ SMDSAbs_ElementType Warping::GetType() const
Class : 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;
// 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 );
}
-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;
// Compute skew
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 A1 = fabs( PI2 - skewAngle( P( 1 ), P( 2 ), P( 3 ) ) );
@@ -562,11 +768,11 @@ SMDSAbs_ElementType Skew::GetType() const
Class : 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 ) );
- 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 ) );
else
return 0;
@@ -587,9 +793,9 @@ SMDSAbs_ElementType Area::GetType() const
Class : Length
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
@@ -602,12 +808,198 @@ SMDSAbs_ElementType Length::GetType() const
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
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;
}
@@ -626,6 +1018,148 @@ SMDSAbs_ElementType MultiConnection::GetType() const
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: "<
-#include
-#include
-#include
-
-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 Controls{
- class Functor
- {
- public:
- ~Functor(){}
- virtual void SetMesh( SMDS_Mesh* theMesh ) = 0;
- virtual SMDSAbs_ElementType GetType() const = 0;
- };
+
+ class Functor;
typedef boost::shared_ptr 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,
- TColgp_SequenceOfXYZ& theRes ) const;
- static bool GetPoints (const SMDS_MeshElement* theElem,
- TColgp_SequenceOfXYZ& theRes );
- protected:
- SMDS_Mesh* myMesh;
- long myPrecision;
- };
+
+ class NumericalFunctor;
typedef boost::shared_ptr NumericalFunctorPtr;
- /*
- 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;
- };
+ class Predicate;
typedef boost::shared_ptr 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 TBorders;
- void GetBoreders(TBorders& theBorders);
-
- protected:
- SMDS_Mesh* myMesh;
- };
- typedef boost::shared_ptr 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 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 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 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 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 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 TMapOfLink;
- typedef std::vector TVectorOfFacePtr;
- typedef std::vector TVectorOfLink;
- typedef std::map TDataMapFacePtrInt;
- typedef std::map 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 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 ElementsOnSurfacePtr;
-
-
- /*
- FILTER
- */
- class Filter{
- public:
- Filter();
- virtual ~Filter();
- virtual void SetPredicate(PredicatePtr thePred);
- typedef std::vector TIdSequence;
- virtual TIdSequence GetElementsId( SMDS_Mesh* theMesh );
-
- protected:
- PredicatePtr myPredicate;
- };
- };
-};
+ }
+}
#endif
diff --git a/src/Controls/SMESH_ControlsDef.hxx b/src/Controls/SMESH_ControlsDef.hxx
new file mode 100644
index 000000000..50fb06558
--- /dev/null
+++ b/src/Controls/SMESH_ControlsDef.hxx
@@ -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
+#include