Skip to content
Snippets Groups Projects
Commit da91b334 authored by Santiago Ospina De Los Ríos's avatar Santiago Ospina De Los Ríos
Browse files

Merge branch 'cleanup/fix-misc-warnings' into 'master'

Fix misc warnings

See merge request !1414
parents e9c88282 56eaf4e1
No related branches found
No related tags found
2 merge requests!1470Fix wrong variable name to make target hash (2.10),!1414Fix misc warnings
Pipeline #74594 waiting for manual action
......@@ -281,65 +281,49 @@ namespace Dune {
//! Bitwise and (for bitset).
BitSetVectorReference& operator&=(const bitset& x)
{
for (size_type i=0; i<block_size; i++)
getBit(i) = (test(i) & x.test(i));
return *this;
return (*this) = bitset(*this) & x;
}
//! Bitwise and (for BitSetVectorConstReference and BitSetVectorReference)
BitSetVectorReference& operator&=(const BitSetVectorConstReference& x)
{
for (size_type i=0; i<block_size; i++)
getBit(i) = (test(i) & x.test(i));
return *this;
return (*this) &= bitset(x);
}
//! Bitwise inclusive or (for bitset)
BitSetVectorReference& operator|=(const bitset& x)
{
for (size_type i=0; i<block_size; i++)
getBit(i) = (test(i) | x.test(i));
return *this;
return (*this) = bitset(*this) | x;
}
//! Bitwise inclusive or (for BitSetVectorConstReference and BitSetVectorReference)
BitSetVectorReference& operator|=(const BitSetVectorConstReference& x)
{
for (size_type i=0; i<block_size; i++)
getBit(i) = (test(i) | x.test(i));
return *this;
return (*this) |= bitset(x);
}
//! Bitwise exclusive or (for bitset).
BitSetVectorReference& operator^=(const bitset& x)
{
for (size_type i=0; i<block_size; i++)
getBit(i) = (test(i) ^ x.test(i));
return *this;
return (*this) = bitset(*this) ^ x;
}
//! Bitwise exclusive or (for BitSetVectorConstReference and BitSetVectorReference)
BitSetVectorReference& operator^=(const BitSetVectorConstReference& x)
{
for (size_type i=0; i<block_size; i++)
getBit(i) = (test(i) ^ x.test(i));
return *this;
return (*this) ^= bitset(x);
}
//! Left shift.
BitSetVectorReference& operator<<=(size_type n)
{
for (size_type i=0; i<block_size-n; i++)
getBit(i) = test(i+n);
return *this;
return (*this) = bitset(*this) << n;
}
//! Right shift.
BitSetVectorReference& operator>>=(size_type n)
{
for (size_type i=0; i<block_size-n; i++)
getBit(i+n) = test(i);
return *this;
return (*this) = bitset(*this) >> n;
}
//! Sets every bit.
......
......@@ -21,8 +21,8 @@ int main() try {
t.checkThrow<Dune::RangeError>([&]{ a+=b;})<<"Add matrices of different sizes didn't throw.";
t.checkThrow<Dune::RangeError>([&]{ a-=b;})<<"Subtract matrices of different sizes didn't throw.";
t.checkThrow<Dune::RangeError>([&]{ (a == b);})<<"Comparing matrices of different sizes for equality didn't throw.";
t.checkThrow<Dune::RangeError>([&]{ (a != b);})<<"Comparing matrices of different sizes for inequality didn't throw.";
t.checkThrow<Dune::RangeError>([&]{ std::ignore = (a == b);})<<"Comparing matrices of different sizes for equality didn't throw.";
t.checkThrow<Dune::RangeError>([&]{ std::ignore = (a != b);})<<"Comparing matrices of different sizes for inequality didn't throw.";
t.checkThrow<Dune::RangeError>([&]{a.axpy(2,b); })<<"Axpy for matrices of different sizes didn't throw.";
Dune::FieldMatrix<double, 1, 3> c = {{1, 2, 3}};
......
......@@ -8,7 +8,16 @@
int main()
{
#if (PY_MAJOR_VERSION >= 3) && (PY_MINOR_VERSION >= 11)
PyConfig config;
PyConfig_InitPythonConfig(&config);
PyConfig_SetString(&config, &config.program_name, PYTHON_INTERPRETER);
pybind11::scoped_interpreter guard{&config};
#else
Py_SetProgramName(PYTHON_INTERPRETER);
pybind11::scoped_interpreter guard{};
#endif
/*
remark: combine getting the guard and loading
dune.common in a single 'initialization' function -
......@@ -16,7 +25,6 @@ int main()
types - although a 'dummy' scope can also be used, i.e.,
pybind11::handle scope;
*/
pybind11::scoped_interpreter guard{};
pybind11::module dcommon = pybind11::module::import("dune.common");
auto global = pybind11::dict(pybind11::module::import("__main__").attr("__dict__"));
......
......@@ -9,9 +9,16 @@
#include<Python.h>
int main()
{
#if (PY_MAJOR_VERSION >= 3) && (PY_MINOR_VERSION >= 11)
PyConfig config;
PyConfig_InitPythonConfig(&config);
PyConfig_SetString(&config, &config.program_name, PYTHON_INTERPRETER);
pybind11::scoped_interpreter guard{&config};
#else
Py_SetProgramName(PYTHON_INTERPRETER);
pybind11::scoped_interpreter guard{};
#endif
auto global = pybind11::dict(pybind11::module::import("__main__").attr("__dict__"));
{
pybind11::module dcommon = pybind11::module::import("dune.common");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment