Skip to content

Commit e012286

Browse files
authored
Merge pull request #347 from SimonRohou/codac2_dev
[doc] BoolInterval + manual style
2 parents dd3f881 + 4843031 commit e012286

9 files changed

Lines changed: 134 additions & 2 deletions

File tree

doc/manual/_static/css/custom.css

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,4 +176,19 @@ a .download:before {
176176
linear-gradient(-45deg, transparent 75%, #ddd 75%);
177177
background-size: var(--size) var(--size);
178178
background-position: 0 0, 0 calc(var(--size)/2), calc(var(--size)/2) calc(var(--size)/-2), calc(var(--size)/-2) 0;
179+
}
180+
181+
/* Adding VIBes + IPE logos in the lateral menu */
182+
.sidebar-tree li.toctree-l1 > a.reference.internal:has(+ input#toctree-checkbox-8) {
183+
background:url("../logos/logos_vibes_ipe.png") no-repeat center / contain;
184+
}
185+
186+
.sidebar-tree li.toctree-l1 > a.reference.internal:has(+ input#toctree-checkbox-8):hover {
187+
background: url("../logos/logos_vibes_ipe.png") no-repeat center / contain,
188+
var(--color-sidebar-item-background--hover);
189+
}
190+
191+
.sidebar-tree li.toctree-l1 > a.reference.internal.current:has(+ input#toctree-checkbox-8) {
192+
background: url("../logos/logos_vibes_ipe.png") no-repeat center / contain,
193+
var(--color-sidebar-item-background--current);
179194
}
4.84 KB
Loading
8.36 KB
Loading
27.7 KB
Loading

doc/manual/manual/contractors/index.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
Contractors
2-
===========
1+
Contractors, separators
2+
=======================
33

44
.. toctree::
55

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
.. _sec-intervals-boolinterval-class:
2+
3+
The BoolInterval enumeration
4+
============================
5+
6+
Main author: `Simon Rohou <https://www.simon-rohou.fr/research/>`_
7+
8+
A :class:`~codac2.BoolInterval` (Boolean interval) is a compact representation of an
9+
uncertain truth value. It is primarily used as a **reliable return type** for predicates
10+
evaluated under uncertainties (interval inputs, rounding effects, geometric tolerances, etc.).
11+
12+
Definition
13+
----------
14+
15+
Let :math:`\mathbb{B}=\{\mathsf{false},\mathsf{true}\}`. A boolean interval represents a subset
16+
of :math:`\mathbb{B}`: :math:`[b]\subseteq\mathbb{B}`.
17+
18+
In Codac, ``BoolInterval`` is an enumeration of four canonical values:
19+
20+
.. tabs::
21+
22+
.. group-tab:: Python
23+
24+
.. literalinclude:: src.py
25+
:language: py
26+
:start-after: [boolinterval-class-1-beg]
27+
:end-before: [boolinterval-class-1-end]
28+
:dedent: 4
29+
30+
.. group-tab:: C++
31+
32+
.. literalinclude:: src.cpp
33+
:language: c++
34+
:start-after: [boolinterval-class-1-beg]
35+
:end-before: [boolinterval-class-1-end]
36+
:dedent: 4
37+
38+
39+
Two useful set values are:
40+
41+
.. tabs::
42+
43+
.. group-tab:: Python
44+
45+
.. literalinclude:: src.py
46+
:language: py
47+
:start-after: [boolinterval-class-2-beg]
48+
:end-before: [boolinterval-class-2-end]
49+
:dedent: 4
50+
51+
.. group-tab:: C++
52+
53+
.. literalinclude:: src.cpp
54+
:language: c++
55+
:start-after: [boolinterval-class-2-beg]
56+
:end-before: [boolinterval-class-2-end]
57+
:dedent: 4
58+
59+
60+
Operations on ``BoolInterval`` are documented below:
61+
62+
.. doxygenfunction:: codac2::operator&(BoolInterval x, BoolInterval y)
63+
:project: codac
64+
65+
.. doxygenfunction:: codac2::operator|(BoolInterval x, BoolInterval y)
66+
:project: codac
67+
68+
.. doxygenfunction:: codac2::operator&&(BoolInterval x, BoolInterval y)
69+
:project: codac
70+
71+
.. doxygenfunction:: codac2::operator||(BoolInterval x, BoolInterval y)
72+
:project: codac
73+
74+
.. doxygenfunction:: codac2::operator~(BoolInterval x)
75+
:project: codac
76+
77+
78+
.. admonition:: Technical documentation
79+
80+
See the `C++ API documentation of the BoolInterval class <../../api/html/codac2___bool_interval_8h.html>`_.

doc/manual/manual/intervals/index.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Codac provides data structures for handling basic interval sets. These structure
88
- :ref:`The Interval class <sec-intervals-class>`: represents a real bounded interval :math:`[x^{-},x^{+}]`.
99
- :ref:`The IntervalVector class <sec-intervals-intervalvector-class>` (or ``IntervalRow``): represents a vector (or row) where each component is an interval.
1010
- ``IntervalMatrix``: represents a matrix where each element is an interval.
11+
- :ref:`The BoolInterval class <sec-intervals-boolinterval-class>`: represents a Boolean interval.
1112

1213

1314
.. toctree::
@@ -16,6 +17,7 @@ Codac provides data structures for handling basic interval sets. These structure
1617
Interval_class.rst
1718
.. Vector_class.rst
1819
IntervalVector_class.rst
20+
BoolInterval_class.rst
1921

2022
.. What is an interval? <http://codac.io>
2123
The Interval class <http://codac.io>

doc/manual/manual/intervals/src.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,26 @@
1414
using namespace std;
1515
using namespace codac2;
1616

17+
TEST_CASE("BoolInterval class - manual")
18+
{
19+
{
20+
// [boolinterval-class-1-beg]
21+
BoolInterval::FALSE; // certainly false
22+
BoolInterval::TRUE; // certainly true
23+
BoolInterval::UNKNOWN; // undetermined
24+
BoolInterval::EMPTY; // inconsistent / impossible
25+
// [boolinterval-class-1-end]
26+
}
27+
/*
28+
{
29+
// [boolinterval-class-2-beg]
30+
BoolInterval::UNKNOWN == BoolInterval::TRUE | BoolInterval::FALSE
31+
BoolInterval::EMPTY == BoolInterval::TRUE & BoolInterval::FALSE
32+
// [boolinterval-class-2-end]
33+
}
34+
*/
35+
}
36+
1737
TEST_CASE("Interval class - manual")
1838
{
1939
#if 0

doc/manual/manual/intervals/src.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,21 @@
1414

1515
class TestIntervalManual(unittest.TestCase):
1616

17+
def tests_BoolInterval_manual(test):
18+
19+
# [boolinterval-class-1-beg]
20+
BoolInterval.FALSE # certainly false
21+
BoolInterval.TRUE # certainly true
22+
BoolInterval.UNKNOWN # undetermined
23+
BoolInterval.EMPTY # inconsistent / impossible
24+
# [boolinterval-class-1-end]
25+
26+
# [boolinterval-class-2-beg]
27+
BoolInterval.UNKNOWN == BoolInterval.TRUE | BoolInterval.FALSE
28+
BoolInterval.EMPTY == BoolInterval.TRUE & BoolInterval.FALSE
29+
# [boolinterval-class-2-end]
30+
31+
1732
def tests_Interval_manual(test):
1833

1934
# [interval-class-1-beg]

0 commit comments

Comments
 (0)