12#include <boost/algorithm/string.hpp>
13#include <boost/format.hpp>
35 const size_t outD,
const std::vector<Kernel::V3D> &eigenvects,
36 const std::vector<double> &eigenvals)
43 for (
size_t d = 0;
d <
inD;
d++) {
46 if (eigenvals.size() ==
inD && eigenvects.size() ==
inD) {
76 for (
size_t d = 0;
d <
inD;
d++) {
81 for (
size_t dd = 0; dd <
inD; dd++) {
96 for (
size_t d = 0;
d <
inD;
d++) {
99 distanceSquared += (dist * dist);
104 outVector[0] = distanceSquared;
110 for (
size_t d = 0;
d <
inD;
d++) {
111 lenQdata += inputVector[
d] * inputVector[
d];
115 lenQdata = std::sqrt(lenQdata);
116 lenQpeak = std::sqrt(lenQpeak);
117 if (lenQpeak * lenQdata != 0.0)
118 cosAng /= (lenQpeak * lenQdata);
119 coord_t angle = std::acos(cosAng);
120 outVector[0] = lenQdata * std::sin(angle);
121 outVector[1] = lenQdata * cosAng - lenQpeak;
133 AutoPtr<Document> pDoc =
new Document;
134 AutoPtr<Element> coordTransformElement = pDoc->createElement(
"CoordTransform");
135 pDoc->appendChild(coordTransformElement);
137 AutoPtr<Element> coordTransformTypeElement = pDoc->createElement(
"Type");
138 coordTransformTypeElement->appendChild(AutoPtr<Text>(pDoc->createTextNode(
"CoordTransformDistance")));
139 coordTransformElement->appendChild(coordTransformTypeElement);
141 AutoPtr<Element> paramListElement = pDoc->createElement(
"ParameterList");
143 AutoPtr<Text> formatText = pDoc->createTextNode(
"%s%s%s%s");
144 paramListElement->appendChild(formatText);
145 coordTransformElement->appendChild(paramListElement);
147 std::stringstream xmlstream;
150 writer.writeNode(xmlstream, pDoc);
153 Mantid::API::InDimParameter inD_param(
inD);
154 Mantid::API::OutDimParameter outD_param(
outD);
155 CoordCenterVectorParam m_center_param(
inD);
156 DimensionsUsedVectorParam m_dimensionsUsed_param(
inD);
159 for (
size_t d = 0;
d <
inD;
d++) {
164 std::string formattedXMLString = boost::str(boost::format(xmlstream.str().c_str()) % inD_param.toXMLString().c_str() %
165 outD_param.toXMLString().c_str() % m_center_param.toXMLString().c_str() %
166 m_dimensionsUsed_param.toXMLString().c_str());
168 return formattedXMLString;
float coord_t
Typedef for the data type to use for coordinate axes in MD objects such as MDBox, MDEventWorkspace,...