// And this for the declarations of the `sqrt' and `fabs' functions:
#include <cmath>
+#include <deal.II/../../source/grid/manifold_lib.cc>
+
// The final step in importing deal.II is this: All deal.II functions and
// classes are in a namespace <code>dealii</code>, to make sure they don't
// clash with symbols from other libraries you may want to use in conjunction
GridGenerator::hyper_shell (triangulation,
center, inner_radius, outer_radius,
10);
+
+ Triangulation<2>::active_cell_iterator
+ cell = triangulation.begin_active(),
+ endc = triangulation.end();
+ for(; cell != endc; ++cell)
+ cell->set_all_manifold_ids(0);
+
+
+ // for(unsigned int f=0; f<GeometryInfo<2>::faces_per_cell; ++f)
+ // if(cell->face(f)->at_boundary())
+ // cell->face(f)->set_manifold_id(0);
+
+
+
// By default, the triangulation assumes that all boundaries are straight
// and given by the cells of the coarse grid (which we just created). It
// uses this information when cells at the boundary are refined and new
// In order to demonstrate how to write a loop over all cells, we will
// refine the grid in five steps towards the inner circle of the domain:
for (unsigned int step=0; step<5; ++step)
+ // triangulation.refine_global(1);
+
+ // if(false)
{
// Next, we need an iterator which points to a cell and which we will
// move over all active cells one by one (active cells are those that
// fine.
}
+void test_case()
+{
+ const unsigned int dim = 2;
+
+ std::vector<Point<dim> > ps(2);
+ ps[0] = Point<dim>(1.0,1.0);
+ ps[1] = Point<dim>(-1.0,1.0);
+
+ std::vector<double> ws(2, .5);
+
+ PolarManifold<dim> manifold;
+
+ Point<dim> p = manifold.get_new_point(ps, ws);
+ std::cout << "Point 0 : " << ps[0]
+ << ", Point 1: " << ps[1]
+ << ", computed point: " << p << std::endl;
+
+
+}
+
// @sect3{The main function}
// two subfunctions, which produce the two grids.
int main ()
{
- first_grid ();
+ // first_grid ();
second_grid ();
+ test_case();
}
template <int spacedim>
-Point<spacedim>
-Manifold<spacedim>::project_to_manifold (const Point<spacedim> &candidate) const
+void
+Manifold<spacedim>::project_to_manifold (Point<spacedim> &candidate) const
{
Assert (false, ExcPureFunctionCalled());
- return Point<spacedim>();
}
{
Assert(surrounding_points.size() == weights.size(),
ExcDimensionMismatch(surrounding_points.size(), weights.size()));
+
+#ifdef DEBUG
+ double sum=std::accumulate(weights.begin(), weights.end(), 0.0);
+ Assert(std::abs(sum-1.0) < 1e-10, ExcMessage("Weights should sum to 1!"));
+#endif
+
Point<spacedim> p;
for(unsigned int i=0; i<surrounding_points.size(); ++i)
p += surrounding_points[i]*weights[i];
-
return p;
}
+template <int spacedim>
+void
+FlatManifold<spacedim>::project_to_manifold (Point<spacedim> &candidate) const
+{}
+
/* -------------------------- ManifoldChart --------------------- */