From: Luca Heltai Date: Sat, 9 Apr 2016 12:23:54 +0000 (+0200) Subject: Moved CompositionManifold to its own directory. X-Git-Tag: v8.5.0-rc1~1116^2~3 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fc78fb044a0a5decc884271be5623f357d606345;p=dealii.git Moved CompositionManifold to its own directory. --- diff --git a/include/deal.II/grid/composition_manifold.h b/include/deal.II/grid/composition_manifold.h new file mode 100644 index 0000000000..c9809cd9a0 --- /dev/null +++ b/include/deal.II/grid/composition_manifold.h @@ -0,0 +1,183 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2016 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + +#ifndef dealii__composition_manifold_h +#define dealii__composition_manifold_h + + +/*---------------------------- composition_manifold.h ------------*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +DEAL_II_NAMESPACE_OPEN + +/** + * CompositionManifold. Take two ChartManifold objects, and make + * their composition. The CompositionManifold object is a + * ChartManifold going from the chart of the first ChartManifold to + * the embedding space of the second ChartManifold. If the first + * ChartManifold is periodic, so is the resulting ChartManifold, with + * the same periodicity. Periodicity on the second ChartManifold is not + * allowed, and the constructor will throw an axception if the second + * Manifold is periodic. + * + * This class only works for dim <= chartdim <= intermediate_spacedim + * <= spacedim. If you try to instantiate anything different, an + * Exception will be thrown in one of the ChartManifold classes that + * violates this condition. + * + * Given the ChartManifold F and the ChartManifold G, this class + * represents the composition of G after F. + * + * The template parameters have the following meaning: + * + * @tparam dim The dimension of the resulting ChartManifold + * @tparam spacedim The space dimension of the resulting ChartManifold + * @tparam chartdim The chart dimension of the resulting ChartManifold + * @tparam intermediate_dim The space dimension of the first ChartManifold + * @tparam dim1 The dimension of the first ChartManifold, which coincides also + * with the chart dimension of the second ChartManifold + * @tparam dim2 The dimension of the second ChartManifold + * + * @ingroup manifold + * @author Luca Heltai, Timo Heister, 2016 + */ +template +class CompositionManifold : public ChartManifold +{ +public: + + /** + * Construct the composition of the two given manifolds. + */ + CompositionManifold(const ChartManifold &F, + const ChartManifold &G); + + /** + * Pull back the given point in spacedim to the Euclidean chartdim + * dimensional space. This function calls the pull_back() function + * of G, and then the pull_back() function of F. + */ + virtual + Point + pull_back(const Point &space_point) const; + + + /** + * Push forward the chartdim dimensional point to a spacedim + * Euclidean point. The function calls first the push_forward() of + * F, and then the push_foward() of G. + */ + virtual + Point + push_forward(const Point &chart_point) const; + + /** + * Return the derivative of the composition of G after F. + */ + virtual + DerivativeForm<1,chartdim,spacedim> + push_forward_gradient(const Point &chart_point) const; + +private: + /** + * The first ChartManifold. + */ + SmartPointer, + CompositionManifold > F; + + + /** + * The second ChartManifold. + */ + SmartPointer, + CompositionManifold > G; +}; + + +/*------------------Template Implementations------------------------*/ + +template +CompositionManifold::CompositionManifold +(const ChartManifold &F, + const ChartManifold &G) : + ChartManifold(F.get_periodicity()), + F(&F), + G(&G) +{ + // We don't know what to do with a periodicity in the second manifold, so + // throw an assertion if the second manifold is periodic + Assert(G.get_periodicity().norm() == 0.0, + ExcMessage("The second manifold cannot be periodic.")); +} + + + +template +Point +CompositionManifold::pull_back(const Point &space_point) const +{ + return F->pull_back(G->pull_back(space_point)); +} + + + +template +Point +CompositionManifold::push_forward(const Point &chart_point) const +{ + return G->push_forward(F->push_forward(chart_point)); +} + + + +template +DerivativeForm<1,chartdim,spacedim> +CompositionManifold::push_forward_gradient(const Point &chart_point) const +{ + DerivativeForm<1,chartdim,intermediate_dim> DF = + F->push_forward_gradient(chart_point); + + DerivativeForm<1,intermediate_dim,spacedim> DG = + G->push_forward_gradient(F->push_forward(chart_point)); + + DerivativeForm<1,chartdim,spacedim> DF_DG; + + for (unsigned int d=0; d periodicity; - DeclException4(ExcPeriodicBox, int, Point, double, double, + DeclException3(ExcPeriodicBox, int, Point, double, << "The component number " << arg1 << " of the point [ " << arg2 - << " ] is not in the interval [ " << -arg4 - << ", " << arg3 << "), bailing out."); + << " ] is not in the interval [ 0, " << arg3 << "), bailing out."); /** * Relative tolerance. This tolerance is used to compute distances in double diff --git a/source/grid/CMakeLists.txt b/source/grid/CMakeLists.txt index 18abd37211..8279350bf2 100644 --- a/source/grid/CMakeLists.txt +++ b/source/grid/CMakeLists.txt @@ -26,7 +26,6 @@ SET(_src intergrid_map.cc manifold.cc manifold_lib.cc - manifold_tools.cc persistent_tria.cc tria_accessor.cc tria_boundary.cc @@ -46,7 +45,6 @@ SET(_inst intergrid_map.inst.in manifold.inst.in manifold_lib.inst.in - manifold_tools.inst.in tria_accessor.inst.in tria_boundary.inst.in tria_boundary_lib.inst.in diff --git a/source/grid/manifold.cc b/source/grid/manifold.cc index bd9174d31f..07ff568521 100644 --- a/source/grid/manifold.cc +++ b/source/grid/manifold.cc @@ -424,9 +424,9 @@ get_new_point (const Quadrature &quad) const for (unsigned int i=0; i= -tolerance*periodicity.norm()), - ExcPeriodicBox(d, surrounding_points[i], periodicity[i], tolerance*periodicity.norm())); + Assert( (surrounding_points[i][d] < periodicity[d]+tolerance*periodicity[d]) || + (surrounding_points[i][d] >= -tolerance*periodicity[d]), + ExcPeriodicBox(d, surrounding_points[i], periodicity[i])); } // compute the weighted average point, possibly taking into account periodicity diff --git a/source/grid/manifold_tools.cc b/source/grid/manifold_tools.cc deleted file mode 100644 index ac98682a5b..0000000000 --- a/source/grid/manifold_tools.cc +++ /dev/null @@ -1,93 +0,0 @@ -// --------------------------------------------------------------------- -// -// Copyright (C) 1998 - 2016 by the deal.II authors -// -// This file is part of the deal.II library. -// -// The deal.II library is free software; you can use it, redistribute -// it, and/or modify it under the terms of the GNU Lesser General -// Public License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// The full text of the license can be found in the file LICENSE at -// the top level of the deal.II distribution. -// -// --------------------------------------------------------------------- - -#include -#include -#include -#include -#include -#include -#include - -DEAL_II_NAMESPACE_OPEN - - -/* -------------------------- CompositionManifold --------------------- */ - -template -CompositionManifold::CompositionManifold -(const ChartManifold &F, - const ChartManifold &G) : - ChartManifold(F.get_periodicity()), - F(&F), - G(&G) -{ - // We don't know what to do with a periodicity in the second manifold, so - // throw an assertion if the second manifold is periodic - Assert(G.get_periodicity().norm() == 0.0, - ExcMessage("The second manifold cannot be periodic.")); -} - - - -template -Point -CompositionManifold::pull_back(const Point &space_point) const -{ - return F->pull_back(G->pull_back(space_point)); -} - - - -template -Point -CompositionManifold::push_forward(const Point &chart_point) const -{ - return G->push_forward(F->push_forward(chart_point)); -} - - - -template -DerivativeForm<1,chartdim,spacedim> -CompositionManifold::push_forward_gradient(const Point &chart_point) const -{ - DerivativeForm<1,chartdim,intermediate_dim> DF = - F->push_forward_gradient(chart_point); - - DerivativeForm<1,intermediate_dim,spacedim> DG = - G->push_forward_gradient(F->push_forward(chart_point)); - - DerivativeForm<1,chartdim,spacedim> DF_DG; - - for (unsigned int d=0; d; -#endif - } - diff --git a/tests/manifold/composition_manifold_01.cc b/tests/manifold/composition_manifold_01.cc index 19af4633b4..433b7291ae 100644 --- a/tests/manifold/composition_manifold_01.cc +++ b/tests/manifold/composition_manifold_01.cc @@ -18,7 +18,7 @@ // all include files you need here #include -#include +#include int main () diff --git a/tests/manifold/composition_manifold_02.cc b/tests/manifold/composition_manifold_02.cc index 38cfb6c18a..fc96261845 100644 --- a/tests/manifold/composition_manifold_02.cc +++ b/tests/manifold/composition_manifold_02.cc @@ -19,7 +19,7 @@ // all include files you need here #include -#include +#include int main () diff --git a/tests/manifold/composition_manifold_03.cc b/tests/manifold/composition_manifold_03.cc index 38bb5945e8..08eeef5609 100644 --- a/tests/manifold/composition_manifold_03.cc +++ b/tests/manifold/composition_manifold_03.cc @@ -19,7 +19,7 @@ // all include files you need here #include -#include +#include int main () diff --git a/tests/manifold/composition_manifold_04.cc b/tests/manifold/composition_manifold_04.cc index 107a5a2d55..c0d3c33b63 100644 --- a/tests/manifold/composition_manifold_04.cc +++ b/tests/manifold/composition_manifold_04.cc @@ -19,7 +19,7 @@ // all include files you need here #include -#include +#include int main ()