16#include <Linear_algebra_tools_impl.h>
17#include <Dirichlet_paroi_defilante.h>
18#include <Build_Map_to_Structured.h>
19#include <Connectivite_som_elem.h>
20#include <Dirichlet_loi_paroi.h>
21#include <Dirichlet_homogene.h>
22#include <Static_Int_Lists.h>
23#include <MD_Vector_tools.h>
24#include <MD_Vector_base.h>
25#include <Faces_builder.h>
26#include <Analyse_Angle.h>
27#include <DeviceMemory.h>
28#include <Array_tools.h>
29#include <Domaine_VF.h>
30#include <Periodique.h>
42#if __cplusplus > 201703L
43#define TRUST_USE_ARBORX
48#include <Array_tools.h>
49#include <Reorder_Mesh.h>
51#include <medcoupling++.h>
53#include <MEDCouplingMemArray.hxx>
54#include <MEDLoader.hxx>
56using namespace MEDCoupling;
60#pragma GCC diagnostic push
61#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
68 os <<
"volumes_ : " << finl;
71 os <<
"volumes_entrelaces_ : " << finl;
74 os <<
"face_voisins_ : " << finl;
77 os <<
"face_surfaces_ : "<<face_surfaces_<< finl;
78 face_surfaces_.ecrit(os);
80 os <<
"xp_ : " << finl;
83 os <<
"xv_ : " << finl;
86 os <<
"elem_faces_ : " << finl;
92 os <<
"face_sommets_ : " << finl;
95 os <<
"nb_faces_ : " << finl;
98 os <<
"les_bords_ : " << finl;
99 os << les_bords_ <<finl;
109 face_surfaces_.lit(is);
116 is >> nb_faces_unused;
128 Cerr <<
"Domaine_VF::order_faces()" << finl;
134 tri_lexicographique_tableau(sort_key);
135 if (reorder_ && reorder_->algo() != Reorder_Algo::None && !reorder_->skip_faces())
160 const Domaine& dom =
domaine();
161 const int nb_elements =
nb_elem();
165 int nb_elems_non_std = 0;
167 for (
int i_face = 0; i_face < nb_faces_front; i_face++)
169 const int elem = les_faces.
voisin(i_face, 0);
181 for (
int elem = 0; elem < size_tot; elem++)
199 const int nbfaces = les_faces.
nb_faces();
200 sort_key.
resize(nbfaces, 2);
205 const IntTab& facevoisins = les_faces.
voisins();
207 for (
int i = 0; i < nb_faces_front; i++)
213 for (
int i=nb_faces_front; i < nbfaces; i++)
215 const int elem0 = facevoisins(i, 0);
216 const int elem1 = facevoisins(i, 1);
218 assert(elem0 >= 0 && elem1 >= 0);
227 sort_key(i, 0) = i + nbfaces;
243 const int nbfaces = les_faces.
nb_faces();
244 std::string algon = reorder_->algo() == Reorder_Algo::Morton ?
"Morton" :
"Hilbert";
245 Cerr <<
"****************************************************************" << finl;
246 Cerr <<
"[Reordering] mesh *faces* using " << algon <<
" scheme ..." << finl;
247 Cerr <<
"Nb of non-std faces put at the begining: " << nbfaces-
nb_faces_std_ <<
"\n";
253 const int nb_fac = sort_key.
dimension(0);
256 const int dim1 =
xv_.dimension(1);
262 for (
int i=nb_fac_non_std; i < nb_fac; i++)
264 for (
int j=0; j < dim1; j++)
266 const auto f_idx = sort_key(i, 1);
267 face_pts(i-nb_fac_non_std, j) =
xv_(f_idx,j);
271 reorder_->dump_to_file(face_pts,
"reordering_faces_before.txt");
272 reorder_->compute_renumbering(face_pts, renum);
275 auto sort_key2(sort_key);
276 for (
int i = nb_fac_non_std; i < nb_fac; i++)
278 int j = i-nb_fac_non_std;
280 sort_key(nb_fac_non_std+idx, 0) = sort_key2(i, 0);
284 if (reorder_->is_dump())
286 auto face_pts2(face_pts);
288 for (
int j = 0; j < dim1; j++)
289 face_pts2(renum(i), j) = face_pts(i,j);
290 reorder_->dump_to_file(face_pts2,
"reordering_faces_after.txt");
293 Cerr <<
"[Reordering] Ordering faces done!" << finl;
294 Cerr <<
"****************************************************************" << finl;
303 const int nbfaces = les_faces.
nb_faces();
307 IntTab old_tab(faces_sommets);
308 const int nb_som_faces = faces_sommets.
dimension(1);
309 for (
int i = 0; i < nbfaces; i++)
311 const int old_i = sort_key(i,1);
312 for (
int j = 0; j < nb_som_faces; j++)
313 faces_sommets(i, j) = old_tab(old_i, j);
317 IntTab& faces_voisins = les_faces.
voisins();
319 IntTab old_tab = faces_voisins;
320 for (
int i = 0; i < nbfaces; i++)
322 const int old_i = sort_key(i,1);
323 faces_voisins(i, 0) = old_tab(old_i, 0);
324 faces_voisins(i, 1) = old_tab(old_i, 1);
329 ArrOfInt reverse_index(nbfaces);
330 for (
int i = 0; i < nbfaces; i++)
332 const int j = sort_key(i,1);
333 reverse_index[j] = i;
340 for (
int i = 0; i < nb_items; i++)
342 const int old = array[i];
343 array[i] = old < 0 ? -1 : reverse_index[old];
348 const int nbjoints = joints.size();
349 for (
int i_joint = 0; i_joint < nbjoints; i_joint++)
351 Joint& un_joint = joints[i_joint];
353 const int nbfaces2 = indices_faces.
size_array();
354 assert(nbfaces2 == un_joint.
nb_faces());
355 for (
int i = 0; i < nbfaces2; i++)
357 const int old = indices_faces[i];
358 indices_faces[i] = reverse_index[old];
375 Cerr <<
"<<<<<<<<<< Discretization VF >>>>>>>>>>" << finl;
381 reorder_->reorder_domain(
domaine());
384 histogramme_angle(ledomaine,Cerr);
386 Faces& les_faces= *les_faces_ptr;
389 Type_Face type_face =
domaine().type_elem()->type_face(0);
390 les_faces.
typer(type_face);
393 Static_Int_Lists connectivite_som_elem;
397 construire_connectivite_som_elem(nb_sommets_tot,
399 connectivite_som_elem,
402 Faces_builder faces_builder;
404 connectivite_som_elem,
418 const IntTab& facevoisins = les_faces.
voisins();
420 for (
int i_frontiere = 0; i_frontiere < nb_frontieres; i_frontiere++)
422 Frontiere& fr = ledomaine.
frontiere(i_frontiere);
426 mes_face_voisins.
resize(nbfaces, 2);
427 for (
int i = 0; i < nbfaces; i++)
429 mes_face_voisins(i, 0) = facevoisins(premiere_face + i, 0);
430 mes_face_voisins(i, 1) = facevoisins(premiere_face + i, 1);
463 face_surfaces_.echange_espace_virtuel();
464 face_surfaces_.set_md_vector(md_nul);
473 int i=0, derniere=ledomaine.
nb_bords();
475 for(; i<derniere; i++)
477 les_bords_[i].associer_frontiere(ledomaine.
bord(i));
478 les_bords_[i].associer_Domaine_dis(*
this);
482 for(; i<derniere; i++)
485 les_bords_[i].associer_frontiere(ledomaine.
raccord(j).valeur());
486 les_bords_[i].associer_Domaine_dis(*
this);
490 for(; i<derniere; i++)
493 les_bords_[i].associer_frontiere(ledomaine.
bords_interne(j));
494 les_bords_[i].associer_Domaine_dis(*
this);
498 for(; i<derniere; i++)
501 les_bords_[i].associer_frontiere(ledomaine.
groupe_faces(j));
502 les_bords_[i].associer_Domaine_dis(*
this);
514 delete les_faces_ptr;
529 Cerr <<
"<<<<<< End of Discretization VF >>>>>>>>>>" << finl;
545 sds.typer(
"Sous_domaine_VF");
546 sds->associer_sous_domaine(dom.
ss_domaine(i));
547 sds->associer_domaine_dis(*
this);
553 Cerr <<
" Domaine_VF::remplir_face_voisins_fictifs(const Domaine_Cl_dis_base& ) must be overloaded by" <<
que_suis_je()<<finl;
565 Faces* les_faces=
new(Faces);
571 Cerr <<
" Domaine_VF::modifier_pour_Cl" << finl;
572 for (
auto& itr : conds_lim)
588 int nb_face_bord = frontieredis.
nb_faces();
593 int num_derniere_face = num_premiere_face+nfin;
597 for (
int ind_face=ndeb; ind_face<nfin; ind_face++)
599 face = frontieredis.
num_face(ind_face);
601 faassociee = frontieredis.
num_face(faassociee);
602 if (ind_face<nb_face_bord)
604 assert(faassociee>=num_premiere_face);
605 assert(faassociee<num_derniere_face);
633 for(
int face=0; face<size; face++)
634 for (
int voisin=0; voisin<2; voisin++)
640 if (face_loc != -1)
num_fac_loc_(face,voisin) = face_loc;
644 int autre_voisin = 1 - voisin;
647 for (face_loc=0; face_loc<nb_faces_elem; face_loc++)
649 const int face_glob =
elem_faces(elem,face_loc);
652 if (elem_voisin1==elem2 || elem_voisin2==elem2)
672 for(
int face_loc=0; face_loc<nfe; face_loc++)
689 const int nb_faces_virt = nf_tot - nf;
693 const int moi =
me();
694 for (i = 0; i < nf; i++)
730 int neighbor_elem=neighbor_faces(global_face_number,0);
731 if( neighbor_elem == -1 )
732 neighbor_elem = neighbor_faces(global_face_number,1);
734 double inner_product=0;
738 double vec_face_elem =
xp(neighbor_elem,i)-
xv(global_face_number,i);
739 inner_product+=vec_face_elem*normal_vector(i);
742 if( inner_product > 0 )
746 normal_vector(i)*=-1;
754 normal_vector(i)*=scale_factor;
757 return normal_vector;
762 Journal() <<
" Domaine_VF::marquer_faces_double_contrib" << finl;
767 for (
auto& itr : conds_lim)
772 for (
int ind_face = 0; ind_face < le_bord.
nb_faces_tot(); ind_face++)
774 int num_face = le_bord.
num_face(ind_face);
778 for (
auto& itr : conds_lim)
786 int nfin = ndeb + frontieredis.
nb_faces();
787 for (
int face=ndeb; face<nfin; face++)
796 for(
int njoint=0; njoint<nbjoints; njoint++)
798 const Joint& joint_temp =
joint(njoint);
800 const int nbfaces = indices_faces_joint.
dimension(0);
801 for (
int j = 0; j < nbfaces; j++)
808 int face_de_joint = indices_faces_joint(j, 1);
816 Cerr <<
"==============================================" << finl;
817 Cerr <<
"The boundary areas of the domain " <<
domaine().
le_nom() <<
" are:" << finl;
824 Faces& faces=raccords(i)->faces();
828 for (
int j=0; j<faces.
nb_faces(); j++)
831 raccords(i)->set_aire(s);
832 Cerr<<
"Area of "<<raccords(i)->le_nom()<<
" \t= "<<s<<finl;
837 for (
int i=0; i<bords.
nb_bords(); i++)
839 Faces& faces=bords(i).faces();
843 for (
int j=0; j<faces.
nb_faces(); j++)
846 bords(i).set_aire(s);
847 Cerr<<
"Area of "<<bords(i).le_nom()<<
" \t= "<<s<<finl;
849 Cerr <<
"==============================================" << finl;
857 Cerr<<
"Calculation of elements and nodes on " <<
domaine().
le_nom() <<
" :" << finl;
858 Cerr<<
"Total number of elements = "<<nbelem<<finl;
859 Cerr<<
"Total number of nodes = "<<nbsom<<finl;
860 Cerr<<
"Total number of faces = "<<nbfaces<<finl;
864 trustIdType nb_boundary_faces =
mp_sum(ref_cast(Frontiere,raccords(i).valeur()).
nb_faces());
865 Cerr<< nb_boundary_faces <<
" of them on boundary "<<raccords(i)->le_nom()<<finl;
869 for (
int i=0; i<bords.
nb_bords(); i++)
871 trustIdType nb_boundary_faces =
mp_sum(ref_cast(Frontiere,bords(i)).
nb_faces());
872 Cerr<< nb_boundary_faces <<
" of them on boundary "<<bords(i).le_nom()<<finl;
874 Cerr<<
"=============================================="<<finl;
875 trustIdType internal_item = std::min(nbelem, nbfaces);
876 internal_item = std::min(internal_item, nbsom);
900 Cerr <<
"Domaine_VF::remplir_face_numero_bord" << finl;
905 const int nb_bords = ledomaine.
nb_bords();
906 for (
int n_bord=0; n_bord<nb_bords; n_bord++)
908 const Bord& le_bord = ledomaine.
bord(n_bord);
911 for (
int num_face=ndeb; num_face<nfin; num_face++)
916 for (
int n_racc=0; n_racc<nb_raccords; n_racc++)
918 const Raccord& le_racc = ledomaine.
raccord(n_racc);
919 ndeb = le_racc -> num_premiere_face();
920 nfin = ndeb + le_racc ->
nb_faces();
921 for (
int num_face=ndeb; num_face<nfin; num_face++)
941 const DoubleTab& xgrav =
xv();
945 for (
int num_face=0; num_face <
nb_faces; num_face++)
947 xgr(num_face,i)=xgrav(num_face,i)-c_grav[i];
961 Cerr <<
"Error in Domaine_VF::build_mc_Cmesh ! You use the interpret Build_Map_to_Structured but your elem type is " <<
domaine().type_elem()->
que_suis_je() <<
" !!!" << finl;
962 Cerr <<
"This option is only available for Quadrangle/Rectangle/Hexaedre types !!! Remove this interpret from your data file." << finl;
967 Cerr <<
"###########################################" << finl;
968 Cerr <<
"@@@@@@@@ Building Structured infos @@@@@@@@" << finl;
969 Cerr <<
"###########################################" << finl;
975 build_mc_Cmesh_nodesCorrespondence();
978 build_mc_Cmesh_correspondence(with_faces);
980 mc_Cmesh_with_faces_corr_ = with_faces;
981 mc_Cmesh_ready_ =
true;
983 Cerr <<
"##################################################" << finl;
984 Cerr <<
"@@@@@@@@ End of Building Structured infos @@@@@@@@" << finl;
985 Cerr <<
"##################################################" << finl;
989 Cerr <<
"Error in Domaine_VF::build_mc_Cmesh ! You use the interpret Build_Map_to_Structured but your TRUST version is compiled without MEDCOUPLING !!!" << finl;
998void Domaine_VF::build_mc_Cmesh()
1000 using DAD = MCAuto<DataArrayDouble>;
1002 Cerr <<
"Domaine_VF::build_mc_Cmesh() ... " << finl;
1003 const auto& u_mesh =
domaine().get_mc_mesh();
1004 const auto& coords = u_mesh->getCoords();
1005 trustIdType nb_soms_tmp = coords->getNumberOfTuples(), nb_elems_tmp = u_mesh->getNumberOfCells();
1009 const int mesh_dim = u_mesh->getMeshDimension();
1011 Cerr <<
"Domaine_VF: Creating a MEDCouplingCMesh object for the domaine_VF '" <<
que_suis_je() <<
"' & the domaine '" <<
domaine().
le_nom() <<
"' ..." << finl;
1012 mc_Cmesh_ = MEDCouplingCMesh::New(
"TRUST_CMesh");
1015 DAD coo[3], uniq[3];
1016 for (
unsigned d=0; d < (unsigned)mesh_dim; d++)
1018 coo[d] = coords->keepSelectedComponents({d});
1019 uniq[d] = coo[d]->getDifferentValues(eps);
1020 std::sort(uniq[d]->rwBegin(), uniq[d]->rwEnd());
1022 mc_Cmesh_x_coords_.resize(uniq[0]->getNumberOfTuples());
1023 std::copy(uniq[0]->begin(), uniq[0]->end(),mc_Cmesh_x_coords_.begin());
1024 mc_Cmesh_y_coords_.resize(uniq[1]->getNumberOfTuples());
1025 std::copy(uniq[1]->begin(), uniq[1]->end(),mc_Cmesh_y_coords_.begin());
1028 mc_Cmesh_z_coords_.resize(uniq[2]->getNumberOfTuples());
1029 std::copy(uniq[2]->begin(), uniq[2]->end(),mc_Cmesh_z_coords_.begin());
1032 const int nx = (int)mc_Cmesh_x_coords_.size(), ny = (int)mc_Cmesh_y_coords_.size();
1033 const int nz = (mesh_dim > 2) ? (
int)mc_Cmesh_z_coords_.size() : 1;
1035 const int nb_som_cart = nx * ny * nz;
1036 const int nb_elem_cart = (mesh_dim > 2) ? (nx - 1) * (ny - 1) * (nz - 1) : (nx - 1) * (ny - 1);
1038 if (nb_som_cart != nb_soms || nb_elem_cart != nb_elems)
1040 Cerr <<
"Issue in converting the TRUST mesh to MEDCouplingCMesh ... It seems that the mesh is not an IJK-like mesh !!!" << finl;
1041 Cerr <<
"Nb soms : " << nb_soms <<
" for TRUST mesh vs " << nb_som_cart <<
" for the MEDCouplingCMesh" << finl;
1042 Cerr <<
"Nb elems : " << nb_elems <<
" for TRUST mesh vs " << nb_elem_cart <<
" for the MEDCouplingCMesh" << finl;
1046 Cerr <<
"Structured mesh dimensions (nodes) : " << nx <<
" x " << ny;
1047 if (mesh_dim > 2) Cerr <<
" x " << nz;
1051 mc_Cmesh_->setCoords(uniq[0], uniq[1], uniq[2]);
1053 mc_Cmesh_->setCoords(uniq[0], uniq[1]);
1055 Cerr <<
"Domaine_VF::build_mc_Cmesh() ... OK !" << finl;
1061void Domaine_VF::build_mc_Cmesh_correspondence(
bool withFace)
1063 using DAI = MCAuto<DataArrayIdType>;
1064 using DAD = MCAuto<DataArrayDouble>;
1066 Cerr <<
"Domaine_VF::build_mc_Cmesh_correspondence() building elem (and potentially face) correspondence ... " << finl;
1070 MCAuto<MEDCouplingUMesh> mc_unstr = mc_Cmesh_->buildUnstructured();
1071 const MEDCouplingUMesh * mc_mesh =
domaine().get_mc_mesh();
1074 mc_unstr->setCoords(mc_mesh->getCoords());
1075 DAI renumb(DataArrayIdType::New());
1076 mcIdType n_nod = mc_unstr->getCoords()->getNumberOfTuples();
1077 renumb->alloc(n_nod);
1078 std::copy(mc_Cmesh_nodesCorrespondence_.data(),mc_Cmesh_nodesCorrespondence_.data()+n_nod, renumb->rwBegin());
1080 mc_unstr->renumberNodesInConn(renumb->begin());
1083 DataArrayIdType * mP;
1084 mc_unstr->areCellsIncludedIn(mc_mesh, 2, mP);
1087 DAI outliers = mP->findIdsNotInRange(0, mc_unstr->getNumberOfCells());
1088 if (outliers->getNumberOfTuples() != 0)
1089 Process::exit(
"ERROR: Issue in converting the TRUST mesh to MEDCouplingCMesh ... It seems that the mesh is not an IJK-like mesh!!!");
1091 mc_Cmesh_elemCorrespondence_.resize(mP->getNumberOfTuples());
1092 std::copy(mP->begin(), mP->end(), mc_Cmesh_elemCorrespondence_.data());
1102 int mesh_dim = mc_unstr->getMeshDimension();
1105 DAI desc(DataArrayIdType::New()), descIndx(DataArrayIdType::New()), revDesc(DataArrayIdType::New()), revDescIndx(DataArrayIdType::New());
1106 MCAuto<MEDCouplingUMesh> mc_unstr_fac(mc_unstr->buildDescendingConnectivity(desc, descIndx, revDesc, revDescIndx));
1107 mcIdType nb_fac = mc_unstr_fac->getNumberOfCells();
1109 DataArrayIdType * mapFac;
1110 mc_unstr_fac->areCellsIncludedIn(mc_face_mesh_, 2, mapFac);
1112 DAD faceBary = mc_face_mesh_->computeCellCenterOfMass();
1113 const double * faceBaryP = faceBary->getConstPointer();
1114 DAI permu(DataArrayIdType::New());
1115 permu->alloc(nb_fac);
1118 auto comp_func_2d = [&](
const int& i1,
const int& i2) ->
bool
1120 std::array<double, 2> tup1 = { faceBaryP[i1*2+1], faceBaryP[i1*2+0] };
1121 std::array<double, 2> tup2 = { faceBaryP[i2*2+1], faceBaryP[i2*2+0] };
1125 auto comp_func_3d = [&](
const int& i1,
const int& i2) ->
bool
1127 std::array<double, 3> tup1 = { faceBaryP[i1*3+2], faceBaryP[i1*3+1], faceBaryP[i1*3+0] };
1128 std::array<double, 3> tup2 = { faceBaryP[i2*3+2], faceBaryP[i2*3+1], faceBaryP[i2*3+0] };
1133 std::sort(permu->rwBegin(), permu->rwEnd(), comp_func_2d);
1135 std::sort(permu->rwBegin(), permu->rwEnd(), comp_func_3d);
1136 for (mcIdType pp: *permu)
1138 int p =
static_cast<int>(pp);
1140 if (ori == 0) mc_Cmesh_facesXCorrespondence_.push_back(p);
1141 if (ori == 1) mc_Cmesh_facesYCorrespondence_.push_back(p);
1142 if (mesh_dim > 2 && ori == 2) mc_Cmesh_facesZCorrespondence_.push_back(p);
1145 Cerr <<
" - Built mc_Cmesh_facesXCorrespondence_ with size " << (int)mc_Cmesh_facesXCorrespondence_.size() << finl;
1146 Cerr <<
" - Built mc_Cmesh_facesYCorrespondence_ with size " << (int)mc_Cmesh_facesYCorrespondence_.size() << finl;
1148 Cerr <<
" - Built mc_Cmesh_facesZCorrespondence_ with size " << (int)mc_Cmesh_facesZCorrespondence_.size() << finl;
1150 Cerr <<
"Domaine_VF::build_mc_Cmesh_correspondence() - done!" << finl;
1155static int findCartIndex(
const std::vector<double>& vect,
const double value)
1157 if (value < vect.front() || value > vect.back())
1160 auto it = std::lower_bound(vect.begin(), vect.end(), value);
1162 if (it == vect.end())
1165 int index =
static_cast<int>(std::distance(vect.begin(), it));
1167 if (index > 0 && value < vect[index])
1175void Domaine_VF::build_mc_Cmesh_nodesCorrespondence()
1177 Cerr <<
"Domaine_VF::build_mc_Cmesh_nodesCorrespondence() ... " << finl;
1178 const auto& u_mesh =
domaine().get_mc_mesh();
1179 const double* coordsP = u_mesh->getCoords()->getConstPointer();
1180 const int space_dim =
static_cast<int>(u_mesh->getCoords()->getNumberOfComponents());
1181 const int nb_soms =
static_cast<int>(u_mesh->getNumberOfNodes());
1182 const int mesh_dim = u_mesh->getMeshDimension();
1183 const int nx = (int)mc_Cmesh_x_coords_.size(), ny = (int)mc_Cmesh_y_coords_.size();
1185 mc_Cmesh_nodesCorrespondence_.resize(nb_soms, -1);
1187 for (
int node = 0; node < nb_soms; ++node)
1189 int i = findCartIndex(mc_Cmesh_x_coords_, coordsP[node*space_dim + 0]);
1190 int j = findCartIndex(mc_Cmesh_y_coords_, coordsP[node*space_dim + 1]);
1191 int k = (mesh_dim > 2) ? findCartIndex(mc_Cmesh_z_coords_, coordsP[node*space_dim + 2]) : 0;
1193 if (i == -1 || j == -1 || (mesh_dim > 2 && k == -1))
1195 Cerr <<
"Node " << node <<
" not contained in the structured mesh !!!" << finl;
1199 const int ijk_idx = i + nx * (j + ny * k);
1200 mc_Cmesh_nodesCorrespondence_[ijk_idx] = node;
1203 Cerr <<
"Domaine_VF::build_mc_Cmesh_nodesCorrespondence() ... OK !" << finl;
1211 CDoubleTabView
xp =
xp_.view_ro();
1212 DoubleTabView positions_v = positions.
view_wo();
1213 Kokkos::parallel_for(start_gpu_timer(__KERNEL_NAME__), range_2D({0,0}, {
nb_elem(),
xp_.dimension(1)}), KOKKOS_LAMBDA(
const int i,
const int j)
1215 positions_v(i,j) =
xp(i,j);
1217 end_gpu_timer(__KERNEL_NAME__);
1226 for (
int i=0; i<ne; i++)
1228 sum+=std::fabs(val_source(i))*
volumes(i);
1237 for (
int i=0; i<ne; i++)
1239 sum+=val_source(i)*val_source(i)*
volumes(i);
1247 CDoubleArrView vol =
volumes().view_ro();
1248 CDoubleArrView val = val_source.view_ro();
1249 Kokkos::parallel_reduce(start_gpu_timer(__KERNEL_NAME__), ne, KOKKOS_LAMBDA(
const int i,
double & sum_tmp,
double & volume_tmp)
1252 sum_tmp += val(i) * v;
1255 end_gpu_timer(__KERNEL_NAME__);
1261 CDoubleArrView vol =
volumes().view_ro();
1262 CDoubleArrView poro = porosity.view_ro();
1263 CDoubleArrView val = val_source.view_ro();
1264 Kokkos::parallel_reduce(start_gpu_timer(__KERNEL_NAME__), ne, KOKKOS_LAMBDA(
const int i,
double & sum_tmp,
double & volume_tmp)
1268 sum_tmp += val(i) * v * p;
1269 volume_tmp += v * p;
1271 end_gpu_timer(__KERNEL_NAME__);
1276 Process::exit(
"The function should not be used in domaine_VF, related to quadrature points (DG discretization)");
1282 Process::exit(
"The function should not be used in domaine_VF, related to quadrature points (DG discretization)");
1288 Process::exit(
"The function should not be used in domaine_VF, related to quadrature points (DG discretization)");
1293#ifdef TRUST_USE_ARBORX
1297 template <
typename Query,
typename Value,
typename Output>
1298 KOKKOS_FUNCTION
void operator()(Query
const&, Value
const& value, Output
const& out)
const
1310 Cerr <<
"Domaine_VF::init_dist_paroi_globale..." << finl;
1330 DoubleTabs remote_xv(parts);
1333 int nb_faces_bord_ = 0;
1336 for (
auto& itr : conds_lim)
1340 int num_face_1_cl = itr->frontiere_dis().frontiere().num_premiere_face();
1341 int nb_faces_cl = itr->frontiere_dis().frontiere().nb_faces();
1343 nb_faces_bord_ += itr->frontiere_dis().frontiere().nb_faces();
1345 for (
int f=num_face_1_cl ; f < nb_faces_cl+num_face_1_cl ; f++)
1348 while ( (nb_som_loc <
nb_som_face()) && (f_s(f, nb_som_loc) != -1))
1350 soms.insert(f_s(f, nb_som_loc));
1353 nb_aretes += (D == 3 ? nb_som_loc : 0) ;
1358 Process::exit(
que_suis_je() +
" : at least one boundary must be solid for the distance to the edge to be calculated !!!");
1360 remote_xv[moi].
resize(nb_faces_bord_ + (
int)soms.size() + nb_aretes,D);
1361 int index[5] = { -1, -1, -1, -1, -1 };
1373 for (
int ind_cl = 0 ; ind_cl < conds_lim.size() ; ind_cl++)
1376 int num_face_1_cl = conds_lim[ind_cl]->frontiere_dis().frontiere().num_premiere_face();
1377 int nb_faces_cl = conds_lim[ind_cl]->frontiere_dis().frontiere().nb_faces();
1379 for (
int f=num_face_1_cl ; f < nb_faces_cl+num_face_1_cl ; f++)
1381 for (
int d=0 ; d<D ; d++)
1382 remote_xv[moi](ind_tab,d) = domaine_.
xv(f, d);
1389 for (
int id_som=1; id_som<=
nb_som_face(); id_som++)
1391 for (
int d = 0; d < D; d++)
1392 remote_xv[moi](ind_tab, d) =
1393 (xs(f_s(f, index[id_som]), d) + xs(f_s(f, index[id_som - 1]), d)) / 2;
1400 while ((id_som <
nb_som_face()) && (f_s(f, id_som) != -1))
1402 for (
int d = 0; d < D; d++)
1403 remote_xv[moi](ind_tab, d) = (xs(f_s(f, id_som), d) + xs(f_s(f, id_som - 1), d)) / 2;
1407 for (
int d = 0; d < D; d++)
1408 remote_xv[moi](ind_tab, d) = (xs(f_s(f, 0), d) + xs(f_s(f, id_som - 1), d)) / 2;
1417 for (
int d=0 ; d<D ; d++)
1418 remote_xv[moi](ind_tab,d) = xs(som, d);
1425 Cerr <<
"[MPI] Broadcasting remote_xv..." << finl;
1426 for (
int p = 0; p < parts; p++)
1427 envoyer_broadcast(remote_xv[p], p);
1429 int nb_total_points=0;
1430 for (
int p = 0; p < parts; p++)
1431 nb_total_points+=remote_xv[p].
dimension(0);
1433 Cerr <<
"Number of boundary points: " << nb_total_points << finl;
1434 double GBytes = nb_total_points * 4.0 * D / 1024.0 / 1024.0 / 1024.0;
1435 Cerr <<
"Estimated memory needed: " << GBytes <<
" GB" << finl;
1440 const DoubleTab& local_xv = domaine_.
xv();
1441 const DoubleTab& local_xp = domaine_.
xp();
1443#ifdef TRUST_USE_ARBORX
1446 using ExecutionSpace = Kokkos::DefaultExecutionSpace;
1447 using MemorySpace = ExecutionSpace::memory_space;
1448 using Point = ArborX::Point<3>;
1449 ExecutionSpace space;
1450 Kokkos::View<Point *, MemorySpace> query_points(
"local_xs", nf + ne);
1452 Kokkos::parallel_for(start_gpu_timer(__KERNEL_NAME__), nf, KOKKOS_LAMBDA(
1455 query_points[i] = {(float)
xv(i, 0), (float)
xv(i, 1), dim == 3 ? (float)
xv(i, 2) : 0.f};
1457 end_gpu_timer(__KERNEL_NAME__);
1459 Kokkos::parallel_for(start_gpu_timer(__KERNEL_NAME__), ne, KOKKOS_LAMBDA(
1462 query_points[nf + i] = {(float)
xp(i, 0), (float)
xp(i, 1), dim == 3 ? (float)
xp(i, 2) : 0.f};
1464 end_gpu_timer(__KERNEL_NAME__);
1466 ArrOfDouble distances(nf+ne);
1467 distances=DMAXFLOAT;
1469 double target_GB = 1.0;
1470 int num_batches = std::max(1, (
int)std::ceil(GBytes / target_GB));
1471 int batch_size = std::max(1, (parts + num_batches - 1) / num_batches);
1472 Cerr <<
"Number of batches: " << num_batches <<
", parts per batch: " << batch_size
1473 <<
", points per batch: ~" << nb_total_points / num_batches << finl;
1474 for (
int batch_start = 0; batch_start < parts; batch_start += batch_size)
1476 int batch_end = std::min(batch_start + batch_size, parts);
1480 for (
int part = batch_start; part < batch_end; part++)
1481 nb_points += remote_xv[part].
dimension(0);
1482 if (nb_points == 0)
continue;
1485 Kokkos::View<Point *, MemorySpace> points(
"remote_xv", nb_points);
1486 int point_offset = 0;
1487 for (
int part = batch_start; part < batch_end; part++)
1489 int size = remote_xv[part].
dimension(0);
1492 CDoubleTabView coord = remote_xv[part].view_ro();
1493 int local_offset = point_offset;
1494 Kokkos::parallel_for(start_gpu_timer(__KERNEL_NAME__), size, KOKKOS_LAMBDA(
const int i)
1496 points[local_offset + i] = {(float) coord(i, 0), (float) coord(i, 1),
1497 dim == 3 ? (float) coord(i, 2) : 0.f
1500 end_gpu_timer(__KERNEL_NAME__);
1502 point_offset += size;
1506 Cerr <<
"ArborX::BoundingVolumeHierarchy for parts " << batch_start <<
" to " << batch_end - 1;
1507 ArborX::BoundingVolumeHierarchy bvh(space, ArborX::Experimental::attach_indices(points));
1508 Cerr <<
" created!" << finl;
1509 Kokkos::View<int *, MemorySpace> offsets(
"Example::offsets", 0);
1510 Kokkos::View<int *, MemorySpace> indices(
"Example::indices", 0);
1511 Cerr <<
"ArborX query...";
1512 bvh.query(space, ArborX::Experimental::make_nearest(query_points, 1), ExtractIndex {}, indices, offsets);
1513 Cerr <<
" completed!" << finl;
1515 int global_offset = 0;
1516 for (
int pp = 0; pp < batch_start; pp++)
1517 global_offset += remote_xv[pp].
dimension(0);
1521 DoubleArrView dist =
static_cast<ArrOfDouble&
>(distances).view_rw();
1522 IntArrView glob =
static_cast<ArrOfInt&
>(glob_idx).view_rw();
1523 int total_fe = nf + ne;
1524 Kokkos::parallel_for(start_gpu_timer(__KERNEL_NAME__), total_fe, KOKKOS_LAMBDA(
const int fe)
1526 int ar = indices(fe);
1528 for (
int i = 0; i < dim; i++)
1530 float diff = query_points(fe)[i] - points(ar)[i];
1535 dist(fe) = (double)d;
1536 glob(fe) = ar + global_offset;
1539 end_gpu_timer(__KERNEL_NAME__);
1544 MCAuto <DataArrayIdType> glob(DataArrayIdType::New());
1546 std::vector<MCAuto<DataArrayDouble> > vxv(parts);
1547 std::vector<const DataArrayDouble*> cvxv(parts);
1548 MCAuto<DataArrayDouble> remote_xvs(DataArrayDouble::New());
1549 for (
int p = 0; p < parts; p++)
1551 vxv[p] = DataArrayDouble::New();
1552 vxv[p]->useExternalArrayWithRWAccess(remote_xv[p].addr(), remote_xv[p].
dimension(0), remote_xv[p].
dimension(1));
1555 remote_xvs = DataArrayDouble::Aggregate(cvxv);
1556 MCAuto<DataArrayDouble> local_xs(DataArrayDouble::New());
1557 local_xs->alloc(nf+ne, D);
1558 for (
int f = 0; f < nf; f++)
1559 for (
int d = 0; d < D; d++)
1560 local_xs->setIJ(f, d, local_xv(f, d));
1561 for (
int e = 0; e < ne; e++)
1562 for (
int d = 0; d < D; d++)
1563 local_xs->setIJ(nf+e, d, local_xp(e, d));
1564 glob = remote_xvs->findClosestTupleId(local_xs);
1565 for (
int i=0; i<nf+ne; i++)
1566 glob_idx(i) = (int)glob->getIJ(i,0);
1569 ToDo_Kokkos(
"critical");
1571 for (
int fe = 0; fe<nf+ne; fe++)
1575 int fe2 = glob_idx(fe);
1576 while (fe2 >= remote_xv[proc].
dimension(0))
1581 double distance2 = 0;
1582 for (
int d=0; d<D; d++)
1585 if (fe<nf) x1=local_xv(fe,d);
1586 else if (fe<nf+ne) x1=local_xp(fe-nf,d);
1587 else { Cerr<<
"Domaine_VF::init_dist_paroi_globale : problem in the ditance to the edge calculation. Contact TRUST support."<<finl;
Process::exit();}
1588 double x2=remote_xv[proc](fe2,d);
1589 distance2 += (x1-x2)*(x1-x2);
1593 y_faces_(fe) = std::sqrt(distance2);
1595 for (
int d = 0 ; d<D ; d++)
1600 y_elem_(fe-nf) = std::sqrt(distance2);
1601 for (
int d = 0 ; d<D ; d++)
1602 n_y_elem_(fe-nf, d) = ( local_xp(fe-nf,d)-remote_xv[proc](fe2,d) )/
y_elem_(fe-nf);
1607 for (
int ind_cl = 0 ; ind_cl < conds_lim.size() ; ind_cl++)
1610 int num_face_1_cl = conds_lim[ind_cl]->frontiere_dis().frontiere().num_premiere_face();
1611 int nb_faces_cl = conds_lim[ind_cl]->frontiere_dis().frontiere().nb_faces();
1613 for (
int f=num_face_1_cl ; f < nb_faces_cl+num_face_1_cl ; f++)
1617 if ( dist_ef_loc <
y_elem_(ind) )
1620 for (
int d = 0 ; d < D ; d++)
1623 for (
int d = 0 ; d<D ; d++)
1631 y_elem_.echange_espace_virtuel();
1633 Cerr <<
"Initialize the y table " << domaine_.
domaine().
le_nom() << finl;
1647 using MEDCoupling::DataArrayIdType;
1648 using MEDCoupling::DataArrayDouble;
1650 using DAId = MCAuto<DataArrayIdType>;
1652 const MEDCouplingUMesh* mc_mesh =
domaine().get_mc_mesh();
1655 DAId desc(DataArrayIdType::New()), descIndx(DataArrayIdType::New()), revDesc(DataArrayIdType::New()), revDescIndx(DataArrayIdType::New());
1656 mc_face_mesh_ = mc_mesh->buildDescendingConnectivity(desc, descIndx, revDesc, revDescIndx);
1660 MCAuto<MEDCouplingUMesh> faces_tmp = mc_face_mesh_->deepCopyConnectivityOnly();
1662 int nb_fac = faces_sommets.
dimension(0);
1664 assert((
int)mc_face_mesh_->getNumberOfCells() == nb_fac);
1665 DAId c(DataArrayIdType::New()), cI(DataArrayIdType::New());
1667 cI->alloc(nb_fac+1, 1);
1668 mcIdType *cIP = cI->getPointer();
1670 mcIdType typ =
Objet_U::dimension == 3 ? INTERP_KERNEL::NormalizedCellType::NORM_POLYGON : INTERP_KERNEL::NormalizedCellType::NORM_SEG2;
1672 for (
int fac=0; fac<nb_fac; fac++)
1674 c->pushBackSilent(typ);
1676 for (; i < max_som_fac && (s = faces_sommets(fac, i)) >= 0; i++)
1677 c->pushBackSilent(s);
1678 cIP[fac+1] = cIP[fac] + i + 1;
1680 faces_tmp->setConnectivity(c, cI);
1683 DataArrayIdType * mP;
1684 mc_face_mesh_->areCellsIncludedIn(faces_tmp,2, mP);
1686 DAId renum2(mP->invertArrayN2O2O2N(nb_fac));
1689 DAId outliers = renum2->findIdsNotInRange(0, nb_fac);
1690 if (outliers->getNumberOfTuples() != 0)
1691 Process::exit(
"Invalid renumbering arrays! Should not happen. Some faces could not be matched between the TRUST face domain and the buildDescendingConnectivity() version.");
1700 mc_face_mesh_->renumberCells(renum2->begin(), check);
1702 mc_face_mesh_->checkConsistency();
1706 mc_face_mesh_ready_ =
true;
1722 using DAId = MCAuto<DataArrayIdType>;
1723 using DAD = MCAuto<DataArrayDouble>;
1725 const MEDCouplingUMesh* mc_face_mesh = get_mc_face_mesh();
1728 Cerr <<
" Domaine: Creating **dual** mesh as a MEDCouplingUMesh object for the domain '" <<
le_nom() <<
"'" << finl;
1734 const mcIdType *fc = mc_face_mesh->getNodalConnectivity()->getConstPointer(),
1735 *fcI= mc_face_mesh->getNodalConnectivityIndex()->getConstPointer();
1740 DAId c(DataArrayIdType::New()), cI(DataArrayIdType::New());
1741 cI->alloc(nb_fac*2, 1);
1743 mcIdType *cIP = cI->getPointer();
1747 auto corrige_voisins_dual_perio = [&](
int f,
int &e1,
int &e2)
1750 auto d2 = [&](
int e) ->
double
1753 for (
int d = 0; d < dim; d++)
1755 double dx =
xp_(e, d) -
xv_(f, d);
1761 if (e1 >= 0 && e2 >= 0)
1764 if (d2(e1) <= d2(e2)) e2 = -1;
1771 for(
int f=0; f<nb_fac; f++)
1777 corrige_voisins_dual_perio(f, e1, e2);
1779 for (
int e: {e1, e2})
1781 if (e==-1 || e >=
nb_elem)
continue;
1786 mcIdType nb_pts = fcI[f+1]-fcI[f]-1;
1800 mcIdType *cP = c->getPointer();
1803 for(
int f=0; f<nb_fac; f++)
1809 corrige_voisins_dual_perio(f, e1, e2);
1811 for (
int e: {e1, e2})
1813 if (e==-1 || e >=
nb_elem)
continue;
1816 cP[c_sz++] = INTERP_KERNEL::NormalizedCellType::NORM_TRI3;
1818 const mcIdType *p = fc + fcI[f] + 1;
1820 cP[c_sz++] = *(p+1);
1821 cP[c_sz++] = e+nb_coo;
1825 mcIdType nb_pts = fcI[f+1]-fcI[f]-1;
1826 cP[c_sz++] = INTERP_KERNEL::NormalizedCellType::NORM_POLYHED;
1829 for(
const mcIdType *p = fc + fcI[f] + 1; p < fc+fcI[f + 1]; p++)
1833 const mcIdType *p2 = fc + fcI[f] + 1;
1834 for (mcIdType i = 0; i<nb_pts; i++)
1837 cP[c_sz++] = e+nb_coo;
1838 cP[c_sz++] = *(p2+i);
1839 cP[c_sz++] = *(p2+(i+1)%nb_pts);
1847 assert(c_sz == totSz);
1853 DAD coo2 = mc_face_mesh->getCoords()->deepCopy();
1854 coo2->reAlloc(nb_coo+
nb_elem);
1855 std::copy(
xp_.addr(),
xp_.addr() +
nb_elem*dim, coo2->getPointer()+nb_coo*dim);
1857 const std::string dual_nam =
domaine().get_mc_mesh()->getName() +
"_dual";
1858 mc_dual_mesh_ = MEDCouplingUMesh::New(dual_nam, dim);
1859 mc_dual_mesh_->setCoords(coo2);
1860 mc_dual_mesh_->setConnectivity(c,cI);
1861 mc_dual_mesh_ready_ =
true;
1870 MCAuto<MEDCouplingUMesh> skin_dual = mc_dual_mesh_->computeSkin();
1871 mcIdType nb_faces_bd = skin_dual->getNumberOfCells();
1874 Process::exit(
"Something wrong with dual mesh computation #1 -- boundary faces !!!! \n");
1878 DAId desc(DataArrayIdType::New()), descIndx(DataArrayIdType::New()), revDesc(DataArrayIdType::New()), revDescIndx(DataArrayIdType::New());
1879 mc_dual_mesh_->buildDescendingConnectivity(desc, descIndx, revDesc, revDescIndx);
1881 DAId dsi = descIndx->deltaShiftIndex();
1882 DAId res = dsi->findIdsLowerOrEqualTo(3) ;
1883 if (res->getNumberOfTuples() > 0)
1884 Process::exit(
"Something wrong with dual mesh computation #2 -- polyhedron faces !!!! \n");
Empty class used as a base for all the arrays.
classe Cond_lim_base Classe de base pour la hierarchie des classes qui representent les differentes c...
virtual Frontiere_dis_base & frontiere_dis()
Renvoie la frontiere discretisee a laquelle les conditions aux limites s'appliquent.
classe Conds_lim Cette classe represente un vecteur de conditions aux limites.
Classe Dirichlet_homogene Cette classe est la classe de base de la hierarchie des conditions aux limi...
Classe Dirichlet_loi_paroi Classe de base pour les valeurs impose pour une condition aux limites des ...
classe Dirichlet_paroi_defilante Impose la vitesse de paroi dnas une equation de type Navier_Stokes.
void calculer_mon_centre_de_gravite(ArrOfDouble &c)
Calcule le centre de gravite du domaine.
const Sous_Domaine_t & ss_domaine(int i) const
Groupe_Faces_t & groupe_faces(int i)
Bord_Interne_t & bords_interne(int i)
virtual void creer_tableau_elements(Array_base &, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT) const
creation d'un tableau parallele de valeurs aux elements.
void creer_mes_domaines_frontieres(const Domaine_VF &domaine_vf)
Raccord_t & raccord(int i)
void calculer_centres_gravite(DoubleTab_t &xp) const
Calcule les centres de gravites des elements du domaine.
int_t nb_faces_frontiere() const
Renvoie le nombre de faces frontiere du domaine (somme des nombres de bords, de raccords et de bords ...
virtual void calculer_volumes(DoubleVect_t &volumes, DoubleVect_t &inv_volumes) const
Calcule les volumes des elements du domaine.
void init_faces_virt_bord(const MD_Vector &md_vect_faces, MD_Vector &md_vect_faces_bord)
DoubleTab_t & les_sommets()
const Frontiere_t & frontiere(int i) const
int nb_frontieres_internes() const
Raccords_t & faces_raccord()
const DoubleTab_t & coord_sommets() const
const ArrOfDouble & cg_moments() const
int_t nb_som_tot() const
Renvoie le nombre total de sommets du domaine i.e. le nombre de sommets reels et virtuels sur le proc...
int_t nb_som() const
Renvoie le nombre de sommets du domaine.
int nb_groupes_faces() const
Groupes_Faces_t & groupes_faces()
classe Domaine_Cl_dis_base Les objets Domaine_Cl_dis_base representent les conditions aux limites
IntVect rang_elem_non_std_
void creer_tableau_aretes(Array_base &, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT) const
virtual const DoubleVect & face_surfaces() const
int nb_faces() const
renvoie le nombre global de faces.
virtual double compute_L1_norm(const DoubleVect &val_source, const bool basis_function, const int order) const
void build_mc_face_mesh() const
Build the MEDCoupling face mesh. It is always made of polygons (in 3D) for simplicity purposes....
void build_map_mc_Cmesh(const bool with_faces) override
IntTab & face_sommets() override
renvoie le tableau de connectivite faces/sommets.
virtual const DoubleTab & xv_bord() const
virtual double dist_face_elem1(int, int) const
virtual double compute_L2_norm(const DoubleVect &val_source, const bool basis_function, const int order) const
void init_dist_paroi_globale(const Conds_lim &conds_lim) override
DoubleVect volumes_entrelaces_
void order_faces(Faces &les_faces)
This method (that may be overriden in various discretisations) is used to order faces according to th...
const MD_Vector & md_vector_aretes() const
virtual void get_ind_integ_points(IntTab &nelem) const
int nb_faces_tot() const
renvoie le nombre total de faces.
virtual Faces * creer_faces()
renvoie new(Faces) ! elle est surchargee par Domaine_VDF par ex.
void creer_tableau_faces(Array_base &, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT) const
void sort_along_zcurve(const Faces &les_faces, IntTab &sort_key) const
Tweak the face sorting keys so that internal faces (=standard faces) follow a Z-curve indexing scheme...
IntTab face_dual_
For each face f, face_dual_(f, j) returns the element built on the left and right of the face in the ...
double xv(int num_face, int k) const
MD_Vector md_vector_faces_
void discretiser_no_face() override
virtual void prepare_elem_non_std(Faces &les_faces)
Identify non-standard elements (will be used later to identify non standard faces) Some discretisatio...
const Joint & joint(int i) const
void remplir_face_numero_bord()
virtual void compute_sort_key(Faces &les_faces, IntTab &sort_key)
Generate an IntTab (sort_key) with two columns allowing to sort the faces along a specific order....
virtual int get_max_nb_integ_points() const
void creer_tableau_faces_bord(Array_base &, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT) const
DoubleVect inverse_volumes_
void discretiser() override
Genere les faces construits les frontieres.
void modifier_pour_Cl(const Conds_lim &) override
void build_mc_dual_mesh() const
Build the dual mesh of the domain for post-processing of face fields.
void construire_face_virt_pe_num()
Remplissage du tableau face_virt_pe_num_ (voir commentaire dans Domaine_VF.
IntTab & elem_faces()
renvoie le tableau de connectivite element/faces
virtual void typer_elem(Domaine &)
virtual void get_position(DoubleTab &positions) const
int numero_face_local(int face, int elem) const
int nb_som_face() const
renvoie le nombre de sommets par face.
DoubleTab normalized_boundaries_outward_vector(int global_face_number, double scale_factor) const
Compute the normalized boundary outward vector associated to the face global_face_number and eventual...
virtual const IntVect & orientation() const
const IntTab & face_virt_pe_num() const
double xp(int num_elem, int k) const
virtual void renumber_faces(Faces &les_faces, IntTab &sort_key)
Re-index faces according to the new order given by 'sort_key'.
virtual void remplir_face_voisins_fictifs(const Domaine_Cl_dis_base &)
void construire_num_fac_loc()
MD_Vector md_vector_faces_front_
DoubleTab calculer_xgr() const
calcul le tableau xgr pour le calcul des moments des forces aux bords :
int premiere_face_int() const
une face est interne ssi elle separe deux elements.
int nb_faces_bord() const
renvoie le nombre de faces sur lesquelles sont appliquees les conditions limites :
virtual void compute_average_porosity(const DoubleVect &val_source, const DoubleVect &porosity, double &sum, double &volume, const bool basis_function, const int order) const
const MD_Vector & md_vector_faces_bord() const
virtual void compute_average(const DoubleVect &val_source, double &sum, double &volume, const bool basis_function, const int order) const
virtual double dist_face_elem0(int, int) const
DoubleVect & inverse_volumes()
virtual DoubleTab & face_normales()
virtual void get_nb_integ_points(IntTab &nelem) const
void typer_discretiser_ss_domaine(int i) override
IntTab & face_voisins() override
renvoie le tableaux des volumes des connectivites face elements cf au dessus.
void marquer_faces_double_contrib(const Conds_lim &)
const Nom & le_nom() const override
Donne le nom de l'Objet_U Methode a surcharger : renvoie "neant" dans cette implementation.
classe Domaine_dis_base Cette classe est la base de la hierarchie des domaines discretisees.
int dist_paroi_initialisee_
virtual void discretiser()
const Domaine & domaine() const
TRUST_Vector< OWN_PTR(Sous_domaine_dis_base)> les_sous_domaines_dis_
Class defining operators and methods for all reading operation in an input flow (file,...
void typer(const Motcle &)
Type les faces.
void associer_domaine(const Domaine_t &z)
IntTab_t & voisins()
Renvoie le tableau des voisins (des faces).
void calculer_surfaces(DoubleVect_t &surf) const
Calcule la surface des faces.
void calculer_centres_gravite(DoubleTab_t &xv) const
Calcule les centres de gravite de chaque face.
int_t voisin(int_t, int) const
Renvoie le numero du i-ieme voisin de face.
const IntTab_t & les_sommets() const
Renvoie le tableau des sommets de toutes les faces.
void creer_faces_reeles(Domaine_t &domaine, const Static_Int_Lists_t &connect_som_elem, Faces_t &les_faces, IntTab_t &elem_faces)
A partir de la description des elements du domaine et des frontieres (bords, raccords,...
int num_premiere_face() const
int num_face(const int) const
int_t num_premiere_face() const
void fixer_num_premiere_face(int_t i)
int_t nb_faces() const
Renvoie le nombre de faces de la frontiere.
const Faces_t & faces() const
void renumerote(ArrOfInt_t &reverse_index)
const Joint_Items_t & joint_item(JOINT_ITEM type) const
Renvoie les informations de joint pour le type demande.
Joint_Items_t & set_joint_item(JOINT_ITEM type)
Renvoie les informations de joint pour un type d'item geometrique donne, pour remplissage des structu...
const IntTab_t & renum_items_communs() const
Voir renum_items_communs_.
ArrOfInt_t & set_items_communs()
Renvoie le tableau items_communs_ pour le remplir.
virtual trustIdType nb_items_seq_tot() const
: Cette classe est un OWN_PTR mais l'objet pointe est partage entre plusieurs
classe Navier Condition aux limites sur la vitesse de type "Navier" :
const Nom & que_suis_je() const
renvoie la chaine identifiant la classe.
virtual Entree & readOn(Entree &)
Lecture d'un Objet_U sur un flot d'entree Methode a surcharger.
static double precision_geom
virtual const Nom & le_nom() const
Donne le nom de l'Objet_U Methode a surcharger : renvoie "neant" dans cette implementation.
virtual Sortie & printOn(Sortie &) const
Ecriture de l'objet sur un flot de sortie Methode a surcharger.
classe Periodique Cette classe represente une condition aux limites periodique.
int face_associee(int i) const
static int check_int_overflow(trustIdType)
static double mp_max(double)
static Sortie & Journal(int message_level=0)
Renvoie un objet statique de type Sortie qui sert de journal d'evenements.
static int nproc()
renvoie le nombre de processeurs dans le groupe courant Voir Comm_Group::nproc() et PE_Groups::curren...
static double mp_sum(double)
Calcule la somme de x sur tous les processeurs du groupe courant.
static int me()
renvoie mon rang dans le groupe de communication courant.
static void exit(int exit_code=-1)
Routine de sortie de TRUST dans une region Kokkos.
int nb_raccords() const
Renvoie le nombre de raccords contenus dans la liste.
static void construire_espace_virtuel_traduction(const MD_Vector &md_indice, const MD_Vector &md_valeur, IntTab &tableau, const int error_is_fatal=1)
Construit la structure items_communs + espaces virtuels d'un tableau contenant des indices d'items ge...
static void calculer_renum_items_communs(Joints &joints, const JOINT_ITEM type_item)
On suppose que chaque joint[i].joint_item(type_item).items_communs() contient les indices locaux des ...
static void construire_md_vector(const Domaine &, int nb_items_reels, const JOINT_ITEM, MD_Vector &)
construction d'un MD_Vector_std a partir des informations de joint du domaine pour le type d'item dem...
static void calculer_espace_distant_faces(Domaine &domaine, const int nb_faces_reelles, const IntTab &elem_faces)
Idem que Scatter::calculer_espace_distant_sommets pour les faces.
Classe de base des flux de sortie.
classe Symetrie Sur les faces de symetrie on a les proprietes suivantes:
_SIZE_ size_array() const
virtual void ref(const TRUSTTab &)
std::enable_if_t< is_default_exec_space< EXEC_SPACE >, View< _TYPE_, _SHAPE_ > > view_wo()
int dimension_int(int d) const
void resize(_SIZE_ n, RESIZE_OPTIONS opt=RESIZE_OPTIONS::COPY_INIT)
std::enable_if_t< is_default_exec_space< EXEC_SPACE >, ConstView< _TYPE_, _SHAPE_ > > view_ro() const
_SIZE_ dimension(int d) const
virtual const MD_Vector & get_md_vector() const
virtual void echange_espace_virtuel(IsExchangeBlocking exchange_type=IsExchangeBlocking::DefaultBlocking, const std::string kernel_name="noname")
static trustIdType internal_items_size_