mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2024-12-28 02:10:35 +05:00
PR: synchro V7_main tag mergefrom_V6_main_19Mar13
This commit is contained in:
parent
f9343acc3c
commit
734f635b5f
23
doc/salome/examples/CMakeLists.txt
Normal file
23
doc/salome/examples/CMakeLists.txt
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# Copyright (C) 2012 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||||
|
#
|
||||||
|
# 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
|
#
|
||||||
|
|
||||||
|
SET(docdir ${CMAKE_INSTALL_PREFIX}/share/doc/salome)
|
||||||
|
FILE(GLOB files "${CMAKE_CURRENT_SOURCE_DIR}/*.py")
|
||||||
|
INSTALL(FILES ${files} DESTINATION ${docdir}/examples/SMESH)
|
||||||
|
|
@ -58,7 +58,9 @@ IF(WINDOWS)
|
|||||||
SET(CALL_STR "call")
|
SET(CALL_STR "call")
|
||||||
ELSE(WINDOWS)
|
ELSE(WINDOWS)
|
||||||
SET(DOC_PYTHONPATH "${CMAKE_INSTALL_PREFIX}/bin/salome:${CMAKE_INSTALL_PREFIX}/lib/python${PYTHON_VERSION}/site-packages/salome:${MED_ROOT_DIR}/lib/python${PYTHON_VERSION}/site-packages/salome:${GEOM_ROOT_DIR}/bin/salome:${GEOM_ROOT_DIR}/lib/python${PYTHON_VERSION}/site-packages/salome:${KERNEL_ROOT_DIR}/bin/salome:${KERNEL_ROOT_DIR}/lib/python${PYTHON_VERSION}/site-packages/salome:${OMNIORB_ROOT_USER}/lib/python${PYTHON_VERSION}/site-packages:${OMNIORB_ROOT_USER}/lib64/python${PYTHON_VERSION}/site-packages")
|
SET(DOC_PYTHONPATH "${CMAKE_INSTALL_PREFIX}/bin/salome:${CMAKE_INSTALL_PREFIX}/lib/python${PYTHON_VERSION}/site-packages/salome:${MED_ROOT_DIR}/lib/python${PYTHON_VERSION}/site-packages/salome:${GEOM_ROOT_DIR}/bin/salome:${GEOM_ROOT_DIR}/lib/python${PYTHON_VERSION}/site-packages/salome:${KERNEL_ROOT_DIR}/bin/salome:${KERNEL_ROOT_DIR}/lib/python${PYTHON_VERSION}/site-packages/salome:${OMNIORB_ROOT_USER}/lib/python${PYTHON_VERSION}/site-packages:${OMNIORB_ROOT_USER}/lib64/python${PYTHON_VERSION}/site-packages")
|
||||||
SET(SCR "export PYTHONPATH=${DOC_PYTHONPATH}:${PYTHONPATH}
|
SET(DOC_LD_LIBRARY_PATH "${CMAKE_INSTALL_PREFIX}/lib/salome:${MED_ROOT_DIR}/lib/salome:${GEOM_ROOT_DIR}/lib/salome:${KERNEL_ROOT_DIR}/lib/salome")
|
||||||
|
SET(SCR "export PYTHONPATH=${DOC_PYTHONPATH}:\${PYTHONPATH}
|
||||||
|
export LD_LIBRARY_PATH=${DOC_LD_LIBRARY_PATH}:\${LD_LIBRARY_PATH}
|
||||||
export SMESH_MeshersList=${DOC_SMESH_MeshersList}
|
export SMESH_MeshersList=${DOC_SMESH_MeshersList}
|
||||||
")
|
")
|
||||||
SET(EXT "sh")
|
SET(EXT "sh")
|
||||||
@ -68,7 +70,7 @@ ENDIF(WINDOWS)
|
|||||||
FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/tmp_env.${EXT} "${SCR}")
|
FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/tmp_env.${EXT} "${SCR}")
|
||||||
|
|
||||||
ADD_CUSTOM_TARGET(usr_docs ${PYTHON_EXECUTABLE} ${f} smesh.py ${CMAKE_SOURCE_DIR}/src/SMESH_SWIG/smeshDC.py smesh
|
ADD_CUSTOM_TARGET(usr_docs ${PYTHON_EXECUTABLE} ${f} smesh.py ${CMAKE_SOURCE_DIR}/src/SMESH_SWIG/smeshDC.py smesh
|
||||||
COMMAND mkdir tmp && ${CALL_STR} ${CMAKE_CURRENT_BINARY_DIR}/tmp_env.${EXT} && ${PYTHON_EXECUTABLE} ${f1} -o tmp/smesh.py StdMeshers
|
COMMAND mkdir -p tmp && ${CALL_STR} ${CMAKE_CURRENT_BINARY_DIR}/tmp_env.${EXT} && ${PYTHON_EXECUTABLE} ${f1} -o tmp/smesh.py StdMeshers
|
||||||
COMMAND ${DOXYGEN_EXECUTABLE} doxyfile_py
|
COMMAND ${DOXYGEN_EXECUTABLE} doxyfile_py
|
||||||
COMMAND ${DOXYGEN_EXECUTABLE} doxyfile
|
COMMAND ${DOXYGEN_EXECUTABLE} doxyfile
|
||||||
COMMAND ${PYTHON_EXECUTABLE} -c "import os, shutil; os.remove(r'''smesh.py'''); shutil.rmtree(r'''tmp''')"
|
COMMAND ${PYTHON_EXECUTABLE} -c "import os, shutil; os.remove(r'''smesh.py'''); shutil.rmtree(r'''tmp''')"
|
||||||
@ -76,3 +78,5 @@ ADD_CUSTOM_TARGET(usr_docs ${PYTHON_EXECUTABLE} ${f} smesh.py ${CMAKE_SOURCE_DIR
|
|||||||
VERBATIM
|
VERBATIM
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
ADD_DEPENDENCIES(usr_docs html_docs)
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
||||||
<title>$title</title>
|
<title>$title</title>
|
||||||
<link href="$relpath$tabs.css" rel="stylesheet" type="text/css"/>
|
<link href="$relpath$tabs.css" rel="stylesheet" type="text/css"/>
|
||||||
|
<script type="text/javascript" src="$relpath^jquery.js"></script>
|
||||||
|
<script type="text/javascript" src="$relpath^dynsections.js"></script>
|
||||||
$treeview
|
$treeview
|
||||||
$search
|
$search
|
||||||
$mathjax
|
$mathjax
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
||||||
<title>$title</title>
|
<title>$title</title>
|
||||||
<link href="$relpath$tabs.css" rel="stylesheet" type="text/css"/>
|
<link href="$relpath$tabs.css" rel="stylesheet" type="text/css"/>
|
||||||
|
<script type="text/javascript" src="$relpath^jquery.js"></script>
|
||||||
|
<script type="text/javascript" src="$relpath^dynsections.js"></script>
|
||||||
$treeview
|
$treeview
|
||||||
$search
|
$search
|
||||||
$mathjax
|
$mathjax
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
||||||
<title>$title</title>
|
<title>$title</title>
|
||||||
<link href="$relpath$tabs.css" rel="stylesheet" type="text/css"/>
|
<link href="$relpath$tabs.css" rel="stylesheet" type="text/css"/>
|
||||||
|
<script type="text/javascript" src="$relpath^jquery.js"></script>
|
||||||
|
<script type="text/javascript" src="$relpath^dynsections.js"></script>
|
||||||
$treeview
|
$treeview
|
||||||
$search
|
$search
|
||||||
$mathjax
|
$mathjax
|
||||||
|
@ -1294,7 +1294,11 @@ double Warping::GetValue( const TSequenceOfXYZ& P )
|
|||||||
double A3 = ComputeA( P( 3 ), P( 4 ), P( 1 ), G );
|
double A3 = ComputeA( P( 3 ), P( 4 ), P( 1 ), G );
|
||||||
double A4 = ComputeA( P( 4 ), P( 1 ), P( 2 ), G );
|
double A4 = ComputeA( P( 4 ), P( 1 ), P( 2 ), G );
|
||||||
|
|
||||||
return Max( Max( A1, A2 ), Max( A3, A4 ) );
|
double val = Max( Max( A1, A2 ), Max( A3, A4 ) );
|
||||||
|
|
||||||
|
const double eps = 0.1; // val is in degrees
|
||||||
|
|
||||||
|
return val < eps ? 0. : val;
|
||||||
}
|
}
|
||||||
|
|
||||||
double Warping::ComputeA( const gp_XYZ& thePnt1,
|
double Warping::ComputeA( const gp_XYZ& thePnt1,
|
||||||
@ -1362,7 +1366,11 @@ double Taper::GetValue( const TSequenceOfXYZ& P )
|
|||||||
double T3 = fabs( ( J3 - JA ) / JA );
|
double T3 = fabs( ( J3 - JA ) / JA );
|
||||||
double T4 = fabs( ( J4 - JA ) / JA );
|
double T4 = fabs( ( J4 - JA ) / JA );
|
||||||
|
|
||||||
return Max( Max( T1, T2 ), Max( T3, T4 ) );
|
double val = Max( Max( T1, T2 ), Max( T3, T4 ) );
|
||||||
|
|
||||||
|
const double eps = 0.01;
|
||||||
|
|
||||||
|
return val < eps ? 0. : val;
|
||||||
}
|
}
|
||||||
|
|
||||||
double Taper::GetBadRate( double Value, int /*nbNodes*/ ) const
|
double Taper::GetBadRate( double Value, int /*nbNodes*/ ) const
|
||||||
@ -1402,7 +1410,7 @@ double Skew::GetValue( const TSequenceOfXYZ& P )
|
|||||||
return 0.;
|
return 0.;
|
||||||
|
|
||||||
// Compute skew
|
// Compute skew
|
||||||
static double PI2 = M_PI / 2.;
|
const double PI2 = M_PI / 2.;
|
||||||
if ( P.size() == 3 )
|
if ( P.size() == 3 )
|
||||||
{
|
{
|
||||||
double A0 = fabs( PI2 - skewAngle( P( 3 ), P( 1 ), P( 2 ) ) );
|
double A0 = fabs( PI2 - skewAngle( P( 3 ), P( 1 ), P( 2 ) ) );
|
||||||
@ -1422,11 +1430,11 @@ double Skew::GetValue( const TSequenceOfXYZ& P )
|
|||||||
double A = v1.Magnitude() <= gp::Resolution() || v2.Magnitude() <= gp::Resolution()
|
double A = v1.Magnitude() <= gp::Resolution() || v2.Magnitude() <= gp::Resolution()
|
||||||
? 0. : fabs( PI2 - v1.Angle( v2 ) );
|
? 0. : fabs( PI2 - v1.Angle( v2 ) );
|
||||||
|
|
||||||
//BUG SWP12743
|
double val = A * 180. / M_PI;
|
||||||
if ( A < theEps )
|
|
||||||
return theInf;
|
|
||||||
|
|
||||||
return A * 180. / M_PI;
|
const double eps = 0.1; // val is in degrees
|
||||||
|
|
||||||
|
return val < eps ? 0. : val;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,12 +18,11 @@
|
|||||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
//
|
//
|
||||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
//
|
|
||||||
|
|
||||||
// SMESH DriverMED : driver to read and write 'med' files
|
// SMESH DriverMED : driver to read and write 'med' files
|
||||||
// File : DriverMED_R_SMESHDS_Mesh.cxx
|
// File : DriverMED_R_SMESHDS_Mesh.cxx
|
||||||
// Module : SMESH
|
// Module : SMESH
|
||||||
//
|
|
||||||
#include "DriverMED_R_SMESHDS_Mesh.h"
|
#include "DriverMED_R_SMESHDS_Mesh.h"
|
||||||
#include "SMESHDS_Mesh.hxx"
|
#include "SMESHDS_Mesh.hxx"
|
||||||
#include "utilities.h"
|
#include "utilities.h"
|
||||||
@ -36,6 +35,8 @@
|
|||||||
#include "MED_CoordUtils.hxx"
|
#include "MED_CoordUtils.hxx"
|
||||||
#include "MED_Utilities.hxx"
|
#include "MED_Utilities.hxx"
|
||||||
|
|
||||||
|
#include <NCollection_Map.hxx>
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#ifdef _DEBUG_
|
#ifdef _DEBUG_
|
||||||
@ -71,7 +72,7 @@ DriverMED_R_SMESHDS_Mesh
|
|||||||
::Perform()
|
::Perform()
|
||||||
{
|
{
|
||||||
Status aResult = DRS_FAIL;
|
Status aResult = DRS_FAIL;
|
||||||
bool isDescConn = false;
|
bool isDescConn = false; // Mantis issue 0020483
|
||||||
#ifndef _DEXCEPT_
|
#ifndef _DEXCEPT_
|
||||||
try{
|
try{
|
||||||
#endif
|
#endif
|
||||||
@ -175,13 +176,17 @@ DriverMED_R_SMESHDS_Mesh
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Are there any MED cells in descending connectivity
|
// Are there any MED cells in descending connectivity
|
||||||
|
// Mantis issue 0020483
|
||||||
//---------------------------------------------------
|
//---------------------------------------------------
|
||||||
|
NCollection_Map<EEntiteMaillage> aDescendingEntitiesMap;
|
||||||
if (!isDescConn) {
|
if (!isDescConn) {
|
||||||
MED::TEntityInfo aEntityInfoDesc = aMed->GetEntityInfo(aMeshInfo, eDESC);
|
MED::TEntityInfo aEntityInfoDesc = aMed->GetEntityInfo(aMeshInfo, eDESC);
|
||||||
MED::TEntityInfo::iterator anEntityIterDesc = aEntityInfoDesc.begin();
|
MED::TEntityInfo::iterator anEntityIterDesc = aEntityInfoDesc.begin();
|
||||||
for (; anEntityIterDesc != aEntityInfoDesc.end() && !isDescConn; anEntityIterDesc++) {
|
//for (; anEntityIterDesc != aEntityInfoDesc.end() && !isDescConn; anEntityIterDesc++) {
|
||||||
|
for (; anEntityIterDesc != aEntityInfoDesc.end(); anEntityIterDesc++) {
|
||||||
const EEntiteMaillage& anEntity = anEntityIterDesc->first;
|
const EEntiteMaillage& anEntity = anEntityIterDesc->first;
|
||||||
if (anEntity != eNOEUD) isDescConn = true;
|
aDescendingEntitiesMap.Add(anEntity);
|
||||||
|
//if (anEntity != eNOEUD) isDescConn = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -193,6 +198,7 @@ DriverMED_R_SMESHDS_Mesh
|
|||||||
MED::TEntityInfo::iterator anEntityIter = aEntityInfo.begin();
|
MED::TEntityInfo::iterator anEntityIter = aEntityInfo.begin();
|
||||||
for (; anEntityIter != aEntityInfo.end(); anEntityIter++) {
|
for (; anEntityIter != aEntityInfo.end(); anEntityIter++) {
|
||||||
const EEntiteMaillage& anEntity = anEntityIter->first;
|
const EEntiteMaillage& anEntity = anEntityIter->first;
|
||||||
|
aDescendingEntitiesMap.Remove(anEntity); // Mantis issue 0020483
|
||||||
if (anEntity == eNOEUD) continue;
|
if (anEntity == eNOEUD) continue;
|
||||||
// Reading MED cells to the corresponding SMDS structure
|
// Reading MED cells to the corresponding SMDS structure
|
||||||
//------------------------------------------------------
|
//------------------------------------------------------
|
||||||
@ -904,8 +910,9 @@ DriverMED_R_SMESHDS_Mesh
|
|||||||
}}
|
}}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
if (aDescendingEntitiesMap.Extent()) isDescConn = true; // Mantis issue 0020483
|
||||||
}
|
} // for(int iMesh = 0; iMesh < aNbMeshes; iMesh++)
|
||||||
|
} // if aNbMeshes
|
||||||
#ifndef _DEXCEPT_
|
#ifndef _DEXCEPT_
|
||||||
}catch(const std::exception& exc){
|
}catch(const std::exception& exc){
|
||||||
INFOS("The following exception was caught:\n\t"<<exc.what());
|
INFOS("The following exception was caught:\n\t"<<exc.what());
|
||||||
@ -918,6 +925,7 @@ DriverMED_R_SMESHDS_Mesh
|
|||||||
if (myMesh)
|
if (myMesh)
|
||||||
myMesh->compactMesh();
|
myMesh->compactMesh();
|
||||||
|
|
||||||
|
// Mantis issue 0020483
|
||||||
if (aResult == DRS_OK && isDescConn) {
|
if (aResult == DRS_OK && isDescConn) {
|
||||||
INFOS("There are some elements in descending connectivity in med file. They were not read !!!");
|
INFOS("There are some elements in descending connectivity in med file. They were not read !!!");
|
||||||
aResult = DRS_WARN_DESCENDING;
|
aResult = DRS_WARN_DESCENDING;
|
||||||
@ -944,10 +952,10 @@ list<string> DriverMED_R_SMESHDS_Mesh::GetMeshNames(Status& theStatus)
|
|||||||
aMeshNames.push_back(aMeshInfo->GetName());
|
aMeshNames.push_back(aMeshInfo->GetName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}catch(const std::exception& exc){
|
} catch(const std::exception& exc) {
|
||||||
INFOS("Following exception was caught:\n\t"<<exc.what());
|
INFOS("Following exception was caught:\n\t"<<exc.what());
|
||||||
theStatus = DRS_FAIL;
|
theStatus = DRS_FAIL;
|
||||||
}catch(...){
|
} catch(...) {
|
||||||
INFOS("Unknown exception was caught !!!");
|
INFOS("Unknown exception was caught !!!");
|
||||||
theStatus = DRS_FAIL;
|
theStatus = DRS_FAIL;
|
||||||
}
|
}
|
||||||
|
@ -160,10 +160,10 @@ SMDS_Mesh::SMDS_Mesh()
|
|||||||
myGrid->Initialize();
|
myGrid->Initialize();
|
||||||
myGrid->Allocate();
|
myGrid->Allocate();
|
||||||
vtkPoints* points = vtkPoints::New();
|
vtkPoints* points = vtkPoints::New();
|
||||||
// rnv: to fix bug "21125: EDF 1233 SMESH: Degrardation of precision in a test case for quadratic conversion"
|
// bug "21125: EDF 1233 SMESH: Degrardation of precision in a test case for quadratic conversion"
|
||||||
// using double type for storing coordinates of nodes instead float.
|
// Use double type for storing coordinates of nodes instead of float.
|
||||||
points->SetDataType(VTK_DOUBLE);
|
points->SetDataType(VTK_DOUBLE);
|
||||||
points->SetNumberOfPoints(SMDS_Mesh::chunkSize);
|
points->SetNumberOfPoints(0 /*SMDS_Mesh::chunkSize*/);
|
||||||
myGrid->SetPoints( points );
|
myGrid->SetPoints( points );
|
||||||
points->Delete();
|
points->Delete();
|
||||||
myGrid->BuildLinks();
|
myGrid->BuildLinks();
|
||||||
|
@ -63,18 +63,16 @@ using namespace std;
|
|||||||
|
|
||||||
SMESH_Gen::SMESH_Gen()
|
SMESH_Gen::SMESH_Gen()
|
||||||
{
|
{
|
||||||
MESSAGE("SMESH_Gen::SMESH_Gen");
|
MESSAGE("SMESH_Gen::SMESH_Gen");
|
||||||
_localId = 0;
|
_localId = 0;
|
||||||
_hypId = 0;
|
_hypId = 0;
|
||||||
_segmentation = _nbSegments = 10;
|
_segmentation = _nbSegments = 10;
|
||||||
SMDS_Mesh::_meshList.clear();
|
SMDS_Mesh::_meshList.clear();
|
||||||
MESSAGE(SMDS_Mesh::_meshList.size());
|
MESSAGE(SMDS_Mesh::_meshList.size());
|
||||||
//_counters = new counters(100);
|
//_counters = new counters(100);
|
||||||
#ifdef WITH_SMESH_CANCEL_COMPUTE
|
_compute_canceled = false;
|
||||||
_compute_canceled = false;
|
_sm_current = NULL;
|
||||||
_sm_current = NULL;
|
//vtkDebugLeaks::SetExitError(0);
|
||||||
#endif
|
|
||||||
//vtkDebugLeaks::SetExitError(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
@ -145,6 +143,11 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
|
|||||||
const int globalAlgoDim = 100;
|
const int globalAlgoDim = 100;
|
||||||
|
|
||||||
SMESH_subMeshIteratorPtr smIt;
|
SMESH_subMeshIteratorPtr smIt;
|
||||||
|
SMESH_subMesh::compute_event computeEvent;
|
||||||
|
if ( !anUpward && aShape.IsSame( aMesh.GetShapeToMesh() ))
|
||||||
|
computeEvent = SMESH_subMesh::COMPUTE;
|
||||||
|
else
|
||||||
|
computeEvent = SMESH_subMesh::COMPUTE_SUBMESH;
|
||||||
|
|
||||||
if ( anUpward ) // is called from below code here
|
if ( anUpward ) // is called from below code here
|
||||||
{
|
{
|
||||||
@ -172,15 +175,11 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
|
|||||||
|
|
||||||
if (smToCompute->GetComputeState() == SMESH_subMesh::READY_TO_COMPUTE)
|
if (smToCompute->GetComputeState() == SMESH_subMesh::READY_TO_COMPUTE)
|
||||||
{
|
{
|
||||||
#ifdef WITH_SMESH_CANCEL_COMPUTE
|
|
||||||
if (_compute_canceled)
|
if (_compute_canceled)
|
||||||
return false;
|
return false;
|
||||||
_sm_current = smToCompute;
|
_sm_current = smToCompute;
|
||||||
#endif
|
smToCompute->ComputeStateEngine( computeEvent );
|
||||||
smToCompute->ComputeStateEngine( SMESH_subMesh::COMPUTE );
|
|
||||||
#ifdef WITH_SMESH_CANCEL_COMPUTE
|
|
||||||
_sm_current = NULL;
|
_sm_current = NULL;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// we check all the submeshes here and detect if any of them failed to compute
|
// we check all the submeshes here and detect if any of them failed to compute
|
||||||
@ -258,15 +257,11 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef WITH_SMESH_CANCEL_COMPUTE
|
|
||||||
if (_compute_canceled)
|
if (_compute_canceled)
|
||||||
return false;
|
return false;
|
||||||
_sm_current = smToCompute;
|
_sm_current = smToCompute;
|
||||||
#endif
|
smToCompute->ComputeStateEngine( computeEvent );
|
||||||
smToCompute->ComputeStateEngine( SMESH_subMesh::COMPUTE );
|
|
||||||
#ifdef WITH_SMESH_CANCEL_COMPUTE
|
|
||||||
_sm_current = NULL;
|
_sm_current = NULL;
|
||||||
#endif
|
|
||||||
if ( aShapesId )
|
if ( aShapesId )
|
||||||
aShapesId->insert( smToCompute->GetId() );
|
aShapesId->insert( smToCompute->GetId() );
|
||||||
}
|
}
|
||||||
@ -342,15 +337,11 @@ bool SMESH_Gen::Compute(SMESH_Mesh & aMesh,
|
|||||||
if ( aShapesId && GetShapeDim( aShType ) > (int)aDim )
|
if ( aShapesId && GetShapeDim( aShType ) > (int)aDim )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
#ifdef WITH_SMESH_CANCEL_COMPUTE
|
|
||||||
if (_compute_canceled)
|
if (_compute_canceled)
|
||||||
return false;
|
return false;
|
||||||
_sm_current = sm;
|
_sm_current = sm;
|
||||||
#endif
|
sm->ComputeStateEngine( computeEvent );
|
||||||
sm->ComputeStateEngine( SMESH_subMesh::COMPUTE );
|
|
||||||
#ifdef WITH_SMESH_CANCEL_COMPUTE
|
|
||||||
_sm_current = NULL;
|
_sm_current = NULL;
|
||||||
#endif
|
|
||||||
if ( aShapesId )
|
if ( aShapesId )
|
||||||
aShapesId->insert( sm->GetId() );
|
aShapesId->insert( sm->GetId() );
|
||||||
}
|
}
|
||||||
|
@ -7656,6 +7656,12 @@ void SMESH_MeshEditor::MergeNodes (TListOfListOfNodes & theGroupsOfNodes)
|
|||||||
//MESSAGE(" node to remove " << nToRemove->GetID());
|
//MESSAGE(" node to remove " << nToRemove->GetID());
|
||||||
rmNodeIds.push_back( nToRemove->GetID() );
|
rmNodeIds.push_back( nToRemove->GetID() );
|
||||||
AddToSameGroups( nToKeep, nToRemove, aMesh );
|
AddToSameGroups( nToKeep, nToRemove, aMesh );
|
||||||
|
// set _alwaysComputed to a sub-mesh of VERTEX to enable mesh computing
|
||||||
|
// after MergeNodes() w/o creating node in place of merged ones.
|
||||||
|
const SMDS_PositionPtr& pos = nToRemove->GetPosition();
|
||||||
|
if ( pos && pos->GetTypeOfPosition() == SMDS_TOP_VERTEX )
|
||||||
|
if ( SMESH_subMesh* sm = myMesh->GetSubMeshContaining( nToRemove->getshapeId() ))
|
||||||
|
sm->SetIsAlwaysComputed( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
SMDS_ElemIteratorPtr invElemIt = nToRemove->GetInverseElementIterator();
|
SMDS_ElemIteratorPtr invElemIt = nToRemove->GetInverseElementIterator();
|
||||||
|
@ -513,6 +513,7 @@ gp_XY SMESH_MesherHelper::GetNodeUV(const TopoDS_Face& F,
|
|||||||
bool* check) const
|
bool* check) const
|
||||||
{
|
{
|
||||||
gp_Pnt2d uv( Precision::Infinite(), Precision::Infinite() );
|
gp_Pnt2d uv( Precision::Infinite(), Precision::Infinite() );
|
||||||
|
|
||||||
const SMDS_PositionPtr Pos = n->GetPosition();
|
const SMDS_PositionPtr Pos = n->GetPosition();
|
||||||
bool uvOK = false;
|
bool uvOK = false;
|
||||||
if(Pos->GetTypeOfPosition()==SMDS_TOP_FACE)
|
if(Pos->GetTypeOfPosition()==SMDS_TOP_FACE)
|
||||||
@ -797,7 +798,8 @@ double SMESH_MesherHelper::GetNodeU(const TopoDS_Edge& E,
|
|||||||
const SMDS_MeshNode* inEdgeNode,
|
const SMDS_MeshNode* inEdgeNode,
|
||||||
bool* check)
|
bool* check)
|
||||||
{
|
{
|
||||||
double param = 0;
|
double param = Precision::Infinite();
|
||||||
|
|
||||||
const SMDS_PositionPtr pos = n->GetPosition();
|
const SMDS_PositionPtr pos = n->GetPosition();
|
||||||
if ( pos->GetTypeOfPosition()==SMDS_TOP_EDGE )
|
if ( pos->GetTypeOfPosition()==SMDS_TOP_EDGE )
|
||||||
{
|
{
|
||||||
@ -1134,8 +1136,8 @@ const SMDS_MeshNode* SMESH_MesherHelper::GetCentralNode(const SMDS_MeshNode* n1,
|
|||||||
Handle( Geom_Surface ) S = BRep_Tool::Surface( F, loc );
|
Handle( Geom_Surface ) S = BRep_Tool::Surface( F, loc );
|
||||||
P = S->Value( uvAvg.X(), uvAvg.Y() ).Transformed( loc );
|
P = S->Value( uvAvg.X(), uvAvg.Y() ).Transformed( loc );
|
||||||
centralNode = meshDS->AddNode( P.X(), P.Y(), P.Z() );
|
centralNode = meshDS->AddNode( P.X(), P.Y(), P.Z() );
|
||||||
if ( mySetElemOnShape )
|
// if ( mySetElemOnShape ) node is not elem!
|
||||||
meshDS->SetNodeOnFace( centralNode, faceID, uvAvg.X(), uvAvg.Y() );
|
meshDS->SetNodeOnFace( centralNode, faceID, uvAvg.X(), uvAvg.Y() );
|
||||||
myMapWithCentralNode.insert( std::make_pair( keyOfMap, centralNode ) );
|
myMapWithCentralNode.insert( std::make_pair( keyOfMap, centralNode ) );
|
||||||
return centralNode;
|
return centralNode;
|
||||||
}
|
}
|
||||||
@ -1147,23 +1149,23 @@ const SMDS_MeshNode* SMESH_MesherHelper::GetCentralNode(const SMDS_MeshNode* n1,
|
|||||||
SMESH_TNodeXYZ( n4 ) ) / 4;
|
SMESH_TNodeXYZ( n4 ) ) / 4;
|
||||||
centralNode = meshDS->AddNode( P.X(), P.Y(), P.Z() );
|
centralNode = meshDS->AddNode( P.X(), P.Y(), P.Z() );
|
||||||
|
|
||||||
if ( mySetElemOnShape )
|
if ( !F.IsNull() )
|
||||||
{
|
{
|
||||||
if ( !F.IsNull() )
|
uvAvg = (GetNodeUV(F,n1,n3) +
|
||||||
{
|
GetNodeUV(F,n2,n4) +
|
||||||
uvAvg = (GetNodeUV(F,n1,n3) +
|
GetNodeUV(F,n3,n1) +
|
||||||
GetNodeUV(F,n2,n4) +
|
GetNodeUV(F,n4,n2)) / 4;
|
||||||
GetNodeUV(F,n3,n1) +
|
CheckNodeUV( F, centralNode, uvAvg, 2*BRep_Tool::Tolerance( F ), /*force=*/true);
|
||||||
GetNodeUV(F,n4,n2)) / 4;
|
meshDS->SetNodeOnFace( centralNode, faceID, uvAvg.X(), uvAvg.Y() );
|
||||||
CheckNodeUV( F, centralNode, uvAvg, 2*BRep_Tool::Tolerance( F ), /*force=*/true);
|
}
|
||||||
meshDS->SetNodeOnFace( centralNode, faceID, uvAvg.X(), uvAvg.Y() );
|
else if ( shapeID > 0 )
|
||||||
}
|
{
|
||||||
else if ( shapeID > 0 )
|
meshDS->SetNodeInVolume( centralNode, shapeID );
|
||||||
meshDS->SetNodeInVolume( centralNode, shapeID );
|
}
|
||||||
else if ( myShapeID > 0 )
|
else if ( myShapeID > 0 && mySetElemOnShape )
|
||||||
meshDS->SetMeshElementOnShape( centralNode, myShapeID );
|
{
|
||||||
|
meshDS->SetMeshElementOnShape( centralNode, myShapeID );
|
||||||
}
|
}
|
||||||
|
|
||||||
myMapWithCentralNode.insert( std::make_pair( keyOfMap, centralNode ) );
|
myMapWithCentralNode.insert( std::make_pair( keyOfMap, centralNode ) );
|
||||||
return centralNode;
|
return centralNode;
|
||||||
}
|
}
|
||||||
@ -1247,8 +1249,8 @@ const SMDS_MeshNode* SMESH_MesherHelper::GetMediumNode(const SMDS_MeshNode* n1,
|
|||||||
gp_XY UV = GetMiddleUV( S, uv[0], uv[1] );
|
gp_XY UV = GetMiddleUV( S, uv[0], uv[1] );
|
||||||
gp_Pnt P = S->Value( UV.X(), UV.Y() ).Transformed(loc);
|
gp_Pnt P = S->Value( UV.X(), UV.Y() ).Transformed(loc);
|
||||||
n12 = meshDS->AddNode(P.X(), P.Y(), P.Z());
|
n12 = meshDS->AddNode(P.X(), P.Y(), P.Z());
|
||||||
if ( mySetElemOnShape )
|
// if ( mySetElemOnShape ) node is not elem!
|
||||||
meshDS->SetNodeOnFace(n12, faceID, UV.X(), UV.Y());
|
meshDS->SetNodeOnFace(n12, faceID, UV.X(), UV.Y());
|
||||||
myTLinkNodeMap.insert(make_pair(link,n12));
|
myTLinkNodeMap.insert(make_pair(link,n12));
|
||||||
return n12;
|
return n12;
|
||||||
}
|
}
|
||||||
@ -1272,8 +1274,8 @@ const SMDS_MeshNode* SMESH_MesherHelper::GetMediumNode(const SMDS_MeshNode* n1,
|
|||||||
|
|
||||||
gp_Pnt P = C->Value( U );
|
gp_Pnt P = C->Value( U );
|
||||||
n12 = meshDS->AddNode(P.X(), P.Y(), P.Z());
|
n12 = meshDS->AddNode(P.X(), P.Y(), P.Z());
|
||||||
if ( mySetElemOnShape )
|
//if ( mySetElemOnShape ) node is not elem!
|
||||||
meshDS->SetNodeOnEdge(n12, edgeID, U);
|
meshDS->SetNodeOnEdge(n12, edgeID, U);
|
||||||
myTLinkNodeMap.insert(make_pair(link,n12));
|
myTLinkNodeMap.insert(make_pair(link,n12));
|
||||||
return n12;
|
return n12;
|
||||||
}
|
}
|
||||||
@ -1286,21 +1288,21 @@ const SMDS_MeshNode* SMESH_MesherHelper::GetMediumNode(const SMDS_MeshNode* n1,
|
|||||||
double z = ( n1->Z() + n2->Z() )/2.;
|
double z = ( n1->Z() + n2->Z() )/2.;
|
||||||
n12 = meshDS->AddNode(x,y,z);
|
n12 = meshDS->AddNode(x,y,z);
|
||||||
|
|
||||||
if ( mySetElemOnShape )
|
//if ( mySetElemOnShape ) node is not elem!
|
||||||
{
|
{
|
||||||
if ( !F.IsNull() )
|
if ( !F.IsNull() )
|
||||||
{
|
{
|
||||||
gp_XY UV = ( uv[0] + uv[1] ) / 2.;
|
gp_XY UV = ( uv[0] + uv[1] ) / 2.;
|
||||||
CheckNodeUV( F, n12, UV, 2*BRep_Tool::Tolerance( F ), /*force=*/true);
|
CheckNodeUV( F, n12, UV, 2 * BRep_Tool::Tolerance( F ), /*force=*/true);
|
||||||
meshDS->SetNodeOnFace(n12, faceID, UV.X(), UV.Y() );
|
meshDS->SetNodeOnFace(n12, faceID, UV.X(), UV.Y() );
|
||||||
}
|
}
|
||||||
else if ( !E.IsNull() )
|
else if ( !E.IsNull() )
|
||||||
{
|
{
|
||||||
double U = ( u[0] + u[1] ) / 2.;
|
double U = ( u[0] + u[1] ) / 2.;
|
||||||
CheckNodeU( E, n12, U, 2*BRep_Tool::Tolerance( E ), /*force=*/true);
|
CheckNodeU( E, n12, U, 2 * BRep_Tool::Tolerance( E ), /*force=*/true);
|
||||||
meshDS->SetNodeOnEdge(n12, edgeID, U);
|
meshDS->SetNodeOnEdge(n12, edgeID, U);
|
||||||
}
|
}
|
||||||
else if ( myShapeID > 0 )
|
else if ( myShapeID > 0 && mySetElemOnShape )
|
||||||
{
|
{
|
||||||
meshDS->SetMeshElementOnShape(n12, myShapeID);
|
meshDS->SetMeshElementOnShape(n12, myShapeID);
|
||||||
}
|
}
|
||||||
@ -1375,8 +1377,8 @@ const SMDS_MeshNode* SMESH_MesherHelper::getMediumNodeOnComposedWire(const SMDS_
|
|||||||
GetMeshDS()->MoveNode( n12, p.X(), p.Y(), p.Z() );
|
GetMeshDS()->MoveNode( n12, p.X(), p.Y(), p.Z() );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( mySetElemOnShape )
|
//if ( mySetElemOnShape ) node is not elem!
|
||||||
GetMeshDS()->SetNodeOnEdge(n12, edges[iOkEdge], u);
|
GetMeshDS()->SetNodeOnEdge(n12, edges[iOkEdge], u);
|
||||||
|
|
||||||
myTLinkNodeMap.insert( make_pair( SMESH_TLink(n1,n2), n12 ));
|
myTLinkNodeMap.insert( make_pair( SMESH_TLink(n1,n2), n12 ));
|
||||||
|
|
||||||
@ -1397,7 +1399,7 @@ SMDS_MeshNode* SMESH_MesherHelper::AddNode(double x, double y, double z, int ID,
|
|||||||
node = meshDS->AddNodeWithID( x, y, z, ID );
|
node = meshDS->AddNodeWithID( x, y, z, ID );
|
||||||
else
|
else
|
||||||
node = meshDS->AddNode( x, y, z );
|
node = meshDS->AddNode( x, y, z );
|
||||||
if ( mySetElemOnShape && myShapeID > 0 ) {
|
if ( mySetElemOnShape && myShapeID > 0 ) { // node is not elem ?
|
||||||
switch ( myShape.ShapeType() ) {
|
switch ( myShape.ShapeType() ) {
|
||||||
case TopAbs_SOLID: meshDS->SetNodeInVolume( node, myShapeID); break;
|
case TopAbs_SOLID: meshDS->SetNodeInVolume( node, myShapeID); break;
|
||||||
case TopAbs_SHELL: meshDS->SetNodeInVolume( node, myShapeID); break;
|
case TopAbs_SHELL: meshDS->SetNodeInVolume( node, myShapeID); break;
|
||||||
@ -2015,7 +2017,6 @@ bool SMESH_MesherHelper::LoadNodeColumns(TParam2ColumnMap & theParam2
|
|||||||
if ( theParam2ColumnMap.empty() )
|
if ( theParam2ColumnMap.empty() )
|
||||||
{
|
{
|
||||||
// get data of edges for normalization of params
|
// get data of edges for normalization of params
|
||||||
|
|
||||||
vector< double > length;
|
vector< double > length;
|
||||||
double fullLen = 0;
|
double fullLen = 0;
|
||||||
list<TopoDS_Edge>::const_iterator edge;
|
list<TopoDS_Edge>::const_iterator edge;
|
||||||
@ -2039,8 +2040,8 @@ bool SMESH_MesherHelper::LoadNodeColumns(TParam2ColumnMap & theParam2
|
|||||||
map< double, const SMDS_MeshNode*>::iterator u_n = sortedBaseNN.begin();
|
map< double, const SMDS_MeshNode*>::iterator u_n = sortedBaseNN.begin();
|
||||||
if ( theProxyMesh ) // from sortedBaseNN remove nodes not shared by faces of faceSubMesh
|
if ( theProxyMesh ) // from sortedBaseNN remove nodes not shared by faces of faceSubMesh
|
||||||
{
|
{
|
||||||
const SMDS_MeshNode* n1 = sortedBaseNN.begin()->second;
|
const SMDS_MeshNode* n1 = (++sortedBaseNN.begin())->second;
|
||||||
const SMDS_MeshNode* n2 = sortedBaseNN.rbegin()->second;
|
const SMDS_MeshNode* n2 = (++sortedBaseNN.rbegin())->second;
|
||||||
bool allNodesAreProxy = ( n1 != theProxyMesh->GetProxyNode( n1 ) &&
|
bool allNodesAreProxy = ( n1 != theProxyMesh->GetProxyNode( n1 ) &&
|
||||||
n2 != theProxyMesh->GetProxyNode( n2 ));
|
n2 != theProxyMesh->GetProxyNode( n2 ));
|
||||||
if ( allNodesAreProxy )
|
if ( allNodesAreProxy )
|
||||||
@ -2052,7 +2053,7 @@ bool SMESH_MesherHelper::LoadNodeColumns(TParam2ColumnMap & theParam2
|
|||||||
while ( ++u_n != sortedBaseNN.end() && !isNodeInSubMesh( u_n->second, faceSubMesh ));
|
while ( ++u_n != sortedBaseNN.end() && !isNodeInSubMesh( u_n->second, faceSubMesh ));
|
||||||
sortedBaseNN.erase( sortedBaseNN.begin(), u_n );
|
sortedBaseNN.erase( sortedBaseNN.begin(), u_n );
|
||||||
}
|
}
|
||||||
else if ( u_n = --sortedBaseNN.end(), !isNodeInSubMesh( u_n->second, faceSubMesh ))
|
if ( u_n = --sortedBaseNN.end(), !isNodeInSubMesh( u_n->second, faceSubMesh ))
|
||||||
{
|
{
|
||||||
while ( u_n != sortedBaseNN.begin() && !isNodeInSubMesh( (--u_n)->second, faceSubMesh ));
|
while ( u_n != sortedBaseNN.begin() && !isNodeInSubMesh( (--u_n)->second, faceSubMesh ));
|
||||||
sortedBaseNN.erase( ++u_n, sortedBaseNN.end() );
|
sortedBaseNN.erase( ++u_n, sortedBaseNN.end() );
|
||||||
|
@ -1336,6 +1336,7 @@ bool SMESH_subMesh::ComputeStateEngine(int event)
|
|||||||
switch ( event ) {
|
switch ( event ) {
|
||||||
case MODIF_ALGO_STATE:
|
case MODIF_ALGO_STATE:
|
||||||
case COMPUTE:
|
case COMPUTE:
|
||||||
|
case COMPUTE_SUBMESH:
|
||||||
//case COMPUTE_CANCELED:
|
//case COMPUTE_CANCELED:
|
||||||
case CLEAN:
|
case CLEAN:
|
||||||
//case SUBMESH_COMPUTED:
|
//case SUBMESH_COMPUTED:
|
||||||
@ -1351,7 +1352,8 @@ bool SMESH_subMesh::ComputeStateEngine(int event)
|
|||||||
{
|
{
|
||||||
_computeState = READY_TO_COMPUTE;
|
_computeState = READY_TO_COMPUTE;
|
||||||
SMESHDS_SubMesh* smDS = GetSubMeshDS();
|
SMESHDS_SubMesh* smDS = GetSubMeshDS();
|
||||||
if ( smDS && smDS->NbNodes() ) {
|
if ( smDS && smDS->NbNodes() )
|
||||||
|
{
|
||||||
if ( event == CLEAN ) {
|
if ( event == CLEAN ) {
|
||||||
cleanDependants();
|
cleanDependants();
|
||||||
cleanSubMesh( this );
|
cleanSubMesh( this );
|
||||||
@ -1359,7 +1361,9 @@ bool SMESH_subMesh::ComputeStateEngine(int event)
|
|||||||
else
|
else
|
||||||
_computeState = COMPUTE_OK;
|
_computeState = COMPUTE_OK;
|
||||||
}
|
}
|
||||||
else if ( event == COMPUTE && !_alwaysComputed ) {
|
else if (( event == COMPUTE || event == COMPUTE_SUBMESH )
|
||||||
|
&& !_alwaysComputed )
|
||||||
|
{
|
||||||
const TopoDS_Vertex & V = TopoDS::Vertex( _subShape );
|
const TopoDS_Vertex & V = TopoDS::Vertex( _subShape );
|
||||||
gp_Pnt P = BRep_Tool::Pnt(V);
|
gp_Pnt P = BRep_Tool::Pnt(V);
|
||||||
if ( SMDS_MeshNode * n = _father->GetMeshDS()->AddNode(P.X(), P.Y(), P.Z()) ) {
|
if ( SMDS_MeshNode * n = _father->GetMeshDS()->AddNode(P.X(), P.Y(), P.Z()) ) {
|
||||||
@ -1393,11 +1397,10 @@ bool SMESH_subMesh::ComputeStateEngine(int event)
|
|||||||
_computeState = READY_TO_COMPUTE;
|
_computeState = READY_TO_COMPUTE;
|
||||||
break;
|
break;
|
||||||
case COMPUTE: // nothing to do
|
case COMPUTE: // nothing to do
|
||||||
|
case COMPUTE_SUBMESH:
|
||||||
break;
|
break;
|
||||||
#ifdef WITH_SMESH_CANCEL_COMPUTE
|
case COMPUTE_CANCELED: // nothing to do
|
||||||
case COMPUTE_CANCELED: // nothing to do
|
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
case CLEAN:
|
case CLEAN:
|
||||||
cleanDependants();
|
cleanDependants();
|
||||||
removeSubMeshElementsAndNodes();
|
removeSubMeshElementsAndNodes();
|
||||||
@ -1440,6 +1443,7 @@ bool SMESH_subMesh::ComputeStateEngine(int event)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case COMPUTE:
|
case COMPUTE:
|
||||||
|
case COMPUTE_SUBMESH:
|
||||||
{
|
{
|
||||||
algo = GetAlgo();
|
algo = GetAlgo();
|
||||||
ASSERT(algo);
|
ASSERT(algo);
|
||||||
@ -1455,10 +1459,16 @@ bool SMESH_subMesh::ComputeStateEngine(int event)
|
|||||||
// check submeshes needed
|
// check submeshes needed
|
||||||
if (_father->HasShapeToMesh() ) {
|
if (_father->HasShapeToMesh() ) {
|
||||||
bool subComputed = false, subFailed = false;
|
bool subComputed = false, subFailed = false;
|
||||||
if (!algo->OnlyUnaryInput())
|
if (!algo->OnlyUnaryInput()) {
|
||||||
shape = getCollection( gen, algo, subComputed, subFailed );
|
if ( event == COMPUTE &&
|
||||||
else
|
( algo->NeedDiscreteBoundary() || algo->SupportSubmeshes() ))
|
||||||
|
shape = getCollection( gen, algo, subComputed, subFailed );
|
||||||
|
else
|
||||||
|
subComputed = SubMeshesComputed( & subFailed );
|
||||||
|
}
|
||||||
|
else {
|
||||||
subComputed = SubMeshesComputed();
|
subComputed = SubMeshesComputed();
|
||||||
|
}
|
||||||
ret = ( algo->NeedDiscreteBoundary() ? subComputed :
|
ret = ( algo->NeedDiscreteBoundary() ? subComputed :
|
||||||
algo->SupportSubmeshes() ? !subFailed :
|
algo->SupportSubmeshes() ? !subFailed :
|
||||||
( !subComputed || _father->IsNotConformAllowed() ));
|
( !subComputed || _father->IsNotConformAllowed() ));
|
||||||
@ -1607,10 +1617,8 @@ bool SMESH_subMesh::ComputeStateEngine(int event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#ifdef WITH_SMESH_CANCEL_COMPUTE
|
|
||||||
case COMPUTE_CANCELED: // nothing to do
|
case COMPUTE_CANCELED: // nothing to do
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
case CLEAN:
|
case CLEAN:
|
||||||
cleanDependants();
|
cleanDependants();
|
||||||
removeSubMeshElementsAndNodes();
|
removeSubMeshElementsAndNodes();
|
||||||
@ -1664,10 +1672,8 @@ bool SMESH_subMesh::ComputeStateEngine(int event)
|
|||||||
break;
|
break;
|
||||||
case COMPUTE: // nothing to do
|
case COMPUTE: // nothing to do
|
||||||
break;
|
break;
|
||||||
#ifdef WITH_SMESH_CANCEL_COMPUTE
|
case COMPUTE_CANCELED: // nothing to do
|
||||||
case COMPUTE_CANCELED: // nothing to do
|
|
||||||
break;
|
break;
|
||||||
#endif
|
|
||||||
case CLEAN:
|
case CLEAN:
|
||||||
cleanDependants(); // clean sub-meshes, dependant on this one, with event CLEAN
|
cleanDependants(); // clean sub-meshes, dependant on this one, with event CLEAN
|
||||||
removeSubMeshElementsAndNodes();
|
removeSubMeshElementsAndNodes();
|
||||||
@ -1721,7 +1727,8 @@ bool SMESH_subMesh::ComputeStateEngine(int event)
|
|||||||
else
|
else
|
||||||
_computeState = NOT_READY;
|
_computeState = NOT_READY;
|
||||||
break;
|
break;
|
||||||
case COMPUTE: // nothing to do
|
case COMPUTE: // nothing to do
|
||||||
|
case COMPUTE_SUBMESH:
|
||||||
break;
|
break;
|
||||||
case COMPUTE_CANCELED:
|
case COMPUTE_CANCELED:
|
||||||
{
|
{
|
||||||
@ -2369,6 +2376,7 @@ void SMESH_subMeshEventListener::ProcessEvent(const int event,
|
|||||||
(*smIt)->ComputeStateEngine( event );
|
(*smIt)->ComputeStateEngine( event );
|
||||||
break;
|
break;
|
||||||
case SMESH_subMesh::COMPUTE:
|
case SMESH_subMesh::COMPUTE:
|
||||||
|
case SMESH_subMesh::COMPUTE_SUBMESH:
|
||||||
if ( subMesh->GetComputeState() == SMESH_subMesh::COMPUTE_OK )
|
if ( subMesh->GetComputeState() == SMESH_subMesh::COMPUTE_OK )
|
||||||
for ( ; smIt != smEnd; ++ smIt)
|
for ( ; smIt != smEnd; ++ smIt)
|
||||||
(*smIt)->ComputeStateEngine( SMESH_subMesh::SUBMESH_COMPUTED );
|
(*smIt)->ComputeStateEngine( SMESH_subMesh::SUBMESH_COMPUTED );
|
||||||
|
@ -107,7 +107,7 @@ class SMESH_EXPORT SMESH_subMesh
|
|||||||
};
|
};
|
||||||
enum compute_event
|
enum compute_event
|
||||||
{
|
{
|
||||||
MODIF_ALGO_STATE, COMPUTE, COMPUTE_CANCELED,
|
MODIF_ALGO_STATE, COMPUTE, COMPUTE_SUBMESH, COMPUTE_CANCELED,
|
||||||
CLEAN, SUBMESH_COMPUTED, SUBMESH_RESTORED, SUBMESH_LOADED,
|
CLEAN, SUBMESH_COMPUTED, SUBMESH_RESTORED, SUBMESH_LOADED,
|
||||||
MESH_ENTITY_REMOVED, CHECK_COMPUTE_STATE
|
MESH_ENTITY_REMOVED, CHECK_COMPUTE_STATE
|
||||||
};
|
};
|
||||||
|
@ -1800,6 +1800,15 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Call mesh->Clear() to prevent loading mesh from file caused by hypotheses removal
|
||||||
|
for( It.Initialize( selected ); It.More(); It.Next()) // loop on selected IO's
|
||||||
|
{
|
||||||
|
Handle(SALOME_InteractiveObject) IObject = It.Value();
|
||||||
|
SMESH::SMESH_Mesh_var mesh = SMESH::IObjectToInterface< SMESH::SMESH_Mesh >( IObject );
|
||||||
|
if ( !mesh->_is_nil() )
|
||||||
|
mesh->Clear();
|
||||||
|
}
|
||||||
|
|
||||||
// Treat SO's in the list starting from the back
|
// Treat SO's in the list starting from the back
|
||||||
aStudyBuilder->NewCommand(); // There is a transaction
|
aStudyBuilder->NewCommand(); // There is a transaction
|
||||||
for ( ritSO = listSO.rbegin(); ritSO != listSO.rend(); ++ritSO )
|
for ( ritSO = listSO.rbegin(); ritSO != listSO.rend(); ++ritSO )
|
||||||
|
@ -179,6 +179,24 @@ namespace {
|
|||||||
|
|
||||||
void CheckObjectPresence( const Handle(_pyCommand)& cmd, set<_pyID> & presentObjects)
|
void CheckObjectPresence( const Handle(_pyCommand)& cmd, set<_pyID> & presentObjects)
|
||||||
{
|
{
|
||||||
|
// either comment or erase a command including NotPublishedObjectName()
|
||||||
|
if ( cmd->GetString().Location( TPythonDump::NotPublishedObjectName(), 1, cmd->Length() ))
|
||||||
|
{
|
||||||
|
bool isResultPublished = false;
|
||||||
|
for ( int i = 0; i < cmd->GetNbResultValues(); i++ )
|
||||||
|
{
|
||||||
|
_pyID objID = cmd->GetResultValue( i+1 );
|
||||||
|
if ( cmd->IsStudyEntry( objID ))
|
||||||
|
isResultPublished = (! theGen->IsNotPublished( objID ));
|
||||||
|
theGen->ObjectCreationRemoved( objID ); // objID.SetName( name ) is not needed
|
||||||
|
}
|
||||||
|
if ( isResultPublished )
|
||||||
|
cmd->Comment();
|
||||||
|
else
|
||||||
|
cmd->Clear();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// comment a command having not created args
|
||||||
for ( int iArg = cmd->GetNbArgs(); iArg; --iArg )
|
for ( int iArg = cmd->GetNbArgs(); iArg; --iArg )
|
||||||
{
|
{
|
||||||
const _pyID& arg = cmd->GetArg( iArg );
|
const _pyID& arg = cmd->GetArg( iArg );
|
||||||
@ -192,14 +210,23 @@ namespace {
|
|||||||
cmd->Comment();
|
cmd->Comment();
|
||||||
cmd->GetString() += " ### " ;
|
cmd->GetString() += " ### " ;
|
||||||
cmd->GetString() += *id + " has not been yet created";
|
cmd->GetString() += *id + " has not been yet created";
|
||||||
|
for ( int i = 0; i < cmd->GetNbResultValues(); i++ ) {
|
||||||
|
_pyID objID = cmd->GetResultValue( i+1 );
|
||||||
|
theGen->ObjectCreationRemoved( objID ); // objID.SetName( name ) is not needed
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// comment a command having not created Object
|
||||||
const _pyID& obj = cmd->GetObject();
|
const _pyID& obj = cmd->GetObject();
|
||||||
if ( !obj.IsEmpty() && cmd->IsStudyEntry( obj ) && !presentObjects.count( obj ))
|
if ( !obj.IsEmpty() && cmd->IsStudyEntry( obj ) && !presentObjects.count( obj ))
|
||||||
{
|
{
|
||||||
cmd->Comment();
|
cmd->Comment();
|
||||||
cmd->GetString() += " ### not created object" ;
|
cmd->GetString() += " ### not created object" ;
|
||||||
|
for ( int i = 0; i < cmd->GetNbResultValues(); i++ ) {
|
||||||
|
_pyID objID = cmd->GetResultValue( i+1 );
|
||||||
|
theGen->ObjectCreationRemoved( objID ); // objID.SetName( name ) is not needed
|
||||||
|
}
|
||||||
}
|
}
|
||||||
const _pyID& result = cmd->GetResultValue();
|
const _pyID& result = cmd->GetResultValue();
|
||||||
if ( result.IsEmpty() || result.Value( 1 ) == '"' || result.Value( 1 ) == '\'' )
|
if ( result.IsEmpty() || result.Value( 1 ) == '"' || result.Value( 1 ) == '\'' )
|
||||||
@ -318,13 +345,15 @@ namespace {
|
|||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
/*!
|
/*!
|
||||||
* \brief Convert python script using commands of smeshBuilder.py
|
* \brief Convert a python script using commands of smeshBuilder.py
|
||||||
* \param theScript - Input script
|
* \param theScript - Input script
|
||||||
* \retval TCollection_AsciiString - Convertion result
|
* \param theEntry2AccessorMethod - returns method names to access to
|
||||||
* \param theToKeepAllCommands - to keep all commands or
|
* objects wrapped with python class
|
||||||
* to exclude commands relating to objects removed from study
|
* \param theObjectNames - names of objects
|
||||||
*
|
* \param theRemovedObjIDs - entries of objects whose created commands were removed
|
||||||
* Class SMESH_2smeshpy declared in SMESH_PythonDump.hxx
|
* \param theHistoricalDump - true means to keep all commands, false means
|
||||||
|
* to exclude commands relating to objects removed from study
|
||||||
|
* \retval TCollection_AsciiString - Convertion result
|
||||||
*/
|
*/
|
||||||
//================================================================================
|
//================================================================================
|
||||||
|
|
||||||
@ -332,10 +361,15 @@ TCollection_AsciiString
|
|||||||
SMESH_2smeshpy::ConvertScript(const TCollection_AsciiString& theScript,
|
SMESH_2smeshpy::ConvertScript(const TCollection_AsciiString& theScript,
|
||||||
Resource_DataMapOfAsciiStringAsciiString& theEntry2AccessorMethod,
|
Resource_DataMapOfAsciiStringAsciiString& theEntry2AccessorMethod,
|
||||||
Resource_DataMapOfAsciiStringAsciiString& theObjectNames,
|
Resource_DataMapOfAsciiStringAsciiString& theObjectNames,
|
||||||
|
std::set< TCollection_AsciiString >& theRemovedObjIDs,
|
||||||
SALOMEDS::Study_ptr& theStudy,
|
SALOMEDS::Study_ptr& theStudy,
|
||||||
const bool theToKeepAllCommands)
|
const bool theToKeepAllCommands)
|
||||||
{
|
{
|
||||||
theGen = new _pyGen( theEntry2AccessorMethod, theObjectNames, theStudy, theToKeepAllCommands );
|
theGen = new _pyGen( theEntry2AccessorMethod,
|
||||||
|
theObjectNames,
|
||||||
|
theRemovedObjIDs,
|
||||||
|
theStudy,
|
||||||
|
theToKeepAllCommands );
|
||||||
|
|
||||||
// split theScript into separate commands
|
// split theScript into separate commands
|
||||||
|
|
||||||
@ -345,9 +379,9 @@ SMESH_2smeshpy::ConvertScript(const TCollection_AsciiString& theScrip
|
|||||||
while ( from < end && ( to = theScript.Location( "\n", from, end )))
|
while ( from < end && ( to = theScript.Location( "\n", from, end )))
|
||||||
{
|
{
|
||||||
if ( to != from )
|
if ( to != from )
|
||||||
// cut out and store a command
|
// cut out and store a command
|
||||||
aNoteBook->AddCommand( theScript.SubString( from, to - 1 ));
|
aNoteBook->AddCommand( theScript.SubString( from, to - 1 ));
|
||||||
from = to + 1;
|
from = to + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
aNoteBook->ReplaceVariables();
|
aNoteBook->ReplaceVariables();
|
||||||
@ -416,12 +450,14 @@ SMESH_2smeshpy::ConvertScript(const TCollection_AsciiString& theScrip
|
|||||||
|
|
||||||
_pyGen::_pyGen(Resource_DataMapOfAsciiStringAsciiString& theEntry2AccessorMethod,
|
_pyGen::_pyGen(Resource_DataMapOfAsciiStringAsciiString& theEntry2AccessorMethod,
|
||||||
Resource_DataMapOfAsciiStringAsciiString& theObjectNames,
|
Resource_DataMapOfAsciiStringAsciiString& theObjectNames,
|
||||||
|
std::set< TCollection_AsciiString >& theRemovedObjIDs,
|
||||||
SALOMEDS::Study_ptr& theStudy,
|
SALOMEDS::Study_ptr& theStudy,
|
||||||
const bool theToKeepAllCommands)
|
const bool theToKeepAllCommands)
|
||||||
: _pyObject( new _pyCommand( "", 0 )),
|
: _pyObject( new _pyCommand( "", 0 )),
|
||||||
myNbCommands( 0 ),
|
myNbCommands( 0 ),
|
||||||
myID2AccessorMethod( theEntry2AccessorMethod ),
|
myID2AccessorMethod( theEntry2AccessorMethod ),
|
||||||
myObjectNames( theObjectNames ),
|
myObjectNames( theObjectNames ),
|
||||||
|
myRemovedObjIDs( theRemovedObjIDs ),
|
||||||
myNbFilters( 0 ),
|
myNbFilters( 0 ),
|
||||||
myToKeepAllCommands( theToKeepAllCommands ),
|
myToKeepAllCommands( theToKeepAllCommands ),
|
||||||
myStudy( SALOMEDS::Study::_duplicate( theStudy )),
|
myStudy( SALOMEDS::Study::_duplicate( theStudy )),
|
||||||
@ -787,7 +823,7 @@ void _pyGen::Process( const Handle(_pyCommand)& theCommand )
|
|||||||
method == "CreateMeshesFromSAUV"||
|
method == "CreateMeshesFromSAUV"||
|
||||||
method == "CreateMeshesFromGMF" )
|
method == "CreateMeshesFromGMF" )
|
||||||
{
|
{
|
||||||
for(int ind = 0;ind<theCommand->GetNbResultValues();ind++)
|
for ( int ind = 0; ind < theCommand->GetNbResultValues(); ind++ )
|
||||||
{
|
{
|
||||||
_pyID meshID = theCommand->GetResultValue(ind+1);
|
_pyID meshID = theCommand->GetResultValue(ind+1);
|
||||||
if ( !theCommand->IsStudyEntry( meshID ) ) continue;
|
if ( !theCommand->IsStudyEntry( meshID ) ) continue;
|
||||||
@ -1368,6 +1404,19 @@ bool _pyGen::IsNotPublished(const _pyID& theObjID) const
|
|||||||
return true; // SMESH object not in study
|
return true; // SMESH object not in study
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//================================================================================
|
||||||
|
/*!
|
||||||
|
* \brief Remove object name from myObjectNames that leads to that SetName() for
|
||||||
|
* this object is not dumped
|
||||||
|
* \param [in] theObjID - entry of the object whose creation command was eliminated
|
||||||
|
*/
|
||||||
|
//================================================================================
|
||||||
|
|
||||||
|
void _pyGen::ObjectCreationRemoved(const _pyID& theObjID)
|
||||||
|
{
|
||||||
|
myRemovedObjIDs.insert( theObjID );
|
||||||
|
}
|
||||||
|
|
||||||
//================================================================================
|
//================================================================================
|
||||||
/*!
|
/*!
|
||||||
* \brief Return reader of hypotheses of plugins
|
* \brief Return reader of hypotheses of plugins
|
||||||
@ -3184,22 +3233,21 @@ const TCollection_AsciiString & _pyCommand::GetResultValue()
|
|||||||
//================================================================================
|
//================================================================================
|
||||||
/*!
|
/*!
|
||||||
* \brief Return number of python command result value ResultValue = Obj.Meth()
|
* \brief Return number of python command result value ResultValue = Obj.Meth()
|
||||||
* \retval const int
|
|
||||||
*/
|
*/
|
||||||
//================================================================================
|
//================================================================================
|
||||||
|
|
||||||
const int _pyCommand::GetNbResultValues()
|
int _pyCommand::GetNbResultValues()
|
||||||
{
|
{
|
||||||
|
int nb = 0;
|
||||||
int begPos = 1;
|
int begPos = 1;
|
||||||
int Nb=0;
|
|
||||||
int endPos = myString.Location( "=", 1, Length() );
|
int endPos = myString.Location( "=", 1, Length() );
|
||||||
TCollection_AsciiString str = "";
|
while ( begPos < endPos )
|
||||||
while ( begPos < endPos) {
|
{
|
||||||
str = GetWord( myString, begPos, true );
|
_AString str = GetWord( myString, begPos, true );
|
||||||
begPos = begPos+ str.Length();
|
begPos = begPos+ str.Length();
|
||||||
Nb++;
|
nb++;
|
||||||
}
|
}
|
||||||
return (Nb-1);
|
return (nb-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ public:
|
|||||||
bool IsEmpty() const { return myString.IsEmpty(); }
|
bool IsEmpty() const { return myString.IsEmpty(); }
|
||||||
_AString GetIndentation();
|
_AString GetIndentation();
|
||||||
const _AString & GetResultValue();
|
const _AString & GetResultValue();
|
||||||
const int GetNbResultValues();
|
int GetNbResultValues();
|
||||||
_AString GetResultValue(int res);
|
_AString GetResultValue(int res);
|
||||||
const _AString & GetObject();
|
const _AString & GetObject();
|
||||||
const _AString & GetMethod();
|
const _AString & GetMethod();
|
||||||
@ -223,6 +223,7 @@ class _pyGen: public _pyObject
|
|||||||
public:
|
public:
|
||||||
_pyGen(Resource_DataMapOfAsciiStringAsciiString& theEntry2AccessorMethod,
|
_pyGen(Resource_DataMapOfAsciiStringAsciiString& theEntry2AccessorMethod,
|
||||||
Resource_DataMapOfAsciiStringAsciiString& theObjectNames,
|
Resource_DataMapOfAsciiStringAsciiString& theObjectNames,
|
||||||
|
std::set< TCollection_AsciiString >& theRemovedObjIDs,
|
||||||
SALOMEDS::Study_ptr& theStudy,
|
SALOMEDS::Study_ptr& theStudy,
|
||||||
const bool theToKeepAllCommands);
|
const bool theToKeepAllCommands);
|
||||||
Handle(_pyCommand) AddCommand( const _AString& theCommand );
|
Handle(_pyCommand) AddCommand( const _AString& theCommand );
|
||||||
@ -236,8 +237,8 @@ public:
|
|||||||
_pyID GenerateNewID( const _pyID& theID );
|
_pyID GenerateNewID( const _pyID& theID );
|
||||||
void AddObject( Handle(_pyObject)& theObj );
|
void AddObject( Handle(_pyObject)& theObj );
|
||||||
void SetProxyObject( const _pyID& theID, Handle(_pyObject)& theObj );
|
void SetProxyObject( const _pyID& theID, Handle(_pyObject)& theObj );
|
||||||
Handle(_pyObject) FindObject( const _pyID& theObjID ) const;
|
Handle(_pyObject) FindObject( const _pyID& theObjID ) const;
|
||||||
Handle(_pySubMesh) FindSubMesh( const _pyID& theSubMeshID );
|
Handle(_pySubMesh) FindSubMesh( const _pyID& theSubMeshID );
|
||||||
Handle(_pyHypothesis) FindHyp( const _pyID& theHypID );
|
Handle(_pyHypothesis) FindHyp( const _pyID& theHypID );
|
||||||
Handle(_pyHypothesis) FindAlgo( const _pyID& theGeom, const _pyID& theMesh,
|
Handle(_pyHypothesis) FindAlgo( const _pyID& theGeom, const _pyID& theMesh,
|
||||||
const Handle(_pyHypothesis)& theHypothesis);
|
const Handle(_pyHypothesis)& theHypothesis);
|
||||||
@ -249,6 +250,7 @@ public:
|
|||||||
|
|
||||||
bool IsGeomObject(const _pyID& theObjID) const;
|
bool IsGeomObject(const _pyID& theObjID) const;
|
||||||
bool IsNotPublished(const _pyID& theObjID) const;
|
bool IsNotPublished(const _pyID& theObjID) const;
|
||||||
|
void ObjectCreationRemoved(const _pyID& theObjID);
|
||||||
bool IsToKeepAllCommands() const { return myToKeepAllCommands; }
|
bool IsToKeepAllCommands() const { return myToKeepAllCommands; }
|
||||||
void AddExportedMesh(const _AString& file, const ExportedMeshData& mesh )
|
void AddExportedMesh(const _AString& file, const ExportedMeshData& mesh )
|
||||||
{ myFile2ExportedMesh[ file ] = mesh; }
|
{ myFile2ExportedMesh[ file ] = mesh; }
|
||||||
@ -268,21 +270,22 @@ private:
|
|||||||
const bool theIsAfter );
|
const bool theIsAfter );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::map< _pyID, Handle(_pyMesh) > myMeshes;
|
std::map< _pyID, Handle(_pyMesh) > myMeshes;
|
||||||
std::map< _pyID, Handle(_pyMeshEditor) > myMeshEditors;
|
std::map< _pyID, Handle(_pyMeshEditor) > myMeshEditors;
|
||||||
std::map< _pyID, Handle(_pyObject) > myObjects;
|
std::map< _pyID, Handle(_pyObject) > myObjects;
|
||||||
std::list< Handle(_pyHypothesis) > myHypos;
|
std::list< Handle(_pyHypothesis) > myHypos;
|
||||||
std::list< Handle(_pyCommand) > myCommands;
|
std::list< Handle(_pyCommand) > myCommands;
|
||||||
int myNbCommands;
|
int myNbCommands;
|
||||||
Resource_DataMapOfAsciiStringAsciiString& myID2AccessorMethod;
|
Resource_DataMapOfAsciiStringAsciiString& myID2AccessorMethod;
|
||||||
Resource_DataMapOfAsciiStringAsciiString& myObjectNames;
|
Resource_DataMapOfAsciiStringAsciiString& myObjectNames;
|
||||||
Handle(_pyCommand) myLastCommand;
|
std::set< TCollection_AsciiString >& myRemovedObjIDs;
|
||||||
int myNbFilters;
|
Handle(_pyCommand) myLastCommand;
|
||||||
bool myToKeepAllCommands;
|
int myNbFilters;
|
||||||
SALOMEDS::Study_var myStudy;
|
bool myToKeepAllCommands;
|
||||||
int myGeomIDNb, myGeomIDIndex;
|
SALOMEDS::Study_var myStudy;
|
||||||
std::map< _AString, ExportedMeshData > myFile2ExportedMesh;
|
int myGeomIDNb, myGeomIDIndex;
|
||||||
Handle( _pyHypothesisReader ) myHypReader;
|
std::map< _AString, ExportedMeshData > myFile2ExportedMesh;
|
||||||
|
Handle( _pyHypothesisReader ) myHypReader;
|
||||||
|
|
||||||
DEFINE_STANDARD_RTTI (_pyGen)
|
DEFINE_STANDARD_RTTI (_pyGen)
|
||||||
};
|
};
|
||||||
|
@ -43,15 +43,11 @@ static int MYDEBUG = 0;
|
|||||||
static int MYDEBUG = 0;
|
static int MYDEBUG = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static TCollection_AsciiString NotPublishedObjectName()
|
|
||||||
{
|
|
||||||
return "__NOT__Published__Object__";
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace SMESH
|
namespace SMESH
|
||||||
{
|
{
|
||||||
|
|
||||||
size_t TPythonDump::myCounter = 0;
|
size_t TPythonDump::myCounter = 0;
|
||||||
|
const char theNotPublishedObjectName[] = "__NOT__Published__Object__";
|
||||||
|
|
||||||
TVar::TVar(CORBA::Double value):myVals(1) { myVals[0] = SMESH_Comment(value); }
|
TVar::TVar(CORBA::Double value):myVals(1) { myVals[0] = SMESH_Comment(value); }
|
||||||
TVar::TVar(CORBA::Long value):myVals(1) { myVals[0] = SMESH_Comment(value); }
|
TVar::TVar(CORBA::Long value):myVals(1) { myVals[0] = SMESH_Comment(value); }
|
||||||
@ -279,7 +275,7 @@ namespace SMESH
|
|||||||
myStream << entry.in();
|
myStream << entry.in();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
myStream << NotPublishedObjectName();
|
myStream << theNotPublishedObjectName;
|
||||||
}
|
}
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
@ -298,7 +294,7 @@ namespace SMESH
|
|||||||
if ( aSMESHGen->CanPublishInStudy( theArg )) // not published SMESH object
|
if ( aSMESHGen->CanPublishInStudy( theArg )) // not published SMESH object
|
||||||
myStream << "smeshObj_" << size_t(theArg);
|
myStream << "smeshObj_" << size_t(theArg);
|
||||||
else
|
else
|
||||||
myStream << NotPublishedObjectName();
|
myStream << theNotPublishedObjectName;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
myStream << "None";
|
myStream << "None";
|
||||||
@ -343,7 +339,7 @@ namespace SMESH
|
|||||||
SMESH::ElementType type = types->length() ? types[0] : SMESH::ALL;
|
SMESH::ElementType type = types->length() ? types[0] : SMESH::ALL;
|
||||||
return *this << mesh << ".GetIDSource(" << anElementsId << ", " << type << ")";
|
return *this << mesh << ".GetIDSource(" << anElementsId << ", " << type << ")";
|
||||||
}
|
}
|
||||||
return *this;
|
return *this << theNotPublishedObjectName;
|
||||||
}
|
}
|
||||||
|
|
||||||
TPythonDump&
|
TPythonDump&
|
||||||
@ -505,6 +501,10 @@ namespace SMESH
|
|||||||
DumpArray( theList, *this );
|
DumpArray( theList, *this );
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
const char* TPythonDump::NotPublishedObjectName()
|
||||||
|
{
|
||||||
|
return theNotPublishedObjectName;
|
||||||
|
}
|
||||||
|
|
||||||
TCollection_AsciiString myLongStringStart( "TPythonDump::LongStringStart" );
|
TCollection_AsciiString myLongStringStart( "TPythonDump::LongStringStart" );
|
||||||
TCollection_AsciiString myLongStringEnd ( "TPythonDump::LongStringEnd" );
|
TCollection_AsciiString myLongStringEnd ( "TPythonDump::LongStringEnd" );
|
||||||
@ -679,7 +679,7 @@ Engines::TMPFile* SMESH_Gen_i::DumpPython (CORBA::Object_ptr theStudy,
|
|||||||
CORBA::Octet* anOctetBuf = (CORBA::Octet*)aBuffer;
|
CORBA::Octet* anOctetBuf = (CORBA::Octet*)aBuffer;
|
||||||
Engines::TMPFile_var aStreamFile = new Engines::TMPFile(aLen+1, aLen+1, anOctetBuf, 1);
|
Engines::TMPFile_var aStreamFile = new Engines::TMPFile(aLen+1, aLen+1, anOctetBuf, 1);
|
||||||
|
|
||||||
bool hasNotPublishedObjects = aScript.Location( NotPublishedObjectName(), 1, aLen);
|
bool hasNotPublishedObjects = aScript.Location( SMESH::theNotPublishedObjectName, 1, aLen);
|
||||||
isValidScript = isValidScript && !hasNotPublishedObjects;
|
isValidScript = isValidScript && !hasNotPublishedObjects;
|
||||||
|
|
||||||
return aStreamFile._retn();
|
return aStreamFile._retn();
|
||||||
@ -915,9 +915,11 @@ TCollection_AsciiString SMESH_Gen_i::DumpPython_impl
|
|||||||
// Some objects are wrapped with python classes and
|
// Some objects are wrapped with python classes and
|
||||||
// Resource_DataMapOfAsciiStringAsciiString holds methods returning wrapped objects
|
// Resource_DataMapOfAsciiStringAsciiString holds methods returning wrapped objects
|
||||||
Resource_DataMapOfAsciiStringAsciiString anEntry2AccessorMethod;
|
Resource_DataMapOfAsciiStringAsciiString anEntry2AccessorMethod;
|
||||||
|
std::set< TCollection_AsciiString > aRemovedObjIDs;
|
||||||
if ( !getenv("NO_2smeshpy_conversion"))
|
if ( !getenv("NO_2smeshpy_conversion"))
|
||||||
aScript = SMESH_2smeshpy::ConvertScript( aScript, anEntry2AccessorMethod,
|
aScript = SMESH_2smeshpy::ConvertScript( aScript, anEntry2AccessorMethod,
|
||||||
theObjectNames, theStudy, isHistoricalDump );
|
theObjectNames, aRemovedObjIDs,
|
||||||
|
theStudy, isHistoricalDump );
|
||||||
|
|
||||||
// Replace characters used instead of quote marks to quote notebook variables
|
// Replace characters used instead of quote marks to quote notebook variables
|
||||||
{
|
{
|
||||||
@ -1018,6 +1020,7 @@ TCollection_AsciiString SMESH_Gen_i::DumpPython_impl
|
|||||||
anUpdatedScript += "\n\taStudyBuilder = theStudy.NewBuilder()";
|
anUpdatedScript += "\n\taStudyBuilder = theStudy.NewBuilder()";
|
||||||
}
|
}
|
||||||
for (int ir = 1; ir <= seqRemoved.Length(); ir++) {
|
for (int ir = 1; ir <= seqRemoved.Length(); ir++) {
|
||||||
|
if ( aRemovedObjIDs.count( seqRemoved.Value(ir) )) continue;
|
||||||
anUpdatedScript += "\n\tSO = theStudy.FindObjectIOR(theStudy.ConvertObjectToIOR(";
|
anUpdatedScript += "\n\tSO = theStudy.FindObjectIOR(theStudy.ConvertObjectToIOR(";
|
||||||
anUpdatedScript += seqRemoved.Value(ir);
|
anUpdatedScript += seqRemoved.Value(ir);
|
||||||
// for object wrapped by class of smeshBuilder.py
|
// for object wrapped by class of smeshBuilder.py
|
||||||
@ -1038,13 +1041,14 @@ TCollection_AsciiString SMESH_Gen_i::DumpPython_impl
|
|||||||
for (Standard_Integer i = 1; i <= aLen; i += 2)
|
for (Standard_Integer i = 1; i <= aLen; i += 2)
|
||||||
{
|
{
|
||||||
anEntry = aScript.SubString(aSeq->Value(i), aSeq->Value(i + 1));
|
anEntry = aScript.SubString(aSeq->Value(i), aSeq->Value(i + 1));
|
||||||
aName = geom->GetDumpName( anEntry.ToCString() );
|
aName = geom->GetDumpName( anEntry.ToCString() );
|
||||||
if (aName.IsEmpty() && // Not a GEOM object
|
if (aName.IsEmpty() && // Not a GEOM object
|
||||||
theNames.IsBound(anEntry) &&
|
theNames.IsBound(anEntry) &&
|
||||||
|
!aRemovedObjIDs.count(anEntry) && // a command creating anEntry was erased
|
||||||
!mapEntries.IsBound(anEntry) && // Not yet processed
|
!mapEntries.IsBound(anEntry) && // Not yet processed
|
||||||
!mapRemoved.IsBound(anEntry)) // Was not removed
|
!mapRemoved.IsBound(anEntry)) // Was not removed
|
||||||
{
|
{
|
||||||
aName = theObjectNames.Find(anEntry);
|
aName = theObjectNames.Find(anEntry);
|
||||||
aGUIName = theNames.Find(anEntry);
|
aGUIName = theNames.Find(anEntry);
|
||||||
mapEntries.Bind(anEntry, aName);
|
mapEntries.Bind(anEntry, aName);
|
||||||
anUpdatedScript += helper + "\n\t" + aSMESHGen + ".SetName(" + aName;
|
anUpdatedScript += helper + "\n\t" + aSMESHGen + ".SetName(" + aName;
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <set>
|
||||||
|
|
||||||
class SMESH_Gen_i;
|
class SMESH_Gen_i;
|
||||||
class SMESH_MeshEditor_i;
|
class SMESH_MeshEditor_i;
|
||||||
@ -51,8 +52,10 @@ public:
|
|||||||
/*!
|
/*!
|
||||||
* \brief Convert a python script using commands of smeshBuilder.py
|
* \brief Convert a python script using commands of smeshBuilder.py
|
||||||
* \param theScript - Input script
|
* \param theScript - Input script
|
||||||
* \param theEntry2AccessorMethod - The returning method names to access to
|
* \param theEntry2AccessorMethod - returns method names to access to
|
||||||
* objects wrapped with python class
|
* objects wrapped with python class
|
||||||
|
* \param theObjectNames - names of objects
|
||||||
|
* \param theRemovedObjIDs - entries of objects whose created commands were removed
|
||||||
* \param theHistoricalDump - true means to keep all commands, false means
|
* \param theHistoricalDump - true means to keep all commands, false means
|
||||||
* to exclude commands relating to objects removed from study
|
* to exclude commands relating to objects removed from study
|
||||||
* \retval TCollection_AsciiString - Convertion result
|
* \retval TCollection_AsciiString - Convertion result
|
||||||
@ -61,6 +64,7 @@ public:
|
|||||||
ConvertScript(const TCollection_AsciiString& theScript,
|
ConvertScript(const TCollection_AsciiString& theScript,
|
||||||
Resource_DataMapOfAsciiStringAsciiString& theEntry2AccessorMethod,
|
Resource_DataMapOfAsciiStringAsciiString& theEntry2AccessorMethod,
|
||||||
Resource_DataMapOfAsciiStringAsciiString& theObjectNames,
|
Resource_DataMapOfAsciiStringAsciiString& theObjectNames,
|
||||||
|
std::set< TCollection_AsciiString >& theRemovedObjIDs,
|
||||||
SALOMEDS::Study_ptr& theStudy,
|
SALOMEDS::Study_ptr& theStudy,
|
||||||
const bool theHistoricalDump);
|
const bool theHistoricalDump);
|
||||||
|
|
||||||
@ -213,6 +217,7 @@ namespace SMESH
|
|||||||
|
|
||||||
static const char* SMESHGenName() { return "smeshgen"; }
|
static const char* SMESHGenName() { return "smeshgen"; }
|
||||||
static const char* MeshEditorName() { return "mesh_editor"; }
|
static const char* MeshEditorName() { return "mesh_editor"; }
|
||||||
|
static const char* NotPublishedObjectName();
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Return marker of long string literal beginning
|
* \brief Return marker of long string literal beginning
|
||||||
|
@ -71,6 +71,7 @@ class Mesh_Algorithm:
|
|||||||
# @return SMESH.SMESH_Hypothesis
|
# @return SMESH.SMESH_Hypothesis
|
||||||
def FindHypothesis (self, hypname, args, CompareMethod, smeshpyD):
|
def FindHypothesis (self, hypname, args, CompareMethod, smeshpyD):
|
||||||
study = smeshpyD.GetCurrentStudy()
|
study = smeshpyD.GetCurrentStudy()
|
||||||
|
if not study: return None
|
||||||
#to do: find component by smeshpyD object, not by its data type
|
#to do: find component by smeshpyD object, not by its data type
|
||||||
scomp = study.FindComponent(smeshpyD.ComponentDataType())
|
scomp = study.FindComponent(smeshpyD.ComponentDataType())
|
||||||
if scomp is not None:
|
if scomp is not None:
|
||||||
|
@ -119,15 +119,42 @@ namespace {
|
|||||||
|
|
||||||
const double a14divPI = 14. / M_PI;
|
const double a14divPI = 14. / M_PI;
|
||||||
|
|
||||||
|
|
||||||
inline double segLength(double S0, double edgeLen, double minLen )
|
inline double segLength(double S0, double edgeLen, double minLen )
|
||||||
{
|
{
|
||||||
// PAL10237
|
// PAL10237
|
||||||
// S = S0 * f(L/Lmin) where f(x) = 1 + (2/Pi * 7 * atan(x/5) )
|
// S = S0 * f(L/Lmin) where f(x) = 1 + (2/Pi * 7 * atan(x/5) )
|
||||||
|
|
||||||
// =>
|
// =>
|
||||||
// S = S0 * ( 1 + 14/PI * atan( L / ( 5 * Lmin )))
|
// S = S0 * ( 1 + 14/PI * atan( L / ( 5 * Lmin )))
|
||||||
return S0 * ( 1. + a14divPI * atan( edgeLen / ( 5 * minLen )));
|
return S0 * ( 1. + a14divPI * atan( edgeLen / ( 5 * minLen )));
|
||||||
}
|
}
|
||||||
|
#if 0
|
||||||
|
//const double a14divPI = 14. / M_PI;
|
||||||
|
const double a2div7divPI = 2. / 7. / M_PI;
|
||||||
|
|
||||||
|
inline double segLength(double S0, double edgeLen, double minLen )
|
||||||
|
{
|
||||||
|
// PAL10237
|
||||||
|
// S = S0 * f(L/Lmin) where
|
||||||
|
// f(x) = 1 + (7 * 2/Pi * atan(x/5))
|
||||||
|
// =>
|
||||||
|
// S = S0 * ( 1 + 14/PI * atan( L / ( 5 * Lmin )))
|
||||||
|
//
|
||||||
|
// return S0 * ( 1. + a14divPI * atan( edgeLen / ( 5 * minLen )));
|
||||||
|
|
||||||
|
// The above formular gives too short segments when Lmax/Lmin is too high
|
||||||
|
// because by this formular the largest segment is only 8 times longer than the
|
||||||
|
// shortest one ( 2/Pi * atan(x/5) varies within [0,1] ). So a new formular is:
|
||||||
|
//
|
||||||
|
// f(x) = 1 + (x/7 * 2/Pi * atan(x/5))
|
||||||
|
// =>
|
||||||
|
// S = S0 * ( 1 + 2/7/PI * L/Lmin * atan( 5 * L/Lmin ))
|
||||||
|
//
|
||||||
|
const double Lratio = edgeLen / minLen;
|
||||||
|
return S0 * ( 1. + a2div7divPI * Lratio * atan( 5 * Lratio ));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
//================================================================================
|
//================================================================================
|
||||||
/*!
|
/*!
|
||||||
* \brief Compute segment length for all edges
|
* \brief Compute segment length for all edges
|
||||||
@ -164,22 +191,22 @@ namespace {
|
|||||||
theTShapeToLengthMap.insert( make_pair( getTShape( edge ), L ));
|
theTShapeToLengthMap.insert( make_pair( getTShape( edge ), L ));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compute S0
|
// Compute S0 - minimal segement length, is computed by the shortest EDGE
|
||||||
|
|
||||||
// image attached to PAL10237
|
/* image attached to PAL10237
|
||||||
|
|
||||||
// NbSeg
|
|
||||||
// ^
|
|
||||||
// |
|
|
||||||
// 10|\
|
|
||||||
// | \
|
|
||||||
// | \
|
|
||||||
// | \
|
|
||||||
// 5| --------
|
|
||||||
// |
|
|
||||||
// +------------>
|
|
||||||
// 1 10 Lmax/Lmin
|
|
||||||
|
|
||||||
|
NbSeg (on the shortest EDGE)
|
||||||
|
^
|
||||||
|
|
|
||||||
|
10|\
|
||||||
|
| \
|
||||||
|
| \
|
||||||
|
| \
|
||||||
|
5| --------
|
||||||
|
|
|
||||||
|
+------------>
|
||||||
|
1 10 Lmax/Lmin
|
||||||
|
*/
|
||||||
const int NbSegMin = 5, NbSegMax = 10; // on axis NbSeg
|
const int NbSegMin = 5, NbSegMax = 10; // on axis NbSeg
|
||||||
const double Lrat1 = 1., Lrat2 = 10.; // on axis Lmax/Lmin
|
const double Lrat1 = 1., Lrat2 = 10.; // on axis Lmax/Lmin
|
||||||
|
|
||||||
@ -192,6 +219,7 @@ namespace {
|
|||||||
MESSAGE( "S0 = " << S0 << ", Lmin = " << Lmin << ", Nbseg = " << (int) NbSeg);
|
MESSAGE( "S0 = " << S0 << ", Lmin = " << Lmin << ", Nbseg = " << (int) NbSeg);
|
||||||
|
|
||||||
// Compute segments length for all edges
|
// Compute segments length for all edges
|
||||||
|
|
||||||
map<const TopoDS_TShape*, double>::iterator tshape_length = theTShapeToLengthMap.begin();
|
map<const TopoDS_TShape*, double>::iterator tshape_length = theTShapeToLengthMap.begin();
|
||||||
for ( ; tshape_length != theTShapeToLengthMap.end(); ++tshape_length )
|
for ( ; tshape_length != theTShapeToLengthMap.end(); ++tshape_length )
|
||||||
{
|
{
|
||||||
|
@ -68,6 +68,11 @@ using namespace std;
|
|||||||
// gp_Pnt p (xyz); \
|
// gp_Pnt p (xyz); \
|
||||||
// cout << msg << " ("<< p.X() << "; " <<p.Y() << "; " <<p.Z() << ") " <<endl;\
|
// cout << msg << " ("<< p.X() << "; " <<p.Y() << "; " <<p.Z() << ") " <<endl;\
|
||||||
// }
|
// }
|
||||||
|
#ifdef _DEBUG_
|
||||||
|
#define DBGOUT(msg) //cout << msg << endl;
|
||||||
|
#else
|
||||||
|
#define DBGOUT(msg)
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace TAssocTool = StdMeshers_ProjectionUtils;
|
namespace TAssocTool = StdMeshers_ProjectionUtils;
|
||||||
|
|
||||||
@ -464,6 +469,7 @@ bool StdMeshers_Prism_3D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape& theSh
|
|||||||
// look for meshed FACEs ("source" FACEs) that must be prism bottoms
|
// look for meshed FACEs ("source" FACEs) that must be prism bottoms
|
||||||
list< TopoDS_Face > meshedFaces, notQuadMeshedFaces, notQuadFaces;
|
list< TopoDS_Face > meshedFaces, notQuadMeshedFaces, notQuadFaces;
|
||||||
const bool meshHasQuads = ( theMesh.NbQuadrangles() > 0 );
|
const bool meshHasQuads = ( theMesh.NbQuadrangles() > 0 );
|
||||||
|
//StdMeshers_Quadrangle_2D* quadAlgo = TQuadrangleAlgo::instance( this );
|
||||||
for ( int iF = 1; iF < faceToSolids.Extent(); ++iF )
|
for ( int iF = 1; iF < faceToSolids.Extent(); ++iF )
|
||||||
{
|
{
|
||||||
const TopoDS_Face& face = TopoDS::Face( faceToSolids.FindKey( iF ));
|
const TopoDS_Face& face = TopoDS::Face( faceToSolids.FindKey( iF ));
|
||||||
@ -480,10 +486,13 @@ bool StdMeshers_Prism_3D::Compute(SMESH_Mesh& theMesh, const TopoDS_Shape& theSh
|
|||||||
else
|
else
|
||||||
meshedFaces.push_back( face );
|
meshedFaces.push_back( face );
|
||||||
}
|
}
|
||||||
else if ( myHelper->Count( face, TopAbs_EDGE, /*ignoreSame=*/false ) != 4 )
|
// not add not quadrilateral FACE as we can't compute it
|
||||||
{
|
// else if ( !quadAlgo->CheckNbEdges( theMesh, face ))
|
||||||
notQuadFaces.push_back( face );
|
// // not add not quadrilateral FACE as it can be a prism side
|
||||||
}
|
// // else if ( myHelper->Count( face, TopAbs_EDGE, /*ignoreSame=*/false ) != 4 )
|
||||||
|
// {
|
||||||
|
// notQuadFaces.push_back( face );
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
// notQuadFaces are of medium priority, put them before ordinary meshed faces
|
// notQuadFaces are of medium priority, put them before ordinary meshed faces
|
||||||
meshedFaces.splice( meshedFaces.begin(), notQuadFaces );
|
meshedFaces.splice( meshedFaces.begin(), notQuadFaces );
|
||||||
@ -1043,6 +1052,7 @@ bool StdMeshers_Prism_3D::computeWalls(const Prism_3D::TPrismTopo& thePrism)
|
|||||||
{
|
{
|
||||||
SMESH_Mesh* mesh = myHelper->GetMesh();
|
SMESH_Mesh* mesh = myHelper->GetMesh();
|
||||||
SMESHDS_Mesh* meshDS = myHelper->GetMeshDS();
|
SMESHDS_Mesh* meshDS = myHelper->GetMeshDS();
|
||||||
|
DBGOUT( endl << "COMPUTE Prism " << meshDS->ShapeToIndex( thePrism.myShape3D ));
|
||||||
|
|
||||||
TProjction1dAlgo* projector1D = TProjction1dAlgo::instance( this );
|
TProjction1dAlgo* projector1D = TProjction1dAlgo::instance( this );
|
||||||
StdMeshers_Quadrangle_2D* quadAlgo = TQuadrangleAlgo::instance( this, myHelper );
|
StdMeshers_Quadrangle_2D* quadAlgo = TQuadrangleAlgo::instance( this, myHelper );
|
||||||
@ -1108,6 +1118,7 @@ bool StdMeshers_Prism_3D::computeWalls(const Prism_3D::TPrismTopo& thePrism)
|
|||||||
const TopoDS_Edge& srcE = lftSide->Edge(i);
|
const TopoDS_Edge& srcE = lftSide->Edge(i);
|
||||||
SMESH_subMesh* srcSM = mesh->GetSubMesh( srcE );
|
SMESH_subMesh* srcSM = mesh->GetSubMesh( srcE );
|
||||||
if ( !srcSM->IsMeshComputed() ) {
|
if ( !srcSM->IsMeshComputed() ) {
|
||||||
|
DBGOUT( "COMPUTE V edge " << srcSM->GetId() );
|
||||||
srcSM->ComputeSubMeshStateEngine( SMESH_subMesh::COMPUTE );
|
srcSM->ComputeSubMeshStateEngine( SMESH_subMesh::COMPUTE );
|
||||||
srcSM->ComputeStateEngine ( SMESH_subMesh::COMPUTE );
|
srcSM->ComputeStateEngine ( SMESH_subMesh::COMPUTE );
|
||||||
if ( !srcSM->IsMeshComputed() )
|
if ( !srcSM->IsMeshComputed() )
|
||||||
@ -1161,8 +1172,9 @@ bool StdMeshers_Prism_3D::computeWalls(const Prism_3D::TPrismTopo& thePrism)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// compute nodes on target EDGEs
|
// compute nodes on target EDGEs
|
||||||
|
DBGOUT( "COMPUTE V edge (proj) " << shapeID( lftSide->Edge(0)));
|
||||||
rgtSide->Reverse(); // direct it same as the lftSide
|
rgtSide->Reverse(); // direct it same as the lftSide
|
||||||
myHelper->SetElementsOnShape( false );
|
myHelper->SetElementsOnShape( false ); // myHelper holds the prism shape
|
||||||
TopoDS_Edge tgtEdge;
|
TopoDS_Edge tgtEdge;
|
||||||
for ( size_t iN = 1; iN < srcNodeStr.size()-1; ++iN ) // add nodes
|
for ( size_t iN = 1; iN < srcNodeStr.size()-1; ++iN ) // add nodes
|
||||||
{
|
{
|
||||||
@ -1173,25 +1185,24 @@ bool StdMeshers_Prism_3D::computeWalls(const Prism_3D::TPrismTopo& thePrism)
|
|||||||
}
|
}
|
||||||
for ( size_t iN = 1; iN < srcNodeStr.size(); ++iN ) // add segments
|
for ( size_t iN = 1; iN < srcNodeStr.size(); ++iN ) // add segments
|
||||||
{
|
{
|
||||||
SMDS_MeshElement* newEdge = myHelper->AddEdge( newNodes[ iN-1 ], newNodes[ iN ] );
|
// find an EDGE to set a new segment
|
||||||
std::pair<int, TopAbs_ShapeEnum> id2type =
|
std::pair<int, TopAbs_ShapeEnum> id2type =
|
||||||
myHelper->GetMediumPos( newNodes[ iN-1 ], newNodes[ iN ] );
|
myHelper->GetMediumPos( newNodes[ iN-1 ], newNodes[ iN ] );
|
||||||
if ( id2type.second == TopAbs_EDGE )
|
if ( id2type.second != TopAbs_EDGE )
|
||||||
{
|
|
||||||
meshDS->SetMeshElementOnShape( newEdge, id2type.first );
|
|
||||||
}
|
|
||||||
else // new nodes are on different EDGEs; put one of them on VERTEX
|
|
||||||
{
|
{
|
||||||
|
// new nodes are on different EDGEs; put one of them on VERTEX
|
||||||
const int edgeIndex = rgtSide->EdgeIndex( srcNodeStr[ iN-1 ].normParam );
|
const int edgeIndex = rgtSide->EdgeIndex( srcNodeStr[ iN-1 ].normParam );
|
||||||
const double vertexParam = rgtSide->LastParameter( edgeIndex );
|
const double vertexParam = rgtSide->LastParameter( edgeIndex );
|
||||||
const gp_Pnt p = BRep_Tool::Pnt( rgtSide->LastVertex( edgeIndex ));
|
const gp_Pnt p = BRep_Tool::Pnt( rgtSide->LastVertex( edgeIndex ));
|
||||||
const int isPrev = ( Abs( srcNodeStr[ iN-1 ].normParam - vertexParam ) <
|
const int isPrev = ( Abs( srcNodeStr[ iN-1 ].normParam - vertexParam ) <
|
||||||
Abs( srcNodeStr[ iN ].normParam - vertexParam ));
|
Abs( srcNodeStr[ iN ].normParam - vertexParam ));
|
||||||
meshDS->SetMeshElementOnShape( newEdge, newNodes[ iN-(1-isPrev) ]->getshapeId() );
|
|
||||||
meshDS->UnSetNodeOnShape( newNodes[ iN-isPrev ] );
|
meshDS->UnSetNodeOnShape( newNodes[ iN-isPrev ] );
|
||||||
meshDS->SetNodeOnVertex ( newNodes[ iN-isPrev ], rgtSide->LastVertex( edgeIndex ));
|
meshDS->SetNodeOnVertex ( newNodes[ iN-isPrev ], rgtSide->LastVertex( edgeIndex ));
|
||||||
meshDS->MoveNode( newNodes[ iN-isPrev ], p.X(), p.Y(), p.Z() );
|
meshDS->MoveNode ( newNodes[ iN-isPrev ], p.X(), p.Y(), p.Z() );
|
||||||
|
id2type.first = newNodes[ iN-(1-isPrev) ]->getshapeId();
|
||||||
}
|
}
|
||||||
|
SMDS_MeshElement* newEdge = myHelper->AddEdge( newNodes[ iN-1 ], newNodes[ iN ] );
|
||||||
|
meshDS->SetMeshElementOnShape( newEdge, id2type.first );
|
||||||
}
|
}
|
||||||
myHelper->SetElementsOnShape( true );
|
myHelper->SetElementsOnShape( true );
|
||||||
for ( int i = 0; i < rgtSide->NbEdges(); ++i ) // update state of sub-meshes
|
for ( int i = 0; i < rgtSide->NbEdges(); ++i ) // update state of sub-meshes
|
||||||
@ -1228,28 +1239,43 @@ bool StdMeshers_Prism_3D::computeWalls(const Prism_3D::TPrismTopo& thePrism)
|
|||||||
// Top EDGEs must be projections from the bottom ones
|
// Top EDGEs must be projections from the bottom ones
|
||||||
// to compute stuctured quad mesh on wall FACEs
|
// to compute stuctured quad mesh on wall FACEs
|
||||||
// ---------------------------------------------------
|
// ---------------------------------------------------
|
||||||
const TopoDS_Edge& botE = (*quad)->side[ QUAD_BOTTOM_SIDE ]->Edge(0);
|
|
||||||
const TopoDS_Edge& topE = (*quad)->side[ QUAD_TOP_SIDE ]->Edge(0);
|
|
||||||
|
|
||||||
projector1D->myHyp.SetSourceEdge( botE );
|
|
||||||
|
|
||||||
SMESH_subMesh* tgtEdgeSm = mesh->GetSubMesh( topE );
|
|
||||||
if ( !tgtEdgeSm->IsMeshComputed() )
|
|
||||||
{
|
{
|
||||||
// compute nodes on VERTEXes
|
const TopoDS_Edge& botE = (*quad)->side[ QUAD_BOTTOM_SIDE ]->Edge(0);
|
||||||
tgtEdgeSm->ComputeSubMeshStateEngine( SMESH_subMesh::COMPUTE );
|
const TopoDS_Edge& topE = (*quad)->side[ QUAD_TOP_SIDE ]->Edge(0);
|
||||||
// project segments
|
SMESH_subMesh* botSM = mesh->GetSubMesh( botE );
|
||||||
projector1D->InitComputeError();
|
SMESH_subMesh* topSM = mesh->GetSubMesh( topE );
|
||||||
bool ok = projector1D->Compute( *mesh, topE );
|
SMESH_subMesh* srcSM = botSM;
|
||||||
if ( !ok )
|
SMESH_subMesh* tgtSM = topSM;
|
||||||
|
if ( !srcSM->IsMeshComputed() && topSM->IsMeshComputed() )
|
||||||
|
std::swap( srcSM, tgtSM );
|
||||||
|
|
||||||
|
if ( !srcSM->IsMeshComputed() )
|
||||||
{
|
{
|
||||||
SMESH_ComputeErrorPtr err = projector1D->GetComputeError();
|
DBGOUT( "COMPUTE H edge " << srcSM->GetId());
|
||||||
if ( err->IsOK() ) err->myName = COMPERR_ALGO_FAILED;
|
srcSM->ComputeSubMeshStateEngine( SMESH_subMesh::COMPUTE ); // nodes on VERTEXes
|
||||||
tgtEdgeSm->GetComputeError() = err;
|
srcSM->ComputeStateEngine( SMESH_subMesh::COMPUTE ); // segments on the EDGE
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
srcSM->ComputeStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE );
|
||||||
|
|
||||||
|
if ( !tgtSM->IsMeshComputed() )
|
||||||
|
{
|
||||||
|
// compute nodes on VERTEXes
|
||||||
|
tgtSM->ComputeSubMeshStateEngine( SMESH_subMesh::COMPUTE );
|
||||||
|
// project segments
|
||||||
|
DBGOUT( "COMPUTE H edge (proj) " << tgtSM->GetId());
|
||||||
|
projector1D->myHyp.SetSourceEdge( TopoDS::Edge( srcSM->GetSubShape() ));
|
||||||
|
projector1D->InitComputeError();
|
||||||
|
bool ok = projector1D->Compute( *mesh, tgtSM->GetSubShape() );
|
||||||
|
if ( !ok )
|
||||||
|
{
|
||||||
|
SMESH_ComputeErrorPtr err = projector1D->GetComputeError();
|
||||||
|
if ( err->IsOK() ) err->myName = COMPERR_ALGO_FAILED;
|
||||||
|
tgtSM->GetComputeError() = err;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tgtSM->ComputeStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE );
|
||||||
}
|
}
|
||||||
tgtEdgeSm->ComputeStateEngine( SMESH_subMesh::CHECK_COMPUTE_STATE );
|
|
||||||
|
|
||||||
// Compute quad mesh on wall FACEs
|
// Compute quad mesh on wall FACEs
|
||||||
// -------------------------------
|
// -------------------------------
|
||||||
@ -1264,6 +1290,7 @@ bool StdMeshers_Prism_3D::computeWalls(const Prism_3D::TPrismTopo& thePrism)
|
|||||||
"Not all edges have valid algorithm and hypothesis"));
|
"Not all edges have valid algorithm and hypothesis"));
|
||||||
// mesh the <face>
|
// mesh the <face>
|
||||||
quadAlgo->InitComputeError();
|
quadAlgo->InitComputeError();
|
||||||
|
DBGOUT( "COMPUTE Quad face " << fSM->GetId());
|
||||||
bool ok = quadAlgo->Compute( *mesh, face );
|
bool ok = quadAlgo->Compute( *mesh, face );
|
||||||
fSM->GetComputeError() = quadAlgo->GetComputeError();
|
fSM->GetComputeError() = quadAlgo->GetComputeError();
|
||||||
if ( !ok )
|
if ( !ok )
|
||||||
@ -1545,7 +1572,7 @@ bool StdMeshers_Prism_3D::assocOrProjBottom2Top()
|
|||||||
_gen->Compute( *myHelper->GetMesh(), botSM->GetSubShape() );
|
_gen->Compute( *myHelper->GetMesh(), botSM->GetSubShape() );
|
||||||
botSMDS = botSM->GetSubMeshDS();
|
botSMDS = botSM->GetSubMeshDS();
|
||||||
if ( !botSMDS || botSMDS->NbElements() == 0 )
|
if ( !botSMDS || botSMDS->NbElements() == 0 )
|
||||||
return toSM( error(TCom("No elememts on face #") << botSM->GetId() ));
|
return toSM( error(TCom("No elements on face #") << botSM->GetId() ));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool needProject = !topSM->IsMeshComputed();
|
bool needProject = !topSM->IsMeshComputed();
|
||||||
|
@ -2044,7 +2044,7 @@ bool StdMeshers_ProjectionUtils::MakeComputed(SMESH_subMesh * sm, const int iter
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
SMESH_Mesh* mesh = sm->GetFather();
|
SMESH_Mesh* mesh = sm->GetFather();
|
||||||
SMESH_Gen* gen = mesh->GetGen();
|
SMESH_Gen* gen = mesh->GetGen();
|
||||||
SMESH_Algo* algo = sm->GetAlgo();
|
SMESH_Algo* algo = sm->GetAlgo();
|
||||||
if ( !algo )
|
if ( !algo )
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user