mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-18 14:10:34 +05:00
PR: debug polygons and merge nodes
This commit is contained in:
parent
5927f96360
commit
43a4d0b5c1
@ -1162,7 +1162,7 @@ SMDS_MeshFace* SMDS_Mesh::AddPolygonalFaceWithID
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
//#ifdef VTK_HAVE_POLYHEDRON
|
//#ifdef VTK_HAVE_POLYHEDRON
|
||||||
MESSAGE("AddPolygonalFaceWithID vtk " << ID);
|
//MESSAGE("AddPolygonalFaceWithID vtk " << ID);
|
||||||
vector<vtkIdType> nodeIds;
|
vector<vtkIdType> nodeIds;
|
||||||
nodeIds.clear();
|
nodeIds.clear();
|
||||||
vector<const SMDS_MeshNode*>::iterator it = nodes.begin();
|
vector<const SMDS_MeshNode*>::iterator it = nodes.begin();
|
||||||
@ -1257,7 +1257,7 @@ SMDS_MeshVolume* SMDS_Mesh::AddPolyhedralVolumeWithID
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
//#ifdef VTK_HAVE_POLYHEDRON
|
//#ifdef VTK_HAVE_POLYHEDRON
|
||||||
MESSAGE("AddPolyhedralVolumeWithID vtk " << ID);
|
//MESSAGE("AddPolyhedralVolumeWithID vtk " << ID);
|
||||||
vector<vtkIdType> nodeIds;
|
vector<vtkIdType> nodeIds;
|
||||||
nodeIds.clear();
|
nodeIds.clear();
|
||||||
vector<const SMDS_MeshNode*>::iterator it = nodes.begin();
|
vector<const SMDS_MeshNode*>::iterator it = nodes.begin();
|
||||||
|
@ -92,7 +92,7 @@ int SMDS_UnstructuredGrid::InsertNextLinkedCell(int type, int npts, vtkIdType *p
|
|||||||
return vtkUnstructuredGrid::InsertNextLinkedCell(type, npts, pts);
|
return vtkUnstructuredGrid::InsertNextLinkedCell(type, npts, pts);
|
||||||
|
|
||||||
// --- type = VTK_POLYHEDRON
|
// --- type = VTK_POLYHEDRON
|
||||||
MESSAGE("InsertNextLinkedCell VTK_POLYHEDRON");
|
//MESSAGE("InsertNextLinkedCell VTK_POLYHEDRON");
|
||||||
int cellid = this->InsertNextCell(type, npts, pts);
|
int cellid = this->InsertNextCell(type, npts, pts);
|
||||||
|
|
||||||
set<vtkIdType> setOfNodes;
|
set<vtkIdType> setOfNodes;
|
||||||
@ -105,7 +105,7 @@ int SMDS_UnstructuredGrid::InsertNextLinkedCell(int type, int npts, vtkIdType *p
|
|||||||
i++;
|
i++;
|
||||||
for (int k = 0; k < nbnodes; k++)
|
for (int k = 0; k < nbnodes; k++)
|
||||||
{
|
{
|
||||||
MESSAGE(" cell " << cellid << " face " << nf << " node " << pts[i]);
|
//MESSAGE(" cell " << cellid << " face " << nf << " node " << pts[i]);
|
||||||
setOfNodes.insert(pts[i]);
|
setOfNodes.insert(pts[i]);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
@ -114,7 +114,7 @@ int SMDS_UnstructuredGrid::InsertNextLinkedCell(int type, int npts, vtkIdType *p
|
|||||||
set<vtkIdType>::iterator it = setOfNodes.begin();
|
set<vtkIdType>::iterator it = setOfNodes.begin();
|
||||||
for (; it != setOfNodes.end(); ++it)
|
for (; it != setOfNodes.end(); ++it)
|
||||||
{
|
{
|
||||||
MESSAGE("reverse link for node " << *it << " cell " << cellid);
|
//MESSAGE("reverse link for node " << *it << " cell " << cellid);
|
||||||
this->Links->ResizeCellList(*it, 1);
|
this->Links->ResizeCellList(*it, 1);
|
||||||
this->Links->AddCellReference(cellid, *it);
|
this->Links->AddCellReference(cellid, *it);
|
||||||
}
|
}
|
||||||
|
@ -63,9 +63,8 @@ void SMDS_VtkVolume::init(std::vector<vtkIdType> nodeIds, SMDS_Mesh* mesh)
|
|||||||
//#ifdef VTK_HAVE_POLYHEDRON
|
//#ifdef VTK_HAVE_POLYHEDRON
|
||||||
void SMDS_VtkVolume::initPoly(std::vector<vtkIdType> nodeIds, std::vector<int> nbNodesPerFace, SMDS_Mesh* mesh)
|
void SMDS_VtkVolume::initPoly(std::vector<vtkIdType> nodeIds, std::vector<int> nbNodesPerFace, SMDS_Mesh* mesh)
|
||||||
{
|
{
|
||||||
MESSAGE("SMDS_VtkVolume::initPoly");
|
//MESSAGE("SMDS_VtkVolume::initPoly");
|
||||||
SMDS_UnstructuredGrid* grid = mesh->getGrid();
|
SMDS_UnstructuredGrid* grid = mesh->getGrid();
|
||||||
// TODO is it useful to orient faces ?
|
|
||||||
double center[3];
|
double center[3];
|
||||||
this->gravityCenter(grid, &nodeIds[0], nodeIds.size(), ¢er[0]);
|
this->gravityCenter(grid, &nodeIds[0], nodeIds.size(), ¢er[0]);
|
||||||
vector<vtkIdType> ptIds;
|
vector<vtkIdType> ptIds;
|
||||||
@ -76,14 +75,13 @@ void SMDS_VtkVolume::initPoly(std::vector<vtkIdType> nodeIds, std::vector<int> n
|
|||||||
{
|
{
|
||||||
int nf = nbNodesPerFace[i];
|
int nf = nbNodesPerFace[i];
|
||||||
ptIds.push_back(nf);
|
ptIds.push_back(nf);
|
||||||
// double a[3];
|
double a[3];
|
||||||
// double b[3];
|
double b[3];
|
||||||
// double c[3];
|
double c[3];
|
||||||
// grid->GetPoints()->GetPoint(nodeIds[k], a);
|
grid->GetPoints()->GetPoint(nodeIds[k], a);
|
||||||
// grid->GetPoints()->GetPoint(nodeIds[k + 1], b);
|
grid->GetPoints()->GetPoint(nodeIds[k + 1], b);
|
||||||
// grid->GetPoints()->GetPoint(nodeIds[k + 2], c);
|
grid->GetPoints()->GetPoint(nodeIds[k + 2], c);
|
||||||
// bool isFaceForward = this->isForward(a, b, c, center);
|
bool isFaceForward = this->isForward(a, b, c, center);
|
||||||
bool isFaceForward = true;
|
|
||||||
//MESSAGE("isFaceForward " << i << " " << isFaceForward);
|
//MESSAGE("isFaceForward " << i << " " << isFaceForward);
|
||||||
vtkIdType *facePts = &nodeIds[k];
|
vtkIdType *facePts = &nodeIds[k];
|
||||||
if (isFaceForward)
|
if (isFaceForward)
|
||||||
@ -571,9 +569,10 @@ bool SMDS_VtkVolume::isForward(double* a, double* b, double* c, double* d)
|
|||||||
w[j] = d[j] - a[j];
|
w[j] = d[j] - a[j];
|
||||||
//MESSAGE("u,v,w " << u[j] << " " << v[j] << " " << w[j]);
|
//MESSAGE("u,v,w " << u[j] << " " << v[j] << " " << w[j]);
|
||||||
}
|
}
|
||||||
double prodmixte = (u[2] * v[3] - u[3] * v[2]) * w[1] + (u[3] * v[1] - u[1] * v[3]) * w[2] + (u[1] * v[2] - u[2]
|
double prodmixte = (u[1]*v[2] - u[2]*v[1]) * w[0]
|
||||||
* v[1]) * w[3];
|
+ (u[2]*v[0] - u[0]*v[2]) * w[1]
|
||||||
return (prodmixte >= 0);
|
+ (u[0]*v[1] - u[1]*v[0]) * w[2];
|
||||||
|
return (prodmixte < 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! For polyhedron only
|
/*! For polyhedron only
|
||||||
|
@ -5310,22 +5310,37 @@ SMESH_MeshEditor::Transform (TIDSortedElemSet & theElems,
|
|||||||
string groupPostfix;
|
string groupPostfix;
|
||||||
switch ( theTrsf.Form() ) {
|
switch ( theTrsf.Form() ) {
|
||||||
case gp_PntMirror:
|
case gp_PntMirror:
|
||||||
|
MESSAGE("gp_PntMirror");
|
||||||
|
needReverse = true;
|
||||||
|
groupPostfix = "mirrored";
|
||||||
|
break;
|
||||||
case gp_Ax1Mirror:
|
case gp_Ax1Mirror:
|
||||||
|
MESSAGE("gp_Ax1Mirror");
|
||||||
|
groupPostfix = "mirrored";
|
||||||
|
break;
|
||||||
case gp_Ax2Mirror:
|
case gp_Ax2Mirror:
|
||||||
|
MESSAGE("gp_Ax2Mirror");
|
||||||
needReverse = true;
|
needReverse = true;
|
||||||
groupPostfix = "mirrored";
|
groupPostfix = "mirrored";
|
||||||
break;
|
break;
|
||||||
case gp_Rotation:
|
case gp_Rotation:
|
||||||
|
MESSAGE("gp_Rotation");
|
||||||
groupPostfix = "rotated";
|
groupPostfix = "rotated";
|
||||||
break;
|
break;
|
||||||
case gp_Translation:
|
case gp_Translation:
|
||||||
|
MESSAGE("gp_Translation");
|
||||||
groupPostfix = "translated";
|
groupPostfix = "translated";
|
||||||
break;
|
break;
|
||||||
case gp_Scale:
|
case gp_Scale:
|
||||||
|
MESSAGE("gp_Scale");
|
||||||
|
groupPostfix = "scaled";
|
||||||
|
break;
|
||||||
case gp_CompoundTrsf: // different scale by axis
|
case gp_CompoundTrsf: // different scale by axis
|
||||||
|
MESSAGE("gp_CompoundTrsf");
|
||||||
groupPostfix = "scaled";
|
groupPostfix = "scaled";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
MESSAGE("default");
|
||||||
needReverse = false;
|
needReverse = false;
|
||||||
groupPostfix = "transformed";
|
groupPostfix = "transformed";
|
||||||
}
|
}
|
||||||
@ -7368,10 +7383,9 @@ void SMESH_MeshEditor::MergeNodes (TListOfListOfNodes & theGroupsOfNodes)
|
|||||||
vector<const SMDS_MeshNode *> polygons_nodes;
|
vector<const SMDS_MeshNode *> polygons_nodes;
|
||||||
vector<int> quantities;
|
vector<int> quantities;
|
||||||
int nbNew = SimplifyFace(face_nodes, polygons_nodes, quantities);
|
int nbNew = SimplifyFace(face_nodes, polygons_nodes, quantities);
|
||||||
|
|
||||||
if (nbNew > 0) {
|
if (nbNew > 0) {
|
||||||
inode = 0;
|
inode = 0;
|
||||||
for (int iface = 0; iface < nbNew - 1; iface++) {
|
for (int iface = 0; iface < nbNew; iface++) {
|
||||||
int nbNodes = quantities[iface];
|
int nbNodes = quantities[iface];
|
||||||
vector<const SMDS_MeshNode *> poly_nodes (nbNodes);
|
vector<const SMDS_MeshNode *> poly_nodes (nbNodes);
|
||||||
for (int ii = 0; ii < nbNodes; ii++, inode++) {
|
for (int ii = 0; ii < nbNodes; ii++, inode++) {
|
||||||
@ -7838,7 +7852,11 @@ void SMESH_MeshEditor::MergeNodes (TListOfListOfNodes & theGroupsOfNodes)
|
|||||||
//MESSAGE("Change regular element or polygon " << elemId);
|
//MESSAGE("Change regular element or polygon " << elemId);
|
||||||
SMDSAbs_ElementType etyp = elem->GetType();
|
SMDSAbs_ElementType etyp = elem->GetType();
|
||||||
uniqueNodes.resize(nbUniqueNodes);
|
uniqueNodes.resize(nbUniqueNodes);
|
||||||
SMDS_MeshElement* newElem = this->AddElement(uniqueNodes, etyp, false);
|
SMDS_MeshElement* newElem = 0;
|
||||||
|
if (elem->GetEntityType() == SMDSEntity_Polygon)
|
||||||
|
newElem = this->AddElement(uniqueNodes, etyp, true);
|
||||||
|
else
|
||||||
|
newElem = this->AddElement(uniqueNodes, etyp, false);
|
||||||
if (newElem)
|
if (newElem)
|
||||||
{
|
{
|
||||||
myLastCreatedElems.Append(newElem);
|
myLastCreatedElems.Append(newElem);
|
||||||
|
@ -216,7 +216,7 @@ bool SMESHDS_Mesh::ChangeElementNodes(const SMDS_MeshElement * elem,
|
|||||||
const SMDS_MeshNode * nodes[],
|
const SMDS_MeshNode * nodes[],
|
||||||
const int nbnodes)
|
const int nbnodes)
|
||||||
{
|
{
|
||||||
MESSAGE("SMESHDS_Mesh::ChangeElementNodes");
|
//MESSAGE("SMESHDS_Mesh::ChangeElementNodes");
|
||||||
if ( ! SMDS_Mesh::ChangeElementNodes( elem, nodes, nbnodes ))
|
if ( ! SMDS_Mesh::ChangeElementNodes( elem, nodes, nbnodes ))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -55,6 +55,8 @@
|
|||||||
#include <QTreeWidget>
|
#include <QTreeWidget>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
|
#include "utilities.h"
|
||||||
|
|
||||||
#include <SALOMEconfig.h>
|
#include <SALOMEconfig.h>
|
||||||
#include CORBA_SERVER_HEADER(SMESH_Group)
|
#include CORBA_SERVER_HEADER(SMESH_Group)
|
||||||
|
|
||||||
@ -667,7 +669,7 @@ void SMESHGUI_SimpleElemInfo::showInfo( long id, bool isElem )
|
|||||||
gtype = tr( "QUADRANGLE" ); break;
|
gtype = tr( "QUADRANGLE" ); break;
|
||||||
case SMDSEntity_Polygon:
|
case SMDSEntity_Polygon:
|
||||||
case SMDSEntity_Quad_Polygon:
|
case SMDSEntity_Quad_Polygon:
|
||||||
gtype = tr( "QUADRANGLE" ); break;
|
gtype = tr( "POLYGON" ); break;
|
||||||
case SMDSEntity_Tetra:
|
case SMDSEntity_Tetra:
|
||||||
case SMDSEntity_Quad_Tetra:
|
case SMDSEntity_Quad_Tetra:
|
||||||
gtype = tr( "TETRAHEDRON" ); break;
|
gtype = tr( "TETRAHEDRON" ); break;
|
||||||
@ -913,7 +915,7 @@ void SMESHGUI_TreeElemInfo::showInfo( long id, bool isElem )
|
|||||||
gtype = tr( "QUADRANGLE" ); break;
|
gtype = tr( "QUADRANGLE" ); break;
|
||||||
case SMDSEntity_Polygon:
|
case SMDSEntity_Polygon:
|
||||||
case SMDSEntity_Quad_Polygon:
|
case SMDSEntity_Quad_Polygon:
|
||||||
gtype = tr( "QUADRANGLE" ); break;
|
gtype = tr( "POLYGON" ); break;
|
||||||
case SMDSEntity_Tetra:
|
case SMDSEntity_Tetra:
|
||||||
case SMDSEntity_Quad_Tetra:
|
case SMDSEntity_Quad_Tetra:
|
||||||
gtype = tr( "TETRAHEDRON" ); break;
|
gtype = tr( "TETRAHEDRON" ); break;
|
||||||
|
Loading…
Reference in New Issue
Block a user