Mesh: Apply clang-format

This commit is contained in:
wmayer
2023-09-22 19:59:39 +02:00
committed by wwmayer
parent 14cbc5f1e5
commit 4e328682d9
116 changed files with 15683 additions and 12447 deletions

View File

@@ -25,22 +25,26 @@
#include <Base/GeometryPyCXX.h>
#include <Base/VectorPy.h>
// clang-format off
#include "Facet.h"
#include "FacetPy.h"
#include "FacetPy.cpp"
#include "EdgePy.h"
#include "Mesh.h"
// clang-format on
using namespace Mesh;
namespace {
class Index {
namespace
{
class Index
{
FacetIndex index;
public:
Index(FacetIndex index)
: index{index}
: index {index}
{}
friend std::ostream& operator<<(std::ostream& os, Index idx)
@@ -54,11 +58,12 @@ public:
return os;
}
};
}
} // namespace
// returns a string which represent the object e.g. when printed in python
std::string FacetPy::representation() const
{
// clang-format off
FacetPy::PointerType ptr = getFacetPtr();
std::stringstream str;
str << "Facet (";
@@ -94,9 +99,10 @@ std::string FacetPy::representation() const
str << ")";
return str.str();
// clang-format on
}
PyObject *FacetPy::PyMake(struct _typeobject *, PyObject *, PyObject *) // Python wrapper
PyObject* FacetPy::PyMake(struct _typeobject*, PyObject*, PyObject*) // Python wrapper
{
// create a new instance of FacetPy and the Twin object
return new FacetPy(new Facet);
@@ -105,25 +111,28 @@ PyObject *FacetPy::PyMake(struct _typeobject *, PyObject *, PyObject *) // Pyth
// constructor method
int FacetPy::PyInit(PyObject* args, PyObject* /*kwds*/)
{
if (!PyArg_ParseTuple(args, ""))
if (!PyArg_ParseTuple(args, "")) {
return -1;
}
return 0;
}
PyObject* FacetPy::unbound(PyObject *args)
PyObject* FacetPy::unbound(PyObject* args)
{
if (!PyArg_ParseTuple(args, ""))
if (!PyArg_ParseTuple(args, "")) {
return nullptr;
}
getFacetPtr()->Index = MeshCore::FACET_INDEX_MAX;
getFacetPtr()->Mesh = nullptr;
Py_Return;
}
PyObject* FacetPy::getEdge(PyObject *args)
PyObject* FacetPy::getEdge(PyObject* args)
{
int index{};
if (!PyArg_ParseTuple(args, "i", &index))
int index {};
if (!PyArg_ParseTuple(args, "i", &index)) {
return nullptr;
}
Edge edge = getFacetPtr()->getEdge(index);
return new EdgePy(new Edge(edge));
@@ -131,7 +140,7 @@ PyObject* FacetPy::getEdge(PyObject *args)
Py::Long FacetPy::getIndex() const
{
return Py::Long((long) getFacetPtr()->Index);
return Py::Long((long)getFacetPtr()->Index);
}
Py::Boolean FacetPy::getBound() const
@@ -143,15 +152,16 @@ Py::Object FacetPy::getNormal() const
{
Base::VectorPy* normal = new Base::VectorPy(getFacetPtr()->GetNormal());
normal->setConst();
return Py::Object(normal,true);
return Py::Object(normal, true);
}
PyObject* FacetPy::intersect(PyObject *args)
PyObject* FacetPy::intersect(PyObject* args)
{
PyObject* object{};
if (!PyArg_ParseTuple(args, "O!", &FacetPy::Type, &object))
PyObject* object {};
if (!PyArg_ParseTuple(args, "O!", &FacetPy::Type, &object)) {
return nullptr;
FacetPy *face = static_cast<FacetPy*>(object);
}
FacetPy* face = static_cast<FacetPy*>(object);
FacetPy::PointerType face_ptr = face->getFacetPtr();
FacetPy::PointerType this_ptr = this->getFacetPtr();
Base::Vector3f p0, p1;
@@ -182,11 +192,12 @@ PyObject* FacetPy::intersect(PyObject *args)
}
}
PyObject* FacetPy::isDegenerated(PyObject *args)
PyObject* FacetPy::isDegenerated(PyObject* args)
{
float fEpsilon = MeshCore::MeshDefinitions::_fMinPointDistanceP2;
if (!PyArg_ParseTuple(args, "|f", &fEpsilon))
if (!PyArg_ParseTuple(args, "|f", &fEpsilon)) {
return nullptr;
}
FacetPy::PointerType face = this->getFacetPtr();
if (!face->isBound()) {
@@ -198,12 +209,13 @@ PyObject* FacetPy::isDegenerated(PyObject *args)
return Py::new_reference_to(Py::Boolean(tria.IsDegenerated(fEpsilon)));
}
PyObject* FacetPy::isDeformed(PyObject *args)
PyObject* FacetPy::isDeformed(PyObject* args)
{
float fMinAngle{};
float fMaxAngle{};
if (!PyArg_ParseTuple(args, "ff", &fMinAngle, &fMaxAngle))
float fMinAngle {};
float fMaxAngle {};
if (!PyArg_ParseTuple(args, "ff", &fMinAngle, &fMaxAngle)) {
return nullptr;
}
FacetPy::PointerType face = this->getFacetPtr();
if (!face->isBound()) {
@@ -236,11 +248,12 @@ Py::List FacetPy::getPoints() const
Py::Tuple FacetPy::getPointIndices() const
{
FacetPy::PointerType face = this->getFacetPtr();
if (!face->isBound())
{ return Py::Tuple(); }
if (!face->isBound()) {
return Py::Tuple();
}
Py::Tuple idxTuple(3);
for (int i=0; i<3; i++) {
for (int i = 0; i < 3; i++) {
idxTuple.setItem(i, Py::Long(face->PIndex[i]));
}
return idxTuple;
@@ -254,7 +267,7 @@ Py::Tuple FacetPy::getNeighbourIndices() const
}
Py::Tuple idxTuple(3);
for (int i=0; i<3; i++) {
for (int i = 0; i < 3; i++) {
auto index = face->NIndex[i];
if (index < MeshCore::FACET_INDEX_MAX) {
idxTuple.setItem(i, Py::Long(index));
@@ -348,14 +361,12 @@ Py::Tuple FacetPy::getInCircle() const
return tuple;
}
PyObject *FacetPy::getCustomAttributes(const char* /*attr*/) const
PyObject* FacetPy::getCustomAttributes(const char* /*attr*/) const
{
return nullptr;
}
int FacetPy::setCustomAttributes(const char* /*attr*/, PyObject * /*obj*/)
int FacetPy::setCustomAttributes(const char* /*attr*/, PyObject* /*obj*/)
{
return 0;
}