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++)
687 const int nb_faces_virt = nf_tot - nf;
691 const int moi =
me();
692 for (i = 0; i < nf; i++)
728 int neighbor_elem=neighbor_faces(global_face_number,0);
729 if( neighbor_elem == -1 )
730 neighbor_elem = neighbor_faces(global_face_number,1);
732 double inner_product=0;
736 double vec_face_elem =
xp(neighbor_elem,i)-
xv(global_face_number,i);
737 inner_product+=vec_face_elem*normal_vector(i);
740 if( inner_product > 0 )
744 normal_vector(i)*=-1;
752 normal_vector(i)*=scale_factor;
755 return normal_vector;
760 Journal() <<
" Domaine_VF::marquer_faces_double_contrib" << finl;
765 for (
auto& itr : conds_lim)
770 for (
int ind_face = 0; ind_face < le_bord.
nb_faces_tot(); ind_face++)
772 int num_face = le_bord.
num_face(ind_face);
776 for (
auto& itr : conds_lim)
784 int nfin = ndeb + frontieredis.
nb_faces();
785 for (
int face=ndeb; face<nfin; face++)
794 for(
int njoint=0; njoint<nbjoints; njoint++)
796 const Joint& joint_temp =
joint(njoint);
798 const int nbfaces = indices_faces_joint.
dimension(0);
799 for (
int j = 0; j < nbfaces; j++)
806 int face_de_joint = indices_faces_joint(j, 1);
814 Cerr <<
"==============================================" << finl;
815 Cerr <<
"The boundary areas of the domain " <<
domaine().
le_nom() <<
" are:" << finl;
822 Faces& faces=raccords(i)->faces();
826 for (
int j=0; j<faces.
nb_faces(); j++)
829 raccords(i)->set_aire(s);
830 Cerr<<
"Area of "<<raccords(i)->le_nom()<<
" \t= "<<s<<finl;
835 for (
int i=0; i<bords.
nb_bords(); i++)
837 Faces& faces=bords(i).faces();
841 for (
int j=0; j<faces.
nb_faces(); j++)
844 bords(i).set_aire(s);
845 Cerr<<
"Area of "<<bords(i).le_nom()<<
" \t= "<<s<<finl;
847 Cerr <<
"==============================================" << finl;
855 Cerr<<
"Calculation of elements and nodes on " <<
domaine().
le_nom() <<
" :" << finl;
856 Cerr<<
"Total number of elements = "<<nbelem<<finl;
857 Cerr<<
"Total number of nodes = "<<nbsom<<finl;
858 Cerr<<
"Total number of faces = "<<nbfaces<<finl;
862 trustIdType nb_boundary_faces =
mp_sum(ref_cast(Frontiere,raccords(i).valeur()).
nb_faces());
863 Cerr<< nb_boundary_faces <<
" of them on boundary "<<raccords(i)->le_nom()<<finl;
867 for (
int i=0; i<bords.
nb_bords(); i++)
869 trustIdType nb_boundary_faces =
mp_sum(ref_cast(Frontiere,bords(i)).
nb_faces());
870 Cerr<< nb_boundary_faces <<
" of them on boundary "<<bords(i).le_nom()<<finl;
872 Cerr<<
"=============================================="<<finl;
873 trustIdType internal_item = std::min(nbelem, nbfaces);
874 internal_item = std::min(internal_item, nbsom);
898 Cerr <<
"Domaine_VF::remplir_face_numero_bord" << finl;
903 const int nb_bords = ledomaine.
nb_bords();
904 for (
int n_bord=0; n_bord<nb_bords; n_bord++)
906 const Bord& le_bord = ledomaine.
bord(n_bord);
909 for (
int num_face=ndeb; num_face<nfin; num_face++)
914 for (
int n_racc=0; n_racc<nb_raccords; n_racc++)
916 const Raccord& le_racc = ledomaine.
raccord(n_racc);
917 ndeb = le_racc -> num_premiere_face();
918 nfin = ndeb + le_racc ->
nb_faces();
919 for (
int num_face=ndeb; num_face<nfin; num_face++)
939 const DoubleTab& xgrav =
xv();
943 for (
int num_face=0; num_face <
nb_faces; num_face++)
945 xgr(num_face,i)=xgrav(num_face,i)-c_grav[i];
959 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;
960 Cerr <<
"This option is only available for Quadrangle/Rectangle/Hexaedre types !!! Remove this interpret from your data file." << finl;
965 Cerr <<
"###########################################" << finl;
966 Cerr <<
"@@@@@@@@ Building Structured infos @@@@@@@@" << finl;
967 Cerr <<
"###########################################" << finl;
973 build_mc_Cmesh_nodesCorrespondence();
976 build_mc_Cmesh_correspondence(with_faces);
978 mc_Cmesh_with_faces_corr_ = with_faces;
979 mc_Cmesh_ready_ =
true;
981 Cerr <<
"##################################################" << finl;
982 Cerr <<
"@@@@@@@@ End of Building Structured infos @@@@@@@@" << finl;
983 Cerr <<
"##################################################" << finl;
987 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;
996void Domaine_VF::build_mc_Cmesh()
998 using DAD = MCAuto<DataArrayDouble>;
1000 Cerr <<
"Domaine_VF::build_mc_Cmesh() ... " << finl;
1001 const auto& u_mesh =
domaine().get_mc_mesh();
1002 const auto& coords = u_mesh->getCoords();
1003 trustIdType nb_soms_tmp = coords->getNumberOfTuples(), nb_elems_tmp = u_mesh->getNumberOfCells();
1007 const int mesh_dim = u_mesh->getMeshDimension();
1009 Cerr <<
"Domaine_VF: Creating a MEDCouplingCMesh object for the domaine_VF '" <<
que_suis_je() <<
"' & the domaine '" <<
domaine().
le_nom() <<
"' ..." << finl;
1010 mc_Cmesh_ = MEDCouplingCMesh::New(
"TRUST_CMesh");
1013 DAD coo[3], uniq[3];
1014 for (
unsigned d=0; d < (unsigned)mesh_dim; d++)
1016 coo[d] = coords->keepSelectedComponents({d});
1017 uniq[d] = coo[d]->getDifferentValues(eps);
1018 std::sort(uniq[d]->rwBegin(), uniq[d]->rwEnd());
1020 mc_Cmesh_x_coords_.resize(uniq[0]->getNumberOfTuples());
1021 std::copy(uniq[0]->begin(), uniq[0]->end(),mc_Cmesh_x_coords_.begin());
1022 mc_Cmesh_y_coords_.resize(uniq[1]->getNumberOfTuples());
1023 std::copy(uniq[1]->begin(), uniq[1]->end(),mc_Cmesh_y_coords_.begin());
1026 mc_Cmesh_z_coords_.resize(uniq[2]->getNumberOfTuples());
1027 std::copy(uniq[2]->begin(), uniq[2]->end(),mc_Cmesh_z_coords_.begin());
1030 const int nx = (int)mc_Cmesh_x_coords_.size(), ny = (int)mc_Cmesh_y_coords_.size();
1031 const int nz = (mesh_dim > 2) ? (
int)mc_Cmesh_z_coords_.size() : 1;
1033 const int nb_som_cart = nx * ny * nz;
1034 const int nb_elem_cart = (mesh_dim > 2) ? (nx - 1) * (ny - 1) * (nz - 1) : (nx - 1) * (ny - 1);
1036 if (nb_som_cart != nb_soms || nb_elem_cart != nb_elems)
1038 Cerr <<
"Issue in converting the TRUST mesh to MEDCouplingCMesh ... It seems that the mesh is not an IJK-like mesh !!!" << finl;
1039 Cerr <<
"Nb soms : " << nb_soms <<
" for TRUST mesh vs " << nb_som_cart <<
" for the MEDCouplingCMesh" << finl;
1040 Cerr <<
"Nb elems : " << nb_elems <<
" for TRUST mesh vs " << nb_elem_cart <<
" for the MEDCouplingCMesh" << finl;
1044 Cerr <<
"Structured mesh dimensions (nodes) : " << nx <<
" x " << ny;
1045 if (mesh_dim > 2) Cerr <<
" x " << nz;
1049 mc_Cmesh_->setCoords(uniq[0], uniq[1], uniq[2]);
1051 mc_Cmesh_->setCoords(uniq[0], uniq[1]);
1053 Cerr <<
"Domaine_VF::build_mc_Cmesh() ... OK !" << finl;
1059void Domaine_VF::build_mc_Cmesh_correspondence(
bool withFace)
1061 using DAI = MCAuto<DataArrayIdType>;
1062 using DAD = MCAuto<DataArrayDouble>;
1064 Cerr <<
"Domaine_VF::build_mc_Cmesh_correspondence() building elem (and potentially face) correspondence ... " << finl;
1068 MCAuto<MEDCouplingUMesh> mc_unstr = mc_Cmesh_->buildUnstructured();
1069 const MEDCouplingUMesh * mc_mesh =
domaine().get_mc_mesh();
1072 mc_unstr->setCoords(mc_mesh->getCoords());
1073 DAI renumb(DataArrayIdType::New());
1074 mcIdType n_nod = mc_unstr->getCoords()->getNumberOfTuples();
1075 renumb->alloc(n_nod);
1076 std::copy(mc_Cmesh_nodesCorrespondence_.data(),mc_Cmesh_nodesCorrespondence_.data()+n_nod, renumb->rwBegin());
1078 mc_unstr->renumberNodesInConn(renumb->begin());
1081 DataArrayIdType * mP;
1082 mc_unstr->areCellsIncludedIn(mc_mesh, 2, mP);
1085 DAI outliers = mP->findIdsNotInRange(0, mc_unstr->getNumberOfCells());
1086 if (outliers->getNumberOfTuples() != 0)
1087 Process::exit(
"ERROR: Issue in converting the TRUST mesh to MEDCouplingCMesh ... It seems that the mesh is not an IJK-like mesh!!!");
1089 mc_Cmesh_elemCorrespondence_.resize(mP->getNumberOfTuples());
1090 std::copy(mP->begin(), mP->end(), mc_Cmesh_elemCorrespondence_.data());
1100 int mesh_dim = mc_unstr->getMeshDimension();
1103 DAI desc(DataArrayIdType::New()), descIndx(DataArrayIdType::New()), revDesc(DataArrayIdType::New()), revDescIndx(DataArrayIdType::New());
1104 MCAuto<MEDCouplingUMesh> mc_unstr_fac(mc_unstr->buildDescendingConnectivity(desc, descIndx, revDesc, revDescIndx));
1105 mcIdType nb_fac = mc_unstr_fac->getNumberOfCells();
1107 DataArrayIdType * mapFac;
1108 mc_unstr_fac->areCellsIncludedIn(mc_face_mesh_, 2, mapFac);
1110 DAD faceBary = mc_face_mesh_->computeCellCenterOfMass();
1111 const double * faceBaryP = faceBary->getConstPointer();
1112 DAI permu(DataArrayIdType::New());
1113 permu->alloc(nb_fac);
1116 auto comp_func_2d = [&](
const int& i1,
const int& i2) ->
bool
1118 std::array<double, 2> tup1 = { faceBaryP[i1*2+1], faceBaryP[i1*2+0] };
1119 std::array<double, 2> tup2 = { faceBaryP[i2*2+1], faceBaryP[i2*2+0] };
1123 auto comp_func_3d = [&](
const int& i1,
const int& i2) ->
bool
1125 std::array<double, 3> tup1 = { faceBaryP[i1*3+2], faceBaryP[i1*3+1], faceBaryP[i1*3+0] };
1126 std::array<double, 3> tup2 = { faceBaryP[i2*3+2], faceBaryP[i2*3+1], faceBaryP[i2*3+0] };
1131 std::sort(permu->rwBegin(), permu->rwEnd(), comp_func_2d);
1133 std::sort(permu->rwBegin(), permu->rwEnd(), comp_func_3d);
1134 for (mcIdType pp: *permu)
1136 int p =
static_cast<int>(pp);
1138 if (ori == 0) mc_Cmesh_facesXCorrespondence_.push_back(p);
1139 if (ori == 1) mc_Cmesh_facesYCorrespondence_.push_back(p);
1140 if (mesh_dim > 2 && ori == 2) mc_Cmesh_facesZCorrespondence_.push_back(p);
1143 Cerr <<
" - Built mc_Cmesh_facesXCorrespondence_ with size " << (int)mc_Cmesh_facesXCorrespondence_.size() << finl;
1144 Cerr <<
" - Built mc_Cmesh_facesYCorrespondence_ with size " << (int)mc_Cmesh_facesYCorrespondence_.size() << finl;
1146 Cerr <<
" - Built mc_Cmesh_facesZCorrespondence_ with size " << (int)mc_Cmesh_facesZCorrespondence_.size() << finl;
1148 Cerr <<
"Domaine_VF::build_mc_Cmesh_correspondence() - done!" << finl;
1153static int findCartIndex(
const std::vector<double>& vect,
const double value)
1155 if (value < vect.front() || value > vect.back())
1158 auto it = std::lower_bound(vect.begin(), vect.end(), value);
1160 if (it == vect.end())
1163 int index =
static_cast<int>(std::distance(vect.begin(), it));
1165 if (index > 0 && value < vect[index])
1173void Domaine_VF::build_mc_Cmesh_nodesCorrespondence()
1175 Cerr <<
"Domaine_VF::build_mc_Cmesh_nodesCorrespondence() ... " << finl;
1176 const auto& u_mesh =
domaine().get_mc_mesh();
1177 const double* coordsP = u_mesh->getCoords()->getConstPointer();
1178 const int space_dim =
static_cast<int>(u_mesh->getCoords()->getNumberOfComponents());
1179 const int nb_soms =
static_cast<int>(u_mesh->getNumberOfNodes());
1180 const int mesh_dim = u_mesh->getMeshDimension();
1181 const int nx = (int)mc_Cmesh_x_coords_.size(), ny = (int)mc_Cmesh_y_coords_.size();
1183 mc_Cmesh_nodesCorrespondence_.resize(nb_soms, -1);
1185 for (
int node = 0; node < nb_soms; ++node)
1187 int i = findCartIndex(mc_Cmesh_x_coords_, coordsP[node*space_dim + 0]);
1188 int j = findCartIndex(mc_Cmesh_y_coords_, coordsP[node*space_dim + 1]);
1189 int k = (mesh_dim > 2) ? findCartIndex(mc_Cmesh_z_coords_, coordsP[node*space_dim + 2]) : 0;
1191 if (i == -1 || j == -1 || (mesh_dim > 2 && k == -1))
1193 Cerr <<
"Node " << node <<
" not contained in the structured mesh !!!" << finl;
1197 const int ijk_idx = i + nx * (j + ny * k);
1198 mc_Cmesh_nodesCorrespondence_[ijk_idx] = node;
1201 Cerr <<
"Domaine_VF::build_mc_Cmesh_nodesCorrespondence() ... OK !" << finl;
1209 CDoubleTabView
xp =
xp_.view_ro();
1210 DoubleTabView positions_v = positions.
view_wo();
1211 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)
1213 positions_v(i,j) =
xp(i,j);
1215 end_gpu_timer(__KERNEL_NAME__);
1224 for (
int i=0; i<ne; i++)
1226 sum+=std::fabs(val_source(i))*
volumes(i);
1235 for (
int i=0; i<ne; i++)
1237 sum+=val_source(i)*val_source(i)*
volumes(i);
1245 CDoubleArrView vol =
volumes().view_ro();
1246 CDoubleArrView val = val_source.view_ro();
1247 Kokkos::parallel_reduce(start_gpu_timer(__KERNEL_NAME__), ne, KOKKOS_LAMBDA(
const int i,
double & sum_tmp,
double & volume_tmp)
1250 sum_tmp += val(i) * v;
1253 end_gpu_timer(__KERNEL_NAME__);
1259 CDoubleArrView vol =
volumes().view_ro();
1260 CDoubleArrView poro = porosity.view_ro();
1261 CDoubleArrView val = val_source.view_ro();
1262 Kokkos::parallel_reduce(start_gpu_timer(__KERNEL_NAME__), ne, KOKKOS_LAMBDA(
const int i,
double & sum_tmp,
double & volume_tmp)
1266 sum_tmp += val(i) * v * p;
1267 volume_tmp += v * p;
1269 end_gpu_timer(__KERNEL_NAME__);
1274 Process::exit(
"The function should not be used in domaine_VF, related to quadrature points (DG discretization)");
1280 Process::exit(
"The function should not be used in domaine_VF, related to quadrature points (DG discretization)");
1286 Process::exit(
"The function should not be used in domaine_VF, related to quadrature points (DG discretization)");
1291#ifdef TRUST_USE_ARBORX
1295 template <
typename Query,
typename Value,
typename Output>
1296 KOKKOS_FUNCTION
void operator()(Query
const&, Value
const& value, Output
const& out)
const
1308 Cerr <<
"Domaine_VF::init_dist_paroi_globale..." << finl;
1328 DoubleTabs remote_xv(parts);
1331 int nb_faces_bord_ = 0;
1334 for (
auto& itr : conds_lim)
1338 int num_face_1_cl = itr->frontiere_dis().frontiere().num_premiere_face();
1339 int nb_faces_cl = itr->frontiere_dis().frontiere().nb_faces();
1341 nb_faces_bord_ += itr->frontiere_dis().frontiere().nb_faces();
1343 for (
int f=num_face_1_cl ; f < nb_faces_cl+num_face_1_cl ; f++)
1346 while ( (nb_som_loc <
nb_som_face()) && (f_s(f, nb_som_loc) != -1))
1348 soms.insert(f_s(f, nb_som_loc));
1351 nb_aretes += (D == 3 ? nb_som_loc : 0) ;
1356 Process::exit(
que_suis_je() +
" : at least one boundary must be solid for the distance to the edge to be calculated !!!");
1358 remote_xv[moi].
resize(nb_faces_bord_ + (
int)soms.size() + nb_aretes,D);
1359 int index[5] = { -1, -1, -1, -1, -1 };
1371 for (
int ind_cl = 0 ; ind_cl < conds_lim.size() ; ind_cl++)
1374 int num_face_1_cl = conds_lim[ind_cl]->frontiere_dis().frontiere().num_premiere_face();
1375 int nb_faces_cl = conds_lim[ind_cl]->frontiere_dis().frontiere().nb_faces();
1377 for (
int f=num_face_1_cl ; f < nb_faces_cl+num_face_1_cl ; f++)
1379 for (
int d=0 ; d<D ; d++)
1380 remote_xv[moi](ind_tab,d) = domaine_.
xv(f, d);
1387 for (
int id_som=1; id_som<=
nb_som_face(); id_som++)
1389 for (
int d = 0; d < D; d++)
1390 remote_xv[moi](ind_tab, d) =
1391 (xs(f_s(f, index[id_som]), d) + xs(f_s(f, index[id_som - 1]), d)) / 2;
1398 while ((id_som <
nb_som_face()) && (f_s(f, id_som) != -1))
1400 for (
int d = 0; d < D; d++)
1401 remote_xv[moi](ind_tab, d) = (xs(f_s(f, id_som), d) + xs(f_s(f, id_som - 1), d)) / 2;
1405 for (
int d = 0; d < D; d++)
1406 remote_xv[moi](ind_tab, d) = (xs(f_s(f, 0), d) + xs(f_s(f, id_som - 1), d)) / 2;
1415 for (
int d=0 ; d<D ; d++)
1416 remote_xv[moi](ind_tab,d) = xs(som, d);
1423 Cerr <<
"[MPI] Broadcasting remote_xv..." << finl;
1424 for (
int p = 0; p < parts; p++)
1425 envoyer_broadcast(remote_xv[p], p);
1427 int nb_total_points=0;
1428 for (
int p = 0; p < parts; p++)
1429 nb_total_points+=remote_xv[p].
dimension(0);
1431 Cerr <<
"Number of boundary points: " << nb_total_points << finl;
1432 double GBytes = nb_total_points * 4.0 * D / 1024.0 / 1024.0 / 1024.0;
1433 Cerr <<
"Estimated memory needed: " << GBytes <<
" GB" << finl;
1438 const DoubleTab& local_xv = domaine_.
xv();
1439 const DoubleTab& local_xp = domaine_.
xp();
1441#ifdef TRUST_USE_ARBORX
1444 using ExecutionSpace = Kokkos::DefaultExecutionSpace;
1445 using MemorySpace = ExecutionSpace::memory_space;
1446 using Point = ArborX::Point<3>;
1447 ExecutionSpace space;
1448 Kokkos::View<Point *, MemorySpace> query_points(
"local_xs", nf + ne);
1450 Kokkos::parallel_for(start_gpu_timer(__KERNEL_NAME__), nf, KOKKOS_LAMBDA(
1453 query_points[i] = {(float)
xv(i, 0), (float)
xv(i, 1), dim == 3 ? (float)
xv(i, 2) : 0.f};
1455 end_gpu_timer(__KERNEL_NAME__);
1457 Kokkos::parallel_for(start_gpu_timer(__KERNEL_NAME__), ne, KOKKOS_LAMBDA(
1460 query_points[nf + i] = {(float)
xp(i, 0), (float)
xp(i, 1), dim == 3 ? (float)
xp(i, 2) : 0.f};
1462 end_gpu_timer(__KERNEL_NAME__);
1464 ArrOfDouble distances(nf+ne);
1465 distances=DMAXFLOAT;
1467 double target_GB = 1.0;
1468 int num_batches = std::max(1, (
int)std::ceil(GBytes / target_GB));
1469 int batch_size = std::max(1, (parts + num_batches - 1) / num_batches);
1470 Cerr <<
"Number of batches: " << num_batches <<
", parts per batch: " << batch_size
1471 <<
", points per batch: ~" << nb_total_points / num_batches << finl;
1472 for (
int batch_start = 0; batch_start < parts; batch_start += batch_size)
1474 int batch_end = std::min(batch_start + batch_size, parts);
1478 for (
int part = batch_start; part < batch_end; part++)
1479 nb_points += remote_xv[part].
dimension(0);
1480 if (nb_points == 0)
continue;
1483 Kokkos::View<Point *, MemorySpace> points(
"remote_xv", nb_points);
1484 int point_offset = 0;
1485 for (
int part = batch_start; part < batch_end; part++)
1487 int size = remote_xv[part].
dimension(0);
1490 CDoubleTabView coord = remote_xv[part].view_ro();
1491 int local_offset = point_offset;
1492 Kokkos::parallel_for(start_gpu_timer(__KERNEL_NAME__), size, KOKKOS_LAMBDA(
const int i)
1494 points[local_offset + i] = {(float) coord(i, 0), (float) coord(i, 1),
1495 dim == 3 ? (float) coord(i, 2) : 0.f
1498 end_gpu_timer(__KERNEL_NAME__);
1500 point_offset += size;
1504 Cerr <<
"ArborX::BoundingVolumeHierarchy for parts " << batch_start <<
" to " << batch_end - 1;
1505 ArborX::BoundingVolumeHierarchy bvh(space, ArborX::Experimental::attach_indices(points));
1506 Cerr <<
" created!" << finl;
1507 Kokkos::View<int *, MemorySpace> offsets(
"Example::offsets", 0);
1508 Kokkos::View<int *, MemorySpace> indices(
"Example::indices", 0);
1509 Cerr <<
"ArborX query...";
1510 bvh.query(space, ArborX::Experimental::make_nearest(query_points, 1), ExtractIndex {}, indices, offsets);
1511 Cerr <<
" completed!" << finl;
1513 int global_offset = 0;
1514 for (
int pp = 0; pp < batch_start; pp++)
1515 global_offset += remote_xv[pp].
dimension(0);
1519 DoubleArrView dist =
static_cast<ArrOfDouble&
>(distances).view_rw();
1520 IntArrView glob =
static_cast<ArrOfInt&
>(glob_idx).view_rw();
1521 int total_fe = nf + ne;
1522 Kokkos::parallel_for(start_gpu_timer(__KERNEL_NAME__), total_fe, KOKKOS_LAMBDA(
const int fe)
1524 int ar = indices(fe);
1526 for (
int i = 0; i < dim; i++)
1528 float diff = query_points(fe)[i] - points(ar)[i];
1533 dist(fe) = (double)d;
1534 glob(fe) = ar + global_offset;
1537 end_gpu_timer(__KERNEL_NAME__);
1542 MCAuto <DataArrayIdType> glob(DataArrayIdType::New());
1544 std::vector<MCAuto<DataArrayDouble> > vxv(parts);
1545 std::vector<const DataArrayDouble*> cvxv(parts);
1546 MCAuto<DataArrayDouble> remote_xvs(DataArrayDouble::New());
1547 for (
int p = 0; p < parts; p++)
1549 vxv[p] = DataArrayDouble::New();
1550 vxv[p]->useExternalArrayWithRWAccess(remote_xv[p].addr(), remote_xv[p].
dimension(0), remote_xv[p].
dimension(1));
1553 remote_xvs = DataArrayDouble::Aggregate(cvxv);
1554 MCAuto<DataArrayDouble> local_xs(DataArrayDouble::New());
1555 local_xs->alloc(nf+ne, D);
1556 for (
int f = 0; f < nf; f++)
1557 for (
int d = 0; d < D; d++)
1558 local_xs->setIJ(f, d, local_xv(f, d));
1559 for (
int e = 0; e < ne; e++)
1560 for (
int d = 0; d < D; d++)
1561 local_xs->setIJ(nf+e, d, local_xp(e, d));
1562 glob = remote_xvs->findClosestTupleId(local_xs);
1563 for (
int i=0; i<nf+ne; i++)
1564 glob_idx(i) = (int)glob->getIJ(i,0);
1567 ToDo_Kokkos(
"critical");
1569 for (
int fe = 0; fe<nf+ne; fe++)
1573 int fe2 = glob_idx(fe);
1574 while (fe2 >= remote_xv[proc].
dimension(0))
1579 double distance2 = 0;
1580 for (
int d=0; d<D; d++)
1583 if (fe<nf) x1=local_xv(fe,d);
1584 else if (fe<nf+ne) x1=local_xp(fe-nf,d);
1585 else { Cerr<<
"Domaine_VF::init_dist_paroi_globale : problem in the ditance to the edge calculation. Contact TRUST support."<<finl;
Process::exit();}
1586 double x2=remote_xv[proc](fe2,d);
1587 distance2 += (x1-x2)*(x1-x2);
1591 y_faces_(fe) = std::sqrt(distance2);
1593 for (
int d = 0 ; d<D ; d++)
1598 y_elem_(fe-nf) = std::sqrt(distance2);
1599 for (
int d = 0 ; d<D ; d++)
1600 n_y_elem_(fe-nf, d) = ( local_xp(fe-nf,d)-remote_xv[proc](fe2,d) )/
y_elem_(fe-nf);
1605 for (
int ind_cl = 0 ; ind_cl < conds_lim.size() ; ind_cl++)
1608 int num_face_1_cl = conds_lim[ind_cl]->frontiere_dis().frontiere().num_premiere_face();
1609 int nb_faces_cl = conds_lim[ind_cl]->frontiere_dis().frontiere().nb_faces();
1611 for (
int f=num_face_1_cl ; f < nb_faces_cl+num_face_1_cl ; f++)
1615 if ( dist_ef_loc <
y_elem_(ind) )
1618 for (
int d = 0 ; d < D ; d++)
1621 for (
int d = 0 ; d<D ; d++)
1629 y_elem_.echange_espace_virtuel();
1631 Cerr <<
"Initialize the y table " << domaine_.
domaine().
le_nom() << finl;
1645 using MEDCoupling::DataArrayIdType;
1646 using MEDCoupling::DataArrayDouble;
1648 using DAId = MCAuto<DataArrayIdType>;
1650 const MEDCouplingUMesh* mc_mesh =
domaine().get_mc_mesh();
1653 DAId desc(DataArrayIdType::New()), descIndx(DataArrayIdType::New()), revDesc(DataArrayIdType::New()), revDescIndx(DataArrayIdType::New());
1654 mc_face_mesh_ = mc_mesh->buildDescendingConnectivity(desc, descIndx, revDesc, revDescIndx);
1658 MCAuto<MEDCouplingUMesh> faces_tmp = mc_face_mesh_->deepCopyConnectivityOnly();
1660 int nb_fac = faces_sommets.
dimension(0);
1662 assert((
int)mc_face_mesh_->getNumberOfCells() == nb_fac);
1663 DAId c(DataArrayIdType::New()), cI(DataArrayIdType::New());
1665 cI->alloc(nb_fac+1, 1);
1666 mcIdType *cIP = cI->getPointer();
1668 mcIdType typ =
Objet_U::dimension == 3 ? INTERP_KERNEL::NormalizedCellType::NORM_POLYGON : INTERP_KERNEL::NormalizedCellType::NORM_SEG2;
1670 for (
int fac=0; fac<nb_fac; fac++)
1672 c->pushBackSilent(typ);
1674 for (; i < max_som_fac && (s = faces_sommets(fac, i)) >= 0; i++)
1675 c->pushBackSilent(s);
1676 cIP[fac+1] = cIP[fac] + i + 1;
1678 faces_tmp->setConnectivity(c, cI);
1681 DataArrayIdType * mP;
1682 mc_face_mesh_->areCellsIncludedIn(faces_tmp,2, mP);
1684 DAId renum2(mP->invertArrayN2O2O2N(nb_fac));
1687 DAId outliers = renum2->findIdsNotInRange(0, nb_fac);
1688 if (outliers->getNumberOfTuples() != 0)
1689 Process::exit(
"Invalid renumbering arrays! Should not happen. Some faces could not be matched between the TRUST face domain and the buildDescendingConnectivity() version.");
1698 mc_face_mesh_->renumberCells(renum2->begin(), check);
1700 mc_face_mesh_->checkConsistency();
1704 mc_face_mesh_ready_ =
true;
1720 using DAId = MCAuto<DataArrayIdType>;
1721 using DAD = MCAuto<DataArrayDouble>;
1723 const MEDCouplingUMesh* mc_face_mesh = get_mc_face_mesh();
1726 Cerr <<
" Domaine: Creating **dual** mesh as a MEDCouplingUMesh object for the domain '" <<
le_nom() <<
"'" << finl;
1732 const mcIdType *fc = mc_face_mesh->getNodalConnectivity()->getConstPointer(),
1733 *fcI= mc_face_mesh->getNodalConnectivityIndex()->getConstPointer();
1738 DAId c(DataArrayIdType::New()), cI(DataArrayIdType::New());
1739 cI->alloc(nb_fac*2, 1);
1741 mcIdType *cIP = cI->getPointer();
1745 auto corrige_voisins_dual_perio = [&](
int f,
int &e1,
int &e2)
1748 auto d2 = [&](
int e) ->
double
1751 for (
int d = 0; d < dim; d++)
1753 double dx =
xp_(e, d) -
xv_(f, d);
1759 if (e1 >= 0 && e2 >= 0)
1762 if (d2(e1) <= d2(e2)) e2 = -1;
1769 for(
int f=0; f<nb_fac; f++)
1775 corrige_voisins_dual_perio(f, e1, e2);
1777 for (
int e: {e1, e2})
1779 if (e==-1 || e >=
nb_elem)
continue;
1784 mcIdType nb_pts = fcI[f+1]-fcI[f]-1;
1798 mcIdType *cP = c->getPointer();
1801 for(
int f=0; f<nb_fac; f++)
1807 corrige_voisins_dual_perio(f, e1, e2);
1809 for (
int e: {e1, e2})
1811 if (e==-1 || e >=
nb_elem)
continue;
1814 cP[c_sz++] = INTERP_KERNEL::NormalizedCellType::NORM_TRI3;
1816 const mcIdType *p = fc + fcI[f] + 1;
1818 cP[c_sz++] = *(p+1);
1819 cP[c_sz++] = e+nb_coo;
1823 mcIdType nb_pts = fcI[f+1]-fcI[f]-1;
1824 cP[c_sz++] = INTERP_KERNEL::NormalizedCellType::NORM_POLYHED;
1827 for(
const mcIdType *p = fc + fcI[f] + 1; p < fc+fcI[f + 1]; p++)
1831 const mcIdType *p2 = fc + fcI[f] + 1;
1832 for (mcIdType i = 0; i<nb_pts; i++)
1835 cP[c_sz++] = e+nb_coo;
1836 cP[c_sz++] = *(p2+i);
1837 cP[c_sz++] = *(p2+(i+1)%nb_pts);
1845 assert(c_sz == totSz);
1851 DAD coo2 = mc_face_mesh->getCoords()->deepCopy();
1852 coo2->reAlloc(nb_coo+
nb_elem);
1853 std::copy(
xp_.addr(),
xp_.addr() +
nb_elem*dim, coo2->getPointer()+nb_coo*dim);
1855 const std::string dual_nam =
domaine().get_mc_mesh()->getName() +
"_dual";
1856 mc_dual_mesh_ = MEDCouplingUMesh::New(dual_nam, dim);
1857 mc_dual_mesh_->setCoords(coo2);
1858 mc_dual_mesh_->setConnectivity(c,cI);
1859 mc_dual_mesh_ready_ =
true;
1868 MCAuto<MEDCouplingUMesh> skin_dual = mc_dual_mesh_->computeSkin();
1869 mcIdType nb_faces_bd = skin_dual->getNumberOfCells();
1872 Process::exit(
"Something wrong with dual mesh computation #1 -- boundary faces !!!! \n");
1876 DAId desc(DataArrayIdType::New()), descIndx(DataArrayIdType::New()), revDesc(DataArrayIdType::New()), revDescIndx(DataArrayIdType::New());
1877 mc_dual_mesh_->buildDescendingConnectivity(desc, descIndx, revDesc, revDescIndx);
1879 DAId dsi = descIndx->deltaShiftIndex();
1880 DAId res = dsi->findIdsLowerOrEqualTo(3) ;
1881 if (res->getNumberOfTuples() > 0)
1882 Process::exit(
"Something wrong with dual mesh computation #2 -- polyhedron faces !!!! \n");
Empty class used as a base for all the arrays.
class Cond_lim_base Base class for the hierarchy of classes that represent the different boundary con...
virtual Frontiere_dis_base & frontiere_dis()
Returns the discretized boundary to which the boundary conditions apply.
class Conds_lim This class represents a vector of boundary conditions.
Classe Dirichlet_homogene This class is the base class of the hierarchy of homogeneous Dirichlet-type...
Classe Dirichlet_loi_paroi Base class for imposed values in a boundary condition of the turbulence eq...
Dirichlet_paroi_defilante Imposes the wall velocity in an equation of type Navier_Stokes.
void calculer_mon_centre_de_gravite(ArrOfDouble &c)
Computes the center of gravity of the domain.
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
Creates a parallel array of values at elements.
void creer_mes_domaines_frontieres(const Domaine_VF &domaine_vf)
Raccord_t & raccord(int i)
void calculer_centres_gravite(DoubleTab_t &xp) const
Calculates the centers of gravity of the domain elements.
int_t nb_faces_frontiere() const
Returns the number of boundary faces of the domain (sum of boundaries, connections,...
virtual void calculer_volumes(DoubleVect_t &volumes, DoubleVect_t &inv_volumes) const
Computes the volumes of the domain elements.
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
Returns the total number of vertices of the domain i.e. the number of real and virtual vertices on th...
int_t nb_som() const
Returns the number of vertices of the domain.
int nb_groupes_faces() const
Groupes_Faces_t & groupes_faces()
class Domaine_Cl_dis_base Domaine_Cl_dis_base objects represent discretized boundary conditions
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
Returns the total number of 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
Returns the face/vertex connectivity array.
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
Method inspired by Raccord_distant_homogene::initialise.
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
Returns the total number of faces.
virtual Faces * creer_faces()
Returns new(Faces)! It is overridden by Domaine_VDF for example.
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
Generates the faces and builds the boundaries.
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()
Fills in the face_virt_pe_num_ array (see comment in Domaine_VF.h).
IntTab & elem_faces()
Returns the element/face connectivity array.
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
Returns the number of vertices per 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
Computes the xgr array for the computation of moments of forces at boundaries.
int premiere_face_int() const
A face is internal if and only if it separates two elements.
int nb_faces_bord() const
Returns the number of faces on which boundary conditions are applied:
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
Returns the face-element connectivity array; see above.
void marquer_faces_double_contrib(const Conds_lim &)
const Nom & le_nom() const override
Returns the name of the Objet_U. Virtual method to override: returns "neant" in this implementation.
class Domaine_dis_base This class is the base of the hierarchy of discretized domains.
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 &)
Sets the type of the faces.
void associer_domaine(const Domaine_t &z)
IntTab_t & voisins()
Returns the array of neighbors (of the faces).
void calculer_surfaces(DoubleVect_t &surf) const
Computes the surface area of the faces.
void calculer_centres_gravite(DoubleTab_t &xv) const
Computes the centers of gravity of each face.
int_t voisin(int_t, int) const
Returns the number of the i-th neighbor of face.
const IntTab_t & les_sommets() const
Returns the array of vertices of all faces.
void creer_faces_reeles(Domaine_t &domaine, const Static_Int_Lists_t &connect_som_elem, Faces_t &les_faces, IntTab_t &elem_faces)
From the description of the domain elements and boundaries (borders, connections, face groups,...
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
Returns the number of faces of the boundary.
const Faces_t & faces() const
void renumerote(ArrOfInt_t &reverse_index)
const Joint_Items_t & joint_item(JOINT_ITEM type) const
Returns the joint information for the requested type (read-only).
Joint_Items_t & set_joint_item(JOINT_ITEM type)
Returns the joint information for a given geometric item type, for filling the structures.
const IntTab_t & renum_items_communs() const
Returns the renum_items_communs_ array (read-only). See renum_items_communs_.
ArrOfInt_t & set_items_communs()
Returns the items_communs_ array for filling.
virtual trustIdType nb_items_seq_tot() const
: This class is an OWN_PTR but the pointed object is shared among multiple
Navier Velocity boundary condition of type "Navier":
const Nom & que_suis_je() const
Returns the string identifying the class.
virtual Entree & readOn(Entree &)
Reads an Objet_U from an input stream. Virtual method to override.
static double precision_geom
virtual const Nom & le_nom() const
Returns the name of the Objet_U. Virtual method to override: returns "neant" in this implementation.
virtual Sortie & printOn(Sortie &) const
Writes the object to an output stream. Virtual method to override.
class Periodique This class represents a periodic boundary condition.
int face_associee(int i) const
static int check_int_overflow(trustIdType)
static double mp_max(double)
static Sortie & Journal(int message_level=0)
Returns a static Sortie object used as an event journal.
static int nproc()
Returns the number of processors in the current group. See Comm_Group::nproc() and PE_Groups::current...
static double mp_sum(double)
Computes the sum of x over all processors in the current group.
static int me()
Returns the rank of the local processor in the current communication group. See Comm_Group::rank() an...
static void exit(int exit_code=-1)
Exit routine for TRUST within a Kokkos region.
int nb_raccords() const
Returns the number of connections contained in the list.
static void construire_espace_virtuel_traduction(const MD_Vector &md_indice, const MD_Vector &md_valeur, IntTab &tableau, const int error_is_fatal=1)
Builds the items_communs + virtual space structure of an array containing indices of geometric items,...
static void calculer_renum_items_communs(Joints &joints, const JOINT_ITEM type_item)
Assumes that each joint[i].joint_item(type_item).items_communs() contains the local indices of common...
static void construire_md_vector(const Domaine &, int nb_items_reels, const JOINT_ITEM, MD_Vector &)
Builds an MD_Vector_std from the joint information of the domain for the requested item type.
static void calculer_espace_distant_faces(Domaine &domaine, const int nb_faces_reelles, const IntTab &elem_faces)
Same as Scatter::calculer_espace_distant_sommets for faces.
Base class for output streams.
Symetrie On symmetry faces, the following properties hold:
_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_