31#include "MeshEntity.h"
32#include "MeshEntityIteratorBase.h"
33#include "MeshFunction.h"
35#include <dolfin/geometry/Point.h>
63 {
return _mesh->type().cell_type(); }
67 {
return _mesh->type().num_vertices(); }
74 {
return _mesh->type().orientation(*
this); }
84 {
return _mesh->type().orientation(*
this, up); }
99 {
return _mesh->type().volume(*
this); }
114 {
return _mesh->type().h(*
this); }
129 {
return _mesh->type().circumradius(*
this); }
146 _mesh->init(_mesh->type().dim() - 1);
148 return _mesh->type().inradius(*
this);
170 _mesh->init(_mesh->type().dim() - 1);
172 return _mesh->type().radius_ratio(*
this);
182 {
return _mesh->type().squared_distance(*
this, point); }
204 double normal(std::size_t facet, std::size_t i)
const
205 {
return _mesh->type().normal(*
this, facet, i); }
215 {
return _mesh->type().normal(*
this, facet); }
222 {
return _mesh->type().cell_normal(*
this); }
232 {
return _mesh->type().facet_area(*
this, facet); }
238 void order(
const std::vector<std::int64_t>& local_to_global_vertex_indices)
239 { _mesh->type().order(*
this, local_to_global_vertex_indices); }
248 bool ordered(
const std::vector<std::int64_t>& local_to_global_vertex_indices)
const
249 {
return _mesh->type().ordered(*
this, local_to_global_vertex_indices); }
296 const std::size_t gdim = geom.
dim();
297 const std::size_t geom_degree = geom.
degree();
299 const unsigned int* vertices = this->
entities(0);
301 if (geom_degree == 1)
305 for (std::size_t j = 0; j < gdim; ++j)
306 coordinates[i*gdim + j] = geom.
x(vertices[i])[j];
308 else if (geom_degree == 2)
310 const std::size_t tdim = _mesh->topology().dim();
312 const unsigned int* edges = this->
entities(1);
317 for (std::size_t j = 0; j < gdim; j++)
318 coordinates[i*gdim + j] = geom.
x(vertices[i])[j];
320 for (std::size_t i = 0; i < num_edges; ++i)
322 const std::size_t entity_index
323 = (tdim == 1) ?
index() : edges[i];
324 const std::size_t point_index
326 for (std::size_t j = 0; j < gdim; ++j)
327 coordinates[(i +
num_vertices)*gdim + j] = geom.
x(point_index)[j];
332 dolfin_error(
"Cell.h",
"get coordinate_dofs",
"Unsupported mesh degree");
341 const std::size_t gdim = _mesh->geometry().dim();
343 const unsigned int* vertices = this->
entities(0);
346 for (std::size_t j = 0; j < gdim; j++)
347 coordinates[i*gdim + j] = _mesh->geometry().x(vertices[i])[j];
354 ufc_cell.geometric_dimension = _mesh->geometry().dim();
355 ufc_cell.local_facet = local_facet;
356 if (_mesh->cell_orientations().empty())
357 ufc_cell.orientation = -1;
360 dolfin_assert(
index() < _mesh->cell_orientations().size());
361 ufc_cell.orientation = _mesh->cell_orientations()[
index()];
363 ufc_cell.mesh_identifier =
mesh_id();
364 ufc_cell.index =
index();
373 const std::size_t tdim = topology.
dim();
374 ufc_cell.topological_dimension = tdim;
375 if (_mesh->cell_orientations().empty())
376 ufc_cell.orientation = -1;
379 dolfin_assert(
index() < _mesh->cell_orientations().size());
380 ufc_cell.orientation = _mesh->cell_orientations()[
index()];
382 ufc_cell.entity_indices.resize(tdim + 1);
383 for (std::size_t d = 0; d < tdim; d++)
388 const std::vector<std::int64_t>& global_indices
391 ufc_cell.entity_indices[d][i] = global_indices[
entities(d)[i]];
396 ufc_cell.entity_indices[d][i] =
entities(d)[i];
399 ufc_cell.entity_indices[tdim].resize(1);
403 ufc_cell.entity_indices[tdim][0] =
index();
408 ufc_cell.index = ufc_cell.entity_indices[tdim][0];
Type
Enum for different cell types.
Definition CellType.h:51
double h() const
Definition Cell.h:113
double inradius() const
Definition Cell.h:143
double facet_area(std::size_t facet) const
Definition Cell.h:231
double distance(const Point &point) const
Definition Cell.h:190
double volume() const
Definition Cell.h:98
bool contains(const Point &point) const
Definition Cell.cpp:25
double radius_ratio() const
Definition Cell.h:167
void get_coordinate_dofs(std::vector< double > &coordinates) const
Get cell coordinate dofs (not vertex coordinates).
Definition Cell.h:293
void get_cell_topology(ufc::cell &ufc_cell) const
Fill UFC cell with topology data.
Definition Cell.h:369
bool ordered(const std::vector< std::int64_t > &local_to_global_vertex_indices) const
Definition Cell.h:248
void get_vertex_coordinates(std::vector< double > &coordinates) const
Get cell vertex coordinates (not coordinate dofs).
Definition Cell.h:339
~Cell()
Destructor.
Definition Cell.h:59
Cell(const Mesh &mesh, std::size_t index)
Definition Cell.h:55
double squared_distance(const Point &point) const
Definition Cell.h:181
Cell()
Create empty cell.
Definition Cell.h:47
Point normal(std::size_t facet) const
Definition Cell.h:214
std::vector< Point > intersection(const MeshEntity &entity) const
Definition Cell.cpp:41
Point cell_normal() const
Definition Cell.h:221
double circumradius() const
Definition Cell.h:128
double normal(std::size_t facet, std::size_t i) const
Definition Cell.h:204
bool collides(const Point &point) const
Definition Cell.cpp:30
CellType::Type type() const
Return type of cell.
Definition Cell.h:62
void get_cell_data(ufc::cell &ufc_cell, int local_facet=-1) const
Fill UFC cell with miscellaneous data.
Definition Cell.h:352
std::size_t orientation() const
Definition Cell.h:73
std::size_t orientation(const Point &up) const
Definition Cell.h:83
std::size_t num_vertices() const
Return number of vertices of cell.
Definition Cell.h:66
void order(const std::vector< std::int64_t > &local_to_global_vertex_indices)
Definition Cell.h:238
Base class for MeshEntityIterators.
Definition MeshEntityIteratorBase.h:37
Definition MeshEntity.h:43
const Mesh & mesh() const
Definition MeshEntity.h:99
const unsigned int * entities(std::size_t dim) const
Definition MeshEntity.h:163
std::size_t dim() const
Definition MeshEntity.h:106
MeshEntity()
Default Constructor.
Definition MeshEntity.h:47
std::size_t index() const
Definition MeshEntity.h:113
std::size_t num_entities(std::size_t dim) const
Definition MeshEntity.h:140
std::size_t mesh_id() const
Definition MeshEntity.h:175
std::int64_t global_index() const
Definition MeshEntity.h:122
MeshGeometry stores the geometry imposed on a mesh.
Definition MeshGeometry.h:40
std::size_t get_entity_index(std::size_t entity_dim, std::size_t order, std::size_t index) const
Get the index for an entity point in coordinates.
Definition MeshGeometry.h:153
std::size_t dim() const
Return Euclidean dimension of coordinate system.
Definition MeshGeometry.h:56
std::size_t degree() const
Return polynomial degree of coordinate field.
Definition MeshGeometry.h:60
double x(std::size_t n, std::size_t i) const
Return value of coordinate with local index n in direction i.
Definition MeshGeometry.h:99
Definition MeshTopology.h:47
std::size_t dim() const
Return topological dimension.
Definition MeshTopology.cpp:70
bool have_global_indices(std::size_t dim) const
Definition MeshTopology.h:115
const std::vector< std::int64_t > & global_indices(std::size_t d) const
Definition MeshTopology.h:107
void dolfin_error(std::string location, std::string task, std::string reason,...)
Definition log.cpp:129
MeshEntityIteratorBase< Cell > CellIterator
A CellIterator is a MeshEntityIterator of topological codimension 0.
Definition Cell.h:414