From: schrage
-Choosing the right type of grid can be essential for solving your problem.
+All numerics are done on a grid.
+Choosing the right kind of grid can be essential for solving your problem.
A grid should be chosen to fit your problem space in the best way possible.
-Otherwise you waste memory and computing time.
+This chapter describes coarse grids for the triangulation of your domain.
@@ -34,20 +35,19 @@ A hypercube can be created using the function
-Example: Below we show the includes,
+Example - create the square [-1,1]x[-1,x]: Below we show the includes,
definitions and
function calls needed. Be sure to use them in their appropriate places.
-This example will create the hypercube [-1,1]dim.
Creation of a Grid
-Grid Types
+Different kinds of grids
void Triangulation::create_hypercube(const double left=0.,const double right=1.)
The cube created is the tensor product of the left and right edges which
default to 0 and 1, creating the unit hypercube. The hypercube will consist of
-exactly one cell.
+exactly one cell. In two dimensions, this amounts to a unit square, in three, to a unit cube.
#include <grid/tria.h>
-int dim=2; // For example
+int dim=2; // Two dimensions; to create a cube set to three
Triangulation<dim> tr;
tr.create_hypercube(-1,1);
@@ -127,8 +127,6 @@ this is possible. deal.II offers the possibility of
reading a complete triangulation from a file in the ucd-format
used by avs. A ucd-file can be read with the function
void DataIn::read_ucd(istream&)
-At present only lines in one dimension and lines and quads in two dimensions
-are accepted. All other data is rejected.
Vertex numbering in input files:
@@ -142,10 +140,76 @@ encountered in two dimensions can be found in the
DataIn
class description.
+Another way to build cutom grids is to use deal.II methods +for creating grid cells and their properties. This is done in the order +
+Example: Below we show the includes, +definitions and +function calls needed. Be sure to use them in their appropriate places. +This example will create a triangulation as shown in this figure. It will +work only in two dimensions. +
+
+
+const Point<2&rt; vertices[8] = { Point<2&rt; (0,0),
+ Point<2&rt; (1,0),
+ Point<2&rt; (1,1),
+ Point<2&rt; (0,1),
+ Point<2&rt; (2,0),
+ Point<2&rt; (2,1),
+ Point<2&rt; (3,0),
+ Point<2&rt; (3,1) };
+const int cell_vertices[3][4] = {{0, 1, 2, 3},
+ {1, 4, 5, 2},
+ {4, 6, 7, 5}};
+
+vector<CellData<2&rt; &rt; cells (3, CellData<2&rt;());
+
+for (unsigned int i=0; i<3; ++i)
+ {
+ for (unsigned int j=0; j<4; ++j)
+ cells[i].vertices[j] = cell_vertices[i][j];
+ cells[i].material_id = 0;
+ };
+
+SubCellData boundary_info;
+if (boundary_conditions == wave_from_left_bottom)
+ {
+ // use Neumann bc at left
+ // (mirror condition)
+ boundary_info.boundary_lines.push_back (CellData<1&rt;());
+ boundary_info.boundary_lines.back().material_id = 1;
+ boundary_info.boundary_lines[0].vertices[0] = 0;
+ boundary_info.boundary_lines[0].vertices[1] = 3;
+ };
+
+coarse_grid-&rt;create_triangulation (vector<Point<2&rt; &rt;(&vertices[0],
+ &vertices[8]),
+ cells, boundary_info);
+
+
+
+
+ Next chapter: Degrees of Freedom + | Back to this chapter's index | @@ -162,3 +226,4 @@ Last modified: $Date$