MAGiC  V5.0
Mailleurs Automatiques de Géometries intégrés à la Cao
occ_fonction_v2015.cpp
Aller à la documentation de ce fichier.
1 //####//------------------------------------------------------------
2 //####//------------------------------------------------------------
3 //####// MAGiC
4 //####// Jean Christophe Cuilliere et Vincent FRANCOIS
5 //####// Departement de Genie Mecanique - UQTR
6 //####//------------------------------------------------------------
7 //####// MAGIC est un projet de recherche de l equipe ERICCA
8 //####// du departement de genie mecanique de l Universite du Quebec a Trois Rivieres
9 //####// http://www.uqtr.ca/ericca
10 //####// http://www.uqtr.ca/
11 //####//------------------------------------------------------------
12 //####//------------------------------------------------------------
13 //####//
14 //####// occ_fonction_v2015.cpp
15 //####//
16 //####//------------------------------------------------------------
17 //####//------------------------------------------------------------
18 //####// COPYRIGHT 2000-2024
19 //####// jeu 13 jun 2024 11:58:55 EDT
20 //####//------------------------------------------------------------
21 //####//------------------------------------------------------------
22 
23 
24 #include "gestionversion.h"
25 #ifdef BREP_OCC
26 #pragma hdrstop
27 
28 #include <TopExp_Explorer.hxx>
29 #include "occ_fonction_v2015.h"
30 #include "tpl_map_entite.h"
31 #include "tpl_liste_entite.h"
32 #include "mg_sommet.h"
33 #include "mg_face.h"
34 #pragma package(smart_init)
36 {
37  indexation=false;
38 }
39 
41 {
42 
43 }
44 
45 int OCC_FONCTION_V2015::get_nb_element_topo(TopoDS_Shape& shape,TopAbs_ShapeEnum shape_type)
46 {
47  TopExp_Explorer Ex;
48  int nb=0;
49  for (Ex.Init(shape,shape_type);Ex.More(); Ex.Next())
50  {
51  nb++;
52  }
53  return nb;
54 }
55 
56 void OCC_FONCTION_V2015::indexation_topo(TopoDS_Shape& shape, TopAbs_ShapeEnum shape_type)
57 {
58  TopExp_Explorer topexp;
59  for(topexp.Init(shape,shape_type);topexp.More();topexp.Next())
60  {
61  Standard_Integer index = myShapes.FindIndex(topexp.Current());
62  if(index==0)
63  {
64  myShapes.Add(topexp.Current());
65  }
66  }
67 }
68 
70 {
71  indexation_topo(ashape,TopAbs_COMPOUND);
72  indexation_topo(ashape,TopAbs_COMPSOLID);
73  indexation_topo(ashape,TopAbs_SOLID);
74  indexation_topo(ashape,TopAbs_SHELL);
75  indexation_topo(ashape,TopAbs_FACE);
76  indexation_topo(ashape,TopAbs_WIRE);
77  indexation_topo(ashape,TopAbs_EDGE);
78  indexation_topo(ashape,TopAbs_VERTEX);
79 }
80 
81 int OCC_FONCTION_V2015::GetID(const TopoDS_Shape &shape)
82 {
83  if(indexation==false) indexation_topologies();
84  if (shape.IsNull()) return 0;
85  return myShapes.FindIndex(shape);
86 }
87 
88 void OCC_FONCTION_V2015::marquer_sommet_pole(MG_FACE* face, double precision)
89 {
90  TPL_MAP_ENTITE<MG_SOMMET*> map_sommet;
92  face->get_topologie_sousjacente(&map_element_topo);
94  for(MG_ELEMENT_TOPOLOGIQUE* ele = map_element_topo.get_premier(it_ele_topo);ele!=NULL;ele=map_element_topo.get_suivant(it_ele_topo))
95  {
96  if(ele->get_dimension()==0) map_sommet.ajouter((MG_SOMMET*)ele);
97  }
98  std::vector<double> liste_pole_face;
99  face->get_liste_pole_uv(&liste_pole_face,precision);
101  for(int i=0;i<liste_pole_face.size();i=i+2)
102  {
103  for(MG_SOMMET* sommet=map_sommet.get_premier(it_sommet);sommet!=NULL;sommet=map_sommet.get_suivant(it_sommet))
104  {
105  double xyz_pole[3];
106  double uv[2]={liste_pole_face[i],liste_pole_face[i+1]};
107  face->evaluer(uv,xyz_pole);
108  double xyz_sommet[3];
109  sommet->get_point()->evaluer(xyz_sommet);
110  if(OPERATEUR::egal(xyz_pole[0],xyz_sommet[0],precision) &&
111  OPERATEUR::egal(xyz_pole[1],xyz_sommet[1],precision) &&
112  OPERATEUR::egal(xyz_pole[2],xyz_sommet[2],precision))
113  {
114  sommet->change_pole(true);
115  }
116  }
117  }
118 }
119 
121 {
122  return "OCCV2015";
123 }
124 
125 
126 
127 
128 
129 
130 
131 
132 
133 
134 
135 
136 
137 
138 
139 
140 
141 #endif
OCC_FONCTION_V2015::get_nb_element_topo
int get_nb_element_topo(TopoDS_Shape &shape, TopAbs_ShapeEnum shape_type)
Definition: occ_fonction_v2015.cpp:45
TPL_MAP_ENTITE::get_premier
virtual X get_premier(ITERATEUR &it)
Definition: tpl_map_entite.h:112
OCC_FONCTION_V2015::marquer_sommet_pole
virtual void marquer_sommet_pole(class MG_FACE *face, double precision=1.0e-06)
Definition: occ_fonction_v2015.cpp:88
OCC_FONCTION_V2015::indexation_topologies
void indexation_topologies(void)
Definition: occ_fonction_v2015.cpp:69
gestionversion.h
OCC_FONCTION_V2015::GetID
virtual int GetID(const TopoDS_Shape &shape)
Definition: occ_fonction_v2015.cpp:81
TPL_MAP_ENTITE
Definition: tpl_map_entite.h:35
MG_FACE::get_topologie_sousjacente
virtual void get_topologie_sousjacente(TPL_MAP_ENTITE< MG_ELEMENT_TOPOLOGIQUE * > *lst)
Definition: mg_face.cpp:114
MG_ELEMENT_TOPOLOGIQUE
Definition: mg_element_topologique.h:51
OCC_FONCTION::ashape
TopoDS_Shape ashape
Definition: occ_fonction.h:59
MG_FACE::get_liste_pole_uv
virtual void get_liste_pole_uv(std::vector< double > *liste_pole_uv, double eps)
Definition: mg_face.cpp:427
MG_FACE::evaluer
virtual void evaluer(double *uv, double *xyz)
Definition: mg_face.cpp:192
OPERATEUR::egal
static int egal(double a, double b, double eps)
Definition: ot_mathematique.cpp:1629
OCC_FONCTION_V2015::indexation_topo
void indexation_topo(TopoDS_Shape &shape, TopAbs_ShapeEnum shape_type)
Definition: occ_fonction_v2015.cpp:56
occ_fonction_v2015.h
OCC_FONCTION::myShapes
TopTools_IndexedMapOfShape myShapes
Definition: occ_fonction.h:62
tpl_map_entite.h
TPL_MAP_ENTITE::ITERATEUR
std::map< unsigned long, X, std::less< unsigned long > >::iterator ITERATEUR
Definition: tpl_map_entite.h:38
OCC_FONCTION::precision
double precision
Definition: occ_fonction.h:64
OCC_FONCTION_V2015::get_version
virtual std::string get_version(void)
Definition: occ_fonction_v2015.cpp:120
OCC_FONCTION_V2015::OCC_FONCTION_V2015
OCC_FONCTION_V2015(void)
Definition: occ_fonction_v2015.cpp:35
OCC_FONCTION_V2015::~OCC_FONCTION_V2015
virtual ~OCC_FONCTION_V2015(void)
Definition: occ_fonction_v2015.cpp:40
TPL_MAP_ENTITE::ajouter
virtual void ajouter(X x)
Definition: tpl_map_entite.h:55
mg_sommet.h
MG_FACE
Definition: mg_face.h:34
TPL_MAP_ENTITE::get_suivant
virtual X get_suivant(ITERATEUR &it)
Definition: tpl_map_entite.h:120
MG_SOMMET
Definition: mg_sommet.h:35
OCC_FONCTION
Definition: occ_fonction.h:40
mg_face.h
tpl_liste_entite.h
OCC_FONCTION_V2015::indexation
bool indexation
Definition: occ_fonction_v2015.h:60