HighMap library (C++)
Loading...
Searching...
No Matches
advection_particle.hpp
Go to the documentation of this file.
1/* Copyright (c) 2023 Otto Link. Distributed under the terms of the GNU General
2 Public License. The full license is in the file LICENSE, distributed with
3 this software. */
4
11#pragma once
12
13#include <vector>
14
15#include "highmap/array.hpp"
16
17namespace hmap
18{
19class Texture;
20}
21
22namespace hmap::gpu
23{
24
68Array advection_particle(const Array &z,
69 const Array &advected_field,
70 int iterations,
71 int nparticles,
72 std::uint32_t seed,
73 bool reverse = false,
74 bool post_filter = true,
75 float post_filter_sigma = 0.125f,
76 float advection_length = 0.1f,
77 float value_persistence = 0.99f,
78 float inertia = 0.f,
79 const Array *p_advection_mask = nullptr,
80 const Array *p_mask = nullptr);
81
83std::vector<Array> advection_particle(
84 const Array &z,
85 const std::vector<const Array *> &advected_fields,
86 int iterations,
87 int nparticles,
88 std::uint32_t seed,
89 bool reverse = false,
90 bool post_filter = true,
91 float post_filter_sigma = 0.125f,
92 float advection_length = 0.1f,
93 float value_persistence = 0.99f,
94 float inertia = 0.f,
95 const Array *p_advection_mask = nullptr,
96 const Array *p_mask = nullptr);
97
99std::vector<Array> advection_particle(const Array &z,
100 const std::vector<Array> &advected_fields,
101 int iterations,
102 int nparticles,
103 std::uint32_t seed,
104 bool reverse = false,
105 bool post_filter = true,
106 float post_filter_sigma = 0.125f,
107 float advection_length = 0.1f,
108 float value_persistence = 0.99f,
109 float inertia = 0.f,
110 const Array *p_advection_mask = nullptr,
111 const Array *p_mask = nullptr);
112
114Array advection_particle(const Array &z,
115 const Array &advected_field,
116 int nparticles,
117 std::uint32_t seed,
118 bool reverse = false,
119 bool post_filter = true,
120 float post_filter_sigma = 0.125f,
121 float advection_length = 0.1f,
122 float value_persistence = 0.99f,
123 float inertia = 0.f,
124 const Array *p_advection_mask = nullptr,
125 const Array *p_mask = nullptr);
126
128std::vector<Array> advection_particle(
129 const Array &z,
130 const std::vector<const Array *> &advected_fields,
131 int nparticles,
132 std::uint32_t seed,
133 bool reverse = false,
134 bool post_filter = true,
135 float post_filter_sigma = 0.125f,
136 float advection_length = 0.1f,
137 float value_persistence = 0.99f,
138 float inertia = 0.f,
139 const Array *p_advection_mask = nullptr,
140 const Array *p_mask = nullptr);
141
143std::vector<Array> advection_particle(const Array &z,
144 const std::vector<Array> &advected_fields,
145 int nparticles,
146 std::uint32_t seed,
147 bool reverse = false,
148 bool post_filter = true,
149 float post_filter_sigma = 0.125f,
150 float advection_length = 0.1f,
151 float value_persistence = 0.99f,
152 float inertia = 0.f,
153 const Array *p_advection_mask = nullptr,
154 const Array *p_mask = nullptr);
155
157Array advection_particle(const Array &dx,
158 const Array &dy,
159 const Array &advected_field,
160 int nparticles,
161 std::uint32_t seed,
162 bool reverse = false,
163 bool post_filter = true,
164 float post_filter_sigma = 0.125f,
165 float advection_length = 0.1f,
166 float value_persistence = 0.99f,
167 float inertia = 0.f,
168 const Array *p_advection_mask = nullptr,
169 const Array *p_mask = nullptr);
170
172std::vector<Array> advection_particle(
173 const Array &dx,
174 const Array &dy,
175 const std::vector<const Array *> &advected_fields,
176 int nparticles,
177 std::uint32_t seed,
178 bool reverse = false,
179 bool post_filter = true,
180 float post_filter_sigma = 0.125f,
181 float advection_length = 0.1f,
182 float value_persistence = 0.99f,
183 float inertia = 0.f,
184 const Array *p_advection_mask = nullptr,
185 const Array *p_mask = nullptr);
186
188std::vector<Array> advection_particle(const Array &dx,
189 const Array &dy,
190 const std::vector<Array> &advected_fields,
191 int nparticles,
192 std::uint32_t seed,
193 bool reverse = false,
194 bool post_filter = true,
195 float post_filter_sigma = 0.125f,
196 float advection_length = 0.1f,
197 float value_persistence = 0.99f,
198 float inertia = 0.f,
199 const Array *p_advection_mask = nullptr,
200 const Array *p_mask = nullptr);
201
203Texture advection_particle(const Array &z,
204 const Texture &texture,
205 int iterations,
206 int nparticles,
207 std::uint32_t seed,
208 bool reverse = false,
209 bool post_filter = true,
210 float post_filter_sigma = 0.125f,
211 float advection_length = 0.1f,
212 float value_persistence = 0.99f,
213 float inertia = 0.f,
214 const Array *p_advection_mask = nullptr,
215 const Array *p_mask = nullptr);
216
218Texture advection_particle(const Array &z,
219 const Texture &texture,
220 int nparticles,
221 std::uint32_t seed,
222 bool reverse = false,
223 bool post_filter = true,
224 float post_filter_sigma = 0.125f,
225 float advection_length = 0.1f,
226 float value_persistence = 0.99f,
227 float inertia = 0.f,
228 const Array *p_advection_mask = nullptr,
229 const Array *p_mask = nullptr);
230
259 const Array &z,
260 const Array &advected_field,
261 std::uint32_t seed,
262 const std::vector<int> &steps_per_level = {4, 2, 1},
263 float particles_ratio = 0.5f,
264 float advection_length = 0.1f,
265 float value_persistence = 0.99f,
266 float inertia = 0.f,
267 float mix = 1.f,
268 float warp = 0.f,
269 bool reverse = false,
270 bool post_filter = true,
271 float post_filter_sigma = 0.125f,
272 const Array *p_advection_mask = nullptr,
273 const Array *p_mask = nullptr);
274
276std::vector<Array> advection_particle_multiscale(
277 const Array &z,
278 const std::vector<const Array *> &advected_fields,
279 std::uint32_t seed,
280 const std::vector<int> &steps_per_level = {4, 2, 1},
281 float particles_ratio = 0.5f,
282 float advection_length = 0.1f,
283 float value_persistence = 0.99f,
284 float inertia = 0.f,
285 float mix = 1.f,
286 float warp = 0.f,
287 bool reverse = false,
288 bool post_filter = true,
289 float post_filter_sigma = 0.125f,
290 const Array *p_advection_mask = nullptr,
291 const Array *p_mask = nullptr);
292
294std::vector<Array> advection_particle_multiscale(
295 const Array &z,
296 const std::vector<Array> &advected_fields,
297 std::uint32_t seed,
298 const std::vector<int> &steps_per_level = {4, 2, 1},
299 float particles_ratio = 0.5f,
300 float advection_length = 0.1f,
301 float value_persistence = 0.99f,
302 float inertia = 0.f,
303 float mix = 1.f,
304 float warp = 0.f,
305 bool reverse = false,
306 bool post_filter = true,
307 float post_filter_sigma = 0.125f,
308 const Array *p_advection_mask = nullptr,
309 const Array *p_mask = nullptr);
310
313 const Array &z,
314 const Texture &texture,
315 std::uint32_t seed,
316 const std::vector<int> &steps_per_level = {4, 2, 1},
317 float particles_ratio = 0.5f,
318 float advection_length = 0.1f,
319 float value_persistence = 0.99f,
320 float inertia = 0.f,
321 float mix = 1.f,
322 float warp = 0.f,
323 bool reverse = false,
324 bool post_filter = true,
325 float post_filter_sigma = 0.125f,
326 const Array *p_advection_mask = nullptr,
327 const Array *p_mask = nullptr);
328
329} // namespace hmap::gpu
Declaration of the Array class for 2D floating-point arrays with various mathematical operations and ...
A class to represent a multi-channel texture using planar hmap::Array storage.
Definition texture.hpp:37
Definition array_blending.hpp:225
Array advection_particle(const Array &z, const Array &advected_field, int iterations, int nparticles, std::uint32_t seed, bool reverse=false, bool post_filter=true, float post_filter_sigma=0.125f, float advection_length=0.1f, float value_persistence=0.99f, float inertia=0.f, const Array *p_advection_mask=nullptr, const Array *p_mask=nullptr)
Performs particle-based advection on a scalar field.
Definition advection_particle_gpu.cpp:25
void warp(Array &array, const Array *p_dx, const Array *p_dy)
See hmap::warp.
Definition warp_gpu.cpp:16
Array advection_particle_multiscale(const Array &z, const Array &advected_field, std::uint32_t seed, const std::vector< int > &steps_per_level={4, 2, 1}, float particles_ratio=0.5f, float advection_length=0.1f, float value_persistence=0.99f, float inertia=0.f, float mix=1.f, float warp=0.f, bool reverse=false, bool post_filter=true, float post_filter_sigma=0.125f, const Array *p_advection_mask=nullptr, const Array *p_mask=nullptr)
Performs multiscale particle-based advection on a scalar field.
Definition advection_particle_gpu.cpp:498
Definition opencv.hpp:20
Texture mix(const Texture &tex1, const Texture &tex2, MixMethod method=MM_SQRT_AVG)
Mix two textures into an output texture.
Definition colorize.cpp:561