20#include "libmesh/system_norm.h"
21#include "libmesh/enum_norm_type.h"
22#include "libmesh/int_range.h"
28 _norms(1,
DISCRETE_L2), _weights(1, 1.0), _weights_sq(1, 1.0)
34 _norms(1, t), _weights(1, 1.0), _weights_sq(1, 1.0)
40 _norms(
std::move(norms)), _weights(1, 1.0), _weights_sq(1, 1.0)
48 std::vector<Real> & weights) :
49 _norms(
std::move(norms)), _weights(weights),
50 _weights_sq(_weights.size(), 0.0)
66 std::vector<std::vector<Real>> & weights):
67 _norms(
std::move(norms)),
68 _weights(weights.size()),
69 _weights_sq(weights.size()),
70 _off_diagonal_weights(weights)
116 std::size_t i = (var <
_norms.size()) ? var :
_norms.size() - 1;
186 const std::vector<Real> & v2)
190 std::size_t vsize = v1.size();
191 libmesh_assert_equal_to (vsize, v2.size());
195 std::size_t diagsize = this->
_weights.size();
196 libmesh_assert_greater_equal (vsize, diagsize);
203 for (std::size_t i = 0; i != diagsize; i++)
205 val += this->
_weights[i] * v1[i] * v2[i];
209 for (std::size_t i = diagsize; i < vsize; i++)
211 val += v1[i] * v2[i];
216 libmesh_assert_less_equal (vsize, nrows);
218 for (std::size_t i = 0; i != nrows; i++)
221 for (std::size_t j=0; j != ncols; j++)
242 for (std::size_t i = 0; i != nrows; i++)
245 for (std::size_t j = 0; j != ncols; j++)
256 for (std::size_t i = 0; i != nrows; i++)
void set_type(unsigned int var, const FEMNormType &t)
Sets the type of the norm in variable var, as well as for any unset variables with index less than va...
std::vector< FEMNormType > _norms
void set_weight(unsigned int var, Real w)
Sets the weight corresponding to the norm in variable var, as well as for any unset variables with in...
std::vector< Real > _weights
void set_off_diagonal_weight(unsigned int i, unsigned int j, Real w)
Sets the weight corresponding to the norm from the variable pair v1(var1) coming from v2(var2).
FEMNormType type(unsigned int var) const
SystemNorm()
Constructor, defaults to DISCRETE_L2 with weight of 1.0.
std::vector< std::vector< Real > > _off_diagonal_weights
One more data structure needed to store the off diagonal components for the generalize SystemNorm cas...
Real calculate_norm(const std::vector< Real > &v)
std::vector< Real > _weights_sq
Real weight(unsigned int var) const
Real weight_sq(unsigned int var) const
The libMesh namespace provides an interface to certain functionality in the library.
auto index_range(const T &sizable)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real