Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
mantidproject
mantid
Commits
561c98fa
Commit
561c98fa
authored
Jan 19, 2016
by
Hahn, Steven
Browse files
Refs #14988. Started making changes suggested by Simon.
parent
f94132a9
Changes
5
Hide whitespace changes
Inline
Side-by-side
Framework/API/inc/MantidAPI/ImmutableCompositeFunction.h
View file @
561c98fa
...
...
@@ -91,7 +91,7 @@ protected:
private:
/// Keep paramater aliases
std
::
map
<
std
::
string
,
size_t
>
m_alias
;
std
::
map
<
std
::
string
,
size_t
>
m_alias
es
;
};
}
// namespace API
...
...
Framework/API/src/Algorithm.cpp
View file @
561c98fa
...
...
@@ -234,13 +234,8 @@ const std::vector<std::string> Algorithm::workspaceMethodOn() const {
WORKSPACE_TYPES_SEPARATOR
,
Poco
::
StringTokenizer
::
TOK_TRIM
|
Poco
::
StringTokenizer
::
TOK_IGNORE_EMPTY
);
std
::
vector
<
std
::
string
>
res
;
res
.
reserve
(
tokenizer
.
count
());
for
(
const
auto
&
iter
:
tokenizer
)
{
res
.
push_back
(
iter
);
}
return
res
;
return
std
::
vector
<
std
::
string
>
(
tokenizer
.
begin
(),
tokenizer
.
end
())
;
}
/**
...
...
@@ -405,13 +400,13 @@ void Algorithm::unlockWorkspaces() {
if
(
this
->
isChild
())
return
;
auto
&
debugLog
=
g_log
.
debug
();
for
(
auto
ws
:
m_writeLockedWorkspaces
)
{
for
(
auto
&
ws
:
m_writeLockedWorkspaces
)
{
if
(
ws
)
{
debugLog
<<
"Unlocking "
<<
ws
->
getName
()
<<
std
::
endl
;
ws
->
getLock
()
->
unlock
();
}
}
for
(
auto
ws
:
m_readLockedWorkspaces
)
{
for
(
auto
&
ws
:
m_readLockedWorkspaces
)
{
if
(
ws
)
{
debugLog
<<
"Unlocking "
<<
ws
->
getName
()
<<
std
::
endl
;
ws
->
getLock
()
->
unlock
();
...
...
Framework/API/src/CompositeFunction.cpp
View file @
561c98fa
...
...
@@ -62,9 +62,8 @@ std::string CompositeFunction::asString() const {
getAttribute
(
"NumDeriv"
).
asBool
()
==
true
)
{
ostr
<<
"composite="
<<
name
();
std
::
vector
<
std
::
string
>
attr
=
this
->
getAttributeNames
();
for
(
auto
&
i
:
attr
)
{
std
::
string
attName
=
i
;
std
::
string
attValue
=
this
->
getAttribute
(
i
).
value
();
for
(
const
auto
&
attName
:
attr
)
{
std
::
string
attValue
=
this
->
getAttribute
(
attName
).
value
();
if
(
!
attValue
.
empty
())
{
ostr
<<
','
<<
attName
<<
'='
<<
attValue
;
}
...
...
Framework/API/src/IFunction.cpp
View file @
561c98fa
...
...
@@ -159,9 +159,8 @@ std::string IFunction::asString() const {
ostr
<<
"name="
<<
this
->
name
();
// print the attributes
std
::
vector
<
std
::
string
>
attr
=
this
->
getAttributeNames
();
for
(
auto
&
i
:
attr
)
{
std
::
string
attName
=
i
;
std
::
string
attValue
=
this
->
getAttribute
(
i
).
value
();
for
(
const
auto
&
attName
:
attr
)
{
std
::
string
attValue
=
this
->
getAttribute
(
attName
).
value
();
if
(
!
attValue
.
empty
()
&&
attValue
!=
"
\"\"
"
)
{
ostr
<<
','
<<
attName
<<
'='
<<
attValue
;
}
...
...
Framework/API/src/ImmutableCompositeFunction.cpp
View file @
561c98fa
...
...
@@ -37,8 +37,8 @@ void ImmutableCompositeFunction::addFunction(IFunction *fun) {
void
ImmutableCompositeFunction
::
setParameter
(
const
std
::
string
&
name
,
const
double
&
value
,
bool
explicitlySet
)
{
auto
alias
=
m_alias
.
find
(
name
);
if
(
alias
!=
m_alias
.
end
())
{
auto
alias
=
m_alias
es
.
find
(
name
);
if
(
alias
!=
m_alias
es
.
end
())
{
CompositeFunction
::
setParameter
(
alias
->
second
,
value
,
explicitlySet
);
}
else
{
CompositeFunction
::
setParameter
(
name
,
value
,
explicitlySet
);
...
...
@@ -52,8 +52,8 @@ void ImmutableCompositeFunction::setParameter(const std::string &name,
*/
void
ImmutableCompositeFunction
::
setParameterDescription
(
const
std
::
string
&
name
,
const
std
::
string
&
description
)
{
auto
alias
=
m_alias
.
find
(
name
);
if
(
alias
!=
m_alias
.
end
())
{
auto
alias
=
m_alias
es
.
find
(
name
);
if
(
alias
!=
m_alias
es
.
end
())
{
CompositeFunction
::
setParameterDescription
(
alias
->
second
,
description
);
}
else
{
CompositeFunction
::
setParameterDescription
(
name
,
description
);
...
...
@@ -66,8 +66,8 @@ void ImmutableCompositeFunction::setParameterDescription(
* @return :: The parameter value.
*/
double
ImmutableCompositeFunction
::
getParameter
(
const
std
::
string
&
name
)
const
{
auto
alias
=
m_alias
.
find
(
name
);
if
(
alias
!=
m_alias
.
end
())
{
auto
alias
=
m_alias
es
.
find
(
name
);
if
(
alias
!=
m_alias
es
.
end
())
{
return
CompositeFunction
::
getParameter
(
alias
->
second
);
}
return
CompositeFunction
::
getParameter
(
name
);
...
...
@@ -79,8 +79,8 @@ double ImmutableCompositeFunction::getParameter(const std::string &name) const {
*/
size_t
ImmutableCompositeFunction
::
parameterIndex
(
const
std
::
string
&
name
)
const
{
auto
alias
=
m_alias
.
find
(
name
);
if
(
alias
!=
m_alias
.
end
())
{
auto
alias
=
m_alias
es
.
find
(
name
);
if
(
alias
!=
m_alias
es
.
end
())
{
return
alias
->
second
;
}
return
CompositeFunction
::
parameterIndex
(
name
);
...
...
@@ -90,9 +90,9 @@ ImmutableCompositeFunction::parameterIndex(const std::string &name) const {
* Returns the alias or name of parameter i
*/
std
::
string
ImmutableCompositeFunction
::
parameterName
(
size_t
i
)
const
{
for
(
const
auto
&
m_alia
:
m_alias
)
{
if
(
m_alia
.
second
==
i
)
return
m_alia
.
first
;
for
(
const
auto
&
m_alia
s
:
m_alias
es
)
{
if
(
m_alia
s
.
second
==
i
)
return
m_alia
s
.
first
;
}
return
CompositeFunction
::
parameterName
(
i
);
}
...
...
@@ -107,10 +107,10 @@ std::string ImmutableCompositeFunction::parameterName(size_t i) const {
void
ImmutableCompositeFunction
::
setAlias
(
const
std
::
string
&
parName
,
const
std
::
string
&
alias
)
{
// make sure the alias is unique
if
(
m_alias
.
count
(
alias
)
>
0
)
{
if
(
m_alias
es
.
count
(
alias
)
>
0
)
{
throw
Kernel
::
Exception
::
ExistsError
(
"ImmutableCompositeFunction"
,
alias
);
}
m_alias
[
alias
]
=
CompositeFunction
::
parameterIndex
(
parName
);
m_alias
es
[
alias
]
=
CompositeFunction
::
parameterIndex
(
parName
);
}
/**
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment