get_tangent_vector (const Point<spacedim> &x1,
const Point<spacedim> &x2) const;
+ /**
+ * Return the periodicity of this Manifold.
+ */
+ const Point<spacedim> &get_periodicity() const;
+
private:
/**
* The periodicity of this Manifold. Periodicity affects the way a middle
get_tangent_vector (const Point<spacedim> &x1,
const Point<spacedim> &x2) const;
+ /**
+ * Return the periodicity associated with the submanifold.
+ */
+ const Point<chartdim> &get_periodicity() const;
+
private:
/**
* The sub_manifold object is used to compute the average of the points in
* 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.
+ * the embedding space of the second ChartManifold. If the first
+ * ChartManifold is periodic, so is the resulting ChartManifold, with
+ * the same periodicity. Notice however that periodicity on the second
+ * ChartManifold is lost during the composition.
*
* This class only works for dim <= chartdim <= intermediate_spacedim
* <= spacedim. If you try to instantiate anything different, an
+template <int dim, int spacedim>
+const Point<spacedim> &
+FlatManifold<dim, spacedim>::get_periodicity() const
+{
+ return periodicity;
+}
+
+
+
template <int dim, int spacedim>
Tensor<1,spacedim>
FlatManifold<dim, spacedim>::get_tangent_vector (const Point<spacedim> &x1,
return result;
}
+template <int dim, int spacedim, int chartdim>
+const Point<chartdim> &
+ChartManifold<dim,spacedim,chartdim>::
+get_periodicity() const
+{
+ return sub_manifold.get_periodicity();
+}
// explicit instantiations
#include "manifold.inst"
/* -------------------------- CompositionManifold --------------------- */
-
-
template <int dim, int spacedim, int chartdim, int intermediate_dim,
int dim1, int dim2>
CompositionManifold<dim,spacedim,chartdim,intermediate_dim,dim1,dim2>::CompositionManifold
(const ChartManifold<dim1, intermediate_dim, chartdim> &F,
const ChartManifold<dim2, spacedim, intermediate_dim> &G) :
+ ChartManifold<dim,spacedim,chartdim>(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 <int dim, int spacedim, int chartdim, int intermediate_dim,
int dim1, int dim2>
return F->pull_back(G->pull_back(space_point));
}
+
+
template <int dim, int spacedim, int chartdim, int intermediate_dim,
int dim1, int dim2>
Point<spacedim>
}
+
template <int dim, int spacedim, int chartdim, int intermediate_dim,
int dim1, int dim2>
DerivativeForm<1,chartdim,spacedim>
}
+
// explicit instantiations
#include "manifold_tools.inst"
//---------------------------- composition_manifold ---------------------------
-// Stress periodicity in CompositionManifold
+// Stress periodicity in CompositionManifold. Compose SphericalManifold with
+// the identity, and make sure periodicity is respected.
#include "../tests.h"
#include <fstream>
unsigned int n_intermediates = 32;
- for (unsigned int n=0; n<2; ++n)
+ out << "set terminal aqua " << 0 << std::endl
+ << "set size ratio -1" << std::endl
+ << "plot '-' with vectors " << std::endl;
+
+ for (unsigned int v=0; v<sp.size(); ++v)
+ out << center << " "
+ << sp[v] << std::endl;
+
+
+ for (unsigned int i=0; i<n_intermediates+1; ++i)
{
- if (n == 1)
- {
- sp.push_back(manifold.push_forward(Point<2>(1.0, numbers::PI/4)));
- sp.push_back(manifold.push_forward(Point<2>(1.0, numbers::PI*3/4)));
- w.push_back(0);
- w.push_back(0);
- }
- out << "set terminal aqua " << n << std::endl
- << "set size ratio -1" << std::endl
- << "plot '-' with vectors " << std::endl;
-
- for (unsigned int v=0; v<sp.size(); ++v)
- out << center << " "
- << sp[v] << std::endl;
-
-
- for (unsigned int i=0; i<n_intermediates+1; ++i)
- {
- w[0] = 1.0-(double)i/((double)n_intermediates);
- w[1] = 1.0 - w[0];
-
- Point<spacedim> ip = manifold.get_new_point(Quadrature<spacedim>(sp, w));
- Tensor<1,spacedim> t1 = manifold.get_tangent_vector(ip, sp[0]);
- Tensor<1,spacedim> t2 = manifold.get_tangent_vector(ip, sp[1]);
-
- out << ip << " "
- << t2 << std::endl;
- }
-
- out << "e" << std::endl;
-
- out << "set terminal aqua " << 2+n << std::endl
- << "set size ratio -1" << std::endl
- << "plot '-' w lp " << std::endl;
-
- for (unsigned int i=0; i<n_intermediates+1; ++i)
- {
- w[0] = 1.0-(double)i/((double)n_intermediates);
- w[1] = 1.0 - w[0];
-
- Point<spacedim> ip = manifold.
- pull_back(manifold.get_new_point(Quadrature<spacedim>(sp, w)));
-
- ip[0] = w[1];
-
- out << ip << std::endl;
- }
- out << "e" << std::endl;
+ w[0] = 1.0-(double)i/((double)n_intermediates);
+ w[1] = 1.0 - w[0];
+
+ Point<spacedim> ip = manifold.get_new_point(Quadrature<spacedim>(sp, w));
+ Tensor<1,spacedim> t1 = manifold.get_tangent_vector(ip, sp[0]);
+ Tensor<1,spacedim> t2 = manifold.get_tangent_vector(ip, sp[1]);
+
+ out << ip << " "
+ << t2 << std::endl;
+ }
+
+ out << "e" << std::endl;
+
+ out << "set terminal aqua " << 1 << std::endl
+ << "set size ratio -1" << std::endl
+ << "plot '-' w lp " << std::endl;
+
+ for (unsigned int i=0; i<n_intermediates+1; ++i)
+ {
+ w[0] = 1.0-(double)i/((double)n_intermediates);
+ w[1] = 1.0 - w[0];
+
+ Point<spacedim> ip = manifold.
+ pull_back(manifold.get_new_point(Quadrature<spacedim>(sp, w)));
+
+ ip[0] = w[1];
+
+ out << ip << std::endl;
}
+ out << "e" << std::endl;
return 0;
}
+
+set terminal aqua 0
+set size ratio -1
+plot '-' with vectors
+0.00000 0.00000 0.707107 -0.707107
+0.00000 0.00000 0.707107 0.707107
+0.707107 -0.707107 1.11072 1.11072
+0.740951 -0.671559 1.02192 1.12751
+0.773010 -0.634393 0.934221 1.13835
+0.803208 -0.595699 0.847998 1.14339
+0.831470 -0.555570 0.763602 1.14281
+0.857729 -0.514103 0.681371 1.13680
+0.881921 -0.471397 0.601630 1.12557
+0.903989 -0.427555 0.524689 1.10936
+0.923880 -0.382683 0.450838 1.08842
+0.941544 -0.336890 0.380352 1.06301
+0.956940 -0.290285 0.313485 1.03342
+0.970031 -0.242980 0.250472 0.999942
+0.980785 -0.195090 0.191529 0.962884
+0.989177 -0.146730 0.136850 0.922566
+0.995185 -0.0980171 0.0866053 0.879318
+0.998795 -0.0490677 0.0409463 0.833480
+1.00000 -2.44929e-16 1.92367e-16 0.785398
+0.998795 0.0490677 -0.0361291 0.735424
+0.995185 0.0980171 -0.0673597 0.683914
+0.989177 0.146730 -0.0936340 0.631229
+0.980785 0.195090 -0.114918 0.577730
+0.970031 0.242980 -0.131200 0.523779
+0.956940 0.290285 -0.142493 0.469737
+0.941544 0.336890 -0.148833 0.415961
+0.923880 0.382683 -0.150279 0.362807
+0.903989 0.427555 -0.146913 0.310621
+0.881921 0.471397 -0.138838 0.259747
+0.857729 0.514103 -0.126180 0.210518
+0.831470 0.555570 -0.109086 0.163259
+0.803208 0.595699 -0.0877240 0.118282
+0.773010 0.634393 -0.0622814 0.0758901
+0.740951 0.671559 -0.0329651 0.0363714
+0.707107 0.707107 0.00000 0.00000
+e
+set terminal aqua 1
+set size ratio -1
+plot '-' w lp
+0.00000 5.49779
+0.0312500 5.54687
+0.0625000 5.59596
+0.0937500 5.64505
+0.125000 5.69414
+0.156250 5.74322
+0.187500 5.79231
+0.218750 5.84140
+0.250000 5.89049
+0.281250 5.93957
+0.312500 5.98866
+0.343750 6.03775
+0.375000 6.08684
+0.406250 6.13592
+0.437500 6.18501
+0.468750 6.23410
+0.500000 6.28319
+0.531250 0.0490874
+0.562500 0.0981748
+0.593750 0.147262
+0.625000 0.196350
+0.656250 0.245437
+0.687500 0.294524
+0.718750 0.343612
+0.750000 0.392699
+0.781250 0.441786
+0.812500 0.490874
+0.843750 0.539961
+0.875000 0.589049
+0.906250 0.638136
+0.937500 0.687223
+0.968750 0.736311
+1.00000 0.785398
+e