Medusa  1.1
Coordinate Free Mehless Method implementation
VectorField.hpp
Go to the documentation of this file.
1 #ifndef MEDUSA_BITS_TYPES_VECTORFIELD_HPP_
2 #define MEDUSA_BITS_TYPES_VECTORFIELD_HPP_
3 
9 #include "VectorField_fwd.hpp"
10 
11 namespace mm {
12 
13 template <typename Scalar, int dimension>
14 template <typename OtherDerived>
15 VectorField<Scalar, dimension>::VectorField(const Eigen::MatrixBase<OtherDerived>& other)
16  : Base(other) {}
17 
19 template <typename Scalar, int dimension>
20 template <typename OtherDerived>
22  const Eigen::MatrixBase<OtherDerived>& other) {
23  Base::operator=(other); return *this;
24 }
26 
27 template <typename Scalar, int dimension>
28 VectorField<Scalar, dimension>&
30  Base::rowwise() = v.transpose();
31  return *this;
32 }
33 
35 template <typename Scalar, int dimension>
36 template <typename OtherDerived>
38  const Eigen::PlainObjectBase<OtherDerived>& other) {
39  assert_msg(other.size() % dimension == 0, "The length of the given data is not a "
40  "multiple of %d.", dimension);
41  return Eigen::Map<const Eigen::Matrix<Scalar, Eigen::Dynamic, dimension>, 0>(
42  other.data(), other.size()/dimension, dimension);
43 }
45 
46 } // namespace mm
47 
48 #endif // MEDUSA_BITS_TYPES_VECTORFIELD_HPP_
operator=
Matrix & operator=(const Scalar &s)
Assign scalar to a matrix, setting all its elements to s.
Definition: MatrixAddons.hpp:15
mm
Root namespace for the whole library.
Definition: Gaussian.hpp:14
mm::VectorField::Base
Eigen::Matrix< Scalar, Eigen::Dynamic, dimension > Base
Base class.
Definition: VectorField_fwd.hpp:41
mm::Vec
Eigen::Matrix< scalar_t, dim, 1, Eigen::ColMajor|Eigen::AutoAlign, dim, 1 > Vec
Fixed size vector type, representing a mathematical 1d/2d/3d vector.
Definition: Vec_fwd.hpp:31
mm::VectorField::fromLinear
static VectorField fromLinear(const Eigen::PlainObjectBase< OtherDerived > &other)
Construct VectorField from its linear representation, obtained from asLinear().
mm::VectorField::VectorField
VectorField(void)
Construct a vector field of size 0.
Definition: VectorField_fwd.hpp:45
assert_msg
#define assert_msg(cond,...)
Assert with better error reporting.
Definition: assert.hpp:75
VectorField_fwd.hpp
mm::VectorField
Represents a discretization of a vector field, a finite collection of vectors.
Definition: VectorField_fwd.hpp:38
mm::VectorField::operator=
VectorField & operator=(const VectorField &)=default
Default copy assignment.