Merge with OCC_development_01

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

View File

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

View File

@ -97,12 +97,6 @@ HDF5_INCLUDES=@HDF5_INCLUDES@
HDF5_LIBS=@HDF5_LIBS@
HDF5_MT_LIBS=@HDF5_MT_LIBS@
# MED2
MED2_INCLUDES=@MED2_INCLUDES@
MED2_LIBS=@MED2_LIBS@
MED2_MT_LIBS=@MED2_MT_LIBS@
# OpenCasCade
OCC_INCLUDES=@CAS_CPPFLAGS@
@ -251,8 +245,8 @@ ac_cxx_mutable.m4 check_mico.m4 libtool.m4 \
ac_cxx_namespaces.m4 check_omniorb.m4 pyembed.m4 \
ac_cxx_partial_specialization.m4 check_opengl.m4 python.m4 \
ac_cxx_typename.m4 check_pthreads.m4 check_cas.m4 \
ac_cc_warnings.m4 check_qt.m4 check_med2.m4 \
check_swig.m4 check_boost.m4
ac_cc_warnings.m4 check_qt.m4 check_boost.m4 \
check_swig.m4
$(top_srcdir)/aclocal.m4: $(ACLOCAL_SRC:%=@KERNEL_ROOT_DIR@/salome_adm/unix/config_files/%)
cd $(top_srcdir) ; aclocal --acdir=adm_local/unix/config_files -I @KERNEL_ROOT_DIR@/salome_adm/unix/config_files

View File

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

View File

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

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

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

View File

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

View File

@ -18,5 +18,12 @@ aux1 = insFld(foldersTree, gFld("TUI Reference Guide", ""))
aux1 = insFld(foldersTree, gFld("IDL/Python mapping", ""))
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"))

View File

@ -45,6 +45,7 @@ module SMESH
enum FunctorType
{
FT_AspectRatio,
FT_AspectRatio3D,
FT_Warping,
FT_MinimumAngle,
FT_Taper,
@ -53,10 +54,13 @@ module SMESH
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,
@ -95,12 +99,34 @@ module SMESH
};
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 MultiConnection : 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,
@ -155,6 +181,19 @@ module SMESH
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 )
@ -320,12 +359,15 @@ module SMESH
*/
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 )
@ -334,6 +376,8 @@ module SMESH
BelongToPlane CreateBelongToPlane();
BelongToCylinder CreateBelongToCylinder();
LyingOnGeom CreateLyingOnGeom();
FreeBorders CreateFreeBorders();
FreeEdges CreateFreeEdges();

View File

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

View File

