ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/lib/geometrie/src/CAD4FE_MCFace.cpp
Revision: 27
Committed: Thu Jul 5 15:26:40 2007 UTC (17 years, 10 months ago) by foucault
Original Path: magic/lib/geometrie/geometrie/src/CAD4FE_MCFace.cpp
File size: 4100 byte(s)
Log Message:

File Contents

# User Rev Content
1 foucault 27 //---------------------------------------------------------------------------
2    
3     #pragma hdrstop
4    
5     #include "CAD4FE_MCFace.h"
6     #include "CAD4FE_PolySurface.h"
7     #include "CAD4FE_MCEdge.h"
8     #include "CAD4FE_MCVertex.h"
9     #include "ot_algorithme_geometrique.h"
10     //---------------------------------------------------------------------------
11     #pragma package(smart_init)
12    
13     #ifdef __BORLANDC__
14     #pragma warn -8012
15     #pragma warn -8037
16     #endif
17    
18     using namespace CAD4FE;
19    
20     MCFace::MCFace(MG_FACE * __mgFace)
21     : MG_FACE (std::string("MC")+std::string(__mgFace->get_idoriginal()), new PolySurface(__mgFace), 1)
22     {
23     time = 0;
24     #define debug 0
25     }
26    
27     MCFace::MCFace( MCFace & __src) : MG_FACE(*this)
28     {
29     time = 0;
30     }
31    
32    
33     MCFace::MCFace( std::string & __idOriginal, PolySurface * __polySurface)
34     : MG_FACE(std::string(__idOriginal), __polySurface, 1)
35     {
36     time = 0;
37     }
38    
39    
40     MCFace::MCFace(MCFace & __a, MCFace & __b)
41     : MG_FACE(std::string(__a.get_idoriginal())+std::string("+")+std::string(__b.get_idoriginal()), new PolySurface(), 1)
42     {
43     time = 0;
44    
45     GetPolySurface()->Merge(*__a.GetPolySurface());
46     GetPolySurface()->Merge(*__b.GetPolySurface());
47    
48     _CopyMeshLink (__a);
49     _CopyMeshLink (__b);
50     }
51    
52     void MCFace::_CopyMeshLink( MCFace & __mcFace)
53     {
54     unsigned i,j,k;
55    
56     //this->get_lien_maillage()->ajouter(*(__mcFace.get_lien_maillage()));
57     TPL_SET<MG_ELEMENT_MAILLAGE*> * lien_maillage = __mcFace.get_lien_maillage();
58     TPL_SET<MG_ELEMENT_MAILLAGE*>::ITERATEUR it;
59     for (MG_ELEMENT_MAILLAGE* element = lien_maillage->get_premier(it); element != NULL; element = lien_maillage->get_suivant(it))
60     {
61     element->change_lien_topologie2(this);
62     this->get_lien_maillage()->ajouter(element);
63    
64     MG_TRIANGLE * triangle = (MG_TRIANGLE *)element;
65     MG_SEGMENT * segs[3]={0,0,0};
66     segs[0] = triangle->get_segment1();
67     segs[1] = triangle->get_segment2();
68     segs[2] = triangle->get_segment3();
69     MG_NOEUD * nodes[3]={0,0,0};
70     nodes[0] = triangle->get_noeud1();
71     nodes[1] = triangle->get_noeud2();
72     nodes[2] = triangle->get_noeud3();
73     for (i=0; i<3; i++)
74     {
75     if (!segs[i]->get_lien_topologie() || segs[i]->get_lien_topologie()->get_dimension() >= 2)
76     {
77     segs[i]->change_lien_topologie2(this);
78     }
79     if (!nodes[i]->get_lien_topologie() || nodes[i]->get_lien_topologie()->get_dimension() >= 2)
80     {
81     nodes[i]->change_lien_topologie2(this);
82     }
83     }
84     }
85     }
86    
87     MCFace::~MCFace()
88     {
89     }
90    
91     PolySurface * MCFace::GetPolySurface ()
92     {
93     return (PolySurface*)get_surface();
94     }
95    
96     void MCFace::enregistrer(std::ostream& o)
97     {
98     o << "%" << get_id() << "=CAD4FE_MCFACE("<< get_idoriginal() << ",$" << get_surface()->get_id() << ",(";
99     for (unsigned int i=0;i<get_nb_mg_boucle();i++)
100     {
101     o << "$" << get_mg_boucle(i)->get_id();
102     if (i!=get_nb_mg_boucle()-1) o << ","; else o << ")";
103     }
104     int nb=get_nb_ccf();
105     o << "," << get_orientation() << "," << nb;
106     if (nb!=0)
107     {
108     o << ",(";
109     for (int i=0;i<nb;i++)
110     {
111     char nom[3];
112     get_type_ccf(i,nom);
113     o << "(" << nom << "," << get_valeur_ccf(i) << ")";
114     if (i!=nb-1) o << "," ;
115     }
116     o << ")";
117     }
118     o << ");" << std::endl;
119     }
120    
121     void MCFace::calcul_normale_unitaire(MG_SOMMET *v, double __n[3], int * __nbRefFace)
122     {
123     GetPolySurface()->calcul_normale_unitaire(v,__n,__nbRefFace);
124     }
125    
126     void MCFace::calcul_normale_unitaire(MCVertex * __mcVertex, double __n[3], int *__nbRefFace)
127     {
128     GetPolySurface()->calcul_normale_unitaire(__mcVertex,__n,__nbRefFace);
129     }
130    
131     void MCFace::calcul_normale_unitaire(const std::map<MG_FACE *, OT_VECTEUR_3D > & __tabRefFaceUV, double __n[3], int *__nbRefFace)
132     {
133     GetPolySurface()->calcul_normale_unitaire(__tabRefFaceUV,__n,__nbRefFace);
134     }
135    
136