mirror of
https://git.salome-platform.org/gitpub/modules/smesh.git
synced 2025-01-15 05:40:33 +05:00
Allow to create polyedres near sewed faces; improve nodes merging to save polyedres; implement polyedres by faces creation.
This commit is contained in:
parent
ee33969d5b
commit
b6545f068b
@ -658,7 +658,8 @@ module SMESH
|
|||||||
in long FirstNodeID2,
|
in long FirstNodeID2,
|
||||||
in long SecondNodeID2,
|
in long SecondNodeID2,
|
||||||
in long LastNodeID2,
|
in long LastNodeID2,
|
||||||
in boolean CreatePoly);
|
in boolean CreatePolygons,
|
||||||
|
in boolean CreatePolyedrs);
|
||||||
|
|
||||||
Sew_Error SewConformFreeBorders (in long FirstNodeID1,
|
Sew_Error SewConformFreeBorders (in long FirstNodeID1,
|
||||||
in long SecondNodeID1,
|
in long SecondNodeID1,
|
||||||
@ -671,7 +672,8 @@ module SMESH
|
|||||||
in long LastNodeIDOnFreeBorder,
|
in long LastNodeIDOnFreeBorder,
|
||||||
in long FirstNodeIDOnSide,
|
in long FirstNodeIDOnSide,
|
||||||
in long LastNodeIDOnSide,
|
in long LastNodeIDOnSide,
|
||||||
in boolean CreatePoly);
|
in boolean CreatePolygons,
|
||||||
|
in boolean CreatePolyedrs);
|
||||||
|
|
||||||
Sew_Error SewSideElements (in long_array IDsOfSide1Elements,
|
Sew_Error SewSideElements (in long_array IDsOfSide1Elements,
|
||||||
in long_array IDsOfSide2Elements,
|
in long_array IDsOfSide2Elements,
|
||||||
|
@ -104,11 +104,14 @@ module SMESH
|
|||||||
/*!
|
/*!
|
||||||
* Create nodes and elements in <theMesh> using nodes
|
* Create nodes and elements in <theMesh> using nodes
|
||||||
* coordinates computed by either of Apply...() methods.
|
* coordinates computed by either of Apply...() methods.
|
||||||
* If CreatePoly is TRUE, replace adjacent faces by polygons,
|
* If CreatePolygons is TRUE, replace adjacent faces by polygons
|
||||||
* inserting new nodes in common links.
|
* to keep mesh conformity.
|
||||||
|
* If CreatePolyedrs is TRUE, replace adjacent volumes by polyedrs
|
||||||
|
* to keep mesh conformity.
|
||||||
*/
|
*/
|
||||||
boolean MakeMesh (in SMESH_Mesh theMesh,
|
boolean MakeMesh (in SMESH_Mesh theMesh,
|
||||||
in boolean CreatePoly);
|
in boolean CreatePolygons,
|
||||||
|
in boolean CreatePolyedrs);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Return the loaded pattern in the string form to be saved in file
|
* Return the loaded pattern in the string form to be saved in file
|
||||||
|
@ -833,8 +833,8 @@ void SMESH_MeshObj::Update( int theIsClear )
|
|||||||
// nb nodes
|
// nb nodes
|
||||||
int nbNodes = anIndexes[i++];
|
int nbNodes = anIndexes[i++];
|
||||||
// nodes
|
// nodes
|
||||||
ASSERT( nbNodes < 9 );
|
//ASSERT( nbNodes < 9 );
|
||||||
const SMDS_MeshNode* aNodes[ 8 ];
|
const SMDS_MeshNode* aNodes[ nbNodes ];
|
||||||
for ( int iNode = 0; iNode < nbNodes; iNode++ )
|
for ( int iNode = 0; iNode < nbNodes; iNode++ )
|
||||||
aNodes[ iNode ] = FindNode( myMesh, anIndexes[i++] );
|
aNodes[ iNode ] = FindNode( myMesh, anIndexes[i++] );
|
||||||
// change
|
// change
|
||||||
|
@ -1985,7 +1985,8 @@ void SMDS_Mesh::RemoveElement(const SMDS_MeshElement * elem,
|
|||||||
// get finite elements built on elem
|
// get finite elements built on elem
|
||||||
set<const SMDS_MeshElement*> * s1;
|
set<const SMDS_MeshElement*> * s1;
|
||||||
if (!hasConstructionEdges() && elem->GetType() == SMDSAbs_Edge ||
|
if (!hasConstructionEdges() && elem->GetType() == SMDSAbs_Edge ||
|
||||||
!hasConstructionFaces() && elem->GetType() == SMDSAbs_Face)
|
!hasConstructionFaces() && elem->GetType() == SMDSAbs_Face ||
|
||||||
|
elem->GetType() == SMDSAbs_Volume)
|
||||||
{
|
{
|
||||||
s1 = new set<const SMDS_MeshElement*>();
|
s1 = new set<const SMDS_MeshElement*>();
|
||||||
s1->insert(elem);
|
s1->insert(elem);
|
||||||
|
@ -492,12 +492,39 @@ bool SMESH_MeshEditor::Reorient (const SMDS_MeshElement * theElem)
|
|||||||
}
|
}
|
||||||
case SMDSAbs_Volume:
|
case SMDSAbs_Volume:
|
||||||
{
|
{
|
||||||
|
if (theElem->IsPoly()) {
|
||||||
|
const SMDS_PolyhedralVolumeOfNodes* aPolyedre =
|
||||||
|
static_cast<const SMDS_PolyhedralVolumeOfNodes*>( theElem );
|
||||||
|
if (!aPolyedre) {
|
||||||
|
MESSAGE("Warning: bad volumic element");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
int nbFaces = aPolyedre->NbFaces();
|
||||||
|
vector<const SMDS_MeshNode *> poly_nodes;
|
||||||
|
vector<int> quantities (nbFaces);
|
||||||
|
|
||||||
|
// reverse each face of the polyedre
|
||||||
|
for (int iface = 1; iface <= nbFaces; iface++) {
|
||||||
|
int inode, nbFaceNodes = aPolyedre->NbFaceNodes(iface);
|
||||||
|
quantities[iface - 1] = nbFaceNodes;
|
||||||
|
|
||||||
|
for (inode = nbFaceNodes; inode >= 1; inode--) {
|
||||||
|
const SMDS_MeshNode* curNode = aPolyedre->GetFaceNode(iface, inode);
|
||||||
|
poly_nodes.push_back(curNode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return GetMeshDS()->ChangePolyhedronNodes( theElem, poly_nodes, quantities );
|
||||||
|
|
||||||
|
} else {
|
||||||
SMDS_VolumeTool vTool;
|
SMDS_VolumeTool vTool;
|
||||||
if ( !vTool.Set( theElem ))
|
if ( !vTool.Set( theElem ))
|
||||||
return false;
|
return false;
|
||||||
vTool.Inverse();
|
vTool.Inverse();
|
||||||
return GetMeshDS()->ChangeElementNodes( theElem, vTool.GetNodes(), vTool.NbNodes() );
|
return GetMeshDS()->ChangeElementNodes( theElem, vTool.GetNodes(), vTool.NbNodes() );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
default:;
|
default:;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2620,6 +2647,88 @@ void SMESH_MeshEditor::FindCoincidentNodes (set<const SMDS_MeshNode*> & theNodes
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : SimplifyFace
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
int SMESH_MeshEditor::SimplifyFace (const vector<const SMDS_MeshNode *> faceNodes,
|
||||||
|
vector<const SMDS_MeshNode *>& poly_nodes,
|
||||||
|
vector<int>& quantities) const
|
||||||
|
{
|
||||||
|
int nbNodes = faceNodes.size();
|
||||||
|
|
||||||
|
if (nbNodes < 3)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
set<const SMDS_MeshNode*> nodeSet;
|
||||||
|
|
||||||
|
// get simple seq of nodes
|
||||||
|
const SMDS_MeshNode* simpleNodes[ nbNodes ];
|
||||||
|
int iSimple = 0, nbUnique = 0;
|
||||||
|
|
||||||
|
simpleNodes[iSimple++] = faceNodes[0];
|
||||||
|
nbUnique++;
|
||||||
|
for (int iCur = 1; iCur < nbNodes; iCur++) {
|
||||||
|
if (faceNodes[iCur] != simpleNodes[iSimple - 1]) {
|
||||||
|
simpleNodes[iSimple++] = faceNodes[iCur];
|
||||||
|
if (nodeSet.insert( faceNodes[iCur] ).second)
|
||||||
|
nbUnique++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int nbSimple = iSimple;
|
||||||
|
if (simpleNodes[nbSimple - 1] == simpleNodes[0]) {
|
||||||
|
nbSimple--;
|
||||||
|
iSimple--;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nbUnique < 3)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
// separate loops
|
||||||
|
int nbNew = 0;
|
||||||
|
bool foundLoop = (nbSimple > nbUnique);
|
||||||
|
while (foundLoop) {
|
||||||
|
foundLoop = false;
|
||||||
|
set<const SMDS_MeshNode*> loopSet;
|
||||||
|
for (iSimple = 0; iSimple < nbSimple && !foundLoop; iSimple++) {
|
||||||
|
const SMDS_MeshNode* n = simpleNodes[iSimple];
|
||||||
|
if (!loopSet.insert( n ).second) {
|
||||||
|
foundLoop = true;
|
||||||
|
|
||||||
|
// separate loop
|
||||||
|
int iC = 0, curLast = iSimple;
|
||||||
|
for (; iC < curLast; iC++) {
|
||||||
|
if (simpleNodes[iC] == n) break;
|
||||||
|
}
|
||||||
|
int loopLen = curLast - iC;
|
||||||
|
if (loopLen > 2) {
|
||||||
|
// create sub-element
|
||||||
|
nbNew++;
|
||||||
|
quantities.push_back(loopLen);
|
||||||
|
for (; iC < curLast; iC++) {
|
||||||
|
poly_nodes.push_back(simpleNodes[iC]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// shift the rest nodes (place from the first loop position)
|
||||||
|
for (iC = curLast + 1; iC < nbSimple; iC++) {
|
||||||
|
simpleNodes[iC - loopLen] = simpleNodes[iC];
|
||||||
|
}
|
||||||
|
nbSimple -= loopLen;
|
||||||
|
iSimple -= loopLen;
|
||||||
|
}
|
||||||
|
} // for (iSimple = 0; iSimple < nbSimple; iSimple++)
|
||||||
|
} // while (foundLoop)
|
||||||
|
|
||||||
|
if (iSimple > 2) {
|
||||||
|
nbNew++;
|
||||||
|
quantities.push_back(iSimple);
|
||||||
|
for (int i = 0; i < iSimple; i++)
|
||||||
|
poly_nodes.push_back(simpleNodes[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return nbNew;
|
||||||
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : MergeNodes
|
//function : MergeNodes
|
||||||
//purpose : In each group, the cdr of nodes are substituted by the first one
|
//purpose : In each group, the cdr of nodes are substituted by the first one
|
||||||
@ -2699,82 +2808,78 @@ void SMESH_MeshEditor::MergeNodes (TListOfListOfNodes & theGroupsOfNodes)
|
|||||||
|
|
||||||
if (elem->GetType() == SMDSAbs_Face) {
|
if (elem->GetType() == SMDSAbs_Face) {
|
||||||
// Polygon
|
// Polygon
|
||||||
if (nbUniqueNodes < 3) {
|
vector<const SMDS_MeshNode *> face_nodes (nbNodes);
|
||||||
isOk = false;
|
int inode = 0;
|
||||||
} else {
|
for (; inode < nbNodes; inode++) {
|
||||||
// get simple seq of nodes
|
face_nodes[inode] = curNodes[inode];
|
||||||
const SMDS_MeshNode* simpleNodes[ nbNodes ];
|
|
||||||
int iSimple = 0;
|
|
||||||
|
|
||||||
simpleNodes[iSimple++] = curNodes[0];
|
|
||||||
for (iCur = 1; iCur < nbNodes; iCur++) {
|
|
||||||
if (curNodes[iCur] != simpleNodes[iSimple - 1]) {
|
|
||||||
simpleNodes[iSimple++] = curNodes[iCur];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
int nbSimple = iSimple;
|
|
||||||
if (simpleNodes[nbSimple - 1] == simpleNodes[0]) {
|
|
||||||
nbSimple--;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// separate cycles
|
vector<const SMDS_MeshNode *> polygons_nodes;
|
||||||
bool foundCycle = (nbSimple > nbUniqueNodes);
|
vector<int> quantities;
|
||||||
while (foundCycle) {
|
int nbNew = SimplifyFace(face_nodes, polygons_nodes, quantities);
|
||||||
foundCycle = false;
|
|
||||||
set<const SMDS_MeshNode*> cycleSet;
|
|
||||||
for (iSimple = 0; iSimple < nbSimple && !foundCycle; iSimple++) {
|
|
||||||
const SMDS_MeshNode* n = simpleNodes[iSimple];
|
|
||||||
if (!cycleSet.insert( n ).second) {
|
|
||||||
foundCycle = true;
|
|
||||||
|
|
||||||
// separate cycle
|
if (nbNew > 0) {
|
||||||
int iC = 0, curLast = iSimple;
|
inode = 0;
|
||||||
for (; iC < curLast; iC++) {
|
for (int iface = 0; iface < nbNew - 1; iface++) {
|
||||||
if (simpleNodes[iC] == n) break;
|
int nbNodes = quantities[iface];
|
||||||
}
|
vector<const SMDS_MeshNode *> poly_nodes (nbNodes);
|
||||||
int cycleLen = curLast - iC;
|
for (int ii = 0; ii < nbNodes; ii++, inode++) {
|
||||||
if (cycleLen > 2) {
|
poly_nodes[ii] = polygons_nodes[inode];
|
||||||
// create sub-element
|
|
||||||
vector<const SMDS_MeshNode *> poly_nodes (cycleLen);
|
|
||||||
for (int ii = 0; iC < curLast; iC++) {
|
|
||||||
poly_nodes[ii++] = simpleNodes[iC];
|
|
||||||
}
|
}
|
||||||
SMDS_MeshElement* newElem = aMesh->AddPolygonalFace(poly_nodes);
|
SMDS_MeshElement* newElem = aMesh->AddPolygonalFace(poly_nodes);
|
||||||
if (aShapeId)
|
if (aShapeId)
|
||||||
aMesh->SetMeshElementOnShape(newElem, aShapeId);
|
aMesh->SetMeshElementOnShape(newElem, aShapeId);
|
||||||
}
|
}
|
||||||
// put the rest nodes from the first cycle position
|
aMesh->ChangeElementNodes(elem, &polygons_nodes[inode], quantities[nbNew - 1]);
|
||||||
for (iC = curLast + 1; iC < nbSimple; iC++) {
|
|
||||||
simpleNodes[iC - cycleLen] = simpleNodes[iC];
|
|
||||||
}
|
|
||||||
nbSimple -= cycleLen;
|
|
||||||
}
|
|
||||||
} // for (iSimple = 0; iSimple < nbSimple; iSimple++)
|
|
||||||
} // while (foundCycle)
|
|
||||||
|
|
||||||
if (iSimple > 2) {
|
|
||||||
aMesh->ChangeElementNodes(elem, simpleNodes, nbSimple);
|
|
||||||
} else {
|
} else {
|
||||||
isOk = false;
|
rmElemIds.push_back(elem->GetID());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (elem->GetType() == SMDSAbs_Volume) {
|
} else if (elem->GetType() == SMDSAbs_Volume) {
|
||||||
// Polyhedral volume
|
// Polyhedral volume
|
||||||
if (nbUniqueNodes < 4) {
|
if (nbUniqueNodes < 4) {
|
||||||
isOk = false;
|
rmElemIds.push_back(elem->GetID());
|
||||||
} else {
|
} else {
|
||||||
// each face has to be analized in order to check volume validity
|
// each face has to be analized in order to check volume validity
|
||||||
//aMesh->ChangeElementNodes(elem, uniqueNodes, nbUniqueNodes);
|
const SMDS_PolyhedralVolumeOfNodes* aPolyedre =
|
||||||
isOk = false;
|
static_cast<const SMDS_PolyhedralVolumeOfNodes*>( elem );
|
||||||
|
if (aPolyedre) {
|
||||||
|
int nbFaces = aPolyedre->NbFaces();
|
||||||
|
|
||||||
|
vector<const SMDS_MeshNode *> poly_nodes;
|
||||||
|
vector<int> quantities;
|
||||||
|
|
||||||
|
for (int iface = 1; iface <= nbFaces; iface++) {
|
||||||
|
int nbFaceNodes = aPolyedre->NbFaceNodes(iface);
|
||||||
|
vector<const SMDS_MeshNode *> faceNodes (nbFaceNodes);
|
||||||
|
|
||||||
|
for (int inode = 1; inode <= nbFaceNodes; inode++) {
|
||||||
|
const SMDS_MeshNode * faceNode = aPolyedre->GetFaceNode(iface, inode);
|
||||||
|
TNodeNodeMap::iterator nnIt = nodeNodeMap.find(faceNode);
|
||||||
|
if (nnIt != nodeNodeMap.end()) { // faceNode sticks
|
||||||
|
faceNode = (*nnIt).second;
|
||||||
}
|
}
|
||||||
|
faceNodes[inode - 1] = faceNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
SimplifyFace(faceNodes, poly_nodes, quantities);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (quantities.size() > 3) {
|
||||||
|
// to be done: remove coincident faces
|
||||||
|
}
|
||||||
|
|
||||||
|
if (quantities.size() > 3)
|
||||||
|
aMesh->ChangePolyhedronNodes(elem, poly_nodes, quantities);
|
||||||
|
else
|
||||||
|
rmElemIds.push_back(elem->GetID());
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
isOk = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isOk)
|
|
||||||
rmElemIds.push_back(elem->GetID());
|
rmElemIds.push_back(elem->GetID());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
}
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -3021,10 +3126,41 @@ void SMESH_MeshEditor::MergeNodes (TListOfListOfNodes & theGroupsOfNodes)
|
|||||||
|
|
||||||
} // if ( nbNodes != nbUniqueNodes ) // some nodes stick
|
} // if ( nbNodes != nbUniqueNodes ) // some nodes stick
|
||||||
|
|
||||||
if ( isOk )
|
if ( isOk ) {
|
||||||
|
if (elem->IsPoly() && elem->GetType() == SMDSAbs_Volume) {
|
||||||
|
// Change nodes of polyedre
|
||||||
|
const SMDS_PolyhedralVolumeOfNodes* aPolyedre =
|
||||||
|
static_cast<const SMDS_PolyhedralVolumeOfNodes*>( elem );
|
||||||
|
if (aPolyedre) {
|
||||||
|
int nbFaces = aPolyedre->NbFaces();
|
||||||
|
|
||||||
|
vector<const SMDS_MeshNode *> poly_nodes;
|
||||||
|
vector<int> quantities (nbFaces);
|
||||||
|
|
||||||
|
for (int iface = 1; iface <= nbFaces; iface++) {
|
||||||
|
int inode, nbFaceNodes = aPolyedre->NbFaceNodes(iface);
|
||||||
|
quantities[iface - 1] = nbFaceNodes;
|
||||||
|
|
||||||
|
for (inode = 1; inode <= nbFaceNodes; inode++) {
|
||||||
|
const SMDS_MeshNode* curNode = aPolyedre->GetFaceNode(iface, inode);
|
||||||
|
|
||||||
|
TNodeNodeMap::iterator nnIt = nodeNodeMap.find( curNode );
|
||||||
|
if (nnIt != nodeNodeMap.end()) { // curNode sticks
|
||||||
|
curNode = (*nnIt).second;
|
||||||
|
}
|
||||||
|
poly_nodes.push_back(curNode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
aMesh->ChangePolyhedronNodes( elem, poly_nodes, quantities );
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Change regular element or polygon
|
||||||
aMesh->ChangeElementNodes( elem, uniqueNodes, nbUniqueNodes );
|
aMesh->ChangeElementNodes( elem, uniqueNodes, nbUniqueNodes );
|
||||||
else
|
}
|
||||||
|
} else {
|
||||||
|
// Remove invalid regular element or invalid polygon
|
||||||
rmElemIds.push_back( elem->GetID() );
|
rmElemIds.push_back( elem->GetID() );
|
||||||
|
}
|
||||||
|
|
||||||
} // loop on elements
|
} // loop on elements
|
||||||
|
|
||||||
@ -3300,7 +3436,8 @@ SMESH_MeshEditor::Sew_Error
|
|||||||
const SMDS_MeshNode* theSideSecondNode,
|
const SMDS_MeshNode* theSideSecondNode,
|
||||||
const SMDS_MeshNode* theSideThirdNode,
|
const SMDS_MeshNode* theSideThirdNode,
|
||||||
const bool theSideIsFreeBorder,
|
const bool theSideIsFreeBorder,
|
||||||
const bool toCreatePoly)
|
const bool toCreatePolygons,
|
||||||
|
const bool toCreatePolyedrs)
|
||||||
{
|
{
|
||||||
MESSAGE("::SewFreeBorder()");
|
MESSAGE("::SewFreeBorder()");
|
||||||
Sew_Error aResult = SEW_OK;
|
Sew_Error aResult = SEW_OK;
|
||||||
@ -3523,7 +3660,7 @@ SMESH_MeshEditor::Sew_Error
|
|||||||
}
|
}
|
||||||
while ( sideNode != theSideSecondNode );
|
while ( sideNode != theSideSecondNode );
|
||||||
|
|
||||||
if ( hasVolumes && sideNodes.size () != bordNodes.size() ) {
|
if ( hasVolumes && sideNodes.size () != bordNodes.size() && !toCreatePolyedrs) {
|
||||||
MESSAGE("VOLUME SPLITTING IS FORBIDDEN");
|
MESSAGE("VOLUME SPLITTING IS FORBIDDEN");
|
||||||
return SEW_VOLUMES_TO_SPLIT; // volume splitting is forbidden
|
return SEW_VOLUMES_TO_SPLIT; // volume splitting is forbidden
|
||||||
}
|
}
|
||||||
@ -3647,15 +3784,19 @@ SMESH_MeshEditor::Sew_Error
|
|||||||
list<const SMDS_MeshNode*> & nodeList = (*insertMapIt).second;
|
list<const SMDS_MeshNode*> & nodeList = (*insertMapIt).second;
|
||||||
const SMDS_MeshNode* n12 = nodeList.front(); nodeList.pop_front();
|
const SMDS_MeshNode* n12 = nodeList.front(); nodeList.pop_front();
|
||||||
const SMDS_MeshNode* n22 = nodeList.front(); nodeList.pop_front();
|
const SMDS_MeshNode* n22 = nodeList.front(); nodeList.pop_front();
|
||||||
InsertNodesIntoLink( elem, n12, n22, nodeList, toCreatePoly );
|
InsertNodesIntoLink( elem, n12, n22, nodeList, toCreatePolygons );
|
||||||
// 2. perform insertion into the link of adjacent faces
|
// 2. perform insertion into the link of adjacent faces
|
||||||
while (true) {
|
while (true) {
|
||||||
const SMDS_MeshElement* adjElem = findAdjacentFace( n12, n22, elem );
|
const SMDS_MeshElement* adjElem = findAdjacentFace( n12, n22, elem );
|
||||||
if ( adjElem )
|
if ( adjElem )
|
||||||
InsertNodesIntoLink( adjElem, n12, n22, nodeList, toCreatePoly );
|
InsertNodesIntoLink( adjElem, n12, n22, nodeList, toCreatePolygons );
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (toCreatePolyedrs) {
|
||||||
|
// perform insertion into the links of adjacent volumes
|
||||||
|
UpdateVolumes(n12, n22, nodeList);
|
||||||
|
}
|
||||||
// 3. find an element appeared on n1 and n2 after the insertion
|
// 3. find an element appeared on n1 and n2 after the insertion
|
||||||
insertMap.erase( elem );
|
insertMap.erase( elem );
|
||||||
elem = findAdjacentFace( n1, n2, 0 );
|
elem = findAdjacentFace( n1, n2, 0 );
|
||||||
@ -3695,18 +3836,22 @@ SMESH_MeshEditor::Sew_Error
|
|||||||
const SMDS_MeshNode* n1 = nodeList.front(); nodeList.pop_front();
|
const SMDS_MeshNode* n1 = nodeList.front(); nodeList.pop_front();
|
||||||
const SMDS_MeshNode* n2 = nodeList.front(); nodeList.pop_front();
|
const SMDS_MeshNode* n2 = nodeList.front(); nodeList.pop_front();
|
||||||
|
|
||||||
InsertNodesIntoLink( elem, n1, n2, nodeList, toCreatePoly );
|
InsertNodesIntoLink( elem, n1, n2, nodeList, toCreatePolygons );
|
||||||
|
|
||||||
if ( !theSideIsFreeBorder ) {
|
if ( !theSideIsFreeBorder ) {
|
||||||
// look for and insert nodes into the faces adjacent to elem
|
// look for and insert nodes into the faces adjacent to elem
|
||||||
while (true) {
|
while (true) {
|
||||||
const SMDS_MeshElement* adjElem = findAdjacentFace( n1, n2, elem );
|
const SMDS_MeshElement* adjElem = findAdjacentFace( n1, n2, elem );
|
||||||
if ( adjElem )
|
if ( adjElem )
|
||||||
InsertNodesIntoLink( adjElem, n1, n2, nodeList, toCreatePoly );
|
InsertNodesIntoLink( adjElem, n1, n2, nodeList, toCreatePolygons );
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (toCreatePolyedrs) {
|
||||||
|
// perform insertion into the links of adjacent volumes
|
||||||
|
UpdateVolumes(n1, n2, nodeList);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // end: insert new nodes
|
} // end: insert new nodes
|
||||||
@ -3890,6 +4035,87 @@ void SMESH_MeshEditor::InsertNodesIntoLink(const SMDS_MeshElement* theFace,
|
|||||||
aMesh->ChangeElementNodes( theFace, newNodes, iSplit == iBestQuad ? 4 : 3 );
|
aMesh->ChangeElementNodes( theFace, newNodes, iSplit == iBestQuad ? 4 : 3 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
//function : UpdateVolumes
|
||||||
|
//purpose :
|
||||||
|
//=======================================================================
|
||||||
|
void SMESH_MeshEditor::UpdateVolumes (const SMDS_MeshNode* theBetweenNode1,
|
||||||
|
const SMDS_MeshNode* theBetweenNode2,
|
||||||
|
list<const SMDS_MeshNode*>& theNodesToInsert)
|
||||||
|
{
|
||||||
|
SMDS_ElemIteratorPtr invElemIt = theBetweenNode1->GetInverseElementIterator();
|
||||||
|
while (invElemIt->more()) { // loop on inverse elements of theBetweenNode1
|
||||||
|
const SMDS_MeshElement* elem = invElemIt->next();
|
||||||
|
if (elem->GetType() != SMDSAbs_Volume)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// check, if current volume has link theBetweenNode1 - theBetweenNode2
|
||||||
|
SMDS_VolumeTool aVolume (elem);
|
||||||
|
if (!aVolume.IsLinked(theBetweenNode1, theBetweenNode2))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// insert new nodes in all faces of the volume, sharing link theBetweenNode1 - theBetweenNode2
|
||||||
|
int iface, nbFaces = aVolume.NbFaces();
|
||||||
|
vector<const SMDS_MeshNode *> poly_nodes;
|
||||||
|
vector<int> quantities (nbFaces);
|
||||||
|
|
||||||
|
for (iface = 0; iface < nbFaces; iface++) {
|
||||||
|
int nbFaceNodes = aVolume.NbFaceNodes(iface), nbInserted = 0;
|
||||||
|
// faceNodes will contain (nbFaceNodes + 1) nodes, last = first
|
||||||
|
const SMDS_MeshNode** faceNodes = aVolume.GetFaceNodes(iface);
|
||||||
|
|
||||||
|
for (int inode = 0; inode < nbFaceNodes; inode++) {
|
||||||
|
poly_nodes.push_back(faceNodes[inode]);
|
||||||
|
|
||||||
|
if (nbInserted == 0) {
|
||||||
|
if (faceNodes[inode] == theBetweenNode1) {
|
||||||
|
if (faceNodes[inode + 1] == theBetweenNode2) {
|
||||||
|
nbInserted = theNodesToInsert.size();
|
||||||
|
|
||||||
|
// add nodes to insert
|
||||||
|
list<const SMDS_MeshNode*>::iterator nIt = theNodesToInsert.begin();
|
||||||
|
for (; nIt != theNodesToInsert.end(); nIt++) {
|
||||||
|
poly_nodes.push_back(*nIt);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (faceNodes[inode] == theBetweenNode2) {
|
||||||
|
if (faceNodes[inode + 1] == theBetweenNode1) {
|
||||||
|
nbInserted = theNodesToInsert.size();
|
||||||
|
|
||||||
|
// add nodes to insert in reversed order
|
||||||
|
list<const SMDS_MeshNode*>::iterator nIt = theNodesToInsert.end();
|
||||||
|
nIt--;
|
||||||
|
for (; nIt != theNodesToInsert.begin(); nIt--) {
|
||||||
|
poly_nodes.push_back(*nIt);
|
||||||
|
}
|
||||||
|
poly_nodes.push_back(*nIt);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
quantities[iface] = nbFaceNodes + nbInserted;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Replace or update the volume
|
||||||
|
SMESHDS_Mesh *aMesh = GetMeshDS();
|
||||||
|
|
||||||
|
if (elem->IsPoly()) {
|
||||||
|
aMesh->ChangePolyhedronNodes(elem, poly_nodes, quantities);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
int aShapeId = FindShape( elem );
|
||||||
|
|
||||||
|
SMDS_MeshElement* newElem =
|
||||||
|
aMesh->AddPolyhedralVolume(poly_nodes, quantities);
|
||||||
|
if (aShapeId && newElem)
|
||||||
|
aMesh->SetMeshElementOnShape(newElem, aShapeId);
|
||||||
|
|
||||||
|
aMesh->RemoveElement(elem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : SewSideElements
|
//function : SewSideElements
|
||||||
//purpose :
|
//purpose :
|
||||||
|
@ -154,6 +154,12 @@ class SMESH_MeshEditor {
|
|||||||
// Return list of group of nodes close to each other within theTolerance.
|
// Return list of group of nodes close to each other within theTolerance.
|
||||||
// Search among theNodes or in the whole mesh if theNodes is empty.
|
// Search among theNodes or in the whole mesh if theNodes is empty.
|
||||||
|
|
||||||
|
int SimplifyFace (const vector<const SMDS_MeshNode *> faceNodes,
|
||||||
|
vector<const SMDS_MeshNode *>& poly_nodes,
|
||||||
|
vector<int>& quantities) const;
|
||||||
|
// Split face, defined by <faceNodes>, into several faces by repeating nodes.
|
||||||
|
// Is used by MergeNodes()
|
||||||
|
|
||||||
void MergeNodes (TListOfListOfNodes & theNodeGroups);
|
void MergeNodes (TListOfListOfNodes & theNodeGroups);
|
||||||
// In each group, the cdr of nodes are substituted by the first one
|
// In each group, the cdr of nodes are substituted by the first one
|
||||||
// in all elements.
|
// in all elements.
|
||||||
@ -190,7 +196,8 @@ class SMESH_MeshEditor {
|
|||||||
const SMDS_MeshNode* theSide2SecondNode,
|
const SMDS_MeshNode* theSide2SecondNode,
|
||||||
const SMDS_MeshNode* theSide2ThirdNode = 0,
|
const SMDS_MeshNode* theSide2ThirdNode = 0,
|
||||||
const bool theSide2IsFreeBorder = true,
|
const bool theSide2IsFreeBorder = true,
|
||||||
const bool toCreatePoly = false);
|
const bool toCreatePolygons = false,
|
||||||
|
const bool toCreatePolyedrs = false);
|
||||||
// Sew the free border to the side2 by replacing nodes in
|
// Sew the free border to the side2 by replacing nodes in
|
||||||
// elements on the free border with nodes of the elements
|
// elements on the free border with nodes of the elements
|
||||||
// of the side 2. If nb of links in the free border and
|
// of the side 2. If nb of links in the free border and
|
||||||
@ -232,6 +239,12 @@ class SMESH_MeshEditor {
|
|||||||
// insert theNodesToInsert into theFace between theBetweenNode1 and theBetweenNode2.
|
// insert theNodesToInsert into theFace between theBetweenNode1 and theBetweenNode2.
|
||||||
// If toCreatePoly is true, replace theFace by polygon, else split theFace.
|
// If toCreatePoly is true, replace theFace by polygon, else split theFace.
|
||||||
|
|
||||||
|
void UpdateVolumes (const SMDS_MeshNode* theBetweenNode1,
|
||||||
|
const SMDS_MeshNode* theBetweenNode2,
|
||||||
|
std::list<const SMDS_MeshNode*>& theNodesToInsert);
|
||||||
|
// insert theNodesToInsert into all volumes, containing link
|
||||||
|
// theBetweenNode1 - theBetweenNode2, between theBetweenNode1 and theBetweenNode2.
|
||||||
|
|
||||||
// static int SortQuadNodes (const SMDS_Mesh * theMesh,
|
// static int SortQuadNodes (const SMDS_Mesh * theMesh,
|
||||||
// int theNodeIds[] );
|
// int theNodeIds[] );
|
||||||
// // Set 4 nodes of a quadrangle face in a good order.
|
// // Set 4 nodes of a quadrangle face in a good order.
|
||||||
|
@ -3138,7 +3138,9 @@ bool SMESH_Pattern::Apply (const SMDS_MeshVolume* theVolume,
|
|||||||
// coordinates computed by either of Apply...() methods
|
// coordinates computed by either of Apply...() methods
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
bool SMESH_Pattern::MakeMesh (SMESH_Mesh* theMesh, bool toCreatePoly)
|
bool SMESH_Pattern::MakeMesh (SMESH_Mesh* theMesh,
|
||||||
|
const bool toCreatePolygons,
|
||||||
|
const bool toCreatePolyedrs)
|
||||||
{
|
{
|
||||||
MESSAGE(" ::MakeMesh() " );
|
MESSAGE(" ::MakeMesh() " );
|
||||||
if ( !myIsComputed )
|
if ( !myIsComputed )
|
||||||
@ -3371,13 +3373,14 @@ bool SMESH_Pattern::MakeMesh (SMESH_Mesh* theMesh, bool toCreatePoly)
|
|||||||
editor.Remove( elemIDs, false );
|
editor.Remove( elemIDs, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (toCreatePoly && myIs2D) {
|
if (toCreatePolygons) {
|
||||||
// replace adjacent faces by polygons, inserting nodes in common link
|
// replace adjacent faces by polygons, inserting nodes in common link
|
||||||
|
|
||||||
map< TNodeSet, list< list<int> > >::iterator linksIt;
|
map< TNodeSet, list< list<int> > >::iterator linksIt;
|
||||||
for (linksIt = myLinks.begin(); linksIt != myLinks.end(); linksIt++) {
|
for (linksIt = myLinks.begin(); linksIt != myLinks.end(); linksIt++) {
|
||||||
// end nodes of link
|
// end nodes of link
|
||||||
set<const SMDS_MeshNode*> ends = linksIt->first;
|
set<const SMDS_MeshNode*> ends = linksIt->first;
|
||||||
|
if (ends.size() < 2) continue;
|
||||||
set<const SMDS_MeshNode*>::iterator endsIt = ends.begin();
|
set<const SMDS_MeshNode*>::iterator endsIt = ends.begin();
|
||||||
const SMDS_MeshNode* n1 = *endsIt;
|
const SMDS_MeshNode* n1 = *endsIt;
|
||||||
endsIt++;
|
endsIt++;
|
||||||
@ -3403,13 +3406,17 @@ bool SMESH_Pattern::MakeMesh (SMESH_Mesh* theMesh, bool toCreatePoly)
|
|||||||
SMESH_MeshEditor::FindFaceInSet(n1, n2, elemSet, avoidSet);
|
SMESH_MeshEditor::FindFaceInSet(n1, n2, elemSet, avoidSet);
|
||||||
if (adjElem) {
|
if (adjElem) {
|
||||||
SMESH_MeshEditor editor (theMesh);
|
SMESH_MeshEditor editor (theMesh);
|
||||||
editor.InsertNodesIntoLink(adjElem, n1, n2, link_nodes, toCreatePoly);
|
editor.InsertNodesIntoLink(adjElem, n1, n2, link_nodes, toCreatePolygons);
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (toCreatePolyedrs) {
|
||||||
|
// replace adjacent volumes by polyedres, inserting nodes in common link
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
return setErrorCode( ERR_OK );
|
return setErrorCode( ERR_OK );
|
||||||
}
|
}
|
||||||
|
@ -128,7 +128,9 @@ class SMESH_Pattern {
|
|||||||
bool GetMappedPoints ( std::list<const gp_XYZ *> & thePoints ) const;
|
bool GetMappedPoints ( std::list<const gp_XYZ *> & thePoints ) const;
|
||||||
// Return nodes coordinates computed by Apply() method
|
// Return nodes coordinates computed by Apply() method
|
||||||
|
|
||||||
bool MakeMesh (SMESH_Mesh* theMesh, bool toCreatePoly = false);
|
bool MakeMesh (SMESH_Mesh* theMesh,
|
||||||
|
const bool toCreatePolygons = false,
|
||||||
|
const bool toCreatePolyedrs = false);
|
||||||
// Create nodes and elements in <theMesh> using nodes
|
// Create nodes and elements in <theMesh> using nodes
|
||||||
// coordinates computed by either of Apply...() methods
|
// coordinates computed by either of Apply...() methods
|
||||||
|
|
||||||
|
@ -207,7 +207,8 @@ QFrame* SMESHGUI_MeshPatternDlg::createMainFrame( QWidget* theParent )
|
|||||||
myReverseChk = new QCheckBox( tr( "REVERSE" ), aPatGrp );
|
myReverseChk = new QCheckBox( tr( "REVERSE" ), aPatGrp );
|
||||||
|
|
||||||
// CreatePoly check box
|
// CreatePoly check box
|
||||||
myCreatePolyChk = new QCheckBox( tr( "CREATE_POLYGONS_NEAR_BOUNDARY" ), aPatGrp );
|
myCreatePolygonsChk = new QCheckBox( tr( "CREATE_POLYGONS_NEAR_BOUNDARY" ), aPatGrp );
|
||||||
|
myCreatePolyedrsChk = new QCheckBox( tr( "CREATE_POLYEDRS_NEAR_BOUNDARY" ), aPatGrp );
|
||||||
|
|
||||||
// Pictures 2d and 3d
|
// Pictures 2d and 3d
|
||||||
for ( int i = 0; i < 2; i++ )
|
for ( int i = 0; i < 2; i++ )
|
||||||
@ -392,9 +393,10 @@ bool SMESHGUI_MeshPatternDlg::onApply()
|
|||||||
myGeomObj[ Object ], myGeomObj[ Vertex1 ], myGeomObj[ Vertex2 ] );
|
myGeomObj[ Object ], myGeomObj[ Vertex1 ], myGeomObj[ Vertex2 ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool toCreatePoly = (myCreatePolyChk->isChecked() && (myType == Type_2d));
|
bool toCreatePolygons = myCreatePolygonsChk->isChecked();
|
||||||
|
bool toCreatePolyedrs = myCreatePolyedrsChk->isChecked();
|
||||||
|
|
||||||
if ( myPattern->MakeMesh( myMesh, toCreatePoly ) )
|
if ( myPattern->MakeMesh( myMesh, toCreatePolygons, toCreatePolyedrs ) )
|
||||||
{
|
{
|
||||||
mySelection->ClearIObjects();
|
mySelection->ClearIObjects();
|
||||||
SMESHGUI* aCompGUI = SMESHGUI::GetSMESHGUI();
|
SMESHGUI* aCompGUI = SMESHGUI::GetSMESHGUI();
|
||||||
@ -1119,6 +1121,9 @@ void SMESHGUI_MeshPatternDlg::onTypeChanged( int theType )
|
|||||||
mySelEdit[ Vertex2 ]->setText( "" );
|
mySelEdit[ Vertex2 ]->setText( "" );
|
||||||
mySelEdit[ Ids ] ->setText( "" );
|
mySelEdit[ Ids ] ->setText( "" );
|
||||||
|
|
||||||
|
myCreatePolygonsChk->show();
|
||||||
|
myCreatePolyedrsChk->show();
|
||||||
|
|
||||||
if ( theType == Type_2d )
|
if ( theType == Type_2d )
|
||||||
{
|
{
|
||||||
// Geom widgets
|
// Geom widgets
|
||||||
@ -1126,7 +1131,6 @@ void SMESHGUI_MeshPatternDlg::onTypeChanged( int theType )
|
|||||||
mySelBtn [ Vertex2 ]->hide();
|
mySelBtn [ Vertex2 ]->hide();
|
||||||
mySelEdit[ Vertex2 ]->hide();
|
mySelEdit[ Vertex2 ]->hide();
|
||||||
myReverseChk->show();
|
myReverseChk->show();
|
||||||
myCreatePolyChk->show();
|
|
||||||
myPicture2d->show();
|
myPicture2d->show();
|
||||||
myPicture3d->hide();
|
myPicture3d->hide();
|
||||||
mySelLbl[ Object ]->setText( tr( "FACE" ) );
|
mySelLbl[ Object ]->setText( tr( "FACE" ) );
|
||||||
@ -1143,7 +1147,6 @@ void SMESHGUI_MeshPatternDlg::onTypeChanged( int theType )
|
|||||||
mySelBtn [ Vertex2 ]->show();
|
mySelBtn [ Vertex2 ]->show();
|
||||||
mySelEdit[ Vertex2 ]->show();
|
mySelEdit[ Vertex2 ]->show();
|
||||||
myReverseChk->hide();
|
myReverseChk->hide();
|
||||||
myCreatePolyChk->hide();
|
|
||||||
myPicture2d->hide();
|
myPicture2d->hide();
|
||||||
myPicture3d->show();
|
myPicture3d->show();
|
||||||
mySelLbl[ Object ]->setText( tr( "3D_BLOCK" ) );
|
mySelLbl[ Object ]->setText( tr( "3D_BLOCK" ) );
|
||||||
|
@ -145,7 +145,8 @@ private:
|
|||||||
QPushButton* myNewBtn;
|
QPushButton* myNewBtn;
|
||||||
|
|
||||||
QCheckBox* myReverseChk;
|
QCheckBox* myReverseChk;
|
||||||
QCheckBox* myCreatePolyChk;
|
QCheckBox* myCreatePolygonsChk;
|
||||||
|
QCheckBox* myCreatePolyedrsChk;
|
||||||
SMESHGUI_PatternWidget* myPicture2d;
|
SMESHGUI_PatternWidget* myPicture2d;
|
||||||
QFrame* myPicture3d;
|
QFrame* myPicture3d;
|
||||||
QLabel* myPreview3d;
|
QLabel* myPreview3d;
|
||||||
|
@ -246,9 +246,14 @@ SMESHGUI_SewingDlg::SMESHGUI_SewingDlg( QWidget* parent, const char* name, SALOM
|
|||||||
GroupArgumentsLayout->addWidget( CheckBoxMerge, 2, 0 );
|
GroupArgumentsLayout->addWidget( CheckBoxMerge, 2, 0 );
|
||||||
|
|
||||||
// Control for the polygons creation instead of splitting
|
// Control for the polygons creation instead of splitting
|
||||||
CheckBoxPoly = new QCheckBox( GroupArguments, "CheckBoxPoly" );
|
CheckBoxPolygons = new QCheckBox( GroupArguments, "CheckBoxPolygons" );
|
||||||
CheckBoxPoly->setText( tr( "CREATE_POLYGONS_INSTEAD_SPLITTING" ) );
|
CheckBoxPolygons->setText( tr( "CREATE_POLYGONS_INSTEAD_SPLITTING" ) );
|
||||||
GroupArgumentsLayout->addWidget( CheckBoxPoly, 3, 0 );
|
GroupArgumentsLayout->addWidget( CheckBoxPolygons, 3, 0 );
|
||||||
|
|
||||||
|
// Control for the polyedres creation to obtain conform mesh
|
||||||
|
CheckBoxPolyedrs = new QCheckBox( GroupArguments, "CheckBoxPolyedrs" );
|
||||||
|
CheckBoxPolyedrs->setText( tr( "CREATE_POLYEDRS_NEAR_BOUNDARY" ) );
|
||||||
|
GroupArgumentsLayout->addWidget( CheckBoxPolyedrs, 4, 0 );
|
||||||
|
|
||||||
|
|
||||||
SMESHGUI_SewingDlgLayout->addWidget( GroupArguments, 1, 0 );
|
SMESHGUI_SewingDlgLayout->addWidget( GroupArguments, 1, 0 );
|
||||||
@ -325,7 +330,8 @@ void SMESHGUI_SewingDlg::Init()
|
|||||||
myActor = 0;
|
myActor = 0;
|
||||||
myMesh = SMESH::SMESH_Mesh::_nil();
|
myMesh = SMESH::SMESH_Mesh::_nil();
|
||||||
CheckBoxMerge->setChecked(false);
|
CheckBoxMerge->setChecked(false);
|
||||||
CheckBoxPoly->setChecked(false);
|
CheckBoxPolygons->setChecked(false);
|
||||||
|
CheckBoxPolyedrs->setChecked(false);
|
||||||
SelectionIntoArgument();
|
SelectionIntoArgument();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -361,8 +367,12 @@ void SMESHGUI_SewingDlg::ConstructorsClicked(int constructorId)
|
|||||||
LineEdit6->setEnabled(true);
|
LineEdit6->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (constructorId != 0 && CheckBoxPoly->isVisible())
|
if (constructorId == 1 || constructorId == 3) {
|
||||||
CheckBoxPoly->hide();
|
if (CheckBoxPolygons->isVisible())
|
||||||
|
CheckBoxPolygons->hide();
|
||||||
|
if (CheckBoxPolyedrs->isVisible())
|
||||||
|
CheckBoxPolyedrs->hide();
|
||||||
|
}
|
||||||
|
|
||||||
switch(constructorId)
|
switch(constructorId)
|
||||||
{
|
{
|
||||||
@ -372,8 +382,10 @@ void SMESHGUI_SewingDlg::ConstructorsClicked(int constructorId)
|
|||||||
SubGroup1->setTitle( tr( "BORDER_1" ) );
|
SubGroup1->setTitle( tr( "BORDER_1" ) );
|
||||||
SubGroup2->setTitle( tr( "BORDER_2" ) );
|
SubGroup2->setTitle( tr( "BORDER_2" ) );
|
||||||
|
|
||||||
if (!CheckBoxPoly->isVisible())
|
if (!CheckBoxPolygons->isVisible())
|
||||||
CheckBoxPoly->show();
|
CheckBoxPolygons->show();
|
||||||
|
if (!CheckBoxPolyedrs->isVisible())
|
||||||
|
CheckBoxPolyedrs->show();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -401,8 +413,10 @@ void SMESHGUI_SewingDlg::ConstructorsClicked(int constructorId)
|
|||||||
SelectButton5->setEnabled(false);
|
SelectButton5->setEnabled(false);
|
||||||
LineEdit5->setEnabled(false);
|
LineEdit5->setEnabled(false);
|
||||||
|
|
||||||
if (!CheckBoxPoly->isVisible())
|
if (!CheckBoxPolygons->isVisible())
|
||||||
CheckBoxPoly->show();
|
CheckBoxPolygons->show();
|
||||||
|
if (!CheckBoxPolyedrs->isVisible())
|
||||||
|
CheckBoxPolyedrs->show();
|
||||||
|
|
||||||
myOk5 = true;
|
myOk5 = true;
|
||||||
|
|
||||||
@ -464,7 +478,8 @@ bool SMESHGUI_SewingDlg::ClickOnApply()
|
|||||||
if ( IsValid() )
|
if ( IsValid() )
|
||||||
{
|
{
|
||||||
bool toMerge = CheckBoxMerge->isChecked();
|
bool toMerge = CheckBoxMerge->isChecked();
|
||||||
bool toCreatePoly = CheckBoxPoly->isChecked();
|
bool toCreatePolygons = CheckBoxPolygons->isChecked();
|
||||||
|
bool toCreatePolyedrs = CheckBoxPolyedrs->isChecked();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -481,7 +496,8 @@ bool SMESHGUI_SewingDlg::ClickOnApply()
|
|||||||
LineEdit4->text().toLong(),
|
LineEdit4->text().toLong(),
|
||||||
LineEdit5->text().toLong(),
|
LineEdit5->text().toLong(),
|
||||||
LineEdit6->text().toLong(),
|
LineEdit6->text().toLong(),
|
||||||
toCreatePoly);
|
toCreatePolygons,
|
||||||
|
toCreatePolyedrs);
|
||||||
else if (aConstructorId == 1)
|
else if (aConstructorId == 1)
|
||||||
anError = aMeshEditor->SewConformFreeBorders(LineEdit1->text().toLong(),
|
anError = aMeshEditor->SewConformFreeBorders(LineEdit1->text().toLong(),
|
||||||
LineEdit2->text().toLong(),
|
LineEdit2->text().toLong(),
|
||||||
@ -494,7 +510,8 @@ bool SMESHGUI_SewingDlg::ClickOnApply()
|
|||||||
LineEdit3->text().toLong(),
|
LineEdit3->text().toLong(),
|
||||||
LineEdit4->text().toLong(),
|
LineEdit4->text().toLong(),
|
||||||
LineEdit6->text().toLong(),
|
LineEdit6->text().toLong(),
|
||||||
toCreatePoly);
|
toCreatePolygons,
|
||||||
|
toCreatePolyedrs);
|
||||||
else if (aConstructorId == 3)
|
else if (aConstructorId == 3)
|
||||||
{
|
{
|
||||||
QStringList aListElementsId1 = QStringList::split( " ", LineEdit1->text(), false);
|
QStringList aListElementsId1 = QStringList::split( " ", LineEdit1->text(), false);
|
||||||
|
@ -111,7 +111,8 @@ private:
|
|||||||
QLineEdit* LineEdit5;
|
QLineEdit* LineEdit5;
|
||||||
QLineEdit* LineEdit6;
|
QLineEdit* LineEdit6;
|
||||||
QCheckBox* CheckBoxMerge;
|
QCheckBox* CheckBoxMerge;
|
||||||
QCheckBox* CheckBoxPoly;
|
QCheckBox* CheckBoxPolygons;
|
||||||
|
QCheckBox* CheckBoxPolyedrs;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
|
@ -190,13 +190,11 @@ CORBA::Boolean SMESH_MeshEditor_i::AddPolyhedralVolume
|
|||||||
{
|
{
|
||||||
int NbNodes = IDsOfNodes.length();
|
int NbNodes = IDsOfNodes.length();
|
||||||
std::vector<const SMDS_MeshNode*> n (NbNodes);
|
std::vector<const SMDS_MeshNode*> n (NbNodes);
|
||||||
//const SMDS_MeshNode* n [NbNodes];
|
|
||||||
for (int i = 0; i < NbNodes; i++)
|
for (int i = 0; i < NbNodes; i++)
|
||||||
n[i] = GetMeshDS()->FindNode(IDsOfNodes[i]);
|
n[i] = GetMeshDS()->FindNode(IDsOfNodes[i]);
|
||||||
|
|
||||||
int NbFaces = Quantities.length();
|
int NbFaces = Quantities.length();
|
||||||
std::vector<int> q (NbFaces);
|
std::vector<int> q (NbFaces);
|
||||||
//int q [NbFaces];
|
|
||||||
for (int j = 0; j < NbFaces; j++)
|
for (int j = 0; j < NbFaces; j++)
|
||||||
q[j] = Quantities[j];
|
q[j] = Quantities[j];
|
||||||
|
|
||||||
@ -213,13 +211,22 @@ CORBA::Boolean SMESH_MeshEditor_i::AddPolyhedralVolumeByFaces
|
|||||||
(const SMESH::long_array & IdsOfFaces)
|
(const SMESH::long_array & IdsOfFaces)
|
||||||
{
|
{
|
||||||
int NbFaces = IdsOfFaces.length();
|
int NbFaces = IdsOfFaces.length();
|
||||||
std::vector<const SMDS_MeshFace*> faces (NbFaces);
|
std::vector<const SMDS_MeshNode*> poly_nodes;
|
||||||
for (int i = 0; i < NbFaces; i++)
|
std::vector<int> quantities (NbFaces);
|
||||||
faces[i] = (SMDS_MeshFace *)GetMeshDS()->FindElement(IdsOfFaces[i]);
|
|
||||||
|
|
||||||
//GetMeshDS()->AddPolyhedralVolumeByFaces(faces);
|
std::vector<const SMDS_MeshFace*> faces (NbFaces);
|
||||||
//return true;
|
for (int i = 0; i < NbFaces; i++) {
|
||||||
return false;
|
const SMDS_MeshElement* aFace = GetMeshDS()->FindElement(IdsOfFaces[i]);
|
||||||
|
quantities[i] = aFace->NbNodes();
|
||||||
|
|
||||||
|
SMDS_ElemIteratorPtr It = aFace->nodesIterator();
|
||||||
|
while (It->more()) {
|
||||||
|
poly_nodes.push_back(static_cast<const SMDS_MeshNode *>(It->next()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
GetMeshDS()->AddPolyhedralVolume(poly_nodes, quantities);
|
||||||
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
@ -917,7 +924,8 @@ SMESH::SMESH_MeshEditor::Sew_Error
|
|||||||
CORBA::Long FirstNodeID2,
|
CORBA::Long FirstNodeID2,
|
||||||
CORBA::Long SecondNodeID2,
|
CORBA::Long SecondNodeID2,
|
||||||
CORBA::Long LastNodeID2,
|
CORBA::Long LastNodeID2,
|
||||||
CORBA::Boolean CreatePoly)
|
CORBA::Boolean CreatePolygons,
|
||||||
|
CORBA::Boolean CreatePolyedrs)
|
||||||
{
|
{
|
||||||
SMESHDS_Mesh* aMesh = GetMeshDS();
|
SMESHDS_Mesh* aMesh = GetMeshDS();
|
||||||
|
|
||||||
@ -945,7 +953,8 @@ SMESH::SMESH_MeshEditor::Sew_Error
|
|||||||
aSide2SecondNode,
|
aSide2SecondNode,
|
||||||
aSide2ThirdNode,
|
aSide2ThirdNode,
|
||||||
true,
|
true,
|
||||||
CreatePoly) );
|
CreatePolygons,
|
||||||
|
CreatePolyedrs) );
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -985,7 +994,7 @@ SMESH::SMESH_MeshEditor::Sew_Error
|
|||||||
aSide2SecondNode,
|
aSide2SecondNode,
|
||||||
aSide2ThirdNode,
|
aSide2ThirdNode,
|
||||||
true,
|
true,
|
||||||
false) );
|
false, false) );
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
@ -999,7 +1008,8 @@ SMESH::SMESH_MeshEditor::Sew_Error
|
|||||||
CORBA::Long LastNodeIDOnFreeBorder,
|
CORBA::Long LastNodeIDOnFreeBorder,
|
||||||
CORBA::Long FirstNodeIDOnSide,
|
CORBA::Long FirstNodeIDOnSide,
|
||||||
CORBA::Long LastNodeIDOnSide,
|
CORBA::Long LastNodeIDOnSide,
|
||||||
CORBA::Boolean CreatePoly)
|
CORBA::Boolean CreatePolygons,
|
||||||
|
CORBA::Boolean CreatePolyedrs)
|
||||||
{
|
{
|
||||||
SMESHDS_Mesh* aMesh = GetMeshDS();
|
SMESHDS_Mesh* aMesh = GetMeshDS();
|
||||||
|
|
||||||
@ -1026,7 +1036,8 @@ SMESH::SMESH_MeshEditor::Sew_Error
|
|||||||
aSide2SecondNode,
|
aSide2SecondNode,
|
||||||
aSide2ThirdNode,
|
aSide2ThirdNode,
|
||||||
false,
|
false,
|
||||||
CreatePoly) );
|
CreatePolygons,
|
||||||
|
CreatePolyedrs) );
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
@ -165,7 +165,8 @@ class SMESH_MeshEditor_i: public POA_SMESH::SMESH_MeshEditor
|
|||||||
CORBA::Long FirstNodeID2,
|
CORBA::Long FirstNodeID2,
|
||||||
CORBA::Long SecondNodeID2,
|
CORBA::Long SecondNodeID2,
|
||||||
CORBA::Long LastNodeID2,
|
CORBA::Long LastNodeID2,
|
||||||
CORBA::Boolean CreatePoly);
|
CORBA::Boolean CreatePolygons,
|
||||||
|
CORBA::Boolean CreatePolyedrs);
|
||||||
SMESH::SMESH_MeshEditor::Sew_Error
|
SMESH::SMESH_MeshEditor::Sew_Error
|
||||||
SewConformFreeBorders(CORBA::Long FirstNodeID1,
|
SewConformFreeBorders(CORBA::Long FirstNodeID1,
|
||||||
CORBA::Long SecondNodeID1,
|
CORBA::Long SecondNodeID1,
|
||||||
@ -178,7 +179,8 @@ class SMESH_MeshEditor_i: public POA_SMESH::SMESH_MeshEditor
|
|||||||
CORBA::Long LastNodeIDOnFreeBorder,
|
CORBA::Long LastNodeIDOnFreeBorder,
|
||||||
CORBA::Long FirstNodeIDOnSide,
|
CORBA::Long FirstNodeIDOnSide,
|
||||||
CORBA::Long LastNodeIDOnSide,
|
CORBA::Long LastNodeIDOnSide,
|
||||||
CORBA::Boolean CreatePoly);
|
CORBA::Boolean CreatePolygons,
|
||||||
|
CORBA::Boolean CreatePolyedrs);
|
||||||
SMESH::SMESH_MeshEditor::Sew_Error
|
SMESH::SMESH_MeshEditor::Sew_Error
|
||||||
SewSideElements(const SMESH::long_array& IDsOfSide1Elements,
|
SewSideElements(const SMESH::long_array& IDsOfSide1Elements,
|
||||||
const SMESH::long_array& IDsOfSide2Elements,
|
const SMESH::long_array& IDsOfSide2Elements,
|
||||||
|
@ -297,13 +297,14 @@ SMESH::point_array*
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
CORBA::Boolean SMESH_Pattern_i::MakeMesh (SMESH::SMESH_Mesh_ptr theMesh,
|
CORBA::Boolean SMESH_Pattern_i::MakeMesh (SMESH::SMESH_Mesh_ptr theMesh,
|
||||||
const CORBA::Boolean CreatePoly)
|
const CORBA::Boolean CreatePolygons,
|
||||||
|
const CORBA::Boolean CreatePolyedrs)
|
||||||
{
|
{
|
||||||
::SMESH_Mesh* aMesh = getMesh( theMesh );
|
::SMESH_Mesh* aMesh = getMesh( theMesh );
|
||||||
if ( !aMesh )
|
if ( !aMesh )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return myPattern.MakeMesh( aMesh, CreatePoly );
|
return myPattern.MakeMesh( aMesh, CreatePolygons, CreatePolyedrs );
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
@ -76,7 +76,8 @@ class SMESH_Pattern_i:
|
|||||||
CORBA::Long theNode001Index);
|
CORBA::Long theNode001Index);
|
||||||
|
|
||||||
CORBA::Boolean MakeMesh (SMESH::SMESH_Mesh_ptr theMesh,
|
CORBA::Boolean MakeMesh (SMESH::SMESH_Mesh_ptr theMesh,
|
||||||
const CORBA::Boolean CreatePoly);
|
const CORBA::Boolean CreatePolygons,
|
||||||
|
const CORBA::Boolean CreatePolyedrs);
|
||||||
|
|
||||||
SMESH::SMESH_Pattern::ErrorCode GetErrorCode();
|
SMESH::SMESH_Pattern::ErrorCode GetErrorCode();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user