Mesh: Apply clang-format

This commit is contained in:
wmayer
2023-09-22 19:59:39 +02:00
committed by wwmayer
parent 70ba930230
commit 23db389a76
116 changed files with 15683 additions and 12447 deletions

View File

@@ -22,15 +22,17 @@
#include "PreCompiled.h"
#ifndef _PreComp_
# include <sstream>
#include <sstream>
#endif
#include <Base/VectorPy.h>
#include "Mesh.h"
#include "MeshPoint.h"
// clang-format off
#include "MeshPointPy.h"
#include "MeshPointPy.cpp"
// clang-format on
using namespace Mesh;
@@ -45,7 +47,8 @@ std::string MeshPointPy::representation() const
str << "MeshPoint (";
if (ptr->isBound()) {
if (getMeshPointPtr()->Mesh->countPoints() <= getMeshPointPtr()->Index) {
str << vec.x << ", " << vec.y << ", " << vec.z << ", Idx=" << ptr->Index << " (Out of range)";
str << vec.x << ", " << vec.y << ", " << vec.z << ", Idx=" << ptr->Index
<< " (Out of range)";
}
else {
vec = getMeshPointPtr()->Mesh->getPoint(getMeshPointPtr()->Index);
@@ -60,7 +63,7 @@ std::string MeshPointPy::representation() const
return str.str();
}
PyObject *MeshPointPy::PyMake(struct _typeobject *, PyObject *, PyObject *) // Python wrapper
PyObject* MeshPointPy::PyMake(struct _typeobject*, PyObject*, PyObject*) // Python wrapper
{
// create a new instance of MeshPointPy and the Twin object
return new MeshPointPy(new MeshPoint);
@@ -69,18 +72,20 @@ PyObject *MeshPointPy::PyMake(struct _typeobject *, PyObject *, PyObject *) //
// constructor method
int MeshPointPy::PyInit(PyObject* args, PyObject* /*kwds*/)
{
double x=0.0,y=0.0,z=0.0;
if (!PyArg_ParseTuple(args, "|ddd", &x,&y,&z))
double x = 0.0, y = 0.0, z = 0.0;
if (!PyArg_ParseTuple(args, "|ddd", &x, &y, &z)) {
return -1;
}
getMeshPointPtr()->Set(x,y,z);
getMeshPointPtr()->Set(x, y, z);
return 0;
}
PyObject* MeshPointPy::unbound(PyObject *args)
PyObject* MeshPointPy::unbound(PyObject* args)
{
if (!PyArg_ParseTuple(args, ""))
if (!PyArg_ParseTuple(args, "")) {
return nullptr;
}
getMeshPointPtr()->Index = UINT_MAX;
getMeshPointPtr()->Mesh = nullptr;
Py_Return;
@@ -88,7 +93,7 @@ PyObject* MeshPointPy::unbound(PyObject *args)
Py::Long MeshPointPy::getIndex() const
{
return Py::Long((long) getMeshPointPtr()->Index);
return Py::Long((long)getMeshPointPtr()->Index);
}
Py::Boolean MeshPointPy::getBound() const
@@ -98,15 +103,19 @@ Py::Boolean MeshPointPy::getBound() const
Py::Object MeshPointPy::getNormal() const
{
if (!getMeshPointPtr()->isBound())
throw Py::RuntimeError("This object is not bound to a mesh, so no topological operation is possible!");
if (getMeshPointPtr()->Mesh->countPoints() <= getMeshPointPtr()->Index)
if (!getMeshPointPtr()->isBound()) {
throw Py::RuntimeError(
"This object is not bound to a mesh, so no topological operation is possible!");
}
if (getMeshPointPtr()->Mesh->countPoints() <= getMeshPointPtr()->Index) {
throw Py::IndexError("Index out of range");
}
Base::Vector3d* v = new Base::Vector3d(getMeshPointPtr()->Mesh->getPointNormal(getMeshPointPtr()->Index));
Base::Vector3d* v =
new Base::Vector3d(getMeshPointPtr()->Mesh->getPointNormal(getMeshPointPtr()->Index));
Base::VectorPy* normal = new Base::VectorPy(v);
normal->setConst();
return Py::Object(normal,true);
return Py::Object(normal, true);
}
Py::Object MeshPointPy::getVector() const
@@ -115,7 +124,7 @@ Py::Object MeshPointPy::getVector() const
Base::VectorPy* vec = new Base::VectorPy(*ptr);
vec->setConst();
return Py::Object(vec,true);
return Py::Object(vec, true);
}
Py::Float MeshPointPy::getx() const
@@ -124,8 +133,9 @@ Py::Float MeshPointPy::getx() const
double x = ptr->x;
if (getMeshPointPtr()->isBound()) {
if (getMeshPointPtr()->Mesh->countPoints() > getMeshPointPtr()->Index)
if (getMeshPointPtr()->Mesh->countPoints() > getMeshPointPtr()->Index) {
x = getMeshPointPtr()->Mesh->getPoint(getMeshPointPtr()->Index).x;
}
}
return Py::Float(x);
@@ -137,8 +147,9 @@ Py::Float MeshPointPy::gety() const
double y = ptr->y;
if (getMeshPointPtr()->isBound()) {
if (getMeshPointPtr()->Mesh->countPoints() > getMeshPointPtr()->Index)
if (getMeshPointPtr()->Mesh->countPoints() > getMeshPointPtr()->Index) {
y = getMeshPointPtr()->Mesh->getPoint(getMeshPointPtr()->Index).y;
}
}
return Py::Float(y);
@@ -150,14 +161,15 @@ Py::Float MeshPointPy::getz() const
double z = ptr->z;
if (getMeshPointPtr()->isBound()) {
if (getMeshPointPtr()->Mesh->countPoints() > getMeshPointPtr()->Index)
if (getMeshPointPtr()->Mesh->countPoints() > getMeshPointPtr()->Index) {
z = getMeshPointPtr()->Mesh->getPoint(getMeshPointPtr()->Index).z;
}
}
return Py::Float(z);
}
PyObject *MeshPointPy::getCustomAttributes(const char* /*attr*/) const
PyObject* MeshPointPy::getCustomAttributes(const char* /*attr*/) const
{
return nullptr;
}