Skip to content
Open
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
bf69037
Split off some calculations from PanelsSurface
jclarkeSTFC Jul 3, 2025
916a805
Add Python interface to new calculator class
jclarkeSTFC Jul 10, 2025
da97f78
Move more logic to PanelsSurfaceCalculator
jclarkeSTFC Jul 10, 2025
79e0d53
Initial code for the side by side projection
jclarkeSTFC Jul 22, 2025
8484c84
Use GridDetector objects instead of Rectangular
jclarkeSTFC Jul 22, 2025
5716a03
Fixes following rebase and tidy up
jclarkeSTFC Jul 22, 2025
608188c
Draw tubes that are arranged in flat banks
jclarkeSTFC Jul 31, 2025
23ea77e
Draw left-over detectors in a final grid.
jclarkeSTFC Aug 4, 2025
4dfeb92
Interactive scalar bars, vertical, on the right
jclarkeSTFC Aug 4, 2025
4594407
Read bank override positions from IDF
jclarkeSTFC Aug 7, 2025
4903d76
Fixes following rebase
jclarkeSTFC Sep 16, 2025
d8b764e
Disable logging for CreateDetectorTable
jclarkeSTFC Sep 16, 2025
7927054
Shrink text labels on scalar bar
jclarkeSTFC Sep 16, 2025
1d902ea
Only use positions of valid detectors for projections
jclarkeSTFC Sep 17, 2025
e034c35
Handle instruments with only a subset of detectors
jclarkeSTFC Sep 18, 2025
7fcfe35
Fix cppcheck warnings
jclarkeSTFC Sep 18, 2025
dea2ccb
Add comments to PanelsSurfaceCalculator
jclarkeSTFC Sep 18, 2025
a82ae86
Handle case of bank arrays of differing sizes
jclarkeSTFC Sep 22, 2025
f989df5
Add tests for SideBySide class
jclarkeSTFC Sep 23, 2025
63aee52
Merge branch 'main' into side-by-side-projection
jclarkeSTFC Sep 23, 2025
403e01c
Fixes following CodeRabbit review
jclarkeSTFC Sep 23, 2025
750eb56
Further improvements from code review
jclarkeSTFC Sep 23, 2025
2643e99
Test fix and tidy up
jclarkeSTFC Sep 24, 2025
29b6bfe
Fix compiler warnings
jclarkeSTFC Sep 24, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Framework/API/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ set(SRC_FILES
src/NumericAxis.cpp
src/NumericAxisValidator.cpp
src/OrientedLatticeValidator.cpp
src/PanelsSurfaceCalculator.cpp
src/ParamFunction.cpp
src/ParameterReference.cpp
src/ParameterTie.cpp
Expand Down Expand Up @@ -318,6 +319,7 @@ set(INC_FILES
inc/MantidAPI/NumericAxis.h
inc/MantidAPI/NumericAxisValidator.h
inc/MantidAPI/OrientedLatticeValidator.h
inc/MantidAPI/PanelsSurfaceCalculator.h
inc/MantidAPI/ParamFunction.h
inc/MantidAPI/ParameterReference.h
inc/MantidAPI/ParameterTie.h
Expand Down Expand Up @@ -452,6 +454,7 @@ set(TEST_FILES
NumericAxisTest.h
NumericAxisValidatorTest.h
OrientedLatticeValidatorTest.h
PanelsSurfaceCalculatorTest.h
ParamFunctionAttributeHolderTest.h
ParameterReferenceTest.h
ParameterTieTest.h
Expand Down
57 changes: 57 additions & 0 deletions Framework/API/inc/MantidAPI/PanelsSurfaceCalculator.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// Mantid Repository : https://github.com/mantidproject/mantid
//
// Copyright © 2025 ISIS Rutherford Appleton Laboratory UKRI,
// NScD Oak Ridge National Laboratory, European Spallation Source,
// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
// SPDX - License - Identifier: GPL - 3.0 +
#pragma once

#include "MantidAPI/DllConfig.h"
#include "MantidGeometry/Instrument.h"
#include "MantidGeometry/Instrument/ComponentInfo.h"
#include "MantidKernel/Logger.h"
#include "MantidKernel/Quat.h"
#include "MantidKernel/V2D.h"
#include "MantidKernel/V3D.h"

#include <functional>
#include <optional>
#include <vector>

using Mantid::Geometry::ComponentInfo;
using Mantid::Geometry::Instrument;
using Mantid::Geometry::Instrument_const_sptr;
using Mantid::Kernel::V3D;

namespace Mantid {
namespace API {
class MANTID_API_DLL PanelsSurfaceCalculator {
public:
void setupBasisAxes(const V3D &zaxis, V3D &xaxis, V3D &yaxis) const;
std::vector<V3D> retrievePanelCorners(const ComponentInfo &componentInfo, const size_t rootIndex) const;
V3D calculatePanelNormal(const std::vector<V3D> &panelCorners) const;
bool isBankFlat(const ComponentInfo &componentInfo, size_t bankIndex, const std::vector<size_t> &tubes,
const V3D &normal);
V3D calculateBankNormal(const ComponentInfo &componentInfo, const std::vector<size_t> &tubes);
void setBankVisited(const ComponentInfo &componentInfo, size_t bankIndex, std::vector<bool> &visitedComponents) const;
size_t findNumDetectors(const ComponentInfo &componentInfo, const std::vector<size_t> &components) const;
Mantid::Kernel::Quat calcBankRotation(const V3D &detPos, V3D normal, const V3D &zAxis, const V3D &yAxis,
const V3D &samplePosition) const;
std::vector<Mantid::Kernel::V2D> transformedBoundingBoxPoints(const ComponentInfo &componentInfo,
size_t detectorIndex, const V3D &refPos,
const Mantid::Kernel::Quat &rotation, const V3D &xaxis,
const V3D &yaxis) const;
std::vector<size_t> tubeDetectorParentIDs(const ComponentInfo &componentInfo, size_t rootIndex,
std::vector<bool> &visited);
std::vector<std::vector<size_t>> examineAllComponents(
const ComponentInfo &componentInfo,
std::function<std::vector<size_t>(const ComponentInfo &, size_t, std::vector<bool> &)> operation);
std::optional<Kernel::V2D> getSideBySideViewPos(const ComponentInfo &componentInfo,
const Instrument_const_sptr &instrument,
const size_t componentIndex) const;

private:
Mantid::Kernel::Logger g_log = Mantid::Kernel::Logger("PanelsSurfaceCalculator");
};
} // namespace API
} // namespace Mantid
Loading