Note: this is documentation for an old release. View the latest documentation at docs.fenicsproject.org/dolfinx/v0.9.0/cpp/doxygen/d6/df3/FunctionSpace_8h_source.html
DOLFINx 0.6.0
DOLFINx C++ interface
Loading...
Searching...
No Matches
FunctionSpace.h
1// Copyright (C) 2008-2022 Anders Logg and Garth N. Wells
2//
3// This file is part of DOLFINx (https://www.fenicsproject.org)
4//
5// SPDX-License-Identifier: LGPL-3.0-or-later
6
7#pragma once
8
9#include <boost/uuid/uuid.hpp>
10#include <cstddef>
11#include <cstdint>
12#include <map>
13#include <memory>
14#include <vector>
15
16namespace dolfinx::mesh
17{
18class Mesh;
19}
20
21namespace dolfinx::fem
22{
23class DofMap;
24class FiniteElement;
25
29
31{
32public:
37 FunctionSpace(std::shared_ptr<const mesh::Mesh> mesh,
38 std::shared_ptr<const FiniteElement> element,
39 std::shared_ptr<const DofMap> dofmap);
40
41 // Copy constructor (deleted)
42 FunctionSpace(const FunctionSpace& V) = delete;
43
46
48 virtual ~FunctionSpace() = default;
49
50 // Assignment operator (delete)
51 FunctionSpace& operator=(const FunctionSpace& V) = delete;
52
55
59 std::shared_ptr<FunctionSpace> sub(const std::vector<int>& component) const;
60
65 bool contains(const FunctionSpace& V) const;
66
70 std::pair<FunctionSpace, std::vector<std::int32_t>> collapse() const;
71
75 std::vector<int> component() const;
76
86 std::vector<double> tabulate_dof_coordinates(bool transpose) const;
87
89 std::shared_ptr<const mesh::Mesh> mesh() const;
90
92 std::shared_ptr<const FiniteElement> element() const;
93
95 std::shared_ptr<const DofMap> dofmap() const;
96
97private:
98 // The mesh
99 std::shared_ptr<const mesh::Mesh> _mesh;
100
101 // The finite element
102 std::shared_ptr<const FiniteElement> _element;
103
104 // The dofmap
105 std::shared_ptr<const DofMap> _dofmap;
106
107 // The component w.r.t. to root space
108 std::vector<int> _component;
109
110 // Unique identifier for the space and for its root space
111 boost::uuids::uuid _id;
112 boost::uuids::uuid _root_space_id;
113
114 // Cache of subspaces
115 mutable std::map<std::vector<int>, std::weak_ptr<FunctionSpace>> _subspaces;
116};
117
127std::array<std::vector<std::shared_ptr<const FunctionSpace>>, 2>
129 const std::vector<
130 std::vector<std::array<std::shared_ptr<const FunctionSpace>, 2>>>& V);
131} // namespace dolfinx::fem
This class represents a finite element function space defined by a mesh, a finite element,...
Definition: FunctionSpace.h:31
std::vector< int > component() const
Get the component with respect to the root superspace.
Definition: FunctionSpace.cpp:117
FunctionSpace & operator=(FunctionSpace &&V)=default
Move assignment operator.
std::pair< FunctionSpace, std::vector< std::int32_t > > collapse() const
Collapse a subspace and return a new function space and a map from new to old dofs.
Definition: FunctionSpace.cpp:101
std::shared_ptr< const DofMap > dofmap() const
The dofmap.
Definition: FunctionSpace.cpp:253
std::vector< double > tabulate_dof_coordinates(bool transpose) const
Tabulate the physical coordinates of all dofs on this process.
Definition: FunctionSpace.cpp:120
bool contains(const FunctionSpace &V) const
Check whether V is subspace of this, or this itself.
Definition: FunctionSpace.cpp:69
virtual ~FunctionSpace()=default
Destructor.
std::shared_ptr< const mesh::Mesh > mesh() const
The mesh.
Definition: FunctionSpace.cpp:246
std::shared_ptr< FunctionSpace > sub(const std::vector< int > &component) const
Extract subspace for component.
Definition: FunctionSpace.cpp:33
std::shared_ptr< const FiniteElement > element() const
The finite element.
Definition: FunctionSpace.cpp:248
FunctionSpace(FunctionSpace &&V)=default
Move constructor.
Finite element method functionality.
Definition: assemble_matrix_impl.h:25
std::array< std::vector< std::shared_ptr< const FunctionSpace > >, 2 > common_function_spaces(const std::vector< std::vector< std::array< std::shared_ptr< const FunctionSpace >, 2 > > > &V)
Extract FunctionSpaces for (0) rows blocks and (1) columns blocks from a rectangular array of (test,...
Definition: FunctionSpace.cpp:256
Mesh data structures and algorithms on meshes.
Definition: DofMap.h:31