getfem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Getfem-commits] r5284 - in /trunk/getfem/src: bgeot_mesh_structure.cc g


From: Yves . Renard
Subject: [Getfem-commits] r5284 - in /trunk/getfem/src: bgeot_mesh_structure.cc getfem_mesh_fem.cc
Date: Mon, 04 Apr 2016 10:49:30 -0000

Author: renard
Date: Mon Apr  4 12:49:29 2016
New Revision: 5284

URL: http://svn.gna.org/viewcvs/getfem?rev=5284&view=rev
Log:
bug fix in neighbours_of_convex

Modified:
    trunk/getfem/src/bgeot_mesh_structure.cc
    trunk/getfem/src/getfem_mesh_fem.cc

Modified: trunk/getfem/src/bgeot_mesh_structure.cc
URL: 
http://svn.gna.org/viewcvs/getfem/trunk/getfem/src/bgeot_mesh_structure.cc?rev=5284&r1=5283&r2=5284&view=diff
==============================================================================
--- trunk/getfem/src/bgeot_mesh_structure.cc    (original)
+++ trunk/getfem/src/bgeot_mesh_structure.cc    Mon Apr  4 12:49:29 2016
@@ -233,22 +233,46 @@
                                             const std::vector<short_type> 
&ftab,
                                             ind_set &s) const {
     s.resize(0);
-    if (ftab.size() == 0) return;
-    if (ftab.size() == 1) return neighbours_of_convex(ic, ftab[0], s);
-    const mesh_convex_structure &q = convex_tab[ic];
-    const convex_ind_ct &ind = q.cstruct->ind_common_points_of_faces(ftab);
-    if (ind.size() == 0) return neighbours_of_convex(ic, s);
-    std::vector<size_type> ipts(ind.size());
-    auto it = ind.cbegin();
-    for (size_type &ipt : ipts) ipt = q.pts[*it++];
+    std::vector<size_type> ipts;
+
+    switch (ftab.size()) {
+    case 0:
+      {
+       ind_cv_ct pt = ind_points_of_convex(ic);
+       ipts.resize(pt.size());
+       std::copy(pt.begin(), pt.end(), ipts.begin());
+      }
+      break;
+
+    case 1:
+      {
+       ind_pt_face_ct pt = ind_points_of_face_of_convex(ic, ftab[0]);
+       ipts.resize(pt.size());
+       std::copy(pt.begin(), pt.end(), ipts.begin());
+      }
+      break;
+
+    default:
+      {
+       const mesh_convex_structure &q = convex_tab[ic];
+       const convex_ind_ct &ind = q.cstruct->ind_common_points_of_faces(ftab);
+       if (ind.size() == 0) return neighbours_of_convex(ic, s);
+       ipts.resize(ind.size());
+       auto it = ind.cbegin();
+       for (size_type &ipt : ipts) ipt = q.pts[*it++];
+      }
+      break;
+    }
+
+    if (ipts.size() == 0) {
+      GMM_ASSERT1(false, "pb");
+    }
 
     auto ipt0 = ipts.cbegin();
     auto ipt1 = ipt0 + 1;
     short_type nbpts = short_type(ipts.size()-1);
     for (size_type icv : points_tab[*ipt0]) {
-      if (icv != ic &&
-          (nbpts == 0 || is_convex_having_points(icv, nbpts, ipt1))
-          && (convex_tab[ic].cstruct->dim()==convex_tab[icv].cstruct->dim()))
+      if (icv != ic && (nbpts==0 || is_convex_having_points(icv, nbpts, ipt1)))
         s.push_back(icv);
     }
   }

Modified: trunk/getfem/src/getfem_mesh_fem.cc
URL: 
http://svn.gna.org/viewcvs/getfem/trunk/getfem/src/getfem_mesh_fem.cc?rev=5284&r1=5283&r2=5284&view=diff
==============================================================================
--- trunk/getfem/src/getfem_mesh_fem.cc (original)
+++ trunk/getfem/src/getfem_mesh_fem.cc Mon Apr  4 12:49:29 2016
@@ -335,8 +335,8 @@
       pgt_old = pgt; pspt_old = pspt;
       size_type nbd = pf->nb_dof(cv);
       pdof_description andof = global_dof(pf->dim());
-      itab.resize(nbd); 
-      
+      itab.resize(nbd);
+
       // determine for each dof on which faces it lies
       ftab.resize(nbd);
       for (size_type i = 0; i < nbd; ++i) ftab[i].resize(0);
@@ -346,7 +346,7 @@
       }
 
       for (size_type i = 0; i < nbd; i++) { // Loop on dofs
-        fd.pnd = pf->dof_types()[i];
+       fd.pnd = pf->dof_types()[i];
         fd.part = get_dof_partition(cv);
 
         if (fd.pnd == andof) {              // If the dof is a global one
@@ -363,9 +363,8 @@
         } else {                            // For a standard linkable dof
           pgp->transform(linked_mesh().points_of_convex(cv), i, P);
           size_type idof = nbdof;
-          if (ftab[i].size()) {
+          // if (ftab[i].size()) { // sauf si elt de taille < N ...
             linked_mesh().neighbours_of_convex(cv, ftab[i], s);
-          
             for (size_type ncv : s) { // For each neighbour
                                       // control if the dof already exists.
               fd.ind_node = dof_nodes[ncv].search_node(P);
@@ -374,7 +373,7 @@
                 if (it != dof_sorts[ncv].end()) { idof = it->second; break; }
               }
             }
-          }
+           // }
           if (idof == nbdof) nbdof += Qdim / pf->target_dim();
           itab[i] = idof;
           fd.ind_node = dof_nodes[cv].add_node(P);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]