VAPOR3 3.9.4
Field.h
Go to the documentation of this file.
1/*
2 * The base class of all possible fields for flow integration.
3 */
4
5#ifndef FIELD_H
6#define FIELD_H
7
8#include <string>
9#include <array>
10#include <glm/glm.hpp>
11#include <vapor/common.h>
12
13namespace flow {
15public:
16 // Constructor and destructor.
17 // This class complies with rule of zero.
18 Field() = default;
19 virtual ~Field() = default;
20
21 //
22 // If a given position at a given time is inside of this field
23 //
24 virtual bool InsideVolumeVelocity(double time, glm::vec3 pos) const = 0;
25 virtual bool InsideVolumeScalar(double time, glm::vec3 pos) const = 0;
26
27 //
28 // Retrieve the number of time steps in this field
29 //
30 virtual uint32_t GetNumberOfTimesteps() const = 0;
31
32 //
33 // Get the field value at a certain position, at a certain time.
34 //
35 virtual int GetScalar(double time, glm::vec3 pos, // input
36 float &val) const = 0; // output
37
38 //
39 // Get the velocity value at a certain position, at a certain time.
40 //
41 virtual int GetVelocity(double time, glm::vec3 pos, // input
42 glm::vec3 &vel) const = 0; // output
43
44 //
45 // Returns the number of empty velocity variable names.
46 // It is 3 when the object is newly created, or is used to represent a scalar field
47 //
49
50 //
51 // Provide an option to cache and lock certain parameters.
52 // Both functions return 0 on success.
53 //
54 virtual auto LockParams() -> int = 0;
55 virtual auto UnlockParams() -> int = 0;
56
57 // Class members
58 bool IsSteady = false;
59 std::string ScalarName = "";
60 std::array<std::string, 3> VelocityNames = {{"", "", ""}};
61};
62}; // namespace flow
63
64#endif
virtual auto LockParams() -> int=0
virtual bool InsideVolumeScalar(double time, glm::vec3 pos) const =0
virtual int GetVelocity(double time, glm::vec3 pos, glm::vec3 &vel) const =0
Field()=default
virtual auto UnlockParams() -> int=0
virtual int GetScalar(double time, glm::vec3 pos, float &val) const =0
virtual uint32_t GetNumberOfTimesteps() const =0
int GetNumOfEmptyVelocityNames() const
virtual ~Field()=default
virtual bool InsideVolumeVelocity(double time, glm::vec3 pos) const =0
#define FLOW_API
Definition: common.h:75
Definition: Advection.h:15