b311480e |
1 | // Created on: 1998-11-10 |
2 | // Created by: Igor FEOKTISTOV |
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 | // |
973c2be1 |
8 | // This library is free software; you can redistribute it and / or modify it |
9 | // under the terms of the GNU Lesser General Public version 2.1 as published |
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 | |
17 | #include <FEmTool_ElementsOfRefMatrix.ixx> |
18 | #include <PLib_Base.hxx> |
19 | #include <TColStd_Array1OfReal.hxx> |
20 | |
21 | |
22 | FEmTool_ElementsOfRefMatrix::FEmTool_ElementsOfRefMatrix(const Handle(PLib_Base)& TheBase, |
23 | const Standard_Integer DerOrder): |
24 | myBase(TheBase) |
25 | { |
26 | if(DerOrder < 0 || DerOrder > 3) |
27 | Standard_ConstructionError::Raise("FEmTool_ElementsOfRefMatrix"); |
28 | |
29 | myDerOrder = DerOrder; |
30 | myNbEquations = (myBase->WorkDegree()+2)*(myBase->WorkDegree()+1)/2; |
31 | |
32 | } |
33 | |
34 | Standard_Integer FEmTool_ElementsOfRefMatrix::NbVariables() const |
35 | { |
36 | return 1; |
37 | } |
38 | |
39 | Standard_Integer FEmTool_ElementsOfRefMatrix::NbEquations() const |
40 | { |
41 | return myNbEquations; |
42 | } |
43 | |
44 | Standard_Boolean FEmTool_ElementsOfRefMatrix::Value(const math_Vector& X, math_Vector& F) |
45 | { |
46 | if(F.Length() < myNbEquations) Standard_OutOfRange::Raise("FEmTool_ElementsOfRefMatrix::Value"); |
47 | |
48 | Standard_Real u = X(X.Lower()); |
49 | TColStd_Array1OfReal Basis(0,myBase->WorkDegree()), Aux(0,myBase->WorkDegree()); |
50 | |
51 | switch (myDerOrder) { |
52 | case 0 : |
53 | myBase->D0(u, Basis); |
54 | break; |
55 | case 1 : |
56 | myBase->D1(u, Aux, Basis); |
57 | break; |
58 | case 2 : |
59 | myBase->D2(u, Aux, Aux, Basis); |
60 | break; |
61 | case 3 : |
62 | myBase->D3(u, Aux, Aux, Aux, Basis); |
63 | break; |
64 | } |
65 | |
66 | Standard_Integer i, j, ii = 0; |
67 | for(i = 0; i<=myBase->WorkDegree(); i++) |
68 | for(j = i; j<=myBase->WorkDegree(); j++) { |
69 | F(F.Lower()+ii) = Basis(i)*Basis(j); ii++; |
70 | } |
71 | |
72 | return Standard_True; |
73 | } |
74 | |