[Bf-blender-cvs] [70fe988dc49] master: Fluid: Cleanup use of std in MANTA wrapper

Sebastián Barschkis noreply at git.blender.org
Sun May 3 21:11:02 CEST 2020


Commit: 70fe988dc497ce4de6269aa28f579c528e2ac797
Author: Sebastián Barschkis
Date:   Sun May 3 21:10:38 2020 +0200
Branches: master
https://developer.blender.org/rB70fe988dc497ce4de6269aa28f579c528e2ac797

Fluid: Cleanup use of std in MANTA wrapper

Moved std namespace to beginning of class.

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

M	intern/mantaflow/intern/MANTA_main.cpp
M	intern/mantaflow/intern/MANTA_main.h

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

diff --git a/intern/mantaflow/intern/MANTA_main.cpp b/intern/mantaflow/intern/MANTA_main.cpp
index 995cce4a1ce..d59c7464934 100644
--- a/intern/mantaflow/intern/MANTA_main.cpp
+++ b/intern/mantaflow/intern/MANTA_main.cpp
@@ -48,7 +48,16 @@
 
 #include "MEM_guardedalloc.h"
 
-std::atomic<int> MANTA::solverID(0);
+using std::cerr;
+using std::cout;
+using std::endl;
+using std::ifstream;
+using std::istringstream;
+using std::ofstream;
+using std::ostringstream;
+using std::to_string;
+
+atomic<int> MANTA::solverID(0);
 int MANTA::with_debug(0);
 
 /* Number of particles that the cache reads at once (with zlib). */
