本文整理汇总了C++中MDWSDescription::addProperty方法的典型用法代码示例。如果您正苦于以下问题:C++ MDWSDescription::addProperty方法的具体用法?C++ MDWSDescription::addProperty怎么用?C++ MDWSDescription::addProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MDWSDescription
的用法示例。
在下文中一共展示了MDWSDescription::addProperty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Wmat
/**
Method builds transformation Q=R*U*B*W*h where W-transf is W or WB or
W*Unit*Lattice_param depending on inputs
*/
Kernel::DblMatrix
MDWSTransform::buildQTrahsf(MDWSDescription &TargWSDescription,
CnvrtToMD::CoordScaling ScaleID,
bool UnitUB) const {
// implements strategy
if (!(TargWSDescription.hasLattice() || UnitUB)) {
throw(std::invalid_argument("this function should be called only on "
"workspace with defined oriented lattice"));
}
// if u,v us default, Wmat is unit transformation
Kernel::DblMatrix Wmat(3, 3, true);
// derive rotation from u0,v0 u0||ki to u,v
if (!m_isUVdefault) {
Wmat[0][0] = m_UProj[0];
Wmat[1][0] = m_UProj[1];
Wmat[2][0] = m_UProj[2];
Wmat[0][1] = m_VProj[0];
Wmat[1][1] = m_VProj[1];
Wmat[2][1] = m_VProj[2];
Wmat[0][2] = m_WProj[0];
Wmat[1][2] = m_WProj[1];
Wmat[2][2] = m_WProj[2];
}
if (ScaleID == OrthogonalHKLScale) {
std::vector<Kernel::V3D> dim_directions;
std::vector<Kernel::V3D> uv(2);
uv[0] = m_UProj;
uv[1] = m_VProj;
dim_directions = Kernel::V3D::makeVectorsOrthogonal(uv);
for (size_t i = 0; i < 3; ++i)
for (size_t j = 0; j < 3; ++j)
Wmat[i][j] = dim_directions[j][i];
}
// Now define lab frame to target frame transformation
Kernel::DblMatrix Scale(3, 3, true);
Kernel::DblMatrix Transf(3, 3, true);
boost::shared_ptr<Geometry::OrientedLattice> spLatt;
if (UnitUB)
spLatt = boost::shared_ptr<Geometry::OrientedLattice>(
new Geometry::OrientedLattice(1, 1, 1));
else
spLatt = TargWSDescription.getLattice();
switch (ScaleID) {
case NoScaling: //< momentums in A^-1
{
Transf = spLatt->getU();
break;
}
case SingleScale: //< momentums divided by 2*Pi/Lattice -- equivalent to
// d-spacing in some sense
{
double dMax(-1.e+32);
for (int i = 0; i < 3; i++)
dMax = (dMax > spLatt->a(i)) ? (dMax) : (spLatt->a(i));
for (int i = 0; i < 3; i++)
Scale[i][i] = (2 * M_PI) / dMax;
Transf = spLatt->getU();
break;
}
case OrthogonalHKLScale: //< each momentum component divided by appropriate
// lattice parameter; equivalent to hkl for orthogonal
// axis
{
if (spLatt) {
for (int i = 0; i < 3; i++) {
Scale[i][i] = (2 * M_PI) / spLatt->a(i);
}
Transf = spLatt->getU();
}
break;
}
case HKLScale: //< non-orthogonal system for non-orthogonal lattice
{
if (spLatt)
Scale = spLatt->getUB() * (2 * M_PI);
break;
}
default:
throw(std::invalid_argument("unrecognized conversion mode"));
}
TargWSDescription.addProperty("W_MATRIX", Wmat.getVector(), true);
return Transf * Scale * Wmat;
}