@@ -23,21 +23,17 @@ Group::Group(std::string name) : m_name(std::move(name)) {}
2323// Move constructor
2424Group::Group (Group&& other) noexcept
2525 : m_position(std::move(other.m_position)), m_orientation(std::move(other.m_orientation)), m_children(std::move(other.m_children)) {
26- for (auto & child : m_children) {
27- child->m_parent = this ;
28- }
26+ for (auto & child : m_children) { child->m_parent = this ; }
2927}
3028
3129// Move assignment operator
3230Group& Group::operator =(Group&& other) noexcept {
3331 if (this != &other) {
34- m_position = std::move (other.m_position );
32+ m_position = std::move (other.m_position );
3533 m_orientation = std::move (other.m_orientation );
36- m_children = std::move (other.m_children );
34+ m_children = std::move (other.m_children );
3735
38- for (auto & child : m_children) {
39- child->m_parent = this ;
40- }
36+ for (auto & child : m_children) { child->m_parent = this ; }
4137 }
4238 return *this ;
4339}
@@ -204,9 +200,7 @@ void Group::ctraverse(const std::function<bool(const BeamlineNode&)>& callback)
204200
205201 for (const auto & child : m_children) {
206202 if (!child) RAYX_EXIT << " m_children contains a nullptr! This should never happen." ;
207- if (callback (*child)) {
208- return ;
209- }
203+ if (callback (*child)) { return ; }
210204 if (child->isGroup ()) {
211205 auto groupPtr = static_cast <Group*>(child.get ());
212206 groupPtr->ctraverse (callback);
@@ -219,9 +213,7 @@ void Group::traverse(const std::function<bool(BeamlineNode&)>& callback) {
219213
220214 for (auto & child : m_children) {
221215 if (!child) RAYX_EXIT << " m_children contains a nullptr! This should never happen." ;
222- if (callback (*child)) {
223- return ;
224- }
216+ if (callback (*child)) { return ; }
225217 if (child->isGroup ()) {
226218 auto groupPtr = static_cast <Group*>(child.get ());
227219 groupPtr->traverse (callback);
@@ -241,7 +233,7 @@ std::unique_ptr<BeamlineNode> Group::releaseNodeFromChildren(const BeamlineNode*
241233 for (auto it = m_children.begin (); it != m_children.end (); ++it) {
242234 if (it->get () == node) {
243235 std::unique_ptr<BeamlineNode> releasedNode = std::move (*it);
244- releasedNode->m_parent = nullptr ;
236+ releasedNode->m_parent = nullptr ;
245237 m_children.erase (it);
246238 return releasedNode;
247239 }
@@ -254,7 +246,7 @@ std::unique_ptr<BeamlineNode> Group::releaseNodeFromTree(const BeamlineNode* nod
254246 for (auto it = m_children.begin (); it != m_children.end (); ++it) {
255247 if (it->get () == node) {
256248 std::unique_ptr<BeamlineNode> releasedNode = std::move (*it);
257- releasedNode->m_parent = nullptr ;
249+ releasedNode->m_parent = nullptr ;
258250 m_children.erase (it);
259251 return releasedNode;
260252 } else if ((*it)->isGroup ()) {
@@ -272,9 +264,7 @@ MaterialTables Group::calcMinimalMaterialTables() const {
272264 relevantMaterials.fill (false );
273265 for (const auto & elemPtr : elements) {
274266 int material = static_cast <int >(elemPtr->getMaterial ()); // assuming getMaterial() exists
275- if (material >= 1 && material <= 92 ) {
276- relevantMaterials[material - 1 ] = true ;
277- }
267+ if (material >= 1 && material <= 92 ) { relevantMaterials[material - 1 ] = true ; }
278268 }
279269 return loadMaterialTables (relevantMaterials);
280270}
@@ -288,13 +278,11 @@ void Group::accumulateLightSourcesWorldPositions(const Group& group, const glm::
288278 assert (child && " m_children contains a nullptr!" );
289279 if (child->isSource ()) {
290280 DesignSource* srcPtr = static_cast <DesignSource*>(child.get ());
291- glm::dvec4 worldPos = currentOri * srcPtr->getPosition () + currentPos;
281+ glm::dvec4 worldPos = currentOri * srcPtr->getPosition () + currentPos;
292282 positions.push_back (worldPos);
293283 } else if (child->isGroup ()) {
294284 Group* grpPtr = static_cast <Group*>(child.get ());
295- if (grpPtr) {
296- accumulateLightSourcesWorldPositions (*grpPtr, currentPos, currentOri, positions);
297- }
285+ if (grpPtr) { accumulateLightSourcesWorldPositions (*grpPtr, currentPos, currentOri, positions); }
298286 }
299287 }
300288}
@@ -326,9 +314,7 @@ std::vector<OpticalElementAndTransform> Group::compileElements() const {
326314std::vector<const DesignElement*> Group::getElements () const {
327315 std::vector<const DesignElement*> elements;
328316 ctraverse ([&elements](const BeamlineNode& node) -> bool {
329- if (node.isElement ()) {
330- elements.push_back (static_cast <const DesignElement*>(&node));
331- }
317+ if (node.isElement ()) { elements.push_back (static_cast <const DesignElement*>(&node)); }
332318 return false ;
333319 });
334320 return elements;
@@ -337,9 +323,7 @@ std::vector<const DesignElement*> Group::getElements() const {
337323std::vector<const DesignSource*> Group::getSources () const {
338324 std::vector<const DesignSource*> sources;
339325 ctraverse ([&sources](const BeamlineNode& node) -> bool {
340- if (node.isSource ()) {
341- sources.push_back (static_cast <const DesignSource*>(&node));
342- }
326+ if (node.isSource ()) { sources.push_back (static_cast <const DesignSource*>(&node)); }
343327 return false ;
344328 });
345329 return sources;
@@ -386,9 +370,7 @@ std::vector<std::string> Group::getObjectNames() const {
386370size_t Group::numElements () const {
387371 size_t count = 0 ;
388372 ctraverse ([&count](const BeamlineNode& node) -> bool {
389- if (node.isElement ()) {
390- ++count;
391- }
373+ if (node.isElement ()) { ++count; }
392374 return false ;
393375 });
394376 return count;
@@ -397,9 +379,7 @@ size_t Group::numElements() const {
397379size_t Group::numSources () const {
398380 size_t count = 0 ;
399381 ctraverse ([&count](const BeamlineNode& node) -> bool {
400- if (node.isSource ()) {
401- ++count;
402- }
382+ if (node.isSource ()) { ++count; }
403383 return false ;
404384 });
405385 return count;
@@ -408,9 +388,7 @@ size_t Group::numSources() const {
408388size_t Group::numObjects () const {
409389 size_t count = 0 ;
410390 ctraverse ([&count](const BeamlineNode& node) -> bool {
411- if (node.isSource () || node.isElement ()) {
412- ++count;
413- }
391+ if (node.isSource () || node.isElement ()) { ++count; }
414392 return false ;
415393 });
416394 return count;
0 commit comments