Commit: 02bb2aa8c528638680c10a73e05bcdf016b91528
Author: Sebastián Barschkis
Date:   Fri Mar 3 17:33:26 2017 +0200
Branches: fluid-mantaflow
https://developer.blender.org/rB02bb2aa8c528638680c10a73e05bcdf016b91528

added multigrid preconditioner setup

dynamic and static obstacles are recognized and preconditioner is set 
accordingly

===================================================================

M       intern/mantaflow/intern/FLUID.cpp
M       intern/mantaflow/intern/strings/smoke_script.h
M       source/blender/blenkernel/intern/smoke.c
M       source/blender/makesdna/DNA_smoke_types.h

===================================================================

diff --git a/intern/mantaflow/intern/FLUID.cpp 
b/intern/mantaflow/intern/FLUID.cpp
index 9738d899e3..47cb44e0f0 100644
--- a/intern/mantaflow/intern/FLUID.cpp
+++ b/intern/mantaflow/intern/FLUID.cpp
@@ -602,6 +602,11 @@ std::string FLUID::getRealValue(const std::string& 
varName,  SmokeModifierData *
                char parent_dir[1024];
                BLI_split_dir_part(smd->domain->manta_filepath, parent_dir, 
sizeof(parent_dir));
                ss << parent_dir;
+       } else if (varName == "PRECONDITIONER") {
+               if (smd->domain->preconditioner == MOD_SMOKE_PC_NONE) ss << 
"PcNone";
+               else if (smd->domain->preconditioner == MOD_SMOKE_PC_MIC) ss << 
"PcMIC";
+               else if (smd->domain->preconditioner == 
MOD_SMOKE_PC_MG_DYNAMIC) ss << "PcMGDynamic";
+               else if (smd->domain->preconditioner == MOD_SMOKE_PC_MG_STATIC) 
ss << "PcMGStatic";
        } else
                std::cout << "ERROR: Unknown option:" << varName << std::endl;
        return ss.str();
diff --git a/intern/mantaflow/intern/strings/smoke_script.h 
b/intern/mantaflow/intern/strings/smoke_script.h
index 9909122306..102c78a8c8 100644
--- a/intern/mantaflow/intern/strings/smoke_script.h
+++ b/intern/mantaflow/intern/strings/smoke_script.h
@@ -327,7 +327,7 @@ def step_low():\n\
     setWallBcs(flags=flags, vel=vel)\n\
     \n\
     mantaMsg('Pressure')\n\
-    solvePressure(flags=flags, vel=vel, pressure=pressure)\n\
+    solvePressure(flags=flags, vel=vel, pressure=pressure, 
preconditioner=$PRECONDITIONER$)\n\
 \n\
 def process_burn_low():\n\
     mantaMsg('Process burn low')\n\
diff --git a/source/blender/blenkernel/intern/smoke.c 
b/source/blender/blenkernel/intern/smoke.c
index b2aa2c7e81..ee93b3f339 100644
--- a/source/blender/blenkernel/intern/smoke.c
+++ b/source/blender/blenkernel/intern/smoke.c
@@ -585,6 +585,7 @@ void smokeModifier_createType(struct SmokeModifierData *smd)
                        smd->domain->viewport_display_mode = 
SM_VIEWPORT_PREVIEW;
                        smd->domain->render_display_mode = SM_VIEWPORT_FINAL;
                        smd->domain->type = MOD_SMOKE_DOMAIN_TYPE_GAS;
+                       smd->domain->preconditioner = MOD_SMOKE_PC_MG_STATIC;
                        
 #ifdef WITH_MANTA
                        smd->domain->gravity[0] = 0.0f;
@@ -717,6 +718,11 @@ void smokeModifier_copy(struct SmokeModifierData *smd, 
struct SmokeModifierData
                tsmd->domain->manta_solver_res = smd->domain->manta_solver_res;
                tsmd->domain->noise_pos_scale = smd->domain->noise_pos_scale;
                tsmd->domain->noise_time_anim = smd->domain->noise_time_anim;
+               
+               tsmd->domain->viewport_display_mode = 
smd->domain->viewport_display_mode;
+               tsmd->domain->render_display_mode = 
smd->domain->render_display_mode;
+               tsmd->domain->type = smd->domain->type;
+               tsmd->domain->preconditioner = smd->domain->preconditioner;
 #endif
 
                copy_v3_v3(tsmd->domain->flame_smoke_color, 
smd->domain->flame_smoke_color);
@@ -909,6 +915,9 @@ static void obstacles_from_derivedmesh(
                                has_velocity = true;
                        }
                }
+               
+               /* Manta CG precoditioner */
+               sds->preconditioner = (has_velocity) ? MOD_SMOKE_PC_MG_DYNAMIC 
: MOD_SMOKE_PC_MG_STATIC;
 
                /*      Transform collider vertices to
                 *   domain grid space for fast lookups */
diff --git a/source/blender/makesdna/DNA_smoke_types.h 
b/source/blender/makesdna/DNA_smoke_types.h
index b4407d1a62..39486dcc8e 100644
--- a/source/blender/makesdna/DNA_smoke_types.h
+++ b/source/blender/makesdna/DNA_smoke_types.h
@@ -233,7 +233,7 @@ typedef struct SmokeDomainSettings {
        int manta_solver_res;   /* dimension of manta solver, 2d or 3d */
        char manta_filepath[1024];
        short type; /* gas, liquid */
-       short mock_var; /* unused */
+       short preconditioner; /* cg preconditioner */
 } SmokeDomainSettings;
 
 /* type */
@@ -242,6 +242,12 @@ typedef struct SmokeDomainSettings {
 #define MOD_SMOKE_FLOW_TYPE_SMOKEFIRE 2
 #define MOD_SMOKE_FLOW_TYPE_LIQUID 3
 
+/* preconditioner */
+#define MOD_SMOKE_PC_NONE 0
+#define MOD_SMOKE_PC_MIC 1
+#define MOD_SMOKE_PC_MG_DYNAMIC 2
+#define MOD_SMOKE_PC_MG_STATIC 3
+
 /* behavior */
 #define MOD_SMOKE_FLOW_BEHAVIOR_INFLOW 0
 #define MOD_SMOKE_FLOW_BEHAVIOR_OUTFLOW 1

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to