Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Verwiebe <info@jensverwiebe.de>2013-04-10 22:35:18 +0400
committerJens Verwiebe <info@jensverwiebe.de>2013-04-10 22:35:18 +0400
commitcbe9ae244e5af8b89e28a6fe03405bcb368ba83b (patch)
tree383220a82cfeea4845f96f298e34b98939014bf2
parentac224a64f408fcc8f90f7ea0124cbe4b9ef1e811 (diff)
Add a gui control for setting omp threads in fluids
-rw-r--r--intern/elbeem/extern/elbeem.h2
-rw-r--r--intern/elbeem/intern/simulation_object.cpp5
-rw-r--r--release/scripts/startup/bl_ui/properties_physics_fluid.py1
-rw-r--r--source/blender/editors/physics/physics_fluid.c2
-rw-r--r--source/blender/makesdna/DNA_object_fluidsim.h5
-rw-r--r--source/blender/makesrna/intern/rna_fluidsim.c5
-rw-r--r--source/blender/modifiers/intern/MOD_fluidsim_util.c1
7 files changed, 19 insertions, 2 deletions
diff --git a/intern/elbeem/extern/elbeem.h b/intern/elbeem/extern/elbeem.h
index 6df08ccebd2..bd50b6f08dc 100644
--- a/intern/elbeem/extern/elbeem.h
+++ b/intern/elbeem/extern/elbeem.h
@@ -99,6 +99,8 @@ typedef struct elbeemSimulationSettings {
elbeemRunSimulationCallback runsimCallback;
/* pointer passed to runsimCallback for user data storage */
void* runsimUserData;
+ /* simulation threads used by omp */
+ int threads;
} elbeemSimulationSettings;
diff --git a/intern/elbeem/intern/simulation_object.cpp b/intern/elbeem/intern/simulation_object.cpp
index 87828b26088..79b1a2ce635 100644
--- a/intern/elbeem/intern/simulation_object.cpp
+++ b/intern/elbeem/intern/simulation_object.cpp
@@ -19,6 +19,10 @@
#include "particletracer.h"
#include "elbeem.h"
+#if PARALLEL==1
+#include <omp.h>
+#endif
+
#ifdef _WIN32
#else
#include <sys/time.h>
@@ -173,6 +177,7 @@ int SimulationObject::initializeLbmSimulation(ntlRenderGlobals *glob)
mpLbm->initDomainTrafo( mpElbeemSettings->surfaceTrafo );
mpLbm->setSmoothing(1.0 * mpElbeemSettings->surfaceSmoothing, 1.0 * mpElbeemSettings->surfaceSmoothing);
mpLbm->setIsoSubdivs(mpElbeemSettings->surfaceSubdivs);
+ omp_set_num_threads(mpElbeemSettings->threads);
mpLbm->setSizeX(mpElbeemSettings->resolutionxyz);
mpLbm->setSizeY(mpElbeemSettings->resolutionxyz);
mpLbm->setSizeZ(mpElbeemSettings->resolutionxyz);
diff --git a/release/scripts/startup/bl_ui/properties_physics_fluid.py b/release/scripts/startup/bl_ui/properties_physics_fluid.py
index b3cd5dc5464..78bb21e76a5 100644
--- a/release/scripts/startup/bl_ui/properties_physics_fluid.py
+++ b/release/scripts/startup/bl_ui/properties_physics_fluid.py
@@ -67,6 +67,7 @@ class PHYSICS_PT_fluid(PhysicButtonsPanel, Panel):
# odd formatting here so translation script can extract string
layout.operator("fluid.bake", text=iface_("Bake (Req. Memory: %s)") % fluid.memory_estimate,
translate=False, icon='MOD_FLUIDSIM')
+ layout.prop(fluid, "threads", text="Simulation Threads")
split = layout.split()
col = split.column()
diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c
index 9197b9e99da..1de2f14dbc0 100644
--- a/source/blender/editors/physics/physics_fluid.c
+++ b/source/blender/editors/physics/physics_fluid.c
@@ -994,7 +994,7 @@ static int fluidsimBake(bContext *C, ReportList *reports, Object *fsDomain, shor
/* ******** export domain to elbeem ******** */
elbeemResetSettings(fsset);
fsset->version = 1;
-
+ fsset->threads = domainSettings->threads;
// setup global settings
copy_v3_v3(fsset->geoStart, domainSettings->bbStart);
copy_v3_v3(fsset->geoSize, domainSettings->bbSize);
diff --git a/source/blender/makesdna/DNA_object_fluidsim.h b/source/blender/makesdna/DNA_object_fluidsim.h
index dc4e4f54fd7..aaebdf579f8 100644
--- a/source/blender/makesdna/DNA_object_fluidsim.h
+++ b/source/blender/makesdna/DNA_object_fluidsim.h
@@ -48,6 +48,9 @@ typedef struct FluidVertexVelocity {
typedef struct FluidsimSettings {
struct FluidsimModifierData *fmd; /* for fast RNA access */
+ /* threadcont the calculation is done with */
+ int threads;
+ int pad1;
/* domain, fluid or obstacle */
short type;
/* display advanced options in fluid sim tab (on=1, off=0)*/
@@ -75,7 +78,7 @@ typedef struct FluidsimSettings {
int bakeStart, bakeEnd;
/* offset for baked frames */
int frameOffset;
- int pad;
+ int pad2;
/* g star param (LBM compressibility) */
float gstar;
/* activate refinement? */
diff --git a/source/blender/makesrna/intern/rna_fluidsim.c b/source/blender/makesrna/intern/rna_fluidsim.c
index 9ff83daa2f8..d6ca900397a 100644
--- a/source/blender/makesrna/intern/rna_fluidsim.c
+++ b/source/blender/makesrna/intern/rna_fluidsim.c
@@ -280,6 +280,11 @@ static void rna_def_fluidsim_domain(BlenderRNA *brna)
/* standard settings */
+ prop = RNA_def_property(srna, "threads", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "threads");
+ RNA_def_property_range(prop, 1, 32);
+ RNA_def_property_ui_text(prop, "Simulation Threads", "Threads used to calculate the simulation");
+
prop = RNA_def_property(srna, "resolution", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "resolutionxyz");
RNA_def_property_range(prop, 1, 1024);
diff --git a/source/blender/modifiers/intern/MOD_fluidsim_util.c b/source/blender/modifiers/intern/MOD_fluidsim_util.c
index b39ddf62c55..6afe121be90 100644
--- a/source/blender/modifiers/intern/MOD_fluidsim_util.c
+++ b/source/blender/modifiers/intern/MOD_fluidsim_util.c
@@ -75,6 +75,7 @@ void fluidsim_init(FluidsimModifierData *fluidmd)
fss->fmd = fluidmd;
fss->type = OB_FLUIDSIM_ENABLE;
+ fss->threads = 4;
fss->show_advancedoptions = 0;
fss->resolutionxyz = 65;