codac 1.5.6
Loading...
Searching...
No Matches
codac_CtcUnion.h
Go to the documentation of this file.
1
12#ifndef __CODAC_CTCUNION_H__
13#define __CODAC_CTCUNION_H__
14
15#include <memory>
16//#include "ibex_CtcUnion.h"
17#include "codac_Ctc.h"
18
19namespace codac
20{
21 class CtcUnion : public Ctc
22 {
23 public:
24
25 CtcUnion(int nb_var) : Ctc(nb_var)
26 { }
27
28 template<typename C1>
29 CtcUnion(const C1& c1) : Ctc(c1.nb_var)
30 {
31 _v_ctc.push_back(std::make_shared<C1>(c1));
32 }
33
34 template<typename C1,typename... C>
35 CtcUnion(const C1& c1, const C&... c) : CtcUnion(c1)
36 {
37 (_v_ctc.push_back(std::make_shared<C>(c)), ...);
38 for(const auto& ci : _v_ctc) { assert(ci->nb_var == nb_var); }
39 }
40
41 void contract(IntervalVector& x)
42 {
43 IntervalVector result(nb_var, Interval::empty_set());
44
45 for(auto& ci : _v_ctc)
46 {
47 IntervalVector saved_x = x;
48 ci->contract(saved_x);
49 result |= saved_x;
50 }
51
52 for(auto& ci : _v_ctc_ptrs)
53 {
54 IntervalVector saved_x = x;
55 ci->contract(saved_x);
56 result |= saved_x;
57 }
58
59 x = result;
60 }
61
62 template<typename C>
63 CtcUnion& operator|=(const C& c)
64 {
65 assert(c.nb_var == nb_var);
66 _v_ctc.push_back(std::make_shared<C>(c));
67 return *this;
68 }
69
70 CtcUnion& add_raw_ptr(Ctc *c)
71 {
72 _v_ctc_ptrs.push_back(c);
73 return *this;
74 }
75
76 protected:
77
78 std::vector<std::shared_ptr<Ctc>> _v_ctc;
79 std::vector<Ctc*> _v_ctc_ptrs;
80 };
81}
82
83#endif
FixPoint of a separator The fixpoint of a separator is computed by calling the "::"separate function ...
Definition codac_capd_helpers.h:9