Mesh: define the typenames FacetIndex and PointIndex to distinguish between facet and point related indexes

This commit is contained in:
wmayer
2021-09-14 23:01:29 +02:00
parent ce285ea265
commit 33f3fa6865
91 changed files with 2057 additions and 2254 deletions

View File

@@ -34,7 +34,7 @@
using namespace Mesh;
// returns a string which represent the object e.g. when printed in python
std::string FacetPy::representation(void) const
std::string FacetPy::representation() const
{
FacetPy::PointerType ptr = getFacetPtr();
std::stringstream str;
@@ -72,23 +72,23 @@ int FacetPy::PyInit(PyObject* args, PyObject* /*kwds*/)
PyObject* FacetPy::unbound(PyObject *args)
{
if (!PyArg_ParseTuple(args, ""))
return NULL;
getFacetPtr()->Index = ULONG_MAX;
getFacetPtr()->Mesh = 0;
return nullptr;
getFacetPtr()->Index = MeshCore::FACET_INDEX_MAX;
getFacetPtr()->Mesh = nullptr;
Py_Return;
}
Py::Long FacetPy::getIndex(void) const
Py::Long FacetPy::getIndex() const
{
return Py::Long((long) getFacetPtr()->Index);
}
Py::Boolean FacetPy::getBound(void) const
Py::Boolean FacetPy::getBound() const
{
return Py::Boolean(getFacetPtr()->Index != UINT_MAX);
}
Py::Object FacetPy::getNormal(void) const
Py::Object FacetPy::getNormal() const
{
Base::VectorPy* normal = new Base::VectorPy(getFacetPtr()->GetNormal());
normal->setConst();
@@ -99,7 +99,7 @@ PyObject* FacetPy::intersect(PyObject *args)
{
PyObject* object;
if (!PyArg_ParseTuple(args, "O!", &FacetPy::Type, &object))
return NULL;
return nullptr;
FacetPy *face = static_cast<FacetPy*>(object);
FacetPy::PointerType face_ptr = face->getFacetPtr();
FacetPy::PointerType this_ptr = this->getFacetPtr();
@@ -127,7 +127,7 @@ PyObject* FacetPy::intersect(PyObject *args)
return Py::new_reference_to(sct);
}
catch (const Py::Exception&) {
return 0;
return nullptr;
}
}
@@ -135,7 +135,7 @@ PyObject* FacetPy::isDegenerated(PyObject *args)
{
float fEpsilon = MeshCore::MeshDefinitions::_fMinPointDistanceP2;
if (!PyArg_ParseTuple(args, "|f", &fEpsilon))
return NULL;
return nullptr;
FacetPy::PointerType face = this->getFacetPtr();
if (!face->isBound()) {
@@ -152,7 +152,7 @@ PyObject* FacetPy::isDeformed(PyObject *args)
float fMinAngle;
float fMaxAngle;
if (!PyArg_ParseTuple(args, "ff", &fMinAngle, &fMaxAngle))
return NULL;
return nullptr;
FacetPy::PointerType face = this->getFacetPtr();
if (!face->isBound()) {
@@ -166,7 +166,7 @@ PyObject* FacetPy::isDeformed(PyObject *args)
return Py::new_reference_to(Py::Boolean(tria.IsDeformed(fCosOfMinAngle, fCosOfMaxAngle)));
}
Py::List FacetPy::getPoints(void) const
Py::List FacetPy::getPoints() const
{
FacetPy::PointerType face = this->getFacetPtr();
@@ -182,7 +182,7 @@ Py::List FacetPy::getPoints(void) const
return pts;
}
Py::Tuple FacetPy::getPointIndices(void) const
Py::Tuple FacetPy::getPointIndices() const
{
FacetPy::PointerType face = this->getFacetPtr();
if (!face->isBound())
@@ -195,7 +195,7 @@ Py::Tuple FacetPy::getPointIndices(void) const
return idxTuple;
}
Py::Tuple FacetPy::getNeighbourIndices(void) const
Py::Tuple FacetPy::getNeighbourIndices() const
{
FacetPy::PointerType face = this->getFacetPtr();
if (!face->isBound()) {
@@ -209,7 +209,7 @@ Py::Tuple FacetPy::getNeighbourIndices(void) const
return idxTuple;
}
Py::Float FacetPy::getArea(void) const
Py::Float FacetPy::getArea() const
{
FacetPy::PointerType face = this->getFacetPtr();
if (!face->isBound()) {
@@ -221,7 +221,7 @@ Py::Float FacetPy::getArea(void) const
return Py::Float(tria.Area());
}
Py::Float FacetPy::getAspectRatio(void) const
Py::Float FacetPy::getAspectRatio() const
{
FacetPy::PointerType face = this->getFacetPtr();
if (!face->isBound()) {
@@ -233,7 +233,7 @@ Py::Float FacetPy::getAspectRatio(void) const
return Py::Float(tria.AspectRatio());
}
Py::Float FacetPy::getAspectRatio2(void) const
Py::Float FacetPy::getAspectRatio2() const
{
FacetPy::PointerType face = this->getFacetPtr();
if (!face->isBound()) {
@@ -245,7 +245,7 @@ Py::Float FacetPy::getAspectRatio2(void) const
return Py::Float(tria.AspectRatio2());
}
Py::Float FacetPy::getRoundness(void) const
Py::Float FacetPy::getRoundness() const
{
FacetPy::PointerType face = this->getFacetPtr();
if (!face->isBound()) {
@@ -257,7 +257,7 @@ Py::Float FacetPy::getRoundness(void) const
return Py::Float(tria.Roundness());
}
Py::Tuple FacetPy::getCircumCircle(void) const
Py::Tuple FacetPy::getCircumCircle() const
{
FacetPy::PointerType face = this->getFacetPtr();
if (!face->isBound()) {
@@ -274,7 +274,7 @@ Py::Tuple FacetPy::getCircumCircle(void) const
return tuple;
}
Py::Tuple FacetPy::getInCircle(void) const
Py::Tuple FacetPy::getInCircle() const
{
FacetPy::PointerType face = this->getFacetPtr();
if (!face->isBound()) {
@@ -293,7 +293,7 @@ Py::Tuple FacetPy::getInCircle(void) const
PyObject *FacetPy::getCustomAttributes(const char* /*attr*/) const
{
return 0;
return nullptr;
}
int FacetPy::setCustomAttributes(const char* /*attr*/, PyObject * /*obj*/)