Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
BornAgain
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mlz
BornAgain
Commits
352f8979
Commit
352f8979
authored
2 years ago
by
Wuttke, Joachim
Browse files
Options
Downloads
Patches
Plain Diff
use top-level rank()
parent
cf4a0f28
No related branches found
No related tags found
1 merge request
!886
Powerfield now inherits from IField; new c'tors
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Device/Data/Powerfield.h
+12
-12
12 additions, 12 deletions
Device/Data/Powerfield.h
with
12 additions
and
12 deletions
Device/Data/Powerfield.h
+
12
−
12
View file @
352f8979
...
...
@@ -399,11 +399,11 @@ std::vector<int> Powerfield<T>::getAxesBinIndices(size_t global_index) const
ASSERT
(
m_ll_data
);
size_t
remainder
=
global_index
;
std
::
vector
<
int
>
result
;
result
.
resize
(
m_ll_data
->
rank
());
for
(
size_t
i
=
0
;
i
<
m_ll_data
->
rank
();
++
i
)
{
result
[
m_ll_data
->
rank
()
-
1
-
i
]
=
(
int
)(
remainder
%
m_axes
[
m_ll_data
->
rank
()
-
1
-
i
]
->
size
());
remainder
/=
m_axes
[
m_ll_data
->
rank
()
-
1
-
i
]
->
size
();
result
.
resize
(
rank
());
for
(
size_t
i
=
0
;
i
<
rank
();
++
i
)
{
result
[
rank
()
-
1
-
i
]
=
(
int
)(
remainder
%
m_axes
[
rank
()
-
1
-
i
]
->
size
());
remainder
/=
m_axes
[
rank
()
-
1
-
i
]
->
size
();
}
return
result
;
}
...
...
@@ -413,8 +413,8 @@ size_t Powerfield<T>::getAxisBinIndex(size_t global_index, size_t i_selected_axi
{
ASSERT
(
m_ll_data
);
size_t
remainder
(
global_index
);
for
(
size_t
i
=
0
;
i
<
m_ll_data
->
rank
();
++
i
)
{
size_t
i_axis
=
m_ll_data
->
rank
()
-
1
-
i
;
for
(
size_t
i
=
0
;
i
<
rank
();
++
i
)
{
size_t
i_axis
=
rank
()
-
1
-
i
;
size_t
result
=
remainder
%
m_axes
[
i_axis
]
->
size
();
if
(
i_selected_axis
==
i_axis
)
return
result
;
...
...
@@ -427,10 +427,10 @@ template <class T>
size_t
Powerfield
<
T
>::
toGlobalIndex
(
const
std
::
vector
<
unsigned
>&
axes_indices
)
const
{
ASSERT
(
m_ll_data
);
ASSERT
(
axes_indices
.
size
()
==
m_ll_data
->
rank
());
ASSERT
(
axes_indices
.
size
()
==
rank
());
size_t
result
=
0
;
size_t
step_size
=
1
;
for
(
size_t
i
=
m_ll_data
->
rank
();
i
>
0
;
--
i
)
{
for
(
size_t
i
=
rank
();
i
>
0
;
--
i
)
{
ASSERT
(
axes_indices
[
i
-
1
]
<
m_axes
[
i
-
1
]
->
size
());
result
+=
axes_indices
[
i
-
1
]
*
step_size
;
step_size
*=
m_axes
[
i
-
1
]
->
size
();
...
...
@@ -442,10 +442,10 @@ template <class T>
size_t
Powerfield
<
T
>::
findGlobalIndex
(
const
std
::
vector
<
double
>&
coordinates
)
const
{
ASSERT
(
m_ll_data
);
ASSERT
(
coordinates
.
size
()
==
m_ll_data
->
rank
());
ASSERT
(
coordinates
.
size
()
==
rank
());
std
::
vector
<
unsigned
>
axes_indexes
;
axes_indexes
.
resize
(
m_ll_data
->
rank
());
for
(
size_t
i
=
0
;
i
<
m_ll_data
->
rank
();
++
i
)
axes_indexes
.
resize
(
rank
());
for
(
size_t
i
=
0
;
i
<
rank
();
++
i
)
axes_indexes
[
i
]
=
static_cast
<
unsigned
>
(
m_axes
[
i
]
->
findClosestIndex
(
coordinates
[
i
]));
return
toGlobalIndex
(
axes_indexes
);
}
...
...
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