// to the information
// stored in the
// boundary class
+ const Boundary<dim,spacedim> &manifold =
+ (cell->manifold_id() != numbers::invalid_manifold_id ?
+ cell->get_manifold() :
+ triangulation.get_boundary(static_cast<types::boundary_id>(cell->material_id())));
+
triangulation.vertices[next_unused_vertex] =
- cell->get_boundary().get_new_point_on_quad(cell);
+ manifold.get_new_point_on_quad (cell);
}
}
// midpoint; otherwise we
// have to ask the manifold
// object
- if (dim == spacedim)
- triangulation.vertices[next_unused_vertex] =
- (cell->vertex(0) + cell->vertex(1)) / 2;
- else
- triangulation.vertices[next_unused_vertex] =
- cell->get_boundary().get_new_point_on_line(cell);
- triangulation.vertices_used[next_unused_vertex] = true;
-
+
+ // Now we always ask the manifold where to put the
+ // new point. The get_boundary function will return
+ // a flat boundary if invalid_manifold_id is set,
+ // behaving as before in the flat case. Backward
+ // compatibility requires us to use the material id
+ // of the cell in the codimension one case, however
+ // we only do this if the manifold_id is the invalid
+ // one, otherwise use the material id. This is done
+ // internally in the get_boundary() function.
+ triangulation.vertices[next_unused_vertex] =
+ cell->get_boundary().get_new_point_on_line(cell);
+ triangulation.vertices_used[next_unused_vertex] = true;
+
// search for next two
// unused cell (++ takes
// care of the end of the
// lines we can compute the
// midpoint as the mean of
// the two vertices:
- if (line->at_boundary())
+ // if (line->at_boundary())
triangulation.vertices[next_unused_vertex]
= line->get_boundary().get_new_point_on_line (line);
- else
- triangulation.vertices[next_unused_vertex]
- = (line->vertex(0) + line->vertex(1)) / 2;
}
else
- // however, if spacedim>dim, we
- // always have to ask the
- // boundary object for its
- // answer
- triangulation.vertices[next_unused_vertex]
- = triangulation.get_boundary(line->user_index()).get_new_point_on_line (line);
-
+ // however, if spacedim>dim, we always have to ask
+ // the boundary object for its answer. We use the
+ // same object of the cell (which was stored in
+ // line->user_index() before) unless a manifold_id
+ // has been set on this very line.
+ if(line->manifold_id() == numbers::invalid_manifold_id)
+ triangulation.vertices[next_unused_vertex]
+ = triangulation.get_boundary(line->user_index()).get_new_point_on_line (line);
+ else
+ triangulation.vertices[next_unused_vertex]
+ = line->get_boundary().get_new_point_on_line (line);
+
// now that we created
// the right point, make
// up the two child
// care about boundary quads
// here
triangulation.vertices[next_unused_vertex]
- = (middle_line->vertex(0) + middle_line->vertex(1)) / 2;
+ = middle_line->get_boundary().get_new_point_on_line(middle_line);
triangulation.vertices_used[next_unused_vertex] = true;
// now search a slot for the two
// set the middle vertex
// appropriately
- if (quad->at_boundary())
+ if (quad->at_boundary() ||
+ (quad->manifold_id() != numbers::invalid_manifold_id) )
triangulation.vertices[next_unused_vertex]
= quad->get_boundary().get_new_point_on_quad (quad);
else
+++ /dev/null
-//---------------------------- manifold_id_01.cc ---------------------------
-// Copyright (C) 2011, 2013 by the mathLab team.
-//
-// This file is subject to LGPL and may not be distributed
-// without copyright and license information. Please refer
-// to the file deal.II/doc/license.html for the text and
-// further information on this license.
-//
-//---------------------------- flat_manifold_01.cc ---------------------------
-
-
-// Test periodicity conditions using FlatManifold
-
-#include "../tests.h"
-#include <fstream>
-#include <base/logstream.h>
-
-
-// all include files you need here
-#include <deal.II/grid/manifold.h>
-#include <deal.II/grid/manifold_lib.h>
-
-template <int spacedim>
-void test() {
- Point<spacedim> period;
- for(unsigned int i=0; i<spacedim; ++i)
- period[i] = 1.0;
- FlatManifold<spacedim> manifold(period);
- deallog << "Testing spacedim = " << spacedim << std::endl;
- deallog << "Period: " << period << std::endl;
- std::vector<Point<spacedim> > p(2);
- std::vector<double> w(2, 0.5);
- double eps = .1;
- p[0] = period*eps*2;
- p[1] = period*(1.0-eps);
- Point<spacedim> middle = manifold.get_new_point(p, w);
- deallog << "P(0): " << p[0] << std::endl;
- deallog << "P(1): " << p[1] << std::endl;
- deallog << "Middle: " << middle << std::endl;
-}
-
-int main ()
-{
- std::ofstream logfile("output");
- deallog.attach(logfile);
- deallog.depth_console(0);
- deallog.threshold_double(1.e-5);
-
- test<1>();
- test<2>();
- test<3>();
-
- return 0;
-}
-
+++ /dev/null
-
-DEAL::Testing spacedim = 1
-DEAL::Period: 1.00000
-DEAL::P(0): 0.200000
-DEAL::P(1): 0.900000
-DEAL::Middle: 0.0500000
-DEAL::Testing spacedim = 2
-DEAL::Period: 1.00000 1.00000
-DEAL::P(0): 0.200000 0.200000
-DEAL::P(1): 0.900000 0.900000
-DEAL::Middle: 0.0500000 0.0500000
-DEAL::Testing spacedim = 3
-DEAL::Period: 1.00000 1.00000 1.00000
-DEAL::P(0): 0.200000 0.200000 0.200000
-DEAL::P(1): 0.900000 0.900000 0.900000
-DEAL::Middle: 0.0500000 0.0500000 0.0500000
#include <deal.II/grid/tria_accessor.h>
#include <deal.II/grid/tria_iterator.h>
#include <deal.II/grid/grid_generator.h>
-#include <deal.II/grid/manifold_lib.h>
+#include <deal.II/grid/tria_boundary_lib.h>
#include <deal.II/grid/grid_out.h>
// Helper function
for(unsigned int i=0; i<dim; ++i)
center[i] = .5;
- PolarManifold<spacedim> boundary(center);
+ HyperBallBoundary<dim,spacedim> boundary(center, .5*std::sqrt((double)dim));
Triangulation<dim,spacedim> tria;
GridGenerator::hyper_cube (tria);
typename Triangulation<dim,spacedim>::active_cell_iterator cell;
tria.begin_active()->face(0)->set_manifold_id(1);
- tria.set_manifold(1,boundary);
+ tria.set_boundary(1,boundary);
tria.refine_global(2);
#include <deal.II/grid/tria_accessor.h>
#include <deal.II/grid/tria_iterator.h>
#include <deal.II/grid/grid_generator.h>
-#include <deal.II/grid/manifold_lib.h>
#include <deal.II/grid/grid_out.h>
+#include <deal.II/grid/tria_boundary_lib.h>
// Helper function
template <int dim, int spacedim>
double radius=center.norm();
- PolarManifold<spacedim> boundary(center);
+ HyperBallBoundary<dim,spacedim> boundary(center, .25*std::sqrt((double)spacedim));
Triangulation<dim,spacedim> tria;
GridGenerator::hyper_cube (tria);
typename Triangulation<dim,spacedim>::active_cell_iterator cell;
if(cell->face(f)->center().distance(center)< radius)
cell->face(f)->set_all_manifold_ids(1);
- tria.set_manifold(1,boundary);
+ tria.set_boundary(1,boundary);
tria.refine_global(2);
GridOut gridout;
#include <deal.II/grid/tria_accessor.h>
#include <deal.II/grid/tria_iterator.h>
#include <deal.II/grid/grid_generator.h>
-#include <deal.II/grid/manifold_lib.h>
+#include <deal.II/grid/tria_boundary_lib.h>
#include <deal.II/grid/grid_out.h>
// Helper function
center[i] = .5;
Triangulation<dim,spacedim> tria;
- PolarManifold<spacedim> boundary(center);
+ HyperBallBoundary<dim,spacedim> boundary(center,.5*std::sqrt((double)dim));
GridGenerator::hyper_cube (tria);
typename Triangulation<dim,spacedim>::active_cell_iterator cell;
tria.begin_active()->face(0)->set_manifold_id(1);
- tria.set_manifold(1,boundary);
+ tria.set_boundary(1,boundary);
tria.refine_global(2);