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