@@ -61,8 +70,8 @@ int MANTA::with_debug(0);
 MANTA::MANTA(int *res, FluidModifierData *mmd) : mCurrentID(++solverID)
 {
   if (with_debug)
-    std::cout << "FLUID: " << mCurrentID << " with res(" << res[0] << ", " << res[1] << ", "
-              << res[2] << ")" << std::endl;
+    cout << "FLUID: " << mCurrentID << " with res(" << res[0] << ", " << res[1] << ", " << res[2]
+         << ")" << endl;
 
   FluidDomainSettings *mds = mmd->domain;
   mds->fluid = this;
@@ -274,32 +283,32 @@ MANTA::MANTA(int *res, FluidModifierData *mmd) : mCurrentID(++solverID)
 void MANTA::initDomain(FluidModifierData *mmd)
 {
   // Vector will hold all python commands that are to be executed
-  std::vector<std::string> pythonCommands;
+  vector<string> pythonCommands;
 
   // Set manta debug level first
   pythonCommands.push_back(manta_import + manta_debuglevel);
 
-  std::ostringstream ss;
+  ostringstream ss;
   ss << "set_manta_debuglevel(" << with_debug << ")";
   pythonCommands.push_back(ss.str());
 
   // Now init basic fluid domain
-  std::string tmpString = fluid_variables + fluid_solver + fluid_alloc + fluid_cache_helper +
-                          fluid_bake_multiprocessing + fluid_bake_data + fluid_bake_noise +
-                          fluid_bake_mesh + fluid_bake_particles + fluid_bake_guiding +
-                          fluid_file_import + fluid_file_export + fluid_save_data +
-                          fluid_load_data + fluid_pre_step + fluid_post_step +
-                          fluid_adapt_time_step + fluid_time_stepping;
-  std::string finalString = parseScript(tmpString, mmd);
+  string tmpString = fluid_variables + fluid_solver + fluid_alloc + fluid_cache_helper +
+                     fluid_bake_multiprocessing + fluid_bake_data + fluid_bake_noise +
+                     fluid_bake_mesh + fluid_bake_particles + fluid_bake_guiding +
+                     fluid_file_import + fluid_file_export + fluid_save_data + fluid_load_data +
+                     fluid_pre_step + fluid_post_step + fluid_adapt_time_step +
+                     fluid_time_stepping;
+  string finalString = parseScript(tmpString, mmd);
   pythonCommands.push_back(finalString);
   runPythonString(pythonCommands);
 }
 
 void MANTA::initNoise(FluidModifierData *mmd)
 {
-  std::vector<std::string> pythonCommands;
-  std::string tmpString = fluid_variables_noise + fluid_solver_noise;
-  std::string finalString = parseScript(tmpString, mmd);
+  vector<string> pythonCommands;
+  string tmpString = fluid_variables_noise + fluid_solver_noise;
+  string finalString = parseScript(tmpString, mmd);
   pythonCommands.push_back(finalString);
 
   runPythonString(pythonCommands);
@@ -307,10 +316,10 @@ void MANTA::initNoise(FluidModifierData *mmd)
 
 void MANTA::initSmoke(FluidModifierData *mmd)
 {
-  std::vector<std::string> pythonCommands;
-  std::string tmpString = smoke_variables + smoke_alloc + smoke_adaptive_step + smoke_save_data +
-                          smoke_load_data + smoke_step;
-  std::string finalString = parseScript(tmpString, mmd);
+  vector<string> pythonCommands;
+  string tmpString = smoke_variables + smoke_alloc + smoke_adaptive_step + smoke_save_data +
+                     smoke_load_data + smoke_step;
+  string finalString = parseScript(tmpString, mmd);
   pythonCommands.push_back(finalString);
 
   runPythonString(pythonCommands);
@@ -318,10 +327,10 @@ void MANTA::initSmoke(FluidModifierData *mmd)
 
 void MANTA::initSmokeNoise(FluidModifierData *mmd)
 {
-  std::vector<std::string> pythonCommands;
-  std::string tmpString = smoke_variables_noise + smoke_alloc_noise + smoke_wavelet_noise +
-                          smoke_save_noise + smoke_load_noise + smoke_step_noise;
-  std::string finalString = parseScript(tmpString, mmd);
+  vector<string> pythonCommands;
+  string tmpString = smoke_variables_noise + smoke_alloc_noise + smoke_wavelet_noise +
+                     smoke_save_noise + smoke_load_noise + smoke_step_noise;
+  string finalString = parseScript(tmpString, mmd);
   pythonCommands.push_back(finalString);
 
   runPythonString(pythonCommands);
@@ -331,9 +340,9 @@ void MANTA::initSmokeNoise(FluidModifierData *mmd)
 void MANTA::initHeat(FluidModifierData *mmd)
 {
   if (!mHeat) {
-    std::vector<std::string> pythonCommands;
-    std::string tmpString = smoke_alloc_heat + smoke_with_heat;
-    std::string finalString = parseScript(tmpString, mmd);
+    vector<string> pythonCommands;
+    string tmpString = smoke_alloc_heat + smoke_with_heat;
+    string finalString = parseScript(tmpString, mmd);
     pythonCommands.push_back(finalString);
 
     runPythonString(pythonCommands);
@@ -344,9 +353,9 @@ void MANTA::initHeat(FluidModifierData *mmd)
 void MANTA::initFire(FluidModifierData *mmd)
 {
   if (!mFuel) {
-    std::vector<std::string> pythonCommands;
-    std::string tmpString = smoke_alloc_fire + smoke_with_fire;
-    std::string finalString = parseScript(tmpString, mmd);
+    vector<string> pythonCommands;
+    string tmpString = smoke_alloc_fire + smoke_with_fire;
+    string finalString = parseScript(tmpString, mmd);
     pythonCommands.push_back(finalString);
 
     runPythonString(pythonCommands);
@@ -357,9 +366,9 @@ void MANTA::initFire(FluidModifierData *mmd)
 void MANTA::initFireHigh(FluidModifierData *mmd)
 {
   if (!mFuelHigh) {
-    std::vector<std::string> pythonCommands;
-    std::string tmpString = smoke_alloc_fire_noise + smoke_with_fire;
-    std::string finalString = parseScript(tmpString, mmd);
+    vector<string> pythonCommands;
+    string tmpString = smoke_alloc_fire_noise + smoke_with_fire;
+    string finalString = parseScript(tmpString, mmd);
     pythonCommands.push_back(finalString);
 
     runPythonString(pythonCommands);
@@ -370,9 +379,9 @@ void MANTA::initFireHigh(FluidModifierData *mmd)
 void MANTA::initColors(FluidModifierData *mmd)
 {
   if (!mColorR) {
-    std::vector<std::string> pythonCommands;
-    std::string tmpString = smoke_alloc_colors + smoke_init_colors + smoke_with_colors;
-    std::string finalString = parseScript(tmpString, mmd);
+    vector<string> pythonCommands;
+    string tmpString = smoke_alloc_colors + smoke_init_colors + smoke_with_colors;
+    string finalString = parseScript(tmpString, mmd);
     pythonCommands.push_back(finalString);
 
     runPythonString(pythonCommands);
@@ -383,9 +392,9 @@ void MANTA::initColors(FluidModifierData *mmd)
 void MANTA::initColorsHigh(FluidModifierData *mmd)
 {
   if (!mColorRHigh) {
-    std::vector<std::string> pythonCommands;
-    std::string tmpString = smoke_alloc_colors_noise + smoke_init_colors_noise + smoke_with_colors;
-    std::string finalString = parseScript(tmpString, mmd);
+    vector<string> pythonCommands;
+    string tmpString = smoke_alloc_colors_noise + smoke_init_colors_noise + smoke_with_colors;
+    string finalString = parseScript(tmpString, mmd);
     pythonCommands.push_back(finalString);
 
     runPythonString(pythonCommands);
@@ -396,10 +405,10 @@ void MANTA::initColorsHigh(FluidModifierData *mmd)
 void MANTA::initLiquid(FluidModifierData *mmd)
 {
   if (!mPhiIn) {
-    std::vector<std::string> pythonCommands;
-    std::string tmpString = liquid_variables + liquid_alloc + liquid_init_phi + liquid_save_data +
-                            liquid_load_data + liquid_adaptive_step + liquid_step;
-    std::string finalString = parseScript(tmpString, mmd);
+    vector<string> pythonCommands;
+    string tmpString = liquid_variables + liquid_alloc + liquid_init_phi + liquid_save_data +
+                       liquid_load_data + liquid_adaptive_step + liquid_step;
+    string finalString = parseScript(tmpString, mmd);
     pythonCommands.push_back(finalString);
 
     runPythonString(pythonCommands);
@@ -409,9 +418,9 @@ void MANTA::initLiquid(FluidModifierData *mmd)
 
 void MANTA::initMesh(FluidModifierData *mmd)
 {
-  std::vector<std::string> pythonCommands;
-  std::string tmpString = fluid_variables_mesh + fluid_solver_mesh + liquid_load_mesh;
-  std::string finalString = parseScript(tmpString, mmd);
+  vector<string> pythonCommands;
+  string tmpString = fluid_variables_mesh + fluid_solver_mesh + liquid_load_mesh;
+  string finalString = parseScript(tmpString, mmd);
   pythonCommands.push_back(finalString);
 
   runPythonString(pythonCommands);
@@ -420,9 +429,9 @@ void MANTA::initMesh(FluidModifierData *mmd)
 
 void MANTA::initLiquidMesh(FluidModifierData *mmd)
 {
-  std::vector<std::string> pythonCommands;
-  std::string tmpString = liquid_alloc_mesh + liquid_step_mesh + liquid_save_mesh;
-  std::string finalString = parseScript(tmpString, mmd);
+  vector<string> pythonCommands;
+  string tmpString = liquid_alloc_mesh + liquid_step_mesh + liquid_save_mesh;
+  string finalString = parseScript(tmpString, mmd);
   pythonCommands.push_back(finalString);
 
   runPythonString(pythonCommands);
@@ -432,9 +441,9 @@ void MANTA::initLiquidMesh(FluidModifierData *mmd)
 void MANTA::initObstacle(FluidModifierData *mmd)
 {
   if (!mPhiObsIn) {
-    std::vector<std::string> pythonCommands;
-    std::string tmpString = fluid_alloc_obstacle + fluid_with_obstacle;
-    std::string finalString = parseScript(tmpString, mmd);
+    vector<string> pythonCommands;
+    string tmpString = fluid_alloc_obstacle + fluid_with_obstacle;
+    string finalString = parseScript(tmpString, mmd);
     pythonCommands.push_back(finalString);
 
     runPythonString(pythonCommands);
@@ -445,10 +454,10 @@ void MANTA::initObstacle(FluidModifierData *mmd)
 void MANTA::initGuiding(FluidModifierData *mmd)
 {
   if (!mPhiGuideIn) {
-    std::vector<std::string> pythonCommands;
-

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list