34 std::vector<Scalar> weights;
35 std::vector<Index> indices;
39 Interpolator(std::vector<Scalar> &weights, std::vector<Index> &indices)
40 : weights(std::move(weights)), indices(std::move(indices))
50 for (
size_t i = 0; i < weights.size(); ++i)
51 ret += field[indices[i]] * weights[i];
58 for (
size_t i = 0; i < weights.size(); ++i) {
59 const Index ind(indices[i]);
60 const Scalar w(weights[i]);
61 ret +=
Vector3(f0[ind], f1[ind], f2[ind]) * w;
76 InterpolationMode mode = Linear)
const = 0;
78 InterpolationMode mode = Linear)
const
80 const Index elem = findCell(point);
84 return getInterpolator(elem, point, mapping, mode);
Definition: geometry.h:23
return at least those elements sharing faces with elem, but might also contain those just sharing ver...
Definition: grid.h:33
Scalar operator()(const Scalar *field) const
Definition: grid.h:47
Vector3 operator()(const Scalar *f0, const Scalar *f1, const Scalar *f2) const
Definition: grid.h:55
Interpolator(std::vector< Scalar > &weights, std::vector< Index > &indices)
Definition: grid.h:39
Interpolator()
Definition: grid.h:38
Interpolator getInterpolator(const Vector &point, DataBase::Mapping mapping=DataBase::Vertex, InterpolationMode mode=Linear) const
Definition: grid.h:77
virtual Index findCell(const Vector &point, Index hint=InvalidIndex, int flags=NoFlags) const =0
virtual Scalar exitDistance(Index elem, const Vector &point, const Vector &dir) const =0
virtual bool isGhostCell(Index elem) const =0
FindCellFlags
Definition: grid.h:16
virtual bool inside(Index elem, const Vector &point) const =0
virtual Vector cellCenter(Index elem) const =0
DEFINE_ENUM_WITH_STRING_CONVERSIONS(InterpolationMode,(First)(Mean)(Nearest)(Linear))
virtual Interpolator getInterpolator(Index elem, const Vector &point, DataBase::Mapping mapping=DataBase::Vertex, InterpolationMode mode=Linear) const =0
virtual std::pair< Vector, Vector > cellBounds(Index elem) const =0
virtual std::vector< Index > getNeighborElements(Index elem) const =0
virtual Scalar cellDiameter(Index elem) const =0
#define V_COREEXPORT
Definition: export.h:9
Definition: allobjects.cpp:30
Eigen::Matrix< Scalar, 3, 1 > Vector3
Definition: vector.h:33
Vector3 Vector
Definition: vector.h:36
const Index InvalidIndex
Definition: index.h:17
float Scalar
Definition: scalar.h:14
uint32_t Index
Definition: index.h:13