Loading...
Searching...
No Matches
GenericDofMap.h
// Copyright (C) 2010-2015 Anders Logg and Garth N. Wells
//
// This file is part of DOLFIN.
//
// DOLFIN is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// DOLFIN is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
#ifndef __GENERIC_DOF_MAP_H
#define __GENERIC_DOF_MAP_H
#include <map>
#include <utility>
#include <vector>
#include <memory>
#include <unordered_map>
#include <unordered_set>
#include <Eigen/Dense>
#include <dolfin/common/types.h>
#include <dolfin/common/Variable.h>
#include <dolfin/la/IndexMap.h>
#include <dolfin/log/log.h>
namespace ufc
{
class cell;
}
namespace dolfin
{
class Cell;
class GenericVector;
class Mesh;
class SubDomain;
class GenericDofMap : public Variable
{
public:
GenericDofMap()
{}
virtual bool is_view() const = 0;
virtual std::size_t global_dimension() const = 0;
std::size_t cell_dimension(std::size_t index) const
{
// TODO: Add deprecation warning
return num_element_dofs(index);
}
std::size_t max_cell_dimension() const
{
// TODO: Add deprecation warning
return max_element_dofs();
}
virtual std::size_t num_element_dofs(std::size_t index) const = 0;
virtual std::size_t max_element_dofs() const = 0;
virtual std::size_t num_entity_dofs(std::size_t entity_dim) const = 0;
virtual std::size_t num_entity_closure_dofs(std::size_t entity_dim) const = 0;
virtual std::size_t num_facet_dofs() const = 0;
virtual std::pair<std::size_t, std::size_t> ownership_range() const = 0;
virtual const std::vector<int>& off_process_owner() const = 0;
virtual Eigen::Map<const Eigen::Array<dolfin::la_index, Eigen::Dynamic, 1>>
cell_dofs(std::size_t cell_index) const = 0;
virtual std::vector<dolfin::la_index>
entity_dofs(const Mesh& mesh, std::size_t entity_dim,
const std::vector<std::size_t> & entity_indices) const = 0;
virtual std::vector<dolfin::la_index>
entity_dofs(const Mesh& mesh, std::size_t entity_dim) const = 0;
virtual 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 = 0;
virtual std::vector<dolfin::la_index>
entity_closure_dofs(const Mesh& mesh, std::size_t entity_dim) const = 0;
virtual void tabulate_facet_dofs(std::vector<std::size_t>& element_dofs,
std::size_t cell_facet_index) const = 0;
virtual void tabulate_entity_dofs(std::vector<std::size_t>& element_dofs,
std::size_t entity_dim,
std::size_t cell_entity_index) const = 0;
virtual void tabulate_entity_closure_dofs(std::vector<std::size_t>& element_dofs,
std::size_t entity_dim,
std::size_t cell_entity_index) const = 0;
virtual void tabulate_global_dofs(std::vector<std::size_t>& dofs) const = 0;
virtual std::shared_ptr<GenericDofMap> copy() const = 0;
virtual std::shared_ptr<GenericDofMap>
create(const Mesh& new_mesh) const = 0;
virtual std::shared_ptr<GenericDofMap>
extract_sub_dofmap(const std::vector<std::size_t>& component,
const Mesh& mesh) const = 0;
virtual std::shared_ptr<GenericDofMap>
collapse(std::unordered_map<std::size_t, std::size_t>& collapsed_map,
const Mesh& mesh) const = 0;
virtual std::vector<dolfin::la_index> dofs(const Mesh& mesh,
std::size_t dim) const = 0;
virtual std::vector<dolfin::la_index> dofs() const = 0;
virtual void set(GenericVector& x, double value) const = 0;
virtual const std::vector<std::size_t>& local_to_global_unowned() const = 0;
virtual std::shared_ptr<const IndexMap> index_map() const = 0;
virtual void tabulate_local_to_global_dofs(std::vector<std::size_t>& local_to_global_map) const = 0;
virtual std::size_t local_to_global_index(int local_index) const = 0;
virtual const std::unordered_map<int, std::vector<int>>&
shared_nodes() const = 0;
virtual const std::set<int>& neighbours() const = 0;
virtual void clear_sub_map_data() = 0;
virtual std::string str(bool verbose) const = 0;
virtual int block_size() const = 0;
std::shared_ptr<const SubDomain> constrained_domain;
};
}
#endif
dolfin::Cell
A Cell is a MeshEntity of topological codimension 0.
Definition Cell.h:43
dolfin::GenericDofMap::num_entity_closure_dofs
virtual std::size_t num_entity_closure_dofs(std::size_t entity_dim) const =0
Return the number of dofs for closure of entity of given dimension.
dolfin::GenericDofMap::max_element_dofs
virtual std::size_t max_element_dofs() const =0
dolfin::GenericDofMap::copy
virtual std::shared_ptr< GenericDofMap > copy() const =0
Create a copy of the dof map.
dolfin::GenericDofMap::ownership_range
virtual std::pair< std::size_t, std::size_t > ownership_range() const =0
dolfin::GenericDofMap::neighbours
virtual const std::set< int > & neighbours() const =0
Return set of processes that share dofs with the this process.
dolfin::GenericDofMap::is_view
virtual bool is_view() const =0
True if dof map is a view into another map (is a sub-dofmap).
dolfin::GenericDofMap::num_element_dofs
virtual std::size_t num_element_dofs(std::size_t index) const =0
dolfin::GenericDofMap::constrained_domain
std::shared_ptr< const SubDomain > constrained_domain
Definition GenericDofMap.h:212
dolfin::GenericDofMap::entity_dofs
virtual std::vector< dolfin::la_index > entity_dofs(const Mesh &mesh, std::size_t entity_dim) const =0
Return the dof indices associated with all entities of given dimension.
dolfin::GenericDofMap::tabulate_entity_dofs
virtual void tabulate_entity_dofs(std::vector< std::size_t > &element_dofs, std::size_t entity_dim, std::size_t cell_entity_index) const =0
dolfin::GenericDofMap::index_map
virtual std::shared_ptr< const IndexMap > index_map() const =0
Index map (const access).
dolfin::GenericDofMap::GenericDofMap
GenericDofMap()
Constructor.
Definition GenericDofMap.h:54
dolfin::GenericDofMap::max_cell_dimension
std::size_t max_cell_dimension() const
Definition GenericDofMap.h:74
dolfin::GenericDofMap::tabulate_local_to_global_dofs
virtual void tabulate_local_to_global_dofs(std::vector< std::size_t > &local_to_global_map) const =0
Tabulate map between local (process) and global dof indices.
dolfin::GenericDofMap::entity_closure_dofs
virtual std::vector< dolfin::la_index > entity_closure_dofs(const Mesh &mesh, std::size_t entity_dim) const =0
dolfin::GenericDofMap::collapse
virtual std::shared_ptr< GenericDofMap > collapse(std::unordered_map< std::size_t, std::size_t > &collapsed_map, const Mesh &mesh) const =0
Create a "collapsed" a dofmap (collapses from a sub-dofmap view).
dolfin::GenericDofMap::local_to_global_unowned
virtual const std::vector< std::size_t > & local_to_global_unowned() const =0
dolfin::GenericDofMap::cell_dofs
virtual Eigen::Map< const Eigen::Array< dolfin::la_index, Eigen::Dynamic, 1 > > cell_dofs(std::size_t cell_index) const =0
Local-to-global mapping of dofs on a cell.
dolfin::GenericDofMap::global_dimension
virtual std::size_t global_dimension() const =0
dolfin::GenericDofMap::dofs
virtual std::vector< dolfin::la_index > dofs(const Mesh &mesh, std::size_t dim) const =0
dolfin::GenericDofMap::entity_closure_dofs
virtual 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 =0
dolfin::GenericDofMap::str
virtual std::string str(bool verbose) const =0
Return informal string representation (pretty-print).
dolfin::GenericDofMap::clear_sub_map_data
virtual void clear_sub_map_data()=0
dolfin::GenericDofMap::dofs
virtual std::vector< dolfin::la_index > dofs() const =0
Return list of global dof indices on this process.
dolfin::GenericDofMap::block_size
virtual int block_size() const =0
Get block size.
dolfin::GenericDofMap::extract_sub_dofmap
virtual std::shared_ptr< GenericDofMap > extract_sub_dofmap(const std::vector< std::size_t > &component, const Mesh &mesh) const =0
Extract sub dofmap component.
dolfin::GenericDofMap::num_facet_dofs
virtual std::size_t num_facet_dofs() const =0
Return number of facet dofs.
dolfin::GenericDofMap::local_to_global_index
virtual std::size_t local_to_global_index(int local_index) const =0
Return global dof index corresponding to a given local index.
dolfin::GenericDofMap::tabulate_facet_dofs
virtual void tabulate_facet_dofs(std::vector< std::size_t > &element_dofs, std::size_t cell_facet_index) const =0
Tabulate local-local facet dofs.
dolfin::GenericDofMap::tabulate_global_dofs
virtual void tabulate_global_dofs(std::vector< std::size_t > &dofs) const =0
Tabulate globally supported dofs.
dolfin::GenericDofMap::entity_dofs
virtual std::vector< dolfin::la_index > entity_dofs(const Mesh &mesh, std::size_t entity_dim, const std::vector< std::size_t > &entity_indices) const =0
Return the dof indices associated with entities of given dimension and entity indices.
dolfin::GenericDofMap::shared_nodes
virtual const std::unordered_map< int, std::vector< int > > & shared_nodes() const =0
dolfin::GenericDofMap::create
virtual std::shared_ptr< GenericDofMap > create(const Mesh &new_mesh) const =0
Create a new dof map on new mesh.
dolfin::GenericDofMap::off_process_owner
virtual const std::vector< int > & off_process_owner() const =0
dolfin::GenericDofMap::num_entity_dofs
virtual std::size_t num_entity_dofs(std::size_t entity_dim) const =0
Return the number of dofs for a given entity dimension.
dolfin::GenericDofMap::tabulate_entity_closure_dofs
virtual void tabulate_entity_closure_dofs(std::vector< std::size_t > &element_dofs, std::size_t entity_dim, std::size_t cell_entity_index) const =0
dolfin::GenericDofMap::set
virtual void set(GenericVector &x, double value) const =0
dolfin::GenericDofMap::cell_dimension
std::size_t cell_dimension(std::size_t index) const
Definition GenericDofMap.h:66
dolfin::GenericVector
This class defines a common interface for vectors.
Definition GenericVector.h:48
dolfin::Mesh
Definition Mesh.h:84
dolfin::SubDomain
Definition SubDomain.h:43
dolfin::Variable::Variable
Variable()
Create unnamed variable.
Definition Variable.cpp:31
dolfin
Definition adapt.h:30