// C++ : Classe Document : Methodes internes 2011
-// Copyright (C) 2009-2013 CEA/DEN, EDF R&D
+// Copyright (C) 2009-2024 CEA, EDF
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// ======================================================== copyDocument
Document* Document::copyDocument ()
{
- string nom = "CopyOf_";
+ std::string nom = "CopyOf_";
nom += el_name;
Document* clone = new Document (nom.c_str());
Hexa* hexa = new Hexa (q_a, q_b, q_c, q_d, q_e, q_f);
return hexa;
}
-// ========================================================= replace
-Elements* Document::replace (Quads pattern, Vertex* p1, Vertex* c1,
+// ========================================================= replaceHexa
+Elements* Document::replaceHexa (Quads pattern, Vertex* p1, Vertex* c1,
Vertex* p2, Vertex* c2, Vertex* p3, Vertex* c3)
{
- DumpStart ("replace", pattern << p1 << c1 << p2 << c2 << p3 << c3);
+ DumpStart ("replaceHexa", pattern << p1 << c1 << p2 << c2 << p3 << c3);
Elements* t_hexas = new Elements (this);
- int ier = t_hexas->replaceHexas (pattern, p1, c1, p2, c2, p3, c3);
+ Mess << " **** This syntax is deprecated" ;
+ t_hexas->setError (HERR);
+
+ DumpReturn (t_hexas);
+ return t_hexas;
+}
+// ========================================================= replace
+Elements* Document::replace (Quads motif, Quads cible, Vertex* p1, Vertex* c1, Vertex* p2, Vertex* c2)
+{
+ DumpStart ("replace", motif << cible << p1 << c1 << p2 << c2);
+
+ Elements* t_hexas = new Elements (this);
+ int ier = t_hexas->replaceHexas (motif, cible, p1, c1, p2, c2);
+
if (ier!=HOK)
{
Mess << " **** Error in Document::replace" ;
- t_hexas->setError (ier);
+ t_hexas->setError (HERR);
}
DumpReturn (t_hexas);
- return t_hexas;
+ return t_hexas;
}
// ========================================================= print_replace
void print_replace (Edge* zig, Edge* zag)
{
- cout << zig->getName() << " = (" << zig->getVertex(0)->getName()
+ std::cout << zig->getName() << " = (" << zig->getVertex(0)->getName()
<< ", " << zig->getVertex(1)->getName() << ") est clone en ";
- cout << zag->getName() << " = (" << zag->getVertex(0)->getName()
- << ", " << zag->getVertex(1)->getName() << ")" << endl;
+ std::cout << zag->getName() << " = (" << zag->getVertex(0)->getName()
+ << ", " << zag->getVertex(1)->getName() << ")" << std::endl;
}
// ========================================================= only_in_hexas
bool only_in_hexas (Hexas& thexas, Quad* quad)
Quad* quad = edge->getParent (nq);
if (NOT only_in_hexas (thexas, quad))
{
- cout << " ... inMoreHexas " << edge->makeDefinition() << endl;
+ std::cout << " ... inMoreHexas " << edge->makeDefinition() << std::endl;
return false;
}
}
- cout << " ... only_in_hexas " << edge->makeDefinition() << endl;
+ std::cout << " ... only_in_hexas " << edge->makeDefinition() << std::endl;
return true;
}
// ========================================================= replace_vertex
DumpStart ("disconnectEdges", thexas << tedges);
if (db)
- cout << " +++ Disconnect Edges" << endl;
+ std::cout << " +++ Disconnect Edges" << std::endl;
Elements* grid = new Elements (this);
if (nbhexas != nbedges)
{
- cout << " **** Error in Document::disconnectEdges\n" << endl;
- cout << " **** Number of Edges and number of Hexas are different\n"
- << endl;
+ std::cout << " **** Error in Document::disconnectEdges\n" << std::endl;
+ std::cout << " **** Number of Edges and number of Hexas are different\n"
+ << std::endl;
return NULL;
}
else if (nbhexas==1)
{
if (BadElement (tedges[nro]))
{
- cout << " **** Eddge number " << nro+1 << " is incorrect"
- << endl;
+ std::cout << " **** Eddge number " << nro+1 << " is incorrect"
+ << std::endl;
return NULL;
}
if (BadElement (thexas[nro]))
{
- cout << " **** Hexa number " << nro+1 << " is incorrect"
- << endl;
+ std::cout << " **** Hexa number " << nro+1 << " is incorrect"
+ << std::endl;
return NULL;
}
if (db)
- cout << nro+1 << " hexa = " << thexas[nro]->getName ()
+ std::cout << nro+1 << " hexa = " << thexas[nro]->getName ()
<< ", edge = " << tedges[nro]->getName ()
<< " = (" << tedges[nro]->getVertex(0)->getName ()
<< ", " << tedges[nro]->getVertex(1)->getName ()
- << ")" << endl;
+ << ")" << std::endl;
}
for (int nro=0 ; nro<nbhexas ; nro++)
int ned = thexas[nro]->findEdge (tedges[nro]);
if (ned==NOTHING)
{
- cout << " **** Edge number " << nro+1
- << " doesnt belong to correspondant hexa" << endl;
+ std::cout << " **** Edge number " << nro+1
+ << " doesnt belong to correspondant hexa" << std::endl;
return NULL;
}
}
- vector <Vertex*> tvertex (nbedges+1);
+ std::vector <Vertex*> tvertex (nbedges+1);
for (int nro=1 ; nro<nbedges ; nro++)
{
tvertex[nro] = tedges[nro]->commonVertex (tedges[nro-1]);
if (tvertex[nro]==NULL)
{
- cout << " **** Edge number " << nro
- << " doesnt intesect next edge" << endl;
+ std::cout << " **** Edge number " << nro
+ << " doesnt intesect next edge" << std::endl;
return NULL;
}
}
int ned = thexas[nro]->findEdge (tedges[nro]);
if (ned==NOTHING)
{
- cout << " **** Edge number " << nro+1
- << " doesnt belong to correspondant hexa" << endl;
+ std::cout << " **** Edge number " << nro+1
+ << " doesnt belong to correspondant hexa" << std::endl;
return NULL;
}
}
// Fin des controles, on peut y aller ...
- map <Edge*, int> state_edge;
- map <Quad*, int> state_quad;
+ std::map <Edge*, int> state_edge;
+ std::map <Quad*, int> state_quad;
enum { UNDEFINED, REPLACED, AS_IS };
- map <Vertex*, Vertex*> new_vertex;
- map <Edge*, Edge*> new_edge;
- map <Quad*, Quad*> new_quad;
+ std::map <Vertex*, Vertex*> new_vertex;
+ std::map <Edge*, Edge*> new_edge;
+ std::map <Quad*, Quad*> new_quad;
- map <Vertex*, Vertex*> :: iterator it_vertex;
- map <Edge*, Edge*> :: iterator it_edge;
- map <Quad*, Quad*> :: iterator it_quad;
+ std::map <Vertex*, Vertex*> :: iterator it_vertex;
+ std::map <Edge*, Edge*> :: iterator it_edge;
+ std::map <Quad*, Quad*> :: iterator it_quad;
#define VertexIsNew(v) (it_vertex=new_vertex.find(v))!=new_vertex.end()
new_vertex [tvertex[nro]] = node1;
if (db)
{
- cout << nro << " : " << tvertex[nro]->getName()
- << " est clone en " << node1->getName() << endl;
+ std::cout << nro << " : " << tvertex[nro]->getName()
+ << " est clone en " << node1->getName() << std::endl;
}
if (nro>0)
}
if (db)
- cout << "_____________________________ Autres substitutions" << endl;
+ std::cout << "_____________________________ Autres substitutions" << std::endl;
// Un edge non remplace, qui contient un vertex remplace
// commun a plus de 2 faces (donc appartenant a un autre hexa)