From bba7ee9b171ea00a424939ad3323d2b8f93cbc73 Mon Sep 17 00:00:00 2001 From: El Hadi Moussi Date: Thu, 8 Aug 2024 17:51:39 +0200 Subject: [PATCH] Rename NodeCurvatureCalculator to NodesBuilder --- src/ShapeRecogn/CMakeLists.txt | 2 +- src/ShapeRecogn/Nodes.hxx | 2 +- ...rvatureCalculator.cxx => NodesBuilder.cxx} | 26 +++++++++---------- ...rvatureCalculator.hxx => NodesBuilder.hxx} | 4 +-- src/ShapeRecogn/ShapeRecognMesh.cxx | 6 ++--- 5 files changed, 20 insertions(+), 20 deletions(-) rename src/ShapeRecogn/{NodeCurvatureCalculator.cxx => NodesBuilder.cxx} (91%) rename src/ShapeRecogn/{NodeCurvatureCalculator.hxx => NodesBuilder.hxx} (94%) diff --git a/src/ShapeRecogn/CMakeLists.txt b/src/ShapeRecogn/CMakeLists.txt index a4dc5717e..9c4b506d8 100644 --- a/src/ShapeRecogn/CMakeLists.txt +++ b/src/ShapeRecogn/CMakeLists.txt @@ -44,7 +44,7 @@ INCLUDE_DIRECTORIES( SET(shaperecogn_SOURCES MathOps.cxx Nodes.cxx - NodeCurvatureCalculator.cxx + NodesBuilder.cxx Areas.cxx AreasBuilder.cxx ShapeRecognMesh.cxx diff --git a/src/ShapeRecogn/Nodes.hxx b/src/ShapeRecogn/Nodes.hxx index c22dc91d6..1d47d3060 100644 --- a/src/ShapeRecogn/Nodes.hxx +++ b/src/ShapeRecogn/Nodes.hxx @@ -29,7 +29,7 @@ namespace MEDCoupling class Nodes { public: - friend class NodeCurvatureCalculator; + friend class NodesBuilder; Nodes(const MEDCouplingUMesh *mesh, const DataArrayInt64 *neighbors, const DataArrayInt64 *neighborsIdx); diff --git a/src/ShapeRecogn/NodeCurvatureCalculator.cxx b/src/ShapeRecogn/NodesBuilder.cxx similarity index 91% rename from src/ShapeRecogn/NodeCurvatureCalculator.cxx rename to src/ShapeRecogn/NodesBuilder.cxx index e6e950d36..1d261f27a 100644 --- a/src/ShapeRecogn/NodeCurvatureCalculator.cxx +++ b/src/ShapeRecogn/NodesBuilder.cxx @@ -1,17 +1,17 @@ -#include "NodeCurvatureCalculator.hxx" +#include "NodesBuilder.hxx" #include "Nodes.hxx" #include "MathOps.hxx" #include "ShapeRecongConstants.hxx" using namespace MEDCoupling; -NodeCurvatureCalculator::NodeCurvatureCalculator( +NodesBuilder::NodesBuilder( const MEDCouplingUMesh *mesh) : mesh(mesh) { } -Nodes *NodeCurvatureCalculator::compute() +Nodes *NodesBuilder::compute() { DataArrayInt64 *neighbors; DataArrayInt64 *neighborsIdx; @@ -22,7 +22,7 @@ Nodes *NodeCurvatureCalculator::compute() return nodes; } -void NodeCurvatureCalculator::computeNormals() +void NodesBuilder::computeNormals() { mcIdType nbNodes = mesh->getNumberOfNodes(); mcIdType nbCells = mesh->getNumberOfCells(); @@ -70,7 +70,7 @@ void NodeCurvatureCalculator::computeNormals() revNodalIdx->decrRef(); } -void NodeCurvatureCalculator::computeCurvatures(double tol) +void NodesBuilder::computeCurvatures(double tol) { mcIdType nbNodes = mesh->getNumberOfNodes(); nodes->k1.resize(nbNodes); @@ -84,7 +84,7 @@ void NodeCurvatureCalculator::computeCurvatures(double tol) computeCurvatures(nodeId, tol); } -void NodeCurvatureCalculator::computeCurvatures(mcIdType nodeId, double tol) +void NodesBuilder::computeCurvatures(mcIdType nodeId, double tol) { std::array normal = nodes->getNormal(nodeId); std::vector neighborIds = nodes->getNeighbors(nodeId); @@ -157,7 +157,7 @@ void NodeCurvatureCalculator::computeCurvatures(mcIdType nodeId, double tol) nodes->primitives[nodeId] = primitive; } -PrimitiveType NodeCurvatureCalculator::findPrimitiveType(double k1, double k2, double kdiff0, double kis0) const +PrimitiveType NodesBuilder::findPrimitiveType(double k1, double k2, double kdiff0, double kis0) const { if ((fabs(k1 - k2) < EPSILON_PRIMITIVE) && (fabs((k1 + k2) / 2) < EPSILON_PRIMITIVE)) return PrimitiveType::Plane; @@ -171,7 +171,7 @@ PrimitiveType NodeCurvatureCalculator::findPrimitiveType(double k1, double k2, d return PrimitiveType::Unknown; } -std::vector NodeCurvatureCalculator::computeNormalCurvatureCoefficients( +std::vector NodesBuilder::computeNormalCurvatureCoefficients( const std::vector &discreteCurvatures, const std::vector &tangents, const std::array &normal, @@ -192,7 +192,7 @@ std::vector NodeCurvatureCalculator::computeNormalCurvatureCoefficients( return MathOps::lstsq(a, discreteCurvatures); } -void NodeCurvatureCalculator::computeCellNormal( +void NodesBuilder::computeCellNormal( const std::vector &nodeIds, std::array &cellNormal) const { @@ -216,7 +216,7 @@ void NodeCurvatureCalculator::computeCellNormal( cellNormal[2] = a[0] * b[1] - a[1] * b[0]; } -double NodeCurvatureCalculator::computeAverageDistance(mcIdType nodeId, const std::vector &neighborIds) const +double NodesBuilder::computeAverageDistance(mcIdType nodeId, const std::vector &neighborIds) const { double distance = 0.0; std::array @@ -232,7 +232,7 @@ double NodeCurvatureCalculator::computeAverageDistance(mcIdType nodeId, const st return distance / (double)neighborIds.size(); } -std::vector NodeCurvatureCalculator::computeDiscreteCurvatures( +std::vector NodesBuilder::computeDiscreteCurvatures( mcIdType nodeId, const std::vector &neighborIds) const { @@ -242,7 +242,7 @@ std::vector NodeCurvatureCalculator::computeDiscreteCurvatures( return discreteCurvatures; } -double NodeCurvatureCalculator::computeDiscreteCurvature( +double NodesBuilder::computeDiscreteCurvature( mcIdType nodeId, mcIdType neighborId) const { @@ -257,7 +257,7 @@ double NodeCurvatureCalculator::computeDiscreteCurvature( return curvature / n; } -std::vector NodeCurvatureCalculator::computeTangentDirections( +std::vector NodesBuilder::computeTangentDirections( mcIdType nodeId, const std::vector &neighborIds) const { diff --git a/src/ShapeRecogn/NodeCurvatureCalculator.hxx b/src/ShapeRecogn/NodesBuilder.hxx similarity index 94% rename from src/ShapeRecogn/NodeCurvatureCalculator.hxx rename to src/ShapeRecogn/NodesBuilder.hxx index ab15e2f87..dde6312bd 100644 --- a/src/ShapeRecogn/NodeCurvatureCalculator.hxx +++ b/src/ShapeRecogn/NodesBuilder.hxx @@ -30,10 +30,10 @@ namespace MEDCoupling { class Nodes; - class NodeCurvatureCalculator + class NodesBuilder { public: - NodeCurvatureCalculator(const MEDCouplingUMesh *); + NodesBuilder(const MEDCouplingUMesh *); Nodes *compute(); diff --git a/src/ShapeRecogn/ShapeRecognMesh.cxx b/src/ShapeRecogn/ShapeRecognMesh.cxx index d5910e949..b70ee9539 100644 --- a/src/ShapeRecogn/ShapeRecognMesh.cxx +++ b/src/ShapeRecogn/ShapeRecognMesh.cxx @@ -1,6 +1,6 @@ #include "ShapeRecognMesh.hxx" -#include "NodeCurvatureCalculator.hxx" +#include "NodesBuilder.hxx" #include "AreasBuilder.hxx" #include "MEDLoader.hxx" #include "MEDCouplingFieldDouble.hxx" @@ -25,8 +25,8 @@ ShapeRecognMesh::~ShapeRecognMesh() void ShapeRecognMesh::recognize() { mesh->incrRef(); - NodeCurvatureCalculator nodeCurvatureCalc(mesh); - nodes = nodeCurvatureCalc.compute(); + NodesBuilder nodesBuilder(mesh); + nodes = nodesBuilder.compute(); AreasBuilder areasBuilder(nodes); areasBuilder.explore(); areasBuilder.expand(); -- 2.39.2