137 les_mots[0] =
"Liste";
138 les_mots[1] =
"Polynomes";
139 les_mots[2] =
"Boite";
140 les_mots[3] =
"Rectangle";
141 les_mots[4] =
"Intervalle";
142 les_mots[5] =
"Fichier";
143 les_mots[6] =
"Plaque";
144 les_mots[7] =
"Segment";
145 les_mots[8] =
"Couronne";
146 les_mots[9] =
"Tube";
147 les_mots[10]=
"Tube_Hexagonal";
148 les_mots[11]=
"fonction_sous_zone";
149 les_mots[12]=
"fonction_sous_domaine";
154 Cerr <<
"You have not associated one of the objects of type Sous_Domaine " << finl;
155 Cerr <<
"to the object of type Domain " << finl;
159 const Domaine_t& ledomaine=le_dom_.valeur();
167 Cerr <<
"We expected a { to the reading of the subarea" << finl;
168 Cerr <<
"instead of " << motlu << finl;
173 using Int_tArrView = View<int_t, 1>;
174 using CInt_tArrView = ConstView<int_t, 1>;
175 using CInt_tTabView = ConstView<int_t, 2>;
176 int_t nb_pol_possible;
177 if (motlu==
"restriction")
180 is >> nom_ss_domaine;
185 Int_tArrView les_polys_possibles = les_polys_possibles_.view_wo();
186 Kokkos::parallel_for(start_gpu_timer(__KERNEL_NAME__), nb_pol_possible, KOKKOS_LAMBDA(
const int_t i)
190 end_gpu_timer(__KERNEL_NAME__);
198 Int_tArrView les_polys_possibles = les_polys_possibles_.view_wo();
199 Kokkos::parallel_for(start_gpu_timer(__KERNEL_NAME__), nb_pol_possible, KOKKOS_LAMBDA(
const int_t i)
201 les_polys_possibles(i)=i;
203 end_gpu_timer(__KERNEL_NAME__);
205 int rang = les_mots.
search(motlu);
211 Cerr << motlu <<
" is not understood " << finl;
212 Cerr <<
"The understood keywords are " << les_mots;
218 Cerr <<
"When the subareas are defined as lists of elements" << finl;
219 Cerr <<
"it is necessary to split them for parallel computing." << finl;
229 Cerr<<
"Sous_Domaine_32_64<_SIZE_>::readOn : Reading of the polynomials"<<finl;
234 Cerr <<
"We expected a { " << finl;
241 les_polynomes.add(un_poly);
244 if(motlu==
Motcle(
"}"))
break;
247 Cerr <<
"We expected " << Et <<
" or } " << finl;
252 const Domaine_t& le_dom=le_dom_.valeur();
259 ToDo_Kokkos(
"critical");
260 for (
int_t n_pol=0; n_pol<nb_pol_possible; n_pol++)
262 le_poly=les_polys_possibles_[n_pol];
264 for(
int le_som=0; le_som<nbsom; le_som++)
269 x/=((double)(nbsom));
271 for (
auto& itr : les_polynomes)
275 if (itr(x(0), x(1)) <0) test = -1;
280 if (itr(x(0), x(1),x(2)) <0) test = -1;
291 Cerr <<
"Construction of the subarea OK" << finl;
301 Cerr <<
"In 2 dimensions, you must use \"Rectangle\" " << finl;
305 if (motlu !=
Motcle(
"Origine"))
307 Cerr <<
"We expected the keyword \"Origine\"" << finl;
310 double deux_pi=M_PI*2.0 ;
312 is >> ox >> oy >> oz ;
314 if (motlu !=
Motcle(
"Cotes"))
316 Cerr <<
"We expected the keyword \"Cotes\"" << finl;
330 const Domaine_t& le_dom=le_dom_.valeur();
336 Cerr <<
"Construction of the subarea " <<
le_nom()<< finl;
338 ToDo_Kokkos(
"critical");
339 for (
int_t n_pol=0; n_pol<nb_pol_possible; n_pol++)
341 le_poly=les_polys_possibles_[n_pol];
345 for(
int le_som = 0; le_som < nbsom && ((s = ledomaine.
sommet_elem(le_poly,le_som)) >= 0); le_som++)
352 x/=((double)(nb_som_poly));
353 y/=((double)(nb_som_poly));
354 z/=((double)(nb_som_poly));
355 if ( sup_strict(x,ox)
360 && sup_strict(lz,z) )
367 Cerr <<
"Construction of the subarea OK" << finl;
377 Cerr <<
"In 3 dimensions, you must use \"Boite\" " << finl;
381 if (motlu !=
Motcle(
"Origine"))
383 Cerr <<
"We expected the keyword \"Origine\"" << finl;
389 if (motlu !=
Motcle(
"Cotes"))
391 Cerr <<
"We expected the keyword \"Cotes\"" << finl;
399 const Domaine_t& le_dom=le_dom_.valeur();
405 Cerr <<
"Construction of the subarea " <<
le_nom() << finl;
407 ToDo_Kokkos(
"critical");
408 for (
int_t n_pol=0; n_pol<nb_pol_possible; n_pol++)
410 le_poly=les_polys_possibles_[n_pol];
412 for(
int le_som=0; le_som<nbsom; le_som++)
417 x/=((double)(nbsom));
418 y/=((double)(nbsom));
419 if ( sup_strict(x,ox)
422 && sup_strict(ly,y) )
429 Cerr <<
"Construction of the subarea OK" << finl;
438 Cerr <<
"You can't use Intervalle option for parallel calculation." << finl;
442 is >> prems >> nombre;
444 ToDo_Kokkos(
"critical");
445 for(
int_t i=0; i<nombre; i++)
461 Cerr <<
"Reading of a subarea in the file " << nomfic << finl;
464 Cerr <<
" Error while opening file." << finl;
468 for(
int p=1; p<
nproc(); p++)
486 ToDo_Kokkos(
"critical");
487 for (
int_t i = 0; i < nb_polys_reels; i++)
495 int_t nb_polys = nb_polys_reels;
496 for (
int_t i = nb_elem; i < domaine_nb_elem_tot; i++)
497 nb_polys += marqueurs[i];
500 nb_polys = nb_polys_reels;
501 for (
int_t i = nb_elem; i < domaine_nb_elem_tot; i++)
512 Cerr <<
"In 2 dimensions, you must use something else like a segment."<< finl;
516 if (motlu !=
Motcle(
"Origine"))
518 Cerr <<
"We expected the keyword \"Origine\"" << finl;
521 double deux_pi=M_PI*2.0 ;
523 is >> ox >> oy >> oz ;
525 if (motlu !=
Motcle(
"Cotes"))
527 Cerr <<
"We expected the keyword \"Cotes\"" << finl;
532 if ((lx!=0)&&(ly!=0)&&(lz!=0))
534 Cerr <<
"We expected at least one quotation to zero" << finl;
546 const Domaine_t& le_dom=le_dom_.valeur();
551 Cerr <<
"Construction of the subarea " <<
le_nom() << finl;
553 ToDo_Kokkos(
"critical");
554 for (
int_t n_pol=0; n_pol<nb_pol_possible; n_pol++)
556 le_poly=les_polys_possibles_[n_pol];
557 int le_som, nb_som_poly = 0;
560 for(le_som=0; le_som<nbsom && ((s = ledomaine.
sommet_elem(le_poly,le_som)) >= 0); le_som++)
568 double xmin,xmax,ymin,ymax,zmin,zmax;
575 for(le_som=1; le_som<nbsom && ((s = ledomaine.
sommet_elem(le_poly,le_som)) >= 0); le_som++)
577 xmin=std::min(xmin,dom.
coord(s, 0));
578 ymin=std::min(ymin,dom.
coord(s, 1));
579 zmin=std::min(zmin,dom.
coord(s, 2));
580 xmax=std::max(xmax,dom.
coord(s, 0));
581 ymax=std::max(ymax,dom.
coord(s, 1));
582 zmax=std::max(zmax,dom.
coord(s, 2));
584 x/=((double)(nb_som_poly));
585 y/=((double)(nb_som_poly));
586 z/=((double)(nb_som_poly));
588 ( sup_strict(x,ox) && sup_strict(lx,x)
589 && sup_strict(y,oy) && sup_strict(ly,y)
590 && sup_strict(oz,zmin) && inf_ou_egal(oz,zmax) )
591 || ( sup_strict(x,ox) && sup_strict(lx,x)
592 && sup_strict(z,oz) && sup_strict(lz,z)
593 && sup_strict(oy,ymin) && inf_ou_egal(oy,ymax) )
594 || ( sup_strict(y,oy) && sup_strict(ly,y)
595 && sup_strict(z,oz) && sup_strict(lz,z)
596 && sup_strict(ox,xmin) && inf_ou_egal(ox,xmax) )
604 Cerr <<
"Construction of the subarea OK" << finl;
613 Cerr <<
"In 3 dimensions, you must use something else like a plaque."<< finl;
617 if (motlu !=
Motcle(
"Origine"))
619 Cerr <<
"We expected the keyword \"Origine\"" << finl;
626 if (motlu !=
Motcle(
"Cotes"))
628 Cerr <<
"We expected the keyword \"Cotes\"" << finl;
633 if ((lx!=0)&&(ly!=0))
635 Cerr <<
"We expected at least one quotation to zero" << finl;
642 const Domaine_t& le_dom=le_dom_.valeur();
647 Cerr <<
"Construction of the subarea " <<
le_nom() << finl;
649 ToDo_Kokkos(
"critical");
650 for (
int_t n_pol=0; n_pol<nb_pol_possible; n_pol++)
652 le_poly=les_polys_possibles_[n_pol];
655 for(le_som=0; le_som<nbsom; le_som++)
661 double xmin,xmax,ymin,ymax;
666 for(le_som=1; le_som<nbsom; le_som++)
673 x/=((double)(nbsom));
674 y/=((double)(nbsom));
676 ( sup_strict(x,ox) && sup_strict(lx,x)
677 && sup_strict(oy,ymin) && inf_ou_egal(oy,ymax) )
678 || ( sup_strict(y,oy) && sup_strict(ly,y)
679 && sup_strict(ox,xmin) && inf_ou_egal(ox,xmax) )
687 Cerr <<
"Construction of the subarea OK" << finl;
697 Cerr <<
"A crown is only in 2D : in 3 dimensions it is a tube \"Tube\" "<< finl;
701 if(motlu!=
Motcle(
"Origine"))
703 Cerr <<
"We expected the keyword \"ORIGINE\" " << finl;
711 Cerr <<
"We expected the internal radius \"RI\" " << finl;
719 Cerr <<
"We expected the external radius \"RE\" " << finl;
726 const Domaine_t& le_dom=le_dom_.valeur();
730 Cerr <<
"Construction of the subarea " <<
le_nom() << finl;
732 ToDo_Kokkos(
"critical");
733 for (
int_t n_pol=0; n_pol<nb_pol_possible; n_pol++)
735 int_t le_poly=les_polys_possibles_[n_pol];
737 for(
int som=0; som<nbsom; som++)
742 x/=((double)(nbsom));
743 if ( sup_strict((x(0)-xo)*(x(0)-xo)+(x(1)-yo)*(x(1)-yo),ri2) && sup_strict(re2,(x(0)-xo)*(x(0)-xo)+ (x(1)-yo)*(x(1)-yo)) )
750 Cerr <<
"Construction of the subarea OK" << finl;
760 Cerr <<
"A tube is only in 3D : in 2 dimensions it is a crown \"Couronne\" "<< finl;
764 if(motlu!=
Motcle(
"Origine"))
766 Cerr <<
"We expected the keyword \"ORIGINE\" " << finl;
770 is >> xo >> yo >> zo;
774 Cerr <<
"We expected the tube direction, keyword \"DIR\" " << finl;
786 int idir = coords.
search(motlu);
788 dir[0]=dir[1]=dir[2]=0;
812 Cerr <<
"DIR is equal to X for a tube parallel to OX ; Y for a tube parallel to OY and Z for a tube parallel to OZ" << finl;
813 Cerr <<
"Currently, DIR is equal to " << coord << finl;
820 Cerr <<
"We expected the internal radius, keyword \"RI\" " << finl;
828 Cerr <<
"We expected the external radius, keyword \"RE\" " << finl;
833 if(motlu!=
Motcle(
"Hauteur"))
835 Cerr <<
"We expected the height of tube, keyword \"Hauteur\" " << finl;
841 double ri2 = ri*ri, re2=re*re;
842 const Domaine_t& le_dom=le_dom_.valeur();
847 Cerr <<
"Construction of the subarea " <<
le_nom() << finl;
849 ToDo_Kokkos(
"critical");
850 for (
int_t n_pol=0; n_pol<nb_pol_possible; n_pol++)
852 le_poly=les_polys_possibles_[n_pol];
854 for(
int le_som=0; le_som<nbsom; le_som++)
859 x/=((double)(nbsom));
860 double tmp = dir[0]*(x(0)-xo)*(x(0)-xo)+ dir[1]*(x(1)-yo)*(x(1)-yo) + dir[2]*(x(2)-zo)*(x(2)-zo);
861 if ( sup_ou_egal(tmp,ri2) && inf_ou_egal(tmp,re2) && inf_ou_egal(x(idir),h) && sup_ou_egal(x(idir),h0) )
868 Cerr <<
"Construction of the subarea OK" << finl;
877 Cerr <<
"An hexagonal tube \"Tube_hexagonal\" is only in 3D "<< finl;
888 if(motlu!=
Motcle(
"ENTREPLAT"))
890 Cerr <<
"We expected the entreplat of the tube, keyword \"ENTREPLAT\"" << finl;
895 if(motlu==
Motcle(
"IN")) in=1;
896 else if(motlu==
Motcle(
"OUT")) in=0;
899 Cerr <<
"We expected the keyword \"IN\" or \"OUT\" " << finl;
904 const Domaine_t& le_dom=le_dom_.valeur();
909 Cerr <<
"Construction of the subarea " <<
le_nom()<< finl;
912 ToDo_Kokkos(
"critical");
913 for (
int_t n_pol=0; n_pol<nb_pol_possible; n_pol++)
915 le_poly=les_polys_possibles_[n_pol];
917 for(
int le_som=0; le_som<nbsom; le_som++)
922 x/=((double)(nbsom));
924 if ( sup_ou_egal(x(1),-ep/2.) && sup_ou_egal(x(1),-ep-x(0)*sqrt(3.)) && sup_ou_egal(x(1),-ep+x(0)*sqrt(3.))
925 && inf_ou_egal(x(1), ep/2.) && inf_ou_egal(x(1), ep-x(0)*sqrt(3.)) && inf_ou_egal(x(1), ep+x(0)*sqrt(3.)) )
943 Cerr <<
"Construction of the subarea OK" << finl;
965 const Domaine_t& le_dom=le_dom_.valeur();
967 Cerr <<
"Construction of the subarea " <<
le_nom()<< finl;
971 Int_tArrView les_polys_possibles = les_polys_possibles_.view_rw();
973 Kokkos::parallel_reduce(start_gpu_timer(__KERNEL_NAME__), nb_pol_possible, KOKKOS_LAMBDA(
const int_t i,
int_t& local_compteur)
975 int_t le_poly=les_polys_possibles(i);
976 double x[3] = {0.,0.,0.};
978 for(
int le_som=0; le_som<nbsom; le_som++)
979 if (sommet_elem(le_poly,le_som) >= 0)
981 for(
int k=0; k<dim; k++)
982 x[k]+=coord(sommet_elem(le_poly,le_som),k);
985 for(
int k=0; k<dim; k++)
987 int threadId = parser.
acquire();
988 parser.
setVar(0,x[0],threadId);
989 parser.
setVar(1,x[1],threadId);
991 parser.
setVar(2,x[2],threadId);
992 double test=parser.
eval(threadId);
999 les_polys_possibles(i) = -1;
1001 end_gpu_timer(__KERNEL_NAME__);
1004 Int_tArrView indices = tab_indices.view_wo();
1005 Kokkos::parallel_scan(start_gpu_timer(__KERNEL_NAME__), nb_pol_possible, KOKKOS_LAMBDA(
const int_t i,
int& update,
const bool final)
1007 if (les_polys_possibles(i) >= 0)
1009 if (
final) indices(i) = update;
1013 end_gpu_timer(__KERNEL_NAME__);
1015 Kokkos::parallel_for(start_gpu_timer(__KERNEL_NAME__), nb_pol_possible, KOKKOS_LAMBDA(
const int_t i)
1017 if (les_polys_possibles(i) >= 0)
1018 les_elems(indices(i)) = les_polys_possibles(i);
1020 end_gpu_timer(__KERNEL_NAME__);
1021 Cerr <<
"Construction of the subarea OK" << finl;
1030 Cerr <<
"TRUST error" << finl;
1036 while (motlu==
"union")
1039 is >> nom_ss_domaine;
1042 ToDo_Kokkos(
"critical");
1044 if (!poly_set.count(ssz(i)))
1056 Cerr <<
"We expected a } to the reading of the subarea" << finl;
1057 Cerr <<
"instead of " << motlu << finl;