<ol>
+ <li>Improved: GridOut::write_vtk() and GridOut::write_vtu() now
+ output material id, level and subdomain ids of the cells.
+ <br>
+ (Guido Kanschat, 2015/07/05)
+ </li>
+
<li>New: GridGenerator::cheese() for a mesh with many holes;
GridGenerator::simplex() for simplices in 2 and 3 dimensions;
GridGenerator::hyper_cross() for crosses in 2 and 3 dimensions.
const unsigned int n_data_sets = data_names.size();
// check against # of data sets in
- // first patch. checks against all
- // other patches are made in
- // write_gmv_reorder_data_vectors
- Assert ((patches[0].data.n_rows() == n_data_sets && !patches[0].points_are_available) ||
- (patches[0].data.n_rows() == n_data_sets+spacedim && patches[0].points_are_available),
- ExcDimensionMismatch (patches[0].points_are_available
- ?
- (n_data_sets + spacedim)
- :
- n_data_sets,
- patches[0].data.n_rows()));
+ // first patch.
+ if (patches[0].points_are_available)
+ {
+ AssertDimension(n_data_sets + spacedim, patches[0].data.n_rows())
+ }
+ else
+ {
+ AssertDimension(n_data_sets, patches[0].data.n_rows())
+ }
///////////////////////
// preamble
// first patch. checks against all
// other patches are made in
// write_gmv_reorder_data_vectors
- Assert ((patches[0].data.n_rows() == n_data_sets && !patches[0].points_are_available) ||
- (patches[0].data.n_rows() == n_data_sets+spacedim && patches[0].points_are_available),
- ExcDimensionMismatch (patches[0].points_are_available
- ?
- (n_data_sets + spacedim)
- :
- n_data_sets,
- patches[0].data.n_rows()));
-
+ if (patches[0].points_are_available)
+ {
+ AssertDimension(n_data_sets + spacedim, patches[0].data.n_rows())
+ }
+ else
+ {
+ AssertDimension(n_data_sets, patches[0].data.n_rows())
+ }
#ifdef DEAL_II_WITH_ZLIB
const char *ascii_or_binary = "binary";
* A function that is able to convert each cell of a triangulation into
* a patch that can then be output by the functions in DataOutBase.
* This is made particularly simple because the patch only needs to
- * contain geometry info -- we attach no data at all
+ * contain geometry info and additional properties of cells
*/
- template <int dim, int spacedim>
- std::vector<DataOutBase::Patch<dim,spacedim> >
- triangulation_to_patches (const Triangulation<dim,spacedim> &triangulation)
+ template <int dim, int spacedim, typename ITERATOR, typename END>
+ void
+ generate_triangulation_patches (std::vector<DataOutBase::Patch<dim,spacedim> > &patches,
+ ITERATOR cell, END end)
{
- std::vector<DataOutBase::Patch<dim,spacedim> > patches;
- patches.reserve (triangulation.n_active_cells());
-
// convert each of the active cells into a patch
- for (typename Triangulation<dim,spacedim>::active_cell_iterator cell = triangulation.begin_active();
- cell != triangulation.end(); ++cell)
+ for (; cell != end; ++cell)
{
DataOutBase::Patch<dim,spacedim> patch;
patch.n_subdivisions = 1;
+ patch.data.reinit (4,GeometryInfo<dim>::vertices_per_cell);
for (unsigned int v=0; v<GeometryInfo<dim>::vertices_per_cell; ++v)
- patch.vertices[v] = cell->vertex(v);
-
- // no data
- patch.data.reinit (0,0);
-
+ {
+ patch.vertices[v] = cell->vertex(v);
+ patch.data(0, v) = cell->level();
+ patch.data(1, v) = cell->material_id();
+ if (!cell->has_children())
+ patch.data(2, v) = cell->subdomain_id();
+ else
+ patch.data(2, v) = -1;
+ patch.data(3, v) = cell->level_subdomain_id();
+ }
patches.push_back (patch);
}
+ }
- return patches;
+ std::vector<std::string> triangulation_patch_data_names ()
+ {
+ std::vector<std::string> v(4);
+ v[0] = "level";
+ v[1] = "material";
+ v[2] = "leaf_subdomain";
+ v[3] = "level_subdomain";
+ return v;
}
}
// and then have them output. since there is no data attached to
// the geometry, we also do not have to provide any names, identifying
// information, etc.
- DataOutBase::write_vtk (triangulation_to_patches(tria),
- std::vector<std::string>(),
+ std::vector<DataOutBase::Patch<dim,spacedim> > patches;
+ patches.reserve (tria.n_active_cells());
+ generate_triangulation_patches(patches, tria.begin_active(), tria.end());
+ DataOutBase::write_vtk (patches,
+ triangulation_patch_data_names(),
std::vector<std_cxx11::tuple<unsigned int, unsigned int, std::string> >(),
vtk_flags,
out);
// and then have them output. since there is no data attached to
// the geometry, we also do not have to provide any names, identifying
// information, etc.
- DataOutBase::write_vtu (triangulation_to_patches(tria),
- std::vector<std::string>(),
+ std::vector<DataOutBase::Patch<dim,spacedim> > patches;
+ patches.reserve (tria.n_active_cells());
+ generate_triangulation_patches(patches, tria.begin_active(), tria.end());
+ DataOutBase::write_vtu (patches,
+ triangulation_patch_data_names(),
std::vector<std_cxx11::tuple<unsigned int, unsigned int, std::string> >(),
vtu_flags,
out);
#include <iomanip>
-std::ofstream logfile("output");
-
-
template <int dim, int spacedim>
-void test ()
+void test (std::ostream& logfile)
{
Triangulation<dim,spacedim> tria;
- GridGenerator::hyper_cube (tria);
- tria.refine_global (1);
+ std::vector<unsigned int> legs(2*dim, 1);
+ if (dim > 1)
+ GridGenerator::hyper_cross (tria, legs, true);
+ else
+ GridGenerator::subdivided_hyper_cube(tria, 2);
+ tria.begin_active()->set_refine_flag();
+ tria.execute_coarsening_and_refinement();
GridOut grid_out;
grid_out.write_vtk (tria, logfile);
int main ()
{
- deallog << std::setprecision (2);
- logfile << std::setprecision (2);
- 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> ();
+ initlog("output");
+ test<1,1> (deallog.get_file_stream());
+ test<1,2> (deallog.get_file_stream());
+ test<2,2> (deallog.get_file_stream());
+ test<2,3> (deallog.get_file_stream());
+ test<3,3> (deallog.get_file_stream());
}
ASCII
DATASET UNSTRUCTURED_GRID
-POINTS 4 double
-0.0 0 0
-0.50 0 0
-0.50 0 0
-1.0 0 0
+POINTS 6 double
+0.500000 0 0
+1.00000 0 0
+0.00000 0 0
+0.250000 0 0
+0.250000 0 0
+0.500000 0 0
-CELLS 2 6
+CELLS 3 9
2 0 1
2 2 3
+2 4 5
-CELL_TYPES 2
- 3 3
-POINT_DATA 4
+CELL_TYPES 3
+ 3 3 3
+POINT_DATA 6
+SCALARS level double 1
+LOOKUP_TABLE default
+0.00000 0.00000 1.00000 1.00000 1.00000 1.00000
+SCALARS material double 1
+LOOKUP_TABLE default
+0.00000 0.00000 0.00000 0.00000 0.00000 0.00000
+SCALARS leaf_subdomain double 1
+LOOKUP_TABLE default
+0.00000 0.00000 0.00000 0.00000 0.00000 0.00000
+SCALARS level_subdomain double 1
+LOOKUP_TABLE default
+0.00000 0.00000 0.00000 0.00000 0.00000 0.00000
# vtk DataFile Version 3.0
#This file was generated
ASCII
DATASET UNSTRUCTURED_GRID
-POINTS 4 double
-0.0 0.0 0
-0.50 0.0 0
-0.50 0.0 0
-1.0 0.0 0
+POINTS 6 double
+0.500000 0.00000 0
+1.00000 0.00000 0
+0.00000 0.00000 0
+0.250000 0.00000 0
+0.250000 0.00000 0
+0.500000 0.00000 0
-CELLS 2 6
+CELLS 3 9
2 0 1
2 2 3
+2 4 5
-CELL_TYPES 2
- 3 3
-POINT_DATA 4
+CELL_TYPES 3
+ 3 3 3
+POINT_DATA 6
+SCALARS level double 1
+LOOKUP_TABLE default
+0.00000 0.00000 1.00000 1.00000 1.00000 1.00000
+SCALARS material double 1
+LOOKUP_TABLE default
+0.00000 0.00000 0.00000 0.00000 0.00000 0.00000
+SCALARS leaf_subdomain double 1
+LOOKUP_TABLE default
+0.00000 0.00000 0.00000 0.00000 0.00000 0.00000
+SCALARS level_subdomain double 1
+LOOKUP_TABLE default
+0.00000 0.00000 0.00000 0.00000 0.00000 0.00000
# vtk DataFile Version 3.0
#This file was generated
ASCII
DATASET UNSTRUCTURED_GRID
-POINTS 16 double
-0.0 0.0 0
-0.50 0.0 0
-0.0 0.50 0
-0.50 0.50 0
-0.50 0.0 0
-1.0 0.0 0
-0.50 0.50 0
-1.0 0.50 0
-0.0 0.50 0
-0.50 0.50 0
-0.0 1.0 0
-0.50 1.0 0
-0.50 0.50 0
-1.0 0.50 0
-0.50 1.0 0
-1.0 1.0 0
-
-CELLS 4 20
+POINTS 32 double
+-1.50000 -0.500000 0
+-0.500000 -0.500000 0
+-1.50000 0.500000 0
+-0.500000 0.500000 0
+0.500000 -0.500000 0
+1.50000 -0.500000 0
+0.500000 0.500000 0
+1.50000 0.500000 0
+-0.500000 -1.50000 0
+0.500000 -1.50000 0
+-0.500000 -0.500000 0
+0.500000 -0.500000 0
+-0.500000 0.500000 0
+0.500000 0.500000 0
+-0.500000 1.50000 0
+0.500000 1.50000 0
+-0.500000 -0.500000 0
+0.00000 -0.500000 0
+-0.500000 0.00000 0
+0.00000 0.00000 0
+0.00000 -0.500000 0
+0.500000 -0.500000 0
+0.00000 0.00000 0
+0.500000 0.00000 0
+-0.500000 0.00000 0
+0.00000 0.00000 0
+-0.500000 0.500000 0
+0.00000 0.500000 0
+0.00000 0.00000 0
+0.500000 0.00000 0
+0.00000 0.500000 0
+0.500000 0.500000 0
+
+CELLS 8 40
4 0 1 3 2
4 4 5 7 6
4 8 9 11 10
4 12 13 15 14
+4 16 17 19 18
+4 20 21 23 22
+4 24 25 27 26
+4 28 29 31 30
-CELL_TYPES 4
- 9 9 9 9
-POINT_DATA 16
+CELL_TYPES 8
+ 9 9 9 9 9 9 9 9
+POINT_DATA 32
+SCALARS level double 1
+LOOKUP_TABLE default
+0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000
+SCALARS material double 1
+LOOKUP_TABLE default
+1.00000 1.00000 1.00000 1.00000 2.00000 2.00000 2.00000 2.00000 3.00000 3.00000 3.00000 3.00000 4.00000 4.00000 4.00000 4.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000
+SCALARS leaf_subdomain double 1
+LOOKUP_TABLE default
+0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000
+SCALARS level_subdomain double 1
+LOOKUP_TABLE default
+0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000
# vtk DataFile Version 3.0
#This file was generated
ASCII
DATASET UNSTRUCTURED_GRID
-POINTS 16 double
-0.0 0.0 0.0
-0.50 0.0 0.0
-0.0 0.50 0.0
-0.50 0.50 0.0
-0.50 0.0 0.0
-1.0 0.0 0.0
-0.50 0.50 0.0
-1.0 0.50 0.0
-0.0 0.50 0.0
-0.50 0.50 0.0
-0.0 1.0 0.0
-0.50 1.0 0.0
-0.50 0.50 0.0
-1.0 0.50 0.0
-0.50 1.0 0.0
-1.0 1.0 0.0
-
-CELLS 4 20
+POINTS 32 double
+-1.50000 -0.500000 0.00000
+-0.500000 -0.500000 0.00000
+-1.50000 0.500000 0.00000
+-0.500000 0.500000 0.00000
+0.500000 -0.500000 0.00000
+1.50000 -0.500000 0.00000
+0.500000 0.500000 0.00000
+1.50000 0.500000 0.00000
+-0.500000 -1.50000 0.00000
+0.500000 -1.50000 0.00000
+-0.500000 -0.500000 0.00000
+0.500000 -0.500000 0.00000
+-0.500000 0.500000 0.00000
+0.500000 0.500000 0.00000
+-0.500000 1.50000 0.00000
+0.500000 1.50000 0.00000
+-0.500000 -0.500000 0.00000
+0.00000 -0.500000 0.00000
+-0.500000 0.00000 0.00000
+0.00000 0.00000 0.00000
+0.00000 -0.500000 0.00000
+0.500000 -0.500000 0.00000
+0.00000 0.00000 0.00000
+0.500000 0.00000 0.00000
+-0.500000 0.00000 0.00000
+0.00000 0.00000 0.00000
+-0.500000 0.500000 0.00000
+0.00000 0.500000 0.00000
+0.00000 0.00000 0.00000
+0.500000 0.00000 0.00000
+0.00000 0.500000 0.00000
+0.500000 0.500000 0.00000
+
+CELLS 8 40
4 0 1 3 2
4 4 5 7 6
4 8 9 11 10
4 12 13 15 14
+4 16 17 19 18
+4 20 21 23 22
+4 24 25 27 26
+4 28 29 31 30
-CELL_TYPES 4
- 9 9 9 9
-POINT_DATA 16
+CELL_TYPES 8
+ 9 9 9 9 9 9 9 9
+POINT_DATA 32
+SCALARS level double 1
+LOOKUP_TABLE default
+0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000
+SCALARS material double 1
+LOOKUP_TABLE default
+1.00000 1.00000 1.00000 1.00000 2.00000 2.00000 2.00000 2.00000 3.00000 3.00000 3.00000 3.00000 4.00000 4.00000 4.00000 4.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000
+SCALARS leaf_subdomain double 1
+LOOKUP_TABLE default
+0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000
+SCALARS level_subdomain double 1
+LOOKUP_TABLE default
+0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000
# vtk DataFile Version 3.0
#This file was generated
ASCII
DATASET UNSTRUCTURED_GRID
-POINTS 64 double
-0.0 0.0 0.0
-0.50 0.0 0.0
-0.0 0.50 0.0
-0.50 0.50 0.0
-0.0 0.0 0.50
-0.50 0.0 0.50
-0.0 0.50 0.50
-0.50 0.50 0.50
-0.50 0.0 0.0
-1.0 0.0 0.0
-0.50 0.50 0.0
-1.0 0.50 0.0
-0.50 0.0 0.50
-1.0 0.0 0.50
-0.50 0.50 0.50
-1.0 0.50 0.50
-0.0 0.50 0.0
-0.50 0.50 0.0
-0.0 1.0 0.0
-0.50 1.0 0.0
-0.0 0.50 0.50
-0.50 0.50 0.50
-0.0 1.0 0.50
-0.50 1.0 0.50
-0.50 0.50 0.0
-1.0 0.50 0.0
-0.50 1.0 0.0
-1.0 1.0 0.0
-0.50 0.50 0.50
-1.0 0.50 0.50
-0.50 1.0 0.50
-1.0 1.0 0.50
-0.0 0.0 0.50
-0.50 0.0 0.50
-0.0 0.50 0.50
-0.50 0.50 0.50
-0.0 0.0 1.0
-0.50 0.0 1.0
-0.0 0.50 1.0
-0.50 0.50 1.0
-0.50 0.0 0.50
-1.0 0.0 0.50
-0.50 0.50 0.50
-1.0 0.50 0.50
-0.50 0.0 1.0
-1.0 0.0 1.0
-0.50 0.50 1.0
-1.0 0.50 1.0
-0.0 0.50 0.50
-0.50 0.50 0.50
-0.0 1.0 0.50
-0.50 1.0 0.50
-0.0 0.50 1.0
-0.50 0.50 1.0
-0.0 1.0 1.0
-0.50 1.0 1.0
-0.50 0.50 0.50
-1.0 0.50 0.50
-0.50 1.0 0.50
-1.0 1.0 0.50
-0.50 0.50 1.0
-1.0 0.50 1.0
-0.50 1.0 1.0
-1.0 1.0 1.0
-
-CELLS 8 72
+POINTS 112 double
+-1.50000 -0.500000 -0.500000
+-0.500000 -0.500000 -0.500000
+-1.50000 0.500000 -0.500000
+-0.500000 0.500000 -0.500000
+-1.50000 -0.500000 0.500000
+-0.500000 -0.500000 0.500000
+-1.50000 0.500000 0.500000
+-0.500000 0.500000 0.500000
+0.500000 -0.500000 -0.500000
+1.50000 -0.500000 -0.500000
+0.500000 0.500000 -0.500000
+1.50000 0.500000 -0.500000
+0.500000 -0.500000 0.500000
+1.50000 -0.500000 0.500000
+0.500000 0.500000 0.500000
+1.50000 0.500000 0.500000
+-0.500000 -1.50000 -0.500000
+0.500000 -1.50000 -0.500000
+-0.500000 -0.500000 -0.500000
+0.500000 -0.500000 -0.500000
+-0.500000 -1.50000 0.500000
+0.500000 -1.50000 0.500000
+-0.500000 -0.500000 0.500000
+0.500000 -0.500000 0.500000
+-0.500000 0.500000 -0.500000
+0.500000 0.500000 -0.500000
+-0.500000 1.50000 -0.500000
+0.500000 1.50000 -0.500000
+-0.500000 0.500000 0.500000
+0.500000 0.500000 0.500000
+-0.500000 1.50000 0.500000
+0.500000 1.50000 0.500000
+-0.500000 -0.500000 -1.50000
+0.500000 -0.500000 -1.50000
+-0.500000 0.500000 -1.50000
+0.500000 0.500000 -1.50000
+-0.500000 -0.500000 -0.500000
+0.500000 -0.500000 -0.500000
+-0.500000 0.500000 -0.500000
+0.500000 0.500000 -0.500000
+-0.500000 -0.500000 0.500000
+0.500000 -0.500000 0.500000
+-0.500000 0.500000 0.500000
+0.500000 0.500000 0.500000
+-0.500000 -0.500000 1.50000
+0.500000 -0.500000 1.50000
+-0.500000 0.500000 1.50000
+0.500000 0.500000 1.50000
+-0.500000 -0.500000 -0.500000
+0.00000 -0.500000 -0.500000
+-0.500000 0.00000 -0.500000
+0.00000 0.00000 -0.500000
+-0.500000 -0.500000 0.00000
+0.00000 -0.500000 0.00000
+-0.500000 0.00000 0.00000
+0.00000 0.00000 6.93889e-18
+0.00000 -0.500000 -0.500000
+0.500000 -0.500000 -0.500000
+0.00000 0.00000 -0.500000
+0.500000 0.00000 -0.500000
+0.00000 -0.500000 0.00000
+0.500000 -0.500000 0.00000
+0.00000 0.00000 6.93889e-18
+0.500000 0.00000 0.00000
+-0.500000 0.00000 -0.500000
+0.00000 0.00000 -0.500000
+-0.500000 0.500000 -0.500000
+0.00000 0.500000 -0.500000
+-0.500000 0.00000 0.00000
+0.00000 0.00000 6.93889e-18
+-0.500000 0.500000 0.00000
+0.00000 0.500000 0.00000
+0.00000 0.00000 -0.500000
+0.500000 0.00000 -0.500000
+0.00000 0.500000 -0.500000
+0.500000 0.500000 -0.500000
+0.00000 0.00000 6.93889e-18
+0.500000 0.00000 0.00000
+0.00000 0.500000 0.00000
+0.500000 0.500000 0.00000
+-0.500000 -0.500000 0.00000
+0.00000 -0.500000 0.00000
+-0.500000 0.00000 0.00000
+0.00000 0.00000 6.93889e-18
+-0.500000 -0.500000 0.500000
+0.00000 -0.500000 0.500000
+-0.500000 0.00000 0.500000
+0.00000 0.00000 0.500000
+0.00000 -0.500000 0.00000
+0.500000 -0.500000 0.00000
+0.00000 0.00000 6.93889e-18
+0.500000 0.00000 0.00000
+0.00000 -0.500000 0.500000
+0.500000 -0.500000 0.500000
+0.00000 0.00000 0.500000
+0.500000 0.00000 0.500000
+-0.500000 0.00000 0.00000
+0.00000 0.00000 6.93889e-18
+-0.500000 0.500000 0.00000
+0.00000 0.500000 0.00000
+-0.500000 0.00000 0.500000
+0.00000 0.00000 0.500000
+-0.500000 0.500000 0.500000
+0.00000 0.500000 0.500000
+0.00000 0.00000 6.93889e-18
+0.500000 0.00000 0.00000
+0.00000 0.500000 0.00000
+0.500000 0.500000 0.00000
+0.00000 0.00000 0.500000
+0.500000 0.00000 0.500000
+0.00000 0.500000 0.500000
+0.500000 0.500000 0.500000
+
+CELLS 14 126
8 0 1 3 2 4 5 7 6
8 8 9 11 10 12 13 15 14
8 16 17 19 18 20 21 23 22
8 40 41 43 42 44 45 47 46
8 48 49 51 50 52 53 55 54
8 56 57 59 58 60 61 63 62
+8 64 65 67 66 68 69 71 70
+8 72 73 75 74 76 77 79 78
+8 80 81 83 82 84 85 87 86
+8 88 89 91 90 92 93 95 94
+8 96 97 99 98 100 101 103 102
+8 104 105 107 106 108 109 111 110
-CELL_TYPES 8
- 12 12 12 12 12 12 12 12
-POINT_DATA 64
+CELL_TYPES 14
+ 12 12 12 12 12 12 12 12 12 12 12 12 12 12
+POINT_DATA 112
+SCALARS level double 1
+LOOKUP_TABLE default
+0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000
+SCALARS material double 1
+LOOKUP_TABLE default
+1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 2.00000 2.00000 2.00000 2.00000 2.00000 2.00000 2.00000 2.00000 3.00000 3.00000 3.00000 3.00000 3.00000 3.00000 3.00000 3.00000 4.00000 4.00000 4.00000 4.00000 4.00000 4.00000 4.00000 4.00000 5.00000 5.00000 5.00000 5.00000 5.00000 5.00000 5.00000 5.00000 6.00000 6.00000 6.00000 6.00000 6.00000 6.00000 6.00000 6.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000
+SCALARS leaf_subdomain double 1
+LOOKUP_TABLE default
+0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000
+SCALARS level_subdomain double 1
+LOOKUP_TABLE default
+0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000
#include <iomanip>
-std::ofstream logfile("output");
-
-
template <int dim, int spacedim>
-void test ()
+void test (std::ostream& logfile)
{
Triangulation<dim,spacedim> tria;
- GridGenerator::hyper_cube (tria);
- tria.refine_global (1);
+ std::vector<unsigned int> legs(2*dim, 1);
+ if (dim > 1)
+ GridGenerator::hyper_cross (tria, legs, true);
+ else
+ GridGenerator::subdivided_hyper_cube(tria, 2);
+ tria.begin_active()->set_refine_flag();
+ tria.execute_coarsening_and_refinement();
GridOut grid_out;
grid_out.write_vtu (tria, logfile);
int main ()
{
- deallog << std::setprecision (2);
- logfile << std::setprecision (2);
- 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> ();
+ initlog("output");
+ test<1,1> (deallog.get_file_stream());
+ test<1,2> (deallog.get_file_stream());
+ test<2,2> (deallog.get_file_stream());
+ test<2,3> (deallog.get_file_stream());
+ test<3,3> (deallog.get_file_stream());
}
-->
<VTKFile type="UnstructuredGrid" version="0.1" compressor="vtkZLibDataCompressor" byte_order="LittleEndian">
<UnstructuredGrid>
-<Piece NumberOfPoints="4" NumberOfCells="2" >
+<Piece NumberOfPoints="6" NumberOfCells="3" >
<Points>
<DataArray type="Float64" NumberOfComponents="3" format="binary">
-AQAAAGAAAABgAAAAEwAAAA==eNpjYMAHHtiTJv4BQxwAjgUDbg==
+AQAAAJAAAACQAAAAHAAAAA==eNpjYACBB/YMWMEHHOK4wAV70sQx7QUAp4oFjA==
</DataArray>
</Points>
<Cells>
<DataArray type="Int32" Name="connectivity" format="binary">
-AQAAABAAAAAQAAAAEwAAAA==eNpjYGBgYARiJiBmBmIAADgABw==
+AQAAABgAAAAYAAAAGAAAAA==eNpjYGBgYARiJiBmBmIWIGYFYgAApAAQ
</DataArray>
<DataArray type="Int32" Name="offsets" format="binary">
-AQAAAAgAAAAIAAAADgAAAA==eNpjYmBgYAFiAAAoAAc=
+AQAAAAwAAAAMAAAAEQAAAA==eNpjYmBgYAFiNiAGAABcAA0=
</DataArray>
<DataArray type="UInt8" Name="types" format="binary">
-AQAAAAIAAAACAAAACgAAAA==eNpjZgYAAAsABw==
+AQAAAAMAAAADAAAACwAAAA==eNpjZmYGAAAVAAo=
</DataArray>
</Cells>
<PointData Scalars="scalars">
+ <DataArray type="Float64" Name="level" format="binary">
+AQAAADAAAAAwAAAADwAAAA==eNpjYMAGPtjjogFBfAS9 </DataArray>
+ <DataArray type="Float64" Name="material" format="binary">
+AQAAADAAAAAwAAAADAAAAA==eNpjYCANAAAAMAAB </DataArray>
+ <DataArray type="Float64" Name="leaf_subdomain" format="binary">
+AQAAADAAAAAwAAAADAAAAA==eNpjYCANAAAAMAAB </DataArray>
+ <DataArray type="Float64" Name="level_subdomain" format="binary">
+AQAAADAAAAAwAAAADAAAAA==eNpjYCANAAAAMAAB </DataArray>
</PointData>
</Piece>
</UnstructuredGrid>
-->
<VTKFile type="UnstructuredGrid" version="0.1" compressor="vtkZLibDataCompressor" byte_order="LittleEndian">
<UnstructuredGrid>
-<Piece NumberOfPoints="4" NumberOfCells="2" >
+<Piece NumberOfPoints="6" NumberOfCells="3" >
<Points>
<DataArray type="Float64" NumberOfComponents="3" format="binary">
-AQAAAGAAAABgAAAAEwAAAA==eNpjYMAHHtiTJv4BQxwAjgUDbg==
+AQAAAJAAAACQAAAAHAAAAA==eNpjYACBB/YMWMEHHOK4wAV70sQx7QUAp4oFjA==
</DataArray>
</Points>
<Cells>
<DataArray type="Int32" Name="connectivity" format="binary">
-AQAAABAAAAAQAAAAEwAAAA==eNpjYGBgYARiJiBmBmIAADgABw==
+AQAAABgAAAAYAAAAGAAAAA==eNpjYGBgYARiJiBmBmIWIGYFYgAApAAQ
</DataArray>
<DataArray type="Int32" Name="offsets" format="binary">
-AQAAAAgAAAAIAAAADgAAAA==eNpjYmBgYAFiAAAoAAc=
+AQAAAAwAAAAMAAAAEQAAAA==eNpjYmBgYAFiNiAGAABcAA0=
</DataArray>
<DataArray type="UInt8" Name="types" format="binary">
-AQAAAAIAAAACAAAACgAAAA==eNpjZgYAAAsABw==
+AQAAAAMAAAADAAAACwAAAA==eNpjZmYGAAAVAAo=
</DataArray>
</Cells>
<PointData Scalars="scalars">
+ <DataArray type="Float64" Name="level" format="binary">
+AQAAADAAAAAwAAAADwAAAA==eNpjYMAGPtjjogFBfAS9 </DataArray>
+ <DataArray type="Float64" Name="material" format="binary">
+AQAAADAAAAAwAAAADAAAAA==eNpjYCANAAAAMAAB </DataArray>
+ <DataArray type="Float64" Name="leaf_subdomain" format="binary">
+AQAAADAAAAAwAAAADAAAAA==eNpjYCANAAAAMAAB </DataArray>
+ <DataArray type="Float64" Name="level_subdomain" format="binary">
+AQAAADAAAAAwAAAADAAAAA==eNpjYCANAAAAMAAB </DataArray>
</PointData>
</Piece>
</UnstructuredGrid>
-->
<VTKFile type="UnstructuredGrid" version="0.1" compressor="vtkZLibDataCompressor" byte_order="LittleEndian">
<UnstructuredGrid>
-<Piece NumberOfPoints="16" NumberOfCells="4" >
+<Piece NumberOfPoints="32" NumberOfCells="8" >
<Points>
<DataArray type="Float64" NumberOfComponents="3" format="binary">
-AQAAAIABAACAAQAAMwAAAA==eNpjYMAHHtgzkCQP4+MSRwcf7PGbi67vgz1+84h1Dy77Yeo+2FPmHlzmfMAQBwBtNxtp
+AQAAAAADAAAAAwAAWQAAAA==eNqlkcEJACAMA7tZRncVx+hTFPWhHAbMp5jGmGBER5Yxos65UIHfeoH+5AU+wG+9QA/vJvik2YtyPntRHtCnvDznns4u3L54X56vmwP99JeH9vd/NcNJQpE=
</DataArray>
</Points>
<Cells>
<DataArray type="Int32" Name="connectivity" format="binary">
-AQAAAEAAAABAAAAAKAAAAA==eNoNwwkSwBAQALB1VIvi/7+VzCQiIlnMVh9fm5/d6fB3edxeCvAAeQ==
+AQAAAIAAAACAAAAAPAAAAA==eNoNwwUOg0AAALCD4Q7DZfv/L2mThhBC5MfYxNTczMLS2srG1t7OwdGvk7OLm6u7h5ent49/f75V4AHx
</DataArray>
<DataArray type="Int32" Name="offsets" format="binary">
-AQAAABAAAAAQAAAAEwAAAA==eNpjYWBg4ABiHiAWAGIAAVAAKQ==
+AQAAACAAAAAgAAAAHQAAAA==eNpjYWBg4ABiHiAWAGIRIJYAYhkgVgBiAAegAJE=
</DataArray>
<DataArray type="UInt8" Name="types" format="binary">
-AQAAAAQAAAAEAAAADAAAAA==eNrj5OTkBAAAXgAl
+AQAAAAgAAAAIAAAACwAAAA==eNrj5IQAAAFMAEk=
</DataArray>
</Cells>
<PointData Scalars="scalars">
+ <DataArray type="Float64" Name="level" format="binary">
+AQAAAAABAAAAAQAAEAAAAA==eNpjYBgM4IP9QNEAk2wS8Q== </DataArray>
+ <DataArray type="Float64" Name="material" format="binary">
+AQAAAAABAAAAAQAAHAAAAA==eNpjYACBD/YMeGkGB/w0BwFagAA9cAAAp2YIHQ== </DataArray>
+ <DataArray type="Float64" Name="leaf_subdomain" format="binary">
+AQAAAAABAAAAAQAADAAAAA==eNpjYBjZAAABAAAB </DataArray>
+ <DataArray type="Float64" Name="level_subdomain" format="binary">
+AQAAAAABAAAAAQAADAAAAA==eNpjYBjZAAABAAAB </DataArray>
</PointData>
</Piece>
</UnstructuredGrid>
-->
<VTKFile type="UnstructuredGrid" version="0.1" compressor="vtkZLibDataCompressor" byte_order="LittleEndian">
<UnstructuredGrid>
-<Piece NumberOfPoints="16" NumberOfCells="4" >
+<Piece NumberOfPoints="32" NumberOfCells="8" >
<Points>
<DataArray type="Float64" NumberOfComponents="3" format="binary">
-AQAAAIABAACAAQAAMwAAAA==eNpjYMAHHtgzkCQP4+MSRwcf7PGbi67vgz1+84h1Dy77Yeo+2FPmHlzmfMAQBwBtNxtp
+AQAAAAADAAAAAwAAWQAAAA==eNqlkcEJACAMA7tZRncVx+hTFPWhHAbMp5jGmGBER5Yxos65UIHfeoH+5AU+wG+9QA/vJvik2YtyPntRHtCnvDznns4u3L54X56vmwP99JeH9vd/NcNJQpE=
</DataArray>
</Points>
<Cells>
<DataArray type="Int32" Name="connectivity" format="binary">
-AQAAAEAAAABAAAAAKAAAAA==eNoNwwkSwBAQALB1VIvi/7+VzCQiIlnMVh9fm5/d6fB3edxeCvAAeQ==
+AQAAAIAAAACAAAAAPAAAAA==eNoNwwUOg0AAALCD4Q7DZfv/L2mThhBC5MfYxNTczMLS2srG1t7OwdGvk7OLm6u7h5ent49/f75V4AHx
</DataArray>
<DataArray type="Int32" Name="offsets" format="binary">
-AQAAABAAAAAQAAAAEwAAAA==eNpjYWBg4ABiHiAWAGIAAVAAKQ==
+AQAAACAAAAAgAAAAHQAAAA==eNpjYWBg4ABiHiAWAGIRIJYAYhkgVgBiAAegAJE=
</DataArray>
<DataArray type="UInt8" Name="types" format="binary">
-AQAAAAQAAAAEAAAADAAAAA==eNrj5OTkBAAAXgAl
+AQAAAAgAAAAIAAAACwAAAA==eNrj5IQAAAFMAEk=
</DataArray>
</Cells>
<PointData Scalars="scalars">
+ <DataArray type="Float64" Name="level" format="binary">
+AQAAAAABAAAAAQAAEAAAAA==eNpjYBgM4IP9QNEAk2wS8Q== </DataArray>
+ <DataArray type="Float64" Name="material" format="binary">
+AQAAAAABAAAAAQAAHAAAAA==eNpjYACBD/YMeGkGB/w0BwFagAA9cAAAp2YIHQ== </DataArray>
+ <DataArray type="Float64" Name="leaf_subdomain" format="binary">
+AQAAAAABAAAAAQAADAAAAA==eNpjYBjZAAABAAAB </DataArray>
+ <DataArray type="Float64" Name="level_subdomain" format="binary">
+AQAAAAABAAAAAQAADAAAAA==eNpjYBjZAAABAAAB </DataArray>
</PointData>
</Piece>
</UnstructuredGrid>
-->
<VTKFile type="UnstructuredGrid" version="0.1" compressor="vtkZLibDataCompressor" byte_order="LittleEndian">
<UnstructuredGrid>
-<Piece NumberOfPoints="64" NumberOfCells="8" >
+<Piece NumberOfPoints="112" NumberOfCells="14" >
<Points>
<DataArray type="Float64" NumberOfComponents="3" format="binary">
-AQAAAAAGAAAABgAAeAAAAA==eNq1ksENwDAIA9PJ2H8LRvAIffXT9CBWRT4oAoR9sFb1MpaVf/6nfdRPdRnXK9bzFN58mbqEer91Kv757/yRLpcn8eh8uDwF9bsvjyflFbWuqfukvREv4tT5m7rPPNxTp5P2MX2fLk/yyX5m79PlSXV7vAFGfKSB
+AQAAAIAKAACACgAAyAAAAA==eNq1U8ENw0AMusEisUo3zSodw8+qVdKHIw5Ie/74EUww+MZ4V+2fNp5m/+JBcCB4c+7CDzKPOV8pfSB4CL0g/Jj3ErpL+aE6wtwQ5mn6Iuf2uX92bgjzhMhZ3HeF91o/5pX6eTsv3HxXCPOEmfPRz3K/91JzbJ7hej028T9k/z/xrq7Or3R2/nR/tR/TlfrJ/Oj8rGw/zfeV+sl0dn7m67/vk+XG/GI+yf0W3SfViexeaB6L7zP1k+2p9ll1n6mfDHftL/BMUEA=
</DataArray>
</Points>
<Cells>
<DataArray type="Int32" Name="connectivity" format="binary">
-AQAAAAABAAAAAQAAaQAAAA==eNoNwwVSAkAAAMADpaQ7pEGluyT//yt2ZzaEECJ+GPXTmAnjJk2Z9suMWfPmLFi0bMmKVevWbNj025ZtO/bs2nfgyKFjf/zz14lT585cuHTtyo1b9+48ePTsyYv/3rx69+HLp2+r3gfh
+AQAAAMABAADAAQAAsQAAAA==eNoNw1VSQgEAAMBntwJ2oSJiYHcLtmJ3dxf3/3N3ZoMgCHLMM9d8Cyyy0GJLLLPUciusstKQYauNWGOt9dbZYKPNNtliq21GbbfDTmPG7bLbhD32mrTPfgccctBhRxxz1HEnnHLSaWecc9Z5F1xy0ZRpV1x21TU3XHfTLTNuu+Ou++554KHHHnniqeeeeeGl115546333vngo88++eKr77754afffvnjr1n//AdNYhhJ
</DataArray>
<DataArray type="Int32" Name="offsets" format="binary">
-AQAAACAAAAAgAAAAHQAAAA==eNrjYGBgEABiCSBWAGINIDYAYgsgdgBiAA8gASE=
+AQAAADgAAAA4AAAALAAAAA==eNrjYGBgEABiCSBWAGINIDYAYgsgdgBiDyAOAOIIIE4A4gwgLgBiAEY4A0k=
</DataArray>
<DataArray type="UInt8" Name="types" format="binary">
-AQAAAAgAAAAIAAAACwAAAA==eNrj4YEAAAG4AGE=
+AQAAAA4AAAAOAAAACwAAAA==eNrj4UEGAAT6AKk=
</DataArray>
</Cells>
<PointData Scalars="scalars">
+ <DataArray type="Float64" Name="level" format="binary">
+AQAAAIADAACAAwAAFAAAAA==eNpjYBgFAw8+2I/SI5MGACClS8E= </DataArray>
+ <DataArray type="Float64" Name="material" format="binary">
+AQAAAIADAACAAwAAJAAAAA==eNpjYACBD/YMFNEMDpTRHBTSAhTSIhTSEhTSo2CkAgAhCRWZ </DataArray>
+ <DataArray type="Float64" Name="leaf_subdomain" format="binary">
+AQAAAIADAACAAwAAEQAAAA==eNpjYBgFo2AUDBQAAAOAAAE= </DataArray>
+ <DataArray type="Float64" Name="level_subdomain" format="binary">
+AQAAAIADAACAAwAAEQAAAA==eNpjYBgFo2AUDBQAAAOAAAE= </DataArray>
</PointData>
</Piece>
</UnstructuredGrid>
</DataArray>
</Cells>
<PointData Scalars="scalars">
+ <DataArray type="Float64" Name="level" format="binary">
+AQAAAIABAACAAQAAEgAAAA==eNpjYACBD/YMo/SA0AAihjjR </DataArray>
+ <DataArray type="Float64" Name="material" format="binary">
+AQAAAIABAACAAQAADQAAAA==eNpjYBgFAwkAAYAAAQ== </DataArray>
+ <DataArray type="Float64" Name="leaf_subdomain" format="binary">
+AQAAAIABAACAAQAADQAAAA==eNpjYBgFAwkAAYAAAQ== </DataArray>
+ <DataArray type="Float64" Name="level_subdomain" format="binary">
+AQAAAIABAACAAQAADQAAAA==eNpjYBgFAwkAAYAAAQ== </DataArray>
</PointData>
</Piece>
</UnstructuredGrid>