Loading...
Searching...
No Matches
ScalarField.hpp
Go to the documentation of this file.
1// This code is based on Jet framework.
2// Copyright (c) 2018 Doyub Kim
3// CubbyFlow is voxel-based fluid simulation engine for computer games.
4// Copyright (c) 2020 CubbyFlow Team
5// Core Part: Chris Ohk, Junwoo Hwang, Jihong Sin, Seungwoo Yoo
6// AI Part: Dongheon Cho, Minseo Kim
7// We are making my contributions/submissions to this project solely in our
8// personal capacity and are not conveying any rights to any intellectual
9// property of any third parties.
10
11#ifndef CUBBYFLOW_SCALAR_FIELD_HPP
12#define CUBBYFLOW_SCALAR_FIELD_HPP
13
14#include <Core/Field/Field.hpp>
16
17#include <functional>
18#include <memory>
19
20namespace CubbyFlow
21{
23template <size_t N>
24class ScalarField : public Field<N>
25{
26 public:
28 ScalarField() = default;
29
31 ~ScalarField() override = default;
32
34 ScalarField(const ScalarField&) = default;
35
37 ScalarField(ScalarField&&) noexcept = default;
38
40 ScalarField& operator=(const ScalarField&) = default;
41
43 ScalarField& operator=(ScalarField&&) noexcept = default;
44
46 [[nodiscard]] virtual double Sample(const Vector<double, N>& x) const = 0;
47
49 [[nodiscard]] virtual Vector<double, N> Gradient(
50 const Vector<double, N>& x) const;
51
53 [[nodiscard]] virtual double Laplacian(const Vector<double, N>& x) const;
54
56 [[nodiscard]] virtual std::function<double(const Vector<double, N>&)>
57 Sampler() const;
58};
59
62
65
67using ScalarField2Ptr = std::shared_ptr<ScalarField2>;
68
70using ScalarField3Ptr = std::shared_ptr<ScalarField3>;
71} // namespace CubbyFlow
72
73#endif
Abstract base class for N-D fields.
Definition Field.hpp:21
Definition Matrix.hpp:30
Abstract base class for N-D scalar field.
Definition ScalarField.hpp:25
virtual double Laplacian(const Vector< double, N > &x) const
Returns Laplacian at given position x.
ScalarField(ScalarField &&) noexcept=default
Default move constructor.
ScalarField()=default
Default constructor.
~ScalarField() override=default
Default destructor.
virtual std::function< double(const Vector< double, N > &)> Sampler() const
Returns sampler function object.
virtual double Sample(const Vector< double, N > &x) const =0
Returns sampled value at given position x.
ScalarField(const ScalarField &)=default
Default copy constructor.
virtual Vector< double, N > Gradient(const Vector< double, N > &x) const
Returns gradient vector at given position x.
Definition pybind11Utils.hpp:21
std::shared_ptr< ScalarField2 > ScalarField2Ptr
Shared pointer for the ScalarField2 type.
Definition ScalarField.hpp:67
std::shared_ptr< ScalarField3 > ScalarField3Ptr
Shared pointer for the ScalarField3 type.
Definition ScalarField.hpp:70