From dda7e974696462f366b60e5bd45e4215d25afdb5 Mon Sep 17 00:00:00 2001 From: Konstantin Leontev Date: Tue, 6 Aug 2024 12:24:46 +0100 Subject: [PATCH] [bos #42217][EDF 28921] Horseshoe with bodyfitting. Added operators << for nodes and links debug output. --- src/SMDS/SMDS_FaceOfNodes.hxx | 2 +- src/SMDS/SMDS_MeshElement.hxx | 2 +- src/SMDS/SMDS_MeshNode.hxx | 2 +- src/SMDS/SMDS_PolygonalFaceOfNodes.hxx | 2 +- src/SMDS/SMDS_VolumeOfNodes.hxx | 2 +- .../StdMeshers_Cartesian_3D_Grid.hxx | 3 + .../StdMeshers_Cartesian_3D_Hexahedron.hxx | 75 +++++++++++++++++++ 7 files changed, 83 insertions(+), 5 deletions(-) diff --git a/src/SMDS/SMDS_FaceOfNodes.hxx b/src/SMDS/SMDS_FaceOfNodes.hxx index 1ccd14f6a..225e620ab 100644 --- a/src/SMDS/SMDS_FaceOfNodes.hxx +++ b/src/SMDS/SMDS_FaceOfNodes.hxx @@ -32,7 +32,7 @@ class SMDS_EXPORT SMDS_FaceOfNodes: public SMDS_CellOfNodes { public: - void Print(std::ostream & OS) const; + virtual void Print(std::ostream & OS) const override; SMDS_FaceOfNodes(const SMDS_MeshNode* node1, const SMDS_MeshNode* node2, const SMDS_MeshNode* node3); diff --git a/src/SMDS/SMDS_MeshElement.hxx b/src/SMDS/SMDS_MeshElement.hxx index eeec4a1f7..1d44ecf75 100644 --- a/src/SMDS/SMDS_MeshElement.hxx +++ b/src/SMDS/SMDS_MeshElement.hxx @@ -142,7 +142,7 @@ public: SMDS_Mesh* GetMesh() const; - void Print(std::ostream & OS) const; + virtual void Print(std::ostream & OS) const; friend SMDS_EXPORT std::ostream & operator <<(std::ostream & OS, const SMDS_MeshElement *); friend class SMDS_ElementFactory; diff --git a/src/SMDS/SMDS_MeshNode.hxx b/src/SMDS/SMDS_MeshNode.hxx index 99549e937..e2aa11270 100644 --- a/src/SMDS/SMDS_MeshNode.hxx +++ b/src/SMDS/SMDS_MeshNode.hxx @@ -65,7 +65,7 @@ class SMDS_EXPORT SMDS_MeshNode: public SMDS_MeshElement virtual bool IsMediumNode(const SMDS_MeshNode* /*node*/) const { return false; } virtual int NbCornerNodes() const { return 1; } - void Print(std::ostream & OS) const; + virtual void Print(std::ostream & OS) const override; private: diff --git a/src/SMDS/SMDS_PolygonalFaceOfNodes.hxx b/src/SMDS/SMDS_PolygonalFaceOfNodes.hxx index 7dbff1211..8b3d4fa5d 100644 --- a/src/SMDS/SMDS_PolygonalFaceOfNodes.hxx +++ b/src/SMDS/SMDS_PolygonalFaceOfNodes.hxx @@ -47,7 +47,7 @@ class SMDS_EXPORT SMDS_PolygonalFaceOfNodes : public SMDS_CellOfNodes virtual int NbEdges() const; virtual int NbFaces() const; - virtual void Print (std::ostream & OS) const; + virtual void Print (std::ostream & OS) const override; virtual const SMDS_MeshNode* GetNode(const int ind) const; diff --git a/src/SMDS/SMDS_VolumeOfNodes.hxx b/src/SMDS/SMDS_VolumeOfNodes.hxx index 36a515c5d..7098cd623 100644 --- a/src/SMDS/SMDS_VolumeOfNodes.hxx +++ b/src/SMDS/SMDS_VolumeOfNodes.hxx @@ -62,7 +62,7 @@ class SMDS_EXPORT SMDS_VolumeOfNodes: public SMDS_CellOfNodes const int nbNodes); ~SMDS_VolumeOfNodes(); - void Print(std::ostream & OS) const; + virtual void Print(std::ostream & OS) const override; int NbFaces() const; int NbNodes() const; int NbEdges() const; diff --git a/src/StdMeshers/StdMeshers_Cartesian_3D_Grid.hxx b/src/StdMeshers/StdMeshers_Cartesian_3D_Grid.hxx index 8ac347c52..7177bbd37 100644 --- a/src/StdMeshers/StdMeshers_Cartesian_3D_Grid.hxx +++ b/src/StdMeshers/StdMeshers_Cartesian_3D_Grid.hxx @@ -539,6 +539,9 @@ namespace Cartesian3D { threads.emplace_back(f, std::ref(*it)); } + + // This line for debug in sequential mode + // std::for_each(it, last, f); } else { diff --git a/src/StdMeshers/StdMeshers_Cartesian_3D_Hexahedron.hxx b/src/StdMeshers/StdMeshers_Cartesian_3D_Hexahedron.hxx index ade329d8d..dbaa7cf52 100644 --- a/src/StdMeshers/StdMeshers_Cartesian_3D_Hexahedron.hxx +++ b/src/StdMeshers/StdMeshers_Cartesian_3D_Hexahedron.hxx @@ -157,6 +157,24 @@ namespace Cartesian3D void Add( const StdMeshers::Cartesian3D::E_IntersectPoint* ip ); void clear(); + + friend std::ostream& operator<<(std::ostream& os, const _Node& node) + { + if (node._node) + { + os << "Node at hexahedron corner: "; + node._node->Print(os); + } + else if (node._intPoint && node._intPoint->_node) + { + os << "Node at intersection point: "; + node._intPoint->_node->Print(os); // intersection point + } + else + os << "mesh node is null\n"; + + return os; + } }; // -------------------------------------------------------------------------------- @@ -172,6 +190,25 @@ namespace Cartesian3D _Link(): _nodes{ 0, 0 }, _faces{ 0, 0 } {} void clear(); + + friend std::ostream& operator<<(std::ostream& os, const _Link& link) + { + os << "Link:\n"; + + for (std::size_t i = 0; i < nodesNum; ++i) + { + if (link._nodes[i]) + os << *link._nodes[i]; + else + os << "link node with index " << i << " is null\n"; + } + + os << "_fIntPoints: " << link._fIntPoints.size() << '\n'; + os << "_fIntNodes: " << link._fIntNodes.size() << '\n'; + os << "_splits: " << link._splits.size() << '\n'; + + return os; + } }; // -------------------------------------------------------------------------------- @@ -241,6 +278,16 @@ namespace Cartesian3D } } } + + friend std::ostream& operator<<(std::ostream& os, const _OrientedLink& link) + { + if (link._link) + os << "Oriented " << *link._link; + else + os << "Oriented link is null\n"; + + return os; + } }; // -------------------------------------------------------------------------------- @@ -314,6 +361,34 @@ namespace Cartesian3D _polyLinks.push_back( l ); _links.push_back( _OrientedLink( &_polyLinks.back() )); } + + friend std::ostream& operator<<(std::ostream& os, const _Face& face) + { + os << "Face " << face._name << '\n'; + + os << "Links on GridLines: \n"; + for (const auto& link : face._links) + { + os << link; + } + + os << "Links added to close a polygonal face: \n"; + for (const auto& link : face._polyLinks) + { + os << link; + } + + os << "Nodes at intersection with EDGEs: \n"; + for (const auto node : face._eIntNodes) + { + if (node) + { + os << *node; + } + } + + return os; + } }; // -------------------------------------------------------------------------------- -- 2.39.2