]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
introduce function transform() into Mappings
authorkanschat <kanschat@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 5 Jan 2009 16:52:48 +0000 (16:52 +0000)
committerkanschat <kanschat@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 5 Jan 2009 16:52:48 +0000 (16:52 +0000)
git-svn-id: https://svn.dealii.org/trunk@18075 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/deal.II/include/fe/mapping.h
deal.II/deal.II/include/fe/mapping_cartesian.h
deal.II/deal.II/include/fe/mapping_q.h
deal.II/deal.II/include/fe/mapping_q1.h
deal.II/deal.II/source/fe/mapping_cartesian.cc
deal.II/deal.II/source/fe/mapping_q.cc
deal.II/deal.II/source/fe/mapping_q1.cc

index 6ce98fb94ab02ee6a6114f9f3307d159450619f8..fe9ad1f52e5976e2a4b5f20550f8a132770d3f17 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 by the deal.II authors
+//    Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -34,6 +34,37 @@ template <int dim, int spacedim> class FESubfaceValues;
 
 //TODO: Offset in transform functions should be replaced by initializing VectorSlice correctly
 
+                                     /**
+                                      * The transformation type used
+                                      * for the Mapping::transform() functions.
+                                      *
+                                      * Special finite elements may
+                                      * need special Mapping from the
+                                      * reference cell to the actual
+                                      * mesh cell. In order to be most
+                                      * flexible, this enum provides
+                                      * an extensible interface for
+                                      * arbitrary
+                                      * transformations. Nevertheless,
+                                      * these must be implemented in
+                                      * the transform() functions of
+                                      * inheriting classes in order to
+                                      * work.
+                                      */
+enum MappingType
+{
+/// Covariant mapping
+      mapping_covariant = 0x0001,
+/// Contravariant mapping
+      mapping_contravariant = 0x0002,
+/// The Piola transform usually used for Hdiv elements
+      mapping_piola = 0x0003,
+/// The mapping used for Raviart-Thomas elements
+      mapping_raviart_thomas = mapping_piola,
+/// The mapping used for BDM elements
+      mapping_bdm = mapping_piola
+};
+
 
 /**
  * Abstract base class for mapping classes.
@@ -256,6 +287,31 @@ class Mapping : public Subscriptor
         bool first_cell;
     };
     
+                                     /**
+                                      * Transform a field of
+                                      * vectors accorsing to
+                                      * the selected MappingType.
+                                      */
+    virtual
+    void
+    transform (const VectorSlice<const std::vector<Tensor<1,dim> > > input,
+               VectorSlice<std::vector<Tensor<1,spacedim> > >             output,
+               const InternalDataBase &internal,
+               const MappingType type) const = 0;
+
+
+                                     /**
+                                      * Transform a field of
+                                      * rank two tensors accorsing to
+                                      * the selected MappingType.
+                                      */
+    virtual
+    void
+    transform (const VectorSlice<const std::vector<Tensor<2,dim> > > input,
+               VectorSlice<std::vector<Tensor<2,spacedim> > >             output,
+               const InternalDataBase &internal,
+               const MappingType type) const = 0;
+    
                                     /**
                                      * Transform a field of covariant
                                      * vectors. The covariant
@@ -307,6 +363,8 @@ class Mapping : public Subscriptor
                          const unsigned int                 offset,
                         VectorSlice<std::vector<Tensor<2,spacedim> > >      output,
                         const InternalDataBase &internal) const = 0;
+
+//TODO: The argument list here seems wrong
     
                                     /**
                                      * Transform a field of
index 6656512626e2b4e420f91f3ff44ad843ba55912c..34c14b6b2aef7fec716d5f6a12b522480df9bf6b 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 by the deal.II authors
+//    Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -92,6 +92,18 @@ class MappingCartesian : public Mapping<dim,spacedim>
                            std::vector<Point<dim> >        &normal_vectors,
                            std::vector<double>             &cell_JxW_values) const ;
 
+    virtual void
+    transform (const VectorSlice<const std::vector<Tensor<1,dim> > > input,
+               VectorSlice<std::vector<Tensor<1,spacedim> > > output,
+               const typename Mapping<dim,spacedim>::InternalDataBase &internal,
+              const MappingType type) const;
+
+    virtual void
+    transform (const VectorSlice<const std::vector<Tensor<2,dim> > > input,
+               VectorSlice<std::vector<Tensor<2,spacedim> > > output,
+               const typename Mapping<dim,spacedim>::InternalDataBase &internal,
+              const MappingType type) const;
+    
 
     virtual void
     transform_covariant (const VectorSlice<const std::vector<Tensor<1,spacedim> > > input,
index 0ae4531ef9118d0e74ac8d7e7a488e83d3687e7d..6995b18a838b9e0bd4bfdbb0d2267be1285f206e 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by the deal.II authors
+//    Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -116,6 +116,18 @@ class MappingQ : public MappingQ1<dim,spacedim>
       const typename Triangulation<dim,spacedim>::cell_iterator &cell,
       const Point<spacedim>                            &p) const;
 
+    virtual void
+    transform (const VectorSlice<const std::vector<Tensor<1,dim> > > input,
+               VectorSlice<std::vector<Tensor<1,spacedim> > > output,
+               const typename Mapping<dim,spacedim>::InternalDataBase &internal,
+              const MappingType type) const;
+
+    virtual void
+    transform (const VectorSlice<const std::vector<Tensor<2,dim> > > input,
+               VectorSlice<std::vector<Tensor<2,spacedim> > > output,
+               const typename Mapping<dim,spacedim>::InternalDataBase &internal,
+              const MappingType type) const;
+    
                                     /**
                                      * Implementation of the
                                      * interface in Mapping.
index 7935b2854cf6dc983dde44ca153b655037d96f33..73c8b50321c0ece9e8be2aef973b452c48bb06b3 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by the deal.II authors
+//    Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -77,6 +77,18 @@ class MappingQ1 : public Mapping<dim,spacedim>
       const typename Triangulation<dim,spacedim>::cell_iterator &cell,
       const Point<spacedim>                            &p) const;
     
+    virtual void
+    transform (const VectorSlice<const std::vector<Tensor<1,dim> > > input,
+               VectorSlice<std::vector<Tensor<1,spacedim> > > output,
+               const typename Mapping<dim,spacedim>::InternalDataBase &internal,
+              const MappingType type) const;
+
+    virtual void
+    transform (const VectorSlice<const std::vector<Tensor<2,dim> > > input,
+               VectorSlice<std::vector<Tensor<2,spacedim> > > output,
+               const typename Mapping<dim,spacedim>::InternalDataBase &internal,
+              const MappingType type) const;
+    
     virtual void
     transform_covariant (const VectorSlice<const std::vector<Tensor<1,dim> > > input,
                          const unsigned int                 offset,
index 604f819c0331ae02cade60c29ab34f664c66da9c..ffb5c9ab23697f892035b582e51cfc61fe8ef6a8 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by the deal.II authors
+//    Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -504,6 +504,50 @@ MappingCartesian<1>::fill_fe_subface_values (const Triangulation<1>::cell_iterat
 #endif
 
 
+template<int dim, int spacedim>
+void
+MappingCartesian<dim,spacedim>::transform (
+  const VectorSlice<const std::vector<Tensor<1,dim> > > input,
+  VectorSlice<std::vector<Tensor<1,spacedim> > > output,
+  const typename Mapping<dim,spacedim>::InternalDataBase &internal,
+  const MappingType mapping_type) const
+{
+  switch (mapping_type)
+    {
+      case mapping_covariant:
+           transform_covariant(input, 0, output, internal);
+           return;
+//       case mapping_contravariant:
+//         transform_contravariant(input, 0, output, internal);
+//         return;
+      default:
+           Assert(false, ExcNotImplemented());
+    }
+}
+
+template<int dim, int spacedim>
+void
+MappingCartesian<dim,spacedim>::transform (
+  const VectorSlice<const std::vector<Tensor<2,dim> > > input,
+  VectorSlice<std::vector<Tensor<2,spacedim> > > output,
+  const typename Mapping<dim,spacedim>::InternalDataBase &internal,
+  const MappingType mapping_type) const
+{
+  switch (mapping_type)
+    {
+      case mapping_covariant:
+           transform_covariant(input, 0, output, internal);
+           return;
+//       case mapping_contravariant:
+//         transform_contravariant(input, 0, output, internal);
+//         return;
+      default:
+           Assert(false, ExcNotImplemented());
+    }
+}
+
+
+
 template<int dim, int spacedim>
 void
 MappingCartesian<dim, spacedim>::transform_covariant (
index 880139da6ac2c9f46cca99c528eb46b8415d3763..48d14df0e2dbe8eb908147cfa3c569311970ed07 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by the deal.II authors
+//    Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -1201,6 +1201,50 @@ add_quad_support_points(const typename Triangulation<dim,spacedim>::cell_iterato
 }
 
 
+template<int dim, int spacedim>
+void
+MappingQ<dim,spacedim>::transform (
+  const VectorSlice<const std::vector<Tensor<1,dim> > > input,
+  VectorSlice<std::vector<Tensor<1,spacedim> > > output,
+  const typename Mapping<dim,spacedim>::InternalDataBase &internal,
+  const MappingType mapping_type) const
+{
+  switch (mapping_type)
+    {
+      case mapping_covariant:
+           transform_covariant(input, 0, output, internal);
+           return;
+//       case mapping_contravariant:
+//         transform_contravariant(input, 0, output, internal);
+//         return;
+      default:
+           Assert(false, ExcNotImplemented());
+    }
+}
+
+
+template<int dim, int spacedim>
+void
+MappingQ<dim,spacedim>::transform (
+  const VectorSlice<const std::vector<Tensor<2,dim> > > input,
+  VectorSlice<std::vector<Tensor<2,spacedim> > > output,
+  const typename Mapping<dim,spacedim>::InternalDataBase &internal,
+  const MappingType mapping_type) const
+{
+  switch (mapping_type)
+    {
+      case mapping_covariant:
+           transform_covariant(input, 0, output, internal);
+           return;
+//       case mapping_contravariant:
+//         transform_contravariant(input, 0, output, internal);
+//         return;
+      default:
+           Assert(false, ExcNotImplemented());
+    }
+}
+
+
 
 template<int dim, int spacedim>
 void
index e116a9311d7b9033726714799fad870082c26515..17f59a091eb04f0031d686ba57dbe03306854f56 100644 (file)
@@ -2,7 +2,7 @@
 //    $Id$
 //    Version: $Name$
 //
-//    Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by the deal.II authors
+//    Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by the deal.II authors
 //
 //    This file is subject to QPL and may not be  distributed
 //    without copyright and license information. Please refer
@@ -1165,6 +1165,49 @@ MappingQ1<1,2>::fill_fe_subface_values (const Triangulation<1,2>::cell_iterator
 #endif
 
 
+template<int dim, int spacedim>
+void
+MappingQ1<dim,spacedim>::transform (
+  const VectorSlice<const std::vector<Tensor<1,dim> > > input,
+  VectorSlice<std::vector<Tensor<1,spacedim> > > output,
+  const typename Mapping<dim,spacedim>::InternalDataBase &internal,
+  const MappingType mapping_type) const
+{
+  switch (mapping_type)
+    {
+      case mapping_covariant:
+           transform_covariant(input, 0, output, internal);
+           return;
+//       case mapping_contravariant:
+//         transform_contravariant(input, 0, output, internal);
+//         return;
+      default:
+           Assert(false, ExcNotImplemented());
+    }
+}
+
+template<int dim, int spacedim>
+void
+MappingQ1<dim,spacedim>::transform (
+  const VectorSlice<const std::vector<Tensor<2,dim> > > input,
+  VectorSlice<std::vector<Tensor<2,spacedim> > > output,
+  const typename Mapping<dim,spacedim>::InternalDataBase &internal,
+  const MappingType mapping_type) const
+{
+  switch (mapping_type)
+    {
+      case mapping_covariant:
+           transform_covariant(input, 0, output, internal);
+           return;
+//       case mapping_contravariant:
+//         transform_contravariant(input, 0, output, internal);
+//         return;
+      default:
+           Assert(false, ExcNotImplemented());
+    }
+}
+
+
 template<int dim, int spacedim>
 void
 MappingQ1<dim,spacedim>::transform_covariant (

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.