Mesh: PR6497 move return statement to new line

This commit is contained in:
Chris Hennes
2022-03-29 12:36:30 -05:00
parent a9c33d8f58
commit 3ecd16e0bd
21 changed files with 131 additions and 63 deletions

View File

@@ -789,7 +789,8 @@ bool MeshAlgorithm::FillupHole(const std::vector<PointIndex>& boundary,
void MeshAlgorithm::SetFacetsProperty(const std::vector<FacetIndex> &raulInds, const std::vector<unsigned long> &raulProps) const
{
if (raulInds.size() != raulProps.size()) return;
if (raulInds.size() != raulProps.size())
return;
std::vector<unsigned long>::const_iterator iP = raulProps.begin();
for (std::vector<FacetIndex>::const_iterator i = raulInds.begin(); i != raulInds.end(); ++i, ++iP)

View File

@@ -275,7 +275,8 @@ struct MeshFastBuilder::Private {
}
bool operator<(const Vertex& rhs) const
{
if (x != rhs.x) return x < rhs.x;
if (x != rhs.x)
return x < rhs.x;
else if (y != rhs.y) return y < rhs.y;
else if (z != rhs.z) return z < rhs.z;
else return false;

View File

@@ -301,7 +301,8 @@ struct MeshFacet_Less
if (y1 > y2)
{ tmp = y1; y1 = y2; y2 = tmp; }
if (x0 < y0) return true;
if (x0 < y0)
return true;
else if (x0 > y0) return false;
else if (x1 < y1) return true;
else if (x1 > y1) return false;
@@ -1065,7 +1066,9 @@ bool MeshEvalRangePoint::Evaluate()
PointIndex ulCtPoints = _rclMesh.CountPoints();
for (MeshFacetArray::_TConstIterator it = rFaces.begin(); it != rFaces.end(); ++it) {
if (std::find_if(it->_aulPoints, it->_aulPoints + 3, [ulCtPoints](PointIndex i) { return i >= ulCtPoints; }) < it->_aulPoints + 3)
if (std::find_if(it->_aulPoints, it->_aulPoints + 3, [ulCtPoints](PointIndex i) {
return i >= ulCtPoints;
}) < it->_aulPoints + 3)
return false;
}
@@ -1080,7 +1083,9 @@ std::vector<PointIndex> MeshEvalRangePoint::GetIndices() const
PointIndex ind=0;
for (MeshFacetArray::_TConstIterator it = rFaces.begin(); it != rFaces.end(); ++it, ind++) {
if (std::find_if(it->_aulPoints, it->_aulPoints + 3, [ulCtPoints](PointIndex i) { return i >= ulCtPoints; }) < it->_aulPoints + 3)
if (std::find_if(it->_aulPoints, it->_aulPoints + 3, [ulCtPoints](PointIndex i) {
return i >= ulCtPoints;
}) < it->_aulPoints + 3)
aInds.push_back(ind);
}

View File

@@ -250,7 +250,8 @@ bool MeshInput::LoadSTL (std::istream &rstrIn)
// the file size has only 134 bytes in this case. On the other hand we must overread the first 80 bytes
// because it can happen that the file is binary but contains one of these keywords.
std::streambuf* buf = rstrIn.rdbuf();
if (!buf) return false;
if (!buf)
return false;
buf->pubseekoff(80, std::ios::beg, std::ios::in);
uint32_t ulCt, ulBytes=50;
rstrIn.read((char*)&ulCt, sizeof(ulCt));

View File

@@ -1406,7 +1406,8 @@ void MeshTopoAlgorithm::SplitNeighbourFacet(FacetIndex ulFacetPos, unsigned shor
bool MeshTopoAlgorithm::RemoveDegeneratedFacet(FacetIndex index)
{
if (index >= _rclMesh._aclFacetArray.size()) return false;
if (index >= _rclMesh._aclFacetArray.size())
return false;
MeshFacet& rFace = _rclMesh._aclFacetArray[index];
// coincident corners (either topological or geometrical)
@@ -1475,7 +1476,8 @@ bool MeshTopoAlgorithm::RemoveDegeneratedFacet(FacetIndex index)
bool MeshTopoAlgorithm::RemoveCorruptedFacet(FacetIndex index)
{
if (index >= _rclMesh._aclFacetArray.size()) return false;
if (index >= _rclMesh._aclFacetArray.size())
return false;
MeshFacet& rFace = _rclMesh._aclFacetArray[index];
// coincident corners (topological)

View File

@@ -383,13 +383,15 @@ bool EarClippingTriangulator::Triangulate::Snip(const std::vector<Base::Vector3f
Cx = contour[V[w]].x;
Cy = contour[V[w]].y;
if (FLOAT_EPS > (((Bx-Ax)*(Cy-Ay)) - ((By-Ay)*(Cx-Ax)))) return false;
if (FLOAT_EPS > (((Bx-Ax)*(Cy-Ay)) - ((By-Ay)*(Cx-Ax))))
return false;
for (p=0;p<n;p++) {
if( (p == u) || (p == v) || (p == w) ) continue;
Px = contour[V[p]].x;
Py = contour[V[p]].y;
if (InsideTriangle(Ax,Ay,Bx,By,Cx,Cy,Px,Py)) return false;
if (InsideTriangle(Ax,Ay,Bx,By,Cx,Cy,Px,Py))
return false;
}
return true;
@@ -403,7 +405,8 @@ bool EarClippingTriangulator::Triangulate::Process(const std::vector<Base::Vecto
/* allocate and initialize list of Vertices in polygon */
int n = contour.size();
if ( n < 3 ) return false;
if ( n < 3 )
return false;
int *V = new int[n];
@@ -604,7 +607,8 @@ struct Vertex2d_Less
{
if (fabs(p.x - q.x) < MeshDefinitions::_fMinPointDistanceD1) {
if (fabs(p.y - q.y) < MeshDefinitions::_fMinPointDistanceD1) {
return false; } else return p.y < q.y;
return false;
} else return p.y < q.y;
} else return p.x < q.x;
}
};

View File

@@ -79,7 +79,8 @@ HarmonizeNormals::~HarmonizeNormals()
App::DocumentObjectExecReturn *HarmonizeNormals::execute()
{
App::DocumentObject* link = Source.getValue();
if (!link) return new App::DocumentObjectExecReturn("No mesh linked");
if (!link)
return new App::DocumentObjectExecReturn("No mesh linked");
App::Property* prop = link->getPropertyByName("Mesh");
if (prop && prop->getTypeId() == Mesh::PropertyMeshKernel::getClassTypeId()) {
Mesh::PropertyMeshKernel* kernel = static_cast<Mesh::PropertyMeshKernel*>(prop);
@@ -107,7 +108,8 @@ FlipNormals::~FlipNormals()
App::DocumentObjectExecReturn *FlipNormals::execute()
{
App::DocumentObject* link = Source.getValue();
if (!link) return new App::DocumentObjectExecReturn("No mesh linked");
if (!link)
return new App::DocumentObjectExecReturn("No mesh linked");
App::Property* prop = link->getPropertyByName("Mesh");
if (prop && prop->getTypeId() == Mesh::PropertyMeshKernel::getClassTypeId()) {
Mesh::PropertyMeshKernel* kernel = static_cast<Mesh::PropertyMeshKernel*>(prop);
@@ -135,7 +137,8 @@ FixNonManifolds::~FixNonManifolds()
App::DocumentObjectExecReturn *FixNonManifolds::execute()
{
App::DocumentObject* link = Source.getValue();
if (!link) return new App::DocumentObjectExecReturn("No mesh linked");
if (!link)
return new App::DocumentObjectExecReturn("No mesh linked");
App::Property* prop = link->getPropertyByName("Mesh");
if (prop && prop->getTypeId() == Mesh::PropertyMeshKernel::getClassTypeId()) {
Mesh::PropertyMeshKernel* kernel = static_cast<Mesh::PropertyMeshKernel*>(prop);
@@ -163,7 +166,8 @@ FixDuplicatedFaces::~FixDuplicatedFaces()
App::DocumentObjectExecReturn *FixDuplicatedFaces::execute()
{
App::DocumentObject* link = Source.getValue();
if (!link) return new App::DocumentObjectExecReturn("No mesh linked");
if (!link)
return new App::DocumentObjectExecReturn("No mesh linked");
App::Property* prop = link->getPropertyByName("Mesh");
if (prop && prop->getTypeId() == Mesh::PropertyMeshKernel::getClassTypeId()) {
Mesh::PropertyMeshKernel* kernel = static_cast<Mesh::PropertyMeshKernel*>(prop);
@@ -191,7 +195,8 @@ FixDuplicatedPoints::~FixDuplicatedPoints()
App::DocumentObjectExecReturn *FixDuplicatedPoints::execute()
{
App::DocumentObject* link = Source.getValue();
if (!link) return new App::DocumentObjectExecReturn("No mesh linked");
if (!link)
return new App::DocumentObjectExecReturn("No mesh linked");
App::Property* prop = link->getPropertyByName("Mesh");
if (prop && prop->getTypeId() == Mesh::PropertyMeshKernel::getClassTypeId()) {
Mesh::PropertyMeshKernel* kernel = static_cast<Mesh::PropertyMeshKernel*>(prop);
@@ -219,7 +224,8 @@ FixDegenerations::~FixDegenerations()
App::DocumentObjectExecReturn *FixDegenerations::execute()
{
App::DocumentObject* link = Source.getValue();
if (!link) return new App::DocumentObjectExecReturn("No mesh linked");
if (!link)
return new App::DocumentObjectExecReturn("No mesh linked");
App::Property* prop = link->getPropertyByName("Mesh");
if (prop && prop->getTypeId() == Mesh::PropertyMeshKernel::getClassTypeId()) {
Mesh::PropertyMeshKernel* kernel = static_cast<Mesh::PropertyMeshKernel*>(prop);
@@ -248,7 +254,8 @@ FixDeformations::~FixDeformations()
App::DocumentObjectExecReturn *FixDeformations::execute()
{
App::DocumentObject* link = Source.getValue();
if (!link) return new App::DocumentObjectExecReturn("No mesh linked");
if (!link)
return new App::DocumentObjectExecReturn("No mesh linked");
App::Property* prop = link->getPropertyByName("Mesh");
if (prop && prop->getTypeId() == Mesh::PropertyMeshKernel::getClassTypeId()) {
Mesh::PropertyMeshKernel* kernel = static_cast<Mesh::PropertyMeshKernel*>(prop);
@@ -278,7 +285,8 @@ FixIndices::~FixIndices()
App::DocumentObjectExecReturn *FixIndices::execute()
{
App::DocumentObject* link = Source.getValue();
if (!link) return new App::DocumentObjectExecReturn("No mesh linked");
if (!link)
return new App::DocumentObjectExecReturn("No mesh linked");
App::Property* prop = link->getPropertyByName("Mesh");
if (prop && prop->getTypeId() == Mesh::PropertyMeshKernel::getClassTypeId()) {
Mesh::PropertyMeshKernel* kernel = static_cast<Mesh::PropertyMeshKernel*>(prop);
@@ -308,7 +316,8 @@ FillHoles::~FillHoles()
App::DocumentObjectExecReturn *FillHoles::execute()
{
App::DocumentObject* link = Source.getValue();
if (!link) return new App::DocumentObjectExecReturn("No mesh linked");
if (!link)
return new App::DocumentObjectExecReturn("No mesh linked");
App::Property* prop = link->getPropertyByName("Mesh");
if (prop && prop->getTypeId() == Mesh::PropertyMeshKernel::getClassTypeId()) {
Mesh::PropertyMeshKernel* kernel = static_cast<Mesh::PropertyMeshKernel*>(prop);
@@ -339,7 +348,8 @@ RemoveComponents::~RemoveComponents()
App::DocumentObjectExecReturn *RemoveComponents::execute()
{
App::DocumentObject* link = Source.getValue();
if (!link) return new App::DocumentObjectExecReturn("No mesh linked");
if (!link)
return new App::DocumentObjectExecReturn("No mesh linked");
App::Property* prop = link->getPropertyByName("Mesh");
if (prop && prop->getTypeId() == Mesh::PropertyMeshKernel::getClassTypeId()) {
Mesh::PropertyMeshKernel* kernel = static_cast<Mesh::PropertyMeshKernel*>(prop);

View File

@@ -1454,7 +1454,9 @@ void MeshObject::removeSelfIntersections(const std::vector<FacetIndex>& indices)
if (indices.size() % 2 != 0)
return;
unsigned long cntfacets = _kernel.CountFacets();
if (std::find_if(indices.begin(), indices.end(), [cntfacets](FacetIndex v) { return v >= cntfacets; }) < indices.end())
if (std::find_if(indices.begin(), indices.end(), [cntfacets](FacetIndex v) {
return v >= cntfacets;
}) < indices.end())
return;
std::vector<std::pair<FacetIndex, FacetIndex> > selfIntersections;
std::vector<FacetIndex>::const_iterator it;

View File

@@ -72,7 +72,8 @@ int MeshPy::PyInit(PyObject* args, PyObject*)
try {
this->parentProperty = nullptr;
// if no mesh is given
if (!pcObj) return 0;
if (!pcObj)
return 0;
if (PyObject_TypeCheck(pcObj, &(MeshPy::Type))) {
getMeshObjectPtr()->operator = (*static_cast<MeshPy*>(pcObj)->getMeshObjectPtr());
}
@@ -80,13 +81,15 @@ int MeshPy::PyInit(PyObject* args, PyObject*)
PyObject* ret = addFacets(args);
bool ok = (ret!=nullptr);
Py_XDECREF(ret);
if (!ok) return -1;
if (!ok)
return -1;
}
else if (PyTuple_Check(pcObj)) {
PyObject* ret = addFacets(args);
bool ok = (ret!=nullptr);
Py_XDECREF(ret);
if (!ok) return -1;
if (!ok)
return -1;
}
else if (PyUnicode_Check(pcObj)) {
getMeshObjectPtr()->load(PyUnicode_AsUTF8(pcObj));