summaryrefslogtreecommitdiff
path: root/src/simulation/Air.cpp
diff options
context:
space:
mode:
authorSimon Robertshaw <simon@hardwired.org.uk>2012-08-16 11:15:29 (GMT)
committer Simon Robertshaw <simon@hardwired.org.uk>2012-08-16 11:15:29 (GMT)
commitf19c7f62c77f6a3e8f5728e015166b0c625f5f67 (patch)
treedc4c5067c6a4d6b7108e33da0cc3a18549eb2066 /src/simulation/Air.cpp
parentca30e9f091376e81b61a0f72bc444a4f59fc4ae7 (diff)
downloadpowder-f19c7f62c77f6a3e8f5728e015166b0c625f5f67.zip
powder-f19c7f62c77f6a3e8f5728e015166b0c625f5f67.tar.gz
Air invert and grid mode switching
Diffstat (limited to 'src/simulation/Air.cpp')
-rw-r--r--src/simulation/Air.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/simulation/Air.cpp b/src/simulation/Air.cpp
index 6d7b5dd..2dfcae0 100644
--- a/src/simulation/Air.cpp
+++ b/src/simulation/Air.cpp
@@ -1,4 +1,5 @@
#include <cmath>
+#include <algorithm>
#include "Config.h"
#include "Air.h"
//#include <powder.h>
@@ -295,6 +296,19 @@ void Air::update_air(void)
memcpy(pv, opv, sizeof(pv));
}
}
+
+void Air::Invert()
+{
+ int nx, ny;
+ for (nx = 0; nx<XRES/CELL; nx++)
+ for (ny = 0; ny<YRES/CELL; ny++)
+ {
+ pv[ny][nx] = -pv[ny][nx];
+ vx[ny][nx] = -vx[ny][nx];
+ vy[ny][nx] = -vy[ny][nx];
+ }
+}
+
Air::Air():
airMode(0)
{