mesh_angle.png \
mesh_area.png \
mesh_aspect.png \
+mesh_aspect_3d.png \
mesh_compute.png \
mesh_connectivity.png \
mesh_diagonal.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 \
mesh_renumbering_nodes.png \
mesh_renumbering_elements.png \
mesh_extrusion.png \
+mesh_extrusionpath.png \
mesh_revolution.png \
ModuleMesh.png \
mesh_unionGroups.png \
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
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@
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
CHECK_HDF5
-echo
-echo ---------------------------------------------
-echo testing MED2
-echo ---------------------------------------------
-echo
-
-CHECK_MED2
-
echo
echo ---------------------------------------------
echo Testing OpenCascade
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
@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/
--- /dev/null
+# 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 =
--- /dev/null
+<!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>
+
+<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>
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"))
-// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,\r
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS \r
-// \r
-// This library is free software; you can redistribute it and/or \r
-// modify it under the terms of the GNU Lesser General Public \r
-// License as published by the Free Software Foundation; either \r
-// version 2.1 of the License. \r
-// \r
-// This library is distributed in the hope that it will be useful, \r
-// but WITHOUT ANY WARRANTY; without even the implied warranty of \r
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU \r
-// Lesser General Public License for more details. \r
-// \r
-// You should have received a copy of the GNU Lesser General Public \r
-// License along with this library; if not, write to the Free Software \r
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA \r
-// \r
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org \r
-//\r
-//\r
-//\r
-// File : SMESH_Filter.idl\r
-// Author : Alexey Petrov, OCC\r
-\r
-#ifndef _SMESH_FILTER_IDL_\r
-#define _SMESH_FILTER_IDL_\r
-\r
-#include "SALOME_Exception.idl"\r
-#include "SALOME_GenericObj.idl"\r
-#include "SMESH_Mesh.idl"\r
-\r
-\r
-module GEOM\r
-{\r
- interface GEOM_Object;\r
-};\r
-\r
-\r
-module SMESH\r
-{\r
-\r
- /*!\r
- * Enumeration of functor types\r
- */\r
- enum FunctorType\r
- {\r
- FT_AspectRatio,\r
- FT_Warping, \r
- FT_MinimumAngle,\r
- FT_Taper, \r
- FT_Skew, \r
- FT_Area, \r
- FT_FreeBorders,\r
- FT_FreeEdges,\r
- FT_MultiConnection,\r
- FT_Length,\r
- FT_BelongToGeom,\r
- FT_BelongToPlane,\r
- FT_BelongToCylinder,\r
- FT_RangeOfIds,\r
- FT_LessThan,\r
- FT_MoreThan,\r
- FT_EqualTo,\r
- FT_LogicalNOT,\r
- FT_LogicalAND,\r
- FT_LogicalOR,\r
- FT_Undefined\r
- };\r
-\r
- /*!\r
- * Base interface for all functors ( i.e. numerical functors and predicates )\r
- */\r
- interface Functor: SALOME::GenericObj\r
- {\r
- void SetMesh( in SMESH_Mesh theMesh );\r
- FunctorType GetFunctorType();\r
- ElementType GetElementType();\r
- };\r
-\r
-\r
-\r
- /*!\r
- * Numerical functors are intended for calculating value by Id of mesh entity\r
- */\r
- interface NumericalFunctor: Functor\r
- {\r
- double GetValue( in long theElementId );\r
-\r
- /*!\r
- * Set precision for calculation. It is a position after point which is\r
- * used to functor value after calculation.\r
- */\r
- void SetPrecision( in long thePrecision );\r
- long GetPrecision();\r
- };\r
- interface MinimumAngle : NumericalFunctor{};\r
- interface AspectRatio : NumericalFunctor{};\r
- interface Warping : NumericalFunctor{};\r
- interface Taper : NumericalFunctor{};\r
- interface Skew : NumericalFunctor{};\r
- interface Area : NumericalFunctor{};\r
- interface Length : NumericalFunctor{};\r
- interface MultiConnection : NumericalFunctor{};\r
-\r
- /*!\r
- * Predicates are intended for verification of criteria,\r
- * must return bool value by mesh id\r
- */\r
- interface Predicate: Functor\r
- {\r
- boolean IsSatisfy( in long thEntityId );\r
- };\r
-\r
- /*!\r
- * Logical functor (predicate) "Belong To Geometry".\r
- * Verify whether mesh element or node belong to pointed Geom Object\r
- */\r
- interface BelongToGeom: Predicate\r
- {\r
- void SetGeom( in GEOM::GEOM_Object theGeom );\r
- void SetElementType( in ElementType theType );\r
-\r
- void SetShapeName( in string theName );\r
- string GetShapeName(); \r
- };\r
-\r
- /*!\r
- * Logical functor (predicate) "Belong To Surface".\r
- * Base interface for "belong to plane" and "belong to cylinder interfaces"\r
- */\r
- interface BelongToSurface: Predicate\r
- {\r
- void SetTolerance( in double theToler );\r
- double GetTolerance();\r
- void SetShapeName( in string theName, in ElementType theType );\r
- string GetShapeName();\r
- };\r
-\r
-\r
- /*!\r
- * Logical functor (predicate) "Belong To Plane".\r
- * Verify whether mesh element lie in pointed Geom planar object\r
- */\r
- interface BelongToPlane: BelongToSurface\r
- {\r
- void SetPlane( in GEOM::GEOM_Object theGeom, in ElementType theType );\r
- };\r
-\r
- /*!\r
- * Logical functor (predicate) "Belong To Culinder".\r
- * Verify whether mesh element lie in pointed Geom cylindrical object\r
- */\r
- interface BelongToCylinder: BelongToSurface\r
- {\r
- void SetCylinder( in GEOM::GEOM_Object theGeom, in ElementType theType );\r
- };\r
-\r
- /*!\r
- * Logical functor (predicate) "Free borders".\r
- * Verify whether 1D mesh element is free ( i.e. connected to one face only )\r
- */\r
- interface FreeBorders: Predicate{};\r
-\r
- /*!\r
- * Logical functor (predicate) "Free edges".\r
- * Verify whether 2D mesh element has free edges( i.e. edges connected to one face only )\r
- */\r
- interface FreeEdges: Predicate\r
-\r
- {\r
- struct Border\r
- {\r
- long myElemId;\r
- long myPnt1, myPnt2;\r
- };\r
- typedef sequence<Border> Borders;\r
- Borders GetBorders();\r
- };\r
-\r
-\r
- /*!\r
- * Abstract logical functor (predicate) "RangeOfIds".\r
- * Verify whether an Entity Id belongs to defined sequence of id's\r
- */\r
- interface RangeOfIds: Predicate\r
- {\r
- void SetRange( in long_array theIds );\r
- boolean SetRangeStr( in string theRange );\r
- string GetRangeStr();\r
-\r
- void SetElementType( in ElementType theType );\r
- };\r
-\r
- /*!\r
- * Comparator. Predicate for compare value calculated\r
- * by numerical functor with threshold value\r
- */\r
- interface Comparator: Predicate\r
- {\r
- void SetMargin( in double theValue );\r
- void SetNumFunctor( in NumericalFunctor theFunct );\r
- double GetMargin();\r
- };\r
- interface LessThan: Comparator{};\r
- interface MoreThan: Comparator{};\r
- interface EqualTo : Comparator\r
- {\r
- void SetTolerance( in double theToler );\r
- double GetTolerance();\r
- };\r
-\r
- /*!\r
- * Logical predicates are intended for compose predicates using boolean operations\r
- */\r
- interface Logical: Predicate{};\r
-\r
- interface LogicalNOT: Logical\r
- {\r
- void SetPredicate(in Predicate thePredicate);\r
- };\r
-\r
- interface LogicalBinary: Logical\r
-{\r
- void SetPredicate1( in Predicate thePredicate );\r
- void SetPredicate2( in Predicate thePredicate );\r
- };\r
-\r
- interface LogicalAND: LogicalBinary{};\r
- interface LogicalOR : LogicalBinary{};\r
-\r
- /*!\r
- * Filter\r
- */\r
- interface Filter: SALOME::GenericObj\r
- {\r
- /*!\r
- * Structure containing information about one criterion\r
- * Type - FT_Taper, FT_Skew ...\r
- * Compare - FT_LessThan, FT_MoreThan, FT_EqualTo\r
- * Threshold - threshold value\r
- * UnaryOp - unary logical operation: FT_LogicalNOT or FT_Undefined\r
- * BinaryOp - binary logical operation FT_LogicalAND, FT_LogicalOR or\r
- * (FT_Undefined must be for the last criterion)\r
- * ThresholdStr - Threshold value defined as string. Used for:\r
- * 1. Diaposon of identifiers. Example: "1,2,3,5-10,12,27-29"\r
- * 2. BelongToGeom predicate for storing name of shape\r
- * Tolerance - Tolerance is used for comparators (EqualTo comparision) and for\r
- * "Belong to plane" and "Belong to cylinder" predicates\r
- * TypeOfElement - type of element SMESH::NODE, SMESH::FACE (used by BelongToGeom predicate only)\r
- * Precision - Precision of numerical functors\r
- */\r
- struct Criterion\r
- {\r
- long Type;\r
- long Compare;\r
- double Threshold;\r
- string ThresholdStr;\r
- long UnaryOp;\r
- long BinaryOp;\r
- double Tolerance;\r
- ElementType TypeOfElement;\r
- long Precision;\r
- };\r
-\r
- typedef sequence<Criterion> Criteria;\r
-\r
- void SetPredicate( in Predicate thePredicate );\r
- long_array GetElementsId( in SMESH_Mesh theMesh );\r
- ElementType GetElementType();\r
- Predicate GetPredicate();\r
-\r
- boolean GetCriteria( out Criteria theCriteria );\r
- boolean SetCriteria( in Criteria theCriteria );\r
- };\r
-\r
-\r
- /*!\r
- * Interface for working with library of filters\r
- */\r
- interface FilterLibrary : SALOME::GenericObj\r
- {\r
- /*!\r
- * Copy filter from library by name (new filter is created)\r
- */\r
- Filter Copy( in string theFilterName );\r
-\r
- /*!\r
- * Methods for editing library\r
- */\r
- boolean Add ( in string theFilterName, in Filter theFilter );\r
- boolean AddEmpty( in string theFilterName, in ElementType theType ); // add empty filter\r
- boolean Delete ( in string theFilterName );\r
- boolean Replace ( in string theFilterName, in string theNewName, in Filter theFilter );\r
-\r
- /*!\r
- * Save library on disk\r
- */\r
- boolean Save();\r
- boolean SaveAs( in string aFileName );\r
-\r
- /*!\r
- * Query methods\r
- */\r
- boolean IsPresent( in string aFilterName );\r
- long NbFilters( in ElementType aType );\r
- string_array GetNames( in ElementType aType );\r
- string_array GetAllNames();\r
- void SetFileName( in string aFilterName );\r
- string GetFileName();\r
- };\r
-\r
-\r
- /*!\r
- * Interface of Filter manager\r
- */\r
- interface FilterManager: SALOME::GenericObj\r
- {\r
- /*!\r
- * Create numerical functors\r
- */\r
- MinimumAngle CreateMinimumAngle();\r
- AspectRatio CreateAspectRatio();\r
- Warping CreateWarping();\r
- Taper CreateTaper();\r
- Skew CreateSkew();\r
- Area CreateArea();\r
- Length CreateLength();\r
- MultiConnection CreateMultiConnection();\r
-\r
- /*!\r
- * Create logical functors ( predicates )\r
- */\r
- BelongToGeom CreateBelongToGeom();\r
- BelongToPlane CreateBelongToPlane();\r
- BelongToCylinder CreateBelongToCylinder();\r
-\r
- FreeBorders CreateFreeBorders();\r
- FreeEdges CreateFreeEdges();\r
-\r
- RangeOfIds CreateRangeOfIds();\r
-\r
- /*!\r
- * Create comparators ( predicates )\r
- */\r
- LessThan CreateLessThan();\r
- MoreThan CreateMoreThan();\r
- EqualTo CreateEqualTo();\r
-\r
- /*!\r
- * Create boolean operations ( predicates )\r
- */\r
- LogicalNOT CreateLogicalNOT();\r
- LogicalAND CreateLogicalAND();\r
- LogicalOR CreateLogicalOR();\r
-\r
- /*!\r
- * Create filter\r
- */\r
- Filter CreateFilter();\r
-\r
- /*!\r
- * Load filter library. If libary does not exist it is created\r
- */\r
- FilterLibrary LoadLibrary( in string aFileName );\r
-\r
- /*!\r
- * Create new library\r
- */\r
- FilterLibrary CreateLibrary();\r
-\r
- /*!\r
- * Delete library\r
- */\r
- boolean DeleteLibrary( in string aFileName );\r
- };\r
-};\r
-\r
-\r
-#endif\r
+// 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<Value> Values;
+ Values GetValues();
+ };
+ 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,
+ * 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<Border> 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<Criterion> 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
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;
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 )
long NbNodes()
raises (SALOME::SALOME_Exception);
+ long NbElements()
+ raises (SALOME::SALOME_Exception);
+
long NbEdges()
raises (SALOME::SALOME_Exception);
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();
};
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,
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 <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
* coordinates computed by either of Apply...() methods
<!-- ************************** Control (menubar) ************************************ -->
<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="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="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="6012" pos-id="" label-id="Taper" icon-id="mesh_taper.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="6013" pos-id="" label-id="Aspect Ratio" icon-id="mesh_aspect.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
- <popup-item item-id="6014" pos-id="" label-id="Minimum angle" icon-id="mesh_angle.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+ <popup-item item-id="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="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>
<!-- ************************** Entity (menubar) ************************************ -->
<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="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="415" pos-id="" label-id="Pattern mapping" icon-id="mesh_pattern.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</menu-item>
<!-- ********************************* Settings (menubar) ********************************* -->
<menu-item label-id="Preferences" item-id="4" pos-id="">
<submenu label-id="Mesh" item-id="100" pos-id="-1">
- <submenu label-id="Display Mode" item-id="1000" pos-id="">
+ <submenu label-id="Display Mode" item-id="1000" pos-id="">
<popup-item item-id="10001" pos-id="" label-id="Wireframe" icon-id="mesh_wireframe.png" tooltip-id="" accel-id="" toggle-id="false" execute-action=""/>
<popup-item item-id="10002" pos-id="" label-id="Shading" icon-id="mesh_shading.png" tooltip-id="" accel-id="" toggle-id="true" execute-action=""/>
<popup-item item-id="10004" pos-id="" label-id="Nodes" icon-id="mesh_points.png" tooltip-id="" accel-id="" toggle-id="false" execute-action=""/>
<separator pos-id=""/>
<popup-item item-id="1006" pos-id="" label-id="Selection" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<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>
<endsubmenu />
<separator pos-id="-1"/>
<popup-item item-id="213" pos-id="" label-id="Shrink" icon-id="mesh_shrink.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</submenu>
<endsubmenu />
+ <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="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=""/>
<separator pos-id=""/>
<submenu label-id="Control" item-id="2000" pos-id="">
- <popup-item item-id="6001" pos-id="" label-id="Length" icon-id="mesh_length.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
- <popup-item item-id="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="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="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="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="6012" pos-id="" label-id="Taper" icon-id="mesh_taper.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="6013" pos-id="" label-id="Aspect Ratio" icon-id="mesh_aspect.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
- <popup-item item-id="6014" pos-id="" label-id="Minimum angle" icon-id="mesh_angle.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+ <popup-item item-id="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="6016" pos-id="" label-id="Skew" icon-id="mesh_skew.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/>
- <popup-item item-id="200" pos-id="" label-id="Reset" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+ <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=""/>
<popup-item item-id="201" pos-id="" label-id="Scalar Bar Properties" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</submenu>
<popup-item item-id="213" pos-id="" label-id="Shrink" icon-id="mesh_shrink.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</submenu>
<endsubmenu />
+ <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="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=""/>
<separator pos-id=""/>
<submenu label-id="Control" item-id="2000" pos-id="">
- <popup-item item-id="6001" pos-id="" label-id="Length" icon-id="mesh_length.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
- <popup-item item-id="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="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="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="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=""/>
+ <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="6012" pos-id="" label-id="Taper" icon-id="mesh_taper.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="6013" pos-id="" label-id="Aspect Ratio" icon-id="mesh_aspect.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
- <popup-item item-id="6014" pos-id="" label-id="Minimum angle" icon-id="mesh_angle.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+ <popup-item item-id="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="6016" pos-id="" label-id="Skew" icon-id="mesh_skew.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/>
- <popup-item item-id="200" pos-id="" label-id="Reset" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+ <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=""/>
<popup-item item-id="201" pos-id="" label-id="Scalar Bar Properties" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</submenu>
<popup-item item-id="213" pos-id="" label-id="Shrink" icon-id="mesh_shrink.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</submenu>
<endsubmenu />
+ <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="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=""/>
<separator pos-id=""/>
<submenu label-id="Control" item-id="2000" pos-id="">
- <popup-item item-id="6001" pos-id="" label-id="Length" icon-id="mesh_length.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
- <popup-item item-id="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="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="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="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="6012" pos-id="" label-id="Taper" icon-id="mesh_taper.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="6013" pos-id="" label-id="Aspect Ratio" icon-id="mesh_aspect.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
- <popup-item item-id="6014" pos-id="" label-id="Minimum angle" icon-id="mesh_angle.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+ <popup-item item-id="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="6016" pos-id="" label-id="Skew" icon-id="mesh_skew.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<separator pos-id=""/>
- <popup-item item-id="200" pos-id="" label-id="Reset" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
+ <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=""/>
<popup-item item-id="201" pos-id="" label-id="Scalar Bar Properties" icon-id="" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</submenu>
<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="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="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="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=""/>
+ <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="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="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="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 label-id="Add/Remove toolbar">
<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="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="415" label-id="Pattern mapping" icon-id="mesh_pattern.png" tooltip-id="2D and 3D pattern mapping" accel-id="" toggle-id="" execute-action=""/>
</toolbar>
@COMMENCE@
-EXPORT_HEADERS = SMESH_Controls.hxx
+EXPORT_HEADERS = SMESH_Controls.hxx SMESH_ControlsDef.hxx
# Libraries targets
//
// 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)
{
new Skew();
new Area();
new Length();
+ // new Length2D();
new MultiConnection();
+ // new MultiConnection2D();
new FreeBorders();
new LessThan();
new MoreThan();
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-#include "SMESH_Controls.hxx"
+#include "SMESH_ControlsDef.hxx"
#include <set>
#include <Geom_CylindricalSurface.hxx>
#include <Precision.hxx>
#include <TColgp_Array1OfXYZ.hxx>
-#include <TColgp_SequenceOfXYZ.hxx>
#include <TColStd_MapOfInteger.hxx>
#include <TColStd_SequenceOfAsciiString.hxx>
#include <TColStd_MapIteratorOfMapOfInteger.hxx>
#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() );
-}
+namespace{
+ 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 getDistance( const gp_XYZ& P1, const gp_XYZ& P2 )
-{
- double aDist = gp_Pnt( P1 ).Distance( gp_Pnt( P2 ) );
- return aDist;
-}
+ 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 int getNbMultiConnection( SMDS_Mesh* theMesh, const int theId )
-{
- if ( theMesh == 0 )
- return 0;
+ inline double getArea( const gp_Pnt& P1, const gp_Pnt& P2, const gp_Pnt& P3 )
+ {
+ return getArea( P1.XYZ(), P2.XYZ(), P3.XYZ() );
+ }
- 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 )
+ inline double getDistance( const gp_XYZ& P1, const gp_XYZ& P2 )
{
- 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();
+ double aDist = gp_Pnt( P1 ).Distance( gp_Pnt( P2 ) );
+ return aDist;
+ }
- if ( anIter->more() ) // i.e. first node
- aMap.Add( anId );
- else if ( aMap.Contains( anId ) )
- aResult++;
- }
+ 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;
/*
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;
}
bool NumericalFunctor::GetPoints(const SMDS_MeshElement* anElem,
- TColgp_SequenceOfXYZ& theRes )
+ TSequenceOfXYZ& theRes )
{
- theRes.Clear();
+ theRes.clear();
if ( anElem == 0)
return false;
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() ) );
+ }
}
}
double NumericalFunctor::GetValue( long theId )
{
- TColgp_SequenceOfXYZ P;
+ TSequenceOfXYZ P;
if ( GetPoints( theId, P ))
{
double aVal = GetValue( P );
double prec = pow( 10., (double)( myPrecision ) );
aVal = floor( aVal * prec + 0.5 ) / prec;
}
-
return aVal;
}
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 ) );
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 ) );
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;
Class : AspectRatio3D
Description : Functor for calculating aspect ratio
*/
+namespace{
-static inline double getHalfPerimeter(double theTria[3]){
- return (theTria[0] + theTria[1] + theTria[2])/2.0;
-}
+ 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]));
-}
+ 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;
-}
+ 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 );
-}
+ 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 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
{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;
}
}
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;
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
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 ) ) );
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;
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
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;
}
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
gp_XYZ n;
int aNbNode = theFace->NbNodes();
TColgp_Array1OfXYZ anArrOfXYZ(1,4);
- gp_XYZ p1, p2, p3, p4;
SMDS_ElemIteratorPtr aNodeItr = theFace->nodesIterator();
int i = 1;
for ( ; aNodeItr->more() && i <= 4; i++ )
SMDS_MeshFace* aFace = (SMDS_MeshFace*)anItr->next();
if ( !aFace )
continue;
- aSetOfFaces.insert( aFace );
+ aSetOfFaces.Add( aFace );
}
// take all faces that shared second node
anItr = theLink.myNode2->facesIterator();
for ( ; anItr->more(); )
{
SMDS_MeshFace* aFace = (SMDS_MeshFace*)anItr->next();
- if ( aSetOfFaces.find( aFace ) != aSetOfFaces.end() )
+ if ( aSetOfFaces.Contains( aFace ) )
theFaces.push_back( aFace );
}
}
#ifndef _SMESH_CONTROLS_HXX_
#define _SMESH_CONTROLS_HXX_
-#include <set>
-#include <map>
-#include <vector>
#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 Controls{
- class Functor
- {
- public:
- ~Functor(){}
- virtual void SetMesh( SMDS_Mesh* theMesh ) = 0;
- virtual SMDSAbs_ElementType GetType() const = 0;
- };
+
+ class Functor;
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,
- 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<NumericalFunctor> 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<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
--- /dev/null
+// 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
LIB_SERVER_IDL =
# 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
-LDFLAGS += -lMeshDriver
+LDFLAGS += -lMeshDriver $(OCC_KERNEL_LIBS)
LDFLAGSFORBIN += -lMeshDriver -lSMDS -L${KERNEL_ROOT_DIR}/lib/salome -lOpUtil -lSALOMELocalTrace
// $Header$
#include "DriverMED_Family.h"
+#include "MED_Factory.hxx"
+
#include <sstream>
using namespace std;
* Create TFamilyInfo for this family
*/
//=============================================================================
-MEDA::PFamilyInfo DriverMED_Family::GetFamilyInfo
- (const MEDA::PMeshInfo& theMeshInfo) const
+MED::PFamilyInfo
+DriverMED_Family::GetFamilyInfo(const MED::PWrapper& theWrapper,
+ const MED::PMeshInfo& theMeshInfo) const
{
string aValue;
ostringstream aStr;
MED::TIntVector anAttrIds (1, myId); // Id=0,
MED::TIntVector anAttrVals (1, myId); // Value=0
- MEDA::PFamilyInfo anInfo = MEDA::TWrapper::CrFamilyInfo(theMeshInfo,
- aValue,
- myId,
- myGroupNames,
- anAttrDescs,anAttrIds,anAttrVals);
+ MED::PFamilyInfo anInfo = theWrapper->CrFamilyInfo(theMeshInfo,
+ aValue,
+ myId,
+ myGroupNames,
+ anAttrDescs,
+ anAttrIds,
+ anAttrVals);
// cout << endl;
// cout << "Groups: ";
#include "SMDS_Mesh.hxx"
#include "SMESHDS_GroupBase.hxx"
#include "SMESHDS_SubMesh.hxx"
-#include "MEDA_Wrapper.hxx"
+#include "MED_Common.hxx"
#include <boost/shared_ptr.hpp>
#include <set>
// from <theGroups> and other sub-meshes from <theSubMeshes>.
// 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
const std::set<const SMDS_MeshElement *>& GetElements () const { return myElements; }
#include "SMESHDS_Group.hxx"
-#include "MEDA_Wrapper.hxx"
+#include "MED_Factory.hxx"
#include "MED_Utilities.hxx"
#include <stdlib.h>
#define _EDF_NODE_IDS_
+using namespace MED;
+
void DriverMED_R_SMESHDS_Mesh::SetMeshName(string theMeshName)
{
myMeshName = theMeshName;
}
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);
if(aNode) return aNode;
EXCEPTION(runtime_error,"SMDS_Mesh::FindNode - cannot find a SMDS_MeshNode for ID = "<<theId);
enum ECoordName{eX, eY, eZ, eNone};
-typedef med_float (*TGetCoord)(MEDA::PNodeInfo&, med_int);
+typedef TFloat (*TGetCoord)(MED::PNodeInfo&, TInt);
template<ECoordName TheCoordId>
-med_float GetCoord(MEDA::PNodeInfo& thePNodeInfo, med_int theElemId){
+TFloat GetCoord(MED::PNodeInfo& thePNodeInfo, TInt theElemId){
return thePNodeInfo->GetNodeCoord(theElemId,TheCoordId);
}
template<>
-med_float GetCoord<eNone>(MEDA::PNodeInfo& thePNodeInfo, med_int theElemId){
+TFloat GetCoord<eNone>(MED::PNodeInfo& thePNodeInfo, TInt theElemId){
return 0.0;
}
class TCoordHelper{
- MEDA::PNodeInfo myPNodeInfo;
+ MED::PNodeInfo myPNodeInfo;
TGetCoord* myGetCoord;
public:
- TCoordHelper(const MEDA::PNodeInfo& thePNodeInfo,
+ TCoordHelper(const MED::PNodeInfo& thePNodeInfo,
TGetCoord* theGetCoord):
myPNodeInfo(thePNodeInfo),
myGetCoord(theGetCoord)
{}
virtual ~TCoordHelper(){}
- med_float GetCoord(med_int theElemId, med_int theCoodId){
+ TFloat GetCoord(TInt theElemId, TInt theCoodId){
return (*myGetCoord[theCoodId])(myPNodeInfo,theElemId);
}
};
{
Status aResult = DRS_FAIL;
try{
- using namespace MEDA;
-
myFamilies.clear();
MESSAGE("Perform - myFile : "<<myFile);
- TWrapper aMed(myFile);
+ PWrapper aMed = CrWrapper(myFile);
aResult = DRS_EMPTY;
- if(med_int aNbMeshes = aMed.GetNbMeshes()){
+ if(TInt aNbMeshes = aMed->GetNbMeshes()){
for(int iMesh = 0; iMesh < aNbMeshes; iMesh++){
// Reading the MED mesh
//---------------------
- PMeshInfo aMeshInfo = aMed.GetMeshInfo(iMesh);
+ PMeshInfo aMeshInfo = aMed->GetPMeshInfo(iMesh+1);
string aMeshName;
if (myMeshId != -1) {
ostringstream aMeshNameStr;
MESSAGE("Perform - aMeshName : "<<aMeshName<<"; "<<aMeshInfo->GetName());
if(aMeshName != aMeshInfo->GetName()) continue;
aResult = DRS_OK;
- med_int aMeshDim = aMeshInfo->GetDim();
+ //TInt aMeshDim = aMeshInfo->GetDim();
// Reading MED families to the temporary structure
//------------------------------------------------
- med_int aNbFams = aMed.GetNbFamilies(aMeshInfo);
+ TInt aNbFams = aMed->GetNbFamilies(aMeshInfo);
MESSAGE("Read " << aNbFams << " families");
- for (med_int iFam = 0; iFam < aNbFams; iFam++) {
- PFamilyInfo aFamilyInfo = aMed.GetFamilyInfo(aMeshInfo, iFam);
- med_int aFamId = aFamilyInfo->GetId();
+ for (TInt iFam = 0; iFam < aNbFams; iFam++) {
+ PFamilyInfo aFamilyInfo = aMed->GetPFamilyInfo(aMeshInfo, iFam+1);
+ TInt aFamId = aFamilyInfo->GetId();
MESSAGE("Family " << aFamId << " :");
DriverMED_FamilyPtr aFamily (new DriverMED_Family);
- med_int aNbGrp = aFamilyInfo->GetNbGroup();
+ TInt aNbGrp = aFamilyInfo->GetNbGroup();
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);
MESSAGE(aGroupName);
aFamily->AddGroupName(aGroupName);
// Reading MED nodes to the corresponding SMDS structure
//------------------------------------------------------
- PNodeInfo aNodeInfo = aMed.GetNodeInfo(aMeshInfo);
+ PNodeInfo aNodeInfo = aMed->GetPNodeInfo(aMeshInfo);
TCoordHelperPtr aCoordHelperPtr;
{
- med_int aMeshDimension = aMeshInfo->GetDim();
+ TInt aMeshDimension = aMeshInfo->GetDim();
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);
if(aDimName == "x" || aDimName == "X")
anIsDimPresent[eX] = true;
}
}
- med_booleen anIsNodeNum = aNodeInfo->IsElemNum();
- med_int aNbElems = aNodeInfo->GetNbElem();
+ EBooleen anIsNodeNum = aNodeInfo->IsElemNum();
+ TInt aNbElems = aNodeInfo->GetNbElem();
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};
- for(med_int iDim = 0; iDim < 3; iDim++)
+ for(TInt iDim = 0; iDim < 3; iDim++)
aCoords[iDim] = aCoordHelperPtr->GetCoord(iElem,iDim);
const SMDS_MeshNode* aNode;
if(anIsNodeNum) {
//cout<<aNode->GetID()<<": "<<aNode->X()<<", "<<aNode->Y()<<", "<<aNode->Z()<<endl;
// 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())
{
myFamilies[aFamNum]->AddElement(aNode);
// Reading pre information about all MED cells
//--------------------------------------------
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();
for(; anEntityIter != aEntityInfo.end(); anEntityIter++){
- const med_entite_maillage& anEntity = anEntityIter->first;
- if(anEntity == MED_NOEUD) continue;
+ const EEntiteMaillage& anEntity = anEntityIter->first;
+ if(anEntity == eNOEUD) continue;
// Reading MED cells to the corresponding SMDS structure
//------------------------------------------------------
const MED::TGeom& aTGeom = anEntityIter->second;
MED::TGeom::const_iterator anTGeomIter = aTGeom.begin();
for(; anTGeomIter != aTGeom.end(); anTGeomIter++){
- const med_geometrie_element& aGeom = anTGeomIter->first;
- if(aGeom == MED_POINT1) continue;
- PCellInfo aCellInfo = aMed.GetCellInfo(aMeshInfo,anEntity,aGeom);
- med_booleen anIsElemNum = takeNumbers ? aCellInfo->IsElemNum() : MED_FAUX;
- med_int aNbElems = aCellInfo->GetNbElem();
+ const EGeometrieElement& aGeom = anTGeomIter->first;
+ if(aGeom == ePOINT1) continue;
+ PCellInfo aCellInfo = aMed->GetPCellInfo(aMeshInfo,anEntity,aGeom);
+ EBooleen anIsElemNum = takeNumbers ? aCellInfo->IsElemNum() : eFAUX;
+ TInt aNbElems = aCellInfo->GetNbElem();
MESSAGE("Perform - anEntity = "<<anEntity<<"; anIsElemNum = "<<anIsElemNum);
MESSAGE("Perform - aGeom = "<<aGeom<<"; aNbElems = "<<aNbElems);
for(int iElem = 0; iElem < aNbElems; iElem++){
- med_int aNbNodes = -1;
+ TInt aNbNodes = -1;
switch(aGeom){
- case MED_SEG2:
- case MED_SEG3:
+ case eSEG2:
+ case eSEG3:
aNbNodes = 2;
break;
- case MED_TRIA3:
- case MED_TRIA6:
+ case eTRIA3:
+ case eTRIA6:
aNbNodes = 3;
break;
break;
- case MED_QUAD4:
- case MED_QUAD8:
+ case eQUAD4:
+ case eQUAD8:
aNbNodes = 4;
break;
- case MED_TETRA4:
- case MED_TETRA10:
+ case eTETRA4:
+ case eTETRA10:
aNbNodes = 4;
break;
- case MED_PYRA5:
- case MED_PYRA13:
+ case ePYRA5:
+ case ePYRA13:
aNbNodes = 5;
break;
- case MED_PENTA6:
- case MED_PENTA15:
+ case ePENTA6:
+ case ePENTA15:
aNbNodes = 6;
break;
- case MED_HEXA8:
- case MED_HEXA20:
+ case eHEXA8:
+ case eHEXA20:
aNbNodes = 8;
break;
}
- vector<med_int> aNodeIds(aNbNodes);
+ vector<TInt> aNodeIds(aNbNodes);
#ifdef _EDF_NODE_IDS_
if(anIsNodeNum) {
for(int i = 0; i < aNbNodes; i++){
bool isRenum = false;
SMDS_MeshElement* anElement = NULL;
- med_int aFamNum = aCellInfo->GetFamNum(iElem);
+ TInt aFamNum = aCellInfo->GetFamNum(iElem);
try{
switch(aGeom){
- case MED_SEG2:
- case MED_SEG3:
+ case eSEG2:
+ case eSEG3:
if(anIsElemNum)
anElement = myMesh->AddEdgeWithID(aNodeIds[0],
aNodeIds[1],
isRenum = anIsElemNum;
}
break;
- case MED_TRIA3:
- case MED_TRIA6:
+ case eTRIA3:
+ case eTRIA6:
aNbNodes = 3;
if(anIsElemNum)
anElement = myMesh->AddFaceWithID(aNodeIds[0],
isRenum = anIsElemNum;
}
break;
- case MED_QUAD4:
- case MED_QUAD8:
+ case eQUAD4:
+ case eQUAD8:
aNbNodes = 4;
// There is some differnce between SMDS and MED
if(anIsElemNum)
isRenum = anIsElemNum;
}
break;
- case MED_TETRA4:
- case MED_TETRA10:
+ case eTETRA4:
+ case eTETRA10:
aNbNodes = 4;
if(anIsElemNum)
anElement = myMesh->AddVolumeWithID(aNodeIds[0],
isRenum = anIsElemNum;
}
break;
- case MED_PYRA5:
- case MED_PYRA13:
+ case ePYRA5:
+ case ePYRA13:
aNbNodes = 5;
// There is some differnce between SMDS and MED
if(anIsElemNum)
isRenum = anIsElemNum;
}
break;
- case MED_PENTA6:
- case MED_PENTA15:
+ case ePENTA6:
+ case ePENTA15:
aNbNodes = 6;
if(anIsElemNum)
anElement = myMesh->AddVolumeWithID(aNodeIds[0],
isRenum = anIsElemNum;
}
break;
- case MED_HEXA8:
- case MED_HEXA20:
+ case eHEXA8:
+ case eHEXA20:
aNbNodes = 8;
if(anIsElemNum)
anElement = myMesh->AddVolumeWithID(aNodeIds[0],
}
else {
if (isRenum) {
- anIsElemNum = MED_FAUX;
+ anIsElemNum = eFAUX;
takeNumbers = false;
if (aResult < DRS_WARN_RENUMBER)
aResult = DRS_WARN_RENUMBER;
list<string> aMeshNames;
try {
- using namespace MEDA;
-
MESSAGE("GetMeshNames - myFile : " << myFile);
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++) {
// Reading the MED mesh
//---------------------
- PMeshInfo aMeshInfo = aMed.GetMeshInfo(iMesh);
+ PMeshInfo aMeshInfo = aMed->GetPMeshInfo(iMesh+1);
aMeshNames.push_back(aMeshInfo->GetName());
}
}
#include "SMDS_MeshNode.hxx"
#include "utilities.h"
-#include "MEDA_Wrapper.hxx"
+#include "MED_Factory.hxx"
#include "MED_Utilities.hxx"
#define _EDF_NODE_IDS_
//#define _ELEMENTS_BY_DIM_
using namespace std;
+using namespace MED;
+
DriverMED_W_SMESHDS_Mesh::DriverMED_W_SMESHDS_Mesh():
myAllSubMeshes (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)
{
myMeshName = theMeshName;
myDoGroupOfVolumes = true;
}
-typedef double (SMDS_MeshNode::* TGetCoord)() const;
-typedef const char* TName;
-typedef const char* TUnit;
-
-static TUnit aUnit[3] = {"m","m","m"};
-
-static TGetCoord aXYZGetCoord[3] = {
- &SMDS_MeshNode::X,
- &SMDS_MeshNode::Y,
- &SMDS_MeshNode::Z
-};
-static TName aXYZName[3] = {"x","y","z"};
-
-
-static TGetCoord aXYGetCoord[2] = {
- &SMDS_MeshNode::X,
- &SMDS_MeshNode::Y
-};
-static TName aXYName[2] = {"x","y"};
-
-static TGetCoord aYZGetCoord[2] = {
- &SMDS_MeshNode::Y,
- &SMDS_MeshNode::Z
-};
-static TName aYZName[2] = {"y","z"};
-
-static TGetCoord aXZGetCoord[2] = {
- &SMDS_MeshNode::X,
- &SMDS_MeshNode::Z
-};
-static TName aXZName[2] = {"x","z"};
-
-
-static TGetCoord aXGetCoord[1] = {
- &SMDS_MeshNode::X
-};
-static TName aXName[1] = {"x"};
-
-static TGetCoord aYGetCoord[1] = {
- &SMDS_MeshNode::Y
-};
-static TName aYName[1] = {"y"};
-
-static TGetCoord aZGetCoord[1] = {
- &SMDS_MeshNode::Z
-};
-static TName aZName[1] = {"z"};
-
-
-class TCoordHelper{
- SMDS_NodeIteratorPtr myNodeIter;
- const SMDS_MeshNode* myCurrentNode;
- TGetCoord* myGetCoord;
- TName* myName;
- TUnit* myUnit;
-public:
- TCoordHelper(const SMDS_NodeIteratorPtr& theNodeIter,
- TGetCoord* theGetCoord,
- TName* theName,
- TUnit* theUnit = aUnit):
- myNodeIter(theNodeIter),
- myGetCoord(theGetCoord),
- myName(theName),
- myUnit(theUnit)
- {}
- virtual ~TCoordHelper(){}
- bool Next(){
- return myNodeIter->more() &&
- (myCurrentNode = myNodeIter->next());
- }
- const SMDS_MeshNode* GetNode(){
- return myCurrentNode;
- }
- MED::TIntVector::value_type GetID(){
- return myCurrentNode->GetID();
- }
- MED::TFloatVector::value_type GetCoord(med_int theCoodId){
- return (myCurrentNode->*myGetCoord[theCoodId])();
- }
- MED::TStringVector::value_type GetName(med_int theDimId){
- return myName[theDimId];
- }
- MED::TStringVector::value_type GetUnit(med_int theDimId){
- return myUnit[theDimId];
- }
-};
-typedef boost::shared_ptr<TCoordHelper> TCoordHelperPtr;
-
+namespace{
+ typedef double (SMDS_MeshNode::* TGetCoord)() const;
+ typedef const char* TName;
+ typedef const char* TUnit;
+
+ TUnit aUnit[3] = {"m","m","m"};
+
+ TGetCoord aXYZGetCoord[3] = {
+ &SMDS_MeshNode::X,
+ &SMDS_MeshNode::Y,
+ &SMDS_MeshNode::Z
+ };
+ TName aXYZName[3] = {"x","y","z"};
+
+
+ TGetCoord aXYGetCoord[2] = {
+ &SMDS_MeshNode::X,
+ &SMDS_MeshNode::Y
+ };
+ TName aXYName[2] = {"x","y"};
+
+ TGetCoord aYZGetCoord[2] = {
+ &SMDS_MeshNode::Y,
+ &SMDS_MeshNode::Z
+ };
+ TName aYZName[2] = {"y","z"};
+
+ TGetCoord aXZGetCoord[2] = {
+ &SMDS_MeshNode::X,
+ &SMDS_MeshNode::Z
+ };
+ TName aXZName[2] = {"x","z"};
+
+
+ TGetCoord aXGetCoord[1] = {
+ &SMDS_MeshNode::X
+ };
+ TName aXName[1] = {"x"};
+
+ TGetCoord aYGetCoord[1] = {
+ &SMDS_MeshNode::Y
+ };
+ TName aYName[1] = {"y"};
+
+ TGetCoord aZGetCoord[1] = {
+ &SMDS_MeshNode::Z
+ };
+ TName aZName[1] = {"z"};
+
+
+ class TCoordHelper{
+ SMDS_NodeIteratorPtr myNodeIter;
+ const SMDS_MeshNode* myCurrentNode;
+ TGetCoord* myGetCoord;
+ TName* myName;
+ TUnit* myUnit;
+ public:
+ TCoordHelper(const SMDS_NodeIteratorPtr& theNodeIter,
+ TGetCoord* theGetCoord,
+ TName* theName,
+ TUnit* theUnit = aUnit):
+ myNodeIter(theNodeIter),
+ myGetCoord(theGetCoord),
+ myName(theName),
+ myUnit(theUnit)
+ {}
+ virtual ~TCoordHelper(){}
+ bool Next(){
+ return myNodeIter->more() &&
+ (myCurrentNode = myNodeIter->next());
+ }
+ const SMDS_MeshNode* GetNode(){
+ return myCurrentNode;
+ }
+ MED::TIntVector::value_type GetID(){
+ return myCurrentNode->GetID();
+ }
+ MED::TFloatVector::value_type GetCoord(TInt theCoodId){
+ return (myCurrentNode->*myGetCoord[theCoodId])();
+ }
+ MED::TStringVector::value_type GetName(TInt theDimId){
+ return myName[theDimId];
+ }
+ MED::TStringVector::value_type GetUnit(TInt theDimId){
+ return myUnit[theDimId];
+ }
+ };
+ typedef boost::shared_ptr<TCoordHelper> TCoordHelperPtr;
+
+}
+
Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
{
Status aResult = DRS_OK;
return DRS_FAIL;
}
try{
- using namespace MEDA;
- using namespace boost;
-
MESSAGE("Perform - myFile : "<<myFile);
- TWrapper aMed(myFile);
// Creating the MED mesh for corresponding SMDS structure
//-------------------------------------------------------
}
// Mesh dimension definition
- med_int aMeshDimension;
+ TInt aMeshDimension;
TCoordHelperPtr aCoordHelperPtr;
{
bool anIsXDimension = false;
anIsXDimension = (aBounds[1] - aBounds[0]) + abs(aBounds[1]) + abs(aBounds[0]) > 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;
-
aMeshDimension = anIsXDimension + anIsYDimension + anIsZDimension;
if(!aMeshDimension)
aMeshDimension = 3;
}
- PMeshInfo aMeshInfo = TWrapper::CrMeshInfo(aMeshDimension,aMeshName);
+ PMeshInfo aMeshInfo = myMed->CrMeshInfo(aMeshDimension,aMeshName);
MESSAGE("Add - aMeshName : "<<aMeshName<<"; "<<aMeshInfo->GetName());
- aMed.SetMeshInfo(aMeshInfo);
+ myMed->SetMeshInfo(aMeshInfo);
// Storing SMDS groups and sub-meshes
//-----------------------------------
for (; aFamsIter != aFamilies.end(); aFamsIter++)
{
- PFamilyInfo aFamilyInfo = (*aFamsIter)->GetFamilyInfo(aMeshInfo);
- aMed.SetFamilyInfo(aFamilyInfo);
+ PFamilyInfo aFamilyInfo = (*aFamsIter)->GetFamilyInfo(myMed,aMeshInfo);
+ myMed->SetFamilyInfo(aFamilyInfo);
int aFamId = (*aFamsIter)->GetId();
const set<const SMDS_MeshElement *>& anElems = (*aFamsIter)->GetElements();
// Storing SMDS nodes to the MED file for the MED mesh
//----------------------------------------------------
#ifdef _EDF_NODE_IDS_
- typedef map<med_int,med_int> TNodeIdMap;
+ typedef map<TInt,TInt> TNodeIdMap;
TNodeIdMap aNodeIdMap;
#endif
- med_int aNbElems = myMesh->NbNodes();
+ TInt aNbElems = myMesh->NbNodes();
MED::TIntVector anElemNums(aNbElems);
MED::TIntVector aFamilyNums(aNbElems);
MED::TFloatVector aCoordinates(aNbElems*aMeshDimension);
- for(med_int iNode = 0, aStartId = 0; aCoordHelperPtr->Next(); iNode++, aStartId += aMeshDimension){
- for(med_int iCoord = 0; iCoord < aMeshDimension; iCoord++){
+ for(TInt iNode = 0, aStartId = 0; aCoordHelperPtr->Next(); iNode++, aStartId += aMeshDimension){
+ for(TInt iCoord = 0; iCoord < aMeshDimension; iCoord++){
aCoordinates[aStartId+iCoord] = aCoordHelperPtr->GetCoord(iCoord);
}
int aNodeID = aCoordHelperPtr->GetID();
MED::TStringVector aCoordNames(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);
aCoordUnits[iCoord] = aCoordHelperPtr->GetUnit(iCoord);
}
- const med_repere SMDS_COORDINATE_SYSTEM = MED_CART;
+ const ERepere SMDS_COORDINATE_SYSTEM = eCART;
- PNodeInfo aNodeInfo = TWrapper::CrNodeInfo(aMeshInfo,
- SMDS_COORDINATE_SYSTEM,
- aCoordinates,
- aCoordNames,
- aCoordUnits,
- aFamilyNums,
- anElemNums);
+ PNodeInfo aNodeInfo = myMed->CrNodeInfo(aMeshInfo,
+ SMDS_COORDINATE_SYSTEM,
+ aCoordinates,
+ aCoordNames,
+ aCoordUnits,
+ aFamilyNums,
+ anElemNums);
MESSAGE("Perform - aNodeInfo->GetNbElem() = "<<aNbElems);
- aMed.SetNodeInfo(aNodeInfo);
+ myMed->SetNodeInfo(aNodeInfo);
// Storing others SMDS elements to the MED file for the MED mesh
//--------------------------------------------------------------
- med_entite_maillage SMDS_MED_ENTITY = MED_MAILLE;
- const med_connectivite SMDS_MED_CONNECTIVITY = MED_NOD;
+ EEntiteMaillage SMDS_MED_ENTITY = eMAILLE;
+ const EConnectivite SMDS_MED_CONNECTIVITY = eNOD;
// Storing SMDS Edges
- if(med_int aNbElems = myMesh->NbEdges()){
+ if(TInt aNbElems = myMesh->NbEdges()){
#ifdef _ELEMENTS_BY_DIM_
- SMDS_MED_ENTITY = MED_ARETE;
+ SMDS_MED_ENTITY = eARETE;
#endif
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 aFamilyNums(aNbElems);
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();
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();
#ifdef _EDF_NODE_IDS_
aConnectivity[iConn+iNode] = aNodeIdMap[aNode->GetID()];
aFamilyNums[iElem] = myEdgesDefaultFamilyId;
}
- PCellInfo aCellInfo = TWrapper::CrCellInfo(aMeshInfo,
- SMDS_MED_ENTITY,
- MED_SEG2,
- SMDS_MED_CONNECTIVITY,
- aConnectivity,
- aFamilyNums,
- anElemNums);
- aMed.SetCellInfo(aCellInfo);
+ PCellInfo aCellInfo = myMed->CrCellInfo(aMeshInfo,
+ SMDS_MED_ENTITY,
+ eSEG2,
+ SMDS_MED_CONNECTIVITY,
+ aConnectivity,
+ aFamilyNums,
+ anElemNums);
+ myMed->SetCellInfo(aCellInfo);
}
// Storing SMDS Faces
- if(med_int aNbElems = myMesh->NbFaces()){
+ if(TInt aNbElems = myMesh->NbFaces()){
SMDS_FaceIteratorPtr anIter = myMesh->facesIterator();
#ifdef _ELEMENTS_BY_DIM_
- SMDS_MED_ENTITY = MED_FACE;
+ SMDS_MED_ENTITY = eFACE;
#endif
- med_int aNbTriaConn = MED::GetNbConn(SMDS_MED_ENTITY,MED_TRIA3,aMeshDimension);
+ TInt aNbTriaConn = MED::GetNbConn(SMDS_MED_ENTITY,eTRIA3,aMeshDimension);
MED::TIntVector anTriaElemNums;
anTriaElemNums.reserve(aNbElems);
MED::TIntVector aTriaFamilyNums;
MED::TIntVector aTriaConn;
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;
aQuadElemNums.reserve(aNbElems);
MED::TIntVector aQuadFamilyNums;
MED::TIntVector aQuadConn;
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();
- med_int aNbNodes = anElem->NbNodes();
+ TInt aNbNodes = anElem->NbNodes();
SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator();
- med_int aNbConnectivity;
+ TInt aNbConnectivity;
MED::TIntVector* anElemNums;
MED::TIntVector* aFamilyNums;
MED::TIntVector* aConnectivity;
break;
}
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();
aVector[iNode] = aNode->GetID();
}
- med_int aSize = aConnectivity->size();
+ TInt aSize = aConnectivity->size();
aConnectivity->resize(aSize+aNbConnectivity);
// There is some differnce between SMDS and MED in cells mapping
#ifdef _EDF_NODE_IDS_
(*aConnectivity)[aSize+2] = aNodeIdMap[aVector[3]];
(*aConnectivity)[aSize+3] = aNodeIdMap[aVector[2]];
default:
- for(med_int iNode = 0; iNode < aNbNodes; iNode++)
+ for(TInt iNode = 0; iNode < aNbNodes; iNode++)
(*aConnectivity)[aSize+iNode] = aNodeIdMap[aVector[iNode]];
}
#else
(*aConnectivity)[aSize+2] = aVector[3];
(*aConnectivity)[aSize+3] = aVector[2];
default:
- for(med_int iNode = 0; iNode < aNbNodes; iNode++)
+ for(TInt iNode = 0; iNode < aNbNodes; iNode++)
(*aConnectivity)[aSize+iNode] = aVector[iNode];
}
#endif
else
aFamilyNums->push_back(myFacesDefaultFamilyId);
}
- if(med_int aNbElems = anTriaElemNums.size()){
- PCellInfo aCellInfo = TWrapper::CrCellInfo(aMeshInfo,
- SMDS_MED_ENTITY,
- MED_TRIA3,
- SMDS_MED_CONNECTIVITY,
- aTriaConn,
- aTriaFamilyNums,
- anTriaElemNums);
- MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<MED_TRIA3<<"; aNbElems = "<<aNbElems);
- aMed.SetCellInfo(aCellInfo);
+ if(TInt aNbElems = anTriaElemNums.size()){
+ PCellInfo aCellInfo = myMed->CrCellInfo(aMeshInfo,
+ SMDS_MED_ENTITY,
+ eTRIA3,
+ SMDS_MED_CONNECTIVITY,
+ aTriaConn,
+ aTriaFamilyNums,
+ anTriaElemNums);
+ MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<eTRIA3<<"; aNbElems = "<<aNbElems);
+ myMed->SetCellInfo(aCellInfo);
}
- if(med_int aNbElems = aQuadElemNums.size()){
- PCellInfo aCellInfo = TWrapper::CrCellInfo(aMeshInfo,
- SMDS_MED_ENTITY,
- MED_QUAD4,
- SMDS_MED_CONNECTIVITY,
- aQuadConn,
- aQuadFamilyNums,
- aQuadElemNums);
- MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<MED_QUAD4<<"; aNbElems = "<<aNbElems);
- aMed.SetCellInfo(aCellInfo);
+ if(TInt aNbElems = aQuadElemNums.size()){
+ PCellInfo aCellInfo = myMed->CrCellInfo(aMeshInfo,
+ SMDS_MED_ENTITY,
+ eQUAD4,
+ SMDS_MED_CONNECTIVITY,
+ aQuadConn,
+ aQuadFamilyNums,
+ aQuadElemNums);
+ MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<eQUAD4<<"; aNbElems = "<<aNbElems);
+ myMed->SetCellInfo(aCellInfo);
}
}
// Storing SMDS Volumes
- if(med_int aNbElems = myMesh->NbVolumes()){
+ if(TInt aNbElems = myMesh->NbVolumes()){
SMDS_VolumeIteratorPtr anIter = myMesh->volumesIterator();
#ifdef _ELEMENTS_BY_DIM_
- SMDS_MED_ENTITY = MED_MAILLE;
+ SMDS_MED_ENTITY = eMAILLE;
#endif
- med_int aNbTetraConn = MED::GetNbConn(SMDS_MED_ENTITY,MED_TETRA4,aMeshDimension);
+ TInt aNbTetraConn = MED::GetNbConn(SMDS_MED_ENTITY,eTETRA4,aMeshDimension);
MED::TIntVector anTetraElemNums;
anTetraElemNums.reserve(aNbElems);
MED::TIntVector aTetraFamilyNums;
MED::TIntVector aTetraConn;
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;
anPyraElemNums.reserve(aNbElems);
MED::TIntVector aPyraFamilyNums;
MED::TIntVector aPyraConn;
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;
anPentaElemNums.reserve(aNbElems);
MED::TIntVector aPentaFamilyNums;
MED::TIntVector aPentaConn;
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;
aHexaElemNums.reserve(aNbElems);
MED::TIntVector aHexaFamilyNums;
MED::TIntVector aHexaConn;
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();
- med_int aNbNodes = anElem->NbNodes();
+ TInt aNbNodes = anElem->NbNodes();
SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator();
- med_int aNbConnectivity;
+ TInt aNbConnectivity;
MED::TIntVector* anElemNums;
MED::TIntVector* aFamilyNums;
MED::TIntVector* aConnectivity;
}
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();
aVector[iNode] = aNode->GetID();
}
- med_int aSize = aConnectivity->size();
+ TInt aSize = aConnectivity->size();
aConnectivity->resize(aSize+aNbConnectivity);
// There is some difference between SMDS and MED in cells mapping
#ifdef _EDF_NODE_IDS_
(*aConnectivity)[aSize+3] = aNodeIdMap[aVector[1]];
(*aConnectivity)[aSize+4] = aNodeIdMap[aVector[4]];
default:
- for(med_int iNode = 0; iNode < aNbNodes; iNode++)
+ for(TInt iNode = 0; iNode < aNbNodes; iNode++)
(*aConnectivity)[aSize+iNode] = aNodeIdMap[aVector[iNode]];
}
#else
(*aConnectivity)[aSize+3] = aVector[1];
(*aConnectivity)[aSize+4] = aVector[4];
default:
- for(med_int iNode = 0; iNode < aNbNodes; iNode++)
+ for(TInt iNode = 0; iNode < aNbNodes; iNode++)
(*aConnectivity)[aSize+iNode] = aVector[iNode];
}
#endif
aFamilyNums->push_back(myVolumesDefaultFamilyId);
}
- if(med_int aNbElems = anTetraElemNums.size()){
- PCellInfo aCellInfo = TWrapper::CrCellInfo(aMeshInfo,
- SMDS_MED_ENTITY,
- MED_TETRA4,
- SMDS_MED_CONNECTIVITY,
- aTetraConn,
- aTetraFamilyNums,
- anTetraElemNums);
- MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<MED_TETRA4<<"; aNbElems = "<<aNbElems);
- aMed.SetCellInfo(aCellInfo);
+ if(TInt aNbElems = anTetraElemNums.size()){
+ PCellInfo aCellInfo = myMed->CrCellInfo(aMeshInfo,
+ SMDS_MED_ENTITY,
+ eTETRA4,
+ SMDS_MED_CONNECTIVITY,
+ aTetraConn,
+ aTetraFamilyNums,
+ anTetraElemNums);
+ MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<eTETRA4<<"; aNbElems = "<<aNbElems);
+ myMed->SetCellInfo(aCellInfo);
}
- if(med_int aNbElems = anPyraElemNums.size()){
- PCellInfo aCellInfo = TWrapper::CrCellInfo(aMeshInfo,
- SMDS_MED_ENTITY,
- MED_PYRA5,
- SMDS_MED_CONNECTIVITY,
- aPyraConn,
- aPyraFamilyNums,
- anPyraElemNums);
- MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<MED_PYRA5<<"; aNbElems = "<<aNbElems);
- aMed.SetCellInfo(aCellInfo);
+ if(TInt aNbElems = anPyraElemNums.size()){
+ PCellInfo aCellInfo = myMed->CrCellInfo(aMeshInfo,
+ SMDS_MED_ENTITY,
+ ePYRA5,
+ SMDS_MED_CONNECTIVITY,
+ aPyraConn,
+ aPyraFamilyNums,
+ anPyraElemNums);
+ MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<ePYRA5<<"; aNbElems = "<<aNbElems);
+ myMed->SetCellInfo(aCellInfo);
}
- if(med_int aNbElems = anPentaElemNums.size()){
- PCellInfo aCellInfo = TWrapper::CrCellInfo(aMeshInfo,
- SMDS_MED_ENTITY,
- MED_PENTA6,
- SMDS_MED_CONNECTIVITY,
- aPentaConn,
- aPentaFamilyNums,
- anPentaElemNums);
- MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<MED_PENTA6<<"; aNbElems = "<<aNbElems);
- aMed.SetCellInfo(aCellInfo);
+ if(TInt aNbElems = anPentaElemNums.size()){
+ PCellInfo aCellInfo = myMed->CrCellInfo(aMeshInfo,
+ SMDS_MED_ENTITY,
+ ePENTA6,
+ SMDS_MED_CONNECTIVITY,
+ aPentaConn,
+ aPentaFamilyNums,
+ anPentaElemNums);
+ MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<ePENTA6<<"; aNbElems = "<<aNbElems);
+ myMed->SetCellInfo(aCellInfo);
}
- if(med_int aNbElems = aHexaElemNums.size()){
- PCellInfo aCellInfo = TWrapper::CrCellInfo(aMeshInfo,
- SMDS_MED_ENTITY,
- MED_HEXA8,
- SMDS_MED_CONNECTIVITY,
- aHexaConn,
- aHexaFamilyNums,
- aHexaElemNums);
- MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<MED_HEXA8<<"; aNbElems = "<<aNbElems);
- aMed.SetCellInfo(aCellInfo);
+ if(TInt aNbElems = aHexaElemNums.size()){
+ PCellInfo aCellInfo = myMed->CrCellInfo(aMeshInfo,
+ SMDS_MED_ENTITY,
+ eHEXA8,
+ SMDS_MED_CONNECTIVITY,
+ aHexaConn,
+ aHexaFamilyNums,
+ aHexaElemNums);
+ MESSAGE("Perform - anEntity = "<<SMDS_MED_ENTITY<<"; aGeom = "<<eHEXA8<<"; aNbElems = "<<aNbElems);
+ myMed->SetCellInfo(aCellInfo);
}
}
}catch(const std::exception& exc){
#define _INCLUDE_DRIVERMED_W_SMESHDS_MESH
#include "Driver_SMESHDS_Mesh.h"
+#include "MED_Factory.hxx"
#include <string>
#include <list>
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()
*/
void AddGroupOfNodes();
private:
+ MED::PWrapper myMed;
std::string myMeshName;
std::list<SMESHDS_GroupBase*> myGroups;
bool myAllSubMeshes;
# additionnal information to compil and link file
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
LDFLAGSFORBIN += -lMeshDriver -lSMDS -lSMESHDS -L${KERNEL_ROOT_DIR}/lib/salome -lMEDWrapper -lOpUtil -lSALOMELocalTrace
LIB_SERVER_IDL =
# 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
-LDFLAGS += -lMeshDriver
+LDFLAGS += -lMeshDriver $(OCC_KERNEL_LIBS)
LDFLAGSFORBIN += -lMeshDriver -lSMDS -L${KERNEL_ROOT_DIR}/lib/salome -lOpUtil -lSALOMELocalTrace
@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
// $Header$
-#include "SMESH_Actor.h"
+#include "SMESH_ActorDef.h"
#include "SMESH_ActorUtils.h"
#include "SMESH_DeviceActor.h"
+#include "SMESH_ControlsDef.hxx"
#include "SALOME_ExtractUnstructuredGrid.h"
#include "QAD_Config.h"
-#include "utilities.h"
#include <qstringlist.h>
#include <vtkTimeStamp.h>
#include <vtkPlane.h>
#include <vtkImplicitBoolean.h>
+#include "utilities.h"
+
#ifdef _DEBUG_
static int MYDEBUG = 0;
-static int MYDEBUGWITHFILES = 0;
#else
static int MYDEBUG = 0;
-static int MYDEBUGWITHFILES = 0;
#endif
static int aLineWidthInc = 2;
static int aPointSizeInc = 2;
-SMESH_Actor* SMESH_Actor::New(){
- return new SMESH_Actor();
+SMESH_ActorDef* SMESH_ActorDef::New(){
+ return new SMESH_ActorDef();
}
const char* theName,
int theIsClear)
{
- SMESH_Actor* anActor = SMESH_Actor::New();
+ SMESH_ActorDef* anActor = SMESH_ActorDef::New();
if(!anActor->Init(theVisualObj,theEntry,theName,theIsClear)){
anActor->Delete();
anActor = NULL;
}
-SMESH_Actor::SMESH_Actor(){
- if(MYDEBUG) MESSAGE("SMESH_Actor");
+SMESH_ActorDef::SMESH_ActorDef(){
+ if(MYDEBUG) MESSAGE("SMESH_ActorDef");
myTimeStamp = vtkTimeStamp::New();
myName = "";
myIO = NULL;
- myColorMode = eNone;
- my1DColorMode = e1DNone;
+ myControlMode = eNone;
myControlActor = my2DActor;
//Definition of myScalarBarActor
aPtsTextProp->SetShadow(0);
myPtsLabeledDataMapper->SetLabelTextProperty(aPtsTextProp);
aPtsTextProp->Delete();
-
+
+ myEntityMode = eAllEntity;
+
myIsPointsLabeled = false;
myPointLabels = vtkActor2D::New();
}
-SMESH_Actor::~SMESH_Actor(){
- if(MYDEBUG) MESSAGE("~SMESH_Actor");
+SMESH_ActorDef::~SMESH_ActorDef(){
+ if(MYDEBUG) MESSAGE("~SMESH_ActorDef");
myScalarBarActor->Delete();
myLookupTable->Delete();
}
-void SMESH_Actor::SetPointsLabeled( bool theIsPointsLabeled )
+void SMESH_ActorDef::SetPointsLabeled( bool theIsPointsLabeled )
{
vtkUnstructuredGrid* aGrid = GetUnstructuredGrid();
myIsPointsLabeled = theIsPointsLabeled && aGrid->GetNumberOfPoints();
}
-void SMESH_Actor::SetCellsLabeled(bool theIsCellsLabeled){
+void SMESH_ActorDef::SetCellsLabeled(bool theIsCellsLabeled){
vtkUnstructuredGrid* aGrid = GetUnstructuredGrid();
myIsCellsLabeled = theIsCellsLabeled && aGrid->GetNumberOfPoints();
if(myIsCellsLabeled){
}
-void SMESH_Actor::SetControlMode(eControl theMode){
- myColorMode = eNone;
- my1DColorMode = e1DNone;
+void SMESH_ActorDef::SetControlMode(eControl theMode){
+ myControlMode = eNone;
my1DActor->GetMapper()->SetScalarVisibility(false);
my2DActor->GetMapper()->SetScalarVisibility(false);
if(anIsScalarVisible){
SMESH::Controls::FunctorPtr aFunctor;
switch(theMode){
- case eLengthEdges:
+ case eLength:
{
SMESH::Controls::Length* aControl = new SMESH::Controls::Length();
aControl->SetPrecision( myControlsPrecision );
myControlActor = my1DActor;
break;
}
+ case eLength2D:
+ {
+ aFunctor.reset(new SMESH::Controls::Length2D());
+ myControlActor = my2DActor;
+ break;
+ }
case eFreeBorders:
aFunctor.reset(new SMESH::Controls::FreeBorders());
myControlActor = my1DActor;
aFunctor.reset(new SMESH::Controls::MultiConnection());
myControlActor = my1DActor;
break;
+ case eMultiConnection2D:
+ aFunctor.reset(new SMESH::Controls::MultiConnection2D());
+ myControlActor = my2DActor;
+ break;
case eArea:
{
SMESH::Controls::Area* aControl = new SMESH::Controls::Area();
myControlActor = my2DActor;
break;
}
+ case eAspectRatio3D:
+ {
+ SMESH::Controls::AspectRatio3D* aControl = new SMESH::Controls::AspectRatio3D();
+ aControl->SetPrecision( myControlsPrecision );
+ aFunctor.reset( aControl );
+ myControlActor = my3DActor;
+ break;
+ }
case eMinimumAngle:
{
SMESH::Controls::MinimumAngle* aControl = new SMESH::Controls::MinimumAngle();
vtkUnstructuredGrid* aGrid = myControlActor->GetUnstructuredGrid();
vtkIdType aNbCells = aGrid->GetNumberOfCells();
if(aNbCells){
- myColorMode = theMode;
- if(theMode == eFreeBorders || theMode == eFreeEdges){
- my1DColorMode = e1DHighlited;
+ myControlMode = theMode;
+ switch(myControlMode){
+ case eFreeEdges:
+ case eFreeBorders:
my1DExtActor->SetExtControlMode(aFunctor,myControlActor);
- }else{
- if(myControlActor == my1DActor)
- my1DColorMode = e1DColored;
+ break;
+ case eLength2D:
+ my1DExtActor->SetExtControlMode(aFunctor,myControlActor,myScalarBarActor,myLookupTable);
+ break;
+ case eMultiConnection2D:
+ my1DExtActor->SetExtControlMode(aFunctor,myControlActor,myScalarBarActor,myLookupTable);
+ break;
+ default:
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());
myTimeStamp->Modified();
}
-void SMESH_Actor::AddToRender(vtkRenderer* theRenderer){
+void SMESH_ActorDef::AddToRender(vtkRenderer* theRenderer){
SALOME_Actor::AddToRender(theRenderer);
theRenderer->AddActor(myNodeActor);
theRenderer->AddActor2D(myCellsLabels);
}
-void SMESH_Actor::RemoveFromRender(vtkRenderer* theRenderer){
+void SMESH_ActorDef::RemoveFromRender(vtkRenderer* theRenderer){
SALOME_Actor::RemoveFromRender(theRenderer);
theRenderer->RemoveActor(myNodeActor);
}
-bool SMESH_Actor::Init(TVisualObjPtr theVisualObj,
- const char* theEntry,
- const char* theName,
- int theIsClear)
+bool SMESH_ActorDef::Init(TVisualObjPtr theVisualObj,
+ const char* theEntry,
+ const char* theName,
+ int theIsClear)
{
Handle(SALOME_InteractiveObject) anIO = new SALOME_InteractiveObject(theEntry,"SMESH",theName);
setIO(anIO);
my3DActor->Init(myVisualObj,myImplicitBoolean);
my1DActor->GetMapper()->SetLookupTable(myLookupTable);
+ my1DExtActor->GetMapper()->SetLookupTable(myLookupTable);
+
my2DActor->GetMapper()->SetLookupTable(myLookupTable);
my3DActor->GetMapper()->SetLookupTable(myLookupTable);
}
-float* SMESH_Actor::GetBounds(){
+float* SMESH_ActorDef::GetBounds(){
return myNodeActor->GetBounds();
}
-vtkDataSet* SMESH_Actor::GetInput(){
+vtkDataSet* SMESH_ActorDef::GetInput(){
return GetUnstructuredGrid();
}
-void SMESH_Actor::SetTransform(SALOME_Transform* theTransform){
+void SMESH_ActorDef::SetTransform(SALOME_Transform* theTransform){
myNodeActor->SetTransform(theTransform);
myBaseActor->SetTransform(theTransform);
}
-void SMESH_Actor::SetMapper(vtkMapper* theMapper){
+void SMESH_ActorDef::SetMapper(vtkMapper* theMapper){
vtkLODActor::SetMapper(theMapper);
}
-void SMESH_Actor::ShallowCopy(vtkProp *prop){
+void SMESH_ActorDef::ShallowCopy(vtkProp *prop){
SALOME_Actor::ShallowCopy(prop);
}
-vtkMapper* SMESH_Actor::GetMapper(){
+vtkMapper* SMESH_ActorDef::GetMapper(){
return myPickableActor->GetMapper();
}
-vtkUnstructuredGrid* SMESH_Actor::GetUnstructuredGrid(){
+vtkUnstructuredGrid* SMESH_ActorDef::GetUnstructuredGrid(){
return myVisualObj->GetUnstructuredGrid();
}
-bool SMESH_Actor::IsInfinitive(){
+bool SMESH_ActorDef::IsInfinitive(){
vtkDataSet *aDataSet = myPickableActor->GetUnstructuredGrid();
aDataSet->Update();
myIsInfinite = aDataSet->GetNumberOfCells() == 0 ||
}
-void SMESH_Actor::SetIsShrunkable(bool theShrunkable){
+void SMESH_ActorDef::SetIsShrunkable(bool theShrunkable){
myIsShrinkable = theShrunkable;
Modified();
}
-float SMESH_Actor::GetShrinkFactor(){
+float SMESH_ActorDef::GetShrinkFactor(){
return myBaseActor->GetShrinkFactor();
}
-void SMESH_Actor::SetShrinkFactor(float theValue){
+void SMESH_ActorDef::SetShrinkFactor(float theValue){
myBaseActor->SetShrinkFactor(theValue);
my1DActor->SetShrinkFactor(theValue);
Modified();
}
-void SMESH_Actor::SetShrink(){
+void SMESH_ActorDef::SetShrink(){
if(!myIsShrinkable) return;
myBaseActor->SetShrink();
Modified();
}
-void SMESH_Actor::UnShrink(){
+void SMESH_ActorDef::UnShrink(){
if(!myIsShrunk) return;
myBaseActor->UnShrink();
}
-int SMESH_Actor::GetNodeObjId(int theVtkID){
+int SMESH_ActorDef::GetNodeObjId(int theVtkID){
return myPickableActor->GetNodeObjId(theVtkID);
}
-float* SMESH_Actor::GetNodeCoord(int theObjID){
+float* SMESH_ActorDef::GetNodeCoord(int theObjID){
return myPickableActor->GetNodeCoord(theObjID);
}
-int SMESH_Actor::GetElemObjId(int theVtkID){
+int SMESH_ActorDef::GetElemObjId(int theVtkID){
return myPickableActor->GetElemObjId(theVtkID);
}
-vtkCell* SMESH_Actor::GetElemCell(int theObjID){
+vtkCell* SMESH_ActorDef::GetElemCell(int theObjID){
return myPickableActor->GetElemCell(theObjID);
}
-void SMESH_Actor::SetVisibility(int theMode){
+void SMESH_ActorDef::SetVisibility(int theMode){
SetVisibility(theMode,true);
}
-void SMESH_Actor::SetVisibility(int theMode, bool theIsUpdateRepersentation){
+void SMESH_ActorDef::SetVisibility(int theMode, bool theIsUpdateRepersentation){
SALOME_Actor::SetVisibility(theMode);
+
+ myNodeActor->VisibilityOff();
+ myBaseActor->VisibilityOff();
+
+ my1DActor->VisibilityOff();
+ my1DExtActor->VisibilityOff();
+
+ my2DActor->VisibilityOff();
+ my3DActor->VisibilityOff();
+
+ myScalarBarActor->VisibilityOff();
+ myPointLabels->VisibilityOff();
+ myCellsLabels->VisibilityOff();
+
if(GetVisibility()){
if(theIsUpdateRepersentation)
SetRepresentation(GetRepresentation());
- if(myColorMode != eNone){
- if(my1DColorMode == e1DHighlited)
+ if(myControlMode != eNone){
+ switch(myControlMode){
+ case eFreeEdges:
+ case eFreeBorders:
+ my1DExtActor->VisibilityOn();
+ break;
+ case eLength2D:
my1DExtActor->VisibilityOn();
- else if(myControlActor->GetUnstructuredGrid()->GetNumberOfCells())
- myScalarBarActor->VisibilityOn();
+ case eMultiConnection2D:
+ my1DExtActor->VisibilityOn();
+ default:
+ if(myControlActor->GetUnstructuredGrid()->GetNumberOfCells())
+ myScalarBarActor->VisibilityOn();
+ }
}
if(myRepresentation != ePoint)
myPickableActor->VisibilityOn();
- my1DActor->VisibilityOn();
+ if(myEntityMode & eEdges)
+ my1DActor->VisibilityOn();
+
+ if(myEntityMode & eFaces)
+ my2DActor->VisibilityOn();
+
+ if(myEntityMode & eVolumes)
+ my3DActor->VisibilityOn();
+
+ if(myIsPointsLabeled)
+ myPointLabels->VisibilityOn();
- my2DActor->VisibilityOn();
- my3DActor->VisibilityOn();
+ if(myIsCellsLabeled)
+ myCellsLabels->VisibilityOn();
+ }
- if(myIsPointsLabeled) myPointLabels->VisibilityOn();
- if(myIsCellsLabeled) myCellsLabels->VisibilityOn();
- }else{
- myNodeActor->VisibilityOff();
- myBaseActor->VisibilityOff();
+ Modified();
+}
- my1DActor->VisibilityOff();
- my1DExtActor->VisibilityOff();
- my2DActor->VisibilityOff();
- my3DActor->VisibilityOff();
+void SMESH_ActorDef::SetEntityMode(unsigned int theMode){
+ if(!myVisualObj->GetNbEntities(SMDSAbs_Edge))
+ theMode &= ~eEdges;
- myScalarBarActor->VisibilityOff();
- myPointLabels->VisibilityOff();
- myCellsLabels->VisibilityOff();
- }
- Modified();
-}
+ if(!myVisualObj->GetNbEntities(SMDSAbs_Face))
+ theMode &= ~eFaces;
+
+ if(!myVisualObj->GetNbEntities(SMDSAbs_Volume))
+ theMode &= ~eVolumes;
+ if(!theMode)
+ return;
-void SMESH_Actor::SetRepresentation(int theMode){
- int aNbEdges = myVisualObj->GetNbEntities(SMESH::EDGE);
- int aNbFaces = myVisualObj->GetNbEntities(SMESH::FACE);
- int aNbVolumes = myVisualObj->GetNbEntities(SMESH::VOLUME);
+ 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){
myRepresentation = eSurface;
if(!aNbFaces && !aNbVolumes && aNbEdges){
my3DActor->SetRepresentation(aReperesent);
my1DExtActor->SetVisibility(false);
- switch(my1DColorMode){
- case e1DColored:
+
+ switch(myControlMode){
+ case eLength:
+ case eMultiConnection:
aProp = aBackProp = my1DProp;
if(myRepresentation != ePoint)
aReperesent = SMESH_DeviceActor::eInsideframe;
break;
- case e1DHighlited:
- my1DExtActor->SetVisibility(true);
- break;
}
my1DActor->SetProperty(aProp);
}
-void SMESH_Actor::SetPointRepresentation(bool theIsPointsVisible){
+void SMESH_ActorDef::SetPointRepresentation(bool theIsPointsVisible){
myIsPointsVisible = theIsPointsVisible;
SetRepresentation(GetRepresentation());
}
-bool SMESH_Actor::GetPointRepresentation(){
+bool SMESH_ActorDef::GetPointRepresentation(){
return myIsPointsVisible || myIsPointsLabeled;
}
-void SMESH_Actor::UpdateHighlight(){
+void SMESH_ActorDef::UpdateHighlight(){
myHighlitableActor->SetVisibility(false);
myHighlitableActor->SetHighlited(false);
}
-void SMESH_Actor::highlight(bool theHighlight){
+void SMESH_ActorDef::highlight(bool theHighlight){
myIsHighlighted = theHighlight;
UpdateHighlight();
}
-void SMESH_Actor::SetPreSelected(bool thePreselect){
+void SMESH_ActorDef::SetPreSelected(bool thePreselect){
myIsPreselected = thePreselect;
UpdateHighlight();
}
// From vtkFollower
-int SMESH_Actor::RenderOpaqueGeometry(vtkViewport *vp)
+int SMESH_ActorDef::RenderOpaqueGeometry(vtkViewport *vp)
{
if (myPickableActor->GetIsOpaque())
{
}
-int SMESH_Actor::RenderTranslucentGeometry(vtkViewport *vp)
+int SMESH_ActorDef::RenderTranslucentGeometry(vtkViewport *vp)
{
if (!myPickableActor->GetIsOpaque())
{
}
-void SMESH_Actor::Render(vtkRenderer *ren){
- unsigned long mTime = myTimeStamp->GetMTime();
+void SMESH_ActorDef::Render(vtkRenderer *ren){
+ unsigned long aTime = myTimeStamp->GetMTime();
unsigned long anObjTime = myVisualObj->GetUnstructuredGrid()->GetMTime();
- if(anObjTime > mTime)
+ unsigned long aClippingTime = myImplicitBoolean->GetMTime();
+ if(anObjTime > aTime || aClippingTime > aTime)
Update();
}
-void SMESH_Actor::Update(){
- SetVisibility(GetVisibility());
- 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");
+void SMESH_ActorDef::Update(){
+ if(MYDEBUG) MESSAGE("SMESH_ActorDef::Update");
if(GetControlMode() != eNone) {
- if(anObjTime > aTime || aClippingTime > aTime){
- SetControlMode(GetControlMode());
- SetVisibility(GetVisibility());
- }
+ SetControlMode(GetControlMode());
}
if(myIsPointsLabeled){
- if(anObjTime > aTime || aClippingTime > aTime)
- SetPointsLabeled(myIsPointsLabeled);
+ SetPointsLabeled(myIsPointsLabeled);
}
if(myIsCellsLabeled){
- if(anObjTime > aTime || aClippingTime > aTime)
- SetCellsLabeled(myIsCellsLabeled);
+ SetCellsLabeled(myIsCellsLabeled);
}
-
+ SetVisibility(GetVisibility());
+
myTimeStamp->Modified();
Modified();
}
-void SMESH_Actor::ReleaseGraphicsResources(vtkWindow *renWin){
+void SMESH_ActorDef::ReleaseGraphicsResources(vtkWindow *renWin){
SALOME_Actor::ReleaseGraphicsResources(renWin);
myPickableActor->ReleaseGraphicsResources(renWin);
}
-void SMESH_Actor::SetOpacity(float theValue){
+void SMESH_ActorDef::SetOpacity(float theValue){
mySurfaceProp->SetOpacity(theValue);
myBackSurfaceProp->SetOpacity(theValue);
myEdgeProp->SetOpacity(theValue);
}
-float SMESH_Actor::GetOpacity(){
+float SMESH_ActorDef::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);
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);
}
-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);
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);
}
-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);
my1DProp->SetColor(r,g,b);
my1DExtProp->SetColor(1.0-r,1.0-g,1.0-b);
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);
}
-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);
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);
}
-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);
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);
}
-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);
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);
}
-float SMESH_Actor::GetLineWidth(){
+float SMESH_ActorDef::GetLineWidth(){
return myEdgeProp->GetLineWidth();
}
-void SMESH_Actor::SetLineWidth(float theVal){
+void SMESH_ActorDef::SetLineWidth(float theVal){
myEdgeProp->SetLineWidth(theVal);
my1DProp->SetLineWidth(theVal + aLineWidthInc);
}
-void SMESH_Actor::SetNodeSize(float theVal){
+void SMESH_ActorDef::SetNodeSize(float theVal){
myNodeProp->SetPointSize(theVal);
myHighlightProp->SetPointSize(theVal);
myPreselectProp->SetPointSize(theVal);
Modified();
}
-float SMESH_Actor::GetNodeSize(){
+float SMESH_ActorDef::GetNodeSize(){
return myNodeProp->GetPointSize();
}
-int SMESH_Actor::GetObjDimension( const int theObjId )
+int SMESH_ActorDef::GetObjDimension( const int theObjId )
{
return myVisualObj->GetElemDimension( theObjId );
}
-vtkImplicitBoolean* SMESH_Actor::GetPlaneContainer(){
+vtkImplicitBoolean* SMESH_ActorDef::GetPlaneContainer(){
return myImplicitBoolean;
}
}
-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);
float anOrigin[3];
::DistanceToPosition(GetUnstructuredGrid(),theDir,theDist,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);
#include "SALOME_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_Actor : public SALOME_Actor{
- friend class SMESH_VisualObj;
+class SMESH_Actor: public SALOME_Actor
+{
+ static SMESH_Actor* New() { return NULL;}
public:
vtkTypeMacro(SMESH_Actor,SALOME_Actor);
const char* theName,
int theIsClear);
- virtual void ReleaseGraphicsResources(vtkWindow *renWin);
- virtual int RenderOpaqueGeometry(vtkViewport *viewport);
- virtual int RenderTranslucentGeometry(vtkViewport *viewport);
- virtual void Render(vtkRenderer *ren);
-
- 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();
-
- void SetSufaceColor(float r,float g,float b);
- void GetSufaceColor(float& r,float& g,float& b);
-
- void SetBackSufaceColor(float r,float g,float b);
- void GetBackSufaceColor(float& r,float& g,float& b);
-
- void SetEdgeColor(float r,float g,float b);
- void GetEdgeColor(float& r,float& g,float& b);
+ virtual void SetSufaceColor(float r,float g,float b) = 0;
+ virtual void GetSufaceColor(float& r,float& g,float& b) = 0;
+
+ virtual void SetBackSufaceColor(float r,float g,float b) = 0;
+ virtual void GetBackSufaceColor(float& r,float& g,float& b) = 0;
+
+ virtual void SetEdgeColor(float r,float g,float b) = 0;
+ virtual void GetEdgeColor(float& r,float& g,float& b) = 0;
- void SetNodeColor(float r,float g,float b);
- void GetNodeColor(float& r,float& g,float& b);
+ virtual void SetNodeColor(float r,float g,float b) = 0;
+ virtual void GetNodeColor(float& r,float& g,float& b) = 0;
- void SetHighlightColor(float r,float g,float b);
- void GetHighlightColor(float& r,float& g,float& b);
+ virtual void SetHighlightColor(float r,float g,float b) = 0;
+ virtual void GetHighlightColor(float& r,float& g,float& b) = 0;
- void SetPreHighlightColor(float r,float g,float b);
- void GetPreHighlightColor(float& r,float& g,float& b);
+ virtual void SetPreHighlightColor(float r,float g,float b) = 0;
+ virtual void GetPreHighlightColor(float& r,float& g,float& b) = 0;
- float GetLineWidth();
- void SetLineWidth(float theVal);
-
- void SetNodeSize(float size) ;
- float GetNodeSize() ;
-
- virtual int GetNodeObjId(int theVtkID);
- virtual float* GetNodeCoord(int theObjID);
+ virtual float GetLineWidth() = 0;
+ virtual void SetLineWidth(float theVal) = 0;
- 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 SetNodeSize(float size) = 0;
+ virtual float GetNodeSize() = 0;
enum EReperesent { ePoint, eEdge, eSurface};
- virtual void SetRepresentation(int theMode);
- void SetPointRepresentation(bool theIsPointsVisible);
- bool GetPointRepresentation();
-
- virtual float* GetBounds();
- virtual void SetTransform(SALOME_Transform* theTransform);
-
- vtkUnstructuredGrid* GetUnstructuredGrid();
- virtual vtkDataSet* GetInput();
- virtual vtkMapper* GetMapper();
-
- virtual float GetShrinkFactor();
- virtual void SetShrinkFactor(float value );
-
- virtual bool IsShrunkable() { return myIsShrinkable;}
- virtual bool IsShrunk() { return myIsShrunk;}
- virtual void SetShrink();
- virtual void UnShrink();
-
- void SetPointsLabeled(bool theIsPointsLabeled);
- bool GetPointsLabeled(){ return myIsPointsLabeled;}
-
- void SetCellsLabeled(bool theIsCellsLabeled);
- bool GetCellsLabeled(){ return myIsCellsLabeled;}
-
- enum eControl{eNone, eLengthEdges, eFreeBorders, eFreeEdges, eMultiConnection,
- eArea, eTaper, eAspectRatio, eMinimumAngle, eWarping, eSkew};
- void SetControlMode(eControl theMode);
- eControl GetControlMode(){ return myColorMode;}
-
- enum e1DControl{e1DNone, e1DColored, e1DHighlited};
- e1DControl Get1DControlMode(){ return my1DColorMode;}
-
- vtkScalarBarActor* GetScalarBarActor(){ return myScalarBarActor;}
-
- void SetPlaneParam(float theDir[3], float theDist, vtkPlane* thePlane);
- void GetPlaneParam(float theDir[3], float& theDist, vtkPlane* thePlane);
-
- vtkImplicitBoolean* GetPlaneContainer();
+
+ enum EEntityMode { eEdges = 0x01, eFaces = 0x02, eVolumes = 0x04, eAllEntity = 0x07};
+ virtual void SetEntityMode(unsigned int theMode) = 0;
+ virtual unsigned int GetEntityMode() const = 0;
- TVisualObjPtr GetObject() { return myVisualObj;}
+ virtual void SetPointRepresentation(bool theIsPointsVisible) = 0;
+ virtual bool GetPointRepresentation() = 0;
- void SetControlsPrecision( const long p ) { myControlsPrecision = p; }
- long GetControlsPrecision() const { return myControlsPrecision; }
+ virtual vtkUnstructuredGrid* GetUnstructuredGrid() = 0;
- protected:
- TVisualObjPtr myVisualObj;
- vtkTimeStamp* myTimeStamp;
+ virtual void SetShrinkFactor(float theValue) = 0;
- vtkScalarBarActor* myScalarBarActor;
- vtkLookupTable* myLookupTable;
+ virtual void SetPointsLabeled(bool theIsPointsLabeled) = 0;
+ virtual bool GetPointsLabeled() = 0;
- vtkProperty* mySurfaceProp;
- vtkProperty* myBackSurfaceProp;
- vtkProperty* myEdgeProp;
- vtkProperty* myNodeProp;
+ virtual void SetCellsLabeled(bool theIsCellsLabeled) = 0;
+ virtual bool GetCellsLabeled() = 0;
- SMESH_DeviceActor* myBaseActor;
- SMESH_DeviceActor* myNodeActor;
- SMESH_DeviceActor* myPickableActor;
+ enum eControl{eNone, eLength, eLength2D, eFreeBorders, eFreeEdges, eMultiConnection,
+ eArea, eTaper, eAspectRatio, eMinimumAngle, eWarping, eSkew,
+ eAspectRatio3D, eMultiConnection2D};
+ virtual void SetControlMode(eControl theMode) = 0;
+ virtual eControl GetControlMode() = 0;
- vtkProperty* myHighlightProp;
- vtkProperty* myPreselectProp;
- SMESH_DeviceActor* myHighlitableActor;
- SMESH_DeviceActor* myNodeHighlitableActor;
+ virtual vtkScalarBarActor* GetScalarBarActor() = 0;
- eControl myColorMode;
- SMESH_DeviceActor* my2DActor;
- SMESH_DeviceActor* my3DActor;
- SMESH_DeviceActor* myControlActor;
+ virtual void SetPlaneParam(float theDir[3], float theDist, vtkPlane* thePlane) = 0;
+ virtual void GetPlaneParam(float theDir[3], float& theDist, vtkPlane* thePlane) = 0;
- e1DControl my1DColorMode;
- vtkProperty* my1DProp;
- SMESH_DeviceActor* my1DActor;
- vtkProperty* my1DExtProp;
- SMESH_DeviceActor* my1DExtActor;
+ virtual vtkImplicitBoolean* GetPlaneContainer() = 0;
- bool myIsPointsVisible;
+ virtual TVisualObjPtr GetObject() = 0;
- 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&);
+ virtual void SetControlsPrecision( const long ) = 0;
+ virtual long GetControlsPrecision() const = 0;
};
--- /dev/null
+// 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
#include "QAD_Config.h"
#include "utilities.h"
+#include <vtkUnstructuredGrid.h>
+#include <vtkUnstructuredGridWriter.h>
+
#ifdef _DEBUG_
static int MYDEBUG = 1;
#else
#endif
namespace SMESH{
+
float GetFloat(const QString& theValue, float theDefault){
if(theValue.isEmpty()) return theDefault;
QString aValue = QAD_CONFIG->getSetting(theValue);
if(aValue.isEmpty()) return theDefault;
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();
+ }
+
}
#include <qstring.h>
+class vtkUnstructuredGrid;
namespace SMESH{
+
float GetFloat(const QString& theValue, float theDefault = 0);
-}
+ void WriteUnstructuredGrid(vtkUnstructuredGrid* theGrid, const char* theFileName);
+
+}
#endif
// File : SMESH_Actor.cxx
// Author : Nicolas REJNERI
// Module : SMESH
-// $Header$
+// $Header$Header$
#include "SMESH_DeviceActor.h"
#include "SMESH_ExtractGeometry.h"
+#include "SMESH_ControlsDef.hxx"
+#include "SMESH_ActorUtils.h"
#include "SALOME_Transform.h"
#include "SALOME_TransformFilter.h"
#include "SALOME_PassThroughFilter.h"
#include "SALOME_ExtractUnstructuredGrid.h"
-#include "utilities.h"
-
// VTK Includes
#include <vtkObjectFactory.h>
#include <vtkShrinkFilter.h>
#include <vtkImplicitBoolean.h>
+#include "utilities.h"
+
#ifdef _DEBUG_
static int MYDEBUG = 0;
-static int MYDEBUGWITHFILES = 0;
#else
static int MYDEBUG = 0;
-static int MYDEBUGWITHFILES = 0;
#endif
using namespace std;
myExtractUnstructuredGrid->SetInput(myExtractGeometry->GetOutput());
myMergeFilter->SetGeometry(myExtractUnstructuredGrid->GetOutput());
-
+
theGrid = static_cast<vtkUnstructuredGrid*>(myMergeFilter->GetOutput());
int anId = 0;
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,
SMESH_DeviceActor* theDeviceActor)
anIdList->SetNumberOfIds(2);
FreeEdges::TBorders::const_iterator anIter = aBorders.begin();
- for(vtkIdType aVtkId; anIter != aBorders.end(); anIter++){
+ for(; anIter != aBorders.end(); anIter++){
const FreeEdges::Border& aBorder = *anIter;
int aNode[2] = {
myVisualObj->GetNodeVTKId(aBorder.myPntId[0]),
SetUnstructuredGrid(aDataSet);
aDataSet->Delete();
- }
+ }
}
+
+
unsigned long int SMESH_DeviceActor::GetMTime(){
unsigned long mTime = this->Superclass::GetMTime();
mTime = max(mTime,myExtractGeometry->GetMTime());
class SMESH_DeviceActor: public vtkLODActor{
- friend class SMESH_Actor;
+ friend class SMESH_ActorDef;
public:
vtkTypeMacro(SMESH_DeviceActor,vtkLODActor);
void SetControlMode(SMESH::Controls::FunctorPtr theFunctor,
vtkScalarBarActor* theScalarBarActor,
vtkLookupTable* theLookupTable);
+ void SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor,
+ SMESH_DeviceActor* theDeviceActor,
+ vtkScalarBarActor* theScalarBarActor,
+ vtkLookupTable* theLookupTable);
void SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor,
SMESH_DeviceActor* theDeviceActor);
// Author : Nicolas REJNERI
// Module : SMESH
-#include "SMESH_Object.h"
+#include "SMESH_ObjectDef.h"
+#include "SMESH_ActorUtils.h"
+
#include "SMDS_Mesh.hxx"
-#include "SALOME_ExtractUnstructuredGrid.h"
#include "SMESH_Actor.h"
+#include "SMESH_ControlsDef.hxx"
+#include "SALOME_ExtractUnstructuredGrid.h"
#include CORBA_SERVER_HEADER(SALOME_Exception)
#include <vtkUnsignedCharArray.h>
#include <vtkUnstructuredGrid.h>
-#include <vtkUnstructuredGridWriter.h>
-#include <vtkUnstructuredGridReader.h>
#include <memory>
#include <sstream>
#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{
inline const SMDS_MeshNode* FindNode(const SMDS_Mesh* theMesh, int theId){
SMESH::log_array_var& theSeq,
CORBA::Long theId)
{
- const SMESH::double_array& aCoords = theSeq[theId].coords;
const SMESH::long_array& anIndexes = theSeq[theId].indexes;
CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
if(3*aNbElems != anIndexes.length())
SMESH::log_array_var& theSeq,
CORBA::Long theId)
{
- const SMESH::double_array& aCoords = theSeq[theId].coords;
const SMESH::long_array& anIndexes = theSeq[theId].indexes;
CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
if(4*aNbElems != anIndexes.length())
SMESH::log_array_var theSeq,
CORBA::Long theId)
{
- const SMESH::double_array& aCoords = theSeq[theId].coords;
const SMESH::long_array& anIndexes = theSeq[theId].indexes;
CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
if(5*aNbElems != anIndexes.length())
SMESH::log_array_var& theSeq,
CORBA::Long theId)
{
- const SMESH::double_array& aCoords = theSeq[theId].coords;
const SMESH::long_array& anIndexes = theSeq[theId].indexes;
CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
if(5*aNbElems != anIndexes.length())
SMESH::log_array_var& theSeq,
CORBA::Long theId)
{
- const SMESH::double_array& aCoords = theSeq[theId].coords;
const SMESH::long_array& anIndexes = theSeq[theId].indexes;
CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
if(6*aNbElems != anIndexes.length())
SMESH::log_array_var& theSeq,
CORBA::Long theId)
{
- const SMESH::double_array& aCoords = theSeq[theId].coords;
const SMESH::long_array& anIndexes = theSeq[theId].indexes;
CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
if(7*aNbElems != anIndexes.length())
SMESH::log_array_var& theSeq,
CORBA::Long theId)
{
- const SMESH::double_array& aCoords = theSeq[theId].coords;
const SMESH::long_array& anIndexes = theSeq[theId].indexes;
CORBA::Long anElemId = 0, aNbElems = theSeq[theId].number;
if(9*aNbElems != anIndexes.length())
}
/*
- Class : SMESH_VisualObj
+ Class : SMESH_VisualObjDef
Description : Base class for all mesh objects to be visuilised
*/
// function : getCellType
// 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 )
{
switch( theType )
{
- case SMESH::EDGE: return theNbNodes == 2 ? VTK_LINE : VTK_EMPTY_CELL;
-
- case SMESH::FACE : if ( theNbNodes == 3 ) return VTK_TRIANGLE;
- else if ( theNbNodes == 4 ) return VTK_QUAD;
- else return VTK_EMPTY_CELL;
+ case SMDSAbs_Edge:
+ return theNbNodes == 2 ? VTK_LINE : VTK_EMPTY_CELL;
- case SMESH::VOLUME: if ( theNbNodes == 4 ) return VTK_TETRA;
- else if ( theNbNodes == 5 ) return VTK_PYRAMID;
- else if ( theNbNodes == 6 ) return VTK_WEDGE;
- else if ( theNbNodes == 8 ) return VTK_HEXAHEDRON;
- else return VTK_EMPTY_CELL;
+ case SMDSAbs_Face :
+ if ( theNbNodes == 3 ) return VTK_TRIANGLE;
+ else if ( theNbNodes == 4 ) return VTK_QUAD;
+ else return VTK_EMPTY_CELL;
+
+ case SMDSAbs_Volume:
+ if ( theNbNodes == 4 ) return VTK_TETRA;
+ else if ( theNbNodes == 5 ) return VTK_PYRAMID;
+ else if ( theNbNodes == 6 ) return VTK_WEDGE;
+ else if ( theNbNodes == 8 ) return VTK_HEXAHEDRON;
+ else return VTK_EMPTY_CELL;
default: return VTK_EMPTY_CELL;
}
}
//=================================================================================
-// functions : SMESH_VisualObj
+// functions : SMESH_VisualObjDef
// purpose : Constructor
//=================================================================================
-SMESH_VisualObj::SMESH_VisualObj()
+SMESH_VisualObjDef::SMESH_VisualObjDef()
{
myGrid = vtkUnstructuredGrid::New();
}
-SMESH_VisualObj::~SMESH_VisualObj()
+SMESH_VisualObjDef::~SMESH_VisualObjDef()
{
if ( MYDEBUG )
MESSAGE( "~SMESH_MeshObj - myGrid->GetReferenceCount() = " << myGrid->GetReferenceCount() );
// functions : GetNodeObjId, GetNodeVTKId, GetElemObjId, GetElemVTKId
// 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];
}
-vtkIdType SMESH_VisualObj::GetNodeVTKId( int theObjID )
+vtkIdType SMESH_VisualObjDef::GetNodeVTKId( int 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];
}
-vtkIdType SMESH_VisualObj::GetElemVTKId( int theObjID )
+vtkIdType SMESH_VisualObjDef::GetElemVTKId( int theObjID )
{
return mySMDS2VTKElems.find(theObjID) == mySMDS2VTKElems.end() ? -1 : mySMDS2VTKElems[theObjID];
}
//=================================================================================
-// function : SMESH_VisualObj::createPoints
+// function : SMESH_VisualObjDef::createPoints
// purpose : Create points from nodes
//=================================================================================
-void SMESH_VisualObj::createPoints( vtkPoints* thePoints )
+void SMESH_VisualObjDef::createPoints( vtkPoints* thePoints )
{
if ( thePoints == 0 )
return;
TEntityList aNodes;
- vtkIdType nbNodes = GetEntities( SMESH::NODE, aNodes );
+ vtkIdType nbNodes = GetEntities( SMDSAbs_Node, aNodes );
thePoints->SetNumberOfPoints( nbNodes );
int nbPoints = 0;
// function : buildPrs
// purpose : create VTK cells( fill unstructured grid )
//=================================================================================
-void SMESH_VisualObj::buildPrs()
+void SMESH_VisualObjDef::buildPrs()
{
try
{
}
if( MYDEBUG ) MESSAGE( "Update - myGrid->GetNumberOfCells() = "<<myGrid->GetNumberOfCells() );
- if( MYDEBUGWITHFILES ) WriteUnstructuredGrid( myGrid,"/tmp/buildPrs" );
+ if( MYDEBUGWITHFILES ) SMESH::WriteUnstructuredGrid( myGrid,"/tmp/buildPrs" );
}
//=================================================================================
// function : buildNodePrs
// purpose : create VTK cells for nodes
//=================================================================================
-void SMESH_VisualObj::buildNodePrs()
+void SMESH_VisualObjDef::buildNodePrs()
{
vtkPoints* aPoints = vtkPoints::New();
createPoints( aPoints );
- int nbPoints = aPoints->GetNumberOfPoints();
myGrid->SetPoints( aPoints );
aPoints->Delete();
// Create cells
/*
+ int nbPoints = aPoints->GetNumberOfPoints();
vtkIdList *anIdList = vtkIdList::New();
anIdList->SetNumberOfIds( 1 );
// function : buildElemPrs
// 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
// 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
- map< int, int > nbEnts;
- map< int, TEntityList > anEnts;
+ map<SMDSAbs_ElementType,int> nbEnts;
+ map<SMDSAbs_ElementType,TEntityList> anEnts;
for ( int i = 0; i <= 2; 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
{
}
}
- vtkIdType aNbCells = nbEnts[ SMESH::EDGE ] + nbEnts[ SMESH::FACE ] + nbEnts[ SMESH::VOLUME ];
+ vtkIdType aNbCells = nbEnts[ SMDSAbs_Edge ] + nbEnts[ SMDSAbs_Face ] + nbEnts[ SMDSAbs_Volume ];
if ( MYDEBUG )
MESSAGE( "Update - aNbCells = "<<aNbCells<<"; aCellsSize = "<<aCellsSize );
vtkIdList *anIdList = vtkIdList::New();
vtkIdType iElem = 0;
-
+
+ TConnect aConnect;
+ aConnect.reserve(VTK_CELL_SIZE);
+
for ( int i = 0; i <= 2; i++ ) // iterate through edges, faces and volumes
{
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;
for ( anIter = aList.begin(); anIter != aList.end(); ++anIter )
{
myVTK2SMDSElems.insert( TMapOfIds::value_type( iElem, anId ) );
SMDS_ElemIteratorPtr aNodesIter = anElem->nodesIterator();
- for( vtkIdType aNodeId = 0; aNodesIter->more(); aNodeId++ )
- {
- const SMDS_MeshElement* aNode = aNodesIter->next();
- anIdList->SetId( aNodeId, mySMDS2VTKNodes[aNode->GetID()] );
- }
+ 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();
+ anIdList->SetId( aNodeId, mySMDS2VTKNodes[aNode->GetID()] );
+ }
+ }
aConnectivity->InsertNextCell( anIdList );
- aCellTypesArray->InsertNextValue( getCellType( aTypes[ i ], aNbNodes ) );
+ aCellTypesArray->InsertNextValue( getCellType( aType, aNbNodes ) );
iElem++;
}
// function : GetEdgeNodes
// purpose : Retrieve ids of nodes from edge of elements ( edge is numbered from 1 )
//=================================================================================
-bool SMESH_VisualObj::GetEdgeNodes( const int theElemId,
- const int theEdgeNum,
- int& theNodeId1,
- int& theNodeId2 ) const
+bool SMESH_VisualObjDef::GetEdgeNodes( const int theElemId,
+ const int theEdgeNum,
+ int& theNodeId1,
+ int& theNodeId2 ) const
{
const SMDS_Mesh* aMesh = GetMesh();
if ( aMesh == 0 )
const SMESH::double_array& aCoords = aSeq[anId].coords;
const SMESH::long_array& anIndexes = aSeq[anId].indexes;
CORBA::Long anElemId = 0, aNbElems = aSeq[anId].number;
- SMDS_MeshElement* anElem = NULL;
CORBA::Long aCommand = aSeq[anId].commandType;
switch(aCommand)
// function : GetEntities
// 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 )
{
- case SMESH::NODE:
+ case SMDSAbs_Node:
{
return myMesh->NbNodes();
}
break;
- case SMESH::EDGE:
+ case SMDSAbs_Edge:
{
return myMesh->NbEdges();
}
break;
- case SMESH::FACE:
+ case SMDSAbs_Face:
{
return myMesh->NbFaces();
}
break;
- case SMESH::VOLUME:
+ case SMDSAbs_Volume:
{
return myMesh->NbVolumes();
}
}
}
-int SMESH_MeshObj::GetEntities( const SMESH::ElementType theType, TEntityList& theObjs ) const
+int SMESH_MeshObj::GetEntities( const SMDSAbs_ElementType theType, TEntityList& theObjs ) const
{
theObjs.clear();
switch ( theType )
{
- case SMESH::NODE:
+ case SMDSAbs_Node:
{
SMDS_NodeIteratorPtr anIter = myMesh->nodesIterator();
while ( anIter->more() ) theObjs.push_back( anIter->next() );
}
break;
- case SMESH::EDGE:
+ case SMDSAbs_Edge:
{
SMDS_EdgeIteratorPtr anIter = myMesh->edgesIterator();
while ( anIter->more() ) theObjs.push_back( anIter->next() );
}
break;
- case SMESH::FACE:
+ case SMDSAbs_Face:
{
SMDS_FaceIteratorPtr anIter = myMesh->facesIterator();
while ( anIter->more() ) theObjs.push_back( anIter->next() );
}
break;
- case SMESH::VOLUME:
+ case SMDSAbs_Volume:
{
SMDS_VolumeIteratorPtr anIter = myMesh->volumesIterator();
while ( anIter->more() ) theObjs.push_back( anIter->next() );
// function : getPointers
// 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,
const SMDS_Mesh* theMesh,
std::list<const SMDS_MeshElement*>& theResList )
{
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 ] );
if ( anElem != 0 )
// function : GetEntities
// 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 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();
SMDS_Mesh* aMesh = myMeshObj->GetMesh();
if ( myGroupServer->Size() == 0 || aMesh == 0 )
return 0;
- SMESH::ElementType aGrpType = myGroupServer->GetType();
+ SMDSAbs_ElementType aGrpType = SMDSAbs_ElementType(myGroupServer->GetType());
SMESH::long_array_var anIds = myGroupServer->GetListOfID();
if ( aGrpType == theType )
return getPointers( theType, anIds, aMesh, theResList );
- else if ( theType == SMESH::NODE )
+ else if ( theType == SMDSAbs_Node )
return getNodesFromElems( anIds, aMesh, theResList );
else
return 0;
// function : GetEntities
// 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 )
{
- case SMESH::NODE:
+ case SMDSAbs_Node:
{
return mySubMeshServer->GetNumberOfNodes( false );
}
break;
- case SMESH::EDGE:
- case SMESH::FACE:
- case SMESH::VOLUME:
+ case SMDSAbs_Edge:
+ case SMDSAbs_Face:
+ case SMDSAbs_Volume:
{
- SMESH::long_array_var anIds = mySubMeshServer->GetElementsByType( theType );
+ SMESH::long_array_var anIds =
+ mySubMeshServer->GetElementsByType( SMESH::ElementType(theType) );
return anIds->length();
}
default:
}
}
-int SMESH_subMeshObj::GetEntities( const SMESH::ElementType theType, TEntityList& theResList ) const
+int SMESH_subMeshObj::GetEntities( const SMDSAbs_ElementType theType, TEntityList& theResList ) const
{
theResList.clear();
if ( isNodal )
{
- if ( theType == SMESH::NODE )
+ if ( theType == SMDSAbs_Node )
{
SMESH::long_array_var anIds = mySubMeshServer->GetNodesId();
- return getPointers( SMESH::NODE, anIds, aMesh, theResList );
+ return getPointers( SMDSAbs_Node, anIds, aMesh, theResList );
}
}
else
{
- if ( theType == SMESH::NODE )
+ if ( theType == SMDSAbs_Node )
{
SMESH::long_array_var anIds = mySubMeshServer->GetElementsId();
return getNodesFromElems( anIds, aMesh, theResList );
}
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 );
}
}
#ifndef 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 <vtkSystemIncludes.h>
#include "SMESH_Controls.hxx"
+#include "SMDSAbs_ElementType.hxx"
-class vtkUnstructuredGrid;
-class vtkPoints;
-class SALOME_ExtractUnstructuredGrid;
-
-class SMESH_Actor;
class SMDS_Mesh;
-class SMDS_MeshNode;
-class SMDS_MeshElement;
-
-class SMESH_VisualObj;
-typedef boost::shared_ptr<SMESH_VisualObj> TVisualObjPtr;
-
+class vtkUnstructuredGrid;
/*
Class : SMESH_VisualObj
*/
class SMESH_VisualObj
{
-protected:
-
- typedef std::list<const SMDS_MeshElement*> TEntityList;
- typedef std::map<vtkIdType,vtkIdType> TMapOfIds;
-
-public:
- SMESH_VisualObj();
- virtual ~SMESH_VisualObj();
-
- 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 SMESH::ElementType) const = 0;
- virtual int GetEntities( const SMESH::ElementType, TEntityList& ) const = 0;
- virtual bool IsNodePrs() const = 0;
- virtual SMDS_Mesh* GetMesh() const = 0;
-
- bool GetEdgeNodes( const int theElemId,
- const int theEdgeNum,
- int& theNodeId1,
- int& theNodeId2 ) const;
-
- vtkUnstructuredGrid* GetUnstructuredGrid() { return myGrid; }
-
- vtkIdType GetNodeObjId( int theVTKID );
- vtkIdType GetNodeVTKId( int theObjID );
- vtkIdType GetElemObjId( int theVTKID );
- 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_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:
+ virtual void Update( int theIsClear = true ) = 0;
+ virtual void UpdateFunctor( const SMESH::Controls::FunctorPtr& theFunctor ) = 0;
+ virtual int GetElemDimension( const int theObjId ) = 0;
- SMESH_SubMeshObj(SMESH_MeshObj* theMeshObj);
- virtual ~SMESH_SubMeshObj();
+ virtual int GetNbEntities( const SMDSAbs_ElementType theType) const = 0;
+ virtual SMDS_Mesh* GetMesh() const = 0;
- virtual void Update( int theIsClear = true );
+ virtual bool GetEdgeNodes( const int theElemId,
+ const int theEdgeNum,
+ int& theNodeId1,
+ int& theNodeId2 ) const = 0;
- virtual void UpdateFunctor( const SMESH::Controls::FunctorPtr& theFunctor );
- virtual int GetElemDimension( const int theObjId );
- virtual SMDS_Mesh* GetMesh() const { return myMeshObj->GetMesh(); }
+ virtual vtkUnstructuredGrid* GetUnstructuredGrid() = 0;
-protected:
-
- SMESH_MeshObj* myMeshObj;
+ virtual vtkIdType GetNodeObjId( int theVTKID ) = 0;
+ virtual vtkIdType GetNodeVTKId( int theObjID ) = 0;
+ virtual vtkIdType GetElemObjId( int theVTKID ) = 0;
+ virtual vtkIdType GetElemVTKId( int theObjID ) = 0;
};
-
-/*
- 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);
-
+typedef boost::shared_ptr<SMESH_VisualObj> TVisualObjPtr;
#endif
--- /dev/null
+// 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
SMDS_TypeOfPosition.hxx \
SMDSAbs_ElementType.hxx \
SMDS_EdgePosition.hxx \
+ SMDS_ElemIterator.hxx \
SMDS_FacePosition.hxx \
SMDS_Mesh.hxx \
SMDS_MeshEdge.hxx \
#SMDS_MeshNodeIDFactory.hxx
# 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
-LDFLAGS += -L${KERNEL_ROOT_DIR}/lib/salome
+LDFLAGS += -L${KERNEL_ROOT_DIR}/lib/salome $(OCC_KERNEL_LIBS)
# additional file to be cleaned
--- /dev/null
+// 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
+//