Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Nektar
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jennifer Ryan
Nektar
Commits
d7702d44
Commit
d7702d44
authored
11 years ago
by
Sergey Yakovlev
Browse files
Options
Downloads
Patches
Plain Diff
- Bernstein basis definition cleanup
parent
8f26533f
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
library/LibUtilities/Foundations/Basis.cpp
+2
-31
2 additions, 31 deletions
library/LibUtilities/Foundations/Basis.cpp
with
2 additions
and
31 deletions
library/LibUtilities/Foundations/Basis.cpp
+
2
−
31
View file @
d7702d44
...
...
@@ -661,39 +661,11 @@ namespace Nektar
{
//points z[] are in (-1,1) so we have to rescale to (0,1) on
//which Bernstein polynomials are defined:
//b(x,P,p) = binom_coeff(P,p) * (x)^p * (1-x)^(P-p)
//P is polynomial degree, p is in (0,1,..,n)
//P is polynomial degree, p is the number of modes
//We are going to used Legendre-type ordering (in terms of mapping): vertex modes are first and last
int
nu
;
//lower number in the binomial coefficient binom_coeff(P, nu)
int
P
=
numModes
-
1
;
//Bernstein polynomial degree
Array
<
OneD
,
NekDouble
>
bern_tmp
(
numModes
,
0.0
);
//array containing binomial coefficients, first and last are 1s
Array
<
OneD
,
NekDouble
>
b_coeffs
(
numModes
,
1.0
);
//compute array midpoint, the values after midpoint will be mirrored
int
mid_array
=
(
numModes
%
2
==
1
)
?
numModes
/
2
+
1
:
numModes
/
2
;
if
(
numModes
>
2
)
{
//auxillary variables used in multiplicative binomial coefficient formula
//after all the cancellation is done
unsigned
long
b_coeff_num
=
P
;
//binomial coefficient numerator
unsigned
long
b_coeff_den
=
1
;
//binomial coefficient denomiantor
unsigned
long
num_mult
=
b_coeff_num
;
unsigned
long
den_mult
=
b_coeff_den
;
for
(
nu
=
1
;
nu
<
mid_array
;
++
nu
)
{
b_coeffs
[
nu
]
=
(
NekDouble
)
b_coeff_num
/
(
NekDouble
)
b_coeff_den
;
b_coeffs
[
P
-
nu
]
=
b_coeffs
[
nu
];
//decrementing numerator and incrementing denominator
num_mult
--
;
den_mult
++
;
b_coeff_num
*=
num_mult
;
b_coeff_den
*=
den_mult
;
}
}
Array
<
OneD
,
NekDouble
>
bern_tmp
(
numModes
,
0.0
);
//temporary array
mode
=
m_bdata
.
data
();
...
...
@@ -708,7 +680,6 @@ namespace Nektar
for
(
k
=
0
;
k
<=
P
-
j
;
k
++
)
bern_tmp
[
k
]
=
(
0.5
-
0.5
*
z
[
i
])
*
bern_tmp
[
k
]
+
(
0.5
+
0.5
*
z
[
i
])
*
bern_tmp
[
k
+
1
];
mode
[
i
]
=
bern_tmp
[
0
];
//mode[i] = b_coeffs[p] * pow(0.5+0.5*z[i],p) * pow(0.5-0.5*z[i], P-p);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment