// Helper function
template <int dim, int spacedim>
-void test(unsigned int ref=1){
+void test(unsigned int ref=1)
+{
deallog << "Testing dim=" << dim
- << ", spacedim="<< spacedim << std::endl;
-
+ << ", spacedim="<< spacedim << std::endl;
+
Triangulation<dim,spacedim> tria;
GridGenerator::hyper_cube (tria);
typename Triangulation<dim,spacedim>::active_cell_iterator cell;
-
+
tria.refine_global(ref);
- for(cell = tria.begin_active(); cell != tria.end(); ++cell) {
- deallog << "C: " << cell
- << ", mid: " << (int)cell->manifold_id() << std::endl;
- for(unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f)
- deallog << "f: " << cell->face(f)
- << ", mid: " << (int)cell->face(f)->manifold_id() << std::endl;
-
- }
+ for (cell = tria.begin_active(); cell != tria.end(); ++cell)
+ {
+ deallog << "C: " << cell
+ << ", mid: " << (int)cell->manifold_id() << std::endl;
+ for (unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f)
+ deallog << "f: " << cell->face(f)
+ << ", mid: " << (int)cell->face(f)->manifold_id() << std::endl;
+
+ }
}
-int main ()
+int main ()
{
std::ofstream logfile("output");
deallog.attach(logfile);
deallog.depth_console(0);
deallog.threshold_double(1.e-10);
-
+
test<1,1>();
test<1,2>();
test<2,2>();
return 0;
}
-
+
// Helper function
template <int dim, int spacedim>
-void test(unsigned int ref=1){
+void test(unsigned int ref=1)
+{
deallog << "Testing dim=" << dim
- << ", spacedim="<< spacedim << std::endl;
-
+ << ", spacedim="<< spacedim << std::endl;
+
Triangulation<dim,spacedim> tria;
GridGenerator::hyper_cube (tria);
Point<spacedim> center;
- for(unsigned int i=0;i<dim;++i)
+ for (unsigned int i=0; i<dim; ++i)
center[i] = .25;
- // const HyperBallBoundary<dim,spacedim> boundary(center,center.norm());
- // triangulation.set_boundary (0, boundary_description);
+ // const HyperBallBoundary<dim,spacedim> boundary(center,center.norm());
+ // triangulation.set_boundary (0, boundary_description);
typename Triangulation<dim,spacedim>::active_cell_iterator cell;
-
+
tria.begin_active()->set_all_manifold_ids(1);
tria.refine_global(ref);
- for(cell = tria.begin_active(); cell != tria.end(); ++cell) {
- deallog << "C: " << cell
- << ", mid: " << (int)cell->manifold_id() << std::endl;
- for(unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f)
- deallog << "f: " << cell->face(f)
- << ", mid: " << (int)cell->face(f)->manifold_id() << std::endl;
- }
-
+ for (cell = tria.begin_active(); cell != tria.end(); ++cell)
+ {
+ deallog << "C: " << cell
+ << ", mid: " << (int)cell->manifold_id() << std::endl;
+ for (unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f)
+ deallog << "f: " << cell->face(f)
+ << ", mid: " << (int)cell->face(f)->manifold_id() << std::endl;
+ }
+
}
-int main ()
+int main ()
{
std::ofstream logfile("output");
deallog.attach(logfile);
deallog.depth_console(0);
deallog.threshold_double(1.e-10);
-
+
test<1,1>();
test<1,2>();
test<2,2>();
return 0;
}
-
+
// Helper function
template <int dim, int spacedim>
-void test(unsigned int ref=1){
- deallog << "Testing dim=" << dim
- << ", spacedim="<< spacedim << std::endl;
-
- Triangulation<dim,spacedim> tria;
- GridGenerator::hyper_cube (tria);
- Point<spacedim> center;
-
- typename Triangulation<dim,spacedim>::active_cell_iterator cell;
-
-
- tria.begin_active()->set_manifold_id(1);
-
- tria.refine_global(1);
-
- for(cell = tria.begin_active(); cell != tria.end(); ++cell) {
- deallog << "C: " << cell
- << ", mid: " << (int)cell->manifold_id() << std::endl;
- for(unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f)
- deallog << "f: " << cell->face(f)
- << ", mid: " << (int)cell->face(f)->manifold_id() << std::endl;
- }
-
+void test(unsigned int ref=1)
+{
+ deallog << "Testing dim=" << dim
+ << ", spacedim="<< spacedim << std::endl;
+
+ Triangulation<dim,spacedim> tria;
+ GridGenerator::hyper_cube (tria);
+ Point<spacedim> center;
+
+ typename Triangulation<dim,spacedim>::active_cell_iterator cell;
+
+
+ tria.begin_active()->set_manifold_id(1);
+
+ tria.refine_global(1);
+
+ for (cell = tria.begin_active(); cell != tria.end(); ++cell)
+ {
+ deallog << "C: " << cell
+ << ", mid: " << (int)cell->manifold_id() << std::endl;
+ for (unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f)
+ deallog << "f: " << cell->face(f)
+ << ", mid: " << (int)cell->face(f)->manifold_id() << std::endl;
+ }
+
}
-int main ()
+int main ()
{
- std::ofstream logfile("output");
- deallog.attach(logfile);
- deallog.depth_console(0);
- deallog.threshold_double(1.e-10);
-
- test<1,1>();
- test<1,2>();
- test<2,2>();
- test<2,3>();
- test<3,3>();
-
- return 0;
+ std::ofstream logfile("output");
+ deallog.attach(logfile);
+ deallog.depth_console(0);
+ deallog.threshold_double(1.e-10);
+
+ test<1,1>();
+ test<1,2>();
+ test<2,2>();
+ test<2,3>();
+ test<3,3>();
+
+ return 0;
}
// Helper function
template <int dim, int spacedim>
-void test(unsigned int ref=1){
- deallog << "Testing dim=" << dim
- << ", spacedim="<< spacedim << std::endl;
-
- Triangulation<dim,spacedim> tria;
- GridGenerator::hyper_cube (tria);
- Point<spacedim> center;
-
- typename Triangulation<dim,spacedim>::active_cell_iterator cell;
-
-
- tria.begin_active()->set_manifold_id(3);
- for(unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f)
- tria.begin_active()->face(f)->set_manifold_id(2);
-
- tria.refine_global(1);
-
- for(cell = tria.begin_active(); cell != tria.end(); ++cell) {
- deallog << "C: " << cell
- << ", mid: " << (int)cell->manifold_id() << std::endl;
- for(unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f)
- deallog << "f: " << cell->face(f)
- << ", mid: " << (int)cell->face(f)->manifold_id() << std::endl;
- }
-
+void test(unsigned int ref=1)
+{
+ deallog << "Testing dim=" << dim
+ << ", spacedim="<< spacedim << std::endl;
+
+ Triangulation<dim,spacedim> tria;
+ GridGenerator::hyper_cube (tria);
+ Point<spacedim> center;
+
+ typename Triangulation<dim,spacedim>::active_cell_iterator cell;
+
+
+ tria.begin_active()->set_manifold_id(3);
+ for (unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f)
+ tria.begin_active()->face(f)->set_manifold_id(2);
+
+ tria.refine_global(1);
+
+ for (cell = tria.begin_active(); cell != tria.end(); ++cell)
+ {
+ deallog << "C: " << cell
+ << ", mid: " << (int)cell->manifold_id() << std::endl;
+ for (unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f)
+ deallog << "f: " << cell->face(f)
+ << ", mid: " << (int)cell->face(f)->manifold_id() << std::endl;
+ }
+
}
-int main ()
+int main ()
{
- std::ofstream logfile("output");
- deallog.attach(logfile);
- deallog.depth_console(1);
- deallog.threshold_double(1.e-10);
-
- test<1,1>();
- test<1,2>();
- test<2,2>();
- test<2,3>();
- test<3,3>();
-
- return 0;
+ std::ofstream logfile("output");
+ deallog.attach(logfile);
+ deallog.depth_console(1);
+ deallog.threshold_double(1.e-10);
+
+ test<1,1>();
+ test<1,2>();
+ test<2,2>();
+ test<2,3>();
+ test<3,3>();
+
+ return 0;
}
// Helper function
template <int dim, int spacedim>
-void test(unsigned int ref=1){
- deallog << "Testing dim=" << dim
- << ", spacedim="<< spacedim << std::endl;
-
- Point<spacedim> center;
- for(unsigned int i=0; i<dim; ++i)
- center[i] = .5;
-
- 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.refine_global(2);
-
- for(cell=tria.begin_active(); cell!=tria.end(); ++cell)
- {
- deallog << "C: " << cell << std::endl;
- for(unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell;++f)
- deallog << "F: " << cell->face(f) << ", mid: "
- << (int) cell->face(f)->manifold_id() << std::endl;
- }
-
-
- GridOut gridout;
- gridout.write_msh(tria, deallog.get_file_stream());
- char fname[30];
- sprintf(fname, "/tmp/id_5_mesh_%d_%d.msh",
- dim, spacedim);
- std::ofstream ofile(fname);
- gridout.write_msh(tria,ofile);
+void test(unsigned int ref=1)
+{
+ deallog << "Testing dim=" << dim
+ << ", spacedim="<< spacedim << std::endl;
+
+ Point<spacedim> center;
+ for (unsigned int i=0; i<dim; ++i)
+ center[i] = .5;
+
+ 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.refine_global(2);
+
+ for (cell=tria.begin_active(); cell!=tria.end(); ++cell)
+ {
+ deallog << "C: " << cell << std::endl;
+ for (unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f)
+ deallog << "F: " << cell->face(f) << ", mid: "
+ << (int) cell->face(f)->manifold_id() << std::endl;
+ }
+
+
+ GridOut gridout;
+ gridout.write_msh(tria, deallog.get_file_stream());
+ char fname[30];
+ sprintf(fname, "/tmp/id_5_mesh_%d_%d.msh",
+ dim, spacedim);
+ std::ofstream ofile(fname);
+ gridout.write_msh(tria,ofile);
}
-int main ()
+int main ()
{
- std::ofstream logfile("output");
- deallog.attach(logfile);
- deallog.depth_console(0);
- deallog.threshold_double(1.e-10);
-
- test<1,1>();
- test<1,2>();
- test<2,2>();
- test<2,3>();
- test<3,3>();
-
- return 0;
+ std::ofstream logfile("output");
+ deallog.attach(logfile);
+ deallog.depth_console(0);
+ deallog.threshold_double(1.e-10);
+
+ test<1,1>();
+ test<1,2>();
+ test<2,2>();
+ test<2,3>();
+ test<3,3>();
+
+ return 0;
}
// Helper function
template <int dim, int spacedim>
-void test(unsigned int ref=1){
- deallog << "Testing dim=" << dim
- << ", spacedim="<< spacedim << std::endl;
-
- Point<spacedim> center;
- for(unsigned int i=0; i<spacedim; ++i)
- center[i] = .25;
-
- double radius=center.norm();
-
- 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;
-
- tria.refine_global(1);
-
- for(cell=tria.begin_active(); cell!=tria.end(); ++cell)
- if(dim<spacedim && cell->center().distance(center)<radius)
- cell->set_all_manifold_ids(1);
- else
- for(unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell;++f)
- if(cell->face(f)->center().distance(center)< radius)
- cell->face(f)->set_all_manifold_ids(1);
-
- tria.set_manifold(1,boundary);
- tria.refine_global(2);
-
- GridOut gridout;
- gridout.write_msh(tria, deallog.get_file_stream());
- char fname[30];
- sprintf(fname, "/tmp/id_6_mesh_%d_%d.msh",
- dim, spacedim);
- std::ofstream ofile(fname);
- gridout.write_msh(tria,ofile);
+void test(unsigned int ref=1)
+{
+ deallog << "Testing dim=" << dim
+ << ", spacedim="<< spacedim << std::endl;
+
+ Point<spacedim> center;
+ for (unsigned int i=0; i<spacedim; ++i)
+ center[i] = .25;
+
+ double radius=center.norm();
+
+ 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;
+
+ tria.refine_global(1);
+
+ for (cell=tria.begin_active(); cell!=tria.end(); ++cell)
+ if (dim<spacedim && cell->center().distance(center)<radius)
+ cell->set_all_manifold_ids(1);
+ else
+ for (unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f)
+ if (cell->face(f)->center().distance(center)< radius)
+ cell->face(f)->set_all_manifold_ids(1);
+
+ tria.set_manifold(1,boundary);
+ tria.refine_global(2);
+
+ GridOut gridout;
+ gridout.write_msh(tria, deallog.get_file_stream());
+ char fname[30];
+ sprintf(fname, "/tmp/id_6_mesh_%d_%d.msh",
+ dim, spacedim);
+ std::ofstream ofile(fname);
+ gridout.write_msh(tria,ofile);
}
-int main ()
+int main ()
{
- std::ofstream logfile("output");
- deallog.attach(logfile);
- deallog.depth_console(0);
- deallog.threshold_double(1.e-10);
-
- test<1,1>();
- test<1,2>();
- test<2,2>();
- test<2,3>();
- test<3,3>();
-
- return 0;
+ std::ofstream logfile("output");
+ deallog.attach(logfile);
+ deallog.depth_console(0);
+ deallog.threshold_double(1.e-10);
+
+ test<1,1>();
+ test<1,2>();
+ test<2,2>();
+ test<2,3>();
+ test<3,3>();
+
+ return 0;
}
// Set a manifold id on one of the boundary face, and attach the
-// boundary description to it. Refine globally twice and output the mesh.
-// Do this building first the Tria, then the manifold, and setting the
-// manifold at the end as well, to check proper destruction of the classes.
+// boundary description to it. Refine globally twice and output the mesh.
+// Do this building first the Tria, then the manifold, and setting the
+// manifold at the end as well, to check proper destruction of the classes.
#include "../tests.h"
#include <fstream>
// Helper function
template <int dim, int spacedim>
-void test(unsigned int ref=1){
- deallog << "Testing dim=" << dim
- << ", spacedim="<< spacedim << std::endl;
-
- Point<spacedim> center;
- for(unsigned int i=0; i<dim; ++i)
- center[i] = .5;
-
- Triangulation<dim,spacedim> tria;
- 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.refine_global(2);
-
- for(cell=tria.begin_active(); cell!=tria.end(); ++cell)
- {
- deallog << "C: " << cell << std::endl;
- for(unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell;++f)
- deallog << "F: " << cell->face(f) << ", mid: "
- << (int) cell->face(f)->manifold_id() << std::endl;
- }
-
-
- GridOut gridout;
- gridout.write_msh(tria, deallog.get_file_stream());
- char fname[30];
- sprintf(fname, "/tmp/id_7_mesh_%d_%d.msh",
- dim, spacedim);
- std::ofstream ofile(fname);
- gridout.write_msh(tria,ofile);
- tria.set_manifold(1);
+void test(unsigned int ref=1)
+{
+ deallog << "Testing dim=" << dim
+ << ", spacedim="<< spacedim << std::endl;
+
+ Point<spacedim> center;
+ for (unsigned int i=0; i<dim; ++i)
+ center[i] = .5;
+
+ Triangulation<dim,spacedim> tria;
+ 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.refine_global(2);
+
+ for (cell=tria.begin_active(); cell!=tria.end(); ++cell)
+ {
+ deallog << "C: " << cell << std::endl;
+ for (unsigned int f=0; f<GeometryInfo<dim>::faces_per_cell; ++f)
+ deallog << "F: " << cell->face(f) << ", mid: "
+ << (int) cell->face(f)->manifold_id() << std::endl;
+ }
+
+
+ GridOut gridout;
+ gridout.write_msh(tria, deallog.get_file_stream());
+ char fname[30];
+ sprintf(fname, "/tmp/id_7_mesh_%d_%d.msh",
+ dim, spacedim);
+ std::ofstream ofile(fname);
+ gridout.write_msh(tria,ofile);
+ tria.set_manifold(1);
}
-int main ()
+int main ()
{
- std::ofstream logfile("output");
- deallog.attach(logfile);
- deallog.depth_console(0);
- deallog.threshold_double(1.e-10);
-
- test<1,1>();
- test<1,2>();
- test<2,2>();
- test<2,3>();
- test<3,3>();
-
- return 0;
+ std::ofstream logfile("output");
+ deallog.attach(logfile);
+ deallog.depth_console(0);
+ deallog.threshold_double(1.e-10);
+
+ test<1,1>();
+ test<1,2>();
+ test<2,2>();
+ test<2,3>();
+ test<3,3>();
+
+ return 0;
}