11template <
typename T,
unsigned D>
70static inline void wxbgi_openlb_begin_session(
int width,
int height,
const char* title)
87static inline void wxbgi_openlb_begin_canvas_session(
int width,
int height)
107static inline int wxbgi_openlb_pump(
void)
134static inline int wxbgi_openlb_present(
void)
137 return wxbgi_openlb_pump();
186 int defaultFluidMaterial,
187 int defaultSolidMaterial,
239 float stepX,
float stepY,
240 int defaultFluidMaterial,
241 int defaultSolidMaterial,
263struct WxbgiOpenLbMaterializeStats
350template <
typename T,
typename Mapper>
351inline WxbgiOpenLbMaterializeStats wxbgi_openlb_materialize_super_geometry_2d(
352 olb::SuperGeometry<T, 2> &superGeometry,
354 Mapper &&mapMaterial,
355 int defaultFluidMaterial = 1,
356 int defaultSolidMaterial = 2,
357 bool overwriteUnmatched =
false)
359 WxbgiOpenLbMaterializeStats stats;
361 superGeometry.forCoreSpatialLocations([&](
auto latticeR) {
364 const auto physR = superGeometry.getPhysR(latticeR);
368 static_cast<float>(physR[0]),
369 static_cast<float>(physR[1]),
370 static_cast<float>(z),
371 defaultFluidMaterial,
372 defaultSolidMaterial,
377 else if (!overwriteUnmatched)
380 auto &blockGeometry = superGeometry.getBlockGeometry(latticeR[0]);
381 const int localR[2] = {latticeR[1], latticeR[2]};
382 const int currentMaterial = blockGeometry.get(localR);
383 const int nextMaterial = mapMaterial(physR, currentMaterial, bridgeMaterial, matched != 0);
384 if (nextMaterial == currentMaterial)
387 blockGeometry.set(localR, nextMaterial);
391 superGeometry.communicate();
392 superGeometry.getStatisticsStatus() =
true;
393 superGeometry.updateStatistics(
false);
426inline WxbgiOpenLbMaterializeStats wxbgi_openlb_materialize_super_geometry_2d(
427 olb::SuperGeometry<T, 2> &superGeometry,
429 int defaultFluidMaterial = 1,
430 int defaultSolidMaterial = 2,
431 bool overwriteUnmatched =
false)
433 return wxbgi_openlb_materialize_super_geometry_2d(
436 [defaultFluidMaterial](
const auto &,
int,
int bridgeMaterial,
bool matched) {
437 return matched ? bridgeMaterial : defaultFluidMaterial;
439 defaultFluidMaterial,
440 defaultSolidMaterial,
487template <
typename T,
typename Mapper>
488inline WxbgiOpenLbMaterializeStats wxbgi_openlb_materialize_super_geometry_3d(
489 olb::SuperGeometry<T, 3> &superGeometry,
490 Mapper &&mapMaterial,
491 int defaultFluidMaterial = 1,
492 int defaultSolidMaterial = 2,
493 bool overwriteUnmatched =
false)
495 WxbgiOpenLbMaterializeStats stats;
497 superGeometry.forCoreSpatialLocations([&](
auto latticeR) {
500 const auto physR = superGeometry.getPhysR(latticeR);
504 static_cast<float>(physR[0]),
505 static_cast<float>(physR[1]),
506 static_cast<float>(physR[2]),
507 defaultFluidMaterial,
508 defaultSolidMaterial,
513 else if (!overwriteUnmatched)
516 auto &blockGeometry = superGeometry.getBlockGeometry(latticeR[0]);
517 const int localR[3] = {latticeR[1], latticeR[2], latticeR[3]};
518 const int currentMaterial = blockGeometry.get(localR);
519 const int nextMaterial = mapMaterial(physR, currentMaterial, bridgeMaterial, matched != 0);
520 if (nextMaterial == currentMaterial)
523 blockGeometry.set(localR, nextMaterial);
527 superGeometry.communicate();
528 superGeometry.getStatisticsStatus() =
true;
529 superGeometry.updateStatistics(
false);
558inline WxbgiOpenLbMaterializeStats wxbgi_openlb_materialize_super_geometry_3d(
559 olb::SuperGeometry<T, 3> &superGeometry,
560 int defaultFluidMaterial = 1,
561 int defaultSolidMaterial = 2,
562 bool overwriteUnmatched =
false)
564 return wxbgi_openlb_materialize_super_geometry_3d(
566 [defaultFluidMaterial](
const auto &,
int,
int bridgeMaterial,
bool matched) {
567 return matched ? bridgeMaterial : defaultFluidMaterial;
569 defaultFluidMaterial,
570 defaultSolidMaterial,
#define BGI_CALL
Definition bgi_types.h:20
#define BGI_API
Definition bgi_types.h:14
BGI_API int BGI_CALL wxbgi_poll_events(void)
Pumps pending OS/window events.
BGI_API int BGI_CALL wxbgi_should_close(void)
Reports whether the window received a close request.
BGI_API void BGI_CALL wxbgi_wx_refresh(void)
Request an immediate canvas repaint.
BGI_API void BGI_CALL wxbgi_wx_app_create(void)
Create the wx application instance.
BGI_API void BGI_CALL wxbgi_wx_set_frame_rate(int fps)
Set the auto-refresh rate in frames per second (default 0 = no auto-refresh).
BGI_API void BGI_CALL wxbgi_wx_frame_create(int width, int height, const char *title)
Create a top-level wxFrame with an embedded WxBgiCanvas.
BGI_API void BGI_CALL wxbgi_wx_init_for_canvas(int width, int height)
Initialise BGI state for wxWidgets-embedded mode (no GLFW).
Public classic BGI-compatible C API exported by the library.
Advanced non-BGI extension API for modern OpenGL workflows.
BGI_API int BGI_CALL wxbgi_openlb_classify_point_material(float x, float y, float z, int defaultFluidMaterial, int defaultSolidMaterial, int *outMatched)
Classify a single physical-space point against the active DDS scene and return the associated OpenLB ...
BGI_API int BGI_CALL wxbgi_openlb_sample_materials_2d(float minX, float minY, float z, int cols, int rows, float stepX, float stepY, int defaultFluidMaterial, int defaultSolidMaterial, int *outMaterials, int materialCount)
Sample a 2-D axis-aligned grid of physical points against the active DDS scene and write per-cell mat...