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();
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();
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;
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++;
}
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);
}
//#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;
{
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)
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
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";
}
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++) {
//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);
const SMDS_MeshNode * nodes[],
const int nbnodes)
{
- MESSAGE("SMESHDS_Mesh::ChangeElementNodes");
+ //MESSAGE("SMESHDS_Mesh::ChangeElementNodes");
if ( ! SMDS_Mesh::ChangeElementNodes( elem, nodes, nbnodes ))
return false;
#include <QTreeWidget>
#include <QVBoxLayout>
+#include "utilities.h"
+
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SMESH_Group)
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;
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;