Salome HOME
Merging with WPdev
[modules/geom.git] / src / NMTTools / NMTTools_PaveFiller.cxx
1 // Copyright (C) 2005  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
2 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
3 // 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either 
7 // version 2.1 of the License.
8 // 
9 // This library is distributed in the hope that it will be useful 
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
12 // Lesser General Public License for more details.
13 //
14 // You should have received a copy of the GNU Lesser General Public  
15 // License along with this library; if not, write to the Free Software 
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 //
18 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 //
20 // File:        NMTTools_PaveFiller.cxx
21 // Created:     Fri Dec  5 14:58:54 2003
22 // Author:      Peter KURNEV
23 //              <pkv@irinox>
24 //
25 #include <NMTTools_PaveFiller.ixx>
26 //
27 #include <BOPTColStd_Failure.hxx>
28 #include <NMTDS_ShapesDataStructure.hxx>
29 #include <NMTTools_DEProcessor.hxx>
30
31 //
32 //=======================================================================
33 // function: NMTTools_PaveFiller::NMTTools_PaveFiller
34 // purpose: 
35 //=======================================================================
36   NMTTools_PaveFiller::NMTTools_PaveFiller()
37 {
38   myIntrPool=NULL;
39   myDS=NULL;
40   myIsDone=Standard_False;
41   myNbSources=0;
42   myNbEdges=0;
43 }
44 //=======================================================================
45 // function:NMTTools_PaveFiller::NMTTools_PaveFiller
46 // purpose: 
47 //=======================================================================
48   NMTTools_PaveFiller::NMTTools_PaveFiller(const BOPTools_InterferencePool& aIP)
49 {
50   SetInterferencePool(aIP);
51 }
52 //=======================================================================
53 // function: Destroy
54 // purpose: 
55 //=======================================================================
56   void NMTTools_PaveFiller::Destroy()
57 {
58 }
59 //=======================================================================
60 // function: SetInterferencePool
61 // purpose: 
62 //=======================================================================
63   void NMTTools_PaveFiller::SetInterferencePool(const BOPTools_InterferencePool& aIP)
64 {
65   myIsDone=Standard_False;
66   //
67   myIntrPool=(BOPTools_InterferencePool*)&aIP;
68   myDS=(NMTDS_ShapesDataStructure*)myIntrPool->DS();
69   myNbSources=myDS->NumberOfShapesOfTheObject()+myDS->NumberOfShapesOfTheTool();
70   myNbEdges=myDS->NbEdges();
71 }
72 //=======================================================================
73 // function:  InterfPool
74 // purpose: 
75 //=======================================================================
76   BOPTools_PInterferencePool NMTTools_PaveFiller::InterfPool()
77 {
78   return myIntrPool;
79 }
80 //=======================================================================
81 // function:IsDone
82 // purpose: 
83 //=======================================================================
84   Standard_Boolean NMTTools_PaveFiller::IsDone() const
85 {
86   return myIsDone;
87 }
88 //=======================================================================
89 // function:  DS
90 // purpose: 
91 //=======================================================================
92   NMTDS_PShapesDataStructure NMTTools_PaveFiller::DS()
93 {
94   return myDS;
95 }
96 //=======================================================================
97 // function: Context
98 // purpose: 
99 //=======================================================================
100   const IntTools_Context& NMTTools_PaveFiller::Context() const
101 {
102   return myContext;
103 }
104 //=======================================================================
105 // function: ChangeContext
106 // purpose: 
107 //=======================================================================
108   IntTools_Context& NMTTools_PaveFiller::ChangeContext() 
109 {
110   return myContext;
111 }
112 //=======================================================================
113 // function: PavePool
114 // purpose: 
115 //=======================================================================
116   const BOPTools_PavePool& NMTTools_PaveFiller::PavePool() const
117 {
118   return myPavePool;
119 }
120 //=======================================================================
121 // function: ChangePavePool
122 // purpose: 
123 //=======================================================================
124   BOPTools_PavePool& NMTTools_PaveFiller::ChangePavePool()
125 {
126   return myPavePool;
127 }
128 //=======================================================================
129 // function:  CommonBlockPool
130 // purpose: 
131 //=======================================================================
132   const NMTTools_CommonBlockPool& NMTTools_PaveFiller::CommonBlockPool() const
133 {
134   return myCommonBlockPool;
135 }
136 //=======================================================================
137 // function:  ChangeCommonBlockPool
138 // purpose: 
139 //=======================================================================
140   NMTTools_CommonBlockPool& NMTTools_PaveFiller::ChangeCommonBlockPool()
141 {
142   return myCommonBlockPool;
143 }
144 //=======================================================================
145 // function:  SplitShapesPool
146 // purpose: 
147 //=======================================================================
148   const BOPTools_SplitShapesPool& NMTTools_PaveFiller::SplitShapesPool() const
149 {
150   return mySplitShapesPool;
151 }
152
153 //=======================================================================
154 // function:  ChangeSplitShapesPool
155 // purpose: 
156 //=======================================================================
157   BOPTools_SplitShapesPool& NMTTools_PaveFiller::ChangeSplitShapesPool()
158 {
159   return mySplitShapesPool;
160 }
161 //=======================================================================
162 // function: Init
163 // purpose: 
164 //=======================================================================
165   void NMTTools_PaveFiller::Init()
166 {
167   myDSIt.SetDS(myDS);
168   // Modified Thu Sep 14 14:35:18 2006 
169   // Contribution of Samtech www.samcef.com BEGIN
170   myDSIt.Prepare();
171   // Contribution of Samtech www.samcef.com END 
172 }
173
174 //=======================================================================
175 // function: Perform
176 // purpose: 
177 //=======================================================================
178   void NMTTools_PaveFiller::Perform()
179 {
180   myIsDone=Standard_False;
181   //
182   try {
183     // 0.
184     // Modified Thu Sep 14 14:35:18 2006 
185     // Contribution of Samtech www.samcef.com BEGIN
186     Init();
187     // Contribution of Samtech www.samcef.com END
188     //1.VV
189     //
190     PerformVV();
191     PerformNewVertices();
192     //
193     // 2.VE
194     myPavePool.Resize (myNbEdges);
195     
196     PrepareEdges();
197
198     PerformVE();
199     //
200     // 3.VF
201     PerformVF();
202     //
203     // 4.EE
204     myCommonBlockPool.Resize (myNbEdges);
205     mySplitShapesPool.Resize (myNbEdges);
206     myPavePoolNew    .Resize (myNbEdges);
207
208     PreparePaveBlocks(TopAbs_VERTEX, TopAbs_EDGE);
209     PreparePaveBlocks(TopAbs_EDGE, TopAbs_EDGE);
210     //
211     PerformEE();
212     //
213     RefinePavePool ();
214     //
215     myPavePoolNew.Destroy();
216     myPavePoolNew.Resize (myNbEdges);
217     //
218     // 5.EF
219     PreparePaveBlocks(TopAbs_EDGE, TopAbs_FACE);
220
221     PerformEF();
222     //
223     RefinePavePool();
224     //
225     myPavePoolNew.Destroy();
226     
227     MakeSplitEdges();
228
229     UpdateCommonBlocks();
230     //
231     // 6. FF
232     PerformFF ();
233     //
234     MakeBlocks();
235     //
236     MakePCurves();
237     //
238     // 7.Postprocessing 
239     UpdatePaveBlocks();
240     //
241     NMTTools_DEProcessor aDEP(*this);
242     aDEP.Do();
243     //
244     // Modified to treat Alone Vertices Thu Sep 14 14:35:18 2006 
245     // Contribution of Samtech www.samcef.com BEGIN
246     MakeAloneVertices();
247     // Contribution of Samtech www.samcef.com END
248     //
249     myIsDone=Standard_True;
250   }
251   catch (BOPTColStd_Failure& ) {
252   }
253 }