本文整理汇总了C++中TopTools_MapOfShape::Contains方法的典型用法代码示例。如果您正苦于以下问题:C++ TopTools_MapOfShape::Contains方法的具体用法?C++ TopTools_MapOfShape::Contains怎么用?C++ TopTools_MapOfShape::Contains使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TopTools_MapOfShape
的用法示例。
在下文中一共展示了TopTools_MapOfShape::Contains方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MakeWire
void BRepOffsetAPI_MakeOffsetFix::MakeWire(TopoDS_Shape& wire)
{
// get the edges of the wire and check which of the stored edges
// serve as input of the wire
TopTools_MapOfShape aMap;
TopExp_Explorer xp(wire, TopAbs_EDGE);
while (xp.More()) {
aMap.Add(xp.Current());
xp.Next();
}
std::list<TopoDS_Edge> edgeList;
for (auto itLoc : myLocations) {
const TopTools_ListOfShape& newShapes = mkOffset.Generated(itLoc.first);
for (TopTools_ListIteratorOfListOfShape it(newShapes); it.More(); it.Next()) {
TopoDS_Shape newShape = it.Value();
if (aMap.Contains(newShape)) {
newShape.Move(itLoc.second);
edgeList.push_back(TopoDS::Edge(newShape));
}
}
}
if (!edgeList.empty()) {
BRepBuilderAPI_MakeWire mkWire;
mkWire.Add(edgeList.front());
edgeList.pop_front();
wire = mkWire.Wire();
bool found = false;
do {
found = false;
for (std::list<TopoDS_Edge>::iterator pE = edgeList.begin(); pE != edgeList.end(); ++pE) {
mkWire.Add(*pE);
if (mkWire.Error() != BRepBuilderAPI_DisconnectedWire) {
// edge added ==> remove it from list
found = true;
edgeList.erase(pE);
wire = mkWire.Wire();
break;
}
}
}
while (found);
}
}
示例2: FillSameDomainFaces
//.........这里部分代码省略.........
BRepBndLib::Add(aF2s, aBoxF2s);
//
aMIS.Bind(i2s, aF2s);
//
aTreeFiller.Add(i2s, aBoxF2s);
}//for (i2s=1; aItF2.More(); aItF2.Next(), ++i2s) {
//
aTreeFiller.Fill();
//
// 2.
aItF1.Initialize(aLF1);
for (j=1; aItF1.More(); aItF1.Next(), ++j) {
Bnd_Box aBoxF1x;
//
const TopoDS_Face& aF1x=*((TopoDS_Face*)(&aItF1.Value()));
//
BRepBndLib::Add(aF1x, aBoxF1x);
//
aSelector.Clear();
aSelector.SetBox(aBoxF1x);
aNbSD=aBBTree.Select(aSelector);
if (!aNbSD) {
continue;
}
//
const TColStd_ListOfInteger& aLI=aSelector.Indices();
aItLI.Initialize(aLI);
for (; aItLI.More(); aItLI.Next()) {
i2s=aItLI.Value();
const TopoDS_Face& aF2y=*((TopoDS_Face*)(&aMIS.Find(i2s)));
//
bIsSDF=NMTTools_Tools::AreFacesSameDomain(aF1x, aF2y, aCtx);
if (bIsSDF) {
if (aMFence.Contains(aF1x) || aMFence.Contains(aF2y)) {
continue;
}
aMFence.Add(aF1x);
aMFence.Add(aF2y);
//
NMTTools_CoupleOfShape aCS;
//
aCS.SetShape1(aF1x);
aCS.SetShape2(aF2y);
aLCS.Append(aCS);
//
if (bForward) {
if (aF1x==aF1) {
if (!mySplitFaces.HasImage(aF1)) {
mySplitFaces.Bind(aF1, aF1);
}
}
if (aF2y==aF2) {
if (!mySplitFaces.HasImage(aF2)) {
mySplitFaces.Bind(aF2, aF2);
}
}
}
else {
if (aF1x==aF2) {
if (!mySplitFaces.HasImage(aF2)) {
mySplitFaces.Bind(aF2, aF2);
}
}
if (aF2y==aF1) {
if (!mySplitFaces.HasImage(aF1)) {
mySplitFaces.Bind(aF1, aF1);
示例3: Max
bool NETGENPlugin_NETGEN_3D::Evaluate(SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape,
MapShapeNbElems& aResMap)
{
int nbtri = 0, nbqua = 0;
double fullArea = 0.0;
for (TopExp_Explorer exp(aShape, TopAbs_FACE); exp.More(); exp.Next()) {
TopoDS_Face F = TopoDS::Face( exp.Current() );
SMESH_subMesh *sm = aMesh.GetSubMesh(F);
MapShapeNbElemsItr anIt = aResMap.find(sm);
if( anIt==aResMap.end() ) {
SMESH_ComputeErrorPtr& smError = sm->GetComputeError();
smError.reset( new SMESH_ComputeError(COMPERR_ALGO_FAILED,"Submesh can not be evaluated",this));
return false;
}
std::vector<int> aVec = (*anIt).second;
nbtri += Max(aVec[SMDSEntity_Triangle],aVec[SMDSEntity_Quad_Triangle]);
nbqua += Max(aVec[SMDSEntity_Quadrangle],aVec[SMDSEntity_Quad_Quadrangle]);
GProp_GProps G;
BRepGProp::SurfaceProperties(F,G);
double anArea = G.Mass();
fullArea += anArea;
}
// collect info from edges
int nb0d_e = 0, nb1d_e = 0;
bool IsQuadratic = false;
bool IsFirst = true;
TopTools_MapOfShape tmpMap;
for (TopExp_Explorer exp(aShape, TopAbs_EDGE); exp.More(); exp.Next()) {
TopoDS_Edge E = TopoDS::Edge(exp.Current());
if( tmpMap.Contains(E) )
continue;
tmpMap.Add(E);
SMESH_subMesh *aSubMesh = aMesh.GetSubMesh(exp.Current());
MapShapeNbElemsItr anIt = aResMap.find(aSubMesh);
if( anIt==aResMap.end() ) {
SMESH_ComputeErrorPtr& smError = aSubMesh->GetComputeError();
smError.reset( new SMESH_ComputeError(COMPERR_ALGO_FAILED,
"Submesh can not be evaluated",this));
return false;
}
std::vector<int> aVec = (*anIt).second;
nb0d_e += aVec[SMDSEntity_Node];
nb1d_e += Max(aVec[SMDSEntity_Edge],aVec[SMDSEntity_Quad_Edge]);
if(IsFirst) {
IsQuadratic = (aVec[SMDSEntity_Quad_Edge] > aVec[SMDSEntity_Edge]);
IsFirst = false;
}
}
tmpMap.Clear();
double ELen_face = sqrt(2.* ( fullArea/(nbtri+nbqua*2) ) / sqrt(3.0) );
double ELen_vol = pow( 72, 1/6. ) * pow( _maxElementVolume, 1/3. );
double ELen = Min(ELen_vol,ELen_face*2);
GProp_GProps G;
BRepGProp::VolumeProperties(aShape,G);
double aVolume = G.Mass();
double tetrVol = 0.1179*ELen*ELen*ELen;
double CoeffQuality = 0.9;
int nbVols = (int)aVolume/tetrVol/CoeffQuality;
int nb1d_f = (nbtri*3 + nbqua*4 - nb1d_e) / 2;
int nb1d_in = (int) ( nbVols*6 - nb1d_e - nb1d_f ) / 5;
std::vector<int> aVec(SMDSEntity_Last);
for(int i=SMDSEntity_Node; i<SMDSEntity_Last; i++) aVec[i]=0;
if( IsQuadratic ) {
aVec[SMDSEntity_Node] = nb1d_in/6 + 1 + nb1d_in;
aVec[SMDSEntity_Quad_Tetra] = nbVols - nbqua*2;
aVec[SMDSEntity_Quad_Pyramid] = nbqua;
}
else {
aVec[SMDSEntity_Node] = nb1d_in/6 + 1;
aVec[SMDSEntity_Tetra] = nbVols - nbqua*2;
aVec[SMDSEntity_Pyramid] = nbqua;
}
SMESH_subMesh *sm = aMesh.GetSubMesh(aShape);
aResMap.insert(std::make_pair(sm,aVec));
return true;
}
示例4: Execute
//=======================================================================
//function : Execute
//purpose :
//=======================================================================
Standard_Integer GEOMImpl_ChamferDriver::Execute(TFunction_Logbook& log) const
{
if (Label().IsNull()) return 0;
Handle(GEOM_Function) aFunction = GEOM_Function::GetFunction(Label());
GEOMImpl_IChamfer aCI (aFunction);
Standard_Integer aType = aFunction->GetType();
TopoDS_Shape aShape;
Handle(GEOM_Function) aRefShape = aCI.GetShape();
TopoDS_Shape aShapeBase = aRefShape->GetValue();
// Check the shape type. It have to be shell
// or solid, or compsolid, or compound of these shapes.
if (!isGoodForChamfer(aShapeBase)) {
StdFail_NotDone::Raise
("Wrong shape. Must be shell or solid, or compsolid or compound of these shapes");
}
BRepFilletAPI_MakeChamfer fill (aShapeBase);
if (aType == CHAMFER_SHAPE_ALL) {
// symmetric chamfer on all edges
double aD = aCI.GetD();
TopTools_IndexedDataMapOfShapeListOfShape M;
GEOMImpl_Block6Explorer::MapShapesAndAncestors(aShapeBase, TopAbs_EDGE, TopAbs_FACE, M);
for (int i = 1; i <= M.Extent(); i++) {
TopoDS_Edge E = TopoDS::Edge(M.FindKey(i));
TopoDS_Face F = TopoDS::Face(M.FindFromIndex(i).First());
if (!BRepTools::IsReallyClosed(E, F) &&
!BRep_Tool::Degenerated(E) &&
M.FindFromIndex(i).Extent() == 2)
fill.Add(aD, E, F);
}
}
else if (aType == CHAMFER_SHAPE_EDGE || aType == CHAMFER_SHAPE_EDGE_AD) {
// chamfer on edges, common to two faces, with D1 on the first face
TopoDS_Shape aFace1, aFace2;
if (GEOMImpl_ILocalOperations::GetSubShape(aShapeBase, aCI.GetFace1(), aFace1) &&
GEOMImpl_ILocalOperations::GetSubShape(aShapeBase, aCI.GetFace2(), aFace2))
{
TopoDS_Face F = TopoDS::Face(aFace1);
// fill map of edges of the second face
TopTools_MapOfShape aMap;
TopExp_Explorer Exp2 (aFace2, TopAbs_EDGE);
for (; Exp2.More(); Exp2.Next()) {
aMap.Add(Exp2.Current());
}
// find edges of the first face, common with the second face
TopExp_Explorer Exp (aFace1, TopAbs_EDGE);
for (; Exp.More(); Exp.Next()) {
if (aMap.Contains(Exp.Current())) {
TopoDS_Edge E = TopoDS::Edge(Exp.Current());
if (!BRepTools::IsReallyClosed(E, F) && !BRep_Tool::Degenerated(E))
{
if ( aType == CHAMFER_SHAPE_EDGE )
{
double aD1 = aCI.GetD1();
double aD2 = aCI.GetD2();
fill.Add(aD1, aD2, E, F);
}
else
{
double aD = aCI.GetD();
double anAngle = aCI.GetAngle();
if ( (anAngle > 0) && (anAngle < (M_PI/2.)) )
fill.AddDA(aD, anAngle, E, F);
}
}
}
}
}
}
else if (aType == CHAMFER_SHAPE_FACES || aType == CHAMFER_SHAPE_FACES_AD) {
// chamfer on all edges of the selected faces, with D1 on the selected face
// (on first selected face, if the edge belongs to two selected faces)
int aLen = aCI.GetLength();
int ind = 1;
TopTools_MapOfShape aMap;
TopTools_IndexedDataMapOfShapeListOfShape M;
GEOMImpl_Block6Explorer::MapShapesAndAncestors(aShapeBase, TopAbs_EDGE, TopAbs_FACE, M);
for (; ind <= aLen; ind++)
{
TopoDS_Shape aShapeFace;
if (GEOMImpl_ILocalOperations::GetSubShape(aShapeBase, aCI.GetFace(ind), aShapeFace))
{
TopoDS_Face F = TopoDS::Face(aShapeFace);
TopExp_Explorer Exp (F, TopAbs_EDGE);
for (; Exp.More(); Exp.Next()) {
if (!aMap.Contains(Exp.Current()))
{
//.........这里部分代码省略.........
示例5: Handle
//=======================================================================
//function : FillIn3DParts
//purpose :
//=======================================================================
void GEOMAlgo_Builder::FillIn3DParts()
{
myErrorStatus=0;
//
const NMTDS_ShapesDataStructure& aDS=*myPaveFiller->DS();
NMTTools_PaveFiller* pPF=myPaveFiller;
const Handle(IntTools_Context)& aCtx= pPF->Context();
//
Standard_Boolean bIsIN, bHasImage;
Standard_Integer aNbS, aNbSolids, i, j, aNbFaces, aNbFP, aNbFPx, aNbFIN, aNbLIF;
TopAbs_ShapeEnum aType;
TopAbs_State aState;
TopTools_IndexedMapOfShape aMSolids, aMS, aMFaces, aMFIN;
TopTools_MapOfShape aMFDone;
TopTools_IndexedDataMapOfShapeListOfShape aMEF;
TopTools_ListIteratorOfListOfShape aItS;
TopoDS_Iterator aIt, aItF;
BRep_Builder aBB;
TopoDS_Solid aSolidSp;
TopoDS_Face aFP;
//
myDraftSolids.Clear();
//
aNbS=aDS.NumberOfShapesOfTheObject();
for (i=1; i<=aNbS; ++i) {
const TopoDS_Shape& aS=aDS.Shape(i);
//
aType=aS.ShapeType();
if (aType==TopAbs_SOLID) {
// all solids from DS
aMSolids.Add(aS);
}
else if (aType==TopAbs_FACE) {
// all faces (originals from DS or theirs images)
if (myImages.HasImage(aS)) {
const TopTools_ListOfShape& aLS=myImages.Image(aS);
aItS.Initialize(aLS);
for (; aItS.More(); aItS.Next()) {
const TopoDS_Shape& aFx=aItS.Value();
//
if (mySameDomainShapes.Contains(aFx)) {
const TopoDS_Shape& aFSDx=mySameDomainShapes.FindFromKey(aFx);
aMFaces.Add(aFSDx);
}
else {
aMFaces.Add(aFx);
}
}
}
else {
if (mySameDomainShapes.Contains(aS)) {
const TopoDS_Shape& aFSDx=mySameDomainShapes.FindFromKey(aS);
aMFaces.Add(aFSDx);
}
else {
aMFaces.Add(aS);
}
}
}
}
//
aNbFaces=aMFaces.Extent();
aNbSolids=aMSolids.Extent();
//
for (i=1; i<=aNbSolids; ++i) {
const TopoDS_Solid& aSolid=TopoDS::Solid(aMSolids(i));
aMFDone.Clear();
aMFIN.Clear();
aMEF.Clear();
//
aBB.MakeSolid(aSolidSp);
//
TopTools_ListOfShape aLIF;
//
BuildDraftSolid(aSolid, aSolidSp, aLIF);
aNbLIF=aLIF.Extent();
//
// 1 all faces/edges from aSolid [ aMS ]
bHasImage=Standard_False;
aMS.Clear();
aIt.Initialize(aSolid);
for (; aIt.More(); aIt.Next()) {
const TopoDS_Shape& aShell=aIt.Value();
//
if (myImages.HasImage(aShell)) {
bHasImage=Standard_True;
//
const TopTools_ListOfShape& aLS=myImages.Image(aShell);
aItS.Initialize(aLS);
for (; aItS.More(); aItS.Next()) {
const TopoDS_Shape& aSx=aItS.Value();
aMS.Add(aSx);
TopExp::MapShapes(aSx, TopAbs_FACE, aMS);
TopExp::MapShapes(aSx, TopAbs_EDGE, aMS);
TopExp::MapShapesAndAncestors(aSx, TopAbs_EDGE, TopAbs_FACE, aMEF);
}
//.........这里部分代码省略.........
示例6: exp
bool StdMeshers_RadialPrism_3D::Evaluate(SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape,
MapShapeNbElems& aResMap)
{
// get 2 shells
TopoDS_Solid solid = TopoDS::Solid( aShape );
TopoDS_Shell outerShell = BRepClass3d::OuterShell( solid );
TopoDS_Shape innerShell;
int nbShells = 0;
for ( TopoDS_Iterator It (solid); It.More(); It.Next(), ++nbShells )
if ( !outerShell.IsSame( It.Value() ))
innerShell = It.Value();
if ( nbShells != 2 ) {
std::vector<int> aResVec(SMDSEntity_Last);
for(int i=SMDSEntity_Node; i<SMDSEntity_Last; i++) aResVec[i] = 0;
SMESH_subMesh * sm = aMesh.GetSubMesh(aShape);
aResMap.insert(std::make_pair(sm,aResVec));
SMESH_ComputeErrorPtr& smError = sm->GetComputeError();
smError.reset( new SMESH_ComputeError(COMPERR_ALGO_FAILED,"Submesh can not be evaluated",this));
return false;
}
// Associate sub-shapes of the shells
ProjectionUtils::TShapeShapeMap shape2ShapeMap;
if ( !ProjectionUtils::FindSubShapeAssociation( outerShell, &aMesh,
innerShell, &aMesh,
shape2ShapeMap) ) {
std::vector<int> aResVec(SMDSEntity_Last);
for(int i=SMDSEntity_Node; i<SMDSEntity_Last; i++) aResVec[i] = 0;
SMESH_subMesh * sm = aMesh.GetSubMesh(aShape);
aResMap.insert(std::make_pair(sm,aResVec));
SMESH_ComputeErrorPtr& smError = sm->GetComputeError();
smError.reset( new SMESH_ComputeError(COMPERR_ALGO_FAILED,"Submesh can not be evaluated",this));
return false;
}
// get info for outer shell
int nb0d_Out=0, nb2d_3_Out=0, nb2d_4_Out=0;
//TopTools_SequenceOfShape FacesOut;
for (TopExp_Explorer exp(outerShell, TopAbs_FACE); exp.More(); exp.Next()) {
//FacesOut.Append(exp.Current());
SMESH_subMesh *aSubMesh = aMesh.GetSubMesh(exp.Current());
MapShapeNbElemsItr anIt = aResMap.find(aSubMesh);
std::vector<int> aVec = (*anIt).second;
nb0d_Out += aVec[SMDSEntity_Node];
nb2d_3_Out += Max(aVec[SMDSEntity_Triangle],aVec[SMDSEntity_Quad_Triangle]);
nb2d_4_Out += Max(aVec[SMDSEntity_Quadrangle],aVec[SMDSEntity_Quad_Quadrangle]);
}
int nb1d_Out = 0;
TopTools_MapOfShape tmpMap;
for (TopExp_Explorer exp(outerShell, TopAbs_EDGE); exp.More(); exp.Next()) {
if( tmpMap.Contains( exp.Current() ) )
continue;
tmpMap.Add( exp.Current() );
SMESH_subMesh *aSubMesh = aMesh.GetSubMesh(exp.Current());
MapShapeNbElemsItr anIt = aResMap.find(aSubMesh);
std::vector<int> aVec = (*anIt).second;
nb0d_Out += aVec[SMDSEntity_Node];
nb1d_Out += Max(aVec[SMDSEntity_Edge],aVec[SMDSEntity_Quad_Edge]);
}
tmpMap.Clear();
for (TopExp_Explorer exp(outerShell, TopAbs_VERTEX); exp.More(); exp.Next()) {
if( tmpMap.Contains( exp.Current() ) )
continue;
tmpMap.Add( exp.Current() );
nb0d_Out++;
}
// get info for inner shell
int nb0d_In=0, nb2d_3_In=0, nb2d_4_In=0;
//TopTools_SequenceOfShape FacesIn;
for (TopExp_Explorer exp(innerShell, TopAbs_FACE); exp.More(); exp.Next()) {
//FacesIn.Append(exp.Current());
SMESH_subMesh *aSubMesh = aMesh.GetSubMesh(exp.Current());
MapShapeNbElemsItr anIt = aResMap.find(aSubMesh);
std::vector<int> aVec = (*anIt).second;
nb0d_In += aVec[SMDSEntity_Node];
nb2d_3_In += Max(aVec[SMDSEntity_Triangle],aVec[SMDSEntity_Quad_Triangle]);
nb2d_4_In += Max(aVec[SMDSEntity_Quadrangle],aVec[SMDSEntity_Quad_Quadrangle]);
}
int nb1d_In = 0;
tmpMap.Clear();
bool IsQuadratic = false;
bool IsFirst = true;
for (TopExp_Explorer exp(innerShell, TopAbs_EDGE); exp.More(); exp.Next()) {
if( tmpMap.Contains( exp.Current() ) )
continue;
tmpMap.Add( exp.Current() );
SMESH_subMesh *aSubMesh = aMesh.GetSubMesh(exp.Current());
MapShapeNbElemsItr anIt = aResMap.find(aSubMesh);
std::vector<int> aVec = (*anIt).second;
nb0d_In += aVec[SMDSEntity_Node];
nb1d_In += Max(aVec[SMDSEntity_Edge],aVec[SMDSEntity_Quad_Edge]);
if(IsFirst) {
IsQuadratic = (aVec[SMDSEntity_Quad_Edge] > aVec[SMDSEntity_Edge]);
IsFirst = false;
}
}
tmpMap.Clear();
for (TopExp_Explorer exp(innerShell, TopAbs_VERTEX); exp.More(); exp.Next()) {
//.........这里部分代码省略.........
示例7: Max
bool NETGENPlugin_NETGEN_2D_ONLY::Evaluate(SMESH_Mesh& aMesh,
const TopoDS_Shape& aShape,
MapShapeNbElems& aResMap)
{
TopoDS_Face F = TopoDS::Face(aShape);
if(F.IsNull())
return false;
// collect info from edges
int nb0d = 0, nb1d = 0;
bool IsQuadratic = false;
bool IsFirst = true;
double fullLen = 0.0;
TopTools_MapOfShape tmpMap;
for (TopExp_Explorer exp(F, TopAbs_EDGE); exp.More(); exp.Next()) {
TopoDS_Edge E = TopoDS::Edge(exp.Current());
if( tmpMap.Contains(E) )
continue;
tmpMap.Add(E);
SMESH_subMesh *aSubMesh = aMesh.GetSubMesh(exp.Current());
MapShapeNbElemsItr anIt = aResMap.find(aSubMesh);
if( anIt==aResMap.end() ) {
SMESH_subMesh *sm = aMesh.GetSubMesh(F);
SMESH_ComputeErrorPtr& smError = sm->GetComputeError();
smError.reset( new SMESH_ComputeError(COMPERR_ALGO_FAILED,"Submesh can not be evaluated",this));
return false;
}
std::vector<int> aVec = (*anIt).second;
nb0d += aVec[SMDSEntity_Node];
nb1d += Max(aVec[SMDSEntity_Edge],aVec[SMDSEntity_Quad_Edge]);
double aLen = SMESH_Algo::EdgeLength(E);
fullLen += aLen;
if(IsFirst) {
IsQuadratic = (aVec[SMDSEntity_Quad_Edge] > aVec[SMDSEntity_Edge]);
IsFirst = false;
}
}
tmpMap.Clear();
// compute edge length
double ELen = 0;
if (_hypLengthFromEdges || (!_hypLengthFromEdges && !_hypMaxElementArea)) {
if ( nb1d > 0 )
ELen = fullLen / nb1d;
}
if ( _hypMaxElementArea ) {
double maxArea = _hypMaxElementArea->GetMaxArea();
ELen = sqrt(2. * maxArea/sqrt(3.0));
}
GProp_GProps G;
BRepGProp::SurfaceProperties(F,G);
double anArea = G.Mass();
const int hugeNb = numeric_limits<int>::max()/10;
if ( anArea / hugeNb > ELen*ELen )
{
SMESH_subMesh *sm = aMesh.GetSubMesh(F);
SMESH_ComputeErrorPtr& smError = sm->GetComputeError();
smError.reset( new SMESH_ComputeError(COMPERR_ALGO_FAILED,"Submesh can not be evaluated.\nToo small element length",this));
return false;
}
int nbFaces = (int) ( anArea / ( ELen*ELen*sqrt(3.) / 4 ) );
int nbNodes = (int) ( ( nbFaces*3 - (nb1d-1)*2 ) / 6 + 1 );
std::vector<int> aVec(SMDSEntity_Last);
for(int i=SMDSEntity_Node; i<SMDSEntity_Last; i++) aVec[i]=0;
if( IsQuadratic ) {
aVec[SMDSEntity_Node] = nbNodes;
aVec[SMDSEntity_Quad_Triangle] = nbFaces;
}
else {
aVec[SMDSEntity_Node] = nbNodes;
aVec[SMDSEntity_Triangle] = nbFaces;
}
SMESH_subMesh *sm = aMesh.GetSubMesh(F);
aResMap.insert(std::make_pair(sm,aVec));
return true;
}
示例8: FindFacePairs
//=======================================================================
//function : FindFacePairs
//purpose :
//=======================================================================
Standard_Boolean FindFacePairs (const TopoDS_Edge& theE,
const TopTools_ListOfShape& thLF,
NMTTools_ListOfCoupleOfShape& theLCFF)
{
Standard_Boolean bFound;
Standard_Integer i, aNbCEF;
TopAbs_Orientation aOr, aOrC;
TopTools_MapOfShape aMFP;
TopoDS_Face aF1, aF2;
TopoDS_Edge aEL, aE1;
TopTools_ListIteratorOfListOfShape aItLF;
NMTTools_CoupleOfShape aCEF, aCFF;
NMTTools_ListOfCoupleOfShape aLCEF, aLCEFx;
NMTTools_ListIteratorOfListOfCoupleOfShape aIt;
//
bFound=Standard_True;
//
// Preface aLCEF
aItLF.Initialize(thLF);
for (; aItLF.More(); aItLF.Next()) {
const TopoDS_Face& aFL=TopoDS::Face(aItLF.Value());
//
bFound=GEOMAlgo_Tools3D::GetEdgeOnFace(theE, aFL, aEL);
if (!bFound) {
return bFound; // it can not be so
}
//
aCEF.SetShape1(aEL);
aCEF.SetShape2(aFL);
aLCEF.Append(aCEF);
}
//
aNbCEF=aLCEF.Extent();
while(aNbCEF) {
//
// aLCEFx
aLCEFx.Clear();
aIt.Initialize(aLCEF);
for (i=0; aIt.More(); aIt.Next(), ++i) {
const NMTTools_CoupleOfShape& aCSx=aIt.Value();
const TopoDS_Shape& aEx=aCSx.Shape1();
const TopoDS_Shape& aFx=aCSx.Shape2();
//
aOr=aEx.Orientation();
//
if (!i) {
aOrC=TopAbs::Reverse(aOr);
aE1=TopoDS::Edge(aEx);
aF1=TopoDS::Face(aFx);
aMFP.Add(aFx);
continue;
}
//
if (aOr==aOrC) {
aLCEFx.Append(aCSx);
aMFP.Add(aFx);
}
}
//
// F2
GEOMAlgo_Tools3D::GetFaceOff(aE1, aF1, aLCEFx, aF2);
//
aCFF.SetShape1(aF1);
aCFF.SetShape2(aF2);
theLCFF.Append(aCFF);
//
aMFP.Add(aF1);
aMFP.Add(aF2);
//
// refine aLCEF
aLCEFx.Clear();
aLCEFx=aLCEF;
aLCEF.Clear();
aIt.Initialize(aLCEFx);
for (; aIt.More(); aIt.Next()) {
const NMTTools_CoupleOfShape& aCSx=aIt.Value();
const TopoDS_Shape& aFx=aCSx.Shape2();
if (!aMFP.Contains(aFx)) {
aLCEF.Append(aCSx);
}
}
//
aNbCEF=aLCEF.Extent();
}//while(aNbCEF) {
//
return bFound;
}
示例9: DetectVertices
//=======================================================================
//function : DetectVertices
//purpose :
//=======================================================================
void GEOMAlgo_GlueDetector::DetectVertices()
{
Standard_Integer j, i, aNbV, aNbVSD;
Standard_Real aTolV;
gp_Pnt aPV;
TColStd_ListIteratorOfListOfInteger aIt;
TopoDS_Shape aVF;
TopTools_IndexedMapOfShape aMV;
TopTools_MapOfShape aMVProcessed;
TopTools_ListIteratorOfListOfShape aItS;
TopTools_DataMapIteratorOfDataMapOfShapeListOfShape aItIm;
TopTools_DataMapOfShapeListOfShape aMVV;
GEOMAlgo_IndexedDataMapOfIntegerShape aMIS;
NMTDS_IndexedDataMapOfShapeBndSphere aMSB;
//
NMTDS_BndSphereTreeSelector aSelector;
NMTDS_BndSphereTree aBBTree;
NCollection_UBTreeFiller <Standard_Integer, NMTDS_BndSphere> aTreeFiller(aBBTree);
//
myErrorStatus=0;
//
TopExp::MapShapes(myArgument, TopAbs_VERTEX, aMV);
aNbV=aMV.Extent();
if (!aNbV) {
myErrorStatus=2; // no vertices in source shape
return;
}
//
for (i=1; i<=aNbV; ++i) {
NMTDS_BndSphere aBox;
//
const TopoDS_Vertex& aV=*((TopoDS_Vertex*)&aMV(i));
aPV=BRep_Tool::Pnt(aV);
aTolV=BRep_Tool::Tolerance(aV);
//
aBox.SetGap(myTolerance);
aBox.SetCenter(aPV);
aBox.SetRadius(aTolV);
//
aTreeFiller.Add(i, aBox);
//
aMIS.Add(i, aV);
aMSB.Add(aV, aBox);
}
//
aTreeFiller.Fill();
//
//---------------------------------------------------
// Chains
for (i=1; i<=aNbV; ++i) {
const TopoDS_Shape& aV=aMV(i);
//
if (aMVProcessed.Contains(aV)) {
continue;
}
//
Standard_Integer aNbIP, aIP, aNbIP1, aIP1;
TopTools_ListOfShape aLVSD;
TColStd_MapOfInteger aMIP, aMIP1, aMIPC;
TColStd_MapIteratorOfMapOfInteger aIt1;
//
aMIP.Add(i);
while(1) {
aNbIP=aMIP.Extent();
aIt1.Initialize(aMIP);
for(; aIt1.More(); aIt1.Next()) {
aIP=aIt1.Key();
if (aMIPC.Contains(aIP)) {
continue;
}
//
const TopoDS_Shape& aVP=aMIS.FindFromKey(aIP);
const NMTDS_BndSphere& aBoxVP=aMSB.FindFromKey(aVP);
//
aSelector.Clear();
aSelector.SetBox(aBoxVP);
//
aNbVSD=aBBTree.Select(aSelector);
if (!aNbVSD) {
continue; // it shoild not be so [at least IP itself]
}
//
const TColStd_ListOfInteger& aLI=aSelector.Indices();
aIt.Initialize(aLI);
for (; aIt.More(); aIt.Next()) {
aIP1=aIt.Value();
if (aMIP.Contains(aIP1)) {
continue;
}
aMIP1.Add(aIP1);
} //for (; aIt.More(); aIt.Next()) {
}//for(; aIt1.More(); aIt1.Next()) {
//
aNbIP1=aMIP1.Extent();
if (!aNbIP1) {
break;
//.........这里部分代码省略.........
示例10: Execute
//.........这里部分代码省略.........
if (aType == CHAMFER_SHAPE_ALL) {
// symmetric chamfer on all edges
double aD = aCI.GetD();
TopTools_IndexedDataMapOfShapeListOfShape M;
GEOMImpl_Block6Explorer::MapShapesAndAncestors(aShapeBase, TopAbs_EDGE, TopAbs_FACE, M);
for (int i = 1; i <= M.Extent(); i++) {
TopoDS_Edge E = TopoDS::Edge(M.FindKey(i));
TopoDS_Face F = TopoDS::Face(M.FindFromIndex(i).First());
if (!BRepTools::IsReallyClosed(E, F) &&
!BRep_Tool::Degenerated(E) &&
M.FindFromIndex(i).Extent() == 2)
fill.Add(aD, E, F);
}
}else if (aType == CHAMFER_SHAPE_EDGE || aType == CHAMFER_SHAPE_EDGE_AD) {
// chamfer on edges, common to two faces, with D1 on the first face
TopoDS_Shape aFace1, aFace2;
if (GEOMImpl_ILocalOperations::GetSubShape(aShapeBase, aCI.GetFace1(), aFace1) &&
GEOMImpl_ILocalOperations::GetSubShape(aShapeBase, aCI.GetFace2(), aFace2))
{
TopoDS_Face F = TopoDS::Face(aFace1);
// fill map of edges of the second face
TopTools_MapOfShape aMap;
TopExp_Explorer Exp2 (aFace2, TopAbs_EDGE);
for (; Exp2.More(); Exp2.Next()) {
aMap.Add(Exp2.Current());
}
// find edges of the first face, common with the second face
TopExp_Explorer Exp (aFace1, TopAbs_EDGE);
for (; Exp.More(); Exp.Next()) {
if (aMap.Contains(Exp.Current())) {
TopoDS_Edge E = TopoDS::Edge(Exp.Current());
if (!BRepTools::IsReallyClosed(E, F) && !BRep_Tool::Degenerated(E))
{
if ( aType == CHAMFER_SHAPE_EDGE )
{
double aD1 = aCI.GetD1();
double aD2 = aCI.GetD2();
fill.Add(aD1, aD2, E, F);
}
else
{
double aD = aCI.GetD();
double anAngle = aCI.GetAngle();
if ( (anAngle > 0) && (anAngle < (Standard_PI/2)) )
fill.AddDA(aD, anAngle, E, F);
}
}
}
}
}
}
else if (aType == CHAMFER_SHAPE_FACES || aType == CHAMFER_SHAPE_FACES_AD) {
// chamfer on all edges of the selected faces, with D1 on the selected face
// (on first selected face, if the edge belongs to two selected faces)
int aLen = aCI.GetLength();
int ind = 1;
TopTools_MapOfShape aMap;
TopTools_IndexedDataMapOfShapeListOfShape M;
GEOMImpl_Block6Explorer::MapShapesAndAncestors(aShapeBase, TopAbs_EDGE, TopAbs_FACE, M);
for (; ind <= aLen; ind++)
{