]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Move a bunch of internal functions into anonymous namespaces.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 24 Aug 2015 02:36:48 +0000 (21:36 -0500)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Tue, 25 Aug 2015 01:57:18 +0000 (20:57 -0500)
Like the MappingQ1 class, MappingFEField had a bunch of internal functions
that might as well live inside the .cc file only in an anonymous namespace.
Do so.

include/deal.II/fe/mapping_fe_field.h
source/fe/mapping_fe_field.cc

index cbbc552f54c0af6debda726c60f89b54458d6526..85cbfe41fb86d175764abe61318c97bd01d1d105 100644 (file)
@@ -445,29 +445,6 @@ private:
    * @}
    */
 
-  /**
-   * This function and the next allow to generate the transform require by the
-   * virtual transform() in mapping, but unfortunately in C++ one cannot
-   * declare a virtual template function.
-   */
-  template <int rank>
-  void
-  transform_fields(const VectorSlice<const std::vector<Tensor<rank,dim> > > input,
-                   VectorSlice<std::vector<Tensor<rank,spacedim> > >        output,
-                   const typename Mapping<dim,spacedim>::InternalDataBase  &internal,
-                   const MappingType                                        mapping_type) const;
-
-
-  /**
-   * See transform_fields() above.
-   */
-  template <int rank>
-  void
-  transform_differential_forms(const VectorSlice<const std::vector<DerivativeForm<rank, dim,spacedim> > > input,
-                               VectorSlice<std::vector<Tensor<rank+1, spacedim> > >                       output,
-                               const typename Mapping<dim,spacedim>::InternalDataBase                    &mapping_data,
-                               const MappingType                                                          mapping_type) const;
-
 
   /**
    * Reference to the vector of shifts.
index 2c267e8f36b9a92ec1f06ad2b47020eee77dfeec..e2b99103bb16b8efa93e7777c4394d3b2e6c5f95 100644 (file)
@@ -980,6 +980,104 @@ fill_fe_subface_values (const typename Triangulation<dim,spacedim>::cell_iterato
 }
 
 
+namespace
+{
+  template<int dim, int spacedim, int rank, class VECTOR, class DH>
+  void
+  transform_fields(const VectorSlice<const std::vector<Tensor<rank,dim> > > input,
+                   VectorSlice<std::vector<Tensor<rank,spacedim> > > output,
+                   const typename Mapping<dim,spacedim>::InternalDataBase &mapping_data,
+                   const MappingType mapping_type)
+  {
+    AssertDimension (input.size(), output.size());
+    Assert ((dynamic_cast<const typename MappingFEField<dim,spacedim,VECTOR,DH>::InternalData *>(&mapping_data) != 0),
+            ExcInternalError());
+    const typename MappingFEField<dim,spacedim,VECTOR,DH>::InternalData
+    &data = static_cast<const typename MappingFEField<dim,spacedim,VECTOR,DH>::InternalData &>(mapping_data);
+
+    switch (mapping_type)
+      {
+      case mapping_contravariant:
+      {
+        Assert (data.update_each & update_contravariant_transformation,
+                typename FEValuesBase<dim>::ExcAccessToUninitializedField("update_contravariant_transformation"));
+
+        for (unsigned int i=0; i<output.size(); ++i)
+          output[i] = apply_transformation(data.contravariant[i], input[i]);
+
+        return;
+      }
+
+      case mapping_piola:
+      {
+        Assert (data.update_each & update_contravariant_transformation,
+                typename FEValuesBase<dim>::ExcAccessToUninitializedField("update_contravariant_transformation"));
+        Assert (data.update_each & update_volume_elements,
+                typename FEValuesBase<dim>::ExcAccessToUninitializedField("update_volume_elements"));
+        Assert (rank==1, ExcMessage("Only for rank 1"));
+        for (unsigned int i=0; i<output.size(); ++i)
+          {
+            output[i] = apply_transformation(data.contravariant[i], input[i]);
+            output[i] /= data.volume_elements[i];
+          }
+        return;
+      }
+
+
+      //We still allow this operation as in the
+      //reference cell Derivatives are Tensor
+      //rather than DerivativeForm
+      case mapping_covariant:
+      {
+        Assert (data.update_each & update_contravariant_transformation,
+                typename FEValuesBase<dim>::ExcAccessToUninitializedField("update_contravariant_transformation"));
+
+        for (unsigned int i=0; i<output.size(); ++i)
+          output[i] = apply_transformation(data.covariant[i], input[i]);
+
+        return;
+      }
+
+      default:
+        Assert(false, ExcNotImplemented());
+      }
+  }
+
+
+  template<int dim, int spacedim, int rank, class VECTOR, class DH>
+  void
+  transform_differential_forms(const VectorSlice<const std::vector<DerivativeForm<rank, dim,spacedim> > >    input,
+                               VectorSlice<std::vector<Tensor<rank+1, spacedim> > > output,
+                               const typename Mapping<dim,spacedim>::InternalDataBase &mapping_data,
+                               const MappingType mapping_type)
+  {
+
+    AssertDimension (input.size(), output.size());
+    Assert ((dynamic_cast<const typename MappingFEField<dim,spacedim,VECTOR,DH>::InternalData *>(&mapping_data) != 0),
+            ExcInternalError());
+    const typename MappingFEField<dim,spacedim,VECTOR,DH>::InternalData
+    &data = static_cast<const typename MappingFEField<dim,spacedim,VECTOR,DH>::InternalData &>(mapping_data);
+
+    switch (mapping_type)
+      {
+      case mapping_covariant:
+      {
+        Assert (data.update_each & update_contravariant_transformation,
+                typename FEValuesBase<dim>::ExcAccessToUninitializedField("update_contravariant_transformation"));
+
+        for (unsigned int i=0; i<output.size(); ++i)
+          output[i] = apply_transformation(data.covariant[i], input[i]);
+
+        return;
+      }
+      default:
+        Assert(false, ExcNotImplemented());
+      }
+
+  }
+}
+
+
 
 template<int dim, int spacedim, class VECTOR, class DH>
 void
@@ -991,7 +1089,7 @@ MappingFEField<dim,spacedim,VECTOR,DH>::transform (
 {
   AssertDimension (input.size(), output.size());
 
-  transform_fields(input, output, mapping_data, mapping_type);
+  transform_fields<dim,spacedim,1,VECTOR,DH>(input, output, mapping_data, mapping_type);
 }
 
 
@@ -1006,7 +1104,7 @@ MappingFEField<dim,spacedim,VECTOR,DH>::transform (
 {
   AssertDimension (input.size(), output.size());
 
-  transform_differential_forms(input, output, mapping_data, mapping_type);
+  transform_differential_forms<dim,spacedim,1,VECTOR,DH>(input, output, mapping_data, mapping_type);
 
 }
 
@@ -1092,102 +1190,6 @@ void MappingFEField<dim,spacedim,VECTOR,DH>::transform (
 }
 
 
-template<int dim, int spacedim, class VECTOR, class DH>
-template < int rank >
-void MappingFEField<dim,spacedim,VECTOR,DH>::transform_fields(
-  const VectorSlice<const std::vector<Tensor<rank,dim> > > input,
-  VectorSlice<std::vector<Tensor<rank,spacedim> > > output,
-  const typename Mapping<dim,spacedim>::InternalDataBase &mapping_data,
-  const MappingType mapping_type) const
-{
-  AssertDimension (input.size(), output.size());
-  Assert (dynamic_cast<const InternalData *>(&mapping_data) != 0,
-          ExcInternalError());
-  const InternalData &data = static_cast<const InternalData &>(mapping_data);
-
-  switch (mapping_type)
-    {
-    case mapping_contravariant:
-    {
-      Assert (data.update_each & update_contravariant_transformation,
-              typename FEValuesBase<dim>::ExcAccessToUninitializedField("update_contravariant_transformation"));
-
-      for (unsigned int i=0; i<output.size(); ++i)
-        output[i] = apply_transformation(data.contravariant[i], input[i]);
-
-      return;
-    }
-
-    case mapping_piola:
-    {
-      Assert (data.update_each & update_contravariant_transformation,
-              typename FEValuesBase<dim>::ExcAccessToUninitializedField("update_contravariant_transformation"));
-      Assert (data.update_each & update_volume_elements,
-              typename FEValuesBase<dim>::ExcAccessToUninitializedField("update_volume_elements"));
-      Assert (rank==1, ExcMessage("Only for rank 1"));
-      for (unsigned int i=0; i<output.size(); ++i)
-        {
-          output[i] = apply_transformation(data.contravariant[i], input[i]);
-          output[i] /= data.volume_elements[i];
-        }
-      return;
-    }
-
-
-    //We still allow this operation as in the
-    //reference cell Derivatives are Tensor
-    //rather than DerivativeForm
-    case mapping_covariant:
-    {
-      Assert (data.update_each & update_contravariant_transformation,
-              typename FEValuesBase<dim>::ExcAccessToUninitializedField("update_contravariant_transformation"));
-
-      for (unsigned int i=0; i<output.size(); ++i)
-        output[i] = apply_transformation(data.covariant[i], input[i]);
-
-      return;
-    }
-
-    default:
-      Assert(false, ExcNotImplemented());
-    }
-}
-
-
-template<int dim, int spacedim, class VECTOR, class DH>
-template < int rank >
-void MappingFEField<dim,spacedim,VECTOR,DH>::transform_differential_forms(
-  const VectorSlice<const std::vector<DerivativeForm<rank, dim,spacedim> > >    input,
-  VectorSlice<std::vector<Tensor<rank+1, spacedim> > > output,
-  const typename Mapping<dim,spacedim>::InternalDataBase &mapping_data,
-  const MappingType mapping_type) const
-{
-
-  AssertDimension (input.size(), output.size());
-  Assert (dynamic_cast<const InternalData *>(&mapping_data) != 0,
-          ExcInternalError());
-  const InternalData &data = static_cast<const InternalData &>(mapping_data);
-
-  switch (mapping_type)
-    {
-    case mapping_covariant:
-    {
-      Assert (data.update_each & update_contravariant_transformation,
-              typename FEValuesBase<dim>::ExcAccessToUninitializedField("update_contravariant_transformation"));
-
-      for (unsigned int i=0; i<output.size(); ++i)
-        output[i] = apply_transformation(data.covariant[i], input[i]);
-
-      return;
-    }
-    default:
-      Assert(false, ExcNotImplemented());
-    }
-
-}
-
-
-
 template<int dim, int spacedim, class VECTOR, class DH>
 Point<spacedim>
 MappingFEField<dim,spacedim,VECTOR,DH>::

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.