2 // C++ : La clase principale de Hexa
4 // Copyright (C) 2009-2013 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.
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/
21 // 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"
32 #include "HexCrossElements.hxx"
34 #include "HexVector.hxx"
35 #include "HexMatrix.hxx"
36 #include "HexCloner.hxx"
37 #include "HexPropagation.hxx"
40 #include "HexXmlWriter.hxx"
41 #include "HexXmlTree.hxx"
42 #include "HexGlobale.hxx"
43 #include "HexGroup.hxx"
45 #include "HexNewShape.hxx"
47 void test_six (Hex::Document* docu, int option);
51 int Document::doc_number = 0;
53 // ======================================================== Constructeur
54 Document::Document (cpchar name, Hex* dad)
58 glob = Globale::getInstance ();
68 maj_propagation = true;
71 nbr_used_hexas = nbr_used_quads = nbr_used_edges = nbr_used_vertex = 0;
73 for (EnumElt type = EL_NONE ; type < EL_MAXI ; type=(EnumElt) (type+1))
75 doc_first_elt [type] = doc_last_elt [type] = new EltBase ();
76 doc_nbr_elt [type] = 0;
80 strcpy (doc_ident, "doc");
82 sprintf (doc_ident, "doc%02d", doc_number);
86 defaultLaw = addLaw ("DefaultLaw", 0);
89 maj_connection = false;
90 purge_elements = false;
91 holes_elements = false;
94 // ======================================================== Destructeur
95 Document::~Document ()
99 for (EnumElt type = EL_NONE ; type < EL_MAXI ; type=(EnumElt) (type+1))
101 // printf ("____________________________ Type=%d\n", type);
102 EltBase* next = NULL;
103 for (EltBase* elt=doc_first_elt [type] ; elt != NULL ; elt=next)
110 // ======================================================== addVector
111 Vector* Document::addVector (double dx, double dy, double dz)
113 DumpStart ("addVector", dx << dy << dz);
114 Vector* pv = new Vector (this, dx, dy, dz);
115 doc_vector.push_back (pv);
120 // ======================================================== addVectorVertices
121 Vector* Document::addVectorVertices (Vertex* va, Vertex* vb)
123 DumpStart ("addVectorVertices", va << vb);
125 Vector* pv = addVector (vb->getX () - va->getX (),
126 vb->getY () - va->getY (),
127 vb->getZ () - va->getZ ());
132 // ======================================================== addVertex
133 Vertex* Document::addVertex (double x, double y, double z)
135 DumpStart ("addVertex", x << y << z);
137 Vertex* pv = new Vertex (this, x, y, z);
141 // ======================================================== addEdge
142 Edge* Document::addEdge (Vertex* va, Vertex* vb)
144 DumpStart ("addEdge", va << vb );
146 if (va==NULL || vb==NULL)
149 Edge* arete = new Edge (va, vb);
153 // ======================================================== addEdgeVector
154 Edge* Document::addEdgeVector (Vertex* va, Vector* vec)
156 DumpStart ("addEdgeVector", va << vec );
158 Vertex* vb = addVertex (va->getX () + vec->getDx(),
159 va->getY () + vec->getDy(),
160 va->getZ () + vec->getDz());
162 Edge* arete = addEdge (va, vb);
166 // ======================================================== addQuadVertices
167 Quad* Document::addQuadVertices (Vertex* va, Vertex* vb, Vertex* vc, Vertex* vd)
169 DumpStart ("addQuadVertices", va << vb << vc << vd );
171 Quad* face = new Quad (va, vb, vc, vd);
175 // ======================================================== addQuad
176 Quad* Document::addQuad (Edge* ea, Edge* eb, Edge* ec, Edge* ed)
178 DumpStart ("addQuad", ea << eb << ec << ed );
180 Quad* face = new Quad (ea, eb, ec, ed);
184 // ======================================================== addHexaVertices
185 Hexa* Document::addHexaVertices (Vertex* va, Vertex* vb, Vertex* vc, Vertex* vd,
186 Vertex* ve, Vertex* vf, Vertex* vg, Vertex* vh)
188 DumpStart ("addHexaVertices", va << vb << vc << vd << ve << vf << vg << vh);
190 Hexa* pave = new Hexa (va, vb, vc, vd, ve, vf, vg, vh);
194 // ======================================================== addHexa
195 Hexa* Document::addHexa (Quad* qa, Quad* qb, Quad* qc, Quad* qd, Quad* qe,
198 DumpStart ("addHexa", qa << qb << qc << qd << qe << qf );
200 Hexa* pave = new Hexa (qa, qb, qc, qd, qe, qf);
204 // ======================================================== findVertex
205 Vertex* Document::findVertex (double vx, double vy, double vz)
207 DumpStart ("findVertex", vx << vy << vz);
208 Vertex* found = NULL;
210 double xmin = vx - doc_tolerance;
211 double xmax = vx + doc_tolerance;
212 double ymin = vy - doc_tolerance;
213 double ymax = vy + doc_tolerance;
214 double zmin = vz - doc_tolerance;
215 double zmax = vz + doc_tolerance;
217 for (EltBase* elt = doc_first_elt[EL_VERTEX]->next ();
218 elt!= NULL && found == NULL ;
223 Vertex* candidat = static_cast <Vertex*> (elt);
224 if (candidat->isin (xmin, xmax, ymin, ymax, zmin, zmax))
232 // ======================================================== findEdge
233 Edge* Document::findEdge (Vertex* v1, Vertex* v2)
235 DumpStart ("findEdge", v1 << v2);
238 for (EltBase* elt = doc_first_elt[EL_EDGE]->next ();
239 elt!= NULL && found == NULL ;
242 Edge* candidat = static_cast <Edge*> (elt);
243 if (candidat->definedBy (v1, v2))
250 // ======================================================== findQuad
251 Quad* Document::findQuad (Vertex* v1, Vertex* v2)
253 DumpStart ("findQuad", v1 << v2);
256 for (EltBase* elt = doc_first_elt[EL_QUAD]->next ();
257 elt!= NULL && found == NULL ;
260 Quad* candidat = static_cast <Quad*> (elt);
261 if (candidat->definedBy (v1, v2))
268 // ======================================================== findQuad
269 Quad* Document::findQuad (Edge* e1, Edge* e2)
271 DumpStart ("findQuad", e1 << e2);
274 for (EltBase* elt = doc_first_elt[EL_QUAD]->next ();
275 elt!= NULL && found == NULL ;
278 Quad* candidat = static_cast <Quad*> (elt);
279 if (candidat->definedBy (e1, e2))
286 // ======================================================== findHexa
287 Hexa* Document::findHexa (Vertex* v1, Vertex* v2)
289 DumpStart ("findHexa", v1 << v2);
292 for (EltBase* elt = doc_first_elt[EL_HEXA]->next ();
293 elt!= NULL && found == NULL ;
296 Hexa* candidat = static_cast <Hexa*> (elt);
297 if (candidat->definedBy (v1, v2))
304 // ======================================================== findElement
305 EltBase* Document::findElement (EnumElt type, int ident)
307 for (EltBase* elt = doc_first_elt[type]->next (); elt!=NULL;
310 if (elt->isHere() && elt->getId()==ident)
315 // ======================================================== findVertex
316 Vertex* Document::findVertex (int ident)
318 Vertex* node = static_cast <Vertex*> (findElement (EL_VERTEX, ident));
322 // ======================================================== index_tv
323 int index_tv (Vertex* table[], Vertex* elt)
325 for (int nro=0; nro<QUAD4; nro++)
326 if (elt == table[nro])
331 // ======================================================== mergeQuads
332 int Document::mergeQuads (Quad* dest, Quad* orig, Vertex* v1, Vertex* v2,
333 Vertex* v3, Vertex* v4)
335 DumpStart ("mergeQuads", dest << orig << v1 << v2 << v3 << v4);
341 printf (" *** Quads identiques dans mergeQuads\n");
345 else if (dest==NULL || dest->isDeleted())
347 printf (" *** Quad nro 1 incorrect dans mergeQuads \n");
351 else if (orig==NULL || orig->isDeleted() )
353 printf (" *** Quad nro 2 incorrect dans mergeQuads \n");
359 for (int nro=0 ; nro<QUAD4 ; nro++)
361 int norig = orig->indexVertex (dest->getVertex(nro));
362 if (norig != NOTHING)
364 Vertex* uv = dest->getVertex(nro);
369 printf (" +++ Sommets communs dans mergeQuads");
370 printf (" (%s,", dest->getName (nom));
371 printf (" %s)\n", orig->getName (nom));
373 printf (" +++ quad1[%d] = quad2[%d] = %s\n", nro, norig,
380 printf (" +++ Les vertex passes en arguments sont ignores\n");
381 int ier = closeQuads (dest, orig);
385 else if (nbcomm != 0)
387 printf (" *** _____________________ mergeQuads refuse: \n");
388 printf (" il y a %d sommet(s) sont commun(s)\n", nbcomm);
393 if ( v1 ==NULL || v1 ->isDeleted() || v2 ==NULL || v2 ->isDeleted()
394 || v3 ==NULL || v3 ->isDeleted() || v4 ==NULL || v4 ->isDeleted())
396 printf (" *** _____________________ mergeQuads refuse: \n");
397 printf (" un sommet est incorrect\n");
405 printf (" ----------------- mergeQuads : \n");
414 Vertex *tv1 [QUAD4], *tv2 [QUAD4];
415 Edge *te1 [QUAD4], *te2 [QUAD4];
417 int ier1 = dest->ordoVertex (v1, v3, tv1);
418 int ier2 = orig->ordoVertex (v2, v4, tv2);
424 else if (ier2 != HOK)
430 for (int nro=0 ; nro<QUAD4 ; nro++)
432 te1 [nro] = dest->getEdge(nro);
433 Vertex* va1 = te1[nro]->getVertex(V_AMONT);
434 Vertex* vb1 = te1[nro]->getVertex(V_AVAL);
435 int na = index_tv (tv1, va1);
436 int nb = index_tv (tv1, vb1);
437 if (na==NOTHING || nb==NOTHING)
443 te2 [nro] = orig->findEdge (tv2[na], tv2[nb]);
453 printf (" ----------------- Correspondances mergeQuads : \n");
454 for (int nro=0 ; nro<QUAD4 ; nro++)
456 printf (" %d : ", nro);
457 tv2 [nro]->printName(" -> ");
458 tv1 [nro]->printName("\n");
460 for (int nro=0 ; nro<QUAD4 ; nro++)
462 printf (" %d : ", nro);
463 te2 [nro]->printName(" (");
464 te2 [nro]->getVertex(0)->printName(", ");
465 te2 [nro]->getVertex(1)->printName(") -> ");
466 te1 [nro]->printName(" (");
467 te1 [nro]->getVertex(0)->printName(", ");
468 te1 [nro]->getVertex(1)->printName(")\n");
472 replaceQuad (orig, dest);
473 for (int nro=0 ; nro<QUAD4 ; nro++)
474 replaceEdge (te2[nro], te1[nro]);
475 for (int nro=0 ; nro<QUAD4 ; nro++)
476 replaceVertex (tv2[nro], tv1[nro]);
478 maj_connection = false;
479 purge_elements = false;
484 // ======================================================== closeQuads
485 int Document::closeQuads (Quad* dest, Quad* orig)
487 DumpStart ("closeQuads", dest << orig);
494 printf (" *** Quads identiques dans closeQuads : %s\n",
499 else if (dest==NULL || dest->isDeleted())
501 printf (" *** Quad nro 1 incorrect dans closeQuads \n");
505 else if (orig==NULL || orig->isDeleted() )
507 printf (" *** Quad nro 2 incorrect dans closeQuads \n");
513 for (int nro=0 ; nro<QUAD4 ; nro++)
515 int norig = orig->indexEdge (dest->getEdge(nro));
516 if (norig != NOTHING)
520 printf (" *** Plus d'une arete commune dans closeQuads");
521 printf (" (%s,", dest->getName (nom));
522 printf (" %s)\n", orig->getName (nom));
526 edc = dest->getEdge (nro);
527 printf (" +++ quad1[%d] = quad2[%d] = %s\n", nro, norig,
532 Vertex* va = edc->getVertex (V_AMONT);
533 Vertex* vb = edc->getVertex (V_AVAL);
534 Vertex *tv1 [QUAD4], *tv2 [QUAD4];
535 Edge *te1 [QUAD4], *te2 [QUAD4];
537 int ier1 = dest->ordoVertex (va, vb, tv1);
538 int ier2 = orig->ordoVertex (va, vb, tv2);
545 else if (ier2 != HOK)
551 for (int nro=0 ; nro<QUAD4 ; nro++)
553 te1 [nro] = dest->getEdge(nro);
554 Vertex* va1 = te1[nro]->getVertex(V_AMONT);
555 Vertex* vb1 = te1[nro]->getVertex(V_AVAL);
556 int na = index_tv (tv1, va1);
557 int nb = index_tv (tv1, vb1);
558 if (na==NOTHING || nb==NOTHING)
564 te2 [nro] = orig->findEdge (tv2[na], tv2[nb]);
574 printf (" ----------------- Correspondances mergeQuads : \n");
575 for (int nro=0 ; nro<QUAD4 ; nro++)
577 printf (" %d : ", nro);
578 tv2 [nro]->printName(" -> ");
579 tv1 [nro]->printName("\n");
581 for (int nro=0 ; nro<QUAD4 ; nro++)
583 printf (" %d : ", nro);
584 te2 [nro]->printName(" (");
585 te2 [nro]->getVertex(0)->printName(", ");
586 te2 [nro]->getVertex(1)->printName(") -> ");
587 te1 [nro]->printName(" (");
588 te1 [nro]->getVertex(0)->printName(", ");
589 te1 [nro]->getVertex(1)->printName(")\n");
593 replaceQuad (orig, dest);
594 for (int nro=0 ; nro<QUAD4 ; nro++)
595 replaceEdge (te2[nro], te1[nro]);
596 for (int nro=0 ; nro<QUAD4 ; nro++)
597 replaceVertex (tv2[nro], tv1[nro]);
599 maj_connection = false;
600 purge_elements = false;
605 // ======================================================== mergeEdges
606 int Document::mergeEdges (Edge* e1, Edge* e2, Vertex* v1, Vertex* v2)
608 DumpStart ("mergeEdges", e1 << e2 << v1 << v2);
610 if (e1==NULL || e1->isDeleted() || e2==NULL || e2->isDeleted())
616 for (int nro=0 ; nro<V_TWO ; nro++)
617 if (e1->index (e2->getVertex(nro))!= NOTHING)
623 Vertex *tv1 [V_TWO], *tv2 [V_TWO];
625 int ier1 = e1->anaMerge (v1, tv1);
626 int ier2 = e2->anaMerge (v2, tv2);
633 else if (ier2 != HOK)
639 replaceEdge (e2, e1);
640 for (int nro=0 ; nro<V_TWO ; nro++)
641 replaceVertex (tv2[nro], tv1[nro]);
643 maj_connection = false;
647 // ======================================================== mergeVertices
648 int Document::mergeVertices (Vertex* vpar, Vertex* vold)
650 DumpStart ("mergeVertices", vpar << vold);
653 if (BadElement (vpar))
655 Mess << "First vertex is not valid";
658 else if (BadElement (vold))
660 Mess << "Second vertex is not valid";
665 Mess << "Vertices are identical";
668 else if (EltIsValid (findEdge (vpar, vold)))
670 Mess << "Theese vertices are connected by an edge";
680 map <Quad*, Quad*> rep_quad;
681 map <Edge*, Edge*> rep_edge;
682 map <Vertex*, Vertex*> rep_vertex;
684 map <Quad*, Quad*> :: iterator itq;
685 map <Edge*, Edge*> :: iterator ited;
686 map <Vertex*, Vertex*> :: iterator itv;
688 rep_vertex [vold] = vpar;
689 int nbparv = vold->getNbrParents ();
691 for (int ned=0 ; ned<nbparv ; ++ned)
693 Edge* edold = vold->getParent (ned);
696 Vertex* vopp = edold->opposedVertex (vold);
697 Edge* edpar = findEdge (vpar, vopp);
699 rep_edge [edold] = edpar;
703 Quad *qold=NULL, *qpar=NULL;
705 for (ited=rep_edge.begin(); ited!=rep_edge.end() ; ++ited)
707 Edge* edold = ited->first;
708 Edge* edpar = ited->second;
709 int nbpared = edold->getNbrParents ();
710 for (int nq=0 ; nq<nbpared ; ++nq)
712 qold = edold->getParent (nq);
715 for (int ned=0 ; ned<QUAD4 ; ned++)
717 // Edge* edge = quad->getEdge(ned);
718 Edge* edge = qold->getEdge (ned);
721 qpar = findQuad (edpar, edge);
723 rep_quad [qold] = qpar;
730 cout << " +++ Intersection : veq = " << rep_vertex.size()
731 << " " << rep_edge.size() << " " << rep_quad.size()
734 for (itq=rep_quad.begin(); itq!=rep_quad.end() ; ++itq)
738 Vertex *tv1[QUAD4], *tv2[QUAD4];
739 Edge *te1[QUAD4], *te2[QUAD4];
740 Edge* einter = qpar->inter (qold);
743 Vertex* va = einter->getVertex (V_AMONT);
744 Vertex* vb = einter->getVertex (V_AVAL);
745 qpar->ordonner (va, vb, tv1, te1);
746 qold->ordonner (va, vb, tv2, te2);
747 for (int nro=0 ; nro<QUAD4 ; nro++)
749 rep_edge [te2[nro]] = te1[nro];
750 rep_vertex [tv2[nro]] = tv1[nro];
753 replaceQuad (qold, qpar);
756 for (ited=rep_edge.begin(); ited!=rep_edge.end() ; ++ited)
757 replaceEdge (ited->first, ited->second);
759 for (itv=rep_vertex.begin(); itv!=rep_vertex.end() ; ++itv)
760 replaceVertex (itv->first, itv->second);
762 maj_connection = false;
766 // ======================================================== replaceVertex
767 void Document::replaceVertex (Vertex* old, Vertex* par)
769 if (BadElement(old) || BadElement(par) || old==par)
772 // par->replaceAssociation (old); TODO
774 for (int type=EL_EDGE ; type <= EL_HEXA ; type++)
776 for (EltBase* elt = doc_first_elt[type]->next (); elt!=NULL;
779 elt->replaceVertex (old, par);
783 // ======================================================== replaceEdge
784 void Document::replaceEdge (Edge* old, Edge* par)
786 if (BadElement(old) || BadElement(par) || old==par)
789 // par->replaceAssociation (old); TODO
791 for (int type=EL_QUAD ; type <= EL_HEXA ; type++)
793 for (EltBase* elt = doc_first_elt[type]->next (); elt!=NULL;
796 elt->replaceEdge (old, par);
801 // ======================================================== replaceQuad
802 int Document::replaceQuad (Quad* old, Quad* par)
804 if (BadElement(old) || BadElement(par) || old==par)
807 // par->replaceAssociation (old); TODO
809 for (EltBase* elt = doc_first_elt[EL_HEXA]->next (); elt!=NULL;
813 Hexa* cell = static_cast <Hexa*> (elt);
814 cell->replaceQuad (old, par);
819 // ========================================================== countElement
820 int Document::countElement (EnumElt type)
823 for (EltBase* elt = doc_first_elt[type]->next (); elt!=NULL;
830 // ========================================================== getElement
831 EltBase* Document::getElement (EnumElt type, int nro)
834 for (EltBase* elt = doc_first_elt[type]->next (); elt!=NULL;
846 // ========================================================= addLaw
847 Law* Document::addLaw (const char* name, int nbnodes)
849 DumpStart ("addLaw", name << nbnodes);
850 Law* loi = new Law (this, name, nbnodes);
855 // ========================================================= addLaw
856 Law* Document::addLaw (Law* loi)
858 doc_laws.push_back (loi);
862 // ========================================================= getLaw
863 Law* Document::getLaw (int nro)
865 DumpStart ("getLaw", nro);
868 if (nro >= 0 && nro < nbr_laws)
869 loi = doc_laws [nro];
874 // ========================================================= findLaw
875 Law* Document::findLaw (const char* name)
877 DumpStart ("findLaw", name);
882 for (int nro=0 ;loi==NULL && nro<nbr_laws; nro++)
883 if (doc_laws [nro]->getName() == nom)
884 loi = doc_laws [nro];
889 // ========================================================= removeLaw
890 int Document::removeLaw (Law* loi)
892 DumpStart ("removeLaw", loi);
894 for (int nro=1 ; nro<nbr_laws; nro++)
895 if (doc_laws [nro] == loi)
897 //All propagations having this law should now have the default law.
898 for (int nl=0 ; nl<nbr_propagations ; nl++)
900 if ( doc_propagation [nl]->getLaw() == loi )
901 doc_propagation [nl]->setLaw(defaultLaw);
904 // delete doc_laws [nro];
905 doc_laws [nro]->suppress ();
906 doc_laws.erase (doc_laws.begin()+nro);
907 nbr_laws = doc_laws.size();
916 // ========================================================= majPropagation
917 void Document::majPropagation ()
922 // if (purge_elements)
925 for (int nro=0 ; nro<nbr_propagations ; nro++)
927 // delete doc_propagation [nro];
928 // doc_propagation [nro]->suppress();
932 doc_propagation.clear ();
933 nbr_propagations = 0;
934 maj_propagation = false;
936 for (EltBase* elt = doc_first_elt[EL_EDGE]->next (); elt!=NULL;
939 Edge* arete = static_cast <Edge*> (elt);
941 arete->setPropag (NOTHING, true);
944 // markAll (NO_COUNTED, EL_EDGE);
946 for (EltBase* elt = doc_first_elt[EL_HEXA]->next (); elt!=NULL;
949 Hexa* cell = static_cast <Hexa*> (elt);
950 if (cell!=NULL && cell->isHere())
952 for (int ne=0 ; ne<HE_MAXI ; ne++)
954 Edge* arete = cell->getEdge(ne);
955 if (arete->getPropag()<0)
957 Propagation* prop = new Propagation (this);
958 doc_propagation.push_back (prop);
959 arete->propager (prop, nbr_propagations);
966 maj_propagation = false;
969 // ======================================================== countPropagation
970 int Document::countPropagation ()
975 return nbr_propagations;
977 // ======================================================== getPropagation
978 Propagation* Document::getPropagation (int nro)
980 DumpStart ("getPropagation", nro);
985 Propagation* prop = NULL;
986 if (nro >= 0 && nro < nbr_propagations)
987 prop = doc_propagation [nro];
992 // ======================================================== findPropagation
993 Propagation* Document::findPropagation (Edge* arete)
995 DumpStart ("findPropagation", arete);
997 Propagation* prop = NULL;
1000 if (maj_propagation)
1002 prop = getPropagation (arete->getPropag ());
1008 // ======================================================== disconnectQuad
1009 Elements* Document::disconnectQuad (Hexa* cell, Quad* element)
1011 DumpStart ("disconnectQuad", cell << element);
1013 Elements* grid = new Elements (this);
1014 grid->checkDisco (cell, element);
1016 if (grid->isValid())
1019 cell->disconnectQuad (element, grid);
1026 // ======================================================== disconnectEdge
1027 Elements* Document::disconnectEdge (Hexa* cell, Edge* element)
1029 DumpStart ("disconnectEdge", cell << element);
1031 Elements* grid = new Elements (this);
1032 grid->checkDisco (cell, element);
1034 if (grid->isValid())
1037 cell->disconnectEdge (element, grid);
1044 // ======================================================== disconnectVertex
1045 Elements* Document::disconnectVertex (Hexa* cell, Vertex* element)
1047 DumpStart ("disconnectVertex", cell << element);
1049 Elements* grid = new Elements (this);
1050 grid->checkDisco (cell, element);
1052 if (grid->isValid())
1055 cell->disconnectVertex (element, grid);
1062 // ======================================================== setName
1063 int Document::setName (cpchar prefix)
1065 DumpStart ("setName", prefix);
1068 if (Cestvide (prefix) || el_name==prefix)
1072 string name = prefix;
1073 if (hex_parent != NULL)
1074 hex_parent->makeName (prefix, name);
1081 // ======================================================== setLevel
1087 void Document::setLevel (int niv)
1089 DumpStart ("setLevel", niv);
1092 checkAssociations ();
1093 else if (niv == 748)
1095 int nbshapes = countShape ();
1096 for (int nsh=0 ; nsh < nbshapes ; nsh++)
1098 doc_tab_shape[nsh]->saveBrep();
1101 else if (niv == 777)
1102 set_special_option (true);
1103 else if (niv == 778)
1104 set_special_option (false);
1106 else if (niv >=100 && niv <=200)
1107 test_six (this, niv);
1115 // ======================================================== makeVarName
1116 char* Document::makeVarName (char* name)
1118 strcpy (name, doc_ident);
1121 // ======================================================== isEmpty
1122 bool Document::isEmpty ()
1124 int nombre = countVertex () + countVector ()
1125 + countCylinder() + countPipe();
1126 return nombre <= 0 && countLaw () <= 1;
1128 // ======================================================== getNextName
1129 cpchar Document::getNextName (EnumElt type, string& buff)
1132 EltBase::makeName (type, doc_nbr_elt [type], name);
1135 return buff.c_str();
1138 // ======================================================== getNextName
1139 string Document::getNextName (EnumElt type)
1142 EltBase::makeName (type, doc_nbr_elt [type], name);
1144 return string(name);
1147 // ======================================================== lockDump
1148 void Document::lockDump ()
1152 // ======================================================== restoreDump
1153 void Document::restoreDump ()
1155 glob->dump.restore (DumpActif);
1157 // ======================================================== getGroup
1158 Group* Document::getGroup (int nro)
1160 int size = doc_group.size();
1161 if (nro>=0 && nro<size)
1162 return doc_group [nro];
1166 // ======================================================== getVector
1167 Vector* Document::getVector (int nro)
1169 int size = doc_vector.size();
1170 if (nro>=0 && nro<size)
1171 return doc_vector [nro];