14#include "arcane/utils/Iostream.h" 
   15#include "arcane/utils/StdHeader.h" 
   16#include "arcane/utils/HashTableMap.h" 
   17#include "arcane/utils/ValueConvert.h" 
   18#include "arcane/utils/ScopedPtr.h" 
   19#include "arcane/utils/ArcanePrecomp.h" 
   20#include "arcane/utils/ITraceMng.h" 
   21#include "arcane/utils/Collection.h" 
   22#include "arcane/utils/Enumerator.h" 
   23#include "arcane/utils/PlatformUtils.h" 
   24#include "arcane/utils/Real3.h" 
   25#include "arcane/utils/OStringStream.h" 
   26#include "arcane/utils/CheckedConvert.h" 
   27#include "arcane/utils/StringBuilder.h" 
   29#include "arcane/IMeshReader.h" 
   30#include "arcane/IGhostLayerMng.h" 
   31#include "arcane/ISubDomain.h" 
   32#include "arcane/IIOMng.h" 
   33#include "arcane/IParallelMng.h" 
   34#include "arcane/IPrimaryMesh.h" 
   35#include "arcane/Item.h" 
   36#include "arcane/ItemTypeMng.h" 
   37#include "arcane/ItemGroup.h" 
   38#include "arcane/ArcaneException.h" 
   39#include "arcane/Service.h" 
   40#include "arcane/Timer.h" 
   41#include "arcane/ServiceFactory.h" 
   42#include "arcane/ServiceInfo.h" 
   43#include "arcane/CaseOptionsMain.h" 
   44#include "arcane/MeshUtils.h" 
   45#include "arcane/ItemEnumerator.h" 
   46#include "arcane/VariableTypes.h" 
   47#include "arcane/ServiceBuildInfo.h" 
   48#include "arcane/XmlNodeList.h" 
   49#include "arcane/IXmlDocumentHolder.h" 
   50#include "arcane/IItemFamily.h" 
   51#include "arcane/FactoryService.h" 
   52#include "arcane/IMeshWriter.h" 
   53#include "arcane/AbstractService.h" 
   54#include "arcane/ICaseDocument.h" 
   55#include "arcane/ICaseMeshReader.h" 
   56#include "arcane/IMeshBuilder.h" 
   58#include "arcane/cea/LimaCutInfosReader.h" 
   60#include <Lima/lima++.h> 
   77void createGroup(IItemFamily* family,
const String& name,
Int32ArrayView local_ids);
 
   84std::mutex global_lima_mutex;
 
   89  explicit GlobalLimaMutex(
bool is_active)
 
   90  : m_is_active(is_active)
 
   93      global_lima_mutex.lock();
 
   98      global_lima_mutex.unlock();
 
  103  bool m_is_active = 
false;
 
 
  120  virtual ~LimaMeshBase() {}
 
  125                        const String& dir_name,
bool use_internal_partition,
Real length_multiplier) =0;
 
  127  ISubDomain* subDomain()
 const { 
return m_sub_domain; }
 
 
  146template<
typename ReaderWrapper>
 
  157    delete m_cut_infos_reader;
 
  163                        const String& dir_name,
bool use_internal_partition,
Real length_multiplier);
 
  168  ReaderWrapper m_wrapper;
 
  171                 const String& dir_name,
bool use_internal_partition,
Real length_multiplier);
 
 
  183  void setLima(
const Lima::Maillage& lima_mesh)
 
  185    m_lima_mesh = lima_mesh;
 
  190  Lima::Maillage m_lima_mesh;
 
 
  200  typedef Lima::Surface LimaCellGroup;
 
  201  typedef Lima::Polygone LimaCell;
 
  202  typedef Lima::Ligne LimaFaceGroup;
 
  203  typedef Lima::Bras LimaFace;
 
  213  LimaCellGroup cellGroup(
Integer i)
 
  215    return m_lima_mesh.surface(i);
 
  217  LimaFaceGroup faceGroup(
Integer i)
 
  219    return m_lima_mesh.ligne(i);
 
  221  Integer faceGroupNbFace(
const LimaFaceGroup& group)
 
  225  LimaFace faceFaceGroup(
const LimaFaceGroup& group,
Integer i)
 
  227    return group.bras(i);
 
  229  Integer cellGroupNbCell(
const LimaCellGroup& group)
 
  233  LimaCell cellCellGroup(
const LimaCellGroup& group,
Integer i)
 
  235    return group.polygone(i);
 
  239    return m_lima_mesh.polygone(i);
 
  243    return m_lima_mesh.bras(i);
 
  257  const char* strDimension()
 
  264    case 3: 
return IT_Triangle3;
 
  265    case 4: 
return IT_Quad4;
 
  266    case 5: 
return IT_Pentagon5;
 
  267    case 6: 
return IT_Hexagon6;
 
 
  282  typedef Lima::Volume LimaCellGroup;
 
  283  typedef Lima::Polyedre LimaCell;
 
  284  typedef Lima::Surface LimaFaceGroup;
 
  285  typedef Lima::Polygone LimaFace;
 
  295  LimaCellGroup cellGroup(
Integer i)
 
  297    return m_lima_mesh.volume(i);
 
  299  LimaFaceGroup faceGroup(
Integer i)
 
  301    return m_lima_mesh.surface(i);
 
  303  Integer faceGroupNbFace(
const LimaFaceGroup& group)
 
  307  LimaFace faceFaceGroup(
const LimaFaceGroup& group,
Integer i)
 
  309    return group.polygone(i);
 
  311  Integer cellGroupNbCell(
const LimaCellGroup& group)
 
  315  LimaCell cellCellGroup(
const LimaCellGroup& group,
Integer i)
 
  317    return group.polyedre(i);
 
  321    return m_lima_mesh.polyedre(i);
 
  325    return m_lima_mesh.polygone(i);
 
  339  const char* strDimension()
 
  346    case 4: 
