17
17
18
18
19
19
20
- #include " arcane/ItemGroup.h"
21
- #include " arcane/ItemPrinter.h"
20
+ #include " arcane/core/ ItemGroup.h"
21
+ #include " arcane/core/ ItemPrinter.h"
22
22
#include " arcane/core/IItemFamily.h"
23
- #include " arcane/IGhostLayerMng.h"
24
- #include " arcane/MeshUtils.h"
25
- #include " arcane/IMeshModifier.h"
23
+ #include " arcane/core/ IGhostLayerMng.h"
24
+ #include " arcane/core/ MeshUtils.h"
25
+ #include " arcane/core/ IMeshModifier.h"
26
26
27
27
#include " arcane/core/SimpleSVGMeshExporter.h" // Write au format svg pour le 2D
28
28
// Write variables
29
29
30
30
#include " arcane/core/ServiceBuilder.h"
31
31
#include " arcane/core/Directory.h"
32
32
#include " arcane/core/IVariableMng.h"
33
- #include " arcane/IParallelMng.h"
34
- #include " arcane/BasicService.h"
35
- #include < arcane/IPrimaryMesh.h>
33
+ #include " arcane/core/ IParallelMng.h"
34
+ #include " arcane/core/ BasicService.h"
35
+ #include " arcane/core/ IPrimaryMesh.h"
36
36
37
37
// get parameter
38
38
#include " arcane/utils/ApplicationInfo.h"
39
39
#include " arcane/utils/CommandLineArguments.h"
40
40
41
41
// utils
42
- #include < map>
43
42
#include < unordered_set>
44
43
#include < algorithm>
45
- #include < iostream>
46
44
#include < iterator>
47
- #include < vector>
48
45
49
46
#include " arcane/core/IMeshUtilities.h"
50
47
@@ -110,7 +107,6 @@ subdivideMesh([[maybe_unused]] IPrimaryMesh* mesh)
110
107
Int32 version = gm->builderVersion ();
111
108
if (version < 3 )
112
109
gm->setBuilderVersion (3 );
113
- Int32 nb_ghost_layer = gm->nbGhostLayer ();
114
110
gm->setNbGhostLayer (0 );
115
111
mesh_modifier->setDynamic (true );
116
112
mesh_modifier->updateGhostLayers ();
@@ -124,7 +120,7 @@ subdivideMesh([[maybe_unused]] IPrimaryMesh* mesh)
124
120
// Compter les arrêtes
125
121
// On cherche un moyen de compter les arrêtes pour faire un test facile sur le nombre de noeud inséré.
126
122
// ARCANE_ASSERT((nb_edge_init+ nb_cell_init + nb_face_init)== nb_node_added,("Mauvais nombre de noeuds insérés"));
127
- // std::cout << "#NOMBRE INITS " << nb_node_init << " " << mesh->allEdges().size() << " " << edg.size() << " " << nb_face_init << " " << nb_cell_init << std::endl ;
123
+ // debug() << "#NOMBRE INITS " << nb_node_init << " " << mesh->allEdges().size() << " " << edg.size() << " " << nb_face_init << " " << nb_cell_init ;
128
124
129
125
// VARIABLES
130
126
// Items à ajouter avec connectivités pour E F et C
@@ -138,7 +134,7 @@ subdivideMesh([[maybe_unused]] IPrimaryMesh* mesh)
138
134
139
135
VariableNodeReal3& nodes_coords = mesh->nodesCoordinates ();
140
136
std::unordered_map<Int64, Real3> nodes_to_add_coords;
141
- std::cout << " ARRAY SIZE " << nodes_coords.arraySize () << std::endl ;
137
+ debug () << " ARRAY SIZE " << nodes_coords.arraySize () ;
142
138
// Nodes on entities
143
139
std::set<Int64> new_nodes; // Utiliser une map permet s'assurer qu'on ajoute une seule fois un noeud avec un uniqueId()
144
140
std::set<Int64> new_faces; // ^--- Pareil pour les faces
@@ -160,44 +156,7 @@ subdivideMesh([[maybe_unused]] IPrimaryMesh* mesh)
160
156
nodes_to_add.reserve (nb_node_to_add_total);
161
157
nodes_to_add_coords.reserve (nb_node_to_add_total);
162
158
163
- IParallelMng* pm = mesh->parallelMng ();
164
- // Calcul max_node_uid
165
-
166
- Int64 max_node_uid = 0 ;
167
159
Arcane::VariableNodeReal3& nodes_coordinates = mesh->nodesCoordinates ();
168
-
169
- ENUMERATE_NODE (inode,mesh->allNodes ())
170
- {
171
- const Node& node = *inode;
172
- const Int64 uid = node.uniqueId ();
173
- if (uid>max_node_uid)
174
- max_node_uid = uid;
175
- }
176
- Integer m_max_node_uid = 0 , m_next_node_uid;
177
- if (pm->commSize () > 1 )
178
- m_max_node_uid = pm->reduce (Parallel::ReduceMax, max_node_uid);
179
- else
180
- m_max_node_uid = max_node_uid;
181
- info () << " NODE_UID_INFO: MY_MAX_UID=" << max_node_uid << " GLOBAL=" << m_max_node_uid;
182
- m_next_node_uid = m_max_node_uid + 1 + my_rank;
183
-
184
- // Calcul max_cell_uid
185
- Int64 max_cell_uid = 0 ;
186
- ENUMERATE_CELL (icell,mesh->allCells ())
187
- {
188
- const Cell& cell = *icell;
189
- const Int64 uid = cell.uniqueId ();
190
- if (uid>max_cell_uid)
191
- max_cell_uid = uid;
192
- }
193
- Integer m_max_cell_uid = 0 ;
194
- if (pm->commSize () > 1 )
195
- m_max_cell_uid = pm->reduce (Parallel::ReduceMax, max_cell_uid);
196
- else
197
- m_max_cell_uid = max_cell_uid;
198
-
199
- std::cout << " MAXCELLUID " << max_cell_uid << " " << m_max_cell_uid << std::endl;
200
- max_cell_uid ++;
201
160
Integer ind_new_cell = 0 ;
202
161
203
162
ARCANE_ASSERT ((mesh->nbEdge () == 0 ),(" Wrong number of edge" ));
@@ -252,12 +211,10 @@ subdivideMesh([[maybe_unused]] IPrimaryMesh* mesh)
252
211
node_in_cell[new_nodes_on_edges_couple[i][0 ]],
253
212
node_in_cell[new_nodes_on_edges_couple[i][1 ]],
254
213
};
255
- Int32 min_index=0 ; // tmp[0]
256
214
if ( tmp[0 ] > tmp[1 ] ){
257
215
std::swap (tmp[0 ],tmp[1 ]);
258
- min_index=1 ;
259
216
}
260
- std::cout << " #TMP " << " cell" << cell.uniqueId () << ' ' << tmp << std::endl ;
217
+ debug () << " #TMP " << " cell" << cell.uniqueId () << ' ' << tmp ;
261
218
node_in_cell[index_27] = Arcane::MeshUtils::generateHashUniqueId (tmp.constView ());
262
219
// Coord on edge
263
220
Arcane::Real3 middle_coord (0.0 ,0.0 ,0.0 );
@@ -330,7 +287,7 @@ subdivideMesh([[maybe_unused]] IPrimaryMesh* mesh)
330
287
new_nodes.insert (node_in_cell[i]);
331
288
}
332
289
}
333
- std::cout << nodes_to_add_coords.size () << " " << nodes_to_add.size () << std::endl ;
290
+ debug () << nodes_to_add_coords.size () << " " << nodes_to_add.size () ;
334
291
335
292
ARCANE_ASSERT ((nodes_to_add_coords.size () == static_cast <size_t >(nodes_to_add.size ())),(" Has to be same" ));
336
293
// Génération des Faces
@@ -368,7 +325,7 @@ subdivideMesh([[maybe_unused]] IPrimaryMesh* mesh)
368
325
faces_to_add.add (node_in_cell[internal_faces[i][3 ]]);
369
326
// Ajouter dans tableau uids faces
370
327
faces_uids.add (uidface);
371
- std::cout << 6 + nb_face_to_add << " " << uidface << std::endl ;
328
+ debug () << 6 + nb_face_to_add << " " << uidface ;
372
329
nb_face_to_add++;
373
330
new_faces.insert (uidface);
374
331
}
@@ -473,9 +430,9 @@ subdivideMesh([[maybe_unused]] IPrimaryMesh* mesh)
473
430
UniqueArray<Int32> face_lid (faces_uids.size ());
474
431
475
432
mesh->modifier ()->addFaces (MeshModifierAddFacesArgs (nb_face_to_add, faces_to_add.constView (),face_lid.view ()));
476
- std::cout << " addOneFac" << nb_face_to_add << std::endl ;
433
+ debug () << " addOneFac" << nb_face_to_add ;
477
434
mesh->faceFamily ()->itemsUniqueIdToLocalId (face_lid,faces_uids,true );
478
- std::cout << " NB_FACE_ADDED AFTER " << face_lid.size () << " " << new_faces.size () << std::endl ;
435
+ debug () << " NB_FACE_ADDED AFTER " << face_lid.size () << " " << new_faces.size () ;
479
436
480
437
ARCANE_ASSERT ((nb_face_to_add == (faces_to_add.size ()/6 )),(" non consistant number of faces" ));
481
438
@@ -510,7 +467,7 @@ subdivideMesh([[maybe_unused]] IPrimaryMesh* mesh)
510
467
ENUMERATE_ (Node, inode, mesh->allNodes ()){
511
468
Node node = *inode;
512
469
auto it = std::min_element (node.cells ().begin (),node.cells ().end ());
513
- Cell cell = node.cell (std::distance (node.cells ().begin (),it));
470
+ Cell cell = node.cell (static_cast <Int32>( std::distance (node.cells ().begin (),it) ));
514
471
node_uid_to_owner[node.uniqueId ().asInt64 ()] = cell.owner ();
515
472
}
516
473
@@ -519,7 +476,7 @@ subdivideMesh([[maybe_unused]] IPrimaryMesh* mesh)
519
476
ENUMERATE_ (Face, iface, mesh->allFaces ()){
520
477
Face face = *iface;
521
478
auto it = std::min_element (face.cells ().begin (),face.cells ().end ());
522
- Cell cell = face.cell (std::distance (face.cells ().begin (),it));
479
+ Cell cell = face.cell (static_cast <Int32>( std::distance (face.cells ().begin (),it) ));
523
480
face_uid_to_owner[face.uniqueId ().asInt64 ()] = cell.owner ();
524
481
}
525
482
0 commit comments