ATLAS Offline Software
Loading...
Searching...
No Matches
ElementModelRigid.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
6#include <stdexcept>
7
8using namespace NswAsBuilt;
9
10//===============================================================================
11// Transform a set of vectors expressed in local frame, stored in a matrix
13{
14 if (!parvec.transformCacheValid) {
15 throw std::runtime_error("Should call Element::cacheTransforms() first");
16 }
17 local = (parvec.transformCache * local).eval(); // Needs eval to avoid aliasing (?)
18}
19
20//===============================================================================
21// Cache the rigid component of this deformation model
23{
24 const auto& pars = parvec.parameters;
25 parvec.transformCache
26 = Eigen::Translation3d(pars[X], pars[Y], pars[Z])
27 * Eigen::AngleAxisd(pars[THZ], Eigen::Vector3d::UnitZ())
28 * Eigen::AngleAxisd(pars[THY], Eigen::Vector3d::UnitY())
29 * Eigen::AngleAxisd(pars[THX], Eigen::Vector3d::UnitX());
30 parvec.transformCacheValid = true;
31}
32
33//===============================================================================
34// Helper methods to convert parameter index to string representation
36{
37 if (parname == "x") return parameter_t::X;
38 if (parname == "y") return parameter_t::Y;
39 if (parname == "z") return parameter_t::Z;
40 if (parname == "thx") return parameter_t::THX;
41 if (parname == "thy") return parameter_t::THY;
42 if (parname == "thz") return parameter_t::THZ;
43 throw std::runtime_error("Invalid parameter name "+parname);
44}
45
46
47//===============================================================================
49{
50 switch (ipar) {
51 case X: return "x";
52 case Y: return "y";
53 case Z: return "z";
54 case THX: return "thx";
55 case THY: return "thy";
56 case THZ: return "thz";
57 default: throw std::runtime_error("Invalid parameter");
58 }
59}
60
virtual std::string getParameterName(ipar_t ipar) const override
virtual void cacheTransform(ParameterVector &parvec) const override
virtual ipar_t getParameterIndex(const std::string &parname) const override
virtual void transform(const ParameterVector &parvec, VectorSetRef local) const override
Eigen::Ref< VectorSet > VectorSetRef