Skip to content

Commit 43e4e76

Browse files
committed
[arcane,mesh] Test MeshUtilities in PolyhedralMesh.
1 parent d5fc4c7 commit 43e4e76

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

arcane/src/arcane/tests/MeshPolyhedralTestModule.cc

+40
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ class MeshPolyhedralTestModule : public ArcaneMeshPolyhedralTestObject
5454
_testEnumerationAndConnectivities(mesh());
5555
_testVariables(mesh());
5656
_testGroups(mesh());
57+
_testMeshUtilities(mesh());
5758
}
5859
else
5960
info() << "No Mesh";
@@ -69,6 +70,7 @@ class MeshPolyhedralTestModule : public ArcaneMeshPolyhedralTestObject
6970
void _testGroups(IMesh* mesh);
7071
void _testDimensions(IMesh* mesh);
7172
void _testCoordinates(IMesh* mesh);
73+
void _testMeshUtilities(IMesh* mesh);
7274
void _buildGroup(IItemFamily* family, String const& group_name);
7375
void _checkBoundaryFaceGroup(IMesh* mesh, String const& boundary_face_group_name) const;
7476
void _checkInternalFaceGroup(IMesh* mesh, String const& internal_face_group_name) const;
@@ -384,6 +386,9 @@ _testGroups(IMesh* mesh)
384386
}
385387
ValueChecker vc{ A_FUNCINFO };
386388
auto nb_internal_group = 19;
389+
if (subDomain()->parallelMng()->isParallel()) {
390+
nb_internal_group = 23;
391+
}
387392
auto nb_group = nb_internal_group + options()->nbMeshGroup;
388393
vc.areEqual(nb_group, mesh->groups().count(), "check number of groups in the mesh");
389394

@@ -435,6 +440,41 @@ _testCoordinates(Arcane::IMesh* mesh)
435440
/*---------------------------------------------------------------------------*/
436441
/*---------------------------------------------------------------------------*/
437442

443+
void MeshPolyhedralTestModule::
444+
_testMeshUtilities(Arcane::IMesh* mesh)
445+
{
446+
auto* mesh_utilities = mesh->utilities();
447+
ARCANE_CHECK_POINTER(mesh_utilities);
448+
// Test change owner from cells
449+
// wip test in sequential: virtually change all cell owners to 1 and check all items have 1 as owner
450+
auto& cell_owners = mesh->cellFamily()->itemsNewOwner();
451+
auto& face_owners = mesh->faceFamily()->itemsNewOwner();
452+
auto& edge_owners = mesh->edgeFamily()->itemsNewOwner();
453+
auto& node_owners = mesh->nodeFamily()->itemsNewOwner();
454+
ENUMERATE_(Cell,icell,allCells()) {
455+
cell_owners[icell] = 1;
456+
info() << "Cell uid " << icell->uniqueId() << " cell_owner[icell] " << cell_owners[icell];
457+
info() << "Cell uid " << icell->uniqueId() << " has owner " << icell->owner();
458+
}
459+
mesh_utilities->changeOwnersFromCells();
460+
bool has_error = false;
461+
ENUMERATE_ (Face,iface,allFaces()) {
462+
has_error |= face_owners[iface] != 1;
463+
}
464+
ENUMERATE_ (Node,inode,allNodes()) {
465+
has_error |= node_owners[inode] != 1;
466+
}
467+
ENUMERATE_ (Edge,iedge,allEdges()) {
468+
has_error |= edge_owners[iedge] != 1;
469+
}
470+
if (has_error) {
471+
ARCANE_FATAL("changeOwnerFromCells does not work with PolyhedralMesh");
472+
}
473+
}
474+
475+
/*---------------------------------------------------------------------------*/
476+
/*---------------------------------------------------------------------------*/
477+
438478
void MeshPolyhedralTestModule::
439479
_buildGroup(IItemFamily* family, String const& group_name)
440480
{

0 commit comments

Comments
 (0)