31 #include "MeshEntity.h" 32 #include "MeshEntityIteratorBase.h" 33 #include "MeshFunction.h" 35 #include <dolfin/geometry/Point.h> 114 {
return _mesh->
type().
h(*
this); }
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); }
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)
303 coordinates.resize(num_vertices*gdim);
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)
312 const unsigned int* edges = this->
entities(1);
314 coordinates.resize((num_vertices + num_edges)*gdim);
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");
343 const unsigned int* vertices = this->
entities(0);
344 coordinates.resize(num_vertices*gdim);
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;
357 ufc_cell.orientation = -1;
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;
376 ufc_cell.orientation = -1;
382 ufc_cell.entity_indices.resize(tdim + 1);
383 for (std::size_t d = 0; d < tdim; d++)
386 if (topology.have_global_indices(d))
388 const std::vector<std::int64_t>& global_indices
389 = topology.global_indices(d);
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);
400 if (topology.have_global_indices(tdim))
403 ufc_cell.entity_indices[tdim][0] =
index();
408 ufc_cell.index = ufc_cell.entity_indices[tdim][0];
std::int64_t global_index() const
Definition: MeshEntity.h:122
MeshEntityIteratorBase< Cell > CellIterator
A CellIterator is a MeshEntityIterator of topological codimension 0.
Definition: Cell.h:414
MeshGeometry stores the geometry imposed on a mesh.
Definition: MeshGeometry.h:39
Definition: MeshTopology.h:46
const Mesh & mesh() const
Definition: MeshEntity.h:99
Cell(const Mesh &mesh, std::size_t index)
Definition: Cell.h:55
std::size_t index() const
Definition: MeshEntity.h:113
double distance(const Point &point) const
Definition: Cell.h:190
std::size_t num_vertices() const
Return number of vertices for cell.
Definition: CellType.h:92
bool ordered(const std::vector< std::int64_t > &local_to_global_vertex_indices) const
Definition: Cell.h:248
double facet_area(std::size_t facet) const
Definition: Cell.h:231
double squared_distance(const Point &point) const
Definition: Cell.h:181
virtual double normal(const Cell &cell, std::size_t facet, std::size_t i) const =0
Compute component i of normal of given facet with respect to the cell.
virtual double inradius(const Cell &cell) const
Compute inradius of cell.
Definition: CellType.cpp:178
Cell()
Create empty cell.
Definition: Cell.h:47
std::size_t init(std::size_t dim) const
Definition: Mesh.cpp:138
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
MeshGeometry & geometry()
Definition: Mesh.h:233
std::size_t degree() const
Return polynomial degree of coordinate field.
Definition: MeshGeometry.h:60
Point normal(std::size_t facet) const
Definition: Cell.h:214
double inradius() const
Definition: Cell.h:143
bool collides(const Point &point) const
Definition: Cell.cpp:30
void order(const std::vector< std::int64_t > &local_to_global_vertex_indices)
Definition: Cell.h:238
void get_vertex_coordinates(std::vector< double > &coordinates) const
Get cell vertex coordinates (not coordinate dofs)
Definition: Cell.h:339
Point cell_normal() const
Definition: Cell.h:221
Type
Enum for different cell types.
Definition: CellType.h:51
virtual double facet_area(const Cell &cell, std::size_t facet) const =0
Compute the area/length of given facet with respect to the cell.
virtual double h(const MeshEntity &entity) const
Compute greatest distance between any two vertices.
Definition: CellType.cpp:151
std::size_t dim() const
Definition: MeshEntity.h:106
std::vector< Point > intersection(const MeshEntity &entity) const
Definition: Cell.cpp:41
void get_cell_topology(ufc::cell &ufc_cell) const
Fill UFC cell with topology data.
Definition: Cell.h:369
double circumradius() const
Definition: Cell.h:128
A Cell is a MeshEntity of topological codimension 0.
Definition: Cell.h:42
bool contains(const Point &point) const
Definition: Cell.cpp:25
virtual double volume(const MeshEntity &entity) const =0
Compute (generalized) volume of mesh entity.
CellType & type()
Definition: Mesh.h:283
MeshTopology & topology()
Definition: Mesh.h:219
std::size_t num_vertices() const
Return number of vertices of cell.
Definition: Cell.h:66
std::size_t orientation(const Point &up) const
Definition: Cell.h:83
CellType::Type type() const
Return type of cell.
Definition: Cell.h:62
double radius_ratio() const
Definition: Cell.h:167
double normal(std::size_t facet, std::size_t i) const
Definition: Cell.h:204
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::size_t orientation() const
Definition: Cell.h:73
virtual double radius_ratio(const Cell &cell) const
Compute dim*inradius/circumradius for given cell.
Definition: CellType.cpp:210
double volume() const
Definition: Cell.h:98
virtual double circumradius(const MeshEntity &entity) const =0
Compute circumradius of mesh entity.
virtual Point cell_normal(const Cell &cell) const =0
Compute normal to given cell (viewed as embedded in 3D)
Type cell_type() const
Return type of cell.
Definition: CellType.h:72
~Cell()
Destructor.
Definition: Cell.h:59
Definition: MeshEntity.h:42
virtual double squared_distance(const Cell &cell, const Point &point) const =0
Compute squared distance to given point.
const std::vector< int > & cell_orientations() const
Definition: Mesh.cpp:432
void dolfin_error(std::string location, std::string task, std::string reason,...)
Definition: log.cpp:129
bool ordered(const Cell &cell, const std::vector< std::int64_t > &local_to_global_vertex_indices) const
Check if entities are ordered.
Definition: CellType.cpp:221
const unsigned int * entities(std::size_t dim) const
Definition: MeshEntity.h:163
std::size_t dim() const
Return Euclidean dimension of coordinate system.
Definition: MeshGeometry.h:56
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
virtual std::size_t dim() const =0
Return topological dimension of cell.
virtual std::size_t orientation(const Cell &cell) const =0
Return orientation of the cell (assuming flat space)
virtual void order(Cell &cell, const std::vector< std::int64_t > &local_to_global_vertex_indices) const =0
Order entities locally.
void get_coordinate_dofs(std::vector< double > &coordinates) const
Get cell coordinate dofs (not vertex coordinates)
Definition: Cell.h:293
void get_cell_data(ufc::cell &ufc_cell, int local_facet=-1) const
Fill UFC cell with miscellaneous data.
Definition: Cell.h:352
double h() const
Definition: Cell.h:113
Base class for MeshEntityIterators.
Definition: MeshEntityIteratorBase.h:36
std::size_t dim() const
Return topological dimension.
Definition: MeshTopology.cpp:70