Version: 9.16.0
StdMeshers_BlockRenumber.hxx
Go to the documentation of this file.
1// Copyright (C) 2007-2026 CEA, EDF, OPEN CASCADE
2//
3// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5//
6// This library is free software; you can redistribute it and/or
7// modify it under the terms of the GNU Lesser General Public
8// License as published by the Free Software Foundation; either
9// version 2.1 of the License, or (at your option) any later version.
10//
11// This library is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14// Lesser General Public License for more details.
15//
16// You should have received a copy of the GNU Lesser General Public
17// License along with this library; if not, write to the Free Software
18// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19//
20// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21//
22
23// SMESH SMESH : implementation of SMESH idl descriptions
24// File : StdMeshers_BlockRenumber.hxx
25// Author : Edward AGAPOV, OCC
26// Module : SMESH
27//
28#ifndef _SMESH_BlockRenumber_HXX_
29#define _SMESH_BlockRenumber_HXX_
30
31#include "SMESH_StdMeshers.hxx"
32
34#include "SMESH_Hypothesis.hxx"
35#include "SMESH_MeshEditor.hxx"
36
37#include <NCollection_DataMap.hxx>
38#include <TopTools_MapOfShape.hxx>
39#include <TopoDS_Vertex.hxx>
40
41#include <boost/serialization/vector.hpp>
42#include <map>
43
44class SMESH_Mesh;
45class TopoDS_Shape;
46class TopoDS_TShape;
47class TopoDS_Vertex;
48
49// =========================================================
50struct StdMeshers_BlockCS // Local coordinate system of a block
51{
52 std::string _solid;
53 std::string _vertex000;
54 std::string _vertex001;
55
56 bool operator==( const StdMeshers_BlockCS& other ) const
57 {
58 return ( _solid == other._solid &&
59 _vertex000 == other._vertex000 &&
60 _vertex001 == other._vertex001 );
61 }
62};
63
64// =========================================================
69// =========================================================
70
72{
73public:
74 StdMeshers_BlockRenumber(int hypId, SMESH_Gen * gen);
75
76 void SetBlocksOrientation( std::vector< StdMeshers_BlockCS > & blockCS );
77
78 const std::vector< StdMeshers_BlockCS > & GetBlocksOrientation() const { return _blockCS; }
79
80 virtual std::ostream & SaveTo(std::ostream & save) override;
81 virtual std::istream & LoadFrom(std::istream & load) override;
82
89 bool SetParametersByMesh(const SMESH_Mesh* /*mesh*/, const TopoDS_Shape& /*shape*/) override
90 { return false; }
91
96 bool SetParametersByDefaults(const TDefaults& /*dflts*/, const SMESH_Mesh* /*mesh*/=0) override
97 { return false; }
98
99 public:
100
104 SMESH_ComputeErrorPtr CheckHypothesis(SMESH_Mesh& theMesh, const TopoDS_Shape& theShape) const;
105
109 bool IsSolidIncluded( SMESH_Mesh& mesh,
110 const TopoDS_Shape& solid,
111 TopoDS_Vertex& vertex000,
112 TopoDS_Vertex& vertex001 ) const;
113
114 private:
115
116 // Persistence: define both input and output at once
117 friend class boost::serialization::access;
118 template<class Archive> void serialize( Archive & ar, const unsigned int /*version*/ )
119 {
120 ar & _blockCS;
121 }
122
123 protected:
124
125 std::vector< StdMeshers_BlockCS > _blockCS;
126
127 typedef NCollection_DataMap< TopoDS_Shape, std::pair< TopoDS_Vertex, TopoDS_Vertex > > TSolid2VV;
128 TSolid2VV _solids2vertices; // shapes defined by _blockCS, non-persistent
129};
130
131// =========================================================
136{
137public:
138
140 const StdMeshers_BlockRenumber* hyp);
144 static TopoDS_Vertex GetVertex000( const TopTools_MapOfShape& cornerVertices );
145
149 static TopoDS_Vertex GetVertexAtPoint( const TopoDS_Shape& solid, const TopoDS_Shape& point );
150
154 void AddReplacingNode( const SMDS_MeshNode* & oldNode );
155
159 void DoReplaceNodes();
160
161private:
162
165
167 std::list< const SMDS_MeshNode* > _newOldNodes;
168};
169
170#endif
boost::shared_ptr< SMESH_ComputeError > SMESH_ComputeErrorPtr
Definition: SMESH_ComputeError.hxx:38
#define STDMESHERS_EXPORT
Definition: SMESH_StdMeshers.hxx:38
Definition: SMDS_MeshNode.hxx:36
virtual std::istream & LoadFrom(std::istream &load)=0
virtual std::ostream & SaveTo(std::ostream &save)=0
Definition: SMESH_Gen.hxx:68
Definition: SMESH_Hypothesis.hxx:48
std::list< std::list< const SMDS_MeshNode * > > TListOfListOfNodes
Definition: SMESH_MeshEditor.hxx:521
Definition: SMESH_Mesh.hxx:80
Definition: StdMeshers_BlockRenumber.hxx:72
const std::vector< StdMeshers_BlockCS > & GetBlocksOrientation() const
Definition: StdMeshers_BlockRenumber.hxx:78
void serialize(Archive &ar, const unsigned int)
Definition: StdMeshers_BlockRenumber.hxx:118
bool SetParametersByMesh(const SMESH_Mesh *, const TopoDS_Shape &) override
Initialize Fineness by the mesh built on the geometry.
Definition: StdMeshers_BlockRenumber.hxx:89
TSolid2VV _solids2vertices
Definition: StdMeshers_BlockRenumber.hxx:128
std::vector< StdMeshers_BlockCS > _blockCS
Definition: StdMeshers_BlockRenumber.hxx:125
NCollection_DataMap< TopoDS_Shape, std::pair< TopoDS_Vertex, TopoDS_Vertex > > TSolid2VV
Definition: StdMeshers_BlockRenumber.hxx:127
bool SetParametersByDefaults(const TDefaults &, const SMESH_Mesh *=0) override
Initialize my parameter values by default parameters.
Definition: StdMeshers_BlockRenumber.hxx:96
Help in using StdMeshers_BlockRenumber.
Definition: StdMeshers_BlockRenumber.hxx:136
void DoReplaceNodes()
Replace old nodes by new ones.
Definition: StdMeshers_BlockRenumber.cxx:270
SMESH_MeshEditor::TListOfListOfNodes _nodesToMerge
Definition: StdMeshers_BlockRenumber.hxx:166
void AddReplacingNode(const SMDS_MeshNode *&oldNode)
Create a copy of an old node and remember this couple of nodes for replacement.
Definition: StdMeshers_BlockRenumber.cxx:233
std::list< const SMDS_MeshNode * > _newOldNodes
Definition: StdMeshers_BlockRenumber.hxx:167
static TopoDS_Vertex GetVertexAtPoint(const TopoDS_Shape &solid, const TopoDS_Shape &point)
Find a vertex of a solid located at the given point.
Definition: StdMeshers_BlockRenumber.cxx:210
static TopoDS_Vertex GetVertex000(const TopTools_MapOfShape &cornerVertices)
Find default vertex at (0,0,0) local position.
Definition: StdMeshers_BlockRenumber.cxx:184
const StdMeshers_BlockRenumber * _hyp
Definition: StdMeshers_BlockRenumber.hxx:164
StdMeshers_RenumberHelper(SMESH_Mesh &mesh, const StdMeshers_BlockRenumber *hyp)
Definition: StdMeshers_BlockRenumber.cxx:173
SMESH_Mesh * _mesh
Definition: StdMeshers_BlockRenumber.hxx:163
Definition: SMESH_Hypothesis.hxx:100
Definition: StdMeshers_BlockRenumber.hxx:51
std::string _vertex000
Definition: StdMeshers_BlockRenumber.hxx:53
bool operator==(const StdMeshers_BlockCS &other) const
Definition: StdMeshers_BlockRenumber.hxx:56
std::string _vertex001
Definition: StdMeshers_BlockRenumber.hxx:54
std::string _solid
Definition: StdMeshers_BlockRenumber.hxx:52