return IT_Tetraedron4;
 
  347    case 5: 
return IT_Pyramid5;
 
  348    case 6: 
return IT_Pentaedron6;
 
  349    case 8: 
return IT_Hexaedron8;
 
  350    case 10: 
return IT_Heptaedron10;
 
  351    case 12: 
return IT_Octaedron12;
 
 
  375                const String& dir_name,
bool use_internal_partition,
 
 
  388class LimaMeshReaderService
 
  404    return str==
"unf" || str==
"mli" || str==
"mli2" || str==
"ice" || str==
"uns" || str==
"unv";
 
 
  409                               const String& dir_name,
bool use_internal_partition) 
override;
 
  410  ISubDomain* subDomain() { 
return m_sub_domain; }
 
  414  ISubDomain* m_sub_domain;
 
 
  429LimaMeshReaderService::
 
  432, m_sub_domain(sbi.subDomain())
 
  439#ifdef ARCANE_LIMA_HAS_MLI 
  442                           const String& filename,
Real length_multiplier);
 
  445#ifdef ARCANE_LIMA_HAS_MLI2 
  448                           const String& filename,
Real length_multiplier);
 
  457                 bool use_internal_partition)
 
  461  String case_doc_lang = 
"en";
 
  464    case_doc_lang = case_doc->
language();
 
  467  String use_unit_attr_name = 
