14#include "arcane/utils/String.h"
15#include "arcane/utils/HashTableMap.h"
16#include "arcane/utils/Real3.h"
17#include "arcane/utils/OStringStream.h"
18#include "arcane/utils/NotImplementedException.h"
19#include "arcane/utils/PlatformUtils.h"
20#include "arcane/utils/ITraceMng.h"
21#include "arcane/utils/Collection.h"
22#include "arcane/utils/Enumerator.h"
23#include "arcane/utils/CheckedConvert.h"
25#include "arcane/mesh/TiedInterface.h"
27#include "arcane/core/IMesh.h"
28#include "arcane/core/IMeshSubMeshTransition.h"
30#include "arcane/core/ItemGroup.h"
31#include "arcane/core/Item.h"
32#include "arcane/core/ISubDomain.h"
33#include "arcane/core/VariableTypes.h"
34#include "arcane/core/IItemFamily.h"
35#include "arcane/core/ItemCompare.h"
36#include "arcane/core/IParallelMng.h"
37#include "arcane/core/GeometricUtilities.h"
38#include "arcane/core/SerializeBuffer.h"
39#include "arcane/core/ItemPrinter.h"
40#include "arcane/core/IMeshUtilities.h"
60 std::ostream& o = cout;
67 <<
" MasterFacesSlaveFaceIndex=" << m_master_faces_slave_face_index.size()
68 <<
" MasterFacesSlaveNodeIndex=" << m_master_faces_slave_node_index.size()
98 Integer size()
const {
return m_nodes_unique_id.size(); }
101 m_nodes_unique_id.add(node_unique_id);
112class TiedInterfaceNodeInfo
116 TiedInterfaceNodeInfo()
160class TiedInterfaceFace
165 : m_unique_id(NULL_ITEM_ID)
166 , m_cell_unique_id(NULL_ITEM_ID)
174 : m_unique_id(unique_id)
175 , m_cell_unique_id(cell_unique_id)
178 , m_data_index(data_index)
190 return m_cell_unique_id;
198 return m_mng->m_nodes_unique_id[m_data_index + i];
204 void setCenter(
Real3 center)
230class TiedInterfaceMasterFace
239 : m_unique_id(NULL_ITEM_ID)
259 TiedInterfaceMasterFace()
260 : m_unique_id(NULL_ITEM_ID)
263 : m_unique_id(unique_id)
275 ItemUniqueId m_unique_id;
276 SharedArray<TiedInterfaceFace*> m_slave_faces;
282class TiedInterfaceSortedNodeInfo
294 bool operator<(
const TiedInterfaceSortedNodeInfo& rhs)
const
296 if (m_alpha != rhs.m_alpha)
297 return m_alpha < rhs.m_alpha;
298 if (m_beta != rhs.m_beta)
299 return (m_beta < rhs.m_beta);
300 return (m_uid < rhs.m_uid);
317class TiedInterfaceStructurationInfo
322 : m_node_uid(node_uid)
329 TiedInterfaceStructurationInfo()
330 : m_node_uid(NULL_ITEM_UNIQUE_ID)
340 bool operator<(
const TiedInterfaceStructurationInfo& rhs)
const
353 if (
m_x != (-1) && x !=
m_x)
354 ARCANE_FATAL(
"already set with a different x value old={0} new={1}",
m_x, x);
355 if (
m_y != (-1) && y !=
m_y)
356 ARCANE_FATAL(
"already set with a different y value old={0} new={1}",
m_y, y);
360 bool hasStructuration()
const
362 return (
m_x != (-1) &&
m_y != (-1));
402class TiedInterfaceBuilder
411 typedef std::set<TiedInterfaceSortedNodeInfo> SortedNodeInfoSet;
417 TiedInterfaceBuilder(
IMesh*
mesh,
const FaceGroup& slave_interface,
bool use_own,
bool is_debug);
418 void setPlanarTolerance(
Real tolerance);
426 const FaceGroup& masterInterface()
const {
return m_master_interface; }
435 NodeInfoList m_nodes_info;
436 TiedInterfaceFaceMap m_slave_faces;
437 TiedInterfaceFaceMap m_master_faces;
438 String m_slave_interface_name;
443 Real m_planar_tolerance;
454 TiedInterfaceFaceMap& face_map);
456 void _printFaces(std::ostream& o, TiedInterfaceFaceMap& face_map);
458 void _addFaceToList(
const Face& face, TiedInterfaceFaceMap& face_map);
460 StructurationMap& nodes);
463 StructurationMap& slave_nodes);
470TiedInterfaceBuilder::
472 bool use_own,
bool is_debug)
474, m_is_debug(is_debug)
476, m_nodes_coord(m_mesh->toPrimaryMesh()->nodesCoordinates())
477, m_nodes_info(1000, true)
478, m_slave_faces(5000, true)
479, m_master_faces(1000, true)
480, m_slave_interface_name(slave_interface.name())
481, m_slave_interface(slave_interface)
482, m_slave_faces_master_face_uid(1000, true)
483, m_planar_tolerance(0.0)
486 m_slave_interface = slave_interface.own();
492void TiedInterfaceBuilder::
493setPlanarTolerance(
Real tolerance)
495 m_planar_tolerance = tolerance;
501void TiedInterfaceBuilder::
502_searchMasterFaces(Array<ItemUniqueId>& slave_faces_to_process,
503 Array<ItemUniqueId>& remaining_slave_faces)
505 String func_name =
"TiedInterfaceBuilder::_searchMasterFaces()";
507 std::set<ItemUniqueId> master_faces_to_test;
508 UniqueArray<ItemUniqueId> master_faces_found;
509 master_faces_found.reserve(100);
511 slave_face_nodes_coord.
reserve(100);
516 info() <<
"nb slave faces to process=" << slave_faces_to_process.size();
519 for (
Integer islaveface = 0, izz = slave_faces_to_process.size(); islaveface < izz; ++islaveface) {
520 master_faces_to_test.clear();
521 master_faces_found.clear();
523 TiedInterfaceFace& face = m_slave_faces[slave_faces_to_process[islaveface]];
525 slave_face_nodes_coord.clear();
527 Integer nb_node = face.nbNode();
528 triangle_centers.resize(nb_node);
530 for (
Integer inode = 0; inode < nb_node; ++inode) {
531 TiedInterfaceNodeInfo& node_info = m_nodes_info[face.nodeUniqueId(inode)];
532 slave_face_nodes_coord.add(node_info.m_coord);
533 for (
Integer zface = 0, zz = node_info.m_connected_master_faces.size(); zface < zz; ++zface) {
534 master_faces_to_test.insert(node_info.m_connected_master_faces[zface]);
538 for (
Integer inode = 0; inode < nb_node; ++inode) {
539 triangle_centers[inode] = (slave_face_nodes_coord[inode] + slave_face_nodes_coord[(inode + 1) % nb_node] + face.center()) / 3.;
544 for (std::set<ItemUniqueId>::const_iterator i_master_face(master_faces_to_test.begin());
545 i_master_face != master_faces_to_test.end(); ++i_master_face) {
546 TiedInterfaceFaceMap::Data* data = m_master_faces.lookup(*i_master_face);
548 ARCANE_FATAL(
"INTERNAL: Can not find face uid={0}", *i_master_face);
549 const TiedInterfaceFace& master_face = data->value();
550 bool is_found =
false;
551 for (
Integer inode = 0; inode < nb_node; ++inode) {
552 if (_isInsideFace(master_face, triangle_centers[inode])) {
571 master_faces_found.add(master_face.uniqueId());
574 switch (master_faces_found.size()) {
576 ItemUniqueId master_face_uid = master_faces_found[0];
578 for (
Integer inode = 0; inode < nb_node; ++inode) {
579 TiedInterfaceNodeInfo& node_info = m_nodes_info[face.nodeUniqueId(inode)];
580 node_info.m_connected_master_faces.add(master_face_uid);
588 remaining_slave_faces.add(face.uniqueId());
599 Real3 face_normale = _computeNormale(face);
601 ostr() <<
"Too many master faces for a slave face (max=1) "
602 <<
" nb_master=" << master_faces_found.size()
603 <<
" (slave_face=" << face.uniqueId() <<
",normal=" << face_normale <<
")"
607 for (
Integer zz = 0; zz < master_faces_found.size(); ++zz) {
608 ItemUniqueId muid = master_faces_found[zz];
609 const TiedInterfaceFace& master_face = m_master_faces.lookupValue(muid);
610 Real3 n = _computeNormale(master_face);
612 if (math::abs(d) > max_dot) {
613 max_dot = math::abs(d);
616 ostr() <<
" (uid=" << muid <<
",nb_node=" << master_face.nbNode()
617 <<
" center=" << master_face.center()
622 if (keep_index >= 0) {
623 info() << func_name <<
" " << ostr.str() <<
". Keeping index=" << keep_index;
625 ItemUniqueId master_face_uid = master_faces_found[keep_index];
626 for (
Integer inode = 0; inode < nb_node; ++inode) {
627 TiedInterfaceNodeInfo& node_info = m_nodes_info[face.nodeUniqueId(inode)];
628 node_info.m_connected_master_faces.add(master_face_uid);
665 Integer nb_node = face.nbNode();
670 for (
Integer inode = 0; inode < nb_node; ++inode) {
671 Real3 v1 = m_nodes_info[face.nodeUniqueId(inode)].m_coord;
672 Real3 v2 = m_nodes_info[face.nodeUniqueId((inode + 1) % nb_node)].m_coord;
694 else if (nb_node == 3) {
695 Real3 v1 = m_nodes_info[face.nodeUniqueId(0)].m_coord;
696 Real3 v2 = m_nodes_info[face.nodeUniqueId(1)].m_coord;
697 Real3 v3 = m_nodes_info[face.nodeUniqueId(2)].m_coord;
698 min_distance = min_distance.
projection(v1, v2, v3, point);
700 else if (nb_node == 2) {
701 Real3 v1 = m_nodes_info[face.nodeUniqueId(0)].m_coord;
702 Real3 v2 = m_nodes_info[face.nodeUniqueId(1)].m_coord;
703 min_distance = min_distance.
projection(v1, v2, point);
711Real3 TiedInterfaceBuilder::
714 Integer nb_node = face.nbNode();
717 for (
Integer inode = 0; inode < nb_node; ++inode) {
718 Real3 v1 = m_nodes_info[face.nodeUniqueId(inode)].m_coord;
719 Real3 v2 = m_nodes_info[face.nodeUniqueId((inode + 1) % nb_node)].m_coord;
720 Real3 v3 = m_nodes_info[face.nodeUniqueId((inode + 2) % nb_node)].m_coord;
721 Real3 vd_a = v1 - v2;
722 Real3 vd_b = v3 - v2;
724 normale += local_normale;
727 else if (nb_node == 2) {
728 Real3 v1 = m_nodes_info[face.nodeUniqueId(0)].m_coord;
729 Real3 v2 = m_nodes_info[face.nodeUniqueId(1)].m_coord;
730 if (v1.z != 0.0 || v2.z != 0.0)
731 throw NotImplementedException(A_FUNCINFO,
"edge in 3D space");
732 Real x = v2.x - v1.x;
733 Real y = v2.y - v1.y;
734 normale = Real3(-y, x, 0.0);
737 throw NotSupportedException(A_FUNCINFO,
"can not compute normal of face with 0 or 1 node");
738 return normale.normalize();
744bool TiedInterfaceBuilder::
747 Integer nb_node = face.nbNode();
749 for (
Integer inode = 0; inode < nb_node; ++inode) {
750 Real3 v1 = m_nodes_info[face.nodeUniqueId(inode)].m_coord;
751 Real3 v2 = m_nodes_info[face.nodeUniqueId((inode + 1) % nb_node)].m_coord;
752 if (m_planar_tolerance != 0.0) {
754 if (math::abs(ecart) > m_planar_tolerance *
math::normeR3(v1 - v2)) {
756 info() <<
"Reject non planar projection " << point <<
" from face uid=" << face.uniqueId();
764 else if (nb_node == 2) {
765 Real3 v1 = m_nodes_info[face.nodeUniqueId(0)].m_coord;
766 Real3 v2 = m_nodes_info[face.nodeUniqueId(1)].m_coord;
795 std::set<ItemUniqueId> slave_faces_flag;
797 Integer nb_slave_face = m_slave_interface.size();
798 m_nodes_info.resize((nb_slave_face * 2) + 5);
799 m_master_faces.resize(nb_slave_face + 5);
800 m_slave_faces.resize((nb_slave_face * 2) + 5);
805 const Face& face = *iface;
806 slave_faces_flag.insert(face.
uniqueId());
807 _addFaceToList(face, m_slave_faces);
810 info() <<
"SLAVE_INTERFACE: nb_face=" << m_slave_interface.size();
813 bool has_not_handled_face =
false;
815 const Face& face = *iface;
817 if (slave_faces_flag.find(face.
uniqueId()) != slave_faces_flag.end())
820 bool is_master_face =
true;
824 if (!m_nodes_info.lookup(uid)) {
825 is_master_face =
false;
829 if (is_master_face) {
831 if (nb_node != 4 && nb_node != 2)
832 has_not_handled_face =
true;
838 _addFaceToList(face, m_master_faces);
841 if (has_not_handled_face)
842 ARCANE_FATAL(
"Some faces of the tied interface '{0}' has incorrect number of nodes (should be 2 or 4)",
843 m_slave_interface.name());
845 m_master_interface = m_mesh->faceFamily()->createGroup(m_slave_interface_name +
"_MASTER",
846 master_faces_lid,
true);
847 info() <<
"MASTER_INTERFACE: nb_face=" << m_master_interface.size();
853void TiedInterfaceBuilder::
854_addFaceToList(
const Face& face, TiedInterfaceFaceMap& face_map)
857 Real3 center(0., 0., 0.);
858 Integer data_index = m_face_info_mng.size();
860 Real3 node_coord = m_nodes_coord[node];
862 NodeInfoList::Data* i = m_nodes_info.
lookup(uid);
865 node_info.m_coord = node_coord;
866 m_nodes_info.
add(uid, node_info);
868 m_face_info_mng.add(uid);
869 center += node_coord;
875 sf.setCenter(center);
888 std::set<ItemUniqueId> master_face_with_slave;
890 for (TiedInterfaceFaceMapEnumerator i(m_slave_faces); ++i;) {
893 master_face_with_slave.insert(master_uid);
900 if (master_face_with_slave.find(uid) == master_face_with_slave.end()) {
901 local_ids_to_remove.
add(iface.itemLocalId());
905 if (!local_ids_to_remove.
empty()) {
906 info() <<
"Removing faces from master list name=" << m_master_interface.name()
907 <<
" ids=" << local_ids_to_remove;
908 m_master_interface.removeItems(local_ids_to_remove,
false);
915void TiedInterfaceBuilder::
919 Integer nb_master_face = m_master_interface.
size();
920 MasterFaceList m_master_faces_full((nb_master_face * 2) + 1,
true);
928 const Face& face = *iface;
933 for (TiedInterfaceFaceMapEnumerator i(m_slave_faces); ++i;) {
934 TiedInterfaceFace& slave_face = *i;
936 TiedInterfaceMasterFace& mf = m_master_faces_full[master_uid];
937 mf.m_slave_faces.add(&slave_face);
942 ItemUniqueId master_uid = face.uniqueId();
944 TiedInterfaceMasterFace& mf = m_master_faces_full[master_uid];
945 Integer master_face_nb_slave_face = mf.m_slave_faces.size();
948 info() <<
"MASTER FACE uid=" << master_uid <<
" NB_SLAVE_FACE=" << master_face_nb_slave_face
949 <<
" face_owner=" << face.owner();
953 for (
Integer zz = 0; zz < master_face_nb_slave_face; ++zz) {
954 ItemUniqueId slave_uid = mf.m_slave_faces[zz]->uniqueId();
959 std::set<ItemUniqueId> slave_nodes_set;
960 SortedNodeInfoSet slave_nodes_sorted_set;
962 bool is_dimension_2d = m_mesh->dimension() == 2;
964 Face master_face = *imasterface;
965 ItemUniqueId master_uid = master_face.uniqueId();
966 slave_nodes_set.clear();
967 slave_nodes_sorted_set.clear();
968 TiedInterfaceMasterFace& face2 = m_master_faces_full[master_uid];
970 Integer face2_nb_node = master_face.nbNode();
971 info() <<
"MASTER FACE: uid=" << face2.uniqueId()
972 <<
" cell_uid=" << master_face.cell(0).uniqueId()
973 <<
" cell_owner=" << master_face.cell(0).owner()
974 <<
" nb_node=" << face2_nb_node;
975 for (
Integer in2 = 0; in2 < face2_nb_node; ++in2)
976 info() <<
"Node " << in2 <<
" uid=" << master_face.node(in2).uniqueId();
978 TiedInterfaceFace& face = m_master_faces[face2.uniqueId()];
979 Integer nb_node = face.nbNode();
980 Integer nb_slave_face = face2.m_slave_faces.size();
981 for (
Integer i = 0; i < nb_slave_face; ++i) {
982 const TiedInterfaceFace& slave_face = *face2.m_slave_faces[i];
983 Integer slave_nb_node = slave_face.nbNode();
984 for (
Integer z = 0; z < slave_nb_node; ++z) {
985 ItemUniqueId node_uid = slave_face.nodeUniqueId(z);
986 slave_nodes_set.insert(node_uid);
991 info() <<
"MASTER FACE: NB_SLAVE_FACE=" << nb_slave_face
992 <<
" NB_SLAVE_NODE=" << slave_nodes_set.size();
996 std::set<ItemUniqueId>::const_iterator i_node = slave_nodes_set.begin();
999 GeometricUtilities::QuadMapping face_mapping;
1000 for (
Integer i = 0; i < nb_node; ++i) {
1001 ItemUniqueId node_uid = face.nodeUniqueId(i);
1002 face_mapping.m_pos[i] = m_nodes_info[node_uid].m_coord;
1005 for (; i_node != slave_nodes_set.end(); ++i_node) {
1006 ItemUniqueId node_uid = *i_node;
1007 TiedInterfaceNodeInfo& node_info = m_nodes_info[node_uid];
1009 Real3 point = node_info.m_coord;
1010 GeometricUtilities::ProjectionInfo projection =
_findProjection(face, point);
1012 info() <<
"POINT PROJECTION: uid=" << node_uid <<
' '
1013 << projection.m_projection <<
" r=" << projection.m_region
1014 <<
" d=" << projection.m_distance
1015 <<
" alpha=" << projection.m_alpha
1016 <<
" beta=" << projection.m_beta;
1017 bool is_bad = face_mapping.cartesianToIso(point, uvw, 0);
1019 info() <<
"ISO1 =" << uvw;
1020 is_bad = face_mapping.cartesianToIso2(point, uvw, 0);
1022 info() <<
"ISO2 =" << uvw;
1024 warning() <<
"Can not compute iso-coordinates for point " << point;
1025 face_mapping.cartesianToIso(point, uvw,
traceMng());
1028 if (math::abs(uvw.x) > 1.1 || math::abs(uvw.y) > 1.1 || math::abs(uvw.z) > 1.1) {
1029 info() <<
"BAD PROJECTION INFO";
1030 info() <<
"P0 = " << face_mapping.m_pos[0];
1031 info() <<
"P1 = " << face_mapping.m_pos[1];
1032 info() <<
"P2 = " << face_mapping.m_pos[2];
1033 info() <<
"P3 = " << face_mapping.m_pos[3];
1034 warning() <<
"Internal: bad iso value: " << uvw
1035 <<
" node=" << node_uid <<
" pos=" << point
1036 <<
" projection=" << projection.m_projection
1037 <<
" face_uid=" << face.uniqueId()
1038 <<
" cell_uid=" << face.cellUniqueId();
1039 face_mapping.cartesianToIso(point, uvw,
traceMng());
1040 face_mapping.cartesianToIso(projection.m_projection, uvw,
traceMng());
1050 if (node_uid == face.nodeUniqueId(0)) {
1051 uvw.x = ARCANE_REAL(-1.0);
1052 uvw.y = ARCANE_REAL(-1.0);
1054 else if (node_uid == face.nodeUniqueId(1)) {
1055 uvw.x = ARCANE_REAL(1.0);
1056 uvw.y = ARCANE_REAL(-1.0);
1058 else if (node_uid == face.nodeUniqueId(2)) {
1059 uvw.x = ARCANE_REAL(1.0);
1060 uvw.y = ARCANE_REAL(1.0);
1062 else if (node_uid == face.nodeUniqueId(3)) {
1063 uvw.x = ARCANE_REAL(-1.0);
1064 uvw.y = ARCANE_REAL(1.0);
1067 slave_nodes_sorted_set.insert(TiedInterfaceSortedNodeInfo(node_uid, uvw.x, uvw.y));
1071 else if (nb_node == 2) {
1072 for (; i_node != slave_nodes_set.end(); ++i_node) {
1073 ItemUniqueId node_uid = *i_node;
1074 TiedInterfaceNodeInfo& node_info = m_nodes_info[node_uid];
1075 Real3 point = node_info.m_coord;
1076 GeometricUtilities::ProjectionInfo projection =
_findProjection(face, point);
1083 Real alpha = projection.m_alpha;
1084 if (node_uid == face.nodeUniqueId(0)) {
1085 alpha = ARCANE_REAL(0.0);
1087 else if (node_uid == face.nodeUniqueId(1)) {
1088 alpha = ARCANE_REAL(1.0);
1090 slave_nodes_sorted_set.insert(TiedInterfaceSortedNodeInfo(node_uid, alpha, 0.0));
1094 ARCANE_FATAL(
"Can not detect structuration for face with nb_node={0}."
1095 " Valid values are 2 or 4",
1098 if (slave_nodes_sorted_set.size() != slave_nodes_set.size()) {
1099 ARCANE_FATAL(
"Internal: error sorting nodes in TiedInterface: bad compare");
1103 if (is_structured) {
1104 StructurationMap struct_map(CheckedConvert::toInteger(slave_nodes_sorted_set.size() * 2),
true);
1105 SortedNodeInfoSet::const_iterator i_node = slave_nodes_sorted_set.begin();
1106 for (; i_node != slave_nodes_sorted_set.end(); ++i_node) {
1107 const TiedInterfaceSortedNodeInfo& node = *i_node;
1108 ItemUniqueId uid = node.uniqueId();
1109 TiedInterfaceStructurationInfo struct_info(uid, node.m_alpha, node.m_beta);
1110 struct_map.add(uid, struct_info);
1112 info() <<
"Add to struct map node_uid=" << uid <<
" alpha=" << node.m_alpha <<
" beta=" << node.m_beta;
1114 _detectStructuration(face2, struct_map);
1119 TiedInterfaceStructurationInfo sinfo = struct_map[face.nodeUniqueId(nb_node / 2)];
1121 info() <<
"********* STRUCTURE X=" << sinfo.m_x <<
" Y=" << sinfo.m_y;
1126 slave_nodes_sorted_set.clear();
1127 for (StructurationMapEnumerator imap(struct_map); ++imap;) {
1128 TiedInterfaceStructurationInfo& minfo = *imap;
1129 ItemUniqueId node_uid = minfo.m_node_uid;
1130 Real old_alpha = minfo.m_alpha;
1131 Real old_beta = minfo.m_beta;
1132 Real new_alpha = 0.0;
1133 Real new_beta = 0.0;
1134 if (is_dimension_2d) {
1137 new_alpha = (1.0 * minfo.m_x) / rx;
1141 new_alpha = -1.0 + (2.0 * minfo.m_x) / rx;
1143 new_beta = -1.0 + (2.0 * minfo.m_y) / ry;
1146 info() <<
"NEW NODE oldx=" << old_alpha <<
" newx=" << new_alpha
1147 <<
" oldy=" << old_beta <<
" newy=" << new_beta;
1148 slave_nodes_sorted_set.insert(TiedInterfaceSortedNodeInfo(node_uid, new_alpha, new_beta));
1152 SortedNodeInfoSet::const_iterator i_node = slave_nodes_sorted_set.begin();
1153 for (; i_node != slave_nodes_sorted_set.end(); ++i_node) {
1154 const TiedInterfaceSortedNodeInfo& node = *i_node;
1156 info() <<
"ADD TO SLAVE NODE: node_uid=" << node.m_uid
1157 <<
" alpha=" << node.m_alpha
1158 <<
" beta=" << node.m_beta;
1169void TiedInterfaceBuilder::
1171 StructurationMap& slave_nodes)
1173 Integer nb_slave_face = master_face.m_slave_faces.size();
1176 TiedInterfaceFace& mface = m_master_faces[master_face.uniqueId()];
1177 TiedInterfaceStructurationInfo& sinfo = slave_nodes[mface.nodeUniqueId(0)];
1178 sinfo.setStructuration(0, 0);
1180 UniqueArray<ItemUniqueId> slave_faces;
1181 UniqueArray<ItemUniqueId> remaining_slave_faces;
1182 for (
Integer i = 0; i < nb_slave_face; ++i) {
1183 const TiedInterfaceFace& slave_face = *master_face.m_slave_faces[i];
1184 slave_faces.add(slave_face.uniqueId());
1187 for (
Integer zz = 0; zz < (nb_slave_face + 1); ++zz) {
1188 remaining_slave_faces.clear();
1189 Integer nb_to_process = slave_faces.size();
1190 _detectStructurationRecursive(slave_faces, remaining_slave_faces, slave_nodes);
1191 Integer nb_remaining = remaining_slave_faces.size();
1192 if (nb_remaining == 0)
1194 if (nb_to_process == nb_remaining) {
1195 ARCANE_FATAL(
"Can not compute structuration for a tied interface"
1196 " remaining_slaves={0}",
1199 slave_faces.copy(remaining_slave_faces);
1206void TiedInterfaceBuilder::
1207_detectStructurationRecursive(Array<ItemUniqueId>& slave_faces,
1208 Array<ItemUniqueId>& remaining_slave_faces,
1209 StructurationMap& slave_nodes)
1225 for (
Integer i = 0, is = slave_faces.size(); i < is; ++i) {
1227 TiedInterfaceStructurationInfo old_sinfo;
1228 const TiedInterfaceFace& face = m_slave_faces[slave_faces[i]];
1229 Integer nb_node = face.nbNode();
1230 for (
Integer z = 0; z < nb_node; ++z) {
1231 ItemUniqueId node_uid = face.nodeUniqueId(z);
1232 const TiedInterfaceStructurationInfo& sinfo = slave_nodes[node_uid];
1234 info() <<
"CHECK NODE face_uid=" << face.uniqueId()
1235 <<
" node_uid=" << node_uid
1236 <<
" x=" << sinfo.m_x
1237 <<
" y=" << sinfo.m_y
1238 <<
" alpha=" << sinfo.m_alpha
1239 <<
" beta=" << sinfo.m_beta;
1240 if (sinfo.hasStructuration()) {
1246 if (node_index == (-1)) {
1247 remaining_slave_faces.add(slave_faces[i]);
1251 for (
Integer z = 1; z < nb_node; ++z) {
1252 ItemUniqueId next_uid = face.nodeUniqueId((node_index + z) % nb_node);
1253 TiedInterfaceStructurationInfo& next_info = slave_nodes[next_uid];
1254 Real diff_alpha = next_info.m_alpha - old_sinfo.m_alpha;
1255 Real diff_beta = next_info.m_beta - old_sinfo.m_beta;
1258 if (math::abs(diff_alpha) > math::abs(diff_beta)) {
1260 if (next_info.m_alpha > old_sinfo.m_alpha) {
1262 info() <<
"SUP_ALPHA SET NEXT uid=" << next_uid <<
" x=" << (x + 1) <<
" y=" << (y);
1263 next_info.setStructuration(x + 1, y);
1267 info() <<
"INF_ALPHA SET NEXT uid=" << next_uid <<
" x=" << (x - 1) <<
" y=" << (y);
1268 next_info.setStructuration(x - 1, y);
1273 if (next_info.m_beta > old_sinfo.m_beta) {
1275 info() <<
"SUP_BETA SET NEXT uid=" << next_uid <<
" x=" << (x) <<
" y=" << (y + 1);
1276 next_info.setStructuration(x, y + 1);
1280 info() <<
"INF_BETA SET NEXT uid=" << next_uid <<
" x=" << (x) <<
" y=" << (y - 1);
1281 next_info.setStructuration(x, y - 1);
1284 old_sinfo = next_info;
1292void TiedInterfaceBuilder::
1293_printFaces(std::ostream& o, TiedInterfaceFaceMap& face_map)
1297 typedef std::map<ItemUniqueId, TiedInterfaceFace*> FacesMap;
1300 for (TiedInterfaceFaceMapEnumerator i(face_map); ++i;) {
1301 TiedInterfaceFace* mf = &i.m_current_data->value();
1302 faces.insert(std::make_pair(mf->uniqueId(), mf));
1305 for (FacesMap::const_iterator i(faces.begin()); i != faces.end(); ++i) {
1306 TiedInterfaceFace& mf = *(i->second);
1307 Integer nb_node = mf.nbNode();
1308 o <<
" face=" << mf.uniqueId() <<
" nb_node=" << nb_node
1309 <<
" center=" << mf.center() <<
'\n';
1310 for (
Integer z = 0; z < nb_node; ++z) {
1311 ItemUniqueId nuid(mf.nodeUniqueId(z));
1312 o <<
" node uid=" << nuid <<
" coord=" << m_nodes_info[nuid].m_coord <<
'\n';
1337 for (NodeInfoListEnumerator i(m_nodes_info); ++i;) {
1340 unique_ids.
add(ni.uniqueId());
1345 nb_connected_master_faces.
add(nb_connected);
1346 for (
Integer z = 0; z < nb_connected; ++z)
1354 sbuf.
setMode(ISerializer::ModeReserve);
1355 sbuf.reserveInteger(1);
1356 sbuf.reserveInteger(1);
1358 sbuf.reserveInteger(nb_connected_master_faces.
size());
1366 sbuf.
put(unique_ids);
1367 sbuf.
put(nb_connected_master_faces);
1368 sbuf.
put(connected_master_faces);
1375 for (
Integer i = 0; i < nb_rank; ++i) {
1378 unique_ids.
resize(nb_node);
1379 nb_connected_master_faces.
resize(nb_node);
1380 connected_master_faces.
resize(nb_connected_face);
1381 coords.
resize(nb_node * 3);
1383 recv_buf.
get(unique_ids);
1384 recv_buf.
get(nb_connected_master_faces);
1385 recv_buf.
get(connected_master_faces);
1386 recv_buf.
get(coords);
1391 for (
Integer z = 0; z < nb_node; ++z) {
1392 Integer nb_face = nb_connected_master_faces[z];
1395 NodeInfoList::Data* data = m_nodes_info.lookup(uid);
1399 for (
Integer zz = 0; zz < nb_face; ++zz) {
1400 ItemUniqueId fuid(connected_master_faces[face_index + zz]);
1402 ni.addConnectedFace(fuid);
1406 face_index += nb_face;
1423 TiedInterfaceFaceMap& face_map)
1430 sbuf.
setMode(ISerializer::ModeReserve);
1436 nodes_unique_id.
reserve(nb_to_send * 4);
1439 coords.
reserve(3 * nb_to_send);
1441 nodes_coords.
reserve(3 * nb_to_send);
1442 for (
Integer i = 0; i < nb_to_send; ++i) {
1444 for (
Integer z = 0, zs = mf.nbNode(); z < zs; ++z) {
1446 nodes_unique_id.
add(nuid.asInt64());
1452 unique_ids[i] = mf.uniqueId().asInt64();
1453 cells_unique_ids[i] = mf.cellUniqueId().asInt64();
1454 nb_nodes[i] = mf.nbNode();
1456 coords.
add(mf.center().
x);
1457 coords.
add(mf.center().
y);
1458 coords.
add(mf.center().
z);
1460 sbuf.reserveInteger(1);
1461 sbuf.reserveInteger(1);
1462 sbuf.reserveInteger(1);
1465 sbuf.reserveInteger(nb_nodes.
size());
1474 sbuf.
put(unique_ids);
1475 sbuf.
put(cells_unique_ids);
1477 sbuf.
put(nodes_unique_id);
1479 sbuf.
put(nodes_coords);
1485 for (
Integer i = 0; i < nb_rank; ++i) {
1490 unique_ids.
resize(nb_face);
1491 cells_unique_ids.
resize(nb_face);
1492 nb_nodes.
resize(nb_face);
1493 nodes_unique_id.
resize(nb_node_unique_id);
1494 coords.
resize(nb_face * 3);
1495 nodes_coords.
resize(nb_node_unique_id * 3);
1497 recv_buf.
get(unique_ids);
1498 recv_buf.
get(cells_unique_ids);
1499 recv_buf.
get(nb_nodes);
1500 recv_buf.
get(nodes_unique_id);
1501 recv_buf.
get(coords);
1502 recv_buf.
get(nodes_coords);
1507 for (
Integer z = 0; z < nb_face; ++z) {
1508 Integer nb_node = nb_nodes[z];
1511 if (!face_map.
hasKey(uid)) {
1513 center.
x = coords[z * 3];
1514 center.
y = coords[z * 3 + 1];
1515 center.
z = coords[z * 3 + 2];
1518 Integer data_index = m_face_info_mng.size();
1519 for (
Integer zz = 0; zz < nb_node; ++zz) {
1521 m_face_info_mng.add(nuid);
1524 ni.
m_coord.
x = nodes_coords[(node_index + zz) * 3];
1525 ni.
m_coord.
y = nodes_coords[(node_index + zz) * 3 + 1];
1526 ni.
m_coord.
z = nodes_coords[(node_index + zz) * 3 + 2];
1528 m_nodes_info.
add(nuid, ni);
1530 TiedInterfaceFace sf(uid, cell_uid, nb_node, sid, data_index, &m_face_info_mng);
1531 sf.setCenter(center);
1532 face_map.
add(uid, sf);
1534 node_index += nb_node;
1559 cells_nb_connected.
fill(0);
1566 Integer master_owner = m_master_faces[master_face].owner();
1569 ++cells_nb_connected[cell_lid];
1570 if (cells_nb_connected[cell_lid] > 1) {
1571 ARCANE_FATAL(
"Cell {0} is connected to more than one master face",
1574 cells_owner[slave_cell] = master_owner;
1604 Int32 master_owner = m_master_faces[master_face].owner();
1607 ItemUniqueId last_master_uid = cells_last_master_uid[cell_lid];
1609 ItemUniqueId master_face_cell_uid = m_master_faces[master_face].cellUniqueId();
1611 if (slave_face_cell_uid < master_face_cell_uid) {
1612 linked_cells.
add(slave_face_cell_uid);
1613 linked_cells.
add(master_face_cell_uid);
1617 linked_cells.
add(master_face_cell_uid);
1618 linked_cells.
add(slave_face_cell_uid);
1619 linked_owners.
add(master_owner);
1621 if (last_master_uid != NULL_ITEM_UNIQUE_ID) {
1624 Int32 last_master_owner = m_master_faces[last_master_uid].owner();
1625 if (last_master_owner != master_owner)
1626 ARCANE_FATAL(
"Cell {0} is connected to more than one master face:"
1627 " face1={1} owner1={2} face2={3} owner2={4}",
1629 last_master_uid, last_master_owner, master_face, master_owner);
1631 cells_last_master_uid[cell_lid] = master_face;
1654 if (allow_communication) {
1656 for (TiedInterfaceFaceMapEnumerator i(m_master_faces); ++i;) {
1658 if (sf.owner() == my_rank)
1659 master_faces_to_send.
add(sf.uniqueId());
1666 String fname =
"master_face_";
1667 fname += m_slave_interface.name();
1673 _printFaces(ofile,m_master_faces);
1679 for (TiedInterfaceFaceMapEnumerator i(m_slave_faces); ++i;) {
1680 slave_faces_to_process.
add((*i).uniqueId());
1685 for (
Integer zz = 0; zz < 10000; ++zz) {
1686 if (allow_communication) {
1687 info() <<
" SEND RECV NODES INFO n=" << zz;
1693 remaining_slave_faces.
clear();
1694 _searchMasterFaces(slave_faces_to_process, remaining_slave_faces);
1695 Integer nb_remaining = remaining_slave_faces.
size();
1696 Integer nb_to_process = slave_faces_to_process.
size();
1697 if (allow_communication) {
1698 info() <<
"NB REMAINING n=" << nb_remaining;
1700 info() <<
"CUMULATIVE NB REMAINING n=" << nb_remaining;
1703 if (nb_remaining == 0)
1705 if (nb_remaining == nb_to_process) {
1706 ARCANE_FATAL(
"Can not compute master/slave infos for a tied interface. Remaining_slaves={0}",
1709 slave_faces_to_process.
copy(remaining_slave_faces);
1729 _computeProjectionInfos(infos, is_structured);
1738bool TiedInterface::m_is_debug =
false;
1747, m_planar_tolerance(0.)
1771 return m_master_interface;
1778 return m_slave_interface;
1784 return m_master_interface_name;
1790 return m_slave_interface_name;
1796 return m_tied_nodes;
1802 return m_tied_faces;
1808 m_tied_nodes.resize(new_sizes);
1814 m_tied_faces.resize(new_sizes);
1818setNodes(
Integer index, ConstArrayView<TiedNode> nodes)
1820 for (
Integer i = 0, is = nodes.size(); i < is; ++i)
1821 m_tied_nodes[index][i] = nodes[i];
1825setFaces(
Integer index, ConstArrayView<TiedFace> faces)
1827 for (
Integer i = 0, is = faces.size(); i < is; ++i)
1828 m_tied_faces[index][i] = faces[i];
1834class TiedInterfacePartitionConstraint
1841 , m_slave_interfaces(slave_interfaces)
1842 , m_is_debug(is_debug)
1843 , m_is_initial(
true)
1856 Integer nb_interface = m_slave_interfaces.size();
1857 for (
Integer i = 0; i < nb_interface; ++i) {
1866 _addLinkedCells(*itied, linked_cells, linked_owners);
1869 tm->
info() <<
"NB_LINKED_CELL=" << linked_cells.
size();
1872 virtual void setInitialRepartition(
bool is_initial)
1874 m_is_initial = is_initial;
1887 Cell sub_cell = isubface.cell(0);
1889 if (sub_cell_uid < cell_uid) {
1890 linked_cells.
add(sub_cell_uid);
1891 linked_cells.
add(cell_uid);
1892 linked_owners.
add(owner);
1895 linked_cells.
add(cell_uid);
1896 linked_cells.
add(sub_cell_uid);
1897 linked_owners.
add(owner);
1906 UniqueArray<FaceGroup> m_slave_interfaces;
1930 info() <<
"Compute information for the tied interface " << slave_interface.
name();
1935 builder.setPlanarTolerance(m_planar_tolerance);
1941 m_slave_interface = slave_interface.own();
1942 m_slave_interface_name = slave_interface.
name();
1943 m_master_interface = builder.masterInterface().own();
1944 m_master_interface_name = builder.masterInterface().
name();
1962 for (
Integer i_master = 0; i_master < nb_master_face; ++i_master) {
1967 <<
" nb_slave_face=" << nb_slave_face
1968 <<
" nb_slave_node=" << nb_slave_node
1969 <<
" node_index=" << infos.m_master_faces_slave_node_index[i_master];
1970 for (
Integer zz = 0; zz < nb_slave_node; ++zz) {
1971 Integer first_index = infos.m_master_faces_slave_node_index[i_master];
1976 Integer local_id = slave_nodes_lid[first_index + zz];
1978 m_tied_nodes[i_master][zz] = tn;
1981 for (
Integer zz = 0; zz < nb_slave_face; ++zz) {
1982 Integer first_index = infos.m_master_faces_slave_face_index[i_master];
1986 Integer local_id = slave_faces_lid[first_index + zz];
1987 m_tied_faces[i_master][zz] =
TiedFace(zz, faces[local_id]);
1999 m_planar_tolerance = tol;
2007 const String& master_interface_name,
2008 const String& slave_interface_name)
2010 m_master_interface_name = master_interface_name;
2011 m_slave_interface_name = slave_interface_name;
2014 ARCANE_FATAL(
"Can not find master group named '{0}'", master_interface_name);
2015 m_master_interface = group.
own();
2016 group = face_family->
findGroup(slave_interface_name);
2018 ARCANE_FATAL(
"Can not find slave group named '{0}'", slave_interface_name);
2019 m_slave_interface = group.
own();
2026rebuild(ITiedInterfaceRebuilder* rebuilder,
2030 info() <<
"REBUILD_TIED_INTERFACE name=" << m_master_interface.
name();
2031 m_tied_nodes.resize(nb_slave_node);
2032 m_tied_faces.resize(nb_slave_face);
2051 info(4) <<
"NEW VALUES face=" <<
ItemPrinter(face) <<
" n=" << face_tied_nodes.
size() <<
" m=" << face_tied_faces.
size();
2056 work_nodes_local_id.
resize(nb_node);
2057 work_nodes_iso.
resize(nb_node);
2058 work_faces_local_id.
resize(nb_face);
2060 rebuilder->fillTiedInfos(face, work_nodes_local_id, work_nodes_iso, work_faces_local_id);
2062 for (
Integer zz = 0; zz < nb_node; ++zz) {
2063 Integer local_id = work_nodes_local_id[zz];
2064 Real2 iso = work_nodes_iso[zz];
2065 info(4) <<
"NEW NODE slave_node=" <<
ItemPrinter(nodes[local_id]) <<
" iso=" << iso;
2066 face_tied_nodes[zz] =
TiedNode(zz, nodes[local_id], iso);
2069 for (
Integer zz = 0; zz < nb_face; ++zz) {
2070 Int32 local_id = work_faces_local_id[zz];
2071 info(4) <<
"NEW FACE slave_face=" << ItemPrinter(faces[local_id]);
2072 face_tied_faces[zz] = TiedFace(zz, faces[local_id]);
2090_checkValid(
bool is_print)
2094 std::set<Int64> nodes_in_master_face;
2095 ITiedInterface*
interface = this;
2098 info() <<
"Interface: Slave=" << slave_group.name()
2099 <<
" nb_face=" << slave_group.size();
2100 info() <<
"Interface: Master=" << master_group.name()
2101 <<
" nb_face=" << master_group.size();
2102 TiedInterfaceNodeList tied_nodes(interface->
tiedNodes());
2103 TiedInterfaceFaceList tied_faces(interface->
tiedFaces());
2108 if (!face.isMasterFace()) {
2110 if (nb_error < max_print_error)
2111 error() <<
" Face uid=" << ItemPrinter(face) <<
" should have isMaster() true";
2113 if (iface.index() > 100000)
2115 nodes_in_master_face.clear();
2117 info() <<
"Master face uid=" << ItemPrinter(face)
2118 <<
" kind=" << face.kind()
2119 <<
" cell=" << ItemPrinter(face.cell(0))
2120 <<
" iface.index()=" << iface.index();
2122 Int32 cell_face_owner = face.cell(0).owner();
2123 if (cell_face_owner != master_face_owner) {
2125 if (nb_error < max_print_error)
2126 error() <<
"master_face and its cell do not have the same owner: face_owner=" << master_face_owner
2127 <<
" cell_owner=" << cell_face_owner;
2130 for (Node inode : face.nodes())
2131 info() <<
"Master face node uid=" << inode.uniqueId();
2132 for (
Integer zz = 0, zs = tied_nodes[iface.index()].size(); zz < zs; ++zz) {
2133 TiedNode tn = tied_nodes[iface.index()][zz];
2134 nodes_in_master_face.insert(tn.node().uniqueId());
2136 info() <<
" node_uid=" << tn.node().uniqueId()
2137 <<
" iso=" << tn.isoCoordinates()
2138 <<
" kind=" << tn.node().kind();
2141 for (Node inode : face.nodes())
2142 if (nodes_in_master_face.find(inode.uniqueId()) == nodes_in_master_face.end()) {
2144 if (nb_error < max_print_error)
2145 error() <<
"node in master face not in slave node list node=" << ItemPrinter(inode);
2147 Integer nb_tied = tied_faces[iface.index()].size();
2148 if (nb_tied != slave_faces.size()) {
2150 if (nb_error < max_print_error) {
2151 error() <<
"face=" << ItemPrinter(face) <<
" bad number of slave faces interne="
2152 << slave_faces.size() <<
" struct=" << nb_tied;
2154 info() <<
"SLAVE " << ItemPrinter(*islaveface);
2158 for (
Integer zz = 0, zs = tied_faces[iface.index()].size(); zz < zs; ++zz) {
2159 TiedFace tf = tied_faces[iface.index()][zz];
2160 Face tied_slave_face = tf.face();
2161 if (!tied_slave_face.isSlaveFace()) {
2163 if (nb_error < max_print_error)
2164 error() <<
"slave face uid=" << ItemPrinter(tf.face()) <<
" should have isSlave() true";
2166 if (tied_slave_face.masterFace() != face) {
2168 if (nb_error < max_print_error)
2169 error() <<
"slave face uid=" << ItemPrinter(tf.face()) <<
" should have masterSlave() valid";
2171 if (tied_slave_face != slave_faces[zz]) {
2173 if (nb_error < max_print_error)
2174 error() <<
"bad slave face internal=" << ItemPrinter(slave_faces[zz])
2175 <<
" struct=" << ItemPrinter(tied_slave_face);
2177 Int32 slave_face_owner = tf.face().owner();
2178 if (slave_face_owner != master_face_owner) {
2180 if (nb_error < max_print_error)
2181 error() <<
"master_face and its slave_face do not have the same owner:"
2182 <<
" master_face=" << ItemPrinter(face)
2183 <<
" master_cell=" << ItemPrinter(face.cell(0))
2184 <<
" slave_face=" << ItemPrinter(tf.face())
2185 <<
" slave_cell=" << ItemPrinter(tf.face().cell(0));
2188 info() <<
" face_uid=" << tf.face().uniqueId() <<
" cell=" << ItemPrinter(tf.face().cell(0));
2193 if (nb_error != 0) {
2194 ARCANE_FATAL(
"Errors in tied interface nb_error={0}", nb_error);
#define ARCANE_FATAL(...)
Macro throwing a FatalErrorException.
Integer size() const
Number of elements in the vector.
bool empty() const
Capacity (number of allocated elements) of the vector.
Modifiable view of an array of type T.
constexpr Integer size() const noexcept
Returns the size of the array.
Base class for 1D data vectors.
void fill(ConstReferenceType value)
Fills the array with the value value.
void resize(Int64 s)
Changes the number of elements in the array to s.
void copy(Span< const T > rhs)
Copies the values from rhs into the instance.
void clear()
Removes the elements from the array.
void add(ConstReferenceType val)
Adds element val to the end of the array.
void reserve(Int64 new_capacity)
Reserves memory for new_capacity elements.
void put(Span< const Real > values) override
Add the array values.
void reserve(eBasicDataType dt, Int64 n) override
Reserves memory for n objects of type dt.
void allocateBuffer() override
Allocates the serializer memory.
Integer getInteger() override
Retrieve a size.
void get(ArrayView< Real > values) override
Retrieve the array values.
void setMode(eMode new_mode) override
Sets the current mode.
void putInteger(Integer value) override
Add the integer value.
EnumeratorT< ITiedInterface * > Enumerator
Constant view of an array of type T.
constexpr Integer size() const noexcept
Number of elements in the array.
View of face information.
Cell cell(Int32 i) const
i-th cell of the face
FaceConnectedListViewType slaveFaces() const
List of slave faces associated with this master face.
Information about the projection of a point onto a segment or a triangle.
static ProjectionInfo projection(Real3 v1, Real3 v2, Real3 v3, Real3 point)
Projection of point point onto the triangle defined by v1, v2 and v3.
int m_region
Region where the projection is located (0 if inside the segment or triangle).
static bool isInside(Real3 v1, Real3 v2, Real3 v3, Real3 point)
Indicates if the projection of point point is inside the triangle defined by v1, v2 and v3.
Real m_distance
Distance of the point to its projection.
Enumerator for a HashTableMap.
Hash table for associative arrays.
Data * lookup(KeyTypeConstRef id)
Searches for the value corresponding to key id.
bool add(KeyTypeConstRef id, const ValueType &value)
Adds the value value corresponding to key id.
bool hasKey(KeyTypeConstRef id)
true if a value with key id is present
Interface of an entity family.
virtual ItemGroup findGroup(const String &name) const =0
Searches for a group.
virtual Int32 maxLocalId() const =0
virtual void itemsUniqueIdToLocalId(Int32ArrayView local_ids, Int64ConstArrayView unique_ids, bool do_fatal=true) const =0
Converts an array of unique numbers to local numbers.
virtual VariableItemInt32 & itemsNewOwner()=0
Variable containing the number of the new subdomain owning the entity.
virtual IItemFamily * itemFamily(eItemKind ik)=0
Returns the entity family of type ik.
Interface of the parallelism manager for a subdomain.
virtual ITraceMng * traceMng() const =0
Trace manager.
virtual Int32 commRank() const =0
Rank of this instance in the communicator.
virtual Int32 commSize() const =0
Number of instances in the communicator.
virtual void allGather(ConstArrayView< char > send_buf, ArrayView< char > recv_buf)=0
Performs an all-gather operation across all processors. This is a collective operation....
virtual char reduce(eReduceType rt, char v)=0
Performs a reduction of type rt on the real v and returns the value.
virtual void barrier()=0
Performs a barrier.
@ ModePut
The serializer expects reserve().
@ ModeGet
The serializer expects get().
Interface of a class managing semi-conforming mesh.
virtual TiedInterfaceFaceList tiedFaces() const =0
List of information about the slave faces of a master face.
virtual FaceGroup masterInterface() const =0
Group containing the master faces.
virtual FaceGroup slaveInterface() const =0
Group containing the slave faces.
virtual TiedInterfaceNodeList tiedNodes() const =0
List of information about the slave nodes of a master face.
virtual TraceMessage info()=0
Stream for an information message.
const String & name() const
Group name.
Integer size() const
Number of elements in the group.
bool null() const
true means the group is the null group
ItemGroup own() const
Group equivalent to this one but containing only the local elements of the subdomain.
Utility class for printing information about an entity.
Unique identifier of an entity.
NodeConnectedListViewType nodes() const
List of nodes of the entity.
Int32 nbNode() const
Number of nodes of the entity.
constexpr Int32 localId() const
Local identifier of the entity in the processor subdomain.
Int32 owner() const
Owner subdomain number of the entity.
ItemUniqueId uniqueId() const
Unique identifier across all domains.
View of node information.
Class managing a 2-dimensional real vector.
Class managing a 3-dimensional real vector.
Implementation of a buffer for serialization.
1D vector of data with reference semantics.
Unicode character string.
const char * localstr() const
Returns the conversion of the instance into UTF-8 encoding.
Semi-conforming mesh face.
Semi-conformal mesh node.
TraceAccessor(ITraceMng *m)
Constructs an accessor via the trace manager m.
TraceMessage info() const
Flow for an information message.
TraceMessage error() const
Flow for an error message.
TraceMessage warning() const
Flow for a warning message.
ITraceMng * traceMng() const
Trace manager.
1D data vector with value semantics (STL style).
IntegerUniqueArray m_master_faces_nb_slave_node
Number of slave nodes for each master face.
Real2UniqueArray m_slave_nodes_iso
List of iso-barycentric coordinates of slave nodes.
UniqueArray< ItemUniqueId > m_slave_nodes_uid
List of uniqueId() of slave nodes.
IntegerUniqueArray m_master_faces_nb_slave_face
Number of slave faces for each master face.
UniqueArray< ItemUniqueId > m_slave_faces_uid
List of uniqueId() of slave faces.
UniqueArray< ItemUniqueId > m_master_faces_uid
List of uniqueId() of master faces.
Construction of semi-conformal interface information.
void computeInterfaceConnections(bool allow_communication)
Builds the info for a linked interface.
HashTableMapT< ItemUniqueId, ItemUniqueId > m_slave_faces_master_face_uid
Table indicating for each slave face, the uid of the corresponding master face.
void _computeMasterInterface()
Determines the master surface of the interface.
void changeOwners(Int64Array &linked_cells, Int32Array &linked_owers)
Positions the links between cells.
void _gatherFaces(ConstArrayView< ItemUniqueId > faces_to_send, TiedInterfaceFaceMap &face_map)
void _gatherAllNodesInfo()
envoie et récupère les informations sur les noeuds de l'interface.
void computeInterfaceInfos(TiedInterfaceBuilderInfos &infos, bool is_structured)
Migrates the meshes on the links.
GeometricUtilities::ProjectionInfo _findProjection(const TiedInterfaceFace &face, Real3 point)
Calculates the projection of a point onto a face.
void _removeMasterFacesWithNoSlave()
Removes from the group of master faces those that are connected to any slave face.
void changeOwnersOld()
Migrates the cells on the links.
Master or slave face of an interface.
ItemUniqueId m_unique_id
ID of this node.
Real3 m_coord
Coordinates of this node.
SharedArray< ItemUniqueId > m_connected_master_faces
List of uniqueId() of master faces to which this node can be connected.
virtual void addLinkedCells(Int64Array &linked_cells, Int32Array &linked_owners)
Adds a set of constraints on the cells.
Integer m_x
Structuration X.
Integer m_y
Structuration Y.
virtual FaceGroup slaveInterface() const
Group containing the slave faces.
virtual String slaveInterfaceName() const
Name of the group containing the slave cells.
static PartitionConstraintBase * createConstraint(IMesh *mesh, ConstArrayView< FaceGroup > slave_interfaces)
Creates information for the tied interface slave_interface/.
virtual void setPlanarTolerance(Real tol)
Defines the relative acceptance threshold for a point projected onto a candidate face.
virtual String masterInterfaceName() const
Name of the group containing the master cells.
virtual void build(const FaceGroup &interface, bool is_structured)
Builds the tied interface on the group interface.
virtual TiedInterfaceFaceList tiedFaces() const
List of information about the slave faces of a master face.
virtual FaceGroup masterInterface() const
Group containing the master faces.
virtual TiedInterfaceNodeList tiedNodes() const
List of information about the slave nodes of a master face.
__host__ __device__ Real3 vecMul(Real3 u, Real3 v)
Vector cross product of u by v in .
__host__ __device__ Real scaMul(Real2 u, Real2 v)
Dot product of u by v in .
__host__ __device__ Real3 normalizeReal3(Real3 v)
Normalization of a Real3.
__host__ __device__ Real mixteMul(Real3 u, Real3 v, Real3 w)
Mixed product of u, v and w.
ItemGroupT< Face > FaceGroup
Group of faces.
ItemVectorViewT< Face > FaceVectorView
View over a vector of faces.
MeshVariableScalarRefT< Node, Real3 > VariableNodeReal3
Coordinate type quantity at node.
ItemVariableScalarRefT< Int32 > VariableItemInt32
32-bit integer type quantity
@ ReduceSum
Sum of values.
Real normeR3(Real3 v1)
Norm of a vector.
Array< Int64 > Int64Array
Dynamic one-dimensional array of 64-bit integers.
bool arcaneIsCheck()
True if running in check mode.
UniqueArray< Int64 > Int64UniqueArray
Dynamic 1D array of 64-bit integers.
std::int64_t Int64
Signed integer type of 64 bits.
Int32 Integer
Type representing an integer.
UniqueArray< Real3 > Real3UniqueArray
Dynamic 1D array of rank 3 vectors.
UniqueArray< Int32 > Int32UniqueArray
Dynamic 1D array of 32-bit integers.
UniqueArray< Real > RealUniqueArray
Dynamic 1D array of reals.
@ IK_Node
Node mesh entity.
@ IK_Face
Face mesh entity.
double Real
Type representing a real number.
Array< Int32 > Int32Array
Dynamic one-dimensional array of 32-bit integers.
@ DT_Int64
64-bit integer data type
UniqueArray< Real2 > Real2UniqueArray
Dynamic 1D array of rank 2 vectors.
UniqueArray< Integer > IntegerUniqueArray
Dynamic 1D array of integers.
ConstArrayView< Integer > IntegerConstArrayView
C equivalent of a 1D array of integers.
Collection< ITiedInterface * > TiedInterfaceCollection
Collection of tied interfaces.
std::int32_t Int32
Signed integer type of 32 bits.
Real y
second component of the triplet
Real z
third component of the triplet
Real x
first component of the triplet