codac 1.5.6
Loading...
Searching...
No Matches
codac2_set_operators.h
Go to the documentation of this file.
1
9
10#pragma once
11
12#include <stdexcept>
13#include <memory>
15#include "codac2_CtcInter.h"
16#include "codac2_SepInter.h"
17#include "codac2_CtcUnion.h"
18#include "codac2_SepUnion.h"
19#include "codac2_SepProj.h"
20#include "codac2_CtcCartProd.h"
21#include "codac2_SepCartProd.h"
22#include "codac2_CtcInverse.h"
23#include "codac2_SepInverse.h"
24#include "codac2_CtcNot.h"
25#include "codac2_SepNot.h"
26#include "codac2_CtcAction.h"
27#include "codac2_SepAction.h"
28
29namespace codac2
30{
31 struct InterSetOp
32 {
33 static std::shared_ptr<CtcBase<IntervalVector>> create_ctc(const std::shared_ptr<CtcBase<IntervalVector>>& s1, const std::shared_ptr<CtcBase<IntervalVector>>& s2)
34 {
35 return std::make_shared<CtcInter<IntervalVector>>(s1,s2);
36 }
37
38 static std::shared_ptr<SepBase> create_sep(const std::shared_ptr<SepBase>& s1, const std::shared_ptr<SepBase>& s2)
39 {
40 return std::make_shared<SepInter>(s1,s2);
41 }
42 };
43
44 struct UnionSetOp
45 {
46 static std::shared_ptr<CtcBase<IntervalVector>> create_ctc(const std::shared_ptr<CtcBase<IntervalVector>>& s1, const std::shared_ptr<CtcBase<IntervalVector>>& s2)
47 {
48 return std::make_shared<CtcUnion<IntervalVector>>(s1,s2);
49 }
50
51 static std::shared_ptr<SepBase> create_sep(const std::shared_ptr<SepBase>& s1, const std::shared_ptr<SepBase>& s2)
52 {
53 return std::make_shared<SepUnion>(s1,s2);
54 }
55 };
56
57 struct ProjSetOp
58 {
59 static std::shared_ptr<CtcBase<IntervalVector>> create_ctc(const std::shared_ptr<CtcBase<IntervalVector>>& s1, const std::vector<Index>& proj_indices, double eps)
60 {
61 throw std::logic_error("CtcProj not yet available");
62 return nullptr;
63 }
64
65 static std::shared_ptr<CtcBase<IntervalVector>> create_ctc(const std::shared_ptr<CtcBase<IntervalVector>>& s1, const std::vector<Index>& proj_indices, const IntervalVector& y, double eps)
66 {
67 throw std::logic_error("CtcProj not yet available");
68 return nullptr;
69 }
70
71 static std::shared_ptr<SepBase> create_sep(const std::shared_ptr<SepBase>& s1, const std::vector<Index>& proj_indices, double eps)
72 {
73 return std::make_shared<SepProj>(s1,proj_indices,eps);
74 }
75
76 static std::shared_ptr<SepBase> create_sep(const std::shared_ptr<SepBase>& s1, const std::vector<Index>& proj_indices, const IntervalVector& y, double eps)
77 {
78 return std::make_shared<SepProj>(s1,proj_indices,y,eps);
79 }
80 };
81
82 struct CartProdSetOp
83 {
84 static std::shared_ptr<CtcBase<IntervalVector>> create_ctc(const std::shared_ptr<CtcBase<IntervalVector>>& s1, const std::shared_ptr<CtcBase<IntervalVector>>& s2)
85 {
86 return std::make_shared<CtcCartProd>(s1,s2);
87 }
88
89 static std::shared_ptr<SepBase> create_sep(const std::shared_ptr<SepBase>& s1, const std::shared_ptr<SepBase>& s2)
90 {
91 return std::make_shared<SepCartProd>(s1,s2);
92 }
93 };
94
95 struct InverseSetOp
96 {
97 static std::shared_ptr<CtcBase<IntervalVector>> create_ctc(const AnalyticFunction<VectorType>& f, const std::shared_ptr<CtcBase<IntervalVector>>& s1)
98 {
99 return std::make_shared<CtcInverse<IntervalVector,IntervalVector>>(f,s1);
100 }
101
102 static std::shared_ptr<SepBase> create_sep(const AnalyticFunction<VectorType>& f, const std::shared_ptr<SepBase>& s1)
103 {
104 return std::make_shared<SepInverse>(f,s1);
105 }
106 };
107
108 struct NotSetOp
109 {
110 static std::shared_ptr<CtcBase<IntervalVector>> create_ctc(const std::shared_ptr<CtcBase<IntervalVector>>& s1)
111 {
112 return std::make_shared<CtcNot>(s1);
113 }
114
115 static std::shared_ptr<SepBase> create_sep(const std::shared_ptr<SepBase>& s1)
116 {
117 return std::make_shared<SepNot>(s1);
118 }
119 };
120
121 struct ActionSetOp
122 {
123 static std::shared_ptr<CtcBase<IntervalVector>> create_ctc(const OctaSym& a, const std::shared_ptr<CtcBase<IntervalVector>>& s1)
124 {
125 return std::make_shared<CtcAction>(s1,a);
126 }
127
128 static std::shared_ptr<SepBase> create_sep(const OctaSym& a, const std::shared_ptr<SepBase>& s1)
129 {
130 return std::make_shared<SepAction>(s1,a);
131 }
132 };
133}