Skip to content

Commit

Permalink
added more rules to clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomaqa committed Jul 6, 2024
1 parent e3c79a9 commit 92329f2
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 19 deletions.
7 changes: 6 additions & 1 deletion .clang-format
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
---
Language: Cpp
BasedOnStyle: LLVM
Standard: c++20
BasedOnStyle: LLVM
ColumnLimit: 120
IndentWidth: 4
AccessModifierOffset: -4
PointerAlignment: Middle
QualifierAlignment: Right
AlignOperands: AlignAfterOperator
AllowShortFunctionsOnASingleLine: Inline
AllowShortBlocksOnASingleLine: Always
AllowShortIfStatementsOnASingleLine: WithoutElse
IndentCaseLabels: True
NamespaceIndentation: All
AlwaysBreakTemplateDeclarations: Yes
SpaceAfterTemplateKeyword: False
2 changes: 1 addition & 1 deletion src/cnfizers/TermMapper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ Var TermMapper::getVar(PTRef r) const {
return v;
}

const Lit TermMapper::getOrCreateLit(PTRef ptr) {
Lit const TermMapper::getOrCreateLit(PTRef ptr) {
PTRef p_tr;
bool sgn;
Var v = var_Undef;
Expand Down
2 changes: 1 addition & 1 deletion src/cnfizers/TermMapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class TermMapper {
* Handles the sign of the term correctly, i.e., it returned negative literal for negative term and
* positive literal for positive term.
*/
const Lit getOrCreateLit(PTRef ptr);
Lit const getOrCreateLit(PTRef ptr);

// Returns the variable corresponding to the term. The connection must already exist.
Var getVar(PTRef) const;
Expand Down
5 changes: 3 additions & 2 deletions src/rewriters/Rewriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@

#include "Logic.h"

template<typename TConfig> class Rewriter {
template<typename TConfig>
class Rewriter {
protected:
Logic & logic;
TConfig & cfg;
Expand Down Expand Up @@ -97,4 +98,4 @@ class NoOpRewriter : Rewriter<DefaultRewriterConfig> {
NoOpRewriter(Logic & logic) : Rewriter<DefaultRewriterConfig>(logic, config) {}
};

#endif // OPENSMT_REWRITER_H
#endif // OPENSMT_REWRITER_H
21 changes: 11 additions & 10 deletions src/tsolvers/lasolver/Tableau.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@

using namespace opensmt;
namespace {
template<class C, class E> inline bool contains(const C & container, const E & elem) {
return container.find(elem) != container.end();
}
template<class C, class E>
inline bool contains(C const & container, E const & elem) {
return container.find(elem) != container.end();
}
} // namespace

void Tableau::nonbasicVar(LVRef v) {
Expand Down Expand Up @@ -50,17 +51,17 @@ std::size_t Tableau::getPolySize(LVRef basicVar) const {
return rows[basicVar.x]->size();
}

const opensmt::Real & Tableau::getCoeff(LVRef basicVar, LVRef nonBasicVar) const {
opensmt::Real const & Tableau::getCoeff(LVRef basicVar, LVRef nonBasicVar) const {
assert(rows[basicVar.x]);
return rows[basicVar.x]->getCoeff(nonBasicVar);
}

const Tableau::column_t & Tableau::getColumn(LVRef nonBasicVar) const {
Tableau::column_t const & Tableau::getColumn(LVRef nonBasicVar) const {
assert(cols[nonBasicVar.x]);
return *cols[nonBasicVar.x];
}

const Tableau::Polynomial & Tableau::getRowPoly(LVRef basicVar) const {
Tableau::Polynomial const & Tableau::getRowPoly(LVRef basicVar) const {
assert(rows[basicVar.x]);
return *rows[basicVar.x];
}
Expand All @@ -70,7 +71,7 @@ Tableau::Polynomial & Tableau::getRowPoly(LVRef basicVar) {
return *rows[basicVar.x];
}

const Tableau::rows_t & Tableau::getRows() const {
Tableau::rows_t const & Tableau::getRows() const {
return rows;
}

Expand Down Expand Up @@ -124,7 +125,7 @@ void Tableau::pivot(LVRef bv, LVRef nv) {
assert(!rows[nv.x]);
{
Polynomial & nvPoly = getRowPoly(bv);
const auto coeff = nvPoly.removeVar(nv);
auto const coeff = nvPoly.removeVar(nv);
if (not coeff.isOne()) { nvPoly.divideBy(coeff); }
nvPoly.negate();
nvPoly.addTerm(bv, coeff.inverse());
Expand All @@ -149,7 +150,7 @@ void Tableau::pivot(LVRef bv, LVRef nv) {
if (rowVar == nv || isQuasiBasic(rowVar)) { continue; }
// update the polynomials
auto & poly = getRowPoly(rowVar);
const auto nvCoeff = poly.removeVar(nv);
auto const nvCoeff = poly.removeVar(nv);
poly.merge(
nvPoly, nvCoeff, tmp_storage,
// informAdded
Expand Down Expand Up @@ -193,7 +194,7 @@ void Tableau::print() const {
for (unsigned i = 0; i != rows.size(); ++i) {
if (!rows[i]) { continue; }
std::cout << "Var of the row: " << i << ';';
for (const auto & term : this->getRowPoly(LVRef{i})) {
for (auto const & term : this->getRowPoly(LVRef{i})) {
std::cout << "( " << term.coeff << " | " << term.var.x << " ) ";
}
std::cout << '\n';
Expand Down
8 changes: 4 additions & 4 deletions src/tsolvers/lasolver/Tableau.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ class Tableau {
void newRow(LVRef v, std::unique_ptr<Polynomial> poly);
std::size_t getNumOfCols() const;
std::size_t getPolySize(LVRef basicVar) const;
const opensmt::Real & getCoeff(LVRef basicVar, LVRef nonBasicVar) const;
const column_t & getColumn(LVRef nonBasicVar) const;
const Polynomial & getRowPoly(LVRef basicVar) const;
opensmt::Real const & getCoeff(LVRef basicVar, LVRef nonBasicVar) const;
column_t const & getColumn(LVRef nonBasicVar) const;
Polynomial const & getRowPoly(LVRef basicVar) const;
Polynomial & getRowPoly(LVRef basicVar);
const rows_t & getRows() const;
rows_t const & getRows() const;

void clear();
void pivot(LVRef bv, LVRef nv);
Expand Down

0 comments on commit 92329f2

Please sign in to comment.