973c2be1 |
1 | // Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
2 | // |
973c2be1 |
3 | // This file is part of Open CASCADE Technology software library. |
b311480e |
4 | // |
d5f74e42 |
5 | // This library is free software; you can redistribute it and/or modify it under |
6 | // the terms of the GNU Lesser General Public License version 2.1 as published |
973c2be1 |
7 | // by the Free Software Foundation, with special exception defined in the file |
8 | // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
9 | // distribution for complete text of the license and disclaimer of any warranty. |
b311480e |
10 | // |
973c2be1 |
11 | // Alternatively, this file may be used under the terms of Open CASCADE |
12 | // commercial license or contractual agreement. |
b311480e |
13 | |
7fd59977 |
14 | #include <IFGraph_StrongComponants.ixx> |
15 | //#include <IFGraph_SortedStrongs.hxx> |
16 | #include <Interface_Graph.hxx> |
17 | #include <Interface_GraphContent.hxx> |
18 | |
19 | //#define PRINTDEB |
20 | #define pbgraphtool |
21 | |
22 | |
b311480e |
23 | IFGraph_StrongComponants::IFGraph_StrongComponants |
7fd59977 |
24 | (const Interface_Graph& agraph, const Standard_Boolean whole) |
25 | : IFGraph_SubPartsIterator (agraph, whole) { } |
26 | |
27 | void IFGraph_StrongComponants::Evaluate () |
28 | { |
29 | Interface_GraphContent iter = Loaded(); |
30 | Interface_Graph G(thegraph); G.GetFromIter(iter,0); |
31 | #ifdef pbgraphtool |
32 | Standard_Integer nb = G.Size(); |
33 | for (Standard_Integer i = 1; i <= nb; i ++) { |
34 | if (!G.IsPresent(i)) continue; |
35 | AddPart(); |
36 | GetFromEntity (G.Entity(i),Standard_False); |
37 | } |
38 | #else |
0797d9d3 |
39 | #ifdef OCCT_DEBUG |
7fd59977 |
40 | cout<<"StrongComponants :"<<endl; |
41 | #endif |
42 | for (IFGraph_SortedStrongs res(G); res.More(); res.Next()) { |
43 | Standard_Integer nb = res.NbVertices(); |
0797d9d3 |
44 | #ifdef OCCT_DEBUG |
7fd59977 |
45 | cout<<" Iteration, Vertices:"<<nb<<" :"; |
46 | #endif |
47 | if (nb == 0) continue; |
48 | AddPart(); |
49 | for (Standard_Integer i = 1; i <= nb; i ++) |
0797d9d3 |
50 | #ifdef OCCT_DEBUG |
7fd59977 |
51 | { |
52 | Handle(Standard_Transient) oneres = res.Value(i); |
53 | cout<<" "<<G.EntityNumber(oneres); |
54 | GetFromEntity(oneres,Standard_False); |
55 | } |
56 | cout<<endl; |
57 | #else |
58 | GetFromEntity(res.Value(i),Standard_False); |
59 | #endif |
60 | } |
61 | #endif |
62 | } |