From: Wolfgang Bangerth Date: Fri, 27 Jan 2006 15:51:24 +0000 (+0000) Subject: New test X-Git-Tag: v8.0.0~12484 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=33c38534d1c5d3b364ebd9d5f3f54fabcc69f4bc;p=dealii.git New test git-svn-id: https://svn.dealii.org/trunk@12192 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/tests/deal.II/Makefile b/tests/deal.II/Makefile index 5b00518e84..9d66a1567a 100644 --- a/tests/deal.II/Makefile +++ b/tests/deal.II/Makefile @@ -32,6 +32,7 @@ tests_x = block_matrices \ grid_out \ grid_test \ grid_transform \ + grid_transform_3d \ measure_et_al \ normals_at_vertices \ intergrid_constraints \ diff --git a/tests/deal.II/grid_transform_3d.cc b/tests/deal.II/grid_transform_3d.cc new file mode 100644 index 0000000000..a5b4cc3278 --- /dev/null +++ b/tests/deal.II/grid_transform_3d.cc @@ -0,0 +1,116 @@ +//---------------------------- grid_transform.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 by the deal.II authors +// +// This file is subject to QPL 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. +// +//---------------------------- grid_transform.cc --------------------------- + + + +#include "../tests.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + + +int main () +{ + const unsigned int dim=3; + Point origin; + CylinderBoundary boundary; + Triangulation tria; + tria.set_boundary(0, boundary); + GridGenerator::cylinder(tria, 1, .7); + tria.refine_global(2); + + // build up a map of vertex indices + // of boundary vertices to the new + // boundary points + std::map > new_points; + + Triangulation::active_cell_iterator cell=tria.begin_active(), + endc=tria.end(); + + for (unsigned int i=0; i<4; ++i) + { + for (cell=tria.begin_active(); cell!=endc; ++cell) + if ((cell->center()[0]-.2)*(cell->center()[0]-.2) + + (cell->center()[2]-cell->center()[1]/4)*(cell->center()[2]-cell->center()[1]/4) + < cell->diameter() * cell->diameter()) + cell->set_refine_flag (); + tria.execute_coarsening_and_refinement(); + } + for (cell=tria.begin_active(); cell!=endc; ++cell) + if ((cell->center()[0]-.2)*(cell->center()[0]-.2) + + (cell->center()[2]-cell->center()[1]/4)*(cell->center()[2]-cell->center()[1]/4) + < cell->diameter() * cell->diameter()) + cell->set_refine_flag (); + else + cell->set_coarsen_flag (); + tria.execute_coarsening_and_refinement(); + + + Triangulation::face_iterator face; + for (cell=tria.begin_active(); cell!=endc; ++cell) + for (unsigned int face_no=0; face_no::faces_per_cell; ++face_no) + { + face=cell->face(face_no); + if (face->at_boundary()) + for (unsigned int vertex_no=0; + vertex_no::vertices_per_face; ++vertex_no) + { + const Point &old_vertex=face->vertex(vertex_no); + + Point new_vertex (old_vertex[0], + old_vertex[1], + (old_vertex[0] <= 0 ? + old_vertex[2]/2 : + old_vertex[2]/(2+4*old_vertex[0]*old_vertex[0]))); + + new_points[face->vertex_index(vertex_no)] = new_vertex; + } + } + + GridGenerator::laplace_transformation (tria, new_points); + + + + if (false) + { + GridOut grid_out; + std::ofstream out("grid_transform_3d/output"); + grid_out.write_gnuplot(tria, out); + } + else + { + FE_Q fe(1); + DoFHandler dof_handler (tria); + dof_handler.distribute_dofs(fe); + Vector v(dof_handler.n_dofs()); + DataOut data_out; + data_out.attach_dof_handler (dof_handler); + data_out.add_data_vector (v, "v"); + data_out.build_patches(); + std::ofstream out("grid_transform_3d/output.gmv"); + data_out.write_gmv(out); + } + + tria.clear(); + + return 0; +}