]> https://gitweb.dealii.org/ - dealii.git/commitdiff
check for point in cell
authorThomas Richter <thomas.richter@iwr.uni-heidelberg.de>
Thu, 12 Oct 2000 07:32:16 +0000 (07:32 +0000)
committerThomas Richter <thomas.richter@iwr.uni-heidelberg.de>
Thu, 12 Oct 2000 07:32:16 +0000 (07:32 +0000)
git-svn-id: https://svn.dealii.org/trunk@3414 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/include/grid/tria_accessor.h
deal.II/deal.II/source/grid/tria_accessor.cc

index 293e1d4b833fc4f6b21ba64473a846464119f33f..017e7f4edb98d1f84c962dc12c63df7c1bf37eb7 100644 (file)
@@ -130,6 +130,9 @@ class TriaAccessor
     bool operator != (const TriaAccessor &) const;
     
   public:
+
+    double ind_value;
+    
                                     /**
                                      * Data type to be used for passing
                                      * parameters from iterators to the
@@ -1929,6 +1932,15 @@ class CellAccessor :  public TriaObjectAccessor<dim,dim>
                                      * of a cell).
                                      */
     bool active () const;
+
+                                    /**
+                                     * Test whether the point p is inside
+                                     * this cell.
+                                     * Up to now, this function is only
+                                     * implemented for 2d
+                                     */
+    bool point_inside(const Point<dim> &p) const;
+    
     
                                     /**
                                      *  Exception
index a6f9354fc3a97d11cc64e2ff1986e0922cf6c900..81c74c43528d1938621b025a250615b4e5b7d6bc 100644 (file)
@@ -1566,6 +1566,12 @@ void CellAccessor<1>::set_material_id (const unsigned char mat_id) const
 };
 
 
+template <>
+bool CellAccessor<1>::point_inside (const Point<1> &) const
+{
+  Assert (false, ExcNotImplemented() );
+}
+
 #endif
 
 
@@ -1599,6 +1605,20 @@ void CellAccessor<2>::set_material_id (const unsigned char mat_id) const
     = mat_id;                                           
 };
 
+template <>
+bool CellAccessor<2>::point_inside (const Point<2> &p) const
+{
+  for (unsigned int k=0;k<4;++k)
+    {
+      const Point<2> to_p = p-vertex(k);
+      const Point<2> face = vertex((k+1)%4)-vertex(k);
+      if (-face(1)*to_p(0)+face(0)*to_p(1)<0)
+       return false;
+    }
+  return true;
+}
+
+
 #endif
 
 
@@ -1634,6 +1654,13 @@ void CellAccessor<3>::set_material_id (const unsigned char mat_id) const
     = mat_id;                                           
 };
 
+template <>
+bool CellAccessor<3>::point_inside (const Point<3> &) const
+{
+  Assert (false, ExcNotImplemented() );
+}
+
+
 #endif
 
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.