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
c0a23bdb
Commit
c0a23bdb
authored
Aug 08, 2011
by
Janik Zikovsky
Browse files
Refs #3302: Fix some compiler warnings on the Mac build.
parent
588effbd
Changes
6
Hide whitespace changes
Inline
Side-by-side
Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/MDEventFactory.h
View file @
c0a23bdb
...
...
@@ -59,6 +59,31 @@ namespace MDEvents
if (MDEW9) funcname<MDEvent<9>, 9>(MDEW9); \
}
/** Macro that makes it possible to call a templated method for
* a MDEventWorkspace using a IMDEventWorkspace_sptr WITH AT LEAST 3 DIMENSIONS as the input.
* @param funcname :: name of the function that will be called.
* @param workspace :: IMDEventWorkspace_sptr input workspace.
*/
#define CALL_MDEVENT_FUNCTION3(funcname, workspace) \
{ \
MDEventWorkspace<MDEvent<3>, 3>::sptr MDEW3 = boost::dynamic_pointer_cast<MDEventWorkspace<MDEvent<3>, 3> >(workspace); \
if (MDEW3) funcname<MDEvent<3>, 3>(MDEW3); \
MDEventWorkspace<MDEvent<4>, 4>::sptr MDEW4 = boost::dynamic_pointer_cast<MDEventWorkspace<MDEvent<4>, 4> >(workspace); \
if (MDEW4) funcname<MDEvent<4>, 4>(MDEW4); \
MDEventWorkspace<MDEvent<5>, 5>::sptr MDEW5 = boost::dynamic_pointer_cast<MDEventWorkspace<MDEvent<5>, 5> >(workspace); \
if (MDEW5) funcname<MDEvent<5>, 5>(MDEW5); \
MDEventWorkspace<MDEvent<6>, 6>::sptr MDEW6 = boost::dynamic_pointer_cast<MDEventWorkspace<MDEvent<6>, 6> >(workspace); \
if (MDEW6) funcname<MDEvent<6>, 6>(MDEW6); \
MDEventWorkspace<MDEvent<7>, 7>::sptr MDEW7 = boost::dynamic_pointer_cast<MDEventWorkspace<MDEvent<7>, 7> >(workspace); \
if (MDEW7) funcname<MDEvent<7>, 7>(MDEW7); \
MDEventWorkspace<MDEvent<8>, 8>::sptr MDEW8 = boost::dynamic_pointer_cast<MDEventWorkspace<MDEvent<8>, 8> >(workspace); \
if (MDEW8) funcname<MDEvent<8>, 8>(MDEW8); \
MDEventWorkspace<MDEvent<9>, 9>::sptr MDEW9 = boost::dynamic_pointer_cast<MDEventWorkspace<MDEvent<9>, 9> >(workspace); \
if (MDEW9) funcname<MDEvent<9>, 9>(MDEW9); \
}
...
...
@@ -194,3 +219,4 @@ namespace MDEvents
Code/Mantid/Framework/MDEvents/src/BinToMDHistoWorkspace.cpp
View file @
c0a23bdb
...
...
@@ -8,12 +8,12 @@
#include
"MantidKernel/Utils.h"
#include
"MantidMDEvents/BinToMDHistoWorkspace.h"
#include
"MantidMDEvents/IMDBox.h"
#include
"MantidMDEvents/MDBox.h"
#include
"MantidMDEvents/MDBoxIterator.h"
#include
"MantidMDEvents/MDEventFactory.h"
#include
"MantidMDEvents/MDEventWorkspace.h"
#include
"MantidMDEvents/MDHistoWorkspace.h"
#include
<boost/algorithm/string.hpp>
#include
"MantidMDEvents/MDBox.h"
using
Mantid
::
Kernel
::
CPUTimer
;
...
...
@@ -130,39 +130,6 @@ namespace MDEvents
}
//-----------------------------------------------------------------------------------------------
/** Performs template argument deduction and uses local call to fabricate an adapter instance of Point3D.
* Templated function may have a more suitable location.
*/
template
<
typename
AdapteeType
>
Mantid
::
API
::
Point3D
*
makePoint3D
(
const
AdapteeType
&
adaptee
)
{
//Local adapter.
class
PointAdapter
:
public
Mantid
::
API
::
Point3D
{
private:
AdapteeType
m_adaptee
;
public:
PointAdapter
(
const
AdapteeType
&
adaptee
)
:
m_adaptee
(
adaptee
)
{
}
virtual
double
getX
()
const
{
return
m_adaptee
.
m_min
[
0
]
+
((
m_adaptee
.
m_max
[
0
]
-
m_adaptee
.
m_min
[
0
])
/
2
);
}
virtual
double
getY
()
const
{
return
m_adaptee
.
m_min
[
1
]
+
((
m_adaptee
.
m_max
[
1
]
-
m_adaptee
.
m_min
[
1
])
/
2
);
}
virtual
double
getZ
()
const
{
return
m_adaptee
.
m_min
[
2
]
+
((
m_adaptee
.
m_max
[
2
]
-
m_adaptee
.
m_min
[
2
])
/
2
);
}
};
return
new
PointAdapter
(
adaptee
);
}
//----------------------------------------------------------------------------------------------
/** Bin the contents of a MDBox
...
...
@@ -494,11 +461,15 @@ namespace MDEvents
}
bin
.
m_index
=
linear_index
;
bool
dimensionsUsed
[
nd
];
for
(
size_t
d
=
0
;
d
<
nd
;
d
++
)
dimensionsUsed
[
d
]
=
(
d
<
3
);
// Check if the bin is in the ImplicitFunction (if any)
bool
binContained
=
true
;
if
(
implicitFunction
)
{
binContained
=
implicitFunction
->
evaluate
(
makePoint3D
(
bin
)
);
binContained
=
implicitFunction
->
evaluate
(
bin
.
m_min
,
dimensionsUsed
,
nd
);
}
if
(
binContained
)
...
...
Code/Mantid/Framework/MDEvents/src/MDCentroidPeaks.cpp
View file @
c0a23bdb
...
...
@@ -182,7 +182,7 @@ namespace MDEvents
{
inWS
=
getProperty
(
"InputWorkspace"
);
CALL_MDEVENT_FUNCTION
(
this
->
integrate
,
inWS
);
CALL_MDEVENT_FUNCTION
3
(
this
->
integrate
,
inWS
);
}
}
// namespace Mantid
...
...
Code/Mantid/Framework/MDEvents/src/MDEWFindPeaks.cpp
View file @
c0a23bdb
...
...
@@ -194,7 +194,10 @@ namespace MDEvents
}
peakBoxes
.
push_back
(
box
);
g_log
.
information
()
<<
"Found box at "
<<
boxCenter
[
0
]
<<
","
<<
boxCenter
[
1
]
<<
","
<<
boxCenter
[
2
]
<<
"; Density = "
<<
density
<<
std
::
endl
;
g_log
.
information
()
<<
"Found box at "
;
for
(
size_t
d
=
0
;
d
<
nd
;
d
++
)
g_log
.
information
()
<<
(
d
>
0
?
","
:
""
)
<<
boxCenter
[
d
];
g_log
.
information
()
<<
"; Density = "
<<
density
<<
std
::
endl
;
}
}
...
...
@@ -263,7 +266,7 @@ namespace MDEvents
prog
=
new
Progress
(
this
,
0.0
,
1.0
,
10
);
CALL_MDEVENT_FUNCTION
(
this
->
findPeaks
,
inWS
);
CALL_MDEVENT_FUNCTION
3
(
this
->
findPeaks
,
inWS
);
delete
prog
;
}
...
...
Code/Mantid/Framework/MDEvents/src/MDEventFactory.cpp
View file @
c0a23bdb
/* Auto-generated by 'generate_mdevent_declarations.py'
* on 2011-0
6-23 16:00:21.049184
* on 2011-0
8-08 14:18:46.514442
*
* DO NOT EDIT!
*/
...
...
Code/Mantid/Framework/MDEvents/src/generate_mdevent_declarations.py
View file @
c0a23bdb
...
...
@@ -85,6 +85,18 @@ macro_top = """
#define CALL_MDEVENT_FUNCTION(funcname, workspace)
\\
{
\\
"""
macro_top3
=
"""
/** Macro that makes it possible to call a templated method for
* a MDEventWorkspace using a IMDEventWorkspace_sptr WITH AT LEAST 3 DIMENSIONS as the input.
* @param funcname :: name of the function that will be called.
* @param workspace :: IMDEventWorkspace_sptr input workspace.
*/
#define CALL_MDEVENT_FUNCTION3(funcname, workspace)
\\
{
\\
"""
macro
=
"""MDEventWorkspace<%s, %d>::sptr MDEW%d = boost::dynamic_pointer_cast<MDEventWorkspace<%s, %d> >(workspace);
\\
if (MDEW%d) funcname<%s, %d>(MDEW%d);
\\
"""
...
...
@@ -98,6 +110,16 @@ def get_macro():
s
+=
"}
\n
"
return
s
def
get_macro3
():
""" Return the macro code CALL_MDEVENT_FUNCTION3 """
s
=
macro_top3
;
for
nd
in
dimensions
:
if
(
nd
>=
3
):
eventType
=
"MDEvent<%d>"
%
nd
s
+=
macro
%
(
eventType
,
nd
,
nd
,
eventType
,
nd
,
nd
,
eventType
,
nd
,
nd
)
s
+=
"}
\n
"
return
s
#======================================================================================
...
...
@@ -210,6 +232,9 @@ def generate():
# Make the macro then pad it into the list of lines
macro
=
get_macro
()
lines
=
insert_lines
(
lines
,
len
(
lines
),
macro
,
padding
)
# Again for 3+ dimensions
macro
=
get_macro3
()
lines
=
insert_lines
(
lines
,
len
(
lines
),
macro
,
padding
)
# Typedefs for MDEventWorkspace
lines
.
append
(
"
\n
"
);
...
...
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