@ -79,6 +79,28 @@ module SMESH
in GEOM::GEOM_Object theVertex000,
in GEOM::GEOM_Object theVertex001);
/*!
* Compute nodes coordinates applying
* the loaded pattern to mesh faces. The first key-point
* will be mapped into <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

View File

@ -73,16 +73,21 @@
<!-- ************************** 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) ************************************ -->
@ -122,6 +127,7 @@
<popup-item item-id="411" pos-id="" label-id="Cutting of quadrangles" icon-id="mesh_cutquad.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
<popup-item item-id="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>
@ -129,7 +135,7 @@
<!-- ********************************* 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=""/>
@ -145,7 +151,11 @@
<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"/>
@ -230,23 +240,36 @@
<popup-item item-id="213" pos-id="" label-id="Shrink" icon-id="mesh_shrink.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</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>
@ -272,23 +295,36 @@
<popup-item item-id="213" pos-id="" label-id="Shrink" icon-id="mesh_shrink.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</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>
@ -316,23 +352,36 @@
<popup-item item-id="213" pos-id="" label-id="Shrink" icon-id="mesh_shrink.png" tooltip-id="" accel-id="" toggle-id="" execute-action=""/>
</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>
@ -370,15 +419,20 @@
<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">
@ -411,6 +465,7 @@
<toolbutton-item item-id="411" label-id="Cutting of quadrangles" icon-id="mesh_cutquad.png" tooltip-id="Cutting of quadrangles" accel-id="" toggle-id="" execute-action=""/>
<toolbutton-item item-id="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>

BIN
resources/mesh_add.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 459 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 482 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 389 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 501 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 461 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 508 B

BIN
resources/mesh_remove.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 386 B

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

@ -20,508 +20,24 @@
#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

View File

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

View File

@ -49,9 +49,9 @@ LIB_CLIENT_IDL =
LIB_SERVER_IDL =
# 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

View File

@ -26,6 +26,8 @@
// $Header$
#include "DriverMED_Family.h"
#include "MED_Factory.hxx"
#include <sstream>
using namespace std;
@ -204,8 +206,9 @@ list<DriverMED_FamilyPtr> DriverMED_Family::MakeFamilies
* 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;
@ -215,11 +218,13 @@ MEDA::PFamilyInfo DriverMED_Family::GetFamilyInfo
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: ";

View File

@ -31,7 +31,7 @@
#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>
@ -63,7 +63,8 @@ class DriverMED_Family
// 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; }

View File

@ -33,20 +33,22 @@
#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);
@ -54,15 +56,15 @@ FindNode(const SMDS_Mesh* theMesh, med_int 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;
}
@ -113,16 +115,16 @@ static TGetCoord aZGetCoord[3] = {
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);
}
};
@ -133,18 +135,16 @@ Driver_Mesh::Status DriverMED_R_SMESHDS_Mesh::Perform()
{
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;
@ -156,22 +156,22 @@ Driver_Mesh::Status DriverMED_R_SMESHDS_Mesh::Perform()
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);
@ -181,13 +181,13 @@ Driver_Mesh::Status DriverMED_R_SMESHDS_Mesh::Perform()
// 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;
@ -219,12 +219,12 @@ Driver_Mesh::Status DriverMED_R_SMESHDS_Mesh::Perform()
}
}
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) {
@ -237,7 +237,7 @@ Driver_Mesh::Status DriverMED_R_SMESHDS_Mesh::Perform()
//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);
@ -248,58 +248,58 @@ Driver_Mesh::Status DriverMED_R_SMESHDS_Mesh::Perform()
// 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++){
@ -318,11 +318,11 @@ Driver_Mesh::Status DriverMED_R_SMESHDS_Mesh::Perform()
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],
@ -333,8 +333,8 @@ Driver_Mesh::Status DriverMED_R_SMESHDS_Mesh::Perform()
isRenum = anIsElemNum;
}
break;
case MED_TRIA3:
case MED_TRIA6:
case eTRIA3:
case eTRIA6:
aNbNodes = 3;
if(anIsElemNum)
anElement = myMesh->AddFaceWithID(aNodeIds[0],
@ -348,8 +348,8 @@ Driver_Mesh::Status DriverMED_R_SMESHDS_Mesh::Perform()
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)
@ -366,8 +366,8 @@ Driver_Mesh::Status DriverMED_R_SMESHDS_Mesh::Perform()
isRenum = anIsElemNum;
}
break;
case MED_TETRA4:
case MED_TETRA10:
case eTETRA4:
case eTETRA10:
aNbNodes = 4;
if(anIsElemNum)
anElement = myMesh->AddVolumeWithID(aNodeIds[0],
@ -383,8 +383,8 @@ Driver_Mesh::Status DriverMED_R_SMESHDS_Mesh::Perform()
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)
@ -403,8 +403,8 @@ Driver_Mesh::Status DriverMED_R_SMESHDS_Mesh::Perform()
isRenum = anIsElemNum;
}
break;
case MED_PENTA6:
case MED_PENTA15:
case ePENTA6:
case ePENTA15:
aNbNodes = 6;
if(anIsElemNum)
anElement = myMesh->AddVolumeWithID(aNodeIds[0],
@ -424,8 +424,8 @@ Driver_Mesh::Status DriverMED_R_SMESHDS_Mesh::Perform()
isRenum = anIsElemNum;
}
break;
case MED_HEXA8:
case MED_HEXA20:
case eHEXA8:
case eHEXA20:
aNbNodes = 8;
if(anIsElemNum)
anElement = myMesh->AddVolumeWithID(aNodeIds[0],
@ -463,7 +463,7 @@ Driver_Mesh::Status DriverMED_R_SMESHDS_Mesh::Perform()
}
else {
if (isRenum) {
anIsElemNum = MED_FAUX;
anIsElemNum = eFAUX;
takeNumbers = false;
if (aResult < DRS_WARN_RENUMBER)
aResult = DRS_WARN_RENUMBER;
@ -496,17 +496,15 @@ list<string> DriverMED_R_SMESHDS_Mesh::GetMeshNames(Status& theStatus)
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());
}
}

View File

@ -35,13 +35,15 @@
#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),
@ -51,6 +53,17 @@ DriverMED_W_SMESHDS_Mesh::DriverMED_W_SMESHDS_Mesh():
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;
@ -91,93 +104,96 @@ void DriverMED_W_SMESHDS_Mesh::AddGroupOfVolumes()
myDoGroupOfVolumes = true;
}
typedef double (SMDS_MeshNode::* TGetCoord)() const;
typedef const char* TName;
typedef const char* TUnit;
namespace{
typedef double (SMDS_MeshNode::* TGetCoord)() const;
typedef const char* TName;
typedef const char* TUnit;
static TUnit aUnit[3] = {"m","m","m"};
TUnit aUnit[3] = {"m","m","m"};
static TGetCoord aXYZGetCoord[3] = {
&SMDS_MeshNode::X,
&SMDS_MeshNode::Y,
&SMDS_MeshNode::Z
};
static TName aXYZName[3] = {"x","y","z"};
TGetCoord aXYZGetCoord[3] = {
&SMDS_MeshNode::X,
&SMDS_MeshNode::Y,
&SMDS_MeshNode::Z
};
TName aXYZName[3] = {"x","y","z"};
static TGetCoord aXYGetCoord[2] = {
&SMDS_MeshNode::X,
&SMDS_MeshNode::Y
};
static TName aXYName[2] = {"x","y"};
TGetCoord aXYGetCoord[2] = {
&SMDS_MeshNode::X,
&SMDS_MeshNode::Y
};
TName aXYName[2] = {"x","y"};
static TGetCoord aYZGetCoord[2] = {
&SMDS_MeshNode::Y,
&SMDS_MeshNode::Z
};
static TName aYZName[2] = {"y","z"};
TGetCoord aYZGetCoord[2] = {
&SMDS_MeshNode::Y,
&SMDS_MeshNode::Z
};
TName aYZName[2] = {"y","z"};
static TGetCoord aXZGetCoord[2] = {
&SMDS_MeshNode::X,
&SMDS_MeshNode::Z
};
static TName aXZName[2] = {"x","z"};
TGetCoord aXZGetCoord[2] = {
&SMDS_MeshNode::X,
&SMDS_MeshNode::Z
};
TName aXZName[2] = {"x","z"};
static TGetCoord aXGetCoord[1] = {
&SMDS_MeshNode::X
};
static TName aXName[1] = {"x"};
TGetCoord aXGetCoord[1] = {
&SMDS_MeshNode::X
};
TName aXName[1] = {"x"};
static TGetCoord aYGetCoord[1] = {
&SMDS_MeshNode::Y
};
static TName aYName[1] = {"y"};
TGetCoord aYGetCoord[1] = {
&SMDS_MeshNode::Y
};
TName aYName[1] = {"y"};
static TGetCoord aZGetCoord[1] = {
&SMDS_MeshNode::Z
};
static TName aZName[1] = {"z"};
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(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;
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()
@ -188,11 +204,7 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
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
//-------------------------------------------------------
@ -206,7 +218,7 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
}
// Mesh dimension definition
med_int aMeshDimension;
TInt aMeshDimension;
TCoordHelperPtr aCoordHelperPtr;
{
bool anIsXDimension = false;
@ -237,7 +249,6 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
anIsXDimension = (aBounds[1] - aBounds[0]) + abs(aBounds[1]) + abs(aBounds[0]) > EPS;
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;
@ -268,9 +279,9 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
}
PMeshInfo aMeshInfo = TWrapper::CrMeshInfo(aMeshDimension,aMeshName);
PMeshInfo aMeshInfo = myMed->CrMeshInfo(aMeshDimension,aMeshName);
MESSAGE("Add - aMeshName : "<<aMeshName<<"; "<<aMeshInfo->GetName());
aMed.SetMeshInfo(aMeshInfo);
myMed->SetMeshInfo(aMeshInfo);
// Storing SMDS groups and sub-meshes
//-----------------------------------
@ -303,8 +314,8 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
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();
@ -319,15 +330,15 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
// 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();
@ -344,44 +355,44 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
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()];
@ -397,23 +408,23 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
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;
@ -421,7 +432,7 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
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;
@ -429,11 +440,11 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
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;
@ -452,12 +463,12 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
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_
@ -468,7 +479,7 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
(*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
@ -479,7 +490,7 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
(*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
@ -490,37 +501,37 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
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;
@ -528,7 +539,7 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
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;
@ -536,7 +547,7 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
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;
@ -544,7 +555,7 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
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;
@ -552,11 +563,11 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
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;
@ -587,11 +598,11 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
}
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_
@ -603,7 +614,7 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
(*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
@ -615,7 +626,7 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
(*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
@ -627,49 +638,49 @@ Driver_Mesh::Status DriverMED_W_SMESHDS_Mesh::Perform()
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){

View File

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

View File

@ -60,7 +60,7 @@ LIB_SERVER_IDL =
# 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

View File

@ -61,9 +61,9 @@ LIB_CLIENT_IDL =
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

View File

@ -31,7 +31,7 @@ VPATH=.:@srcdir@:@top_srcdir@/idl:$(top_builddir)/idl
@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

View File

@ -27,13 +27,13 @@
// $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>
@ -69,20 +69,20 @@
#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();
}
@ -91,7 +91,7 @@ SMESH_Actor* SMESH_Actor::New(TVisualObjPtr theVisualObj,
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;
@ -100,8 +100,8 @@ SMESH_Actor* SMESH_Actor::New(TVisualObjPtr theVisualObj,
}
SMESH_Actor::SMESH_Actor(){
if(MYDEBUG) MESSAGE("SMESH_Actor");
SMESH_ActorDef::SMESH_ActorDef(){
if(MYDEBUG) MESSAGE("SMESH_ActorDef");
myTimeStamp = vtkTimeStamp::New();
@ -284,8 +284,7 @@ SMESH_Actor::SMESH_Actor(){
myName = "";
myIO = NULL;
myColorMode = eNone;
my1DColorMode = e1DNone;
myControlMode = eNone;
myControlActor = my2DActor;
//Definition of myScalarBarActor
@ -439,6 +438,8 @@ SMESH_Actor::SMESH_Actor(){
myPtsLabeledDataMapper->SetLabelTextProperty(aPtsTextProp);
aPtsTextProp->Delete();
myEntityMode = eAllEntity;
myIsPointsLabeled = false;
myPointLabels = vtkActor2D::New();
@ -491,8 +492,8 @@ SMESH_Actor::SMESH_Actor(){
}
SMESH_Actor::~SMESH_Actor(){
if(MYDEBUG) MESSAGE("~SMESH_Actor");
SMESH_ActorDef::~SMESH_ActorDef(){
if(MYDEBUG) MESSAGE("~SMESH_ActorDef");
myScalarBarActor->Delete();
myLookupTable->Delete();
@ -562,7 +563,7 @@ SMESH_Actor::~SMESH_Actor(){
}
void SMESH_Actor::SetPointsLabeled( bool theIsPointsLabeled )
void SMESH_ActorDef::SetPointsLabeled( bool theIsPointsLabeled )
{
vtkUnstructuredGrid* aGrid = GetUnstructuredGrid();
myIsPointsLabeled = theIsPointsLabeled && aGrid->GetNumberOfPoints();
@ -597,7 +598,7 @@ void SMESH_Actor::SetPointsLabeled( bool theIsPointsLabeled )
}
void SMESH_Actor::SetCellsLabeled(bool theIsCellsLabeled){
void SMESH_ActorDef::SetCellsLabeled(bool theIsCellsLabeled){
vtkUnstructuredGrid* aGrid = GetUnstructuredGrid();
myIsCellsLabeled = theIsCellsLabeled && aGrid->GetNumberOfPoints();
if(myIsCellsLabeled){
@ -620,9 +621,8 @@ void SMESH_Actor::SetCellsLabeled(bool theIsCellsLabeled){
}
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);
@ -634,7 +634,7 @@ void SMESH_Actor::SetControlMode(eControl theMode){
if(anIsScalarVisible){
SMESH::Controls::FunctorPtr aFunctor;
switch(theMode){
case eLengthEdges:
case eLength:
{
SMESH::Controls::Length* aControl = new SMESH::Controls::Length();
aControl->SetPrecision( myControlsPrecision );
@ -642,6 +642,12 @@ void SMESH_Actor::SetControlMode(eControl theMode){
myControlActor = my1DActor;
break;
}
case eLength2D:
{
aFunctor.reset(new SMESH::Controls::Length2D());
myControlActor = my2DActor;
break;
}
case eFreeBorders:
aFunctor.reset(new SMESH::Controls::FreeBorders());
myControlActor = my1DActor;
@ -654,6 +660,10 @@ void SMESH_Actor::SetControlMode(eControl theMode){
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();
@ -678,6 +688,14 @@ void SMESH_Actor::SetControlMode(eControl theMode){
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();
@ -709,17 +727,36 @@ void SMESH_Actor::SetControlMode(eControl theMode){
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();
@ -727,7 +764,7 @@ void SMESH_Actor::SetControlMode(eControl theMode){
}
void SMESH_Actor::AddToRender(vtkRenderer* theRenderer){
void SMESH_ActorDef::AddToRender(vtkRenderer* theRenderer){
SALOME_Actor::AddToRender(theRenderer);
theRenderer->AddActor(myNodeActor);
@ -751,7 +788,7 @@ void SMESH_Actor::AddToRender(vtkRenderer* theRenderer){
theRenderer->AddActor2D(myCellsLabels);
}
void SMESH_Actor::RemoveFromRender(vtkRenderer* theRenderer){
void SMESH_ActorDef::RemoveFromRender(vtkRenderer* theRenderer){
SALOME_Actor::RemoveFromRender(theRenderer);
theRenderer->RemoveActor(myNodeActor);
@ -772,10 +809,10 @@ void SMESH_Actor::RemoveFromRender(vtkRenderer* theRenderer){
}
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);
@ -809,6 +846,8 @@ bool SMESH_Actor::Init(TVisualObjPtr theVisualObj,
my3DActor->Init(myVisualObj,myImplicitBoolean);
my1DActor->GetMapper()->SetLookupTable(myLookupTable);
my1DExtActor->GetMapper()->SetLookupTable(myLookupTable);
my2DActor->GetMapper()->SetLookupTable(myLookupTable);
my3DActor->GetMapper()->SetLookupTable(myLookupTable);
@ -840,17 +879,17 @@ bool SMESH_Actor::Init(TVisualObjPtr theVisualObj,
}
float* SMESH_Actor::GetBounds(){
float* SMESH_ActorDef::GetBounds(){
return myNodeActor->GetBounds();
}
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);
@ -867,27 +906,27 @@ void SMESH_Actor::SetTransform(SALOME_Transform* theTransform){
}
void SMESH_Actor::SetMapper(vtkMapper* theMapper){
void SMESH_ActorDef::SetMapper(vtkMapper* theMapper){
vtkLODActor::SetMapper(theMapper);
}
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 ||
@ -897,16 +936,16 @@ bool SMESH_Actor::IsInfinitive(){
}
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);
@ -918,7 +957,7 @@ void SMESH_Actor::SetShrinkFactor(float theValue){
Modified();
}
void SMESH_Actor::SetShrink(){
void SMESH_ActorDef::SetShrink(){
if(!myIsShrinkable) return;
myBaseActor->SetShrink();
@ -933,7 +972,7 @@ void SMESH_Actor::SetShrink(){
Modified();
}
void SMESH_Actor::UnShrink(){
void SMESH_ActorDef::UnShrink(){
if(!myIsShrunk) return;
myBaseActor->UnShrink();
@ -949,74 +988,110 @@ void SMESH_Actor::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();
else if(myControlActor->GetUnstructuredGrid()->GetNumberOfCells())
myScalarBarActor->VisibilityOn();
break;
case eLength2D:
my1DExtActor->VisibilityOn();
case eMultiConnection2D:
my1DExtActor->VisibilityOn();
default:
if(myControlActor->GetUnstructuredGrid()->GetNumberOfCells())
myScalarBarActor->VisibilityOn();
}
}
if(myRepresentation != ePoint)
myPickableActor->VisibilityOn();
my1DActor->VisibilityOn();
if(myEntityMode & eEdges)
my1DActor->VisibilityOn();
my2DActor->VisibilityOn();
my3DActor->VisibilityOn();
if(myEntityMode & eFaces)
my2DActor->VisibilityOn();
if(myIsPointsLabeled) myPointLabels->VisibilityOn();
if(myIsCellsLabeled) myCellsLabels->VisibilityOn();
}else{
myNodeActor->VisibilityOff();
myBaseActor->VisibilityOff();
if(myEntityMode & eVolumes)
my3DActor->VisibilityOn();
my1DActor->VisibilityOff();
my1DExtActor->VisibilityOff();
if(myIsPointsLabeled)
myPointLabels->VisibilityOn();
my2DActor->VisibilityOff();
my3DActor->VisibilityOff();
myScalarBarActor->VisibilityOff();
myPointLabels->VisibilityOff();
myCellsLabels->VisibilityOff();
if(myIsCellsLabeled)
myCellsLabels->VisibilityOn();
}
Modified();
}
void SMESH_Actor::SetRepresentation(int theMode){
int aNbEdges = myVisualObj->GetNbEntities(SMESH::EDGE);
int aNbFaces = myVisualObj->GetNbEntities(SMESH::FACE);
int aNbVolumes = myVisualObj->GetNbEntities(SMESH::VOLUME);
void SMESH_ActorDef::SetEntityMode(unsigned int theMode){
if(!myVisualObj->GetNbEntities(SMDSAbs_Edge))
theMode &= ~eEdges;
if(!myVisualObj->GetNbEntities(SMDSAbs_Face))
theMode &= ~eFaces;
if(!myVisualObj->GetNbEntities(SMDSAbs_Volume))
theMode &= ~eVolumes;
if(!theMode)
return;
myEntityMode = theMode;
SetVisibility(GetVisibility(),false);
}
void SMESH_ActorDef::SetRepresentation(int theMode){
int aNbEdges = myVisualObj->GetNbEntities(SMDSAbs_Edge);
int aNbFaces = myVisualObj->GetNbEntities(SMDSAbs_Face);
int aNbVolumes = myVisualObj->GetNbEntities(SMDSAbs_Volume);
if(theMode < 0){
myRepresentation = eSurface;
if(!aNbFaces && !aNbVolumes && aNbEdges){
@ -1080,15 +1155,14 @@ void SMESH_Actor::SetRepresentation(int theMode){
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);
@ -1111,17 +1185,17 @@ void SMESH_Actor::SetRepresentation(int theMode){
}
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);
@ -1151,20 +1225,20 @@ void SMESH_Actor::UpdateHighlight(){
}
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())
{
@ -1176,7 +1250,7 @@ int SMESH_Actor::RenderOpaqueGeometry(vtkViewport *vp)
}
int SMESH_Actor::RenderTranslucentGeometry(vtkViewport *vp)
int SMESH_ActorDef::RenderTranslucentGeometry(vtkViewport *vp)
{
if (!myPickableActor->GetIsOpaque())
{
@ -1188,42 +1262,35 @@ int SMESH_Actor::RenderTranslucentGeometry(vtkViewport *vp)
}
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);
@ -1238,7 +1305,7 @@ static void GetColor(vtkProperty *theProperty, float& r,float& g,float& b){
}
void SMESH_Actor::SetOpacity(float theValue){
void SMESH_ActorDef::SetOpacity(float theValue){
mySurfaceProp->SetOpacity(theValue);
myBackSurfaceProp->SetOpacity(theValue);
myEdgeProp->SetOpacity(theValue);
@ -1248,74 +1315,74 @@ void SMESH_Actor::SetOpacity(float theValue){
}
float SMESH_Actor::GetOpacity(){
float SMESH_ActorDef::GetOpacity(){
return mySurfaceProp->GetOpacity();
}
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);
@ -1325,7 +1392,7 @@ void SMESH_Actor::SetLineWidth(float theVal){
}
void SMESH_Actor::SetNodeSize(float theVal){
void SMESH_ActorDef::SetNodeSize(float theVal){
myNodeProp->SetPointSize(theVal);
myHighlightProp->SetPointSize(theVal);
myPreselectProp->SetPointSize(theVal);
@ -1336,17 +1403,17 @@ void SMESH_Actor::SetNodeSize(float 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;
}
@ -1418,17 +1485,16 @@ static void PositionToDistance(vtkDataSet* theDataSet,
}
void SMESH_Actor::SetPlaneParam(float theDir[3], float theDist, vtkPlane* thePlane)
void SMESH_ActorDef::SetPlaneParam(float theDir[3], float theDist, vtkPlane* thePlane)
{
thePlane->SetNormal(theDir);
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);

View File

@ -32,33 +32,16 @@
#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);
@ -67,182 +50,66 @@ class SMESH_Actor : public 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 SetSufaceColor(float r,float g,float b) = 0;
virtual void GetSufaceColor(float& r,float& g,float& b) = 0;
virtual void AddToRender(vtkRenderer* theRenderer);
virtual void RemoveFromRender(vtkRenderer* theRenderer);
virtual void SetBackSufaceColor(float r,float g,float b) = 0;
virtual void GetBackSufaceColor(float& r,float& g,float& b) = 0;
virtual bool hasHighlight() { return true; }
virtual void highlight(bool theHighlight);
virtual void SetPreSelected(bool thePreselect = false);
virtual void SetEdgeColor(float r,float g,float b) = 0;
virtual void GetEdgeColor(float& r,float& g,float& b) = 0;
virtual bool IsInfinitive();
virtual void SetNodeColor(float r,float g,float b) = 0;
virtual void GetNodeColor(float& r,float& g,float& b) = 0;
virtual void SetOpacity(float theValue);
virtual float GetOpacity();
virtual void SetHighlightColor(float r,float g,float b) = 0;
virtual void GetHighlightColor(float& r,float& g,float& b) = 0;
void SetSufaceColor(float r,float g,float b);
void GetSufaceColor(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;
void SetBackSufaceColor(float r,float g,float b);
void GetBackSufaceColor(float& r,float& g,float& b);
virtual float GetLineWidth() = 0;
virtual void SetLineWidth(float theVal) = 0;
void SetEdgeColor(float r,float g,float b);
void GetEdgeColor(float& r,float& g,float& b);
void SetNodeColor(float r,float g,float b);
void GetNodeColor(float& r,float& g,float& b);
void SetHighlightColor(float r,float g,float b);
void GetHighlightColor(float& r,float& g,float& b);
void SetPreHighlightColor(float r,float g,float b);
void GetPreHighlightColor(float& r,float& g,float& b);
float GetLineWidth();
void SetLineWidth(float theVal);
void SetNodeSize(float size) ;
float GetNodeSize() ;
virtual int GetNodeObjId(int theVtkID);
virtual float* GetNodeCoord(int theObjID);
virtual int GetElemObjId(int theVtkID);
virtual vtkCell* GetElemCell(int theObjID);
virtual int GetObjDimension( const int theObjId );
virtual void SetVisibility(int theMode);
void SetVisibility(int theMode, bool theIsUpdateRepersentation);
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);
enum EEntityMode { eEdges = 0x01, eFaces = 0x02, eVolumes = 0x04, eAllEntity = 0x07};
virtual void SetEntityMode(unsigned int theMode) = 0;
virtual unsigned int GetEntityMode() const = 0;
vtkUnstructuredGrid* GetUnstructuredGrid();
virtual vtkDataSet* GetInput();
virtual vtkMapper* GetMapper();
virtual void SetPointRepresentation(bool theIsPointsVisible) = 0;
virtual bool GetPointRepresentation() = 0;
virtual float GetShrinkFactor();
virtual void SetShrinkFactor(float value );
virtual vtkUnstructuredGrid* GetUnstructuredGrid() = 0;
virtual bool IsShrunkable() { return myIsShrinkable;}
virtual bool IsShrunk() { return myIsShrunk;}
virtual void SetShrink();
virtual void UnShrink();
virtual void SetShrinkFactor(float theValue) = 0;
void SetPointsLabeled(bool theIsPointsLabeled);
bool GetPointsLabeled(){ return myIsPointsLabeled;}
virtual void SetPointsLabeled(bool theIsPointsLabeled) = 0;
virtual bool GetPointsLabeled() = 0;
void SetCellsLabeled(bool theIsCellsLabeled);
bool GetCellsLabeled(){ return myIsCellsLabeled;}
virtual void SetCellsLabeled(bool theIsCellsLabeled) = 0;
virtual bool GetCellsLabeled() = 0;
enum eControl{eNone, eLengthEdges, eFreeBorders, eFreeEdges, eMultiConnection,
eArea, eTaper, eAspectRatio, eMinimumAngle, eWarping, eSkew};
void SetControlMode(eControl theMode);
eControl GetControlMode(){ return myColorMode;}
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;
enum e1DControl{e1DNone, e1DColored, e1DHighlited};
e1DControl Get1DControlMode(){ return my1DColorMode;}
virtual vtkScalarBarActor* GetScalarBarActor() = 0;
vtkScalarBarActor* GetScalarBarActor(){ return myScalarBarActor;}
virtual void SetPlaneParam(float theDir[3], float theDist, vtkPlane* thePlane) = 0;
virtual void GetPlaneParam(float theDir[3], float& theDist, vtkPlane* thePlane) = 0;
void SetPlaneParam(float theDir[3], float theDist, vtkPlane* thePlane);
void GetPlaneParam(float theDir[3], float& theDist, vtkPlane* thePlane);
virtual vtkImplicitBoolean* GetPlaneContainer() = 0;
vtkImplicitBoolean* GetPlaneContainer();
virtual TVisualObjPtr GetObject() = 0;
TVisualObjPtr GetObject() { return myVisualObj;}
void SetControlsPrecision( const long p ) { myControlsPrecision = p; }
long GetControlsPrecision() const { return myControlsPrecision; }
protected:
TVisualObjPtr myVisualObj;
vtkTimeStamp* myTimeStamp;
vtkScalarBarActor* myScalarBarActor;
vtkLookupTable* myLookupTable;
vtkProperty* mySurfaceProp;
vtkProperty* myBackSurfaceProp;
vtkProperty* myEdgeProp;
vtkProperty* myNodeProp;
SMESH_DeviceActor* myBaseActor;
SMESH_DeviceActor* myNodeActor;
SMESH_DeviceActor* myPickableActor;
vtkProperty* myHighlightProp;
vtkProperty* myPreselectProp;
SMESH_DeviceActor* myHighlitableActor;
SMESH_DeviceActor* myNodeHighlitableActor;
eControl myColorMode;
SMESH_DeviceActor* my2DActor;
SMESH_DeviceActor* my3DActor;
SMESH_DeviceActor* myControlActor;
e1DControl my1DColorMode;
vtkProperty* my1DProp;
SMESH_DeviceActor* my1DActor;
vtkProperty* my1DExtProp;
SMESH_DeviceActor* my1DExtActor;
bool myIsPointsVisible;
bool myIsShrinkable;
bool myIsShrunk;
bool myIsPointsLabeled;
vtkUnstructuredGrid* myPointsNumDataSet;
vtkActor2D *myPointLabels;
vtkMaskPoints* myPtsMaskPoints;
vtkLabeledDataMapper* myPtsLabeledDataMapper;
vtkSelectVisiblePoints* myPtsSelectVisiblePoints;
bool myIsCellsLabeled;
vtkUnstructuredGrid* myCellsNumDataSet;
vtkActor2D *myCellsLabels;
vtkMaskPoints* myClsMaskPoints;
vtkCellCenters* myCellCenters;
vtkLabeledDataMapper* myClsLabeledDataMapper;
vtkSelectVisiblePoints* myClsSelectVisiblePoints;
vtkImplicitBoolean* myImplicitBoolean;
long myControlsPrecision;
SMESH_Actor();
~SMESH_Actor();
bool Init(TVisualObjPtr theVisualObj,
const char* theEntry,
const char* theName,
int theIsClear);
void SetIsShrunkable(bool theShrunkable);
void UpdateHighlight();
void Update();
private:
// hide the two parameter Render() method from the user and the compiler.
virtual void Render(vtkRenderer *, vtkMapper *) {};
virtual void ShallowCopy(vtkProp *prop);
virtual void SetMapper(vtkMapper *);
static SMESH_Actor* New();
// Not implemented.
SMESH_Actor(const SMESH_Actor&);
void operator=(const SMESH_Actor&);
virtual void SetControlsPrecision( const long ) = 0;
virtual long GetControlsPrecision() const = 0;
};

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

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

View File

@ -23,6 +23,9 @@
#include "QAD_Config.h"
#include "utilities.h"
#include <vtkUnstructuredGrid.h>
#include <vtkUnstructuredGridWriter.h>
#ifdef _DEBUG_
static int MYDEBUG = 1;
#else
@ -30,10 +33,22 @@ static int MYDEBUG = 0;
#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();
}
}

View File

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

View File

@ -24,19 +24,19 @@
// 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>
@ -61,12 +61,12 @@
#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;
@ -261,6 +261,146 @@ void SMESH_DeviceActor::SetControlMode(SMESH::Controls::FunctorPtr theFunctor,
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)
@ -304,7 +444,7 @@ void SMESH_DeviceActor::SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor
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]),
@ -335,6 +475,8 @@ void SMESH_DeviceActor::SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor
}
unsigned long int SMESH_DeviceActor::GetMTime(){
unsigned long mTime = this->Superclass::GetMTime();
mTime = max(mTime,myExtractGeometry->GetMTime());

View File

@ -55,7 +55,7 @@ class SMESH_ExtractGeometry;
class SMESH_DeviceActor: public vtkLODActor{
friend class SMESH_Actor;
friend class SMESH_ActorDef;
public:
vtkTypeMacro(SMESH_DeviceActor,vtkLODActor);
@ -94,6 +94,10 @@ class SMESH_DeviceActor: public 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);

View File

@ -25,10 +25,13 @@
// 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)
@ -39,8 +42,6 @@
#include <vtkUnsignedCharArray.h>
#include <vtkUnstructuredGrid.h>
#include <vtkUnstructuredGridWriter.h>
#include <vtkUnstructuredGridReader.h>
#include <memory>
#include <sstream>
@ -68,17 +69,6 @@ static int MYDEBUGWITHFILES = 0;
#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){
@ -117,7 +107,6 @@ namespace{
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())
@ -136,7 +125,6 @@ namespace{
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())
@ -156,7 +144,6 @@ namespace{
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())
@ -177,7 +164,6 @@ namespace{
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())
@ -198,7 +184,6 @@ namespace{
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())
@ -220,7 +205,6 @@ namespace{
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())
@ -243,7 +227,6 @@ namespace{
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())
@ -266,7 +249,7 @@ namespace{
}
/*
Class : SMESH_VisualObj
Class : SMESH_VisualObjDef
Description : Base class for all mesh objects to be visuilised
*/
@ -274,36 +257,39 @@ namespace{
// 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 SMDSAbs_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_Face :
if ( theNbNodes == 3 ) return VTK_TRIANGLE;
else if ( theNbNodes == 4 ) return VTK_QUAD;
else return 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_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() );
@ -314,37 +300,37 @@ SMESH_VisualObj::~SMESH_VisualObj()
// 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;
@ -371,7 +357,7 @@ void SMESH_VisualObj::createPoints( vtkPoints* thePoints )
// function : buildPrs
// purpose : create VTK cells( fill unstructured grid )
//=================================================================================
void SMESH_VisualObj::buildPrs()
void SMESH_VisualObjDef::buildPrs()
{
try
{
@ -395,18 +381,17 @@ void SMESH_VisualObj::buildPrs()
}
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();
@ -414,6 +399,7 @@ void SMESH_VisualObj::buildNodePrs()
// Create cells
/*
int nbPoints = aPoints->GetNumberOfPoints();
vtkIdList *anIdList = vtkIdList::New();
anIdList->SetNumberOfIds( 1 );
@ -452,7 +438,33 @@ void SMESH_VisualObj::buildNodePrs()
// 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
@ -466,16 +478,16 @@ void SMESH_VisualObj::buildElemPrs()
// 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
{
@ -488,7 +500,7 @@ void SMESH_VisualObj::buildElemPrs()
}
}
vtkIdType aNbCells = nbEnts[ SMESH::EDGE ] + nbEnts[ SMESH::FACE ] + nbEnts[ SMESH::VOLUME ];
vtkIdType aNbCells = nbEnts[ SMDSAbs_Edge ] + nbEnts[ SMDSAbs_Face ] + nbEnts[ SMDSAbs_Volume ];
if ( MYDEBUG )
MESSAGE( "Update - aNbCells = "<<aNbCells<<"; aCellsSize = "<<aCellsSize );
@ -505,11 +517,15 @@ void SMESH_VisualObj::buildElemPrs()
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 )
{
@ -524,14 +540,48 @@ void SMESH_VisualObj::buildElemPrs()
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++;
}
@ -560,10 +610,10 @@ void SMESH_VisualObj::buildElemPrs()
// 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 )
@ -650,7 +700,6 @@ void SMESH_MeshObj::Update( int theIsClear )
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)
@ -760,26 +809,26 @@ int SMESH_MeshObj::GetElemDimension( const int theObjId )
// 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();
}
@ -790,31 +839,31 @@ int SMESH_MeshObj::GetNbEntities( const SMESH::ElementType theType) const
}
}
int SMESH_MeshObj::GetEntities( const SMESH::ElementType theType, TEntityList& theObjs ) const
int SMESH_MeshObj::GetEntities( const SMDSAbs_ElementType theType, TEntityList& theObjs ) const
{
theObjs.clear();
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() );
@ -964,14 +1013,14 @@ static int getNodesFromElems( SMESH::long_array_var& theElemIds,
// 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 )
@ -986,15 +1035,15 @@ static int getPointers( const SMESH::ElementType theRequestType,
// 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();
@ -1002,12 +1051,12 @@ int SMESH_GroupObj::GetEntities( const SMESH::ElementType theType, TEntityList&
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;
@ -1044,20 +1093,21 @@ SMESH_subMeshObj::~SMESH_subMeshObj()
// 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:
@ -1066,7 +1116,7 @@ int SMESH_subMeshObj::GetNbEntities( const SMESH::ElementType theType) const
}
}
int SMESH_subMeshObj::GetEntities( const SMESH::ElementType theType, TEntityList& theResList ) const
int SMESH_subMeshObj::GetEntities( const SMDSAbs_ElementType theType, TEntityList& theResList ) const
{
theResList.clear();
@ -1078,22 +1128,23 @@ int SMESH_subMeshObj::GetEntities( const SMESH::ElementType theType, TEntityList
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 );
}
}

View File

@ -29,30 +29,14 @@
#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
@ -60,155 +44,27 @@ typedef boost::shared_ptr<SMESH_VisualObj> TVisualObjPtr;
*/
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 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 SMDS_Mesh* GetMesh() const = 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;
virtual bool GetEdgeNodes( const int theElemId,
const int theEdgeNum,
int& theNodeId1,
int& theNodeId2 ) const = 0;
bool GetEdgeNodes( const int theElemId,
const int theEdgeNum,
int& theNodeId1,
int& theNodeId2 ) const;
virtual vtkUnstructuredGrid* GetUnstructuredGrid() = 0;
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;
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_MeshObj
Description : Class for visualisation of mesh
*/
class SMESH_MeshObj: public SMESH_VisualObj
{
public:
SMESH_MeshObj( SMESH::SMESH_Mesh_ptr );
virtual ~SMESH_MeshObj();
virtual void Update( int theIsClear = true );
virtual int GetNbEntities( const SMESH::ElementType) const;
virtual int GetEntities( const SMESH::ElementType, TEntityList& ) const;
virtual bool IsNodePrs() const;
virtual int GetElemDimension( const int theObjId );
virtual void UpdateFunctor( const SMESH::Controls::FunctorPtr& theFunctor );
SMESH::SMESH_Mesh_ptr GetMeshServer() { return myMeshServer.in(); }
SMDS_Mesh* GetMesh() const { return myMesh; }
protected:
SMESH::SMESH_Mesh_var myMeshServer;
SMDS_Mesh* myMesh;
};
/*
Class : SMESH_SubMeshObj
Description : Base class for visualisation of submeshes and groups
*/
class SMESH_SubMeshObj: public SMESH_VisualObj
{
public:
SMESH_SubMeshObj(SMESH_MeshObj* theMeshObj);
virtual ~SMESH_SubMeshObj();
virtual void Update( int theIsClear = true );
virtual void UpdateFunctor( const SMESH::Controls::FunctorPtr& theFunctor );
virtual int GetElemDimension( const int theObjId );
virtual SMDS_Mesh* GetMesh() const { return myMeshObj->GetMesh(); }
protected:
SMESH_MeshObj* myMeshObj;
};
/*
Class : SMESH_GroupObj
Description : Class for visualisation of groups
*/
class SMESH_GroupObj: public SMESH_SubMeshObj
{
public:
SMESH_GroupObj( SMESH::SMESH_GroupBase_ptr, SMESH_MeshObj* );
virtual ~SMESH_GroupObj();
virtual int GetNbEntities( const SMESH::ElementType) const;
virtual int GetEntities( const SMESH::ElementType, TEntityList& ) const;
virtual bool IsNodePrs() const;
private:
SMESH::SMESH_GroupBase_var myGroupServer;
};
/*
Class : SMESH_subMeshObj
Description : Class for visualisation of submeshes
*/
class SMESH_subMeshObj : public SMESH_SubMeshObj
{
public:
SMESH_subMeshObj( SMESH::SMESH_subMesh_ptr,
SMESH_MeshObj* );
virtual ~SMESH_subMeshObj();
virtual int GetNbEntities( const SMESH::ElementType) const;
virtual int GetEntities( const SMESH::ElementType, TEntityList& ) const;
virtual bool IsNodePrs() const;
protected:
SMESH::SMESH_subMesh_var mySubMeshServer;
};
extern void WriteUnstructuredGrid(vtkUnstructuredGrid* theGrid, const char* theFileName);
typedef boost::shared_ptr<SMESH_VisualObj> TVisualObjPtr;
#endif

View File

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

View File

@ -88,6 +88,7 @@ EXPORT_HEADERS= \
SMDS_TypeOfPosition.hxx \
SMDSAbs_ElementType.hxx \
SMDS_EdgePosition.hxx \
SMDS_ElemIterator.hxx \
SMDS_FacePosition.hxx \
SMDS_Mesh.hxx \
SMDS_MeshEdge.hxx \
@ -125,9 +126,9 @@ EXPORT_HEADERS= \
#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

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

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -29,20 +29,15 @@
#include "SMDSAbs_ElementType.hxx"
#include "SMDS_MeshObject.hxx"
#include "SMDS_Iterator.hxx"
#include "SMDS_ElemIterator.hxx"
#include "SMDS_MeshElementIDFactory.hxx"
#include <boost/shared_ptr.hpp>
#include <vector>
#include <iostream>
class SMDS_MeshNode;
class SMDS_MeshEdge;
class SMDS_MeshFace;
class SMDS_MeshElement;
typedef SMDS_Iterator<const SMDS_MeshElement *> SMDS_ElemIterator;
typedef boost::shared_ptr<SMDS_Iterator<const SMDS_MeshElement *> > SMDS_ElemIteratorPtr;
///////////////////////////////////////////////////////////////////////////////
/// Base class for elements

View File

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

View File

@ -28,26 +28,35 @@
#define _SMDS_MeshElementIDFactory_HeaderFile
#include "SMDS_MeshIDFactory.hxx"
#include "SMDS_ElemIterator.hxx"
#include <map>
#include <NCollection_DataMap.hxx>
class SMDS_MeshElement;
typedef std::map<int, SMDS_MeshElement *> SMDS_IdElementMap;
typedef NCollection_DataMap<int, SMDS_MeshElement *> SMDS_IdElementMap;
class SMDS_MeshElementIDFactory:public SMDS_MeshIDFactory
{
public:
SMDS_MeshElementIDFactory();
bool BindID(int ID, SMDS_MeshElement * elem);
SMDS_MeshElement * MeshElement(int ID);
virtual int GetFreeID();
virtual void ReleaseID(int ID);
int GetMaxID() const;
int GetMinID() const;
const SMDS_IdElementMap & GetIdElementMap() const { return myIDElements; }
private:
SMDS_IdElementMap myIDElements;
public:
SMDS_MeshElementIDFactory();
bool BindID(int ID, SMDS_MeshElement * elem);
SMDS_MeshElement * MeshElement(int ID);
virtual int GetFreeID();
virtual void ReleaseID(int ID);
int GetMaxID() const;
int GetMinID() const;
SMDS_ElemIteratorPtr elementsIterator() const;
private:
void updateMinMax() const;
void updateMinMax(int id) const
{
if (id > myMax) myMax = id;
if (id < myMin) myMin = id;
}
SMDS_IdElementMap myIDElements;
mutable int myMin, myMax;
};

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -44,16 +44,17 @@ public :
SMESHGUI_SpinBox( QWidget* parent, const char* name = 0 ) ;
~SMESHGUI_SpinBox() ;
void RangeStepAndValidator( double min = -1000000.0,
double max = +1000000.0,
double step = 100.0,
unsigned short decimals = 3 ) ;
void SetValue( double v ) ;
double GetValue() ;
QString GetString() ;
void RangeStepAndValidator( double min = -1000000.0,
double max = +1000000.0,
double step = 100.0,
unsigned short decimals = 3 ) ;
void SetValue( double v ) ;
double GetValue() ;
QString GetString() ;
QLineEdit* editor() { return QAD_SpinBoxDbl::editor(); }
public slots:
void SetStep( double newStep );
void SetStep( double newStep );
};
#endif // SMESHSPINBOX_H

View File

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

View File

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

View File

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

View File

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

View File

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

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