diff --git a/resources/SalomeApp.xml.in b/resources/SalomeApp.xml.in
index ed4f2ade6..aae569166 100644
--- a/resources/SalomeApp.xml.in
+++ b/resources/SalomeApp.xml.in
@@ -118,6 +118,7 @@
+
diff --git a/src/SMDS/SMDS_VtkVolume.cxx b/src/SMDS/SMDS_VtkVolume.cxx
index d11f12b1e..e78e8d24b 100644
--- a/src/SMDS/SMDS_VtkVolume.cxx
+++ b/src/SMDS/SMDS_VtkVolume.cxx
@@ -567,7 +567,7 @@ int SMDS_VtkVolume::NbCornerNodes() const
case VTK_TRIQUADRATIC_HEXAHEDRON: return 8;
default:;
}
- return grid->GetCell(myVtkID)->GetNumberOfPoints();
+ return NbNodes();
}
SMDSAbs_EntityType SMDS_VtkVolume::GetEntityType() const
diff --git a/src/SMESH/SMESH_MeshEditor.cxx b/src/SMESH/SMESH_MeshEditor.cxx
index fc554be48..350fcd60f 100644
--- a/src/SMESH/SMESH_MeshEditor.cxx
+++ b/src/SMESH/SMESH_MeshEditor.cxx
@@ -2157,7 +2157,7 @@ void SMESH_MeshEditor::SplitVolumes (const TFacetOfElem & theElems,
helper.SetIsQuadratic( false );
}
vector nodes( volTool.GetNodes(),
- volTool.GetNodes() + elem->NbCornerNodes() );
+ volTool.GetNodes() + elem->NbNodes() );
helper.SetElementsOnShape( true );
if ( splitMethod._baryNode )
{
diff --git a/src/SMESHUtils/SMESH_OctreeNode.cxx b/src/SMESHUtils/SMESH_OctreeNode.cxx
index ef85d11b5..31c6ba660 100644
--- a/src/SMESHUtils/SMESH_OctreeNode.cxx
+++ b/src/SMESHUtils/SMESH_OctreeNode.cxx
@@ -235,7 +235,7 @@ bool SMESH_OctreeNode::NodesAround(const gp_XYZ &node,
// if ( dist2Nodes.size() > 1 ) // leave only closest node in dist2Nodes
// dist2Nodes.erase( ++dist2Nodes.begin(), dist2Nodes.end());
- return ( sqrt( minDist) <= precision * 1e-12 );
+ return ( sqrt( minDist) <= precision * ( 1 + 1e-12 ));
}
}
return false;
diff --git a/src/SMESH_I/SMESH_Mesh_i.cxx b/src/SMESH_I/SMESH_Mesh_i.cxx
index d3e504e16..2b230a593 100644
--- a/src/SMESH_I/SMESH_Mesh_i.cxx
+++ b/src/SMESH_I/SMESH_Mesh_i.cxx
@@ -199,7 +199,8 @@ void SMESH_Mesh_i::SetShape( GEOM::GEOM_Object_ptr theShapeObject )
// to track changes of GEOM groups
SMESH::SMESH_Mesh_var mesh = _this();
addGeomGroupData( theShapeObject, mesh );
- _mainShapeTick = theShapeObject->GetTick();
+ if ( !CORBA::is_nil( theShapeObject ))
+ _mainShapeTick = theShapeObject->GetTick();
}
//================================================================================
@@ -1709,6 +1710,9 @@ void SMESH_Mesh_i::addGeomGroupData(GEOM::GEOM_Object_ptr theGeomObj,
groupData._indices.insert( ids[i] );
// SMESH object
groupData._smeshObject = CORBA::Object::_duplicate( theSmeshObj );
+ // shape index in SMESHDS
+ // TopoDS_Shape shape = _gen_i->GeomObjectToShape( theGeomObj );
+ // groupData._dsID = shape.IsNull() ? 0 : _impl->GetSubMesh( shape )->GetId();
}
//================================================================================
@@ -1824,13 +1828,12 @@ void SMESH_Mesh_i::CheckGeomModif()
GEOM::GEOM_Object_var mainGO = _gen_i->ShapeToGeomObject( _impl->GetShapeToMesh() );
if ( mainGO->_is_nil() ) return;
- if ( mainGO->GetType() == GEOM_GROUP )
+ if ( mainGO->GetType() == GEOM_GROUP ||
+ mainGO->GetTick() == _mainShapeTick )
{
CheckGeomGroupModif();
return;
}
- if ( mainGO->GetTick() == _mainShapeTick )
- return;
GEOM_Client* geomClient = _gen_i->GetShapeReader();
if ( !geomClient ) return;
@@ -1841,7 +1844,7 @@ void SMESH_Mesh_i::CheckGeomModif()
geomClient->RemoveShapeFromBuffer( ior.in() );
// Update data taking into account that
- // all sub-shapes change but IDs of sub-shapes remain
+ // all sub-shapes change but IDs of sub-shapes remain (except for geom groups)
_impl->Clear();
TopoDS_Shape newShape = _gen_i->GeomObjectToShape( mainGO );
@@ -1879,9 +1882,31 @@ void SMESH_Mesh_i::CheckGeomModif()
}
// change shape to mesh
+ int oldNbSubShapes = meshDS->MaxShapeIndex();
_impl->ShapeToMesh( TopoDS_Shape() );
_impl->ShapeToMesh( newShape );
+ // re-add shapes of geom groups
+ list::iterator data = _geomGroupData.begin();
+ for ( ; data != _geomGroupData.end(); ++data )
+ {
+ TopoDS_Shape newShape = newGroupShape( *data );
+ if ( !newShape.IsNull() )
+ {
+ if ( meshDS->ShapeToIndex( newShape ) > 0 ) // a group reduced to one sub-shape
+ {
+ TopoDS_Compound compound;
+ BRep_Builder().MakeCompound( compound );
+ BRep_Builder().Add( compound, newShape );
+ newShape = compound;
+ }
+ _impl->GetSubMesh( newShape );
+ }
+ }
+ if ( oldNbSubShapes != meshDS->MaxShapeIndex() )
+ THROW_SALOME_CORBA_EXCEPTION( "SMESH_Mesh_i::CheckGeomModif() bug",
+ SALOME::INTERNAL_ERROR );
+
// re-assign hypotheses
for ( size_t i = 0; i < ids2Hyps.size(); ++i )
{
@@ -3046,7 +3071,7 @@ void SMESH_Mesh_i::ExportPartToMED(SMESH::SMESH_IDSource_ptr meshPart,
{
aMeshName = prepareMeshNameAndGroups(file, overwrite);
_impl->ExportMED( file, aMeshName.c_str(), auto_groups,
- version, 0, autoDimension, have0dField);
+ version, 0, autoDimension, /*addODOnVertices=*/have0dField);
meshDS = _impl->GetMeshDS();
}
else
@@ -3066,7 +3091,7 @@ void SMESH_Mesh_i::ExportPartToMED(SMESH::SMESH_IDSource_ptr meshPart,
}
SMESH_MeshPartDS* partDS = new SMESH_MeshPartDS( meshPart );
_impl->ExportMED( file, aMeshName.c_str(), auto_groups,
- version, partDS, autoDimension, have0dField);
+ version, partDS, autoDimension, /*addODOnVertices=*/have0dField);
meshDS = tmpDSDeleter._obj = partDS;
}
@@ -3152,7 +3177,7 @@ void SMESH_Mesh_i::exportMEDFields( DriverMED_W_Field& fieldWriter,
name.in(),
elemType,
comps->length(),
- ( dataType == GEOM::FDT_Int )))
+ /*isIntData=*/false ))//( dataType == GEOM::FDT_Int )))
continue;
for ( size_t iC = 0; iC < comps->length(); ++iC )
@@ -3239,9 +3264,9 @@ void SMESH_Mesh_i::exportMEDFields( DriverMED_W_Field& fieldWriter,
const SMDS_MeshElement* e = elemIt->next();
const int shapeID = e->getshapeId();
if ( shapeID < 1 || shapeID >= intVals.size() )
- fieldWriter.AddValue( noneIntValue );
+ fieldWriter.AddValue( (double) noneIntValue );
else
- fieldWriter.AddValue( intVals[ shapeID ]);
+ fieldWriter.AddValue( (double) intVals[ shapeID ]);
}
// write a step
@@ -3279,17 +3304,17 @@ void SMESH_Mesh_i::exportMEDFields( DriverMED_W_Field& fieldWriter,
std::vector< std::string > compNames;
switch ( geomAssocFields[ iF ]) {
case 'v': case 'V':
- fieldWriter.Set( meshDS, "_vertices_", SMDSAbs_Node, /*nbComps=*/2, /*isInt=*/true );
+ fieldWriter.Set( meshDS, "_vertices_", SMDSAbs_Node, /*nbComps=*/2, /*isInt=*/false );
compNames.push_back( "dim" );
break;
case 'e': case 'E':
- fieldWriter.Set( meshDS, "_edges_", SMDSAbs_Edge, /*nbComps=*/1, /*isInt=*/true );
+ fieldWriter.Set( meshDS, "_edges_", SMDSAbs_Edge, /*nbComps=*/1, /*isInt=*/false );
break;
case 'f': case 'F':
- fieldWriter.Set( meshDS, "_faces_", SMDSAbs_Face, /*nbComps=*/1, /*isInt=*/true );
+ fieldWriter.Set( meshDS, "_faces_", SMDSAbs_Face, /*nbComps=*/1, /*isInt=*/false );
break;
case 's': case 'S':
- fieldWriter.Set( meshDS, "_solids_", SMDSAbs_Volume, /*nbComps=*/1, /*isInt=*/true );
+ fieldWriter.Set( meshDS, "_solids_", SMDSAbs_Volume, /*nbComps=*/1, /*isInt=*/false );
break;
default: continue;
}
@@ -3310,14 +3335,14 @@ void SMESH_Mesh_i::exportMEDFields( DriverMED_W_Field& fieldWriter,
const int shapeID = e->getshapeId();
if ( shapeID < 1 )
{
- fieldWriter.AddValue( -1 );
- fieldWriter.AddValue( -1 );
+ fieldWriter.AddValue( (double) -1 );
+ fieldWriter.AddValue( (double) -1 );
}
else
{
const TopoDS_Shape& S = meshDS->IndexToShape( shapeID );
- fieldWriter.AddValue( S.IsNull() ? -1 : shapeDim[ S.ShapeType() ]);
- fieldWriter.AddValue( shapeID );
+ fieldWriter.AddValue( (double) ( S.IsNull() ? -1 : shapeDim[ S.ShapeType() ]));
+ fieldWriter.AddValue( (double) shapeID );
}
}
else
@@ -3326,9 +3351,9 @@ void SMESH_Mesh_i::exportMEDFields( DriverMED_W_Field& fieldWriter,
const SMDS_MeshElement* e = elemIt->next();
const int shapeID = e->getshapeId();
if ( shapeID < 1 )
- fieldWriter.AddValue( -1 );
+ fieldWriter.AddValue( (double) -1 );
else
- fieldWriter.AddValue( shapeID );
+ fieldWriter.AddValue( (double) shapeID );
}
// write a step
diff --git a/src/SMESH_SWIG/smeshBuilder.py b/src/SMESH_SWIG/smeshBuilder.py
index 222e4f9dc..262685a43 100644
--- a/src/SMESH_SWIG/smeshBuilder.py
+++ b/src/SMESH_SWIG/smeshBuilder.py
@@ -1567,8 +1567,10 @@ class Mesh:
if self.mesh.HasShapeToMesh():
hyp_type = hyp.GetName()
lib_name = hyp.GetLibName()
- isSubMesh = ( not geom.IsSame( self.mesh.GetShapeToMesh() ))
- isApplicable = self.smeshpyD.IsApplicable(hyp_type, lib_name, geom, isSubMesh)
+ checkAll = ( not geom.IsSame( self.mesh.GetShapeToMesh() ))
+ if checkAll and geom:
+ checkAll = geom.GetType() == 37
+ isApplicable = self.smeshpyD.IsApplicable(hyp_type, lib_name, geom, checkAll)
if isApplicable:
AssureGeomPublished( self, geom, "shape for %s" % hyp.GetName())
status = self.mesh.AddHypothesis(geom, hyp)
diff --git a/src/Tools/CMakeLists.txt b/src/Tools/CMakeLists.txt
index 273b753bf..9495dd8c3 100644
--- a/src/Tools/CMakeLists.txt
+++ b/src/Tools/CMakeLists.txt
@@ -21,6 +21,7 @@ ADD_SUBDIRECTORY(MeshCut)
ADD_SUBDIRECTORY(padder)
ADD_SUBDIRECTORY(Verima)
ADD_SUBDIRECTORY(blocFissure)
+ADD_SUBDIRECTORY(MacMesh)
IF(SALOME_BUILD_GUI)
ADD_SUBDIRECTORY(MGCleanerPlug)
diff --git a/src/Tools/MacMesh/CMakeLists.txt b/src/Tools/MacMesh/CMakeLists.txt
new file mode 100644
index 000000000..4cf6c7293
--- /dev/null
+++ b/src/Tools/MacMesh/CMakeLists.txt
@@ -0,0 +1,68 @@
+# Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+
+# Copyright (C) 2003-2007 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, or (at your option) any later version.
+
+# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
+
+SET(MACMESH_INSTALL_PY ${SALOME_SMESH_INSTALL_PLUGINS}/MacMesh)
+SET(MACMESH_INSTALL_DOC ${SALOME_INSTALL_DOC}/gui/SMESH/MacMesh)
+
+SALOME_CONFIGURE_FILE(Doc/index.html.in index.html)
+SALOME_CONFIGURE_FILE(Example/PressureValve.py.in PressureValve.py)
+
+SET(plugin_DOC_FILES
+ Doc/MacMesh.v.10avr.pdf
+ ${CMAKE_CURRENT_BINARY_DIR}/index.html
+ Doc/snap.jpg
+ )
+
+IF(SALOME_BUILD_DOC)
+ INSTALL(FILES ${plugin_DOC_FILES} DESTINATION ${MACMESH_INSTALL_DOC})
+ENDIF(SALOME_BUILD_DOC)
+
+# --- scripts ---
+
+# scripts / static
+SET(plugin_SCRIPTS
+ MacMesh/Alarms.py
+ MacMesh/CentralUnrefine.py
+ MacMesh/CompositeBox.py
+ MacMesh/CompositeBoxF.py
+ MacMesh/Config.py
+ MacMesh/CutnGroup.py
+ MacMesh/Cylinder.py
+ MacMesh/GenFunctions.py
+ MacMesh/MacObject.py
+ MacMesh/PublishGroups.py
+ MacMesh/SharpAngle.py
+)
+SET(sample_SCRIPT
+ ${CMAKE_CURRENT_BINARY_DIR}/PressureValve.py
+)
+# --- rules ---
+
+SALOME_INSTALL_SCRIPTS("${plugin_SCRIPTS}" ${MACMESH_INSTALL_PY})
+SALOME_INSTALL_SCRIPTS("${sample_SCRIPT}" ${SALOME_INSTALL_SCRIPT_PYTHON} DEF_PERMS)
+
+SET(testname MacMesh_Example_PressureValve)
+SALOME_GENERATE_TESTS_ENVIRONMENT(tests_env)
+ADD_TEST(
+ NAME ${testname}
+ COMMAND ${PYTHON_EXECUTABLE} -B ${CMAKE_SOURCE_DIR}/doc/salome/examples/testme.py ${sample_SCRIPT})
+SET_TESTS_PROPERTIES(${testname} PROPERTIES ENVIRONMENT "${tests_env}")
+
diff --git a/src/Tools/MacMesh/Doc/MacMesh.v.10avr.pdf b/src/Tools/MacMesh/Doc/MacMesh.v.10avr.pdf
new file mode 100755
index 000000000..0c59d56a6
Binary files /dev/null and b/src/Tools/MacMesh/Doc/MacMesh.v.10avr.pdf differ
diff --git a/src/Tools/MacMesh/Doc/index.html.in b/src/Tools/MacMesh/Doc/index.html.in
new file mode 100644
index 000000000..fc87fe214
--- /dev/null
+++ b/src/Tools/MacMesh/Doc/index.html.in
@@ -0,0 +1,20 @@
+
+
+
+
+ MacMesh for Salome
+
+ The multi-purpose Salome plug-in for regular 2D meshing
+
+ - Consider reading
+ User manual to learn how to use the plug-in
+ - Type import PressureValve in the Python console of
+ Salome to run a sample script
+ -
+ Download the sample script
+ - Python files of the plugin are located in
+ ${SMESH_ROOT_DIR}/@MACMESH_INSTALL_PY@ directory
+
+
+
+