2 // C++ : La clase principale de Hexa
4 // Copyright (C) 2009-2016 CEA/DEN, EDF R&D
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 #include "HexDocument.hxx"
25 #include "HexEltBase.hxx"
26 #include "HexVertex.hxx"
27 #include "HexEdge.hxx"
28 #include "HexQuad.hxx"
29 #include "HexHexa.hxx"
31 #include "HexElements.hxx"
33 #include "HexVector.hxx"
34 #include "HexMatrix.hxx"
35 #include "HexCloner.hxx"
36 #include "HexPropagation.hxx"
39 #include "HexXmlWriter.hxx"
40 #include "HexXmlTree.hxx"
41 #include "HexGlobale.hxx"
42 #include "HexGroup.hxx"
44 #include "HexNewShape.hxx"
46 void test_six (Hex::Document* docu, int option);
50 int Document::doc_number = 0;
52 // ======================================================== Constructeur
53 Document::Document (cpchar name, Hex* dad)
57 glob = Globale::getInstance ();
67 maj_propagation = true;
70 nbr_used_hexas = nbr_used_quads = nbr_used_edges = nbr_used_vertex = 0;
72 for (EnumElt type = EL_NONE ; type < EL_MAXI ; type=(EnumElt) (type+1))
74 doc_first_elt [type] = doc_last_elt [type] = new EltBase ();
75 doc_nbr_elt [type] = 0;
79 strcpy (doc_ident, "doc");
81 sprintf (doc_ident, "doc%02d", doc_number);
85 defaultLaw = addLaw ("DefaultLaw", 0);
88 maj_connection = false;
89 purge_elements = false;
90 holes_elements = false;
93 // ======================================================== Destructeur
94 Document::~Document ()
98 for (EnumElt type = EL_NONE ; type < EL_MAXI ; type=(EnumElt) (type+1))
100 // printf ("____________________________ Type=%d\n", type);
101 EltBase* next = NULL;
102 for (EltBase* elt=doc_first_elt [type] ; elt != NULL ; elt=next)
109 // ======================================================== addVector
110 Vector* Document::addVector (double dx, double dy, double dz)
112 DumpStart ("addVector", dx << dy << dz);
113 Vector* pv = new Vector (this, dx, dy, dz);
114 doc_vector.push_back (pv);
119 // ======================================================== addVectorVertices
120 Vector* Document::addVectorVertices (Vertex* va, Vertex* vb)
122 DumpStart ("addVectorVertices", va << vb);
124 Vector* pv = addVector (vb->getX () - va->getX (),
125 vb->getY () - va->getY (),
126 vb->getZ () - va->getZ ());
131 // ======================================================== addVertex
132 Vertex* Document::addVertex (double x, double y, double z)
134 DumpStart ("addVertex", x << y << z);
136 Vertex* pv = new Vertex (this, x, y, z);
140 // ======================================================== addEdge
141 Edge* Document::addEdge (Vertex* va, Vertex* vb)
143 DumpStart ("addEdge", va << vb );
145 if (va==NULL || vb==NULL)
148 Edge* arete = new Edge (va, vb);
152 // ======================================================== addEdgeVector
153 Edge* Document::addEdgeVector (Vertex* va, Vector* vec)
155 DumpStart ("addEdgeVector", va << vec );
157 Vertex* vb = addVertex (va->getX () + vec->getDx(),
158 va->getY () + vec->getDy(),
159 va->getZ () + vec->getDz());
161 Edge* arete = addEdge (va, vb);
165 // ======================================================== addQuadVertices
166 Quad* Document::addQuadVertices (Vertex* va, Vertex* vb, Vertex* vc, Vertex* vd)
168 DumpStart ("addQuadVertices", va << vb << vc << vd );
170 Quad* face = new Quad (va, vb, vc, vd);
174 // ======================================================== addQuad
175 Quad* Document::addQuad (Edge* ea, Edge* eb, Edge* ec, Edge* ed)
177 DumpStart ("addQuad", ea << eb << ec << ed );
179 Quad* face = new Quad (ea, eb, ec, ed);
183 // ======================================================== addHexaVertices
184 Hexa* Document::addHexaVertices (Vertex* va, Vertex* vb, Vertex* vc, Vertex* vd,
185 Vertex* ve, Vertex* vf, Vertex* vg, Vertex* vh)
187 DumpStart ("addHexaVertices", va << vb << vc << vd << ve << vf << vg << vh);
189 Hexa* pave = new Hexa (va, vb, vc, vd, ve, vf, vg, vh);
193 // ======================================================== addHexa
194 Hexa* Document::addHexa (Quad* qa, Quad* qb, Quad* qc, Quad* qd, Quad* qe,
197 DumpStart ("addHexa", qa << qb << qc << qd << qe << qf );
199 Hexa* pave = new Hexa (qa, qb, qc, qd, qe, qf);
203 // ======================================================== findVertex
204 Vertex* Document::findVertex (double vx, double vy, double vz)
206 DumpStart ("findVertex", vx << vy << vz);
207 Vertex* found = NULL;
209 double xmin = vx - doc_tolerance;
210 double xmax = vx + doc_tolerance;
211 double ymin = vy - doc_tolerance;
212 double ymax = vy + doc_tolerance;
213 double zmin = vz - doc_tolerance;
214 double zmax = vz + doc_tolerance;
216 for (EltBase* elt = doc_first_elt[EL_VERTEX]->next ();
217 elt!= NULL && found == NULL ;
222 Vertex* candidat = static_cast <Vertex*> (elt);
223 if (candidat->isin (xmin, xmax, ymin, ymax, zmin, zmax))
231 // ======================================================== findEdge
232 Edge* Document::findEdge (Vertex* v1, Vertex* v2)
234 DumpStart ("findEdge", v1 << v2);
237 for (EltBase* elt = doc_first_elt[EL_EDGE]->next ();
238 elt!= NULL && found == NULL ;
241 Edge* candidat = static_cast <Edge*> (elt);
242 if (candidat->definedBy (v1, v2))
249 // ======================================================== findQuad
250 Quad* Document::findQuad (Vertex* v1, Vertex* v2)
252 DumpStart ("findQuad", v1 << v2);
255 for (EltBase* elt = doc_first_elt[EL_QUAD]->next ();
256 elt!= NULL && found == NULL ;
259 Quad* candidat = static_cast <Quad*> (elt);
260 if (candidat->definedBy (v1, v2))
267 // ======================================================== findQuad
268 Quad* Document::findQuad (Edge* e1, Edge* e2)
270 DumpStart ("findQuad", e1 << e2);
273 for (EltBase* elt = doc_first_elt[EL_QUAD]->next ();
274 elt!= NULL && found == NULL ;
277 Quad* candidat = static_cast <Quad*> (elt);
278 if (candidat->definedBy (e1, e2))
285 // ======================================================== findHexa
286 Hexa* Document::findHexa (Vertex* v1, Vertex* v2)
288 DumpStart ("findHexa", v1 << v2);
291 for (EltBase* elt = doc_first_elt[EL_HEXA]->next ();
292 elt!= NULL && found == NULL ;
295 Hexa* candidat = static_cast <Hexa*> (elt);
296 if (candidat->definedBy (v1, v2))
303 // ======================================================== findElement
304 EltBase* Document::findElement (EnumElt type, int ident)
306 for (EltBase* elt = doc_first_elt[type]->next (); elt!=NULL;
309 if (elt->isHere() && elt->getId()==ident)
314 // ======================================================== findVertex
315 Vertex* Document::findVertex (int ident)
317 Vertex* node = static_cast <Vertex*> (findElement (EL_VERTEX, ident));
321 // ======================================================== index_tv
322 int index_tv (Vertex* table[], Vertex* elt)
324 for (int nro=0; nro<QUAD4; nro++)
325 if (elt == table[nro])
330 // ======================================================== mergeQuads
331 int Document::mergeQuads (Quad* dest, Quad* orig, Vertex* v1, Vertex* v2,
332 Vertex* v3, Vertex* v4)
334 DumpStart ("mergeQuads", dest << orig << v1 << v2 << v3 << v4);
340 printf (" *** Quads identiques dans mergeQuads\n");
344 else if (dest==NULL || dest->isDeleted())
346 printf (" *** Quad nro 1 incorrect dans mergeQuads \n");
350 else if (orig==NULL || orig->isDeleted() )
352 printf (" *** Quad nro 2 incorrect dans mergeQuads \n");
358 for (int nro=0 ; nro<QUAD4 ; nro++)
360 int norig = orig->indexVertex (dest->getVertex(nro));
361 if (norig != NOTHING)
363 Vertex* uv = dest->getVertex(nro);
368 printf (" +++ Sommets communs dans mergeQuads");
369 printf (" (%s,", dest->getName (nom));
370 printf (" %s)\n", orig->getName (nom));
372 printf (" +++ quad1[%d] = quad2[%d] = %s\n", nro, norig,
379 printf (" +++ Les vertex passes en arguments sont ignores\n");
380 int ier = closeQuads (dest, orig);
384 else if (nbcomm != 0)
386 printf (" *** _____________________ mergeQuads refuse: \n");
387 printf (" il y a %d sommet(s) sont commun(s)\n", nbcomm);
392 if ( v1 ==NULL || v1 ->isDeleted() || v2 ==NULL || v2 ->isDeleted()
393 || v3 ==NULL || v3 ->isDeleted() || v4 ==NULL || v4 ->isDeleted())
395 printf (" *** _____________________ mergeQuads refuse: \n");
396 printf (" un sommet est incorrect\n");
404 printf (" ----------------- mergeQuads : \n");
413 Vertex *tv1 [QUAD4], *tv2 [QUAD4];
414 Edge *te1 [QUAD4], *te2 [QUAD4];
416 int ier1 = dest->ordoVertex (v1, v3, tv1);
417 int ier2 = orig->ordoVertex (v2, v4, tv2);
423 else if (ier2 != HOK)
429 for (int nro=0 ; nro<QUAD4 ; nro++)
431 te1 [nro] = dest->getEdge(nro);
432 Vertex* va1 = te1[nro]->getVertex(V_AMONT);
433 Vertex* vb1 = te1[nro]->getVertex(V_AVAL);
434 int na = index_tv (tv1, va1);
435 int nb = index_tv (tv1, vb1);
436 if (na==NOTHING || nb==NOTHING)
442 te2 [nro] = orig->findEdge (tv2[na], tv2[nb]);
452 printf (" ----------------- Correspondances mergeQuads : \n");
453 for (int nro=0 ; nro<QUAD4 ; nro++)
455 printf (" %d : ", nro);
456 tv2 [nro]->printName(" -> ");
457 tv1 [nro]->printName("\n");
459 for (int nro=0 ; nro<QUAD4 ; nro++)
461 printf (" %d : ", nro);
462 te2 [nro]->printName(" (");
463 te2 [nro]->getVertex(0)->printName(", ");
464 te2 [nro]->getVertex(1)->printName(") -> ");
465 te1 [nro]->printName(" (");
466 te1 [nro]->getVertex(0)->printName(", ");
467 te1 [nro]->getVertex(1)->printName(")\n");
471 replaceQuad (orig, dest);
472 for (int nro=0 ; nro<QUAD4 ; nro++)
473 replaceEdge (te2[nro], te1[nro]);
474 for (int nro=0 ; nro<QUAD4 ; nro++)
475 replaceVertex (tv2[nro], tv1[nro]);
477 maj_connection = false;
478 purge_elements = false;
483 // ======================================================== closeQuads
484 int Document::closeQuads (Quad* dest, Quad* orig)
486 DumpStart ("closeQuads", dest << orig);
493 printf (" *** Quads identiques dans closeQuads : %s\n",
498 else if (dest==NULL || dest->isDeleted())
500 printf (" *** Quad nro 1 incorrect dans closeQuads \n");
504 else if (orig==NULL || orig->isDeleted() )
506 printf (" *** Quad nro 2 incorrect dans closeQuads \n");
512 for (int nro=0 ; nro<QUAD4 ; nro++)
514 int norig = orig->indexEdge (dest->getEdge(nro));
515 if (norig != NOTHING)
519 printf (" *** Plus d'une arete commune dans closeQuads");
520 printf (" (%s,", dest->getName (nom));
521 printf (" %s)\n", orig->getName (nom));
525 edc = dest->getEdge (nro);
526 printf (" +++ quad1[%d] = quad2[%d] = %s\n", nro, norig,
531 Vertex* va = edc->getVertex (V_AMONT);
532 Vertex* vb = edc->getVertex (V_AVAL);
533 Vertex *tv1 [QUAD4], *tv2 [QUAD4];
534 Edge *te1 [QUAD4], *te2 [QUAD4];
536 int ier1 = dest->ordoVertex (va, vb, tv1);
537 int ier2 = orig->ordoVertex (va, vb, tv2);
544 else if (ier2 != HOK)
550 for (int nro=0 ; nro<QUAD4 ; nro++)
552 te1 [nro] = dest->getEdge(nro);
553 Vertex* va1 = te1[nro]->getVertex(V_AMONT);
554 Vertex* vb1 = te1[nro]->getVertex(V_AVAL);
555 int na = index_tv (tv1, va1);
556 int nb = index_tv (tv1, vb1);
557 if (na==NOTHING || nb==NOTHING)
563 te2 [nro] = orig->findEdge (tv2[na], tv2[nb]);
573 printf (" ----------------- Correspondances mergeQuads : \n");
574 for (int nro=0 ; nro<QUAD4 ; nro++)
576 printf (" %d : ", nro);
577 tv2 [nro]->printName(" -> ");
578 tv1 [nro]->printName("\n");
580 for (int nro=0 ; nro<QUAD4 ; nro++)
582 printf (" %d : ", nro);
583 te2 [nro]->printName(" (");
584 te2 [nro]->getVertex(0)->printName(", ");
585 te2 [nro]->getVertex(1)->printName(") -> ");
586 te1 [nro]->printName(" (");
587 te1 [nro]->getVertex(0)->printName(", ");
588 te1 [nro]->getVertex(1)->printName(")\n");
592 replaceQuad (orig, dest);
593 for (int nro=0 ; nro<QUAD4 ; nro++)
594 replaceEdge (te2[nro], te1[nro]);
595 for (int nro=0 ; nro<QUAD4 ; nro++)
596 replaceVertex (tv2[nro], tv1[nro]);
598 maj_connection = false;
599 purge_elements = false;
604 // ======================================================== mergeEdges
605 int Document::mergeEdges (Edge* e1, Edge* e2, Vertex* v1, Vertex* v2)
607 DumpStart ("mergeEdges", e1 << e2 << v1 << v2);
609 if (e1==NULL || e1->isDeleted() || e2==NULL || e2->isDeleted())
615 for (int nro=0 ; nro<V_TWO ; nro++)
616 if (e1->index (e2->getVertex(nro))!= NOTHING)
622 Vertex *tv1 [V_TWO], *tv2 [V_TWO];
624 int ier1 = e1->anaMerge (v1, tv1);
625 int ier2 = e2->anaMerge (v2, tv2);
632 else if (ier2 != HOK)
638 replaceEdge (e2, e1);
639 for (int nro=0 ; nro<V_TWO ; nro++)
640 replaceVertex (tv2[nro], tv1[nro]);
642 maj_connection = false;
646 // ======================================================== mergeVertices
647 int Document::mergeVertices (Vertex* vpar, Vertex* vold)
649 DumpStart ("mergeVertices", vpar << vold);
652 if (BadElement (vpar))
654 Mess << "First vertex is not valid";
657 else if (BadElement (vold))
659 Mess << "Second vertex is not valid";
664 Mess << "Vertices are identical";
667 else if (EltIsValid (findEdge (vpar, vold)))
669 Mess << "Theese vertices are connected by an edge";
679 map <Quad*, Quad*> rep_quad;
680 map <Edge*, Edge*> rep_edge;
681 map <Vertex*, Vertex*> rep_vertex;
683 map <Quad*, Quad*> :: iterator itq;
684 map <Edge*, Edge*> :: iterator ited;
685 map <Vertex*, Vertex*> :: iterator itv;
687 rep_vertex [vold] = vpar;
688 int nbparv = vold->getNbrParents ();
690 for (int ned=0 ; ned<nbparv ; ++ned)
692 Edge* edold = vold->getParent (ned);
695 Vertex* vopp = edold->opposedVertex (vold);
696 Edge* edpar = findEdge (vpar, vopp);
698 rep_edge [edold] = edpar;
702 Quad *qold=NULL, *qpar=NULL;
704 for (ited=rep_edge.begin(); ited!=rep_edge.end() ; ++ited)
706 Edge* edold = ited->first;
707 Edge* edpar = ited->second;
708 int nbpared = edold->getNbrParents ();
709 for (int nq=0 ; nq<nbpared ; ++nq)
711 qold = edold->getParent (nq);
714 for (int ned=0 ; ned<QUAD4 ; ned++)
716 // Edge* edge = quad->getEdge(ned);
717 Edge* edge = qold->getEdge (ned);
720 qpar = findQuad (edpar, edge);
722 rep_quad [qold] = qpar;
729 cout << " +++ Intersection : veq = " << rep_vertex.size()
730 << " " << rep_edge.size() << " " << rep_quad.size()
733 for (itq=rep_quad.begin(); itq!=rep_quad.end() ; ++itq)
737 Vertex *tv1[QUAD4], *tv2[QUAD4];
738 Edge *te1[QUAD4], *te2[QUAD4];
739 Edge* einter = qpar->inter (qold);
742 Vertex* va = einter->getVertex (V_AMONT);
743 Vertex* vb = einter->getVertex (V_AVAL);
744 qpar->ordonner (va, vb, tv1, te1);
745 qold->ordonner (va, vb, tv2, te2);
746 for (int nro=0 ; nro<QUAD4 ; nro++)
748 rep_edge [te2[nro]] = te1[nro];
749 rep_vertex [tv2[nro]] = tv1[nro];
752 replaceQuad (qold, qpar);
755 for (ited=rep_edge.begin(); ited!=rep_edge.end() ; ++ited)
756 replaceEdge (ited->first, ited->second);
758 for (itv=rep_vertex.begin(); itv!=rep_vertex.end() ; ++itv)
759 replaceVertex (itv->first, itv->second);
761 maj_connection = false;
765 // ======================================================== replaceVertex
766 void Document::replaceVertex (Vertex* old, Vertex* par)
768 if (BadElement(old) || BadElement(par) || old==par)
771 // par->replaceAssociation (old); TODO
773 for (int type=EL_EDGE ; type <= EL_HEXA ; type++)
775 for (EltBase* elt = doc_first_elt[type]->next (); elt!=NULL;
778 elt->replaceVertex (old, par);
782 // ======================================================== replaceEdge
783 void Document::replaceEdge (Edge* old, Edge* par)
785 if (BadElement(old) || BadElement(par) || old==par)
788 // par->replaceAssociation (old); TODO
790 for (int type=EL_QUAD ; type <= EL_HEXA ; type++)
792 for (EltBase* elt = doc_first_elt[type]->next (); elt!=NULL;
795 elt->replaceEdge (old, par);
800 // ======================================================== replaceQuad
801 int Document::replaceQuad (Quad* old, Quad* par)
803 if (BadElement(old) || BadElement(par) || old==par)
806 // par->replaceAssociation (old); TODO
808 for (EltBase* elt = doc_first_elt[EL_HEXA]->next (); elt!=NULL;
812 Hexa* cell = static_cast <Hexa*> (elt);
813 cell->replaceQuad (old, par);
818 // ========================================================== countElement
819 int Document::countElement (EnumElt type)
822 for (EltBase* elt = doc_first_elt[type]->next (); elt!=NULL;
829 // ========================================================== getElement
830 EltBase* Document::getElement (EnumElt type, int nro)
833 for (EltBase* elt = doc_first_elt[type]->next (); elt!=NULL;
845 // ========================================================= addLaw
846 Law* Document::addLaw (const char* name, int nbnodes)
848 DumpStart ("addLaw", name << nbnodes);
849 Law* loi = new Law (this, name, nbnodes);
854 // ========================================================= addLaw
855 Law* Document::addLaw (Law* loi)
857 doc_laws.push_back (loi);
861 // ========================================================= getLaw
862 Law* Document::getLaw (int nro)
864 DumpStart ("getLaw", nro);
867 if (nro >= 0 && nro < nbr_laws)
868 loi = doc_laws [nro];
873 // ========================================================= findLaw
874 Law* Document::findLaw (const char* name)
876 DumpStart ("findLaw", name);
881 for (int nro=0 ;loi==NULL && nro<nbr_laws; nro++)
882 if (doc_laws [nro]->getName() == nom)
883 loi = doc_laws [nro];
888 // ========================================================= removeLaw
889 int Document::removeLaw (Law* loi)
891 DumpStart ("removeLaw", loi);
893 for (int nro=1 ; nro<nbr_laws; nro++)
894 if (doc_laws [nro] == loi)
896 //All propagations having this law should now have the default law.
897 for (int nl=0 ; nl<nbr_propagations ; nl++)
899 if ( doc_propagation [nl]->getLaw() == loi )
900 doc_propagation [nl]->setLaw(defaultLaw);
903 // delete doc_laws [nro];
904 doc_laws [nro]->suppress ();
905 doc_laws.erase (doc_laws.begin()+nro);
906 nbr_laws = doc_laws.size();
915 // ========================================================= majPropagation
916 void Document::majPropagation ()
921 // if (purge_elements)
924 for (int nro=0 ; nro<nbr_propagations ; nro++)
926 // delete doc_propagation [nro];
927 // doc_propagation [nro]->suppress();
931 doc_propagation.clear ();
932 nbr_propagations = 0;
933 maj_propagation = false;
935 for (EltBase* elt = doc_first_elt[EL_EDGE]->next (); elt!=NULL;
938 Edge* arete = static_cast <Edge*> (elt);
940 arete->setPropag (NOTHING, true);
943 // markAll (NO_COUNTED, EL_EDGE);
945 for (EltBase* elt = doc_first_elt[EL_HEXA]->next (); elt!=NULL;
948 Hexa* cell = static_cast <Hexa*> (elt);
949 if (cell!=NULL && cell->isHere())
951 for (int ne=0 ; ne<HE_MAXI ; ne++)
953 Edge* arete = cell->getEdge(ne);
954 if (arete->getPropag()<0)
956 Propagation* prop = new Propagation (this);
957 doc_propagation.push_back (prop);
958 arete->propager (prop, nbr_propagations);
965 maj_propagation = false;
968 // ======================================================== countPropagation
969 int Document::countPropagation ()
974 return nbr_propagations;
976 // ======================================================== getPropagation
977 Propagation* Document::getPropagation (int nro)
979 DumpStart ("getPropagation", nro);
984 Propagation* prop = NULL;
985 if (nro >= 0 && nro < nbr_propagations)
986 prop = doc_propagation [nro];
991 // ======================================================== findPropagation
992 Propagation* Document::findPropagation (Edge* arete)
994 DumpStart ("findPropagation", arete);
996 Propagation* prop = NULL;
1001 prop = getPropagation (arete->getPropag ());
1007 // ======================================================== disconnectQuad
1008 Elements* Document::disconnectQuad (Hexa* cell, Quad* element)
1010 DumpStart ("disconnectQuad", cell << element);
1012 Elements* grid = new Elements (this);
1013 grid->checkDisco (cell, element);
1015 if (grid->isValid())
1018 cell->disconnectQuad (element, grid);
1025 // ======================================================== disconnectEdge
1026 Elements* Document::disconnectEdge (Hexa* cell, Edge* element)
1028 DumpStart ("disconnectEdge", cell << element);
1030 Elements* grid = new Elements (this);
1031 grid->checkDisco (cell, element);
1033 if (grid->isValid())
1036 cell->disconnectEdge (element, grid);
1043 // ======================================================== disconnectVertex
1044 Elements* Document::disconnectVertex (Hexa* cell, Vertex* element)
1046 DumpStart ("disconnectVertex", cell << element);
1048 Elements* grid = new Elements (this);
1049 grid->checkDisco (cell, element);
1051 if (grid->isValid())
1054 cell->disconnectVertex (element, grid);
1061 // ======================================================== setName
1062 int Document::setName (cpchar prefix)
1064 DumpStart ("setName", prefix);
1067 if (Cestvide (prefix) || el_name==prefix)
1071 string name = prefix;
1072 if (hex_parent != NULL)
1073 hex_parent->makeName (prefix, name);
1080 // ======================================================== setLevel
1086 void Document::setLevel (int niv)
1088 DumpStart ("setLevel", niv);
1091 checkAssociations ();
1092 else if (niv == 748)
1094 int nbshapes = countShape ();
1095 for (int nsh=0 ; nsh < nbshapes ; nsh++)
1097 doc_tab_shape[nsh]->saveBrep();
1100 else if (niv == 777)
1101 set_special_option (true);
1102 else if (niv == 778)
1103 set_special_option (false);
1105 else if (niv >=100 && niv <=200)
1106 test_six (this, niv);
1114 // ======================================================== makeVarName
1115 char* Document::makeVarName (char* name)
1117 strcpy (name, doc_ident);
1120 // ======================================================== isEmpty
1121 bool Document::isEmpty ()
1123 int nombre = countVertex () + countVector ();
1124 return nombre <= 0 && countLaw () <= 1;
1126 // ======================================================== getNextName
1127 cpchar Document::getNextName (EnumElt type, string& buff)
1130 EltBase::makeName (type, doc_nbr_elt [type], name);
1133 return buff.c_str();
1136 // ======================================================== getNextName
1137 string Document::getNextName (EnumElt type)
1140 EltBase::makeName (type, doc_nbr_elt [type], name);
1142 return string(name);
1145 // ======================================================== lockDump
1146 void Document::lockDump ()
1150 // ======================================================== restoreDump
1151 void Document::restoreDump ()
1153 glob->dump.restore (DumpActif);
1155 // ======================================================== getGroup
1156 Group* Document::getGroup (int nro)
1158 int size = doc_group.size();
1159 if (nro>=0 && nro<size)
1160 return doc_group [nro];
1164 // ======================================================== getVector
1165 Vector* Document::getVector (int nro)
1167 int size = doc_vector.size();
1168 if (nro>=0 && nro<size)
1169 return doc_vector [nro];