Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
mantid
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
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
mantidproject
mantid
Commits
e9c6fd09
Commit
e9c6fd09
authored
8 years ago
by
Michael Wedel
Browse files
Options
Downloads
Patches
Plain Diff
Refs #19049. Improve PointGroup performance
parent
761da2d7
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Framework/Geometry/inc/MantidGeometry/Crystal/PointGroup.h
+1
-1
1 addition, 1 deletion
Framework/Geometry/inc/MantidGeometry/Crystal/PointGroup.h
Framework/Geometry/src/Crystal/PointGroup.cpp
+19
-15
19 additions, 15 deletions
Framework/Geometry/src/Crystal/PointGroup.cpp
with
20 additions
and
16 deletions
Framework/Geometry/inc/MantidGeometry/Crystal/PointGroup.h
+
1
−
1
View file @
e9c6fd09
...
...
@@ -63,7 +63,7 @@ public:
Kernel
::
V3D
getReflectionFamily
(
const
Kernel
::
V3D
&
hkl
)
const
;
protected
:
std
::
vector
<
Kernel
::
V3D
>
getEquivalent
Set
(
const
Kernel
::
V3D
&
hkl
)
const
;
std
::
vector
<
Kernel
::
V3D
>
get
All
Equivalent
s
(
const
Kernel
::
V3D
&
hkl
)
const
;
CrystalSystem
getCrystalSystemFromGroup
()
const
;
LatticeSystem
getLatticeSystemFromCrystalSystemAndGroup
(
...
...
This diff is collapsed.
Click to expand it.
Framework/Geometry/src/Crystal/PointGroup.cpp
+
19
−
15
View file @
e9c6fd09
...
...
@@ -31,7 +31,14 @@ using Kernel::IntMatrix;
* @return :: std::vector containing all equivalent hkls.
*/
std
::
vector
<
V3D
>
PointGroup
::
getEquivalents
(
const
V3D
&
hkl
)
const
{
return
getEquivalentSet
(
hkl
);
auto
equivalents
=
getAllEquivalents
(
hkl
);
std
::
sort
(
equivalents
.
begin
(),
equivalents
.
end
(),
std
::
greater
<
V3D
>
());
equivalents
.
erase
(
std
::
unique
(
equivalents
.
begin
(),
equivalents
.
end
()),
equivalents
.
end
());
return
equivalents
;
}
/**
...
...
@@ -48,7 +55,9 @@ std::vector<V3D> PointGroup::getEquivalents(const V3D &hkl) const {
* @return :: hkl specific to a family of index-triplets
*/
V3D
PointGroup
::
getReflectionFamily
(
const
Kernel
::
V3D
&
hkl
)
const
{
return
*
getEquivalentSet
(
hkl
).
begin
();
auto
equivalents
=
getAllEquivalents
(
hkl
);
return
*
std
::
max_element
(
equivalents
.
begin
(),
equivalents
.
end
());
}
/// Protected constructor - can not be used directly.
...
...
@@ -65,9 +74,9 @@ std::string PointGroup::getSymbol() const { return m_symbolHM; }
bool
PointGroup
::
isEquivalent
(
const
Kernel
::
V3D
&
hkl
,
const
Kernel
::
V3D
&
hkl2
)
const
{
std
::
vector
<
V3D
>
hklEquivalents
=
getEquivalent
Set
(
hkl
);
auto
hklEquivalents
=
get
All
Equivalent
s
(
hkl
);
return
(
std
::
find
(
hklEquivalents
.
begin
(),
hklEquivalents
.
end
(),
hkl2
)
!=
return
(
std
::
find
(
hklEquivalents
.
c
begin
(),
hklEquivalents
.
c
end
(),
hkl2
)
!=
hklEquivalents
.
end
());
}
...
...
@@ -75,29 +84,24 @@ bool PointGroup::isEquivalent(const Kernel::V3D &hkl,
* Generates a set of hkls
*
* This method applies all transformation matrices to the supplied hkl and puts
*
i
t into a
set
, which is returned in the end.
Using a set ensures that each
*
hkl occurs once and only once. This set is the set of equivalent hkls,
*
specific to a concrete point group
.
* t
hem
into a
vector
, which is returned in the end.
For special reflections
*
such as 100 or 110 or 111, the vector may contain duplicates that need to
*
be filtered out
.
*
* The symmetry operations need to be set prior to calling this method by a call
* to PointGroup::setTransformationMatrices.
*
* @param hkl :: Arbitrary hkl
* @return ::
set
of hkls.
* @return ::
vector
of hkls.
*/
std
::
vector
<
V3D
>
PointGroup
::
getEquivalent
Set
(
const
Kernel
::
V3D
&
hkl
)
const
{
std
::
vector
<
V3D
>
PointGroup
::
get
All
Equivalent
s
(
const
Kernel
::
V3D
&
hkl
)
const
{
std
::
vector
<
V3D
>
equivalents
;
equivalents
.
reserve
(
m_allOperations
.
size
());
for
(
const
auto
&
operation
:
m_allOperations
)
{
equivalents
.
push
_back
(
operation
.
transformHKL
(
hkl
));
equivalents
.
emplace
_back
(
operation
.
transformHKL
(
hkl
));
}
std
::
sort
(
equivalents
.
begin
(),
equivalents
.
end
(),
std
::
greater
<
V3D
>
());
equivalents
.
erase
(
std
::
unique
(
equivalents
.
begin
(),
equivalents
.
end
()),
equivalents
.
end
());
return
equivalents
;
}
...
...
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