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:
Diffstat (limited to 'extern/mantaflow/helper')
-rw-r--r--extern/mantaflow/helper/pwrapper/numpyWrap.cpp6
-rw-r--r--extern/mantaflow/helper/pwrapper/pclass.cpp6
-rw-r--r--extern/mantaflow/helper/pwrapper/pclass.h2
-rw-r--r--extern/mantaflow/helper/pwrapper/pconvert.cpp12
-rw-r--r--extern/mantaflow/helper/pwrapper/pconvert.h19
-rw-r--r--extern/mantaflow/helper/pwrapper/pvec3.cpp80
-rw-r--r--extern/mantaflow/helper/pwrapper/registry.cpp108
-rw-r--r--extern/mantaflow/helper/util/randomstream.h2
-rw-r--r--extern/mantaflow/helper/util/rcmatrix.h14
-rw-r--r--extern/mantaflow/helper/util/simpleimage.cpp10
-rw-r--r--extern/mantaflow/helper/util/simpleimage.h2
11 files changed, 131 insertions, 130 deletions
diff --git a/extern/mantaflow/helper/pwrapper/numpyWrap.cpp b/extern/mantaflow/helper/pwrapper/numpyWrap.cpp
index d2ddb21be70..0e2ef3f4803 100644
--- a/extern/mantaflow/helper/pwrapper/numpyWrap.cpp
+++ b/extern/mantaflow/helper/pwrapper/numpyWrap.cpp
@@ -94,7 +94,7 @@ void PyArrayContainer::ExtractData(void *_pParentPyArray)
template<> PyArrayContainer fromPy<PyArrayContainer>(PyObject *obj)
{
- if (PyArray_API == NULL) {
+ if (PyArray_API == nullptr) {
// python 3 uses the return value
#if PY_VERSION_HEX >= 0x03000000
import_array();
@@ -109,12 +109,12 @@ template<> PyArrayContainer fromPy<PyArrayContainer>(PyObject *obj)
PyArrayObject *obj_p = reinterpret_cast<PyArrayObject *>(
PyArray_CheckFromAny(obj,
- NULL,
+ nullptr,
0,
0,
/*NPY_ARRAY_ENSURECOPY*/ NPY_ARRAY_C_CONTIGUOUS |
NPY_ARRAY_ENSUREARRAY | NPY_ARRAY_NOTSWAPPED,
- NULL));
+ nullptr));
PyArrayContainer container = PyArrayContainer(obj_p);
return container;
diff --git a/extern/mantaflow/helper/pwrapper/pclass.cpp b/extern/mantaflow/helper/pwrapper/pclass.cpp
index a95254ebe11..ae028b0a330 100644
--- a/extern/mantaflow/helper/pwrapper/pclass.cpp
+++ b/extern/mantaflow/helper/pwrapper/pclass.cpp
@@ -98,13 +98,13 @@ string PbType::str() const
vector<PbClass *> PbClass::mInstances;
PbClass::PbClass(FluidSolver *parent, const string &name, PyObject *obj)
- : mMutex(NULL), mParent(parent), mPyObject(obj), mName(name), mHidden(false)
+ : mMutex(nullptr), mParent(parent), mPyObject(obj), mName(name), mHidden(false)
{
mMutex = new QMutex();
}
PbClass::PbClass(const PbClass &a)
- : mMutex(NULL), mParent(a.mParent), mPyObject(0), mName("_unnamed"), mHidden(false)
+ : mMutex(nullptr), mParent(a.mParent), mPyObject(0), mName("_unnamed"), mHidden(false)
{
mMutex = new QMutex();
}
@@ -180,7 +180,7 @@ PbClass *PbClass::createPyObject(const string &classname,
void PbClass::checkParent()
{
- if (getParent() == NULL) {
+ if (getParent() == nullptr) {
errMsg("New class " + mName + ": no parent given -- specify using parent=xxx !");
}
}
diff --git a/extern/mantaflow/helper/pwrapper/pclass.h b/extern/mantaflow/helper/pwrapper/pclass.h
index b34103ca9a7..334ab9fb1ec 100644
--- a/extern/mantaflow/helper/pwrapper/pclass.h
+++ b/extern/mantaflow/helper/pwrapper/pclass.h
@@ -43,7 +43,7 @@ struct PbTypeVec {
//! Base class for all classes exposed to Python
class PbClass {
public:
- PbClass(FluidSolver *parent, const std::string &name = "", PyObject *obj = NULL);
+ PbClass(FluidSolver *parent, const std::string &name = "", PyObject *obj = nullptr);
PbClass(const PbClass &a);
virtual ~PbClass();
diff --git a/extern/mantaflow/helper/pwrapper/pconvert.cpp b/extern/mantaflow/helper/pwrapper/pconvert.cpp
index 861a2c070bd..7c66cdc7e72 100644
--- a/extern/mantaflow/helper/pwrapper/pconvert.cpp
+++ b/extern/mantaflow/helper/pwrapper/pconvert.cpp
@@ -491,7 +491,7 @@ template<> bool isPy<std::vector<float>>(PyObject *obj)
//******************************************************************************
// PbArgs class defs
-PbArgs PbArgs::EMPTY(NULL, NULL);
+PbArgs PbArgs::EMPTY(nullptr, nullptr);
PbArgs::PbArgs(PyObject *linarg, PyObject *dict) : mLinArgs(0), mKwds(0)
{
@@ -577,7 +577,7 @@ void PbArgs::check()
FluidSolver *PbArgs::obtainParent()
{
- FluidSolver *solver = getPtrOpt<FluidSolver>("solver", -1, NULL);
+ FluidSolver *solver = getPtrOpt<FluidSolver>("solver", -1, nullptr);
if (solver != 0)
return solver;
@@ -585,7 +585,7 @@ FluidSolver *PbArgs::obtainParent()
PbClass *obj = Pb::objFromPy(it->second.obj);
if (obj) {
- if (solver == NULL)
+ if (solver == nullptr)
solver = obj->getParent();
}
}
@@ -593,7 +593,7 @@ FluidSolver *PbArgs::obtainParent()
PbClass *obj = Pb::objFromPy(it->obj);
if (obj) {
- if (solver == NULL)
+ if (solver == nullptr)
solver = obj->getParent();
}
}
@@ -616,7 +616,7 @@ PyObject *PbArgs::getItem(const std::string &key, bool strict, ArgLocker *lk)
if (lu == mData.end()) {
if (strict)
errMsg("Argument '" + key + "' is not defined.");
- return NULL;
+ return nullptr;
}
PbClass *pbo = Pb::objFromPy(lu->second.obj);
// try to lock
@@ -629,7 +629,7 @@ PyObject *PbArgs::getItem(size_t number, bool strict, ArgLocker *lk)
{
if (number >= mLinData.size()) {
if (!strict)
- return NULL;
+ return nullptr;
stringstream s;
s << "Argument number #" << number << " not specified.";
errMsg(s.str());
diff --git a/extern/mantaflow/helper/pwrapper/pconvert.h b/extern/mantaflow/helper/pwrapper/pconvert.h
index 87f4248f6f1..eda2f5b9632 100644
--- a/extern/mantaflow/helper/pwrapper/pconvert.h
+++ b/extern/mantaflow/helper/pwrapper/pconvert.h
@@ -139,9 +139,9 @@ template<> bool isPy<std::vector<float>>(PyObject *obj);
//! Encapsulation of python arguments
class PbArgs {
public:
- PbArgs(PyObject *linargs = NULL, PyObject *dict = NULL);
+ PbArgs(PyObject *linargs = nullptr, PyObject *dict = nullptr);
~PbArgs();
- void setup(PyObject *linargs = NULL, PyObject *dict = NULL);
+ void setup(PyObject *linargs = nullptr, PyObject *dict = nullptr);
void check();
FluidSolver *obtainParent();
@@ -153,7 +153,7 @@ class PbArgs {
inline bool has(const std::string &key)
{
- return getItem(key, false) != NULL;
+ return getItem(key, false) != nullptr;
}
inline void deleteItem(const std::string &key)
{
@@ -177,7 +177,7 @@ class PbArgs {
DataElement el = {toPy(arg), false};
mData[key] = el;
}
- template<class T> inline T get(const std::string &key, int number = -1, ArgLocker *lk = NULL)
+ template<class T> inline T get(const std::string &key, int number = -1, ArgLocker *lk = nullptr)
{
visit(number, key);
PyObject *o = getItem(key, false, lk);
@@ -189,7 +189,7 @@ class PbArgs {
errMsg("Argument '" + key + "' is not defined.");
}
template<class T>
- inline T getOpt(const std::string &key, int number, T defarg, ArgLocker *lk = NULL)
+ inline T getOpt(const std::string &key, int number, T defarg, ArgLocker *lk = nullptr)
{
visit(number, key);
PyObject *o = getItem(key, false, lk);
@@ -200,7 +200,7 @@ class PbArgs {
return (o) ? fromPy<T>(o) : defarg;
}
template<class T>
- inline T *getPtrOpt(const std::string &key, int number, T *defarg, ArgLocker *lk = NULL)
+ inline T *getPtrOpt(const std::string &key, int number, T *defarg, ArgLocker *lk = nullptr)
{
visit(number, key);
PyObject *o = getItem(key, false, lk);
@@ -210,7 +210,8 @@ class PbArgs {
o = getItem(number, false, lk);
return o ? fromPyPtr<T>(o, &mTmpStorage) : defarg;
}
- template<class T> inline T *getPtr(const std::string &key, int number = -1, ArgLocker *lk = NULL)
+ template<class T>
+ inline T *getPtr(const std::string &key, int number = -1, ArgLocker *lk = nullptr)
{
visit(number, key);
PyObject *o = getItem(key, false, lk);
@@ -239,8 +240,8 @@ class PbArgs {
static PbArgs EMPTY;
protected:
- PyObject *getItem(const std::string &key, bool strict, ArgLocker *lk = NULL);
- PyObject *getItem(size_t number, bool strict, ArgLocker *lk = NULL);
+ PyObject *getItem(const std::string &key, bool strict, ArgLocker *lk = nullptr);
+ PyObject *getItem(size_t number, bool strict, ArgLocker *lk = nullptr);
struct DataElement {
PyObject *obj;
diff --git a/extern/mantaflow/helper/pwrapper/pvec3.cpp b/extern/mantaflow/helper/pwrapper/pvec3.cpp
index 69bde2a2ad0..1dca44d5e5c 100644
--- a/extern/mantaflow/helper/pwrapper/pvec3.cpp
+++ b/extern/mantaflow/helper/pwrapper/pvec3.cpp
@@ -77,13 +77,13 @@ static PyMemberDef PbVec3Members[] = {
{(char *)"x", T_FLOAT, offsetof(PbVec3, data), 0, (char *)"X"},
{(char *)"y", T_FLOAT, offsetof(PbVec3, data) + sizeof(float), 0, (char *)"Y"},
{(char *)"z", T_FLOAT, offsetof(PbVec3, data) + sizeof(float) * 2, 0, (char *)"Z"},
- {NULL} // Sentinel
+ {nullptr} // Sentinel
};
static PyMethodDef PbVec3Methods[] = {
//{"name", (PyCFunction)Noddy_name, METH_NOARGS, "Return the name, combining the first and last
//name" },
- {NULL} // Sentinel
+ {nullptr} // Sentinel
};
// operator overloads
@@ -240,24 +240,24 @@ static PyNumberMethods PbVec3NumberMethods = {
#endif
PyTypeObject PbVec3Type = {
- PyVarObject_HEAD_INIT(NULL, 0) "manta.vec3", /* tp_name */
- sizeof(PbVec3), /* tp_basicsize */
- 0, /* tp_itemsize */
- (destructor)PbVec3Dealloc, /* tp_dealloc */
- 0, /* tp_print */
- 0, /* tp_getattr */
- 0, /* tp_setattr */
- 0, /* tp_reserved */
- (reprfunc)PbVec3Repr, /* tp_repr */
- &PbVec3NumberMethods, /* tp_as_number */
- 0, /* tp_as_sequence */
- 0, /* tp_as_mapping */
- 0, /* tp_hash */
- 0, /* tp_call */
- 0, /* tp_str */
- 0, /* tp_getattro */
- 0, /* tp_setattro */
- 0, /* tp_as_buffer */
+ PyVarObject_HEAD_INIT(nullptr, 0) "manta.vec3", /* tp_name */
+ sizeof(PbVec3), /* tp_basicsize */
+ 0, /* tp_itemsize */
+ (destructor)PbVec3Dealloc, /* tp_dealloc */
+ 0, /* tp_print */
+ 0, /* tp_getattr */
+ 0, /* tp_setattr */
+ 0, /* tp_reserved */
+ (reprfunc)PbVec3Repr, /* tp_repr */
+ &PbVec3NumberMethods, /* tp_as_number */
+ 0, /* tp_as_sequence */
+ 0, /* tp_as_mapping */
+ 0, /* tp_hash */
+ 0, /* tp_call */
+ 0, /* tp_str */
+ 0, /* tp_getattro */
+ 0, /* tp_setattro */
+ 0, /* tp_as_buffer */
#if PY_MAJOR_VERSION >= 3
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
#else
@@ -297,7 +297,7 @@ struct PbVec4 {
};
static PyMethodDef PbVec4Methods[] = {
- {NULL} // Sentinel
+ {nullptr} // Sentinel
};
static PyMemberDef PbVec4Members[] = {
@@ -305,7 +305,7 @@ static PyMemberDef PbVec4Members[] = {
{(char *)"y", T_FLOAT, offsetof(PbVec4, data) + sizeof(float) * 1, 0, (char *)"Y"},
{(char *)"z", T_FLOAT, offsetof(PbVec4, data) + sizeof(float) * 2, 0, (char *)"Z"},
{(char *)"t", T_FLOAT, offsetof(PbVec4, data) + sizeof(float) * 3, 0, (char *)"T"},
- {NULL} // Sentinel
+ {nullptr} // Sentinel
};
static void PbVec4Dealloc(PbVec4 *self)
@@ -352,24 +352,24 @@ static PyObject *PbVec4Repr(PbVec4 *self)
}
PyTypeObject PbVec4Type = {
- PyVarObject_HEAD_INIT(NULL, 0) "manta.vec4", /* tp_name */
- sizeof(PbVec4), /* tp_basicsize */
- 0, /* tp_itemsize */
- (destructor)PbVec4Dealloc, /* tp_dealloc */
- 0, /* tp_print */
- 0, /* tp_getattr */
- 0, /* tp_setattr */
- 0, /* tp_reserved */
- (reprfunc)PbVec4Repr, /* tp_repr */
- NULL, // &PbVec4NumberMethods, /* tp_as_number */
- 0, /* tp_as_sequence */
- 0, /* tp_as_mapping */
- 0, /* tp_hash */
- 0, /* tp_call */
- 0, /* tp_str */
- 0, /* tp_getattro */
- 0, /* tp_setattro */
- 0, /* tp_as_buffer */
+ PyVarObject_HEAD_INIT(nullptr, 0) "manta.vec4", /* tp_name */
+ sizeof(PbVec4), /* tp_basicsize */
+ 0, /* tp_itemsize */
+ (destructor)PbVec4Dealloc, /* tp_dealloc */
+ 0, /* tp_print */
+ 0, /* tp_getattr */
+ 0, /* tp_setattr */
+ 0, /* tp_reserved */
+ (reprfunc)PbVec4Repr, /* tp_repr */
+ nullptr, // &PbVec4NumberMethods, /* tp_as_number */
+ 0, /* tp_as_sequence */
+ 0, /* tp_as_mapping */
+ 0, /* tp_hash */
+ 0, /* tp_call */
+ 0, /* tp_str */
+ 0, /* tp_getattro */
+ 0, /* tp_setattro */
+ 0, /* tp_as_buffer */
#if PY_MAJOR_VERSION >= 3
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */
#else
diff --git a/extern/mantaflow/helper/pwrapper/registry.cpp b/extern/mantaflow/helper/pwrapper/registry.cpp
index 5b313e52fb4..f88c2aa708e 100644
--- a/extern/mantaflow/helper/pwrapper/registry.cpp
+++ b/extern/mantaflow/helper/pwrapper/registry.cpp
@@ -52,7 +52,7 @@ struct GetSet {
PyGetSetDef def()
{
- PyGetSetDef def = {&name[0], getter, setter, &doc[0], NULL};
+ PyGetSetDef def = {&name[0], getter, setter, &doc[0], nullptr};
return def;
}
};
@@ -175,10 +175,10 @@ void cbDealloc(PbObject *self)
PyObject *cbNew(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
PbObject *self = (PbObject *)type->tp_alloc(type, 0);
- if (self != NULL) {
+ if (self != nullptr) {
// lookup and link classdef
self->classdef = WrapperRegistry::instance().lookup(type->tp_name);
- self->instance = NULL;
+ self->instance = nullptr;
// cout << "creating " << self->classdef->cName << endl;
}
else
@@ -233,7 +233,7 @@ ClassData *WrapperRegistry::getOrConstructClass(const string &classname)
data->cPureName = classname.substr(0, tplIdx);
data->cTemplate = classname.substr(tplIdx + 1, classname.find('>') - tplIdx - 1);
}
- data->baseclass = NULL;
+ data->baseclass = nullptr;
data->constructor = cbDisableConstructor;
mClasses[classname] = data;
mClassList.push_back(data);
@@ -435,7 +435,7 @@ ClassData *WrapperRegistry::lookup(const string &name)
if (it->first == name || it->second->cName == name)
return it->second;
}
- return NULL;
+ return nullptr;
}
void WrapperRegistry::cleanup()
@@ -510,7 +510,7 @@ void WrapperRegistry::runPreInit()
PyObject *sys_path = PySys_GetObject((char *)"path");
for (size_t i = 0; i < mPaths.size(); i++) {
PyObject *path = Manta::toPy(mPaths[i]);
- if (sys_path == NULL || path == NULL || PyList_Append(sys_path, path) < 0) {
+ if (sys_path == nullptr || path == nullptr || PyList_Append(sys_path, path) < 0) {
errMsg("unable to set python path");
}
Py_DECREF(path);
@@ -531,7 +531,7 @@ PyObject *WrapperRegistry::createPyObject(const string &classname,
errMsg("Class " + classname + " doesn't exist.");
// create object
- PyObject *obj = cbNew(&classdef->typeInfo, NULL, NULL);
+ PyObject *obj = cbNew(&classdef->typeInfo, nullptr, nullptr);
PbObject *self = (PbObject *)obj;
PyObject *nkw = 0;
@@ -578,8 +578,8 @@ inline PyObject *castPy(PyTypeObject *p)
PyObject *WrapperRegistry::initModule()
{
// generate and terminate all method lists
- PyMethodDef sentinelFunc = {NULL, NULL, 0, NULL};
- PyGetSetDef sentinelGetSet = {NULL, NULL, NULL, NULL, NULL};
+ PyMethodDef sentinelFunc = {nullptr, nullptr, 0, nullptr};
+ PyGetSetDef sentinelGetSet = {nullptr, nullptr, nullptr, nullptr, nullptr};
for (int i = 0; i < (int)mClassList.size(); i++) {
ClassData *cls = mClassList[i];
cls->genMethods.clear();
@@ -599,11 +599,11 @@ PyObject *WrapperRegistry::initModule()
gDefaultModuleName.c_str(),
"Bridge module to the C++ solver",
-1,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL};
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr};
// get generic methods (plugin functions)
MainModule.m_methods = &mClasses["__modclass__"]->genMethods[0];
@@ -613,8 +613,8 @@ PyObject *WrapperRegistry::initModule()
PyObject *module = Py_InitModule(gDefaultModuleName.c_str(),
&mClasses["__modclass__"]->genMethods[0]);
#endif
- if (module == NULL)
- return NULL;
+ if (module == nullptr)
+ return nullptr;
// load classes
for (vector<ClassData *>::iterator it = mClassList.begin(); it != mClassList.end(); ++it) {
@@ -631,43 +631,43 @@ PyObject *WrapperRegistry::initModule()
// define python classinfo
PyTypeObject t = {
- PyVarObject_HEAD_INIT(NULL, 0)(char *) data.pyName.c_str(), // tp_name
- sizeof(PbObject), // tp_basicsize
- 0, // tp_itemsize
- (destructor)cbDealloc, // tp_dealloc
- 0, // tp_print
- 0, // tp_getattr
- 0, // tp_setattr
- 0, // tp_reserved
- 0, // tp_repr
- num, // tp_as_number
- 0, // tp_as_sequence
- 0, // tp_as_mapping
- 0, // tp_hash
- 0, // tp_call
- 0, // tp_str
- 0, // tp_getattro
- 0, // tp_setattro
- 0, // tp_as_buffer
- Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, // tp_flags
- nameptr, // tp_doc
- 0, // tp_traverse
- 0, // tp_clear
- 0, // tp_richcompare
- 0, // tp_weaklistoffset
- 0, // tp_iter
- 0, // tp_iternext
- &data.genMethods[0], // tp_methods
- 0, // tp_members
- &data.genGetSet[0], // tp_getset
- 0, // tp_base
- 0, // tp_dict
- 0, // tp_descr_get
- 0, // tp_descr_set
- 0, // tp_dictoffset
- (initproc)(data.constructor), // tp_init
- 0, // tp_alloc
- cbNew // tp_new
+ PyVarObject_HEAD_INIT(nullptr, 0)(char *) data.pyName.c_str(), // tp_name
+ sizeof(PbObject), // tp_basicsize
+ 0, // tp_itemsize
+ (destructor)cbDealloc, // tp_dealloc
+ 0, // tp_print
+ 0, // tp_getattr
+ 0, // tp_setattr
+ 0, // tp_reserved
+ 0, // tp_repr
+ num, // tp_as_number
+ 0, // tp_as_sequence
+ 0, // tp_as_mapping
+ 0, // tp_hash
+ 0, // tp_call
+ 0, // tp_str
+ 0, // tp_getattro
+ 0, // tp_setattro
+ 0, // tp_as_buffer
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, // tp_flags
+ nameptr, // tp_doc
+ 0, // tp_traverse
+ 0, // tp_clear
+ 0, // tp_richcompare
+ 0, // tp_weaklistoffset
+ 0, // tp_iter
+ 0, // tp_iternext
+ &data.genMethods[0], // tp_methods
+ 0, // tp_members
+ &data.genGetSet[0], // tp_getset
+ 0, // tp_base
+ 0, // tp_dict
+ 0, // tp_descr_get
+ 0, // tp_descr_set
+ 0, // tp_dictoffset
+ (initproc)(data.constructor), // tp_init
+ 0, // tp_alloc
+ cbNew // tp_new
};
data.typeInfo = t;
@@ -722,7 +722,7 @@ bool canConvert(PyObject *obj, const string &classname)
Manta::PbClass *objFromPy(PyObject *obj)
{
if (Py_TYPE(obj)->tp_dealloc != (destructor)cbDealloc) // not a manta object
- return NULL;
+ return nullptr;
return ((PbObject *)obj)->instance;
}
diff --git a/extern/mantaflow/helper/util/randomstream.h b/extern/mantaflow/helper/util/randomstream.h
index 5b477326f6f..95e007fa943 100644
--- a/extern/mantaflow/helper/util/randomstream.h
+++ b/extern/mantaflow/helper/util/randomstream.h
@@ -270,7 +270,7 @@ inline void MTRand::seed()
}
// Was not successful, so use time() and clock() instead
- seed(hash(time(NULL), clock()));
+ seed(hash(time(nullptr), clock()));
}
inline void MTRand::initialize(const uint32 intseed)
diff --git a/extern/mantaflow/helper/util/rcmatrix.h b/extern/mantaflow/helper/util/rcmatrix.h
index 3a466952ac2..f1f0efe6416 100644
--- a/extern/mantaflow/helper/util/rcmatrix.h
+++ b/extern/mantaflow/helper/util/rcmatrix.h
@@ -157,18 +157,18 @@ template<class N, class T> struct RCMatrix {
{
for (N i = 0; i < n; i++) {
dealloc_row(i);
- matrix[i] = NULL;
+ matrix[i] = nullptr;
if (offsets.size())
offsets[i] = 0;
}
};
bool empty(N i) const
{
- return matrix[i] == NULL;
+ return matrix[i] == nullptr;
}
N row_nonzero_size(N i) const
{
- return matrix[i] == NULL ? 0 : matrix[i]->index.size();
+ return matrix[i] == nullptr ? 0 : matrix[i]->index.size();
}
void resize(N size, N expected_none_zeros = 0)
{
@@ -185,7 +185,7 @@ template<class N, class T> struct RCMatrix {
// Expanding
matrix.resize(size);
for (N i = n; i < size; i++) {
- matrix[i] = NULL;
+ matrix[i] = nullptr;
if (offsets.size())
offsets[i] = 0;
}
@@ -209,7 +209,7 @@ template<class N, class T> struct RCMatrix {
if (matrix[i]) {
if (offsets.empty() || !offsets[i])
delete matrix[i];
- matrix[i] = NULL;
+ matrix[i] = nullptr;
if (offsets.size())
offsets[i] = 0;
}
@@ -426,7 +426,7 @@ template<class N, class T> struct RCMatrix {
}
operator bool() const
{
- return rowEntry != NULL && k < (N)rowEntry->index.size();
+ return rowEntry != nullptr && k < (N)rowEntry->index.size();
}
Iterator &operator++()
{
@@ -447,7 +447,7 @@ template<class N, class T> struct RCMatrix {
}
N size() const
{
- return rowEntry == NULL ? 0 : rowEntry->index.size();
+ return rowEntry == nullptr ? 0 : rowEntry->index.size();
}
protected:
diff --git a/extern/mantaflow/helper/util/simpleimage.cpp b/extern/mantaflow/helper/util/simpleimage.cpp
index 9846fa5bd96..5f062bf0150 100644
--- a/extern/mantaflow/helper/util/simpleimage.cpp
+++ b/extern/mantaflow/helper/util/simpleimage.cpp
@@ -35,7 +35,7 @@ bool SimpleImage::writePpm(
}
FILE *fp = fopen(filename.c_str(), "wb");
- if (fp == NULL) {
+ if (fp == nullptr) {
errMsg("SimpleImage::WritePPM Unable to open '" << filename << "' for writing");
return false;
}
@@ -96,7 +96,7 @@ bool SimpleImage::initFromPpm(std::string filename)
}
// 1st line: PPM or PGM
- if (fgets(line, MAXLINE, fp) == NULL) {
+ if (fgets(line, MAXLINE, fp) == nullptr) {
if (mAbortOnError)
debMsg("SimpleImage::initFromPpm fgets failed", 1);
return 0;
@@ -114,7 +114,7 @@ bool SimpleImage::initFromPpm(std::string filename)
// Read in width and height, & allocate space
// 2nd line: width height
- if (fgets(line, MAXLINE, fp) == NULL) {
+ if (fgets(line, MAXLINE, fp) == nullptr) {
if (mAbortOnError)
errMsg("SimpleImage::initFromPpm fgets failed");
return 0;
@@ -156,14 +156,14 @@ bool SimpleImage::initFromPpm(std::string filename)
// Read in maximum value (ignore) , could be scanned with sscanf as well, but this should be
// 255... 3rd line
- if (fgets(line, MAXLINE, fp) == NULL) {
+ if (fgets(line, MAXLINE, fp) == nullptr) {
if (mAbortOnError)
errMsg("SimpleImage::initFromPpm fgets failed");
return 0;
}
// Read in the pixel array row-by-row: 1st row = top scanline */
- unsigned char *ptr = NULL;
+ unsigned char *ptr = nullptr;
ptr = &pic[(windH - 1) * rowsize];
for (int i = windH; i > 0; i--) {
assertMsg(fread((void *)ptr, 1, rowsize, fp) == rowsize,
diff --git a/extern/mantaflow/helper/util/simpleimage.h b/extern/mantaflow/helper/util/simpleimage.h
index d7e88b83f74..865e64ab86e 100644
--- a/extern/mantaflow/helper/util/simpleimage.h
+++ b/extern/mantaflow/helper/util/simpleimage.h
@@ -29,7 +29,7 @@ namespace Manta {
class SimpleImage {
public:
// cons/des
- SimpleImage() : mSize(-1), mpData(NULL), mAbortOnError(true){};
+ SimpleImage() : mSize(-1), mpData(nullptr), mAbortOnError(true){};
virtual ~SimpleImage()
{
if (mpData)