aboutsummaryrefslogtreecommitdiff
path: root/src/fluid_buffer.h
blob: 72518bb3ffe721ceb23f85fcd66470863a327a99 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#pragma once

#include <memory>
#include <string>

#include "vector.h"

using Velocity = Vector<double>;
using Density  = double;

class FluidBuffer {
private:
	const std::size_t dim_x_;
	const std::size_t dim_y_;

	std::unique_ptr<Density[]> density_;
	std::unique_ptr<Velocity[]> velocity_;

public:
	FluidBuffer(std::size_t dimX, std::size_t dimY);

	std::size_t dimX() const;
	std::size_t dimY() const;

	Density& density(std::size_t x, std::size_t y);
	Density& density(Vector<std::size_t> pos);

	Velocity& velocity(std::size_t x, std::size_t y);
	Velocity& velocity(Vector<std::size_t> pos);

	void writeAsVTK(const std::string& path);
};