* \brief Reorient faces.
* \param theFaces - the faces to reorient. If empty the whole mesh is meant
* \param theDirection - desired direction of normal of \a theFace
- * \param theFace - one of \a theFaces that sould be oriented according to
+ * \param theFace - one of \a theFaces that should be oriented according to
* \a theDirection and whose orientation defines orientation of other faces
* \return number of reoriented faces.
*/
}
else
{
- // among possible triangles create ones discribed by split method
+ // among possible triangles create ones described by split method
const int* nInd = volTool.GetFaceNodesIndices( iF );
int nbVariants = ( nbNodes == 4 ? 2 : nbNodes );
int iCom = 0; // common node of triangle faces to split into
// Fill theFacets starting from facetID of startHex
- // facets used for seach of volumes adjacent to already treated ones
+ // facets used for searching of volumes adjacent to already treated ones
typedef pair< TFacetOfElem::iterator, int > TElemFacets;
typedef map< TVolumeFaceKey, TElemFacets > TFacetMap;
TFacetMap facetsToCheck;
}
}
if ( maxRatio <= theTgtAspectRatio ) {
- MESSAGE("-- quality achived --");
+ //MESSAGE("-- quality achieved --");
break;
}
if (it+1 == theNbIterations) {
- MESSAGE("-- Iteration limit exceeded --");
+ //MESSAGE("-- Iteration limit exceeded --");
}
} // smoothing iterations
- MESSAGE(" Face id: " << *fId <<
- " Nb iterstions: " << it <<
- " Displacement: " << maxDisplacement <<
- " Aspect Ratio " << maxRatio);
+ // MESSAGE(" Face id: " << *fId <<
+ // " Nb iterstions: " << it <<
+ // " Displacement: " << maxDisplacement <<
+ // " Aspect Ratio " << maxRatio);
// ---------------------------------------
// new nodes positions are computed,
std::swap( itNN[0], itNN[1] );
std::swap( prevNod[0], prevNod[1] );
std::swap( nextNod[0], nextNod[1] );
+#if defined(__APPLE__)
+ std::swap( isSingleNode[0], isSingleNode[1] );
+#else
isSingleNode.swap( isSingleNode[0], isSingleNode[1] );
+#endif
if ( nbSame > 0 )
sames[0] = 1 - sames[0];
iNotSameNode = 1 - iNotSameNode;
//=======================================================================
//function : MakeEdgePathPoints
-//purpose : auxilary for ExtrusionAlongTrack
+//purpose : auxiliary for ExtrusionAlongTrack
//=======================================================================
SMESH_MeshEditor::Extrusion_Error
SMESH_MeshEditor::MakeEdgePathPoints(std::list<double>& aPrms,
//=======================================================================
//function : MakeExtrElements
-//purpose : auxilary for ExtrusionAlongTrack
+//purpose : auxiliary for ExtrusionAlongTrack
//=======================================================================
SMESH_MeshEditor::Extrusion_Error
SMESH_MeshEditor::MakeExtrElements(TIDSortedElemSet theElemSets[2],
// in all elements.
//=======================================================================
-void SMESH_MeshEditor::MergeNodes (TListOfListOfNodes & theGroupsOfNodes)
+void SMESH_MeshEditor::MergeNodes (TListOfListOfNodes & theGroupsOfNodes,
+ const bool theAvoidMakingHoles)
{
myLastCreatedElems.Clear();
myLastCreatedNodes.Clear();
// -------------------------------------------------------------------------
// 1. Since sewing may break if there are volumes to split on the side 2,
- // we wont move nodes but just compute new coordinates for them
+ // we won't move nodes but just compute new coordinates for them
typedef map<const SMDS_MeshNode*, gp_XYZ> TNodeXYZMap;
TNodeXYZMap nBordXYZ;
list< const SMDS_MeshNode* >& bordNodes = nSide[ 0 ];
} // loop on inverse elements of prevSideNode
if ( !sideNode ) {
- MESSAGE(" Cant find path by links of the Side 2 ");
+ MESSAGE(" Can't find path by links of the Side 2 ");
return SEW_BAD_SIDE_NODES;
}
sideNodes.push_back( sideNode );
// remove a linear element
GetMeshDS()->RemoveFreeElement(elem, theSm, /*fromGroups=*/false);
- // remove central nodes of biquadratic elements (biquad->quad convertion)
+ // remove central nodes of biquadratic elements (biquad->quad conversion)
if ( hasCentralNodes )
for ( size_t i = nbNodes * 2; i < nodes.size(); ++i )
if ( nodes[i]->NbInverseElements() == 0 )
// face does not exist
SMESHDS_Mesh* aMesh = GetMeshDS();
- // TODO algoritm not OK with vtkUnstructuredGrid: 2 meshes can't share nodes
+ // TODO algorithm not OK with vtkUnstructuredGrid: 2 meshes can't share nodes
//SMDS_Mesh aTmpFacesMesh; // try to use the same mesh
TIDSortedElemSet faceSet1, faceSet2;
set<const SMDS_MeshElement*> volSet1, volSet2;
bool createJointElems,
bool onAllBoundaries)
{
- MESSAGE("----------------------------------------------");
- MESSAGE("SMESH_MeshEditor::doubleNodesOnGroupBoundaries");
- MESSAGE("----------------------------------------------");
+ // MESSAGE("----------------------------------------------");
+ // MESSAGE("SMESH_MeshEditor::doubleNodesOnGroupBoundaries");
+ // MESSAGE("----------------------------------------------");
SMESHDS_Mesh *meshDS = this->myMesh->GetMeshDS();
meshDS->BuildDownWardConnectivity(true);
std::set<int> emptySet;
emptyMap.clear();
- MESSAGE(".. Number of domains :"<<theElems.size());
+ //MESSAGE(".. Number of domains :"<<theElems.size());
TIDSortedElemSet theRestDomElems;
const int iRestDom = -1;
// and corresponding volume of this domain, for each shared face.
// a volume has a face shared by 2 domains if it has a neighbor which is not in his domain.
- MESSAGE("... Neighbors of domain #" << idom);
+ //MESSAGE("... Neighbors of domain #" << idom);
const TIDSortedElemSet& domain = theElems[idom];
TIDSortedElemSet::const_iterator elemItr = domain.begin();
for (; elemItr != domain.end(); ++elemItr)
std::map<int, std::vector<int> > mutipleNodes; // nodes multi domains with domain order
std::map<int, std::vector<int> > mutipleNodesToFace; // nodes multi domains with domain order to transform in Face (junction between 3 or more 2D domains)
- MESSAGE(".. Duplication of the nodes");
+ //MESSAGE(".. Duplication of the nodes");
for (int idomain = idom0; idomain < nbDomains; idomain++)
{
itface = faceDomains.begin();
}
}
- MESSAGE(".. Creation of elements");
+ //MESSAGE(".. Creation of elements");
for (int idomain = idom0; idomain < nbDomains; idomain++)
{
itface = faceDomains.begin();
std::map<int, std::map<long,int> > nodeQuadDomains;
std::map<std::string, SMESH_Group*> mapOfJunctionGroups;
- MESSAGE(".. Creation of elements: simple junction");
+ //MESSAGE(".. Creation of elements: simple junction");
if (createJointElems)
{
int idg;
// iterate on mutipleNodesToFace
// iterate on edgesMultiDomains
- MESSAGE(".. Creation of elements: multiple junction");
+ //MESSAGE(".. Creation of elements: multiple junction");
if (createJointElems)
{
// --- iterate on mutipleNodesToFace
faceOrEdgeDom.clear();
feDom.clear();
- MESSAGE(".. Modification of elements");
+ //MESSAGE(".. Modification of elements");
for (int idomain = idom0; idomain < nbDomains; idomain++)
{
std::map<int, std::map<int, int> >::const_iterator itnod = nodeDomains.begin();
*/
bool SMESH_MeshEditor::CreateFlatElementsOnFacesGroups(const std::vector<TIDSortedElemSet>& theElems)
{
- MESSAGE("-------------------------------------------------");
- MESSAGE("SMESH_MeshEditor::CreateFlatElementsOnFacesGroups");
- MESSAGE("-------------------------------------------------");
+ // MESSAGE("-------------------------------------------------");
+ // MESSAGE("SMESH_MeshEditor::CreateFlatElementsOnFacesGroups");
+ // MESSAGE("-------------------------------------------------");
SMESHDS_Mesh *meshDS = this->myMesh->GetMeshDS();
std::vector<double>& nodesCoords,
std::vector<std::vector<int> >& listOfListOfNodes)
{
- MESSAGE("--------------------------------");
- MESSAGE("SMESH_MeshEditor::CreateHoleSkin");
- MESSAGE("--------------------------------");
+ // MESSAGE("--------------------------------");
+ // MESSAGE("SMESH_MeshEditor::CreateHoleSkin");
+ // MESSAGE("--------------------------------");
// --- zone of volumes to remove is given :
// 1 either by a geom shape (one or more vertices) and a radius,
if (isNodeGroup) // --- a group of nodes is provided : find all the volumes using one or more of this nodes
{
- MESSAGE("group of nodes provided");
+ //MESSAGE("group of nodes provided");
SMDS_ElemIteratorPtr elemIt = groupDS->GetElements();
while ( elemIt->more() )
{
}
else if (isNodeCoords)
{
- MESSAGE("list of nodes coordinates provided");
+ //MESSAGE("list of nodes coordinates provided");
size_t i = 0;
int k = 0;
while ( i < nodesCoords.size()-2 )
double z = nodesCoords[i++];
gp_Pnt p = gp_Pnt(x, y ,z);
gpnts.push_back(p);
- MESSAGE("TopoDS_Vertex " << k << " " << p.X() << " " << p.Y() << " " << p.Z());
+ //MESSAGE("TopoDS_Vertex " << k << " " << p.X() << " " << p.Y() << " " << p.Z());
k++;
}
}
else // --- no group, no coordinates : use the vertices of the geom shape provided, and radius
{
- MESSAGE("no group of nodes provided, using vertices from geom shape, and radius");
+ //MESSAGE("no group of nodes provided, using vertices from geom shape, and radius");
TopTools_IndexedMapOfShape vertexMap;
TopExp::MapShapes( theShape, TopAbs_VERTEX, vertexMap );
gp_Pnt p = gp_Pnt(0,0,0);
const TopoDS_Vertex& vertex = TopoDS::Vertex( vertexMap( i ));
p = BRep_Tool::Pnt(vertex);
gpnts.push_back(p);
- MESSAGE("TopoDS_Vertex " << i << " " << p.X() << " " << p.Y() << " " << p.Z());
+ //MESSAGE("TopoDS_Vertex " << i << " " << p.X() << " " << p.Y() << " " << p.Z());
}
}
if (gpnts.size() > 0)
{
- int nodeId = 0;
const SMDS_MeshNode* startNode = theNodeSearcher->FindClosestTo(gpnts[0]);
- if (startNode)
- nodeId = startNode->GetID();
- MESSAGE("nodeId " << nodeId);
+ //MESSAGE("startNode->nodeId " << nodeId);
double radius2 = radius*radius;
- MESSAGE("radius2 " << radius2);
+ //MESSAGE("radius2 " << radius2);
// --- volumes on start node
{
std::set<int>::iterator it = setOfVolToCheck.begin();
int vtkId = *it;
- MESSAGE("volume to check, vtkId " << vtkId << " smdsId " << meshDS->fromVtkToSmds(vtkId));
+ //MESSAGE("volume to check, vtkId " << vtkId << " smdsId " << meshDS->fromVtkToSmds(vtkId));
bool volInside = false;
vtkIdType npts = 0;
vtkIdType* pts = 0;
if (mapOfNodeDistance2.count(pts[i]))
{
distance2 = mapOfNodeDistance2[pts[i]];
- MESSAGE("point " << pts[i] << " distance2 " << distance2);
+ //MESSAGE("point " << pts[i] << " distance2 " << distance2);
}
else
{
}
}
mapOfNodeDistance2[pts[i]] = distance2;
- MESSAGE(" point " << pts[i] << " distance2 " << distance2 << " coords " << coords[0] << " " << coords[1] << " " << coords[2]);
+ //MESSAGE(" point " << pts[i] << " distance2 " << distance2 << " coords " << coords[0] << " " << coords[1] << " " << coords[2]);
}
if (distance2 < radius2)
{
if (volInside)
{
setOfInsideVol.insert(vtkId);
- MESSAGE(" volume inside, vtkId " << vtkId << " smdsId " << meshDS->fromVtkToSmds(vtkId));
+ //MESSAGE(" volume inside, vtkId " << vtkId << " smdsId " << meshDS->fromVtkToSmds(vtkId));
int neighborsVtkIds[NBMAXNEIGHBORS];
int downIds[NBMAXNEIGHBORS];
unsigned char downTypes[NBMAXNEIGHBORS];
else
{
setOfOutsideVol.insert(vtkId);
- MESSAGE(" volume outside, vtkId " << vtkId << " smdsId " << meshDS->fromVtkToSmds(vtkId));
+ //MESSAGE(" volume outside, vtkId " << vtkId << " smdsId " << meshDS->fromVtkToSmds(vtkId));
}
setOfVolToCheck.erase(vtkId);
}
std::set<int> setOfVolToReCheck;
while (addedInside)
{
- MESSAGE(" --------------------------- re check");
+ //MESSAGE(" --------------------------- re check");
addedInside = false;
std::set<int>::iterator itv = setOfInsideVol.begin();
for (; itv != setOfInsideVol.end(); ++itv)
int vtkId = *it;
if (grid->GetCellType(vtkId) == VTK_HEXAHEDRON)
{
- MESSAGE("volume to recheck, vtkId " << vtkId << " smdsId " << meshDS->fromVtkToSmds(vtkId));
+ //MESSAGE("volume to recheck, vtkId " << vtkId << " smdsId " << meshDS->fromVtkToSmds(vtkId));
int countInside = 0;
int neighborsVtkIds[NBMAXNEIGHBORS];
int downIds[NBMAXNEIGHBORS];
for (int n = 0; n < nbNeighbors; n++)
if (setOfInsideVol.count(neighborsVtkIds[n]))
countInside++;
- MESSAGE("countInside " << countInside);
+ //MESSAGE("countInside " << countInside);
if (countInside > 1)
{
- MESSAGE(" volume inside, vtkId " << vtkId << " smdsId " << meshDS->fromVtkToSmds(vtkId));
+ //MESSAGE(" volume inside, vtkId " << vtkId << " smdsId " << meshDS->fromVtkToSmds(vtkId));
setOfInsideVol.insert(vtkId);
sgrp->Add(meshDS->fromVtkToSmds(vtkId));
addedInside = true;
for (; itShape != shapeIdToVtkIdSet.end(); ++itShape)
{
int shapeId = itShape->first;
- MESSAGE(" --- Shape ID --- "<< shapeId);
+ //MESSAGE(" --- Shape ID --- "<< shapeId);
shapeIdToEdges[shapeId] = emptyEdges;
std::vector<int> nodesEdges;
for (; its != itShape->second.end(); ++its)
{
int vtkId = *its;
- MESSAGE(" " << vtkId);
+ //MESSAGE(" " << vtkId);
int neighborsVtkIds[NBMAXNEIGHBORS];
int downIds[NBMAXNEIGHBORS];
unsigned char downTypes[NBMAXNEIGHBORS];
int nbNodes = grid->getDownArray(downTypes[n])->getNodes(downIds[n],vtkNodeId);
nodesEdges.push_back(vtkNodeId[0]);
nodesEdges.push_back(vtkNodeId[nbNodes-1]);
- MESSAGE(" --- nodes " << vtkNodeId[0]+1 << " " << vtkNodeId[nbNodes-1]+1);
+ //MESSAGE(" --- nodes " << vtkNodeId[0]+1 << " " << vtkNodeId[nbNodes-1]+1);
}
}
}
order.clear();
if (nodesEdges.size() > 0)
{
- order.push_back(nodesEdges[0]); MESSAGE(" --- back " << order.back()+1); // SMDS id = VTK id + 1;
+ order.push_back(nodesEdges[0]); //MESSAGE(" --- back " << order.back()+1); // SMDS id = VTK id + 1;
nodesEdges[0] = -1;
- order.push_back(nodesEdges[1]); MESSAGE(" --- back " << order.back()+1);
+ order.push_back(nodesEdges[1]); //MESSAGE(" --- back " << order.back()+1);
nodesEdges[1] = -1; // do not reuse this edge
bool found = true;
while (found)
found = false;
else
{
- order.push_back(nodesEdges[i-1]); MESSAGE(" --- back " << order.back()+1);
+ order.push_back(nodesEdges[i-1]); //MESSAGE(" --- back " << order.back()+1);
nodesEdges[i-1] = -1;
}
else // even ==> use the next one
found = false;
else
{
- order.push_back(nodesEdges[i+1]); MESSAGE(" --- back " << order.back()+1);
+ order.push_back(nodesEdges[i+1]); //MESSAGE(" --- back " << order.back()+1);
nodesEdges[i+1] = -1;
}
}
found = false;
else
{
- order.push_front(nodesEdges[i-1]); MESSAGE(" --- front " << order.front()+1);
+ order.push_front(nodesEdges[i-1]); //MESSAGE(" --- front " << order.front()+1);
nodesEdges[i-1] = -1;
}
else // even ==> use the next one
found = false;
else
{
- order.push_front(nodesEdges[i+1]); MESSAGE(" --- front " << order.front()+1);
+ order.push_front(nodesEdges[i+1]); //MESSAGE(" --- front " << order.front()+1);
nodesEdges[i+1] = -1;
}
}
for (; itl != order.end(); itl++)
{
nodes.push_back((*itl) + 1); // SMDS id = VTK id + 1;
- MESSAGE(" ordered node " << nodes[nodes.size()-1]);
+ //MESSAGE(" ordered node " << nodes[nodes.size()-1]);
}
listOfListOfNodes.push_back(nodes);
}