forked from bartvdbraak/blender
Add a gui control for setting omp threads in fluids
This commit is contained in:
parent
ac224a64f4
commit
cbe9ae244e
2
intern/elbeem/extern/elbeem.h
vendored
2
intern/elbeem/extern/elbeem.h
vendored
@ -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;
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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()
|
||||
|
@ -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);
|
||||
|
@ -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? */
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user