Skip to content

Commit b80cae1

Browse files
committed
Reformatting with clang-format
1 parent 3d0e099 commit b80cae1

30 files changed

+215
-214
lines changed

Diff for: lib/coek/coek/api/constraint.cpp

+5-3
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,12 @@ Constraint& Constraint::operator=(const Constraint& expr)
3030
}
3131

3232
Constraint& Constraint::expr(const Constraint& expr)
33-
{ repn = expr.repn; return *this; }
33+
{
34+
repn = expr.repn;
35+
return *this;
36+
}
3437

35-
Constraint Constraint::expr() const
36-
{ return *this; }
38+
Constraint Constraint::expr() const { return *this; }
3739

3840
bool Constraint::active() const { return repn->active; }
3941

Diff for: lib/coek/coek/api/constraint.hpp

-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ class Constraint {
4747
/** \returns \c true if the constraint is feasible */
4848
bool is_feasible() const;
4949

50-
5150
/** \returns the expression for the constraint lower bound */
5251
Expression lower() const;
5352
/** \returns the expression for the constraint body */

Diff for: lib/coek/coek/api/expression.cpp

+6-9
Original file line numberDiff line numberDiff line change
@@ -281,11 +281,11 @@ bool Variable::is_integer() const { return repn->integer; }
281281
Variable Variable::expand()
282282
{
283283
#ifdef COEK_WITH_COMPACT_MODEL
284-
auto var = Variable().
285-
lower( this->lower_expression().expand() ).
286-
upper( this->upper_expression().expand() ).
287-
value( this->value_expression().expand() ).
288-
within( this->within() );
284+
auto var = Variable()
285+
.lower(this->lower_expression().expand())
286+
.upper(this->upper_expression().expand())
287+
.value(this->value_expression().expand())
288+
.within(this->within());
289289
return var;
290290
#else
291291
return *this;
@@ -365,10 +365,7 @@ Expression Expression::diff(const Variable& var) const
365365
return e;
366366
}
367367

368-
Expression Expression::expand()
369-
{
370-
return expand_expr(repn);
371-
}
368+
Expression Expression::expand() { return expand_expr(repn); }
372369

373370
std::ostream& operator<<(std::ostream& ostr, const Expression& arg)
374371
{

Diff for: lib/coek/coek/api/indexed_container.defs.hpp

+14-14
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ class IndexedComponentRepn_multiarray : public IndexedComponentRepn<TYPE> {
1212
public:
1313
IndexedComponentRepn_multiarray(size_t n) : IndexedComponentRepn<TYPE>(1), shape({n})
1414
{
15-
#ifdef CUSTOM_INDEXVECTOR
15+
#ifdef CUSTOM_INDEXVECTOR
1616
this->cache.resize(2 * (n + 1) * 2);
17-
#endif
17+
#endif
1818
}
1919

2020
IndexedComponentRepn_multiarray(const std::vector<size_t>& _shape)
@@ -23,9 +23,9 @@ class IndexedComponentRepn_multiarray : public IndexedComponentRepn<TYPE> {
2323
size_t _size = 1;
2424
for (auto n : shape)
2525
_size *= n;
26-
#ifdef CUSTOM_INDEXVECTOR
26+
#ifdef CUSTOM_INDEXVECTOR
2727
this->cache.resize(2 * (_size + 1) * (_shape.size() + 1));
28-
#endif
28+
#endif
2929
}
3030

3131
IndexedComponentRepn_multiarray(const std::initializer_list<size_t>& _shape)
@@ -34,9 +34,9 @@ class IndexedComponentRepn_multiarray : public IndexedComponentRepn<TYPE> {
3434
size_t _size = 1;
3535
for (auto n : shape)
3636
_size *= n;
37-
#ifdef CUSTOM_INDEXVECTOR
37+
#ifdef CUSTOM_INDEXVECTOR
3838
this->cache.resize(2 * (_size + 1) * (_shape.size() + 1));
39-
#endif
39+
#endif
4040
}
4141

4242
virtual ~IndexedComponentRepn_multiarray() {}
@@ -94,9 +94,9 @@ class IndexedComponentRepn_setindex : public IndexedComponentRepn<TYPE> {
9494
IndexedComponentRepn_setindex(ConcreteSet& _arg)
9595
: IndexedComponentRepn<TYPE>(_arg.dim()), concrete_set(_arg)
9696
{
97-
#ifdef CUSTOM_INDEXVECTOR
97+
# ifdef CUSTOM_INDEXVECTOR
9898
this->cache.resize(2 * (this->dim() + 1) * (_arg.size() + 1));
99-
#endif
99+
# endif
100100
this->tmp.resize(this->dim());
101101
}
102102

@@ -127,12 +127,12 @@ void IndexedComponentRepn_setindex<TYPE>::generate_names()
127127
return;
128128

129129
size_t _dim = this->dim();
130-
#ifdef CUSTOM_INDEXVECTOR
130+
# ifdef CUSTOM_INDEXVECTOR
131131
std::vector<int> x_data(_dim);
132132
IndexVector x(&(x_data[0]), _dim);
133-
#else
133+
# else
134134
IndexVector x(_dim);
135-
#endif
135+
# endif
136136
for (auto& indices : concrete_set) {
137137
for (size_t j = 0; j < _dim; j++)
138138
x[j] = indices[j];
@@ -221,11 +221,11 @@ TYPE& IndexedComponent_Map<TYPE>::index(const IndexVector& args)
221221

222222
auto curr = this->repn->value.find(args);
223223
if (curr == this->repn->value.end()) {
224-
#ifdef CUSTOM_INDEXVECTOR
224+
#ifdef CUSTOM_INDEXVECTOR
225225
auto _args = this->repn->cache.clone(args);
226-
#else
226+
#else
227227
auto& _args = args;
228-
#endif
228+
#endif
229229
TYPE tmp;
230230
auto& res = this->repn->value[_args] = tmp;
231231
return res;

Diff for: lib/coek/coek/api/indexed_container.hpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ typedef std::variant<int, expr_pointer_t> refarg_types;
2424
template <class TYPE>
2525
class IndexedComponentRepn {
2626
public:
27-
#ifdef CUSTOM_INDEXVECTOR
27+
#ifdef CUSTOM_INDEXVECTOR
2828
IndexVectorCache cache;
29-
#endif
29+
#endif
3030
std::map<IndexVector, TYPE> value;
3131
size_t _dim;
3232
std::string _name;
@@ -40,11 +40,11 @@ class IndexedComponentRepn {
4040

4141
void resize_index_vectors(IndexVector& tmp, std::vector<refarg_types>& reftmp)
4242
{
43-
#ifdef CUSTOM_INDEXVECTOR
44-
tmp = cache.alloc(2*dim());
45-
#else
43+
#ifdef CUSTOM_INDEXVECTOR
44+
tmp = cache.alloc(2 * dim());
45+
#else
4646
tmp.resize(dim());
47-
#endif
47+
#endif
4848
reftmp.resize(dim());
4949
}
5050

Diff for: lib/coek/coek/api/intrinsic_fn.hpp

+20-20
Original file line numberDiff line numberDiff line change
@@ -53,140 +53,140 @@ inline Expression if_else(CondType _cond, const Expression& then_, const Express
5353
* The function abs(x) computes the absolute value of x.
5454
*/
5555
Expression abs(const Expression&);
56-
inline double abs(double value) {return std::abs(value); }
56+
inline double abs(double value) { return std::abs(value); }
5757
/**
5858
* Create an expression calling the ceil() function.
5959
*
6060
* The function ceil(x) computes the nearest integer not less than x.
6161
*/
6262
Expression ceil(const Expression&);
63-
inline double ceil(double value) {return std::ceil(value); }
63+
inline double ceil(double value) { return std::ceil(value); }
6464
/**
6565
* Create an expression calling the floor() function.
6666
*
6767
* The function floor(x) computes the nearest integer not greater than x.
6868
*/
6969
Expression floor(const Expression&);
70-
inline double floor(double value) {return std::floor(value); }
70+
inline double floor(double value) { return std::floor(value); }
7171
/**
7272
* Create an expression calling the exp() function.
7373
*
7474
* The function exp(x) computes the value of e raised to the xth power.
7575
*/
7676
Expression exp(const Expression&);
77-
inline double exp(double value) {return std::exp(value); }
77+
inline double exp(double value) { return std::exp(value); }
7878
/**
7979
* Create an expression calling the log() function.
8080
*
8181
* The function log(x) computes the natural logarithm of x (base e).
8282
*/
8383
Expression log(const Expression&);
84-
inline double log(double value) {return std::log(value); }
84+
inline double log(double value) { return std::log(value); }
8585
/**
8686
* Create an expression calling the log10() function.
8787
*
8888
* The function log10(x) computes the common logarithm of x (base 10).
8989
*/
9090
Expression log10(const Expression&);
91-
inline double log10(double value) {return std::log10(value); }
91+
inline double log10(double value) { return std::log10(value); }
9292
/**
9393
* Create an expression calling the sqrt() function.
9494
*
9595
* The function sqrt(x) computes the square root of x.
9696
*/
9797
Expression sqrt(const Expression&);
98-
inline double sqrt(double value) {return std::sqrt(value); }
98+
inline double sqrt(double value) { return std::sqrt(value); }
9999
/**
100100
* Create an expression calling the sin() function.
101101
*
102102
* The function sin(x) computes the sine of x.
103103
*/
104104
Expression sin(const Expression&);
105-
inline double sin(double value) {return std::sin(value); }
105+
inline double sin(double value) { return std::sin(value); }
106106
/**
107107
* Create an expression calling the cos() function.
108108
*
109109
* The function cos(x) computes the cosine of x.
110110
*/
111111
Expression cos(const Expression&);
112-
inline double cos(double value) {return std::cos(value); }
112+
inline double cos(double value) { return std::cos(value); }
113113
/**
114114
* Create an expression calling the tan() function.
115115
*
116116
* The function tan(x) computes the tangent of x.
117117
*/
118118
Expression tan(const Expression&);
119-
inline double tan(double value) {return std::tan(value); }
119+
inline double tan(double value) { return std::tan(value); }
120120
/**
121121
* Create an expression calling the sinh() function.
122122
*
123123
* The function sinh(x) computes the hyperbolic sine of x.
124124
*/
125125
Expression sinh(const Expression&);
126-
inline double sinh(double value) {return std::sinh(value); }
126+
inline double sinh(double value) { return std::sinh(value); }
127127
/**
128128
* Create an expression calling the cosh() function.
129129
*
130130
* The function cosh(x) computes the hyperbolic cosine of x.
131131
*/
132132
Expression cosh(const Expression&);
133-
inline double cosh(double value) {return std::cosh(value); }
133+
inline double cosh(double value) { return std::cosh(value); }
134134
/**
135135
* Create an expression calling the tanh() function.
136136
*
137137
* The function tanh(x) computes the hyperbolic tangent of x.
138138
*/
139139
Expression tanh(const Expression&);
140-
inline double tanh(double value) {return std::tanh(value); }
140+
inline double tanh(double value) { return std::tanh(value); }
141141
/**
142142
* Create an expression calling the asin() function.
143143
*
144144
* The function asin(x) computes the arc sine of x.
145145
*/
146146
Expression asin(const Expression&);
147-
inline double asin(double value) {return std::asin(value); }
147+
inline double asin(double value) { return std::asin(value); }
148148
/**
149149
* Create an expression calling the acos() function.
150150
*
151151
* The function acos(x) computes the arc cosine of x.
152152
*/
153153
Expression acos(const Expression&);
154-
inline double acos(double value) {return std::acos(value); }
154+
inline double acos(double value) { return std::acos(value); }
155155
/**
156156
* Create an expression calling the atan() function.
157157
*
158158
* The function atan(x) computes the arc tangent of x.
159159
*/
160160
Expression atan(const Expression&);
161-
inline double atan(double value) {return std::atan(value); }
161+
inline double atan(double value) { return std::atan(value); }
162162
/**
163163
* Create an expression calling the asinh() function.
164164
*
165165
* The function asinh(x) computes the hyperbolic arc sine of x.
166166
*/
167167
Expression asinh(const Expression&);
168-
inline double asinh(double value) {return std::asinh(value); }
168+
inline double asinh(double value) { return std::asinh(value); }
169169
/**
170170
* Create an expression calling the acosh() function.
171171
*
172172
* The function acosh(x) computes the hyperbolic arc cosine of x.
173173
*/
174174
Expression acosh(const Expression&);
175-
inline double acosh(double value) {return std::acosh(value); }
175+
inline double acosh(double value) { return std::acosh(value); }
176176
/**
177177
* Create an expression calling the atanh() function.
178178
*
179179
* The function atanh(x) computes the hyperbolic arc tangent of x.
180180
*/
181181
Expression atanh(const Expression&);
182-
inline double atanh(double value) {return std::atanh(value); }
182+
inline double atanh(double value) { return std::atanh(value); }
183183
/**
184184
* Create an expression calling the pow() function with two expression arguments.
185185
*
186186
* The function pow(x,y) computes the value of x raised to the power y.
187187
*/
188188
Expression pow(const Expression&, const Expression&);
189-
inline double pow(double base, double exp) {return std::pow(base, exp); }
189+
inline double pow(double base, double exp) { return std::pow(base, exp); }
190190
/**
191191
* Create an expression calling the pow() function with a double exponent value.
192192
*

Diff for: lib/coek/coek/api/parameter_array.cpp

+11-12
Original file line numberDiff line numberDiff line change
@@ -12,29 +12,29 @@ class ParameterArrayRepn : public ParameterAssocArrayRepn {
1212
size_t _size;
1313

1414
public:
15-
ParameterArrayRepn(size_t n) : shape({n}), _size(n)
15+
ParameterArrayRepn(size_t n) : shape({n}), _size(n)
1616
{
17-
#ifdef CUSTOM_INDEXVECTOR
18-
cache.resize(2 * (size() + 1) * 2);
19-
#endif
17+
#ifdef CUSTOM_INDEXVECTOR
18+
cache.resize(2 * (size() + 1) * 2);
19+
#endif
2020
}
2121

2222
ParameterArrayRepn(const std::vector<size_t>& _shape) : shape(_shape), _size(1)
2323
{
2424
for (auto n : shape)
2525
_size *= n;
26-
#ifdef CUSTOM_INDEXVECTOR
26+
#ifdef CUSTOM_INDEXVECTOR
2727
cache.resize(2 * (size() + 1) * (dim() + 1));
28-
#endif
28+
#endif
2929
}
3030

3131
ParameterArrayRepn(const std::initializer_list<size_t>& _shape) : shape(_shape), _size(1)
3232
{
3333
for (auto n : shape)
3434
_size *= n;
35-
#ifdef CUSTOM_INDEXVECTOR
35+
#ifdef CUSTOM_INDEXVECTOR
3636
cache.resize(2 * (size() + 1) * (dim() + 1));
37-
#endif
37+
#endif
3838
}
3939

4040
virtual ~ParameterArrayRepn() {}
@@ -114,13 +114,12 @@ ParameterArray::ParameterArray(const std::initializer_list<size_t>& shape)
114114

115115
std::shared_ptr<ParameterAssocArrayRepn> ParameterArray::get_repn() { return repn; }
116116

117-
Parameter ParameterArray::index(const IndexVector& args)
118-
{ return repn->index(args); }
117+
Parameter ParameterArray::index(const IndexVector& args) { return repn->index(args); }
119118

120119
std::shared_ptr<ParameterTerm> ParameterArrayRepn::index(const IndexVector& args)
121120
{
122-
//auto _repn = repn.get();
123-
//auto& shape = _repn->shape;
121+
// auto _repn = repn.get();
122+
// auto& shape = _repn->shape;
124123
assert(args.size() == shape.size());
125124

126125
expand();

Diff for: lib/coek/coek/api/parameter_assoc_array.hpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ namespace coek {
66

77
class ParameterAssocArray {
88
public:
9-
109
virtual std::shared_ptr<ParameterAssocArrayRepn> get_repn() = 0;
1110
IndexVector tmp;
1211
std::vector<refarg_types> reftmp;
@@ -18,7 +17,7 @@ class ParameterAssocArray {
1817
size_t size();
1918
size_t dim();
2019

21-
//virtual Parameter index(const IndexVector& args) = 0;
20+
// virtual Parameter index(const IndexVector& args) = 0;
2221
#ifdef COEK_WITH_COMPACT_MODEL
2322
Expression create_paramref(const std::vector<refarg_types>& indices);
2423
#endif

0 commit comments

Comments
 (0)