11#include <dolfinx/common/IndexMap.h>
12#include <dolfinx/common/log.h>
13#include <dolfinx/mesh/Mesh.h>
14#include <dolfinx/mesh/Topology.h>
24template <std::
floating_po
int T>
30 if (topology->cell_types().size() > 1)
31 throw std::runtime_error(
"Mixed topology not supported");
33 if (topology->cell_types()[0] != mesh::CellType::triangle
34 and topology->cell_types()[0] != mesh::CellType::tetrahedron)
36 throw std::runtime_error(
"Refinement only defined for simplices");
39 auto [refined_mesh, parent_cell, parent_facet]
43 const int D = topology->dim();
44 const std::int64_t n0 = topology->index_map(D)->size_global();
45 const std::int64_t n1 = refined_mesh.topology()->index_map(D)->size_global();
46 LOG(INFO) <<
"Number of cells increased from " << n0 <<
" to " << n1 <<
" ("
47 << 100.0 * (
static_cast<double>(n1) /
static_cast<double>(n0) - 1.0)
63template <std::
floating_po
int T>
65 std::span<const std::int32_t> edges,
66 bool redistribute =
true)
71 if (topology->cell_types().size() > 1)
72 throw std::runtime_error(
"Mixed topology not supported");
73 if (topology->cell_types()[0] != mesh::CellType::triangle
74 and topology->cell_types()[0] != mesh::CellType::tetrahedron)
76 throw std::runtime_error(
"Refinement only defined for simplices");
79 auto [refined_mesh, parent_cell, parent_facet]
83 const int D = topology->dim();
84 const std::int64_t n0 = topology->index_map(D)->size_global();
85 const std::int64_t n1 = refined_mesh.topology()->index_map(D)->size_global();
86 LOG(INFO) <<
"Number of cells increased from " << n0 <<
" to " << n1 <<
" ("
87 << 100.0 * (
static_cast<double>(n1) /
static_cast<double>(n0) - 1.0)
A Mesh consists of a set of connected and numbered mesh topological entities, and geometry data.
Definition Mesh.h:23
std::shared_ptr< Topology > topology()
Get mesh topology.
Definition Mesh.h:64
std::tuple< mesh::Mesh< T >, std::vector< std::int32_t >, std::vector< std::int8_t > > refine(const mesh::Mesh< T > &mesh, bool redistribute, Option option)
Uniform refine, optionally redistributing and optionally calculating the parent-child relationships`.
Definition plaza.h:427
Mesh refinement algorithms.
Definition dolfinx_refinement.h:8
mesh::Mesh< T > refine(const mesh::Mesh< T > &mesh, bool redistribute=true)
Create a uniformly refined mesh.
Definition refine.h:25