25 #ifndef __DOLFIN_DOF_MAP_H 26 #define __DOLFIN_DOF_MAP_H 31 #include <unordered_map> 34 #include <Eigen/Dense> 37 #include <dolfin/common/types.h> 38 #include <dolfin/la/IndexMap.h> 39 #include <dolfin/mesh/Cell.h> 40 #include "GenericDofMap.h" 64 DofMap(std::shared_ptr<const ufc::dofmap> ufc_dofmap,
75 DofMap(std::shared_ptr<const ufc::dofmap> ufc_dofmap,
82 const std::vector<std::size_t>& component,
86 DofMap(std::unordered_map<std::size_t, std::size_t>& collapsed_map,
171 {
return _index_map->off_process_owner(); }
178 const std::unordered_map<int, std::vector<int>>&
shared_nodes()
const;
191 _ufc_local_to_local.clear();
200 Eigen::Map<const Eigen::Array<dolfin::la_index, Eigen::Dynamic, 1>>
203 const std::size_t index = cell_index*_cell_dimension;
204 dolfin_assert(index + _cell_dimension <= _dofmap.size());
205 return Eigen::Map<const Eigen::Array<dolfin::la_index, Eigen::Dynamic, 1>>(&_dofmap[index], _cell_dimension);
218 std::vector<dolfin::la_index>
220 const std::vector<std::size_t> & entity_indices)
const;
230 std::vector<dolfin::la_index>
244 std::vector<dolfin::la_index>
246 const std::vector<std::size_t> & entity_indices)
const;
257 std::vector<dolfin::la_index>
267 std::size_t cell_facet_index)
const;
278 std::size_t entity_dim, std::size_t cell_entity_index)
const;
289 std::size_t entity_dim, std::size_t cell_entity_index)
const;
297 dolfin_assert(_global_nodes.empty() ||
block_size() == 1);
298 element_dofs.resize(_global_nodes.size());
299 std::copy(_global_nodes.cbegin(), _global_nodes.cend(), element_dofs.begin());
306 std::shared_ptr<GenericDofMap>
copy()
const;
315 std::shared_ptr<GenericDofMap>
create(
const Mesh& new_mesh)
const;
327 std::shared_ptr<GenericDofMap>
329 const Mesh& mesh)
const;
340 std::shared_ptr<GenericDofMap>
341 collapse(std::unordered_map<std::size_t, std::size_t>&
342 collapsed_map,
const Mesh& mesh)
const;
347 std::vector<dolfin::la_index>
dofs(
const Mesh& mesh,
348 std::size_t dim)
const;
351 std::vector<dolfin::la_index>
dofs()
const;
366 {
return _index_map; }
371 {
return _index_map->block_size(); }
388 {
return _index_map->local_to_global(local_index); }
392 {
return _index_map->local_to_global_unowned(); }
401 std::string
str(
bool verbose)
const;
409 static void check_dimensional_consistency(
const ufc::dofmap& dofmap,
413 static void check_provided_entities(
const ufc::dofmap& dofmap,
417 std::vector<dolfin::la_index> _dofmap;
420 std::set<std::size_t> _global_nodes;
423 std::size_t _cell_dimension;
426 std::shared_ptr<const ufc::dofmap> _ufc_dofmap;
433 std::vector<std::size_t> _num_mesh_entities_global;
437 std::vector<int> _ufc_local_to_local;
444 std::size_t _global_dimension;
447 std::size_t _ufc_offset;
450 std::size_t _multimesh_offset;
454 std::shared_ptr<IndexMap> _index_map;
460 std::unordered_map<int, std::vector<int>> _shared_nodes;
463 std::set<int> _neighbours;
std::vector< dolfin::la_index > entity_dofs(const Mesh &mesh, std::size_t entity_dim, const std::vector< std::size_t > &entity_indices) const
Definition: DofMap.cpp:310
std::size_t num_facet_dofs() const
Definition: DofMap.cpp:178
std::size_t num_element_dofs(std::size_t cell_index) const
Definition: DofMap.cpp:155
virtual std::size_t num_entity_closure_dofs(std::size_t entity_dim) const
Definition: DofMap.cpp:172
This class provides a generic interface for dof maps.
Definition: GenericDofMap.h:49
const std::set< int > & neighbours() const
Definition: DofMap.cpp:194
void clear_sub_map_data()
Definition: DofMap.h:188
std::string str(bool verbose) const
Definition: DofMap.cpp:631
std::pair< std::size_t, std::size_t > ownership_range() const
Definition: DofMap.cpp:184
const std::unordered_map< int, std::vector< int > > & shared_nodes() const
Definition: DofMap.cpp:189
std::size_t global_dimension() const
Definition: DofMap.cpp:150
const std::vector< int > & off_process_owner() const
Definition: DofMap.h:170
void tabulate_entity_closure_dofs(std::vector< std::size_t > &element_dofs, std::size_t entity_dim, std::size_t cell_entity_index) const
Definition: DofMap.cpp:442
std::shared_ptr< const IndexMap > index_map() const
Return the map (const access)
Definition: DofMap.h:365
std::shared_ptr< GenericDofMap > copy() const
Definition: DofMap.cpp:453
const std::vector< std::size_t > & local_to_global_unowned() const
Return indices of dofs which are owned by other processes.
Definition: DofMap.h:391
std::shared_ptr< GenericDofMap > extract_sub_dofmap(const std::vector< std::size_t > &component, const Mesh &mesh) const
Definition: DofMap.cpp:466
Degree-of-freedom map.
Definition: DofMap.h:54
std::vector< dolfin::la_index > dofs() const
Return list of global dof indices on this process.
Definition: DofMap.cpp:551
DofMap(std::shared_ptr< const ufc::dofmap > ufc_dofmap, const Mesh &mesh)
Definition: DofMap.cpp:42
Eigen::Map< const Eigen::Array< dolfin::la_index, Eigen::Dynamic, 1 > > cell_dofs(std::size_t cell_index) const
Definition: DofMap.h:201
bool is_view() const
Definition: DofMap.h:103
std::size_t max_element_dofs() const
Definition: DofMap.cpp:160
int block_size() const
Definition: DofMap.h:370
std::size_t local_to_global_index(int local_index) const
Definition: DofMap.h:387
void tabulate_entity_dofs(std::vector< std::size_t > &element_dofs, std::size_t entity_dim, std::size_t cell_entity_index) const
Definition: DofMap.cpp:430
Definition: MultiMeshDofMap.h:37
virtual std::size_t num_entity_dofs(std::size_t entity_dim) const
Definition: DofMap.cpp:166
std::shared_ptr< const SubDomain > constrained_domain
Definition: GenericDofMap.h:212
void tabulate_facet_dofs(std::vector< std::size_t > &element_dofs, std::size_t cell_facet_index) const
Definition: DofMap.cpp:421
std::shared_ptr< GenericDofMap > create(const Mesh &new_mesh) const
Definition: DofMap.cpp:458
Builds a DofMap on a Mesh.
Definition: DofMapBuilder.h:50
~DofMap()
Destructor.
Definition: DofMap.cpp:145
This class defines a common interface for vectors.
Definition: GenericVector.h:47
void tabulate_global_dofs(std::vector< std::size_t > &element_dofs) const
Definition: DofMap.h:295
std::vector< dolfin::la_index > entity_closure_dofs(const Mesh &mesh, std::size_t entity_dim, const std::vector< std::size_t > &entity_indices) const
Definition: DofMap.cpp:199
std::shared_ptr< GenericDofMap > collapse(std::unordered_map< std::size_t, std::size_t > &collapsed_map, const Mesh &mesh) const
Definition: DofMap.cpp:473
void tabulate_local_to_global_dofs(std::vector< std::size_t > &local_to_global_map) const
Definition: DofMap.cpp:592