mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-13 18:20:34 +05:00
Fix regressions
This commit is contained in:
parent
7ee75034e2
commit
81bd088581
@ -187,16 +187,16 @@ SMDS_ElemIteratorPtr SMDS_MeshNode::GetInverseElementIterator(SMDSAbs_ElementTyp
|
||||
return SMDS_ElemIteratorPtr(new SMDS_MeshNode_MyInvIterator(SMDS_Mesh::_meshList[myMeshId], l.cells, l.ncells, type));
|
||||
}
|
||||
|
||||
// Same as GetInverseElementIterator but the create iterator only return
|
||||
// Same as GetInverseElementIterator but the created iterator only returns
|
||||
// wanted type elements.
|
||||
class SMDS_MeshNode_MyIterator:public SMDS_ElemIterator
|
||||
{
|
||||
private:
|
||||
SMDS_Mesh* myMesh;
|
||||
vtkIdType* myCells;
|
||||
int myNcells;
|
||||
SMDSAbs_ElementType myType;
|
||||
int iter;
|
||||
SMDS_Mesh* myMesh;
|
||||
vtkIdType* myCells;
|
||||
int myNcells;
|
||||
SMDSAbs_ElementType myType;
|
||||
int iter;
|
||||
vector<SMDS_MeshElement*> myFiltCells;
|
||||
|
||||
public:
|
||||
@ -206,20 +206,16 @@ public:
|
||||
SMDSAbs_ElementType type):
|
||||
myMesh(mesh), myCells(cells), myNcells(ncells), myType(type), iter(0)
|
||||
{
|
||||
//MESSAGE("myNcells " << myNcells);
|
||||
for (; iter<ncells; iter++)
|
||||
{
|
||||
int vtkId = myCells[iter];
|
||||
int smdsId = myMesh->fromVtkToSmds(vtkId);
|
||||
//MESSAGE("vtkId " << vtkId << " smdsId " << smdsId);
|
||||
const SMDS_MeshElement* elem = myMesh->FindElement(smdsId);
|
||||
if (elem->GetType() == type)
|
||||
myFiltCells.push_back((SMDS_MeshElement*)elem);
|
||||
}
|
||||
myNcells = myFiltCells.size();
|
||||
//MESSAGE("myNcells " << myNcells);
|
||||
iter = 0;
|
||||
//MESSAGE("SMDS_MeshNode_MyIterator (filter) " << ncells << " " << myNcells);
|
||||
}
|
||||
|
||||
bool more()
|
||||
|
@ -189,13 +189,14 @@ void SMDS_UnstructuredGrid::compactGrid(std::vector<int>& idNodesOldToNew, int n
|
||||
|
||||
// --- if newNodeSize, create a new compacted vtkPoints
|
||||
|
||||
vtkPoints *newPoints = vtkPoints::New();
|
||||
newPoints->SetDataType(VTK_DOUBLE);
|
||||
newPoints->SetNumberOfPoints(newNodeSize);
|
||||
if (newNodeSize)
|
||||
if ( newNodeSize )
|
||||
{
|
||||
// rnv: to fix bug "21125: EDF 1233 SMESH: Degradation of precision in a test case for quadratic conversion"
|
||||
// using double type for storing coordinates of nodes instead float.
|
||||
vtkPoints *newPoints = vtkPoints::New();
|
||||
newPoints->SetDataType(VTK_DOUBLE);
|
||||
newPoints->SetNumberOfPoints(newNodeSize);
|
||||
|
||||
int oldNodeSize = idNodesOldToNew.size();
|
||||
|
||||
int i = 0;
|
||||
@ -211,21 +212,16 @@ void SMDS_UnstructuredGrid::compactGrid(std::vector<int>& idNodesOldToNew, int n
|
||||
int endBloc = i;
|
||||
copyNodes(newPoints, idNodesOldToNew, alreadyCopied, startBloc, endBloc);
|
||||
}
|
||||
newPoints->Squeeze();
|
||||
}
|
||||
|
||||
if (1/*newNodeSize*/)
|
||||
{
|
||||
this->SetPoints(newPoints);
|
||||
newPoints->Delete();
|
||||
}
|
||||
newPoints->Delete();
|
||||
|
||||
this->Points->Squeeze();
|
||||
|
||||
// --- create new compacted Connectivity, Locations and Types
|
||||
|
||||
int oldCellSize = this->Types->GetNumberOfTuples();
|
||||
|
||||
if ( oldCellSize == newCellSize ) // no holes in elements
|
||||
if ( !newNodeSize && oldCellSize == newCellSize ) // no holes in elements
|
||||
{
|
||||
this->Connectivity->Squeeze();
|
||||
this->Locations->Squeeze();
|
||||
|
@ -1242,24 +1242,35 @@ void SMESH_Mesh::NotifySubMeshesHypothesisModification(const SMESH_Hypothesis* h
|
||||
}
|
||||
}
|
||||
if ( toNotify )
|
||||
{
|
||||
smToNotify.push_back( aSubMesh );
|
||||
|
||||
if ( !aSubMesh->IsEmpty() &&
|
||||
aSubMesh->GetSubShape().ShapeType() == TopAbs_EDGE &&
|
||||
!toNotify )
|
||||
allMeshedEdgesNotified = false;
|
||||
if ( aSubMesh->GetAlgoState() == SMESH_subMesh::MISSING_HYP )
|
||||
allMeshedEdgesNotified = false; // update of algo state needed, not mesh clearing
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( !aSubMesh->IsEmpty() &&
|
||||
aSubMesh->GetSubShape().ShapeType() == TopAbs_EDGE )
|
||||
allMeshedEdgesNotified = false;
|
||||
}
|
||||
}
|
||||
if ( smToNotify.empty() )
|
||||
return;
|
||||
|
||||
// if all meshed EDGEs will be notified then the notification is equivalent
|
||||
// to the whole mesh clearing
|
||||
if ( allMeshedEdgesNotified )
|
||||
Clear();
|
||||
{
|
||||
if ( NbNodes() > 0 )
|
||||
Clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
// notify in reverse order to avoid filling of the pool of IDs
|
||||
for ( int i = smToNotify.size()-1; i >= 0; --i )
|
||||
smToNotify[i]->AlgoStateEngine(SMESH_subMesh::MODIF_HYP,
|
||||
const_cast< SMESH_Hypothesis*>( hyp ));
|
||||
|
||||
}
|
||||
HasModificationsToDiscard(); // to reset _isModified flag if mesh becomes empty
|
||||
GetMeshDS()->Modified();
|
||||
}
|
||||
|
@ -1279,24 +1279,34 @@ static void cleanSubMesh( SMESH_subMesh * subMesh )
|
||||
if ( nbElems > 0 )
|
||||
{
|
||||
// start from elem with max ID to avoid filling the pool of IDs
|
||||
const SMDS_MeshElement * lastElem = subMeshDS->GetElement( nbElems-1 );
|
||||
bool rev = ( lastElem->GetID() == meshDS->MaxElementID() );
|
||||
bool rev = true;
|
||||
SMDS_ElemIteratorPtr ite = subMeshDS->GetElements( rev );
|
||||
const SMDS_MeshElement * lastElem = ite->next();
|
||||
rev = ( lastElem->GetID() == meshDS->MaxElementID() );
|
||||
if ( !rev )
|
||||
ite = subMeshDS->GetElements( rev );
|
||||
else
|
||||
meshDS->RemoveFreeElement( lastElem, subMeshDS );
|
||||
while (ite->more()) {
|
||||
const SMDS_MeshElement * elt = ite->next();
|
||||
meshDS->RemoveFreeElement(elt, 0);
|
||||
meshDS->RemoveFreeElement( elt, subMeshDS );
|
||||
}
|
||||
}
|
||||
int nbNodes = subMeshDS->NbNodes();
|
||||
if ( nbNodes > 0 )
|
||||
{
|
||||
const SMDS_MeshNode * lastNode = subMeshDS->GetNode( nbNodes-1 );
|
||||
bool rev = ( lastNode->GetID() == meshDS->MaxNodeID() );
|
||||
bool rev = true;
|
||||
SMDS_NodeIteratorPtr itn = subMeshDS->GetNodes( rev );
|
||||
const SMDS_MeshNode * lastNode = itn->next();
|
||||
rev = ( lastNode->GetID() == meshDS->MaxNodeID() );
|
||||
if ( !rev )
|
||||
itn = subMeshDS->GetNodes( rev );
|
||||
else
|
||||
meshDS->RemoveNode( lastNode );
|
||||
while (itn->more()) {
|
||||
const SMDS_MeshNode * node = itn->next();
|
||||
if ( node->NbInverseElements() == 0 )
|
||||
meshDS->RemoveFreeNode(node, 0);
|
||||
meshDS->RemoveFreeNode( node, subMeshDS );
|
||||
else // for StdMeshers_CompositeSegment_1D: node in one submesh, edge in another
|
||||
meshDS->RemoveNode(node);
|
||||
}
|
||||
|
@ -2150,14 +2150,10 @@ void SMESHDS_Mesh::compactMesh()
|
||||
SMDS_Mesh::compactMesh();
|
||||
|
||||
int newNodeSize = 0;
|
||||
int nbNodes = myNodes.size();
|
||||
int nbVtkNodes = myGrid->GetNumberOfPoints();
|
||||
int nbNodeTemp = nbVtkNodes;
|
||||
if (nbNodes > nbVtkNodes)
|
||||
nbNodeTemp = nbNodes;
|
||||
vector<int> idNodesOldToNew;
|
||||
idNodesOldToNew.clear();
|
||||
idNodesOldToNew.resize(nbNodeTemp, -1); // all unused id will be -1
|
||||
int nbNodes = myNodes.size();
|
||||
int nbVtkNodes = myGrid->GetNumberOfPoints();
|
||||
int nbNodeTemp = Max( nbVtkNodes, nbNodes );
|
||||
vector<int> idNodesOldToNew(nbNodeTemp, -1); // all unused id will be -1
|
||||
|
||||
for (int i = 0; i < nbNodes; i++)
|
||||
{
|
||||
@ -2168,18 +2164,14 @@ void SMESHDS_Mesh::compactMesh()
|
||||
newNodeSize++;
|
||||
}
|
||||
}
|
||||
bool areNodesModified = (newNodeSize < nbVtkNodes);
|
||||
bool areNodesModified = (newNodeSize != nbVtkNodes);
|
||||
areNodesModified = true;
|
||||
|
||||
int newCellSize = 0;
|
||||
int nbCells = myCells.size();
|
||||
int nbVtkCells = myGrid->GetNumberOfCells();
|
||||
int nbCellTemp = nbVtkCells;
|
||||
if (nbCells > nbVtkCells)
|
||||
nbCellTemp = nbCells;
|
||||
vector<int> idCellsOldToNew;
|
||||
idCellsOldToNew.clear();
|
||||
idCellsOldToNew.resize(nbCellTemp, -1); // all unused id will be -1
|
||||
int nbCells = myCells.size();
|
||||
int nbVtkCells = myGrid->GetNumberOfCells();
|
||||
int nbCellTemp = Max( nbVtkCells, nbCells );
|
||||
vector<int> idCellsOldToNew(nbCellTemp, -1); // all unused id will be -1
|
||||
|
||||
for (int i = 0; i < nbCells; i++)
|
||||
{
|
||||
@ -2206,18 +2198,17 @@ void SMESHDS_Mesh::compactMesh()
|
||||
if (nbVtkCells > newCellSize) newCellSize = nbVtkCells; // several cells with same SMDS Id
|
||||
}
|
||||
|
||||
// --- SMDS_MeshNode and myNodes (id in SMDS and in VTK are the same), myNodeIdFactory
|
||||
// --- SMDS_MeshNode and myNodes, myNodeIdFactory
|
||||
|
||||
if (areNodesModified)
|
||||
if ( true )
|
||||
{
|
||||
SetOfNodes newNodes;
|
||||
newNodes.resize(newNodeSize+1,0); // 0 not used, SMDS numbers 1..n
|
||||
SetOfNodes newNodes(newNodeSize+1,0); // 0 not used, SMDS numbers 1..n
|
||||
int newSmdsId = 0;
|
||||
for (int i = 0; i < nbNodes; i++)
|
||||
{
|
||||
if (myNodes[i])
|
||||
{
|
||||
newSmdsId++; // SMDS id start to 1
|
||||
newSmdsId++; // SMDS id starts from 1
|
||||
int oldVtkId = myNodes[i]->getVtkId();
|
||||
int newVtkId = idNodesOldToNew[oldVtkId];
|
||||
myNodes[i]->setVtkId(newVtkId);
|
||||
@ -2232,25 +2223,18 @@ void SMESHDS_Mesh::compactMesh()
|
||||
// --- SMDS_MeshCell, myCellIdVtkToSmds, myCellIdSmdsToVtk, myCells
|
||||
|
||||
int vtkIndexSize = myCellIdVtkToSmds.size();
|
||||
int maxVtkId = -1;
|
||||
for (int oldVtkId = 0; oldVtkId < vtkIndexSize; oldVtkId++)
|
||||
{
|
||||
int oldSmdsId = this->myCellIdVtkToSmds[oldVtkId];
|
||||
if (oldSmdsId > 0)
|
||||
{
|
||||
int newVtkId = idCellsOldToNew[oldVtkId];
|
||||
if (newVtkId > maxVtkId)
|
||||
maxVtkId = newVtkId;
|
||||
myCells[oldSmdsId]->setVtkId(newVtkId);
|
||||
}
|
||||
}
|
||||
|
||||
SetOfCells newCells;
|
||||
vector<int> newVtkToSmds;
|
||||
|
||||
assert(maxVtkId < newCellSize);
|
||||
newCells.resize(newCellSize+1, 0); // 0 not used, SMDS numbers 1..n
|
||||
newVtkToSmds.resize(newCellSize+1, -1);
|
||||
SetOfCells newCells(newCellSize+1, 0); // 0 not used, SMDS numbers 1..n
|
||||
vector<int> newVtkToSmds(newCellSize+1, -1);
|
||||
|
||||
int myCellsSize = myCells.size();
|
||||
int newSmdsId = 0;
|
||||
@ -2258,7 +2242,7 @@ void SMESHDS_Mesh::compactMesh()
|
||||
{
|
||||
if ( myCells[i] )
|
||||
{
|
||||
newSmdsId++; // SMDS id start to 1
|
||||
newSmdsId++; // SMDS id starts from 1
|
||||
assert(newSmdsId <= newCellSize);
|
||||
newCells[newSmdsId] = myCells[i];
|
||||
newCells[newSmdsId]->setId(newSmdsId);
|
||||
|
@ -567,6 +567,10 @@ void SMESHDS_SubMesh::compactList()
|
||||
myElements.swap(newElems);
|
||||
myUnusedIdElements = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector<const SMDS_MeshElement*>( myElements ).swap( myElements );
|
||||
}
|
||||
|
||||
if ( myUnusedIdNodes > 0 )
|
||||
{
|
||||
@ -582,6 +586,10 @@ void SMESHDS_SubMesh::compactList()
|
||||
myNodes.swap(newNodes);
|
||||
myUnusedIdNodes = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector<const SMDS_MeshNode*>( myNodes ).swap( myNodes );
|
||||
}
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
@ -349,7 +349,7 @@ namespace SMESH
|
||||
try {
|
||||
OCC_CATCH_SIGNALS;
|
||||
if (nulData)
|
||||
objModified = aVisualObj->NulData();
|
||||
objModified = aVisualObj->NulData();
|
||||
else
|
||||
objModified = aVisualObj->Update();
|
||||
}
|
||||
@ -370,24 +370,24 @@ namespace SMESH
|
||||
int usedMB = aVisualObj->GetUnstructuredGrid()->GetActualMemorySize() / 1024;
|
||||
//MESSAGE("SMESHGUI_VTKUtils::GetVisualObj(), freeMB=" << freeMB << ", usedMB=" <<usedMB);
|
||||
if ( freeMB > 0 && usedMB * 5 > freeMB ) {
|
||||
bool continu = false;
|
||||
if ( usedMB * 3 > freeMB )
|
||||
// even dont try to show
|
||||
SUIT_MessageBox::warning(SMESHGUI::desktop(), QObject::tr("SMESH_WRN_WARNING"),
|
||||
QObject::tr("SMESH_NO_MESH_VISUALIZATION"));
|
||||
else
|
||||
// there is a chance to succeed
|
||||
continu = SUIT_MessageBox::warning
|
||||
(SMESHGUI::desktop(),
|
||||
QObject::tr("SMESH_WRN_WARNING"),
|
||||
QObject::tr("SMESH_CONTINUE_MESH_VISUALIZATION"),
|
||||
SUIT_MessageBox::Yes | SUIT_MessageBox::No,
|
||||
SUIT_MessageBox::Yes ) == SUIT_MessageBox::Yes;
|
||||
if ( !continu ) {
|
||||
// remove the corresponding actors from all views
|
||||
RemoveVisualObjectWithActors( theEntry );
|
||||
aVisualObj.reset();
|
||||
}
|
||||
bool continu = false;
|
||||
if ( usedMB * 3 > freeMB )
|
||||
// even dont try to show
|
||||
SUIT_MessageBox::warning(SMESHGUI::desktop(), QObject::tr("SMESH_WRN_WARNING"),
|
||||
QObject::tr("SMESH_NO_MESH_VISUALIZATION"));
|
||||
else
|
||||
// there is a chance to succeed
|
||||
continu = SUIT_MessageBox::warning
|
||||
(SMESHGUI::desktop(),
|
||||
QObject::tr("SMESH_WRN_WARNING"),
|
||||
QObject::tr("SMESH_CONTINUE_MESH_VISUALIZATION"),
|
||||
SUIT_MessageBox::Yes | SUIT_MessageBox::No,
|
||||
SUIT_MessageBox::Yes ) == SUIT_MessageBox::Yes;
|
||||
if ( !continu ) {
|
||||
// remove the corresponding actors from all views
|
||||
RemoveVisualObjectWithActors( theEntry );
|
||||
aVisualObj.reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -960,7 +960,7 @@ void SMESH_Gen_i::SetOption(const char* name, const char* value)
|
||||
{
|
||||
vector<int> color;
|
||||
string str = value;
|
||||
// color must be presented as a string of next form:
|
||||
// color must be presented as a string of following form:
|
||||
if ( str.at(0) == '#' && str.length() == 7 ) { // hexadecimal color ("#ffaa00", for example)
|
||||
str = str.substr(1);
|
||||
for ( size_t i = 0; i < str.length()/2; i++ )
|
||||
|
@ -2324,7 +2324,7 @@ bool StdMeshers_ProjectionUtils::MakeComputed(SMESH_subMesh * sm, const int iter
|
||||
|
||||
string algoType = algo->GetName();
|
||||
if ( algoType.substr(0, 11) != "Projection_")
|
||||
return gen->Compute( *mesh, shape, /*shapeOnly=*/true );
|
||||
return gen->Compute( *mesh, shape, SMESH_Gen::SHAPE_ONLY );
|
||||
|
||||
// try to compute source mesh
|
||||
|
||||
@ -2365,7 +2365,7 @@ bool StdMeshers_ProjectionUtils::MakeComputed(SMESH_subMesh * sm, const int iter
|
||||
srcMesh = mesh;
|
||||
|
||||
if ( MakeComputed( srcMesh->GetSubMesh( srcShape ), iterationNb + 1 ) &&
|
||||
gen->Compute( *mesh, shape, /*shapeOnly=*/true ))
|
||||
gen->Compute( *mesh, shape, SMESH_Gen::SHAPE_ONLY ))
|
||||
return sm->IsMeshComputed();
|
||||
|
||||
return false;
|
||||
|
@ -5653,20 +5653,30 @@ bool _Smoother1D::smoothComplexEdge( _SolidData& data,
|
||||
return false;
|
||||
}
|
||||
|
||||
// adjust length of extreme LE (test viscous_layers_01/B7)
|
||||
gp_Vec vDiv0( pExtreme[0], pProj[0] );
|
||||
gp_Vec vDiv1( pExtreme[1], pProj[1] );
|
||||
double d0 = vDiv0.Magnitude();
|
||||
double d1 = vDiv1.Magnitude();
|
||||
if ( e[0]->_normal * vDiv0.XYZ() < 0 ) e[0]->_len += d0;
|
||||
else e[0]->_len -= d0;
|
||||
if ( e[1]->_normal * vDiv1.XYZ() < 0 ) e[1]->_len += d1;
|
||||
else e[1]->_len -= d1;
|
||||
|
||||
// compute normalized length of the offset segments located between the projections
|
||||
|
||||
size_t iSeg = 0, nbSeg = _iSeg[1] - _iSeg[0] + 1;
|
||||
vector< double > len( nbSeg + 1 );
|
||||
len[ iSeg++ ] = 0;
|
||||
len[ iSeg++ ] = pProj[ 0 ].Distance( _offPoints[ _iSeg[0]+1 ]._xyz );
|
||||
len[ iSeg++ ] = pProj[ 0 ].Distance( _offPoints[ _iSeg[0]+1 ]._xyz )/* * e[0]->_lenFactor*/;
|
||||
for ( size_t i = _iSeg[0]+1; i <= _iSeg[1]; ++i, ++iSeg )
|
||||
{
|
||||
len[ iSeg ] = len[ iSeg-1 ] + _offPoints[i].Distance( _offPoints[i+1] );
|
||||
}
|
||||
len[ nbSeg ] -= pProj[ 1 ].Distance( _offPoints[ _iSeg[1]+1 ]._xyz );
|
||||
len[ nbSeg ] -= pProj[ 1 ].Distance( _offPoints[ _iSeg[1]+1 ]._xyz )/* * e[1]->_lenFactor*/;
|
||||
|
||||
double d0 = pProj[0].Distance( pExtreme[0]);
|
||||
double d1 = pProj[1].Distance( pExtreme[1]);
|
||||
// d0 *= e[0]->_lenFactor;
|
||||
// d1 *= e[1]->_lenFactor;
|
||||
double fullLen = len.back() - d0 - d1;
|
||||
for ( iSeg = 0; iSeg < len.size(); ++iSeg )
|
||||
len[iSeg] = ( len[iSeg] - d0 ) / fullLen;
|
||||
|
Loading…
Reference in New Issue
Block a user