0031004: Coding - eliminate warnings issued by gcc 9.1.0
[occt.git] / src / AdvApp2Var / AdvApp2Var_Network.cxx
CommitLineData
b311480e 1// Created on: 1996-07-02
2// Created by: Joelle CHAUVET
3// Copyright (c) 1996-1999 Matra Datavision
973c2be1 4// Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 5//
973c2be1 6// This file is part of Open CASCADE Technology software library.
b311480e 7//
d5f74e42 8// This library is free software; you can redistribute it and/or modify it under
9// the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 10// by the Free Software Foundation, with special exception defined in the file
11// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12// distribution for complete text of the license and disclaimer of any warranty.
b311480e 13//
973c2be1 14// Alternatively, this file may be used under the terms of Open CASCADE
15// commercial license or contractual agreement.
b311480e 16
7fd59977 17// Modified: Mon Dec 9 11:39:13 1996
18// by: Joelle CHAUVET
19// G1135 : empty constructor
20
42cf5bc1 21#include <AdvApp2Var_Network.hxx>
7fd59977 22#include <AdvApp2Var_Patch.hxx>
23#include <AdvApp2Var_SequenceOfPatch.hxx>
42cf5bc1 24#include <Standard_NoSuchObject.hxx>
7fd59977 25#include <TColStd_SequenceOfReal.hxx>
26
27//==========================================================================================
28//function : AdvApp2Var_Network
29//purpose :
30//==========================================================================================
7fd59977 31AdvApp2Var_Network::AdvApp2Var_Network()
32{
33}
34
35
36//==========================================================================================
37//function : AdvApp2Var_Network
38//purpose :
39//==========================================================================================
40
41AdvApp2Var_Network::AdvApp2Var_Network(const AdvApp2Var_SequenceOfPatch& Net,
42 const TColStd_SequenceOfReal& TheU,
43 const TColStd_SequenceOfReal& TheV)
44{
45 myNet=Net;
46 myUParameters=TheU;
47 myVParameters=TheV;
48}
49
50//==========================================================================================
51//function : FirstNotApprox
52//purpose : return the first Patch not approximated
53//==========================================================================================
54
158f2931 55Standard_Boolean AdvApp2Var_Network::FirstNotApprox(Standard_Integer& theIndex) const
7fd59977 56{
158f2931 57 Standard_Integer anIndex = 1;
58 for (AdvApp2Var_SequenceOfPatch::Iterator aPatchIter (myNet); aPatchIter.More(); aPatchIter.Next(), ++anIndex)
59 {
60 const Handle(AdvApp2Var_Patch)& aPatch = aPatchIter.Value();
61 if (!aPatch->IsApproximated())
62 {
63 theIndex = anIndex;
64 return true;
65 }
7fd59977 66 }
158f2931 67 return false;
7fd59977 68}
69
70//==========================================================================================
71//function : UpdateInU
72//purpose : modification and insertion of patches and parameters
73//==========================================================================================
74
75void AdvApp2Var_Network::UpdateInU(const Standard_Real CuttingValue)
76{
77
78// insertion du nouveau parametre de decoupe
79 Standard_Integer i=1,j;
80 while (myUParameters.Value(i)<CuttingValue) {
81 i++;
82 }
83 myUParameters.InsertBefore(i,CuttingValue);
84
158f2931 85 for (j=1; j< myVParameters.Length() ; j++)
86 {
7fd59977 87// modification des patches concernes par la decoupe
158f2931 88 Standard_Integer indice = (myUParameters.Length()-1) * (j-1) + i - 1;
89 const Handle(AdvApp2Var_Patch)& aPat = myNet.Value(indice);
90 aPat->ChangeDomain (aPat->U0(), CuttingValue, aPat->V0(), aPat->V1());
91 aPat->ResetApprox();
7fd59977 92
93// insertion des nouveaux patches
158f2931 94 Handle(AdvApp2Var_Patch) aNewPat = new AdvApp2Var_Patch (CuttingValue,myUParameters.Value(i+1),
7fd59977 95 myVParameters.Value(j),myVParameters.Value(j+1),
158f2931 96 aPat->UOrder(), aPat->VOrder());
97 aNewPat->ResetApprox();
98 myNet.InsertAfter(indice, aNewPat);
7fd59977 99 }
100
101}
102
103//==========================================================================================
104//function : UpdateInV
105//purpose : modification and insertion of patches and parameters
106//==========================================================================================
107
108void AdvApp2Var_Network::UpdateInV(const Standard_Real CuttingValue)
109{
110
111// insertion du nouveau parametre de decoupe
158f2931 112 Standard_Integer j = 1;
113 Handle(AdvApp2Var_Patch) Pat;
114 while (myVParameters.Value(j)<CuttingValue)
115 {
7fd59977 116 j++;
117 }
118 myVParameters.InsertBefore(j,CuttingValue);
119
120// modification des patches concernes par la decoupe
158f2931 121 for (Standard_Integer i = 1; i < myUParameters.Length(); i++)
122 {
123 const Standard_Integer indice = (myUParameters.Length()-1) * (j-2) + i;
7fd59977 124 Pat = myNet.Value(indice);
158f2931 125 Pat->ChangeDomain(Pat->U0(), Pat->U1(), Pat->V0(), CuttingValue);
126 Pat->ResetApprox();
7fd59977 127 }
128
129// insertion des nouveaux patches
158f2931 130 for (Standard_Integer i = 1; i < myUParameters.Length(); i++)
131 {
132 const Standard_Integer indice = (myUParameters.Length()-1) * (j-1) + i-1;
133 Handle(AdvApp2Var_Patch) aNewPat = new AdvApp2Var_Patch (myUParameters.Value(i), myUParameters.Value(i+1),
7fd59977 134 CuttingValue,myVParameters.Value(j+1),
158f2931 135 Pat->UOrder(),Pat->VOrder());
136 aNewPat->ResetApprox();
137 myNet.InsertAfter (indice, aNewPat);
7fd59977 138 }
139}
140
141//=======================================================================
142//function : SameDegree
143//purpose : same numbers of coefficients for all patches
144//=======================================================================
145
146void AdvApp2Var_Network::SameDegree(const Standard_Integer iu,
147 const Standard_Integer iv,
148 Standard_Integer& ncfu,
149 Standard_Integer& ncfv)
150{
7fd59977 151// calcul des coeff. max avec init selon l'ordre de continuite
7fd59977 152 ncfu = 2*iu+2;
153 ncfv = 2*iv+2;
158f2931 154 for (AdvApp2Var_SequenceOfPatch::Iterator aPatIter (myNet); aPatIter.More(); aPatIter.Next())
155 {
156 const Handle(AdvApp2Var_Patch)& aPat = aPatIter.Value();
157 ncfu = Max(ncfu, aPat->NbCoeffInU());
158 ncfv = Max(ncfv, aPat->NbCoeffInV());
7fd59977 159 }
160
161// augmentation des nombres de coeff.
158f2931 162 for (AdvApp2Var_SequenceOfPatch::Iterator aPatIter (myNet); aPatIter.More(); aPatIter.Next())
163 {
164 const Handle(AdvApp2Var_Patch)& aPat = aPatIter.Value();
165 aPat->ChangeNbCoeff (ncfu, ncfv);
7fd59977 166 }
167
168}
169
170//=======================================================================
171//function : NbPatch
172//purpose :
173//=======================================================================
174
175Standard_Integer AdvApp2Var_Network::NbPatch() const
176{
177 return myNet.Length();
178}
179
180//=======================================================================
181//function : NbPatchInU
182//purpose :
183//=======================================================================
184
185Standard_Integer AdvApp2Var_Network::NbPatchInU() const
186{
187 return myUParameters.Length()-1;
188}
189
190//=======================================================================
191//function : NbPatchInV
192//purpose :
193//=======================================================================
194
195Standard_Integer AdvApp2Var_Network::NbPatchInV() const
196{
197 return myVParameters.Length()-1;
198}
199
200//=======================================================================
201//function : UParameter
202//purpose :
203//=======================================================================
204
205Standard_Real AdvApp2Var_Network::UParameter(const Standard_Integer Index) const
206{
207 return myUParameters.Value(Index);
208}
209
210//=======================================================================
211//function : VParameter
212//purpose :
213//=======================================================================
214
215Standard_Real AdvApp2Var_Network::VParameter(const Standard_Integer Index) const
216{
217 return myVParameters.Value(Index);
218}
219