MAGiC  V5.0
Mailleurs Automatiques de Géometries intégrés à la Cao
CAD4FE_LoopCriteria.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 //####// CAD4FE_LoopCriteria.cpp
15 //####//
16 //####//------------------------------------------------------------
17 //####//------------------------------------------------------------
18 //####// COPYRIGHT 2000-2024
19 //####// jeu 13 jun 2024 11:58:56 EDT
20 //####//------------------------------------------------------------
21 //####//------------------------------------------------------------
22 
23 
24 #include "gestionversion.h"
25 #include <mg_geometrie.h>
26 #include <mg_maillage.h>
27 #include <mg_maillage_outils.h>
28 #include <ot_mathematique.h>
29 #include <ot_quadrature_gauss.h>
30 
31 #include "CAD4FE_MCEdge.h"
32 #include "CAD4FE_MCFace.h"
33 #include "CAD4FE_PolyCurve.h"
34 #include "CAD4FE_MCAA.h"
35 #include "CAD4FE_MCBody.h"
36 #include "CAD4FE_mg_utils.h"
39 
40 #pragma hdrstop
41 
42 #include "CAD4FE_LoopCriteria.h"
43 
44 
45 #pragma package(smart_init)
46 
47 using namespace CAD4FE;
48 
49 LoopCriteria::LoopCriteria(MCAA * __mcaa, MCFace * __mcFace, std::vector < MCEdge * > __loop, int __nbSegMin)
50 : _loop(__loop), _mcaa(__mcaa), _mcFace(__mcFace)
51 {
52  _nbSegMin = __nbSegMin;
53  Update();
54 }
55 
57 {
58  MCEdge * mcEdge; MG_ARETE * refEdge; PolyCurve * pc;
59  if (_mcFace->get_nb_ccf() != 0)
60  {
61  _score = 0;
62  return;
63  }
64 
65  for (unsigned itMCEdge = 0; itMCEdge < _loop.size(); itMCEdge++)
66  {
67  mcEdge = _loop[itMCEdge];
68  if (mcEdge->get_nb_ccf() != 0)
69  {
70  _score = 0;
71  return;
72  }
73  }
74 
75  _nbSeg=0;
76  for (unsigned itMCEdge = 0; itMCEdge < _loop.size(); itMCEdge++){
77  MCEdge * mcEdge = _loop[itMCEdge];
79  }
80 
81  if ( _nbSeg < _nbSegMin )
82  {
83  _score = 1-((double)_nbSeg)/_nbSegMin;
84  }
85  else
86  {
87  _score = 0;
88  }
89 }
90 
92 {
93  return _nbSeg;
94 }
95 
97 {
98  return _nbSegMin;
99 }
100 
101 double LoopCriteria::EdgeSplitScore(MCEdge * __mcEdge, double __splitPoint[3])
102 {
103  std::vector<MCVertex*> extremities;
104  _mcaa->GetMCBody()->Edge_GetVertices(__mcEdge, extremities);
105  if (! (extremities.size () == 1 || (extremities.size()==2 && extremities[0] == extremities[1])))
106  return 0;
107 
108 
109  int mcEdgeSegCount = _mcaa->GetFEMeshSegmentCount(__mcEdge);
110 
111  if ( mcEdgeSegCount >= 2 )
112  {
113  double L = __mcEdge->GetPolyCurve()->get_longueur();
114  double xyz[3];
115  __mcEdge->evaluer(.5*L,xyz);
116  double meshSize = _mcaa->GetSize(xyz);
117  __mcEdge->evaluer(meshSize,__splitPoint);
118  return 1;
119  }
120 
121  return 0;
122 }
123 
125 {
126  return _score;
127 }
128 
129 std::vector < MCEdge * > & LoopCriteria::GetLoop()
130 {
131  return _loop;
132 }
133 
135 {
136  return _mcFace;
137 }
CAD4FE::LoopCriteria::_nbSegMin
int _nbSegMin
Definition: CAD4FE_LoopCriteria.h:51
CAD4FE::LoopCriteria::_loop
std::vector< MCEdge * > _loop
Definition: CAD4FE_LoopCriteria.h:49
CAD4FE::PolyCurve::get_longueur
double get_longueur(double __s_min=-1, double __s_max=-1, double precision=1E-6)
Definition: CAD4FE_PolyCurve.cpp:669
CAD4FE_MCBody.h
mg_geometrie.h
CAD4FE::MCAA::GetSize
double GetSize(double xyz[3])
Definition: CAD4FE_MCAA.cpp:923
gestionversion.h
CAD4FE::LoopCriteria::LoopCriteria
LoopCriteria(MCAA *__mcaa, MCFace *__mcFace, std::vector< MCEdge * > __loop, int __nbSegMin=3)
Definition: CAD4FE_LoopCriteria.cpp:49
MG_ARETE::evaluer
virtual void evaluer(double t, double *xyz)
Definition: mg_arete.cpp:143
CAD4FE::PolyCurve
Definition: CAD4FE_PolyCurve.h:38
CAD4FE::MCAA
Definition: CAD4FE_MCAA.h:73
CAD4FE::MCBody::Edge_GetVertices
void Edge_GetVertices(MCEdge *, std::vector< MCVertex * > &__mcVertices)
Definition: CAD4FE_MCBody.cpp:1224
CAD4FE_Intersection_Plane_MG_MAILLAGE.h
CAD4FE::LoopCriteria::GetNbFEMeshSeg
int GetNbFEMeshSeg()
Definition: CAD4FE_LoopCriteria.cpp:91
mg_maillage_outils.h
CAD4FE::LoopCriteria::Update
void Update()
Definition: CAD4FE_LoopCriteria.cpp:56
CAD4FE_LoopCriteria.h
MG_ELEMENT_TOPOLOGIQUE::get_nb_ccf
virtual int get_nb_ccf(void)
Definition: mg_element_topologique.cpp:154
CAD4FE::MCAA::GetFEMeshSegmentCount
int GetFEMeshSegmentCount(MCEdge *__mcEdge)
Definition: CAD4FE_MCAA.cpp:743
CAD4FE::LoopCriteria::_mcFace
MCFace * _mcFace
Definition: CAD4FE_LoopCriteria.h:48
CAD4FE::LoopCriteria::GetFace
MCFace * GetFace()
Definition: CAD4FE_LoopCriteria.cpp:134
CAD4FE_MCAA.h
CAD4FE::LoopCriteria::_mcaa
MCAA * _mcaa
Definition: CAD4FE_LoopCriteria.h:47
ot_mathematique.h
CAD4FE_MCEdge.h
CAD4FE::LoopCriteria::_nbSeg
int _nbSeg
Definition: CAD4FE_LoopCriteria.h:52
CAD4FE::MCAA::GetMCBody
MCBody * GetMCBody() const
Definition: CAD4FE_MCAA.cpp:622
CAD4FE::MCEdge
Definition: CAD4FE_MCEdge.h:48
mg_maillage.h
CAD4FE_PolyCurve.h
CAD4FE::LoopCriteria::GetLoop
std::vector< MCEdge * > & GetLoop()
Definition: CAD4FE_LoopCriteria.cpp:129
ot_algorithme_geometrique.h
CAD4FE
Definition: CAD4FE_ClosestPoint_Segment_MG_ARETE.h:34
CAD4FE::LoopCriteria::DeletionScore
double DeletionScore()
Definition: CAD4FE_LoopCriteria.cpp:124
CAD4FE::LoopCriteria::_score
double _score
Definition: CAD4FE_LoopCriteria.h:46
CAD4FE::MCEdge::GetPolyCurve
PolyCurve * GetPolyCurve()
Definition: CAD4FE_MCEdge.cpp:98
MG_ARETE
Definition: mg_arete.h:36
ot_quadrature_gauss.h
CAD4FE::MCFace
Definition: CAD4FE_MCFace.h:50
CAD4FE_MCFace.h
CAD4FE::LoopCriteria::GetNbFEMeshSegMin
int GetNbFEMeshSegMin()
Definition: CAD4FE_LoopCriteria.cpp:96
CAD4FE::LoopCriteria::EdgeSplitScore
double EdgeSplitScore(MCEdge *__mcEdge, double __splitPoint[3])
Definition: CAD4FE_LoopCriteria.cpp:101
CAD4FE_mg_utils.h