File indexing completed on 2026-01-06 10:19:25
0001
0002
0003
0004
0005
0006
0007 #pragma once
0008
0009 #include <memory>
0010 #include <string>
0011 #include <vector>
0012
0013 #include "IntersectRegion.hh"
0014 #include "ObjectInterface.hh"
0015 #include "Shape.hh"
0016
0017 namespace celeritas
0018 {
0019 namespace orangeinp
0020 {
0021
0022
0023
0024
0025
0026
0027
0028 class Truncated final : public ObjectInterface
0029 {
0030 public:
0031 using Plane = InfPlane;
0032 using VecPlane = std::vector<Plane>;
0033 using UPRegion = std::unique_ptr<IntersectRegionInterface>;
0034
0035 public:
0036
0037 template<class T>
0038 inline static SPConstObject
0039 or_shape(std::string&& label, T&& interior, VecPlane&& truncated);
0040
0041
0042 Truncated(std::string&& label, UPRegion&& region, VecPlane&& planes);
0043
0044
0045 NodeId build(VolumeBuilder& vb) const final;
0046
0047
0048 void output(JsonPimpl*) const final;
0049
0050
0051
0052
0053 std::string_view label() const final { return label_; }
0054
0055
0056 IntersectRegionInterface const& region() const { return *region_; }
0057
0058
0059 VecPlane const& planes() const { return planes_; }
0060
0061 private:
0062 std::string label_;
0063 std::unique_ptr<IntersectRegionInterface> region_;
0064 VecPlane planes_;
0065 };
0066
0067
0068
0069
0070
0071 template<class T>
0072 auto Truncated::or_shape(std::string&& label,
0073 T&& interior,
0074 VecPlane&& truncated) -> SPConstObject
0075 {
0076 if (truncated.empty())
0077 {
0078
0079 return std::make_shared<Shape<T>>(std::move(label),
0080 std::forward<T>(interior));
0081 }
0082 return std::make_shared<Truncated>(
0083 std::move(label),
0084 std::make_unique<T>(std::forward<T>(interior)),
0085 std::move(truncated));
0086 }
0087
0088
0089 }
0090 }