0024157: Parallelization of assembly part of BO
[occt.git] / src / IFSelect / IFSelect_GraphCounter.cxx
CommitLineData
b311480e 1// Copyright (c) 1999-2012 OPEN CASCADE SAS
2//
3// The content of this file is subject to the Open CASCADE Technology Public
4// License Version 6.5 (the "License"). You may not use the content of this file
5// except in compliance with the License. Please obtain a copy of the License
6// at http://www.opencascade.org and read it completely before using this file.
7//
8// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
9// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
10//
11// The Original Code and all software distributed under the License is
12// distributed on an "AS IS" basis, without warranty of any kind, and the
13// Initial Developer hereby disclaims all such warranties, including without
14// limitation, any warranties of merchantability, fitness for a particular
15// purpose or non-infringement. Please see the License for the specific terms
16// and conditions governing the rights and limitations under the License.
17
7fd59977 18#include <IFSelect_GraphCounter.ixx>
19#include <Interface_EntityIterator.hxx>
20#include <IFSelect_SelectPointed.hxx>
21#include <stdio.h>
22#include <string.h>
23
24
b311480e 25IFSelect_GraphCounter::IFSelect_GraphCounter
7fd59977 26 (const Standard_Boolean withmap, const Standard_Boolean withlist)
27 : IFSelect_SignCounter (withmap,withlist) { }
28
29 Handle(IFSelect_SelectDeduct) IFSelect_GraphCounter::Applied () const
30 { return theapplied; }
31
32 void IFSelect_GraphCounter::SetApplied
33 (const Handle(IFSelect_SelectDeduct)& applied)
34 { theapplied = applied; }
35
36 void IFSelect_GraphCounter::AddWithGraph
37 (const Handle(TColStd_HSequenceOfTransient)& list,
38 const Interface_Graph& graph)
39{
40 if (theapplied.IsNull()) { AddList (list,graph.Model()); return; }
41 if (list.IsNull()) return;
42 Standard_Integer i, nb = list->Length();
43 for (i = 1; i <= nb; i ++) {
44 char val[12];
45 Handle(Standard_Transient) ent = list->Value(i);
46 theapplied->Alternate()->SetEntity (ent);
47 Interface_EntityIterator iter = theapplied->UniqueResult(graph);
48 Standard_Integer n = iter.NbEntities();
49 switch (n) {
50 case 0: Add (ent,"0"); break;
51 case 1: Add (ent,"1"); break;
52 case 2: Add (ent,"2"); break;
53 case 3: Add (ent,"3"); break;
54 case 4: Add (ent,"4"); break;
55 case 5: Add (ent,"5"); break;
56 case 6: Add (ent,"6"); break;
57 case 7: Add (ent,"7"); break;
58 case 8: Add (ent,"8"); break;
59 case 9: Add (ent,"9"); break;
60 default :
61 sprintf (val,"%d",n);
62 Add (ent,val);
63 break;
64 }
65 }
66}