MAGiC  V5.0
Mailleurs Automatiques de Géometries intégrés à la Cao
CAD4FE_MCEdge.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_MCEdge.cpp
15 //####//
16 //####//------------------------------------------------------------
17 //####//------------------------------------------------------------
18 //####// COPYRIGHT 2000-2024
19 //####// jeu 13 jun 2024 11:58:53 EDT
20 //####//------------------------------------------------------------
21 //####//------------------------------------------------------------
22 #pragma hdrstop
23 
24 #include "gestionversion.h"
25 
26 #include "CAD4FE_MCEdge.h"
27 #include "math.h"
28 #include "CAD4FE_MCVertex.h"
29 #include "CAD4FE_MCFace.h"
30 #include "CAD4FE_PolyCurve.h"
32 
33 #include <sstream>
34 #include <string>
35 
36 #ifdef __BORLANDC__
37 #pragma warn -8012
38 #pragma warn -8037
39 #endif
40 
41 using namespace CAD4FE;
42 
44  : MG_ARETE(std::string("MC")+std::string(__refEdge->get_idoriginal()), new PolyCurve(__refEdge), 1)
45 {
46  time = 0;
47  transfert_ccf(*__refEdge);
48 }
49 
50 MCEdge::MCEdge(std::string __idOriginal, PolyCurve * __polycurve)
51 : MG_ARETE(__idOriginal, (PolyCurve*)__polycurve, 1)
52 {
53  time = 0;
54 }
55 
57 {
58 }
59 
60 MCEdge::MCEdge(std::string __idoriginal, MCEdge & __A, MCEdge & __B)
61 : MG_ARETE(__idoriginal, new PolyCurve(), 1)
62 {
63  time = 0;
64 
65  GetPolyCurve()->Merge (*__A.GetPolyCurve());
66  GetPolyCurve()->Merge (*__B.GetPolyCurve());
67  transfert_ccf(__A);
68  transfert_ccf(__B);
69 
70  _CopyMeshLink(__A);
71  _CopyMeshLink(__B);
72 }
73 
74 void MCEdge::_CopyMeshLink( MCEdge & __mcEdge)
75 {
76  int i;
79 
80  for (MG_ELEMENT_MAILLAGE* element = lien_maillage->get_premier(it);element;element = lien_maillage->get_suivant(it))
81  {
82  element->change_lien_topologie2(this);
83  get_lien_maillage()->ajouter(element);
84 
85  MG_SEGMENT * seg = (MG_SEGMENT *) element;
86  MG_NOEUD * nos[2];
87  nos[0] = seg->get_noeud1();
88  nos[1] = seg->get_noeud2();
89  for (i=0; i<2; i++)
90  {
91  if (!nos[i]->get_lien_topologie() || nos[i]->get_lien_topologie()->get_dimension() >= 1)
92  nos[i]->change_lien_topologie2(this);
93  }
94  }
95 }
96 
97 PolyCurve *
99 {
100  return (PolyCurve *) get_courbe();
101 }
102 
103 int
105 {
106  if (get_nb_mg_coarete() != 2)
107  return 0;
108 
109  if (get_mg_coarete(0)->get_boucle() == get_mg_coarete(1)->get_boucle())
110  return 1;
111  else
112  return 0;
113 }
114 
115 void MCEdge::enregistrer(std::ostream& o,double version)
116 {
117  int nb=get_nb_ccf();
118  o << "%" << get_id() << "=CAD4FE_MCEDGE("<< get_idoriginal() << ",$" << get_courbe()->get_id() << ",$"<<get_cosommet1()->get_id() << ",$" <<get_cosommet2()->get_id() << "," << get_orientation() << "," << nb;
119  if (nb!=0)
120  {
121  o << ",(";
122  for (int i=0;i<nb;i++)
123  {
124  char nom[3];
125  get_type_ccf(i,nom);
126  o << "(" << nom << "," << get_valeur_ccf(i) << ")";
127  if (i!=nb-1) o << "," ;
128  }
129  o << ")";
130  }
131  o << ");" << std::endl;
132 }
133 
void _CopyMeshLink(MCEdge &)
virtual void enregistrer(std::ostream &o, double version)
MCEdge(MG_ARETE *__refEdge)
PolyCurve * GetPolyCurve()
void Merge(PolyCurve &)
virtual int get_orientation(void)
Definition: mg_arete.cpp:93
virtual class MG_COURBE * get_courbe(void)
Definition: mg_arete.cpp:89
virtual MG_COARETE * get_mg_coarete(int num)
Definition: mg_arete.cpp:228
virtual class MG_COSOMMET * get_cosommet2(void)
Definition: mg_arete.cpp:85
virtual class MG_COSOMMET * get_cosommet1(void)
Definition: mg_arete.cpp:81
virtual int get_nb_mg_coarete(void)
Definition: mg_arete.cpp:106
MG_ELEMENT_TOPOLOGIQUE * get_lien_topologie(void)
virtual void transfert_ccf(MG_ELEMENT_TOPOLOGIQUE &a1)
virtual TPL_SET< MG_ELEMENT_MAILLAGE * > * get_lien_maillage(void)
virtual std::string get_idoriginal(void)
virtual bool get_valeur_ccf(char *nom, double &val)
TPL_SET< MG_ELEMENT_MAILLAGE * > lien_maillage
virtual int get_dimension(void)=0
virtual void get_type_ccf(int num, char *nom)
unsigned long get_id()
virtual MG_NOEUD * get_noeud1(void)
Definition: mg_segment.cpp:108
virtual MG_NOEUD * get_noeud2(void)
Definition: mg_segment.cpp:113
X get_premier(ITERATEUR &it)
Definition: tpl_set.h:99
void ajouter(X x)
Definition: tpl_set.h:55
X get_suivant(ITERATEUR &it)
Definition: tpl_set.h:107