Skip to content
Snippets Groups Projects
Commit 8fc31db5 authored by Oliver Sander's avatar Oliver Sander
Browse files

Implement VariableBlockVector<double>

parent 2b63e74e
No related branches found
No related tags found
1 merge request!240Allow number types as entries of matrix and vector types
Pipeline #14850 passed
......@@ -224,7 +224,7 @@ namespace Imp {
[&](auto id) {
using namespace std;
for (size_type i=0; i<this->n; ++i)
sum += Dune::dot((*this)[i],y[i]);
sum += Dune::dot(id((*this)[i]),y[i]);
},
[&](auto id) {
for (size_type i=0; i<this->n; ++i)
......@@ -283,7 +283,7 @@ namespace Imp {
Hybrid::ifElse(IsNumber<B>(),
[&](auto id) {
for (size_type i=0; i<this->n; ++i)
sum += fvmeta::abs2((*this)[i]);
sum += fvmeta::abs2(id((*this)[i]));
},
[&](auto id) {
for (size_type i=0; i<this->n; ++i)
......
......@@ -72,5 +72,14 @@ int main()
testVectorSpaceOperations(v3);
testScalarProduct(v3);
// Perform tests with a scalar vector entry
VariableBlockVector<double> v5(10);
testHomogeneousRandomAccessContainer(v5);
Dune::testConstructibility<VariableBlockVector<double> >();
testNorms(v5);
testVectorSpaceOperations(v5);
testScalarProduct(v5);
return suite.exit();
}
......@@ -48,7 +48,7 @@ namespace Dune {
//===== type definitions and constants
//! export the type representing the field
typedef typename B::field_type field_type;
using field_type = typename Imp::BlockTraits<B>::field_type;
//! export the allocator type
typedef A allocator_type;
......@@ -82,10 +82,7 @@ namespace Dune {
/** increment block level counter, yes, it is two levels because
VariableBlockVector is a container of containers
*/
enum {
//! The number of blocklevels this vector contains.
blocklevel = B::blocklevel+2
};
static constexpr unsigned int blocklevel = Imp::BlockTraits<B>::blockLevel()+2;
//===== constructors and such
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment