[Bf-blender-cvs] [6c1846e] fluid-mantaflow: cleaned up include statements

Sebastián Barschkis noreply at git.blender.org
Mon Mar 21 18:56:30 CET 2016


Commit: 6c1846e64f1852325d5a3f067e23de0b787e1327
Author: Sebastián Barschkis
Date:   Mon Mar 21 18:53:37 2016 +0100
Branches: fluid-mantaflow
https://developer.blender.org/rB6c1846e64f1852325d5a3f067e23de0b787e1327

cleaned up include statements

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

M	intern/mantaflow/extern/manta_python_API.h
M	intern/mantaflow/extern/manta_smoke_API.h
M	intern/mantaflow/intern/MANTA.cpp
M	intern/mantaflow/intern/MANTA.h
M	intern/mantaflow/intern/manta_python_API.cpp
M	intern/mantaflow/intern/manta_smoke_API.cpp
M	intern/mantaflow/intern/strings/liquid.h
M	intern/mantaflow/intern/strings/smoke.h
M	source/blender/editors/physics/physics_fluid.c

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

diff --git a/intern/mantaflow/extern/manta_python_API.h b/intern/mantaflow/extern/manta_python_API.h
index c3fe3b3..85bae12 100644
--- a/intern/mantaflow/extern/manta_python_API.h
+++ b/intern/mantaflow/extern/manta_python_API.h
@@ -1,5 +1,34 @@
-#ifndef _MANTA_API_H_
-#define _MANTA_API_H_
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. 
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2016 Blender Foundation.
+ * All rights reserved.
+ *
+ * Contributor(s): Sebastian Barschkis (sebbas)
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file mantaflow/extern/manta_python_API.h
+ *  \ingroup mantaflow
+ */
+
+#ifndef MANTA_PYTHON_API_H
+#define MANTA_PYTHON_API_H
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/intern/mantaflow/extern/manta_smoke_API.h b/intern/mantaflow/extern/manta_smoke_API.h
index feebf87..f3cf249 100644
--- a/intern/mantaflow/extern/manta_smoke_API.h
+++ b/intern/mantaflow/extern/manta_smoke_API.h
@@ -27,9 +27,8 @@
  *  \ingroup mantaflow
  */
 
-
-#ifndef MANTA_SMOKE_API_H_
-#define MANTA_SMOKE_API_H_
+#ifndef MANTA_SMOKE_API_H
+#define MANTA_SMOKE_API_H
 
 #ifdef __cplusplus
 extern "C" {
@@ -42,7 +41,7 @@ struct MANTA *smoke_init(int *res, struct SmokeModifierData *smd);
 void smoke_free(struct MANTA *manta);
 size_t smoke_get_index(int x, int max_x, int y, int max_y, int z /*, int max_z */);
 size_t smoke_get_index2d(int x, int max_x, int y /*, int max_y, int z, int max_z */);
-void smoke_manta_export(struct SmokeModifierData *smd);
+void smoke_manta_export(struct MANTA* manta, SmokeModifierData *smd);
 void smoke_step(struct MANTA *manta, SmokeModifierData *smd);
 void smoke_dissolve(struct MANTA *manta, int speed, int log);
 void smoke_dissolve_wavelet(struct MANTA *manta, int speed, int log);
diff --git a/intern/mantaflow/intern/MANTA.cpp b/intern/mantaflow/intern/MANTA.cpp
index bd810a7..0fa2ce8 100644
--- a/intern/mantaflow/intern/MANTA.cpp
+++ b/intern/mantaflow/intern/MANTA.cpp
@@ -27,7 +27,20 @@
  *  \ingroup mantaflow
  */
 
+#include <sstream>
+#include <fstream>
+#include <iostream>
+
 #include "MANTA.h"
+#include "registry.h"
+#include "smoke.h"
+
+#include "BLI_path_util.h"
+#include "BLI_utildefines.h"
+
+#include "DNA_scene_types.h"
+#include "DNA_modifier_types.h"
+#include "DNA_smoke_types.h"
 
 bool MANTA::mantaInitialized = false;
 
@@ -213,7 +226,7 @@ void MANTA::initColors(SmokeModifierData *smd)
 {
 	if (!mColorR) {
 		mCommands.clear();
-		std:: string colorCodes = parseScript(set_color_codes, smd);
+		std::string colorCodes = parseScript(set_color_codes, smd);
 		mCommands.push_back(colorCodes);
 		mCommands.push_back(alloc_colors_low);
 		mCommands.push_back(init_colors_low);
@@ -227,7 +240,7 @@ void MANTA::initColorsHigh(SmokeModifierData *smd)
 {
 	if (!mColorRHigh) {
 		mCommands.clear();
-		std:: string colorCodes = parseScript(set_color_codes, smd);
+		std::string colorCodes = parseScript(set_color_codes, smd);
 		mCommands.push_back(colorCodes);
 		mCommands.push_back(alloc_colors_high);
 		mCommands.push_back(init_colors_high);
@@ -376,7 +389,7 @@ void MANTA::startMantaflow()
 
 std::string MANTA::getRealValue(const std::string& varName,  SmokeModifierData *smd)
 {
-	ostringstream ss;
+	std::ostringstream ss;
 	bool is2D = (smd->domain->manta_solver_res == 2);
 	ModifierData *md = ((ModifierData*) smd);
 	
@@ -466,14 +479,14 @@ std::string MANTA::getRealValue(const std::string& varName,  SmokeModifierData *
 		BLI_split_dir_part(smd->domain->manta_filepath, parent_dir, sizeof(parent_dir));
 		ss << parent_dir;
 	} else
-		cout << "ERROR: Unknown option:" << varName <<endl;
+		std::cout << "ERROR: Unknown option:" << varName << std::endl;
 	return ss.str();
 }
 
-std::string MANTA::parseLine(const string& line, SmokeModifierData *smd)
+std::string MANTA::parseLine(const std::string& line, SmokeModifierData *smd)
 {
 	if (line.size() == 0) return "";
-	string res = "";
+	std::string res = "";
 	int currPos = 0, start_del = 0, end_del = -1;
 	bool readingVar = false;
 	const char delimiter = '$';
@@ -494,11 +507,11 @@ std::string MANTA::parseLine(const string& line, SmokeModifierData *smd)
 	return res;
 }
 
-std::string MANTA::parseScript(const string& setup_string, SmokeModifierData *smd)
+std::string MANTA::parseScript(const std::string& setup_string, SmokeModifierData *smd)
 {
 	std::istringstream f(setup_string);
-	ostringstream res;
-	string line = "";
+	std::ostringstream res;
+	std::string line = "";
 	while(getline(f, line)) {
 		res << parseLine(line, smd) << "\n";
 	}
@@ -586,7 +599,7 @@ void MANTA::exportScript(SmokeModifierData *smd)
 	final_script += standalone;
 	
 	// Write script
-	ofstream myfile;
+	std::ofstream myfile;
 	myfile.open(smd->domain->manta_filepath);
 	myfile << final_script;
 	myfile.close();
@@ -618,32 +631,32 @@ PyObject* MANTA::getPythonObject(std::string pyVariableName)
 	return pyObject;
 }
 
-string MANTA::getGridPointer(std::string gridName, std::string solverName)
+std::string MANTA::getGridPointer(std::string gridName, std::string solverName)
 {
 	if ((gridName == "") && (solverName == "")) {
 		return "";
 	}
 	PyGILState_STATE gilstate = PyGILState_Ensure();
 	PyObject *main = PyImport_AddModule("__main__");
-	if (main == NULL){cout << "null" << 1 << endl;return "";}
+	if (main == NULL){std::cout << "null" << 1 << std::endl; return "";}
 	PyObject *globals = PyModule_GetDict(main);
-	if (globals == NULL){cout << "null" << 12 << endl;return "";}
+	if (globals == NULL){std::cout << "null" << 12 << std::endl; return "";}
 	PyObject *grid_object = PyDict_GetItemString(globals, gridName.c_str());
-	if (grid_object == NULL){cout << "null" << 13 << endl;return "";}
+	if (grid_object == NULL){std::cout << "null" << 13 << std::endl; return "";}
 	PyObject* func = PyObject_GetAttrString(grid_object,(char*)"getDataPointer");
-	if (func == NULL){cout << "null" << 14 << endl;return "";}
+	if (func == NULL){std::cout << "null" << 14 << std::endl; return "";}
 	PyObject* retured_value = PyObject_CallObject(func, NULL);
 	PyObject* encoded = PyUnicode_AsUTF8String(retured_value);
-	if (retured_value == NULL){cout << "null" << 15 << endl;return "";}
+	if (retured_value == NULL){std::cout << "null" << 15 << std::endl; return "";}
 	std::string res = PyBytes_AsString(encoded);
-	cout << "Pointer on "<< gridName << " " << res << endl;
+	std::cout << "Pointer on "<< gridName << " " << res << std::endl;
 	PyGILState_Release(gilstate);
 	return res;
 }
 
 void* MANTA::pointerFromString(const std::string& s)
 {
-	stringstream ss(s);
+	std::stringstream ss(s);
 	void *gridPointer = NULL;
 	ss >> gridPointer;
 	return gridPointer;
diff --git a/intern/mantaflow/intern/MANTA.h b/intern/mantaflow/intern/MANTA.h
index c27b49a..47ad9d1 100644
--- a/intern/mantaflow/intern/MANTA.h
+++ b/intern/mantaflow/intern/MANTA.h
@@ -27,27 +27,13 @@
  *  \ingroup mantaflow
  */
 
-#ifndef MANTA_H
-#define MANTA_H
+#ifndef MANTA_A_H
+#define MANTA_A_H
 
-#include <cstdlib>
-#include <cmath>
-#include <cstring>
-#include <sstream>
-#include <fstream>
-#include <iostream>
+#include <string>
 #include <vector>
 
-#include "smoke.h"
 #include "Python.h"
-#include "registry.h"
-
-#include "DNA_scene_types.h"
-#include "DNA_modifier_types.h"
-#include "DNA_smoke_types.h"
-
-#include "BLI_path_util.h"
-#include "BLI_utildefines.h"
 
 struct MANTA {
 public:
@@ -179,8 +165,8 @@ private:
 	void startMantaflow();
 	void runPythonString(std::vector<std::string> commands);
 	std::string getRealValue(const std::string& varName, SmokeModifierData *smd);
-	std::string parseLine(const string& line, SmokeModifierData *smd);
-	std::string parseScript(const string& setup_string, SmokeModifierData *smd);
+	std::string parseLine(const std::string& line, SmokeModifierData *smd);
+	std::string parseScript(const std::string& setup_string, SmokeModifierData *smd);
 	std::string getGridPointer(std::string gridName, std::string solverName);
 	void* pointerFromString(const std::string& s);
 	PyObject* getPythonObject(std::string pyVariableName);
diff --git a/intern/mantaflow/intern/manta_python_API.cpp b/intern/mantaflow/intern/manta_python_API.cpp
index 9300a32..8d37b0b 100644
--- a/intern/mantaflow/intern/manta_python_API.cpp
+++ b/intern/mantaflow/intern/manta_python_API.cpp
@@ -1,10 +1,37 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version. 
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2016 Blender Foundation.
+ * All rights reserved.
+ *
+ * Contributor(s): Sebastian Barschkis (sebbas)
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file mantaflow/intern/manta_python_API.cpp
+ *  \ingroup mantaflow
+ */
+
 #include "Python.h"
 #include "manta_python_API.h"
-#include "manta.h"
-
-using namespace Manta;
+#include "registry.h"
 
-PyObject * PyInit_Manta(void)
+PyObject* PyInit_Manta

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list