"utilise-unite";
 
  469  if (case_doc_lang==
"en"){
 
  472    if (!use_unit_str.
empty()){
 
  473      warning() << 
"'utilise-unite' ne doit être utilisé que pour les JDD en francais." 
  474                << 
"Utilisez 'use-unit' à la place";
 
  476    use_unit_attr_name = 
"use-unit";
 
  482    if (use_unit_str.
null()){
 
  483      info() << 
"Attribute '" << use_unit_attr_name << 
"' is not found. Trying with 'use-unit'";
 
  484      use_unit_attr_name = 
"use-unit";
 
  490  bool use_length_unit = 
true;
 
  492    use_length_unit = 
false;
 
  493  info() << 
"Default value for unit usage: " << use_length_unit;
 
  495  if (use_unit_str.
empty())
 
  496    use_unit_str = mesh_node.
attrValue(use_unit_attr_name);
 
  497  info() << 
"Checking for attribute '" << use_unit_attr_name << 
"' value='" << use_unit_str << 
"'";
 
  498  if (!use_unit_str.
empty()){
 
  499    if (use_unit_str==
"1" || use_unit_str==
"true")
 
  500      use_length_unit = 
true;
 
  501    else if (use_unit_str==
"0" || use_unit_str==
"false")
 
  502      use_length_unit = 
false;
 
  504      ARCANE_FATAL(
"Invalid value boolean value '{0}' for '{1}' attribute." 
  505                   " Valid values are '0', '1' 'true' or 'false'",
 
  506                   use_unit_str,use_unit_attr_name);
 
  509  info() << 
"Utilise l'unité de longueur de Lima: " << use_length_unit << 
" (lang=" << case_doc_lang << 
")";
 
  512  return reader.readMesh(mesh,filename,dir_name,use_internal_partition,use_length_unit);
 
 
  520         bool use_internal_partition, 
bool use_length_unit)
 
  530  info() << 
"Lima: use_length_unit=" << use_length_unit
 
  531         << 
" use_internal_partition=" << use_internal_partition;
 
  532  Real length_multiplier = 0.0;
 
  533  if (use_length_unit){
 
  537    if (code_system.
null() || code_system.
empty()){
 
  538      info() << 
"No unit system configured. Use MKS unit system.";
 
  539      length_multiplier = 1.0;
 
  541    else if (code_system==
"CGS"){
 
  542      length_multiplier = 100.0;
 
  544    else if (code_system==
"MKS"){
 
  545      length_multiplier = 1.0;
 
  548      ARCANE_FATAL(
"Unknown unit system '{0}' (valid values are: 'CGS' ou 'MKS'",code_system);
 
  552  std::string loc_file_name = filename.
localstr();
 
  553  size_t rpos = loc_file_name.rfind(
".mli");
 
  554  size_t rpos2 = loc_file_name.rfind(
".mli2");
 
  555  const bool need_mutex = rpos2 != std::string::npos;
 
  556  info() << 
" FILE_NAME=" << loc_file_name;
 
  557  info() << 
" RPOS MLI=" << rpos << 
" s=" << loc_file_name.length();
 
  558  info() << 
" RPOS MLI2=" << rpos2 << 
" s=" << loc_file_name.length();
 
  570  if (!has_thread && use_internal_partition && ((rpos+4)==loc_file_name.length())){
 
  571    info() << 
"Use direct partitioning with mli";
 
  572#ifdef ARCANE_LIMA_HAS_MLI 
  573    return _directLimaPartitionMalipp(timer_mng,mesh,filename,length_multiplier);
 
  575    ARCANE_FATAL(
"Can not use 'mli' files because Lima is not compiled with 'mli' support");
 
  578  else if (!has_thread && use_internal_partition && ((rpos2+5)==loc_file_name.length())){
 
  579    info() << 
"Use direct partitioning with mli2";
 
  580#ifdef ARCANE_LIMA_HAS_MLI2 
  581    return _directLimaPartitionMalipp2(timer_mng,mesh,filename,length_multiplier);
 
  583    ARCANE_FATAL(
"Can not use 'mli2' files because Lima is not compiled with 'mli2' support");
 
  587    info() << 
"Chargement Lima du fichier '" << filename << 
"'";
 
  589    const char* version = Lima::lima_version();
 
  590    info() << 
"Utilisation de la version " << version << 
" de Lima";
 
  595    LM_TYPEMASQUE preparation = LM_ORIENTATION | LM_COMPACTE;
 
  597    log() << 
"Début lecture fichier " << filename;
 
  599    Lima::Maillage lima(filename.
localstr());
 
  603        Timer::Sentry sentry(&time_to_read);
 
  604        Timer::Phase t_action(sd,TP_InputOutput);
 
  605        LimaUtils::GlobalLimaMutex sc(need_mutex);
 
  606        lima.lire(filename.
localstr(),Lima::SUFFIXE,
true);
 
  608        lima.preparation_parametrable(preparation);
 
  611    catch(
const Lima::erreur& ex){
 
  612      ARCANE_FATAL(
"Can not read lima file '{0}' error is '{1}'",filename,ex.what());
 
  618    info() << 
"Temps de lecture et préparation du maillage (unité: seconde): " 
  619           << time_to_read.lastActivationTime();
 
  623      if (lima.dimension()==Lima::D3){
 
  625        info() << 
"Maillage 3D";
 
  627      else if (lima.dimension()==Lima::D2){
 
  629        info() << 
"Maillage 2D";
 
  634      lm = 
new LimaWrapper<Lima3DReaderWrapper>(sd);
 
  637      lm = 
new LimaWrapper<Lima2DReaderWrapper>(sd);
 
  640      log() << 
"Dimension du maillage non reconnue par lima";
 
  644    bool ret = lm->readMesh(lima,mesh,filename,dir_name,use_internal_partition,length_multiplier);
 
  651      if (nb_ghost_layer>1)
 
  666         const String& dir_name,
bool use_internal_partition,
Real length_multiplier)
 
  668  return _readMesh(lima,mesh,filename,dir_name,use_internal_partition,length_multiplier);
 
  676          const String& dir_name,
bool use_internal_partition,
Real length_multiplier)
 
  678  ARCANE_UNUSED(file_name);
 
  692  m_wrapper.setLima(lima);
 
  695  mesh_nb_cell = m_wrapper.nbCell(); 
 
  696  lima_nb_face = m_wrapper.nbFace(); 
 
  699  info() << 
"-- Informations sur le maillage (Interne):";
 
  700  info() << 
"Nombre de noeuds  " << mesh_nb_node;
 
  701  info() << 
"Nombre d'arêtes   " << nb_edge;
 
  702  info() << 
"Nombre de faces   " << lima_nb_face;
 
  703  info() << 
"Nombre de mailles " << mesh_nb_cell;
 
  704  info() << 
"-- Informations sur le maillage (Lima):";
 
  705  info() << 
"Nombre de noeuds    " << lima.nb_noeuds();
 
  706  info() << 
"Nombre d'arêtes     " << lima.nb_bras();
 
  707  info() << 
"Nombre de polygones " << lima.nb_polygones();
 
  708  info() << 
"Nombre de polyedres " << lima.nb_polyedres();
 
  709  info() << 
"Nombre de surfaces  " << lima.nb_surfaces();
 
  710  info() << 
"Nombre de volumes   " << lima.nb_volumes();
 
  712  info() << 
"Unité de longueur du fichier: " << lima.unite_longueur();
 
  715  if (length_multiplier==0.0)
 
  716    length_multiplier = 1.0;
 
  718    length_multiplier *= lima.unite_longueur();
 
  720  if (mesh_nb_node==0){
 
  732  if (is_parallel && !use_internal_partition && pm->commSize()>1){
 
  733    m_cut_infos_reader->readItemsUniqueId(nodes_unique_id,cells_unique_id,dir_name);
 
  736    for( 
Integer i=0; i<mesh_nb_node; ++i )
 
  737      nodes_unique_id[i] = i;
 
  738    for( 
Integer i=0; i<mesh_nb_cell; ++i )
 
  739      cells_unique_id[i] = i;
 
  744  bool first_uid_is_one = 
false;
 
  746    first_uid_is_one = 
true;
 
  747    info() << 
"WARNING: UniqueId begin at 1";
 
  749  if (first_uid_is_one){
 
  750    for( 
Integer i=0; i<mesh_nb_node; ++i )
 
  751      ++nodes_unique_id[i];
 
  752    for( 
Integer i=0; i<mesh_nb_cell; ++i )
 
  753      ++cells_unique_id[i];
 
  758    info() << 
"Using length multiplier v=" << length_multiplier;
 
  759    for( 
Integer i=0; i<mesh_nb_node; ++i ){
 
  760      const Lima::Noeud& node = lima.noeud(i);
 
  761      Real3 coord(node.x(),node.y(),node.z());
 
  762      coord *= length_multiplier;
 
  763      nodes_coords.nocheckAdd(nodes_unique_id[i],coord);
 
  767    for( 
Integer i=0; i<mesh_nb_node; ++i ){
 
  768      const Lima::Noeud& node = lima.noeud(i);
 
  769      Real3 coord(node.x(),node.y(),node.z());
 
  770      nodes_coords.nocheckAdd(nodes_unique_id[i],coord);
 
  778  bool use_own_mesh = 
false;
 
  780  if (is_parallel && pm->commSize()>1){
 
  782    if (use_internal_partition)
 
  783      use_own_mesh = 
false;
 
  786  typedef typename ReaderWrapper::LimaCellGroup LimaCellGroup;
 
  787  typedef typename ReaderWrapper::LimaCell LimaCell;
 
  788  typedef typename ReaderWrapper::LimaFaceGroup LimaFaceGroup;
 
  789  typedef typename ReaderWrapper::LimaFace LimaFace;
 
  792    Integer nb = m_wrapper.nbCellGroup();
 
  794      const LimaCellGroup& lima_group = m_wrapper.cellGroup(i);
 
  795      std::string group_name = lima_group.nom();
 
  796      if (group_name==
"LOCAL" || group_name==
"local"){
 
  797        Integer nb_own_cell = m_wrapper.cellGroupNbCell(lima_group);
 
  798        cells_filter.resize(nb_own_cell);
 
  799        for( 
Integer z=0; z<nb_own_cell; ++z ){
 
  806    if (use_internal_partition && sid!=0){
 
  811    cells_filter.resize(mesh_nb_cell);
 
  812    for( 
Integer i=0; i<mesh_nb_cell; ++i )
 
  818  for( 
Integer j=0, js=cells_filter.size(); j<js; ++j ){
 
  826  for( 
Integer i_cell=0, s_cell=cells_filter.size(); i_cell<s_cell; ++i_cell ){
 
  828    Integer cell_indirect_id = cells_filter[i_cell];
 
  829    LimaCell lima_cell = m_wrapper.cell(cell_indirect_id);
 
  832    Integer ct = ReaderWrapper::cellToType(n);
 
  836    cells_infos[cells_infos_index] = ct;
 
  839    cells_infos[cells_infos_index] = cells_unique_id[cell_indirect_id];
 
  843    for( 
Integer z=0, sz=n; z<sz; ++z ){
 
  845      cells_infos[cells_infos_index+z] = node_uid;
 
  849    cout << 
"CELL LIMA1 " << cells_unique_id[cell_indirect_id] << 
" ";
 
  851      cout << 
" " << cells_infos[cells_infos_index+z];
 
  855    cells_infos_index += n;
 
  858  logdate() << 
"Début allocation du maillage nb_cell=" << cells_filter.size();
 
  859  mesh->allocateCells(cells_filter.size(),cells_infos,
false);
 
  860  logdate() << 
"Fin allocation du maillage";
 
  863  if (use_internal_partition){
 
  865    for( 
Integer i=0, is=nodes.size(); i<is; ++i )
 
  866      nodes[i]->setOwner(sid,sid);
 
  868    for( 
Integer i=0, is=cells.size(); i<is; ++i )
 
  869      cells[i]->setOwner(sid,sid);
 
  874    Integer sub_domain_id = subDomain()->subDomainId();
 
  877      const Lima::Nuage& lima_group = lima.nuage(i);
 
  879      std::string group_name = lima_group.nom();
 
  880      unique_ids.resize(nb_item_in_group);
 
  881      local_ids.resize(nb_item_in_group);
 
  882      for( 
Integer z=0; z<nb_item_in_group; ++z ){
 
  885      mesh->nodeFamily()->itemsUniqueIdToLocalId(local_ids,unique_ids,
false);
 
  886      bool remove_group = 
false;
 
  887      if (group_name==
"LOCALN" || group_name==
"localn"){
 
  888        info() << 
"Utilisation du groupe 'LOCALN' pour indiquer que les " 
  889               << 
"noeuds appartiennent au sous-domaine";
 
  891        for( 
Integer z=0, sz=nb_item_in_group; z<sz; ++z ){
 
  892          Integer local_id = local_ids[z];
 
  893          if (local_id!=NULL_ITEM_ID)
 
  894            nodes[local_id]->setOwner(sub_domain_id,sub_domain_id);
 
  898      debug() << 
"Vérification du groupe '" << group_name << 
"'";
 
  899      if (group_name.length()>3 && !remove_group){
 
  901        if (grp.startsWith(
"NF_")){
 
  902          grp = grp.substring(3);
 
  903          Int32 ghost_sub_domain_id = 0;
 
  904          bool is_bad = builtInGetValue(ghost_sub_domain_id,grp);
 
  905          debug() << 
"Vérification du groupe '" << group_name << 
"' (3) " << is_bad;
 
  907            info() << 
"Utilisation du groupe " << group_name << 
" pour indiquer que le " 
  908                   << 
"sous-domaine " << ghost_sub_domain_id << 
" est propriétaire de ses noeuds";
 
  910            for( 
Integer z=0, sz=nb_item_in_group; z<sz; ++z ){
 
  911              Integer local_id = local_ids[z];
 
  912              if (local_id!=NULL_ITEM_ID)
 
  913                nodes[local_ids[z]]->setOwner(ghost_sub_domain_id,sub_domain_id);
 
  931    for( 
Integer i_face=0; i_face<lima_nb_face; ++i_face ){
 
  932      const LimaFace& lima_face = m_wrapper.face(i_face);
 
  939    Integer faces_nodes_unique_id_index = 0;
 
  949    for( 
Integer i_face=0; i_face<lima_nb_face; ++i_face ){
 
  950      const LimaFace& lima_face = m_wrapper.face(i_face);
 
  952      orig_nodes_id.resize(n);
 
  953      face_nodes_index.resize(n);
 
  959      cout << 
"FACE LIMA1 " << lima_face.id()-1 << 
" ";
 
  961        cout << 
" " << orig_nodes_id[z];
 
  967        faces_nodes_unique_id[faces_nodes_unique_id_index+z] = orig_nodes_id[face_nodes_index[z]];
 
  968      faces_first_node_unique_id[i_face] = orig_nodes_id[face_nodes_index[0]];
 
  969      faces_nodes_unique_id_index += n;
 
  972    mesh->nodeFamily()->itemsUniqueIdToLocalId(faces_first_node_local_id,faces_first_node_unique_id);
 
  974    faces_nodes_unique_id_index = 0;
 
  975    for( 
Integer i_face=0; i_face<lima_nb_face; ++i_face ){
 
  976      const LimaFace& lima_face = m_wrapper.face(i_face);
 
  979      Node current_node(mesh_nodes[faces_first_node_local_id[i_face]]);
 
  980      Face face = mesh_utils::getFaceFromNodesUnique(current_node,face_nodes_id);
 
  986          ostr() << 
' ' << face_nodes_id[z];
 
  987        ostr() << 
" - " << current_node.localId() << 
")";
 
  988        ARCANE_FATAL(
"INTERNAL: Lima face index={0} with nodes '{1}' is not in node/face connectivity",
 
  991      faces_id[i_face] = face.localId();
 
  993      faces_nodes_unique_id_index += n;
 
 1002  if (use_internal_partition && sid!=0){
 
 1005      for( 
Integer i=0; i<nb; ++i ){
 
 1006        const Lima::Nuage& lima_group = lima.nuage(i);
 
 1007        std::string group_name = lima_group.nom();
 
 1012      Integer nb = m_wrapper.nbFaceGroup();
 
 1013      for( 
Integer i=0; i<nb; ++i ){
 
 1014        const LimaFaceGroup& lima_group = m_wrapper.faceGroup(i);
 
 1015        std::string group_name = lima_group.nom();
 
 1020      Integer nb = m_wrapper.nbCellGroup();
 
 1021      for( 
Integer i=0; i<nb; ++i ){
 
 1022        const LimaCellGroup& lima_group = m_wrapper.cellGroup(i);
 
 1023        std::string group_name = lima_group.nom();
 
 1031    Integer sub_domain_id = subDomain()->subDomainId();
 
 1035      for( 
Integer i=0; i<nb; ++i ){
 
 1036        const Lima::Nuage& lima_group = lima.nuage(i);
 
 1038        std::string group_name = lima_group.nom();
 
 1039        unique_ids.resize(nb_item_in_group);
 
 1040        local_ids.resize(nb_item_in_group);
 
 1041        for( 
Integer z=0; z<nb_item_in_group; ++z ){
 
 1043          unique_ids[z] = nodes_unique_id[lima_node_id - 1];
 
 1045        mesh->nodeFamily()->itemsUniqueIdToLocalId(local_ids,unique_ids);
 
 1046        bool remove_group = 
false;
 
 1047        if (group_name==
"LOCALN" || group_name==
"localn"){
 
 1048          remove_group = 
true;
 
 1050        debug() << 
"Vérification du groupe '" << group_name << 
"'";
 
 1051        if (group_name.length()>3 && !remove_group){
 
 1052          String grp = group_name.c_str();
 
 1054          debug() << 
"Vérification du groupe '" << group_name << 
"' (2) '" << grp << 
"'";
 
 1055          if (grp.startsWith(
"NF_")){
 
 1058            grp = grp.substring(3);
 
 1059            Integer ghost_sub_domain_id = 0;
 
 1060            bool is_bad = builtInGetValue(ghost_sub_domain_id,grp);
 
 1061            debug() << 
"Vérification du groupe '" << group_name << 
"' (3) " << is_bad;
 
 1063              remove_group = 
true;
 
 1068          log() << 
"NodeGroup Name <" << group_name << 
"> (" << nb_item_in_group << 
" elements)";
 
 1069          LimaUtils::createGroup(node_family,group_name,local_ids);
 
 1075      Integer nb = m_wrapper.nbFaceGroup();
 
 1076      for( 
Integer i=0; i<nb; ++i ){
 
 1077        const LimaFaceGroup& lima_group = m_wrapper.faceGroup(i);
 
 1078        Integer nb_item_in_group = m_wrapper.faceGroupNbFace(lima_group);
 
 1079        local_ids.resize(nb_item_in_group);
 
 1082        for( 
Integer z=0; z<nb_item_in_group; ++z ){
 
 1085        std::string group_name = lima_group.nom();
 
 1086        log() << 
"FaceGroup Name <" << group_name << 
"> (" << nb_item_in_group << 
" elements)";
 
 1087        LimaUtils::createGroup(face_family,group_name,local_ids);
 
 1092      Integer nb = m_wrapper.nbCellGroup();
 
 1093      for( 
Integer i=0; i<nb; ++i ){
 
 1094        const LimaCellGroup& lima_group = m_wrapper.cellGroup(i);
 
 1095        Integer nb_item_in_group = m_wrapper.cellGroupNbCell(lima_group);
 
 1096        std::string group_name = lima_group.nom();
 
 1097        unique_ids.resize(nb_item_in_group);
 
 1098        local_ids.resize(nb_item_in_group);
 
 1099        for( 
Integer z=0; z<nb_item_in_group; ++z ){
 
 1102        mesh->cellFamily()->itemsUniqueIdToLocalId(local_ids,unique_ids);
 
 1103        bool remove_group = 
false;
 
 1104        if (group_name==
"LOCAL" || group_name==
"local"){
 
 1106          for( 
Integer z=0, sz=nb_item_in_group; z<sz; ++z )
 
 1107            cells[local_ids[z]]->setOwner(sub_domain_id,sub_domain_id);
 
 1108          remove_group = 
true;
 
 1111          String grp(group_name.c_str());
 
 1112          if (grp.startsWith(
"MF_")){
 
 1113            info() << 
"Le groupe de mailles " << group_name << 
" n'est pas utilisé";
 
 1114            remove_group = 
true;
 
 1118          log() << 
"CellGroup Name <" << group_name << 
"> (" << nb_item_in_group << 
" elements)";
 
 1119          LimaUtils::createGroup(cell_family,group_name,local_ids);
 
 1136    Integer nb_ghost_layer = mesh->ghostLayerMng()->nbGhostLayer();
 
 1137    if (nb_ghost_layer>1)
 
 1138      nodes = mesh->ownNodes();
 
 1140      const Node& node = *i;
 
 1141      nodes_coord_var[node] = nodes_coords.lookupValue(node.uniqueId());
 
 1144    if (nb_ghost_layer>1)
 
 1150  info() << 
"Nombre de nuages   " << lima.nb_nuages();
 
 1151  info() << 
"Nombre de lignes   " << lima.nb_lignes();
 
 1152  info() << 
"Nombre de surfaces " << lima.nb_surfaces();
 
 1153  info() << 
"Nombre de volumes  " << lima.nb_volumes();
 
 1159  logdate() << 
"Fin de lecture du fichier";
 
 1171  if (!dir_name.empty()){
 
 1172    comm_file_nameb += dir_name;
 
 1173    comm_file_nameb += 
"/";
 
 1175  comm_file_nameb += 
"Communications";
 
 1176  String comm_file_name = comm_file_nameb.toString();
 
 1180  if (!doc_holder.get())
 
 1187  String ustr_buf  = String::fromNumber(sd->subDomainId());
 
 1189  for( 
Integer i=0, s=cpu_list.size(); i<s; ++i ){
 
 1190    String id_str = cpu_list[i].attrValue(ustr_id);
 
 1191    if (id_str==ustr_buf){
 
 1192      cpu_elem = cpu_list[i];
 
 1196  if (cpu_elem.null())
 
 1197    ARCANE_FATAL(
"No element <cpus/cpu-from[@id=\"{0}\"]>",sd->subDomainId());
 
 1199    cpu_list = cpu_elem.children(
String(
"cpu-to"));
 
 1200    debug() << 
"Nb procs " << cpu_list.size();
 
 1201    for( 
Integer i=0; i<cpu_list.size(); ++i ){
 
 1202      Integer v = cpu_list[i].valueAsInteger();
 
 1204      debug() << 
"Read proc " << v;
 
 1212class LimaCaseMeshReader
 
 1226    , m_read_info(read_info)
 
 1233      ARCANE_UNUSED(build_info);
 
 
 1238      String fname = m_read_info.fileName();
 
 1239      m_trace_mng->info() << 
"Lima Reader (ICaseMeshReader) file_name=" << fname;
 
 1240      bool use_length_unit = 
true; 
 
 1241      String directory_name = m_read_info.directoryName();
 
 1242      IMeshReader::eReturnType ret = reader.readMesh(pm, fname, directory_name, m_read_info.isParallelRead(), use_length_unit);
 
 
 
 1265    String str = read_info.format();
 
 1266    if (str==
"unf" || str==
"mli" || str==
"mli2" || str==
"ice" || str==
"uns" || str==
"unv")
 
 1267      builder = 
new Builder(m_sub_domain, read_info);
 
 
 
 1316void LimaMeshWriter::
 
 1317_writeItem(Lima::Maillage& m,ConstArrayView<Lima::Noeud> nodes,ItemWithNodes c)
 
 1320  case IT_Octaedron12:
 
 1321    m.ajouter(Lima::Polyedre(nodes[c.node(0).localId()],nodes[c.node(1).localId()],
 
 1322                             nodes[c.node(2).localId()],nodes[c.node(3).localId()],
 
 1323                             nodes[c.node(4).localId()],nodes[c.node(5).localId()],
 
 1324                             nodes[c.node(6).localId()],nodes[c.node(7).localId()],
 
 1325                             nodes[c.node(8).localId()],nodes[c.node(9).localId()],
 
 1326                             nodes[c.node(10).localId()],nodes[c.node(11).localId()]));
 
 1328  case IT_Heptaedron10:
 
 1329    m.ajouter(Lima::Polyedre(nodes[c.node(0).localId()],nodes[c.node(1).localId()],
 
 1330                             nodes[c.node(2).localId()],nodes[c.node(3).localId()],
 
 1331                             nodes[c.node(4).localId()],nodes[c.node(5).localId()],
 
 1332                             nodes[c.node(6).localId()],nodes[c.node(7).localId()],
 
 1333                             nodes[c.node(8).localId()],nodes[c.node(9).localId()]));
 
 1336    m.ajouter(Lima::Polyedre(nodes[c.node(0).localId()],nodes[c.node(1).localId()],
 
 1337                             nodes[c.node(2).localId()],nodes[c.node(3).localId()],
 
 1338                             nodes[c.node(4).localId()],nodes[c.node(5).localId()],
 
 1339                             nodes[c.node(6).localId()],nodes[c.node(7).localId()]));
 
 1341  case IT_Pentaedron6:
 
 1342    m.ajouter(Lima::Polyedre(nodes[c.node(0).localId()],nodes[c.node(1).localId()],
 
 1343                             nodes[c.node(2).localId()],nodes[c.node(3).localId()],
 
 1344                             nodes[c.node(4).localId()],nodes[c.node(5).localId()]));
 
 1347    m.ajouter(Lima::Polyedre(nodes[c.node(0).localId()],nodes[c.node(1).localId()],
 
 1348                             nodes[c.node(2).localId()],nodes[c.node(3).localId()],
 
 1349                             nodes[c.node(4).localId()]));
 
 1351  case IT_Tetraedron4:
 
 1352    m.ajouter(Lima::Polyedre(nodes[c.node(0).localId()],nodes[c.node(1).localId()],
 
 1353                             nodes[c.node(2).localId()],nodes[c.node(3).localId()]));
 
 1356    m.ajouter(Lima::Polygone(nodes[c.node(0).localId()],nodes[c.node(1).localId()],
 
 1357                                nodes[c.node(2).localId()],nodes[c.node(3).localId()],
 
 1358                                nodes[c.node(4).localId()],nodes[c.node(5).localId()]));
 
 1361    m.ajouter(Lima::Polygone(nodes[c.node(0).localId()],nodes[c.node(1).localId()],
 
 1362                                nodes[c.node(2).localId()],nodes[c.node(3).localId()],
 
 1363                                nodes[c.node(4).localId()]));
 
 1366    m.ajouter(Lima::Polygone(nodes[c.node(0).localId()],nodes[c.node(1).localId()],
 
 1367                                nodes[c.node(2).localId()],nodes[c.node(3).localId()]));
 
 1370    m.ajouter(Lima::Polygone(nodes[c.node(0).localId()],nodes[c.node(1).localId()],
 
 1371                                nodes[c.node(2).localId()]));
 
 1374    m.ajouter(Lima::Bras(nodes[c.node(0).localId()],nodes[c.node(1).localId()]));
 
 1390  int dimension = mesh->dimension();
 
 1392  std::string std_file_name = file_name.
localstr();
 
 1396  const size_t rpos2 = std_file_name.rfind(
".mli2");
 
 1397  std::string::size_type std_end = std::string::npos;
 
 1398  bool need_mutex = rpos2!=std_end;
 
 1399  if (rpos2==std_end && std_file_name.rfind(
".mli")==std_end && std_file_name.rfind(
".unf")==std_end){
 
 1400    std_file_name += 
".mli2";
 
 1403  info() << 
"FINAL_FILE_NAME=" << std_file_name;
 
 1404  Lima::Maillage lima(std_file_name);
 
 1407    lima.dimension(Lima::D3);
 
 1408  else if (dimension==2)
 
 1409    lima.dimension(Lima::D2);
 
 1431  for( 
Integer i=0; i<mesh_nb_node; ++i ){
 
 1432    Node node = nodes[i];
 
 1433    Real3 coord = nodes_coords[node];
 
 1437    lima.ajouter(lm_nodes[i]);
 
 1441  for( 
Integer i=0; i<mesh_nb_edge; ++i ){
 
 1442    _writeItem(lima,lm_nodes,edges[i]);
 
 1446  for( 
Integer i=0; i<mesh_nb_face; ++i ){
 
 1447    _writeItem(lima,lm_nodes,faces[i]);
 
 1451  for( 
Integer i=0; i<mesh_nb_cell; ++i ){
 
 1452    _writeItem(lima,lm_nodes,cells[i]);
 
 1463      lima.ajouter(lm_group);
 
 1465        lm_group.ajouter(lima.noeud(iitem.localId()));
 
 1475      lima.ajouter(lm_group);
 
 1477        lm_group.ajouter(lima.bras(iitem.localId()));
 
 1488        lima.ajouter(lm_group);
 
 1490          lm_group.ajouter(lima.polygone(iitem.localId()));
 
 1493      else if (dimension==2){
 
 1495        lima.ajouter(lm_group);
 
 1497          lm_group.ajouter(lima.bras(iitem.localId()));
 
 1509        lima.ajouter(lm_group);
 
 1511          lm_group.ajouter(lima.polyedre(iitem.localId()));
 
 1514      else if (dimension==2){
 
 1516        lima.ajouter(lm_group);
 
 1518          lm_group.ajouter(lima.polygone(iitem.localId()));
 
 1522    info(4) << 
"Writing file '" << std_file_name << 
"'";
 
 1526      lima.ecrire(std_file_name);
 
 1529  catch(
const std::exception& ex){
 
 1530    trace->
warning() << 
"Exception (std::exception) in LIMA: Can not write file <" << std_file_name << 
">" 
 1531                      << 
" Exception: " << ex.what() << 
'\n';
 
 1535    trace->
warning() << 
"Exception (unknown) in LIMA: Can not write file <" << std_file_name << 
">";
 
 
 1555  if (!local_ids.
empty())
 
 1556    std::sort(std::begin(local_ids),std::end(local_ids));
 
 1560  for( 
Integer i=1; i<nb_item; ++i )
 
 1561    if (local_ids[i]==local_ids[i-1]){
 
 1564  if (nb_duplicated!=0){
 
 1565    tm->
warning() << 
"Duplicated items in group name=" << name
 
 1566                  << 
" nb_duplicated=" << nb_duplicated;
 
 1567    auto xbegin = std::begin(local_ids);
 
 1568    auto xend = std::end(local_ids);
 
 1570    tm->
info() << 
"NEW_SIZE=" << new_size << 
" old=" << nb_item;
 
 1571    local_ids = local_ids.
subView(0,new_size);
 
#define ARCANE_FATAL(...)
Macro envoyant une exception FatalErrorException.
bool reorderNodesOfFace2(Int64ConstArrayView nodes_unique_id, Int32ArrayView new_index)
Réordonne les noeuds d'une face.
#define ARCANE_SERVICE_INTERFACE(ainterface)
Macro pour déclarer une interface lors de l'enregistrement d'un service.
Classe de base d'un service.
AbstractService(const ServiceBuildInfo &)
Constructeur à partir d'un ServiceBuildInfo.
constexpr ArrayView< T > subView(Integer abegin, Integer asize) noexcept
Sous-vue à partir de l'élément abegin et contenant asize éléments.
constexpr Integer size() const noexcept
Retourne la taille du tableau.
constexpr bool empty() const noexcept
Retourne true si le tableau est vide (dimension nulle)
void reserve(Int64 new_capacity)
Réserve le mémoire pour new_capacity éléments.
Informations nécessaires pour la lecture d'un fichier de maillage.
Vue sur les informations des mailles.
EnumeratorT< ItemGroup > Enumerator
Vue constante d'un tableau de type T.
Vue sur les informations des arêtes.
Vue sur les informations des faces.
virtual ITraceMng * traceMng() const =0
Gestionnaire de traces.
virtual String language() const =0
Langage utilisé dans le jeu de données.
virtual String codeUnitSystem() const =0
Nom du système d'unité du document.
Interface du service de lecture du maillage à partir du jeu de données.
virtual Integer nbGhostLayer() const =0
Nombre de couches fantômes.
Interface d'une famille d'entités.
virtual ItemGroupCollection groups() const =0
Liste des groupes de cette famille.
virtual void synchronize(VariableCollection variables)=0
Synchronise les variables variables.
virtual ItemGroup createGroup(const String &name, Int32ConstArrayView local_ids, bool do_override=false)=0
Créé un groupe d'entités de nom name contenant les entités local_ids.
virtual ITraceMng * traceMng() const =0
Gestionnaire de trace associé
virtual Integer nbItem() const =0
Nombre d'entités.
virtual Integer dimension()=0
Dimension du maillage (1D, 2D ou 3D).
Interface d'un service de création/lecture du maillage.
Interface du service gérant la lecture d'un maillage.
eReturnType
Types des codes de retour d'une lecture ou écriture.
@ RTIrrelevant
Non concerné par l'opération. Cela signifie que le format de fichier ne correspond pas à ce lecteur o...
@ RTError
Erreur lors de l'opération.
@ RTOk
Opération effectuée avec succès.
Interface d'un service d'écriture d'un maillage.
virtual IParallelMng * parallelMng()=0
Gestionnaire de parallèlisme.
virtual void synchronizeGroupsAndVariables()=0
Synchronise tous les groupes et les variables du maillage.
virtual IGhostLayerMng * ghostLayerMng() const =0
Gestionnare de couche fantômes associé
Interface du gestionnaire de parallélisme pour un sous-domaine.
virtual bool isThreadImplementation() const =0
Indique si l'implémentation utilise les threads.
virtual bool isParallel() const =0
Retourne true si l'exécution est parallèle.
virtual void setDimension(Integer dim)=0
Positionne la dimension du maillage (1D, 2D ou 3D).
Interface du gestionnaire d'un sous-domaine.
virtual ICaseDocument * caseDocument()=0
Document XML du cas.
virtual IParallelMng * parallelMng()=0
Retourne le gestionnaire de parallélisme.
virtual ITimerMng * timerMng() const =0
Retourne le gestionnaire de timers.
Interface d'un gestionnaire de timer.
Interface du gestionnaire de traces.
virtual TraceMessage warning()=0
Flot pour un message d'avertissement.
virtual TraceMessage info()=0
Flot pour un message d'information.
Groupe d'entités de maillage.
const String & name() const
Nom du groupe.
bool isAllItems() const
Indique si le groupe est celui de toutes les entités.
Elément de maillage s'appuyant sur des noeuds (Edge,Face,Cell).
void fillMeshBuildInfo(MeshBuildInfo &build_info) override
Remplit build_info avec les informations nécessaires pour créer le maillage.
void allocateMeshItems(IPrimaryMesh *pm) override
Alloue les entités du maillage géré par ce service.
Ref< IMeshBuilder > createBuilder(const CaseMeshReaderReadInfo &read_info) const override
Retourne un builder pour créer et lire le maillage dont les informations sont spécifiées dans read_in...
Construction d'un maillage 3D.
Lecteur des fichiers de maillage via la bibliothèque LIMA.
Lecteur des fichiers de maillage via la bibliothèque LIMA.
eReturnType readMeshFromFile(IPrimaryMesh *mesh, const XmlNode &mesh_node, const String &file_name, const String &dir_name, bool use_internal_partition) override
Lit un maillage à partir d'un fichier.
void build()
Construction de niveau build du service.
bool allowExtension(const String &str) override
Vérifie si le service supporte les fichiers avec l'extension str.
Lecteur des fichiers de maillage via la bibliothèque LIMA.
virtual bool writeMeshToFile(IMesh *mesh, const String &file_name)
Ecriture du maillage au format Lima.
virtual void build()
Construction de niveau build du service.
Lecteur des fichiers de maillage via la bibliothèque LIMA.
Paramètres nécessaires à la construction d'un maillage.
Vue sur les informations des noeuds.
Flot de sortie lié à une String.
Classe gérant un vecteur de réel de dimension 3.
Référence à une instance.
Encapsulation d'un pointeur qui se détruit automatiquement.
ISubDomain * subDomain() const
Accès au ISubDomain associé.
Structure contenant les informations pour créer un service.
Propriétés de création d'un service.
Constructeur de chaîne de caractère unicode.
Chaîne de caractères unicode.
bool null() const
Retourne true si la chaîne est nulle.
const char * localstr() const
Retourne la conversion de l'instance dans l'encodage UTF-8.
bool empty() const
Vrai si la chaîne est vide (nulle ou "")
@ TimerReal
Timer utilisant le temps réel.
TraceAccessor(ITraceMng *m)
Construit un accesseur via le gestionnaire de trace m.
TraceMessage log() const
Flot pour un message de log.
TraceMessage info() const
Flot pour un message d'information.
TraceMessage warning() const
Flot pour un message d'avertissement.
Vecteur 1D de données avec sémantique par valeur (style STL).
Liste de noeuds d'un arbre DOM.
XmlNode documentElement() const
Retourne le noeud élément du document.
String attrValue(const String &name, bool throw_exception=false) const
Valeur de l'attribut name.
ItemGroupT< Node > NodeGroup
Groupe de noeuds.
#define ARCANE_REGISTER_SERVICE(aclass, a_service_property,...)
Macro pour enregistrer un service.
MeshVariableScalarRefT< Node, Real3 > VariableNodeReal3
Grandeur au noeud de type coordonnées.
ItemVariableScalarRefT< Real3 > VariableItemReal3
Grandeur de type coordonn?es 3D.
Integer toInteger(Real r)
Converti un Int64 en un Integer.
double toDouble(Real r)
Converti un Real en double.
__host__ __device__ double log(double v)
Logarithme népérien de v.
constexpr __host__ __device__ bool isEqual(const _Type &a, const _Type &b)
Teste l'égalité bit à bit entre deux valeurs.
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
UniqueArray< Int64 > Int64UniqueArray
Tableau dynamique à une dimension d'entiers 64 bits.
std::int64_t Int64
Type entier signé sur 64 bits.
Int32 Integer
Type représentant un entier.
ConstArrayView< ItemInternal * > ItemInternalList
Type de la liste interne des entités.
@ ST_SubDomain
Le service s'utilise au niveau du sous-domaine.
ConstArrayView< Int64 > Int64ConstArrayView
Equivalent C d'un tableau à une dimension d'entiers 64 bits.
UniqueArray< Int32 > Int32UniqueArray
Tableau dynamique à une dimension d'entiers 32 bits.
ArrayView< Int32 > Int32ArrayView
Equivalent C d'un tableau à une dimension d'entiers 32 bits.
@ IK_Node
Entité de maillage de genre noeud.
@ IK_Cell
Entité de maillage de genre maille.
double Real
Type représentant un réel.
auto makeRef(InstanceType *t) -> Ref< InstanceType >
Créé une référence sur un pointeur.
std::int32_t Int32
Type entier signé sur 32 bits.
Real y
deuxième composante du triplet
Real z
troisième composante du triplet
Real x
première composante du triplet