37     GMM_ASSERT1(i <= nbpt,  
"convex_structure::add_point_adaptative: " 
   39     if (i == nbpt) nbpt++;
 
   41       faces[f].resize(faces[f].size() + 1);
 
   42       (faces[f])[faces[f].size() - 1] = i;
 
   48     std::fill(faces_struct.begin(),faces_struct.end(),
 
   50     std::fill(faces.begin(),faces.end(), convex_ind_ct());
 
   51      dir_points_ = convex_ind_ct();
 
   56   (
const std::vector<short_type> &ftab)
 const {
 
   57     auto it = intersection_points.find(ftab);
 
   58     if (it == intersection_points.end()) {
 
   59       std::vector<size_type> cpt(
nb_points(), ftab.size());
 
   65         if (cpt[i] == 0) ind.push_back(i);
 
   66       it = intersection_points.emplace(ftab, ind).first;
 
   72     o << 
"convex structure of dimension " << int(cv.
dim()) << 
" with " 
   80   class convex_structure_key : 
virtual public dal::static_stored_object_key {
 
   86     bool compare(
const static_stored_object_key &oo)
 const override{
 
   87       const convex_structure_key &o
 
   88         = 
dynamic_cast<const convex_structure_key &
>(oo);
 
   89       if (type < o.type) 
return true;
 
   90       if (type > o.type) 
return false;
 
   91       if (N < o.N) 
return true;
 
   92       if (N > o.N) 
return false;
 
   93       if (K < o.K) 
return true;
 
   94       if (K > o.K) 
return false;
 
   95       if (nf < o.nf) 
return true;
 
   98     bool equal(
const static_stored_object_key &oo)
 const override{
 
   99       auto &o = 
dynamic_cast<const convex_structure_key &
>(oo);
 
  100       if (type != o.type) 
return false;
 
  101       if (N != o.N) 
return false;
 
  102       if (K != o.K) 
return false;
 
  103       if (nf != o.nf) 
return false;
 
  106     convex_structure_key(
int t, dim_type NN, 
short_type KK = 0,
 
  108       : type(t), N(NN), K(KK), nf(nnf)  {}
 
  112     if (!p1 || !p2) 
return p1.get() == p2.get();
 
  113     if (p1.get() == p2.get()) 
return true;
 
  114     else return *dal::key_of_stored_object(p1) == *dal::key_of_stored_object(p2);
 
  122     return p1.get() == 
nullptr;
 
  126     return p2 == 
nullptr;
 
  130     return !(p1 == 
nullptr);
 
  134     return !(p2 == 
nullptr);
 
  141   class simplex_structure_ : 
public convex_structure
 
  144 #ifdef GETFEM_HAVE_QDLIB 
  149 #ifdef GETFEM_HAVE_QDLIB 
  151     static bool fpu_init = 
false;
 
  154       fpu_fix_start(&old_cw);
 
  158     dal::pstatic_stored_object_key
 
  159       pcsk = std::make_shared<convex_structure_key>(0, nc, 1);
 
  161     if (o) 
return std::dynamic_pointer_cast<const convex_structure>(o);
 
  163     auto p = std::make_shared<simplex_structure_>();
 
  165     p->Nc = dim_type(nc); p->nbpt = 
short_type(nc+1);
 
  167     p->faces_struct.resize(p->nbf);
 
  168     p->faces.resize(p->nbf);
 
  169     p->dir_points_.resize(p->Nc + 1);
 
  170     p->auto_basic = 
true;
 
  172       p->dir_points_[i] = i;
 
  174       p->faces[i].resize(nc);
 
  176         (p->faces[i])[j] = (j >= i) ? 
short_type(j + 1) : j;
 
  182                              dal::PERMANENT_STATIC_OBJECT);
 
  190   struct K_simplex_structure_ : 
public convex_structure {
 
  192     K_simplex_structure_(dim_type NN, 
short_type KK) {
 
  195       faces_struct.resize(nbf);
 
  197       dir_points_.resize(Nc+1);
 
  200         for (
int i = 0; i < nbf; i++) {
 
  202           faces[i].resize(faces_struct[i]->nb_points());
 
  205         for (
int i = 0; i < nbf; i++) {
 
  212       std::vector<int> pf(Nc+1,0);
 
  215         c.fill(scalar_type(1.0) / scalar_type(Nc+1));
 
  217         for (l = 1; l <= Nc; ++l)
 
  218           (faces[l])[(pf[l])++] = 0;
 
  219         dir_points_[pd++] = 0;
 
  223           c[l] += scalar_type(1) / scalar_type(KK);
 
  226             sum -= 
size_type(floor(0.5+(c[l] * KK)));
 
  228             c[l] += scalar_type(1) / scalar_type(KK);
 
  231           for (l = 1; l <= Nc; ++l)
 
  232             if (c[l-1] == scalar_type(0.0))
 
  233               (faces[l])[(pf[l])++] = r;
 
  235             (faces[0])[(pf[0])++] = r;
 
  236             if (*(std::max_element(c.begin(), c.end())) == scalar_type(1.0))
 
  237               dir_points_[pd++] = r;
 
  247     dal::pstatic_stored_object_key
 
  248       pcsk = std::make_shared<convex_structure_key>(0, nc, K);
 
  250     if (o) 
return std::dynamic_pointer_cast<const convex_structure>(o);
 
  254                            dal::PERMANENT_STATIC_OBJECT);
 
  262   struct polygon_structure_ : 
public convex_structure {
 
  270     dal::pstatic_stored_object_key
 
  271       pcsk = std::make_shared<convex_structure_key>(1, dim_type(nbt));
 
  273     if (o) 
return std::dynamic_pointer_cast<const convex_structure>(o);
 
  275     auto p = std::make_shared<polygon_structure_>();
 
  277     p->Nc = 2; p->nbpt = nbt; p->nbf = nbt;
 
  278     p->auto_basic = 
true;
 
  279     p->faces_struct.resize(p->nbf);
 
  280     p->faces = std::vector< std::vector<short_type> >(p->nbf);
 
  281     p->dir_points_ = std::vector<short_type>(p->Nc + 1);
 
  283     for (
int i = 0; i < p->nbf; i++) {
 
  285       p->faces[i] = std::vector<short_type>(2);
 
  286       for (
int j = 0; j < 2; j++)
 
  290     p->dir_points_[0] = 0;
 
  291     p->dir_points_[1] = 1;
 
  295                            dal::PERMANENT_STATIC_OBJECT);
 
  305   struct cv_pr_structure_ : 
public convex_structure {
 
  307       Nc = dim_type(cv1->dim() + cv2->dim());
 
  308       prod_a = cv1; prod_b = cv2;
 
  309       nbpt = 
short_type(cv1->nb_points() * cv2->nb_points());
 
  310       nbf = 
short_type(cv1->nb_faces() + cv2->nb_faces());
 
  316       faces_struct.resize(nbf);
 
  317       faces = std::vector< std::vector<short_type> >(nbf);
 
  319       if (cv1->ind_dir_points().size() && cv2->ind_dir_points().size()) {
 
  320         dir_points_ = std::vector<short_type>(Nc + 1);
 
  322         for (
int i = 0; i <= cv1->dim(); i++)
 
  325                          + cv2->ind_dir_points()[0] * cv1->nb_points());
 
  326         for (
int i = 1; i <= cv2->dim(); i++)
 
  327           dir_points_[cv1->dim()+i]
 
  329                          + cv2->ind_dir_points()[i] * cv1->nb_points());
 
  332       for (
short_type i = 0; i < cv1->nb_faces(); i++) {
 
  333         if (cv1->nb_points_of_face(i) == 1)
 
  334           faces_struct[i] = cv2;
 
  341         faces[i] = std::vector<short_type>(cv1->nb_points_of_face(i)
 
  344         for (
short_type j = 0; j < cv1->nb_points_of_face(i); j++)
 
  345           for (
short_type l = 0; l < cv2->nb_points(); l++) {
 
  346             (faces[i])[l*cv1->nb_points_of_face(i)+j]
 
  348                            + l * cv1->nb_points());
 
  351       for (
short_type i = 0; i < cv2->nb_faces(); i++) {
 
  353         if (cv2->nb_points_of_face(i) == 1)
 
  354           faces_struct[i+k] = cv1;
 
  361         faces[i+k] = std::vector<short_type>(cv2->nb_points_of_face(i)
 
  364         for (
short_type j = 0; j < cv2->nb_points_of_face(i); j++)
 
  365           for (
short_type l = 0; l < cv1->nb_points(); l++) {
 
  366             (faces[i+k])[j*cv1->nb_points()+l]
 
  367               = 
short_type(l + (cv2->ind_points_of_face(i))[j]
 
  377     dal::pstatic_stored_object_key pcsk = std::make_shared<cv_pr_key_>(a, b);
 
  379     if (o) 
return std::dynamic_pointer_cast<const convex_structure>(o);
 
  382     for (
size_type k = 0; k < p->nb_faces(); ++k) {
 
  383       if (exists_stored_object(p->faces_structure()[k]))
 
  396     { DAL_STORED_OBJECT_DEBUG_CREATED(
this, 
"parallelepiped structure"); }
 
  398     { DAL_STORED_OBJECT_DEBUG_DESTROYED(
this, 
"parallelepiped structure"); }
 
  401   DAL_DOUBLE_KEY(parallelepiped_key_, dim_type, dim_type);
 
  407     dal::pstatic_stored_object_key
 
  408       pcsk = std::make_shared<parallelepiped_key_>(nc, k);
 
  412       return ((std::dynamic_pointer_cast<const parallelepiped_>(o))->p);
 
  414       auto p = std::make_shared<parallelepiped_>();
 
  418                              dal::PERMANENT_STATIC_OBJECT);
 
  428   struct Q2_incomplete_structure_ : 
public convex_structure {
 
  432   DAL_SIMPLE_KEY(Q2_incomplete_structure_key_, dim_type);
 
  435     GMM_ASSERT1(nc == 2 || nc == 3, 
"Bad parameter, expected value 2 or 3");
 
  436     dal::pstatic_stored_object_key
 
  437       pcsk = std::make_shared<Q2_incomplete_structure_key_>(nc);
 
  439     if (o) 
return std::dynamic_pointer_cast<const convex_structure>(o);
 
  441     auto p = std::make_shared<Q2_incomplete_structure_>();
 
  444     p->nbpt = (nc == 2) ? 8 : 20;
 
  445     p->nbf =  (nc == 2) ? 4 : 6;
 
  447     p->faces_struct.resize(p->nbf);
 
  448     p->faces = std::vector< std::vector<short_type> >(p->nbf);
 
  449     p->dir_points_ = std::vector<short_type>(p->Nc + 1);
 
  457       p->faces[0] = {2,4,7};
 
  458       p->faces[1] = {0,3,5};
 
  459       p->faces[2] = {5,6,7};
 
  460       p->faces[3] = {0,1,2};
 
  462       p->dir_points_[0] = 0;
 
  463       p->dir_points_[1] = 2;
 
  464       p->dir_points_[2] = 5;
 
  477       p->faces[0] = {2,4,7,9,11,14,16,19};
 
  478       p->faces[1] = {0,3,5,8,10,12,15,17};
 
  480       p->faces[2] = {5,6,7,10,11,17,18,19};
 
  481       p->faces[3] = {0,1,2,8,9,12,13,14};
 
  483       p->faces[4] = {12,13,14,15,16,17,18,19};
 
  484       p->faces[5] = {0,1,2,3,4,5,6,7};
 
  486       p->dir_points_[0] = 0;
 
  487       p->dir_points_[1] = 2;
 
  488       p->dir_points_[2] = 5;
 
  489       p->dir_points_[3] = 12;
 
  492     for (
int i = 0; i < p->nbf; i++) {
 
  498                            dal::PERMANENT_STATIC_OBJECT);
 
  508   struct pyramid_QK_structure_ : 
public convex_structure {
 
  512   DAL_SIMPLE_KEY(pyramid_QK_structure_key_, dim_type);
 
  515     GMM_ASSERT1(k == 1 || k == 2, 
"Sorry, pyramidal elements implemented " 
  516                 "only for degree one or two.");
 
  517     dal::pstatic_stored_object_key
 
  518       pcsk = std::make_shared<pyramid_QK_structure_key_>(k);
 
  521       return std::dynamic_pointer_cast<const convex_structure>(o);
 
  523     auto p = std::make_shared<pyramid_QK_structure_>();
 
  527     p->dir_points_ = std::vector<short_type>(p->Nc + 1);
 
  532       p->auto_basic = 
true;
 
  541       p->faces_struct.resize(p->nbf);
 
  542       p->faces = std::vector< std::vector<short_type> >(p->nbf);
 
  543       p->faces[0] = {0,1,2,3};
 
  544       p->faces[1] = {0,1,4};
 
  545       p->faces[2] = {1,3,4};
 
  546       p->faces[3] = {3,2,4};
 
  547       p->faces[4] = {2,0,4};
 
  549       p->dir_points_[0] = 0;
 
  550       p->dir_points_[1] = 1;
 
  551       p->dir_points_[2] = 2;
 
  552       p->dir_points_[3] = 4;
 
  555       for (
int i = 1; i < p->nbf; i++)
 
  560                              dal::PERMANENT_STATIC_OBJECT);
 
  577       p->faces_struct.resize(p->nbf);
 
  578       p->faces = std::vector< std::vector<short_type> >(p->nbf);
 
  579       p->faces[0] = {0,1,2,3,4,5,6,7,8};
 
  580       p->faces[1] = {0,1,2,9,10,13};
 
  581       p->faces[2] = {2,5,8,10,12,13};
 
  582       p->faces[3] = {8,7,6,12,11,13};
 
  583       p->faces[4] = {6,3,0,11,9,13};
 
  585       p->dir_points_[0] = 0;
 
  586       p->dir_points_[1] = 2;
 
  587       p->dir_points_[2] = 6;
 
  588       p->dir_points_[3] = 13;
 
  591       for (
int i = 1; i < p->nbf; i++)
 
  596                              dal::PERMANENT_STATIC_OBJECT);
 
  605   struct pyramid_Q2_incomplete_structure_ : 
public convex_structure {
 
  609   DAL_SIMPLE_KEY(pyramid_Q2_incomplete_structure_key_, dim_type);
 
  612     dal::pstatic_stored_object_key
 
  613       pcsk = std::make_shared<pyramid_Q2_incomplete_structure_key_>(0);
 
  616       return std::dynamic_pointer_cast<const convex_structure>(o);
 
  618     auto p = std::make_shared<pyramid_Q2_incomplete_structure_>();
 
  622     p->dir_points_ = std::vector<short_type>(p->Nc + 1);
 
  638     p->faces_struct.resize(p->nbf);
 
  639     p->faces = std::vector< std::vector<short_type> >(p->nbf);
 
  640     p->faces[0] = {0,1,2,3,4,5,6,7};
 
  641     p->faces[1] = {0,1,2,8,9,12};
 
  642     p->faces[2] = {2,4,7,9,11,12};
 
  643     p->faces[3] = {7,6,5,11,10,12};
 
  644     p->faces[4] = {5,3,0,10,8,12};
 
  646     p->dir_points_[0] = 0;
 
  647     p->dir_points_[1] = 2;
 
  648     p->dir_points_[2] = 5;
 
  649     p->dir_points_[3] = 12;
 
  652     for (
int i = 1; i < p->nbf; i++)
 
  657                            dal::PERMANENT_STATIC_OBJECT);
 
  665   struct prism_incomplete_P2_structure_ : 
public convex_structure {
 
  669   DAL_SIMPLE_KEY(prism_incomplete_P2_structure_key_, dim_type);
 
  672     dal::pstatic_stored_object_key
 
  673       pcsk = std::make_shared<prism_incomplete_P2_structure_key_>(0);
 
  676       return std::dynamic_pointer_cast<const convex_structure>(o);
 
  678     auto p = std::make_shared<prism_incomplete_P2_structure_>();
 
  682     p->dir_points_ = std::vector<short_type>(p->Nc + 1);
 
  698     p->faces_struct.resize(p->nbf);
 
  699     p->faces = std::vector< std::vector<short_type> >(p->nbf);
 
  700     p->faces[0] = {2,4,5,7,8,11,13,14};
 
  701     p->faces[1] = {0,3,5,6,8,9,12,14};
 
  702     p->faces[2] = {0,1,2,6,7,9,10,11};
 
  703     p->faces[3] = {9,10,11,12,13,14};
 
  704     p->faces[4] = {0,1,2,3,4,5};
 
  706     p->dir_points_[0] = 0;
 
  707     p->dir_points_[1] = 2;
 
  708     p->dir_points_[2] = 5;
 
  709     p->dir_points_[3] = 9;
 
  711     for (
int i = 0; i < 3; i++)
 
  718                            dal::PERMANENT_STATIC_OBJECT);
 
  726   struct dummy_structure_ : 
public convex_structure {
 
  733     dal::pstatic_stored_object_key
 
  734       pcsk = std::make_shared<convex_structure_key>(2, nc, 
short_type(n), nf);
 
  736     if (o) 
return std::dynamic_pointer_cast<const convex_structure>(o);
 
  737     auto p = std::make_shared<dummy_structure_>();
 
  739     p->Nc = nc; p->nbpt = 
short_type(n); p->nbf = 0;
 
  740     p->faces_struct.resize(nf);
 
  746       p->faces[j].resize(n);
 
  747       for (
short_type k = 0; k < n; ++k) p->faces[j][k] = k;
 
  749     p->dir_points_.resize(0);
 
  750     p->auto_basic = 
true;
 
  756                              dal::PERMANENT_STATIC_OBJECT);
 
convenient initialization of vectors via overload of "operator,".
 
Definition of convex structures.
 
const convex_ind_ct & ind_points_of_face(short_type i) const
Give an array of the indexes of the vertices of a face.
 
dim_type dim() const
Dimension of the convex.
 
const convex_ind_ct & ind_common_points_of_faces(const std::vector< short_type > &ftab) const
Give an array of the indexes of the vertices at the intersection of a set of faces.
 
friend pconvex_structure basic_structure(pconvex_structure cv)
Original structure (if concerned)
 
short_type nb_points() const
Number of vertices.
 
short_type nb_faces() const
Number of faces.
 
base class for static stored objects
 
A simple singleton implementation.
 
Stores interdependent getfem objects.
 
pconvex_structure prism_incomplete_P2_structure()
Give a pointer on the 3D quadratic incomplete prism structure.
 
pconvex_structure pyramid_Q2_incomplete_structure()
Give a pointer on the 3D quadratic incomplete pyramid structure.
 
gmm::uint16_type short_type
used as the common short type integer in the library
 
pconvex_structure pyramid_QK_structure(dim_type k)
Give a pointer on the 3D pyramid structure for a degree k = 1 or 2.
 
std::ostream & operator<<(std::ostream &o, const convex_structure &cv)
Print the details of the convex structure cvs to the output stream o.
 
std::shared_ptr< const convex_structure > pconvex_structure
Pointer on a convex structure description.
 
pconvex_structure parallelepiped_structure(dim_type nc, dim_type k)
Give a pointer on the structures of a parallelepiped of dimension d.
 
pconvex_structure generic_dummy_structure(dim_type nc, size_type n, short_type nf)
Generic convex with n global nodes.
 
bool operator==(const pconvex_structure &p1, const pconvex_structure &p2)
Stored objects must be compared by keys, because there is a possibility that they are duplicated in s...
 
pconvex_structure Q2_incomplete_structure(dim_type nc)
Give a pointer on the structures of a incomplete Q2 quadrilateral/hexahedral of dimension d = 2 or 3.
 
pconvex_structure prism_P1_structure(dim_type nc)
Give a pointer on the structures of a prism of dimension d.
 
pconvex_structure simplex_structure(dim_type nc)
Give a pointer on the structures of a simplex of dimension d.
 
size_t size_type
used as the common size type in the library
 
pconvex_structure polygon_structure(short_type nbt)
Give a pointer on the structures of a polygon with n vertex.
 
pconvex_structure convex_product_structure(pconvex_structure a, pconvex_structure b)
Give a pointer on the structures of a convex which is the direct product of the convexes represented ...
 
pconvex_structure basic_structure(pconvex_structure cv)
Original structure (if concerned)
 
size_type alpha(short_type n, short_type d)
Return the value of  which is the number of monomials of a polynomial of  variables and degree .
 
void add_stored_object(pstatic_stored_object_key k, pstatic_stored_object o, permanence perm)
Add an object with two optional dependencies.
 
void add_dependency(pstatic_stored_object o1, pstatic_stored_object o2)
Add a dependency, object o1 will depend on object o2.
 
pstatic_stored_object search_stored_object(pstatic_stored_object_key k)
Gives a pointer to an object from a key pointer.