0026377: Passing Handle objects as arguments to functions as non-const reference...
[occt.git] / src / Plate / Plate_LinearScalarConstraint.cxx
CommitLineData
b311480e 1// Created on: 1998-03-26
2// Created by: # Andre LIEUTIER
3// Copyright (c) 1998-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.
7fd59977 16
7fd59977 17
42cf5bc1 18#include <gp_XYZ.hxx>
19#include <Plate_LinearScalarConstraint.hxx>
20#include <Plate_PinpointConstraint.hxx>
21#include <Standard_DimensionMismatch.hxx>
22#include <Standard_OutOfRange.hxx>
7fd59977 23
24Plate_LinearScalarConstraint::Plate_LinearScalarConstraint() {}
25
26Plate_LinearScalarConstraint::Plate_LinearScalarConstraint
27 (const Plate_PinpointConstraint& PPC1,const gp_XYZ& coeff)
28
29{
30 myPPC = new Plate_HArray1OfPinpointConstraint(1,1);
31 myCoef = new TColgp_HArray2OfXYZ(1,1,1,1);
32
33 myPPC->ChangeValue(1) = PPC1;
34 myCoef->ChangeValue(1,1) = coeff;
35}
36
76363522 37Plate_LinearScalarConstraint::Plate_LinearScalarConstraint(const Plate_Array1OfPinpointConstraint& thePPC,const TColgp_Array1OfXYZ& theCoeff)
7fd59977 38{
76363522 39 if(theCoeff.Length()!= thePPC.Length()) Standard_DimensionMismatch::Raise();
40 myPPC = new Plate_HArray1OfPinpointConstraint(1, thePPC.Length());
41 myCoef = new TColgp_HArray2OfXYZ(1,1,1, theCoeff.Length());
7fd59977 42
76363522 43 myPPC->ChangeArray1() = thePPC;
44 for(Standard_Integer i = 1; i<= theCoeff.Length(); i++) {
45 myCoef->ChangeValue(1,i) = theCoeff(i+ theCoeff.Lower()-1);
7fd59977 46 }
47}
48
49Plate_LinearScalarConstraint::Plate_LinearScalarConstraint
76363522 50 (const Plate_Array1OfPinpointConstraint& thePPC,const TColgp_Array2OfXYZ& theCoeff)
7fd59977 51{
76363522 52 if(theCoeff.RowLength()!= thePPC.Length()) Standard_DimensionMismatch::Raise();
53 myPPC = new Plate_HArray1OfPinpointConstraint(1, thePPC.Length());
54 myCoef = new TColgp_HArray2OfXYZ(1, theCoeff.ColLength(),1, theCoeff.RowLength());
7fd59977 55
76363522 56 myPPC->ChangeArray1() = thePPC;
57 myCoef->ChangeArray2() = theCoeff;
7fd59977 58}
59
60
61Plate_LinearScalarConstraint::Plate_LinearScalarConstraint(const Standard_Integer ColLen,const Standard_Integer RowLen)
62{
63 myPPC = new Plate_HArray1OfPinpointConstraint(1,RowLen);
64 myCoef = new TColgp_HArray2OfXYZ(1,ColLen,1,RowLen);
65 myCoef->Init(gp_XYZ(0.,0.,0.));
66}
67
68 void Plate_LinearScalarConstraint::SetPPC(const Standard_Integer Index,const Plate_PinpointConstraint& Value)
69{
70 myPPC->ChangeValue(Index) = Value;
71}
72
73 void Plate_LinearScalarConstraint::SetCoeff(const Standard_Integer Row,const Standard_Integer Col,const gp_XYZ& Value)
74{
75 myCoef->ChangeValue(Row,Col) = Value;
76}
77