Mantid
Loading...
Searching...
No Matches
CompAssembly.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2007 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8#include "MantidGeometry/DllConfig.h"
11#include <string>
12#include <vector>
13
14#ifdef _WIN32
15#pragma warning(disable : 4250)
16#endif
17
18namespace Mantid {
19namespace Geometry {
20
31class MANTID_GEOMETRY_DLL CompAssembly : public ICompAssembly, public Component {
32protected:
33 using comp_it = std::vector<IComponent *>::iterator;
34 using const_comp_it = std::vector<IComponent *>::const_iterator;
35
36public:
38 std::string type() const override { return "CompAssembly"; }
42 CompAssembly(const IComponent *base, const ParameterMap *map);
44 CompAssembly(const std::string &, IComponent *reference = nullptr);
47 CompAssembly &operator=(const CompAssembly &other);
48 ~CompAssembly() override;
50 IComponent *clone() const override;
52 int nelements() const override;
54 int add(IComponent *) override;
56
58
59 int addCopy(IComponent *) override;
61 int addCopy(IComponent *, const std::string &) override;
63 int remove(IComponent *);
65 //[] when you have a pointer
66 std::shared_ptr<IComponent> getChild(const int i) const override;
68 void getChildren(std::vector<IComponent_const_sptr> &outVector, bool recursive) const override;
70 std::shared_ptr<IComponent> operator[](int i) const override;
73 std::shared_ptr<const IComponent> getComponentByName(const std::string &cname, int nlevels = 0) const override;
74
75 Kernel::V3D getPos() const override;
76
77 Kernel::Quat getRotation() const override;
78
80 void getBoundingBox(BoundingBox &assemblyBox) const override;
81
83 void printChildren(std::ostream &) const override;
84 void printTree(std::ostream &) const override;
85
88 void testIntersectionWithChildren(Track &testRay, std::deque<IComponent_const_sptr> &searchQueue) const override;
89
90 virtual size_t registerContents(class ComponentVisitor &componentVisitor) const override;
91
92private:
95
96protected:
98 std::vector<IComponent *> m_children;
99
102};
103
104MANTID_GEOMETRY_DLL std::ostream &operator<<(std::ostream &, const CompAssembly &);
105
106} // Namespace Geometry
107} // Namespace Mantid
A simple structure that defines an axis-aligned cuboid shaped bounding box for a geometrical object.
Definition: BoundingBox.h:34
Class for Assembly of geometric components.
Definition: CompAssembly.h:31
std::string type() const override
String description of the type of component.
Definition: CompAssembly.h:38
std::vector< IComponent * > m_children
the group of child components
Definition: CompAssembly.h:98
BoundingBox * m_cachedBoundingBox
A cached bounding box.
Definition: CompAssembly.h:101
std::vector< IComponent * >::iterator comp_it
Iterator type.
Definition: CompAssembly.h:33
std::vector< IComponent * >::const_iterator const_comp_it
Const iterator type.
Definition: CompAssembly.h:34
void addChildren(IComponent *comp)
Add a copy (clone) of a component.
CompAssembly & operator=(const ICompAssembly &)
Private copy assignment operator.
ComponentVisitor : Visitor for IComponents.
Component is a wrapper for a Component which can modify some of its parameters, e....
Definition: Component.h:41
Class for Assembly of geometric components.
Definition: ICompAssembly.h:30
base class for Geometric IComponent
Definition: IComponent.h:51
Defines a track as a start point and a direction.
Definition: Track.h:165
Class for quaternions.
Definition: Quat.h:39
Class for 3D vectors.
Definition: V3D.h:34
MANTID_GEOMETRY_DLL std::ostream & operator<<(std::ostream &stream, const PointGroup &self)
Returns a streamed representation of the PointGroup object.
Definition: PointGroup.cpp:312
Helper class which provides the Collimation Length for SANS instruments.